@netless/app-slide 0.0.33 → 0.0.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.iife.js CHANGED
@@ -1,4 +1,4 @@
1
- (()=>{var z_=Object.defineProperty,j_=Object.defineProperties;var V_=Object.getOwnPropertyDescriptors;var Bv=Object.getOwnPropertySymbols;var W_=Object.prototype.hasOwnProperty,X_=Object.prototype.propertyIsEnumerable;var kv=(wo,Bs,al)=>Bs in wo?z_(wo,Bs,{enumerable:!0,configurable:!0,writable:!0,value:al}):wo[Bs]=al,_p=(wo,Bs)=>{for(var al in Bs||(Bs={}))W_.call(Bs,al)&&kv(wo,al,Bs[al]);if(Bv)for(var al of Bv(Bs))X_.call(Bs,al)&&kv(wo,al,Bs[al]);return wo},Uv=(wo,Bs)=>j_(wo,V_(Bs));var J_=function(wo){"use strict";const Bs="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",al=Bs.length,Bg=Array(20),yf=()=>{for(let F=0;F<20;F++)Bg[F]=Bs.charAt(Math.random()*al);return Bg.join("")};class wm{constructor(){this.disposers=new Map}add(w,S=yf()){return this.flush(S),this.disposers.set(S,w()),S}addDisposer(w,S=yf()){return this.flush(S),this.disposers.set(S,w),S}addEventListener(w,S,W,pt,lt=yf()){return this.add(()=>(w.addEventListener(S,W,pt),()=>w.removeEventListener(S,W,pt)),lt),lt}setTimeout(w,S,W=yf()){return this.add(()=>{const pt=window.setTimeout(()=>{this.remove(W),w()},S);return()=>window.clearTimeout(pt)},W)}setInterval(w,S,W=yf()){return this.add(()=>{const pt=window.setInterval(w,S);return()=>window.clearInterval(pt)},W)}remove(w){const S=this.disposers.get(w);return this.disposers.delete(w),S}flush(w){const S=this.remove(w);if(S)try{S()}catch(W){console.error(W)}}flushAll(){this.disposers.forEach(w=>{try{w()}catch(S){console.error(S)}}),this.disposers.clear()}}function Gv(F){return F!=null&&typeof F=="object"&&!Array.isArray(F)}function Hv(F,w){let S=F.getAttributes();if(S||(F.setAttributes(w),S=F.getAttributes()),!S)throw new Error("[NetlessAppMonaco] No attributes");return Gv(w)&&Object.keys(w).forEach(W=>{Object.prototype.hasOwnProperty.call(S,W)||F.updateAttributes([W],w[W])}),S}var ao=function(F){var w={};function S(W){if(w[W])return w[W].exports;var pt=w[W]={i:W,l:!1,exports:{}};return F[W].call(pt.exports,pt,pt.exports,S),pt.l=!0,pt.exports}return S.m=F,S.c=w,S.d=function(W,pt,lt){S.o(W,pt)||Object.defineProperty(W,pt,{enumerable:!0,get:lt})},S.r=function(W){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(W,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(W,"__esModule",{value:!0})},S.t=function(W,pt){if(1&pt&&(W=S(W)),8&pt||4&pt&&typeof W=="object"&&W&&W.__esModule)return W;var lt=Object.create(null);if(S.r(lt),Object.defineProperty(lt,"default",{enumerable:!0,value:W}),2&pt&&typeof W!="string")for(var J in W)S.d(lt,J,function(X){return W[X]}.bind(null,J));return lt},S.n=function(W){var pt=W&&W.__esModule?function(){return W.default}:function(){return W};return S.d(pt,"a",pt),pt},S.o=function(W,pt){return Object.prototype.hasOwnProperty.call(W,pt)},S.p="",S(S.s=34)}([function(F,w,S){var W=Object.prototype.hasOwnProperty,pt="~";function lt(){}function J($,ut,kt){this.fn=$,this.context=ut,this.once=kt||!1}function X($,ut,kt,Gt,zt){if(typeof kt!="function")throw new TypeError("The listener must be a function");var L=new J(kt,Gt||$,zt),k=pt?pt+ut:ut;return $._events[k]?$._events[k].fn?$._events[k]=[$._events[k],L]:$._events[k].push(L):($._events[k]=L,$._eventsCount++),$}function ct($,ut){--$._eventsCount==0?$._events=new lt:delete $._events[ut]}function tt(){this._events=new lt,this._eventsCount=0}Object.create&&(lt.prototype=Object.create(null),new lt().__proto__||(pt=!1)),tt.prototype.eventNames=function(){var $,ut,kt=[];if(this._eventsCount===0)return kt;for(ut in $=this._events)W.call($,ut)&&kt.push(pt?ut.slice(1):ut);return Object.getOwnPropertySymbols?kt.concat(Object.getOwnPropertySymbols($)):kt},tt.prototype.listeners=function($){var ut=pt?pt+$:$,kt=this._events[ut];if(!kt)return[];if(kt.fn)return[kt.fn];for(var Gt=0,zt=kt.length,L=new Array(zt);Gt<zt;Gt++)L[Gt]=kt[Gt].fn;return L},tt.prototype.listenerCount=function($){var ut=pt?pt+$:$,kt=this._events[ut];return kt?kt.fn?1:kt.length:0},tt.prototype.emit=function($,ut,kt,Gt,zt,L){var k=pt?pt+$:$;if(!this._events[k])return!1;var Y,ht,B=this._events[k],Q=arguments.length;if(B.fn){switch(B.once&&this.removeListener($,B.fn,void 0,!0),Q){case 1:return B.fn.call(B.context),!0;case 2:return B.fn.call(B.context,ut),!0;case 3:return B.fn.call(B.context,ut,kt),!0;case 4:return B.fn.call(B.context,ut,kt,Gt),!0;case 5:return B.fn.call(B.context,ut,kt,Gt,zt),!0;case 6:return B.fn.call(B.context,ut,kt,Gt,zt,L),!0}for(ht=1,Y=new Array(Q-1);ht<Q;ht++)Y[ht-1]=arguments[ht];B.fn.apply(B.context,Y)}else{var et,ft=B.length;for(ht=0;ht<ft;ht++)switch(B[ht].once&&this.removeListener($,B[ht].fn,void 0,!0),Q){case 1:B[ht].fn.call(B[ht].context);break;case 2:B[ht].fn.call(B[ht].context,ut);break;case 3:B[ht].fn.call(B[ht].context,ut,kt);break;case 4:B[ht].fn.call(B[ht].context,ut,kt,Gt);break;default:if(!Y)for(et=1,Y=new Array(Q-1);et<Q;et++)Y[et-1]=arguments[et];B[ht].fn.apply(B[ht].context,Y)}}return!0},tt.prototype.on=function($,ut,kt){return X(this,$,ut,kt,!1)},tt.prototype.once=function($,ut,kt){return X(this,$,ut,kt,!0)},tt.prototype.removeListener=function($,ut,kt,Gt){var zt=pt?pt+$:$;if(!this._events[zt])return this;if(!ut)return ct(this,zt),this;var L=this._events[zt];if(L.fn)L.fn!==ut||Gt&&!L.once||kt&&L.context!==kt||ct(this,zt);else{for(var k=0,Y=[],ht=L.length;k<ht;k++)(L[k].fn!==ut||Gt&&!L[k].once||kt&&L[k].context!==kt)&&Y.push(L[k]);Y.length?this._events[zt]=Y.length===1?Y[0]:Y:ct(this,zt)}return this},tt.prototype.removeAllListeners=function($){var ut;return $?(ut=pt?pt+$:$,this._events[ut]&&ct(this,ut)):(this._events=new lt,this._eventsCount=0),this},tt.prototype.off=tt.prototype.removeListener,tt.prototype.addListener=tt.prototype.on,tt.prefixed=pt,tt.EventEmitter=tt,F.exports=tt},function(F,w,S){(function(W,pt){var lt;/**
1
+ (()=>{var z_=Object.defineProperty,j_=Object.defineProperties;var V_=Object.getOwnPropertyDescriptors;var kv=Object.getOwnPropertySymbols;var W_=Object.prototype.hasOwnProperty,X_=Object.prototype.propertyIsEnumerable;var Uv=(wo,Bs,al)=>Bs in wo?z_(wo,Bs,{enumerable:!0,configurable:!0,writable:!0,value:al}):wo[Bs]=al,_p=(wo,Bs)=>{for(var al in Bs||(Bs={}))W_.call(Bs,al)&&Uv(wo,al,Bs[al]);if(kv)for(var al of kv(Bs))X_.call(Bs,al)&&Uv(wo,al,Bs[al]);return wo},Gv=(wo,Bs)=>j_(wo,V_(Bs));var J_=function(wo){"use strict";const Bs="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",al=Bs.length,Bg=Array(20),yf=()=>{for(let F=0;F<20;F++)Bg[F]=Bs.charAt(Math.random()*al);return Bg.join("")};class wm{constructor(){this.disposers=new Map}add(w,S=yf()){return this.flush(S),this.disposers.set(S,w()),S}addDisposer(w,S=yf()){return this.flush(S),this.disposers.set(S,w),S}addEventListener(w,S,W,pt,lt=yf()){return this.add(()=>(w.addEventListener(S,W,pt),()=>w.removeEventListener(S,W,pt)),lt),lt}setTimeout(w,S,W=yf()){return this.add(()=>{const pt=window.setTimeout(()=>{this.remove(W),w()},S);return()=>window.clearTimeout(pt)},W)}setInterval(w,S,W=yf()){return this.add(()=>{const pt=window.setInterval(w,S);return()=>window.clearInterval(pt)},W)}remove(w){const S=this.disposers.get(w);return this.disposers.delete(w),S}flush(w){const S=this.remove(w);if(S)try{S()}catch(W){console.error(W)}}flushAll(){this.disposers.forEach(w=>{try{w()}catch(S){console.error(S)}}),this.disposers.clear()}}function Hv(F){return F!=null&&typeof F=="object"&&!Array.isArray(F)}function zv(F,w){let S=F.getAttributes();if(S||(F.setAttributes(w),S=F.getAttributes()),!S)throw new Error("[NetlessAppMonaco] No attributes");return Hv(w)&&Object.keys(w).forEach(W=>{Object.prototype.hasOwnProperty.call(S,W)||F.updateAttributes([W],w[W])}),S}var ao=function(F){var w={};function S(W){if(w[W])return w[W].exports;var pt=w[W]={i:W,l:!1,exports:{}};return F[W].call(pt.exports,pt,pt.exports,S),pt.l=!0,pt.exports}return S.m=F,S.c=w,S.d=function(W,pt,lt){S.o(W,pt)||Object.defineProperty(W,pt,{enumerable:!0,get:lt})},S.r=function(W){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(W,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(W,"__esModule",{value:!0})},S.t=function(W,pt){if(1&pt&&(W=S(W)),8&pt||4&pt&&typeof W=="object"&&W&&W.__esModule)return W;var lt=Object.create(null);if(S.r(lt),Object.defineProperty(lt,"default",{enumerable:!0,value:W}),2&pt&&typeof W!="string")for(var J in W)S.d(lt,J,function(X){return W[X]}.bind(null,J));return lt},S.n=function(W){var pt=W&&W.__esModule?function(){return W.default}:function(){return W};return S.d(pt,"a",pt),pt},S.o=function(W,pt){return Object.prototype.hasOwnProperty.call(W,pt)},S.p="",S(S.s=34)}([function(F,w,S){var W=Object.prototype.hasOwnProperty,pt="~";function lt(){}function J($,ut,kt){this.fn=$,this.context=ut,this.once=kt||!1}function X($,ut,kt,Gt,zt){if(typeof kt!="function")throw new TypeError("The listener must be a function");var L=new J(kt,Gt||$,zt),k=pt?pt+ut:ut;return $._events[k]?$._events[k].fn?$._events[k]=[$._events[k],L]:$._events[k].push(L):($._events[k]=L,$._eventsCount++),$}function ct($,ut){--$._eventsCount==0?$._events=new lt:delete $._events[ut]}function tt(){this._events=new lt,this._eventsCount=0}Object.create&&(lt.prototype=Object.create(null),new lt().__proto__||(pt=!1)),tt.prototype.eventNames=function(){var $,ut,kt=[];if(this._eventsCount===0)return kt;for(ut in $=this._events)W.call($,ut)&&kt.push(pt?ut.slice(1):ut);return Object.getOwnPropertySymbols?kt.concat(Object.getOwnPropertySymbols($)):kt},tt.prototype.listeners=function($){var ut=pt?pt+$:$,kt=this._events[ut];if(!kt)return[];if(kt.fn)return[kt.fn];for(var Gt=0,zt=kt.length,L=new Array(zt);Gt<zt;Gt++)L[Gt]=kt[Gt].fn;return L},tt.prototype.listenerCount=function($){var ut=pt?pt+$:$,kt=this._events[ut];return kt?kt.fn?1:kt.length:0},tt.prototype.emit=function($,ut,kt,Gt,zt,L){var k=pt?pt+$:$;if(!this._events[k])return!1;var Y,ht,B=this._events[k],Q=arguments.length;if(B.fn){switch(B.once&&this.removeListener($,B.fn,void 0,!0),Q){case 1:return B.fn.call(B.context),!0;case 2:return B.fn.call(B.context,ut),!0;case 3:return B.fn.call(B.context,ut,kt),!0;case 4:return B.fn.call(B.context,ut,kt,Gt),!0;case 5:return B.fn.call(B.context,ut,kt,Gt,zt),!0;case 6:return B.fn.call(B.context,ut,kt,Gt,zt,L),!0}for(ht=1,Y=new Array(Q-1);ht<Q;ht++)Y[ht-1]=arguments[ht];B.fn.apply(B.context,Y)}else{var et,ft=B.length;for(ht=0;ht<ft;ht++)switch(B[ht].once&&this.removeListener($,B[ht].fn,void 0,!0),Q){case 1:B[ht].fn.call(B[ht].context);break;case 2:B[ht].fn.call(B[ht].context,ut);break;case 3:B[ht].fn.call(B[ht].context,ut,kt);break;case 4:B[ht].fn.call(B[ht].context,ut,kt,Gt);break;default:if(!Y)for(et=1,Y=new Array(Q-1);et<Q;et++)Y[et-1]=arguments[et];B[ht].fn.apply(B[ht].context,Y)}}return!0},tt.prototype.on=function($,ut,kt){return X(this,$,ut,kt,!1)},tt.prototype.once=function($,ut,kt){return X(this,$,ut,kt,!0)},tt.prototype.removeListener=function($,ut,kt,Gt){var zt=pt?pt+$:$;if(!this._events[zt])return this;if(!ut)return ct(this,zt),this;var L=this._events[zt];if(L.fn)L.fn!==ut||Gt&&!L.once||kt&&L.context!==kt||ct(this,zt);else{for(var k=0,Y=[],ht=L.length;k<ht;k++)(L[k].fn!==ut||Gt&&!L[k].once||kt&&L[k].context!==kt)&&Y.push(L[k]);Y.length?this._events[zt]=Y.length===1?Y[0]:Y:ct(this,zt)}return this},tt.prototype.removeAllListeners=function($){var ut;return $?(ut=pt?pt+$:$,this._events[ut]&&ct(this,ut)):(this._events=new lt,this._eventsCount=0),this},tt.prototype.off=tt.prototype.removeListener,tt.prototype.addListener=tt.prototype.on,tt.prefixed=pt,tt.EventEmitter=tt,F.exports=tt},function(F,w,S){(function(W,pt){var lt;/**
2
2
  * @license
3
3
  * Lodash <https://lodash.com/>
4
4
  * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
@@ -2919,7 +2919,7 @@ void main() {
2919
2919
  squared_mean = squared_mean * HALF_SAMPLE_RATE;
2920
2920
  float std_dev = sqrt( squared_mean - mean * mean );
2921
2921
  gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
2922
- }`}),R=A.clone();R.defines.HORIZONTAL_PASS=1;const O=new zn;O.setAttribute("position",new Kn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const U=new Bi(O,A),D=this;function Z(Pt,Et){const Ot=t.update(U);A.uniforms.shadow_pass.value=Pt.map.texture,A.uniforms.resolution.value=Pt.mapSize,A.uniforms.radius.value=Pt.radius,m.setRenderTarget(Pt.mapPass),m.clear(),m.renderBufferDirect(Et,null,Ot,A,U,null),R.uniforms.shadow_pass.value=Pt.mapPass.texture,R.uniforms.resolution.value=Pt.mapSize,R.uniforms.radius.value=Pt.radius,m.setRenderTarget(Pt.map),m.clear(),m.renderBufferDirect(Et,null,Ot,R,U,null)}function ot(Pt){const Et=Pt<<0;let Ot=v[Et];return Ot===void 0&&(Ot=new Uh({depthPacking:os,morphTargets:Pt}),v[Et]=Ot),Ot}function vt(Pt){const Et=Pt<<0;let Ot=_[Et];return Ot===void 0&&(Ot=new ms({morphTargets:Pt}),_[Et]=Ot),Ot}function mt(Pt,Et,Ot,Ie,ye,xe,ge){let Ht=null,ce=ot,We=Pt.customDepthMaterial;if(Ie.isPointLight===!0&&(ce=vt,We=Pt.customDistanceMaterial),We===void 0){let je=!1;Ot.morphTargets===!0&&(je=Et.morphAttributes&&Et.morphAttributes.position&&Et.morphAttributes.position.length>0),Ht=ce(je)}else Ht=We;if(m.localClippingEnabled&&Ot.clipShadows===!0&&Ot.clippingPlanes.length!==0){const je=Ht.uuid,ze=Ot.uuid;let fn=x[je];fn===void 0&&(fn={},x[je]=fn);let _n=fn[ze];_n===void 0&&(_n=Ht.clone(),fn[ze]=_n),Ht=_n}return Ht.visible=Ot.visible,Ht.wireframe=Ot.wireframe,Ht.side=ge===Gt?Ot.shadowSide!==null?Ot.shadowSide:Ot.side:Ot.shadowSide!==null?Ot.shadowSide:C[Ot.side],Ht.clipShadows=Ot.clipShadows,Ht.clippingPlanes=Ot.clippingPlanes,Ht.clipIntersection=Ot.clipIntersection,Ht.wireframeLinewidth=Ot.wireframeLinewidth,Ht.linewidth=Ot.linewidth,Ie.isPointLight===!0&&Ht.isMeshDistanceMaterial===!0&&(Ht.referencePosition.setFromMatrixPosition(Ie.matrixWorld),Ht.nearDistance=ye,Ht.farDistance=xe),Ht}function At(Pt,Et,Ot,Ie,ye){if(Pt.visible===!1)return;if(Pt.layers.test(Et.layers)&&(Pt.isMesh||Pt.isLine||Pt.isPoints)&&(Pt.castShadow||Pt.receiveShadow&&ye===Gt)&&(!Pt.frustumCulled||a.intersectsObject(Pt))){Pt.modelViewMatrix.multiplyMatrices(Ot.matrixWorldInverse,Pt.matrixWorld);const ge=t.update(Pt),Ht=Pt.material;if(Array.isArray(Ht)){const ce=ge.groups;for(let We=0,je=ce.length;We<je;We++){const ze=ce[We],fn=Ht[ze.materialIndex];if(fn&&fn.visible){const _n=mt(Pt,ge,fn,Ie,Ot.near,Ot.far,ye);m.renderBufferDirect(Ot,null,ge,_n,Pt,ze)}}}else if(Ht.visible){const ce=mt(Pt,ge,Ht,Ie,Ot.near,Ot.far,ye);m.renderBufferDirect(Ot,null,ge,ce,Pt,null)}}const xe=Pt.children;for(let ge=0,Ht=xe.length;ge<Ht;ge++)At(xe[ge],Et,Ot,Ie,ye)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ut,this.render=function(Pt,Et,Ot){if(D.enabled===!1||D.autoUpdate===!1&&D.needsUpdate===!1||Pt.length===0)return;const Ie=m.getRenderTarget(),ye=m.getActiveCubeFace(),xe=m.getActiveMipmapLevel(),ge=m.state;ge.setBlending(B),ge.buffers.color.setClear(1,1,1,1),ge.buffers.depth.setTest(!0),ge.setScissorTest(!1);for(let Ht=0,ce=Pt.length;Ht<ce;Ht++){const We=Pt[Ht],je=We.shadow;if(je===void 0){console.warn("THREE.WebGLShadowMap:",We,"has no shadow.");continue}if(je.autoUpdate===!1&&je.needsUpdate===!1)continue;l.copy(je.mapSize);const ze=je.getFrameExtents();if(l.multiply(ze),d.copy(je.mapSize),(l.x>M||l.y>M)&&(l.x>M&&(d.x=Math.floor(M/ze.x),l.x=d.x*ze.x,je.mapSize.x=d.x),l.y>M&&(d.y=Math.floor(M/ze.y),l.y=d.y*ze.y,je.mapSize.y=d.y)),je.map===null&&!je.isPointLightShadow&&this.type===Gt){const _n={minFilter:Qe,magFilter:Qe,format:Tn};je.map=new Bo(l.x,l.y,_n),je.map.texture.name=We.name+".shadowMap",je.mapPass=new Bo(l.x,l.y,_n),je.camera.updateProjectionMatrix()}if(je.map===null){const _n={minFilter:wt,magFilter:wt,format:Tn};je.map=new Bo(l.x,l.y,_n),je.map.texture.name=We.name+".shadowMap",je.camera.updateProjectionMatrix()}m.setRenderTarget(je.map),m.clear();const fn=je.getViewportCount();for(let _n=0;_n<fn;_n++){const Mn=je.getViewport(_n);p.set(d.x*Mn.x,d.y*Mn.y,d.x*Mn.z,d.y*Mn.w),ge.viewport(p),je.updateMatrices(We,_n),a=je.getFrustum(),At(Et,Ot,je.camera,We,this.type)}je.isPointLightShadow||this.type!==Gt||Z(je,Ot),je.needsUpdate=!1}D.needsUpdate=!1,m.setRenderTarget(Ie,ye,xe)}}function Qd(m,t,i){const a=i.isWebGL2,l=new function(){let xt=!1;const Zt=new Ir;let Te=null;const Pe=new Ir(0,0,0,0);return{setMask:function(we){Te===we||xt||(m.colorMask(we,we,we,we),Te=we)},setLocked:function(we){xt=we},setClear:function(we,bn,Gn,Fn,_r){_r===!0&&(we*=Fn,bn*=Fn,Gn*=Fn),Zt.set(we,bn,Gn,Fn),Pe.equals(Zt)===!1&&(m.clearColor(we,bn,Gn,Fn),Pe.copy(Zt))},reset:function(){xt=!1,Te=null,Pe.set(-1,0,0,0)}}},d=new function(){let xt=!1,Zt=null,Te=null,Pe=null;return{setTest:function(we){we?Sn(2929):Rt(2929)},setMask:function(we){Zt===we||xt||(m.depthMask(we),Zt=we)},setFunc:function(we){if(Te!==we){if(we)switch(we){case Bn:m.depthFunc(512);break;case Wn:m.depthFunc(519);break;case vn:m.depthFunc(513);break;case Pr:m.depthFunc(515);break;case Ur:m.depthFunc(514);break;case Rr:m.depthFunc(518);break;case qr:m.depthFunc(516);break;case yr:m.depthFunc(517);break;default:m.depthFunc(515)}else m.depthFunc(515);Te=we}},setLocked:function(we){xt=we},setClear:function(we){Pe!==we&&(m.clearDepth(we),Pe=we)},reset:function(){xt=!1,Zt=null,Te=null,Pe=null}}},p=new function(){let xt=!1,Zt=null,Te=null,Pe=null,we=null,bn=null,Gn=null,Fn=null,_r=null;return{setTest:function(Tr){xt||(Tr?Sn(2960):Rt(2960))},setMask:function(Tr){Zt===Tr||xt||(m.stencilMask(Tr),Zt=Tr)},setFunc:function(Tr,qo,fi){Te===Tr&&Pe===qo&&we===fi||(m.stencilFunc(Tr,qo,fi),Te=Tr,Pe=qo,we=fi)},setOp:function(Tr,qo,fi){bn===Tr&&Gn===qo&&Fn===fi||(m.stencilOp(Tr,qo,fi),bn=Tr,Gn=qo,Fn=fi)},setLocked:function(Tr){xt=Tr},setClear:function(Tr){_r!==Tr&&(m.clearStencil(Tr),_r=Tr)},reset:function(){xt=!1,Zt=null,Te=null,Pe=null,we=null,bn=null,Gn=null,Fn=null,_r=null}}};let v={},_=null,x={},M=null,C=!1,A=null,R=null,O=null,U=null,D=null,Z=null,ot=null,vt=!1,mt=null,At=null,Pt=null,Et=null,Ot=null;const Ie=m.getParameter(35661);let ye=!1,xe=0;const ge=m.getParameter(7938);ge.indexOf("WebGL")!==-1?(xe=parseFloat(/^WebGL (\d)/.exec(ge)[1]),ye=xe>=1):ge.indexOf("OpenGL ES")!==-1&&(xe=parseFloat(/^OpenGL ES (\d)/.exec(ge)[1]),ye=xe>=2);let Ht=null,ce={};const We=m.getParameter(3088),je=m.getParameter(2978),ze=new Ir().fromArray(We),fn=new Ir().fromArray(je);function _n(xt,Zt,Te){const Pe=new Uint8Array(4),we=m.createTexture();m.bindTexture(xt,we),m.texParameteri(xt,10241,9728),m.texParameteri(xt,10240,9728);for(let bn=0;bn<Te;bn++)m.texImage2D(Zt+bn,0,6408,1,1,0,6408,5121,Pe);return we}const Mn={};function Sn(xt){v[xt]!==!0&&(m.enable(xt),v[xt]=!0)}function Rt(xt){v[xt]!==!1&&(m.disable(xt),v[xt]=!1)}Mn[3553]=_n(3553,3553,1),Mn[34067]=_n(34067,34069,6),l.setClear(0,0,0,1),d.setClear(1),p.setClear(0),Sn(2929),d.setFunc(Pr),pe(!1),rn(X),Sn(2884),Be(B);const Dt={[ne]:32774,[bt]:32778,[Jt]:32779};if(a)Dt[Kt]=32775,Dt[rt]=32776;else{const xt=t.get("EXT_blend_minmax");xt!==null&&(Dt[Kt]=xt.MIN_EXT,Dt[rt]=xt.MAX_EXT)}const Fe={[Ut]:0,[Wt]:1,[te]:768,[le]:770,[Ln]:776,[Hn]:774,[Ye]:772,[Xt]:769,[fe]:771,[Ke]:775,[ke]:773};function Be(xt,Zt,Te,Pe,we,bn,Gn,Fn){if(xt!==B){if(C===!1&&(Sn(3042),C=!0),xt===Oe)we=we||Zt,bn=bn||Te,Gn=Gn||Pe,Zt===R&&we===D||(m.blendEquationSeparate(Dt[Zt],Dt[we]),R=Zt,D=we),Te===O&&Pe===U&&bn===Z&&Gn===ot||(m.blendFuncSeparate(Fe[Te],Fe[Pe],Fe[bn],Fe[Gn]),O=Te,U=Pe,Z=bn,ot=Gn),A=xt,vt=null;else if(xt!==A||Fn!==vt){if(R===ne&&D===ne||(m.blendEquation(32774),R=ne,D=ne),Fn)switch(xt){case Q:m.blendFuncSeparate(1,771,1,771);break;case et:m.blendFunc(1,1);break;case ft:m.blendFuncSeparate(0,0,769,771);break;case ae:m.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",xt)}else switch(xt){case Q:m.blendFuncSeparate(770,771,1,771);break;case et:m.blendFunc(770,1);break;case ft:m.blendFunc(0,769);break;case ae:m.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",xt)}O=null,U=null,Z=null,ot=null,A=xt,vt=Fn}}else C===!0&&(Rt(3042),C=!1)}function pe(xt){mt!==xt&&(xt?m.frontFace(2304):m.frontFace(2305),mt=xt)}function rn(xt){xt!==J?(Sn(2884),xt!==At&&(xt===X?m.cullFace(1029):xt===ct?m.cullFace(1028):m.cullFace(1032))):Rt(2884),At=xt}function sn(xt,Zt,Te){xt?(Sn(32823),Et===Zt&&Ot===Te||(m.polygonOffset(Zt,Te),Et=Zt,Ot=Te)):Rt(32823)}function be(xt){xt===void 0&&(xt=33984+Ie-1),Ht!==xt&&(m.activeTexture(xt),Ht=xt)}return{buffers:{color:l,depth:d,stencil:p},enable:Sn,disable:Rt,bindFramebuffer:function(xt,Zt){return Zt===null&&_!==null&&(Zt=_),x[xt]!==Zt&&(m.bindFramebuffer(xt,Zt),x[xt]=Zt,a&&(xt===36009&&(x[36160]=Zt),xt===36160&&(x[36009]=Zt)),!0)},bindXRFramebuffer:function(xt){xt!==_&&(m.bindFramebuffer(36160,xt),_=xt)},useProgram:function(xt){return M!==xt&&(m.useProgram(xt),M=xt,!0)},setBlending:Be,setMaterial:function(xt,Zt){xt.side===k?Rt(2884):Sn(2884);let Te=xt.side===L;Zt&&(Te=!Te),pe(Te),xt.blending===Q&&xt.transparent===!1?Be(B):Be(xt.blending,xt.blendEquation,xt.blendSrc,xt.blendDst,xt.blendEquationAlpha,xt.blendSrcAlpha,xt.blendDstAlpha,xt.premultipliedAlpha),d.setFunc(xt.depthFunc),d.setTest(xt.depthTest),d.setMask(xt.depthWrite),l.setMask(xt.colorWrite);const Pe=xt.stencilWrite;p.setTest(Pe),Pe&&(p.setMask(xt.stencilWriteMask),p.setFunc(xt.stencilFunc,xt.stencilRef,xt.stencilFuncMask),p.setOp(xt.stencilFail,xt.stencilZFail,xt.stencilZPass)),sn(xt.polygonOffset,xt.polygonOffsetFactor,xt.polygonOffsetUnits),xt.alphaToCoverage===!0?Sn(32926):Rt(32926)},setFlipSided:pe,setCullFace:rn,setLineWidth:function(xt){xt!==Pt&&(ye&&m.lineWidth(xt),Pt=xt)},setPolygonOffset:sn,setScissorTest:function(xt){xt?Sn(3089):Rt(3089)},activeTexture:be,bindTexture:function(xt,Zt){Ht===null&&be();let Te=ce[Ht];Te===void 0&&(Te={type:void 0,texture:void 0},ce[Ht]=Te),Te.type===xt&&Te.texture===Zt||(m.bindTexture(xt,Zt||Mn[xt]),Te.type=xt,Te.texture=Zt)},unbindTexture:function(){const xt=ce[Ht];xt!==void 0&&xt.type!==void 0&&(m.bindTexture(xt.type,null),xt.type=void 0,xt.texture=void 0)},compressedTexImage2D:function(){try{m.compressedTexImage2D.apply(m,arguments)}catch(xt){console.error("THREE.WebGLState:",xt)}},texImage2D:function(){try{m.texImage2D.apply(m,arguments)}catch(xt){console.error("THREE.WebGLState:",xt)}},texImage3D:function(){try{m.texImage3D.apply(m,arguments)}catch(xt){console.error("THREE.WebGLState:",xt)}},scissor:function(xt){ze.equals(xt)===!1&&(m.scissor(xt.x,xt.y,xt.z,xt.w),ze.copy(xt))},viewport:function(xt){fn.equals(xt)===!1&&(m.viewport(xt.x,xt.y,xt.z,xt.w),fn.copy(xt))},reset:function(){m.disable(3042),m.disable(2884),m.disable(2929),m.disable(32823),m.disable(3089),m.disable(2960),m.disable(32926),m.blendEquation(32774),m.blendFunc(1,0),m.blendFuncSeparate(1,0,1,0),m.colorMask(!0,!0,!0,!0),m.clearColor(0,0,0,0),m.depthMask(!0),m.depthFunc(513),m.clearDepth(1),m.stencilMask(4294967295),m.stencilFunc(519,0,4294967295),m.stencilOp(7680,7680,7680),m.clearStencil(0),m.cullFace(1029),m.frontFace(2305),m.polygonOffset(0,0),m.activeTexture(33984),m.bindFramebuffer(36160,null),a===!0&&(m.bindFramebuffer(36009,null),m.bindFramebuffer(36008,null)),m.useProgram(null),m.lineWidth(1),m.scissor(0,0,m.canvas.width,m.canvas.height),m.viewport(0,0,m.canvas.width,m.canvas.height),v={},Ht=null,ce={},_=null,x={},M=null,C=!1,A=null,R=null,O=null,U=null,D=null,Z=null,ot=null,vt=!1,mt=null,At=null,Pt=null,Et=null,Ot=null,ze.set(0,0,m.canvas.width,m.canvas.height),fn.set(0,0,m.canvas.width,m.canvas.height),l.reset(),d.reset(),p.reset()}}}function Cs(m,t,i,a,l,d,p){const v=l.isWebGL2,_=l.maxTextures,x=l.maxCubemapSize,M=l.maxTextureSize,C=l.maxSamples,A=new WeakMap;let R,O=!1;try{O=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function U(Rt,Dt){return O?new OffscreenCanvas(Rt,Dt):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function D(Rt,Dt,Fe,Be){let pe=1;if((Rt.width>Be||Rt.height>Be)&&(pe=Be/Math.max(Rt.width,Rt.height)),pe<1||Dt===!0){if(typeof HTMLImageElement!="undefined"&&Rt instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&Rt instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&Rt instanceof ImageBitmap){const rn=Dt?Ep:Math.floor,sn=rn(pe*Rt.width),be=rn(pe*Rt.height);R===void 0&&(R=U(sn,be));const xt=Fe?U(sn,be):R;return xt.width=sn,xt.height=be,xt.getContext("2d").drawImage(Rt,0,0,sn,be),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Rt.width+"x"+Rt.height+") to ("+sn+"x"+be+")."),xt}return"data"in Rt&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Rt.width+"x"+Rt.height+")."),Rt}return Rt}function Z(Rt){return xi(Rt.width)&&xi(Rt.height)}function ot(Rt,Dt){return Rt.generateMipmaps&&Dt&&Rt.minFilter!==wt&&Rt.minFilter!==Qe}function vt(Rt,Dt,Fe,Be,pe=1){m.generateMipmap(Rt),a.get(Dt).__maxMipLevel=Math.log2(Math.max(Fe,Be,pe))}function mt(Rt,Dt,Fe){if(v===!1)return Dt;if(Rt!==null){if(m[Rt]!==void 0)return m[Rt];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+Rt+"'")}let Be=Dt;return Dt===6403&&(Fe===5126&&(Be=33326),Fe===5131&&(Be=33325),Fe===5121&&(Be=33321)),Dt===6407&&(Fe===5126&&(Be=34837),Fe===5131&&(Be=34843),Fe===5121&&(Be=32849)),Dt===6408&&(Fe===5126&&(Be=34836),Fe===5131&&(Be=34842),Fe===5121&&(Be=32856)),Be!==33325&&Be!==33326&&Be!==34842&&Be!==34836||t.get("EXT_color_buffer_float"),Be}function At(Rt){return Rt===wt||Rt===Vt||Rt===Le?9728:9729}function Pt(Rt){const Dt=Rt.target;Dt.removeEventListener("dispose",Pt),function(Fe){const Be=a.get(Fe);Be.__webglInit!==void 0&&(m.deleteTexture(Be.__webglTexture),a.remove(Fe))}(Dt),Dt.isVideoTexture&&A.delete(Dt),p.memory.textures--}function Et(Rt){const Dt=Rt.target;Dt.removeEventListener("dispose",Et),function(Fe){const Be=Fe.texture,pe=a.get(Fe),rn=a.get(Be);if(!!Fe){if(rn.__webglTexture!==void 0&&(m.deleteTexture(rn.__webglTexture),p.memory.textures--),Fe.depthTexture&&Fe.depthTexture.dispose(),Fe.isWebGLCubeRenderTarget)for(let sn=0;sn<6;sn++)m.deleteFramebuffer(pe.__webglFramebuffer[sn]),pe.__webglDepthbuffer&&m.deleteRenderbuffer(pe.__webglDepthbuffer[sn]);else m.deleteFramebuffer(pe.__webglFramebuffer),pe.__webglDepthbuffer&&m.deleteRenderbuffer(pe.__webglDepthbuffer),pe.__webglMultisampledFramebuffer&&m.deleteFramebuffer(pe.__webglMultisampledFramebuffer),pe.__webglColorRenderbuffer&&m.deleteRenderbuffer(pe.__webglColorRenderbuffer),pe.__webglDepthRenderbuffer&&m.deleteRenderbuffer(pe.__webglDepthRenderbuffer);if(Fe.isWebGLMultipleRenderTargets)for(let sn=0,be=Be.length;sn<be;sn++){const xt=a.get(Be[sn]);xt.__webglTexture&&(m.deleteTexture(xt.__webglTexture),p.memory.textures--),a.remove(Be[sn])}a.remove(Be),a.remove(Fe)}}(Dt)}let Ot=0;function Ie(Rt,Dt){const Fe=a.get(Rt);if(Rt.isVideoTexture&&function(Be){const pe=p.render.frame;A.get(Be)!==pe&&(A.set(Be,pe),Be.update())}(Rt),Rt.version>0&&Fe.__version!==Rt.version){const Be=Rt.image;if(Be===void 0)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(Be.complete!==!1)return void We(Fe,Rt,Dt);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}i.activeTexture(33984+Dt),i.bindTexture(3553,Fe.__webglTexture)}function ye(Rt,Dt){const Fe=a.get(Rt);Rt.version>0&&Fe.__version!==Rt.version?function(Be,pe,rn){if(pe.image.length!==6)return;ce(Be,pe),i.activeTexture(33984+rn),i.bindTexture(34067,Be.__webglTexture),m.pixelStorei(37440,pe.flipY),m.pixelStorei(37441,pe.premultiplyAlpha),m.pixelStorei(3317,pe.unpackAlignment),m.pixelStorei(37443,0);const sn=pe&&(pe.isCompressedTexture||pe.image[0].isCompressedTexture),be=pe.image[0]&&pe.image[0].isDataTexture,xt=[];for(let Fn=0;Fn<6;Fn++)xt[Fn]=sn||be?be?pe.image[Fn].image:pe.image[Fn]:D(pe.image[Fn],!1,!0,x);const Zt=xt[0],Te=Z(Zt)||v,Pe=d.convert(pe.format),we=d.convert(pe.type),bn=mt(pe.internalFormat,Pe,we);let Gn;if(Ht(34067,pe,Te),sn){for(let Fn=0;Fn<6;Fn++){Gn=xt[Fn].mipmaps;for(let _r=0;_r<Gn.length;_r++){const Tr=Gn[_r];pe.format!==Tn&&pe.format!==yn?Pe!==null?i.compressedTexImage2D(34069+Fn,_r,bn,Tr.width,Tr.height,0,Tr.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):i.texImage2D(34069+Fn,_r,bn,Tr.width,Tr.height,0,Pe,we,Tr.data)}}Be.__maxMipLevel=Gn.length-1}else{Gn=pe.mipmaps;for(let Fn=0;Fn<6;Fn++)if(be){i.texImage2D(34069+Fn,0,bn,xt[Fn].width,xt[Fn].height,0,Pe,we,xt[Fn].data);for(let _r=0;_r<Gn.length;_r++){const Tr=Gn[_r].image[Fn].image;i.texImage2D(34069+Fn,_r+1,bn,Tr.width,Tr.height,0,Pe,we,Tr.data)}}else{i.texImage2D(34069+Fn,0,bn,Pe,we,xt[Fn]);for(let _r=0;_r<Gn.length;_r++){const Tr=Gn[_r];i.texImage2D(34069+Fn,_r+1,bn,Pe,we,Tr.image[Fn])}}Be.__maxMipLevel=Gn.length}ot(pe,Te)&&vt(34067,pe,Zt.width,Zt.height),Be.__version=pe.version,pe.onUpdate&&pe.onUpdate(pe)}(Fe,Rt,Dt):(i.activeTexture(33984+Dt),i.bindTexture(34067,Fe.__webglTexture))}const xe={[yt]:10497,[St]:33071,[Ct]:33648},ge={[wt]:9728,[Vt]:9984,[Le]:9986,[Qe]:9729,[Qn]:9985,[Yr]:9987};function Ht(Rt,Dt,Fe){if(Fe?(m.texParameteri(Rt,10242,xe[Dt.wrapS]),m.texParameteri(Rt,10243,xe[Dt.wrapT]),Rt!==32879&&Rt!==35866||m.texParameteri(Rt,32882,xe[Dt.wrapR]),m.texParameteri(Rt,10240,ge[Dt.magFilter]),m.texParameteri(Rt,10241,ge[Dt.minFilter])):(m.texParameteri(Rt,10242,33071),m.texParameteri(Rt,10243,33071),Rt!==32879&&Rt!==35866||m.texParameteri(Rt,32882,33071),Dt.wrapS===St&&Dt.wrapT===St||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),m.texParameteri(Rt,10240,At(Dt.magFilter)),m.texParameteri(Rt,10241,At(Dt.minFilter)),Dt.minFilter!==wt&&Dt.minFilter!==Qe&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),t.has("EXT_texture_filter_anisotropic")===!0){const Be=t.get("EXT_texture_filter_anisotropic");if(Dt.type===ee&&t.has("OES_texture_float_linear")===!1||v===!1&&Dt.type===Ft&&t.has("OES_texture_half_float_linear")===!1)return;(Dt.anisotropy>1||a.get(Dt).__currentAnisotropy)&&(m.texParameterf(Rt,Be.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(Dt.anisotropy,l.getMaxAnisotropy())),a.get(Dt).__currentAnisotropy=Dt.anisotropy)}}function ce(Rt,Dt){Rt.__webglInit===void 0&&(Rt.__webglInit=!0,Dt.addEventListener("dispose",Pt),Rt.__webglTexture=m.createTexture(),p.memory.textures++)}function We(Rt,Dt,Fe){let Be=3553;Dt.isDataTexture2DArray&&(Be=35866),Dt.isDataTexture3D&&(Be=32879),ce(Rt,Dt),i.activeTexture(33984+Fe),i.bindTexture(Be,Rt.__webglTexture),m.pixelStorei(37440,Dt.flipY),m.pixelStorei(37441,Dt.premultiplyAlpha),m.pixelStorei(3317,Dt.unpackAlignment),m.pixelStorei(37443,0);const pe=function(we){return!v&&(we.wrapS!==St||we.wrapT!==St||we.minFilter!==wt&&we.minFilter!==Qe)}(Dt)&&Z(Dt.image)===!1,rn=D(Dt.image,pe,!1,M),sn=Z(rn)||v,be=d.convert(Dt.format);let xt,Zt=d.convert(Dt.type),Te=mt(Dt.internalFormat,be,Zt);Ht(Be,Dt,sn);const Pe=Dt.mipmaps;if(Dt.isDepthTexture)Te=6402,v?Te=Dt.type===ee?36012:Dt.type===Jo?33190:Dt.type===un?35056:33189:Dt.type===ee&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),Dt.format===dn&&Te===6402&&Dt.type!==Ra&&Dt.type!==Jo&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),Dt.type=Ra,Zt=d.convert(Dt.type)),Dt.format===rr&&Te===6402&&(Te=34041,Dt.type!==un&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),Dt.type=un,Zt=d.convert(Dt.type))),i.texImage2D(3553,0,Te,rn.width,rn.height,0,be,Zt,null);else if(Dt.isDataTexture)if(Pe.length>0&&sn){for(let we=0,bn=Pe.length;we<bn;we++)xt=Pe[we],i.texImage2D(3553,we,Te,xt.width,xt.height,0,be,Zt,xt.data);Dt.generateMipmaps=!1,Rt.__maxMipLevel=Pe.length-1}else i.texImage2D(3553,0,Te,rn.width,rn.height,0,be,Zt,rn.data),Rt.__maxMipLevel=0;else if(Dt.isCompressedTexture){for(let we=0,bn=Pe.length;we<bn;we++)xt=Pe[we],Dt.format!==Tn&&Dt.format!==yn?be!==null?i.compressedTexImage2D(3553,we,Te,xt.width,xt.height,0,xt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):i.texImage2D(3553,we,Te,xt.width,xt.height,0,be,Zt,xt.data);Rt.__maxMipLevel=Pe.length-1}else if(Dt.isDataTexture2DArray)i.texImage3D(35866,0,Te,rn.width,rn.height,rn.depth,0,be,Zt,rn.data),Rt.__maxMipLevel=0;else if(Dt.isDataTexture3D)i.texImage3D(32879,0,Te,rn.width,rn.height,rn.depth,0,be,Zt,rn.data),Rt.__maxMipLevel=0;else if(Pe.length>0&&sn){for(let we=0,bn=Pe.length;we<bn;we++)xt=Pe[we],i.texImage2D(3553,we,Te,be,Zt,xt);Dt.generateMipmaps=!1,Rt.__maxMipLevel=Pe.length-1}else i.texImage2D(3553,0,Te,be,Zt,rn),Rt.__maxMipLevel=0;ot(Dt,sn)&&vt(Be,Dt,rn.width,rn.height),Rt.__version=Dt.version,Dt.onUpdate&&Dt.onUpdate(Dt)}function je(Rt,Dt,Fe,Be,pe){const rn=d.convert(Fe.format),sn=d.convert(Fe.type),be=mt(Fe.internalFormat,rn,sn);pe===32879||pe===35866?i.texImage3D(pe,0,be,Dt.width,Dt.height,Dt.depth,0,rn,sn,null):i.texImage2D(pe,0,be,Dt.width,Dt.height,0,rn,sn,null),i.bindFramebuffer(36160,Rt),m.framebufferTexture2D(36160,Be,pe,a.get(Fe).__webglTexture,0),i.bindFramebuffer(36160,null)}function ze(Rt,Dt,Fe){if(m.bindRenderbuffer(36161,Rt),Dt.depthBuffer&&!Dt.stencilBuffer){let Be=33189;if(Fe){const pe=Dt.depthTexture;pe&&pe.isDepthTexture&&(pe.type===ee?Be=36012:pe.type===Jo&&(Be=33190));const rn=_n(Dt);m.renderbufferStorageMultisample(36161,rn,Be,Dt.width,Dt.height)}else m.renderbufferStorage(36161,Be,Dt.width,Dt.height);m.framebufferRenderbuffer(36160,36096,36161,Rt)}else if(Dt.depthBuffer&&Dt.stencilBuffer){if(Fe){const Be=_n(Dt);m.renderbufferStorageMultisample(36161,Be,35056,Dt.width,Dt.height)}else m.renderbufferStorage(36161,34041,Dt.width,Dt.height);m.framebufferRenderbuffer(36160,33306,36161,Rt)}else{const Be=Dt.isWebGLMultipleRenderTargets===!0?Dt.texture[0]:Dt.texture,pe=d.convert(Be.format),rn=d.convert(Be.type),sn=mt(Be.internalFormat,pe,rn);if(Fe){const be=_n(Dt);m.renderbufferStorageMultisample(36161,be,sn,Dt.width,Dt.height)}else m.renderbufferStorage(36161,sn,Dt.width,Dt.height)}m.bindRenderbuffer(36161,null)}function fn(Rt){const Dt=a.get(Rt),Fe=Rt.isWebGLCubeRenderTarget===!0;if(Rt.depthTexture){if(Fe)throw new Error("target.depthTexture not supported in Cube render targets");(function(Be,pe){if(pe&&pe.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(i.bindFramebuffer(36160,Be),!pe.depthTexture||!pe.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");a.get(pe.depthTexture).__webglTexture&&pe.depthTexture.image.width===pe.width&&pe.depthTexture.image.height===pe.height||(pe.depthTexture.image.width=pe.width,pe.depthTexture.image.height=pe.height,pe.depthTexture.needsUpdate=!0),Ie(pe.depthTexture,0);const rn=a.get(pe.depthTexture).__webglTexture;if(pe.depthTexture.format===dn)m.framebufferTexture2D(36160,36096,3553,rn,0);else{if(pe.depthTexture.format!==rr)throw new Error("Unknown depthTexture format");m.framebufferTexture2D(36160,33306,3553,rn,0)}})(Dt.__webglFramebuffer,Rt)}else if(Fe){Dt.__webglDepthbuffer=[];for(let Be=0;Be<6;Be++)i.bindFramebuffer(36160,Dt.__webglFramebuffer[Be]),Dt.__webglDepthbuffer[Be]=m.createRenderbuffer(),ze(Dt.__webglDepthbuffer[Be],Rt,!1)}else i.bindFramebuffer(36160,Dt.__webglFramebuffer),Dt.__webglDepthbuffer=m.createRenderbuffer(),ze(Dt.__webglDepthbuffer,Rt,!1);i.bindFramebuffer(36160,null)}function _n(Rt){return v&&Rt.isWebGLMultisampleRenderTarget?Math.min(C,Rt.samples):0}let Mn=!1,Sn=!1;this.allocateTextureUnit=function(){const Rt=Ot;return Rt>=_&&console.warn("THREE.WebGLTextures: Trying to use "+Rt+" texture units while this GPU supports only "+_),Ot+=1,Rt},this.resetTextureUnits=function(){Ot=0},this.setTexture2D=Ie,this.setTexture2DArray=function(Rt,Dt){const Fe=a.get(Rt);Rt.version>0&&Fe.__version!==Rt.version?We(Fe,Rt,Dt):(i.activeTexture(33984+Dt),i.bindTexture(35866,Fe.__webglTexture))},this.setTexture3D=function(Rt,Dt){const Fe=a.get(Rt);Rt.version>0&&Fe.__version!==Rt.version?We(Fe,Rt,Dt):(i.activeTexture(33984+Dt),i.bindTexture(32879,Fe.__webglTexture))},this.setTextureCube=ye,this.setupRenderTarget=function(Rt){const Dt=Rt.texture,Fe=a.get(Rt),Be=a.get(Dt);Rt.addEventListener("dispose",Et),Rt.isWebGLMultipleRenderTargets!==!0&&(Be.__webglTexture=m.createTexture(),Be.__version=Dt.version,p.memory.textures++);const pe=Rt.isWebGLCubeRenderTarget===!0,rn=Rt.isWebGLMultipleRenderTargets===!0,sn=Rt.isWebGLMultisampleRenderTarget===!0,be=Dt.isDataTexture3D||Dt.isDataTexture2DArray,xt=Z(Rt)||v;if(!v||Dt.format!==yn||Dt.type!==ee&&Dt.type!==Ft||(Dt.format=Tn,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),pe){Fe.__webglFramebuffer=[];for(let Zt=0;Zt<6;Zt++)Fe.__webglFramebuffer[Zt]=m.createFramebuffer()}else if(Fe.__webglFramebuffer=m.createFramebuffer(),rn)if(l.drawBuffers){const Zt=Rt.texture;for(let Te=0,Pe=Zt.length;Te<Pe;Te++){const we=a.get(Zt[Te]);we.__webglTexture===void 0&&(we.__webglTexture=m.createTexture(),p.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(sn)if(v){Fe.__webglMultisampledFramebuffer=m.createFramebuffer(),Fe.__webglColorRenderbuffer=m.createRenderbuffer(),m.bindRenderbuffer(36161,Fe.__webglColorRenderbuffer);const Zt=d.convert(Dt.format),Te=d.convert(Dt.type),Pe=mt(Dt.internalFormat,Zt,Te),we=_n(Rt);m.renderbufferStorageMultisample(36161,we,Pe,Rt.width,Rt.height),i.bindFramebuffer(36160,Fe.__webglMultisampledFramebuffer),m.framebufferRenderbuffer(36160,36064,36161,Fe.__webglColorRenderbuffer),m.bindRenderbuffer(36161,null),Rt.depthBuffer&&(Fe.__webglDepthRenderbuffer=m.createRenderbuffer(),ze(Fe.__webglDepthRenderbuffer,Rt,!0)),i.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(pe){i.bindTexture(34067,Be.__webglTexture),Ht(34067,Dt,xt);for(let Zt=0;Zt<6;Zt++)je(Fe.__webglFramebuffer[Zt],Rt,Dt,36064,34069+Zt);ot(Dt,xt)&&vt(34067,Dt,Rt.width,Rt.height),i.bindTexture(34067,null)}else if(rn){const Zt=Rt.texture;for(let Te=0,Pe=Zt.length;Te<Pe;Te++){const we=Zt[Te],bn=a.get(we);i.bindTexture(3553,bn.__webglTexture),Ht(3553,we,xt),je(Fe.__webglFramebuffer,Rt,we,36064+Te,3553),ot(we,xt)&&vt(3553,we,Rt.width,Rt.height)}i.bindTexture(3553,null)}else{let Zt=3553;be&&(v?Zt=Dt.isDataTexture3D?32879:35866:console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")),i.bindTexture(Zt,Be.__webglTexture),Ht(Zt,Dt,xt),je(Fe.__webglFramebuffer,Rt,Dt,36064,Zt),ot(Dt,xt)&&vt(Zt,Dt,Rt.width,Rt.height,Rt.depth),i.bindTexture(Zt,null)}Rt.depthBuffer&&fn(Rt)},this.updateRenderTargetMipmap=function(Rt){const Dt=Z(Rt)||v,Fe=Rt.isWebGLMultipleRenderTargets===!0?Rt.texture:[Rt.texture];for(let Be=0,pe=Fe.length;Be<pe;Be++){const rn=Fe[Be];if(ot(rn,Dt)){const sn=Rt.isWebGLCubeRenderTarget?34067:3553,be=a.get(rn).__webglTexture;i.bindTexture(sn,be),vt(sn,rn,Rt.width,Rt.height),i.bindTexture(sn,null)}}},this.updateMultisampleRenderTarget=function(Rt){if(Rt.isWebGLMultisampleRenderTarget)if(v){const Dt=Rt.width,Fe=Rt.height;let Be=16384;Rt.depthBuffer&&(Be|=256),Rt.stencilBuffer&&(Be|=1024);const pe=a.get(Rt);i.bindFramebuffer(36008,pe.__webglMultisampledFramebuffer),i.bindFramebuffer(36009,pe.__webglFramebuffer),m.blitFramebuffer(0,0,Dt,Fe,0,0,Dt,Fe,Be,9728),i.bindFramebuffer(36008,null),i.bindFramebuffer(36009,pe.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(Rt,Dt){Rt&&Rt.isWebGLRenderTarget&&(Mn===!1&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),Mn=!0),Rt=Rt.texture),Ie(Rt,Dt)},this.safeSetTextureCube=function(Rt,Dt){Rt&&Rt.isWebGLCubeRenderTarget&&(Sn===!1&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),Sn=!0),Rt=Rt.texture),ye(Rt,Dt)}}function Wc(m,t,i){const a=i.isWebGL2;return{convert:function(l){let d;if(l===uo)return 5121;if(l===Se)return 32819;if(l===Ge)return 32820;if(l===Ve)return 33635;if(l===vs)return 5120;if(l===ea)return 5122;if(l===Ra)return 5123;if(l===rh)return 5124;if(l===Jo)return 5125;if(l===ee)return 5126;if(l===Ft)return a?5131:(d=t.get("OES_texture_half_float"),d!==null?d.HALF_FLOAT_OES:null);if(l===Dn)return 6406;if(l===yn)return 6407;if(l===Tn)return 6408;if(l===mr)return 6409;if(l===gr)return 6410;if(l===dn)return 6402;if(l===rr)return 34041;if(l===ui)return 6403;if(l===Zn)return 36244;if(l===Gr)return 33319;if(l===ii)return 33320;if(l===Er)return 36248;if(l===$r)return 36249;if(l===rs||l===gu||l===Ki||l===Qr){if(d=t.get("WEBGL_compressed_texture_s3tc"),d===null)return null;if(l===rs)return d.COMPRESSED_RGB_S3TC_DXT1_EXT;if(l===gu)return d.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(l===Ki)return d.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(l===Qr)return d.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(l===mc||l===gc||l===vu||l===ih){if(d=t.get("WEBGL_compressed_texture_pvrtc"),d===null)return null;if(l===mc)return d.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(l===gc)return d.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(l===vu)return d.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(l===ih)return d.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(l===_u)return d=t.get("WEBGL_compressed_texture_etc1"),d!==null?d.COMPRESSED_RGB_ETC1_WEBGL:null;if((l===oh||l===No)&&(d=t.get("WEBGL_compressed_texture_etc"),d!==null)){if(l===oh)return d.COMPRESSED_RGB8_ETC2;if(l===No)return d.COMPRESSED_RGBA8_ETC2_EAC}return l===Td||l===ho||l===_i||l===yu||l===Ia||l===sh||l===dr||l===ti||l===La||l===Cl||l===vc||l===oi||l===Pl||l===yi||l===is||l===ul||l===Oa||l===ah||l===lh||l===Rl||l===ei||l===uh||l===Il||l===_c||l===So||l===hi||l===Ll||l===Ed?(d=t.get("WEBGL_compressed_texture_astc"),d!==null?l:null):l===ks?(d=t.get("EXT_texture_compression_bptc"),d!==null?l:null):l===un?a?34042:(d=t.get("WEBGL_depth_texture"),d!==null?d.UNSIGNED_INT_24_8_WEBGL:null):void 0}}}class zr extends Yi{constructor(t=[]){super(),this.cameras=t}}zr.prototype.isArrayCamera=!0;class bl extends ar{constructor(){super(),this.type="Group"}}bl.prototype.isGroup=!0;const Zp={type:"move"};class eu{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new bl,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new bl,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new gt,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new gt),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new bl,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new gt,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new gt),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,i,a){let l=null,d=null,p=null;const v=this._targetRay,_=this._grip,x=this._hand;if(t&&i.session.visibilityState!=="visible-blurred")if(v!==null&&(l=i.getPose(t.targetRaySpace,a),l!==null&&(v.matrix.fromArray(l.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),l.linearVelocity?(v.hasLinearVelocity=!0,v.linearVelocity.copy(l.linearVelocity)):v.hasLinearVelocity=!1,l.angularVelocity?(v.hasAngularVelocity=!0,v.angularVelocity.copy(l.angularVelocity)):v.hasAngularVelocity=!1,this.dispatchEvent(Zp))),x&&t.hand){p=!0;for(const U of t.hand.values()){const D=i.getJointPose(U,a);if(x.joints[U.jointName]===void 0){const ot=new bl;ot.matrixAutoUpdate=!1,ot.visible=!1,x.joints[U.jointName]=ot,x.add(ot)}const Z=x.joints[U.jointName];D!==null&&(Z.matrix.fromArray(D.transform.matrix),Z.matrix.decompose(Z.position,Z.rotation,Z.scale),Z.jointRadius=D.radius),Z.visible=D!==null}const M=x.joints["index-finger-tip"],C=x.joints["thumb-tip"],A=M.position.distanceTo(C.position),R=.02,O=.005;x.inputState.pinching&&A>R+O?(x.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!x.inputState.pinching&&A<=R-O&&(x.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else _!==null&&t.gripSpace&&(d=i.getPose(t.gripSpace,a),d!==null&&(_.matrix.fromArray(d.transform.matrix),_.matrix.decompose(_.position,_.rotation,_.scale),d.linearVelocity?(_.hasLinearVelocity=!0,_.linearVelocity.copy(d.linearVelocity)):_.hasLinearVelocity=!1,d.angularVelocity?(_.hasAngularVelocity=!0,_.angularVelocity.copy(d.angularVelocity)):_.hasAngularVelocity=!1));return v!==null&&(v.visible=l!==null),_!==null&&(_.visible=d!==null),x!==null&&(x.visible=p!==null),this}}class Hf extends Ua{constructor(t,i){super();const a=this,l=t.state;let d=null,p=1,v=null,_="local-floor",x=null,M=null,C=null,A=null;const R=[],O=new Map,U=new Yi;U.layers.enable(1),U.viewport=new Ir;const D=new Yi;D.layers.enable(2),D.viewport=new Ir;const Z=[U,D],ot=new zr;ot.layers.enable(1),ot.layers.enable(2);let vt=null,mt=null;function At(Ht){const ce=O.get(Ht.inputSource);ce&&ce.dispatchEvent({type:Ht.type,data:Ht.inputSource})}function Pt(){O.forEach(function(Ht,ce){Ht.disconnect(ce)}),O.clear(),vt=null,mt=null,l.bindXRFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),ge.stop(),a.isPresenting=!1,a.dispatchEvent({type:"sessionend"})}function Et(Ht){const ce=d.inputSources;for(let We=0;We<R.length;We++)O.set(ce[We],R[We]);for(let We=0;We<Ht.removed.length;We++){const je=Ht.removed[We],ze=O.get(je);ze&&(ze.dispatchEvent({type:"disconnected",data:je}),O.delete(je))}for(let We=0;We<Ht.added.length;We++){const je=Ht.added[We],ze=O.get(je);ze&&ze.dispatchEvent({type:"connected",data:je})}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Ht){let ce=R[Ht];return ce===void 0&&(ce=new eu,R[Ht]=ce),ce.getTargetRaySpace()},this.getControllerGrip=function(Ht){let ce=R[Ht];return ce===void 0&&(ce=new eu,R[Ht]=ce),ce.getGripSpace()},this.getHand=function(Ht){let ce=R[Ht];return ce===void 0&&(ce=new eu,R[Ht]=ce),ce.getHandSpace()},this.setFramebufferScaleFactor=function(Ht){p=Ht,a.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Ht){_=Ht,a.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return v},this.getSession=function(){return d},this.setSession=async function(Ht){if(d=Ht,d!==null){d.addEventListener("select",At),d.addEventListener("selectstart",At),d.addEventListener("selectend",At),d.addEventListener("squeeze",At),d.addEventListener("squeezestart",At),d.addEventListener("squeezeend",At),d.addEventListener("end",Pt),d.addEventListener("inputsourceschange",Et);const ce=i.getContextAttributes();if(ce.xrCompatible!==!0&&await i.makeXRCompatible(),d.renderState.layers===void 0){const We={antialias:ce.antialias,alpha:ce.alpha,depth:ce.depth,stencil:ce.stencil,framebufferScaleFactor:p},je=new XRWebGLLayer(d,i,We);d.updateRenderState({baseLayer:je})}else{let We=0;ce.depth&&(We=ce.stencil?34041:6402);const je={colorFormat:ce.alpha?6408:6407,depthFormat:We,scaleFactor:p};M=new XRWebGLBinding(d,i),A=M.createProjectionLayer(je),C=i.createFramebuffer(),d.updateRenderState({layers:[A]})}v=await d.requestReferenceSpace(_),ge.setContext(d),ge.start(),a.isPresenting=!0,a.dispatchEvent({type:"sessionstart"})}};const Ot=new gt,Ie=new gt;function ye(Ht,ce){ce===null?Ht.matrixWorld.copy(Ht.matrix):Ht.matrixWorld.multiplyMatrices(ce.matrixWorld,Ht.matrix),Ht.matrixWorldInverse.copy(Ht.matrixWorld).invert()}this.updateCamera=function(Ht){if(d===null)return;ot.near=D.near=U.near=Ht.near,ot.far=D.far=U.far=Ht.far,vt===ot.near&&mt===ot.far||(d.updateRenderState({depthNear:ot.near,depthFar:ot.far}),vt=ot.near,mt=ot.far);const ce=Ht.parent,We=ot.cameras;ye(ot,ce);for(let ze=0;ze<We.length;ze++)ye(We[ze],ce);ot.matrixWorld.decompose(ot.position,ot.quaternion,ot.scale),Ht.position.copy(ot.position),Ht.quaternion.copy(ot.quaternion),Ht.scale.copy(ot.scale),Ht.matrix.copy(ot.matrix),Ht.matrixWorld.copy(ot.matrixWorld);const je=Ht.children;for(let ze=0,fn=je.length;ze<fn;ze++)je[ze].updateMatrixWorld(!0);We.length===2?function(ze,fn,_n){Ot.setFromMatrixPosition(fn.matrixWorld),Ie.setFromMatrixPosition(_n.matrixWorld);const Mn=Ot.distanceTo(Ie),Sn=fn.projectionMatrix.elements,Rt=_n.projectionMatrix.elements,Dt=Sn[14]/(Sn[10]-1),Fe=Sn[14]/(Sn[10]+1),Be=(Sn[9]+1)/Sn[5],pe=(Sn[9]-1)/Sn[5],rn=(Sn[8]-1)/Sn[0],sn=(Rt[8]+1)/Rt[0],be=Dt*rn,xt=Dt*sn,Zt=Mn/(-rn+sn),Te=Zt*-rn;fn.matrixWorld.decompose(ze.position,ze.quaternion,ze.scale),ze.translateX(Te),ze.translateZ(Zt),ze.matrixWorld.compose(ze.position,ze.quaternion,ze.scale),ze.matrixWorldInverse.copy(ze.matrixWorld).invert();const Pe=Dt+Zt,we=Fe+Zt,bn=be-Te,Gn=xt+(Mn-Te),Fn=Be*Fe/we*Pe,_r=pe*Fe/we*Pe;ze.projectionMatrix.makePerspective(bn,Gn,Fn,_r,Pe,we)}(ot,U,D):ot.projectionMatrix.copy(U.projectionMatrix)},this.getCamera=function(){return ot};let xe=null;const ge=new Ph;ge.setAnimationLoop(function(Ht,ce){if(x=ce.getViewerPose(v),x!==null){const je=x.views,ze=d.renderState.baseLayer;d.renderState.layers===void 0&&l.bindXRFramebuffer(ze.framebuffer);let fn=!1;je.length!==ot.cameras.length&&(ot.cameras.length=0,fn=!0);for(let _n=0;_n<je.length;_n++){const Mn=je[_n];let Sn=null;if(d.renderState.layers===void 0)Sn=ze.getViewport(Mn);else{const Dt=M.getViewSubImage(A,Mn);l.bindXRFramebuffer(C),i.framebufferTexture2D(36160,36064,3553,Dt.colorTexture,0),Dt.depthStencilTexture!==void 0&&i.framebufferTexture2D(36160,36096,3553,Dt.depthStencilTexture,0),Sn=Dt.viewport}const Rt=Z[_n];Rt.matrix.fromArray(Mn.transform.matrix),Rt.projectionMatrix.fromArray(Mn.projectionMatrix),Rt.viewport.set(Sn.x,Sn.y,Sn.width,Sn.height),_n===0&&ot.matrix.copy(Rt.matrix),fn===!0&&ot.cameras.push(Rt)}}const We=d.inputSources;for(let je=0;je<R.length;je++){const ze=R[je],fn=We[je];ze.update(fn,ce,v)}xe&&xe(Ht,ce)}),this.setAnimationLoop=function(Ht){xe=Ht},this.dispose=function(){}}}function Jp(m){function t(a,l){a.opacity.value=l.opacity,l.color&&a.diffuse.value.copy(l.color),l.emissive&&a.emissive.value.copy(l.emissive).multiplyScalar(l.emissiveIntensity),l.map&&(a.map.value=l.map),l.alphaMap&&(a.alphaMap.value=l.alphaMap),l.specularMap&&(a.specularMap.value=l.specularMap);const d=m.get(l).envMap;if(d){a.envMap.value=d,a.flipEnvMap.value=d.isCubeTexture&&d._needsFlipEnvMap?-1:1,a.reflectivity.value=l.reflectivity,a.refractionRatio.value=l.refractionRatio;const _=m.get(d).__maxMipLevel;_!==void 0&&(a.maxMipLevel.value=_)}let p,v;l.lightMap&&(a.lightMap.value=l.lightMap,a.lightMapIntensity.value=l.lightMapIntensity),l.aoMap&&(a.aoMap.value=l.aoMap,a.aoMapIntensity.value=l.aoMapIntensity),l.map?p=l.map:l.specularMap?p=l.specularMap:l.displacementMap?p=l.displacementMap:l.normalMap?p=l.normalMap:l.bumpMap?p=l.bumpMap:l.roughnessMap?p=l.roughnessMap:l.metalnessMap?p=l.metalnessMap:l.alphaMap?p=l.alphaMap:l.emissiveMap?p=l.emissiveMap:l.clearcoatMap?p=l.clearcoatMap:l.clearcoatNormalMap?p=l.clearcoatNormalMap:l.clearcoatRoughnessMap&&(p=l.clearcoatRoughnessMap),p!==void 0&&(p.isWebGLRenderTarget&&(p=p.texture),p.matrixAutoUpdate===!0&&p.updateMatrix(),a.uvTransform.value.copy(p.matrix)),l.aoMap?v=l.aoMap:l.lightMap&&(v=l.lightMap),v!==void 0&&(v.isWebGLRenderTarget&&(v=v.texture),v.matrixAutoUpdate===!0&&v.updateMatrix(),a.uv2Transform.value.copy(v.matrix))}function i(a,l){a.roughness.value=l.roughness,a.metalness.value=l.metalness,l.roughnessMap&&(a.roughnessMap.value=l.roughnessMap),l.metalnessMap&&(a.metalnessMap.value=l.metalnessMap),l.emissiveMap&&(a.emissiveMap.value=l.emissiveMap),l.bumpMap&&(a.bumpMap.value=l.bumpMap,a.bumpScale.value=l.bumpScale,l.side===L&&(a.bumpScale.value*=-1)),l.normalMap&&(a.normalMap.value=l.normalMap,a.normalScale.value.copy(l.normalScale),l.side===L&&a.normalScale.value.negate()),l.displacementMap&&(a.displacementMap.value=l.displacementMap,a.displacementScale.value=l.displacementScale,a.displacementBias.value=l.displacementBias),m.get(l).envMap&&(a.envMapIntensity.value=l.envMapIntensity)}return{refreshFogUniforms:function(a,l){a.fogColor.value.copy(l.color),l.isFog?(a.fogNear.value=l.near,a.fogFar.value=l.far):l.isFogExp2&&(a.fogDensity.value=l.density)},refreshMaterialUniforms:function(a,l,d,p,v){l.isMeshBasicMaterial?t(a,l):l.isMeshLambertMaterial?(t(a,l),function(_,x){x.emissiveMap&&(_.emissiveMap.value=x.emissiveMap)}(a,l)):l.isMeshToonMaterial?(t(a,l),function(_,x){x.gradientMap&&(_.gradientMap.value=x.gradientMap),x.emissiveMap&&(_.emissiveMap.value=x.emissiveMap),x.bumpMap&&(_.bumpMap.value=x.bumpMap,_.bumpScale.value=x.bumpScale,x.side===L&&(_.bumpScale.value*=-1)),x.normalMap&&(_.normalMap.value=x.normalMap,_.normalScale.value.copy(x.normalScale),x.side===L&&_.normalScale.value.negate()),x.displacementMap&&(_.displacementMap.value=x.displacementMap,_.displacementScale.value=x.displacementScale,_.displacementBias.value=x.displacementBias)}(a,l)):l.isMeshPhongMaterial?(t(a,l),function(_,x){_.specular.value.copy(x.specular),_.shininess.value=Math.max(x.shininess,1e-4),x.emissiveMap&&(_.emissiveMap.value=x.emissiveMap),x.bumpMap&&(_.bumpMap.value=x.bumpMap,_.bumpScale.value=x.bumpScale,x.side===L&&(_.bumpScale.value*=-1)),x.normalMap&&(_.normalMap.value=x.normalMap,_.normalScale.value.copy(x.normalScale),x.side===L&&_.normalScale.value.negate()),x.displacementMap&&(_.displacementMap.value=x.displacementMap,_.displacementScale.value=x.displacementScale,_.displacementBias.value=x.displacementBias)}(a,l)):l.isMeshStandardMaterial?(t(a,l),l.isMeshPhysicalMaterial?function(_,x,M){i(_,x),_.reflectivity.value=x.reflectivity,_.clearcoat.value=x.clearcoat,_.clearcoatRoughness.value=x.clearcoatRoughness,x.sheen&&_.sheen.value.copy(x.sheen),x.clearcoatMap&&(_.clearcoatMap.value=x.clearcoatMap),x.clearcoatRoughnessMap&&(_.clearcoatRoughnessMap.value=x.clearcoatRoughnessMap),x.clearcoatNormalMap&&(_.clearcoatNormalScale.value.copy(x.clearcoatNormalScale),_.clearcoatNormalMap.value=x.clearcoatNormalMap,x.side===L&&_.clearcoatNormalScale.value.negate()),_.transmission.value=x.transmission,x.transmissionMap&&(_.transmissionMap.value=x.transmissionMap),x.transmission>0&&(_.transmissionSamplerMap.value=M.texture,_.transmissionSamplerSize.value.set(M.width,M.height)),_.thickness.value=x.thickness,x.thicknessMap&&(_.thicknessMap.value=x.thicknessMap),_.attenuationDistance.value=x.attenuationDistance,_.attenuationColor.value.copy(x.attenuationColor)}(a,l,v):i(a,l)):l.isMeshMatcapMaterial?(t(a,l),function(_,x){x.matcap&&(_.matcap.value=x.matcap),x.bumpMap&&(_.bumpMap.value=x.bumpMap,_.bumpScale.value=x.bumpScale,x.side===L&&(_.bumpScale.value*=-1)),x.normalMap&&(_.normalMap.value=x.normalMap,_.normalScale.value.copy(x.normalScale),x.side===L&&_.normalScale.value.negate()),x.displacementMap&&(_.displacementMap.value=x.displacementMap,_.displacementScale.value=x.displacementScale,_.displacementBias.value=x.displacementBias)}(a,l)):l.isMeshDepthMaterial?(t(a,l),function(_,x){x.displacementMap&&(_.displacementMap.value=x.displacementMap,_.displacementScale.value=x.displacementScale,_.displacementBias.value=x.displacementBias)}(a,l)):l.isMeshDistanceMaterial?(t(a,l),function(_,x){x.displacementMap&&(_.displacementMap.value=x.displacementMap,_.displacementScale.value=x.displacementScale,_.displacementBias.value=x.displacementBias),_.referencePosition.value.copy(x.referencePosition),_.nearDistance.value=x.nearDistance,_.farDistance.value=x.farDistance}(a,l)):l.isMeshNormalMaterial?(t(a,l),function(_,x){x.bumpMap&&(_.bumpMap.value=x.bumpMap,_.bumpScale.value=x.bumpScale,x.side===L&&(_.bumpScale.value*=-1)),x.normalMap&&(_.normalMap.value=x.normalMap,_.normalScale.value.copy(x.normalScale),x.side===L&&_.normalScale.value.negate()),x.displacementMap&&(_.displacementMap.value=x.displacementMap,_.displacementScale.value=x.displacementScale,_.displacementBias.value=x.displacementBias)}(a,l)):l.isLineBasicMaterial?(function(_,x){_.diffuse.value.copy(x.color),_.opacity.value=x.opacity}(a,l),l.isLineDashedMaterial&&function(_,x){_.dashSize.value=x.dashSize,_.totalSize.value=x.dashSize+x.gapSize,_.scale.value=x.scale}(a,l)):l.isPointsMaterial?function(_,x,M,C){_.diffuse.value.copy(x.color),_.opacity.value=x.opacity,_.size.value=x.size*M,_.scale.value=.5*C,x.map&&(_.map.value=x.map),x.alphaMap&&(_.alphaMap.value=x.alphaMap);let A;x.map?A=x.map:x.alphaMap&&(A=x.alphaMap),A!==void 0&&(A.matrixAutoUpdate===!0&&A.updateMatrix(),_.uvTransform.value.copy(A.matrix))}(a,l,d,p):l.isSpriteMaterial?function(_,x){_.diffuse.value.copy(x.color),_.opacity.value=x.opacity,_.rotation.value=x.rotation,x.map&&(_.map.value=x.map),x.alphaMap&&(_.alphaMap.value=x.alphaMap);let M;x.map?M=x.map:x.alphaMap&&(M=x.alphaMap),M!==void 0&&(M.matrixAutoUpdate===!0&&M.updateMatrix(),_.uvTransform.value.copy(M.matrix))}(a,l):l.isShadowMaterial?(a.color.value.copy(l.color),a.opacity.value=l.opacity):l.isShaderMaterial&&(l.uniformsNeedUpdate=!1)}}}function Fr(m={}){const t=m.canvas!==void 0?m.canvas:function(){const It=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return It.style.display="block",It}(),i=m.context!==void 0?m.context:null,a=m.alpha!==void 0&&m.alpha,l=m.depth===void 0||m.depth,d=m.stencil===void 0||m.stencil,p=m.antialias!==void 0&&m.antialias,v=m.premultipliedAlpha===void 0||m.premultipliedAlpha,_=m.preserveDrawingBuffer!==void 0&&m.preserveDrawingBuffer,x=m.powerPreference!==void 0?m.powerPreference:"default",M=m.failIfMajorPerformanceCaveat!==void 0&&m.failIfMajorPerformanceCaveat;let C=null,A=null;const R=[],O=[];this.domElement=t,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.gammaFactor=2,this.outputEncoding=Wr,this.physicallyCorrectLights=!1,this.toneMapping=Or,this.toneMappingExposure=1;const U=this;let D=!1,Z=0,ot=0,vt=null,mt=-1,At=null;const Pt=new Ir,Et=new Ir;let Ot=null,Ie=t.width,ye=t.height,xe=1,ge=null,Ht=null;const ce=new Ir(0,0,Ie,ye),We=new Ir(0,0,Ie,ye);let je=!1;const ze=[],fn=new Xa;let _n=!1,Mn=!1,Sn=null;const Rt=new En,Dt=new gt,Fe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Be(){return vt===null?xe:1}let pe,rn,sn,be,xt,Zt,Te,Pe,we,bn,Gn,Fn,_r,Tr,qo,fi,du,_m,ym,xm,Qs,Ca,qe=i;function Av(It,Me){for(let se=0;se<It.length;se++){const Ce=It[se],en=t.getContext(Ce,Me);if(en!==null)return en}return null}try{const It={alpha:a,depth:l,stencil:d,antialias:p,premultipliedAlpha:v,preserveDrawingBuffer:_,powerPreference:x,failIfMajorPerformanceCaveat:M};if(t.addEventListener("webglcontextlost",Pv,!1),t.addEventListener("webglcontextrestored",Rv,!1),qe===null){const Me=["webgl2","webgl","experimental-webgl"];if(U.isWebGL1Renderer===!0&&Me.shift(),qe=Av(Me,It),qe===null)throw Av(Me)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}qe.getShaderPrecisionFormat===void 0&&(qe.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(It){throw console.error("THREE.WebGLRenderer: "+It.message),It}function Cv(){pe=new Rp(qe),rn=new Gi(qe,pe,m),pe.init(rn),Qs=new Wc(qe,pe,rn),sn=new Qd(qe,pe,rn),ze[0]=1029,be=new Lp(qe),xt=new ci,Zt=new Cs(qe,pe,sn,xt,rn,Qs,be),Te=new yl(U),Pe=new qa(qe,rn),Ca=new Pf(qe,pe,Pe,rn),we=new Ih(qe,Pe,be,Ca),bn=new Dc(qe,we,Pe,be),_m=new Oc(qe),qo=new Ic(xt),Gn=new si(U,Te,pe,rn,Ca,qo),Fn=new Jp(xt),_r=new Vc(xt),Tr=new Kd(pe,rn),du=new Rh(U,Te,sn,bn,v),fi=new or(U,bn,rn),ym=new ga(qe,pe,be,rn),xm=new Ip(qe,pe,be,rn),be.programs=Gn.programs,U.capabilities=rn,U.extensions=pe,U.properties=xt,U.renderLists=_r,U.shadowMap=fi,U.state=sn,U.info=be}Cv();const ol=new Hf(U,qe);function Pv(It){It.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),D=!0}function Rv(){console.log("THREE.WebGLRenderer: Context Restored."),D=!1;const It=be.autoReset,Me=fi.enabled,se=fi.autoUpdate,Ce=fi.needsUpdate,en=fi.type;Cv(),be.autoReset=It,fi.enabled=Me,fi.autoUpdate=se,fi.needsUpdate=Ce,fi.type=en}function Iv(It){const Me=It.target;Me.removeEventListener("dispose",Iv),function(se){(function(Ce){const en=xt.get(Ce).programs;en!==void 0&&en.forEach(function(Xr){Gn.releaseProgram(Xr)})})(se),xt.remove(se)}(Me)}this.xr=ol,this.getContext=function(){return qe},this.getContextAttributes=function(){return qe.getContextAttributes()},this.forceContextLoss=function(){const It=pe.get("WEBGL_lose_context");It&&It.loseContext()},this.forceContextRestore=function(){const It=pe.get("WEBGL_lose_context");It&&It.restoreContext()},this.getPixelRatio=function(){return xe},this.setPixelRatio=function(It){It!==void 0&&(xe=It,this.setSize(Ie,ye,!1))},this.getSize=function(It){return It.set(Ie,ye)},this.setSize=function(It,Me,se){ol.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(Ie=It,ye=Me,t.width=Math.floor(It*xe),t.height=Math.floor(Me*xe),se!==!1&&(t.style.width=It+"px",t.style.height=Me+"px"),this.setViewport(0,0,It,Me))},this.getDrawingBufferSize=function(It){return It.set(Ie*xe,ye*xe).floor()},this.setDrawingBufferSize=function(It,Me,se){Ie=It,ye=Me,xe=se,t.width=Math.floor(It*se),t.height=Math.floor(Me*se),this.setViewport(0,0,It,Me)},this.getCurrentViewport=function(It){return It.copy(Pt)},this.getViewport=function(It){return It.copy(ce)},this.setViewport=function(It,Me,se,Ce){It.isVector4?ce.set(It.x,It.y,It.z,It.w):ce.set(It,Me,se,Ce),sn.viewport(Pt.copy(ce).multiplyScalar(xe).floor())},this.getScissor=function(It){return It.copy(We)},this.setScissor=function(It,Me,se,Ce){It.isVector4?We.set(It.x,It.y,It.z,It.w):We.set(It,Me,se,Ce),sn.scissor(Et.copy(We).multiplyScalar(xe).floor())},this.getScissorTest=function(){return je},this.setScissorTest=function(It){sn.setScissorTest(je=It)},this.setOpaqueSort=function(It){ge=It},this.setTransparentSort=function(It){Ht=It},this.getClearColor=function(It){return It.copy(du.getClearColor())},this.setClearColor=function(){du.setClearColor.apply(du,arguments)},this.getClearAlpha=function(){return du.getClearAlpha()},this.setClearAlpha=function(){du.setClearAlpha.apply(du,arguments)},this.clear=function(It,Me,se){let Ce=0;(It===void 0||It)&&(Ce|=16384),(Me===void 0||Me)&&(Ce|=256),(se===void 0||se)&&(Ce|=1024),qe.clear(Ce)},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(){t.removeEventListener("webglcontextlost",Pv,!1),t.removeEventListener("webglcontextrestored",Rv,!1),_r.dispose(),Tr.dispose(),xt.dispose(),Te.dispose(),bn.dispose(),Ca.dispose(),ol.dispose(),ol.removeEventListener("sessionstart",Lv),ol.removeEventListener("sessionend",Ov),Sn&&(Sn.dispose(),Sn=null),vp.stop()},this.renderBufferImmediate=function(It,Me){Ca.initAttributes();const se=xt.get(It);It.hasPositions&&!se.position&&(se.position=qe.createBuffer()),It.hasNormals&&!se.normal&&(se.normal=qe.createBuffer()),It.hasUvs&&!se.uv&&(se.uv=qe.createBuffer()),It.hasColors&&!se.color&&(se.color=qe.createBuffer());const Ce=Me.getAttributes();It.hasPositions&&(qe.bindBuffer(34962,se.position),qe.bufferData(34962,It.positionArray,35048),Ca.enableAttribute(Ce.position),qe.vertexAttribPointer(Ce.position,3,5126,!1,0,0)),It.hasNormals&&(qe.bindBuffer(34962,se.normal),qe.bufferData(34962,It.normalArray,35048),Ca.enableAttribute(Ce.normal),qe.vertexAttribPointer(Ce.normal,3,5126,!1,0,0)),It.hasUvs&&(qe.bindBuffer(34962,se.uv),qe.bufferData(34962,It.uvArray,35048),Ca.enableAttribute(Ce.uv),qe.vertexAttribPointer(Ce.uv,2,5126,!1,0,0)),It.hasColors&&(qe.bindBuffer(34962,se.color),qe.bufferData(34962,It.colorArray,35048),Ca.enableAttribute(Ce.color),qe.vertexAttribPointer(Ce.color,3,5126,!1,0,0)),Ca.disableUnusedAttributes(),qe.drawArrays(4,0,It.count),It.count=0},this.renderBufferDirect=function(It,Me,se,Ce,en,Xr){Me===null&&(Me=Fe);const cr=en.isMesh&&en.matrixWorld.determinant()<0,cn=Fv(It,Me,Ce,en);sn.setMaterial(Ce,cr);let Cr=se.index;const Vn=se.attributes.position;if(Cr===null){if(Vn===void 0||Vn.count===0)return}else if(Cr.count===0)return;let Vr,sr=1;Ce.wireframe===!0&&(Cr=we.getWireframeAttribute(se),sr=2),(Ce.morphTargets||Ce.morphNormals)&&_m.update(en,se,Ce,cn),Ca.setup(en,Ce,cn,se,Cr);let kr=ym;Cr!==null&&(Vr=Pe.get(Cr),kr=xm,kr.setIndex(Vr));const Oo=Cr!==null?Cr.count:Vn.count,Ci=se.drawRange.start*sr,pu=se.drawRange.count*sr,mi=Xr!==null?Xr.start*sr:0,eh=Xr!==null?Xr.count*sr:1/0,Yo=Math.max(Ci,mi),sl=Math.min(Oo,Ci+pu,mi+eh)-1,Fs=Math.max(0,sl-Yo+1);if(Fs!==0){if(en.isMesh)Ce.wireframe===!0?(sn.setLineWidth(Ce.wireframeLinewidth*Be()),kr.setMode(1)):kr.setMode(4);else if(en.isLine){let bm=Ce.linewidth;bm===void 0&&(bm=1),sn.setLineWidth(bm*Be()),en.isLineSegments?kr.setMode(1):en.isLineLoop?kr.setMode(2):kr.setMode(3)}else en.isPoints?kr.setMode(0):en.isSprite&&kr.setMode(4);if(en.isInstancedMesh)kr.renderInstances(Yo,Fs,en.count);else if(se.isInstancedBufferGeometry){const bm=Math.min(se.instanceCount,se._maxInstanceCount);kr.renderInstances(Yo,Fs,bm)}else kr.render(Yo,Fs)}},this.compile=function(It,Me){A=Tr.get(It),A.init(),It.traverseVisible(function(se){se.isLight&&se.layers.test(Me.layers)&&(A.pushLight(se),se.castShadow&&A.pushShadow(se))}),A.setupLights(),It.traverse(function(se){const Ce=se.material;if(Ce)if(Array.isArray(Ce))for(let en=0;en<Ce.length;en++)Fg(Ce[en],It,se);else Fg(Ce,It,se)})};let Ng=null;function Lv(){vp.stop()}function Ov(){vp.start()}const vp=new Ph;function ig(It,Me,se){const Ce=Me.isScene===!0?Me.overrideMaterial:null;for(let en=0,Xr=It.length;en<Xr;en++){const cr=It[en],cn=cr.object,Cr=cr.geometry,Vn=Ce===null?cr.material:Ce,Vr=cr.group;if(se.isArrayCamera){const sr=se.cameras;for(let kr=0,Oo=sr.length;kr<Oo;kr++){const Ci=sr[kr];cn.layers.test(Ci.layers)&&(sn.viewport(Pt.copy(Ci.viewport)),A.setupLightsView(Ci),Dv(cn,Me,Ci,Cr,Vn,Vr))}}else Dv(cn,Me,se,Cr,Vn,Vr)}}function Dv(It,Me,se,Ce,en,Xr){if(It.onBeforeRender(U,Me,se,Ce,en,Xr),It.modelViewMatrix.multiplyMatrices(se.matrixWorldInverse,It.matrixWorld),It.normalMatrix.getNormalMatrix(It.modelViewMatrix),It.isImmediateRenderObject){const cr=Fv(se,Me,en,It);sn.setMaterial(en),Ca.reset(),function(cn,Cr){cn.render(function(Vn){U.renderBufferImmediate(Vn,Cr)})}(It,cr)}else en.transparent===!0&&en.side===k?(en.side=L,en.needsUpdate=!0,U.renderBufferDirect(se,Me,Ce,en,It,Xr),en.side=zt,en.needsUpdate=!0,U.renderBufferDirect(se,Me,Ce,en,It,Xr),en.side=k):U.renderBufferDirect(se,Me,Ce,en,It,Xr);It.onAfterRender(U,Me,se,Ce,en,Xr)}function Fg(It,Me,se){Me.isScene!==!0&&(Me=Fe);const Ce=xt.get(It),en=A.state.lights,Xr=A.state.shadowsArray,cr=en.state.version,cn=Gn.getParameters(It,en.state,Xr,Me,se),Cr=Gn.getProgramCacheKey(cn);let Vn=Ce.programs;Ce.environment=It.isMeshStandardMaterial?Me.environment:null,Ce.fog=Me.fog,Ce.envMap=Te.get(It.envMap||Ce.environment),Vn===void 0&&(It.addEventListener("dispose",Iv),Vn=new Map,Ce.programs=Vn);let Vr=Vn.get(Cr);if(Vr!==void 0){if(Ce.currentProgram===Vr&&Ce.lightsStateVersion===cr)return Nv(It,cn),Vr}else cn.uniforms=Gn.getUniforms(It),It.onBuild(cn,U),It.onBeforeCompile(cn,U),Vr=Gn.acquireProgram(cn,Cr),Vn.set(Cr,Vr),Ce.uniforms=cn.uniforms;const sr=Ce.uniforms;(It.isShaderMaterial||It.isRawShaderMaterial)&&It.clipping!==!0||(sr.clippingPlanes=qo.uniform),Nv(It,cn),Ce.needsLights=function(Ci){return Ci.isMeshLambertMaterial||Ci.isMeshToonMaterial||Ci.isMeshPhongMaterial||Ci.isMeshStandardMaterial||Ci.isShadowMaterial||Ci.isShaderMaterial&&Ci.lights===!0}(It),Ce.lightsStateVersion=cr,Ce.needsLights&&(sr.ambientLightColor.value=en.state.ambient,sr.lightProbe.value=en.state.probe,sr.directionalLights.value=en.state.directional,sr.directionalLightShadows.value=en.state.directionalShadow,sr.spotLights.value=en.state.spot,sr.spotLightShadows.value=en.state.spotShadow,sr.rectAreaLights.value=en.state.rectArea,sr.ltc_1.value=en.state.rectAreaLTC1,sr.ltc_2.value=en.state.rectAreaLTC2,sr.pointLights.value=en.state.point,sr.pointLightShadows.value=en.state.pointShadow,sr.hemisphereLights.value=en.state.hemi,sr.directionalShadowMap.value=en.state.directionalShadowMap,sr.directionalShadowMatrix.value=en.state.directionalShadowMatrix,sr.spotShadowMap.value=en.state.spotShadowMap,sr.spotShadowMatrix.value=en.state.spotShadowMatrix,sr.pointShadowMap.value=en.state.pointShadowMap,sr.pointShadowMatrix.value=en.state.pointShadowMatrix);const kr=Vr.getUniforms(),Oo=va.seqWithValue(kr.seq,sr);return Ce.currentProgram=Vr,Ce.uniformsList=Oo,Vr}function Nv(It,Me){const se=xt.get(It);se.outputEncoding=Me.outputEncoding,se.instancing=Me.instancing,se.skinning=Me.skinning,se.numClippingPlanes=Me.numClippingPlanes,se.numIntersection=Me.numClipIntersection,se.vertexAlphas=Me.vertexAlphas}function Fv(It,Me,se,Ce){Me.isScene!==!0&&(Me=Fe),Zt.resetTextureUnits();const en=Me.fog,Xr=se.isMeshStandardMaterial?Me.environment:null,cr=vt===null?U.outputEncoding:vt.texture.encoding,cn=Te.get(se.envMap||Xr),Cr=se.vertexColors===!0&&Ce.geometry&&Ce.geometry.attributes.color&&Ce.geometry.attributes.color.itemSize===4,Vn=xt.get(se),Vr=A.state.lights;if(_n===!0&&(Mn===!0||It!==At)){const Fs=It===At&&se.id===mt;qo.setState(se,It,Fs)}let sr=!1;se.version===Vn.__version?Vn.needsLights&&Vn.lightsStateVersion!==Vr.state.version||Vn.outputEncoding!==cr||Ce.isInstancedMesh&&Vn.instancing===!1?sr=!0:Ce.isInstancedMesh||Vn.instancing!==!0?Ce.isSkinnedMesh&&Vn.skinning===!1?sr=!0:Ce.isSkinnedMesh||Vn.skinning!==!0?Vn.envMap!==cn||se.fog&&Vn.fog!==en?sr=!0:Vn.numClippingPlanes===void 0||Vn.numClippingPlanes===qo.numPlanes&&Vn.numIntersection===qo.numIntersection?Vn.vertexAlphas!==Cr&&(sr=!0):sr=!0:sr=!0:sr=!0:(sr=!0,Vn.__version=se.version);let kr=Vn.currentProgram;sr===!0&&(kr=Fg(se,Me,Ce));let Oo=!1,Ci=!1,pu=!1;const mi=kr.getUniforms(),eh=Vn.uniforms;if(sn.useProgram(kr.program)&&(Oo=!0,Ci=!0,pu=!0),se.id!==mt&&(mt=se.id,Ci=!0),Oo||At!==It){if(mi.setValue(qe,"projectionMatrix",It.projectionMatrix),rn.logarithmicDepthBuffer&&mi.setValue(qe,"logDepthBufFC",2/(Math.log(It.far+1)/Math.LN2)),At!==It&&(At=It,Ci=!0,pu=!0),se.isShaderMaterial||se.isMeshPhongMaterial||se.isMeshToonMaterial||se.isMeshStandardMaterial||se.envMap){const Fs=mi.map.cameraPosition;Fs!==void 0&&Fs.setValue(qe,Dt.setFromMatrixPosition(It.matrixWorld))}(se.isMeshPhongMaterial||se.isMeshToonMaterial||se.isMeshLambertMaterial||se.isMeshBasicMaterial||se.isMeshStandardMaterial||se.isShaderMaterial)&&mi.setValue(qe,"isOrthographic",It.isOrthographicCamera===!0),(se.isMeshPhongMaterial||se.isMeshToonMaterial||se.isMeshLambertMaterial||se.isMeshBasicMaterial||se.isMeshStandardMaterial||se.isShaderMaterial||se.isShadowMaterial||Ce.isSkinnedMesh)&&mi.setValue(qe,"viewMatrix",It.matrixWorldInverse)}if(Ce.isSkinnedMesh){mi.setOptional(qe,Ce,"bindMatrix"),mi.setOptional(qe,Ce,"bindMatrixInverse");const Fs=Ce.skeleton;Fs&&(rn.floatVertexTextures?(Fs.boneTexture===null&&Fs.computeBoneTexture(),mi.setValue(qe,"boneTexture",Fs.boneTexture,Zt),mi.setValue(qe,"boneTextureSize",Fs.boneTextureSize)):mi.setOptional(qe,Fs,"boneMatrices"))}var Yo,sl;return(Ci||Vn.receiveShadow!==Ce.receiveShadow)&&(Vn.receiveShadow=Ce.receiveShadow,mi.setValue(qe,"receiveShadow",Ce.receiveShadow)),Ci&&(mi.setValue(qe,"toneMappingExposure",U.toneMappingExposure),Vn.needsLights&&(sl=pu,(Yo=eh).ambientLightColor.needsUpdate=sl,Yo.lightProbe.needsUpdate=sl,Yo.directionalLights.needsUpdate=sl,Yo.directionalLightShadows.needsUpdate=sl,Yo.pointLights.needsUpdate=sl,Yo.pointLightShadows.needsUpdate=sl,Yo.spotLights.needsUpdate=sl,Yo.spotLightShadows.needsUpdate=sl,Yo.rectAreaLights.needsUpdate=sl,Yo.hemisphereLights.needsUpdate=sl),en&&se.fog&&Fn.refreshFogUniforms(eh,en),Fn.refreshMaterialUniforms(eh,se,xe,ye,Sn),va.upload(qe,Vn.uniformsList,eh,Zt)),se.isShaderMaterial&&se.uniformsNeedUpdate===!0&&(va.upload(qe,Vn.uniformsList,eh,Zt),se.uniformsNeedUpdate=!1),se.isSpriteMaterial&&mi.setValue(qe,"center",Ce.center),mi.setValue(qe,"modelViewMatrix",Ce.modelViewMatrix),mi.setValue(qe,"normalMatrix",Ce.normalMatrix),mi.setValue(qe,"modelMatrix",Ce.matrixWorld),kr}vp.setAnimationLoop(function(It){Ng&&Ng(It)}),typeof window!="undefined"&&vp.setContext(window),this.setAnimationLoop=function(It){Ng=It,ol.setAnimationLoop(It),It===null?vp.stop():vp.start()},ol.addEventListener("sessionstart",Lv),ol.addEventListener("sessionend",Ov),this.render=function(It,Me){if(Me!==void 0&&Me.isCamera!==!0)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(D===!0)return;It.autoUpdate===!0&&It.updateMatrixWorld(),Me.parent===null&&Me.updateMatrixWorld(),ol.enabled===!0&&ol.isPresenting===!0&&(ol.cameraAutoUpdate===!0&&ol.updateCamera(Me),Me=ol.getCamera()),It.isScene===!0&&It.onBeforeRender(U,It,Me,vt),A=Tr.get(It,O.length),A.init(),O.push(A),Rt.multiplyMatrices(Me.projectionMatrix,Me.matrixWorldInverse),fn.setFromProjectionMatrix(Rt),Mn=this.localClippingEnabled,_n=qo.init(this.clippingPlanes,Mn,Me),C=_r.get(It,R.length),C.init(),R.push(C),function cr(cn,Cr,Vn,Vr){if(cn.visible===!1)return;if(cn.layers.test(Cr.layers)){if(cn.isGroup)Vn=cn.renderOrder;else if(cn.isLOD)cn.autoUpdate===!0&&cn.update(Cr);else if(cn.isLight)A.pushLight(cn),cn.castShadow&&A.pushShadow(cn);else if(cn.isSprite){if(!cn.frustumCulled||fn.intersectsSprite(cn)){Vr&&Dt.setFromMatrixPosition(cn.matrixWorld).applyMatrix4(Rt);const kr=bn.update(cn),Oo=cn.material;Oo.visible&&C.push(cn,kr,Oo,Vn,Dt.z,null)}}else if(cn.isImmediateRenderObject)Vr&&Dt.setFromMatrixPosition(cn.matrixWorld).applyMatrix4(Rt),C.push(cn,null,cn.material,Vn,Dt.z,null);else if((cn.isMesh||cn.isLine||cn.isPoints)&&(cn.isSkinnedMesh&&cn.skeleton.frame!==be.render.frame&&(cn.skeleton.update(),cn.skeleton.frame=be.render.frame),!cn.frustumCulled||fn.intersectsObject(cn))){Vr&&Dt.setFromMatrixPosition(cn.matrixWorld).applyMatrix4(Rt);const kr=bn.update(cn),Oo=cn.material;if(Array.isArray(Oo)){const Ci=kr.groups;for(let pu=0,mi=Ci.length;pu<mi;pu++){const eh=Ci[pu],Yo=Oo[eh.materialIndex];Yo&&Yo.visible&&C.push(cn,kr,Yo,Vn,Dt.z,eh)}}else Oo.visible&&C.push(cn,kr,Oo,Vn,Dt.z,null)}}const sr=cn.children;for(let kr=0,Oo=sr.length;kr<Oo;kr++)cr(sr[kr],Cr,Vn,Vr)}(It,Me,0,U.sortObjects),C.finish(),U.sortObjects===!0&&C.sort(ge,Ht),_n===!0&&qo.beginShadows();const se=A.state.shadowsArray;fi.render(se,It,Me),A.setupLights(),A.setupLightsView(Me),_n===!0&&qo.endShadows(),this.info.autoReset===!0&&this.info.reset(),du.render(C,It);const Ce=C.opaque,en=C.transmissive,Xr=C.transparent;Ce.length>0&&ig(Ce,It,Me),en.length>0&&function(cr,cn,Cr,Vn){if(Sn===null){const kr=p===!0&&rn.isWebGL2===!0;Sn=new(kr?wc:Bo)(1024,1024,{generateMipmaps:!0,type:Qs.convert(Ft)!==null?Ft:uo,minFilter:Yr,magFilter:wt,wrapS:St,wrapT:St})}const Vr=U.getRenderTarget();U.setRenderTarget(Sn),U.clear();const sr=U.toneMapping;U.toneMapping=Or,ig(cr,Cr,Vn),U.toneMapping=sr,Zt.updateMultisampleRenderTarget(Sn),Zt.updateRenderTargetMipmap(Sn),U.setRenderTarget(Vr),ig(cn,Cr,Vn)}(Ce,en,It,Me),Xr.length>0&&ig(Xr,It,Me),vt!==null&&(Zt.updateMultisampleRenderTarget(vt),Zt.updateRenderTargetMipmap(vt)),It.isScene===!0&&It.onAfterRender(U,It,Me),sn.buffers.depth.setTest(!0),sn.buffers.depth.setMask(!0),sn.buffers.color.setMask(!0),sn.setPolygonOffset(!1),Ca.resetDefaultState(),mt=-1,At=null,O.pop(),A=O.length>0?O[O.length-1]:null,R.pop(),C=R.length>0?R[R.length-1]:null},this.getActiveCubeFace=function(){return Z},this.getActiveMipmapLevel=function(){return ot},this.getRenderTarget=function(){return vt},this.setRenderTarget=function(It,Me=0,se=0){vt=It,Z=Me,ot=se,It&&xt.get(It).__webglFramebuffer===void 0&&Zt.setupRenderTarget(It);let Ce=null,en=!1,Xr=!1;if(It){const cr=It.texture;(cr.isDataTexture3D||cr.isDataTexture2DArray)&&(Xr=!0);const cn=xt.get(It).__webglFramebuffer;It.isWebGLCubeRenderTarget?(Ce=cn[Me],en=!0):Ce=It.isWebGLMultisampleRenderTarget?xt.get(It).__webglMultisampledFramebuffer:cn,Pt.copy(It.viewport),Et.copy(It.scissor),Ot=It.scissorTest}else Pt.copy(ce).multiplyScalar(xe).floor(),Et.copy(We).multiplyScalar(xe).floor(),Ot=je;if(sn.bindFramebuffer(36160,Ce)&&rn.drawBuffers){let cr=!1;if(It)if(It.isWebGLMultipleRenderTargets){const cn=It.texture;if(ze.length!==cn.length||ze[0]!==36064){for(let Cr=0,Vn=cn.length;Cr<Vn;Cr++)ze[Cr]=36064+Cr;ze.length=cn.length,cr=!0}}else ze.length===1&&ze[0]===36064||(ze[0]=36064,ze.length=1,cr=!0);else ze.length===1&&ze[0]===1029||(ze[0]=1029,ze.length=1,cr=!0);cr&&(rn.isWebGL2?qe.drawBuffers(ze):pe.get("WEBGL_draw_buffers").drawBuffersWEBGL(ze))}if(sn.viewport(Pt),sn.scissor(Et),sn.setScissorTest(Ot),en){const cr=xt.get(It.texture);qe.framebufferTexture2D(36160,36064,34069+Me,cr.__webglTexture,se)}else if(Xr){const cr=xt.get(It.texture),cn=Me||0;qe.framebufferTextureLayer(36160,36064,cr.__webglTexture,se||0,cn)}},this.readRenderTargetPixels=function(It,Me,se,Ce,en,Xr,cr){if(!It||!It.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let cn=xt.get(It).__webglFramebuffer;if(It.isWebGLCubeRenderTarget&&cr!==void 0&&(cn=cn[cr]),cn){sn.bindFramebuffer(36160,cn);try{const Cr=It.texture,Vn=Cr.format,Vr=Cr.type;if(Vn!==Tn&&Qs.convert(Vn)!==qe.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const sr=Vr===Ft&&(pe.has("EXT_color_buffer_half_float")||rn.isWebGL2&&pe.has("EXT_color_buffer_float"));if(!(Vr===uo||Qs.convert(Vr)===qe.getParameter(35738)||Vr===ee&&(rn.isWebGL2||pe.has("OES_texture_float")||pe.has("WEBGL_color_buffer_float"))||sr))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");qe.checkFramebufferStatus(36160)===36053?Me>=0&&Me<=It.width-Ce&&se>=0&&se<=It.height-en&&qe.readPixels(Me,se,Ce,en,Qs.convert(Vn),Qs.convert(Vr),Xr):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const Cr=vt!==null?xt.get(vt).__webglFramebuffer:null;sn.bindFramebuffer(36160,Cr)}}},this.copyFramebufferToTexture=function(It,Me,se=0){const Ce=Math.pow(2,-se),en=Math.floor(Me.image.width*Ce),Xr=Math.floor(Me.image.height*Ce);let cr=Qs.convert(Me.format);rn.isWebGL2&&(cr===6407&&(cr=32849),cr===6408&&(cr=32856)),Zt.setTexture2D(Me,0),qe.copyTexImage2D(3553,se,cr,It.x,It.y,en,Xr,0),sn.unbindTexture()},this.copyTextureToTexture=function(It,Me,se,Ce=0){const en=Me.image.width,Xr=Me.image.height,cr=Qs.convert(se.format),cn=Qs.convert(se.type);Zt.setTexture2D(se,0),qe.pixelStorei(37440,se.flipY),qe.pixelStorei(37441,se.premultiplyAlpha),qe.pixelStorei(3317,se.unpackAlignment),Me.isDataTexture?qe.texSubImage2D(3553,Ce,It.x,It.y,en,Xr,cr,cn,Me.image.data):Me.isCompressedTexture?qe.compressedTexSubImage2D(3553,Ce,It.x,It.y,Me.mipmaps[0].width,Me.mipmaps[0].height,cr,Me.mipmaps[0].data):qe.texSubImage2D(3553,Ce,It.x,It.y,cr,cn,Me.image),Ce===0&&se.generateMipmaps&&qe.generateMipmap(3553),sn.unbindTexture()},this.copyTextureToTexture3D=function(It,Me,se,Ce,en=0){if(U.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const Xr=It.max.x-It.min.x+1,cr=It.max.y-It.min.y+1,cn=It.max.z-It.min.z+1,Cr=Qs.convert(Ce.format),Vn=Qs.convert(Ce.type);let Vr;if(Ce.isDataTexture3D)Zt.setTexture3D(Ce,0),Vr=32879;else{if(!Ce.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");Zt.setTexture2DArray(Ce,0),Vr=35866}qe.pixelStorei(37440,Ce.flipY),qe.pixelStorei(37441,Ce.premultiplyAlpha),qe.pixelStorei(3317,Ce.unpackAlignment);const sr=qe.getParameter(3314),kr=qe.getParameter(32878),Oo=qe.getParameter(3316),Ci=qe.getParameter(3315),pu=qe.getParameter(32877),mi=se.isCompressedTexture?se.mipmaps[0]:se.image;qe.pixelStorei(3314,mi.width),qe.pixelStorei(32878,mi.height),qe.pixelStorei(3316,It.min.x),qe.pixelStorei(3315,It.min.y),qe.pixelStorei(32877,It.min.z),se.isDataTexture||se.isDataTexture3D?qe.texSubImage3D(Vr,en,Me.x,Me.y,Me.z,Xr,cr,cn,Cr,Vn,mi.data):se.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),qe.compressedTexSubImage3D(Vr,en,Me.x,Me.y,Me.z,Xr,cr,cn,Cr,mi.data)):qe.texSubImage3D(Vr,en,Me.x,Me.y,Me.z,Xr,cr,cn,Cr,Vn,mi),qe.pixelStorei(3314,sr),qe.pixelStorei(32878,kr),qe.pixelStorei(3316,Oo),qe.pixelStorei(3315,Ci),qe.pixelStorei(32877,pu),en===0&&Ce.generateMipmaps&&qe.generateMipmap(Vr),sn.unbindTexture()},this.initTexture=function(It){Zt.setTexture2D(It,0),sn.unbindTexture()},this.resetState=function(){Z=0,ot=0,vt=null,sn.reset(),Ca.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class $p extends Fr{}$p.prototype.isWebGL1Renderer=!0;class nu{constructor(t,i=25e-5){this.name="",this.color=new pn(t),this.density=i}clone(){return new nu(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}nu.prototype.isFogExp2=!0;class ru{constructor(t,i=1,a=1e3){this.name="",this.color=new pn(t),this.near=i,this.far=a}clone(){return new ru(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}ru.prototype.isFog=!0;class Gh extends ar{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,i){return super.copy(t,i),t.background!==null&&(this.background=t.background.clone()),t.environment!==null&&(this.environment=t.environment.clone()),t.fog!==null&&(this.fog=t.fog.clone()),t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const i=super.toJSON(t);return this.fog!==null&&(i.object.fog=this.fog.toJSON()),i}}Gh.prototype.isScene=!0;class wl{constructor(t,i){this.array=t,this.stride=i,this.count=t!==void 0?t.length/i:0,this.usage=Ba,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Fo()}onUploadCallback(){}set needsUpdate(t){t===!0&&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(t,i,a){t*=this.stride,a*=i.stride;for(let l=0,d=this.stride;l<d;l++)this.array[t+l]=i.array[a+l];return this}set(t,i=0){return this.array.set(t,i),this}clone(t){t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Fo()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const i=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),a=new this.constructor(i,this.stride);return a.setUsage(this.usage),a}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Fo()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(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}}}wl.prototype.isInterleavedBuffer=!0;const ai=new gt;class ri{constructor(t,i,a,l=!1){this.name="",this.data=t,this.itemSize=i,this.offset=a,this.normalized=l===!0}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let i=0,a=this.data.count;i<a;i++)ai.x=this.getX(i),ai.y=this.getY(i),ai.z=this.getZ(i),ai.applyMatrix4(t),this.setXYZ(i,ai.x,ai.y,ai.z);return this}applyNormalMatrix(t){for(let i=0,a=this.count;i<a;i++)ai.x=this.getX(i),ai.y=this.getY(i),ai.z=this.getZ(i),ai.applyNormalMatrix(t),this.setXYZ(i,ai.x,ai.y,ai.z);return this}transformDirection(t){for(let i=0,a=this.count;i<a;i++)ai.x=this.getX(i),ai.y=this.getY(i),ai.z=this.getZ(i),ai.transformDirection(t),this.setXYZ(i,ai.x,ai.y,ai.z);return this}setX(t,i){return this.data.array[t*this.data.stride+this.offset]=i,this}setY(t,i){return this.data.array[t*this.data.stride+this.offset+1]=i,this}setZ(t,i){return this.data.array[t*this.data.stride+this.offset+2]=i,this}setW(t,i){return this.data.array[t*this.data.stride+this.offset+3]=i,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,i,a){return t=t*this.data.stride+this.offset,this.data.array[t+0]=i,this.data.array[t+1]=a,this}setXYZ(t,i,a,l){return t=t*this.data.stride+this.offset,this.data.array[t+0]=i,this.data.array[t+1]=a,this.data.array[t+2]=l,this}setXYZW(t,i,a,l,d){return t=t*this.data.stride+this.offset,this.data.array[t+0]=i,this.data.array[t+1]=a,this.data.array[t+2]=l,this.data.array[t+3]=d,this}clone(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const i=[];for(let a=0;a<this.count;a++){const l=a*this.data.stride+this.offset;for(let d=0;d<this.itemSize;d++)i.push(this.data.array[l+d])}return new Kn(new this.array.constructor(i),this.itemSize,this.normalized)}return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new ri(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const i=[];for(let a=0;a<this.count;a++){const l=a*this.data.stride+this.offset;for(let d=0;d<this.itemSize;d++)i.push(this.data.array[l+d])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:i,normalized:this.normalized}}return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}ri.prototype.isInterleavedBufferAttribute=!0;class xo extends Ni{constructor(t){super(),this.type="SpriteMaterial",this.color=new pn(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}}let iu;xo.prototype.isSpriteMaterial=!0;const Nu=new gt,Fu=new gt,Vo=new gt,Ps=new He,gs=new He,Hh=new En,Rs=new gt,Sl=new gt,Bu=new gt,Is=new He,Xc=new He,ku=new He;class Uu extends ar{constructor(t){if(super(),this.type="Sprite",iu===void 0){iu=new zn;const i=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),a=new wl(i,5);iu.setIndex([0,1,2,0,2,3]),iu.setAttribute("position",new ri(a,3,0,!1)),iu.setAttribute("uv",new ri(a,2,3,!1))}this.geometry=iu,this.material=t!==void 0?t:new xo,this.center=new He(.5,.5)}raycast(t,i){t.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Fu.setFromMatrixScale(this.matrixWorld),Hh.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),Vo.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Fu.multiplyScalar(-Vo.z);const a=this.material.rotation;let l,d;a!==0&&(d=Math.cos(a),l=Math.sin(a));const p=this.center;zh(Rs.set(-.5,-.5,0),Vo,p,Fu,l,d),zh(Sl.set(.5,-.5,0),Vo,p,Fu,l,d),zh(Bu.set(.5,.5,0),Vo,p,Fu,l,d),Is.set(0,0),Xc.set(1,0),ku.set(1,1);let v=t.ray.intersectTriangle(Rs,Sl,Bu,!1,Nu);if(v===null&&(zh(Sl.set(-.5,.5,0),Vo,p,Fu,l,d),Xc.set(0,1),v=t.ray.intersectTriangle(Rs,Bu,Sl,!1,Nu),v===null))return;const _=t.ray.origin.distanceTo(Nu);_<t.near||_>t.far||i.push({distance:_,point:Nu.clone(),uv:bi.getUV(Nu,Rs,Sl,Bu,Is,Xc,ku,new He),face:null,object:this})}copy(t){return super.copy(t),t.center!==void 0&&this.center.copy(t.center),this.material=t.material,this}}function zh(m,t,i,a,l,d){Ps.subVectors(m,i).addScalar(.5).multiply(a),l!==void 0?(gs.x=d*Ps.x-l*Ps.y,gs.y=l*Ps.x+d*Ps.y):gs.copy(Ps),m.copy(t),m.x+=gs.x,m.y+=gs.y,m.applyMatrix4(Hh)}Uu.prototype.isSprite=!0;const jh=new gt,tp=new gt;class Vh extends ar{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const i=t.levels;for(let a=0,l=i.length;a<l;a++){const d=i[a];this.addLevel(d.object.clone(),d.distance)}return this.autoUpdate=t.autoUpdate,this}addLevel(t,i=0){i=Math.abs(i);const a=this.levels;let l;for(l=0;l<a.length&&!(i<a[l].distance);l++);return a.splice(l,0,{distance:i,object:t}),this.add(t),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(t){const i=this.levels;if(i.length>0){let a,l;for(a=1,l=i.length;a<l&&!(t<i[a].distance);a++);return i[a-1].object}return null}raycast(t,i){if(this.levels.length>0){jh.setFromMatrixPosition(this.matrixWorld);const a=t.ray.origin.distanceTo(jh);this.getObjectForDistance(a).raycast(t,i)}}update(t){const i=this.levels;if(i.length>1){jh.setFromMatrixPosition(t.matrixWorld),tp.setFromMatrixPosition(this.matrixWorld);const a=jh.distanceTo(tp)/t.zoom;let l,d;for(i[0].object.visible=!0,l=1,d=i.length;l<d&&a>=i[l].distance;l++)i[l-1].object.visible=!1,i[l].object.visible=!0;for(this._currentLevel=l-1;l<d;l++)i[l].object.visible=!1}}toJSON(t){const i=super.toJSON(t);this.autoUpdate===!1&&(i.object.autoUpdate=!1),i.object.levels=[];const a=this.levels;for(let l=0,d=a.length;l<d;l++){const p=a[l];i.object.levels.push({object:p.object.uuid,distance:p.distance})}return i}}const ep=new gt,np=new Ir,Gu=new Ir,rp=new gt,qc=new En;class Yc extends Bi{constructor(t,i){super(t,i),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new En,this.bindMatrixInverse=new En}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,i){this.skeleton=t,i===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),i=this.matrixWorld),this.bindMatrix.copy(i),this.bindMatrixInverse.copy(i).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new Ir,i=this.geometry.attributes.skinWeight;for(let a=0,l=i.count;a<l;a++){t.x=i.getX(a),t.y=i.getY(a),t.z=i.getZ(a),t.w=i.getW(a);const d=1/t.manhattanLength();d!==1/0?t.multiplyScalar(d):t.set(1,0,0,0),i.setXYZW(a,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(t,i){const a=this.skeleton,l=this.geometry;np.fromBufferAttribute(l.attributes.skinIndex,t),Gu.fromBufferAttribute(l.attributes.skinWeight,t),ep.fromBufferAttribute(l.attributes.position,t).applyMatrix4(this.bindMatrix),i.set(0,0,0);for(let d=0;d<4;d++){const p=Gu.getComponent(d);if(p!==0){const v=np.getComponent(d);qc.multiplyMatrices(a.bones[v].matrixWorld,a.boneInverses[v]),i.addScaledVector(rp.copy(ep).applyMatrix4(qc),p)}}return i.applyMatrix4(this.bindMatrixInverse)}}Yc.prototype.isSkinnedMesh=!0;class no extends ar{constructor(){super(),this.type="Bone"}}no.prototype.isBone=!0;class Ls extends ni{constructor(t=null,i=1,a=1,l,d,p,v,_,x=wt,M=wt,C,A){super(null,p,v,_,x,M,l,d,C,A),this.image={data:t,width:i,height:a},this.magFilter=x,this.minFilter=M,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}Ls.prototype.isDataTexture=!0;const Zc=new En,Kp=new En;class Hu{constructor(t=[],i=[]){this.uuid=Fo(),this.bones=t.slice(0),this.boneInverses=i,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){const t=this.bones,i=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),i.length===0)this.calculateInverses();else if(t.length!==i.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let a=0,l=this.bones.length;a<l;a++)this.boneInverses.push(new En)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,i=this.bones.length;t<i;t++){const a=new En;this.bones[t]&&a.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(a)}}pose(){for(let t=0,i=this.bones.length;t<i;t++){const a=this.bones[t];a&&a.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,i=this.bones.length;t<i;t++){const a=this.bones[t];a&&(a.parent&&a.parent.isBone?(a.matrix.copy(a.parent.matrixWorld).invert(),a.matrix.multiply(a.matrixWorld)):a.matrix.copy(a.matrixWorld),a.matrix.decompose(a.position,a.quaternion,a.scale))}}update(){const t=this.bones,i=this.boneInverses,a=this.boneMatrices,l=this.boneTexture;for(let d=0,p=t.length;d<p;d++){const v=t[d]?t[d].matrixWorld:Kp;Zc.multiplyMatrices(v,i[d]),Zc.toArray(a,16*d)}l!==null&&(l.needsUpdate=!0)}clone(){return new Hu(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(4*this.bones.length);t=to(t),t=Math.max(t,4);const i=new Float32Array(t*t*4);i.set(this.boneMatrices);const a=new Ls(i,t,t,Tn,ee);return this.boneMatrices=i,this.boneTexture=a,this.boneTextureSize=t,this}getBoneByName(t){for(let i=0,a=this.bones.length;i<a;i++){const l=this.bones[i];if(l.name===t)return l}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,i){this.uuid=t.uuid;for(let a=0,l=t.bones.length;a<l;a++){const d=t.bones[a];let p=i[d];p===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",d),p=new no),this.bones.push(p),this.boneInverses.push(new En().fromArray(t.boneInverses[a]))}return this.init(),this}toJSON(){const t={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const i=this.bones,a=this.boneInverses;for(let l=0,d=i.length;l<d;l++){const p=i[l];t.bones.push(p.uuid);const v=a[l];t.boneInverses.push(v.toArray())}return t}}const Jc=new En,Qp=new En,$c=[],Wh=new Bi;class Kc extends Bi{constructor(t,i,a){super(t,i),this.instanceMatrix=new Kn(new Float32Array(16*a),16),this.instanceColor=null,this.count=a,this.frustumCulled=!1}copy(t){return super.copy(t),this.instanceMatrix.copy(t.instanceMatrix),t.instanceColor!==null&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,this}getColorAt(t,i){i.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,i){i.fromArray(this.instanceMatrix.array,16*t)}raycast(t,i){const a=this.matrixWorld,l=this.count;if(Wh.geometry=this.geometry,Wh.material=this.material,Wh.material!==void 0)for(let d=0;d<l;d++){this.getMatrixAt(d,Jc),Qp.multiplyMatrices(a,Jc),Wh.matrixWorld=Qp,Wh.raycast(t,$c);for(let p=0,v=$c.length;p<v;p++){const _=$c[p];_.instanceId=d,_.object=this,i.push(_)}$c.length=0}}setColorAt(t,i){this.instanceColor===null&&(this.instanceColor=new Kn(new Float32Array(3*this.count),3)),i.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,i){i.toArray(this.instanceMatrix.array,16*t)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}Kc.prototype.isInstancedMesh=!0;class ro extends Ni{constructor(t){super(),this.type="LineBasicMaterial",this.color=new pn(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,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.morphTargets=t.morphTargets,this}}ro.prototype.isLineBasicMaterial=!0;const tf=new gt,Qc=new gt,td=new En,ip=new Ha,ed=new ws;class $a extends ar{constructor(t=new zn,i=new ro){super(),this.type="Line",this.geometry=t,this.material=i,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(t.index===null){const i=t.attributes.position,a=[0];for(let l=1,d=i.count;l<d;l++)tf.fromBufferAttribute(i,l-1),Qc.fromBufferAttribute(i,l),a[l]=a[l-1],a[l]+=tf.distanceTo(Qc);t.setAttribute("lineDistance",new xn(a,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(t,i){const a=this.geometry,l=this.matrixWorld,d=t.params.Line.threshold,p=a.drawRange;if(a.boundingSphere===null&&a.computeBoundingSphere(),ed.copy(a.boundingSphere),ed.applyMatrix4(l),ed.radius+=d,t.ray.intersectsSphere(ed)===!1)return;td.copy(l).invert(),ip.copy(t.ray).applyMatrix4(td);const v=d/((this.scale.x+this.scale.y+this.scale.z)/3),_=v*v,x=new gt,M=new gt,C=new gt,A=new gt,R=this.isLineSegments?2:1;if(a.isBufferGeometry){const O=a.index,U=a.attributes.position;if(O!==null)for(let D=Math.max(0,p.start),Z=Math.min(O.count,p.start+p.count)-1;D<Z;D+=R){const ot=O.getX(D),vt=O.getX(D+1);if(x.fromBufferAttribute(U,ot),M.fromBufferAttribute(U,vt),ip.distanceSqToSegment(x,M,A,C)>_)continue;A.applyMatrix4(this.matrixWorld);const mt=t.ray.origin.distanceTo(A);mt<t.near||mt>t.far||i.push({distance:mt,point:C.clone().applyMatrix4(this.matrixWorld),index:D,face:null,faceIndex:null,object:this})}else for(let D=Math.max(0,p.start),Z=Math.min(U.count,p.start+p.count)-1;D<Z;D+=R){if(x.fromBufferAttribute(U,D),M.fromBufferAttribute(U,D+1),ip.distanceSqToSegment(x,M,A,C)>_)continue;A.applyMatrix4(this.matrixWorld);const ot=t.ray.origin.distanceTo(A);ot<t.near||ot>t.far||i.push({distance:ot,point:C.clone().applyMatrix4(this.matrixWorld),index:D,face:null,faceIndex:null,object:this})}}else a.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const i=t.morphAttributes,a=Object.keys(i);if(a.length>0){const l=i[a[0]];if(l!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let d=0,p=l.length;d<p;d++){const v=l[d].name||String(d);this.morphTargetInfluences.push(0),this.morphTargetDictionary[v]=d}}}}else{const i=t.morphTargets;i!==void 0&&i.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}$a.prototype.isLine=!0;const ef=new gt,nd=new gt;class io extends $a{constructor(t,i){super(t,i),this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(t.index===null){const i=t.attributes.position,a=[];for(let l=0,d=i.count;l<d;l+=2)ef.fromBufferAttribute(i,l),nd.fromBufferAttribute(i,l+1),a[l]=l===0?0:a[l-1],a[l+1]=a[l]+ef.distanceTo(nd);t.setAttribute("lineDistance",new xn(a,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}io.prototype.isLineSegments=!0;class ou extends $a{constructor(t,i){super(t,i),this.type="LineLoop"}}ou.prototype.isLineLoop=!0;class Tl extends Ni{constructor(t){super(),this.type="PointsMaterial",this.color=new pn(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,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.morphTargets=t.morphTargets,this}}Tl.prototype.isPointsMaterial=!0;const c=new En,g=new Ha,E=new ws,N=new gt;class q extends ar{constructor(t=new zn,i=new Tl){super(),this.type="Points",this.geometry=t,this.material=i,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}raycast(t,i){const a=this.geometry,l=this.matrixWorld,d=t.params.Points.threshold,p=a.drawRange;if(a.boundingSphere===null&&a.computeBoundingSphere(),E.copy(a.boundingSphere),E.applyMatrix4(l),E.radius+=d,t.ray.intersectsSphere(E)===!1)return;c.copy(l).invert(),g.copy(t.ray).applyMatrix4(c);const v=d/((this.scale.x+this.scale.y+this.scale.z)/3),_=v*v;if(a.isBufferGeometry){const x=a.index,M=a.attributes.position;if(x!==null)for(let C=Math.max(0,p.start),A=Math.min(x.count,p.start+p.count);C<A;C++){const R=x.getX(C);N.fromBufferAttribute(M,R),dt(N,R,_,l,t,i,this)}else for(let C=Math.max(0,p.start),A=Math.min(M.count,p.start+p.count);C<A;C++)N.fromBufferAttribute(M,C),dt(N,C,_,l,t,i,this)}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const i=t.morphAttributes,a=Object.keys(i);if(a.length>0){const l=i[a[0]];if(l!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let d=0,p=l.length;d<p;d++){const v=l[d].name||String(d);this.morphTargetInfluences.push(0),this.morphTargetDictionary[v]=d}}}}else{const i=t.morphTargets;i!==void 0&&i.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function dt(m,t,i,a,l,d,p){const v=g.distanceSqToPoint(m);if(v<i){const _=new gt;g.closestPointToPoint(m,_),_.applyMatrix4(a);const x=l.ray.origin.distanceTo(_);if(x<l.near||x>l.far)return;d.push({distance:x,distanceToRay:Math.sqrt(v),point:_,index:t,face:null,object:p})}}q.prototype.isPoints=!0;class Mt extends ni{constructor(t,i,a,l,d,p,v,_,x){super(t,i,a,l,d,p,v,_,x),this.format=v!==void 0?v:yn,this.minFilter=p!==void 0?p:Qe,this.magFilter=d!==void 0?d:Qe,this.generateMipmaps=!1;const M=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback(function C(){M.needsUpdate=!0,t.requestVideoFrameCallback(C)})}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!("requestVideoFrameCallback"in t)&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}Mt.prototype.isVideoTexture=!0;class Lt extends ni{constructor(t,i,a,l,d,p,v,_,x,M,C,A){super(null,p,v,_,x,M,l,d,C,A),this.image={width:i,height:a},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}Lt.prototype.isCompressedTexture=!0;class qt extends ni{constructor(t,i,a,l,d,p,v,_,x){super(t,i,a,l,d,p,v,_,x),this.needsUpdate=!0}}qt.prototype.isCanvasTexture=!0;class Ee extends ni{constructor(t,i,a,l,d,p,v,_,x,M){if((M=M!==void 0?M:dn)!==dn&&M!==rr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");a===void 0&&M===dn&&(a=Ra),a===void 0&&M===rr&&(a=un),super(null,l,d,p,v,_,M,a,x),this.image={width:t,height:i},this.magFilter=v!==void 0?v:wt,this.minFilter=_!==void 0?_:wt,this.flipY=!1,this.generateMipmaps=!1}}Ee.prototype.isDepthTexture=!0;class me extends zn{constructor(t=1,i=8,a=0,l=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:i,thetaStart:a,thetaLength:l},i=Math.max(3,i);const d=[],p=[],v=[],_=[],x=new gt,M=new He;p.push(0,0,0),v.push(0,0,1),_.push(.5,.5);for(let C=0,A=3;C<=i;C++,A+=3){const R=a+C/i*l;x.x=t*Math.cos(R),x.y=t*Math.sin(R),p.push(x.x,x.y,x.z),v.push(0,0,1),M.x=(p[A]/t+1)/2,M.y=(p[A+1]/t+1)/2,_.push(M.x,M.y)}for(let C=1;C<=i;C++)d.push(C,C+1,0);this.setIndex(d),this.setAttribute("position",new xn(p,3)),this.setAttribute("normal",new xn(v,3)),this.setAttribute("uv",new xn(_,2))}static fromJSON(t){return new me(t.radius,t.segments,t.thetaStart,t.thetaLength)}}class De extends zn{constructor(t=1,i=1,a=1,l=8,d=1,p=!1,v=0,_=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:i,height:a,radialSegments:l,heightSegments:d,openEnded:p,thetaStart:v,thetaLength:_};const x=this;l=Math.floor(l),d=Math.floor(d);const M=[],C=[],A=[],R=[];let O=0;const U=[],D=a/2;let Z=0;function ot(vt){const mt=O,At=new He,Pt=new gt;let Et=0;const Ot=vt===!0?t:i,Ie=vt===!0?1:-1;for(let xe=1;xe<=l;xe++)C.push(0,D*Ie,0),A.push(0,Ie,0),R.push(.5,.5),O++;const ye=O;for(let xe=0;xe<=l;xe++){const ge=xe/l*_+v,Ht=Math.cos(ge),ce=Math.sin(ge);Pt.x=Ot*ce,Pt.y=D*Ie,Pt.z=Ot*Ht,C.push(Pt.x,Pt.y,Pt.z),A.push(0,Ie,0),At.x=.5*Ht+.5,At.y=.5*ce*Ie+.5,R.push(At.x,At.y),O++}for(let xe=0;xe<l;xe++){const ge=mt+xe,Ht=ye+xe;vt===!0?M.push(Ht,Ht+1,ge):M.push(Ht+1,Ht,ge),Et+=3}x.addGroup(Z,Et,vt===!0?1:2),Z+=Et}(function(){const vt=new gt,mt=new gt;let At=0;const Pt=(i-t)/a;for(let Et=0;Et<=d;Et++){const Ot=[],Ie=Et/d,ye=Ie*(i-t)+t;for(let xe=0;xe<=l;xe++){const ge=xe/l,Ht=ge*_+v,ce=Math.sin(Ht),We=Math.cos(Ht);mt.x=ye*ce,mt.y=-Ie*a+D,mt.z=ye*We,C.push(mt.x,mt.y,mt.z),vt.set(ce,Pt,We).normalize(),A.push(vt.x,vt.y,vt.z),R.push(ge,1-Ie),Ot.push(O++)}U.push(Ot)}for(let Et=0;Et<l;Et++)for(let Ot=0;Ot<d;Ot++){const Ie=U[Ot][Et],ye=U[Ot+1][Et],xe=U[Ot+1][Et+1],ge=U[Ot][Et+1];M.push(Ie,ye,ge),M.push(ye,xe,ge),At+=6}x.addGroup(Z,At,0),Z+=At})(),p===!1&&(t>0&&ot(!0),i>0&&ot(!1)),this.setIndex(M),this.setAttribute("position",new xn(C,3)),this.setAttribute("normal",new xn(A,3)),this.setAttribute("uv",new xn(R,2))}static fromJSON(t){return new De(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class gn extends De{constructor(t=1,i=1,a=8,l=1,d=!1,p=0,v=2*Math.PI){super(0,t,i,a,l,d,p,v),this.type="ConeGeometry",this.parameters={radius:t,height:i,radialSegments:a,heightSegments:l,openEnded:d,thetaStart:p,thetaLength:v}}static fromJSON(t){return new gn(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class ln extends zn{constructor(t,i,a=1,l=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:i,radius:a,detail:l};const d=[],p=[];function v(A,R,O,U){const D=U+1,Z=[];for(let ot=0;ot<=D;ot++){Z[ot]=[];const vt=A.clone().lerp(O,ot/D),mt=R.clone().lerp(O,ot/D),At=D-ot;for(let Pt=0;Pt<=At;Pt++)Z[ot][Pt]=Pt===0&&ot===D?vt:vt.clone().lerp(mt,Pt/At)}for(let ot=0;ot<D;ot++)for(let vt=0;vt<2*(D-ot)-1;vt++){const mt=Math.floor(vt/2);vt%2==0?(_(Z[ot][mt+1]),_(Z[ot+1][mt]),_(Z[ot][mt])):(_(Z[ot][mt+1]),_(Z[ot+1][mt+1]),_(Z[ot+1][mt]))}}function _(A){d.push(A.x,A.y,A.z)}function x(A,R){const O=3*A;R.x=t[O+0],R.y=t[O+1],R.z=t[O+2]}function M(A,R,O,U){U<0&&A.x===1&&(p[R]=A.x-1),O.x===0&&O.z===0&&(p[R]=U/2/Math.PI+.5)}function C(A){return Math.atan2(A.z,-A.x)}(function(A){const R=new gt,O=new gt,U=new gt;for(let D=0;D<i.length;D+=3)x(i[D+0],R),x(i[D+1],O),x(i[D+2],U),v(R,O,U,A)})(l),function(A){const R=new gt;for(let O=0;O<d.length;O+=3)R.x=d[O+0],R.y=d[O+1],R.z=d[O+2],R.normalize().multiplyScalar(A),d[O+0]=R.x,d[O+1]=R.y,d[O+2]=R.z}(a),function(){const A=new gt;for(let O=0;O<d.length;O+=3){A.x=d[O+0],A.y=d[O+1],A.z=d[O+2];const U=C(A)/2/Math.PI+.5,D=(R=A,Math.atan2(-R.y,Math.sqrt(R.x*R.x+R.z*R.z))/Math.PI+.5);p.push(U,1-D)}var R;(function(){const O=new gt,U=new gt,D=new gt,Z=new gt,ot=new He,vt=new He,mt=new He;for(let At=0,Pt=0;At<d.length;At+=9,Pt+=6){O.set(d[At+0],d[At+1],d[At+2]),U.set(d[At+3],d[At+4],d[At+5]),D.set(d[At+6],d[At+7],d[At+8]),ot.set(p[Pt+0],p[Pt+1]),vt.set(p[Pt+2],p[Pt+3]),mt.set(p[Pt+4],p[Pt+5]),Z.copy(O).add(U).add(D).divideScalar(3);const Et=C(Z);M(ot,Pt+0,O,Et),M(vt,Pt+2,U,Et),M(mt,Pt+4,D,Et)}})(),function(){for(let O=0;O<p.length;O+=6){const U=p[O+0],D=p[O+2],Z=p[O+4],ot=Math.max(U,D,Z),vt=Math.min(U,D,Z);ot>.9&&vt<.1&&(U<.2&&(p[O+0]+=1),D<.2&&(p[O+2]+=1),Z<.2&&(p[O+4]+=1))}}()}(),this.setAttribute("position",new xn(d,3)),this.setAttribute("normal",new xn(d.slice(),3)),this.setAttribute("uv",new xn(p,2)),l===0?this.computeVertexNormals():this.normalizeNormals()}static fromJSON(t){return new ln(t.vertices,t.indices,t.radius,t.details)}}class An extends ln{constructor(t=1,i=0){const a=(1+Math.sqrt(5))/2,l=1/a;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-l,-a,0,-l,a,0,l,-a,0,l,a,-l,-a,0,-l,a,0,l,-a,0,l,a,0,-a,0,-l,a,0,-l,-a,0,l,a,0,l],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,i),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:i}}static fromJSON(t){return new An(t.radius,t.detail)}}const ve=new gt,Xe=new gt,Un=new gt,mn=new bi;class Yn extends zn{constructor(t,i){if(super(),this.type="EdgesGeometry",this.parameters={thresholdAngle:i},i=i!==void 0?i:1,t.isGeometry===!0)return void console.error("THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");const a=Math.pow(10,4),l=Math.cos(ra*i),d=t.getIndex(),p=t.getAttribute("position"),v=d?d.count:p.count,_=[0,0,0],x=["a","b","c"],M=new Array(3),C={},A=[];for(let R=0;R<v;R+=3){d?(_[0]=d.getX(R),_[1]=d.getX(R+1),_[2]=d.getX(R+2)):(_[0]=R,_[1]=R+1,_[2]=R+2);const{a:O,b:U,c:D}=mn;if(O.fromBufferAttribute(p,_[0]),U.fromBufferAttribute(p,_[1]),D.fromBufferAttribute(p,_[2]),mn.getNormal(Un),M[0]=`${Math.round(O.x*a)},${Math.round(O.y*a)},${Math.round(O.z*a)}`,M[1]=`${Math.round(U.x*a)},${Math.round(U.y*a)},${Math.round(U.z*a)}`,M[2]=`${Math.round(D.x*a)},${Math.round(D.y*a)},${Math.round(D.z*a)}`,M[0]!==M[1]&&M[1]!==M[2]&&M[2]!==M[0])for(let Z=0;Z<3;Z++){const ot=(Z+1)%3,vt=M[Z],mt=M[ot],At=mn[x[Z]],Pt=mn[x[ot]],Et=`${vt}_${mt}`,Ot=`${mt}_${vt}`;Ot in C&&C[Ot]?(Un.dot(C[Ot].normal)<=l&&(A.push(At.x,At.y,At.z),A.push(Pt.x,Pt.y,Pt.z)),C[Ot]=null):Et in C||(C[Et]={index0:_[Z],index1:_[ot],normal:Un.clone()})}}for(const R in C)if(C[R]){const{index0:O,index1:U}=C[R];ve.fromBufferAttribute(p,O),Xe.fromBufferAttribute(p,U),A.push(ve.x,ve.y,ve.z),A.push(Xe.x,Xe.y,Xe.z)}this.setAttribute("position",new xn(A,3))}}class wn{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,i){const a=this.getUtoTmapping(t);return this.getPoint(a,i)}getPoints(t=5){const i=[];for(let a=0;a<=t;a++)i.push(this.getPoint(a/t));return i}getSpacedPoints(t=5){const i=[];for(let a=0;a<=t;a++)i.push(this.getPointAt(a/t));return i}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const i=[];let a,l=this.getPoint(0),d=0;i.push(0);for(let p=1;p<=t;p++)a=this.getPoint(p/t),d+=a.distanceTo(l),i.push(d),l=a;return this.cacheArcLengths=i,i}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,i){const a=this.getLengths();let l=0;const d=a.length;let p;p=i||t*a[d-1];let v,_=0,x=d-1;for(;_<=x;)if(l=Math.floor(_+(x-_)/2),v=a[l]-p,v<0)_=l+1;else{if(!(v>0)){x=l;break}x=l-1}if(l=x,a[l]===p)return l/(d-1);const M=a[l];return(l+(p-M)/(a[l+1]-M))/(d-1)}getTangent(t,i){let a=t-1e-4,l=t+1e-4;a<0&&(a=0),l>1&&(l=1);const d=this.getPoint(a),p=this.getPoint(l),v=i||(d.isVector2?new He:new gt);return v.copy(p).sub(d).normalize(),v}getTangentAt(t,i){const a=this.getUtoTmapping(t);return this.getTangent(a,i)}computeFrenetFrames(t,i){const a=new gt,l=[],d=[],p=[],v=new gt,_=new En;for(let R=0;R<=t;R++){const O=R/t;l[R]=this.getTangentAt(O,new gt),l[R].normalize()}d[0]=new gt,p[0]=new gt;let x=Number.MAX_VALUE;const M=Math.abs(l[0].x),C=Math.abs(l[0].y),A=Math.abs(l[0].z);M<=x&&(x=M,a.set(1,0,0)),C<=x&&(x=C,a.set(0,1,0)),A<=x&&a.set(0,0,1),v.crossVectors(l[0],a).normalize(),d[0].crossVectors(l[0],v),p[0].crossVectors(l[0],d[0]);for(let R=1;R<=t;R++){if(d[R]=d[R-1].clone(),p[R]=p[R-1].clone(),v.crossVectors(l[R-1],l[R]),v.length()>Number.EPSILON){v.normalize();const O=Math.acos(zi(l[R-1].dot(l[R]),-1,1));d[R].applyMatrix4(_.makeRotationAxis(v,O))}p[R].crossVectors(l[R],d[R])}if(i===!0){let R=Math.acos(zi(d[0].dot(d[t]),-1,1));R/=t,l[0].dot(v.crossVectors(d[0],d[t]))>0&&(R=-R);for(let O=1;O<=t;O++)d[O].applyMatrix4(_.makeRotationAxis(l[O],R*O)),p[O].crossVectors(l[O],d[O])}return{tangents:l,normals:d,binormals:p}}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 lr extends wn{constructor(t=0,i=0,a=1,l=1,d=0,p=2*Math.PI,v=!1,_=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=i,this.xRadius=a,this.yRadius=l,this.aStartAngle=d,this.aEndAngle=p,this.aClockwise=v,this.aRotation=_}getPoint(t,i){const a=i||new He,l=2*Math.PI;let d=this.aEndAngle-this.aStartAngle;const p=Math.abs(d)<Number.EPSILON;for(;d<0;)d+=l;for(;d>l;)d-=l;d<Number.EPSILON&&(d=p?0:l),this.aClockwise!==!0||p||(d===l?d=-l:d-=l);const v=this.aStartAngle+t*d;let _=this.aX+this.xRadius*Math.cos(v),x=this.aY+this.yRadius*Math.sin(v);if(this.aRotation!==0){const M=Math.cos(this.aRotation),C=Math.sin(this.aRotation),A=_-this.aX,R=x-this.aY;_=A*M-R*C+this.aX,x=A*C+R*M+this.aY}return a.set(_,x)}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}}lr.prototype.isEllipseCurve=!0;class In extends lr{constructor(t,i,a,l,d,p){super(t,i,a,a,l,d,p),this.type="ArcCurve"}}function jn(){let m=0,t=0,i=0,a=0;function l(d,p,v,_){m=d,t=v,i=-3*d+3*p-2*v-_,a=2*d-2*p+v+_}return{initCatmullRom:function(d,p,v,_,x){l(p,v,x*(v-d),x*(_-p))},initNonuniformCatmullRom:function(d,p,v,_,x,M,C){let A=(p-d)/x-(v-d)/(x+M)+(v-p)/M,R=(v-p)/M-(_-p)/(M+C)+(_-v)/C;A*=M,R*=M,l(p,v,A,R)},calc:function(d){const p=d*d;return m+t*d+i*p+a*(p*d)}}}In.prototype.isArcCurve=!0;const Ei=new gt,bo=new jn,Os=new jn,ki=new jn;class $s extends wn{constructor(t=[],i=!1,a="centripetal",l=.5){super(),this.type="CatmullRomCurve3",this.points=t,this.closed=i,this.curveType=a,this.tension=l}getPoint(t,i=new gt){const a=i,l=this.points,d=l.length,p=(d-(this.closed?0:1))*t;let v,_,x=Math.floor(p),M=p-x;this.closed?x+=x>0?0:(Math.floor(Math.abs(x)/d)+1)*d:M===0&&x===d-1&&(x=d-2,M=1),this.closed||x>0?v=l[(x-1)%d]:(Ei.subVectors(l[0],l[1]).add(l[0]),v=Ei);const C=l[x%d],A=l[(x+1)%d];if(this.closed||x+2<d?_=l[(x+2)%d]:(Ei.subVectors(l[d-1],l[d-2]).add(l[d-1]),_=Ei),this.curveType==="centripetal"||this.curveType==="chordal"){const R=this.curveType==="chordal"?.5:.25;let O=Math.pow(v.distanceToSquared(C),R),U=Math.pow(C.distanceToSquared(A),R),D=Math.pow(A.distanceToSquared(_),R);U<1e-4&&(U=1),O<1e-4&&(O=U),D<1e-4&&(D=U),bo.initNonuniformCatmullRom(v.x,C.x,A.x,_.x,O,U,D),Os.initNonuniformCatmullRom(v.y,C.y,A.y,_.y,O,U,D),ki.initNonuniformCatmullRom(v.z,C.z,A.z,_.z,O,U,D)}else this.curveType==="catmullrom"&&(bo.initCatmullRom(v.x,C.x,A.x,_.x,this.tension),Os.initCatmullRom(v.y,C.y,A.y,_.y,this.tension),ki.initCatmullRom(v.z,C.z,A.z,_.z,this.tension));return a.set(bo.calc(M),Os.calc(M),ki.calc(M)),a}copy(t){super.copy(t),this.points=[];for(let i=0,a=t.points.length;i<a;i++){const l=t.points[i];this.points.push(l.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let i=0,a=this.points.length;i<a;i++){const l=this.points[i];t.points.push(l.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let i=0,a=t.points.length;i<a;i++){const l=t.points[i];this.points.push(new gt().fromArray(l))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function Ka(m,t,i,a,l){const d=.5*(a-t),p=.5*(l-i),v=m*m;return(2*i-2*a+d+p)*(m*v)+(-3*i+3*a-2*d-p)*v+d*m+i}function Qa(m,t,i,a){return function(l,d){const p=1-l;return p*p*d}(m,t)+function(l,d){return 2*(1-l)*l*d}(m,i)+function(l,d){return l*l*d}(m,a)}function El(m,t,i,a,l){return function(d,p){const v=1-d;return v*v*v*p}(m,t)+function(d,p){const v=1-d;return 3*v*v*d*p}(m,i)+function(d,p){return 3*(1-d)*d*d*p}(m,a)+function(d,p){return d*d*d*p}(m,l)}$s.prototype.isCatmullRomCurve3=!0;class ya extends wn{constructor(t=new He,i=new He,a=new He,l=new He){super(),this.type="CubicBezierCurve",this.v0=t,this.v1=i,this.v2=a,this.v3=l}getPoint(t,i=new He){const a=i,l=this.v0,d=this.v1,p=this.v2,v=this.v3;return a.set(El(t,l.x,d.x,p.x,v.x),El(t,l.y,d.y,p.y,v.y)),a}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}}ya.prototype.isCubicBezierCurve=!0;class xa extends wn{constructor(t=new gt,i=new gt,a=new gt,l=new gt){super(),this.type="CubicBezierCurve3",this.v0=t,this.v1=i,this.v2=a,this.v3=l}getPoint(t,i=new gt){const a=i,l=this.v0,d=this.v1,p=this.v2,v=this.v3;return a.set(El(t,l.x,d.x,p.x,v.x),El(t,l.y,d.y,p.y,v.y),El(t,l.z,d.z,p.z,v.z)),a}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}}xa.prototype.isCubicBezierCurve3=!0;class zu extends wn{constructor(t=new He,i=new He){super(),this.type="LineCurve",this.v1=t,this.v2=i}getPoint(t,i=new He){const a=i;return t===1?a.copy(this.v2):(a.copy(this.v2).sub(this.v1),a.multiplyScalar(t).add(this.v1)),a}getPointAt(t,i){return this.getPoint(t,i)}getTangent(t,i){const a=i||new He;return a.copy(this.v2).sub(this.v1).normalize(),a}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}}zu.prototype.isLineCurve=!0;class op extends wn{constructor(t=new gt,i=new gt){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=t,this.v2=i}getPoint(t,i=new gt){const a=i;return t===1?a.copy(this.v2):(a.copy(this.v2).sub(this.v1),a.multiplyScalar(t).add(this.v1)),a}getPointAt(t,i){return this.getPoint(t,i)}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}}class su extends wn{constructor(t=new He,i=new He,a=new He){super(),this.type="QuadraticBezierCurve",this.v0=t,this.v1=i,this.v2=a}getPoint(t,i=new He){const a=i,l=this.v0,d=this.v1,p=this.v2;return a.set(Qa(t,l.x,d.x,p.x),Qa(t,l.y,d.y,p.y)),a}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}}su.prototype.isQuadraticBezierCurve=!0;class Xh extends wn{constructor(t=new gt,i=new gt,a=new gt){super(),this.type="QuadraticBezierCurve3",this.v0=t,this.v1=i,this.v2=a}getPoint(t,i=new gt){const a=i,l=this.v0,d=this.v1,p=this.v2;return a.set(Qa(t,l.x,d.x,p.x),Qa(t,l.y,d.y,p.y),Qa(t,l.z,d.z,p.z)),a}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}}Xh.prototype.isQuadraticBezierCurve3=!0;class au extends wn{constructor(t=[]){super(),this.type="SplineCurve",this.points=t}getPoint(t,i=new He){const a=i,l=this.points,d=(l.length-1)*t,p=Math.floor(d),v=d-p,_=l[p===0?p:p-1],x=l[p],M=l[p>l.length-2?l.length-1:p+1],C=l[p>l.length-3?l.length-1:p+2];return a.set(Ka(v,_.x,x.x,M.x,C.x),Ka(v,_.y,x.y,M.y,C.y)),a}copy(t){super.copy(t),this.points=[];for(let i=0,a=t.points.length;i<a;i++){const l=t.points[i];this.points.push(l.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let i=0,a=this.points.length;i<a;i++){const l=this.points[i];t.points.push(l.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let i=0,a=t.points.length;i<a;i++){const l=t.points[i];this.points.push(new He().fromArray(l))}return this}}au.prototype.isSplineCurve=!0;var tl=Object.freeze({__proto__:null,ArcCurve:In,CatmullRomCurve3:$s,CubicBezierCurve:ya,CubicBezierCurve3:xa,EllipseCurve:lr,LineCurve:zu,LineCurve3:op,QuadraticBezierCurve:su,QuadraticBezierCurve3:Xh,SplineCurve:au});const nf=function(m,t,i=2){const a=t&&t.length,l=a?t[0]*i:m.length;let d=qh(m,0,l,i,!0);const p=[];if(!d||d.next===d.prev)return p;let v,_,x,M,C,A,R;if(a&&(d=function(O,U,D,Z){const ot=[];let vt,mt,At,Pt,Et;for(vt=0,mt=U.length;vt<mt;vt++)At=U[vt]*Z,Pt=vt<mt-1?U[vt+1]*Z:O.length,Et=qh(O,At,Pt,Z,!1),Et===Et.next&&(Et.steiner=!0),ot.push(id(Et));for(ot.sort(ns),vt=0;vt<ot.length;vt++)zf(ot[vt],D),D=Ro(D,D.next);return D}(m,t,d,i)),m.length>80*i){v=x=m[0],_=M=m[1];for(let O=i;O<l;O+=i)C=m[O],A=m[O+1],C<v&&(v=C),A<_&&(_=A),C>x&&(x=C),A>M&&(M=A);R=Math.max(x-v,M-_),R=R!==0?1/R:0}return rd(d,p,i,v,_,R),p};function qh(m,t,i,a,l){let d,p;if(l===function(v,_,x,M){let C=0;for(let A=_,R=x-M;A<x;A+=M)C+=(v[R]-v[A])*(v[A+1]+v[R+1]),R=A;return C}(m,t,i,a)>0)for(d=t;d<i;d+=a)p=Dm(d,m[d],m[d+1],p);else for(d=i-a;d>=t;d-=a)p=Dm(d,m[d],m[d+1],p);return p&&Io(p,p.next)&&(lp(p),p=p.next),p}function Ro(m,t){if(!m)return m;t||(t=m);let i,a=m;do if(i=!1,a.steiner||!Io(a,a.next)&&Mi(a.prev,a,a.next)!==0)a=a.next;else{if(lp(a),a=t=a.prev,a===a.next)break;i=!0}while(i||a!==t);return t}function rd(m,t,i,a,l,d,p){if(!m)return;!p&&d&&function(M,C,A,R){let O=M;do O.z===null&&(O.z=Yh(O.x,O.y,C,A,R)),O.prevZ=O.prev,O.nextZ=O.next,O=O.next;while(O!==M);O.prevZ.nextZ=null,O.prevZ=null,function(U){let D,Z,ot,vt,mt,At,Pt,Et,Ot=1;do{for(Z=U,U=null,mt=null,At=0;Z;){for(At++,ot=Z,Pt=0,D=0;D<Ot&&(Pt++,ot=ot.nextZ,ot);D++);for(Et=Ot;Pt>0||Et>0&&ot;)Pt!==0&&(Et===0||!ot||Z.z<=ot.z)?(vt=Z,Z=Z.nextZ,Pt--):(vt=ot,ot=ot.nextZ,Et--),mt?mt.nextZ=vt:U=vt,vt.prevZ=mt,mt=vt;Z=ot}mt.nextZ=null,Ot*=2}while(At>1)}(O)}(m,a,l,d);let v,_,x=m;for(;m.prev!==m.next;)if(v=m.prev,_=m.next,d?bg(m,a,l,d):xg(m))t.push(v.i/i),t.push(m.i/i),t.push(_.i/i),lp(m),m=_.next,x=_.next;else if((m=_)===x){p?p===1?rd(m=Lm(Ro(m),t,i),t,i,a,l,d,2):p===2&&wg(m,t,i,a,l,d):rd(Ro(m),t,i,a,l,d,1);break}}function xg(m){const t=m.prev,i=m,a=m.next;if(Mi(t,i,a)>=0)return!1;let l=m.next.next;for(;l!==m.prev;){if(Zh(t.x,t.y,i.x,i.y,a.x,a.y,l.x,l.y)&&Mi(l.prev,l,l.next)>=0)return!1;l=l.next}return!0}function bg(m,t,i,a){const l=m.prev,d=m,p=m.next;if(Mi(l,d,p)>=0)return!1;const v=l.x<d.x?l.x<p.x?l.x:p.x:d.x<p.x?d.x:p.x,_=l.y<d.y?l.y<p.y?l.y:p.y:d.y<p.y?d.y:p.y,x=l.x>d.x?l.x>p.x?l.x:p.x:d.x>p.x?d.x:p.x,M=l.y>d.y?l.y>p.y?l.y:p.y:d.y>p.y?d.y:p.y,C=Yh(v,_,t,i,a),A=Yh(x,M,t,i,a);let R=m.prevZ,O=m.nextZ;for(;R&&R.z>=C&&O&&O.z<=A;){if(R!==m.prev&&R!==m.next&&Zh(l.x,l.y,d.x,d.y,p.x,p.y,R.x,R.y)&&Mi(R.prev,R,R.next)>=0||(R=R.prevZ,O!==m.prev&&O!==m.next&&Zh(l.x,l.y,d.x,d.y,p.x,p.y,O.x,O.y)&&Mi(O.prev,O,O.next)>=0))return!1;O=O.nextZ}for(;R&&R.z>=C;){if(R!==m.prev&&R!==m.next&&Zh(l.x,l.y,d.x,d.y,p.x,p.y,R.x,R.y)&&Mi(R.prev,R,R.next)>=0)return!1;R=R.prevZ}for(;O&&O.z<=A;){if(O!==m.prev&&O!==m.next&&Zh(l.x,l.y,d.x,d.y,p.x,p.y,O.x,O.y)&&Mi(O.prev,O,O.next)>=0)return!1;O=O.nextZ}return!0}function Lm(m,t,i){let a=m;do{const l=a.prev,d=a.next.next;!Io(l,d)&&sp(l,a,a.next,d)&&$h(l,d)&&$h(d,l)&&(t.push(l.i/i),t.push(a.i/i),t.push(d.i/i),lp(a),lp(a.next),a=m=d),a=a.next}while(a!==m);return Ro(a)}function wg(m,t,i,a,l,d){let p=m;do{let v=p.next.next;for(;v!==p.prev;){if(p.i!==v.i&&Om(p,v)){let _=rf(p,v);return p=Ro(p,p.next),_=Ro(_,_.next),rd(p,t,i,a,l,d),void rd(_,t,i,a,l,d)}v=v.next}p=p.next}while(p!==m)}function ns(m,t){return m.x-t.x}function zf(m,t){if(t=function(i,a){let l=a;const d=i.x,p=i.y;let v,_=-1/0;do{if(p<=l.y&&p>=l.next.y&&l.next.y!==l.y){const O=l.x+(p-l.y)*(l.next.x-l.x)/(l.next.y-l.y);if(O<=d&&O>_){if(_=O,O===d){if(p===l.y)return l;if(p===l.next.y)return l.next}v=l.x<l.next.x?l:l.next}}l=l.next}while(l!==a);if(!v)return null;if(d===_)return v;const x=v,M=v.x,C=v.y;let A,R=1/0;l=v;do d>=l.x&&l.x>=M&&d!==l.x&&Zh(p<C?d:_,p,M,C,p<C?_:d,p,l.x,l.y)&&(A=Math.abs(p-l.y)/(d-l.x),$h(l,i)&&(A<R||A===R&&(l.x>v.x||l.x===v.x&&Sg(v,l)))&&(v=l,R=A)),l=l.next;while(l!==x);return v}(m,t)){const i=rf(t,m);Ro(t,t.next),Ro(i,i.next)}}function Sg(m,t){return Mi(m.prev,m,t.prev)<0&&Mi(t.next,m,m.next)<0}function Yh(m,t,i,a,l){return(m=1431655765&((m=858993459&((m=252645135&((m=16711935&((m=32767*(m-i)*l)|m<<8))|m<<4))|m<<2))|m<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-a)*l)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function id(m){let t=m,i=m;do(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next;while(t!==m);return i}function Zh(m,t,i,a,l,d,p,v){return(l-p)*(t-v)-(m-p)*(d-v)>=0&&(m-p)*(a-v)-(i-p)*(t-v)>=0&&(i-p)*(d-v)-(l-p)*(a-v)>=0}function Om(m,t){return m.next.i!==t.i&&m.prev.i!==t.i&&!function(i,a){let l=i;do{if(l.i!==i.i&&l.next.i!==i.i&&l.i!==a.i&&l.next.i!==a.i&&sp(l,l.next,i,a))return!0;l=l.next}while(l!==i);return!1}(m,t)&&($h(m,t)&&$h(t,m)&&function(i,a){let l=i,d=!1;const p=(i.x+a.x)/2,v=(i.y+a.y)/2;do l.y>v!=l.next.y>v&&l.next.y!==l.y&&p<(l.next.x-l.x)*(v-l.y)/(l.next.y-l.y)+l.x&&(d=!d),l=l.next;while(l!==i);return d}(m,t)&&(Mi(m.prev,m,t.prev)||Mi(m,t.prev,t))||Io(m,t)&&Mi(m.prev,m,m.next)>0&&Mi(t.prev,t,t.next)>0)}function Mi(m,t,i){return(t.y-m.y)*(i.x-t.x)-(t.x-m.x)*(i.y-t.y)}function Io(m,t){return m.x===t.x&&m.y===t.y}function sp(m,t,i,a){const l=Jh(Mi(m,t,i)),d=Jh(Mi(m,t,a)),p=Jh(Mi(i,a,m)),v=Jh(Mi(i,a,t));return l!==d&&p!==v||!(l!==0||!ap(m,i,t))||!(d!==0||!ap(m,a,t))||!(p!==0||!ap(i,m,a))||!(v!==0||!ap(i,t,a))}function ap(m,t,i){return t.x<=Math.max(m.x,i.x)&&t.x>=Math.min(m.x,i.x)&&t.y<=Math.max(m.y,i.y)&&t.y>=Math.min(m.y,i.y)}function Jh(m){return m>0?1:m<0?-1:0}function $h(m,t){return Mi(m.prev,m,m.next)<0?Mi(m,t,m.next)>=0&&Mi(m,m.prev,t)>=0:Mi(m,t,m.prev)<0||Mi(m,m.next,t)<0}function rf(m,t){const i=new ju(m.i,m.x,m.y),a=new ju(t.i,t.x,t.y),l=m.next,d=t.prev;return m.next=t,t.prev=m,i.next=l,l.prev=i,a.next=i,i.prev=a,d.next=a,a.prev=d,a}function Dm(m,t,i,a){const l=new ju(m,t,i);return a?(l.next=a.next,l.prev=a,a.next.prev=l,a.next=l):(l.prev=l,l.next=l),l}function lp(m){m.next.prev=m.prev,m.prev.next=m.next,m.prevZ&&(m.prevZ.nextZ=m.nextZ),m.nextZ&&(m.nextZ.prevZ=m.prevZ)}function ju(m,t,i){this.i=m,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class Ds{static area(t){const i=t.length;let a=0;for(let l=i-1,d=0;d<i;l=d++)a+=t[l].x*t[d].y-t[d].x*t[l].y;return .5*a}static isClockWise(t){return Ds.area(t)<0}static triangulateShape(t,i){const a=[],l=[],d=[];Nm(t),Fm(a,t);let p=t.length;i.forEach(Nm);for(let _=0;_<i.length;_++)l.push(p),p+=i[_].length,Fm(a,i[_]);const v=nf(a,l);for(let _=0;_<v.length;_+=3)d.push(v.slice(_,_+3));return d}}function Nm(m){const t=m.length;t>2&&m[t-1].equals(m[0])&&m.pop()}function Fm(m,t){for(let i=0;i<t.length;i++)m.push(t[i].x),m.push(t[i].y)}class el extends zn{constructor(t,i){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:i},t=Array.isArray(t)?t:[t];const a=this,l=[],d=[];for(let v=0,_=t.length;v<_;v++)p(t[v]);function p(v){const _=[],x=i.curveSegments!==void 0?i.curveSegments:12,M=i.steps!==void 0?i.steps:1;let C=i.depth!==void 0?i.depth:100,A=i.bevelEnabled===void 0||i.bevelEnabled,R=i.bevelThickness!==void 0?i.bevelThickness:6,O=i.bevelSize!==void 0?i.bevelSize:R-2,U=i.bevelOffset!==void 0?i.bevelOffset:0,D=i.bevelSegments!==void 0?i.bevelSegments:3;const Z=i.extrudePath,ot=i.UVGenerator!==void 0?i.UVGenerator:Bm;i.amount!==void 0&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),C=i.amount);let vt,mt,At,Pt,Et,Ot=!1;Z&&(vt=Z.getSpacedPoints(M),Ot=!0,A=!1,mt=Z.computeFrenetFrames(M,!1),At=new gt,Pt=new gt,Et=new gt),A||(D=0,R=0,O=0,U=0);const Ie=v.extractPoints(x);let ye=Ie.shape;const xe=Ie.holes;if(!Ds.isClockWise(ye)){ye=ye.reverse();for(let be=0,xt=xe.length;be<xt;be++){const Zt=xe[be];Ds.isClockWise(Zt)&&(xe[be]=Zt.reverse())}}const ge=Ds.triangulateShape(ye,xe),Ht=ye;for(let be=0,xt=xe.length;be<xt;be++){const Zt=xe[be];ye=ye.concat(Zt)}function ce(be,xt,Zt){return xt||console.error("THREE.ExtrudeGeometry: vec does not exist"),xt.clone().multiplyScalar(Zt).add(be)}const We=ye.length,je=ge.length;function ze(be,xt,Zt){let Te,Pe,we;const bn=be.x-xt.x,Gn=be.y-xt.y,Fn=Zt.x-be.x,_r=Zt.y-be.y,Tr=bn*bn+Gn*Gn,qo=bn*_r-Gn*Fn;if(Math.abs(qo)>Number.EPSILON){const fi=Math.sqrt(Tr),du=Math.sqrt(Fn*Fn+_r*_r),_m=xt.x-Gn/fi,ym=xt.y+bn/fi,xm=((Zt.x-_r/du-_m)*_r-(Zt.y+Fn/du-ym)*Fn)/(bn*_r-Gn*Fn);Te=_m+bn*xm-be.x,Pe=ym+Gn*xm-be.y;const Qs=Te*Te+Pe*Pe;if(Qs<=2)return new He(Te,Pe);we=Math.sqrt(Qs/2)}else{let fi=!1;bn>Number.EPSILON?Fn>Number.EPSILON&&(fi=!0):bn<-Number.EPSILON?Fn<-Number.EPSILON&&(fi=!0):Math.sign(Gn)===Math.sign(_r)&&(fi=!0),fi?(Te=-Gn,Pe=bn,we=Math.sqrt(Tr)):(Te=bn,Pe=Gn,we=Math.sqrt(Tr/2))}return new He(Te/we,Pe/we)}const fn=[];for(let be=0,xt=Ht.length,Zt=xt-1,Te=be+1;be<xt;be++,Zt++,Te++)Zt===xt&&(Zt=0),Te===xt&&(Te=0),fn[be]=ze(Ht[be],Ht[Zt],Ht[Te]);const _n=[];let Mn,Sn=fn.concat();for(let be=0,xt=xe.length;be<xt;be++){const Zt=xe[be];Mn=[];for(let Te=0,Pe=Zt.length,we=Pe-1,bn=Te+1;Te<Pe;Te++,we++,bn++)we===Pe&&(we=0),bn===Pe&&(bn=0),Mn[Te]=ze(Zt[Te],Zt[we],Zt[bn]);_n.push(Mn),Sn=Sn.concat(Mn)}for(let be=0;be<D;be++){const xt=be/D,Zt=R*Math.cos(xt*Math.PI/2),Te=O*Math.sin(xt*Math.PI/2)+U;for(let Pe=0,we=Ht.length;Pe<we;Pe++){const bn=ce(Ht[Pe],fn[Pe],Te);Fe(bn.x,bn.y,-Zt)}for(let Pe=0,we=xe.length;Pe<we;Pe++){const bn=xe[Pe];Mn=_n[Pe];for(let Gn=0,Fn=bn.length;Gn<Fn;Gn++){const _r=ce(bn[Gn],Mn[Gn],Te);Fe(_r.x,_r.y,-Zt)}}}const Rt=O+U;for(let be=0;be<We;be++){const xt=A?ce(ye[be],Sn[be],Rt):ye[be];Ot?(Pt.copy(mt.normals[0]).multiplyScalar(xt.x),At.copy(mt.binormals[0]).multiplyScalar(xt.y),Et.copy(vt[0]).add(Pt).add(At),Fe(Et.x,Et.y,Et.z)):Fe(xt.x,xt.y,0)}for(let be=1;be<=M;be++)for(let xt=0;xt<We;xt++){const Zt=A?ce(ye[xt],Sn[xt],Rt):ye[xt];Ot?(Pt.copy(mt.normals[be]).multiplyScalar(Zt.x),At.copy(mt.binormals[be]).multiplyScalar(Zt.y),Et.copy(vt[be]).add(Pt).add(At),Fe(Et.x,Et.y,Et.z)):Fe(Zt.x,Zt.y,C/M*be)}for(let be=D-1;be>=0;be--){const xt=be/D,Zt=R*Math.cos(xt*Math.PI/2),Te=O*Math.sin(xt*Math.PI/2)+U;for(let Pe=0,we=Ht.length;Pe<we;Pe++){const bn=ce(Ht[Pe],fn[Pe],Te);Fe(bn.x,bn.y,C+Zt)}for(let Pe=0,we=xe.length;Pe<we;Pe++){const bn=xe[Pe];Mn=_n[Pe];for(let Gn=0,Fn=bn.length;Gn<Fn;Gn++){const _r=ce(bn[Gn],Mn[Gn],Te);Ot?Fe(_r.x,_r.y+vt[M-1].y,vt[M-1].x+Zt):Fe(_r.x,_r.y,C+Zt)}}}function Dt(be,xt){let Zt=be.length;for(;--Zt>=0;){const Te=Zt;let Pe=Zt-1;Pe<0&&(Pe=be.length-1);for(let we=0,bn=M+2*D;we<bn;we++){const Gn=We*we,Fn=We*(we+1);pe(xt+Te+Gn,xt+Pe+Gn,xt+Pe+Fn,xt+Te+Fn)}}}function Fe(be,xt,Zt){_.push(be),_.push(xt),_.push(Zt)}function Be(be,xt,Zt){rn(be),rn(xt),rn(Zt);const Te=l.length/3,Pe=ot.generateTopUV(a,l,Te-3,Te-2,Te-1);sn(Pe[0]),sn(Pe[1]),sn(Pe[2])}function pe(be,xt,Zt,Te){rn(be),rn(xt),rn(Te),rn(xt),rn(Zt),rn(Te);const Pe=l.length/3,we=ot.generateSideWallUV(a,l,Pe-6,Pe-3,Pe-2,Pe-1);sn(we[0]),sn(we[1]),sn(we[3]),sn(we[1]),sn(we[2]),sn(we[3])}function rn(be){l.push(_[3*be+0]),l.push(_[3*be+1]),l.push(_[3*be+2])}function sn(be){d.push(be.x),d.push(be.y)}(function(){const be=l.length/3;if(A){let xt=0,Zt=We*xt;for(let Te=0;Te<je;Te++){const Pe=ge[Te];Be(Pe[2]+Zt,Pe[1]+Zt,Pe[0]+Zt)}xt=M+2*D,Zt=We*xt;for(let Te=0;Te<je;Te++){const Pe=ge[Te];Be(Pe[0]+Zt,Pe[1]+Zt,Pe[2]+Zt)}}else{for(let xt=0;xt<je;xt++){const Zt=ge[xt];Be(Zt[2],Zt[1],Zt[0])}for(let xt=0;xt<je;xt++){const Zt=ge[xt];Be(Zt[0]+We*M,Zt[1]+We*M,Zt[2]+We*M)}}a.addGroup(be,l.length/3-be,0)})(),function(){const be=l.length/3;let xt=0;Dt(Ht,xt),xt+=Ht.length;for(let Zt=0,Te=xe.length;Zt<Te;Zt++){const Pe=xe[Zt];Dt(Pe,xt),xt+=Pe.length}a.addGroup(be,l.length/3-be,1)}()}this.setAttribute("position",new xn(l,3)),this.setAttribute("uv",new xn(d,2)),this.computeVertexNormals()}toJSON(){const t=super.toJSON();return function(i,a,l){if(l.shapes=[],Array.isArray(i))for(let d=0,p=i.length;d<p;d++){const v=i[d];l.shapes.push(v.uuid)}else l.shapes.push(i.uuid);return a.extrudePath!==void 0&&(l.options.extrudePath=a.extrudePath.toJSON()),l}(this.parameters.shapes,this.parameters.options,t)}static fromJSON(t,i){const a=[];for(let d=0,p=t.shapes.length;d<p;d++){const v=i[t.shapes[d]];a.push(v)}const l=t.options.extrudePath;return l!==void 0&&(t.options.extrudePath=new tl[l.type]().fromJSON(l)),new el(a,t.options)}}const Bm={generateTopUV:function(m,t,i,a,l){const d=t[3*i],p=t[3*i+1],v=t[3*a],_=t[3*a+1],x=t[3*l],M=t[3*l+1];return[new He(d,p),new He(v,_),new He(x,M)]},generateSideWallUV:function(m,t,i,a,l,d){const p=t[3*i],v=t[3*i+1],_=t[3*i+2],x=t[3*a],M=t[3*a+1],C=t[3*a+2],A=t[3*l],R=t[3*l+1],O=t[3*l+2],U=t[3*d],D=t[3*d+1],Z=t[3*d+2];return Math.abs(v-M)<Math.abs(p-x)?[new He(p,1-_),new He(x,1-C),new He(A,1-O),new He(U,1-Z)]:[new He(v,1-_),new He(M,1-C),new He(R,1-O),new He(D,1-Z)]}};class Vu extends ln{constructor(t=1,i=0){const a=(1+Math.sqrt(5))/2;super([-1,a,0,1,a,0,-1,-a,0,1,-a,0,0,-1,a,0,1,a,0,-1,-a,0,1,-a,a,0,-1,a,0,1,-a,0,-1,-a,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,i),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:i}}static fromJSON(t){return new Vu(t.radius,t.detail)}}class od extends zn{constructor(t,i=12,a=0,l=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:t,segments:i,phiStart:a,phiLength:l},i=Math.floor(i),l=zi(l,0,2*Math.PI);const d=[],p=[],v=[],_=1/i,x=new gt,M=new He;for(let C=0;C<=i;C++){const A=a+C*_*l,R=Math.sin(A),O=Math.cos(A);for(let U=0;U<=t.length-1;U++)x.x=t[U].x*R,x.y=t[U].y,x.z=t[U].x*O,p.push(x.x,x.y,x.z),M.x=C/i,M.y=U/(t.length-1),v.push(M.x,M.y)}for(let C=0;C<i;C++)for(let A=0;A<t.length-1;A++){const R=A+C*t.length,O=R,U=R+t.length,D=R+t.length+1,Z=R+1;d.push(O,U,Z),d.push(U,D,Z)}if(this.setIndex(d),this.setAttribute("position",new xn(p,3)),this.setAttribute("uv",new xn(v,2)),this.computeVertexNormals(),l===2*Math.PI){const C=this.attributes.normal.array,A=new gt,R=new gt,O=new gt,U=i*t.length*3;for(let D=0,Z=0;D<t.length;D++,Z+=3)A.x=C[Z+0],A.y=C[Z+1],A.z=C[Z+2],R.x=C[U+Z+0],R.y=C[U+Z+1],R.z=C[U+Z+2],O.addVectors(A,R).normalize(),C[Z+0]=C[U+Z+0]=O.x,C[Z+1]=C[U+Z+1]=O.y,C[Z+2]=C[U+Z+2]=O.z}}static fromJSON(t){return new od(t.points,t.segments,t.phiStart,t.phiLength)}}class Kh extends ln{constructor(t=1,i=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,i),this.type="OctahedronGeometry",this.parameters={radius:t,detail:i}}static fromJSON(t){return new Kh(t.radius,t.detail)}}class up extends zn{constructor(t,i,a){super(),this.type="ParametricGeometry",this.parameters={func:t,slices:i,stacks:a};const l=[],d=[],p=[],v=[],_=1e-5,x=new gt,M=new gt,C=new gt,A=new gt,R=new gt;t.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");const O=i+1;for(let U=0;U<=a;U++){const D=U/a;for(let Z=0;Z<=i;Z++){const ot=Z/i;t(ot,D,M),d.push(M.x,M.y,M.z),ot-_>=0?(t(ot-_,D,C),A.subVectors(M,C)):(t(ot+_,D,C),A.subVectors(C,M)),D-_>=0?(t(ot,D-_,C),R.subVectors(M,C)):(t(ot,D+_,C),R.subVectors(C,M)),x.crossVectors(A,R).normalize(),p.push(x.x,x.y,x.z),v.push(ot,D)}}for(let U=0;U<a;U++)for(let D=0;D<i;D++){const Z=U*O+D,ot=U*O+D+1,vt=(U+1)*O+D+1,mt=(U+1)*O+D;l.push(Z,ot,mt),l.push(ot,vt,mt)}this.setIndex(l),this.setAttribute("position",new xn(d,3)),this.setAttribute("normal",new xn(p,3)),this.setAttribute("uv",new xn(v,2))}}class sd extends zn{constructor(t=.5,i=1,a=8,l=1,d=0,p=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:i,thetaSegments:a,phiSegments:l,thetaStart:d,thetaLength:p},a=Math.max(3,a);const v=[],_=[],x=[],M=[];let C=t;const A=(i-t)/(l=Math.max(1,l)),R=new gt,O=new He;for(let U=0;U<=l;U++){for(let D=0;D<=a;D++){const Z=d+D/a*p;R.x=C*Math.cos(Z),R.y=C*Math.sin(Z),_.push(R.x,R.y,R.z),x.push(0,0,1),O.x=(R.x/i+1)/2,O.y=(R.y/i+1)/2,M.push(O.x,O.y)}C+=A}for(let U=0;U<l;U++){const D=U*(a+1);for(let Z=0;Z<a;Z++){const ot=Z+D,vt=ot,mt=ot+a+1,At=ot+a+2,Pt=ot+1;v.push(vt,mt,Pt),v.push(mt,At,Pt)}}this.setIndex(v),this.setAttribute("position",new xn(_,3)),this.setAttribute("normal",new xn(x,3)),this.setAttribute("uv",new xn(M,2))}static fromJSON(t){return new sd(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}}class Qh extends zn{constructor(t,i=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:i};const a=[],l=[],d=[],p=[];let v=0,_=0;if(Array.isArray(t)===!1)x(t);else for(let M=0;M<t.length;M++)x(t[M]),this.addGroup(v,_,M),v+=_,_=0;function x(M){const C=l.length/3,A=M.extractPoints(i);let R=A.shape;const O=A.holes;Ds.isClockWise(R)===!1&&(R=R.reverse());for(let D=0,Z=O.length;D<Z;D++){const ot=O[D];Ds.isClockWise(ot)===!0&&(O[D]=ot.reverse())}const U=Ds.triangulateShape(R,O);for(let D=0,Z=O.length;D<Z;D++){const ot=O[D];R=R.concat(ot)}for(let D=0,Z=R.length;D<Z;D++){const ot=R[D];l.push(ot.x,ot.y,0),d.push(0,0,1),p.push(ot.x,ot.y)}for(let D=0,Z=U.length;D<Z;D++){const ot=U[D],vt=ot[0]+C,mt=ot[1]+C,At=ot[2]+C;a.push(vt,mt,At),_+=3}}this.setIndex(a),this.setAttribute("position",new xn(l,3)),this.setAttribute("normal",new xn(d,3)),this.setAttribute("uv",new xn(p,2))}toJSON(){const t=super.toJSON();return function(i,a){if(a.shapes=[],Array.isArray(i))for(let l=0,d=i.length;l<d;l++){const p=i[l];a.shapes.push(p.uuid)}else a.shapes.push(i.uuid);return a}(this.parameters.shapes,t)}static fromJSON(t,i){const a=[];for(let l=0,d=t.shapes.length;l<d;l++){const p=i[t.shapes[l]];a.push(p)}return new Qh(a,t.curveSegments)}}class tc extends zn{constructor(t=1,i=8,a=6,l=0,d=2*Math.PI,p=0,v=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:i,heightSegments:a,phiStart:l,phiLength:d,thetaStart:p,thetaLength:v},i=Math.max(3,Math.floor(i)),a=Math.max(2,Math.floor(a));const _=Math.min(p+v,Math.PI);let x=0;const M=[],C=new gt,A=new gt,R=[],O=[],U=[],D=[];for(let Z=0;Z<=a;Z++){const ot=[],vt=Z/a;let mt=0;Z==0&&p==0?mt=.5/i:Z==a&&_==Math.PI&&(mt=-.5/i);for(let At=0;At<=i;At++){const Pt=At/i;C.x=-t*Math.cos(l+Pt*d)*Math.sin(p+vt*v),C.y=t*Math.cos(p+vt*v),C.z=t*Math.sin(l+Pt*d)*Math.sin(p+vt*v),O.push(C.x,C.y,C.z),A.copy(C).normalize(),U.push(A.x,A.y,A.z),D.push(Pt+mt,1-vt),ot.push(x++)}M.push(ot)}for(let Z=0;Z<a;Z++)for(let ot=0;ot<i;ot++){const vt=M[Z][ot+1],mt=M[Z][ot],At=M[Z+1][ot],Pt=M[Z+1][ot+1];(Z!==0||p>0)&&R.push(vt,mt,Pt),(Z!==a-1||_<Math.PI)&&R.push(mt,At,Pt)}this.setIndex(R),this.setAttribute("position",new xn(O,3)),this.setAttribute("normal",new xn(U,3)),this.setAttribute("uv",new xn(D,2))}static fromJSON(t){return new tc(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class ad extends ln{constructor(t=1,i=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,i),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:i}}static fromJSON(t){return new ad(t.radius,t.detail)}}class of extends el{constructor(t,i={}){const a=i.font;if(!a||!a.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new zn;const l=a.generateShapes(t,i.size);i.depth=i.height!==void 0?i.height:50,i.bevelThickness===void 0&&(i.bevelThickness=10),i.bevelSize===void 0&&(i.bevelSize=8),i.bevelEnabled===void 0&&(i.bevelEnabled=!1),super(l,i),this.type="TextGeometry"}}class ld extends zn{constructor(t=1,i=.4,a=8,l=6,d=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:i,radialSegments:a,tubularSegments:l,arc:d},a=Math.floor(a),l=Math.floor(l);const p=[],v=[],_=[],x=[],M=new gt,C=new gt,A=new gt;for(let R=0;R<=a;R++)for(let O=0;O<=l;O++){const U=O/l*d,D=R/a*Math.PI*2;C.x=(t+i*Math.cos(D))*Math.cos(U),C.y=(t+i*Math.cos(D))*Math.sin(U),C.z=i*Math.sin(D),v.push(C.x,C.y,C.z),M.x=t*Math.cos(U),M.y=t*Math.sin(U),A.subVectors(C,M).normalize(),_.push(A.x,A.y,A.z),x.push(O/l),x.push(R/a)}for(let R=1;R<=a;R++)for(let O=1;O<=l;O++){const U=(l+1)*R+O-1,D=(l+1)*(R-1)+O-1,Z=(l+1)*(R-1)+O,ot=(l+1)*R+O;p.push(U,D,ot),p.push(D,Z,ot)}this.setIndex(p),this.setAttribute("position",new xn(v,3)),this.setAttribute("normal",new xn(_,3)),this.setAttribute("uv",new xn(x,2))}static fromJSON(t){return new ld(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}}class ud extends zn{constructor(t=1,i=.4,a=64,l=8,d=2,p=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:i,tubularSegments:a,radialSegments:l,p:d,q:p},a=Math.floor(a),l=Math.floor(l);const v=[],_=[],x=[],M=[],C=new gt,A=new gt,R=new gt,O=new gt,U=new gt,D=new gt,Z=new gt;for(let vt=0;vt<=a;++vt){const mt=vt/a*d*Math.PI*2;ot(mt,d,p,t,R),ot(mt+.01,d,p,t,O),D.subVectors(O,R),Z.addVectors(O,R),U.crossVectors(D,Z),Z.crossVectors(U,D),U.normalize(),Z.normalize();for(let At=0;At<=l;++At){const Pt=At/l*Math.PI*2,Et=-i*Math.cos(Pt),Ot=i*Math.sin(Pt);C.x=R.x+(Et*Z.x+Ot*U.x),C.y=R.y+(Et*Z.y+Ot*U.y),C.z=R.z+(Et*Z.z+Ot*U.z),_.push(C.x,C.y,C.z),A.subVectors(C,R).normalize(),x.push(A.x,A.y,A.z),M.push(vt/a),M.push(At/l)}}for(let vt=1;vt<=a;vt++)for(let mt=1;mt<=l;mt++){const At=(l+1)*(vt-1)+(mt-1),Pt=(l+1)*vt+(mt-1),Et=(l+1)*vt+mt,Ot=(l+1)*(vt-1)+mt;v.push(At,Pt,Ot),v.push(Pt,Et,Ot)}function ot(vt,mt,At,Pt,Et){const Ot=Math.cos(vt),Ie=Math.sin(vt),ye=At/mt*vt,xe=Math.cos(ye);Et.x=Pt*(2+xe)*.5*Ot,Et.y=Pt*(2+xe)*Ie*.5,Et.z=Pt*Math.sin(ye)*.5}this.setIndex(v),this.setAttribute("position",new xn(_,3)),this.setAttribute("normal",new xn(x,3)),this.setAttribute("uv",new xn(M,2))}static fromJSON(t){return new ud(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}}class hd extends zn{constructor(t,i=64,a=1,l=8,d=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:i,radius:a,radialSegments:l,closed:d};const p=t.computeFrenetFrames(i,d);this.tangents=p.tangents,this.normals=p.normals,this.binormals=p.binormals;const v=new gt,_=new gt,x=new He;let M=new gt;const C=[],A=[],R=[],O=[];function U(D){M=t.getPointAt(D/i,M);const Z=p.normals[D],ot=p.binormals[D];for(let vt=0;vt<=l;vt++){const mt=vt/l*Math.PI*2,At=Math.sin(mt),Pt=-Math.cos(mt);_.x=Pt*Z.x+At*ot.x,_.y=Pt*Z.y+At*ot.y,_.z=Pt*Z.z+At*ot.z,_.normalize(),A.push(_.x,_.y,_.z),v.x=M.x+a*_.x,v.y=M.y+a*_.y,v.z=M.z+a*_.z,C.push(v.x,v.y,v.z)}}(function(){for(let D=0;D<i;D++)U(D);U(d===!1?i:0),function(){for(let D=0;D<=i;D++)for(let Z=0;Z<=l;Z++)x.x=D/i,x.y=Z/l,R.push(x.x,x.y)}(),function(){for(let D=1;D<=i;D++)for(let Z=1;Z<=l;Z++){const ot=(l+1)*(D-1)+(Z-1),vt=(l+1)*D+(Z-1),mt=(l+1)*D+Z,At=(l+1)*(D-1)+Z;O.push(ot,vt,At),O.push(vt,mt,At)}}()})(),this.setIndex(O),this.setAttribute("position",new xn(C,3)),this.setAttribute("normal",new xn(A,3)),this.setAttribute("uv",new xn(R,2))}toJSON(){const t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new hd(new tl[t.path.type]().fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}class jf extends zn{constructor(t){if(super(),this.type="WireframeGeometry",t.isGeometry===!0)return void console.error("THREE.WireframeGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");const i=[],a=[0,0],l={},d=new gt;if(t.index!==null){const p=t.attributes.position,v=t.index;let _=t.groups;_.length===0&&(_=[{start:0,count:v.count,materialIndex:0}]);for(let x=0,M=_.length;x<M;++x){const C=_[x],A=C.start;for(let R=A,O=A+C.count;R<O;R+=3)for(let U=0;U<3;U++){const D=v.getX(R+U),Z=v.getX(R+(U+1)%3);a[0]=Math.min(D,Z),a[1]=Math.max(D,Z);const ot=a[0]+","+a[1];l[ot]===void 0&&(l[ot]={index1:a[0],index2:a[1]})}}for(const x in l){const M=l[x];d.fromBufferAttribute(p,M.index1),i.push(d.x,d.y,d.z),d.fromBufferAttribute(p,M.index2),i.push(d.x,d.y,d.z)}}else{const p=t.attributes.position;for(let v=0,_=p.count/3;v<_;v++)for(let x=0;x<3;x++){const M=3*v+x;d.fromBufferAttribute(p,M),i.push(d.x,d.y,d.z);const C=3*v+(x+1)%3;d.fromBufferAttribute(p,C),i.push(d.x,d.y,d.z)}}this.setAttribute("position",new xn(i,3))}}var km=Object.freeze({__proto__:null,BoxGeometry:da,BoxBufferGeometry:da,CircleGeometry:me,CircleBufferGeometry:me,ConeGeometry:gn,ConeBufferGeometry:gn,CylinderGeometry:De,CylinderBufferGeometry:De,DodecahedronGeometry:An,DodecahedronBufferGeometry:An,EdgesGeometry:Yn,ExtrudeGeometry:el,ExtrudeBufferGeometry:el,IcosahedronGeometry:Vu,IcosahedronBufferGeometry:Vu,LatheGeometry:od,LatheBufferGeometry:od,OctahedronGeometry:Kh,OctahedronBufferGeometry:Kh,ParametricGeometry:up,ParametricBufferGeometry:up,PlaneGeometry:ma,PlaneBufferGeometry:ma,PolyhedronGeometry:ln,PolyhedronBufferGeometry:ln,RingGeometry:sd,RingBufferGeometry:sd,ShapeGeometry:Qh,ShapeBufferGeometry:Qh,SphereGeometry:tc,SphereBufferGeometry:tc,TetrahedronGeometry:ad,TetrahedronBufferGeometry:ad,TextGeometry:of,TextBufferGeometry:of,TorusGeometry:ld,TorusBufferGeometry:ld,TorusKnotGeometry:ud,TorusKnotBufferGeometry:ud,TubeGeometry:hd,TubeBufferGeometry:hd,WireframeGeometry:jf});class Vf extends Ni{constructor(t){super(),this.type="ShadowMaterial",this.color=new pn(0),this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this}}Vf.prototype.isShadowMaterial=!0;class ec extends _o{constructor(t){super(t),this.type="RawShaderMaterial"}}ec.prototype.isRawShaderMaterial=!0;class hp extends Ni{constructor(t){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new pn(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 pn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hr,this.normalScale=new He(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.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.vertexTangents=!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.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this.vertexTangents=t.vertexTangents,this}}hp.prototype.isMeshStandardMaterial=!0;class Wf extends hp{constructor(t){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new He(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,Object.defineProperty(this,"ior",{get:function(){return(1+.4*this.reflectivity)/(1-.4*this.reflectivity)},set:function(i){this.reflectivity=zi(2.5*(i-1)/(i+1),0,1)}}),this.sheen=null,this.transmission=0,this.transmissionMap=null,this.thickness=.01,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new pn(1,1,1),this.setValues(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.reflectivity=t.reflectivity,t.sheen?this.sheen=(this.sheen||new pn).copy(t.sheen):this.sheen=null,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}}Wf.prototype.isMeshPhysicalMaterial=!0;class Xf extends Ni{constructor(t){super(),this.type="MeshPhongMaterial",this.color=new pn(16777215),this.specular=new pn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hr,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=br,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,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.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.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}Xf.prototype.isMeshPhongMaterial=!0;class qf extends Ni{constructor(t){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new pn(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hr,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,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.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this}}qf.prototype.isMeshToonMaterial=!0;class Yf extends Ni{constructor(t){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hr,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),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.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}Yf.prototype.isMeshNormalMaterial=!0;class Wu extends Ni{constructor(t){super(),this.type="MeshLambertMaterial",this.color=new pn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=br,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,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.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,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.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this}}Wu.prototype.isMeshLambertMaterial=!0;class sf extends Ni{constructor(t){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new pn(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hr,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,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.alphaMap=t.alphaMap,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}sf.prototype.isMeshMatcapMaterial=!0;class Zf 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}}Zf.prototype.isLineDashedMaterial=!0;var Pn=Object.freeze({__proto__:null,ShadowMaterial:Vf,SpriteMaterial:xo,RawShaderMaterial:ec,ShaderMaterial:_o,PointsMaterial:Tl,MeshPhysicalMaterial:Wf,MeshStandardMaterial:hp,MeshPhongMaterial:Xf,MeshToonMaterial:qf,MeshNormalMaterial:Yf,MeshLambertMaterial:Wu,MeshDepthMaterial:Uh,MeshDistanceMaterial:ms,MeshBasicMaterial:Fi,MeshMatcapMaterial:sf,LineDashedMaterial:Zf,LineBasicMaterial:ro,Material:Ni});const di={arraySlice:function(m,t,i){return di.isTypedArray(m)?new m.constructor(m.subarray(t,i!==void 0?i:m.length)):m.slice(t,i)},convertArray:function(m,t,i){return!m||!i&&m.constructor===t?m:typeof t.BYTES_PER_ELEMENT=="number"?new t(m):Array.prototype.slice.call(m)},isTypedArray:function(m){return ArrayBuffer.isView(m)&&!(m instanceof DataView)},getKeyframeOrder:function(m){const t=m.length,i=new Array(t);for(let a=0;a!==t;++a)i[a]=a;return i.sort(function(a,l){return m[a]-m[l]}),i},sortedArray:function(m,t,i){const a=m.length,l=new m.constructor(a);for(let d=0,p=0;p!==a;++d){const v=i[d]*t;for(let _=0;_!==t;++_)l[p++]=m[v+_]}return l},flattenJSON:function(m,t,i,a){let l=1,d=m[0];for(;d!==void 0&&d[a]===void 0;)d=m[l++];if(d===void 0)return;let p=d[a];if(p!==void 0)if(Array.isArray(p))do p=d[a],p!==void 0&&(t.push(d.time),i.push.apply(i,p)),d=m[l++];while(d!==void 0);else if(p.toArray!==void 0)do p=d[a],p!==void 0&&(t.push(d.time),p.toArray(i,i.length)),d=m[l++];while(d!==void 0);else do p=d[a],p!==void 0&&(t.push(d.time),i.push(p)),d=m[l++];while(d!==void 0)},subclip:function(m,t,i,a,l=30){const d=m.clone();d.name=t;const p=[];for(let _=0;_<d.tracks.length;++_){const x=d.tracks[_],M=x.getValueSize(),C=[],A=[];for(let R=0;R<x.times.length;++R){const O=x.times[R]*l;if(!(O<i||O>=a)){C.push(x.times[R]);for(let U=0;U<M;++U)A.push(x.values[R*M+U])}}C.length!==0&&(x.times=di.convertArray(C,x.times.constructor),x.values=di.convertArray(A,x.values.constructor),p.push(x))}d.tracks=p;let v=1/0;for(let _=0;_<d.tracks.length;++_)v>d.tracks[_].times[0]&&(v=d.tracks[_].times[0]);for(let _=0;_<d.tracks.length;++_)d.tracks[_].shift(-1*v);return d.resetDuration(),d},makeClipAdditive:function(m,t=0,i=m,a=30){a<=0&&(a=30);const l=i.tracks.length,d=t/a;for(let p=0;p<l;++p){const v=i.tracks[p],_=v.ValueTypeName;if(_==="bool"||_==="string")continue;const x=m.tracks.find(function(Z){return Z.name===v.name&&Z.ValueTypeName===_});if(x===void 0)continue;let M=0;const C=v.getValueSize();v.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(M=C/3);let A=0;const R=x.getValueSize();x.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(A=R/3);const O=v.times.length-1;let U;if(d<=v.times[0]){const Z=M,ot=C-M;U=di.arraySlice(v.values,Z,ot)}else if(d>=v.times[O]){const Z=O*C+M,ot=Z+C-M;U=di.arraySlice(v.values,Z,ot)}else{const Z=v.createInterpolant(),ot=M,vt=C-M;Z.evaluate(d),U=di.arraySlice(Z.resultBuffer,ot,vt)}_==="quaternion"&&new Oi().fromArray(U).normalize().conjugate().toArray(U);const D=x.times.length;for(let Z=0;Z<D;++Z){const ot=Z*R+A;if(_==="quaternion")Oi.multiplyQuaternionsFlat(x.values,ot,U,0,x.values,ot);else{const vt=R-2*A;for(let mt=0;mt<vt;++mt)x.values[ot+mt]-=U[mt]}}}return m.blendMode=Md,m}};class Ks{constructor(t,i,a,l){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=l!==void 0?l:new i.constructor(a),this.sampleValues=i,this.valueSize=a,this.settings=null,this.DefaultSettings_={}}evaluate(t){const i=this.parameterPositions;let a=this._cachedIndex,l=i[a],d=i[a-1];t:{e:{let p;n:{r:if(!(t<l)){for(let v=a+2;;){if(l===void 0){if(t<d)break r;return a=i.length,this._cachedIndex=a,this.afterEnd_(a-1,t,d)}if(a===v)break;if(d=l,l=i[++a],t<l)break e}p=i.length;break n}if(t>=d)break t;{const v=i[1];t<v&&(a=2,d=v);for(let _=a-2;;){if(d===void 0)return this._cachedIndex=0,this.beforeStart_(0,t,l);if(a===_)break;if(l=d,d=i[--a-1],t>=d)break e}p=a,a=0}}for(;a<p;){const v=a+p>>>1;t<i[v]?p=v:a=v+1}if(l=i[a],d=i[a-1],d===void 0)return this._cachedIndex=0,this.beforeStart_(0,t,l);if(l===void 0)return a=i.length,this._cachedIndex=a,this.afterEnd_(a-1,d,t)}this._cachedIndex=a,this.intervalChanged_(a,d,l)}return this.interpolate_(a,d,t,l)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const i=this.resultBuffer,a=this.sampleValues,l=this.valueSize,d=t*l;for(let p=0;p!==l;++p)i[p]=a[d+p];return i}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}Ks.prototype.beforeStart_=Ks.prototype.copySampleValue_,Ks.prototype.afterEnd_=Ks.prototype.copySampleValue_;class Xu extends Ks{constructor(t,i,a,l){super(t,i,a,l),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:na,endingEnd:na}}intervalChanged_(t,i,a){const l=this.parameterPositions;let d=t-2,p=t+1,v=l[d],_=l[p];if(v===void 0)switch(this.getSettings_().endingStart){case Na:d=t,v=2*i-a;break;case ys:d=l.length-2,v=i+l[d]-l[d+1];break;default:d=t,v=a}if(_===void 0)switch(this.getSettings_().endingEnd){case Na:p=t,_=2*a-i;break;case ys:p=1,_=a+l[1]-l[0];break;default:p=t-1,_=i}const x=.5*(a-i),M=this.valueSize;this._weightPrev=x/(i-v),this._weightNext=x/(_-a),this._offsetPrev=d*M,this._offsetNext=p*M}interpolate_(t,i,a,l){const d=this.resultBuffer,p=this.sampleValues,v=this.valueSize,_=t*v,x=_-v,M=this._offsetPrev,C=this._offsetNext,A=this._weightPrev,R=this._weightNext,O=(a-i)/(l-i),U=O*O,D=U*O,Z=-A*D+2*A*U-A*O,ot=(1+A)*D+(-1.5-2*A)*U+(-.5+A)*O+1,vt=(-1-R)*D+(1.5+R)*U+.5*O,mt=R*D-R*U;for(let At=0;At!==v;++At)d[At]=Z*p[M+At]+ot*p[x+At]+vt*p[_+At]+mt*p[C+At];return d}}class af extends Ks{constructor(t,i,a,l){super(t,i,a,l)}interpolate_(t,i,a,l){const d=this.resultBuffer,p=this.sampleValues,v=this.valueSize,_=t*v,x=_-v,M=(a-i)/(l-i),C=1-M;for(let A=0;A!==v;++A)d[A]=p[x+A]*C+p[_+A]*M;return d}}class lf extends Ks{constructor(t,i,a,l){super(t,i,a,l)}interpolate_(t){return this.copySampleValue_(t-1)}}class Wo{constructor(t,i,a,l){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(i===void 0||i.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=di.convertArray(i,this.TimeBufferType),this.values=di.convertArray(a,this.ValueBufferType),this.setInterpolation(l||this.DefaultInterpolation)}static toJSON(t){const i=t.constructor;let a;if(i.toJSON!==this.toJSON)a=i.toJSON(t);else{a={name:t.name,times:di.convertArray(t.times,Array),values:di.convertArray(t.values,Array)};const l=t.getInterpolation();l!==t.DefaultInterpolation&&(a.interpolation=l)}return a.type=t.ValueTypeName,a}InterpolantFactoryMethodDiscrete(t){return new lf(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new af(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Xu(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let i;switch(t){case Ol:i=this.InterpolantFactoryMethodDiscrete;break;case Ii:i=this.InterpolantFactoryMethodLinear;break;case Da:i=this.InterpolantFactoryMethodSmooth}if(i===void 0){const a="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0){if(t===this.DefaultInterpolation)throw new Error(a);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",a),this}return this.createInterpolant=i,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Ol;case this.InterpolantFactoryMethodLinear:return Ii;case this.InterpolantFactoryMethodSmooth:return Da}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){const i=this.times;for(let a=0,l=i.length;a!==l;++a)i[a]+=t}return this}scale(t){if(t!==1){const i=this.times;for(let a=0,l=i.length;a!==l;++a)i[a]*=t}return this}trim(t,i){const a=this.times,l=a.length;let d=0,p=l-1;for(;d!==l&&a[d]<t;)++d;for(;p!==-1&&a[p]>i;)--p;if(++p,d!==0||p!==l){d>=p&&(p=Math.max(p,1),d=p-1);const v=this.getValueSize();this.times=di.arraySlice(a,d,p),this.values=di.arraySlice(this.values,d*v,p*v)}return this}validate(){let t=!0;const i=this.getValueSize();i-Math.floor(i)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const a=this.times,l=this.values,d=a.length;d===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let p=null;for(let v=0;v!==d;v++){const _=a[v];if(typeof _=="number"&&isNaN(_)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,v,_),t=!1;break}if(p!==null&&p>_){console.error("THREE.KeyframeTrack: Out of order keys.",this,v,_,p),t=!1;break}p=_}if(l!==void 0&&di.isTypedArray(l))for(let v=0,_=l.length;v!==_;++v){const x=l[v];if(isNaN(x)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,v,x),t=!1;break}}return t}optimize(){const t=di.arraySlice(this.times),i=di.arraySlice(this.values),a=this.getValueSize(),l=this.getInterpolation()===Da,d=t.length-1;let p=1;for(let v=1;v<d;++v){let _=!1;const x=t[v];if(x!==t[v+1]&&(v!==1||x!==t[0]))if(l)_=!0;else{const M=v*a,C=M-a,A=M+a;for(let R=0;R!==a;++R){const O=i[M+R];if(O!==i[C+R]||O!==i[A+R]){_=!0;break}}}if(_){if(v!==p){t[p]=t[v];const M=v*a,C=p*a;for(let A=0;A!==a;++A)i[C+A]=i[M+A]}++p}}if(d>0){t[p]=t[d];for(let v=d*a,_=p*a,x=0;x!==a;++x)i[_+x]=i[v+x];++p}return p!==t.length?(this.times=di.arraySlice(t,0,p),this.values=di.arraySlice(i,0,p*a)):(this.times=t,this.values=i),this}clone(){const t=di.arraySlice(this.times,0),i=di.arraySlice(this.values,0),a=new this.constructor(this.name,t,i);return a.createInterpolant=this.createInterpolant,a}}Wo.prototype.TimeBufferType=Float32Array,Wo.prototype.ValueBufferType=Float32Array,Wo.prototype.DefaultInterpolation=Ii;class nc extends Wo{}nc.prototype.ValueTypeName="bool",nc.prototype.ValueBufferType=Array,nc.prototype.DefaultInterpolation=Ol,nc.prototype.InterpolantFactoryMethodLinear=void 0,nc.prototype.InterpolantFactoryMethodSmooth=void 0;class uf extends Wo{}uf.prototype.ValueTypeName="color";class rc extends Wo{}rc.prototype.ValueTypeName="number";class Jf extends Ks{constructor(t,i,a,l){super(t,i,a,l)}interpolate_(t,i,a,l){const d=this.resultBuffer,p=this.sampleValues,v=this.valueSize,_=(a-i)/(l-i);let x=t*v;for(let M=x+v;x!==M;x+=4)Oi.slerpFlat(d,0,p,x-v,p,x,_);return d}}class ic extends Wo{InterpolantFactoryMethodLinear(t){return new Jf(this.times,this.values,this.getValueSize(),t)}}ic.prototype.ValueTypeName="quaternion",ic.prototype.DefaultInterpolation=Ii,ic.prototype.InterpolantFactoryMethodSmooth=void 0;class nl extends Wo{}nl.prototype.ValueTypeName="string",nl.prototype.ValueBufferType=Array,nl.prototype.DefaultInterpolation=Ol,nl.prototype.InterpolantFactoryMethodLinear=void 0,nl.prototype.InterpolantFactoryMethodSmooth=void 0;class qu extends Wo{}qu.prototype.ValueTypeName="vector";class cd{constructor(t,i=-1,a,l=Fa){this.name=t,this.tracks=a,this.duration=i,this.blendMode=l,this.uuid=Fo(),this.duration<0&&this.resetDuration()}static parse(t){const i=[],a=t.tracks,l=1/(t.fps||1);for(let p=0,v=a.length;p!==v;++p)i.push(Tg(a[p]).scale(l));const d=new this(t.name,t.duration,i,t.blendMode);return d.uuid=t.uuid,d}static toJSON(t){const i=[],a=t.tracks,l={name:t.name,duration:t.duration,tracks:i,uuid:t.uuid,blendMode:t.blendMode};for(let d=0,p=a.length;d!==p;++d)i.push(Wo.toJSON(a[d]));return l}static CreateFromMorphTargetSequence(t,i,a,l){const d=i.length,p=[];for(let v=0;v<d;v++){let _=[],x=[];_.push((v+d-1)%d,v,(v+1)%d),x.push(0,1,0);const M=di.getKeyframeOrder(_);_=di.sortedArray(_,1,M),x=di.sortedArray(x,1,M),l||_[0]!==0||(_.push(d),x.push(x[0])),p.push(new rc(".morphTargetInfluences["+i[v].name+"]",_,x).scale(1/a))}return new this(t,-1,p)}static findByName(t,i){let a=t;if(!Array.isArray(t)){const l=t;a=l.geometry&&l.geometry.animations||l.animations}for(let l=0;l<a.length;l++)if(a[l].name===i)return a[l];return null}static CreateClipsFromMorphTargetSequences(t,i,a){const l={},d=/^([\w-]*?)([\d]+)$/;for(let v=0,_=t.length;v<_;v++){const x=t[v],M=x.name.match(d);if(M&&M.length>1){const C=M[1];let A=l[C];A||(l[C]=A=[]),A.push(x)}}const p=[];for(const v in l)p.push(this.CreateFromMorphTargetSequence(v,l[v],i,a));return p}static parseAnimation(t,i){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const a=function(M,C,A,R,O){if(A.length!==0){const U=[],D=[];di.flattenJSON(A,U,D,R),U.length!==0&&O.push(new M(C,U,D))}},l=[],d=t.name||"default",p=t.fps||30,v=t.blendMode;let _=t.length||-1;const x=t.hierarchy||[];for(let M=0;M<x.length;M++){const C=x[M].keys;if(C&&C.length!==0)if(C[0].morphTargets){const A={};let R;for(R=0;R<C.length;R++)if(C[R].morphTargets)for(let O=0;O<C[R].morphTargets.length;O++)A[C[R].morphTargets[O]]=-1;for(const O in A){const U=[],D=[];for(let Z=0;Z!==C[R].morphTargets.length;++Z){const ot=C[R];U.push(ot.time),D.push(ot.morphTarget===O?1:0)}l.push(new rc(".morphTargetInfluence["+O+"]",U,D))}_=A.length*(p||1)}else{const A=".bones["+i[M].name+"]";a(qu,A+".position",C,"pos",l),a(ic,A+".quaternion",C,"rot",l),a(qu,A+".scale",C,"scl",l)}}return l.length===0?null:new this(d,_,l,v)}resetDuration(){let t=0;for(let i=0,a=this.tracks.length;i!==a;++i){const l=this.tracks[i];t=Math.max(t,l.times[l.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let i=0;i<this.tracks.length;i++)t=t&&this.tracks[i].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let i=0;i<this.tracks.length;i++)t.push(this.tracks[i].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Tg(m){if(m.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const t=function(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return rc;case"vector":case"vector2":case"vector3":case"vector4":return qu;case"color":return uf;case"quaternion":return ic;case"bool":case"boolean":return nc;case"string":return nl}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}(m.type);if(m.times===void 0){const i=[],a=[];di.flattenJSON(m.keys,i,a,"value"),m.times=i,m.values=a}return t.parse!==void 0?t.parse(m):new t(m.name,m.times,m.values,m.interpolation)}const oc={enabled:!1,files:{},add:function(m,t){this.enabled!==!1&&(this.files[m]=t)},get:function(m){if(this.enabled!==!1)return this.files[m]},remove:function(m){delete this.files[m]},clear:function(){this.files={}}};class ba{constructor(t,i,a){const l=this;let d=!1,p=0,v=0,_;const x=[];this.onStart=void 0,this.onLoad=t,this.onProgress=i,this.onError=a,this.itemStart=function(M){v++,d===!1&&l.onStart!==void 0&&l.onStart(M,p,v),d=!0},this.itemEnd=function(M){p++,l.onProgress!==void 0&&l.onProgress(M,p,v),p===v&&(d=!1,l.onLoad!==void 0&&l.onLoad())},this.itemError=function(M){l.onError!==void 0&&l.onError(M)},this.resolveURL=function(M){return _?_(M):M},this.setURLModifier=function(M){return _=M,this},this.addHandler=function(M,C){return x.push(M,C),this},this.removeHandler=function(M){const C=x.indexOf(M);return C!==-1&&x.splice(C,2),this},this.getHandler=function(M){for(let C=0,A=x.length;C<A;C+=2){const R=x[C],O=x[C+1];if(R.global&&(R.lastIndex=0),R.test(M))return O}return null}}}const sc=new ba;class Xo{constructor(t){this.manager=t!==void 0?t:sc,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,i){const a=this;return new Promise(function(l,d){a.load(t,l,i,d)})}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 wa={};class Sa extends Xo{constructor(t){super(t)}load(t,i,a,l){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const d=this,p=oc.get(t);if(p!==void 0)return d.manager.itemStart(t),setTimeout(function(){i&&i(p),d.manager.itemEnd(t)},0),p;if(wa[t]!==void 0)return void wa[t].push({onLoad:i,onProgress:a,onError:l});const v=t.match(/^data:(.*?)(;base64)?,(.*)$/);let _;if(v){const x=v[1],M=!!v[2];let C=v[3];C=decodeURIComponent(C),M&&(C=atob(C));try{let A;const R=(this.responseType||"").toLowerCase();switch(R){case"arraybuffer":case"blob":const O=new Uint8Array(C.length);for(let D=0;D<C.length;D++)O[D]=C.charCodeAt(D);A=R==="blob"?new Blob([O.buffer],{type:x}):O.buffer;break;case"document":A=new DOMParser().parseFromString(C,x);break;case"json":A=JSON.parse(C);break;default:A=C}setTimeout(function(){i&&i(A),d.manager.itemEnd(t)},0)}catch(A){setTimeout(function(){l&&l(A),d.manager.itemError(t),d.manager.itemEnd(t)},0)}}else{wa[t]=[],wa[t].push({onLoad:i,onProgress:a,onError:l}),_=new XMLHttpRequest,_.open("GET",t,!0),_.addEventListener("load",function(x){const M=this.response,C=wa[t];if(delete wa[t],this.status===200||this.status===0){this.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),oc.add(t,M);for(let A=0,R=C.length;A<R;A++){const O=C[A];O.onLoad&&O.onLoad(M)}d.manager.itemEnd(t)}else{for(let A=0,R=C.length;A<R;A++){const O=C[A];O.onError&&O.onError(x)}d.manager.itemError(t),d.manager.itemEnd(t)}},!1),_.addEventListener("progress",function(x){const M=wa[t];for(let C=0,A=M.length;C<A;C++){const R=M[C];R.onProgress&&R.onProgress(x)}},!1),_.addEventListener("error",function(x){const M=wa[t];delete wa[t];for(let C=0,A=M.length;C<A;C++){const R=M[C];R.onError&&R.onError(x)}d.manager.itemError(t),d.manager.itemEnd(t)},!1),_.addEventListener("abort",function(x){const M=wa[t];delete wa[t];for(let C=0,A=M.length;C<A;C++){const R=M[C];R.onError&&R.onError(x)}d.manager.itemError(t),d.manager.itemEnd(t)},!1),this.responseType!==void 0&&(_.responseType=this.responseType),this.withCredentials!==void 0&&(_.withCredentials=this.withCredentials),_.overrideMimeType&&_.overrideMimeType(this.mimeType!==void 0?this.mimeType:"text/plain");for(const x in this.requestHeader)_.setRequestHeader(x,this.requestHeader[x]);_.send(null)}return d.manager.itemStart(t),_}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class Eg extends Xo{constructor(t){super(t)}load(t,i,a,l){const d=this,p=new Sa(this.manager);p.setPath(this.path),p.setRequestHeader(this.requestHeader),p.setWithCredentials(this.withCredentials),p.load(t,function(v){try{i(d.parse(JSON.parse(v)))}catch(_){l?l(_):console.error(_),d.manager.itemError(t)}},a,l)}parse(t){const i=[];for(let a=0;a<t.length;a++){const l=cd.parse(t[a]);i.push(l)}return i}}class Um extends Xo{constructor(t){super(t)}load(t,i,a,l){const d=this,p=[],v=new Lt,_=new Sa(this.manager);_.setPath(this.path),_.setResponseType("arraybuffer"),_.setRequestHeader(this.requestHeader),_.setWithCredentials(d.withCredentials);let x=0;function M(C){_.load(t[C],function(A){const R=d.parse(A,!0);p[C]={width:R.width,height:R.height,format:R.format,mipmaps:R.mipmaps},x+=1,x===6&&(R.mipmapCount===1&&(v.minFilter=Qe),v.image=p,v.format=R.format,v.needsUpdate=!0,i&&i(v))},a,l)}if(Array.isArray(t))for(let C=0,A=t.length;C<A;++C)M(C);else _.load(t,function(C){const A=d.parse(C,!0);if(A.isCubemap){const R=A.mipmaps.length/A.mipmapCount;for(let O=0;O<R;O++){p[O]={mipmaps:[]};for(let U=0;U<A.mipmapCount;U++)p[O].mipmaps.push(A.mipmaps[O*A.mipmapCount+U]),p[O].format=A.format,p[O].width=A.width,p[O].height=A.height}v.image=p}else v.image.width=A.width,v.image.height=A.height,v.mipmaps=A.mipmaps;A.mipmapCount===1&&(v.minFilter=Qe),v.format=A.format,v.needsUpdate=!0,i&&i(v)},a,l);return v}}class cp extends Xo{constructor(t){super(t)}load(t,i,a,l){this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const d=this,p=oc.get(t);if(p!==void 0)return d.manager.itemStart(t),setTimeout(function(){i&&i(p),d.manager.itemEnd(t)},0),p;const v=document.createElementNS("http://www.w3.org/1999/xhtml","img");function _(){v.removeEventListener("load",_,!1),v.removeEventListener("error",x,!1),oc.add(t,this),i&&i(this),d.manager.itemEnd(t)}function x(M){v.removeEventListener("load",_,!1),v.removeEventListener("error",x,!1),l&&l(M),d.manager.itemError(t),d.manager.itemEnd(t)}return v.addEventListener("load",_,!1),v.addEventListener("error",x,!1),t.substr(0,5)!=="data:"&&this.crossOrigin!==void 0&&(v.crossOrigin=this.crossOrigin),d.manager.itemStart(t),v.src=t,v}}class $f extends Xo{constructor(t){super(t)}load(t,i,a,l){const d=new ql,p=new cp(this.manager);p.setCrossOrigin(this.crossOrigin),p.setPath(this.path);let v=0;function _(x){p.load(t[x],function(M){d.images[x]=M,v++,v===6&&(d.needsUpdate=!0,i&&i(d))},void 0,l)}for(let x=0;x<t.length;++x)_(x);return d}}class Gm extends Xo{constructor(t){super(t)}load(t,i,a,l){const d=this,p=new Ls,v=new Sa(this.manager);return v.setResponseType("arraybuffer"),v.setRequestHeader(this.requestHeader),v.setPath(this.path),v.setWithCredentials(d.withCredentials),v.load(t,function(_){const x=d.parse(_);x&&(x.image!==void 0?p.image=x.image:x.data!==void 0&&(p.image.width=x.width,p.image.height=x.height,p.image.data=x.data),p.wrapS=x.wrapS!==void 0?x.wrapS:St,p.wrapT=x.wrapT!==void 0?x.wrapT:St,p.magFilter=x.magFilter!==void 0?x.magFilter:Qe,p.minFilter=x.minFilter!==void 0?x.minFilter:Qe,p.anisotropy=x.anisotropy!==void 0?x.anisotropy:1,x.encoding!==void 0&&(p.encoding=x.encoding),x.flipY!==void 0&&(p.flipY=x.flipY),x.format!==void 0&&(p.format=x.format),x.type!==void 0&&(p.type=x.type),x.mipmaps!==void 0&&(p.mipmaps=x.mipmaps,p.minFilter=Yr),x.mipmapCount===1&&(p.minFilter=Qe),x.generateMipmaps!==void 0&&(p.generateMipmaps=x.generateMipmaps),p.needsUpdate=!0,i&&i(p,x))},a,l),p}}class Kf extends Xo{constructor(t){super(t)}load(t,i,a,l){const d=new ni,p=new cp(this.manager);return p.setCrossOrigin(this.crossOrigin),p.setPath(this.path),p.load(t,function(v){d.image=v;const _=t.search(/\.jpe?g($|\?)/i)>0||t.search(/^data\:image\/jpeg/)===0;d.format=_?yn:Tn,d.needsUpdate=!0,i!==void 0&&i(d)},a,l),d}}class Hm extends wn{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),i=this.curves[this.curves.length-1].getPoint(1);t.equals(i)||this.curves.push(new zu(i,t))}getPoint(t){const i=t*this.getLength(),a=this.getCurveLengths();let l=0;for(;l<a.length;){if(a[l]>=i){const d=a[l]-i,p=this.curves[l],v=p.getLength(),_=v===0?0:1-d/v;return p.getPointAt(_)}l++}return null}getLength(){const 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 t=[];let i=0;for(let a=0,l=this.curves.length;a<l;a++)i+=this.curves[a].getLength(),t.push(i);return this.cacheLengths=t,t}getSpacedPoints(t=40){const i=[];for(let a=0;a<=t;a++)i.push(this.getPoint(a/t));return this.autoClose&&i.push(i[0]),i}getPoints(t=12){const i=[];let a;for(let l=0,d=this.curves;l<d.length;l++){const p=d[l],v=p&&p.isEllipseCurve?2*t:p&&(p.isLineCurve||p.isLineCurve3)?1:p&&p.isSplineCurve?t*p.points.length:t,_=p.getPoints(v);for(let x=0;x<_.length;x++){const M=_[x];a&&a.equals(M)||(i.push(M),a=M)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}copy(t){super.copy(t),this.curves=[];for(let i=0,a=t.curves.length;i<a;i++){const l=t.curves[i];this.curves.push(l.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let i=0,a=this.curves.length;i<a;i++){const l=this.curves[i];t.curves.push(l.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let i=0,a=t.curves.length;i<a;i++){const l=t.curves[i];this.curves.push(new tl[l.type]().fromJSON(l))}return this}}class ac extends Hm{constructor(t){super(),this.type="Path",this.currentPoint=new He,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let i=1,a=t.length;i<a;i++)this.lineTo(t[i].x,t[i].y);return this}moveTo(t,i){return this.currentPoint.set(t,i),this}lineTo(t,i){const a=new zu(this.currentPoint.clone(),new He(t,i));return this.curves.push(a),this.currentPoint.set(t,i),this}quadraticCurveTo(t,i,a,l){const d=new su(this.currentPoint.clone(),new He(t,i),new He(a,l));return this.curves.push(d),this.currentPoint.set(a,l),this}bezierCurveTo(t,i,a,l,d,p){const v=new ya(this.currentPoint.clone(),new He(t,i),new He(a,l),new He(d,p));return this.curves.push(v),this.currentPoint.set(d,p),this}splineThru(t){const i=[this.currentPoint.clone()].concat(t),a=new au(i);return this.curves.push(a),this.currentPoint.copy(t[t.length-1]),this}arc(t,i,a,l,d,p){const v=this.currentPoint.x,_=this.currentPoint.y;return this.absarc(t+v,i+_,a,l,d,p),this}absarc(t,i,a,l,d,p){return this.absellipse(t,i,a,a,l,d,p),this}ellipse(t,i,a,l,d,p,v,_){const x=this.currentPoint.x,M=this.currentPoint.y;return this.absellipse(t+x,i+M,a,l,d,p,v,_),this}absellipse(t,i,a,l,d,p,v,_){const x=new lr(t,i,a,l,d,p,v,_);if(this.curves.length>0){const C=x.getPoint(0);C.equals(this.currentPoint)||this.lineTo(C.x,C.y)}this.curves.push(x);const M=x.getPoint(1);return this.currentPoint.copy(M),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 Yu extends ac{constructor(t){super(t),this.uuid=Fo(),this.type="Shape",this.holes=[]}getPointsHoles(t){const i=[];for(let a=0,l=this.holes.length;a<l;a++)i[a]=this.holes[a].getPoints(t);return i}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let i=0,a=t.holes.length;i<a;i++){const l=t.holes[i];this.holes.push(l.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let i=0,a=this.holes.length;i<a;i++){const l=this.holes[i];t.holes.push(l.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let i=0,a=t.holes.length;i<a;i++){const l=t.holes[i];this.holes.push(new ac().fromJSON(l))}return this}}class Ta extends ar{constructor(t,i=1){super(),this.type="Light",this.color=new pn(t),this.intensity=i}dispose(){}copy(t){return super.copy(t),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const i=super.toJSON(t);return i.object.color=this.color.getHex(),i.object.intensity=this.intensity,this.groundColor!==void 0&&(i.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(i.object.distance=this.distance),this.angle!==void 0&&(i.object.angle=this.angle),this.decay!==void 0&&(i.object.decay=this.decay),this.penumbra!==void 0&&(i.object.penumbra=this.penumbra),this.shadow!==void 0&&(i.object.shadow=this.shadow.toJSON()),i}}Ta.prototype.isLight=!0;class hf extends Ta{constructor(t,i,a){super(t,a),this.type="HemisphereLight",this.position.copy(ar.DefaultUp),this.updateMatrix(),this.groundColor=new pn(i)}copy(t){return Ta.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}hf.prototype.isHemisphereLight=!0;const cf=new En,df=new gt,Qf=new gt;class tm{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.mapSize=new He(512,512),this.map=null,this.mapPass=null,this.matrix=new En,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Xa,this._frameExtents=new He(1,1),this._viewportCount=1,this._viewports=[new Ir(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const i=this.camera,a=this.matrix;df.setFromMatrixPosition(t.matrixWorld),i.position.copy(df),Qf.setFromMatrixPosition(t.target.matrixWorld),i.lookAt(Qf),i.updateMatrixWorld(),cf.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(cf),a.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),a.multiply(i.projectionMatrix),a.multiply(i.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 this.bias!==0&&(t.bias=this.bias),this.normalBias!==0&&(t.normalBias=this.normalBias),this.radius!==1&&(t.radius=this.radius),this.mapSize.x===512&&this.mapSize.y===512||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class zm extends tm{constructor(){super(new Yi(50,1,.5,500)),this.focus=1}updateMatrices(t){const i=this.camera,a=2*ia*t.angle*this.focus,l=this.mapSize.width/this.mapSize.height,d=t.distance||i.far;a===i.fov&&l===i.aspect&&d===i.far||(i.fov=a,i.aspect=l,i.far=d,i.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}zm.prototype.isSpotLightShadow=!0;class dd extends Ta{constructor(t,i,a=0,l=Math.PI/3,d=0,p=1){super(t,i),this.type="SpotLight",this.position.copy(ar.DefaultUp),this.updateMatrix(),this.target=new ar,this.distance=a,this.angle=l,this.penumbra=d,this.decay=p,this.shadow=new zm}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}}dd.prototype.isSpotLight=!0;const em=new En,Zu=new gt,nm=new gt;class jm extends tm{constructor(){super(new Yi(90,1,.5,500)),this._frameExtents=new He(4,2),this._viewportCount=6,this._viewports=[new Ir(2,1,1,1),new Ir(0,1,1,1),new Ir(3,1,1,1),new Ir(1,1,1,1),new Ir(3,0,1,1),new Ir(1,0,1,1)],this._cubeDirections=[new gt(1,0,0),new gt(-1,0,0),new gt(0,0,1),new gt(0,0,-1),new gt(0,1,0),new gt(0,-1,0)],this._cubeUps=[new gt(0,1,0),new gt(0,1,0),new gt(0,1,0),new gt(0,1,0),new gt(0,0,1),new gt(0,0,-1)]}updateMatrices(t,i=0){const a=this.camera,l=this.matrix,d=t.distance||a.far;d!==a.far&&(a.far=d,a.updateProjectionMatrix()),Zu.setFromMatrixPosition(t.matrixWorld),a.position.copy(Zu),nm.copy(a.position),nm.add(this._cubeDirections[i]),a.up.copy(this._cubeUps[i]),a.lookAt(nm),a.updateMatrixWorld(),l.makeTranslation(-Zu.x,-Zu.y,-Zu.z),em.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),this._frustum.setFromProjectionMatrix(em)}}jm.prototype.isPointLightShadow=!0;class rm extends Ta{constructor(t,i,a=0,l=1){super(t,i),this.type="PointLight",this.distance=a,this.decay=l,this.shadow=new jm}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}}rm.prototype.isPointLight=!0;class dp extends Xl{constructor(t=-1,i=1,a=1,l=-1,d=.1,p=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=i,this.top=a,this.bottom=l,this.near=d,this.far=p,this.updateProjectionMatrix()}copy(t,i){return super.copy(t,i),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=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,i,a,l,d,p){this.view===null&&(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=i,this.view.offsetX=a,this.view.offsetY=l,this.view.width=d,this.view.height=p,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),i=(this.top-this.bottom)/(2*this.zoom),a=(this.right+this.left)/2,l=(this.top+this.bottom)/2;let d=a-t,p=a+t,v=l+i,_=l-i;if(this.view!==null&&this.view.enabled){const x=(this.right-this.left)/this.view.fullWidth/this.zoom,M=(this.top-this.bottom)/this.view.fullHeight/this.zoom;d+=x*this.view.offsetX,p=d+x*this.view.width,v-=M*this.view.offsetY,_=v-M*this.view.height}this.projectionMatrix.makeOrthographic(d,p,v,_,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const i=super.toJSON(t);return i.object.zoom=this.zoom,i.object.left=this.left,i.object.right=this.right,i.object.top=this.top,i.object.bottom=this.bottom,i.object.near=this.near,i.object.far=this.far,this.view!==null&&(i.object.view=Object.assign({},this.view)),i}}dp.prototype.isOrthographicCamera=!0;class Vm extends tm{constructor(){super(new dp(-5,5,5,-5,.5,500))}}Vm.prototype.isDirectionalLightShadow=!0;class Ju extends Ta{constructor(t,i){super(t,i),this.type="DirectionalLight",this.position.copy(ar.DefaultUp),this.updateMatrix(),this.target=new ar,this.shadow=new Vm}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}Ju.prototype.isDirectionalLight=!0;class pf extends Ta{constructor(t,i){super(t,i),this.type="AmbientLight"}}pf.prototype.isAmbientLight=!0;class lc extends Ta{constructor(t,i,a=10,l=10){super(t,i),this.type="RectAreaLight",this.width=a,this.height=l}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const i=super.toJSON(t);return i.object.width=this.width,i.object.height=this.height,i}}lc.prototype.isRectAreaLight=!0;class Re{constructor(){this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new gt)}set(t){for(let i=0;i<9;i++)this.coefficients[i].copy(t[i]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,i){const a=t.x,l=t.y,d=t.z,p=this.coefficients;return i.copy(p[0]).multiplyScalar(.282095),i.addScaledVector(p[1],.488603*l),i.addScaledVector(p[2],.488603*d),i.addScaledVector(p[3],.488603*a),i.addScaledVector(p[4],a*l*1.092548),i.addScaledVector(p[5],l*d*1.092548),i.addScaledVector(p[6],.315392*(3*d*d-1)),i.addScaledVector(p[7],a*d*1.092548),i.addScaledVector(p[8],.546274*(a*a-l*l)),i}getIrradianceAt(t,i){const a=t.x,l=t.y,d=t.z,p=this.coefficients;return i.copy(p[0]).multiplyScalar(.886227),i.addScaledVector(p[1],1.023328*l),i.addScaledVector(p[2],1.023328*d),i.addScaledVector(p[3],1.023328*a),i.addScaledVector(p[4],.858086*a*l),i.addScaledVector(p[5],.858086*l*d),i.addScaledVector(p[6],.743125*d*d-.247708),i.addScaledVector(p[7],.858086*a*d),i.addScaledVector(p[8],.429043*(a*a-l*l)),i}add(t){for(let i=0;i<9;i++)this.coefficients[i].add(t.coefficients[i]);return this}addScaledSH(t,i){for(let a=0;a<9;a++)this.coefficients[a].addScaledVector(t.coefficients[a],i);return this}scale(t){for(let i=0;i<9;i++)this.coefficients[i].multiplyScalar(t);return this}lerp(t,i){for(let a=0;a<9;a++)this.coefficients[a].lerp(t.coefficients[a],i);return this}equals(t){for(let i=0;i<9;i++)if(!this.coefficients[i].equals(t.coefficients[i]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(t,i=0){const a=this.coefficients;for(let l=0;l<9;l++)a[l].fromArray(t,i+3*l);return this}toArray(t=[],i=0){const a=this.coefficients;for(let l=0;l<9;l++)a[l].toArray(t,i+3*l);return t}static getBasisAt(t,i){const a=t.x,l=t.y,d=t.z;i[0]=.282095,i[1]=.488603*l,i[2]=.488603*d,i[3]=.488603*a,i[4]=1.092548*a*l,i[5]=1.092548*l*d,i[6]=.315392*(3*d*d-1),i[7]=1.092548*a*d,i[8]=.546274*(a*a-l*l)}}Re.prototype.isSphericalHarmonics3=!0;class pp extends Ta{constructor(t=new Re,i=1){super(void 0,i),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 i=super.toJSON(t);return i.object.sh=this.sh.toArray(),i}}pp.prototype.isLightProbe=!0;class pd extends Xo{constructor(t){super(t),this.textures={}}load(t,i,a,l){const d=this,p=new Sa(d.manager);p.setPath(d.path),p.setRequestHeader(d.requestHeader),p.setWithCredentials(d.withCredentials),p.load(t,function(v){try{i(d.parse(JSON.parse(v)))}catch(_){l?l(_):console.error(_),d.manager.itemError(t)}},a,l)}parse(t){const i=this.textures;function a(d){return i[d]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",d),i[d]}const l=new Pn[t.type];if(t.uuid!==void 0&&(l.uuid=t.uuid),t.name!==void 0&&(l.name=t.name),t.color!==void 0&&l.color!==void 0&&l.color.setHex(t.color),t.roughness!==void 0&&(l.roughness=t.roughness),t.metalness!==void 0&&(l.metalness=t.metalness),t.sheen!==void 0&&(l.sheen=new pn().setHex(t.sheen)),t.emissive!==void 0&&l.emissive!==void 0&&l.emissive.setHex(t.emissive),t.specular!==void 0&&l.specular!==void 0&&l.specular.setHex(t.specular),t.shininess!==void 0&&(l.shininess=t.shininess),t.clearcoat!==void 0&&(l.clearcoat=t.clearcoat),t.clearcoatRoughness!==void 0&&(l.clearcoatRoughness=t.clearcoatRoughness),t.transmission!==void 0&&(l.transmission=t.transmission),t.thickness!==void 0&&(l.thickness=t.thickness),t.attenuationDistance!==void 0&&(l.attenuationDistance=t.attenuationDistance),t.attenuationColor!==void 0&&l.attenuationColor!==void 0&&l.attenuationColor.setHex(t.attenuationColor),t.fog!==void 0&&(l.fog=t.fog),t.flatShading!==void 0&&(l.flatShading=t.flatShading),t.blending!==void 0&&(l.blending=t.blending),t.combine!==void 0&&(l.combine=t.combine),t.side!==void 0&&(l.side=t.side),t.shadowSide!==void 0&&(l.shadowSide=t.shadowSide),t.opacity!==void 0&&(l.opacity=t.opacity),t.transparent!==void 0&&(l.transparent=t.transparent),t.alphaTest!==void 0&&(l.alphaTest=t.alphaTest),t.depthTest!==void 0&&(l.depthTest=t.depthTest),t.depthWrite!==void 0&&(l.depthWrite=t.depthWrite),t.colorWrite!==void 0&&(l.colorWrite=t.colorWrite),t.stencilWrite!==void 0&&(l.stencilWrite=t.stencilWrite),t.stencilWriteMask!==void 0&&(l.stencilWriteMask=t.stencilWriteMask),t.stencilFunc!==void 0&&(l.stencilFunc=t.stencilFunc),t.stencilRef!==void 0&&(l.stencilRef=t.stencilRef),t.stencilFuncMask!==void 0&&(l.stencilFuncMask=t.stencilFuncMask),t.stencilFail!==void 0&&(l.stencilFail=t.stencilFail),t.stencilZFail!==void 0&&(l.stencilZFail=t.stencilZFail),t.stencilZPass!==void 0&&(l.stencilZPass=t.stencilZPass),t.wireframe!==void 0&&(l.wireframe=t.wireframe),t.wireframeLinewidth!==void 0&&(l.wireframeLinewidth=t.wireframeLinewidth),t.wireframeLinecap!==void 0&&(l.wireframeLinecap=t.wireframeLinecap),t.wireframeLinejoin!==void 0&&(l.wireframeLinejoin=t.wireframeLinejoin),t.rotation!==void 0&&(l.rotation=t.rotation),t.linewidth!==1&&(l.linewidth=t.linewidth),t.dashSize!==void 0&&(l.dashSize=t.dashSize),t.gapSize!==void 0&&(l.gapSize=t.gapSize),t.scale!==void 0&&(l.scale=t.scale),t.polygonOffset!==void 0&&(l.polygonOffset=t.polygonOffset),t.polygonOffsetFactor!==void 0&&(l.polygonOffsetFactor=t.polygonOffsetFactor),t.polygonOffsetUnits!==void 0&&(l.polygonOffsetUnits=t.polygonOffsetUnits),t.morphTargets!==void 0&&(l.morphTargets=t.morphTargets),t.morphNormals!==void 0&&(l.morphNormals=t.morphNormals),t.dithering!==void 0&&(l.dithering=t.dithering),t.alphaToCoverage!==void 0&&(l.alphaToCoverage=t.alphaToCoverage),t.premultipliedAlpha!==void 0&&(l.premultipliedAlpha=t.premultipliedAlpha),t.vertexTangents!==void 0&&(l.vertexTangents=t.vertexTangents),t.visible!==void 0&&(l.visible=t.visible),t.toneMapped!==void 0&&(l.toneMapped=t.toneMapped),t.userData!==void 0&&(l.userData=t.userData),t.vertexColors!==void 0&&(typeof t.vertexColors=="number"?l.vertexColors=t.vertexColors>0:l.vertexColors=t.vertexColors),t.uniforms!==void 0)for(const d in t.uniforms){const p=t.uniforms[d];switch(l.uniforms[d]={},p.type){case"t":l.uniforms[d].value=a(p.value);break;case"c":l.uniforms[d].value=new pn().setHex(p.value);break;case"v2":l.uniforms[d].value=new He().fromArray(p.value);break;case"v3":l.uniforms[d].value=new gt().fromArray(p.value);break;case"v4":l.uniforms[d].value=new Ir().fromArray(p.value);break;case"m3":l.uniforms[d].value=new ji().fromArray(p.value);break;case"m4":l.uniforms[d].value=new En().fromArray(p.value);break;default:l.uniforms[d].value=p.value}}if(t.defines!==void 0&&(l.defines=t.defines),t.vertexShader!==void 0&&(l.vertexShader=t.vertexShader),t.fragmentShader!==void 0&&(l.fragmentShader=t.fragmentShader),t.extensions!==void 0)for(const d in t.extensions)l.extensions[d]=t.extensions[d];if(t.shading!==void 0&&(l.flatShading=t.shading===1),t.size!==void 0&&(l.size=t.size),t.sizeAttenuation!==void 0&&(l.sizeAttenuation=t.sizeAttenuation),t.map!==void 0&&(l.map=a(t.map)),t.matcap!==void 0&&(l.matcap=a(t.matcap)),t.alphaMap!==void 0&&(l.alphaMap=a(t.alphaMap)),t.bumpMap!==void 0&&(l.bumpMap=a(t.bumpMap)),t.bumpScale!==void 0&&(l.bumpScale=t.bumpScale),t.normalMap!==void 0&&(l.normalMap=a(t.normalMap)),t.normalMapType!==void 0&&(l.normalMapType=t.normalMapType),t.normalScale!==void 0){let d=t.normalScale;Array.isArray(d)===!1&&(d=[d,d]),l.normalScale=new He().fromArray(d)}return t.displacementMap!==void 0&&(l.displacementMap=a(t.displacementMap)),t.displacementScale!==void 0&&(l.displacementScale=t.displacementScale),t.displacementBias!==void 0&&(l.displacementBias=t.displacementBias),t.roughnessMap!==void 0&&(l.roughnessMap=a(t.roughnessMap)),t.metalnessMap!==void 0&&(l.metalnessMap=a(t.metalnessMap)),t.emissiveMap!==void 0&&(l.emissiveMap=a(t.emissiveMap)),t.emissiveIntensity!==void 0&&(l.emissiveIntensity=t.emissiveIntensity),t.specularMap!==void 0&&(l.specularMap=a(t.specularMap)),t.envMap!==void 0&&(l.envMap=a(t.envMap)),t.envMapIntensity!==void 0&&(l.envMapIntensity=t.envMapIntensity),t.reflectivity!==void 0&&(l.reflectivity=t.reflectivity),t.refractionRatio!==void 0&&(l.refractionRatio=t.refractionRatio),t.lightMap!==void 0&&(l.lightMap=a(t.lightMap)),t.lightMapIntensity!==void 0&&(l.lightMapIntensity=t.lightMapIntensity),t.aoMap!==void 0&&(l.aoMap=a(t.aoMap)),t.aoMapIntensity!==void 0&&(l.aoMapIntensity=t.aoMapIntensity),t.gradientMap!==void 0&&(l.gradientMap=a(t.gradientMap)),t.clearcoatMap!==void 0&&(l.clearcoatMap=a(t.clearcoatMap)),t.clearcoatRoughnessMap!==void 0&&(l.clearcoatRoughnessMap=a(t.clearcoatRoughnessMap)),t.clearcoatNormalMap!==void 0&&(l.clearcoatNormalMap=a(t.clearcoatNormalMap)),t.clearcoatNormalScale!==void 0&&(l.clearcoatNormalScale=new He().fromArray(t.clearcoatNormalScale)),t.transmissionMap!==void 0&&(l.transmissionMap=a(t.transmissionMap)),t.thicknessMap!==void 0&&(l.thicknessMap=a(t.thicknessMap)),l}setTextures(t){return this.textures=t,this}}class uc{static decodeText(t){if(typeof TextDecoder!="undefined")return new TextDecoder().decode(t);let i="";for(let a=0,l=t.length;a<l;a++)i+=String.fromCharCode(t[a]);try{return decodeURIComponent(escape(i))}catch{return i}}static extractUrlBase(t){const i=t.lastIndexOf("/");return i===-1?"./":t.substr(0,i+1)}}class fp extends zn{constructor(){super(),this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}clone(){return new this.constructor().copy(this)}toJSON(){const t=super.toJSON(this);return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}fp.prototype.isInstancedBufferGeometry=!0;class ff extends Kn{constructor(t,i,a,l=1){typeof a=="number"&&(l=a,a=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(t,i,a),this.meshPerAttribute=l}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}}ff.prototype.isInstancedBufferAttribute=!0;class mp extends Xo{constructor(t){super(t)}load(t,i,a,l){const d=this,p=new Sa(d.manager);p.setPath(d.path),p.setRequestHeader(d.requestHeader),p.setWithCredentials(d.withCredentials),p.load(t,function(v){try{i(d.parse(JSON.parse(v)))}catch(_){l?l(_):console.error(_),d.manager.itemError(t)}},a,l)}parse(t){const i={},a={};function l(C,A){if(i[A]!==void 0)return i[A];const R=C.interleavedBuffers[A],O=function(Z,ot){if(a[ot]!==void 0)return a[ot];const vt=Z.arrayBuffers[ot],mt=new Uint32Array(vt).buffer;return a[ot]=mt,mt}(C,R.buffer),U=Si(R.type,O),D=new wl(U,R.stride);return D.uuid=R.uuid,i[A]=D,D}const d=t.isInstancedBufferGeometry?new fp:new zn,p=t.data.index;if(p!==void 0){const C=Si(p.type,p.array);d.setIndex(new Kn(C,1))}const v=t.data.attributes;for(const C in v){const A=v[C];let R;if(A.isInterleavedBufferAttribute){const O=l(t.data,A.data);R=new ri(O,A.itemSize,A.offset,A.normalized)}else{const O=Si(A.type,A.array);R=new(A.isInstancedBufferAttribute?ff:Kn)(O,A.itemSize,A.normalized)}A.name!==void 0&&(R.name=A.name),A.usage!==void 0&&R.setUsage(A.usage),A.updateRange!==void 0&&(R.updateRange.offset=A.updateRange.offset,R.updateRange.count=A.updateRange.count),d.setAttribute(C,R)}const _=t.data.morphAttributes;if(_)for(const C in _){const A=_[C],R=[];for(let O=0,U=A.length;O<U;O++){const D=A[O];let Z;if(D.isInterleavedBufferAttribute){const ot=l(t.data,D.data);Z=new ri(ot,D.itemSize,D.offset,D.normalized)}else{const ot=Si(D.type,D.array);Z=new Kn(ot,D.itemSize,D.normalized)}D.name!==void 0&&(Z.name=D.name),R.push(Z)}d.morphAttributes[C]=R}t.data.morphTargetsRelative&&(d.morphTargetsRelative=!0);const x=t.data.groups||t.data.drawcalls||t.data.offsets;if(x!==void 0)for(let C=0,A=x.length;C!==A;++C){const R=x[C];d.addGroup(R.start,R.count,R.materialIndex)}const M=t.data.boundingSphere;if(M!==void 0){const C=new gt;M.center!==void 0&&C.fromArray(M.center),d.boundingSphere=new ws(C,M.radius)}return t.name&&(d.name=t.name),t.userData&&(d.userData=t.userData),d}}class Mg extends Xo{constructor(t){super(t)}load(t,i,a,l){const d=this,p=this.path===""?uc.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||p;const v=new Sa(this.manager);v.setPath(this.path),v.setRequestHeader(this.requestHeader),v.setWithCredentials(this.withCredentials),v.load(t,function(_){let x=null;try{x=JSON.parse(_)}catch(C){return l!==void 0&&l(C),void console.error("THREE:ObjectLoader: Can't parse "+t+".",C.message)}const M=x.metadata;M!==void 0&&M.type!==void 0&&M.type.toLowerCase()!=="geometry"?d.parse(x,i):console.error("THREE.ObjectLoader: Can't load "+t)},a,l)}async loadAsync(t,i){const a=this.path===""?uc.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||a;const l=new Sa(this.manager);l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials);const d=await l.loadAsync(t,i),p=JSON.parse(d),v=p.metadata;if(v===void 0||v.type===void 0||v.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+t);return await this.parseAsync(p)}parse(t,i){const a=this.parseAnimations(t.animations),l=this.parseShapes(t.shapes),d=this.parseGeometries(t.geometries,l),p=this.parseImages(t.images,function(){i!==void 0&&i(x)}),v=this.parseTextures(t.textures,p),_=this.parseMaterials(t.materials,v),x=this.parseObject(t.object,d,_,v,a),M=this.parseSkeletons(t.skeletons,x);if(this.bindSkeletons(x,M),i!==void 0){let C=!1;for(const A in p)if(p[A]instanceof HTMLImageElement){C=!0;break}C===!1&&i(x)}return x}async parseAsync(t){const i=this.parseAnimations(t.animations),a=this.parseShapes(t.shapes),l=this.parseGeometries(t.geometries,a),d=await this.parseImagesAsync(t.images),p=this.parseTextures(t.textures,d),v=this.parseMaterials(t.materials,p),_=this.parseObject(t.object,l,v,p,i),x=this.parseSkeletons(t.skeletons,_);return this.bindSkeletons(_,x),_}parseShapes(t){const i={};if(t!==void 0)for(let a=0,l=t.length;a<l;a++){const d=new Yu().fromJSON(t[a]);i[d.uuid]=d}return i}parseSkeletons(t,i){const a={},l={};if(i.traverse(function(d){d.isBone&&(l[d.uuid]=d)}),t!==void 0)for(let d=0,p=t.length;d<p;d++){const v=new Hu().fromJSON(t[d],l);a[v.uuid]=v}return a}parseGeometries(t,i){const a={};if(t!==void 0){const l=new mp;for(let d=0,p=t.length;d<p;d++){let v;const _=t[d];switch(_.type){case"BufferGeometry":case"InstancedBufferGeometry":v=l.parse(_);break;case"Geometry":console.error("THREE.ObjectLoader: The legacy Geometry type is no longer supported.");break;default:_.type in km?v=km[_.type].fromJSON(_,i):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${_.type}"`)}v.uuid=_.uuid,_.name!==void 0&&(v.name=_.name),v.isBufferGeometry===!0&&_.userData!==void 0&&(v.userData=_.userData),a[_.uuid]=v}}return a}parseMaterials(t,i){const a={},l={};if(t!==void 0){const d=new pd;d.setTextures(i);for(let p=0,v=t.length;p<v;p++){const _=t[p];if(_.type==="MultiMaterial"){const x=[];for(let M=0;M<_.materials.length;M++){const C=_.materials[M];a[C.uuid]===void 0&&(a[C.uuid]=d.parse(C)),x.push(a[C.uuid])}l[_.uuid]=x}else a[_.uuid]===void 0&&(a[_.uuid]=d.parse(_)),l[_.uuid]=a[_.uuid]}}return l}parseAnimations(t){const i={};if(t!==void 0)for(let a=0;a<t.length;a++){const l=t[a],d=cd.parse(l);i[d.uuid]=d}return i}parseImages(t,i){const a=this,l={};let d;function p(v){if(typeof v=="string"){const _=v;return function(x){return a.manager.itemStart(x),d.load(x,function(){a.manager.itemEnd(x)},void 0,function(){a.manager.itemError(x),a.manager.itemEnd(x)})}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(_)?_:a.resourcePath+_)}return v.data?{data:Si(v.type,v.data),width:v.width,height:v.height}:null}if(t!==void 0&&t.length>0){const v=new ba(i);d=new cp(v),d.setCrossOrigin(this.crossOrigin);for(let _=0,x=t.length;_<x;_++){const M=t[_],C=M.url;if(Array.isArray(C)){l[M.uuid]=[];for(let A=0,R=C.length;A<R;A++){const O=p(C[A]);O!==null&&(O instanceof HTMLImageElement?l[M.uuid].push(O):l[M.uuid].push(new Ls(O.data,O.width,O.height)))}}else{const A=p(M.url);A!==null&&(l[M.uuid]=A)}}}return l}async parseImagesAsync(t){const i=this,a={};let l;async function d(p){if(typeof p=="string"){const v=p,_=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(v)?v:i.resourcePath+v;return await l.loadAsync(_)}return p.data?{data:Si(p.type,p.data),width:p.width,height:p.height}:null}if(t!==void 0&&t.length>0){l=new cp(this.manager),l.setCrossOrigin(this.crossOrigin);for(let p=0,v=t.length;p<v;p++){const _=t[p],x=_.url;if(Array.isArray(x)){a[_.uuid]=[];for(let M=0,C=x.length;M<C;M++){const A=x[M],R=await d(A);R!==null&&(R instanceof HTMLImageElement?a[_.uuid].push(R):a[_.uuid].push(new Ls(R.data,R.width,R.height)))}}else{const M=await d(_.url);M!==null&&(a[_.uuid]=M)}}}return a}parseTextures(t,i){function a(d,p){return typeof d=="number"?d:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",d),p[d])}const l={};if(t!==void 0)for(let d=0,p=t.length;d<p;d++){const v=t[d];let _;v.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',v.uuid),i[v.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",v.image);const x=i[v.image];Array.isArray(x)?(_=new ql(x),x.length===6&&(_.needsUpdate=!0)):(_=x&&x.data?new Ls(x.data,x.width,x.height):new ni(x),x&&(_.needsUpdate=!0)),_.uuid=v.uuid,v.name!==void 0&&(_.name=v.name),v.mapping!==void 0&&(_.mapping=a(v.mapping,rl)),v.offset!==void 0&&_.offset.fromArray(v.offset),v.repeat!==void 0&&_.repeat.fromArray(v.repeat),v.center!==void 0&&_.center.fromArray(v.center),v.rotation!==void 0&&(_.rotation=v.rotation),v.wrap!==void 0&&(_.wrapS=a(v.wrap[0],Ea),_.wrapT=a(v.wrap[1],Ea)),v.format!==void 0&&(_.format=v.format),v.type!==void 0&&(_.type=v.type),v.encoding!==void 0&&(_.encoding=v.encoding),v.minFilter!==void 0&&(_.minFilter=a(v.minFilter,lu)),v.magFilter!==void 0&&(_.magFilter=a(v.magFilter,lu)),v.anisotropy!==void 0&&(_.anisotropy=v.anisotropy),v.flipY!==void 0&&(_.flipY=v.flipY),v.premultiplyAlpha!==void 0&&(_.premultiplyAlpha=v.premultiplyAlpha),v.unpackAlignment!==void 0&&(_.unpackAlignment=v.unpackAlignment),l[v.uuid]=_}return l}parseObject(t,i,a,l,d){let p,v,_;function x(A){return i[A]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",A),i[A]}function M(A){if(A!==void 0){if(Array.isArray(A)){const R=[];for(let O=0,U=A.length;O<U;O++){const D=A[O];a[D]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",D),R.push(a[D])}return R}return a[A]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",A),a[A]}}function C(A){return l[A]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",A),l[A]}switch(t.type){case"Scene":p=new Gh,t.background!==void 0&&(Number.isInteger(t.background)?p.background=new pn(t.background):p.background=C(t.background)),t.environment!==void 0&&(p.environment=C(t.environment)),t.fog!==void 0&&(t.fog.type==="Fog"?p.fog=new ru(t.fog.color,t.fog.near,t.fog.far):t.fog.type==="FogExp2"&&(p.fog=new nu(t.fog.color,t.fog.density)));break;case"PerspectiveCamera":p=new Yi(t.fov,t.aspect,t.near,t.far),t.focus!==void 0&&(p.focus=t.focus),t.zoom!==void 0&&(p.zoom=t.zoom),t.filmGauge!==void 0&&(p.filmGauge=t.filmGauge),t.filmOffset!==void 0&&(p.filmOffset=t.filmOffset),t.view!==void 0&&(p.view=Object.assign({},t.view));break;case"OrthographicCamera":p=new dp(t.left,t.right,t.top,t.bottom,t.near,t.far),t.zoom!==void 0&&(p.zoom=t.zoom),t.view!==void 0&&(p.view=Object.assign({},t.view));break;case"AmbientLight":p=new pf(t.color,t.intensity);break;case"DirectionalLight":p=new Ju(t.color,t.intensity);break;case"PointLight":p=new rm(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":p=new lc(t.color,t.intensity,t.width,t.height);break;case"SpotLight":p=new dd(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":p=new hf(t.color,t.groundColor,t.intensity);break;case"LightProbe":p=new pp().fromJSON(t);break;case"SkinnedMesh":v=x(t.geometry),_=M(t.material),p=new Yc(v,_),t.bindMode!==void 0&&(p.bindMode=t.bindMode),t.bindMatrix!==void 0&&p.bindMatrix.fromArray(t.bindMatrix),t.skeleton!==void 0&&(p.skeleton=t.skeleton);break;case"Mesh":v=x(t.geometry),_=M(t.material),p=new Bi(v,_);break;case"InstancedMesh":v=x(t.geometry),_=M(t.material);const A=t.count,R=t.instanceMatrix,O=t.instanceColor;p=new Kc(v,_,A),p.instanceMatrix=new Kn(new Float32Array(R.array),16),O!==void 0&&(p.instanceColor=new Kn(new Float32Array(O.array),O.itemSize));break;case"LOD":p=new Vh;break;case"Line":p=new $a(x(t.geometry),M(t.material));break;case"LineLoop":p=new ou(x(t.geometry),M(t.material));break;case"LineSegments":p=new io(x(t.geometry),M(t.material));break;case"PointCloud":case"Points":p=new q(x(t.geometry),M(t.material));break;case"Sprite":p=new Uu(M(t.material));break;case"Group":p=new bl;break;case"Bone":p=new no;break;default:p=new ar}if(p.uuid=t.uuid,t.name!==void 0&&(p.name=t.name),t.matrix!==void 0?(p.matrix.fromArray(t.matrix),t.matrixAutoUpdate!==void 0&&(p.matrixAutoUpdate=t.matrixAutoUpdate),p.matrixAutoUpdate&&p.matrix.decompose(p.position,p.quaternion,p.scale)):(t.position!==void 0&&p.position.fromArray(t.position),t.rotation!==void 0&&p.rotation.fromArray(t.rotation),t.quaternion!==void 0&&p.quaternion.fromArray(t.quaternion),t.scale!==void 0&&p.scale.fromArray(t.scale)),t.castShadow!==void 0&&(p.castShadow=t.castShadow),t.receiveShadow!==void 0&&(p.receiveShadow=t.receiveShadow),t.shadow&&(t.shadow.bias!==void 0&&(p.shadow.bias=t.shadow.bias),t.shadow.normalBias!==void 0&&(p.shadow.normalBias=t.shadow.normalBias),t.shadow.radius!==void 0&&(p.shadow.radius=t.shadow.radius),t.shadow.mapSize!==void 0&&p.shadow.mapSize.fromArray(t.shadow.mapSize),t.shadow.camera!==void 0&&(p.shadow.camera=this.parseObject(t.shadow.camera))),t.visible!==void 0&&(p.visible=t.visible),t.frustumCulled!==void 0&&(p.frustumCulled=t.frustumCulled),t.renderOrder!==void 0&&(p.renderOrder=t.renderOrder),t.userData!==void 0&&(p.userData=t.userData),t.layers!==void 0&&(p.layers.mask=t.layers),t.children!==void 0){const A=t.children;for(let R=0;R<A.length;R++)p.add(this.parseObject(A[R],i,a,l,d))}if(t.animations!==void 0){const A=t.animations;for(let R=0;R<A.length;R++){const O=A[R];p.animations.push(d[O])}}if(t.type==="LOD"){t.autoUpdate!==void 0&&(p.autoUpdate=t.autoUpdate);const A=t.levels;for(let R=0;R<A.length;R++){const O=A[R],U=p.getObjectByProperty("uuid",O.object);U!==void 0&&p.addLevel(U,O.distance)}}return p}bindSkeletons(t,i){Object.keys(i).length!==0&&t.traverse(function(a){if(a.isSkinnedMesh===!0&&a.skeleton!==void 0){const l=i[a.skeleton];l===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",a.skeleton):a.bind(l,a.bindMatrix)}})}setTexturePath(t){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(t)}}const rl={UVMapping:lo,CubeReflectionMapping:I,CubeRefractionMapping:z,EquirectangularReflectionMapping:H,EquirectangularRefractionMapping:at,CubeUVReflectionMapping:nt,CubeUVRefractionMapping:it},Ea={RepeatWrapping:yt,ClampToEdgeWrapping:St,MirroredRepeatWrapping:Ct},lu={NearestFilter:wt,NearestMipmapNearestFilter:Vt,NearestMipmapLinearFilter:Le,LinearFilter:Qe,LinearMipmapNearestFilter:Qn,LinearMipmapLinearFilter:Yr};class uu extends Xo{constructor(t){super(t),typeof createImageBitmap=="undefined"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch=="undefined"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,i,a,l){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const d=this,p=oc.get(t);if(p!==void 0)return d.manager.itemStart(t),setTimeout(function(){i&&i(p),d.manager.itemEnd(t)},0),p;const v={};v.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",v.headers=this.requestHeader,fetch(t,v).then(function(_){return _.blob()}).then(function(_){return createImageBitmap(_,Object.assign(d.options,{colorSpaceConversion:"none"}))}).then(function(_){oc.add(t,_),i&&i(_),d.manager.itemEnd(t)}).catch(function(_){l&&l(_),d.manager.itemError(t),d.manager.itemEnd(t)}),d.manager.itemStart(t)}}uu.prototype.isImageBitmapLoader=!0;class hu{constructor(){this.type="ShapePath",this.color=new pn,this.subPaths=[],this.currentPath=null}moveTo(t,i){return this.currentPath=new ac,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,i),this}lineTo(t,i){return this.currentPath.lineTo(t,i),this}quadraticCurveTo(t,i,a,l){return this.currentPath.quadraticCurveTo(t,i,a,l),this}bezierCurveTo(t,i,a,l,d,p){return this.currentPath.bezierCurveTo(t,i,a,l,d,p),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t,i){function a(ot){const vt=[];for(let mt=0,At=ot.length;mt<At;mt++){const Pt=ot[mt],Et=new Yu;Et.curves=Pt.curves,vt.push(Et)}return vt}function l(ot,vt){const mt=vt.length;let At=!1;for(let Pt=mt-1,Et=0;Et<mt;Pt=Et++){let Ot=vt[Pt],Ie=vt[Et],ye=Ie.x-Ot.x,xe=Ie.y-Ot.y;if(Math.abs(xe)>Number.EPSILON){if(xe<0&&(Ot=vt[Et],ye=-ye,Ie=vt[Pt],xe=-xe),ot.y<Ot.y||ot.y>Ie.y)continue;if(ot.y===Ot.y){if(ot.x===Ot.x)return!0}else{const ge=xe*(ot.x-Ot.x)-ye*(ot.y-Ot.y);if(ge===0)return!0;if(ge<0)continue;At=!At}}else{if(ot.y!==Ot.y)continue;if(Ie.x<=ot.x&&ot.x<=Ot.x||Ot.x<=ot.x&&ot.x<=Ie.x)return!0}}return At}const d=Ds.isClockWise,p=this.subPaths;if(p.length===0)return[];if(i===!0)return a(p);let v,_,x;const M=[];if(p.length===1)return _=p[0],x=new Yu,x.curves=_.curves,M.push(x),M;let C=!d(p[0].getPoints());C=t?!C:C;const A=[],R=[];let O,U,D=[],Z=0;R[Z]=void 0,D[Z]=[];for(let ot=0,vt=p.length;ot<vt;ot++)_=p[ot],O=_.getPoints(),v=d(O),v=t?!v:v,v?(!C&&R[Z]&&Z++,R[Z]={s:new Yu,p:O},R[Z].s.curves=_.curves,C&&Z++,D[Z]=[]):D[Z].push({h:_,p:O[0]});if(!R[0])return a(p);if(R.length>1){let ot=!1;const vt=[];for(let mt=0,At=R.length;mt<At;mt++)A[mt]=[];for(let mt=0,At=R.length;mt<At;mt++){const Pt=D[mt];for(let Et=0;Et<Pt.length;Et++){const Ot=Pt[Et];let Ie=!0;for(let ye=0;ye<R.length;ye++)l(Ot.p,R[ye].p)&&(mt!==ye&&vt.push({froms:mt,tos:ye,hole:Et}),Ie?(Ie=!1,A[ye].push(Ot)):ot=!0);Ie&&A[mt].push(Ot)}}vt.length>0&&(ot||(D=A))}for(let ot=0,vt=R.length;ot<vt;ot++){x=R[ot].s,M.push(x),U=D[ot];for(let mt=0,At=U.length;mt<At;mt++)x.holes.push(U[mt].h)}return M}}class oo{constructor(t){this.type="Font",this.data=t}generateShapes(t,i=100){const a=[],l=function(d,p,v){const _=Array.from(d),x=p/v.resolution,M=(v.boundingBox.yMax-v.boundingBox.yMin+v.underlineThickness)*x,C=[];let A=0,R=0;for(let O=0;O<_.length;O++){const U=_[O];if(U===`
2922
+ }`}),R=A.clone();R.defines.HORIZONTAL_PASS=1;const O=new zn;O.setAttribute("position",new Kn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const U=new Bi(O,A),D=this;function Z(Pt,Et){const Ot=t.update(U);A.uniforms.shadow_pass.value=Pt.map.texture,A.uniforms.resolution.value=Pt.mapSize,A.uniforms.radius.value=Pt.radius,m.setRenderTarget(Pt.mapPass),m.clear(),m.renderBufferDirect(Et,null,Ot,A,U,null),R.uniforms.shadow_pass.value=Pt.mapPass.texture,R.uniforms.resolution.value=Pt.mapSize,R.uniforms.radius.value=Pt.radius,m.setRenderTarget(Pt.map),m.clear(),m.renderBufferDirect(Et,null,Ot,R,U,null)}function ot(Pt){const Et=Pt<<0;let Ot=v[Et];return Ot===void 0&&(Ot=new Uh({depthPacking:os,morphTargets:Pt}),v[Et]=Ot),Ot}function vt(Pt){const Et=Pt<<0;let Ot=_[Et];return Ot===void 0&&(Ot=new ms({morphTargets:Pt}),_[Et]=Ot),Ot}function mt(Pt,Et,Ot,Ie,ye,xe,ge){let Ht=null,ce=ot,We=Pt.customDepthMaterial;if(Ie.isPointLight===!0&&(ce=vt,We=Pt.customDistanceMaterial),We===void 0){let je=!1;Ot.morphTargets===!0&&(je=Et.morphAttributes&&Et.morphAttributes.position&&Et.morphAttributes.position.length>0),Ht=ce(je)}else Ht=We;if(m.localClippingEnabled&&Ot.clipShadows===!0&&Ot.clippingPlanes.length!==0){const je=Ht.uuid,ze=Ot.uuid;let fn=x[je];fn===void 0&&(fn={},x[je]=fn);let _n=fn[ze];_n===void 0&&(_n=Ht.clone(),fn[ze]=_n),Ht=_n}return Ht.visible=Ot.visible,Ht.wireframe=Ot.wireframe,Ht.side=ge===Gt?Ot.shadowSide!==null?Ot.shadowSide:Ot.side:Ot.shadowSide!==null?Ot.shadowSide:C[Ot.side],Ht.clipShadows=Ot.clipShadows,Ht.clippingPlanes=Ot.clippingPlanes,Ht.clipIntersection=Ot.clipIntersection,Ht.wireframeLinewidth=Ot.wireframeLinewidth,Ht.linewidth=Ot.linewidth,Ie.isPointLight===!0&&Ht.isMeshDistanceMaterial===!0&&(Ht.referencePosition.setFromMatrixPosition(Ie.matrixWorld),Ht.nearDistance=ye,Ht.farDistance=xe),Ht}function At(Pt,Et,Ot,Ie,ye){if(Pt.visible===!1)return;if(Pt.layers.test(Et.layers)&&(Pt.isMesh||Pt.isLine||Pt.isPoints)&&(Pt.castShadow||Pt.receiveShadow&&ye===Gt)&&(!Pt.frustumCulled||a.intersectsObject(Pt))){Pt.modelViewMatrix.multiplyMatrices(Ot.matrixWorldInverse,Pt.matrixWorld);const ge=t.update(Pt),Ht=Pt.material;if(Array.isArray(Ht)){const ce=ge.groups;for(let We=0,je=ce.length;We<je;We++){const ze=ce[We],fn=Ht[ze.materialIndex];if(fn&&fn.visible){const _n=mt(Pt,ge,fn,Ie,Ot.near,Ot.far,ye);m.renderBufferDirect(Ot,null,ge,_n,Pt,ze)}}}else if(Ht.visible){const ce=mt(Pt,ge,Ht,Ie,Ot.near,Ot.far,ye);m.renderBufferDirect(Ot,null,ge,ce,Pt,null)}}const xe=Pt.children;for(let ge=0,Ht=xe.length;ge<Ht;ge++)At(xe[ge],Et,Ot,Ie,ye)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ut,this.render=function(Pt,Et,Ot){if(D.enabled===!1||D.autoUpdate===!1&&D.needsUpdate===!1||Pt.length===0)return;const Ie=m.getRenderTarget(),ye=m.getActiveCubeFace(),xe=m.getActiveMipmapLevel(),ge=m.state;ge.setBlending(B),ge.buffers.color.setClear(1,1,1,1),ge.buffers.depth.setTest(!0),ge.setScissorTest(!1);for(let Ht=0,ce=Pt.length;Ht<ce;Ht++){const We=Pt[Ht],je=We.shadow;if(je===void 0){console.warn("THREE.WebGLShadowMap:",We,"has no shadow.");continue}if(je.autoUpdate===!1&&je.needsUpdate===!1)continue;l.copy(je.mapSize);const ze=je.getFrameExtents();if(l.multiply(ze),d.copy(je.mapSize),(l.x>M||l.y>M)&&(l.x>M&&(d.x=Math.floor(M/ze.x),l.x=d.x*ze.x,je.mapSize.x=d.x),l.y>M&&(d.y=Math.floor(M/ze.y),l.y=d.y*ze.y,je.mapSize.y=d.y)),je.map===null&&!je.isPointLightShadow&&this.type===Gt){const _n={minFilter:Qe,magFilter:Qe,format:Tn};je.map=new Bo(l.x,l.y,_n),je.map.texture.name=We.name+".shadowMap",je.mapPass=new Bo(l.x,l.y,_n),je.camera.updateProjectionMatrix()}if(je.map===null){const _n={minFilter:wt,magFilter:wt,format:Tn};je.map=new Bo(l.x,l.y,_n),je.map.texture.name=We.name+".shadowMap",je.camera.updateProjectionMatrix()}m.setRenderTarget(je.map),m.clear();const fn=je.getViewportCount();for(let _n=0;_n<fn;_n++){const Mn=je.getViewport(_n);p.set(d.x*Mn.x,d.y*Mn.y,d.x*Mn.z,d.y*Mn.w),ge.viewport(p),je.updateMatrices(We,_n),a=je.getFrustum(),At(Et,Ot,je.camera,We,this.type)}je.isPointLightShadow||this.type!==Gt||Z(je,Ot),je.needsUpdate=!1}D.needsUpdate=!1,m.setRenderTarget(Ie,ye,xe)}}function Qd(m,t,i){const a=i.isWebGL2,l=new function(){let xt=!1;const Zt=new Ir;let Te=null;const Pe=new Ir(0,0,0,0);return{setMask:function(we){Te===we||xt||(m.colorMask(we,we,we,we),Te=we)},setLocked:function(we){xt=we},setClear:function(we,bn,Gn,Fn,_r){_r===!0&&(we*=Fn,bn*=Fn,Gn*=Fn),Zt.set(we,bn,Gn,Fn),Pe.equals(Zt)===!1&&(m.clearColor(we,bn,Gn,Fn),Pe.copy(Zt))},reset:function(){xt=!1,Te=null,Pe.set(-1,0,0,0)}}},d=new function(){let xt=!1,Zt=null,Te=null,Pe=null;return{setTest:function(we){we?Sn(2929):Rt(2929)},setMask:function(we){Zt===we||xt||(m.depthMask(we),Zt=we)},setFunc:function(we){if(Te!==we){if(we)switch(we){case Bn:m.depthFunc(512);break;case Wn:m.depthFunc(519);break;case vn:m.depthFunc(513);break;case Pr:m.depthFunc(515);break;case Ur:m.depthFunc(514);break;case Rr:m.depthFunc(518);break;case qr:m.depthFunc(516);break;case yr:m.depthFunc(517);break;default:m.depthFunc(515)}else m.depthFunc(515);Te=we}},setLocked:function(we){xt=we},setClear:function(we){Pe!==we&&(m.clearDepth(we),Pe=we)},reset:function(){xt=!1,Zt=null,Te=null,Pe=null}}},p=new function(){let xt=!1,Zt=null,Te=null,Pe=null,we=null,bn=null,Gn=null,Fn=null,_r=null;return{setTest:function(Tr){xt||(Tr?Sn(2960):Rt(2960))},setMask:function(Tr){Zt===Tr||xt||(m.stencilMask(Tr),Zt=Tr)},setFunc:function(Tr,qo,fi){Te===Tr&&Pe===qo&&we===fi||(m.stencilFunc(Tr,qo,fi),Te=Tr,Pe=qo,we=fi)},setOp:function(Tr,qo,fi){bn===Tr&&Gn===qo&&Fn===fi||(m.stencilOp(Tr,qo,fi),bn=Tr,Gn=qo,Fn=fi)},setLocked:function(Tr){xt=Tr},setClear:function(Tr){_r!==Tr&&(m.clearStencil(Tr),_r=Tr)},reset:function(){xt=!1,Zt=null,Te=null,Pe=null,we=null,bn=null,Gn=null,Fn=null,_r=null}}};let v={},_=null,x={},M=null,C=!1,A=null,R=null,O=null,U=null,D=null,Z=null,ot=null,vt=!1,mt=null,At=null,Pt=null,Et=null,Ot=null;const Ie=m.getParameter(35661);let ye=!1,xe=0;const ge=m.getParameter(7938);ge.indexOf("WebGL")!==-1?(xe=parseFloat(/^WebGL (\d)/.exec(ge)[1]),ye=xe>=1):ge.indexOf("OpenGL ES")!==-1&&(xe=parseFloat(/^OpenGL ES (\d)/.exec(ge)[1]),ye=xe>=2);let Ht=null,ce={};const We=m.getParameter(3088),je=m.getParameter(2978),ze=new Ir().fromArray(We),fn=new Ir().fromArray(je);function _n(xt,Zt,Te){const Pe=new Uint8Array(4),we=m.createTexture();m.bindTexture(xt,we),m.texParameteri(xt,10241,9728),m.texParameteri(xt,10240,9728);for(let bn=0;bn<Te;bn++)m.texImage2D(Zt+bn,0,6408,1,1,0,6408,5121,Pe);return we}const Mn={};function Sn(xt){v[xt]!==!0&&(m.enable(xt),v[xt]=!0)}function Rt(xt){v[xt]!==!1&&(m.disable(xt),v[xt]=!1)}Mn[3553]=_n(3553,3553,1),Mn[34067]=_n(34067,34069,6),l.setClear(0,0,0,1),d.setClear(1),p.setClear(0),Sn(2929),d.setFunc(Pr),pe(!1),rn(X),Sn(2884),Be(B);const Dt={[ne]:32774,[bt]:32778,[Jt]:32779};if(a)Dt[Kt]=32775,Dt[rt]=32776;else{const xt=t.get("EXT_blend_minmax");xt!==null&&(Dt[Kt]=xt.MIN_EXT,Dt[rt]=xt.MAX_EXT)}const Fe={[Ut]:0,[Wt]:1,[te]:768,[le]:770,[Ln]:776,[Hn]:774,[Ye]:772,[Xt]:769,[fe]:771,[Ke]:775,[ke]:773};function Be(xt,Zt,Te,Pe,we,bn,Gn,Fn){if(xt!==B){if(C===!1&&(Sn(3042),C=!0),xt===Oe)we=we||Zt,bn=bn||Te,Gn=Gn||Pe,Zt===R&&we===D||(m.blendEquationSeparate(Dt[Zt],Dt[we]),R=Zt,D=we),Te===O&&Pe===U&&bn===Z&&Gn===ot||(m.blendFuncSeparate(Fe[Te],Fe[Pe],Fe[bn],Fe[Gn]),O=Te,U=Pe,Z=bn,ot=Gn),A=xt,vt=null;else if(xt!==A||Fn!==vt){if(R===ne&&D===ne||(m.blendEquation(32774),R=ne,D=ne),Fn)switch(xt){case Q:m.blendFuncSeparate(1,771,1,771);break;case et:m.blendFunc(1,1);break;case ft:m.blendFuncSeparate(0,0,769,771);break;case ae:m.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",xt)}else switch(xt){case Q:m.blendFuncSeparate(770,771,1,771);break;case et:m.blendFunc(770,1);break;case ft:m.blendFunc(0,769);break;case ae:m.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",xt)}O=null,U=null,Z=null,ot=null,A=xt,vt=Fn}}else C===!0&&(Rt(3042),C=!1)}function pe(xt){mt!==xt&&(xt?m.frontFace(2304):m.frontFace(2305),mt=xt)}function rn(xt){xt!==J?(Sn(2884),xt!==At&&(xt===X?m.cullFace(1029):xt===ct?m.cullFace(1028):m.cullFace(1032))):Rt(2884),At=xt}function sn(xt,Zt,Te){xt?(Sn(32823),Et===Zt&&Ot===Te||(m.polygonOffset(Zt,Te),Et=Zt,Ot=Te)):Rt(32823)}function be(xt){xt===void 0&&(xt=33984+Ie-1),Ht!==xt&&(m.activeTexture(xt),Ht=xt)}return{buffers:{color:l,depth:d,stencil:p},enable:Sn,disable:Rt,bindFramebuffer:function(xt,Zt){return Zt===null&&_!==null&&(Zt=_),x[xt]!==Zt&&(m.bindFramebuffer(xt,Zt),x[xt]=Zt,a&&(xt===36009&&(x[36160]=Zt),xt===36160&&(x[36009]=Zt)),!0)},bindXRFramebuffer:function(xt){xt!==_&&(m.bindFramebuffer(36160,xt),_=xt)},useProgram:function(xt){return M!==xt&&(m.useProgram(xt),M=xt,!0)},setBlending:Be,setMaterial:function(xt,Zt){xt.side===k?Rt(2884):Sn(2884);let Te=xt.side===L;Zt&&(Te=!Te),pe(Te),xt.blending===Q&&xt.transparent===!1?Be(B):Be(xt.blending,xt.blendEquation,xt.blendSrc,xt.blendDst,xt.blendEquationAlpha,xt.blendSrcAlpha,xt.blendDstAlpha,xt.premultipliedAlpha),d.setFunc(xt.depthFunc),d.setTest(xt.depthTest),d.setMask(xt.depthWrite),l.setMask(xt.colorWrite);const Pe=xt.stencilWrite;p.setTest(Pe),Pe&&(p.setMask(xt.stencilWriteMask),p.setFunc(xt.stencilFunc,xt.stencilRef,xt.stencilFuncMask),p.setOp(xt.stencilFail,xt.stencilZFail,xt.stencilZPass)),sn(xt.polygonOffset,xt.polygonOffsetFactor,xt.polygonOffsetUnits),xt.alphaToCoverage===!0?Sn(32926):Rt(32926)},setFlipSided:pe,setCullFace:rn,setLineWidth:function(xt){xt!==Pt&&(ye&&m.lineWidth(xt),Pt=xt)},setPolygonOffset:sn,setScissorTest:function(xt){xt?Sn(3089):Rt(3089)},activeTexture:be,bindTexture:function(xt,Zt){Ht===null&&be();let Te=ce[Ht];Te===void 0&&(Te={type:void 0,texture:void 0},ce[Ht]=Te),Te.type===xt&&Te.texture===Zt||(m.bindTexture(xt,Zt||Mn[xt]),Te.type=xt,Te.texture=Zt)},unbindTexture:function(){const xt=ce[Ht];xt!==void 0&&xt.type!==void 0&&(m.bindTexture(xt.type,null),xt.type=void 0,xt.texture=void 0)},compressedTexImage2D:function(){try{m.compressedTexImage2D.apply(m,arguments)}catch(xt){console.error("THREE.WebGLState:",xt)}},texImage2D:function(){try{m.texImage2D.apply(m,arguments)}catch(xt){console.error("THREE.WebGLState:",xt)}},texImage3D:function(){try{m.texImage3D.apply(m,arguments)}catch(xt){console.error("THREE.WebGLState:",xt)}},scissor:function(xt){ze.equals(xt)===!1&&(m.scissor(xt.x,xt.y,xt.z,xt.w),ze.copy(xt))},viewport:function(xt){fn.equals(xt)===!1&&(m.viewport(xt.x,xt.y,xt.z,xt.w),fn.copy(xt))},reset:function(){m.disable(3042),m.disable(2884),m.disable(2929),m.disable(32823),m.disable(3089),m.disable(2960),m.disable(32926),m.blendEquation(32774),m.blendFunc(1,0),m.blendFuncSeparate(1,0,1,0),m.colorMask(!0,!0,!0,!0),m.clearColor(0,0,0,0),m.depthMask(!0),m.depthFunc(513),m.clearDepth(1),m.stencilMask(4294967295),m.stencilFunc(519,0,4294967295),m.stencilOp(7680,7680,7680),m.clearStencil(0),m.cullFace(1029),m.frontFace(2305),m.polygonOffset(0,0),m.activeTexture(33984),m.bindFramebuffer(36160,null),a===!0&&(m.bindFramebuffer(36009,null),m.bindFramebuffer(36008,null)),m.useProgram(null),m.lineWidth(1),m.scissor(0,0,m.canvas.width,m.canvas.height),m.viewport(0,0,m.canvas.width,m.canvas.height),v={},Ht=null,ce={},_=null,x={},M=null,C=!1,A=null,R=null,O=null,U=null,D=null,Z=null,ot=null,vt=!1,mt=null,At=null,Pt=null,Et=null,Ot=null,ze.set(0,0,m.canvas.width,m.canvas.height),fn.set(0,0,m.canvas.width,m.canvas.height),l.reset(),d.reset(),p.reset()}}}function Cs(m,t,i,a,l,d,p){const v=l.isWebGL2,_=l.maxTextures,x=l.maxCubemapSize,M=l.maxTextureSize,C=l.maxSamples,A=new WeakMap;let R,O=!1;try{O=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function U(Rt,Dt){return O?new OffscreenCanvas(Rt,Dt):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function D(Rt,Dt,Fe,Be){let pe=1;if((Rt.width>Be||Rt.height>Be)&&(pe=Be/Math.max(Rt.width,Rt.height)),pe<1||Dt===!0){if(typeof HTMLImageElement!="undefined"&&Rt instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&Rt instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&Rt instanceof ImageBitmap){const rn=Dt?Ep:Math.floor,sn=rn(pe*Rt.width),be=rn(pe*Rt.height);R===void 0&&(R=U(sn,be));const xt=Fe?U(sn,be):R;return xt.width=sn,xt.height=be,xt.getContext("2d").drawImage(Rt,0,0,sn,be),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Rt.width+"x"+Rt.height+") to ("+sn+"x"+be+")."),xt}return"data"in Rt&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Rt.width+"x"+Rt.height+")."),Rt}return Rt}function Z(Rt){return xi(Rt.width)&&xi(Rt.height)}function ot(Rt,Dt){return Rt.generateMipmaps&&Dt&&Rt.minFilter!==wt&&Rt.minFilter!==Qe}function vt(Rt,Dt,Fe,Be,pe=1){m.generateMipmap(Rt),a.get(Dt).__maxMipLevel=Math.log2(Math.max(Fe,Be,pe))}function mt(Rt,Dt,Fe){if(v===!1)return Dt;if(Rt!==null){if(m[Rt]!==void 0)return m[Rt];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+Rt+"'")}let Be=Dt;return Dt===6403&&(Fe===5126&&(Be=33326),Fe===5131&&(Be=33325),Fe===5121&&(Be=33321)),Dt===6407&&(Fe===5126&&(Be=34837),Fe===5131&&(Be=34843),Fe===5121&&(Be=32849)),Dt===6408&&(Fe===5126&&(Be=34836),Fe===5131&&(Be=34842),Fe===5121&&(Be=32856)),Be!==33325&&Be!==33326&&Be!==34842&&Be!==34836||t.get("EXT_color_buffer_float"),Be}function At(Rt){return Rt===wt||Rt===Vt||Rt===Le?9728:9729}function Pt(Rt){const Dt=Rt.target;Dt.removeEventListener("dispose",Pt),function(Fe){const Be=a.get(Fe);Be.__webglInit!==void 0&&(m.deleteTexture(Be.__webglTexture),a.remove(Fe))}(Dt),Dt.isVideoTexture&&A.delete(Dt),p.memory.textures--}function Et(Rt){const Dt=Rt.target;Dt.removeEventListener("dispose",Et),function(Fe){const Be=Fe.texture,pe=a.get(Fe),rn=a.get(Be);if(!!Fe){if(rn.__webglTexture!==void 0&&(m.deleteTexture(rn.__webglTexture),p.memory.textures--),Fe.depthTexture&&Fe.depthTexture.dispose(),Fe.isWebGLCubeRenderTarget)for(let sn=0;sn<6;sn++)m.deleteFramebuffer(pe.__webglFramebuffer[sn]),pe.__webglDepthbuffer&&m.deleteRenderbuffer(pe.__webglDepthbuffer[sn]);else m.deleteFramebuffer(pe.__webglFramebuffer),pe.__webglDepthbuffer&&m.deleteRenderbuffer(pe.__webglDepthbuffer),pe.__webglMultisampledFramebuffer&&m.deleteFramebuffer(pe.__webglMultisampledFramebuffer),pe.__webglColorRenderbuffer&&m.deleteRenderbuffer(pe.__webglColorRenderbuffer),pe.__webglDepthRenderbuffer&&m.deleteRenderbuffer(pe.__webglDepthRenderbuffer);if(Fe.isWebGLMultipleRenderTargets)for(let sn=0,be=Be.length;sn<be;sn++){const xt=a.get(Be[sn]);xt.__webglTexture&&(m.deleteTexture(xt.__webglTexture),p.memory.textures--),a.remove(Be[sn])}a.remove(Be),a.remove(Fe)}}(Dt)}let Ot=0;function Ie(Rt,Dt){const Fe=a.get(Rt);if(Rt.isVideoTexture&&function(Be){const pe=p.render.frame;A.get(Be)!==pe&&(A.set(Be,pe),Be.update())}(Rt),Rt.version>0&&Fe.__version!==Rt.version){const Be=Rt.image;if(Be===void 0)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(Be.complete!==!1)return void We(Fe,Rt,Dt);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}i.activeTexture(33984+Dt),i.bindTexture(3553,Fe.__webglTexture)}function ye(Rt,Dt){const Fe=a.get(Rt);Rt.version>0&&Fe.__version!==Rt.version?function(Be,pe,rn){if(pe.image.length!==6)return;ce(Be,pe),i.activeTexture(33984+rn),i.bindTexture(34067,Be.__webglTexture),m.pixelStorei(37440,pe.flipY),m.pixelStorei(37441,pe.premultiplyAlpha),m.pixelStorei(3317,pe.unpackAlignment),m.pixelStorei(37443,0);const sn=pe&&(pe.isCompressedTexture||pe.image[0].isCompressedTexture),be=pe.image[0]&&pe.image[0].isDataTexture,xt=[];for(let Fn=0;Fn<6;Fn++)xt[Fn]=sn||be?be?pe.image[Fn].image:pe.image[Fn]:D(pe.image[Fn],!1,!0,x);const Zt=xt[0],Te=Z(Zt)||v,Pe=d.convert(pe.format),we=d.convert(pe.type),bn=mt(pe.internalFormat,Pe,we);let Gn;if(Ht(34067,pe,Te),sn){for(let Fn=0;Fn<6;Fn++){Gn=xt[Fn].mipmaps;for(let _r=0;_r<Gn.length;_r++){const Tr=Gn[_r];pe.format!==Tn&&pe.format!==yn?Pe!==null?i.compressedTexImage2D(34069+Fn,_r,bn,Tr.width,Tr.height,0,Tr.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):i.texImage2D(34069+Fn,_r,bn,Tr.width,Tr.height,0,Pe,we,Tr.data)}}Be.__maxMipLevel=Gn.length-1}else{Gn=pe.mipmaps;for(let Fn=0;Fn<6;Fn++)if(be){i.texImage2D(34069+Fn,0,bn,xt[Fn].width,xt[Fn].height,0,Pe,we,xt[Fn].data);for(let _r=0;_r<Gn.length;_r++){const Tr=Gn[_r].image[Fn].image;i.texImage2D(34069+Fn,_r+1,bn,Tr.width,Tr.height,0,Pe,we,Tr.data)}}else{i.texImage2D(34069+Fn,0,bn,Pe,we,xt[Fn]);for(let _r=0;_r<Gn.length;_r++){const Tr=Gn[_r];i.texImage2D(34069+Fn,_r+1,bn,Pe,we,Tr.image[Fn])}}Be.__maxMipLevel=Gn.length}ot(pe,Te)&&vt(34067,pe,Zt.width,Zt.height),Be.__version=pe.version,pe.onUpdate&&pe.onUpdate(pe)}(Fe,Rt,Dt):(i.activeTexture(33984+Dt),i.bindTexture(34067,Fe.__webglTexture))}const xe={[yt]:10497,[St]:33071,[Ct]:33648},ge={[wt]:9728,[Vt]:9984,[Le]:9986,[Qe]:9729,[Qn]:9985,[Yr]:9987};function Ht(Rt,Dt,Fe){if(Fe?(m.texParameteri(Rt,10242,xe[Dt.wrapS]),m.texParameteri(Rt,10243,xe[Dt.wrapT]),Rt!==32879&&Rt!==35866||m.texParameteri(Rt,32882,xe[Dt.wrapR]),m.texParameteri(Rt,10240,ge[Dt.magFilter]),m.texParameteri(Rt,10241,ge[Dt.minFilter])):(m.texParameteri(Rt,10242,33071),m.texParameteri(Rt,10243,33071),Rt!==32879&&Rt!==35866||m.texParameteri(Rt,32882,33071),Dt.wrapS===St&&Dt.wrapT===St||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),m.texParameteri(Rt,10240,At(Dt.magFilter)),m.texParameteri(Rt,10241,At(Dt.minFilter)),Dt.minFilter!==wt&&Dt.minFilter!==Qe&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),t.has("EXT_texture_filter_anisotropic")===!0){const Be=t.get("EXT_texture_filter_anisotropic");if(Dt.type===ee&&t.has("OES_texture_float_linear")===!1||v===!1&&Dt.type===Ft&&t.has("OES_texture_half_float_linear")===!1)return;(Dt.anisotropy>1||a.get(Dt).__currentAnisotropy)&&(m.texParameterf(Rt,Be.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(Dt.anisotropy,l.getMaxAnisotropy())),a.get(Dt).__currentAnisotropy=Dt.anisotropy)}}function ce(Rt,Dt){Rt.__webglInit===void 0&&(Rt.__webglInit=!0,Dt.addEventListener("dispose",Pt),Rt.__webglTexture=m.createTexture(),p.memory.textures++)}function We(Rt,Dt,Fe){let Be=3553;Dt.isDataTexture2DArray&&(Be=35866),Dt.isDataTexture3D&&(Be=32879),ce(Rt,Dt),i.activeTexture(33984+Fe),i.bindTexture(Be,Rt.__webglTexture),m.pixelStorei(37440,Dt.flipY),m.pixelStorei(37441,Dt.premultiplyAlpha),m.pixelStorei(3317,Dt.unpackAlignment),m.pixelStorei(37443,0);const pe=function(we){return!v&&(we.wrapS!==St||we.wrapT!==St||we.minFilter!==wt&&we.minFilter!==Qe)}(Dt)&&Z(Dt.image)===!1,rn=D(Dt.image,pe,!1,M),sn=Z(rn)||v,be=d.convert(Dt.format);let xt,Zt=d.convert(Dt.type),Te=mt(Dt.internalFormat,be,Zt);Ht(Be,Dt,sn);const Pe=Dt.mipmaps;if(Dt.isDepthTexture)Te=6402,v?Te=Dt.type===ee?36012:Dt.type===Jo?33190:Dt.type===un?35056:33189:Dt.type===ee&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),Dt.format===dn&&Te===6402&&Dt.type!==Ra&&Dt.type!==Jo&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),Dt.type=Ra,Zt=d.convert(Dt.type)),Dt.format===rr&&Te===6402&&(Te=34041,Dt.type!==un&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),Dt.type=un,Zt=d.convert(Dt.type))),i.texImage2D(3553,0,Te,rn.width,rn.height,0,be,Zt,null);else if(Dt.isDataTexture)if(Pe.length>0&&sn){for(let we=0,bn=Pe.length;we<bn;we++)xt=Pe[we],i.texImage2D(3553,we,Te,xt.width,xt.height,0,be,Zt,xt.data);Dt.generateMipmaps=!1,Rt.__maxMipLevel=Pe.length-1}else i.texImage2D(3553,0,Te,rn.width,rn.height,0,be,Zt,rn.data),Rt.__maxMipLevel=0;else if(Dt.isCompressedTexture){for(let we=0,bn=Pe.length;we<bn;we++)xt=Pe[we],Dt.format!==Tn&&Dt.format!==yn?be!==null?i.compressedTexImage2D(3553,we,Te,xt.width,xt.height,0,xt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):i.texImage2D(3553,we,Te,xt.width,xt.height,0,be,Zt,xt.data);Rt.__maxMipLevel=Pe.length-1}else if(Dt.isDataTexture2DArray)i.texImage3D(35866,0,Te,rn.width,rn.height,rn.depth,0,be,Zt,rn.data),Rt.__maxMipLevel=0;else if(Dt.isDataTexture3D)i.texImage3D(32879,0,Te,rn.width,rn.height,rn.depth,0,be,Zt,rn.data),Rt.__maxMipLevel=0;else if(Pe.length>0&&sn){for(let we=0,bn=Pe.length;we<bn;we++)xt=Pe[we],i.texImage2D(3553,we,Te,be,Zt,xt);Dt.generateMipmaps=!1,Rt.__maxMipLevel=Pe.length-1}else i.texImage2D(3553,0,Te,be,Zt,rn),Rt.__maxMipLevel=0;ot(Dt,sn)&&vt(Be,Dt,rn.width,rn.height),Rt.__version=Dt.version,Dt.onUpdate&&Dt.onUpdate(Dt)}function je(Rt,Dt,Fe,Be,pe){const rn=d.convert(Fe.format),sn=d.convert(Fe.type),be=mt(Fe.internalFormat,rn,sn);pe===32879||pe===35866?i.texImage3D(pe,0,be,Dt.width,Dt.height,Dt.depth,0,rn,sn,null):i.texImage2D(pe,0,be,Dt.width,Dt.height,0,rn,sn,null),i.bindFramebuffer(36160,Rt),m.framebufferTexture2D(36160,Be,pe,a.get(Fe).__webglTexture,0),i.bindFramebuffer(36160,null)}function ze(Rt,Dt,Fe){if(m.bindRenderbuffer(36161,Rt),Dt.depthBuffer&&!Dt.stencilBuffer){let Be=33189;if(Fe){const pe=Dt.depthTexture;pe&&pe.isDepthTexture&&(pe.type===ee?Be=36012:pe.type===Jo&&(Be=33190));const rn=_n(Dt);m.renderbufferStorageMultisample(36161,rn,Be,Dt.width,Dt.height)}else m.renderbufferStorage(36161,Be,Dt.width,Dt.height);m.framebufferRenderbuffer(36160,36096,36161,Rt)}else if(Dt.depthBuffer&&Dt.stencilBuffer){if(Fe){const Be=_n(Dt);m.renderbufferStorageMultisample(36161,Be,35056,Dt.width,Dt.height)}else m.renderbufferStorage(36161,34041,Dt.width,Dt.height);m.framebufferRenderbuffer(36160,33306,36161,Rt)}else{const Be=Dt.isWebGLMultipleRenderTargets===!0?Dt.texture[0]:Dt.texture,pe=d.convert(Be.format),rn=d.convert(Be.type),sn=mt(Be.internalFormat,pe,rn);if(Fe){const be=_n(Dt);m.renderbufferStorageMultisample(36161,be,sn,Dt.width,Dt.height)}else m.renderbufferStorage(36161,sn,Dt.width,Dt.height)}m.bindRenderbuffer(36161,null)}function fn(Rt){const Dt=a.get(Rt),Fe=Rt.isWebGLCubeRenderTarget===!0;if(Rt.depthTexture){if(Fe)throw new Error("target.depthTexture not supported in Cube render targets");(function(Be,pe){if(pe&&pe.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(i.bindFramebuffer(36160,Be),!pe.depthTexture||!pe.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");a.get(pe.depthTexture).__webglTexture&&pe.depthTexture.image.width===pe.width&&pe.depthTexture.image.height===pe.height||(pe.depthTexture.image.width=pe.width,pe.depthTexture.image.height=pe.height,pe.depthTexture.needsUpdate=!0),Ie(pe.depthTexture,0);const rn=a.get(pe.depthTexture).__webglTexture;if(pe.depthTexture.format===dn)m.framebufferTexture2D(36160,36096,3553,rn,0);else{if(pe.depthTexture.format!==rr)throw new Error("Unknown depthTexture format");m.framebufferTexture2D(36160,33306,3553,rn,0)}})(Dt.__webglFramebuffer,Rt)}else if(Fe){Dt.__webglDepthbuffer=[];for(let Be=0;Be<6;Be++)i.bindFramebuffer(36160,Dt.__webglFramebuffer[Be]),Dt.__webglDepthbuffer[Be]=m.createRenderbuffer(),ze(Dt.__webglDepthbuffer[Be],Rt,!1)}else i.bindFramebuffer(36160,Dt.__webglFramebuffer),Dt.__webglDepthbuffer=m.createRenderbuffer(),ze(Dt.__webglDepthbuffer,Rt,!1);i.bindFramebuffer(36160,null)}function _n(Rt){return v&&Rt.isWebGLMultisampleRenderTarget?Math.min(C,Rt.samples):0}let Mn=!1,Sn=!1;this.allocateTextureUnit=function(){const Rt=Ot;return Rt>=_&&console.warn("THREE.WebGLTextures: Trying to use "+Rt+" texture units while this GPU supports only "+_),Ot+=1,Rt},this.resetTextureUnits=function(){Ot=0},this.setTexture2D=Ie,this.setTexture2DArray=function(Rt,Dt){const Fe=a.get(Rt);Rt.version>0&&Fe.__version!==Rt.version?We(Fe,Rt,Dt):(i.activeTexture(33984+Dt),i.bindTexture(35866,Fe.__webglTexture))},this.setTexture3D=function(Rt,Dt){const Fe=a.get(Rt);Rt.version>0&&Fe.__version!==Rt.version?We(Fe,Rt,Dt):(i.activeTexture(33984+Dt),i.bindTexture(32879,Fe.__webglTexture))},this.setTextureCube=ye,this.setupRenderTarget=function(Rt){const Dt=Rt.texture,Fe=a.get(Rt),Be=a.get(Dt);Rt.addEventListener("dispose",Et),Rt.isWebGLMultipleRenderTargets!==!0&&(Be.__webglTexture=m.createTexture(),Be.__version=Dt.version,p.memory.textures++);const pe=Rt.isWebGLCubeRenderTarget===!0,rn=Rt.isWebGLMultipleRenderTargets===!0,sn=Rt.isWebGLMultisampleRenderTarget===!0,be=Dt.isDataTexture3D||Dt.isDataTexture2DArray,xt=Z(Rt)||v;if(!v||Dt.format!==yn||Dt.type!==ee&&Dt.type!==Ft||(Dt.format=Tn,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),pe){Fe.__webglFramebuffer=[];for(let Zt=0;Zt<6;Zt++)Fe.__webglFramebuffer[Zt]=m.createFramebuffer()}else if(Fe.__webglFramebuffer=m.createFramebuffer(),rn)if(l.drawBuffers){const Zt=Rt.texture;for(let Te=0,Pe=Zt.length;Te<Pe;Te++){const we=a.get(Zt[Te]);we.__webglTexture===void 0&&(we.__webglTexture=m.createTexture(),p.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(sn)if(v){Fe.__webglMultisampledFramebuffer=m.createFramebuffer(),Fe.__webglColorRenderbuffer=m.createRenderbuffer(),m.bindRenderbuffer(36161,Fe.__webglColorRenderbuffer);const Zt=d.convert(Dt.format),Te=d.convert(Dt.type),Pe=mt(Dt.internalFormat,Zt,Te),we=_n(Rt);m.renderbufferStorageMultisample(36161,we,Pe,Rt.width,Rt.height),i.bindFramebuffer(36160,Fe.__webglMultisampledFramebuffer),m.framebufferRenderbuffer(36160,36064,36161,Fe.__webglColorRenderbuffer),m.bindRenderbuffer(36161,null),Rt.depthBuffer&&(Fe.__webglDepthRenderbuffer=m.createRenderbuffer(),ze(Fe.__webglDepthRenderbuffer,Rt,!0)),i.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(pe){i.bindTexture(34067,Be.__webglTexture),Ht(34067,Dt,xt);for(let Zt=0;Zt<6;Zt++)je(Fe.__webglFramebuffer[Zt],Rt,Dt,36064,34069+Zt);ot(Dt,xt)&&vt(34067,Dt,Rt.width,Rt.height),i.bindTexture(34067,null)}else if(rn){const Zt=Rt.texture;for(let Te=0,Pe=Zt.length;Te<Pe;Te++){const we=Zt[Te],bn=a.get(we);i.bindTexture(3553,bn.__webglTexture),Ht(3553,we,xt),je(Fe.__webglFramebuffer,Rt,we,36064+Te,3553),ot(we,xt)&&vt(3553,we,Rt.width,Rt.height)}i.bindTexture(3553,null)}else{let Zt=3553;be&&(v?Zt=Dt.isDataTexture3D?32879:35866:console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")),i.bindTexture(Zt,Be.__webglTexture),Ht(Zt,Dt,xt),je(Fe.__webglFramebuffer,Rt,Dt,36064,Zt),ot(Dt,xt)&&vt(Zt,Dt,Rt.width,Rt.height,Rt.depth),i.bindTexture(Zt,null)}Rt.depthBuffer&&fn(Rt)},this.updateRenderTargetMipmap=function(Rt){const Dt=Z(Rt)||v,Fe=Rt.isWebGLMultipleRenderTargets===!0?Rt.texture:[Rt.texture];for(let Be=0,pe=Fe.length;Be<pe;Be++){const rn=Fe[Be];if(ot(rn,Dt)){const sn=Rt.isWebGLCubeRenderTarget?34067:3553,be=a.get(rn).__webglTexture;i.bindTexture(sn,be),vt(sn,rn,Rt.width,Rt.height),i.bindTexture(sn,null)}}},this.updateMultisampleRenderTarget=function(Rt){if(Rt.isWebGLMultisampleRenderTarget)if(v){const Dt=Rt.width,Fe=Rt.height;let Be=16384;Rt.depthBuffer&&(Be|=256),Rt.stencilBuffer&&(Be|=1024);const pe=a.get(Rt);i.bindFramebuffer(36008,pe.__webglMultisampledFramebuffer),i.bindFramebuffer(36009,pe.__webglFramebuffer),m.blitFramebuffer(0,0,Dt,Fe,0,0,Dt,Fe,Be,9728),i.bindFramebuffer(36008,null),i.bindFramebuffer(36009,pe.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(Rt,Dt){Rt&&Rt.isWebGLRenderTarget&&(Mn===!1&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),Mn=!0),Rt=Rt.texture),Ie(Rt,Dt)},this.safeSetTextureCube=function(Rt,Dt){Rt&&Rt.isWebGLCubeRenderTarget&&(Sn===!1&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),Sn=!0),Rt=Rt.texture),ye(Rt,Dt)}}function Wc(m,t,i){const a=i.isWebGL2;return{convert:function(l){let d;if(l===uo)return 5121;if(l===Se)return 32819;if(l===Ge)return 32820;if(l===Ve)return 33635;if(l===vs)return 5120;if(l===ea)return 5122;if(l===Ra)return 5123;if(l===rh)return 5124;if(l===Jo)return 5125;if(l===ee)return 5126;if(l===Ft)return a?5131:(d=t.get("OES_texture_half_float"),d!==null?d.HALF_FLOAT_OES:null);if(l===Dn)return 6406;if(l===yn)return 6407;if(l===Tn)return 6408;if(l===mr)return 6409;if(l===gr)return 6410;if(l===dn)return 6402;if(l===rr)return 34041;if(l===ui)return 6403;if(l===Zn)return 36244;if(l===Gr)return 33319;if(l===ii)return 33320;if(l===Er)return 36248;if(l===$r)return 36249;if(l===rs||l===gu||l===Ki||l===Qr){if(d=t.get("WEBGL_compressed_texture_s3tc"),d===null)return null;if(l===rs)return d.COMPRESSED_RGB_S3TC_DXT1_EXT;if(l===gu)return d.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(l===Ki)return d.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(l===Qr)return d.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(l===mc||l===gc||l===vu||l===ih){if(d=t.get("WEBGL_compressed_texture_pvrtc"),d===null)return null;if(l===mc)return d.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(l===gc)return d.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(l===vu)return d.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(l===ih)return d.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(l===_u)return d=t.get("WEBGL_compressed_texture_etc1"),d!==null?d.COMPRESSED_RGB_ETC1_WEBGL:null;if((l===oh||l===No)&&(d=t.get("WEBGL_compressed_texture_etc"),d!==null)){if(l===oh)return d.COMPRESSED_RGB8_ETC2;if(l===No)return d.COMPRESSED_RGBA8_ETC2_EAC}return l===Td||l===ho||l===_i||l===yu||l===Ia||l===sh||l===dr||l===ti||l===La||l===Cl||l===vc||l===oi||l===Pl||l===yi||l===is||l===ul||l===Oa||l===ah||l===lh||l===Rl||l===ei||l===uh||l===Il||l===_c||l===So||l===hi||l===Ll||l===Ed?(d=t.get("WEBGL_compressed_texture_astc"),d!==null?l:null):l===ks?(d=t.get("EXT_texture_compression_bptc"),d!==null?l:null):l===un?a?34042:(d=t.get("WEBGL_depth_texture"),d!==null?d.UNSIGNED_INT_24_8_WEBGL:null):void 0}}}class zr extends Yi{constructor(t=[]){super(),this.cameras=t}}zr.prototype.isArrayCamera=!0;class bl extends ar{constructor(){super(),this.type="Group"}}bl.prototype.isGroup=!0;const Zp={type:"move"};class eu{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new bl,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new bl,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new gt,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new gt),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new bl,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new gt,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new gt),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,i,a){let l=null,d=null,p=null;const v=this._targetRay,_=this._grip,x=this._hand;if(t&&i.session.visibilityState!=="visible-blurred")if(v!==null&&(l=i.getPose(t.targetRaySpace,a),l!==null&&(v.matrix.fromArray(l.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),l.linearVelocity?(v.hasLinearVelocity=!0,v.linearVelocity.copy(l.linearVelocity)):v.hasLinearVelocity=!1,l.angularVelocity?(v.hasAngularVelocity=!0,v.angularVelocity.copy(l.angularVelocity)):v.hasAngularVelocity=!1,this.dispatchEvent(Zp))),x&&t.hand){p=!0;for(const U of t.hand.values()){const D=i.getJointPose(U,a);if(x.joints[U.jointName]===void 0){const ot=new bl;ot.matrixAutoUpdate=!1,ot.visible=!1,x.joints[U.jointName]=ot,x.add(ot)}const Z=x.joints[U.jointName];D!==null&&(Z.matrix.fromArray(D.transform.matrix),Z.matrix.decompose(Z.position,Z.rotation,Z.scale),Z.jointRadius=D.radius),Z.visible=D!==null}const M=x.joints["index-finger-tip"],C=x.joints["thumb-tip"],A=M.position.distanceTo(C.position),R=.02,O=.005;x.inputState.pinching&&A>R+O?(x.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!x.inputState.pinching&&A<=R-O&&(x.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else _!==null&&t.gripSpace&&(d=i.getPose(t.gripSpace,a),d!==null&&(_.matrix.fromArray(d.transform.matrix),_.matrix.decompose(_.position,_.rotation,_.scale),d.linearVelocity?(_.hasLinearVelocity=!0,_.linearVelocity.copy(d.linearVelocity)):_.hasLinearVelocity=!1,d.angularVelocity?(_.hasAngularVelocity=!0,_.angularVelocity.copy(d.angularVelocity)):_.hasAngularVelocity=!1));return v!==null&&(v.visible=l!==null),_!==null&&(_.visible=d!==null),x!==null&&(x.visible=p!==null),this}}class Hf extends Ua{constructor(t,i){super();const a=this,l=t.state;let d=null,p=1,v=null,_="local-floor",x=null,M=null,C=null,A=null;const R=[],O=new Map,U=new Yi;U.layers.enable(1),U.viewport=new Ir;const D=new Yi;D.layers.enable(2),D.viewport=new Ir;const Z=[U,D],ot=new zr;ot.layers.enable(1),ot.layers.enable(2);let vt=null,mt=null;function At(Ht){const ce=O.get(Ht.inputSource);ce&&ce.dispatchEvent({type:Ht.type,data:Ht.inputSource})}function Pt(){O.forEach(function(Ht,ce){Ht.disconnect(ce)}),O.clear(),vt=null,mt=null,l.bindXRFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),ge.stop(),a.isPresenting=!1,a.dispatchEvent({type:"sessionend"})}function Et(Ht){const ce=d.inputSources;for(let We=0;We<R.length;We++)O.set(ce[We],R[We]);for(let We=0;We<Ht.removed.length;We++){const je=Ht.removed[We],ze=O.get(je);ze&&(ze.dispatchEvent({type:"disconnected",data:je}),O.delete(je))}for(let We=0;We<Ht.added.length;We++){const je=Ht.added[We],ze=O.get(je);ze&&ze.dispatchEvent({type:"connected",data:je})}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Ht){let ce=R[Ht];return ce===void 0&&(ce=new eu,R[Ht]=ce),ce.getTargetRaySpace()},this.getControllerGrip=function(Ht){let ce=R[Ht];return ce===void 0&&(ce=new eu,R[Ht]=ce),ce.getGripSpace()},this.getHand=function(Ht){let ce=R[Ht];return ce===void 0&&(ce=new eu,R[Ht]=ce),ce.getHandSpace()},this.setFramebufferScaleFactor=function(Ht){p=Ht,a.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Ht){_=Ht,a.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return v},this.getSession=function(){return d},this.setSession=async function(Ht){if(d=Ht,d!==null){d.addEventListener("select",At),d.addEventListener("selectstart",At),d.addEventListener("selectend",At),d.addEventListener("squeeze",At),d.addEventListener("squeezestart",At),d.addEventListener("squeezeend",At),d.addEventListener("end",Pt),d.addEventListener("inputsourceschange",Et);const ce=i.getContextAttributes();if(ce.xrCompatible!==!0&&await i.makeXRCompatible(),d.renderState.layers===void 0){const We={antialias:ce.antialias,alpha:ce.alpha,depth:ce.depth,stencil:ce.stencil,framebufferScaleFactor:p},je=new XRWebGLLayer(d,i,We);d.updateRenderState({baseLayer:je})}else{let We=0;ce.depth&&(We=ce.stencil?34041:6402);const je={colorFormat:ce.alpha?6408:6407,depthFormat:We,scaleFactor:p};M=new XRWebGLBinding(d,i),A=M.createProjectionLayer(je),C=i.createFramebuffer(),d.updateRenderState({layers:[A]})}v=await d.requestReferenceSpace(_),ge.setContext(d),ge.start(),a.isPresenting=!0,a.dispatchEvent({type:"sessionstart"})}};const Ot=new gt,Ie=new gt;function ye(Ht,ce){ce===null?Ht.matrixWorld.copy(Ht.matrix):Ht.matrixWorld.multiplyMatrices(ce.matrixWorld,Ht.matrix),Ht.matrixWorldInverse.copy(Ht.matrixWorld).invert()}this.updateCamera=function(Ht){if(d===null)return;ot.near=D.near=U.near=Ht.near,ot.far=D.far=U.far=Ht.far,vt===ot.near&&mt===ot.far||(d.updateRenderState({depthNear:ot.near,depthFar:ot.far}),vt=ot.near,mt=ot.far);const ce=Ht.parent,We=ot.cameras;ye(ot,ce);for(let ze=0;ze<We.length;ze++)ye(We[ze],ce);ot.matrixWorld.decompose(ot.position,ot.quaternion,ot.scale),Ht.position.copy(ot.position),Ht.quaternion.copy(ot.quaternion),Ht.scale.copy(ot.scale),Ht.matrix.copy(ot.matrix),Ht.matrixWorld.copy(ot.matrixWorld);const je=Ht.children;for(let ze=0,fn=je.length;ze<fn;ze++)je[ze].updateMatrixWorld(!0);We.length===2?function(ze,fn,_n){Ot.setFromMatrixPosition(fn.matrixWorld),Ie.setFromMatrixPosition(_n.matrixWorld);const Mn=Ot.distanceTo(Ie),Sn=fn.projectionMatrix.elements,Rt=_n.projectionMatrix.elements,Dt=Sn[14]/(Sn[10]-1),Fe=Sn[14]/(Sn[10]+1),Be=(Sn[9]+1)/Sn[5],pe=(Sn[9]-1)/Sn[5],rn=(Sn[8]-1)/Sn[0],sn=(Rt[8]+1)/Rt[0],be=Dt*rn,xt=Dt*sn,Zt=Mn/(-rn+sn),Te=Zt*-rn;fn.matrixWorld.decompose(ze.position,ze.quaternion,ze.scale),ze.translateX(Te),ze.translateZ(Zt),ze.matrixWorld.compose(ze.position,ze.quaternion,ze.scale),ze.matrixWorldInverse.copy(ze.matrixWorld).invert();const Pe=Dt+Zt,we=Fe+Zt,bn=be-Te,Gn=xt+(Mn-Te),Fn=Be*Fe/we*Pe,_r=pe*Fe/we*Pe;ze.projectionMatrix.makePerspective(bn,Gn,Fn,_r,Pe,we)}(ot,U,D):ot.projectionMatrix.copy(U.projectionMatrix)},this.getCamera=function(){return ot};let xe=null;const ge=new Ph;ge.setAnimationLoop(function(Ht,ce){if(x=ce.getViewerPose(v),x!==null){const je=x.views,ze=d.renderState.baseLayer;d.renderState.layers===void 0&&l.bindXRFramebuffer(ze.framebuffer);let fn=!1;je.length!==ot.cameras.length&&(ot.cameras.length=0,fn=!0);for(let _n=0;_n<je.length;_n++){const Mn=je[_n];let Sn=null;if(d.renderState.layers===void 0)Sn=ze.getViewport(Mn);else{const Dt=M.getViewSubImage(A,Mn);l.bindXRFramebuffer(C),i.framebufferTexture2D(36160,36064,3553,Dt.colorTexture,0),Dt.depthStencilTexture!==void 0&&i.framebufferTexture2D(36160,36096,3553,Dt.depthStencilTexture,0),Sn=Dt.viewport}const Rt=Z[_n];Rt.matrix.fromArray(Mn.transform.matrix),Rt.projectionMatrix.fromArray(Mn.projectionMatrix),Rt.viewport.set(Sn.x,Sn.y,Sn.width,Sn.height),_n===0&&ot.matrix.copy(Rt.matrix),fn===!0&&ot.cameras.push(Rt)}}const We=d.inputSources;for(let je=0;je<R.length;je++){const ze=R[je],fn=We[je];ze.update(fn,ce,v)}xe&&xe(Ht,ce)}),this.setAnimationLoop=function(Ht){xe=Ht},this.dispose=function(){}}}function Jp(m){function t(a,l){a.opacity.value=l.opacity,l.color&&a.diffuse.value.copy(l.color),l.emissive&&a.emissive.value.copy(l.emissive).multiplyScalar(l.emissiveIntensity),l.map&&(a.map.value=l.map),l.alphaMap&&(a.alphaMap.value=l.alphaMap),l.specularMap&&(a.specularMap.value=l.specularMap);const d=m.get(l).envMap;if(d){a.envMap.value=d,a.flipEnvMap.value=d.isCubeTexture&&d._needsFlipEnvMap?-1:1,a.reflectivity.value=l.reflectivity,a.refractionRatio.value=l.refractionRatio;const _=m.get(d).__maxMipLevel;_!==void 0&&(a.maxMipLevel.value=_)}let p,v;l.lightMap&&(a.lightMap.value=l.lightMap,a.lightMapIntensity.value=l.lightMapIntensity),l.aoMap&&(a.aoMap.value=l.aoMap,a.aoMapIntensity.value=l.aoMapIntensity),l.map?p=l.map:l.specularMap?p=l.specularMap:l.displacementMap?p=l.displacementMap:l.normalMap?p=l.normalMap:l.bumpMap?p=l.bumpMap:l.roughnessMap?p=l.roughnessMap:l.metalnessMap?p=l.metalnessMap:l.alphaMap?p=l.alphaMap:l.emissiveMap?p=l.emissiveMap:l.clearcoatMap?p=l.clearcoatMap:l.clearcoatNormalMap?p=l.clearcoatNormalMap:l.clearcoatRoughnessMap&&(p=l.clearcoatRoughnessMap),p!==void 0&&(p.isWebGLRenderTarget&&(p=p.texture),p.matrixAutoUpdate===!0&&p.updateMatrix(),a.uvTransform.value.copy(p.matrix)),l.aoMap?v=l.aoMap:l.lightMap&&(v=l.lightMap),v!==void 0&&(v.isWebGLRenderTarget&&(v=v.texture),v.matrixAutoUpdate===!0&&v.updateMatrix(),a.uv2Transform.value.copy(v.matrix))}function i(a,l){a.roughness.value=l.roughness,a.metalness.value=l.metalness,l.roughnessMap&&(a.roughnessMap.value=l.roughnessMap),l.metalnessMap&&(a.metalnessMap.value=l.metalnessMap),l.emissiveMap&&(a.emissiveMap.value=l.emissiveMap),l.bumpMap&&(a.bumpMap.value=l.bumpMap,a.bumpScale.value=l.bumpScale,l.side===L&&(a.bumpScale.value*=-1)),l.normalMap&&(a.normalMap.value=l.normalMap,a.normalScale.value.copy(l.normalScale),l.side===L&&a.normalScale.value.negate()),l.displacementMap&&(a.displacementMap.value=l.displacementMap,a.displacementScale.value=l.displacementScale,a.displacementBias.value=l.displacementBias),m.get(l).envMap&&(a.envMapIntensity.value=l.envMapIntensity)}return{refreshFogUniforms:function(a,l){a.fogColor.value.copy(l.color),l.isFog?(a.fogNear.value=l.near,a.fogFar.value=l.far):l.isFogExp2&&(a.fogDensity.value=l.density)},refreshMaterialUniforms:function(a,l,d,p,v){l.isMeshBasicMaterial?t(a,l):l.isMeshLambertMaterial?(t(a,l),function(_,x){x.emissiveMap&&(_.emissiveMap.value=x.emissiveMap)}(a,l)):l.isMeshToonMaterial?(t(a,l),function(_,x){x.gradientMap&&(_.gradientMap.value=x.gradientMap),x.emissiveMap&&(_.emissiveMap.value=x.emissiveMap),x.bumpMap&&(_.bumpMap.value=x.bumpMap,_.bumpScale.value=x.bumpScale,x.side===L&&(_.bumpScale.value*=-1)),x.normalMap&&(_.normalMap.value=x.normalMap,_.normalScale.value.copy(x.normalScale),x.side===L&&_.normalScale.value.negate()),x.displacementMap&&(_.displacementMap.value=x.displacementMap,_.displacementScale.value=x.displacementScale,_.displacementBias.value=x.displacementBias)}(a,l)):l.isMeshPhongMaterial?(t(a,l),function(_,x){_.specular.value.copy(x.specular),_.shininess.value=Math.max(x.shininess,1e-4),x.emissiveMap&&(_.emissiveMap.value=x.emissiveMap),x.bumpMap&&(_.bumpMap.value=x.bumpMap,_.bumpScale.value=x.bumpScale,x.side===L&&(_.bumpScale.value*=-1)),x.normalMap&&(_.normalMap.value=x.normalMap,_.normalScale.value.copy(x.normalScale),x.side===L&&_.normalScale.value.negate()),x.displacementMap&&(_.displacementMap.value=x.displacementMap,_.displacementScale.value=x.displacementScale,_.displacementBias.value=x.displacementBias)}(a,l)):l.isMeshStandardMaterial?(t(a,l),l.isMeshPhysicalMaterial?function(_,x,M){i(_,x),_.reflectivity.value=x.reflectivity,_.clearcoat.value=x.clearcoat,_.clearcoatRoughness.value=x.clearcoatRoughness,x.sheen&&_.sheen.value.copy(x.sheen),x.clearcoatMap&&(_.clearcoatMap.value=x.clearcoatMap),x.clearcoatRoughnessMap&&(_.clearcoatRoughnessMap.value=x.clearcoatRoughnessMap),x.clearcoatNormalMap&&(_.clearcoatNormalScale.value.copy(x.clearcoatNormalScale),_.clearcoatNormalMap.value=x.clearcoatNormalMap,x.side===L&&_.clearcoatNormalScale.value.negate()),_.transmission.value=x.transmission,x.transmissionMap&&(_.transmissionMap.value=x.transmissionMap),x.transmission>0&&(_.transmissionSamplerMap.value=M.texture,_.transmissionSamplerSize.value.set(M.width,M.height)),_.thickness.value=x.thickness,x.thicknessMap&&(_.thicknessMap.value=x.thicknessMap),_.attenuationDistance.value=x.attenuationDistance,_.attenuationColor.value.copy(x.attenuationColor)}(a,l,v):i(a,l)):l.isMeshMatcapMaterial?(t(a,l),function(_,x){x.matcap&&(_.matcap.value=x.matcap),x.bumpMap&&(_.bumpMap.value=x.bumpMap,_.bumpScale.value=x.bumpScale,x.side===L&&(_.bumpScale.value*=-1)),x.normalMap&&(_.normalMap.value=x.normalMap,_.normalScale.value.copy(x.normalScale),x.side===L&&_.normalScale.value.negate()),x.displacementMap&&(_.displacementMap.value=x.displacementMap,_.displacementScale.value=x.displacementScale,_.displacementBias.value=x.displacementBias)}(a,l)):l.isMeshDepthMaterial?(t(a,l),function(_,x){x.displacementMap&&(_.displacementMap.value=x.displacementMap,_.displacementScale.value=x.displacementScale,_.displacementBias.value=x.displacementBias)}(a,l)):l.isMeshDistanceMaterial?(t(a,l),function(_,x){x.displacementMap&&(_.displacementMap.value=x.displacementMap,_.displacementScale.value=x.displacementScale,_.displacementBias.value=x.displacementBias),_.referencePosition.value.copy(x.referencePosition),_.nearDistance.value=x.nearDistance,_.farDistance.value=x.farDistance}(a,l)):l.isMeshNormalMaterial?(t(a,l),function(_,x){x.bumpMap&&(_.bumpMap.value=x.bumpMap,_.bumpScale.value=x.bumpScale,x.side===L&&(_.bumpScale.value*=-1)),x.normalMap&&(_.normalMap.value=x.normalMap,_.normalScale.value.copy(x.normalScale),x.side===L&&_.normalScale.value.negate()),x.displacementMap&&(_.displacementMap.value=x.displacementMap,_.displacementScale.value=x.displacementScale,_.displacementBias.value=x.displacementBias)}(a,l)):l.isLineBasicMaterial?(function(_,x){_.diffuse.value.copy(x.color),_.opacity.value=x.opacity}(a,l),l.isLineDashedMaterial&&function(_,x){_.dashSize.value=x.dashSize,_.totalSize.value=x.dashSize+x.gapSize,_.scale.value=x.scale}(a,l)):l.isPointsMaterial?function(_,x,M,C){_.diffuse.value.copy(x.color),_.opacity.value=x.opacity,_.size.value=x.size*M,_.scale.value=.5*C,x.map&&(_.map.value=x.map),x.alphaMap&&(_.alphaMap.value=x.alphaMap);let A;x.map?A=x.map:x.alphaMap&&(A=x.alphaMap),A!==void 0&&(A.matrixAutoUpdate===!0&&A.updateMatrix(),_.uvTransform.value.copy(A.matrix))}(a,l,d,p):l.isSpriteMaterial?function(_,x){_.diffuse.value.copy(x.color),_.opacity.value=x.opacity,_.rotation.value=x.rotation,x.map&&(_.map.value=x.map),x.alphaMap&&(_.alphaMap.value=x.alphaMap);let M;x.map?M=x.map:x.alphaMap&&(M=x.alphaMap),M!==void 0&&(M.matrixAutoUpdate===!0&&M.updateMatrix(),_.uvTransform.value.copy(M.matrix))}(a,l):l.isShadowMaterial?(a.color.value.copy(l.color),a.opacity.value=l.opacity):l.isShaderMaterial&&(l.uniformsNeedUpdate=!1)}}}function Fr(m={}){const t=m.canvas!==void 0?m.canvas:function(){const It=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return It.style.display="block",It}(),i=m.context!==void 0?m.context:null,a=m.alpha!==void 0&&m.alpha,l=m.depth===void 0||m.depth,d=m.stencil===void 0||m.stencil,p=m.antialias!==void 0&&m.antialias,v=m.premultipliedAlpha===void 0||m.premultipliedAlpha,_=m.preserveDrawingBuffer!==void 0&&m.preserveDrawingBuffer,x=m.powerPreference!==void 0?m.powerPreference:"default",M=m.failIfMajorPerformanceCaveat!==void 0&&m.failIfMajorPerformanceCaveat;let C=null,A=null;const R=[],O=[];this.domElement=t,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.gammaFactor=2,this.outputEncoding=Wr,this.physicallyCorrectLights=!1,this.toneMapping=Or,this.toneMappingExposure=1;const U=this;let D=!1,Z=0,ot=0,vt=null,mt=-1,At=null;const Pt=new Ir,Et=new Ir;let Ot=null,Ie=t.width,ye=t.height,xe=1,ge=null,Ht=null;const ce=new Ir(0,0,Ie,ye),We=new Ir(0,0,Ie,ye);let je=!1;const ze=[],fn=new Xa;let _n=!1,Mn=!1,Sn=null;const Rt=new En,Dt=new gt,Fe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Be(){return vt===null?xe:1}let pe,rn,sn,be,xt,Zt,Te,Pe,we,bn,Gn,Fn,_r,Tr,qo,fi,du,_m,ym,xm,Qs,Ca,qe=i;function Cv(It,Me){for(let se=0;se<It.length;se++){const Ce=It[se],en=t.getContext(Ce,Me);if(en!==null)return en}return null}try{const It={alpha:a,depth:l,stencil:d,antialias:p,premultipliedAlpha:v,preserveDrawingBuffer:_,powerPreference:x,failIfMajorPerformanceCaveat:M};if(t.addEventListener("webglcontextlost",Rv,!1),t.addEventListener("webglcontextrestored",Iv,!1),qe===null){const Me=["webgl2","webgl","experimental-webgl"];if(U.isWebGL1Renderer===!0&&Me.shift(),qe=Cv(Me,It),qe===null)throw Cv(Me)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}qe.getShaderPrecisionFormat===void 0&&(qe.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(It){throw console.error("THREE.WebGLRenderer: "+It.message),It}function Pv(){pe=new Rp(qe),rn=new Gi(qe,pe,m),pe.init(rn),Qs=new Wc(qe,pe,rn),sn=new Qd(qe,pe,rn),ze[0]=1029,be=new Lp(qe),xt=new ci,Zt=new Cs(qe,pe,sn,xt,rn,Qs,be),Te=new yl(U),Pe=new qa(qe,rn),Ca=new Pf(qe,pe,Pe,rn),we=new Ih(qe,Pe,be,Ca),bn=new Dc(qe,we,Pe,be),_m=new Oc(qe),qo=new Ic(xt),Gn=new si(U,Te,pe,rn,Ca,qo),Fn=new Jp(xt),_r=new Vc(xt),Tr=new Kd(pe,rn),du=new Rh(U,Te,sn,bn,v),fi=new or(U,bn,rn),ym=new ga(qe,pe,be,rn),xm=new Ip(qe,pe,be,rn),be.programs=Gn.programs,U.capabilities=rn,U.extensions=pe,U.properties=xt,U.renderLists=_r,U.shadowMap=fi,U.state=sn,U.info=be}Pv();const ol=new Hf(U,qe);function Rv(It){It.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),D=!0}function Iv(){console.log("THREE.WebGLRenderer: Context Restored."),D=!1;const It=be.autoReset,Me=fi.enabled,se=fi.autoUpdate,Ce=fi.needsUpdate,en=fi.type;Pv(),be.autoReset=It,fi.enabled=Me,fi.autoUpdate=se,fi.needsUpdate=Ce,fi.type=en}function Lv(It){const Me=It.target;Me.removeEventListener("dispose",Lv),function(se){(function(Ce){const en=xt.get(Ce).programs;en!==void 0&&en.forEach(function(Xr){Gn.releaseProgram(Xr)})})(se),xt.remove(se)}(Me)}this.xr=ol,this.getContext=function(){return qe},this.getContextAttributes=function(){return qe.getContextAttributes()},this.forceContextLoss=function(){const It=pe.get("WEBGL_lose_context");It&&It.loseContext()},this.forceContextRestore=function(){const It=pe.get("WEBGL_lose_context");It&&It.restoreContext()},this.getPixelRatio=function(){return xe},this.setPixelRatio=function(It){It!==void 0&&(xe=It,this.setSize(Ie,ye,!1))},this.getSize=function(It){return It.set(Ie,ye)},this.setSize=function(It,Me,se){ol.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(Ie=It,ye=Me,t.width=Math.floor(It*xe),t.height=Math.floor(Me*xe),se!==!1&&(t.style.width=It+"px",t.style.height=Me+"px"),this.setViewport(0,0,It,Me))},this.getDrawingBufferSize=function(It){return It.set(Ie*xe,ye*xe).floor()},this.setDrawingBufferSize=function(It,Me,se){Ie=It,ye=Me,xe=se,t.width=Math.floor(It*se),t.height=Math.floor(Me*se),this.setViewport(0,0,It,Me)},this.getCurrentViewport=function(It){return It.copy(Pt)},this.getViewport=function(It){return It.copy(ce)},this.setViewport=function(It,Me,se,Ce){It.isVector4?ce.set(It.x,It.y,It.z,It.w):ce.set(It,Me,se,Ce),sn.viewport(Pt.copy(ce).multiplyScalar(xe).floor())},this.getScissor=function(It){return It.copy(We)},this.setScissor=function(It,Me,se,Ce){It.isVector4?We.set(It.x,It.y,It.z,It.w):We.set(It,Me,se,Ce),sn.scissor(Et.copy(We).multiplyScalar(xe).floor())},this.getScissorTest=function(){return je},this.setScissorTest=function(It){sn.setScissorTest(je=It)},this.setOpaqueSort=function(It){ge=It},this.setTransparentSort=function(It){Ht=It},this.getClearColor=function(It){return It.copy(du.getClearColor())},this.setClearColor=function(){du.setClearColor.apply(du,arguments)},this.getClearAlpha=function(){return du.getClearAlpha()},this.setClearAlpha=function(){du.setClearAlpha.apply(du,arguments)},this.clear=function(It,Me,se){let Ce=0;(It===void 0||It)&&(Ce|=16384),(Me===void 0||Me)&&(Ce|=256),(se===void 0||se)&&(Ce|=1024),qe.clear(Ce)},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(){t.removeEventListener("webglcontextlost",Rv,!1),t.removeEventListener("webglcontextrestored",Iv,!1),_r.dispose(),Tr.dispose(),xt.dispose(),Te.dispose(),bn.dispose(),Ca.dispose(),ol.dispose(),ol.removeEventListener("sessionstart",Ov),ol.removeEventListener("sessionend",Dv),Sn&&(Sn.dispose(),Sn=null),vp.stop()},this.renderBufferImmediate=function(It,Me){Ca.initAttributes();const se=xt.get(It);It.hasPositions&&!se.position&&(se.position=qe.createBuffer()),It.hasNormals&&!se.normal&&(se.normal=qe.createBuffer()),It.hasUvs&&!se.uv&&(se.uv=qe.createBuffer()),It.hasColors&&!se.color&&(se.color=qe.createBuffer());const Ce=Me.getAttributes();It.hasPositions&&(qe.bindBuffer(34962,se.position),qe.bufferData(34962,It.positionArray,35048),Ca.enableAttribute(Ce.position),qe.vertexAttribPointer(Ce.position,3,5126,!1,0,0)),It.hasNormals&&(qe.bindBuffer(34962,se.normal),qe.bufferData(34962,It.normalArray,35048),Ca.enableAttribute(Ce.normal),qe.vertexAttribPointer(Ce.normal,3,5126,!1,0,0)),It.hasUvs&&(qe.bindBuffer(34962,se.uv),qe.bufferData(34962,It.uvArray,35048),Ca.enableAttribute(Ce.uv),qe.vertexAttribPointer(Ce.uv,2,5126,!1,0,0)),It.hasColors&&(qe.bindBuffer(34962,se.color),qe.bufferData(34962,It.colorArray,35048),Ca.enableAttribute(Ce.color),qe.vertexAttribPointer(Ce.color,3,5126,!1,0,0)),Ca.disableUnusedAttributes(),qe.drawArrays(4,0,It.count),It.count=0},this.renderBufferDirect=function(It,Me,se,Ce,en,Xr){Me===null&&(Me=Fe);const cr=en.isMesh&&en.matrixWorld.determinant()<0,cn=Bv(It,Me,Ce,en);sn.setMaterial(Ce,cr);let Cr=se.index;const Vn=se.attributes.position;if(Cr===null){if(Vn===void 0||Vn.count===0)return}else if(Cr.count===0)return;let Vr,sr=1;Ce.wireframe===!0&&(Cr=we.getWireframeAttribute(se),sr=2),(Ce.morphTargets||Ce.morphNormals)&&_m.update(en,se,Ce,cn),Ca.setup(en,Ce,cn,se,Cr);let kr=ym;Cr!==null&&(Vr=Pe.get(Cr),kr=xm,kr.setIndex(Vr));const Oo=Cr!==null?Cr.count:Vn.count,Ci=se.drawRange.start*sr,pu=se.drawRange.count*sr,mi=Xr!==null?Xr.start*sr:0,eh=Xr!==null?Xr.count*sr:1/0,Yo=Math.max(Ci,mi),sl=Math.min(Oo,Ci+pu,mi+eh)-1,Fs=Math.max(0,sl-Yo+1);if(Fs!==0){if(en.isMesh)Ce.wireframe===!0?(sn.setLineWidth(Ce.wireframeLinewidth*Be()),kr.setMode(1)):kr.setMode(4);else if(en.isLine){let bm=Ce.linewidth;bm===void 0&&(bm=1),sn.setLineWidth(bm*Be()),en.isLineSegments?kr.setMode(1):en.isLineLoop?kr.setMode(2):kr.setMode(3)}else en.isPoints?kr.setMode(0):en.isSprite&&kr.setMode(4);if(en.isInstancedMesh)kr.renderInstances(Yo,Fs,en.count);else if(se.isInstancedBufferGeometry){const bm=Math.min(se.instanceCount,se._maxInstanceCount);kr.renderInstances(Yo,Fs,bm)}else kr.render(Yo,Fs)}},this.compile=function(It,Me){A=Tr.get(It),A.init(),It.traverseVisible(function(se){se.isLight&&se.layers.test(Me.layers)&&(A.pushLight(se),se.castShadow&&A.pushShadow(se))}),A.setupLights(),It.traverse(function(se){const Ce=se.material;if(Ce)if(Array.isArray(Ce))for(let en=0;en<Ce.length;en++)Fg(Ce[en],It,se);else Fg(Ce,It,se)})};let Ng=null;function Ov(){vp.stop()}function Dv(){vp.start()}const vp=new Ph;function ig(It,Me,se){const Ce=Me.isScene===!0?Me.overrideMaterial:null;for(let en=0,Xr=It.length;en<Xr;en++){const cr=It[en],cn=cr.object,Cr=cr.geometry,Vn=Ce===null?cr.material:Ce,Vr=cr.group;if(se.isArrayCamera){const sr=se.cameras;for(let kr=0,Oo=sr.length;kr<Oo;kr++){const Ci=sr[kr];cn.layers.test(Ci.layers)&&(sn.viewport(Pt.copy(Ci.viewport)),A.setupLightsView(Ci),Nv(cn,Me,Ci,Cr,Vn,Vr))}}else Nv(cn,Me,se,Cr,Vn,Vr)}}function Nv(It,Me,se,Ce,en,Xr){if(It.onBeforeRender(U,Me,se,Ce,en,Xr),It.modelViewMatrix.multiplyMatrices(se.matrixWorldInverse,It.matrixWorld),It.normalMatrix.getNormalMatrix(It.modelViewMatrix),It.isImmediateRenderObject){const cr=Bv(se,Me,en,It);sn.setMaterial(en),Ca.reset(),function(cn,Cr){cn.render(function(Vn){U.renderBufferImmediate(Vn,Cr)})}(It,cr)}else en.transparent===!0&&en.side===k?(en.side=L,en.needsUpdate=!0,U.renderBufferDirect(se,Me,Ce,en,It,Xr),en.side=zt,en.needsUpdate=!0,U.renderBufferDirect(se,Me,Ce,en,It,Xr),en.side=k):U.renderBufferDirect(se,Me,Ce,en,It,Xr);It.onAfterRender(U,Me,se,Ce,en,Xr)}function Fg(It,Me,se){Me.isScene!==!0&&(Me=Fe);const Ce=xt.get(It),en=A.state.lights,Xr=A.state.shadowsArray,cr=en.state.version,cn=Gn.getParameters(It,en.state,Xr,Me,se),Cr=Gn.getProgramCacheKey(cn);let Vn=Ce.programs;Ce.environment=It.isMeshStandardMaterial?Me.environment:null,Ce.fog=Me.fog,Ce.envMap=Te.get(It.envMap||Ce.environment),Vn===void 0&&(It.addEventListener("dispose",Lv),Vn=new Map,Ce.programs=Vn);let Vr=Vn.get(Cr);if(Vr!==void 0){if(Ce.currentProgram===Vr&&Ce.lightsStateVersion===cr)return Fv(It,cn),Vr}else cn.uniforms=Gn.getUniforms(It),It.onBuild(cn,U),It.onBeforeCompile(cn,U),Vr=Gn.acquireProgram(cn,Cr),Vn.set(Cr,Vr),Ce.uniforms=cn.uniforms;const sr=Ce.uniforms;(It.isShaderMaterial||It.isRawShaderMaterial)&&It.clipping!==!0||(sr.clippingPlanes=qo.uniform),Fv(It,cn),Ce.needsLights=function(Ci){return Ci.isMeshLambertMaterial||Ci.isMeshToonMaterial||Ci.isMeshPhongMaterial||Ci.isMeshStandardMaterial||Ci.isShadowMaterial||Ci.isShaderMaterial&&Ci.lights===!0}(It),Ce.lightsStateVersion=cr,Ce.needsLights&&(sr.ambientLightColor.value=en.state.ambient,sr.lightProbe.value=en.state.probe,sr.directionalLights.value=en.state.directional,sr.directionalLightShadows.value=en.state.directionalShadow,sr.spotLights.value=en.state.spot,sr.spotLightShadows.value=en.state.spotShadow,sr.rectAreaLights.value=en.state.rectArea,sr.ltc_1.value=en.state.rectAreaLTC1,sr.ltc_2.value=en.state.rectAreaLTC2,sr.pointLights.value=en.state.point,sr.pointLightShadows.value=en.state.pointShadow,sr.hemisphereLights.value=en.state.hemi,sr.directionalShadowMap.value=en.state.directionalShadowMap,sr.directionalShadowMatrix.value=en.state.directionalShadowMatrix,sr.spotShadowMap.value=en.state.spotShadowMap,sr.spotShadowMatrix.value=en.state.spotShadowMatrix,sr.pointShadowMap.value=en.state.pointShadowMap,sr.pointShadowMatrix.value=en.state.pointShadowMatrix);const kr=Vr.getUniforms(),Oo=va.seqWithValue(kr.seq,sr);return Ce.currentProgram=Vr,Ce.uniformsList=Oo,Vr}function Fv(It,Me){const se=xt.get(It);se.outputEncoding=Me.outputEncoding,se.instancing=Me.instancing,se.skinning=Me.skinning,se.numClippingPlanes=Me.numClippingPlanes,se.numIntersection=Me.numClipIntersection,se.vertexAlphas=Me.vertexAlphas}function Bv(It,Me,se,Ce){Me.isScene!==!0&&(Me=Fe),Zt.resetTextureUnits();const en=Me.fog,Xr=se.isMeshStandardMaterial?Me.environment:null,cr=vt===null?U.outputEncoding:vt.texture.encoding,cn=Te.get(se.envMap||Xr),Cr=se.vertexColors===!0&&Ce.geometry&&Ce.geometry.attributes.color&&Ce.geometry.attributes.color.itemSize===4,Vn=xt.get(se),Vr=A.state.lights;if(_n===!0&&(Mn===!0||It!==At)){const Fs=It===At&&se.id===mt;qo.setState(se,It,Fs)}let sr=!1;se.version===Vn.__version?Vn.needsLights&&Vn.lightsStateVersion!==Vr.state.version||Vn.outputEncoding!==cr||Ce.isInstancedMesh&&Vn.instancing===!1?sr=!0:Ce.isInstancedMesh||Vn.instancing!==!0?Ce.isSkinnedMesh&&Vn.skinning===!1?sr=!0:Ce.isSkinnedMesh||Vn.skinning!==!0?Vn.envMap!==cn||se.fog&&Vn.fog!==en?sr=!0:Vn.numClippingPlanes===void 0||Vn.numClippingPlanes===qo.numPlanes&&Vn.numIntersection===qo.numIntersection?Vn.vertexAlphas!==Cr&&(sr=!0):sr=!0:sr=!0:sr=!0:(sr=!0,Vn.__version=se.version);let kr=Vn.currentProgram;sr===!0&&(kr=Fg(se,Me,Ce));let Oo=!1,Ci=!1,pu=!1;const mi=kr.getUniforms(),eh=Vn.uniforms;if(sn.useProgram(kr.program)&&(Oo=!0,Ci=!0,pu=!0),se.id!==mt&&(mt=se.id,Ci=!0),Oo||At!==It){if(mi.setValue(qe,"projectionMatrix",It.projectionMatrix),rn.logarithmicDepthBuffer&&mi.setValue(qe,"logDepthBufFC",2/(Math.log(It.far+1)/Math.LN2)),At!==It&&(At=It,Ci=!0,pu=!0),se.isShaderMaterial||se.isMeshPhongMaterial||se.isMeshToonMaterial||se.isMeshStandardMaterial||se.envMap){const Fs=mi.map.cameraPosition;Fs!==void 0&&Fs.setValue(qe,Dt.setFromMatrixPosition(It.matrixWorld))}(se.isMeshPhongMaterial||se.isMeshToonMaterial||se.isMeshLambertMaterial||se.isMeshBasicMaterial||se.isMeshStandardMaterial||se.isShaderMaterial)&&mi.setValue(qe,"isOrthographic",It.isOrthographicCamera===!0),(se.isMeshPhongMaterial||se.isMeshToonMaterial||se.isMeshLambertMaterial||se.isMeshBasicMaterial||se.isMeshStandardMaterial||se.isShaderMaterial||se.isShadowMaterial||Ce.isSkinnedMesh)&&mi.setValue(qe,"viewMatrix",It.matrixWorldInverse)}if(Ce.isSkinnedMesh){mi.setOptional(qe,Ce,"bindMatrix"),mi.setOptional(qe,Ce,"bindMatrixInverse");const Fs=Ce.skeleton;Fs&&(rn.floatVertexTextures?(Fs.boneTexture===null&&Fs.computeBoneTexture(),mi.setValue(qe,"boneTexture",Fs.boneTexture,Zt),mi.setValue(qe,"boneTextureSize",Fs.boneTextureSize)):mi.setOptional(qe,Fs,"boneMatrices"))}var Yo,sl;return(Ci||Vn.receiveShadow!==Ce.receiveShadow)&&(Vn.receiveShadow=Ce.receiveShadow,mi.setValue(qe,"receiveShadow",Ce.receiveShadow)),Ci&&(mi.setValue(qe,"toneMappingExposure",U.toneMappingExposure),Vn.needsLights&&(sl=pu,(Yo=eh).ambientLightColor.needsUpdate=sl,Yo.lightProbe.needsUpdate=sl,Yo.directionalLights.needsUpdate=sl,Yo.directionalLightShadows.needsUpdate=sl,Yo.pointLights.needsUpdate=sl,Yo.pointLightShadows.needsUpdate=sl,Yo.spotLights.needsUpdate=sl,Yo.spotLightShadows.needsUpdate=sl,Yo.rectAreaLights.needsUpdate=sl,Yo.hemisphereLights.needsUpdate=sl),en&&se.fog&&Fn.refreshFogUniforms(eh,en),Fn.refreshMaterialUniforms(eh,se,xe,ye,Sn),va.upload(qe,Vn.uniformsList,eh,Zt)),se.isShaderMaterial&&se.uniformsNeedUpdate===!0&&(va.upload(qe,Vn.uniformsList,eh,Zt),se.uniformsNeedUpdate=!1),se.isSpriteMaterial&&mi.setValue(qe,"center",Ce.center),mi.setValue(qe,"modelViewMatrix",Ce.modelViewMatrix),mi.setValue(qe,"normalMatrix",Ce.normalMatrix),mi.setValue(qe,"modelMatrix",Ce.matrixWorld),kr}vp.setAnimationLoop(function(It){Ng&&Ng(It)}),typeof window!="undefined"&&vp.setContext(window),this.setAnimationLoop=function(It){Ng=It,ol.setAnimationLoop(It),It===null?vp.stop():vp.start()},ol.addEventListener("sessionstart",Ov),ol.addEventListener("sessionend",Dv),this.render=function(It,Me){if(Me!==void 0&&Me.isCamera!==!0)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(D===!0)return;It.autoUpdate===!0&&It.updateMatrixWorld(),Me.parent===null&&Me.updateMatrixWorld(),ol.enabled===!0&&ol.isPresenting===!0&&(ol.cameraAutoUpdate===!0&&ol.updateCamera(Me),Me=ol.getCamera()),It.isScene===!0&&It.onBeforeRender(U,It,Me,vt),A=Tr.get(It,O.length),A.init(),O.push(A),Rt.multiplyMatrices(Me.projectionMatrix,Me.matrixWorldInverse),fn.setFromProjectionMatrix(Rt),Mn=this.localClippingEnabled,_n=qo.init(this.clippingPlanes,Mn,Me),C=_r.get(It,R.length),C.init(),R.push(C),function cr(cn,Cr,Vn,Vr){if(cn.visible===!1)return;if(cn.layers.test(Cr.layers)){if(cn.isGroup)Vn=cn.renderOrder;else if(cn.isLOD)cn.autoUpdate===!0&&cn.update(Cr);else if(cn.isLight)A.pushLight(cn),cn.castShadow&&A.pushShadow(cn);else if(cn.isSprite){if(!cn.frustumCulled||fn.intersectsSprite(cn)){Vr&&Dt.setFromMatrixPosition(cn.matrixWorld).applyMatrix4(Rt);const kr=bn.update(cn),Oo=cn.material;Oo.visible&&C.push(cn,kr,Oo,Vn,Dt.z,null)}}else if(cn.isImmediateRenderObject)Vr&&Dt.setFromMatrixPosition(cn.matrixWorld).applyMatrix4(Rt),C.push(cn,null,cn.material,Vn,Dt.z,null);else if((cn.isMesh||cn.isLine||cn.isPoints)&&(cn.isSkinnedMesh&&cn.skeleton.frame!==be.render.frame&&(cn.skeleton.update(),cn.skeleton.frame=be.render.frame),!cn.frustumCulled||fn.intersectsObject(cn))){Vr&&Dt.setFromMatrixPosition(cn.matrixWorld).applyMatrix4(Rt);const kr=bn.update(cn),Oo=cn.material;if(Array.isArray(Oo)){const Ci=kr.groups;for(let pu=0,mi=Ci.length;pu<mi;pu++){const eh=Ci[pu],Yo=Oo[eh.materialIndex];Yo&&Yo.visible&&C.push(cn,kr,Yo,Vn,Dt.z,eh)}}else Oo.visible&&C.push(cn,kr,Oo,Vn,Dt.z,null)}}const sr=cn.children;for(let kr=0,Oo=sr.length;kr<Oo;kr++)cr(sr[kr],Cr,Vn,Vr)}(It,Me,0,U.sortObjects),C.finish(),U.sortObjects===!0&&C.sort(ge,Ht),_n===!0&&qo.beginShadows();const se=A.state.shadowsArray;fi.render(se,It,Me),A.setupLights(),A.setupLightsView(Me),_n===!0&&qo.endShadows(),this.info.autoReset===!0&&this.info.reset(),du.render(C,It);const Ce=C.opaque,en=C.transmissive,Xr=C.transparent;Ce.length>0&&ig(Ce,It,Me),en.length>0&&function(cr,cn,Cr,Vn){if(Sn===null){const kr=p===!0&&rn.isWebGL2===!0;Sn=new(kr?wc:Bo)(1024,1024,{generateMipmaps:!0,type:Qs.convert(Ft)!==null?Ft:uo,minFilter:Yr,magFilter:wt,wrapS:St,wrapT:St})}const Vr=U.getRenderTarget();U.setRenderTarget(Sn),U.clear();const sr=U.toneMapping;U.toneMapping=Or,ig(cr,Cr,Vn),U.toneMapping=sr,Zt.updateMultisampleRenderTarget(Sn),Zt.updateRenderTargetMipmap(Sn),U.setRenderTarget(Vr),ig(cn,Cr,Vn)}(Ce,en,It,Me),Xr.length>0&&ig(Xr,It,Me),vt!==null&&(Zt.updateMultisampleRenderTarget(vt),Zt.updateRenderTargetMipmap(vt)),It.isScene===!0&&It.onAfterRender(U,It,Me),sn.buffers.depth.setTest(!0),sn.buffers.depth.setMask(!0),sn.buffers.color.setMask(!0),sn.setPolygonOffset(!1),Ca.resetDefaultState(),mt=-1,At=null,O.pop(),A=O.length>0?O[O.length-1]:null,R.pop(),C=R.length>0?R[R.length-1]:null},this.getActiveCubeFace=function(){return Z},this.getActiveMipmapLevel=function(){return ot},this.getRenderTarget=function(){return vt},this.setRenderTarget=function(It,Me=0,se=0){vt=It,Z=Me,ot=se,It&&xt.get(It).__webglFramebuffer===void 0&&Zt.setupRenderTarget(It);let Ce=null,en=!1,Xr=!1;if(It){const cr=It.texture;(cr.isDataTexture3D||cr.isDataTexture2DArray)&&(Xr=!0);const cn=xt.get(It).__webglFramebuffer;It.isWebGLCubeRenderTarget?(Ce=cn[Me],en=!0):Ce=It.isWebGLMultisampleRenderTarget?xt.get(It).__webglMultisampledFramebuffer:cn,Pt.copy(It.viewport),Et.copy(It.scissor),Ot=It.scissorTest}else Pt.copy(ce).multiplyScalar(xe).floor(),Et.copy(We).multiplyScalar(xe).floor(),Ot=je;if(sn.bindFramebuffer(36160,Ce)&&rn.drawBuffers){let cr=!1;if(It)if(It.isWebGLMultipleRenderTargets){const cn=It.texture;if(ze.length!==cn.length||ze[0]!==36064){for(let Cr=0,Vn=cn.length;Cr<Vn;Cr++)ze[Cr]=36064+Cr;ze.length=cn.length,cr=!0}}else ze.length===1&&ze[0]===36064||(ze[0]=36064,ze.length=1,cr=!0);else ze.length===1&&ze[0]===1029||(ze[0]=1029,ze.length=1,cr=!0);cr&&(rn.isWebGL2?qe.drawBuffers(ze):pe.get("WEBGL_draw_buffers").drawBuffersWEBGL(ze))}if(sn.viewport(Pt),sn.scissor(Et),sn.setScissorTest(Ot),en){const cr=xt.get(It.texture);qe.framebufferTexture2D(36160,36064,34069+Me,cr.__webglTexture,se)}else if(Xr){const cr=xt.get(It.texture),cn=Me||0;qe.framebufferTextureLayer(36160,36064,cr.__webglTexture,se||0,cn)}},this.readRenderTargetPixels=function(It,Me,se,Ce,en,Xr,cr){if(!It||!It.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let cn=xt.get(It).__webglFramebuffer;if(It.isWebGLCubeRenderTarget&&cr!==void 0&&(cn=cn[cr]),cn){sn.bindFramebuffer(36160,cn);try{const Cr=It.texture,Vn=Cr.format,Vr=Cr.type;if(Vn!==Tn&&Qs.convert(Vn)!==qe.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const sr=Vr===Ft&&(pe.has("EXT_color_buffer_half_float")||rn.isWebGL2&&pe.has("EXT_color_buffer_float"));if(!(Vr===uo||Qs.convert(Vr)===qe.getParameter(35738)||Vr===ee&&(rn.isWebGL2||pe.has("OES_texture_float")||pe.has("WEBGL_color_buffer_float"))||sr))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");qe.checkFramebufferStatus(36160)===36053?Me>=0&&Me<=It.width-Ce&&se>=0&&se<=It.height-en&&qe.readPixels(Me,se,Ce,en,Qs.convert(Vn),Qs.convert(Vr),Xr):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const Cr=vt!==null?xt.get(vt).__webglFramebuffer:null;sn.bindFramebuffer(36160,Cr)}}},this.copyFramebufferToTexture=function(It,Me,se=0){const Ce=Math.pow(2,-se),en=Math.floor(Me.image.width*Ce),Xr=Math.floor(Me.image.height*Ce);let cr=Qs.convert(Me.format);rn.isWebGL2&&(cr===6407&&(cr=32849),cr===6408&&(cr=32856)),Zt.setTexture2D(Me,0),qe.copyTexImage2D(3553,se,cr,It.x,It.y,en,Xr,0),sn.unbindTexture()},this.copyTextureToTexture=function(It,Me,se,Ce=0){const en=Me.image.width,Xr=Me.image.height,cr=Qs.convert(se.format),cn=Qs.convert(se.type);Zt.setTexture2D(se,0),qe.pixelStorei(37440,se.flipY),qe.pixelStorei(37441,se.premultiplyAlpha),qe.pixelStorei(3317,se.unpackAlignment),Me.isDataTexture?qe.texSubImage2D(3553,Ce,It.x,It.y,en,Xr,cr,cn,Me.image.data):Me.isCompressedTexture?qe.compressedTexSubImage2D(3553,Ce,It.x,It.y,Me.mipmaps[0].width,Me.mipmaps[0].height,cr,Me.mipmaps[0].data):qe.texSubImage2D(3553,Ce,It.x,It.y,cr,cn,Me.image),Ce===0&&se.generateMipmaps&&qe.generateMipmap(3553),sn.unbindTexture()},this.copyTextureToTexture3D=function(It,Me,se,Ce,en=0){if(U.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const Xr=It.max.x-It.min.x+1,cr=It.max.y-It.min.y+1,cn=It.max.z-It.min.z+1,Cr=Qs.convert(Ce.format),Vn=Qs.convert(Ce.type);let Vr;if(Ce.isDataTexture3D)Zt.setTexture3D(Ce,0),Vr=32879;else{if(!Ce.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");Zt.setTexture2DArray(Ce,0),Vr=35866}qe.pixelStorei(37440,Ce.flipY),qe.pixelStorei(37441,Ce.premultiplyAlpha),qe.pixelStorei(3317,Ce.unpackAlignment);const sr=qe.getParameter(3314),kr=qe.getParameter(32878),Oo=qe.getParameter(3316),Ci=qe.getParameter(3315),pu=qe.getParameter(32877),mi=se.isCompressedTexture?se.mipmaps[0]:se.image;qe.pixelStorei(3314,mi.width),qe.pixelStorei(32878,mi.height),qe.pixelStorei(3316,It.min.x),qe.pixelStorei(3315,It.min.y),qe.pixelStorei(32877,It.min.z),se.isDataTexture||se.isDataTexture3D?qe.texSubImage3D(Vr,en,Me.x,Me.y,Me.z,Xr,cr,cn,Cr,Vn,mi.data):se.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),qe.compressedTexSubImage3D(Vr,en,Me.x,Me.y,Me.z,Xr,cr,cn,Cr,mi.data)):qe.texSubImage3D(Vr,en,Me.x,Me.y,Me.z,Xr,cr,cn,Cr,Vn,mi),qe.pixelStorei(3314,sr),qe.pixelStorei(32878,kr),qe.pixelStorei(3316,Oo),qe.pixelStorei(3315,Ci),qe.pixelStorei(32877,pu),en===0&&Ce.generateMipmaps&&qe.generateMipmap(Vr),sn.unbindTexture()},this.initTexture=function(It){Zt.setTexture2D(It,0),sn.unbindTexture()},this.resetState=function(){Z=0,ot=0,vt=null,sn.reset(),Ca.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class $p extends Fr{}$p.prototype.isWebGL1Renderer=!0;class nu{constructor(t,i=25e-5){this.name="",this.color=new pn(t),this.density=i}clone(){return new nu(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}nu.prototype.isFogExp2=!0;class ru{constructor(t,i=1,a=1e3){this.name="",this.color=new pn(t),this.near=i,this.far=a}clone(){return new ru(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}ru.prototype.isFog=!0;class Gh extends ar{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,i){return super.copy(t,i),t.background!==null&&(this.background=t.background.clone()),t.environment!==null&&(this.environment=t.environment.clone()),t.fog!==null&&(this.fog=t.fog.clone()),t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const i=super.toJSON(t);return this.fog!==null&&(i.object.fog=this.fog.toJSON()),i}}Gh.prototype.isScene=!0;class wl{constructor(t,i){this.array=t,this.stride=i,this.count=t!==void 0?t.length/i:0,this.usage=Ba,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Fo()}onUploadCallback(){}set needsUpdate(t){t===!0&&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(t,i,a){t*=this.stride,a*=i.stride;for(let l=0,d=this.stride;l<d;l++)this.array[t+l]=i.array[a+l];return this}set(t,i=0){return this.array.set(t,i),this}clone(t){t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Fo()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const i=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),a=new this.constructor(i,this.stride);return a.setUsage(this.usage),a}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Fo()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(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}}}wl.prototype.isInterleavedBuffer=!0;const ai=new gt;class ri{constructor(t,i,a,l=!1){this.name="",this.data=t,this.itemSize=i,this.offset=a,this.normalized=l===!0}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let i=0,a=this.data.count;i<a;i++)ai.x=this.getX(i),ai.y=this.getY(i),ai.z=this.getZ(i),ai.applyMatrix4(t),this.setXYZ(i,ai.x,ai.y,ai.z);return this}applyNormalMatrix(t){for(let i=0,a=this.count;i<a;i++)ai.x=this.getX(i),ai.y=this.getY(i),ai.z=this.getZ(i),ai.applyNormalMatrix(t),this.setXYZ(i,ai.x,ai.y,ai.z);return this}transformDirection(t){for(let i=0,a=this.count;i<a;i++)ai.x=this.getX(i),ai.y=this.getY(i),ai.z=this.getZ(i),ai.transformDirection(t),this.setXYZ(i,ai.x,ai.y,ai.z);return this}setX(t,i){return this.data.array[t*this.data.stride+this.offset]=i,this}setY(t,i){return this.data.array[t*this.data.stride+this.offset+1]=i,this}setZ(t,i){return this.data.array[t*this.data.stride+this.offset+2]=i,this}setW(t,i){return this.data.array[t*this.data.stride+this.offset+3]=i,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,i,a){return t=t*this.data.stride+this.offset,this.data.array[t+0]=i,this.data.array[t+1]=a,this}setXYZ(t,i,a,l){return t=t*this.data.stride+this.offset,this.data.array[t+0]=i,this.data.array[t+1]=a,this.data.array[t+2]=l,this}setXYZW(t,i,a,l,d){return t=t*this.data.stride+this.offset,this.data.array[t+0]=i,this.data.array[t+1]=a,this.data.array[t+2]=l,this.data.array[t+3]=d,this}clone(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const i=[];for(let a=0;a<this.count;a++){const l=a*this.data.stride+this.offset;for(let d=0;d<this.itemSize;d++)i.push(this.data.array[l+d])}return new Kn(new this.array.constructor(i),this.itemSize,this.normalized)}return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new ri(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const i=[];for(let a=0;a<this.count;a++){const l=a*this.data.stride+this.offset;for(let d=0;d<this.itemSize;d++)i.push(this.data.array[l+d])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:i,normalized:this.normalized}}return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}ri.prototype.isInterleavedBufferAttribute=!0;class xo extends Ni{constructor(t){super(),this.type="SpriteMaterial",this.color=new pn(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}}let iu;xo.prototype.isSpriteMaterial=!0;const Nu=new gt,Fu=new gt,Vo=new gt,Ps=new He,gs=new He,Hh=new En,Rs=new gt,Sl=new gt,Bu=new gt,Is=new He,Xc=new He,ku=new He;class Uu extends ar{constructor(t){if(super(),this.type="Sprite",iu===void 0){iu=new zn;const i=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),a=new wl(i,5);iu.setIndex([0,1,2,0,2,3]),iu.setAttribute("position",new ri(a,3,0,!1)),iu.setAttribute("uv",new ri(a,2,3,!1))}this.geometry=iu,this.material=t!==void 0?t:new xo,this.center=new He(.5,.5)}raycast(t,i){t.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Fu.setFromMatrixScale(this.matrixWorld),Hh.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),Vo.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Fu.multiplyScalar(-Vo.z);const a=this.material.rotation;let l,d;a!==0&&(d=Math.cos(a),l=Math.sin(a));const p=this.center;zh(Rs.set(-.5,-.5,0),Vo,p,Fu,l,d),zh(Sl.set(.5,-.5,0),Vo,p,Fu,l,d),zh(Bu.set(.5,.5,0),Vo,p,Fu,l,d),Is.set(0,0),Xc.set(1,0),ku.set(1,1);let v=t.ray.intersectTriangle(Rs,Sl,Bu,!1,Nu);if(v===null&&(zh(Sl.set(-.5,.5,0),Vo,p,Fu,l,d),Xc.set(0,1),v=t.ray.intersectTriangle(Rs,Bu,Sl,!1,Nu),v===null))return;const _=t.ray.origin.distanceTo(Nu);_<t.near||_>t.far||i.push({distance:_,point:Nu.clone(),uv:bi.getUV(Nu,Rs,Sl,Bu,Is,Xc,ku,new He),face:null,object:this})}copy(t){return super.copy(t),t.center!==void 0&&this.center.copy(t.center),this.material=t.material,this}}function zh(m,t,i,a,l,d){Ps.subVectors(m,i).addScalar(.5).multiply(a),l!==void 0?(gs.x=d*Ps.x-l*Ps.y,gs.y=l*Ps.x+d*Ps.y):gs.copy(Ps),m.copy(t),m.x+=gs.x,m.y+=gs.y,m.applyMatrix4(Hh)}Uu.prototype.isSprite=!0;const jh=new gt,tp=new gt;class Vh extends ar{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const i=t.levels;for(let a=0,l=i.length;a<l;a++){const d=i[a];this.addLevel(d.object.clone(),d.distance)}return this.autoUpdate=t.autoUpdate,this}addLevel(t,i=0){i=Math.abs(i);const a=this.levels;let l;for(l=0;l<a.length&&!(i<a[l].distance);l++);return a.splice(l,0,{distance:i,object:t}),this.add(t),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(t){const i=this.levels;if(i.length>0){let a,l;for(a=1,l=i.length;a<l&&!(t<i[a].distance);a++);return i[a-1].object}return null}raycast(t,i){if(this.levels.length>0){jh.setFromMatrixPosition(this.matrixWorld);const a=t.ray.origin.distanceTo(jh);this.getObjectForDistance(a).raycast(t,i)}}update(t){const i=this.levels;if(i.length>1){jh.setFromMatrixPosition(t.matrixWorld),tp.setFromMatrixPosition(this.matrixWorld);const a=jh.distanceTo(tp)/t.zoom;let l,d;for(i[0].object.visible=!0,l=1,d=i.length;l<d&&a>=i[l].distance;l++)i[l-1].object.visible=!1,i[l].object.visible=!0;for(this._currentLevel=l-1;l<d;l++)i[l].object.visible=!1}}toJSON(t){const i=super.toJSON(t);this.autoUpdate===!1&&(i.object.autoUpdate=!1),i.object.levels=[];const a=this.levels;for(let l=0,d=a.length;l<d;l++){const p=a[l];i.object.levels.push({object:p.object.uuid,distance:p.distance})}return i}}const ep=new gt,np=new Ir,Gu=new Ir,rp=new gt,qc=new En;class Yc extends Bi{constructor(t,i){super(t,i),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new En,this.bindMatrixInverse=new En}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,i){this.skeleton=t,i===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),i=this.matrixWorld),this.bindMatrix.copy(i),this.bindMatrixInverse.copy(i).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new Ir,i=this.geometry.attributes.skinWeight;for(let a=0,l=i.count;a<l;a++){t.x=i.getX(a),t.y=i.getY(a),t.z=i.getZ(a),t.w=i.getW(a);const d=1/t.manhattanLength();d!==1/0?t.multiplyScalar(d):t.set(1,0,0,0),i.setXYZW(a,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(t,i){const a=this.skeleton,l=this.geometry;np.fromBufferAttribute(l.attributes.skinIndex,t),Gu.fromBufferAttribute(l.attributes.skinWeight,t),ep.fromBufferAttribute(l.attributes.position,t).applyMatrix4(this.bindMatrix),i.set(0,0,0);for(let d=0;d<4;d++){const p=Gu.getComponent(d);if(p!==0){const v=np.getComponent(d);qc.multiplyMatrices(a.bones[v].matrixWorld,a.boneInverses[v]),i.addScaledVector(rp.copy(ep).applyMatrix4(qc),p)}}return i.applyMatrix4(this.bindMatrixInverse)}}Yc.prototype.isSkinnedMesh=!0;class no extends ar{constructor(){super(),this.type="Bone"}}no.prototype.isBone=!0;class Ls extends ni{constructor(t=null,i=1,a=1,l,d,p,v,_,x=wt,M=wt,C,A){super(null,p,v,_,x,M,l,d,C,A),this.image={data:t,width:i,height:a},this.magFilter=x,this.minFilter=M,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}Ls.prototype.isDataTexture=!0;const Zc=new En,Kp=new En;class Hu{constructor(t=[],i=[]){this.uuid=Fo(),this.bones=t.slice(0),this.boneInverses=i,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){const t=this.bones,i=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),i.length===0)this.calculateInverses();else if(t.length!==i.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let a=0,l=this.bones.length;a<l;a++)this.boneInverses.push(new En)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,i=this.bones.length;t<i;t++){const a=new En;this.bones[t]&&a.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(a)}}pose(){for(let t=0,i=this.bones.length;t<i;t++){const a=this.bones[t];a&&a.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,i=this.bones.length;t<i;t++){const a=this.bones[t];a&&(a.parent&&a.parent.isBone?(a.matrix.copy(a.parent.matrixWorld).invert(),a.matrix.multiply(a.matrixWorld)):a.matrix.copy(a.matrixWorld),a.matrix.decompose(a.position,a.quaternion,a.scale))}}update(){const t=this.bones,i=this.boneInverses,a=this.boneMatrices,l=this.boneTexture;for(let d=0,p=t.length;d<p;d++){const v=t[d]?t[d].matrixWorld:Kp;Zc.multiplyMatrices(v,i[d]),Zc.toArray(a,16*d)}l!==null&&(l.needsUpdate=!0)}clone(){return new Hu(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(4*this.bones.length);t=to(t),t=Math.max(t,4);const i=new Float32Array(t*t*4);i.set(this.boneMatrices);const a=new Ls(i,t,t,Tn,ee);return this.boneMatrices=i,this.boneTexture=a,this.boneTextureSize=t,this}getBoneByName(t){for(let i=0,a=this.bones.length;i<a;i++){const l=this.bones[i];if(l.name===t)return l}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,i){this.uuid=t.uuid;for(let a=0,l=t.bones.length;a<l;a++){const d=t.bones[a];let p=i[d];p===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",d),p=new no),this.bones.push(p),this.boneInverses.push(new En().fromArray(t.boneInverses[a]))}return this.init(),this}toJSON(){const t={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const i=this.bones,a=this.boneInverses;for(let l=0,d=i.length;l<d;l++){const p=i[l];t.bones.push(p.uuid);const v=a[l];t.boneInverses.push(v.toArray())}return t}}const Jc=new En,Qp=new En,$c=[],Wh=new Bi;class Kc extends Bi{constructor(t,i,a){super(t,i),this.instanceMatrix=new Kn(new Float32Array(16*a),16),this.instanceColor=null,this.count=a,this.frustumCulled=!1}copy(t){return super.copy(t),this.instanceMatrix.copy(t.instanceMatrix),t.instanceColor!==null&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,this}getColorAt(t,i){i.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,i){i.fromArray(this.instanceMatrix.array,16*t)}raycast(t,i){const a=this.matrixWorld,l=this.count;if(Wh.geometry=this.geometry,Wh.material=this.material,Wh.material!==void 0)for(let d=0;d<l;d++){this.getMatrixAt(d,Jc),Qp.multiplyMatrices(a,Jc),Wh.matrixWorld=Qp,Wh.raycast(t,$c);for(let p=0,v=$c.length;p<v;p++){const _=$c[p];_.instanceId=d,_.object=this,i.push(_)}$c.length=0}}setColorAt(t,i){this.instanceColor===null&&(this.instanceColor=new Kn(new Float32Array(3*this.count),3)),i.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,i){i.toArray(this.instanceMatrix.array,16*t)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}Kc.prototype.isInstancedMesh=!0;class ro extends Ni{constructor(t){super(),this.type="LineBasicMaterial",this.color=new pn(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,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.morphTargets=t.morphTargets,this}}ro.prototype.isLineBasicMaterial=!0;const tf=new gt,Qc=new gt,td=new En,ip=new Ha,ed=new ws;class $a extends ar{constructor(t=new zn,i=new ro){super(),this.type="Line",this.geometry=t,this.material=i,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(t.index===null){const i=t.attributes.position,a=[0];for(let l=1,d=i.count;l<d;l++)tf.fromBufferAttribute(i,l-1),Qc.fromBufferAttribute(i,l),a[l]=a[l-1],a[l]+=tf.distanceTo(Qc);t.setAttribute("lineDistance",new xn(a,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(t,i){const a=this.geometry,l=this.matrixWorld,d=t.params.Line.threshold,p=a.drawRange;if(a.boundingSphere===null&&a.computeBoundingSphere(),ed.copy(a.boundingSphere),ed.applyMatrix4(l),ed.radius+=d,t.ray.intersectsSphere(ed)===!1)return;td.copy(l).invert(),ip.copy(t.ray).applyMatrix4(td);const v=d/((this.scale.x+this.scale.y+this.scale.z)/3),_=v*v,x=new gt,M=new gt,C=new gt,A=new gt,R=this.isLineSegments?2:1;if(a.isBufferGeometry){const O=a.index,U=a.attributes.position;if(O!==null)for(let D=Math.max(0,p.start),Z=Math.min(O.count,p.start+p.count)-1;D<Z;D+=R){const ot=O.getX(D),vt=O.getX(D+1);if(x.fromBufferAttribute(U,ot),M.fromBufferAttribute(U,vt),ip.distanceSqToSegment(x,M,A,C)>_)continue;A.applyMatrix4(this.matrixWorld);const mt=t.ray.origin.distanceTo(A);mt<t.near||mt>t.far||i.push({distance:mt,point:C.clone().applyMatrix4(this.matrixWorld),index:D,face:null,faceIndex:null,object:this})}else for(let D=Math.max(0,p.start),Z=Math.min(U.count,p.start+p.count)-1;D<Z;D+=R){if(x.fromBufferAttribute(U,D),M.fromBufferAttribute(U,D+1),ip.distanceSqToSegment(x,M,A,C)>_)continue;A.applyMatrix4(this.matrixWorld);const ot=t.ray.origin.distanceTo(A);ot<t.near||ot>t.far||i.push({distance:ot,point:C.clone().applyMatrix4(this.matrixWorld),index:D,face:null,faceIndex:null,object:this})}}else a.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const i=t.morphAttributes,a=Object.keys(i);if(a.length>0){const l=i[a[0]];if(l!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let d=0,p=l.length;d<p;d++){const v=l[d].name||String(d);this.morphTargetInfluences.push(0),this.morphTargetDictionary[v]=d}}}}else{const i=t.morphTargets;i!==void 0&&i.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}$a.prototype.isLine=!0;const ef=new gt,nd=new gt;class io extends $a{constructor(t,i){super(t,i),this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(t.index===null){const i=t.attributes.position,a=[];for(let l=0,d=i.count;l<d;l+=2)ef.fromBufferAttribute(i,l),nd.fromBufferAttribute(i,l+1),a[l]=l===0?0:a[l-1],a[l+1]=a[l]+ef.distanceTo(nd);t.setAttribute("lineDistance",new xn(a,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}io.prototype.isLineSegments=!0;class ou extends $a{constructor(t,i){super(t,i),this.type="LineLoop"}}ou.prototype.isLineLoop=!0;class Tl extends Ni{constructor(t){super(),this.type="PointsMaterial",this.color=new pn(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,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.morphTargets=t.morphTargets,this}}Tl.prototype.isPointsMaterial=!0;const c=new En,g=new Ha,E=new ws,N=new gt;class q extends ar{constructor(t=new zn,i=new Tl){super(),this.type="Points",this.geometry=t,this.material=i,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}raycast(t,i){const a=this.geometry,l=this.matrixWorld,d=t.params.Points.threshold,p=a.drawRange;if(a.boundingSphere===null&&a.computeBoundingSphere(),E.copy(a.boundingSphere),E.applyMatrix4(l),E.radius+=d,t.ray.intersectsSphere(E)===!1)return;c.copy(l).invert(),g.copy(t.ray).applyMatrix4(c);const v=d/((this.scale.x+this.scale.y+this.scale.z)/3),_=v*v;if(a.isBufferGeometry){const x=a.index,M=a.attributes.position;if(x!==null)for(let C=Math.max(0,p.start),A=Math.min(x.count,p.start+p.count);C<A;C++){const R=x.getX(C);N.fromBufferAttribute(M,R),dt(N,R,_,l,t,i,this)}else for(let C=Math.max(0,p.start),A=Math.min(M.count,p.start+p.count);C<A;C++)N.fromBufferAttribute(M,C),dt(N,C,_,l,t,i,this)}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const i=t.morphAttributes,a=Object.keys(i);if(a.length>0){const l=i[a[0]];if(l!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let d=0,p=l.length;d<p;d++){const v=l[d].name||String(d);this.morphTargetInfluences.push(0),this.morphTargetDictionary[v]=d}}}}else{const i=t.morphTargets;i!==void 0&&i.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function dt(m,t,i,a,l,d,p){const v=g.distanceSqToPoint(m);if(v<i){const _=new gt;g.closestPointToPoint(m,_),_.applyMatrix4(a);const x=l.ray.origin.distanceTo(_);if(x<l.near||x>l.far)return;d.push({distance:x,distanceToRay:Math.sqrt(v),point:_,index:t,face:null,object:p})}}q.prototype.isPoints=!0;class Mt extends ni{constructor(t,i,a,l,d,p,v,_,x){super(t,i,a,l,d,p,v,_,x),this.format=v!==void 0?v:yn,this.minFilter=p!==void 0?p:Qe,this.magFilter=d!==void 0?d:Qe,this.generateMipmaps=!1;const M=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback(function C(){M.needsUpdate=!0,t.requestVideoFrameCallback(C)})}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!("requestVideoFrameCallback"in t)&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}Mt.prototype.isVideoTexture=!0;class Lt extends ni{constructor(t,i,a,l,d,p,v,_,x,M,C,A){super(null,p,v,_,x,M,l,d,C,A),this.image={width:i,height:a},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}Lt.prototype.isCompressedTexture=!0;class qt extends ni{constructor(t,i,a,l,d,p,v,_,x){super(t,i,a,l,d,p,v,_,x),this.needsUpdate=!0}}qt.prototype.isCanvasTexture=!0;class Ee extends ni{constructor(t,i,a,l,d,p,v,_,x,M){if((M=M!==void 0?M:dn)!==dn&&M!==rr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");a===void 0&&M===dn&&(a=Ra),a===void 0&&M===rr&&(a=un),super(null,l,d,p,v,_,M,a,x),this.image={width:t,height:i},this.magFilter=v!==void 0?v:wt,this.minFilter=_!==void 0?_:wt,this.flipY=!1,this.generateMipmaps=!1}}Ee.prototype.isDepthTexture=!0;class me extends zn{constructor(t=1,i=8,a=0,l=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:i,thetaStart:a,thetaLength:l},i=Math.max(3,i);const d=[],p=[],v=[],_=[],x=new gt,M=new He;p.push(0,0,0),v.push(0,0,1),_.push(.5,.5);for(let C=0,A=3;C<=i;C++,A+=3){const R=a+C/i*l;x.x=t*Math.cos(R),x.y=t*Math.sin(R),p.push(x.x,x.y,x.z),v.push(0,0,1),M.x=(p[A]/t+1)/2,M.y=(p[A+1]/t+1)/2,_.push(M.x,M.y)}for(let C=1;C<=i;C++)d.push(C,C+1,0);this.setIndex(d),this.setAttribute("position",new xn(p,3)),this.setAttribute("normal",new xn(v,3)),this.setAttribute("uv",new xn(_,2))}static fromJSON(t){return new me(t.radius,t.segments,t.thetaStart,t.thetaLength)}}class De extends zn{constructor(t=1,i=1,a=1,l=8,d=1,p=!1,v=0,_=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:i,height:a,radialSegments:l,heightSegments:d,openEnded:p,thetaStart:v,thetaLength:_};const x=this;l=Math.floor(l),d=Math.floor(d);const M=[],C=[],A=[],R=[];let O=0;const U=[],D=a/2;let Z=0;function ot(vt){const mt=O,At=new He,Pt=new gt;let Et=0;const Ot=vt===!0?t:i,Ie=vt===!0?1:-1;for(let xe=1;xe<=l;xe++)C.push(0,D*Ie,0),A.push(0,Ie,0),R.push(.5,.5),O++;const ye=O;for(let xe=0;xe<=l;xe++){const ge=xe/l*_+v,Ht=Math.cos(ge),ce=Math.sin(ge);Pt.x=Ot*ce,Pt.y=D*Ie,Pt.z=Ot*Ht,C.push(Pt.x,Pt.y,Pt.z),A.push(0,Ie,0),At.x=.5*Ht+.5,At.y=.5*ce*Ie+.5,R.push(At.x,At.y),O++}for(let xe=0;xe<l;xe++){const ge=mt+xe,Ht=ye+xe;vt===!0?M.push(Ht,Ht+1,ge):M.push(Ht+1,Ht,ge),Et+=3}x.addGroup(Z,Et,vt===!0?1:2),Z+=Et}(function(){const vt=new gt,mt=new gt;let At=0;const Pt=(i-t)/a;for(let Et=0;Et<=d;Et++){const Ot=[],Ie=Et/d,ye=Ie*(i-t)+t;for(let xe=0;xe<=l;xe++){const ge=xe/l,Ht=ge*_+v,ce=Math.sin(Ht),We=Math.cos(Ht);mt.x=ye*ce,mt.y=-Ie*a+D,mt.z=ye*We,C.push(mt.x,mt.y,mt.z),vt.set(ce,Pt,We).normalize(),A.push(vt.x,vt.y,vt.z),R.push(ge,1-Ie),Ot.push(O++)}U.push(Ot)}for(let Et=0;Et<l;Et++)for(let Ot=0;Ot<d;Ot++){const Ie=U[Ot][Et],ye=U[Ot+1][Et],xe=U[Ot+1][Et+1],ge=U[Ot][Et+1];M.push(Ie,ye,ge),M.push(ye,xe,ge),At+=6}x.addGroup(Z,At,0),Z+=At})(),p===!1&&(t>0&&ot(!0),i>0&&ot(!1)),this.setIndex(M),this.setAttribute("position",new xn(C,3)),this.setAttribute("normal",new xn(A,3)),this.setAttribute("uv",new xn(R,2))}static fromJSON(t){return new De(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class gn extends De{constructor(t=1,i=1,a=8,l=1,d=!1,p=0,v=2*Math.PI){super(0,t,i,a,l,d,p,v),this.type="ConeGeometry",this.parameters={radius:t,height:i,radialSegments:a,heightSegments:l,openEnded:d,thetaStart:p,thetaLength:v}}static fromJSON(t){return new gn(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class ln extends zn{constructor(t,i,a=1,l=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:i,radius:a,detail:l};const d=[],p=[];function v(A,R,O,U){const D=U+1,Z=[];for(let ot=0;ot<=D;ot++){Z[ot]=[];const vt=A.clone().lerp(O,ot/D),mt=R.clone().lerp(O,ot/D),At=D-ot;for(let Pt=0;Pt<=At;Pt++)Z[ot][Pt]=Pt===0&&ot===D?vt:vt.clone().lerp(mt,Pt/At)}for(let ot=0;ot<D;ot++)for(let vt=0;vt<2*(D-ot)-1;vt++){const mt=Math.floor(vt/2);vt%2==0?(_(Z[ot][mt+1]),_(Z[ot+1][mt]),_(Z[ot][mt])):(_(Z[ot][mt+1]),_(Z[ot+1][mt+1]),_(Z[ot+1][mt]))}}function _(A){d.push(A.x,A.y,A.z)}function x(A,R){const O=3*A;R.x=t[O+0],R.y=t[O+1],R.z=t[O+2]}function M(A,R,O,U){U<0&&A.x===1&&(p[R]=A.x-1),O.x===0&&O.z===0&&(p[R]=U/2/Math.PI+.5)}function C(A){return Math.atan2(A.z,-A.x)}(function(A){const R=new gt,O=new gt,U=new gt;for(let D=0;D<i.length;D+=3)x(i[D+0],R),x(i[D+1],O),x(i[D+2],U),v(R,O,U,A)})(l),function(A){const R=new gt;for(let O=0;O<d.length;O+=3)R.x=d[O+0],R.y=d[O+1],R.z=d[O+2],R.normalize().multiplyScalar(A),d[O+0]=R.x,d[O+1]=R.y,d[O+2]=R.z}(a),function(){const A=new gt;for(let O=0;O<d.length;O+=3){A.x=d[O+0],A.y=d[O+1],A.z=d[O+2];const U=C(A)/2/Math.PI+.5,D=(R=A,Math.atan2(-R.y,Math.sqrt(R.x*R.x+R.z*R.z))/Math.PI+.5);p.push(U,1-D)}var R;(function(){const O=new gt,U=new gt,D=new gt,Z=new gt,ot=new He,vt=new He,mt=new He;for(let At=0,Pt=0;At<d.length;At+=9,Pt+=6){O.set(d[At+0],d[At+1],d[At+2]),U.set(d[At+3],d[At+4],d[At+5]),D.set(d[At+6],d[At+7],d[At+8]),ot.set(p[Pt+0],p[Pt+1]),vt.set(p[Pt+2],p[Pt+3]),mt.set(p[Pt+4],p[Pt+5]),Z.copy(O).add(U).add(D).divideScalar(3);const Et=C(Z);M(ot,Pt+0,O,Et),M(vt,Pt+2,U,Et),M(mt,Pt+4,D,Et)}})(),function(){for(let O=0;O<p.length;O+=6){const U=p[O+0],D=p[O+2],Z=p[O+4],ot=Math.max(U,D,Z),vt=Math.min(U,D,Z);ot>.9&&vt<.1&&(U<.2&&(p[O+0]+=1),D<.2&&(p[O+2]+=1),Z<.2&&(p[O+4]+=1))}}()}(),this.setAttribute("position",new xn(d,3)),this.setAttribute("normal",new xn(d.slice(),3)),this.setAttribute("uv",new xn(p,2)),l===0?this.computeVertexNormals():this.normalizeNormals()}static fromJSON(t){return new ln(t.vertices,t.indices,t.radius,t.details)}}class An extends ln{constructor(t=1,i=0){const a=(1+Math.sqrt(5))/2,l=1/a;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-l,-a,0,-l,a,0,l,-a,0,l,a,-l,-a,0,-l,a,0,l,-a,0,l,a,0,-a,0,-l,a,0,-l,-a,0,l,a,0,l],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,i),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:i}}static fromJSON(t){return new An(t.radius,t.detail)}}const ve=new gt,Xe=new gt,Un=new gt,mn=new bi;class Yn extends zn{constructor(t,i){if(super(),this.type="EdgesGeometry",this.parameters={thresholdAngle:i},i=i!==void 0?i:1,t.isGeometry===!0)return void console.error("THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");const a=Math.pow(10,4),l=Math.cos(ra*i),d=t.getIndex(),p=t.getAttribute("position"),v=d?d.count:p.count,_=[0,0,0],x=["a","b","c"],M=new Array(3),C={},A=[];for(let R=0;R<v;R+=3){d?(_[0]=d.getX(R),_[1]=d.getX(R+1),_[2]=d.getX(R+2)):(_[0]=R,_[1]=R+1,_[2]=R+2);const{a:O,b:U,c:D}=mn;if(O.fromBufferAttribute(p,_[0]),U.fromBufferAttribute(p,_[1]),D.fromBufferAttribute(p,_[2]),mn.getNormal(Un),M[0]=`${Math.round(O.x*a)},${Math.round(O.y*a)},${Math.round(O.z*a)}`,M[1]=`${Math.round(U.x*a)},${Math.round(U.y*a)},${Math.round(U.z*a)}`,M[2]=`${Math.round(D.x*a)},${Math.round(D.y*a)},${Math.round(D.z*a)}`,M[0]!==M[1]&&M[1]!==M[2]&&M[2]!==M[0])for(let Z=0;Z<3;Z++){const ot=(Z+1)%3,vt=M[Z],mt=M[ot],At=mn[x[Z]],Pt=mn[x[ot]],Et=`${vt}_${mt}`,Ot=`${mt}_${vt}`;Ot in C&&C[Ot]?(Un.dot(C[Ot].normal)<=l&&(A.push(At.x,At.y,At.z),A.push(Pt.x,Pt.y,Pt.z)),C[Ot]=null):Et in C||(C[Et]={index0:_[Z],index1:_[ot],normal:Un.clone()})}}for(const R in C)if(C[R]){const{index0:O,index1:U}=C[R];ve.fromBufferAttribute(p,O),Xe.fromBufferAttribute(p,U),A.push(ve.x,ve.y,ve.z),A.push(Xe.x,Xe.y,Xe.z)}this.setAttribute("position",new xn(A,3))}}class wn{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,i){const a=this.getUtoTmapping(t);return this.getPoint(a,i)}getPoints(t=5){const i=[];for(let a=0;a<=t;a++)i.push(this.getPoint(a/t));return i}getSpacedPoints(t=5){const i=[];for(let a=0;a<=t;a++)i.push(this.getPointAt(a/t));return i}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const i=[];let a,l=this.getPoint(0),d=0;i.push(0);for(let p=1;p<=t;p++)a=this.getPoint(p/t),d+=a.distanceTo(l),i.push(d),l=a;return this.cacheArcLengths=i,i}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,i){const a=this.getLengths();let l=0;const d=a.length;let p;p=i||t*a[d-1];let v,_=0,x=d-1;for(;_<=x;)if(l=Math.floor(_+(x-_)/2),v=a[l]-p,v<0)_=l+1;else{if(!(v>0)){x=l;break}x=l-1}if(l=x,a[l]===p)return l/(d-1);const M=a[l];return(l+(p-M)/(a[l+1]-M))/(d-1)}getTangent(t,i){let a=t-1e-4,l=t+1e-4;a<0&&(a=0),l>1&&(l=1);const d=this.getPoint(a),p=this.getPoint(l),v=i||(d.isVector2?new He:new gt);return v.copy(p).sub(d).normalize(),v}getTangentAt(t,i){const a=this.getUtoTmapping(t);return this.getTangent(a,i)}computeFrenetFrames(t,i){const a=new gt,l=[],d=[],p=[],v=new gt,_=new En;for(let R=0;R<=t;R++){const O=R/t;l[R]=this.getTangentAt(O,new gt),l[R].normalize()}d[0]=new gt,p[0]=new gt;let x=Number.MAX_VALUE;const M=Math.abs(l[0].x),C=Math.abs(l[0].y),A=Math.abs(l[0].z);M<=x&&(x=M,a.set(1,0,0)),C<=x&&(x=C,a.set(0,1,0)),A<=x&&a.set(0,0,1),v.crossVectors(l[0],a).normalize(),d[0].crossVectors(l[0],v),p[0].crossVectors(l[0],d[0]);for(let R=1;R<=t;R++){if(d[R]=d[R-1].clone(),p[R]=p[R-1].clone(),v.crossVectors(l[R-1],l[R]),v.length()>Number.EPSILON){v.normalize();const O=Math.acos(zi(l[R-1].dot(l[R]),-1,1));d[R].applyMatrix4(_.makeRotationAxis(v,O))}p[R].crossVectors(l[R],d[R])}if(i===!0){let R=Math.acos(zi(d[0].dot(d[t]),-1,1));R/=t,l[0].dot(v.crossVectors(d[0],d[t]))>0&&(R=-R);for(let O=1;O<=t;O++)d[O].applyMatrix4(_.makeRotationAxis(l[O],R*O)),p[O].crossVectors(l[O],d[O])}return{tangents:l,normals:d,binormals:p}}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 lr extends wn{constructor(t=0,i=0,a=1,l=1,d=0,p=2*Math.PI,v=!1,_=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=i,this.xRadius=a,this.yRadius=l,this.aStartAngle=d,this.aEndAngle=p,this.aClockwise=v,this.aRotation=_}getPoint(t,i){const a=i||new He,l=2*Math.PI;let d=this.aEndAngle-this.aStartAngle;const p=Math.abs(d)<Number.EPSILON;for(;d<0;)d+=l;for(;d>l;)d-=l;d<Number.EPSILON&&(d=p?0:l),this.aClockwise!==!0||p||(d===l?d=-l:d-=l);const v=this.aStartAngle+t*d;let _=this.aX+this.xRadius*Math.cos(v),x=this.aY+this.yRadius*Math.sin(v);if(this.aRotation!==0){const M=Math.cos(this.aRotation),C=Math.sin(this.aRotation),A=_-this.aX,R=x-this.aY;_=A*M-R*C+this.aX,x=A*C+R*M+this.aY}return a.set(_,x)}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}}lr.prototype.isEllipseCurve=!0;class In extends lr{constructor(t,i,a,l,d,p){super(t,i,a,a,l,d,p),this.type="ArcCurve"}}function jn(){let m=0,t=0,i=0,a=0;function l(d,p,v,_){m=d,t=v,i=-3*d+3*p-2*v-_,a=2*d-2*p+v+_}return{initCatmullRom:function(d,p,v,_,x){l(p,v,x*(v-d),x*(_-p))},initNonuniformCatmullRom:function(d,p,v,_,x,M,C){let A=(p-d)/x-(v-d)/(x+M)+(v-p)/M,R=(v-p)/M-(_-p)/(M+C)+(_-v)/C;A*=M,R*=M,l(p,v,A,R)},calc:function(d){const p=d*d;return m+t*d+i*p+a*(p*d)}}}In.prototype.isArcCurve=!0;const Ei=new gt,bo=new jn,Os=new jn,ki=new jn;class $s extends wn{constructor(t=[],i=!1,a="centripetal",l=.5){super(),this.type="CatmullRomCurve3",this.points=t,this.closed=i,this.curveType=a,this.tension=l}getPoint(t,i=new gt){const a=i,l=this.points,d=l.length,p=(d-(this.closed?0:1))*t;let v,_,x=Math.floor(p),M=p-x;this.closed?x+=x>0?0:(Math.floor(Math.abs(x)/d)+1)*d:M===0&&x===d-1&&(x=d-2,M=1),this.closed||x>0?v=l[(x-1)%d]:(Ei.subVectors(l[0],l[1]).add(l[0]),v=Ei);const C=l[x%d],A=l[(x+1)%d];if(this.closed||x+2<d?_=l[(x+2)%d]:(Ei.subVectors(l[d-1],l[d-2]).add(l[d-1]),_=Ei),this.curveType==="centripetal"||this.curveType==="chordal"){const R=this.curveType==="chordal"?.5:.25;let O=Math.pow(v.distanceToSquared(C),R),U=Math.pow(C.distanceToSquared(A),R),D=Math.pow(A.distanceToSquared(_),R);U<1e-4&&(U=1),O<1e-4&&(O=U),D<1e-4&&(D=U),bo.initNonuniformCatmullRom(v.x,C.x,A.x,_.x,O,U,D),Os.initNonuniformCatmullRom(v.y,C.y,A.y,_.y,O,U,D),ki.initNonuniformCatmullRom(v.z,C.z,A.z,_.z,O,U,D)}else this.curveType==="catmullrom"&&(bo.initCatmullRom(v.x,C.x,A.x,_.x,this.tension),Os.initCatmullRom(v.y,C.y,A.y,_.y,this.tension),ki.initCatmullRom(v.z,C.z,A.z,_.z,this.tension));return a.set(bo.calc(M),Os.calc(M),ki.calc(M)),a}copy(t){super.copy(t),this.points=[];for(let i=0,a=t.points.length;i<a;i++){const l=t.points[i];this.points.push(l.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let i=0,a=this.points.length;i<a;i++){const l=this.points[i];t.points.push(l.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let i=0,a=t.points.length;i<a;i++){const l=t.points[i];this.points.push(new gt().fromArray(l))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function Ka(m,t,i,a,l){const d=.5*(a-t),p=.5*(l-i),v=m*m;return(2*i-2*a+d+p)*(m*v)+(-3*i+3*a-2*d-p)*v+d*m+i}function Qa(m,t,i,a){return function(l,d){const p=1-l;return p*p*d}(m,t)+function(l,d){return 2*(1-l)*l*d}(m,i)+function(l,d){return l*l*d}(m,a)}function El(m,t,i,a,l){return function(d,p){const v=1-d;return v*v*v*p}(m,t)+function(d,p){const v=1-d;return 3*v*v*d*p}(m,i)+function(d,p){return 3*(1-d)*d*d*p}(m,a)+function(d,p){return d*d*d*p}(m,l)}$s.prototype.isCatmullRomCurve3=!0;class ya extends wn{constructor(t=new He,i=new He,a=new He,l=new He){super(),this.type="CubicBezierCurve",this.v0=t,this.v1=i,this.v2=a,this.v3=l}getPoint(t,i=new He){const a=i,l=this.v0,d=this.v1,p=this.v2,v=this.v3;return a.set(El(t,l.x,d.x,p.x,v.x),El(t,l.y,d.y,p.y,v.y)),a}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}}ya.prototype.isCubicBezierCurve=!0;class xa extends wn{constructor(t=new gt,i=new gt,a=new gt,l=new gt){super(),this.type="CubicBezierCurve3",this.v0=t,this.v1=i,this.v2=a,this.v3=l}getPoint(t,i=new gt){const a=i,l=this.v0,d=this.v1,p=this.v2,v=this.v3;return a.set(El(t,l.x,d.x,p.x,v.x),El(t,l.y,d.y,p.y,v.y),El(t,l.z,d.z,p.z,v.z)),a}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}}xa.prototype.isCubicBezierCurve3=!0;class zu extends wn{constructor(t=new He,i=new He){super(),this.type="LineCurve",this.v1=t,this.v2=i}getPoint(t,i=new He){const a=i;return t===1?a.copy(this.v2):(a.copy(this.v2).sub(this.v1),a.multiplyScalar(t).add(this.v1)),a}getPointAt(t,i){return this.getPoint(t,i)}getTangent(t,i){const a=i||new He;return a.copy(this.v2).sub(this.v1).normalize(),a}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}}zu.prototype.isLineCurve=!0;class op extends wn{constructor(t=new gt,i=new gt){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=t,this.v2=i}getPoint(t,i=new gt){const a=i;return t===1?a.copy(this.v2):(a.copy(this.v2).sub(this.v1),a.multiplyScalar(t).add(this.v1)),a}getPointAt(t,i){return this.getPoint(t,i)}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}}class su extends wn{constructor(t=new He,i=new He,a=new He){super(),this.type="QuadraticBezierCurve",this.v0=t,this.v1=i,this.v2=a}getPoint(t,i=new He){const a=i,l=this.v0,d=this.v1,p=this.v2;return a.set(Qa(t,l.x,d.x,p.x),Qa(t,l.y,d.y,p.y)),a}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}}su.prototype.isQuadraticBezierCurve=!0;class Xh extends wn{constructor(t=new gt,i=new gt,a=new gt){super(),this.type="QuadraticBezierCurve3",this.v0=t,this.v1=i,this.v2=a}getPoint(t,i=new gt){const a=i,l=this.v0,d=this.v1,p=this.v2;return a.set(Qa(t,l.x,d.x,p.x),Qa(t,l.y,d.y,p.y),Qa(t,l.z,d.z,p.z)),a}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}}Xh.prototype.isQuadraticBezierCurve3=!0;class au extends wn{constructor(t=[]){super(),this.type="SplineCurve",this.points=t}getPoint(t,i=new He){const a=i,l=this.points,d=(l.length-1)*t,p=Math.floor(d),v=d-p,_=l[p===0?p:p-1],x=l[p],M=l[p>l.length-2?l.length-1:p+1],C=l[p>l.length-3?l.length-1:p+2];return a.set(Ka(v,_.x,x.x,M.x,C.x),Ka(v,_.y,x.y,M.y,C.y)),a}copy(t){super.copy(t),this.points=[];for(let i=0,a=t.points.length;i<a;i++){const l=t.points[i];this.points.push(l.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let i=0,a=this.points.length;i<a;i++){const l=this.points[i];t.points.push(l.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let i=0,a=t.points.length;i<a;i++){const l=t.points[i];this.points.push(new He().fromArray(l))}return this}}au.prototype.isSplineCurve=!0;var tl=Object.freeze({__proto__:null,ArcCurve:In,CatmullRomCurve3:$s,CubicBezierCurve:ya,CubicBezierCurve3:xa,EllipseCurve:lr,LineCurve:zu,LineCurve3:op,QuadraticBezierCurve:su,QuadraticBezierCurve3:Xh,SplineCurve:au});const nf=function(m,t,i=2){const a=t&&t.length,l=a?t[0]*i:m.length;let d=qh(m,0,l,i,!0);const p=[];if(!d||d.next===d.prev)return p;let v,_,x,M,C,A,R;if(a&&(d=function(O,U,D,Z){const ot=[];let vt,mt,At,Pt,Et;for(vt=0,mt=U.length;vt<mt;vt++)At=U[vt]*Z,Pt=vt<mt-1?U[vt+1]*Z:O.length,Et=qh(O,At,Pt,Z,!1),Et===Et.next&&(Et.steiner=!0),ot.push(id(Et));for(ot.sort(ns),vt=0;vt<ot.length;vt++)zf(ot[vt],D),D=Ro(D,D.next);return D}(m,t,d,i)),m.length>80*i){v=x=m[0],_=M=m[1];for(let O=i;O<l;O+=i)C=m[O],A=m[O+1],C<v&&(v=C),A<_&&(_=A),C>x&&(x=C),A>M&&(M=A);R=Math.max(x-v,M-_),R=R!==0?1/R:0}return rd(d,p,i,v,_,R),p};function qh(m,t,i,a,l){let d,p;if(l===function(v,_,x,M){let C=0;for(let A=_,R=x-M;A<x;A+=M)C+=(v[R]-v[A])*(v[A+1]+v[R+1]),R=A;return C}(m,t,i,a)>0)for(d=t;d<i;d+=a)p=Dm(d,m[d],m[d+1],p);else for(d=i-a;d>=t;d-=a)p=Dm(d,m[d],m[d+1],p);return p&&Io(p,p.next)&&(lp(p),p=p.next),p}function Ro(m,t){if(!m)return m;t||(t=m);let i,a=m;do if(i=!1,a.steiner||!Io(a,a.next)&&Mi(a.prev,a,a.next)!==0)a=a.next;else{if(lp(a),a=t=a.prev,a===a.next)break;i=!0}while(i||a!==t);return t}function rd(m,t,i,a,l,d,p){if(!m)return;!p&&d&&function(M,C,A,R){let O=M;do O.z===null&&(O.z=Yh(O.x,O.y,C,A,R)),O.prevZ=O.prev,O.nextZ=O.next,O=O.next;while(O!==M);O.prevZ.nextZ=null,O.prevZ=null,function(U){let D,Z,ot,vt,mt,At,Pt,Et,Ot=1;do{for(Z=U,U=null,mt=null,At=0;Z;){for(At++,ot=Z,Pt=0,D=0;D<Ot&&(Pt++,ot=ot.nextZ,ot);D++);for(Et=Ot;Pt>0||Et>0&&ot;)Pt!==0&&(Et===0||!ot||Z.z<=ot.z)?(vt=Z,Z=Z.nextZ,Pt--):(vt=ot,ot=ot.nextZ,Et--),mt?mt.nextZ=vt:U=vt,vt.prevZ=mt,mt=vt;Z=ot}mt.nextZ=null,Ot*=2}while(At>1)}(O)}(m,a,l,d);let v,_,x=m;for(;m.prev!==m.next;)if(v=m.prev,_=m.next,d?bg(m,a,l,d):xg(m))t.push(v.i/i),t.push(m.i/i),t.push(_.i/i),lp(m),m=_.next,x=_.next;else if((m=_)===x){p?p===1?rd(m=Lm(Ro(m),t,i),t,i,a,l,d,2):p===2&&wg(m,t,i,a,l,d):rd(Ro(m),t,i,a,l,d,1);break}}function xg(m){const t=m.prev,i=m,a=m.next;if(Mi(t,i,a)>=0)return!1;let l=m.next.next;for(;l!==m.prev;){if(Zh(t.x,t.y,i.x,i.y,a.x,a.y,l.x,l.y)&&Mi(l.prev,l,l.next)>=0)return!1;l=l.next}return!0}function bg(m,t,i,a){const l=m.prev,d=m,p=m.next;if(Mi(l,d,p)>=0)return!1;const v=l.x<d.x?l.x<p.x?l.x:p.x:d.x<p.x?d.x:p.x,_=l.y<d.y?l.y<p.y?l.y:p.y:d.y<p.y?d.y:p.y,x=l.x>d.x?l.x>p.x?l.x:p.x:d.x>p.x?d.x:p.x,M=l.y>d.y?l.y>p.y?l.y:p.y:d.y>p.y?d.y:p.y,C=Yh(v,_,t,i,a),A=Yh(x,M,t,i,a);let R=m.prevZ,O=m.nextZ;for(;R&&R.z>=C&&O&&O.z<=A;){if(R!==m.prev&&R!==m.next&&Zh(l.x,l.y,d.x,d.y,p.x,p.y,R.x,R.y)&&Mi(R.prev,R,R.next)>=0||(R=R.prevZ,O!==m.prev&&O!==m.next&&Zh(l.x,l.y,d.x,d.y,p.x,p.y,O.x,O.y)&&Mi(O.prev,O,O.next)>=0))return!1;O=O.nextZ}for(;R&&R.z>=C;){if(R!==m.prev&&R!==m.next&&Zh(l.x,l.y,d.x,d.y,p.x,p.y,R.x,R.y)&&Mi(R.prev,R,R.next)>=0)return!1;R=R.prevZ}for(;O&&O.z<=A;){if(O!==m.prev&&O!==m.next&&Zh(l.x,l.y,d.x,d.y,p.x,p.y,O.x,O.y)&&Mi(O.prev,O,O.next)>=0)return!1;O=O.nextZ}return!0}function Lm(m,t,i){let a=m;do{const l=a.prev,d=a.next.next;!Io(l,d)&&sp(l,a,a.next,d)&&$h(l,d)&&$h(d,l)&&(t.push(l.i/i),t.push(a.i/i),t.push(d.i/i),lp(a),lp(a.next),a=m=d),a=a.next}while(a!==m);return Ro(a)}function wg(m,t,i,a,l,d){let p=m;do{let v=p.next.next;for(;v!==p.prev;){if(p.i!==v.i&&Om(p,v)){let _=rf(p,v);return p=Ro(p,p.next),_=Ro(_,_.next),rd(p,t,i,a,l,d),void rd(_,t,i,a,l,d)}v=v.next}p=p.next}while(p!==m)}function ns(m,t){return m.x-t.x}function zf(m,t){if(t=function(i,a){let l=a;const d=i.x,p=i.y;let v,_=-1/0;do{if(p<=l.y&&p>=l.next.y&&l.next.y!==l.y){const O=l.x+(p-l.y)*(l.next.x-l.x)/(l.next.y-l.y);if(O<=d&&O>_){if(_=O,O===d){if(p===l.y)return l;if(p===l.next.y)return l.next}v=l.x<l.next.x?l:l.next}}l=l.next}while(l!==a);if(!v)return null;if(d===_)return v;const x=v,M=v.x,C=v.y;let A,R=1/0;l=v;do d>=l.x&&l.x>=M&&d!==l.x&&Zh(p<C?d:_,p,M,C,p<C?_:d,p,l.x,l.y)&&(A=Math.abs(p-l.y)/(d-l.x),$h(l,i)&&(A<R||A===R&&(l.x>v.x||l.x===v.x&&Sg(v,l)))&&(v=l,R=A)),l=l.next;while(l!==x);return v}(m,t)){const i=rf(t,m);Ro(t,t.next),Ro(i,i.next)}}function Sg(m,t){return Mi(m.prev,m,t.prev)<0&&Mi(t.next,m,m.next)<0}function Yh(m,t,i,a,l){return(m=1431655765&((m=858993459&((m=252645135&((m=16711935&((m=32767*(m-i)*l)|m<<8))|m<<4))|m<<2))|m<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-a)*l)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function id(m){let t=m,i=m;do(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next;while(t!==m);return i}function Zh(m,t,i,a,l,d,p,v){return(l-p)*(t-v)-(m-p)*(d-v)>=0&&(m-p)*(a-v)-(i-p)*(t-v)>=0&&(i-p)*(d-v)-(l-p)*(a-v)>=0}function Om(m,t){return m.next.i!==t.i&&m.prev.i!==t.i&&!function(i,a){let l=i;do{if(l.i!==i.i&&l.next.i!==i.i&&l.i!==a.i&&l.next.i!==a.i&&sp(l,l.next,i,a))return!0;l=l.next}while(l!==i);return!1}(m,t)&&($h(m,t)&&$h(t,m)&&function(i,a){let l=i,d=!1;const p=(i.x+a.x)/2,v=(i.y+a.y)/2;do l.y>v!=l.next.y>v&&l.next.y!==l.y&&p<(l.next.x-l.x)*(v-l.y)/(l.next.y-l.y)+l.x&&(d=!d),l=l.next;while(l!==i);return d}(m,t)&&(Mi(m.prev,m,t.prev)||Mi(m,t.prev,t))||Io(m,t)&&Mi(m.prev,m,m.next)>0&&Mi(t.prev,t,t.next)>0)}function Mi(m,t,i){return(t.y-m.y)*(i.x-t.x)-(t.x-m.x)*(i.y-t.y)}function Io(m,t){return m.x===t.x&&m.y===t.y}function sp(m,t,i,a){const l=Jh(Mi(m,t,i)),d=Jh(Mi(m,t,a)),p=Jh(Mi(i,a,m)),v=Jh(Mi(i,a,t));return l!==d&&p!==v||!(l!==0||!ap(m,i,t))||!(d!==0||!ap(m,a,t))||!(p!==0||!ap(i,m,a))||!(v!==0||!ap(i,t,a))}function ap(m,t,i){return t.x<=Math.max(m.x,i.x)&&t.x>=Math.min(m.x,i.x)&&t.y<=Math.max(m.y,i.y)&&t.y>=Math.min(m.y,i.y)}function Jh(m){return m>0?1:m<0?-1:0}function $h(m,t){return Mi(m.prev,m,m.next)<0?Mi(m,t,m.next)>=0&&Mi(m,m.prev,t)>=0:Mi(m,t,m.prev)<0||Mi(m,m.next,t)<0}function rf(m,t){const i=new ju(m.i,m.x,m.y),a=new ju(t.i,t.x,t.y),l=m.next,d=t.prev;return m.next=t,t.prev=m,i.next=l,l.prev=i,a.next=i,i.prev=a,d.next=a,a.prev=d,a}function Dm(m,t,i,a){const l=new ju(m,t,i);return a?(l.next=a.next,l.prev=a,a.next.prev=l,a.next=l):(l.prev=l,l.next=l),l}function lp(m){m.next.prev=m.prev,m.prev.next=m.next,m.prevZ&&(m.prevZ.nextZ=m.nextZ),m.nextZ&&(m.nextZ.prevZ=m.prevZ)}function ju(m,t,i){this.i=m,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class Ds{static area(t){const i=t.length;let a=0;for(let l=i-1,d=0;d<i;l=d++)a+=t[l].x*t[d].y-t[d].x*t[l].y;return .5*a}static isClockWise(t){return Ds.area(t)<0}static triangulateShape(t,i){const a=[],l=[],d=[];Nm(t),Fm(a,t);let p=t.length;i.forEach(Nm);for(let _=0;_<i.length;_++)l.push(p),p+=i[_].length,Fm(a,i[_]);const v=nf(a,l);for(let _=0;_<v.length;_+=3)d.push(v.slice(_,_+3));return d}}function Nm(m){const t=m.length;t>2&&m[t-1].equals(m[0])&&m.pop()}function Fm(m,t){for(let i=0;i<t.length;i++)m.push(t[i].x),m.push(t[i].y)}class el extends zn{constructor(t,i){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:i},t=Array.isArray(t)?t:[t];const a=this,l=[],d=[];for(let v=0,_=t.length;v<_;v++)p(t[v]);function p(v){const _=[],x=i.curveSegments!==void 0?i.curveSegments:12,M=i.steps!==void 0?i.steps:1;let C=i.depth!==void 0?i.depth:100,A=i.bevelEnabled===void 0||i.bevelEnabled,R=i.bevelThickness!==void 0?i.bevelThickness:6,O=i.bevelSize!==void 0?i.bevelSize:R-2,U=i.bevelOffset!==void 0?i.bevelOffset:0,D=i.bevelSegments!==void 0?i.bevelSegments:3;const Z=i.extrudePath,ot=i.UVGenerator!==void 0?i.UVGenerator:Bm;i.amount!==void 0&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),C=i.amount);let vt,mt,At,Pt,Et,Ot=!1;Z&&(vt=Z.getSpacedPoints(M),Ot=!0,A=!1,mt=Z.computeFrenetFrames(M,!1),At=new gt,Pt=new gt,Et=new gt),A||(D=0,R=0,O=0,U=0);const Ie=v.extractPoints(x);let ye=Ie.shape;const xe=Ie.holes;if(!Ds.isClockWise(ye)){ye=ye.reverse();for(let be=0,xt=xe.length;be<xt;be++){const Zt=xe[be];Ds.isClockWise(Zt)&&(xe[be]=Zt.reverse())}}const ge=Ds.triangulateShape(ye,xe),Ht=ye;for(let be=0,xt=xe.length;be<xt;be++){const Zt=xe[be];ye=ye.concat(Zt)}function ce(be,xt,Zt){return xt||console.error("THREE.ExtrudeGeometry: vec does not exist"),xt.clone().multiplyScalar(Zt).add(be)}const We=ye.length,je=ge.length;function ze(be,xt,Zt){let Te,Pe,we;const bn=be.x-xt.x,Gn=be.y-xt.y,Fn=Zt.x-be.x,_r=Zt.y-be.y,Tr=bn*bn+Gn*Gn,qo=bn*_r-Gn*Fn;if(Math.abs(qo)>Number.EPSILON){const fi=Math.sqrt(Tr),du=Math.sqrt(Fn*Fn+_r*_r),_m=xt.x-Gn/fi,ym=xt.y+bn/fi,xm=((Zt.x-_r/du-_m)*_r-(Zt.y+Fn/du-ym)*Fn)/(bn*_r-Gn*Fn);Te=_m+bn*xm-be.x,Pe=ym+Gn*xm-be.y;const Qs=Te*Te+Pe*Pe;if(Qs<=2)return new He(Te,Pe);we=Math.sqrt(Qs/2)}else{let fi=!1;bn>Number.EPSILON?Fn>Number.EPSILON&&(fi=!0):bn<-Number.EPSILON?Fn<-Number.EPSILON&&(fi=!0):Math.sign(Gn)===Math.sign(_r)&&(fi=!0),fi?(Te=-Gn,Pe=bn,we=Math.sqrt(Tr)):(Te=bn,Pe=Gn,we=Math.sqrt(Tr/2))}return new He(Te/we,Pe/we)}const fn=[];for(let be=0,xt=Ht.length,Zt=xt-1,Te=be+1;be<xt;be++,Zt++,Te++)Zt===xt&&(Zt=0),Te===xt&&(Te=0),fn[be]=ze(Ht[be],Ht[Zt],Ht[Te]);const _n=[];let Mn,Sn=fn.concat();for(let be=0,xt=xe.length;be<xt;be++){const Zt=xe[be];Mn=[];for(let Te=0,Pe=Zt.length,we=Pe-1,bn=Te+1;Te<Pe;Te++,we++,bn++)we===Pe&&(we=0),bn===Pe&&(bn=0),Mn[Te]=ze(Zt[Te],Zt[we],Zt[bn]);_n.push(Mn),Sn=Sn.concat(Mn)}for(let be=0;be<D;be++){const xt=be/D,Zt=R*Math.cos(xt*Math.PI/2),Te=O*Math.sin(xt*Math.PI/2)+U;for(let Pe=0,we=Ht.length;Pe<we;Pe++){const bn=ce(Ht[Pe],fn[Pe],Te);Fe(bn.x,bn.y,-Zt)}for(let Pe=0,we=xe.length;Pe<we;Pe++){const bn=xe[Pe];Mn=_n[Pe];for(let Gn=0,Fn=bn.length;Gn<Fn;Gn++){const _r=ce(bn[Gn],Mn[Gn],Te);Fe(_r.x,_r.y,-Zt)}}}const Rt=O+U;for(let be=0;be<We;be++){const xt=A?ce(ye[be],Sn[be],Rt):ye[be];Ot?(Pt.copy(mt.normals[0]).multiplyScalar(xt.x),At.copy(mt.binormals[0]).multiplyScalar(xt.y),Et.copy(vt[0]).add(Pt).add(At),Fe(Et.x,Et.y,Et.z)):Fe(xt.x,xt.y,0)}for(let be=1;be<=M;be++)for(let xt=0;xt<We;xt++){const Zt=A?ce(ye[xt],Sn[xt],Rt):ye[xt];Ot?(Pt.copy(mt.normals[be]).multiplyScalar(Zt.x),At.copy(mt.binormals[be]).multiplyScalar(Zt.y),Et.copy(vt[be]).add(Pt).add(At),Fe(Et.x,Et.y,Et.z)):Fe(Zt.x,Zt.y,C/M*be)}for(let be=D-1;be>=0;be--){const xt=be/D,Zt=R*Math.cos(xt*Math.PI/2),Te=O*Math.sin(xt*Math.PI/2)+U;for(let Pe=0,we=Ht.length;Pe<we;Pe++){const bn=ce(Ht[Pe],fn[Pe],Te);Fe(bn.x,bn.y,C+Zt)}for(let Pe=0,we=xe.length;Pe<we;Pe++){const bn=xe[Pe];Mn=_n[Pe];for(let Gn=0,Fn=bn.length;Gn<Fn;Gn++){const _r=ce(bn[Gn],Mn[Gn],Te);Ot?Fe(_r.x,_r.y+vt[M-1].y,vt[M-1].x+Zt):Fe(_r.x,_r.y,C+Zt)}}}function Dt(be,xt){let Zt=be.length;for(;--Zt>=0;){const Te=Zt;let Pe=Zt-1;Pe<0&&(Pe=be.length-1);for(let we=0,bn=M+2*D;we<bn;we++){const Gn=We*we,Fn=We*(we+1);pe(xt+Te+Gn,xt+Pe+Gn,xt+Pe+Fn,xt+Te+Fn)}}}function Fe(be,xt,Zt){_.push(be),_.push(xt),_.push(Zt)}function Be(be,xt,Zt){rn(be),rn(xt),rn(Zt);const Te=l.length/3,Pe=ot.generateTopUV(a,l,Te-3,Te-2,Te-1);sn(Pe[0]),sn(Pe[1]),sn(Pe[2])}function pe(be,xt,Zt,Te){rn(be),rn(xt),rn(Te),rn(xt),rn(Zt),rn(Te);const Pe=l.length/3,we=ot.generateSideWallUV(a,l,Pe-6,Pe-3,Pe-2,Pe-1);sn(we[0]),sn(we[1]),sn(we[3]),sn(we[1]),sn(we[2]),sn(we[3])}function rn(be){l.push(_[3*be+0]),l.push(_[3*be+1]),l.push(_[3*be+2])}function sn(be){d.push(be.x),d.push(be.y)}(function(){const be=l.length/3;if(A){let xt=0,Zt=We*xt;for(let Te=0;Te<je;Te++){const Pe=ge[Te];Be(Pe[2]+Zt,Pe[1]+Zt,Pe[0]+Zt)}xt=M+2*D,Zt=We*xt;for(let Te=0;Te<je;Te++){const Pe=ge[Te];Be(Pe[0]+Zt,Pe[1]+Zt,Pe[2]+Zt)}}else{for(let xt=0;xt<je;xt++){const Zt=ge[xt];Be(Zt[2],Zt[1],Zt[0])}for(let xt=0;xt<je;xt++){const Zt=ge[xt];Be(Zt[0]+We*M,Zt[1]+We*M,Zt[2]+We*M)}}a.addGroup(be,l.length/3-be,0)})(),function(){const be=l.length/3;let xt=0;Dt(Ht,xt),xt+=Ht.length;for(let Zt=0,Te=xe.length;Zt<Te;Zt++){const Pe=xe[Zt];Dt(Pe,xt),xt+=Pe.length}a.addGroup(be,l.length/3-be,1)}()}this.setAttribute("position",new xn(l,3)),this.setAttribute("uv",new xn(d,2)),this.computeVertexNormals()}toJSON(){const t=super.toJSON();return function(i,a,l){if(l.shapes=[],Array.isArray(i))for(let d=0,p=i.length;d<p;d++){const v=i[d];l.shapes.push(v.uuid)}else l.shapes.push(i.uuid);return a.extrudePath!==void 0&&(l.options.extrudePath=a.extrudePath.toJSON()),l}(this.parameters.shapes,this.parameters.options,t)}static fromJSON(t,i){const a=[];for(let d=0,p=t.shapes.length;d<p;d++){const v=i[t.shapes[d]];a.push(v)}const l=t.options.extrudePath;return l!==void 0&&(t.options.extrudePath=new tl[l.type]().fromJSON(l)),new el(a,t.options)}}const Bm={generateTopUV:function(m,t,i,a,l){const d=t[3*i],p=t[3*i+1],v=t[3*a],_=t[3*a+1],x=t[3*l],M=t[3*l+1];return[new He(d,p),new He(v,_),new He(x,M)]},generateSideWallUV:function(m,t,i,a,l,d){const p=t[3*i],v=t[3*i+1],_=t[3*i+2],x=t[3*a],M=t[3*a+1],C=t[3*a+2],A=t[3*l],R=t[3*l+1],O=t[3*l+2],U=t[3*d],D=t[3*d+1],Z=t[3*d+2];return Math.abs(v-M)<Math.abs(p-x)?[new He(p,1-_),new He(x,1-C),new He(A,1-O),new He(U,1-Z)]:[new He(v,1-_),new He(M,1-C),new He(R,1-O),new He(D,1-Z)]}};class Vu extends ln{constructor(t=1,i=0){const a=(1+Math.sqrt(5))/2;super([-1,a,0,1,a,0,-1,-a,0,1,-a,0,0,-1,a,0,1,a,0,-1,-a,0,1,-a,a,0,-1,a,0,1,-a,0,-1,-a,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,i),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:i}}static fromJSON(t){return new Vu(t.radius,t.detail)}}class od extends zn{constructor(t,i=12,a=0,l=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:t,segments:i,phiStart:a,phiLength:l},i=Math.floor(i),l=zi(l,0,2*Math.PI);const d=[],p=[],v=[],_=1/i,x=new gt,M=new He;for(let C=0;C<=i;C++){const A=a+C*_*l,R=Math.sin(A),O=Math.cos(A);for(let U=0;U<=t.length-1;U++)x.x=t[U].x*R,x.y=t[U].y,x.z=t[U].x*O,p.push(x.x,x.y,x.z),M.x=C/i,M.y=U/(t.length-1),v.push(M.x,M.y)}for(let C=0;C<i;C++)for(let A=0;A<t.length-1;A++){const R=A+C*t.length,O=R,U=R+t.length,D=R+t.length+1,Z=R+1;d.push(O,U,Z),d.push(U,D,Z)}if(this.setIndex(d),this.setAttribute("position",new xn(p,3)),this.setAttribute("uv",new xn(v,2)),this.computeVertexNormals(),l===2*Math.PI){const C=this.attributes.normal.array,A=new gt,R=new gt,O=new gt,U=i*t.length*3;for(let D=0,Z=0;D<t.length;D++,Z+=3)A.x=C[Z+0],A.y=C[Z+1],A.z=C[Z+2],R.x=C[U+Z+0],R.y=C[U+Z+1],R.z=C[U+Z+2],O.addVectors(A,R).normalize(),C[Z+0]=C[U+Z+0]=O.x,C[Z+1]=C[U+Z+1]=O.y,C[Z+2]=C[U+Z+2]=O.z}}static fromJSON(t){return new od(t.points,t.segments,t.phiStart,t.phiLength)}}class Kh extends ln{constructor(t=1,i=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,i),this.type="OctahedronGeometry",this.parameters={radius:t,detail:i}}static fromJSON(t){return new Kh(t.radius,t.detail)}}class up extends zn{constructor(t,i,a){super(),this.type="ParametricGeometry",this.parameters={func:t,slices:i,stacks:a};const l=[],d=[],p=[],v=[],_=1e-5,x=new gt,M=new gt,C=new gt,A=new gt,R=new gt;t.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");const O=i+1;for(let U=0;U<=a;U++){const D=U/a;for(let Z=0;Z<=i;Z++){const ot=Z/i;t(ot,D,M),d.push(M.x,M.y,M.z),ot-_>=0?(t(ot-_,D,C),A.subVectors(M,C)):(t(ot+_,D,C),A.subVectors(C,M)),D-_>=0?(t(ot,D-_,C),R.subVectors(M,C)):(t(ot,D+_,C),R.subVectors(C,M)),x.crossVectors(A,R).normalize(),p.push(x.x,x.y,x.z),v.push(ot,D)}}for(let U=0;U<a;U++)for(let D=0;D<i;D++){const Z=U*O+D,ot=U*O+D+1,vt=(U+1)*O+D+1,mt=(U+1)*O+D;l.push(Z,ot,mt),l.push(ot,vt,mt)}this.setIndex(l),this.setAttribute("position",new xn(d,3)),this.setAttribute("normal",new xn(p,3)),this.setAttribute("uv",new xn(v,2))}}class sd extends zn{constructor(t=.5,i=1,a=8,l=1,d=0,p=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:i,thetaSegments:a,phiSegments:l,thetaStart:d,thetaLength:p},a=Math.max(3,a);const v=[],_=[],x=[],M=[];let C=t;const A=(i-t)/(l=Math.max(1,l)),R=new gt,O=new He;for(let U=0;U<=l;U++){for(let D=0;D<=a;D++){const Z=d+D/a*p;R.x=C*Math.cos(Z),R.y=C*Math.sin(Z),_.push(R.x,R.y,R.z),x.push(0,0,1),O.x=(R.x/i+1)/2,O.y=(R.y/i+1)/2,M.push(O.x,O.y)}C+=A}for(let U=0;U<l;U++){const D=U*(a+1);for(let Z=0;Z<a;Z++){const ot=Z+D,vt=ot,mt=ot+a+1,At=ot+a+2,Pt=ot+1;v.push(vt,mt,Pt),v.push(mt,At,Pt)}}this.setIndex(v),this.setAttribute("position",new xn(_,3)),this.setAttribute("normal",new xn(x,3)),this.setAttribute("uv",new xn(M,2))}static fromJSON(t){return new sd(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}}class Qh extends zn{constructor(t,i=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:i};const a=[],l=[],d=[],p=[];let v=0,_=0;if(Array.isArray(t)===!1)x(t);else for(let M=0;M<t.length;M++)x(t[M]),this.addGroup(v,_,M),v+=_,_=0;function x(M){const C=l.length/3,A=M.extractPoints(i);let R=A.shape;const O=A.holes;Ds.isClockWise(R)===!1&&(R=R.reverse());for(let D=0,Z=O.length;D<Z;D++){const ot=O[D];Ds.isClockWise(ot)===!0&&(O[D]=ot.reverse())}const U=Ds.triangulateShape(R,O);for(let D=0,Z=O.length;D<Z;D++){const ot=O[D];R=R.concat(ot)}for(let D=0,Z=R.length;D<Z;D++){const ot=R[D];l.push(ot.x,ot.y,0),d.push(0,0,1),p.push(ot.x,ot.y)}for(let D=0,Z=U.length;D<Z;D++){const ot=U[D],vt=ot[0]+C,mt=ot[1]+C,At=ot[2]+C;a.push(vt,mt,At),_+=3}}this.setIndex(a),this.setAttribute("position",new xn(l,3)),this.setAttribute("normal",new xn(d,3)),this.setAttribute("uv",new xn(p,2))}toJSON(){const t=super.toJSON();return function(i,a){if(a.shapes=[],Array.isArray(i))for(let l=0,d=i.length;l<d;l++){const p=i[l];a.shapes.push(p.uuid)}else a.shapes.push(i.uuid);return a}(this.parameters.shapes,t)}static fromJSON(t,i){const a=[];for(let l=0,d=t.shapes.length;l<d;l++){const p=i[t.shapes[l]];a.push(p)}return new Qh(a,t.curveSegments)}}class tc extends zn{constructor(t=1,i=8,a=6,l=0,d=2*Math.PI,p=0,v=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:i,heightSegments:a,phiStart:l,phiLength:d,thetaStart:p,thetaLength:v},i=Math.max(3,Math.floor(i)),a=Math.max(2,Math.floor(a));const _=Math.min(p+v,Math.PI);let x=0;const M=[],C=new gt,A=new gt,R=[],O=[],U=[],D=[];for(let Z=0;Z<=a;Z++){const ot=[],vt=Z/a;let mt=0;Z==0&&p==0?mt=.5/i:Z==a&&_==Math.PI&&(mt=-.5/i);for(let At=0;At<=i;At++){const Pt=At/i;C.x=-t*Math.cos(l+Pt*d)*Math.sin(p+vt*v),C.y=t*Math.cos(p+vt*v),C.z=t*Math.sin(l+Pt*d)*Math.sin(p+vt*v),O.push(C.x,C.y,C.z),A.copy(C).normalize(),U.push(A.x,A.y,A.z),D.push(Pt+mt,1-vt),ot.push(x++)}M.push(ot)}for(let Z=0;Z<a;Z++)for(let ot=0;ot<i;ot++){const vt=M[Z][ot+1],mt=M[Z][ot],At=M[Z+1][ot],Pt=M[Z+1][ot+1];(Z!==0||p>0)&&R.push(vt,mt,Pt),(Z!==a-1||_<Math.PI)&&R.push(mt,At,Pt)}this.setIndex(R),this.setAttribute("position",new xn(O,3)),this.setAttribute("normal",new xn(U,3)),this.setAttribute("uv",new xn(D,2))}static fromJSON(t){return new tc(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class ad extends ln{constructor(t=1,i=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,i),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:i}}static fromJSON(t){return new ad(t.radius,t.detail)}}class of extends el{constructor(t,i={}){const a=i.font;if(!a||!a.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new zn;const l=a.generateShapes(t,i.size);i.depth=i.height!==void 0?i.height:50,i.bevelThickness===void 0&&(i.bevelThickness=10),i.bevelSize===void 0&&(i.bevelSize=8),i.bevelEnabled===void 0&&(i.bevelEnabled=!1),super(l,i),this.type="TextGeometry"}}class ld extends zn{constructor(t=1,i=.4,a=8,l=6,d=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:i,radialSegments:a,tubularSegments:l,arc:d},a=Math.floor(a),l=Math.floor(l);const p=[],v=[],_=[],x=[],M=new gt,C=new gt,A=new gt;for(let R=0;R<=a;R++)for(let O=0;O<=l;O++){const U=O/l*d,D=R/a*Math.PI*2;C.x=(t+i*Math.cos(D))*Math.cos(U),C.y=(t+i*Math.cos(D))*Math.sin(U),C.z=i*Math.sin(D),v.push(C.x,C.y,C.z),M.x=t*Math.cos(U),M.y=t*Math.sin(U),A.subVectors(C,M).normalize(),_.push(A.x,A.y,A.z),x.push(O/l),x.push(R/a)}for(let R=1;R<=a;R++)for(let O=1;O<=l;O++){const U=(l+1)*R+O-1,D=(l+1)*(R-1)+O-1,Z=(l+1)*(R-1)+O,ot=(l+1)*R+O;p.push(U,D,ot),p.push(D,Z,ot)}this.setIndex(p),this.setAttribute("position",new xn(v,3)),this.setAttribute("normal",new xn(_,3)),this.setAttribute("uv",new xn(x,2))}static fromJSON(t){return new ld(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}}class ud extends zn{constructor(t=1,i=.4,a=64,l=8,d=2,p=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:i,tubularSegments:a,radialSegments:l,p:d,q:p},a=Math.floor(a),l=Math.floor(l);const v=[],_=[],x=[],M=[],C=new gt,A=new gt,R=new gt,O=new gt,U=new gt,D=new gt,Z=new gt;for(let vt=0;vt<=a;++vt){const mt=vt/a*d*Math.PI*2;ot(mt,d,p,t,R),ot(mt+.01,d,p,t,O),D.subVectors(O,R),Z.addVectors(O,R),U.crossVectors(D,Z),Z.crossVectors(U,D),U.normalize(),Z.normalize();for(let At=0;At<=l;++At){const Pt=At/l*Math.PI*2,Et=-i*Math.cos(Pt),Ot=i*Math.sin(Pt);C.x=R.x+(Et*Z.x+Ot*U.x),C.y=R.y+(Et*Z.y+Ot*U.y),C.z=R.z+(Et*Z.z+Ot*U.z),_.push(C.x,C.y,C.z),A.subVectors(C,R).normalize(),x.push(A.x,A.y,A.z),M.push(vt/a),M.push(At/l)}}for(let vt=1;vt<=a;vt++)for(let mt=1;mt<=l;mt++){const At=(l+1)*(vt-1)+(mt-1),Pt=(l+1)*vt+(mt-1),Et=(l+1)*vt+mt,Ot=(l+1)*(vt-1)+mt;v.push(At,Pt,Ot),v.push(Pt,Et,Ot)}function ot(vt,mt,At,Pt,Et){const Ot=Math.cos(vt),Ie=Math.sin(vt),ye=At/mt*vt,xe=Math.cos(ye);Et.x=Pt*(2+xe)*.5*Ot,Et.y=Pt*(2+xe)*Ie*.5,Et.z=Pt*Math.sin(ye)*.5}this.setIndex(v),this.setAttribute("position",new xn(_,3)),this.setAttribute("normal",new xn(x,3)),this.setAttribute("uv",new xn(M,2))}static fromJSON(t){return new ud(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}}class hd extends zn{constructor(t,i=64,a=1,l=8,d=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:i,radius:a,radialSegments:l,closed:d};const p=t.computeFrenetFrames(i,d);this.tangents=p.tangents,this.normals=p.normals,this.binormals=p.binormals;const v=new gt,_=new gt,x=new He;let M=new gt;const C=[],A=[],R=[],O=[];function U(D){M=t.getPointAt(D/i,M);const Z=p.normals[D],ot=p.binormals[D];for(let vt=0;vt<=l;vt++){const mt=vt/l*Math.PI*2,At=Math.sin(mt),Pt=-Math.cos(mt);_.x=Pt*Z.x+At*ot.x,_.y=Pt*Z.y+At*ot.y,_.z=Pt*Z.z+At*ot.z,_.normalize(),A.push(_.x,_.y,_.z),v.x=M.x+a*_.x,v.y=M.y+a*_.y,v.z=M.z+a*_.z,C.push(v.x,v.y,v.z)}}(function(){for(let D=0;D<i;D++)U(D);U(d===!1?i:0),function(){for(let D=0;D<=i;D++)for(let Z=0;Z<=l;Z++)x.x=D/i,x.y=Z/l,R.push(x.x,x.y)}(),function(){for(let D=1;D<=i;D++)for(let Z=1;Z<=l;Z++){const ot=(l+1)*(D-1)+(Z-1),vt=(l+1)*D+(Z-1),mt=(l+1)*D+Z,At=(l+1)*(D-1)+Z;O.push(ot,vt,At),O.push(vt,mt,At)}}()})(),this.setIndex(O),this.setAttribute("position",new xn(C,3)),this.setAttribute("normal",new xn(A,3)),this.setAttribute("uv",new xn(R,2))}toJSON(){const t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new hd(new tl[t.path.type]().fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}class jf extends zn{constructor(t){if(super(),this.type="WireframeGeometry",t.isGeometry===!0)return void console.error("THREE.WireframeGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");const i=[],a=[0,0],l={},d=new gt;if(t.index!==null){const p=t.attributes.position,v=t.index;let _=t.groups;_.length===0&&(_=[{start:0,count:v.count,materialIndex:0}]);for(let x=0,M=_.length;x<M;++x){const C=_[x],A=C.start;for(let R=A,O=A+C.count;R<O;R+=3)for(let U=0;U<3;U++){const D=v.getX(R+U),Z=v.getX(R+(U+1)%3);a[0]=Math.min(D,Z),a[1]=Math.max(D,Z);const ot=a[0]+","+a[1];l[ot]===void 0&&(l[ot]={index1:a[0],index2:a[1]})}}for(const x in l){const M=l[x];d.fromBufferAttribute(p,M.index1),i.push(d.x,d.y,d.z),d.fromBufferAttribute(p,M.index2),i.push(d.x,d.y,d.z)}}else{const p=t.attributes.position;for(let v=0,_=p.count/3;v<_;v++)for(let x=0;x<3;x++){const M=3*v+x;d.fromBufferAttribute(p,M),i.push(d.x,d.y,d.z);const C=3*v+(x+1)%3;d.fromBufferAttribute(p,C),i.push(d.x,d.y,d.z)}}this.setAttribute("position",new xn(i,3))}}var km=Object.freeze({__proto__:null,BoxGeometry:da,BoxBufferGeometry:da,CircleGeometry:me,CircleBufferGeometry:me,ConeGeometry:gn,ConeBufferGeometry:gn,CylinderGeometry:De,CylinderBufferGeometry:De,DodecahedronGeometry:An,DodecahedronBufferGeometry:An,EdgesGeometry:Yn,ExtrudeGeometry:el,ExtrudeBufferGeometry:el,IcosahedronGeometry:Vu,IcosahedronBufferGeometry:Vu,LatheGeometry:od,LatheBufferGeometry:od,OctahedronGeometry:Kh,OctahedronBufferGeometry:Kh,ParametricGeometry:up,ParametricBufferGeometry:up,PlaneGeometry:ma,PlaneBufferGeometry:ma,PolyhedronGeometry:ln,PolyhedronBufferGeometry:ln,RingGeometry:sd,RingBufferGeometry:sd,ShapeGeometry:Qh,ShapeBufferGeometry:Qh,SphereGeometry:tc,SphereBufferGeometry:tc,TetrahedronGeometry:ad,TetrahedronBufferGeometry:ad,TextGeometry:of,TextBufferGeometry:of,TorusGeometry:ld,TorusBufferGeometry:ld,TorusKnotGeometry:ud,TorusKnotBufferGeometry:ud,TubeGeometry:hd,TubeBufferGeometry:hd,WireframeGeometry:jf});class Vf extends Ni{constructor(t){super(),this.type="ShadowMaterial",this.color=new pn(0),this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this}}Vf.prototype.isShadowMaterial=!0;class ec extends _o{constructor(t){super(t),this.type="RawShaderMaterial"}}ec.prototype.isRawShaderMaterial=!0;class hp extends Ni{constructor(t){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new pn(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 pn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hr,this.normalScale=new He(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.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.vertexTangents=!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.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this.vertexTangents=t.vertexTangents,this}}hp.prototype.isMeshStandardMaterial=!0;class Wf extends hp{constructor(t){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new He(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,Object.defineProperty(this,"ior",{get:function(){return(1+.4*this.reflectivity)/(1-.4*this.reflectivity)},set:function(i){this.reflectivity=zi(2.5*(i-1)/(i+1),0,1)}}),this.sheen=null,this.transmission=0,this.transmissionMap=null,this.thickness=.01,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new pn(1,1,1),this.setValues(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.reflectivity=t.reflectivity,t.sheen?this.sheen=(this.sheen||new pn).copy(t.sheen):this.sheen=null,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}}Wf.prototype.isMeshPhysicalMaterial=!0;class Xf extends Ni{constructor(t){super(),this.type="MeshPhongMaterial",this.color=new pn(16777215),this.specular=new pn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hr,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=br,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,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.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.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}Xf.prototype.isMeshPhongMaterial=!0;class qf extends Ni{constructor(t){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new pn(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hr,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,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.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this}}qf.prototype.isMeshToonMaterial=!0;class Yf extends Ni{constructor(t){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hr,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),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.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}Yf.prototype.isMeshNormalMaterial=!0;class Wu extends Ni{constructor(t){super(),this.type="MeshLambertMaterial",this.color=new pn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=br,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,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.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,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.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this}}Wu.prototype.isMeshLambertMaterial=!0;class sf extends Ni{constructor(t){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new pn(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hr,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,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.alphaMap=t.alphaMap,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}sf.prototype.isMeshMatcapMaterial=!0;class Zf 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}}Zf.prototype.isLineDashedMaterial=!0;var Pn=Object.freeze({__proto__:null,ShadowMaterial:Vf,SpriteMaterial:xo,RawShaderMaterial:ec,ShaderMaterial:_o,PointsMaterial:Tl,MeshPhysicalMaterial:Wf,MeshStandardMaterial:hp,MeshPhongMaterial:Xf,MeshToonMaterial:qf,MeshNormalMaterial:Yf,MeshLambertMaterial:Wu,MeshDepthMaterial:Uh,MeshDistanceMaterial:ms,MeshBasicMaterial:Fi,MeshMatcapMaterial:sf,LineDashedMaterial:Zf,LineBasicMaterial:ro,Material:Ni});const di={arraySlice:function(m,t,i){return di.isTypedArray(m)?new m.constructor(m.subarray(t,i!==void 0?i:m.length)):m.slice(t,i)},convertArray:function(m,t,i){return!m||!i&&m.constructor===t?m:typeof t.BYTES_PER_ELEMENT=="number"?new t(m):Array.prototype.slice.call(m)},isTypedArray:function(m){return ArrayBuffer.isView(m)&&!(m instanceof DataView)},getKeyframeOrder:function(m){const t=m.length,i=new Array(t);for(let a=0;a!==t;++a)i[a]=a;return i.sort(function(a,l){return m[a]-m[l]}),i},sortedArray:function(m,t,i){const a=m.length,l=new m.constructor(a);for(let d=0,p=0;p!==a;++d){const v=i[d]*t;for(let _=0;_!==t;++_)l[p++]=m[v+_]}return l},flattenJSON:function(m,t,i,a){let l=1,d=m[0];for(;d!==void 0&&d[a]===void 0;)d=m[l++];if(d===void 0)return;let p=d[a];if(p!==void 0)if(Array.isArray(p))do p=d[a],p!==void 0&&(t.push(d.time),i.push.apply(i,p)),d=m[l++];while(d!==void 0);else if(p.toArray!==void 0)do p=d[a],p!==void 0&&(t.push(d.time),p.toArray(i,i.length)),d=m[l++];while(d!==void 0);else do p=d[a],p!==void 0&&(t.push(d.time),i.push(p)),d=m[l++];while(d!==void 0)},subclip:function(m,t,i,a,l=30){const d=m.clone();d.name=t;const p=[];for(let _=0;_<d.tracks.length;++_){const x=d.tracks[_],M=x.getValueSize(),C=[],A=[];for(let R=0;R<x.times.length;++R){const O=x.times[R]*l;if(!(O<i||O>=a)){C.push(x.times[R]);for(let U=0;U<M;++U)A.push(x.values[R*M+U])}}C.length!==0&&(x.times=di.convertArray(C,x.times.constructor),x.values=di.convertArray(A,x.values.constructor),p.push(x))}d.tracks=p;let v=1/0;for(let _=0;_<d.tracks.length;++_)v>d.tracks[_].times[0]&&(v=d.tracks[_].times[0]);for(let _=0;_<d.tracks.length;++_)d.tracks[_].shift(-1*v);return d.resetDuration(),d},makeClipAdditive:function(m,t=0,i=m,a=30){a<=0&&(a=30);const l=i.tracks.length,d=t/a;for(let p=0;p<l;++p){const v=i.tracks[p],_=v.ValueTypeName;if(_==="bool"||_==="string")continue;const x=m.tracks.find(function(Z){return Z.name===v.name&&Z.ValueTypeName===_});if(x===void 0)continue;let M=0;const C=v.getValueSize();v.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(M=C/3);let A=0;const R=x.getValueSize();x.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(A=R/3);const O=v.times.length-1;let U;if(d<=v.times[0]){const Z=M,ot=C-M;U=di.arraySlice(v.values,Z,ot)}else if(d>=v.times[O]){const Z=O*C+M,ot=Z+C-M;U=di.arraySlice(v.values,Z,ot)}else{const Z=v.createInterpolant(),ot=M,vt=C-M;Z.evaluate(d),U=di.arraySlice(Z.resultBuffer,ot,vt)}_==="quaternion"&&new Oi().fromArray(U).normalize().conjugate().toArray(U);const D=x.times.length;for(let Z=0;Z<D;++Z){const ot=Z*R+A;if(_==="quaternion")Oi.multiplyQuaternionsFlat(x.values,ot,U,0,x.values,ot);else{const vt=R-2*A;for(let mt=0;mt<vt;++mt)x.values[ot+mt]-=U[mt]}}}return m.blendMode=Md,m}};class Ks{constructor(t,i,a,l){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=l!==void 0?l:new i.constructor(a),this.sampleValues=i,this.valueSize=a,this.settings=null,this.DefaultSettings_={}}evaluate(t){const i=this.parameterPositions;let a=this._cachedIndex,l=i[a],d=i[a-1];t:{e:{let p;n:{r:if(!(t<l)){for(let v=a+2;;){if(l===void 0){if(t<d)break r;return a=i.length,this._cachedIndex=a,this.afterEnd_(a-1,t,d)}if(a===v)break;if(d=l,l=i[++a],t<l)break e}p=i.length;break n}if(t>=d)break t;{const v=i[1];t<v&&(a=2,d=v);for(let _=a-2;;){if(d===void 0)return this._cachedIndex=0,this.beforeStart_(0,t,l);if(a===_)break;if(l=d,d=i[--a-1],t>=d)break e}p=a,a=0}}for(;a<p;){const v=a+p>>>1;t<i[v]?p=v:a=v+1}if(l=i[a],d=i[a-1],d===void 0)return this._cachedIndex=0,this.beforeStart_(0,t,l);if(l===void 0)return a=i.length,this._cachedIndex=a,this.afterEnd_(a-1,d,t)}this._cachedIndex=a,this.intervalChanged_(a,d,l)}return this.interpolate_(a,d,t,l)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const i=this.resultBuffer,a=this.sampleValues,l=this.valueSize,d=t*l;for(let p=0;p!==l;++p)i[p]=a[d+p];return i}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}Ks.prototype.beforeStart_=Ks.prototype.copySampleValue_,Ks.prototype.afterEnd_=Ks.prototype.copySampleValue_;class Xu extends Ks{constructor(t,i,a,l){super(t,i,a,l),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:na,endingEnd:na}}intervalChanged_(t,i,a){const l=this.parameterPositions;let d=t-2,p=t+1,v=l[d],_=l[p];if(v===void 0)switch(this.getSettings_().endingStart){case Na:d=t,v=2*i-a;break;case ys:d=l.length-2,v=i+l[d]-l[d+1];break;default:d=t,v=a}if(_===void 0)switch(this.getSettings_().endingEnd){case Na:p=t,_=2*a-i;break;case ys:p=1,_=a+l[1]-l[0];break;default:p=t-1,_=i}const x=.5*(a-i),M=this.valueSize;this._weightPrev=x/(i-v),this._weightNext=x/(_-a),this._offsetPrev=d*M,this._offsetNext=p*M}interpolate_(t,i,a,l){const d=this.resultBuffer,p=this.sampleValues,v=this.valueSize,_=t*v,x=_-v,M=this._offsetPrev,C=this._offsetNext,A=this._weightPrev,R=this._weightNext,O=(a-i)/(l-i),U=O*O,D=U*O,Z=-A*D+2*A*U-A*O,ot=(1+A)*D+(-1.5-2*A)*U+(-.5+A)*O+1,vt=(-1-R)*D+(1.5+R)*U+.5*O,mt=R*D-R*U;for(let At=0;At!==v;++At)d[At]=Z*p[M+At]+ot*p[x+At]+vt*p[_+At]+mt*p[C+At];return d}}class af extends Ks{constructor(t,i,a,l){super(t,i,a,l)}interpolate_(t,i,a,l){const d=this.resultBuffer,p=this.sampleValues,v=this.valueSize,_=t*v,x=_-v,M=(a-i)/(l-i),C=1-M;for(let A=0;A!==v;++A)d[A]=p[x+A]*C+p[_+A]*M;return d}}class lf extends Ks{constructor(t,i,a,l){super(t,i,a,l)}interpolate_(t){return this.copySampleValue_(t-1)}}class Wo{constructor(t,i,a,l){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(i===void 0||i.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=di.convertArray(i,this.TimeBufferType),this.values=di.convertArray(a,this.ValueBufferType),this.setInterpolation(l||this.DefaultInterpolation)}static toJSON(t){const i=t.constructor;let a;if(i.toJSON!==this.toJSON)a=i.toJSON(t);else{a={name:t.name,times:di.convertArray(t.times,Array),values:di.convertArray(t.values,Array)};const l=t.getInterpolation();l!==t.DefaultInterpolation&&(a.interpolation=l)}return a.type=t.ValueTypeName,a}InterpolantFactoryMethodDiscrete(t){return new lf(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new af(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Xu(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let i;switch(t){case Ol:i=this.InterpolantFactoryMethodDiscrete;break;case Ii:i=this.InterpolantFactoryMethodLinear;break;case Da:i=this.InterpolantFactoryMethodSmooth}if(i===void 0){const a="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0){if(t===this.DefaultInterpolation)throw new Error(a);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",a),this}return this.createInterpolant=i,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Ol;case this.InterpolantFactoryMethodLinear:return Ii;case this.InterpolantFactoryMethodSmooth:return Da}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){const i=this.times;for(let a=0,l=i.length;a!==l;++a)i[a]+=t}return this}scale(t){if(t!==1){const i=this.times;for(let a=0,l=i.length;a!==l;++a)i[a]*=t}return this}trim(t,i){const a=this.times,l=a.length;let d=0,p=l-1;for(;d!==l&&a[d]<t;)++d;for(;p!==-1&&a[p]>i;)--p;if(++p,d!==0||p!==l){d>=p&&(p=Math.max(p,1),d=p-1);const v=this.getValueSize();this.times=di.arraySlice(a,d,p),this.values=di.arraySlice(this.values,d*v,p*v)}return this}validate(){let t=!0;const i=this.getValueSize();i-Math.floor(i)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const a=this.times,l=this.values,d=a.length;d===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let p=null;for(let v=0;v!==d;v++){const _=a[v];if(typeof _=="number"&&isNaN(_)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,v,_),t=!1;break}if(p!==null&&p>_){console.error("THREE.KeyframeTrack: Out of order keys.",this,v,_,p),t=!1;break}p=_}if(l!==void 0&&di.isTypedArray(l))for(let v=0,_=l.length;v!==_;++v){const x=l[v];if(isNaN(x)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,v,x),t=!1;break}}return t}optimize(){const t=di.arraySlice(this.times),i=di.arraySlice(this.values),a=this.getValueSize(),l=this.getInterpolation()===Da,d=t.length-1;let p=1;for(let v=1;v<d;++v){let _=!1;const x=t[v];if(x!==t[v+1]&&(v!==1||x!==t[0]))if(l)_=!0;else{const M=v*a,C=M-a,A=M+a;for(let R=0;R!==a;++R){const O=i[M+R];if(O!==i[C+R]||O!==i[A+R]){_=!0;break}}}if(_){if(v!==p){t[p]=t[v];const M=v*a,C=p*a;for(let A=0;A!==a;++A)i[C+A]=i[M+A]}++p}}if(d>0){t[p]=t[d];for(let v=d*a,_=p*a,x=0;x!==a;++x)i[_+x]=i[v+x];++p}return p!==t.length?(this.times=di.arraySlice(t,0,p),this.values=di.arraySlice(i,0,p*a)):(this.times=t,this.values=i),this}clone(){const t=di.arraySlice(this.times,0),i=di.arraySlice(this.values,0),a=new this.constructor(this.name,t,i);return a.createInterpolant=this.createInterpolant,a}}Wo.prototype.TimeBufferType=Float32Array,Wo.prototype.ValueBufferType=Float32Array,Wo.prototype.DefaultInterpolation=Ii;class nc extends Wo{}nc.prototype.ValueTypeName="bool",nc.prototype.ValueBufferType=Array,nc.prototype.DefaultInterpolation=Ol,nc.prototype.InterpolantFactoryMethodLinear=void 0,nc.prototype.InterpolantFactoryMethodSmooth=void 0;class uf extends Wo{}uf.prototype.ValueTypeName="color";class rc extends Wo{}rc.prototype.ValueTypeName="number";class Jf extends Ks{constructor(t,i,a,l){super(t,i,a,l)}interpolate_(t,i,a,l){const d=this.resultBuffer,p=this.sampleValues,v=this.valueSize,_=(a-i)/(l-i);let x=t*v;for(let M=x+v;x!==M;x+=4)Oi.slerpFlat(d,0,p,x-v,p,x,_);return d}}class ic extends Wo{InterpolantFactoryMethodLinear(t){return new Jf(this.times,this.values,this.getValueSize(),t)}}ic.prototype.ValueTypeName="quaternion",ic.prototype.DefaultInterpolation=Ii,ic.prototype.InterpolantFactoryMethodSmooth=void 0;class nl extends Wo{}nl.prototype.ValueTypeName="string",nl.prototype.ValueBufferType=Array,nl.prototype.DefaultInterpolation=Ol,nl.prototype.InterpolantFactoryMethodLinear=void 0,nl.prototype.InterpolantFactoryMethodSmooth=void 0;class qu extends Wo{}qu.prototype.ValueTypeName="vector";class cd{constructor(t,i=-1,a,l=Fa){this.name=t,this.tracks=a,this.duration=i,this.blendMode=l,this.uuid=Fo(),this.duration<0&&this.resetDuration()}static parse(t){const i=[],a=t.tracks,l=1/(t.fps||1);for(let p=0,v=a.length;p!==v;++p)i.push(Tg(a[p]).scale(l));const d=new this(t.name,t.duration,i,t.blendMode);return d.uuid=t.uuid,d}static toJSON(t){const i=[],a=t.tracks,l={name:t.name,duration:t.duration,tracks:i,uuid:t.uuid,blendMode:t.blendMode};for(let d=0,p=a.length;d!==p;++d)i.push(Wo.toJSON(a[d]));return l}static CreateFromMorphTargetSequence(t,i,a,l){const d=i.length,p=[];for(let v=0;v<d;v++){let _=[],x=[];_.push((v+d-1)%d,v,(v+1)%d),x.push(0,1,0);const M=di.getKeyframeOrder(_);_=di.sortedArray(_,1,M),x=di.sortedArray(x,1,M),l||_[0]!==0||(_.push(d),x.push(x[0])),p.push(new rc(".morphTargetInfluences["+i[v].name+"]",_,x).scale(1/a))}return new this(t,-1,p)}static findByName(t,i){let a=t;if(!Array.isArray(t)){const l=t;a=l.geometry&&l.geometry.animations||l.animations}for(let l=0;l<a.length;l++)if(a[l].name===i)return a[l];return null}static CreateClipsFromMorphTargetSequences(t,i,a){const l={},d=/^([\w-]*?)([\d]+)$/;for(let v=0,_=t.length;v<_;v++){const x=t[v],M=x.name.match(d);if(M&&M.length>1){const C=M[1];let A=l[C];A||(l[C]=A=[]),A.push(x)}}const p=[];for(const v in l)p.push(this.CreateFromMorphTargetSequence(v,l[v],i,a));return p}static parseAnimation(t,i){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const a=function(M,C,A,R,O){if(A.length!==0){const U=[],D=[];di.flattenJSON(A,U,D,R),U.length!==0&&O.push(new M(C,U,D))}},l=[],d=t.name||"default",p=t.fps||30,v=t.blendMode;let _=t.length||-1;const x=t.hierarchy||[];for(let M=0;M<x.length;M++){const C=x[M].keys;if(C&&C.length!==0)if(C[0].morphTargets){const A={};let R;for(R=0;R<C.length;R++)if(C[R].morphTargets)for(let O=0;O<C[R].morphTargets.length;O++)A[C[R].morphTargets[O]]=-1;for(const O in A){const U=[],D=[];for(let Z=0;Z!==C[R].morphTargets.length;++Z){const ot=C[R];U.push(ot.time),D.push(ot.morphTarget===O?1:0)}l.push(new rc(".morphTargetInfluence["+O+"]",U,D))}_=A.length*(p||1)}else{const A=".bones["+i[M].name+"]";a(qu,A+".position",C,"pos",l),a(ic,A+".quaternion",C,"rot",l),a(qu,A+".scale",C,"scl",l)}}return l.length===0?null:new this(d,_,l,v)}resetDuration(){let t=0;for(let i=0,a=this.tracks.length;i!==a;++i){const l=this.tracks[i];t=Math.max(t,l.times[l.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let i=0;i<this.tracks.length;i++)t=t&&this.tracks[i].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let i=0;i<this.tracks.length;i++)t.push(this.tracks[i].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Tg(m){if(m.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const t=function(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return rc;case"vector":case"vector2":case"vector3":case"vector4":return qu;case"color":return uf;case"quaternion":return ic;case"bool":case"boolean":return nc;case"string":return nl}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}(m.type);if(m.times===void 0){const i=[],a=[];di.flattenJSON(m.keys,i,a,"value"),m.times=i,m.values=a}return t.parse!==void 0?t.parse(m):new t(m.name,m.times,m.values,m.interpolation)}const oc={enabled:!1,files:{},add:function(m,t){this.enabled!==!1&&(this.files[m]=t)},get:function(m){if(this.enabled!==!1)return this.files[m]},remove:function(m){delete this.files[m]},clear:function(){this.files={}}};class ba{constructor(t,i,a){const l=this;let d=!1,p=0,v=0,_;const x=[];this.onStart=void 0,this.onLoad=t,this.onProgress=i,this.onError=a,this.itemStart=function(M){v++,d===!1&&l.onStart!==void 0&&l.onStart(M,p,v),d=!0},this.itemEnd=function(M){p++,l.onProgress!==void 0&&l.onProgress(M,p,v),p===v&&(d=!1,l.onLoad!==void 0&&l.onLoad())},this.itemError=function(M){l.onError!==void 0&&l.onError(M)},this.resolveURL=function(M){return _?_(M):M},this.setURLModifier=function(M){return _=M,this},this.addHandler=function(M,C){return x.push(M,C),this},this.removeHandler=function(M){const C=x.indexOf(M);return C!==-1&&x.splice(C,2),this},this.getHandler=function(M){for(let C=0,A=x.length;C<A;C+=2){const R=x[C],O=x[C+1];if(R.global&&(R.lastIndex=0),R.test(M))return O}return null}}}const sc=new ba;class Xo{constructor(t){this.manager=t!==void 0?t:sc,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,i){const a=this;return new Promise(function(l,d){a.load(t,l,i,d)})}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 wa={};class Sa extends Xo{constructor(t){super(t)}load(t,i,a,l){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const d=this,p=oc.get(t);if(p!==void 0)return d.manager.itemStart(t),setTimeout(function(){i&&i(p),d.manager.itemEnd(t)},0),p;if(wa[t]!==void 0)return void wa[t].push({onLoad:i,onProgress:a,onError:l});const v=t.match(/^data:(.*?)(;base64)?,(.*)$/);let _;if(v){const x=v[1],M=!!v[2];let C=v[3];C=decodeURIComponent(C),M&&(C=atob(C));try{let A;const R=(this.responseType||"").toLowerCase();switch(R){case"arraybuffer":case"blob":const O=new Uint8Array(C.length);for(let D=0;D<C.length;D++)O[D]=C.charCodeAt(D);A=R==="blob"?new Blob([O.buffer],{type:x}):O.buffer;break;case"document":A=new DOMParser().parseFromString(C,x);break;case"json":A=JSON.parse(C);break;default:A=C}setTimeout(function(){i&&i(A),d.manager.itemEnd(t)},0)}catch(A){setTimeout(function(){l&&l(A),d.manager.itemError(t),d.manager.itemEnd(t)},0)}}else{wa[t]=[],wa[t].push({onLoad:i,onProgress:a,onError:l}),_=new XMLHttpRequest,_.open("GET",t,!0),_.addEventListener("load",function(x){const M=this.response,C=wa[t];if(delete wa[t],this.status===200||this.status===0){this.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),oc.add(t,M);for(let A=0,R=C.length;A<R;A++){const O=C[A];O.onLoad&&O.onLoad(M)}d.manager.itemEnd(t)}else{for(let A=0,R=C.length;A<R;A++){const O=C[A];O.onError&&O.onError(x)}d.manager.itemError(t),d.manager.itemEnd(t)}},!1),_.addEventListener("progress",function(x){const M=wa[t];for(let C=0,A=M.length;C<A;C++){const R=M[C];R.onProgress&&R.onProgress(x)}},!1),_.addEventListener("error",function(x){const M=wa[t];delete wa[t];for(let C=0,A=M.length;C<A;C++){const R=M[C];R.onError&&R.onError(x)}d.manager.itemError(t),d.manager.itemEnd(t)},!1),_.addEventListener("abort",function(x){const M=wa[t];delete wa[t];for(let C=0,A=M.length;C<A;C++){const R=M[C];R.onError&&R.onError(x)}d.manager.itemError(t),d.manager.itemEnd(t)},!1),this.responseType!==void 0&&(_.responseType=this.responseType),this.withCredentials!==void 0&&(_.withCredentials=this.withCredentials),_.overrideMimeType&&_.overrideMimeType(this.mimeType!==void 0?this.mimeType:"text/plain");for(const x in this.requestHeader)_.setRequestHeader(x,this.requestHeader[x]);_.send(null)}return d.manager.itemStart(t),_}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class Eg extends Xo{constructor(t){super(t)}load(t,i,a,l){const d=this,p=new Sa(this.manager);p.setPath(this.path),p.setRequestHeader(this.requestHeader),p.setWithCredentials(this.withCredentials),p.load(t,function(v){try{i(d.parse(JSON.parse(v)))}catch(_){l?l(_):console.error(_),d.manager.itemError(t)}},a,l)}parse(t){const i=[];for(let a=0;a<t.length;a++){const l=cd.parse(t[a]);i.push(l)}return i}}class Um extends Xo{constructor(t){super(t)}load(t,i,a,l){const d=this,p=[],v=new Lt,_=new Sa(this.manager);_.setPath(this.path),_.setResponseType("arraybuffer"),_.setRequestHeader(this.requestHeader),_.setWithCredentials(d.withCredentials);let x=0;function M(C){_.load(t[C],function(A){const R=d.parse(A,!0);p[C]={width:R.width,height:R.height,format:R.format,mipmaps:R.mipmaps},x+=1,x===6&&(R.mipmapCount===1&&(v.minFilter=Qe),v.image=p,v.format=R.format,v.needsUpdate=!0,i&&i(v))},a,l)}if(Array.isArray(t))for(let C=0,A=t.length;C<A;++C)M(C);else _.load(t,function(C){const A=d.parse(C,!0);if(A.isCubemap){const R=A.mipmaps.length/A.mipmapCount;for(let O=0;O<R;O++){p[O]={mipmaps:[]};for(let U=0;U<A.mipmapCount;U++)p[O].mipmaps.push(A.mipmaps[O*A.mipmapCount+U]),p[O].format=A.format,p[O].width=A.width,p[O].height=A.height}v.image=p}else v.image.width=A.width,v.image.height=A.height,v.mipmaps=A.mipmaps;A.mipmapCount===1&&(v.minFilter=Qe),v.format=A.format,v.needsUpdate=!0,i&&i(v)},a,l);return v}}class cp extends Xo{constructor(t){super(t)}load(t,i,a,l){this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const d=this,p=oc.get(t);if(p!==void 0)return d.manager.itemStart(t),setTimeout(function(){i&&i(p),d.manager.itemEnd(t)},0),p;const v=document.createElementNS("http://www.w3.org/1999/xhtml","img");function _(){v.removeEventListener("load",_,!1),v.removeEventListener("error",x,!1),oc.add(t,this),i&&i(this),d.manager.itemEnd(t)}function x(M){v.removeEventListener("load",_,!1),v.removeEventListener("error",x,!1),l&&l(M),d.manager.itemError(t),d.manager.itemEnd(t)}return v.addEventListener("load",_,!1),v.addEventListener("error",x,!1),t.substr(0,5)!=="data:"&&this.crossOrigin!==void 0&&(v.crossOrigin=this.crossOrigin),d.manager.itemStart(t),v.src=t,v}}class $f extends Xo{constructor(t){super(t)}load(t,i,a,l){const d=new ql,p=new cp(this.manager);p.setCrossOrigin(this.crossOrigin),p.setPath(this.path);let v=0;function _(x){p.load(t[x],function(M){d.images[x]=M,v++,v===6&&(d.needsUpdate=!0,i&&i(d))},void 0,l)}for(let x=0;x<t.length;++x)_(x);return d}}class Gm extends Xo{constructor(t){super(t)}load(t,i,a,l){const d=this,p=new Ls,v=new Sa(this.manager);return v.setResponseType("arraybuffer"),v.setRequestHeader(this.requestHeader),v.setPath(this.path),v.setWithCredentials(d.withCredentials),v.load(t,function(_){const x=d.parse(_);x&&(x.image!==void 0?p.image=x.image:x.data!==void 0&&(p.image.width=x.width,p.image.height=x.height,p.image.data=x.data),p.wrapS=x.wrapS!==void 0?x.wrapS:St,p.wrapT=x.wrapT!==void 0?x.wrapT:St,p.magFilter=x.magFilter!==void 0?x.magFilter:Qe,p.minFilter=x.minFilter!==void 0?x.minFilter:Qe,p.anisotropy=x.anisotropy!==void 0?x.anisotropy:1,x.encoding!==void 0&&(p.encoding=x.encoding),x.flipY!==void 0&&(p.flipY=x.flipY),x.format!==void 0&&(p.format=x.format),x.type!==void 0&&(p.type=x.type),x.mipmaps!==void 0&&(p.mipmaps=x.mipmaps,p.minFilter=Yr),x.mipmapCount===1&&(p.minFilter=Qe),x.generateMipmaps!==void 0&&(p.generateMipmaps=x.generateMipmaps),p.needsUpdate=!0,i&&i(p,x))},a,l),p}}class Kf extends Xo{constructor(t){super(t)}load(t,i,a,l){const d=new ni,p=new cp(this.manager);return p.setCrossOrigin(this.crossOrigin),p.setPath(this.path),p.load(t,function(v){d.image=v;const _=t.search(/\.jpe?g($|\?)/i)>0||t.search(/^data\:image\/jpeg/)===0;d.format=_?yn:Tn,d.needsUpdate=!0,i!==void 0&&i(d)},a,l),d}}class Hm extends wn{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),i=this.curves[this.curves.length-1].getPoint(1);t.equals(i)||this.curves.push(new zu(i,t))}getPoint(t){const i=t*this.getLength(),a=this.getCurveLengths();let l=0;for(;l<a.length;){if(a[l]>=i){const d=a[l]-i,p=this.curves[l],v=p.getLength(),_=v===0?0:1-d/v;return p.getPointAt(_)}l++}return null}getLength(){const 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 t=[];let i=0;for(let a=0,l=this.curves.length;a<l;a++)i+=this.curves[a].getLength(),t.push(i);return this.cacheLengths=t,t}getSpacedPoints(t=40){const i=[];for(let a=0;a<=t;a++)i.push(this.getPoint(a/t));return this.autoClose&&i.push(i[0]),i}getPoints(t=12){const i=[];let a;for(let l=0,d=this.curves;l<d.length;l++){const p=d[l],v=p&&p.isEllipseCurve?2*t:p&&(p.isLineCurve||p.isLineCurve3)?1:p&&p.isSplineCurve?t*p.points.length:t,_=p.getPoints(v);for(let x=0;x<_.length;x++){const M=_[x];a&&a.equals(M)||(i.push(M),a=M)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}copy(t){super.copy(t),this.curves=[];for(let i=0,a=t.curves.length;i<a;i++){const l=t.curves[i];this.curves.push(l.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let i=0,a=this.curves.length;i<a;i++){const l=this.curves[i];t.curves.push(l.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let i=0,a=t.curves.length;i<a;i++){const l=t.curves[i];this.curves.push(new tl[l.type]().fromJSON(l))}return this}}class ac extends Hm{constructor(t){super(),this.type="Path",this.currentPoint=new He,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let i=1,a=t.length;i<a;i++)this.lineTo(t[i].x,t[i].y);return this}moveTo(t,i){return this.currentPoint.set(t,i),this}lineTo(t,i){const a=new zu(this.currentPoint.clone(),new He(t,i));return this.curves.push(a),this.currentPoint.set(t,i),this}quadraticCurveTo(t,i,a,l){const d=new su(this.currentPoint.clone(),new He(t,i),new He(a,l));return this.curves.push(d),this.currentPoint.set(a,l),this}bezierCurveTo(t,i,a,l,d,p){const v=new ya(this.currentPoint.clone(),new He(t,i),new He(a,l),new He(d,p));return this.curves.push(v),this.currentPoint.set(d,p),this}splineThru(t){const i=[this.currentPoint.clone()].concat(t),a=new au(i);return this.curves.push(a),this.currentPoint.copy(t[t.length-1]),this}arc(t,i,a,l,d,p){const v=this.currentPoint.x,_=this.currentPoint.y;return this.absarc(t+v,i+_,a,l,d,p),this}absarc(t,i,a,l,d,p){return this.absellipse(t,i,a,a,l,d,p),this}ellipse(t,i,a,l,d,p,v,_){const x=this.currentPoint.x,M=this.currentPoint.y;return this.absellipse(t+x,i+M,a,l,d,p,v,_),this}absellipse(t,i,a,l,d,p,v,_){const x=new lr(t,i,a,l,d,p,v,_);if(this.curves.length>0){const C=x.getPoint(0);C.equals(this.currentPoint)||this.lineTo(C.x,C.y)}this.curves.push(x);const M=x.getPoint(1);return this.currentPoint.copy(M),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 Yu extends ac{constructor(t){super(t),this.uuid=Fo(),this.type="Shape",this.holes=[]}getPointsHoles(t){const i=[];for(let a=0,l=this.holes.length;a<l;a++)i[a]=this.holes[a].getPoints(t);return i}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let i=0,a=t.holes.length;i<a;i++){const l=t.holes[i];this.holes.push(l.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let i=0,a=this.holes.length;i<a;i++){const l=this.holes[i];t.holes.push(l.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let i=0,a=t.holes.length;i<a;i++){const l=t.holes[i];this.holes.push(new ac().fromJSON(l))}return this}}class Ta extends ar{constructor(t,i=1){super(),this.type="Light",this.color=new pn(t),this.intensity=i}dispose(){}copy(t){return super.copy(t),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const i=super.toJSON(t);return i.object.color=this.color.getHex(),i.object.intensity=this.intensity,this.groundColor!==void 0&&(i.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(i.object.distance=this.distance),this.angle!==void 0&&(i.object.angle=this.angle),this.decay!==void 0&&(i.object.decay=this.decay),this.penumbra!==void 0&&(i.object.penumbra=this.penumbra),this.shadow!==void 0&&(i.object.shadow=this.shadow.toJSON()),i}}Ta.prototype.isLight=!0;class hf extends Ta{constructor(t,i,a){super(t,a),this.type="HemisphereLight",this.position.copy(ar.DefaultUp),this.updateMatrix(),this.groundColor=new pn(i)}copy(t){return Ta.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}hf.prototype.isHemisphereLight=!0;const cf=new En,df=new gt,Qf=new gt;class tm{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.mapSize=new He(512,512),this.map=null,this.mapPass=null,this.matrix=new En,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Xa,this._frameExtents=new He(1,1),this._viewportCount=1,this._viewports=[new Ir(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const i=this.camera,a=this.matrix;df.setFromMatrixPosition(t.matrixWorld),i.position.copy(df),Qf.setFromMatrixPosition(t.target.matrixWorld),i.lookAt(Qf),i.updateMatrixWorld(),cf.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(cf),a.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),a.multiply(i.projectionMatrix),a.multiply(i.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 this.bias!==0&&(t.bias=this.bias),this.normalBias!==0&&(t.normalBias=this.normalBias),this.radius!==1&&(t.radius=this.radius),this.mapSize.x===512&&this.mapSize.y===512||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class zm extends tm{constructor(){super(new Yi(50,1,.5,500)),this.focus=1}updateMatrices(t){const i=this.camera,a=2*ia*t.angle*this.focus,l=this.mapSize.width/this.mapSize.height,d=t.distance||i.far;a===i.fov&&l===i.aspect&&d===i.far||(i.fov=a,i.aspect=l,i.far=d,i.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}zm.prototype.isSpotLightShadow=!0;class dd extends Ta{constructor(t,i,a=0,l=Math.PI/3,d=0,p=1){super(t,i),this.type="SpotLight",this.position.copy(ar.DefaultUp),this.updateMatrix(),this.target=new ar,this.distance=a,this.angle=l,this.penumbra=d,this.decay=p,this.shadow=new zm}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}}dd.prototype.isSpotLight=!0;const em=new En,Zu=new gt,nm=new gt;class jm extends tm{constructor(){super(new Yi(90,1,.5,500)),this._frameExtents=new He(4,2),this._viewportCount=6,this._viewports=[new Ir(2,1,1,1),new Ir(0,1,1,1),new Ir(3,1,1,1),new Ir(1,1,1,1),new Ir(3,0,1,1),new Ir(1,0,1,1)],this._cubeDirections=[new gt(1,0,0),new gt(-1,0,0),new gt(0,0,1),new gt(0,0,-1),new gt(0,1,0),new gt(0,-1,0)],this._cubeUps=[new gt(0,1,0),new gt(0,1,0),new gt(0,1,0),new gt(0,1,0),new gt(0,0,1),new gt(0,0,-1)]}updateMatrices(t,i=0){const a=this.camera,l=this.matrix,d=t.distance||a.far;d!==a.far&&(a.far=d,a.updateProjectionMatrix()),Zu.setFromMatrixPosition(t.matrixWorld),a.position.copy(Zu),nm.copy(a.position),nm.add(this._cubeDirections[i]),a.up.copy(this._cubeUps[i]),a.lookAt(nm),a.updateMatrixWorld(),l.makeTranslation(-Zu.x,-Zu.y,-Zu.z),em.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),this._frustum.setFromProjectionMatrix(em)}}jm.prototype.isPointLightShadow=!0;class rm extends Ta{constructor(t,i,a=0,l=1){super(t,i),this.type="PointLight",this.distance=a,this.decay=l,this.shadow=new jm}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}}rm.prototype.isPointLight=!0;class dp extends Xl{constructor(t=-1,i=1,a=1,l=-1,d=.1,p=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=i,this.top=a,this.bottom=l,this.near=d,this.far=p,this.updateProjectionMatrix()}copy(t,i){return super.copy(t,i),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=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,i,a,l,d,p){this.view===null&&(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=i,this.view.offsetX=a,this.view.offsetY=l,this.view.width=d,this.view.height=p,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),i=(this.top-this.bottom)/(2*this.zoom),a=(this.right+this.left)/2,l=(this.top+this.bottom)/2;let d=a-t,p=a+t,v=l+i,_=l-i;if(this.view!==null&&this.view.enabled){const x=(this.right-this.left)/this.view.fullWidth/this.zoom,M=(this.top-this.bottom)/this.view.fullHeight/this.zoom;d+=x*this.view.offsetX,p=d+x*this.view.width,v-=M*this.view.offsetY,_=v-M*this.view.height}this.projectionMatrix.makeOrthographic(d,p,v,_,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const i=super.toJSON(t);return i.object.zoom=this.zoom,i.object.left=this.left,i.object.right=this.right,i.object.top=this.top,i.object.bottom=this.bottom,i.object.near=this.near,i.object.far=this.far,this.view!==null&&(i.object.view=Object.assign({},this.view)),i}}dp.prototype.isOrthographicCamera=!0;class Vm extends tm{constructor(){super(new dp(-5,5,5,-5,.5,500))}}Vm.prototype.isDirectionalLightShadow=!0;class Ju extends Ta{constructor(t,i){super(t,i),this.type="DirectionalLight",this.position.copy(ar.DefaultUp),this.updateMatrix(),this.target=new ar,this.shadow=new Vm}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}Ju.prototype.isDirectionalLight=!0;class pf extends Ta{constructor(t,i){super(t,i),this.type="AmbientLight"}}pf.prototype.isAmbientLight=!0;class lc extends Ta{constructor(t,i,a=10,l=10){super(t,i),this.type="RectAreaLight",this.width=a,this.height=l}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const i=super.toJSON(t);return i.object.width=this.width,i.object.height=this.height,i}}lc.prototype.isRectAreaLight=!0;class Re{constructor(){this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new gt)}set(t){for(let i=0;i<9;i++)this.coefficients[i].copy(t[i]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,i){const a=t.x,l=t.y,d=t.z,p=this.coefficients;return i.copy(p[0]).multiplyScalar(.282095),i.addScaledVector(p[1],.488603*l),i.addScaledVector(p[2],.488603*d),i.addScaledVector(p[3],.488603*a),i.addScaledVector(p[4],a*l*1.092548),i.addScaledVector(p[5],l*d*1.092548),i.addScaledVector(p[6],.315392*(3*d*d-1)),i.addScaledVector(p[7],a*d*1.092548),i.addScaledVector(p[8],.546274*(a*a-l*l)),i}getIrradianceAt(t,i){const a=t.x,l=t.y,d=t.z,p=this.coefficients;return i.copy(p[0]).multiplyScalar(.886227),i.addScaledVector(p[1],1.023328*l),i.addScaledVector(p[2],1.023328*d),i.addScaledVector(p[3],1.023328*a),i.addScaledVector(p[4],.858086*a*l),i.addScaledVector(p[5],.858086*l*d),i.addScaledVector(p[6],.743125*d*d-.247708),i.addScaledVector(p[7],.858086*a*d),i.addScaledVector(p[8],.429043*(a*a-l*l)),i}add(t){for(let i=0;i<9;i++)this.coefficients[i].add(t.coefficients[i]);return this}addScaledSH(t,i){for(let a=0;a<9;a++)this.coefficients[a].addScaledVector(t.coefficients[a],i);return this}scale(t){for(let i=0;i<9;i++)this.coefficients[i].multiplyScalar(t);return this}lerp(t,i){for(let a=0;a<9;a++)this.coefficients[a].lerp(t.coefficients[a],i);return this}equals(t){for(let i=0;i<9;i++)if(!this.coefficients[i].equals(t.coefficients[i]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(t,i=0){const a=this.coefficients;for(let l=0;l<9;l++)a[l].fromArray(t,i+3*l);return this}toArray(t=[],i=0){const a=this.coefficients;for(let l=0;l<9;l++)a[l].toArray(t,i+3*l);return t}static getBasisAt(t,i){const a=t.x,l=t.y,d=t.z;i[0]=.282095,i[1]=.488603*l,i[2]=.488603*d,i[3]=.488603*a,i[4]=1.092548*a*l,i[5]=1.092548*l*d,i[6]=.315392*(3*d*d-1),i[7]=1.092548*a*d,i[8]=.546274*(a*a-l*l)}}Re.prototype.isSphericalHarmonics3=!0;class pp extends Ta{constructor(t=new Re,i=1){super(void 0,i),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 i=super.toJSON(t);return i.object.sh=this.sh.toArray(),i}}pp.prototype.isLightProbe=!0;class pd extends Xo{constructor(t){super(t),this.textures={}}load(t,i,a,l){const d=this,p=new Sa(d.manager);p.setPath(d.path),p.setRequestHeader(d.requestHeader),p.setWithCredentials(d.withCredentials),p.load(t,function(v){try{i(d.parse(JSON.parse(v)))}catch(_){l?l(_):console.error(_),d.manager.itemError(t)}},a,l)}parse(t){const i=this.textures;function a(d){return i[d]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",d),i[d]}const l=new Pn[t.type];if(t.uuid!==void 0&&(l.uuid=t.uuid),t.name!==void 0&&(l.name=t.name),t.color!==void 0&&l.color!==void 0&&l.color.setHex(t.color),t.roughness!==void 0&&(l.roughness=t.roughness),t.metalness!==void 0&&(l.metalness=t.metalness),t.sheen!==void 0&&(l.sheen=new pn().setHex(t.sheen)),t.emissive!==void 0&&l.emissive!==void 0&&l.emissive.setHex(t.emissive),t.specular!==void 0&&l.specular!==void 0&&l.specular.setHex(t.specular),t.shininess!==void 0&&(l.shininess=t.shininess),t.clearcoat!==void 0&&(l.clearcoat=t.clearcoat),t.clearcoatRoughness!==void 0&&(l.clearcoatRoughness=t.clearcoatRoughness),t.transmission!==void 0&&(l.transmission=t.transmission),t.thickness!==void 0&&(l.thickness=t.thickness),t.attenuationDistance!==void 0&&(l.attenuationDistance=t.attenuationDistance),t.attenuationColor!==void 0&&l.attenuationColor!==void 0&&l.attenuationColor.setHex(t.attenuationColor),t.fog!==void 0&&(l.fog=t.fog),t.flatShading!==void 0&&(l.flatShading=t.flatShading),t.blending!==void 0&&(l.blending=t.blending),t.combine!==void 0&&(l.combine=t.combine),t.side!==void 0&&(l.side=t.side),t.shadowSide!==void 0&&(l.shadowSide=t.shadowSide),t.opacity!==void 0&&(l.opacity=t.opacity),t.transparent!==void 0&&(l.transparent=t.transparent),t.alphaTest!==void 0&&(l.alphaTest=t.alphaTest),t.depthTest!==void 0&&(l.depthTest=t.depthTest),t.depthWrite!==void 0&&(l.depthWrite=t.depthWrite),t.colorWrite!==void 0&&(l.colorWrite=t.colorWrite),t.stencilWrite!==void 0&&(l.stencilWrite=t.stencilWrite),t.stencilWriteMask!==void 0&&(l.stencilWriteMask=t.stencilWriteMask),t.stencilFunc!==void 0&&(l.stencilFunc=t.stencilFunc),t.stencilRef!==void 0&&(l.stencilRef=t.stencilRef),t.stencilFuncMask!==void 0&&(l.stencilFuncMask=t.stencilFuncMask),t.stencilFail!==void 0&&(l.stencilFail=t.stencilFail),t.stencilZFail!==void 0&&(l.stencilZFail=t.stencilZFail),t.stencilZPass!==void 0&&(l.stencilZPass=t.stencilZPass),t.wireframe!==void 0&&(l.wireframe=t.wireframe),t.wireframeLinewidth!==void 0&&(l.wireframeLinewidth=t.wireframeLinewidth),t.wireframeLinecap!==void 0&&(l.wireframeLinecap=t.wireframeLinecap),t.wireframeLinejoin!==void 0&&(l.wireframeLinejoin=t.wireframeLinejoin),t.rotation!==void 0&&(l.rotation=t.rotation),t.linewidth!==1&&(l.linewidth=t.linewidth),t.dashSize!==void 0&&(l.dashSize=t.dashSize),t.gapSize!==void 0&&(l.gapSize=t.gapSize),t.scale!==void 0&&(l.scale=t.scale),t.polygonOffset!==void 0&&(l.polygonOffset=t.polygonOffset),t.polygonOffsetFactor!==void 0&&(l.polygonOffsetFactor=t.polygonOffsetFactor),t.polygonOffsetUnits!==void 0&&(l.polygonOffsetUnits=t.polygonOffsetUnits),t.morphTargets!==void 0&&(l.morphTargets=t.morphTargets),t.morphNormals!==void 0&&(l.morphNormals=t.morphNormals),t.dithering!==void 0&&(l.dithering=t.dithering),t.alphaToCoverage!==void 0&&(l.alphaToCoverage=t.alphaToCoverage),t.premultipliedAlpha!==void 0&&(l.premultipliedAlpha=t.premultipliedAlpha),t.vertexTangents!==void 0&&(l.vertexTangents=t.vertexTangents),t.visible!==void 0&&(l.visible=t.visible),t.toneMapped!==void 0&&(l.toneMapped=t.toneMapped),t.userData!==void 0&&(l.userData=t.userData),t.vertexColors!==void 0&&(typeof t.vertexColors=="number"?l.vertexColors=t.vertexColors>0:l.vertexColors=t.vertexColors),t.uniforms!==void 0)for(const d in t.uniforms){const p=t.uniforms[d];switch(l.uniforms[d]={},p.type){case"t":l.uniforms[d].value=a(p.value);break;case"c":l.uniforms[d].value=new pn().setHex(p.value);break;case"v2":l.uniforms[d].value=new He().fromArray(p.value);break;case"v3":l.uniforms[d].value=new gt().fromArray(p.value);break;case"v4":l.uniforms[d].value=new Ir().fromArray(p.value);break;case"m3":l.uniforms[d].value=new ji().fromArray(p.value);break;case"m4":l.uniforms[d].value=new En().fromArray(p.value);break;default:l.uniforms[d].value=p.value}}if(t.defines!==void 0&&(l.defines=t.defines),t.vertexShader!==void 0&&(l.vertexShader=t.vertexShader),t.fragmentShader!==void 0&&(l.fragmentShader=t.fragmentShader),t.extensions!==void 0)for(const d in t.extensions)l.extensions[d]=t.extensions[d];if(t.shading!==void 0&&(l.flatShading=t.shading===1),t.size!==void 0&&(l.size=t.size),t.sizeAttenuation!==void 0&&(l.sizeAttenuation=t.sizeAttenuation),t.map!==void 0&&(l.map=a(t.map)),t.matcap!==void 0&&(l.matcap=a(t.matcap)),t.alphaMap!==void 0&&(l.alphaMap=a(t.alphaMap)),t.bumpMap!==void 0&&(l.bumpMap=a(t.bumpMap)),t.bumpScale!==void 0&&(l.bumpScale=t.bumpScale),t.normalMap!==void 0&&(l.normalMap=a(t.normalMap)),t.normalMapType!==void 0&&(l.normalMapType=t.normalMapType),t.normalScale!==void 0){let d=t.normalScale;Array.isArray(d)===!1&&(d=[d,d]),l.normalScale=new He().fromArray(d)}return t.displacementMap!==void 0&&(l.displacementMap=a(t.displacementMap)),t.displacementScale!==void 0&&(l.displacementScale=t.displacementScale),t.displacementBias!==void 0&&(l.displacementBias=t.displacementBias),t.roughnessMap!==void 0&&(l.roughnessMap=a(t.roughnessMap)),t.metalnessMap!==void 0&&(l.metalnessMap=a(t.metalnessMap)),t.emissiveMap!==void 0&&(l.emissiveMap=a(t.emissiveMap)),t.emissiveIntensity!==void 0&&(l.emissiveIntensity=t.emissiveIntensity),t.specularMap!==void 0&&(l.specularMap=a(t.specularMap)),t.envMap!==void 0&&(l.envMap=a(t.envMap)),t.envMapIntensity!==void 0&&(l.envMapIntensity=t.envMapIntensity),t.reflectivity!==void 0&&(l.reflectivity=t.reflectivity),t.refractionRatio!==void 0&&(l.refractionRatio=t.refractionRatio),t.lightMap!==void 0&&(l.lightMap=a(t.lightMap)),t.lightMapIntensity!==void 0&&(l.lightMapIntensity=t.lightMapIntensity),t.aoMap!==void 0&&(l.aoMap=a(t.aoMap)),t.aoMapIntensity!==void 0&&(l.aoMapIntensity=t.aoMapIntensity),t.gradientMap!==void 0&&(l.gradientMap=a(t.gradientMap)),t.clearcoatMap!==void 0&&(l.clearcoatMap=a(t.clearcoatMap)),t.clearcoatRoughnessMap!==void 0&&(l.clearcoatRoughnessMap=a(t.clearcoatRoughnessMap)),t.clearcoatNormalMap!==void 0&&(l.clearcoatNormalMap=a(t.clearcoatNormalMap)),t.clearcoatNormalScale!==void 0&&(l.clearcoatNormalScale=new He().fromArray(t.clearcoatNormalScale)),t.transmissionMap!==void 0&&(l.transmissionMap=a(t.transmissionMap)),t.thicknessMap!==void 0&&(l.thicknessMap=a(t.thicknessMap)),l}setTextures(t){return this.textures=t,this}}class uc{static decodeText(t){if(typeof TextDecoder!="undefined")return new TextDecoder().decode(t);let i="";for(let a=0,l=t.length;a<l;a++)i+=String.fromCharCode(t[a]);try{return decodeURIComponent(escape(i))}catch{return i}}static extractUrlBase(t){const i=t.lastIndexOf("/");return i===-1?"./":t.substr(0,i+1)}}class fp extends zn{constructor(){super(),this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}clone(){return new this.constructor().copy(this)}toJSON(){const t=super.toJSON(this);return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}fp.prototype.isInstancedBufferGeometry=!0;class ff extends Kn{constructor(t,i,a,l=1){typeof a=="number"&&(l=a,a=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(t,i,a),this.meshPerAttribute=l}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}}ff.prototype.isInstancedBufferAttribute=!0;class mp extends Xo{constructor(t){super(t)}load(t,i,a,l){const d=this,p=new Sa(d.manager);p.setPath(d.path),p.setRequestHeader(d.requestHeader),p.setWithCredentials(d.withCredentials),p.load(t,function(v){try{i(d.parse(JSON.parse(v)))}catch(_){l?l(_):console.error(_),d.manager.itemError(t)}},a,l)}parse(t){const i={},a={};function l(C,A){if(i[A]!==void 0)return i[A];const R=C.interleavedBuffers[A],O=function(Z,ot){if(a[ot]!==void 0)return a[ot];const vt=Z.arrayBuffers[ot],mt=new Uint32Array(vt).buffer;return a[ot]=mt,mt}(C,R.buffer),U=Si(R.type,O),D=new wl(U,R.stride);return D.uuid=R.uuid,i[A]=D,D}const d=t.isInstancedBufferGeometry?new fp:new zn,p=t.data.index;if(p!==void 0){const C=Si(p.type,p.array);d.setIndex(new Kn(C,1))}const v=t.data.attributes;for(const C in v){const A=v[C];let R;if(A.isInterleavedBufferAttribute){const O=l(t.data,A.data);R=new ri(O,A.itemSize,A.offset,A.normalized)}else{const O=Si(A.type,A.array);R=new(A.isInstancedBufferAttribute?ff:Kn)(O,A.itemSize,A.normalized)}A.name!==void 0&&(R.name=A.name),A.usage!==void 0&&R.setUsage(A.usage),A.updateRange!==void 0&&(R.updateRange.offset=A.updateRange.offset,R.updateRange.count=A.updateRange.count),d.setAttribute(C,R)}const _=t.data.morphAttributes;if(_)for(const C in _){const A=_[C],R=[];for(let O=0,U=A.length;O<U;O++){const D=A[O];let Z;if(D.isInterleavedBufferAttribute){const ot=l(t.data,D.data);Z=new ri(ot,D.itemSize,D.offset,D.normalized)}else{const ot=Si(D.type,D.array);Z=new Kn(ot,D.itemSize,D.normalized)}D.name!==void 0&&(Z.name=D.name),R.push(Z)}d.morphAttributes[C]=R}t.data.morphTargetsRelative&&(d.morphTargetsRelative=!0);const x=t.data.groups||t.data.drawcalls||t.data.offsets;if(x!==void 0)for(let C=0,A=x.length;C!==A;++C){const R=x[C];d.addGroup(R.start,R.count,R.materialIndex)}const M=t.data.boundingSphere;if(M!==void 0){const C=new gt;M.center!==void 0&&C.fromArray(M.center),d.boundingSphere=new ws(C,M.radius)}return t.name&&(d.name=t.name),t.userData&&(d.userData=t.userData),d}}class Mg extends Xo{constructor(t){super(t)}load(t,i,a,l){const d=this,p=this.path===""?uc.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||p;const v=new Sa(this.manager);v.setPath(this.path),v.setRequestHeader(this.requestHeader),v.setWithCredentials(this.withCredentials),v.load(t,function(_){let x=null;try{x=JSON.parse(_)}catch(C){return l!==void 0&&l(C),void console.error("THREE:ObjectLoader: Can't parse "+t+".",C.message)}const M=x.metadata;M!==void 0&&M.type!==void 0&&M.type.toLowerCase()!=="geometry"?d.parse(x,i):console.error("THREE.ObjectLoader: Can't load "+t)},a,l)}async loadAsync(t,i){const a=this.path===""?uc.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||a;const l=new Sa(this.manager);l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials);const d=await l.loadAsync(t,i),p=JSON.parse(d),v=p.metadata;if(v===void 0||v.type===void 0||v.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+t);return await this.parseAsync(p)}parse(t,i){const a=this.parseAnimations(t.animations),l=this.parseShapes(t.shapes),d=this.parseGeometries(t.geometries,l),p=this.parseImages(t.images,function(){i!==void 0&&i(x)}),v=this.parseTextures(t.textures,p),_=this.parseMaterials(t.materials,v),x=this.parseObject(t.object,d,_,v,a),M=this.parseSkeletons(t.skeletons,x);if(this.bindSkeletons(x,M),i!==void 0){let C=!1;for(const A in p)if(p[A]instanceof HTMLImageElement){C=!0;break}C===!1&&i(x)}return x}async parseAsync(t){const i=this.parseAnimations(t.animations),a=this.parseShapes(t.shapes),l=this.parseGeometries(t.geometries,a),d=await this.parseImagesAsync(t.images),p=this.parseTextures(t.textures,d),v=this.parseMaterials(t.materials,p),_=this.parseObject(t.object,l,v,p,i),x=this.parseSkeletons(t.skeletons,_);return this.bindSkeletons(_,x),_}parseShapes(t){const i={};if(t!==void 0)for(let a=0,l=t.length;a<l;a++){const d=new Yu().fromJSON(t[a]);i[d.uuid]=d}return i}parseSkeletons(t,i){const a={},l={};if(i.traverse(function(d){d.isBone&&(l[d.uuid]=d)}),t!==void 0)for(let d=0,p=t.length;d<p;d++){const v=new Hu().fromJSON(t[d],l);a[v.uuid]=v}return a}parseGeometries(t,i){const a={};if(t!==void 0){const l=new mp;for(let d=0,p=t.length;d<p;d++){let v;const _=t[d];switch(_.type){case"BufferGeometry":case"InstancedBufferGeometry":v=l.parse(_);break;case"Geometry":console.error("THREE.ObjectLoader: The legacy Geometry type is no longer supported.");break;default:_.type in km?v=km[_.type].fromJSON(_,i):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${_.type}"`)}v.uuid=_.uuid,_.name!==void 0&&(v.name=_.name),v.isBufferGeometry===!0&&_.userData!==void 0&&(v.userData=_.userData),a[_.uuid]=v}}return a}parseMaterials(t,i){const a={},l={};if(t!==void 0){const d=new pd;d.setTextures(i);for(let p=0,v=t.length;p<v;p++){const _=t[p];if(_.type==="MultiMaterial"){const x=[];for(let M=0;M<_.materials.length;M++){const C=_.materials[M];a[C.uuid]===void 0&&(a[C.uuid]=d.parse(C)),x.push(a[C.uuid])}l[_.uuid]=x}else a[_.uuid]===void 0&&(a[_.uuid]=d.parse(_)),l[_.uuid]=a[_.uuid]}}return l}parseAnimations(t){const i={};if(t!==void 0)for(let a=0;a<t.length;a++){const l=t[a],d=cd.parse(l);i[d.uuid]=d}return i}parseImages(t,i){const a=this,l={};let d;function p(v){if(typeof v=="string"){const _=v;return function(x){return a.manager.itemStart(x),d.load(x,function(){a.manager.itemEnd(x)},void 0,function(){a.manager.itemError(x),a.manager.itemEnd(x)})}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(_)?_:a.resourcePath+_)}return v.data?{data:Si(v.type,v.data),width:v.width,height:v.height}:null}if(t!==void 0&&t.length>0){const v=new ba(i);d=new cp(v),d.setCrossOrigin(this.crossOrigin);for(let _=0,x=t.length;_<x;_++){const M=t[_],C=M.url;if(Array.isArray(C)){l[M.uuid]=[];for(let A=0,R=C.length;A<R;A++){const O=p(C[A]);O!==null&&(O instanceof HTMLImageElement?l[M.uuid].push(O):l[M.uuid].push(new Ls(O.data,O.width,O.height)))}}else{const A=p(M.url);A!==null&&(l[M.uuid]=A)}}}return l}async parseImagesAsync(t){const i=this,a={};let l;async function d(p){if(typeof p=="string"){const v=p,_=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(v)?v:i.resourcePath+v;return await l.loadAsync(_)}return p.data?{data:Si(p.type,p.data),width:p.width,height:p.height}:null}if(t!==void 0&&t.length>0){l=new cp(this.manager),l.setCrossOrigin(this.crossOrigin);for(let p=0,v=t.length;p<v;p++){const _=t[p],x=_.url;if(Array.isArray(x)){a[_.uuid]=[];for(let M=0,C=x.length;M<C;M++){const A=x[M],R=await d(A);R!==null&&(R instanceof HTMLImageElement?a[_.uuid].push(R):a[_.uuid].push(new Ls(R.data,R.width,R.height)))}}else{const M=await d(_.url);M!==null&&(a[_.uuid]=M)}}}return a}parseTextures(t,i){function a(d,p){return typeof d=="number"?d:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",d),p[d])}const l={};if(t!==void 0)for(let d=0,p=t.length;d<p;d++){const v=t[d];let _;v.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',v.uuid),i[v.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",v.image);const x=i[v.image];Array.isArray(x)?(_=new ql(x),x.length===6&&(_.needsUpdate=!0)):(_=x&&x.data?new Ls(x.data,x.width,x.height):new ni(x),x&&(_.needsUpdate=!0)),_.uuid=v.uuid,v.name!==void 0&&(_.name=v.name),v.mapping!==void 0&&(_.mapping=a(v.mapping,rl)),v.offset!==void 0&&_.offset.fromArray(v.offset),v.repeat!==void 0&&_.repeat.fromArray(v.repeat),v.center!==void 0&&_.center.fromArray(v.center),v.rotation!==void 0&&(_.rotation=v.rotation),v.wrap!==void 0&&(_.wrapS=a(v.wrap[0],Ea),_.wrapT=a(v.wrap[1],Ea)),v.format!==void 0&&(_.format=v.format),v.type!==void 0&&(_.type=v.type),v.encoding!==void 0&&(_.encoding=v.encoding),v.minFilter!==void 0&&(_.minFilter=a(v.minFilter,lu)),v.magFilter!==void 0&&(_.magFilter=a(v.magFilter,lu)),v.anisotropy!==void 0&&(_.anisotropy=v.anisotropy),v.flipY!==void 0&&(_.flipY=v.flipY),v.premultiplyAlpha!==void 0&&(_.premultiplyAlpha=v.premultiplyAlpha),v.unpackAlignment!==void 0&&(_.unpackAlignment=v.unpackAlignment),l[v.uuid]=_}return l}parseObject(t,i,a,l,d){let p,v,_;function x(A){return i[A]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",A),i[A]}function M(A){if(A!==void 0){if(Array.isArray(A)){const R=[];for(let O=0,U=A.length;O<U;O++){const D=A[O];a[D]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",D),R.push(a[D])}return R}return a[A]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",A),a[A]}}function C(A){return l[A]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",A),l[A]}switch(t.type){case"Scene":p=new Gh,t.background!==void 0&&(Number.isInteger(t.background)?p.background=new pn(t.background):p.background=C(t.background)),t.environment!==void 0&&(p.environment=C(t.environment)),t.fog!==void 0&&(t.fog.type==="Fog"?p.fog=new ru(t.fog.color,t.fog.near,t.fog.far):t.fog.type==="FogExp2"&&(p.fog=new nu(t.fog.color,t.fog.density)));break;case"PerspectiveCamera":p=new Yi(t.fov,t.aspect,t.near,t.far),t.focus!==void 0&&(p.focus=t.focus),t.zoom!==void 0&&(p.zoom=t.zoom),t.filmGauge!==void 0&&(p.filmGauge=t.filmGauge),t.filmOffset!==void 0&&(p.filmOffset=t.filmOffset),t.view!==void 0&&(p.view=Object.assign({},t.view));break;case"OrthographicCamera":p=new dp(t.left,t.right,t.top,t.bottom,t.near,t.far),t.zoom!==void 0&&(p.zoom=t.zoom),t.view!==void 0&&(p.view=Object.assign({},t.view));break;case"AmbientLight":p=new pf(t.color,t.intensity);break;case"DirectionalLight":p=new Ju(t.color,t.intensity);break;case"PointLight":p=new rm(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":p=new lc(t.color,t.intensity,t.width,t.height);break;case"SpotLight":p=new dd(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":p=new hf(t.color,t.groundColor,t.intensity);break;case"LightProbe":p=new pp().fromJSON(t);break;case"SkinnedMesh":v=x(t.geometry),_=M(t.material),p=new Yc(v,_),t.bindMode!==void 0&&(p.bindMode=t.bindMode),t.bindMatrix!==void 0&&p.bindMatrix.fromArray(t.bindMatrix),t.skeleton!==void 0&&(p.skeleton=t.skeleton);break;case"Mesh":v=x(t.geometry),_=M(t.material),p=new Bi(v,_);break;case"InstancedMesh":v=x(t.geometry),_=M(t.material);const A=t.count,R=t.instanceMatrix,O=t.instanceColor;p=new Kc(v,_,A),p.instanceMatrix=new Kn(new Float32Array(R.array),16),O!==void 0&&(p.instanceColor=new Kn(new Float32Array(O.array),O.itemSize));break;case"LOD":p=new Vh;break;case"Line":p=new $a(x(t.geometry),M(t.material));break;case"LineLoop":p=new ou(x(t.geometry),M(t.material));break;case"LineSegments":p=new io(x(t.geometry),M(t.material));break;case"PointCloud":case"Points":p=new q(x(t.geometry),M(t.material));break;case"Sprite":p=new Uu(M(t.material));break;case"Group":p=new bl;break;case"Bone":p=new no;break;default:p=new ar}if(p.uuid=t.uuid,t.name!==void 0&&(p.name=t.name),t.matrix!==void 0?(p.matrix.fromArray(t.matrix),t.matrixAutoUpdate!==void 0&&(p.matrixAutoUpdate=t.matrixAutoUpdate),p.matrixAutoUpdate&&p.matrix.decompose(p.position,p.quaternion,p.scale)):(t.position!==void 0&&p.position.fromArray(t.position),t.rotation!==void 0&&p.rotation.fromArray(t.rotation),t.quaternion!==void 0&&p.quaternion.fromArray(t.quaternion),t.scale!==void 0&&p.scale.fromArray(t.scale)),t.castShadow!==void 0&&(p.castShadow=t.castShadow),t.receiveShadow!==void 0&&(p.receiveShadow=t.receiveShadow),t.shadow&&(t.shadow.bias!==void 0&&(p.shadow.bias=t.shadow.bias),t.shadow.normalBias!==void 0&&(p.shadow.normalBias=t.shadow.normalBias),t.shadow.radius!==void 0&&(p.shadow.radius=t.shadow.radius),t.shadow.mapSize!==void 0&&p.shadow.mapSize.fromArray(t.shadow.mapSize),t.shadow.camera!==void 0&&(p.shadow.camera=this.parseObject(t.shadow.camera))),t.visible!==void 0&&(p.visible=t.visible),t.frustumCulled!==void 0&&(p.frustumCulled=t.frustumCulled),t.renderOrder!==void 0&&(p.renderOrder=t.renderOrder),t.userData!==void 0&&(p.userData=t.userData),t.layers!==void 0&&(p.layers.mask=t.layers),t.children!==void 0){const A=t.children;for(let R=0;R<A.length;R++)p.add(this.parseObject(A[R],i,a,l,d))}if(t.animations!==void 0){const A=t.animations;for(let R=0;R<A.length;R++){const O=A[R];p.animations.push(d[O])}}if(t.type==="LOD"){t.autoUpdate!==void 0&&(p.autoUpdate=t.autoUpdate);const A=t.levels;for(let R=0;R<A.length;R++){const O=A[R],U=p.getObjectByProperty("uuid",O.object);U!==void 0&&p.addLevel(U,O.distance)}}return p}bindSkeletons(t,i){Object.keys(i).length!==0&&t.traverse(function(a){if(a.isSkinnedMesh===!0&&a.skeleton!==void 0){const l=i[a.skeleton];l===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",a.skeleton):a.bind(l,a.bindMatrix)}})}setTexturePath(t){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(t)}}const rl={UVMapping:lo,CubeReflectionMapping:I,CubeRefractionMapping:z,EquirectangularReflectionMapping:H,EquirectangularRefractionMapping:at,CubeUVReflectionMapping:nt,CubeUVRefractionMapping:it},Ea={RepeatWrapping:yt,ClampToEdgeWrapping:St,MirroredRepeatWrapping:Ct},lu={NearestFilter:wt,NearestMipmapNearestFilter:Vt,NearestMipmapLinearFilter:Le,LinearFilter:Qe,LinearMipmapNearestFilter:Qn,LinearMipmapLinearFilter:Yr};class uu extends Xo{constructor(t){super(t),typeof createImageBitmap=="undefined"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch=="undefined"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,i,a,l){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const d=this,p=oc.get(t);if(p!==void 0)return d.manager.itemStart(t),setTimeout(function(){i&&i(p),d.manager.itemEnd(t)},0),p;const v={};v.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",v.headers=this.requestHeader,fetch(t,v).then(function(_){return _.blob()}).then(function(_){return createImageBitmap(_,Object.assign(d.options,{colorSpaceConversion:"none"}))}).then(function(_){oc.add(t,_),i&&i(_),d.manager.itemEnd(t)}).catch(function(_){l&&l(_),d.manager.itemError(t),d.manager.itemEnd(t)}),d.manager.itemStart(t)}}uu.prototype.isImageBitmapLoader=!0;class hu{constructor(){this.type="ShapePath",this.color=new pn,this.subPaths=[],this.currentPath=null}moveTo(t,i){return this.currentPath=new ac,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,i),this}lineTo(t,i){return this.currentPath.lineTo(t,i),this}quadraticCurveTo(t,i,a,l){return this.currentPath.quadraticCurveTo(t,i,a,l),this}bezierCurveTo(t,i,a,l,d,p){return this.currentPath.bezierCurveTo(t,i,a,l,d,p),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t,i){function a(ot){const vt=[];for(let mt=0,At=ot.length;mt<At;mt++){const Pt=ot[mt],Et=new Yu;Et.curves=Pt.curves,vt.push(Et)}return vt}function l(ot,vt){const mt=vt.length;let At=!1;for(let Pt=mt-1,Et=0;Et<mt;Pt=Et++){let Ot=vt[Pt],Ie=vt[Et],ye=Ie.x-Ot.x,xe=Ie.y-Ot.y;if(Math.abs(xe)>Number.EPSILON){if(xe<0&&(Ot=vt[Et],ye=-ye,Ie=vt[Pt],xe=-xe),ot.y<Ot.y||ot.y>Ie.y)continue;if(ot.y===Ot.y){if(ot.x===Ot.x)return!0}else{const ge=xe*(ot.x-Ot.x)-ye*(ot.y-Ot.y);if(ge===0)return!0;if(ge<0)continue;At=!At}}else{if(ot.y!==Ot.y)continue;if(Ie.x<=ot.x&&ot.x<=Ot.x||Ot.x<=ot.x&&ot.x<=Ie.x)return!0}}return At}const d=Ds.isClockWise,p=this.subPaths;if(p.length===0)return[];if(i===!0)return a(p);let v,_,x;const M=[];if(p.length===1)return _=p[0],x=new Yu,x.curves=_.curves,M.push(x),M;let C=!d(p[0].getPoints());C=t?!C:C;const A=[],R=[];let O,U,D=[],Z=0;R[Z]=void 0,D[Z]=[];for(let ot=0,vt=p.length;ot<vt;ot++)_=p[ot],O=_.getPoints(),v=d(O),v=t?!v:v,v?(!C&&R[Z]&&Z++,R[Z]={s:new Yu,p:O},R[Z].s.curves=_.curves,C&&Z++,D[Z]=[]):D[Z].push({h:_,p:O[0]});if(!R[0])return a(p);if(R.length>1){let ot=!1;const vt=[];for(let mt=0,At=R.length;mt<At;mt++)A[mt]=[];for(let mt=0,At=R.length;mt<At;mt++){const Pt=D[mt];for(let Et=0;Et<Pt.length;Et++){const Ot=Pt[Et];let Ie=!0;for(let ye=0;ye<R.length;ye++)l(Ot.p,R[ye].p)&&(mt!==ye&&vt.push({froms:mt,tos:ye,hole:Et}),Ie?(Ie=!1,A[ye].push(Ot)):ot=!0);Ie&&A[mt].push(Ot)}}vt.length>0&&(ot||(D=A))}for(let ot=0,vt=R.length;ot<vt;ot++){x=R[ot].s,M.push(x),U=D[ot];for(let mt=0,At=U.length;mt<At;mt++)x.holes.push(U[mt].h)}return M}}class oo{constructor(t){this.type="Font",this.data=t}generateShapes(t,i=100){const a=[],l=function(d,p,v){const _=Array.from(d),x=p/v.resolution,M=(v.boundingBox.yMax-v.boundingBox.yMin+v.underlineThickness)*x,C=[];let A=0,R=0;for(let O=0;O<_.length;O++){const U=_[O];if(U===`
2923
2923
  `)A=0,R-=M;else{const D=im(U,x,A,R,v);A+=D.offsetX,C.push(D.path)}}return C}(t,i,this.data);for(let d=0,p=l.length;d<p;d++)Array.prototype.push.apply(a,l[d].toShapes());return a}}function im(m,t,i,a,l){const d=l.glyphs[m]||l.glyphs["?"];if(!d)return void console.error('THREE.Font: character "'+m+'" does not exists in font family '+l.familyName+".");const p=new hu;let v,_,x,M,C,A,R,O;if(d.o){const U=d._cachedOutline||(d._cachedOutline=d.o.split(" "));for(let D=0,Z=U.length;D<Z;)switch(U[D++]){case"m":v=U[D++]*t+i,_=U[D++]*t+a,p.moveTo(v,_);break;case"l":v=U[D++]*t+i,_=U[D++]*t+a,p.lineTo(v,_);break;case"q":x=U[D++]*t+i,M=U[D++]*t+a,C=U[D++]*t+i,A=U[D++]*t+a,p.quadraticCurveTo(C,A,x,M);break;case"b":x=U[D++]*t+i,M=U[D++]*t+a,C=U[D++]*t+i,A=U[D++]*t+a,R=U[D++]*t+i,O=U[D++]*t+a,p.bezierCurveTo(C,A,R,O,x,M)}}return{offsetX:d.ha*t,path:p}}oo.prototype.isFont=!0;class om extends Xo{constructor(t){super(t)}load(t,i,a,l){const d=this,p=new Sa(this.manager);p.setPath(this.path),p.setRequestHeader(this.requestHeader),p.setWithCredentials(d.withCredentials),p.load(t,function(v){let _;try{_=JSON.parse(v)}catch{console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),_=JSON.parse(v.substring(65,v.length-2))}const x=d.parse(_);i&&i(x)},a,l)}parse(t){return new oo(t)}}let Ml;const mf={getContext:function(){return Ml===void 0&&(Ml=new(window.AudioContext||window.webkitAudioContext)),Ml},setContext:function(m){Ml=m}};class Wm extends Xo{constructor(t){super(t)}load(t,i,a,l){const d=this,p=new Sa(this.manager);p.setResponseType("arraybuffer"),p.setPath(this.path),p.setRequestHeader(this.requestHeader),p.setWithCredentials(this.withCredentials),p.load(t,function(v){try{const _=v.slice(0);mf.getContext().decodeAudioData(_,function(x){i(x)})}catch(_){l?l(_):console.error(_),d.manager.itemError(t)}},a,l)}}class il extends pp{constructor(t,i,a=1){super(void 0,a);const l=new pn().set(t),d=new pn().set(i),p=new gt(l.r,l.g,l.b),v=new gt(d.r,d.g,d.b),_=Math.sqrt(Math.PI),x=_*Math.sqrt(.75);this.sh.coefficients[0].copy(p).add(v).multiplyScalar(_),this.sh.coefficients[1].copy(p).sub(v).multiplyScalar(x)}}il.prototype.isHemisphereLightProbe=!0;class re extends pp{constructor(t,i=1){super(void 0,i);const a=new pn().set(t);this.sh.coefficients[0].set(a.r,a.g,a.b).multiplyScalar(2*Math.sqrt(Math.PI))}}re.prototype.isAmbientLightProbe=!0;const sm=new En,Xm=new En;class Ag{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Yi,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Yi,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(t){const i=this._cache;if(i.focus!==t.focus||i.fov!==t.fov||i.aspect!==t.aspect*this.aspect||i.near!==t.near||i.far!==t.far||i.zoom!==t.zoom||i.eyeSep!==this.eyeSep){i.focus=t.focus,i.fov=t.fov,i.aspect=t.aspect*this.aspect,i.near=t.near,i.far=t.far,i.zoom=t.zoom,i.eyeSep=this.eyeSep;const a=t.projectionMatrix.clone(),l=i.eyeSep/2,d=l*i.near/i.focus,p=i.near*Math.tan(ra*i.fov*.5)/i.zoom;let v,_;Xm.elements[12]=-l,sm.elements[12]=l,v=-p*i.aspect+d,_=p*i.aspect+d,a.elements[0]=2*i.near/(_-v),a.elements[8]=(_+v)/(_-v),this.cameraL.projectionMatrix.copy(a),v=-p*i.aspect-d,_=p*i.aspect-d,a.elements[0]=2*i.near/(_-v),a.elements[8]=(_+v)/(_-v),this.cameraR.projectionMatrix.copy(a)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(Xm),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(sm)}}class am{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=lm(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const i=lm();t=(i-this.oldTime)/1e3,this.oldTime=i,this.elapsedTime+=t}return t}}function lm(){return(typeof performance=="undefined"?Date:performance).now()}const Al=new gt,um=new Oi,hm=new gt,$u=new gt;class cm extends ar{constructor(){super(),this.type="AudioListener",this.context=mf.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new am}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);const i=this.context.listener,a=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Al,um,hm),$u.set(0,0,-1).applyQuaternion(um),i.positionX){const l=this.context.currentTime+this.timeDelta;i.positionX.linearRampToValueAtTime(Al.x,l),i.positionY.linearRampToValueAtTime(Al.y,l),i.positionZ.linearRampToValueAtTime(Al.z,l),i.forwardX.linearRampToValueAtTime($u.x,l),i.forwardY.linearRampToValueAtTime($u.y,l),i.forwardZ.linearRampToValueAtTime($u.z,l),i.upX.linearRampToValueAtTime(a.x,l),i.upY.linearRampToValueAtTime(a.y,l),i.upZ.linearRampToValueAtTime(a.z,l)}else i.setPosition(Al.x,Al.y,Al.z),i.setOrientation($u.x,$u.y,$u.z,a.x,a.y,a.z)}}class dm extends ar{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(this.isPlaying===!0)return void console.warn("THREE.Audio: Audio is already playing.");if(this.hasPlaybackControl===!1)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;const i=this.context.createBufferSource();return i.buffer=this.buffer,i.loop=this.loop,i.loopStart=this.loopStart,i.loopEnd=this.loopEnd,i.onended=this.onEnded.bind(this),i.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=i,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl!==!1)return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(){if(this.hasPlaybackControl!==!1)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,i=this.filters.length;t<i;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let t=1,i=this.filters.length;t<i;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(t){return t||(t=[]),this._connected===!0?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){if(this.detune=t,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){if(this.hasPlaybackControl!==!1)return this.playbackRate=t,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(t){if(this.hasPlaybackControl!==!1)return this.loop=t,this.isPlaying===!0&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}}const Ku=new gt,qm=new Oi,Cg=new gt,hc=new gt;class Pg extends dm{constructor(t){super(t),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(t){return this.panner.refDistance=t,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(t){return this.panner.rolloffFactor=t,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(t){return this.panner.distanceModel=t,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(t){return this.panner.maxDistance=t,this}setDirectionalCone(t,i,a){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=i,this.panner.coneOuterGain=a,this}updateMatrixWorld(t){if(super.updateMatrixWorld(t),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(Ku,qm,Cg),hc.set(0,0,1).applyQuaternion(qm);const i=this.panner;if(i.positionX){const a=this.context.currentTime+this.listener.timeDelta;i.positionX.linearRampToValueAtTime(Ku.x,a),i.positionY.linearRampToValueAtTime(Ku.y,a),i.positionZ.linearRampToValueAtTime(Ku.z,a),i.orientationX.linearRampToValueAtTime(hc.x,a),i.orientationY.linearRampToValueAtTime(hc.y,a),i.orientationZ.linearRampToValueAtTime(hc.z,a)}else i.setPosition(Ku.x,Ku.y,Ku.z),i.setOrientation(hc.x,hc.y,hc.z)}}class Ym{constructor(t,i=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=i,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0;const i=this.getFrequencyData();for(let a=0;a<i.length;a++)t+=i[a];return t/i.length}}class fd{constructor(t,i,a){let l,d,p;switch(this.binding=t,this.valueSize=a,i){case"quaternion":l=this._slerp,d=this._slerpAdditive,p=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*a),this._workIndex=5;break;case"string":case"bool":l=this._select,d=this._select,p=this._setAdditiveIdentityOther,this.buffer=new Array(5*a);break;default:l=this._lerp,d=this._lerpAdditive,p=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*a)}this._mixBufferRegion=l,this._mixBufferRegionAdditive=d,this._setIdentity=p,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,i){const a=this.buffer,l=this.valueSize,d=t*l+l;let p=this.cumulativeWeight;if(p===0){for(let v=0;v!==l;++v)a[d+v]=a[v];p=i}else{p+=i;const v=i/p;this._mixBufferRegion(a,d,0,v,l)}this.cumulativeWeight=p}accumulateAdditive(t){const i=this.buffer,a=this.valueSize,l=a*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(i,l,0,t,a),this.cumulativeWeightAdditive+=t}apply(t){const i=this.valueSize,a=this.buffer,l=t*i+i,d=this.cumulativeWeight,p=this.cumulativeWeightAdditive,v=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,d<1){const _=i*this._origIndex;this._mixBufferRegion(a,l,_,1-d,i)}p>0&&this._mixBufferRegionAdditive(a,l,this._addIndex*i,1,i);for(let _=i,x=i+i;_!==x;++_)if(a[_]!==a[_+i]){v.setValue(a,l);break}}saveOriginalState(){const t=this.binding,i=this.buffer,a=this.valueSize,l=a*this._origIndex;t.getValue(i,l);for(let d=a,p=l;d!==p;++d)i[d]=i[l+d%a];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,i=t+this.valueSize;for(let a=t;a<i;a++)this.buffer[a]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,i=this._addIndex*this.valueSize;for(let a=0;a<this.valueSize;a++)this.buffer[i+a]=this.buffer[t+a]}_select(t,i,a,l,d){if(l>=.5)for(let p=0;p!==d;++p)t[i+p]=t[a+p]}_slerp(t,i,a,l){Oi.slerpFlat(t,i,t,i,t,a,l)}_slerpAdditive(t,i,a,l,d){const p=this._workIndex*d;Oi.multiplyQuaternionsFlat(t,p,t,i,t,a),Oi.slerpFlat(t,i,t,i,t,p,l)}_lerp(t,i,a,l,d){const p=1-l;for(let v=0;v!==d;++v){const _=i+v;t[_]=t[_]*p+t[a+v]*l}}_lerpAdditive(t,i,a,l,d){for(let p=0;p!==d;++p){const v=i+p;t[v]=t[v]+t[a+p]*l}}}const gf=new RegExp("[\\[\\]\\.:\\/]","g"),Zm="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",md=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),pm=/(WCOD+)?/.source.replace("WCOD",Zm),Jm=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),li=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),fm=new RegExp("^"+md+pm+Jm+li+"$"),$m=["material","materials","bones"];class Br{constructor(t,i,a){this.path=i,this.parsedPath=a||Br.parseTrackName(i),this.node=Br.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,i,a){return t&&t.isAnimationObjectGroup?new Br.Composite(t,i,a):new Br(t,i,a)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(gf,"")}static parseTrackName(t){const i=fm.exec(t);if(!i)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const a={nodeName:i[2],objectName:i[3],objectIndex:i[4],propertyName:i[5],propertyIndex:i[6]},l=a.nodeName&&a.nodeName.lastIndexOf(".");if(l!==void 0&&l!==-1){const d=a.nodeName.substring(l+1);$m.indexOf(d)!==-1&&(a.nodeName=a.nodeName.substring(0,l),a.objectName=d)}if(a.propertyName===null||a.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return a}static findNode(t,i){if(!i||i===""||i==="."||i===-1||i===t.name||i===t.uuid)return t;if(t.skeleton){const a=t.skeleton.getBoneByName(i);if(a!==void 0)return a}if(t.children){const a=function(d){for(let p=0;p<d.length;p++){const v=d[p];if(v.name===i||v.uuid===i)return v;const _=a(v.children);if(_)return _}return null},l=a(t.children);if(l)return l}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,i){t[i]=this.node[this.propertyName]}_getValue_array(t,i){const a=this.resolvedProperty;for(let l=0,d=a.length;l!==d;++l)t[i++]=a[l]}_getValue_arrayElement(t,i){t[i]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,i){this.resolvedProperty.toArray(t,i)}_setValue_direct(t,i){this.targetObject[this.propertyName]=t[i]}_setValue_direct_setNeedsUpdate(t,i){this.targetObject[this.propertyName]=t[i],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,i){this.targetObject[this.propertyName]=t[i],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,i){const a=this.resolvedProperty;for(let l=0,d=a.length;l!==d;++l)a[l]=t[i++]}_setValue_array_setNeedsUpdate(t,i){const a=this.resolvedProperty;for(let l=0,d=a.length;l!==d;++l)a[l]=t[i++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,i){const a=this.resolvedProperty;for(let l=0,d=a.length;l!==d;++l)a[l]=t[i++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,i){this.resolvedProperty[this.propertyIndex]=t[i]}_setValue_arrayElement_setNeedsUpdate(t,i){this.resolvedProperty[this.propertyIndex]=t[i],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,i){this.resolvedProperty[this.propertyIndex]=t[i],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,i){this.resolvedProperty.fromArray(t,i)}_setValue_fromArray_setNeedsUpdate(t,i){this.resolvedProperty.fromArray(t,i),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,i){this.resolvedProperty.fromArray(t,i),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,i){this.bind(),this.getValue(t,i)}_setValue_unbound(t,i){this.bind(),this.setValue(t,i)}bind(){let t=this.node;const i=this.parsedPath,a=i.objectName,l=i.propertyName;let d=i.propertyIndex;if(t||(t=Br.findNode(this.rootNode,i.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");if(a){let x=i.objectIndex;switch(a){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let M=0;M<t.length;M++)if(t[M].name===x){x=M;break}break;default:if(t[a]===void 0)return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[a]}if(x!==void 0){if(t[x]===void 0)return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[x]}}const p=t[l];if(p===void 0){const x=i.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+x+"."+l+" but it wasn't found.",t)}let v=this.Versioning.None;this.targetObject=t,t.needsUpdate!==void 0?v=this.Versioning.NeedsUpdate:t.matrixWorldNeedsUpdate!==void 0&&(v=this.Versioning.MatrixWorldNeedsUpdate);let _=this.BindingType.Direct;if(d!==void 0){if(l==="morphTargetInfluences"){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);t.morphTargetDictionary[d]!==void 0&&(d=t.morphTargetDictionary[d])}_=this.BindingType.ArrayElement,this.resolvedProperty=p,this.propertyIndex=d}else p.fromArray!==void 0&&p.toArray!==void 0?(_=this.BindingType.HasFromToArray,this.resolvedProperty=p):Array.isArray(p)?(_=this.BindingType.EntireArray,this.resolvedProperty=p):this.propertyName=l;this.getValue=this.GetterByBindingType[_],this.setValue=this.SetterByBindingTypeAndVersioning[_][v]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Br.Composite=class{constructor(m,t,i){const a=i||Br.parseTrackName(t);this._targetGroup=m,this._bindings=m.subscribe_(t,a)}getValue(m,t){this.bind();const i=this._targetGroup.nCachedObjects_,a=this._bindings[i];a!==void 0&&a.getValue(m,t)}setValue(m,t){const i=this._bindings;for(let a=this._targetGroup.nCachedObjects_,l=i.length;a!==l;++a)i[a].setValue(m,t)}bind(){const m=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=m.length;t!==i;++t)m[t].bind()}unbind(){const m=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=m.length;t!==i;++t)m[t].unbind()}},Br.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Br.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Br.prototype.GetterByBindingType=[Br.prototype._getValue_direct,Br.prototype._getValue_array,Br.prototype._getValue_arrayElement,Br.prototype._getValue_toArray],Br.prototype.SetterByBindingTypeAndVersioning=[[Br.prototype._setValue_direct,Br.prototype._setValue_direct_setNeedsUpdate,Br.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Br.prototype._setValue_array,Br.prototype._setValue_array_setNeedsUpdate,Br.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Br.prototype._setValue_arrayElement,Br.prototype._setValue_arrayElement_setNeedsUpdate,Br.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Br.prototype._setValue_fromArray,Br.prototype._setValue_fromArray_setNeedsUpdate,Br.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class mm{constructor(){this.uuid=Fo(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const t={};this._indicesByUUID=t;for(let a=0,l=arguments.length;a!==l;++a)t[arguments[a].uuid]=a;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}add(){const t=this._objects,i=this._indicesByUUID,a=this._paths,l=this._parsedPaths,d=this._bindings,p=d.length;let v,_=t.length,x=this.nCachedObjects_;for(let M=0,C=arguments.length;M!==C;++M){const A=arguments[M],R=A.uuid;let O=i[R];if(O===void 0){O=_++,i[R]=O,t.push(A);for(let U=0,D=p;U!==D;++U)d[U].push(new Br(A,a[U],l[U]))}else if(O<x){v=t[O];const U=--x,D=t[U];i[D.uuid]=O,t[O]=D,i[R]=U,t[U]=A;for(let Z=0,ot=p;Z!==ot;++Z){const vt=d[Z],mt=vt[U];let At=vt[O];vt[O]=mt,At===void 0&&(At=new Br(A,a[Z],l[Z])),vt[U]=At}}else t[O]!==v&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=x}remove(){const t=this._objects,i=this._indicesByUUID,a=this._bindings,l=a.length;let d=this.nCachedObjects_;for(let p=0,v=arguments.length;p!==v;++p){const _=arguments[p],x=_.uuid,M=i[x];if(M!==void 0&&M>=d){const C=d++,A=t[C];i[A.uuid]=M,t[M]=A,i[x]=C,t[C]=_;for(let R=0,O=l;R!==O;++R){const U=a[R],D=U[C],Z=U[M];U[M]=D,U[C]=Z}}}this.nCachedObjects_=d}uncache(){const t=this._objects,i=this._indicesByUUID,a=this._bindings,l=a.length;let d=this.nCachedObjects_,p=t.length;for(let v=0,_=arguments.length;v!==_;++v){const x=arguments[v].uuid,M=i[x];if(M!==void 0)if(delete i[x],M<d){const C=--d,A=t[C],R=--p,O=t[R];i[A.uuid]=M,t[M]=A,i[O.uuid]=C,t[C]=O,t.pop();for(let U=0,D=l;U!==D;++U){const Z=a[U],ot=Z[C],vt=Z[R];Z[M]=ot,Z[C]=vt,Z.pop()}}else{const C=--p,A=t[C];C>0&&(i[A.uuid]=M),t[M]=A,t.pop();for(let R=0,O=l;R!==O;++R){const U=a[R];U[M]=U[C],U.pop()}}}this.nCachedObjects_=d}subscribe_(t,i){const a=this._bindingsIndicesByPath;let l=a[t];const d=this._bindings;if(l!==void 0)return d[l];const p=this._paths,v=this._parsedPaths,_=this._objects,x=_.length,M=this.nCachedObjects_,C=new Array(x);l=d.length,a[t]=l,p.push(t),v.push(i),d.push(C);for(let A=M,R=_.length;A!==R;++A){const O=_[A];C[A]=new Br(O,t,i)}return C}unsubscribe_(t){const i=this._bindingsIndicesByPath,a=i[t];if(a!==void 0){const l=this._paths,d=this._parsedPaths,p=this._bindings,v=p.length-1,_=p[v];i[t[v]]=a,p[a]=_,p.pop(),d[a]=d[v],d.pop(),l[a]=l[v],l.pop()}}}mm.prototype.isAnimationObjectGroup=!0;class gp{constructor(t,i,a=null,l=i.blendMode){this._mixer=t,this._clip=i,this._localRoot=a,this.blendMode=l;const d=i.tracks,p=d.length,v=new Array(p),_={endingStart:na,endingEnd:na};for(let x=0;x!==p;++x){const M=d[x].createInterpolant(null);v[x]=M,M.settings=_}this._interpolantSettings=_,this._interpolants=v,this._propertyBindings=new Array(p),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=_s,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,i){return this.loop=t,this.repetitions=i,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,i,a){if(t.fadeOut(i),this.fadeIn(i),a){const l=this._clip.duration,d=t._clip.duration,p=d/l,v=l/d;t.warp(1,p,i),this.warp(v,1,i)}return this}crossFadeTo(t,i,a){return t.crossFadeFrom(this,i,a)}stopFading(){const t=this._weightInterpolant;return t!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,i,a){const l=this._mixer,d=l.time,p=this.timeScale;let v=this._timeScaleInterpolant;v===null&&(v=l._lendControlInterpolant(),this._timeScaleInterpolant=v);const _=v.parameterPositions,x=v.sampleValues;return _[0]=d,_[1]=d+a,x[0]=t/p,x[1]=i/p,this}stopWarping(){const t=this._timeScaleInterpolant;return t!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,i,a,l){if(!this.enabled)return void this._updateWeight(t);const d=this._startTime;if(d!==null){const _=(t-d)*a;if(_<0||a===0)return;this._startTime=null,i=a*_}i*=this._updateTimeScale(t);const p=this._updateTime(i),v=this._updateWeight(t);if(v>0){const _=this._interpolants,x=this._propertyBindings;switch(this.blendMode){case Md:for(let M=0,C=_.length;M!==C;++M)_[M].evaluate(p),x[M].accumulateAdditive(v);break;case Fa:default:for(let M=0,C=_.length;M!==C;++M)_[M].evaluate(p),x[M].accumulate(l,v)}}}_updateWeight(t){let i=0;if(this.enabled){i=this.weight;const a=this._weightInterpolant;if(a!==null){const l=a.evaluate(t)[0];i*=l,t>a.parameterPositions[1]&&(this.stopFading(),l===0&&(this.enabled=!1))}}return this._effectiveWeight=i,i}_updateTimeScale(t){let i=0;if(!this.paused){i=this.timeScale;const a=this._timeScaleInterpolant;a!==null&&(i*=a.evaluate(t)[0],t>a.parameterPositions[1]&&(this.stopWarping(),i===0?this.paused=!0:this.timeScale=i))}return this._effectiveTimeScale=i,i}_updateTime(t){const i=this._clip.duration,a=this.loop;let l=this.time+t,d=this._loopCount;const p=a===xp;if(t===0)return d===-1?l:p&&(1&d)==1?i-l:l;if(a===Ri){d===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(l>=i)l=i;else{if(!(l<0)){this.time=l;break t}l=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=l,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(d===-1&&(t>=0?(d=0,this._setEndings(!0,this.repetitions===0,p)):this._setEndings(this.repetitions===0,!0,p)),l>=i||l<0){const v=Math.floor(l/i);l-=i*v,d+=Math.abs(v);const _=this.repetitions-d;if(_<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,l=t>0?i:0,this.time=l,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(_===1){const x=t<0;this._setEndings(x,!x,p)}else this._setEndings(!1,!1,p);this._loopCount=d,this.time=l,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:v})}}else this.time=l;if(p&&(1&d)==1)return i-l}return l}_setEndings(t,i,a){const l=this._interpolantSettings;a?(l.endingStart=Na,l.endingEnd=Na):(l.endingStart=t?this.zeroSlopeAtStart?Na:na:ys,l.endingEnd=i?this.zeroSlopeAtEnd?Na:na:ys)}_scheduleFading(t,i,a){const l=this._mixer,d=l.time;let p=this._weightInterpolant;p===null&&(p=l._lendControlInterpolant(),this._weightInterpolant=p);const v=p.parameterPositions,_=p.sampleValues;return v[0]=d,_[0]=i,v[1]=d+t,_[1]=a,this}}class cc extends Ua{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,i){const a=t._localRoot||this._root,l=t._clip.tracks,d=l.length,p=t._propertyBindings,v=t._interpolants,_=a.uuid,x=this._bindingsByRootAndName;let M=x[_];M===void 0&&(M={},x[_]=M);for(let C=0;C!==d;++C){const A=l[C],R=A.name;let O=M[R];if(O!==void 0)p[C]=O;else{if(O=p[C],O!==void 0){O._cacheIndex===null&&(++O.referenceCount,this._addInactiveBinding(O,_,R));continue}const U=i&&i._propertyBindings[C].binding.parsedPath;O=new fd(Br.create(a,R,U),A.ValueTypeName,A.getValueSize()),++O.referenceCount,this._addInactiveBinding(O,_,R),p[C]=O}v[C].resultBuffer=O.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(t._cacheIndex===null){const a=(t._localRoot||this._root).uuid,l=t._clip.uuid,d=this._actionsByClip[l];this._bindAction(t,d&&d.knownActions[0]),this._addInactiveAction(t,l,a)}const i=t._propertyBindings;for(let a=0,l=i.length;a!==l;++a){const d=i[a];d.useCount++==0&&(this._lendBinding(d),d.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const i=t._propertyBindings;for(let a=0,l=i.length;a!==l;++a){const d=i[a];--d.useCount==0&&(d.restoreOriginalState(),this._takeBackBinding(d))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const i=t._cacheIndex;return i!==null&&i<this._nActiveActions}_addInactiveAction(t,i,a){const l=this._actions,d=this._actionsByClip;let p=d[i];if(p===void 0)p={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,d[i]=p;else{const v=p.knownActions;t._byClipCacheIndex=v.length,v.push(t)}t._cacheIndex=l.length,l.push(t),p.actionByRoot[a]=t}_removeInactiveAction(t){const i=this._actions,a=i[i.length-1],l=t._cacheIndex;a._cacheIndex=l,i[l]=a,i.pop(),t._cacheIndex=null;const d=t._clip.uuid,p=this._actionsByClip,v=p[d],_=v.knownActions,x=_[_.length-1],M=t._byClipCacheIndex;x._byClipCacheIndex=M,_[M]=x,_.pop(),t._byClipCacheIndex=null,delete v.actionByRoot[(t._localRoot||this._root).uuid],_.length===0&&delete p[d],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const i=t._propertyBindings;for(let a=0,l=i.length;a!==l;++a){const d=i[a];--d.referenceCount==0&&this._removeInactiveBinding(d)}}_lendAction(t){const i=this._actions,a=t._cacheIndex,l=this._nActiveActions++,d=i[l];t._cacheIndex=l,i[l]=t,d._cacheIndex=a,i[a]=d}_takeBackAction(t){const i=this._actions,a=t._cacheIndex,l=--this._nActiveActions,d=i[l];t._cacheIndex=l,i[l]=t,d._cacheIndex=a,i[a]=d}_addInactiveBinding(t,i,a){const l=this._bindingsByRootAndName,d=this._bindings;let p=l[i];p===void 0&&(p={},l[i]=p),p[a]=t,t._cacheIndex=d.length,d.push(t)}_removeInactiveBinding(t){const i=this._bindings,a=t.binding,l=a.rootNode.uuid,d=a.path,p=this._bindingsByRootAndName,v=p[l],_=i[i.length-1],x=t._cacheIndex;_._cacheIndex=x,i[x]=_,i.pop(),delete v[d],Object.keys(v).length===0&&delete p[l]}_lendBinding(t){const i=this._bindings,a=t._cacheIndex,l=this._nActiveBindings++,d=i[l];t._cacheIndex=l,i[l]=t,d._cacheIndex=a,i[a]=d}_takeBackBinding(t){const i=this._bindings,a=t._cacheIndex,l=--this._nActiveBindings,d=i[l];t._cacheIndex=l,i[l]=t,d._cacheIndex=a,i[a]=d}_lendControlInterpolant(){const t=this._controlInterpolants,i=this._nActiveControlInterpolants++;let a=t[i];return a===void 0&&(a=new af(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),a.__cacheIndex=i,t[i]=a),a}_takeBackControlInterpolant(t){const i=this._controlInterpolants,a=t.__cacheIndex,l=--this._nActiveControlInterpolants,d=i[l];t.__cacheIndex=l,i[l]=t,d.__cacheIndex=a,i[a]=d}clipAction(t,i,a){const l=i||this._root,d=l.uuid;let p=typeof t=="string"?cd.findByName(l,t):t;const v=p!==null?p.uuid:t,_=this._actionsByClip[v];let x=null;if(a===void 0&&(a=p!==null?p.blendMode:Fa),_!==void 0){const C=_.actionByRoot[d];if(C!==void 0&&C.blendMode===a)return C;x=_.knownActions[0],p===null&&(p=x._clip)}if(p===null)return null;const M=new gp(this,p,i,a);return this._bindAction(M,x),this._addInactiveAction(M,v,d),M}existingAction(t,i){const a=i||this._root,l=a.uuid,d=typeof t=="string"?cd.findByName(a,t):t,p=d?d.uuid:t,v=this._actionsByClip[p];return v!==void 0&&v.actionByRoot[l]||null}stopAllAction(){const t=this._actions;for(let i=this._nActiveActions-1;i>=0;--i)t[i].stop();return this}update(t){t*=this.timeScale;const i=this._actions,a=this._nActiveActions,l=this.time+=t,d=Math.sign(t),p=this._accuIndex^=1;for(let x=0;x!==a;++x)i[x]._update(l,t,d,p);const v=this._bindings,_=this._nActiveBindings;for(let x=0;x!==_;++x)v[x].apply(p);return this}setTime(t){this.time=0;for(let i=0;i<this._actions.length;i++)this._actions[i].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const i=this._actions,a=t.uuid,l=this._actionsByClip,d=l[a];if(d!==void 0){const p=d.knownActions;for(let v=0,_=p.length;v!==_;++v){const x=p[v];this._deactivateAction(x);const M=x._cacheIndex,C=i[i.length-1];x._cacheIndex=null,x._byClipCacheIndex=null,C._cacheIndex=M,i[M]=C,i.pop(),this._removeInactiveBindingsForAction(x)}delete l[a]}}uncacheRoot(t){const i=t.uuid,a=this._actionsByClip;for(const d in a){const p=a[d].actionByRoot[i];p!==void 0&&(this._deactivateAction(p),this._removeInactiveAction(p))}const l=this._bindingsByRootAndName[i];if(l!==void 0)for(const d in l){const p=l[d];p.restoreOriginalState(),this._removeInactiveBinding(p)}}uncacheAction(t,i){const a=this.existingAction(t,i);a!==null&&(this._deactivateAction(a),this._removeInactiveAction(a))}}cc.prototype._controlInterpolantsResultBuffer=new Float32Array(1);class gd{constructor(t){typeof t=="string"&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}clone(){return new gd(this.value.clone===void 0?this.value:this.value.clone())}}class gm extends wl{constructor(t,i,a=1){super(t,i),this.meshPerAttribute=a}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){const i=super.clone(t);return i.meshPerAttribute=this.meshPerAttribute,i}toJSON(t){const i=super.toJSON(t);return i.isInstancedInterleavedBuffer=!0,i.meshPerAttribute=this.meshPerAttribute,i}}gm.prototype.isInstancedInterleavedBuffer=!0;class Km{constructor(t,i,a,l,d){this.buffer=t,this.type=i,this.itemSize=a,this.elementSize=l,this.count=d,this.version=0}set needsUpdate(t){t===!0&&this.version++}setBuffer(t){return this.buffer=t,this}setType(t,i){return this.type=t,this.elementSize=i,this}setItemSize(t){return this.itemSize=t,this}setCount(t){return this.count=t,this}}Km.prototype.isGLBufferAttribute=!0;class Rg{constructor(t,i,a=0,l=1/0){this.ray=new Ha(t,i),this.near=a,this.far=l,this.camera=null,this.layers=new pl,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,i){this.ray.set(t,i)}setFromCamera(t,i){i&&i.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(i.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(i).sub(this.ray.origin).normalize(),this.camera=i):i&&i.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(i.near+i.far)/(i.near-i.far)).unproject(i),this.ray.direction.set(0,0,-1).transformDirection(i.matrixWorld),this.camera=i):console.error("THREE.Raycaster: Unsupported camera type: "+i.type)}intersectObject(t,i=!1,a=[]){return vd(t,this,a,i),a.sort(vf),a}intersectObjects(t,i=!1,a=[]){for(let l=0,d=t.length;l<d;l++)vd(t[l],this,a,i);return a.sort(vf),a}}function vf(m,t){return m.distance-t.distance}function vd(m,t,i,a){if(m.layers.test(t.layers)&&m.raycast(t,i),a===!0){const l=m.children;for(let d=0,p=l.length;d<p;d++)vd(l[d],t,i,!0)}}class Ig{constructor(t=1,i=0,a=0){return this.radius=t,this.phi=i,this.theta=a,this}set(t,i,a){return this.radius=t,this.phi=i,this.theta=a,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,i,a){return this.radius=Math.sqrt(t*t+i*i+a*a),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,a),this.phi=Math.acos(zi(i/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class Lg{constructor(t=1,i=0,a=0){return this.radius=t,this.theta=i,this.y=a,this}set(t,i,a){return this.radius=t,this.theta=i,this.y=a,this}copy(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,i,a){return this.radius=Math.sqrt(t*t+a*a),this.theta=Math.atan2(t,a),this.y=i,this}clone(){return new this.constructor().copy(this)}}const Qm=new He;class _d{constructor(t=new He(1/0,1/0),i=new He(-1/0,-1/0)){this.min=t,this.max=i}set(t,i){return this.min.copy(t),this.max.copy(i),this}setFromPoints(t){this.makeEmpty();for(let i=0,a=t.length;i<a;i++)this.expandByPoint(t[i]);return this}setFromCenterAndSize(t,i){const a=Qm.copy(i).multiplyScalar(.5);return this.min.copy(t).sub(a),this.max.copy(t).add(a),this}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=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(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}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}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}getParameter(t,i){return i.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}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)}clampPoint(t,i){return i.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return Qm.copy(t).clamp(this.min,this.max).sub(t).length()}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}union(t){return this.min.min(t.min),this.max.max(t.max),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)}}_d.prototype.isBox2=!0;const tg=new gt,Qu=new gt;class Ma{constructor(t=new gt,i=new gt){this.start=t,this.end=i}set(t,i){return this.start.copy(t),this.end.copy(i),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,i){return this.delta(i).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,i){tg.subVectors(t,this.start),Qu.subVectors(this.end,this.start);const a=Qu.dot(Qu);let l=Qu.dot(tg)/a;return i&&(l=zi(l,0,1)),l}closestPointToPoint(t,i,a){const l=this.closestPointToPointParameter(t,i);return this.delta(a).multiplyScalar(l).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}class Aa extends ar{constructor(t){super(),this.material=t,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}}Aa.prototype.isImmediateRenderObject=!0;const th=new gt;class Og extends ar{constructor(t,i){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=i;const a=new zn,l=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let p=0,v=1,_=32;p<_;p++,v++){const x=p/_*Math.PI*2,M=v/_*Math.PI*2;l.push(Math.cos(x),Math.sin(x),1,Math.cos(M),Math.sin(M),1)}a.setAttribute("position",new xn(l,3));const d=new ro({fog:!1,toneMapped:!1});this.cone=new io(a,d),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();const t=this.light.distance?this.light.distance:1e3,i=t*Math.tan(this.light.angle);this.cone.scale.set(i,i,t),th.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(th),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const cu=new gt,yd=new En,Ns=new En;class vm extends io{constructor(t){const i=function _(x){const M=[];x&&x.isBone&&M.push(x);for(let C=0;C<x.children.length;C++)M.push.apply(M,_(x.children[C]));return M}(t),a=new zn,l=[],d=[],p=new pn(0,0,1),v=new pn(0,1,0);for(let _=0;_<i.length;_++){const x=i[_];x.parent&&x.parent.isBone&&(l.push(0,0,0),l.push(0,0,0),d.push(p.r,p.g,p.b),d.push(v.r,v.g,v.b))}a.setAttribute("position",new xn(l,3)),a.setAttribute("color",new xn(d,3)),super(a,new ro({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=t,this.bones=i,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(t){const i=this.bones,a=this.geometry,l=a.getAttribute("position");Ns.copy(this.root.matrixWorld).invert();for(let d=0,p=0;d<i.length;d++){const v=i[d];v.parent&&v.parent.isBone&&(yd.multiplyMatrices(Ns,v.matrixWorld),cu.setFromMatrixPosition(yd),l.setXYZ(p,cu.x,cu.y,cu.z),yd.multiplyMatrices(Ns,v.parent.matrixWorld),cu.setFromMatrixPosition(yd),l.setXYZ(p+1,cu.x,cu.y,cu.z),p+=2)}a.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}}class Dg extends Bi{constructor(t,i,a){super(new tc(i,4,2),new Fi({wireframe:!0,fog:!1,toneMapped:!1})),this.light=t,this.light.updateMatrixWorld(),this.color=a,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const o=new gt,n=new pn,e=new pn;class r extends ar{constructor(t,i,a){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=a;const l=new Kh(i);l.rotateY(.5*Math.PI),this.material=new Fi({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const d=l.getAttribute("position"),p=new Float32Array(3*d.count);l.setAttribute("color",new Kn(p,3)),this.add(new Bi(l,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const t=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const i=t.geometry.getAttribute("color");n.copy(this.light.color),e.copy(this.light.groundColor);for(let a=0,l=i.count;a<l;a++){const d=a<l/2?n:e;i.setXYZ(a,d.r,d.g,d.b)}i.needsUpdate=!0}t.lookAt(o.setFromMatrixPosition(this.light.matrixWorld).negate())}}class s extends io{constructor(t=10,i=10,a=4473924,l=8947848){a=new pn(a),l=new pn(l);const d=i/2,p=t/i,v=t/2,_=[],x=[];for(let C=0,A=0,R=-v;C<=i;C++,R+=p){_.push(-v,0,R,v,0,R),_.push(R,0,-v,R,0,v);const O=C===d?a:l;O.toArray(x,A),A+=3,O.toArray(x,A),A+=3,O.toArray(x,A),A+=3,O.toArray(x,A),A+=3}const M=new zn;M.setAttribute("position",new xn(_,3)),M.setAttribute("color",new xn(x,3)),super(M,new ro({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}}class u extends io{constructor(t=10,i=16,a=8,l=64,d=4473924,p=8947848){d=new pn(d),p=new pn(p);const v=[],_=[];for(let M=0;M<=i;M++){const C=M/i*(2*Math.PI),A=Math.sin(C)*t,R=Math.cos(C)*t;v.push(0,0,0),v.push(A,0,R);const O=1&M?d:p;_.push(O.r,O.g,O.b),_.push(O.r,O.g,O.b)}for(let M=0;M<=a;M++){const C=1&M?d:p,A=t-t/a*M;for(let R=0;R<l;R++){let O=R/l*(2*Math.PI),U=Math.sin(O)*A,D=Math.cos(O)*A;v.push(U,0,D),_.push(C.r,C.g,C.b),O=(R+1)/l*(2*Math.PI),U=Math.sin(O)*A,D=Math.cos(O)*A,v.push(U,0,D),_.push(C.r,C.g,C.b)}}const x=new zn;x.setAttribute("position",new xn(v,3)),x.setAttribute("color",new xn(_,3)),super(x,new ro({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}}const h=new gt,f=new gt,y=new gt;class b extends ar{constructor(t,i,a){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=a,i===void 0&&(i=1);let l=new zn;l.setAttribute("position",new xn([-i,i,0,i,i,0,i,-i,0,-i,-i,0,-i,i,0],3));const d=new ro({fog:!1,toneMapped:!1});this.lightPlane=new $a(l,d),this.add(this.lightPlane),l=new zn,l.setAttribute("position",new xn([0,0,0,0,0,1],3)),this.targetLine=new $a(l,d),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){h.setFromMatrixPosition(this.light.matrixWorld),f.setFromMatrixPosition(this.light.target.matrixWorld),y.subVectors(f,h),this.lightPlane.lookAt(f),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(f),this.targetLine.scale.z=y.length()}}const T=new gt,P=new Xl;class j extends io{constructor(t){const i=new zn,a=new ro({color:16777215,vertexColors:!0,toneMapped:!1}),l=[],d=[],p={},v=new pn(16755200),_=new pn(16711680),x=new pn(43775),M=new pn(16777215),C=new pn(3355443);function A(O,U,D){R(O,D),R(U,D)}function R(O,U){l.push(0,0,0),d.push(U.r,U.g,U.b),p[O]===void 0&&(p[O]=[]),p[O].push(l.length/3-1)}A("n1","n2",v),A("n2","n4",v),A("n4","n3",v),A("n3","n1",v),A("f1","f2",v),A("f2","f4",v),A("f4","f3",v),A("f3","f1",v),A("n1","f1",v),A("n2","f2",v),A("n3","f3",v),A("n4","f4",v),A("p","n1",_),A("p","n2",_),A("p","n3",_),A("p","n4",_),A("u1","u2",x),A("u2","u3",x),A("u3","u1",x),A("c","t",M),A("p","c",C),A("cn1","cn2",C),A("cn3","cn4",C),A("cf1","cf2",C),A("cf3","cf4",C),i.setAttribute("position",new xn(l,3)),i.setAttribute("color",new xn(d,3)),super(i,a),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=p,this.update()}update(){const t=this.geometry,i=this.pointMap;P.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),G("c",i,t,P,0,0,-1),G("t",i,t,P,0,0,1),G("n1",i,t,P,-1,-1,-1),G("n2",i,t,P,1,-1,-1),G("n3",i,t,P,-1,1,-1),G("n4",i,t,P,1,1,-1),G("f1",i,t,P,-1,-1,1),G("f2",i,t,P,1,-1,1),G("f3",i,t,P,-1,1,1),G("f4",i,t,P,1,1,1),G("u1",i,t,P,.7,1.1,-1),G("u2",i,t,P,-.7,1.1,-1),G("u3",i,t,P,0,2,-1),G("cf1",i,t,P,-1,0,1),G("cf2",i,t,P,1,0,1),G("cf3",i,t,P,0,-1,1),G("cf4",i,t,P,0,1,1),G("cn1",i,t,P,-1,0,-1),G("cn2",i,t,P,1,0,-1),G("cn3",i,t,P,0,-1,-1),G("cn4",i,t,P,0,1,-1),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function G(m,t,i,a,l,d,p){T.set(l,d,p).unproject(a);const v=t[m];if(v!==void 0){const _=i.getAttribute("position");for(let x=0,M=v.length;x<M;x++)_.setXYZ(v[x],T.x,T.y,T.z)}}const V=new Eo;class K extends io{constructor(t,i=16776960){const a=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),l=new Float32Array(24),d=new zn;d.setIndex(new Kn(a,1)),d.setAttribute("position",new Kn(l,3)),super(d,new ro({color:i,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(t){if(t!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&V.setFromObject(this.object),V.isEmpty())return;const i=V.min,a=V.max,l=this.geometry.attributes.position,d=l.array;d[0]=a.x,d[1]=a.y,d[2]=a.z,d[3]=i.x,d[4]=a.y,d[5]=a.z,d[6]=i.x,d[7]=i.y,d[8]=a.z,d[9]=a.x,d[10]=i.y,d[11]=a.z,d[12]=a.x,d[13]=a.y,d[14]=i.z,d[15]=i.x,d[16]=a.y,d[17]=i.z,d[18]=i.x,d[19]=i.y,d[20]=i.z,d[21]=a.x,d[22]=i.y,d[23]=i.z,l.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}copy(t){return io.prototype.copy.call(this,t),this.object=t.object,this}}class _t extends io{constructor(t,i=16776960){const a=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),l=new zn;l.setIndex(new Kn(a,1)),l.setAttribute("position",new xn([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(l,new ro({color:i,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){const i=this.box;i.isEmpty()||(i.getCenter(this.position),i.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}}class Tt extends $a{constructor(t,i=1,a=16776960){const l=a,d=new zn;d.setAttribute("position",new xn([1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],3)),d.computeBoundingSphere(),super(d,new ro({color:l,toneMapped:!1})),this.type="PlaneHelper",this.plane=t,this.size=i;const p=new zn;p.setAttribute("position",new xn([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),p.computeBoundingSphere(),this.add(new Bi(p,new Fi({color:l,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(t){let i=-this.plane.constant;Math.abs(i)<1e-8&&(i=1e-8),this.scale.set(.5*this.size,.5*this.size,i),this.children[0].material.side=i<0?L:zt,this.lookAt(this.plane.normal),super.updateMatrixWorld(t)}}const jt=new gt;let de,Ne;class Nt extends ar{constructor(t=new gt(0,0,1),i=new gt(0,0,0),a=1,l=16776960,d=.2*a,p=.2*d){super(),this.type="ArrowHelper",de===void 0&&(de=new zn,de.setAttribute("position",new xn([0,0,0,0,1,0],3)),Ne=new De(0,.5,1,5,1),Ne.translate(0,-.5,0)),this.position.copy(i),this.line=new $a(de,new ro({color:l,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Bi(Ne,new Fi({color:l,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(a,d,p)}setDirection(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{jt.set(t.z,0,-t.x).normalize();const i=Math.acos(t.y);this.quaternion.setFromAxisAngle(jt,i)}}setLength(t,i=.2*t,a=.2*i){this.line.scale.set(1,Math.max(1e-4,t-i),1),this.line.updateMatrix(),this.cone.scale.set(a,i,a),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}}class ue extends io{constructor(t=1){const i=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],a=new zn;a.setAttribute("position",new xn(i,3)),a.setAttribute("color",new xn([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(a,new ro({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,i,a){const l=new pn,d=this.geometry.attributes.color.array;return l.set(t),l.toArray(d,0),l.toArray(d,3),l.set(i),l.toArray(d,6),l.toArray(d,9),l.set(a),l.toArray(d,12),l.toArray(d,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}const $t=new Float32Array(1),ie=new Int32Array($t.buffer);class Je{static toHalfFloat(t){$t[0]=t;const i=ie[0];let a=i>>16&32768,l=i>>12&2047;const d=i>>23&255;return d<103?a:d>142?(a|=31744,a|=(d==255?0:1)&&8388607&i,a):d<113?(l|=2048,a|=(l>>114-d)+(l>>113-d&1),a):(a|=d-112<<10|l>>1,a+=1&l,a)}}const he=Math.pow(2,8),oe=[.125,.215,.35,.446,.526,.582],Ae=5+oe.length,nn={[Wr]:0,[Us]:1,[_e]:2,[tn]:3,[Xn]:4,[Mr]:5,[Yt]:6},on=new Fi({side:L,depthWrite:!1,depthTest:!1}),$n=new Bi(new da,on),nr=new dp,{_lodPlanes:$e,_sizeLods:Ue,_sigmas:Cn}=Ai(),kn=new pn;let wr=null;const Ar=(1+Math.sqrt(5))/2,Dr=1/Ar,pi=[new gt(1,1,1),new gt(-1,1,1),new gt(1,1,-1),new gt(-1,1,-1),new gt(0,Ar,Dr),new gt(0,Ar,-Dr),new gt(Dr,0,Ar),new gt(-Dr,0,Ar),new gt(Ar,Dr,0),new gt(-Ar,Dr,0)];function Ji(m){const t=Math.max(m.r,m.g,m.b),i=Math.min(Math.max(Math.ceil(Math.log2(t)),-128),127);return m.multiplyScalar(Math.pow(2,-i)),(i+128)/255}class jr{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=function(i){const a=new Float32Array(i),l=new gt(0,1,0);return new ec({name:"SphericalGaussianBlur",defines:{n:i},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:a},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:l},inputEncoding:{value:nn[Wr]},outputEncoding:{value:nn[Wr]}},vertexShader:ur(),fragmentShader:`
2924
2924
 
2925
2925
  precision mediump float;
@@ -6075,6 +6075,6 @@ void main(void){
6075
6075
  `)}},n.prototype.emitSyncDispatch=function(e){if(!this.lock.isLocked(e.type)){var r=Math.random().toString(32).substr(2);this.lock.addLock(e.type,r),this.emit(Ns.syncDispatch,Qu(Qu({},e),{uuid:r})),this.log+="=== sync dispatch ["+new Date().toISOString()+`] ===
6076
6076
  `,this.log+=JSON.stringify(e,null,2),this.log+=`
6077
6077
 
6078
- `}},n.prototype.setMainSeqStep=function(e,r){var s;(s=this.player)===null||s===void 0||s.setMainSeqStep(e,r)},n.prototype.setInteractive=function(e){var r;this.interactive=e,(r=this.player)===null||r===void 0||r.setInteractive(e)},n.prototype.pause=function(){var e;(e=this.player)===null||e===void 0||e.pause()},n.prototype.resume=function(){var e;(e=this.player)===null||e===void 0||e.resume()},n.prototype.getPreviewImage=function(e){var r;return Ma(this,void 0,void 0,function(){return Aa(this,function(s){return[2,((r=this.player)===null||r===void 0?void 0:r.getPreviewImage(e))||null]})})},n.prototype.frozen=function(){var e;return Ma(this,void 0,void 0,function(){var r,s,u,h=this;return Aa(this,function(f){switch(f.label){case 0:return this.isFrowning?[2,yd(function(){return!h.isFrowning},6e4)]:this.view&&this.player?(this.isFrowning=!0,[4,this.player.clock.waitUntil(function(){return!h.isLoading},6e4)]):[3,2];case 1:for(s in f.sent(),r=this.player.getSnapshot()||"",this.cacheImage.src=r,this.cacheImage.style.position="absolute",this.cacheImage.style.zIndex="100",this.frame.appendChild(this.cacheImage),this.player.destroy(),(e=this.playerController)===null||e===void 0||e.destroy(),this.player=void 0,this.__slideState.mediaState)u=this.__slideState.mediaState[s],this.__slideState.mediaState[s]=Qu(Qu({},u),{frozenTime:this.timestamp()});this.isFrowning=!1,f.label=2;case 2:return[2]}})})},n.prototype.release=function(){var e;return Ma(this,void 0,void 0,function(){var r,s,u,h,f=this;return Aa(this,function(y){switch(y.label){case 0:if(this.isReleasing)return[2,yd(function(){return!f.isReleasing},6e4)];for(s in this.isReleasing=!0,this.initPlayer(this.config),this.player.view&&(this.player.view.style.visibility="hidden"),r=this.__slideState,this.__slideState=Object(X.cloneDeep)(vm),r.mediaState)(u=r.mediaState[s]).type==="play"&&(h=Math.max((e=u.frozenTime)!==null&&e!==void 0?e:0,u.time),u.time=this.timestamp()-(h-u.time),u.frozenTime=void 0);return[4,this.setSlideState(r)];case 1:return y.sent(),[4,this.player.clock.delay(333)];case 2:y.sent(),this.player.view&&(this.player.view.style.visibility="visible");try{this.frame.removeChild(this.cacheImage)}catch{}return this.isReleasing=!1,[2]}})})},n.prototype.destroy=function(){var e,r,s,u;this.playerController&&this.playerController.destroy(),this.frameResizeObserver.disconnect(),(e=this.player)===null||e===void 0||e.removeAllListeners(),(r=this.player)===null||r===void 0||r.destroy(),(s=this.player)===null||s===void 0||s.removeAllListeners(),window.removeEventListener("__slide_log__",this.handleLogDownload),window.removeEventListener("__slide_state__",this.handleSlideStateLog),window.removeEventListener("__slide_ref__",this.handleSlideRef),window.clearInterval(this.persistLogId),th&&th.removeItem(this.logId).catch(function(){});try{((u=this.player)===null||u===void 0?void 0:u.view)&&this.anchor.removeChild(this.player.view)}catch{}},n}(J.a)}]);function kg(F,w,S){return Math.min(Math.max(F,w),S)}function Ug(F){return typeof F=="object"&&F!==null}function xf(F){return JSON.parse(JSON.stringify(F))}var Gg={exports:{}},zv={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Hg={exports:{}},jv=function(w){return!w||typeof w=="string"?!1:w instanceof Array||Array.isArray(w)||w.length>=0&&(w.splice instanceof Function||Object.getOwnPropertyDescriptor(w,w.length-1)&&w.constructor.name!=="String")},Vv=jv,Wv=Array.prototype.concat,Xv=Array.prototype.slice,zg=Hg.exports=function(w){for(var S=[],W=0,pt=w.length;W<pt;W++){var lt=w[W];Vv(lt)?S=Wv.call(S,Xv.call(lt)):S.push(lt)}return S};zg.wrap=function(F){return function(){return F(zg(arguments))}};var bf=zv,wf=Hg.exports,jg=Object.hasOwnProperty,Vg={};for(var og in bf)jg.call(bf,og)&&(Vg[bf[og]]=og);var Pa=Gg.exports={to:{},get:{}};Pa.get=function(F){var w=F.substring(0,3).toLowerCase(),S,W;switch(w){case"hsl":S=Pa.get.hsl(F),W="hsl";break;case"hwb":S=Pa.get.hwb(F),W="hwb";break;default:S=Pa.get.rgb(F),W="rgb";break}return S?{model:W,value:S}:null},Pa.get.rgb=function(F){if(!F)return null;var w=/^#([a-f0-9]{3,4})$/i,S=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,W=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,pt=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,lt=/^(\w+)$/,J=[0,0,0,1],X,ct,tt;if(X=F.match(S)){for(tt=X[2],X=X[1],ct=0;ct<3;ct++){var $=ct*2;J[ct]=parseInt(X.slice($,$+2),16)}tt&&(J[3]=parseInt(tt,16)/255)}else if(X=F.match(w)){for(X=X[1],tt=X[3],ct=0;ct<3;ct++)J[ct]=parseInt(X[ct]+X[ct],16);tt&&(J[3]=parseInt(tt+tt,16)/255)}else if(X=F.match(W)){for(ct=0;ct<3;ct++)J[ct]=parseInt(X[ct+1],0);X[4]&&(X[5]?J[3]=parseFloat(X[4])*.01:J[3]=parseFloat(X[4]))}else if(X=F.match(pt)){for(ct=0;ct<3;ct++)J[ct]=Math.round(parseFloat(X[ct+1])*2.55);X[4]&&(X[5]?J[3]=parseFloat(X[4])*.01:J[3]=parseFloat(X[4]))}else return(X=F.match(lt))?X[1]==="transparent"?[0,0,0,0]:jg.call(bf,X[1])?(J=bf[X[1]],J[3]=1,J):null:null;for(ct=0;ct<3;ct++)J[ct]=pc(J[ct],0,255);return J[3]=pc(J[3],0,1),J},Pa.get.hsl=function(F){if(!F)return null;var w=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?[\d\.]+)\s*)?\)$/,S=F.match(w);if(S){var W=parseFloat(S[4]),pt=(parseFloat(S[1])%360+360)%360,lt=pc(parseFloat(S[2]),0,100),J=pc(parseFloat(S[3]),0,100),X=pc(isNaN(W)?1:W,0,1);return[pt,lt,J,X]}return null},Pa.get.hwb=function(F){if(!F)return null;var w=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,S=F.match(w);if(S){var W=parseFloat(S[4]),pt=(parseFloat(S[1])%360+360)%360,lt=pc(parseFloat(S[2]),0,100),J=pc(parseFloat(S[3]),0,100),X=pc(isNaN(W)?1:W,0,1);return[pt,lt,J,X]}return null},Pa.to.hex=function(){var F=wf(arguments);return"#"+Sm(F[0])+Sm(F[1])+Sm(F[2])+(F[3]<1?Sm(Math.round(F[3]*255)):"")},Pa.to.rgb=function(){var F=wf(arguments);return F.length<4||F[3]===1?"rgb("+Math.round(F[0])+", "+Math.round(F[1])+", "+Math.round(F[2])+")":"rgba("+Math.round(F[0])+", "+Math.round(F[1])+", "+Math.round(F[2])+", "+F[3]+")"},Pa.to.rgb.percent=function(){var F=wf(arguments),w=Math.round(F[0]/255*100),S=Math.round(F[1]/255*100),W=Math.round(F[2]/255*100);return F.length<4||F[3]===1?"rgb("+w+"%, "+S+"%, "+W+"%)":"rgba("+w+"%, "+S+"%, "+W+"%, "+F[3]+")"},Pa.to.hsl=function(){var F=wf(arguments);return F.length<4||F[3]===1?"hsl("+F[0]+", "+F[1]+"%, "+F[2]+"%)":"hsla("+F[0]+", "+F[1]+"%, "+F[2]+"%, "+F[3]+")"},Pa.to.hwb=function(){var F=wf(arguments),w="";return F.length>=4&&F[3]!==1&&(w=", "+F[3]),"hwb("+F[0]+", "+F[1]+"%, "+F[2]+"%"+w+")"},Pa.to.keyword=function(F){return Vg[F.slice(0,3)]};function pc(F,w,S){return Math.min(Math.max(w,F),S)}function Sm(F){var w=Math.round(F).toString(16).toUpperCase();return w.length<2?"0"+w:w}var qv=Gg.exports;class Yv{constructor(w){this.enable=w,this.apps={},this.level="debug",this._onMessage=S=>{Ug(S.data)&&(typeof S.data.slide=="boolean"?this.enable=S.data.slide:S.data.slide==="__instance"&&console.log(this))},window.addEventListener("message",this._onMessage)}log(...w){this.enable&&console.log(...w)}verbose(...w){this.enable&&this.level==="verbose"&&console.log(...w)}dispose(w){this.enable=!1,delete this.apps[w],window.removeEventListener("message",this._onMessage)}}const fu=new Yv(!1),Zo=fu.log.bind(fu),Zv=fu.verbose.bind(fu);function Wg(F){try{const w=window.getComputedStyle(F).backgroundColor;if(w!=="rgba(0, 0, 0, 0)"&&w!=="transparent")return w;if(F.parentElement)return Wg(F.parentElement)}catch{}return"#ffffff"}function Jv(F){const w=qv.get(F);if(w&&w.model==="rgb"){const S=w.value,pt=(((Math.round(S[0])&255)<<16)+((Math.round(S[1])&255)<<8)+(Math.round(S[2])&255)).toString(16);return"#"+"000000".substring(pt.length)+pt}else return F}let Tm="";function Xg(F){return Tm||(Tm=Jv(Wg(F)),Zo("[Slide] guess bg color",Tm)),Tm}function qg(F){const{width:w,height:S,slideCount:W,slideState:pt}=F,{taskId:lt,url:J}=pt,X=[];for(let ct=1;ct<=W;++ct)X.push({width:w,height:S,thumbnail:`${J}/${lt}/preview/${ct}.png`,src:"ppt"});return X}function $v(F,w,S,W){var X;const pt=S.slideState.currentSlideIndex;if(!(pt>0)||!w.getIsWritable())return;const lt=[W,pt].join("/");if(F.scenePathType(lt)!=="page"){F.removeScenes(W);const ct=S.slideCount,tt=[];for(let $=1;$<=ct;++$)tt.push({name:`${$}`});F.putScenes(W,tt)}let J;w.getBox().focus?J=F.state.sceneState.scenePath:J=((X=w.getView())==null?void 0:X.focusScenePath)||"",J!==lt&&w.setScenePath(lt)}const sg="https://convertcdn.netless.link/dynamicConvert",Kv=40,ag={taskId:"",url:"",state:null};class Qv{constructor({context:w,anchor:S,onPageChanged:W,onTransitionStart:pt,onTransitionEnd:lt,onError:J}){this.sideEffect=new wm,this.ready=!1,this.readyPromise=new Promise(X=>{this.resolveReady=()=>setTimeout(()=>{this.ready=!0,X()},1e3)}),this.onSyncDispatch=X=>{if(this.context.getIsWritable()&&this.room){const ct={type:ao.SLIDE_EVENTS.syncDispatch,payload:X};Zo("[Slide] dispatch",X),this.room.dispatchMagixEvent(this.channel,ct)}},this.magixEventListener=X=>{if(X.event===this.channel&&Ug(X.payload)){const{type:ct,payload:tt}=X.payload;ct===ao.SLIDE_EVENTS.syncDispatch&&(this.syncStateOnce(),Zo("[Slide] receive",tt),this.syncStateOnceFlag||this.slide.emit(ao.SLIDE_EVENTS.syncReceive,tt))}},this.onStateChange=X=>{this.context.getIsWritable()&&(Zv("[Slide] state change",JSON.stringify(X,null,2)),this.context.updateAttributes(["state"],X))},this.onSeeked=()=>{const X=this.context.getAttributes().state;X&&this.slide.setSlideState(xf(X))},this.pollCount=0,this.pollReadyState=()=>{this.ready?this._toFreeze===1?this.freeze():this._toFreeze===-1&&this.unfreeze():this.pollCount<Kv?(this.pollCount++,setTimeout(this.pollReadyState,500)):(this.pollCount=0,Zo("[Slide] renderSlide (retry after timeout)",1),this.slide.renderSlide(1))},this._pageCount=0,this.destroyed=!1,this.timestamp=()=>this.room&&this.room.calibrationTimestamp?this.room.calibrationTimestamp:this.player?this.player.beginTimestamp+this.player.progressTime:Date.now(),this.isFrozen=!1,this._toFreeze=0,this.freezePromise=null,this.freeze=()=>{this.ready?(Zo("[Slide] freeze",this.context.appId),this.freezePromise?this._toFreeze=1:this.isFrozen||(this._toFreeze=0,this.freezePromise=this.slide.frozen().then(this.afterFreeze.bind(this,1)))):this._toFreeze=1},this.unfreeze=async()=>{this.ready?(Zo("[Slide] unfreeze",this.context.appId),this.freezePromise?this._toFreeze=-1:this.isFrozen&&(this._toFreeze=0,this.freezePromise=this.slide.release().then(this.afterFreeze.bind(this,-1)))):this._toFreeze=-1},this.onPageChanged=W,this.onTransitionStart=pt,this.onTransitionEnd=lt,this.onError=J,this.context=w,this.channel=`channel-${w.appId}`,this.room=w.getRoom(),this.player=this.room?void 0:w.getDisplayer(),this.slide=this.createSlide(S),this.syncStateOnceFlag=!this.context.isAddApp,this.initialize()}jumpToPage(w){this.ready&&(w=kg(w,1,this.pageCount),this.slide.renderSlide(w))}initialize(){this.registerEventListeners(),this.kickStart()}kickStart(){const{context:w,slide:S}=this,{taskId:W,url:pt,state:lt}=_p(_p({},ag),this.context.getAttributes());S.setResource(W,pt||sg),lt?(Zo("[Slide] init with state",xf(lt)),this.syncStateOnceFlag=!1,S.setSlideState(xf(lt))):w.isAddApp&&(Zo("[Slide] init by renderSlide",1),S.renderSlide(1)),this.pollReadyState()}registerEventListeners(){const{context:w,slide:S}=this;this.sideEffect.add(()=>{const W=w.mobxUtils.reaction(()=>w.getAttributes().state,()=>{this.syncStateOnce(),W()});return W}),this.sideEffect.add(()=>(w.emitter.on("seek",this.onSeeked),()=>w.emitter.off("seek",this.onSeeked))),this.sideEffect.add(()=>{const W=w.getDisplayer();return W.addMagixEventListener(this.channel,this.magixEventListener,{fireSelfEventAfterCommit:!0}),()=>W.removeMagixEventListener(this.channel)}),S.on(ao.SLIDE_EVENTS.slideChange,this.onPageChanged),S.on(ao.SLIDE_EVENTS.renderStart,this.onTransitionStart),S.on(ao.SLIDE_EVENTS.renderEnd,this.onTransitionEnd),S.on(ao.SLIDE_EVENTS.mainSeqStepStart,this.onTransitionStart),S.on(ao.SLIDE_EVENTS.mainSeqStepEnd,this.onTransitionEnd),S.on(ao.SLIDE_EVENTS.renderError,this.onError),S.on(ao.SLIDE_EVENTS.stateChange,this.onStateChange),S.on(ao.SLIDE_EVENTS.syncDispatch,this.onSyncDispatch),S.on(ao.SLIDE_EVENTS.renderEnd,this.resolveReady)}syncStateOnce(){if(this.syncStateOnceFlag){const{state:w}=_p(_p({},ag),this.context.getAttributes());w&&(Zo("[Slide] sync with state (once)",xf(w)),this.slide.setSlideState(xf(w)),this.syncStateOnceFlag=!1)}}get pageCount(){return this._pageCount>0?this._pageCount:(this._pageCount=this.slide.slideCount,this._pageCount)}get page(){return this.slide.slideState.currentSlideIndex}createSlide(w){var W,pt;return new ao.Slide({anchor:w,interactive:!0,mode:"interactive",resize:!0,controller:fu.enable,renderOptions:{minFPS:25,maxFPS:30,autoFPS:!0,autoResolution:!0,resolution:(W=this.context.getAppOptions())==null?void 0:W.resolution,transactionBgColor:((pt=this.context.getAppOptions())==null?void 0:pt.bgColor)||Xg(w)},timestamp:this.timestamp})}destroy(){this.sideEffect.flushAll(),this.destroyed||(Zo("[Slide] destroy slide (once)"),this.slide.destroy(),this.destroyed=!0)}afterFreeze(w){w===1?(this.isFrozen=!0,this.freezePromise=null,this._toFreeze===-1&&this.unfreeze()):w===-1&&(this.isFrozen=!1,this.freezePromise=null,this._toFreeze===1&&this.freeze())}}function t0(F){const w="http://www.w3.org/2000/svg",S=document.createElementNS(w,"svg");S.setAttribute("class",`${F}-footer-icon-sidebar`),S.setAttribute("viewBox","0 0 64 64");const W=document.createElementNS(w,"path");return W.setAttribute("fill","currentColor"),W.setAttribute("d","M50 8H14c-3.309 0-6 2.691-6 6v36c0 3.309 2.691 6 6 6h36c3.309 0 6-2.691 6-6V14c0-3.309-2.691-6-6-6zM12 50V14c0-1.103.897-2 2-2h8v40h-8c-1.103 0-2-.897-2-2zm40 0c0 1.103-.897 2-2 2H26V12h24c1.103 0 2 .897 2 2z"),S.appendChild(W),S}function e0(F){const w="http://www.w3.org/2000/svg",S=document.createElementNS(w,"svg");S.setAttribute("class",`${F}-footer-icon-arrow-left`),S.setAttribute("viewBox","0 0 500 500");const W=document.createElementNS(w,"path");return W.setAttribute("fill","currentColor"),W.setAttribute("d","M177.81 249.959L337.473 90.295c2.722-2.865 2.651-7.378-.143-10.1-2.793-2.65-7.163-2.65-9.956 0l-164.75 164.75c-2.793 2.793-2.793 7.306 0 10.1l164.75 164.75c2.865 2.722 7.378 2.65 10.099-.143 2.651-2.794 2.651-7.163 0-9.957L177.809 249.959z"),S.appendChild(W),S}function n0(F){const w="http://www.w3.org/2000/svg",S=document.createElementNS(w,"svg");S.setAttribute("class",`${F}-footer-icon-arrow-right`),S.setAttribute("viewBox","0 0 500 500");const W=document.createElementNS(w,"path");return W.setAttribute("fill","currentColor"),W.setAttribute("d","M322.19 250.041L162.527 409.705c-2.722 2.865-2.651 7.378.143 10.1 2.793 2.65 7.163 2.65 9.956 0l164.75-164.75c2.793-2.793 2.793-7.306 0-10.1l-164.75-164.75c-2.865-2.722-7.378-2.65-10.099.143-2.651 2.794-2.651 7.163 0 9.957l159.664 159.736z"),S.appendChild(W),S}function r0(F){const w="http://www.w3.org/2000/svg",S=document.createElementNS(w,"svg");S.setAttribute("class",`${F}-footer-icon-play`),S.setAttribute("viewBox","0 0 500 500");const W=document.createElementNS(w,"path");return W.setAttribute("fill","currentColor"),W.setAttribute("d","M418.158 257.419L174.663 413.33c-6.017 3.919-15.708 3.772-21.291-.29-2.791-2.018-4.295-4.483-4.295-7.084V94.109c0-5.65 6.883-10.289 15.271-10.289 4.298 0 8.391 1.307 11.181 3.332l242.629 155.484c6.016 3.917 6.451 10.292.649 14.491-.216.154-.432.154-.649.292zM170.621 391.288l223.116-141.301L170.71 107.753l-.089 283.535z"),S.appendChild(W),S}function i0(F){const w="http://www.w3.org/2000/svg",S=document.createElementNS(w,"svg");S.setAttribute("class",`${F}-footer-icon-pause`),S.setAttribute("viewBox","0 0 500 500");const W=document.createElementNS(w,"path");return W.setAttribute("fill","currentColor"),W.setAttribute("d","M312.491 78.261c0-6.159 4.893-11.213 11.04-11.213 6.158 0 11.211 5.054 11.211 11.213v343.478c0 6.159-5.053 11.213-11.211 11.213-6.147 0-11.04-5.054-11.04-11.213V78.261zM165.257 78.261c0-6.159 4.893-11.213 11.04-11.213 6.158 0 11.211 5.054 11.211 11.213v343.478c0 6.159-5.053 11.213-11.211 11.213-6.147 0-11.04-5.054-11.04-11.213V78.261z"),S.appendChild(W),S}const bd=typeof window!="undefined",Yg=bd&&!("onscroll"in window)||typeof navigator!="undefined"&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),Zg=bd&&"IntersectionObserver"in window,Jg=bd&&"classList"in document.createElement("p"),$g=bd&&window.devicePixelRatio>1,o0={elements_selector:".lazy",container:Yg||bd?document:null,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",data_bg_hidpi:"bg-hidpi",data_bg_multi:"bg-multi",data_bg_multi_hidpi:"bg-multi-hidpi",data_poster:"poster",class_applied:"applied",class_loading:"loading",class_loaded:"loaded",class_error:"error",class_entered:"entered",class_exited:"exited",unobserve_completed:!0,unobserve_entered:!1,cancel_on_exit:!0,callback_enter:null,callback_exit:null,callback_applied:null,callback_loading:null,callback_loaded:null,callback_error:null,callback_finish:null,callback_cancel:null,use_native:!1},Kg=F=>Object.assign({},o0,F),Qg=function(F,w){let S;const W="LazyLoad::Initialized",pt=new F(w);try{S=new CustomEvent(W,{detail:{instance:pt}})}catch{S=document.createEvent("CustomEvent"),S.initCustomEvent(W,!1,!1,{instance:pt})}window.dispatchEvent(S)},s0=(F,w)=>{if(!!w)if(!w.length)Qg(F,w);else for(let S=0,W;W=w[S];S+=1)Qg(F,W)},nh="src",lg="srcset",ug="sizes",tv="poster",Sf="llOriginalAttrs",hg="loading",ev="loaded",nv="applied",a0="entered",cg="error",rv="native",iv="data-",ov="ll-status",ll=(F,w)=>F.getAttribute(iv+w),l0=(F,w,S)=>{var W=iv+w;if(S===null){F.removeAttribute(W);return}F.setAttribute(W,S)},Tf=F=>ll(F,ov),wd=(F,w)=>l0(F,ov,w),Em=F=>wd(F,null),dg=F=>Tf(F)===null,u0=F=>Tf(F)===hg,h0=F=>Tf(F)===cg,pg=F=>Tf(F)===rv,c0=[hg,ev,nv,cg],d0=F=>c0.indexOf(Tf(F))>=0,fc=(F,w,S,W)=>{if(!!F){if(W!==void 0){F(w,S,W);return}if(S!==void 0){F(w,S);return}F(w)}},yp=(F,w)=>{if(Jg){F.classList.add(w);return}F.className+=(F.className?" ":"")+w},mu=(F,w)=>{if(Jg){F.classList.remove(w);return}F.className=F.className.replace(new RegExp("(^|\\s+)"+w+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},p0=F=>{F.llTempImage=document.createElement("IMG")},f0=F=>{delete F.llTempImage},sv=F=>F.llTempImage,Mm=(F,w)=>{if(!w)return;const S=w._observer;!S||S.unobserve(F)},m0=F=>{F.disconnect()},g0=(F,w,S)=>{w.unobserve_entered&&Mm(F,S)},fg=(F,w)=>{!F||(F.loadingCount+=w)},v0=F=>{!F||(F.toLoadCount-=1)},av=(F,w)=>{!F||(F.toLoadCount=w)},_0=F=>F.loadingCount>0,y0=F=>F.toLoadCount>0,lv=F=>{let w=[];for(let S=0,W;W=F.children[S];S+=1)W.tagName==="SOURCE"&&w.push(W);return w},mg=(F,w)=>{const S=F.parentNode;if(!S||S.tagName!=="PICTURE")return;lv(S).forEach(w)},uv=(F,w)=>{lv(F).forEach(w)},Am=[nh],hv=[nh,tv],Cm=[nh,lg,ug],Pm=F=>!!F[Sf],cv=F=>F[Sf],dv=F=>delete F[Sf],Ef=(F,w)=>{if(Pm(F))return;const S={};w.forEach(W=>{S[W]=F.getAttribute(W)}),F[Sf]=S},x0=F=>{Pm(F)||(F[Sf]={backgroundImage:F.style.backgroundImage})},b0=(F,w,S)=>{if(!S){F.removeAttribute(w);return}F.setAttribute(w,S)},Mf=(F,w)=>{if(!Pm(F))return;const S=cv(F);w.forEach(W=>{b0(F,W,S[W])})},w0=F=>{if(!Pm(F))return;const w=cv(F);F.style.backgroundImage=w.backgroundImage},S0=(F,w,S)=>{yp(F,w.class_applied),wd(F,nv),!!S&&(w.unobserve_completed&&Mm(F,w),fc(w.callback_applied,F,S))},pv=(F,w,S)=>{yp(F,w.class_loading),wd(F,hg),!!S&&(fg(S,1),fc(w.callback_loading,F,S))},Sd=(F,w,S)=>{!S||F.setAttribute(w,S)},fv=(F,w)=>{Sd(F,ug,ll(F,w.data_sizes)),Sd(F,lg,ll(F,w.data_srcset)),Sd(F,nh,ll(F,w.data_src))},T0=(F,w)=>{mg(F,S=>{Ef(S,Cm),fv(S,w)}),Ef(F,Cm),fv(F,w)},E0=(F,w)=>{Ef(F,Am),Sd(F,nh,ll(F,w.data_src))},M0=(F,w)=>{uv(F,S=>{Ef(S,Am),Sd(S,nh,ll(S,w.data_src))}),Ef(F,hv),Sd(F,tv,ll(F,w.data_poster)),Sd(F,nh,ll(F,w.data_src)),F.load()},A0=(F,w,S)=>{const W=ll(F,w.data_bg),pt=ll(F,w.data_bg_hidpi),lt=$g&&pt?pt:W;!lt||(F.style.backgroundImage=`url("${lt}")`,sv(F).setAttribute(nh,lt),pv(F,w,S))},C0=(F,w,S)=>{const W=ll(F,w.data_bg_multi),pt=ll(F,w.data_bg_multi_hidpi),lt=$g&&pt?pt:W;!lt||(F.style.backgroundImage=lt,S0(F,w,S))},mv={IMG:T0,IFRAME:E0,VIDEO:M0},P0=(F,w)=>{const S=mv[F.tagName];!S||S(F,w)},R0=(F,w,S)=>{const W=mv[F.tagName];!W||(W(F,w),pv(F,w,S))},I0=["IMG","IFRAME","VIDEO"],L0=F=>I0.indexOf(F.tagName)>-1,gv=(F,w)=>{w&&!_0(w)&&!y0(w)&&fc(F.callback_finish,w)},vv=(F,w,S)=>{F.addEventListener(w,S),F.llEvLisnrs[w]=S},O0=(F,w,S)=>{F.removeEventListener(w,S)},gg=F=>!!F.llEvLisnrs,D0=(F,w,S)=>{gg(F)||(F.llEvLisnrs={});const W=F.tagName==="VIDEO"?"loadeddata":"load";vv(F,W,w),vv(F,"error",S)},vg=F=>{if(!gg(F))return;const w=F.llEvLisnrs;for(let S in w){const W=w[S];O0(F,S,W)}delete F.llEvLisnrs},_v=(F,w,S)=>{f0(F),fg(S,-1),v0(S),mu(F,w.class_loading),w.unobserve_completed&&Mm(F,S)},N0=(F,w,S,W)=>{const pt=pg(w);_v(w,S,W),yp(w,S.class_loaded),wd(w,ev),fc(S.callback_loaded,w,W),pt||gv(S,W)},F0=(F,w,S,W)=>{const pt=pg(w);_v(w,S,W),yp(w,S.class_error),wd(w,cg),fc(S.callback_error,w,W),pt||gv(S,W)},_g=(F,w,S)=>{const W=sv(F)||F;if(gg(W))return;D0(W,J=>{N0(J,F,w,S),vg(W)},J=>{F0(J,F,w,S),vg(W)})},B0=(F,w,S)=>{p0(F),_g(F,w,S),x0(F),A0(F,w,S),C0(F,w,S)},k0=(F,w,S)=>{_g(F,w,S),R0(F,w,S)},yg=(F,w,S)=>{L0(F)?k0(F,w,S):B0(F,w,S)},U0=(F,w,S)=>{F.setAttribute("loading","lazy"),_g(F,w,S),P0(F,w),wd(F,rv)},yv=F=>{F.removeAttribute(nh),F.removeAttribute(lg),F.removeAttribute(ug)},G0=F=>{mg(F,w=>{yv(w)}),yv(F)},xv=F=>{mg(F,w=>{Mf(w,Cm)}),Mf(F,Cm)},H0={IMG:xv,IFRAME:F=>{Mf(F,Am)},VIDEO:F=>{uv(F,w=>{Mf(w,Am)}),Mf(F,hv),F.load()}},z0=F=>{const w=H0[F.tagName];if(!w){w0(F);return}w(F)},j0=(F,w)=>{dg(F)||pg(F)||(mu(F,w.class_entered),mu(F,w.class_exited),mu(F,w.class_applied),mu(F,w.class_loading),mu(F,w.class_loaded),mu(F,w.class_error))},V0=(F,w)=>{z0(F),j0(F,w),Em(F),dv(F)},W0=(F,w,S,W)=>{!S.cancel_on_exit||!u0(F)||F.tagName==="IMG"&&(vg(F),G0(F),xv(F),mu(F,S.class_loading),fg(W,-1),Em(F),fc(S.callback_cancel,F,w,W))},X0=(F,w,S,W)=>{const pt=d0(F);wd(F,a0),yp(F,S.class_entered),mu(F,S.class_exited),g0(F,S,W),fc(S.callback_enter,F,w,W),!pt&&yg(F,S,W)},q0=(F,w,S,W)=>{dg(F)||(yp(F,S.class_exited),W0(F,w,S,W),fc(S.callback_exit,F,w,W))},Y0=["IMG","IFRAME","VIDEO"],bv=F=>F.use_native&&"loading"in HTMLImageElement.prototype,Z0=(F,w,S)=>{F.forEach(W=>{Y0.indexOf(W.tagName)!==-1&&U0(W,w,S)}),av(S,0)},J0=F=>F.isIntersecting||F.intersectionRatio>0,$0=F=>({root:F.container===document?null:F.container,rootMargin:F.thresholds||F.threshold+"px"}),K0=(F,w,S)=>{F.forEach(W=>J0(W)?X0(W.target,W,w,S):q0(W.target,W,w,S))},Q0=(F,w)=>{w.forEach(S=>{F.observe(S)})},t_=(F,w)=>{m0(F),Q0(F,w)},e_=(F,w)=>{!Zg||bv(F)||(w._observer=new IntersectionObserver(S=>{K0(S,F,w)},$0(F)))},wv=F=>Array.prototype.slice.call(F),Rm=F=>F.container.querySelectorAll(F.elements_selector),n_=F=>wv(F).filter(dg),r_=F=>h0(F),i_=F=>wv(F).filter(r_),Sv=(F,w)=>n_(F||Rm(w)),o_=(F,w)=>{i_(Rm(F)).forEach(W=>{mu(W,F.class_error),Em(W)}),w.update()},s_=(F,w)=>{!bd||window.addEventListener("online",()=>{o_(F,w)})},Af=function(F,w){const S=Kg(F);this._settings=S,this.loadingCount=0,e_(S,this),s_(S,this),this.update(w)};Af.prototype={update:function(F){const w=this._settings,S=Sv(F,w);if(av(this,S.length),Yg||!Zg){this.loadAll(S);return}if(bv(w)){Z0(S,w,this);return}t_(this._observer,S)},destroy:function(){this._observer&&this._observer.disconnect(),Rm(this._settings).forEach(F=>{dv(F)}),delete this._observer,delete this._settings,delete this.loadingCount,delete this.toLoadCount},loadAll:function(F){const w=this._settings;Sv(F,w).forEach(W=>{Mm(W,this),yg(W,w,this)})},restoreAll:function(){const F=this._settings;Rm(F).forEach(w=>{V0(w,F)})}},Af.load=(F,w)=>{const S=Kg(w);yg(F,S)},Af.resetStatus=F=>{Em(F)},bd&&s0(Af,window.lazyLoadOptions);class Tv{constructor({readonly:w,onNewPageIndex:S,onPlay:W}){this._pages=[],this.pageIndex=0,this.setPaused=()=>{this.$btnPlay.classList.toggle(this.wrapClassName("footer-btn-playing"),!1)},this.setPlaying=()=>{this.$btnPlay.classList.toggle(this.wrapClassName("footer-btn-playing"),!0)},this.namespace="netless-app-slide",this.isShowPreview=!1,this.isSmallBox=!1,this.sideEffect=new wm,this.readonly=w,this.onNewPageIndex=S,this.onPlay=W,this.render()}set pages(w){this._pages=w,this.refreshPreview(),this.refreshTotalPage(),this.refreshBtnSidebar()}get pages(){return this._pages}unmount(){this.$content.remove(),this.$footer.remove()}setReadonly(w){this.readonly=w,this.$content.classList.toggle(this.wrapClassName("readonly"),w),this.$footer.classList.toggle(this.wrapClassName("readonly"),w),this.$pageNumberInput.disabled=w}destroy(){this.sideEffect.flushAll(),this.unmount()}setPageIndex(w){Number.isNaN(w)||(this.pageIndex=w,this.$pageNumberInput.value=String(w+1))}refreshTotalPage(){this.pages.length?this.$totalPage.textContent=" / "+this.pages.length:this.$totalPage.textContent=""}setSmallBox(w){this.isSmallBox!==w&&(this.isSmallBox=w,this.$footer.classList.toggle(this.wrapClassName("float-footer"),w))}render(){return this.renderContent(),this.renderFooter(),this.$content}renderContent(){if(!this.$content){const w=document.createElement("div");w.className=this.wrapClassName("content"),this.$content=w,this.readonly&&w.classList.add(this.wrapClassName("readonly")),w.appendChild(this.renderPreviewMask()),w.appendChild(this.renderPreview())}return this.$content}renderPreview(){if(!this.$preview){const w=document.createElement("div");w.className=this.wrapClassName("preview")+" tele-fancy-scrollbar",this.$preview=w,this.sideEffect.add(()=>(this.previewLazyLoad=new Af({container:this.$preview,elements_selector:`.${this.wrapClassName("preview-page>img")}`}),()=>{var S;return(S=this.previewLazyLoad)==null?void 0:S.destroy()})),this.refreshPreview(),this.sideEffect.addEventListener(w,"click",S=>{var pt;if(this.readonly)return;const W=(pt=S.target.dataset)==null?void 0:pt.pageIndex;W&&(S.preventDefault(),S.stopPropagation(),S.stopImmediatePropagation(),this.onNewPageIndex(Number(W)),this.togglePreview(!1))})}return this.$preview}refreshPreview(){var pt;const{$preview:w}=this,S=this.wrapClassName("preview-page"),W=this.wrapClassName("preview-page-name");for(;w.firstChild;)w.firstChild.remove();this.pages.forEach((lt,J)=>{var kt;const X=(kt=lt.thumbnail)!=null?kt:lt.src.startsWith("ppt")?void 0:lt.src;if(!X)return;const ct=String(J),tt=document.createElement("a");tt.className=S+" "+this.wrapClassName(`preview-page-${J}`),tt.setAttribute("href","#"),tt.dataset.pageIndex=ct;const $=document.createElement("span");$.className=W,$.textContent=String(J+1),$.dataset.pageIndex=ct;const ut=document.createElement("img");ut.width=lt.width,ut.height=lt.height,ut.dataset.src=X,ut.dataset.pageIndex=ct,tt.appendChild(ut),tt.appendChild($),w.appendChild(tt)}),(pt=this.previewLazyLoad)==null||pt.update()}renderPreviewMask(){return this.$previewMask||(this.$previewMask=document.createElement("div"),this.$previewMask.className=this.wrapClassName("preview-mask"),this.sideEffect.addEventListener(this.$previewMask,"click",w=>{this.readonly||w.target===this.$previewMask&&this.togglePreview(!1)})),this.$previewMask}refreshBtnSidebar(){this.$btnSidebar.style.display=this.pages.length>0?"":"none"}renderFooter(){if(!this.$footer){const w=document.createElement("div");w.className=this.wrapClassName("footer"),this.$footer=w,this.readonly&&w.classList.add(this.wrapClassName("readonly")),this.isSmallBox&&w.classList.add(this.wrapClassName("float-footer"));const S=this.renderFooterBtn("btn-sidebar",t0(this.namespace));this.sideEffect.addEventListener(S,"click",()=>{this.readonly||this.togglePreview()}),this.$btnSidebar=S,this.$btnSidebar.style.display="none",this.$footer.appendChild(S);const W=document.createElement("div");W.className=this.wrapClassName("page-jumps");const pt=this.renderFooterBtn("btn-page-back",e0(this.namespace));if(this.sideEffect.addEventListener(pt,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex-1)}),W.appendChild(pt),this.onPlay){const tt=this.renderFooterBtn("btn-page-play",r0(this.namespace),i0(this.namespace));this.$btnPlay=tt,this.sideEffect.addEventListener(tt,"click",()=>{this.readonly||(this.setPlaying(),this.onPlay&&this.onPlay())}),W.appendChild(tt)}const lt=this.renderFooterBtn("btn-page-next",n0(this.namespace));this.sideEffect.addEventListener(lt,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex+1)}),W.appendChild(lt);const J=document.createElement("div");J.className=this.wrapClassName("page-number");const X=document.createElement("input");X.className=this.wrapClassName("page-number-input"),X.value=String(this.pageIndex+1),this.readonly&&(X.disabled=!0),this.$pageNumberInput=X,this.sideEffect.addEventListener(X,"change",()=>{this.readonly||X.value&&this.onNewPageIndex(Number(X.value)-1)});const ct=document.createElement("span");this.$totalPage=ct,J.appendChild(X),J.appendChild(ct),this.$footer.appendChild(W),this.$footer.appendChild(J)}return this.$footer}renderFooterBtn(w,S,W){const pt=document.createElement("button");return pt.className=this.wrapClassName("footer-btn")+" "+this.wrapClassName(w),pt.appendChild(S),W&&pt.appendChild(W),pt}togglePreview(w){if(this.isShowPreview=w!=null?w:!this.isShowPreview,this.$content.classList.toggle(this.wrapClassName("preview-active"),this.isShowPreview),this.isShowPreview){const S=this.$preview.querySelector("."+this.wrapClassName(`preview-page-${this.pageIndex}`));S&&this.$preview.scrollTo({top:S.offsetTop-16})}}wrapClassName(w){return`${this.namespace}-${w}`}}const a_=new Set(["clicker"]);class l_{constructor({box:w,view:S,mountSlideController:W,mountWhiteboard:pt}){this.slideController=null,this.isViewMounted=!1,this.onError=({error:lt})=>{this.viewer.setPaused(),console.warn("[Slide] render error",lt)},this.refreshPages=()=>{this.slideController&&(this.viewer.pages=qg(this.slideController.slide),this.viewer.setPageIndex(this.getPageIndex(this.slideController.page)),this.scaleDocsToFit())},this.scaleDocsToFit=()=>{if(this.slideController){const{width:lt,height:J}=this.slideController.slide;lt&&J&&(this.whiteboardView.moveCameraToContain({originX:-lt/2,originY:-J/2,width:lt,height:J,animationMode:"immediately"}),this.isViewMounted||(this.isViewMounted=!0,console.log("[Slide] mount whiteboard view"),this.mountWhiteboard(this.$whiteboardView)))}},this.onPlay=()=>{this.slideController&&this.slideController.slide.nextStep()},this.onNewPageIndex=lt=>{this.slideController&&this.slideController.jumpToPage(lt+1)},this.sideEffect=new wm,this.namespace="netless-app-slide",this.box=w,this.whiteboardView=S,this.mountSlideController=W,this.mountWhiteboard=pt,this.viewer=new Tv({readonly:w.readonly,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlay}),this.sideEffect.add(()=>{const lt=J=>{this.setReadonly(J)};return w.events.on("readonly",lt),()=>w.events.off("readonly",lt)}),this.render()}render(){this.viewer.$content.appendChild(this.renderSlideContainer()),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.sideEffect.addEventListener(window,"keydown",w=>{if(this.box.focus&&this.slideController)switch(w.key){case"ArrowUp":case"ArrowLeft":{this.slideController.slide.prevStep();break}case"ArrowRight":case"ArrowDown":{this.slideController.slide.nextStep();break}}})}renderSlideContainer(){if(!this.$slide){const w=document.createElement("div");w.className=this.wrapClassName("slide"),w.dataset.appKind="Slide",this.$slide=w}return this.$slide}renderWhiteboardView(){return this.$whiteboardView||(this.$whiteboardView=document.createElement("div"),this.$whiteboardView.className=this.wrapClassName("wb-view")),this.$whiteboardView}mount(){return this.box.mountContent(this.viewer.$content),this.box.mountFooter(this.viewer.$footer),this.slideController=this.mountSlideController({anchor:this.$slide,onTransitionStart:this.viewer.setPlaying,onTransitionEnd:this.viewer.setPaused,onReady:this.refreshPages,onError:this.onError}),this.scaleDocsToFit(),this.sideEffect.add(()=>(this.whiteboardView.callbacks.on("onSizeUpdated",this.scaleDocsToFit),()=>this.whiteboardView.callbacks.off("onSizeUpdated",this.scaleDocsToFit))),this}getPageIndex(w){return(w>0?w:1)-1}unmount(){return this.slideController&&(this.slideController.destroy(),this.slideController=null),this.viewer.unmount(),this}setReadonly(w){this.viewer.setReadonly(w)}destroy(){this.sideEffect.flushAll(),this.unmount(),this.viewer.destroy()}toggleClickThrough(w){this.$whiteboardView.style.pointerEvents=!w||a_.has(w)?"none":"auto"}wrapClassName(w){return`${this.namespace}-${w}`}}const Ev=2,Im={map:new Map,queue:[],validateQueue(){for(Zo("[Slide] freezer: validate",this.queue);this.queue.length>Ev;){const F=this.queue.pop(),w=this.map.get(F);w&&(Zo("[Slide] freezer: validate-freeze",F,this.queue),w.freeze())}},set(F,w){Zo("[Slide] freezer: add",F,this.queue),this.map.set(F,w),this.queue.includes(F)||this.queue.unshift(F),this.validateQueue()},delete(F){Zo("[Slide] freezer: delete",F,this.queue),this.map.delete(F),this.queue=this.queue.filter(w=>w!==F)},focus(F){const w=this.map.get(F),S=this.queue.indexOf(F);S>-1&&this.queue.splice(S,1),this.queue.unshift(F),this.validateQueue(),Zo("[Slide] freezer: focus",F,this.queue),w&&w.unfreeze()}},u_=F=>{F.on("focus",({appId:w})=>{Im.focus(w)})};var h_=`.netless-app-slide-content{position:relative;height:100%;overflow:hidden}.netless-app-slide-preview-mask{display:none;position:absolute;z-index:200;top:0;left:0;width:100%;height:100%}.netless-app-slide-preview{display:flex;flex-direction:column;align-items:center;position:absolute;z-index:300;top:0;left:0;width:33%;max-width:200px;height:100%;padding-top:10px;transform:translate(-100%);background:rgba(237,237,240,.9);box-shadow:inset -1px 0 #0000001c;transition:transform .4s}.netless-app-slide-preview-active .netless-app-slide-preview-mask{display:block}.netless-app-slide-preview-active .netless-app-slide-preview{transform:translate(0)}.netless-app-slide-preview-page{position:relative;display:block;width:55%;margin-bottom:10px;font-size:0;color:transparent;outline:none;border:7px solid transparent;border-radius:4px;transition:border-color .3s;user-select:none}.netless-app-slide-preview-page:hover,.netless-app-slide-preview-page.netless-app-slide-preview-page-active{border-color:#444e601a}.netless-app-slide-preview-page>img{width:100%;height:auto;box-sizing:border-box;border:1px solid rgba(0,0,0,.5);border-radius:1px;background-color:#fff;box-shadow:0 2px 8px #0000004d}.netless-app-slide-preview-page-name{position:absolute;top:1px;left:-10px;transform:translate(-100%);text-align:right;font-size:12px;color:#5f5f5f;user-select:none}.netless-app-slide-footer{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;border-top:1px solid #eeeef7;color:#191919}.netless-app-slide-float-footer{width:100%;min-height:26px;position:absolute;left:0;bottom:0;z-index:2000;background:rgba(249,249,252,.9);transition:opacity .4s}.netless-app-slide-footer-btn{box-sizing:border-box;width:26px;height:26px;font-size:0;margin:0;padding:3px;border:none;border-radius:1px;outline:none;color:currentColor;background:transparent;transition:background .4s;cursor:pointer;user-select:none}.netless-app-slide-footer-btn:hover{background:rgba(237,237,240,.9)}.netless-app-slide-footer-btn>svg{width:100%;height:100%}.netless-app-slide-footer-btn>svg:nth-of-type(2){display:none}.netless-app-slide-footer-btn.netless-app-slide-footer-btn-playing>svg:nth-of-type(1){display:none}.netless-app-slide-footer-btn.netless-app-slide-footer-btn-playing>svg:nth-of-type(2){display:initial}.netless-app-slide-footer-btn~.netless-app-slide-footer-btn{margin-left:15px}.netless-app-slide-page-jumps{flex:1;display:flex;justify-content:center;align-items:center}.netless-app-slide-page-number{margin-left:auto;font-size:13px;user-select:none;white-space:nowrap;word-break:keep-all}.netless-app-slide-page-number-input{border:none;outline:none;width:1.5em;text-align:right;border-radius:2px;color:currentColor;background:transparent;transition:background .4s;user-select:text}.netless-app-slide-page-number-input:hover,.netless-app-slide-page-number-input:focus,.netless-app-slide-page-number-input:active{background:#fff;box-shadow:#63636333 0 2px 8px}.netless-app-slide-readonly .netless-app-slide-footer-btn{cursor:not-allowed}.netless-app-slide-readonly .netless-app-slide-footer-btn:hover{background:transparent}.netless-app-slide-readonly .netless-app-slide-page-number-input{cursor:not-allowed}.netless-app-slide-readonly .netless-app-slide-page-number-input:hover,.netless-app-slide-readonly .netless-app-slide-page-number-input:focus,.netless-app-slide-readonly .netless-app-slide-page-number-input:active{background:transparent;box-shadow:none}.netless-app-slide-readonly .netless-app-slide-page-number-input:disabled{color:inherit}.netless-app-slide-readonly.netless-app-slide-float-footer{display:none}.netless-app-slide-wb-view{position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;overflow:hidden}.netless-app-slide-slide{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.netless-app-slide-slide canvas{transform:scale(var(--netless-app-slide-scale, 1))}
6079
- `;function c_({container:F,taskId:w,url:S=sg,debug:W=!1}){if(!w)throw new Error("[Slide] taskId is required");F.style.cssText+="display:flex;flex-direction:column";const pt=new Mv({target:F});return pt.debug=!!W,pt.mount(w,S),pt}class Mv{constructor(w){this.slide=null,this.debug=!1,this.ready=!1,this.readyPromise=new Promise(S=>{this.resolveReady=()=>{this.ready=!0,S()}}),this.onPageChanged=S=>{this.viewer.setPageIndex(S-1)},this.onTransitionStart=()=>{this.viewer.setPlaying()},this.onTransitionEnd=()=>{this.viewer.setPaused()},this.onError=({error:S})=>{this.viewer.setPaused(),console.warn("[Slide] render error",S)},this.destroyed=!1,this.refreshPages=()=>{this.slide&&(this.viewer.pages=qg(this.slide),this.viewer.setPageIndex(this.getPageIndex(this.slide.slideCount)))},this.onPlay=()=>{this.slide&&this.slide.nextStep()},this.onNewPageIndex=S=>{this.slide&&this.slide.slideCount>0&&this.slide.renderSlide(kg(S+1,1,this.slide.slideCount))},this.namespace="netless-app-slide",this.target=w.target,this.bgColor=Xg(this.target),this.viewer=new Tv({readonly:!1,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlay}),this.render()}render(){this.viewer.$content.appendChild(this.renderSlideContainer())}mount(w,S){this.target.appendChild(this.viewer.$content),this.target.appendChild(this.viewer.$footer),this.slide=new ao.Slide({anchor:this.$slide,interactive:!1,mode:"local",resize:!0,controller:this.debug,renderOptions:{minFPS:25,maxFPS:30,autoFPS:!0,autoResolution:!0,transactionBgColor:this.bgColor}}),this.registerEventListeners(),this.slide.setResource(w,S),this.slide.renderSlide(1)}registerEventListeners(){if(!this.slide)return;const{slide:w}=this;w.on(ao.SLIDE_EVENTS.slideChange,this.onPageChanged),w.on(ao.SLIDE_EVENTS.renderStart,this.onTransitionStart),w.on(ao.SLIDE_EVENTS.renderEnd,this.onTransitionEnd),w.on(ao.SLIDE_EVENTS.mainSeqStepStart,this.onTransitionStart),w.on(ao.SLIDE_EVENTS.mainSeqStepEnd,this.onTransitionEnd),w.on(ao.SLIDE_EVENTS.renderError,this.onError),w.on(ao.SLIDE_EVENTS.renderEnd,this.resolveReady),this.readyPromise.then(this.refreshPages)}destroy(){this.slide&&!this.destroyed&&(Zo("[Slide] destroy slide (once)"),this.slide.destroy(),this.destroyed=!0),this.viewer.destroy()}getPageIndex(w){return(w>0?w:1)-1}renderSlideContainer(){if(!this.$slide){const w=document.createElement("div");w.className=this.wrapClassName("slide"),w.dataset.appKind="Slide",this.$slide=w}return this.$slide}wrapClassName(w){return`${this.namespace}-${w}`}}const d_={kind:"Slide",setup(F){F.getIsWritable()&&Hv(F,ag);const w=F.getAttributes();if(!(w==null?void 0:w.taskId))throw new Error("[Slide] no taskId");const S=F.getView();if(!S)throw new Error("[Slide] no view, please set scenePath on addApp()");S.disableCameraTransform=!0;const W=F.getBox();W.mountStyles(h_);const pt=F.getInitScenePath();let lt=null;const J=$=>{const ut=F.getRoom();if(lt&&lt.slideController){let kt=!1;ut&&F.getIsWritable()&&($v(ut,F,lt.slideController.slide,pt),kt=!0),Zo("[Slide] page to",$,kt),lt.viewer.setPageIndex($-1)}},X=$=>{var kt,Gt;const ut=new Qv(Uv(_p({context:F},$),{onPageChanged:J}));return Im.set(F.appId,ut),((kt=fu.apps)[Gt=F.appId]||(kt[Gt]={})).controller=ut,ut.readyPromise.then($.onReady),ut};lt=new l_({box:W,view:S,mountSlideController:X,mountWhiteboard:F.mountView.bind(F)});const ct=F.getRoom(),tt=new wm;tt.add(()=>{var $,ut,kt;return(($=fu.apps)[ut=F.appId]||($[ut]={})).context=F,fu.enable=((kt=F.getAppOptions())==null?void 0:kt.debug)||!1,fu.level="debug",()=>fu.dispose(F.appId)}),ct&&(lt.toggleClickThrough(ct.state.memberState.currentApplianceName),tt.add(()=>{const $=ut=>{ut.memberState&&lt&&lt.toggleClickThrough(ut.memberState.currentApplianceName)};return ct.callbacks.on("onRoomStateChanged",$),()=>ct.callbacks.off("onRoomStateChanged",$)})),F.emitter.on("destroy",()=>{Zo("[Slide]: destroy"),Im.delete(F.appId),tt.flushAll(),lt&&(lt.destroy(),lt=null)}),lt.mount()}};return wo.DefaultUrl=sg,wo.FreezerLength=Ev,wo.SlidePreviewer=Mv,wo.addHooks=u_,wo.apps=Im,wo.default=d_,wo.previewSlide=c_,Object.defineProperty(wo,"__esModule",{value:!0}),wo[Symbol.toStringTag]="Module",wo}({});})();
6078
+ `}},n.prototype.setMainSeqStep=function(e,r){var s;(s=this.player)===null||s===void 0||s.setMainSeqStep(e,r)},n.prototype.setInteractive=function(e){var r;this.interactive=e,(r=this.player)===null||r===void 0||r.setInteractive(e)},n.prototype.pause=function(){var e;(e=this.player)===null||e===void 0||e.pause()},n.prototype.resume=function(){var e;(e=this.player)===null||e===void 0||e.resume()},n.prototype.getPreviewImage=function(e){var r;return Ma(this,void 0,void 0,function(){return Aa(this,function(s){return[2,((r=this.player)===null||r===void 0?void 0:r.getPreviewImage(e))||null]})})},n.prototype.frozen=function(){var e;return Ma(this,void 0,void 0,function(){var r,s,u,h=this;return Aa(this,function(f){switch(f.label){case 0:return this.isFrowning?[2,yd(function(){return!h.isFrowning},6e4)]:this.view&&this.player?(this.isFrowning=!0,[4,this.player.clock.waitUntil(function(){return!h.isLoading},6e4)]):[3,2];case 1:for(s in f.sent(),r=this.player.getSnapshot()||"",this.cacheImage.src=r,this.cacheImage.style.position="absolute",this.cacheImage.style.zIndex="100",this.frame.appendChild(this.cacheImage),this.player.destroy(),(e=this.playerController)===null||e===void 0||e.destroy(),this.player=void 0,this.__slideState.mediaState)u=this.__slideState.mediaState[s],this.__slideState.mediaState[s]=Qu(Qu({},u),{frozenTime:this.timestamp()});this.isFrowning=!1,f.label=2;case 2:return[2]}})})},n.prototype.release=function(){var e;return Ma(this,void 0,void 0,function(){var r,s,u,h,f=this;return Aa(this,function(y){switch(y.label){case 0:if(this.isReleasing)return[2,yd(function(){return!f.isReleasing},6e4)];for(s in this.isReleasing=!0,this.initPlayer(this.config),this.player.view&&(this.player.view.style.visibility="hidden"),r=this.__slideState,this.__slideState=Object(X.cloneDeep)(vm),r.mediaState)(u=r.mediaState[s]).type==="play"&&(h=Math.max((e=u.frozenTime)!==null&&e!==void 0?e:0,u.time),u.time=this.timestamp()-(h-u.time),u.frozenTime=void 0);return[4,this.setSlideState(r)];case 1:return y.sent(),[4,this.player.clock.delay(333)];case 2:y.sent(),this.player.view&&(this.player.view.style.visibility="visible");try{this.frame.removeChild(this.cacheImage)}catch{}return this.isReleasing=!1,[2]}})})},n.prototype.destroy=function(){var e,r,s,u;this.playerController&&this.playerController.destroy(),this.frameResizeObserver.disconnect(),(e=this.player)===null||e===void 0||e.removeAllListeners(),(r=this.player)===null||r===void 0||r.destroy(),(s=this.player)===null||s===void 0||s.removeAllListeners(),window.removeEventListener("__slide_log__",this.handleLogDownload),window.removeEventListener("__slide_state__",this.handleSlideStateLog),window.removeEventListener("__slide_ref__",this.handleSlideRef),window.clearInterval(this.persistLogId),th&&th.removeItem(this.logId).catch(function(){});try{((u=this.player)===null||u===void 0?void 0:u.view)&&this.anchor.removeChild(this.player.view)}catch{}},n}(J.a)}]);function kg(F,w,S){return Math.min(Math.max(F,w),S)}function Ug(F){return typeof F=="object"&&F!==null}function xf(F){return JSON.parse(JSON.stringify(F))}var Gg={exports:{}},jv={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Hg={exports:{}},Vv=function(w){return!w||typeof w=="string"?!1:w instanceof Array||Array.isArray(w)||w.length>=0&&(w.splice instanceof Function||Object.getOwnPropertyDescriptor(w,w.length-1)&&w.constructor.name!=="String")},Wv=Vv,Xv=Array.prototype.concat,qv=Array.prototype.slice,zg=Hg.exports=function(w){for(var S=[],W=0,pt=w.length;W<pt;W++){var lt=w[W];Wv(lt)?S=Xv.call(S,qv.call(lt)):S.push(lt)}return S};zg.wrap=function(F){return function(){return F(zg(arguments))}};var bf=jv,wf=Hg.exports,jg=Object.hasOwnProperty,Vg={};for(var og in bf)jg.call(bf,og)&&(Vg[bf[og]]=og);var Pa=Gg.exports={to:{},get:{}};Pa.get=function(F){var w=F.substring(0,3).toLowerCase(),S,W;switch(w){case"hsl":S=Pa.get.hsl(F),W="hsl";break;case"hwb":S=Pa.get.hwb(F),W="hwb";break;default:S=Pa.get.rgb(F),W="rgb";break}return S?{model:W,value:S}:null},Pa.get.rgb=function(F){if(!F)return null;var w=/^#([a-f0-9]{3,4})$/i,S=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,W=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,pt=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,lt=/^(\w+)$/,J=[0,0,0,1],X,ct,tt;if(X=F.match(S)){for(tt=X[2],X=X[1],ct=0;ct<3;ct++){var $=ct*2;J[ct]=parseInt(X.slice($,$+2),16)}tt&&(J[3]=parseInt(tt,16)/255)}else if(X=F.match(w)){for(X=X[1],tt=X[3],ct=0;ct<3;ct++)J[ct]=parseInt(X[ct]+X[ct],16);tt&&(J[3]=parseInt(tt+tt,16)/255)}else if(X=F.match(W)){for(ct=0;ct<3;ct++)J[ct]=parseInt(X[ct+1],0);X[4]&&(X[5]?J[3]=parseFloat(X[4])*.01:J[3]=parseFloat(X[4]))}else if(X=F.match(pt)){for(ct=0;ct<3;ct++)J[ct]=Math.round(parseFloat(X[ct+1])*2.55);X[4]&&(X[5]?J[3]=parseFloat(X[4])*.01:J[3]=parseFloat(X[4]))}else return(X=F.match(lt))?X[1]==="transparent"?[0,0,0,0]:jg.call(bf,X[1])?(J=bf[X[1]],J[3]=1,J):null:null;for(ct=0;ct<3;ct++)J[ct]=pc(J[ct],0,255);return J[3]=pc(J[3],0,1),J},Pa.get.hsl=function(F){if(!F)return null;var w=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?[\d\.]+)\s*)?\)$/,S=F.match(w);if(S){var W=parseFloat(S[4]),pt=(parseFloat(S[1])%360+360)%360,lt=pc(parseFloat(S[2]),0,100),J=pc(parseFloat(S[3]),0,100),X=pc(isNaN(W)?1:W,0,1);return[pt,lt,J,X]}return null},Pa.get.hwb=function(F){if(!F)return null;var w=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,S=F.match(w);if(S){var W=parseFloat(S[4]),pt=(parseFloat(S[1])%360+360)%360,lt=pc(parseFloat(S[2]),0,100),J=pc(parseFloat(S[3]),0,100),X=pc(isNaN(W)?1:W,0,1);return[pt,lt,J,X]}return null},Pa.to.hex=function(){var F=wf(arguments);return"#"+Sm(F[0])+Sm(F[1])+Sm(F[2])+(F[3]<1?Sm(Math.round(F[3]*255)):"")},Pa.to.rgb=function(){var F=wf(arguments);return F.length<4||F[3]===1?"rgb("+Math.round(F[0])+", "+Math.round(F[1])+", "+Math.round(F[2])+")":"rgba("+Math.round(F[0])+", "+Math.round(F[1])+", "+Math.round(F[2])+", "+F[3]+")"},Pa.to.rgb.percent=function(){var F=wf(arguments),w=Math.round(F[0]/255*100),S=Math.round(F[1]/255*100),W=Math.round(F[2]/255*100);return F.length<4||F[3]===1?"rgb("+w+"%, "+S+"%, "+W+"%)":"rgba("+w+"%, "+S+"%, "+W+"%, "+F[3]+")"},Pa.to.hsl=function(){var F=wf(arguments);return F.length<4||F[3]===1?"hsl("+F[0]+", "+F[1]+"%, "+F[2]+"%)":"hsla("+F[0]+", "+F[1]+"%, "+F[2]+"%, "+F[3]+")"},Pa.to.hwb=function(){var F=wf(arguments),w="";return F.length>=4&&F[3]!==1&&(w=", "+F[3]),"hwb("+F[0]+", "+F[1]+"%, "+F[2]+"%"+w+")"},Pa.to.keyword=function(F){return Vg[F.slice(0,3)]};function pc(F,w,S){return Math.min(Math.max(w,F),S)}function Sm(F){var w=Math.round(F).toString(16).toUpperCase();return w.length<2?"0"+w:w}var Yv=Gg.exports;class Zv{constructor(w){this.enable=w,this.apps={},this.level="debug",this._onMessage=S=>{Ug(S.data)&&(typeof S.data.slide=="boolean"?this.enable=S.data.slide:S.data.slide==="__instance"&&console.log(this))},window.addEventListener("message",this._onMessage)}log(...w){this.enable&&console.log(...w)}verbose(...w){this.enable&&this.level==="verbose"&&console.log(...w)}dispose(w){this.enable=!1,delete this.apps[w],window.removeEventListener("message",this._onMessage)}}const fu=new Zv(!1),Zo=fu.log.bind(fu),Jv=fu.verbose.bind(fu);function Wg(F){try{const w=window.getComputedStyle(F).backgroundColor;if(w!=="rgba(0, 0, 0, 0)"&&w!=="transparent")return w;if(F.parentElement)return Wg(F.parentElement)}catch{}return"#ffffff"}function $v(F){const w=Yv.get(F);if(w&&w.model==="rgb"){const S=w.value,pt=(((Math.round(S[0])&255)<<16)+((Math.round(S[1])&255)<<8)+(Math.round(S[2])&255)).toString(16);return"#"+"000000".substring(pt.length)+pt}else return F}let Tm="";function Xg(F){return Tm||(Tm=$v(Wg(F)),Zo("[Slide] guess bg color",Tm)),Tm}function qg(F){const{width:w,height:S,slideCount:W,slideState:pt}=F,{taskId:lt,url:J}=pt,X=[];for(let ct=1;ct<=W;++ct)X.push({width:w,height:S,thumbnail:`${J}/${lt}/preview/${ct}.png`,src:"ppt"});return X}function Kv(F,w,S,W){var X;const pt=S.slideState.currentSlideIndex;if(!(pt>0)||!w.getIsWritable())return;const lt=[W,pt].join("/");if(F.scenePathType(lt)!=="page"){F.removeScenes(W);const ct=S.slideCount,tt=[];for(let $=1;$<=ct;++$)tt.push({name:`${$}`});F.putScenes(W,tt)}let J;w.getBox().focus?J=F.state.sceneState.scenePath:J=((X=w.getView())==null?void 0:X.focusScenePath)||"",J!==lt&&w.setScenePath(lt)}const sg="https://convertcdn.netless.link/dynamicConvert",Qv=40,ag={taskId:"",url:"",state:null};class t0{constructor({context:w,anchor:S,onPageChanged:W,onTransitionStart:pt,onTransitionEnd:lt,onError:J}){this.sideEffect=new wm,this.ready=!1,this.readyPromise=new Promise(X=>{this.resolveReady=()=>setTimeout(()=>{this.ready=!0,X()},1e3)}),this.onSyncDispatch=X=>{if(this.context.getIsWritable()&&this.room){const ct={type:ao.SLIDE_EVENTS.syncDispatch,payload:X};Zo("[Slide] dispatch",X),this.room.dispatchMagixEvent(this.channel,ct)}},this.magixEventListener=X=>{if(X.event===this.channel&&Ug(X.payload)){const{type:ct,payload:tt}=X.payload;ct===ao.SLIDE_EVENTS.syncDispatch&&(this.syncStateOnce(),Zo("[Slide] receive",tt),this.syncStateOnceFlag||this.slide.emit(ao.SLIDE_EVENTS.syncReceive,tt))}},this.onStateChange=X=>{this.context.getIsWritable()&&(Jv("[Slide] state change",JSON.stringify(X,null,2)),this.context.updateAttributes(["state"],X))},this.onSeeked=()=>{const X=this.context.getAttributes().state;X&&this.slide.setSlideState(xf(X))},this.pollCount=0,this.pollReadyState=()=>{this.ready?this._toFreeze===1?this.freeze():this._toFreeze===-1&&this.unfreeze():this.pollCount<Qv?(this.pollCount++,setTimeout(this.pollReadyState,500)):(this.pollCount=0,Zo("[Slide] renderSlide (retry after timeout)",1),this.slide.renderSlide(1))},this._pageCount=0,this.destroyed=!1,this.timestamp=()=>this.room&&this.room.calibrationTimestamp?this.room.calibrationTimestamp:this.player?this.player.beginTimestamp+this.player.progressTime:Date.now(),this.isFrozen=!1,this._toFreeze=0,this.freezePromise=null,this.freeze=()=>{this.ready?(Zo("[Slide] freeze",this.context.appId),this.freezePromise?this._toFreeze=1:this.isFrozen||(this._toFreeze=0,this.freezePromise=this.slide.frozen().then(this.afterFreeze.bind(this,1)))):this._toFreeze=1},this.unfreeze=async()=>{this.ready?(Zo("[Slide] unfreeze",this.context.appId),this.freezePromise?this._toFreeze=-1:this.isFrozen&&(this._toFreeze=0,this.freezePromise=this.slide.release().then(this.afterFreeze.bind(this,-1)))):this._toFreeze=-1},this.onPageChanged=W,this.onTransitionStart=pt,this.onTransitionEnd=lt,this.onError=J,this.context=w,this.channel=`channel-${w.appId}`,this.room=w.getRoom(),this.player=this.room?void 0:w.getDisplayer(),this.slide=this.createSlide(S),this.syncStateOnceFlag=!this.context.isAddApp,this.initialize()}jumpToPage(w){this.ready&&(w=kg(w,1,this.pageCount),this.slide.renderSlide(w))}initialize(){this.registerEventListeners(),this.kickStart()}kickStart(){const{context:w,slide:S}=this,{taskId:W,url:pt,state:lt}=_p(_p({},ag),this.context.getAttributes());S.setResource(W,pt||sg),lt?(Zo("[Slide] init with state",xf(lt)),this.syncStateOnceFlag=!1,S.setSlideState(xf(lt))):w.isAddApp&&(Zo("[Slide] init by renderSlide",1),S.renderSlide(1)),this.pollReadyState()}registerEventListeners(){const{context:w,slide:S}=this;this.sideEffect.add(()=>{const W=w.mobxUtils.reaction(()=>w.getAttributes().state,()=>{this.syncStateOnce(),W()});return W}),this.sideEffect.add(()=>(w.emitter.on("seek",this.onSeeked),()=>w.emitter.off("seek",this.onSeeked))),this.sideEffect.add(()=>{const W=w.getDisplayer();return W.addMagixEventListener(this.channel,this.magixEventListener,{fireSelfEventAfterCommit:!0}),()=>W.removeMagixEventListener(this.channel)}),S.on(ao.SLIDE_EVENTS.slideChange,this.onPageChanged),S.on(ao.SLIDE_EVENTS.renderStart,this.onTransitionStart),S.on(ao.SLIDE_EVENTS.renderEnd,this.onTransitionEnd),S.on(ao.SLIDE_EVENTS.mainSeqStepStart,this.onTransitionStart),S.on(ao.SLIDE_EVENTS.mainSeqStepEnd,this.onTransitionEnd),S.on(ao.SLIDE_EVENTS.renderError,this.onError),S.on(ao.SLIDE_EVENTS.stateChange,this.onStateChange),S.on(ao.SLIDE_EVENTS.syncDispatch,this.onSyncDispatch),S.on(ao.SLIDE_EVENTS.renderEnd,this.resolveReady)}syncStateOnce(){if(this.syncStateOnceFlag){const{state:w}=_p(_p({},ag),this.context.getAttributes());w&&(Zo("[Slide] sync with state (once)",xf(w)),this.slide.setSlideState(xf(w)),this.syncStateOnceFlag=!1)}}get pageCount(){return this._pageCount>0?this._pageCount:(this._pageCount=this.slide.slideCount,this._pageCount)}get page(){return this.slide.slideState.currentSlideIndex}createSlide(w){var W,pt;return new ao.Slide({anchor:w,interactive:!0,mode:"interactive",resize:!0,controller:fu.enable,renderOptions:{minFPS:25,maxFPS:30,autoFPS:!0,autoResolution:!0,resolution:(W=this.context.getAppOptions())==null?void 0:W.resolution,transactionBgColor:((pt=this.context.getAppOptions())==null?void 0:pt.bgColor)||Xg(w)},timestamp:this.timestamp})}destroy(){this.sideEffect.flushAll(),this.destroyed||(Zo("[Slide] destroy slide (once)"),this.slide.destroy(),this.destroyed=!0)}afterFreeze(w){w===1?(this.isFrozen=!0,this.freezePromise=null,this._toFreeze===-1&&this.unfreeze()):w===-1&&(this.isFrozen=!1,this.freezePromise=null,this._toFreeze===1&&this.freeze())}}function e0(F){const w="http://www.w3.org/2000/svg",S=document.createElementNS(w,"svg");S.setAttribute("class",`${F}-footer-icon-sidebar`),S.setAttribute("viewBox","0 0 64 64");const W=document.createElementNS(w,"path");return W.setAttribute("fill","currentColor"),W.setAttribute("d","M50 8H14c-3.309 0-6 2.691-6 6v36c0 3.309 2.691 6 6 6h36c3.309 0 6-2.691 6-6V14c0-3.309-2.691-6-6-6zM12 50V14c0-1.103.897-2 2-2h8v40h-8c-1.103 0-2-.897-2-2zm40 0c0 1.103-.897 2-2 2H26V12h24c1.103 0 2 .897 2 2z"),S.appendChild(W),S}function n0(F){const w="http://www.w3.org/2000/svg",S=document.createElementNS(w,"svg");S.setAttribute("class",`${F}-footer-icon-arrow-left`),S.setAttribute("viewBox","0 0 500 500");const W=document.createElementNS(w,"path");return W.setAttribute("fill","currentColor"),W.setAttribute("d","M177.81 249.959L337.473 90.295c2.722-2.865 2.651-7.378-.143-10.1-2.793-2.65-7.163-2.65-9.956 0l-164.75 164.75c-2.793 2.793-2.793 7.306 0 10.1l164.75 164.75c2.865 2.722 7.378 2.65 10.099-.143 2.651-2.794 2.651-7.163 0-9.957L177.809 249.959z"),S.appendChild(W),S}function r0(F){const w="http://www.w3.org/2000/svg",S=document.createElementNS(w,"svg");S.setAttribute("class",`${F}-footer-icon-arrow-right`),S.setAttribute("viewBox","0 0 500 500");const W=document.createElementNS(w,"path");return W.setAttribute("fill","currentColor"),W.setAttribute("d","M322.19 250.041L162.527 409.705c-2.722 2.865-2.651 7.378.143 10.1 2.793 2.65 7.163 2.65 9.956 0l164.75-164.75c2.793-2.793 2.793-7.306 0-10.1l-164.75-164.75c-2.865-2.722-7.378-2.65-10.099.143-2.651 2.794-2.651 7.163 0 9.957l159.664 159.736z"),S.appendChild(W),S}function i0(F){const w="http://www.w3.org/2000/svg",S=document.createElementNS(w,"svg");S.setAttribute("class",`${F}-footer-icon-play`),S.setAttribute("viewBox","0 0 500 500");const W=document.createElementNS(w,"path");return W.setAttribute("fill","currentColor"),W.setAttribute("d","M418.158 257.419L174.663 413.33c-6.017 3.919-15.708 3.772-21.291-.29-2.791-2.018-4.295-4.483-4.295-7.084V94.109c0-5.65 6.883-10.289 15.271-10.289 4.298 0 8.391 1.307 11.181 3.332l242.629 155.484c6.016 3.917 6.451 10.292.649 14.491-.216.154-.432.154-.649.292zM170.621 391.288l223.116-141.301L170.71 107.753l-.089 283.535z"),S.appendChild(W),S}function o0(F){const w="http://www.w3.org/2000/svg",S=document.createElementNS(w,"svg");S.setAttribute("class",`${F}-footer-icon-pause`),S.setAttribute("viewBox","0 0 500 500");const W=document.createElementNS(w,"path");return W.setAttribute("fill","currentColor"),W.setAttribute("d","M312.491 78.261c0-6.159 4.893-11.213 11.04-11.213 6.158 0 11.211 5.054 11.211 11.213v343.478c0 6.159-5.053 11.213-11.211 11.213-6.147 0-11.04-5.054-11.04-11.213V78.261zM165.257 78.261c0-6.159 4.893-11.213 11.04-11.213 6.158 0 11.211 5.054 11.211 11.213v343.478c0 6.159-5.053 11.213-11.211 11.213-6.147 0-11.04-5.054-11.04-11.213V78.261z"),S.appendChild(W),S}const bd=typeof window!="undefined",Yg=bd&&!("onscroll"in window)||typeof navigator!="undefined"&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),Zg=bd&&"IntersectionObserver"in window,Jg=bd&&"classList"in document.createElement("p"),$g=bd&&window.devicePixelRatio>1,s0={elements_selector:".lazy",container:Yg||bd?document:null,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",data_bg_hidpi:"bg-hidpi",data_bg_multi:"bg-multi",data_bg_multi_hidpi:"bg-multi-hidpi",data_poster:"poster",class_applied:"applied",class_loading:"loading",class_loaded:"loaded",class_error:"error",class_entered:"entered",class_exited:"exited",unobserve_completed:!0,unobserve_entered:!1,cancel_on_exit:!0,callback_enter:null,callback_exit:null,callback_applied:null,callback_loading:null,callback_loaded:null,callback_error:null,callback_finish:null,callback_cancel:null,use_native:!1},Kg=F=>Object.assign({},s0,F),Qg=function(F,w){let S;const W="LazyLoad::Initialized",pt=new F(w);try{S=new CustomEvent(W,{detail:{instance:pt}})}catch{S=document.createEvent("CustomEvent"),S.initCustomEvent(W,!1,!1,{instance:pt})}window.dispatchEvent(S)},a0=(F,w)=>{if(!!w)if(!w.length)Qg(F,w);else for(let S=0,W;W=w[S];S+=1)Qg(F,W)},nh="src",lg="srcset",ug="sizes",tv="poster",Sf="llOriginalAttrs",hg="loading",ev="loaded",nv="applied",l0="entered",cg="error",rv="native",iv="data-",ov="ll-status",ll=(F,w)=>F.getAttribute(iv+w),u0=(F,w,S)=>{var W=iv+w;if(S===null){F.removeAttribute(W);return}F.setAttribute(W,S)},Tf=F=>ll(F,ov),wd=(F,w)=>u0(F,ov,w),Em=F=>wd(F,null),dg=F=>Tf(F)===null,h0=F=>Tf(F)===hg,c0=F=>Tf(F)===cg,pg=F=>Tf(F)===rv,d0=[hg,ev,nv,cg],p0=F=>d0.indexOf(Tf(F))>=0,fc=(F,w,S,W)=>{if(!!F){if(W!==void 0){F(w,S,W);return}if(S!==void 0){F(w,S);return}F(w)}},yp=(F,w)=>{if(Jg){F.classList.add(w);return}F.className+=(F.className?" ":"")+w},mu=(F,w)=>{if(Jg){F.classList.remove(w);return}F.className=F.className.replace(new RegExp("(^|\\s+)"+w+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},f0=F=>{F.llTempImage=document.createElement("IMG")},m0=F=>{delete F.llTempImage},sv=F=>F.llTempImage,Mm=(F,w)=>{if(!w)return;const S=w._observer;!S||S.unobserve(F)},g0=F=>{F.disconnect()},v0=(F,w,S)=>{w.unobserve_entered&&Mm(F,S)},fg=(F,w)=>{!F||(F.loadingCount+=w)},_0=F=>{!F||(F.toLoadCount-=1)},av=(F,w)=>{!F||(F.toLoadCount=w)},y0=F=>F.loadingCount>0,x0=F=>F.toLoadCount>0,lv=F=>{let w=[];for(let S=0,W;W=F.children[S];S+=1)W.tagName==="SOURCE"&&w.push(W);return w},mg=(F,w)=>{const S=F.parentNode;if(!S||S.tagName!=="PICTURE")return;lv(S).forEach(w)},uv=(F,w)=>{lv(F).forEach(w)},Am=[nh],hv=[nh,tv],Cm=[nh,lg,ug],Pm=F=>!!F[Sf],cv=F=>F[Sf],dv=F=>delete F[Sf],Ef=(F,w)=>{if(Pm(F))return;const S={};w.forEach(W=>{S[W]=F.getAttribute(W)}),F[Sf]=S},b0=F=>{Pm(F)||(F[Sf]={backgroundImage:F.style.backgroundImage})},w0=(F,w,S)=>{if(!S){F.removeAttribute(w);return}F.setAttribute(w,S)},Mf=(F,w)=>{if(!Pm(F))return;const S=cv(F);w.forEach(W=>{w0(F,W,S[W])})},S0=F=>{if(!Pm(F))return;const w=cv(F);F.style.backgroundImage=w.backgroundImage},T0=(F,w,S)=>{yp(F,w.class_applied),wd(F,nv),!!S&&(w.unobserve_completed&&Mm(F,w),fc(w.callback_applied,F,S))},pv=(F,w,S)=>{yp(F,w.class_loading),wd(F,hg),!!S&&(fg(S,1),fc(w.callback_loading,F,S))},Sd=(F,w,S)=>{!S||F.setAttribute(w,S)},fv=(F,w)=>{Sd(F,ug,ll(F,w.data_sizes)),Sd(F,lg,ll(F,w.data_srcset)),Sd(F,nh,ll(F,w.data_src))},E0=(F,w)=>{mg(F,S=>{Ef(S,Cm),fv(S,w)}),Ef(F,Cm),fv(F,w)},M0=(F,w)=>{Ef(F,Am),Sd(F,nh,ll(F,w.data_src))},A0=(F,w)=>{uv(F,S=>{Ef(S,Am),Sd(S,nh,ll(S,w.data_src))}),Ef(F,hv),Sd(F,tv,ll(F,w.data_poster)),Sd(F,nh,ll(F,w.data_src)),F.load()},C0=(F,w,S)=>{const W=ll(F,w.data_bg),pt=ll(F,w.data_bg_hidpi),lt=$g&&pt?pt:W;!lt||(F.style.backgroundImage=`url("${lt}")`,sv(F).setAttribute(nh,lt),pv(F,w,S))},P0=(F,w,S)=>{const W=ll(F,w.data_bg_multi),pt=ll(F,w.data_bg_multi_hidpi),lt=$g&&pt?pt:W;!lt||(F.style.backgroundImage=lt,T0(F,w,S))},mv={IMG:E0,IFRAME:M0,VIDEO:A0},R0=(F,w)=>{const S=mv[F.tagName];!S||S(F,w)},I0=(F,w,S)=>{const W=mv[F.tagName];!W||(W(F,w),pv(F,w,S))},L0=["IMG","IFRAME","VIDEO"],O0=F=>L0.indexOf(F.tagName)>-1,gv=(F,w)=>{w&&!y0(w)&&!x0(w)&&fc(F.callback_finish,w)},vv=(F,w,S)=>{F.addEventListener(w,S),F.llEvLisnrs[w]=S},D0=(F,w,S)=>{F.removeEventListener(w,S)},gg=F=>!!F.llEvLisnrs,N0=(F,w,S)=>{gg(F)||(F.llEvLisnrs={});const W=F.tagName==="VIDEO"?"loadeddata":"load";vv(F,W,w),vv(F,"error",S)},vg=F=>{if(!gg(F))return;const w=F.llEvLisnrs;for(let S in w){const W=w[S];D0(F,S,W)}delete F.llEvLisnrs},_v=(F,w,S)=>{m0(F),fg(S,-1),_0(S),mu(F,w.class_loading),w.unobserve_completed&&Mm(F,S)},F0=(F,w,S,W)=>{const pt=pg(w);_v(w,S,W),yp(w,S.class_loaded),wd(w,ev),fc(S.callback_loaded,w,W),pt||gv(S,W)},B0=(F,w,S,W)=>{const pt=pg(w);_v(w,S,W),yp(w,S.class_error),wd(w,cg),fc(S.callback_error,w,W),pt||gv(S,W)},_g=(F,w,S)=>{const W=sv(F)||F;if(gg(W))return;N0(W,J=>{F0(J,F,w,S),vg(W)},J=>{B0(J,F,w,S),vg(W)})},k0=(F,w,S)=>{f0(F),_g(F,w,S),b0(F),C0(F,w,S),P0(F,w,S)},U0=(F,w,S)=>{_g(F,w,S),I0(F,w,S)},yg=(F,w,S)=>{O0(F)?U0(F,w,S):k0(F,w,S)},G0=(F,w,S)=>{F.setAttribute("loading","lazy"),_g(F,w,S),R0(F,w),wd(F,rv)},yv=F=>{F.removeAttribute(nh),F.removeAttribute(lg),F.removeAttribute(ug)},H0=F=>{mg(F,w=>{yv(w)}),yv(F)},xv=F=>{mg(F,w=>{Mf(w,Cm)}),Mf(F,Cm)},z0={IMG:xv,IFRAME:F=>{Mf(F,Am)},VIDEO:F=>{uv(F,w=>{Mf(w,Am)}),Mf(F,hv),F.load()}},j0=F=>{const w=z0[F.tagName];if(!w){S0(F);return}w(F)},V0=(F,w)=>{dg(F)||pg(F)||(mu(F,w.class_entered),mu(F,w.class_exited),mu(F,w.class_applied),mu(F,w.class_loading),mu(F,w.class_loaded),mu(F,w.class_error))},W0=(F,w)=>{j0(F),V0(F,w),Em(F),dv(F)},X0=(F,w,S,W)=>{!S.cancel_on_exit||!h0(F)||F.tagName==="IMG"&&(vg(F),H0(F),xv(F),mu(F,S.class_loading),fg(W,-1),Em(F),fc(S.callback_cancel,F,w,W))},q0=(F,w,S,W)=>{const pt=p0(F);wd(F,l0),yp(F,S.class_entered),mu(F,S.class_exited),v0(F,S,W),fc(S.callback_enter,F,w,W),!pt&&yg(F,S,W)},Y0=(F,w,S,W)=>{dg(F)||(yp(F,S.class_exited),X0(F,w,S,W),fc(S.callback_exit,F,w,W))},Z0=["IMG","IFRAME","VIDEO"],bv=F=>F.use_native&&"loading"in HTMLImageElement.prototype,J0=(F,w,S)=>{F.forEach(W=>{Z0.indexOf(W.tagName)!==-1&&G0(W,w,S)}),av(S,0)},$0=F=>F.isIntersecting||F.intersectionRatio>0,K0=F=>({root:F.container===document?null:F.container,rootMargin:F.thresholds||F.threshold+"px"}),Q0=(F,w,S)=>{F.forEach(W=>$0(W)?q0(W.target,W,w,S):Y0(W.target,W,w,S))},t_=(F,w)=>{w.forEach(S=>{F.observe(S)})},e_=(F,w)=>{g0(F),t_(F,w)},n_=(F,w)=>{!Zg||bv(F)||(w._observer=new IntersectionObserver(S=>{Q0(S,F,w)},K0(F)))},wv=F=>Array.prototype.slice.call(F),Rm=F=>F.container.querySelectorAll(F.elements_selector),r_=F=>wv(F).filter(dg),i_=F=>c0(F),o_=F=>wv(F).filter(i_),Sv=(F,w)=>r_(F||Rm(w)),s_=(F,w)=>{o_(Rm(F)).forEach(W=>{mu(W,F.class_error),Em(W)}),w.update()},a_=(F,w)=>{!bd||window.addEventListener("online",()=>{s_(F,w)})},Af=function(F,w){const S=Kg(F);this._settings=S,this.loadingCount=0,n_(S,this),a_(S,this),this.update(w)};Af.prototype={update:function(F){const w=this._settings,S=Sv(F,w);if(av(this,S.length),Yg||!Zg){this.loadAll(S);return}if(bv(w)){J0(S,w,this);return}e_(this._observer,S)},destroy:function(){this._observer&&this._observer.disconnect(),Rm(this._settings).forEach(F=>{dv(F)}),delete this._observer,delete this._settings,delete this.loadingCount,delete this.toLoadCount},loadAll:function(F){const w=this._settings;Sv(F,w).forEach(W=>{Mm(W,this),yg(W,w,this)})},restoreAll:function(){const F=this._settings;Rm(F).forEach(w=>{W0(w,F)})}},Af.load=(F,w)=>{const S=Kg(w);yg(F,S)},Af.resetStatus=F=>{Em(F)},bd&&a0(Af,window.lazyLoadOptions);class Tv{constructor({readonly:w,onNewPageIndex:S,onPlay:W}){this._pages=[],this.pageIndex=0,this.setPaused=()=>{this.$btnPlay.classList.toggle(this.wrapClassName("footer-btn-playing"),!1)},this.setPlaying=()=>{this.$btnPlay.classList.toggle(this.wrapClassName("footer-btn-playing"),!0)},this.namespace="netless-app-slide",this.isShowPreview=!1,this.isSmallBox=!1,this.sideEffect=new wm,this.readonly=w,this.onNewPageIndex=S,this.onPlay=W,this.render()}set pages(w){this._pages=w,this.refreshPreview(),this.refreshTotalPage(),this.refreshBtnSidebar()}get pages(){return this._pages}unmount(){this.$content.remove(),this.$footer.remove()}setReadonly(w){this.readonly=w,this.$content.classList.toggle(this.wrapClassName("readonly"),w),this.$footer.classList.toggle(this.wrapClassName("readonly"),w),this.$pageNumberInput.disabled=w}destroy(){this.sideEffect.flushAll(),this.unmount()}setPageIndex(w){Number.isNaN(w)||(this.pageIndex=w,this.$pageNumberInput.value=String(w+1))}refreshTotalPage(){this.pages.length?this.$totalPage.textContent=" / "+this.pages.length:this.$totalPage.textContent=""}setSmallBox(w){this.isSmallBox!==w&&(this.isSmallBox=w,this.$footer.classList.toggle(this.wrapClassName("float-footer"),w))}render(){return this.renderContent(),this.renderFooter(),this.$content}renderContent(){if(!this.$content){const w=document.createElement("div");w.className=this.wrapClassName("content"),this.$content=w,this.readonly&&w.classList.add(this.wrapClassName("readonly")),w.appendChild(this.renderPreviewMask()),w.appendChild(this.renderPreview())}return this.$content}renderPreview(){if(!this.$preview){const w=document.createElement("div");w.className=this.wrapClassName("preview")+" tele-fancy-scrollbar",this.$preview=w,this.sideEffect.add(()=>(this.previewLazyLoad=new Af({container:this.$preview,elements_selector:`.${this.wrapClassName("preview-page>img")}`}),()=>{var S;return(S=this.previewLazyLoad)==null?void 0:S.destroy()})),this.refreshPreview(),this.sideEffect.addEventListener(w,"click",S=>{var pt;if(this.readonly)return;const W=(pt=S.target.dataset)==null?void 0:pt.pageIndex;W&&(S.preventDefault(),S.stopPropagation(),S.stopImmediatePropagation(),this.onNewPageIndex(Number(W)),this.togglePreview(!1))})}return this.$preview}refreshPreview(){var pt;const{$preview:w}=this,S=this.wrapClassName("preview-page"),W=this.wrapClassName("preview-page-name");for(;w.firstChild;)w.firstChild.remove();this.pages.forEach((lt,J)=>{var kt;const X=(kt=lt.thumbnail)!=null?kt:lt.src.startsWith("ppt")?void 0:lt.src;if(!X)return;const ct=String(J),tt=document.createElement("a");tt.className=S+" "+this.wrapClassName(`preview-page-${J}`),tt.setAttribute("href","#"),tt.dataset.pageIndex=ct;const $=document.createElement("span");$.className=W,$.textContent=String(J+1),$.dataset.pageIndex=ct;const ut=document.createElement("img");ut.width=lt.width,ut.height=lt.height,ut.dataset.src=X,ut.dataset.pageIndex=ct,tt.appendChild(ut),tt.appendChild($),w.appendChild(tt)}),(pt=this.previewLazyLoad)==null||pt.update()}renderPreviewMask(){return this.$previewMask||(this.$previewMask=document.createElement("div"),this.$previewMask.className=this.wrapClassName("preview-mask"),this.sideEffect.addEventListener(this.$previewMask,"click",w=>{this.readonly||w.target===this.$previewMask&&this.togglePreview(!1)})),this.$previewMask}refreshBtnSidebar(){this.$btnSidebar.style.display=this.pages.length>0?"":"none"}renderFooter(){if(!this.$footer){const w=document.createElement("div");w.className=this.wrapClassName("footer"),this.$footer=w,this.readonly&&w.classList.add(this.wrapClassName("readonly")),this.isSmallBox&&w.classList.add(this.wrapClassName("float-footer"));const S=this.renderFooterBtn("btn-sidebar",e0(this.namespace));this.sideEffect.addEventListener(S,"click",()=>{this.readonly||this.togglePreview()}),this.$btnSidebar=S,this.$btnSidebar.style.display="none",this.$footer.appendChild(S);const W=document.createElement("div");W.className=this.wrapClassName("page-jumps");const pt=this.renderFooterBtn("btn-page-back",n0(this.namespace));if(this.sideEffect.addEventListener(pt,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex-1)}),W.appendChild(pt),this.onPlay){const tt=this.renderFooterBtn("btn-page-play",i0(this.namespace),o0(this.namespace));this.$btnPlay=tt,this.sideEffect.addEventListener(tt,"click",()=>{this.readonly||(this.setPlaying(),this.onPlay&&this.onPlay())}),W.appendChild(tt)}const lt=this.renderFooterBtn("btn-page-next",r0(this.namespace));this.sideEffect.addEventListener(lt,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex+1)}),W.appendChild(lt);const J=document.createElement("div");J.className=this.wrapClassName("page-number");const X=document.createElement("input");X.className=this.wrapClassName("page-number-input"),X.value=String(this.pageIndex+1),this.readonly&&(X.disabled=!0),this.$pageNumberInput=X,this.sideEffect.addEventListener(X,"change",()=>{this.readonly||X.value&&this.onNewPageIndex(Number(X.value)-1)});const ct=document.createElement("span");this.$totalPage=ct,J.appendChild(X),J.appendChild(ct),this.$footer.appendChild(W),this.$footer.appendChild(J)}return this.$footer}renderFooterBtn(w,S,W){const pt=document.createElement("button");return pt.className=this.wrapClassName("footer-btn")+" "+this.wrapClassName(w),pt.appendChild(S),W&&pt.appendChild(W),pt}togglePreview(w){if(this.isShowPreview=w!=null?w:!this.isShowPreview,this.$content.classList.toggle(this.wrapClassName("preview-active"),this.isShowPreview),this.isShowPreview){const S=this.$preview.querySelector("."+this.wrapClassName(`preview-page-${this.pageIndex}`));S&&this.$preview.scrollTo({top:S.offsetTop-16})}}wrapClassName(w){return`${this.namespace}-${w}`}}const l_=new Set(["clicker"]);class u_{constructor({box:w,view:S,mountSlideController:W,mountWhiteboard:pt}){this.slideController=null,this.isViewMounted=!1,this.onError=({error:lt})=>{this.viewer.setPaused(),console.warn("[Slide] render error",lt)},this.refreshPages=()=>{this.slideController&&(this.viewer.pages=qg(this.slideController.slide),this.viewer.setPageIndex(this.getPageIndex(this.slideController.page)),this.scaleDocsToFit())},this.scaleDocsToFit=()=>{if(this.slideController){const{width:lt,height:J}=this.slideController.slide;lt&&J&&(this.whiteboardView.moveCameraToContain({originX:-lt/2,originY:-J/2,width:lt,height:J,animationMode:"immediately"}),this.isViewMounted||(this.isViewMounted=!0,console.log("[Slide] mount whiteboard view"),this.mountWhiteboard(this.$whiteboardView)))}},this.onPlay=()=>{this.slideController&&this.slideController.slide.nextStep()},this.onNewPageIndex=lt=>{this.slideController&&this.slideController.jumpToPage(lt+1)},this.sideEffect=new wm,this.namespace="netless-app-slide",this.box=w,this.whiteboardView=S,this.mountSlideController=W,this.mountWhiteboard=pt,this.viewer=new Tv({readonly:w.readonly,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlay}),this.sideEffect.add(()=>{const lt=J=>{this.setReadonly(J)};return w.events.on("readonly",lt),()=>w.events.off("readonly",lt)}),this.render()}render(){this.viewer.$content.appendChild(this.renderSlideContainer()),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.sideEffect.addEventListener(window,"keydown",w=>{if(this.box.focus&&this.slideController)switch(w.key){case"ArrowUp":case"ArrowLeft":{this.slideController.slide.prevStep();break}case"ArrowRight":case"ArrowDown":{this.slideController.slide.nextStep();break}}})}renderSlideContainer(){if(!this.$slide){const w=document.createElement("div");w.className=this.wrapClassName("slide"),w.dataset.appKind="Slide",this.$slide=w}return this.$slide}renderWhiteboardView(){return this.$whiteboardView||(this.$whiteboardView=document.createElement("div"),this.$whiteboardView.className=this.wrapClassName("wb-view")),this.$whiteboardView}mount(){return this.box.mountContent(this.viewer.$content),this.box.mountFooter(this.viewer.$footer),this.slideController=this.mountSlideController({anchor:this.$slide,onTransitionStart:this.viewer.setPlaying,onTransitionEnd:this.viewer.setPaused,onReady:this.refreshPages,onError:this.onError}),this.scaleDocsToFit(),this.sideEffect.add(()=>(this.whiteboardView.callbacks.on("onSizeUpdated",this.scaleDocsToFit),()=>this.whiteboardView.callbacks.off("onSizeUpdated",this.scaleDocsToFit))),this}getPageIndex(w){return(w>0?w:1)-1}unmount(){return this.slideController&&(this.slideController.destroy(),this.slideController=null),this.viewer.unmount(),this}setReadonly(w){this.viewer.setReadonly(w)}destroy(){this.sideEffect.flushAll(),this.unmount(),this.viewer.destroy()}toggleClickThrough(w){this.$whiteboardView.style.pointerEvents=!w||l_.has(w)?"none":"auto"}wrapClassName(w){return`${this.namespace}-${w}`}}const Ev=2,Im={map:new Map,queue:[],validateQueue(){for(Zo("[Slide] freezer: validate",this.queue);this.queue.length>Ev;){const F=this.queue.pop(),w=this.map.get(F);w&&(Zo("[Slide] freezer: validate-freeze",F,this.queue),w.freeze())}},set(F,w){Zo("[Slide] freezer: add",F,this.queue),this.map.set(F,w),this.queue.includes(F)||this.queue.unshift(F),this.validateQueue()},delete(F){Zo("[Slide] freezer: delete",F,this.queue),this.map.delete(F),this.queue=this.queue.filter(w=>w!==F)},focus(F){const w=this.map.get(F),S=this.queue.indexOf(F);S>-1&&this.queue.splice(S,1),this.queue.unshift(F),this.validateQueue(),Zo("[Slide] freezer: focus",F,this.queue),w&&w.unfreeze()}},h_=F=>{F.on("focus",({appId:w})=>{Im.focus(w)})};var Mv=`.netless-app-slide-content{position:relative;height:100%;overflow:hidden}.netless-app-slide-preview-mask{display:none;position:absolute;z-index:200;top:0;left:0;width:100%;height:100%}.netless-app-slide-preview{display:flex;flex-direction:column;align-items:center;position:absolute;z-index:300;top:0;left:0;width:33%;max-width:200px;height:100%;padding-top:10px;transform:translate(-100%);background:rgba(237,237,240,.9);box-shadow:inset -1px 0 #0000001c;transition:transform .4s}.netless-app-slide-preview-active .netless-app-slide-preview-mask{display:block}.netless-app-slide-preview-active .netless-app-slide-preview{transform:translate(0)}.netless-app-slide-preview-page{position:relative;display:block;width:55%;margin-bottom:10px;font-size:0;color:transparent;outline:none;border:7px solid transparent;border-radius:4px;transition:border-color .3s;user-select:none}.netless-app-slide-preview-page:hover,.netless-app-slide-preview-page.netless-app-slide-preview-page-active{border-color:#444e601a}.netless-app-slide-preview-page>img{width:100%;height:auto;box-sizing:border-box;border:1px solid rgba(0,0,0,.5);border-radius:1px;background-color:#fff;box-shadow:0 2px 8px #0000004d}.netless-app-slide-preview-page-name{position:absolute;top:1px;left:-10px;transform:translate(-100%);text-align:right;font-size:12px;color:#5f5f5f;user-select:none}.netless-app-slide-footer{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;border-top:1px solid #eeeef7;color:#191919}.netless-app-slide-float-footer{width:100%;min-height:26px;position:absolute;left:0;bottom:0;z-index:2000;background:rgba(249,249,252,.9);transition:opacity .4s}.netless-app-slide-footer-btn{box-sizing:border-box;width:26px;height:26px;font-size:0;margin:0;padding:3px;border:none;border-radius:1px;outline:none;color:currentColor;background:transparent;transition:background .4s;cursor:pointer;user-select:none}.netless-app-slide-footer-btn:hover{background:rgba(237,237,240,.9)}.netless-app-slide-footer-btn>svg{width:100%;height:100%}.netless-app-slide-footer-btn>svg:nth-of-type(2){display:none}.netless-app-slide-footer-btn.netless-app-slide-footer-btn-playing>svg:nth-of-type(1){display:none}.netless-app-slide-footer-btn.netless-app-slide-footer-btn-playing>svg:nth-of-type(2){display:initial}.netless-app-slide-footer-btn~.netless-app-slide-footer-btn{margin-left:15px}.netless-app-slide-page-jumps{flex:1;display:flex;justify-content:center;align-items:center}.netless-app-slide-page-number{margin-left:auto;font-size:13px;user-select:none;white-space:nowrap;word-break:keep-all}.netless-app-slide-page-number-input{border:none;outline:none;width:1.5em;text-align:right;border-radius:2px;color:currentColor;background:transparent;transition:background .4s;user-select:text}.netless-app-slide-page-number-input:hover,.netless-app-slide-page-number-input:focus,.netless-app-slide-page-number-input:active{background:#fff;box-shadow:#63636333 0 2px 8px}.netless-app-slide-readonly .netless-app-slide-footer-btn{cursor:not-allowed}.netless-app-slide-readonly .netless-app-slide-footer-btn:hover{background:transparent}.netless-app-slide-readonly .netless-app-slide-page-number-input{cursor:not-allowed}.netless-app-slide-readonly .netless-app-slide-page-number-input:hover,.netless-app-slide-readonly .netless-app-slide-page-number-input:focus,.netless-app-slide-readonly .netless-app-slide-page-number-input:active{background:transparent;box-shadow:none}.netless-app-slide-readonly .netless-app-slide-page-number-input:disabled{color:inherit}.netless-app-slide-readonly.netless-app-slide-float-footer{display:none}.netless-app-slide-wb-view{position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;overflow:hidden}.netless-app-slide-slide{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.netless-app-slide-slide canvas{transform:scale(var(--netless-app-slide-scale, 1))}
6079
+ `;function c_({container:F,taskId:w,url:S=sg,debug:W=!1}){if(!w)throw new Error("[Slide] taskId is required");F.style.cssText+="display:flex;flex-direction:column";const pt=new Av({target:F});return pt.debug=!!W,pt.mount(w,S),pt}class Av{constructor(w){this.slide=null,this.debug=!1,this.ready=!1,this.readyPromise=new Promise(S=>{this.resolveReady=()=>{this.ready=!0,S()}}),this.onPageChanged=S=>{this.viewer.setPageIndex(S-1)},this.onTransitionStart=()=>{this.viewer.setPlaying()},this.onTransitionEnd=()=>{this.viewer.setPaused()},this.onError=({error:S})=>{this.viewer.setPaused(),console.warn("[Slide] render error",S)},this.destroyed=!1,this.refreshPages=()=>{this.slide&&(this.viewer.pages=qg(this.slide),this.viewer.setPageIndex(this.getPageIndex(this.slide.slideCount)))},this.onPlay=()=>{this.slide&&this.slide.nextStep()},this.onNewPageIndex=S=>{this.slide&&this.slide.slideCount>0&&this.slide.renderSlide(kg(S+1,1,this.slide.slideCount))},this.namespace="netless-app-slide",this.target=w.target,this.bgColor=Xg(this.target),this.viewer=new Tv({readonly:!1,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlay}),this.render()}render(){this.viewer.$content.appendChild(this.renderSlideContainer())}mount(w,S){this.target.appendChild(this.renderStyle()),this.target.appendChild(this.viewer.$content),this.target.appendChild(this.viewer.$footer),this.slide=new ao.Slide({anchor:this.$slide,interactive:!1,mode:"local",resize:!0,controller:this.debug,renderOptions:{minFPS:25,maxFPS:30,autoFPS:!0,autoResolution:!0,transactionBgColor:this.bgColor}}),this.registerEventListeners(),this.slide.setResource(w,S),this.slide.renderSlide(1)}renderStyle(){const w=document.createElement("style");return w.appendChild(document.createTextNode(Mv)),w}registerEventListeners(){if(!this.slide)return;const{slide:w}=this;w.on(ao.SLIDE_EVENTS.slideChange,this.onPageChanged),w.on(ao.SLIDE_EVENTS.renderStart,this.onTransitionStart),w.on(ao.SLIDE_EVENTS.renderEnd,this.onTransitionEnd),w.on(ao.SLIDE_EVENTS.mainSeqStepStart,this.onTransitionStart),w.on(ao.SLIDE_EVENTS.mainSeqStepEnd,this.onTransitionEnd),w.on(ao.SLIDE_EVENTS.renderError,this.onError),w.on(ao.SLIDE_EVENTS.renderEnd,this.resolveReady),this.readyPromise.then(this.refreshPages)}destroy(){this.slide&&!this.destroyed&&(Zo("[Slide] destroy slide (once)"),this.slide.destroy(),this.destroyed=!0),this.viewer.destroy()}getPageIndex(w){return(w>0?w:1)-1}renderSlideContainer(){if(!this.$slide){const w=document.createElement("div");w.className=this.wrapClassName("slide"),w.dataset.appKind="Slide",this.$slide=w}return this.$slide}wrapClassName(w){return`${this.namespace}-${w}`}}const d_={kind:"Slide",setup(F){F.getIsWritable()&&zv(F,ag);const w=F.getAttributes();if(!(w==null?void 0:w.taskId))throw new Error("[Slide] no taskId");const S=F.getView();if(!S)throw new Error("[Slide] no view, please set scenePath on addApp()");S.disableCameraTransform=!0;const W=F.getBox();W.mountStyles(Mv);const pt=F.getInitScenePath();let lt=null;const J=$=>{const ut=F.getRoom();if(lt&&lt.slideController){let kt=!1;ut&&F.getIsWritable()&&(Kv(ut,F,lt.slideController.slide,pt),kt=!0),Zo("[Slide] page to",$,kt),lt.viewer.setPageIndex($-1)}},X=$=>{var kt,Gt;const ut=new t0(Gv(_p({context:F},$),{onPageChanged:J}));return Im.set(F.appId,ut),((kt=fu.apps)[Gt=F.appId]||(kt[Gt]={})).controller=ut,ut.readyPromise.then($.onReady),ut};lt=new u_({box:W,view:S,mountSlideController:X,mountWhiteboard:F.mountView.bind(F)});const ct=F.getRoom(),tt=new wm;tt.add(()=>{var $,ut,kt;return(($=fu.apps)[ut=F.appId]||($[ut]={})).context=F,fu.enable=((kt=F.getAppOptions())==null?void 0:kt.debug)||!1,fu.level="debug",()=>fu.dispose(F.appId)}),ct&&(lt.toggleClickThrough(ct.state.memberState.currentApplianceName),tt.add(()=>{const $=ut=>{ut.memberState&&lt&&lt.toggleClickThrough(ut.memberState.currentApplianceName)};return ct.callbacks.on("onRoomStateChanged",$),()=>ct.callbacks.off("onRoomStateChanged",$)})),F.emitter.on("destroy",()=>{Zo("[Slide]: destroy"),Im.delete(F.appId),tt.flushAll(),lt&&(lt.destroy(),lt=null)}),lt.mount()}};return wo.DefaultUrl=sg,wo.FreezerLength=Ev,wo.SlidePreviewer=Av,wo.addHooks=h_,wo.apps=Im,wo.default=d_,wo.previewSlide=c_,Object.defineProperty(wo,"__esModule",{value:!0}),wo[Symbol.toStringTag]="Module",wo}({});})();
6080
6080
  //# sourceMappingURL=main.iife.js.map