@aibee/crc-bmap 0.13.3 → 0.13.4
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/lib/index.cjs +1 -1
- package/lib/index.esm.min.js +1 -1
- package/lib/index.online.esm.min.js +1 -1
- package/lib/index.online.min.js +1 -1
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -8049,7 +8049,7 @@ void main() {
|
|
|
8049
8049
|
|
|
8050
8050
|
}\`,Ap=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,o){if(this.texture===null){let s=new Vi,u=t.properties.get(s);u.__webglTexture=e.texture,(e.depthNear!=o.depthNear||e.depthFar!=o.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=s}}render(t,e){if(this.texture!==null){if(this.mesh===null){let o=e.cameras[0].viewport,s=new wo({extensions:{fragDepth:!0},vertexShader:CT,fragmentShader:PT,uniforms:{depthColor:{value:this.texture},depthWidth:{value:o.z},depthHeight:{value:o.w}}});this.mesh=new ao(new qc(20,20),s)}t.render(this.mesh,e)}}reset(){this.texture=null,this.mesh=null}},Tp=class extends Ss{constructor(t,e){super();let o=this,s=null,u=1,c=null,h="local-floor",p=1,d=null,m=null,y=null,v=null,E=null,b=null,A=new Ap,_=e.getContextAttributes(),x=null,T=null,w=[],R=[],G=new qt,z=null,F=new Li;F.layers.enable(1),F.viewport=new zr;let I=new Li;I.layers.enable(2),I.viewport=new zr;let lt=[F,I],L=new bp;L.layers.enable(1),L.layers.enable(2);let W=null,V=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(et){let St=w[et];return St===void 0&&(St=new ol,w[et]=St),St.getTargetRaySpace()},this.getControllerGrip=function(et){let St=w[et];return St===void 0&&(St=new ol,w[et]=St),St.getGripSpace()},this.getHand=function(et){let St=w[et];return St===void 0&&(St=new ol,w[et]=St),St.getHandSpace()};function wt(et){let St=R.indexOf(et.inputSource);if(St===-1)return;let kt=w[St];kt!==void 0&&(kt.update(et.inputSource,et.frame,d||c),kt.dispatchEvent({type:et.type,data:et.inputSource}))}function Y(){s.removeEventListener("select",wt),s.removeEventListener("selectstart",wt),s.removeEventListener("selectend",wt),s.removeEventListener("squeeze",wt),s.removeEventListener("squeezestart",wt),s.removeEventListener("squeezeend",wt),s.removeEventListener("end",Y),s.removeEventListener("inputsourceschange",dt);for(let et=0;et<w.length;et++){let St=R[et];St!==null&&(R[et]=null,w[et].disconnect(St))}W=null,V=null,A.reset(),t.setRenderTarget(x),E=null,v=null,y=null,s=null,T=null,Kt.stop(),o.isPresenting=!1,t.setPixelRatio(z),t.setSize(G.width,G.height,!1),o.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(et){u=et,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(et){h=et,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||c},this.setReferenceSpace=function(et){d=et},this.getBaseLayer=function(){return v!==null?v:E},this.getBinding=function(){return y},this.getFrame=function(){return b},this.getSession=function(){return s},this.setSession=function(et){return Kl(this,null,function*(){if(s=et,s!==null){if(x=t.getRenderTarget(),s.addEventListener("select",wt),s.addEventListener("selectstart",wt),s.addEventListener("selectend",wt),s.addEventListener("squeeze",wt),s.addEventListener("squeezestart",wt),s.addEventListener("squeezeend",wt),s.addEventListener("end",Y),s.addEventListener("inputsourceschange",dt),_.xrCompatible!==!0&&(yield e.makeXRCompatible()),z=t.getPixelRatio(),t.getSize(G),s.renderState.layers===void 0||t.capabilities.isWebGL2===!1){let St={antialias:s.renderState.layers===void 0?_.antialias:!0,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:u};E=new XRWebGLLayer(s,e,St),s.updateRenderState({baseLayer:E}),t.setPixelRatio(1),t.setSize(E.framebufferWidth,E.framebufferHeight,!1),T=new jo(E.framebufferWidth,E.framebufferHeight,{format:so,type:Es,colorSpace:t.outputColorSpace,stencilBuffer:_.stencil})}else{let St=null,kt=null,Zt=null;_.depth&&(Zt=_.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,St=_.stencil?su:ia,kt=_.stencil?ra:vs);let Dt={colorFormat:e.RGBA8,depthFormat:Zt,scaleFactor:u};y=new XRWebGLBinding(s,e),v=y.createProjectionLayer(Dt),s.updateRenderState({layers:[v]}),t.setPixelRatio(1),t.setSize(v.textureWidth,v.textureHeight,!1),T=new jo(v.textureWidth,v.textureHeight,{format:so,type:Es,depthTexture:new Xc(v.textureWidth,v.textureHeight,kt,void 0,void 0,void 0,void 0,void 0,void 0,St),stencilBuffer:_.stencil,colorSpace:t.outputColorSpace,samples:_.antialias?4:0});let Bt=t.properties.get(T);Bt.__ignoreDepthValues=v.ignoreDepthValues}T.isXRRenderTarget=!0,this.setFoveation(p),d=null,c=yield s.requestReferenceSpace(h),Kt.setContext(s),Kt.start(),o.isPresenting=!0,o.dispatchEvent({type:"sessionstart"})}})},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode};function dt(et){for(let St=0;St<et.removed.length;St++){let kt=et.removed[St],Zt=R.indexOf(kt);Zt>=0&&(R[Zt]=null,w[Zt].disconnect(kt))}for(let St=0;St<et.added.length;St++){let kt=et.added[St],Zt=R.indexOf(kt);if(Zt===-1){for(let Bt=0;Bt<w.length;Bt++)if(Bt>=R.length){R.push(kt),Zt=Bt;break}else if(R[Bt]===null){R[Bt]=kt,Zt=Bt;break}if(Zt===-1)break}let Dt=w[Zt];Dt&&Dt.connect(kt)}}let ct=new st,yt=new st;function rt(et,St,kt){ct.setFromMatrixPosition(St.matrixWorld),yt.setFromMatrixPosition(kt.matrixWorld);let Zt=ct.distanceTo(yt),Dt=St.projectionMatrix.elements,Bt=kt.projectionMatrix.elements,Tt=Dt[14]/(Dt[10]-1),te=Dt[14]/(Dt[10]+1),Z=(Dt[9]+1)/Dt[5],Nt=(Dt[9]-1)/Dt[5],vt=(Dt[8]-1)/Dt[0],Lt=(Bt[8]+1)/Bt[0],Mt=Tt*vt,Ht=Tt*Lt,Xt=Zt/(-vt+Lt),Pt=Xt*-vt;St.matrixWorld.decompose(et.position,et.quaternion,et.scale),et.translateX(Pt),et.translateZ(Xt),et.matrixWorld.compose(et.position,et.quaternion,et.scale),et.matrixWorldInverse.copy(et.matrixWorld).invert();let ee=Tt+Xt,X=te+Xt,N=Mt-Pt,_t=Ht+(Zt-Pt),Et=Z*te/X*ee,it=Nt*te/X*ee;et.projectionMatrix.makePerspective(N,_t,Et,it,ee,X),et.projectionMatrixInverse.copy(et.projectionMatrix).invert()}function ut(et,St){St===null?et.matrixWorld.copy(et.matrix):et.matrixWorld.multiplyMatrices(St.matrixWorld,et.matrix),et.matrixWorldInverse.copy(et.matrixWorld).invert()}this.updateCamera=function(et){if(s===null)return;A.texture!==null&&(et.near=A.depthNear,et.far=A.depthFar),L.near=I.near=F.near=et.near,L.far=I.far=F.far=et.far,(W!==L.near||V!==L.far)&&(s.updateRenderState({depthNear:L.near,depthFar:L.far}),W=L.near,V=L.far,F.near=W,F.far=V,I.near=W,I.far=V,F.updateProjectionMatrix(),I.updateProjectionMatrix(),et.updateProjectionMatrix());let St=et.parent,kt=L.cameras;ut(L,St);for(let Zt=0;Zt<kt.length;Zt++)ut(kt[Zt],St);kt.length===2?rt(L,F,I):L.projectionMatrix.copy(F.projectionMatrix),q(et,L,St)};function q(et,St,kt){kt===null?et.matrix.copy(St.matrixWorld):(et.matrix.copy(kt.matrixWorld),et.matrix.invert(),et.matrix.multiply(St.matrixWorld)),et.matrix.decompose(et.position,et.quaternion,et.scale),et.updateMatrixWorld(!0),et.projectionMatrix.copy(St.projectionMatrix),et.projectionMatrixInverse.copy(St.projectionMatrixInverse),et.isPerspectiveCamera&&(et.fov=lp*2*Math.atan(1/et.projectionMatrix.elements[5]),et.zoom=1)}this.getCamera=function(){return L},this.getFoveation=function(){if(!(v===null&&E===null))return p},this.setFoveation=function(et){p=et,v!==null&&(v.fixedFoveation=et),E!==null&&E.fixedFoveation!==void 0&&(E.fixedFoveation=et)},this.hasDepthSensing=function(){return A.texture!==null};let bt=null;function Ct(et,St){if(m=St.getViewerPose(d||c),b=St,m!==null){let kt=m.views;E!==null&&(t.setRenderTargetFramebuffer(T,E.framebuffer),t.setRenderTarget(T));let Zt=!1;kt.length!==L.cameras.length&&(L.cameras.length=0,Zt=!0);for(let Bt=0;Bt<kt.length;Bt++){let Tt=kt[Bt],te=null;if(E!==null)te=E.getViewport(Tt);else{let Nt=y.getViewSubImage(v,Tt);te=Nt.viewport,Bt===0&&(t.setRenderTargetTextures(T,Nt.colorTexture,v.ignoreDepthValues?void 0:Nt.depthStencilTexture),t.setRenderTarget(T))}let Z=lt[Bt];Z===void 0&&(Z=new Li,Z.layers.enable(Bt),Z.viewport=new zr,lt[Bt]=Z),Z.matrix.fromArray(Tt.transform.matrix),Z.matrix.decompose(Z.position,Z.quaternion,Z.scale),Z.projectionMatrix.fromArray(Tt.projectionMatrix),Z.projectionMatrixInverse.copy(Z.projectionMatrix).invert(),Z.viewport.set(te.x,te.y,te.width,te.height),Bt===0&&(L.matrix.copy(Z.matrix),L.matrix.decompose(L.position,L.quaternion,L.scale)),Zt===!0&&L.cameras.push(Z)}let Dt=s.enabledFeatures;if(Dt&&Dt.includes("depth-sensing")){let Bt=y.getDepthInformation(kt[0]);Bt&&Bt.isValid&&Bt.texture&&A.init(t,Bt,s.renderState)}}for(let kt=0;kt<w.length;kt++){let Zt=R[kt],Dt=w[kt];Zt!==null&&Dt!==void 0&&Dt.update(Zt,St,d||c)}A.render(t,L),bt&&bt(et,St),St.detectedPlanes&&o.dispatchEvent({type:"planesdetected",data:St}),b=null}let Kt=new hy;Kt.setAnimationLoop(Ct),this.setAnimationLoop=function(et){bt=et},this.dispose=function(){}}},Js=new sa,IT=new er;function RT(r,t){function e(_,x){_.matrixAutoUpdate===!0&&_.updateMatrix(),x.value.copy(_.matrix)}function o(_,x){x.color.getRGB(_.fogColor.value,cy(r)),x.isFog?(_.fogNear.value=x.near,_.fogFar.value=x.far):x.isFogExp2&&(_.fogDensity.value=x.density)}function s(_,x,T,w,R){x.isMeshBasicMaterial||x.isMeshLambertMaterial?u(_,x):x.isMeshToonMaterial?(u(_,x),y(_,x)):x.isMeshPhongMaterial?(u(_,x),m(_,x)):x.isMeshStandardMaterial?(u(_,x),v(_,x),x.isMeshPhysicalMaterial&&E(_,x,R)):x.isMeshMatcapMaterial?(u(_,x),b(_,x)):x.isMeshDepthMaterial?u(_,x):x.isMeshDistanceMaterial?(u(_,x),A(_,x)):x.isMeshNormalMaterial?u(_,x):x.isLineBasicMaterial?(c(_,x),x.isLineDashedMaterial&&h(_,x)):x.isPointsMaterial?p(_,x,T,w):x.isSpriteMaterial?d(_,x):x.isShadowMaterial?(_.color.value.copy(x.color),_.opacity.value=x.opacity):x.isShaderMaterial&&(x.uniformsNeedUpdate=!1)}function u(_,x){_.opacity.value=x.opacity,x.color&&_.diffuse.value.copy(x.color),x.emissive&&_.emissive.value.copy(x.emissive).multiplyScalar(x.emissiveIntensity),x.map&&(_.map.value=x.map,e(x.map,_.mapTransform)),x.alphaMap&&(_.alphaMap.value=x.alphaMap,e(x.alphaMap,_.alphaMapTransform)),x.bumpMap&&(_.bumpMap.value=x.bumpMap,e(x.bumpMap,_.bumpMapTransform),_.bumpScale.value=x.bumpScale,x.side===xi&&(_.bumpScale.value*=-1)),x.normalMap&&(_.normalMap.value=x.normalMap,e(x.normalMap,_.normalMapTransform),_.normalScale.value.copy(x.normalScale),x.side===xi&&_.normalScale.value.negate()),x.displacementMap&&(_.displacementMap.value=x.displacementMap,e(x.displacementMap,_.displacementMapTransform),_.displacementScale.value=x.displacementScale,_.displacementBias.value=x.displacementBias),x.emissiveMap&&(_.emissiveMap.value=x.emissiveMap,e(x.emissiveMap,_.emissiveMapTransform)),x.specularMap&&(_.specularMap.value=x.specularMap,e(x.specularMap,_.specularMapTransform)),x.alphaTest>0&&(_.alphaTest.value=x.alphaTest);let T=t.get(x),w=T.envMap,R=T.envMapRotation;if(w&&(_.envMap.value=w,Js.copy(R),Js.x*=-1,Js.y*=-1,Js.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(Js.y*=-1,Js.z*=-1),_.envMapRotation.value.setFromMatrix4(IT.makeRotationFromEuler(Js)),_.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,_.reflectivity.value=x.reflectivity,_.ior.value=x.ior,_.refractionRatio.value=x.refractionRatio),x.lightMap){_.lightMap.value=x.lightMap;let G=r._useLegacyLights===!0?Math.PI:1;_.lightMapIntensity.value=x.lightMapIntensity*G,e(x.lightMap,_.lightMapTransform)}x.aoMap&&(_.aoMap.value=x.aoMap,_.aoMapIntensity.value=x.aoMapIntensity,e(x.aoMap,_.aoMapTransform))}function c(_,x){_.diffuse.value.copy(x.color),_.opacity.value=x.opacity,x.map&&(_.map.value=x.map,e(x.map,_.mapTransform))}function h(_,x){_.dashSize.value=x.dashSize,_.totalSize.value=x.dashSize+x.gapSize,_.scale.value=x.scale}function p(_,x,T,w){_.diffuse.value.copy(x.color),_.opacity.value=x.opacity,_.size.value=x.size*T,_.scale.value=w*.5,x.map&&(_.map.value=x.map,e(x.map,_.uvTransform)),x.alphaMap&&(_.alphaMap.value=x.alphaMap,e(x.alphaMap,_.alphaMapTransform)),x.alphaTest>0&&(_.alphaTest.value=x.alphaTest)}function d(_,x){_.diffuse.value.copy(x.color),_.opacity.value=x.opacity,_.rotation.value=x.rotation,x.map&&(_.map.value=x.map,e(x.map,_.mapTransform)),x.alphaMap&&(_.alphaMap.value=x.alphaMap,e(x.alphaMap,_.alphaMapTransform)),x.alphaTest>0&&(_.alphaTest.value=x.alphaTest)}function m(_,x){_.specular.value.copy(x.specular),_.shininess.value=Math.max(x.shininess,1e-4)}function y(_,x){x.gradientMap&&(_.gradientMap.value=x.gradientMap)}function v(_,x){_.metalness.value=x.metalness,x.metalnessMap&&(_.metalnessMap.value=x.metalnessMap,e(x.metalnessMap,_.metalnessMapTransform)),_.roughness.value=x.roughness,x.roughnessMap&&(_.roughnessMap.value=x.roughnessMap,e(x.roughnessMap,_.roughnessMapTransform)),t.get(x).envMap&&(_.envMapIntensity.value=x.envMapIntensity)}function E(_,x,T){_.ior.value=x.ior,x.sheen>0&&(_.sheenColor.value.copy(x.sheenColor).multiplyScalar(x.sheen),_.sheenRoughness.value=x.sheenRoughness,x.sheenColorMap&&(_.sheenColorMap.value=x.sheenColorMap,e(x.sheenColorMap,_.sheenColorMapTransform)),x.sheenRoughnessMap&&(_.sheenRoughnessMap.value=x.sheenRoughnessMap,e(x.sheenRoughnessMap,_.sheenRoughnessMapTransform))),x.clearcoat>0&&(_.clearcoat.value=x.clearcoat,_.clearcoatRoughness.value=x.clearcoatRoughness,x.clearcoatMap&&(_.clearcoatMap.value=x.clearcoatMap,e(x.clearcoatMap,_.clearcoatMapTransform)),x.clearcoatRoughnessMap&&(_.clearcoatRoughnessMap.value=x.clearcoatRoughnessMap,e(x.clearcoatRoughnessMap,_.clearcoatRoughnessMapTransform)),x.clearcoatNormalMap&&(_.clearcoatNormalMap.value=x.clearcoatNormalMap,e(x.clearcoatNormalMap,_.clearcoatNormalMapTransform),_.clearcoatNormalScale.value.copy(x.clearcoatNormalScale),x.side===xi&&_.clearcoatNormalScale.value.negate())),x.iridescence>0&&(_.iridescence.value=x.iridescence,_.iridescenceIOR.value=x.iridescenceIOR,_.iridescenceThicknessMinimum.value=x.iridescenceThicknessRange[0],_.iridescenceThicknessMaximum.value=x.iridescenceThicknessRange[1],x.iridescenceMap&&(_.iridescenceMap.value=x.iridescenceMap,e(x.iridescenceMap,_.iridescenceMapTransform)),x.iridescenceThicknessMap&&(_.iridescenceThicknessMap.value=x.iridescenceThicknessMap,e(x.iridescenceThicknessMap,_.iridescenceThicknessMapTransform))),x.transmission>0&&(_.transmission.value=x.transmission,_.transmissionSamplerMap.value=T.texture,_.transmissionSamplerSize.value.set(T.width,T.height),x.transmissionMap&&(_.transmissionMap.value=x.transmissionMap,e(x.transmissionMap,_.transmissionMapTransform)),_.thickness.value=x.thickness,x.thicknessMap&&(_.thicknessMap.value=x.thicknessMap,e(x.thicknessMap,_.thicknessMapTransform)),_.attenuationDistance.value=x.attenuationDistance,_.attenuationColor.value.copy(x.attenuationColor)),x.anisotropy>0&&(_.anisotropyVector.value.set(x.anisotropy*Math.cos(x.anisotropyRotation),x.anisotropy*Math.sin(x.anisotropyRotation)),x.anisotropyMap&&(_.anisotropyMap.value=x.anisotropyMap,e(x.anisotropyMap,_.anisotropyMapTransform))),_.specularIntensity.value=x.specularIntensity,_.specularColor.value.copy(x.specularColor),x.specularColorMap&&(_.specularColorMap.value=x.specularColorMap,e(x.specularColorMap,_.specularColorMapTransform)),x.specularIntensityMap&&(_.specularIntensityMap.value=x.specularIntensityMap,e(x.specularIntensityMap,_.specularIntensityMapTransform))}function b(_,x){x.matcap&&(_.matcap.value=x.matcap)}function A(_,x){let T=t.get(x).light;_.referencePosition.value.setFromMatrixPosition(T.matrixWorld),_.nearDistance.value=T.shadow.camera.near,_.farDistance.value=T.shadow.camera.far}return{refreshFogUniforms:o,refreshMaterialUniforms:s}}function LT(r,t,e,o){let s={},u={},c=[],h=e.isWebGL2?r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS):0;function p(T,w){let R=w.program;o.uniformBlockBinding(T,R)}function d(T,w){let R=s[T.id];R===void 0&&(b(T),R=m(T),s[T.id]=R,T.addEventListener("dispose",_));let G=w.program;o.updateUBOMapping(T,G);let z=t.render.frame;u[T.id]!==z&&(v(T),u[T.id]=z)}function m(T){let w=y();T.__bindingPointIndex=w;let R=r.createBuffer(),G=T.__size,z=T.usage;return r.bindBuffer(r.UNIFORM_BUFFER,R),r.bufferData(r.UNIFORM_BUFFER,G,z),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,w,R),R}function y(){for(let T=0;T<h;T++)if(c.indexOf(T)===-1)return c.push(T),T;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function v(T){let w=s[T.id],R=T.uniforms,G=T.__cache;r.bindBuffer(r.UNIFORM_BUFFER,w);for(let z=0,F=R.length;z<F;z++){let I=Array.isArray(R[z])?R[z]:[R[z]];for(let lt=0,L=I.length;lt<L;lt++){let W=I[lt];if(E(W,z,lt,G)===!0){let V=W.__offset,wt=Array.isArray(W.value)?W.value:[W.value],Y=0;for(let dt=0;dt<wt.length;dt++){let ct=wt[dt],yt=A(ct);typeof ct=="number"||typeof ct=="boolean"?(W.__data[0]=ct,r.bufferSubData(r.UNIFORM_BUFFER,V+Y,W.__data)):ct.isMatrix3?(W.__data[0]=ct.elements[0],W.__data[1]=ct.elements[1],W.__data[2]=ct.elements[2],W.__data[3]=0,W.__data[4]=ct.elements[3],W.__data[5]=ct.elements[4],W.__data[6]=ct.elements[5],W.__data[7]=0,W.__data[8]=ct.elements[6],W.__data[9]=ct.elements[7],W.__data[10]=ct.elements[8],W.__data[11]=0):(ct.toArray(W.__data,Y),Y+=yt.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,V,W.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function E(T,w,R,G){let z=T.value,F=w+"_"+R;if(G[F]===void 0)return typeof z=="number"||typeof z=="boolean"?G[F]=z:G[F]=z.clone(),!0;{let I=G[F];if(typeof z=="number"||typeof z=="boolean"){if(I!==z)return G[F]=z,!0}else if(I.equals(z)===!1)return I.copy(z),!0}return!1}function b(T){let w=T.uniforms,R=0,G=16;for(let F=0,I=w.length;F<I;F++){let lt=Array.isArray(w[F])?w[F]:[w[F]];for(let L=0,W=lt.length;L<W;L++){let V=lt[L],wt=Array.isArray(V.value)?V.value:[V.value];for(let Y=0,dt=wt.length;Y<dt;Y++){let ct=wt[Y],yt=A(ct),rt=R%G;rt!==0&&G-rt<yt.boundary&&(R+=G-rt),V.__data=new Float32Array(yt.storage/Float32Array.BYTES_PER_ELEMENT),V.__offset=R,R+=yt.storage}}}let z=R%G;return z>0&&(R+=G-z),T.__size=R,T.__cache={},this}function A(T){let w={boundary:0,storage:0};return typeof T=="number"||typeof T=="boolean"?(w.boundary=4,w.storage=4):T.isVector2?(w.boundary=8,w.storage=8):T.isVector3||T.isColor?(w.boundary=16,w.storage=12):T.isVector4?(w.boundary=16,w.storage=16):T.isMatrix3?(w.boundary=48,w.storage=48):T.isMatrix4?(w.boundary=64,w.storage=64):T.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",T),w}function _(T){let w=T.target;w.removeEventListener("dispose",_);let R=c.indexOf(w.__bindingPointIndex);c.splice(R,1),r.deleteBuffer(s[w.id]),delete s[w.id],delete u[w.id]}function x(){for(let T in s)r.deleteBuffer(s[T]);c=[],s={},u={}}return{bind:p,update:d,dispose:x}}var Cp=class{constructor(t={}){let{canvas:e=FM(),context:o=null,depth:s=!0,stencil:u=!0,alpha:c=!1,antialias:h=!1,premultipliedAlpha:p=!0,preserveDrawingBuffer:d=!1,powerPreference:m="default",failIfMajorPerformanceCaveat:y=!1}=t;this.isWebGLRenderer=!0;let v;o!==null?v=o.getContextAttributes().alpha:v=c;let E=new Uint32Array(4),b=new Int32Array(4),A=null,_=null,x=[],T=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=xo,this._useLegacyLights=!1,this.toneMapping=xs,this.toneMappingExposure=1;let w=this,R=!1,G=0,z=0,F=null,I=-1,lt=null,L=new zr,W=new zr,V=null,wt=new cn(0),Y=0,dt=e.width,ct=e.height,yt=1,rt=null,ut=null,q=new zr(0,0,dt,ct),bt=new zr(0,0,dt,ct),Ct=!1,Kt=new Vc,et=!1,St=!1,kt=null,Zt=new er,Dt=new qt,Bt=new st,Tt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function te(){return F===null?yt:1}let Z=o;function Nt(H,ot){for(let xt=0;xt<H.length;xt++){let pt=H[xt],at=e.getContext(pt,ot);if(at!==null)return at}return null}try{let H={alpha:!0,depth:s,stencil:u,antialias:h,premultipliedAlpha:p,preserveDrawingBuffer:d,powerPreference:m,failIfMajorPerformanceCaveat:y};if("setAttribute"in e&&e.setAttribute("data-engine",\`three.js r\${Kp}\`),e.addEventListener("webglcontextlost",ht,!1),e.addEventListener("webglcontextrestored",O,!1),e.addEventListener("webglcontextcreationerror",j,!1),Z===null){let ot=["webgl2","webgl","experimental-webgl"];if(w.isWebGL1Renderer===!0&&ot.shift(),Z=Nt(ot,H),Z===null)throw Nt(ot)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext!="undefined"&&Z instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),Z.getShaderPrecisionFormat===void 0&&(Z.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(H){throw console.error("THREE.WebGLRenderer: "+H.message),H}let vt,Lt,Mt,Ht,Xt,Pt,ee,X,N,_t,Et,it,Rt,le,It,Ft,Wt,J,S,P,D,k,B,nt;function Q(){vt=new Zb(Z),Lt=new Hb(Z,vt,t),vt.init(Lt),k=new AT(Z,vt,Lt),Mt=new ST(Z,vt,Lt),Ht=new Kb(Z),Xt=new fT,Pt=new bT(Z,vt,Mt,Xt,Lt,k,Ht),ee=new qb(w),X=new Yb(w),N=new rw(Z,Lt),B=new Gb(Z,vt,N,Lt),_t=new $b(Z,N,Ht,B),Et=new eA(Z,_t,N,Ht),S=new tA(Z,Lt,Pt),Ft=new Vb(Xt),it=new hT(w,ee,X,vt,Lt,B,Ft),Rt=new RT(w,Xt),le=new dT,It=new xT(vt,Lt),J=new zb(w,ee,X,Mt,Et,v,p),Wt=new wT(w,Et,Lt),nt=new LT(Z,Ht,Lt,Mt),P=new kb(Z,vt,Ht,Lt),D=new Jb(Z,vt,Ht,Lt),Ht.programs=it.programs,w.capabilities=Lt,w.extensions=vt,w.properties=Xt,w.renderLists=le,w.shadowMap=Wt,w.state=Mt,w.info=Ht}Q();let ft=new Tp(w,Z);this.xr=ft,this.getContext=function(){return Z},this.getContextAttributes=function(){return Z.getContextAttributes()},this.forceContextLoss=function(){let H=vt.get("WEBGL_lose_context");H&&H.loseContext()},this.forceContextRestore=function(){let H=vt.get("WEBGL_lose_context");H&&H.restoreContext()},this.getPixelRatio=function(){return yt},this.setPixelRatio=function(H){H!==void 0&&(yt=H,this.setSize(dt,ct,!1))},this.getSize=function(H){return H.set(dt,ct)},this.setSize=function(H,ot,xt=!0){if(ft.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}dt=H,ct=ot,e.width=Math.floor(H*yt),e.height=Math.floor(ot*yt),xt===!0&&(e.style.width=H+"px",e.style.height=ot+"px"),this.setViewport(0,0,H,ot)},this.getDrawingBufferSize=function(H){return H.set(dt*yt,ct*yt).floor()},this.setDrawingBufferSize=function(H,ot,xt){dt=H,ct=ot,yt=xt,e.width=Math.floor(H*xt),e.height=Math.floor(ot*xt),this.setViewport(0,0,H,ot)},this.getCurrentViewport=function(H){return H.copy(L)},this.getViewport=function(H){return H.copy(q)},this.setViewport=function(H,ot,xt,pt){H.isVector4?q.set(H.x,H.y,H.z,H.w):q.set(H,ot,xt,pt),Mt.viewport(L.copy(q).multiplyScalar(yt).round())},this.getScissor=function(H){return H.copy(bt)},this.setScissor=function(H,ot,xt,pt){H.isVector4?bt.set(H.x,H.y,H.z,H.w):bt.set(H,ot,xt,pt),Mt.scissor(W.copy(bt).multiplyScalar(yt).round())},this.getScissorTest=function(){return Ct},this.setScissorTest=function(H){Mt.setScissorTest(Ct=H)},this.setOpaqueSort=function(H){rt=H},this.setTransparentSort=function(H){ut=H},this.getClearColor=function(H){return H.copy(J.getClearColor())},this.setClearColor=function(){J.setClearColor.apply(J,arguments)},this.getClearAlpha=function(){return J.getClearAlpha()},this.setClearAlpha=function(){J.setClearAlpha.apply(J,arguments)},this.clear=function(H=!0,ot=!0,xt=!0){let pt=0;if(H){let at=!1;if(F!==null){let jt=F.texture.format;at=jt===iy||jt===ry||jt===ny}if(at){let jt=F.texture.type,Qt=jt===Es||jt===vs||jt===jp||jt===ra||jt===ty||jt===ey,ue=J.getClearColor(),ne=J.getClearAlpha(),ye=ue.r,ce=ue.g,he=ue.b;Qt?(E[0]=ye,E[1]=ce,E[2]=he,E[3]=ne,Z.clearBufferuiv(Z.COLOR,0,E)):(b[0]=ye,b[1]=ce,b[2]=he,b[3]=ne,Z.clearBufferiv(Z.COLOR,0,b))}else pt|=Z.COLOR_BUFFER_BIT}ot&&(pt|=Z.DEPTH_BUFFER_BIT),xt&&(pt|=Z.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Z.clear(pt)},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(){e.removeEventListener("webglcontextlost",ht,!1),e.removeEventListener("webglcontextrestored",O,!1),e.removeEventListener("webglcontextcreationerror",j,!1),le.dispose(),It.dispose(),Xt.dispose(),ee.dispose(),X.dispose(),Et.dispose(),B.dispose(),nt.dispose(),it.dispose(),Wt.dispose(),ft.dispose(),ft.removeEventListener("sessionstart",Me),ft.removeEventListener("sessionend",ge),kt&&(kt.dispose(),kt=null),Se.stop()};function ht(H){H.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),R=!0}function O(){console.log("THREE.WebGLRenderer: Context Restored."),R=!1;let H=Ht.autoReset,ot=Wt.enabled,xt=Wt.autoUpdate,pt=Wt.needsUpdate,at=Wt.type;Q(),Ht.autoReset=H,Wt.enabled=ot,Wt.autoUpdate=xt,Wt.needsUpdate=pt,Wt.type=at}function j(H){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",H.statusMessage)}function $(H){let ot=H.target;ot.removeEventListener("dispose",$),tt(ot)}function tt(H){At(H),Xt.remove(H)}function At(H){let ot=Xt.get(H).programs;ot!==void 0&&(ot.forEach(function(xt){it.releaseProgram(xt)}),H.isShaderMaterial&&it.releaseShaderCache(H))}this.renderBufferDirect=function(H,ot,xt,pt,at,jt){ot===null&&(ot=Tt);let Qt=at.isMesh&&at.matrixWorld.determinant()<0,ue=xn(H,ot,xt,pt,at);Mt.setMaterial(pt,Qt);let ne=xt.index,ye=1;if(pt.wireframe===!0){if(ne=_t.getWireframeAttribute(xt),ne===void 0)return;ye=2}let ce=xt.drawRange,he=xt.attributes.position,un=ce.start*ye,xr=(ce.start+ce.count)*ye;jt!==null&&(un=Math.max(un,jt.start*ye),xr=Math.min(xr,(jt.start+jt.count)*ye)),ne!==null?(un=Math.max(un,0),xr=Math.min(xr,ne.count)):he!=null&&(un=Math.max(un,0),xr=Math.min(xr,he.count));let Bn=xr-un;if(Bn<0||Bn===1/0)return;B.setup(at,pt,ue,xt,ne);let ei,En=P;if(ne!==null&&(ei=N.get(ne),En=D,En.setIndex(ei)),at.isMesh)pt.wireframe===!0?(Mt.setLineWidth(pt.wireframeLinewidth*te()),En.setMode(Z.LINES)):En.setMode(Z.TRIANGLES);else if(at.isLine){let oe=pt.linewidth;oe===void 0&&(oe=1),Mt.setLineWidth(oe*te()),at.isLineSegments?En.setMode(Z.LINES):at.isLineLoop?En.setMode(Z.LINE_LOOP):En.setMode(Z.LINE_STRIP)}else at.isPoints?En.setMode(Z.POINTS):at.isSprite&&En.setMode(Z.TRIANGLES);if(at.isBatchedMesh)En.renderMultiDraw(at._multiDrawStarts,at._multiDrawCounts,at._multiDrawCount);else if(at.isInstancedMesh)En.renderInstances(un,Bn,at.count);else if(xt.isInstancedBufferGeometry){let oe=xt._maxInstanceCount!==void 0?xt._maxInstanceCount:1/0,xa=Math.min(xt.instanceCount,oe);En.renderInstances(un,Bn,xa)}else En.render(un,Bn)};function zt(H,ot,xt){H.transparent===!0&&H.side===Zo&&H.forceSinglePass===!1?(H.side=xi,H.needsUpdate=!0,_n(H,ot,xt),H.side=ws,H.needsUpdate=!0,_n(H,ot,xt),H.side=Zo):_n(H,ot,xt)}this.compile=function(H,ot,xt=null){xt===null&&(xt=H),_=It.get(xt),_.init(),T.push(_),xt.traverseVisible(function(at){at.isLight&&at.layers.test(ot.layers)&&(_.pushLight(at),at.castShadow&&_.pushShadow(at))}),H!==xt&&H.traverseVisible(function(at){at.isLight&&at.layers.test(ot.layers)&&(_.pushLight(at),at.castShadow&&_.pushShadow(at))}),_.setupLights(w._useLegacyLights);let pt=new Set;return H.traverse(function(at){let jt=at.material;if(jt)if(Array.isArray(jt))for(let Qt=0;Qt<jt.length;Qt++){let ue=jt[Qt];zt(ue,xt,at),pt.add(ue)}else zt(jt,xt,at),pt.add(jt)}),T.pop(),_=null,pt},this.compileAsync=function(H,ot,xt=null){let pt=this.compile(H,ot,xt);return new Promise(at=>{function jt(){if(pt.forEach(function(Qt){Xt.get(Qt).currentProgram.isReady()&&pt.delete(Qt)}),pt.size===0){at(H);return}setTimeout(jt,10)}vt.get("KHR_parallel_shader_compile")!==null?jt():setTimeout(jt,10)})};let re=null;function ie(H){re&&re(H)}function Me(){Se.stop()}function ge(){Se.start()}let Se=new hy;Se.setAnimationLoop(ie),typeof self!="undefined"&&Se.setContext(self),this.setAnimationLoop=function(H){re=H,ft.setAnimationLoop(H),H===null?Se.stop():Se.start()},ft.addEventListener("sessionstart",Me),ft.addEventListener("sessionend",ge),this.render=function(H,ot){if(ot!==void 0&&ot.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(R===!0)return;H.matrixWorldAutoUpdate===!0&&H.updateMatrixWorld(),ot.parent===null&&ot.matrixWorldAutoUpdate===!0&&ot.updateMatrixWorld(),ft.enabled===!0&&ft.isPresenting===!0&&(ft.cameraAutoUpdate===!0&&ft.updateCamera(ot),ot=ft.getCamera()),H.isScene===!0&&H.onBeforeRender(w,H,ot,F),_=It.get(H,T.length),_.init(),T.push(_),Zt.multiplyMatrices(ot.projectionMatrix,ot.matrixWorldInverse),Kt.setFromProjectionMatrix(Zt),St=this.localClippingEnabled,et=Ft.init(this.clippingPlanes,St),A=le.get(H,x.length),A.init(),x.push(A),be(H,ot,0,w.sortObjects),A.finish(),w.sortObjects===!0&&A.sort(rt,ut),this.info.render.frame++,et===!0&&Ft.beginShadows();let xt=_.state.shadowsArray;if(Wt.render(xt,H,ot),et===!0&&Ft.endShadows(),this.info.autoReset===!0&&this.info.reset(),(ft.enabled===!1||ft.isPresenting===!1||ft.hasDepthSensing()===!1)&&J.render(A,H),_.setupLights(w._useLegacyLights),ot.isArrayCamera){let pt=ot.cameras;for(let at=0,jt=pt.length;at<jt;at++){let Qt=pt[at];Ln(A,H,Qt,Qt.viewport)}}else Ln(A,H,ot);F!==null&&(Pt.updateMultisampleRenderTarget(F),Pt.updateRenderTargetMipmap(F)),H.isScene===!0&&H.onAfterRender(w,H,ot),B.resetDefaultState(),I=-1,lt=null,T.pop(),T.length>0?_=T[T.length-1]:_=null,x.pop(),x.length>0?A=x[x.length-1]:A=null};function be(H,ot,xt,pt){if(H.visible===!1)return;if(H.layers.test(ot.layers)){if(H.isGroup)xt=H.renderOrder;else if(H.isLOD)H.autoUpdate===!0&&H.update(ot);else if(H.isLight)_.pushLight(H),H.castShadow&&_.pushShadow(H);else if(H.isSprite){if(!H.frustumCulled||Kt.intersectsSprite(H)){pt&&Bt.setFromMatrixPosition(H.matrixWorld).applyMatrix4(Zt);let Qt=Et.update(H),ue=H.material;ue.visible&&A.push(H,Qt,ue,xt,Bt.z,null)}}else if((H.isMesh||H.isLine||H.isPoints)&&(!H.frustumCulled||Kt.intersectsObject(H))){let Qt=Et.update(H),ue=H.material;if(pt&&(H.boundingSphere!==void 0?(H.boundingSphere===null&&H.computeBoundingSphere(),Bt.copy(H.boundingSphere.center)):(Qt.boundingSphere===null&&Qt.computeBoundingSphere(),Bt.copy(Qt.boundingSphere.center)),Bt.applyMatrix4(H.matrixWorld).applyMatrix4(Zt)),Array.isArray(ue)){let ne=Qt.groups;for(let ye=0,ce=ne.length;ye<ce;ye++){let he=ne[ye],un=ue[he.materialIndex];un&&un.visible&&A.push(H,Qt,un,xt,Bt.z,he)}}else ue.visible&&A.push(H,Qt,ue,xt,Bt.z,null)}}let jt=H.children;for(let Qt=0,ue=jt.length;Qt<ue;Qt++)be(jt[Qt],ot,xt,pt)}function Ln(H,ot,xt,pt){let at=H.opaque,jt=H.transmissive,Qt=H.transparent;_.setupLightsView(xt),et===!0&&Ft.setGlobalState(w.clippingPlanes,xt),jt.length>0&&lr(at,jt,ot,xt),pt&&Mt.viewport(L.copy(pt)),at.length>0&&vn(at,ot,xt),jt.length>0&&vn(jt,ot,xt),Qt.length>0&&vn(Qt,ot,xt),Mt.buffers.depth.setTest(!0),Mt.buffers.depth.setMask(!0),Mt.buffers.color.setMask(!0),Mt.setPolygonOffset(!1)}function lr(H,ot,xt,pt){if((xt.isScene===!0?xt.overrideMaterial:null)!==null)return;let jt=Lt.isWebGL2;kt===null&&(kt=new jo(1,1,{generateMipmaps:!0,type:vt.has("EXT_color_buffer_half_float")?ul:Es,minFilter:ta,samples:jt?4:0})),w.getDrawingBufferSize(Dt),jt?kt.setSize(Dt.x,Dt.y):kt.setSize(cp(Dt.x),cp(Dt.y));let Qt=w.getRenderTarget();w.setRenderTarget(kt),w.getClearColor(wt),Y=w.getClearAlpha(),Y<1&&w.setClearColor(16777215,.5),w.clear();let ue=w.toneMapping;w.toneMapping=xs,vn(H,xt,pt),Pt.updateMultisampleRenderTarget(kt),Pt.updateRenderTargetMipmap(kt);let ne=!1;for(let ye=0,ce=ot.length;ye<ce;ye++){let he=ot[ye],un=he.object,xr=he.geometry,Bn=he.material,ei=he.group;if(Bn.side===Zo&&un.layers.test(pt.layers)){let En=Bn.side;Bn.side=xi,Bn.needsUpdate=!0,fe(un,xt,pt,xr,Bn,ei),Bn.side=En,Bn.needsUpdate=!0,ne=!0}}ne===!0&&(Pt.updateMultisampleRenderTarget(kt),Pt.updateRenderTargetMipmap(kt)),w.setRenderTarget(Qt),w.setClearColor(wt,Y),w.toneMapping=ue}function vn(H,ot,xt){let pt=ot.isScene===!0?ot.overrideMaterial:null;for(let at=0,jt=H.length;at<jt;at++){let Qt=H[at],ue=Qt.object,ne=Qt.geometry,ye=pt===null?Qt.material:pt,ce=Qt.group;ue.layers.test(xt.layers)&&fe(ue,ot,xt,ne,ye,ce)}}function fe(H,ot,xt,pt,at,jt){H.onBeforeRender(w,ot,xt,pt,at,jt),H.modelViewMatrix.multiplyMatrices(xt.matrixWorldInverse,H.matrixWorld),H.normalMatrix.getNormalMatrix(H.modelViewMatrix),at.onBeforeRender(w,ot,xt,pt,H,jt),at.transparent===!0&&at.side===Zo&&at.forceSinglePass===!1?(at.side=xi,at.needsUpdate=!0,w.renderBufferDirect(xt,ot,pt,at,H,jt),at.side=ws,at.needsUpdate=!0,w.renderBufferDirect(xt,ot,pt,at,H,jt),at.side=Zo):w.renderBufferDirect(xt,ot,pt,at,H,jt),H.onAfterRender(w,ot,xt,pt,at,jt)}function _n(H,ot,xt){ot.isScene!==!0&&(ot=Tt);let pt=Xt.get(H),at=_.state.lights,jt=_.state.shadowsArray,Qt=at.state.version,ue=it.getParameters(H,at.state,jt,ot,xt),ne=it.getProgramCacheKey(ue),ye=pt.programs;pt.environment=H.isMeshStandardMaterial?ot.environment:null,pt.fog=ot.fog,pt.envMap=(H.isMeshStandardMaterial?X:ee).get(H.envMap||pt.environment),pt.envMapRotation=pt.environment!==null&&H.envMap===null?ot.environmentRotation:H.envMapRotation,ye===void 0&&(H.addEventListener("dispose",$),ye=new Map,pt.programs=ye);let ce=ye.get(ne);if(ce!==void 0){if(pt.currentProgram===ce&&pt.lightsStateVersion===Qt)return bn(H,ue),ce}else ue.uniforms=it.getUniforms(H),H.onBuild(xt,ue,w),H.onBeforeCompile(ue,w),ce=it.acquireProgram(ue,ne),ye.set(ne,ce),pt.uniforms=ue.uniforms;let he=pt.uniforms;return(!H.isShaderMaterial&&!H.isRawShaderMaterial||H.clipping===!0)&&(he.clippingPlanes=Ft.uniform),bn(H,ue),pt.needsLights=_r(H),pt.lightsStateVersion=Qt,pt.needsLights&&(he.ambientLightColor.value=at.state.ambient,he.lightProbe.value=at.state.probe,he.directionalLights.value=at.state.directional,he.directionalLightShadows.value=at.state.directionalShadow,he.spotLights.value=at.state.spot,he.spotLightShadows.value=at.state.spotShadow,he.rectAreaLights.value=at.state.rectArea,he.ltc_1.value=at.state.rectAreaLTC1,he.ltc_2.value=at.state.rectAreaLTC2,he.pointLights.value=at.state.point,he.pointLightShadows.value=at.state.pointShadow,he.hemisphereLights.value=at.state.hemi,he.directionalShadowMap.value=at.state.directionalShadowMap,he.directionalShadowMatrix.value=at.state.directionalShadowMatrix,he.spotShadowMap.value=at.state.spotShadowMap,he.spotLightMatrix.value=at.state.spotLightMatrix,he.spotLightMap.value=at.state.spotLightMap,he.pointShadowMap.value=at.state.pointShadowMap,he.pointShadowMatrix.value=at.state.pointShadowMatrix),pt.currentProgram=ce,pt.uniformsList=null,ce}function Pn(H){if(H.uniformsList===null){let ot=H.currentProgram.getUniforms();H.uniformsList=ru.seqWithValue(ot.seq,H.uniforms)}return H.uniformsList}function bn(H,ot){let xt=Xt.get(H);xt.outputColorSpace=ot.outputColorSpace,xt.batching=ot.batching,xt.instancing=ot.instancing,xt.instancingColor=ot.instancingColor,xt.instancingMorph=ot.instancingMorph,xt.skinning=ot.skinning,xt.morphTargets=ot.morphTargets,xt.morphNormals=ot.morphNormals,xt.morphColors=ot.morphColors,xt.morphTargetsCount=ot.morphTargetsCount,xt.numClippingPlanes=ot.numClippingPlanes,xt.numIntersection=ot.numClipIntersection,xt.vertexAlphas=ot.vertexAlphas,xt.vertexTangents=ot.vertexTangents,xt.toneMapping=ot.toneMapping}function xn(H,ot,xt,pt,at){ot.isScene!==!0&&(ot=Tt),Pt.resetTextureUnits();let jt=ot.fog,Qt=pt.isMeshStandardMaterial?ot.environment:null,ue=F===null?w.outputColorSpace:F.isXRRenderTarget===!0?F.texture.colorSpace:bs,ne=(pt.isMeshStandardMaterial?X:ee).get(pt.envMap||Qt),ye=pt.vertexColors===!0&&!!xt.attributes.color&&xt.attributes.color.itemSize===4,ce=!!xt.attributes.tangent&&(!!pt.normalMap||pt.anisotropy>0),he=!!xt.morphAttributes.position,un=!!xt.morphAttributes.normal,xr=!!xt.morphAttributes.color,Bn=xs;pt.toneMapped&&(F===null||F.isXRRenderTarget===!0)&&(Bn=w.toneMapping);let ei=xt.morphAttributes.position||xt.morphAttributes.normal||xt.morphAttributes.color,En=ei!==void 0?ei.length:0,oe=Xt.get(pt),xa=_.state.lights;if(et===!0&&(St===!0||H!==lt)){let ni=H===lt&&pt.id===I;Ft.setState(pt,H,ni)}let ln=!1;pt.version===oe.__version?(oe.needsLights&&oe.lightsStateVersion!==xa.state.version||oe.outputColorSpace!==ue||at.isBatchedMesh&&oe.batching===!1||!at.isBatchedMesh&&oe.batching===!0||at.isInstancedMesh&&oe.instancing===!1||!at.isInstancedMesh&&oe.instancing===!0||at.isSkinnedMesh&&oe.skinning===!1||!at.isSkinnedMesh&&oe.skinning===!0||at.isInstancedMesh&&oe.instancingColor===!0&&at.instanceColor===null||at.isInstancedMesh&&oe.instancingColor===!1&&at.instanceColor!==null||at.isInstancedMesh&&oe.instancingMorph===!0&&at.morphTexture===null||at.isInstancedMesh&&oe.instancingMorph===!1&&at.morphTexture!==null||oe.envMap!==ne||pt.fog===!0&&oe.fog!==jt||oe.numClippingPlanes!==void 0&&(oe.numClippingPlanes!==Ft.numPlanes||oe.numIntersection!==Ft.numIntersection)||oe.vertexAlphas!==ye||oe.vertexTangents!==ce||oe.morphTargets!==he||oe.morphNormals!==un||oe.morphColors!==xr||oe.toneMapping!==Bn||Lt.isWebGL2===!0&&oe.morphTargetsCount!==En)&&(ln=!0):(ln=!0,oe.__version=pt.version);let Wi=oe.currentProgram;ln===!0&&(Wi=_n(pt,ot,at));let Bu=!1,ve=!1,Ns=!1,Mn=Wi.getUniforms(),Xi=oe.uniforms;if(Mt.useProgram(Wi.program)&&(Bu=!0,ve=!0,Ns=!0),pt.id!==I&&(I=pt.id,ve=!0),Bu||lt!==H){Mn.setValue(Z,"projectionMatrix",H.projectionMatrix),Mn.setValue(Z,"viewMatrix",H.matrixWorldInverse);let ni=Mn.map.cameraPosition;ni!==void 0&&ni.setValue(Z,Bt.setFromMatrixPosition(H.matrixWorld)),Lt.logarithmicDepthBuffer&&Mn.setValue(Z,"logDepthBufFC",2/(Math.log(H.far+1)/Math.LN2)),(pt.isMeshPhongMaterial||pt.isMeshToonMaterial||pt.isMeshLambertMaterial||pt.isMeshBasicMaterial||pt.isMeshStandardMaterial||pt.isShaderMaterial)&&Mn.setValue(Z,"isOrthographic",H.isOrthographicCamera===!0),lt!==H&&(lt=H,ve=!0,Ns=!0)}if(at.isSkinnedMesh){Mn.setOptional(Z,at,"bindMatrix"),Mn.setOptional(Z,at,"bindMatrixInverse");let ni=at.skeleton;ni&&(Lt.floatVertexTextures?(ni.boneTexture===null&&ni.computeBoneTexture(),Mn.setValue(Z,"boneTexture",ni.boneTexture,Pt)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}at.isBatchedMesh&&(Mn.setOptional(Z,at,"batchingTexture"),Mn.setValue(Z,"batchingTexture",at._matricesTexture,Pt));let me=xt.morphAttributes;if((me.position!==void 0||me.normal!==void 0||me.color!==void 0&&Lt.isWebGL2===!0)&&S.update(at,xt,Wi),(ve||oe.receiveShadow!==at.receiveShadow)&&(oe.receiveShadow=at.receiveShadow,Mn.setValue(Z,"receiveShadow",at.receiveShadow)),pt.isMeshGouraudMaterial&&pt.envMap!==null&&(Xi.envMap.value=ne,Xi.flipEnvMap.value=ne.isCubeTexture&&ne.isRenderTargetTexture===!1?-1:1),ve&&(Mn.setValue(Z,"toneMappingExposure",w.toneMappingExposure),oe.needsLights&&Wr(Xi,Ns),jt&&pt.fog===!0&&Rt.refreshFogUniforms(Xi,jt),Rt.refreshMaterialUniforms(Xi,pt,yt,ct,kt),ru.upload(Z,Pn(oe),Xi,Pt)),pt.isShaderMaterial&&pt.uniformsNeedUpdate===!0&&(ru.upload(Z,Pn(oe),Xi,Pt),pt.uniformsNeedUpdate=!1),pt.isSpriteMaterial&&Mn.setValue(Z,"center",at.center),Mn.setValue(Z,"modelViewMatrix",at.modelViewMatrix),Mn.setValue(Z,"normalMatrix",at.normalMatrix),Mn.setValue(Z,"modelMatrix",at.matrixWorld),pt.isShaderMaterial||pt.isRawShaderMaterial){let ni=pt.uniformsGroups;for(let zu=0,Ea=ni.length;zu<Ea;zu++)if(Lt.isWebGL2){let ri=ni[zu];nt.update(ri,Wi),nt.bind(ri,Wi)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return Wi}function Wr(H,ot){H.ambientLightColor.needsUpdate=ot,H.lightProbe.needsUpdate=ot,H.directionalLights.needsUpdate=ot,H.directionalLightShadows.needsUpdate=ot,H.pointLights.needsUpdate=ot,H.pointLightShadows.needsUpdate=ot,H.spotLights.needsUpdate=ot,H.spotLightShadows.needsUpdate=ot,H.rectAreaLights.needsUpdate=ot,H.hemisphereLights.needsUpdate=ot}function _r(H){return H.isMeshLambertMaterial||H.isMeshToonMaterial||H.isMeshPhongMaterial||H.isMeshStandardMaterial||H.isShadowMaterial||H.isShaderMaterial&&H.lights===!0}this.getActiveCubeFace=function(){return G},this.getActiveMipmapLevel=function(){return z},this.getRenderTarget=function(){return F},this.setRenderTargetTextures=function(H,ot,xt){Xt.get(H.texture).__webglTexture=ot,Xt.get(H.depthTexture).__webglTexture=xt;let pt=Xt.get(H);pt.__hasExternalTextures=!0,pt.__autoAllocateDepthBuffer=xt===void 0,pt.__autoAllocateDepthBuffer||vt.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),pt.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(H,ot){let xt=Xt.get(H);xt.__webglFramebuffer=ot,xt.__useDefaultFramebuffer=ot===void 0},this.setRenderTarget=function(H,ot=0,xt=0){F=H,G=ot,z=xt;let pt=!0,at=null,jt=!1,Qt=!1;if(H){let ne=Xt.get(H);ne.__useDefaultFramebuffer!==void 0?(Mt.bindFramebuffer(Z.FRAMEBUFFER,null),pt=!1):ne.__webglFramebuffer===void 0?Pt.setupRenderTarget(H):ne.__hasExternalTextures&&Pt.rebindTextures(H,Xt.get(H.texture).__webglTexture,Xt.get(H.depthTexture).__webglTexture);let ye=H.texture;(ye.isData3DTexture||ye.isDataArrayTexture||ye.isCompressedArrayTexture)&&(Qt=!0);let ce=Xt.get(H).__webglFramebuffer;H.isWebGLCubeRenderTarget?(Array.isArray(ce[ot])?at=ce[ot][xt]:at=ce[ot],jt=!0):Lt.isWebGL2&&H.samples>0&&Pt.useMultisampledRTT(H)===!1?at=Xt.get(H).__webglMultisampledFramebuffer:Array.isArray(ce)?at=ce[xt]:at=ce,L.copy(H.viewport),W.copy(H.scissor),V=H.scissorTest}else L.copy(q).multiplyScalar(yt).floor(),W.copy(bt).multiplyScalar(yt).floor(),V=Ct;if(Mt.bindFramebuffer(Z.FRAMEBUFFER,at)&&Lt.drawBuffers&&pt&&Mt.drawBuffers(H,at),Mt.viewport(L),Mt.scissor(W),Mt.setScissorTest(V),jt){let ne=Xt.get(H.texture);Z.framebufferTexture2D(Z.FRAMEBUFFER,Z.COLOR_ATTACHMENT0,Z.TEXTURE_CUBE_MAP_POSITIVE_X+ot,ne.__webglTexture,xt)}else if(Qt){let ne=Xt.get(H.texture),ye=ot||0;Z.framebufferTextureLayer(Z.FRAMEBUFFER,Z.COLOR_ATTACHMENT0,ne.__webglTexture,xt||0,ye)}I=-1},this.readRenderTargetPixels=function(H,ot,xt,pt,at,jt,Qt){if(!(H&&H.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ue=Xt.get(H).__webglFramebuffer;if(H.isWebGLCubeRenderTarget&&Qt!==void 0&&(ue=ue[Qt]),ue){Mt.bindFramebuffer(Z.FRAMEBUFFER,ue);try{let ne=H.texture,ye=ne.format,ce=ne.type;if(ye!==so&&k.convert(ye)!==Z.getParameter(Z.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let he=ce===ul&&(vt.has("EXT_color_buffer_half_float")||Lt.isWebGL2&&vt.has("EXT_color_buffer_float"));if(ce!==Es&&k.convert(ce)!==Z.getParameter(Z.IMPLEMENTATION_COLOR_READ_TYPE)&&!(ce===$o&&(Lt.isWebGL2||vt.has("OES_texture_float")||vt.has("WEBGL_color_buffer_float")))&&!he){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ot>=0&&ot<=H.width-pt&&xt>=0&&xt<=H.height-at&&Z.readPixels(ot,xt,pt,at,k.convert(ye),k.convert(ce),jt)}finally{let ne=F!==null?Xt.get(F).__webglFramebuffer:null;Mt.bindFramebuffer(Z.FRAMEBUFFER,ne)}}},this.copyFramebufferToTexture=function(H,ot,xt=0){let pt=Math.pow(2,-xt),at=Math.floor(ot.image.width*pt),jt=Math.floor(ot.image.height*pt);Pt.setTexture2D(ot,0),Z.copyTexSubImage2D(Z.TEXTURE_2D,xt,0,0,H.x,H.y,at,jt),Mt.unbindTexture()},this.copyTextureToTexture=function(H,ot,xt,pt=0){let at=ot.image.width,jt=ot.image.height,Qt=k.convert(xt.format),ue=k.convert(xt.type);Pt.setTexture2D(xt,0),Z.pixelStorei(Z.UNPACK_FLIP_Y_WEBGL,xt.flipY),Z.pixelStorei(Z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,xt.premultiplyAlpha),Z.pixelStorei(Z.UNPACK_ALIGNMENT,xt.unpackAlignment),ot.isDataTexture?Z.texSubImage2D(Z.TEXTURE_2D,pt,H.x,H.y,at,jt,Qt,ue,ot.image.data):ot.isCompressedTexture?Z.compressedTexSubImage2D(Z.TEXTURE_2D,pt,H.x,H.y,ot.mipmaps[0].width,ot.mipmaps[0].height,Qt,ot.mipmaps[0].data):Z.texSubImage2D(Z.TEXTURE_2D,pt,H.x,H.y,Qt,ue,ot.image),pt===0&&xt.generateMipmaps&&Z.generateMipmap(Z.TEXTURE_2D),Mt.unbindTexture()},this.copyTextureToTexture3D=function(H,ot,xt,pt,at=0){if(w.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let jt=Math.round(H.max.x-H.min.x),Qt=Math.round(H.max.y-H.min.y),ue=H.max.z-H.min.z+1,ne=k.convert(pt.format),ye=k.convert(pt.type),ce;if(pt.isData3DTexture)Pt.setTexture3D(pt,0),ce=Z.TEXTURE_3D;else if(pt.isDataArrayTexture||pt.isCompressedArrayTexture)Pt.setTexture2DArray(pt,0),ce=Z.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}Z.pixelStorei(Z.UNPACK_FLIP_Y_WEBGL,pt.flipY),Z.pixelStorei(Z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,pt.premultiplyAlpha),Z.pixelStorei(Z.UNPACK_ALIGNMENT,pt.unpackAlignment);let he=Z.getParameter(Z.UNPACK_ROW_LENGTH),un=Z.getParameter(Z.UNPACK_IMAGE_HEIGHT),xr=Z.getParameter(Z.UNPACK_SKIP_PIXELS),Bn=Z.getParameter(Z.UNPACK_SKIP_ROWS),ei=Z.getParameter(Z.UNPACK_SKIP_IMAGES),En=xt.isCompressedTexture?xt.mipmaps[at]:xt.image;Z.pixelStorei(Z.UNPACK_ROW_LENGTH,En.width),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,En.height),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,H.min.x),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,H.min.y),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,H.min.z),xt.isDataTexture||xt.isData3DTexture?Z.texSubImage3D(ce,at,ot.x,ot.y,ot.z,jt,Qt,ue,ne,ye,En.data):pt.isCompressedArrayTexture?Z.compressedTexSubImage3D(ce,at,ot.x,ot.y,ot.z,jt,Qt,ue,ne,En.data):Z.texSubImage3D(ce,at,ot.x,ot.y,ot.z,jt,Qt,ue,ne,ye,En),Z.pixelStorei(Z.UNPACK_ROW_LENGTH,he),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,un),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,xr),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,Bn),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,ei),at===0&&pt.generateMipmaps&&Z.generateMipmap(ce),Mt.unbindTexture()},this.initTexture=function(H){H.isCubeTexture?Pt.setTextureCube(H,0):H.isData3DTexture?Pt.setTexture3D(H,0):H.isDataArrayTexture||H.isCompressedArrayTexture?Pt.setTexture2DArray(H,0):Pt.setTexture2D(H,0),Mt.unbindTexture()},this.resetState=function(){G=0,z=0,F=null,Mt.reset(),B.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Jo}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=t===Qp?"display-p3":"srgb",e.unpackColorSpace=Tn.workingColorSpace===Qc?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(t){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=t}},Pp=class extends Cp{};Pp.prototype.isWebGL1Renderer=!0;var Yc=class{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=t!==void 0?t.length/e:0,this.usage=ap,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=Ko()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return uy("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}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,e,o){t*=this.stride,o*=e.stride;for(let s=0,u=this.stride;s<u;s++)this.array[t+s]=e.array[o+s];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Ko()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),o=new this.constructor(e,this.stride);return o.setUsage(this.usage),o}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=Ko()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}},ci=new st,hl=class r{constructor(t,e,o,s=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=o,this.normalized=s}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,o=this.data.count;e<o;e++)ci.fromBufferAttribute(this,e),ci.applyMatrix4(t),this.setXYZ(e,ci.x,ci.y,ci.z);return this}applyNormalMatrix(t){for(let e=0,o=this.count;e<o;e++)ci.fromBufferAttribute(this,e),ci.applyNormalMatrix(t),this.setXYZ(e,ci.x,ci.y,ci.z);return this}transformDirection(t){for(let e=0,o=this.count;e<o;e++)ci.fromBufferAttribute(this,e),ci.transformDirection(t),this.setXYZ(e,ci.x,ci.y,ci.z);return this}getComponent(t,e){let o=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(o=Mo(o,this.array)),o}setComponent(t,e,o){return this.normalized&&(o=An(o,this.array)),this.data.array[t*this.data.stride+this.offset+e]=o,this}setX(t,e){return this.normalized&&(e=An(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=An(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=An(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=An(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=Mo(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=Mo(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=Mo(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=Mo(e,this.array)),e}setXY(t,e,o){return t=t*this.data.stride+this.offset,this.normalized&&(e=An(e,this.array),o=An(o,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=o,this}setXYZ(t,e,o,s){return t=t*this.data.stride+this.offset,this.normalized&&(e=An(e,this.array),o=An(o,this.array),s=An(s,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=o,this.data.array[t+2]=s,this}setXYZW(t,e,o,s,u){return t=t*this.data.stride+this.offset,this.normalized&&(e=An(e,this.array),o=An(o,this.array),s=An(s,this.array),u=An(u,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=o,this.data.array[t+2]=s,this.data.array[t+3]=u,this}clone(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let o=0;o<this.count;o++){let s=o*this.data.stride+this.offset;for(let u=0;u<this.itemSize;u++)e.push(this.data.array[s+u])}return new qn(new this.array.constructor(e),this.itemSize,this.normalized)}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new r(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let o=0;o<this.count;o++){let s=o*this.data.stride+this.offset;for(let u=0;u<this.itemSize;u++)e.push(this.data.array[s+u])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}else 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}}},Ip=class extends aa{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new cn(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!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.fog=t.fog,this}},gs,nl=new st,$a=new st,Ja=new st,Ka=new qt,rl=new qt,yy=new er,_c=new st,il=new st,xc=new st,q0=new qt,Kf=new qt,W0=new qt,Rp=class extends uo{constructor(t=new Ip){if(super(),this.isSprite=!0,this.type="Sprite",gs===void 0){gs=new Ei;let e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),o=new Yc(e,5);gs.setIndex([0,1,2,0,2,3]),gs.setAttribute("position",new hl(o,3,0,!1)),gs.setAttribute("uv",new hl(o,2,3,!1))}this.geometry=gs,this.material=t,this.center=new qt(.5,.5)}raycast(t,e){t.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),$a.setFromMatrixScale(this.matrixWorld),yy.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),Ja.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&$a.multiplyScalar(-Ja.z);let o=this.material.rotation,s,u;o!==0&&(u=Math.cos(o),s=Math.sin(o));let c=this.center;Ec(_c.set(-.5,-.5,0),Ja,c,$a,s,u),Ec(il.set(.5,-.5,0),Ja,c,$a,s,u),Ec(xc.set(.5,.5,0),Ja,c,$a,s,u),q0.set(0,0),Kf.set(1,0),W0.set(1,1);let h=t.ray.intersectTriangle(_c,il,xc,!1,nl);if(h===null&&(Ec(il.set(-.5,.5,0),Ja,c,$a,s,u),Kf.set(0,1),h=t.ray.intersectTriangle(_c,xc,il,!1,nl),h===null))return;let p=t.ray.origin.distanceTo(nl);p<t.near||p>t.far||e.push({distance:p,point:nl.clone(),uv:ea.getInterpolation(nl,_c,il,xc,q0,Kf,W0,new qt),face:null,object:this})}copy(t,e){return super.copy(t,e),t.center!==void 0&&this.center.copy(t.center),this.material=t.material,this}};Rp.Dispose=function(){gs.dispose(),gs=void 0};function Ec(r,t,e,o,s,u){Ka.subVectors(r,e).addScalar(.5).multiply(o),s!==void 0?(rl.x=u*Ka.x-s*Ka.y,rl.y=s*Ka.x+u*Ka.y):rl.copy(Ka),r.copy(t),r.x+=rl.x,r.y+=rl.y,r.applyMatrix4(yy)}var qi=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){let o=this.getUtoTmapping(t);return this.getPoint(o,e)}getPoints(t=5){let e=[];for(let o=0;o<=t;o++)e.push(this.getPoint(o/t));return e}getSpacedPoints(t=5){let e=[];for(let o=0;o<=t;o++)e.push(this.getPointAt(o/t));return e}getLength(){let 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;let e=[],o,s=this.getPoint(0),u=0;e.push(0);for(let c=1;c<=t;c++)o=this.getPoint(c/t),u+=o.distanceTo(s),e.push(u),s=o;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){let o=this.getLengths(),s=0,u=o.length,c;e?c=e:c=t*o[u-1];let h=0,p=u-1,d;for(;h<=p;)if(s=Math.floor(h+(p-h)/2),d=o[s]-c,d<0)h=s+1;else if(d>0)p=s-1;else{p=s;break}if(s=p,o[s]===c)return s/(u-1);let m=o[s],v=o[s+1]-m,E=(c-m)/v;return(s+E)/(u-1)}getTangent(t,e){let s=t-1e-4,u=t+1e-4;s<0&&(s=0),u>1&&(u=1);let c=this.getPoint(s),h=this.getPoint(u),p=e||(c.isVector2?new qt:new st);return p.copy(h).sub(c).normalize(),p}getTangentAt(t,e){let o=this.getUtoTmapping(t);return this.getTangent(o,e)}computeFrenetFrames(t,e){let o=new st,s=[],u=[],c=[],h=new st,p=new er;for(let E=0;E<=t;E++){let b=E/t;s[E]=this.getTangentAt(b,new st)}u[0]=new st,c[0]=new st;let d=Number.MAX_VALUE,m=Math.abs(s[0].x),y=Math.abs(s[0].y),v=Math.abs(s[0].z);m<=d&&(d=m,o.set(1,0,0)),y<=d&&(d=y,o.set(0,1,0)),v<=d&&o.set(0,0,1),h.crossVectors(s[0],o).normalize(),u[0].crossVectors(s[0],h),c[0].crossVectors(s[0],u[0]);for(let E=1;E<=t;E++){if(u[E]=u[E-1].clone(),c[E]=c[E-1].clone(),h.crossVectors(s[E-1],s[E]),h.length()>Number.EPSILON){h.normalize();let b=Math.acos(jr(s[E-1].dot(s[E]),-1,1));u[E].applyMatrix4(p.makeRotationAxis(h,b))}c[E].crossVectors(s[E],u[E])}if(e===!0){let E=Math.acos(jr(u[0].dot(u[t]),-1,1));E/=t,s[0].dot(h.crossVectors(u[0],u[t]))>0&&(E=-E);for(let b=1;b<=t;b++)u[b].applyMatrix4(p.makeRotationAxis(s[b],E*b)),c[b].crossVectors(s[b],u[b])}return{tangents:s,normals:u,binormals:c}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){let t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}},fl=class extends qi{constructor(t=0,e=0,o=1,s=1,u=0,c=Math.PI*2,h=!1,p=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=o,this.yRadius=s,this.aStartAngle=u,this.aEndAngle=c,this.aClockwise=h,this.aRotation=p}getPoint(t,e=new qt){let o=e,s=Math.PI*2,u=this.aEndAngle-this.aStartAngle,c=Math.abs(u)<Number.EPSILON;for(;u<0;)u+=s;for(;u>s;)u-=s;u<Number.EPSILON&&(c?u=0:u=s),this.aClockwise===!0&&!c&&(u===s?u=-s:u=u-s);let h=this.aStartAngle+t*u,p=this.aX+this.xRadius*Math.cos(h),d=this.aY+this.yRadius*Math.sin(h);if(this.aRotation!==0){let m=Math.cos(this.aRotation),y=Math.sin(this.aRotation),v=p-this.aX,E=d-this.aY;p=v*m-E*y+this.aX,d=v*y+E*m+this.aY}return o.set(p,d)}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(){let 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}},Lp=class extends fl{constructor(t,e,o,s,u,c){super(t,e,o,o,s,u,c),this.isArcCurve=!0,this.type="ArcCurve"}};function ed(){let r=0,t=0,e=0,o=0;function s(u,c,h,p){r=u,t=h,e=-3*u+3*c-2*h-p,o=2*u-2*c+h+p}return{initCatmullRom:function(u,c,h,p,d){s(c,h,d*(h-u),d*(p-c))},initNonuniformCatmullRom:function(u,c,h,p,d,m,y){let v=(c-u)/d-(h-u)/(d+m)+(h-c)/m,E=(h-c)/m-(p-c)/(m+y)+(p-h)/y;v*=m,E*=m,s(c,h,v,E)},calc:function(u){let c=u*u,h=c*u;return r+t*u+e*c+o*h}}}var Mc=new st,jf=new ed,Qf=new ed,tp=new ed,Np=class extends qi{constructor(t=[],e=!1,o="centripetal",s=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=o,this.tension=s}getPoint(t,e=new st){let o=e,s=this.points,u=s.length,c=(u-(this.closed?0:1))*t,h=Math.floor(c),p=c-h;this.closed?h+=h>0?0:(Math.floor(Math.abs(h)/u)+1)*u:p===0&&h===u-1&&(h=u-2,p=1);let d,m;this.closed||h>0?d=s[(h-1)%u]:(Mc.subVectors(s[0],s[1]).add(s[0]),d=Mc);let y=s[h%u],v=s[(h+1)%u];if(this.closed||h+2<u?m=s[(h+2)%u]:(Mc.subVectors(s[u-1],s[u-2]).add(s[u-1]),m=Mc),this.curveType==="centripetal"||this.curveType==="chordal"){let E=this.curveType==="chordal"?.5:.25,b=Math.pow(d.distanceToSquared(y),E),A=Math.pow(y.distanceToSquared(v),E),_=Math.pow(v.distanceToSquared(m),E);A<1e-4&&(A=1),b<1e-4&&(b=A),_<1e-4&&(_=A),jf.initNonuniformCatmullRom(d.x,y.x,v.x,m.x,b,A,_),Qf.initNonuniformCatmullRom(d.y,y.y,v.y,m.y,b,A,_),tp.initNonuniformCatmullRom(d.z,y.z,v.z,m.z,b,A,_)}else this.curveType==="catmullrom"&&(jf.initCatmullRom(d.x,y.x,v.x,m.x,this.tension),Qf.initCatmullRom(d.y,y.y,v.y,m.y,this.tension),tp.initCatmullRom(d.z,y.z,v.z,m.z,this.tension));return o.set(jf.calc(p),Qf.calc(p),tp.calc(p)),o}copy(t){super.copy(t),this.points=[];for(let e=0,o=t.points.length;e<o;e++){let s=t.points[e];this.points.push(s.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){let t=super.toJSON();t.points=[];for(let e=0,o=this.points.length;e<o;e++){let s=this.points[e];t.points.push(s.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,o=t.points.length;e<o;e++){let s=t.points[e];this.points.push(new st().fromArray(s))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}};function X0(r,t,e,o,s){let u=(o-t)*.5,c=(s-e)*.5,h=r*r,p=r*h;return(2*e-2*o+u+c)*p+(-3*e+3*o-2*u-c)*h+u*r+e}function NT(r,t){let e=1-r;return e*e*t}function OT(r,t){return 2*(1-r)*r*t}function DT(r,t){return r*r*t}function sl(r,t,e,o){return NT(r,t)+OT(r,e)+DT(r,o)}function FT(r,t){let e=1-r;return e*e*e*t}function UT(r,t){let e=1-r;return 3*e*e*r*t}function BT(r,t){return 3*(1-r)*r*r*t}function zT(r,t){return r*r*r*t}function al(r,t,e,o,s){return FT(r,t)+UT(r,e)+BT(r,o)+zT(r,s)}var Zc=class extends qi{constructor(t=new qt,e=new qt,o=new qt,s=new qt){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=o,this.v3=s}getPoint(t,e=new qt){let o=e,s=this.v0,u=this.v1,c=this.v2,h=this.v3;return o.set(al(t,s.x,u.x,c.x,h.x),al(t,s.y,u.y,c.y,h.y)),o}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(){let 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}},Op=class extends qi{constructor(t=new st,e=new st,o=new st,s=new st){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=o,this.v3=s}getPoint(t,e=new st){let o=e,s=this.v0,u=this.v1,c=this.v2,h=this.v3;return o.set(al(t,s.x,u.x,c.x,h.x),al(t,s.y,u.y,c.y,h.y),al(t,s.z,u.z,c.z,h.z)),o}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(){let 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}},$c=class extends qi{constructor(t=new qt,e=new qt){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new qt){let o=e;return t===1?o.copy(this.v2):(o.copy(this.v2).sub(this.v1),o.multiplyScalar(t).add(this.v1)),o}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new qt){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let 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}},Dp=class extends qi{constructor(t=new st,e=new st){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new st){let o=e;return t===1?o.copy(this.v2):(o.copy(this.v2).sub(this.v1),o.multiplyScalar(t).add(this.v1)),o}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new st){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let 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}},Jc=class extends qi{constructor(t=new qt,e=new qt,o=new qt){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=o}getPoint(t,e=new qt){let o=e,s=this.v0,u=this.v1,c=this.v2;return o.set(sl(t,s.x,u.x,c.x),sl(t,s.y,u.y,c.y)),o}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let 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}},Fp=class extends qi{constructor(t=new st,e=new st,o=new st){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=o}getPoint(t,e=new st){let o=e,s=this.v0,u=this.v1,c=this.v2;return o.set(sl(t,s.x,u.x,c.x),sl(t,s.y,u.y,c.y),sl(t,s.z,u.z,c.z)),o}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let 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}},Kc=class extends qi{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new qt){let o=e,s=this.points,u=(s.length-1)*t,c=Math.floor(u),h=u-c,p=s[c===0?c:c-1],d=s[c],m=s[c>s.length-2?s.length-1:c+1],y=s[c>s.length-3?s.length-1:c+2];return o.set(X0(h,p.x,d.x,m.x,y.x),X0(h,p.y,d.y,m.y,y.y)),o}copy(t){super.copy(t),this.points=[];for(let e=0,o=t.points.length;e<o;e++){let s=t.points[e];this.points.push(s.clone())}return this}toJSON(){let t=super.toJSON();t.points=[];for(let e=0,o=this.points.length;e<o;e++){let s=this.points[e];t.points.push(s.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,o=t.points.length;e<o;e++){let s=t.points[e];this.points.push(new qt().fromArray(s))}return this}},Up=Object.freeze({__proto__:null,ArcCurve:Lp,CatmullRomCurve3:Np,CubicBezierCurve:Zc,CubicBezierCurve3:Op,EllipseCurve:fl,LineCurve:$c,LineCurve3:Dp,QuadraticBezierCurve:Jc,QuadraticBezierCurve3:Fp,SplineCurve:Kc}),Bp=class extends qi{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){let t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){let o=t.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Up[o](e,t))}return this}getPoint(t,e){let o=t*this.getLength(),s=this.getCurveLengths(),u=0;for(;u<s.length;){if(s[u]>=o){let c=s[u]-o,h=this.curves[u],p=h.getLength(),d=p===0?0:1-c/p;return h.getPointAt(d,e)}u++}return null}getLength(){let 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;let t=[],e=0;for(let o=0,s=this.curves.length;o<s;o++)e+=this.curves[o].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){let e=[];for(let o=0;o<=t;o++)e.push(this.getPoint(o/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){let e=[],o;for(let s=0,u=this.curves;s<u.length;s++){let c=u[s],h=c.isEllipseCurve?t*2:c.isLineCurve||c.isLineCurve3?1:c.isSplineCurve?t*c.points.length:t,p=c.getPoints(h);for(let d=0;d<p.length;d++){let m=p[d];o&&o.equals(m)||(e.push(m),o=m)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,o=t.curves.length;e<o;e++){let s=t.curves[e];this.curves.push(s.clone())}return this.autoClose=t.autoClose,this}toJSON(){let t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,o=this.curves.length;e<o;e++){let s=this.curves[e];t.curves.push(s.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,o=t.curves.length;e<o;e++){let s=t.curves[e];this.curves.push(new Up[s.type]().fromJSON(s))}return this}},uu=class extends Bp{constructor(t){super(),this.type="Path",this.currentPoint=new qt,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,o=t.length;e<o;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){let o=new $c(this.currentPoint.clone(),new qt(t,e));return this.curves.push(o),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,o,s){let u=new Jc(this.currentPoint.clone(),new qt(t,e),new qt(o,s));return this.curves.push(u),this.currentPoint.set(o,s),this}bezierCurveTo(t,e,o,s,u,c){let h=new Zc(this.currentPoint.clone(),new qt(t,e),new qt(o,s),new qt(u,c));return this.curves.push(h),this.currentPoint.set(u,c),this}splineThru(t){let e=[this.currentPoint.clone()].concat(t),o=new Kc(e);return this.curves.push(o),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,o,s,u,c){let h=this.currentPoint.x,p=this.currentPoint.y;return this.absarc(t+h,e+p,o,s,u,c),this}absarc(t,e,o,s,u,c){return this.absellipse(t,e,o,o,s,u,c),this}ellipse(t,e,o,s,u,c,h,p){let d=this.currentPoint.x,m=this.currentPoint.y;return this.absellipse(t+d,e+m,o,s,u,c,h,p),this}absellipse(t,e,o,s,u,c,h,p){let d=new fl(t,e,o,s,u,c,h,p);if(this.curves.length>0){let y=d.getPoint(0);y.equals(this.currentPoint)||this.lineTo(y.x,y.y)}this.curves.push(d);let m=d.getPoint(1);return this.currentPoint.copy(m),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){let t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}};var lu=class extends uu{constructor(t){super(t),this.uuid=Ko(),this.type="Shape",this.holes=[]}getPointsHoles(t){let e=[];for(let o=0,s=this.holes.length;o<s;o++)e[o]=this.holes[o].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,o=t.holes.length;e<o;e++){let s=t.holes[e];this.holes.push(s.clone())}return this}toJSON(){let t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,o=this.holes.length;e<o;e++){let s=this.holes[e];t.holes.push(s.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,o=t.holes.length;e<o;e++){let s=t.holes[e];this.holes.push(new uu().fromJSON(s))}return this}},GT={triangulate:function(r,t,e=2){let o=t&&t.length,s=o?t[0]*e:r.length,u=vy(r,0,s,e,!0),c=[];if(!u||u.next===u.prev)return c;let h,p,d,m,y,v,E;if(o&&(u=WT(r,t,u,e)),r.length>80*e){h=d=r[0],p=m=r[1];for(let b=e;b<s;b+=e)y=r[b],v=r[b+1],y<h&&(h=y),v<p&&(p=v),y>d&&(d=y),v>m&&(m=v);E=Math.max(d-h,m-p),E=E!==0?32767/E:0}return pl(u,c,e,h,p,E,0),c}};function vy(r,t,e,o,s){let u,c;if(s===nC(r,t,e,o)>0)for(u=t;u<e;u+=o)c=Y0(u,r[u],r[u+1],c);else for(u=e-o;u>=t;u-=o)c=Y0(u,r[u],r[u+1],c);return c&&eh(c,c.next)&&(ml(c),c=c.next),c}function ua(r,t){if(!r)return r;t||(t=r);let e=r,o;do if(o=!1,!e.steiner&&(eh(e,e.next)||Xn(e.prev,e,e.next)===0)){if(ml(e),e=t=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==t);return t}function pl(r,t,e,o,s,u,c){if(!r)return;!c&&u&&JT(r,o,s,u);let h=r,p,d;for(;r.prev!==r.next;){if(p=r.prev,d=r.next,u?HT(r,o,s,u):kT(r)){t.push(p.i/e|0),t.push(r.i/e|0),t.push(d.i/e|0),ml(r),r=d.next,h=d.next;continue}if(r=d,r===h){c?c===1?(r=VT(ua(r),t,e),pl(r,t,e,o,s,u,2)):c===2&&qT(r,t,e,o,s,u):pl(ua(r),t,e,o,s,u,1);break}}}function kT(r){let t=r.prev,e=r,o=r.next;if(Xn(t,e,o)>=0)return!1;let s=t.x,u=e.x,c=o.x,h=t.y,p=e.y,d=o.y,m=s<u?s<c?s:c:u<c?u:c,y=h<p?h<d?h:d:p<d?p:d,v=s>u?s>c?s:c:u>c?u:c,E=h>p?h>d?h:d:p>d?p:d,b=o.next;for(;b!==t;){if(b.x>=m&&b.x<=v&&b.y>=y&&b.y<=E&&tu(s,h,u,p,c,d,b.x,b.y)&&Xn(b.prev,b,b.next)>=0)return!1;b=b.next}return!0}function HT(r,t,e,o){let s=r.prev,u=r,c=r.next;if(Xn(s,u,c)>=0)return!1;let h=s.x,p=u.x,d=c.x,m=s.y,y=u.y,v=c.y,E=h<p?h<d?h:d:p<d?p:d,b=m<y?m<v?m:v:y<v?y:v,A=h>p?h>d?h:d:p>d?p:d,_=m>y?m>v?m:v:y>v?y:v,x=zp(E,b,t,e,o),T=zp(A,_,t,e,o),w=r.prevZ,R=r.nextZ;for(;w&&w.z>=x&&R&&R.z<=T;){if(w.x>=E&&w.x<=A&&w.y>=b&&w.y<=_&&w!==s&&w!==c&&tu(h,m,p,y,d,v,w.x,w.y)&&Xn(w.prev,w,w.next)>=0||(w=w.prevZ,R.x>=E&&R.x<=A&&R.y>=b&&R.y<=_&&R!==s&&R!==c&&tu(h,m,p,y,d,v,R.x,R.y)&&Xn(R.prev,R,R.next)>=0))return!1;R=R.nextZ}for(;w&&w.z>=x;){if(w.x>=E&&w.x<=A&&w.y>=b&&w.y<=_&&w!==s&&w!==c&&tu(h,m,p,y,d,v,w.x,w.y)&&Xn(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;R&&R.z<=T;){if(R.x>=E&&R.x<=A&&R.y>=b&&R.y<=_&&R!==s&&R!==c&&tu(h,m,p,y,d,v,R.x,R.y)&&Xn(R.prev,R,R.next)>=0)return!1;R=R.nextZ}return!0}function VT(r,t,e){let o=r;do{let s=o.prev,u=o.next.next;!eh(s,u)&&_y(s,o,o.next,u)&&dl(s,u)&&dl(u,s)&&(t.push(s.i/e|0),t.push(o.i/e|0),t.push(u.i/e|0),ml(o),ml(o.next),o=r=u),o=o.next}while(o!==r);return ua(o)}function qT(r,t,e,o,s,u){let c=r;do{let h=c.next.next;for(;h!==c.prev;){if(c.i!==h.i&&QT(c,h)){let p=xy(c,h);c=ua(c,c.next),p=ua(p,p.next),pl(c,t,e,o,s,u,0),pl(p,t,e,o,s,u,0);return}h=h.next}c=c.next}while(c!==r)}function WT(r,t,e,o){let s=[],u,c,h,p,d;for(u=0,c=t.length;u<c;u++)h=t[u]*o,p=u<c-1?t[u+1]*o:r.length,d=vy(r,h,p,o,!1),d===d.next&&(d.steiner=!0),s.push(jT(d));for(s.sort(XT),u=0;u<s.length;u++)e=YT(s[u],e);return e}function XT(r,t){return r.x-t.x}function YT(r,t){let e=ZT(r,t);if(!e)return t;let o=xy(e,r);return ua(o,o.next),ua(e,e.next)}function ZT(r,t){let e=t,o=-1/0,s,u=r.x,c=r.y;do{if(c<=e.y&&c>=e.next.y&&e.next.y!==e.y){let v=e.x+(c-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(v<=u&&v>o&&(o=v,s=e.x<e.next.x?e:e.next,v===u))return s}e=e.next}while(e!==t);if(!s)return null;let h=s,p=s.x,d=s.y,m=1/0,y;e=s;do u>=e.x&&e.x>=p&&u!==e.x&&tu(c<d?u:o,c,p,d,c<d?o:u,c,e.x,e.y)&&(y=Math.abs(c-e.y)/(u-e.x),dl(e,r)&&(y<m||y===m&&(e.x>s.x||e.x===s.x&&$T(s,e)))&&(s=e,m=y)),e=e.next;while(e!==h);return s}function $T(r,t){return Xn(r.prev,r,t.prev)<0&&Xn(t.next,r,r.next)<0}function JT(r,t,e,o){let s=r;do s.z===0&&(s.z=zp(s.x,s.y,t,e,o)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==r);s.prevZ.nextZ=null,s.prevZ=null,KT(s)}function KT(r){let t,e,o,s,u,c,h,p,d=1;do{for(e=r,r=null,u=null,c=0;e;){for(c++,o=e,h=0,t=0;t<d&&(h++,o=o.nextZ,!!o);t++);for(p=d;h>0||p>0&&o;)h!==0&&(p===0||!o||e.z<=o.z)?(s=e,e=e.nextZ,h--):(s=o,o=o.nextZ,p--),u?u.nextZ=s:r=s,s.prevZ=u,u=s;e=o}u.nextZ=null,d*=2}while(c>1);return r}function zp(r,t,e,o,s){return r=(r-e)*s|0,t=(t-o)*s|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function jT(r){let t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function tu(r,t,e,o,s,u,c,h){return(s-c)*(t-h)>=(r-c)*(u-h)&&(r-c)*(o-h)>=(e-c)*(t-h)&&(e-c)*(u-h)>=(s-c)*(o-h)}function QT(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!tC(r,t)&&(dl(r,t)&&dl(t,r)&&eC(r,t)&&(Xn(r.prev,r,t.prev)||Xn(r,t.prev,t))||eh(r,t)&&Xn(r.prev,r,r.next)>0&&Xn(t.prev,t,t.next)>0)}function Xn(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function eh(r,t){return r.x===t.x&&r.y===t.y}function _y(r,t,e,o){let s=Sc(Xn(r,t,e)),u=Sc(Xn(r,t,o)),c=Sc(Xn(e,o,r)),h=Sc(Xn(e,o,t));return!!(s!==u&&c!==h||s===0&&wc(r,e,t)||u===0&&wc(r,o,t)||c===0&&wc(e,r,o)||h===0&&wc(e,t,o))}function wc(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function Sc(r){return r>0?1:r<0?-1:0}function tC(r,t){let e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&_y(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function dl(r,t){return Xn(r.prev,r,r.next)<0?Xn(r,t,r.next)>=0&&Xn(r,r.prev,t)>=0:Xn(r,t,r.prev)<0||Xn(r,r.next,t)<0}function eC(r,t){let e=r,o=!1,s=(r.x+t.x)/2,u=(r.y+t.y)/2;do e.y>u!=e.next.y>u&&e.next.y!==e.y&&s<(e.next.x-e.x)*(u-e.y)/(e.next.y-e.y)+e.x&&(o=!o),e=e.next;while(e!==r);return o}function xy(r,t){let e=new Gp(r.i,r.x,r.y),o=new Gp(t.i,t.x,t.y),s=r.next,u=t.prev;return r.next=t,t.prev=r,e.next=s,s.prev=e,o.next=e,e.prev=o,u.next=o,o.prev=u,o}function Y0(r,t,e,o){let s=new Gp(r,t,e);return o?(s.next=o.next,s.prev=o,o.next.prev=s,o.next=s):(s.prev=s,s.next=s),s}function ml(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Gp(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function nC(r,t,e,o){let s=0;for(let u=t,c=e-o;u<e;u+=o)s+=(r[c]-r[u])*(r[u+1]+r[c+1]),c=u;return s}var Ms=class r{static area(t){let e=t.length,o=0;for(let s=e-1,u=0;u<e;s=u++)o+=t[s].x*t[u].y-t[u].x*t[s].y;return o*.5}static isClockWise(t){return r.area(t)<0}static triangulateShape(t,e){let o=[],s=[],u=[];Z0(t),$0(o,t);let c=t.length;e.forEach(Z0);for(let p=0;p<e.length;p++)s.push(c),c+=e[p].length,$0(o,e[p]);let h=GT.triangulate(o,s);for(let p=0;p<h.length;p+=3)u.push(h.slice(p,p+3));return u}};function Z0(r){let t=r.length;t>2&&r[t-1].equals(r[0])&&r.pop()}function $0(r,t){for(let e=0;e<t.length;e++)r.push(t[e].x),r.push(t[e].y)}var cu=class r extends Ei{constructor(t=new lu([new qt(.5,.5),new qt(-.5,.5),new qt(-.5,-.5),new qt(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];let o=this,s=[],u=[];for(let h=0,p=t.length;h<p;h++){let d=t[h];c(d)}this.setAttribute("position",new Gr(s,3)),this.setAttribute("uv",new Gr(u,2)),this.computeVertexNormals();function c(h){let p=[],d=e.curveSegments!==void 0?e.curveSegments:12,m=e.steps!==void 0?e.steps:1,y=e.depth!==void 0?e.depth:1,v=e.bevelEnabled!==void 0?e.bevelEnabled:!0,E=e.bevelThickness!==void 0?e.bevelThickness:.2,b=e.bevelSize!==void 0?e.bevelSize:E-.1,A=e.bevelOffset!==void 0?e.bevelOffset:0,_=e.bevelSegments!==void 0?e.bevelSegments:3,x=e.extrudePath,T=e.UVGenerator!==void 0?e.UVGenerator:rC,w,R=!1,G,z,F,I;x&&(w=x.getSpacedPoints(m),R=!0,v=!1,G=x.computeFrenetFrames(m,!1),z=new st,F=new st,I=new st),v||(_=0,E=0,b=0,A=0);let lt=h.extractPoints(d),L=lt.shape,W=lt.holes;if(!Ms.isClockWise(L)){L=L.reverse();for(let Z=0,Nt=W.length;Z<Nt;Z++){let vt=W[Z];Ms.isClockWise(vt)&&(W[Z]=vt.reverse())}}let wt=Ms.triangulateShape(L,W),Y=L;for(let Z=0,Nt=W.length;Z<Nt;Z++){let vt=W[Z];L=L.concat(vt)}function dt(Z,Nt,vt){return Nt||console.error("THREE.ExtrudeGeometry: vec does not exist"),Z.clone().addScaledVector(Nt,vt)}let ct=L.length,yt=wt.length;function rt(Z,Nt,vt){let Lt,Mt,Ht,Xt=Z.x-Nt.x,Pt=Z.y-Nt.y,ee=vt.x-Z.x,X=vt.y-Z.y,N=Xt*Xt+Pt*Pt,_t=Xt*X-Pt*ee;if(Math.abs(_t)>Number.EPSILON){let Et=Math.sqrt(N),it=Math.sqrt(ee*ee+X*X),Rt=Nt.x-Pt/Et,le=Nt.y+Xt/Et,It=vt.x-X/it,Ft=vt.y+ee/it,Wt=((It-Rt)*X-(Ft-le)*ee)/(Xt*X-Pt*ee);Lt=Rt+Xt*Wt-Z.x,Mt=le+Pt*Wt-Z.y;let J=Lt*Lt+Mt*Mt;if(J<=2)return new qt(Lt,Mt);Ht=Math.sqrt(J/2)}else{let Et=!1;Xt>Number.EPSILON?ee>Number.EPSILON&&(Et=!0):Xt<-Number.EPSILON?ee<-Number.EPSILON&&(Et=!0):Math.sign(Pt)===Math.sign(X)&&(Et=!0),Et?(Lt=-Pt,Mt=Xt,Ht=Math.sqrt(N)):(Lt=Xt,Mt=Pt,Ht=Math.sqrt(N/2))}return new qt(Lt/Ht,Mt/Ht)}let ut=[];for(let Z=0,Nt=Y.length,vt=Nt-1,Lt=Z+1;Z<Nt;Z++,vt++,Lt++)vt===Nt&&(vt=0),Lt===Nt&&(Lt=0),ut[Z]=rt(Y[Z],Y[vt],Y[Lt]);let q=[],bt,Ct=ut.concat();for(let Z=0,Nt=W.length;Z<Nt;Z++){let vt=W[Z];bt=[];for(let Lt=0,Mt=vt.length,Ht=Mt-1,Xt=Lt+1;Lt<Mt;Lt++,Ht++,Xt++)Ht===Mt&&(Ht=0),Xt===Mt&&(Xt=0),bt[Lt]=rt(vt[Lt],vt[Ht],vt[Xt]);q.push(bt),Ct=Ct.concat(bt)}for(let Z=0;Z<_;Z++){let Nt=Z/_,vt=E*Math.cos(Nt*Math.PI/2),Lt=b*Math.sin(Nt*Math.PI/2)+A;for(let Mt=0,Ht=Y.length;Mt<Ht;Mt++){let Xt=dt(Y[Mt],ut[Mt],Lt);Zt(Xt.x,Xt.y,-vt)}for(let Mt=0,Ht=W.length;Mt<Ht;Mt++){let Xt=W[Mt];bt=q[Mt];for(let Pt=0,ee=Xt.length;Pt<ee;Pt++){let X=dt(Xt[Pt],bt[Pt],Lt);Zt(X.x,X.y,-vt)}}}let Kt=b+A;for(let Z=0;Z<ct;Z++){let Nt=v?dt(L[Z],Ct[Z],Kt):L[Z];R?(F.copy(G.normals[0]).multiplyScalar(Nt.x),z.copy(G.binormals[0]).multiplyScalar(Nt.y),I.copy(w[0]).add(F).add(z),Zt(I.x,I.y,I.z)):Zt(Nt.x,Nt.y,0)}for(let Z=1;Z<=m;Z++)for(let Nt=0;Nt<ct;Nt++){let vt=v?dt(L[Nt],Ct[Nt],Kt):L[Nt];R?(F.copy(G.normals[Z]).multiplyScalar(vt.x),z.copy(G.binormals[Z]).multiplyScalar(vt.y),I.copy(w[Z]).add(F).add(z),Zt(I.x,I.y,I.z)):Zt(vt.x,vt.y,y/m*Z)}for(let Z=_-1;Z>=0;Z--){let Nt=Z/_,vt=E*Math.cos(Nt*Math.PI/2),Lt=b*Math.sin(Nt*Math.PI/2)+A;for(let Mt=0,Ht=Y.length;Mt<Ht;Mt++){let Xt=dt(Y[Mt],ut[Mt],Lt);Zt(Xt.x,Xt.y,y+vt)}for(let Mt=0,Ht=W.length;Mt<Ht;Mt++){let Xt=W[Mt];bt=q[Mt];for(let Pt=0,ee=Xt.length;Pt<ee;Pt++){let X=dt(Xt[Pt],bt[Pt],Lt);R?Zt(X.x,X.y+w[m-1].y,w[m-1].x+vt):Zt(X.x,X.y,y+vt)}}}et(),St();function et(){let Z=s.length/3;if(v){let Nt=0,vt=ct*Nt;for(let Lt=0;Lt<yt;Lt++){let Mt=wt[Lt];Dt(Mt[2]+vt,Mt[1]+vt,Mt[0]+vt)}Nt=m+_*2,vt=ct*Nt;for(let Lt=0;Lt<yt;Lt++){let Mt=wt[Lt];Dt(Mt[0]+vt,Mt[1]+vt,Mt[2]+vt)}}else{for(let Nt=0;Nt<yt;Nt++){let vt=wt[Nt];Dt(vt[2],vt[1],vt[0])}for(let Nt=0;Nt<yt;Nt++){let vt=wt[Nt];Dt(vt[0]+ct*m,vt[1]+ct*m,vt[2]+ct*m)}}o.addGroup(Z,s.length/3-Z,0)}function St(){let Z=s.length/3,Nt=0;kt(Y,Nt),Nt+=Y.length;for(let vt=0,Lt=W.length;vt<Lt;vt++){let Mt=W[vt];kt(Mt,Nt),Nt+=Mt.length}o.addGroup(Z,s.length/3-Z,1)}function kt(Z,Nt){let vt=Z.length;for(;--vt>=0;){let Lt=vt,Mt=vt-1;Mt<0&&(Mt=Z.length-1);for(let Ht=0,Xt=m+_*2;Ht<Xt;Ht++){let Pt=ct*Ht,ee=ct*(Ht+1),X=Nt+Lt+Pt,N=Nt+Mt+Pt,_t=Nt+Mt+ee,Et=Nt+Lt+ee;Bt(X,N,_t,Et)}}}function Zt(Z,Nt,vt){p.push(Z),p.push(Nt),p.push(vt)}function Dt(Z,Nt,vt){Tt(Z),Tt(Nt),Tt(vt);let Lt=s.length/3,Mt=T.generateTopUV(o,s,Lt-3,Lt-2,Lt-1);te(Mt[0]),te(Mt[1]),te(Mt[2])}function Bt(Z,Nt,vt,Lt){Tt(Z),Tt(Nt),Tt(Lt),Tt(Nt),Tt(vt),Tt(Lt);let Mt=s.length/3,Ht=T.generateSideWallUV(o,s,Mt-6,Mt-3,Mt-2,Mt-1);te(Ht[0]),te(Ht[1]),te(Ht[3]),te(Ht[1]),te(Ht[2]),te(Ht[3])}function Tt(Z){s.push(p[Z*3+0]),s.push(p[Z*3+1]),s.push(p[Z*3+2])}function te(Z){u.push(Z.x),u.push(Z.y)}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON(),e=this.parameters.shapes,o=this.parameters.options;return iC(e,o,t)}static fromJSON(t,e){let o=[];for(let u=0,c=t.shapes.length;u<c;u++){let h=e[t.shapes[u]];o.push(h)}let s=t.options.extrudePath;return s!==void 0&&(t.options.extrudePath=new Up[s.type]().fromJSON(s)),new r(o,t.options)}},rC={generateTopUV:function(r,t,e,o,s){let u=t[e*3],c=t[e*3+1],h=t[o*3],p=t[o*3+1],d=t[s*3],m=t[s*3+1];return[new qt(u,c),new qt(h,p),new qt(d,m)]},generateSideWallUV:function(r,t,e,o,s,u){let c=t[e*3],h=t[e*3+1],p=t[e*3+2],d=t[o*3],m=t[o*3+1],y=t[o*3+2],v=t[s*3],E=t[s*3+1],b=t[s*3+2],A=t[u*3],_=t[u*3+1],x=t[u*3+2];return Math.abs(h-m)<Math.abs(c-d)?[new qt(c,1-p),new qt(d,1-y),new qt(v,1-b),new qt(A,1-x)]:[new qt(h,1-p),new qt(m,1-y),new qt(E,1-b),new qt(_,1-x)]}};function iC(r,t,e){if(e.shapes=[],Array.isArray(r))for(let o=0,s=r.length;o<s;o++){let u=r[o];e.shapes.push(u.uuid)}else e.shapes.push(r.uuid);return e.options=Object.assign({},t),t.extrudePath!==void 0&&(e.options.extrudePath=t.extrudePath.toJSON()),e}var gl=class r extends Ei{constructor(t=new lu([new qt(0,.5),new qt(-.5,-.5),new qt(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};let o=[],s=[],u=[],c=[],h=0,p=0;if(Array.isArray(t)===!1)d(t);else for(let m=0;m<t.length;m++)d(t[m]),this.addGroup(h,p,m),h+=p,p=0;this.setIndex(o),this.setAttribute("position",new Gr(s,3)),this.setAttribute("normal",new Gr(u,3)),this.setAttribute("uv",new Gr(c,2));function d(m){let y=s.length/3,v=m.extractPoints(e),E=v.shape,b=v.holes;Ms.isClockWise(E)===!1&&(E=E.reverse());for(let _=0,x=b.length;_<x;_++){let T=b[_];Ms.isClockWise(T)===!0&&(b[_]=T.reverse())}let A=Ms.triangulateShape(E,b);for(let _=0,x=b.length;_<x;_++){let T=b[_];E=E.concat(T)}for(let _=0,x=E.length;_<x;_++){let T=E[_];s.push(T.x,T.y,0),u.push(0,0,1),c.push(T.x,T.y)}for(let _=0,x=A.length;_<x;_++){let T=A[_],w=T[0]+y,R=T[1]+y,G=T[2]+y;o.push(w,R,G),p+=3}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON(),e=this.parameters.shapes;return oC(e,t)}static fromJSON(t,e){let o=[];for(let s=0,u=t.shapes.length;s<u;s++){let c=e[t.shapes[s]];o.push(c)}return new r(o,t.curveSegments)}};function oC(r,t){if(t.shapes=[],Array.isArray(r))for(let e=0,o=r.length;e<o;e++){let s=r[e];t.shapes.push(s.uuid)}else t.shapes.push(r.uuid);return t}function bc(r,t,e){return!r||!e&&r.constructor===t?r:typeof t.BYTES_PER_ELEMENT=="number"?new t(r):Array.prototype.slice.call(r)}function sC(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}var hu=class{constructor(t,e,o,s){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new e.constructor(o),this.sampleValues=e,this.valueSize=o,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,o=this._cachedIndex,s=e[o],u=e[o-1];n:{t:{let c;e:{r:if(!(t<s)){for(let h=o+2;;){if(s===void 0){if(t<u)break r;return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}if(o===h)break;if(u=s,s=e[++o],t<s)break t}c=e.length;break e}if(!(t>=u)){let h=e[1];t<h&&(o=2,u=h);for(let p=o-2;;){if(u===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(o===p)break;if(s=u,u=e[--o-1],t>=u)break t}c=o,o=0;break e}break n}for(;o<c;){let h=o+c>>>1;t<e[h]?c=h:o=h+1}if(s=e[o],u=e[o-1],u===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(s===void 0)return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}this._cachedIndex=o,this.intervalChanged_(o,u,s)}return this.interpolate_(o,u,t,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,o=this.sampleValues,s=this.valueSize,u=t*s;for(let c=0;c!==s;++c)e[c]=o[u+c];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},kp=class extends hu{constructor(t,e,o,s){super(t,e,o,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Qg,endingEnd:Qg}}intervalChanged_(t,e,o){let s=this.parameterPositions,u=t-2,c=t+1,h=s[u],p=s[c];if(h===void 0)switch(this.getSettings_().endingStart){case t0:u=t,h=2*e-o;break;case e0:u=s.length-2,h=e+s[u]-s[u+1];break;default:u=t,h=o}if(p===void 0)switch(this.getSettings_().endingEnd){case t0:c=t,p=2*o-e;break;case e0:c=1,p=o+s[1]-s[0];break;default:c=t-1,p=e}let d=(o-e)*.5,m=this.valueSize;this._weightPrev=d/(e-h),this._weightNext=d/(p-o),this._offsetPrev=u*m,this._offsetNext=c*m}interpolate_(t,e,o,s){let u=this.resultBuffer,c=this.sampleValues,h=this.valueSize,p=t*h,d=p-h,m=this._offsetPrev,y=this._offsetNext,v=this._weightPrev,E=this._weightNext,b=(o-e)/(s-e),A=b*b,_=A*b,x=-v*_+2*v*A-v*b,T=(1+v)*_+(-1.5-2*v)*A+(-.5+v)*b+1,w=(-1-E)*_+(1.5+E)*A+.5*b,R=E*_-E*A;for(let G=0;G!==h;++G)u[G]=x*c[m+G]+T*c[d+G]+w*c[p+G]+R*c[y+G];return u}},Hp=class extends hu{constructor(t,e,o,s){super(t,e,o,s)}interpolate_(t,e,o,s){let u=this.resultBuffer,c=this.sampleValues,h=this.valueSize,p=t*h,d=p-h,m=(o-e)/(s-e),y=1-m;for(let v=0;v!==h;++v)u[v]=c[d+v]*y+c[p+v]*m;return u}},Vp=class extends hu{constructor(t,e,o,s){super(t,e,o,s)}interpolate_(t){return this.copySampleValue_(t-1)}},lo=class{constructor(t,e,o,s){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=bc(e,this.TimeBufferType),this.values=bc(o,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(t){let e=t.constructor,o;if(e.toJSON!==this.toJSON)o=e.toJSON(t);else{o={name:t.name,times:bc(t.times,Array),values:bc(t.values,Array)};let s=t.getInterpolation();s!==t.DefaultInterpolation&&(o.interpolation=s)}return o.type=t.ValueTypeName,o}InterpolantFactoryMethodDiscrete(t){return new Vp(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Hp(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new kp(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case Tc:e=this.InterpolantFactoryMethodDiscrete;break;case Cc:e=this.InterpolantFactoryMethodLinear;break;case Sf:e=this.InterpolantFactoryMethodSmooth;break}if(e===void 0){let o="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(o);return console.warn("THREE.KeyframeTrack:",o),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Tc;case this.InterpolantFactoryMethodLinear:return Cc;case this.InterpolantFactoryMethodSmooth:return Sf}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let o=0,s=e.length;o!==s;++o)e[o]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let o=0,s=e.length;o!==s;++o)e[o]*=t}return this}trim(t,e){let o=this.times,s=o.length,u=0,c=s-1;for(;u!==s&&o[u]<t;)++u;for(;c!==-1&&o[c]>e;)--c;if(++c,u!==0||c!==s){u>=c&&(c=Math.max(c,1),u=c-1);let h=this.getValueSize();this.times=o.slice(u,c),this.values=this.values.slice(u*h,c*h)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);let o=this.times,s=this.values,u=o.length;u===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let c=null;for(let h=0;h!==u;h++){let p=o[h];if(typeof p=="number"&&isNaN(p)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,h,p),t=!1;break}if(c!==null&&c>p){console.error("THREE.KeyframeTrack: Out of order keys.",this,h,p,c),t=!1;break}c=p}if(s!==void 0&&sC(s))for(let h=0,p=s.length;h!==p;++h){let d=s[h];if(isNaN(d)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,h,d),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),o=this.getValueSize(),s=this.getInterpolation()===Sf,u=t.length-1,c=1;for(let h=1;h<u;++h){let p=!1,d=t[h],m=t[h+1];if(d!==m&&(h!==1||d!==t[0]))if(s)p=!0;else{let y=h*o,v=y-o,E=y+o;for(let b=0;b!==o;++b){let A=e[y+b];if(A!==e[v+b]||A!==e[E+b]){p=!0;break}}}if(p){if(h!==c){t[c]=t[h];let y=h*o,v=c*o;for(let E=0;E!==o;++E)e[v+E]=e[y+E]}++c}}if(u>0){t[c]=t[u];for(let h=u*o,p=c*o,d=0;d!==o;++d)e[p+d]=e[h+d];++c}return c!==t.length?(this.times=t.slice(0,c),this.values=e.slice(0,c*o)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),o=this.constructor,s=new o(this.name,t,e);return s.createInterpolant=this.createInterpolant,s}};lo.prototype.TimeBufferType=Float32Array;lo.prototype.ValueBufferType=Float32Array;lo.prototype.DefaultInterpolation=Cc;var la=class extends lo{};la.prototype.ValueTypeName="bool";la.prototype.ValueBufferType=Array;la.prototype.DefaultInterpolation=Tc;la.prototype.InterpolantFactoryMethodLinear=void 0;la.prototype.InterpolantFactoryMethodSmooth=void 0;var qp=class extends lo{};qp.prototype.ValueTypeName="color";var Wp=class extends lo{};Wp.prototype.ValueTypeName="number";var Xp=class extends hu{constructor(t,e,o,s){super(t,e,o,s)}interpolate_(t,e,o,s){let u=this.resultBuffer,c=this.sampleValues,h=this.valueSize,p=(o-e)/(s-e),d=t*h;for(let m=d+h;d!==m;d+=4)Qo.slerpFlat(u,0,c,d-h,c,d,p);return u}},yl=class extends lo{InterpolantFactoryMethodLinear(t){return new Xp(this.times,this.values,this.getValueSize(),t)}};yl.prototype.ValueTypeName="quaternion";yl.prototype.DefaultInterpolation=Cc;yl.prototype.InterpolantFactoryMethodSmooth=void 0;var ca=class extends lo{};ca.prototype.ValueTypeName="string";ca.prototype.ValueBufferType=Array;ca.prototype.DefaultInterpolation=Tc;ca.prototype.InterpolantFactoryMethodLinear=void 0;ca.prototype.InterpolantFactoryMethodSmooth=void 0;var Yp=class extends lo{};Yp.prototype.ValueTypeName="vector";var Zp=class{constructor(t,e,o){let s=this,u=!1,c=0,h=0,p,d=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=o,this.itemStart=function(m){h++,u===!1&&s.onStart!==void 0&&s.onStart(m,c,h),u=!0},this.itemEnd=function(m){c++,s.onProgress!==void 0&&s.onProgress(m,c,h),c===h&&(u=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(m){s.onError!==void 0&&s.onError(m)},this.resolveURL=function(m){return p?p(m):m},this.setURLModifier=function(m){return p=m,this},this.addHandler=function(m,y){return d.push(m,y),this},this.removeHandler=function(m){let y=d.indexOf(m);return y!==-1&&d.splice(y,2),this},this.getHandler=function(m){for(let y=0,v=d.length;y<v;y+=2){let E=d[y],b=d[y+1];if(E.global&&(E.lastIndex=0),E.test(m))return b}return null}}},aC=new Zp,$p=class{constructor(t){this.manager=t!==void 0?t:aC,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){let o=this;return new Promise(function(s,u){o.load(t,s,e,u)})}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}};$p.DEFAULT_MATERIAL_NAME="__DEFAULT";var nd="\\\\[\\\\]\\\\.:\\\\/",uC=new RegExp("["+nd+"]","g"),rd="[^"+nd+"]",lC="[^"+nd.replace("\\\\.","")+"]",cC=/((?:WC+[\\/:])*)/.source.replace("WC",rd),hC=/(WCOD+)?/.source.replace("WCOD",lC),fC=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",rd),pC=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",rd),dC=new RegExp("^"+cC+hC+fC+pC+"$"),mC=["material","materials","bones","map"],Jp=class{constructor(t,e,o){let s=o||Vn.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,s)}getValue(t,e){this.bind();let o=this._targetGroup.nCachedObjects_,s=this._bindings[o];s!==void 0&&s.getValue(t,e)}setValue(t,e){let o=this._bindings;for(let s=this._targetGroup.nCachedObjects_,u=o.length;s!==u;++s)o[s].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,o=t.length;e!==o;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,o=t.length;e!==o;++e)t[e].unbind()}},Vn=class r{constructor(t,e,o){this.path=e,this.parsedPath=o||r.parseTrackName(e),this.node=r.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,o){return t&&t.isAnimationObjectGroup?new r.Composite(t,e,o):new r(t,e,o)}static sanitizeNodeName(t){return t.replace(/\\s/g,"_").replace(uC,"")}static parseTrackName(t){let e=dC.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let o={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},s=o.nodeName&&o.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){let u=o.nodeName.substring(s+1);mC.indexOf(u)!==-1&&(o.nodeName=o.nodeName.substring(0,s),o.objectName=u)}if(o.propertyName===null||o.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return o}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let o=t.skeleton.getBoneByName(e);if(o!==void 0)return o}if(t.children){let o=function(u){for(let c=0;c<u.length;c++){let h=u[c];if(h.name===e||h.uuid===e)return h;let p=o(h.children);if(p)return p}return null},s=o(t.children);if(s)return s}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let o=this.resolvedProperty;for(let s=0,u=o.length;s!==u;++s)t[e++]=o[s]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){let o=this.resolvedProperty;for(let s=0,u=o.length;s!==u;++s)o[s]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let o=this.resolvedProperty;for(let s=0,u=o.length;s!==u;++s)o[s]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let o=this.resolvedProperty;for(let s=0,u=o.length;s!==u;++s)o[s]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node,e=this.parsedPath,o=e.objectName,s=e.propertyName,u=e.propertyIndex;if(t||(t=r.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(o){let d=e.objectIndex;switch(o){case"materials":if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let m=0;m<t.length;m++)if(t[m].name===d){d=m;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[o]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[o]}if(d!==void 0){if(t[d]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[d]}}let c=t[s];if(c===void 0){let d=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+d+"."+s+" but it wasn't found.",t);return}let h=this.Versioning.None;this.targetObject=t,t.needsUpdate!==void 0?h=this.Versioning.NeedsUpdate:t.matrixWorldNeedsUpdate!==void 0&&(h=this.Versioning.MatrixWorldNeedsUpdate);let p=this.BindingType.Direct;if(u!==void 0){if(s==="morphTargetInfluences"){if(!t.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[u]!==void 0&&(u=t.morphTargetDictionary[u])}p=this.BindingType.ArrayElement,this.resolvedProperty=c,this.propertyIndex=u}else c.fromArray!==void 0&&c.toArray!==void 0?(p=this.BindingType.HasFromToArray,this.resolvedProperty=c):Array.isArray(c)?(p=this.BindingType.EntireArray,this.resolvedProperty=c):this.propertyName=s;this.getValue=this.GetterByBindingType[p],this.setValue=this.SetterByBindingTypeAndVersioning[p][h]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Vn.Composite=Jp;Vn.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Vn.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Vn.prototype.GetterByBindingType=[Vn.prototype._getValue_direct,Vn.prototype._getValue_array,Vn.prototype._getValue_arrayElement,Vn.prototype._getValue_toArray];Vn.prototype.SetterByBindingTypeAndVersioning=[[Vn.prototype._setValue_direct,Vn.prototype._setValue_direct_setNeedsUpdate,Vn.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Vn.prototype._setValue_array,Vn.prototype._setValue_array_setNeedsUpdate,Vn.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Vn.prototype._setValue_arrayElement,Vn.prototype._setValue_arrayElement_setNeedsUpdate,Vn.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Vn.prototype._setValue_fromArray,Vn.prototype._setValue_fromArray_setNeedsUpdate,Vn.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var f2=new Float32Array(1);typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Kp}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Kp);function pu(r,t=[]){let e=new lu(r.map(o=>new qt(...o)));return t.length&&t.forEach(o=>{var s=new uu(o.map(u=>new qt(...u)));e.holes.push(s)}),e}var Ir=63710088e-1,_2={centimeters:Ir*100,centimetres:Ir*100,degrees:Ir/111325,feet:Ir*3.28084,inches:Ir*39.37,kilometers:Ir/1e3,kilometres:Ir/1e3,meters:Ir,metres:Ir,miles:Ir/1609.344,millimeters:Ir*1e3,millimetres:Ir*1e3,nauticalmiles:Ir/1852,radians:1,yards:Ir*1.0936},x2={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Ir,yards:1.0936133};function pi(r,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=r,o}function Fn(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!So(r[0])||!So(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return pi(o,t,e)}function Un(r,t,e){e===void 0&&(e={});for(var o=0,s=r;o<s.length;o++){var u=s[o];if(u.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var c=0;c<u[u.length-1].length;c++)if(u[u.length-1][c]!==u[0][c])throw new Error("First and last Position are not equivalent.")}var h={type:"Polygon",coordinates:r};return pi(h,t,e)}function Rr(r,t,e){if(e===void 0&&(e={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:r};return pi(o,t,e)}function id(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return pi(o,t,e)}function So(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function mr(r,t,e){if(r!==null)for(var o,s,u,c,h,p,d,m=0,y=0,v,E=r.type,b=E==="FeatureCollection",A=E==="Feature",_=b?r.features.length:1,x=0;x<_;x++){d=b?r.features[x].geometry:A?r.geometry:r,v=d?d.type==="GeometryCollection":!1,h=v?d.geometries.length:1;for(var T=0;T<h;T++){var w=0,R=0;if(c=v?d.geometries[T]:d,c!==null){p=c.coordinates;var G=c.type;switch(m=e&&(G==="Polygon"||G==="MultiPolygon")?1:0,G){case null:break;case"Point":if(t(p,y,x,w,R)===!1)return!1;y++,w++;break;case"LineString":case"MultiPoint":for(o=0;o<p.length;o++){if(t(p[o],y,x,w,R)===!1)return!1;y++,G==="MultiPoint"&&w++}G==="LineString"&&w++;break;case"Polygon":case"MultiLineString":for(o=0;o<p.length;o++){for(s=0;s<p[o].length-m;s++){if(t(p[o][s],y,x,w,R)===!1)return!1;y++}G==="MultiLineString"&&w++,G==="Polygon"&&R++}G==="Polygon"&&w++;break;case"MultiPolygon":for(o=0;o<p.length;o++){for(R=0,s=0;s<p[o].length;s++){for(u=0;u<p[o][s].length-m;u++){if(t(p[o][s][u],y,x,w,R)===!1)return!1;y++}R++}w++}break;case"GeometryCollection":for(o=0;o<c.geometries.length;o++)if(mr(c.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Ey(r,t,e,o){var s=e;return mr(r,function(u,c,h,p,d){c===0&&e===void 0?s=u:s=t(s,u,c,h,p,d)},o),s}function As(r,t){var e,o,s,u,c,h,p,d,m,y,v=0,E=r.type==="FeatureCollection",b=r.type==="Feature",A=E?r.features.length:1;for(e=0;e<A;e++){for(h=E?r.features[e].geometry:b?r.geometry:r,d=E?r.features[e].properties:b?r.properties:{},m=E?r.features[e].bbox:b?r.bbox:void 0,y=E?r.features[e].id:b?r.id:void 0,p=h?h.type==="GeometryCollection":!1,c=p?h.geometries.length:1,s=0;s<c;s++){if(u=p?h.geometries[s]:h,u===null){if(t(null,v,d,m,y)===!1)return!1;continue}switch(u.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(u,v,d,m,y)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<u.geometries.length;o++)if(t(u.geometries[o],v,d,m,y)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}v++}}function Ni(r,t){As(r,function(e,o,s,u,c){var h=e===null?null:e.type;switch(h){case null:case"Point":case"LineString":case"Polygon":return t(pi(e,s,{bbox:u,id:c}),o,0)===!1?!1:void 0}var p;switch(h){case"MultiPoint":p="Point";break;case"MultiLineString":p="LineString";break;case"MultiPolygon":p="Polygon";break}for(var d=0;d<e.coordinates.length;d++){var m=e.coordinates[d],y={type:p,coordinates:m};if(t(pi(y,s),o,d)===!1)return!1}})}function od(r){var t=[1/0,1/0,-1/0,-1/0];return mr(r,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}od.default=od;var di=od;function kr(r){if(!r)throw new Error("coord is required");if(!Array.isArray(r)){if(r.type==="Feature"&&r.geometry!==null&&r.geometry.type==="Point")return r.geometry.coordinates;if(r.type==="Point")return r.coordinates}if(Array.isArray(r)&&r.length>=2&&!Array.isArray(r[0])&&!Array.isArray(r[1]))return r;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function sd(r,t,e){if(!r)throw new Error("No feature passed");if(!e)throw new Error(".featureOf() requires a name");if(!r||r.type!=="Feature"||!r.geometry)throw new Error("Invalid input to "+e+", Feature with geometry required");if(!r.geometry||r.geometry.type!==t)throw new Error("Invalid input to "+e+": must be a "+t+", given "+r.geometry.type)}function Hr(r){return r.type==="Feature"?r.geometry:r}var wC=tr(nh(),1);var NC=tr(zy(),1);function Lr(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("point is required");if(!t)throw new Error("polygon is required");var o=kr(r),s=Hr(t),u=s.type,c=t.bbox,h=s.coordinates;if(c&&OC(o,c)===!1)return!1;u==="Polygon"&&(h=[h]);for(var p=!1,d=0;d<h.length&&!p;d++)if(Gy(o,h[d][0],e.ignoreBoundary)){for(var m=!1,y=1;y<h[d].length&&!m;)Gy(o,h[d][y],!e.ignoreBoundary)&&(m=!0),y++;m||(p=!0)}return p}function Gy(r,t,e){var o=!1;t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]&&(t=t.slice(0,t.length-1));for(var s=0,u=t.length-1;s<t.length;u=s++){var c=t[s][0],h=t[s][1],p=t[u][0],d=t[u][1],m=r[1]*(c-p)+h*(p-r[0])+d*(r[0]-c)===0&&(c-r[0])*(p-r[0])<=0&&(h-r[1])*(d-r[1])<=0;if(m)return!e;var y=h>r[1]!=d>r[1]&&r[0]<(p-c)*(r[1]-h)/(d-h)+c;y&&(o=!o)}return o}function OC(r,t){return t[0]<=r[0]&&t[1]<=r[1]&&t[2]>=r[0]&&t[3]>=r[1]}var Vy=new ArrayBuffer(16),$O=new Float64Array(Vy),JO=new Uint32Array(Vy);var $C=tr(Md(),1);var M3=function(){function r(t){this.points=t.points||[],this.duration=t.duration||1e4,this.sharpness=t.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=t.stepLength||60,this.length=this.points.length,this.delay=0;for(var e=0;e<this.length;e++)this.points[e].z=this.points[e].z||0;for(var e=0;e<this.length-1;e++){var o=this.points[e],s=this.points[e+1];this.centers.push({x:(o.x+s.x)/2,y:(o.y+s.y)/2,z:(o.z+s.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(var e=0;e<this.centers.length-1;e++){var u=this.points[e+1].x-(this.centers[e].x+this.centers[e+1].x)/2,c=this.points[e+1].y-(this.centers[e].y+this.centers[e+1].y)/2,h=this.points[e+1].z-(this.centers[e].y+this.centers[e+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e].x+u),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e].y+c),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e].z+h)},{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e+1].x+u),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e+1].y+c),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e+1].z+h)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}return r.prototype.cacheSteps=function(t){var e=[],o=this.pos(0);e.push(0);for(var s=0;s<this.duration;s+=10){var u=this.pos(s),c=Math.sqrt((u.x-o.x)*(u.x-o.x)+(u.y-o.y)*(u.y-o.y)+(u.z-o.z)*(u.z-o.z));c>t&&(e.push(s),o=u)}return e},r.prototype.vector=function(t){var e=this.pos(t+10),o=this.pos(t-10);return{angle:180*Math.atan2(e.y-o.y,e.x-o.x)/3.14,speed:Math.sqrt((o.x-e.x)*(o.x-e.x)+(o.y-e.y)*(o.y-e.y)+(o.z-e.z)*(o.z-e.z))}},r.prototype.pos=function(t){var e=t-this.delay;e<0&&(e=0),e>this.duration&&(e=this.duration-1);var o=e/this.duration;if(o>=1)return this.points[this.length-1];var s=Math.floor((this.points.length-1)*o),u=(this.length-1)*o-s;return JC(u,this.points[s],this.controls[s][1],this.controls[s+1][0],this.points[s+1])},r}();function JC(r,t,e,o,s){var u=KC(r),c={x:s.x*u[0]+o.x*u[1]+e.x*u[2]+t.x*u[3],y:s.y*u[0]+o.y*u[1]+e.y*u[2]+t.y*u[3],z:s.z*u[0]+o.z*u[1]+e.z*u[2]+t.z*u[3]};return c}function KC(r){var t=r*r,e=t*r;return[e,3*t*(1-r),3*r*(1-r)*(1-r),(1-r)*(1-r)*(1-r)]}function El(r,t){t===void 0&&(t={});var e=Number(r[0]),o=Number(r[1]),s=Number(r[2]),u=Number(r[3]);if(r.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var c=[e,o],h=[e,u],p=[s,u],d=[s,o];return Un([[c,d,p,h,c]],t.properties,{bbox:r,id:t.id})}function jC(r){return El(di(r))}var wd=jC;var mP=tr(tv(),1);var HP=tr(_h(),1);var qP=tr(nh(),1);var YP=tr(Md(),1);var vv=Math.PI/180,_v=180/Math.PI,Cl=function(r,t){this.lon=r,this.lat=t,this.x=vv*r,this.y=vv*t};Cl.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)};Cl.prototype.antipode=function(){var r=-1*this.lat,t=this.lon<0?180+this.lon:(180-this.lon)*-1;return new Cl(t,r)};var xv=function(){this.coords=[],this.length=0};xv.prototype.move_to=function(r){this.length++,this.coords.push(r)};var Vd=function(r){this.properties=r||{},this.geometries=[]};Vd.prototype.json=function(){if(this.geometries.length<=0)return{geometry:{type:"LineString",coordinates:null},type:"Feature",properties:this.properties};if(this.geometries.length===1)return{geometry:{type:"LineString",coordinates:this.geometries[0].coords},type:"Feature",properties:this.properties};for(var r=[],t=0;t<this.geometries.length;t++)r.push(this.geometries[t].coords);return{geometry:{type:"MultiLineString",coordinates:r},type:"Feature",properties:this.properties}};Vd.prototype.wkt=function(){for(var r="",t="LINESTRING(",e=function(u){t+=u[0]+" "+u[1]+","},o=0;o<this.geometries.length;o++){if(this.geometries[o].coords.length===0)return"LINESTRING(empty)";var s=this.geometries[o].coords;s.forEach(e),r+=t.substring(0,t.length-1)+")"}return r};var Ev=function(r,t,e){if(!r||r.x===void 0||r.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");if(!t||t.x===void 0||t.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");this.start=new Cl(r.x,r.y),this.end=new Cl(t.x,t.y),this.properties=e||{};var o=this.start.x-this.end.x,s=this.start.y-this.end.y,u=Math.pow(Math.sin(s/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(o/2),2);if(this.g=2*Math.asin(Math.sqrt(u)),this.g===Math.PI)throw new Error("it appears "+r.view()+" and "+t.view()+" are 'antipodal', e.g diametrically opposite, thus there is no single route but rather infinite");if(isNaN(this.g))throw new Error("could not calculate great circle between "+r+" and "+t)};Ev.prototype.interpolate=function(r){var t=Math.sin((1-r)*this.g)/Math.sin(this.g),e=Math.sin(r*this.g)/Math.sin(this.g),o=t*Math.cos(this.start.y)*Math.cos(this.start.x)+e*Math.cos(this.end.y)*Math.cos(this.end.x),s=t*Math.cos(this.start.y)*Math.sin(this.start.x)+e*Math.cos(this.end.y)*Math.sin(this.end.x),u=t*Math.sin(this.start.y)+e*Math.sin(this.end.y),c=_v*Math.atan2(u,Math.sqrt(Math.pow(o,2)+Math.pow(s,2))),h=_v*Math.atan2(s,o);return[h,c]};Ev.prototype.Arc=function(r,t){var e=[];if(!r||r<=2)e.push([this.start.lon,this.start.lat]),e.push([this.end.lon,this.end.lat]);else for(var o=1/(r-1),s=0;s<r;++s){var u=o*s,c=this.interpolate(u);e.push(c)}for(var h=!1,p=0,d=t&&t.offset?t.offset:10,m=180-d,y=-180+d,v=360-d,E=1;E<e.length;++E){var b=e[E-1][0],A=e[E][0],_=Math.abs(A-b);_>v&&(A>m&&b<y||b>m&&A<y)?h=!0:_>p&&(p=_)}var x=[];if(h&&p<d){var T=[];x.push(T);for(var w=0;w<e.length;++w){var R=parseFloat(e[w][0]);if(w>0&&Math.abs(R-e[w-1][0])>v){var G=parseFloat(e[w-1][0]),z=parseFloat(e[w-1][1]),F=parseFloat(e[w][0]),I=parseFloat(e[w][1]);if(G>-180&&G<y&&F===180&&w+1<e.length&&e[w-1][0]>-180&&e[w-1][0]<y){T.push([-180,e[w][1]]),w++,T.push([e[w][0],e[w][1]]);continue}else if(G>m&&G<180&&F===-180&&w+1<e.length&&e[w-1][0]>m&&e[w-1][0]<180){T.push([180,e[w][1]]),w++,T.push([e[w][0],e[w][1]]);continue}if(G<y&&F>m){var lt=G;G=F,F=lt;var L=z;z=I,I=L}if(G>m&&F<y&&(F+=360),G<=180&&F>=180&&G<F){var W=(180-G)/(F-G),V=W*I+(1-W)*z;T.push([e[w-1][0]>m?180:-180,V]),T=[],T.push([e[w-1][0]>m?-180:180,V]),x.push(T)}else T=[],x.push(T);T.push([R,e[w][1]])}else T.push([e[w][0],e[w][1]])}}else{var wt=[];x.push(wt);for(var Y=0;Y<e.length;++Y)wt.push([e[Y][0],e[Y][1]])}for(var dt=new Vd(this.properties),ct=0;ct<x.length;++ct){var yt=new xv;dt.geometries.push(yt);for(var rt=x[ct],ut=0;ut<rt.length;++ut)yt.move_to(rt[ut])}return dt};var JP=tr(_h(),1);var $R=tr(_h(),1);var JR=tr(ym(),1);var QR=tr(nh(),1);var Ae=[],Te=[],Ce=[],Pe=[],Ie=[],Re=[],Le=[],Ne=[],Oe=[],De=[],Fe=[],Ue=[],Be=[],ze=[],Ge=[],ke=[],He=[],Ve=[],qe=[],We=[],Xe=[],Ye=[],Ze=[],$e=[];Le[85]=De[85]=-1;Ne[85]=Fe[85]=0;Oe[85]=Ue[85]=1;qe[85]=Ye[85]=1;We[85]=Ze[85]=0;Xe[85]=$e[85]=1;Ae[85]=Pe[85]=0;Te[85]=Ie[85]=-1;Ce[85]=Ge[85]=0;ke[85]=Be[85]=0;He[85]=ze[85]=1;Re[85]=Ve[85]=1;Ye[1]=Ye[169]=0;Ze[1]=Ze[169]=-1;$e[1]=$e[169]=0;Be[1]=Be[169]=-1;ze[1]=ze[169]=0;Ge[1]=Ge[169]=0;De[4]=De[166]=0;Fe[4]=Fe[166]=-1;Ue[4]=Ue[166]=1;ke[4]=ke[166]=1;He[4]=He[166]=0;Ve[4]=Ve[166]=0;Le[16]=Le[154]=0;Ne[16]=Ne[154]=1;Oe[16]=Oe[154]=1;Pe[16]=Pe[154]=1;Ie[16]=Ie[154]=0;Re[16]=Re[154]=1;qe[64]=qe[106]=0;We[64]=We[106]=1;Xe[64]=Xe[106]=0;Ae[64]=Ae[106]=-1;Te[64]=Te[106]=0;Ce[64]=Ce[106]=1;qe[2]=qe[168]=0;We[2]=We[168]=-1;Xe[2]=Xe[168]=1;Ye[2]=Ye[168]=0;Ze[2]=Ze[168]=-1;$e[2]=$e[168]=0;Be[2]=Be[168]=-1;ze[2]=ze[168]=0;Ge[2]=Ge[168]=0;ke[2]=ke[168]=-1;He[2]=He[168]=0;Ve[2]=Ve[168]=1;Le[8]=Le[162]=0;Ne[8]=Ne[162]=-1;Oe[8]=Oe[162]=0;De[8]=De[162]=0;Fe[8]=Fe[162]=-1;Ue[8]=Ue[162]=1;Be[8]=Be[162]=1;ze[8]=ze[162]=0;Ge[8]=Ge[162]=1;ke[8]=ke[162]=1;He[8]=He[162]=0;Ve[8]=Ve[162]=0;Le[32]=Le[138]=0;Ne[32]=Ne[138]=1;Oe[32]=Oe[138]=1;De[32]=De[138]=0;Fe[32]=Fe[138]=1;Ue[32]=Ue[138]=0;Ae[32]=Ae[138]=1;Te[32]=Te[138]=0;Ce[32]=Ce[138]=0;Pe[32]=Pe[138]=1;Ie[32]=Ie[138]=0;Re[32]=Re[138]=1;Ye[128]=Ye[42]=0;Ze[128]=Ze[42]=1;$e[128]=$e[42]=1;qe[128]=qe[42]=0;We[128]=We[42]=1;Xe[128]=Xe[42]=0;Ae[128]=Ae[42]=-1;Te[128]=Te[42]=0;Ce[128]=Ce[42]=1;Pe[128]=Pe[42]=-1;Ie[128]=Ie[42]=0;Re[128]=Re[42]=0;De[5]=De[165]=-1;Fe[5]=Fe[165]=0;Ue[5]=Ue[165]=0;Ye[5]=Ye[165]=1;Ze[5]=Ze[165]=0;$e[5]=$e[165]=0;ke[20]=ke[150]=0;He[20]=He[150]=1;Ve[20]=Ve[150]=1;Pe[20]=Pe[150]=0;Ie[20]=Ie[150]=-1;Re[20]=Re[150]=1;Le[80]=Le[90]=-1;Ne[80]=Ne[90]=0;Oe[80]=Oe[90]=1;qe[80]=qe[90]=1;We[80]=We[90]=0;Xe[80]=Xe[90]=1;Be[65]=Be[105]=0;ze[65]=ze[105]=1;Ge[65]=Ge[105]=0;Ae[65]=Ae[105]=0;Te[65]=Te[105]=-1;Ce[65]=Ce[105]=0;Le[160]=Le[10]=-1;Ne[160]=Ne[10]=0;Oe[160]=Oe[10]=1;De[160]=De[10]=-1;Fe[160]=Fe[10]=0;Ue[160]=Ue[10]=0;Ye[160]=Ye[10]=1;Ze[160]=Ze[10]=0;$e[160]=$e[10]=0;qe[160]=qe[10]=1;We[160]=We[10]=0;Xe[160]=Xe[10]=1;ke[130]=ke[40]=0;He[130]=He[40]=1;Ve[130]=Ve[40]=1;Be[130]=Be[40]=0;ze[130]=ze[40]=1;Ge[130]=Ge[40]=0;Ae[130]=Ae[40]=0;Te[130]=Te[40]=-1;Ce[130]=Ce[40]=0;Pe[130]=Pe[40]=0;Ie[130]=Ie[40]=-1;Re[130]=Re[40]=1;De[37]=De[133]=0;Fe[37]=Fe[133]=1;Ue[37]=Ue[133]=1;Ye[37]=Ye[133]=0;Ze[37]=Ze[133]=1;$e[37]=$e[133]=0;Ae[37]=Ae[133]=-1;Te[37]=Te[133]=0;Ce[37]=Ce[133]=0;Pe[37]=Pe[133]=1;Ie[37]=Ie[133]=0;Re[37]=Re[133]=0;ke[148]=ke[22]=-1;He[148]=He[22]=0;Ve[148]=Ve[22]=0;Ye[148]=Ye[22]=0;Ze[148]=Ze[22]=-1;$e[148]=$e[22]=1;qe[148]=qe[22]=0;We[148]=We[22]=1;Xe[148]=Xe[22]=1;Pe[148]=Pe[22]=-1;Ie[148]=Ie[22]=0;Re[148]=Re[22]=1;Le[82]=Le[88]=0;Ne[82]=Ne[88]=-1;Oe[82]=Oe[88]=1;ke[82]=ke[88]=1;He[82]=He[88]=0;Ve[82]=Ve[88]=1;Be[82]=Be[88]=-1;ze[82]=ze[88]=0;Ge[82]=Ge[88]=1;qe[82]=qe[88]=0;We[82]=We[88]=-1;Xe[82]=Xe[88]=0;Le[73]=Le[97]=0;Ne[73]=Ne[97]=1;Oe[73]=Oe[97]=0;De[73]=De[97]=0;Fe[73]=Fe[97]=-1;Ue[73]=Ue[97]=0;Be[73]=Be[97]=1;ze[73]=ze[97]=0;Ge[73]=Ge[97]=0;Ae[73]=Ae[97]=1;Te[73]=Te[97]=0;Ce[73]=Ce[97]=1;Le[145]=Le[25]=0;Ne[145]=Ne[25]=-1;Oe[145]=Oe[25]=0;Be[145]=Be[25]=1;ze[145]=ze[25]=0;Ge[145]=Ge[25]=1;Ye[145]=Ye[25]=0;Ze[145]=Ze[25]=1;$e[145]=$e[25]=1;Pe[145]=Pe[25]=-1;Ie[145]=Ie[25]=0;Re[145]=Re[25]=0;De[70]=De[100]=0;Fe[70]=Fe[100]=1;Ue[70]=Ue[100]=0;ke[70]=ke[100]=-1;He[70]=He[100]=0;Ve[70]=Ve[100]=1;qe[70]=qe[100]=0;We[70]=We[100]=-1;Xe[70]=Xe[100]=1;Ae[70]=Ae[100]=1;Te[70]=Te[100]=0;Ce[70]=Ce[100]=0;De[101]=De[69]=0;Fe[101]=Fe[69]=1;Ue[101]=Ue[69]=0;Ae[101]=Ae[69]=1;Te[101]=Te[69]=0;Ce[101]=Ce[69]=0;Ye[149]=Ye[21]=0;Ze[149]=Ze[21]=1;$e[149]=$e[21]=1;Pe[149]=Pe[21]=-1;Ie[149]=Ie[21]=0;Re[149]=Re[21]=0;ke[86]=ke[84]=-1;He[86]=He[84]=0;Ve[86]=Ve[84]=1;qe[86]=qe[84]=0;We[86]=We[84]=-1;Xe[86]=Xe[84]=1;Le[89]=Le[81]=0;Ne[89]=Ne[81]=-1;Oe[89]=Oe[81]=0;Be[89]=Be[81]=1;ze[89]=ze[81]=0;Ge[89]=Ge[81]=1;Le[96]=Le[74]=0;Ne[96]=Ne[74]=1;Oe[96]=Oe[74]=0;De[96]=De[74]=-1;Fe[96]=Fe[74]=0;Ue[96]=Ue[74]=1;qe[96]=qe[74]=1;We[96]=We[74]=0;Xe[96]=Xe[74]=0;Ae[96]=Ae[74]=1;Te[96]=Te[74]=0;Ce[96]=Ce[74]=1;Le[24]=Le[146]=0;Ne[24]=Ne[146]=-1;Oe[24]=Oe[146]=1;ke[24]=ke[146]=1;He[24]=He[146]=0;Ve[24]=Ve[146]=1;Be[24]=Be[146]=0;ze[24]=ze[146]=1;Ge[24]=Ge[146]=1;Pe[24]=Pe[146]=0;Ie[24]=Ie[146]=-1;Re[24]=Re[146]=0;De[6]=De[164]=-1;Fe[6]=Fe[164]=0;Ue[6]=Ue[164]=1;ke[6]=ke[164]=-1;He[6]=He[164]=0;Ve[6]=Ve[164]=0;Ye[6]=Ye[164]=0;Ze[6]=Ze[164]=-1;$e[6]=$e[164]=1;qe[6]=qe[164]=1;We[6]=We[164]=0;Xe[6]=Xe[164]=0;Be[129]=Be[41]=0;ze[129]=ze[41]=1;Ge[129]=Ge[41]=1;Ye[129]=Ye[41]=0;Ze[129]=Ze[41]=1;$e[129]=$e[41]=0;Ae[129]=Ae[41]=-1;Te[129]=Te[41]=0;Ce[129]=Ce[41]=0;Pe[129]=Pe[41]=0;Ie[129]=Ie[41]=-1;Re[129]=Re[41]=0;ke[66]=ke[104]=0;He[66]=He[104]=1;Ve[66]=Ve[104]=0;Be[66]=Be[104]=-1;ze[66]=ze[104]=0;Ge[66]=Ge[104]=1;qe[66]=qe[104]=0;We[66]=We[104]=-1;Xe[66]=Xe[104]=0;Ae[66]=Ae[104]=0;Te[66]=Te[104]=-1;Ce[66]=Ce[104]=1;Le[144]=Le[26]=-1;Ne[144]=Ne[26]=0;Oe[144]=Oe[26]=0;Ye[144]=Ye[26]=1;Ze[144]=Ze[26]=0;$e[144]=$e[26]=1;qe[144]=qe[26]=0;We[144]=We[26]=1;Xe[144]=Xe[26]=1;Pe[144]=Pe[26]=-1;Ie[144]=Ie[26]=0;Re[144]=Re[26]=1;De[36]=De[134]=0;Fe[36]=Fe[134]=1;Ue[36]=Ue[134]=1;ke[36]=ke[134]=0;He[36]=He[134]=1;Ve[36]=Ve[134]=0;Ae[36]=Ae[134]=0;Te[36]=Te[134]=-1;Ce[36]=Ce[134]=1;Pe[36]=Pe[134]=1;Ie[36]=Ie[134]=0;Re[36]=Re[134]=0;Le[9]=Le[161]=-1;Ne[9]=Ne[161]=0;Oe[9]=Oe[161]=0;De[9]=De[161]=0;Fe[9]=Fe[161]=-1;Ue[9]=Ue[161]=0;Be[9]=Be[161]=1;ze[9]=ze[161]=0;Ge[9]=Ge[161]=0;Ye[9]=Ye[161]=1;Ze[9]=Ze[161]=0;$e[9]=$e[161]=1;Le[136]=0;Ne[136]=1;Oe[136]=1;De[136]=0;Fe[136]=1;Ue[136]=0;ke[136]=-1;He[136]=0;Ve[136]=1;Be[136]=-1;ze[136]=0;Ge[136]=0;Ye[136]=0;Ze[136]=-1;$e[136]=0;qe[136]=0;We[136]=-1;Xe[136]=1;Ae[136]=1;Te[136]=0;Ce[136]=0;Pe[136]=1;Ie[136]=0;Re[136]=1;Le[34]=0;Ne[34]=-1;Oe[34]=0;De[34]=0;Fe[34]=-1;Ue[34]=1;ke[34]=1;He[34]=0;Ve[34]=0;Be[34]=1;ze[34]=0;Ge[34]=1;Ye[34]=0;Ze[34]=1;$e[34]=1;qe[34]=0;We[34]=1;Xe[34]=0;Ae[34]=-1;Te[34]=0;Ce[34]=1;Pe[34]=-1;Ie[34]=0;Re[34]=0;Le[35]=0;Ne[35]=1;Oe[35]=1;De[35]=0;Fe[35]=-1;Ue[35]=1;ke[35]=1;He[35]=0;Ve[35]=0;Be[35]=-1;ze[35]=0;Ge[35]=0;Ye[35]=0;Ze[35]=-1;$e[35]=0;qe[35]=0;We[35]=1;Xe[35]=0;Ae[35]=-1;Te[35]=0;Ce[35]=1;Pe[35]=1;Ie[35]=0;Re[35]=1;Le[153]=0;Ne[153]=1;Oe[153]=1;Be[153]=-1;ze[153]=0;Ge[153]=0;Ye[153]=0;Ze[153]=-1;$e[153]=0;Pe[153]=1;Ie[153]=0;Re[153]=1;De[102]=0;Fe[102]=-1;Ue[102]=1;ke[102]=1;He[102]=0;Ve[102]=0;qe[102]=0;We[102]=1;Xe[102]=0;Ae[102]=-1;Te[102]=0;Ce[102]=1;Le[155]=0;Ne[155]=-1;Oe[155]=0;Be[155]=1;ze[155]=0;Ge[155]=1;Ye[155]=0;Ze[155]=1;$e[155]=1;Pe[155]=-1;Ie[155]=0;Re[155]=0;De[103]=0;Fe[103]=1;Ue[103]=0;ke[103]=-1;He[103]=0;Ve[103]=1;qe[103]=0;We[103]=-1;Xe[103]=1;Ae[103]=1;Te[103]=0;Ce[103]=0;Le[152]=0;Ne[152]=1;Oe[152]=1;ke[152]=-1;He[152]=0;Ve[152]=1;Be[152]=-1;ze[152]=0;Ge[152]=0;Ye[152]=0;Ze[152]=-1;$e[152]=0;qe[152]=0;We[152]=-1;Xe[152]=1;Pe[152]=1;Ie[152]=0;Re[152]=1;Le[156]=0;Ne[156]=-1;Oe[156]=1;ke[156]=1;He[156]=0;Ve[156]=1;Be[156]=-1;ze[156]=0;Ge[156]=0;Ye[156]=0;Ze[156]=-1;$e[156]=0;qe[156]=0;We[156]=1;Xe[156]=1;Pe[156]=-1;Ie[156]=0;Re[156]=1;Le[137]=0;Ne[137]=1;Oe[137]=1;De[137]=0;Fe[137]=1;Ue[137]=0;Be[137]=-1;ze[137]=0;Ge[137]=0;Ye[137]=0;Ze[137]=-1;$e[137]=0;Ae[137]=1;Te[137]=0;Ce[137]=0;Pe[137]=1;Ie[137]=0;Re[137]=1;Le[139]=0;Ne[139]=1;Oe[139]=1;De[139]=0;Fe[139]=-1;Ue[139]=0;Be[139]=1;ze[139]=0;Ge[139]=0;Ye[139]=0;Ze[139]=1;$e[139]=0;Ae[139]=-1;Te[139]=0;Ce[139]=0;Pe[139]=1;Ie[139]=0;Re[139]=1;Le[98]=0;Ne[98]=-1;Oe[98]=0;De[98]=0;Fe[98]=-1;Ue[98]=1;ke[98]=1;He[98]=0;Ve[98]=0;Be[98]=1;ze[98]=0;Ge[98]=1;qe[98]=0;We[98]=1;Xe[98]=0;Ae[98]=-1;Te[98]=0;Ce[98]=1;Le[99]=0;Ne[99]=1;Oe[99]=0;De[99]=0;Fe[99]=-1;Ue[99]=1;ke[99]=1;He[99]=0;Ve[99]=0;Be[99]=-1;ze[99]=0;Ge[99]=1;qe[99]=0;We[99]=-1;Xe[99]=0;Ae[99]=1;Te[99]=0;Ce[99]=1;De[38]=0;Fe[38]=-1;Ue[38]=1;ke[38]=1;He[38]=0;Ve[38]=0;Ye[38]=0;Ze[38]=1;$e[38]=1;qe[38]=0;We[38]=1;Xe[38]=0;Ae[38]=-1;Te[38]=0;Ce[38]=1;Pe[38]=-1;Ie[38]=0;Re[38]=0;De[39]=0;Fe[39]=1;Ue[39]=1;ke[39]=-1;He[39]=0;Ve[39]=0;Ye[39]=0;Ze[39]=-1;$e[39]=1;qe[39]=0;We[39]=1;Xe[39]=0;Ae[39]=-1;Te[39]=0;Ce[39]=1;Pe[39]=1;Ie[39]=0;Re[39]=0;var vm=function(r){return[[r.bottomleft,0],[0,0],[0,r.leftbottom]]},_m=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0]]},xm=function(r){return[[r.topright,1],[1,1],[1,r.righttop]]},Em=function(r){return[[0,r.lefttop],[0,1],[r.topleft,1]]},Mm=function(r){return[[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop]]},wm=function(r){return[[r.bottomright,0],[r.bottomleft,0],[1,r.righttop],[1,r.rightbottom]]},Sm=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.topleft,1],[r.topright,1]]},bm=function(r){return[[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},tL=function(r){return[[0,0],[0,r.leftbottom],[1,r.rightbottom],[1,0]]},eL=function(r){return[[1,0],[r.bottomright,0],[r.topright,1],[1,1]]},nL=function(r){return[[1,1],[1,r.righttop],[0,r.lefttop],[0,1]]},rL=function(r){return[[r.bottomleft,0],[0,0],[0,1],[r.topleft,1]]},iL=function(r){return[[1,r.righttop],[1,r.rightbottom],[0,r.leftbottom],[0,r.lefttop]]},oL=function(r){return[[r.topleft,1],[r.topright,1],[r.bottomright,0],[r.bottomleft,0]]},sL=function(){return[[0,0],[0,1],[1,1],[1,0]]},aL=function(r){return[[1,r.rightbottom],[1,0],[0,0],[0,1],[r.topleft,1]]},uL=function(r){return[[r.topright,1],[1,1],[1,0],[0,0],[0,r.leftbottom]]},lL=function(r){return[[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[1,1]]},cL=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,1]]},hL=function(r){return[[1,r.righttop],[1,r.rightbottom],[0,r.lefttop],[0,1],[r.topleft,1]]},fL=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[r.topright,1]]},pL=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop]]},dL=function(r){return[[r.topright,1],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topleft,1]]},mL=function(r){return[[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1],[r.topleft,1]]},gL=function(r){return[[1,1],[1,r.righttop],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},yL=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[r.topleft,1],[r.topright,1]]},vL=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,r.leftbottom]]},_L=function(r){return[[1,r.rightbottom],[1,0],[0,0],[0,r.leftbottom],[r.topleft,1],[r.topright,1]]},xL=function(r){return[[1,1],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},EL=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1]]},ML=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,1],[r.topleft,1]]},wL=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topright,1]]},SL=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[r.topleft,1]]},bL=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},AL=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topright,1]]},TL=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[r.topleft,1]]},CL=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},PL=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topleft,1],[r.topright,1]]},IL=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1],[r.topleft,1]]},RL=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},Qe=[],tn=[],en=[],nn=[],rn=[],on=[],sn=[],an=[];nn[1]=rn[1]=18;nn[169]=rn[169]=18;en[4]=tn[4]=12;en[166]=tn[166]=12;Qe[16]=an[16]=4;Qe[154]=an[154]=4;on[64]=sn[64]=22;on[106]=sn[106]=22;en[2]=on[2]=17;nn[2]=rn[2]=18;en[168]=on[168]=17;nn[168]=rn[168]=18;Qe[8]=nn[8]=9;tn[8]=en[8]=12;Qe[162]=nn[162]=9;tn[162]=en[162]=12;Qe[32]=an[32]=4;tn[32]=sn[32]=1;Qe[138]=an[138]=4;tn[138]=sn[138]=1;rn[128]=an[128]=21;on[128]=sn[128]=22;rn[42]=an[42]=21;on[42]=sn[42]=22;tn[5]=rn[5]=14;tn[165]=rn[165]=14;en[20]=an[20]=6;en[150]=an[150]=6;Qe[80]=on[80]=11;Qe[90]=on[90]=11;nn[65]=sn[65]=3;nn[105]=sn[105]=3;Qe[160]=on[160]=11;tn[160]=rn[160]=14;Qe[10]=on[10]=11;tn[10]=rn[10]=14;en[130]=an[130]=6;nn[130]=sn[130]=3;en[40]=an[40]=6;nn[40]=sn[40]=3;tn[101]=sn[101]=1;tn[69]=sn[69]=1;rn[149]=an[149]=21;rn[21]=an[21]=21;en[86]=on[86]=17;en[84]=on[84]=17;Qe[89]=nn[89]=9;Qe[81]=nn[81]=9;Qe[96]=sn[96]=0;tn[96]=on[96]=15;Qe[74]=sn[74]=0;tn[74]=on[74]=15;Qe[24]=en[24]=8;nn[24]=an[24]=7;Qe[146]=en[146]=8;nn[146]=an[146]=7;tn[6]=on[6]=15;en[6]=rn[6]=16;tn[164]=on[164]=15;en[164]=rn[164]=16;nn[129]=an[129]=7;rn[129]=sn[129]=20;nn[41]=an[41]=7;rn[41]=sn[41]=20;en[66]=sn[66]=2;nn[66]=on[66]=19;en[104]=sn[104]=2;nn[104]=on[104]=19;Qe[144]=rn[144]=10;on[144]=an[144]=23;Qe[26]=rn[26]=10;on[26]=an[26]=23;tn[36]=an[36]=5;en[36]=sn[36]=2;tn[134]=an[134]=5;en[134]=sn[134]=2;Qe[9]=rn[9]=10;tn[9]=nn[9]=13;Qe[161]=rn[161]=10;tn[161]=nn[161]=13;tn[37]=an[37]=5;rn[37]=sn[37]=20;tn[133]=an[133]=5;rn[133]=sn[133]=20;en[148]=rn[148]=16;on[148]=an[148]=23;en[22]=rn[22]=16;on[22]=an[22]=23;Qe[82]=en[82]=8;nn[82]=on[82]=19;Qe[88]=en[88]=8;nn[88]=on[88]=19;Qe[73]=sn[73]=0;tn[73]=nn[73]=13;Qe[97]=sn[97]=0;tn[97]=nn[97]=13;Qe[145]=nn[145]=9;rn[145]=an[145]=21;Qe[25]=nn[25]=9;rn[25]=an[25]=21;tn[70]=sn[70]=1;en[70]=on[70]=17;tn[100]=sn[100]=1;en[100]=on[100]=17;Qe[34]=nn[34]=9;tn[34]=en[34]=12;rn[34]=an[34]=21;on[34]=sn[34]=22;Qe[136]=an[136]=4;tn[136]=sn[136]=1;en[136]=on[136]=17;nn[136]=rn[136]=18;Qe[35]=an[35]=4;tn[35]=en[35]=12;nn[35]=rn[35]=18;on[35]=sn[35]=22;Qe[153]=an[153]=4;nn[153]=rn[153]=18;tn[102]=en[102]=12;on[102]=sn[102]=22;Qe[155]=nn[155]=9;rn[155]=an[155]=23;tn[103]=sn[103]=1;en[103]=on[103]=17;Qe[152]=an[152]=4;en[152]=on[152]=17;nn[152]=rn[152]=18;Qe[156]=en[156]=8;nn[156]=rn[156]=18;on[156]=an[156]=23;Qe[137]=an[137]=4;tn[137]=sn[137]=1;nn[137]=rn[137]=18;Qe[139]=an[139]=4;tn[139]=nn[139]=13;rn[139]=sn[139]=20;Qe[98]=nn[98]=9;tn[98]=en[98]=12;on[98]=sn[98]=22;Qe[99]=sn[99]=0;tn[99]=en[99]=12;nn[99]=on[99]=19;tn[38]=en[38]=12;rn[38]=an[38]=21;on[38]=sn[38]=22;tn[39]=an[39]=5;en[39]=rn[39]=16;on[39]=sn[39]=22;var Yt=[];Yt[1]=Yt[169]=vm;Yt[4]=Yt[166]=_m;Yt[16]=Yt[154]=xm;Yt[64]=Yt[106]=Em;Yt[168]=Yt[2]=Mm;Yt[162]=Yt[8]=wm;Yt[138]=Yt[32]=Sm;Yt[42]=Yt[128]=bm;Yt[5]=Yt[165]=tL;Yt[20]=Yt[150]=eL;Yt[80]=Yt[90]=nL;Yt[65]=Yt[105]=rL;Yt[160]=Yt[10]=iL;Yt[130]=Yt[40]=oL;Yt[85]=sL;Yt[101]=Yt[69]=aL;Yt[149]=Yt[21]=uL;Yt[86]=Yt[84]=lL;Yt[89]=Yt[81]=cL;Yt[96]=Yt[74]=hL;Yt[24]=Yt[146]=fL;Yt[6]=Yt[164]=pL;Yt[129]=Yt[41]=dL;Yt[66]=Yt[104]=mL;Yt[144]=Yt[26]=gL;Yt[36]=Yt[134]=yL;Yt[9]=Yt[161]=vL;Yt[37]=Yt[133]=_L;Yt[148]=Yt[22]=xL;Yt[82]=Yt[88]=EL;Yt[73]=Yt[97]=ML;Yt[145]=Yt[25]=wL;Yt[70]=Yt[100]=SL;Yt[34]=function(r){return[bm(r),wm(r)]};Yt[35]=bL;Yt[136]=function(r){return[Sm(r),Mm(r)]};Yt[153]=function(r){return[xm(r),vm(r)]};Yt[102]=function(r){return[_m(r),Em(r)]};Yt[155]=AL;Yt[103]=TL;Yt[152]=function(r){return[xm(r),Mm(r)]};Yt[156]=CL;Yt[137]=function(r){return[Sm(r),vm(r)]};Yt[139]=PL;Yt[98]=function(r){return[wm(r),Em(r)]};Yt[99]=IL;Yt[38]=function(r){return[_m(r),bm(r)]};Yt[39]=RL;function NL(r){return(r>0)-(r<0)||+r}function Pu(r,t,e){var o=t[0]-r[0],s=t[1]-r[1],u=e[0]-t[0],c=e[1]-t[1];return NL(o*c-u*s)}function u1(r,t){var e=r.geometry.coordinates[0].map(function(c){return c[0]}),o=r.geometry.coordinates[0].map(function(c){return c[1]}),s=t.geometry.coordinates[0].map(function(c){return c[0]}),u=t.geometry.coordinates[0].map(function(c){return c[1]});return Math.max.apply(null,e)===Math.max.apply(null,s)&&Math.max.apply(null,o)===Math.max.apply(null,u)&&Math.min.apply(null,e)===Math.min.apply(null,s)&&Math.min.apply(null,o)===Math.min.apply(null,u)}function Am(r,t){return t.geometry.coordinates[0].every(function(e){return Lr(Fn(e),r)})}function l1(r,t){return r[0]===t[0]&&r[1]===t[1]}var OL=function(){function r(t){this.id=r.buildId(t),this.coordinates=t,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}return r.buildId=function(t){return t.join(",")},r.prototype.removeInnerEdge=function(t){this.innerEdges=this.innerEdges.filter(function(e){return e.from.id!==t.from.id})},r.prototype.removeOuterEdge=function(t){this.outerEdges=this.outerEdges.filter(function(e){return e.to.id!==t.to.id})},r.prototype.addOuterEdge=function(t){this.outerEdges.push(t),this.outerEdgesSorted=!1},r.prototype.sortOuterEdges=function(){var t=this;this.outerEdgesSorted||(this.outerEdges.sort(function(e,o){var s=e.to,u=o.to;if(s.coordinates[0]-t.coordinates[0]>=0&&u.coordinates[0]-t.coordinates[0]<0)return 1;if(s.coordinates[0]-t.coordinates[0]<0&&u.coordinates[0]-t.coordinates[0]>=0)return-1;if(s.coordinates[0]-t.coordinates[0]===0&&u.coordinates[0]-t.coordinates[0]===0)return s.coordinates[1]-t.coordinates[1]>=0||u.coordinates[1]-t.coordinates[1]>=0?s.coordinates[1]-u.coordinates[1]:u.coordinates[1]-s.coordinates[1];var c=Pu(t.coordinates,s.coordinates,u.coordinates);if(c<0)return 1;if(c>0)return-1;var h=Math.pow(s.coordinates[0]-t.coordinates[0],2)+Math.pow(s.coordinates[1]-t.coordinates[1],2),p=Math.pow(u.coordinates[0]-t.coordinates[0],2)+Math.pow(u.coordinates[1]-t.coordinates[1],2);return h-p}),this.outerEdgesSorted=!0)},r.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},r.prototype.getOuterEdge=function(t){return this.sortOuterEdges(),this.outerEdges[t]},r.prototype.addInnerEdge=function(t){this.innerEdges.push(t)},r}(),Tm=OL;var DL=function(){function r(t,e){this.from=t,this.to=e,this.next=void 0,this.label=void 0,this.symetric=void 0,this.ring=void 0,this.from.addOuterEdge(this),this.to.addInnerEdge(this)}return r.prototype.getSymetric=function(){return this.symetric||(this.symetric=new r(this.to,this.from),this.symetric.symetric=this),this.symetric},r.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},r.prototype.isEqual=function(t){return this.from.id===t.from.id&&this.to.id===t.to.id},r.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},r.prototype.toLineString=function(){return Rr([this.from.coordinates,this.to.coordinates])},r.prototype.compareTo=function(t){return Pu(t.from.coordinates,t.to.coordinates,this.to.coordinates)},r}(),c1=DL;var FL=function(){function r(){this.edges=[],this.polygon=void 0,this.envelope=void 0}return r.prototype.push=function(t){this.edges.push(t),this.polygon=this.envelope=void 0},r.prototype.get=function(t){return this.edges[t]},Object.defineProperty(r.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),r.prototype.forEach=function(t){this.edges.forEach(t)},r.prototype.map=function(t){return this.edges.map(t)},r.prototype.some=function(t){return this.edges.some(t)},r.prototype.isValid=function(){return!0},r.prototype.isHole=function(){var t=this,e=this.edges.reduce(function(c,h,p){return h.from.coordinates[1]>t.edges[c].from.coordinates[1]&&(c=p),c},0),o=(e===0?this.length:e)-1,s=(e+1)%this.length,u=Pu(this.edges[o].from.coordinates,this.edges[e].from.coordinates,this.edges[s].from.coordinates);return u===0?this.edges[o].from.coordinates[0]>this.edges[s].from.coordinates[0]:u>0},r.prototype.toMultiPoint=function(){return id(this.edges.map(function(t){return t.from.coordinates}))},r.prototype.toPolygon=function(){if(this.polygon)return this.polygon;var t=this.edges.map(function(e){return e.from.coordinates});return t.push(this.edges[0].from.coordinates),this.polygon=Un([t])},r.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=wd(this.toPolygon())},r.findEdgeRingContaining=function(t,e){var o=t.getEnvelope(),s,u;return e.forEach(function(c){var h=c.getEnvelope();if(u&&(s=u.getEnvelope()),!u1(h,o)&&Am(h,o)){for(var p=t.map(function(b){return b.from.coordinates}),d=void 0,m=function(b){c.some(function(A){return l1(b,A.from.coordinates)})||(d=b)},y=0,v=p;y<v.length;y++){var E=v[y];m(E)}d&&c.inside(Fn(d))&&(!u||Am(s,h))&&(u=c)}}),u},r.prototype.inside=function(t){return Lr(t,this.toPolygon())},r}(),Cm=FL;function UL(r){if(!r)throw new Error("No geojson passed");if(r.type!=="FeatureCollection"&&r.type!=="GeometryCollection"&&r.type!=="MultiLineString"&&r.type!=="LineString"&&r.type!=="Feature")throw new Error("Invalid input type '"+r.type+"'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature")}var I4=function(){function r(){this.edges=[],this.nodes={}}return r.fromGeoJson=function(t){UL(t);var e=new r;return Ni(t,function(o){sd(o,"LineString","Graph::fromGeoJson"),Ey(o,function(s,u){if(s){var c=e.getNode(s),h=e.getNode(u);e.addEdge(c,h)}return u})}),e},r.prototype.getNode=function(t){var e=Tm.buildId(t),o=this.nodes[e];return o||(o=this.nodes[e]=new Tm(t)),o},r.prototype.addEdge=function(t,e){var o=new c1(t,e),s=o.getSymetric();this.edges.push(o),this.edges.push(s)},r.prototype.deleteDangles=function(){var t=this;Object.keys(this.nodes).map(function(e){return t.nodes[e]}).forEach(function(e){return t._removeIfDangle(e)})},r.prototype._removeIfDangle=function(t){var e=this;if(t.innerEdges.length<=1){var o=t.getOuterEdges().map(function(s){return s.to});this.removeNode(t),o.forEach(function(s){return e._removeIfDangle(s)})}},r.prototype.deleteCutEdges=function(){var t=this;this._computeNextCWEdges(),this._findLabeledEdgeRings(),this.edges.forEach(function(e){e.label===e.symetric.label&&(t.removeEdge(e.symetric),t.removeEdge(e))})},r.prototype._computeNextCWEdges=function(t){var e=this;typeof t=="undefined"?Object.keys(this.nodes).forEach(function(o){return e._computeNextCWEdges(e.nodes[o])}):t.getOuterEdges().forEach(function(o,s){t.getOuterEdge((s===0?t.getOuterEdges().length:s)-1).symetric.next=o})},r.prototype._computeNextCCWEdges=function(t,e){for(var o=t.getOuterEdges(),s,u,c=o.length-1;c>=0;--c){var h=o[c],p=h.symetric,d=void 0,m=void 0;h.label===e&&(d=h),p.label===e&&(m=p),!(!d||!m)&&(m&&(u=m),d&&(u&&(u.next=d,u=void 0),s||(s=d)))}u&&(u.next=s)},r.prototype._findLabeledEdgeRings=function(){var t=[],e=0;return this.edges.forEach(function(o){if(!(o.label>=0)){t.push(o);var s=o;do s.label=e,s=s.next;while(!o.isEqual(s));e++}}),t},r.prototype.getEdgeRings=function(){var t=this;this._computeNextCWEdges(),this.edges.forEach(function(o){o.label=void 0}),this._findLabeledEdgeRings().forEach(function(o){t._findIntersectionNodes(o).forEach(function(s){t._computeNextCCWEdges(s,o.label)})});var e=[];return this.edges.forEach(function(o){o.ring||e.push(t._findEdgeRing(o))}),e},r.prototype._findIntersectionNodes=function(t){var e=[],o=t,s=function(){var u=0;o.from.getOuterEdges().forEach(function(c){c.label===t.label&&++u}),u>1&&e.push(o.from),o=o.next};do s();while(!t.isEqual(o));return e},r.prototype._findEdgeRing=function(t){var e=t,o=new Cm;do o.push(e),e.ring=o,e=e.next;while(!t.isEqual(e));return o},r.prototype.removeNode=function(t){var e=this;t.getOuterEdges().forEach(function(o){return e.removeEdge(o)}),t.innerEdges.forEach(function(o){return e.removeEdge(o)}),delete this.nodes[t.id]},r.prototype.removeEdge=function(t){this.edges=this.edges.filter(function(e){return!e.isEqual(t)}),t.deleteEdge()},r}();var kL=tr(Pm(),1);var HL=tr(Pm(),1);var qL=tr(_1(),1);var KL=tr(P1(),1);function R1(r){for(var t=r,e=[];t.parent;)e.unshift(t),t=t.parent;return e}function QL(){return new L1(function(r){return r.f})}var Nm={search:function(r,t,e,o){r.cleanDirty(),o=o||{};var s=o.heuristic||Nm.heuristics.manhattan,u=o.closest||!1,c=QL(),h=t;for(t.h=s(t,e),c.push(t);c.size()>0;){var p=c.pop();if(p===e)return R1(p);p.closed=!0;for(var d=r.neighbors(p),m=0,y=d.length;m<y;++m){var v=d[m];if(!(v.closed||v.isWall())){var E=p.g+v.getCost(p),b=v.visited;(!b||E<v.g)&&(v.visited=!0,v.parent=p,v.h=v.h||s(v,e),v.g=E,v.f=v.g+v.h,r.markDirty(v),u&&(v.h<h.h||v.h===h.h&&v.g<h.g)&&(h=v),b?c.rescoreElement(v):c.push(v))}}}return u?R1(h):[]},heuristics:{manhattan:function(r,t){var e=Math.abs(t.x-r.x),o=Math.abs(t.y-r.y);return e+o},diagonal:function(r,t){var e=1,o=Math.sqrt(2),s=Math.abs(t.x-r.x),u=Math.abs(t.y-r.y);return e*(s+u)+(o-2*e)*Math.min(s,u)}},cleanNode:function(r){r.f=0,r.g=0,r.h=0,r.visited=!1,r.closed=!1,r.parent=null}};function Ul(r,t){t=t||{},this.nodes=[],this.diagonal=!!t.diagonal,this.grid=[];for(var e=0;e<r.length;e++){this.grid[e]=[];for(var o=0,s=r[e];o<s.length;o++){var u=new Xh(e,o,s[o]);this.grid[e][o]=u,this.nodes.push(u)}}this.init()}Ul.prototype.init=function(){this.dirtyNodes=[];for(var r=0;r<this.nodes.length;r++)Nm.cleanNode(this.nodes[r])};Ul.prototype.cleanDirty=function(){for(var r=0;r<this.dirtyNodes.length;r++)Nm.cleanNode(this.dirtyNodes[r]);this.dirtyNodes=[]};Ul.prototype.markDirty=function(r){this.dirtyNodes.push(r)};Ul.prototype.neighbors=function(r){var t=[],e=r.x,o=r.y,s=this.grid;return s[e-1]&&s[e-1][o]&&t.push(s[e-1][o]),s[e+1]&&s[e+1][o]&&t.push(s[e+1][o]),s[e]&&s[e][o-1]&&t.push(s[e][o-1]),s[e]&&s[e][o+1]&&t.push(s[e][o+1]),this.diagonal&&(s[e-1]&&s[e-1][o-1]&&t.push(s[e-1][o-1]),s[e+1]&&s[e+1][o-1]&&t.push(s[e+1][o-1]),s[e-1]&&s[e-1][o+1]&&t.push(s[e-1][o+1]),s[e+1]&&s[e+1][o+1]&&t.push(s[e+1][o+1])),t};Ul.prototype.toString=function(){for(var r=[],t=this.grid,e,o,s,u,c=0,h=t.length;c<h;c++){for(e=[],o=t[c],s=0,u=o.length;s<u;s++)e.push(o[s].weight);r.push(e.join(" "))}return r.join(\`
|
|
8051
8051
|
\`)};function Xh(r,t,e){this.x=r,this.y=t,this.weight=e}Xh.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};Xh.prototype.getCost=function(r){return r&&r.x!==this.x&&r.y!==this.y?this.weight*1.41421:this.weight};Xh.prototype.isWall=function(){return this.weight===0};function L1(r){this.content=[],this.scoreFunction=r}L1.prototype={push:function(r){this.content.push(r),this.sinkDown(this.content.length-1)},pop:function(){var r=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.bubbleUp(0)),r},remove:function(r){var t=this.content.indexOf(r),e=this.content.pop();t!==this.content.length-1&&(this.content[t]=e,this.scoreFunction(e)<this.scoreFunction(r)?this.sinkDown(t):this.bubbleUp(t))},size:function(){return this.content.length},rescoreElement:function(r){this.sinkDown(this.content.indexOf(r))},sinkDown:function(r){for(var t=this.content[r];r>0;){var e=(r+1>>1)-1,o=this.content[e];if(this.scoreFunction(t)<this.scoreFunction(o))this.content[e]=t,this.content[r]=o,r=e;else break}},bubbleUp:function(r){for(var t=this.content.length,e=this.content[r],o=this.scoreFunction(e);;){var s=r+1<<1,u=s-1,c=null,h;if(u<t){var p=this.content[u];h=this.scoreFunction(p),h<o&&(c=u)}if(s<t){var d=this.content[s],m=this.scoreFunction(d);m<(c===null?o:h)&&(c=s)}if(c!==null)this.content[r]=this.content[c],this.content[c]=e,r=c;else break}}};function Om(){this._=null}function Ru(r){r.U=r.C=r.L=r.R=r.P=r.N=null}Om.prototype={constructor:Om,insert:function(r,t){var e,o,s;if(r){if(t.P=r,t.N=r.N,r.N&&(r.N.P=t),r.N=t,r.R){for(r=r.R;r.L;)r=r.L;r.L=t}else r.R=t;e=r}else this._?(r=N1(this._),t.P=null,t.N=r,r.P=r.L=t,e=r):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,r=t;e&&e.C;)o=e.U,e===o.L?(s=o.R,s&&s.C?(e.C=s.C=!1,o.C=!0,r=o):(r===e.R&&(Bl(this,e),r=e,e=r.U),e.C=!1,o.C=!0,zl(this,o))):(s=o.L,s&&s.C?(e.C=s.C=!1,o.C=!0,r=o):(r===e.L&&(zl(this,e),r=e,e=r.U),e.C=!1,o.C=!0,Bl(this,o))),e=r.U;this._.C=!1},remove:function(r){r.N&&(r.N.P=r.P),r.P&&(r.P.N=r.N),r.N=r.P=null;var t=r.U,e,o=r.L,s=r.R,u,c;if(o?s?u=N1(s):u=o:u=s,t?t.L===r?t.L=u:t.R=u:this._=u,o&&s?(c=u.C,u.C=r.C,u.L=o,o.U=u,u!==s?(t=u.U,u.U=r.U,r=u.R,t.L=r,u.R=s,s.U=u):(u.U=t,t=u,r=u.R)):(c=r.C,r=u),r&&(r.U=t),!c){if(r&&r.C){r.C=!1;return}do{if(r===this._)break;if(r===t.L){if(e=t.R,e.C&&(e.C=!1,t.C=!0,Bl(this,t),e=t.R),e.L&&e.L.C||e.R&&e.R.C){(!e.R||!e.R.C)&&(e.L.C=!1,e.C=!0,zl(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,Bl(this,t),r=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,zl(this,t),e=t.L),e.L&&e.L.C||e.R&&e.R.C){(!e.L||!e.L.C)&&(e.R.C=!1,e.C=!0,Bl(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,zl(this,t),r=this._;break}e.C=!0,r=t,t=t.U}while(!r.C);r&&(r.C=!1)}}};function Bl(r,t){var e=t,o=t.R,s=e.U;s?s.L===e?s.L=o:s.R=o:r._=o,o.U=s,e.U=o,e.R=o.L,e.R&&(e.R.U=e),o.L=e}function zl(r,t){var e=t,o=t.L,s=e.U;s?s.L===e?s.L=o:s.R=o:r._=o,o.U=s,e.U=o,e.L=o.R,e.L&&(e.L.U=e),o.R=e}function N1(r){for(;r.L;)r=r.L;return r}var Dm=Om;function Lu(r,t,e,o){var s=[null,null],u=Or.push(s)-1;return s.left=r,s.right=t,e&&Gl(s,r,t,e),o&&Gl(s,t,r,o),mi[r.index].halfedges.push(u),mi[t.index].halfedges.push(u),s}function Nu(r,t,e){var o=[t,e];return o.left=r,o}function Gl(r,t,e,o){!r[0]&&!r[1]?(r[0]=o,r.left=t,r.right=e):r.left===e?r[1]=o:r[0]=o}function tN(r,t,e,o,s){var u=r[0],c=r[1],h=u[0],p=u[1],d=c[0],m=c[1],y=0,v=1,E=d-h,b=m-p,A;if(A=t-h,!(!E&&A>0)){if(A/=E,E<0){if(A<y)return;A<v&&(v=A)}else if(E>0){if(A>v)return;A>y&&(y=A)}if(A=o-h,!(!E&&A<0)){if(A/=E,E<0){if(A>v)return;A>y&&(y=A)}else if(E>0){if(A<y)return;A<v&&(v=A)}if(A=e-p,!(!b&&A>0)){if(A/=b,b<0){if(A<y)return;A<v&&(v=A)}else if(b>0){if(A>v)return;A>y&&(y=A)}if(A=s-p,!(!b&&A<0)){if(A/=b,b<0){if(A>v)return;A>y&&(y=A)}else if(b>0){if(A<y)return;A<v&&(v=A)}return!(y>0)&&!(v<1)||(y>0&&(r[0]=[h+y*E,p+y*b]),v<1&&(r[1]=[h+v*E,p+v*b])),!0}}}}}function eN(r,t,e,o,s){var u=r[1];if(u)return!0;var c=r[0],h=r.left,p=r.right,d=h[0],m=h[1],y=p[0],v=p[1],E=(d+y)/2,b=(m+v)/2,A,_;if(v===m){if(E<t||E>=o)return;if(d>y){if(!c)c=[E,e];else if(c[1]>=s)return;u=[E,s]}else{if(!c)c=[E,s];else if(c[1]<e)return;u=[E,e]}}else if(A=(d-y)/(v-m),_=b-A*E,A<-1||A>1)if(d>y){if(!c)c=[(e-_)/A,e];else if(c[1]>=s)return;u=[(s-_)/A,s]}else{if(!c)c=[(s-_)/A,s];else if(c[1]<e)return;u=[(e-_)/A,e]}else if(m<v){if(!c)c=[t,A*t+_];else if(c[0]>=o)return;u=[o,A*o+_]}else{if(!c)c=[o,A*o+_];else if(c[0]<t)return;u=[t,A*t+_]}return r[0]=c,r[1]=u,!0}function O1(r,t,e,o){for(var s=Or.length,u;s--;)(!eN(u=Or[s],r,t,e,o)||!tN(u,r,t,e,o)||!(Math.abs(u[0][0]-u[1][0])>Cn||Math.abs(u[0][1]-u[1][1])>Cn))&&delete Or[s]}function D1(r){return mi[r.index]={site:r,halfedges:[]}}function nN(r,t){var e=r.site,o=t.left,s=t.right;return e===s&&(s=o,o=e),s?Math.atan2(s[1]-o[1],s[0]-o[0]):(e===o?(o=t[1],s=t[0]):(o=t[0],s=t[1]),Math.atan2(o[0]-s[0],s[1]-o[1]))}function Fm(r,t){return t[+(t.left!==r.site)]}function rN(r,t){return t[+(t.left===r.site)]}function F1(){for(var r=0,t=mi.length,e,o,s,u;r<t;++r)if((e=mi[r])&&(u=(o=e.halfedges).length)){var c=new Array(u),h=new Array(u);for(s=0;s<u;++s)c[s]=s,h[s]=nN(e,Or[o[s]]);for(c.sort(function(p,d){return h[d]-h[p]}),s=0;s<u;++s)h[s]=o[c[s]];for(s=0;s<u;++s)o[s]=h[s]}}function U1(r,t,e,o){var s=mi.length,u,c,h,p,d,m,y,v,E,b,A,_,x=!0;for(u=0;u<s;++u)if(c=mi[u]){for(h=c.site,d=c.halfedges,p=d.length;p--;)Or[d[p]]||d.splice(p,1);for(p=0,m=d.length;p<m;)b=rN(c,Or[d[p]]),A=b[0],_=b[1],y=Fm(c,Or[d[++p%m]]),v=y[0],E=y[1],(Math.abs(A-v)>Cn||Math.abs(_-E)>Cn)&&(d.splice(p,0,Or.push(Nu(h,b,Math.abs(A-r)<Cn&&o-_>Cn?[r,Math.abs(v-r)<Cn?E:o]:Math.abs(_-o)<Cn&&e-A>Cn?[Math.abs(E-o)<Cn?v:e,o]:Math.abs(A-e)<Cn&&_-t>Cn?[e,Math.abs(v-e)<Cn?E:t]:Math.abs(_-t)<Cn&&A-r>Cn?[Math.abs(E-t)<Cn?v:r,t]:null))-1),++m);m&&(x=!1)}if(x){var T,w,R,G=1/0;for(u=0,x=null;u<s;++u)(c=mi[u])&&(h=c.site,T=h[0]-r,w=h[1]-t,R=T*T+w*w,R<G&&(G=R,x=c));if(x){var z=[r,t],F=[r,o],I=[e,o],lt=[e,t];x.halfedges.push(Or.push(Nu(h=x.site,z,F))-1,Or.push(Nu(h,F,I))-1,Or.push(Nu(h,I,lt))-1,Or.push(Nu(h,lt,z))-1)}}for(u=0;u<s;++u)(c=mi[u])&&(c.halfedges.length||delete mi[u])}var B1=[],Yh;function iN(){Ru(this),this.x=this.y=this.arc=this.site=this.cy=null}function ma(r){var t=r.P,e=r.N;if(!(!t||!e)){var o=t.site,s=r.site,u=e.site;if(o!==u){var c=s[0],h=s[1],p=o[0]-c,d=o[1]-h,m=u[0]-c,y=u[1]-h,v=2*(p*y-d*m);if(!(v>=-z1)){var E=p*p+d*d,b=m*m+y*y,A=(y*E-d*b)/v,_=(p*b-m*E)/v,x=B1.pop()||new iN;x.arc=r,x.site=s,x.x=A+c,x.y=(x.cy=_+h)+Math.sqrt(A*A+_*_),r.circle=x;for(var T=null,w=Ou._;w;)if(x.y<w.y||x.y===w.y&&x.x<=w.x)if(w.L)w=w.L;else{T=w.P;break}else if(w.R)w=w.R;else{T=w;break}Ou.insert(T,x),T||(Yh=x)}}}}function ga(r){var t=r.circle;t&&(t.P||(Yh=t.N),Ou.remove(t),B1.push(t),Ru(t),r.circle=null)}var k1=[];function oN(){Ru(this),this.edge=this.site=this.circle=null}function G1(r){var t=k1.pop()||new oN;return t.site=r,t}function Um(r){ga(r),ya.remove(r),k1.push(r),Ru(r)}function H1(r){var t=r.circle,e=t.x,o=t.cy,s=[e,o],u=r.P,c=r.N,h=[r];Um(r);for(var p=u;p.circle&&Math.abs(e-p.circle.x)<Cn&&Math.abs(o-p.circle.cy)<Cn;)u=p.P,h.unshift(p),Um(p),p=u;h.unshift(p),ga(p);for(var d=c;d.circle&&Math.abs(e-d.circle.x)<Cn&&Math.abs(o-d.circle.cy)<Cn;)c=d.N,h.push(d),Um(d),d=c;h.push(d),ga(d);var m=h.length,y;for(y=1;y<m;++y)d=h[y],p=h[y-1],Gl(d.edge,p.site,d.site,s);p=h[0],d=h[m-1],d.edge=Lu(p.site,d.site,null,s),ma(p),ma(d)}function V1(r){for(var t=r[0],e=r[1],o,s,u,c,h=ya._;h;)if(u=q1(h,e)-t,u>Cn)h=h.L;else if(c=t-sN(h,e),c>Cn){if(!h.R){o=h;break}h=h.R}else{u>-Cn?(o=h.P,s=h):c>-Cn?(o=h,s=h.N):o=s=h;break}D1(r);var p=G1(r);if(ya.insert(o,p),!(!o&&!s)){if(o===s){ga(o),s=G1(o.site),ya.insert(p,s),p.edge=s.edge=Lu(o.site,p.site),ma(o),ma(s);return}if(!s){p.edge=Lu(o.site,p.site);return}ga(o),ga(s);var d=o.site,m=d[0],y=d[1],v=r[0]-m,E=r[1]-y,b=s.site,A=b[0]-m,_=b[1]-y,x=2*(v*_-E*A),T=v*v+E*E,w=A*A+_*_,R=[(_*T-E*w)/x+m,(v*w-A*T)/x+y];Gl(s.edge,d,b,R),p.edge=Lu(d,r,null,R),s.edge=Lu(r,b,null,R),ma(o),ma(s)}}function q1(r,t){var e=r.site,o=e[0],s=e[1],u=s-t;if(!u)return o;var c=r.P;if(!c)return-1/0;e=c.site;var h=e[0],p=e[1],d=p-t;if(!d)return h;var m=h-o,y=1/u-1/d,v=m/d;return y?(-v+Math.sqrt(v*v-2*y*(m*m/(-2*d)-p+d/2+s-u/2)))/y+o:(o+h)/2}function sN(r,t){var e=r.N;if(e)return q1(e,t);var o=r.site;return o[1]===t?o[0]:1/0}var Cn=1e-6,z1=1e-12,ya,mi,Ou,Or;function aN(r,t,e){return(r[0]-e[0])*(t[1]-r[1])-(r[0]-t[0])*(e[1]-r[1])}function uN(r,t){return t[1]-r[1]||t[0]-r[0]}function Zh(r,t){var e=r.sort(uN).pop(),o,s,u;for(Or=[],mi=new Array(r.length),ya=new Dm,Ou=new Dm;;)if(u=Yh,e&&(!u||e[1]<u.y||e[1]===u.y&&e[0]<u.x))(e[0]!==o||e[1]!==s)&&(V1(e),o=e[0],s=e[1]),e=r.pop();else if(u)H1(u.arc);else break;if(F1(),t){var c=+t[0][0],h=+t[0][1],p=+t[1][0],d=+t[1][1];O1(c,h,p,d),U1(c,h,p,d)}this.edges=Or,this.cells=mi,ya=Ou=Or=mi=null}Zh.prototype={constructor:Zh,polygons:function(){var r=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(o){return Fm(t,r[o])});return e.data=t.site.data,e})},triangles:function(){var r=[],t=this.edges;return this.cells.forEach(function(e,o){if(h=(u=e.halfedges).length)for(var s=e.site,u,c=-1,h,p,d=t[u[h-1]],m=d.left===s?d.right:d.left;++c<h;)p=m,d=t[u[c]],m=d.left===s?d.right:d.left,p&&m&&o<p.index&&o<m.index&&aN(s,p,m)<0&&r.push([s.data,p.data,m.data])}),r},links:function(){return this.edges.filter(function(r){return r.right}).map(function(r){return{source:r.left.data,target:r.right.data}})},find:function(r,t,e){for(var o=this,s,u=o._found||0,c=o.cells.length,h;!(h=o.cells[u]);)if(++u>=c)return null;var p=r-h.site[0],d=t-h.site[1],m=p*p+d*d;do h=o.cells[s=u],u=null,h.halfedges.forEach(function(y){var v=o.edges[y],E=v.left;if(!((E===h.site||!E)&&!(E=v.right))){var b=r-E[0],A=t-E[1],_=b*b+A*A;_<m&&(m=_,u=E.index)}});while(u!==null);return o._found=s,e==null||m<=e*e?h.site:null}};var gN=tr(Du(),1);var jm=tr(Z1(),1);function Mi(){return new Kh}function Kh(){this.reset()}Kh.prototype={constructor:Kh,reset:function(){this.s=this.t=0},add:function(r){$1(Jh,r,this.t),$1(this,Jh.s,this.s),this.s?this.t+=Jh.t:this.s=Jh.t},valueOf:function(){return this.s}};var Jh=new Kh;function $1(r,t,e){var o=r.s=t+e,s=o-t,u=o-s;r.t=t-u+(e-s)}var gn=1e-6;var Sn=Math.PI,vr=Sn/2,jh=Sn/4,Co=Sn*2,va=180/Sn,wi=Sn/180,Jn=Math.abs,ho=Math.atan,Si=Math.atan2,hn=Math.cos;var Qh=Math.exp;var kl=Math.log;var we=Math.sin;var qr=Math.sqrt,Hl=Math.tan;function Gm(r){return r>1?0:r<-1?Sn:Math.acos(r)}function gi(r){return r>1?vr:r<-1?-vr:Math.asin(r)}function fo(){}var yN=Mi(),SH=Mi();function _a(r){var t=r[0],e=r[1],o=hn(e);return[o*hn(t),o*we(t),we(e)]}function Vl(r,t){return[r[1]*t[2]-r[2]*t[1],r[2]*t[0]-r[0]*t[2],r[0]*t[1]-r[1]*t[0]]}function ql(r){var t=qr(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);r[0]/=t,r[1]/=t,r[2]/=t}var OH=Mi();function K1(r,t){return[r>Sn?r-Co:r<-Sn?r+Co:r,t]}K1.invert=K1;function km(){var r=[],t;return{point:function(e,o){t.push([e,o])},lineStart:function(){r.push(t=[])},lineEnd:fo,rejoin:function(){r.length>1&&r.push(r.pop().concat(r.shift()))},result:function(){var e=r;return r=[],t=null,e}}}function Hm(r,t){return Jn(r[0]-t[0])<gn&&Jn(r[1]-t[1])<gn}function tf(r,t,e,o){this.x=r,this.z=t,this.o=e,this.e=o,this.v=!1,this.n=this.p=null}function Vm(r,t,e,o,s){var u=[],c=[],h,p;if(r.forEach(function(b){if(!((A=b.length-1)<=0)){var A,_=b[0],x=b[A],T;if(Hm(_,x)){for(s.lineStart(),h=0;h<A;++h)s.point((_=b[h])[0],_[1]);s.lineEnd();return}u.push(T=new tf(_,b,null,!0)),c.push(T.o=new tf(_,null,T,!1)),u.push(T=new tf(x,b,null,!1)),c.push(T.o=new tf(x,null,T,!0))}}),!!u.length){for(c.sort(t),j1(u),j1(c),h=0,p=c.length;h<p;++h)c[h].e=e=!e;for(var d=u[0],m,y;;){for(var v=d,E=!0;v.v;)if((v=v.n)===d)return;m=v.z,s.lineStart();do{if(v.v=v.o.v=!0,v.e){if(E)for(h=0,p=m.length;h<p;++h)s.point((y=m[h])[0],y[1]);else o(v.x,v.n.x,1,s);v=v.n}else{if(E)for(m=v.p.z,h=m.length-1;h>=0;--h)s.point((y=m[h])[0],y[1]);else o(v.x,v.p.x,-1,s);v=v.p}v=v.o,m=v.z,E=!E}while(!v.v);s.lineEnd()}}}function j1(r){if(t=r.length){for(var t,e=0,o=r[0],s;++e<t;)o.n=s=r[e],s.p=o,o=s;o.n=s=r[0],s.p=o}}function Rs(r,t){return r<t?-1:r>t?1:r>=t?0:NaN}function qm(r){return r.length===1&&(r=xN(r)),{left:function(t,e,o,s){for(o==null&&(o=0),s==null&&(s=t.length);o<s;){var u=o+s>>>1;r(t[u],e)<0?o=u+1:s=u}return o},right:function(t,e,o,s){for(o==null&&(o=0),s==null&&(s=t.length);o<s;){var u=o+s>>>1;r(t[u],e)>0?s=u:o=u+1}return o}}}function xN(r){return function(t,e){return Rs(r(t),e)}}var Q1=qm(Rs),EN=Q1.right,MN=Q1.left;var tE=Array.prototype,SN=tE.slice,bN=tE.map;var AV=Math.sqrt(50),TV=Math.sqrt(10),CV=Math.sqrt(2);function nf(r){for(var t=r.length,e,o=-1,s=0,u,c;++o<t;)s+=r[o].length;for(u=new Array(s);--t>=0;)for(c=r[t],e=c.length;--e>=0;)u[--s]=c[e];return u}var NN=1e9,h8=-NN;var Wm=Mi();function Xm(r,t){var e=t[0],o=t[1],s=[we(e),-hn(e),0],u=0,c=0;Wm.reset();for(var h=0,p=r.length;h<p;++h)if(m=(d=r[h]).length)for(var d,m,y=d[m-1],v=y[0],E=y[1]/2+jh,b=we(E),A=hn(E),_=0;_<m;++_,v=T,b=R,A=G,y=x){var x=d[_],T=x[0],w=x[1]/2+jh,R=we(w),G=hn(w),z=T-v,F=z>=0?1:-1,I=F*z,lt=I>Sn,L=b*R;if(Wm.add(Si(L*F*we(I),A*G+L*hn(I))),u+=lt?z+F*Co:z,lt^v>=e^T>=e){var W=Vl(_a(y),_a(x));ql(W);var V=Vl(s,W);ql(V);var wt=(lt^z>=0?-1:1)*gi(V[2]);(o>wt||o===wt&&(W[0]||W[1]))&&(c+=lt^z>=0?1:-1)}}return(u<-gn||u<gn&&Wm<-gn)^c&1}var E8=Mi();var G8=Mi(),k8=Mi();var FN=1/0;var q8=-FN;function Ym(r){this._context=r}Ym.prototype={_radius:4.5,pointRadius:function(r){return this._radius=r,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(r,t){switch(this._point){case 0:{this._context.moveTo(r,t),this._point=1;break}case 1:{this._context.lineTo(r,t);break}default:{this._context.moveTo(r+this._radius,t),this._context.arc(r,t,this._radius,0,Co);break}}},result:fo};var tq=Mi();function Zm(){this._string=[]}Zm.prototype={_radius:4.5,_circle:rE(4.5),pointRadius:function(r){return(r=+r)!==this._radius&&(this._radius=r,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(r,t){switch(this._point){case 0:{this._string.push("M",r,",",t),this._point=1;break}case 1:{this._string.push("L",r,",",t);break}default:{this._circle==null&&(this._circle=rE(this._radius)),this._string.push("M",r,",",t,this._circle);break}}},result:function(){if(this._string.length){var r=this._string.join("");return this._string=[],r}else return null}};function rE(r){return"m0,"+r+"a"+r+","+r+" 0 1,1 0,"+-2*r+"a"+r+","+r+" 0 1,1 0,"+2*r+"z"}function $m(r,t,e,o){return function(s,u){var c=t(u),h=s.invert(o[0],o[1]),p=km(),d=t(p),m=!1,y,v,E,b={point:A,lineStart:x,lineEnd:T,polygonStart:function(){b.point=w,b.lineStart=R,b.lineEnd=G,v=[],y=[]},polygonEnd:function(){b.point=A,b.lineStart=x,b.lineEnd=T,v=nf(v);var z=Xm(y,h);v.length?(m||(u.polygonStart(),m=!0),Vm(v,zN,z,e,u)):z&&(m||(u.polygonStart(),m=!0),u.lineStart(),e(null,null,1,u),u.lineEnd()),m&&(u.polygonEnd(),m=!1),v=y=null},sphere:function(){u.polygonStart(),u.lineStart(),e(null,null,1,u),u.lineEnd(),u.polygonEnd()}};function A(z,F){var I=s(z,F);r(z=I[0],F=I[1])&&u.point(z,F)}function _(z,F){var I=s(z,F);c.point(I[0],I[1])}function x(){b.point=_,c.lineStart()}function T(){b.point=A,c.lineEnd()}function w(z,F){E.push([z,F]);var I=s(z,F);d.point(I[0],I[1])}function R(){d.lineStart(),E=[]}function G(){w(E[0][0],E[0][1]),d.lineEnd();var z=d.clean(),F=p.result(),I,lt=F.length,L,W,V;if(E.pop(),y.push(E),E=null,!!lt){if(z&1){if(W=F[0],(L=W.length-1)>0){for(m||(u.polygonStart(),m=!0),u.lineStart(),I=0;I<L;++I)u.point((V=W[I])[0],V[1]);u.lineEnd()}return}lt>1&&z&2&&F.push(F.pop().concat(F.shift())),v.push(F.filter(BN))}}return b}}function BN(r){return r.length>1}function zN(r,t){return((r=r.x)[0]<0?r[1]-vr-gn:vr-r[1])-((t=t.x)[0]<0?t[1]-vr-gn:vr-t[1])}var GN=$m(function(){return!0},kN,VN,[-Sn,-vr]);function kN(r){var t=NaN,e=NaN,o=NaN,s;return{lineStart:function(){r.lineStart(),s=1},point:function(u,c){var h=u>0?Sn:-Sn,p=Jn(u-t);Jn(p-Sn)<gn?(r.point(t,e=(e+c)/2>0?vr:-vr),r.point(o,e),r.lineEnd(),r.lineStart(),r.point(h,e),r.point(u,e),s=0):o!==h&&p>=Sn&&(Jn(t-o)<gn&&(t-=o*gn),Jn(u-h)<gn&&(u-=h*gn),e=HN(t,e,u,c),r.point(o,e),r.lineEnd(),r.lineStart(),r.point(h,e),s=0),r.point(t=u,e=c),o=h},lineEnd:function(){r.lineEnd(),t=e=NaN},clean:function(){return 2-s}}}function HN(r,t,e,o){var s,u,c=we(r-e);return Jn(c)>gn?ho((we(t)*(u=hn(o))*we(e)-we(o)*(s=hn(t))*we(r))/(s*u*c)):(t+o)/2}function VN(r,t,e,o){var s;if(r==null)s=e*vr,o.point(-Sn,s),o.point(0,s),o.point(Sn,s),o.point(Sn,0),o.point(Sn,-s),o.point(0,-s),o.point(-Sn,-s),o.point(-Sn,0),o.point(-Sn,s);else if(Jn(r[0]-t[0])>gn){var u=r[0]<t[0]?Sn:-Sn;s=e*u/2,o.point(-u,s),o.point(0,s),o.point(u,s)}else o.point(t[0],t[1])}function rf(r){return function(t){var e=new Jm;for(var o in r)e[o]=r[o];return e.stream=t,e}}function Jm(){}Jm.prototype={constructor:Jm,point:function(r,t){this.stream.point(r,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var kq=hn(30*wi);var eW=rf({point:function(r,t){this.stream.point(r*wi,t*wi)}});function of(r){return function(t,e){var o=hn(t),s=hn(e),u=r(o*s);return[u*s*we(t),u*we(e)]}}function Po(r){return function(t,e){var o=qr(t*t+e*e),s=r(o),u=we(s),c=hn(s);return[Si(t*u,o*c),gi(o&&e*u/o)]}}var cE=of(function(r){return qr(2/(1+r))});cE.invert=Po(function(r){return 2*gi(r/2)});var hE=of(function(r){return(r=Gm(r))&&r/we(r)});hE.invert=Po(function(r){return r});function Km(r,t){return[r,kl(Hl((vr+t)/2))]}Km.invert=function(r,t){return[r,2*ho(Qh(t))-vr]};function sf(r,t){return[r,t]}sf.invert=sf;function fE(r,t){var e=hn(t),o=hn(r)*e;return[e*we(r)/o,we(t)/o]}fE.invert=Po(ho);function pE(r,t){var e=t*t,o=e*e;return[r*(.8707-.131979*e+o*(-.013791+o*(.003971*e-.001529*o))),t*(1.007226+e*(.015085+o*(-.044475+.028874*e-.005916*o)))]}pE.invert=function(r,t){var e=t,o=25,s;do{var u=e*e,c=u*u;e-=s=(e*(1.007226+u*(.015085+c*(-.044475+.028874*u-.005916*c)))-t)/(1.007226+u*(.015085*3+c*(-.044475*7+.028874*9*u-.005916*11*c)))}while(Jn(s)>gn&&--o>0);return[r/(.8707+(u=e*e)*(-.131979+u*(-.013791+u*u*u*(.003971-.001529*u)))),e]};function dE(r,t){return[hn(t)*we(r),we(t)]}dE.invert=Po(gi);function mE(r,t){var e=hn(t),o=1+hn(r)*e;return[e*we(r)/o,we(t)/o]}mE.invert=Po(function(r){return 2*ho(r)});function gE(r,t){return[kl(Hl((vr+t)/2)),-r]}gE.invert=function(r,t){return[-t,2*ho(Qh(r))-vr]};var $N=tr(Du(),1);var JN=tr(Du(),1);var jN=tr(Du(),1);var QN=tr(Du(),1);function vE(r){return r.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function _E(r){let t={};for(let o in r)o.startsWith("on")&&(t[vE(o.slice(2))]=r[o],t[o]=r[o]);let e=s=>Kl(this,[s],function*({data:o}){if(t[o.type])try{let u=yield t[o.type](o.data);if(u!=null&&u.$transfer&&Array.isArray(u.$transfer)){let c=u.$transfer;delete u.$transfer,self.postMessage({type:\`\${o.type}_result\`,key:o.key,data:u},c)}else self.postMessage({type:\`\${o.type}_result\`,key:o.key,data:u})}catch(u){self.postMessage({type:\`\${o.type}_result\`,key:o.key,error:u})}else self.postMessage({type:\`\${o.type}_result\`,key:o.key,error:"no_event"})});return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}function Uu(r,t=!1){let e=r[0].index!==null,o=new Set(Object.keys(r[0].attributes)),s=new Set(Object.keys(r[0].morphAttributes)),u={},c={},h=r[0].morphTargetsRelative,p=new Ei,d=0;for(let m=0;m<r.length;++m){let y=r[m],v=0;if(e!==(y.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+m+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let E in y.attributes){if(!o.has(E))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+m+'. All geometries must have compatible attributes; make sure "'+E+'" attribute exists among all geometries, or in none of them.'),null;u[E]===void 0&&(u[E]=[]),u[E].push(y.attributes[E]),v++}if(v!==o.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+m+". Make sure all geometries have the same number of attributes."),null;if(h!==y.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+m+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let E in y.morphAttributes){if(!s.has(E))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+m+". .morphAttributes must be consistent throughout all geometries."),null;c[E]===void 0&&(c[E]=[]),c[E].push(y.morphAttributes[E])}if(t){let E;if(e)E=y.index.count;else if(y.attributes.position!==void 0)E=y.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+m+". The geometry must have either an index or a position attribute"),null;p.addGroup(d,E,m),d+=E}}if(e){let m=0,y=[];for(let v=0;v<r.length;++v){let E=r[v].index;for(let b=0;b<E.count;++b)y.push(E.getX(b)+m);m+=r[v].attributes.position.count}p.setIndex(y)}for(let m in u){let y=xE(u[m]);if(!y)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+m+" attribute."),null;p.setAttribute(m,y)}for(let m in c){let y=c[m][0].length;if(y===0)break;p.morphAttributes=p.morphAttributes||{},p.morphAttributes[m]=[];for(let v=0;v<y;++v){let E=[];for(let A=0;A<c[m].length;++A)E.push(c[m][A][v]);let b=xE(E);if(!b)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+m+" morphAttribute."),null;p.morphAttributes[m].push(b)}}return p}function xE(r){let t,e,o,s=-1,u=0;for(let d=0;d<r.length;++d){let m=r[d];if(t===void 0&&(t=m.array.constructor),t!==m.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(e===void 0&&(e=m.itemSize),e!==m.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(o===void 0&&(o=m.normalized),o!==m.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(s===-1&&(s=m.gpuType),s!==m.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;u+=m.count*e}let c=new t(u),h=new qn(c,e,o),p=0;for(let d=0;d<r.length;++d){let m=r[d];if(m.isInterleavedBufferAttribute){let y=p/e;for(let v=0,E=m.count;v<E;v++)for(let b=0;b<e;b++){let A=m.getComponent(v,b);h.setComponent(v+y,b,A)}}else c.set(m.array,p);p+=m.count*e}return s!==void 0&&(h.gpuType=s),h}function EE(r,t=!0,e=!1){let o=r.filter(h=>h.geometry.type==="polygon");if(!o.length)return null;let s=o.map(h=>{let p=h.geometry.coords,d=pu(p[0],p.slice(1)),m=new cu(d,{steps:1,bevelEnabled:!1,depth:h.height,curveSegments:4});h.deltaHeight||(h.deltaHeight=0),m.translate(0,0,h.airHeight+h.deltaHeight);let y=m.attributes.position.count,v=new Float32Array(y).fill(h.height+h.airHeight+h.deltaHeight);if(m.setAttribute("maxZ",new qn(v,1)),m.setAttribute("opacity",new qn(new Float32Array(y).fill(h.fillOpacity),1)),e){let A=new Float32Array(y).fill(h.airHeight+h.deltaHeight);m.setAttribute("minZ",new qn(A,1))}let E=new cn(h.fillColor).convertLinearToSRGB(),b=new Float32Array(y*3);for(let A=0;A<y;A++)b[A*3]=E.r,b[A*3+1]=E.g,b[A*3+2]=E.b;return m.setAttribute("color",new qn(b,3)),m}),u=Uu(s);s.forEach(h=>h.dispose());let c={geometry:u};return u.dispose(),t&&(c.lineGeometry=Qm(o)||void 0),c}function Qm(r){let{points:t,colors:e,opacities:o}=u2(r);if(!t.length)return null;let s=new Ei().setFromPoints(t);return s.setAttribute("color",new qn(new Float32Array(e),3)),s.setAttribute("opacity",new qn(new Float32Array(o),1)),s}function u2(r){let t=[],e=[],o=[];return r.filter(s=>s.strokeOpacity>0).map(s=>{let u=s.height+(s.deltaHeight||0)+s.airHeight,{coords:c}=s.geometry,{strokeColor:h,strokeOpacity:p}=s,d=new cn(h).convertLinearToSRGB();for(let m=0;m<c.length;m++){let y=c[m];for(let v=0;v<y.length;v++){let E=y[v],b=v+1===y.length?y[0]:y[v+1];t.push(new st(E[0],E[1],u)),t.push(new st(b[0],b[1],u)),e.push(d.r,d.g,d.b),e.push(d.r,d.g,d.b),o.push(p),o.push(p)}}}),{points:t,colors:e,opacities:o}}_E({onGetMergedGeometryAttributes({data:r}){let t=r.map(s=>{let u=s.geometry.coords,c=pu(u[0],u.slice(1));return new cu(c,{steps:1,bevelEnabled:!1,depth:s.height,curveSegments:4})}),e=Uu(t);t.forEach(s=>s.dispose());let o={attributes:e.attributes,index:e.index,morphAttributes:e.morphAttributes,morphTargetsRelative:e.morphTargetsRelative,groups:e.groups,boundingSphere:e.boundingSphere};return e.dispose(),o},onGetMergedShapeGeometryAttributes({data:r}){let t=r.map(s=>{var m;let u=pu(s.geometry.coords[0].slice(0,-1),s.geometry.coords.slice(1)),c=new gl(u,4),h=c.getAttribute("position"),p=[],d=new cn(s.fillColor);for(let y=0;y<h.count;y++)h.setZ(y,s.airHeight+(s.deltaHeight||0)),p.push(d.r,d.g,d.b,(m=s.fillOpacity)!=null?m:1);return c.setAttribute("color",new qn(new Float32Array(p),4)),c}),e=Uu(t);t.forEach(s=>s.dispose());let o={attributes:e.attributes,index:e.index,morphAttributes:e.morphAttributes,morphTargetsRelative:e.morphTargetsRelative,groups:e.groups,boundingSphere:e.boundingSphere};return e.dispose(),o},onGetMergedTexture2dShapeGeometryAttributes({data:r}){let t=r.map(s=>{let u=pu(s.geometry.coords[0].slice(0,-1),s.geometry.coords.slice(1)),c=new gl(u,4),h=c.getAttribute("position"),p=[1,1,1,0,0,0,0,1];c.setAttribute("uv",new Gr(p,2));let d=s.height+(s.deltaHeight||0)+s.airHeight;for(let m=0;m<h.count;m++)h.setZ(m,d);return c}),e=Uu(t);t.forEach(s=>s.dispose());let o={attributes:e.attributes,index:e.index,morphAttributes:e.morphAttributes,morphTargetsRelative:e.morphTargetsRelative,groups:e.groups,boundingSphere:e.boundingSphere};return e.dispose(),o},onGetMergedGeometriesJson({data:r}){let t=EE(r,!1);return t?{mergedGeometry:t.geometry.toJSON()}:null},onGetMergedGeometriesLineJson({data:r}){let t=Qm(r);return t?{lineGeometry:t.toJSON()}:null}});
|
|
8052
|
-
`],{type:"text/javascript"}),t=URL.createObjectURL(a),e=new Worker(t);return URL.revokeObjectURL(t),e}var qn=require("three");var rn=class{static GetMergeGeometry(t){return g(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield nn(e,"get_merged_geometry_attributes",{data:t}),r=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),r})}static GetMergedShapeGeometry(t){return g(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield nn(e,"get_merged_shape_geometry_attributes",{data:t}),r=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),r})}static GetMergedTexture2dGeometry(t){return g(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield nn(e,"get_merged_texture2d_shape_geometry_attributes",{data:t}),r=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),r})}static GetBufferGeometryByData(t){let e=new qn.BufferGeometry;return Object.keys(t.attributes).forEach(n=>{e.setAttribute(n,new qn.BufferAttribute(t.attributes[n].array,t.attributes[n].itemSize))}),t.index&&e.setIndex(new qn.BufferAttribute(t.index.array,t.index.itemSize)),e.morphAttributes=t.morphAttributes,e.morphTargetsRelative=t.morphTargetsRelative,e.groups=t.groups,e.boundingSphere=t.boundingSphere,e}static GetMergedGeometry(t){return g(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield nn(e,"get_merged_geometries_json",{data:t});return this.WorkerPool.releaseWorker(e),n?wn(wn({},t[0]),n):null})}static GetMergedGeometryLine(t){return g(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield nn(e,"get_merged_geometries_line_json",{data:t});return this.WorkerPool.releaseWorker(e),n?wn(wn({},t[0]),n):null})}static dispose(){this.WorkerPool.dispose()}};ht(rn,"WorkerPool",new Gr(10,ki));var jn=class extends nt{getCenter(){return new kt.Box3().setFromObject(this).getCenter(new kt.Vector3)}addInstancedGraphic(t){this.instancedGraphicConfig?(this.instancedGraphicConfig.size+=t.size,this.instancedGraphicConfig.colors=[...this.instancedGraphicConfig.colors,...t.colors],this.instancedGraphicConfig.matrixes=[...this.instancedGraphicConfig.matrixes,...t.matrixes],this.instancedGraphicConfig.opacities=[...this.instancedGraphicConfig.opacities,...t.opacities],this.instancedGraphicConfig.maxZs=[...this.instancedGraphicConfig.maxZs,...t.maxZs],this.instancedGraphicConfig.ids=[...this.instancedGraphicConfig.ids,...t.ids]):this.instancedGraphicConfig=t,this.refeshInstancedGraphic()}refeshInstancedGraphic(){this.instancedGraphic&&(this.remove(this.instancedGraphic),F(this.instancedGraphic)),this.instancedGraphicConfig&&(this.instancedGraphic=new Ye(this.context,this.instancedGraphicConfig),this.add(this.instancedGraphic))}addGraphics(t,e){t.map(n=>{this.graphicDataMap.set(n.id,n),this.graphicOriginOptionMap.set(n.id,{fillOpacity:n.fillOpacity,strokeOpacity:n.strokeOpacity})}),e?e.map(n=>{if(n.instancedGeometry&&this.addInstancedGraphic(n.instancedGeometry),n.mergedGeometry){let r=new on(this.context,v({},n,{lineGeometry:null}));this.mergedGraphicGroup.add(r)}if(n.lineGeometry){let r=new Ne(this.context,n.lineGeometry);this.mergedLineGroup.add(r)}}):(this.refreshMergeGraphic(),this.refreshLine())}createGraphic(t){return g(this,null,function*(){let e=yield rn.GetMergedGeometry(t);if(F(this.mergedGraphicGroup),this.mergedGraphicGroup.clear(),e){let n=new on(this.context,e);this.mergedGraphicGroup.add(n)}})}createLine(t){return g(this,null,function*(){let e=yield rn.GetMergedGeometryLine(t);if(F(this.mergedLineGroup),this.mergedLineGroup.clear(),e){let n=new Ne(this.context,e.lineGeometry);this.mergedLineGroup.add(n)}})}refreshMergeGraphic(){let t=Array.from(this.graphicDataMap.values());this.instancedGraphicConfig&&(t=t.filter(e=>{var n;return!((n=this.instancedGraphicConfig)!=null&&n.ids.includes(e.id))})),this.createGraphic(t)}refreshLine(){let t=Array.from(this.graphicDataMap.values());this.createLine(t)}removeGraphicById(t){var e;if(this.graphicDataMap.delete(t),(e=this.instancedGraphicConfig)!=null&&e.ids.includes(t)){let n=this.instancedGraphicConfig.ids.findIndex(r=>r===t);this.instancedGraphicConfig.size--,this.instancedGraphicConfig.colors.splice(n*3,3),this.instancedGraphicConfig.matrixes.splice(n*16,16),this.instancedGraphicConfig.opacities.splice(n,1),this.instancedGraphicConfig.maxZs.splice(n,1),this.instancedGraphicConfig.ids.splice(n,1),this.refeshInstancedGraphic()}else this.refreshMergeGraphic();this.refreshLine()}getGraphicDataByNodeId(t){return this.graphicMap.get(t)||null}setGraphicOptions(t,e){var n;let r,i=this.graphicDataMap.get(t);if(i){if(typeof e=="function"?r=e(i):r=v({},i,e),this.graphicDataMap.set(t,r),(n=this.instancedGraphicConfig)!=null&&n.ids.includes(t)&&this.instancedGraphic){this.instancedGraphic.setColorById(t,r.fillColor),this.instancedGraphic.setOpacityById(t,r.fillOpacity),this.instancedGraphic.setMaxZById(t,r.deltaHeight+r.airHeight+r.height);let o=this.instancedGraphicConfig.ids.findIndex(p=>p===t),s=this.instancedGraphicConfig.matrixes.slice(o*16,(o+1)*16),u=new kt.Matrix4().fromArray(s),l=new kt.Vector3,c=new kt.Quaternion,h=new kt.Vector3;u.decompose(l,c,h),h.z=r.height,l.z=r.deltaHeight+r.airHeight+r.height/2,u.compose(l,c,h),this.instancedGraphic.setMatrixById(t,u)}else this.refreshMergeGraphic();this.refreshLine()}}getGraphicPosition(t){let e=this.graphicDataMap.get(t);return e?[e.center_x,e.center_y]:null}setOpacity(t,e){e===void 0&&(e=!1);var n;this.graphicDataMap.forEach((r,i)=>{if(e)r.fillOpacity=t,r.strokeOpacity=t;else{let u=this.graphicOriginOptionMap.get(i);var o;r.fillOpacity=Math.min(t,(o=u==null?void 0:u.fillOpacity)!=null?o:1);var s;r.strokeOpacity=Math.min(t,(s=u==null?void 0:u.strokeOpacity)!=null?s:1)}}),(n=this.instancedGraphic)==null||n.setOpacity(t,e),this.refeshInstancedGraphic(),this.refreshLine()}dispose(){super.dispose(),this.mergedGraphicGroup.clear(),this.mergedLineGroup.clear(),this.instancedGraphic=null,this.instancedGraphicConfig=null}constructor(t){super(t),this.graphicMap=new Map,this.mergedGraphicGroup=new kt.Group,this.mergedLineGroup=new kt.Group,this.graphicDataMap=new Map,this.graphicOriginOptionMap=new Map,this.instancedGraphic=null,this.instancedGraphicConfig=null,this.add(this.mergedGraphicGroup),this.add(this.mergedLineGroup)}};var pd=require("core-js/modules/web.dom-collections.iterator.js"),fd=require("core-js/modules/es.array.push.js");var _t=require("three");var od=require("core-js/modules/es.string.replace.js"),sd=require("core-js/modules/es.regexp.exec.js"),ad=require("core-js/modules/es.error.cause.js"),ud=require("core-js/modules/web.dom-collections.iterator.js"),kr=require("three");var Yn=class{setBaseUrl(t){this.baseUrl=t.replace(/\/$/,"")}setConfig(t){this.config=t}loadConfig(){return g(this,null,function*(){if(this.config)return this.config;if(!this.baseUrl)throw new Error("Base URL is not set");try{let t=yield fetch(""+this.baseUrl+"/config.json");return this.config=yield t.json(),this.config}catch(t){return console.error("Failed to load tile config:",t),this.config={extent:[12276734621488994e-9,2.1183542845726013e6,12279646804065457e-9,2121524247761597e-9],maxZoom:21,minZoom:11},this.config}})}buildTileUrl(t,e,n){if(!this.baseUrl)throw new Error("Base URL is not set");return this.baseUrl+"/"+n+"/"+t+"/"+e+".png"}loadTileTexture(t,e,n){return g(this,null,function*(){if(!this.baseUrl)throw new Error("Base URL is not set");let r=this.buildTileUrl(t,e,n);if(this.textureCache.has(r)){let o=this.textureCache.get(r);return o instanceof Promise?o:Promise.resolve(o)}let i=this.textureLoader.loadAsync(r).then(o=>(o.flipY=!0,o.colorSpace=kr.SRGBColorSpace,this.textureCache.set(r,o),o)).catch(o=>null);return this.textureCache.set(r,i),i})}clearCache(){this.textureCache.forEach(t=>{t instanceof Promise?t.then(e=>e==null?void 0:e.dispose()):t.dispose()}),this.textureCache.clear()}dispose(){this.clearCache()}constructor(t){this.baseUrl="",this.config=null,this.textureCache=new Map,this.textureLoader=new kr.TextureLoader,t&&this.setBaseUrl(t)}};var Fs=require("lodash");var Us={base_url:"https://robot-vr-public.aibee.cn/static_resource/tiles"},sn=class a extends nt{loadTileConfig(){return g(this,null,function*(){return this.tileLoader.loadConfig()})}initEvents(){this.context.addEventListener("control-change",this.onUpdate),this.context.bmap.addEventListener("center-change",this.onCenterChange)}removeEvents(){this.context.removeEventListener("control-change",this.onUpdate),this.context.bmap.removeEventListener("center-change",this.onCenterChange)}getViewBounds(){let t=this.context.camera,e=new _t.Raycaster,n=new _t.Vector2,r=[],[i,o]=this.context.center||[0,0],s=[{x:-1,y:1},{x:1,y:1},{x:1,y:-1},{x:-1,y:-1}];for(let p of s){n.set(p.x,p.y),e.setFromCamera(n,t);let f=new _t.Vector3(0,0,1),d=new _t.Vector3(0,0,0),m=new _t.Plane().setFromNormalAndCoplanarPoint(f,d),y=new _t.Vector3;e.ray.intersectPlane(m,y)?r.push(y):(e.ray.direction.negate(),e.ray.intersectPlane(m,y)&&r.push(y))}if(r.length<4)return null;let u=1/0,l=1/0,c=-1/0,h=-1/0;return r.forEach(p=>{u=Math.min(u,p.x+i),l=Math.min(l,p.y+o),c=Math.max(c,p.x+i),h=Math.max(h,p.y+o)}),{minX:u,minY:l,maxX:c,maxY:h}}getTileZoomLevel(t,e){let{minZoom:n,maxZoom:r}=e,i=this.context.camera,o=(i.right-i.left)/i.zoom,s=this.context.clientSize.width,u=o/s,l=a.WORLD_WIDTH,c=Math.log2(l/(u*this.tileSize));return Math.min(r,Math.max(n,Math.round(c)))}getTilesInView(t,e,n){let[r,i,o,s]=n.extent,u=Math.max(t.minX,r),l=Math.max(t.minY,i),c=Math.min(t.maxX,o),h=Math.min(t.maxY,s);if(u>=c||l>=h)return[];let p=Math.pow(2,e),f=a.WORLD_WIDTH/p,d=a.WORLD_WIDTH_HALF,m=Math.max(0,Math.floor((u+d)/f)),y=Math.floor((c+d)/f),x=Math.max(0,Math.floor((d-h)/f)),E=Math.floor((d-l)/f),S=[];for(let R=m;R<=y;R++)for(let P=x;P<=E;P++)S.push({x:R,y:P,z:e});return S}renderTiles(t,e){return g(this,null,function*(){let n=t,r=[];if(this.currentLevel!==e)r=[...this.tileGroup.children];else{let s=this.tileGroup.children,u=s.map(c=>c.userData.key),l=t.map(c=>c.z+"/"+c.x+"/"+c.y);n=t.filter(c=>!u.includes(c.z+"/"+c.x+"/"+c.y)),r=s.filter(c=>!l.includes(c.userData.key))}let i=Math.pow(2,e),o=a.WORLD_WIDTH/i;yield Promise.all(n.map(s=>g(this,null,function*(){let u=s.z+"/"+s.x+"/"+s.y,l=yield this.tileLoader.loadTileTexture(s.x,s.y,s.z);if(l){let c=new _t.MeshBasicMaterial({map:l,transparent:!0}),h=new _t.Mesh(this.baseGeometry,c);h.scale.setX(o).setY(o),h.position.set((s.x-i/2)*o+o/2,-((s.y-i/2)*o)-o/2,0),h.userData.key=u,this.tileGroup.add(h)}}))),this.tileGroup.children.forEach(s=>{r.includes(s)&&(s.material.dispose(),this.tileGroup.remove(s))})})}setVisibility(t){this.visible=t,t&&this.onUpdate()}setOpacity(t){super.setOpacity(t)}clearTiles(){this.tileGroup.children.forEach(t=>{t.material.dispose()}),this.tileGroup.clear()}dispose(){this.removeEvents(),this.clearTiles(),this.baseGeometry.dispose(),this.tileLoader.dispose(),super.dispose()}constructor(t,e){super(t),this.loadedTiles=new Map,this.currentLevel=0,this.tileSize=256,this.baseGeometry=new _t.PlaneGeometry(1,1),this.options=Us,this.onUpdate=()=>{this.updateTiles()},this.onCenterChange=()=>{let{center:r}=this.context;this.tileGroup.position.set(-r[0],-r[1],0),this.updateTiles()},this.updateTiles=(0,Fs.debounce)(()=>g(this,null,function*(){if(!this.visible)return;let r=yield this.loadTileConfig(),i=this.context.camera,o=this.getViewBounds();if(!o)return;let s=this.getTileZoomLevel(i.zoom,r),u=this.getTilesInView(o,s,r);this.renderTiles(u,s)}),100),this.options=v({},Us,e),this.tileGroup=new _t.Group;let{center:n}=t;this.tileGroup.position.set(-n[0],-n[1],0),this.add(this.tileGroup),this.tileLoader=new Yn(this.options.base_url),this.initEvents(),this.updateTiles()}};sn.WORLD_WIDTH=4007501668e-2;sn.WORLD_WIDTH_HALF=sn.WORLD_WIDTH/2;var vd=require("core-js/modules/es.array.push.js"),xd=require("core-js/modules/web.dom-collections.iterator.js"),Ed=require("core-js/modules/es.string.trim.js");var Tt=require("three");var Oe=require("lodash");var Eu={text:"",icon:"",icon_size:[22,22],level:1,collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},text_font_size:14,icon_rotate:0,depth_test:!1,hide_text:!1,maxWeight:25,minWeight:1,text_opacity:1,icon_opacity:1},st=class extends Tt.Object3D{get hasText(){return!this.options.hide_text&&this.options.text}get durIconAndText(){return this.options.icon&&this.hasText?2:0}get offset(){return this.options.icon&&this.hasText?0:.5}get iconWidth(){return this.options.icon?this.options.icon_size[0]:0}get iconHeight(){return this.options.icon?this.options.icon_size[1]:0}get textWidth(){return this.hasText?this.textHeight*this.textAspect:0}get textHeight(){return this.hasText?this.options.text_font_size*this.textureLines:0}get hasOriginTexture(){let{text_texture:t,text_texture_width:e,text_texture_height:n,text_texture_offset_x:r,text_texture_offset_y:i}=this.options;return!(0,Oe.isNil)(t)&&!(0,Oe.isNil)(e)&&!(0,Oe.isNil)(n)&&!(0,Oe.isNil)(r)&&!(0,Oe.isNil)(i)}get inited(){return!this.options.text||this.options.text&&this.textTexture}get deltaZ(){return this.options.icon&&this.hasText?.1+this.offset*(this.iconHeight+this.durIconAndText+this.textHeight)/this.context.camera.zoom:this.hasText?.1+.5*this.textHeight/this.context.camera.zoom:.1}get canSelect(){return this.visible&&this._shouldShow}show(){return g(this,null,function*(){if(this._shouldShow)return;this._shouldShow=!0;let t=[];if(!this.spriteIcon&&this.options.icon&&t.push(this.initIcon()),!this.spriteText&&this.hasText&&t.push(this.initText()),yield Promise.all(t),!this._shouldShow){this.hide();return}this.initSize(),this._initScale({zoom:this.context.camera.zoom}),this.spriteIcon&&(this.spriteIcon.visible=!0),this.spriteText&&(this.spriteText.visible=!0)})}hide(){this._shouldShow=!1,this.spriteIcon&&(this.remove(this.spriteIcon),this.spriteIcon.material.dispose(),this.spriteIcon=void 0),this.spriteText&&(this.remove(this.spriteText),this.spriteText.material.dispose(),this.spriteText=void 0)}registryEvent(){this.context.addEventListener("control-zoom-change",this._initScale),this.addEventListener("change-icon",t=>g(this,null,function*(){let{value:e}=t;this._shouldShow&&(this.hide(),yield this.show())})),this.addEventListener("change-text",t=>g(this,null,function*(){let{value:e}=t;this._shouldShow&&(this.hide(),yield this.show())})),this.addEventListener("change-text_font_size",t=>g(this,null,function*(){let{value:e}=t;this._shouldShow&&(this.hide(),yield this.show())})),this.addEventListener("change-icon_rotate",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.rotation=e/180*Math.PI)}),this.addEventListener("change-icon_size",t=>{let{value:e}=t;this._shouldShow&&(this.hide(),this.show())}),this.addEventListener("change-depth_test",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.depthTest=e),this.spriteText&&(this.spriteText.material.depthTest=e)}),this.addEventListener("change-icon_opacity",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.opacity=e)}),this.addEventListener("change-text_opacity",t=>{let{value:e}=t;this.spriteText&&(this.spriteText.material.opacity=e)})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}getPosition(){return this.position}initIcon(){return g(this,null,function*(){if(this.options.icon)return this._initIconPromise=new Promise(t=>g(this,null,function*(){let e;if(this.options.icon_border){let{icon:r,icon_size:i,icon_border:o}=this.options;e=yield gt.getUrlTextureBorder(r,i[0]-o.width*2,o)}else e=yield gt.getTextureByUrl(this.options.icon);let n=new Tt.Sprite(new Tt.SpriteMaterial({map:e,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,rotation:this.options.icon_rotate/180*Math.PI,opacity:this.options.icon_opacity}));n.visible=!1,n.renderOrder=1e5+this.options.level,e.needsUpdate=!0,this.add(n),this.spriteIcon=n,t(n)})).then(()=>{this._initIconPromise=null})})}initText(){return g(this,null,function*(){if(this.hasText){let t=this.textTexture;if(!t)return;let e=new Tt.Sprite(new Tt.SpriteMaterial({map:t,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,opacity:this.options.text_opacity}));e.visible=!1,e.renderOrder=100001+this.options.level,t.needsUpdate=!0,this.spriteText=e,this.add(e)}})}initSize(){var t,e;let n=0,r=0,{icon:i}=this.options;i?this.hasText?(n=0,r=n*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(n=.5,r=0):this.hasText?(r=.5,n=0):(n=0,r=0),(t=this.spriteIcon)==null||t.center.set(.5,n),(e=this.spriteText)==null||e.center.set(.5,r)}init(){return g(this,null,function*(){yield Promise.all([this.initIcon(),this.initText()]),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})}resetZ(){let t=this.deltaZ;this.spriteIcon&&(this.spriteIcon.position.z=t),this.spriteText&&(this.spriteText.position.z=t)}getBox(t){if(!this.inited)return this.initTextTexture(),null;let{clientSize:{width:e,height:n}}=this.context,r=e*(t.x+1)/2,i=n*(-t.y+1)/2;i+=this.offset*(this.iconHeight+this.durIconAndText+this.textHeight);let o=this.iconWidth/2,s=new Tt.Box2(new Tt.Vector2(r-o,i-this.iconHeight),new Tt.Vector2(r+o,i)),u=this.textWidth/2,l=new Tt.Box2(new Tt.Vector2(r-u,i-this.textHeight-this.durIconAndText-this.iconHeight),new Tt.Vector2(r+u,i-this.iconHeight-this.durIconAndText));return this.box=l.union(s),this.box}renderBoxHelper(t,e){if(!this.boxHelper){let n=document.createElement("div");n.style.position="absolute",n.style.zIndex="999",n.style.border="1px solid red",n.style.pointerEvents="none",this.boxHelper=n,this.context.container.appendChild(n)}t&&e?(this.boxHelper.style.left=t+"px",this.boxHelper.style.top=e+"px",this.boxHelper.style.width="2px",this.boxHelper.style.height="2px"):(this.boxHelper.style.left=this.box.min.x+"px",this.boxHelper.style.top=this.box.min.y+"px",this.boxHelper.style.width=this.box.max.x-this.box.min.x+"px",this.boxHelper.style.height=this.box.max.y-this.box.min.y+"px")}parentSetVisible(t){t?this.show():this.hide(),this.boxHelper&&(this.boxHelper.style.display=t?"block":"none")}dispose(){this.hide(),this.unRegistryEvent(),this._listeners={}}constructor(t,e){var n;super(),this.context=t,this.textAspect=1,this.box=new Tt.Box2,this._initIconPromise=null,this.textureLines=1,this._shouldShow=!1,this.initTextTexture=(0,Oe.once)(()=>g(this,null,function*(){if(!this.options.text||this.textTexture)return;let i;if(this.hasOriginTexture){let{text_texture:o,text_texture_width:s,text_texture_height:u,text_texture_offset_x:l,text_texture_offset_y:c}=this.options;i=this.options.text_texture.clone(),i.uuid=o.uuid,i.offset.set(l/i.image.width,1-(u+c)/i.image.height),i.repeat.set(s/i.image.width,u/i.image.height),this.textAspect=s/u}else{let o=yield ft.getTextureByText(this.options.text);i=o.texture,this.textureLines=o.lines,this.textAspect=i.image.width/i.image.height}this.textTexture=i,this.dispatchEvent({type:"text-texture-inited"})})),this._initScale=i=>{let{zoom:o}=i;if(this.spriteText){let u=this.textHeight/o;this.spriteText.scale.set(this.textAspect*u,u,.1)}if(this.spriteIcon){var s;(s=this.spriteIcon)==null||s.scale.set(this.options.icon_size[0]/o,this.options.icon_size[1]/o,.1)}this.resetZ()};var r;this.options=Ge(v({},Eu,e,{text:(r=(n=e.text)==null?void 0:n.trim())!=null?r:""}),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent()}};var re=class extends Dt.Object3D{getPosition(){return this.box.getCenter(new Dt.Vector3)}onAddToScene(t){this.poiLayer2.onAddToScene(t)}onRemoveFromScene(){this.poiLayer2.onRemoveFromScene()}createGround(t){let e=new mt(this.context,t);e.userData.data=t,this.addGrounds([e])}addGrounds(t){t.forEach(e=>{this.grounds.has(e)||(this.grounds.add(e),this.groundLayer.add(e))}),this.changeGroundMaxHeight()}changeGroundMaxHeight(){let t=Array.from(this.grounds);this.groundMaxHeight=this.grounds.size>0?Math.max(...t.map(e=>e.options.height+e.options.airHeight+e.options.deltaHeight)):0,this.groundUpper.position.z=this.groundMaxHeight+.01}get hasElement(){return!!(this.grounds.size||this.graphicLayer.children.length)}getCenter(){return new Dt.Box3().setFromObject(this).getCenter(new Dt.Vector3)}addModel(t){let e=new zn(this.context,t);return this.models.add(e),this.modelMap.set(t.id,e),e}addShadow(){let t=new Dt.Box3().setFromObject(this.groundUpper),e=t.getCenter(new Dt.Vector3),n=t.getSize(new Dt.Vector3);this.shadow.setPosition(e),this.shadow.changeLightCamera(n)}addGraphic(t){return this.graphicLayer.createGraphic(t)}addPoi(t){return this.poiLayer.createPoi(t)}addPoi2(t){let e=new st(this.context,t);return this.poiLayer2.pushPoi(e),e}removePoi2(t){return this.poiLayer2.removePoi(t)}removePoi2ById(t){return this.poiLayer2.removePoiById(t)}addHeatmap(t){this.heatmap||(this.heatmap=new Bn(this.context),this.add(this.heatmap)),this.heatmap.loadData(t);let e=new Dt.Box3().setFromObject(this.graphicLayer);return this.heatmap.position.setZ(e.max.z+.1),this.heatmap}removeHeatMap(){this.heatmap&&(this.remove(this.heatmap),this.heatmap.dispose(),this.heatmap=void 0)}setShadowOpacity(t){this.shadow.setOpacity(t)}setShadowVisible(t){this.shadow.visible=t}setGraphicOptions(t,e){this.graphicLayer.graphicMap.has(t)?this.graphicLayer.setGraphicOptions(t,e):this.mergeGraphicLayer.setGraphicOptions(t,e)}getGraphicPosition(t){return this.graphicLayer.getGraphicPosition(t)||this.mergeGraphicLayer.getGraphicPosition(t)||this.parkingSpaceLayer.getGraphicPosition(t)}changeParkingColor(t){this.parkingSpaceLayer.changeParkingColor(t)}getParkingOptionsByParkingNo(t){return this.parkingSpaceLayer.getParkingOptionsByParkingNo(t)}updateBox(){this.box.setFromObject(this.groundLayer)}getGraphics(){return this.graphicLayer.children.filter(t=>t instanceof mt)}setOpacity(t,e){e===void 0&&(e=!1),this.groundLayer.setOpacity(t,e),this.graphicLayer.setOpacity(t,e),this.mergeGraphicLayer.setOpacity(t,e),this.poiLayer2.setOpacity(t),this.parkingSpaceLayer.setOpacity(t,e),this.laneLayer.setOpacity(t,e),this.wallLayer.setOpacity(t,e),this.textureLayer.setOpacity(t),this.textTextureLayer.setOpacity(t),this.glbModelLayer.setOpacity(t,e),this.userData.opacity=t}dispose(){var t;console.log("floor dispose",this.name),this.shadow.dispose(),this.groundLayer.dispose(),this.graphicLayer.dispose(),this.poiLayer.dispose(),this.poiLayer2.dispose(),this.parkingSpaceLayer.dispose(),this.wallLayer.dispose(),this.textureLayer.dispose(),this.glbModelLayer.dispose(),this.laneLayer.dispose(),this.mergeGraphicLayer.dispose(),this.textTextureLayer.dispose(),this.grounds.forEach(e=>e.dispose()),(t=this.heatmap)==null||t.dispose(),this.groundUpper.clear(),this.models.children.forEach(e=>e.dispose()),this.models.clear(),this.modelMap.clear(),this.clear()}constructor(t){super(),this.context=t,this.grounds=new Set,this.shadow=new Fn,this.groundUpper=new Dt.Object3D,this.models=new Dt.Object3D,this.modelMap=new Map,this.groundMaxHeight=0,this.name="",this.key="",this.box=new Dt.Box3,this.groundLayer=new nt(this.context),this.graphicLayer=new Gn(this.context),this.poiLayer=new kn(this.context),this.poiLayer2=new Vn(this.context),this.parkingSpaceLayer=new Hn(this.context),this.wallLayer=new nt(this.context),this.textureLayer=new nt(this.context),this.glbModelLayer=new Wn(this.context),this.laneLayer=new nt(this.context),this.mergeGraphicLayer=new jn(this.context),this.textTextureLayer=new nt(this.context),this.groundUpper.add(this.graphicLayer),this.groundUpper.add(this.poiLayer),this.groundUpper.add(this.poiLayer2),this.groundUpper.add(this.parkingSpaceLayer),this.groundUpper.add(this.wallLayer),this.groundUpper.add(this.textureLayer),this.groundUpper.add(this.glbModelLayer),this.groundUpper.add(this.laneLayer),this.groundUpper.add(this.mergeGraphicLayer),this.groundUpper.add(this.textTextureLayer),this.add(this.groundUpper),this.add(this.groundLayer),this.add(this.models)}};var Hd=require("core-js/modules/es.array.push.js"),Wd=require("core-js/modules/web.dom-collections.iterator.js");var Vr=require("three");var Vt=class extends Vr.EventDispatcher{_registryEvent(){this.context.addEventListener("resize",this._onResize)}_unRegistryEvent(){this.context.removeEventListener("resize",this._onResize)}setEnable(t){this.enable=t,t?this.svg.style.display="block":this.svg.style.display="none"}getIntersectByPointerEvent(t){let{camera:e,renderer:n}=this.context,{offsetX:r,offsetY:i}=t,{clientWidth:o,clientHeight:s}=n.domElement,u=r/o*2-1,l=1-i/s*2;return new Vr.Vector3(u,l,0).unproject(e)}getSvgCoordinate(t){let{camera:e,container:n}=this.context;return N(t,e,n.clientWidth,n.clientHeight)}dispose(){this._unRegistryEvent(),this.context.container.removeChild(this.svg),this.svg=null}constructor(t){super(),this.context=t,this.points=[],this.enable=!0,this._onResize=e=>{let{width:n,height:r}=e;this.svg&&(this.svg.setAttribute("width",""+n),this.svg.setAttribute("height",""+r))},this.svg=Ei(""+t.container.clientWidth,""+t.container.clientHeight),t.container.appendChild(this.svg),this._registryEvent()}};var Zn=class extends Vt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}addPoint(t){if(this.points.push(t),this.points.length>=2){let e=this.calculatedDistance();this.dispatchEvent({type:"distance",distance:e})}}calculatedDistance(){let[{x:t,y:e},{x:n,y:r}]=this.points;return Math.sqrt((n-t)**2+(r-e)**2)}dispose(){super.dispose(),this.unRegistryEvent(),this.line=null,this.circles=[]}constructor(t){super(t),this.context=t,this.onUpdate=()=>{if(this.points[0]){let r=this.getSvgCoordinate(this.points[0]);Ae(this.circles[0],r.x,r.y),Yt(this.line,r)}if(this.points[1]){let r=this.getSvgCoordinate(this.points[1]);Ae(this.circles[1],r.x,r.y),Yt(this.line,void 0,r)}},this.onPointermove=r=>{this.points.length===1&&(this.line.style.display="block",Yt(this.line,void 0,{x:r.offsetX,y:r.offsetY}))},this.onPointerleave=()=>{this.points[1]||(this.line.style.display="none")},this.onPointerdown=r=>{if(this.points[1])return;let i=this.getIntersectByPointerEvent(r);if(i){let{offsetX:o,offsetY:s}=r,u=this.circles[this.points.length];Ae(u,o,s),this.points.length||Yt(this.line,{x:o,y:s},{x:o,y:s}),this.addPoint(i)}};let{config:{svg:{circle:e,line:n}}}=t;this.circles=[Je(e.radius,e.fill),Je(e.radius,e.fill)],this.line=In(n.stroke),this.svg.appendChild(this.circles[0]),this.svg.appendChild(this.circles[1]),this.svg.appendChild(this.line),this.registryEvent()}};var Yd=require("core-js/modules/es.array.push.js");var Kn=class extends Vt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}get lastLine(){return this.lines.slice(-1)[0]}addCircle(t){this.circles.push(t),this.svg.appendChild(t)}addLine(t){this.lines.push(t),this.svg.appendChild(t)}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}checkAdsorb(t,e){if(this.points.length<3)return!1;let n=this.circles[0],r=+n.getAttribute("cx"),i=+n.getAttribute("cy");return Math.sqrt((t-r)**2+(e-i)**2)<=5}addPoint(t){if(this.points.push(t),this.isClose){let e=this.calculatedArea();this.dispatchEvent({type:"area",area:e})}}calculatedArea(){let t=this.points.map(r=>[r.x,r.y]),e=0,n=t.length;for(let r=0;r<n;r++){let i=(r+1)%n;e+=t[r][0]*t[i][1]-t[i][0]*t[r][1]}return Math.abs(e/2)}dispose(){super.dispose(),this.unRegistryEvent(),this.lines=[],this.circles=[]}constructor(t){super(t),this.circles=[],this.lines=[],this.isClose=!1,this.onUpdate=()=>{this.points.length&&this.points.forEach((e,n)=>{let r=this.getSvgCoordinate(e);this.circles[n]&&Ae(this.circles[n],r.x,r.y),n!==0&&Yt(this.lines[n-1],void 0,r),this.lines[n]&&Yt(this.lines[n],r)})},this.onPointermove=e=>{!this.lastLine||this.isClose||(this.lastLine.style.display="block",Yt(this.lastLine,void 0,{x:e.offsetX,y:e.offsetY}))},this.onPointerleave=()=>{this.isClose||(this.lastLine.style.display="none")},this.onPointerdown=e=>{if(this.isClose)return;let n=this.getIntersectByPointerEvent(e);if(n){let{offsetX:r,offsetY:i}=e;this.checkAdsorb(r,i)?(this.isClose=!0,this.addPoint(this.points[0])):this.addPoint(n);let{circle:{fill:o,radius:s},line:{stroke:u}}=this.context.config.svg;if(!this.isClose){let l=Je(s,o);Ae(l,r,i),this.addCircle(l)}if(this.lines.length&&Yt(this.lastLine,void 0,{x:r,y:i}),!this.isClose){let l=In(u);Yt(l,{x:r,y:i},{x:r,y:i}),this.addLine(l)}}},this.registryEvent()}};var Bs=require("three");var Vi=class extends Vt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}selectGraphic(t){this.graphic=t}dispose(){super.dispose(),this.unRegistryEvent(),this.rect=null,this.cornerRect=[],this.centerRect=[]}constructor(t){super(t),this.context=t,this.cornerRect=[],this.centerRect=[],this.onUpdate=()=>{if(this.graphic){let n=new Bs.Box3().setFromObject(this.graphic),{camera:r,container:{clientWidth:i,clientHeight:o}}=this.context,{min:s,max:u}=n,l=N(s,r,i,o),c=N(u,r,i,o);Ct(this.rect,l.x,c.y,Math.abs(c.x-l.x),Math.abs(c.y-l.y));let{x:h,y:p}=l,{x:f,y:d}=c,m=5,y=[{x:h-m,y:d-m},{x:f-m,y:d-m},{x:h-m,y:p-m},{x:f-m,y:p-m}];for(let P=0;P<y.length;P++)Ct(this.cornerRect[P],y[P].x,y[P].y,m*2,m*2);let x=4,E=(h+f)/2,S=(p+d)/2,R=[{x:E-x,y:d-x},{x:h-x,y:S-x},{x:f-x,y:S-x},{x:E-x,y:p-x}];for(let P=0;P<R.length;P++)Ct(this.centerRect[P],R[P].x,R[P].y,x*2,x*2)}else{Ct(this.rect,0,0,0,0);for(let n=0;n<this.cornerRect.length;n++)Ct(this.cornerRect[n],0,0,0,0),Ct(this.centerRect[n],0,0,0,0)}};let{config:{svg:{line:e}}}=t;this.rect=xe(e.stroke,"transparent"),this.svg.appendChild(this.rect);for(let n=0;n<4;n++)this.cornerRect[n]=xe(e.stroke,"#ffffff"),this.centerRect[n]=xe(e.stroke,"#ffffff"),this.svg.appendChild(this.cornerRect[n]),this.svg.appendChild(this.centerRect[n]);this.registryEvent()}};var eg=require("core-js/modules/es.array.push.js"),At=require("three");var zs=require("three/examples/jsm/utils/BufferGeometryUtils.js");var $n=class extends At.Object3D{initGeometry(){return g(this,null,function*(){let t=yield ne.GetMergeGeometry(this.options);this.geometry=t})}initMaterial(){let t=`
|
|
8052
|
+
`],{type:"text/javascript"}),t=URL.createObjectURL(a),e=new Worker(t);return URL.revokeObjectURL(t),e}var qn=require("three");var rn=class{static GetMergeGeometry(t){return g(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield nn(e,"get_merged_geometry_attributes",{data:t}),r=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),r})}static GetMergedShapeGeometry(t){return g(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield nn(e,"get_merged_shape_geometry_attributes",{data:t}),r=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),r})}static GetMergedTexture2dGeometry(t){return g(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield nn(e,"get_merged_texture2d_shape_geometry_attributes",{data:t}),r=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),r})}static GetBufferGeometryByData(t){let e=new qn.BufferGeometry;return Object.keys(t.attributes).forEach(n=>{e.setAttribute(n,new qn.BufferAttribute(t.attributes[n].array,t.attributes[n].itemSize))}),t.index&&e.setIndex(new qn.BufferAttribute(t.index.array,t.index.itemSize)),e.morphAttributes=t.morphAttributes,e.morphTargetsRelative=t.morphTargetsRelative,e.groups=t.groups,e.boundingSphere=t.boundingSphere,e}static GetMergedGeometry(t){return g(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield nn(e,"get_merged_geometries_json",{data:t});return this.WorkerPool.releaseWorker(e),n?wn(wn({},t[0]),n):null})}static GetMergedGeometryLine(t){return g(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield nn(e,"get_merged_geometries_line_json",{data:t});return this.WorkerPool.releaseWorker(e),n?wn(wn({},t[0]),n):null})}static dispose(){this.WorkerPool.dispose()}};ht(rn,"WorkerPool",new Gr(10,ki));var jn=class extends nt{getCenter(){return new kt.Box3().setFromObject(this).getCenter(new kt.Vector3)}addInstancedGraphic(t){this.instancedGraphicConfig?(this.instancedGraphicConfig.size+=t.size,this.instancedGraphicConfig.colors=[...this.instancedGraphicConfig.colors,...t.colors],this.instancedGraphicConfig.matrixes=[...this.instancedGraphicConfig.matrixes,...t.matrixes],this.instancedGraphicConfig.opacities=[...this.instancedGraphicConfig.opacities,...t.opacities],this.instancedGraphicConfig.maxZs=[...this.instancedGraphicConfig.maxZs,...t.maxZs],this.instancedGraphicConfig.ids=[...this.instancedGraphicConfig.ids,...t.ids]):this.instancedGraphicConfig=t,this.refeshInstancedGraphic()}refeshInstancedGraphic(){this.instancedGraphic&&(this.remove(this.instancedGraphic),F(this.instancedGraphic)),this.instancedGraphicConfig&&(this.instancedGraphic=new Ye(this.context,this.instancedGraphicConfig),this.add(this.instancedGraphic))}addGraphics(t,e){t.map(n=>{this.graphicDataMap.set(n.id,n),this.graphicOriginOptionMap.set(n.id,{fillOpacity:n.fillOpacity,strokeOpacity:n.strokeOpacity})}),e?e.map(n=>{if(n.instancedGeometry&&this.addInstancedGraphic(n.instancedGeometry),n.mergedGeometry){let r=new on(this.context,v({},n,{lineGeometry:null}));this.mergedGraphicGroup.add(r)}if(n.lineGeometry){let r=new Ne(this.context,n.lineGeometry);this.mergedLineGroup.add(r)}}):(this.refreshMergeGraphic(),this.refreshLine())}createGraphic(t){return g(this,null,function*(){let e=yield rn.GetMergedGeometry(t);if(F(this.mergedGraphicGroup),this.mergedGraphicGroup.clear(),e){let n=new on(this.context,e);this.mergedGraphicGroup.add(n)}})}createLine(t){return g(this,null,function*(){let e=yield rn.GetMergedGeometryLine(t);if(F(this.mergedLineGroup),this.mergedLineGroup.clear(),e){let n=new Ne(this.context,e.lineGeometry);this.mergedLineGroup.add(n)}})}refreshMergeGraphic(){let t=Array.from(this.graphicDataMap.values());this.instancedGraphicConfig&&(t=t.filter(e=>{var n;return!((n=this.instancedGraphicConfig)!=null&&n.ids.includes(e.id))})),this.createGraphic(t)}refreshLine(){let t=Array.from(this.graphicDataMap.values());this.createLine(t)}removeGraphicById(t){var e;if(this.graphicDataMap.delete(t),(e=this.instancedGraphicConfig)!=null&&e.ids.includes(t)){let n=this.instancedGraphicConfig.ids.findIndex(r=>r===t);this.instancedGraphicConfig.size--,this.instancedGraphicConfig.colors.splice(n*3,3),this.instancedGraphicConfig.matrixes.splice(n*16,16),this.instancedGraphicConfig.opacities.splice(n,1),this.instancedGraphicConfig.maxZs.splice(n,1),this.instancedGraphicConfig.ids.splice(n,1),this.refeshInstancedGraphic()}else this.refreshMergeGraphic();this.refreshLine()}getGraphicDataByNodeId(t){return this.graphicMap.get(t)||null}setGraphicOptions(t,e){var n;let r,i=this.graphicDataMap.get(t);if(i){if(typeof e=="function"?r=e(i):r=v({},i,e),this.graphicDataMap.set(t,r),(n=this.instancedGraphicConfig)!=null&&n.ids.includes(t)&&this.instancedGraphic){this.instancedGraphic.setColorById(t,r.fillColor),this.instancedGraphic.setOpacityById(t,r.fillOpacity),this.instancedGraphic.setMaxZById(t,r.deltaHeight+r.airHeight+r.height);let o=this.instancedGraphicConfig.ids.findIndex(p=>p===t),s=this.instancedGraphicConfig.matrixes.slice(o*16,(o+1)*16),u=new kt.Matrix4().fromArray(s),l=new kt.Vector3,c=new kt.Quaternion,h=new kt.Vector3;u.decompose(l,c,h),h.z=r.height,l.z=r.deltaHeight+r.airHeight+r.height/2,u.compose(l,c,h),this.instancedGraphic.setMatrixById(t,u)}else this.refreshMergeGraphic();this.refreshLine()}}getGraphicPosition(t){let e=this.graphicDataMap.get(t);return e?[e.center_x,e.center_y]:null}setOpacity(t,e){e===void 0&&(e=!1);var n;this.graphicDataMap.forEach((r,i)=>{if(e)r.fillOpacity=t,r.strokeOpacity=t;else{let u=this.graphicOriginOptionMap.get(i);var o;r.fillOpacity=Math.min(t,(o=u==null?void 0:u.fillOpacity)!=null?o:1);var s;r.strokeOpacity=Math.min(t,(s=u==null?void 0:u.strokeOpacity)!=null?s:1)}}),(n=this.instancedGraphic)==null||n.setOpacity(t,e),this.refeshInstancedGraphic(),this.refreshLine()}dispose(){super.dispose(),this.mergedGraphicGroup.clear(),this.mergedLineGroup.clear(),this.instancedGraphic=null,this.instancedGraphicConfig=null}constructor(t){super(t),this.graphicMap=new Map,this.mergedGraphicGroup=new kt.Group,this.mergedLineGroup=new kt.Group,this.graphicDataMap=new Map,this.graphicOriginOptionMap=new Map,this.instancedGraphic=null,this.instancedGraphicConfig=null,this.add(this.mergedGraphicGroup),this.add(this.mergedLineGroup)}};var pd=require("core-js/modules/web.dom-collections.iterator.js"),fd=require("core-js/modules/es.array.push.js");var _t=require("three");var od=require("core-js/modules/es.string.replace.js"),sd=require("core-js/modules/es.regexp.exec.js"),ad=require("core-js/modules/es.error.cause.js"),ud=require("core-js/modules/web.dom-collections.iterator.js"),kr=require("three");var Yn=class{setBaseUrl(t){this.baseUrl=t.replace(/\/$/,"")}setConfig(t){this.config=t}loadConfig(){return g(this,null,function*(){if(this.config)return this.config;if(!this.baseUrl)throw new Error("Base URL is not set");try{let t=yield fetch(""+this.baseUrl+"/config.json");return this.config=yield t.json(),this.config}catch(t){return console.error("Failed to load tile config:",t),this.config={extent:[12276734621488994e-9,2.1183542845726013e6,12279646804065457e-9,2121524247761597e-9],maxZoom:21,minZoom:11},this.config}})}buildTileUrl(t,e,n){if(!this.baseUrl)throw new Error("Base URL is not set");return this.baseUrl+"/"+n+"/"+t+"/"+e+".png"}loadTileTexture(t,e,n){return g(this,null,function*(){if(!this.baseUrl)throw new Error("Base URL is not set");let r=this.buildTileUrl(t,e,n);if(this.textureCache.has(r)){let o=this.textureCache.get(r);return o instanceof Promise?o:Promise.resolve(o)}let i=this.textureLoader.loadAsync(r).then(o=>(o.flipY=!0,o.colorSpace=kr.SRGBColorSpace,this.textureCache.set(r,o),o)).catch(o=>null);return this.textureCache.set(r,i),i})}clearCache(){this.textureCache.forEach(t=>{t instanceof Promise?t.then(e=>e==null?void 0:e.dispose()):t.dispose()}),this.textureCache.clear()}dispose(){this.clearCache()}constructor(t){this.baseUrl="",this.config=null,this.textureCache=new Map,this.textureLoader=new kr.TextureLoader,t&&this.setBaseUrl(t)}};var Fs=require("lodash");var Us={base_url:"https://robot-vr-public.aibee.cn/static_resource/tiles"},sn=class a extends nt{loadTileConfig(){return g(this,null,function*(){return this.tileLoader.loadConfig()})}initEvents(){this.context.addEventListener("control-change",this.onUpdate),this.context.bmap.addEventListener("center-change",this.onCenterChange)}removeEvents(){this.context.removeEventListener("control-change",this.onUpdate),this.context.bmap.removeEventListener("center-change",this.onCenterChange)}getViewBounds(){let t=this.context.camera,e=new _t.Raycaster,n=new _t.Vector2,r=[],[i,o]=this.context.center||[0,0],s=[{x:-1,y:1},{x:1,y:1},{x:1,y:-1},{x:-1,y:-1}];for(let p of s){n.set(p.x,p.y),e.setFromCamera(n,t);let f=new _t.Vector3(0,0,1),d=new _t.Vector3(0,0,0),m=new _t.Plane().setFromNormalAndCoplanarPoint(f,d),y=new _t.Vector3;e.ray.intersectPlane(m,y)?r.push(y):(e.ray.direction.negate(),e.ray.intersectPlane(m,y)&&r.push(y))}if(r.length<4)return null;let u=1/0,l=1/0,c=-1/0,h=-1/0;return r.forEach(p=>{u=Math.min(u,p.x+i),l=Math.min(l,p.y+o),c=Math.max(c,p.x+i),h=Math.max(h,p.y+o)}),{minX:u,minY:l,maxX:c,maxY:h}}getTileZoomLevel(t,e){let{minZoom:n,maxZoom:r}=e,i=this.context.camera,o=(i.right-i.left)/i.zoom,s=this.context.clientSize.width,u=o/s,l=a.WORLD_WIDTH,c=Math.log2(l/(u*this.tileSize));return Math.min(r,Math.max(n,Math.round(c)))}getTilesInView(t,e,n){let[r,i,o,s]=n.extent,u=Math.max(t.minX,r),l=Math.max(t.minY,i),c=Math.min(t.maxX,o),h=Math.min(t.maxY,s);if(u>=c||l>=h)return[];let p=Math.pow(2,e),f=a.WORLD_WIDTH/p,d=a.WORLD_WIDTH_HALF,m=Math.max(0,Math.floor((u+d)/f)),y=Math.floor((c+d)/f),x=Math.max(0,Math.floor((d-h)/f)),E=Math.floor((d-l)/f),S=[];for(let R=m;R<=y;R++)for(let P=x;P<=E;P++)S.push({x:R,y:P,z:e});return S}renderTiles(t,e){return g(this,null,function*(){let n=t,r=[];if(this.currentLevel!==e)r=[...this.tileGroup.children];else{let s=this.tileGroup.children,u=s.map(c=>c.userData.key),l=t.map(c=>c.z+"/"+c.x+"/"+c.y);n=t.filter(c=>!u.includes(c.z+"/"+c.x+"/"+c.y)),r=s.filter(c=>!l.includes(c.userData.key))}let i=Math.pow(2,e),o=a.WORLD_WIDTH/i;yield Promise.all(n.map(s=>g(this,null,function*(){let u=s.z+"/"+s.x+"/"+s.y,l=yield this.tileLoader.loadTileTexture(s.x,s.y,s.z);if(l){let c=new _t.MeshBasicMaterial({map:l,transparent:!0}),h=new _t.Mesh(this.baseGeometry,c);h.scale.setX(o).setY(o),h.position.set((s.x-i/2)*o+o/2,-((s.y-i/2)*o)-o/2,0),h.userData.key=u,this.tileGroup.add(h)}}))),this.tileGroup.children.forEach(s=>{r.includes(s)&&(s.material.dispose(),this.tileGroup.remove(s))})})}setVisibility(t){this.visible=t,t&&this.onUpdate()}setOpacity(t){super.setOpacity(t)}clearTiles(){this.tileGroup.children.forEach(t=>{t.material.dispose()}),this.tileGroup.clear()}dispose(){this.removeEvents(),this.clearTiles(),this.baseGeometry.dispose(),this.tileLoader.dispose(),super.dispose()}constructor(t,e){super(t),this.loadedTiles=new Map,this.currentLevel=0,this.tileSize=256,this.baseGeometry=new _t.PlaneGeometry(1,1),this.options=Us,this.onUpdate=()=>{this.updateTiles()},this.onCenterChange=()=>{let{center:r}=this.context;this.tileGroup.position.set(-r[0],-r[1],0),this.updateTiles()},this.updateTiles=(0,Fs.debounce)(()=>g(this,null,function*(){if(!this.visible)return;let r=yield this.loadTileConfig(),i=this.context.camera,o=this.getViewBounds();if(!o)return;let s=this.getTileZoomLevel(i.zoom,r),u=this.getTilesInView(o,s,r);this.renderTiles(u,s)}),100),this.options=v({},Us,e),this.tileGroup=new _t.Group;let{center:n}=t;this.tileGroup.position.set(-n[0],-n[1],0),this.add(this.tileGroup),this.tileLoader=new Yn(this.options.base_url),this.initEvents(),this.updateTiles()}};sn.WORLD_WIDTH=4007501668e-2;sn.WORLD_WIDTH_HALF=sn.WORLD_WIDTH/2;var vd=require("core-js/modules/es.array.push.js"),xd=require("core-js/modules/web.dom-collections.iterator.js"),Ed=require("core-js/modules/es.string.trim.js");var Tt=require("three");var Oe=require("lodash");var Eu={text:"",icon:"",icon_size:[22,22],level:1,collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},text_font_size:14,icon_rotate:0,depth_test:!1,hide_text:!1,maxWeight:25,minWeight:1,text_opacity:1,icon_opacity:1},st=class extends Tt.Object3D{get hasText(){return!this.options.hide_text&&this.options.text}get durIconAndText(){return this.options.icon&&this.hasText?2:0}get offset(){return this.options.icon&&this.hasText?0:.5}get iconWidth(){return this.options.icon?this.options.icon_size[0]:0}get iconHeight(){return this.options.icon?this.options.icon_size[1]:0}get textWidth(){return this.hasText?this.textHeight*this.textAspect:0}get textHeight(){return this.hasText?this.options.text_font_size*this.textureLines:0}get hasOriginTexture(){let{text_texture:t,text_texture_width:e,text_texture_height:n,text_texture_offset_x:r,text_texture_offset_y:i}=this.options;return!(0,Oe.isNil)(t)&&!(0,Oe.isNil)(e)&&!(0,Oe.isNil)(n)&&!(0,Oe.isNil)(r)&&!(0,Oe.isNil)(i)}get inited(){return!this.options.text||this.options.text&&this.textTexture}get deltaZ(){return this.options.icon&&this.hasText?.1+this.offset*(this.iconHeight+this.durIconAndText+this.textHeight)/this.context.camera.zoom:this.hasText?.1+.5*this.textHeight/this.context.camera.zoom:.1}get canSelect(){return this.visible&&this._shouldShow}show(){return g(this,null,function*(){if(this._shouldShow)return;this._shouldShow=!0;let t=[];if(!this.spriteIcon&&this.options.icon&&t.push(this.initIcon()),!this.spriteText&&this.hasText&&t.push(this.initText()),yield Promise.all(t),!this._shouldShow){this.hide();return}this.initSize(),this._initScale({zoom:this.context.camera.zoom}),this.spriteIcon&&(this.spriteIcon.visible=!0),this.spriteText&&(this.spriteText.visible=!0)})}hide(){this._shouldShow=!1,this.spriteIcon&&(this.remove(this.spriteIcon),this.spriteIcon.material.dispose(),this.spriteIcon=void 0),this.spriteText&&(this.remove(this.spriteText),this.spriteText.material.dispose(),this.spriteText=void 0)}registryEvent(){this.context.addEventListener("control-zoom-change",this._initScale),this.addEventListener("change-icon",t=>g(this,null,function*(){let{value:e}=t;this._shouldShow&&(this.hide(),yield this.show()),this.context.forceUpdate()})),this.addEventListener("change-text",t=>g(this,null,function*(){let{value:e}=t;this._shouldShow&&(this.hide(),yield this.show()),this.context.forceUpdate()})),this.addEventListener("change-text_font_size",t=>g(this,null,function*(){let{value:e}=t;this._shouldShow&&(this.hide(),yield this.show())})),this.addEventListener("change-icon_rotate",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.rotation=e/180*Math.PI)}),this.addEventListener("change-icon_size",t=>{let{value:e}=t;this._initScale({zoom:this.context.camera.zoom}),this.options.icon&&this.context.forceUpdate()}),this.addEventListener("change-depth_test",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.depthTest=e),this.spriteText&&(this.spriteText.material.depthTest=e)}),this.addEventListener("change-icon_opacity",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.opacity=e)}),this.addEventListener("change-text_opacity",t=>{let{value:e}=t;this.spriteText&&(this.spriteText.material.opacity=e)})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}getPosition(){return this.position}initIcon(){return g(this,null,function*(){if(this.options.icon)return this._initIconPromise=new Promise(t=>g(this,null,function*(){let e;if(this.options.icon_border){let{icon:r,icon_size:i,icon_border:o}=this.options;e=yield gt.getUrlTextureBorder(r,i[0]-o.width*2,o)}else e=yield gt.getTextureByUrl(this.options.icon);let n=new Tt.Sprite(new Tt.SpriteMaterial({map:e,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,rotation:this.options.icon_rotate/180*Math.PI,opacity:this.options.icon_opacity}));n.visible=!1,n.renderOrder=1e5+this.options.level,e.needsUpdate=!0,this.add(n),this.spriteIcon=n,t(n)})).then(()=>{this._initIconPromise=null})})}initText(){return g(this,null,function*(){if(this.hasText){let t=this.textTexture;if(!t)return;let e=new Tt.Sprite(new Tt.SpriteMaterial({map:t,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,opacity:this.options.text_opacity}));e.visible=!1,e.renderOrder=100001+this.options.level,t.needsUpdate=!0,this.spriteText=e,this.add(e)}})}initSize(){var t,e;let n=0,r=0,{icon:i}=this.options;i?this.hasText?(n=0,r=n*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(n=.5,r=0):this.hasText?(r=.5,n=0):(n=0,r=0),(t=this.spriteIcon)==null||t.center.set(.5,n),(e=this.spriteText)==null||e.center.set(.5,r)}init(){return g(this,null,function*(){yield Promise.all([this.initIcon(),this.initText()]),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})}resetZ(){let t=this.deltaZ;this.spriteIcon&&(this.spriteIcon.position.z=t),this.spriteText&&(this.spriteText.position.z=t)}getBox(t){if(!this.inited)return this.initTextTexture(),null;let{clientSize:{width:e,height:n}}=this.context,r=e*(t.x+1)/2,i=n*(-t.y+1)/2;i+=this.offset*(this.iconHeight+this.durIconAndText+this.textHeight);let o=this.iconWidth/2,s=new Tt.Box2(new Tt.Vector2(r-o,i-this.iconHeight),new Tt.Vector2(r+o,i)),u=this.textWidth/2,l=new Tt.Box2(new Tt.Vector2(r-u,i-this.textHeight-this.durIconAndText-this.iconHeight),new Tt.Vector2(r+u,i-this.iconHeight-this.durIconAndText));return this.box=l.union(s),this.box}renderBoxHelper(t,e){if(!this.boxHelper){let n=document.createElement("div");n.style.position="absolute",n.style.zIndex="999",n.style.border="1px solid red",n.style.pointerEvents="none",this.boxHelper=n,this.context.container.appendChild(n)}t&&e?(this.boxHelper.style.left=t+"px",this.boxHelper.style.top=e+"px",this.boxHelper.style.width="2px",this.boxHelper.style.height="2px"):(this.boxHelper.style.left=this.box.min.x+"px",this.boxHelper.style.top=this.box.min.y+"px",this.boxHelper.style.width=this.box.max.x-this.box.min.x+"px",this.boxHelper.style.height=this.box.max.y-this.box.min.y+"px")}parentSetVisible(t){t?this.show():this.hide(),this.boxHelper&&(this.boxHelper.style.display=t?"block":"none")}dispose(){this.hide(),this.unRegistryEvent(),this._listeners={}}constructor(t,e){var n;super(),this.context=t,this.textAspect=1,this.box=new Tt.Box2,this._initIconPromise=null,this.textureLines=1,this._shouldShow=!1,this.initTextTexture=(0,Oe.once)(()=>g(this,null,function*(){if(!this.options.text||this.textTexture)return;let i;if(this.hasOriginTexture){let{text_texture:o,text_texture_width:s,text_texture_height:u,text_texture_offset_x:l,text_texture_offset_y:c}=this.options;i=this.options.text_texture.clone(),i.uuid=o.uuid,i.offset.set(l/i.image.width,1-(u+c)/i.image.height),i.repeat.set(s/i.image.width,u/i.image.height),this.textAspect=s/u}else{let o=yield ft.getTextureByText(this.options.text);i=o.texture,this.textureLines=o.lines,this.textAspect=i.image.width/i.image.height}this.textTexture=i,this.dispatchEvent({type:"text-texture-inited"})})),this._initScale=i=>{let{zoom:o}=i;if(this.spriteText){let u=this.textHeight/o;this.spriteText.scale.set(this.textAspect*u,u,.1)}if(this.spriteIcon){var s;(s=this.spriteIcon)==null||s.scale.set(this.options.icon_size[0]/o,this.options.icon_size[1]/o,.1)}this.resetZ()};var r;this.options=Ge(v({},Eu,e,{text:(r=(n=e.text)==null?void 0:n.trim())!=null?r:""}),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent()}};var re=class extends Dt.Object3D{getPosition(){return this.box.getCenter(new Dt.Vector3)}onAddToScene(t){this.poiLayer2.onAddToScene(t)}onRemoveFromScene(){this.poiLayer2.onRemoveFromScene()}createGround(t){let e=new mt(this.context,t);e.userData.data=t,this.addGrounds([e])}addGrounds(t){t.forEach(e=>{this.grounds.has(e)||(this.grounds.add(e),this.groundLayer.add(e))}),this.changeGroundMaxHeight()}changeGroundMaxHeight(){let t=Array.from(this.grounds);this.groundMaxHeight=this.grounds.size>0?Math.max(...t.map(e=>e.options.height+e.options.airHeight+e.options.deltaHeight)):0,this.groundUpper.position.z=this.groundMaxHeight+.01}get hasElement(){return!!(this.grounds.size||this.graphicLayer.children.length)}getCenter(){return new Dt.Box3().setFromObject(this).getCenter(new Dt.Vector3)}addModel(t){let e=new zn(this.context,t);return this.models.add(e),this.modelMap.set(t.id,e),e}addShadow(){let t=new Dt.Box3().setFromObject(this.groundUpper),e=t.getCenter(new Dt.Vector3),n=t.getSize(new Dt.Vector3);this.shadow.setPosition(e),this.shadow.changeLightCamera(n)}addGraphic(t){return this.graphicLayer.createGraphic(t)}addPoi(t){return this.poiLayer.createPoi(t)}addPoi2(t){let e=new st(this.context,t);return this.poiLayer2.pushPoi(e),e}removePoi2(t){return this.poiLayer2.removePoi(t)}removePoi2ById(t){return this.poiLayer2.removePoiById(t)}addHeatmap(t){this.heatmap||(this.heatmap=new Bn(this.context),this.add(this.heatmap)),this.heatmap.loadData(t);let e=new Dt.Box3().setFromObject(this.graphicLayer);return this.heatmap.position.setZ(e.max.z+.1),this.heatmap}removeHeatMap(){this.heatmap&&(this.remove(this.heatmap),this.heatmap.dispose(),this.heatmap=void 0)}setShadowOpacity(t){this.shadow.setOpacity(t)}setShadowVisible(t){this.shadow.visible=t}setGraphicOptions(t,e){this.graphicLayer.graphicMap.has(t)?this.graphicLayer.setGraphicOptions(t,e):this.mergeGraphicLayer.setGraphicOptions(t,e)}getGraphicPosition(t){return this.graphicLayer.getGraphicPosition(t)||this.mergeGraphicLayer.getGraphicPosition(t)||this.parkingSpaceLayer.getGraphicPosition(t)}changeParkingColor(t){this.parkingSpaceLayer.changeParkingColor(t)}getParkingOptionsByParkingNo(t){return this.parkingSpaceLayer.getParkingOptionsByParkingNo(t)}updateBox(){this.box.setFromObject(this.groundLayer)}getGraphics(){return this.graphicLayer.children.filter(t=>t instanceof mt)}setOpacity(t,e){e===void 0&&(e=!1),this.groundLayer.setOpacity(t,e),this.graphicLayer.setOpacity(t,e),this.mergeGraphicLayer.setOpacity(t,e),this.poiLayer2.setOpacity(t),this.parkingSpaceLayer.setOpacity(t,e),this.laneLayer.setOpacity(t,e),this.wallLayer.setOpacity(t,e),this.textureLayer.setOpacity(t),this.textTextureLayer.setOpacity(t),this.glbModelLayer.setOpacity(t,e),this.userData.opacity=t}dispose(){var t;console.log("floor dispose",this.name),this.shadow.dispose(),this.groundLayer.dispose(),this.graphicLayer.dispose(),this.poiLayer.dispose(),this.poiLayer2.dispose(),this.parkingSpaceLayer.dispose(),this.wallLayer.dispose(),this.textureLayer.dispose(),this.glbModelLayer.dispose(),this.laneLayer.dispose(),this.mergeGraphicLayer.dispose(),this.textTextureLayer.dispose(),this.grounds.forEach(e=>e.dispose()),(t=this.heatmap)==null||t.dispose(),this.groundUpper.clear(),this.models.children.forEach(e=>e.dispose()),this.models.clear(),this.modelMap.clear(),this.clear()}constructor(t){super(),this.context=t,this.grounds=new Set,this.shadow=new Fn,this.groundUpper=new Dt.Object3D,this.models=new Dt.Object3D,this.modelMap=new Map,this.groundMaxHeight=0,this.name="",this.key="",this.box=new Dt.Box3,this.groundLayer=new nt(this.context),this.graphicLayer=new Gn(this.context),this.poiLayer=new kn(this.context),this.poiLayer2=new Vn(this.context),this.parkingSpaceLayer=new Hn(this.context),this.wallLayer=new nt(this.context),this.textureLayer=new nt(this.context),this.glbModelLayer=new Wn(this.context),this.laneLayer=new nt(this.context),this.mergeGraphicLayer=new jn(this.context),this.textTextureLayer=new nt(this.context),this.groundUpper.add(this.graphicLayer),this.groundUpper.add(this.poiLayer),this.groundUpper.add(this.poiLayer2),this.groundUpper.add(this.parkingSpaceLayer),this.groundUpper.add(this.wallLayer),this.groundUpper.add(this.textureLayer),this.groundUpper.add(this.glbModelLayer),this.groundUpper.add(this.laneLayer),this.groundUpper.add(this.mergeGraphicLayer),this.groundUpper.add(this.textTextureLayer),this.add(this.groundUpper),this.add(this.groundLayer),this.add(this.models)}};var Hd=require("core-js/modules/es.array.push.js"),Wd=require("core-js/modules/web.dom-collections.iterator.js");var Vr=require("three");var Vt=class extends Vr.EventDispatcher{_registryEvent(){this.context.addEventListener("resize",this._onResize)}_unRegistryEvent(){this.context.removeEventListener("resize",this._onResize)}setEnable(t){this.enable=t,t?this.svg.style.display="block":this.svg.style.display="none"}getIntersectByPointerEvent(t){let{camera:e,renderer:n}=this.context,{offsetX:r,offsetY:i}=t,{clientWidth:o,clientHeight:s}=n.domElement,u=r/o*2-1,l=1-i/s*2;return new Vr.Vector3(u,l,0).unproject(e)}getSvgCoordinate(t){let{camera:e,container:n}=this.context;return N(t,e,n.clientWidth,n.clientHeight)}dispose(){this._unRegistryEvent(),this.context.container.removeChild(this.svg),this.svg=null}constructor(t){super(),this.context=t,this.points=[],this.enable=!0,this._onResize=e=>{let{width:n,height:r}=e;this.svg&&(this.svg.setAttribute("width",""+n),this.svg.setAttribute("height",""+r))},this.svg=Ei(""+t.container.clientWidth,""+t.container.clientHeight),t.container.appendChild(this.svg),this._registryEvent()}};var Zn=class extends Vt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}addPoint(t){if(this.points.push(t),this.points.length>=2){let e=this.calculatedDistance();this.dispatchEvent({type:"distance",distance:e})}}calculatedDistance(){let[{x:t,y:e},{x:n,y:r}]=this.points;return Math.sqrt((n-t)**2+(r-e)**2)}dispose(){super.dispose(),this.unRegistryEvent(),this.line=null,this.circles=[]}constructor(t){super(t),this.context=t,this.onUpdate=()=>{if(this.points[0]){let r=this.getSvgCoordinate(this.points[0]);Ae(this.circles[0],r.x,r.y),Yt(this.line,r)}if(this.points[1]){let r=this.getSvgCoordinate(this.points[1]);Ae(this.circles[1],r.x,r.y),Yt(this.line,void 0,r)}},this.onPointermove=r=>{this.points.length===1&&(this.line.style.display="block",Yt(this.line,void 0,{x:r.offsetX,y:r.offsetY}))},this.onPointerleave=()=>{this.points[1]||(this.line.style.display="none")},this.onPointerdown=r=>{if(this.points[1])return;let i=this.getIntersectByPointerEvent(r);if(i){let{offsetX:o,offsetY:s}=r,u=this.circles[this.points.length];Ae(u,o,s),this.points.length||Yt(this.line,{x:o,y:s},{x:o,y:s}),this.addPoint(i)}};let{config:{svg:{circle:e,line:n}}}=t;this.circles=[Je(e.radius,e.fill),Je(e.radius,e.fill)],this.line=In(n.stroke),this.svg.appendChild(this.circles[0]),this.svg.appendChild(this.circles[1]),this.svg.appendChild(this.line),this.registryEvent()}};var Yd=require("core-js/modules/es.array.push.js");var Kn=class extends Vt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}get lastLine(){return this.lines.slice(-1)[0]}addCircle(t){this.circles.push(t),this.svg.appendChild(t)}addLine(t){this.lines.push(t),this.svg.appendChild(t)}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}checkAdsorb(t,e){if(this.points.length<3)return!1;let n=this.circles[0],r=+n.getAttribute("cx"),i=+n.getAttribute("cy");return Math.sqrt((t-r)**2+(e-i)**2)<=5}addPoint(t){if(this.points.push(t),this.isClose){let e=this.calculatedArea();this.dispatchEvent({type:"area",area:e})}}calculatedArea(){let t=this.points.map(r=>[r.x,r.y]),e=0,n=t.length;for(let r=0;r<n;r++){let i=(r+1)%n;e+=t[r][0]*t[i][1]-t[i][0]*t[r][1]}return Math.abs(e/2)}dispose(){super.dispose(),this.unRegistryEvent(),this.lines=[],this.circles=[]}constructor(t){super(t),this.circles=[],this.lines=[],this.isClose=!1,this.onUpdate=()=>{this.points.length&&this.points.forEach((e,n)=>{let r=this.getSvgCoordinate(e);this.circles[n]&&Ae(this.circles[n],r.x,r.y),n!==0&&Yt(this.lines[n-1],void 0,r),this.lines[n]&&Yt(this.lines[n],r)})},this.onPointermove=e=>{!this.lastLine||this.isClose||(this.lastLine.style.display="block",Yt(this.lastLine,void 0,{x:e.offsetX,y:e.offsetY}))},this.onPointerleave=()=>{this.isClose||(this.lastLine.style.display="none")},this.onPointerdown=e=>{if(this.isClose)return;let n=this.getIntersectByPointerEvent(e);if(n){let{offsetX:r,offsetY:i}=e;this.checkAdsorb(r,i)?(this.isClose=!0,this.addPoint(this.points[0])):this.addPoint(n);let{circle:{fill:o,radius:s},line:{stroke:u}}=this.context.config.svg;if(!this.isClose){let l=Je(s,o);Ae(l,r,i),this.addCircle(l)}if(this.lines.length&&Yt(this.lastLine,void 0,{x:r,y:i}),!this.isClose){let l=In(u);Yt(l,{x:r,y:i},{x:r,y:i}),this.addLine(l)}}},this.registryEvent()}};var Bs=require("three");var Vi=class extends Vt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}selectGraphic(t){this.graphic=t}dispose(){super.dispose(),this.unRegistryEvent(),this.rect=null,this.cornerRect=[],this.centerRect=[]}constructor(t){super(t),this.context=t,this.cornerRect=[],this.centerRect=[],this.onUpdate=()=>{if(this.graphic){let n=new Bs.Box3().setFromObject(this.graphic),{camera:r,container:{clientWidth:i,clientHeight:o}}=this.context,{min:s,max:u}=n,l=N(s,r,i,o),c=N(u,r,i,o);Ct(this.rect,l.x,c.y,Math.abs(c.x-l.x),Math.abs(c.y-l.y));let{x:h,y:p}=l,{x:f,y:d}=c,m=5,y=[{x:h-m,y:d-m},{x:f-m,y:d-m},{x:h-m,y:p-m},{x:f-m,y:p-m}];for(let P=0;P<y.length;P++)Ct(this.cornerRect[P],y[P].x,y[P].y,m*2,m*2);let x=4,E=(h+f)/2,S=(p+d)/2,R=[{x:E-x,y:d-x},{x:h-x,y:S-x},{x:f-x,y:S-x},{x:E-x,y:p-x}];for(let P=0;P<R.length;P++)Ct(this.centerRect[P],R[P].x,R[P].y,x*2,x*2)}else{Ct(this.rect,0,0,0,0);for(let n=0;n<this.cornerRect.length;n++)Ct(this.cornerRect[n],0,0,0,0),Ct(this.centerRect[n],0,0,0,0)}};let{config:{svg:{line:e}}}=t;this.rect=xe(e.stroke,"transparent"),this.svg.appendChild(this.rect);for(let n=0;n<4;n++)this.cornerRect[n]=xe(e.stroke,"#ffffff"),this.centerRect[n]=xe(e.stroke,"#ffffff"),this.svg.appendChild(this.cornerRect[n]),this.svg.appendChild(this.centerRect[n]);this.registryEvent()}};var eg=require("core-js/modules/es.array.push.js"),At=require("three");var zs=require("three/examples/jsm/utils/BufferGeometryUtils.js");var $n=class extends At.Object3D{initGeometry(){return g(this,null,function*(){let t=yield ne.GetMergeGeometry(this.options);this.geometry=t})}initMaterial(){let t=`
|
|
8053
8053
|
varying vec3 vPosition; // \u7528\u4E8E\u4F20\u9012\u9876\u70B9\u7684\u4F4D\u7F6E\u7ED9\u7247\u6BB5\u7740\u8272\u5668
|
|
8054
8054
|
uniform float maxZ; // \u58F0\u660E\u4E00\u4E2Auniform\u53D8\u91CF
|
|
8055
8055
|
uniform vec3 uColor;
|