123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- (window.webpackJsonp=window.webpackJsonp||[]).push([["threejs~threejshb"],{"0805":function(t,e){t.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAEK0lEQVRIiZ2Wf0xVZRjHP/fewxWIQsLJDys3uPxmlKCWzU03/2jGdJRpRoKTmrTFcqBgtmYazgo2M72snJu6tLu2fmmrtdVWa2NZlmgMRERIkR+jDQm9wQUOnPbc9zLwnnMx+W5n58fzPt/veZ/3fZ73sRm3BgjGYFmhEygIXMuARMBpGqjgBbqAC8BXwJlot2c0eJBJaLCs8BmgRkvNcoXlLUNLzcL+YCw4NGuZcZ2Jm/3oV5oZO39W7leBndFuz5eWQoNlhQ5gvz0usSpiYwlaSmaICcwMve0Sw58eY6KvpwZ4I9rtGRcH+zSv/ZorvSqqsnrWIgLxjarch5aSUSWck9/tgdk8Z49LqIos3YEtPGLWIpOwhYcTuXU7Eh3hls+2f4pXO7HZ2qPK33rIkZRq7em9BT99C42/w989YLNBXCLkLIWV+XBflKXbeMcVvO/v7cYwkmSF12upWaFFhPzEBxARCY+vgHjZiAb0dEL9D/DjN/BSBWQuMrkKp5aatUBvbdogQgVhuU+EEDkHR96DVWth7YugBe28/OfhixNQtw/KdkPGoyYK4dZbmwpkjZbIFjZhyAsfH1aheXbzlMjoiLr8LE7YuBVWPg3HDoBv2ESjpfm5F4tQvD9PgvHzd+CcAwVFyvDvbfjoHSgvVNfRWhgeUraCYnA4oP57E409xs+dIEJzLJPxz3OwdAWEhan34weh9waUvg6lO6GzHU4eDswsDPKWK59gKG6n3WwJoK8bHklWz4MD0NwAm16FnCVqtxW+Ahd/UzMVLExWPiEQWkjXp8rOZOwfmDtlnxsLhjFlk/USn3sWipkH/X3qeX4CzIuDrz0wNgojPjjzCcQvgNj5UxGIsVjruwqlZkPDL+pZEnTzNmhthIpNsKMI2lug+DVll5ldOAvpOSHpQpRkYNUaqN6mxHKfBFcGvP0hXLqohCVBJYkFf9RD13XYUjGj0G3D57tf6tMdSHgYnloHJ+tUeBa6IDIKFi+/c1zHZThVB/kbVCiDMe5ft1EJXa8xeNP6N9a8AFmL4NBeuNFhtl9rA3e1mvHq9ZYUEwP9cusVoUb96mVrIbsdSsohLVuJdV+fsnV2wKE9kJULRWUqnBbQW5v9wRWh02MNv4aMLXYHlGyHpDQ4uFslbdc1JZLxGGwpVz8UAgHu0//vmCCQV1KCJIQTE5CcDi9XmgvtNIz/1Yb3wB45JpLt/kbCMCqGPEcxJmuXFYRQSo9UC1fmXUWEa+jUEdn65dFuz8j0nqFGS8mojCytxLQD7xGGz8fQkVr0tpbaaLeniqCE3aW3tbi9tW/6G4zZQnwVR0udcE7SWLVb64B3tbRslxxaWlq2KvVyDFiFaHQEY6Af2bmy8Hprk7Rbu6Ldns+nj5upgZTEkB4vD5BMDJwXJowBUrbPBxrIz0wNJPAf2cF7CUK237kAAAAASUVORK5CYII="},"0b25":function(t,e,n){var i=n("da84"),r=n("5926"),s=n("50c4"),a=i.RangeError;t.exports=function(t){if(void 0===t)return 0;var e=r(t),t=s(e);if(e!==t)throw a("Wrong length or index");return t}},"0ca5":function(t,e,n){"use strict";n.d(e,"a",function(){return i});var a=n("5a89");const o=new WeakMap;class i extends a.E{constructor(t){super(t),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(t){return this.decoderPath=t,this}setDecoderConfig(t){return this.decoderConfig=t,this}setWorkerLimit(t){return this.workerLimit=t,this}load(t,n,e,i){const r=new a.n(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(t,t=>{var e={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(t,e).then(n).catch(i)},e,i)}decodeDracoFile(t,e,n,i){n={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n};this.decodeGeometry(t,n).then(e)}decodeGeometry(n,i){for(const o in i.attributeTypes){const n=i.attributeTypes[o];void 0!==n.BYTES_PER_ELEMENT&&(i.attributeTypes[o]=n.name)}var t=JSON.stringify(i);if(o.has(n)){const i=o.get(n);if(i.key===t)return i.promise;if(0===n.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let r;const s=this.workerNextTaskID++,e=n.byteLength,a=this._getWorker(s,e).then(t=>(r=t,new Promise((t,e)=>{r._callbacks[s]={resolve:t,reject:e},r.postMessage({type:"decode",id:s,taskConfig:i,buffer:n},[n])}))).then(t=>this._createGeometry(t.geometry));return a.catch(()=>!0).then(()=>{r&&s&&this._releaseTask(r,s)}),o.set(n,{key:t,promise:a}),a}_createGeometry(e){const n=new a.g;e.index&&n.setIndex(new a.f(e.index.array,1));for(let t=0;t<e.attributes.length;t++){var i=e.attributes[t],r=i.name,s=i.array,i=i.itemSize;n.setAttribute(r,new a.f(s,i))}return n}_loadLibrary(n,t){const i=new a.n(this.manager);return i.setPath(this.decoderPath),i.setResponseType(t),i.setWithCredentials(this.withCredentials),new Promise((t,e)=>{i.load(n,t,void 0,e)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const r="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return r?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(t=>{const e=t[0];r||(this.decoderConfig.wasmBinary=t[1]);const n=function(){let t,e;function o(n,i,r,s){var a=s.attributeIDs,o=s.attributeTypes;let l,t;var e=i.GetEncodedGeometryType(r);if(e===n.TRIANGULAR_MESH)l=new n.Mesh,t=i.DecodeBufferToMesh(r,l);else{if(e!==n.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");l=new n.PointCloud,t=i.DecodeBufferToPointCloud(r,l)}if(!t.ok()||0===l.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+t.error_msg());const c={index:null,attributes:[]};for(const h in a){const r=self[o[h]];let t,e;if(s.useUniqueIDs)e=a[h],t=i.GetAttributeByUniqueId(l,e);else{if(e=i.GetAttributeId(l,n[a[h]]),-1===e)continue;t=i.GetAttribute(l,e)}c.attributes.push(function(t,e,n,i,r,s){var a=s.num_components(),o=n.num_points(),l=o*a,c=l*r.BYTES_PER_ELEMENT,h=function(t,e){switch(e){case Float32Array:return t.DT_FLOAT32;case Int8Array:return t.DT_INT8;case Int16Array:return t.DT_INT16;case Int32Array:return t.DT_INT32;case Uint8Array:return t.DT_UINT8;case Uint16Array:return t.DT_UINT16;case Uint32Array:return t.DT_UINT32}}(t,r),o=t._malloc(c);e.GetAttributeDataArrayForAllPoints(n,s,h,c,o);l=new r(t.HEAPF32.buffer,o,l).slice();return t._free(o),{name:i,array:l,itemSize:a}}(n,i,l,h,r,t))}return e===n.TRIANGULAR_MESH&&(c.index=function(t,e,n){var i=n.num_faces(),r=3*i,s=4*r,i=t._malloc(s);e.GetTrianglesUInt32Array(n,s,i);r=new Uint32Array(t.HEAPF32.buffer,i,r).slice();return t._free(i),{array:r,itemSize:1}}(n,i,l)),n.destroy(l),c}onmessage=function(r){const s=r.data;switch(s.type){case"init":t=s.decoderConfig,e=new Promise(function(e){t.onModuleLoaded=function(t){e({draco:t})},DracoDecoderModule(t)});break;case"decode":const r=s.buffer,a=s.taskConfig;e.then(t=>{const e=t.draco,n=new e.Decoder,i=new e.DecoderBuffer;i.Init(new Int8Array(r),r.byteLength);try{const t=o(e,n,i,a),r=t.attributes.map(t=>t.array.buffer);t.index&&r.push(t.index.array.buffer),self.postMessage({type:"decode",id:s.id,geometry:t},r)}catch(t){self.postMessage({type:"error",id:s.id,error:t.message})}finally{e.destroy(i),e.destroy(n)}})}}}.toString(),i=["/* draco decoder */",e,"","/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i]))}),this.decoderPending}_getWorker(n,e){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const n=new Worker(this.workerSourceURL);n._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:this.decoderConfig}),n.onmessage=function(t){var e=t.data;switch(e.type){case"decode":n._callbacks[e.id].resolve(e);break;case"error":n._callbacks[e.id].reject(e)}},this.workerPool.push(n)}else this.workerPool.sort(function(t,e){return t._taskLoad>e._taskLoad?-1:1});const t=this.workerPool[this.workerPool.length-1];return t._taskCosts[n]=e,t._taskLoad+=e,t})}_releaseTask(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]}debug(){}dispose(){for(let t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,this}}},1448:function(t,e,n){var i=n("dfb9"),r=n("b6b7");t.exports=function(t,e){return i(r(t),e)}},"145e":function(t,e,n){"use strict";var l=n("7b0b"),c=n("23cb"),h=n("07fa"),u=Math.min;t.exports=[].copyWithin||function(t,e){var n=l(this),i=h(n),r=c(t,i),s=c(e,i),e=2<arguments.length?arguments[2]:void 0,a=u((void 0===e?i:c(e,i))-s,i-r),o=1;for(s<r&&r<s+a&&(o=-1,s+=a-1,r+=a-1);0<a--;)s in n?n[r]=n[s]:delete n[r],r+=o,s+=o;return n}},"170b":function(t,e,n){"use strict";var i=n("ebb5"),r=n("50c4"),s=n("23cb"),a=n("b6b7"),o=i.aTypedArray;(0,i.exportTypedArrayMethod)("subarray",function(t,e){var n=o(this),i=n.length,t=s(t,i);return new(a(n))(n.buffer,n.byteOffset+t*n.BYTES_PER_ELEMENT,r((void 0===e?i:s(e,i))-t))})},"182d":function(t,e,n){var i=n("da84"),r=n("f8cd"),s=i.RangeError;t.exports=function(t,e){t=r(t);if(t%e)throw s("Wrong offset");return t}},"219c":function(t,e,n){"use strict";var i=n("da84"),r=n("e330"),s=n("d039"),a=n("59ed"),o=n("addb"),l=n("ebb5"),c=n("04d1"),h=n("d998"),u=n("2d00"),d=n("512c"),p=i.Array,f=l.aTypedArray,l=l.exportTypedArrayMethod,m=i.Uint16Array,g=m&&r(m.prototype.sort),r=!(!g||s(function(){g(new m(2),null)})&&s(function(){g(new m(2),{})})),v=!!g&&!s(function(){if(u)return u<74;if(c)return c<67;if(h)return!0;if(d)return d<602;for(var t,e=new m(516),n=p(516),i=0;i<516;i++)t=i%4,e[i]=515-i,n[i]=i-2*t+3;for(g(e,function(t,e){return(t/4|0)-(e/4|0)}),i=0;i<516;i++)if(e[i]!==n[i])return!0});l("sort",function(t){return void 0!==t&&a(t),v?g(this,t):o(f(this),(n=t,function(t,e){return void 0!==n?+n(t,e)||0:e!=e?-1:t!=t?1:0===t&&0===e?0<1/t&&1/e<0?1:-1:e<t}));var n},!v||r)},2532:function(t,e,n){"use strict";var i=n("23e7"),r=n("e330"),s=n("5a34"),a=n("1d80"),o=n("577e"),n=n("ab13"),l=r("".indexOf);i({target:"String",proto:!0,forced:!n("includes")},{includes:function(t){return!!~l(o(a(this)),o(s(t)),1<arguments.length?arguments[1]:void 0)}})},"25a1":function(t,e,n){"use strict";var i=n("ebb5"),r=n("d58f").right,s=i.aTypedArray;(0,i.exportTypedArrayMethod)("reduceRight",function(t){var e=arguments.length;return r(s(this),t,e,1<e?arguments[1]:void 0)})},2954:function(t,e,n){"use strict";var i=n("ebb5"),a=n("b6b7"),r=n("d039"),o=n("f36a"),l=i.aTypedArray;(0,i.exportTypedArrayMethod)("slice",function(t,e){for(var n=o(l(this),t,e),e=a(this),i=0,r=n.length,s=new e(r);i<r;)s[i]=n[i++];return s},r(function(){new Int8Array(1).slice()}))},3280:function(t,e,n){"use strict";var i=n("ebb5"),r=n("2ba4"),s=n("e58c"),a=i.aTypedArray;(0,i.exportTypedArrayMethod)("lastIndexOf",function(t){var e=arguments.length;return r(s,a(this),1<e?[t,arguments[1]]:[t])})},"32ab":function(t,e,n){"use strict";n.d(e,"b",function(){return r}),n.d(e,"a",function(){return s});n=n("5a89");const m=new n.tb,g=new n.bb,v=new n.tb;class i extends n.T{constructor(t=document.createElement("div")){super(),this.element=t,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.addEventListener("removed",function(){this.traverse(function(t){t.element instanceof Element&&null!==t.element.parentNode&&t.element.parentNode.removeChild(t.element)})})}copy(t,e){return super.copy(t,e),this.element=t.element.cloneNode(!0),this}}i.prototype.isCSS3DObject=!0;class r extends i{constructor(t){super(t),this.rotation2D=0}copy(t,e){return super.copy(t,e),this.rotation2D=t.rotation2D,this}}r.prototype.isCSS3DSprite=!0;const x=new n.J,y=new n.J;class s{constructor(t={}){const l=this;let n,i,a,o;const c={camera:{fov:0,style:""},objects:new WeakMap},h=void 0!==t.element?t.element:document.createElement("div");h.style.overflow="hidden",this.domElement=h;const u=document.createElement("div");function d(t){return Math.abs(t)<1e-10?0:t}function p(t){t=t.elements;return"matrix3d("+d(t[0])+","+d(-t[1])+","+d(t[2])+","+d(t[3])+","+d(t[4])+","+d(-t[5])+","+d(t[6])+","+d(t[7])+","+d(t[8])+","+d(-t[9])+","+d(t[10])+","+d(t[11])+","+d(t[12])+","+d(-t[13])+","+d(t[14])+","+d(t[15])+")"}function f(t){t=t.elements;return"translate(-50%,-50%)"+("matrix3d("+d(t[0])+","+d(t[1])+","+d(t[2])+","+d(t[3])+","+d(-t[4])+","+d(-t[5])+","+d(-t[6])+","+d(-t[7])+","+d(t[8])+","+d(t[9])+","+d(t[10])+","+d(t[11])+","+d(t[12])+","+d(t[13])+","+d(t[14])+","+d(t[15])+")")}u.style.transformStyle="preserve-3d",u.style.pointerEvents="none",h.appendChild(u),this.getSize=function(){return{width:n,height:i}},this.render=function(t,e){var n=e.projectionMatrix.elements[5]*o;let i,r;c.camera.fov!==n&&(h.style.perspective=e.isPerspectiveCamera?n+"px":"",c.camera.fov=n),!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),e.isOrthographicCamera&&(i=-(e.right+e.left)/2,r=(e.top+e.bottom)/2);var s=e.isOrthographicCamera?"scale("+n+")translate("+d(i)+"px,"+d(r)+"px)"+p(e.matrixWorldInverse):"translateZ("+n+"px)"+p(e.matrixWorldInverse),n=s+"translate("+a+"px,"+o+"px)";c.camera.style!==n&&(u.style.transform=n,c.camera.style=n),function n(i,r,s,a){if(i.isCSS3DObject){let t;i.onBeforeRender(l,r,s),t=i.isCSS3DSprite?(x.copy(s.matrixWorldInverse),x.transpose(),0!==i.rotation2D&&x.multiply(y.makeRotationZ(i.rotation2D)),i.matrixWorld.decompose(m,g,v),x.setPosition(m),x.scale(v),x.elements[3]=0,x.elements[7]=0,x.elements[11]=0,x.elements[15]=1,f(x)):f(i.matrixWorld);const e=i.element,o=c.objects.get(i);if(void 0===o||o.style!==t){e.style.transform=t;const l={style:t};c.objects.set(i,l)}e.style.display=i.visible?"":"none",e.parentNode!==u&&u.appendChild(e),i.onAfterRender(l,r,s)}for(let t=0,e=i.children.length;t<e;t++)n(i.children[t],r,s,a)}(t,t,e,s)},this.setSize=function(t,e){n=t,i=e,a=n/2,o=i/2,h.style.width=t+"px",h.style.height=e+"px",u.style.width=t+"px",u.style.height=e+"px"}}}},"34ad":function(t,e,n){"use strict";n.d(e,"a",function(){return i});var v=n("5a89");class i extends v.E{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new a(t)}),this.register(function(t){return new f(t)}),this.register(function(t){return new m(t)}),this.register(function(t){return new o(t)}),this.register(function(t){return new l(t)}),this.register(function(t){return new h(t)}),this.register(function(t){return new u(t)}),this.register(function(t){return new p(t)}),this.register(function(t){return new s(t)}),this.register(function(t){return new g(t)})}load(e,n,t,i){const r=this;let s;s=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:v.F.extractUrlBase(e),this.manager.itemStart(e);function a(t){i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)}const o=new v.n(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(t){try{r.parse(t,s,function(t){n(t),r.manager.itemEnd(e)},a)}catch(t){a(t)}},t,a)}setDRACOLoader(t){return this.dracoLoader=t,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return-1===this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.push(t),this}unregister(t){return-1!==this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(e,n,t,i){let r;const s={},a={};if("string"==typeof e)r=e;else{const n=v.F.decodeText(new Uint8Array(e,0,4));if(n===x){try{s[d.KHR_BINARY_GLTF]=new _(e)}catch(t){return void(i&&i(t))}r=s[d.KHR_BINARY_GLTF].content}else r=v.F.decodeText(new Uint8Array(e))}var o=JSON.parse(r);if(void 0===o.asset||o.asset.version[0]<2)i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{const l=new G(o,{path:n||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let t=0;t<this.pluginCallbacks.length;t++){const e=this.pluginCallbacks[t](l);a[e.name]=e,s[e.name]=!0}if(o.extensionsUsed)for(let t=0;t<o.extensionsUsed.length;++t){const e=o.extensionsUsed[t],n=o.extensionsRequired||[];switch(e){case d.KHR_MATERIALS_UNLIT:s[e]=new c;break;case d.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:s[e]=new w;break;case d.KHR_DRACO_MESH_COMPRESSION:s[e]=new M(o,this.dracoLoader);break;case d.KHR_TEXTURE_TRANSFORM:s[e]=new b;break;case d.KHR_MESH_QUANTIZATION:s[e]=new T;break;default:0<=n.indexOf(e)&&a[e]}}l.setExtensions(s),l.setPlugins(a),l.parse(t,i)}}parseAsync(n,i){const r=this;return new Promise(function(t,e){r.parse(n,i,t,e)})}}function r(){let n={};return{get:function(t){return n[t]},add:function(t,e){n[t]=e},remove:function(t){delete n[t]},removeAll:function(){n={}}}}const d={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"};class s{constructor(t){this.parser=t,this.name=d.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const n=this.parser,i=this.parser.json.nodes||[];for(let t=0,e=i.length;t<e;t++){var r=i[t];r.extensions&&r.extensions[this.name]&&void 0!==r.extensions[this.name].light&&n._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(t){const e=this.parser,n="light:"+t;let i=e.cache.get(n);if(i)return i;const r=e.json,s=r.extensions&&r.extensions[this.name]||{},a=s.lights||[],o=a[t];let l;const c=new v.j(16777215);void 0!==o.color&&c.fromArray(o.color);var h=void 0!==o.range?o.range:0;switch(o.type){case"directional":l=new v.k(c),l.target.position.set(0,0,-1),l.add(l.target);break;case"point":l=new v.X(c),l.distance=h;break;case"spot":l=new v.lb(c),l.distance=h,o.spot=o.spot||{},o.spot.innerConeAngle=void 0!==o.spot.innerConeAngle?o.spot.innerConeAngle:0,o.spot.outerConeAngle=void 0!==o.spot.outerConeAngle?o.spot.outerConeAngle:Math.PI/4,l.angle=o.spot.outerConeAngle,l.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,l.target.position.set(0,0,-1),l.add(l.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return l.position.set(0,0,0),l.decay=2,void 0!==o.intensity&&(l.intensity=o.intensity),l.name=e.createUniqueName(o.name||"light_"+t),i=Promise.resolve(l),e.cache.add(n,i),i}createNodeAttachment(t){const e=this,n=this.parser,i=n.json,r=i.nodes[t],s=r.extensions&&r.extensions[this.name]||{},a=s.light;return void 0===a?null:this._loadLight(a).then(function(t){return n._getNodeRef(e.cache,a,t)})}}class c{constructor(){this.name=d.KHR_MATERIALS_UNLIT}getMaterialType(){return v.L}extendParams(t,e,n){const i=[];t.color=new v.j(1,1,1),t.opacity=1;e=e.pbrMetallicRoughness;if(e){if(Array.isArray(e.baseColorFactor)){const r=e.baseColorFactor;t.color.fromArray(r),t.opacity=r[3]}void 0!==e.baseColorTexture&&i.push(n.assignTexture(t,"map",e.baseColorTexture))}return Promise.all(i)}}class a{constructor(t){this.parser=t,this.name=d.KHR_MATERIALS_CLEARCOAT}getMaterialType(t){t=this.parser.json.materials[t];return t.extensions&&t.extensions[this.name]?v.M:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];if(void 0!==s.clearcoatFactor&&(e.clearcoat=s.clearcoatFactor),void 0!==s.clearcoatTexture&&r.push(n.assignTexture(e,"clearcoatMap",s.clearcoatTexture)),void 0!==s.clearcoatRoughnessFactor&&(e.clearcoatRoughness=s.clearcoatRoughnessFactor),void 0!==s.clearcoatRoughnessTexture&&r.push(n.assignTexture(e,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),void 0!==s.clearcoatNormalTexture&&(r.push(n.assignTexture(e,"clearcoatNormalMap",s.clearcoatNormalTexture)),void 0!==s.clearcoatNormalTexture.scale)){const t=s.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new v.sb(t,t)}return Promise.all(r)}}class o{constructor(t){this.parser=t,this.name=d.KHR_MATERIALS_SHEEN}getMaterialType(t){t=this.parser.json.materials[t];return t.extensions&&t.extensions[this.name]?v.M:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[];e.sheenColor=new v.j(0,0,0),e.sheenRoughness=0,e.sheen=1;t=i.extensions[this.name];return void 0!==t.sheenColorFactor&&e.sheenColor.fromArray(t.sheenColorFactor),void 0!==t.sheenRoughnessFactor&&(e.sheenRoughness=t.sheenRoughnessFactor),void 0!==t.sheenColorTexture&&r.push(n.assignTexture(e,"sheenColorMap",t.sheenColorTexture)),void 0!==t.sheenRoughnessTexture&&r.push(n.assignTexture(e,"sheenRoughnessMap",t.sheenRoughnessTexture)),Promise.all(r)}}class l{constructor(t){this.parser=t,this.name=d.KHR_MATERIALS_TRANSMISSION}getMaterialType(t){t=this.parser.json.materials[t];return t.extensions&&t.extensions[this.name]?v.M:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return void 0!==s.transmissionFactor&&(e.transmission=s.transmissionFactor),void 0!==s.transmissionTexture&&r.push(n.assignTexture(e,"transmissionMap",s.transmissionTexture)),Promise.all(r)}}class h{constructor(t){this.parser=t,this.name=d.KHR_MATERIALS_VOLUME}getMaterialType(t){t=this.parser.json.materials[t];return t.extensions&&t.extensions[this.name]?v.M:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];e.thickness=void 0!==s.thicknessFactor?s.thicknessFactor:0,void 0!==s.thicknessTexture&&r.push(n.assignTexture(e,"thicknessMap",s.thicknessTexture)),e.attenuationDistance=s.attenuationDistance||0;t=s.attenuationColor||[1,1,1];return e.attenuationColor=new v.j(t[0],t[1],t[2]),Promise.all(r)}}class u{constructor(t){this.parser=t,this.name=d.KHR_MATERIALS_IOR}getMaterialType(t){t=this.parser.json.materials[t];return t.extensions&&t.extensions[this.name]?v.M:null}extendMaterialParams(t,e){t=this.parser.json.materials[t];if(!t.extensions||!t.extensions[this.name])return Promise.resolve();t=t.extensions[this.name];return e.ior=void 0!==t.ior?t.ior:1.5,Promise.resolve()}}class p{constructor(t){this.parser=t,this.name=d.KHR_MATERIALS_SPECULAR}getMaterialType(t){t=this.parser.json.materials[t];return t.extensions&&t.extensions[this.name]?v.M:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];e.specularIntensity=void 0!==s.specularFactor?s.specularFactor:1,void 0!==s.specularTexture&&r.push(n.assignTexture(e,"specularIntensityMap",s.specularTexture));t=s.specularColorFactor||[1,1,1];return e.specularColor=new v.j(t[0],t[1],t[2]),void 0!==s.specularColorTexture&&r.push(n.assignTexture(e,"specularColorMap",s.specularColorTexture).then(function(t){t.encoding=v.xb})),Promise.all(r)}}class f{constructor(t){this.parser=t,this.name=d.KHR_TEXTURE_BASISU}loadTexture(t){const e=this.parser,n=e.json,i=n.textures[t];if(!i.extensions||!i.extensions[this.name])return null;var r=i.extensions[this.name],s=n.images[r.source],r=e.options.ktx2Loader;if(r)return e.loadTextureImage(t,s,r);if(n.extensionsRequired&&0<=n.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}}class m{constructor(t){this.parser=t,this.name=d.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const n=this.name,i=this.parser,r=i.json,t=r.textures[e];if(!t.extensions||!t.extensions[n])return null;const s=t.extensions[n],a=r.images[s.source];let o=i.textureLoader;if(a.uri){const e=i.options.manager.getHandler(a.uri);null!==e&&(o=e)}return this.detectSupport().then(function(t){if(t)return i.loadTextureImage(e,a,o);if(r.extensionsRequired&&0<=r.extensionsRequired.indexOf(n))throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(1===e.height)}})),this.isSupported}}class g{constructor(t){this.name=d.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(a){const t=this.parser.json,e=t.bufferViews[a];if(e.extensions&&e.extensions[this.name]){const a=e.extensions[this.name],n=this.parser.getDependency("buffer",a.buffer),o=this.parser.options.meshoptDecoder;if(o&&o.supported)return Promise.all([n,o.ready]).then(function(t){var e=a.byteOffset||0,n=a.byteLength||0,i=a.count,r=a.byteStride,s=new ArrayBuffer(i*r),n=new Uint8Array(t[0],e,n);return o.decodeGltfBuffer(new Uint8Array(s),i,r,n,a.mode,a.filter),s});if(t.extensionsRequired&&0<=t.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return null}}const x="glTF",y={JSON:1313821514,BIN:5130562};class _{constructor(t){this.name=d.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(t,0,12);if(this.header={magic:v.F.decodeText(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==x)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-12,i=new DataView(t,12);let r=0;for(;r<n;){const e=i.getUint32(r,!0);r+=4;const n=i.getUint32(r,!0);if(r+=4,n===y.JSON){const n=new Uint8Array(t,12+r,e);this.content=v.F.decodeText(n)}else if(n===y.BIN){const n=12+r;this.body=t.slice(n,n+e)}r+=e}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class M{constructor(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=d.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(t,e){const n=this.json,r=this.dracoLoader,i=t.extensions[this.name].bufferView,s=t.extensions[this.name].attributes,a={},o={},l={};for(const c in s){const t=I[c]||c.toLowerCase();a[t]=s[c]}for(const h in t.attributes){const e=I[h]||h.toLowerCase();if(void 0!==s[h]){const r=n.accessors[t.attributes[h]],i=P[r.componentType];l[e]=i,o[e]=!0===r.normalized}}return e.getDependency("bufferView",i).then(function(t){return new Promise(function(i){r.decodeDracoFile(t,function(t){for(const i in t.attributes){const e=t.attributes[i],n=o[i];void 0!==n&&(e.normalized=n)}i(t)},a,l)})})}}class b{constructor(){this.name=d.KHR_TEXTURE_TRANSFORM}extendTexture(t,e){return e.texCoord,void 0===e.offset&&void 0===e.rotation&&void 0===e.scale||(t=t.clone(),void 0!==e.offset&&t.offset.fromArray(e.offset),void 0!==e.rotation&&(t.rotation=e.rotation),void 0!==e.scale&&t.repeat.fromArray(e.scale),t.needsUpdate=!0),t}}class S extends v.N{constructor(t){super(),this.isGLTFSpecularGlossinessMaterial=!0;const e=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),n=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),i=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\ttexelSpecular = sRGBToLinear( texelSpecular );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),r=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),s=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.roughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.","material.roughness += geometryRoughness;","material.roughness = min( material.roughness, 1.0 );","material.specularColor = specularFactor;"].join("\n"),a={specular:{value:(new v.j).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=a,this.onBeforeCompile=function(t){for(const e in a)t.uniforms[e]=a[e];t.fragmentShader=t.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>",e).replace("#include <metalnessmap_pars_fragment>",n).replace("#include <roughnessmap_fragment>",i).replace("#include <metalnessmap_fragment>",r).replace("#include <lights_physical_fragment>",s)},Object.defineProperties(this,{specular:{get:function(){return a.specular.value},set:function(t){a.specular.value=t}},specularMap:{get:function(){return a.specularMap.value},set:function(t){(a.specularMap.value=t)?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return a.glossiness.value},set:function(t){a.glossiness.value=t}},glossinessMap:{get:function(){return a.glossinessMap.value},set:function(t){(a.glossinessMap.value=t)?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(t)}copy(t){return super.copy(t),this.specularMap=t.specularMap,this.specular.copy(t.specular),this.glossinessMap=t.glossinessMap,this.glossiness=t.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this}}class w{constructor(){this.name=d.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.specularGlossinessParams=["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"]}getMaterialType(){return S}extendParams(t,e,n){e=e.extensions[this.name];t.color=new v.j(1,1,1),t.opacity=1;const i=[];if(Array.isArray(e.diffuseFactor)){const r=e.diffuseFactor;t.color.fromArray(r),t.opacity=r[3]}if(void 0!==e.diffuseTexture&&i.push(n.assignTexture(t,"map",e.diffuseTexture)),t.emissive=new v.j(0,0,0),t.glossiness=void 0!==e.glossinessFactor?e.glossinessFactor:1,t.specular=new v.j(1,1,1),Array.isArray(e.specularFactor)&&t.specular.fromArray(e.specularFactor),void 0!==e.specularGlossinessTexture){const r=e.specularGlossinessTexture;i.push(n.assignTexture(t,"glossinessMap",r)),i.push(n.assignTexture(t,"specularMap",r))}return Promise.all(i)}createMaterial(t){const e=new S(t);return e.fog=!0,e.color=t.color,e.map=void 0===t.map?null:t.map,e.lightMap=null,e.lightMapIntensity=1,e.aoMap=void 0===t.aoMap?null:t.aoMap,e.aoMapIntensity=1,e.emissive=t.emissive,e.emissiveIntensity=1,e.emissiveMap=void 0===t.emissiveMap?null:t.emissiveMap,e.bumpMap=void 0===t.bumpMap?null:t.bumpMap,e.bumpScale=1,e.normalMap=void 0===t.normalMap?null:t.normalMap,e.normalMapType=v.nb,t.normalScale&&(e.normalScale=t.normalScale),e.displacementMap=null,e.displacementScale=1,e.displacementBias=0,e.specularMap=void 0===t.specularMap?null:t.specularMap,e.specular=t.specular,e.glossinessMap=void 0===t.glossinessMap?null:t.glossinessMap,e.glossiness=t.glossiness,e.alphaMap=null,e.envMap=void 0===t.envMap?null:t.envMap,e.envMapIntensity=1,e.refractionRatio=.98,e}}class T{constructor(){this.name=d.KHR_MESH_QUANTIZATION}}class A extends v.t{constructor(t,e,n,i){super(t,e,n,i)}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=t*i*3+i;for(let t=0;t!==i;t++)e[t]=n[r+t];return e}}A.prototype.beforeStart_=A.prototype.copySampleValue_,A.prototype.afterEnd_=A.prototype.copySampleValue_,A.prototype.interpolate_=function(e,n,i,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=2*o,t=3*o,c=r-n,h=(i-n)/c,u=h*h,d=u*h,p=e*t,f=p-t,m=-2*d+3*u,g=d-u,v=1-m,x=g-u+h;for(let t=0;t!==o;t++){const e=a[f+t+o],n=a[f+t+l]*c,i=a[p+t+o],r=a[p+t]*c;s[t]=v*e+x*n+m*i+g*r}return s};const E=new v.bb;class L extends A{interpolate_(t,e,n,i){i=super.interpolate_(t,e,n,i);return E.fromArray(i).normalize().toArray(i),i}}const C={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},P={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},D={9728:v.P,9729:v.B,9984:v.R,9985:v.D,9986:v.Q,9987:v.C},R={33071:v.i,33648:v.O,10497:v.fb},N={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},I={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},O={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},z={CUBICSPLINE:void 0,LINEAR:v.v,STEP:v.u},U={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function F(t,e,n){for(const i in n.extensions)void 0===t[i]&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[i]=n.extensions[i])}function B(t,e){void 0!==e.extras&&"object"==typeof e.extras&&Object.assign(t.userData,e.extras)}function k(n){let i="";var r=Object.keys(n).sort();for(let t=0,e=r.length;t<e;t++)i+=r[t]+":"+n[r[t]]+";";return i}function V(t){switch(t){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}class G{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new r,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.textureCache={},this.nodeNamesUsed={},"undefined"!=typeof createImageBitmap&&!1===/Firefox|Safari/.test(navigator.userAgent)?this.textureLoader=new v.q(this.options.manager):this.textureLoader=new v.pb(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new v.n(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(n,t){const i=this,r=this.json,s=this.extensions;this.cache.removeAll(),this._invokeAll(function(t){return t._markDefs&&t._markDefs()}),Promise.all(this._invokeAll(function(t){return t.beforeRoot&&t.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(t){const e={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:i,userData:{}};F(s,e,r),B(e,r),Promise.all(i._invokeAll(function(t){return t.afterRoot&&t.afterRoot(e)})).then(function(){n(e)})}).catch(t)}_markDefs(){const n=this.json.nodes||[],i=this.json.skins||[],r=this.json.meshes||[];for(let t=0,e=i.length;t<e;t++){const r=i[t].joints;for(let t=0,e=r.length;t<e;t++)n[r[t]].isBone=!0}for(let t=0,e=n.length;t<e;t++){const i=n[t];void 0!==i.mesh&&(this._addNodeRef(this.meshCache,i.mesh),void 0!==i.skin&&(r[i.mesh].isSkinnedMesh=!0)),void 0!==i.camera&&this._addNodeRef(this.cameraCache,i.camera)}}_addNodeRef(t,e){void 0!==e&&(void 0===t.refs[e]&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}_getNodeRef(t,e,n){if(t.refs[e]<=1)return n;const i=n.clone(),s=(t,e)=>{var n,i,r=this.associations.get(t);null!=r&&this.associations.set(e,r);for([n,i]of t.children.entries())s(i,e.children[n])};return s(n,i),i.name+="_instance_"+t.uses[e]++,i}_invokeOne(e){const n=Object.values(this.plugins);n.push(this);for(let t=0;t<n.length;t++){var i=e(n[t]);if(i)return i}return null}_invokeAll(e){const n=Object.values(this.plugins);n.unshift(this);const i=[];for(let t=0;t<n.length;t++){var r=e(n[t]);r&&i.push(r)}return i}getDependency(t,e){var n=t+":"+e;let i=this.cache.get(n);if(!i){switch(t){case"scene":i=this.loadScene(e);break;case"node":i=this.loadNode(e);break;case"mesh":i=this._invokeOne(function(t){return t.loadMesh&&t.loadMesh(e)});break;case"accessor":i=this.loadAccessor(e);break;case"bufferView":i=this._invokeOne(function(t){return t.loadBufferView&&t.loadBufferView(e)});break;case"buffer":i=this.loadBuffer(e);break;case"material":i=this._invokeOne(function(t){return t.loadMaterial&&t.loadMaterial(e)});break;case"texture":i=this._invokeOne(function(t){return t.loadTexture&&t.loadTexture(e)});break;case"skin":i=this.loadSkin(e);break;case"animation":i=this.loadAnimation(e);break;case"camera":i=this.loadCamera(e);break;default:throw new Error("Unknown type: "+t)}this.cache.add(n,i)}return i}getDependencies(n){let t=this.cache.get(n);if(!t){const i=this,e=this.json[n+("mesh"===n?"es":"s")]||[];t=Promise.all(e.map(function(t,e){return i.getDependency(n,e)})),this.cache.add(n,t)}return t}loadBuffer(t){const n=this.json.buffers[t],i=this.fileLoader;if(n.type&&"arraybuffer"!==n.type)throw new Error("THREE.GLTFLoader: "+n.type+" buffer type is not supported.");if(void 0===n.uri&&0===t)return Promise.resolve(this.extensions[d.KHR_BINARY_GLTF].body);const r=this.options;return new Promise(function(t,e){i.load(v.F.resolveURL(n.uri,r.path),t,void 0,function(){e(new Error('THREE.GLTFLoader: Failed to load buffer "'+n.uri+'".'))})})}loadBufferView(t){const i=this.json.bufferViews[t];return this.getDependency("buffer",i.buffer).then(function(t){var e=i.byteLength||0,n=i.byteOffset||0;return t.slice(n,n+e)})}loadAccessor(t){const u=this,d=this.json,p=this.json.accessors[t];if(void 0===p.bufferView&&void 0===p.sparse)return Promise.resolve(null);const e=[];return void 0!==p.bufferView?e.push(this.getDependency("bufferView",p.bufferView)):e.push(null),void 0!==p.sparse&&(e.push(this.getDependency("bufferView",p.sparse.indices.bufferView)),e.push(this.getDependency("bufferView",p.sparse.values.bufferView))),Promise.all(e).then(function(e){const n=e[0],i=N[p.type],r=P[p.componentType],s=r.BYTES_PER_ELEMENT,t=s*i,a=p.byteOffset||0,o=void 0!==p.bufferView?d.bufferViews[p.bufferView].byteStride:void 0,l=!0===p.normalized;let c,h;if(o&&o!==t){const e=Math.floor(a/o),d="InterleavedBuffer:"+p.bufferView+":"+p.componentType+":"+e+":"+p.count;let t=u.cache.get(d);t||(c=new r(n,e*o,p.count*o/s),t=new v.r(c,o/s),u.cache.add(d,t)),h=new v.s(t,i,a%o/s,l)}else c=null===n?new r(p.count*i):new r(n,a,p.count*i),h=new v.f(c,i,l);if(void 0!==p.sparse){const u=N.SCALAR,d=P[p.sparse.indices.componentType],s=p.sparse.indices.byteOffset||0,t=p.sparse.values.byteOffset||0,a=new d(e[1],s,p.sparse.count*u),o=new r(e[2],t,p.sparse.count*i);null!==n&&(h=new v.f(h.array.slice(),h.itemSize,h.normalized));for(let t=0,e=a.length;t<e;t++){const u=a[t];if(h.setX(u,o[t*i]),2<=i&&h.setY(u,o[t*i+1]),3<=i&&h.setZ(u,o[t*i+2]),4<=i&&h.setW(u,o[t*i+3]),5<=i)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return h})}loadTexture(t){const e=this.json,n=this.options,i=e.textures[t],r=e.images[i.source];let s=this.textureLoader;if(r.uri){const t=n.manager.getHandler(r.uri);null!==t&&(s=t)}return this.loadTextureImage(t,r,s)}loadTextureImage(n,e,r){const i=this,s=this.json,a=this.options,o=s.textures[n],t=(e.uri||e.bufferView)+":"+o.sampler;if(this.textureCache[t])return this.textureCache[t];const l=self.URL||self.webkitURL;let c=e.uri||"",h=!1;if(void 0!==e.bufferView)c=i.getDependency("bufferView",e.bufferView).then(function(t){h=!0;t=new Blob([t],{type:e.mimeType});return c=l.createObjectURL(t),c});else if(void 0===e.uri)throw new Error("THREE.GLTFLoader: Image "+n+" is missing URI and bufferView");var u=Promise.resolve(c).then(function(i){return new Promise(function(n,t){let e=n;!0===r.isImageBitmapLoader&&(e=function(t){const e=new v.ob(t);e.needsUpdate=!0,n(e)}),r.load(v.F.resolveURL(i,a.path),e,void 0,t)})}).then(function(t){!0===h&&l.revokeObjectURL(c),t.flipY=!1,o.name&&(t.name=o.name);var e=(s.samplers||{})[o.sampler]||{};return t.magFilter=D[e.magFilter]||v.B,t.minFilter=D[e.minFilter]||v.C,t.wrapS=R[e.wrapS]||v.fb,t.wrapT=R[e.wrapT]||v.fb,i.associations.set(t,{textures:n}),t}).catch(function(){return null});return this.textureCache[t]=u}assignTexture(e,n,i){const r=this;return this.getDependency("texture",i.index).then(function(t){if(void 0===i.texCoord||0==i.texCoord||"aoMap"===n&&i.texCoord,r.extensions[d.KHR_TEXTURE_TRANSFORM]){const e=void 0!==i.extensions?i.extensions[d.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const n=r.associations.get(t);t=r.extensions[d.KHR_TEXTURE_TRANSFORM].extendTexture(t,e),r.associations.set(t,n)}}return e[n]=t})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;var i=void 0===t.attributes.tangent,r=void 0!==t.attributes.color,s=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new v.Z,v.H.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){const e="LineBasicMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new v.x,v.H.prototype.copy.call(t,n),t.color.copy(n.color),this.cache.add(e,t)),n=t}if(i||r||s){let t="ClonedMaterial:"+n.uuid+":";n.isGLTFSpecularGlossinessMaterial&&(t+="specular-glossiness:"),i&&(t+="derivative-tangents:"),r&&(t+="vertex-colors:"),s&&(t+="flat-shading:");let e=this.cache.get(t);e||(e=n.clone(),r&&(e.vertexColors=!0),s&&(e.flatShading=!0),i&&(e.normalScale&&(e.normalScale.y*=-1),e.clearcoatNormalScale&&(e.clearcoatNormalScale.y*=-1)),this.cache.add(t,e),this.associations.set(e,this.associations.get(n))),n=e}n.aoMap&&void 0===t.attributes.uv2&&void 0!==t.attributes.uv&&t.setAttribute("uv2",t.attributes.uv),e.material=n}getMaterialType(){return v.N}loadMaterial(e){const n=this,t=this.json,i=this.extensions,r=t.materials[e];let s;const a={},o=r.extensions||{},l=[];if(o[d.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){const e=i[d.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];s=e.getMaterialType(),l.push(e.extendParams(a,r,n))}else if(o[d.KHR_MATERIALS_UNLIT]){const e=i[d.KHR_MATERIALS_UNLIT];s=e.getMaterialType(),l.push(e.extendParams(a,r,n))}else{const t=r.pbrMetallicRoughness||{};if(a.color=new v.j(1,1,1),a.opacity=1,Array.isArray(t.baseColorFactor)){const e=t.baseColorFactor;a.color.fromArray(e),a.opacity=e[3]}void 0!==t.baseColorTexture&&l.push(n.assignTexture(a,"map",t.baseColorTexture)),a.metalness=void 0!==t.metallicFactor?t.metallicFactor:1,a.roughness=void 0!==t.roughnessFactor?t.roughnessFactor:1,void 0!==t.metallicRoughnessTexture&&(l.push(n.assignTexture(a,"metalnessMap",t.metallicRoughnessTexture)),l.push(n.assignTexture(a,"roughnessMap",t.metallicRoughnessTexture))),s=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,a)})))}!0===r.doubleSided&&(a.side=v.l);var c=r.alphaMode||U.OPAQUE;if(c===U.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.format=v.db,a.transparent=!1,c===U.MASK&&(a.alphaTest=void 0!==r.alphaCutoff?r.alphaCutoff:.5)),void 0!==r.normalTexture&&s!==v.L&&(l.push(n.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new v.sb(1,1),void 0!==r.normalTexture.scale)){const e=r.normalTexture.scale;a.normalScale.set(e,e)}return void 0!==r.occlusionTexture&&s!==v.L&&(l.push(n.assignTexture(a,"aoMap",r.occlusionTexture)),void 0!==r.occlusionTexture.strength&&(a.aoMapIntensity=r.occlusionTexture.strength)),void 0!==r.emissiveFactor&&s!==v.L&&(a.emissive=(new v.j).fromArray(r.emissiveFactor)),void 0!==r.emissiveTexture&&s!==v.L&&l.push(n.assignTexture(a,"emissiveMap",r.emissiveTexture)),Promise.all(l).then(function(){let t;return t=s===S?i[d.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(a):new s(a),r.name&&(t.name=r.name),t.map&&(t.map.encoding=v.xb),t.emissiveMap&&(t.emissiveMap.encoding=v.xb),B(t,r),n.associations.set(t,{materials:e}),r.extensions&&F(i,t,r),t})}createUniqueName(t){var e=v.ab.sanitizeNodeName(t||"");let n=e;for(let t=1;this.nodeNamesUsed[n];++t)n=e+"_"+t;return this.nodeNamesUsed[n]=!0,n}loadGeometries(n){const i=this,r=this.extensions,s=this.primitiveCache;function a(e){return r[d.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,i).then(function(t){return H(t,e,i)})}const o=[];for(let t=0,e=n.length;t<e;t++){const r=n[t],h=(l=r,c=void 0,(c=l.extensions&&l.extensions[d.KHR_DRACO_MESH_COMPRESSION])?"draco:"+c.bufferView+":"+c.indices+":"+k(c.attributes):l.indices+":"+k(l.attributes)+":"+l.mode),u=s[h];u?o.push(u.promise):(l=r.extensions&&r.extensions[d.KHR_DRACO_MESH_COMPRESSION]?a(r):H(new v.g,r,i),s[h]={primitive:r,promise:l},o.push(l))}var l,c;return Promise.all(o)}loadMesh(l){const c=this,t=this.json,h=this.extensions,u=t.meshes[l],d=u.primitives,n=[];for(let t=0,e=d.length;t<e;t++){const l=void 0===d[t].material?(void 0===(i=this.cache).DefaultMaterial&&(i.DefaultMaterial=new v.N({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:v.o})),i.DefaultMaterial):this.getDependency("material",d[t].material);n.push(l)}var i;return n.push(c.loadGeometries(d)),Promise.all(n).then(function(n){const i=n.slice(0,n.length-1),r=n[n.length-1],s=[];for(let e=0,t=r.length;e<t;e++){const n=r[e],o=d[e];let t;var a=i[e];if(o.mode===C.TRIANGLES||o.mode===C.TRIANGLE_STRIP||o.mode===C.TRIANGLE_FAN||void 0===o.mode)t=new(!0===u.isSkinnedMesh?v.ib:v.K)(n,a),!0!==t.isSkinnedMesh||t.geometry.attributes.skinWeight.normalized||t.normalizeSkinWeights(),o.mode===C.TRIANGLE_STRIP?t.geometry=W(t.geometry,v.rb):o.mode===C.TRIANGLE_FAN&&(t.geometry=W(t.geometry,v.qb));else if(o.mode===C.LINES)t=new v.A(n,a);else if(o.mode===C.LINE_STRIP)t=new v.w(n,a);else if(o.mode===C.LINE_LOOP)t=new v.z(n,a);else{if(o.mode!==C.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+o.mode);t=new v.Y(n,a)}0<Object.keys(t.geometry.morphAttributes).length&&function(n,i){if(n.updateMorphTargets(),void 0!==i.weights)for(let t=0,e=i.weights.length;t<e;t++)n.morphTargetInfluences[t]=i.weights[t];if(i.extras&&Array.isArray(i.extras.targetNames)){var r=i.extras.targetNames;if(n.morphTargetInfluences.length===r.length){n.morphTargetDictionary={};for(let t=0,e=r.length;t<e;t++)n.morphTargetDictionary[r[t]]=t}}}(t,u),t.name=c.createUniqueName(u.name||"mesh_"+l),B(t,u),o.extensions&&F(h,t,o),c.assignFinalMaterial(t),s.push(t)}for(let t=0,e=s.length;t<e;t++)c.associations.set(s[t],{meshes:l,primitives:t});if(1===s.length)return s[0];const o=new v.p;c.associations.set(o,{meshes:l});for(let t=0,e=s.length;t<e;t++)o.add(s[t]);return o})}loadCamera(t){let e;var n=this.json.cameras[t],t=n[n.type];if(t)return"perspective"===n.type?e=new v.W(v.I.radToDeg(t.yfov),t.aspectRatio||1,t.znear||1,t.zfar||2e6):"orthographic"===n.type&&(e=new v.U(-t.xmag,t.xmag,t.ymag,-t.ymag,t.znear,t.zfar)),n.name&&(e.name=this.createUniqueName(n.name)),B(e,n),Promise.resolve(e)}loadSkin(t){const e=this.json.skins[t],n={joints:e.joints};return void 0===e.inverseBindMatrices?Promise.resolve(n):this.getDependency("accessor",e.inverseBindMatrices).then(function(t){return n.inverseBindMatrices=t,n})}loadAnimation(m){const n=this.json,g=n.animations[m],i=[],r=[],s=[],a=[],o=[];for(let t=0,e=g.channels.length;t<e;t++){const m=g.channels[t],n=g.samplers[m.sampler],l=m.target,c=void 0!==l.node?l.node:l.id,h=void 0!==g.parameters?g.parameters[n.input]:n.input,u=void 0!==g.parameters?g.parameters[n.output]:n.output;i.push(this.getDependency("node",c)),r.push(this.getDependency("accessor",h)),s.push(this.getDependency("accessor",u)),a.push(n),o.push(l)}return Promise.all([Promise.all(i),Promise.all(r),Promise.all(s),Promise.all(a),Promise.all(o)]).then(function(r){const n=r[0],i=r[1],s=r[2],a=r[3],o=r[4],l=[];for(let t=0,e=n.length;t<e;t++){const r=n[t],g=i[t],c=s[t],h=a[t],u=o[t];if(void 0!==r){let n;switch(r.updateMatrix(),r.matrixAutoUpdate=!0,O[u.path]){case O.weights:n=v.S;break;case O.rotation:n=v.cb;break;case O.position:case O.scale:default:n=v.ub}const d=r.name||r.uuid,p=void 0!==h.interpolation?z[h.interpolation]:v.v,f=[];O[u.path]===O.weights?r.traverse(function(t){t.morphTargetInfluences&&f.push(t.name||t.uuid)}):f.push(d);let i=c.array;if(c.normalized){const m=V(i.constructor),r=new Float32Array(i.length);for(let t=0,e=i.length;t<e;t++)r[t]=i[t]*m;i=r}for(let t=0,e=f.length;t<e;t++){const r=new n(f[t]+"."+O[u.path],g.array,i,p);"CUBICSPLINE"===h.interpolation&&(r.createInterpolant=function(t){const e=this instanceof v.cb?L:A;return new e(this.times,this.values,this.getValueSize()/3,t)},r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),l.push(r)}}}const c=g.name||"animation_"+m;return new v.a(c,void 0,l)})}createNodeMesh(t){const e=this.json,n=this,i=e.nodes[t];return void 0===i.mesh?null:n.getDependency("mesh",i.mesh).then(function(t){const e=n._getNodeRef(n.meshCache,i.mesh,t);return void 0!==i.weights&&e.traverse(function(n){if(n.isMesh)for(let t=0,e=i.weights.length;t<e;t++)n.morphTargetInfluences[t]=i.weights[t]}),e})}loadNode(r){const t=this.json,e=this.extensions,s=this,a=t.nodes[r],o=a.name?s.createUniqueName(a.name):"";return function(){const e=[],t=s._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(r)});return t&&e.push(t),void 0!==a.camera&&e.push(s.getDependency("camera",a.camera).then(function(t){return s._getNodeRef(s.cameraCache,a.camera,t)})),s._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(r)}).forEach(function(t){e.push(t)}),Promise.all(e)}().then(function(n){let i;if(i=!0===a.isBone?new v.c:1<n.length?new v.p:1===n.length?n[0]:new v.T,i!==n[0])for(let t=0,e=n.length;t<e;t++)i.add(n[t]);if(a.name&&(i.userData.name=a.name,i.name=o),B(i,a),a.extensions&&F(e,i,a),void 0!==a.matrix){const r=new v.J;r.fromArray(a.matrix),i.applyMatrix4(r)}else void 0!==a.translation&&i.position.fromArray(a.translation),void 0!==a.rotation&&i.quaternion.fromArray(a.rotation),void 0!==a.scale&&i.scale.fromArray(a.scale);return s.associations.has(i)||s.associations.set(i,{}),s.associations.get(i).nodes=r,i})}loadScene(t){const n=this.json,e=this.extensions,i=this.json.scenes[t],r=this,s=new v.p;i.name&&(s.name=r.createUniqueName(i.name)),B(s,i),i.extensions&&F(e,s,i);const a=i.nodes||[],o=[];for(let t=0,e=a.length;t<e;t++)o.push(function s(t,a,o,l){const e=o.nodes[t];return l.getDependency("node",t).then(function(t){if(void 0===e.skin)return t;let a;return l.getDependency("skin",e.skin).then(function(t){a=t;const n=[];for(let t=0,e=a.joints.length;t<e;t++)n.push(l.getDependency("node",a.joints[t]));return Promise.all(n)}).then(function(s){return t.traverse(function(n){if(n.isMesh){const i=[],r=[];for(let t=0,e=s.length;t<e;t++){const n=s[t];if(n){i.push(n);const s=new v.J;void 0!==a.inverseBindMatrices&&s.fromArray(a.inverseBindMatrices.array,16*t),r.push(s)}}n.bind(new v.hb(i,r),n.matrixWorld)}}),t})}).then(function(n){a.add(n);const i=[];if(e.children){const a=e.children;for(let t=0,e=a.length;t<e;t++){const r=a[t];i.push(s(r,n,o,l))}}return Promise.all(i)})}(a[t],s,n,r));return Promise.all(o).then(function(){return r.associations=(t=>{const n=new Map;for(var[e,i]of r.associations)(e instanceof v.H||e instanceof v.ob)&&n.set(e,i);return t.traverse(t=>{var e=r.associations.get(t);null!=e&&n.set(t,e)}),n})(s),s})}}function H(n,t,i){const e=t.attributes,r=[];for(const s in e){const t=I[s]||s.toLowerCase();t in n.attributes||r.push(function(t,e){return i.getDependency("accessor",t).then(function(t){n.setAttribute(e,t)})}(e[s],t))}if(void 0!==t.indices&&!n.index){const e=i.getDependency("accessor",t.indices).then(function(t){n.setIndex(t)});r.push(e)}return B(n,t),function(n,i,r){const s=i.attributes,a=new v.d;if(void 0!==s.POSITION){{const n=r.json.accessors[s.POSITION],i=n.min,o=n.max;if(void 0===i||void 0===o)return;if(a.set(new v.tb(i[0],i[1],i[2]),new v.tb(o[0],o[1],o[2])),n.normalized){const i=V(P[n.componentType]);a.min.multiplyScalar(i),a.max.multiplyScalar(i)}}const o=i.targets;if(void 0!==o){const n=new v.tb,i=new v.tb;for(let t=0,e=o.length;t<e;t++){const s=o[t];if(void 0!==s.POSITION){const v=r.json.accessors[s.POSITION],a=v.min,o=v.max;if(void 0!==a&&void 0!==o){if(i.setX(Math.max(Math.abs(a[0]),Math.abs(o[0]))),i.setY(Math.max(Math.abs(a[1]),Math.abs(o[1]))),i.setZ(Math.max(Math.abs(a[2]),Math.abs(o[2]))),v.normalized){const n=V(P[v.componentType]);i.multiplyScalar(n)}n.max(i)}}}a.expandByVector(n)}n.boundingBox=a;const t=new v.jb;a.getCenter(t.center),t.radius=a.min.distanceTo(a.max)/2,n.boundingSphere=t}}(n,t,i),Promise.all(r).then(function(){return void 0!==t.targets?function(n,i,r){let s=!1,a=!1;for(let t=0,e=i.length;t<e;t++){const n=i[t];if(void 0!==n.POSITION&&(s=!0),void 0!==n.NORMAL&&(a=!0),s&&a)break}if(!s&&!a)return Promise.resolve(n);const o=[],l=[];for(let t=0,e=i.length;t<e;t++){var c=i[t];if(s){const i=void 0!==c.POSITION?r.getDependency("accessor",c.POSITION):n.attributes.position;o.push(i)}if(a){const i=void 0!==c.NORMAL?r.getDependency("accessor",c.NORMAL):n.attributes.normal;l.push(i)}}return Promise.all([Promise.all(o),Promise.all(l)]).then(function(t){var e=t[0],t=t[1];return s&&(n.morphAttributes.position=e),a&&(n.morphAttributes.normal=t),n.morphTargetsRelative=!0,n})}(n,t.targets,i):n})}function W(t,e){let n=t.getIndex();if(null===n){const e=[],v=t.getAttribute("position");if(void 0===v)return t;for(let t=0;t<v.count;t++)e.push(t);t.setIndex(e),n=t.getIndex()}const i=n.count-2,r=[];if(e===v.qb)for(let t=1;t<=i;t++)r.push(n.getX(0)),r.push(n.getX(t)),r.push(n.getX(t+1));else for(let t=0;t<i;t++)t%2==0?(r.push(n.getX(t)),r.push(n.getX(t+1)),r.push(n.getX(t+2))):(r.push(n.getX(t+2)),r.push(n.getX(t+1)),r.push(n.getX(t)));r.length;const s=t.clone();return s.setIndex(r),s}},"3a7b":function(t,e,n){"use strict";var i=n("ebb5"),r=n("b727").findIndex,s=i.aTypedArray;(0,i.exportTypedArrayMethod)("findIndex",function(t){return r(s(this),t,1<arguments.length?arguments[1]:void 0)})},"3c5d":function(t,e,n){"use strict";var i=n("da84"),r=n("ebb5"),a=n("07fa"),o=n("182d"),l=n("7b0b"),n=n("d039"),c=i.RangeError,h=r.aTypedArray;(0,r.exportTypedArrayMethod)("set",function(t){h(this);var e=o(1<arguments.length?arguments[1]:void 0,1),n=this.length,i=l(t),r=a(i),s=0;if(n<r+e)throw c("Wrong length");for(;s<r;)this[e+s]=i[s++]},n(function(){new Int8Array(1).set({})}))},"3fcc":function(t,e,n){"use strict";var i=n("ebb5"),r=n("b727").map,s=n("b6b7"),a=i.aTypedArray;(0,i.exportTypedArrayMethod)("map",function(t){return r(a(this),t,1<arguments.length?arguments[1]:void 0,function(t,e){return new(s(t))(e)})})},"40ce":function(t,e){t.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAEk0lEQVRoQ+2ZTchWRRTH/z+oZWAJtUkJCgotKCr62GSQQVBQShLlwlCLykWGVpCQQS6s1DYWqZmLvlCyoEVQC61FFiVFWSQURIWQkRmtWp04Nfdl3nnm3pn7fAiPNDC88N4z55z/nJkz5/wfNOWDKfdf/wNII2hm50qaH00X+amZwPFxRn3kCJjZAknXSbpR0i2Szik4eELSe5IOSDoEfDsKoKEBmJk7vVbSnaM4IGmfpG3AoWH09AZgZudLeiQ4n7N5UJLvcjNdxqPSzEUtjm6TtBX4pQ+QXgDM7A5Jz0q6MDFyRNKbPoEfuhwwM197V5iXJrK+dj3wdi2IagBm9oCkFxLFhyXtAHbUGozlzOw+ST6vTNY/CLxYo7MKgJk9KWljovD+YR3PZC4H8VLy/43AUyUQRQBmtljS+4miZYBfvrENM/NksDdReDPwQZeRTgBmdo2kTxIF8/petFqUIUH8nMhfC3zapqMVQFDm6C+JFs8FPLtMbJiZZ6vfIwPfSVrctmldALYmqbJzJ8aJKBN5fyc8dQ+MLIDwSH0cSY/twtYCDRkqvtjX5x67NgB+mZoX9jBwVa3hccqZ2edRit0HLEv1DwAws8slfdFn983M8/hZgL/CxRF2dy9wsks4E4UrgC/jNTkAD3ttEoSOAvElHrBnZl4aeGHmYxOwoeDUTHSBmjTul/jioHMt8HwJgD/jtweh54D1BYdiAC66BViXW2Nm8dH03Z8P/FXQ76VLo+8dwMuZmZGLwB+S5gSJhTXlbual3g6siQ0lzvunu4E3SuctlOvfBLmTwNmtAEIz8msQOAh4jV81MiB2Ayt9ccb5lcDuKsX/rfcj2lSx58VN0awImJlnm8+C4v3A0lojwdG0Znpd0plJz7AG2N5T71uSloQ1VwOenf4dKQAXcmEfu4DVfQy1gIhVrAO2DKFzp6RVYd1SYH8bgDgDPQM81tdYB4gNwKYh9W2W9GhYOysTpREYGUC4dJ5tFibObgYenzSAkY5Qh/ON3zsBr/17DTOrPkJDX+IW55smKG6G/I7dA/xdi8LMqi+xczq902ib801HlUmxnhaXA8dqQFSn0XABvRZvuJ2LKpp0l/0oOfMD7WAGxFeSbgJ+6wIRSIDvg8wJYG4sn3uJX/UQB6Fi5jCzFZJeiZS29rIZEA8BKVEwC4+ZPSHp6fDP14DlJQD+eu4KQkeAywo7dIEk79zOkLSn1IgHEJ7T/5R0K/BjQf/Xkhr6ZRXwcgmAU4VN7eGyp7yZaRzMlNMDtdnp19CEi+y85/S2lAFE2tSPnQtqO/sZjqhfUx8AOInrLWLMg06ME4rOvduNuSHnSxf1plUCCO9+Ziq/YGRi3FCGE3KTS7rI3pqeNEfqjp0jamEBiyRvEUCIxPSSu9HZzJG8k6LXi6Ru41dVBCIQTvbuSfhS/3xU0rteUpRIgFD43SvptoguaUw4hbKii8xNM1cvAFF2ms6fmGL0U/sjXxrCQEU65XFDoD4aTqntnXJCy9+XD/1vShV2FXa5b72PUMnA1P3QXQI06e9jj8CkHR45C51qB0v2/gHO2hlPTgqWUAAAAABJRU5ErkJggg=="},4721:function(t,e,n){"use strict";n.d(e,"a",function(){return i});var Y=n("5a89");const Z={type:"change"},J={type:"start"},K={type:"end"};class i extends Y.m{constructor(t,e){super(),document,this.object=t,this.domElement=e,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new Y.tb,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Y.G.ROTATE,MIDDLE:Y.G.DOLLY,RIGHT:Y.G.PAN},this.touches={ONE:Y.mb.ROTATE,TWO:Y.mb.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return p.phi},this.getAzimuthalAngle=function(){return p.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(t){t.addEventListener("keydown",H),this._domElementKeyEvents=t},this.saveState=function(){c.target0.copy(c.target),c.position0.copy(c.object.position),c.zoom0=c.object.zoom},this.reset=function(){c.target.copy(c.target0),c.object.position.copy(c.position0),c.object.zoom=c.zoom0,c.object.updateProjectionMatrix(),c.dispatchEvent(Z),c.update(),u=h.NONE},this.update=function(){const i=new Y.tb,r=(new Y.bb).setFromUnitVectors(t.up,new Y.tb(0,1,0)),s=r.clone().invert(),a=new Y.tb,o=new Y.bb,l=2*Math.PI;return function(){const t=c.object.position;i.copy(t).sub(c.target),i.applyQuaternion(r),p.setFromVector3(i),c.autoRotate&&u===h.NONE&&S(2*Math.PI/60/60*c.autoRotateSpeed),c.enableDamping?(p.theta+=f.theta*c.dampingFactor,p.phi+=f.phi*c.dampingFactor):(p.theta+=f.theta,p.phi+=f.phi);let e=c.minAzimuthAngle,n=c.maxAzimuthAngle;return isFinite(e)&&isFinite(n)&&(e<-Math.PI?e+=l:e>Math.PI&&(e-=l),n<-Math.PI?n+=l:n>Math.PI&&(n-=l),p.theta=e<=n?Math.max(e,Math.min(n,p.theta)):p.theta>(e+n)/2?Math.max(e,p.theta):Math.min(n,p.theta)),p.phi=Math.max(c.minPolarAngle,Math.min(c.maxPolarAngle,p.phi)),p.makeSafe(),p.radius*=m,p.radius=Math.max(c.minDistance,Math.min(c.maxDistance,p.radius)),!0===c.enableDamping?c.target.addScaledVector(g,c.dampingFactor):c.target.add(g),i.setFromSpherical(p),i.applyQuaternion(s),t.copy(c.target).add(i),c.object.lookAt(c.target),!0===c.enableDamping?(f.theta*=1-c.dampingFactor,f.phi*=1-c.dampingFactor,g.multiplyScalar(1-c.dampingFactor)):(f.set(0,0,0),g.set(0,0,0)),m=1,!!(v||a.distanceToSquared(c.object.position)>d||8*(1-o.dot(c.object.quaternion))>d)&&(c.dispatchEvent(Z),a.copy(c.object.position),o.copy(c.object.quaternion),!(v=!1))}}(),this.dispose=function(){c.domElement.removeEventListener("contextmenu",W),c.domElement.removeEventListener("pointerdown",F),c.domElement.removeEventListener("pointercancel",V),c.domElement.removeEventListener("wheel",G),c.domElement.removeEventListener("pointermove",B),c.domElement.removeEventListener("pointerup",k),null!==c._domElementKeyEvents&&c._domElementKeyEvents.removeEventListener("keydown",H)};const c=this,h={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let u=h.NONE;const d=1e-6,p=new Y.kb,f=new Y.kb;let m=1;const g=new Y.tb;let v=!1;const i=new Y.sb,r=new Y.sb,s=new Y.sb,a=new Y.sb,o=new Y.sb,l=new Y.sb,x=new Y.sb,y=new Y.sb,_=new Y.sb,M=[],n={};function b(){return Math.pow(.95,c.zoomSpeed)}function S(t){f.theta-=t}function w(t){f.phi-=t}const T=function(){const n=new Y.tb;return function(t,e){n.setFromMatrixColumn(e,0),n.multiplyScalar(-t),g.add(n)}}(),A=function(){const n=new Y.tb;return function(t,e){!0===c.screenSpacePanning?n.setFromMatrixColumn(e,1):(n.setFromMatrixColumn(e,0),n.crossVectors(c.object.up,n)),n.multiplyScalar(t),g.add(n)}}(),E=function(){const r=new Y.tb;return function(t,e){var n,i=c.domElement;c.object.isPerspectiveCamera?(n=c.object.position,r.copy(n).sub(c.target),n=r.length(),n*=Math.tan(c.object.fov/2*Math.PI/180),T(2*t*n/i.clientHeight,c.object.matrix),A(2*e*n/i.clientHeight,c.object.matrix)):c.object.isOrthographicCamera?(T(t*(c.object.right-c.object.left)/c.object.zoom/i.clientWidth,c.object.matrix),A(e*(c.object.top-c.object.bottom)/c.object.zoom/i.clientHeight,c.object.matrix)):c.enablePan=!1}}();function L(t){c.object.isPerspectiveCamera?m/=t:c.object.isOrthographicCamera?(c.object.zoom=Math.max(c.minZoom,Math.min(c.maxZoom,c.object.zoom*t)),c.object.updateProjectionMatrix(),v=!0):c.enableZoom=!1}function C(t){c.object.isPerspectiveCamera?m*=t:c.object.isOrthographicCamera?(c.object.zoom=Math.max(c.minZoom,Math.min(c.maxZoom,c.object.zoom/t)),c.object.updateProjectionMatrix(),v=!0):c.enableZoom=!1}function P(t){i.set(t.clientX,t.clientY)}function D(t){a.set(t.clientX,t.clientY)}function R(){var t,e;1===M.length?i.set(M[0].pageX,M[0].pageY):(t=.5*(M[0].pageX+M[1].pageX),e=.5*(M[0].pageY+M[1].pageY),i.set(t,e))}function N(){var t,e;1===M.length?a.set(M[0].pageX,M[0].pageY):(t=.5*(M[0].pageX+M[1].pageX),e=.5*(M[0].pageY+M[1].pageY),a.set(t,e))}function I(){var t=M[0].pageX-M[1].pageX,e=M[0].pageY-M[1].pageY,e=Math.sqrt(t*t+e*e);x.set(0,e)}function O(t){if(1==M.length)r.set(t.pageX,t.pageY);else{const e=q(t),c=.5*(t.pageX+e.x),n=.5*(t.pageY+e.y);r.set(c,n)}s.subVectors(r,i).multiplyScalar(c.rotateSpeed);const e=c.domElement;S(2*Math.PI*s.x/e.clientHeight),w(2*Math.PI*s.y/e.clientHeight),i.copy(r)}function z(t){if(1===M.length)o.set(t.pageX,t.pageY);else{const e=q(t),c=.5*(t.pageX+e.x),n=.5*(t.pageY+e.y);o.set(c,n)}l.subVectors(o,a).multiplyScalar(c.panSpeed),E(l.x,l.y),a.copy(o)}function U(t){var e=q(t),n=t.pageX-e.x,e=t.pageY-e.y,e=Math.sqrt(n*n+e*e);y.set(0,e),_.set(0,Math.pow(y.y/x.y,c.zoomSpeed)),L(_.y),x.copy(y)}function F(t){var e;!1!==c.enabled&&(0===M.length&&(c.domElement.setPointerCapture(t.pointerId),c.domElement.addEventListener("pointermove",B),c.domElement.addEventListener("pointerup",k)),e=t,M.push(e),("touch"===t.pointerType?function(t){switch(X(t),M.length){case 1:switch(c.touches.ONE){case Y.mb.ROTATE:if(!1===c.enableRotate)return;R(),u=h.TOUCH_ROTATE;break;case Y.mb.PAN:if(!1===c.enablePan)return;N(),u=h.TOUCH_PAN;break;default:u=h.NONE}break;case 2:switch(c.touches.TWO){case Y.mb.DOLLY_PAN:if(!1===c.enableZoom&&!1===c.enablePan)return;c.enableZoom&&I(),c.enablePan&&N(),u=h.TOUCH_DOLLY_PAN;break;case Y.mb.DOLLY_ROTATE:if(!1===c.enableZoom&&!1===c.enableRotate)return;c.enableZoom&&I(),c.enableRotate&&R(),u=h.TOUCH_DOLLY_ROTATE;break;default:u=h.NONE}break;default:u=h.NONE}u!==h.NONE&&c.dispatchEvent(J)}:function(t){let e;switch(t.button){case 0:e=c.mouseButtons.LEFT;break;case 1:e=c.mouseButtons.MIDDLE;break;case 2:e=c.mouseButtons.RIGHT;break;default:e=-1}switch(e){case Y.G.DOLLY:if(!1===c.enableZoom)return;(function(t){x.set(t.clientX,t.clientY)})(t),u=h.DOLLY;break;case Y.G.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===c.enablePan)return;D(t),u=h.PAN}else{if(!1===c.enableRotate)return;P(t),u=h.ROTATE}break;case Y.G.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===c.enableRotate)return;P(t),u=h.ROTATE}else{if(!1===c.enablePan)return;D(t),u=h.PAN}break;default:u=h.NONE}u!==h.NONE&&c.dispatchEvent(J)})(t))}function B(t){!1!==c.enabled&&("touch"===t.pointerType?function(t){switch(X(t),u){case h.TOUCH_ROTATE:if(!1===c.enableRotate)return;O(t),c.update();break;case h.TOUCH_PAN:if(!1===c.enablePan)return;z(t),c.update();break;case h.TOUCH_DOLLY_PAN:if(!1===c.enableZoom&&!1===c.enablePan)return;(function(t){c.enableZoom&&U(t),c.enablePan&&z(t)})(t),c.update();break;case h.TOUCH_DOLLY_ROTATE:if(!1===c.enableZoom&&!1===c.enableRotate)return;(function(t){c.enableZoom&&U(t),c.enableRotate&&O(t)})(t),c.update();break;default:u=h.NONE}}:function(t){if(!1!==c.enabled)switch(u){case h.ROTATE:if(!1===c.enableRotate)return;!function(t){r.set(t.clientX,t.clientY),s.subVectors(r,i).multiplyScalar(c.rotateSpeed),t=c.domElement,S(2*Math.PI*s.x/t.clientHeight),w(2*Math.PI*s.y/t.clientHeight),i.copy(r),c.update()}(t);break;case h.DOLLY:if(!1===c.enableZoom)return;!function(t){y.set(t.clientX,t.clientY),_.subVectors(y,x),0<_.y?L(b()):_.y<0&&C(b()),x.copy(y),c.update()}(t);break;case h.PAN:if(!1===c.enablePan)return;!function(t){o.set(t.clientX,t.clientY),l.subVectors(o,a).multiplyScalar(c.panSpeed),E(l.x,l.y),a.copy(o),c.update()}(t)}})(t)}function k(t){j(t),0===M.length&&(c.domElement.releasePointerCapture(t.pointerId),c.domElement.removeEventListener("pointermove",B),c.domElement.removeEventListener("pointerup",k)),c.dispatchEvent(K),u=h.NONE}function V(t){j(t)}function G(t){!1!==c.enabled&&!1!==c.enableZoom&&u===h.NONE&&(t.preventDefault(),c.dispatchEvent(J),(t=t).deltaY<0?C(b()):0<t.deltaY&&L(b()),c.update(),c.dispatchEvent(K))}function H(t){!1!==c.enabled&&!1!==c.enablePan&&function(t){let e=!1;switch(t.code){case c.keys.UP:E(0,c.keyPanSpeed),e=!0;break;case c.keys.BOTTOM:E(0,-c.keyPanSpeed),e=!0;break;case c.keys.LEFT:E(c.keyPanSpeed,0),e=!0;break;case c.keys.RIGHT:E(-c.keyPanSpeed,0),e=!0}e&&(t.preventDefault(),c.update())}(t)}function W(t){!1!==c.enabled&&t.preventDefault()}function j(e){delete n[e.pointerId];for(let t=0;t<M.length;t++)if(M[t].pointerId==e.pointerId)return M.splice(t,1),0}function X(t){let e=n[t.pointerId];void 0===e&&(e=new Y.sb,n[t.pointerId]=e),e.set(t.pageX,t.pageY)}function q(t){t=t.pointerId===M[0].pointerId?M[1]:M[0];return n[t.pointerId]}c.domElement.addEventListener("contextmenu",W),c.domElement.addEventListener("pointerdown",F),c.domElement.addEventListener("pointercancel",V),c.domElement.addEventListener("wheel",G,{passive:!1}),this.update()}}},"4b1d":function(t,e,n){"use strict";n.d(e,"a",function(){return i});var v=n("5a89");class i extends v.gb{constructor(){super();const t=new v.e;t.deleteAttribute("uv");const e=new v.N({side:v.b}),n=new v.N,i=new v.X(16777215,5,28,2);i.position.set(.418,16.199,.3),this.add(i);const r=new v.K(t,e);r.position.set(-.757,13.219,.717),r.scale.set(31.713,28.305,28.591),this.add(r);const s=new v.K(t,n);s.position.set(-10.906,2.009,1.846),s.rotation.set(0,-.195,0),s.scale.set(2.328,7.905,4.651),this.add(s);const a=new v.K(t,n);a.position.set(-5.607,-.754,-.758),a.rotation.set(0,.994,0),a.scale.set(1.97,1.534,3.955),this.add(a);const o=new v.K(t,n);o.position.set(6.167,.857,7.803),o.rotation.set(0,.561,0),o.scale.set(3.927,6.285,3.687),this.add(o);const l=new v.K(t,n);l.position.set(-2.017,.018,6.124),l.rotation.set(0,.333,0),l.scale.set(2.002,4.566,2.064),this.add(l);const c=new v.K(t,n);c.position.set(2.291,-.756,-2.621),c.rotation.set(0,-.286,0),c.scale.set(1.546,1.552,1.496),this.add(c);const h=new v.K(t,n);h.position.set(-2.193,-.369,-5.547),h.rotation.set(0,.516,0),h.scale.set(3.875,3.487,2.986),this.add(h);const u=new v.K(t,x(50));u.position.set(-16.116,14.37,8.208),u.scale.set(.1,2.428,2.739),this.add(u);const d=new v.K(t,x(50));d.position.set(-16.109,18.021,-8.207),d.scale.set(.1,2.425,2.751),this.add(d);const p=new v.K(t,x(17));p.position.set(14.904,12.198,-1.832),p.scale.set(.15,4.265,6.331),this.add(p);const f=new v.K(t,x(43));f.position.set(-.462,8.89,14.52),f.scale.set(4.38,5.441,.088),this.add(f);const m=new v.K(t,x(20));m.position.set(3.235,11.486,-12.541),m.scale.set(2.5,2,.1),this.add(m);const g=new v.K(t,x(100));g.position.set(0,20,0),g.scale.set(1,.1,1),this.add(g)}}function x(t){const e=new v.L;return e.color.setScalar(t),e}},"5a34":function(t,e,n){var i=n("da84"),r=n("44e7"),s=i.TypeError;t.exports=function(t){if(r(t))throw s("The method doesn't accept regular expressions");return t}},"5a89":function(t,e,n){"use strict";n.d(e,"a",function(){return ic}),n.d(e,"b",function(){return Lt}),n.d(e,"c",function(){return Ao}),n.d(e,"d",function(){return on}),n.d(e,"e",function(){return or}),n.d(e,"f",function(){return Pi}),n.d(e,"g",function(){return Vi}),n.d(e,"h",function(){return rl}),n.d(e,"i",function(){return Dt}),n.d(e,"j",function(){return Ai}),n.d(e,"k",function(){return Tc}),n.d(e,"l",function(){return Ct}),n.d(e,"m",function(){return De}),n.d(e,"n",function(){return lc}),n.d(e,"o",function(){return Et}),n.d(e,"p",function(){return oo}),n.d(e,"q",function(){return Cc}),n.d(e,"r",function(){return go}),n.d(e,"s",function(){return xo}),n.d(e,"t",function(){return jl}),n.d(e,"u",function(){return ve}),n.d(e,"v",function(){return xe}),n.d(e,"w",function(){return Fo}),n.d(e,"x",function(){return Ro}),n.d(e,"y",function(){return Hl}),n.d(e,"z",function(){return Go}),n.d(e,"A",function(){return Vo}),n.d(e,"B",function(){return wt}),n.d(e,"C",function(){return Nt}),n.d(e,"D",function(){return Tt}),n.d(e,"E",function(){return ac}),n.d(e,"F",function(){return Lc}),n.d(e,"G",function(){return i}),n.d(e,"H",function(){return yi}),n.d(e,"I",function(){return He}),n.d(e,"J",function(){return On}),n.d(e,"K",function(){return sr}),n.d(e,"L",function(){return Ei}),n.d(e,"M",function(){return Gl}),n.d(e,"N",function(){return Vl}),n.d(e,"O",function(){return G}),n.d(e,"P",function(){return Rt}),n.d(e,"Q",function(){return W}),n.d(e,"R",function(){return H}),n.d(e,"S",function(){return Ql}),n.d(e,"T",function(){return ai}),n.d(e,"U",function(){return zr}),n.d(e,"V",function(){return Kr}),n.d(e,"W",function(){return pr}),n.d(e,"X",function(){return Sc}),n.d(e,"Y",function(){return Yo}),n.d(e,"Z",function(){return Ho}),n.d(e,"ab",function(){return kc}),n.d(e,"bb",function(){return nn}),n.d(e,"cb",function(){return tc}),n.d(e,"db",function(){return kt}),n.d(e,"eb",function(){return Vc}),n.d(e,"fb",function(){return V}),n.d(e,"gb",function(){return mo}),n.d(e,"hb",function(){return Po}),n.d(e,"ib",function(){return To}),n.d(e,"jb",function(){return An}),n.d(e,"kb",function(){return Wc}),n.d(e,"lb",function(){return xc}),n.d(e,"mb",function(){return r}),n.d(e,"nb",function(){return Ae}),n.d(e,"ob",function(){return Ke}),n.d(e,"pb",function(){return uc}),n.d(e,"qb",function(){return be}),n.d(e,"rb",function(){return Me}),n.d(e,"sb",function(){return We}),n.d(e,"tb",function(){return rn}),n.d(e,"ub",function(){return nc}),n.d(e,"vb",function(){return jc}),n.d(e,"wb",function(){return fo}),n.d(e,"xb",function(){return we});const At="136",i={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},r={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},j=0,X=1,q=2,T=1,A=3,Et=0,Lt=1,Ct=2,Y=0,Z=1,J=2,K=3,Q=4,$=5,tt=100,et=101,nt=102,it=103,rt=104,st=200,at=201,ot=202,lt=203,ct=204,ht=205,ut=206,dt=207,pt=208,ft=209,mt=210,gt=0,vt=1,xt=2,yt=3,_t=4,Mt=5,bt=6,St=7,Pt=0,b=301,S=302,c=303,h=304,P=306,D=307,V=1e3,Dt=1001,G=1002,Rt=1003,H=1004,W=1005,wt=1006,Tt=1007,Nt=1008,It=1009,s=1010,a=1011,Ot=1012,o=1013,zt=1014,Ut=1015,Ft=1016,l=1017,u=1018,d=1019,Bt=1020,p=1021,kt=1022,Vt=1023,f=1024,m=1025,Gt=1026,Ht=1027,g=1028,v=1029,x=1030,y=1031,_=1032,M=1033,w=33776,E=33777,L=33778,C=33779,R=35840,N=35841,I=35842,O=35843,z=36196,U=37492,F=37496,B=37808,k=37809,Wt=37810,jt=37811,Xt=37812,qt=37813,Yt=37814,Zt=37815,Jt=37816,Kt=37817,Qt=37818,$t=37819,te=37820,ee=37821,ne=36492,ie=37840,re=37841,se=37842,ae=37843,oe=37844,le=37845,ce=37846,he=37847,ue=37848,de=37849,pe=37850,fe=37851,me=37852,ge=37853,ve=2300,xe=2301,ye=2400,_e=2401,Me=1,be=2,Se=3e3,we=3001,Te=3201,Ae=0,Ee=1,Le=35044,Ce=35048,Pe="300 es";class De{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)}hasEventListener(t,e){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)}removeEventListener(t,e){if(void 0!==this._listeners){const n=this._listeners,i=n[t];if(void 0!==i){const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}}dispatchEvent(n){if(void 0!==this._listeners){const i=this._listeners,t=i[n.type];if(void 0!==t){n.target=this;const i=t.slice(0);for(let t=0,e=i.length;t<e;t++)i[t].call(this,n);n.target=null}}}}const Re=[];for(let t=0;t<256;t++)Re[t]=(t<16?"0":"")+t.toString(16);let Ne=1234567;const Ie=Math.PI/180,Oe=180/Math.PI;function ze(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0,r=Re[255&t]+Re[t>>8&255]+Re[t>>16&255]+Re[t>>24&255]+"-"+Re[255&e]+Re[e>>8&255]+"-"+Re[e>>16&15|64]+Re[e>>24&255]+"-"+Re[63&n|128]+Re[n>>8&255]+"-"+Re[n>>16&255]+Re[n>>24&255]+Re[255&i]+Re[i>>8&255]+Re[i>>16&255]+Re[i>>24&255];return r.toUpperCase()}function Ue(t,e,n){return Math.max(e,Math.min(n,t))}function Fe(t,e){return(t%e+e)%e}function Be(t,e,n){return(1-n)*t+n*e}function ke(t){return 0==(t&t-1)&&0!==t}function Ve(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Ge(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}var He=Object.freeze({__proto__:null,DEG2RAD:Ie,RAD2DEG:Oe,generateUUID:ze,clamp:Ue,euclideanModulo:Fe,mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},inverseLerp:function(t,e,n){return t!==e?(n-t)/(e-t):0},lerp:Be,damp:function(t,e,n,i){return Be(t,e,1-Math.exp(-n*i))},pingpong:function(t,e=1){return e-Math.abs(Fe(t,2*e)-e)},smoothstep:function(t,e,n){return t<=e?0:n<=t?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:n<=t?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){return void 0!==t&&(Ne=t%2147483647),Ne=16807*Ne%2147483647,(Ne-1)/2147483646},degToRad:function(t){return t*Ie},radToDeg:function(t){return t*Oe},isPowerOfTwo:ke,ceilPowerOfTwo:Ve,floorPowerOfTwo:Ge,setQuaternionFromProperEuler:function(t,e,n,i,r){const s=Math.cos,a=Math.sin,o=s(n/2),l=a(n/2),c=s((e+i)/2),h=a((e+i)/2),u=s((e-i)/2),d=a((e-i)/2),p=s((i-e)/2),f=a((i-e)/2);switch(r){case"XYX":t.set(o*h,l*u,l*d,o*c);break;case"YZY":t.set(l*d,o*h,l*u,o*c);break;case"ZXZ":t.set(l*u,l*d,o*h,o*c);break;case"XZX":t.set(o*h,l*f,l*p,o*c);break;case"YXY":t.set(l*p,o*h,l*f,o*c);break;case"ZYZ":t.set(l*f,l*p,o*h,o*c)}}});class We{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t,e){return void 0!==e?this.addVectors(t,e):(this.x+=t.x,this.y+=t.y,this)}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t,e){return void 0!==e?this.subVectors(t,e):(this.x-=t.x,this.y-=t.y,this)}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){var e=this.x,n=this.y,t=t.elements;return this.x=t[0]*e+t[3]*n+t[6],this.y=t[1]*e+t[4]*n+t[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){var e=this.x-t.x,t=this.y-t.y;return e*e+t*t}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e,n){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){var n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,e=this.y-t.y;return this.x=r*n-e*i+t.x,this.y=r*i+e*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}We.prototype.isVector2=!0;class je{constructor(){this.elements=[1,0,0,0,1,0,0,0,1]}set(t,e,n,i,r,s,a,o,l){const c=this.elements;return c[0]=t,c[1]=i,c[2]=a,c[3]=e,c[4]=r,c[5]=o,c[6]=n,c[7]=s,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){t=t.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,s=n[0],a=n[3],o=n[6],l=n[1],c=n[4],h=n[7],u=n[2],d=n[5],p=n[8],f=i[0],m=i[3],g=i[6],v=i[1],x=i[4],y=i[7],_=i[2],M=i[5],b=i[8];return r[0]=s*f+a*v+o*_,r[3]=s*m+a*x+o*M,r[6]=s*g+a*y+o*b,r[1]=l*f+c*v+h*_,r[4]=l*m+c*x+h*M,r[7]=l*g+c*y+h*b,r[2]=u*f+d*v+p*_,r[5]=u*m+d*x+p*M,r[8]=u*g+d*y+p*b,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){var t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],t=t[8];return e*s*t-e*a*l-n*r*t+n*a*o+i*r*l-i*s*o}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8],h=c*s-a*l,u=a*o-c*r,d=l*r-s*o,p=e*h+n*u+i*d;if(0==p)return this.set(0,0,0,0,0,0,0,0,0);var f=1/p;return t[0]=h*f,t[1]=(i*l-c*n)*f,t[2]=(a*n-i*s)*f,t[3]=u*f,t[4]=(c*e-i*o)*f,t[5]=(i*r-a*e)*f,t[6]=d*f,t[7]=(n*o-l*e)*f,t[8]=(s*e-n*r)*f,this}transpose(){var t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,r,s,a){var o=Math.cos(r),r=Math.sin(r);return this.set(n*o,n*r,-n*(o*s+r*a)+s+t,-i*r,i*o,-i*(-r*s+o*a)+a+e,0,0,1),this}scale(t,e){const n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this}rotate(t){const e=Math.cos(t),n=Math.sin(t),i=this.elements,r=i[0],s=i[3],a=i[6],o=i[1],l=i[4],c=i[7];return i[0]=e*r+n*o,i[3]=e*s+n*l,i[6]=e*a+n*c,i[1]=-n*r+e*o,i[4]=-n*s+e*l,i[7]=-n*a+e*c,this}translate(t,e){const n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=e*n[2],n[4]+=e*n[5],n[7]+=e*n[8],this}equals(t){var e=this.elements,n=t.elements;for(let t=0;t<9;t++)if(e[t]!==n[t])return!1;return!0}fromArray(e,n=0){for(let t=0;t<9;t++)this.elements[t]=e[t+n];return this}toArray(t=[],e=0){var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}function Xe(n){if(0===n.length)return-1/0;let i=n[0];for(let t=1,e=n.length;t<e;++t)n[t]>i&&(i=n[t]);return i}function qe(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}je.prototype.isMatrix3=!0,Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;let Ye;class Ze{static getDataURL(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===Ye&&(Ye=qe("canvas")),Ye.width=t.width,Ye.height=t.height;const n=Ye.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=Ye}return 2048<e.width||2048<e.height?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}}let Je=0;class Ke extends De{constructor(t=Ke.DEFAULT_IMAGE,e=Ke.DEFAULT_MAPPING,n=Dt,i=Dt,r=wt,s=Nt,a=Vt,o=It,l=1,c=Se){super(),Object.defineProperty(this,"id",{value:Je++}),this.uuid=ze(),this.name="",this.image=t,this.mipmaps=[],this.mapping=e,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=s,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=o,this.offset=new We(0,0),this.repeat=new We(1,1),this.center=new We(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new je,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=c,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this.userData=JSON.parse(JSON.stringify(t.userData)),this}toJSON(t){var e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){const i=this.image;if(void 0===i.uuid&&(i.uuid=ze()),!e&&void 0===t.images[i.uuid]){let n;if(Array.isArray(i)){n=[];for(let t=0,e=i.length;t<e;t++)i[t].isDataTexture?n.push(Qe(i[t].image)):n.push(Qe(i[t]))}else n=Qe(i);t.images[i.uuid]={uuid:i.uuid,url:n}}n.image=i.uuid}return"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||1<t.x)switch(this.wrapS){case V:t.x=t.x-Math.floor(t.x);break;case Dt:t.x=t.x<0?0:1;break;case G:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||1<t.y)switch(this.wrapT){case V:t.y=t.y-Math.floor(t.y);break;case Dt:t.y=t.y<0?0:1;break;case G:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&this.version++}}function Qe(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Ze.getDataURL(t):t.data?{data:Array.prototype.slice.call(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:{}}Ke.DEFAULT_IMAGE=void 0,Ke.DEFAULT_MAPPING=300,Ke.prototype.isTexture=!0;class $e{constructor(t=0,e=0,n=0,i=1){this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t,e){return void 0!==e?this.addVectors(t,e):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t,e){return void 0!==e?this.subVectors(t,e):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){var e=this.x,n=this.y,i=this.z,r=this.w,t=t.elements;return this.x=t[0]*e+t[4]*n+t[8]*i+t[12]*r,this.y=t[1]*e+t[5]*n+t[9]*i+t[13]*r,this.z=t[2]*e+t[6]*n+t[10]*i+t[14]*r,this.w=t[3]*e+t[7]*n+t[11]*i+t[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,r;const s=t.elements,a=s[0],o=s[4],l=s[8],c=s[1],h=s[5],u=s[9],d=s[2],p=s[6],f=s[10];if(Math.abs(o-c)<.01&&Math.abs(l-d)<.01&&Math.abs(u-p)<.01){if(Math.abs(o+c)<.1&&Math.abs(l+d)<.1&&Math.abs(u+p)<.1&&Math.abs(a+h+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const t=(a+1)/2,s=(h+1)/2,m=(f+1)/2,g=(o+c)/4,v=(l+d)/4,x=(u+p)/4;return t>s&&t>m?r=t<.01?(n=0,i=.707106781):(n=Math.sqrt(t),i=g/n,v/n):s>m?r=s<.01?(n=.707106781,i=0,.707106781):(i=Math.sqrt(s),n=g/i,x/i):m<.01?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(m),n=v/r,i=x/r),this.set(n,i,r,e),this}let m=Math.sqrt((p-u)*(p-u)+(l-d)*(l-d)+(c-o)*(c-o));return Math.abs(m)<.001&&(m=1),this.x=(p-u)/m,this.y=(l-d)/m,this.z=(c-o)/m,this.w=Math.acos((a+h+f-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e,n){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}$e.prototype.isVector4=!0;class tn extends De{constructor(t,e,n={}){super(),this.width=t,this.height=e,this.depth=1,this.scissor=new $e(0,0,t,e),this.scissorTest=!1,this.viewport=new $e(0,0,t,e),this.texture=new Ke(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.isRenderTargetTexture=!0,this.texture.image={width:t,height:e,depth:1},this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.internalFormat=void 0!==n.internalFormat?n.internalFormat:null,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:wt,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0!==n.stencilBuffer&&n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}setTexture(t){t.image={width:this.width,height:this.height,depth:this.depth},this.texture=t}setSize(t,e,n=1){this.width===t&&this.height===e&&this.depth===n||(this.width=t,this.height=e,this.depth=n,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.image={...this.texture.image},this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}tn.prototype.isWebGLRenderTarget=!0;(class extends tn{});class en extends tn{constructor(t,e,n={}){super(t,e,n),this.samples=4,this.ignoreDepthForMultisampleCopy=void 0===n.ignoreDepth||n.ignoreDepth,this.useRenderToTexture=void 0!==n.useRenderToTexture&&n.useRenderToTexture,this.useRenderbuffer=!1===this.useRenderToTexture}copy(t){return super.copy.call(this,t),this.samples=t.samples,this.useRenderToTexture=t.useRenderToTexture,this.useRenderbuffer=t.useRenderbuffer,this}}en.prototype.isWebGLMultisampleRenderTarget=!0;class nn{constructor(t=0,e=0,n=0,i=1){this._x=t,this._y=e,this._z=n,this._w=i}static slerp(t,e,n,i){return n.slerpQuaternions(t,e,i)}static slerpFlat(e,n,i,r,s,a,o){let l=i[r+0],c=i[r+1],h=i[r+2],u=i[r+3];var d=s[a+0],i=s[a+1],r=s[a+2],a=s[a+3];if(0===o)return e[n+0]=l,e[n+1]=c,e[n+2]=h,void(e[n+3]=u);if(1===o)return e[n+0]=d,e[n+1]=i,e[n+2]=r,void(e[n+3]=a);if(u!==a||l!==d||c!==i||h!==r){let t=1-o;const n=l*d+c*i+h*r+u*a,p=0<=n?1:-1,f=1-n*n;if(f>Number.EPSILON){const s=Math.sqrt(f),m=Math.atan2(s,n*p);t=Math.sin(t*m)/s,o=Math.sin(o*m)/s}const s=o*p;if(l=l*t+d*s,c=c*t+i*s,h=h*t+r*s,u=u*t+a*s,t===1-o){const e=1/Math.sqrt(l*l+c*c+h*h+u*u);l*=e,c*=e,h*=e,u*=e}}e[n]=l,e[n+1]=c,e[n+2]=h,e[n+3]=u}static multiplyQuaternionsFlat(t,e,n,i,r,s){var a=n[i],o=n[i+1],l=n[i+2],c=n[i+3],h=r[s],n=r[s+1],i=r[s+2],s=r[s+3];return t[e]=a*s+c*h+o*i-l*n,t[e+1]=o*s+c*n+l*h-a*i,t[e+2]=l*s+c*i+a*n-o*h,t[e+3]=c*s-a*h-o*n-l*i,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=t._x,i=t._y,r=t._z,s=t._order,a=Math.cos,o=Math.sin,l=a(n/2),c=a(i/2),h=a(r/2),u=o(n/2),d=o(i/2),p=o(r/2);switch(s){case"XYZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"YXZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"ZXY":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"ZYX":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"YZX":this._x=u*c*h+l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h-u*d*p;break;case"XZY":this._x=u*c*h-l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h+u*d*p}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){var n=e/2,e=Math.sin(n);return this._x=t.x*e,this._y=t.y*e,this._z=t.z*e,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){var e=t.elements,n=e[0],i=e[4],r=e[8],s=e[1],a=e[5],o=e[9],l=e[2],c=e[6],t=e[10],e=n+a+t;if(0<e){const h=.5/Math.sqrt(e+1);this._w=.25/h,this._x=(c-o)*h,this._y=(r-l)*h,this._z=(s-i)*h}else if(a<n&&t<n){const h=2*Math.sqrt(1+n-a-t);this._w=(c-o)/h,this._x=.25*h,this._y=(i+s)/h,this._z=(r+l)/h}else if(t<a){const h=2*Math.sqrt(1+a-n-t);this._w=(r-l)/h,this._x=(i+s)/h,this._y=.25*h,this._z=(o+c)/h}else{const h=2*Math.sqrt(1+t-n-a);this._w=(s-i)/h,this._x=(r+l)/h,this._y=(o+c)/h,this._z=.25*h}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<Number.EPSILON?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0):(this._x=0,this._y=-t.z,this._z=t.y)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x),this._w=n,this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Ue(this.dot(t),-1,1)))}rotateTowards(t,e){var n=this.angleTo(t);if(0===n)return this;n=Math.min(1,e/n);return this.slerp(t,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(this._x=this._x*(t=1/t),this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t,e){return void 0!==e?this.multiplyQuaternions(t,e):this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){var n=t._x,i=t._y,r=t._z,s=t._w,a=e._x,o=e._y,t=e._z,e=e._w;return this._x=n*e+s*a+i*t-r*o,this._y=i*e+s*o+r*a-n*t,this._z=r*e+s*t+n*o-i*a,this._w=s*e-n*a-i*o-r*t,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,i=this._y,r=this._z,s=this._w;let a=s*t._w+n*t._x+i*t._y+r*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),1<=a)return this._w=s,this._x=n,this._y=i,this._z=r,this;var o=1-a*a;if(o<=Number.EPSILON){const c=1-e;return this._w=c*s+e*this._w,this._x=c*n+e*this._x,this._y=c*i+e*this._y,this._z=c*r+e*this._z,this.normalize(),this._onChangeCallback(),this}var l=Math.sqrt(o),t=Math.atan2(l,a),o=Math.sin((1-e)*t)/l,l=Math.sin(e*t)/l;return this._w=s*o+this._w*l,this._x=n*o+this._x*l,this._y=i*o+this._y*l,this._z=r*o+this._z*l,this._onChangeCallback(),this}slerpQuaternions(t,e,n){this.copy(t).slerp(e,n)}random(){var t=Math.random(),e=Math.sqrt(1-t),n=Math.sqrt(t),i=2*Math.PI*Math.random(),t=2*Math.PI*Math.random();return this.set(e*Math.cos(i),n*Math.sin(t),n*Math.cos(t),e*Math.sin(i))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}nn.prototype.isQuaternion=!0;class rn{constructor(t=0,e=0,n=0){this.x=t,this.y=e,this.z=n}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t,e){return void 0!==e?this.addVectors(t,e):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t,e){return void 0!==e?this.subVectors(t,e):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t,e){return void 0!==e?this.multiplyVectors(t,e):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return t&&t.isEuler,this.applyQuaternion(an.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(an.setFromAxisAngle(t,e))}applyMatrix3(t){var e=this.x,n=this.y,i=this.z,t=t.elements;return this.x=t[0]*e+t[3]*n+t[6]*i,this.y=t[1]*e+t[4]*n+t[7]*i,this.z=t[2]*e+t[5]*n+t[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){var e=this.x,n=this.y,i=this.z,r=t.elements,t=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*t,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*t,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*t,this}applyQuaternion(t){var e=this.x,n=this.y,i=this.z,r=t.x,s=t.y,a=t.z,o=t.w,l=o*e+s*i-a*n,c=o*n+a*e-r*i,t=o*i+r*n-s*e,i=-r*e-s*n-a*i;return this.x=l*o+i*-r+c*-a-t*-s,this.y=c*o+i*-s+t*-r-l*-a,this.z=t*o+i*-a+l*-s-c*-r,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){var e=this.x,n=this.y,i=this.z,t=t.elements;return this.x=t[0]*e+t[4]*n+t[8]*i,this.y=t[1]*e+t[5]*n+t[9]*i,this.z=t[2]*e+t[6]*n+t[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t,e){return void 0!==e?this.crossVectors(t,e):this.crossVectors(this,t)}crossVectors(t,e){var n=t.x,i=t.y,r=t.z,s=e.x,t=e.y,e=e.z;return this.x=i*e-r*t,this.y=r*s-n*e,this.z=n*t-i*s,this}projectOnVector(t){var e=t.lengthSq();if(0===e)return this.set(0,0,0);e=t.dot(this)/e;return this.copy(t).multiplyScalar(e)}projectOnPlane(t){return sn.copy(this).projectOnVector(t),this.sub(sn)}reflect(t){return this.sub(sn.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){var e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;e=this.dot(t)/e;return Math.acos(Ue(e,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){var e=this.x-t.x,n=this.y-t.y,t=this.z-t.z;return e*e+n*n+t*t}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){var i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){t=t.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),t=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=t,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e,n){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){var t=2*(Math.random()-.5),e=Math.random()*Math.PI*2,n=Math.sqrt(1-t**2);return this.x=n*Math.cos(e),this.y=n*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}rn.prototype.isVector3=!0;const sn=new rn,an=new nn;class on{constructor(t=new rn(1/0,1/0,1/0),e=new rn(-1/0,-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(n){let i=1/0,r=1/0,s=1/0,a=-1/0,o=-1/0,l=-1/0;for(let t=0,e=n.length;t<e;t+=3){var c=n[t],h=n[t+1],u=n[t+2];c<i&&(i=c),h<r&&(r=h),u<s&&(s=u),c>a&&(a=c),h>o&&(o=h),u>l&&(l=u)}return this.min.set(i,r,s),this.max.set(a,o,l),this}setFromBufferAttribute(n){let i=1/0,r=1/0,s=1/0,a=-1/0,o=-1/0,l=-1/0;for(let t=0,e=n.count;t<e;t++){var c=n.getX(t),h=n.getY(t),u=n.getZ(t);c<i&&(i=c),h<r&&(r=h),u<s&&(s=u),c>a&&(a=c),h>o&&(o=h),u>l&&(l=u)}return this.min.set(i,r,s),this.max.set(a,o,l),this}setFromPoints(n){this.makeEmpty();for(let t=0,e=n.length;t<e;t++)this.expandByPoint(n[t]);return this}setFromCenterAndSize(t,e){e=cn.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(e),this.max.copy(t).add(e),this}setFromObject(t){return this.makeEmpty(),this.expandByObject(t)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t){t.updateWorldMatrix(!1,!1);const e=t.geometry;void 0!==e&&(null===e.boundingBox&&e.computeBoundingBox(),hn.copy(e.boundingBox),hn.applyMatrix4(t.matrixWorld),this.union(hn));var n=t.children;for(let t=0,e=n.length;t<e;t++)this.expandByObject(n[t]);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,cn),cn.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return n=0<t.normal.x?(e=t.normal.x*this.min.x,t.normal.x*this.max.x):(e=t.normal.x*this.max.x,t.normal.x*this.min.x),0<t.normal.y?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),0<t.normal.z?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){return!this.isEmpty()&&(this.getCenter(vn),xn.subVectors(this.max,vn),un.subVectors(t.a,vn),dn.subVectors(t.b,vn),pn.subVectors(t.c,vn),fn.subVectors(dn,un),mn.subVectors(pn,dn),gn.subVectors(un,pn),!!Mn([0,-fn.z,fn.y,0,-mn.z,mn.y,0,-gn.z,gn.y,fn.z,0,-fn.x,mn.z,0,-mn.x,gn.z,0,-gn.x,-fn.y,fn.x,0,-mn.y,mn.x,0,-gn.y,gn.x,0],un,dn,pn,xn)&&(!!Mn([1,0,0,0,1,0,0,0,1],un,dn,pn,xn)&&(yn.crossVectors(fn,mn),Mn([yn.x,yn.y,yn.z],un,dn,pn,xn))))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){const e=cn.copy(t).clamp(this.min,this.max);return e.sub(t).length()}getBoundingSphere(t){return this.getCenter(t.center),t.radius=.5*this.getSize(cn).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(ln[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),ln[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),ln[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),ln[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),ln[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),ln[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),ln[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),ln[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(ln)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}on.prototype.isBox3=!0;const ln=[new rn,new rn,new rn,new rn,new rn,new rn,new rn,new rn],cn=new rn,hn=new on,un=new rn,dn=new rn,pn=new rn,fn=new rn,mn=new rn,gn=new rn,vn=new rn,xn=new rn,yn=new rn,_n=new rn;function Mn(n,i,r,s,a){for(let t=0,e=n.length-3;t<=e;t+=3){_n.fromArray(n,t);var o=a.x*Math.abs(_n.x)+a.y*Math.abs(_n.y)+a.z*Math.abs(_n.z),l=i.dot(_n),c=r.dot(_n),h=s.dot(_n);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}const bn=new on,Sn=new rn,wn=new rn,Tn=new rn;class An{constructor(t=new rn,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(n,t){const i=this.center;void 0!==t?i.copy(t):bn.setFromPoints(n).getCenter(i);let r=0;for(let t=0,e=n.length;t<e;t++)r=Math.max(r,i.distanceToSquared(n[t]));return this.radius=Math.sqrt(r),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){var n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?t.makeEmpty():(t.set(this.center,this.center),t.expandByScalar(this.radius)),t}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){Tn.subVectors(t,this.center);t=Tn.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),n=.5*(e-this.radius);this.center.add(Tn.multiplyScalar(n/e)),this.radius+=n}return this}union(t){return(!0===this.center.equals(t.center)?wn.set(0,0,1):wn.subVectors(t.center,this.center).normalize()).multiplyScalar(t.radius),this.expandByPoint(Sn.copy(t.center).add(wn)),this.expandByPoint(Sn.copy(t.center).sub(wn)),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const En=new rn,Ln=new rn,Cn=new rn,Pn=new rn,Dn=new rn,Rn=new rn,Nn=new rn;class In{constructor(t=new rn,e=new rn(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,En)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);t=e.dot(this.direction);return t<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(t).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){var e=En.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(En.copy(this.direction).multiplyScalar(e).add(this.origin),En.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){Ln.copy(t).add(e).multiplyScalar(.5),Cn.copy(e).sub(t).normalize(),Pn.copy(this.origin).sub(Ln);var r=.5*t.distanceTo(e),s=-this.direction.dot(Cn),a=Pn.dot(this.direction),o=-Pn.dot(Cn),t=Pn.lengthSq(),e=Math.abs(1-s*s);let l,c,h,u;if(0<e)if(l=s*o-a,c=s*a-o,u=r*e,0<=l)if(c>=-u)if(c<=u){const d=1/e;l*=d,c*=d,h=l*(l+s*c+2*a)+c*(s*l+c+2*o)+t}else c=r,l=Math.max(0,-(s*c+a)),h=-l*l+c*(c+2*o)+t;else c=-r,l=Math.max(0,-(s*c+a)),h=-l*l+c*(c+2*o)+t;else h=c<=-u?(l=Math.max(0,-(-s*r+a)),c=0<l?-r:Math.min(Math.max(-r,-o),r),-l*l+c*(c+2*o)+t):c<=u?(l=0,c=Math.min(Math.max(-r,-o),r),c*(c+2*o)+t):(l=Math.max(0,-(s*r+a)),c=0<l?r:Math.min(Math.max(-r,-o),r),-l*l+c*(c+2*o)+t);else c=0<s?-r:r,l=Math.max(0,-(s*c+a)),h=-l*l+c*(c+2*o)+t;return n&&n.copy(this.direction).multiplyScalar(l).add(this.origin),i&&i.copy(Cn).multiplyScalar(c).add(Ln),h}intersectSphere(t,e){En.subVectors(t.center,this.origin);var n=En.dot(this.direction),i=En.dot(En)-n*n,t=t.radius*t.radius;if(t<i)return null;t=Math.sqrt(t-i),i=n-t,t=n+t;return i<0&&t<0?null:i<0?this.at(t,e):this.at(i,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;e=-(this.origin.dot(t.normal)+t.constant)/e;return 0<=e?e:null}intersectPlane(t,e){t=this.distanceToPlane(t);return null===t?null:this.at(t,e)}intersectsPlane(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,i,r,s,a,o;var l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return i=0<=l?(n=(t.min.x-u.x)*l,(t.max.x-u.x)*l):(n=(t.max.x-u.x)*l,(t.min.x-u.x)*l),s=0<=c?(r=(t.min.y-u.y)*c,(t.max.y-u.y)*c):(r=(t.max.y-u.y)*c,(t.min.y-u.y)*c),n>s||r>i?null:((r>n||n!=n)&&(n=r),(s<i||i!=i)&&(i=s),o=0<=h?(a=(t.min.z-u.z)*h,(t.max.z-u.z)*h):(a=(t.max.z-u.z)*h,(t.min.z-u.z)*h),n>o||a>i?null:((a>n||n!=n)&&(n=a),(o<i||i!=i)&&(i=o),i<0?null:this.at(0<=n?n:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,En)}intersectTriangle(t,e,n,i,r){Dn.subVectors(e,t),Rn.subVectors(n,t),Nn.crossVectors(Dn,Rn);let s,a=this.direction.dot(Nn);if(0<a){if(i)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}Pn.subVectors(this.origin,t);i=s*this.direction.dot(Rn.crossVectors(Pn,Rn));if(i<0)return null;t=s*this.direction.dot(Dn.cross(Pn));if(t<0)return null;if(i+t>a)return null;t=-s*Pn.dot(Nn);return t<0?null:this.at(t/a,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class On{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(t,e,n,i,r,s,a,o,l,c,h,u,d,p,f,m){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=s,g[9]=a,g[13]=o,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new On).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){t=t.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,i=1/zn.setFromMatrixColumn(t,0).length(),r=1/zn.setFromMatrixColumn(t,1).length(),s=1/zn.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*s,e[9]=n[9]*s,e[10]=n[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){t&&t.isEuler;const e=this.elements,n=t.x,i=t.y,r=t.z,s=Math.cos(n),a=Math.sin(n),o=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===t.order){const t=s*c,n=s*h,i=a*c,r=a*h;e[0]=o*c,e[4]=-o*h,e[8]=l,e[1]=n+i*l,e[5]=t-r*l,e[9]=-a*o,e[2]=r-t*l,e[6]=i+n*l,e[10]=s*o}else if("YXZ"===t.order){const t=o*c,n=o*h,i=l*c,r=l*h;e[0]=t+r*a,e[4]=i*a-n,e[8]=s*l,e[1]=s*h,e[5]=s*c,e[9]=-a,e[2]=n*a-i,e[6]=r+t*a,e[10]=s*o}else if("ZXY"===t.order){const t=o*c,n=o*h,i=l*c,r=l*h;e[0]=t-r*a,e[4]=-s*h,e[8]=i+n*a,e[1]=n+i*a,e[5]=s*c,e[9]=r-t*a,e[2]=-s*l,e[6]=a,e[10]=s*o}else if("ZYX"===t.order){const t=s*c,n=s*h,i=a*c,r=a*h;e[0]=o*c,e[4]=i*l-n,e[8]=t*l+r,e[1]=o*h,e[5]=r*l+t,e[9]=n*l-i,e[2]=-l,e[6]=a*o,e[10]=s*o}else if("YZX"===t.order){const t=s*o,n=s*l,i=a*o,r=a*l;e[0]=o*c,e[4]=r-t*h,e[8]=i*h+n,e[1]=h,e[5]=s*c,e[9]=-a*c,e[2]=-l*c,e[6]=n*h+i,e[10]=t-r*h}else if("XZY"===t.order){const t=s*o,n=s*l,i=a*o,r=a*l;e[0]=o*c,e[4]=-h,e[8]=l*c,e[1]=t*h+r,e[5]=s*c,e[9]=n*h-i,e[2]=i*h-n,e[6]=a*c,e[10]=r*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Fn,t,Bn)}lookAt(t,e,n){const i=this.elements;return Gn.subVectors(t,e),0===Gn.lengthSq()&&(Gn.z=1),Gn.normalize(),kn.crossVectors(n,Gn),0===kn.lengthSq()&&(1===Math.abs(n.z)?Gn.x+=1e-4:Gn.z+=1e-4,Gn.normalize(),kn.crossVectors(n,Gn)),kn.normalize(),Vn.crossVectors(Gn,kn),i[0]=kn.x,i[4]=Vn.x,i[8]=Gn.x,i[1]=kn.y,i[5]=Vn.y,i[9]=Gn.y,i[2]=kn.z,i[6]=Vn.z,i[10]=Gn.z,this}multiply(t,e){return void 0!==e?this.multiplyMatrices(t,e):this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,s=n[0],a=n[4],o=n[8],l=n[12],c=n[1],h=n[5],u=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],x=n[7],y=n[11],_=n[15],M=i[0],b=i[4],S=i[8],w=i[12],T=i[1],A=i[5],E=i[9],L=i[13],C=i[2],P=i[6],D=i[10],R=i[14],N=i[3],I=i[7],O=i[11],z=i[15];return r[0]=s*M+a*T+o*C+l*N,r[4]=s*b+a*A+o*P+l*I,r[8]=s*S+a*E+o*D+l*O,r[12]=s*w+a*L+o*R+l*z,r[1]=c*M+h*T+u*C+d*N,r[5]=c*b+h*A+u*P+d*I,r[9]=c*S+h*E+u*D+d*O,r[13]=c*w+h*L+u*R+d*z,r[2]=p*M+f*T+m*C+g*N,r[6]=p*b+f*A+m*P+g*I,r[10]=p*S+f*E+m*D+g*O,r[14]=p*w+f*L+m*R+g*z,r[3]=v*M+x*T+y*C+_*N,r[7]=v*b+x*A+y*P+_*I,r[11]=v*S+x*E+y*D+_*O,r[15]=v*w+x*L+y*R+_*z,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){var t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],s=t[1],a=t[5],o=t[9],l=t[13],c=t[2],h=t[6],u=t[10],d=t[14];return t[3]*(+r*o*h-i*l*h-r*a*u+n*l*u+i*a*d-n*o*d)+t[7]*(+e*o*d-e*l*u+r*s*u-i*s*d+i*l*c-r*o*c)+t[11]*(+e*l*h-e*a*d-r*s*h+n*s*d+r*a*c-n*l*c)+t[15]*(-i*a*c-e*o*h+e*a*u+i*s*h-n*s*u+n*o*c)}transpose(){const t=this.elements;var e=t[1];return t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8],h=t[9],u=t[10],d=t[11],p=t[12],f=t[13],m=t[14],g=t[15],v=h*m*l-f*u*l+f*o*d-a*m*d-h*o*g+a*u*g,x=p*u*l-c*m*l-p*o*d+s*m*d+c*o*g-s*u*g,y=c*f*l-p*h*l+p*a*d-s*f*d-c*a*g+s*h*g,_=p*h*o-c*f*o-p*a*u+s*f*u+c*a*m-s*h*m,M=e*v+n*x+i*y+r*_;if(0==M)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var b=1/M;return t[0]=v*b,t[1]=(f*u*r-h*m*r-f*i*d+n*m*d+h*i*g-n*u*g)*b,t[2]=(a*m*r-f*o*r+f*i*l-n*m*l-a*i*g+n*o*g)*b,t[3]=(h*o*r-a*u*r-h*i*l+n*u*l+a*i*d-n*o*d)*b,t[4]=x*b,t[5]=(c*m*r-p*u*r+p*i*d-e*m*d-c*i*g+e*u*g)*b,t[6]=(p*o*r-s*m*r-p*i*l+e*m*l+s*i*g-e*o*g)*b,t[7]=(s*u*r-c*o*r+c*i*l-e*u*l-s*i*d+e*o*d)*b,t[8]=y*b,t[9]=(p*h*r-c*f*r-p*n*d+e*f*d+c*n*g-e*h*g)*b,t[10]=(s*f*r-p*a*r+p*n*l-e*f*l-s*n*g+e*a*g)*b,t[11]=(c*a*r-s*h*r-c*n*l+e*h*l+s*n*d-e*a*d)*b,t[12]=_*b,t[13]=(c*f*i-p*h*i+p*n*u-e*f*u-c*n*m+e*h*m)*b,t[14]=(p*a*i-s*f*i-p*n*o+e*f*o+s*n*m-e*a*m)*b,t[15]=(s*h*i-c*a*i+c*n*o-e*h*o-s*n*u+e*a*u)*b,this}scale(t){const e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,this}getMaxScaleOnAxis(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],t=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,t))}makeTranslation(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){var e=Math.cos(t),t=Math.sin(t);return this.set(1,0,0,0,0,e,-t,0,0,t,e,0,0,0,0,1),this}makeRotationY(t){var e=Math.cos(t),t=Math.sin(t);return this.set(e,0,t,0,0,1,0,0,-t,0,e,0,0,0,0,1),this}makeRotationZ(t){var e=Math.cos(t),t=Math.sin(t);return this.set(e,-t,0,0,t,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){var n=Math.cos(e),i=Math.sin(e),r=1-n,s=t.x,a=t.y,o=t.z,e=r*s,t=r*a;return this.set(e*s+n,e*a-i*o,e*o+i*a,0,e*a+i*o,t*a+n,t*o-i*s,0,e*o-i*a,t*o+i*s,r*o*o+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,i,r,s){return this.set(1,n,r,0,t,1,s,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,r=e._x,s=e._y,a=e._z,o=e._w,l=r+r,c=s+s,h=a+a,u=r*l,d=r*c,p=r*h,f=s*c,m=s*h,g=a*h,v=o*l,x=o*c,y=o*h,_=n.x,M=n.y,b=n.z;return i[0]=(1-(f+g))*_,i[1]=(d+y)*_,i[2]=(p-x)*_,i[3]=0,i[4]=(d-y)*M,i[5]=(1-(u+g))*M,i[6]=(m+v)*M,i[7]=0,i[8]=(p+x)*b,i[9]=(m-v)*b,i[10]=(1-(u+f))*b,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){var i=this.elements;let r=zn.set(i[0],i[1],i[2]).length();var s=zn.set(i[4],i[5],i[6]).length(),a=zn.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),t.x=i[12],t.y=i[13],t.z=i[14],Un.copy(this);var o=1/r,t=1/s,i=1/a;return Un.elements[0]*=o,Un.elements[1]*=o,Un.elements[2]*=o,Un.elements[4]*=t,Un.elements[5]*=t,Un.elements[6]*=t,Un.elements[8]*=i,Un.elements[9]*=i,Un.elements[10]*=i,e.setFromRotationMatrix(Un),n.x=r,n.y=s,n.z=a,this}makePerspective(t,e,n,i,r,s){const a=this.elements,o=2*r/(e-t),l=2*r/(n-i),c=(e+t)/(e-t),h=(n+i)/(n-i),u=-(s+r)/(s-r),d=-2*s*r/(s-r);return a[0]=o,a[4]=0,a[8]=c,a[12]=0,a[1]=0,a[5]=l,a[9]=h,a[13]=0,a[2]=0,a[6]=0,a[10]=u,a[14]=d,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(t,e,n,i,r,s){const a=this.elements,o=1/(e-t),l=1/(n-i),c=1/(s-r),h=(e+t)*o,u=(n+i)*l,d=(s+r)*c;return a[0]=2*o,a[4]=0,a[8]=0,a[12]=-h,a[1]=0,a[5]=2*l,a[9]=0,a[13]=-u,a[2]=0,a[6]=0,a[10]=-2*c,a[14]=-d,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(t){var e=this.elements,n=t.elements;for(let t=0;t<16;t++)if(e[t]!==n[t])return!1;return!0}fromArray(e,n=0){for(let t=0;t<16;t++)this.elements[t]=e[t+n];return this}toArray(t=[],e=0){var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}On.prototype.isMatrix4=!0;const zn=new rn,Un=new On,Fn=new rn(0,0,0),Bn=new rn(1,1,1),kn=new rn,Vn=new rn,Gn=new rn,Hn=new On,Wn=new nn;class jn{constructor(t=0,e=0,n=0,i=jn.DefaultOrder){this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,i=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){var t=t.elements,i=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],h=t[6],u=t[10];switch(e){case"XYZ":this._y=Math.asin(Ue(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,u),this._z=Math.atan2(-r,i)):(this._x=Math.atan2(h,o),this._z=0);break;case"YXZ":this._x=Math.asin(-Ue(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(s,u),this._z=Math.atan2(a,o)):(this._y=Math.atan2(-c,i),this._z=0);break;case"ZXY":this._x=Math.asin(Ue(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-c,u),this._z=Math.atan2(-r,o)):(this._y=0,this._z=Math.atan2(a,i));break;case"ZYX":this._y=Math.asin(-Ue(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(h,u),this._z=Math.atan2(a,i)):(this._x=0,this._z=Math.atan2(-r,o));break;case"YZX":this._z=Math.asin(Ue(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-l,o),this._y=Math.atan2(-c,i)):(this._x=0,this._y=Math.atan2(s,u));break;case"XZY":this._z=Math.asin(-Ue(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(h,o),this._y=Math.atan2(s,i)):(this._x=Math.atan2(-l,u),this._y=0)}return this._order=e,!0===n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Hn.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Hn,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Wn.setFromEuler(this),this.setFromQuaternion(Wn,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}toVector3(t){return t?t.set(this._x,this._y,this._z):new rn(this._x,this._y,this._z)}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}jn.prototype.isEuler=!0,jn.DefaultOrder="XYZ",jn.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Xn{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return 0!=(this.mask&t.mask)}isEnabled(t){return 0!=(this.mask&(1<<t|0))}}let qn=0;const Yn=new rn,Zn=new nn,Jn=new On,Kn=new rn,Qn=new rn,$n=new rn,ti=new nn,ei=new rn(1,0,0),ni=new rn(0,1,0),ii=new rn(0,0,1),ri={type:"added"},si={type:"removed"};class ai extends De{constructor(){super(),Object.defineProperty(this,"id",{value:qn++}),this.uuid=ze(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ai.DefaultUp.clone();const t=new rn,e=new jn,n=new nn,i=new rn(1,1,1);e._onChange(function(){n.setFromEuler(e,!1)}),n._onChange(function(){e.setFromQuaternion(n,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new On},normalMatrix:{value:new je}}),this.matrix=new On,this.matrixWorld=new On,this.matrixAutoUpdate=ai.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Xn,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Zn.setFromAxisAngle(t,e),this.quaternion.multiply(Zn),this}rotateOnWorldAxis(t,e){return Zn.setFromAxisAngle(t,e),this.quaternion.premultiply(Zn),this}rotateX(t){return this.rotateOnAxis(ei,t)}rotateY(t){return this.rotateOnAxis(ni,t)}rotateZ(t){return this.rotateOnAxis(ii,t)}translateOnAxis(t,e){return Yn.copy(t).applyQuaternion(this.quaternion),this.position.add(Yn.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(ei,t)}translateY(t){return this.translateOnAxis(ni,t)}translateZ(t){return this.translateOnAxis(ii,t)}localToWorld(t){return t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return t.applyMatrix4(Jn.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?Kn.copy(t):Kn.set(t,e,n);n=this.parent;this.updateWorldMatrix(!0,!1),Qn.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Jn.lookAt(Qn,Kn,this.up):Jn.lookAt(Kn,Qn,this.up),this.quaternion.setFromRotationMatrix(Jn),n&&(Jn.extractRotation(n.matrixWorld),Zn.setFromRotationMatrix(Jn),this.quaternion.premultiply(Zn.invert()))}add(t){if(1<arguments.length){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this||t&&t.isObject3D&&(null!==t.parent&&t.parent.remove(t),(t.parent=this).children.push(t),t.dispatchEvent(ri)),this}remove(t){if(1<arguments.length){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(si)),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){for(let t=0;t<this.children.length;t++){const e=this.children[t];e.parent=null,e.dispatchEvent(si)}return this.children.length=0,this}attach(t){return this.updateWorldMatrix(!0,!1),Jn.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),Jn.multiply(t.parent.matrixWorld)),t.applyMatrix4(Jn),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(n,i){if(this[n]===i)return this;for(let t=0,e=this.children.length;t<e;t++){const r=this.children[t],s=r.getObjectByProperty(n,i);if(void 0!==s)return s}}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Qn,t,$n),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Qn,ti,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);var e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(n){n(this);const i=this.children;for(let t=0,e=i.length;t<e;t++)i[t].traverse(n)}traverseVisible(n){if(!1!==this.visible){n(this);const i=this.children;for(let t=0,e=i.length;t<e;t++)i[t].traverseVisible(n)}}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(n){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),n=!(this.matrixWorldNeedsUpdate=!1));const i=this.children;for(let t=0,e=i.length;t<e;t++)i[t].updateMatrixWorld(n)}updateWorldMatrix(n,t){const e=this.parent;if(!0===n&&null!==e&&e.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===t){const n=this.children;for(let t=0,e=n.length;t<e;t++)n[t].updateWorldMatrix(!1,!0)}}toJSON(n){const i=void 0===n||"string"==typeof n,r={};i&&(n={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},r.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const s={};function a(t,e){return void 0===t[e.uuid]&&(t[e.uuid]=e.toJSON(n)),e.uuid}if(s.uuid=this.uuid,s.type=this.type,""!==this.name&&(s.name=this.name),!0===this.castShadow&&(s.castShadow=!0),!0===this.receiveShadow&&(s.receiveShadow=!0),!1===this.visible&&(s.visible=!1),!1===this.frustumCulled&&(s.frustumCulled=!1),0!==this.renderOrder&&(s.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(s.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(n).uuid)),this.environment&&this.environment.isTexture&&(s.environment=this.environment.toJSON(n).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=a(n.geometries,this.geometry);const i=this.geometry.parameters;if(void 0!==i&&void 0!==i.shapes){const r=i.shapes;if(Array.isArray(r))for(let t=0,e=r.length;t<e;t++){const s=r[t];a(n.shapes,s)}else a(n.shapes,r)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(a(n.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const i=[];for(let t=0,e=this.material.length;t<e;t++)i.push(a(n.materials,this.material[t]));s.material=i}else s.material=a(n.materials,this.material);if(0<this.children.length){s.children=[];for(let t=0;t<this.children.length;t++)s.children.push(this.children[t].toJSON(n).object)}if(0<this.animations.length){s.animations=[];for(let t=0;t<this.animations.length;t++){const r=this.animations[t];s.animations.push(a(n.animations,r))}}if(i){const i=t(n.geometries),s=t(n.materials),a=t(n.textures),e=t(n.images),o=t(n.shapes),l=t(n.skeletons),c=t(n.animations);0<i.length&&(r.geometries=i),0<s.length&&(r.materials=s),0<a.length&&(r.textures=a),0<e.length&&(r.images=e),0<o.length&&(r.shapes=o),0<l.length&&(r.skeletons=l),0<c.length&&(r.animations=c)}return r.object=s,r;function t(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(e,n=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===n)for(let t=0;t<e.children.length;t++){const n=e.children[t];this.add(n.clone())}return this}}ai.DefaultUp=new rn(0,1,0),ai.DefaultMatrixAutoUpdate=!0,ai.prototype.isObject3D=!0;const oi=new rn,li=new rn,ci=new rn,hi=new rn,ui=new rn,di=new rn,pi=new rn,fi=new rn,mi=new rn,gi=new rn;class vi{constructor(t=new rn,e=new rn,n=new rn){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,i){i.subVectors(n,e),oi.subVectors(t,e),i.cross(oi);e=i.lengthSq();return 0<e?i.multiplyScalar(1/Math.sqrt(e)):i.set(0,0,0)}static getBarycoord(t,e,n,i,r){oi.subVectors(i,e),li.subVectors(n,e),ci.subVectors(t,e);var s=oi.dot(oi),a=oi.dot(li),i=oi.dot(ci),n=li.dot(li),t=li.dot(ci),e=s*n-a*a;if(0==e)return r.set(-2,-1,-1);e=1/e,n=(n*i-a*t)*e,e*=s*t-a*i;return r.set(1-n-e,e,n)}static containsPoint(t,e,n,i){return this.getBarycoord(t,e,n,i,hi),0<=hi.x&&0<=hi.y&&hi.x+hi.y<=1}static getUV(t,e,n,i,r,s,a,o){return this.getBarycoord(t,e,n,i,hi),o.set(0,0),o.addScaledVector(r,hi.x),o.addScaledVector(s,hi.y),o.addScaledVector(a,hi.z),o}static isFrontFacing(t,e,n,i){return oi.subVectors(n,e),li.subVectors(t,e),oi.cross(li).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return oi.subVectors(this.c,this.b),li.subVectors(this.a,this.b),.5*oi.cross(li).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return vi.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return vi.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,i,r){return vi.getUV(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return vi.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return vi.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){var n=this.a,i=this.b,r=this.c;let s,a;ui.subVectors(i,n),di.subVectors(r,n),fi.subVectors(t,n);var o=ui.dot(fi),l=di.dot(fi);if(o<=0&&l<=0)return e.copy(n);mi.subVectors(t,i);var c=ui.dot(mi),h=di.dot(mi);if(0<=c&&h<=c)return e.copy(i);var u=o*h-c*l;if(u<=0&&0<=o&&c<=0)return s=o/(o-c),e.copy(n).addScaledVector(ui,s);gi.subVectors(t,r);var d=ui.dot(gi),t=di.dot(gi);if(0<=t&&d<=t)return e.copy(r);o=d*l-o*t;if(o<=0&&0<=l&&t<=0)return a=l/(l-t),e.copy(n).addScaledVector(di,a);l=c*t-d*h;if(l<=0&&0<=h-c&&0<=d-t)return pi.subVectors(r,i),a=(h-c)/(h-c+(d-t)),e.copy(i).addScaledVector(pi,a);l=1/(l+o+u);return s=o*l,a=u*l,e.copy(n).addScaledVector(ui,s).addScaledVector(di,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let xi=0;class yi extends De{constructor(){super(),Object.defineProperty(this,"id",{value:xi++}),this.uuid=ze(),this.name="",this.type="Material",this.fog=!0,this.blending=Z,this.side=Et,this.vertexColors=!1,this.opacity=1,this.format=Vt,this.transparent=!1,this.blendSrc=ct,this.blendDst=ht,this.blendEquation=tt,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=yt,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){0<this._alphaTest!=0<t&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const n in t){var e=t[n];if(void 0!==e)if("shading"!==n){const i=this[n];void 0!==i&&(i&&i.isColor?i.set(e):i&&i.isVector3&&e&&e.isVector3?i.copy(e):this[n]=e)}else this.flatShading=1===e}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Z&&(n.blending=this.blending),this.side!==Et&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.format!==Vt&&(n.format=this.format),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),0<this.alphaTest&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),1<this.wireframeLinewidth&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e){const e=i(t.textures),r=i(t.images);0<e.length&&(n.textures=e),0<r.length&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.format=e.format,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const n=e.clippingPlanes;let i=null;if(null!==n){const e=n.length;i=new Array(e);for(let t=0;t!==e;++t)i[t]=n[t].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}yi.prototype.isMaterial=!0;const _i={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Mi={h:0,s:0,l:0},bi={h:0,s:0,l:0};function Si(t,e,n){return n<0&&(n+=1),1<n&&--n,n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}function wi(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Ti(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class Ai{constructor(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this}setRGB(t,e,n){return this.r=t,this.g=e,this.b=n,this}setHSL(t,e,n){return t=Fe(t,1),e=Ue(e,0,1),n=Ue(n,0,1),0===e?this.r=this.g=this.b=n:(this.r=Si(e=2*n-(n=n<=.5?n*(1+e):n+e-n*e),n,t+1/3),this.g=Si(e,n,t),this.b=Si(e,n,t-1/3)),this}setStyle(t){function e(t){void 0!==t&&parseFloat(t)}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;var i=n[1],r=n[2];switch(i){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,e(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,e(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r)){const n=parseFloat(t[1])/360,s=parseInt(t[2],10)/100,a=parseInt(t[3],10)/100;return e(t[4]),this.setHSL(n,s,a)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=n[1],e=t.length;if(3===e)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,this;if(6===e)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,this}return t&&0<t.length?this.setColorName(t):this}setColorName(t){t=_i[t.toLowerCase()];return void 0!==t&&this.setHex(t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=wi(t.r),this.g=wi(t.g),this.b=wi(t.b),this}copyLinearToSRGB(t){return this.r=Ti(t.r),this.g=Ti(t.g),this.b=Ti(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(t){var e=this.r,n=this.g,i=this.b,r=Math.max(e,n,i),s=Math.min(e,n,i);let a,o;var l=(s+r)/2;if(s===r)a=0,o=0;else{const t=r-s;switch(o=l<=.5?t/(r+s):t/(2-r-s),r){case e:a=(n-i)/t+(n<i?6:0);break;case n:a=(i-e)/t+2;break;case i:a=(e-n)/t+4}a/=6}return t.h=a,t.s=o,t.l=l,t}getStyle(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"}offsetHSL(t,e,n){return this.getHSL(Mi),Mi.h+=t,Mi.s+=e,Mi.l+=n,this.setHSL(Mi.h,Mi.s,Mi.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(Mi),t.getHSL(bi);var n=Be(Mi.h,bi.h,e),t=Be(Mi.s,bi.s,e),e=Be(Mi.l,bi.l,e);return this.setHSL(n,t,e),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),!0===t.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}}Ai.NAMES=_i,Ai.prototype.isColor=!0,Ai.prototype.r=1,Ai.prototype.g=1,Ai.prototype.b=1;class Ei extends yi{constructor(t){super(),this.type="MeshBasicMaterial",this.color=new Ai(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}Ei.prototype.isMeshBasicMaterial=!0;const Li=new rn,Ci=new We;class Pi{constructor(t,e,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===n,this.usage=Le,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this}copyAt(n,i,r){n*=this.itemSize,r*=i.itemSize;for(let t=0,e=this.itemSize;t<e;t++)this.array[n+t]=i.array[r+t];return this}copyArray(t){return this.array.set(t),this}copyColorsArray(n){const i=this.array;let r=0;for(let e=0,t=n.length;e<t;e++){let t=n[e];void 0===t&&(t=new Ai),i[r++]=t.r,i[r++]=t.g,i[r++]=t.b}return this}copyVector2sArray(n){const i=this.array;let r=0;for(let e=0,t=n.length;e<t;e++){let t=n[e];void 0===t&&(t=new We),i[r++]=t.x,i[r++]=t.y}return this}copyVector3sArray(n){const i=this.array;let r=0;for(let e=0,t=n.length;e<t;e++){let t=n[e];void 0===t&&(t=new rn),i[r++]=t.x,i[r++]=t.y,i[r++]=t.z}return this}copyVector4sArray(n){const i=this.array;let r=0;for(let e=0,t=n.length;e<t;e++){let t=n[e];void 0===t&&(t=new $e),i[r++]=t.x,i[r++]=t.y,i[r++]=t.z,i[r++]=t.w}return this}applyMatrix3(n){if(2===this.itemSize)for(let t=0,e=this.count;t<e;t++)Ci.fromBufferAttribute(this,t),Ci.applyMatrix3(n),this.setXY(t,Ci.x,Ci.y);else if(3===this.itemSize)for(let t=0,e=this.count;t<e;t++)Li.fromBufferAttribute(this,t),Li.applyMatrix3(n),this.setXYZ(t,Li.x,Li.y,Li.z);return this}applyMatrix4(n){for(let t=0,e=this.count;t<e;t++)Li.x=this.getX(t),Li.y=this.getY(t),Li.z=this.getZ(t),Li.applyMatrix4(n),this.setXYZ(t,Li.x,Li.y,Li.z);return this}applyNormalMatrix(n){for(let t=0,e=this.count;t<e;t++)Li.x=this.getX(t),Li.y=this.getY(t),Li.z=this.getZ(t),Li.applyNormalMatrix(n),this.setXYZ(t,Li.x,Li.y,Li.z);return this}transformDirection(n){for(let t=0,e=this.count;t<e;t++)Li.x=this.getX(t),Li.y=this.getY(t),Li.z=this.getZ(t),Li.transformDirection(n),this.setXYZ(t,Li.x,Li.y,Li.z);return this}set(t,e=0){return this.array.set(t,e),this}getX(t){return this.array[t*this.itemSize]}setX(t,e){return this.array[t*this.itemSize]=e,this}getY(t){return this.array[t*this.itemSize+1]}setY(t,e){return this.array[t*this.itemSize+1]=e,this}getZ(t){return this.array[t*this.itemSize+2]}setZ(t,e){return this.array[t*this.itemSize+2]=e,this}getW(t){return this.array[t*this.itemSize+3]}setW(t,e){return this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this}setXYZW(t,e,n,i,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),this.usage!==Le&&(t.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(t.updateRange=this.updateRange),t}}Pi.prototype.isBufferAttribute=!0;class Di extends Pi{constructor(t,e,n){super(new Uint16Array(t),e,n)}}class Ri extends Pi{constructor(t,e,n){super(new Uint32Array(t),e,n)}}(class extends Pi{});class Ni extends Pi{constructor(t,e,n){super(new Float32Array(t),e,n)}}let Ii=0;const Oi=new On,zi=new ai,Ui=new rn,Fi=new on,Bi=new on,ki=new rn;class Vi extends De{constructor(){super(),Object.defineProperty(this,"id",{value:Ii++}),this.uuid=ze(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(65535<Xe(t)?Ri:Di)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const e=(new je).getNormalMatrix(t);n.applyNormalMatrix(e),n.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(t),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return Oi.makeRotationFromQuaternion(t),this.applyMatrix4(Oi),this}rotateX(t){return Oi.makeRotationX(t),this.applyMatrix4(Oi),this}rotateY(t){return Oi.makeRotationY(t),this.applyMatrix4(Oi),this}rotateZ(t){return Oi.makeRotationZ(t),this.applyMatrix4(Oi),this}translate(t,e,n){return Oi.makeTranslation(t,e,n),this.applyMatrix4(Oi),this}scale(t,e,n){return Oi.makeScale(t,e,n),this.applyMatrix4(Oi),this}lookAt(t){return zi.lookAt(t),zi.updateMatrix(),this.applyMatrix4(zi.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ui).negate(),this.translate(Ui.x,Ui.y,Ui.z),this}setFromPoints(n){const i=[];for(let t=0,e=n.length;t<e;t++){var r=n[t];i.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new Ni(i,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new on);const n=this.attributes.position,i=this.morphAttributes.position;if(n&&n.isGLBufferAttribute)this.boundingBox.set(new rn(-1/0,-1/0,-1/0),new rn(1/0,1/0,1/0));else{if(void 0!==n){if(this.boundingBox.setFromBufferAttribute(n),i)for(let t=0,e=i.length;t<e;t++){const n=i[t];Fi.setFromBufferAttribute(n),this.morphTargetsRelative?(ki.addVectors(this.boundingBox.min,Fi.min),this.boundingBox.expandByPoint(ki),ki.addVectors(this.boundingBox.max,Fi.max),this.boundingBox.expandByPoint(ki)):(this.boundingBox.expandByPoint(Fi.min),this.boundingBox.expandByPoint(Fi.max))}}else this.boundingBox.makeEmpty();isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z)}}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new An);var i=this.attributes.position,r=this.morphAttributes.position;if(i&&i.isGLBufferAttribute)this.boundingSphere.set(new rn,1/0);else if(i){const l=this.boundingSphere.center;if(Fi.setFromBufferAttribute(i),r)for(let t=0,e=r.length;t<e;t++){var s=r[t];Bi.setFromBufferAttribute(s),this.morphTargetsRelative?(ki.addVectors(Fi.min,Bi.min),Fi.expandByPoint(ki),ki.addVectors(Fi.max,Bi.max),Fi.expandByPoint(ki)):(Fi.expandByPoint(Bi.min),Fi.expandByPoint(Bi.max))}Fi.getCenter(l);let n=0;for(let t=0,e=i.count;t<e;t++)ki.fromBufferAttribute(i,t),n=Math.max(n,l.distanceToSquared(ki));if(r)for(let t=0,e=r.length;t<e;t++){var a=r[t],o=this.morphTargetsRelative;for(let t=0,e=a.count;t<e;t++)ki.fromBufferAttribute(a,t),o&&(Ui.fromBufferAttribute(i,t),ki.add(Ui)),n=Math.max(n,l.distanceToSquared(ki))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)}}computeTangents(){const i=this.index,r=this.attributes;if(null!==i&&void 0!==r.position&&void 0!==r.normal&&void 0!==r.uv){const o=i.array,l=r.position.array,c=r.normal.array,h=r.uv.array,e=l.length/3;void 0===r.tangent&&this.setAttribute("tangent",new Pi(new Float32Array(4*e),4));const u=r.tangent.array,d=[],p=[];for(let t=0;t<e;t++)d[t]=new rn,p[t]=new rn;const f=new rn,m=new rn,g=new rn,v=new We,x=new We,y=new We,_=new rn,M=new rn;let n=this.groups;0===n.length&&(n=[{start:0,count:o.length}]);for(let t=0,e=n.length;t<e;++t){const i=n[t],r=i.start,l=i.count;for(let t=r,e=r+l;t<e;t+=3)s(o[t+0],o[t+1],o[t+2])}const b=new rn,S=new rn,w=new rn,T=new rn;for(let t=0,e=n.length;t<e;++t){const i=n[t],r=i.start,l=i.count;for(let t=r,e=r+l;t<e;t+=3)a(o[t+0]),a(o[t+1]),a(o[t+2])}function s(t,e,n){f.fromArray(l,3*t),m.fromArray(l,3*e),g.fromArray(l,3*n),v.fromArray(h,2*t),x.fromArray(h,2*e),y.fromArray(h,2*n),m.sub(f),g.sub(f),x.sub(v),y.sub(v);var i=1/(x.x*y.y-y.x*x.y);isFinite(i)&&(_.copy(m).multiplyScalar(y.y).addScaledVector(g,-x.y).multiplyScalar(i),M.copy(g).multiplyScalar(x.x).addScaledVector(m,-y.x).multiplyScalar(i),d[t].add(_),d[e].add(_),d[n].add(_),p[t].add(M),p[e].add(M),p[n].add(M))}function a(t){w.fromArray(c,3*t),T.copy(w);var e=d[t];b.copy(e),b.sub(w.multiplyScalar(w.dot(e))).normalize(),S.crossVectors(T,e);e=S.dot(p[t])<0?-1:1;u[4*t]=b.x,u[4*t+1]=b.y,u[4*t+2]=b.z,u[4*t+3]=e}}}computeVertexNormals(){const i=this.index,r=this.getAttribute("position");if(void 0!==r){let n=this.getAttribute("normal");if(void 0===n)n=new Pi(new Float32Array(3*r.count),3),this.setAttribute("normal",n);else for(let t=0,e=n.count;t<e;t++)n.setXYZ(t,0,0,0);const l=new rn,c=new rn,h=new rn,u=new rn,d=new rn,p=new rn,f=new rn,m=new rn;if(i)for(let t=0,e=i.count;t<e;t+=3){var s=i.getX(t+0),a=i.getX(t+1),o=i.getX(t+2);l.fromBufferAttribute(r,s),c.fromBufferAttribute(r,a),h.fromBufferAttribute(r,o),f.subVectors(h,c),m.subVectors(l,c),f.cross(m),u.fromBufferAttribute(n,s),d.fromBufferAttribute(n,a),p.fromBufferAttribute(n,o),u.add(f),d.add(f),p.add(f),n.setXYZ(s,u.x,u.y,u.z),n.setXYZ(a,d.x,d.y,d.z),n.setXYZ(o,p.x,p.y,p.z)}else for(let t=0,e=r.count;t<e;t+=3)l.fromBufferAttribute(r,t+0),c.fromBufferAttribute(r,t+1),h.fromBufferAttribute(r,t+2),f.subVectors(h,c),m.subVectors(l,c),f.cross(m),n.setXYZ(t+0,f.x,f.y,f.z),n.setXYZ(t+1,f.x,f.y,f.z),n.setXYZ(t+2,f.x,f.y,f.z);this.normalizeNormals(),n.needsUpdate=!0}}merge(t,e){if(t&&t.isBufferGeometry){void 0===e&&(e=0);var n=this.attributes;for(const i in n)if(void 0!==t.attributes[i]){const r=n[i],s=r.array,a=t.attributes[i],o=a.array,l=a.itemSize*e,c=Math.min(o.length,s.length-l);for(let t=0,e=l;t<c;t++,e++)s[e]=o[t]}return this}}normalizeNormals(){const n=this.attributes.normal;for(let t=0,e=n.count;t<e;t++)ki.fromBufferAttribute(n,t),ki.normalize(),n.setXYZ(t,ki.x,ki.y,ki.z)}toNonIndexed(){function n(n,i){const r=n.array,s=n.itemSize,t=n.normalized,a=new r.constructor(i.length*s);let o=0,l=0;for(let t=0,e=i.length;t<e;t++){o=n.isInterleavedBufferAttribute?i[t]*n.data.stride+n.offset:i[t]*s;for(let t=0;t<s;t++)a[l++]=r[o++]}return new Pi(a,s,t)}if(null===this.index)return this;const i=new Vi,r=this.index.array,s=this.attributes;for(const t in s){const a=s[t],o=n(a,r);i.setAttribute(t,o)}const a=this.morphAttributes;for(const e in a){const s=[],o=a[e];for(let t=0,e=o.length;t<e;t++){const a=o[t],l=n(a,r);s.push(l)}i.morphAttributes[e]=s}i.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let t=0,e=o.length;t<e;t++){const n=o[t];i.addGroup(n.start,n.count,n.materialIndex)}return i}toJSON(){const n={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),0<Object.keys(this.userData).length&&(n.userData=this.userData),void 0!==this.parameters){const i=this.parameters;for(const r in i)void 0!==i[r]&&(n[r]=i[r]);return n}n.data={attributes:{}};const i=this.index;null!==i&&(n.data.index={type:i.array.constructor.name,array:Array.prototype.slice.call(i.array)});const r=this.attributes;for(const o in r){const i=r[o];n.data.attributes[o]=i.toJSON(n.data)}const t={};let s=!1;for(const l in this.morphAttributes){const i=this.morphAttributes[l],r=[];for(let t=0,e=i.length;t<e;t++){const s=i[t];r.push(s.toJSON(n.data))}0<r.length&&(t[l]=r,s=!0)}s&&(n.data.morphAttributes=t,n.data.morphTargetsRelative=this.morphTargetsRelative);var e=this.groups;0<e.length&&(n.data.groups=JSON.parse(JSON.stringify(e)));const a=this.boundingSphere;return null!==a&&(n.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),n}clone(){return(new this.constructor).copy(this)}copy(n){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;var i={};this.name=n.name;const r=n.index;null!==r&&this.setIndex(r.clone(i));var t=n.attributes;for(const l in t){const n=t[l];this.setAttribute(l,n.clone(i))}var e=n.morphAttributes;for(const c in e){const n=[],r=e[c];for(let t=0,e=r.length;t<e;t++)n.push(r[t].clone(i));this.morphAttributes[c]=n}this.morphTargetsRelative=n.morphTargetsRelative;var s=n.groups;for(let t=0,e=s.length;t<e;t++){const n=s[t];this.addGroup(n.start,n.count,n.materialIndex)}const a=n.boundingBox;null!==a&&(this.boundingBox=a.clone());const o=n.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=n.drawRange.start,this.drawRange.count=n.drawRange.count,this.userData=n.userData,void 0!==n.parameters&&(this.parameters=Object.assign({},n.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}}Vi.prototype.isBufferGeometry=!0;const Gi=new On,Hi=new In,Wi=new An,ji=new rn,Xi=new rn,qi=new rn,Yi=new rn,Zi=new rn,Ji=new rn,Ki=new rn,Qi=new rn,$i=new rn,tr=new We,er=new We,nr=new We,ir=new rn,rr=new rn;class sr extends ai{constructor(t=new Vi,e=new Ei){super(),this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=t.material,this.geometry=t.geometry,this}updateMorphTargets(){const n=this.geometry;if(n.isBufferGeometry){var t=n.morphAttributes,e=Object.keys(t);if(0<e.length){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;t<e;t++){var i=n[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=t}}}}else{e=n.morphTargets;void 0!==e&&e.length}}raycast(i,r){const s=this.geometry,a=this.material,o=this.matrixWorld;if(void 0!==a&&(null===s.boundingSphere&&s.computeBoundingSphere(),Wi.copy(s.boundingSphere),Wi.applyMatrix4(o),!1!==i.ray.intersectsSphere(Wi)&&(Gi.copy(o).invert(),Hi.copy(i.ray).applyMatrix4(Gi),null===s.boundingBox||!1!==Hi.intersectsBox(s.boundingBox)))){let n;if(s.isBufferGeometry){const o=s.index,h=s.attributes.position,u=s.morphAttributes.position,d=s.morphTargetsRelative,p=s.attributes.uv,f=s.attributes.uv2,m=s.groups,g=s.drawRange;if(null!==o)if(Array.isArray(a))for(let t=0,e=m.length;t<e;t++){var l=m[t],c=a[l.materialIndex];for(let t=Math.max(l.start,g.start),e=Math.min(o.count,Math.min(l.start+l.count,g.start+g.count));t<e;t+=3){const a=o.getX(t),v=o.getX(t+1),x=o.getX(t+2);n=ar(this,c,i,Hi,h,u,d,p,f,a,v,x),n&&(n.faceIndex=Math.floor(t/3),n.face.materialIndex=l.materialIndex,r.push(n))}}else{const s=Math.max(0,g.start),y=Math.min(o.count,g.start+g.count);for(let t=s,e=y;t<e;t+=3){const s=o.getX(t),_=o.getX(t+1),M=o.getX(t+2);n=ar(this,a,i,Hi,h,u,d,p,f,s,_,M),n&&(n.faceIndex=Math.floor(t/3),r.push(n))}}else if(void 0!==h)if(Array.isArray(a))for(let t=0,e=m.length;t<e;t++){const o=m[t],b=a[o.materialIndex],S=Math.max(o.start,g.start),w=Math.min(h.count,Math.min(o.start+o.count,g.start+g.count));for(let t=S,e=w;t<e;t+=3){const a=t,T=t+1,A=t+2;n=ar(this,b,i,Hi,h,u,d,p,f,a,T,A),n&&(n.faceIndex=Math.floor(t/3),n.face.materialIndex=o.materialIndex,r.push(n))}}else{const s=Math.max(0,g.start),o=Math.min(h.count,g.start+g.count);for(let t=s,e=o;t<e;t+=3){const s=t,o=t+1,E=t+2;n=ar(this,a,i,Hi,h,u,d,p,f,s,o,E),n&&(n.faceIndex=Math.floor(t/3),r.push(n))}}}else s.isGeometry}}}function ar(t,e,n,i,r,s,a,o,l,c,h,u){ji.fromBufferAttribute(r,c),Xi.fromBufferAttribute(r,h),qi.fromBufferAttribute(r,u);var d,p,f,m=t.morphTargetInfluences;if(s&&m){Ki.set(0,0,0),Qi.set(0,0,0),$i.set(0,0,0);for(let t=0,e=s.length;t<e;t++){const v=m[t],x=s[t];0!==v&&(Yi.fromBufferAttribute(x,c),Zi.fromBufferAttribute(x,h),Ji.fromBufferAttribute(x,u),a?(Ki.addScaledVector(Yi,v),Qi.addScaledVector(Zi,v),$i.addScaledVector(Ji,v)):(Ki.addScaledVector(Yi.sub(ji),v),Qi.addScaledVector(Zi.sub(Xi),v),$i.addScaledVector(Ji.sub(qi),v)))}ji.add(Ki),Xi.add(Qi),qi.add($i)}t.isSkinnedMesh&&(t.boneTransform(c,ji),t.boneTransform(h,Xi),t.boneTransform(u,qi));const g=(d=t,p=e,f=n,r=i,t=ji,e=Xi,n=qi,i=ir,null===(p.side===Lt?r.intersectTriangle(n,e,t,!0,i):r.intersectTriangle(t,e,n,p.side!==Ct,i))?null:(rr.copy(i),rr.applyMatrix4(d.matrixWorld),(i=f.ray.origin.distanceTo(rr))<f.near||i>f.far?null:{distance:i,point:rr.clone(),object:d}));if(g){o&&(tr.fromBufferAttribute(o,c),er.fromBufferAttribute(o,h),nr.fromBufferAttribute(o,u),g.uv=vi.getUV(ir,ji,Xi,qi,tr,er,nr,new We)),l&&(tr.fromBufferAttribute(l,c),er.fromBufferAttribute(l,h),nr.fromBufferAttribute(l,u),g.uv2=vi.getUV(ir,ji,Xi,qi,tr,er,nr,new We));const y={a:c,b:h,c:u,normal:new rn,materialIndex:0};vi.getNormal(ji,Xi,qi,y.normal),g.face=y}return g}sr.prototype.isMesh=!0;class or extends Vi{constructor(t=1,e=1,n=1,i=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:s};const M=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);const b=[],S=[],w=[],T=[];let A=0,E=0;function a(n,i,r,s,a,o,t,l,c,h,e){var u=o/c,d=t/h,p=o/2,f=t/2,m=l/2,g=c+1,v=h+1;let x=0,y=0;const _=new rn;for(let e=0;e<v;e++){const o=e*d-f;for(let t=0;t<g;t++){const A=t*u-p;_[n]=A*s,_[i]=o*a,_[r]=m,S.push(_.x,_.y,_.z),_[n]=0,_[i]=0,_[r]=0<l?1:-1,w.push(_.x,_.y,_.z),T.push(t/c),T.push(1-e/h),x+=1}}for(let e=0;e<h;e++)for(let t=0;t<c;t++){const i=A+t+g*e,r=A+t+g*(e+1),s=A+(t+1)+g*(e+1),a=A+(t+1)+g*e;b.push(i,r,a),b.push(r,s,a),y+=6}M.addGroup(E,y,e),E+=y,A+=x}a("z","y","x",-1,-1,n,e,t,s,r,0),a("z","y","x",1,-1,n,e,-t,s,r,1),a("x","z","y",1,1,t,n,e,i,s,2),a("x","z","y",1,-1,t,n,-e,i,s,3),a("x","y","z",1,-1,t,e,n,i,r,4),a("x","y","z",-1,-1,t,e,-n,i,r,5),this.setIndex(b),this.setAttribute("position",new Ni(S,3)),this.setAttribute("normal",new Ni(w,3)),this.setAttribute("uv",new Ni(T,2))}static fromJSON(t){return new or(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function lr(t){const e={};for(const n in t){e[n]={};for(const i in t[n]){const r=t[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}}return e}function cr(e){const n={};for(let t=0;t<e.length;t++){var i=lr(e[t]);for(const e in i)n[e]=i[e]}return n}const hr={clone:lr,merge:cr};class ur extends yi{constructor(t){super(),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&(t.attributes,this.setValues(t))}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=lr(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const i in this.uniforms){const n=this.uniforms[i],r=n.value;r&&r.isTexture?e.uniforms[i]={type:"t",value:r.toJSON(t).uuid}:r&&r.isColor?e.uniforms[i]={type:"c",value:r.getHex()}:r&&r.isVector2?e.uniforms[i]={type:"v2",value:r.toArray()}:r&&r.isVector3?e.uniforms[i]={type:"v3",value:r.toArray()}:r&&r.isVector4?e.uniforms[i]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?e.uniforms[i]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?e.uniforms[i]={type:"m4",value:r.toArray()}:e.uniforms[i]={value:r}}0<Object.keys(this.defines).length&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const n={};for(const s in this.extensions)!0===this.extensions[s]&&(n[s]=!0);return 0<Object.keys(n).length&&(e.extensions=n),e}}ur.prototype.isShaderMaterial=!0;class dr extends ai{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new On,this.projectionMatrix=new On,this.projectionMatrixInverse=new On}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this}getWorldDirection(t){this.updateWorldMatrix(!0,!1);var e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}dr.prototype.isCamera=!0;class pr extends dr{constructor(t=50,e=1,n=.1,i=2e3){super(),this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){t=.5*this.getFilmHeight()/t;this.fov=2*Oe*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){var t=Math.tan(.5*Ie*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*Oe*Math.atan(Math.tan(.5*Ie*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,e,n,i,r,s){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*Ie*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i;var s=this.view;if(null!==this.view&&this.view.enabled){const t=s.fullWidth,a=s.fullHeight;r+=s.offsetX*i/t,e-=s.offsetY*n/a,i*=s.width/t,n*=s.height/a}const a=this.filmOffset;0!==a&&(r+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}pr.prototype.isPerspectiveCamera=!0;class fr extends ai{constructor(t,e,n){if(super(),this.type="CubeCamera",!0===n.isWebGLCubeRenderTarget){this.renderTarget=n;const i=new pr(90,1,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new rn(1,0,0)),this.add(i);const r=new pr(90,1,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new rn(-1,0,0)),this.add(r);const s=new pr(90,1,t,e);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(new rn(0,1,0)),this.add(s);const a=new pr(90,1,t,e);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(new rn(0,-1,0)),this.add(a);const o=new pr(90,1,t,e);o.layers=this.layers,o.up.set(0,-1,0),o.lookAt(new rn(0,0,1)),this.add(o);const l=new pr(90,1,t,e);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new rn(0,0,-1)),this.add(l)}}update(t,e){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[i,r,s,a,o,l]=this.children,c=t.xr.enabled,h=t.getRenderTarget();t.xr.enabled=!1;var u=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,i),t.setRenderTarget(n,1),t.render(e,r),t.setRenderTarget(n,2),t.render(e,s),t.setRenderTarget(n,3),t.render(e,a),t.setRenderTarget(n,4),t.render(e,o),n.texture.generateMipmaps=u,t.setRenderTarget(n,5),t.render(e,l),t.setRenderTarget(h),t.xr.enabled=c}}class mr extends Ke{constructor(t,e,n,i,r,s,a,o,l,c){super(t=void 0!==t?t:[],e=void 0!==e?e:b,n,i,r,s,a,o,l,c),this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}mr.prototype.isCubeTexture=!0;class gr extends tn{constructor(t,e,n){super(t,t,e=Number.isInteger(e)?n:e),e=e||{},this.texture=new mr(void 0,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:wt,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.format=Vt,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={tEquirect:{value:null}},i="\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",r="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",s=new or(5,5,5),a=new ur({name:"CubemapFromEquirect",uniforms:lr(n),vertexShader:i,fragmentShader:r,side:Lt,blending:Y});a.uniforms.tEquirect.value=e;const o=new sr(s,a),l=e.minFilter;e.minFilter===Nt&&(e.minFilter=wt);const c=new fr(1,10,this);return c.update(t,o),e.minFilter=l,o.geometry.dispose(),o.material.dispose(),this}clear(e,n,i,r){var t=e.getRenderTarget();for(let t=0;t<6;t++)e.setRenderTarget(this,t),e.clear(n,i,r);e.setRenderTarget(t)}}gr.prototype.isWebGLCubeRenderTarget=!0;const vr=new rn,xr=new rn,yr=new je;class _r{constructor(t=new rn(1,0,0),e=0){this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){e=vr.subVectors(n,e).cross(xr.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(e,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)}intersectLine(t,e){var n=t.delta(vr),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;i=-(t.start.dot(this.normal)+this.constant)/i;return i<0||1<i?null:e.copy(n).multiplyScalar(i).add(t.start)}intersectsLine(t){var e=this.distanceToPoint(t.start),t=this.distanceToPoint(t.end);return e<0&&0<t||t<0&&0<e}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||yr.getNormalMatrix(t),i=this.coplanarPoint(vr).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}_r.prototype.isPlane=!0;const Mr=new An,br=new rn;class Sr{constructor(t=new _r,e=new _r,n=new _r,i=new _r,r=new _r,s=new _r){this.planes=[t,e,n,i,r,s]}set(t,e,n,i,r,s){const a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(s),this}copy(e){const n=this.planes;for(let t=0;t<6;t++)n[t].copy(e.planes[t]);return this}setFromProjectionMatrix(t){const e=this.planes,n=t.elements,i=n[0],r=n[1],s=n[2],a=n[3],o=n[4],l=n[5],c=n[6],h=n[7],u=n[8],d=n[9],p=n[10],f=n[11],m=n[12],g=n[13],v=n[14],x=n[15];return e[0].setComponents(a-i,h-o,f-u,x-m).normalize(),e[1].setComponents(a+i,h+o,f+u,x+m).normalize(),e[2].setComponents(a+r,h+l,f+d,x+g).normalize(),e[3].setComponents(a-r,h-l,f-d,x-g).normalize(),e[4].setComponents(a-s,h-c,f-p,x-v).normalize(),e[5].setComponents(a+s,h+c,f+p,x+v).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Mr.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Mr)}intersectsSprite(t){return Mr.center.set(0,0,0),Mr.radius=.7071067811865476,Mr.applyMatrix4(t.matrixWorld),this.intersectsSphere(Mr)}intersectsSphere(e){const n=this.planes,i=e.center,r=-e.radius;for(let t=0;t<6;t++){const e=n[t].distanceToPoint(i);if(e<r)return!1}return!0}intersectsBox(e){var n=this.planes;for(let t=0;t<6;t++){const i=n[t];if(br.x=(0<i.normal.x?e.max:e.min).x,br.y=(0<i.normal.y?e.max:e.min).y,br.z=(0<i.normal.z?e.max:e.min).z,i.distanceToPoint(br)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let t=0;t<6;t++)if(n[t].distanceToPoint(e)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function wr(){let n=null,t=!1,i=null,r=null;function s(t,e){i(t,e),r=n.requestAnimationFrame(s)}return{start:function(){!0!==t&&null!==i&&(r=n.requestAnimationFrame(s),t=!0)},stop:function(){n.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(t){i=t},setContext:function(t){n=t}}}function Tr(a,t){const o=t.isWebGL2,i=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),i.get(t)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);var e=i.get(t);e&&(a.deleteBuffer(e.buffer),i.delete(t))},update:function(t,e){if(t.isGLBufferAttribute){const e=i.get(t);(!e||e.version<t.version)&&i.set(t,{buffer:t.buffer,type:t.type,bytesPerElement:t.elementSize,version:t.version})}else{t.isInterleavedBufferAttribute&&(t=t.data);const n=i.get(t);void 0===n?i.set(t,function(t,e){var n=t.array,i=t.usage,r=a.createBuffer();a.bindBuffer(e,r),a.bufferData(e,n,i),t.onUploadCallback();let s=5126;return n instanceof Float32Array?s=5126:n instanceof Float64Array||(n instanceof Uint16Array?t.isFloat16BufferAttribute?o&&(s=5131):s=5123:n instanceof Int16Array?s=5122:n instanceof Uint32Array?s=5125:n instanceof Int32Array?s=5124:n instanceof Int8Array?s=5120:(n instanceof Uint8Array||n instanceof Uint8ClampedArray)&&(s=5121)),{buffer:r,type:s,bytesPerElement:n.BYTES_PER_ELEMENT,version:t.version}}(t,e)):n.version<t.version&&(function(t,e,n){const i=e.array,r=e.updateRange;a.bindBuffer(n,t),-1===r.count?a.bufferSubData(n,0,i):(o?a.bufferSubData(n,r.offset*i.BYTES_PER_ELEMENT,i,r.offset,r.count):a.bufferSubData(n,r.offset*i.BYTES_PER_ELEMENT,i.subarray(r.offset,r.offset+r.count)),r.count=-1)}(n.buffer,t,e),n.version=t.version)}}}}class Ar extends Vi{constructor(n=1,i=1,r=1,s=1){super(),this.type="PlaneGeometry",this.parameters={width:n,height:i,widthSegments:r,heightSegments:s};const a=n/2,t=i/2,o=Math.floor(r),l=Math.floor(s),c=o+1,h=l+1,u=n/o,d=i/l,p=[],f=[],m=[],g=[];for(let e=0;e<h;e++){const n=e*d-t;for(let t=0;t<c;t++){const r=t*u-a;f.push(r,-n,0),m.push(0,0,1),g.push(t/o),g.push(1-e/l)}}for(let e=0;e<l;e++)for(let t=0;t<o;t++){const i=t+c*e,r=t+c*(e+1),s=t+1+c*(e+1),a=t+1+c*e;p.push(i,r,a),p.push(r,s,a)}this.setIndex(p),this.setAttribute("position",new Ni(f,3)),this.setAttribute("normal",new Ni(m,3)),this.setAttribute("uv",new Ni(g,2))}static fromJSON(t){return new Ar(t.width,t.height,t.widthSegments,t.heightSegments)}}const Er={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 ) + 0.5;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\treturn texture2D( envMap, uv ).rgb;\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 reflectVec;\n\t\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\t\treflectVec = reflect( - viewDir, normal );\n\t\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\t#else\n\t\t\t\treflectVec = refract( - viewDir, normal, refractionRatio );\n\t\t\t#endif\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tlightMapIrradiance *= PI;\n\t#endif\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= specularColorMapTexelToLinear( texture2D( specularColorMap, vUv ) ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= sheenColorMapTexelToLinear( texture2D( sheenColorMap, vUv ) ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] > 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1, 2 ) * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform vec2 morphTargetsTextureSize;\n\t\tvec3 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset, const in int stride ) {\n\t\t\tfloat texelIndex = float( vertexIndex * stride + offset );\n\t\t\tfloat y = floor( texelIndex / morphTargetsTextureSize.x );\n\t\t\tfloat x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tvec3 morphUV = vec3( ( x + 0.5 ) / morphTargetsTextureSize.x, y / morphTargetsTextureSize.y, morphTargetIndex );\n\t\t\treturn texture( morphTargetsTexture, morphUV ).xyz;\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\t#ifndef USE_MORPHNORMALS\n\t\t\t\tif ( morphTargetInfluences[ i ] > 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 1 ) * morphTargetInfluences[ i ];\n\t\t\t#else\n\t\t\t\tif ( morphTargetInfluences[ i ] > 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 2 ) * morphTargetInfluences[ i ];\n\t\t\t#endif\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( float roughness, float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( vec2 fragCoord, float roughness, float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( vec3 radiance, float transmissionDistance, vec3 attenuationColor, float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 diffuseColor, vec3 specularColor, float specularF90,\n\t\tvec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness,\n\t\tvec3 attenuationColor, float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}"},Lr={common:{diffuse:{value:new Ai(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new je},uv2Transform:{value:new je},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new We(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ai(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Ai(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new je}},sprite:{diffuse:{value:new Ai(16777215)},opacity:{value:1},center:{value:new We(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new je}}},Cr={basic:{uniforms:cr([Lr.common,Lr.specularmap,Lr.envmap,Lr.aomap,Lr.lightmap,Lr.fog]),vertexShader:Er.meshbasic_vert,fragmentShader:Er.meshbasic_frag},lambert:{uniforms:cr([Lr.common,Lr.specularmap,Lr.envmap,Lr.aomap,Lr.lightmap,Lr.emissivemap,Lr.fog,Lr.lights,{emissive:{value:new Ai(0)}}]),vertexShader:Er.meshlambert_vert,fragmentShader:Er.meshlambert_frag},phong:{uniforms:cr([Lr.common,Lr.specularmap,Lr.envmap,Lr.aomap,Lr.lightmap,Lr.emissivemap,Lr.bumpmap,Lr.normalmap,Lr.displacementmap,Lr.fog,Lr.lights,{emissive:{value:new Ai(0)},specular:{value:new Ai(1118481)},shininess:{value:30}}]),vertexShader:Er.meshphong_vert,fragmentShader:Er.meshphong_frag},standard:{uniforms:cr([Lr.common,Lr.envmap,Lr.aomap,Lr.lightmap,Lr.emissivemap,Lr.bumpmap,Lr.normalmap,Lr.displacementmap,Lr.roughnessmap,Lr.metalnessmap,Lr.fog,Lr.lights,{emissive:{value:new Ai(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Er.meshphysical_vert,fragmentShader:Er.meshphysical_frag},toon:{uniforms:cr([Lr.common,Lr.aomap,Lr.lightmap,Lr.emissivemap,Lr.bumpmap,Lr.normalmap,Lr.displacementmap,Lr.gradientmap,Lr.fog,Lr.lights,{emissive:{value:new Ai(0)}}]),vertexShader:Er.meshtoon_vert,fragmentShader:Er.meshtoon_frag},matcap:{uniforms:cr([Lr.common,Lr.bumpmap,Lr.normalmap,Lr.displacementmap,Lr.fog,{matcap:{value:null}}]),vertexShader:Er.meshmatcap_vert,fragmentShader:Er.meshmatcap_frag},points:{uniforms:cr([Lr.points,Lr.fog]),vertexShader:Er.points_vert,fragmentShader:Er.points_frag},dashed:{uniforms:cr([Lr.common,Lr.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Er.linedashed_vert,fragmentShader:Er.linedashed_frag},depth:{uniforms:cr([Lr.common,Lr.displacementmap]),vertexShader:Er.depth_vert,fragmentShader:Er.depth_frag},normal:{uniforms:cr([Lr.common,Lr.bumpmap,Lr.normalmap,Lr.displacementmap,{opacity:{value:1}}]),vertexShader:Er.meshnormal_vert,fragmentShader:Er.meshnormal_frag},sprite:{uniforms:cr([Lr.sprite,Lr.fog]),vertexShader:Er.sprite_vert,fragmentShader:Er.sprite_frag},background:{uniforms:{uvTransform:{value:new je},t2D:{value:null}},vertexShader:Er.background_vert,fragmentShader:Er.background_frag},cube:{uniforms:cr([Lr.envmap,{opacity:{value:1}}]),vertexShader:Er.cube_vert,fragmentShader:Er.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Er.equirect_vert,fragmentShader:Er.equirect_frag},distanceRGBA:{uniforms:cr([Lr.common,Lr.displacementmap,{referencePosition:{value:new rn},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Er.distanceRGBA_vert,fragmentShader:Er.distanceRGBA_frag},shadow:{uniforms:cr([Lr.lights,Lr.fog,{color:{value:new Ai(0)},opacity:{value:1}}]),vertexShader:Er.shadow_vert,fragmentShader:Er.shadow_frag}};function Pr(a,o,n,l,i){const c=new Ai(0);let h,u,d=0,p=null,f=0,m=null;function g(t,e){n.buffers.color.setClear(t.r,t.g,t.b,e,i)}return{getClearColor:function(){return c},setClearColor:function(t,e=1){c.set(t),d=e,g(c,d)},getClearAlpha:function(){return d},setClearAlpha:function(t){d=t,g(c,d)},render:function(t,e){let n=!1,i=!0===e.isScene?e.background:null;i&&i.isTexture&&(i=o.get(i));const r=a.xr,s=r.getSession&&r.getSession();s&&"additive"===s.environmentBlendMode&&(i=null),null===i?g(c,d):i&&i.isColor&&(g(i,1),n=!0),(a.autoClear||n)&&a.clear(a.autoClearColor,a.autoClearDepth,a.autoClearStencil),i&&(i.isCubeTexture||i.mapping===P)?(void 0===u&&(u=new sr(new or(1,1,1),new ur({name:"BackgroundCubeMaterial",uniforms:lr(Cr.cube.uniforms),vertexShader:Cr.cube.vertexShader,fragmentShader:Cr.cube.fragmentShader,side:Lt,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),l.update(u)),u.material.uniforms.envMap.value=i,u.material.uniforms.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,p===i&&f===i.version&&m===a.toneMapping||(u.material.needsUpdate=!0,p=i,f=i.version,m=a.toneMapping),t.unshift(u,u.geometry,u.material,0,0,null)):i&&i.isTexture&&(void 0===h&&(h=new sr(new Ar(2,2),new ur({name:"BackgroundMaterial",uniforms:lr(Cr.background.uniforms),vertexShader:Cr.background.vertexShader,fragmentShader:Cr.background.fragmentShader,side:Et,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),l.update(h)),h.material.uniforms.t2D.value=i,!0===i.matrixAutoUpdate&&i.updateMatrix(),h.material.uniforms.uvTransform.value.copy(i.matrix),p===i&&f===i.version&&m===a.toneMapping||(h.material.needsUpdate=!0,p=i,f=i.version,m=a.toneMapping),t.unshift(h,h.geometry,h.material,0,0,null))}}}function Dr(c,h,u,d){const r=c.getParameter(34921),e=d.isWebGL2?null:h.get("OES_vertex_array_object"),a=d.isWebGL2||null!==e,o={},t=m(null);let l=t;function p(){return d.isWebGL2?c.createVertexArray():e.createVertexArrayOES()}function f(t){return d.isWebGL2?c.bindVertexArray(t):e.bindVertexArrayOES(t)}function s(t){return d.isWebGL2?c.deleteVertexArray(t):e.deleteVertexArrayOES(t)}function m(t){const e=[],n=[],i=[];for(let t=0;t<r;t++)e[t]=0,n[t]=0,i[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:n,attributeDivisors:i,object:t,attributes:{},index:null}}function g(){const n=l.newAttributes;for(let t=0,e=n.length;t<e;t++)n[t]=0}function v(t){x(t,0)}function x(t,e){const n=l.newAttributes,i=l.enabledAttributes,r=l.attributeDivisors;if(n[t]=1,0===i[t]&&(c.enableVertexAttribArray(t),i[t]=1),r[t]!==e){const n=d.isWebGL2?c:h.get("ANGLE_instanced_arrays");n[d.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](t,e),r[t]=e}}function y(){const n=l.newAttributes,i=l.enabledAttributes;for(let t=0,e=i.length;t<e;t++)i[t]!==n[t]&&(c.disableVertexAttribArray(t),i[t]=0)}function _(t,e,n,i,r,s){!0!==d.isWebGL2||5124!==n&&5125!==n?c.vertexAttribPointer(t,e,n,i,r,s):c.vertexAttribIPointer(t,e,n,r,s)}function M(){n(),l!==t&&(l=t,f(l.object))}function n(){t.geometry=null,t.program=null,t.wireframe=!1}return{setup:function(t,e,n,i,r){let s=!1;if(a){const c=function(t,e,n){n=!0===n.wireframe;let i=o[t.id];void 0===i&&(i={},o[t.id]=i);let r=i[e.id];void 0===r&&(r={},i[e.id]=r);let s=r[n];return void 0===s&&(s=m(p()),r[n]=s),s}(i,n,e);l!==c&&(l=c,f(l.object)),s=function(t,e){var n=l.attributes,i=t.attributes;let r=0;for(const s in i){const t=n[s],e=i[s];if(void 0===t)return!0;if(t.attribute!==e)return!0;if(t.data!==e.data)return!0;r++}return l.attributesNum!==r||l.index!==e}(i,r),s&&function(t,e){const n={},i=t.attributes;let r=0;for(const s in i){const t=i[s],e={};(e.attribute=t).data&&(e.data=t.data),n[s]=e,r++}l.attributes=n,l.attributesNum=r,l.index=e}(i,r)}else{const c=!0===e.wireframe;l.geometry===i.id&&l.program===n.id&&l.wireframe===c||(l.geometry=i.id,l.program=n.id,l.wireframe=c,s=!0)}!0===t.isInstancedMesh&&(s=!0),null!==r&&u.update(r,34963),s&&(function(t,e,n,i){if(!1!==d.isWebGL2||!t.isInstancedMesh&&!i.isInstancedBufferGeometry||null!==h.get("ANGLE_instanced_arrays")){g();const r=i.attributes,s=n.getAttributes(),a=e.defaultAttributeValues;for(const h in s){const d=s[h];if(0<=d.location){let e=r[h];if(void 0===e&&("instanceMatrix"===h&&t.instanceMatrix&&(e=t.instanceMatrix),"instanceColor"===h&&t.instanceColor&&(e=t.instanceColor)),void 0!==e){const h=e.normalized,n=e.itemSize,r=u.get(e);if(void 0!==r){const s=r.buffer,a=r.type,o=r.bytesPerElement;if(e.isInterleavedBufferAttribute){const u=e.data,r=u.stride,l=e.offset;if(u&&u.isInstancedInterleavedBuffer){for(let t=0;t<d.locationSize;t++)x(d.location+t,u.meshPerAttribute);!0!==t.isInstancedMesh&&void 0===i._maxInstanceCount&&(i._maxInstanceCount=u.meshPerAttribute*u.count)}else for(let t=0;t<d.locationSize;t++)v(d.location+t);c.bindBuffer(34962,s);for(let t=0;t<d.locationSize;t++)_(d.location+t,n/d.locationSize,a,h,r*o,(l+n/d.locationSize*t)*o)}else{if(e.isInstancedBufferAttribute){for(let t=0;t<d.locationSize;t++)x(d.location+t,e.meshPerAttribute);!0!==t.isInstancedMesh&&void 0===i._maxInstanceCount&&(i._maxInstanceCount=e.meshPerAttribute*e.count)}else for(let t=0;t<d.locationSize;t++)v(d.location+t);c.bindBuffer(34962,s);for(let t=0;t<d.locationSize;t++)_(d.location+t,n/d.locationSize,a,h,n*o,n/d.locationSize*t*o)}}}else if(void 0!==a){const u=a[h];if(void 0!==u)switch(u.length){case 2:c.vertexAttrib2fv(d.location,u);break;case 3:c.vertexAttrib3fv(d.location,u);break;case 4:c.vertexAttrib4fv(d.location,u);break;default:c.vertexAttrib1fv(d.location,u)}}}}y()}}(t,e,n,i),null!==r&&c.bindBuffer(34963,u.get(r).buffer))},reset:M,resetDefaultState:n,dispose:function(){M();for(const t in o){const e=o[t];for(const n in e){const i=e[n];for(const r in i)s(i[r].object),delete i[r];delete e[n]}delete o[t]}},releaseStatesOfGeometry:function(t){if(void 0!==o[t.id]){const e=o[t.id];for(const n in e){const t=e[n];for(const e in t)s(t[e].object),delete t[e];delete e[n]}delete o[t.id]}},releaseStatesOfProgram:function(t){for(const e in o){const n=o[e];if(void 0!==n[t.id]){const i=n[t.id];for(const t in i)s(i[t].object),delete i[t];delete n[t.id]}}},initAttributes:g,enableAttribute:v,disableUnusedAttributes:y}}function Rr(s,a,o,t){const l=t.isWebGL2;let c;this.setMode=function(t){c=t},this.render=function(t,e){s.drawArrays(c,t,e),o.update(e,c,1)},this.renderInstances=function(n,i,r){if(0!==r){let t,e;if(l)t=s,e="drawArraysInstanced";else if(t=a.get("ANGLE_instanced_arrays"),e="drawArraysInstancedANGLE",null===t)return;t[e](c,n,i,r),o.update(i,c,r)}}}function Nr(e,n,t){let i;function r(t){if("highp"===t){if(0<e.getShaderPrecisionFormat(35633,36338).precision&&0<e.getShaderPrecisionFormat(35632,36338).precision)return"highp";t="mediump"}return"mediump"===t&&0<e.getShaderPrecisionFormat(35633,36337).precision&&0<e.getShaderPrecisionFormat(35632,36337).precision?"mediump":"lowp"}var s="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext;let a=void 0!==t.precision?t.precision:"highp";var o=r(a);o!==a&&(a=o);var l=s||n.has("WEBGL_draw_buffers"),c=!0===t.logarithmicDepthBuffer,h=e.getParameter(34930),u=e.getParameter(35660),d=e.getParameter(3379),p=e.getParameter(34076),f=e.getParameter(34921),m=e.getParameter(36347),g=e.getParameter(36348),v=e.getParameter(36349),x=0<u,y=s||n.has("OES_texture_float"),o=x&&y,t=s?e.getParameter(36183):0;return{isWebGL2:s,drawBuffers:l,getMaxAnisotropy:function(){return void 0!==i||(i=!0===n.has("EXT_texture_filter_anisotropic")?(t=n.get("EXT_texture_filter_anisotropic"),e.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT)):0),i;var t},getMaxPrecision:r,precision:a,logarithmicDepthBuffer:c,maxTextures:h,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:v,vertexTextures:x,floatFragmentTextures:y,floatVertexTextures:o,maxSamples:t}}function Ir(o){const e=this;let l=null,c=0,h=!1,u=!1;const d=new _r,p=new je,f={value:null,needsUpdate:!1};function m(){f.value!==l&&(f.value=l,f.needsUpdate=0<c),e.numPlanes=c,e.numIntersection=0}function g(n,t,i,r){var s=null!==n?n.length:0;let a=null;if(0!==s){if(a=f.value,!0!==r||null===a){const e=i+4*s,r=t.matrixWorldInverse;p.getNormalMatrix(r),(null===a||a.length<e)&&(a=new Float32Array(e));for(let t=0,e=i;t!==s;++t,e+=4)d.copy(n[t]).applyMatrix4(r,p),d.normal.toArray(a,e),a[e+3]=d.constant}f.value=a,f.needsUpdate=!0}return e.numPlanes=s,e.numIntersection=0,a}this.uniform=f,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e,n){var i=0!==t.length||e||0!==c||h;return h=e,l=g(t,n,0),c=t.length,i},this.beginShadows=function(){u=!0,g(null)},this.endShadows=function(){u=!1,m()},this.setState=function(n,t,i){const r=n.clippingPlanes,s=n.clipIntersection,e=n.clipShadows,a=o.get(n);if(!h||null===r||0===r.length||u&&!e)u?g(null):m();else{const o=u?0:c,n=4*o;let e=a.clippingState||null;f.value=e,e=g(r,t,n,i);for(let t=0;t!==n;++t)e[t]=l[t];a.clippingState=e,this.numIntersection=s?this.numPlanes:0,this.numPlanes+=o}}}function Or(r){let s=new WeakMap;function a(t,e){return e===c?t.mapping=b:e===h&&(t.mapping=S),t}function o(t){const e=t.target;e.removeEventListener("dispose",o);const n=s.get(e);void 0!==n&&(s.delete(e),n.dispose())}return{get:function(t){if(t&&t.isTexture&&!1===t.isRenderTargetTexture){var e=t.mapping;if(e===c||e===h){if(s.has(t)){const r=s.get(t).texture;return a(r,t.mapping)}e=t.image;if(e&&0<e.height){const n=r.getRenderTarget(),i=new gr(e.height/2);return i.fromEquirectangularTexture(r,t),s.set(t,i),r.setRenderTarget(n),t.addEventListener("dispose",o),a(i.texture,t.mapping)}return null}}return t},dispose:function(){s=new WeakMap}}}Cr.physical={uniforms:cr([Cr.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new We(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new Ai(0)},sheenColorMap:{value:null},sheenRoughness:{value:0},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new We},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Ai(0)},specularIntensity:{value:0},specularIntensityMap:{value:null},specularColor:{value:new Ai(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Er.meshphysical_vert,fragmentShader:Er.meshphysical_frag};class zr extends dr{constructor(t=-1,e=1,n=1,i=-1,r=.1,s=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,n,i,r,s){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-t,s=n+t,a=i+e,o=i-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,s=r+t*this.view.width,a-=e*this.view.offsetY,o=a-e*this.view.height}this.projectionMatrix.makeOrthographic(r,s,a,o,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}zr.prototype.isOrthographicCamera=!0;class Ur extends ur{constructor(t){super(t),this.type="RawShaderMaterial"}}Ur.prototype.isRawShaderMaterial=!0;const Fr=Math.pow(2,8),Br=[.125,.215,.35,.446,.526,.582],kr=5+Br.length,Vr={[Se]:0,[we]:1},Gr=new zr,{_lodPlanes:Hr,_sizeLods:Wr,_sigmas:jr}=function(){const n=[],i=[],r=[];let s=8;for(let e=0;e<kr;e++){var a=Math.pow(2,s);i.push(a);let t=1/a;4<e?t=Br[e-8+4-1]:0==e&&(t=0),r.push(t);const l=1/(a-1),c=-l/2,h=1+l/2,u=[c,c,h,c,h,h,c,c,h,h,c,h],d=new Float32Array(108),p=new Float32Array(72),f=new Float32Array(36);for(let t=0;t<6;t++){const i=t%3*2/3-1,r=2<t?0:-1,s=[i,r,0,i+2/3,r,0,i+2/3,1+r,0,i,r,0,i+2/3,1+r,0,i,1+r,0];d.set(s,18*t),p.set(u,12*t);var o=[t,t,t,t,t,t];f.set(o,6*t)}const m=new Vi;m.setAttribute("position",new Pi(d,3)),m.setAttribute("uv",new Pi(p,2)),m.setAttribute("faceIndex",new Pi(f,1)),n.push(m),4<s&&s--}return{_lodPlanes:n,_sizeLods:i,_sigmas:r}}(),Xr=new Ai;let qr=null;const Yr=(1+Math.sqrt(5))/2,Zr=1/Yr,Jr=[new rn(1,1,1),new rn(-1,1,1),new rn(1,1,-1),new rn(-1,1,-1),new rn(0,Yr,Zr),new rn(0,Yr,-Zr),new rn(Zr,0,Yr),new rn(-Zr,0,Yr),new rn(Yr,Zr,0),new rn(-Yr,Zr,0)];class Kr{constructor(t){var e,n;this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=(e=20,n=new Float32Array(e),t=new rn(0,1,0),t=new Ur({name:"SphericalGaussianBlur",defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:t}},vertexShader:ns(),fragmentShader:`
- precision mediump float;
- precision mediump int;
- varying vec3 vOutputDirection;
- uniform sampler2D envMap;
- uniform int samples;
- uniform float weights[ n ];
- uniform bool latitudinal;
- uniform float dTheta;
- uniform float mipInt;
- uniform vec3 poleAxis;
- ${is()}
- #define ENVMAP_TYPE_CUBE_UV
- #include <cube_uv_reflection_fragment>
- vec3 getSample( float theta, vec3 axis ) {
- float cosTheta = cos( theta );
- // Rodrigues' axis-angle rotation
- vec3 sampleDirection = vOutputDirection * cosTheta
- + cross( axis, vOutputDirection ) * sin( theta )
- + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
- return bilinearCubeUV( envMap, sampleDirection, mipInt );
- }
- void main() {
- vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
- if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
- axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
- }
- axis = normalize( axis );
- gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
- gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
- for ( int i = 1; i < n; i++ ) {
- if ( i >= samples ) {
- break;
- }
- float theta = dTheta * float( i );
- gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
- gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
- }
- }
- `,blending:Y,depthTest:!1,depthWrite:!1})),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,i=100){qr=this._renderer.getRenderTarget();var r=this._allocateTargets();return this._sceneToCubeUV(t,n,i,r),0<e&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t){return this._fromTexture(t)}fromCubemap(t){return this._fromTexture(t)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=es(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=ts(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let t=0;t<Hr.length;t++)Hr[t].dispose()}_cleanup(t){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(qr),t.scissorTest=!1,$r(t,0,0,t.width,t.height)}_fromTexture(t){qr=this._renderer.getRenderTarget();var e=this._allocateTargets(t);return this._textureToCubeUV(t,e),this._applyPMREM(e),this._cleanup(e),e}_allocateTargets(t){const e={magFilter:wt,minFilter:wt,generateMipmaps:!1,type:Ft,format:Vt,encoding:Se,depthBuffer:!1},n=Qr(e);return n.depthBuffer=!t,this._pingPongRenderTarget=Qr(e),n}_compileMaterial(t){t=new sr(Hr[0],t);this._renderer.compile(t,Gr)}_sceneToCubeUV(e,n,t,i){const r=new pr(90,1,n,t),s=[1,-1,1,1,1,1],a=[1,1,1,-1,-1,-1],o=this._renderer,l=o.autoClear,c=o.toneMapping;o.getClearColor(Xr),o.toneMapping=Pt,o.autoClear=!1;const h=new Ei({name:"PMREM.Background",side:Lt,depthWrite:!1,depthTest:!1}),u=new sr(new or,h);let d=!1;t=e.background;t?t.isColor&&(h.color.copy(t),e.background=null,d=!0):(h.color.copy(Xr),d=!0);for(let t=0;t<6;t++){const n=t%3;0==n?(r.up.set(0,s[t],0),r.lookAt(a[t],0,0)):1==n?(r.up.set(0,0,s[t]),r.lookAt(0,a[t],0)):(r.up.set(0,s[t],0),r.lookAt(0,0,a[t])),$r(i,n*Fr,2<t?Fr:0,Fr,Fr),o.setRenderTarget(i),d&&o.render(u,r),o.render(e,r)}u.geometry.dispose(),u.material.dispose(),o.toneMapping=c,o.autoClear=l,e.background=t}_setEncoding(t,e){!0===this._renderer.capabilities.isWebGL2&&e.format===Vt&&e.type===It&&e.encoding===we?t.value=Vr[Se]:t.value=Vr[e.encoding]}_textureToCubeUV(t,e){const n=this._renderer,i=t.mapping===b||t.mapping===S;i?null==this._cubemapShader&&(this._cubemapShader=es()):null==this._equirectShader&&(this._equirectShader=ts());const r=i?this._cubemapShader:this._equirectShader,s=new sr(Hr[0],r),a=r.uniforms;a.envMap.value=t,i||a.texelSize.value.set(1/t.image.width,1/t.image.height),this._setEncoding(a.inputEncoding,t),$r(e,0,0,3*Fr,2*Fr),n.setRenderTarget(e),n.render(s,Gr)}_applyPMREM(e){const n=this._renderer,i=n.autoClear;n.autoClear=!1;for(let t=1;t<kr;t++){const n=Math.sqrt(jr[t]*jr[t]-jr[t-1]*jr[t-1]),i=Jr[(t-1)%Jr.length];this._blur(e,t-1,t,n,i)}n.autoClear=i}_blur(t,e,n,i,r){var s=this._pingPongRenderTarget;this._halfBlur(t,s,e,n,i,"latitudinal",r),this._halfBlur(s,t,n,n,i,"longitudinal",r)}_halfBlur(e,n,t,i,r,s,a){const o=this._renderer,l=this._blurMaterial,c=new sr(Hr[i],l),h=l.uniforms,u=Wr[t]-1,d=isFinite(r)?Math.PI/(2*u):2*Math.PI/39,p=r/d,f=isFinite(r)?1+Math.floor(3*p):20,m=[];let g=0;for(let t=0;t<20;++t){const e=t/p,n=Math.exp(-e*e/2);m.push(n),0==t?g+=n:t<f&&(g+=2*n)}for(let t=0;t<m.length;t++)m[t]=m[t]/g;h.envMap.value=e.texture,h.samples.value=f,h.weights.value=m,h.latitudinal.value="latitudinal"===s,a&&(h.poleAxis.value=a),h.dTheta.value=d,h.mipInt.value=8-t;t=Wr[i];$r(n,3*Math.max(0,Fr-2*t),(0===i?0:2*Fr)+2*t*(4<i?i-8+4:0),3*t,2*t),o.setRenderTarget(n),o.render(c,Gr)}}function Qr(t){const e=new tn(3*Fr,3*Fr,t);return e.texture.mapping=P,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function $r(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function ts(){var t=new We(1,1);return new Ur({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:t},inputEncoding:{value:Vr[Se]}},vertexShader:ns(),fragmentShader:`
- precision mediump float;
- precision mediump int;
- varying vec3 vOutputDirection;
- uniform sampler2D envMap;
- uniform vec2 texelSize;
- ${is()}
- #include <common>
- void main() {
- gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
- vec3 outputDirection = normalize( vOutputDirection );
- vec2 uv = equirectUv( outputDirection );
- vec2 f = fract( uv / texelSize - 0.5 );
- uv -= f * texelSize;
- vec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
- uv.x += texelSize.x;
- vec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
- uv.y += texelSize.y;
- vec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
- uv.x -= texelSize.x;
- vec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
- vec3 tm = mix( tl, tr, f.x );
- vec3 bm = mix( bl, br, f.x );
- gl_FragColor.rgb = mix( tm, bm, f.y );
- }
- `,blending:Y,depthTest:!1,depthWrite:!1})}function es(){return new Ur({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:Vr[Se]}},vertexShader:ns(),fragmentShader:`
- precision mediump float;
- precision mediump int;
- varying vec3 vOutputDirection;
- uniform samplerCube envMap;
- ${is()}
- void main() {
- gl_FragColor = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) );
- }
- `,blending:Y,depthTest:!1,depthWrite:!1})}function ns(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function is(){return"\n\n\t\tuniform int inputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t"}function rs(r){let s=new WeakMap,a=null;function o(e){let n=0;for(let t=0;t<6;t++)void 0!==e[t]&&n++;return 6===n}function l(t){const e=t.target;e.removeEventListener("dispose",l);const n=s.get(e);void 0!==n&&(s.delete(e),n.dispose())}return{get:function(t){if(t&&t.isTexture&&!1===t.isRenderTargetTexture){var e=t.mapping,n=e===c||e===h,i=e===b||e===S;if(n||i){if(s.has(t))return s.get(t).texture;e=t.image;if(n&&e&&0<e.height||i&&e&&o(e)){const o=r.getRenderTarget();null===a&&(a=new Kr(r));n=n?a.fromEquirectangular(t):a.fromCubemap(t);return s.set(t,n),r.setRenderTarget(o),t.addEventListener("dispose",l),n.texture}return null}}return t},dispose:function(){s=new WeakMap,null!==a&&(a.dispose(),a=null)}}}function ss(n){const i={};function e(t){if(void 0!==i[t])return i[t];let e;switch(t){case"WEBGL_depth_texture":e=n.getExtension("WEBGL_depth_texture")||n.getExtension("MOZ_WEBGL_depth_texture")||n.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":e=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":e=n.getExtension("WEBGL_compressed_texture_s3tc")||n.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":e=n.getExtension("WEBGL_compressed_texture_pvrtc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:e=n.getExtension(t)}return i[t]=e,e}return{has:function(t){return null!==e(t)},init:function(t){t.isWebGL2?e("EXT_color_buffer_float"):(e("WEBGL_depth_texture"),e("OES_texture_float"),e("OES_texture_half_float"),e("OES_texture_half_float_linear"),e("OES_standard_derivatives"),e("OES_element_index_uint"),e("OES_vertex_array_object"),e("ANGLE_instanced_arrays")),e("OES_texture_float_linear"),e("EXT_color_buffer_half_float"),e("WEBGL_multisampled_render_to_texture")},get:function(t){t=e(t);return t}}}function as(t,o,n,i){const r={},l=new WeakMap;function s(t){const e=t.target;null!==e.index&&o.remove(e.index);for(const n in e.attributes)o.remove(e.attributes[n]);e.removeEventListener("dispose",s),delete r[e.id];t=l.get(e);t&&(o.remove(t),l.delete(e)),i.releaseStatesOfGeometry(e),!0===e.isInstancedBufferGeometry&&delete e._maxInstanceCount,n.memory.geometries--}function a(n){const i=[],r=n.index,s=n.attributes.position;let t=0;if(null!==r){const n=r.array;t=r.version;for(let t=0,e=n.length;t<e;t+=3){const r=n[t+0],s=n[t+1],l=n[t+2];i.push(r,s,s,l,l,r)}}else{const n=s.array;t=s.version;for(let t=0,e=n.length/3-1;t<e;t+=3){const n=t+0,r=t+1,s=t+2;i.push(n,r,r,s,s,n)}}const e=new(65535<Xe(i)?Ri:Di)(i,1);e.version=t;var a=l.get(n);a&&o.remove(a),l.set(n,e)}return{get:function(t,e){return!0===r[e.id]||(e.addEventListener("dispose",s),r[e.id]=!0,n.memory.geometries++),e},update:function(n){var t=n.attributes;for(const i in t)o.update(t[i],34962);var e=n.morphAttributes;for(const r in e){const n=e[r];for(let t=0,e=n.length;t<e;t++)o.update(n[t],34962)}},getWireframeAttribute:function(t){var e,n=l.get(t);return(!n||null!==(e=t.index)&&n.version<e.version)&&a(t),l.get(t)}}}function os(s,a,o,t){const l=t.isWebGL2;let c,h,u;this.setMode=function(t){c=t},this.setIndex=function(t){h=t.type,u=t.bytesPerElement},this.render=function(t,e){s.drawElements(c,e,h,t*u),o.update(e,c,1)},this.renderInstances=function(n,i,r){if(0!==r){let t,e;if(l)t=s,e="drawElementsInstanced";else if(t=a.get("ANGLE_instanced_arrays"),e="drawElementsInstancedANGLE",null===t)return;t[e](c,i,h,n*u,r),o.update(i,c,r)}}}function ls(t){const i={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:i,programs:null,autoReset:!0,reset:function(){i.frame++,i.calls=0,i.triangles=0,i.points=0,i.lines=0},update:function(t,e,n){switch(i.calls++,e){case 4:i.triangles+=n*(t/3);break;case 1:i.lines+=n*(t/2);break;case 3:i.lines+=n*(t-1);break;case 2:i.lines+=n*t;break;case 0:i.points+=n*t}}}}class cs extends Ke{constructor(t=null,e=1,n=1,i=1){super(null),this.image={data:t,width:e,height:n,depth:i},this.magFilter=Rt,this.minFilter=Rt,this.wrapR=Dt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}function hs(t,e){return t[0]-e[0]}function us(t,e){return Math.abs(e[1])-Math.abs(t[1])}function ds(t,e){let n=1;e=(e.isInterleavedBufferAttribute?e.data:e).array;e instanceof Int8Array?n=127:e instanceof Int16Array?n=32767:e instanceof Int32Array&&(n=2147483647),t.divideScalar(n)}function ps(u,d,p){const f={},m=new Float32Array(8),g=new WeakMap,v=new rn,x=[];for(let t=0;t<8;t++)x[t]=[t,0];return{update:function(i,r,s,a){var o=i.morphTargetInfluences;if(!0===d.isWebGL2){const f=r.morphAttributes.position.length;let t=g.get(r);if(void 0===t||t.count!==f){void 0!==t&&t.texture.dispose();const u=void 0!==r.morphAttributes.normal,p=r.morphAttributes.position,x=r.morphAttributes.normal||[],i=r.attributes.position.count,s=!0==u?2:1;let e=i*s,n=1;e>d.maxTextureSize&&(n=Math.ceil(e/d.maxTextureSize),e=d.maxTextureSize);const c=new Float32Array(e*n*4*f),h=new cs(c,e,n,f);h.format=Vt,h.type=Ut,h.needsUpdate=!0;var l=4*s;for(let t=0;t<f;t++){const f=p[t],m=x[t],g=e*n*4*t;for(let t=0;t<f.count;t++){v.fromBufferAttribute(f,t),!0===f.normalized&&ds(v,f);const p=t*l;c[g+p]=v.x,c[g+p+1]=v.y,c[g+p+2]=v.z,!(c[g+p+3]=0)==u&&(v.fromBufferAttribute(m,t),!0===m.normalized&&ds(v,m),c[g+p+4]=v.x,c[g+p+5]=v.y,c[g+p+6]=v.z,c[g+p+7]=0)}}t={count:f,texture:h,size:new We(e,n)},g.set(r,t)}let e=0;for(let t=0;t<o.length;t++)e+=o[t];const i=r.morphTargetsRelative?1:1-e;a.getUniforms().setValue(u,"morphTargetBaseInfluence",i),a.getUniforms().setValue(u,"morphTargetInfluences",o),a.getUniforms().setValue(u,"morphTargetsTexture",t.texture,p),a.getUniforms().setValue(u,"morphTargetsTextureSize",t.size)}else{const d=void 0===o?0:o.length;let e=f[r.id];if(void 0===e||e.length!==d){e=[];for(let t=0;t<d;t++)e[t]=[t,0];f[r.id]=e}for(let t=0;t<d;t++){const d=e[t];d[0]=t,d[1]=o[t]}e.sort(us);for(let t=0;t<8;t++)t<d&&e[t][1]?(x[t][0]=e[t][0],x[t][1]=e[t][1]):(x[t][0]=Number.MAX_SAFE_INTEGER,x[t][1]=0);x.sort(hs);const g=r.morphAttributes.position,v=r.morphAttributes.normal;let n=0;for(let t=0;t<8;t++){const d=x[t],p=d[0],f=d[1];p!==Number.MAX_SAFE_INTEGER&&f?(g&&r.getAttribute("morphTarget"+t)!==g[p]&&r.setAttribute("morphTarget"+t,g[p]),v&&r.getAttribute("morphNormal"+t)!==v[p]&&r.setAttribute("morphNormal"+t,v[p]),m[t]=f,n+=f):(g&&!0===r.hasAttribute("morphTarget"+t)&&r.deleteAttribute("morphTarget"+t),v&&!0===r.hasAttribute("morphNormal"+t)&&r.deleteAttribute("morphNormal"+t),m[t]=0)}const s=r.morphTargetsRelative?1:1-n;a.getUniforms().setValue(u,"morphTargetBaseInfluence",s),a.getUniforms().setValue(u,"morphTargetInfluences",m)}}}}function fs(t,i,r,s){let a=new WeakMap;function o(t){const e=t.target;e.removeEventListener("dispose",o),r.remove(e.instanceMatrix),null!==e.instanceColor&&r.remove(e.instanceColor)}return{update:function(t){var e=s.render.frame,n=t.geometry,n=i.get(t,n);return a.get(n)!==e&&(i.update(n),a.set(n,e)),t.isInstancedMesh&&(!1===t.hasEventListener("dispose",o)&&t.addEventListener("dispose",o),r.update(t.instanceMatrix,34962),null!==t.instanceColor&&r.update(t.instanceColor,34962)),n},dispose:function(){a=new WeakMap}}}cs.prototype.isDataTexture2DArray=!0;class ms extends Ke{constructor(t=null,e=1,n=1,i=1){super(null),this.image={data:t,width:e,height:n,depth:i},this.magFilter=Rt,this.minFilter=Rt,this.wrapR=Dt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}ms.prototype.isDataTexture3D=!0;const gs=new Ke,vs=new cs,xs=new ms,ys=new mr,_s=[],Ms=[],bs=new Float32Array(16),Ss=new Float32Array(9),ws=new Float32Array(4);function Ts(n,i,r){const t=n[0];if(t<=0||0<t)return n;var e=i*r;let s=_s[e];if(void 0===s&&(s=new Float32Array(e),_s[e]=s),0!==i){t.toArray(s,0);for(let t=1,e=0;t!==i;++t)e+=r,n[t].toArray(s,e)}return s}function As(n,i){if(n.length===i.length){for(let t=0,e=n.length;t<e;t++)if(n[t]!==i[t])return;return 1}}function Es(n,i){for(let t=0,e=i.length;t<e;t++)n[t]=i[t]}function Ls(e,n){let i=Ms[n];void 0===i&&(i=new Int32Array(n),Ms[n]=i);for(let t=0;t!==n;++t)i[t]=e.allocateTextureUnit();return i}function Cs(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function Ps(t,e){const n=this.cache;void 0!==e.x?n[0]===e.x&&n[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y):As(n,e)||(t.uniform2fv(this.addr,e),Es(n,e))}function Ds(t,e){const n=this.cache;void 0!==e.x?n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z):void 0!==e.r?n[0]===e.r&&n[1]===e.g&&n[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b):As(n,e)||(t.uniform3fv(this.addr,e),Es(n,e))}function Rs(t,e){const n=this.cache;void 0!==e.x?n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w):As(n,e)||(t.uniform4fv(this.addr,e),Es(n,e))}function Ns(t,e){var n=this.cache,i=e.elements;void 0===i?As(n,e)||(t.uniformMatrix2fv(this.addr,!1,e),Es(n,e)):As(n,i)||(ws.set(i),t.uniformMatrix2fv(this.addr,!1,ws),Es(n,i))}function Is(t,e){var n=this.cache,i=e.elements;void 0===i?As(n,e)||(t.uniformMatrix3fv(this.addr,!1,e),Es(n,e)):As(n,i)||(Ss.set(i),t.uniformMatrix3fv(this.addr,!1,Ss),Es(n,i))}function Os(t,e){var n=this.cache,i=e.elements;void 0===i?As(n,e)||(t.uniformMatrix4fv(this.addr,!1,e),Es(n,e)):As(n,i)||(bs.set(i),t.uniformMatrix4fv(this.addr,!1,bs),Es(n,i))}function zs(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function Us(t,e){var n=this.cache;As(n,e)||(t.uniform2iv(this.addr,e),Es(n,e))}function Fs(t,e){var n=this.cache;As(n,e)||(t.uniform3iv(this.addr,e),Es(n,e))}function Bs(t,e){var n=this.cache;As(n,e)||(t.uniform4iv(this.addr,e),Es(n,e))}function ks(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function Vs(t,e){var n=this.cache;As(n,e)||(t.uniform2uiv(this.addr,e),Es(n,e))}function Gs(t,e){var n=this.cache;As(n,e)||(t.uniform3uiv(this.addr,e),Es(n,e))}function Hs(t,e){var n=this.cache;As(n,e)||(t.uniform4uiv(this.addr,e),Es(n,e))}function Ws(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.safeSetTexture2D(e||gs,r)}function js(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(e||xs,r)}function Xs(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.safeSetTextureCube(e||ys,r)}function qs(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(e||vs,r)}function Ys(t,e){t.uniform1fv(this.addr,e)}function Zs(t,e){e=Ts(e,this.size,2);t.uniform2fv(this.addr,e)}function Js(t,e){e=Ts(e,this.size,3);t.uniform3fv(this.addr,e)}function Ks(t,e){e=Ts(e,this.size,4);t.uniform4fv(this.addr,e)}function Qs(t,e){e=Ts(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,e)}function $s(t,e){e=Ts(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,e)}function ta(t,e){e=Ts(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,e)}function ea(t,e){t.uniform1iv(this.addr,e)}function na(t,e){t.uniform2iv(this.addr,e)}function ia(t,e){t.uniform3iv(this.addr,e)}function ra(t,e){t.uniform4iv(this.addr,e)}function sa(t,e){t.uniform1uiv(this.addr,e)}function aa(t,e){t.uniform2uiv(this.addr,e)}function oa(t,e){t.uniform3uiv(this.addr,e)}function la(t,e){t.uniform4uiv(this.addr,e)}function ca(t,e,n){var i=e.length,r=Ls(n,i);t.uniform1iv(this.addr,r);for(let t=0;t!==i;++t)n.safeSetTexture2D(e[t]||gs,r[t])}function ha(t,e,n){var i=e.length,r=Ls(n,i);t.uniform1iv(this.addr,r);for(let t=0;t!==i;++t)n.setTexture3D(e[t]||xs,r[t])}function ua(t,e,n){var i=e.length,r=Ls(n,i);t.uniform1iv(this.addr,r);for(let t=0;t!==i;++t)n.safeSetTextureCube(e[t]||ys,r[t])}function da(t,e,n){var i=e.length,r=Ls(n,i);t.uniform1iv(this.addr,r);for(let t=0;t!==i;++t)n.setTexture2DArray(e[t]||vs,r[t])}function pa(t,e,n){this.id=t,this.addr=n,this.cache=[],this.setValue=function(t){switch(t){case 5126:return Cs;case 35664:return Ps;case 35665:return Ds;case 35666:return Rs;case 35674:return Ns;case 35675:return Is;case 35676:return Os;case 5124:case 35670:return zs;case 35667:case 35671:return Us;case 35668:case 35672:return Fs;case 35669:case 35673:return Bs;case 5125:return ks;case 36294:return Vs;case 36295:return Gs;case 36296:return Hs;case 35678:case 36198:case 36298:case 36306:case 35682:return Ws;case 35679:case 36299:case 36307:return js;case 35680:case 36300:case 36308:case 36293:return Xs;case 36289:case 36303:case 36311:case 36292:return qs}}(e.type)}function fa(t,e,n){this.id=t,this.addr=n,this.cache=[],this.size=e.size,this.setValue=function(t){switch(t){case 5126:return Ys;case 35664:return Zs;case 35665:return Js;case 35666:return Ks;case 35674:return Qs;case 35675:return $s;case 35676:return ta;case 5124:case 35670:return ea;case 35667:case 35671:return na;case 35668:case 35672:return ia;case 35669:case 35673:return ra;case 5125:return sa;case 36294:return aa;case 36295:return oa;case 36296:return la;case 35678:case 36198:case 36298:case 36306:case 35682:return ca;case 35679:case 36299:case 36307:return ha;case 35680:case 36300:case 36308:case 36293:return ua;case 36289:case 36303:case 36311:case 36292:return da}}(e.type)}function ma(t){this.id=t,this.seq=[],this.map={}}fa.prototype.updateCache=function(t){var e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),Es(e,t)},ma.prototype.setValue=function(n,i,r){var s=this.seq;for(let t=0,e=s.length;t!==e;++t){const a=s[t];a.setValue(n,i[a.id],r)}};const ga=/(\w+)(\])?(\[|\.)?/g;function va(t,e){t.seq.push(e),t.map[e.id]=e}function xa(e,n){this.seq=[],this.map={};const i=e.getProgramParameter(n,35718);for(let t=0;t<i;++t){const i=e.getActiveUniform(n,t),r=e.getUniformLocation(n,i.name);!function(n,t,i){var r=n.name,s=r.length;for(ga.lastIndex=0;;){var a=ga.exec(r),o=ga.lastIndex;let e=a[1];var l="]"===a[2],a=a[3];if(l&&(e|=0),void 0===a||"["===a&&o+2===s){va(i,new(void 0===a?pa:fa)(e,n,t));break}{const n=i.map;let t=n[e];void 0===t&&(t=new ma(e),va(i,t)),i=t}}}(i,r,this)}}function ya(t,e,n){e=t.createShader(e);return t.shaderSource(e,n),t.compileShader(e),e}xa.prototype.setValue=function(t,e,n,i){const r=this.map[e];void 0!==r&&r.setValue(t,n,i)},xa.prototype.setOptional=function(t,e,n){e=e[n];void 0!==e&&this.setValue(t,n,e)},xa.upload=function(n,i,r,s){for(let t=0,e=i.length;t!==e;++t){const a=i[t],o=r[a.id];!1!==o.needsUpdate&&a.setValue(n,o.value,s)}},xa.seqWithValue=function(n,i){const r=[];for(let t=0,e=n.length;t!==e;++t){var s=n[t];s.id in i&&r.push(s)}return r};let _a=0;function Ma(t){switch(t){case Se:return["Linear","( value )"];case we:return["sRGB","( value )"];default:return["Linear","( value )"]}}function ba(t,e,n){var i=t.getShaderParameter(e,35713),r=t.getShaderInfoLog(e).trim();return i&&""===r?"":n.toUpperCase()+"\n\n"+r+"\n\n"+function(t){const e=t.split("\n");for(let t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join("\n")}(t.getShaderSource(e))}function Sa(t,e){e=Ma(e);return"vec4 "+t+"( vec4 value ) { return "+e[0]+"ToLinear"+e[1]+"; }"}function wa(t){return""!==t}function Ta(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Aa(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Ea=/^[ \t]*#include +<([\w\d./]+)>/gm;function La(t){return t.replace(Ea,Ca)}function Ca(t,e){var n=Er[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return La(n)}const Pa=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Da=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Ra(t){return t.replace(Da,Ia).replace(Pa,Na)}function Na(t,e,n,i){return Ia(0,e,n,i)}function Ia(t,e,n,i){let r="";for(let t=parseInt(e);t<parseInt(n);t++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return r}function Oa(t){let e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function za(n,i,r,t){const s=n.getContext(),e=r.defines;var a,o,l=r.vertexShader,c=r.fragmentShader;const h=function(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===T?e="SHADOWMAP_TYPE_PCF":2===t.shadowMapType?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===A&&(e="SHADOWMAP_TYPE_VSM"),e}(r),u=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case b:case S:e="ENVMAP_TYPE_CUBE";break;case P:case D:e="ENVMAP_TYPE_CUBE_UV"}return e}(r),d=function(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case S:case D:e="ENVMAP_MODE_REFRACTION"}return e}(r),p=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case 0:e="ENVMAP_BLENDING_MULTIPLY";break;case 1:e="ENVMAP_BLENDING_MIX";break;case 2:e="ENVMAP_BLENDING_ADD"}return e}(r),f=r.isWebGL2?"":function(t){const e=[t.extensionDerivatives||t.envMapCubeUV||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap||t.transmission)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""];return e.filter(wa).join("\n")}(r),m=function(t){const e=[];for(const i in t){var n=t[i];!1!==n&&e.push("#define "+i+" "+n)}return e.join("\n")}(e),g=s.createProgram();let v,x,y=r.glslVersion?"#version "+r.glslVersion+"\n":"";r.isRawShaderMaterial?(v=[m].filter(wa).join("\n"),0<v.length&&(v+="\n"),x=[f,m].filter(wa).join("\n"),0<x.length&&(x+="\n")):(v=[Oa(r),"#define SHADER_NAME "+r.shaderName,m,r.instancing?"#define USE_INSTANCING":"",r.instancingColor?"#define USE_INSTANCING_COLOR":"",r.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define MAX_BONES "+r.maxBones,r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+d:"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.normalMap&&r.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",r.normalMap&&r.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",r.clearcoatMap?"#define USE_CLEARCOATMAP":"",r.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",r.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",r.displacementMap&&r.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",r.specularColorMap?"#define USE_SPECULARCOLORMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.transmission?"#define USE_TRANSMISSION":"",r.transmissionMap?"#define USE_TRANSMISSIONMAP":"",r.thicknessMap?"#define USE_THICKNESSMAP":"",r.sheenColorMap?"#define USE_SHEENCOLORMAP":"",r.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",r.vertexTangents?"#define USE_TANGENT":"",r.vertexColors?"#define USE_COLOR":"",r.vertexAlphas?"#define USE_COLOR_ALPHA":"",r.vertexUvs?"#define USE_UV":"",r.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",r.flatShading?"#define FLAT_SHADED":"",r.skinning?"#define USE_SKINNING":"",r.useVertexTexture?"#define BONE_TEXTURE":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.morphNormals&&!1===r.flatShading?"#define USE_MORPHNORMALS":"",r.morphTargets&&r.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",r.morphTargets&&r.isWebGL2?"#define MORPHTARGETS_COUNT "+r.morphTargetsCount:"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"",r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+h:"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.logarithmicDepthBuffer&&r.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(wa).join("\n"),x=[f,Oa(r),"#define SHADER_NAME "+r.shaderName,m,r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.matcap?"#define USE_MATCAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+u:"",r.envMap?"#define "+d:"",r.envMap?"#define "+p:"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.normalMap&&r.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",r.normalMap&&r.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",r.clearcoat?"#define USE_CLEARCOAT":"",r.clearcoatMap?"#define USE_CLEARCOATMAP":"",r.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",r.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",r.specularColorMap?"#define USE_SPECULARCOLORMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.alphaTest?"#define USE_ALPHATEST":"",r.sheen?"#define USE_SHEEN":"",r.sheenColorMap?"#define USE_SHEENCOLORMAP":"",r.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",r.transmission?"#define USE_TRANSMISSION":"",r.transmissionMap?"#define USE_TRANSMISSIONMAP":"",r.thicknessMap?"#define USE_THICKNESSMAP":"",r.vertexTangents?"#define USE_TANGENT":"",r.vertexColors||r.instancingColor?"#define USE_COLOR":"",r.vertexAlphas?"#define USE_COLOR_ALPHA":"",r.vertexUvs?"#define USE_UV":"",r.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",r.gradientMap?"#define USE_GRADIENTMAP":"",r.flatShading?"#define FLAT_SHADED":"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"",r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+h:"",r.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",r.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.logarithmicDepthBuffer&&r.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(r.extensionShaderTextureLOD||r.envMap)&&r.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",r.toneMapping!==Pt?"#define TONE_MAPPING":"",r.toneMapping!==Pt?Er.tonemapping_pars_fragment:"",r.toneMapping!==Pt?function(t,e){let n;switch(e){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="OptimizedCineon";break;case 4:n="ACESFilmic";break;case 5:n="Custom";break;default:n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}("toneMapping",r.toneMapping):"",r.dithering?"#define DITHERING":"",r.format===kt?"#define OPAQUE":"",Er.encodings_pars_fragment,r.map?Sa("mapTexelToLinear",r.mapEncoding):"",r.matcap?Sa("matcapTexelToLinear",r.matcapEncoding):"",r.envMap?Sa("envMapTexelToLinear",r.envMapEncoding):"",r.emissiveMap?Sa("emissiveMapTexelToLinear",r.emissiveMapEncoding):"",r.specularColorMap?Sa("specularColorMapTexelToLinear",r.specularColorMapEncoding):"",r.sheenColorMap?Sa("sheenColorMapTexelToLinear",r.sheenColorMapEncoding):"",r.lightMap?Sa("lightMapTexelToLinear",r.lightMapEncoding):"",(a="linearToOutputTexel",o=Ma(o=r.outputEncoding),"vec4 "+a+"( vec4 value ) { return LinearTo"+o[0]+o[1]+"; }"),r.depthPacking?"#define DEPTH_PACKING "+r.depthPacking:"","\n"].filter(wa).join("\n")),l=Aa(Ta(La(l),r),r),c=Aa(Ta(La(c),r),r),l=Ra(l),c=Ra(c),r.isWebGL2&&!0!==r.isRawShaderMaterial&&(y="#version 300 es\n",v=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+v,x=["#define varying in",r.glslVersion===Pe?"":"layout(location = 0) out highp vec4 pc_fragColor;",r.glslVersion===Pe?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+x);l=y+v+l,c=y+x+c,l=ya(s,35633,l),c=ya(s,35632,c);if(s.attachShader(g,l),s.attachShader(g,c),void 0!==r.index0AttributeName?s.bindAttribLocation(g,0,r.index0AttributeName):!0===r.morphTargets&&s.bindAttribLocation(g,0,"position"),s.linkProgram(g),n.debug.checkShaderErrors){const n=s.getProgramInfoLog(g).trim(),i=s.getShaderInfoLog(l).trim(),r=s.getShaderInfoLog(c).trim();let t=!0,e=!0;if(!1===s.getProgramParameter(g,35714)){t=!1;const i=ba(s,l,"vertex"),r=ba(s,c,"fragment")}else""===n&&(""!==i&&""!==r||(e=!1));e&&(this.diagnostics={runnable:t,programLog:n,vertexShader:{log:i,prefix:v},fragmentShader:{log:r,prefix:x}})}let _,M;return s.deleteShader(l),s.deleteShader(c),this.getUniforms=function(){return void 0===_&&(_=new xa(s,g)),_},this.getAttributes=function(){return void 0===M&&(M=function(n,i){const r={},s=n.getProgramParameter(i,35721);for(let e=0;e<s;e++){const s=n.getActiveAttrib(i,e),a=s.name;let t=1;35674===s.type&&(t=2),35675===s.type&&(t=3),35676===s.type&&(t=4),r[a]={type:s.type,location:n.getAttribLocation(i,a),locationSize:t}}return r}(s,g)),M},this.destroy=function(){t.releaseStatesOfProgram(this),s.deleteProgram(g),this.program=void 0},this.name=r.shaderName,this.id=_a++,this.cacheKey=i,this.usedTimes=1,this.program=g,this.vertexShader=l,this.fragmentShader=c,this}let Ua=0;class Fa{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,n=t.fragmentShader,i=this._getShaderStage(e),r=this._getShaderStage(n),s=this._getShaderCacheForMaterial(t);return!1===s.has(i)&&(s.add(i),i.usedTimes++),!1===s.has(r)&&(s.add(r),r.usedTimes++),this}remove(t){for(const e of this.materialCache.get(t))e.usedTimes--,0===e.usedTimes&&this.shaderCache.delete(e);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;return!1===e.has(t)&&e.set(t,new Set),e.get(t)}_getShaderStage(t){const e=this.shaderCache;var n;return!1===e.has(t)&&(n=new Ba,e.set(t,n)),e.get(t)}}class Ba{constructor(){this.id=Ua++,this.usedTimes=0}}function ka(m,g,v,x,y,t,_){const r=new Xn,M=new Fa,s=[],b=y.isWebGL2,S=y.logarithmicDepthBuffer,w=y.floatVertexTextures,T=y.maxVertexUniforms,A=y.vertexTextures;let E=y.precision;const L={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function C(t){let e;return e=t&&t.isTexture?t.encoding:t&&t.isWebGLRenderTarget?t.texture.encoding:Se,b&&t&&t.isTexture&&t.format===Vt&&t.type===It&&t.encoding===we&&(e=Se),e}return{getParameters:function(t,e,n,i,r){var s=i.fog,a=t.isMeshStandardMaterial?i.environment:null,o=(t.isMeshStandardMaterial?v:g).get(t.envMap||a),l=L[t.type],c=r.isSkinnedMesh?function(t){const e=t.skeleton,n=e.bones;if(w)return 1024;{const t=T,e=Math.floor((t-20)/4),i=Math.min(e,n.length);return i<n.length?0:i}}(r):0;let h,u,d,p;if(null!==t.precision&&(E=y.getMaxPrecision(t.precision),E,t.precision),l){const m=Cr[l];h=m.vertexShader,u=m.fragmentShader}else h=t.vertexShader,u=t.fragmentShader,M.update(t),d=M.getVertexShaderID(t),p=M.getFragmentShaderID(t);var f=m.getRenderTarget(),i=0<t.alphaTest,a=0<t.clearcoat;return{isWebGL2:b,shaderID:l,shaderName:t.type,vertexShader:h,fragmentShader:u,defines:t.defines,customVertexShaderID:d,customFragmentShaderID:p,isRawShaderMaterial:!0===t.isRawShaderMaterial,glslVersion:t.glslVersion,precision:E,instancing:!0===r.isInstancedMesh,instancingColor:!0===r.isInstancedMesh&&null!==r.instanceColor,supportsVertexTextures:A,outputEncoding:null!==f?C(f.texture):m.outputEncoding,map:!!t.map,mapEncoding:C(t.map),matcap:!!t.matcap,matcapEncoding:C(t.matcap),envMap:!!o,envMapMode:o&&o.mapping,envMapEncoding:C(o),envMapCubeUV:!!o&&(o.mapping===P||o.mapping===D),lightMap:!!t.lightMap,lightMapEncoding:C(t.lightMap),aoMap:!!t.aoMap,emissiveMap:!!t.emissiveMap,emissiveMapEncoding:C(t.emissiveMap),bumpMap:!!t.bumpMap,normalMap:!!t.normalMap,objectSpaceNormalMap:t.normalMapType===Ee,tangentSpaceNormalMap:t.normalMapType===Ae,clearcoat:a,clearcoatMap:a&&!!t.clearcoatMap,clearcoatRoughnessMap:a&&!!t.clearcoatRoughnessMap,clearcoatNormalMap:a&&!!t.clearcoatNormalMap,displacementMap:!!t.displacementMap,roughnessMap:!!t.roughnessMap,metalnessMap:!!t.metalnessMap,specularMap:!!t.specularMap,specularIntensityMap:!!t.specularIntensityMap,specularColorMap:!!t.specularColorMap,specularColorMapEncoding:C(t.specularColorMap),alphaMap:!!t.alphaMap,alphaTest:i,gradientMap:!!t.gradientMap,sheen:0<t.sheen,sheenColorMap:!!t.sheenColorMap,sheenColorMapEncoding:C(t.sheenColorMap),sheenRoughnessMap:!!t.sheenRoughnessMap,transmission:0<t.transmission,transmissionMap:!!t.transmissionMap,thicknessMap:!!t.thicknessMap,combine:t.combine,vertexTangents:!!t.normalMap&&!!r.geometry&&!!r.geometry.attributes.tangent,vertexColors:t.vertexColors,vertexAlphas:!0===t.vertexColors&&!!r.geometry&&!!r.geometry.attributes.color&&4===r.geometry.attributes.color.itemSize,vertexUvs:!!(t.map||t.bumpMap||t.normalMap||t.specularMap||t.alphaMap||t.emissiveMap||t.roughnessMap||t.metalnessMap||t.clearcoatMap||t.clearcoatRoughnessMap||t.clearcoatNormalMap||t.displacementMap||t.transmissionMap||t.thicknessMap||t.specularIntensityMap||t.specularColorMap||t.sheenColorMap||t.sheenRoughnessMap),uvsVertexOnly:!(t.map||t.bumpMap||t.normalMap||t.specularMap||t.alphaMap||t.emissiveMap||t.roughnessMap||t.metalnessMap||t.clearcoatNormalMap||0<t.transmission||t.transmissionMap||t.thicknessMap||t.specularIntensityMap||t.specularColorMap||0<t.sheen||t.sheenColorMap||t.sheenRoughnessMap||!t.displacementMap),fog:!!s,useFog:t.fog,fogExp2:s&&s.isFogExp2,flatShading:!!t.flatShading,sizeAttenuation:t.sizeAttenuation,logarithmicDepthBuffer:S,skinning:!0===r.isSkinnedMesh&&0<c,maxBones:c,useVertexTexture:w,morphTargets:!!r.geometry&&!!r.geometry.morphAttributes.position,morphNormals:!!r.geometry&&!!r.geometry.morphAttributes.normal,morphTargetsCount:r.geometry&&r.geometry.morphAttributes.position?r.geometry.morphAttributes.position.length:0,numDirLights:e.directional.length,numPointLights:e.point.length,numSpotLights:e.spot.length,numRectAreaLights:e.rectArea.length,numHemiLights:e.hemi.length,numDirLightShadows:e.directionalShadowMap.length,numPointLightShadows:e.pointShadowMap.length,numSpotLightShadows:e.spotShadowMap.length,numClippingPlanes:_.numPlanes,numClipIntersection:_.numIntersection,format:t.format,dithering:t.dithering,shadowMapEnabled:m.shadowMap.enabled&&0<n.length,shadowMapType:m.shadowMap.type,toneMapping:t.toneMapped?m.toneMapping:Pt,physicallyCorrectLights:m.physicallyCorrectLights,premultipliedAlpha:t.premultipliedAlpha,doubleSided:t.side===Ct,flipSided:t.side===Lt,depthPacking:void 0!==t.depthPacking&&t.depthPacking,index0AttributeName:t.index0AttributeName,extensionDerivatives:t.extensions&&t.extensions.derivatives,extensionFragDepth:t.extensions&&t.extensions.fragDepth,extensionDrawBuffers:t.extensions&&t.extensions.drawBuffers,extensionShaderTextureLOD:t.extensions&&t.extensions.shaderTextureLOD,rendererExtensionFragDepth:b||x.has("EXT_frag_depth"),rendererExtensionDrawBuffers:b||x.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:b||x.has("EXT_shader_texture_lod"),customProgramCacheKey:t.customProgramCacheKey()}},getProgramCacheKey:function(t){const e=[];if(t.shaderID?e.push(t.shaderID):(e.push(t.customVertexShaderID),e.push(t.customFragmentShaderID)),void 0!==t.defines)for(const m in t.defines)e.push(m),e.push(t.defines[m]);return!1===t.isRawShaderMaterial&&(n=e,i=t,n.push(i.precision),n.push(i.outputEncoding),n.push(i.mapEncoding),n.push(i.matcapEncoding),n.push(i.envMapMode),n.push(i.envMapEncoding),n.push(i.lightMapEncoding),n.push(i.emissiveMapEncoding),n.push(i.combine),n.push(i.vertexUvs),n.push(i.fogExp2),n.push(i.sizeAttenuation),n.push(i.maxBones),n.push(i.morphTargetsCount),n.push(i.numDirLights),n.push(i.numPointLights),n.push(i.numSpotLights),n.push(i.numHemiLights),n.push(i.numRectAreaLights),n.push(i.numDirLightShadows),n.push(i.numPointLightShadows),n.push(i.numSpotLightShadows),n.push(i.shadowMapType),n.push(i.toneMapping),n.push(i.numClippingPlanes),n.push(i.numClipIntersection),n.push(i.format),n.push(i.specularColorMapEncoding),n.push(i.sheenColorMapEncoding),n=e,i=t,r.disableAll(),i.isWebGL2&&r.enable(0),i.supportsVertexTextures&&r.enable(1),i.instancing&&r.enable(2),i.instancingColor&&r.enable(3),i.map&&r.enable(4),i.matcap&&r.enable(5),i.envMap&&r.enable(6),i.envMapCubeUV&&r.enable(7),i.lightMap&&r.enable(8),i.aoMap&&r.enable(9),i.emissiveMap&&r.enable(10),i.bumpMap&&r.enable(11),i.normalMap&&r.enable(12),i.objectSpaceNormalMap&&r.enable(13),i.tangentSpaceNormalMap&&r.enable(14),i.clearcoat&&r.enable(15),i.clearcoatMap&&r.enable(16),i.clearcoatRoughnessMap&&r.enable(17),i.clearcoatNormalMap&&r.enable(18),i.displacementMap&&r.enable(19),i.specularMap&&r.enable(20),i.roughnessMap&&r.enable(21),i.metalnessMap&&r.enable(22),i.gradientMap&&r.enable(23),i.alphaMap&&r.enable(24),i.alphaTest&&r.enable(25),i.vertexColors&&r.enable(26),i.vertexAlphas&&r.enable(27),i.vertexUvs&&r.enable(28),i.vertexTangents&&r.enable(29),i.uvsVertexOnly&&r.enable(30),i.fog&&r.enable(31),n.push(r.mask),r.disableAll(),i.useFog&&r.enable(0),i.flatShading&&r.enable(1),i.logarithmicDepthBuffer&&r.enable(2),i.skinning&&r.enable(3),i.useVertexTexture&&r.enable(4),i.morphTargets&&r.enable(5),i.morphNormals&&r.enable(6),i.premultipliedAlpha&&r.enable(7),i.shadowMapEnabled&&r.enable(8),i.physicallyCorrectLights&&r.enable(9),i.doubleSided&&r.enable(10),i.flipSided&&r.enable(11),i.depthPacking&&r.enable(12),i.dithering&&r.enable(13),i.specularIntensityMap&&r.enable(14),i.specularColorMap&&r.enable(15),i.transmission&&r.enable(16),i.transmissionMap&&r.enable(17),i.thicknessMap&&r.enable(18),i.sheen&&r.enable(19),i.sheenColorMap&&r.enable(20),i.sheenRoughnessMap&&r.enable(21),n.push(r.mask),e.push(m.outputEncoding)),e.push(t.customProgramCacheKey),e.join();var n,i},getUniforms:function(t){var e=L[t.type];let n;if(e){const t=Cr[e];n=hr.clone(t.uniforms)}else n=t.uniforms;return n},acquireProgram:function(n,i){let r;for(let t=0,e=s.length;t<e;t++){const n=s[t];if(n.cacheKey===i){r=n,++r.usedTimes;break}}return void 0===r&&(r=new za(m,i,n,t),s.push(r)),r},releaseProgram:function(t){var e;0==--t.usedTimes&&(e=s.indexOf(t),s[e]=s[s.length-1],s.pop(),t.destroy())},releaseShaderCache:function(t){M.remove(t)},programs:s,dispose:function(){M.dispose()}}}function Va(){let i=new WeakMap;return{get:function(t){let e=i.get(t);return void 0===e&&(e={},i.set(t,e)),e},remove:function(t){i.delete(t)},update:function(t,e,n){i.get(t)[e]=n},dispose:function(){i=new WeakMap}}}function Ga(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function Ha(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Wa(){const o=[];let l=0;const a=[],c=[],h=[];function u(t,e,n,i,r,s){let a=o[l];return void 0===a?(a={id:t.id,object:t,geometry:e,material:n,groupOrder:i,renderOrder:t.renderOrder,z:r,group:s},o[l]=a):(a.id=t.id,a.object=t,a.geometry=e,a.material=n,a.groupOrder=i,a.renderOrder=t.renderOrder,a.z=r,a.group=s),l++,a}return{opaque:a,transmissive:c,transparent:h,init:function(){l=0,a.length=0,c.length=0,h.length=0},push:function(t,e,n,i,r,s){s=u(t,e,n,i,r,s),(0<n.transmission?c:!0===n.transparent?h:a).push(s)},unshift:function(t,e,n,i,r,s){s=u(t,e,n,i,r,s),(0<n.transmission?c:!0===n.transparent?h:a).unshift(s)},finish:function(){for(let t=l,e=o.length;t<e;t++){const l=o[t];if(null===l.id)break;l.id=null,l.object=null,l.geometry=null,l.material=null,l.group=null}},sort:function(t,e){1<a.length&&a.sort(t||Ga),1<c.length&&c.sort(e||Ha),1<h.length&&h.sort(e||Ha)}}}function ja(){let i=new WeakMap;return{get:function(t,e){let n;return!1===i.has(t)?(n=new Wa,i.set(t,[n])):e>=i.get(t).length?(n=new Wa,i.get(t).push(n)):n=i.get(t)[e],n},dispose:function(){i=new WeakMap}}}function Xa(){const n={};return{get:function(t){if(void 0!==n[t.id])return n[t.id];let e;switch(t.type){case"DirectionalLight":e={direction:new rn,color:new Ai};break;case"SpotLight":e={position:new rn,direction:new rn,color:new Ai,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new rn,color:new Ai,distance:0,decay:0};break;case"HemisphereLight":e={direction:new rn,skyColor:new Ai,groundColor:new Ai};break;case"RectAreaLight":e={color:new Ai,position:new rn,halfWidth:new rn,halfHeight:new rn}}return n[t.id]=e,e}}}let qa=0;function Ya(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function Za(y,_){const M=new Xa,b=function(){const n={};return{get:function(t){if(void 0!==n[t.id])return n[t.id];let e;switch(t.type){case"DirectionalLight":case"SpotLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new We};break;case"PointLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new We,shadowCameraNear:1,shadowCameraFar:1e3}}return n[t.id]=e,e}}}(),S={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let t=0;t<9;t++)S.probe.push(new rn);const h=new rn,u=new On,d=new On;return{setup:function(n,i){let r=0,s=0,a=0;for(let t=0;t<9;t++)S.probe[t].set(0,0,0);let o=0,l=0,c=0,h=0,u=0,d=0,p=0,f=0;n.sort(Ya);var m=!0!==i?Math.PI:1;for(let t=0,e=n.length;t<e;t++){const _=n[t],i=_.color,g=_.intensity,v=_.distance,x=_.shadow&&_.shadow.map?_.shadow.map.texture:null;if(_.isAmbientLight)r+=i.r*g*m,s+=i.g*g*m,a+=i.b*g*m;else if(_.isLightProbe)for(let t=0;t<9;t++)S.probe[t].addScaledVector(_.sh.coefficients[t],g);else if(_.isDirectionalLight){const y=M.get(_);if(y.color.copy(_.color).multiplyScalar(_.intensity*m),_.castShadow){const y=_.shadow,M=b.get(_);M.shadowBias=y.bias,M.shadowNormalBias=y.normalBias,M.shadowRadius=y.radius,M.shadowMapSize=y.mapSize,S.directionalShadow[o]=M,S.directionalShadowMap[o]=x,S.directionalShadowMatrix[o]=_.shadow.matrix,d++}S.directional[o]=y,o++}else if(_.isSpotLight){const y=M.get(_);if(y.position.setFromMatrixPosition(_.matrixWorld),y.color.copy(i).multiplyScalar(g*m),y.distance=v,y.coneCos=Math.cos(_.angle),y.penumbraCos=Math.cos(_.angle*(1-_.penumbra)),y.decay=_.decay,_.castShadow){const y=_.shadow,M=b.get(_);M.shadowBias=y.bias,M.shadowNormalBias=y.normalBias,M.shadowRadius=y.radius,M.shadowMapSize=y.mapSize,S.spotShadow[c]=M,S.spotShadowMap[c]=x,S.spotShadowMatrix[c]=_.shadow.matrix,f++}S.spot[c]=y,c++}else if(_.isRectAreaLight){const y=M.get(_);y.color.copy(i).multiplyScalar(g),y.halfWidth.set(.5*_.width,0,0),y.halfHeight.set(0,.5*_.height,0),S.rectArea[h]=y,h++}else if(_.isPointLight){const y=M.get(_);if(y.color.copy(_.color).multiplyScalar(_.intensity*m),y.distance=_.distance,y.decay=_.decay,_.castShadow){const y=_.shadow,M=b.get(_);M.shadowBias=y.bias,M.shadowNormalBias=y.normalBias,M.shadowRadius=y.radius,M.shadowMapSize=y.mapSize,M.shadowCameraNear=y.camera.near,M.shadowCameraFar=y.camera.far,S.pointShadow[l]=M,S.pointShadowMap[l]=x,S.pointShadowMatrix[l]=_.shadow.matrix,p++}S.point[l]=y,l++}else if(_.isHemisphereLight){const y=M.get(_);y.skyColor.copy(_.color).multiplyScalar(g*m),y.groundColor.copy(_.groundColor).multiplyScalar(g*m),S.hemi[u]=y,u++}}0<h&&(_.isWebGL2||!0===y.has("OES_texture_float_linear")?(S.rectAreaLTC1=Lr.LTC_FLOAT_1,S.rectAreaLTC2=Lr.LTC_FLOAT_2):!0===y.has("OES_texture_half_float_linear")&&(S.rectAreaLTC1=Lr.LTC_HALF_1,S.rectAreaLTC2=Lr.LTC_HALF_2)),S.ambient[0]=r,S.ambient[1]=s,S.ambient[2]=a;const g=S.hash;g.directionalLength===o&&g.pointLength===l&&g.spotLength===c&&g.rectAreaLength===h&&g.hemiLength===u&&g.numDirectionalShadows===d&&g.numPointShadows===p&&g.numSpotShadows===f||(S.directional.length=o,S.spot.length=c,S.rectArea.length=h,S.point.length=l,S.hemi.length=u,S.directionalShadow.length=d,S.directionalShadowMap.length=d,S.pointShadow.length=p,S.pointShadowMap.length=p,S.spotShadow.length=f,S.spotShadowMap.length=f,S.directionalShadowMatrix.length=d,S.pointShadowMatrix.length=p,S.spotShadowMatrix.length=f,g.directionalLength=o,g.pointLength=l,g.spotLength=c,g.rectAreaLength=h,g.hemiLength=u,g.numDirectionalShadows=d,g.numPointShadows=p,g.numSpotShadows=f,S.version=qa++)},setupView:function(n,i){let r=0,s=0,a=0,o=0,l=0;var c=i.matrixWorldInverse;for(let t=0,e=n.length;t<e;t++){const i=n[t];if(i.isDirectionalLight){const n=S.directional[r];n.direction.setFromMatrixPosition(i.matrixWorld),h.setFromMatrixPosition(i.target.matrixWorld),n.direction.sub(h),n.direction.transformDirection(c),r++}else if(i.isSpotLight){const n=S.spot[a];n.position.setFromMatrixPosition(i.matrixWorld),n.position.applyMatrix4(c),n.direction.setFromMatrixPosition(i.matrixWorld),h.setFromMatrixPosition(i.target.matrixWorld),n.direction.sub(h),n.direction.transformDirection(c),a++}else if(i.isRectAreaLight){const n=S.rectArea[o];n.position.setFromMatrixPosition(i.matrixWorld),n.position.applyMatrix4(c),d.identity(),u.copy(i.matrixWorld),u.premultiply(c),d.extractRotation(u),n.halfWidth.set(.5*i.width,0,0),n.halfHeight.set(0,.5*i.height,0),n.halfWidth.applyMatrix4(d),n.halfHeight.applyMatrix4(d),o++}else if(i.isPointLight){const n=S.point[s];n.position.setFromMatrixPosition(i.matrixWorld),n.position.applyMatrix4(c),s++}else if(i.isHemisphereLight){const n=S.hemi[l];n.direction.setFromMatrixPosition(i.matrixWorld),n.direction.transformDirection(c),n.direction.normalize(),l++}}},state:S}}function Ja(t,e){const n=new Za(t,e),i=[],r=[];return{init:function(){i.length=0,r.length=0},state:{lightsArray:i,shadowsArray:r,lights:n},setupLights:function(t){n.setup(i,t)},setupLightsView:function(t){n.setupView(i,t)},pushLight:function(t){i.push(t)},pushShadow:function(t){r.push(t)}}}function Ka(i,r){let s=new WeakMap;return{get:function(t,e=0){let n;return!1===s.has(t)?(n=new Ja(i,r),s.set(t,[n])):e>=s.get(t).length?(n=new Ja(i,r),s.get(t).push(n)):n=s.get(t)[e],n},dispose:function(){s=new WeakMap}}}class Qa extends yi{constructor(t){super(),this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}Qa.prototype.isMeshDepthMaterial=!0;class $a extends yi{constructor(t){super(),this.type="MeshDistanceMaterial",this.referencePosition=new rn,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}$a.prototype.isMeshDistanceMaterial=!0;const to="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",eo="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}";function no(p,f,t){let m=new Sr;const g=new We,v=new We,x=new $e,c=new Qa({depthPacking:Te}),h=new $a,u={},y=t.maxTextureSize,d={0:Lt,1:Et,2:Ct},_=new ur({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new We},radius:{value:4}},vertexShader:to,fragmentShader:eo}),M=_.clone();M.defines.HORIZONTAL_PASS=1;const e=new Vi;e.setAttribute("position",new Pi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const b=new sr(e,_),S=this;function w(t,e,n,i,r,s,a){let o=null;t=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(o=void 0!==t?t:!0===i.isPointLight?h:c,p.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&0<n.alphaTest){const p=o.uuid,l=n.uuid;let t=u[p];void 0===t&&(t={},u[p]=t);let e=t[l];void 0===e&&(e=o.clone(),t[l]=e),o=e}return o.visible=n.visible,o.wireframe=n.wireframe,o.side=a===A?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:d[n.side],o.alphaMap=n.alphaMap,o.alphaTest=n.alphaTest,o.clipShadows=n.clipShadows,o.clippingPlanes=n.clippingPlanes,o.clipIntersection=n.clipIntersection,o.displacementMap=n.displacementMap,o.displacementScale=n.displacementScale,o.displacementBias=n.displacementBias,o.wireframeLinewidth=n.wireframeLinewidth,o.linewidth=n.linewidth,!0===i.isPointLight&&!0===o.isMeshDistanceMaterial&&(o.referencePosition.setFromMatrixPosition(i.matrixWorld),o.nearDistance=r,o.farDistance=s),o}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=T,this.render=function(n,i,r){if(!1!==S.enabled&&(!1!==S.autoUpdate||!1!==S.needsUpdate)&&0!==n.length){const c=p.getRenderTarget(),h=p.getActiveCubeFace(),u=p.getActiveMipmapLevel(),d=p.state;d.setBlending(Y),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(let t=0,e=n.length;t<e;t++){const c=n[t],h=c.shadow;if(void 0!==h&&(!1!==h.autoUpdate||!1!==h.needsUpdate)){g.copy(h.mapSize);const u=h.getFrameExtents();if(g.multiply(u),v.copy(h.mapSize),(g.x>y||g.y>y)&&(g.x>y&&(v.x=Math.floor(y/u.x),g.x=v.x*u.x,h.mapSize.x=v.x),g.y>y&&(v.y=Math.floor(y/u.y),g.y=v.y*u.y,h.mapSize.y=v.y)),null===h.map&&!h.isPointLightShadow&&this.type===A){const p={minFilter:wt,magFilter:wt,format:Vt};h.map=new tn(g.x,g.y,p),h.map.texture.name=c.name+".shadowMap",h.mapPass=new tn(g.x,g.y,p),h.camera.updateProjectionMatrix()}if(null===h.map){const p={minFilter:Rt,magFilter:Rt,format:Vt};h.map=new tn(g.x,g.y,p),h.map.texture.name=c.name+".shadowMap",h.camera.updateProjectionMatrix()}p.setRenderTarget(h.map),p.clear();var s=h.getViewportCount();for(let t=0;t<s;t++){const n=h.getViewport(t);x.set(v.x*n.x,v.y*n.y,v.x*n.z,v.y*n.w),d.viewport(x),h.updateMatrices(c,t),m=h.getFrustum(),function n(i,r,s,a,o){if(!1!==i.visible){if(i.layers.test(r.layers)&&(i.isMesh||i.isLine||i.isPoints)&&(i.castShadow||i.receiveShadow&&o===A)&&(!i.frustumCulled||m.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,i.matrixWorld);const m=f.update(i),r=i.material;if(Array.isArray(r)){const f=m.groups;for(let t=0,e=f.length;t<e;t++){const l=f[t],c=r[l.materialIndex];if(c&&c.visible){const f=w(i,m,c,a,s.near,s.far,o);p.renderBufferDirect(s,null,m,f,i,l)}}}else if(r.visible){const f=w(i,m,r,a,s.near,s.far,o);p.renderBufferDirect(s,null,m,f,i,null)}}const l=i.children;for(let t=0,e=l.length;t<e;t++)n(l[t],r,s,a,o)}}(i,r,h.camera,c,this.type)}h.isPointLightShadow||this.type!==A||(a=h,o=r,l=void 0,l=f.update(b),_.defines.VSM_SAMPLES!==a.blurSamples&&(_.defines.VSM_SAMPLES=a.blurSamples,M.defines.VSM_SAMPLES=a.blurSamples,_.needsUpdate=!0,M.needsUpdate=!0),_.uniforms.shadow_pass.value=a.map.texture,_.uniforms.resolution.value=a.mapSize,_.uniforms.radius.value=a.radius,p.setRenderTarget(a.mapPass),p.clear(),p.renderBufferDirect(o,null,l,_,b,null),M.uniforms.shadow_pass.value=a.mapPass.texture,M.uniforms.resolution.value=a.mapSize,M.uniforms.radius.value=a.radius,p.setRenderTarget(a.map),p.clear(),p.renderBufferDirect(o,null,l,M,b,null)),h.needsUpdate=!1}}var a,o,l;S.needsUpdate=!1,p.setRenderTarget(c,h,u)}}}function io(h,t,e){const n=e.isWebGL2;const i=new function(){let e=!1;const s=new $e;let n=null;const a=new $e(0,0,0,0);return{setMask:function(t){n===t||e||(h.colorMask(t,t,t,t),n=t)},setLocked:function(t){e=t},setClear:function(t,e,n,i,r){!0===r&&(t*=i,e*=i,n*=i),s.set(t,e,n,i),!1===a.equals(s)&&(h.clearColor(t,e,n,i),a.copy(s))},reset:function(){e=!1,n=null,a.set(-1,0,0,0)}}},r=new function(){let e=!1,n=null,i=null,r=null;return{setTest:function(t){(t?z:U)(2929)},setMask:function(t){n===t||e||(h.depthMask(t),n=t)},setFunc:function(t){if(i!==t){if(t)switch(t){case gt:h.depthFunc(512);break;case vt:h.depthFunc(519);break;case xt:h.depthFunc(513);break;case yt:h.depthFunc(515);break;case _t:h.depthFunc(514);break;case Mt:h.depthFunc(518);break;case bt:h.depthFunc(516);break;case St:h.depthFunc(517);break;default:h.depthFunc(515)}else h.depthFunc(515);i=t}},setLocked:function(t){e=t},setClear:function(t){r!==t&&(h.clearDepth(t),r=t)},reset:function(){e=!1,n=null,i=null,r=null}}},s=new function(){let e=!1,n=null,i=null,r=null,s=null,a=null,o=null,l=null,c=null;return{setTest:function(t){e||(t?z:U)(2960)},setMask:function(t){n===t||e||(h.stencilMask(t),n=t)},setFunc:function(t,e,n){i===t&&r===e&&s===n||(h.stencilFunc(t,e,n),i=t,r=e,s=n)},setOp:function(t,e,n){a===t&&o===e&&l===n||(h.stencilOp(t,e,n),a=t,o=e,l=n)},setLocked:function(t){e=t},setClear:function(t){c!==t&&(h.clearStencil(t),c=t)},reset:function(){e=!1,n=null,i=null,r=null,s=null,a=null,o=null,l=null,c=null}}};let a={},o={},l=null,c=!1,u=null,d=null,p=null,f=null,m=null,g=null,v=null,x=!1,y=null,_=null,M=null,b=null,S=null;const w=h.getParameter(35661);let T=!1,A=0;const E=h.getParameter(7938);-1!==E.indexOf("WebGL")?(A=parseFloat(/^WebGL (\d)/.exec(E)[1]),T=1<=A):-1!==E.indexOf("OpenGL ES")&&(A=parseFloat(/^OpenGL ES (\d)/.exec(E)[1]),T=2<=A);let L=null,C={};const P=h.getParameter(3088),D=h.getParameter(2978),R=(new $e).fromArray(P),N=(new $e).fromArray(D);function I(t,e,n){var i=new Uint8Array(4),r=h.createTexture();h.bindTexture(t,r),h.texParameteri(t,10241,9728),h.texParameteri(t,10240,9728);for(let t=0;t<n;t++)h.texImage2D(e+t,0,6408,1,1,0,6408,5121,i);return r}const O={};function z(t){!0!==a[t]&&(h.enable(t),a[t]=!0)}function U(t){!1!==a[t]&&(h.disable(t),a[t]=!1)}O[3553]=I(3553,3553,1),O[34067]=I(34067,34069,6),i.setClear(0,0,0,1),r.setClear(1),s.setClear(0),z(2929),r.setFunc(yt),V(!1),G(X),z(2884),k(Y);const F={[tt]:32774,[et]:32778,[nt]:32779};if(n)F[it]=32775,F[rt]=32776;else{const h=t.get("EXT_blend_minmax");null!==h&&(F[it]=h.MIN_EXT,F[rt]=h.MAX_EXT)}const B={[st]:0,[at]:1,[ot]:768,[ct]:770,[mt]:776,[pt]:774,[ut]:772,[lt]:769,[ht]:771,[ft]:775,[dt]:773};function k(t,e,n,i,r,s,a,o){if(t!==Y){if(!1===c&&(z(3042),c=!0),t===$)r=r||e,s=s||n,a=a||i,e===d&&r===m||(h.blendEquationSeparate(F[e],F[r]),d=e,m=r),n===p&&i===f&&s===g&&a===v||(h.blendFuncSeparate(B[n],B[i],B[s],B[a]),p=n,f=i,g=s,v=a),u=t,x=null;else if(t!==u||o!==x){if(d===tt&&m===tt||(h.blendEquation(32774),d=tt,m=tt),o)switch(t){case Z:h.blendFuncSeparate(1,771,1,771);break;case J:h.blendFunc(1,1);break;case K:h.blendFuncSeparate(0,0,769,771);break;case Q:h.blendFuncSeparate(0,768,0,770)}else switch(t){case Z:h.blendFuncSeparate(770,771,1,771);break;case J:h.blendFunc(770,1);break;case K:h.blendFunc(0,769);break;case Q:h.blendFunc(0,768)}p=null,f=null,g=null,v=null,u=t,x=o}}else!0===c&&(U(3042),c=!1)}function V(t){y!==t&&(t?h.frontFace(2304):h.frontFace(2305),y=t)}function G(t){t!==j?(z(2884),t!==_&&(t===X?h.cullFace(1029):t===q?h.cullFace(1028):h.cullFace(1032))):U(2884),_=t}function H(t,e,n){t?(z(32823),b===e&&S===n||(h.polygonOffset(e,n),b=e,S=n)):U(32823)}function W(t){void 0===t&&(t=33984+w-1),L!==t&&(h.activeTexture(t),L=t)}return{buffers:{color:i,depth:r,stencil:s},enable:z,disable:U,bindFramebuffer:function(t,e){return o[t]!==e&&(h.bindFramebuffer(t,e),o[t]=e,n&&(36009===t&&(o[36160]=e),36160===t&&(o[36009]=e)),!0)},useProgram:function(t){return l!==t&&(h.useProgram(t),l=t,!0)},setBlending:k,setMaterial:function(t,e){(t.side===Ct?U:z)(2884);let n=t.side===Lt;e&&(n=!n),V(n),t.blending===Z&&!1===t.transparent?k(Y):k(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),r.setFunc(t.depthFunc),r.setTest(t.depthTest),r.setMask(t.depthWrite),i.setMask(t.colorWrite),e=t.stencilWrite,s.setTest(e),e&&(s.setMask(t.stencilWriteMask),s.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),s.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),H(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),(!0===t.alphaToCoverage?z:U)(32926)},setFlipSided:V,setCullFace:G,setLineWidth:function(t){t!==M&&(T&&h.lineWidth(t),M=t)},setPolygonOffset:H,setScissorTest:function(t){(t?z:U)(3089)},activeTexture:W,bindTexture:function(t,e){null===L&&W();let n=C[L];void 0===n&&(n={type:void 0,texture:void 0},C[L]=n),n.type===t&&n.texture===e||(h.bindTexture(t,e||O[t]),n.type=t,n.texture=e)},unbindTexture:function(){const t=C[L];void 0!==t&&void 0!==t.type&&(h.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{h.compressedTexImage2D.apply(h,arguments)}catch(t){}},texImage2D:function(){try{h.texImage2D.apply(h,arguments)}catch(t){}},texImage3D:function(){try{h.texImage3D.apply(h,arguments)}catch(t){}},texStorage2D:function(){try{h.texStorage2D.apply(h,arguments)}catch(t){}},texStorage3D:function(){try{h.texStorage3D.apply(h,arguments)}catch(t){}},texSubImage2D:function(){try{h.texSubImage2D.apply(h,arguments)}catch(t){}},texSubImage3D:function(){try{h.texSubImage3D.apply(h,arguments)}catch(t){}},compressedTexSubImage2D:function(){try{h.compressedTexSubImage2D.apply(h,arguments)}catch(t){}},scissor:function(t){!1===R.equals(t)&&(h.scissor(t.x,t.y,t.z,t.w),R.copy(t))},viewport:function(t){!1===N.equals(t)&&(h.viewport(t.x,t.y,t.z,t.w),N.copy(t))},reset:function(){h.disable(3042),h.disable(2884),h.disable(2929),h.disable(32823),h.disable(3089),h.disable(2960),h.disable(32926),h.blendEquation(32774),h.blendFunc(1,0),h.blendFuncSeparate(1,0,1,0),h.colorMask(!0,!0,!0,!0),h.clearColor(0,0,0,0),h.depthMask(!0),h.depthFunc(513),h.clearDepth(1),h.stencilMask(4294967295),h.stencilFunc(519,0,4294967295),h.stencilOp(7680,7680,7680),h.clearStencil(0),h.cullFace(1029),h.frontFace(2305),h.polygonOffset(0,0),h.activeTexture(33984),h.bindFramebuffer(36160,null),!0===n&&(h.bindFramebuffer(36009,null),h.bindFramebuffer(36008,null)),h.useProgram(null),h.lineWidth(1),h.scissor(0,0,h.canvas.width,h.canvas.height),h.viewport(0,0,h.canvas.width,h.canvas.height),a={},L=null,C={},o={},l=null,c=!1,u=null,d=null,p=null,f=null,m=null,g=null,v=null,x=!1,y=null,_=null,M=null,b=null,S=null,R.set(0,0,h.canvas.width,h.canvas.height),N.set(0,0,h.canvas.width,h.canvas.height),i.reset(),r.reset(),s.reset()}}}function ro(m,s,g,l,c,v,h){const x=c.isWebGL2,e=c.maxTextures,y=c.maxCubemapSize,p=c.maxTextureSize,n=c.maxSamples,t=s.has("WEBGL_multisampled_render_to_texture"),u=t?s.get("WEBGL_multisampled_render_to_texture"):void 0,a=new WeakMap;let d,i=!1;try{i="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function f(t,e){return i?new OffscreenCanvas(t,e):qe("canvas")}function _(t,e,n,i){let r=1;if((t.width>i||t.height>i)&&(r=i/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const i=e?Ge:Math.floor,s=i(r*t.width),a=i(r*t.height);void 0===d&&(d=f(s,a));const o=n?f(s,a):d;o.width=s,o.height=a;const l=o.getContext("2d");return l.drawImage(t,0,0,s,a),o}return 0 in t,t}return t}function M(t){return ke(t.width)&&ke(t.height)}function b(t,e){return t.generateMipmaps&&e&&t.minFilter!==Rt&&t.minFilter!==wt}function S(t){m.generateMipmap(t)}function w(t,e,n,i){if(!1===x)return e;if(null!==t&&void 0!==m[t])return m[t];let r=e;return 6403===e&&(5126===n&&(r=33326),5131===n&&(r=33325),5121===n&&(r=33321)),6407===e&&(5126===n&&(r=34837),5131===n&&(r=34843),5121===n&&(r=32849)),6408===e&&(5126===n&&(r=34836),5131===n&&(r=34842),5121===n&&(r=i===we?35907:32856)),33325!==r&&33326!==r&&34842!==r&&34836!==r||s.get("EXT_color_buffer_float"),r}function T(t,e,n){return!0===b(t,n)||t.isFramebufferTexture&&t.minFilter!==Rt&&t.minFilter!==wt?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&0<t.mipmaps.length?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function r(t){return t===Rt||t===H||t===W?9728:9729}function o(t){const e=t.target;var n;e.removeEventListener("dispose",o),n=e,void 0!==(t=l.get(n)).__webglInit&&(m.deleteTexture(t.__webglTexture),l.remove(n)),e.isVideoTexture&&a.delete(e),h.memory.textures--}function A(t){const e=t.target;e.removeEventListener("dispose",A),function(t){const n=t.texture,i=l.get(t),e=l.get(n);if(t){if(void 0!==e.__webglTexture&&(m.deleteTexture(e.__webglTexture),h.memory.textures--),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++)m.deleteFramebuffer(i.__webglFramebuffer[t]),i.__webglDepthbuffer&&m.deleteRenderbuffer(i.__webglDepthbuffer[t]);else m.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&m.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&m.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer&&m.deleteRenderbuffer(i.__webglColorRenderbuffer),i.__webglDepthRenderbuffer&&m.deleteRenderbuffer(i.__webglDepthRenderbuffer);if(t.isWebGLMultipleRenderTargets)for(let t=0,e=n.length;t<e;t++){const i=l.get(n[t]);i.__webglTexture&&(m.deleteTexture(i.__webglTexture),h.memory.textures--),l.remove(n[t])}l.remove(n),l.remove(t)}}(e)}let E=0;function L(t,e){var n,i,r=l.get(t);if(t.isVideoTexture&&(n=t,i=h.render.frame,a.get(n)!==i&&(a.set(n,i),n.update())),0<t.version&&r.__version!==t.version){const g=t.image;if(void 0!==g&&!1!==g.complete)return void I(r,t,e)}g.activeTexture(33984+e),g.bindTexture(3553,r.__webglTexture)}function C(t,e){var n=l.get(t);0<t.version&&n.__version!==t.version?function(e,i,r){if(6===i.image.length){N(e,i),g.activeTexture(33984+r),g.bindTexture(34067,e.__webglTexture),m.pixelStorei(37440,i.flipY),m.pixelStorei(37441,i.premultiplyAlpha),m.pixelStorei(3317,i.unpackAlignment),m.pixelStorei(37443,0);const u=i&&(i.isCompressedTexture||i.image[0].isCompressedTexture),d=i.image[0]&&i.image[0].isDataTexture,p=[];for(let t=0;t<6;t++)p[t]=u||d?d?i.image[t].image:i.image[t]:_(i.image[t],!1,!0,y);var s=p[0],a=M(s)||x,o=v.convert(i.format),l=v.convert(i.type),c=w(i.internalFormat,o,l,i.encoding),h=x&&!0!==i.isVideoTexture,r=void 0===e.__version;let n,t=T(i,s,a);if(R(34067,i,a),u){h&&r&&g.texStorage2D(34067,t,c,s.width,s.height);for(let e=0;e<6;e++){n=p[e].mipmaps;for(let t=0;t<n.length;t++){const f=n[t];i.format!==Vt&&i.format!==kt?null!==o&&(h?g.compressedTexSubImage2D(34069+e,t,0,0,f.width,f.height,o,f.data):g.compressedTexImage2D(34069+e,t,c,f.width,f.height,0,f.data)):h?g.texSubImage2D(34069+e,t,0,0,f.width,f.height,o,l,f.data):g.texImage2D(34069+e,t,c,f.width,f.height,0,o,l,f.data)}}}else{n=i.mipmaps,h&&r&&(0<n.length&&t++,g.texStorage2D(34067,t,c,p[0].width,p[0].height));for(let e=0;e<6;e++)if(d){h?g.texSubImage2D(34069+e,0,0,0,p[e].width,p[e].height,o,l,p[e].data):g.texImage2D(34069+e,0,c,p[e].width,p[e].height,0,o,l,p[e].data);for(let t=0;t<n.length;t++){const i=n[t],f=i.image[e].image;h?g.texSubImage2D(34069+e,t+1,0,0,f.width,f.height,o,l,f.data):g.texImage2D(34069+e,t+1,c,f.width,f.height,0,o,l,f.data)}}else{h?g.texSubImage2D(34069+e,0,0,0,o,l,p[e]):g.texImage2D(34069+e,0,c,o,l,p[e]);for(let t=0;t<n.length;t++){const i=n[t];h?g.texSubImage2D(34069+e,t+1,0,0,o,l,i.image[e]):g.texImage2D(34069+e,t+1,c,o,l,i.image[e])}}}b(i,a)&&S(34067),e.__version=i.version,i.onUpdate&&i.onUpdate(i)}}(n,t,e):(g.activeTexture(33984+e),g.bindTexture(34067,n.__webglTexture))}const P={[V]:10497,[Dt]:33071,[G]:33648},D={[Rt]:9728,[H]:9984,[W]:9986,[wt]:9729,[Tt]:9985,[Nt]:9987};function R(t,e,n){if(n?(m.texParameteri(t,10242,P[e.wrapS]),m.texParameteri(t,10243,P[e.wrapT]),32879!==t&&35866!==t||m.texParameteri(t,32882,P[e.wrapR]),m.texParameteri(t,10240,D[e.magFilter]),m.texParameteri(t,10241,D[e.minFilter])):(m.texParameteri(t,10242,33071),m.texParameteri(t,10243,33071),32879!==t&&35866!==t||m.texParameteri(t,32882,33071),e.wrapS===Dt&&(e.wrapT,Dt),m.texParameteri(t,10240,r(e.magFilter)),m.texParameteri(t,10241,r(e.minFilter)),e.minFilter!==Rt&&(e.minFilter,wt)),!0===s.has("EXT_texture_filter_anisotropic")){const n=s.get("EXT_texture_filter_anisotropic");e.type===Ut&&!1===s.has("OES_texture_float_linear")||!1===x&&e.type===Ft&&!1===s.has("OES_texture_half_float_linear")||(1<e.anisotropy||l.get(e).__currentAnisotropy)&&(m.texParameterf(t,n.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(e.anisotropy,c.getMaxAnisotropy())),l.get(e).__currentAnisotropy=e.anisotropy)}}function N(t,e){void 0===t.__webglInit&&(t.__webglInit=!0,e.addEventListener("dispose",o),t.__webglTexture=m.createTexture(),h.memory.textures++)}function I(t,n,e){let i=3553;n.isDataTexture2DArray&&(i=35866),n.isDataTexture3D&&(i=32879),N(t,n),g.activeTexture(33984+e),g.bindTexture(i,t.__webglTexture),m.pixelStorei(37440,n.flipY),m.pixelStorei(37441,n.premultiplyAlpha),m.pixelStorei(3317,n.unpackAlignment),m.pixelStorei(37443,0);var r=(d=n,!x&&(d.wrapS!==Dt||d.wrapT!==Dt||d.minFilter!==Rt&&d.minFilter!==wt)&&!1===M(n.image)),s=_(n.image,r,!1,p),e=M(s)||x,a=v.convert(n.format);let o,l=v.convert(n.type),c=w(n.internalFormat,a,l,n.encoding);R(i,n,e);var h=n.mipmaps,u=x&&!0!==n.isVideoTexture,d=void 0===t.__version,r=T(n,s,e);if(n.isDepthTexture)c=6402,x?c=n.type===Ut?36012:n.type===zt?33190:n.type===Bt?35056:33189:(n.type,Ut),n.format===Gt&&6402===c&&n.type!==Ot&&n.type!==zt&&(n.type=Ot,l=v.convert(n.type)),n.format===Ht&&6402===c&&(c=34041,n.type!==Bt&&(n.type=Bt,l=v.convert(n.type))),u&&d?g.texStorage2D(3553,1,c,s.width,s.height):g.texImage2D(3553,0,c,s.width,s.height,0,a,l,null);else if(n.isDataTexture)if(0<h.length&&e){u&&d&&g.texStorage2D(3553,r,c,h[0].width,h[0].height);for(let t=0,e=h.length;t<e;t++)o=h[t],u?g.texSubImage2D(3553,0,0,0,o.width,o.height,a,l,o.data):g.texImage2D(3553,t,c,o.width,o.height,0,a,l,o.data);n.generateMipmaps=!1}else u?(d&&g.texStorage2D(3553,r,c,s.width,s.height),g.texSubImage2D(3553,0,0,0,s.width,s.height,a,l,s.data)):g.texImage2D(3553,0,c,s.width,s.height,0,a,l,s.data);else if(n.isCompressedTexture){u&&d&&g.texStorage2D(3553,r,c,h[0].width,h[0].height);for(let t=0,e=h.length;t<e;t++)o=h[t],n.format!==Vt&&n.format!==kt?null!==a&&(u?g.compressedTexSubImage2D(3553,t,0,0,o.width,o.height,a,o.data):g.compressedTexImage2D(3553,t,c,o.width,o.height,0,o.data)):u?g.texSubImage2D(3553,t,0,0,o.width,o.height,a,l,o.data):g.texImage2D(3553,t,c,o.width,o.height,0,a,l,o.data)}else if(n.isDataTexture2DArray)u?(d&&g.texStorage3D(35866,r,c,s.width,s.height,s.depth),g.texSubImage3D(35866,0,0,0,0,s.width,s.height,s.depth,a,l,s.data)):g.texImage3D(35866,0,c,s.width,s.height,s.depth,0,a,l,s.data);else if(n.isDataTexture3D)u?(d&&g.texStorage3D(32879,r,c,s.width,s.height,s.depth),g.texSubImage3D(32879,0,0,0,0,s.width,s.height,s.depth,a,l,s.data)):g.texImage3D(32879,0,c,s.width,s.height,s.depth,0,a,l,s.data);else if(n.isFramebufferTexture)u&&d?g.texStorage2D(3553,r,c,s.width,s.height):g.texImage2D(3553,0,c,s.width,s.height,0,a,l,null);else if(0<h.length&&e){u&&d&&g.texStorage2D(3553,r,c,h[0].width,h[0].height);for(let t=0,e=h.length;t<e;t++)o=h[t],u?g.texSubImage2D(3553,t,0,0,a,l,o):g.texImage2D(3553,t,c,a,l,o);n.generateMipmaps=!1}else u?(d&&g.texStorage2D(3553,r,c,s.width,s.height),g.texSubImage2D(3553,0,0,0,a,l,s)):g.texImage2D(3553,0,c,a,l,s);b(n,e)&&S(i),t.__version=n.version,n.onUpdate&&n.onUpdate(n)}function O(t,e,n,i,r){var s=v.convert(n.format),a=v.convert(n.type),o=w(n.internalFormat,s,a,n.encoding);l.get(e).__hasExternalTextures||(32879===r||35866===r?g.texImage3D(r,0,o,e.width,e.height,e.depth,0,s,a,null):g.texImage2D(r,0,o,e.width,e.height,0,s,a,null)),g.bindFramebuffer(36160,t),e.useRenderToTexture?u.framebufferTexture2DMultisampleEXT(36160,i,r,l.get(n).__webglTexture,0,F(e)):m.framebufferTexture2D(36160,i,r,l.get(n).__webglTexture,0),g.bindFramebuffer(36160,null)}function z(e,n,i){if(m.bindRenderbuffer(36161,e),n.depthBuffer&&!n.stencilBuffer){let t=33189;if(i||n.useRenderToTexture){const e=n.depthTexture;e&&e.isDepthTexture&&(e.type===Ut?t=36012:e.type===zt&&(t=33190));const i=F(n);n.useRenderToTexture?u.renderbufferStorageMultisampleEXT(36161,i,t,n.width,n.height):m.renderbufferStorageMultisample(36161,i,t,n.width,n.height)}else m.renderbufferStorage(36161,t,n.width,n.height);m.framebufferRenderbuffer(36160,36096,36161,e)}else if(n.depthBuffer&&n.stencilBuffer){var t=F(n);i&&n.useRenderbuffer?m.renderbufferStorageMultisample(36161,t,35056,n.width,n.height):n.useRenderToTexture?u.renderbufferStorageMultisampleEXT(36161,t,35056,n.width,n.height):m.renderbufferStorage(36161,34041,n.width,n.height),m.framebufferRenderbuffer(36160,33306,36161,e)}else{const e=!0===n.isWebGLMultipleRenderTargets?n.texture[0]:n.texture,r=v.convert(e.format),s=v.convert(e.type),a=w(e.internalFormat,r,s,e.encoding),o=F(n);i&&n.useRenderbuffer?m.renderbufferStorageMultisample(36161,o,a,n.width,n.height):n.useRenderToTexture?u.renderbufferStorageMultisampleEXT(36161,o,a,n.width,n.height):m.renderbufferStorage(36161,a,n.width,n.height)}m.bindRenderbuffer(36161,null)}function U(e){const n=l.get(e),t=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture&&!n.__autoAllocateDepthBuffer){if(t)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,e){if(e&&e.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(g.bindFramebuffer(36160,t),!e.depthTexture||!e.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");l.get(e.depthTexture).__webglTexture&&e.depthTexture.image.width===e.width&&e.depthTexture.image.height===e.height||(e.depthTexture.image.width=e.width,e.depthTexture.image.height=e.height,e.depthTexture.needsUpdate=!0),L(e.depthTexture,0);var n=l.get(e.depthTexture).__webglTexture,t=F(e);if(e.depthTexture.format===Gt)e.useRenderToTexture?u.framebufferTexture2DMultisampleEXT(36160,36096,3553,n,0,t):m.framebufferTexture2D(36160,36096,3553,n,0);else{if(e.depthTexture.format!==Ht)throw new Error("Unknown depthTexture format");e.useRenderToTexture?u.framebufferTexture2DMultisampleEXT(36160,33306,3553,n,0,t):m.framebufferTexture2D(36160,33306,3553,n,0)}}(n.__webglFramebuffer,e)}else if(t){n.__webglDepthbuffer=[];for(let t=0;t<6;t++)g.bindFramebuffer(36160,n.__webglFramebuffer[t]),n.__webglDepthbuffer[t]=m.createRenderbuffer(),z(n.__webglDepthbuffer[t],e,!1)}else g.bindFramebuffer(36160,n.__webglFramebuffer),n.__webglDepthbuffer=m.createRenderbuffer(),z(n.__webglDepthbuffer,e,!1);g.bindFramebuffer(36160,null)}function F(t){return x&&(t.useRenderbuffer||t.useRenderToTexture)?Math.min(n,t.samples):0}let B=!1,k=!1;this.allocateTextureUnit=function(){var t=E;return e,E+=1,t},this.resetTextureUnits=function(){E=0},this.setTexture2D=L,this.setTexture2DArray=function(t,e){var n=l.get(t);0<t.version&&n.__version!==t.version?I(n,t,e):(g.activeTexture(33984+e),g.bindTexture(35866,n.__webglTexture))},this.setTexture3D=function(t,e){var n=l.get(t);0<t.version&&n.__version!==t.version?I(n,t,e):(g.activeTexture(33984+e),g.bindTexture(32879,n.__webglTexture))},this.setTextureCube=C,this.rebindTextures=function(t,e,n){var i=l.get(t);void 0!==e&&O(i.__webglFramebuffer,t,t.texture,36064,3553),void 0!==n&&U(t)},this.setupRenderTarget=function(n){const e=n.texture,i=l.get(n),r=l.get(e);n.addEventListener("dispose",A),!0!==n.isWebGLMultipleRenderTargets&&(void 0===r.__webglTexture&&(r.__webglTexture=m.createTexture()),r.__version=e.version,h.memory.textures++);var t=!0===n.isWebGLCubeRenderTarget,s=!0===n.isWebGLMultipleRenderTargets,a=e.isDataTexture3D||e.isDataTexture2DArray,o=M(n)||x;if(!x||e.format!==kt||e.type!==Ut&&e.type!==Ft||(e.format=Vt),t){i.__webglFramebuffer=[];for(let t=0;t<6;t++)i.__webglFramebuffer[t]=m.createFramebuffer()}else if(i.__webglFramebuffer=m.createFramebuffer(),s){if(c.drawBuffers){const g=n.texture;for(let t=0,e=g.length;t<e;t++){const c=l.get(g[t]);void 0===c.__webglTexture&&(c.__webglTexture=m.createTexture(),h.memory.textures++)}}}else if(n.useRenderbuffer&&x){i.__webglMultisampledFramebuffer=m.createFramebuffer(),i.__webglColorRenderbuffer=m.createRenderbuffer(),m.bindRenderbuffer(36161,i.__webglColorRenderbuffer);const l=v.convert(e.format),c=v.convert(e.type),h=w(e.internalFormat,l,c,e.encoding),x=F(n);m.renderbufferStorageMultisample(36161,x,h,n.width,n.height),g.bindFramebuffer(36160,i.__webglMultisampledFramebuffer),m.framebufferRenderbuffer(36160,36064,36161,i.__webglColorRenderbuffer),m.bindRenderbuffer(36161,null),n.depthBuffer&&(i.__webglDepthRenderbuffer=m.createRenderbuffer(),z(i.__webglDepthRenderbuffer,n,!0)),g.bindFramebuffer(36160,null)}if(t){g.bindTexture(34067,r.__webglTexture),R(34067,e,o);for(let t=0;t<6;t++)O(i.__webglFramebuffer[t],n,e,36064,34069+t);b(e,o)&&S(34067),g.unbindTexture()}else if(s){const m=n.texture;for(let t=0,e=m.length;t<e;t++){const v=m[t],h=l.get(v);g.bindTexture(3553,h.__webglTexture),R(3553,v,o),O(i.__webglFramebuffer,n,v,36064+t,3553),b(v,o)&&S(3553)}g.unbindTexture()}else{let t=3553;if(a&&x){const n=e.isDataTexture3D;t=n?32879:35866}g.bindTexture(t,r.__webglTexture),R(t,e,o),O(i.__webglFramebuffer,n,e,36064,t),b(e,o)&&S(t),g.unbindTexture()}n.depthBuffer&&U(n)},this.updateRenderTargetMipmap=function(n){const i=M(n)||x,r=!0===n.isWebGLMultipleRenderTargets?n.texture:[n.texture];for(let t=0,e=r.length;t<e;t++){var s=r[t];if(b(s,i)){const i=n.isWebGLCubeRenderTarget?34067:3553,r=l.get(s).__webglTexture;g.bindTexture(i,r),S(i),g.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(e.useRenderbuffer&&x){var n=e.width,i=e.height;let t=16384;const x=[36064],s=e.stencilBuffer?33306:36096;e.depthBuffer&&x.push(s),e.ignoreDepthForMultisampleCopy||(e.depthBuffer&&(t|=256),e.stencilBuffer&&(t|=1024));var r=l.get(e);g.bindFramebuffer(36008,r.__webglMultisampledFramebuffer),g.bindFramebuffer(36009,r.__webglFramebuffer),e.ignoreDepthForMultisampleCopy&&(m.invalidateFramebuffer(36008,[s]),m.invalidateFramebuffer(36009,[s])),m.blitFramebuffer(0,0,n,i,0,0,n,i,t,9728),m.invalidateFramebuffer(36008,x),g.bindFramebuffer(36008,null),g.bindFramebuffer(36009,r.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=U,this.setupFrameBufferTexture=O,this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===B&&(B=!0),t=t.texture),L(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===k&&(k=!0),t=t.texture),C(t,e)}}function so(t,n,e){const i=e.isWebGL2;return{convert:function(t){let e;if(t===It)return 5121;if(t===l)return 32819;if(t===u)return 32820;if(t===d)return 33635;if(t===s)return 5120;if(t===a)return 5122;if(t===Ot)return 5123;if(t===o)return 5124;if(t===zt)return 5125;if(t===Ut)return 5126;if(t===Ft)return i?5131:(e=n.get("OES_texture_half_float"),null!==e?e.HALF_FLOAT_OES:null);if(t===p)return 6406;if(t===kt)return 6407;if(t===Vt)return 6408;if(t===f)return 6409;if(t===m)return 6410;if(t===Gt)return 6402;if(t===Ht)return 34041;if(t===g)return 6403;if(t===v)return 36244;if(t===x)return 33319;if(t===y)return 33320;if(t===_)return 36248;if(t===M)return 36249;if(t===w||t===E||t===L||t===C){if(e=n.get("WEBGL_compressed_texture_s3tc"),null===e)return null;if(t===w)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===E)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===L)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===C)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t===R||t===N||t===I||t===O){if(e=n.get("WEBGL_compressed_texture_pvrtc"),null===e)return null;if(t===R)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===N)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===I)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===O)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===z)return e=n.get("WEBGL_compressed_texture_etc1"),null!==e?e.COMPRESSED_RGB_ETC1_WEBGL:null;if((t===U||t===F)&&(e=n.get("WEBGL_compressed_texture_etc"),null!==e)){if(t===U)return e.COMPRESSED_RGB8_ETC2;if(t===F)return e.COMPRESSED_RGBA8_ETC2_EAC}return t===B||t===k||t===Wt||t===jt||t===Xt||t===qt||t===Yt||t===Zt||t===Jt||t===Kt||t===Qt||t===$t||t===te||t===ee||t===ie||t===re||t===se||t===ae||t===oe||t===le||t===ce||t===he||t===ue||t===de||t===pe||t===fe||t===me||t===ge?(e=n.get("WEBGL_compressed_texture_astc"),null!==e?t:null):t===ne?(e=n.get("EXT_texture_compression_bptc"),null!==e?t:null):t===Bt?i?34042:(e=n.get("WEBGL_depth_texture"),null!==e?e.UNSIGNED_INT_24_8_WEBGL:null):void 0}}}class ao extends pr{constructor(t=[]){super(),this.cameras=t}}ao.prototype.isArrayCamera=!0;class oo extends ai{constructor(){super(),this.type="Group"}}oo.prototype.isGroup=!0;const lo={type:"move"};class co{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new oo,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new oo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new rn,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new rn),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new oo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new rn,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new rn),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,n){let i=null,r=null,s=null;const a=this._targetRay,o=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(null!==a&&(i=e.getPose(t.targetRaySpace,n),null!==i&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(lo))),l&&t.hand){s=!0;for(const s of t.hand.values()){const t=e.getJointPose(s,n);if(void 0===l.joints[s.jointName]){const t=new oo;t.matrixAutoUpdate=!1,t.visible=!1,l.joints[s.jointName]=t,l.add(t)}const i=l.joints[s.jointName];null!==t&&(i.matrix.fromArray(t.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.jointRadius=t.radius),i.visible=null!==t}const i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],a=i.position.distanceTo(r.position),o=.02;l.inputState.pinching&&.025<a?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&a<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));return null!==a&&(a.visible=null!==i),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==s),this}}class ho extends Ke{constructor(t,e,n,i,r,s,a,o,l,c){if((c=void 0!==c?c:Gt)!==Gt&&c!==Ht)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super(null,i,r,s,a,o,c,n=void 0===(n=void 0===n&&c===Gt?Ot:n)&&c===Ht?Bt:n,l),this.image={width:t,height:e},this.magFilter=void 0!==a?a:Rt,this.minFilter=void 0!==o?o:Rt,this.flipY=!1,this.generateMipmaps=!1}}ho.prototype.isDepthTexture=!0;class uo extends De{constructor(a,r){super();const e=this;let o=null,s=1,n=null,l="local-floor";const c=a.extensions.has("WEBGL_multisampled_render_to_texture");let t=null,h=null,u=null,d=null,p,f=null;const m=r.getContextAttributes();let g=null,v=null;const x=[],i=new Map,y=new pr;y.layers.enable(1),y.viewport=new $e;const _=new pr;_.layers.enable(2),_.viewport=new $e;const M=[y,_],b=new ao;b.layers.enable(1),b.layers.enable(2);let S=null,w=null;function T(t){const e=i.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function A(){i.forEach(function(t,e){t.disconnect(e)}),i.clear(),S=null,w=null,a.setRenderTarget(g),d=null,u=null,h=null,o=null,v=null,R.stop(),e.isPresenting=!1,e.dispatchEvent({type:"sessionend"})}function E(e){const n=o.inputSources;for(let t=0;t<x.length;t++)i.set(n[t],x[t]);for(let t=0;t<e.removed.length;t++){const n=e.removed[t],o=i.get(n);o&&(o.dispatchEvent({type:"disconnected",data:n}),i.delete(n))}for(let t=0;t<e.added.length;t++){const n=e.added[t],o=i.get(n);o&&o.dispatchEvent({type:"connected",data:n})}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=x[t];return void 0===e&&(e=new co,x[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=x[t];return void 0===e&&(e=new co,x[t]=e),e.getGripSpace()},this.getHand=function(t){let e=x[t];return void 0===e&&(e=new co,x[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){s=t,e.isPresenting},this.setReferenceSpaceType=function(t){l=t,e.isPresenting},this.getReferenceSpace=function(){return n},this.getBaseLayer=function(){return null!==u?u:d},this.getBinding=function(){return h},this.getFrame=function(){return f},this.getSession=function(){return o},this.setSession=async function(i){if(o=i,null!==o){if(g=a.getRenderTarget(),o.addEventListener("select",T),o.addEventListener("selectstart",T),o.addEventListener("selectend",T),o.addEventListener("squeeze",T),o.addEventListener("squeezestart",T),o.addEventListener("squeezeend",T),o.addEventListener("end",A),o.addEventListener("inputsourceschange",E),!0!==m.xrCompatible&&await r.makeXRCompatible(),void 0===o.renderState.layers||!1===a.capabilities.isWebGL2){const e={antialias:void 0!==o.renderState.layers||m.antialias,alpha:m.alpha,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:s};d=new XRWebGLLayer(o,r,e),o.updateRenderState({baseLayer:d}),v=new tn(d.framebufferWidth,d.framebufferHeight,{format:Vt,type:It,encoding:a.outputEncoding})}else{p=m.antialias;let t=null,e=null,n=null;m.depth&&(n=m.stencil?35056:33190,t=m.stencil?Ht:Gt,e=m.stencil?Bt:Ot);const i={colorFormat:m.alpha||p?32856:32849,depthFormat:n,scaleFactor:s};h=new XRWebGLBinding(o,r),u=h.createProjectionLayer(i),o.updateRenderState({layers:[u]}),v=p?new en(u.textureWidth,u.textureHeight,{format:Vt,type:It,depthTexture:new ho(u.textureWidth,u.textureHeight,e,void 0,void 0,void 0,void 0,void 0,void 0,t),stencilBuffer:m.stencil,ignoreDepth:u.ignoreDepthValues,useRenderToTexture:c,encoding:a.outputEncoding}):new tn(u.textureWidth,u.textureHeight,{format:m.alpha?Vt:kt,type:It,depthTexture:new ho(u.textureWidth,u.textureHeight,e,void 0,void 0,void 0,void 0,void 0,void 0,t),stencilBuffer:m.stencil,ignoreDepth:u.ignoreDepthValues,encoding:a.outputEncoding})}this.setFoveation(1),n=await o.requestReferenceSpace(l),R.setContext(o),R.start(),e.isPresenting=!0,e.dispatchEvent({type:"sessionstart"})}};const L=new rn,C=new rn;function P(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null!==o){b.near=_.near=y.near=t.near,b.far=_.far=y.far=t.far,S===b.near&&w===b.far||(o.updateRenderState({depthNear:b.near,depthFar:b.far}),S=b.near,w=b.far);var e=t.parent,n=b.cameras;P(b,e);for(let t=0;t<n.length;t++)P(n[t],e);b.matrixWorld.decompose(b.position,b.quaternion,b.scale),t.position.copy(b.position),t.quaternion.copy(b.quaternion),t.scale.copy(b.scale),t.matrix.copy(b.matrix),t.matrixWorld.copy(b.matrixWorld);const i=t.children;for(let t=0,e=i.length;t<e;t++)i[t].updateMatrixWorld(!0);2===n.length?function(t,e,n){L.setFromMatrixPosition(e.matrixWorld),C.setFromMatrixPosition(n.matrixWorld);var i=L.distanceTo(C),r=e.projectionMatrix.elements,s=n.projectionMatrix.elements,a=r[14]/(r[10]-1),o=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],h=(r[8]-1)/r[0],n=(s[8]+1)/s[0],r=a*h,s=a*n,h=(n=i/(n-h))*-h;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(h),t.translateZ(n),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert(),a+=n,n=o+n,t.projectionMatrix.makePerspective(r-h,i-h+s,l*o/n*a,c*o/n*a,a,n)}(b,y,_):b.projectionMatrix.copy(y.projectionMatrix)}},this.getCamera=function(){return b},this.getFoveation=function(){return null!==u?u.fixedFoveation:null!==d?d.fixedFoveation:void 0},this.setFoveation=function(t){null!==u&&(u.fixedFoveation=t),null!==d&&void 0!==d.fixedFoveation&&(d.fixedFoveation=t)};let D=null;const R=new wr;R.setAnimationLoop(function(i,e){if(t=e.getViewerPose(n),f=e,null!==t){const i=t.views;null!==d&&(a.setRenderTargetFramebuffer(v,d.framebuffer),a.setRenderTarget(v));let n=!1;i.length!==b.cameras.length&&(b.cameras.length=0,n=!0);for(let e=0;e<i.length;e++){const r=i[e];let t=null;if(null!==d)t=d.getViewport(r);else{const i=h.getViewSubImage(u,r);t=i.viewport,0===e&&(a.setRenderTargetTextures(v,i.colorTexture,u.ignoreDepthValues?void 0:i.depthStencilTexture),a.setRenderTarget(v))}const s=M[e];s.matrix.fromArray(r.transform.matrix),s.projectionMatrix.fromArray(r.projectionMatrix),s.viewport.set(t.x,t.y,t.width,t.height),0===e&&b.matrix.copy(s.matrix),!0===n&&b.cameras.push(s)}}const r=o.inputSources;for(let t=0;t<x.length;t++){const i=x[t],o=r[t];i.update(o,e,n)}D&&D(i,e),f=null}),this.setAnimationLoop=function(t){D=t},this.dispose=function(){}}}function po(s){function m(t,e){t.opacity.value=e.opacity,e.color&&t.diffuse.value.copy(e.color),e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.specularMap&&(t.specularMap.value=e.specularMap),0<e.alphaTest&&(t.alphaTest.value=e.alphaTest);var n=s.get(e).envMap;let i,r;n&&(t.envMap.value=n,t.flipEnvMap.value=n.isCubeTexture&&!1===n.isRenderTargetTexture?-1:1,t.reflectivity.value=e.reflectivity,t.ior.value=e.ior,t.refractionRatio.value=e.refractionRatio),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity),e.map?i=e.map:e.specularMap?i=e.specularMap:e.displacementMap?i=e.displacementMap:e.normalMap?i=e.normalMap:e.bumpMap?i=e.bumpMap:e.roughnessMap?i=e.roughnessMap:e.metalnessMap?i=e.metalnessMap:e.alphaMap?i=e.alphaMap:e.emissiveMap?i=e.emissiveMap:e.clearcoatMap?i=e.clearcoatMap:e.clearcoatNormalMap?i=e.clearcoatNormalMap:e.clearcoatRoughnessMap?i=e.clearcoatRoughnessMap:e.specularIntensityMap?i=e.specularIntensityMap:e.specularColorMap?i=e.specularColorMap:e.transmissionMap?i=e.transmissionMap:e.thicknessMap?i=e.thicknessMap:e.sheenColorMap?i=e.sheenColorMap:e.sheenRoughnessMap&&(i=e.sheenRoughnessMap),void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix)),e.aoMap?r=e.aoMap:e.lightMap&&(r=e.lightMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uv2Transform.value.copy(r.matrix))}function g(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===Lt&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===Lt&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),s.get(e).envMap&&(t.envMapIntensity.value=e.envMapIntensity)}return{refreshFogUniforms:function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)},refreshMaterialUniforms:function(t,e,n,i,r){var s,a,o,l,c,h,u,d,p,f;e.isMeshBasicMaterial?m(t,e):e.isMeshLambertMaterial?(m(t,e),p=t,(f=e).emissiveMap&&(p.emissiveMap.value=f.emissiveMap)):e.isMeshToonMaterial?(m(t,e),u=t,(d=e).gradientMap&&(u.gradientMap.value=d.gradientMap),d.emissiveMap&&(u.emissiveMap.value=d.emissiveMap),d.bumpMap&&(u.bumpMap.value=d.bumpMap,u.bumpScale.value=d.bumpScale,d.side===Lt&&(u.bumpScale.value*=-1)),d.normalMap&&(u.normalMap.value=d.normalMap,u.normalScale.value.copy(d.normalScale),d.side===Lt&&u.normalScale.value.negate()),d.displacementMap&&(u.displacementMap.value=d.displacementMap,u.displacementScale.value=d.displacementScale,u.displacementBias.value=d.displacementBias)):e.isMeshPhongMaterial?(m(t,e),u=e,(d=t).specular.value.copy(u.specular),d.shininess.value=Math.max(u.shininess,1e-4),u.emissiveMap&&(d.emissiveMap.value=u.emissiveMap),u.bumpMap&&(d.bumpMap.value=u.bumpMap,d.bumpScale.value=u.bumpScale,u.side===Lt&&(d.bumpScale.value*=-1)),u.normalMap&&(d.normalMap.value=u.normalMap,d.normalScale.value.copy(u.normalScale),u.side===Lt&&d.normalScale.value.negate()),u.displacementMap&&(d.displacementMap.value=u.displacementMap,d.displacementScale.value=u.displacementScale,d.displacementBias.value=u.displacementBias)):e.isMeshStandardMaterial?(m(t,e),e.isMeshPhysicalMaterial?(r=r,g(c=t,h=e),c.ior.value=h.ior,0<h.sheen&&(c.sheenColor.value.copy(h.sheenColor).multiplyScalar(h.sheen),c.sheenRoughness.value=h.sheenRoughness,h.sheenColorMap&&(c.sheenColorMap.value=h.sheenColorMap),h.sheenRoughnessMap&&(c.sheenRoughnessMap.value=h.sheenRoughnessMap)),0<h.clearcoat&&(c.clearcoat.value=h.clearcoat,c.clearcoatRoughness.value=h.clearcoatRoughness,h.clearcoatMap&&(c.clearcoatMap.value=h.clearcoatMap),h.clearcoatRoughnessMap&&(c.clearcoatRoughnessMap.value=h.clearcoatRoughnessMap),h.clearcoatNormalMap&&(c.clearcoatNormalScale.value.copy(h.clearcoatNormalScale),c.clearcoatNormalMap.value=h.clearcoatNormalMap,h.side===Lt&&c.clearcoatNormalScale.value.negate())),0<h.transmission&&(c.transmission.value=h.transmission,c.transmissionSamplerMap.value=r.texture,c.transmissionSamplerSize.value.set(r.width,r.height),h.transmissionMap&&(c.transmissionMap.value=h.transmissionMap),c.thickness.value=h.thickness,h.thicknessMap&&(c.thicknessMap.value=h.thicknessMap),c.attenuationDistance.value=h.attenuationDistance,c.attenuationColor.value.copy(h.attenuationColor)),c.specularIntensity.value=h.specularIntensity,c.specularColor.value.copy(h.specularColor),h.specularIntensityMap&&(c.specularIntensityMap.value=h.specularIntensityMap),h.specularColorMap&&(c.specularColorMap.value=h.specularColorMap)):g(t,e)):e.isMeshMatcapMaterial?(m(t,e),c=t,(h=e).matcap&&(c.matcap.value=h.matcap),h.bumpMap&&(c.bumpMap.value=h.bumpMap,c.bumpScale.value=h.bumpScale,h.side===Lt&&(c.bumpScale.value*=-1)),h.normalMap&&(c.normalMap.value=h.normalMap,c.normalScale.value.copy(h.normalScale),h.side===Lt&&c.normalScale.value.negate()),h.displacementMap&&(c.displacementMap.value=h.displacementMap,c.displacementScale.value=h.displacementScale,c.displacementBias.value=h.displacementBias)):e.isMeshDepthMaterial?(m(t,e),o=t,(l=e).displacementMap&&(o.displacementMap.value=l.displacementMap,o.displacementScale.value=l.displacementScale,o.displacementBias.value=l.displacementBias)):e.isMeshDistanceMaterial?(m(t,e),o=t,(l=e).displacementMap&&(o.displacementMap.value=l.displacementMap,o.displacementScale.value=l.displacementScale,o.displacementBias.value=l.displacementBias),o.referencePosition.value.copy(l.referencePosition),o.nearDistance.value=l.nearDistance,o.farDistance.value=l.farDistance):e.isMeshNormalMaterial?(m(t,e),s=t,(a=e).bumpMap&&(s.bumpMap.value=a.bumpMap,s.bumpScale.value=a.bumpScale,a.side===Lt&&(s.bumpScale.value*=-1)),a.normalMap&&(s.normalMap.value=a.normalMap,s.normalScale.value.copy(a.normalScale),a.side===Lt&&s.normalScale.value.negate()),a.displacementMap&&(s.displacementMap.value=a.displacementMap,s.displacementScale.value=a.displacementScale,s.displacementBias.value=a.displacementBias)):e.isLineBasicMaterial?(s=e,(a=t).diffuse.value.copy(s.color),a.opacity.value=s.opacity,e.isLineDashedMaterial&&(a=e,(s=t).dashSize.value=a.dashSize,s.totalSize.value=a.dashSize+a.gapSize,s.scale.value=a.scale)):e.isPointsMaterial?function(t,e,n,i){let r;t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*i,e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),0<e.alphaTest&&(t.alphaTest.value=e.alphaTest),e.map?r=e.map:e.alphaMap&&(r=e.alphaMap),void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix))}(t,e,n,i):e.isSpriteMaterial?function(t,e){let n;t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),0<e.alphaTest&&(t.alphaTest.value=e.alphaTest),e.map?n=e.map:e.alphaMap&&(n=e.alphaMap),void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),t.uvTransform.value.copy(n.matrix))}(t,e):e.isShadowMaterial?(t.color.value.copy(e.color),t.opacity.value=e.opacity):e.isShaderMaterial&&(e.uniformsNeedUpdate=!1)}}}function fo(t={}){const r=void 0!==t.canvas?t.canvas:function(){const t=qe("canvas");return t.style.display="block",t}(),e=void 0!==t.context?t.context:null,n=void 0!==t.alpha&&t.alpha,i=void 0===t.depth||t.depth,s=void 0===t.stencil||t.stencil,a=void 0!==t.antialias&&t.antialias,o=void 0===t.premultipliedAlpha||t.premultipliedAlpha,l=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,c=void 0!==t.powerPreference?t.powerPreference:"default",h=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;let u=null,w=null;const d=[],p=[];this.domElement=r,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=Se,this.physicallyCorrectLights=!1,this.toneMapping=Pt,this.toneMappingExposure=1;const T=this;let f=!1,m=0,g=0,A=null,E=-1,L=null;const v=new $e,x=new $e;let y=null,_=r.width,C=r.height,P=1,M=null,b=null;const S=new $e(0,0,_,C),D=new $e(0,0,_,C);let R=!1;const N=[],I=new Sr;let O=!1,z=!1,U=null;const F=new On,B=new rn,k={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function V(){return null===A?P:1}let G,H,W,j,X,q,Y,Z,J,K,Q,$,tt,et,nt,it,rt,st,at,ot,lt,ct,ht,ut=e;function dt(e,n){for(let t=0;t<e.length;t++){var i=e[t],i=r.getContext(i,n);if(null!==i)return i}return null}try{const t={alpha:n,depth:i,stencil:s,antialias:a,premultipliedAlpha:o,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:h};if("setAttribute"in r&&r.setAttribute("data-engine","three.js r"+At),r.addEventListener("webglcontextlost",mt,!1),r.addEventListener("webglcontextrestored",gt,!1),null===ut){const r=["webgl2","webgl","experimental-webgl"];if(!0===T.isWebGL1Renderer&&r.shift(),ut=dt(r,t),null===ut)throw dt(r)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===ut.getShaderPrecisionFormat&&(ut.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw t}function pt(){G=new ss(ut),H=new Nr(ut,G,t),G.init(H),ct=new so(ut,G,H),W=new io(ut,G,H),N[0]=1029,j=new ls(ut),X=new Va,q=new ro(ut,G,W,X,H,ct,j),Y=new Or(T),Z=new rs(T),J=new Tr(ut,H),ht=new Dr(ut,G,J,H),K=new as(ut,J,j,ht),Q=new fs(ut,K,J,j),at=new ps(ut,H,q),it=new Ir(X),$=new ka(T,Y,Z,G,H,ht,it),tt=new po(X),et=new ja,nt=new Ka(G,H),st=new Pr(T,Y,W,Q,o),rt=new no(T,Q,H),ot=new Rr(ut,G,j,H),lt=new os(ut,G,j,H),j.programs=$.programs,T.capabilities=H,T.extensions=G,T.properties=X,T.renderLists=et,T.shadowMap=rt,T.state=W,T.info=j}pt();const ft=new uo(T,ut);function mt(t){t.preventDefault(),f=!0}function gt(){f=!1;var t=j.autoReset,e=rt.enabled,n=rt.autoUpdate,i=rt.needsUpdate,r=rt.type;pt(),j.autoReset=t,rt.enabled=e,rt.autoUpdate=n,rt.needsUpdate=i,rt.type=r}function vt(t){const e=t.target;e.removeEventListener("dispose",vt),function(t){const e=X.get(t).programs;void 0!==e&&(e.forEach(function(t){$.releaseProgram(t)}),t.isShaderMaterial&&$.releaseShaderCache(t))}(t=e),X.remove(t)}this.xr=ft,this.getContext=function(){return ut},this.getContextAttributes=function(){return ut.getContextAttributes()},this.forceContextLoss=function(){const t=G.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=G.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return P},this.setPixelRatio=function(t){void 0!==t&&(P=t,this.setSize(_,C,!1))},this.getSize=function(t){return t.set(_,C)},this.setSize=function(t,e,n){ft.isPresenting||(_=t,C=e,r.width=Math.floor(t*P),r.height=Math.floor(e*P),!1!==n&&(r.style.width=t+"px",r.style.height=e+"px"),this.setViewport(0,0,t,e))},this.getDrawingBufferSize=function(t){return t.set(_*P,C*P).floor()},this.setDrawingBufferSize=function(t,e,n){_=t,C=e,P=n,r.width=Math.floor(t*n),r.height=Math.floor(e*n),this.setViewport(0,0,t,e)},this.getCurrentViewport=function(t){return t.copy(v)},this.getViewport=function(t){return t.copy(S)},this.setViewport=function(t,e,n,i){t.isVector4?S.set(t.x,t.y,t.z,t.w):S.set(t,e,n,i),W.viewport(v.copy(S).multiplyScalar(P).floor())},this.getScissor=function(t){return t.copy(D)},this.setScissor=function(t,e,n,i){t.isVector4?D.set(t.x,t.y,t.z,t.w):D.set(t,e,n,i),W.scissor(x.copy(D).multiplyScalar(P).floor())},this.getScissorTest=function(){return R},this.setScissorTest=function(t){W.setScissorTest(R=t)},this.setOpaqueSort=function(t){M=t},this.setTransparentSort=function(t){b=t},this.getClearColor=function(t){return t.copy(st.getClearColor())},this.setClearColor=function(){st.setClearColor.apply(st,arguments)},this.getClearAlpha=function(){return st.getClearAlpha()},this.setClearAlpha=function(){st.setClearAlpha.apply(st,arguments)},this.clear=function(t,e,n){let i=0;void 0!==t&&!t||(i|=16384),void 0!==e&&!e||(i|=256),void 0!==n&&!n||(i|=1024),ut.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){r.removeEventListener("webglcontextlost",mt,!1),r.removeEventListener("webglcontextrestored",gt,!1),et.dispose(),nt.dispose(),X.dispose(),Y.dispose(),Z.dispose(),Q.dispose(),ht.dispose(),$.dispose(),ft.dispose(),ft.removeEventListener("sessionstart",yt),ft.removeEventListener("sessionend",_t),U&&(U.dispose(),U=null),Mt.stop()},this.renderBufferDirect=function(t,e,n,i,r,s){null===e&&(e=k);var a=r.isMesh&&r.matrixWorld.determinant()<0,o=function(t,e,n,i,r){!0!==e.isScene&&(e=k),q.resetTextureUnits();const s=e.fog,a=i.isMeshStandardMaterial?e.environment:null,o=null===A?T.outputEncoding:A.texture.encoding,l=(i.isMeshStandardMaterial?Z:Y).get(i.envMap||a),c=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,h=!!i.normalMap&&!!n.attributes.tangent,u=!!n.morphAttributes.position,d=!!n.morphAttributes.normal,p=n.morphAttributes.position?n.morphAttributes.position.length:0,f=i.toneMapped?T.toneMapping:Pt,m=X.get(i),g=w.state.lights;if(!0===O&&(!0===z||t!==L)){const e=t===L&&i.id===E;it.setState(i,t,e)}let v=!1;i.version===m.__version?(m.needsLights&&m.lightsStateVersion!==g.state.version||m.outputEncoding!==o||r.isInstancedMesh&&!1===m.instancing||!r.isInstancedMesh&&!0===m.instancing||r.isSkinnedMesh&&!1===m.skinning||!r.isSkinnedMesh&&!0===m.skinning||m.envMap!==l||i.fog&&m.fog!==s||void 0!==m.numClippingPlanes&&(m.numClippingPlanes!==it.numPlanes||m.numIntersection!==it.numIntersection)||m.vertexAlphas!==c||m.vertexTangents!==h||m.morphTargets!==u||m.morphNormals!==d||m.toneMapping!==f||!0===H.isWebGL2&&m.morphTargetsCount!==p)&&(v=!0):(v=!0,m.__version=i.version);let x=m.currentProgram;!0===v&&(x=wt(i,e,r));let y=!1,_=!1,M=!1;const b=x.getUniforms(),S=m.uniforms;if(W.useProgram(x.program)&&(y=!0,_=!0,M=!0),i.id!==E&&(E=i.id,_=!0),y||L!==t){if(b.setValue(ut,"projectionMatrix",t.projectionMatrix),H.logarithmicDepthBuffer&&b.setValue(ut,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),L!==t&&(L=t,_=!0,M=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshStandardMaterial||i.envMap){const e=b.map.cameraPosition;void 0!==e&&e.setValue(ut,B.setFromMatrixPosition(t.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&b.setValue(ut,"isOrthographic",!0===t.isOrthographicCamera),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.isShadowMaterial||r.isSkinnedMesh)&&b.setValue(ut,"viewMatrix",t.matrixWorldInverse)}if(r.isSkinnedMesh){b.setOptional(ut,r,"bindMatrix"),b.setOptional(ut,r,"bindMatrixInverse");const t=r.skeleton;t&&(H.floatVertexTextures?(null===t.boneTexture&&t.computeBoneTexture(),b.setValue(ut,"boneTexture",t.boneTexture,q),b.setValue(ut,"boneTextureSize",t.boneTextureSize)):b.setOptional(ut,t,"boneMatrices"))}return!n||void 0===n.morphAttributes.position&&void 0===n.morphAttributes.normal||at.update(r,n,i,x),!_&&m.receiveShadow===r.receiveShadow||(m.receiveShadow=r.receiveShadow,b.setValue(ut,"receiveShadow",r.receiveShadow)),_&&(b.setValue(ut,"toneMappingExposure",T.toneMappingExposure),m.needsLights&&function(t,e){t.ambientLightColor.needsUpdate=e,t.lightProbe.needsUpdate=e,t.directionalLights.needsUpdate=e,t.directionalLightShadows.needsUpdate=e,t.pointLights.needsUpdate=e,t.pointLightShadows.needsUpdate=e,t.spotLights.needsUpdate=e,t.spotLightShadows.needsUpdate=e,t.rectAreaLights.needsUpdate=e,t.hemisphereLights.needsUpdate=e}(S,M),s&&i.fog&&tt.refreshFogUniforms(S,s),tt.refreshMaterialUniforms(S,i,P,C,U),xa.upload(ut,m.uniformsList,S,q)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(xa.upload(ut,m.uniformsList,S,q),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&b.setValue(ut,"center",r.center),b.setValue(ut,"modelViewMatrix",r.modelViewMatrix),b.setValue(ut,"normalMatrix",r.normalMatrix),b.setValue(ut,"modelMatrix",r.matrixWorld),x}(t,e,n,i,r);W.setMaterial(i,a);let l=n.index;var c=n.attributes.position;if(null===l){if(void 0===c||0===c.count)return}else if(0===l.count)return;let h,u=1;!0===i.wireframe&&(l=K.getWireframeAttribute(n),u=2),ht.setup(r,i,o,n,l);let d=ot;null!==l&&(h=J.get(l),d=lt,d.setIndex(h));t=(null!==l?l:c).count,e=n.drawRange.start*u,a=n.drawRange.count*u,o=null!==s?s.start*u:0,c=null!==s?s.count*u:1/0,s=Math.max(e,o),c=Math.min(t,e+a,o+c)-1,c=Math.max(0,c-s+1);if(0!==c){if(r.isMesh)!0===i.wireframe?(W.setLineWidth(i.wireframeLinewidth*V()),d.setMode(1)):d.setMode(4);else if(r.isLine){let t=i.linewidth;void 0===t&&(t=1),W.setLineWidth(t*V()),r.isLineSegments?d.setMode(1):r.isLineLoop?d.setMode(2):d.setMode(3)}else r.isPoints?d.setMode(0):r.isSprite&&d.setMode(4);if(r.isInstancedMesh)d.renderInstances(s,c,r.count);else if(n.isInstancedBufferGeometry){const p=Math.min(n.instanceCount,n._maxInstanceCount);d.renderInstances(s,c,p)}else d.render(s,c)}},this.compile=function(i,e){w=nt.get(i),w.init(),p.push(w),i.traverseVisible(function(t){t.isLight&&t.layers.test(e.layers)&&(w.pushLight(t),t.castShadow&&w.pushShadow(t))}),w.setupLights(T.physicallyCorrectLights),i.traverse(function(e){var n=e.material;if(n)if(Array.isArray(n))for(let t=0;t<n.length;t++)wt(n[t],i,e);else wt(n,i,e)}),p.pop(),w=null};let xt=null;function yt(){Mt.stop()}function _t(){Mt.start()}const Mt=new wr;function bt(t,e,n,i){var r=t.opaque,s=t.transmissive,t=t.transparent;w.setupLightsView(n),0<s.length&&function(t,e,n){if(null===U){const t=!0===a&&!0===H.isWebGL2,e=t?en:tn;U=new e(1024,1024,{generateMipmaps:!0,type:null!==ct.convert(Ft)?Ft:It,minFilter:Nt,magFilter:Rt,wrapS:Dt,wrapT:Dt,useRenderToTexture:G.has("WEBGL_multisampled_render_to_texture")})}var i=T.getRenderTarget();T.setRenderTarget(U),T.clear();var r=T.toneMapping;T.toneMapping=Pt,St(t,e,n),T.toneMapping=r,q.updateMultisampleRenderTarget(U),q.updateRenderTargetMipmap(U),T.setRenderTarget(i)}(r,e,n),i&&W.viewport(v.copy(i)),0<r.length&&St(r,e,n),0<s.length&&St(s,e,n),0<t.length&&St(t,e,n)}function St(n,i,r){var s,a,o,l,c,h,u=!0===i.isScene?i.overrideMaterial:null;for(let t=0,e=n.length;t<e;t++){const d=n[t],p=d.object,f=d.geometry,m=null===u?d.material:u,g=d.group;p.layers.test(r.layers)&&(s=p,a=i,o=r,l=f,c=m,h=g,s.onBeforeRender(T,a,o,l,c,h),s.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,s.matrixWorld),s.normalMatrix.getNormalMatrix(s.modelViewMatrix),c.onBeforeRender(T,a,o,l,s,h),!0===c.transparent&&c.side===Ct?(c.side=Lt,c.needsUpdate=!0,T.renderBufferDirect(o,a,l,c,s,h),c.side=Et,c.needsUpdate=!0,T.renderBufferDirect(o,a,l,c,s,h),c.side=Ct):T.renderBufferDirect(o,a,l,c,s,h),s.onAfterRender(T,a,o,l,c,h))}}function wt(t,e,n){!0!==e.isScene&&(e=k);const i=X.get(t),r=w.state.lights,s=w.state.shadowsArray,a=r.state.version,o=$.getParameters(t,r.state,s,e,n),l=$.getProgramCacheKey(o);let c=i.programs;i.environment=t.isMeshStandardMaterial?e.environment:null,i.fog=e.fog,i.envMap=(t.isMeshStandardMaterial?Z:Y).get(t.envMap||i.environment),void 0===c&&(t.addEventListener("dispose",vt),c=new Map,i.programs=c);let h=c.get(l);if(void 0!==h){if(i.currentProgram===h&&i.lightsStateVersion===a)return Tt(t,o),h}else o.uniforms=$.getUniforms(t),t.onBuild(n,o,T),t.onBeforeCompile(o,T),h=$.acquireProgram(o,l),c.set(l,h),i.uniforms=o.uniforms;const u=i.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(u.clippingPlanes=it.uniform),Tt(t,o),i.needsLights=(t=t).isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights,i.lightsStateVersion=a,i.needsLights&&(u.ambientLightColor.value=r.state.ambient,u.lightProbe.value=r.state.probe,u.directionalLights.value=r.state.directional,u.directionalLightShadows.value=r.state.directionalShadow,u.spotLights.value=r.state.spot,u.spotLightShadows.value=r.state.spotShadow,u.rectAreaLights.value=r.state.rectArea,u.ltc_1.value=r.state.rectAreaLTC1,u.ltc_2.value=r.state.rectAreaLTC2,u.pointLights.value=r.state.point,u.pointLightShadows.value=r.state.pointShadow,u.hemisphereLights.value=r.state.hemi,u.directionalShadowMap.value=r.state.directionalShadowMap,u.directionalShadowMatrix.value=r.state.directionalShadowMatrix,u.spotShadowMap.value=r.state.spotShadowMap,u.spotShadowMatrix.value=r.state.spotShadowMatrix,u.pointShadowMap.value=r.state.pointShadowMap,u.pointShadowMatrix.value=r.state.pointShadowMatrix);t=h.getUniforms(),t=xa.seqWithValue(t.seq,u);return i.currentProgram=h,i.uniformsList=t,h}function Tt(t,e){const n=X.get(t);n.outputEncoding=e.outputEncoding,n.instancing=e.instancing,n.skinning=e.skinning,n.morphTargets=e.morphTargets,n.morphNormals=e.morphNormals,n.morphTargetsCount=e.morphTargetsCount,n.numClippingPlanes=e.numClippingPlanes,n.numIntersection=e.numClipIntersection,n.vertexAlphas=e.vertexAlphas,n.vertexTangents=e.vertexTangents,n.toneMapping=e.toneMapping}Mt.setAnimationLoop(function(t){xt&&xt(t)}),"undefined"!=typeof window&&Mt.setContext(window),this.setAnimationLoop=function(t){xt=t,ft.setAnimationLoop(t),null===t?Mt.stop():Mt.start()},ft.addEventListener("sessionstart",yt),ft.addEventListener("sessionend",_t),this.render=function(n,t){if((void 0===t||!0===t.isCamera)&&!0!==f){!0===n.autoUpdate&&n.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),!0===ft.enabled&&!0===ft.isPresenting&&(!0===ft.cameraAutoUpdate&&ft.updateCamera(t),t=ft.getCamera()),!0===n.isScene&&n.onBeforeRender(T,n,t,A),w=nt.get(n,p.length),w.init(),p.push(w),F.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),I.setFromProjectionMatrix(F),z=this.localClippingEnabled,O=it.init(this.clippingPlanes,z,t),u=et.get(n,d.length),u.init(),d.push(u),function n(i,r,s,a){if(!1!==i.visible){const h=i.layers.test(r.layers);if(h)if(i.isGroup)s=i.renderOrder;else if(i.isLOD)!0===i.autoUpdate&&i.update(r);else if(i.isLight)w.pushLight(i),i.castShadow&&w.pushShadow(i);else if(i.isSprite){if(!i.frustumCulled||I.intersectsSprite(i)){a&&B.setFromMatrixPosition(i.matrixWorld).applyMatrix4(F);const r=Q.update(i),h=i.material;h.visible&&u.push(i,r,h,s,B.z,null)}}else if((i.isMesh||i.isLine||i.isPoints)&&(i.isSkinnedMesh&&i.skeleton.frame!==j.render.frame&&(i.skeleton.update(),i.skeleton.frame=j.render.frame),!i.frustumCulled||I.intersectsObject(i))){a&&B.setFromMatrixPosition(i.matrixWorld).applyMatrix4(F);const r=Q.update(i),h=i.material;if(Array.isArray(h)){const a=r.groups;for(let t=0,e=a.length;t<e;t++){var o=a[t],l=h[o.materialIndex];l&&l.visible&&u.push(i,r,l,s,B.z,o)}}else h.visible&&u.push(i,r,h,s,B.z,null)}var c=i.children;for(let t=0,e=c.length;t<e;t++)n(c[t],r,s,a)}}(n,t,0,T.sortObjects),u.finish(),!0===T.sortObjects&&u.sort(M,b),!0===O&&it.beginShadows();const r=w.state.shadowsArray;if(rt.render(r,n,t),!0===O&&it.endShadows(),!0===this.info.autoReset&&this.info.reset(),st.render(u,n),w.setupLights(T.physicallyCorrectLights),t.isArrayCamera){const r=t.cameras;for(let t=0,e=r.length;t<e;t++){var i=r[t];bt(u,n,i,i.viewport)}}else bt(u,n,t);null!==A&&(q.updateMultisampleRenderTarget(A),q.updateRenderTargetMipmap(A)),!0===n.isScene&&n.onAfterRender(T,n,t),W.buffers.depth.setTest(!0),W.buffers.depth.setMask(!0),W.buffers.color.setMask(!0),W.setPolygonOffset(!1),ht.resetDefaultState(),E=-1,L=null,p.pop(),w=0<p.length?p[p.length-1]:null,d.pop(),u=0<d.length?d[d.length-1]:null}},this.getActiveCubeFace=function(){return m},this.getActiveMipmapLevel=function(){return g},this.getRenderTarget=function(){return A},this.setRenderTargetTextures=function(t,e,n){X.get(t.texture).__webglTexture=e,X.get(t.depthTexture).__webglTexture=n;const i=X.get(t);i.__hasExternalTextures=!0,i.__hasExternalTextures&&(i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||t.useRenderToTexture&&(t.useRenderToTexture=!1,t.useRenderbuffer=!0))},this.setRenderTargetFramebuffer=function(t,e){const n=X.get(t);n.__webglFramebuffer=e,n.__useDefaultFramebuffer=void 0===e},this.setRenderTarget=function(e,t=0,n=0){A=e,m=t,g=n;let i=!0;if(e){const t=X.get(e);void 0!==t.__useDefaultFramebuffer?(W.bindFramebuffer(36160,null),i=!1):void 0===t.__webglFramebuffer?q.setupRenderTarget(e):t.__hasExternalTextures&&q.rebindTextures(e,X.get(e.texture).__webglTexture,X.get(e.depthTexture).__webglTexture)}let r=null,s=!1,a=!1;if(e){const n=e.texture;(n.isDataTexture3D||n.isDataTexture2DArray)&&(a=!0);const i=X.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=i[t],s=!0):r=e.useRenderbuffer?X.get(e).__webglMultisampledFramebuffer:i,v.copy(e.viewport),x.copy(e.scissor),y=e.scissorTest}else v.copy(S).multiplyScalar(P).floor(),x.copy(D).multiplyScalar(P).floor(),y=R;if(W.bindFramebuffer(36160,r)&&H.drawBuffers&&i){let t=!1;if(e)if(e.isWebGLMultipleRenderTargets){const n=e.texture;if(N.length!==n.length||36064!==N[0]){for(let t=0,e=n.length;t<e;t++)N[t]=36064+t;N.length=n.length,t=!0}}else 1===N.length&&36064===N[0]||(N[0]=36064,N.length=1,t=!0);else 1===N.length&&1029===N[0]||(N[0]=1029,N.length=1,t=!0);t&&(H.isWebGL2?ut.drawBuffers(N):G.get("WEBGL_draw_buffers").drawBuffersWEBGL(N))}if(W.viewport(v),W.scissor(x),W.setScissorTest(y),s){const i=X.get(e.texture);ut.framebufferTexture2D(36160,36064,34069+t,i.__webglTexture,n)}else if(a){const i=X.get(e.texture),r=t||0;ut.framebufferTextureLayer(36160,36064,i.__webglTexture,n||0,r)}E=-1},this.readRenderTargetPixels=function(e,n,i,r,s,a,o){if(e&&e.isWebGLRenderTarget){let t=X.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(t=t[o]),t){W.bindFramebuffer(36160,t);try{const o=e.texture,t=o.format,c=o.type;if(t!==Vt&&ct.convert(t)!==ut.getParameter(35739))return;var l=c===Ft&&(G.has("EXT_color_buffer_half_float")||H.isWebGL2&&G.has("EXT_color_buffer_float"));if(!(c===It||ct.convert(c)===ut.getParameter(35738)||c===Ut&&(H.isWebGL2||G.has("OES_texture_float")||G.has("WEBGL_color_buffer_float"))||l))return;36053!==ut.checkFramebufferStatus(36160)||0<=n&&n<=e.width-r&&0<=i&&i<=e.height-s&&ut.readPixels(n,i,r,s,ct.convert(t),ct.convert(c),a)}finally{const e=null!==A?X.get(A).__webglFramebuffer:null;W.bindFramebuffer(36160,e)}}}},this.copyFramebufferToTexture=function(t,e,n=0){var i,r;!0===e.isFramebufferTexture&&(r=Math.pow(2,-n),i=Math.floor(e.image.width*r),r=Math.floor(e.image.height*r),q.setTexture2D(e,0),ut.copyTexSubImage2D(3553,n,0,0,t.x,t.y,i,r),W.unbindTexture())},this.copyTextureToTexture=function(t,e,n,i=0){var r=e.image.width,s=e.image.height,a=ct.convert(n.format),o=ct.convert(n.type);q.setTexture2D(n,0),ut.pixelStorei(37440,n.flipY),ut.pixelStorei(37441,n.premultiplyAlpha),ut.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?ut.texSubImage2D(3553,i,t.x,t.y,r,s,a,o,e.image.data):e.isCompressedTexture?ut.compressedTexSubImage2D(3553,i,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,a,e.mipmaps[0].data):ut.texSubImage2D(3553,i,t.x,t.y,a,o,e.image),0===i&&n.generateMipmaps&&ut.generateMipmap(3553),W.unbindTexture()},this.copyTextureToTexture3D=function(e,n,i,r,s=0){if(!T.isWebGL1Renderer){var a=e.max.x-e.min.x+1,o=e.max.y-e.min.y+1,l=e.max.z-e.min.z+1,c=ct.convert(r.format),h=ct.convert(r.type);let t;if(r.isDataTexture3D)q.setTexture3D(r,0),t=32879;else{if(!r.isDataTexture2DArray)return;q.setTexture2DArray(r,0),t=35866}ut.pixelStorei(37440,r.flipY),ut.pixelStorei(37441,r.premultiplyAlpha),ut.pixelStorei(3317,r.unpackAlignment);var u=ut.getParameter(3314),d=ut.getParameter(32878),p=ut.getParameter(3316),f=ut.getParameter(3315),m=ut.getParameter(32877),g=i.isCompressedTexture?i.mipmaps[0]:i.image;ut.pixelStorei(3314,g.width),ut.pixelStorei(32878,g.height),ut.pixelStorei(3316,e.min.x),ut.pixelStorei(3315,e.min.y),ut.pixelStorei(32877,e.min.z),i.isDataTexture||i.isDataTexture3D?ut.texSubImage3D(t,s,n.x,n.y,n.z,a,o,l,c,h,g.data):i.isCompressedTexture?ut.compressedTexSubImage3D(t,s,n.x,n.y,n.z,a,o,l,c,g.data):ut.texSubImage3D(t,s,n.x,n.y,n.z,a,o,l,c,h,g),ut.pixelStorei(3314,u),ut.pixelStorei(32878,d),ut.pixelStorei(3316,p),ut.pixelStorei(3315,f),ut.pixelStorei(32877,m),0===s&&r.generateMipmaps&&ut.generateMipmap(t),W.unbindTexture()}},this.initTexture=function(t){q.setTexture2D(t,0),W.unbindTexture()},this.resetState=function(){m=0,g=0,A=null,W.reset(),ht.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}fo.prototype.isWebGLRenderer=!0;(class Xc{constructor(t,e=1,n=1e3){this.name="",this.color=new Ai(t),this.near=e,this.far=n}clone(){return new Xc(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}).prototype.isFog=class qc{constructor(t,e=25e-5){this.name="",this.color=new Ai(t),this.density=e}clone(){return new qc(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}.prototype.isFogExp2=class extends fo{}.prototype.isWebGL1Renderer=!0;class mo extends ai{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}mo.prototype.isScene=!0;class go{constructor(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=Le,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=ze()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(n,i,r){n*=this.stride,r*=i.stride;for(let t=0,e=this.stride;t<e;t++)this.array[n+t]=i.array[r+t];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=ze()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(e,this.stride);return n.setUsage(this.usage),n}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=ze()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}go.prototype.isInterleavedBuffer=!0;const vo=new rn;class xo{constructor(t,e,n,i=!1){this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=!0===i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(n){for(let t=0,e=this.data.count;t<e;t++)vo.x=this.getX(t),vo.y=this.getY(t),vo.z=this.getZ(t),vo.applyMatrix4(n),this.setXYZ(t,vo.x,vo.y,vo.z);return this}applyNormalMatrix(n){for(let t=0,e=this.count;t<e;t++)vo.x=this.getX(t),vo.y=this.getY(t),vo.z=this.getZ(t),vo.applyNormalMatrix(n),this.setXYZ(t,vo.x,vo.y,vo.z);return this}transformDirection(n){for(let t=0,e=this.count;t<e;t++)vo.x=this.getX(t),vo.y=this.getY(t),vo.z=this.getZ(t),vo.transformDirection(n),this.setXYZ(t,vo.x,vo.y,vo.z);return this}setX(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){return this.data.array[t*this.data.stride+this.offset]}getY(t){return this.data.array[t*this.data.stride+this.offset+1]}getZ(t){return this.data.array[t*this.data.stride+this.offset+2]}getW(t){return this.data.array[t*this.data.stride+this.offset+3]}setXY(t,e,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this}setXYZ(t,e,n,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this}setXYZW(t,e,n,i,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this.data.array[t+3]=r,this}clone(e){if(void 0!==e)return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new xo(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized);{const e=[];for(let t=0;t<this.count;t++){var n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return new Pi(new this.array.constructor(e),this.itemSize,this.normalized)}}toJSON(e){if(void 0!==e)return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized};{const e=[];for(let t=0;t<this.count;t++){var n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}}}xo.prototype.isInterleavedBufferAttribute=!0;class yo extends yi{constructor(t){super(),this.type="SpriteMaterial",this.color=new Ai(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this}}yo.prototype.isSpriteMaterial=!0;new rn,new rn,new rn,new We,new We,new On,new rn,new rn,new rn,new We,new We,new We;(class extends ai{});const _o=new rn,Mo=new $e,bo=new $e,So=new rn,wo=new On;class To extends sr{constructor(t,e){super(t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new On,this.bindMatrixInverse=new On}copy(t){return super.copy(t),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,this}bind(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const n=new $e,i=this.geometry.attributes.skinWeight;for(let t=0,e=i.count;t<e;t++){n.x=i.getX(t),n.y=i.getY(t),n.z=i.getZ(t),n.w=i.getW(t);var r=1/n.manhattanLength();r!=1/0?n.multiplyScalar(r):n.set(1,0,0,0),i.setXYZW(t,n.x,n.y,n.z,n.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}boneTransform(e,n){const i=this.skeleton,r=this.geometry;Mo.fromBufferAttribute(r.attributes.skinIndex,e),bo.fromBufferAttribute(r.attributes.skinWeight,e),_o.copy(n).applyMatrix4(this.bindMatrix),n.set(0,0,0);for(let t=0;t<4;t++){const e=bo.getComponent(t);if(0!==e){const r=Mo.getComponent(t);wo.multiplyMatrices(i.bones[r].matrixWorld,i.boneInverses[r]),n.addScaledVector(So.copy(_o).applyMatrix4(wo),e)}}return n.applyMatrix4(this.bindMatrixInverse)}}To.prototype.isSkinnedMesh=!0;class Ao extends ai{constructor(){super(),this.type="Bone"}}Ao.prototype.isBone=!0;class Eo extends Ke{constructor(t=null,e=1,n=1,i,r,s,a,o,l=Rt,c=Rt,h,u){super(null,s,a,o,l,c,i,r,h,u),this.image={data:t,width:e,height:n},this.magFilter=l,this.minFilter=c,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}Eo.prototype.isDataTexture=!0;const Lo=new On,Co=new On;class Po{constructor(t=[],e=[]){this.uuid=ze(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){var t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),0===e.length)this.calculateInverses();else if(t.length!==e.length){this.boneInverses=[];for(let t=0,e=this.bones.length;t<e;t++)this.boneInverses.push(new On)}}calculateInverses(){for(let t=this.boneInverses.length=0,e=this.bones.length;t<e;t++){const n=new On;this.bones[t]&&n.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){const n=this.bones[t];n&&n.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){const i=this.bones[t];i&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}}update(){const n=this.bones,i=this.boneInverses,r=this.boneMatrices,s=this.boneTexture;for(let t=0,e=n.length;t<e;t++){const s=n[t]?n[t].matrixWorld:Co;Lo.multiplyMatrices(s,i[t]),Lo.toArray(r,16*t)}null!==s&&(s.needsUpdate=!0)}clone(){return new Po(this.bones,this.boneInverses)}computeBoneTexture(){var t=Ve(t=Math.sqrt(4*this.bones.length));t=Math.max(t,4);const e=new Float32Array(t*t*4);e.set(this.boneMatrices);const n=new Eo(e,t,t,Vt,Ut);return n.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=n,this.boneTextureSize=t,this}getBoneByName(n){for(let t=0,e=this.bones.length;t<e;t++){var i=this.bones[t];if(i.name===n)return i}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(n,i){this.uuid=n.uuid;for(let e=0,t=n.bones.length;e<t;e++){var r=n.bones[e];let t=i[r];void 0===t&&(t=new Ao),this.bones.push(t),this.boneInverses.push((new On).fromArray(n.boneInverses[e]))}return this.init(),this}toJSON(){const n={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};n.uuid=this.uuid;var i=this.bones,r=this.boneInverses;for(let t=0,e=i.length;t<e;t++){var s=i[t];n.bones.push(s.uuid);const a=r[t];n.boneInverses.push(a.toArray())}return n}}class Do extends Pi{constructor(t,e,n,i=1){"number"==typeof n&&(i=n,n=!1),super(t,e,n),this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}Do.prototype.isInstancedBufferAttribute=!0;new On,new On,new sr;(class extends sr{});class Ro extends yi{constructor(t){super(),this.type="LineBasicMaterial",this.color=new Ai(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this}}Ro.prototype.isLineBasicMaterial=!0;const No=new rn,Io=new rn,Oo=new On,zo=new In,Uo=new An;class Fo extends ai{constructor(t=new Vi,e=new Ro){super(),this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry){if(null===t.index){const n=t.attributes.position,i=[0];for(let t=1,e=n.count;t<e;t++)No.fromBufferAttribute(n,t-1),Io.fromBufferAttribute(n,t),i[t]=i[t-1],i[t]+=No.distanceTo(Io);t.setAttribute("lineDistance",new Ni(i,1))}}else t.isGeometry;return this}raycast(n,i){const r=this.geometry,s=this.matrixWorld,a=n.params.Line.threshold,t=r.drawRange;if(null===r.boundingSphere&&r.computeBoundingSphere(),Uo.copy(r.boundingSphere),Uo.applyMatrix4(s),Uo.radius+=a,!1!==n.ray.intersectsSphere(Uo)){Oo.copy(s).invert(),zo.copy(n.ray).applyMatrix4(Oo);const l=a/((this.scale.x+this.scale.y+this.scale.z)/3),c=l*l,h=new rn,u=new rn,d=new rn,p=new rn,f=this.isLineSegments?2:1;if(r.isBufferGeometry){const s=r.index,a=r.attributes,l=a.position;if(null!==s){const r=Math.max(0,t.start),a=Math.min(s.count,t.start+t.count);for(let t=r,e=a-1;t<e;t+=f){const r=s.getX(t),a=s.getX(t+1);h.fromBufferAttribute(l,r),u.fromBufferAttribute(l,a);const f=zo.distanceSqToSegment(h,u,p,d);var o;f>c||(p.applyMatrix4(this.matrixWorld),(o=n.ray.origin.distanceTo(p))<n.near||o>n.far||i.push({distance:o,point:d.clone().applyMatrix4(this.matrixWorld),index:t,face:null,faceIndex:null,object:this}))}}else{const r=Math.max(0,t.start),s=Math.min(l.count,t.start+t.count);for(let t=r,e=s-1;t<e;t+=f){h.fromBufferAttribute(l,t),u.fromBufferAttribute(l,t+1);const r=zo.distanceSqToSegment(h,u,p,d);if(!(r>c)){p.applyMatrix4(this.matrixWorld);const s=n.ray.origin.distanceTo(p);s<n.near||s>n.far||i.push({distance:s,point:d.clone().applyMatrix4(this.matrixWorld),index:t,face:null,faceIndex:null,object:this})}}}}else r.isGeometry}}updateMorphTargets(){const n=this.geometry;if(n.isBufferGeometry){var t=n.morphAttributes,e=Object.keys(t);if(0<e.length){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;t<e;t++){var i=n[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=t}}}}else{e=n.morphTargets;void 0!==e&&e.length}}}Fo.prototype.isLine=!0;const Bo=new rn,ko=new rn;class Vo extends Fo{constructor(t,e){super(t,e),this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry){if(null===t.index){const n=t.attributes.position,i=[];for(let t=0,e=n.count;t<e;t+=2)Bo.fromBufferAttribute(n,t),ko.fromBufferAttribute(n,t+1),i[t]=0===t?0:i[t-1],i[t+1]=i[t]+Bo.distanceTo(ko);t.setAttribute("lineDistance",new Ni(i,1))}}else t.isGeometry;return this}}Vo.prototype.isLineSegments=!0;class Go extends Fo{constructor(t,e){super(t,e),this.type="LineLoop"}}Go.prototype.isLineLoop=!0;class Ho extends yi{constructor(t){super(),this.type="PointsMaterial",this.color=new Ai(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this}}Ho.prototype.isPointsMaterial=!0;const Wo=new On,jo=new In,Xo=new An,qo=new rn;class Yo extends ai{constructor(t=new Vi,e=new Ho){super(),this.type="Points",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}raycast(n,i){const r=this.geometry,s=this.matrixWorld,a=n.params.Points.threshold,t=r.drawRange;if(null===r.boundingSphere&&r.computeBoundingSphere(),Xo.copy(r.boundingSphere),Xo.applyMatrix4(s),Xo.radius+=a,!1!==n.ray.intersectsSphere(Xo)){Wo.copy(s).invert(),jo.copy(n.ray).applyMatrix4(Wo);const o=a/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o;if(r.isBufferGeometry){const a=r.index,o=r.attributes,c=o.position;if(null!==a){const r=Math.max(0,t.start),o=Math.min(a.count,t.start+t.count);for(let t=r,e=o;t<e;t++){const r=a.getX(t);qo.fromBufferAttribute(c,r),Zo(qo,r,l,s,n,i,this)}}else{const r=Math.max(0,t.start),a=Math.min(c.count,t.start+t.count);for(let t=r,e=a;t<e;t++)qo.fromBufferAttribute(c,t),Zo(qo,t,l,s,n,i,this)}}}}updateMorphTargets(){const n=this.geometry;if(n.isBufferGeometry){var t=n.morphAttributes,e=Object.keys(t);if(0<e.length){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;t<e;t++){var i=n[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=t}}}}else{e=n.morphTargets;void 0!==e&&e.length}}}function Zo(t,e,n,i,r,s,a){var o=jo.distanceSqToPoint(t);if(o<n){const n=new rn;jo.closestPointToPoint(t,n),n.applyMatrix4(i);i=r.ray.origin.distanceTo(n);i<r.near||i>r.far||s.push({distance:i,distanceToRay:Math.sqrt(o),point:n,index:e,face:null,object:a})}}Yo.prototype.isPoints=!0;(class extends Ke{});(class extends Ke{});(class extends Ke{});(class extends Ke{});new rn,new rn,new rn,new vi;class Jo{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return null}getPointAt(t,e){t=this.getUtoTmapping(t);return this.getPoint(t,e)}getPoints(e=5){const n=[];for(let t=0;t<=e;t++)n.push(this.getPoint(t/e));return n}getSpacedPoints(e=5){const n=[];for(let t=0;t<=e;t++)n.push(this.getPointAt(t/e));return n}getLength(){var t=this.getLengths();return t[t.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const n=[];let i,r=this.getPoint(0),s=0;n.push(0);for(let t=1;t<=e;t++)i=this.getPoint(t/e),s+=i.distanceTo(r),n.push(s),r=i;return this.cacheArcLengths=n,n}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){var n=this.getLengths();let i=0;var r=n.length,s=e||t*n[r-1];let a,o=0,l=r-1;for(;o<=l;)if(i=Math.floor(o+(l-o)/2),(a=n[i]-s)<0)o=i+1;else{if(!(0<a)){l=i;break}l=i-1}if(i=l,n[i]===s)return i/(r-1);e=n[i],t=n[i+1];return(i+(s-e)/(t-e))/(r-1)}getTangent(t,e){let n=t-1e-4,i=t+1e-4;n<0&&(n=0),1<i&&(i=1);const r=this.getPoint(n),s=this.getPoint(i),a=e||new(r.isVector2?We:rn);return a.copy(s).sub(r).normalize(),a}getTangentAt(t,e){t=this.getUtoTmapping(t);return this.getTangent(t,e)}computeFrenetFrames(n,e){const t=new rn,i=[],r=[],s=[],a=new rn,o=new On;for(let t=0;t<=n;t++){const e=t/n;i[t]=this.getTangentAt(e,new rn)}r[0]=new rn,s[0]=new rn;let l=Number.MAX_VALUE;var c=Math.abs(i[0].x),h=Math.abs(i[0].y),u=Math.abs(i[0].z);c<=l&&(l=c,t.set(1,0,0)),h<=l&&(l=h,t.set(0,1,0)),u<=l&&t.set(0,0,1),a.crossVectors(i[0],t).normalize(),r[0].crossVectors(i[0],a),s[0].crossVectors(i[0],r[0]);for(let t=1;t<=n;t++){if(r[t]=r[t-1].clone(),s[t]=s[t-1].clone(),a.crossVectors(i[t-1],i[t]),a.length()>Number.EPSILON){a.normalize();const n=Math.acos(Ue(i[t-1].dot(i[t]),-1,1));r[t].applyMatrix4(o.makeRotationAxis(a,n))}s[t].crossVectors(i[t],r[t])}if(!0===e){let e=Math.acos(Ue(r[0].dot(r[n]),-1,1));e/=n,0<i[0].dot(a.crossVectors(r[0],r[n]))&&(e=-e);for(let t=1;t<=n;t++)r[t].applyMatrix4(o.makeRotationAxis(i[t],e*t)),s[t].crossVectors(i[t],r[t])}return{tangents:i,normals:r,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class Ko extends Jo{constructor(t=0,e=0,n=1,i=1,r=0,s=2*Math.PI,a=!1,o=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=a,this.aRotation=o}getPoint(t,e){const n=e||new We,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;for(e=Math.abs(r)<Number.EPSILON;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=e?0:i),!0!==this.aClockwise||e||(r===i?r=-i:r-=i);t=this.aStartAngle+t*r;let s=this.aX+this.xRadius*Math.cos(t),a=this.aY+this.yRadius*Math.sin(t);if(0!==this.aRotation){const o=Math.cos(this.aRotation),l=Math.sin(this.aRotation),n=s-this.aX,i=a-this.aY;s=n*o-i*l+this.aX,a=n*l+i*o+this.aY}return n.set(s,a)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}Ko.prototype.isEllipseCurve=!0;class Qo extends Ko{constructor(t,e,n,i,r,s){super(t,e,n,n,i,r,s),this.type="ArcCurve"}}function $o(){let r=0,s=0,a=0,o=0;function l(t,e,n,i){r=t,s=n,a=-3*t+3*e-2*n-i,o=2*t-2*e+n+i}return{initCatmullRom:function(t,e,n,i,r){l(e,n,r*(n-t),r*(i-e))},initNonuniformCatmullRom:function(t,e,n,i,r,s,a){r=(e-t)/r-(n-t)/(r+s)+(n-e)/s,a=(n-e)/s-(i-e)/(s+a)+(i-n)/a;l(e,n,r*=s,a*=s)},calc:function(t){var e=t*t,n=e*t;return r+s*t+a*e+o*n}}}Qo.prototype.isArcCurve=!0;const tl=new rn,el=new $o,nl=new $o,il=new $o;class rl extends Jo{constructor(t=[],e=!1,n="centripetal",i=.5){super(),this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=i}getPoint(i,t=new rn){const e=t,n=this.points,r=n.length,s=(r-(this.closed?0:1))*i;let a,o,l=Math.floor(s),c=s-l;this.closed?l+=0<l?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),a=this.closed||0<l?n[(l-1)%r]:(tl.subVectors(n[0],n[1]).add(n[0]),tl);const h=n[l%r],u=n[(l+1)%r];if(o=this.closed||l+2<r?n[(l+2)%r]:(tl.subVectors(n[r-1],n[r-2]).add(n[r-1]),tl),"centripetal"===this.curveType||"chordal"===this.curveType){const i="chordal"===this.curveType?.5:.25;let t=Math.pow(a.distanceToSquared(h),i),e=Math.pow(h.distanceToSquared(u),i),n=Math.pow(u.distanceToSquared(o),i);e<1e-4&&(e=1),t<1e-4&&(t=e),n<1e-4&&(n=e),el.initNonuniformCatmullRom(a.x,h.x,u.x,o.x,t,e,n),nl.initNonuniformCatmullRom(a.y,h.y,u.y,o.y,t,e,n),il.initNonuniformCatmullRom(a.z,h.z,u.z,o.z,t,e,n)}else"catmullrom"===this.curveType&&(el.initCatmullRom(a.x,h.x,u.x,o.x,this.tension),nl.initCatmullRom(a.y,h.y,u.y,o.y,this.tension),il.initCatmullRom(a.z,h.z,u.z,o.z,this.tension));return e.set(el.calc(c),nl.calc(c),il.calc(c)),e}copy(n){super.copy(n),this.points=[];for(let t=0,e=n.points.length;t<e;t++){const i=n.points[t];this.points.push(i.clone())}return this.closed=n.closed,this.curveType=n.curveType,this.tension=n.tension,this}toJSON(){const n=super.toJSON();n.points=[];for(let t=0,e=this.points.length;t<e;t++){const i=this.points[t];n.points.push(i.toArray())}return n.closed=this.closed,n.curveType=this.curveType,n.tension=this.tension,n}fromJSON(n){super.fromJSON(n),this.points=[];for(let t=0,e=n.points.length;t<e;t++){var i=n.points[t];this.points.push((new rn).fromArray(i))}return this.closed=n.closed,this.curveType=n.curveType,this.tension=n.tension,this}}function sl(t,e,n,i,r){var s=.5*(i-e),e=.5*(r-n),r=t*t;return(2*n-2*i+s+e)*(t*r)+(-3*n+3*i-2*s-e)*r+s*t+n}function al(t,e,n,i){return(r=1-(r=t))*r*e+2*(1-t)*t*n+t*t*i;var r}function ol(t,e,n,i,r){return(s=1-(s=t))*s*s*e+3*(e=1-t)*e*t*n+3*(1-t)*t*t*i+t*t*t*r;var s}rl.prototype.isCatmullRomCurve3=!0;class ll extends Jo{constructor(t=new We,e=new We,n=new We,i=new We){super(),this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new We){const n=e,i=this.v0,r=this.v1,s=this.v2,a=this.v3;return n.set(ol(t,i.x,r.x,s.x,a.x),ol(t,i.y,r.y,s.y,a.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}ll.prototype.isCubicBezierCurve=!0;class cl extends Jo{constructor(t=new rn,e=new rn,n=new rn,i=new rn){super(),this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new rn){const n=e,i=this.v0,r=this.v1,s=this.v2,a=this.v3;return n.set(ol(t,i.x,r.x,s.x,a.x),ol(t,i.y,r.y,s.y,a.y),ol(t,i.z,r.z,s.z,a.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class hl extends Jo{constructor(t=new We,e=new We){super(),this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new We){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){const n=e||new We;return n.copy(this.v2).sub(this.v1).normalize(),n}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}hl.prototype.isLineCurve=cl.prototype.isCubicBezierCurve3=!0;Jo;class ul extends Jo{constructor(t=new We,e=new We,n=new We){super(),this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new We){const n=e,i=this.v0,r=this.v1,s=this.v2;return n.set(al(t,i.x,r.x,s.x),al(t,i.y,r.y,s.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}ul.prototype.isQuadraticBezierCurve=!0;class dl extends Jo{constructor(t=new rn,e=new rn,n=new rn){super(),this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new rn){const n=e,i=this.v0,r=this.v1,s=this.v2;return n.set(al(t,i.x,r.x,s.x),al(t,i.y,r.y,s.y),al(t,i.z,r.z,s.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class pl extends Jo{constructor(t=[]){super(),this.type="SplineCurve",this.points=t}getPoint(t,e=new We){const n=e,i=this.points,r=(i.length-1)*t,s=Math.floor(r),a=r-s,o=i[0===s?s:s-1],l=i[s],c=i[s>i.length-2?i.length-1:s+1],h=i[s>i.length-3?i.length-1:s+2];return n.set(sl(a,o.x,l.x,c.x,h.x),sl(a,o.y,l.y,c.y,h.y)),n}copy(n){super.copy(n),this.points=[];for(let t=0,e=n.points.length;t<e;t++){const i=n.points[t];this.points.push(i.clone())}return this}toJSON(){const n=super.toJSON();n.points=[];for(let t=0,e=this.points.length;t<e;t++){const i=this.points[t];n.points.push(i.toArray())}return n}fromJSON(n){super.fromJSON(n),this.points=[];for(let t=0,e=n.points.length;t<e;t++){var i=n.points[t];this.points.push((new We).fromArray(i))}return this}}pl.prototype.isSplineCurve=dl.prototype.isQuadraticBezierCurve3=!0;var fl=Object.freeze({__proto__:null,ArcCurve:Qo,CatmullRomCurve3:rl,CubicBezierCurve:ll,CubicBezierCurve3:cl,EllipseCurve:Ko,LineCurve:hl,LineCurve3:class extends Jo{constructor(t=new rn,e=new rn){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=t,this.v2=e}getPoint(t,e=new rn){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},QuadraticBezierCurve:ul,QuadraticBezierCurve3:dl,SplineCurve:pl});class ml extends Jo{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new hl(e,t))}getPoint(t,e){var n=t*this.getLength(),i=this.getCurveLengths();let r=0;for(;r<i.length;){if(i[r]>=n){const t=i[r]-n,s=this.curves[r],a=s.getLength(),o=0===a?0:1-t/a;return s.getPointAt(o,e)}r++}return null}getLength(){var t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const n=[];let i=0;for(let t=0,e=this.curves.length;t<e;t++)i+=this.curves[t].getLength(),n.push(i);return this.cacheLengths=n,n}getSpacedPoints(e=40){const n=[];for(let t=0;t<=e;t++)n.push(this.getPoint(t/e));return this.autoClose&&n.push(n[0]),n}getPoints(n=12){const i=[];let r;for(let t=0,e=this.curves;t<e.length;t++){const a=e[t],o=a&&a.isEllipseCurve?2*n:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?n*a.points.length:n,l=a.getPoints(o);for(let t=0;t<l.length;t++){var s=l[t];r&&r.equals(s)||(i.push(s),r=s)}}return this.autoClose&&1<i.length&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}copy(n){super.copy(n),this.curves=[];for(let t=0,e=n.curves.length;t<e;t++){const i=n.curves[t];this.curves.push(i.clone())}return this.autoClose=n.autoClose,this}toJSON(){const n=super.toJSON();n.autoClose=this.autoClose,n.curves=[];for(let t=0,e=this.curves.length;t<e;t++){const i=this.curves[t];n.curves.push(i.toJSON())}return n}fromJSON(n){super.fromJSON(n),this.autoClose=n.autoClose,this.curves=[];for(let t=0,e=n.curves.length;t<e;t++){var i=n.curves[t];this.curves.push((new fl[i.type]).fromJSON(i))}return this}}class gl extends ml{constructor(t){super(),this.type="Path",this.currentPoint=new We,t&&this.setFromPoints(t)}setFromPoints(n){this.moveTo(n[0].x,n[0].y);for(let t=1,e=n.length;t<e;t++)this.lineTo(n[t].x,n[t].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){var n=new hl(this.currentPoint.clone(),new We(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,i){e=new ul(this.currentPoint.clone(),new We(t,e),new We(n,i));return this.curves.push(e),this.currentPoint.set(n,i),this}bezierCurveTo(t,e,n,i,r,s){i=new ll(this.currentPoint.clone(),new We(t,e),new We(n,i),new We(r,s));return this.curves.push(i),this.currentPoint.set(r,s),this}splineThru(t){var e=[this.currentPoint.clone()].concat(t),e=new pl(e);return this.curves.push(e),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,i,r,s){var a=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(t+a,e+o,n,i,r,s),this}absarc(t,e,n,i,r,s){return this.absellipse(t,e,n,n,i,r,s),this}ellipse(t,e,n,i,r,s,a,o){var l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(t+l,e+c,n,i,r,s,a,o),this}absellipse(t,e,n,i,r,s,a,o){const l=new Ko(t,e,n,i,r,s,a,o);if(0<this.curves.length){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);o=l.getPoint(1);return this.currentPoint.copy(o),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class vl extends gl{constructor(t){super(t),this.uuid=ze(),this.type="Shape",this.holes=[]}getPointsHoles(n){const i=[];for(let t=0,e=this.holes.length;t<e;t++)i[t]=this.holes[t].getPoints(n);return i}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(n){super.copy(n),this.holes=[];for(let t=0,e=n.holes.length;t<e;t++){const i=n.holes[t];this.holes.push(i.clone())}return this}toJSON(){const n=super.toJSON();n.uuid=this.uuid,n.holes=[];for(let t=0,e=this.holes.length;t<e;t++){const i=this.holes[t];n.holes.push(i.toJSON())}return n}fromJSON(n){super.fromJSON(n),this.uuid=n.uuid,this.holes=[];for(let t=0,e=n.holes.length;t<e;t++){var i=n.holes[t];this.holes.push((new gl).fromJSON(i))}return this}}const xl={triangulate:function(e,t,n=2){var i=t&&t.length,r=i?t[0]*n:e.length;let s=yl(e,0,r,n,!0);var a=[];if(!s||s.next===s.prev)return a;let o,l,c,h,u,d,p;if(i&&(s=function(t,e,n,i){const r=[];let s,a,o,l,c;for(s=0,a=e.length;s<a;s++)o=e[s]*i,l=s<a-1?e[s+1]*i:t.length,c=yl(t,o,l,i,!1),c===c.next&&(c.steiner=!0),r.push(function(t){let e=t,n=t;for(;(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next,e!==t;);return n}(c));for(r.sort(bl),s=0;s<r.length;s++)(function(t,e){(e=function(t,e){let n=e;var i=t.x,r=t.y;let s,a=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){const t=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=i&&t>a){if((a=t)===i){if(r===n.y)return n;if(r===n.next.y)return n.next}s=n.x<n.next.x?n:n.next}}}while(n=n.next,n!==e);if(!s)return null;if(i===a)return s;var o=s,l=s.x,c=s.y;let h,u=1/0;n=s;for(;i>=n.x&&n.x>=l&&i!==n.x&&wl(r<c?i:a,r,l,c,r<c?a:i,r,n.x,n.y)&&(h=Math.abs(r-n.y)/(i-n.x),Pl(n,t)&&(h<u||h===u&&(n.x>s.x||n.x===s.x&&function(t,e){return Tl(t.prev,t,e.prev)<0&&Tl(e.next,t,t.next)<0}(s,n)))&&(s=n,u=h)),n=n.next,n!==o;);return s}(t,e))&&(t=Dl(e,t),_l(e,e.next),_l(t,t.next))})(r[s],n),n=_l(n,n.next);return n}(e,t,s,n)),e.length>80*n){o=c=e[0],l=h=e[1];for(let t=n;t<r;t+=n)u=e[t],d=e[t+1],u<o&&(o=u),d<l&&(l=d),u>c&&(c=u),d>h&&(h=d);p=Math.max(c-o,h-l),p=0!==p?1/p:0}return Ml(s,a,n,o,l,p),a}};function yl(t,e,n,i,r){let s,a;if(r===0<function(n,i,r,s){let a=0;for(let t=i,e=r-s;t<r;t+=s)a+=(n[e]-n[t])*(n[t+1]+n[e+1]),e=t;return a}(t,e,n,i))for(s=e;s<n;s+=i)a=Rl(s,t[s],t[s+1],a);else for(s=n-i;s>=e;s-=i)a=Rl(s,t[s],t[s+1],a);return a&&Al(a,a.next)&&(Nl(a),a=a.next),a}function _l(t,e){if(!t)return t;e=e||t;let n,i=t;do{if(n=!1,i.steiner||!Al(i,i.next)&&0!==Tl(i.prev,i,i.next))i=i.next;else{if(Nl(i),i=e=i.prev,i===i.next)break;n=!0}}while(n||i!==e);return e}function Ml(i,r,s,a,o,l,c){if(i){!c&&l&&function(t,e,n,i){let r=t;for(;null===r.z&&(r.z=Sl(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next,r!==t;);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,n,i,r,s,a,o,l,c=1;do{for(n=t,t=null,s=null,a=0;n;){for(a++,i=n,o=0,e=0;e<c&&(o++,i=i.nextZ,i);e++);for(l=c;0<o||0<l&&i;)0!==o&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,o--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;n=i}}while(s.nextZ=null,c*=2,1<a)}(r)}(i,a,o,l);let t,e,n=i;for(;i.prev!==i.next;)if(t=i.prev,e=i.next,l?function(t,e,n,i){var r=t.prev,s=t,a=t.next;if(0<=Tl(r,s,a))return!1;var o=(r.x<s.x?r.x<a.x?r:a:s.x<a.x?s:a).x,l=(r.y<s.y?r.y<a.y?r:a:s.y<a.y?s:a).y,c=(r.x>s.x?r.x>a.x?r:a:s.x>a.x?s:a).x,h=(r.y>s.y?r.y>a.y?r:a:s.y>a.y?s:a).y,u=Sl(o,l,e,n,i),d=Sl(c,h,e,n,i);let p=t.prevZ,f=t.nextZ;for(;p&&p.z>=u&&f&&f.z<=d;){if(p!==t.prev&&p!==t.next&&wl(r.x,r.y,s.x,s.y,a.x,a.y,p.x,p.y)&&0<=Tl(p.prev,p,p.next))return!1;if(p=p.prevZ,f!==t.prev&&f!==t.next&&wl(r.x,r.y,s.x,s.y,a.x,a.y,f.x,f.y)&&0<=Tl(f.prev,f,f.next))return!1;f=f.nextZ}for(;p&&p.z>=u;){if(p!==t.prev&&p!==t.next&&wl(r.x,r.y,s.x,s.y,a.x,a.y,p.x,p.y)&&0<=Tl(p.prev,p,p.next))return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&wl(r.x,r.y,s.x,s.y,a.x,a.y,f.x,f.y)&&0<=Tl(f.prev,f,f.next))return!1;f=f.nextZ}return!0}(i,a,o,l):function(t){var e=t.prev,n=t,i=t.next;if(0<=Tl(e,n,i))return!1;let r=t.next.next;for(;r!==t.prev;){if(wl(e.x,e.y,n.x,n.y,i.x,i.y,r.x,r.y)&&0<=Tl(r.prev,r,r.next))return!1;r=r.next}return!0}(i))r.push(t.i/s),r.push(i.i/s),r.push(e.i/s),Nl(i),i=e.next,n=e.next;else if((i=e)===n){c?1===c?Ml(i=function(t,e,n){let i=t;do{var r=i.prev,s=i.next.next;!Al(r,s)&&El(r,i,i.next,s)&&Pl(r,s)&&Pl(s,r)&&(e.push(r.i/n),e.push(i.i/n),e.push(s.i/n),Nl(i),Nl(i.next),i=t=s),i=i.next}while(i!==t);return _l(i)}(_l(i),r,s),r,s,a,o,l,2):2===c&&function(t,e,n,i,r,s){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&function(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&El(n,n.next,t,e))return!0}while(n=n.next,n!==t);return!1}(t,e)&&(Pl(t,e)&&Pl(e,t)&&function(t,e){let n=t,i=!1;var r=(t.x+e.x)/2,s=(t.y+e.y)/2;for(;n.y>s!=n.next.y>s&&n.next.y!==n.y&&r<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next,n!==t;);return i}(t,e)&&(Tl(t.prev,t,e.prev)||Tl(t,e.prev,e))||Al(t,e)&&0<Tl(t.prev,t,t.next)&&0<Tl(e.prev,e,e.next))}(a,t)){var o=Dl(a,t);return a=_l(a,a.next),o=_l(o,o.next),Ml(a,e,n,i,r,s),Ml(o,e,n,i,r,s)}t=t.next}}while(a=a.next,a!==t)}(i,r,s,a,o,l):Ml(_l(i),r,s,a,o,l,1);break}}}function bl(t,e){return t.x-e.x}function Sl(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function wl(t,e,n,i,r,s,a,o){return 0<=(r-a)*(e-o)-(t-a)*(s-o)&&0<=(t-a)*(i-o)-(n-a)*(e-o)&&0<=(n-a)*(s-o)-(r-a)*(i-o)}function Tl(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Al(t,e){return t.x===e.x&&t.y===e.y}function El(t,e,n,i){var r=Cl(Tl(t,e,n)),s=Cl(Tl(t,e,i)),a=Cl(Tl(n,i,t)),o=Cl(Tl(n,i,e));return r!==s&&a!==o||0===r&&Ll(t,n,e)||0===s&&Ll(t,i,e)||0===a&&Ll(n,t,i)||0===o&&Ll(n,e,i)}function Ll(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function Cl(t){return 0<t?1:t<0?-1:0}function Pl(t,e){return Tl(t.prev,t,t.next)<0?0<=Tl(t,e,t.next)&&0<=Tl(t,t.prev,e):Tl(t,e,t.prev)<0||Tl(t,t.next,e)<0}function Dl(t,e){const n=new Il(t.i,t.x,t.y),i=new Il(e.i,e.x,e.y),r=t.next,s=e.prev;return(t.next=e).prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function Rl(t,e,n,i){const r=new Il(t,e,n);return i?(r.next=i.next,(r.prev=i).next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Nl(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Il(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class Ol{static area(n){var i=n.length;let r=0;for(let t=i-1,e=0;e<i;t=e++)r+=n[t].x*n[e].y-n[e].x*n[t].y;return.5*r}static isClockWise(t){return Ol.area(t)<0}static triangulateShape(t,e){const n=[],i=[],r=[];zl(t),Ul(n,t);let s=t.length;e.forEach(zl);for(let t=0;t<e.length;t++)i.push(s),s+=e[t].length,Ul(n,e[t]);const a=xl.triangulate(n,i);for(let t=0;t<a.length;t+=3)r.push(a.slice(t,t+3));return r}}function zl(t){var e=t.length;2<e&&t[e-1].equals(t[0])&&t.pop()}function Ul(e,n){for(let t=0;t<n.length;t++)e.push(n[t].x),e.push(n[t].y)}class Fl extends Vi{constructor(n=new vl([new We(.5,.5),new We(-.5,.5),new We(-.5,-.5),new We(.5,-.5)]),F={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:n,options:F},n=Array.isArray(n)?n:[n];const B=this,k=[],V=[];for(let t=0,e=n.length;t<e;t++){const F=n[t];i(F)}function i(t){const i=[],e=void 0!==F.curveSegments?F.curveSegments:12,h=void 0!==F.steps?F.steps:1;let n=void 0!==F.depth?F.depth:1,r=void 0===F.bevelEnabled||F.bevelEnabled,s=void 0!==F.bevelThickness?F.bevelThickness:.2,a=void 0!==F.bevelSize?F.bevelSize:s-.1,o=void 0!==F.bevelOffset?F.bevelOffset:0,u=void 0!==F.bevelSegments?F.bevelSegments:3;const l=F.extrudePath,d=void 0!==F.UVGenerator?F.UVGenerator:Bl;void 0!==F.amount&&(n=F.amount);let c,p,f,m,g,v=!1;l&&(c=l.getSpacedPoints(h),v=!0,r=!1,p=l.computeFrenetFrames(h,!1),f=new rn,m=new rn,g=new rn),r||(u=0,s=0,a=0,o=0);t=t.extractPoints(e);let x=t.shape;const y=t.holes,_=!Ol.isClockWise(x);if(_){x=x.reverse();for(let t=0,e=y.length;t<e;t++){const F=y[t];Ol.isClockWise(F)&&(y[t]=F.reverse())}}const M=Ol.triangulateShape(x,y),b=x;for(let t=0,e=y.length;t<e;t++){const U=y[t];x=x.concat(U)}function S(t,e,n){return e.clone().multiplyScalar(n).add(t)}const w=x.length,T=M.length;function A(t,e,n){let i,r,s;const a=t.x-e.x,o=t.y-e.y,l=n.x-t.x,c=n.y-t.y,h=a*a+o*o,u=a*c-o*l;if(Math.abs(u)>Number.EPSILON){const u=Math.sqrt(h),d=Math.sqrt(l*l+c*c),p=e.x-o/u,f=e.y+a/u,m=n.x-c/d,g=n.y+l/d,v=((m-p)*c-(g-f)*l)/(a*c-o*l);i=p+a*v-t.x,r=f+o*v-t.y;t=i*i+r*r;if(t<=2)return new We(i,r);s=Math.sqrt(t/2)}else{let t=!1;a>Number.EPSILON?l>Number.EPSILON&&(t=!0):a<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(o)===Math.sign(c)&&(t=!0),s=t?(i=-o,r=a,Math.sqrt(h)):(i=a,r=o,Math.sqrt(h/2))}return new We(i/s,r/s)}const E=[];for(let t=0,e=b.length,n=e-1,i=t+1;t<e;t++,n++,i++)n===e&&(n=0),i===e&&(i=0),E[t]=A(b[t],b[n],b[i]);const L=[];let C,P=E.concat();for(let t=0,e=y.length;t<e;t++){const U=y[t];C=[];for(let t=0,e=U.length,n=e-1,i=t+1;t<e;t++,n++,i++)n===e&&(n=0),i===e&&(i=0),C[t]=A(U[t],U[n],U[i]);L.push(C),P=P.concat(C)}for(let t=0;t<u;t++){const U=t/u,B=s*Math.cos(U*Math.PI/2),k=a*Math.sin(U*Math.PI/2)+o;for(let t=0,e=b.length;t<e;t++){const U=S(b[t],E[t],k);N(U.x,U.y,-B)}for(let t=0,e=y.length;t<e;t++){const U=y[t];C=L[t];for(let t=0,e=U.length;t<e;t++){const V=S(U[t],C[t],k);N(V.x,V.y,-B)}}}var D=a+o;for(let t=0;t<w;t++){const U=r?S(x[t],P[t],D):x[t];v?(m.copy(p.normals[0]).multiplyScalar(U.x),f.copy(p.binormals[0]).multiplyScalar(U.y),g.copy(c[0]).add(m).add(f),N(g.x,g.y,g.z)):N(U.x,U.y,0)}for(let e=1;e<=h;e++)for(let t=0;t<w;t++){const B=r?S(x[t],P[t],D):x[t];v?(m.copy(p.normals[e]).multiplyScalar(B.x),f.copy(p.binormals[e]).multiplyScalar(B.y),g.copy(c[e]).add(m).add(f),N(g.x,g.y,g.z)):N(B.x,B.y,n/h*e)}for(let t=u-1;0<=t;t--){const U=t/u,B=s*Math.cos(U*Math.PI/2),k=a*Math.sin(U*Math.PI/2)+o;for(let t=0,e=b.length;t<e;t++){const U=S(b[t],E[t],k);N(U.x,U.y,n+B)}for(let t=0,e=y.length;t<e;t++){const U=y[t];C=L[t];for(let t=0,e=U.length;t<e;t++){const V=S(U[t],C[t],k);v?N(V.x,V.y+c[h-1].y,c[h-1].x+B):N(V.x,V.y,n+B)}}}function R(t,i){let r=t.length;for(;0<=--r;){var s=r;let n=r-1;n<0&&(n=t.length-1);for(let t=0,e=h+2*u;t<e;t++){const r=w*t,a=w*(t+1),o=i+s+r,h=i+n+r,l=i+n+a,c=i+s+a;!function(t,e,n,i){O(t),O(e),O(i),O(e),O(n),O(i);i=k.length/3,i=d.generateSideWallUV(B,k,i-6,i-3,i-2,i-1);z(i[0]),z(i[1]),z(i[3]),z(i[1]),z(i[2]),z(i[3])}(o,h,l,c)}}}function N(t,e,n){i.push(t),i.push(e),i.push(n)}function I(t,e,n){O(t),O(e),O(n);n=k.length/3,n=d.generateTopUV(B,k,n-3,n-2,n-1);z(n[0]),z(n[1]),z(n[2])}function O(t){k.push(i[3*t+0]),k.push(i[3*t+1]),k.push(i[3*t+2])}function z(t){V.push(t.x),V.push(t.y)}(function(){const n=k.length/3;if(r){let t,e=0*w;for(let t=0;t<T;t++){const n=M[t];I(n[2]+e,n[1]+e,n[0]+e)}t=h+2*u,e=w*t;for(let t=0;t<T;t++){const n=M[t];I(n[0]+e,n[1]+e,n[2]+e)}}else{for(let t=0;t<T;t++){var e=M[t];I(e[2],e[1],e[0])}for(let t=0;t<T;t++){var i=M[t];I(i[0]+w*h,i[1]+w*h,i[2]+w*h)}}B.addGroup(n,k.length/3-n,0)})(),function(){const n=k.length/3;let i=0;R(b,i),i+=b.length;for(let t=0,e=y.length;t<e;t++){const n=y[t];R(n,i),i+=n.length}B.addGroup(n,k.length/3-n,1)}()}this.setAttribute("position",new Ni(k,3)),this.setAttribute("uv",new Ni(V,2)),this.computeVertexNormals()}toJSON(){var t=super.toJSON();return function(n,i,r){if(r.shapes=[],Array.isArray(n))for(let t=0,e=n.length;t<e;t++){const i=n[t];r.shapes.push(i.uuid)}else r.shapes.push(n.uuid);return void 0!==i.extrudePath&&(r.options.extrudePath=i.extrudePath.toJSON()),r}(this.parameters.shapes,this.parameters.options,t)}static fromJSON(n,i){const r=[];for(let t=0,e=n.shapes.length;t<e;t++){const s=i[n.shapes[t]];r.push(s)}const s=n.options.extrudePath;return void 0!==s&&(n.options.extrudePath=(new fl[s.type]).fromJSON(s)),new Fl(r,n.options)}}const Bl={generateTopUV:function(t,e,n,i,r){var s=e[3*n],a=e[3*n+1],o=e[3*i],n=e[3*i+1],i=e[3*r],r=e[3*r+1];return[new We(s,a),new We(o,n),new We(i,r)]},generateSideWallUV:function(t,e,n,i,r,s){var a=e[3*n],o=e[3*n+1],l=e[3*n+2],c=e[3*i],h=e[3*i+1],u=e[3*i+2],d=e[3*r],p=e[3*r+1],n=e[3*r+2],i=e[3*s],r=e[3*s+1],s=e[3*s+2];return Math.abs(o-h)<Math.abs(a-c)?[new We(a,1-l),new We(c,1-u),new We(d,1-n),new We(i,1-s)]:[new We(o,1-l),new We(h,1-u),new We(p,1-n),new We(r,1-s)]}};class kl extends Vi{constructor(e=new vl([new We(0,.5),new We(-.5,-.5),new We(.5,-.5)]),o=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:o};const l=[],c=[],h=[],u=[];let n=0,d=0;if(!1===Array.isArray(e))i(e);else for(let t=0;t<e.length;t++)i(e[t]),this.addGroup(n,d,t),n+=d,d=0;function i(t){var n=c.length/3,t=t.extractPoints(o);let i=t.shape;const r=t.holes;!1===Ol.isClockWise(i)&&(i=i.reverse());for(let t=0,e=r.length;t<e;t++){const a=r[t];!0===Ol.isClockWise(a)&&(r[t]=a.reverse())}var s=Ol.triangulateShape(i,r);for(let t=0,e=r.length;t<e;t++){const a=r[t];i=i.concat(a)}for(let t=0,e=i.length;t<e;t++){const a=i[t];c.push(a.x,a.y,0),h.push(0,0,1),u.push(a.x,a.y)}for(let t=0,e=s.length;t<e;t++){const a=s[t],c=a[0]+n,h=a[1]+n,u=a[2]+n;l.push(c,h,u),d+=3}}this.setIndex(l),this.setAttribute("position",new Ni(c,3)),this.setAttribute("normal",new Ni(h,3)),this.setAttribute("uv",new Ni(u,2))}toJSON(){var t=super.toJSON();return function(n,i){if(i.shapes=[],Array.isArray(n))for(let t=0,e=n.length;t<e;t++){var r=n[t];i.shapes.push(r.uuid)}else i.shapes.push(n.uuid);return i}(this.parameters.shapes,t)}static fromJSON(n,i){const r=[];for(let t=0,e=n.shapes.length;t<e;t++){var s=i[n.shapes[t]];r.push(s)}return new kl(r,n.curveSegments)}}(class extends yi{});class Vl extends yi{constructor(t){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Ai(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ai(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ae,this.normalScale=new We(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this}}Vl.prototype.isMeshStandardMaterial=!0;class Gl extends Vl{constructor(t){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new We(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Ue(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.sheenColor=new Ai(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new Ai(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ai(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._transmission=0,this.setValues(t)}get sheen(){return this._sheen}set sheen(t){0<this._sheen!=0<t&&this.version++,this._sheen=t}get clearcoat(){return this._clearcoat}set clearcoat(t){0<this._clearcoat!=0<t&&this.version++,this._clearcoat=t}get transmission(){return this._transmission}set transmission(t){0<this._transmission!=0<t&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.ior=t.ior,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}Gl.prototype.isMeshPhysicalMaterial=!0;(class extends yi{});(class extends yi{});(class extends yi{});(class extends yi{});(class extends yi{});class Hl extends Ro{constructor(t){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}Hl.prototype.isLineDashedMaterial=!0;const Wl={arraySlice:function(t,e,n){return Wl.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==n?n:t.length)):t.slice(e,n)},convertArray:function(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(n){const e=n.length,i=new Array(e);for(let t=0;t!==e;++t)i[t]=t;return i.sort(function(t,e){return n[t]-n[e]}),i},sortedArray:function(n,i,r){const s=n.length,a=new n.constructor(s);for(let t=0,e=0;e!==s;++t){const s=r[t]*i;for(let t=0;t!==i;++t)a[e++]=n[s+t]}return a},flattenJSON:function(e,n,i,r){let s=1,a=e[0];for(;void 0!==a&&void 0===a[r];)a=e[s++];if(void 0!==a){let t=a[r];if(void 0!==t)if(Array.isArray(t))for(;t=a[r],void 0!==t&&(n.push(a.time),i.push.apply(i,t)),a=e[s++],void 0!==a;);else if(void 0!==t.toArray)for(;t=a[r],void 0!==t&&(n.push(a.time),t.toArray(i,i.length)),a=e[s++],void 0!==a;);else for(;t=a[r],void 0!==t&&(n.push(a.time),i.push(t)),a=e[s++],void 0!==a;);}},subclip:function(n,i,r,s,a=30){const e=n.clone();e.name=i;const o=[];for(let t=0;t<e.tracks.length;++t){const n=e.tracks[t],i=n.getValueSize(),l=[],c=[];for(let e=0;e<n.times.length;++e){const o=n.times[e]*a;if(!(o<r||o>=s)){l.push(n.times[e]);for(let t=0;t<i;++t)c.push(n.values[e*i+t])}}0!==l.length&&(n.times=Wl.convertArray(l,n.times.constructor),n.values=Wl.convertArray(c,n.values.constructor),o.push(n))}e.tracks=o;let l=1/0;for(let t=0;t<e.tracks.length;++t)l>e.tracks[t].times[0]&&(l=e.tracks[t].times[0]);for(let t=0;t<e.tracks.length;++t)e.tracks[t].shift(-1*l);return e.resetDuration(),e},makeClipAdditive:function(i,r=0,s=i,a=30){const o=s.tracks.length,l=r/(a=a<=0?30:a);for(let t=0;t<o;++t){const r=s.tracks[t],a=r.ValueTypeName;if("bool"!==a&&"string"!==a){const o=i.tracks.find(function(t){return t.name===r.name&&t.ValueTypeName===a});if(void 0!==o){let t=0;var c=r.getValueSize();r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(t=c/3);let e=0;var h=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(e=h/3);var u=r.times.length-1;let n;if(l<=r.times[0]){const i=t,s=c-t;n=Wl.arraySlice(r.values,i,s)}else if(l>=r.times[u]){const i=u*c+t,s=i+c-t;n=Wl.arraySlice(r.values,i,s)}else{const i=r.createInterpolant(),s=t,a=c-t;i.evaluate(l),n=Wl.arraySlice(i.resultBuffer,s,a)}if("quaternion"===a){const i=(new nn).fromArray(n).normalize().conjugate();i.toArray(n)}var d=o.times.length;for(let t=0;t<d;++t){const r=t*h+e;if("quaternion"===a)nn.multiplyQuaternionsFlat(o.values,r,n,0,o.values,r);else{const i=h-2*e;for(let t=0;t<i;++t)o.values[r+t]-=n[t]}}}}}return i.blendMode=2501,i}};class jl{constructor(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){var n=this.parameterPositions;let i=this._cachedIndex,r=n[i],s=n[i-1];t:{e:{let t;n:{i:if(!(e<r)){for(var a=i+2;;){if(void 0===r){if(e<s)break i;return i=n.length,this._cachedIndex=i,this.afterEnd_(i-1,e,s)}if(i===a)break;if(s=r,r=n[++i],e<r)break e}t=n.length;break n}if(e>=s)break t;var o=n[1];e<o&&(i=2,s=o);for(var l=i-2;;){if(void 0===s)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(i===l)break;if(r=s,s=n[--i-1],e>=s)break e}t=i,i=0}for(;i<t;){const r=i+t>>>1;e<n[r]?t=r:i=1+r}if(r=n[i],s=n[i-1],void 0===s)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(void 0===r)return i=n.length,this._cachedIndex=i,this.afterEnd_(i-1,s,e)}this._cachedIndex=i,this.intervalChanged_(i,s,r)}return this.interpolate_(i,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=t*i;for(let t=0;t!==i;++t)e[t]=n[r+t];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}jl.prototype.beforeStart_=jl.prototype.copySampleValue_,jl.prototype.afterEnd_=jl.prototype.copySampleValue_;class Xl extends jl{constructor(t,e,n,i){super(t,e,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:ye,endingEnd:ye}}intervalChanged_(t,e,n){var i=this.parameterPositions;let r=t-2,s=t+1,a=i[r],o=i[s];if(void 0===a)switch(this.getSettings_().endingStart){case _e:r=t,a=2*e-n;break;case 2402:r=i.length-2,a=e+i[r]-i[r+1];break;default:r=t,a=n}if(void 0===o)switch(this.getSettings_().endingEnd){case _e:s=t,o=2*n-e;break;case 2402:s=1,o=n+i[1]-i[0];break;default:s=t-1,o=e}var l=.5*(n-e),c=this.valueSize;this._weightPrev=l/(e-a),this._weightNext=l/(o-n),this._offsetPrev=r*c,this._offsetNext=s*c}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=t*a,l=o-a,c=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(n-e)/(i-e),f=p*p,m=f*p,g=-u*m+2*u*f-u*p,v=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*p+1,x=(-1-d)*m+(1.5+d)*f+.5*p,y=d*m-d*f;for(let t=0;t!==a;++t)r[t]=g*s[c+t]+v*s[l+t]+x*s[o+t]+y*s[h+t];return r}}class ql extends jl{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=t*a,l=o-a,c=(n-e)/(i-e),h=1-c;for(let t=0;t!==a;++t)r[t]=s[l+t]*h+s[o+t]*c;return r}}class Yl extends jl{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t){return this.copySampleValue_(t-1)}}class Zl{constructor(t,e,n,i){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Wl.convertArray(e,this.TimeBufferType),this.values=Wl.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:Wl.convertArray(t.times,Array),values:Wl.convertArray(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(n.interpolation=e)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new Yl(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new ql(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Xl(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case ve:e=this.InterpolantFactoryMethodDiscrete;break;case xe:e=this.InterpolantFactoryMethodLinear;break;case 2302:e=this.InterpolantFactoryMethodSmooth}if(void 0!==e)return this.createInterpolant=e,this;{const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return this}}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ve;case this.InterpolantFactoryMethodLinear:return xe;case this.InterpolantFactoryMethodSmooth:return 2302}}getValueSize(){return this.values.length/this.times.length}shift(n){if(0!==n){const i=this.times;for(let t=0,e=i.length;t!==e;++t)i[t]+=n}return this}scale(n){if(1!==n){const i=this.times;for(let t=0,e=i.length;t!==e;++t)i[t]*=n}return this}trim(t,e){var n=this.times,i=n.length;let r=0,s=i-1;for(;r!==i&&n[r]<t;)++r;for(;-1!==s&&n[s]>e;)--s;if(++s,0!==r||s!==i){r>=s&&(s=Math.max(s,1),r=s-1);const t=this.getValueSize();this.times=Wl.arraySlice(n,r,s),this.values=Wl.arraySlice(this.values,r*t,s*t)}return this}validate(){let n=!0;const i=this.getValueSize();i-Math.floor(i)!=0&&(n=!1);var e=this.times,r=this.values,s=e.length;0===s&&(n=!1);let a=null;for(let t=0;t!==s;t++){const i=e[t];if("number"==typeof i&&isNaN(i)){n=!1;break}if(null!==a&&a>i){n=!1;break}a=i}if(void 0!==r&&Wl.isTypedArray(r))for(let t=0,e=r.length;t!==e;++t){const i=r[t];if(isNaN(i)){n=!1;break}}return n}optimize(){const n=Wl.arraySlice(this.times),i=Wl.arraySlice(this.values),r=this.getValueSize(),s=2302===this.getInterpolation(),a=n.length-1;let o=1;for(let t=1;t<a;++t){let e=!1;var l=n[t];if(l!==n[t+1]&&(1!==t||l!==n[0]))if(s)e=!0;else{const n=t*r,s=n-r,o=n+r;for(let t=0;t!==r;++t){const r=i[n+t];if(r!==i[s+t]||r!==i[o+t]){e=!0;break}}}if(e){if(t!==o){n[o]=n[t];const s=t*r,a=o*r;for(let t=0;t!==r;++t)i[a+t]=i[s+t]}++o}}if(0<a){n[o]=n[a];for(let t=a*r,e=o*r,n=0;n!==r;++n)i[e+n]=i[t+n];++o}return o!==n.length?(this.times=Wl.arraySlice(n,0,o),this.values=Wl.arraySlice(i,0,o*r)):(this.times=n,this.values=i),this}clone(){const t=Wl.arraySlice(this.times,0),e=Wl.arraySlice(this.values,0),n=this.constructor,i=new n(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}Zl.prototype.TimeBufferType=Float32Array,Zl.prototype.ValueBufferType=Float32Array,Zl.prototype.DefaultInterpolation=xe;class Jl extends Zl{}Jl.prototype.ValueTypeName="bool",Jl.prototype.ValueBufferType=Array,Jl.prototype.DefaultInterpolation=ve,Jl.prototype.InterpolantFactoryMethodLinear=void 0,Jl.prototype.InterpolantFactoryMethodSmooth=void 0;class Kl extends Zl{}Kl.prototype.ValueTypeName="color";class Ql extends Zl{}Ql.prototype.ValueTypeName="number";class $l extends jl{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){var r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=(n-e)/(i-e);let l=t*a;for(var c=l+a;l!==c;l+=4)nn.slerpFlat(r,0,s,l-a,s,l,o);return r}}class tc extends Zl{InterpolantFactoryMethodLinear(t){return new $l(this.times,this.values,this.getValueSize(),t)}}tc.prototype.ValueTypeName="quaternion",tc.prototype.DefaultInterpolation=xe,tc.prototype.InterpolantFactoryMethodSmooth=void 0;class ec extends Zl{}ec.prototype.ValueTypeName="string",ec.prototype.ValueBufferType=Array,ec.prototype.DefaultInterpolation=ve,ec.prototype.InterpolantFactoryMethodLinear=void 0,ec.prototype.InterpolantFactoryMethodSmooth=void 0;class nc extends Zl{}class ic{constructor(t,e=-1,n,i=2500){this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=ze(),this.duration<0&&this.resetDuration()}static parse(t){const n=[],i=t.tracks,r=1/(t.fps||1);for(let t=0,e=i.length;t!==e;++t)n.push(function(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Ql;case"vector":case"vector2":case"vector3":case"vector4":return nc;case"color":return Kl;case"quaternion":return tc;case"bool":case"boolean":return Jl;case"string":return ec}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],n=[];Wl.flattenJSON(t.keys,e,n,"value"),t.times=e,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}(i[t]).scale(r));const e=new this(t.name,t.duration,n,t.blendMode);return e.uuid=t.uuid,e}static toJSON(t){const n=[],i=t.tracks,e={name:t.name,duration:t.duration,tracks:n,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,e=i.length;t!==e;++t)n.push(Zl.toJSON(i[t]));return e}static CreateFromMorphTargetSequence(t,i,r,s){const a=i.length,o=[];for(let n=0;n<a;n++){let t=[],e=[];t.push((n+a-1)%a,n,(n+1)%a),e.push(0,1,0);var l=Wl.getKeyframeOrder(t);t=Wl.sortedArray(t,1,l),e=Wl.sortedArray(e,1,l),s||0!==t[0]||(t.push(a),e.push(e[0])),o.push(new Ql(".morphTargetInfluences["+i[n].name+"]",t,e).scale(1/r))}return new this(t,-1,o)}static findByName(t,e){let n=t;if(!Array.isArray(t)){const e=t;n=e.geometry&&e.geometry.animations||e.animations}for(let t=0;t<n.length;t++)if(n[t].name===e)return n[t];return null}static CreateClipsFromMorphTargetSequences(n,i,r){const s={},a=/^([\w-]*?)([\d]+)$/;for(let t=0,e=n.length;t<e;t++){const i=n[t],r=i.name.match(a);if(r&&1<r.length){const n=r[1];let t=s[n];t||(s[n]=t=[]),t.push(i)}}const t=[];for(const e in s)t.push(this.CreateFromMorphTargetSequence(e,s[e],i,r));return t}static parseAnimation(n,i){if(!n)return null;function e(t,e,n,i,r){var s,a;0!==n.length&&(s=[],a=[],Wl.flattenJSON(n,s,a,i),0!==s.length&&r.push(new t(e,s,a)))}const r=[],s=n.name||"default",a=n.fps||30,t=n.blendMode;let o=n.length||-1;var l=n.hierarchy||[];for(let t=0;t<l.length;t++){const n=l[t].keys;if(n&&0!==n.length)if(n[0].morphTargets){const i={};let e;for(e=0;e<n.length;e++)if(n[e].morphTargets)for(let t=0;t<n[e].morphTargets.length;t++)i[n[e].morphTargets[t]]=-1;for(const s in i){const i=[],a=[];for(let t=0;t!==n[e].morphTargets.length;++t){const r=n[e];i.push(r.time),a.push(r.morphTarget===s?1:0)}r.push(new Ql(".morphTargetInfluence["+s+"]",i,a))}o=i.length*(a||1)}else{const s=".bones["+i[t].name+"]";e(nc,s+".position",n,"pos",r),e(tc,s+".quaternion",n,"rot",r),e(nc,s+".scale",n,"scl",r)}}return 0===r.length?null:new this(s,o,r,t)}resetDuration(){const n=this.tracks;let i=0;for(let t=0,e=n.length;t!==e;++t){const n=this.tracks[t];i=Math.max(i,n.times[n.times.length-1])}return this.duration=i,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}const rc={enabled:!(nc.prototype.ValueTypeName="vector"),files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};const sc=new class{constructor(t,e,n){const i=this;let r=!1,s=0,a=0,o=void 0;const l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){a++,!1===r&&void 0!==i.onStart&&i.onStart(t,s,a),r=!0},this.itemEnd=function(t){s++,void 0!==i.onProgress&&i.onProgress(t,s,a),s===a&&(r=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)},this.resolveURL=function(t){return o?o(t):t},this.setURLModifier=function(t){return o=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){t=l.indexOf(t);return-1!==t&&l.splice(t,2),this},this.getHandler=function(n){for(let t=0,e=l.length;t<e;t+=2){const i=l[t],r=l[t+1];if(i.global&&(i.lastIndex=0),i.test(n))return r}return null}}};class ac{constructor(t){this.manager=void 0!==t?t:sc,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(n,i){const r=this;return new Promise(function(t,e){r.load(n,t,i,e)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}const oc={};class lc extends ac{constructor(t){super(t)}load(l,t,e,n){void 0===l&&(l=""),void 0!==this.path&&(l=this.path+l),l=this.manager.resolveURL(l);const i=rc.get(l);if(void 0!==i)return this.manager.itemStart(l),setTimeout(()=>{t&&t(i),this.manager.itemEnd(l)},0),i;var r;void 0===oc[l]?(oc[l]=[],oc[l].push({onLoad:t,onProgress:e,onError:n}),r=new Request(l,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),fetch(r).then(t=>{if(200!==t.status&&0!==t.status)throw Error(`fetch for "${t.url}" responded with ${t.status}: `+t.statusText);{if(t.status,"undefined"==typeof ReadableStream||void 0===t.body.getReader)return t;const s=oc[l],n=t.body.getReader(),e=t.headers.get("Content-Length"),a=e?parseInt(e):0,o=0!==a;let r=0;t=new ReadableStream({start(e){!function i(){n.read().then(({done:n,value:t})=>{if(n)e.close();else{r+=t.byteLength;const n=new ProgressEvent("progress",{lengthComputable:o,loaded:r,total:a});for(let t=0,e=s.length;t<e;t++){const i=s[t];i.onProgress&&i.onProgress(n)}e.enqueue(t),i()}})}()}});return new Response(t)}}).then(t=>{switch(this.responseType){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then(t=>{const e=new DOMParser;return e.parseFromString(t,this.mimeType)});case"json":return t.json();default:return t.text()}}).then(n=>{rc.add(l,n);var i=oc[l];delete oc[l];for(let t=0,e=i.length;t<e;t++){const r=i[t];r.onLoad&&r.onLoad(n)}}).catch(n=>{var i=oc[l];if(void 0===i)throw this.manager.itemError(l),n;delete oc[l];for(let t=0,e=i.length;t<e;t++){const r=i[t];r.onError&&r.onError(n)}this.manager.itemError(l)}).finally(()=>{this.manager.itemEnd(l)}),this.manager.itemStart(l)):oc[l].push({onLoad:t,onProgress:e,onError:n})}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class cc extends ac{constructor(t){super(t)}load(e,t,n,i){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,s=rc.get(e);if(void 0!==s)return r.manager.itemStart(e),setTimeout(function(){t&&t(s),r.manager.itemEnd(e)},0),s;const a=qe("img");function o(){c(),rc.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(t){c(),i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)}function c(){a.removeEventListener("load",o,!1),a.removeEventListener("error",l,!1)}return a.addEventListener("load",o,!1),a.addEventListener("error",l,!1),"data:"!==e.substr(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(e),a.src=e,a}}class hc extends ac{constructor(t){super(t)}load(n,i,t,r){const s=new mr,a=new cc(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let o=0;for(let t=0;t<n.length;++t)!function(e){a.load(n[e],function(t){s.images[e]=t,o++,6===o&&(s.needsUpdate=!0,i&&i(s))},void 0,r)}(t);return s}}class uc extends ac{constructor(t){super(t)}load(t,e,n,i){const r=new Ke,s=new cc(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(t,function(t){r.image=t,r.needsUpdate=!0,void 0!==e&&e(r)},n,i),r}}class dc extends ai{constructor(t,e=1){super(),this.type="Light",this.color=new Ai(t),this.intensity=e}dispose(){}copy(t){return super.copy(t),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}dc.prototype.isLight=!0;dc;(class extends dc{constructor(t,e,n){super(t,n),this.type="HemisphereLight",this.position.copy(ai.DefaultUp),this.updateMatrix(),this.groundColor=new Ai(e)}copy(t){return dc.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}).prototype.isHemisphereLight=!0;const pc=new On,fc=new rn,mc=new rn;class gc{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new We(512,512),this.map=null,this.mapPass=null,this.matrix=new On,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Sr,this._frameExtents=new We(1,1),this._viewportCount=1,this._viewports=[new $e(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;fc.setFromMatrixPosition(t.matrixWorld),e.position.copy(fc),mc.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(mc),e.updateMatrixWorld(),pc.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(pc),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(e.projectionMatrix),n.multiply(e.matrixWorldInverse)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class vc extends gc{constructor(){super(new pr(50,1,.5,500)),this.focus=1}updateMatrices(t){const e=this.camera,n=2*Oe*t.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;n===e.fov&&i===e.aspect&&r===e.far||(e.fov=n,e.aspect=i,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}vc.prototype.isSpotLightShadow=!0;class xc extends dc{constructor(t,e,n=0,i=Math.PI/3,r=0,s=1){super(t,e),this.type="SpotLight",this.position.copy(ai.DefaultUp),this.updateMatrix(),this.target=new ai,this.distance=n,this.angle=i,this.penumbra=r,this.decay=s,this.shadow=new vc}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}xc.prototype.isSpotLight=!0;const yc=new On,_c=new rn,Mc=new rn;class bc extends gc{constructor(){super(new pr(90,1,.5,500)),this._frameExtents=new We(4,2),this._viewportCount=6,this._viewports=[new $e(2,1,1,1),new $e(0,1,1,1),new $e(3,1,1,1),new $e(1,1,1,1),new $e(3,0,1,1),new $e(1,0,1,1)],this._cubeDirections=[new rn(1,0,0),new rn(-1,0,0),new rn(0,0,1),new rn(0,0,-1),new rn(0,1,0),new rn(0,-1,0)],this._cubeUps=[new rn(0,1,0),new rn(0,1,0),new rn(0,1,0),new rn(0,1,0),new rn(0,0,1),new rn(0,0,-1)]}updateMatrices(t,e=0){const n=this.camera,i=this.matrix,r=t.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),_c.setFromMatrixPosition(t.matrixWorld),n.position.copy(_c),Mc.copy(n.position),Mc.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(Mc),n.updateMatrixWorld(),i.makeTranslation(-_c.x,-_c.y,-_c.z),yc.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(yc)}}bc.prototype.isPointLightShadow=!0;class Sc extends dc{constructor(t,e,n=0,i=1){super(t,e),this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new bc}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}Sc.prototype.isPointLight=!0;class wc extends gc{constructor(){super(new zr(-5,5,5,-5,.5,500))}}wc.prototype.isDirectionalLightShadow=!0;class Tc extends dc{constructor(t,e){super(t,e),this.type="DirectionalLight",this.position.copy(ai.DefaultUp),this.updateMatrix(),this.target=new ai,this.shadow=new wc}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}Tc.prototype.isDirectionalLight=!0;dc;dc;class Ac{constructor(){this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new rn)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){var n=t.x,i=t.y,r=t.z,t=this.coefficients;return e.copy(t[0]).multiplyScalar(.282095),e.addScaledVector(t[1],.488603*i),e.addScaledVector(t[2],.488603*r),e.addScaledVector(t[3],.488603*n),e.addScaledVector(t[4],n*i*1.092548),e.addScaledVector(t[5],i*r*1.092548),e.addScaledVector(t[6],.315392*(3*r*r-1)),e.addScaledVector(t[7],n*r*1.092548),e.addScaledVector(t[8],.546274*(n*n-i*i)),e}getIrradianceAt(t,e){var n=t.x,i=t.y,r=t.z,t=this.coefficients;return e.copy(t[0]).multiplyScalar(.886227),e.addScaledVector(t[1],1.023328*i),e.addScaledVector(t[2],1.023328*r),e.addScaledVector(t[3],1.023328*n),e.addScaledVector(t[4],.858086*n*i),e.addScaledVector(t[5],.858086*i*r),e.addScaledVector(t[6],.743125*r*r-.247708),e.addScaledVector(t[7],.858086*n*r),e.addScaledVector(t[8],.429043*(n*n-i*i)),e}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,n){for(let t=0;t<9;t++)this.coefficients[t].addScaledVector(e.coefficients[t],n);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,n){for(let t=0;t<9;t++)this.coefficients[t].lerp(e.coefficients[t],n);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(e,n=0){const i=this.coefficients;for(let t=0;t<9;t++)i[t].fromArray(e,n+3*t);return this}toArray(e=[],n=0){const i=this.coefficients;for(let t=0;t<9;t++)i[t].toArray(e,n+3*t);return e}static getBasisAt(t,e){var n=t.x,i=t.y,t=t.z;e[0]=.282095,e[1]=.488603*i,e[2]=.488603*t,e[3]=.488603*n,e[4]=1.092548*n*i,e[5]=1.092548*i*t,e[6]=.315392*(3*t*t-1),e[7]=1.092548*n*t,e[8]=.546274*(n*n-i*i)}}Ac.prototype.isSphericalHarmonics3=class extends dc{constructor(t,e,n=10,i=10){super(t,e),this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(t){this.intensity=t/(this.width*this.height*Math.PI)}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}}.prototype.isRectAreaLight=class extends dc{constructor(t,e){super(t,e),this.type="AmbientLight"}}.prototype.isAmbientLight=!0;class Ec extends dc{constructor(t=new Ac,e=1){super(void 0,e),this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}Ec.prototype.isLightProbe=!0;class Lc{static decodeText(n){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(n);let i="";for(let t=0,e=n.length;t<e;t++)i+=String.fromCharCode(n[t]);try{return decodeURIComponent(escape(i))}catch(t){return i}}static extractUrlBase(t){var e=t.lastIndexOf("/");return-1===e?"./":t.substr(0,e+1)}static resolveURL(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}}(class extends Vi{});class Cc extends ac{constructor(t){super(t),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(e,n,t,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,s=rc.get(e);if(void 0!==s)return r.manager.itemStart(e),setTimeout(function(){n&&n(s),r.manager.itemEnd(e)},0),s;const a={};a.credentials="anonymous"===this.crossOrigin?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(t){return t.blob()}).then(function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(t){rc.add(e,t),n&&n(t),r.manager.itemEnd(e)}).catch(function(t){i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)}),r.manager.itemStart(e)}}Cc.prototype.isImageBitmapLoader=!0;(class extends ac{});(class extends Ec{constructor(t,e=1){super(void 0,e);t=(new Ai).set(t);this.sh.coefficients[0].set(t.r,t.g,t.b).multiplyScalar(2*Math.sqrt(Math.PI))}}).prototype.isAmbientLightProbe=class extends Ec{constructor(t,e,n=1){super(void 0,n);var i=(new Ai).set(t),n=(new Ai).set(e),t=new rn(i.r,i.g,i.b),e=new rn(n.r,n.g,n.b),i=Math.sqrt(Math.PI),n=i*Math.sqrt(.75);this.sh.coefficients[0].copy(t).add(e).multiplyScalar(i),this.sh.coefficients[1].copy(t).sub(e).multiplyScalar(n)}}.prototype.isHemisphereLightProbe=!0;(class extends ai{});const Pc="\\[\\]\\.:\\/",Dc=new RegExp("["+Pc+"]","g"),Rc="[^"+Pc+"]",Nc="[^"+Pc.replace("\\.","")+"]",Ic=/((?:WC+[\/:])*)/.source.replace("WC",Rc),Oc=/(WCOD+)?/.source.replace("WCOD",Nc),zc=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Rc),Uc=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Rc),Fc=new RegExp("^"+Ic+Oc+zc+Uc+"$"),Bc=["material","materials","bones"];class kc{constructor(t,e,n){this.path=e,this.parsedPath=n||kc.parseTrackName(e),this.node=kc.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return new(t&&t.isAnimationObjectGroup?kc.Composite:kc)(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(Dc,"")}static parseTrackName(t){var e=Fc.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const t=n.nodeName.substring(i+1);-1!==Bc.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=t)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,i){if(!i||""===i||"."===i||-1===i||i===t.name||i===t.uuid)return t;if(t.skeleton){var e=t.skeleton.getBoneByName(i);if(void 0!==e)return e}if(t.children){const r=function(e){for(let t=0;t<e.length;t++){var n=e[t];if(n.name===i||n.uuid===i)return n;n=r(n.children);if(n)return n}return null},n=r(t.children);if(n)return n}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(n,i){var r=this.resolvedProperty;for(let t=0,e=r.length;t!==e;++t)n[i++]=r[t]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(n,i){const r=this.resolvedProperty;for(let t=0,e=r.length;t!==e;++t)r[t]=n[i++]}_setValue_array_setNeedsUpdate(n,i){const r=this.resolvedProperty;for(let t=0,e=r.length;t!==e;++t)r[t]=n[i++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(n,i){const r=this.resolvedProperty;for(let t=0,e=r.length;t!==e;++t)r[t]=n[i++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let n=this.node;const t=this.parsedPath,i=t.objectName,r=t.propertyName;let s=t.propertyIndex;if(n||(n=kc.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=n),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,n){if(i){let e=t.objectIndex;switch(i){case"materials":if(!n.material)return;if(!n.material.materials)return;n=n.material.materials;break;case"bones":if(!n.skeleton)return;n=n.skeleton.bones;for(let t=0;t<n.length;t++)if(n[t].name===e){e=t;break}break;default:if(void 0===n[i])return;n=n[i]}if(void 0!==e){if(void 0===n[e])return;n=n[e]}}var a=n[r];if(void 0!==a){let t=this.Versioning.None;this.targetObject=n,void 0!==n.needsUpdate?t=this.Versioning.NeedsUpdate:void 0!==n.matrixWorldNeedsUpdate&&(t=this.Versioning.MatrixWorldNeedsUpdate);let e=this.BindingType.Direct;if(void 0!==s){if("morphTargetInfluences"===r){if(!n.geometry)return;if(!n.geometry.isBufferGeometry)return;if(!n.geometry.morphAttributes)return;void 0!==n.morphTargetDictionary[s]&&(s=n.morphTargetDictionary[s])}e=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else void 0!==a.fromArray&&void 0!==a.toArray?(e=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(e=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=r;this.getValue=this.GetterByBindingType[e],this.setValue=this.SetterByBindingTypeAndVersioning[e][t]}else{const i=t.nodeName}}}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}kc.Composite=class{constructor(t,e,n){n=n||kc.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,n)}getValue(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(t,e)}setValue(n,i){const r=this._bindings;for(let t=this._targetGroup.nCachedObjects_,e=r.length;t!==e;++t)r[t].setValue(n,i)}bind(){const n=this._bindings;for(let t=this._targetGroup.nCachedObjects_,e=n.length;t!==e;++t)n[t].bind()}unbind(){const n=this._bindings;for(let t=this._targetGroup.nCachedObjects_,e=n.length;t!==e;++t)n[t].unbind()}},kc.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},kc.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},kc.prototype.GetterByBindingType=[kc.prototype._getValue_direct,kc.prototype._getValue_array,kc.prototype._getValue_arrayElement,kc.prototype._getValue_toArray],kc.prototype.SetterByBindingTypeAndVersioning=[[kc.prototype._setValue_direct,kc.prototype._setValue_direct_setNeedsUpdate,kc.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[kc.prototype._setValue_array,kc.prototype._setValue_array_setNeedsUpdate,kc.prototype._setValue_array_setMatrixWorldNeedsUpdate],[kc.prototype._setValue_arrayElement,kc.prototype._setValue_arrayElement_setNeedsUpdate,kc.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[kc.prototype._setValue_fromArray,kc.prototype._setValue_fromArray_setNeedsUpdate,kc.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];(class extends De{});new Float32Array(1);(class extends go{});class Vc{constructor(t,e,n=0,i=1/0){this.ray=new In(t,e),this.near=n,this.far=i,this.camera=null,this.layers=new Xn,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e&&e.isOrthographicCamera&&(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e)}intersectObject(t,e=!0,n=[]){return Hc(t,this,n,e),n.sort(Gc),n}intersectObjects(n,i=!0,r=[]){for(let t=0,e=n.length;t<e;t++)Hc(n[t],this,r,i);return r.sort(Gc),r}}function Gc(t,e){return t.distance-e.distance}function Hc(t,n,i,r){if(t.layers.test(n.layers)&&t.raycast(n,i),!0===r){const r=t.children;for(let t=0,e=r.length;t<e;t++)Hc(r[t],n,i,!0)}}class Wc{constructor(t=1,e=0,n=0){return this.radius=t,this.phi=e,this.theta=n,this}set(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(Ue(e/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}new We;new rn,new rn;new rn,new On,new On;(class extends Vo{});(class extends Vo{});e=new Float32Array(1);new Int32Array(e.buffer);const jc=2;Jo.create=function(t,e){return t.prototype=Object.create(Jo.prototype),(t.prototype.constructor=t).prototype.getPoint=e,t},gl.prototype.fromPoints=function(t){return this.setFromPoints(t)},ac.prototype.extractUrlBase=function(t){return Lc.extractUrlBase(t)},ac.Handlers={add:function(){},get:function(){}},on.prototype.center=function(t){return this.getCenter(t)},on.prototype.empty=function(){return this.isEmpty()},on.prototype.isIntersectionBox=function(t){return this.intersectsBox(t)},on.prototype.isIntersectionSphere=function(t){return this.intersectsSphere(t)},on.prototype.size=function(t){return this.getSize(t)},An.prototype.empty=function(){return this.isEmpty()},Sr.prototype.setFromMatrix=function(t){return this.setFromProjectionMatrix(t)},je.prototype.flattenToArrayOffset=function(t,e){return this.toArray(t,e)},je.prototype.multiplyVector3=function(t){return t.applyMatrix3(this)},je.prototype.multiplyVector3Array=function(){},je.prototype.applyToBufferAttribute=function(t){return t.applyMatrix3(this)},je.prototype.applyToVector3Array=function(){},je.prototype.getInverse=function(t){return this.copy(t).invert()},On.prototype.extractPosition=function(t){return this.copyPosition(t)},On.prototype.flattenToArrayOffset=function(t,e){return this.toArray(t,e)},On.prototype.getPosition=function(){return(new rn).setFromMatrixColumn(this,3)},On.prototype.setRotationFromQuaternion=function(t){return this.makeRotationFromQuaternion(t)},On.prototype.multiplyToArray=function(){},On.prototype.multiplyVector3=function(t){return t.applyMatrix4(this)},On.prototype.multiplyVector4=function(t){return t.applyMatrix4(this)},On.prototype.multiplyVector3Array=function(){},On.prototype.rotateAxis=function(t){t.transformDirection(this)},On.prototype.crossVector=function(t){return t.applyMatrix4(this)},On.prototype.translate=function(){},On.prototype.rotateX=function(){},On.prototype.rotateY=function(){},On.prototype.rotateZ=function(){},On.prototype.rotateByAxis=function(){},On.prototype.applyToBufferAttribute=function(t){return t.applyMatrix4(this)},On.prototype.applyToVector3Array=function(){},On.prototype.makeFrustum=function(t,e,n,i,r,s){return this.makePerspective(t,e,i,n,r,s)},On.prototype.getInverse=function(t){return this.copy(t).invert()},_r.prototype.isIntersectionLine=function(t){return this.intersectsLine(t)},nn.prototype.multiplyVector3=function(t){return t.applyQuaternion(this)},nn.prototype.inverse=function(){return this.invert()},In.prototype.isIntersectionBox=function(t){return this.intersectsBox(t)},In.prototype.isIntersectionPlane=function(t){return this.intersectsPlane(t)},In.prototype.isIntersectionSphere=function(t){return this.intersectsSphere(t)},vi.prototype.area=function(){return this.getArea()},vi.prototype.barycoordFromPoint=function(t,e){return this.getBarycoord(t,e)},vi.prototype.midpoint=function(t){return this.getMidpoint(t)},vi.prototypenormal=function(t){return this.getNormal(t)},vi.prototype.plane=function(t){return this.getPlane(t)},vi.barycoordFromPoint=function(t,e,n,i,r){return vi.getBarycoord(t,e,n,i,r)},vi.normal=function(t,e,n,i){return vi.getNormal(t,e,n,i)},vl.prototype.extractAllPoints=function(t){return this.extractPoints(t)},vl.prototype.extrude=function(t){return new Fl(this,t)},vl.prototype.makeGeometry=function(t){return new kl(this,t)},We.prototype.fromAttribute=function(t,e,n){return this.fromBufferAttribute(t,e,n)},We.prototype.distanceToManhattan=function(t){return this.manhattanDistanceTo(t)},We.prototype.lengthManhattan=function(){return this.manhattanLength()},rn.prototype.setEulerFromRotationMatrix=function(){},rn.prototype.setEulerFromQuaternion=function(){},rn.prototype.getPositionFromMatrix=function(t){return this.setFromMatrixPosition(t)},rn.prototype.getScaleFromMatrix=function(t){return this.setFromMatrixScale(t)},rn.prototype.getColumnFromMatrix=function(t,e){return this.setFromMatrixColumn(e,t)},rn.prototype.applyProjection=function(t){return this.applyMatrix4(t)},rn.prototype.fromAttribute=function(t,e,n){return this.fromBufferAttribute(t,e,n)},rn.prototype.distanceToManhattan=function(t){return this.manhattanDistanceTo(t)},rn.prototype.lengthManhattan=function(){return this.manhattanLength()},$e.prototype.fromAttribute=function(t,e,n){return this.fromBufferAttribute(t,e,n)},$e.prototype.lengthManhattan=function(){return this.manhattanLength()},ai.prototype.getChildByName=function(t){return this.getObjectByName(t)},ai.prototype.renderDepth=function(){},ai.prototype.translate=function(t,e){return this.translateOnAxis(e,t)},ai.prototype.getWorldRotation=function(){},ai.prototype.applyMatrix=function(t){return this.applyMatrix4(t)},Object.defineProperties(ai.prototype,{eulerOrder:{get:function(){return this.rotation.order},set:function(t){this.rotation.order=t}},useQuaternion:{get:function(){},set:function(){}}}),sr.prototype.setDrawMode=function(){},Object.defineProperties(sr.prototype,{drawMode:{get:function(){return 0},set:function(){}}}),To.prototype.initBones=function(){},pr.prototype.setLens=function(t,e){void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(dc.prototype,{onlyShadow:{set:function(){}},shadowCameraFov:{set:function(t){this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){}},shadowBias:{set:function(t){this.shadow.bias=t}},shadowDarkness:{set:function(){}},shadowMapWidth:{set:function(t){this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){this.shadow.mapSize.height=t}}}),Object.defineProperties(Pi.prototype,{length:{get:function(){return this.array.length}},dynamic:{get:function(){return this.usage===Ce},set:function(){this.setUsage(Ce)}}}),Pi.prototype.setDynamic=function(t){return this.setUsage(!0===t?Ce:Le),this},Pi.prototype.copyIndicesArray=function(){},Pi.prototype.setArray=function(){},Vi.prototype.addIndex=function(t){this.setIndex(t)},Vi.prototype.addAttribute=function(t,e){return e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(this.setIndex(e),this):this.setAttribute(t,e):this.setAttribute(t,new Pi(e,arguments[2]))},Vi.prototype.addDrawCall=function(t,e,n){this.addGroup(t,e)},Vi.prototype.clearDrawCalls=function(){this.clearGroups()},Vi.prototype.computeOffsets=function(){},Vi.prototype.removeAttribute=function(t){return this.deleteAttribute(t)},Vi.prototype.applyMatrix=function(t){return this.applyMatrix4(t)},Object.defineProperties(Vi.prototype,{drawcalls:{get:function(){return this.groups}},offsets:{get:function(){return this.groups}}}),go.prototype.setDynamic=function(t){return this.setUsage(!0===t?Ce:Le),this},go.prototype.setArray=function(){},Fl.prototype.getArrays=function(){},Fl.prototype.addShapeList=function(){},Fl.prototype.addShape=function(){},mo.prototype.dispose=function(){},class Yc{constructor(t){this.value=t="string"==typeof t?arguments[1]:t}clone(){return new Yc(void 0===this.value.clone?this.value:this.value.clone())}}.prototype.onUpdate=function(){return this},Object.defineProperties(yi.prototype,{wrapAround:{get:function(){},set:function(){}},overdraw:{get:function(){},set:function(){}},wrapRGB:{get:function(){return new Ai}},shading:{get:function(){},set:function(t){this.flatShading=1===t}},stencilMask:{get:function(){return this.stencilFuncMask},set:function(t){this.stencilFuncMask=t}},vertexTangents:{get:function(){},set:function(){}}}),Object.defineProperties(ur.prototype,{derivatives:{get:function(){return this.extensions.derivatives},set:function(t){this.extensions.derivatives=t}}}),fo.prototype.clearTarget=function(t,e,n,i){this.setRenderTarget(t),this.clear(e,n,i)},fo.prototype.animate=function(t){this.setAnimationLoop(t)},fo.prototype.getCurrentRenderTarget=function(){return this.getRenderTarget()},fo.prototype.getMaxAnisotropy=function(){return this.capabilities.getMaxAnisotropy()},fo.prototype.getPrecision=function(){return this.capabilities.precision},fo.prototype.resetGLState=function(){return this.state.reset()},fo.prototype.supportsFloatTextures=function(){return this.extensions.get("OES_texture_float")},fo.prototype.supportsHalfFloatTextures=function(){return this.extensions.get("OES_texture_half_float")},fo.prototype.supportsStandardDerivatives=function(){return this.extensions.get("OES_standard_derivatives")},fo.prototype.supportsCompressedTextureS3TC=function(){return this.extensions.get("WEBGL_compressed_texture_s3tc")},fo.prototype.supportsCompressedTexturePVRTC=function(){return this.extensions.get("WEBGL_compressed_texture_pvrtc")},fo.prototype.supportsBlendMinMax=function(){return this.extensions.get("EXT_blend_minmax")},fo.prototype.supportsVertexTextures=function(){return this.capabilities.vertexTextures},fo.prototype.supportsInstancedArrays=function(){return this.extensions.get("ANGLE_instanced_arrays")},fo.prototype.enableScissorTest=function(t){this.setScissorTest(t)},fo.prototype.initMaterial=function(){},fo.prototype.addPrePlugin=function(){},fo.prototype.addPostPlugin=function(){},fo.prototype.updateShadowMap=function(){},fo.prototype.setFaceCulling=function(){},fo.prototype.allocTextureUnit=function(){},fo.prototype.setTexture=function(){},fo.prototype.setTexture2D=function(){},fo.prototype.setTextureCube=function(){},fo.prototype.getActiveMipMapLevel=function(){return this.getActiveMipmapLevel()},Object.defineProperties(fo.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){this.shadowMap.type=t}},shadowMapCullFace:{get:function(){},set:function(){}},context:{get:function(){return this.getContext()}},vr:{get:function(){return this.xr}},gammaInput:{get:function(){return!1},set:function(){}},gammaOutput:{get:function(){return!1},set:function(t){this.outputEncoding=!0===t?we:Se}},toneMappingWhitePoint:{get:function(){return 1},set:function(){}},gammaFactor:{get:function(){return 2},set:function(){}}}),Object.defineProperties(no.prototype,{cullFace:{get:function(){},set:function(){}},renderReverseSided:{get:function(){},set:function(){}},renderSingleSided:{get:function(){},set:function(){}}}),Object.defineProperties(tn.prototype,{wrapS:{get:function(){return this.texture.wrapS},set:function(t){this.texture.wrapS=t}},wrapT:{get:function(){return this.texture.wrapT},set:function(t){this.texture.wrapT=t}},magFilter:{get:function(){return this.texture.magFilter},set:function(t){this.texture.magFilter=t}},minFilter:{get:function(){return this.texture.minFilter},set:function(t){this.texture.minFilter=t}},anisotropy:{get:function(){return this.texture.anisotropy},set:function(t){this.texture.anisotropy=t}},offset:{get:function(){return this.texture.offset},set:function(t){this.texture.offset=t}},repeat:{get:function(){return this.texture.repeat},set:function(t){this.texture.repeat=t}},format:{get:function(){return this.texture.format},set:function(t){this.texture.format=t}},type:{get:function(){return this.texture.type},set:function(t){this.texture.type=t}},generateMipmaps:{get:function(){return this.texture.generateMipmaps},set:function(t){this.texture.generateMipmaps=t}}}),fr.prototype.updateCubeMap=function(t,e){return this.update(t,e)},fr.prototype.clear=function(t,e,n,i){return this.renderTarget.clear(t,e,n,i)},Ze.crossOrigin=void 0,Ze.loadTexture=function(t,e,n,i){const r=new uc;r.setCrossOrigin(this.crossOrigin);const s=r.load(t,n,void 0,i);return e&&(s.mapping=e),s},Ze.loadTextureCube=function(t,e,n,i){const r=new hc;r.setCrossOrigin(this.crossOrigin);const s=r.load(t,n,void 0,i);return e&&(s.mapping=e),s},Ze.loadCompressedTexture=function(){},Ze.loadCompressedTextureCube=function(){},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:At}})),"undefined"==typeof window||window.__THREE__||(window.__THREE__=At)},"5f96":function(t,e,n){"use strict";var i=n("ebb5"),n=n("e330"),r=i.aTypedArray,i=i.exportTypedArrayMethod,s=n([].join);i("join",function(t){return s(r(this),t)})},"60bd":function(t,e,n){"use strict";function i(){return h(p(this))}var r=n("da84"),s=n("d039"),a=n("e330"),o=n("ebb5"),l=n("e260"),c=n("b622")("iterator"),r=r.Uint8Array,h=a(l.values),u=a(l.keys),d=a(l.entries),p=o.aTypedArray,o=o.exportTypedArrayMethod,f=r&&r.prototype,r=!s(function(){f[c].call([1])}),s=!!f&&f.values&&f[c]===f.values&&"values"===f.values.name;o("entries",function(){return d(p(this))},r),o("keys",function(){return u(p(this))},r),o("values",i,r||!s,{name:"values"}),o(c,i,r||!s,{name:"values"})},"621a":function(t,e,n){"use strict";function i(t){return[255&t]}function r(t){return[255&t,t>>8&255]}function s(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]}function a(t){return t[3]<<24|t[2]<<16|t[1]<<8|t[0]}function o(t){return q(t,23,4)}function l(t){return q(t,52,8)}function c(t,e){L(t[U],e,{get:function(){return O(this)[e]}})}function h(t,e,n,i){var r=S(n),n=O(t);if(r+e>n.byteLength)throw W(F);return t=O(n.buffer).bytes,n=r+n.byteOffset,e=P(t,n,n+e),i?e:X(e)}function u(t,e,n,i,r,s){if(n=S(n),t=O(t),n+e>t.byteLength)throw W(F);for(var a=O(t.buffer).bytes,o=n+t.byteOffset,l=i(+r),c=0;c<e;c++)a[o+c]=l[s?c:e-c-1]}var d=n("da84"),p=n("e330"),f=n("83ab"),m=n("a981"),g=n("5e77"),v=n("9112"),x=n("e2cc"),y=n("d039"),_=n("19aa"),M=n("5926"),b=n("50c4"),S=n("0b25"),w=n("77a7"),T=n("e163"),A=n("d2bb"),E=n("241c").f,L=n("9bf2").f,C=n("81d5"),P=n("4dae"),D=n("d44e"),R=n("69f3"),N=g.PROPER,I=g.CONFIGURABLE,O=R.get,z=R.set,n="ArrayBuffer",U="prototype",F="Wrong index",B=d[n],k=B,V=k&&k[U],g=d.DataView,G=g&&g[U],R=Object.prototype,H=d.Array,W=d.RangeError,j=p(C),X=p([].reverse),q=w.pack,Y=w.unpack;if(m){var Z=N&&B.name!==n;if(y(function(){B(1)})&&y(function(){new B(-1)})&&!y(function(){return new B,new B(1.5),new B(NaN),Z&&!I}))Z&&I&&v(B,"name",n);else{(k=function(t){return _(this,V),new B(S(t))})[U]=V;for(var J,K=E(B),Q=0;K.length>Q;)(J=K[Q++])in k||v(k,J,B[J]);V.constructor=k}A&&T(G)!==R&&A(G,R);var R=new g(new k(2)),$=p(G.setInt8);R.setInt8(0,2147483648),R.setInt8(1,2147483649),!R.getInt8(0)&&R.getInt8(1)||x(G,{setInt8:function(t,e){$(this,t,e<<24>>24)},setUint8:function(t,e){$(this,t,e<<24>>24)}},{unsafe:!0})}else V=(k=function(t){_(this,V);t=S(t);z(this,{bytes:j(H(t),0),byteLength:t}),f||(this.byteLength=t)})[U],G=(g=function(t,e,n){_(this,G),_(t,V);var i=O(t).byteLength,e=M(e);if(e<0||i<e)throw W("Wrong offset");if(i<e+(n=void 0===n?i-e:b(n)))throw W("Wrong length");z(this,{buffer:t,byteLength:n,byteOffset:e}),f||(this.buffer=t,this.byteLength=n,this.byteOffset=e)})[U],f&&(c(k,"byteLength"),c(g,"buffer"),c(g,"byteLength"),c(g,"byteOffset")),x(G,{getInt8:function(t){return h(this,1,t)[0]<<24>>24},getUint8:function(t){return h(this,1,t)[0]},getInt16:function(t){t=h(this,2,t,1<arguments.length?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(t){t=h(this,2,t,1<arguments.length?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(t){return a(h(this,4,t,1<arguments.length?arguments[1]:void 0))},getUint32:function(t){return a(h(this,4,t,1<arguments.length?arguments[1]:void 0))>>>0},getFloat32:function(t){return Y(h(this,4,t,1<arguments.length?arguments[1]:void 0),23)},getFloat64:function(t){return Y(h(this,8,t,1<arguments.length?arguments[1]:void 0),52)},setInt8:function(t,e){u(this,1,t,i,e)},setUint8:function(t,e){u(this,1,t,i,e)},setInt16:function(t,e){u(this,2,t,r,e,2<arguments.length?arguments[2]:void 0)},setUint16:function(t,e){u(this,2,t,r,e,2<arguments.length?arguments[2]:void 0)},setInt32:function(t,e){u(this,4,t,s,e,2<arguments.length?arguments[2]:void 0)},setUint32:function(t,e){u(this,4,t,s,e,2<arguments.length?arguments[2]:void 0)},setFloat32:function(t,e){u(this,4,t,o,e,2<arguments.length?arguments[2]:void 0)},setFloat64:function(t,e){u(this,8,t,l,e,2<arguments.length?arguments[2]:void 0)}});D(k,n),D(g,"DataView"),t.exports={ArrayBuffer:k,DataView:g}},"649e":function(t,e,n){"use strict";var i=n("ebb5"),r=n("b727").some,s=i.aTypedArray;(0,i.exportTypedArrayMethod)("some",function(t){return r(s(this),t,1<arguments.length?arguments[1]:void 0)})},"72f7":function(t,e,n){"use strict";var i=n("ebb5").exportTypedArrayMethod,r=n("d039"),s=n("da84"),n=n("e330"),s=s.Uint8Array,s=s&&s.prototype||{},a=[].toString,o=n([].join);r(function(){a.call({})})&&(a=function(){return o(this)});s=s.toString!=a;i("toString",a,s)},"735e":function(t,e,n){"use strict";var i=n("ebb5"),r=n("c65b"),s=n("81d5"),a=i.aTypedArray;(0,i.exportTypedArrayMethod)("fill",function(t){var e=arguments.length;return r(s,a(this),t,1<e?arguments[1]:void 0,2<e?arguments[2]:void 0)})},"74e8":function(t,e,n){"use strict";function p(t,e){$(t);for(var n=0,i=e.length,r=new t(i);n<i;)r[n]=e[n++];return r}function i(t,e){V(t,e,{get:function(){return B(this)[e]}})}function f(t){var e;return C(X,t)||"ArrayBuffer"==(e=T(t))||"SharedArrayBuffer"==e}function r(t,e){return tt(t)&&!E(e)&&e in t&&y(+e)&&0<=e}function s(t,e){return e=S(e),r(t,e)?d(2,t[e]):G(t,e)}function a(t,e,n){return e=S(e),!(r(t,e)&&A(n)&&w(n,"value"))||w(n,"get")||w(n,"set")||n.configurable||w(n,"writable")&&!n.writable||w(n,"enumerable")&&!n.enumerable?V(t,e,n):(t[e]=n.value,t)}var o=n("23e7"),l=n("da84"),m=n("c65b"),c=n("83ab"),g=n("8aa7"),h=n("ebb5"),u=n("621a"),v=n("19aa"),d=n("5c6c"),x=n("9112"),y=n("eac5"),_=n("50c4"),M=n("0b25"),b=n("182d"),S=n("a04b"),w=n("1a2d"),T=n("f5df"),A=n("861d"),E=n("d9b5"),L=n("7c73"),C=n("3a9b"),P=n("d2bb"),D=n("241c").f,R=n("a078"),N=n("b727").forEach,I=n("2626"),O=n("9bf2"),z=n("06cf"),U=n("69f3"),F=n("7156"),B=U.get,k=U.set,V=O.f,G=z.f,H=Math.round,W=l.RangeError,j=u.ArrayBuffer,X=j.prototype,q=u.DataView,Y=h.NATIVE_ARRAY_BUFFER_VIEWS,Z=h.TYPED_ARRAY_CONSTRUCTOR,J=h.TYPED_ARRAY_TAG,K=h.TypedArray,Q=h.TypedArrayPrototype,$=h.aTypedArrayConstructor,tt=h.isTypedArray,et="BYTES_PER_ELEMENT",nt="Wrong length";c?(Y||(z.f=s,O.f=a,i(Q,"buffer"),i(Q,"byteOffset"),i(Q,"byteLength"),i(Q,"length")),o({target:"Object",stat:!0,forced:!Y},{getOwnPropertyDescriptor:s,defineProperty:a}),t.exports=function(t,e,i){function c(t,e){V(t,e,{get:function(){return function(t,e){t=B(t);return t.view[r](e*h+t.byteOffset,!0)}(this,e)},set:function(t){return function(t,e,n){t=B(t);i&&(n=(n=H(n))<0?0:255<n?255:255&n),t.view[s](e*h+t.byteOffset,n,!0)}(this,e,t)},enumerable:!0})}var h=t.match(/\d+$/)[0]/8,n=t+(i?"Clamped":"")+"Array",r="get"+t,s="set"+t,a=l[n],u=a,d=u&&u.prototype,t={};Y?g&&(u=e(function(t,e,n,i){return v(t,d),F(A(e)?f(e)?void 0!==i?new a(e,b(n,h),i):void 0!==n?new a(e,b(n,h)):new a(e):tt(e)?p(u,e):m(R,u,e):new a(M(e)),t,u)}),P&&P(u,K),N(D(a),function(t){t in u||x(u,t,a[t])}),u.prototype=d):(u=e(function(t,e,n,i){v(t,d);var r,s,a=0,o=0;if(A(e)){if(!f(e))return tt(e)?p(u,e):m(R,u,e);var l=e,o=b(n,h),n=e.byteLength;if(void 0===i){if(n%h)throw W(nt);if((r=n-o)<0)throw W(nt)}else if(n<(r=_(i)*h)+o)throw W(nt);s=r/h}else s=M(e),l=new j(r=s*h);for(k(t,{buffer:l,byteOffset:o,byteLength:r,length:s,view:new q(l)});a<s;)c(t,a++)}),P&&P(u,K),d=u.prototype=L(Q)),d.constructor!==u&&x(d,"constructor",u),x(d,Z,u),J&&x(d,J,n),t[n]=u,o({global:!0,forced:u!=a,sham:!Y},t),et in u||x(u,et,h),et in d||x(d,et,h),I(n)}):t.exports=function(){}},"77a7":function(t,e,n){var d=n("da84").Array,p=Math.abs,f=Math.pow,m=Math.floor,g=Math.log,v=Math.LN2;t.exports={pack:function(t,e,n){var i,r,s=d(n),a=8*n-e-1,o=(1<<a)-1,l=o>>1,c=23===e?f(2,-24)-f(2,-77):0,h=t<0||0===t&&1/t<0?1:0,u=0;for((t=p(t))!=t||t===1/0?(r=t!=t?1:0,i=o):(i=m(g(t)/v),t*(n=f(2,-i))<1&&(i--,n*=2),2<=(t+=1<=i+l?c/n:c*f(2,1-l))*n&&(i++,n/=2),o<=i+l?(r=0,i=o):1<=i+l?(r=(t*n-1)*f(2,e),i+=l):(r=t*f(2,l-1)*f(2,e),i=0));8<=e;)s[u++]=255&r,r/=256,e-=8;for(i=i<<e|r,a+=e;0<a;)s[u++]=255&i,i/=256,a-=8;return s[--u]|=128*h,s},unpack:function(t,e){var n,i=t.length,r=8*i-e-1,s=(1<<r)-1,a=s>>1,o=r-7,l=i-1,i=t[l--],c=127&i;for(i>>=7;0<o;)c=256*c+t[l--],o-=8;for(n=c&(1<<-o)-1,c>>=-o,o+=e;0<o;)n=256*n+t[l--],o-=8;if(0===c)c=1-a;else{if(c===s)return n?NaN:i?-1/0:1/0;n+=f(2,e),c-=a}return(i?-1:1)*n*f(2,c-e)}}},"82f8":function(t,e,n){"use strict";var i=n("ebb5"),r=n("4d64").includes,s=i.aTypedArray;(0,i.exportTypedArrayMethod)("includes",function(t){return r(s(this),t,1<arguments.length?arguments[1]:void 0)})},"8aa7":function(t,e,n){var i=n("da84"),r=n("d039"),s=n("1c7e"),n=n("ebb5").NATIVE_ARRAY_BUFFER_VIEWS,a=i.ArrayBuffer,o=i.Int8Array;t.exports=!n||!r(function(){o(1)})||!r(function(){new o(-1)})||!s(function(t){new o,new o(null),new o(1.5),new o(t)},!0)||r(function(){return 1!==new o(new a(2),1,void 0).length})},"907a":function(t,e,n){"use strict";var i=n("ebb5"),r=n("07fa"),s=n("5926"),a=i.aTypedArray;(0,i.exportTypedArrayMethod)("at",function(t){var e=a(this),n=r(e),t=s(t),t=0<=t?t:n+t;return t<0||n<=t?void 0:e[t]})},"9a8c":function(t,e,n){"use strict";var i=n("e330"),r=n("ebb5"),s=i(n("145e")),a=r.aTypedArray;(0,r.exportTypedArrayMethod)("copyWithin",function(t,e){return s(a(this),t,e,2<arguments.length?arguments[2]:void 0)})},a078:function(t,e,n){var p=n("0366"),f=n("c65b"),m=n("5087"),g=n("7b0b"),v=n("07fa"),x=n("9a1f"),y=n("35a1"),_=n("e95a"),M=n("ebb5").aTypedArrayConstructor;t.exports=function(t){var e,n,i,r,s,a,o=m(this),l=g(t),c=arguments.length,h=1<c?arguments[1]:void 0,u=void 0!==h,d=y(l);if(d&&!_(d))for(a=(s=x(l,d)).next,l=[];!(r=f(a,s)).done;)l.push(r.value);for(u&&2<c&&(h=p(h,arguments[2])),n=v(l),i=new(M(o))(n),e=0;e<n;e++)i[e]=u?h(l[e],e):l[e];return i}},a975:function(t,e,n){"use strict";var i=n("ebb5"),r=n("b727").every,s=i.aTypedArray;(0,i.exportTypedArrayMethod)("every",function(t){return r(s(this),t,1<arguments.length?arguments[1]:void 0)})},a981:function(t,e){t.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},ab13:function(t,e,n){var i=n("b622")("match");t.exports=function(e){var n=/./;try{"/./"[e](n)}catch(t){try{return n[i]=!1,"/./"[e](n)}catch(t){}}return!1}},b39a:function(t,e,n){"use strict";var i=n("da84"),r=n("2ba4"),s=n("ebb5"),a=n("d039"),o=n("f36a"),l=i.Int8Array,c=s.aTypedArray,s=s.exportTypedArrayMethod,h=[].toLocaleString,u=!!l&&a(function(){h.call(new l(1))});s("toLocaleString",function(){return r(h,u?o(c(this)):c(this),o(arguments))},a(function(){return[1,2].toLocaleString()!=new l([1,2]).toLocaleString()})||!a(function(){l.prototype.toLocaleString.call([1,2])}))},b6b7:function(t,e,n){var i=n("ebb5"),r=n("4840"),s=i.TYPED_ARRAY_CONSTRUCTOR,a=i.aTypedArrayConstructor;t.exports=function(t){return a(r(t,t[s]))}},c1ac:function(t,e,n){"use strict";var i=n("ebb5"),r=n("b727").filter,s=n("1448"),a=i.aTypedArray;(0,i.exportTypedArrayMethod)("filter",function(t){t=r(a(this),t,1<arguments.length?arguments[1]:void 0);return s(this,t)})},ca91:function(t,e,n){"use strict";var i=n("ebb5"),r=n("d58f").left,s=i.aTypedArray;(0,i.exportTypedArrayMethod)("reduce",function(t){var e=arguments.length;return r(s(this),t,e,1<e?arguments[1]:void 0)})},caad:function(t,e,n){"use strict";var i=n("23e7"),r=n("4d64").includes,n=n("44d2");i({target:"Array",proto:!0},{includes:function(t){return r(this,t,1<arguments.length?arguments[1]:void 0)}}),n("includes")},cd26:function(t,e,n){"use strict";var n=n("ebb5"),r=n.aTypedArray,n=n.exportTypedArrayMethod,s=Math.floor;n("reverse",function(){for(var t,e=r(this).length,n=s(e/2),i=0;i<n;)t=this[i],this[i++]=this[--e],this[e]=t;return this})},cfc3:function(t,e,n){n("74e8")("Float32",function(i){return function(t,e,n){return i(this,t,e,n)}})},d139:function(t,e,n){"use strict";var i=n("ebb5"),r=n("b727").find,s=i.aTypedArray;(0,i.exportTypedArrayMethod)("find",function(t){return r(s(this),t,1<arguments.length?arguments[1]:void 0)})},d58f:function(t,e,n){function i(c){return function(t,e,n,i){h(e);var r=u(t),s=d(r),a=p(r),o=c?a-1:0,l=c?-1:1;if(n<2)for(;;){if(o in s){i=s[o],o+=l;break}if(o+=l,c?o<0:a<=o)throw f("Reduce of empty array with no initial value")}for(;c?0<=o:o<a;o+=l)o in s&&(i=e(i,s[o],o,r));return i}}var r=n("da84"),h=n("59ed"),u=n("7b0b"),d=n("44ad"),p=n("07fa"),f=r.TypeError;t.exports={left:i(!1),right:i(!0)}},d5d6:function(t,e,n){"use strict";var i=n("ebb5"),r=n("b727").forEach,s=i.aTypedArray;(0,i.exportTypedArrayMethod)("forEach",function(t){r(s(this),t,1<arguments.length?arguments[1]:void 0)})},dfb9:function(t,e,n){var s=n("07fa");t.exports=function(t,e){for(var n=0,i=s(e),r=new t(i);n<i;)r[n]=e[n++];return r}},e58c:function(t,e,n){"use strict";var r=n("2ba4"),s=n("fc6a"),a=n("5926"),o=n("07fa"),n=n("a640"),l=Math.min,c=[].lastIndexOf,h=!!c&&1/[1].lastIndexOf(1,-0)<0,n=n("lastIndexOf");t.exports=h||!n?function(t){if(h)return r(c,this,arguments)||0;var e=s(this),n=o(e),i=n-1;for((i=1<arguments.length?l(i,a(arguments[1])):i)<0&&(i=n+i);0<=i;i--)if(i in e&&e[i]===t)return i||0;return-1}:c},e91f:function(t,e,n){"use strict";var i=n("ebb5"),r=n("4d64").indexOf,s=i.aTypedArray;(0,i.exportTypedArrayMethod)("indexOf",function(t){return r(s(this),t,1<arguments.length?arguments[1]:void 0)})},eac5:function(t,e,n){var i=n("861d"),r=Math.floor;t.exports=Number.isInteger||function(t){return!i(t)&&isFinite(t)&&r(t)===t}},ebb5:function(t,e,n){"use strict";function i(t){return!!u(t)&&(t=p(t),d(D,t)||d(R,t))}var r,s,a,o=n("a981"),l=n("83ab"),c=n("da84"),h=n("1626"),u=n("861d"),d=n("1a2d"),p=n("f5df"),f=n("0d51"),m=n("9112"),g=n("6eeb"),v=n("9bf2").f,x=n("3a9b"),y=n("e163"),_=n("d2bb"),M=n("b622"),b=n("90e3"),S=c.Int8Array,w=S&&S.prototype,n=c.Uint8ClampedArray,n=n&&n.prototype,T=S&&y(S),A=w&&y(w),S=Object.prototype,E=c.TypeError,M=M("toStringTag"),L=b("TYPED_ARRAY_TAG"),C=b("TYPED_ARRAY_CONSTRUCTOR"),P=o&&!!_&&"Opera"!==p(c.opera),o=!1,D={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},R={BigInt64Array:8,BigUint64Array:8};for(r in D)s=c[r],a=s&&s.prototype,a?m(a,C,s):P=!1;for(r in R)s=c[r],a=s&&s.prototype,a&&m(a,C,s);if((!P||!h(T)||T===Function.prototype)&&(T=function(){throw E("Incorrect invocation")},P))for(r in D)c[r]&&_(c[r],T);if((!P||!A||A===S)&&(A=T.prototype,P))for(r in D)c[r]&&_(c[r].prototype,A);if(P&&y(n)!==A&&_(n,A),l&&!d(A,M))for(r in o=!0,v(A,M,{get:function(){return u(this)?this[L]:void 0}}),D)c[r]&&m(c[r],L,r);t.exports={NATIVE_ARRAY_BUFFER_VIEWS:P,TYPED_ARRAY_CONSTRUCTOR:C,TYPED_ARRAY_TAG:o&&L,aTypedArray:function(t){if(i(t))return t;throw E("Target is not a typed array")},aTypedArrayConstructor:function(t){if(h(t)&&(!_||x(T,t)))return t;throw E(f(t)+" is not a typed array constructor")},exportTypedArrayMethod:function(t,e,n,i){if(l){if(n)for(var r in D){r=c[r];if(r&&d(r.prototype,t))try{delete r.prototype[t]}catch(t){}}A[t]&&!n||g(A,t,!n&&P&&w[t]||e,i)}},exportTypedArrayStaticMethod:function(t,e,n){var i,r;if(l){if(_){if(n)for(i in D)if(r=c[i],r&&d(r,t))try{delete r[t]}catch(t){}if(T[t]&&!n)return;try{return g(T,t,!n&&P&&T[t]||e)}catch(t){}}for(i in D)r=c[i],!r||r[t]&&!n||g(r,t,e)}},isView:function(t){if(!u(t))return!1;t=p(t);return"DataView"===t||d(D,t)||d(R,t)},isTypedArray:i,TypedArray:T,TypedArrayPrototype:A}},f8cd:function(t,e,n){var i=n("da84"),r=n("5926"),s=i.RangeError;t.exports=function(t){t=r(t);if(t<0)throw s("The argument can't be less than 0");return t}}}]);
|