playcanvas
Version:
PlayCanvas WebGL game engine
6 lines • 1.2 MB
JavaScript
/**
* @license
* PlayCanvas Engine v1.41.0-dev revision bbc2326ad
* Copyright 2011-2021 PlayCanvas Ltd. All rights reserved.
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).pc={})}(this,(function(e){"use strict";Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(e){if(null==this)throw TypeError('"this" is null or not defined');var t=Object(this),i=t.length>>>0;if("function"!=typeof e)throw TypeError("predicate must be a function");for(var n=arguments[1],s=0;s<i;){var r=t[s];if(e.call(n,r,s,t))return r;s++}},configurable:!0,writable:!0}),Array.prototype.findIndex||Object.defineProperty(Array.prototype,"findIndex",{value:function(e){if(null==this)throw new TypeError('"this" is null or not defined');var t=Object(this),i=t.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var n=arguments[1],s=0;s<i;){var r=t[s];if(e.call(n,r,s,t))return s;s++}return-1},configurable:!0,writable:!0}),Math.log2=Math.log2||function(e){return Math.log(e)*Math.LOG2E},Math.sign||(Math.sign=function(e){return(e>0)-(e<0)||+e}),void 0===Number.isFinite&&(Number.isFinite=function(e){return"number"==typeof e&&isFinite(e)}),"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var i=Object(e),n=1;n<arguments.length;n++){var s=arguments[n];if(null!=s)for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(i[r]=s[r])}return i},writable:!0,configurable:!0}),function(){if("undefined"!=typeof navigator&&"undefined"!=typeof document){navigator.pointer=navigator.pointer||navigator.webkitPointer||navigator.mozPointer;var e=function(){var e=document.createEvent("CustomEvent");e.initCustomEvent("pointerlockchange",!0,!1,null),document.dispatchEvent(e)},t=function(){var e=document.createEvent("CustomEvent");e.initCustomEvent("pointerlockerror",!0,!1,null),document.dispatchEvent(e)};document.addEventListener("webkitpointerlockchange",e,!1),document.addEventListener("webkitpointerlocklost",e,!1),document.addEventListener("mozpointerlockchange",e,!1),document.addEventListener("mozpointerlocklost",e,!1),document.addEventListener("webkitpointerlockerror",t,!1),document.addEventListener("mozpointerlockerror",t,!1),Element.prototype.mozRequestPointerLock?Element.prototype.requestPointerLock=function(){this.mozRequestPointerLock()}:Element.prototype.requestPointerLock=Element.prototype.requestPointerLock||Element.prototype.webkitRequestPointerLock||Element.prototype.mozRequestPointerLock,!Element.prototype.requestPointerLock&&navigator.pointer&&(Element.prototype.requestPointerLock=function(){document.pointerLockElement=this,navigator.pointer.lock(this,e,t)}),document.exitPointerLock=document.exitPointerLock||document.webkitExitPointerLock||document.mozExitPointerLock,document.exitPointerLock||(document.exitPointerLock=function(){navigator.pointer&&(document.pointerLockElement=null,navigator.pointer.unlock())})}}(),function(){if("undefined"!=typeof window){for(var e=0,t=["ms","moz","webkit","o"],i=0;i<t.length&&!window.requestAnimationFrame;++i)window.requestAnimationFrame=window[t[i]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[t[i]+"CancelAnimationFrame"]||window[t[i]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(t,i){var n=(new Date).getTime(),s=Math.max(0,16-(n-e)),r=window.setTimeout((function(){t(n+s)}),s);return e=n+s,r}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(e){clearTimeout(e)})}}(),String.prototype.endsWith||(String.prototype.endsWith=function(e,t){return(void 0===t||t>this.length)&&(t=this.length),this.substring(t-e.length,t)===e}),String.prototype.includes||(String.prototype.includes=function(e,t){return"number"!=typeof t&&(t=0),!(t+e.length>this.length)&&-1!==this.indexOf(e,t)}),String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return this.substr(!t||t<0?0:+t,e.length)===e}),function(){var e={};function t(t,i){var n;e[t]=!0,void 0!==i&&(n=i,window.console&&window.console.error&&window.console.error(n))}var i=function e(t){var i=t.gl;this.ext=t,this.isAlive=!0,this.hasBeenBound=!1,this.elementArrayBuffer=null,this.attribs=new Array(t.maxVertexAttribs);for(var n=0;n<this.attribs.length;n++){var s=new e.VertexAttrib(i);this.attribs[n]=s}this.maxAttrib=0};(i.VertexAttrib=function(e){this.enabled=!1,this.buffer=null,this.size=4,this.type=e.FLOAT,this.normalized=!1,this.stride=16,this.offset=0,this.cached="",this.recache()}).prototype.recache=function(){this.cached=[this.size,this.type,this.normalized,this.stride,this.offset].join(":")};var n=function(t){var i=this;this.gl=t,function(t){var i=t.getError;t.getError=function(){do{(n=i.apply(t))!=t.NO_ERROR&&(e[n]=!0)}while(n!=t.NO_ERROR);for(var n in e)if(e[n])return delete e[n],parseInt(n);return t.NO_ERROR}}(t);var n=this.original={getParameter:t.getParameter,enableVertexAttribArray:t.enableVertexAttribArray,disableVertexAttribArray:t.disableVertexAttribArray,bindBuffer:t.bindBuffer,getVertexAttrib:t.getVertexAttrib,vertexAttribPointer:t.vertexAttribPointer};t.getParameter=function(e){return e==i.VERTEX_ARRAY_BINDING_OES?i.currentVertexArrayObject==i.defaultVertexArrayObject?null:i.currentVertexArrayObject:n.getParameter.apply(this,arguments)},t.enableVertexAttribArray=function(e){var t=i.currentVertexArrayObject;t.maxAttrib=Math.max(t.maxAttrib,e);var s=t.attribs[e];return s.enabled=!0,n.enableVertexAttribArray.apply(this,arguments)},t.disableVertexAttribArray=function(e){var t=i.currentVertexArrayObject;t.maxAttrib=Math.max(t.maxAttrib,e);var s=t.attribs[e];return s.enabled=!1,n.disableVertexAttribArray.apply(this,arguments)},t.bindBuffer=function(e,s){switch(e){case t.ARRAY_BUFFER:i.currentArrayBuffer=s;break;case t.ELEMENT_ARRAY_BUFFER:i.currentVertexArrayObject.elementArrayBuffer=s}return n.bindBuffer.apply(this,arguments)},t.getVertexAttrib=function(e,s){var r=i.currentVertexArrayObject,a=r.attribs[e];switch(s){case t.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:return a.buffer;case t.VERTEX_ATTRIB_ARRAY_ENABLED:return a.enabled;case t.VERTEX_ATTRIB_ARRAY_SIZE:return a.size;case t.VERTEX_ATTRIB_ARRAY_STRIDE:return a.stride;case t.VERTEX_ATTRIB_ARRAY_TYPE:return a.type;case t.VERTEX_ATTRIB_ARRAY_NORMALIZED:return a.normalized;default:return n.getVertexAttrib.apply(this,arguments)}},t.vertexAttribPointer=function(e,t,s,r,a,o){var h=i.currentVertexArrayObject;h.maxAttrib=Math.max(h.maxAttrib,e);var l=h.attribs[e];return l.buffer=i.currentArrayBuffer,l.size=t,l.type=s,l.normalized=r,l.stride=a,l.offset=o,l.recache(),n.vertexAttribPointer.apply(this,arguments)},t.instrumentExtension&&t.instrumentExtension(this,"OES_vertex_array_object"),t.canvas.addEventListener("webglcontextrestored",(function(){var e;e="OESVertexArrayObject emulation library context restored",window.console&&window.console.log&&window.console.log(e),i.reset_()}),!0),this.reset_()};n.prototype.VERTEX_ARRAY_BINDING_OES=34229,n.prototype.reset_=function(){if(void 0!==this.vertexArrayObjects)for(var e=0;e<this.vertexArrayObjects.length;++e)this.vertexArrayObjects.isAlive=!1;var t=this.gl;this.maxVertexAttribs=t.getParameter(t.MAX_VERTEX_ATTRIBS),this.defaultVertexArrayObject=new i(this),this.currentVertexArrayObject=null,this.currentArrayBuffer=null,this.vertexArrayObjects=[this.defaultVertexArrayObject],this.bindVertexArrayOES(null)},n.prototype.createVertexArrayOES=function(){var e=new i(this);return this.vertexArrayObjects.push(e),e},n.prototype.deleteVertexArrayOES=function(e){e.isAlive=!1,this.vertexArrayObjects.splice(this.vertexArrayObjects.indexOf(e),1),this.currentVertexArrayObject==e&&this.bindVertexArrayOES(null)},n.prototype.isVertexArrayOES=function(e){return!!(e&&e instanceof i&&e.hasBeenBound&&e.ext==this)},n.prototype.bindVertexArrayOES=function(e){var i=this.gl;if(!e||e.isAlive){var n=this.original,s=this.currentVertexArrayObject;this.currentVertexArrayObject=e||this.defaultVertexArrayObject,this.currentVertexArrayObject.hasBeenBound=!0;var r=this.currentVertexArrayObject;if(s!=r){s&&r.elementArrayBuffer==s.elementArrayBuffer||n.bindBuffer.call(i,i.ELEMENT_ARRAY_BUFFER,r.elementArrayBuffer);for(var a=this.currentArrayBuffer,o=Math.max(s?s.maxAttrib:0,r.maxAttrib),h=0;h<=o;h++){var l=r.attribs[h],c=s?s.attribs[h]:null;if(s&&l.enabled==c.enabled||(l.enabled?n.enableVertexAttribArray.call(i,h):n.disableVertexAttribArray.call(i,h)),l.enabled){var u=!1;s&&l.buffer==c.buffer||(a!=l.buffer&&(n.bindBuffer.call(i,i.ARRAY_BUFFER,l.buffer),a=l.buffer),u=!0),(u||l.cached!=c.cached)&&n.vertexAttribPointer.call(i,h,l.size,l.type,l.normalized,l.stride,l.offset)}}this.currentArrayBuffer!=a&&n.bindBuffer.call(i,i.ARRAY_BUFFER,this.currentArrayBuffer)}}else t(i.INVALID_OPERATION,"bindVertexArrayOES: attempt to bind deleted arrayObject")},window.setupVertexArrayObject=function(e){if(e.getSupportedExtensions){if(-1!=e.getSupportedExtensions().indexOf("OES_vertex_array_object"))return}else if(e.getExtension){if(e.getExtension("OES_vertex_array_object"))return}if(e.getSupportedExtensions){var t=e.getSupportedExtensions;e.getSupportedExtensions=function(){var e=t.call(this)||[];return e.push("OES_vertex_array_object"),e}}var i=e.getExtension;e.getExtension=function(t){return"OES_vertex_array_object"==t?(e.__OESVertexArrayObject||(e.__OESVertexArrayObject=new n(e)),e.__OESVertexArrayObject):i?i.call(this,t):null}}}();var t=function(){for(var e={},t=["Array","Object","Function","Date","RegExp","Float32Array"],i=0;i<t.length;i++)e["[object "+t[i]+"]"]=t[i].toLowerCase();return e}(),i="1.41.0-dev",n="bbc2326ad";function s(e){if(null===e)return"null";var i=typeof e;return"undefined"===i||"number"===i||"string"===i||"boolean"===i?i:t[Object.prototype.toString.call(e)]}function r(e,t){for(var i in t){var n=t[i];"object"===s(n)?e[i]=r({},n):"array"===s(n)?e[i]=r([],n):e[i]=n}return e}function a(e){return undefined!==e}var o=null,h=null,l=null,c=null;var u={display:function(e){for(var t in o||(o=document.createElement("table"),h=document.createElement("tr"),l=document.createElement("td"),c=document.createElement("td"),o.style.cssText="position:absolute;font-family:sans-serif;font-size:12px;color:#cccccc",o.style.top="0px",o.style.left="0px",o.style.border="thin solid #cccccc",document.body.appendChild(o)),o.innerHTML="",e){var i=h.cloneNode(),n=l.cloneNode(),s=c.cloneNode();n.textContent=t,s.textContent=e[t],i.appendChild(n),i.appendChild(s),o.appendChild(i)}}},d=function(){function e(){this.initEventHandler()}var t=e.prototype;return t.initEventHandler=function(){this._callbacks={},this._callbackActive={}},t._addCallback=function(e,t,i,n){void 0===n&&(n=!1),e&&"string"==typeof e&&t&&(this._callbacks[e]||(this._callbacks[e]=[]),this._callbackActive[e]&&this._callbackActive[e]===this._callbacks[e]&&(this._callbackActive[e]=this._callbackActive[e].slice()),this._callbacks[e].push({callback:t,scope:i||this,once:n}))},t.on=function(e,t,i){return this._addCallback(e,t,i,!1),this},t.off=function(e,t,i){if(e)this._callbackActive[e]&&this._callbackActive[e]===this._callbacks[e]&&(this._callbackActive[e]=this._callbackActive[e].slice());else for(var n in this._callbackActive)this._callbacks[n]&&this._callbacks[n]===this._callbackActive[n]&&(this._callbackActive[n]=this._callbackActive[n].slice());if(e)if(t){var s=this._callbacks[e];if(!s)return this;for(var r=s.length,a=0;a<r;a++)s[a].callback===t&&(i&&s[a].scope!==i||(s[a--]=s[--r]));s.length=r}else this._callbacks[e]&&(this._callbacks[e]=[]);else this._callbacks={};return this},t.fire=function(e,t,i,n,s,r,a,o,h){if(!e||!this._callbacks[e])return this;var l;this._callbackActive[e]?(this._callbackActive[e]===this._callbacks[e]&&(this._callbackActive[e]=this._callbackActive[e].slice()),l=this._callbacks[e].slice()):this._callbackActive[e]=this._callbacks[e];for(var c=0;(l||this._callbackActive[e])&&c<(l||this._callbackActive[e]).length;c++){var u=(l||this._callbackActive[e])[c];if(u.callback.call(u.scope,t,i,n,s,r,a,o,h),u.once){var d=this._callbacks[e].indexOf(u);-1!==d&&(this._callbackActive[e]===this._callbacks[e]&&(this._callbackActive[e]=this._callbackActive[e].slice()),this._callbacks[e].splice(d,1))}}return l||(this._callbackActive[e]=null),this},t.once=function(e,t,i){return this._addCallback(e,t,i,!0),this},t.hasEvent=function(e){return this._callbacks[e]&&0!==this._callbacks[e].length||!1},e}(),f={attach:function(e){var t=f;return e._addCallback=t._addCallback,e.on=t.on,e.off=t.off,e.fire=t.fire,e.once=t.once,e.hasEvent=t.hasEvent,e._callbacks={},e._callbackActive={},e},_addCallback:d.prototype._addCallback,on:d.prototype.on,off:d.prototype.off,fire:d.prototype.fire,once:d.prototype.once,hasEvent:d.prototype.hasEvent},p={create:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}},m={delimiter:"/",join:function(){for(var e=arguments.length,t=arguments[0],i=0;i<e-1;++i){var n=arguments[i],s=arguments[i+1];if(!a(n)||!a(s))throw new Error("undefined argument to pc.path.join");s[0]!==m.delimiter?n&&s&&n[n.length-1]!==m.delimiter&&s[0]!==m.delimiter?t+=m.delimiter+s:t+=s:t=s}return t},normalize:function(e){for(var t=e.startsWith(m.delimiter),i=e.endsWith(m.delimiter),n=e.split("/"),s="",r=[],a=0;a<n.length;a++)""!==n[a]&&"."!==n[a]&&(".."===n[a]&&r.length>0?r=r.slice(0,r.length-2):(a>0&&r.push(m.delimiter),r.push(n[a])));return s=r.join(""),t||s[0]!==m.delimiter||(s=s.slice(1)),i&&s[s.length-1]!==m.delimiter&&(s+=m.delimiter),s},split:function(e){var t=e.split(m.delimiter),i=t.slice(t.length-1)[0];return[t.slice(0,t.length-1).join(m.delimiter),i]},getBasename:function(e){return m.split(e)[1]},getDirectory:function(e){var t=e.split(m.delimiter);return t.slice(0,t.length-1).join(m.delimiter)},getExtension:function(e){var t=e.split("?")[0].split(".").pop();return t!==e?"."+t:""},isRelativePath:function(e){return"/"!==e.charAt(0)&&null===e.match(/:\/\//)},extractPath:function(e){var t="",i=e.split("/"),n=0;if(i.length>1)if(m.isRelativePath(e))if("."===i[0])for(n=0;n<i.length-1;++n)t+=0===n?i[n]:"/"+i[n];else if(".."===i[0])for(n=0;n<i.length-1;++n)t+=0===n?i[n]:"/"+i[n];else for(t=".",n=0;n<i.length-1;++n)t+="/"+i[n];else for(n=0;n<i.length-1;++n)t+=0===n?i[n]:"/"+i[n];return t}},_=!1,g=!1,v=!1,y=!1,b=!1,x=!1,S=!1,w=!1,T=!1,M=!1;if("undefined"!=typeof navigator){var A=navigator.userAgent;/(windows|mac os|linux|cros)/i.test(A)&&(_=!0),/xbox/i.test(A)&&(y=!0),/(windows phone|iemobile|wpdesktop)/i.test(A)?(_=!1,g=!0,v=!0):/android/i.test(A)?(_=!1,g=!0,b=!0):/ip([ao]d|hone)/i.test(A)&&(_=!1,g=!0,x=!0),"undefined"!=typeof window&&(S="ontouchstart"in window||"maxTouchPoints"in navigator&&navigator.maxTouchPoints>0),w="getGamepads"in navigator,T="undefined"!=typeof Worker;try{var C=Object.defineProperty({},"passive",{get:function(){return M=!0,!1}});window.addEventListener("testpassive",null,C),window.removeEventListener("testpassive",null,C)}catch(e){}}var P={desktop:_,mobile:g,ios:x,android:b,windows:v,xbox:y,gamepads:w,touch:S,workers:T,passiveEvents:M},E="abcdefghijklmnopqrstuvwxyz",I="ABCDEFGHIJKLMNOPQRSTUVWXYZ",R=55296,L=127462,D=127487,O=65024,k=65039;function F(e,t){void 0===t&&(t=0);var i=e.length;if(t<0||t>=i)return null;var n=e.charCodeAt(t);if(i>1&&n>=R&&n<=56319){var s=e.charCodeAt(t+1);if(s>=56320&&s<=57343)return{code:1024*(n-R)+s-56320+65536,long:!0}}return{code:n,long:!1}}function B(e,t,i){if(!e)return!1;var n=F(e);if(n){var s=n.code;return s>=t&&s<=i}return!1}function N(e,t){if(t===e.length-1)return 1;if(B(e[t],R,56319)){var i=e.substring(t,t+2),n=e.substring(t+2,t+4);return B(n,127995,127999)||B(i,L,D)&&B(n,L,D)?4:B(n,O,k)?3:2}return B(e[t+1],O,k)?2:1}var z={ASCII_LOWERCASE:E,ASCII_UPPERCASE:I,ASCII_LETTERS:"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",format:function(e){for(var t=1;t<arguments.length;t++)e=e.replace("{"+(t-1)+"}",arguments[t]);return e},toBool:function(e,t){if(void 0===t&&(t=!1),"true"===e)return!0;if(t){if("false"===e)return!1;throw new TypeError("Not a boolean string")}return!1},getCodePoint:function(e,t){var i=F(e,t);return i&&i.code},getCodePoints:function(e){if("string"!=typeof e)throw new TypeError("Not a string");for(var t,i=0,n=[];t=F(e,i);)n.push(t.code),i+=t.long?2:1;return n},getSymbols:function(e){if("string"!=typeof e)throw new TypeError("Not a string");for(var t,i=0,n=e.length,s=[],r=0;i<n;)if(B(t=e[i+(r+=N(e,i+r))],8400,8447)&&(t=e[i+r++]),B(t,O,k)&&(t=e[i+r++]),t&&8205===t.charCodeAt(0))t=e[i+r++];else{var a=e.substring(i,i+r);s.push(a),i+=r,r=0}return s},fromCodePoint:function(){for(var e,t,i,n=[],s=0;s<arguments.length;++s)t=(e=Number(arguments[s]))-65536,i=e>65535?[55296+(t>>10),t%1024+56320]:[e],n.push(String.fromCharCode.apply(null,i));return n.join("")}},U=function(){function e(){this._list=[],this._index={}}var t=e.prototype;return t.push=function(e,t){if(this._index[e])throw Error("Key already in index "+e);var i=this._list.push(t)-1;this._index[e]=i},t.has=function(e){return void 0!==this._index[e]},t.get=function(e){var t=this._index[e];return void 0!==t?this._list[t]:null},t.remove=function(e){var t=this._index[e];if(void 0!==t){for(e in this._list.splice(t,1),delete this._index[e],this._index){var i=this._index[e];i>t&&(this._index[e]=i-1)}return!0}return!1},t.list=function(){return this._list},t.clear=function(){for(var e in this._list.length=0,this._index)delete this._index[e]},e}(),V=function(){function e(e){this._sortBy=e.sortBy,this.items=[],this.length=0,this.loopIndex=-1,this._sortHandler=this._doSort.bind(this)}var t=e.prototype;return t._binarySearch=function(e){for(var t,i,n=0,s=this.items.length-1,r=e[this._sortBy];n<=s;)t=Math.floor((n+s)/2),(i=this.items[t][this._sortBy])<=r?n=t+1:i>r&&(s=t-1);return n},t._doSort=function(e,t){var i=this._sortBy;return e[i]-t[i]},t.insert=function(e){var t=this._binarySearch(e);this.items.splice(t,0,e),this.length++,this.loopIndex>=t&&this.loopIndex++},t.append=function(e){this.items.push(e),this.length++},t.remove=function(e){var t=this.items.indexOf(e);t<0||(this.items.splice(t,1),this.length--,this.loopIndex>=t&&this.loopIndex--)},t.sort=function(){var e=this.loopIndex>=0?this.items[this.loopIndex]:null;this.items.sort(this._sortHandler),null!==e&&(this.loopIndex=this.items.indexOf(e))},e}();function G(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function W(e,t,i){return t&&G(e.prototype,t),i&&G(e,i),e}function H(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,X(e,t)}function X(e,t){return(X=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function j(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function q(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function Y(e,t){var i;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return q(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?q(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(i=e[Symbol.iterator]()).next.bind(i)}var K=function(e){function t(t){var i;return(i=e.call(this)||this)._index={},i._list=[],i._parent=t,i}H(t,e);var i=t.prototype;return i.add=function(){var e=!1,t=this._processArguments(arguments,!0);if(!t.length)return e;for(var i=0;i<t.length;i++)this._index[t[i]]||(e=!0,this._index[t[i]]=!0,this._list.push(t[i]),this.fire("add",t[i],this._parent));return e&&this.fire("change",this._parent),e},i.remove=function(){var e=!1;if(!this._list.length)return e;var t=this._processArguments(arguments,!0);if(!t.length)return e;for(var i=0;i<t.length;i++)this._index[t[i]]&&(e=!0,delete this._index[t[i]],this._list.splice(this._list.indexOf(t[i]),1),this.fire("remove",t[i],this._parent));return e&&this.fire("change",this._parent),e},i.clear=function(){if(this._list.length){var e=this._list.slice(0);this._list=[],this._index={};for(var t=0;t<e.length;t++)this.fire("remove",e[t],this._parent);this.fire("change",this._parent)}},i.has=function(){return!!this._list.length&&this._has(this._processArguments(arguments))},i._has=function(e){if(!this._list.length||!e.length)return!1;for(var t=0;t<e.length;t++)if(1===e[t].length){if(this._index[e[t][0]])return!0}else{for(var i=!0,n=0;n<e[t].length;n++)if(!this._index[e[t][n]]){i=!1;break}if(i)return!0}return!1},i.list=function(){return this._list.slice(0)},i._processArguments=function(e,t){var i=[],n=[];if(!e||!e.length)return i;for(var s=0;s<e.length;s++)if(e[s]instanceof Array){t||(n=[]);for(var r=0;r<e[s].length;r++)"string"==typeof e[s][r]&&(t?i.push(e[s][r]):n.push(e[s][r]));!t&&n.length&&i.push(n)}else"string"==typeof e[s]&&(t?i.push(e[s]):i.push([e[s]]));return i},W(t,[{key:"size",get:function(){return this._list.length}}]),t}(d),Z="undefined"!=typeof window&&window.performance&&window.performance.now&&window.performance.timing?function(){return window.performance.now()}:Date.now,$=function(){function e(){this._isRunning=!1,this._a=0,this._b=0}var t=e.prototype;return t.start=function(){this._isRunning=!0,this._a=Z()},t.stop=function(){this._isRunning=!1,this._b=Z()},t.getMilliseconds=function(){return this._b-this._a},e}();var Q,J,ee=/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,te=function(){function e(e){var t=e.match(ee);this.scheme=t[2],this.authority=t[4],this.path=t[5],this.query=t[7],this.fragment=t[9]}var t=e.prototype;return t.toString=function(){var e="";return this.scheme&&(e+=this.scheme+":"),this.authority&&(e+="//"+this.authority),e+=this.path,this.query&&(e+="?"+this.query),this.fragment&&(e+="#"+this.fragment),e},t.getQuery=function(){var e={};if(this.query)for(var t,i=Y(decodeURIComponent(this.query).split("&"));!(t=i()).done;){var n=t.value.split("=");e[n[0]]=n[1]}return e},t.setQuery=function(e){var t="";for(var i in e)e.hasOwnProperty(i)&&(""!==t&&(t+="&"),t+=encodeURIComponent(i)+"="+encodeURIComponent(e[i]));this.query=t},e}(),ie={DEG_TO_RAD:Math.PI/180,RAD_TO_DEG:180/Math.PI,clamp:function(e,t,i){return e>=i?i:e<=t?t:e},intToBytes24:function(e){return[e>>16&255,e>>8&255,255&e]},intToBytes32:function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]},bytesToInt24:function(e,t,i){return e.length&&(i=e[2],t=e[1],e=e[0]),e<<16|t<<8|i},bytesToInt32:function(e,t,i,n){return e.length&&(n=e[3],i=e[2],t=e[1],e=e[0]),(e<<24|t<<16|i<<8|n)>>>32},lerp:function(e,t,i){return e+(t-e)*ie.clamp(i,0,1)},lerpAngle:function(e,t,i){return t-e>180&&(t-=360),t-e<-180&&(t+=360),ie.lerp(e,t,ie.clamp(i,0,1))},powerOfTwo:function(e){return 0!==e&&!(e&e-1)},nextPowerOfTwo:function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e},random:function(e,t){var i=t-e;return Math.random()*i+e},smoothstep:function(e,t,i){return i<=e?0:i>=t?1:(i=(i-e)/(t-e))*i*(3-2*i)},smootherstep:function(e,t,i){return i<=e?0:i>=t?1:(i=(i-e)/(t-e))*i*i*(i*(6*i-15)+10)},roundUp:function(e,t){return 0===t?e:Math.ceil(e/t)*t},float2Half:(Q=new Float32Array(1),J=new Int32Array(Q.buffer),function(e){Q[0]=e;var t=J[0],i=t>>16&32768,n=t>>12&2047,s=t>>23&255;return s<103?i:s>142?(i|=31744,i|=(255===s?0:1)&&8388607&t):s<113?i|=((n|=2048)>>114-s)+(n>>113-s&1):(i|=s-112<<10|n>>1,i+=1&n)}),between:function(e,t,i,n){var s=Math.min(t,i),r=Math.max(t,i);return n?e>=s&&e<=r:e>s&&e<r}},ne=function(){function e(){this.ContentType=e.ContentType,this.ResponseType=e.ResponseType,this.binaryExtensions=e.binaryExtensions}var t=e.prototype;return t.get=function(e,t,i){return"function"==typeof t&&(i=t,t={}),this.request("GET",e,t,i)},t.post=function(e,t,i,n){return"function"==typeof i&&(n=i,i={}),i.postdata=t,this.request("POST",e,i,n)},t.put=function(e,t,i,n){return"function"==typeof i&&(n=i,i={}),i.postdata=t,this.request("PUT",e,i,n)},t.del=function(e,t,i){return"function"==typeof t&&(i=t,t={}),this.request("DELETE",e,t,i)},t.request=function(t,i,n,s){var a,o,h,l,c,u=!1;if("function"==typeof n&&(s=n,n={}),n.retry&&(n=Object.assign({retries:0,maxRetries:5},n)),n.callback=s,null==n.async&&(n.async=!0),null==n.headers&&(n.headers={}),null!=n.postdata)if(n.postdata instanceof Document)l=n.postdata;else if(n.postdata instanceof FormData)l=n.postdata;else if(n.postdata instanceof Object){var d=n.headers["Content-Type"];switch(void 0===d&&(n.headers["Content-Type"]=e.ContentType.FORM_URLENCODED,d=n.headers["Content-Type"]),d){case e.ContentType.FORM_URLENCODED:l="";var f=!0;for(var p in n.postdata)n.postdata.hasOwnProperty(p)&&(f?f=!1:l+="&",l+=escape(p)+"="+escape(n.postdata[p]));break;default:case e.ContentType.JSON:null==d&&(n.headers["Content-Type"]=e.ContentType.JSON),l=JSON.stringify(n.postdata)}}else l=n.postdata;for(var m in!1===n.cache&&(h=Z(),(a=new te(i)).query?a.query=a.query+"&ts="+h:a.query="ts="+h,i=a.toString()),n.query&&(o=r((a=new te(i)).getQuery(),n.query),a.setQuery(o),i=a.toString()),(c=new XMLHttpRequest).open(t,i,n.async),c.withCredentials=void 0!==n.withCredentials&&n.withCredentials,c.responseType=n.responseType||this._guessResponseType(i),n.headers)n.headers.hasOwnProperty(m)&&c.setRequestHeader(m,n.headers[m]);c.onreadystatechange=function(){this._onReadyStateChange(t,i,n,c)}.bind(this),c.onerror=function(){this._onError(t,i,n,c),u=!0}.bind(this);try{c.send(l)}catch(e){u||n.error(c.status,c,e)}return c},t._guessResponseType=function(t){var i=new te(t),n=m.getExtension(i.path);return e.binaryExtensions.indexOf(n)>=0?e.ResponseType.ARRAY_BUFFER:".xml"===n?e.ResponseType.DOCUMENT:e.ResponseType.TEXT},t._isBinaryContentType=function(t){return[e.ContentType.MP4,e.ContentType.WAV,e.ContentType.OGG,e.ContentType.MP3,e.ContentType.BIN,e.ContentType.DDS,e.ContentType.BASIS,e.ContentType.GLB].indexOf(t)>=0},t._onReadyStateChange=function(e,t,i,n){if(4===n.readyState)switch(n.status){case 0:n.responseURL&&n.responseURL.startsWith("file:///")?this._onSuccess(e,t,i,n):this._onError(e,t,i,n);break;case 200:case 201:case 206:case 304:this._onSuccess(e,t,i,n);break;default:this._onError(e,t,i,n)}},t._onSuccess=function(t,i,n,s){var r,a,o;(a=s.getResponseHeader("Content-Type"))&&(o=a.split(";")[0].trim());try{o===this.ContentType.JSON||i.split("?")[0].endsWith(".json")?r=JSON.parse(s.responseText):this._isBinaryContentType(o)?r=s.response:(o&&console.warn("responseType: "+s.responseType+" being served with Content-Type: "+o),r=s.responseType===e.ResponseType.ARRAY_BUFFER||s.responseType===e.ResponseType.BLOB||s.responseType===e.ResponseType.JSON?s.response:s.responseType===e.ResponseType.DOCUMENT||o===this.ContentType.XML?s.responseXML:s.responseText),n.callback(null,r)}catch(e){n.callback(e)}},t._onError=function(t,i,n,s){if(!n.retrying)if(n.retry&&n.retries<n.maxRetries){n.retries++,n.retrying=!0;var r=ie.clamp(Math.pow(2,n.retries)*e.retryDelay,0,n.maxRetryDelay||5e3);console.log(t+": "+i+" - Error "+s.status+". Retrying in "+r+" ms"),setTimeout(function(){n.retrying=!1,this.request(t,i,n,n.callback)}.bind(this),r)}else n.callback(0===s.status?"Network error":s.status,null)},e}();ne.ContentType={FORM_URLENCODED:"application/x-www-form-urlencoded",GIF:"image/gif",JPEG:"image/jpeg",DDS:"image/dds",JSON:"application/json",PNG:"image/png",TEXT:"text/plain",XML:"application/xml",WAV:"audio/x-wav",OGG:"audio/ogg",MP3:"audio/mpeg",MP4:"audio/mp4",AAC:"audio/aac",BIN:"application/octet-stream",BASIS:"image/basis",GLB:"model/gltf-binary"},ne.ResponseType={TEXT:"text",ARRAY_BUFFER:"arraybuffer",BLOB:"blob",DOCUMENT:"document",JSON:"json"},ne.binaryExtensions=[".model",".wav",".ogg",".mp3",".mp4",".m4a",".aac",".dds",".basis",".glb"],ne.retryDelay=100;var se=new ne,re=function(){function e(e,t,i,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=1);var s=e.length;3===s||4===s?(this.r=e[0],this.g=e[1],this.b=e[2],this.a=void 0!==e[3]?e[3]:1):(this.r=e,this.g=t,this.b=i,this.a=n)}var t=e.prototype;return t.clone=function(){return new e(this.r,this.g,this.b,this.a)},t.copy=function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this},t.equals=function(e){return this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a},t.set=function(e,t,i,n){return void 0===n&&(n=1),this.r=e,this.g=t,this.b=i,this.a=n,this},t.lerp=function(e,t,i){return this.r=e.r+i*(t.r-e.r),this.g=e.g+i*(t.g-e.g),this.b=e.b+i*(t.b-e.b),this.a=e.a+i*(t.a-e.a),this},t.fromString=function(e){var t,i=parseInt(e.replace("#","0x"),16);return e.length>7?t=ie.intToBytes32(i):(t=ie.intToBytes24(i))[3]=255,this.set(t[0]/255,t[1]/255,t[2]/255,t[3]/255),this},t.toString=function(e){var t="#"+((1<<24)+(Math.round(255*this.r)<<16)+(Math.round(255*this.g)<<8)+Math.round(255*this.b)).toString(16).slice(1);if(!0===e){var i=Math.round(255*this.a).toString(16);this.a<16/255?t+="0"+i:t+=i}return t},e}();re.BLACK=Object.freeze(new re(0,0,0,1)),re.BLUE=Object.freeze(new re(0,0,1,1)),re.CYAN=Object.freeze(new re(0,1,1,1)),re.GRAY=Object.freeze(new re(.5,.5,.5,1)),re.GREEN=Object.freeze(new re(0,1,0,1)),re.MAGENTA=Object.freeze(new re(1,0,1,1)),re.RED=Object.freeze(new re(1,0,0,1)),re.WHITE=Object.freeze(new re(1,1,1,1)),re.YELLOW=Object.freeze(new re(1,1,0,1));var ae=function(){function e(e,t){this._curve=e,this._left=-1/0,this._right=1/0,this._recip=0,this._p0=0,this._p1=0,this._m0=0,this._m1=0,this._reset(t||0)}var t=e.prototype;return t.evaluate=function(e,t){var i;(t||e<this._left||e>=this._right)&&this._reset(e);var n=this._curve.type;if(5===n)i=this._p0;else{var s=0===this._recip?0:(e-this._left)*this._recip;i=0===n?ie.lerp(this._p0,this._p1,s):1===n?ie.lerp(this._p0,this._p1,s*s*(3-2*s)):this._evaluateHermite(this._p0,this._p1,this._m0,this._m1,s)}return i},t._reset=function(e){var t=this._curve.keys,i=t.length;if(i)if(e<t[0][0])this._left=-1/0,this._right=t[0][0],this._recip=0,this._p0=this._p1=t[0][1],this._m0=this._m1=0;else if(e>=t[i-1][0])this._left=t[i-1][0],this._right=1/0,this._recip=0,this._p0=this._p1=t[i-1][1],this._m0=this._m1=0;else{for(var n=0;e>=t[n+1][0];)n++;this._left=t[n][0],this._right=t[n+1][0];var s=1/(this._right-this._left);this._recip=isFinite(s)?s:0,this._p0=t[n][1],this._p1=t[n+1][1],this._isHermite()&&this._calcTangents(t,n)}else this._left=-1/0,this._right=1/0,this._recip=0,this._p0=this._p1=this._m0=this._m1=0},t._isHermite=function(){return 2===this._curve.type||3===this._curve.type||4===this._curve.type},t._calcTangents=function(e,t){var i,n,s=e[t],r=e[t+1];if(i=0===t?[e[0][0]+(e[0][0]-e[1][0]),e[0][1]+(e[0][1]-e[1][1])]:e[t-1],n=t===e.length-2?[e[t+1][0]+(e[t+1][0]-e[t][0]),e[t+1][1]+(e[t+1][1]-e[t][1])]:e[t+2],4===this._curve.type){var a=2*(r[0]-s[0])/(r[0]-i[0]),o=2*(r[0]-s[0])/(n[0]-s[0]);this._m0=this._curve.tension*(isFinite(a)?a:0)*(r[1]-i[1]),this._m1=this._curve.tension*(isFinite(o)?o:0)*(n[1]-s[1])}else{var h=(r[0]-s[0])/(s[0]-i[0]),l=(r[0]-s[0])/(n[0]-r[0]),c=s[1]+(i[1]-s[1])*(isFinite(h)?h:0),u=r[1]+(n[1]-r[1])*(isFinite(l)?l:0),d=2===this._curve.type?.5:this._curve.tension;this._m0=d*(r[1]-c),this._m1=d*(u-s[1])}},t._evaluateHermite=function(e,t,i,n,s){var r=s*s,a=s+s,o=1-s,h=o*o;return e*((1+a)*h)+i*(s*h)+t*(r*(3-a))+n*(r*(s-1))},e}(),oe=function(){function e(e){if(this.keys=[],this.type=1,this.tension=.5,this._eval=new ae(this),e)for(var t=0;t<e.length-1;t+=2)this.keys.push([e[t],e[t+1]]);this.sort()}var t=e.prototype;return t.add=function(e,t){for(var i=this.keys,n=i.length,s=0;s<n&&!(i[s][0]>e);s++);var r=[e,t];return this.keys.splice(s,0,r),r},t.get=function(e){return this.keys[e]},t.sort=function(){this.keys.sort((function(e,t){return e[0]-t[0]}))},t.value=function(e){return this._eval.evaluate(e,!0)},t.closest=function(e){for(var t=this.keys,i=t.length,n=2,s=null,r=0;r<i;r++){var a=Math.abs(e-t[r][0]);if(!(n>=a))break;n=a,s=t[r]}return s},t.clone=function(){var t=new e;return t.keys=r(t.keys,this.keys),t.type=this.type,t.tension=this.tension,t},t.quantize=function(e){e=Math.max(e,2);var t=new Float32Array(e),i=1/(e-1);t[0]=this._eval.evaluate(0,!0);for(var n=1;n<e;n++)t[n]=this._eval.evaluate(i*n);return t},t.quantizeClamped=function(e,t,i){for(var n=this.quantize(e),s=0;s<n.length;++s)n[s]=Math.min(i,Math.max(t,n[s]));return n},W(e,[{key:"length",get:function(){return this.keys.length}}]),e}(),he=function(){function e(){if(this.curves=[],this._type=1,arguments.length>1)for(var e=0;e<arguments.length;e++)this.curves.push(new oe(arguments[e]));else if(0===arguments.length)this.curves.push(new oe);else{var t=arguments[0];if("number"==typeof t)for(var i=0;i<t;i++)this.curves.push(new oe);else for(var n=0;n<t.length;n++)this.curves.push(new oe(t[n]))}}var t=e.prototype;return t.get=function(e){return this.curves[e]},t.value=function(e,t){void 0===t&&(t=[]);var i=this.curves.length;t.length=i;for(var n=0;n<i;n++)t[n]=this.curves[n].value(e);return t},t.clone=function(){var t=new e;t.curves=[];for(var i=0;i<this.curves.length;i++)t.curves.push(this.curves[i].clone());return t._type=this._type,t},t.quantize=function(e){e=Math.max(e,2);for(var t=this.curves.length,i=new Float32Array(e*t),n=1/(e-1),s=0;s<t;s++)for(var r=new ae(this.curves[s]),a=0;a<e;a++)i[a*t+s]=r.evaluate(n*a);return i},t.quantizeClamped=function(e,t,i){for(var n=this.quantize(e),s=0;s<n.length;++s)n[s]=Math.min(i,Math.max(t,n[s]));return n},W(e,[{key:"length",get:function(){return this.curves.length}},{key:"type",get:function(){return this._type},set:function(e){this._type=e;for(var t=0;t<this.curves.length;t++)this.curves[t].type=e}}]),e}(),le=function(){function e(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),3===e.length?(this.x=e[0],this.y=e[1],this.z=e[2]):(this.x=e,this.y=t,this.z=i)}var t=e.prototype;return t.add=function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this},t.add2=function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},t.addScalar=function(e){return this.x+=e,this.y+=e,this.z+=e,this},t.clone=function(){return new e(this.x,this.y,this.z)},t.copy=function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},t.cross=function(e,t){var i=e.x,n=e.y,s=e.z,r=t.x,a=t.y,o=t.z;return this.x=n*o-a*s,this.y=s*r-o*i,this.z=i*a-r*n,this},t.distance=function(e){var t=this.x-e.x,i=this.y-e.y,n=this.z-e.z;return Math.sqrt(t*t+i*i+n*n)},t.div=function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},t.div2=function(e,t){return this.x=e.x/t.x,this.y=e.y/t.y,this.z=e.z/t.z,this},t.divScalar=function(e){return this.x/=e,this.y/=e,this.z/=e,this},t.dot=function(e){return this.x*e.x+this.y*e.y+this.z*e.z},t.equals=function(e){return this.x===e.x&&this.y===e.y&&this.z===e.z},t.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},t.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z},t.lerp=function(e,t,i){return this.x=e.x+i*(t.x-e.x),this.y=e.y+i*(t.y-e.y),this.z=e.z+i*(t.z-e.z),this},t.mul=function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this},t.mul2=function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},t.mulScalar=function(e){return this.x*=e,this.y*=e,this.z*=e,this},t.normalize=function(){var e=this.x*this.x+this.y*this.y+this.z*this.z;if(e>0){var t=1/Math.sqrt(e);this.x*=t,this.y*=t,this.z*=t}return this},t.project=function(e){var t=(this.x*e.x+this.y*e.y+this.z*e.z)/(e.x*e.x+e.y*e.y+e.z*e.z);return this.x=e.x*t,this.y=e.y*t,this.z=e.z*t,this},t.set=function(e,t,i){return this.x=e,this.y=t,this.z=i,this},t.sub=function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this},t.sub2=function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},t.subScalar=function(e){return this.x-=e,this.y-=e,this.z-=e,this},t.toString=function(){return"["+this.x+", "+this.y+", "+this.z+"]"},e}();le.ZERO=Object.freeze(new le(0,0,0)),le.ONE=Object.freeze(new le(1,1,1)),le.UP=Object.freeze(new le(0,1,0)),le.DOWN=Object.freeze(new le(0,-1,0)),le.RIGHT=Object.freeze(new le(1,0,0)),le.LEFT=Object.freeze(new le(-1,0,0)),le.FORWARD=Object.freeze(new le(0,0,-1)),le.BACK=Object.freeze(new le(0,0,1));var ce=function(){function e(){var e=new Float32Array(9);e[0]=e[4]=e[8]=1,this.data=e}var t=e.prototype;return t.clone=function(){return(new e).copy(this)},t.copy=function(e){var t=e.data,i=this.data;return i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[4]=t[4],i[5]=t[5],i[6]=t[6],i[7]=t[7],i[8]=t[8],this},t.set=function(e){var t=this.data;return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],this},t.equals=function(e){var t=this.data,i=e.data;return t[0]===i[0]&&t[1]===i[1]&&t[2]===i[2]&&t[3]===i[3]&&t[4]===i[4]&&t[5]===i[5]&&t[6]===i[6]&&t[7]===i[7]&&t[8]===i[8]},t.isIdentity=function(){var e=this.data;return 1===e[0]&&0===e[1]&&0===e[2]&&0===e[3]&&1===e[4]&&0===e[5]&&0===e[6]&&0===e[7]&&1===e[8]},t.setIdentity=function(){var e=this.data;return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,this},t.toString=function(){for(var e="[",t=0;t<9;t++)e+=this.data[t],e+=8!==t?", ":"";return e+="]"},t.transpose=function(){var e,t=this.data;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},t.setFromMat4=function(e){var t=e.data,i=this.data;return i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[4],i[4]=t[5],i[5]=t[6],i[6]=t[8],i[7]=t[9],i[8]=t[10],this},t.transformVector=function(e,t){void 0===t&&(t=new le);var i=this.data,n=e.x,s=e.y,r=e.z;return t.x=n*i[0]+s*i[3]+r*i[6],t.y=n*i[1]+s*i[4]+r*i[7],t.z=n*i[2]+s*i[5]+r*i[8],t},e}();ce.IDENTITY=Object.freeze(new ce),ce.ZERO=Object.freeze((new ce).set([0,0,0,0,0,0,0,0,0]));var ue=function(){function e(e,t){void 0===e&&(e=0),void 0===t&&(t=0),2===e.length?(this.x=e[0],this.y=e[1]):(this.x=e,this.y=t)}var t=e.prototype;return t.add=function(e){return this.x+=e.x,this.y+=e.y,this},t.add2=function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},t.addScalar=function(e){return this.x+=e,this.y+=e,this},t.clone=function(){return new e(this.x,this.y)},t.copy=function(e){return this.x=e.x,this.y=e.y,this},t.cross=function(e){return this.x*e.y-this.y*e.x},t.distance=function(e){var t=this.x-e.x,i=this.y-e.y;return Math.sqrt(t*t+i*i)},t.div=function(e){return this.x/=e.x,this.y/=e.y,this},t.div2=function(e,t){return this.x=e.x/t.x,this.y=e.y/t.y,this},t.divScalar=function(e){return this.x/=e,this.y/=e,this},t.dot=function(e){return this.x*e.x+this.y*e.y},t.equals=function(e){return this.x===e.x&&this.y===e.y},t.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},t.lengthSq=function(){return this.x*this.x+this.y*this.y},t.lerp=function(e,t,i){return this.x=e.x+i*(t.x-e.x),this.y=e.y+i*(t.y-e.y),this},t.mul=function(e){return this.x*=e.x,this.y*=e.y,this},t.mul2=function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this},t.mulScalar=function(e){return this.x*=e,this.y*=e,this},t.normalize=function(){var e=this.x*this.x+this.y*this.y;if(e>0){var t=1/Math.sqrt(e);this.x*=t,this.y*=t}return this},t.set=function(e,t){return this.x=e,this.y=t,this},t.sub=function(e){return this.x-=e.x,this.y-=e.y,this},t.sub2=function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},t.subScalar=function(e){return this.x-=e,this.y-=e,this},t.toString=function(){return"["+this.x+", "+this.y+"]"},e.angleRad=function(e,t){return Math.atan2(e.x*t.y-e.y*t.x,e.x*t.x+e.y*t.y)},e}();ue.ZERO=Object.freeze(new ue(0,0)),ue.ONE=Object.freeze(new ue(1,1)),ue.UP=Object.freeze(new ue(0,1)),ue.DOWN=Object.freeze(new ue(0,-1)),ue.RIGHT=Object.freeze(new ue(1,0)),ue.LEFT=Object.freeze(new ue(-1,0));var de=function(){function e(e,t,i,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=0),4===e.length?(this.x=e[0],this.y=e[1],this.z=e[2],this.w=e[3]):(this.x=e,this.y=t,this.z=i,this.w=n)}var t=e.prototype;return t.add=function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this},t.add2=function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},t.addScalar=function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},t.clone=function(){return new e(this.x,this.y,this.z,this.w)},t.copy=function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this},t.div=function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this},t.div2=function(e,t){return this.x=e.x/t.x,this.y=e.y/t.y,this.z=e.z/t.z,this.w=e.w/t.w,this},t.divScalar=function(e){return this.x/=e,this.y/=e,this.z/=e,this.w/=e,this},t.dot=function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},t.equals=function(e){return this.x===e.x&&this.y===e.y&&this.z===e.z&&this.w===e.w},t.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},t.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},t.lerp=function(e,t,i){return this.x=e.x+i*(t.x-e.x),this.y=e.y+i*(t.y-e.y),this.z=e.z+i*(t.z-e.z),this.w=e.w+i*(t.w-e.w),this},t.mul=function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this},t.mul2=function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this.w=e.w*t.w,this},t.mulScalar=function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},t.normalize=function(){var e=this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w;if(e>0){var t=1/Math.sqrt(e);this.x*=t,this.y*=t,this.z*=t,this.w*=t}return this},t.set=function(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this},t.sub=function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this},t.sub2=function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},t.subScalar=function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},t.toString=function(){return"["+this.x+", "+this.y+", "+this.z+", "+this.w+"]"},e}();de.ZERO=Object.freeze(new de(0,0,0,0)),de.ONE=Object.freeze(new de(1,1,1,1));var fe=new ue,pe=new le,me=new le,_e=new le,ge=new le,ve=function(){function e(){var e=new Float32Array(16);e[0]=e[5]=e[10]=e[15]=1,this.data=e}e._getPerspectiveHalfSize=function(e,t,i,n,s){s?(e.x=n*Math.tan(t*Math.PI/360),e.y=e.x/i):(e.y=n*Math.tan(t*Math.PI/360),e.x=e.y*i)};var t=e.prototype;return t.add2=function(e,t){var i=e.data,n=t.data,s=this.data;return s[0]=i[0]+n[0],s[1]=i[1]+n[1],s[2]=i[2]+n[2],s[3]=i[3]+n[3],s[4]=i[4]+n[4],s[5]=i[5]+n[5],s[6]=i[6]+n[6],s[7]=i[7]+n[7],s[8]=i[8]+n[8],s[9]=i[9]+n[9],s[10]=i[10]+n[10],s[11]=i[11]+n[11],s[12]=i[12]+n[12],s[13]=i[13]+n[13],s[14]=i[14]+n[14],s[15]=i[15]+n[15],this},t.add=function(e){return this.add2(this,e)},t.clone=function(){return(new e).copy(this)},t.copy=function(e){var t=e.data,i=this.data;return i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[4]=t[4],i[5]=t[5],i[6]=t[6],i[7]=t[7],i[8]=t[8],i[9]=t[9],i[10]=t[10],i[11]=t[11],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15],this},t.equals=function(e){var t=this.data,i=e.data;return t[0]===i[0]&&t[1]===i[1]&&t[2]===i[2]&&t[3]===i[3]&&t[4]===i[4]&&t[5]===i[5]&&t[6]===i[6]&&t[7]===i[7]&&t[8]===i[8]&&t[9]===i[9]&&t[10]===i[10]&&t[11]===i[11]&&t[12]===i[12]&&t[13]===i[13]&&t[14]===i[14]&&t[15]===i[15]},t.isIdentity=function(){var e=this.data;return 1===e[0]&&0===e[1]&&0===e[2]&&0===e[3]&&0===e[4]&&1===e[5]&&0===e[6]&&0===e[7]&&0===e[8]&&0===e[9]&&1===e[10]&&0===e[11]&&0===e[12]&&0===e[13]&&0===e[14]&&1===e[15]},t.mul2=function(e,t){var i,n,s,r,a=e.data,o=t.data,h=this.data,l=a[0],c=a[1],u=a[2],d=a[3],f=a[4],p=a[5],m=a[6],_=a[7],g=a[8],v=a[9],y=a[10],b=a[11],x=a[12],S=a[13],w=a[14],T=a[15];return i=o[0],n=o[1],s=o[2],r=o[3],h[0]=l*i+f*n+g*s+x*r,h[1]=c*i+p*n+v*s+S*r,h[2]=u*i+m*n+y*s+w*r,h[3]=d*i+_*n+b*s+T*r,i=o[4],n=o[5],s=o[6],r=o[7],h[4]=l*i+f*n+g*s+x*r,h[5]=c*i+p*n+v*s+S*r,h[6]=u*i+m*n+y*s+w*r,h[7]=d*i+_*n+b*s+T*r,i=o[8],n=o[9],s=o[10],r=o[11],h[8]=l*i+f*n+g*s+x*r,h[9]=c*i+p*n+v*s+S*r,h[10]=u*i+m*n+y*s+w*r,h[11]=d*i+_*n+b*s+T*r,i=o[12],n=o[13],s=o[14],r=o[15],h[12]=l*i+f*n+g*s+x*r,h[13]=c*i+p*n+v*s+S*r,h[14]=u*i+m*n+y*s+w*r,h[15]=d*i+_*n+b*s+T*r,this},t.mulAffine2=function(e,t){var i,n,s,r=e.data,a=t.data,o=this.data,h=r[0],l=r[1],c=r[2],u=r[4],d=r[5],f=r[6],p=r[8],m=r[9],_=r[10],g=r[12],v=r[13],y=r[14];return i=a[0],n=a[1],s=a[2],o[0]=h*i+u*n+p*s,o[1]=l*i+d*n+m*s,o[2]=c*i+f*n+_*s,o[3]=0,i=a[4],n=a[5],s=a[6],o[4]=h*i+u*n+p*s,o[5]=l*i+d*n+m*s,o[6]=c*i+f*n+_*s,o[7]=0,i=a[8],n=a[9],s=a[10],o[8]=h*i+u*n+p*s,o[9]=l*i+d*n+m*s,o[10]=c*i+f*n+_*s,o[11]=0,i=a[12],n=a[13],s=a[14],o[12]=h*i+u*n+p*s+g,o[13]=l*i+d*n+m*s+v,o[14]=c*i+f*n+_*s+y,o[15]=1,this},t.mul=function(e){return this.mul2(this,e)},t.transformPoint=function(e,t){void 0===t&&(t=new le);var i=this.data,n=e.x,s=e.y,r=e.z;return t.x=n*i[0]+s*i[4]+r*i[8]+i[12],t.y=n*i[1]+s*i[5]+r*i[9]+i[13],t.z=n*i[2]+s*i[6]+r*i[10]+i[14],t},t.transformVector=function(e,t){void 0===t&&(t=new le);var i=this.data,n=e.x,s=e.y,r=e.z;return t.x=n*i[0]+s*i[4]+r*i[8],t.y=n*i[1]+s*i[5]+r*i[9],t.z=n*i[2]+s*i[6]+r*i[10],t},t.transformVec4=function(e,t){void 0===t&&(t=new de);var i=this.data,n=e.x,s=e.y,r=e.z,a=e.w;return t.x=n*i[0]+s*i[4]+r*i[8]+a*i[12],t.y=n*i[1]+s*i[5]+r*i[9]+a*i[13],t.z=n*i[2]+s*i[6]+r*i[10]+a*i[14],t.w=n*i[3]+s*i[7]+r*i[11]+a*i[15],t},t.setLookAt=function(e,t,i){_e.sub2(e,t).normalize(),me.copy(i).normalize(),pe.cross(me,_e).normalize(),me.cross(_e,pe);var n=this.data;return n[0]=pe.x,n[1]=pe.y,n[2]=pe.z,n[3]=0,n[4]=me.x,n[5]=me.y,n[6]=me.z,n[7]=0,n[8]=_e.x,n[9]=_e.y,n[10]=_e.z,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,this},t.setFrustum=function(e,t,i,n,s,r){var a=2*s,o=t-e,h=n-i,l=r-s,c=this.data;return c[0]=a/o,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=a/h,c[6]=0,c[7]=0,c[8]=(t+e)/o,c[9]=(n+i)/h,c[10]=(-r-s)/l,c[11]=-1,c[12]=0,c[13]=0,c[14]=-a*r/l,c[15]=0,this},t.setPerspective=function(t,i,n,s,r){return e._getPerspectiveHalfSize(fe,t,i,n,r),this.setFrustum(-fe.x,fe.x,-fe.y,fe.y,n,s)},t.setOrtho=function(e,t,i,n,s,r){var a=this.data;return a[0]=2/(t-e),a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=2/(n-i),a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=-2/(r-s),a[11]=0,a[12]=-(t+e)/(t-e),a[13]=-(n+i)/(n-i),a[14]=-(r+s)/(r-s),a[15]=1,this},t.setFromAxisAngle=function(e,t){t*=ie.DEG_TO_RAD;var i=e.x,n=e.y,s=e.z,r=Math.cos(t),a=Math.sin(t),o=1-r,h=o*i,l=o*n,c=this.data;return c[0]=h*i+r,c[1]=h*n+a*s,c[2]=h*s-a*n,c[3]=0,c[4]=h*n-a*s,c[5]=l*n+r,c[6]=l*s+a*i,c[7]=0,c[8]=h*s+a*n,c[9]=l*s-i*a,c[10]=o*s*s+r,c[11]=0,c[12]=0,c[13]=0,c[14]=0,c[15]=1,this},t.setTranslate=function(e,t,i){var n=this.data;return n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=e,n[13]=t,n[14]=i,n[15]=1,this},t.setScale=function(e,t,i){var n=this.data;return n[0]=e,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=t,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=i,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this},t.invert=function(){var e=this.data,t=e[0],i=e[1],n=e[2],s=e[3],r=e[4],a=e[5],o=e[6],h=e[7],l=e[8],c=e[9],u=e[10],d=e[11],f=e[12],p=e[13],m=e[14],_=e[15],g=t*a-i*r,v=t*o-n*r,y=t*h-s*r,b=i*o-n*a,x=i*h-s*a,S=n*h-s*o,w=l*p-c*f,T=l*m-u*f,M=l*_-d*f,A=c*m-u*p,C=c*_-d*p,P=u*_-d*m,E=g*P-v*C+y*A+b*M-x*T+S*w;if(0===E)this.setIdentity();else{var I=1/E;e[0]=(a*P-o*C+h*A)*I,e[1]=(-i*P+n*C-s*A)*I,e[2]=(p*S-m*x+_*b)*I,e[3]=(-c*S+u*x-d*b)*I,e[4]=(-r*P+o*M-h*T)*I,e[5]=(t*P-n*M+s*T)*I,e[6]=(-f*S+m*y-_*v)*I,e[7]=(l*S-u*y+d*v)*I,e[8]=(r*C-a*M+h*w)*I,e[9]=(-t*C+i*M-s*w)*I,e[10]=(f*x-p*y+_*g)*I,e[11]=(-l*x+c*y-d*g)*I,e[12]=(-r*A+a*T-o*w)*I,e[13]=(t*A-i*T+n*w)*I,e[14]=(-f*b+p*v-m*g)*I,e[15]=(l*b-c*v+u*g)*I}return this},t.set=function(e){var t=this.data;return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],this},t.setIdentity=function(){var e=this.data;return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},t.setTRS=function(e,t,i){var n=t.x,s=t.y,r=t.z,a=t.w,o=i.x,h=i.y,l=i.z,c=n+n,u=s+s,d=r+r,f=n*c,p=n*u,m=n*d,_=s*u,g=s*d,v=r*d,y=a*c,b=a*u,x=a*d,S=this.data;return S[0]=(1-(_+v))*o,S[1]=(p+x)*o,S[2]=(m-b)*o,S[3]=0,S[4]=(p-x)*h,S[5]=(1-(f+v))*h,S[6]=(g+y)*h,S[7]=0,S[8]=(m+b)*l,S[9]=(g-y)*l,S[10]=(1-(f+_))*l,S[11]=0,S[12]=e.x,S[13]=e.y,S[14]=e.z,S[15]=1,this},t.transpose=function(){var e,t=this.data;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},t.invertTo3x3=function(e){var t=this.data,i=e.data,n=t[0],s=t[1],r=t[2],a=t[4],o=t[5],h=t[6],l=t[8],c=t[9],u=t[10],d=u*o-h*c,f=-u*s+r*c,p=h*s-r*o,m=-u*a+h*l,_=u*n-r*l,g=-h*n+r*a,v=c*a-o*l,y=-c*n+s*l,b=o*n-s*a,x=n*d+s*m+r*v;if(0===x)return this;var S=1/x;return i[0]=S*d,i[1]=S*f,i[2]=S*p,i[3]=S*m,i[4]=S*_,i[5]=S*g,i[6]=S*v,i[7]=S*y,i[8]=S*b,this},t.getTranslation=function(e){return void 0===e&&(e=new le),e.set(this.data[12],this.data[13],this.data[14])},t.getX=function(e){return void 0===e&&(e=new le),e.set(this.data[0],this.data[1],this.data[2])},t.getY=function(e){return void 0===e&&(e=new le),e.set(this.data[4],this.data[5],this.data[6])},t.getZ=function(e){return void 0===e&&(e=new le),e.set(this.data[8],this.data[9],this.data[10])},t.getScale=function(e){return void 0===e&&(e=new le),this.getX(pe),this.getY(me),this.getZ(_e),e.set(pe.length(),me.length(),_e.length()),e},t.setFromEulerAngles=function(e,t,i){e*=ie.DEG_TO_RAD,t*=ie.DEG_TO_RAD,i*=ie.DEG_TO_RAD;var n=Math.sin(-e),s=Math.cos(-e),r=Math.sin(-t),a=Math.cos(-t),o=Math.sin(-i),h=Math.cos(-i),l=this.data;return l[0]=a*h,l[1]=-a*o,l[2]=r,l[3]=0,l[4]=s*o+h*n*r,l[5]=s*h-n*r*o,l[6]=-a*n,l[7]=0,l[8]=n*o-s*h*r,l[9]=h*n+s*r*o,l[10]=s*a,l[11]=0,l[12]=0,l[13]=0,l[14]=0,l[15]=1,this},t.getEulerAngles=function(e){void 0===e&&(e=new le),this.getScale(ge);var t=ge.