@terra.gl/core 0.0.1-alpha.7 → 0.0.1-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +66 -53
- package/dist/index.js +140 -139
- package/dist/index.umd.cjs +12 -12
- package/package.json +1 -1
package/dist/index.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(ee,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("three")):typeof define=="function"&&define.amd?define(["exports","three"],m):(ee=typeof globalThis<"u"?globalThis:ee||self,m(ee["terra-gl"]={},ee.THREE))})(this,function(ee,m){"use strict";var Ax=Object.defineProperty;var Fx=(ee,m,ar)=>m in ee?Ax(ee,m,{enumerable:!0,configurable:!0,writable:!0,value:ar}):ee[m]=ar;var G=(ee,m,ar)=>Fx(ee,typeof m!="symbol"?m+"":m,ar);function ar(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const e in a)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(a,e);Object.defineProperty(t,e,n.get?n:{enumerable:!0,get:()=>a[e]})}}return t.default=a,Object.freeze(t)}const wt=ar(m),Vh="0.0.1-alpha.8",Ms={name:"criska"};var Cr=function(){var a=0,t=document.createElement("div");t.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",t.addEventListener("click",function(p){p.preventDefault(),n(++a%t.children.length)},!1);function e(p){return t.appendChild(p.dom),p}function n(p){for(var f=0;f<t.children.length;f++)t.children[f].style.display=f===p?"block":"none";a=p}var r=(performance||Date).now(),s=r,l=0,c=e(new Cr.Panel("FPS","#0ff","#002")),u=e(new Cr.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var d=e(new Cr.Panel("MB","#f08","#201"));return n(0),{REVISION:16,dom:t,addPanel:e,showPanel:n,begin:function(){r=(performance||Date).now()},end:function(){l++;var p=(performance||Date).now();if(u.update(p-r,200),p>=s+1e3&&(c.update(l*1e3/(p-s),100),s=p,l=0,d)){var f=performance.memory;d.update(f.usedJSHeapSize/1048576,f.jsHeapSizeLimit/1048576)}return p},update:function(){r=this.end()},domElement:t,setMode:n}};Cr.Panel=function(a,t,e){var n=1/0,r=0,s=Math.round,l=s(window.devicePixelRatio||1),c=80*l,u=48*l,d=3*l,p=2*l,f=3*l,y=15*l,v=74*l,b=30*l,T=document.createElement("canvas");T.width=c,T.height=u,T.style.cssText="width:80px;height:48px";var _=T.getContext("2d");return _.font="bold "+9*l+"px Helvetica,Arial,sans-serif",_.textBaseline="top",_.fillStyle=e,_.fillRect(0,0,c,u),_.fillStyle=t,_.fillText(a,d,p),_.fillRect(f,y,v,b),_.fillStyle=e,_.globalAlpha=.9,_.fillRect(f,y,v,b),{dom:T,update:function(S,L){n=Math.min(n,S),r=Math.max(r,S),_.fillStyle=e,_.globalAlpha=1,_.fillRect(0,0,c,y),_.fillStyle=t,_.fillText(s(S)+" "+a+" ("+s(n)+"-"+s(r)+")",d,p),_.drawImage(T,f+l,y,v-l,b,f,y,v-l,b),_.fillRect(f+v-l,y,l,b),_.fillStyle=e,_.globalAlpha=.9,_.fillRect(f+v-l,y,l,s((1-S/L)*b))}}};const fi=parseInt(m.REVISION.replace(/\D+/g,"")),Ls=fi>=125?"uv1":"uv2";function Wa(a,t){if(t===m.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),a;if(t===m.TriangleFanDrawMode||t===m.TriangleStripDrawMode){let e=a.getIndex();if(e===null){const l=[],c=a.getAttribute("position");if(c!==void 0){for(let u=0;u<c.count;u++)l.push(u);a.setIndex(l),e=a.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),a}const n=e.count-2,r=[];if(e)if(t===m.TriangleFanDrawMode)for(let l=1;l<=n;l++)r.push(e.getX(0)),r.push(e.getX(l)),r.push(e.getX(l+1));else for(let l=0;l<n;l++)l%2===0?(r.push(e.getX(l)),r.push(e.getX(l+1)),r.push(e.getX(l+2))):(r.push(e.getX(l+2)),r.push(e.getX(l+1)),r.push(e.getX(l)));r.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=a.clone();return s.setIndex(r),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),a}var Gt=Uint8Array,xn=Uint16Array,Ss=Uint32Array,Pa=new Gt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Ca=new Gt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Ah=new Gt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Va=function(a,t){for(var e=new xn(31),n=0;n<31;++n)e[n]=t+=1<<a[n-1];for(var r=new Ss(e[30]),n=1;n<30;++n)for(var s=e[n];s<e[n+1];++s)r[s]=s-e[n]<<5|n;return[e,r]},Aa=Va(Pa,2),Fa=Aa[0],Fh=Aa[1];Fa[28]=258,Fh[258]=28;for(var Xh=Va(Ca,0),kh=Xh[0],Ts=new xn(32768),Pe=0;Pe<32768;++Pe){var _n=(Pe&43690)>>>1|(Pe&21845)<<1;_n=(_n&52428)>>>2|(_n&13107)<<2,_n=(_n&61680)>>>4|(_n&3855)<<4,Ts[Pe]=((_n&65280)>>>8|(_n&255)<<8)>>>1}for(var Vr=function(a,t,e){for(var n=a.length,r=0,s=new xn(t);r<n;++r)++s[a[r]-1];var l=new xn(t);for(r=0;r<t;++r)l[r]=l[r-1]+s[r-1]<<1;var c;if(e){c=new xn(1<<t);var u=15-t;for(r=0;r<n;++r)if(a[r])for(var d=r<<4|a[r],p=t-a[r],f=l[a[r]-1]++<<p,y=f|(1<<p)-1;f<=y;++f)c[Ts[f]>>>u]=d}else for(c=new xn(n),r=0;r<n;++r)a[r]&&(c[r]=Ts[l[a[r]-1]++]>>>15-a[r]);return c},Ar=new Gt(288),Pe=0;Pe<144;++Pe)Ar[Pe]=8;for(var Pe=144;Pe<256;++Pe)Ar[Pe]=9;for(var Pe=256;Pe<280;++Pe)Ar[Pe]=7;for(var Pe=280;Pe<288;++Pe)Ar[Pe]=8;for(var Xa=new Gt(32),Pe=0;Pe<32;++Pe)Xa[Pe]=5;var Dh=Vr(Ar,9,1),zh=Vr(Xa,5,1),Gs=function(a){for(var t=a[0],e=1;e<a.length;++e)a[e]>t&&(t=a[e]);return t},Kt=function(a,t,e){var n=t/8|0;return(a[n]|a[n+1]<<8)>>(t&7)&e},Zs=function(a,t){var e=t/8|0;return(a[e]|a[e+1]<<8|a[e+2]<<16)>>(t&7)},Oh=function(a){return(a/8|0)+(a&7&&1)},Kh=function(a,t,e){(e==null||e>a.length)&&(e=a.length);var n=new(a instanceof xn?xn:a instanceof Ss?Ss:Gt)(e-t);return n.set(a.subarray(t,e)),n},Rh=function(a,t,e){var n=a.length;if(!n||e&&!e.l&&n<5)return t||new Gt(0);var r=!t||e,s=!e||e.i;e||(e={}),t||(t=new Gt(n*3));var l=function(je){var Je=t.length;if(je>Je){var Qe=new Gt(Math.max(Je*2,je));Qe.set(t),t=Qe}},c=e.f||0,u=e.p||0,d=e.b||0,p=e.l,f=e.d,y=e.m,v=e.n,b=n*8;do{if(!p){e.f=c=Kt(a,u,1);var T=Kt(a,u+1,3);if(u+=3,T)if(T==1)p=Dh,f=zh,y=9,v=5;else if(T==2){var I=Kt(a,u,31)+257,F=Kt(a,u+10,15)+4,K=I+Kt(a,u+5,31)+1;u+=14;for(var D=new Gt(K),O=new Gt(19),V=0;V<F;++V)O[Ah[V]]=Kt(a,u+V*3,7);u+=F*3;for(var R=Gs(O),P=(1<<R)-1,k=Vr(O,R,1),V=0;V<K;){var N=k[Kt(a,u,P)];u+=N&15;var _=N>>>4;if(_<16)D[V++]=_;else{var H=0,Q=0;for(_==16?(Q=3+Kt(a,u,3),u+=2,H=D[V-1]):_==17?(Q=3+Kt(a,u,7),u+=3):_==18&&(Q=11+Kt(a,u,127),u+=7);Q--;)D[V++]=H}}var q=D.subarray(0,I),J=D.subarray(I);y=Gs(q),v=Gs(J),p=Vr(q,y,1),f=Vr(J,v,1)}else throw"invalid block type";else{var _=Oh(u)+4,S=a[_-4]|a[_-3]<<8,L=_+S;if(L>n){if(s)throw"unexpected EOF";break}r&&l(d+S),t.set(a.subarray(_,L),d),e.b=d+=S,e.p=u=L*8;continue}if(u>b){if(s)throw"unexpected EOF";break}}r&&l(d+131072);for(var oe=(1<<y)-1,ie=(1<<v)-1,te=u;;te=u){var H=p[Zs(a,u)&oe],me=H>>>4;if(u+=H&15,u>b){if(s)throw"unexpected EOF";break}if(!H)throw"invalid length/literal";if(me<256)t[d++]=me;else if(me==256){te=u,p=null;break}else{var xe=me-254;if(me>264){var V=me-257,he=Pa[V];xe=Kt(a,u,(1<<he)-1)+Fa[V],u+=he}var ve=f[Zs(a,u)&ie],ke=ve>>>4;if(!ve)throw"invalid distance";u+=ve&15;var J=kh[ke];if(ke>3){var he=Ca[ke];J+=Zs(a,u)&(1<<he)-1,u+=he}if(u>b){if(s)throw"unexpected EOF";break}r&&l(d+131072);for(var Ye=d+xe;d<Ye;d+=4)t[d]=t[d-J],t[d+1]=t[d+1-J],t[d+2]=t[d+2-J],t[d+3]=t[d+3-J];d=Ye}}e.l=p,e.p=te,e.b=d,p&&(c=1,e.m=y,e.d=f,e.n=v)}while(!c);return d==t.length?t:Kh(t,0,d)},Yh=new Gt(0),Uh=function(a){if((a[0]&15)!=8||a[0]>>>4>7||(a[0]<<8|a[1])%31)throw"invalid zlib data";if(a[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function Bh(a,t){return Rh((Uh(a),a.subarray(2,-4)),t)}var Nh=typeof TextDecoder<"u"&&new TextDecoder,jh=0;try{Nh.decode(Yh,{stream:!0}),jh=1}catch{}class Jh extends m.Mesh{constructor(t,e={}){super(t),this.isWater=!0;const n=this,r=e.textureWidth!==void 0?e.textureWidth:512,s=e.textureHeight!==void 0?e.textureHeight:512,l=e.clipBias!==void 0?e.clipBias:0,c=e.alpha!==void 0?e.alpha:1,u=e.time!==void 0?e.time:0,d=e.waterNormals!==void 0?e.waterNormals:null,p=e.sunDirection!==void 0?e.sunDirection:new m.Vector3(.70707,.70707,0),f=new m.Color(e.sunColor!==void 0?e.sunColor:16777215),y=new m.Color(e.waterColor!==void 0?e.waterColor:8355711),v=e.eye!==void 0?e.eye:new m.Vector3(0,0,0),b=e.distortionScale!==void 0?e.distortionScale:20,T=e.side!==void 0?e.side:m.FrontSide,_=e.fog!==void 0?e.fog:!1,S=new m.Plane,L=new m.Vector3,I=new m.Vector3,F=new m.Vector3,K=new m.Matrix4,D=new m.Vector3(0,0,-1),O=new m.Vector4,V=new m.Vector3,R=new m.Vector3,P=new m.Vector4,k=new m.Matrix4,N=new m.PerspectiveCamera,H=new m.WebGLRenderTarget(r,s),Q={uniforms:m.UniformsUtils.merge([m.UniformsLib.fog,m.UniformsLib.lights,{normalSampler:{value:null},mirrorSampler:{value:null},alpha:{value:1},time:{value:0},size:{value:1},distortionScale:{value:20},textureMatrix:{value:new m.Matrix4},sunColor:{value:new m.Color(8355711)},sunDirection:{value:new m.Vector3(.70707,.70707,0)},eye:{value:new m.Vector3},waterColor:{value:new m.Color(5592405)}}]),vertexShader:`
|
|
2
2
|
uniform mat4 textureMatrix;
|
|
3
3
|
uniform float time;
|
|
4
4
|
|
|
@@ -94,11 +94,11 @@
|
|
|
94
94
|
#include <tonemapping_fragment>
|
|
95
95
|
#include <${fi>=154?"colorspace_fragment":"encodings_fragment"}>
|
|
96
96
|
#include <fog_fragment>
|
|
97
|
-
}`},q=new m.ShaderMaterial({fragmentShader:Q.fragmentShader,vertexShader:Q.vertexShader,uniforms:m.UniformsUtils.clone(Q.uniforms),lights:!0,side:T,fog:_});q.uniforms.mirrorSampler.value=H.texture,q.uniforms.textureMatrix.value=k,q.uniforms.alpha.value=c,q.uniforms.time.value=u,q.uniforms.normalSampler.value=d,q.uniforms.sunColor.value=f,q.uniforms.waterColor.value=y,q.uniforms.sunDirection.value=p,q.uniforms.distortionScale.value=b,q.uniforms.eye.value=v,n.material=q,n.onBeforeRender=function(J,oe,ie){if(I.setFromMatrixPosition(n.matrixWorld),F.setFromMatrixPosition(ie.matrixWorld),K.extractRotation(n.matrixWorld),L.set(0,0,1),L.applyMatrix4(K),V.subVectors(I,F),V.dot(L)>0)return;V.reflect(L).negate(),V.add(I),K.extractRotation(ie.matrixWorld),D.set(0,0,-1),D.applyMatrix4(K),D.add(F),R.subVectors(I,D),R.reflect(L).negate(),R.add(I),N.position.copy(V),N.up.set(0,1,0),N.up.applyMatrix4(K),N.up.reflect(L),N.lookAt(R),N.far=ie.far,N.updateMatrixWorld(),N.projectionMatrix.copy(ie.projectionMatrix),k.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),k.multiply(N.projectionMatrix),k.multiply(N.matrixWorldInverse),S.setFromNormalAndCoplanarPoint(L,I),S.applyMatrix4(N.matrixWorldInverse),O.set(S.normal.x,S.normal.y,S.normal.z,S.constant);const ee=N.projectionMatrix;P.x=(Math.sign(O.x)+ee.elements[8])/ee.elements[0],P.y=(Math.sign(O.y)+ee.elements[9])/ee.elements[5],P.z=-1,P.w=(1+ee.elements[10])/ee.elements[14],O.multiplyScalar(2/O.dot(P)),ee.elements[2]=O.x,ee.elements[6]=O.y,ee.elements[10]=O.z+1-l,ee.elements[14]=O.w,v.setFromMatrixPosition(ie.matrixWorld);const me=J.getRenderTarget(),xe=J.xr.enabled,he=J.shadowMap.autoUpdate;n.visible=!1,J.xr.enabled=!1,J.shadowMap.autoUpdate=!1,J.setRenderTarget(H),J.state.buffers.depth.setMask(!0),J.autoClear===!1&&J.clear(),J.render(oe,N),n.visible=!0,J.xr.enabled=xe,J.shadowMap.autoUpdate=he,J.setRenderTarget(me);const ve=ie.viewport;ve!==void 0&&J.state.viewport(ve)}}}var Qh=Object.defineProperty,Hh=(a,t,e)=>t in a?Qh(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e,Eh=(a,t,e)=>(Hh(a,t+"",e),e);class qh{constructor(){Eh(this,"_listeners")}addEventListener(t,e){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[t]===void 0&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;const n=this._listeners;return n[t]!==void 0&&n[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;const r=this._listeners[t];if(r!==void 0){const s=r.indexOf(e);s!==-1&&r.splice(s,1)}}dispatchEvent(t){if(this._listeners===void 0)return;const n=this._listeners[t.type];if(n!==void 0){t.target=this;const r=n.slice(0);for(let s=0,l=r.length;s<l;s++)r[s].call(this,t);t.target=null}}}var $h=Object.defineProperty,ed=(a,t,e)=>t in a?$h(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e,se=(a,t,e)=>(ed(a,typeof t!="symbol"?t+"":t,e),e);const pi=new m.Ray,ka=new m.Plane,td=Math.cos(70*(Math.PI/180)),Da=(a,t)=>(a%t+t)%t;class nd extends qh{constructor(t,e){super(),se(this,"object"),se(this,"domElement"),se(this,"enabled",!0),se(this,"target",new m.Vector3),se(this,"minDistance",0),se(this,"maxDistance",1/0),se(this,"minZoom",0),se(this,"maxZoom",1/0),se(this,"minPolarAngle",0),se(this,"maxPolarAngle",Math.PI),se(this,"minAzimuthAngle",-1/0),se(this,"maxAzimuthAngle",1/0),se(this,"enableDamping",!1),se(this,"dampingFactor",.05),se(this,"enableZoom",!0),se(this,"zoomSpeed",1),se(this,"enableRotate",!0),se(this,"rotateSpeed",1),se(this,"enablePan",!0),se(this,"panSpeed",1),se(this,"screenSpacePanning",!0),se(this,"keyPanSpeed",7),se(this,"zoomToCursor",!1),se(this,"autoRotate",!1),se(this,"autoRotateSpeed",2),se(this,"reverseOrbit",!1),se(this,"reverseHorizontalOrbit",!1),se(this,"reverseVerticalOrbit",!1),se(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),se(this,"mouseButtons",{LEFT:m.MOUSE.ROTATE,MIDDLE:m.MOUSE.DOLLY,RIGHT:m.MOUSE.PAN}),se(this,"touches",{ONE:m.TOUCH.ROTATE,TWO:m.TOUCH.DOLLY_PAN}),se(this,"target0"),se(this,"position0"),se(this,"zoom0"),se(this,"_domElementKeyEvents",null),se(this,"getPolarAngle"),se(this,"getAzimuthalAngle"),se(this,"setPolarAngle"),se(this,"setAzimuthalAngle"),se(this,"getDistance"),se(this,"getZoomScale"),se(this,"listenToKeyEvents"),se(this,"stopListenToKeyEvents"),se(this,"saveState"),se(this,"reset"),se(this,"update"),se(this,"connect"),se(this,"dispose"),se(this,"dollyIn"),se(this,"dollyOut"),se(this,"getScale"),se(this,"setScale"),this.object=t,this.domElement=e,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>p.phi,this.getAzimuthalAngle=()=>p.theta,this.setPolarAngle=X=>{let E=Da(X,2*Math.PI),ue=p.phi;ue<0&&(ue+=2*Math.PI),E<0&&(E+=2*Math.PI);let Se=Math.abs(E-ue);2*Math.PI-Se<Se&&(E<ue?E+=2*Math.PI:ue+=2*Math.PI),f.phi=E-ue,n.update()},this.setAzimuthalAngle=X=>{let E=Da(X,2*Math.PI),ue=p.theta;ue<0&&(ue+=2*Math.PI),E<0&&(E+=2*Math.PI);let Se=Math.abs(E-ue);2*Math.PI-Se<Se&&(E<ue?E+=2*Math.PI:ue+=2*Math.PI),f.theta=E-ue,n.update()},this.getDistance=()=>n.object.position.distanceTo(n.target),this.listenToKeyEvents=X=>{X.addEventListener("keydown",sn),this._domElementKeyEvents=X},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",sn),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(r),n.update(),u=c.NONE},this.update=(()=>{const X=new m.Vector3,E=new m.Vector3(0,1,0),ue=new m.Quaternion().setFromUnitVectors(t.up,E),Se=ue.clone().invert(),Re=new m.Vector3,Pt=new m.Quaternion,Bt=2*Math.PI;return function(){const Ai=n.object.position;ue.setFromUnitVectors(t.up,E),Se.copy(ue).invert(),X.copy(Ai).sub(n.target),X.applyQuaternion(ue),p.setFromVector3(X),n.autoRotate&&u===c.NONE&&Q(N()),n.enableDamping?(p.theta+=f.theta*n.dampingFactor,p.phi+=f.phi*n.dampingFactor):(p.theta+=f.theta,p.phi+=f.phi);let Nt=n.minAzimuthAngle,jt=n.maxAzimuthAngle;isFinite(Nt)&&isFinite(jt)&&(Nt<-Math.PI?Nt+=Bt:Nt>Math.PI&&(Nt-=Bt),jt<-Math.PI?jt+=Bt:jt>Math.PI&&(jt-=Bt),Nt<=jt?p.theta=Math.max(Nt,Math.min(jt,p.theta)):p.theta=p.theta>(Nt+jt)/2?Math.max(Nt,p.theta):Math.min(jt,p.theta)),p.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,p.phi)),p.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(v,n.dampingFactor):n.target.add(v),n.zoomToCursor&&R||n.object.isOrthographicCamera?p.radius=ve(p.radius):p.radius=ve(p.radius*y),X.setFromSpherical(p),X.applyQuaternion(Se),Ai.copy(n.target).add(X),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(f.theta*=1-n.dampingFactor,f.phi*=1-n.dampingFactor,v.multiplyScalar(1-n.dampingFactor)):(f.set(0,0,0),v.set(0,0,0));let Wn=!1;if(n.zoomToCursor&&R){let Hn=null;if(n.object instanceof m.PerspectiveCamera&&n.object.isPerspectiveCamera){const En=X.length();Hn=ve(En*y);const yr=En-Hn;n.object.position.addScaledVector(O,yr),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const En=new m.Vector3(V.x,V.y,0);En.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/y)),n.object.updateProjectionMatrix(),Wn=!0;const yr=new m.Vector3(V.x,V.y,0);yr.unproject(n.object),n.object.position.sub(yr).add(En),n.object.updateMatrixWorld(),Hn=X.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;Hn!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(Hn).add(n.object.position):(pi.origin.copy(n.object.position),pi.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(pi.direction))<td?t.lookAt(n.target):(ka.setFromNormalAndCoplanarPoint(n.object.up,n.target),pi.intersectPlane(ka,n.target))))}else n.object instanceof m.OrthographicCamera&&n.object.isOrthographicCamera&&(Wn=y!==1,Wn&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/y)),n.object.updateProjectionMatrix()));return y=1,R=!1,Wn||Re.distanceToSquared(n.object.position)>d||8*(1-Pt.dot(n.object.quaternion))>d?(n.dispatchEvent(r),Re.copy(n.object.position),Pt.copy(n.object.quaternion),Wn=!1,!0):!1}})(),this.connect=X=>{n.domElement=X,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",mr),n.domElement.addEventListener("pointerdown",Gn),n.domElement.addEventListener("pointercancel",jn),n.domElement.addEventListener("wheel",In)},this.dispose=()=>{var X,E,ue,Se,Re,Pt;n.domElement&&(n.domElement.style.touchAction="auto"),(X=n.domElement)==null||X.removeEventListener("contextmenu",mr),(E=n.domElement)==null||E.removeEventListener("pointerdown",Gn),(ue=n.domElement)==null||ue.removeEventListener("pointercancel",jn),(Se=n.domElement)==null||Se.removeEventListener("wheel",In),(Re=n.domElement)==null||Re.ownerDocument.removeEventListener("pointermove",Zn),(Pt=n.domElement)==null||Pt.ownerDocument.removeEventListener("pointerup",jn),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",sn)};const n=this,r={type:"change"},s={type:"start"},l={type:"end"},c={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let u=c.NONE;const d=1e-6,p=new m.Spherical,f=new m.Spherical;let y=1;const v=new m.Vector3,b=new m.Vector2,T=new m.Vector2,_=new m.Vector2,S=new m.Vector2,L=new m.Vector2,I=new m.Vector2,F=new m.Vector2,K=new m.Vector2,D=new m.Vector2,O=new m.Vector3,V=new m.Vector2;let R=!1;const P=[],k={};function N(){return 2*Math.PI/60/60*n.autoRotateSpeed}function H(){return Math.pow(.95,n.zoomSpeed)}function Q(X){n.reverseOrbit||n.reverseHorizontalOrbit?f.theta+=X:f.theta-=X}function q(X){n.reverseOrbit||n.reverseVerticalOrbit?f.phi+=X:f.phi-=X}const J=(()=>{const X=new m.Vector3;return function(ue,Se){X.setFromMatrixColumn(Se,0),X.multiplyScalar(-ue),v.add(X)}})(),oe=(()=>{const X=new m.Vector3;return function(ue,Se){n.screenSpacePanning===!0?X.setFromMatrixColumn(Se,1):(X.setFromMatrixColumn(Se,0),X.crossVectors(n.object.up,X)),X.multiplyScalar(ue),v.add(X)}})(),ie=(()=>{const X=new m.Vector3;return function(ue,Se){const Re=n.domElement;if(Re&&n.object instanceof m.PerspectiveCamera&&n.object.isPerspectiveCamera){const Pt=n.object.position;X.copy(Pt).sub(n.target);let Bt=X.length();Bt*=Math.tan(n.object.fov/2*Math.PI/180),J(2*ue*Bt/Re.clientHeight,n.object.matrix),oe(2*Se*Bt/Re.clientHeight,n.object.matrix)}else Re&&n.object instanceof m.OrthographicCamera&&n.object.isOrthographicCamera?(J(ue*(n.object.right-n.object.left)/n.object.zoom/Re.clientWidth,n.object.matrix),oe(Se*(n.object.top-n.object.bottom)/n.object.zoom/Re.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function ee(X){n.object instanceof m.PerspectiveCamera&&n.object.isPerspectiveCamera||n.object instanceof m.OrthographicCamera&&n.object.isOrthographicCamera?y=X:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function me(X){ee(y/X)}function xe(X){ee(y*X)}function he(X){if(!n.zoomToCursor||!n.domElement)return;R=!0;const E=n.domElement.getBoundingClientRect(),ue=X.clientX-E.left,Se=X.clientY-E.top,Re=E.width,Pt=E.height;V.x=ue/Re*2-1,V.y=-(Se/Pt)*2+1,O.set(V.x,V.y,1).unproject(n.object).sub(n.object.position).normalize()}function ve(X){return Math.max(n.minDistance,Math.min(n.maxDistance,X))}function ke(X){b.set(X.clientX,X.clientY)}function Ye(X){he(X),F.set(X.clientX,X.clientY)}function je(X){S.set(X.clientX,X.clientY)}function Je(X){T.set(X.clientX,X.clientY),_.subVectors(T,b).multiplyScalar(n.rotateSpeed);const E=n.domElement;E&&(Q(2*Math.PI*_.x/E.clientHeight),q(2*Math.PI*_.y/E.clientHeight)),b.copy(T),n.update()}function Qe(X){K.set(X.clientX,X.clientY),D.subVectors(K,F),D.y>0?me(H()):D.y<0&&xe(H()),F.copy(K),n.update()}function ct(X){L.set(X.clientX,X.clientY),I.subVectors(L,S).multiplyScalar(n.panSpeed),ie(I.x,I.y),S.copy(L),n.update()}function pt(X){he(X),X.deltaY<0?xe(H()):X.deltaY>0&&me(H()),n.update()}function Ue(X){let E=!1;switch(X.code){case n.keys.UP:ie(0,n.keyPanSpeed),E=!0;break;case n.keys.BOTTOM:ie(0,-n.keyPanSpeed),E=!0;break;case n.keys.LEFT:ie(n.keyPanSpeed,0),E=!0;break;case n.keys.RIGHT:ie(-n.keyPanSpeed,0),E=!0;break}E&&(X.preventDefault(),n.update())}function hn(){if(P.length==1)b.set(P[0].pageX,P[0].pageY);else{const X=.5*(P[0].pageX+P[1].pageX),E=.5*(P[0].pageY+P[1].pageY);b.set(X,E)}}function Tn(){if(P.length==1)S.set(P[0].pageX,P[0].pageY);else{const X=.5*(P[0].pageX+P[1].pageX),E=.5*(P[0].pageY+P[1].pageY);S.set(X,E)}}function Ae(){const X=P[0].pageX-P[1].pageX,E=P[0].pageY-P[1].pageY,ue=Math.sqrt(X*X+E*E);F.set(0,ue)}function Ut(){n.enableZoom&&Ae(),n.enablePan&&Tn()}function It(){n.enableZoom&&Ae(),n.enableRotate&&hn()}function Wt(X){if(P.length==1)T.set(X.pageX,X.pageY);else{const ue=Qn(X),Se=.5*(X.pageX+ue.x),Re=.5*(X.pageY+ue.y);T.set(Se,Re)}_.subVectors(T,b).multiplyScalar(n.rotateSpeed);const E=n.domElement;E&&(Q(2*Math.PI*_.x/E.clientHeight),q(2*Math.PI*_.y/E.clientHeight)),b.copy(T)}function jr(X){if(P.length==1)L.set(X.pageX,X.pageY);else{const E=Qn(X),ue=.5*(X.pageX+E.x),Se=.5*(X.pageY+E.y);L.set(ue,Se)}I.subVectors(L,S).multiplyScalar(n.panSpeed),ie(I.x,I.y),S.copy(L)}function Vi(X){const E=Qn(X),ue=X.pageX-E.x,Se=X.pageY-E.y,Re=Math.sqrt(ue*ue+Se*Se);K.set(0,Re),D.set(0,Math.pow(K.y/F.y,n.zoomSpeed)),me(D.y),F.copy(K)}function Nn(X){n.enableZoom&&Vi(X),n.enablePan&&jr(X)}function bt(X){n.enableZoom&&Vi(X),n.enableRotate&&Wt(X)}function Gn(X){var E,ue;n.enabled!==!1&&(P.length===0&&((E=n.domElement)==null||E.ownerDocument.addEventListener("pointermove",Zn),(ue=n.domElement)==null||ue.ownerDocument.addEventListener("pointerup",jn)),Hr(X),X.pointerType==="touch"?Jr(X):Jn(X))}function Zn(X){n.enabled!==!1&&(X.pointerType==="touch"?Qr(X):yo(X))}function jn(X){var E,ue,Se;Er(X),P.length===0&&((E=n.domElement)==null||E.releasePointerCapture(X.pointerId),(ue=n.domElement)==null||ue.ownerDocument.removeEventListener("pointermove",Zn),(Se=n.domElement)==null||Se.ownerDocument.removeEventListener("pointerup",jn)),n.dispatchEvent(l),u=c.NONE}function Jn(X){let E;switch(X.button){case 0:E=n.mouseButtons.LEFT;break;case 1:E=n.mouseButtons.MIDDLE;break;case 2:E=n.mouseButtons.RIGHT;break;default:E=-1}switch(E){case m.MOUSE.DOLLY:if(n.enableZoom===!1)return;Ye(X),u=c.DOLLY;break;case m.MOUSE.ROTATE:if(X.ctrlKey||X.metaKey||X.shiftKey){if(n.enablePan===!1)return;je(X),u=c.PAN}else{if(n.enableRotate===!1)return;ke(X),u=c.ROTATE}break;case m.MOUSE.PAN:if(X.ctrlKey||X.metaKey||X.shiftKey){if(n.enableRotate===!1)return;ke(X),u=c.ROTATE}else{if(n.enablePan===!1)return;je(X),u=c.PAN}break;default:u=c.NONE}u!==c.NONE&&n.dispatchEvent(s)}function yo(X){if(n.enabled!==!1)switch(u){case c.ROTATE:if(n.enableRotate===!1)return;Je(X);break;case c.DOLLY:if(n.enableZoom===!1)return;Qe(X);break;case c.PAN:if(n.enablePan===!1)return;ct(X);break}}function In(X){n.enabled===!1||n.enableZoom===!1||u!==c.NONE&&u!==c.ROTATE||(X.preventDefault(),n.dispatchEvent(s),pt(X),n.dispatchEvent(l))}function sn(X){n.enabled===!1||n.enablePan===!1||Ue(X)}function Jr(X){switch(gr(X),P.length){case 1:switch(n.touches.ONE){case m.TOUCH.ROTATE:if(n.enableRotate===!1)return;hn(),u=c.TOUCH_ROTATE;break;case m.TOUCH.PAN:if(n.enablePan===!1)return;Tn(),u=c.TOUCH_PAN;break;default:u=c.NONE}break;case 2:switch(n.touches.TWO){case m.TOUCH.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Ut(),u=c.TOUCH_DOLLY_PAN;break;case m.TOUCH.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;It(),u=c.TOUCH_DOLLY_ROTATE;break;default:u=c.NONE}break;default:u=c.NONE}u!==c.NONE&&n.dispatchEvent(s)}function Qr(X){switch(gr(X),u){case c.TOUCH_ROTATE:if(n.enableRotate===!1)return;Wt(X),n.update();break;case c.TOUCH_PAN:if(n.enablePan===!1)return;jr(X),n.update();break;case c.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Nn(X),n.update();break;case c.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;bt(X),n.update();break;default:u=c.NONE}}function mr(X){n.enabled!==!1&&X.preventDefault()}function Hr(X){P.push(X)}function Er(X){delete k[X.pointerId];for(let E=0;E<P.length;E++)if(P[E].pointerId==X.pointerId){P.splice(E,1);return}}function gr(X){let E=k[X.pointerId];E===void 0&&(E=new m.Vector2,k[X.pointerId]=E),E.set(X.pageX,X.pageY)}function Qn(X){const E=X.pointerId===P[0].pointerId?P[1]:P[0];return k[E.pointerId]}this.dollyIn=(X=H())=>{xe(X),n.update()},this.dollyOut=(X=H())=>{me(X),n.update()},this.getScale=()=>y,this.setScale=X=>{ee(X),n.update()},this.getZoomScale=()=>H(),e!==void 0&&this.connect(e),this.update()}}class rd extends nd{constructor(t,e){super(t,e),this.screenSpacePanning=!1,this.mouseButtons.LEFT=m.MOUSE.PAN,this.mouseButtons.RIGHT=m.MOUSE.ROTATE,this.touches.ONE=m.TOUCH.PAN,this.touches.TWO=m.TOUCH.DOLLY_ROTATE}}function lr(a){if(typeof TextDecoder<"u")return new TextDecoder().decode(a);let t="";for(let e=0,n=a.length;e<n;e++)t+=String.fromCharCode(a[e]);try{return decodeURIComponent(escape(t))}catch{return t}}const On="srgb",cn="srgb-linear",za=3001,id=3e3;class sd extends m.Loader{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new ud(e)}),this.register(function(e){return new hd(e)}),this.register(function(e){return new bd(e)}),this.register(function(e){return new xd(e)}),this.register(function(e){return new _d(e)}),this.register(function(e){return new fd(e)}),this.register(function(e){return new pd(e)}),this.register(function(e){return new md(e)}),this.register(function(e){return new gd(e)}),this.register(function(e){return new cd(e)}),this.register(function(e){return new yd(e)}),this.register(function(e){return new dd(e)}),this.register(function(e){return new wd(e)}),this.register(function(e){return new vd(e)}),this.register(function(e){return new ad(e)}),this.register(function(e){return new Md(e)}),this.register(function(e){return new Ld(e)})}load(t,e,n,r){const s=this;let l;if(this.resourcePath!=="")l=this.resourcePath;else if(this.path!==""){const d=m.LoaderUtils.extractUrlBase(t);l=m.LoaderUtils.resolveURL(d,this.path)}else l=m.LoaderUtils.extractUrlBase(t);this.manager.itemStart(t);const c=function(d){r?r(d):console.error(d),s.manager.itemError(t),s.manager.itemEnd(t)},u=new m.FileLoader(this.manager);u.setPath(this.path),u.setResponseType("arraybuffer"),u.setRequestHeader(this.requestHeader),u.setWithCredentials(this.withCredentials),u.load(t,function(d){try{s.parse(d,l,function(p){e(p),s.manager.itemEnd(t)},c)}catch(p){c(p)}},n,c)}setDRACOLoader(t){return this.dracoLoader=t,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return this.pluginCallbacks.indexOf(t)===-1&&this.pluginCallbacks.push(t),this}unregister(t){return this.pluginCallbacks.indexOf(t)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,e,n,r){let s;const l={},c={};if(typeof t=="string")s=JSON.parse(t);else if(t instanceof ArrayBuffer)if(lr(new Uint8Array(t.slice(0,4)))===Oa){try{l[we.KHR_BINARY_GLTF]=new Sd(t)}catch(p){r&&r(p);return}s=JSON.parse(l[we.KHR_BINARY_GLTF].content)}else s=JSON.parse(lr(new Uint8Array(t)));else s=t;if(s.asset===void 0||s.asset.version[0]<2){r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const u=new Dd(s,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(let d=0;d<this.pluginCallbacks.length;d++){const p=this.pluginCallbacks[d](u);p.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),c[p.name]=p,l[p.name]=!0}if(s.extensionsUsed)for(let d=0;d<s.extensionsUsed.length;++d){const p=s.extensionsUsed[d],f=s.extensionsRequired||[];switch(p){case we.KHR_MATERIALS_UNLIT:l[p]=new ld;break;case we.KHR_DRACO_MESH_COMPRESSION:l[p]=new Td(s,this.dracoLoader);break;case we.KHR_TEXTURE_TRANSFORM:l[p]=new Gd;break;case we.KHR_MESH_QUANTIZATION:l[p]=new Zd;break;default:f.indexOf(p)>=0&&c[p]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+p+'".')}}u.setExtensions(l),u.setPlugins(c),u.parse(n,r)}parseAsync(t,e){const n=this;return new Promise(function(r,s){n.parse(t,e,r,s)})}}function od(){let a={};return{get:function(t){return a[t]},add:function(t,e){a[t]=e},remove:function(t){delete a[t]},removeAll:function(){a={}}}}const we={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class ad{constructor(t){this.parser=t,this.name=we.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let n=0,r=e.length;n<r;n++){const s=e[n];s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0&&t._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(t){const e=this.parser,n="light:"+t;let r=e.cache.get(n);if(r)return r;const s=e.json,u=((s.extensions&&s.extensions[this.name]||{}).lights||[])[t];let d;const p=new m.Color(16777215);u.color!==void 0&&p.setRGB(u.color[0],u.color[1],u.color[2],cn);const f=u.range!==void 0?u.range:0;switch(u.type){case"directional":d=new m.DirectionalLight(p),d.target.position.set(0,0,-1),d.add(d.target);break;case"point":d=new m.PointLight(p),d.distance=f;break;case"spot":d=new m.SpotLight(p),d.distance=f,u.spot=u.spot||{},u.spot.innerConeAngle=u.spot.innerConeAngle!==void 0?u.spot.innerConeAngle:0,u.spot.outerConeAngle=u.spot.outerConeAngle!==void 0?u.spot.outerConeAngle:Math.PI/4,d.angle=u.spot.outerConeAngle,d.penumbra=1-u.spot.innerConeAngle/u.spot.outerConeAngle,d.target.position.set(0,0,-1),d.add(d.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+u.type)}return d.position.set(0,0,0),d.decay=2,un(d,u),u.intensity!==void 0&&(d.intensity=u.intensity),d.name=e.createUniqueName(u.name||"light_"+t),r=Promise.resolve(d),e.cache.add(n,r),r}getDependency(t,e){if(t==="light")return this._loadLight(e)}createNodeAttachment(t){const e=this,n=this.parser,s=n.json.nodes[t],c=(s.extensions&&s.extensions[this.name]||{}).light;return c===void 0?null:this._loadLight(c).then(function(u){return n._getNodeRef(e.cache,c,u)})}}class ld{constructor(){this.name=we.KHR_MATERIALS_UNLIT}getMaterialType(){return m.MeshBasicMaterial}extendParams(t,e,n){const r=[];t.color=new m.Color(1,1,1),t.opacity=1;const s=e.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){const l=s.baseColorFactor;t.color.setRGB(l[0],l[1],l[2],cn),t.opacity=l[3]}s.baseColorTexture!==void 0&&r.push(n.assignTexture(t,"map",s.baseColorTexture,On))}return Promise.all(r)}}class cd{constructor(t){this.parser=t,this.name=we.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(t,e){const r=this.parser.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name].emissiveStrength;return s!==void 0&&(e.emissiveIntensity=s),Promise.resolve()}}class ud{constructor(t){this.parser=t,this.name=we.KHR_MATERIALS_CLEARCOAT}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:m.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],l=r.extensions[this.name];if(l.clearcoatFactor!==void 0&&(e.clearcoat=l.clearcoatFactor),l.clearcoatTexture!==void 0&&s.push(n.assignTexture(e,"clearcoatMap",l.clearcoatTexture)),l.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=l.clearcoatRoughnessFactor),l.clearcoatRoughnessTexture!==void 0&&s.push(n.assignTexture(e,"clearcoatRoughnessMap",l.clearcoatRoughnessTexture)),l.clearcoatNormalTexture!==void 0&&(s.push(n.assignTexture(e,"clearcoatNormalMap",l.clearcoatNormalTexture)),l.clearcoatNormalTexture.scale!==void 0)){const c=l.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new m.Vector2(c,c)}return Promise.all(s)}}class hd{constructor(t){this.parser=t,this.name=we.KHR_MATERIALS_DISPERSION}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:m.MeshPhysicalMaterial}extendMaterialParams(t,e){const r=this.parser.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name];return e.dispersion=s.dispersion!==void 0?s.dispersion:0,Promise.resolve()}}class dd{constructor(t){this.parser=t,this.name=we.KHR_MATERIALS_IRIDESCENCE}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:m.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],l=r.extensions[this.name];return l.iridescenceFactor!==void 0&&(e.iridescence=l.iridescenceFactor),l.iridescenceTexture!==void 0&&s.push(n.assignTexture(e,"iridescenceMap",l.iridescenceTexture)),l.iridescenceIor!==void 0&&(e.iridescenceIOR=l.iridescenceIor),e.iridescenceThicknessRange===void 0&&(e.iridescenceThicknessRange=[100,400]),l.iridescenceThicknessMinimum!==void 0&&(e.iridescenceThicknessRange[0]=l.iridescenceThicknessMinimum),l.iridescenceThicknessMaximum!==void 0&&(e.iridescenceThicknessRange[1]=l.iridescenceThicknessMaximum),l.iridescenceThicknessTexture!==void 0&&s.push(n.assignTexture(e,"iridescenceThicknessMap",l.iridescenceThicknessTexture)),Promise.all(s)}}class fd{constructor(t){this.parser=t,this.name=we.KHR_MATERIALS_SHEEN}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:m.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[];e.sheenColor=new m.Color(0,0,0),e.sheenRoughness=0,e.sheen=1;const l=r.extensions[this.name];if(l.sheenColorFactor!==void 0){const c=l.sheenColorFactor;e.sheenColor.setRGB(c[0],c[1],c[2],cn)}return l.sheenRoughnessFactor!==void 0&&(e.sheenRoughness=l.sheenRoughnessFactor),l.sheenColorTexture!==void 0&&s.push(n.assignTexture(e,"sheenColorMap",l.sheenColorTexture,On)),l.sheenRoughnessTexture!==void 0&&s.push(n.assignTexture(e,"sheenRoughnessMap",l.sheenRoughnessTexture)),Promise.all(s)}}class pd{constructor(t){this.parser=t,this.name=we.KHR_MATERIALS_TRANSMISSION}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:m.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],l=r.extensions[this.name];return l.transmissionFactor!==void 0&&(e.transmission=l.transmissionFactor),l.transmissionTexture!==void 0&&s.push(n.assignTexture(e,"transmissionMap",l.transmissionTexture)),Promise.all(s)}}class md{constructor(t){this.parser=t,this.name=we.KHR_MATERIALS_VOLUME}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:m.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],l=r.extensions[this.name];e.thickness=l.thicknessFactor!==void 0?l.thicknessFactor:0,l.thicknessTexture!==void 0&&s.push(n.assignTexture(e,"thicknessMap",l.thicknessTexture)),e.attenuationDistance=l.attenuationDistance||1/0;const c=l.attenuationColor||[1,1,1];return e.attenuationColor=new m.Color().setRGB(c[0],c[1],c[2],cn),Promise.all(s)}}class gd{constructor(t){this.parser=t,this.name=we.KHR_MATERIALS_IOR}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:m.MeshPhysicalMaterial}extendMaterialParams(t,e){const r=this.parser.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name];return e.ior=s.ior!==void 0?s.ior:1.5,Promise.resolve()}}class yd{constructor(t){this.parser=t,this.name=we.KHR_MATERIALS_SPECULAR}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:m.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],l=r.extensions[this.name];e.specularIntensity=l.specularFactor!==void 0?l.specularFactor:1,l.specularTexture!==void 0&&s.push(n.assignTexture(e,"specularIntensityMap",l.specularTexture));const c=l.specularColorFactor||[1,1,1];return e.specularColor=new m.Color().setRGB(c[0],c[1],c[2],cn),l.specularColorTexture!==void 0&&s.push(n.assignTexture(e,"specularColorMap",l.specularColorTexture,On)),Promise.all(s)}}class vd{constructor(t){this.parser=t,this.name=we.EXT_MATERIALS_BUMP}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:m.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],l=r.extensions[this.name];return e.bumpScale=l.bumpFactor!==void 0?l.bumpFactor:1,l.bumpTexture!==void 0&&s.push(n.assignTexture(e,"bumpMap",l.bumpTexture)),Promise.all(s)}}class wd{constructor(t){this.parser=t,this.name=we.KHR_MATERIALS_ANISOTROPY}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:m.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],l=r.extensions[this.name];return l.anisotropyStrength!==void 0&&(e.anisotropy=l.anisotropyStrength),l.anisotropyRotation!==void 0&&(e.anisotropyRotation=l.anisotropyRotation),l.anisotropyTexture!==void 0&&s.push(n.assignTexture(e,"anisotropyMap",l.anisotropyTexture)),Promise.all(s)}}class bd{constructor(t){this.parser=t,this.name=we.KHR_TEXTURE_BASISU}loadTexture(t){const e=this.parser,n=e.json,r=n.textures[t];if(!r.extensions||!r.extensions[this.name])return null;const s=r.extensions[this.name],l=e.options.ktx2Loader;if(!l){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,s.source,l)}}class xd{constructor(t){this.parser=t,this.name=we.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(t){const e=this.name,n=this.parser,r=n.json,s=r.textures[t];if(!s.extensions||!s.extensions[e])return null;const l=s.extensions[e],c=r.images[l.source];let u=n.textureLoader;if(c.uri){const d=n.options.manager.getHandler(c.uri);d!==null&&(u=d)}return this.detectSupport().then(function(d){if(d)return n.loadTextureImage(t,l.source,u);if(r.extensionsRequired&&r.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(e.height===1)}})),this.isSupported}}class _d{constructor(t){this.parser=t,this.name=we.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(t){const e=this.name,n=this.parser,r=n.json,s=r.textures[t];if(!s.extensions||!s.extensions[e])return null;const l=s.extensions[e],c=r.images[l.source];let u=n.textureLoader;if(c.uri){const d=n.options.manager.getHandler(c.uri);d!==null&&(u=d)}return this.detectSupport().then(function(d){if(d)return n.loadTextureImage(t,l.source,u);if(r.extensionsRequired&&r.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const e=new Image;e.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",e.onload=e.onerror=function(){t(e.height===1)}})),this.isSupported}}class Md{constructor(t){this.name=we.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(t){const e=this.parser.json,n=e.bufferViews[t];if(n.extensions&&n.extensions[this.name]){const r=n.extensions[this.name],s=this.parser.getDependency("buffer",r.buffer),l=this.parser.options.meshoptDecoder;if(!l||!l.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(c){const u=r.byteOffset||0,d=r.byteLength||0,p=r.count,f=r.byteStride,y=new Uint8Array(c,u,d);return l.decodeGltfBufferAsync?l.decodeGltfBufferAsync(p,f,y,r.mode,r.filter).then(function(v){return v.buffer}):l.ready.then(function(){const v=new ArrayBuffer(p*f);return l.decodeGltfBuffer(new Uint8Array(v),p,f,y,r.mode,r.filter),v})})}else return null}}class Ld{constructor(t){this.name=we.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(t){const e=this.parser.json,n=e.nodes[t];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const r=e.meshes[n.mesh];for(const d of r.primitives)if(d.mode!==Zt.TRIANGLES&&d.mode!==Zt.TRIANGLE_STRIP&&d.mode!==Zt.TRIANGLE_FAN&&d.mode!==void 0)return null;const l=n.extensions[this.name].attributes,c=[],u={};for(const d in l)c.push(this.parser.getDependency("accessor",l[d]).then(p=>(u[d]=p,u[d])));return c.length<1?null:(c.push(this.parser.createNodeMesh(t)),Promise.all(c).then(d=>{const p=d.pop(),f=p.isGroup?p.children:[p],y=d[0].count,v=[];for(const b of f){const T=new m.Matrix4,_=new m.Vector3,S=new m.Quaternion,L=new m.Vector3(1,1,1),I=new m.InstancedMesh(b.geometry,b.material,y);for(let F=0;F<y;F++)u.TRANSLATION&&_.fromBufferAttribute(u.TRANSLATION,F),u.ROTATION&&S.fromBufferAttribute(u.ROTATION,F),u.SCALE&&L.fromBufferAttribute(u.SCALE,F),I.setMatrixAt(F,T.compose(_,S,L));for(const F in u)if(F==="_COLOR_0"){const K=u[F];I.instanceColor=new m.InstancedBufferAttribute(K.array,K.itemSize,K.normalized)}else F!=="TRANSLATION"&&F!=="ROTATION"&&F!=="SCALE"&&b.geometry.setAttribute(F,u[F]);m.Object3D.prototype.copy.call(I,b),this.parser.assignFinalMaterial(I),v.push(I)}return p.isGroup?(p.clear(),p.add(...v),p):v[0]}))}}const Oa="glTF",Fr=12,Ka={JSON:1313821514,BIN:5130562};class Sd{constructor(t){this.name=we.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(t,0,Fr);if(this.header={magic:lr(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==Oa)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-Fr,r=new DataView(t,Fr);let s=0;for(;s<n;){const l=r.getUint32(s,!0);s+=4;const c=r.getUint32(s,!0);if(s+=4,c===Ka.JSON){const u=new Uint8Array(t,Fr+s,l);this.content=lr(u)}else if(c===Ka.BIN){const u=Fr+s;this.body=t.slice(u,u+l)}s+=l}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Td{constructor(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=we.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(t,e){const n=this.json,r=this.dracoLoader,s=t.extensions[this.name].bufferView,l=t.extensions[this.name].attributes,c={},u={},d={};for(const p in l){const f=Ws[p]||p.toLowerCase();c[f]=l[p]}for(const p in t.attributes){const f=Ws[p]||p.toLowerCase();if(l[p]!==void 0){const y=n.accessors[t.attributes[p]],v=cr[y.componentType];d[f]=v.name,u[f]=y.normalized===!0}}return e.getDependency("bufferView",s).then(function(p){return new Promise(function(f,y){r.decodeDracoFile(p,function(v){for(const b in v.attributes){const T=v.attributes[b],_=u[b];_!==void 0&&(T.normalized=_)}f(v)},c,d,cn,y)})})}}class Gd{constructor(){this.name=we.KHR_TEXTURE_TRANSFORM}extendTexture(t,e){return(e.texCoord===void 0||e.texCoord===t.channel)&&e.offset===void 0&&e.rotation===void 0&&e.scale===void 0||(t=t.clone(),e.texCoord!==void 0&&(t.channel=e.texCoord),e.offset!==void 0&&t.offset.fromArray(e.offset),e.rotation!==void 0&&(t.rotation=e.rotation),e.scale!==void 0&&t.repeat.fromArray(e.scale),t.needsUpdate=!0),t}}class Zd{constructor(){this.name=we.KHR_MESH_QUANTIZATION}}class Ra extends m.Interpolant{constructor(t,e,n,r){super(t,e,n,r)}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,r=this.valueSize,s=t*r*3+r;for(let l=0;l!==r;l++)e[l]=n[s+l];return e}interpolate_(t,e,n,r){const s=this.resultBuffer,l=this.sampleValues,c=this.valueSize,u=c*2,d=c*3,p=r-e,f=(n-e)/p,y=f*f,v=y*f,b=t*d,T=b-d,_=-2*v+3*y,S=v-y,L=1-_,I=S-y+f;for(let F=0;F!==c;F++){const K=l[T+F+c],D=l[T+F+u]*p,O=l[b+F+c],V=l[b+F]*p;s[F]=L*K+I*D+_*O+S*V}return s}}const Id=new m.Quaternion;class Wd extends Ra{interpolate_(t,e,n,r){const s=super.interpolate_(t,e,n,r);return Id.fromArray(s).normalize().toArray(s),s}}const Zt={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},cr={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Ya={9728:m.NearestFilter,9729:m.LinearFilter,9984:m.NearestMipmapNearestFilter,9985:m.LinearMipmapNearestFilter,9986:m.NearestMipmapLinearFilter,9987:m.LinearMipmapLinearFilter},Ua={33071:m.ClampToEdgeWrapping,33648:m.MirroredRepeatWrapping,10497:m.RepeatWrapping},Is={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Ws={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",...fi>=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"},COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Mn={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Pd={CUBICSPLINE:void 0,LINEAR:m.InterpolateLinear,STEP:m.InterpolateDiscrete},Ps={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Cd(a){return a.DefaultMaterial===void 0&&(a.DefaultMaterial=new m.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:m.FrontSide})),a.DefaultMaterial}function Kn(a,t,e){for(const n in e.extensions)a[n]===void 0&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[n]=e.extensions[n])}function un(a,t){t.extras!==void 0&&(typeof t.extras=="object"?Object.assign(a.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Vd(a,t,e){let n=!1,r=!1,s=!1;for(let d=0,p=t.length;d<p;d++){const f=t[d];if(f.POSITION!==void 0&&(n=!0),f.NORMAL!==void 0&&(r=!0),f.COLOR_0!==void 0&&(s=!0),n&&r&&s)break}if(!n&&!r&&!s)return Promise.resolve(a);const l=[],c=[],u=[];for(let d=0,p=t.length;d<p;d++){const f=t[d];if(n){const y=f.POSITION!==void 0?e.getDependency("accessor",f.POSITION):a.attributes.position;l.push(y)}if(r){const y=f.NORMAL!==void 0?e.getDependency("accessor",f.NORMAL):a.attributes.normal;c.push(y)}if(s){const y=f.COLOR_0!==void 0?e.getDependency("accessor",f.COLOR_0):a.attributes.color;u.push(y)}}return Promise.all([Promise.all(l),Promise.all(c),Promise.all(u)]).then(function(d){const p=d[0],f=d[1],y=d[2];return n&&(a.morphAttributes.position=p),r&&(a.morphAttributes.normal=f),s&&(a.morphAttributes.color=y),a.morphTargetsRelative=!0,a})}function Ad(a,t){if(a.updateMorphTargets(),t.weights!==void 0)for(let e=0,n=t.weights.length;e<n;e++)a.morphTargetInfluences[e]=t.weights[e];if(t.extras&&Array.isArray(t.extras.targetNames)){const e=t.extras.targetNames;if(a.morphTargetInfluences.length===e.length){a.morphTargetDictionary={};for(let n=0,r=e.length;n<r;n++)a.morphTargetDictionary[e[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Fd(a){let t;const e=a.extensions&&a.extensions[we.KHR_DRACO_MESH_COMPRESSION];if(e?t="draco:"+e.bufferView+":"+e.indices+":"+Cs(e.attributes):t=a.indices+":"+Cs(a.attributes)+":"+a.mode,a.targets!==void 0)for(let n=0,r=a.targets.length;n<r;n++)t+=":"+Cs(a.targets[n]);return t}function Cs(a){let t="";const e=Object.keys(a).sort();for(let n=0,r=e.length;n<r;n++)t+=e[n]+":"+a[e[n]]+";";return t}function Vs(a){switch(a){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Xd(a){return a.search(/\.jpe?g($|\?)/i)>0||a.search(/^data\:image\/jpeg/)===0?"image/jpeg":a.search(/\.webp($|\?)/i)>0||a.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const kd=new m.Matrix4;class Dd{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new od,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,r=!1,s=-1;typeof navigator<"u"&&typeof navigator.userAgent<"u"&&(n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,r=navigator.userAgent.indexOf("Firefox")>-1,s=r?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||n||r&&s<98?this.textureLoader=new m.TextureLoader(this.options.manager):this.textureLoader=new m.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new m.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const n=this,r=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(l){return l._markDefs&&l._markDefs()}),Promise.all(this._invokeAll(function(l){return l.beforeRoot&&l.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(l){const c={scene:l[0][r.scene||0],scenes:l[0],animations:l[1],cameras:l[2],asset:r.asset,parser:n,userData:{}};return Kn(s,c,r),un(c,r),Promise.all(n._invokeAll(function(u){return u.afterRoot&&u.afterRoot(c)})).then(function(){for(const u of c.scenes)u.updateMatrixWorld();t(c)})}).catch(e)}_markDefs(){const t=this.json.nodes||[],e=this.json.skins||[],n=this.json.meshes||[];for(let r=0,s=e.length;r<s;r++){const l=e[r].joints;for(let c=0,u=l.length;c<u;c++)t[l[c]].isBone=!0}for(let r=0,s=t.length;r<s;r++){const l=t[r];l.mesh!==void 0&&(this._addNodeRef(this.meshCache,l.mesh),l.skin!==void 0&&(n[l.mesh].isSkinnedMesh=!0)),l.camera!==void 0&&this._addNodeRef(this.cameraCache,l.camera)}}_addNodeRef(t,e){e!==void 0&&(t.refs[e]===void 0&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}_getNodeRef(t,e,n){if(t.refs[e]<=1)return n;const r=n.clone(),s=(l,c)=>{const u=this.associations.get(l);u!=null&&this.associations.set(c,u);for(const[d,p]of l.children.entries())s(p,c.children[d])};return s(n,r),r.name+="_instance_"+t.uses[e]++,r}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let n=0;n<e.length;n++){const r=t(e[n]);if(r)return r}return null}_invokeAll(t){const e=Object.values(this.plugins);e.unshift(this);const n=[];for(let r=0;r<e.length;r++){const s=t(e[r]);s&&n.push(s)}return n}getDependency(t,e){const n=t+":"+e;let r=this.cache.get(n);if(!r){switch(t){case"scene":r=this.loadScene(e);break;case"node":r=this._invokeOne(function(s){return s.loadNode&&s.loadNode(e)});break;case"mesh":r=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(e)});break;case"accessor":r=this.loadAccessor(e);break;case"bufferView":r=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(e)});break;case"buffer":r=this.loadBuffer(e);break;case"material":r=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(e)});break;case"texture":r=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(e)});break;case"skin":r=this.loadSkin(e);break;case"animation":r=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(e)});break;case"camera":r=this.loadCamera(e);break;default:if(r=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(t,e)}),!r)throw new Error("Unknown type: "+t);break}this.cache.add(n,r)}return r}getDependencies(t){let e=this.cache.get(t);if(!e){const n=this,r=this.json[t+(t==="mesh"?"es":"s")]||[];e=Promise.all(r.map(function(s,l){return n.getDependency(t,l)})),this.cache.add(t,e)}return e}loadBuffer(t){const e=this.json.buffers[t],n=this.fileLoader;if(e.type&&e.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(e.uri===void 0&&t===0)return Promise.resolve(this.extensions[we.KHR_BINARY_GLTF].body);const r=this.options;return new Promise(function(s,l){n.load(m.LoaderUtils.resolveURL(e.uri,r.path),s,void 0,function(){l(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))})})}loadBufferView(t){const e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then(function(n){const r=e.byteLength||0,s=e.byteOffset||0;return n.slice(s,s+r)})}loadAccessor(t){const e=this,n=this.json,r=this.json.accessors[t];if(r.bufferView===void 0&&r.sparse===void 0){const l=Is[r.type],c=cr[r.componentType],u=r.normalized===!0,d=new c(r.count*l);return Promise.resolve(new m.BufferAttribute(d,l,u))}const s=[];return r.bufferView!==void 0?s.push(this.getDependency("bufferView",r.bufferView)):s.push(null),r.sparse!==void 0&&(s.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(s).then(function(l){const c=l[0],u=Is[r.type],d=cr[r.componentType],p=d.BYTES_PER_ELEMENT,f=p*u,y=r.byteOffset||0,v=r.bufferView!==void 0?n.bufferViews[r.bufferView].byteStride:void 0,b=r.normalized===!0;let T,_;if(v&&v!==f){const S=Math.floor(y/v),L="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+S+":"+r.count;let I=e.cache.get(L);I||(T=new d(c,S*v,r.count*v/p),I=new m.InterleavedBuffer(T,v/p),e.cache.add(L,I)),_=new m.InterleavedBufferAttribute(I,u,y%v/p,b)}else c===null?T=new d(r.count*u):T=new d(c,y,r.count*u),_=new m.BufferAttribute(T,u,b);if(r.sparse!==void 0){const S=Is.SCALAR,L=cr[r.sparse.indices.componentType],I=r.sparse.indices.byteOffset||0,F=r.sparse.values.byteOffset||0,K=new L(l[1],I,r.sparse.count*S),D=new d(l[2],F,r.sparse.count*u);c!==null&&(_=new m.BufferAttribute(_.array.slice(),_.itemSize,_.normalized));for(let O=0,V=K.length;O<V;O++){const R=K[O];if(_.setX(R,D[O*u]),u>=2&&_.setY(R,D[O*u+1]),u>=3&&_.setZ(R,D[O*u+2]),u>=4&&_.setW(R,D[O*u+3]),u>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return _})}loadTexture(t){const e=this.json,n=this.options,s=e.textures[t].source,l=e.images[s];let c=this.textureLoader;if(l.uri){const u=n.manager.getHandler(l.uri);u!==null&&(c=u)}return this.loadTextureImage(t,s,c)}loadTextureImage(t,e,n){const r=this,s=this.json,l=s.textures[t],c=s.images[e],u=(c.uri||c.bufferView)+":"+l.sampler;if(this.textureCache[u])return this.textureCache[u];const d=this.loadImageSource(e,n).then(function(p){p.flipY=!1,p.name=l.name||c.name||"",p.name===""&&typeof c.uri=="string"&&c.uri.startsWith("data:image/")===!1&&(p.name=c.uri);const y=(s.samplers||{})[l.sampler]||{};return p.magFilter=Ya[y.magFilter]||m.LinearFilter,p.minFilter=Ya[y.minFilter]||m.LinearMipmapLinearFilter,p.wrapS=Ua[y.wrapS]||m.RepeatWrapping,p.wrapT=Ua[y.wrapT]||m.RepeatWrapping,r.associations.set(p,{textures:t}),p}).catch(function(){return null});return this.textureCache[u]=d,d}loadImageSource(t,e){const n=this,r=this.json,s=this.options;if(this.sourceCache[t]!==void 0)return this.sourceCache[t].then(f=>f.clone());const l=r.images[t],c=self.URL||self.webkitURL;let u=l.uri||"",d=!1;if(l.bufferView!==void 0)u=n.getDependency("bufferView",l.bufferView).then(function(f){d=!0;const y=new Blob([f],{type:l.mimeType});return u=c.createObjectURL(y),u});else if(l.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const p=Promise.resolve(u).then(function(f){return new Promise(function(y,v){let b=y;e.isImageBitmapLoader===!0&&(b=function(T){const _=new m.Texture(T);_.needsUpdate=!0,y(_)}),e.load(m.LoaderUtils.resolveURL(f,s.path),b,void 0,v)})}).then(function(f){return d===!0&&c.revokeObjectURL(u),un(f,l),f.userData.mimeType=l.mimeType||Xd(l.uri),f}).catch(function(f){throw console.error("THREE.GLTFLoader: Couldn't load texture",u),f});return this.sourceCache[t]=p,p}assignTexture(t,e,n,r){const s=this;return this.getDependency("texture",n.index).then(function(l){if(!l)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(l=l.clone(),l.channel=n.texCoord),s.extensions[we.KHR_TEXTURE_TRANSFORM]){const c=n.extensions!==void 0?n.extensions[we.KHR_TEXTURE_TRANSFORM]:void 0;if(c){const u=s.associations.get(l);l=s.extensions[we.KHR_TEXTURE_TRANSFORM].extendTexture(l,c),s.associations.set(l,u)}}return r!==void 0&&(typeof r=="number"&&(r=r===za?On:cn),"colorSpace"in l?l.colorSpace=r:l.encoding=r===On?za:id),t[e]=l,l})}assignFinalMaterial(t){const e=t.geometry;let n=t.material;const r=e.attributes.tangent===void 0,s=e.attributes.color!==void 0,l=e.attributes.normal===void 0;if(t.isPoints){const c="PointsMaterial:"+n.uuid;let u=this.cache.get(c);u||(u=new m.PointsMaterial,m.Material.prototype.copy.call(u,n),u.color.copy(n.color),u.map=n.map,u.sizeAttenuation=!1,this.cache.add(c,u)),n=u}else if(t.isLine){const c="LineBasicMaterial:"+n.uuid;let u=this.cache.get(c);u||(u=new m.LineBasicMaterial,m.Material.prototype.copy.call(u,n),u.color.copy(n.color),u.map=n.map,this.cache.add(c,u)),n=u}if(r||s||l){let c="ClonedMaterial:"+n.uuid+":";r&&(c+="derivative-tangents:"),s&&(c+="vertex-colors:"),l&&(c+="flat-shading:");let u=this.cache.get(c);u||(u=n.clone(),s&&(u.vertexColors=!0),l&&(u.flatShading=!0),r&&(u.normalScale&&(u.normalScale.y*=-1),u.clearcoatNormalScale&&(u.clearcoatNormalScale.y*=-1)),this.cache.add(c,u),this.associations.set(u,this.associations.get(n))),n=u}t.material=n}getMaterialType(){return m.MeshStandardMaterial}loadMaterial(t){const e=this,n=this.json,r=this.extensions,s=n.materials[t];let l;const c={},u=s.extensions||{},d=[];if(u[we.KHR_MATERIALS_UNLIT]){const f=r[we.KHR_MATERIALS_UNLIT];l=f.getMaterialType(),d.push(f.extendParams(c,s,e))}else{const f=s.pbrMetallicRoughness||{};if(c.color=new m.Color(1,1,1),c.opacity=1,Array.isArray(f.baseColorFactor)){const y=f.baseColorFactor;c.color.setRGB(y[0],y[1],y[2],cn),c.opacity=y[3]}f.baseColorTexture!==void 0&&d.push(e.assignTexture(c,"map",f.baseColorTexture,On)),c.metalness=f.metallicFactor!==void 0?f.metallicFactor:1,c.roughness=f.roughnessFactor!==void 0?f.roughnessFactor:1,f.metallicRoughnessTexture!==void 0&&(d.push(e.assignTexture(c,"metalnessMap",f.metallicRoughnessTexture)),d.push(e.assignTexture(c,"roughnessMap",f.metallicRoughnessTexture))),l=this._invokeOne(function(y){return y.getMaterialType&&y.getMaterialType(t)}),d.push(Promise.all(this._invokeAll(function(y){return y.extendMaterialParams&&y.extendMaterialParams(t,c)})))}s.doubleSided===!0&&(c.side=m.DoubleSide);const p=s.alphaMode||Ps.OPAQUE;if(p===Ps.BLEND?(c.transparent=!0,c.depthWrite=!1):(c.transparent=!1,p===Ps.MASK&&(c.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&l!==m.MeshBasicMaterial&&(d.push(e.assignTexture(c,"normalMap",s.normalTexture)),c.normalScale=new m.Vector2(1,1),s.normalTexture.scale!==void 0)){const f=s.normalTexture.scale;c.normalScale.set(f,f)}if(s.occlusionTexture!==void 0&&l!==m.MeshBasicMaterial&&(d.push(e.assignTexture(c,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(c.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&l!==m.MeshBasicMaterial){const f=s.emissiveFactor;c.emissive=new m.Color().setRGB(f[0],f[1],f[2],cn)}return s.emissiveTexture!==void 0&&l!==m.MeshBasicMaterial&&d.push(e.assignTexture(c,"emissiveMap",s.emissiveTexture,On)),Promise.all(d).then(function(){const f=new l(c);return s.name&&(f.name=s.name),un(f,s),e.associations.set(f,{materials:t}),s.extensions&&Kn(r,f,s),f})}createUniqueName(t){const e=m.PropertyBinding.sanitizeNodeName(t||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(t){const e=this,n=this.extensions,r=this.primitiveCache;function s(c){return n[we.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(c,e).then(function(u){return Ba(u,c,e)})}const l=[];for(let c=0,u=t.length;c<u;c++){const d=t[c],p=Fd(d),f=r[p];if(f)l.push(f.promise);else{let y;d.extensions&&d.extensions[we.KHR_DRACO_MESH_COMPRESSION]?y=s(d):y=Ba(new m.BufferGeometry,d,e),r[p]={primitive:d,promise:y},l.push(y)}}return Promise.all(l)}loadMesh(t){const e=this,n=this.json,r=this.extensions,s=n.meshes[t],l=s.primitives,c=[];for(let u=0,d=l.length;u<d;u++){const p=l[u].material===void 0?Cd(this.cache):this.getDependency("material",l[u].material);c.push(p)}return c.push(e.loadGeometries(l)),Promise.all(c).then(function(u){const d=u.slice(0,u.length-1),p=u[u.length-1],f=[];for(let v=0,b=p.length;v<b;v++){const T=p[v],_=l[v];let S;const L=d[v];if(_.mode===Zt.TRIANGLES||_.mode===Zt.TRIANGLE_STRIP||_.mode===Zt.TRIANGLE_FAN||_.mode===void 0)S=s.isSkinnedMesh===!0?new m.SkinnedMesh(T,L):new m.Mesh(T,L),S.isSkinnedMesh===!0&&S.normalizeSkinWeights(),_.mode===Zt.TRIANGLE_STRIP?S.geometry=Wa(S.geometry,m.TriangleStripDrawMode):_.mode===Zt.TRIANGLE_FAN&&(S.geometry=Wa(S.geometry,m.TriangleFanDrawMode));else if(_.mode===Zt.LINES)S=new m.LineSegments(T,L);else if(_.mode===Zt.LINE_STRIP)S=new m.Line(T,L);else if(_.mode===Zt.LINE_LOOP)S=new m.LineLoop(T,L);else if(_.mode===Zt.POINTS)S=new m.Points(T,L);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+_.mode);Object.keys(S.geometry.morphAttributes).length>0&&Ad(S,s),S.name=e.createUniqueName(s.name||"mesh_"+t),un(S,s),_.extensions&&Kn(r,S,_),e.assignFinalMaterial(S),f.push(S)}for(let v=0,b=f.length;v<b;v++)e.associations.set(f[v],{meshes:t,primitives:v});if(f.length===1)return s.extensions&&Kn(r,f[0],s),f[0];const y=new m.Group;s.extensions&&Kn(r,y,s),e.associations.set(y,{meshes:t});for(let v=0,b=f.length;v<b;v++)y.add(f[v]);return y})}loadCamera(t){let e;const n=this.json.cameras[t],r=n[n.type];if(!r){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?e=new m.PerspectiveCamera(m.MathUtils.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):n.type==="orthographic"&&(e=new m.OrthographicCamera(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),n.name&&(e.name=this.createUniqueName(n.name)),un(e,n),Promise.resolve(e)}loadSkin(t){const e=this.json.skins[t],n=[];for(let r=0,s=e.joints.length;r<s;r++)n.push(this._loadNodeShallow(e.joints[r]));return e.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",e.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(r){const s=r.pop(),l=r,c=[],u=[];for(let d=0,p=l.length;d<p;d++){const f=l[d];if(f){c.push(f);const y=new m.Matrix4;s!==null&&y.fromArray(s.array,d*16),u.push(y)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[d])}return new m.Skeleton(c,u)})}loadAnimation(t){const e=this.json,n=this,r=e.animations[t],s=r.name?r.name:"animation_"+t,l=[],c=[],u=[],d=[],p=[];for(let f=0,y=r.channels.length;f<y;f++){const v=r.channels[f],b=r.samplers[v.sampler],T=v.target,_=T.node,S=r.parameters!==void 0?r.parameters[b.input]:b.input,L=r.parameters!==void 0?r.parameters[b.output]:b.output;T.node!==void 0&&(l.push(this.getDependency("node",_)),c.push(this.getDependency("accessor",S)),u.push(this.getDependency("accessor",L)),d.push(b),p.push(T))}return Promise.all([Promise.all(l),Promise.all(c),Promise.all(u),Promise.all(d),Promise.all(p)]).then(function(f){const y=f[0],v=f[1],b=f[2],T=f[3],_=f[4],S=[];for(let L=0,I=y.length;L<I;L++){const F=y[L],K=v[L],D=b[L],O=T[L],V=_[L];if(F===void 0)continue;F.updateMatrix&&F.updateMatrix();const R=n._createAnimationTracks(F,K,D,O,V);if(R)for(let P=0;P<R.length;P++)S.push(R[P])}return new m.AnimationClip(s,void 0,S)})}createNodeMesh(t){const e=this.json,n=this,r=e.nodes[t];return r.mesh===void 0?null:n.getDependency("mesh",r.mesh).then(function(s){const l=n._getNodeRef(n.meshCache,r.mesh,s);return r.weights!==void 0&&l.traverse(function(c){if(c.isMesh)for(let u=0,d=r.weights.length;u<d;u++)c.morphTargetInfluences[u]=r.weights[u]}),l})}loadNode(t){const e=this.json,n=this,r=e.nodes[t],s=n._loadNodeShallow(t),l=[],c=r.children||[];for(let d=0,p=c.length;d<p;d++)l.push(n.getDependency("node",c[d]));const u=r.skin===void 0?Promise.resolve(null):n.getDependency("skin",r.skin);return Promise.all([s,Promise.all(l),u]).then(function(d){const p=d[0],f=d[1],y=d[2];y!==null&&p.traverse(function(v){v.isSkinnedMesh&&v.bind(y,kd)});for(let v=0,b=f.length;v<b;v++)p.add(f[v]);return p})}_loadNodeShallow(t){const e=this.json,n=this.extensions,r=this;if(this.nodeCache[t]!==void 0)return this.nodeCache[t];const s=e.nodes[t],l=s.name?r.createUniqueName(s.name):"",c=[],u=r._invokeOne(function(d){return d.createNodeMesh&&d.createNodeMesh(t)});return u&&c.push(u),s.camera!==void 0&&c.push(r.getDependency("camera",s.camera).then(function(d){return r._getNodeRef(r.cameraCache,s.camera,d)})),r._invokeAll(function(d){return d.createNodeAttachment&&d.createNodeAttachment(t)}).forEach(function(d){c.push(d)}),this.nodeCache[t]=Promise.all(c).then(function(d){let p;if(s.isBone===!0?p=new m.Bone:d.length>1?p=new m.Group:d.length===1?p=d[0]:p=new m.Object3D,p!==d[0])for(let f=0,y=d.length;f<y;f++)p.add(d[f]);if(s.name&&(p.userData.name=s.name,p.name=l),un(p,s),s.extensions&&Kn(n,p,s),s.matrix!==void 0){const f=new m.Matrix4;f.fromArray(s.matrix),p.applyMatrix4(f)}else s.translation!==void 0&&p.position.fromArray(s.translation),s.rotation!==void 0&&p.quaternion.fromArray(s.rotation),s.scale!==void 0&&p.scale.fromArray(s.scale);return r.associations.has(p)||r.associations.set(p,{}),r.associations.get(p).nodes=t,p}),this.nodeCache[t]}loadScene(t){const e=this.extensions,n=this.json.scenes[t],r=this,s=new m.Group;n.name&&(s.name=r.createUniqueName(n.name)),un(s,n),n.extensions&&Kn(e,s,n);const l=n.nodes||[],c=[];for(let u=0,d=l.length;u<d;u++)c.push(r.getDependency("node",l[u]));return Promise.all(c).then(function(u){for(let p=0,f=u.length;p<f;p++)s.add(u[p]);const d=p=>{const f=new Map;for(const[y,v]of r.associations)(y instanceof m.Material||y instanceof m.Texture)&&f.set(y,v);return p.traverse(y=>{const v=r.associations.get(y);v!=null&&f.set(y,v)}),f};return r.associations=d(s),s})}_createAnimationTracks(t,e,n,r,s){const l=[],c=t.name?t.name:t.uuid,u=[];Mn[s.path]===Mn.weights?t.traverse(function(y){y.morphTargetInfluences&&u.push(y.name?y.name:y.uuid)}):u.push(c);let d;switch(Mn[s.path]){case Mn.weights:d=m.NumberKeyframeTrack;break;case Mn.rotation:d=m.QuaternionKeyframeTrack;break;case Mn.position:case Mn.scale:d=m.VectorKeyframeTrack;break;default:switch(n.itemSize){case 1:d=m.NumberKeyframeTrack;break;case 2:case 3:default:d=m.VectorKeyframeTrack;break}break}const p=r.interpolation!==void 0?Pd[r.interpolation]:m.InterpolateLinear,f=this._getArrayFromAccessor(n);for(let y=0,v=u.length;y<v;y++){const b=new d(u[y]+"."+Mn[s.path],e.array,f,p);r.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(b),l.push(b)}return l}_getArrayFromAccessor(t){let e=t.array;if(t.normalized){const n=Vs(e.constructor),r=new Float32Array(e.length);for(let s=0,l=e.length;s<l;s++)r[s]=e[s]*n;e=r}return e}_createCubicSplineTrackInterpolant(t){t.createInterpolant=function(n){const r=this instanceof m.QuaternionKeyframeTrack?Wd:Ra;return new r(this.times,this.values,this.getValueSize()/3,n)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function zd(a,t,e){const n=t.attributes,r=new m.Box3;if(n.POSITION!==void 0){const c=e.json.accessors[n.POSITION],u=c.min,d=c.max;if(u!==void 0&&d!==void 0){if(r.set(new m.Vector3(u[0],u[1],u[2]),new m.Vector3(d[0],d[1],d[2])),c.normalized){const p=Vs(cr[c.componentType]);r.min.multiplyScalar(p),r.max.multiplyScalar(p)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=t.targets;if(s!==void 0){const c=new m.Vector3,u=new m.Vector3;for(let d=0,p=s.length;d<p;d++){const f=s[d];if(f.POSITION!==void 0){const y=e.json.accessors[f.POSITION],v=y.min,b=y.max;if(v!==void 0&&b!==void 0){if(u.setX(Math.max(Math.abs(v[0]),Math.abs(b[0]))),u.setY(Math.max(Math.abs(v[1]),Math.abs(b[1]))),u.setZ(Math.max(Math.abs(v[2]),Math.abs(b[2]))),y.normalized){const T=Vs(cr[y.componentType]);u.multiplyScalar(T)}c.max(u)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(c)}a.boundingBox=r;const l=new m.Sphere;r.getCenter(l.center),l.radius=r.min.distanceTo(r.max)/2,a.boundingSphere=l}function Ba(a,t,e){const n=t.attributes,r=[];function s(l,c){return e.getDependency("accessor",l).then(function(u){a.setAttribute(c,u)})}for(const l in n){const c=Ws[l]||l.toLowerCase();c in a.attributes||r.push(s(n[l],c))}if(t.indices!==void 0&&!a.index){const l=e.getDependency("accessor",t.indices).then(function(c){a.setIndex(c)});r.push(l)}return un(a,t),zd(a,t,e),Promise.all(r).then(function(){return t.targets!==void 0?Vd(a,t.targets,e):a})}function Na(a,t,e){const n=e.length-a-1;if(t>=e[n])return n-1;if(t<=e[a])return a;let r=a,s=n,l=Math.floor((r+s)/2);for(;t<e[l]||t>=e[l+1];)t<e[l]?s=l:r=l,l=Math.floor((r+s)/2);return l}function Od(a,t,e,n){const r=[],s=[],l=[];r[0]=1;for(let c=1;c<=e;++c){s[c]=t-n[a+1-c],l[c]=n[a+c]-t;let u=0;for(let d=0;d<c;++d){const p=l[d+1],f=s[c-d],y=r[d]/(p+f);r[d]=u+p*y,u=f*y}r[c]=u}return r}function Kd(a,t,e,n){const r=Na(a,n,t),s=Od(r,n,a,t),l=new m.Vector4(0,0,0,0);for(let c=0;c<=a;++c){const u=e[r-a+c],d=s[c],p=u.w*d;l.x+=u.x*p,l.y+=u.y*p,l.z+=u.z*p,l.w+=u.w*d}return l}function Rd(a,t,e,n,r){const s=[];for(let f=0;f<=e;++f)s[f]=0;const l=[];for(let f=0;f<=n;++f)l[f]=s.slice(0);const c=[];for(let f=0;f<=e;++f)c[f]=s.slice(0);c[0][0]=1;const u=s.slice(0),d=s.slice(0);for(let f=1;f<=e;++f){u[f]=t-r[a+1-f],d[f]=r[a+f]-t;let y=0;for(let v=0;v<f;++v){const b=d[v+1],T=u[f-v];c[f][v]=b+T;const _=c[v][f-1]/c[f][v];c[v][f]=y+b*_,y=T*_}c[f][f]=y}for(let f=0;f<=e;++f)l[0][f]=c[f][e];for(let f=0;f<=e;++f){let y=0,v=1;const b=[];for(let T=0;T<=e;++T)b[T]=s.slice(0);b[0][0]=1;for(let T=1;T<=n;++T){let _=0;const S=f-T,L=e-T;f>=T&&(b[v][0]=b[y][0]/c[L+1][S],_=b[v][0]*c[S][L]);const I=S>=-1?1:-S,F=f-1<=L?T-1:e-f;for(let D=I;D<=F;++D)b[v][D]=(b[y][D]-b[y][D-1])/c[L+1][S+D],_+=b[v][D]*c[S+D][L];f<=L&&(b[v][T]=-b[y][T-1]/c[L+1][f],_+=b[v][T]*c[f][L]),l[T][f]=_;const K=y;y=v,v=K}}let p=e;for(let f=1;f<=n;++f){for(let y=0;y<=e;++y)l[f][y]*=p;p*=e-f}return l}function Yd(a,t,e,n,r){const s=r<a?r:a,l=[],c=Na(a,n,t),u=Rd(c,n,a,s,t),d=[];for(let p=0;p<e.length;++p){const f=e[p].clone(),y=f.w;f.x*=y,f.y*=y,f.z*=y,d[p]=f}for(let p=0;p<=s;++p){const f=d[c-a].clone().multiplyScalar(u[p][0]);for(let y=1;y<=a;++y)f.add(d[c-a+y].clone().multiplyScalar(u[p][y]));l[p]=f}for(let p=s+1;p<=r+1;++p)l[p]=new m.Vector4(0,0,0);return l}function Ud(a,t){let e=1;for(let r=2;r<=a;++r)e*=r;let n=1;for(let r=2;r<=t;++r)n*=r;for(let r=2;r<=a-t;++r)n*=r;return e/n}function Bd(a){const t=a.length,e=[],n=[];for(let s=0;s<t;++s){const l=a[s];e[s]=new m.Vector3(l.x,l.y,l.z),n[s]=l.w}const r=[];for(let s=0;s<t;++s){const l=e[s].clone();for(let c=1;c<=s;++c)l.sub(r[s-c].clone().multiplyScalar(Ud(s,c)*n[c]));r[s]=l.divideScalar(n[0])}return r}function Nd(a,t,e,n,r){const s=Yd(a,t,e,n,r);return Bd(s)}class ja extends m.Curve{constructor(t,e,n,r,s){super(),this.degree=t,this.knots=e,this.controlPoints=[],this.startKnot=r||0,this.endKnot=s||this.knots.length-1;for(let l=0;l<n.length;++l){const c=n[l];this.controlPoints[l]=new m.Vector4(c.x,c.y,c.z,c.w)}}getPoint(t,e){const n=e||new m.Vector3,r=this.knots[this.startKnot]+t*(this.knots[this.endKnot]-this.knots[this.startKnot]),s=Kd(this.degree,this.knots,this.controlPoints,r);return s.w!=1&&s.divideScalar(s.w),n.set(s.x,s.y,s.z)}getTangent(t,e){const n=e||new m.Vector3,r=this.knots[0]+t*(this.knots[this.knots.length-1]-this.knots[0]),s=Nd(this.degree,this.knots,this.controlPoints,r,1);return n.copy(s[1]).normalize(),n}}let be,ze,ft;class jd extends m.Loader{constructor(t){super(t)}load(t,e,n,r){const s=this,l=s.path===""?m.LoaderUtils.extractUrlBase(t):s.path,c=new m.FileLoader(this.manager);c.setPath(s.path),c.setResponseType("arraybuffer"),c.setRequestHeader(s.requestHeader),c.setWithCredentials(s.withCredentials),c.load(t,function(u){try{e(s.parse(u,l))}catch(d){r?r(d):console.error(d),s.manager.itemError(t)}},n,r)}parse(t,e){if($d(t))be=new qd().parse(t);else{const r=$a(t);if(!ef(r))throw new Error("THREE.FBXLoader: Unknown format.");if(Ha(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Ha(r));be=new Ed().parse(r)}const n=new m.TextureLoader(this.manager).setPath(this.resourcePath||e).setCrossOrigin(this.crossOrigin);return new Jd(n,this.manager).parse(be)}}class Jd{constructor(t,e){this.textureLoader=t,this.manager=e}parse(){ze=this.parseConnections();const t=this.parseImages(),e=this.parseTextures(t),n=this.parseMaterials(e),r=this.parseDeformers(),s=new Qd().parse(r);return this.parseScene(r,s,n),ft}parseConnections(){const t=new Map;return"Connections"in be&&be.Connections.connections.forEach(function(n){const r=n[0],s=n[1],l=n[2];t.has(r)||t.set(r,{parents:[],children:[]});const c={ID:s,relationship:l};t.get(r).parents.push(c),t.has(s)||t.set(s,{parents:[],children:[]});const u={ID:r,relationship:l};t.get(s).children.push(u)}),t}parseImages(){const t={},e={};if("Video"in be.Objects){const n=be.Objects.Video;for(const r in n){const s=n[r],l=parseInt(r);if(t[l]=s.RelativeFilename||s.Filename,"Content"in s){const c=s.Content instanceof ArrayBuffer&&s.Content.byteLength>0,u=typeof s.Content=="string"&&s.Content!=="";if(c||u){const d=this.parseImage(n[r]);e[s.RelativeFilename||s.Filename]=d}}}}for(const n in t){const r=t[n];e[r]!==void 0?t[n]=e[r]:t[n]=t[n].split("\\").pop()}return t}parseImage(t){const e=t.Content,n=t.RelativeFilename||t.Filename,r=n.slice(n.lastIndexOf(".")+1).toLowerCase();let s;switch(r){case"bmp":s="image/bmp";break;case"jpg":case"jpeg":s="image/jpeg";break;case"png":s="image/png";break;case"tif":s="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",n),s="image/tga";break;default:console.warn('FBXLoader: Image type "'+r+'" is not supported.');return}if(typeof e=="string")return"data:"+s+";base64,"+e;{const l=new Uint8Array(e);return window.URL.createObjectURL(new Blob([l],{type:s}))}}parseTextures(t){const e=new Map;if("Texture"in be.Objects){const n=be.Objects.Texture;for(const r in n){const s=this.parseTexture(n[r],t);e.set(parseInt(r),s)}}return e}parseTexture(t,e){const n=this.loadTexture(t,e);n.ID=t.id,n.name=t.attrName;const r=t.WrapModeU,s=t.WrapModeV,l=r!==void 0?r.value:0,c=s!==void 0?s.value:0;if(n.wrapS=l===0?m.RepeatWrapping:m.ClampToEdgeWrapping,n.wrapT=c===0?m.RepeatWrapping:m.ClampToEdgeWrapping,"Scaling"in t){const u=t.Scaling.value;n.repeat.x=u[0],n.repeat.y=u[1]}return n}loadTexture(t,e){let n;const r=this.textureLoader.path,s=ze.get(t.id).children;s!==void 0&&s.length>0&&e[s[0].ID]!==void 0&&(n=e[s[0].ID],(n.indexOf("blob:")===0||n.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let l;const c=t.FileName.slice(-3).toLowerCase();if(c==="tga"){const u=this.manager.getHandler(".tga");u===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",t.RelativeFilename),l=new m.Texture):(u.setPath(this.textureLoader.path),l=u.load(n))}else c==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",t.RelativeFilename),l=new m.Texture):l=this.textureLoader.load(n);return this.textureLoader.setPath(r),l}parseMaterials(t){const e=new Map;if("Material"in be.Objects){const n=be.Objects.Material;for(const r in n){const s=this.parseMaterial(n[r],t);s!==null&&e.set(parseInt(r),s)}}return e}parseMaterial(t,e){const n=t.id,r=t.attrName;let s=t.ShadingModel;if(typeof s=="object"&&(s=s.value),!ze.has(n))return null;const l=this.parseParameters(t,e,n);let c;switch(s.toLowerCase()){case"phong":c=new m.MeshPhongMaterial;break;case"lambert":c=new m.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',s),c=new m.MeshPhongMaterial;break}return c.setValues(l),c.name=r,c}parseParameters(t,e,n){const r={};t.BumpFactor&&(r.bumpScale=t.BumpFactor.value),t.Diffuse?r.color=new m.Color().fromArray(t.Diffuse.value):t.DiffuseColor&&(t.DiffuseColor.type==="Color"||t.DiffuseColor.type==="ColorRGB")&&(r.color=new m.Color().fromArray(t.DiffuseColor.value)),t.DisplacementFactor&&(r.displacementScale=t.DisplacementFactor.value),t.Emissive?r.emissive=new m.Color().fromArray(t.Emissive.value):t.EmissiveColor&&(t.EmissiveColor.type==="Color"||t.EmissiveColor.type==="ColorRGB")&&(r.emissive=new m.Color().fromArray(t.EmissiveColor.value)),t.EmissiveFactor&&(r.emissiveIntensity=parseFloat(t.EmissiveFactor.value)),t.Opacity&&(r.opacity=parseFloat(t.Opacity.value)),r.opacity<1&&(r.transparent=!0),t.ReflectionFactor&&(r.reflectivity=t.ReflectionFactor.value),t.Shininess&&(r.shininess=t.Shininess.value),t.Specular?r.specular=new m.Color().fromArray(t.Specular.value):t.SpecularColor&&t.SpecularColor.type==="Color"&&(r.specular=new m.Color().fromArray(t.SpecularColor.value));const s=this;return ze.get(n).children.forEach(function(l){const c=l.relationship;switch(c){case"Bump":r.bumpMap=s.getTexture(e,l.ID);break;case"Maya|TEX_ao_map":r.aoMap=s.getTexture(e,l.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=s.getTexture(e,l.ID),r.map!==void 0&&("colorSpace"in r.map?r.map.colorSpace="srgb":r.map.encoding=3001);break;case"DisplacementColor":r.displacementMap=s.getTexture(e,l.ID);break;case"EmissiveColor":r.emissiveMap=s.getTexture(e,l.ID),r.emissiveMap!==void 0&&("colorSpace"in r.emissiveMap?r.emissiveMap.colorSpace="srgb":r.emissiveMap.encoding=3001);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=s.getTexture(e,l.ID);break;case"ReflectionColor":r.envMap=s.getTexture(e,l.ID),r.envMap!==void 0&&(r.envMap.mapping=m.EquirectangularReflectionMapping,"colorSpace"in r.envMap?r.envMap.colorSpace="srgb":r.envMap.encoding=3001);break;case"SpecularColor":r.specularMap=s.getTexture(e,l.ID),r.specularMap!==void 0&&("colorSpace"in r.specularMap?r.specularMap.colorSpace="srgb":r.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=s.getTexture(e,l.ID),r.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",c);break}}),r}getTexture(t,e){return"LayeredTexture"in be.Objects&&e in be.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),e=ze.get(e).children[0].ID),t.get(e)}parseDeformers(){const t={},e={};if("Deformer"in be.Objects){const n=be.Objects.Deformer;for(const r in n){const s=n[r],l=ze.get(parseInt(r));if(s.attrType==="Skin"){const c=this.parseSkeleton(l,n);c.ID=r,l.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),c.geometryID=l.parents[0].ID,t[r]=c}else if(s.attrType==="BlendShape"){const c={id:r};c.rawTargets=this.parseMorphTargets(l,n),c.id=r,l.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),e[r]=c}}}return{skeletons:t,morphTargets:e}}parseSkeleton(t,e){const n=[];return t.children.forEach(function(r){const s=e[r.ID];if(s.attrType!=="Cluster")return;const l={ID:r.ID,indices:[],weights:[],transformLink:new m.Matrix4().fromArray(s.TransformLink.a)};"Indexes"in s&&(l.indices=s.Indexes.a,l.weights=s.Weights.a),n.push(l)}),{rawBones:n,bones:[]}}parseMorphTargets(t,e){const n=[];for(let r=0;r<t.children.length;r++){const s=t.children[r],l=e[s.ID],c={name:l.attrName,initialWeight:l.DeformPercent,id:l.id,fullWeights:l.FullWeights.a};if(l.attrType!=="BlendShapeChannel")return;c.geoID=ze.get(parseInt(s.ID)).children.filter(function(u){return u.relationship===void 0})[0].ID,n.push(c)}return n}parseScene(t,e,n){ft=new m.Group;const r=this.parseModels(t.skeletons,e,n),s=be.Objects.Model,l=this;r.forEach(function(u){const d=s[u.ID];l.setLookAtProperties(u,d),ze.get(u.ID).parents.forEach(function(f){const y=r.get(f.ID);y!==void 0&&y.add(u)}),u.parent===null&&ft.add(u)}),this.bindSkeleton(t.skeletons,e,r),this.createAmbientLight(),ft.traverse(function(u){if(u.userData.transformData){u.parent&&(u.userData.transformData.parentMatrix=u.parent.matrix,u.userData.transformData.parentMatrixWorld=u.parent.matrixWorld);const d=Ea(u.userData.transformData);u.applyMatrix4(d),u.updateWorldMatrix()}});const c=new Hd().parse();ft.children.length===1&&ft.children[0].isGroup&&(ft.children[0].animations=c,ft=ft.children[0]),ft.animations=c}parseModels(t,e,n){const r=new Map,s=be.Objects.Model;for(const l in s){const c=parseInt(l),u=s[l],d=ze.get(c);let p=this.buildSkeleton(d,t,c,u.attrName);if(!p){switch(u.attrType){case"Camera":p=this.createCamera(d);break;case"Light":p=this.createLight(d);break;case"Mesh":p=this.createMesh(d,e,n);break;case"NurbsCurve":p=this.createCurve(d,e);break;case"LimbNode":case"Root":p=new m.Bone;break;case"Null":default:p=new m.Group;break}p.name=u.attrName?m.PropertyBinding.sanitizeNodeName(u.attrName):"",p.ID=c}this.getTransformData(p,u),r.set(c,p)}return r}buildSkeleton(t,e,n,r){let s=null;return t.parents.forEach(function(l){for(const c in e){const u=e[c];u.rawBones.forEach(function(d,p){if(d.ID===l.ID){const f=s;s=new m.Bone,s.matrixWorld.copy(d.transformLink),s.name=r?m.PropertyBinding.sanitizeNodeName(r):"",s.ID=n,u.bones[p]=s,f!==null&&s.add(f)}})}}),s}createCamera(t){let e,n;if(t.children.forEach(function(r){const s=be.Objects.NodeAttribute[r.ID];s!==void 0&&(n=s)}),n===void 0)e=new m.Object3D;else{let r=0;n.CameraProjectionType!==void 0&&n.CameraProjectionType.value===1&&(r=1);let s=1;n.NearPlane!==void 0&&(s=n.NearPlane.value/1e3);let l=1e3;n.FarPlane!==void 0&&(l=n.FarPlane.value/1e3);let c=window.innerWidth,u=window.innerHeight;n.AspectWidth!==void 0&&n.AspectHeight!==void 0&&(c=n.AspectWidth.value,u=n.AspectHeight.value);const d=c/u;let p=45;n.FieldOfView!==void 0&&(p=n.FieldOfView.value);const f=n.FocalLength?n.FocalLength.value:null;switch(r){case 0:e=new m.PerspectiveCamera(p,d,s,l),f!==null&&e.setFocalLength(f);break;case 1:e=new m.OrthographicCamera(-c/2,c/2,u/2,-u/2,s,l);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+r+"."),e=new m.Object3D;break}}return e}createLight(t){let e,n;if(t.children.forEach(function(r){const s=be.Objects.NodeAttribute[r.ID];s!==void 0&&(n=s)}),n===void 0)e=new m.Object3D;else{let r;n.LightType===void 0?r=0:r=n.LightType.value;let s=16777215;n.Color!==void 0&&(s=new m.Color().fromArray(n.Color.value));let l=n.Intensity===void 0?1:n.Intensity.value/100;n.CastLightOnObject!==void 0&&n.CastLightOnObject.value===0&&(l=0);let c=0;n.FarAttenuationEnd!==void 0&&(n.EnableFarAttenuation!==void 0&&n.EnableFarAttenuation.value===0?c=0:c=n.FarAttenuationEnd.value);const u=1;switch(r){case 0:e=new m.PointLight(s,l,c,u);break;case 1:e=new m.DirectionalLight(s,l);break;case 2:let d=Math.PI/3;n.InnerAngle!==void 0&&(d=m.MathUtils.degToRad(n.InnerAngle.value));let p=0;n.OuterAngle!==void 0&&(p=m.MathUtils.degToRad(n.OuterAngle.value),p=Math.max(p,1)),e=new m.SpotLight(s,l,c,d,p,u);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),e=new m.PointLight(s,l);break}n.CastShadows!==void 0&&n.CastShadows.value===1&&(e.castShadow=!0)}return e}createMesh(t,e,n){let r,s=null,l=null;const c=[];return t.children.forEach(function(u){e.has(u.ID)&&(s=e.get(u.ID)),n.has(u.ID)&&c.push(n.get(u.ID))}),c.length>1?l=c:c.length>0?l=c[0]:(l=new m.MeshPhongMaterial({color:13421772}),c.push(l)),"color"in s.attributes&&c.forEach(function(u){u.vertexColors=!0}),s.FBX_Deformer?(r=new m.SkinnedMesh(s,l),r.normalizeSkinWeights()):r=new m.Mesh(s,l),r}createCurve(t,e){const n=t.children.reduce(function(s,l){return e.has(l.ID)&&(s=e.get(l.ID)),s},null),r=new m.LineBasicMaterial({color:3342591,linewidth:1});return new m.Line(n,r)}getTransformData(t,e){const n={};"InheritType"in e&&(n.inheritType=parseInt(e.InheritType.value)),"RotationOrder"in e?n.eulerOrder=qa(e.RotationOrder.value):n.eulerOrder="ZYX","Lcl_Translation"in e&&(n.translation=e.Lcl_Translation.value),"PreRotation"in e&&(n.preRotation=e.PreRotation.value),"Lcl_Rotation"in e&&(n.rotation=e.Lcl_Rotation.value),"PostRotation"in e&&(n.postRotation=e.PostRotation.value),"Lcl_Scaling"in e&&(n.scale=e.Lcl_Scaling.value),"ScalingOffset"in e&&(n.scalingOffset=e.ScalingOffset.value),"ScalingPivot"in e&&(n.scalingPivot=e.ScalingPivot.value),"RotationOffset"in e&&(n.rotationOffset=e.RotationOffset.value),"RotationPivot"in e&&(n.rotationPivot=e.RotationPivot.value),t.userData.transformData=n}setLookAtProperties(t,e){"LookAtProperty"in e&&ze.get(t.ID).children.forEach(function(r){if(r.relationship==="LookAtProperty"){const s=be.Objects.Model[r.ID];if("Lcl_Translation"in s){const l=s.Lcl_Translation.value;t.target!==void 0?(t.target.position.fromArray(l),ft.add(t.target)):t.lookAt(new m.Vector3().fromArray(l))}}})}bindSkeleton(t,e,n){const r=this.parsePoseNodes();for(const s in t){const l=t[s];ze.get(parseInt(l.ID)).parents.forEach(function(u){if(e.has(u.ID)){const d=u.ID;ze.get(d).parents.forEach(function(f){n.has(f.ID)&&n.get(f.ID).bind(new m.Skeleton(l.bones),r[f.ID])})}})}}parsePoseNodes(){const t={};if("Pose"in be.Objects){const e=be.Objects.Pose;for(const n in e)if(e[n].attrType==="BindPose"&&e[n].NbPoseNodes>0){const r=e[n].PoseNode;Array.isArray(r)?r.forEach(function(s){t[s.Node]=new m.Matrix4().fromArray(s.Matrix.a)}):t[r.Node]=new m.Matrix4().fromArray(r.Matrix.a)}}return t}createAmbientLight(){if("GlobalSettings"in be&&"AmbientColor"in be.GlobalSettings){const t=be.GlobalSettings.AmbientColor.value,e=t[0],n=t[1],r=t[2];if(e!==0||n!==0||r!==0){const s=new m.Color(e,n,r);ft.add(new m.AmbientLight(s,1))}}}}class Qd{parse(t){const e=new Map;if("Geometry"in be.Objects){const n=be.Objects.Geometry;for(const r in n){const s=ze.get(parseInt(r)),l=this.parseGeometry(s,n[r],t);e.set(parseInt(r),l)}}return e}parseGeometry(t,e,n){switch(e.attrType){case"Mesh":return this.parseMeshGeometry(t,e,n);case"NurbsCurve":return this.parseNurbsGeometry(e)}}parseMeshGeometry(t,e,n){const r=n.skeletons,s=[],l=t.parents.map(function(f){return be.Objects.Model[f.ID]});if(l.length===0)return;const c=t.children.reduce(function(f,y){return r[y.ID]!==void 0&&(f=r[y.ID]),f},null);t.children.forEach(function(f){n.morphTargets[f.ID]!==void 0&&s.push(n.morphTargets[f.ID])});const u=l[0],d={};"RotationOrder"in u&&(d.eulerOrder=qa(u.RotationOrder.value)),"InheritType"in u&&(d.inheritType=parseInt(u.InheritType.value)),"GeometricTranslation"in u&&(d.translation=u.GeometricTranslation.value),"GeometricRotation"in u&&(d.rotation=u.GeometricRotation.value),"GeometricScaling"in u&&(d.scale=u.GeometricScaling.value);const p=Ea(d);return this.genGeometry(e,c,s,p)}genGeometry(t,e,n,r){const s=new m.BufferGeometry;t.attrName&&(s.name=t.attrName);const l=this.parseGeoNode(t,e),c=this.genBuffers(l),u=new m.Float32BufferAttribute(c.vertex,3);if(u.applyMatrix4(r),s.setAttribute("position",u),c.colors.length>0&&s.setAttribute("color",new m.Float32BufferAttribute(c.colors,3)),e&&(s.setAttribute("skinIndex",new m.Uint16BufferAttribute(c.weightsIndices,4)),s.setAttribute("skinWeight",new m.Float32BufferAttribute(c.vertexWeights,4)),s.FBX_Deformer=e),c.normal.length>0){const d=new m.Matrix3().getNormalMatrix(r),p=new m.Float32BufferAttribute(c.normal,3);p.applyNormalMatrix(d),s.setAttribute("normal",p)}if(c.uvs.forEach(function(d,p){Ls==="uv2"&&p++;const f=p===0?"uv":`uv${p}`;s.setAttribute(f,new m.Float32BufferAttribute(c.uvs[p],2))}),l.material&&l.material.mappingType!=="AllSame"){let d=c.materialIndex[0],p=0;if(c.materialIndex.forEach(function(f,y){f!==d&&(s.addGroup(p,y-p,d),d=f,p=y)}),s.groups.length>0){const f=s.groups[s.groups.length-1],y=f.start+f.count;y!==c.materialIndex.length&&s.addGroup(y,c.materialIndex.length-y,d)}s.groups.length===0&&s.addGroup(0,c.materialIndex.length,c.materialIndex[0])}return this.addMorphTargets(s,t,n,r),s}parseGeoNode(t,e){const n={};if(n.vertexPositions=t.Vertices!==void 0?t.Vertices.a:[],n.vertexIndices=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],t.LayerElementColor&&(n.color=this.parseVertexColors(t.LayerElementColor[0])),t.LayerElementMaterial&&(n.material=this.parseMaterialIndices(t.LayerElementMaterial[0])),t.LayerElementNormal&&(n.normal=this.parseNormals(t.LayerElementNormal[0])),t.LayerElementUV){n.uv=[];let r=0;for(;t.LayerElementUV[r];)t.LayerElementUV[r].UV&&n.uv.push(this.parseUVs(t.LayerElementUV[r])),r++}return n.weightTable={},e!==null&&(n.skeleton=e,e.rawBones.forEach(function(r,s){r.indices.forEach(function(l,c){n.weightTable[l]===void 0&&(n.weightTable[l]=[]),n.weightTable[l].push({id:s,weight:r.weights[c]})})})),n}genBuffers(t){const e={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,r=0,s=!1,l=[],c=[],u=[],d=[],p=[],f=[];const y=this;return t.vertexIndices.forEach(function(v,b){let T,_=!1;v<0&&(v=v^-1,_=!0);let S=[],L=[];if(l.push(v*3,v*3+1,v*3+2),t.color){const I=mi(b,n,v,t.color);u.push(I[0],I[1],I[2])}if(t.skeleton){if(t.weightTable[v]!==void 0&&t.weightTable[v].forEach(function(I){L.push(I.weight),S.push(I.id)}),L.length>4){s||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),s=!0);const I=[0,0,0,0],F=[0,0,0,0];L.forEach(function(K,D){let O=K,V=S[D];F.forEach(function(R,P,k){if(O>R){k[P]=O,O=R;const N=I[P];I[P]=V,V=N}})}),S=I,L=F}for(;L.length<4;)L.push(0),S.push(0);for(let I=0;I<4;++I)p.push(L[I]),f.push(S[I])}if(t.normal){const I=mi(b,n,v,t.normal);c.push(I[0],I[1],I[2])}t.material&&t.material.mappingType!=="AllSame"&&(T=mi(b,n,v,t.material)[0]),t.uv&&t.uv.forEach(function(I,F){const K=mi(b,n,v,I);d[F]===void 0&&(d[F]=[]),d[F].push(K[0]),d[F].push(K[1])}),r++,_&&(y.genFace(e,t,l,T,c,u,d,p,f,r),n++,r=0,l=[],c=[],u=[],d=[],p=[],f=[])}),e}genFace(t,e,n,r,s,l,c,u,d,p){for(let f=2;f<p;f++)t.vertex.push(e.vertexPositions[n[0]]),t.vertex.push(e.vertexPositions[n[1]]),t.vertex.push(e.vertexPositions[n[2]]),t.vertex.push(e.vertexPositions[n[(f-1)*3]]),t.vertex.push(e.vertexPositions[n[(f-1)*3+1]]),t.vertex.push(e.vertexPositions[n[(f-1)*3+2]]),t.vertex.push(e.vertexPositions[n[f*3]]),t.vertex.push(e.vertexPositions[n[f*3+1]]),t.vertex.push(e.vertexPositions[n[f*3+2]]),e.skeleton&&(t.vertexWeights.push(u[0]),t.vertexWeights.push(u[1]),t.vertexWeights.push(u[2]),t.vertexWeights.push(u[3]),t.vertexWeights.push(u[(f-1)*4]),t.vertexWeights.push(u[(f-1)*4+1]),t.vertexWeights.push(u[(f-1)*4+2]),t.vertexWeights.push(u[(f-1)*4+3]),t.vertexWeights.push(u[f*4]),t.vertexWeights.push(u[f*4+1]),t.vertexWeights.push(u[f*4+2]),t.vertexWeights.push(u[f*4+3]),t.weightsIndices.push(d[0]),t.weightsIndices.push(d[1]),t.weightsIndices.push(d[2]),t.weightsIndices.push(d[3]),t.weightsIndices.push(d[(f-1)*4]),t.weightsIndices.push(d[(f-1)*4+1]),t.weightsIndices.push(d[(f-1)*4+2]),t.weightsIndices.push(d[(f-1)*4+3]),t.weightsIndices.push(d[f*4]),t.weightsIndices.push(d[f*4+1]),t.weightsIndices.push(d[f*4+2]),t.weightsIndices.push(d[f*4+3])),e.color&&(t.colors.push(l[0]),t.colors.push(l[1]),t.colors.push(l[2]),t.colors.push(l[(f-1)*3]),t.colors.push(l[(f-1)*3+1]),t.colors.push(l[(f-1)*3+2]),t.colors.push(l[f*3]),t.colors.push(l[f*3+1]),t.colors.push(l[f*3+2])),e.material&&e.material.mappingType!=="AllSame"&&(t.materialIndex.push(r),t.materialIndex.push(r),t.materialIndex.push(r)),e.normal&&(t.normal.push(s[0]),t.normal.push(s[1]),t.normal.push(s[2]),t.normal.push(s[(f-1)*3]),t.normal.push(s[(f-1)*3+1]),t.normal.push(s[(f-1)*3+2]),t.normal.push(s[f*3]),t.normal.push(s[f*3+1]),t.normal.push(s[f*3+2])),e.uv&&e.uv.forEach(function(y,v){t.uvs[v]===void 0&&(t.uvs[v]=[]),t.uvs[v].push(c[v][0]),t.uvs[v].push(c[v][1]),t.uvs[v].push(c[v][(f-1)*2]),t.uvs[v].push(c[v][(f-1)*2+1]),t.uvs[v].push(c[v][f*2]),t.uvs[v].push(c[v][f*2+1])})}addMorphTargets(t,e,n,r){if(n.length===0)return;t.morphTargetsRelative=!0,t.morphAttributes.position=[];const s=this;n.forEach(function(l){l.rawTargets.forEach(function(c){const u=be.Objects.Geometry[c.geoID];u!==void 0&&s.genMorphGeometry(t,e,u,r,c.name)})})}genMorphGeometry(t,e,n,r,s){const l=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],c=n.Vertices!==void 0?n.Vertices.a:[],u=n.Indexes!==void 0?n.Indexes.a:[],d=t.attributes.position.count*3,p=new Float32Array(d);for(let b=0;b<u.length;b++){const T=u[b]*3;p[T]=c[b*3],p[T+1]=c[b*3+1],p[T+2]=c[b*3+2]}const f={vertexIndices:l,vertexPositions:p},y=this.genBuffers(f),v=new m.Float32BufferAttribute(y.vertex,3);v.name=s||n.attrName,v.applyMatrix4(r),t.morphAttributes.position.push(v)}parseNormals(t){const e=t.MappingInformationType,n=t.ReferenceInformationType,r=t.Normals.a;let s=[];return n==="IndexToDirect"&&("NormalIndex"in t?s=t.NormalIndex.a:"NormalsIndex"in t&&(s=t.NormalsIndex.a)),{dataSize:3,buffer:r,indices:s,mappingType:e,referenceType:n}}parseUVs(t){const e=t.MappingInformationType,n=t.ReferenceInformationType,r=t.UV.a;let s=[];return n==="IndexToDirect"&&(s=t.UVIndex.a),{dataSize:2,buffer:r,indices:s,mappingType:e,referenceType:n}}parseVertexColors(t){const e=t.MappingInformationType,n=t.ReferenceInformationType,r=t.Colors.a;let s=[];return n==="IndexToDirect"&&(s=t.ColorIndex.a),{dataSize:4,buffer:r,indices:s,mappingType:e,referenceType:n}}parseMaterialIndices(t){const e=t.MappingInformationType,n=t.ReferenceInformationType;if(e==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};const r=t.Materials.a,s=[];for(let l=0;l<r.length;++l)s.push(l);return{dataSize:1,buffer:r,indices:s,mappingType:e,referenceType:n}}parseNurbsGeometry(t){if(ja===void 0)return console.error("THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new m.BufferGeometry;const e=parseInt(t.Order);if(isNaN(e))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",t.Order,t.id),new m.BufferGeometry;const n=e-1,r=t.KnotVector.a,s=[],l=t.Points.a;for(let f=0,y=l.length;f<y;f+=4)s.push(new m.Vector4().fromArray(l,f));let c,u;if(t.Form==="Closed")s.push(s[0]);else if(t.Form==="Periodic"){c=n,u=r.length-1-c;for(let f=0;f<n;++f)s.push(s[f])}const p=new ja(n,r,s,c,u).getPoints(s.length*12);return new m.BufferGeometry().setFromPoints(p)}}class Hd{parse(){const t=[],e=this.parseClips();if(e!==void 0)for(const n in e){const r=e[n],s=this.addClip(r);t.push(s)}return t}parseClips(){if(be.Objects.AnimationCurve===void 0)return;const t=this.parseAnimationCurveNodes();this.parseAnimationCurves(t);const e=this.parseAnimationLayers(t);return this.parseAnimStacks(e)}parseAnimationCurveNodes(){const t=be.Objects.AnimationCurveNode,e=new Map;for(const n in t){const r=t[n];if(r.attrName.match(/S|R|T|DeformPercent/)!==null){const s={id:r.id,attr:r.attrName,curves:{}};e.set(s.id,s)}}return e}parseAnimationCurves(t){const e=be.Objects.AnimationCurve;for(const n in e){const r={id:e[n].id,times:e[n].KeyTime.a.map(tf),values:e[n].KeyValueFloat.a},s=ze.get(r.id);if(s!==void 0){const l=s.parents[0].ID,c=s.parents[0].relationship;c.match(/X/)?t.get(l).curves.x=r:c.match(/Y/)?t.get(l).curves.y=r:c.match(/Z/)?t.get(l).curves.z=r:c.match(/d|DeformPercent/)&&t.has(l)&&(t.get(l).curves.morph=r)}}}parseAnimationLayers(t){const e=be.Objects.AnimationLayer,n=new Map;for(const r in e){const s=[],l=ze.get(parseInt(r));l!==void 0&&(l.children.forEach(function(u,d){if(t.has(u.ID)){const p=t.get(u.ID);if(p.curves.x!==void 0||p.curves.y!==void 0||p.curves.z!==void 0){if(s[d]===void 0){const f=ze.get(u.ID).parents.filter(function(y){return y.relationship!==void 0})[0].ID;if(f!==void 0){const y=be.Objects.Model[f.toString()];if(y===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",u);return}const v={modelName:y.attrName?m.PropertyBinding.sanitizeNodeName(y.attrName):"",ID:y.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};ft.traverse(function(b){b.ID===y.id&&(v.transform=b.matrix,b.userData.transformData&&(v.eulerOrder=b.userData.transformData.eulerOrder))}),v.transform||(v.transform=new m.Matrix4),"PreRotation"in y&&(v.preRotation=y.PreRotation.value),"PostRotation"in y&&(v.postRotation=y.PostRotation.value),s[d]=v}}s[d]&&(s[d][p.attr]=p)}else if(p.curves.morph!==void 0){if(s[d]===void 0){const f=ze.get(u.ID).parents.filter(function(S){return S.relationship!==void 0})[0].ID,y=ze.get(f).parents[0].ID,v=ze.get(y).parents[0].ID,b=ze.get(v).parents[0].ID,T=be.Objects.Model[b],_={modelName:T.attrName?m.PropertyBinding.sanitizeNodeName(T.attrName):"",morphName:be.Objects.Deformer[f].attrName};s[d]=_}s[d][p.attr]=p}}}),n.set(parseInt(r),s))}return n}parseAnimStacks(t){const e=be.Objects.AnimationStack,n={};for(const r in e){const s=ze.get(parseInt(r)).children;s.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const l=t.get(s[0].ID);n[r]={name:e[r].attrName,layer:l}}return n}addClip(t){let e=[];const n=this;return t.layer.forEach(function(r){e=e.concat(n.generateTracks(r))}),new m.AnimationClip(t.name,-1,e)}generateTracks(t){const e=[];let n=new m.Vector3,r=new m.Quaternion,s=new m.Vector3;if(t.transform&&t.transform.decompose(n,r,s),n=n.toArray(),r=new m.Euler().setFromQuaternion(r,t.eulerOrder).toArray(),s=s.toArray(),t.T!==void 0&&Object.keys(t.T.curves).length>0){const l=this.generateVectorTrack(t.modelName,t.T.curves,n,"position");l!==void 0&&e.push(l)}if(t.R!==void 0&&Object.keys(t.R.curves).length>0){const l=this.generateRotationTrack(t.modelName,t.R.curves,r,t.preRotation,t.postRotation,t.eulerOrder);l!==void 0&&e.push(l)}if(t.S!==void 0&&Object.keys(t.S.curves).length>0){const l=this.generateVectorTrack(t.modelName,t.S.curves,s,"scale");l!==void 0&&e.push(l)}if(t.DeformPercent!==void 0){const l=this.generateMorphTrack(t);l!==void 0&&e.push(l)}return e}generateVectorTrack(t,e,n,r){const s=this.getTimesForAllAxes(e),l=this.getKeyframeTrackValues(s,e,n);return new m.VectorKeyframeTrack(t+"."+r,s,l)}generateRotationTrack(t,e,n,r,s,l){e.x!==void 0&&(this.interpolateRotations(e.x),e.x.values=e.x.values.map(m.MathUtils.degToRad)),e.y!==void 0&&(this.interpolateRotations(e.y),e.y.values=e.y.values.map(m.MathUtils.degToRad)),e.z!==void 0&&(this.interpolateRotations(e.z),e.z.values=e.z.values.map(m.MathUtils.degToRad));const c=this.getTimesForAllAxes(e),u=this.getKeyframeTrackValues(c,e,n);r!==void 0&&(r=r.map(m.MathUtils.degToRad),r.push(l),r=new m.Euler().fromArray(r),r=new m.Quaternion().setFromEuler(r)),s!==void 0&&(s=s.map(m.MathUtils.degToRad),s.push(l),s=new m.Euler().fromArray(s),s=new m.Quaternion().setFromEuler(s).invert());const d=new m.Quaternion,p=new m.Euler,f=[];for(let y=0;y<u.length;y+=3)p.set(u[y],u[y+1],u[y+2],l),d.setFromEuler(p),r!==void 0&&d.premultiply(r),s!==void 0&&d.multiply(s),d.toArray(f,y/3*4);return new m.QuaternionKeyframeTrack(t+".quaternion",c,f)}generateMorphTrack(t){const e=t.DeformPercent.curves.morph,n=e.values.map(function(s){return s/100}),r=ft.getObjectByName(t.modelName).morphTargetDictionary[t.morphName];return new m.NumberKeyframeTrack(t.modelName+".morphTargetInfluences["+r+"]",e.times,n)}getTimesForAllAxes(t){let e=[];if(t.x!==void 0&&(e=e.concat(t.x.times)),t.y!==void 0&&(e=e.concat(t.y.times)),t.z!==void 0&&(e=e.concat(t.z.times)),e=e.sort(function(n,r){return n-r}),e.length>1){let n=1,r=e[0];for(let s=1;s<e.length;s++){const l=e[s];l!==r&&(e[n]=l,r=l,n++)}e=e.slice(0,n)}return e}getKeyframeTrackValues(t,e,n){const r=n,s=[];let l=-1,c=-1,u=-1;return t.forEach(function(d){if(e.x&&(l=e.x.times.indexOf(d)),e.y&&(c=e.y.times.indexOf(d)),e.z&&(u=e.z.times.indexOf(d)),l!==-1){const p=e.x.values[l];s.push(p),r[0]=p}else s.push(r[0]);if(c!==-1){const p=e.y.values[c];s.push(p),r[1]=p}else s.push(r[1]);if(u!==-1){const p=e.z.values[u];s.push(p),r[2]=p}else s.push(r[2])}),s}interpolateRotations(t){for(let e=1;e<t.values.length;e++){const n=t.values[e-1],r=t.values[e]-n,s=Math.abs(r);if(s>=180){const l=s/180,c=r/l;let u=n+c;const d=t.times[e-1],f=(t.times[e]-d)/l;let y=d+f;const v=[],b=[];for(;y<t.times[e];)v.push(y),y+=f,b.push(u),u+=c;t.times=el(t.times,e,v),t.values=el(t.values,e,b)}}}}class Ed{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(t){this.nodeStack.push(t),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(t,e){this.currentProp=t,this.currentPropName=e}parse(t){this.currentIndent=0,this.allNodes=new Qa,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const e=this,n=t.split(/[\r\n]+/);return n.forEach(function(r,s){const l=r.match(/^[\s\t]*;/),c=r.match(/^[\s\t]*$/);if(l||c)return;const u=r.match("^\\t{"+e.currentIndent+"}(\\w+):(.*){",""),d=r.match("^\\t{"+e.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),p=r.match("^\\t{"+(e.currentIndent-1)+"}}");u?e.parseNodeBegin(r,u):d?e.parseNodeProperty(r,d,n[++s]):p?e.popStack():r.match(/^[^\s\t}]/)&&e.parseNodePropertyContinued(r)}),this.allNodes}parseNodeBegin(t,e){const n=e[1].trim().replace(/^"/,"").replace(/"$/,""),r=e[2].split(",").map(function(u){return u.trim().replace(/^"/,"").replace(/"$/,"")}),s={name:n},l=this.parseNodeAttr(r),c=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(n,s):n in c?(n==="PoseNode"?c.PoseNode.push(s):c[n].id!==void 0&&(c[n]={},c[n][c[n].id]=c[n]),l.id!==""&&(c[n][l.id]=s)):typeof l.id=="number"?(c[n]={},c[n][l.id]=s):n!=="Properties70"&&(n==="PoseNode"?c[n]=[s]:c[n]=s),typeof l.id=="number"&&(s.id=l.id),l.name!==""&&(s.attrName=l.name),l.type!==""&&(s.attrType=l.type),this.pushStack(s)}parseNodeAttr(t){let e=t[0];t[0]!==""&&(e=parseInt(t[0]),isNaN(e)&&(e=t[0]));let n="",r="";return t.length>1&&(n=t[1].replace(/^(\w+)::/,""),r=t[2]),{id:e,name:n,type:r}}parseNodeProperty(t,e,n){let r=e[1].replace(/^"/,"").replace(/"$/,"").trim(),s=e[2].replace(/^"/,"").replace(/"$/,"").trim();r==="Content"&&s===","&&(s=n.replace(/"/g,"").replace(/,$/,"").trim());const l=this.getCurrentNode();if(l.name==="Properties70"){this.parseNodeSpecialProperty(t,r,s);return}if(r==="C"){const u=s.split(",").slice(1),d=parseInt(u[0]),p=parseInt(u[1]);let f=s.split(",").slice(3);f=f.map(function(y){return y.trim().replace(/^"/,"")}),r="connections",s=[d,p],rf(s,f),l[r]===void 0&&(l[r]=[])}r==="Node"&&(l.id=s),r in l&&Array.isArray(l[r])?l[r].push(s):r!=="a"?l[r]=s:l.a=s,this.setCurrentProp(l,r),r==="a"&&s.slice(-1)!==","&&(l.a=Fs(s))}parseNodePropertyContinued(t){const e=this.getCurrentNode();e.a+=t,t.slice(-1)!==","&&(e.a=Fs(e.a))}parseNodeSpecialProperty(t,e,n){const r=n.split('",').map(function(p){return p.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=r[0],l=r[1],c=r[2],u=r[3];let d=r[4];switch(l){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":d=parseFloat(d);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":d=Fs(d);break}this.getPrevNode()[s]={type:l,type2:c,flag:u,value:d},this.setCurrentProp(this.getPrevNode(),s)}}class qd{parse(t){const e=new Ja(t);e.skip(23);const n=e.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const r=new Qa;for(;!this.endOfContent(e);){const s=this.parseNode(e,n);s!==null&&r.add(s.name,s)}return r}endOfContent(t){return t.size()%16===0?(t.getOffset()+160+16&-16)>=t.size():t.getOffset()+160+16>=t.size()}parseNode(t,e){const n={},r=e>=7500?t.getUint64():t.getUint32(),s=e>=7500?t.getUint64():t.getUint32();e>=7500?t.getUint64():t.getUint32();const l=t.getUint8(),c=t.getString(l);if(r===0)return null;const u=[];for(let y=0;y<s;y++)u.push(this.parseProperty(t));const d=u.length>0?u[0]:"",p=u.length>1?u[1]:"",f=u.length>2?u[2]:"";for(n.singleProperty=s===1&&t.getOffset()===r;r>t.getOffset();){const y=this.parseNode(t,e);y!==null&&this.parseSubNode(c,n,y)}return n.propertyList=u,typeof d=="number"&&(n.id=d),p!==""&&(n.attrName=p),f!==""&&(n.attrType=f),c!==""&&(n.name=c),n}parseSubNode(t,e,n){if(n.singleProperty===!0){const r=n.propertyList[0];Array.isArray(r)?(e[n.name]=n,n.a=r):e[n.name]=r}else if(t==="Connections"&&n.name==="C"){const r=[];n.propertyList.forEach(function(s,l){l!==0&&r.push(s)}),e.connections===void 0&&(e.connections=[]),e.connections.push(r)}else if(n.name==="Properties70")Object.keys(n).forEach(function(s){e[s]=n[s]});else if(t==="Properties70"&&n.name==="P"){let r=n.propertyList[0],s=n.propertyList[1];const l=n.propertyList[2],c=n.propertyList[3];let u;r.indexOf("Lcl ")===0&&(r=r.replace("Lcl ","Lcl_")),s.indexOf("Lcl ")===0&&(s=s.replace("Lcl ","Lcl_")),s==="Color"||s==="ColorRGB"||s==="Vector"||s==="Vector3D"||s.indexOf("Lcl_")===0?u=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:u=n.propertyList[4],e[r]={type:s,type2:l,flag:c,value:u}}else e[n.name]===void 0?typeof n.id=="number"?(e[n.name]={},e[n.name][n.id]=n):e[n.name]=n:n.name==="PoseNode"?(Array.isArray(e[n.name])||(e[n.name]=[e[n.name]]),e[n.name].push(n)):e[n.name][n.id]===void 0&&(e[n.name][n.id]=n)}parseProperty(t){const e=t.getString(1);let n;switch(e){case"C":return t.getBoolean();case"D":return t.getFloat64();case"F":return t.getFloat32();case"I":return t.getInt32();case"L":return t.getInt64();case"R":return n=t.getUint32(),t.getArrayBuffer(n);case"S":return n=t.getUint32(),t.getString(n);case"Y":return t.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const r=t.getUint32(),s=t.getUint32(),l=t.getUint32();if(s===0)switch(e){case"b":case"c":return t.getBooleanArray(r);case"d":return t.getFloat64Array(r);case"f":return t.getFloat32Array(r);case"i":return t.getInt32Array(r);case"l":return t.getInt64Array(r)}const c=Bh(new Uint8Array(t.getArrayBuffer(l))),u=new Ja(c.buffer);switch(e){case"b":case"c":return u.getBooleanArray(r);case"d":return u.getFloat64Array(r);case"f":return u.getFloat32Array(r);case"i":return u.getInt32Array(r);case"l":return u.getInt64Array(r)}default:throw new Error("THREE.FBXLoader: Unknown property type "+e)}}}class Ja{constructor(t,e){this.dv=new DataView(t),this.offset=0,this.littleEndian=e!==void 0?e:!0}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(t){this.offset+=t}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(t){const e=[];for(let n=0;n<t;n++)e.push(this.getBoolean());return e}getUint8(){const t=this.dv.getUint8(this.offset);return this.offset+=1,t}getInt16(){const t=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,t}getInt32(){const t=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,t}getInt32Array(t){const e=[];for(let n=0;n<t;n++)e.push(this.getInt32());return e}getUint32(){const t=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,t}getInt64(){let t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),e&2147483648?(e=~e&4294967295,t=~t&4294967295,t===4294967295&&(e=e+1&4294967295),t=t+1&4294967295,-(e*4294967296+t)):e*4294967296+t}getInt64Array(t){const e=[];for(let n=0;n<t;n++)e.push(this.getInt64());return e}getUint64(){let t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),e*4294967296+t}getFloat32(){const t=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t}getFloat32Array(t){const e=[];for(let n=0;n<t;n++)e.push(this.getFloat32());return e}getFloat64(){const t=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t}getFloat64Array(t){const e=[];for(let n=0;n<t;n++)e.push(this.getFloat64());return e}getArrayBuffer(t){const e=this.dv.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e}getString(t){let e=[];for(let r=0;r<t;r++)e[r]=this.getUint8();const n=e.indexOf(0);return n>=0&&(e=e.slice(0,n)),lr(new Uint8Array(e))}}class Qa{add(t,e){this[t]=e}}function $d(a){const t="Kaydara FBX Binary \0";return a.byteLength>=t.length&&t===$a(a,0,t.length)}function ef(a){const t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let e=0;function n(r){const s=a[r-1];return a=a.slice(e+r),e++,s}for(let r=0;r<t.length;++r)if(n(1)===t[r])return!1;return!0}function Ha(a){const t=/FBXVersion: (\d+)/,e=a.match(t);if(e)return parseInt(e[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function tf(a){return a/46186158e3}const nf=[];function mi(a,t,e,n){let r;switch(n.mappingType){case"ByPolygonVertex":r=a;break;case"ByPolygon":r=t;break;case"ByVertice":r=e;break;case"AllSame":r=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}n.referenceType==="IndexToDirect"&&(r=n.indices[r]);const s=r*n.dataSize,l=s+n.dataSize;return sf(nf,n.buffer,s,l)}const As=new m.Euler,ur=new m.Vector3;function Ea(a){const t=new m.Matrix4,e=new m.Matrix4,n=new m.Matrix4,r=new m.Matrix4,s=new m.Matrix4,l=new m.Matrix4,c=new m.Matrix4,u=new m.Matrix4,d=new m.Matrix4,p=new m.Matrix4,f=new m.Matrix4,y=new m.Matrix4,v=a.inheritType?a.inheritType:0;if(a.translation&&t.setPosition(ur.fromArray(a.translation)),a.preRotation){const P=a.preRotation.map(m.MathUtils.degToRad);P.push(a.eulerOrder),e.makeRotationFromEuler(As.fromArray(P))}if(a.rotation){const P=a.rotation.map(m.MathUtils.degToRad);P.push(a.eulerOrder),n.makeRotationFromEuler(As.fromArray(P))}if(a.postRotation){const P=a.postRotation.map(m.MathUtils.degToRad);P.push(a.eulerOrder),r.makeRotationFromEuler(As.fromArray(P)),r.invert()}a.scale&&s.scale(ur.fromArray(a.scale)),a.scalingOffset&&c.setPosition(ur.fromArray(a.scalingOffset)),a.scalingPivot&&l.setPosition(ur.fromArray(a.scalingPivot)),a.rotationOffset&&u.setPosition(ur.fromArray(a.rotationOffset)),a.rotationPivot&&d.setPosition(ur.fromArray(a.rotationPivot)),a.parentMatrixWorld&&(f.copy(a.parentMatrix),p.copy(a.parentMatrixWorld));const b=e.clone().multiply(n).multiply(r),T=new m.Matrix4;T.extractRotation(p);const _=new m.Matrix4;_.copyPosition(p);const S=_.clone().invert().multiply(p),L=T.clone().invert().multiply(S),I=s,F=new m.Matrix4;if(v===0)F.copy(T).multiply(b).multiply(L).multiply(I);else if(v===1)F.copy(T).multiply(L).multiply(b).multiply(I);else{const k=new m.Matrix4().scale(new m.Vector3().setFromMatrixScale(f)).clone().invert(),N=L.clone().multiply(k);F.copy(T).multiply(b).multiply(N).multiply(I)}const K=d.clone().invert(),D=l.clone().invert();let O=t.clone().multiply(u).multiply(d).multiply(e).multiply(n).multiply(r).multiply(K).multiply(c).multiply(l).multiply(s).multiply(D);const V=new m.Matrix4().copyPosition(O),R=p.clone().multiply(V);return y.copyPosition(R),O=y.clone().multiply(F),O.premultiply(p.invert()),O}function qa(a){a=a||0;const t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return a===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[a]}function Fs(a){return a.split(",").map(function(e){return parseFloat(e)})}function $a(a,t,e){return t===void 0&&(t=0),e===void 0&&(e=a.byteLength),lr(new Uint8Array(a,t,e))}function rf(a,t){for(let e=0,n=a.length,r=t.length;e<r;e++,n++)a[n]=t[e]}function sf(a,t,e,n){for(let r=e,s=0;r<n;r++,s++)a[s]=t[r];return a}function el(a,t,e){return a.slice(0,t).concat(e).concat(a.slice(t))}class of extends m.DataTextureLoader{constructor(t){super(t),this.type=m.HalfFloatType}parse(t){const l=function(V,R){switch(V){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(R||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(R||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(R||""));default:case 4:throw new Error("THREE.RGBELoader: Memory Error: "+(R||""))}},p=`
|
|
97
|
+
}`},q=new m.ShaderMaterial({fragmentShader:Q.fragmentShader,vertexShader:Q.vertexShader,uniforms:m.UniformsUtils.clone(Q.uniforms),lights:!0,side:T,fog:_});q.uniforms.mirrorSampler.value=H.texture,q.uniforms.textureMatrix.value=k,q.uniforms.alpha.value=c,q.uniforms.time.value=u,q.uniforms.normalSampler.value=d,q.uniforms.sunColor.value=f,q.uniforms.waterColor.value=y,q.uniforms.sunDirection.value=p,q.uniforms.distortionScale.value=b,q.uniforms.eye.value=v,n.material=q,n.onBeforeRender=function(J,oe,ie){if(I.setFromMatrixPosition(n.matrixWorld),F.setFromMatrixPosition(ie.matrixWorld),K.extractRotation(n.matrixWorld),L.set(0,0,1),L.applyMatrix4(K),V.subVectors(I,F),V.dot(L)>0)return;V.reflect(L).negate(),V.add(I),K.extractRotation(ie.matrixWorld),D.set(0,0,-1),D.applyMatrix4(K),D.add(F),R.subVectors(I,D),R.reflect(L).negate(),R.add(I),N.position.copy(V),N.up.set(0,1,0),N.up.applyMatrix4(K),N.up.reflect(L),N.lookAt(R),N.far=ie.far,N.updateMatrixWorld(),N.projectionMatrix.copy(ie.projectionMatrix),k.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),k.multiply(N.projectionMatrix),k.multiply(N.matrixWorldInverse),S.setFromNormalAndCoplanarPoint(L,I),S.applyMatrix4(N.matrixWorldInverse),O.set(S.normal.x,S.normal.y,S.normal.z,S.constant);const te=N.projectionMatrix;P.x=(Math.sign(O.x)+te.elements[8])/te.elements[0],P.y=(Math.sign(O.y)+te.elements[9])/te.elements[5],P.z=-1,P.w=(1+te.elements[10])/te.elements[14],O.multiplyScalar(2/O.dot(P)),te.elements[2]=O.x,te.elements[6]=O.y,te.elements[10]=O.z+1-l,te.elements[14]=O.w,v.setFromMatrixPosition(ie.matrixWorld);const me=J.getRenderTarget(),xe=J.xr.enabled,he=J.shadowMap.autoUpdate;n.visible=!1,J.xr.enabled=!1,J.shadowMap.autoUpdate=!1,J.setRenderTarget(H),J.state.buffers.depth.setMask(!0),J.autoClear===!1&&J.clear(),J.render(oe,N),n.visible=!0,J.xr.enabled=xe,J.shadowMap.autoUpdate=he,J.setRenderTarget(me);const ve=ie.viewport;ve!==void 0&&J.state.viewport(ve)}}}var Qh=Object.defineProperty,Hh=(a,t,e)=>t in a?Qh(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e,Eh=(a,t,e)=>(Hh(a,t+"",e),e);class qh{constructor(){Eh(this,"_listeners")}addEventListener(t,e){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[t]===void 0&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;const n=this._listeners;return n[t]!==void 0&&n[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;const r=this._listeners[t];if(r!==void 0){const s=r.indexOf(e);s!==-1&&r.splice(s,1)}}dispatchEvent(t){if(this._listeners===void 0)return;const n=this._listeners[t.type];if(n!==void 0){t.target=this;const r=n.slice(0);for(let s=0,l=r.length;s<l;s++)r[s].call(this,t);t.target=null}}}var $h=Object.defineProperty,ed=(a,t,e)=>t in a?$h(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e,se=(a,t,e)=>(ed(a,typeof t!="symbol"?t+"":t,e),e);const pi=new m.Ray,ka=new m.Plane,td=Math.cos(70*(Math.PI/180)),Da=(a,t)=>(a%t+t)%t;class nd extends qh{constructor(t,e){super(),se(this,"object"),se(this,"domElement"),se(this,"enabled",!0),se(this,"target",new m.Vector3),se(this,"minDistance",0),se(this,"maxDistance",1/0),se(this,"minZoom",0),se(this,"maxZoom",1/0),se(this,"minPolarAngle",0),se(this,"maxPolarAngle",Math.PI),se(this,"minAzimuthAngle",-1/0),se(this,"maxAzimuthAngle",1/0),se(this,"enableDamping",!1),se(this,"dampingFactor",.05),se(this,"enableZoom",!0),se(this,"zoomSpeed",1),se(this,"enableRotate",!0),se(this,"rotateSpeed",1),se(this,"enablePan",!0),se(this,"panSpeed",1),se(this,"screenSpacePanning",!0),se(this,"keyPanSpeed",7),se(this,"zoomToCursor",!1),se(this,"autoRotate",!1),se(this,"autoRotateSpeed",2),se(this,"reverseOrbit",!1),se(this,"reverseHorizontalOrbit",!1),se(this,"reverseVerticalOrbit",!1),se(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),se(this,"mouseButtons",{LEFT:m.MOUSE.ROTATE,MIDDLE:m.MOUSE.DOLLY,RIGHT:m.MOUSE.PAN}),se(this,"touches",{ONE:m.TOUCH.ROTATE,TWO:m.TOUCH.DOLLY_PAN}),se(this,"target0"),se(this,"position0"),se(this,"zoom0"),se(this,"_domElementKeyEvents",null),se(this,"getPolarAngle"),se(this,"getAzimuthalAngle"),se(this,"setPolarAngle"),se(this,"setAzimuthalAngle"),se(this,"getDistance"),se(this,"getZoomScale"),se(this,"listenToKeyEvents"),se(this,"stopListenToKeyEvents"),se(this,"saveState"),se(this,"reset"),se(this,"update"),se(this,"connect"),se(this,"dispose"),se(this,"dollyIn"),se(this,"dollyOut"),se(this,"getScale"),se(this,"setScale"),this.object=t,this.domElement=e,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>p.phi,this.getAzimuthalAngle=()=>p.theta,this.setPolarAngle=X=>{let E=Da(X,2*Math.PI),ue=p.phi;ue<0&&(ue+=2*Math.PI),E<0&&(E+=2*Math.PI);let Se=Math.abs(E-ue);2*Math.PI-Se<Se&&(E<ue?E+=2*Math.PI:ue+=2*Math.PI),f.phi=E-ue,n.update()},this.setAzimuthalAngle=X=>{let E=Da(X,2*Math.PI),ue=p.theta;ue<0&&(ue+=2*Math.PI),E<0&&(E+=2*Math.PI);let Se=Math.abs(E-ue);2*Math.PI-Se<Se&&(E<ue?E+=2*Math.PI:ue+=2*Math.PI),f.theta=E-ue,n.update()},this.getDistance=()=>n.object.position.distanceTo(n.target),this.listenToKeyEvents=X=>{X.addEventListener("keydown",sn),this._domElementKeyEvents=X},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",sn),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(r),n.update(),u=c.NONE},this.update=(()=>{const X=new m.Vector3,E=new m.Vector3(0,1,0),ue=new m.Quaternion().setFromUnitVectors(t.up,E),Se=ue.clone().invert(),Re=new m.Vector3,Ct=new m.Quaternion,Bt=2*Math.PI;return function(){const Ai=n.object.position;ue.setFromUnitVectors(t.up,E),Se.copy(ue).invert(),X.copy(Ai).sub(n.target),X.applyQuaternion(ue),p.setFromVector3(X),n.autoRotate&&u===c.NONE&&Q(N()),n.enableDamping?(p.theta+=f.theta*n.dampingFactor,p.phi+=f.phi*n.dampingFactor):(p.theta+=f.theta,p.phi+=f.phi);let Nt=n.minAzimuthAngle,jt=n.maxAzimuthAngle;isFinite(Nt)&&isFinite(jt)&&(Nt<-Math.PI?Nt+=Bt:Nt>Math.PI&&(Nt-=Bt),jt<-Math.PI?jt+=Bt:jt>Math.PI&&(jt-=Bt),Nt<=jt?p.theta=Math.max(Nt,Math.min(jt,p.theta)):p.theta=p.theta>(Nt+jt)/2?Math.max(Nt,p.theta):Math.min(jt,p.theta)),p.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,p.phi)),p.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(v,n.dampingFactor):n.target.add(v),n.zoomToCursor&&R||n.object.isOrthographicCamera?p.radius=ve(p.radius):p.radius=ve(p.radius*y),X.setFromSpherical(p),X.applyQuaternion(Se),Ai.copy(n.target).add(X),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(f.theta*=1-n.dampingFactor,f.phi*=1-n.dampingFactor,v.multiplyScalar(1-n.dampingFactor)):(f.set(0,0,0),v.set(0,0,0));let Pn=!1;if(n.zoomToCursor&&R){let Hn=null;if(n.object instanceof m.PerspectiveCamera&&n.object.isPerspectiveCamera){const En=X.length();Hn=ve(En*y);const yr=En-Hn;n.object.position.addScaledVector(O,yr),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const En=new m.Vector3(V.x,V.y,0);En.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/y)),n.object.updateProjectionMatrix(),Pn=!0;const yr=new m.Vector3(V.x,V.y,0);yr.unproject(n.object),n.object.position.sub(yr).add(En),n.object.updateMatrixWorld(),Hn=X.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;Hn!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(Hn).add(n.object.position):(pi.origin.copy(n.object.position),pi.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(pi.direction))<td?t.lookAt(n.target):(ka.setFromNormalAndCoplanarPoint(n.object.up,n.target),pi.intersectPlane(ka,n.target))))}else n.object instanceof m.OrthographicCamera&&n.object.isOrthographicCamera&&(Pn=y!==1,Pn&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/y)),n.object.updateProjectionMatrix()));return y=1,R=!1,Pn||Re.distanceToSquared(n.object.position)>d||8*(1-Ct.dot(n.object.quaternion))>d?(n.dispatchEvent(r),Re.copy(n.object.position),Ct.copy(n.object.quaternion),Pn=!1,!0):!1}})(),this.connect=X=>{n.domElement=X,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",mr),n.domElement.addEventListener("pointerdown",Zn),n.domElement.addEventListener("pointercancel",jn),n.domElement.addEventListener("wheel",Wn)},this.dispose=()=>{var X,E,ue,Se,Re,Ct;n.domElement&&(n.domElement.style.touchAction="auto"),(X=n.domElement)==null||X.removeEventListener("contextmenu",mr),(E=n.domElement)==null||E.removeEventListener("pointerdown",Zn),(ue=n.domElement)==null||ue.removeEventListener("pointercancel",jn),(Se=n.domElement)==null||Se.removeEventListener("wheel",Wn),(Re=n.domElement)==null||Re.ownerDocument.removeEventListener("pointermove",In),(Ct=n.domElement)==null||Ct.ownerDocument.removeEventListener("pointerup",jn),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",sn)};const n=this,r={type:"change"},s={type:"start"},l={type:"end"},c={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let u=c.NONE;const d=1e-6,p=new m.Spherical,f=new m.Spherical;let y=1;const v=new m.Vector3,b=new m.Vector2,T=new m.Vector2,_=new m.Vector2,S=new m.Vector2,L=new m.Vector2,I=new m.Vector2,F=new m.Vector2,K=new m.Vector2,D=new m.Vector2,O=new m.Vector3,V=new m.Vector2;let R=!1;const P=[],k={};function N(){return 2*Math.PI/60/60*n.autoRotateSpeed}function H(){return Math.pow(.95,n.zoomSpeed)}function Q(X){n.reverseOrbit||n.reverseHorizontalOrbit?f.theta+=X:f.theta-=X}function q(X){n.reverseOrbit||n.reverseVerticalOrbit?f.phi+=X:f.phi-=X}const J=(()=>{const X=new m.Vector3;return function(ue,Se){X.setFromMatrixColumn(Se,0),X.multiplyScalar(-ue),v.add(X)}})(),oe=(()=>{const X=new m.Vector3;return function(ue,Se){n.screenSpacePanning===!0?X.setFromMatrixColumn(Se,1):(X.setFromMatrixColumn(Se,0),X.crossVectors(n.object.up,X)),X.multiplyScalar(ue),v.add(X)}})(),ie=(()=>{const X=new m.Vector3;return function(ue,Se){const Re=n.domElement;if(Re&&n.object instanceof m.PerspectiveCamera&&n.object.isPerspectiveCamera){const Ct=n.object.position;X.copy(Ct).sub(n.target);let Bt=X.length();Bt*=Math.tan(n.object.fov/2*Math.PI/180),J(2*ue*Bt/Re.clientHeight,n.object.matrix),oe(2*Se*Bt/Re.clientHeight,n.object.matrix)}else Re&&n.object instanceof m.OrthographicCamera&&n.object.isOrthographicCamera?(J(ue*(n.object.right-n.object.left)/n.object.zoom/Re.clientWidth,n.object.matrix),oe(Se*(n.object.top-n.object.bottom)/n.object.zoom/Re.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function te(X){n.object instanceof m.PerspectiveCamera&&n.object.isPerspectiveCamera||n.object instanceof m.OrthographicCamera&&n.object.isOrthographicCamera?y=X:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function me(X){te(y/X)}function xe(X){te(y*X)}function he(X){if(!n.zoomToCursor||!n.domElement)return;R=!0;const E=n.domElement.getBoundingClientRect(),ue=X.clientX-E.left,Se=X.clientY-E.top,Re=E.width,Ct=E.height;V.x=ue/Re*2-1,V.y=-(Se/Ct)*2+1,O.set(V.x,V.y,1).unproject(n.object).sub(n.object.position).normalize()}function ve(X){return Math.max(n.minDistance,Math.min(n.maxDistance,X))}function ke(X){b.set(X.clientX,X.clientY)}function Ye(X){he(X),F.set(X.clientX,X.clientY)}function je(X){S.set(X.clientX,X.clientY)}function Je(X){T.set(X.clientX,X.clientY),_.subVectors(T,b).multiplyScalar(n.rotateSpeed);const E=n.domElement;E&&(Q(2*Math.PI*_.x/E.clientHeight),q(2*Math.PI*_.y/E.clientHeight)),b.copy(T),n.update()}function Qe(X){K.set(X.clientX,X.clientY),D.subVectors(K,F),D.y>0?me(H()):D.y<0&&xe(H()),F.copy(K),n.update()}function ct(X){L.set(X.clientX,X.clientY),I.subVectors(L,S).multiplyScalar(n.panSpeed),ie(I.x,I.y),S.copy(L),n.update()}function pt(X){he(X),X.deltaY<0?xe(H()):X.deltaY>0&&me(H()),n.update()}function Ue(X){let E=!1;switch(X.code){case n.keys.UP:ie(0,n.keyPanSpeed),E=!0;break;case n.keys.BOTTOM:ie(0,-n.keyPanSpeed),E=!0;break;case n.keys.LEFT:ie(n.keyPanSpeed,0),E=!0;break;case n.keys.RIGHT:ie(-n.keyPanSpeed,0),E=!0;break}E&&(X.preventDefault(),n.update())}function hn(){if(P.length==1)b.set(P[0].pageX,P[0].pageY);else{const X=.5*(P[0].pageX+P[1].pageX),E=.5*(P[0].pageY+P[1].pageY);b.set(X,E)}}function Gn(){if(P.length==1)S.set(P[0].pageX,P[0].pageY);else{const X=.5*(P[0].pageX+P[1].pageX),E=.5*(P[0].pageY+P[1].pageY);S.set(X,E)}}function Ae(){const X=P[0].pageX-P[1].pageX,E=P[0].pageY-P[1].pageY,ue=Math.sqrt(X*X+E*E);F.set(0,ue)}function Ut(){n.enableZoom&&Ae(),n.enablePan&&Gn()}function Wt(){n.enableZoom&&Ae(),n.enableRotate&&hn()}function Pt(X){if(P.length==1)T.set(X.pageX,X.pageY);else{const ue=Qn(X),Se=.5*(X.pageX+ue.x),Re=.5*(X.pageY+ue.y);T.set(Se,Re)}_.subVectors(T,b).multiplyScalar(n.rotateSpeed);const E=n.domElement;E&&(Q(2*Math.PI*_.x/E.clientHeight),q(2*Math.PI*_.y/E.clientHeight)),b.copy(T)}function jr(X){if(P.length==1)L.set(X.pageX,X.pageY);else{const E=Qn(X),ue=.5*(X.pageX+E.x),Se=.5*(X.pageY+E.y);L.set(ue,Se)}I.subVectors(L,S).multiplyScalar(n.panSpeed),ie(I.x,I.y),S.copy(L)}function Vi(X){const E=Qn(X),ue=X.pageX-E.x,Se=X.pageY-E.y,Re=Math.sqrt(ue*ue+Se*Se);K.set(0,Re),D.set(0,Math.pow(K.y/F.y,n.zoomSpeed)),me(D.y),F.copy(K)}function Nn(X){n.enableZoom&&Vi(X),n.enablePan&&jr(X)}function bt(X){n.enableZoom&&Vi(X),n.enableRotate&&Pt(X)}function Zn(X){var E,ue;n.enabled!==!1&&(P.length===0&&((E=n.domElement)==null||E.ownerDocument.addEventListener("pointermove",In),(ue=n.domElement)==null||ue.ownerDocument.addEventListener("pointerup",jn)),Hr(X),X.pointerType==="touch"?Jr(X):Jn(X))}function In(X){n.enabled!==!1&&(X.pointerType==="touch"?Qr(X):yo(X))}function jn(X){var E,ue,Se;Er(X),P.length===0&&((E=n.domElement)==null||E.releasePointerCapture(X.pointerId),(ue=n.domElement)==null||ue.ownerDocument.removeEventListener("pointermove",In),(Se=n.domElement)==null||Se.ownerDocument.removeEventListener("pointerup",jn)),n.dispatchEvent(l),u=c.NONE}function Jn(X){let E;switch(X.button){case 0:E=n.mouseButtons.LEFT;break;case 1:E=n.mouseButtons.MIDDLE;break;case 2:E=n.mouseButtons.RIGHT;break;default:E=-1}switch(E){case m.MOUSE.DOLLY:if(n.enableZoom===!1)return;Ye(X),u=c.DOLLY;break;case m.MOUSE.ROTATE:if(X.ctrlKey||X.metaKey||X.shiftKey){if(n.enablePan===!1)return;je(X),u=c.PAN}else{if(n.enableRotate===!1)return;ke(X),u=c.ROTATE}break;case m.MOUSE.PAN:if(X.ctrlKey||X.metaKey||X.shiftKey){if(n.enableRotate===!1)return;ke(X),u=c.ROTATE}else{if(n.enablePan===!1)return;je(X),u=c.PAN}break;default:u=c.NONE}u!==c.NONE&&n.dispatchEvent(s)}function yo(X){if(n.enabled!==!1)switch(u){case c.ROTATE:if(n.enableRotate===!1)return;Je(X);break;case c.DOLLY:if(n.enableZoom===!1)return;Qe(X);break;case c.PAN:if(n.enablePan===!1)return;ct(X);break}}function Wn(X){n.enabled===!1||n.enableZoom===!1||u!==c.NONE&&u!==c.ROTATE||(X.preventDefault(),n.dispatchEvent(s),pt(X),n.dispatchEvent(l))}function sn(X){n.enabled===!1||n.enablePan===!1||Ue(X)}function Jr(X){switch(gr(X),P.length){case 1:switch(n.touches.ONE){case m.TOUCH.ROTATE:if(n.enableRotate===!1)return;hn(),u=c.TOUCH_ROTATE;break;case m.TOUCH.PAN:if(n.enablePan===!1)return;Gn(),u=c.TOUCH_PAN;break;default:u=c.NONE}break;case 2:switch(n.touches.TWO){case m.TOUCH.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Ut(),u=c.TOUCH_DOLLY_PAN;break;case m.TOUCH.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;Wt(),u=c.TOUCH_DOLLY_ROTATE;break;default:u=c.NONE}break;default:u=c.NONE}u!==c.NONE&&n.dispatchEvent(s)}function Qr(X){switch(gr(X),u){case c.TOUCH_ROTATE:if(n.enableRotate===!1)return;Pt(X),n.update();break;case c.TOUCH_PAN:if(n.enablePan===!1)return;jr(X),n.update();break;case c.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Nn(X),n.update();break;case c.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;bt(X),n.update();break;default:u=c.NONE}}function mr(X){n.enabled!==!1&&X.preventDefault()}function Hr(X){P.push(X)}function Er(X){delete k[X.pointerId];for(let E=0;E<P.length;E++)if(P[E].pointerId==X.pointerId){P.splice(E,1);return}}function gr(X){let E=k[X.pointerId];E===void 0&&(E=new m.Vector2,k[X.pointerId]=E),E.set(X.pageX,X.pageY)}function Qn(X){const E=X.pointerId===P[0].pointerId?P[1]:P[0];return k[E.pointerId]}this.dollyIn=(X=H())=>{xe(X),n.update()},this.dollyOut=(X=H())=>{me(X),n.update()},this.getScale=()=>y,this.setScale=X=>{te(X),n.update()},this.getZoomScale=()=>H(),e!==void 0&&this.connect(e),this.update()}}class rd extends nd{constructor(t,e){super(t,e),this.screenSpacePanning=!1,this.mouseButtons.LEFT=m.MOUSE.PAN,this.mouseButtons.RIGHT=m.MOUSE.ROTATE,this.touches.ONE=m.TOUCH.PAN,this.touches.TWO=m.TOUCH.DOLLY_ROTATE}}function lr(a){if(typeof TextDecoder<"u")return new TextDecoder().decode(a);let t="";for(let e=0,n=a.length;e<n;e++)t+=String.fromCharCode(a[e]);try{return decodeURIComponent(escape(t))}catch{return t}}const Kn="srgb",cn="srgb-linear",za=3001,id=3e3;class sd extends m.Loader{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new ud(e)}),this.register(function(e){return new hd(e)}),this.register(function(e){return new bd(e)}),this.register(function(e){return new xd(e)}),this.register(function(e){return new _d(e)}),this.register(function(e){return new fd(e)}),this.register(function(e){return new pd(e)}),this.register(function(e){return new md(e)}),this.register(function(e){return new gd(e)}),this.register(function(e){return new cd(e)}),this.register(function(e){return new yd(e)}),this.register(function(e){return new dd(e)}),this.register(function(e){return new wd(e)}),this.register(function(e){return new vd(e)}),this.register(function(e){return new ad(e)}),this.register(function(e){return new Md(e)}),this.register(function(e){return new Ld(e)})}load(t,e,n,r){const s=this;let l;if(this.resourcePath!=="")l=this.resourcePath;else if(this.path!==""){const d=m.LoaderUtils.extractUrlBase(t);l=m.LoaderUtils.resolveURL(d,this.path)}else l=m.LoaderUtils.extractUrlBase(t);this.manager.itemStart(t);const c=function(d){r?r(d):console.error(d),s.manager.itemError(t),s.manager.itemEnd(t)},u=new m.FileLoader(this.manager);u.setPath(this.path),u.setResponseType("arraybuffer"),u.setRequestHeader(this.requestHeader),u.setWithCredentials(this.withCredentials),u.load(t,function(d){try{s.parse(d,l,function(p){e(p),s.manager.itemEnd(t)},c)}catch(p){c(p)}},n,c)}setDRACOLoader(t){return this.dracoLoader=t,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return this.pluginCallbacks.indexOf(t)===-1&&this.pluginCallbacks.push(t),this}unregister(t){return this.pluginCallbacks.indexOf(t)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,e,n,r){let s;const l={},c={};if(typeof t=="string")s=JSON.parse(t);else if(t instanceof ArrayBuffer)if(lr(new Uint8Array(t.slice(0,4)))===Oa){try{l[we.KHR_BINARY_GLTF]=new Sd(t)}catch(p){r&&r(p);return}s=JSON.parse(l[we.KHR_BINARY_GLTF].content)}else s=JSON.parse(lr(new Uint8Array(t)));else s=t;if(s.asset===void 0||s.asset.version[0]<2){r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const u=new Dd(s,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(let d=0;d<this.pluginCallbacks.length;d++){const p=this.pluginCallbacks[d](u);p.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),c[p.name]=p,l[p.name]=!0}if(s.extensionsUsed)for(let d=0;d<s.extensionsUsed.length;++d){const p=s.extensionsUsed[d],f=s.extensionsRequired||[];switch(p){case we.KHR_MATERIALS_UNLIT:l[p]=new ld;break;case we.KHR_DRACO_MESH_COMPRESSION:l[p]=new Td(s,this.dracoLoader);break;case we.KHR_TEXTURE_TRANSFORM:l[p]=new Gd;break;case we.KHR_MESH_QUANTIZATION:l[p]=new Zd;break;default:f.indexOf(p)>=0&&c[p]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+p+'".')}}u.setExtensions(l),u.setPlugins(c),u.parse(n,r)}parseAsync(t,e){const n=this;return new Promise(function(r,s){n.parse(t,e,r,s)})}}function od(){let a={};return{get:function(t){return a[t]},add:function(t,e){a[t]=e},remove:function(t){delete a[t]},removeAll:function(){a={}}}}const we={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class ad{constructor(t){this.parser=t,this.name=we.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let n=0,r=e.length;n<r;n++){const s=e[n];s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0&&t._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(t){const e=this.parser,n="light:"+t;let r=e.cache.get(n);if(r)return r;const s=e.json,u=((s.extensions&&s.extensions[this.name]||{}).lights||[])[t];let d;const p=new m.Color(16777215);u.color!==void 0&&p.setRGB(u.color[0],u.color[1],u.color[2],cn);const f=u.range!==void 0?u.range:0;switch(u.type){case"directional":d=new m.DirectionalLight(p),d.target.position.set(0,0,-1),d.add(d.target);break;case"point":d=new m.PointLight(p),d.distance=f;break;case"spot":d=new m.SpotLight(p),d.distance=f,u.spot=u.spot||{},u.spot.innerConeAngle=u.spot.innerConeAngle!==void 0?u.spot.innerConeAngle:0,u.spot.outerConeAngle=u.spot.outerConeAngle!==void 0?u.spot.outerConeAngle:Math.PI/4,d.angle=u.spot.outerConeAngle,d.penumbra=1-u.spot.innerConeAngle/u.spot.outerConeAngle,d.target.position.set(0,0,-1),d.add(d.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+u.type)}return d.position.set(0,0,0),d.decay=2,un(d,u),u.intensity!==void 0&&(d.intensity=u.intensity),d.name=e.createUniqueName(u.name||"light_"+t),r=Promise.resolve(d),e.cache.add(n,r),r}getDependency(t,e){if(t==="light")return this._loadLight(e)}createNodeAttachment(t){const e=this,n=this.parser,s=n.json.nodes[t],c=(s.extensions&&s.extensions[this.name]||{}).light;return c===void 0?null:this._loadLight(c).then(function(u){return n._getNodeRef(e.cache,c,u)})}}class ld{constructor(){this.name=we.KHR_MATERIALS_UNLIT}getMaterialType(){return m.MeshBasicMaterial}extendParams(t,e,n){const r=[];t.color=new m.Color(1,1,1),t.opacity=1;const s=e.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){const l=s.baseColorFactor;t.color.setRGB(l[0],l[1],l[2],cn),t.opacity=l[3]}s.baseColorTexture!==void 0&&r.push(n.assignTexture(t,"map",s.baseColorTexture,Kn))}return Promise.all(r)}}class cd{constructor(t){this.parser=t,this.name=we.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(t,e){const r=this.parser.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name].emissiveStrength;return s!==void 0&&(e.emissiveIntensity=s),Promise.resolve()}}class ud{constructor(t){this.parser=t,this.name=we.KHR_MATERIALS_CLEARCOAT}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:m.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],l=r.extensions[this.name];if(l.clearcoatFactor!==void 0&&(e.clearcoat=l.clearcoatFactor),l.clearcoatTexture!==void 0&&s.push(n.assignTexture(e,"clearcoatMap",l.clearcoatTexture)),l.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=l.clearcoatRoughnessFactor),l.clearcoatRoughnessTexture!==void 0&&s.push(n.assignTexture(e,"clearcoatRoughnessMap",l.clearcoatRoughnessTexture)),l.clearcoatNormalTexture!==void 0&&(s.push(n.assignTexture(e,"clearcoatNormalMap",l.clearcoatNormalTexture)),l.clearcoatNormalTexture.scale!==void 0)){const c=l.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new m.Vector2(c,c)}return Promise.all(s)}}class hd{constructor(t){this.parser=t,this.name=we.KHR_MATERIALS_DISPERSION}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:m.MeshPhysicalMaterial}extendMaterialParams(t,e){const r=this.parser.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name];return e.dispersion=s.dispersion!==void 0?s.dispersion:0,Promise.resolve()}}class dd{constructor(t){this.parser=t,this.name=we.KHR_MATERIALS_IRIDESCENCE}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:m.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],l=r.extensions[this.name];return l.iridescenceFactor!==void 0&&(e.iridescence=l.iridescenceFactor),l.iridescenceTexture!==void 0&&s.push(n.assignTexture(e,"iridescenceMap",l.iridescenceTexture)),l.iridescenceIor!==void 0&&(e.iridescenceIOR=l.iridescenceIor),e.iridescenceThicknessRange===void 0&&(e.iridescenceThicknessRange=[100,400]),l.iridescenceThicknessMinimum!==void 0&&(e.iridescenceThicknessRange[0]=l.iridescenceThicknessMinimum),l.iridescenceThicknessMaximum!==void 0&&(e.iridescenceThicknessRange[1]=l.iridescenceThicknessMaximum),l.iridescenceThicknessTexture!==void 0&&s.push(n.assignTexture(e,"iridescenceThicknessMap",l.iridescenceThicknessTexture)),Promise.all(s)}}class fd{constructor(t){this.parser=t,this.name=we.KHR_MATERIALS_SHEEN}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:m.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[];e.sheenColor=new m.Color(0,0,0),e.sheenRoughness=0,e.sheen=1;const l=r.extensions[this.name];if(l.sheenColorFactor!==void 0){const c=l.sheenColorFactor;e.sheenColor.setRGB(c[0],c[1],c[2],cn)}return l.sheenRoughnessFactor!==void 0&&(e.sheenRoughness=l.sheenRoughnessFactor),l.sheenColorTexture!==void 0&&s.push(n.assignTexture(e,"sheenColorMap",l.sheenColorTexture,Kn)),l.sheenRoughnessTexture!==void 0&&s.push(n.assignTexture(e,"sheenRoughnessMap",l.sheenRoughnessTexture)),Promise.all(s)}}class pd{constructor(t){this.parser=t,this.name=we.KHR_MATERIALS_TRANSMISSION}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:m.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],l=r.extensions[this.name];return l.transmissionFactor!==void 0&&(e.transmission=l.transmissionFactor),l.transmissionTexture!==void 0&&s.push(n.assignTexture(e,"transmissionMap",l.transmissionTexture)),Promise.all(s)}}class md{constructor(t){this.parser=t,this.name=we.KHR_MATERIALS_VOLUME}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:m.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],l=r.extensions[this.name];e.thickness=l.thicknessFactor!==void 0?l.thicknessFactor:0,l.thicknessTexture!==void 0&&s.push(n.assignTexture(e,"thicknessMap",l.thicknessTexture)),e.attenuationDistance=l.attenuationDistance||1/0;const c=l.attenuationColor||[1,1,1];return e.attenuationColor=new m.Color().setRGB(c[0],c[1],c[2],cn),Promise.all(s)}}class gd{constructor(t){this.parser=t,this.name=we.KHR_MATERIALS_IOR}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:m.MeshPhysicalMaterial}extendMaterialParams(t,e){const r=this.parser.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name];return e.ior=s.ior!==void 0?s.ior:1.5,Promise.resolve()}}class yd{constructor(t){this.parser=t,this.name=we.KHR_MATERIALS_SPECULAR}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:m.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],l=r.extensions[this.name];e.specularIntensity=l.specularFactor!==void 0?l.specularFactor:1,l.specularTexture!==void 0&&s.push(n.assignTexture(e,"specularIntensityMap",l.specularTexture));const c=l.specularColorFactor||[1,1,1];return e.specularColor=new m.Color().setRGB(c[0],c[1],c[2],cn),l.specularColorTexture!==void 0&&s.push(n.assignTexture(e,"specularColorMap",l.specularColorTexture,Kn)),Promise.all(s)}}class vd{constructor(t){this.parser=t,this.name=we.EXT_MATERIALS_BUMP}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:m.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],l=r.extensions[this.name];return e.bumpScale=l.bumpFactor!==void 0?l.bumpFactor:1,l.bumpTexture!==void 0&&s.push(n.assignTexture(e,"bumpMap",l.bumpTexture)),Promise.all(s)}}class wd{constructor(t){this.parser=t,this.name=we.KHR_MATERIALS_ANISOTROPY}getMaterialType(t){const n=this.parser.json.materials[t];return!n.extensions||!n.extensions[this.name]?null:m.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],l=r.extensions[this.name];return l.anisotropyStrength!==void 0&&(e.anisotropy=l.anisotropyStrength),l.anisotropyRotation!==void 0&&(e.anisotropyRotation=l.anisotropyRotation),l.anisotropyTexture!==void 0&&s.push(n.assignTexture(e,"anisotropyMap",l.anisotropyTexture)),Promise.all(s)}}class bd{constructor(t){this.parser=t,this.name=we.KHR_TEXTURE_BASISU}loadTexture(t){const e=this.parser,n=e.json,r=n.textures[t];if(!r.extensions||!r.extensions[this.name])return null;const s=r.extensions[this.name],l=e.options.ktx2Loader;if(!l){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,s.source,l)}}class xd{constructor(t){this.parser=t,this.name=we.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(t){const e=this.name,n=this.parser,r=n.json,s=r.textures[t];if(!s.extensions||!s.extensions[e])return null;const l=s.extensions[e],c=r.images[l.source];let u=n.textureLoader;if(c.uri){const d=n.options.manager.getHandler(c.uri);d!==null&&(u=d)}return this.detectSupport().then(function(d){if(d)return n.loadTextureImage(t,l.source,u);if(r.extensionsRequired&&r.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(e.height===1)}})),this.isSupported}}class _d{constructor(t){this.parser=t,this.name=we.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(t){const e=this.name,n=this.parser,r=n.json,s=r.textures[t];if(!s.extensions||!s.extensions[e])return null;const l=s.extensions[e],c=r.images[l.source];let u=n.textureLoader;if(c.uri){const d=n.options.manager.getHandler(c.uri);d!==null&&(u=d)}return this.detectSupport().then(function(d){if(d)return n.loadTextureImage(t,l.source,u);if(r.extensionsRequired&&r.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const e=new Image;e.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",e.onload=e.onerror=function(){t(e.height===1)}})),this.isSupported}}class Md{constructor(t){this.name=we.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(t){const e=this.parser.json,n=e.bufferViews[t];if(n.extensions&&n.extensions[this.name]){const r=n.extensions[this.name],s=this.parser.getDependency("buffer",r.buffer),l=this.parser.options.meshoptDecoder;if(!l||!l.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(c){const u=r.byteOffset||0,d=r.byteLength||0,p=r.count,f=r.byteStride,y=new Uint8Array(c,u,d);return l.decodeGltfBufferAsync?l.decodeGltfBufferAsync(p,f,y,r.mode,r.filter).then(function(v){return v.buffer}):l.ready.then(function(){const v=new ArrayBuffer(p*f);return l.decodeGltfBuffer(new Uint8Array(v),p,f,y,r.mode,r.filter),v})})}else return null}}class Ld{constructor(t){this.name=we.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(t){const e=this.parser.json,n=e.nodes[t];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const r=e.meshes[n.mesh];for(const d of r.primitives)if(d.mode!==Zt.TRIANGLES&&d.mode!==Zt.TRIANGLE_STRIP&&d.mode!==Zt.TRIANGLE_FAN&&d.mode!==void 0)return null;const l=n.extensions[this.name].attributes,c=[],u={};for(const d in l)c.push(this.parser.getDependency("accessor",l[d]).then(p=>(u[d]=p,u[d])));return c.length<1?null:(c.push(this.parser.createNodeMesh(t)),Promise.all(c).then(d=>{const p=d.pop(),f=p.isGroup?p.children:[p],y=d[0].count,v=[];for(const b of f){const T=new m.Matrix4,_=new m.Vector3,S=new m.Quaternion,L=new m.Vector3(1,1,1),I=new m.InstancedMesh(b.geometry,b.material,y);for(let F=0;F<y;F++)u.TRANSLATION&&_.fromBufferAttribute(u.TRANSLATION,F),u.ROTATION&&S.fromBufferAttribute(u.ROTATION,F),u.SCALE&&L.fromBufferAttribute(u.SCALE,F),I.setMatrixAt(F,T.compose(_,S,L));for(const F in u)if(F==="_COLOR_0"){const K=u[F];I.instanceColor=new m.InstancedBufferAttribute(K.array,K.itemSize,K.normalized)}else F!=="TRANSLATION"&&F!=="ROTATION"&&F!=="SCALE"&&b.geometry.setAttribute(F,u[F]);m.Object3D.prototype.copy.call(I,b),this.parser.assignFinalMaterial(I),v.push(I)}return p.isGroup?(p.clear(),p.add(...v),p):v[0]}))}}const Oa="glTF",Fr=12,Ka={JSON:1313821514,BIN:5130562};class Sd{constructor(t){this.name=we.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(t,0,Fr);if(this.header={magic:lr(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==Oa)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-Fr,r=new DataView(t,Fr);let s=0;for(;s<n;){const l=r.getUint32(s,!0);s+=4;const c=r.getUint32(s,!0);if(s+=4,c===Ka.JSON){const u=new Uint8Array(t,Fr+s,l);this.content=lr(u)}else if(c===Ka.BIN){const u=Fr+s;this.body=t.slice(u,u+l)}s+=l}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Td{constructor(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=we.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(t,e){const n=this.json,r=this.dracoLoader,s=t.extensions[this.name].bufferView,l=t.extensions[this.name].attributes,c={},u={},d={};for(const p in l){const f=Ws[p]||p.toLowerCase();c[f]=l[p]}for(const p in t.attributes){const f=Ws[p]||p.toLowerCase();if(l[p]!==void 0){const y=n.accessors[t.attributes[p]],v=cr[y.componentType];d[f]=v.name,u[f]=y.normalized===!0}}return e.getDependency("bufferView",s).then(function(p){return new Promise(function(f,y){r.decodeDracoFile(p,function(v){for(const b in v.attributes){const T=v.attributes[b],_=u[b];_!==void 0&&(T.normalized=_)}f(v)},c,d,cn,y)})})}}class Gd{constructor(){this.name=we.KHR_TEXTURE_TRANSFORM}extendTexture(t,e){return(e.texCoord===void 0||e.texCoord===t.channel)&&e.offset===void 0&&e.rotation===void 0&&e.scale===void 0||(t=t.clone(),e.texCoord!==void 0&&(t.channel=e.texCoord),e.offset!==void 0&&t.offset.fromArray(e.offset),e.rotation!==void 0&&(t.rotation=e.rotation),e.scale!==void 0&&t.repeat.fromArray(e.scale),t.needsUpdate=!0),t}}class Zd{constructor(){this.name=we.KHR_MESH_QUANTIZATION}}class Ra extends m.Interpolant{constructor(t,e,n,r){super(t,e,n,r)}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,r=this.valueSize,s=t*r*3+r;for(let l=0;l!==r;l++)e[l]=n[s+l];return e}interpolate_(t,e,n,r){const s=this.resultBuffer,l=this.sampleValues,c=this.valueSize,u=c*2,d=c*3,p=r-e,f=(n-e)/p,y=f*f,v=y*f,b=t*d,T=b-d,_=-2*v+3*y,S=v-y,L=1-_,I=S-y+f;for(let F=0;F!==c;F++){const K=l[T+F+c],D=l[T+F+u]*p,O=l[b+F+c],V=l[b+F]*p;s[F]=L*K+I*D+_*O+S*V}return s}}const Id=new m.Quaternion;class Wd extends Ra{interpolate_(t,e,n,r){const s=super.interpolate_(t,e,n,r);return Id.fromArray(s).normalize().toArray(s),s}}const Zt={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},cr={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Ya={9728:m.NearestFilter,9729:m.LinearFilter,9984:m.NearestMipmapNearestFilter,9985:m.LinearMipmapNearestFilter,9986:m.NearestMipmapLinearFilter,9987:m.LinearMipmapLinearFilter},Ua={33071:m.ClampToEdgeWrapping,33648:m.MirroredRepeatWrapping,10497:m.RepeatWrapping},Is={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Ws={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",...fi>=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"},COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Mn={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Pd={CUBICSPLINE:void 0,LINEAR:m.InterpolateLinear,STEP:m.InterpolateDiscrete},Ps={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Cd(a){return a.DefaultMaterial===void 0&&(a.DefaultMaterial=new m.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:m.FrontSide})),a.DefaultMaterial}function Rn(a,t,e){for(const n in e.extensions)a[n]===void 0&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[n]=e.extensions[n])}function un(a,t){t.extras!==void 0&&(typeof t.extras=="object"?Object.assign(a.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Vd(a,t,e){let n=!1,r=!1,s=!1;for(let d=0,p=t.length;d<p;d++){const f=t[d];if(f.POSITION!==void 0&&(n=!0),f.NORMAL!==void 0&&(r=!0),f.COLOR_0!==void 0&&(s=!0),n&&r&&s)break}if(!n&&!r&&!s)return Promise.resolve(a);const l=[],c=[],u=[];for(let d=0,p=t.length;d<p;d++){const f=t[d];if(n){const y=f.POSITION!==void 0?e.getDependency("accessor",f.POSITION):a.attributes.position;l.push(y)}if(r){const y=f.NORMAL!==void 0?e.getDependency("accessor",f.NORMAL):a.attributes.normal;c.push(y)}if(s){const y=f.COLOR_0!==void 0?e.getDependency("accessor",f.COLOR_0):a.attributes.color;u.push(y)}}return Promise.all([Promise.all(l),Promise.all(c),Promise.all(u)]).then(function(d){const p=d[0],f=d[1],y=d[2];return n&&(a.morphAttributes.position=p),r&&(a.morphAttributes.normal=f),s&&(a.morphAttributes.color=y),a.morphTargetsRelative=!0,a})}function Ad(a,t){if(a.updateMorphTargets(),t.weights!==void 0)for(let e=0,n=t.weights.length;e<n;e++)a.morphTargetInfluences[e]=t.weights[e];if(t.extras&&Array.isArray(t.extras.targetNames)){const e=t.extras.targetNames;if(a.morphTargetInfluences.length===e.length){a.morphTargetDictionary={};for(let n=0,r=e.length;n<r;n++)a.morphTargetDictionary[e[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Fd(a){let t;const e=a.extensions&&a.extensions[we.KHR_DRACO_MESH_COMPRESSION];if(e?t="draco:"+e.bufferView+":"+e.indices+":"+Cs(e.attributes):t=a.indices+":"+Cs(a.attributes)+":"+a.mode,a.targets!==void 0)for(let n=0,r=a.targets.length;n<r;n++)t+=":"+Cs(a.targets[n]);return t}function Cs(a){let t="";const e=Object.keys(a).sort();for(let n=0,r=e.length;n<r;n++)t+=e[n]+":"+a[e[n]]+";";return t}function Vs(a){switch(a){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Xd(a){return a.search(/\.jpe?g($|\?)/i)>0||a.search(/^data\:image\/jpeg/)===0?"image/jpeg":a.search(/\.webp($|\?)/i)>0||a.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const kd=new m.Matrix4;class Dd{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new od,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,r=!1,s=-1;typeof navigator<"u"&&typeof navigator.userAgent<"u"&&(n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,r=navigator.userAgent.indexOf("Firefox")>-1,s=r?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||n||r&&s<98?this.textureLoader=new m.TextureLoader(this.options.manager):this.textureLoader=new m.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new m.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const n=this,r=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(l){return l._markDefs&&l._markDefs()}),Promise.all(this._invokeAll(function(l){return l.beforeRoot&&l.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(l){const c={scene:l[0][r.scene||0],scenes:l[0],animations:l[1],cameras:l[2],asset:r.asset,parser:n,userData:{}};return Rn(s,c,r),un(c,r),Promise.all(n._invokeAll(function(u){return u.afterRoot&&u.afterRoot(c)})).then(function(){for(const u of c.scenes)u.updateMatrixWorld();t(c)})}).catch(e)}_markDefs(){const t=this.json.nodes||[],e=this.json.skins||[],n=this.json.meshes||[];for(let r=0,s=e.length;r<s;r++){const l=e[r].joints;for(let c=0,u=l.length;c<u;c++)t[l[c]].isBone=!0}for(let r=0,s=t.length;r<s;r++){const l=t[r];l.mesh!==void 0&&(this._addNodeRef(this.meshCache,l.mesh),l.skin!==void 0&&(n[l.mesh].isSkinnedMesh=!0)),l.camera!==void 0&&this._addNodeRef(this.cameraCache,l.camera)}}_addNodeRef(t,e){e!==void 0&&(t.refs[e]===void 0&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}_getNodeRef(t,e,n){if(t.refs[e]<=1)return n;const r=n.clone(),s=(l,c)=>{const u=this.associations.get(l);u!=null&&this.associations.set(c,u);for(const[d,p]of l.children.entries())s(p,c.children[d])};return s(n,r),r.name+="_instance_"+t.uses[e]++,r}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let n=0;n<e.length;n++){const r=t(e[n]);if(r)return r}return null}_invokeAll(t){const e=Object.values(this.plugins);e.unshift(this);const n=[];for(let r=0;r<e.length;r++){const s=t(e[r]);s&&n.push(s)}return n}getDependency(t,e){const n=t+":"+e;let r=this.cache.get(n);if(!r){switch(t){case"scene":r=this.loadScene(e);break;case"node":r=this._invokeOne(function(s){return s.loadNode&&s.loadNode(e)});break;case"mesh":r=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(e)});break;case"accessor":r=this.loadAccessor(e);break;case"bufferView":r=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(e)});break;case"buffer":r=this.loadBuffer(e);break;case"material":r=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(e)});break;case"texture":r=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(e)});break;case"skin":r=this.loadSkin(e);break;case"animation":r=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(e)});break;case"camera":r=this.loadCamera(e);break;default:if(r=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(t,e)}),!r)throw new Error("Unknown type: "+t);break}this.cache.add(n,r)}return r}getDependencies(t){let e=this.cache.get(t);if(!e){const n=this,r=this.json[t+(t==="mesh"?"es":"s")]||[];e=Promise.all(r.map(function(s,l){return n.getDependency(t,l)})),this.cache.add(t,e)}return e}loadBuffer(t){const e=this.json.buffers[t],n=this.fileLoader;if(e.type&&e.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(e.uri===void 0&&t===0)return Promise.resolve(this.extensions[we.KHR_BINARY_GLTF].body);const r=this.options;return new Promise(function(s,l){n.load(m.LoaderUtils.resolveURL(e.uri,r.path),s,void 0,function(){l(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))})})}loadBufferView(t){const e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then(function(n){const r=e.byteLength||0,s=e.byteOffset||0;return n.slice(s,s+r)})}loadAccessor(t){const e=this,n=this.json,r=this.json.accessors[t];if(r.bufferView===void 0&&r.sparse===void 0){const l=Is[r.type],c=cr[r.componentType],u=r.normalized===!0,d=new c(r.count*l);return Promise.resolve(new m.BufferAttribute(d,l,u))}const s=[];return r.bufferView!==void 0?s.push(this.getDependency("bufferView",r.bufferView)):s.push(null),r.sparse!==void 0&&(s.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(s).then(function(l){const c=l[0],u=Is[r.type],d=cr[r.componentType],p=d.BYTES_PER_ELEMENT,f=p*u,y=r.byteOffset||0,v=r.bufferView!==void 0?n.bufferViews[r.bufferView].byteStride:void 0,b=r.normalized===!0;let T,_;if(v&&v!==f){const S=Math.floor(y/v),L="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+S+":"+r.count;let I=e.cache.get(L);I||(T=new d(c,S*v,r.count*v/p),I=new m.InterleavedBuffer(T,v/p),e.cache.add(L,I)),_=new m.InterleavedBufferAttribute(I,u,y%v/p,b)}else c===null?T=new d(r.count*u):T=new d(c,y,r.count*u),_=new m.BufferAttribute(T,u,b);if(r.sparse!==void 0){const S=Is.SCALAR,L=cr[r.sparse.indices.componentType],I=r.sparse.indices.byteOffset||0,F=r.sparse.values.byteOffset||0,K=new L(l[1],I,r.sparse.count*S),D=new d(l[2],F,r.sparse.count*u);c!==null&&(_=new m.BufferAttribute(_.array.slice(),_.itemSize,_.normalized));for(let O=0,V=K.length;O<V;O++){const R=K[O];if(_.setX(R,D[O*u]),u>=2&&_.setY(R,D[O*u+1]),u>=3&&_.setZ(R,D[O*u+2]),u>=4&&_.setW(R,D[O*u+3]),u>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return _})}loadTexture(t){const e=this.json,n=this.options,s=e.textures[t].source,l=e.images[s];let c=this.textureLoader;if(l.uri){const u=n.manager.getHandler(l.uri);u!==null&&(c=u)}return this.loadTextureImage(t,s,c)}loadTextureImage(t,e,n){const r=this,s=this.json,l=s.textures[t],c=s.images[e],u=(c.uri||c.bufferView)+":"+l.sampler;if(this.textureCache[u])return this.textureCache[u];const d=this.loadImageSource(e,n).then(function(p){p.flipY=!1,p.name=l.name||c.name||"",p.name===""&&typeof c.uri=="string"&&c.uri.startsWith("data:image/")===!1&&(p.name=c.uri);const y=(s.samplers||{})[l.sampler]||{};return p.magFilter=Ya[y.magFilter]||m.LinearFilter,p.minFilter=Ya[y.minFilter]||m.LinearMipmapLinearFilter,p.wrapS=Ua[y.wrapS]||m.RepeatWrapping,p.wrapT=Ua[y.wrapT]||m.RepeatWrapping,r.associations.set(p,{textures:t}),p}).catch(function(){return null});return this.textureCache[u]=d,d}loadImageSource(t,e){const n=this,r=this.json,s=this.options;if(this.sourceCache[t]!==void 0)return this.sourceCache[t].then(f=>f.clone());const l=r.images[t],c=self.URL||self.webkitURL;let u=l.uri||"",d=!1;if(l.bufferView!==void 0)u=n.getDependency("bufferView",l.bufferView).then(function(f){d=!0;const y=new Blob([f],{type:l.mimeType});return u=c.createObjectURL(y),u});else if(l.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const p=Promise.resolve(u).then(function(f){return new Promise(function(y,v){let b=y;e.isImageBitmapLoader===!0&&(b=function(T){const _=new m.Texture(T);_.needsUpdate=!0,y(_)}),e.load(m.LoaderUtils.resolveURL(f,s.path),b,void 0,v)})}).then(function(f){return d===!0&&c.revokeObjectURL(u),un(f,l),f.userData.mimeType=l.mimeType||Xd(l.uri),f}).catch(function(f){throw console.error("THREE.GLTFLoader: Couldn't load texture",u),f});return this.sourceCache[t]=p,p}assignTexture(t,e,n,r){const s=this;return this.getDependency("texture",n.index).then(function(l){if(!l)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(l=l.clone(),l.channel=n.texCoord),s.extensions[we.KHR_TEXTURE_TRANSFORM]){const c=n.extensions!==void 0?n.extensions[we.KHR_TEXTURE_TRANSFORM]:void 0;if(c){const u=s.associations.get(l);l=s.extensions[we.KHR_TEXTURE_TRANSFORM].extendTexture(l,c),s.associations.set(l,u)}}return r!==void 0&&(typeof r=="number"&&(r=r===za?Kn:cn),"colorSpace"in l?l.colorSpace=r:l.encoding=r===Kn?za:id),t[e]=l,l})}assignFinalMaterial(t){const e=t.geometry;let n=t.material;const r=e.attributes.tangent===void 0,s=e.attributes.color!==void 0,l=e.attributes.normal===void 0;if(t.isPoints){const c="PointsMaterial:"+n.uuid;let u=this.cache.get(c);u||(u=new m.PointsMaterial,m.Material.prototype.copy.call(u,n),u.color.copy(n.color),u.map=n.map,u.sizeAttenuation=!1,this.cache.add(c,u)),n=u}else if(t.isLine){const c="LineBasicMaterial:"+n.uuid;let u=this.cache.get(c);u||(u=new m.LineBasicMaterial,m.Material.prototype.copy.call(u,n),u.color.copy(n.color),u.map=n.map,this.cache.add(c,u)),n=u}if(r||s||l){let c="ClonedMaterial:"+n.uuid+":";r&&(c+="derivative-tangents:"),s&&(c+="vertex-colors:"),l&&(c+="flat-shading:");let u=this.cache.get(c);u||(u=n.clone(),s&&(u.vertexColors=!0),l&&(u.flatShading=!0),r&&(u.normalScale&&(u.normalScale.y*=-1),u.clearcoatNormalScale&&(u.clearcoatNormalScale.y*=-1)),this.cache.add(c,u),this.associations.set(u,this.associations.get(n))),n=u}t.material=n}getMaterialType(){return m.MeshStandardMaterial}loadMaterial(t){const e=this,n=this.json,r=this.extensions,s=n.materials[t];let l;const c={},u=s.extensions||{},d=[];if(u[we.KHR_MATERIALS_UNLIT]){const f=r[we.KHR_MATERIALS_UNLIT];l=f.getMaterialType(),d.push(f.extendParams(c,s,e))}else{const f=s.pbrMetallicRoughness||{};if(c.color=new m.Color(1,1,1),c.opacity=1,Array.isArray(f.baseColorFactor)){const y=f.baseColorFactor;c.color.setRGB(y[0],y[1],y[2],cn),c.opacity=y[3]}f.baseColorTexture!==void 0&&d.push(e.assignTexture(c,"map",f.baseColorTexture,Kn)),c.metalness=f.metallicFactor!==void 0?f.metallicFactor:1,c.roughness=f.roughnessFactor!==void 0?f.roughnessFactor:1,f.metallicRoughnessTexture!==void 0&&(d.push(e.assignTexture(c,"metalnessMap",f.metallicRoughnessTexture)),d.push(e.assignTexture(c,"roughnessMap",f.metallicRoughnessTexture))),l=this._invokeOne(function(y){return y.getMaterialType&&y.getMaterialType(t)}),d.push(Promise.all(this._invokeAll(function(y){return y.extendMaterialParams&&y.extendMaterialParams(t,c)})))}s.doubleSided===!0&&(c.side=m.DoubleSide);const p=s.alphaMode||Ps.OPAQUE;if(p===Ps.BLEND?(c.transparent=!0,c.depthWrite=!1):(c.transparent=!1,p===Ps.MASK&&(c.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&l!==m.MeshBasicMaterial&&(d.push(e.assignTexture(c,"normalMap",s.normalTexture)),c.normalScale=new m.Vector2(1,1),s.normalTexture.scale!==void 0)){const f=s.normalTexture.scale;c.normalScale.set(f,f)}if(s.occlusionTexture!==void 0&&l!==m.MeshBasicMaterial&&(d.push(e.assignTexture(c,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(c.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&l!==m.MeshBasicMaterial){const f=s.emissiveFactor;c.emissive=new m.Color().setRGB(f[0],f[1],f[2],cn)}return s.emissiveTexture!==void 0&&l!==m.MeshBasicMaterial&&d.push(e.assignTexture(c,"emissiveMap",s.emissiveTexture,Kn)),Promise.all(d).then(function(){const f=new l(c);return s.name&&(f.name=s.name),un(f,s),e.associations.set(f,{materials:t}),s.extensions&&Rn(r,f,s),f})}createUniqueName(t){const e=m.PropertyBinding.sanitizeNodeName(t||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(t){const e=this,n=this.extensions,r=this.primitiveCache;function s(c){return n[we.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(c,e).then(function(u){return Ba(u,c,e)})}const l=[];for(let c=0,u=t.length;c<u;c++){const d=t[c],p=Fd(d),f=r[p];if(f)l.push(f.promise);else{let y;d.extensions&&d.extensions[we.KHR_DRACO_MESH_COMPRESSION]?y=s(d):y=Ba(new m.BufferGeometry,d,e),r[p]={primitive:d,promise:y},l.push(y)}}return Promise.all(l)}loadMesh(t){const e=this,n=this.json,r=this.extensions,s=n.meshes[t],l=s.primitives,c=[];for(let u=0,d=l.length;u<d;u++){const p=l[u].material===void 0?Cd(this.cache):this.getDependency("material",l[u].material);c.push(p)}return c.push(e.loadGeometries(l)),Promise.all(c).then(function(u){const d=u.slice(0,u.length-1),p=u[u.length-1],f=[];for(let v=0,b=p.length;v<b;v++){const T=p[v],_=l[v];let S;const L=d[v];if(_.mode===Zt.TRIANGLES||_.mode===Zt.TRIANGLE_STRIP||_.mode===Zt.TRIANGLE_FAN||_.mode===void 0)S=s.isSkinnedMesh===!0?new m.SkinnedMesh(T,L):new m.Mesh(T,L),S.isSkinnedMesh===!0&&S.normalizeSkinWeights(),_.mode===Zt.TRIANGLE_STRIP?S.geometry=Wa(S.geometry,m.TriangleStripDrawMode):_.mode===Zt.TRIANGLE_FAN&&(S.geometry=Wa(S.geometry,m.TriangleFanDrawMode));else if(_.mode===Zt.LINES)S=new m.LineSegments(T,L);else if(_.mode===Zt.LINE_STRIP)S=new m.Line(T,L);else if(_.mode===Zt.LINE_LOOP)S=new m.LineLoop(T,L);else if(_.mode===Zt.POINTS)S=new m.Points(T,L);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+_.mode);Object.keys(S.geometry.morphAttributes).length>0&&Ad(S,s),S.name=e.createUniqueName(s.name||"mesh_"+t),un(S,s),_.extensions&&Rn(r,S,_),e.assignFinalMaterial(S),f.push(S)}for(let v=0,b=f.length;v<b;v++)e.associations.set(f[v],{meshes:t,primitives:v});if(f.length===1)return s.extensions&&Rn(r,f[0],s),f[0];const y=new m.Group;s.extensions&&Rn(r,y,s),e.associations.set(y,{meshes:t});for(let v=0,b=f.length;v<b;v++)y.add(f[v]);return y})}loadCamera(t){let e;const n=this.json.cameras[t],r=n[n.type];if(!r){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?e=new m.PerspectiveCamera(m.MathUtils.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):n.type==="orthographic"&&(e=new m.OrthographicCamera(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),n.name&&(e.name=this.createUniqueName(n.name)),un(e,n),Promise.resolve(e)}loadSkin(t){const e=this.json.skins[t],n=[];for(let r=0,s=e.joints.length;r<s;r++)n.push(this._loadNodeShallow(e.joints[r]));return e.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",e.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(r){const s=r.pop(),l=r,c=[],u=[];for(let d=0,p=l.length;d<p;d++){const f=l[d];if(f){c.push(f);const y=new m.Matrix4;s!==null&&y.fromArray(s.array,d*16),u.push(y)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[d])}return new m.Skeleton(c,u)})}loadAnimation(t){const e=this.json,n=this,r=e.animations[t],s=r.name?r.name:"animation_"+t,l=[],c=[],u=[],d=[],p=[];for(let f=0,y=r.channels.length;f<y;f++){const v=r.channels[f],b=r.samplers[v.sampler],T=v.target,_=T.node,S=r.parameters!==void 0?r.parameters[b.input]:b.input,L=r.parameters!==void 0?r.parameters[b.output]:b.output;T.node!==void 0&&(l.push(this.getDependency("node",_)),c.push(this.getDependency("accessor",S)),u.push(this.getDependency("accessor",L)),d.push(b),p.push(T))}return Promise.all([Promise.all(l),Promise.all(c),Promise.all(u),Promise.all(d),Promise.all(p)]).then(function(f){const y=f[0],v=f[1],b=f[2],T=f[3],_=f[4],S=[];for(let L=0,I=y.length;L<I;L++){const F=y[L],K=v[L],D=b[L],O=T[L],V=_[L];if(F===void 0)continue;F.updateMatrix&&F.updateMatrix();const R=n._createAnimationTracks(F,K,D,O,V);if(R)for(let P=0;P<R.length;P++)S.push(R[P])}return new m.AnimationClip(s,void 0,S)})}createNodeMesh(t){const e=this.json,n=this,r=e.nodes[t];return r.mesh===void 0?null:n.getDependency("mesh",r.mesh).then(function(s){const l=n._getNodeRef(n.meshCache,r.mesh,s);return r.weights!==void 0&&l.traverse(function(c){if(c.isMesh)for(let u=0,d=r.weights.length;u<d;u++)c.morphTargetInfluences[u]=r.weights[u]}),l})}loadNode(t){const e=this.json,n=this,r=e.nodes[t],s=n._loadNodeShallow(t),l=[],c=r.children||[];for(let d=0,p=c.length;d<p;d++)l.push(n.getDependency("node",c[d]));const u=r.skin===void 0?Promise.resolve(null):n.getDependency("skin",r.skin);return Promise.all([s,Promise.all(l),u]).then(function(d){const p=d[0],f=d[1],y=d[2];y!==null&&p.traverse(function(v){v.isSkinnedMesh&&v.bind(y,kd)});for(let v=0,b=f.length;v<b;v++)p.add(f[v]);return p})}_loadNodeShallow(t){const e=this.json,n=this.extensions,r=this;if(this.nodeCache[t]!==void 0)return this.nodeCache[t];const s=e.nodes[t],l=s.name?r.createUniqueName(s.name):"",c=[],u=r._invokeOne(function(d){return d.createNodeMesh&&d.createNodeMesh(t)});return u&&c.push(u),s.camera!==void 0&&c.push(r.getDependency("camera",s.camera).then(function(d){return r._getNodeRef(r.cameraCache,s.camera,d)})),r._invokeAll(function(d){return d.createNodeAttachment&&d.createNodeAttachment(t)}).forEach(function(d){c.push(d)}),this.nodeCache[t]=Promise.all(c).then(function(d){let p;if(s.isBone===!0?p=new m.Bone:d.length>1?p=new m.Group:d.length===1?p=d[0]:p=new m.Object3D,p!==d[0])for(let f=0,y=d.length;f<y;f++)p.add(d[f]);if(s.name&&(p.userData.name=s.name,p.name=l),un(p,s),s.extensions&&Rn(n,p,s),s.matrix!==void 0){const f=new m.Matrix4;f.fromArray(s.matrix),p.applyMatrix4(f)}else s.translation!==void 0&&p.position.fromArray(s.translation),s.rotation!==void 0&&p.quaternion.fromArray(s.rotation),s.scale!==void 0&&p.scale.fromArray(s.scale);return r.associations.has(p)||r.associations.set(p,{}),r.associations.get(p).nodes=t,p}),this.nodeCache[t]}loadScene(t){const e=this.extensions,n=this.json.scenes[t],r=this,s=new m.Group;n.name&&(s.name=r.createUniqueName(n.name)),un(s,n),n.extensions&&Rn(e,s,n);const l=n.nodes||[],c=[];for(let u=0,d=l.length;u<d;u++)c.push(r.getDependency("node",l[u]));return Promise.all(c).then(function(u){for(let p=0,f=u.length;p<f;p++)s.add(u[p]);const d=p=>{const f=new Map;for(const[y,v]of r.associations)(y instanceof m.Material||y instanceof m.Texture)&&f.set(y,v);return p.traverse(y=>{const v=r.associations.get(y);v!=null&&f.set(y,v)}),f};return r.associations=d(s),s})}_createAnimationTracks(t,e,n,r,s){const l=[],c=t.name?t.name:t.uuid,u=[];Mn[s.path]===Mn.weights?t.traverse(function(y){y.morphTargetInfluences&&u.push(y.name?y.name:y.uuid)}):u.push(c);let d;switch(Mn[s.path]){case Mn.weights:d=m.NumberKeyframeTrack;break;case Mn.rotation:d=m.QuaternionKeyframeTrack;break;case Mn.position:case Mn.scale:d=m.VectorKeyframeTrack;break;default:switch(n.itemSize){case 1:d=m.NumberKeyframeTrack;break;case 2:case 3:default:d=m.VectorKeyframeTrack;break}break}const p=r.interpolation!==void 0?Pd[r.interpolation]:m.InterpolateLinear,f=this._getArrayFromAccessor(n);for(let y=0,v=u.length;y<v;y++){const b=new d(u[y]+"."+Mn[s.path],e.array,f,p);r.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(b),l.push(b)}return l}_getArrayFromAccessor(t){let e=t.array;if(t.normalized){const n=Vs(e.constructor),r=new Float32Array(e.length);for(let s=0,l=e.length;s<l;s++)r[s]=e[s]*n;e=r}return e}_createCubicSplineTrackInterpolant(t){t.createInterpolant=function(n){const r=this instanceof m.QuaternionKeyframeTrack?Wd:Ra;return new r(this.times,this.values,this.getValueSize()/3,n)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function zd(a,t,e){const n=t.attributes,r=new m.Box3;if(n.POSITION!==void 0){const c=e.json.accessors[n.POSITION],u=c.min,d=c.max;if(u!==void 0&&d!==void 0){if(r.set(new m.Vector3(u[0],u[1],u[2]),new m.Vector3(d[0],d[1],d[2])),c.normalized){const p=Vs(cr[c.componentType]);r.min.multiplyScalar(p),r.max.multiplyScalar(p)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=t.targets;if(s!==void 0){const c=new m.Vector3,u=new m.Vector3;for(let d=0,p=s.length;d<p;d++){const f=s[d];if(f.POSITION!==void 0){const y=e.json.accessors[f.POSITION],v=y.min,b=y.max;if(v!==void 0&&b!==void 0){if(u.setX(Math.max(Math.abs(v[0]),Math.abs(b[0]))),u.setY(Math.max(Math.abs(v[1]),Math.abs(b[1]))),u.setZ(Math.max(Math.abs(v[2]),Math.abs(b[2]))),y.normalized){const T=Vs(cr[y.componentType]);u.multiplyScalar(T)}c.max(u)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(c)}a.boundingBox=r;const l=new m.Sphere;r.getCenter(l.center),l.radius=r.min.distanceTo(r.max)/2,a.boundingSphere=l}function Ba(a,t,e){const n=t.attributes,r=[];function s(l,c){return e.getDependency("accessor",l).then(function(u){a.setAttribute(c,u)})}for(const l in n){const c=Ws[l]||l.toLowerCase();c in a.attributes||r.push(s(n[l],c))}if(t.indices!==void 0&&!a.index){const l=e.getDependency("accessor",t.indices).then(function(c){a.setIndex(c)});r.push(l)}return un(a,t),zd(a,t,e),Promise.all(r).then(function(){return t.targets!==void 0?Vd(a,t.targets,e):a})}function Na(a,t,e){const n=e.length-a-1;if(t>=e[n])return n-1;if(t<=e[a])return a;let r=a,s=n,l=Math.floor((r+s)/2);for(;t<e[l]||t>=e[l+1];)t<e[l]?s=l:r=l,l=Math.floor((r+s)/2);return l}function Od(a,t,e,n){const r=[],s=[],l=[];r[0]=1;for(let c=1;c<=e;++c){s[c]=t-n[a+1-c],l[c]=n[a+c]-t;let u=0;for(let d=0;d<c;++d){const p=l[d+1],f=s[c-d],y=r[d]/(p+f);r[d]=u+p*y,u=f*y}r[c]=u}return r}function Kd(a,t,e,n){const r=Na(a,n,t),s=Od(r,n,a,t),l=new m.Vector4(0,0,0,0);for(let c=0;c<=a;++c){const u=e[r-a+c],d=s[c],p=u.w*d;l.x+=u.x*p,l.y+=u.y*p,l.z+=u.z*p,l.w+=u.w*d}return l}function Rd(a,t,e,n,r){const s=[];for(let f=0;f<=e;++f)s[f]=0;const l=[];for(let f=0;f<=n;++f)l[f]=s.slice(0);const c=[];for(let f=0;f<=e;++f)c[f]=s.slice(0);c[0][0]=1;const u=s.slice(0),d=s.slice(0);for(let f=1;f<=e;++f){u[f]=t-r[a+1-f],d[f]=r[a+f]-t;let y=0;for(let v=0;v<f;++v){const b=d[v+1],T=u[f-v];c[f][v]=b+T;const _=c[v][f-1]/c[f][v];c[v][f]=y+b*_,y=T*_}c[f][f]=y}for(let f=0;f<=e;++f)l[0][f]=c[f][e];for(let f=0;f<=e;++f){let y=0,v=1;const b=[];for(let T=0;T<=e;++T)b[T]=s.slice(0);b[0][0]=1;for(let T=1;T<=n;++T){let _=0;const S=f-T,L=e-T;f>=T&&(b[v][0]=b[y][0]/c[L+1][S],_=b[v][0]*c[S][L]);const I=S>=-1?1:-S,F=f-1<=L?T-1:e-f;for(let D=I;D<=F;++D)b[v][D]=(b[y][D]-b[y][D-1])/c[L+1][S+D],_+=b[v][D]*c[S+D][L];f<=L&&(b[v][T]=-b[y][T-1]/c[L+1][f],_+=b[v][T]*c[f][L]),l[T][f]=_;const K=y;y=v,v=K}}let p=e;for(let f=1;f<=n;++f){for(let y=0;y<=e;++y)l[f][y]*=p;p*=e-f}return l}function Yd(a,t,e,n,r){const s=r<a?r:a,l=[],c=Na(a,n,t),u=Rd(c,n,a,s,t),d=[];for(let p=0;p<e.length;++p){const f=e[p].clone(),y=f.w;f.x*=y,f.y*=y,f.z*=y,d[p]=f}for(let p=0;p<=s;++p){const f=d[c-a].clone().multiplyScalar(u[p][0]);for(let y=1;y<=a;++y)f.add(d[c-a+y].clone().multiplyScalar(u[p][y]));l[p]=f}for(let p=s+1;p<=r+1;++p)l[p]=new m.Vector4(0,0,0);return l}function Ud(a,t){let e=1;for(let r=2;r<=a;++r)e*=r;let n=1;for(let r=2;r<=t;++r)n*=r;for(let r=2;r<=a-t;++r)n*=r;return e/n}function Bd(a){const t=a.length,e=[],n=[];for(let s=0;s<t;++s){const l=a[s];e[s]=new m.Vector3(l.x,l.y,l.z),n[s]=l.w}const r=[];for(let s=0;s<t;++s){const l=e[s].clone();for(let c=1;c<=s;++c)l.sub(r[s-c].clone().multiplyScalar(Ud(s,c)*n[c]));r[s]=l.divideScalar(n[0])}return r}function Nd(a,t,e,n,r){const s=Yd(a,t,e,n,r);return Bd(s)}class ja extends m.Curve{constructor(t,e,n,r,s){super(),this.degree=t,this.knots=e,this.controlPoints=[],this.startKnot=r||0,this.endKnot=s||this.knots.length-1;for(let l=0;l<n.length;++l){const c=n[l];this.controlPoints[l]=new m.Vector4(c.x,c.y,c.z,c.w)}}getPoint(t,e){const n=e||new m.Vector3,r=this.knots[this.startKnot]+t*(this.knots[this.endKnot]-this.knots[this.startKnot]),s=Kd(this.degree,this.knots,this.controlPoints,r);return s.w!=1&&s.divideScalar(s.w),n.set(s.x,s.y,s.z)}getTangent(t,e){const n=e||new m.Vector3,r=this.knots[0]+t*(this.knots[this.knots.length-1]-this.knots[0]),s=Nd(this.degree,this.knots,this.controlPoints,r,1);return n.copy(s[1]).normalize(),n}}let be,ze,ft;class jd extends m.Loader{constructor(t){super(t)}load(t,e,n,r){const s=this,l=s.path===""?m.LoaderUtils.extractUrlBase(t):s.path,c=new m.FileLoader(this.manager);c.setPath(s.path),c.setResponseType("arraybuffer"),c.setRequestHeader(s.requestHeader),c.setWithCredentials(s.withCredentials),c.load(t,function(u){try{e(s.parse(u,l))}catch(d){r?r(d):console.error(d),s.manager.itemError(t)}},n,r)}parse(t,e){if($d(t))be=new qd().parse(t);else{const r=$a(t);if(!ef(r))throw new Error("THREE.FBXLoader: Unknown format.");if(Ha(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Ha(r));be=new Ed().parse(r)}const n=new m.TextureLoader(this.manager).setPath(this.resourcePath||e).setCrossOrigin(this.crossOrigin);return new Jd(n,this.manager).parse(be)}}class Jd{constructor(t,e){this.textureLoader=t,this.manager=e}parse(){ze=this.parseConnections();const t=this.parseImages(),e=this.parseTextures(t),n=this.parseMaterials(e),r=this.parseDeformers(),s=new Qd().parse(r);return this.parseScene(r,s,n),ft}parseConnections(){const t=new Map;return"Connections"in be&&be.Connections.connections.forEach(function(n){const r=n[0],s=n[1],l=n[2];t.has(r)||t.set(r,{parents:[],children:[]});const c={ID:s,relationship:l};t.get(r).parents.push(c),t.has(s)||t.set(s,{parents:[],children:[]});const u={ID:r,relationship:l};t.get(s).children.push(u)}),t}parseImages(){const t={},e={};if("Video"in be.Objects){const n=be.Objects.Video;for(const r in n){const s=n[r],l=parseInt(r);if(t[l]=s.RelativeFilename||s.Filename,"Content"in s){const c=s.Content instanceof ArrayBuffer&&s.Content.byteLength>0,u=typeof s.Content=="string"&&s.Content!=="";if(c||u){const d=this.parseImage(n[r]);e[s.RelativeFilename||s.Filename]=d}}}}for(const n in t){const r=t[n];e[r]!==void 0?t[n]=e[r]:t[n]=t[n].split("\\").pop()}return t}parseImage(t){const e=t.Content,n=t.RelativeFilename||t.Filename,r=n.slice(n.lastIndexOf(".")+1).toLowerCase();let s;switch(r){case"bmp":s="image/bmp";break;case"jpg":case"jpeg":s="image/jpeg";break;case"png":s="image/png";break;case"tif":s="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",n),s="image/tga";break;default:console.warn('FBXLoader: Image type "'+r+'" is not supported.');return}if(typeof e=="string")return"data:"+s+";base64,"+e;{const l=new Uint8Array(e);return window.URL.createObjectURL(new Blob([l],{type:s}))}}parseTextures(t){const e=new Map;if("Texture"in be.Objects){const n=be.Objects.Texture;for(const r in n){const s=this.parseTexture(n[r],t);e.set(parseInt(r),s)}}return e}parseTexture(t,e){const n=this.loadTexture(t,e);n.ID=t.id,n.name=t.attrName;const r=t.WrapModeU,s=t.WrapModeV,l=r!==void 0?r.value:0,c=s!==void 0?s.value:0;if(n.wrapS=l===0?m.RepeatWrapping:m.ClampToEdgeWrapping,n.wrapT=c===0?m.RepeatWrapping:m.ClampToEdgeWrapping,"Scaling"in t){const u=t.Scaling.value;n.repeat.x=u[0],n.repeat.y=u[1]}return n}loadTexture(t,e){let n;const r=this.textureLoader.path,s=ze.get(t.id).children;s!==void 0&&s.length>0&&e[s[0].ID]!==void 0&&(n=e[s[0].ID],(n.indexOf("blob:")===0||n.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let l;const c=t.FileName.slice(-3).toLowerCase();if(c==="tga"){const u=this.manager.getHandler(".tga");u===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",t.RelativeFilename),l=new m.Texture):(u.setPath(this.textureLoader.path),l=u.load(n))}else c==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",t.RelativeFilename),l=new m.Texture):l=this.textureLoader.load(n);return this.textureLoader.setPath(r),l}parseMaterials(t){const e=new Map;if("Material"in be.Objects){const n=be.Objects.Material;for(const r in n){const s=this.parseMaterial(n[r],t);s!==null&&e.set(parseInt(r),s)}}return e}parseMaterial(t,e){const n=t.id,r=t.attrName;let s=t.ShadingModel;if(typeof s=="object"&&(s=s.value),!ze.has(n))return null;const l=this.parseParameters(t,e,n);let c;switch(s.toLowerCase()){case"phong":c=new m.MeshPhongMaterial;break;case"lambert":c=new m.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',s),c=new m.MeshPhongMaterial;break}return c.setValues(l),c.name=r,c}parseParameters(t,e,n){const r={};t.BumpFactor&&(r.bumpScale=t.BumpFactor.value),t.Diffuse?r.color=new m.Color().fromArray(t.Diffuse.value):t.DiffuseColor&&(t.DiffuseColor.type==="Color"||t.DiffuseColor.type==="ColorRGB")&&(r.color=new m.Color().fromArray(t.DiffuseColor.value)),t.DisplacementFactor&&(r.displacementScale=t.DisplacementFactor.value),t.Emissive?r.emissive=new m.Color().fromArray(t.Emissive.value):t.EmissiveColor&&(t.EmissiveColor.type==="Color"||t.EmissiveColor.type==="ColorRGB")&&(r.emissive=new m.Color().fromArray(t.EmissiveColor.value)),t.EmissiveFactor&&(r.emissiveIntensity=parseFloat(t.EmissiveFactor.value)),t.Opacity&&(r.opacity=parseFloat(t.Opacity.value)),r.opacity<1&&(r.transparent=!0),t.ReflectionFactor&&(r.reflectivity=t.ReflectionFactor.value),t.Shininess&&(r.shininess=t.Shininess.value),t.Specular?r.specular=new m.Color().fromArray(t.Specular.value):t.SpecularColor&&t.SpecularColor.type==="Color"&&(r.specular=new m.Color().fromArray(t.SpecularColor.value));const s=this;return ze.get(n).children.forEach(function(l){const c=l.relationship;switch(c){case"Bump":r.bumpMap=s.getTexture(e,l.ID);break;case"Maya|TEX_ao_map":r.aoMap=s.getTexture(e,l.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=s.getTexture(e,l.ID),r.map!==void 0&&("colorSpace"in r.map?r.map.colorSpace="srgb":r.map.encoding=3001);break;case"DisplacementColor":r.displacementMap=s.getTexture(e,l.ID);break;case"EmissiveColor":r.emissiveMap=s.getTexture(e,l.ID),r.emissiveMap!==void 0&&("colorSpace"in r.emissiveMap?r.emissiveMap.colorSpace="srgb":r.emissiveMap.encoding=3001);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=s.getTexture(e,l.ID);break;case"ReflectionColor":r.envMap=s.getTexture(e,l.ID),r.envMap!==void 0&&(r.envMap.mapping=m.EquirectangularReflectionMapping,"colorSpace"in r.envMap?r.envMap.colorSpace="srgb":r.envMap.encoding=3001);break;case"SpecularColor":r.specularMap=s.getTexture(e,l.ID),r.specularMap!==void 0&&("colorSpace"in r.specularMap?r.specularMap.colorSpace="srgb":r.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=s.getTexture(e,l.ID),r.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",c);break}}),r}getTexture(t,e){return"LayeredTexture"in be.Objects&&e in be.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),e=ze.get(e).children[0].ID),t.get(e)}parseDeformers(){const t={},e={};if("Deformer"in be.Objects){const n=be.Objects.Deformer;for(const r in n){const s=n[r],l=ze.get(parseInt(r));if(s.attrType==="Skin"){const c=this.parseSkeleton(l,n);c.ID=r,l.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),c.geometryID=l.parents[0].ID,t[r]=c}else if(s.attrType==="BlendShape"){const c={id:r};c.rawTargets=this.parseMorphTargets(l,n),c.id=r,l.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),e[r]=c}}}return{skeletons:t,morphTargets:e}}parseSkeleton(t,e){const n=[];return t.children.forEach(function(r){const s=e[r.ID];if(s.attrType!=="Cluster")return;const l={ID:r.ID,indices:[],weights:[],transformLink:new m.Matrix4().fromArray(s.TransformLink.a)};"Indexes"in s&&(l.indices=s.Indexes.a,l.weights=s.Weights.a),n.push(l)}),{rawBones:n,bones:[]}}parseMorphTargets(t,e){const n=[];for(let r=0;r<t.children.length;r++){const s=t.children[r],l=e[s.ID],c={name:l.attrName,initialWeight:l.DeformPercent,id:l.id,fullWeights:l.FullWeights.a};if(l.attrType!=="BlendShapeChannel")return;c.geoID=ze.get(parseInt(s.ID)).children.filter(function(u){return u.relationship===void 0})[0].ID,n.push(c)}return n}parseScene(t,e,n){ft=new m.Group;const r=this.parseModels(t.skeletons,e,n),s=be.Objects.Model,l=this;r.forEach(function(u){const d=s[u.ID];l.setLookAtProperties(u,d),ze.get(u.ID).parents.forEach(function(f){const y=r.get(f.ID);y!==void 0&&y.add(u)}),u.parent===null&&ft.add(u)}),this.bindSkeleton(t.skeletons,e,r),this.createAmbientLight(),ft.traverse(function(u){if(u.userData.transformData){u.parent&&(u.userData.transformData.parentMatrix=u.parent.matrix,u.userData.transformData.parentMatrixWorld=u.parent.matrixWorld);const d=Ea(u.userData.transformData);u.applyMatrix4(d),u.updateWorldMatrix()}});const c=new Hd().parse();ft.children.length===1&&ft.children[0].isGroup&&(ft.children[0].animations=c,ft=ft.children[0]),ft.animations=c}parseModels(t,e,n){const r=new Map,s=be.Objects.Model;for(const l in s){const c=parseInt(l),u=s[l],d=ze.get(c);let p=this.buildSkeleton(d,t,c,u.attrName);if(!p){switch(u.attrType){case"Camera":p=this.createCamera(d);break;case"Light":p=this.createLight(d);break;case"Mesh":p=this.createMesh(d,e,n);break;case"NurbsCurve":p=this.createCurve(d,e);break;case"LimbNode":case"Root":p=new m.Bone;break;case"Null":default:p=new m.Group;break}p.name=u.attrName?m.PropertyBinding.sanitizeNodeName(u.attrName):"",p.ID=c}this.getTransformData(p,u),r.set(c,p)}return r}buildSkeleton(t,e,n,r){let s=null;return t.parents.forEach(function(l){for(const c in e){const u=e[c];u.rawBones.forEach(function(d,p){if(d.ID===l.ID){const f=s;s=new m.Bone,s.matrixWorld.copy(d.transformLink),s.name=r?m.PropertyBinding.sanitizeNodeName(r):"",s.ID=n,u.bones[p]=s,f!==null&&s.add(f)}})}}),s}createCamera(t){let e,n;if(t.children.forEach(function(r){const s=be.Objects.NodeAttribute[r.ID];s!==void 0&&(n=s)}),n===void 0)e=new m.Object3D;else{let r=0;n.CameraProjectionType!==void 0&&n.CameraProjectionType.value===1&&(r=1);let s=1;n.NearPlane!==void 0&&(s=n.NearPlane.value/1e3);let l=1e3;n.FarPlane!==void 0&&(l=n.FarPlane.value/1e3);let c=window.innerWidth,u=window.innerHeight;n.AspectWidth!==void 0&&n.AspectHeight!==void 0&&(c=n.AspectWidth.value,u=n.AspectHeight.value);const d=c/u;let p=45;n.FieldOfView!==void 0&&(p=n.FieldOfView.value);const f=n.FocalLength?n.FocalLength.value:null;switch(r){case 0:e=new m.PerspectiveCamera(p,d,s,l),f!==null&&e.setFocalLength(f);break;case 1:e=new m.OrthographicCamera(-c/2,c/2,u/2,-u/2,s,l);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+r+"."),e=new m.Object3D;break}}return e}createLight(t){let e,n;if(t.children.forEach(function(r){const s=be.Objects.NodeAttribute[r.ID];s!==void 0&&(n=s)}),n===void 0)e=new m.Object3D;else{let r;n.LightType===void 0?r=0:r=n.LightType.value;let s=16777215;n.Color!==void 0&&(s=new m.Color().fromArray(n.Color.value));let l=n.Intensity===void 0?1:n.Intensity.value/100;n.CastLightOnObject!==void 0&&n.CastLightOnObject.value===0&&(l=0);let c=0;n.FarAttenuationEnd!==void 0&&(n.EnableFarAttenuation!==void 0&&n.EnableFarAttenuation.value===0?c=0:c=n.FarAttenuationEnd.value);const u=1;switch(r){case 0:e=new m.PointLight(s,l,c,u);break;case 1:e=new m.DirectionalLight(s,l);break;case 2:let d=Math.PI/3;n.InnerAngle!==void 0&&(d=m.MathUtils.degToRad(n.InnerAngle.value));let p=0;n.OuterAngle!==void 0&&(p=m.MathUtils.degToRad(n.OuterAngle.value),p=Math.max(p,1)),e=new m.SpotLight(s,l,c,d,p,u);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),e=new m.PointLight(s,l);break}n.CastShadows!==void 0&&n.CastShadows.value===1&&(e.castShadow=!0)}return e}createMesh(t,e,n){let r,s=null,l=null;const c=[];return t.children.forEach(function(u){e.has(u.ID)&&(s=e.get(u.ID)),n.has(u.ID)&&c.push(n.get(u.ID))}),c.length>1?l=c:c.length>0?l=c[0]:(l=new m.MeshPhongMaterial({color:13421772}),c.push(l)),"color"in s.attributes&&c.forEach(function(u){u.vertexColors=!0}),s.FBX_Deformer?(r=new m.SkinnedMesh(s,l),r.normalizeSkinWeights()):r=new m.Mesh(s,l),r}createCurve(t,e){const n=t.children.reduce(function(s,l){return e.has(l.ID)&&(s=e.get(l.ID)),s},null),r=new m.LineBasicMaterial({color:3342591,linewidth:1});return new m.Line(n,r)}getTransformData(t,e){const n={};"InheritType"in e&&(n.inheritType=parseInt(e.InheritType.value)),"RotationOrder"in e?n.eulerOrder=qa(e.RotationOrder.value):n.eulerOrder="ZYX","Lcl_Translation"in e&&(n.translation=e.Lcl_Translation.value),"PreRotation"in e&&(n.preRotation=e.PreRotation.value),"Lcl_Rotation"in e&&(n.rotation=e.Lcl_Rotation.value),"PostRotation"in e&&(n.postRotation=e.PostRotation.value),"Lcl_Scaling"in e&&(n.scale=e.Lcl_Scaling.value),"ScalingOffset"in e&&(n.scalingOffset=e.ScalingOffset.value),"ScalingPivot"in e&&(n.scalingPivot=e.ScalingPivot.value),"RotationOffset"in e&&(n.rotationOffset=e.RotationOffset.value),"RotationPivot"in e&&(n.rotationPivot=e.RotationPivot.value),t.userData.transformData=n}setLookAtProperties(t,e){"LookAtProperty"in e&&ze.get(t.ID).children.forEach(function(r){if(r.relationship==="LookAtProperty"){const s=be.Objects.Model[r.ID];if("Lcl_Translation"in s){const l=s.Lcl_Translation.value;t.target!==void 0?(t.target.position.fromArray(l),ft.add(t.target)):t.lookAt(new m.Vector3().fromArray(l))}}})}bindSkeleton(t,e,n){const r=this.parsePoseNodes();for(const s in t){const l=t[s];ze.get(parseInt(l.ID)).parents.forEach(function(u){if(e.has(u.ID)){const d=u.ID;ze.get(d).parents.forEach(function(f){n.has(f.ID)&&n.get(f.ID).bind(new m.Skeleton(l.bones),r[f.ID])})}})}}parsePoseNodes(){const t={};if("Pose"in be.Objects){const e=be.Objects.Pose;for(const n in e)if(e[n].attrType==="BindPose"&&e[n].NbPoseNodes>0){const r=e[n].PoseNode;Array.isArray(r)?r.forEach(function(s){t[s.Node]=new m.Matrix4().fromArray(s.Matrix.a)}):t[r.Node]=new m.Matrix4().fromArray(r.Matrix.a)}}return t}createAmbientLight(){if("GlobalSettings"in be&&"AmbientColor"in be.GlobalSettings){const t=be.GlobalSettings.AmbientColor.value,e=t[0],n=t[1],r=t[2];if(e!==0||n!==0||r!==0){const s=new m.Color(e,n,r);ft.add(new m.AmbientLight(s,1))}}}}class Qd{parse(t){const e=new Map;if("Geometry"in be.Objects){const n=be.Objects.Geometry;for(const r in n){const s=ze.get(parseInt(r)),l=this.parseGeometry(s,n[r],t);e.set(parseInt(r),l)}}return e}parseGeometry(t,e,n){switch(e.attrType){case"Mesh":return this.parseMeshGeometry(t,e,n);case"NurbsCurve":return this.parseNurbsGeometry(e)}}parseMeshGeometry(t,e,n){const r=n.skeletons,s=[],l=t.parents.map(function(f){return be.Objects.Model[f.ID]});if(l.length===0)return;const c=t.children.reduce(function(f,y){return r[y.ID]!==void 0&&(f=r[y.ID]),f},null);t.children.forEach(function(f){n.morphTargets[f.ID]!==void 0&&s.push(n.morphTargets[f.ID])});const u=l[0],d={};"RotationOrder"in u&&(d.eulerOrder=qa(u.RotationOrder.value)),"InheritType"in u&&(d.inheritType=parseInt(u.InheritType.value)),"GeometricTranslation"in u&&(d.translation=u.GeometricTranslation.value),"GeometricRotation"in u&&(d.rotation=u.GeometricRotation.value),"GeometricScaling"in u&&(d.scale=u.GeometricScaling.value);const p=Ea(d);return this.genGeometry(e,c,s,p)}genGeometry(t,e,n,r){const s=new m.BufferGeometry;t.attrName&&(s.name=t.attrName);const l=this.parseGeoNode(t,e),c=this.genBuffers(l),u=new m.Float32BufferAttribute(c.vertex,3);if(u.applyMatrix4(r),s.setAttribute("position",u),c.colors.length>0&&s.setAttribute("color",new m.Float32BufferAttribute(c.colors,3)),e&&(s.setAttribute("skinIndex",new m.Uint16BufferAttribute(c.weightsIndices,4)),s.setAttribute("skinWeight",new m.Float32BufferAttribute(c.vertexWeights,4)),s.FBX_Deformer=e),c.normal.length>0){const d=new m.Matrix3().getNormalMatrix(r),p=new m.Float32BufferAttribute(c.normal,3);p.applyNormalMatrix(d),s.setAttribute("normal",p)}if(c.uvs.forEach(function(d,p){Ls==="uv2"&&p++;const f=p===0?"uv":`uv${p}`;s.setAttribute(f,new m.Float32BufferAttribute(c.uvs[p],2))}),l.material&&l.material.mappingType!=="AllSame"){let d=c.materialIndex[0],p=0;if(c.materialIndex.forEach(function(f,y){f!==d&&(s.addGroup(p,y-p,d),d=f,p=y)}),s.groups.length>0){const f=s.groups[s.groups.length-1],y=f.start+f.count;y!==c.materialIndex.length&&s.addGroup(y,c.materialIndex.length-y,d)}s.groups.length===0&&s.addGroup(0,c.materialIndex.length,c.materialIndex[0])}return this.addMorphTargets(s,t,n,r),s}parseGeoNode(t,e){const n={};if(n.vertexPositions=t.Vertices!==void 0?t.Vertices.a:[],n.vertexIndices=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],t.LayerElementColor&&(n.color=this.parseVertexColors(t.LayerElementColor[0])),t.LayerElementMaterial&&(n.material=this.parseMaterialIndices(t.LayerElementMaterial[0])),t.LayerElementNormal&&(n.normal=this.parseNormals(t.LayerElementNormal[0])),t.LayerElementUV){n.uv=[];let r=0;for(;t.LayerElementUV[r];)t.LayerElementUV[r].UV&&n.uv.push(this.parseUVs(t.LayerElementUV[r])),r++}return n.weightTable={},e!==null&&(n.skeleton=e,e.rawBones.forEach(function(r,s){r.indices.forEach(function(l,c){n.weightTable[l]===void 0&&(n.weightTable[l]=[]),n.weightTable[l].push({id:s,weight:r.weights[c]})})})),n}genBuffers(t){const e={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,r=0,s=!1,l=[],c=[],u=[],d=[],p=[],f=[];const y=this;return t.vertexIndices.forEach(function(v,b){let T,_=!1;v<0&&(v=v^-1,_=!0);let S=[],L=[];if(l.push(v*3,v*3+1,v*3+2),t.color){const I=mi(b,n,v,t.color);u.push(I[0],I[1],I[2])}if(t.skeleton){if(t.weightTable[v]!==void 0&&t.weightTable[v].forEach(function(I){L.push(I.weight),S.push(I.id)}),L.length>4){s||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),s=!0);const I=[0,0,0,0],F=[0,0,0,0];L.forEach(function(K,D){let O=K,V=S[D];F.forEach(function(R,P,k){if(O>R){k[P]=O,O=R;const N=I[P];I[P]=V,V=N}})}),S=I,L=F}for(;L.length<4;)L.push(0),S.push(0);for(let I=0;I<4;++I)p.push(L[I]),f.push(S[I])}if(t.normal){const I=mi(b,n,v,t.normal);c.push(I[0],I[1],I[2])}t.material&&t.material.mappingType!=="AllSame"&&(T=mi(b,n,v,t.material)[0]),t.uv&&t.uv.forEach(function(I,F){const K=mi(b,n,v,I);d[F]===void 0&&(d[F]=[]),d[F].push(K[0]),d[F].push(K[1])}),r++,_&&(y.genFace(e,t,l,T,c,u,d,p,f,r),n++,r=0,l=[],c=[],u=[],d=[],p=[],f=[])}),e}genFace(t,e,n,r,s,l,c,u,d,p){for(let f=2;f<p;f++)t.vertex.push(e.vertexPositions[n[0]]),t.vertex.push(e.vertexPositions[n[1]]),t.vertex.push(e.vertexPositions[n[2]]),t.vertex.push(e.vertexPositions[n[(f-1)*3]]),t.vertex.push(e.vertexPositions[n[(f-1)*3+1]]),t.vertex.push(e.vertexPositions[n[(f-1)*3+2]]),t.vertex.push(e.vertexPositions[n[f*3]]),t.vertex.push(e.vertexPositions[n[f*3+1]]),t.vertex.push(e.vertexPositions[n[f*3+2]]),e.skeleton&&(t.vertexWeights.push(u[0]),t.vertexWeights.push(u[1]),t.vertexWeights.push(u[2]),t.vertexWeights.push(u[3]),t.vertexWeights.push(u[(f-1)*4]),t.vertexWeights.push(u[(f-1)*4+1]),t.vertexWeights.push(u[(f-1)*4+2]),t.vertexWeights.push(u[(f-1)*4+3]),t.vertexWeights.push(u[f*4]),t.vertexWeights.push(u[f*4+1]),t.vertexWeights.push(u[f*4+2]),t.vertexWeights.push(u[f*4+3]),t.weightsIndices.push(d[0]),t.weightsIndices.push(d[1]),t.weightsIndices.push(d[2]),t.weightsIndices.push(d[3]),t.weightsIndices.push(d[(f-1)*4]),t.weightsIndices.push(d[(f-1)*4+1]),t.weightsIndices.push(d[(f-1)*4+2]),t.weightsIndices.push(d[(f-1)*4+3]),t.weightsIndices.push(d[f*4]),t.weightsIndices.push(d[f*4+1]),t.weightsIndices.push(d[f*4+2]),t.weightsIndices.push(d[f*4+3])),e.color&&(t.colors.push(l[0]),t.colors.push(l[1]),t.colors.push(l[2]),t.colors.push(l[(f-1)*3]),t.colors.push(l[(f-1)*3+1]),t.colors.push(l[(f-1)*3+2]),t.colors.push(l[f*3]),t.colors.push(l[f*3+1]),t.colors.push(l[f*3+2])),e.material&&e.material.mappingType!=="AllSame"&&(t.materialIndex.push(r),t.materialIndex.push(r),t.materialIndex.push(r)),e.normal&&(t.normal.push(s[0]),t.normal.push(s[1]),t.normal.push(s[2]),t.normal.push(s[(f-1)*3]),t.normal.push(s[(f-1)*3+1]),t.normal.push(s[(f-1)*3+2]),t.normal.push(s[f*3]),t.normal.push(s[f*3+1]),t.normal.push(s[f*3+2])),e.uv&&e.uv.forEach(function(y,v){t.uvs[v]===void 0&&(t.uvs[v]=[]),t.uvs[v].push(c[v][0]),t.uvs[v].push(c[v][1]),t.uvs[v].push(c[v][(f-1)*2]),t.uvs[v].push(c[v][(f-1)*2+1]),t.uvs[v].push(c[v][f*2]),t.uvs[v].push(c[v][f*2+1])})}addMorphTargets(t,e,n,r){if(n.length===0)return;t.morphTargetsRelative=!0,t.morphAttributes.position=[];const s=this;n.forEach(function(l){l.rawTargets.forEach(function(c){const u=be.Objects.Geometry[c.geoID];u!==void 0&&s.genMorphGeometry(t,e,u,r,c.name)})})}genMorphGeometry(t,e,n,r,s){const l=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],c=n.Vertices!==void 0?n.Vertices.a:[],u=n.Indexes!==void 0?n.Indexes.a:[],d=t.attributes.position.count*3,p=new Float32Array(d);for(let b=0;b<u.length;b++){const T=u[b]*3;p[T]=c[b*3],p[T+1]=c[b*3+1],p[T+2]=c[b*3+2]}const f={vertexIndices:l,vertexPositions:p},y=this.genBuffers(f),v=new m.Float32BufferAttribute(y.vertex,3);v.name=s||n.attrName,v.applyMatrix4(r),t.morphAttributes.position.push(v)}parseNormals(t){const e=t.MappingInformationType,n=t.ReferenceInformationType,r=t.Normals.a;let s=[];return n==="IndexToDirect"&&("NormalIndex"in t?s=t.NormalIndex.a:"NormalsIndex"in t&&(s=t.NormalsIndex.a)),{dataSize:3,buffer:r,indices:s,mappingType:e,referenceType:n}}parseUVs(t){const e=t.MappingInformationType,n=t.ReferenceInformationType,r=t.UV.a;let s=[];return n==="IndexToDirect"&&(s=t.UVIndex.a),{dataSize:2,buffer:r,indices:s,mappingType:e,referenceType:n}}parseVertexColors(t){const e=t.MappingInformationType,n=t.ReferenceInformationType,r=t.Colors.a;let s=[];return n==="IndexToDirect"&&(s=t.ColorIndex.a),{dataSize:4,buffer:r,indices:s,mappingType:e,referenceType:n}}parseMaterialIndices(t){const e=t.MappingInformationType,n=t.ReferenceInformationType;if(e==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};const r=t.Materials.a,s=[];for(let l=0;l<r.length;++l)s.push(l);return{dataSize:1,buffer:r,indices:s,mappingType:e,referenceType:n}}parseNurbsGeometry(t){if(ja===void 0)return console.error("THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new m.BufferGeometry;const e=parseInt(t.Order);if(isNaN(e))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",t.Order,t.id),new m.BufferGeometry;const n=e-1,r=t.KnotVector.a,s=[],l=t.Points.a;for(let f=0,y=l.length;f<y;f+=4)s.push(new m.Vector4().fromArray(l,f));let c,u;if(t.Form==="Closed")s.push(s[0]);else if(t.Form==="Periodic"){c=n,u=r.length-1-c;for(let f=0;f<n;++f)s.push(s[f])}const p=new ja(n,r,s,c,u).getPoints(s.length*12);return new m.BufferGeometry().setFromPoints(p)}}class Hd{parse(){const t=[],e=this.parseClips();if(e!==void 0)for(const n in e){const r=e[n],s=this.addClip(r);t.push(s)}return t}parseClips(){if(be.Objects.AnimationCurve===void 0)return;const t=this.parseAnimationCurveNodes();this.parseAnimationCurves(t);const e=this.parseAnimationLayers(t);return this.parseAnimStacks(e)}parseAnimationCurveNodes(){const t=be.Objects.AnimationCurveNode,e=new Map;for(const n in t){const r=t[n];if(r.attrName.match(/S|R|T|DeformPercent/)!==null){const s={id:r.id,attr:r.attrName,curves:{}};e.set(s.id,s)}}return e}parseAnimationCurves(t){const e=be.Objects.AnimationCurve;for(const n in e){const r={id:e[n].id,times:e[n].KeyTime.a.map(tf),values:e[n].KeyValueFloat.a},s=ze.get(r.id);if(s!==void 0){const l=s.parents[0].ID,c=s.parents[0].relationship;c.match(/X/)?t.get(l).curves.x=r:c.match(/Y/)?t.get(l).curves.y=r:c.match(/Z/)?t.get(l).curves.z=r:c.match(/d|DeformPercent/)&&t.has(l)&&(t.get(l).curves.morph=r)}}}parseAnimationLayers(t){const e=be.Objects.AnimationLayer,n=new Map;for(const r in e){const s=[],l=ze.get(parseInt(r));l!==void 0&&(l.children.forEach(function(u,d){if(t.has(u.ID)){const p=t.get(u.ID);if(p.curves.x!==void 0||p.curves.y!==void 0||p.curves.z!==void 0){if(s[d]===void 0){const f=ze.get(u.ID).parents.filter(function(y){return y.relationship!==void 0})[0].ID;if(f!==void 0){const y=be.Objects.Model[f.toString()];if(y===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",u);return}const v={modelName:y.attrName?m.PropertyBinding.sanitizeNodeName(y.attrName):"",ID:y.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};ft.traverse(function(b){b.ID===y.id&&(v.transform=b.matrix,b.userData.transformData&&(v.eulerOrder=b.userData.transformData.eulerOrder))}),v.transform||(v.transform=new m.Matrix4),"PreRotation"in y&&(v.preRotation=y.PreRotation.value),"PostRotation"in y&&(v.postRotation=y.PostRotation.value),s[d]=v}}s[d]&&(s[d][p.attr]=p)}else if(p.curves.morph!==void 0){if(s[d]===void 0){const f=ze.get(u.ID).parents.filter(function(S){return S.relationship!==void 0})[0].ID,y=ze.get(f).parents[0].ID,v=ze.get(y).parents[0].ID,b=ze.get(v).parents[0].ID,T=be.Objects.Model[b],_={modelName:T.attrName?m.PropertyBinding.sanitizeNodeName(T.attrName):"",morphName:be.Objects.Deformer[f].attrName};s[d]=_}s[d][p.attr]=p}}}),n.set(parseInt(r),s))}return n}parseAnimStacks(t){const e=be.Objects.AnimationStack,n={};for(const r in e){const s=ze.get(parseInt(r)).children;s.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const l=t.get(s[0].ID);n[r]={name:e[r].attrName,layer:l}}return n}addClip(t){let e=[];const n=this;return t.layer.forEach(function(r){e=e.concat(n.generateTracks(r))}),new m.AnimationClip(t.name,-1,e)}generateTracks(t){const e=[];let n=new m.Vector3,r=new m.Quaternion,s=new m.Vector3;if(t.transform&&t.transform.decompose(n,r,s),n=n.toArray(),r=new m.Euler().setFromQuaternion(r,t.eulerOrder).toArray(),s=s.toArray(),t.T!==void 0&&Object.keys(t.T.curves).length>0){const l=this.generateVectorTrack(t.modelName,t.T.curves,n,"position");l!==void 0&&e.push(l)}if(t.R!==void 0&&Object.keys(t.R.curves).length>0){const l=this.generateRotationTrack(t.modelName,t.R.curves,r,t.preRotation,t.postRotation,t.eulerOrder);l!==void 0&&e.push(l)}if(t.S!==void 0&&Object.keys(t.S.curves).length>0){const l=this.generateVectorTrack(t.modelName,t.S.curves,s,"scale");l!==void 0&&e.push(l)}if(t.DeformPercent!==void 0){const l=this.generateMorphTrack(t);l!==void 0&&e.push(l)}return e}generateVectorTrack(t,e,n,r){const s=this.getTimesForAllAxes(e),l=this.getKeyframeTrackValues(s,e,n);return new m.VectorKeyframeTrack(t+"."+r,s,l)}generateRotationTrack(t,e,n,r,s,l){e.x!==void 0&&(this.interpolateRotations(e.x),e.x.values=e.x.values.map(m.MathUtils.degToRad)),e.y!==void 0&&(this.interpolateRotations(e.y),e.y.values=e.y.values.map(m.MathUtils.degToRad)),e.z!==void 0&&(this.interpolateRotations(e.z),e.z.values=e.z.values.map(m.MathUtils.degToRad));const c=this.getTimesForAllAxes(e),u=this.getKeyframeTrackValues(c,e,n);r!==void 0&&(r=r.map(m.MathUtils.degToRad),r.push(l),r=new m.Euler().fromArray(r),r=new m.Quaternion().setFromEuler(r)),s!==void 0&&(s=s.map(m.MathUtils.degToRad),s.push(l),s=new m.Euler().fromArray(s),s=new m.Quaternion().setFromEuler(s).invert());const d=new m.Quaternion,p=new m.Euler,f=[];for(let y=0;y<u.length;y+=3)p.set(u[y],u[y+1],u[y+2],l),d.setFromEuler(p),r!==void 0&&d.premultiply(r),s!==void 0&&d.multiply(s),d.toArray(f,y/3*4);return new m.QuaternionKeyframeTrack(t+".quaternion",c,f)}generateMorphTrack(t){const e=t.DeformPercent.curves.morph,n=e.values.map(function(s){return s/100}),r=ft.getObjectByName(t.modelName).morphTargetDictionary[t.morphName];return new m.NumberKeyframeTrack(t.modelName+".morphTargetInfluences["+r+"]",e.times,n)}getTimesForAllAxes(t){let e=[];if(t.x!==void 0&&(e=e.concat(t.x.times)),t.y!==void 0&&(e=e.concat(t.y.times)),t.z!==void 0&&(e=e.concat(t.z.times)),e=e.sort(function(n,r){return n-r}),e.length>1){let n=1,r=e[0];for(let s=1;s<e.length;s++){const l=e[s];l!==r&&(e[n]=l,r=l,n++)}e=e.slice(0,n)}return e}getKeyframeTrackValues(t,e,n){const r=n,s=[];let l=-1,c=-1,u=-1;return t.forEach(function(d){if(e.x&&(l=e.x.times.indexOf(d)),e.y&&(c=e.y.times.indexOf(d)),e.z&&(u=e.z.times.indexOf(d)),l!==-1){const p=e.x.values[l];s.push(p),r[0]=p}else s.push(r[0]);if(c!==-1){const p=e.y.values[c];s.push(p),r[1]=p}else s.push(r[1]);if(u!==-1){const p=e.z.values[u];s.push(p),r[2]=p}else s.push(r[2])}),s}interpolateRotations(t){for(let e=1;e<t.values.length;e++){const n=t.values[e-1],r=t.values[e]-n,s=Math.abs(r);if(s>=180){const l=s/180,c=r/l;let u=n+c;const d=t.times[e-1],f=(t.times[e]-d)/l;let y=d+f;const v=[],b=[];for(;y<t.times[e];)v.push(y),y+=f,b.push(u),u+=c;t.times=el(t.times,e,v),t.values=el(t.values,e,b)}}}}class Ed{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(t){this.nodeStack.push(t),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(t,e){this.currentProp=t,this.currentPropName=e}parse(t){this.currentIndent=0,this.allNodes=new Qa,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const e=this,n=t.split(/[\r\n]+/);return n.forEach(function(r,s){const l=r.match(/^[\s\t]*;/),c=r.match(/^[\s\t]*$/);if(l||c)return;const u=r.match("^\\t{"+e.currentIndent+"}(\\w+):(.*){",""),d=r.match("^\\t{"+e.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),p=r.match("^\\t{"+(e.currentIndent-1)+"}}");u?e.parseNodeBegin(r,u):d?e.parseNodeProperty(r,d,n[++s]):p?e.popStack():r.match(/^[^\s\t}]/)&&e.parseNodePropertyContinued(r)}),this.allNodes}parseNodeBegin(t,e){const n=e[1].trim().replace(/^"/,"").replace(/"$/,""),r=e[2].split(",").map(function(u){return u.trim().replace(/^"/,"").replace(/"$/,"")}),s={name:n},l=this.parseNodeAttr(r),c=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(n,s):n in c?(n==="PoseNode"?c.PoseNode.push(s):c[n].id!==void 0&&(c[n]={},c[n][c[n].id]=c[n]),l.id!==""&&(c[n][l.id]=s)):typeof l.id=="number"?(c[n]={},c[n][l.id]=s):n!=="Properties70"&&(n==="PoseNode"?c[n]=[s]:c[n]=s),typeof l.id=="number"&&(s.id=l.id),l.name!==""&&(s.attrName=l.name),l.type!==""&&(s.attrType=l.type),this.pushStack(s)}parseNodeAttr(t){let e=t[0];t[0]!==""&&(e=parseInt(t[0]),isNaN(e)&&(e=t[0]));let n="",r="";return t.length>1&&(n=t[1].replace(/^(\w+)::/,""),r=t[2]),{id:e,name:n,type:r}}parseNodeProperty(t,e,n){let r=e[1].replace(/^"/,"").replace(/"$/,"").trim(),s=e[2].replace(/^"/,"").replace(/"$/,"").trim();r==="Content"&&s===","&&(s=n.replace(/"/g,"").replace(/,$/,"").trim());const l=this.getCurrentNode();if(l.name==="Properties70"){this.parseNodeSpecialProperty(t,r,s);return}if(r==="C"){const u=s.split(",").slice(1),d=parseInt(u[0]),p=parseInt(u[1]);let f=s.split(",").slice(3);f=f.map(function(y){return y.trim().replace(/^"/,"")}),r="connections",s=[d,p],rf(s,f),l[r]===void 0&&(l[r]=[])}r==="Node"&&(l.id=s),r in l&&Array.isArray(l[r])?l[r].push(s):r!=="a"?l[r]=s:l.a=s,this.setCurrentProp(l,r),r==="a"&&s.slice(-1)!==","&&(l.a=Fs(s))}parseNodePropertyContinued(t){const e=this.getCurrentNode();e.a+=t,t.slice(-1)!==","&&(e.a=Fs(e.a))}parseNodeSpecialProperty(t,e,n){const r=n.split('",').map(function(p){return p.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=r[0],l=r[1],c=r[2],u=r[3];let d=r[4];switch(l){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":d=parseFloat(d);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":d=Fs(d);break}this.getPrevNode()[s]={type:l,type2:c,flag:u,value:d},this.setCurrentProp(this.getPrevNode(),s)}}class qd{parse(t){const e=new Ja(t);e.skip(23);const n=e.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const r=new Qa;for(;!this.endOfContent(e);){const s=this.parseNode(e,n);s!==null&&r.add(s.name,s)}return r}endOfContent(t){return t.size()%16===0?(t.getOffset()+160+16&-16)>=t.size():t.getOffset()+160+16>=t.size()}parseNode(t,e){const n={},r=e>=7500?t.getUint64():t.getUint32(),s=e>=7500?t.getUint64():t.getUint32();e>=7500?t.getUint64():t.getUint32();const l=t.getUint8(),c=t.getString(l);if(r===0)return null;const u=[];for(let y=0;y<s;y++)u.push(this.parseProperty(t));const d=u.length>0?u[0]:"",p=u.length>1?u[1]:"",f=u.length>2?u[2]:"";for(n.singleProperty=s===1&&t.getOffset()===r;r>t.getOffset();){const y=this.parseNode(t,e);y!==null&&this.parseSubNode(c,n,y)}return n.propertyList=u,typeof d=="number"&&(n.id=d),p!==""&&(n.attrName=p),f!==""&&(n.attrType=f),c!==""&&(n.name=c),n}parseSubNode(t,e,n){if(n.singleProperty===!0){const r=n.propertyList[0];Array.isArray(r)?(e[n.name]=n,n.a=r):e[n.name]=r}else if(t==="Connections"&&n.name==="C"){const r=[];n.propertyList.forEach(function(s,l){l!==0&&r.push(s)}),e.connections===void 0&&(e.connections=[]),e.connections.push(r)}else if(n.name==="Properties70")Object.keys(n).forEach(function(s){e[s]=n[s]});else if(t==="Properties70"&&n.name==="P"){let r=n.propertyList[0],s=n.propertyList[1];const l=n.propertyList[2],c=n.propertyList[3];let u;r.indexOf("Lcl ")===0&&(r=r.replace("Lcl ","Lcl_")),s.indexOf("Lcl ")===0&&(s=s.replace("Lcl ","Lcl_")),s==="Color"||s==="ColorRGB"||s==="Vector"||s==="Vector3D"||s.indexOf("Lcl_")===0?u=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:u=n.propertyList[4],e[r]={type:s,type2:l,flag:c,value:u}}else e[n.name]===void 0?typeof n.id=="number"?(e[n.name]={},e[n.name][n.id]=n):e[n.name]=n:n.name==="PoseNode"?(Array.isArray(e[n.name])||(e[n.name]=[e[n.name]]),e[n.name].push(n)):e[n.name][n.id]===void 0&&(e[n.name][n.id]=n)}parseProperty(t){const e=t.getString(1);let n;switch(e){case"C":return t.getBoolean();case"D":return t.getFloat64();case"F":return t.getFloat32();case"I":return t.getInt32();case"L":return t.getInt64();case"R":return n=t.getUint32(),t.getArrayBuffer(n);case"S":return n=t.getUint32(),t.getString(n);case"Y":return t.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const r=t.getUint32(),s=t.getUint32(),l=t.getUint32();if(s===0)switch(e){case"b":case"c":return t.getBooleanArray(r);case"d":return t.getFloat64Array(r);case"f":return t.getFloat32Array(r);case"i":return t.getInt32Array(r);case"l":return t.getInt64Array(r)}const c=Bh(new Uint8Array(t.getArrayBuffer(l))),u=new Ja(c.buffer);switch(e){case"b":case"c":return u.getBooleanArray(r);case"d":return u.getFloat64Array(r);case"f":return u.getFloat32Array(r);case"i":return u.getInt32Array(r);case"l":return u.getInt64Array(r)}default:throw new Error("THREE.FBXLoader: Unknown property type "+e)}}}class Ja{constructor(t,e){this.dv=new DataView(t),this.offset=0,this.littleEndian=e!==void 0?e:!0}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(t){this.offset+=t}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(t){const e=[];for(let n=0;n<t;n++)e.push(this.getBoolean());return e}getUint8(){const t=this.dv.getUint8(this.offset);return this.offset+=1,t}getInt16(){const t=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,t}getInt32(){const t=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,t}getInt32Array(t){const e=[];for(let n=0;n<t;n++)e.push(this.getInt32());return e}getUint32(){const t=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,t}getInt64(){let t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),e&2147483648?(e=~e&4294967295,t=~t&4294967295,t===4294967295&&(e=e+1&4294967295),t=t+1&4294967295,-(e*4294967296+t)):e*4294967296+t}getInt64Array(t){const e=[];for(let n=0;n<t;n++)e.push(this.getInt64());return e}getUint64(){let t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),e*4294967296+t}getFloat32(){const t=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t}getFloat32Array(t){const e=[];for(let n=0;n<t;n++)e.push(this.getFloat32());return e}getFloat64(){const t=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t}getFloat64Array(t){const e=[];for(let n=0;n<t;n++)e.push(this.getFloat64());return e}getArrayBuffer(t){const e=this.dv.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e}getString(t){let e=[];for(let r=0;r<t;r++)e[r]=this.getUint8();const n=e.indexOf(0);return n>=0&&(e=e.slice(0,n)),lr(new Uint8Array(e))}}class Qa{add(t,e){this[t]=e}}function $d(a){const t="Kaydara FBX Binary \0";return a.byteLength>=t.length&&t===$a(a,0,t.length)}function ef(a){const t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let e=0;function n(r){const s=a[r-1];return a=a.slice(e+r),e++,s}for(let r=0;r<t.length;++r)if(n(1)===t[r])return!1;return!0}function Ha(a){const t=/FBXVersion: (\d+)/,e=a.match(t);if(e)return parseInt(e[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function tf(a){return a/46186158e3}const nf=[];function mi(a,t,e,n){let r;switch(n.mappingType){case"ByPolygonVertex":r=a;break;case"ByPolygon":r=t;break;case"ByVertice":r=e;break;case"AllSame":r=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}n.referenceType==="IndexToDirect"&&(r=n.indices[r]);const s=r*n.dataSize,l=s+n.dataSize;return sf(nf,n.buffer,s,l)}const As=new m.Euler,ur=new m.Vector3;function Ea(a){const t=new m.Matrix4,e=new m.Matrix4,n=new m.Matrix4,r=new m.Matrix4,s=new m.Matrix4,l=new m.Matrix4,c=new m.Matrix4,u=new m.Matrix4,d=new m.Matrix4,p=new m.Matrix4,f=new m.Matrix4,y=new m.Matrix4,v=a.inheritType?a.inheritType:0;if(a.translation&&t.setPosition(ur.fromArray(a.translation)),a.preRotation){const P=a.preRotation.map(m.MathUtils.degToRad);P.push(a.eulerOrder),e.makeRotationFromEuler(As.fromArray(P))}if(a.rotation){const P=a.rotation.map(m.MathUtils.degToRad);P.push(a.eulerOrder),n.makeRotationFromEuler(As.fromArray(P))}if(a.postRotation){const P=a.postRotation.map(m.MathUtils.degToRad);P.push(a.eulerOrder),r.makeRotationFromEuler(As.fromArray(P)),r.invert()}a.scale&&s.scale(ur.fromArray(a.scale)),a.scalingOffset&&c.setPosition(ur.fromArray(a.scalingOffset)),a.scalingPivot&&l.setPosition(ur.fromArray(a.scalingPivot)),a.rotationOffset&&u.setPosition(ur.fromArray(a.rotationOffset)),a.rotationPivot&&d.setPosition(ur.fromArray(a.rotationPivot)),a.parentMatrixWorld&&(f.copy(a.parentMatrix),p.copy(a.parentMatrixWorld));const b=e.clone().multiply(n).multiply(r),T=new m.Matrix4;T.extractRotation(p);const _=new m.Matrix4;_.copyPosition(p);const S=_.clone().invert().multiply(p),L=T.clone().invert().multiply(S),I=s,F=new m.Matrix4;if(v===0)F.copy(T).multiply(b).multiply(L).multiply(I);else if(v===1)F.copy(T).multiply(L).multiply(b).multiply(I);else{const k=new m.Matrix4().scale(new m.Vector3().setFromMatrixScale(f)).clone().invert(),N=L.clone().multiply(k);F.copy(T).multiply(b).multiply(N).multiply(I)}const K=d.clone().invert(),D=l.clone().invert();let O=t.clone().multiply(u).multiply(d).multiply(e).multiply(n).multiply(r).multiply(K).multiply(c).multiply(l).multiply(s).multiply(D);const V=new m.Matrix4().copyPosition(O),R=p.clone().multiply(V);return y.copyPosition(R),O=y.clone().multiply(F),O.premultiply(p.invert()),O}function qa(a){a=a||0;const t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return a===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[a]}function Fs(a){return a.split(",").map(function(e){return parseFloat(e)})}function $a(a,t,e){return t===void 0&&(t=0),e===void 0&&(e=a.byteLength),lr(new Uint8Array(a,t,e))}function rf(a,t){for(let e=0,n=a.length,r=t.length;e<r;e++,n++)a[n]=t[e]}function sf(a,t,e,n){for(let r=e,s=0;r<n;r++,s++)a[s]=t[r];return a}function el(a,t,e){return a.slice(0,t).concat(e).concat(a.slice(t))}class of extends m.DataTextureLoader{constructor(t){super(t),this.type=m.HalfFloatType}parse(t){const l=function(V,R){switch(V){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(R||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(R||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(R||""));default:case 4:throw new Error("THREE.RGBELoader: Memory Error: "+(R||""))}},p=`
|
|
98
98
|
`,f=function(V,R,P){R=R||1024;let N=V.pos,H=-1,Q=0,q="",J=String.fromCharCode.apply(null,new Uint16Array(V.subarray(N,N+128)));for(;0>(H=J.indexOf(p))&&Q<R&&N<V.byteLength;)q+=J,Q+=J.length,N+=128,J+=String.fromCharCode.apply(null,new Uint16Array(V.subarray(N,N+128)));return-1<H?(V.pos+=Q+H+1,q+J.slice(0,H)):!1},y=function(V){const R=/^#\?(\S+)/,P=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,k=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,N=/^\s*FORMAT=(\S+)\s*$/,H=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,Q={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let q,J;for((V.pos>=V.byteLength||!(q=f(V)))&&l(1,"no header found"),(J=q.match(R))||l(3,"bad initial token"),Q.valid|=1,Q.programtype=J[1],Q.string+=q+`
|
|
99
99
|
`;q=f(V),q!==!1;){if(Q.string+=q+`
|
|
100
100
|
`,q.charAt(0)==="#"){Q.comments+=q+`
|
|
101
|
-
`;continue}if((J=q.match(P))&&(Q.gamma=parseFloat(J[1])),(J=q.match(k))&&(Q.exposure=parseFloat(J[1])),(J=q.match(N))&&(Q.valid|=2,Q.format=J[1]),(J=q.match(H))&&(Q.valid|=4,Q.height=parseInt(J[1],10),Q.width=parseInt(J[2],10)),Q.valid&2&&Q.valid&4)break}return Q.valid&2||l(3,"missing format specifier"),Q.valid&4||l(3,"missing image size specifier"),Q},v=function(V,R,P){const k=R;if(k<8||k>32767||V[0]!==2||V[1]!==2||V[2]&128)return new Uint8Array(V);k!==(V[2]<<8|V[3])&&l(3,"wrong scanline width");const N=new Uint8Array(4*R*P);N.length||l(4,"unable to allocate buffer space");let H=0,Q=0;const q=4*k,J=new Uint8Array(4),oe=new Uint8Array(q);let ie=P;for(;ie>0&&Q<V.byteLength;){Q+4>V.byteLength&&l(1),J[0]=V[Q++],J[1]=V[Q++],J[2]=V[Q++],J[3]=V[Q++],(J[0]!=2||J[1]!=2||(J[2]<<8|J[3])!=k)&&l(3,"bad rgbe scanline format");let
|
|
101
|
+
`;continue}if((J=q.match(P))&&(Q.gamma=parseFloat(J[1])),(J=q.match(k))&&(Q.exposure=parseFloat(J[1])),(J=q.match(N))&&(Q.valid|=2,Q.format=J[1]),(J=q.match(H))&&(Q.valid|=4,Q.height=parseInt(J[1],10),Q.width=parseInt(J[2],10)),Q.valid&2&&Q.valid&4)break}return Q.valid&2||l(3,"missing format specifier"),Q.valid&4||l(3,"missing image size specifier"),Q},v=function(V,R,P){const k=R;if(k<8||k>32767||V[0]!==2||V[1]!==2||V[2]&128)return new Uint8Array(V);k!==(V[2]<<8|V[3])&&l(3,"wrong scanline width");const N=new Uint8Array(4*R*P);N.length||l(4,"unable to allocate buffer space");let H=0,Q=0;const q=4*k,J=new Uint8Array(4),oe=new Uint8Array(q);let ie=P;for(;ie>0&&Q<V.byteLength;){Q+4>V.byteLength&&l(1),J[0]=V[Q++],J[1]=V[Q++],J[2]=V[Q++],J[3]=V[Q++],(J[0]!=2||J[1]!=2||(J[2]<<8|J[3])!=k)&&l(3,"bad rgbe scanline format");let te=0,me;for(;te<q&&Q<V.byteLength;){me=V[Q++];const he=me>128;if(he&&(me-=128),(me===0||te+me>q)&&l(3,"bad scanline data"),he){const ve=V[Q++];for(let ke=0;ke<me;ke++)oe[te++]=ve}else oe.set(V.subarray(Q,Q+me),te),te+=me,Q+=me}const xe=k;for(let he=0;he<xe;he++){let ve=0;N[H]=oe[he+ve],ve+=k,N[H+1]=oe[he+ve],ve+=k,N[H+2]=oe[he+ve],ve+=k,N[H+3]=oe[he+ve],H+=4}ie--}return N},b=function(V,R,P,k){const N=V[R+3],H=Math.pow(2,N-128)/255;P[k+0]=V[R+0]*H,P[k+1]=V[R+1]*H,P[k+2]=V[R+2]*H,P[k+3]=1},T=function(V,R,P,k){const N=V[R+3],H=Math.pow(2,N-128)/255;P[k+0]=m.DataUtils.toHalfFloat(Math.min(V[R+0]*H,65504)),P[k+1]=m.DataUtils.toHalfFloat(Math.min(V[R+1]*H,65504)),P[k+2]=m.DataUtils.toHalfFloat(Math.min(V[R+2]*H,65504)),P[k+3]=m.DataUtils.toHalfFloat(1)},_=new Uint8Array(t);_.pos=0;const S=y(_),L=S.width,I=S.height,F=v(_.subarray(_.pos),L,I);let K,D,O;switch(this.type){case m.FloatType:O=F.length/4;const V=new Float32Array(O*4);for(let P=0;P<O;P++)b(F,P*4,V,P*4);K=V,D=m.FloatType;break;case m.HalfFloatType:O=F.length/4;const R=new Uint16Array(O*4);for(let P=0;P<O;P++)T(F,P*4,R,P*4);K=R,D=m.HalfFloatType;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:L,height:I,data:K,header:S.string,gamma:S.gamma,exposure:S.exposure,type:D}}setDataType(t){return this.type=t,this}load(t,e,n,r){function s(l,c){switch(l.type){case m.FloatType:case m.HalfFloatType:"colorSpace"in l?l.colorSpace="srgb-linear":l.encoding=3e3,l.minFilter=m.LinearFilter,l.magFilter=m.LinearFilter,l.generateMipmaps=!1,l.flipY=!0;break}e&&e(l,c)}return super.load(t,s,n,r)}}const Xs=new WeakMap;class af extends m.Loader{constructor(t){super(t),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(t){return this.decoderPath=t,this}setDecoderConfig(t){return this.decoderConfig=t,this}setWorkerLimit(t){return this.workerLimit=t,this}load(t,e,n,r){const s=new m.FileLoader(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,l=>{const c={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(l,c).then(e).catch(r)},n,r)}decodeDracoFile(t,e,n,r){const s={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!n};this.decodeGeometry(t,s).then(e)}decodeGeometry(t,e){for(const u in e.attributeTypes){const d=e.attributeTypes[u];d.BYTES_PER_ELEMENT!==void 0&&(e.attributeTypes[u]=d.name)}const n=JSON.stringify(e);if(Xs.has(t)){const u=Xs.get(t);if(u.key===n)return u.promise;if(t.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let r;const s=this.workerNextTaskID++,l=t.byteLength,c=this._getWorker(s,l).then(u=>(r=u,new Promise((d,p)=>{r._callbacks[s]={resolve:d,reject:p},r.postMessage({type:"decode",id:s,taskConfig:e,buffer:t},[t])}))).then(u=>this._createGeometry(u.geometry));return c.catch(()=>!0).then(()=>{r&&s&&this._releaseTask(r,s)}),Xs.set(t,{key:n,promise:c}),c}_createGeometry(t){const e=new m.BufferGeometry;t.index&&e.setIndex(new m.BufferAttribute(t.index.array,1));for(let n=0;n<t.attributes.length;n++){const r=t.attributes[n],s=r.name,l=r.array,c=r.itemSize;e.setAttribute(s,new m.BufferAttribute(l,c))}return e}_loadLibrary(t,e){const n=new m.FileLoader(this.manager);return n.setPath(this.decoderPath),n.setResponseType(e),n.setWithCredentials(this.withCredentials),new Promise((r,s)=>{n.load(t,r,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const t=typeof WebAssembly!="object"||this.decoderConfig.type==="js",e=[];return t?e.push(this._loadLibrary("draco_decoder.js","text")):(e.push(this._loadLibrary("draco_wasm_wrapper.js","text")),e.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(e).then(n=>{const r=n[0];t||(this.decoderConfig.wasmBinary=n[1]);const s=lf.toString(),l=["/* draco decoder */",r,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(`
|
|
102
102
|
`);this.workerSourceURL=URL.createObjectURL(new Blob([l]))}),this.decoderPending}_getWorker(t,e){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const r=new Worker(this.workerSourceURL);r._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:this.decoderConfig}),r.onmessage=function(s){const l=s.data;switch(l.type){case"decode":r._callbacks[l.id].resolve(l);break;case"error":r._callbacks[l.id].reject(l);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+l.type+'"')}},this.workerPool.push(r)}else this.workerPool.sort(function(r,s){return r._taskLoad>s._taskLoad?-1:1});const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[t]=e,n._taskLoad+=e,n})}_releaseTask(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]}debug(){console.log("Task load: ",this.workerPool.map(t=>t._taskLoad))}dispose(){for(let t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,this}}function lf(){let a,t;onmessage=function(l){const c=l.data;switch(c.type){case"init":a=c.decoderConfig,t=new Promise(function(p){a.onModuleLoaded=function(f){p({draco:f})},DracoDecoderModule(a)});break;case"decode":const u=c.buffer,d=c.taskConfig;t.then(p=>{const f=p.draco,y=new f.Decoder,v=new f.DecoderBuffer;v.Init(new Int8Array(u),u.byteLength);try{const b=e(f,y,v,d),T=b.attributes.map(_=>_.array.buffer);b.index&&T.push(b.index.array.buffer),self.postMessage({type:"decode",id:c.id,geometry:b},T)}catch(b){console.error(b),self.postMessage({type:"error",id:c.id,error:b.message})}finally{f.destroy(v),f.destroy(y)}});break}};function e(l,c,u,d){const p=d.attributeIDs,f=d.attributeTypes;let y,v;const b=c.GetEncodedGeometryType(u);if(b===l.TRIANGULAR_MESH)y=new l.Mesh,v=c.DecodeBufferToMesh(u,y);else if(b===l.POINT_CLOUD)y=new l.PointCloud,v=c.DecodeBufferToPointCloud(u,y);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!v.ok()||y.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+v.error_msg());const T={index:null,attributes:[]};for(const _ in p){const S=self[f[_]];let L,I;if(d.useUniqueIDs)I=p[_],L=c.GetAttributeByUniqueId(y,I);else{if(I=c.GetAttributeId(y,l[p[_]]),I===-1)continue;L=c.GetAttribute(y,I)}T.attributes.push(r(l,c,y,_,S,L))}return b===l.TRIANGULAR_MESH&&(T.index=n(l,c,y)),l.destroy(y),T}function n(l,c,u){const p=u.num_faces()*3,f=p*4,y=l._malloc(f);c.GetTrianglesUInt32Array(u,f,y);const v=new Uint32Array(l.HEAPF32.buffer,y,p).slice();return l._free(y),{array:v,itemSize:1}}function r(l,c,u,d,p,f){const y=f.num_components(),b=u.num_points()*y,T=b*p.BYTES_PER_ELEMENT,_=s(l,p),S=l._malloc(T);c.GetAttributeDataArrayForAllPoints(u,f,_,T,S);const L=new p(l.HEAPF32.buffer,S,b).slice();return l._free(S),{name:d,array:L,itemSize:y}}function s(l,c){switch(c){case Float32Array:return l.DT_FLOAT32;case Int8Array:return l.DT_INT8;case Int16Array:return l.DT_INT16;case Int32Array:return l.DT_INT32;case Uint8Array:return l.DT_UINT8;case Uint16Array:return l.DT_UINT16;case Uint32Array:return l.DT_UINT32}}}const tl=new m.Box3,gi=new m.Vector3;class nl extends m.InstancedBufferGeometry{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const t=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],e=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],n=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(n),this.setAttribute("position",new m.Float32BufferAttribute(t,3)),this.setAttribute("uv",new m.Float32BufferAttribute(e,2))}applyMatrix4(t){const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;return e!==void 0&&(e.applyMatrix4(t),n.applyMatrix4(t),e.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));const n=new m.InstancedInterleavedBuffer(e,6,1);return this.setAttribute("instanceStart",new m.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceEnd",new m.InterleavedBufferAttribute(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(t,e=3){let n;t instanceof Float32Array?n=t:Array.isArray(t)&&(n=new Float32Array(t));const r=new m.InstancedInterleavedBuffer(n,e*2,1);return this.setAttribute("instanceColorStart",new m.InterleavedBufferAttribute(r,e,0)),this.setAttribute("instanceColorEnd",new m.InterleavedBufferAttribute(r,e,e)),this}fromWireframeGeometry(t){return this.setPositions(t.attributes.position.array),this}fromEdgesGeometry(t){return this.setPositions(t.attributes.position.array),this}fromMesh(t){return this.fromWireframeGeometry(new m.WireframeGeometry(t.geometry)),this}fromLineSegments(t){const e=t.geometry;return this.setPositions(e.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new m.Box3);const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;t!==void 0&&e!==void 0&&(this.boundingBox.setFromBufferAttribute(t),tl.setFromBufferAttribute(e),this.boundingBox.union(tl))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new m.Sphere),this.boundingBox===null&&this.computeBoundingBox();const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(t!==void 0&&e!==void 0){const n=this.boundingSphere.center;this.boundingBox.getCenter(n);let r=0;for(let s=0,l=t.count;s<l;s++)gi.fromBufferAttribute(t,s),r=Math.max(r,n.distanceToSquared(gi)),gi.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(gi));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(t){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(t)}}class yi extends nl{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(t){const e=t.length-3,n=new Float32Array(2*e);for(let r=0;r<e;r+=3)n[2*r]=t[r],n[2*r+1]=t[r+1],n[2*r+2]=t[r+2],n[2*r+3]=t[r+3],n[2*r+4]=t[r+4],n[2*r+5]=t[r+5];return super.setPositions(n),this}setColors(t,e=3){const n=t.length-e,r=new Float32Array(2*n);if(e===3)for(let s=0;s<n;s+=e)r[2*s]=t[s],r[2*s+1]=t[s+1],r[2*s+2]=t[s+2],r[2*s+3]=t[s+3],r[2*s+4]=t[s+4],r[2*s+5]=t[s+5];else for(let s=0;s<n;s+=e)r[2*s]=t[s],r[2*s+1]=t[s+1],r[2*s+2]=t[s+2],r[2*s+3]=t[s+3],r[2*s+4]=t[s+4],r[2*s+5]=t[s+5],r[2*s+6]=t[s+6],r[2*s+7]=t[s+7];return super.setColors(r,e),this}fromLine(t){const e=t.geometry;return this.setPositions(e.attributes.position.array),this}}class Xr extends m.ShaderMaterial{constructor(t){super({type:"LineMaterial",uniforms:m.UniformsUtils.clone(m.UniformsUtils.merge([m.UniformsLib.common,m.UniformsLib.fog,{worldUnits:{value:1},linewidth:{value:1},resolution:{value:new m.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}}])),vertexShader:`
|
|
103
103
|
#include <common>
|
|
104
104
|
#include <fog_pars_vertex>
|
|
@@ -507,14 +507,14 @@
|
|
|
507
507
|
#include <premultiplied_alpha_fragment>
|
|
508
508
|
|
|
509
509
|
}
|
|
510
|
-
`,clipping:!0}),this.isLineMaterial=!0,this.onBeforeCompile=function(){this.transparent?this.defines.USE_LINE_COLOR_ALPHA="1":delete this.defines.USE_LINE_COLOR_ALPHA},Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(e){e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashed:{enumerable:!0,get:function(){return"USE_DASH"in this.defines},set(e){!!e!="USE_DASH"in this.defines&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},alphaToCoverage:{enumerable:!0,get:function(){return"USE_ALPHA_TO_COVERAGE"in this.defines},set:function(e){!!e!="USE_ALPHA_TO_COVERAGE"in this.defines&&(this.needsUpdate=!0),e===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(t)}}const ks=new m.Vector4,rl=new m.Vector3,il=new m.Vector3,Ee=new m.Vector4,qe=new m.Vector4,qt=new m.Vector4,Ds=new m.Vector3,zs=new m.Matrix4,$e=new m.Line3,sl=new m.Vector3,vi=new m.Box3,wi=new m.Sphere,$t=new m.Vector4;let en,Rn;function ol(a,t,e){return $t.set(0,0,-t,1).applyMatrix4(a.projectionMatrix),$t.multiplyScalar(1/$t.w),$t.x=Rn/e.width,$t.y=Rn/e.height,$t.applyMatrix4(a.projectionMatrixInverse),$t.multiplyScalar(1/$t.w),Math.abs(Math.max($t.x,$t.y))}function cf(a,t){const e=a.matrixWorld,n=a.geometry,r=n.attributes.instanceStart,s=n.attributes.instanceEnd,l=Math.min(n.instanceCount,r.count);for(let c=0,u=l;c<u;c++){$e.start.fromBufferAttribute(r,c),$e.end.fromBufferAttribute(s,c),$e.applyMatrix4(e);const d=new m.Vector3,p=new m.Vector3;en.distanceSqToSegment($e.start,$e.end,p,d),p.distanceTo(d)<Rn*.5&&t.push({point:p,pointOnLine:d,distance:en.origin.distanceTo(p),object:a,face:null,faceIndex:c,uv:null,[Ls]:null})}}function uf(a,t,e){const n=t.projectionMatrix,s=a.material.resolution,l=a.matrixWorld,c=a.geometry,u=c.attributes.instanceStart,d=c.attributes.instanceEnd,p=Math.min(c.instanceCount,u.count),f=-t.near;en.at(1,qt),qt.w=1,qt.applyMatrix4(t.matrixWorldInverse),qt.applyMatrix4(n),qt.multiplyScalar(1/qt.w),qt.x*=s.x/2,qt.y*=s.y/2,qt.z=0,Ds.copy(qt),zs.multiplyMatrices(t.matrixWorldInverse,l);for(let y=0,v=p;y<v;y++){if(Ee.fromBufferAttribute(u,y),qe.fromBufferAttribute(d,y),Ee.w=1,qe.w=1,Ee.applyMatrix4(zs),qe.applyMatrix4(zs),Ee.z>f&&qe.z>f)continue;if(Ee.z>f){const I=Ee.z-qe.z,F=(Ee.z-f)/I;Ee.lerp(qe,F)}else if(qe.z>f){const I=qe.z-Ee.z,F=(qe.z-f)/I;qe.lerp(Ee,F)}Ee.applyMatrix4(n),qe.applyMatrix4(n),Ee.multiplyScalar(1/Ee.w),qe.multiplyScalar(1/qe.w),Ee.x*=s.x/2,Ee.y*=s.y/2,qe.x*=s.x/2,qe.y*=s.y/2,$e.start.copy(Ee),$e.start.z=0,$e.end.copy(qe),$e.end.z=0;const T=$e.closestPointToPointParameter(Ds,!0);$e.at(T,sl);const _=m.MathUtils.lerp(Ee.z,qe.z,T),S=_>=-1&&_<=1,L=Ds.distanceTo(sl)<Rn*.5;if(S&&L){$e.start.fromBufferAttribute(u,y),$e.end.fromBufferAttribute(d,y),$e.start.applyMatrix4(l),$e.end.applyMatrix4(l);const I=new m.Vector3,F=new m.Vector3;en.distanceSqToSegment($e.start,$e.end,F,I),e.push({point:F,pointOnLine:I,distance:en.origin.distanceTo(F),object:a,face:null,faceIndex:y,uv:null,[Ls]:null})}}}class hf extends m.Mesh{constructor(t=new nl,e=new Xr({color:Math.random()*16777215})){super(t,e),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const t=this.geometry,e=t.attributes.instanceStart,n=t.attributes.instanceEnd,r=new Float32Array(2*e.count);for(let l=0,c=0,u=e.count;l<u;l++,c+=2)rl.fromBufferAttribute(e,l),il.fromBufferAttribute(n,l),r[c]=c===0?0:r[c-1],r[c+1]=r[c]+rl.distanceTo(il);const s=new m.InstancedInterleavedBuffer(r,2,1);return t.setAttribute("instanceDistanceStart",new m.InterleavedBufferAttribute(s,1,0)),t.setAttribute("instanceDistanceEnd",new m.InterleavedBufferAttribute(s,1,1)),this}raycast(t,e){const n=this.material.worldUnits,r=t.camera;r===null&&!n&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=t.params.Line2!==void 0&&t.params.Line2.threshold||0;en=t.ray;const l=this.matrixWorld,c=this.geometry,u=this.material;Rn=u.linewidth+s,c.boundingSphere===null&&c.computeBoundingSphere(),wi.copy(c.boundingSphere).applyMatrix4(l);let d;if(n)d=Rn*.5;else{const f=Math.max(r.near,wi.distanceToPoint(en.origin));d=ol(r,f,u.resolution)}if(wi.radius+=d,en.intersectsSphere(wi)===!1)return;c.boundingBox===null&&c.computeBoundingBox(),vi.copy(c.boundingBox).applyMatrix4(l);let p;if(n)p=Rn*.5;else{const f=Math.max(r.near,vi.distanceToPoint(en.origin));p=ol(r,f,u.resolution)}vi.expandByScalar(p),en.intersectsBox(vi)!==!1&&(n?cf(this,e):uf(this,r,e))}onBeforeRender(t){const e=this.material.uniforms;e&&e.resolution&&(t.getViewport(ks),this.material.uniforms.resolution.value.set(ks.z,ks.w))}}class Os extends hf{constructor(t=new yi,e=new Xr({color:Math.random()*16777215})){super(t,e),this.isLine2=!0,this.type="Line2"}}var hr=Object.freeze({Linear:Object.freeze({None:function(a){return a},In:function(a){return this.None(a)},Out:function(a){return this.None(a)},InOut:function(a){return this.None(a)}}),Quadratic:Object.freeze({In:function(a){return a*a},Out:function(a){return a*(2-a)},InOut:function(a){return(a*=2)<1?.5*a*a:-.5*(--a*(a-2)-1)}}),Cubic:Object.freeze({In:function(a){return a*a*a},Out:function(a){return--a*a*a+1},InOut:function(a){return(a*=2)<1?.5*a*a*a:.5*((a-=2)*a*a+2)}}),Quartic:Object.freeze({In:function(a){return a*a*a*a},Out:function(a){return 1- --a*a*a*a},InOut:function(a){return(a*=2)<1?.5*a*a*a*a:-.5*((a-=2)*a*a*a-2)}}),Quintic:Object.freeze({In:function(a){return a*a*a*a*a},Out:function(a){return--a*a*a*a*a+1},InOut:function(a){return(a*=2)<1?.5*a*a*a*a*a:.5*((a-=2)*a*a*a*a+2)}}),Sinusoidal:Object.freeze({In:function(a){return 1-Math.sin((1-a)*Math.PI/2)},Out:function(a){return Math.sin(a*Math.PI/2)},InOut:function(a){return .5*(1-Math.sin(Math.PI*(.5-a)))}}),Exponential:Object.freeze({In:function(a){return a===0?0:Math.pow(1024,a-1)},Out:function(a){return a===1?1:1-Math.pow(2,-10*a)},InOut:function(a){return a===0?0:a===1?1:(a*=2)<1?.5*Math.pow(1024,a-1):.5*(-Math.pow(2,-10*(a-1))+2)}}),Circular:Object.freeze({In:function(a){return 1-Math.sqrt(1-a*a)},Out:function(a){return Math.sqrt(1- --a*a)},InOut:function(a){return(a*=2)<1?-.5*(Math.sqrt(1-a*a)-1):.5*(Math.sqrt(1-(a-=2)*a)+1)}}),Elastic:Object.freeze({In:function(a){return a===0?0:a===1?1:-Math.pow(2,10*(a-1))*Math.sin((a-1.1)*5*Math.PI)},Out:function(a){return a===0?0:a===1?1:Math.pow(2,-10*a)*Math.sin((a-.1)*5*Math.PI)+1},InOut:function(a){return a===0?0:a===1?1:(a*=2,a<1?-.5*Math.pow(2,10*(a-1))*Math.sin((a-1.1)*5*Math.PI):.5*Math.pow(2,-10*(a-1))*Math.sin((a-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(a){var t=1.70158;return a===1?1:a*a*((t+1)*a-t)},Out:function(a){var t=1.70158;return a===0?0:--a*a*((t+1)*a+t)+1},InOut:function(a){var t=2.5949095;return(a*=2)<1?.5*(a*a*((t+1)*a-t)):.5*((a-=2)*a*((t+1)*a+t)+2)}}),Bounce:Object.freeze({In:function(a){return 1-hr.Bounce.Out(1-a)},Out:function(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375},InOut:function(a){return a<.5?hr.Bounce.In(a*2)*.5:hr.Bounce.Out(a*2-1)*.5+.5}}),generatePow:function(a){return a===void 0&&(a=4),a=a<Number.EPSILON?Number.EPSILON:a,a=a>1e4?1e4:a,{In:function(t){return Math.pow(t,a)},Out:function(t){return 1-Math.pow(1-t,a)},InOut:function(t){return t<.5?Math.pow(t*2,a)/2:(1-Math.pow(2-t*2,a))/2+.5}}}}),kr=function(){return performance.now()},df=function(){function a(){this._tweens={},this._tweensAddedDuringUpdate={}}return a.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(e){return t._tweens[e]})},a.prototype.removeAll=function(){this._tweens={}},a.prototype.add=function(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t},a.prototype.remove=function(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]},a.prototype.update=function(t,e){t===void 0&&(t=kr()),e===void 0&&(e=!1);var n=Object.keys(this._tweens);if(n.length===0)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r<n.length;r++){var s=this._tweens[n[r]],l=!e;s&&s.update(t,l)===!1&&!e&&delete this._tweens[n[r]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},a}(),Ks={Linear:function(a,t){var e=a.length-1,n=e*t,r=Math.floor(n),s=Ks.Utils.Linear;return t<0?s(a[0],a[1],n):t>1?s(a[e],a[e-1],e-n):s(a[r],a[r+1>e?e:r+1],n-r)},Utils:{Linear:function(a,t,e){return(t-a)*e+a}}},al=function(){function a(){}return a.nextId=function(){return a._nextId++},a._nextId=0,a}(),Rs=new df,ll=function(){function a(t,e){e===void 0&&(e=Rs),this._object=t,this._group=e,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=hr.Linear.None,this._interpolationFunction=Ks.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=al.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return a.prototype.getId=function(){return this._id},a.prototype.isPlaying=function(){return this._isPlaying},a.prototype.isPaused=function(){return this._isPaused},a.prototype.getDuration=function(){return this._duration},a.prototype.to=function(t,e){if(e===void 0&&(e=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=t,this._propertiesAreSetUp=!1,this._duration=e<0?0:e,this},a.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t<0?0:t,this},a.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},a.prototype.start=function(t,e){if(t===void 0&&(t=kr()),e===void 0&&(e=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||e){if(this._propertiesAreSetUp=!0,!this._isDynamic){var r={};for(var s in this._valuesEnd)r[s]=this._valuesEnd[s];this._valuesEnd=r}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,e)}return this},a.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},a.prototype._setupProperties=function(t,e,n,r,s){for(var l in n){var c=t[l],u=Array.isArray(c),d=u?"array":typeof c,p=!u&&Array.isArray(n[l]);if(!(d==="undefined"||d==="function")){if(p){var f=n[l];if(f.length===0)continue;for(var y=[c],v=0,b=f.length;v<b;v+=1){var T=this._handleRelativeValue(c,f[v]);if(isNaN(T)){p=!1,console.warn("Found invalid interpolation list. Skipping.");break}y.push(T)}p&&(n[l]=y)}if((d==="object"||u)&&c&&!p){e[l]=u?[]:{};var _=c;for(var S in _)e[l][S]=_[S];r[l]=u?[]:{};var f=n[l];if(!this._isDynamic){var L={};for(var S in f)L[S]=f[S];n[l]=f=L}this._setupProperties(_,e[l],f,r[l],s)}else(typeof e[l]>"u"||s)&&(e[l]=c),u||(e[l]*=1),p?r[l]=n[l].slice().reverse():r[l]=e[l]||0}}},a.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},a.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},a.prototype.pause=function(t){return t===void 0&&(t=kr()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this._group&&this._group.remove(this),this)},a.prototype.resume=function(t){return t===void 0&&(t=kr()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},a.prototype.stopChainedTweens=function(){for(var t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this},a.prototype.group=function(t){return t===void 0&&(t=Rs),this._group=t,this},a.prototype.delay=function(t){return t===void 0&&(t=0),this._delayTime=t,this},a.prototype.repeat=function(t){return t===void 0&&(t=0),this._initialRepeat=t,this._repeat=t,this},a.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},a.prototype.yoyo=function(t){return t===void 0&&(t=!1),this._yoyo=t,this},a.prototype.easing=function(t){return t===void 0&&(t=hr.Linear.None),this._easingFunction=t,this},a.prototype.interpolation=function(t){return t===void 0&&(t=Ks.Linear),this._interpolationFunction=t,this},a.prototype.chain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._chainedTweens=t,this},a.prototype.onStart=function(t){return this._onStartCallback=t,this},a.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},a.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},a.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},a.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},a.prototype.onStop=function(t){return this._onStopCallback=t,this},a.prototype.update=function(t,e){var n=this,r;if(t===void 0&&(t=kr()),e===void 0&&(e=!0),this._isPaused)return!0;var s,l=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(t>l)return!1;e&&this.start(t,!0)}if(this._goToEnd=!1,t<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var c=t-this._startTime,u=this._duration+((r=this._repeatDelayTime)!==null&&r!==void 0?r:this._delayTime),d=this._duration+this._repeat*u,p=function(){if(n._duration===0||c>d)return 1;var _=Math.trunc(c/u),S=c-_*u,L=Math.min(S/n._duration,1);return L===0&&c===n._duration?1:L},f=p(),y=this._easingFunction(f);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,y),this._onUpdateCallback&&this._onUpdateCallback(this._object,f),this._duration===0||c>=this._duration)if(this._repeat>0){var v=Math.min(Math.trunc((c-this._duration)/u)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=v);for(s in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[s]=="string"&&(this._valuesStartRepeat[s]=this._valuesStartRepeat[s]+parseFloat(this._valuesEnd[s])),this._yoyo&&this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=u*v,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var b=0,T=this._chainedTweens.length;b<T;b++)this._chainedTweens[b].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},a.prototype._updateProperties=function(t,e,n,r){for(var s in n)if(e[s]!==void 0){var l=e[s]||0,c=n[s],u=Array.isArray(t[s]),d=Array.isArray(c),p=!u&&d;p?t[s]=this._interpolationFunction(c,r):typeof c=="object"&&c?this._updateProperties(t[s],l,c,r):(c=this._handleRelativeValue(l,c),typeof c=="number"&&(t[s]=l+(c-l)*r))}},a.prototype._handleRelativeValue=function(t,e){return typeof e!="string"?e:e.charAt(0)==="+"||e.charAt(0)==="-"?t+parseFloat(e):parseFloat(e)},a.prototype._swapEndStartRepeatValues=function(t){var e=this._valuesStartRepeat[t],n=this._valuesEnd[t];typeof n=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(n):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=e},a}();al.nextId;var tn=Rs;tn.getAll.bind(tn),tn.removeAll.bind(tn),tn.add.bind(tn),tn.remove.bind(tn);var ff=tn.update.bind(tn);function Ys(a,t,e){if(a==null||a==="")throw new Error(e||`Parameter "${t}" is required but received: ${a}`);return a}function cl(a,t,e){const n=t.split(".");let r=a;for(const s of n){if(r[s]===void 0||r[s]===null)throw new Error(`Property "${t}" is required but missing at path: "${s}"`);r=r[s]}return r}function pf(a,t,e,n=0,r=1){const s=(a-t)*(r-n)/(e-t)+n,l=Math.min(n,r),c=Math.max(n,r);return s<l?l:s>c?c:s||0}class ul extends m.EventDispatcher{constructor(e,n={}){super();G(this,"scene");G(this,"renderer");G(this,"camera");G(this,"controls");G(this,"ambLight");G(this,"dirLight");G(this,"auxDirLight");G(this,"clouds",null);G(this,"container");G(this,"_clock",new m.Clock);G(this,"stats");G(this,"_animationCallbacks",new Set);G(this,"_fogFactor",1);G(this,"_sceneSize",5e4*2);G(this,"gorund");G(this,"map");G(this,"centerPostion");G(this,"_isInteracting",!1);G(this,"debug",!1);const{antialias:r=!1,stencil:s=!0,logarithmicDepthBuffer:l=!0,skybox:c,map:u}=n;this.map=u,this.centerPostion=this.map.geo2world(new m.Vector3(this.map.center[0],this.map.center[1],0)),this.renderer=this._createRenderer(r,s,l),this.scene=this._createScene(c),this.camera=this._createCamera(),e&&this.addTo(e),this.controls=this._createControls(),this.ambLight=this._createAmbLight(),this.scene.add(this.ambLight),this.dirLight=this._createDirLight(),this.scene.add(this.dirLight),this.scene.add(this.dirLight.target),this.auxDirLight=this._createAuxDirLight(),this.gorund=this._createGorund(),this.scene.add(this.gorund),this.renderer.setAnimationLoop(this.animate.bind(this)),this.debug=n.debug||!1,this.debug&&(this.stats=new Cr,document.body.appendChild(this.stats.dom))}get fogFactor(){return this._fogFactor}get isInteracting(){return this._isInteracting}set fogFactor(e){this._fogFactor=e,this.controls.dispatchEvent({type:"change",target:this.controls})}get width(){return this.container?.clientWidth||0}get height(){return this.container?.clientHeight||0}addTo(e){const n=typeof e=="string"?document.querySelector(e):e;if(n instanceof HTMLElement)this.container=n,n.appendChild(this.renderer.domElement),new ResizeObserver(this.resize.bind(this)).observe(n);else throw`${e} not found!}`;return this}_createScene(e){const n=new m.Scene,r=e?.defaultColor||"rgb(21,48,94)";if(n.background=new m.Color(r),n.fog=new m.FogExp2(r,2e-4),e?.files){const s=new m.CubeTextureLoader;e.path&&s.setPath(e.path),s.load(e.files,l=>{n.background=l},void 0,l=>{console.error("Error loading skybox:",l),n.background=new m.Color(r)})}else e?.hdr&&this._loadHDRWithPMREM(n,e);return n}async _loadHDRWithPMREM(e,n){try{if(n){const s=await new of().setPath(n.path||"").setDataType(m.FloatType).loadAsync(n.hdr);s.colorSpace=this.renderer.outputColorSpace,s.mapping=303,s.needsUpdate=!0,e.background=s,e.environment=s}}catch(r){console.error("加载HDR失败:",r),e.background=new m.Color(n?.defaultColor||14414079)}}_createRenderer(e,n,r){const s=new m.WebGLRenderer({antialias:e,logarithmicDepthBuffer:r,stencil:n,alpha:!0,precision:"highp",powerPreference:"high-performance",failIfMajorPerformanceCaveat:!0});return s.debug.checkShaderErrors=!0,s.sortObjects=!0,s.setPixelRatio(window.devicePixelRatio),s.domElement.tabIndex=0,s.shadowMap.enabled=!0,s.shadowMap.needsUpdate=!0,s.shadowMap.type=m.PCFSoftShadowMap,s.toneMapping=m.ACESFilmicToneMapping,s.toneMappingExposure=1,s}_createCamera(){return new m.PerspectiveCamera(45,this.getAspect(),.1,this._sceneSize*2)}_createControls(){const e=new rd(this.camera,this.renderer.domElement),n=Math.PI/2.1;return e.screenSpacePanning=!1,e.minDistance=.1,e.maxDistance=3e4*2,e.maxPolarAngle=n,e.enableDamping=!0,e.dampingFactor=.08,e.keyPanSpeed=1,e.listenToKeyEvents(this.renderer.domElement),e.addEventListener("change",()=>{const r=Math.max(e.getPolarAngle(),.1),s=Math.max(e.getDistance(),100);e.zoomSpeed=Math.max(Math.log(s/1e3),1)+3;const l=3e5*2;e.maxDistance>l*.95&&(e.maxDistance=l*.95),this.camera.far=m.MathUtils.clamp(s/r*8,100,l),this.camera.near=m.MathUtils.clamp(this.camera.far/1e3,.001,1),this.camera.updateProjectionMatrix(),this.scene.fog instanceof m.FogExp2&&(this.scene.fog.density=r/(s+5)*this.fogFactor*.1);const u=s>6e4;e.minAzimuthAngle=u?0:-1/0,e.maxAzimuthAngle=u?0:1/0,e.maxPolarAngle=pf(e.getDistance(),0,7e4,n,0),this.map?.trigger("control-change",{type:"control-change",control:e,camera:this.camera,target:this.map})}),e.addEventListener("start",()=>{this._isInteracting=!0,this.map?.trigger("control-start",{type:"control-start",control:e,camera:this.camera,target:this.map})}),e.addEventListener("end",()=>{this._isInteracting=!1,this.map?.trigger("control-end",{type:"control-end",control:e,camera:this.camera,target:this.map})}),e}_createAmbLight(){return new m.AmbientLight(16777215,.1)}_createDirLight(){const y=new m.DirectionalLight("rgb(255, 255, 255)",3);y.position.set(this.centerPostion.x+55e3*1.2,55e3*2,this.centerPostion.z+55e3*1);const v=new m.Object3D;if(v.position.copy(this.centerPostion),this.scene.add(v),y.target=v,y.castShadow=!0,y.shadow.mapSize.width=1024*10,y.shadow.mapSize.height=1024*10,y.shadow.camera.near=1,y.shadow.camera.far=192500,y.shadow.camera.left=-55e3,y.shadow.camera.bottom=-55e3,y.shadow.camera.top=55e3,y.shadow.camera.right=55e3,y.shadow.radius=1,y.shadow.bias=-0,this.debug){const b=new m.CameraHelper(y.shadow.camera);b.name="dirLightCameraHelper",this.scene.add(b)}return y}_createAuxDirLight(){const c=this._createAuxLightInstance(this.centerPostion.x+-66e3,82500,this.centerPostion.z+-55e3,.5);c.name="AuxDirLight_BackFill",this.scene.add(c),this.scene.add(c.target);const f=this._createAuxLightInstance(this.centerPostion.x+55e3*-1,55e3*1.5,this.centerPostion.z+55e3*1.2,.5);f.name="AuxDirLight_LeftRim",this.scene.add(f),this.scene.add(f.target);const T=this._createAuxLightInstance(this.centerPostion.x+55e3*1,55e3*1.5,this.centerPostion.z+55e3*-1.2,.5);return T.name="AuxDirLight_RightRim",this.scene.add(T),this.scene.add(T.target),c}_createAuxLightInstance(e,n,r,s){const l=new m.DirectionalLight(16777215,s);l.position.set(e,n,r);const c=new m.Object3D;return c.position.copy(this.centerPostion),this.scene.add(c),l.target=c,l.castShadow=!1,l}resize(){const e=this.width,n=this.height;return this.renderer.setSize(e,n),this.camera.aspect=e/n,this.camera.updateProjectionMatrix(),this.renderer.render(this.scene,this.camera),this}addAnimationCallback(e){return this._animationCallbacks.add(e),()=>this._animationCallbacks.delete(e)}animate(){const e=this._clock.getDelta(),n=this._clock.getElapsedTime();this._animationCallbacks.forEach(r=>r(e,n,this)),this.controls.update(),this.renderer.render(this.scene,this.camera),ff(),this.stats&&this.stats.update(),this.dispatchEvent({type:"update",delta:e})}flyTo(e,n,r=!0,s){if(this.controls.target.copy(e),r){const l=this.camera.position;new ll(l).to({y:2e7,z:0},500).chain(new ll(l).to(n,2e3).easing(hr.Quintic.Out).onComplete(c=>s&&s(c))).start()}else this.camera.position.copy(n)}getState(){return{centerPosition:this.controls.target,cameraPosition:this.camera.position}}_bindMap(e){e&&(this.map=e)}getMap(){return this.map?this.map:null}getAspect(){const[e,n]=this.getWidthHeight();return e/n}getWidthHeight(){let e=window.innerWidth,n=window.innerHeight;return[e,n]}_createGorund(){const e=this.centerPostion,n=new m.MeshStandardMaterial({transparent:!1,color:new m.Color("rgb(45,52,60)").multiplyScalar(.7),metalness:.2,roughness:1}),r=new m.PlaneGeometry(this._sceneSize*2,this._sceneSize*2),s=new m.Mesh(r,n);return s.name="地面",s.castShadow=!1,s.receiveShadow=!1,s.position.y=0,s.position.add(e),s.rotateX(-Math.PI/2),s.visible=!1,s}}var Dr=(a=>(a[a.none=0]="none",a[a.create=1]="create",a[a.remove=2]="remove",a))(Dr||{});function mf(a,t){const e=a.position.clone().setZ(a.maxZ).applyMatrix4(a.matrixWorld);return t.distanceTo(e)}function gf(a){const t=a.scale,e=new m.Vector3(-t.x,-t.y,0).applyMatrix4(a.matrixWorld),n=new m.Vector3(t.x,t.y,0).applyMatrix4(a.matrixWorld);return e.sub(n).length()}function yf(a){return a.distToCamera/a.sizeInWorld*.8}function vf(a,t,e,n){const r=yf(a);if(a.isLeaf){if(a.inFrustum&&a.z<e&&(a.z<t||a.showing)&&(a.z<t||r<n))return 1}else if(a.z>=t&&(a.z>e||r>n))return 2;return 0}function wf(a,t,e,n){const r=[],s=n+1,l=t*2,c=0,u=.25;{const d=e*2,p=new m.Vector3(.5,.5,1),f=new nn(l,d,s),y=new nn(l+1,d,s),v=new nn(l,d+1,s),b=new nn(l+1,d+1,s);f.position.set(-u,u,c),f.scale.copy(p),y.position.set(u,u,c),y.scale.copy(p),v.position.set(-u,-u,c),v.scale.copy(p),b.position.set(u,-u,c),b.scale.copy(p),r.push(f,y,v,b)}return r}const bf=10,xf=new m.InstancedBufferGeometry,_f=new m.Vector3,Mf=new m.Matrix4,Lf=new m.Box3(new m.Vector3(-.5,-.5,0),new m.Vector3(.5,.5,1)),hl=new m.Frustum,Bn=class Bn extends m.Mesh{constructor(e=0,n=0,r=0){super(xf,[]);G(this,"_dataOnlyMode",!1);G(this,"vectorData",null);G(this,"x");G(this,"y");G(this,"z");G(this,"isTile",!0);G(this,"parent",null);G(this,"children",[]);G(this,"_ready",!1);G(this,"_isDummy",!1);G(this,"_showing",!1);G(this,"_maxZ",0);G(this,"distToCamera",0);G(this,"sizeInWorld",0);G(this,"_loaded",!1);G(this,"_inFrustum",!1);this.x=e,this.y=n,this.z=r,this.name=`Tile ${r}-${e}-${n}`,this.up.set(0,0,1),this.matrixAutoUpdate=!1}setDataOnlyMode(e){return this._dataOnlyMode=e,e&&(this.visible=!1),this}isDataOnlyMode(){return this._dataOnlyMode}getVectorData(){return this.vectorData}static get downloadThreads(){return Bn._downloadThreads}get isDummy(){return this._isDummy}get showing(){return this._showing}set showing(e){const n=this._showing;this._showing=e,this.material.forEach(r=>r.visible=e),n===!1&&this._showing===!0&&this._loaded&&this.dispatchEvent({type:"tile-shown",tile:this}),n===!0&&this._showing===!1&&this.dispatchEvent({type:"tile-hidden",tile:this})}get maxZ(){return this._maxZ}set maxZ(e){this._maxZ=e}get index(){return this.parent?this.parent.children.indexOf(this):-1}get loaded(){return this._loaded}get inFrustum(){return this._inFrustum}set inFrustum(e){this._inFrustum=e}get isLeaf(){return this.children.filter(e=>e.isTile).length===0}traverse(e){e(this),this.children.forEach(n=>{n.isTile&&n.traverse(e)})}traverseVisible(e){this.visible&&(e(this),this.children.forEach(n=>{n.isTile&&n.traverseVisible(e)}))}raycast(e,n){this.showing&&this.loaded&&this.isTile&&super.raycast(e,n)}LOD(e){if(Bn.downloadThreads>bf)return{action:Dr.none};let n=[];const{loader:r,minLevel:s,maxLevel:l,LODThreshold:c}=e,u=vf(this,s,l,c);return u===Dr.create&&(n=wf(r,this.x,this.y,this.z),this.add(...n)),{action:u,newTiles:n}}_checkVisible(){const e=this.parent;if(e&&e.isTile){const n=e.children.filter(s=>s.isTile),r=n.every(s=>s.loaded);e.showing=!r,n.forEach(s=>s.showing=r)}return this}async _load(e){Bn._downloadThreads++;const{x:n,y:r,z:s}=this;if(this._dataOnlyMode)try{const l=await e.load({x:n,y:r,z:s,bounds:[-1/0,-1/0,1/0,1/0]});this.vectorData=l.geometry?.userData||{},this._loaded=!0,this.dispatchEvent({type:"vector-data-loaded",data:this.vectorData,tile:this})}catch(l){console.error(`数据模式加载失败 ${s}/${n}/${r}:`,l),this._loaded=!1}else{const l=await e.load({x:n,y:r,z:s,bounds:[-1/0,-1/0,1/0,1/0]});this.material=l.materials,this.geometry=l.geometry,this.maxZ=this.geometry.boundingBox?.max.z||0,this._loaded=!0}return Bn._downloadThreads--,this}_init(){this.updateMatrix(),this.updateMatrixWorld(),this.sizeInWorld=gf(this)}update(e){if(console.assert(this.z===0),!this.parent)return this;hl.setFromProjectionMatrix(Mf.multiplyMatrices(e.camera.projectionMatrix,e.camera.matrixWorldInverse));const n=e.camera.getWorldPosition(_f);return this.traverse(r=>{r.receiveShadow=this.receiveShadow,r.castShadow=this.castShadow;const s=Lf.clone().applyMatrix4(r.matrixWorld);s.max.setY(9e3),r.inFrustum=hl.intersectsBox(s),r.distToCamera=mf(r,n);const{action:l,newTiles:c}=r.LOD(e);this._doAction(r,l,c,e)}),this._checkReady(),this}_doAction(e,n,r,s){return n===Dr.create?r?.forEach(l=>{l._init(),l._isDummy=l.z<s.minLevel,this.dispatchEvent({type:"tile-created",tile:l}),l.isDummy||l._load(s.loader).then(()=>{l._checkVisible(),this.dispatchEvent({type:"tile-loaded",tile:l})})}):n===Dr.remove&&(e.showing=!0,e._unLoad(!1,s.loader),this.dispatchEvent({type:"tile-unload",tile:e})),this}reload(e){return this._unLoad(!0,e),this}_checkReady(){return this._ready||(this._ready=!0,this.traverse(e=>{if(e.isLeaf&&e.loaded&&!e.isDummy){this._ready=!1;return}}),this._ready&&this.dispatchEvent({type:"ready"})),this}_unLoad(e,n){return e&&this.isTile&&!this.isDummy&&(this.dispatchEvent({type:"unload"}),n?.unload?.(this)),this.children.forEach(r=>r._unLoad(!0,n)),this.clear(),this}};G(Bn,"_downloadThreads",0);let nn=Bn;class dl{constructor(t=0){G(this,"_lon0",0);this._lon0=t}get lon0(){return this._lon0}getTileXWithCenterLon(t,e){const n=Math.pow(2,e);let r=t+Math.round(n/360*this._lon0);return r>=n?r-=n:r<0&&(r+=n),r}getTileXYZproj(t,e,n){const r=this.mapWidth,s=this.mapHeight/2,l=t/Math.pow(2,n)*r-r/2,c=s-e/Math.pow(2,n)*s*2;return{x:l,y:c}}getProjBoundsFromLonLat(t){const e=t[0]===-180&&t[2]===180,n=this.project(t[0]+(e?this._lon0:0),t[1]),r=this.project(t[2]+(e?this._lon0:0),t[3]);return[Math.min(n.x,r.x),Math.min(n.y,r.y),Math.max(n.x,r.x),Math.max(n.y,r.y)]}getProjBoundsFromXYZ(t,e,n){const r=this.getTileXYZproj(t,e,n),s=this.getTileXYZproj(t+1,e+1,n);return[Math.min(r.x,s.x),Math.min(r.y,s.y),Math.max(r.x,s.x),Math.max(r.y,s.y)]}getLonLatBoundsFromXYZ(t,e,n){const r=this.getProjBoundsFromXYZ(t,e,n),s=this.unProject(r[0],r[1]),l=this.unProject(r[2],r[3]);return[s.lon,s.lat,l.lon,l.lat]}}const zr=6378e3;class fl extends dl{constructor(){super(...arguments);G(this,"ID","3857");G(this,"mapWidth",2*Math.PI*zr);G(this,"mapHeight",this.mapWidth);G(this,"mapDepth",1)}project(e,n){const r=(e-this.lon0)*(Math.PI/180),s=n*(Math.PI/180),l=zr*r,c=zr*Math.log(Math.tan(Math.PI/4+s/2));return{x:l,y:c}}unProject(e,n){let r=e/zr*(180/Math.PI)+this.lon0;return r>180&&(r-=360),{lat:(2*Math.atan(Math.exp(n/zr))-Math.PI/2)*(180/Math.PI),lon:r}}}class Sf extends dl{constructor(){super(...arguments);G(this,"ID","4326");G(this,"mapWidth",36e3);G(this,"mapHeight",18e3);G(this,"mapDepth",1)}project(e,n){return{x:(e-this.lon0)*100,y:n*100}}unProject(e,n){return{lon:e/100+this.lon0,lat:n/100}}}const Tf={createFromID:(a="3857",t)=>{let e;switch(a){case"3857":e=new fl(t);break;case"4326":e=new Sf(t);break;default:throw new Error(`Projection ID: ${a} is not supported.`)}return e}};function Us(a,t){const e=a.getLayers().find(r=>r.isBaseLayer===!0)?._rootTile,n=t.intersectObjects([e]);for(const r of n)if(r.object instanceof nn){const s=a.worldToLocal(r.point.clone()),l=a.map2geo(s);return Object.assign(r,{location:l})}}function Bs(a,t){const e=new m.Vector3(0,-1,0),n=new m.Vector3(t.x,10*1e3,t.z),r=new m.Raycaster(n,e);return Us(a,r)}function pl(a,t,e){const n=new m.Raycaster;return n.setFromCamera(e,a),Us(t,n)}function Gf(a,t=128){const e=document.createElement("canvas"),n=e.getContext("2d");if(!n)throw new Error("Failed to get canvas context");e.width=t,e.height=t;const r=t/2,s=t/2;return n.imageSmoothingEnabled=!1,n.fillStyle="#000022",n.strokeStyle="DarkGoldenrod",n.lineWidth=5,n.moveTo(r,3),n.lineTo(r,t),n.stroke(),n.closePath(),n.lineWidth=2,n.beginPath(),n.roundRect(2,2,t-4,s-8,10),n.closePath(),n.fill(),n.stroke(),n.font="24px Arial",n.fillStyle="Goldenrod",n.strokeStyle="black",n.textAlign="center",n.textBaseline="top",n.strokeText(a,r,20),n.fillText(a,r,20),e}function Zf(a,t=128){const e=new m.CanvasTexture(Gf(a,t)),n=new m.SpriteMaterial({map:e,sizeAttenuation:!1}),r=new m.Sprite(n);return r.visible=!1,r.center.set(.5,.3),r.scale.setScalar(.11),r.renderOrder=999,r}class bi extends m.Mesh{constructor(e){super();G(this,"name","map");G(this,"_clock",new m.Clock);G(this,"isLOD",!0);G(this,"autoUpdate",!0);G(this,"updateInterval",100);G(this,"_minLevel",2);G(this,"_layers",new Map);G(this,"_maxLevel",19);G(this,"_projection",new fl(0));G(this,"_LODThreshold",1);this.up.set(0,0,1);const{minLevel:n=2,maxLevel:r=19}=e;this.minLevel=n,this.maxLevel=r}get minLevel(){return this._minLevel}set minLevel(e){this._minLevel=e}get maxLevel(){return this._maxLevel}set maxLevel(e){this._maxLevel=e}get lon0(){return this.projection.lon0}get projection(){return this._projection}get LODThreshold(){return this._LODThreshold}set LODThreshold(e){this._LODThreshold=e}static create(e){return new bi(e)}update(e){if(!this.autoUpdate)return;const n=this._clock.getElapsedTime();n>this.updateInterval/1e3&&(this._layers.forEach(r=>{r.enabled&&r.visible&&r.update(e)}),this._clock.start(),this.dispatchEvent({type:"update",delta:n}))}dispose(){this.removeFromParent()}geo2pos(e){return this.geo2map(e)}geo2map(e){const n=this.projection.project(e.x,e.y);return new m.Vector3(n.x,n.y,e.z)}geo2world(e){return this.localToWorld(this.geo2map(e))}pos2geo(e){return this.map2geo(e)}map2geo(e){const n=this.projection.unProject(e.x,e.y);return new m.Vector3(n.lon,n.lat,e.z)}world2geo(e){return this.pos2geo(this.worldToLocal(e.clone()))}getLocalInfoFromGeo(e){const n=this.geo2world(e);return Bs(this,n)}getLocalInfoFromWorld(e){return Bs(this,e)}getLocalInfoFromScreen(e,n){return pl(e,this,n)}get downloading(){return nn.downloadThreads}addLayer(e){return this._layers.has(e.layerId)&&console.warn(`图层 ${e.layerid} 已存在,将被替换`),this._layers.set(e.layerId,e),this.add(e),this}removeLayer(e){const n=this._layers.get(e);return n?(this._layers.delete(e),this.remove(n),n.dispose(),console.log(`✅ 图层 ${e} 移除成功`),!0):(console.warn(`⚠️ 图层 ${e} 不存在`),!1)}getLayer(e){return this._layers.get(e)}getLayerIds(){return Array.from(this._layers.keys())}clearLayers(){return this._layers.forEach(e=>{this.remove(e),e.dispose()}),this._layers.clear(),console.log("✅ 所有图层已清空"),this}getLayers(){return Array.from(this._layers.values())}}class Ns{constructor(){G(this,"_dispatcher",new m.EventDispatcher);G(this,"_listenerMap",new Map)}on(t,e){const n=r=>e(r.data||r);return this._listenerMap.has(t)||this._listenerMap.set(t,new Map),this._listenerMap.get(t).set(e,n),this._dispatcher.addEventListener(t,n),this}once(t,e){const n=r=>{this.off(t,n),e(r.data||r)};return this.on(t,n)}off(t,e){const n=this._listenerMap.get(t);if(!n)return this;const r=n.get(e);return r&&(this._dispatcher.removeEventListener(t,r),n.delete(e),n.size===0&&this._listenerMap.delete(t)),this}trigger(t,e){const n={type:t,data:e};return this._dispatcher.dispatchEvent(n),this}get threeEventDispatcher(){return this._dispatcher}}function If(a,t){return a.replace(/\{(\w+)\}/g,(e,n)=>{if(t.hasOwnProperty(n)){const r=t[n];return r!==void 0?String(r):e}throw new Error(`缺少必要参数: ${n}`)})}function js(a,...t){for(let e=0;e<t.length;e++){const n=t[e];for(const r in n)a[r]=n[r]}return a}function Js(a){return a==null}function Or(a){return Js(a)?!1:typeof a=="function"||a.constructor!==null&&a.constructor===Function}function Wf(a=new Date){const t=a.getFullYear().toString(),e=(a.getMonth()+1).toString().padStart(2,"0"),n=a.getDate().toString().padStart(2,"0"),r=a.getHours().toString().padStart(2,"0"),s=a.getMinutes().toString().padStart(2,"0"),l=a.getSeconds().toString().padStart(2,"0");return`${t}-${e}-${n} ${r}:${s}:${l}`}class Pf{}class ml extends xi(_i(Pf)){constructor(e){super();G(this,"target");G(this,"dom");G(this,"_enabled",!1);this.target=e}enable(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)}disable(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this}enabled(){return!!this._enabled}remove(){this.disable(),delete this.target,delete this.dom}}const gl=Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"&&!process.versions.electron&&!process.versions.nw&&!process.versions["node-webkit"];let Kr={};function yl(){return window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI}if(!gl){const a=navigator.userAgent.toLowerCase(),t=document.documentElement||{style:{}},e="ActiveXObject"in window,n=a.indexOf("webkit")!==-1,r=a.indexOf("phantom")!==-1,s=a.search("android [23]")!==-1,l=a.indexOf("chrome")!==-1,c=a.indexOf("gecko")!==-1&&!n&&!("opera"in window)&&!e,u=/iphone/i.test(a)&&/micromessenger/i.test(a),d=typeof orientation<"u"||a.indexOf("mobile")!==-1,p=!window.PointerEvent&&"MSPointerEvent"in window,f=window.PointerEvent&&navigator.pointerEnabled||p,y=e&&"transition"in t.style,v="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!s,b="MozPerspective"in t.style,T="OTransition"in t.style,_=(y||v||b)&&!T&&!r,S=typeof window<"u"&&Or(window.createImageBitmap),L=typeof window<"u"&&Or(window.ResizeObserver),I=typeof window<"u"&&Or(window.btoa),F=typeof window<"u"&&Or(window.Proxy),K=typeof window<"u"&&Or(window.requestIdleCallback);let D=0;if(l){const N=a.match(/chrome\/([\d.]+)/);D=N?N[1]:0}const O=!r&&(f||"ontouchstart"in window||"DocumentTouch"in window&&document instanceof window.DocumentTouch),V=typeof window<"u"&&"WebGLRenderingContext"in window,R=yl();let P=!1;try{new OffscreenCanvas(2,2).getContext("2d"),P=!0}catch{P=!1}let k=!1;try{window.addEventListener("testPassive",()=>{},{get passive(){return k=!0,!0}})}catch{}Kr={IS_NODE:gl,isTest:!1,ie:e,ielt9:e&&!document.addEventListener,edge:"msLaunchUri"in navigator&&!("documentMode"in document),webkit:n,gecko:c,android:a.indexOf("android")!==-1,android23:s,chrome:l,chromeVersion:D,safari:!l&&a.indexOf("safari")!==-1,phantomjs:r,ie3d:y,webkit3d:v,gecko3d:b,opera12:T,any3d:_,iosWeixin:u,mobile:d,mobileWebkit:d&&n,mobileWebkit3d:d&&v,mobileOpera:d&&"opera"in window,mobileGecko:d&&c,touch:!!O,msPointer:!!p,pointer:!!f,retina:R>1,devicePixelRatio:R,language:navigator.browserLanguage?navigator.browserLanguage:navigator.language,ie9:e&&document.documentMode===9,ie10:e&&document.documentMode===10,webgl:V,imageBitMap:S,resizeObserver:L,btoa:I,decodeImageInWorker:P,monitorDPRChange:!0,supportsPassive:k,proxy:F,requestIdleCallback:K,checkDevicePixelRatio:()=>{if(typeof window<"u"&&Kr.monitorDPRChange){const N=yl(),H=N!==Kr.devicePixelRatio;return H&&(Kr.devicePixelRatio=N),H}return!1}}}const Cf=Kr;function xi(a){return class extends a{constructor(...e){super(...e);G(this,"eventClass",new Ns);G(this,"on",this.eventClass.on.bind(this.eventClass));G(this,"trigger",this.eventClass.trigger.bind(this.eventClass));G(this,"off",this.eventClass.off.bind(this.eventClass));this.eventClass=new Ns}}}function _i(a){return class extends a{constructor(...e){super(...e);G(this,"options");G(this,"_isUpdatingOptions");G(this,"_initHooksCalled");G(this,"_initHooks");const n=Object.getPrototypeOf(this).options||{},r=js({},n,e[0]||{});this.setOptions(r),this.callInitHooks(),this._isUpdatingOptions=!1}proxyOptions(){return Cf.proxy?(this.options=new Proxy(this.options,{set:(e,n,r)=>{if(n=n,e[n]===r||(e[n]=r,this._isUpdatingOptions))return!0;const s={};return s[n]=r,this.config(s),!0}}),this):this}callInitHooks(){const e=Object.getPrototypeOf(this);return this._visitInitHooks(e),this}setOptions(e){if((!this.hasOwnProperty("options")||Js(this.options))&&(this.options=this.options?Object.create(this.options):{}),!e)return this;for(const n in e)this.options[n]=e[n];return this}config(e,n){if(this._isUpdatingOptions=!0,e){if(arguments.length===2&&typeof e=="string"){const r={};r[e]=n,e=r}e=e;for(const r in e)this.options[r]=e[r],this[r]&&this[r]instanceof ml&&(e[r]?this[r].enable():this[r].disable());this.onConfig(e),this._isUpdatingOptions=!1}else{const r={};for(const s in this.options)this.options.hasOwnProperty(s)&&(r[s]=this.options[s]);return this._isUpdatingOptions=!1,r}return this}onConfig(e){}_visitInitHooks(e){if(this._initHooksCalled)return;const n=Object.getPrototypeOf(e);n._visitInitHooks&&n._visitInitHooks.call(this,n),this._initHooksCalled=!0;const r=e._initHooks;if(r&&r!==n._initHooks)for(let s=0;s<r.length;s++)r[s].call(this)}static mergeOptions(e){const n=this.prototype,r=Object.getPrototypeOf(n);return n.hasOwnProperty("options")?n.options===r.options&&(n.options=Object.create(n.options)):n.options={},js(n.options,e),this}static addInitHook(e,...n){const r=typeof e=="function"?e:function(){this[e].apply(this,n)},s=this.prototype,l=Object.getPrototypeOf(s);return(!s._initHooks||s._initHooks===l._initHooks)&&(s._initHooks=[]),s._initHooks.push(r),this}static include(...e){for(let n=0;n<e.length;n++)js(this.prototype,e[n]);return this}}}function Qs(a){return class extends a{constructor(...n){super(...n);G(this,"_handlers");this._handlers=[]}addHandler(n,r){if(!r)return this;if(this._handlers||(this._handlers=[]),this[n])return this[n].enable(),this;const s=this[n]=new r(this);return this._handlers.push(s),this.options[n]&&s.enable(),this}removeHandler(n){if(!n)return this;const r=this[n];if(r&&this._handlers){const s=this._handlers.indexOf(r);s>=0&&this._handlers.splice(s,1),this[n].remove(),delete this[n]}return this}_clearHandlers(){if(this._handlers){for(let n=0,r=this._handlers.length;n<r;n++)this._handlers[n].remove();this._handlers=[]}}}}const Vf={attribution:"",visible:!0,opacity:1,zIndex:0,isSceneLayer:!1,altitude:0};class Mi extends Qs(xi(_i(m.Group))){constructor(e,n){super();G(this,"_id");G(this,"opacity",1);G(this,"_animationCallbacks",new Set);G(this,"isSceneLayer",!1);G(this,"_altitude",0);Ys(e,"id","图层ID必须指定"),n&&(this.opacity=n.opacity||1,this.isSceneLayer=n.isSceneLayer??!1,n.altitude!==void 0&&this.setAltitude(n.altitude)),this._id=e,typeof this.animate=="function"&&this._registerAnimate()}getId(){return this._id}addTo(e){return e.addLayer(this),this}getZIndex(){return 0}getOpacity(){return this.opacity}setOpacity(e){this.opacity=e,this.traverse(n=>{"material"in n&&(Array.isArray(n.material)?n.material:[n.material]).forEach(s=>{"opacity"in s&&(s.transparent=e<1,s.opacity=e,s.needsUpdate=!0)}),n instanceof m.Sprite&&(n.material.opacity=e,n.material.transparent=e<1,n.material.needsUpdate=!0)})}getMap(){return this.map?this.map:null}show(){return this.visible||(this.visible=!0,this.options.visible=!0,this.getMap()),this}hide(){return this.visible&&(this.visible=!1,this.options.visible=!1,this.getMap()),this}setAltitude(e){return this.position.y=e,this.updateMatrix(),this.updateMatrixWorld(!0),this}getAltitude(){return this.position.y}_bindMap(e){e&&(this.map=e,typeof this.animate=="function"&&this._registerAnimate())}_registerAnimate(){const e=this.getMap();if(!e?.viewer)return;const n=e.viewer.addAnimationCallback((r,s,l)=>{this.animate?.(r,s,l)});this._animationCallbacks.add(n)}_clearAnimationCallbacks(){this._animationCallbacks.forEach(e=>e()),this._animationCallbacks.clear()}getOptions(){return{...this.options}}}Mi.mergeOptions(Vf);const Ci=class Ci{constructor(t){G(this,"_cache",new Map);G(this,"_gltfLoader");G(this,"_fbxLoader");G(this,"_dracoLoader");this._gltfLoader=new sd(t),this._fbxLoader=new jd(t)}static init(t){return this._instance||(this._instance=new Ci(t)),this._instance}async load(t){const e=`${t.type}:${t.url}`;if(this._cache.has(e))return this._cloneCachedModel(e,t);t.type==="gltf"&&t.dracoOptions?.enable&&this._initDracoLoader(t.dracoOptions.decoderPath);let n,r;try{if(t.type==="gltf"){const s=await this._gltfLoader.loadAsync(t.url);n=s.scene,r=s.animations}else n=await this._fbxLoader.loadAsync(t.url),r=n.animations;return this._cache.set(e,{model:n,animations:r}),{model:this._processModel(n.clone(),t),animations:r?.map(s=>({...s,name:s.name||"unnamed"}))||[]}}catch(s){throw console.error(`加载${t.type}模型失败:`,t.url,s),s}}_initDracoLoader(t="/draco/"){this._dracoLoader||(this._dracoLoader=new af,this._dracoLoader.setDecoderPath(t),this._gltfLoader.setDRACOLoader(this._dracoLoader))}_cloneCachedModel(t,e){const r=this._cache.get(t).model.clone();return this._processModel(r,e)}_processModel(t,e){return e.position&&t.position.copy(e.position),e.scale&&(typeof e.scale=="number"?t.scale.setScalar(e.scale):e.scale.x!==void 0||e.scale.y!==void 0||e.scale.z!==void 0?(e.scale.x!==void 0&&(t.scale.x=e.scale.x),e.scale.y!==void 0&&(t.scale.y=e.scale.y),e.scale.z!==void 0&&(t.scale.z=e.scale.z)):t.scale.copy(e.scale)),e.rotation&&t.rotation.set(e.rotation.x,e.rotation.y,e.rotation.z),e.materialOverrides&&t.traverse(n=>{if(n instanceof m.Mesh&&n.material){const r=e.materialOverrides[n.name];r&&(n.material=r)}}),t.traverse(n=>{n instanceof m.Mesh&&n.material}),t}};G(Ci,"_instance");let Hs=Ci;const Es=(a,t)=>{"updateRanges"in a?a.updateRanges[0]=t:a.updateRange=t},vl=new m.Matrix4,Li=new m.Vector3,Si=new m.Quaternion,wl=new m.Vector3,bl=new m.Quaternion,Rr=new m.Vector3,Af=a=>class extends a{constructor(){super();const t=parseInt(m.REVISION.replace(/\D+/g,""))>=154?"opaque_fragment":"output_fragment";this.onBeforeCompile=e=>{e.vertexShader=`attribute float cloudOpacity;
|
|
510
|
+
`,clipping:!0}),this.isLineMaterial=!0,this.onBeforeCompile=function(){this.transparent?this.defines.USE_LINE_COLOR_ALPHA="1":delete this.defines.USE_LINE_COLOR_ALPHA},Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(e){e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashed:{enumerable:!0,get:function(){return"USE_DASH"in this.defines},set(e){!!e!="USE_DASH"in this.defines&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},alphaToCoverage:{enumerable:!0,get:function(){return"USE_ALPHA_TO_COVERAGE"in this.defines},set:function(e){!!e!="USE_ALPHA_TO_COVERAGE"in this.defines&&(this.needsUpdate=!0),e===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(t)}}const ks=new m.Vector4,rl=new m.Vector3,il=new m.Vector3,Ee=new m.Vector4,qe=new m.Vector4,qt=new m.Vector4,Ds=new m.Vector3,zs=new m.Matrix4,$e=new m.Line3,sl=new m.Vector3,vi=new m.Box3,wi=new m.Sphere,$t=new m.Vector4;let en,Yn;function ol(a,t,e){return $t.set(0,0,-t,1).applyMatrix4(a.projectionMatrix),$t.multiplyScalar(1/$t.w),$t.x=Yn/e.width,$t.y=Yn/e.height,$t.applyMatrix4(a.projectionMatrixInverse),$t.multiplyScalar(1/$t.w),Math.abs(Math.max($t.x,$t.y))}function cf(a,t){const e=a.matrixWorld,n=a.geometry,r=n.attributes.instanceStart,s=n.attributes.instanceEnd,l=Math.min(n.instanceCount,r.count);for(let c=0,u=l;c<u;c++){$e.start.fromBufferAttribute(r,c),$e.end.fromBufferAttribute(s,c),$e.applyMatrix4(e);const d=new m.Vector3,p=new m.Vector3;en.distanceSqToSegment($e.start,$e.end,p,d),p.distanceTo(d)<Yn*.5&&t.push({point:p,pointOnLine:d,distance:en.origin.distanceTo(p),object:a,face:null,faceIndex:c,uv:null,[Ls]:null})}}function uf(a,t,e){const n=t.projectionMatrix,s=a.material.resolution,l=a.matrixWorld,c=a.geometry,u=c.attributes.instanceStart,d=c.attributes.instanceEnd,p=Math.min(c.instanceCount,u.count),f=-t.near;en.at(1,qt),qt.w=1,qt.applyMatrix4(t.matrixWorldInverse),qt.applyMatrix4(n),qt.multiplyScalar(1/qt.w),qt.x*=s.x/2,qt.y*=s.y/2,qt.z=0,Ds.copy(qt),zs.multiplyMatrices(t.matrixWorldInverse,l);for(let y=0,v=p;y<v;y++){if(Ee.fromBufferAttribute(u,y),qe.fromBufferAttribute(d,y),Ee.w=1,qe.w=1,Ee.applyMatrix4(zs),qe.applyMatrix4(zs),Ee.z>f&&qe.z>f)continue;if(Ee.z>f){const I=Ee.z-qe.z,F=(Ee.z-f)/I;Ee.lerp(qe,F)}else if(qe.z>f){const I=qe.z-Ee.z,F=(qe.z-f)/I;qe.lerp(Ee,F)}Ee.applyMatrix4(n),qe.applyMatrix4(n),Ee.multiplyScalar(1/Ee.w),qe.multiplyScalar(1/qe.w),Ee.x*=s.x/2,Ee.y*=s.y/2,qe.x*=s.x/2,qe.y*=s.y/2,$e.start.copy(Ee),$e.start.z=0,$e.end.copy(qe),$e.end.z=0;const T=$e.closestPointToPointParameter(Ds,!0);$e.at(T,sl);const _=m.MathUtils.lerp(Ee.z,qe.z,T),S=_>=-1&&_<=1,L=Ds.distanceTo(sl)<Yn*.5;if(S&&L){$e.start.fromBufferAttribute(u,y),$e.end.fromBufferAttribute(d,y),$e.start.applyMatrix4(l),$e.end.applyMatrix4(l);const I=new m.Vector3,F=new m.Vector3;en.distanceSqToSegment($e.start,$e.end,F,I),e.push({point:F,pointOnLine:I,distance:en.origin.distanceTo(F),object:a,face:null,faceIndex:y,uv:null,[Ls]:null})}}}class hf extends m.Mesh{constructor(t=new nl,e=new Xr({color:Math.random()*16777215})){super(t,e),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const t=this.geometry,e=t.attributes.instanceStart,n=t.attributes.instanceEnd,r=new Float32Array(2*e.count);for(let l=0,c=0,u=e.count;l<u;l++,c+=2)rl.fromBufferAttribute(e,l),il.fromBufferAttribute(n,l),r[c]=c===0?0:r[c-1],r[c+1]=r[c]+rl.distanceTo(il);const s=new m.InstancedInterleavedBuffer(r,2,1);return t.setAttribute("instanceDistanceStart",new m.InterleavedBufferAttribute(s,1,0)),t.setAttribute("instanceDistanceEnd",new m.InterleavedBufferAttribute(s,1,1)),this}raycast(t,e){const n=this.material.worldUnits,r=t.camera;r===null&&!n&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=t.params.Line2!==void 0&&t.params.Line2.threshold||0;en=t.ray;const l=this.matrixWorld,c=this.geometry,u=this.material;Yn=u.linewidth+s,c.boundingSphere===null&&c.computeBoundingSphere(),wi.copy(c.boundingSphere).applyMatrix4(l);let d;if(n)d=Yn*.5;else{const f=Math.max(r.near,wi.distanceToPoint(en.origin));d=ol(r,f,u.resolution)}if(wi.radius+=d,en.intersectsSphere(wi)===!1)return;c.boundingBox===null&&c.computeBoundingBox(),vi.copy(c.boundingBox).applyMatrix4(l);let p;if(n)p=Yn*.5;else{const f=Math.max(r.near,vi.distanceToPoint(en.origin));p=ol(r,f,u.resolution)}vi.expandByScalar(p),en.intersectsBox(vi)!==!1&&(n?cf(this,e):uf(this,r,e))}onBeforeRender(t){const e=this.material.uniforms;e&&e.resolution&&(t.getViewport(ks),this.material.uniforms.resolution.value.set(ks.z,ks.w))}}class Os extends hf{constructor(t=new yi,e=new Xr({color:Math.random()*16777215})){super(t,e),this.isLine2=!0,this.type="Line2"}}var hr=Object.freeze({Linear:Object.freeze({None:function(a){return a},In:function(a){return this.None(a)},Out:function(a){return this.None(a)},InOut:function(a){return this.None(a)}}),Quadratic:Object.freeze({In:function(a){return a*a},Out:function(a){return a*(2-a)},InOut:function(a){return(a*=2)<1?.5*a*a:-.5*(--a*(a-2)-1)}}),Cubic:Object.freeze({In:function(a){return a*a*a},Out:function(a){return--a*a*a+1},InOut:function(a){return(a*=2)<1?.5*a*a*a:.5*((a-=2)*a*a+2)}}),Quartic:Object.freeze({In:function(a){return a*a*a*a},Out:function(a){return 1- --a*a*a*a},InOut:function(a){return(a*=2)<1?.5*a*a*a*a:-.5*((a-=2)*a*a*a-2)}}),Quintic:Object.freeze({In:function(a){return a*a*a*a*a},Out:function(a){return--a*a*a*a*a+1},InOut:function(a){return(a*=2)<1?.5*a*a*a*a*a:.5*((a-=2)*a*a*a*a+2)}}),Sinusoidal:Object.freeze({In:function(a){return 1-Math.sin((1-a)*Math.PI/2)},Out:function(a){return Math.sin(a*Math.PI/2)},InOut:function(a){return .5*(1-Math.sin(Math.PI*(.5-a)))}}),Exponential:Object.freeze({In:function(a){return a===0?0:Math.pow(1024,a-1)},Out:function(a){return a===1?1:1-Math.pow(2,-10*a)},InOut:function(a){return a===0?0:a===1?1:(a*=2)<1?.5*Math.pow(1024,a-1):.5*(-Math.pow(2,-10*(a-1))+2)}}),Circular:Object.freeze({In:function(a){return 1-Math.sqrt(1-a*a)},Out:function(a){return Math.sqrt(1- --a*a)},InOut:function(a){return(a*=2)<1?-.5*(Math.sqrt(1-a*a)-1):.5*(Math.sqrt(1-(a-=2)*a)+1)}}),Elastic:Object.freeze({In:function(a){return a===0?0:a===1?1:-Math.pow(2,10*(a-1))*Math.sin((a-1.1)*5*Math.PI)},Out:function(a){return a===0?0:a===1?1:Math.pow(2,-10*a)*Math.sin((a-.1)*5*Math.PI)+1},InOut:function(a){return a===0?0:a===1?1:(a*=2,a<1?-.5*Math.pow(2,10*(a-1))*Math.sin((a-1.1)*5*Math.PI):.5*Math.pow(2,-10*(a-1))*Math.sin((a-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(a){var t=1.70158;return a===1?1:a*a*((t+1)*a-t)},Out:function(a){var t=1.70158;return a===0?0:--a*a*((t+1)*a+t)+1},InOut:function(a){var t=2.5949095;return(a*=2)<1?.5*(a*a*((t+1)*a-t)):.5*((a-=2)*a*((t+1)*a+t)+2)}}),Bounce:Object.freeze({In:function(a){return 1-hr.Bounce.Out(1-a)},Out:function(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375},InOut:function(a){return a<.5?hr.Bounce.In(a*2)*.5:hr.Bounce.Out(a*2-1)*.5+.5}}),generatePow:function(a){return a===void 0&&(a=4),a=a<Number.EPSILON?Number.EPSILON:a,a=a>1e4?1e4:a,{In:function(t){return Math.pow(t,a)},Out:function(t){return 1-Math.pow(1-t,a)},InOut:function(t){return t<.5?Math.pow(t*2,a)/2:(1-Math.pow(2-t*2,a))/2+.5}}}}),kr=function(){return performance.now()},df=function(){function a(){this._tweens={},this._tweensAddedDuringUpdate={}}return a.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(e){return t._tweens[e]})},a.prototype.removeAll=function(){this._tweens={}},a.prototype.add=function(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t},a.prototype.remove=function(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]},a.prototype.update=function(t,e){t===void 0&&(t=kr()),e===void 0&&(e=!1);var n=Object.keys(this._tweens);if(n.length===0)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r<n.length;r++){var s=this._tweens[n[r]],l=!e;s&&s.update(t,l)===!1&&!e&&delete this._tweens[n[r]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},a}(),Ks={Linear:function(a,t){var e=a.length-1,n=e*t,r=Math.floor(n),s=Ks.Utils.Linear;return t<0?s(a[0],a[1],n):t>1?s(a[e],a[e-1],e-n):s(a[r],a[r+1>e?e:r+1],n-r)},Utils:{Linear:function(a,t,e){return(t-a)*e+a}}},al=function(){function a(){}return a.nextId=function(){return a._nextId++},a._nextId=0,a}(),Rs=new df,ll=function(){function a(t,e){e===void 0&&(e=Rs),this._object=t,this._group=e,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=hr.Linear.None,this._interpolationFunction=Ks.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=al.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return a.prototype.getId=function(){return this._id},a.prototype.isPlaying=function(){return this._isPlaying},a.prototype.isPaused=function(){return this._isPaused},a.prototype.getDuration=function(){return this._duration},a.prototype.to=function(t,e){if(e===void 0&&(e=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=t,this._propertiesAreSetUp=!1,this._duration=e<0?0:e,this},a.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t<0?0:t,this},a.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},a.prototype.start=function(t,e){if(t===void 0&&(t=kr()),e===void 0&&(e=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||e){if(this._propertiesAreSetUp=!0,!this._isDynamic){var r={};for(var s in this._valuesEnd)r[s]=this._valuesEnd[s];this._valuesEnd=r}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,e)}return this},a.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},a.prototype._setupProperties=function(t,e,n,r,s){for(var l in n){var c=t[l],u=Array.isArray(c),d=u?"array":typeof c,p=!u&&Array.isArray(n[l]);if(!(d==="undefined"||d==="function")){if(p){var f=n[l];if(f.length===0)continue;for(var y=[c],v=0,b=f.length;v<b;v+=1){var T=this._handleRelativeValue(c,f[v]);if(isNaN(T)){p=!1,console.warn("Found invalid interpolation list. Skipping.");break}y.push(T)}p&&(n[l]=y)}if((d==="object"||u)&&c&&!p){e[l]=u?[]:{};var _=c;for(var S in _)e[l][S]=_[S];r[l]=u?[]:{};var f=n[l];if(!this._isDynamic){var L={};for(var S in f)L[S]=f[S];n[l]=f=L}this._setupProperties(_,e[l],f,r[l],s)}else(typeof e[l]>"u"||s)&&(e[l]=c),u||(e[l]*=1),p?r[l]=n[l].slice().reverse():r[l]=e[l]||0}}},a.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},a.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},a.prototype.pause=function(t){return t===void 0&&(t=kr()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this._group&&this._group.remove(this),this)},a.prototype.resume=function(t){return t===void 0&&(t=kr()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},a.prototype.stopChainedTweens=function(){for(var t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this},a.prototype.group=function(t){return t===void 0&&(t=Rs),this._group=t,this},a.prototype.delay=function(t){return t===void 0&&(t=0),this._delayTime=t,this},a.prototype.repeat=function(t){return t===void 0&&(t=0),this._initialRepeat=t,this._repeat=t,this},a.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},a.prototype.yoyo=function(t){return t===void 0&&(t=!1),this._yoyo=t,this},a.prototype.easing=function(t){return t===void 0&&(t=hr.Linear.None),this._easingFunction=t,this},a.prototype.interpolation=function(t){return t===void 0&&(t=Ks.Linear),this._interpolationFunction=t,this},a.prototype.chain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._chainedTweens=t,this},a.prototype.onStart=function(t){return this._onStartCallback=t,this},a.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},a.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},a.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},a.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},a.prototype.onStop=function(t){return this._onStopCallback=t,this},a.prototype.update=function(t,e){var n=this,r;if(t===void 0&&(t=kr()),e===void 0&&(e=!0),this._isPaused)return!0;var s,l=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(t>l)return!1;e&&this.start(t,!0)}if(this._goToEnd=!1,t<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var c=t-this._startTime,u=this._duration+((r=this._repeatDelayTime)!==null&&r!==void 0?r:this._delayTime),d=this._duration+this._repeat*u,p=function(){if(n._duration===0||c>d)return 1;var _=Math.trunc(c/u),S=c-_*u,L=Math.min(S/n._duration,1);return L===0&&c===n._duration?1:L},f=p(),y=this._easingFunction(f);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,y),this._onUpdateCallback&&this._onUpdateCallback(this._object,f),this._duration===0||c>=this._duration)if(this._repeat>0){var v=Math.min(Math.trunc((c-this._duration)/u)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=v);for(s in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[s]=="string"&&(this._valuesStartRepeat[s]=this._valuesStartRepeat[s]+parseFloat(this._valuesEnd[s])),this._yoyo&&this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=u*v,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var b=0,T=this._chainedTweens.length;b<T;b++)this._chainedTweens[b].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},a.prototype._updateProperties=function(t,e,n,r){for(var s in n)if(e[s]!==void 0){var l=e[s]||0,c=n[s],u=Array.isArray(t[s]),d=Array.isArray(c),p=!u&&d;p?t[s]=this._interpolationFunction(c,r):typeof c=="object"&&c?this._updateProperties(t[s],l,c,r):(c=this._handleRelativeValue(l,c),typeof c=="number"&&(t[s]=l+(c-l)*r))}},a.prototype._handleRelativeValue=function(t,e){return typeof e!="string"?e:e.charAt(0)==="+"||e.charAt(0)==="-"?t+parseFloat(e):parseFloat(e)},a.prototype._swapEndStartRepeatValues=function(t){var e=this._valuesStartRepeat[t],n=this._valuesEnd[t];typeof n=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(n):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=e},a}();al.nextId;var tn=Rs;tn.getAll.bind(tn),tn.removeAll.bind(tn),tn.add.bind(tn),tn.remove.bind(tn);var ff=tn.update.bind(tn);function Ys(a,t,e){if(a==null||a==="")throw new Error(e||`Parameter "${t}" is required but received: ${a}`);return a}function cl(a,t,e){const n=t.split(".");let r=a;for(const s of n){if(r[s]===void 0||r[s]===null)throw new Error(`Property "${t}" is required but missing at path: "${s}"`);r=r[s]}return r}function pf(a,t,e,n=0,r=1){const s=(a-t)*(r-n)/(e-t)+n,l=Math.min(n,r),c=Math.max(n,r);return s<l?l:s>c?c:s||0}class ul extends m.EventDispatcher{constructor(e,n={}){super();G(this,"scene");G(this,"renderer");G(this,"camera");G(this,"controls");G(this,"ambLight");G(this,"dirLight");G(this,"auxDirLight");G(this,"clouds",null);G(this,"container");G(this,"_clock",new m.Clock);G(this,"stats");G(this,"_animationCallbacks",new Set);G(this,"_fogFactor",1);G(this,"_sceneSize",5e4*2);G(this,"gorund");G(this,"map");G(this,"centerPostion");G(this,"_isInteracting",!1);G(this,"debug",!1);const{antialias:r=!1,stencil:s=!0,logarithmicDepthBuffer:l=!0,skybox:c,map:u}=n;this.map=u,this.centerPostion=this.map.geo2world(new m.Vector3(this.map.center[0],this.map.center[1],0)),this.renderer=this._createRenderer(r,s,l),this.scene=this._createScene(c),this.camera=this._createCamera(),e&&this.addTo(e),this.controls=this._createControls(),this.ambLight=this._createAmbLight(),this.scene.add(this.ambLight),this.dirLight=this._createDirLight(),this.scene.add(this.dirLight),this.scene.add(this.dirLight.target),this.auxDirLight=this._createAuxDirLight(),this.gorund=this._createGorund(),this.scene.add(this.gorund),this.renderer.setAnimationLoop(this.animate.bind(this)),this.debug=n.debug||!1,this.debug&&(this.stats=new Cr,document.body.appendChild(this.stats.dom))}get fogFactor(){return this._fogFactor}get isInteracting(){return this._isInteracting}set fogFactor(e){this._fogFactor=e,this.controls.dispatchEvent({type:"change",target:this.controls})}get width(){return this.container?.clientWidth||0}get height(){return this.container?.clientHeight||0}addTo(e){const n=typeof e=="string"?document.querySelector(e):e;if(n instanceof HTMLElement)this.container=n,n.appendChild(this.renderer.domElement),new ResizeObserver(this.resize.bind(this)).observe(n);else throw`${e} not found!}`;return this}_createScene(e){const n=new m.Scene,r=e?.defaultColor||"rgb(21,48,94)";if(n.background=new m.Color(r),n.fog=new m.FogExp2(r,2e-4),e?.files){const s=new m.CubeTextureLoader;e.path&&s.setPath(e.path),s.load(e.files,l=>{n.background=l},void 0,l=>{console.error("Error loading skybox:",l),n.background=new m.Color(r)})}else e?.hdr&&this._loadHDRWithPMREM(n,e);return n}async _loadHDRWithPMREM(e,n){try{if(n){const s=await new of().setPath(n.path||"").setDataType(m.FloatType).loadAsync(n.hdr);s.colorSpace=this.renderer.outputColorSpace,s.mapping=303,s.needsUpdate=!0,e.background=s,e.environment=s}}catch(r){console.error("加载HDR失败:",r),e.background=new m.Color(n?.defaultColor||14414079)}}_createRenderer(e,n,r){const s=new m.WebGLRenderer({antialias:e,logarithmicDepthBuffer:r,stencil:n,alpha:!0,precision:"highp",powerPreference:"high-performance",failIfMajorPerformanceCaveat:!0});return s.debug.checkShaderErrors=!0,s.sortObjects=!0,s.setPixelRatio(window.devicePixelRatio),s.domElement.tabIndex=0,s.shadowMap.enabled=!0,s.shadowMap.needsUpdate=!0,s.shadowMap.type=m.PCFSoftShadowMap,s.toneMapping=m.ACESFilmicToneMapping,s.toneMappingExposure=1,s}_createCamera(){return new m.PerspectiveCamera(45,this.getAspect(),.1,this._sceneSize*2)}_createControls(){const e=new rd(this.camera,this.renderer.domElement),n=Math.PI/2.1;return e.screenSpacePanning=!1,e.minDistance=.1,e.maxDistance=3e4*2,e.maxPolarAngle=n,e.enableDamping=!0,e.dampingFactor=.08,e.keyPanSpeed=1,e.listenToKeyEvents(this.renderer.domElement),e.addEventListener("change",()=>{const r=Math.max(e.getPolarAngle(),.1),s=Math.max(e.getDistance(),100);e.zoomSpeed=Math.max(Math.log(s/1e3),1)+3;const l=3e5*2;e.maxDistance>l*.95&&(e.maxDistance=l*.95),this.camera.far=m.MathUtils.clamp(s/r*8,100,l),this.camera.near=m.MathUtils.clamp(this.camera.far/1e3,.001,1),this.camera.updateProjectionMatrix(),this.scene.fog instanceof m.FogExp2&&(this.scene.fog.density=r/(s+5)*this.fogFactor*.1);const u=s>6e4;e.minAzimuthAngle=u?0:-1/0,e.maxAzimuthAngle=u?0:1/0,e.maxPolarAngle=pf(e.getDistance(),0,7e4,n,0),this.map?.trigger("control-change",{type:"control-change",control:e,camera:this.camera,target:this.map})}),e.addEventListener("start",()=>{this._isInteracting=!0,this.map?.trigger("control-start",{type:"control-start",control:e,camera:this.camera,target:this.map})}),e.addEventListener("end",()=>{this._isInteracting=!1,this.map?.trigger("control-end",{type:"control-end",control:e,camera:this.camera,target:this.map})}),e}_createAmbLight(){return new m.AmbientLight(16777215,.1)}_createDirLight(){const y=new m.DirectionalLight("rgb(255, 255, 255)",3);y.position.set(this.centerPostion.x+55e3*1.2,55e3*2,this.centerPostion.z+55e3*1);const v=new m.Object3D;if(v.position.copy(this.centerPostion),this.scene.add(v),y.target=v,y.castShadow=!0,y.shadow.mapSize.width=1024*10,y.shadow.mapSize.height=1024*10,y.shadow.camera.near=1,y.shadow.camera.far=192500,y.shadow.camera.left=-55e3,y.shadow.camera.bottom=-55e3,y.shadow.camera.top=55e3,y.shadow.camera.right=55e3,y.shadow.radius=1,y.shadow.bias=-0,this.debug){const b=new m.CameraHelper(y.shadow.camera);b.name="dirLightCameraHelper",this.scene.add(b)}return y}_createAuxDirLight(){const c=this._createAuxLightInstance(this.centerPostion.x+-66e3,82500,this.centerPostion.z+-55e3,.5);c.name="AuxDirLight_BackFill",this.scene.add(c),this.scene.add(c.target);const f=this._createAuxLightInstance(this.centerPostion.x+55e3*-1,55e3*1.5,this.centerPostion.z+55e3*1.2,.5);f.name="AuxDirLight_LeftRim",this.scene.add(f),this.scene.add(f.target);const T=this._createAuxLightInstance(this.centerPostion.x+55e3*1,55e3*1.5,this.centerPostion.z+55e3*-1.2,.5);return T.name="AuxDirLight_RightRim",this.scene.add(T),this.scene.add(T.target),c}_createAuxLightInstance(e,n,r,s){const l=new m.DirectionalLight(16777215,s);l.position.set(e,n,r);const c=new m.Object3D;return c.position.copy(this.centerPostion),this.scene.add(c),l.target=c,l.castShadow=!1,l}resize(){const e=this.width,n=this.height;return this.renderer.setSize(e,n),this.camera.aspect=e/n,this.camera.updateProjectionMatrix(),this.renderer.render(this.scene,this.camera),this}addAnimationCallback(e){return this._animationCallbacks.add(e),()=>this._animationCallbacks.delete(e)}animate(){const e=this._clock.getDelta(),n=this._clock.getElapsedTime();this._animationCallbacks.forEach(r=>r(e,n,this)),this.controls.update(),this.renderer.render(this.scene,this.camera),ff(),this.stats&&this.stats.update(),this.dispatchEvent({type:"update",delta:e})}flyTo(e,n,r=!0,s){if(this.controls.target.copy(e),r){const l=this.camera.position;new ll(l).to({y:2e7,z:0},500).chain(new ll(l).to(n,2e3).easing(hr.Quintic.Out).onComplete(c=>s&&s(c))).start()}else this.camera.position.copy(n)}getState(){return{centerPosition:this.controls.target,cameraPosition:this.camera.position}}_bindMap(e){e&&(this.map=e)}getMap(){return this.map?this.map:null}getAspect(){const[e,n]=this.getWidthHeight();return e/n}getWidthHeight(){let e=window.innerWidth,n=window.innerHeight;return[e,n]}_createGorund(){const e=this.centerPostion,n=new m.MeshStandardMaterial({transparent:!1,color:new m.Color("rgb(45,52,60)").multiplyScalar(.7),metalness:.2,roughness:1}),r=new m.PlaneGeometry(this._sceneSize*2,this._sceneSize*2),s=new m.Mesh(r,n);return s.name="地面",s.castShadow=!1,s.receiveShadow=!1,s.position.y=0,s.position.add(e),s.rotateX(-Math.PI/2),s.visible=!1,s}}var Dr=(a=>(a[a.none=0]="none",a[a.create=1]="create",a[a.remove=2]="remove",a))(Dr||{});function mf(a,t){const e=a.position.clone().setZ(a.maxZ).applyMatrix4(a.matrixWorld);return t.distanceTo(e)}function gf(a){const t=a.scale,e=new m.Vector3(-t.x,-t.y,0).applyMatrix4(a.matrixWorld),n=new m.Vector3(t.x,t.y,0).applyMatrix4(a.matrixWorld);return e.sub(n).length()}function yf(a){return a.distToCamera/a.sizeInWorld*.8}function vf(a,t,e,n){const r=yf(a);if(a.isLeaf){if(a.inFrustum&&a.z<e&&(a.z<t||a.showing)&&(a.z<t||r<n))return 1}else if(a.z>=t&&(a.z>e||r>n))return 2;return 0}function wf(a,t,e,n){const r=[],s=n+1,l=t*2,c=0,u=.25;{const d=e*2,p=new m.Vector3(.5,.5,1),f=new nn(l,d,s),y=new nn(l+1,d,s),v=new nn(l,d+1,s),b=new nn(l+1,d+1,s);f.position.set(-u,u,c),f.scale.copy(p),y.position.set(u,u,c),y.scale.copy(p),v.position.set(-u,-u,c),v.scale.copy(p),b.position.set(u,-u,c),b.scale.copy(p),r.push(f,y,v,b)}return r}const bf=10,xf=new m.InstancedBufferGeometry,_f=new m.Vector3,Mf=new m.Matrix4,Lf=new m.Box3(new m.Vector3(-.5,-.5,0),new m.Vector3(.5,.5,1)),hl=new m.Frustum,Bn=class Bn extends m.Mesh{constructor(e=0,n=0,r=0){super(xf,[]);G(this,"_dataOnlyMode",!1);G(this,"vectorData",null);G(this,"x");G(this,"y");G(this,"z");G(this,"isTile",!0);G(this,"parent",null);G(this,"children",[]);G(this,"_ready",!1);G(this,"_isDummy",!1);G(this,"_showing",!1);G(this,"_maxZ",0);G(this,"distToCamera",0);G(this,"sizeInWorld",0);G(this,"_loaded",!1);G(this,"_inFrustum",!1);this.x=e,this.y=n,this.z=r,this.name=`Tile ${r}-${e}-${n}`,this.up.set(0,0,1),this.matrixAutoUpdate=!1}setDataOnlyMode(e){return this._dataOnlyMode=e,e&&(this.visible=!1),this}isDataOnlyMode(){return this._dataOnlyMode}getVectorData(){return this.vectorData}static get downloadThreads(){return Bn._downloadThreads}get isDummy(){return this._isDummy}get showing(){return this._showing}set showing(e){const n=this._showing;this._showing=e,this.material.forEach(r=>r.visible=e),n===!1&&this._showing===!0&&this._loaded&&this.dispatchEvent({type:"tile-shown",tile:this}),n===!0&&this._showing===!1&&this.dispatchEvent({type:"tile-hidden",tile:this})}get maxZ(){return this._maxZ}set maxZ(e){this._maxZ=e}get index(){return this.parent?this.parent.children.indexOf(this):-1}get loaded(){return this._loaded}get inFrustum(){return this._inFrustum}set inFrustum(e){this._inFrustum=e}get isLeaf(){return this.children.filter(e=>e.isTile).length===0}traverse(e){e(this),this.children.forEach(n=>{n.isTile&&n.traverse(e)})}traverseVisible(e){this.visible&&(e(this),this.children.forEach(n=>{n.isTile&&n.traverseVisible(e)}))}raycast(e,n){this.showing&&this.loaded&&this.isTile&&super.raycast(e,n)}LOD(e){if(Bn.downloadThreads>bf)return{action:Dr.none};let n=[];const{loader:r,minLevel:s,maxLevel:l,LODThreshold:c}=e,u=vf(this,s,l,c);return u===Dr.create&&(n=wf(r,this.x,this.y,this.z),this.add(...n)),{action:u,newTiles:n}}_checkVisible(){const e=this.parent;if(e&&e.isTile){const n=e.children.filter(s=>s.isTile),r=n.every(s=>s.loaded);e.showing=!r,n.forEach(s=>s.showing=r)}return this}async _load(e){Bn._downloadThreads++;const{x:n,y:r,z:s}=this;if(this._dataOnlyMode)try{const l=await e.load({x:n,y:r,z:s,bounds:[-1/0,-1/0,1/0,1/0]});this.vectorData=l.geometry?.userData||{},this._loaded=!0,this.dispatchEvent({type:"vector-data-loaded",data:this.vectorData,tile:this})}catch(l){console.error(`数据模式加载失败 ${s}/${n}/${r}:`,l),this._loaded=!1}else{const l=await e.load({x:n,y:r,z:s,bounds:[-1/0,-1/0,1/0,1/0]});this.material=l.materials,this.geometry=l.geometry,this.maxZ=this.geometry.boundingBox?.max.z||0,this._loaded=!0}return Bn._downloadThreads--,this}_init(){this.updateMatrix(),this.updateMatrixWorld(),this.sizeInWorld=gf(this)}update(e){if(console.assert(this.z===0),!this.parent)return this;hl.setFromProjectionMatrix(Mf.multiplyMatrices(e.camera.projectionMatrix,e.camera.matrixWorldInverse));const n=e.camera.getWorldPosition(_f);return this.traverse(r=>{r.receiveShadow=this.receiveShadow,r.castShadow=this.castShadow;const s=Lf.clone().applyMatrix4(r.matrixWorld);s.max.setY(9e3),r.inFrustum=hl.intersectsBox(s),r.distToCamera=mf(r,n);const{action:l,newTiles:c}=r.LOD(e);this._doAction(r,l,c,e)}),this._checkReady(),this}_doAction(e,n,r,s){return n===Dr.create?r?.forEach(l=>{l._init(),l._isDummy=l.z<s.minLevel,this.dispatchEvent({type:"tile-created",tile:l}),l.isDummy||l._load(s.loader).then(()=>{l._checkVisible(),this.dispatchEvent({type:"tile-loaded",tile:l})})}):n===Dr.remove&&(e.showing=!0,e._unLoad(!1,s.loader),this.dispatchEvent({type:"tile-unload",tile:e})),this}reload(e){return this._unLoad(!0,e),this}_checkReady(){return this._ready||(this._ready=!0,this.traverse(e=>{if(e.isLeaf&&e.loaded&&!e.isDummy){this._ready=!1;return}}),this._ready&&this.dispatchEvent({type:"ready"})),this}_unLoad(e,n){return e&&this.isTile&&!this.isDummy&&(this.dispatchEvent({type:"unload"}),n?.unload?.(this)),this.children.forEach(r=>r._unLoad(!0,n)),this.clear(),this}};G(Bn,"_downloadThreads",0);let nn=Bn;class dl{constructor(t=0){G(this,"_lon0",0);this._lon0=t}get lon0(){return this._lon0}getTileXWithCenterLon(t,e){const n=Math.pow(2,e);let r=t+Math.round(n/360*this._lon0);return r>=n?r-=n:r<0&&(r+=n),r}getTileXYZproj(t,e,n){const r=this.mapWidth,s=this.mapHeight/2,l=t/Math.pow(2,n)*r-r/2,c=s-e/Math.pow(2,n)*s*2;return{x:l,y:c}}getProjBoundsFromLonLat(t){const e=t[0]===-180&&t[2]===180,n=this.project(t[0]+(e?this._lon0:0),t[1]),r=this.project(t[2]+(e?this._lon0:0),t[3]);return[Math.min(n.x,r.x),Math.min(n.y,r.y),Math.max(n.x,r.x),Math.max(n.y,r.y)]}getProjBoundsFromXYZ(t,e,n){const r=this.getTileXYZproj(t,e,n),s=this.getTileXYZproj(t+1,e+1,n);return[Math.min(r.x,s.x),Math.min(r.y,s.y),Math.max(r.x,s.x),Math.max(r.y,s.y)]}getLonLatBoundsFromXYZ(t,e,n){const r=this.getProjBoundsFromXYZ(t,e,n),s=this.unProject(r[0],r[1]),l=this.unProject(r[2],r[3]);return[s.lon,s.lat,l.lon,l.lat]}}const zr=6378e3;class fl extends dl{constructor(){super(...arguments);G(this,"ID","3857");G(this,"mapWidth",2*Math.PI*zr);G(this,"mapHeight",this.mapWidth);G(this,"mapDepth",1)}project(e,n){const r=(e-this.lon0)*(Math.PI/180),s=n*(Math.PI/180),l=zr*r,c=zr*Math.log(Math.tan(Math.PI/4+s/2));return{x:l,y:c}}unProject(e,n){let r=e/zr*(180/Math.PI)+this.lon0;return r>180&&(r-=360),{lat:(2*Math.atan(Math.exp(n/zr))-Math.PI/2)*(180/Math.PI),lon:r}}}class Sf extends dl{constructor(){super(...arguments);G(this,"ID","4326");G(this,"mapWidth",36e3);G(this,"mapHeight",18e3);G(this,"mapDepth",1)}project(e,n){return{x:(e-this.lon0)*100,y:n*100}}unProject(e,n){return{lon:e/100+this.lon0,lat:n/100}}}const Tf={createFromID:(a="3857",t)=>{let e;switch(a){case"3857":e=new fl(t);break;case"4326":e=new Sf(t);break;default:throw new Error(`Projection ID: ${a} is not supported.`)}return e}};function Us(a,t){const e=a.getLayers().find(r=>r.isBaseLayer===!0)?._rootTile,n=t.intersectObjects([e]);for(const r of n)if(r.object instanceof nn){const s=a.worldToLocal(r.point.clone()),l=a.map2geo(s);return Object.assign(r,{location:l})}}function Bs(a,t){const e=new m.Vector3(0,-1,0),n=new m.Vector3(t.x,10*1e3,t.z),r=new m.Raycaster(n,e);return Us(a,r)}function pl(a,t,e){const n=new m.Raycaster;return n.setFromCamera(e,a),Us(t,n)}function Gf(a,t=128){const e=document.createElement("canvas"),n=e.getContext("2d");if(!n)throw new Error("Failed to get canvas context");e.width=t,e.height=t;const r=t/2,s=t/2;return n.imageSmoothingEnabled=!1,n.fillStyle="#000022",n.strokeStyle="DarkGoldenrod",n.lineWidth=5,n.moveTo(r,3),n.lineTo(r,t),n.stroke(),n.closePath(),n.lineWidth=2,n.beginPath(),n.roundRect(2,2,t-4,s-8,10),n.closePath(),n.fill(),n.stroke(),n.font="24px Arial",n.fillStyle="Goldenrod",n.strokeStyle="black",n.textAlign="center",n.textBaseline="top",n.strokeText(a,r,20),n.fillText(a,r,20),e}function Zf(a,t=128){const e=new m.CanvasTexture(Gf(a,t)),n=new m.SpriteMaterial({map:e,sizeAttenuation:!1}),r=new m.Sprite(n);return r.visible=!1,r.center.set(.5,.3),r.scale.setScalar(.11),r.renderOrder=999,r}class bi extends m.Mesh{constructor(e){super();G(this,"name","map");G(this,"_clock",new m.Clock);G(this,"isLOD",!0);G(this,"autoUpdate",!0);G(this,"updateInterval",100);G(this,"_minLevel",2);G(this,"_layers",new Map);G(this,"_maxLevel",19);G(this,"_projection",new fl(0));G(this,"_LODThreshold",1);this.up.set(0,0,1);const{minLevel:n=2,maxLevel:r=19}=e;this.minLevel=n,this.maxLevel=r}get minLevel(){return this._minLevel}set minLevel(e){this._minLevel=e}get maxLevel(){return this._maxLevel}set maxLevel(e){this._maxLevel=e}get lon0(){return this.projection.lon0}get projection(){return this._projection}get LODThreshold(){return this._LODThreshold}set LODThreshold(e){this._LODThreshold=e}static create(e){return new bi(e)}update(e){if(!this.autoUpdate)return;const n=this._clock.getElapsedTime();n>this.updateInterval/1e3&&(this._layers.forEach(r=>{r.enabled&&r.visible&&r.update(e)}),this._clock.start(),this.dispatchEvent({type:"update",delta:n}))}dispose(){this.removeFromParent()}geo2pos(e){return this.geo2map(e)}geo2map(e){const n=this.projection.project(e.x,e.y);return new m.Vector3(n.x,n.y,e.z)}geo2world(e){return this.localToWorld(this.geo2map(e))}pos2geo(e){return this.map2geo(e)}map2geo(e){const n=this.projection.unProject(e.x,e.y);return new m.Vector3(n.lon,n.lat,e.z)}world2geo(e){return this.pos2geo(this.worldToLocal(e.clone()))}getLocalInfoFromGeo(e){const n=this.geo2world(e);return Bs(this,n)}getLocalInfoFromWorld(e){return Bs(this,e)}getLocalInfoFromScreen(e,n){return pl(e,this,n)}get downloading(){return nn.downloadThreads}addLayer(e){return this._layers.has(e.layerId)&&console.warn(`图层 ${e.layerid} 已存在,将被替换`),this._layers.set(e.layerId,e),this.add(e),this}removeLayer(e){const n=this._layers.get(e);return n?(this._layers.delete(e),this.remove(n),n.dispose(),console.log(`✅ 图层 ${e} 移除成功`),!0):(console.warn(`⚠️ 图层 ${e} 不存在`),!1)}getLayer(e){return this._layers.get(e)}getLayerIds(){return Array.from(this._layers.keys())}clearLayers(){return this._layers.forEach(e=>{this.remove(e),e.dispose()}),this._layers.clear(),console.log("✅ 所有图层已清空"),this}getLayers(){return Array.from(this._layers.values())}}class Ns{constructor(){G(this,"_dispatcher",new m.EventDispatcher);G(this,"_listenerMap",new Map)}on(t,e){const n=r=>e(r.data||r);return this._listenerMap.has(t)||this._listenerMap.set(t,new Map),this._listenerMap.get(t).set(e,n),this._dispatcher.addEventListener(t,n),this}once(t,e){const n=r=>{this.off(t,n),e(r.data||r)};return this.on(t,n)}off(t,e){const n=this._listenerMap.get(t);if(!n)return this;const r=n.get(e);return r&&(this._dispatcher.removeEventListener(t,r),n.delete(e),n.size===0&&this._listenerMap.delete(t)),this}trigger(t,e){const n={type:t,data:e};return this._dispatcher.dispatchEvent(n),this}get threeEventDispatcher(){return this._dispatcher}}function If(a,t){return a.replace(/\{(\w+)\}/g,(e,n)=>{if(t.hasOwnProperty(n)){const r=t[n];return r!==void 0?String(r):e}throw new Error(`缺少必要参数: ${n}`)})}function js(a,...t){for(let e=0;e<t.length;e++){const n=t[e];for(const r in n)a[r]=n[r]}return a}function Js(a){return a==null}function Or(a){return Js(a)?!1:typeof a=="function"||a.constructor!==null&&a.constructor===Function}function Wf(a=new Date){const t=a.getFullYear().toString(),e=(a.getMonth()+1).toString().padStart(2,"0"),n=a.getDate().toString().padStart(2,"0"),r=a.getHours().toString().padStart(2,"0"),s=a.getMinutes().toString().padStart(2,"0"),l=a.getSeconds().toString().padStart(2,"0");return`${t}-${e}-${n} ${r}:${s}:${l}`}class Pf{}class ml extends xi(_i(Pf)){constructor(e){super();G(this,"target");G(this,"dom");G(this,"_enabled",!1);this.target=e}enable(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)}disable(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this}enabled(){return!!this._enabled}remove(){this.disable(),delete this.target,delete this.dom}}const gl=Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"&&!process.versions.electron&&!process.versions.nw&&!process.versions["node-webkit"];let Kr={};function yl(){return window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI}if(!gl){const a=navigator.userAgent.toLowerCase(),t=document.documentElement||{style:{}},e="ActiveXObject"in window,n=a.indexOf("webkit")!==-1,r=a.indexOf("phantom")!==-1,s=a.search("android [23]")!==-1,l=a.indexOf("chrome")!==-1,c=a.indexOf("gecko")!==-1&&!n&&!("opera"in window)&&!e,u=/iphone/i.test(a)&&/micromessenger/i.test(a),d=typeof orientation<"u"||a.indexOf("mobile")!==-1,p=!window.PointerEvent&&"MSPointerEvent"in window,f=window.PointerEvent&&navigator.pointerEnabled||p,y=e&&"transition"in t.style,v="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!s,b="MozPerspective"in t.style,T="OTransition"in t.style,_=(y||v||b)&&!T&&!r,S=typeof window<"u"&&Or(window.createImageBitmap),L=typeof window<"u"&&Or(window.ResizeObserver),I=typeof window<"u"&&Or(window.btoa),F=typeof window<"u"&&Or(window.Proxy),K=typeof window<"u"&&Or(window.requestIdleCallback);let D=0;if(l){const N=a.match(/chrome\/([\d.]+)/);D=N?N[1]:0}const O=!r&&(f||"ontouchstart"in window||"DocumentTouch"in window&&document instanceof window.DocumentTouch),V=typeof window<"u"&&"WebGLRenderingContext"in window,R=yl();let P=!1;try{new OffscreenCanvas(2,2).getContext("2d"),P=!0}catch{P=!1}let k=!1;try{window.addEventListener("testPassive",()=>{},{get passive(){return k=!0,!0}})}catch{}Kr={IS_NODE:gl,isTest:!1,ie:e,ielt9:e&&!document.addEventListener,edge:"msLaunchUri"in navigator&&!("documentMode"in document),webkit:n,gecko:c,android:a.indexOf("android")!==-1,android23:s,chrome:l,chromeVersion:D,safari:!l&&a.indexOf("safari")!==-1,phantomjs:r,ie3d:y,webkit3d:v,gecko3d:b,opera12:T,any3d:_,iosWeixin:u,mobile:d,mobileWebkit:d&&n,mobileWebkit3d:d&&v,mobileOpera:d&&"opera"in window,mobileGecko:d&&c,touch:!!O,msPointer:!!p,pointer:!!f,retina:R>1,devicePixelRatio:R,language:navigator.browserLanguage?navigator.browserLanguage:navigator.language,ie9:e&&document.documentMode===9,ie10:e&&document.documentMode===10,webgl:V,imageBitMap:S,resizeObserver:L,btoa:I,decodeImageInWorker:P,monitorDPRChange:!0,supportsPassive:k,proxy:F,requestIdleCallback:K,checkDevicePixelRatio:()=>{if(typeof window<"u"&&Kr.monitorDPRChange){const N=yl(),H=N!==Kr.devicePixelRatio;return H&&(Kr.devicePixelRatio=N),H}return!1}}}const Cf=Kr;function xi(a){return class extends a{constructor(...e){super(...e);G(this,"eventClass",new Ns);G(this,"on",this.eventClass.on.bind(this.eventClass));G(this,"trigger",this.eventClass.trigger.bind(this.eventClass));G(this,"off",this.eventClass.off.bind(this.eventClass));this.eventClass=new Ns}}}function _i(a){return class extends a{constructor(...e){super(...e);G(this,"options");G(this,"_isUpdatingOptions");G(this,"_initHooksCalled");G(this,"_initHooks");const n=Object.getPrototypeOf(this).options||{},r=js({},n,e[0]||{});this.setOptions(r),this.callInitHooks(),this._isUpdatingOptions=!1}proxyOptions(){return Cf.proxy?(this.options=new Proxy(this.options,{set:(e,n,r)=>{if(n=n,e[n]===r||(e[n]=r,this._isUpdatingOptions))return!0;const s={};return s[n]=r,this.config(s),!0}}),this):this}callInitHooks(){const e=Object.getPrototypeOf(this);return this._visitInitHooks(e),this}setOptions(e){if((!this.hasOwnProperty("options")||Js(this.options))&&(this.options=this.options?Object.create(this.options):{}),!e)return this;for(const n in e)this.options[n]=e[n];return this}config(e,n){if(this._isUpdatingOptions=!0,e){if(arguments.length===2&&typeof e=="string"){const r={};r[e]=n,e=r}e=e;for(const r in e)this.options[r]=e[r],this[r]&&this[r]instanceof ml&&(e[r]?this[r].enable():this[r].disable());this.onConfig(e),this._isUpdatingOptions=!1}else{const r={};for(const s in this.options)this.options.hasOwnProperty(s)&&(r[s]=this.options[s]);return this._isUpdatingOptions=!1,r}return this}onConfig(e){}_visitInitHooks(e){if(this._initHooksCalled)return;const n=Object.getPrototypeOf(e);n._visitInitHooks&&n._visitInitHooks.call(this,n),this._initHooksCalled=!0;const r=e._initHooks;if(r&&r!==n._initHooks)for(let s=0;s<r.length;s++)r[s].call(this)}static mergeOptions(e){const n=this.prototype,r=Object.getPrototypeOf(n);return n.hasOwnProperty("options")?n.options===r.options&&(n.options=Object.create(n.options)):n.options={},js(n.options,e),this}static addInitHook(e,...n){const r=typeof e=="function"?e:function(){this[e].apply(this,n)},s=this.prototype,l=Object.getPrototypeOf(s);return(!s._initHooks||s._initHooks===l._initHooks)&&(s._initHooks=[]),s._initHooks.push(r),this}static include(...e){for(let n=0;n<e.length;n++)js(this.prototype,e[n]);return this}}}function Qs(a){return class extends a{constructor(...n){super(...n);G(this,"_handlers");this._handlers=[]}addHandler(n,r){if(!r)return this;if(this._handlers||(this._handlers=[]),this[n])return this[n].enable(),this;const s=this[n]=new r(this);return this._handlers.push(s),this.options[n]&&s.enable(),this}removeHandler(n){if(!n)return this;const r=this[n];if(r&&this._handlers){const s=this._handlers.indexOf(r);s>=0&&this._handlers.splice(s,1),this[n].remove(),delete this[n]}return this}_clearHandlers(){if(this._handlers){for(let n=0,r=this._handlers.length;n<r;n++)this._handlers[n].remove();this._handlers=[]}}}}const Vf={attribution:"",visible:!0,opacity:1,zIndex:0,isSceneLayer:!1,altitude:0};class Mi extends Qs(xi(_i(m.Group))){constructor(e,n){super();G(this,"_id");G(this,"opacity",1);G(this,"_animationCallbacks",new Set);G(this,"isSceneLayer",!1);G(this,"_altitude",0);Ys(e,"id","图层ID必须指定"),n&&(this.opacity=n.opacity||1,this.isSceneLayer=n.isSceneLayer??!1,n.altitude!==void 0&&this.setAltitude(n.altitude)),this._id=e,typeof this.animate=="function"&&this._registerAnimate()}getId(){return this._id}addTo(e){return e.addLayer(this),this}getZIndex(){return 0}getOpacity(){return this.opacity}setOpacity(e){this.opacity=e,this.traverse(n=>{"material"in n&&(Array.isArray(n.material)?n.material:[n.material]).forEach(s=>{"opacity"in s&&(s.transparent=e<1,s.opacity=e,s.needsUpdate=!0)}),n instanceof m.Sprite&&(n.material.opacity=e,n.material.transparent=e<1,n.material.needsUpdate=!0)})}getMap(){return this.map?this.map:null}show(){return this.visible||(this.visible=!0,this.options.visible=!0,this.getMap()),this}hide(){return this.visible&&(this.visible=!1,this.options.visible=!1,this.getMap()),this}setAltitude(e){return this.position.y=e,this.updateMatrix(),this.updateMatrixWorld(!0),this}getAltitude(){return this.position.y}_bindMap(e){e&&(this.map=e,typeof this.animate=="function"&&this._registerAnimate())}_registerAnimate(){const e=this.getMap();if(!e?.viewer)return;const n=e.viewer.addAnimationCallback((r,s,l)=>{this.animate?.(r,s,l)});this._animationCallbacks.add(n)}_clearAnimationCallbacks(){this._animationCallbacks.forEach(e=>e()),this._animationCallbacks.clear()}getOptions(){return{...this.options}}}Mi.mergeOptions(Vf);const Ci=class Ci{constructor(t){G(this,"_cache",new Map);G(this,"_gltfLoader");G(this,"_fbxLoader");G(this,"_dracoLoader");this._gltfLoader=new sd(t),this._fbxLoader=new jd(t)}static init(t){return this._instance||(this._instance=new Ci(t)),this._instance}async load(t){const e=`${t.type}:${t.url}`;if(this._cache.has(e))return this._cloneCachedModel(e,t);t.type==="gltf"&&t.dracoOptions?.enable&&this._initDracoLoader(t.dracoOptions.decoderPath);let n,r;try{if(t.type==="gltf"){const s=await this._gltfLoader.loadAsync(t.url);n=s.scene,r=s.animations}else n=await this._fbxLoader.loadAsync(t.url),r=n.animations;return this._cache.set(e,{model:n,animations:r}),{model:this._processModel(n.clone(),t),animations:r?.map(s=>({...s,name:s.name||"unnamed"}))||[]}}catch(s){throw console.error(`加载${t.type}模型失败:`,t.url,s),s}}_initDracoLoader(t="/draco/"){this._dracoLoader||(this._dracoLoader=new af,this._dracoLoader.setDecoderPath(t),this._gltfLoader.setDRACOLoader(this._dracoLoader))}_cloneCachedModel(t,e){const r=this._cache.get(t).model.clone();return this._processModel(r,e)}_processModel(t,e){return e.position&&t.position.copy(e.position),e.scale&&(typeof e.scale=="number"?t.scale.setScalar(e.scale):e.scale.x!==void 0||e.scale.y!==void 0||e.scale.z!==void 0?(e.scale.x!==void 0&&(t.scale.x=e.scale.x),e.scale.y!==void 0&&(t.scale.y=e.scale.y),e.scale.z!==void 0&&(t.scale.z=e.scale.z)):t.scale.copy(e.scale)),e.rotation&&t.rotation.set(e.rotation.x,e.rotation.y,e.rotation.z),e.materialOverrides&&t.traverse(n=>{if(n instanceof m.Mesh&&n.material){const r=e.materialOverrides[n.name];r&&(n.material=r)}}),t.traverse(n=>{n instanceof m.Mesh&&n.material}),t}};G(Ci,"_instance");let Hs=Ci;const Es=(a,t)=>{"updateRanges"in a?a.updateRanges[0]=t:a.updateRange=t},vl=new m.Matrix4,Li=new m.Vector3,Si=new m.Quaternion,wl=new m.Vector3,bl=new m.Quaternion,Rr=new m.Vector3,Af=a=>class extends a{constructor(){super();const t=parseInt(m.REVISION.replace(/\D+/g,""))>=154?"opaque_fragment":"output_fragment";this.onBeforeCompile=e=>{e.vertexShader=`attribute float cloudOpacity;
|
|
511
511
|
varying float vOpacity;
|
|
512
512
|
`+e.vertexShader.replace("#include <fog_vertex>",`#include <fog_vertex>
|
|
513
513
|
vOpacity = cloudOpacity;
|
|
514
514
|
`),e.fragmentShader=`varying float vOpacity;
|
|
515
515
|
`+e.fragmentShader.replace(`#include <${t}>`,`#include <${t}>
|
|
516
516
|
gl_FragColor = vec4(outgoingLight, diffuseColor.a * vOpacity);
|
|
517
|
-
`)}}};class Ff extends m.Group{constructor({limit:t=200,range:e,material:n=m.MeshLambertMaterial,texture:r,frustumCulled:s=!0}={}){super(),this.name="Clouds",this.ref=this;const l=this,c=new m.PlaneGeometry(1,1),u=new Float32Array(Array.from({length:t},()=>1)),d=new Float32Array(Array.from({length:t},()=>[1,1,1]).flat()),p=new m.InstancedBufferAttribute(u,1);p.setUsage(m.DynamicDrawUsage),c.setAttribute("cloudOpacity",p);const f=Af(n),y=new f;y.map=r,y.transparent=!0,y.depthWrite=!1,y.needsUpdate=!0,this.cloudMaterial=y,this.instance=new m.InstancedMesh(c,y,t);const v=this.instance;v.matrixAutoUpdate=!1,v.frustumCulled=s,v.instanceColor=new m.InstancedBufferAttribute(d,3),v.instanceColor.setUsage(m.DynamicDrawUsage),l.add(v);const b=[],T=()=>{const O=b.length;let V=0;for(let R=0;R<this.ref.children.length;R++){const P=this.ref.children[R];P.cloudStateArray&&(V+=P.cloudStateArray.length)}if(O===V)return b;b.length=0;for(let R=0;R<this.ref.children.length;R++){const P=this.ref.children[R];P.cloudStateArray&&b.push(...P.cloudStateArray)}return _(),b},_=()=>{const O=Math.min(t,e!==void 0?e:t,b.length);v.count=O,Es(v.instanceMatrix,{offset:0,count:O*16}),v.instanceColor&&Es(v.instanceColor,{offset:0,count:O*3}),Es(v.geometry.attributes.cloudOpacity,{offset:0,count:O})};let S=0,L=0,I;const F=new m.Quaternion,K=new m.Vector3(0,0,1),D=new m.Vector3;this.update=(O,V,R)=>{S=V,vl.copy(v.matrixWorld).invert(),O.matrixWorld.decompose(wl,bl,Rr);const P=T();for(L=0;L<P.length;L++)I=P[L],I.ref.matrixWorld.decompose(Li,Si,Rr),Li.add(D.copy(I.position).applyQuaternion(Si).multiply(Rr)),Si.copy(bl).multiply(F.setFromAxisAngle(K,I.rotation+=R*I.rotationFactor)),Rr.multiplyScalar(I.volume+(1+Math.sin(S*I.density*I.speed))/2*I.growth),I.matrix.compose(Li,Si,Rr).premultiply(vl),I.dist=Li.distanceTo(wl);for(P.sort((k,N)=>N.dist-k.dist),L=0;L<P.length;L++)I=P[L],u[L]=I.opacity*(I.dist<I.fade-1?I.dist/I.fade:1),v.setMatrixAt(L,I.matrix),v.setColorAt(L,I.color);v.geometry.attributes.cloudOpacity.needsUpdate=!0,v.instanceMatrix.needsUpdate=!0,v.instanceColor&&(v.instanceColor.needsUpdate=!0)}}}let Xf=0;class kf extends m.Group{constructor({opacity:t=1,speed:e=0,bounds:n=new m.Vector3().fromArray([5,1,1]),segments:r=20,color:s=new m.Color("#ffffff"),fade:l=10,volume:c=6,smallestVolume:u=.25,distribute:d=null,growth:p=4,concentrate:f="inside",seed:y=Math.random()}={}){super(),this.name="cloud_"+Xf++,this.seed=y,this.segments=r,this.bounds=n,this.concentrate=f,this.volume=c,this.smallestVolume=u,this.distribute=d,this.growth=p,this.speed=e,this.fade=l,this.opacity=t,this.color=s,this.ref=this,this.cloudStateArray=[],this.updateCloud()}updateCloudStateArray(){if(this.cloudStateArray.length===this.segments)return;const{segments:t,uuid:e}=this;if(this.cloudStateArray.length>this.segments)this.cloudStateArray.splice(0,this.cloudStateArray.length-this.segments);else for(let n=this.cloudStateArray.length;n<t;n++)this.cloudStateArray.push({segments:t,bounds:new m.Vector3(1,1,1),position:new m.Vector3,uuid:e,index:n,ref:this,dist:0,matrix:new m.Matrix4,volume:0,length:0,speed:0,growth:0,opacity:1,fade:0,density:0,rotation:n*(Math.PI/t),rotationFactor:0,color:new m.Color})}updateCloud(){const{volume:t,color:e,speed:n,growth:r,opacity:s,fade:l,bounds:c,seed:u,cloudStateArray:d,distribute:p,segments:f,concentrate:y,smallestVolume:v}=this;this.updateCloudStateArray();let b=0;function T(){const _=Math.sin(u+b)*1e4;return b++,_-Math.floor(_)}d.forEach((_,S)=>{_.segments=f,_.volume=t,_.color=e,_.speed=n,_.growth=r,_.opacity=s,_.fade=l,_.bounds.copy(c),_.density=Math.max(.5,T()),_.rotationFactor=Math.max(.2,.5*T())*n;const L=p?.(_,S);if(L||f>1){var I;_.position.copy(_.bounds).multiply((I=L?.point)!==null&&I!==void 0?I:{x:T()*2-1,y:T()*2-1,z:T()*2-1})}const F=Math.abs(_.position.x),K=Math.abs(_.position.y),D=Math.abs(_.position.z),O=Math.max(F,K,D);_.length=1,F===O&&(_.length-=F/_.bounds.x),K===O&&(_.length-=K/_.bounds.y),D===O&&(_.length-=D/_.bounds.z),_.volume=(L?.volume!==void 0?L.volume:Math.max(Math.max(0,v),y==="random"?T():y==="inside"?_.length:1-_.length))*t})}}class qs{constructor(t=4){this.pool=t,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(t){if(!this.workers[t]){const e=this.workerCreator();e.addEventListener("message",this._onMessage.bind(this,t)),this.workers[t]=e}}_getIdleWorker(){for(let t=0;t<this.pool;t++)if(!(this.workerStatus&1<<t))return t;return-1}_onMessage(t,e){const n=this.workersResolve[t];if(n&&n(e),this.queue.length){const{resolve:r,msg:s,transfer:l}=this.queue.shift();this.workersResolve[t]=r,this.workers[t].postMessage(s,l)}else this.workerStatus^=1<<t}setWorkerCreator(t){this.workerCreator=t}setWorkerLimit(t){this.pool=t}postMessage(t,e){return new Promise(n=>{const r=this._getIdleWorker();r!==-1?(this._initWorker(r),this.workerStatus|=1<<r,this.workersResolve[r]=n,this.workers[r].postMessage(t,e)):this.queue.push({resolve:n,msg:t,transfer:e})})}dispose(){this.workers.forEach(t=>t.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}function xl(a,t){const e=new m.BufferGeometry;e.setAttribute("position",new m.BufferAttribute(new Float32Array([0,0,0]),3));const n=new m.Points(e,new m.PointsMaterial({size:a.size,color:a.color||16777215,sizeAttenuation:!a.glow}));return n.position.copy(t),n}async function _l(a,t){const e=await
|
|
517
|
+
`)}}};class Ff extends m.Group{constructor({limit:t=200,range:e,material:n=m.MeshLambertMaterial,texture:r,frustumCulled:s=!0}={}){super(),this.name="Clouds",this.ref=this;const l=this,c=new m.PlaneGeometry(1,1),u=new Float32Array(Array.from({length:t},()=>1)),d=new Float32Array(Array.from({length:t},()=>[1,1,1]).flat()),p=new m.InstancedBufferAttribute(u,1);p.setUsage(m.DynamicDrawUsage),c.setAttribute("cloudOpacity",p);const f=Af(n),y=new f;y.map=r,y.transparent=!0,y.depthWrite=!1,y.needsUpdate=!0,this.cloudMaterial=y,this.instance=new m.InstancedMesh(c,y,t);const v=this.instance;v.matrixAutoUpdate=!1,v.frustumCulled=s,v.instanceColor=new m.InstancedBufferAttribute(d,3),v.instanceColor.setUsage(m.DynamicDrawUsage),l.add(v);const b=[],T=()=>{const O=b.length;let V=0;for(let R=0;R<this.ref.children.length;R++){const P=this.ref.children[R];P.cloudStateArray&&(V+=P.cloudStateArray.length)}if(O===V)return b;b.length=0;for(let R=0;R<this.ref.children.length;R++){const P=this.ref.children[R];P.cloudStateArray&&b.push(...P.cloudStateArray)}return _(),b},_=()=>{const O=Math.min(t,e!==void 0?e:t,b.length);v.count=O,Es(v.instanceMatrix,{offset:0,count:O*16}),v.instanceColor&&Es(v.instanceColor,{offset:0,count:O*3}),Es(v.geometry.attributes.cloudOpacity,{offset:0,count:O})};let S=0,L=0,I;const F=new m.Quaternion,K=new m.Vector3(0,0,1),D=new m.Vector3;this.update=(O,V,R)=>{S=V,vl.copy(v.matrixWorld).invert(),O.matrixWorld.decompose(wl,bl,Rr);const P=T();for(L=0;L<P.length;L++)I=P[L],I.ref.matrixWorld.decompose(Li,Si,Rr),Li.add(D.copy(I.position).applyQuaternion(Si).multiply(Rr)),Si.copy(bl).multiply(F.setFromAxisAngle(K,I.rotation+=R*I.rotationFactor)),Rr.multiplyScalar(I.volume+(1+Math.sin(S*I.density*I.speed))/2*I.growth),I.matrix.compose(Li,Si,Rr).premultiply(vl),I.dist=Li.distanceTo(wl);for(P.sort((k,N)=>N.dist-k.dist),L=0;L<P.length;L++)I=P[L],u[L]=I.opacity*(I.dist<I.fade-1?I.dist/I.fade:1),v.setMatrixAt(L,I.matrix),v.setColorAt(L,I.color);v.geometry.attributes.cloudOpacity.needsUpdate=!0,v.instanceMatrix.needsUpdate=!0,v.instanceColor&&(v.instanceColor.needsUpdate=!0)}}}let Xf=0;class kf extends m.Group{constructor({opacity:t=1,speed:e=0,bounds:n=new m.Vector3().fromArray([5,1,1]),segments:r=20,color:s=new m.Color("#ffffff"),fade:l=10,volume:c=6,smallestVolume:u=.25,distribute:d=null,growth:p=4,concentrate:f="inside",seed:y=Math.random()}={}){super(),this.name="cloud_"+Xf++,this.seed=y,this.segments=r,this.bounds=n,this.concentrate=f,this.volume=c,this.smallestVolume=u,this.distribute=d,this.growth=p,this.speed=e,this.fade=l,this.opacity=t,this.color=s,this.ref=this,this.cloudStateArray=[],this.updateCloud()}updateCloudStateArray(){if(this.cloudStateArray.length===this.segments)return;const{segments:t,uuid:e}=this;if(this.cloudStateArray.length>this.segments)this.cloudStateArray.splice(0,this.cloudStateArray.length-this.segments);else for(let n=this.cloudStateArray.length;n<t;n++)this.cloudStateArray.push({segments:t,bounds:new m.Vector3(1,1,1),position:new m.Vector3,uuid:e,index:n,ref:this,dist:0,matrix:new m.Matrix4,volume:0,length:0,speed:0,growth:0,opacity:1,fade:0,density:0,rotation:n*(Math.PI/t),rotationFactor:0,color:new m.Color})}updateCloud(){const{volume:t,color:e,speed:n,growth:r,opacity:s,fade:l,bounds:c,seed:u,cloudStateArray:d,distribute:p,segments:f,concentrate:y,smallestVolume:v}=this;this.updateCloudStateArray();let b=0;function T(){const _=Math.sin(u+b)*1e4;return b++,_-Math.floor(_)}d.forEach((_,S)=>{_.segments=f,_.volume=t,_.color=e,_.speed=n,_.growth=r,_.opacity=s,_.fade=l,_.bounds.copy(c),_.density=Math.max(.5,T()),_.rotationFactor=Math.max(.2,.5*T())*n;const L=p?.(_,S);if(L||f>1){var I;_.position.copy(_.bounds).multiply((I=L?.point)!==null&&I!==void 0?I:{x:T()*2-1,y:T()*2-1,z:T()*2-1})}const F=Math.abs(_.position.x),K=Math.abs(_.position.y),D=Math.abs(_.position.z),O=Math.max(F,K,D);_.length=1,F===O&&(_.length-=F/_.bounds.x),K===O&&(_.length-=K/_.bounds.y),D===O&&(_.length-=D/_.bounds.z),_.volume=(L?.volume!==void 0?L.volume:Math.max(Math.max(0,v),y==="random"?T():y==="inside"?_.length:1-_.length))*t})}}class qs{constructor(t=4){this.pool=t,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(t){if(!this.workers[t]){const e=this.workerCreator();e.addEventListener("message",this._onMessage.bind(this,t)),this.workers[t]=e}}_getIdleWorker(){for(let t=0;t<this.pool;t++)if(!(this.workerStatus&1<<t))return t;return-1}_onMessage(t,e){const n=this.workersResolve[t];if(n&&n(e),this.queue.length){const{resolve:r,msg:s,transfer:l}=this.queue.shift();this.workersResolve[t]=r,this.workers[t].postMessage(s,l)}else this.workerStatus^=1<<t}setWorkerCreator(t){this.workerCreator=t}setWorkerLimit(t){this.pool=t}postMessage(t,e){return new Promise(n=>{const r=this._getIdleWorker();r!==-1?(this._initWorker(r),this.workerStatus|=1<<r,this.workersResolve[r]=n,this.workers[r].postMessage(t,e)):this.queue.push({resolve:n,msg:t,transfer:e})})}dispose(){this.workers.forEach(t=>t.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}function xl(a,t){const e=new m.BufferGeometry;e.setAttribute("position",new m.BufferAttribute(new Float32Array([0,0,0]),3));const n=new m.Points(e,new m.PointsMaterial({size:a.size,color:a.color||16777215,sizeAttenuation:!a.glow}));return n.position.copy(t),n}async function _l(a,t){const e=await It._loadTexture(a.url),n=new m.Sprite(new m.SpriteMaterial({map:e,color:a.color||16777215,transparent:!0,opacity:a.opacity??1,sizeAttenuation:a.sizeAttenuation??!0})),r=.002;return n.scale.set(a.size[0]*r,a.size[1]*r,1),a.rotation&&(n.rotation.z=a.rotation),a.anchor&&n.center.set(a.anchor[0],a.anchor[1]),n.position.copy(t),n}function $s(a,t){let e;t instanceof Float32Array?e=Array.from(t):Array.isArray(t)&&typeof t[0]=="number"?e=t:e=t.flatMap(s=>[s.x,s.y,s.z]);const n=new yi;n.setPositions(e);const r=new Xr({color:new m.Color(a.color??16777215).getHex(),linewidth:a.width??2,transparent:a.opacity!==void 0&&a.opacity<1,opacity:a.opacity??1,dashed:!!a.dashArray,dashScale:a.dashArray?.[0]??1,dashSize:a.dashArray?.[0]??1,gapSize:a.dashArray?.[1]??0,resolution:new m.Vector2(window.innerWidth,window.innerHeight),alphaToCoverage:!0});return window.addEventListener("resize",()=>{r.resolution.set(window.innerWidth,window.innerHeight)}),new Os(n,r)}async function Df(a,t){const e=a.type||(a.url.toLowerCase().endsWith(".fbx")?"fbx":"gltf");return await Hs.init().load({...a,type:e,position:t})}function zf(a,t){const e=new m.BufferGeometry;e.setAttribute("position",new m.BufferAttribute(new Float32Array(t),3));const n=[],r=t.length/3;for(let l=1;l<r-1;l++)n.push(0,l,l+1);e.setIndex(n),e.computeVertexNormals();const s=new m.MeshBasicMaterial({color:new m.Color(a.color??16777215),transparent:a.opacity!==void 0&&a.opacity<1,opacity:a.opacity??1,wireframe:a.wireframe??!1,side:a.side==="back"?m.BackSide:a.side==="double"?m.DoubleSide:m.FrontSide,depthWrite:!0,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1});return new m.Mesh(e,s)}function Of(a,t){const e=a.extrude?.height||2e3,n=[],r=[],s=[];for(let f=0;f<t.length;f+=3){const y=t[f],v=t[f+1],b=t[f+2];r.push(new m.Vector3(y,v,b)),s.push(new m.Vector3(y,v+e,b))}n.push(...r,...s);const l=new m.BufferGeometry;l.setFromPoints(n);const c=[],u=r.length;for(let f=0;f<u;f++){const y=(f+1)%u;c.push(f,f+u,y),c.push(y,f+u,y+u)}for(let f=2;f<u;f++)c.push(0,f-1,f),c.push(u,u+f-1,u+f);l.setIndex(c),l.computeVertexNormals();const d=new m.ShaderMaterial({uniforms:{uColor:{value:new m.Color(a.color??16777215)},uOpacity:{value:a.opacity??1},uBrightness:{value:1.2}},vertexShader:`
|
|
518
518
|
varying vec3 vWorldPosition;
|
|
519
519
|
varying vec3 vNormal;
|
|
520
520
|
void main() {
|
|
@@ -536,16 +536,16 @@
|
|
|
536
536
|
gl_FragColor = vec4(finalColor, uOpacity);
|
|
537
537
|
if (uOpacity >= 0.99) gl_FragDepthEXT = gl_FragCoord.z;
|
|
538
538
|
}
|
|
539
|
-
`,transparent:!0,side:m.DoubleSide,depthWrite:!0}),p=new m.Mesh(l,d);return p.renderOrder=5e3,p}function Kf(a,t,e){const{geometry:n,center:r,avgY:s}=Ml(e),l=new Jh(n,{textureWidth:512,textureHeight:512,waterNormals:new m.TextureLoader().load(a.normalMap,function(d){d.wrapS=d.wrapT=m.RepeatWrapping}),waterColor:a.color||"#19AAEE",sunColor:a.sunColor||"#05FFF8",distortionScale:1,alpha:a.opacity||.8}),c=l.onBeforeRender,u=l.onAfterRender;return l.onBeforeRender=(d,p,f,y,v,b)=>{t.tilemap.autoUpdate=!1,c.call(l,d,p,f,y,v,b)},l.onAfterRender=(d,p,f,y,v,b)=>{t.tilemap.autoUpdate=!0,u.call(l,d,p,f,y,v,b)},l.material.uniforms.size.value=.1,l.rotation.x=-Math.PI/2,l.position.set(r.x,s,r.z),t.viewer.addEventListener("update",()=>{l.material.uniforms.time.value+=1/60}),l}function Ml(a){let t=0;for(let l=1;l<a.length;l+=3)t+=a[l];t/=a.length/3;const e={x:0,z:0},n=[];for(let l=0;l<a.length;l+=3)e.x+=a[l],e.z+=a[l+2];e.x/=a.length/3,e.z/=a.length/3;for(let l=0;l<a.length;l+=3)n.push(new m.Vector2(a[l]-e.x,-(a[l+2]-e.z)));const r=new m.Shape(n);return{geometry:new m.ShapeGeometry(r),center:e,avgY:t}}async function Rf(a,t){const{geometry:e,center:n,avgY:r}=Ml(t),s=await Kt._loadTexture(a.normalMap),l=await Kt._loadTexture(a.normalMap);s.wrapS=s.wrapT=m.RepeatWrapping,l.wrapS=l.wrapT=m.RepeatWrapping,s.repeat.set(.015,.015),l.repeat.set(.005,.005);const c=new m.MeshStandardMaterial({color:new m.Color(a.color).multiplyScalar(3.5),roughness:.1,metalness:.8,transparent:!0,opacity:.9,fog:!1,normalMap:s,normalScale:new m.Vector2(1.5,1.5),envMapIntensity:2}),u=new m.Mesh(e,c);u.rotation.x=-Math.PI/2,u.position.set(n.x,r+.15,n.z),u.castShadow=!1,u.receiveShadow=!0;let d=0;return u.onBeforeRender=()=>{const p=performance.now(),f=d?(p-d)/1e3:.016;s.offset.x+=f*.08,s.offset.y+=f*.03,l.offset.x-=f*.12,l.offset.y+=f*.02,u.position.y=r+.5+Math.sin(p*.02)*.02,d=p},u}function Yf(a,t){a.color=new m.Color(a.hexcolor),a.boundstext&&(a.bounds=new m.Vector3(a.boundstext.x,a.boundstext.y,a.boundstext.z));const e=new kf(a);return e.castShadow=!0,e.scale.setScalar(50),e.position.copy(t),e}async function Uf(a,t){const n={...{fontSize:48,fontFamily:"'Microsoft YaHei', sans-serif",fontWeight:"bold",fontStyle:"normal",textColor:"#ffffff",strokeColor:"#000000",strokeWidth:2,showBackground:!0,bgStyle:1,bgColor:"#3498db",bgOpacity:.8,shadowColor:"rgba(0, 0, 0, 0.5)",shadowBlur:5,shadowOffsetX:3,shadowOffsetY:3,roundRectRadius:20,bubblePointerHeight:10,bubblePointerWidth:15,bubbleBorderColor:"#ffffff",bubbleBorderWidth:3,fixedSize:50},...a};n.fontSize=Math.min(Math.max(n.fontSize,8),128);const r=document.createElement("canvas"),s=r.getContext("2d");if(!s)throw new Error("canvas context is null");const l=`${n.fontStyle} ${n.fontWeight} ${n.fontSize}px ${n.fontFamily}`;s.font=l;const c=n.showBackground?20:0,u=100,d=50,p=s.measureText(n.text),f=Math.max(u,p.width+c*2),y=Math.max(d,n.fontSize*1.5+c*2);r.width=Math.min(f,2048),r.height=Math.min(y,2048),s.clearRect(0,0,r.width,r.height),s.font=l,n.showBackground&&(n.bgStyle===1?(s.fillStyle=n.bgColor,s.globalAlpha=n.bgOpacity,s.beginPath(),Ll(s,c/2,c/2,r.width-c,r.height-c,n.roundRectRadius),s.fill(),s.globalAlpha=1,s.shadowColor=n.shadowColor,s.shadowBlur=n.shadowBlur,s.shadowOffsetX=n.shadowOffsetX,s.shadowOffsetY=n.shadowOffsetY):(s.fillStyle=n.bgColor,s.globalAlpha=n.bgOpacity,s.beginPath(),Sl(s,r.width/2,r.height/2,r.width*.8,r.height*.8,n.roundRectRadius,n.bubblePointerHeight,n.bubblePointerWidth),s.fill(),s.globalAlpha=1,s.strokeStyle=n.bubbleBorderColor,s.lineWidth=n.bubbleBorderWidth,s.stroke())),s.textAlign="center",s.textBaseline="middle",n.strokeWidth>0&&(s.strokeStyle=n.strokeColor,s.lineWidth=n.strokeWidth,s.lineJoin="round",s.strokeText(n.text,r.width/2,r.height/2)),s.fillStyle=n.textColor,s.fillText(n.text,r.width/2,r.height/2),s.shadowColor="transparent";const v=new m.CanvasTexture(r);v.magFilter=m.NearestFilter,v.minFilter=m.LinearMipmapLinearFilter,v.anisotropy=16;const b=new m.SpriteMaterial({map:v,transparent:!0,depthTest:!1,depthWrite:!1,fog:!1}),T=new m.Sprite(b),_=n.fixedSize;return T.scale.set(r.width*_/100,r.height*_/100,1),t&&T.position.copy(t),T.renderOrder=9999,T}async function Bf(a,t,e){const r={...{fontSize:48,fontFamily:"'Microsoft YaHei', sans-serif",fontWeight:"bold",fontStyle:"normal",textColor:"#ffffff",strokeColor:"#000000",strokeWidth:2,showBackground:!0,bgStyle:1,bgColor:"#3498db",bgOpacity:.8,shadowColor:"rgba(0, 0, 0, 0.5)",shadowBlur:5,shadowOffsetX:3,shadowOffsetY:3,roundRectRadius:20,bubblePointerHeight:10,bubblePointerWidth:15,bubbleBorderColor:"#ffffff",bubbleBorderWidth:3,screenSpaceSize:20,maxVisibleDistance:1/0},...a};r.fontSize=Math.min(Math.max(r.fontSize,8),128);const s=document.createElement("canvas"),l=s.getContext("2d");if(!l)throw new Error("Failed to get canvas context");const c=`${r.fontStyle} ${r.fontWeight} ${r.fontSize}px ${r.fontFamily}`;l.font=c;const u=r.showBackground?20:0,d=100,p=50,f=l.measureText(r.text),y=Math.max(d,f.width+u*2),v=Math.max(p,r.fontSize*1.5+u*2);s.width=Math.min(y,2048),s.height=Math.min(v,2048),l.clearRect(0,0,s.width,s.height),l.font=c,r.showBackground&&(r.bgStyle===1?(l.fillStyle=r.bgColor,l.globalAlpha=r.bgOpacity,l.beginPath(),Ll(l,u/2,u/2,s.width-u,s.height-u,r.roundRectRadius),l.fill(),l.globalAlpha=1,l.shadowColor=r.shadowColor,l.shadowBlur=r.shadowBlur,l.shadowOffsetX=r.shadowOffsetX,l.shadowOffsetY=r.shadowOffsetY):(l.fillStyle=r.bgColor,l.globalAlpha=r.bgOpacity,l.beginPath(),Sl(l,s.width/2,s.height/2,s.width*.8,s.height*.8,r.roundRectRadius,r.bubblePointerHeight,r.bubblePointerWidth),l.fill(),l.globalAlpha=1,l.strokeStyle=r.bubbleBorderColor,l.lineWidth=r.bubbleBorderWidth,l.stroke())),l.textAlign="center",l.textBaseline="middle",r.strokeWidth>0&&(l.strokeStyle=r.strokeColor,l.lineWidth=r.strokeWidth,l.lineJoin="round",l.strokeText(r.text,s.width/2,s.height/2)),l.fillStyle=r.textColor,l.fillText(r.text,s.width/2,s.height/2),l.shadowColor="transparent";const b=new m.CanvasTexture(s),T=new m.SpriteMaterial({map:b,transparent:!0,depthTest:!1,depthWrite:!1,fog:!1}),_=new m.Sprite(T);_.position.copy(t),_.renderOrder=9999,_.userData.isLabel=!0;const S=()=>{if(!_.visible)return;const I=e.viewer.camera.position.distanceTo(_.position);if(I>r.maxVisibleDistance){_.visible=!1;return}_.visible=!0;const F=new m.Vector2;e.viewer.renderer.getSize(F);const K=F.height,D=r.screenSpaceSize/s.height*(I/Math.tan(m.MathUtils.degToRad(e.viewer.camera.fov)/2))*(2/K);_.scale.set(D*s.width,D*s.height,1),_.lookAt(e.viewer.camera.position)};S();const L=()=>S();return _.addEventListener("dispose",()=>{e.viewer.renderer.domElement.removeEventListener("resize",S)}),e.viewer.renderer.domElement.addEventListener("resize",S),e.viewer.camera.addEventListener("change",S),_.onBeforeRender=L,_}function Ll(a,t,e,n,r,s){a.beginPath(),a.moveTo(t+s,e),a.lineTo(t+n-s,e),a.quadraticCurveTo(t+n,e,t+n,e+s),a.lineTo(t+n,e+r-s),a.quadraticCurveTo(t+n,e+r,t+n-s,e+r),a.lineTo(t+s,e+r),a.quadraticCurveTo(t,e+r,t,e+r-s),a.lineTo(t,e+s),a.quadraticCurveTo(t,e,t+s,e),a.closePath()}function Sl(a,t,e,n,r,s,l,c){if(n<=0)throw new Error("Width must be positive");if(r<=0)throw new Error("Height must be positive");if(s<0)throw new Error("Radius cannot be negative");const u=n,d=r,p=Math.min(s,n/2,r/2),f=l??10,y=c??15;a.beginPath(),a.moveTo(t-u/2+p,e-d/2),a.lineTo(t+u/2-p,e-d/2),a.quadraticCurveTo(t+u/2,e-d/2,t+u/2,e-d/2+p),a.lineTo(t+u/2,e+d/2-p),a.quadraticCurveTo(t+u/2,e+d/2,t+u/2-p,e+d/2),a.lineTo(t+y/2,e+d/2),a.lineTo(t,e+d/2+f),a.lineTo(t-y/2,e+d/2),a.lineTo(t-u/2+p,e+d/2),a.quadraticCurveTo(t-u/2,e+d/2,t-u/2,e+d/2-p),a.lineTo(t-u/2,e-d/2+p),a.quadraticCurveTo(t-u/2,e-d/2,t-u/2+p,e-d/2),a.closePath()}async function Nf(a,t,e){const{text:n,iconUrl:r,fontSize:s=30,iconSize:l=60,fontFamily:c="Arial",padding:u={},bgColor:d="rgba(0,0,0,0.0)",textColor:p="rgb(255,255,255)",strokeColor:f="rgb(0,0,0)",strokeWidth:y=s/9,iconScale:v=.8,canvasScale:b=1,renderbg:T=!0,textOffset:_={x:0,y:0}}=a,S={top:0,right:1,bottom:0,left:0,...u};let L=null;r&&(L=await Jf(r));const{canvas:I,width:F,height:K,center:D}=await jf({text:n,iconImage:L,fontSize:s,iconSize:l,fontFamily:c,padding:S,bgColor:d,textColor:p,strokeColor:f,strokeWidth:y,iconScale:v,canvasScale:b,renderbg:T,textOffset:_},t),O=new m.Texture(I);O.needsUpdate=!0;const V=new m.SpriteMaterial({map:O,transparent:!0,depthTest:!0,depthWrite:!0,blending:m.NormalBlending,sizeAttenuation:!1,alphaTest:.01}),R=new m.Sprite(V),P=.001;return R.scale.set(F*P,K*P,1),R.center.set(D[0],D[1]),e&&R.position.copy(e),R.renderOrder=999,R}async function jf(a,t){return new Promise(e=>{const{text:n,iconImage:r,fontSize:s,iconSize:l,fontFamily:c,padding:u,bgColor:d,textColor:p,strokeColor:f,strokeWidth:y,iconScale:v,canvasScale:b,renderbg:T,textOffset:_={x:0,y:0}}=a,L=document.createElement("canvas").getContext("2d");if(!L)throw new Error("Could not get temp canvas context");L.font=`500 ${s}px ${c}`;const I=L.measureText(n),F=I.width,K=I.actualBoundingBoxAscent||s*.8,D=I.actualBoundingBoxDescent||s*.2,O=r!==null;let V=0,R=0,P=0,k=0;if(O){V=0,R=0,P=l,k=l;const he=l/2+_.x,ve=l/2+_.y,ke=he,Ye=he+F,je=ve-K,Je=ve+D;V=Math.min(V,ke),P=Math.max(P,Ye),R=Math.min(R,je),k=Math.max(k,Je)}else{const he=_.x,ve=_.x+F,ke=_.y-K,Ye=_.y+D;V=he,P=ve,R=ke,k=Ye}const N=P-V,H=k-R,Q=Math.ceil(N+u.left+u.right)*b,q=Math.ceil(H+u.top+u.bottom)*b,J=u.left-V,oe=u.top-R,ie=t._getCanvas(Q,q,n);ie.width=Q,ie.height=q;const ee=ie.getContext("2d");if(!ee)throw new Error("Could not get canvas context");ee.clearRect(0,0,Q,q),ee.globalCompositeOperation="source-over",ee.save(),ee.scale(b,b);const me=Q/b,xe=q/b;if(T&&(ee.fillStyle=d,ee.fillRect(0,0,me,xe)),r){const he=J,ve=oe,ke=l*v,Ye=(l-ke)/2,je=(l-ke)/2;ee.imageSmoothingEnabled=!1,ee.drawImage(r,he+Ye,ve+je,ke,ke),ee.font=`500 ${s}px ${c}`,ee.textBaseline="alphabetic",ee.textAlign="left";const Je=J+l/2+_.x,Qe=oe+l/2+_.y;y>0&&(ee.strokeStyle=f,ee.lineWidth=y,ee.strokeText(n,Je,Qe)),ee.fillStyle=p,ee.fillText(n,Je,Qe)}else{ee.font=`500 ${s}px ${c}`,ee.textBaseline="alphabetic",ee.textAlign="left";const he=J+_.x,ve=oe+_.y;y>0&&(ee.strokeStyle=f,ee.lineWidth=y,ee.strokeText(n,he,ve)),ee.fillStyle=p,ee.fillText(n,he,ve)}ee.restore(),e({canvas:ie,width:me,height:xe,center:[(l*.5+u.left)/me,(1-v)*.5]})})}function Jf(a){return new Promise((t,e)=>{const n=new Image;n.crossOrigin="Anonymous",n.onload=()=>t(n),n.onerror=r=>e(new Error(`Failed to load image: ${a} ${r}`)),n.src=a})}async function Qf(a,t,e){const r=new m.CylinderGeometry(.2,.2,24,12),s=new m.MeshBasicMaterial({color:a.color}),l=await Kt._loadTexture(a.icon),c=new m.PointsMaterial({size:80*window.innerHeight/window.innerHeight,fog:!1,opacity:1,transparent:!0,toneMapped:!1,blending:m.AdditiveBlending,map:l,sizeAttenuation:!0,depthTest:!0,depthWrite:!1}),u=new m.InstancedMesh(r,s,t.length);u.position.add(e.prjcenter),u.castShadow=!0,u.renderOrder=1;const d=new m.Object3D,p=[];for(let b=0;b<t.length;b++){const T=t[b],_=new m.Vector3(T.coordinates[0],T.coordinates[1],T.coordinates[2]||0),L=e.geo2world(_).sub(e.prjcenter);d.position.copy(L),d.updateMatrix(),u.setMatrixAt(b,d.matrix),p.push(L.x,0,L.z)}const f=new Float32Array(p),y=new m.BufferGeometry;y.setAttribute("position",new m.BufferAttribute(f,3));const v=new m.Points(y,c);return v.position.add(e.prjcenter),v.position.y=1.5*10,v.renderOrder=99999999,v.visible=!0,console.log(e,"map"),{points:v,InstancedCol:u}}const Yt=class Yt{constructor(t){this.config=t}async applyTo(t){if(!t)return!1;try{switch(t.visible=this.config.visible!==!1,this.config.zIndex&&(t.renderOrder=this.config.zIndex),this.config.type){case"basic-point":case"icon-point":case"icon-label-point":return this._applyPointStyle(t);case"basic-line":return this._applyLineStyle(t);case"gltf":case"fbx":return this._applyModelStyle(t);case"basic-polygon":return this._applyPolygonStyle(t);case"extrude-polygon":return this._applyExtrudeStyle(t);case"water":case"base-water":return this._applyWaterStyle(t);case"cloud":return this._applyCloudStyle(t);case"canvas-label":case"canvas-label-fixed":return this._applyTextSpriteStyle(t);case"light":return this._applyLightStyle(t);case"custom":return this._applyCustomStyle(t);default:throw new Error("Unknown style type")}}catch(e){return console.error("Style apply failed:",e),t.visible=!1,!1}}async _applyPointStyle(t){const e=this.config;return e.type==="icon-point"?await this._applyIconPoint(t,e):e.type==="basic-point"?this._applyBasicPoint(t,e):e.type==="icon-label-point"&&this._applyIconLabelPoint(t,e),!0}async _applyIconPoint(t,e){let n;if(t instanceof m.Sprite)n=t;else if(n=await _l(e,t.position),n.position.copy(t.position),n.rotation.copy(t.rotation),n.scale.copy(t.scale),n.renderOrder=999,t.parent){let u=t.parent;u._threeGeometry=n,u._updateGeometry()}const r=e.size,[s,l]=Array.isArray(r)?r:[r,r];if(s<=0||l<=0){console.error("Invalid sprite size:",e.size),n.visible=!1;return}const c=n.material;try{if(c.map=await Yt._loadTexture(e.url),!c.map)throw new Error("Texture failed to load");c.needsUpdate=!0,n.scale.set(s,l,1),e.rotation!==void 0&&(n.rotation.z=e.rotation)}catch(u){console.error("Failed to load texture:",e.url,u),n.visible=!1}}_applyBasicPoint(t,e){let n;if(t instanceof m.Points)n=t;else if(n=xl(e,t.position),n.position.copy(t.position),n.rotation.copy(t.rotation),n.scale.copy(t.scale),n.renderOrder=999,t.parent){let s=t.parent;s._threeGeometry=n,s._updateGeometry()}const r=n.material;r.size=e.size,e.color&&r.color.set(e.color),e.glow&&(r.sizeAttenuation=!1)}_applyIconLabelPoint(t,e){return!0}_applyLineStyle(t){const e=this.config;if(t.parent){let n=t.parent;n._threeGeometry=$s(e,n._vertexPoints),n._updateGeometry()}return!0}_applyPolygonStyle(t){return!0}_applyExtrudeStyle(t){return!0}_applyWaterStyle(t){return!0}_applyCloudStyle(t){return!0}_applyTextSpriteStyle(t){return!0}_applyLightStyle(t){return!0}async _applyModelStyle(t){return!0}async _applyCustomStyle(t){const n=await this.config.build();return t instanceof m.Group&&(t.clear(),t.add(n)),!0}static async _loadTexture(t){if(Yt._textureCache.has(t))return Yt._textureCache.get(t);const e=await new Promise((n,r)=>{Yt._textureLoader.load(t,n,void 0,r)});return e.premultiplyAlpha=!0,Yt._textureCache.set(t,e),e}static create(t){return t instanceof Yt?t:new Yt(t)}};G(Yt,"_textureCache",new Map),G(Yt,"_textureLoader",new m.TextureLoader);let Kt=Yt;const et=[];for(let a=0;a<256;++a)et.push((a+256).toString(16).slice(1));function Hf(a,t=0){return(et[a[t+0]]+et[a[t+1]]+et[a[t+2]]+et[a[t+3]]+"-"+et[a[t+4]]+et[a[t+5]]+"-"+et[a[t+6]]+et[a[t+7]]+"-"+et[a[t+8]]+et[a[t+9]]+"-"+et[a[t+10]]+et[a[t+11]]+et[a[t+12]]+et[a[t+13]]+et[a[t+14]]+et[a[t+15]]).toLowerCase()}let eo;const Ef=new Uint8Array(16);function qf(){if(!eo){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");eo=crypto.getRandomValues.bind(crypto)}return eo(Ef)}const Tl={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function $f(a,t,e){if(Tl.randomUUID&&!a)return Tl.randomUUID();a=a||{};const n=a.random??a.rng?.()??qf();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,Hf(n)}var Gl=(a=>(a.POINT="point",a.LINE_VERTEX="line_vertex",a.POLYGON_CENTER="polygon_center",a.LABEL="label",a.ICON="icon",a.CLUSTER="cluster",a))(Gl||{}),rn=(a=>(a.NO_COLLISION="no_collision",a.PRIORITY_LOST="priority_lost",a.OUT_OF_VIEWPORT="out_of_viewport",a.ZOOM_FILTERED="zoom_filtered",a.MANUAL_HIDDEN="manual_hidden",a.GROUP_COLLISION="group_collision",a))(rn||{});class Yn extends Qs(xi(_i(m.Object3D))){constructor(e){super();G(this,"_position");G(this,"_threeGeometry");G(this,"_geometry");G(this,"_layer");G(this,"_style");G(this,"_id");G(this,"_styleQueue",[]);G(this,"_isApplyingStyle",!1);G(this,"_isGeometryInitializing",!1);G(this,"_collisionState",{visible:!0,reason:rn.NO_COLLISION,collidedWith:[],timestamp:Date.now()});G(this,"_collisionConfig",{enabled:!0,priority:50,padding:4,minZoom:0,maxZoom:24});G(this,"_animationRef",null);Ys(e.geometry,"geometry","geometry must be specified"),this._geometry=e.geometry,this._position=new m.Vector3(0,0,0),this._threeGeometry=new m.Object3D,e.userData&&(this.userData=Object.assign({},JSON.parse(JSON.stringify(e.userData)))),e.style&&this.setStyle(e.style),e.id?this._id=e.id:this._id=$f()}async initializeGeometry(){if(!(this._isGeometryInitializing||this._threeGeometry)){this._isGeometryInitializing=!0;try{await this._toThreeJSGeometry(),this._processStyleQueue()}finally{this._isGeometryInitializing=!1}}}setStyle(e){const n=e instanceof Kt?e:new Kt(e);this._style=n;const r=JSON.parse(JSON.stringify(n.config));return this._styleQueue.push(r),this._tryProcessQueue(),this}getStyle(){return this._style}async _applyStyleWithRetry(e,n=3,r=100){let s=null;for(let l=1;l<=n;l++)try{this._threeGeometry.parent||(this.add(this._threeGeometry),await new Promise(c=>requestAnimationFrame(c))),await e.applyTo(this._threeGeometry);return}catch(c){if(s=c,l<n){const u=r*Math.pow(2,l-1);await new Promise(d=>setTimeout(d,u))}}throw s||new Error("样式应用失败,重试次数耗尽")}async _processStyleQueue(){if(!this._threeGeometry||this._isApplyingStyle||this._styleQueue.length===0)return;this._isApplyingStyle=!0;const e=this._styleQueue[0];try{const n=new Kt(JSON.parse(JSON.stringify(e)));await this._applyStyleWithRetry(n),this._styleQueue.shift(),this._styleQueue.length>0&&await this._processStyleQueue()}catch(n){throw n}finally{this._isApplyingStyle=!1,this._styleQueue.length>0&&this._tryProcessQueue()}}_tryProcessQueue(){this._threeGeometry&&!this._isApplyingStyle&&this._styleQueue.length>0?this._processStyleQueue().catch(n=>{this._isApplyingStyle=!1,this._tryProcessQueue(),console.warn(n)}):!this._threeGeometry&&!this._isGeometryInitializing&&this.initializeGeometry()}addTo(e){return e.addFeature(this),this}getLayer(){return this._layer||null}getMap(){return this._layer?.getMap()||null}_bindLayer(e){if(this._layer&&this._layer!==e)throw new Error("Feature cannot be added to multiple layers");this._layer=e}_updateGeometry(){this._disposeGeometry(),this._threeGeometry&&(this._threeGeometry.position.copy(this._position),this._threeGeometry.renderOrder=999,this.add(this._threeGeometry),this.updateMatrixWorld(!0),this._tryProcessQueue())}_remove(){return this.getLayer()?(this._unbind(),this):this}_unbind(){const e=this.getLayer();e&&(e.onRemoveFeature&&e.onRemoveFeature(this),delete this._layer)}_disposeGeometry(){this._threeGeometry&&(this.clear(),"traverse"in this&&this._threeGeometry.traverse(e=>{e instanceof m.Mesh?(e.geometry?.dispose(),Array.isArray(e.material)?e.material.forEach(n=>n.dispose()):e.material?.dispose()):"isLine"in e&&e.isLine&&(e.geometry?.dispose(),e.material?.dispose())}))}get collidable(){return this._collisionConfig.enabled}get collisionType(){return Gl.POINT}getCollisionPriority(){return this.userData.collisionPriority??this._style?.config.collisionPriority??this._collisionConfig.priority}getScreenBoundingBox(e,n){if(!this.collidable)return null;try{const r=new m.Vector3;this._threeGeometry.getWorldPosition(r);const s=r.clone().project(e);if(!(s.x>=-1.1&&s.x<=1.1&&s.y>=-1.1&&s.y<=1.1&&s.z>=-1&&s.z<=1))return null;const{width:c,height:u}=n.domElement,d=(s.x*.5+.5)*c,p=(-s.y*.5+.5)*u,f=this._calculateCollisionBoundingBox(e,n);return f?{id:this._id,x:d+f.offsetX,y:p+f.offsetY,width:20+this._collisionConfig.padding*2,height:20+this._collisionConfig.padding*2,priority:this.getCollisionPriority(),featureId:this._id,layerId:this._layer?.getId()||"unknown",type:this.collisionType,data:this.getCollisionData()}:null}catch(r){return console.warn(`Feature ${this._id} 包围盒计算失败:`,r),null}}setCollisionVisibility(e,n=rn.MANUAL_HIDDEN){this._collisionState.visible!==e&&(this._animationRef!==null&&(cancelAnimationFrame(this._animationRef),this._animationRef=null),this.visible=e,this._applyFinalAlpha(e?1:0),this._collisionState={visible:e,reason:n,collidedWith:e?[]:this._collisionState.collidedWith,timestamp:Date.now()})}getCollisionVisibility(){return this._collisionState.visible}setCollisionConfig(e){return Object.assign(this._collisionConfig,e),this}enableCollision(){return this._collisionConfig.enabled=!0,this}disableCollision(){return this._collisionConfig.enabled=!1,this.setCollisionVisibility(!0,rn.MANUAL_HIDDEN),this}_applyVisibilityAlpha(e){this.traverse(n=>{n instanceof m.Mesh&&(Array.isArray(n.material)?n.material.forEach(r=>{r.opacity!==void 0&&(r.opacity=e)}):n.material.opacity!==void 0&&(n.material.opacity=e))})}_applyFinalAlpha(e){this._applyVisibilityAlpha(e),this.traverse(n=>{n instanceof m.Mesh&&(n.material.needsUpdate=!0)})}getCollisionData(){return{featureType:this.constructor.name,userData:this.userData,styleConfig:this._style?.config}}_calculateCollisionBoundingBox(e,n){if(!this.visible||!this._threeGeometry||!e||!n)return null;try{const r=new m.Box3().setFromObject(this._threeGeometry);if(r.isEmpty())return this._getFallbackBoundingBox();const s=[new m.Vector3(r.min.x,r.min.y,r.min.z),new m.Vector3(r.max.x,r.min.y,r.min.z),new m.Vector3(r.min.x,r.max.y,r.min.z),new m.Vector3(r.max.x,r.max.y,r.min.z),new m.Vector3(r.min.x,r.min.y,r.max.z),new m.Vector3(r.max.x,r.min.y,r.max.z),new m.Vector3(r.min.x,r.max.y,r.max.z),new m.Vector3(r.max.x,r.max.y,r.max.z)],{width:l,height:c}=n.domElement,u=[];s.forEach(D=>{const O=D.clone().project(e),V=(O.x*.5+.5)*l,R=(-O.y*.5+.5)*c;u.push(new m.Vector2(V,R))});let d=1/0,p=-1/0,f=1/0,y=-1/0;u.forEach(D=>{d=Math.min(d,D.x),p=Math.max(p,D.x),f=Math.min(f,D.y),y=Math.max(y,D.y)});const v=p-d,b=y-f,T=4,_=Math.max(v,T),S=Math.max(b,T),L=new m.Vector3;r.getCenter(L);const I=L.clone().project(e),F=(I.x*.5+.5)*l,K=(-I.y*.5+.5)*c;return{width:_,height:S,offsetX:d-F,offsetY:f-K}}catch(r){return console.warn("包围盒计算失败:",r),this._getFallbackBoundingBox()}}_getFallbackBoundingBox(){return{width:20,height:20,offsetX:-10,offsetY:-10}}_tileCoordToLocalWorld(e,n,r,s){const{tileZ:l,tileX:c,tileY:u,extent:d,tileSize:p}=r,f=(e/d-.5)*p,y=(.5-n/d)*p;return s.tileIDToWorldCenter(l,c,u).clone().add(new m.Vector3(f,y,0)).sub(s.prjcenter)}}class Un extends Mi{constructor(e,n){super(e,n);G(this,"_feaList");G(this,"_collision",!1);this._feaList=[],n?.collision&&(this._collision=!0)}addFeature(e){const n=Array.isArray(e)?e:[e];for(const r of n)if(!(!r||!(r instanceof Yn))&&!r.getLayer()){if(!this.validateFeature(r)){console.error(`Feature ${r.id} does not match the layer's type requirements`);continue}r._bindLayer(this),this._feaList.push(r),r.getMap()&&r._toThreeJSGeometry(),this._clouds&&(this.map.viewer.scene.add(this._clouds),console.log("我是云朵被添加cloud",this.map.viewer.scene)),this.add(r)}return this}getFeatures(e,n){if(!e)return this._feaList.slice(0);const r=[];let s,l;for(let c=0,u=this._feaList.length;c<u;c++)s=this._feaList[c],n?l=e.call(n,s):l=e(s),l&&r.push(s);return r}getCount(){return this._feaList.length}isEmpty(){return!this._feaList.length}removeFeature(e){if(!Array.isArray(e))return this.removeFeature([e]);for(let n=e.length-1;n>=0;n--)e[n]instanceof Yn||(e[n]=this.removeFeature(e[n])),!(!e[n]||this!==e[n].getLayer())&&e[n]._remove();return this}onRemoveFeature(e){if(!e)return;const n=e.getLayer();if(!n||n!==this)return;const r=this._findInList(e);r>=0&&this._feaList.splice(r,1),e.parent&&e.parent===this?this.remove(e):console.warn("Feature parent mismatch:",e.parent),this._disposeFeatureResources(e)}_findInList(e){const n=this._feaList.length;if(n===0)return-1;let r=0,s=n-1,l;for(;r<=s;){if(l=Math.floor((r+s)/2),this._feaList[l]===e)return l;r=l+1}return-1}_disposeFeatureResources(e){try{e.geometry&&e.geometry.dispose&&e.geometry.dispose(),e.material&&(Array.isArray(e.material)?e.material.forEach(n=>n.dispose?.()):e.material.dispose&&e.material.dispose()),e instanceof m.Object3D&&e.traverse(n=>{n!==e&&this._disposeFeatureResources(n)})}catch(n){console.error("Error disposing feature resources:",n)}}_mergedGeometry(){this.traverse(e=>{e.isMesh&&e.geometry&&e.material&&console.log("几何体合并中",e)})}setCollisionEngine(e){return this._collisionEngine=e,this}}class ep extends m.Group{constructor(){super(...arguments);G(this,"_layers",new Set);G(this,"_layerids",new Set)}add(...e){return e.forEach(n=>{if(!(n instanceof Mi))throw new Error("LayerContainer只能包含Layer实例!");const r=n.getId();if(this._layerids.has(r))throw new Error(`ID为'${r}'的图层已存在于容器中!`);this._layers.add(n),this._layerids.add(r),super.add(n)}),this}remove(...e){return e.forEach(n=>{this._layers.delete(n),this._layerids.delete(n.getId()),super.remove(n)}),this}getLayers(){return Array.from(this._layers)}getLayerById(e){for(const n of this._layers)if(n.getId()===e)return n}clearLayers(){return this._layers.clear(),this._layerids.clear(),super.clear(),this}}class tp{constructor(){G(this,"canvasDict",{})}getCanvas(t=40,e=30,n=1,r){const s=Math.ceil(t*n),l=Math.ceil(e*n),c=r?`${s}_${l}_${r}`:`${s}_${l}`;if(!this.canvasDict[c]){const p=document.createElement("canvas");p.width=s,p.height=l,this.canvasDict[c]=p}const u=this.canvasDict[c],d=u.getContext("2d");return d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,u.width,u.height),d.scale(n,n),u}}function np(a){const t=+this._x.call(null,a),e=+this._y.call(null,a);return Zl(this.cover(t,e),t,e,a)}function Zl(a,t,e,n){if(isNaN(t)||isNaN(e))return a;var r,s=a._root,l={data:n},c=a._x0,u=a._y0,d=a._x1,p=a._y1,f,y,v,b,T,_,S,L;if(!s)return a._root=l,a;for(;s.length;)if((T=t>=(f=(c+d)/2))?c=f:d=f,(_=e>=(y=(u+p)/2))?u=y:p=y,r=s,!(s=s[S=_<<1|T]))return r[S]=l,a;if(v=+a._x.call(null,s.data),b=+a._y.call(null,s.data),t===v&&e===b)return l.next=s,r?r[S]=l:a._root=l,a;do r=r?r[S]=new Array(4):a._root=new Array(4),(T=t>=(f=(c+d)/2))?c=f:d=f,(_=e>=(y=(u+p)/2))?u=y:p=y;while((S=_<<1|T)===(L=(b>=y)<<1|v>=f));return r[L]=s,r[S]=l,a}function rp(a){var t,e,n=a.length,r,s,l=new Array(n),c=new Array(n),u=1/0,d=1/0,p=-1/0,f=-1/0;for(e=0;e<n;++e)isNaN(r=+this._x.call(null,t=a[e]))||isNaN(s=+this._y.call(null,t))||(l[e]=r,c[e]=s,r<u&&(u=r),r>p&&(p=r),s<d&&(d=s),s>f&&(f=s));if(u>p||d>f)return this;for(this.cover(u,d).cover(p,f),e=0;e<n;++e)Zl(this,l[e],c[e],a[e]);return this}function ip(a,t){if(isNaN(a=+a)||isNaN(t=+t))return this;var e=this._x0,n=this._y0,r=this._x1,s=this._y1;if(isNaN(e))r=(e=Math.floor(a))+1,s=(n=Math.floor(t))+1;else{for(var l=r-e||1,c=this._root,u,d;e>a||a>=r||n>t||t>=s;)switch(d=(t<n)<<1|a<e,u=new Array(4),u[d]=c,c=u,l*=2,d){case 0:r=e+l,s=n+l;break;case 1:e=r-l,s=n+l;break;case 2:r=e+l,n=s-l;break;case 3:e=r-l,n=s-l;break}this._root&&this._root.length&&(this._root=c)}return this._x0=e,this._y0=n,this._x1=r,this._y1=s,this}function sp(){var a=[];return this.visit(function(t){if(!t.length)do a.push(t.data);while(t=t.next)}),a}function op(a){return arguments.length?this.cover(+a[0][0],+a[0][1]).cover(+a[1][0],+a[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function at(a,t,e,n,r){this.node=a,this.x0=t,this.y0=e,this.x1=n,this.y1=r}function ap(a,t,e){var n,r=this._x0,s=this._y0,l,c,u,d,p=this._x1,f=this._y1,y=[],v=this._root,b,T;for(v&&y.push(new at(v,r,s,p,f)),e==null?e=1/0:(r=a-e,s=t-e,p=a+e,f=t+e,e*=e);b=y.pop();)if(!(!(v=b.node)||(l=b.x0)>p||(c=b.y0)>f||(u=b.x1)<r||(d=b.y1)<s))if(v.length){var _=(l+u)/2,S=(c+d)/2;y.push(new at(v[3],_,S,u,d),new at(v[2],l,S,_,d),new at(v[1],_,c,u,S),new at(v[0],l,c,_,S)),(T=(t>=S)<<1|a>=_)&&(b=y[y.length-1],y[y.length-1]=y[y.length-1-T],y[y.length-1-T]=b)}else{var L=a-+this._x.call(null,v.data),I=t-+this._y.call(null,v.data),F=L*L+I*I;if(F<e){var K=Math.sqrt(e=F);r=a-K,s=t-K,p=a+K,f=t+K,n=v.data}}return n}function lp(a){if(isNaN(p=+this._x.call(null,a))||isNaN(f=+this._y.call(null,a)))return this;var t,e=this._root,n,r,s,l=this._x0,c=this._y0,u=this._x1,d=this._y1,p,f,y,v,b,T,_,S;if(!e)return this;if(e.length)for(;;){if((b=p>=(y=(l+u)/2))?l=y:u=y,(T=f>=(v=(c+d)/2))?c=v:d=v,t=e,!(e=e[_=T<<1|b]))return this;if(!e.length)break;(t[_+1&3]||t[_+2&3]||t[_+3&3])&&(n=t,S=_)}for(;e.data!==a;)if(r=e,!(e=e.next))return this;return(s=e.next)&&delete e.next,r?(s?r.next=s:delete r.next,this):t?(s?t[_]=s:delete t[_],(e=t[0]||t[1]||t[2]||t[3])&&e===(t[3]||t[2]||t[1]||t[0])&&!e.length&&(n?n[S]=e:this._root=e),this):(this._root=s,this)}function cp(a){for(var t=0,e=a.length;t<e;++t)this.remove(a[t]);return this}function up(){return this._root}function hp(){var a=0;return this.visit(function(t){if(!t.length)do++a;while(t=t.next)}),a}function dp(a){var t=[],e,n=this._root,r,s,l,c,u;for(n&&t.push(new at(n,this._x0,this._y0,this._x1,this._y1));e=t.pop();)if(!a(n=e.node,s=e.x0,l=e.y0,c=e.x1,u=e.y1)&&n.length){var d=(s+c)/2,p=(l+u)/2;(r=n[3])&&t.push(new at(r,d,p,c,u)),(r=n[2])&&t.push(new at(r,s,p,d,u)),(r=n[1])&&t.push(new at(r,d,l,c,p)),(r=n[0])&&t.push(new at(r,s,l,d,p))}return this}function fp(a){var t=[],e=[],n;for(this._root&&t.push(new at(this._root,this._x0,this._y0,this._x1,this._y1));n=t.pop();){var r=n.node;if(r.length){var s,l=n.x0,c=n.y0,u=n.x1,d=n.y1,p=(l+u)/2,f=(c+d)/2;(s=r[0])&&t.push(new at(s,l,c,p,f)),(s=r[1])&&t.push(new at(s,p,c,u,f)),(s=r[2])&&t.push(new at(s,l,f,p,d)),(s=r[3])&&t.push(new at(s,p,f,u,d))}e.push(n)}for(;n=e.pop();)a(n.node,n.x0,n.y0,n.x1,n.y1);return this}function pp(a){return a[0]}function mp(a){return arguments.length?(this._x=a,this):this._x}function gp(a){return a[1]}function yp(a){return arguments.length?(this._y=a,this):this._y}function Il(a,t,e){var n=new to(t??pp,e??gp,NaN,NaN,NaN,NaN);return a==null?n:n.addAll(a)}function to(a,t,e,n,r,s){this._x=a,this._y=t,this._x0=e,this._y0=n,this._x1=r,this._y1=s,this._root=void 0}function Wl(a){for(var t={data:a.data},e=t;a=a.next;)e=e.next={data:a.data};return t}var lt=Il.prototype=to.prototype;lt.copy=function(){var a=new to(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,e,n;if(!t)return a;if(!t.length)return a._root=Wl(t),a;for(e=[{source:t,target:a._root=new Array(4)}];t=e.pop();)for(var r=0;r<4;++r)(n=t.source[r])&&(n.length?e.push({source:n,target:t.target[r]=new Array(4)}):t.target[r]=Wl(n));return a},lt.add=np,lt.addAll=rp,lt.cover=ip,lt.data=sp,lt.extent=op,lt.find=ap,lt.remove=lp,lt.removeAll=cp,lt.root=up,lt.size=hp,lt.visit=dp,lt.visitAfter=fp,lt.x=mp,lt.y=yp;class Pl{constructor(t){G(this,"_quadtree");G(this,"_viewport");this._viewport=t,this._rebuildQuadTree()}updateViewport(t){(t.width!==this._viewport.width||t.height!==this._viewport.height)&&(this._viewport=t,this._rebuildQuadTree())}addBoxes(t){t.forEach(e=>{this._isBoxInViewport(e)&&this._quadtree.add(e)})}findCollisions(t){const e=[],n=this._getSearchBounds(t);return this._quadtree.visit((r,s,l,c,u)=>this._checkNodeCollision(n,s,l,c,u)?(r.length||this._getNodeData(r).forEach(p=>{p.id!==t.id&&this._checkBoxCollision(t,p)&&e.push(p)}),!1):void 0),e}clear(){this._rebuildQuadTree()}getAllBoxes(){const t=[];return this._quadtree.visit(e=>{if(!e.length){const n=this._getNodeData(e);t.push(...n)}return!1}),t}_rebuildQuadTree(){this._quadtree=Il().x(t=>t.x).y(t=>t.y).extent([[0,0],[this._viewport.width,this._viewport.height]])}_isBoxInViewport(t){const e=t.width/2,n=t.height/2;return t.x+e>=0&&t.x-e<=this._viewport.width&&t.y+n>=0&&t.y-n<=this._viewport.height}_getSearchBounds(t){return{x:t.x,y:t.y,width:t.width*2,height:t.height*2}}_checkNodeCollision(t,e,n,r,s){const l=(e+r)/2,c=(n+s)/2,u=r-e,d=s-n;return Math.abs(t.x-l)*2<t.width+u&&Math.abs(t.y-c)*2<t.height+d}_checkBoxCollision(t,e){return Math.abs(t.x-e.x)*2<t.width+e.width&&Math.abs(t.y-e.y)*2<t.height+e.height}_getNodeData(t){return t?Array.isArray(t.data)?t.data:t.data?[t.data]:[]:[]}removeBox(t){const n=this.getAllBoxes().filter(r=>r.id!==t);this.clear(),n.length>0&&this.addBoxes(n)}}class vp{constructor(){G(this,"_strategies",new Map);G(this,"_executionOrder",[])}registerStrategy(t,e){return this._strategies.set(t.name,t),e!==void 0?this._executionOrder.splice(e,0,t.name):this._executionOrder.push(t.name),this}async executeStrategies(t,e){const n=new Map;t.forEach(r=>{n.set(r._id,{featureId:r._id,visible:!0,reason:rn.NO_COLLISION,collidedWith:[],timestamp:e.timestamp})});for(const r of this._executionOrder){const s=this._strategies.get(r);if(s?.enabled)try{const l=await s.execute(t,e,n);this._mergeResults(n,l)}catch(l){console.error(`策略 ${r} 执行失败:`,l)}}return n}_mergeResults(t,e){e.forEach(n=>{const r=t.get(n.featureId);r&&!r.visible||t.set(n.featureId,n)})}}class wp{constructor(){G(this,"frameStats",new Map);G(this,"summaryStats",{totalFrames:0,averageFrameTime:0,averageFPS:0,minFrameTime:1/0,maxFrameTime:0,totalFeaturesProcessed:0});G(this,"sampleWindowSize",60);G(this,"currentFrameId",0);G(this,"lastReportTime",0);G(this,"reportInterval",5e3);G(this,"performanceThresholds",{criticalFrameTime:33,warningFrameTime:16,idealFrameTime:8});this.lastReportTime=Date.now()}startFrame(t){this.currentFrameId=t;const e={frameId:t,startTime:performance.now(),endTime:0,duration:0,featureCount:0,visibleCount:0,hiddenCount:0,collisionChecks:0,memoryUsage:0,strategyTimes:new Map};this.frameStats.set(t,e),this.cleanupOldFrames()}endFrame(t,e){const n=this.frameStats.get(t);if(!n)return;const r=performance.now();n.endTime=r,n.duration=r-n.startTime,e&&Object.assign(n,e),"memory"in performance&&(n.memoryUsage=performance.memory.usedJSHeapSize),this.updateSummaryStats(n),this.maybeOutputReport()}recordStrategyTime(t,e){const n=this.frameStats.get(this.currentFrameId);n&&n.strategyTimes.set(t,e)}recordCollisionChecks(t){const e=this.frameStats.get(this.currentFrameId);e&&(e.collisionChecks+=t)}getStats(){const t=this.getRecentFrames(this.sampleWindowSize),e=this.calculateFPS(t),n=this.calculateAverageFrameTime(t);return{summary:{...this.summaryStats},recent:{fps:e,frameTime:n,frameTimeStdDev:this.calculateFrameTimeStdDev(t),averageFeaturesPerFrame:this.calculateAverageFeatures(t),performanceLevel:this.getPerformanceLevel(n)},currentFrame:this.frameStats.get(this.currentFrameId)||null,strategies:this.getStrategyPerformance(t),warnings:this.getPerformanceWarnings(t)}}getDetailedReport(){const t=this.getRecentFrames(this.sampleWindowSize),e=this.getStats();return{...e,frameHistory:Array.from(t.values()),trends:this.calculateTrends(t),recommendations:this.getPerformanceRecommendations(e)}}reset(){this.frameStats.clear(),this.summaryStats={totalFrames:0,averageFrameTime:0,averageFPS:0,minFrameTime:1/0,maxFrameTime:0,totalFeaturesProcessed:0},this.currentFrameId=0,this.lastReportTime=Date.now()}cleanupOldFrames(){this.frameStats.size>this.sampleWindowSize*2&&Array.from(this.frameStats.keys()).sort((e,n)=>e-n).slice(0,this.frameStats.size-this.sampleWindowSize).forEach(e=>{this.frameStats.delete(e)})}updateSummaryStats(t){this.summaryStats.totalFrames++,this.summaryStats.totalFeaturesProcessed+=t.featureCount||0,this.summaryStats.averageFrameTime=(this.summaryStats.averageFrameTime*(this.summaryStats.totalFrames-1)+t.duration)/this.summaryStats.totalFrames,this.summaryStats.minFrameTime=Math.min(this.summaryStats.minFrameTime,t.duration),this.summaryStats.maxFrameTime=Math.max(this.summaryStats.maxFrameTime,t.duration),this.summaryStats.averageFPS=1e3/this.summaryStats.averageFrameTime}maybeOutputReport(){const t=Date.now();if(t-this.lastReportTime>=this.reportInterval){const e=this.getStats();e.warnings.length>0?console.warn("避让系统性能报告:",e):console.log("避让系统性能正常:",e),this.lastReportTime=t}}getRecentFrames(t){return Array.from(this.frameStats.values()).slice(-t).filter(n=>n.duration>0)}calculateFPS(t){if(t.length===0)return 0;const e=this.calculateAverageFrameTime(t);return e>0?1e3/e:0}calculateAverageFrameTime(t){return t.length===0?0:t.reduce((e,n)=>e+n.duration,0)/t.length}calculateFrameTimeStdDev(t){if(t.length===0)return 0;const e=this.calculateAverageFrameTime(t),n=t.map(r=>Math.pow(r.duration-e,2));return Math.sqrt(n.reduce((r,s)=>r+s,0)/t.length)}calculateAverageFeatures(t){return t.length===0?0:t.reduce((e,n)=>e+(n.featureCount||0),0)/t.length}getPerformanceLevel(t){return t>this.performanceThresholds.criticalFrameTime?"critical":t>this.performanceThresholds.warningFrameTime?"warning":t>this.performanceThresholds.idealFrameTime?"good":"excellent"}getStrategyPerformance(t){const e=new Map;return t.forEach(n=>{n.strategyTimes.forEach((r,s)=>{e.has(s)||e.set(s,[]),e.get(s).push(r)})}),Array.from(e.entries()).map(([n,r])=>({name:n,averageTime:r.reduce((s,l)=>s+l,0)/r.length,maxTime:Math.max(...r),minTime:Math.min(...r),callCount:r.length}))}getPerformanceWarnings(t){const e=[],n=t.slice(-30);if(n.length===0)return e;const r=this.calculateAverageFrameTime(n);r>this.performanceThresholds.criticalFrameTime?e.push({type:"critical",message:`帧率过低: ${Math.round(1e3/r)}fps`,suggestion:"考虑减少要素数量或简化避让策略"}):r>this.performanceThresholds.warningFrameTime&&e.push({type:"warning",message:`帧率较低: ${Math.round(1e3/r)}fps`,suggestion:"建议优化避让算法或增加更新间隔"});const s=n.map(l=>l.memoryUsage).filter(l=>l>0);if(s.length>0){const l=s.reduce((c,u)=>c+u,0)/s.length;l>100*1024*1024&&e.push({type:"warning",message:`内存使用较高: ${(l/1024/1024).toFixed(1)}MB`,suggestion:"检查内存泄漏,及时清理无用资源"})}return e}calculateTrends(t){if(t.length<2)return{frameTime:"stable",fps:"stable",features:"stable"};const e=t.slice(0,Math.floor(t.length/2)),n=t.slice(Math.floor(t.length/2)),r=this.calculateAverageFrameTime(e),l=(this.calculateAverageFrameTime(n)-r)/r*100;return{frameTime:Math.abs(l)<5?"stable":l>0?"worsening":"improving",fps:Math.abs(l)<5?"stable":l>0?"improving":"worsening",features:"stable"}}getPerformanceRecommendations(t){const e=[];return t.recent.performanceLevel==="critical"&&(e.push("建议启用要素抽样或聚合显示"),e.push("考虑增加避让更新间隔时间"),e.push("检查是否有不必要的避让策略")),t.recent.averageFeaturesPerFrame>5e3&&e.push("要素数量过多,建议启用LOD分级"),t.strategies.forEach(n=>{n.averageTime>10&&e.push(`策略 "${n.name}" 执行时间较长,考虑优化`)}),e}}class bp{constructor(){G(this,"name","priority");G(this,"enabled",!0);G(this,"weight",1);G(this,"description","基于优先级的避让策略,数值越小优先级越高")}async execute(t,e,n){const r=[],s=new Pl(e.viewport),l=[],c=new Map;return t.forEach(u=>{if(!u.collidable)return;const d=u.getScreenBoundingBox(e.camera,e.renderer);d&&(l.push(d),c.set(u._id,u),n?.get(u._id)?.visible)}),l.sort((u,d)=>u.priority-d.priority),l.forEach(u=>{const d=s.findCollisions(u);d.length===0?(s.addBoxes([u]),r.push({featureId:u.featureId,visible:!0,reason:rn.NO_COLLISION,collidedWith:[],timestamp:e.timestamp})):d.some(f=>f.priority<u.priority)?r.push({featureId:u.featureId,visible:!1,reason:rn.PRIORITY_LOST,collidedWith:d.map(f=>f.featureId),timestamp:e.timestamp}):(s.addBoxes([u]),r.push({featureId:u.featureId,visible:!0,reason:rn.NO_COLLISION,collidedWith:[],timestamp:e.timestamp}),d.forEach(f=>{r.push({featureId:f.featureId,visible:!1,reason:rn.PRIORITY_LOST,collidedWith:[u.featureId],timestamp:e.timestamp})}))}),r}}class xp{constructor(t,e={}){G(this,"_quadTreeManager");G(this,"_strategyOrchestrator");G(this,"_performanceMonitor");G(this,"_layers",new Set);G(this,"_config");G(this,"_isUpdating",!1);G(this,"_lastUpdateTime",0);G(this,"_frameCount",0);this.renderer=t,this._config={enabled:!0,padding:4,updateInterval:0,animationDuration:300,maxFeaturesPerFrame:2e3,viewportMargin:50,strategies:{priority:!0,grouping:!1,proximity:!1},...e},this._initializeComponents(),this._setupPerformanceMonitoring()}async update(t){if(!this._config.enabled||this._isUpdating)return;const e=Date.now();if(!(this._config.updateInterval>0&&e-this._lastUpdateTime<this._config.updateInterval)){this._isUpdating=!0,this._frameCount++;try{this._resetAllFeaturesVisibility();const n=this._createCollisionContext(t,e),r=this._collectCollidableFeatures();if(r.length===0)return;this._performanceMonitor.startFrame(this._frameCount);const s=await this._strategyOrchestrator.executeStrategies(r,n);await this._applyCollisionResults(s,r),this._performanceMonitor.endFrame(this._frameCount,{featureCount:r.length,visibleCount:Array.from(s.values()).filter(l=>l.visible).length,hiddenCount:Array.from(s.values()).filter(l=>!l.visible).length}),this._lastUpdateTime=e}catch(n){console.error("避让引擎更新失败:",n)}finally{this._isUpdating=!1}}}_resetAllFeaturesVisibility(){this._layers.forEach(t=>{t.getFeatures().filter(n=>n.collidable).forEach(n=>{n.setCollisionVisibility(!0,rn.NO_COLLISION)})})}registerLayer(t){return this._layers.add(t),this}unregisterLayer(t){return this._layers.delete(t),this}setConfig(t){return Object.assign(this._config,t),this}getPerformanceStats(){return this._performanceMonitor.getStats()}_initializeComponents(){const t={width:this.renderer.domElement.width,height:this.renderer.domElement.height};this._quadTreeManager=new Pl(t),this._strategyOrchestrator=new vp,this._performanceMonitor=new wp,this._strategyOrchestrator.registerStrategy(new bp,0),this._setupViewportResizeHandler()}_createCollisionContext(t,e){return{camera:t,renderer:this.renderer,viewport:{width:this.renderer.domElement.width,height:this.renderer.domElement.height},zoomLevel:t.position.z,timestamp:e,frameNumber:this._frameCount}}_collectCollidableFeatures(){const t=[];return this._layers.forEach(e=>{const n=e.getFeatures().filter(r=>r.collidable&&r instanceof Yn);if(t.length+n.length>this._config.maxFeaturesPerFrame){console.warn(`达到每帧最大要素处理限制: ${this._config.maxFeaturesPerFrame}`);return}t.push(...n)}),t}async _applyCollisionResults(t,e){const n=e.map(r=>{const s=t.get(r._id);return s&&r.setCollisionVisibility(s.visible,s.reason),Promise.resolve()});await Promise.all(n)}_setupViewportResizeHandler(){new ResizeObserver(e=>{e.forEach(n=>{const{width:r,height:s}=n.contentRect;this._quadTreeManager.updateViewport({width:r,height:s})})}).observe(this.renderer.domElement)}_setupPerformanceMonitoring(){setInterval(()=>{const t=this.getPerformanceStats();t.frameRate<30&&console.warn("避让系统性能警告:",t)},5e3)}}var Yr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ti={exports:{}};/**
|
|
539
|
+
`,transparent:!0,side:m.DoubleSide,depthWrite:!0}),p=new m.Mesh(l,d);return p.renderOrder=5e3,p}function Kf(a,t,e){const{geometry:n,center:r,avgY:s}=Ml(e),l=new Jh(n,{textureWidth:512,textureHeight:512,waterNormals:new m.TextureLoader().load(a.normalMap,function(d){d.wrapS=d.wrapT=m.RepeatWrapping}),waterColor:a.color||"#19AAEE",sunColor:a.sunColor||"#05FFF8",distortionScale:1,alpha:a.opacity||.8}),c=l.onBeforeRender,u=l.onAfterRender;return l.onBeforeRender=(d,p,f,y,v,b)=>{t.tilemap.autoUpdate=!1,c.call(l,d,p,f,y,v,b)},l.onAfterRender=(d,p,f,y,v,b)=>{t.tilemap.autoUpdate=!0,u.call(l,d,p,f,y,v,b)},l.material.uniforms.size.value=.1,l.rotation.x=-Math.PI/2,l.position.set(r.x,s,r.z),t.viewer.addEventListener("update",()=>{l.material.uniforms.time.value+=1/60}),l}function Ml(a){let t=0;for(let l=1;l<a.length;l+=3)t+=a[l];t/=a.length/3;const e={x:0,z:0},n=[];for(let l=0;l<a.length;l+=3)e.x+=a[l],e.z+=a[l+2];e.x/=a.length/3,e.z/=a.length/3;for(let l=0;l<a.length;l+=3)n.push(new m.Vector2(a[l]-e.x,-(a[l+2]-e.z)));const r=new m.Shape(n);return{geometry:new m.ShapeGeometry(r),center:e,avgY:t}}async function Rf(a,t){const{geometry:e,center:n,avgY:r}=Ml(t),s=await It._loadTexture(a.normalMap),l=await It._loadTexture(a.normalMap);s.wrapS=s.wrapT=m.RepeatWrapping,l.wrapS=l.wrapT=m.RepeatWrapping,s.repeat.set(.015,.015),l.repeat.set(.005,.005);const c=new m.MeshStandardMaterial({color:new m.Color(a.color).multiplyScalar(3.5),roughness:.1,metalness:.8,transparent:!0,opacity:.9,fog:!1,normalMap:s,normalScale:new m.Vector2(1.5,1.5),envMapIntensity:2}),u=new m.Mesh(e,c);u.rotation.x=-Math.PI/2,u.position.set(n.x,r+.15,n.z),u.castShadow=!1,u.receiveShadow=!0;let d=0;return u.onBeforeRender=()=>{const p=performance.now(),f=d?(p-d)/1e3:.016;s.offset.x+=f*.08,s.offset.y+=f*.03,l.offset.x-=f*.12,l.offset.y+=f*.02,u.position.y=r+.5+Math.sin(p*.02)*.02,d=p},u}function Yf(a,t){a.color=new m.Color(a.hexcolor),a.boundstext&&(a.bounds=new m.Vector3(a.boundstext.x,a.boundstext.y,a.boundstext.z));const e=new kf(a);return e.castShadow=!0,e.scale.setScalar(50),e.position.copy(t),e}async function Uf(a,t){const n={...{fontSize:48,fontFamily:"'Microsoft YaHei', sans-serif",fontWeight:"bold",fontStyle:"normal",textColor:"#ffffff",strokeColor:"#000000",strokeWidth:2,showBackground:!0,bgStyle:1,bgColor:"#3498db",bgOpacity:.8,shadowColor:"rgba(0, 0, 0, 0.5)",shadowBlur:5,shadowOffsetX:3,shadowOffsetY:3,roundRectRadius:20,bubblePointerHeight:10,bubblePointerWidth:15,bubbleBorderColor:"#ffffff",bubbleBorderWidth:3,fixedSize:50},...a};n.fontSize=Math.min(Math.max(n.fontSize,8),128);const r=document.createElement("canvas"),s=r.getContext("2d");if(!s)throw new Error("canvas context is null");const l=`${n.fontStyle} ${n.fontWeight} ${n.fontSize}px ${n.fontFamily}`;s.font=l;const c=n.showBackground?20:0,u=100,d=50,p=s.measureText(n.text),f=Math.max(u,p.width+c*2),y=Math.max(d,n.fontSize*1.5+c*2);r.width=Math.min(f,2048),r.height=Math.min(y,2048),s.clearRect(0,0,r.width,r.height),s.font=l,n.showBackground&&(n.bgStyle===1?(s.fillStyle=n.bgColor,s.globalAlpha=n.bgOpacity,s.beginPath(),Ll(s,c/2,c/2,r.width-c,r.height-c,n.roundRectRadius),s.fill(),s.globalAlpha=1,s.shadowColor=n.shadowColor,s.shadowBlur=n.shadowBlur,s.shadowOffsetX=n.shadowOffsetX,s.shadowOffsetY=n.shadowOffsetY):(s.fillStyle=n.bgColor,s.globalAlpha=n.bgOpacity,s.beginPath(),Sl(s,r.width/2,r.height/2,r.width*.8,r.height*.8,n.roundRectRadius,n.bubblePointerHeight,n.bubblePointerWidth),s.fill(),s.globalAlpha=1,s.strokeStyle=n.bubbleBorderColor,s.lineWidth=n.bubbleBorderWidth,s.stroke())),s.textAlign="center",s.textBaseline="middle",n.strokeWidth>0&&(s.strokeStyle=n.strokeColor,s.lineWidth=n.strokeWidth,s.lineJoin="round",s.strokeText(n.text,r.width/2,r.height/2)),s.fillStyle=n.textColor,s.fillText(n.text,r.width/2,r.height/2),s.shadowColor="transparent";const v=new m.CanvasTexture(r);v.magFilter=m.NearestFilter,v.minFilter=m.LinearMipmapLinearFilter,v.anisotropy=16;const b=new m.SpriteMaterial({map:v,transparent:!0,depthTest:!1,depthWrite:!1,fog:!1}),T=new m.Sprite(b),_=n.fixedSize;return T.scale.set(r.width*_/100,r.height*_/100,1),t&&T.position.copy(t),T.renderOrder=9999,T}async function Bf(a,t,e){const r={...{fontSize:48,fontFamily:"'Microsoft YaHei', sans-serif",fontWeight:"bold",fontStyle:"normal",textColor:"#ffffff",strokeColor:"#000000",strokeWidth:2,showBackground:!0,bgStyle:1,bgColor:"#3498db",bgOpacity:.8,shadowColor:"rgba(0, 0, 0, 0.5)",shadowBlur:5,shadowOffsetX:3,shadowOffsetY:3,roundRectRadius:20,bubblePointerHeight:10,bubblePointerWidth:15,bubbleBorderColor:"#ffffff",bubbleBorderWidth:3,screenSpaceSize:20,maxVisibleDistance:1/0},...a};r.fontSize=Math.min(Math.max(r.fontSize,8),128);const s=document.createElement("canvas"),l=s.getContext("2d");if(!l)throw new Error("Failed to get canvas context");const c=`${r.fontStyle} ${r.fontWeight} ${r.fontSize}px ${r.fontFamily}`;l.font=c;const u=r.showBackground?20:0,d=100,p=50,f=l.measureText(r.text),y=Math.max(d,f.width+u*2),v=Math.max(p,r.fontSize*1.5+u*2);s.width=Math.min(y,2048),s.height=Math.min(v,2048),l.clearRect(0,0,s.width,s.height),l.font=c,r.showBackground&&(r.bgStyle===1?(l.fillStyle=r.bgColor,l.globalAlpha=r.bgOpacity,l.beginPath(),Ll(l,u/2,u/2,s.width-u,s.height-u,r.roundRectRadius),l.fill(),l.globalAlpha=1,l.shadowColor=r.shadowColor,l.shadowBlur=r.shadowBlur,l.shadowOffsetX=r.shadowOffsetX,l.shadowOffsetY=r.shadowOffsetY):(l.fillStyle=r.bgColor,l.globalAlpha=r.bgOpacity,l.beginPath(),Sl(l,s.width/2,s.height/2,s.width*.8,s.height*.8,r.roundRectRadius,r.bubblePointerHeight,r.bubblePointerWidth),l.fill(),l.globalAlpha=1,l.strokeStyle=r.bubbleBorderColor,l.lineWidth=r.bubbleBorderWidth,l.stroke())),l.textAlign="center",l.textBaseline="middle",r.strokeWidth>0&&(l.strokeStyle=r.strokeColor,l.lineWidth=r.strokeWidth,l.lineJoin="round",l.strokeText(r.text,s.width/2,s.height/2)),l.fillStyle=r.textColor,l.fillText(r.text,s.width/2,s.height/2),l.shadowColor="transparent";const b=new m.CanvasTexture(s),T=new m.SpriteMaterial({map:b,transparent:!0,depthTest:!1,depthWrite:!1,fog:!1}),_=new m.Sprite(T);_.position.copy(t),_.renderOrder=9999,_.userData.isLabel=!0;const S=()=>{if(!_.visible)return;const I=e.viewer.camera.position.distanceTo(_.position);if(I>r.maxVisibleDistance){_.visible=!1;return}_.visible=!0;const F=new m.Vector2;e.viewer.renderer.getSize(F);const K=F.height,D=r.screenSpaceSize/s.height*(I/Math.tan(m.MathUtils.degToRad(e.viewer.camera.fov)/2))*(2/K);_.scale.set(D*s.width,D*s.height,1),_.lookAt(e.viewer.camera.position)};S();const L=()=>S();return _.addEventListener("dispose",()=>{e.viewer.renderer.domElement.removeEventListener("resize",S)}),e.viewer.renderer.domElement.addEventListener("resize",S),e.viewer.camera.addEventListener("change",S),_.onBeforeRender=L,_}function Ll(a,t,e,n,r,s){a.beginPath(),a.moveTo(t+s,e),a.lineTo(t+n-s,e),a.quadraticCurveTo(t+n,e,t+n,e+s),a.lineTo(t+n,e+r-s),a.quadraticCurveTo(t+n,e+r,t+n-s,e+r),a.lineTo(t+s,e+r),a.quadraticCurveTo(t,e+r,t,e+r-s),a.lineTo(t,e+s),a.quadraticCurveTo(t,e,t+s,e),a.closePath()}function Sl(a,t,e,n,r,s,l,c){if(n<=0)throw new Error("Width must be positive");if(r<=0)throw new Error("Height must be positive");if(s<0)throw new Error("Radius cannot be negative");const u=n,d=r,p=Math.min(s,n/2,r/2),f=l??10,y=c??15;a.beginPath(),a.moveTo(t-u/2+p,e-d/2),a.lineTo(t+u/2-p,e-d/2),a.quadraticCurveTo(t+u/2,e-d/2,t+u/2,e-d/2+p),a.lineTo(t+u/2,e+d/2-p),a.quadraticCurveTo(t+u/2,e+d/2,t+u/2-p,e+d/2),a.lineTo(t+y/2,e+d/2),a.lineTo(t,e+d/2+f),a.lineTo(t-y/2,e+d/2),a.lineTo(t-u/2+p,e+d/2),a.quadraticCurveTo(t-u/2,e+d/2,t-u/2,e+d/2-p),a.lineTo(t-u/2,e-d/2+p),a.quadraticCurveTo(t-u/2,e-d/2,t-u/2+p,e-d/2),a.closePath()}async function Nf(a,t,e){const{text:n,iconUrl:r,fontSize:s=30,iconSize:l=60,fontFamily:c="Arial",padding:u={},bgColor:d="rgba(0,0,0,0.0)",textColor:p="rgb(255,255,255)",strokeColor:f="rgb(0,0,0)",strokeWidth:y=s/9,iconScale:v=.8,canvasScale:b=1,renderbg:T=!0,textOffset:_={x:0,y:0}}=a,S={top:0,right:1,bottom:0,left:0,...u};let L=null;r&&(L=await Jf(r));const{canvas:I,width:F,height:K,center:D}=await jf({text:n,iconImage:L,fontSize:s,iconSize:l,fontFamily:c,padding:S,bgColor:d,textColor:p,strokeColor:f,strokeWidth:y,iconScale:v,canvasScale:b,renderbg:T,textOffset:_},t),O=new m.Texture(I);O.needsUpdate=!0;const V=new m.SpriteMaterial({map:O,transparent:!0,depthTest:!0,depthWrite:!0,blending:m.NormalBlending,sizeAttenuation:!1,alphaTest:.01}),R=new m.Sprite(V),P=.001;return R.scale.set(F*P,K*P,1),R.center.set(D[0],D[1]),e&&R.position.copy(e),R.renderOrder=999,R}async function jf(a,t){return new Promise(e=>{const{text:n,iconImage:r,fontSize:s,iconSize:l,fontFamily:c,padding:u,bgColor:d,textColor:p,strokeColor:f,strokeWidth:y,iconScale:v,canvasScale:b,renderbg:T,textOffset:_={x:0,y:0}}=a,L=document.createElement("canvas").getContext("2d");if(!L)throw new Error("Could not get temp canvas context");L.font=`500 ${s}px ${c}`;const I=L.measureText(n),F=I.width,K=I.actualBoundingBoxAscent||s*.8,D=I.actualBoundingBoxDescent||s*.2,O=r!==null;let V=0,R=0,P=0,k=0;if(O){V=0,R=0,P=l,k=l;const he=l/2+_.x,ve=l/2+_.y,ke=he,Ye=he+F,je=ve-K,Je=ve+D;V=Math.min(V,ke),P=Math.max(P,Ye),R=Math.min(R,je),k=Math.max(k,Je)}else{const he=_.x,ve=_.x+F,ke=_.y-K,Ye=_.y+D;V=he,P=ve,R=ke,k=Ye}const N=P-V,H=k-R,Q=Math.ceil(N+u.left+u.right)*b,q=Math.ceil(H+u.top+u.bottom)*b,J=u.left-V,oe=u.top-R,ie=t._getCanvas(Q,q,n);ie.width=Q,ie.height=q;const te=ie.getContext("2d");if(!te)throw new Error("Could not get canvas context");te.clearRect(0,0,Q,q),te.globalCompositeOperation="source-over",te.save(),te.scale(b,b);const me=Q/b,xe=q/b;if(T&&(te.fillStyle=d,te.fillRect(0,0,me,xe)),r){const he=J,ve=oe,ke=l*v,Ye=(l-ke)/2,je=(l-ke)/2;te.imageSmoothingEnabled=!1,te.drawImage(r,he+Ye,ve+je,ke,ke),te.font=`500 ${s}px ${c}`,te.textBaseline="alphabetic",te.textAlign="left";const Je=J+l/2+_.x,Qe=oe+l/2+_.y;y>0&&(te.strokeStyle=f,te.lineWidth=y,te.strokeText(n,Je,Qe)),te.fillStyle=p,te.fillText(n,Je,Qe)}else{te.font=`500 ${s}px ${c}`,te.textBaseline="alphabetic",te.textAlign="left";const he=J+_.x,ve=oe+_.y;y>0&&(te.strokeStyle=f,te.lineWidth=y,te.strokeText(n,he,ve)),te.fillStyle=p,te.fillText(n,he,ve)}te.restore(),e({canvas:ie,width:me,height:xe,center:[(l*.5+u.left)/me,(1-v)*.5]})})}function Jf(a){return new Promise((t,e)=>{const n=new Image;n.crossOrigin="Anonymous",n.onload=()=>t(n),n.onerror=r=>e(new Error(`Failed to load image: ${a} ${r}`)),n.src=a})}async function Qf(a,t,e){const r=new m.CylinderGeometry(.2,.2,24,12),s=new m.MeshBasicMaterial({color:a.color}),l=await It._loadTexture(a.icon),c=new m.PointsMaterial({size:80*window.innerHeight/window.innerHeight,fog:!1,opacity:1,transparent:!0,toneMapped:!1,blending:m.AdditiveBlending,map:l,sizeAttenuation:!0,depthTest:!0,depthWrite:!1}),u=new m.InstancedMesh(r,s,t.length);u.position.add(e.prjcenter),u.castShadow=!0,u.renderOrder=1;const d=new m.Object3D,p=[];for(let b=0;b<t.length;b++){const T=t[b],_=new m.Vector3(T.coordinates[0],T.coordinates[1],T.coordinates[2]||0),L=e.geo2world(_).sub(e.prjcenter);d.position.copy(L),d.updateMatrix(),u.setMatrixAt(b,d.matrix),p.push(L.x,0,L.z)}const f=new Float32Array(p),y=new m.BufferGeometry;y.setAttribute("position",new m.BufferAttribute(f,3));const v=new m.Points(y,c);return v.position.add(e.prjcenter),v.position.y=1.5*10,v.renderOrder=99999999,v.visible=!0,console.log(e,"map"),{points:v,InstancedCol:u}}const Yt=class Yt{constructor(t){this.config=t}async applyTo(t){if(!t)return!1;try{switch(t.visible=this.config.visible!==!1,this.config.zIndex&&(t.renderOrder=this.config.zIndex),this.config.type){case"basic-point":case"icon-point":case"icon-label-point":return this._applyPointStyle(t);case"basic-line":return this._applyLineStyle(t);case"gltf":case"fbx":return this._applyModelStyle(t);case"basic-polygon":return this._applyPolygonStyle(t);case"extrude-polygon":return this._applyExtrudeStyle(t);case"water":case"base-water":return this._applyWaterStyle(t);case"cloud":return this._applyCloudStyle(t);case"canvas-label":case"canvas-label-fixed":return this._applyTextSpriteStyle(t);case"light":return this._applyLightStyle(t);case"custom":return this._applyCustomStyle(t);default:throw new Error("Unknown style type")}}catch(e){return console.error("Style apply failed:",e),t.visible=!1,!1}}async _applyPointStyle(t){const e=this.config;return e.type==="icon-point"?await this._applyIconPoint(t,e):e.type==="basic-point"?this._applyBasicPoint(t,e):e.type==="icon-label-point"&&this._applyIconLabelPoint(t,e),!0}async _applyIconPoint(t,e){let n;if(t instanceof m.Sprite)n=t;else if(n=await _l(e,t.position),n.position.copy(t.position),n.rotation.copy(t.rotation),n.scale.copy(t.scale),n.renderOrder=999,t.parent){let u=t.parent;u._threeGeometry=n,u._updateGeometry()}const r=e.size,[s,l]=Array.isArray(r)?r:[r,r];if(s<=0||l<=0){console.error("Invalid sprite size:",e.size),n.visible=!1;return}const c=n.material;try{if(c.map=await Yt._loadTexture(e.url),!c.map)throw new Error("Texture failed to load");c.needsUpdate=!0,n.scale.set(s,l,1),e.rotation!==void 0&&(n.rotation.z=e.rotation)}catch(u){console.error("Failed to load texture:",e.url,u),n.visible=!1}}_applyBasicPoint(t,e){let n;if(t instanceof m.Points)n=t;else if(n=xl(e,t.position),n.position.copy(t.position),n.rotation.copy(t.rotation),n.scale.copy(t.scale),n.renderOrder=999,t.parent){let s=t.parent;s._threeGeometry=n,s._updateGeometry()}const r=n.material;r.size=e.size,e.color&&r.color.set(e.color),e.glow&&(r.sizeAttenuation=!1)}_applyIconLabelPoint(t,e){return!0}_applyLineStyle(t){const e=this.config;if(t.parent){let n=t.parent;n._threeGeometry=$s(e,n._vertexPoints),n._updateGeometry()}return!0}_applyPolygonStyle(t){return!0}_applyExtrudeStyle(t){return!0}_applyWaterStyle(t){return!0}_applyCloudStyle(t){return!0}_applyTextSpriteStyle(t){return!0}_applyLightStyle(t){return!0}async _applyModelStyle(t){return!0}async _applyCustomStyle(t){const n=await this.config.build();return t instanceof m.Group&&(t.clear(),t.add(n)),!0}static async _loadTexture(t){if(Yt._textureCache.has(t))return Yt._textureCache.get(t);const e=await new Promise((n,r)=>{Yt._textureLoader.load(t,n,void 0,r)});return e.premultiplyAlpha=!0,Yt._textureCache.set(t,e),e}static create(t){return t instanceof Yt?t:new Yt(t)}};G(Yt,"_textureCache",new Map),G(Yt,"_textureLoader",new m.TextureLoader);let It=Yt;const et=[];for(let a=0;a<256;++a)et.push((a+256).toString(16).slice(1));function Hf(a,t=0){return(et[a[t+0]]+et[a[t+1]]+et[a[t+2]]+et[a[t+3]]+"-"+et[a[t+4]]+et[a[t+5]]+"-"+et[a[t+6]]+et[a[t+7]]+"-"+et[a[t+8]]+et[a[t+9]]+"-"+et[a[t+10]]+et[a[t+11]]+et[a[t+12]]+et[a[t+13]]+et[a[t+14]]+et[a[t+15]]).toLowerCase()}let eo;const Ef=new Uint8Array(16);function qf(){if(!eo){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");eo=crypto.getRandomValues.bind(crypto)}return eo(Ef)}const Tl={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function $f(a,t,e){if(Tl.randomUUID&&!a)return Tl.randomUUID();a=a||{};const n=a.random??a.rng?.()??qf();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,Hf(n)}var Gl=(a=>(a.POINT="point",a.LINE_VERTEX="line_vertex",a.POLYGON_CENTER="polygon_center",a.LABEL="label",a.ICON="icon",a.CLUSTER="cluster",a))(Gl||{}),rn=(a=>(a.NO_COLLISION="no_collision",a.PRIORITY_LOST="priority_lost",a.OUT_OF_VIEWPORT="out_of_viewport",a.ZOOM_FILTERED="zoom_filtered",a.MANUAL_HIDDEN="manual_hidden",a.GROUP_COLLISION="group_collision",a))(rn||{});class Ln extends Qs(xi(_i(m.Object3D))){constructor(e){super();G(this,"_position");G(this,"_threeGeometry");G(this,"_geometry");G(this,"_layer");G(this,"_style");G(this,"_id");G(this,"_styleQueue",[]);G(this,"_isApplyingStyle",!1);G(this,"_isGeometryInitializing",!1);G(this,"_collisionState",{visible:!0,reason:rn.NO_COLLISION,collidedWith:[],timestamp:Date.now()});G(this,"_collisionConfig",{enabled:!0,priority:50,padding:4,minZoom:0,maxZoom:24});G(this,"_animationRef",null);Ys(e.geometry,"geometry","geometry must be specified"),this._geometry=e.geometry,this._position=new m.Vector3(0,0,0),this._threeGeometry=new m.Object3D,e.userData&&(this.userData=Object.assign({},JSON.parse(JSON.stringify(e.userData)))),e.style&&this.setStyle(e.style),e.id?this._id=e.id:this._id=$f()}async initializeGeometry(){if(!(this._isGeometryInitializing||this._threeGeometry)){this._isGeometryInitializing=!0;try{await this._toThreeJSGeometry(),this._processStyleQueue()}finally{this._isGeometryInitializing=!1}}}setStyle(e){const n=e instanceof It?e:new It(e);this._style=n;const r=JSON.parse(JSON.stringify(n.config));return this._styleQueue.push(r),this._tryProcessQueue(),this}getStyle(){return this._style}async _applyStyleWithRetry(e,n=3,r=100){let s=null;for(let l=1;l<=n;l++)try{this._threeGeometry.parent||(this.add(this._threeGeometry),await new Promise(c=>requestAnimationFrame(c))),await e.applyTo(this._threeGeometry);return}catch(c){if(s=c,l<n){const u=r*Math.pow(2,l-1);await new Promise(d=>setTimeout(d,u))}}throw s||new Error("样式应用失败,重试次数耗尽")}async _processStyleQueue(){if(!this._threeGeometry||this._isApplyingStyle||this._styleQueue.length===0)return;this._isApplyingStyle=!0;const e=this._styleQueue[0];try{const n=new It(JSON.parse(JSON.stringify(e)));await this._applyStyleWithRetry(n),this._styleQueue.shift(),this._styleQueue.length>0&&await this._processStyleQueue()}catch(n){throw n}finally{this._isApplyingStyle=!1,this._styleQueue.length>0&&this._tryProcessQueue()}}_tryProcessQueue(){this._threeGeometry&&!this._isApplyingStyle&&this._styleQueue.length>0?this._processStyleQueue().catch(n=>{this._isApplyingStyle=!1,this._tryProcessQueue(),console.warn(n)}):!this._threeGeometry&&!this._isGeometryInitializing&&this.initializeGeometry()}addTo(e){return e.addFeature(this),this}getLayer(){return this._layer||null}getMap(){return this._layer?.getMap()||null}_bindLayer(e){if(this._layer&&this._layer!==e)throw new Error("Feature cannot be added to multiple layers");this._layer=e}_updateGeometry(){this._disposeGeometry(),this._threeGeometry&&(this._threeGeometry.position.copy(this._position),this._threeGeometry.renderOrder=999,this.add(this._threeGeometry),this.updateMatrixWorld(!0),this._tryProcessQueue())}_remove(){return this.getLayer()?(this._unbind(),this):this}_unbind(){const e=this.getLayer();e&&(e.onRemoveFeature&&e.onRemoveFeature(this),delete this._layer)}_disposeGeometry(){this._threeGeometry&&(this.clear(),"traverse"in this&&this._threeGeometry.traverse(e=>{e instanceof m.Mesh?(e.geometry?.dispose(),Array.isArray(e.material)?e.material.forEach(n=>n.dispose()):e.material?.dispose()):"isLine"in e&&e.isLine&&(e.geometry?.dispose(),e.material?.dispose())}))}get collidable(){return this._collisionConfig.enabled}get collisionType(){return Gl.POINT}getCollisionPriority(){return this.userData.collisionPriority??this._style?.config.collisionPriority??this._collisionConfig.priority}getScreenBoundingBox(e,n){if(!this.collidable)return null;try{const r=new m.Vector3;this._threeGeometry.getWorldPosition(r);const s=r.clone().project(e);if(!(s.x>=-1.1&&s.x<=1.1&&s.y>=-1.1&&s.y<=1.1&&s.z>=-1&&s.z<=1))return null;const{width:c,height:u}=n.domElement,d=(s.x*.5+.5)*c,p=(-s.y*.5+.5)*u,f=this._calculateCollisionBoundingBox(e,n);return f?{id:this._id,x:d+f.offsetX,y:p+f.offsetY,width:20+this._collisionConfig.padding*2,height:20+this._collisionConfig.padding*2,priority:this.getCollisionPriority(),featureId:this._id,layerId:this._layer?.getId()||"unknown",type:this.collisionType,data:this.getCollisionData()}:null}catch(r){return console.warn(`Feature ${this._id} 包围盒计算失败:`,r),null}}setCollisionVisibility(e,n=rn.MANUAL_HIDDEN){this._collisionState.visible!==e&&(this._animationRef!==null&&(cancelAnimationFrame(this._animationRef),this._animationRef=null),this.visible=e,this._applyFinalAlpha(e?1:0),this._collisionState={visible:e,reason:n,collidedWith:e?[]:this._collisionState.collidedWith,timestamp:Date.now()})}getCollisionVisibility(){return this._collisionState.visible}setCollisionConfig(e){return Object.assign(this._collisionConfig,e),this}enableCollision(){return this._collisionConfig.enabled=!0,this}disableCollision(){return this._collisionConfig.enabled=!1,this.setCollisionVisibility(!0,rn.MANUAL_HIDDEN),this}_applyVisibilityAlpha(e){this.traverse(n=>{n instanceof m.Mesh&&(Array.isArray(n.material)?n.material.forEach(r=>{r.opacity!==void 0&&(r.opacity=e)}):n.material.opacity!==void 0&&(n.material.opacity=e))})}_applyFinalAlpha(e){this._applyVisibilityAlpha(e),this.traverse(n=>{n instanceof m.Mesh&&(n.material.needsUpdate=!0)})}getCollisionData(){return{featureType:this.constructor.name,userData:this.userData,styleConfig:this._style?.config}}_calculateCollisionBoundingBox(e,n){if(!this.visible||!this._threeGeometry||!e||!n)return null;try{const r=new m.Box3().setFromObject(this._threeGeometry);if(r.isEmpty())return this._getFallbackBoundingBox();const s=[new m.Vector3(r.min.x,r.min.y,r.min.z),new m.Vector3(r.max.x,r.min.y,r.min.z),new m.Vector3(r.min.x,r.max.y,r.min.z),new m.Vector3(r.max.x,r.max.y,r.min.z),new m.Vector3(r.min.x,r.min.y,r.max.z),new m.Vector3(r.max.x,r.min.y,r.max.z),new m.Vector3(r.min.x,r.max.y,r.max.z),new m.Vector3(r.max.x,r.max.y,r.max.z)],{width:l,height:c}=n.domElement,u=[];s.forEach(D=>{const O=D.clone().project(e),V=(O.x*.5+.5)*l,R=(-O.y*.5+.5)*c;u.push(new m.Vector2(V,R))});let d=1/0,p=-1/0,f=1/0,y=-1/0;u.forEach(D=>{d=Math.min(d,D.x),p=Math.max(p,D.x),f=Math.min(f,D.y),y=Math.max(y,D.y)});const v=p-d,b=y-f,T=4,_=Math.max(v,T),S=Math.max(b,T),L=new m.Vector3;r.getCenter(L);const I=L.clone().project(e),F=(I.x*.5+.5)*l,K=(-I.y*.5+.5)*c;return{width:_,height:S,offsetX:d-F,offsetY:f-K}}catch(r){return console.warn("包围盒计算失败:",r),this._getFallbackBoundingBox()}}_getFallbackBoundingBox(){return{width:20,height:20,offsetX:-10,offsetY:-10}}_tileCoordToLocalWorld(e,n,r,s){const{tileZ:l,tileX:c,tileY:u,extent:d,tileSize:p}=r,f=(e/d-.5)*p,y=(.5-n/d)*p;return s.tileIDToWorldCenter(l,c,u).clone().add(new m.Vector3(f,y,0)).sub(s.prjcenter)}}class Un extends Mi{constructor(e,n){super(e,n);G(this,"_feaList");G(this,"_collision",!1);this._feaList=[],n?.collision&&(this._collision=!0)}addFeature(e){const n=Array.isArray(e)?e:[e];for(const r of n)if(!(!r||!(r instanceof Ln))&&!r.getLayer()){if(!this.validateFeature(r)){console.error(`Feature ${r.id} does not match the layer's type requirements`);continue}r._bindLayer(this),this._feaList.push(r),r.getMap()&&r._toThreeJSGeometry(),this._clouds&&(this.map.viewer.scene.add(this._clouds),console.log("我是云朵被添加cloud",this.map.viewer.scene)),this.add(r)}return this}getFeatures(e,n){if(!e)return this._feaList.slice(0);const r=[];let s,l;for(let c=0,u=this._feaList.length;c<u;c++)s=this._feaList[c],n?l=e.call(n,s):l=e(s),l&&r.push(s);return r}getCount(){return this._feaList.length}isEmpty(){return!this._feaList.length}removeFeature(e){if(!Array.isArray(e))return this.removeFeature([e]);for(let n=e.length-1;n>=0;n--)e[n]instanceof Ln||(e[n]=this.removeFeature(e[n])),!(!e[n]||this!==e[n].getLayer())&&e[n]._remove();return this}onRemoveFeature(e){if(!e)return;const n=e.getLayer();if(!n||n!==this)return;const r=this._findInList(e);r>=0&&this._feaList.splice(r,1),e.parent&&e.parent===this?this.remove(e):console.warn("Feature parent mismatch:",e.parent),this._disposeFeatureResources(e)}_findInList(e){const n=this._feaList.length;if(n===0)return-1;let r=0,s=n-1,l;for(;r<=s;){if(l=Math.floor((r+s)/2),this._feaList[l]===e)return l;r=l+1}return-1}_disposeFeatureResources(e){try{e.geometry&&e.geometry.dispose&&e.geometry.dispose(),e.material&&(Array.isArray(e.material)?e.material.forEach(n=>n.dispose?.()):e.material.dispose&&e.material.dispose()),e instanceof m.Object3D&&e.traverse(n=>{n!==e&&this._disposeFeatureResources(n)})}catch(n){console.error("Error disposing feature resources:",n)}}_mergedGeometry(){this.traverse(e=>{e.isMesh&&e.geometry&&e.material&&console.log("几何体合并中",e)})}setCollisionEngine(e){return this._collisionEngine=e,this}}class ep extends m.Group{constructor(){super(...arguments);G(this,"_layers",new Set);G(this,"_layerids",new Set)}add(...e){return e.forEach(n=>{if(!(n instanceof Mi))throw new Error("LayerContainer只能包含Layer实例!");const r=n.getId();if(this._layerids.has(r))throw new Error(`ID为'${r}'的图层已存在于容器中!`);this._layers.add(n),this._layerids.add(r),super.add(n)}),this}remove(...e){return e.forEach(n=>{this._layers.delete(n),this._layerids.delete(n.getId()),super.remove(n)}),this}getLayers(){return Array.from(this._layers)}getLayerById(e){for(const n of this._layers)if(n.getId()===e)return n}clearLayers(){return this._layers.clear(),this._layerids.clear(),super.clear(),this}}class tp{constructor(){G(this,"canvasDict",{})}getCanvas(t=40,e=30,n=1,r){const s=Math.ceil(t*n),l=Math.ceil(e*n),c=r?`${s}_${l}_${r}`:`${s}_${l}`;if(!this.canvasDict[c]){const p=document.createElement("canvas");p.width=s,p.height=l,this.canvasDict[c]=p}const u=this.canvasDict[c],d=u.getContext("2d");return d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,u.width,u.height),d.scale(n,n),u}}function np(a){const t=+this._x.call(null,a),e=+this._y.call(null,a);return Zl(this.cover(t,e),t,e,a)}function Zl(a,t,e,n){if(isNaN(t)||isNaN(e))return a;var r,s=a._root,l={data:n},c=a._x0,u=a._y0,d=a._x1,p=a._y1,f,y,v,b,T,_,S,L;if(!s)return a._root=l,a;for(;s.length;)if((T=t>=(f=(c+d)/2))?c=f:d=f,(_=e>=(y=(u+p)/2))?u=y:p=y,r=s,!(s=s[S=_<<1|T]))return r[S]=l,a;if(v=+a._x.call(null,s.data),b=+a._y.call(null,s.data),t===v&&e===b)return l.next=s,r?r[S]=l:a._root=l,a;do r=r?r[S]=new Array(4):a._root=new Array(4),(T=t>=(f=(c+d)/2))?c=f:d=f,(_=e>=(y=(u+p)/2))?u=y:p=y;while((S=_<<1|T)===(L=(b>=y)<<1|v>=f));return r[L]=s,r[S]=l,a}function rp(a){var t,e,n=a.length,r,s,l=new Array(n),c=new Array(n),u=1/0,d=1/0,p=-1/0,f=-1/0;for(e=0;e<n;++e)isNaN(r=+this._x.call(null,t=a[e]))||isNaN(s=+this._y.call(null,t))||(l[e]=r,c[e]=s,r<u&&(u=r),r>p&&(p=r),s<d&&(d=s),s>f&&(f=s));if(u>p||d>f)return this;for(this.cover(u,d).cover(p,f),e=0;e<n;++e)Zl(this,l[e],c[e],a[e]);return this}function ip(a,t){if(isNaN(a=+a)||isNaN(t=+t))return this;var e=this._x0,n=this._y0,r=this._x1,s=this._y1;if(isNaN(e))r=(e=Math.floor(a))+1,s=(n=Math.floor(t))+1;else{for(var l=r-e||1,c=this._root,u,d;e>a||a>=r||n>t||t>=s;)switch(d=(t<n)<<1|a<e,u=new Array(4),u[d]=c,c=u,l*=2,d){case 0:r=e+l,s=n+l;break;case 1:e=r-l,s=n+l;break;case 2:r=e+l,n=s-l;break;case 3:e=r-l,n=s-l;break}this._root&&this._root.length&&(this._root=c)}return this._x0=e,this._y0=n,this._x1=r,this._y1=s,this}function sp(){var a=[];return this.visit(function(t){if(!t.length)do a.push(t.data);while(t=t.next)}),a}function op(a){return arguments.length?this.cover(+a[0][0],+a[0][1]).cover(+a[1][0],+a[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function at(a,t,e,n,r){this.node=a,this.x0=t,this.y0=e,this.x1=n,this.y1=r}function ap(a,t,e){var n,r=this._x0,s=this._y0,l,c,u,d,p=this._x1,f=this._y1,y=[],v=this._root,b,T;for(v&&y.push(new at(v,r,s,p,f)),e==null?e=1/0:(r=a-e,s=t-e,p=a+e,f=t+e,e*=e);b=y.pop();)if(!(!(v=b.node)||(l=b.x0)>p||(c=b.y0)>f||(u=b.x1)<r||(d=b.y1)<s))if(v.length){var _=(l+u)/2,S=(c+d)/2;y.push(new at(v[3],_,S,u,d),new at(v[2],l,S,_,d),new at(v[1],_,c,u,S),new at(v[0],l,c,_,S)),(T=(t>=S)<<1|a>=_)&&(b=y[y.length-1],y[y.length-1]=y[y.length-1-T],y[y.length-1-T]=b)}else{var L=a-+this._x.call(null,v.data),I=t-+this._y.call(null,v.data),F=L*L+I*I;if(F<e){var K=Math.sqrt(e=F);r=a-K,s=t-K,p=a+K,f=t+K,n=v.data}}return n}function lp(a){if(isNaN(p=+this._x.call(null,a))||isNaN(f=+this._y.call(null,a)))return this;var t,e=this._root,n,r,s,l=this._x0,c=this._y0,u=this._x1,d=this._y1,p,f,y,v,b,T,_,S;if(!e)return this;if(e.length)for(;;){if((b=p>=(y=(l+u)/2))?l=y:u=y,(T=f>=(v=(c+d)/2))?c=v:d=v,t=e,!(e=e[_=T<<1|b]))return this;if(!e.length)break;(t[_+1&3]||t[_+2&3]||t[_+3&3])&&(n=t,S=_)}for(;e.data!==a;)if(r=e,!(e=e.next))return this;return(s=e.next)&&delete e.next,r?(s?r.next=s:delete r.next,this):t?(s?t[_]=s:delete t[_],(e=t[0]||t[1]||t[2]||t[3])&&e===(t[3]||t[2]||t[1]||t[0])&&!e.length&&(n?n[S]=e:this._root=e),this):(this._root=s,this)}function cp(a){for(var t=0,e=a.length;t<e;++t)this.remove(a[t]);return this}function up(){return this._root}function hp(){var a=0;return this.visit(function(t){if(!t.length)do++a;while(t=t.next)}),a}function dp(a){var t=[],e,n=this._root,r,s,l,c,u;for(n&&t.push(new at(n,this._x0,this._y0,this._x1,this._y1));e=t.pop();)if(!a(n=e.node,s=e.x0,l=e.y0,c=e.x1,u=e.y1)&&n.length){var d=(s+c)/2,p=(l+u)/2;(r=n[3])&&t.push(new at(r,d,p,c,u)),(r=n[2])&&t.push(new at(r,s,p,d,u)),(r=n[1])&&t.push(new at(r,d,l,c,p)),(r=n[0])&&t.push(new at(r,s,l,d,p))}return this}function fp(a){var t=[],e=[],n;for(this._root&&t.push(new at(this._root,this._x0,this._y0,this._x1,this._y1));n=t.pop();){var r=n.node;if(r.length){var s,l=n.x0,c=n.y0,u=n.x1,d=n.y1,p=(l+u)/2,f=(c+d)/2;(s=r[0])&&t.push(new at(s,l,c,p,f)),(s=r[1])&&t.push(new at(s,p,c,u,f)),(s=r[2])&&t.push(new at(s,l,f,p,d)),(s=r[3])&&t.push(new at(s,p,f,u,d))}e.push(n)}for(;n=e.pop();)a(n.node,n.x0,n.y0,n.x1,n.y1);return this}function pp(a){return a[0]}function mp(a){return arguments.length?(this._x=a,this):this._x}function gp(a){return a[1]}function yp(a){return arguments.length?(this._y=a,this):this._y}function Il(a,t,e){var n=new to(t??pp,e??gp,NaN,NaN,NaN,NaN);return a==null?n:n.addAll(a)}function to(a,t,e,n,r,s){this._x=a,this._y=t,this._x0=e,this._y0=n,this._x1=r,this._y1=s,this._root=void 0}function Wl(a){for(var t={data:a.data},e=t;a=a.next;)e=e.next={data:a.data};return t}var lt=Il.prototype=to.prototype;lt.copy=function(){var a=new to(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,e,n;if(!t)return a;if(!t.length)return a._root=Wl(t),a;for(e=[{source:t,target:a._root=new Array(4)}];t=e.pop();)for(var r=0;r<4;++r)(n=t.source[r])&&(n.length?e.push({source:n,target:t.target[r]=new Array(4)}):t.target[r]=Wl(n));return a},lt.add=np,lt.addAll=rp,lt.cover=ip,lt.data=sp,lt.extent=op,lt.find=ap,lt.remove=lp,lt.removeAll=cp,lt.root=up,lt.size=hp,lt.visit=dp,lt.visitAfter=fp,lt.x=mp,lt.y=yp;class Pl{constructor(t){G(this,"_quadtree");G(this,"_viewport");this._viewport=t,this._rebuildQuadTree()}updateViewport(t){(t.width!==this._viewport.width||t.height!==this._viewport.height)&&(this._viewport=t,this._rebuildQuadTree())}addBoxes(t){t.forEach(e=>{this._isBoxInViewport(e)&&this._quadtree.add(e)})}findCollisions(t){const e=[],n=this._getSearchBounds(t);return this._quadtree.visit((r,s,l,c,u)=>this._checkNodeCollision(n,s,l,c,u)?(r.length||this._getNodeData(r).forEach(p=>{p.id!==t.id&&this._checkBoxCollision(t,p)&&e.push(p)}),!1):void 0),e}clear(){this._rebuildQuadTree()}getAllBoxes(){const t=[];return this._quadtree.visit(e=>{if(!e.length){const n=this._getNodeData(e);t.push(...n)}return!1}),t}_rebuildQuadTree(){this._quadtree=Il().x(t=>t.x).y(t=>t.y).extent([[0,0],[this._viewport.width,this._viewport.height]])}_isBoxInViewport(t){const e=t.width/2,n=t.height/2;return t.x+e>=0&&t.x-e<=this._viewport.width&&t.y+n>=0&&t.y-n<=this._viewport.height}_getSearchBounds(t){return{x:t.x,y:t.y,width:t.width*2,height:t.height*2}}_checkNodeCollision(t,e,n,r,s){const l=(e+r)/2,c=(n+s)/2,u=r-e,d=s-n;return Math.abs(t.x-l)*2<t.width+u&&Math.abs(t.y-c)*2<t.height+d}_checkBoxCollision(t,e){return Math.abs(t.x-e.x)*2<t.width+e.width&&Math.abs(t.y-e.y)*2<t.height+e.height}_getNodeData(t){return t?Array.isArray(t.data)?t.data:t.data?[t.data]:[]:[]}removeBox(t){const n=this.getAllBoxes().filter(r=>r.id!==t);this.clear(),n.length>0&&this.addBoxes(n)}}class vp{constructor(){G(this,"_strategies",new Map);G(this,"_executionOrder",[])}registerStrategy(t,e){return this._strategies.set(t.name,t),e!==void 0?this._executionOrder.splice(e,0,t.name):this._executionOrder.push(t.name),this}async executeStrategies(t,e){const n=new Map;t.forEach(r=>{n.set(r._id,{featureId:r._id,visible:!0,reason:rn.NO_COLLISION,collidedWith:[],timestamp:e.timestamp})});for(const r of this._executionOrder){const s=this._strategies.get(r);if(s?.enabled)try{const l=await s.execute(t,e,n);this._mergeResults(n,l)}catch(l){console.error(`策略 ${r} 执行失败:`,l)}}return n}_mergeResults(t,e){e.forEach(n=>{const r=t.get(n.featureId);r&&!r.visible||t.set(n.featureId,n)})}}class wp{constructor(){G(this,"frameStats",new Map);G(this,"summaryStats",{totalFrames:0,averageFrameTime:0,averageFPS:0,minFrameTime:1/0,maxFrameTime:0,totalFeaturesProcessed:0});G(this,"sampleWindowSize",60);G(this,"currentFrameId",0);G(this,"lastReportTime",0);G(this,"reportInterval",5e3);G(this,"performanceThresholds",{criticalFrameTime:33,warningFrameTime:16,idealFrameTime:8});this.lastReportTime=Date.now()}startFrame(t){this.currentFrameId=t;const e={frameId:t,startTime:performance.now(),endTime:0,duration:0,featureCount:0,visibleCount:0,hiddenCount:0,collisionChecks:0,memoryUsage:0,strategyTimes:new Map};this.frameStats.set(t,e),this.cleanupOldFrames()}endFrame(t,e){const n=this.frameStats.get(t);if(!n)return;const r=performance.now();n.endTime=r,n.duration=r-n.startTime,e&&Object.assign(n,e),"memory"in performance&&(n.memoryUsage=performance.memory.usedJSHeapSize),this.updateSummaryStats(n),this.maybeOutputReport()}recordStrategyTime(t,e){const n=this.frameStats.get(this.currentFrameId);n&&n.strategyTimes.set(t,e)}recordCollisionChecks(t){const e=this.frameStats.get(this.currentFrameId);e&&(e.collisionChecks+=t)}getStats(){const t=this.getRecentFrames(this.sampleWindowSize),e=this.calculateFPS(t),n=this.calculateAverageFrameTime(t);return{summary:{...this.summaryStats},recent:{fps:e,frameTime:n,frameTimeStdDev:this.calculateFrameTimeStdDev(t),averageFeaturesPerFrame:this.calculateAverageFeatures(t),performanceLevel:this.getPerformanceLevel(n)},currentFrame:this.frameStats.get(this.currentFrameId)||null,strategies:this.getStrategyPerformance(t),warnings:this.getPerformanceWarnings(t)}}getDetailedReport(){const t=this.getRecentFrames(this.sampleWindowSize),e=this.getStats();return{...e,frameHistory:Array.from(t.values()),trends:this.calculateTrends(t),recommendations:this.getPerformanceRecommendations(e)}}reset(){this.frameStats.clear(),this.summaryStats={totalFrames:0,averageFrameTime:0,averageFPS:0,minFrameTime:1/0,maxFrameTime:0,totalFeaturesProcessed:0},this.currentFrameId=0,this.lastReportTime=Date.now()}cleanupOldFrames(){this.frameStats.size>this.sampleWindowSize*2&&Array.from(this.frameStats.keys()).sort((e,n)=>e-n).slice(0,this.frameStats.size-this.sampleWindowSize).forEach(e=>{this.frameStats.delete(e)})}updateSummaryStats(t){this.summaryStats.totalFrames++,this.summaryStats.totalFeaturesProcessed+=t.featureCount||0,this.summaryStats.averageFrameTime=(this.summaryStats.averageFrameTime*(this.summaryStats.totalFrames-1)+t.duration)/this.summaryStats.totalFrames,this.summaryStats.minFrameTime=Math.min(this.summaryStats.minFrameTime,t.duration),this.summaryStats.maxFrameTime=Math.max(this.summaryStats.maxFrameTime,t.duration),this.summaryStats.averageFPS=1e3/this.summaryStats.averageFrameTime}maybeOutputReport(){const t=Date.now();if(t-this.lastReportTime>=this.reportInterval){const e=this.getStats();e.warnings.length>0?console.warn("避让系统性能报告:",e):console.log("避让系统性能正常:",e),this.lastReportTime=t}}getRecentFrames(t){return Array.from(this.frameStats.values()).slice(-t).filter(n=>n.duration>0)}calculateFPS(t){if(t.length===0)return 0;const e=this.calculateAverageFrameTime(t);return e>0?1e3/e:0}calculateAverageFrameTime(t){return t.length===0?0:t.reduce((e,n)=>e+n.duration,0)/t.length}calculateFrameTimeStdDev(t){if(t.length===0)return 0;const e=this.calculateAverageFrameTime(t),n=t.map(r=>Math.pow(r.duration-e,2));return Math.sqrt(n.reduce((r,s)=>r+s,0)/t.length)}calculateAverageFeatures(t){return t.length===0?0:t.reduce((e,n)=>e+(n.featureCount||0),0)/t.length}getPerformanceLevel(t){return t>this.performanceThresholds.criticalFrameTime?"critical":t>this.performanceThresholds.warningFrameTime?"warning":t>this.performanceThresholds.idealFrameTime?"good":"excellent"}getStrategyPerformance(t){const e=new Map;return t.forEach(n=>{n.strategyTimes.forEach((r,s)=>{e.has(s)||e.set(s,[]),e.get(s).push(r)})}),Array.from(e.entries()).map(([n,r])=>({name:n,averageTime:r.reduce((s,l)=>s+l,0)/r.length,maxTime:Math.max(...r),minTime:Math.min(...r),callCount:r.length}))}getPerformanceWarnings(t){const e=[],n=t.slice(-30);if(n.length===0)return e;const r=this.calculateAverageFrameTime(n);r>this.performanceThresholds.criticalFrameTime?e.push({type:"critical",message:`帧率过低: ${Math.round(1e3/r)}fps`,suggestion:"考虑减少要素数量或简化避让策略"}):r>this.performanceThresholds.warningFrameTime&&e.push({type:"warning",message:`帧率较低: ${Math.round(1e3/r)}fps`,suggestion:"建议优化避让算法或增加更新间隔"});const s=n.map(l=>l.memoryUsage).filter(l=>l>0);if(s.length>0){const l=s.reduce((c,u)=>c+u,0)/s.length;l>100*1024*1024&&e.push({type:"warning",message:`内存使用较高: ${(l/1024/1024).toFixed(1)}MB`,suggestion:"检查内存泄漏,及时清理无用资源"})}return e}calculateTrends(t){if(t.length<2)return{frameTime:"stable",fps:"stable",features:"stable"};const e=t.slice(0,Math.floor(t.length/2)),n=t.slice(Math.floor(t.length/2)),r=this.calculateAverageFrameTime(e),l=(this.calculateAverageFrameTime(n)-r)/r*100;return{frameTime:Math.abs(l)<5?"stable":l>0?"worsening":"improving",fps:Math.abs(l)<5?"stable":l>0?"improving":"worsening",features:"stable"}}getPerformanceRecommendations(t){const e=[];return t.recent.performanceLevel==="critical"&&(e.push("建议启用要素抽样或聚合显示"),e.push("考虑增加避让更新间隔时间"),e.push("检查是否有不必要的避让策略")),t.recent.averageFeaturesPerFrame>5e3&&e.push("要素数量过多,建议启用LOD分级"),t.strategies.forEach(n=>{n.averageTime>10&&e.push(`策略 "${n.name}" 执行时间较长,考虑优化`)}),e}}class bp{constructor(){G(this,"name","priority");G(this,"enabled",!0);G(this,"weight",1);G(this,"description","基于优先级的避让策略,数值越小优先级越高")}async execute(t,e,n){const r=[],s=new Pl(e.viewport),l=[],c=new Map;return t.forEach(u=>{if(!u.collidable)return;const d=u.getScreenBoundingBox(e.camera,e.renderer);d&&(l.push(d),c.set(u._id,u),n?.get(u._id)?.visible)}),l.sort((u,d)=>u.priority-d.priority),l.forEach(u=>{const d=s.findCollisions(u);d.length===0?(s.addBoxes([u]),r.push({featureId:u.featureId,visible:!0,reason:rn.NO_COLLISION,collidedWith:[],timestamp:e.timestamp})):d.some(f=>f.priority<u.priority)?r.push({featureId:u.featureId,visible:!1,reason:rn.PRIORITY_LOST,collidedWith:d.map(f=>f.featureId),timestamp:e.timestamp}):(s.addBoxes([u]),r.push({featureId:u.featureId,visible:!0,reason:rn.NO_COLLISION,collidedWith:[],timestamp:e.timestamp}),d.forEach(f=>{r.push({featureId:f.featureId,visible:!1,reason:rn.PRIORITY_LOST,collidedWith:[u.featureId],timestamp:e.timestamp})}))}),r}}class xp{constructor(t,e={}){G(this,"_quadTreeManager");G(this,"_strategyOrchestrator");G(this,"_performanceMonitor");G(this,"_layers",new Set);G(this,"_config");G(this,"_isUpdating",!1);G(this,"_lastUpdateTime",0);G(this,"_frameCount",0);this.renderer=t,this._config={enabled:!0,padding:4,updateInterval:0,animationDuration:300,maxFeaturesPerFrame:2e3,viewportMargin:50,strategies:{priority:!0,grouping:!1,proximity:!1},...e},this._initializeComponents(),this._setupPerformanceMonitoring()}async update(t){if(!this._config.enabled||this._isUpdating)return;const e=Date.now();if(!(this._config.updateInterval>0&&e-this._lastUpdateTime<this._config.updateInterval)){this._isUpdating=!0,this._frameCount++;try{this._resetAllFeaturesVisibility();const n=this._createCollisionContext(t,e),r=this._collectCollidableFeatures();if(r.length===0)return;this._performanceMonitor.startFrame(this._frameCount);const s=await this._strategyOrchestrator.executeStrategies(r,n);await this._applyCollisionResults(s,r),this._performanceMonitor.endFrame(this._frameCount,{featureCount:r.length,visibleCount:Array.from(s.values()).filter(l=>l.visible).length,hiddenCount:Array.from(s.values()).filter(l=>!l.visible).length}),this._lastUpdateTime=e}catch(n){console.error("避让引擎更新失败:",n)}finally{this._isUpdating=!1}}}_resetAllFeaturesVisibility(){this._layers.forEach(t=>{t.getFeatures().filter(n=>n.collidable).forEach(n=>{n.setCollisionVisibility(!0,rn.NO_COLLISION)})})}registerLayer(t){return this._layers.add(t),this}unregisterLayer(t){return this._layers.delete(t),this}setConfig(t){return Object.assign(this._config,t),this}getPerformanceStats(){return this._performanceMonitor.getStats()}_initializeComponents(){const t={width:this.renderer.domElement.width,height:this.renderer.domElement.height};this._quadTreeManager=new Pl(t),this._strategyOrchestrator=new vp,this._performanceMonitor=new wp,this._strategyOrchestrator.registerStrategy(new bp,0),this._setupViewportResizeHandler()}_createCollisionContext(t,e){return{camera:t,renderer:this.renderer,viewport:{width:this.renderer.domElement.width,height:this.renderer.domElement.height},zoomLevel:t.position.z,timestamp:e,frameNumber:this._frameCount}}_collectCollidableFeatures(){const t=[];return this._layers.forEach(e=>{const n=e.getFeatures().filter(r=>r.collidable&&r instanceof Ln);if(t.length+n.length>this._config.maxFeaturesPerFrame){console.warn(`达到每帧最大要素处理限制: ${this._config.maxFeaturesPerFrame}`);return}t.push(...n)}),t}async _applyCollisionResults(t,e){const n=e.map(r=>{const s=t.get(r._id);return s&&r.setCollisionVisibility(s.visible,s.reason),Promise.resolve()});await Promise.all(n)}_setupViewportResizeHandler(){new ResizeObserver(e=>{e.forEach(n=>{const{width:r,height:s}=n.contentRect;this._quadTreeManager.updateViewport({width:r,height:s})})}).observe(this.renderer.domElement)}_setupPerformanceMonitoring(){setInterval(()=>{const t=this.getPerformanceStats();t.frameRate<30&&console.warn("避让系统性能警告:",t)},5e3)}}var Yr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ti={exports:{}};/**
|
|
540
540
|
* @license
|
|
541
541
|
* Lodash <https://lodash.com/>
|
|
542
542
|
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
543
543
|
* Released under MIT license <https://lodash.com/license>
|
|
544
544
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
545
545
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
546
|
-
*/Ti.exports,function(a,t){(function(){var e,n="4.17.21",r=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",l="Expected a function",c="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",d=500,p="__lodash_placeholder__",f=1,y=2,v=4,b=1,T=2,_=1,S=2,L=4,I=8,F=16,K=32,D=64,O=128,V=256,R=512,P=30,k="...",N=800,H=16,Q=1,q=2,J=3,oe=1/0,ie=9007199254740991,ee=17976931348623157e292,me=NaN,xe=4294967295,he=xe-1,ve=xe>>>1,ke=[["ary",O],["bind",_],["bindKey",S],["curry",I],["curryRight",F],["flip",R],["partial",K],["partialRight",D],["rearg",V]],Ye="[object Arguments]",je="[object Array]",Je="[object AsyncFunction]",Qe="[object Boolean]",ct="[object Date]",pt="[object DOMException]",Ue="[object Error]",hn="[object Function]",Tn="[object GeneratorFunction]",Ae="[object Map]",Ut="[object Number]",It="[object Null]",Wt="[object Object]",jr="[object Promise]",Vi="[object Proxy]",Nn="[object RegExp]",bt="[object Set]",Gn="[object String]",Zn="[object Symbol]",jn="[object Undefined]",Jn="[object WeakMap]",yo="[object WeakSet]",In="[object ArrayBuffer]",sn="[object DataView]",Jr="[object Float32Array]",Qr="[object Float64Array]",mr="[object Int8Array]",Hr="[object Int16Array]",Er="[object Int32Array]",gr="[object Uint8Array]",Qn="[object Uint8ClampedArray]",X="[object Uint16Array]",E="[object Uint32Array]",ue=/\b__p \+= '';/g,Se=/\b(__p \+=) '' \+/g,Re=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Pt=/&(?:amp|lt|gt|quot|#39);/g,Bt=/[&<>"']/g,sc=RegExp(Pt.source),Ai=RegExp(Bt.source),Nt=/<%-([\s\S]+?)%>/g,jt=/<%([\s\S]+?)%>/g,Wn=/<%=([\s\S]+?)%>/g,Hn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,En=/^\w*$/,yr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vo=/[\\^$.*+?()[\]{}|]/g,h0=RegExp(vo.source),wo=/^\s+/,d0=/\s/,f0=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,p0=/\{\n\/\* \[wrapped with (.+)\] \*/,m0=/,? & /,g0=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,y0=/[()=,{}\[\]\/\s]/,v0=/\\(\\)?/g,w0=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,oc=/\w*$/,b0=/^[-+]0x[0-9a-f]+$/i,x0=/^0b[01]+$/i,_0=/^\[object .+?Constructor\]$/,M0=/^0o[0-7]+$/i,L0=/^(?:0|[1-9]\d*)$/,S0=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Fi=/($^)/,T0=/['\n\r\u2028\u2029\\]/g,Xi="\\ud800-\\udfff",G0="\\u0300-\\u036f",Z0="\\ufe20-\\ufe2f",I0="\\u20d0-\\u20ff",ac=G0+Z0+I0,lc="\\u2700-\\u27bf",cc="a-z\\xdf-\\xf6\\xf8-\\xff",W0="\\xac\\xb1\\xd7\\xf7",P0="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",C0="\\u2000-\\u206f",V0=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",uc="A-Z\\xc0-\\xd6\\xd8-\\xde",hc="\\ufe0e\\ufe0f",dc=W0+P0+C0+V0,bo="['’]",A0="["+Xi+"]",fc="["+dc+"]",ki="["+ac+"]",pc="\\d+",F0="["+lc+"]",mc="["+cc+"]",gc="[^"+Xi+dc+pc+lc+cc+uc+"]",xo="\\ud83c[\\udffb-\\udfff]",X0="(?:"+ki+"|"+xo+")",yc="[^"+Xi+"]",_o="(?:\\ud83c[\\udde6-\\uddff]){2}",Mo="[\\ud800-\\udbff][\\udc00-\\udfff]",vr="["+uc+"]",vc="\\u200d",wc="(?:"+mc+"|"+gc+")",k0="(?:"+vr+"|"+gc+")",bc="(?:"+bo+"(?:d|ll|m|re|s|t|ve))?",xc="(?:"+bo+"(?:D|LL|M|RE|S|T|VE))?",_c=X0+"?",Mc="["+hc+"]?",D0="(?:"+vc+"(?:"+[yc,_o,Mo].join("|")+")"+Mc+_c+")*",z0="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",O0="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Lc=Mc+_c+D0,K0="(?:"+[F0,_o,Mo].join("|")+")"+Lc,R0="(?:"+[yc+ki+"?",ki,_o,Mo,A0].join("|")+")",Y0=RegExp(bo,"g"),U0=RegExp(ki,"g"),Lo=RegExp(xo+"(?="+xo+")|"+R0+Lc,"g"),B0=RegExp([vr+"?"+mc+"+"+bc+"(?="+[fc,vr,"$"].join("|")+")",k0+"+"+xc+"(?="+[fc,vr+wc,"$"].join("|")+")",vr+"?"+wc+"+"+bc,vr+"+"+xc,O0,z0,pc,K0].join("|"),"g"),N0=RegExp("["+vc+Xi+ac+hc+"]"),j0=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,J0=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Q0=-1,Ce={};Ce[Jr]=Ce[Qr]=Ce[mr]=Ce[Hr]=Ce[Er]=Ce[gr]=Ce[Qn]=Ce[X]=Ce[E]=!0,Ce[Ye]=Ce[je]=Ce[In]=Ce[Qe]=Ce[sn]=Ce[ct]=Ce[Ue]=Ce[hn]=Ce[Ae]=Ce[Ut]=Ce[Wt]=Ce[Nn]=Ce[bt]=Ce[Gn]=Ce[Jn]=!1;var We={};We[Ye]=We[je]=We[In]=We[sn]=We[Qe]=We[ct]=We[Jr]=We[Qr]=We[mr]=We[Hr]=We[Er]=We[Ae]=We[Ut]=We[Wt]=We[Nn]=We[bt]=We[Gn]=We[Zn]=We[gr]=We[Qn]=We[X]=We[E]=!0,We[Ue]=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ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},E0={"&":"&","<":"<",">":">",'"':""","'":"'"},q0={"&":"&","<":"<",">":">",""":'"',"'":"'"},$0={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},eg=parseFloat,tg=parseInt,Sc=typeof Yr=="object"&&Yr&&Yr.Object===Object&&Yr,ng=typeof self=="object"&&self&&self.Object===Object&&self,nt=Sc||ng||Function("return this")(),So=t&&!t.nodeType&&t,qn=So&&!0&&a&&!a.nodeType&&a,Tc=qn&&qn.exports===So,To=Tc&&Sc.process,Ct=function(){try{var C=qn&&qn.require&&qn.require("util").types;return C||To&&To.binding&&To.binding("util")}catch{}}(),Gc=Ct&&Ct.isArrayBuffer,Zc=Ct&&Ct.isDate,Ic=Ct&&Ct.isMap,Wc=Ct&&Ct.isRegExp,Pc=Ct&&Ct.isSet,Cc=Ct&&Ct.isTypedArray;function xt(C,Y,z){switch(z.length){case 0:return C.call(Y);case 1:return C.call(Y,z[0]);case 2:return C.call(Y,z[0],z[1]);case 3:return C.call(Y,z[0],z[1],z[2])}return C.apply(Y,z)}function rg(C,Y,z,ne){for(var de=-1,Te=C==null?0:C.length;++de<Te;){var Be=C[de];Y(ne,Be,z(Be),C)}return ne}function Vt(C,Y){for(var z=-1,ne=C==null?0:C.length;++z<ne&&Y(C[z],z,C)!==!1;);return C}function ig(C,Y){for(var z=C==null?0:C.length;z--&&Y(C[z],z,C)!==!1;);return C}function Vc(C,Y){for(var z=-1,ne=C==null?0:C.length;++z<ne;)if(!Y(C[z],z,C))return!1;return!0}function Pn(C,Y){for(var z=-1,ne=C==null?0:C.length,de=0,Te=[];++z<ne;){var Be=C[z];Y(Be,z,C)&&(Te[de++]=Be)}return Te}function Di(C,Y){var z=C==null?0:C.length;return!!z&&wr(C,Y,0)>-1}function Go(C,Y,z){for(var ne=-1,de=C==null?0:C.length;++ne<de;)if(z(Y,C[ne]))return!0;return!1}function Ve(C,Y){for(var z=-1,ne=C==null?0:C.length,de=Array(ne);++z<ne;)de[z]=Y(C[z],z,C);return de}function Cn(C,Y){for(var z=-1,ne=Y.length,de=C.length;++z<ne;)C[de+z]=Y[z];return C}function Zo(C,Y,z,ne){var de=-1,Te=C==null?0:C.length;for(ne&&Te&&(z=C[++de]);++de<Te;)z=Y(z,C[de],de,C);return z}function sg(C,Y,z,ne){var de=C==null?0:C.length;for(ne&&de&&(z=C[--de]);de--;)z=Y(z,C[de],de,C);return z}function Io(C,Y){for(var z=-1,ne=C==null?0:C.length;++z<ne;)if(Y(C[z],z,C))return!0;return!1}var og=Wo("length");function ag(C){return C.split("")}function lg(C){return C.match(g0)||[]}function Ac(C,Y,z){var ne;return z(C,function(de,Te,Be){if(Y(de,Te,Be))return ne=Te,!1}),ne}function zi(C,Y,z,ne){for(var de=C.length,Te=z+(ne?1:-1);ne?Te--:++Te<de;)if(Y(C[Te],Te,C))return Te;return-1}function wr(C,Y,z){return Y===Y?bg(C,Y,z):zi(C,Fc,z)}function cg(C,Y,z,ne){for(var de=z-1,Te=C.length;++de<Te;)if(ne(C[de],Y))return de;return-1}function Fc(C){return C!==C}function Xc(C,Y){var z=C==null?0:C.length;return z?Co(C,Y)/z:me}function Wo(C){return function(Y){return Y==null?e:Y[C]}}function Po(C){return function(Y){return C==null?e:C[Y]}}function kc(C,Y,z,ne,de){return de(C,function(Te,Be,Ie){z=ne?(ne=!1,Te):Y(z,Te,Be,Ie)}),z}function ug(C,Y){var z=C.length;for(C.sort(Y);z--;)C[z]=C[z].value;return C}function Co(C,Y){for(var z,ne=-1,de=C.length;++ne<de;){var Te=Y(C[ne]);Te!==e&&(z=z===e?Te:z+Te)}return z}function Vo(C,Y){for(var z=-1,ne=Array(C);++z<C;)ne[z]=Y(z);return ne}function hg(C,Y){return Ve(Y,function(z){return[z,C[z]]})}function Dc(C){return C&&C.slice(0,Rc(C)+1).replace(wo,"")}function _t(C){return function(Y){return C(Y)}}function Ao(C,Y){return Ve(Y,function(z){return C[z]})}function qr(C,Y){return C.has(Y)}function zc(C,Y){for(var z=-1,ne=C.length;++z<ne&&wr(Y,C[z],0)>-1;);return z}function Oc(C,Y){for(var z=C.length;z--&&wr(Y,C[z],0)>-1;);return z}function dg(C,Y){for(var z=C.length,ne=0;z--;)C[z]===Y&&++ne;return ne}var fg=Po(H0),pg=Po(E0);function mg(C){return"\\"+$0[C]}function gg(C,Y){return C==null?e:C[Y]}function br(C){return N0.test(C)}function yg(C){return j0.test(C)}function vg(C){for(var Y,z=[];!(Y=C.next()).done;)z.push(Y.value);return z}function Fo(C){var Y=-1,z=Array(C.size);return C.forEach(function(ne,de){z[++Y]=[de,ne]}),z}function Kc(C,Y){return function(z){return C(Y(z))}}function Vn(C,Y){for(var z=-1,ne=C.length,de=0,Te=[];++z<ne;){var Be=C[z];(Be===Y||Be===p)&&(C[z]=p,Te[de++]=z)}return Te}function Oi(C){var Y=-1,z=Array(C.size);return C.forEach(function(ne){z[++Y]=ne}),z}function wg(C){var Y=-1,z=Array(C.size);return C.forEach(function(ne){z[++Y]=[ne,ne]}),z}function bg(C,Y,z){for(var ne=z-1,de=C.length;++ne<de;)if(C[ne]===Y)return ne;return-1}function xg(C,Y,z){for(var ne=z+1;ne--;)if(C[ne]===Y)return ne;return ne}function xr(C){return br(C)?Mg(C):og(C)}function Jt(C){return br(C)?Lg(C):ag(C)}function Rc(C){for(var Y=C.length;Y--&&d0.test(C.charAt(Y)););return Y}var _g=Po(q0);function Mg(C){for(var Y=Lo.lastIndex=0;Lo.test(C);)++Y;return Y}function Lg(C){return C.match(Lo)||[]}function Sg(C){return C.match(B0)||[]}var Tg=function C(Y){Y=Y==null?nt:_r.defaults(nt.Object(),Y,_r.pick(nt,J0));var z=Y.Array,ne=Y.Date,de=Y.Error,Te=Y.Function,Be=Y.Math,Ie=Y.Object,Xo=Y.RegExp,Gg=Y.String,At=Y.TypeError,Ki=z.prototype,Zg=Te.prototype,Mr=Ie.prototype,Ri=Y["__core-js_shared__"],Yi=Zg.toString,Ze=Mr.hasOwnProperty,Ig=0,Yc=function(){var i=/[^.]+$/.exec(Ri&&Ri.keys&&Ri.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""}(),Ui=Mr.toString,Wg=Yi.call(Ie),Pg=nt._,Cg=Xo("^"+Yi.call(Ze).replace(vo,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Bi=Tc?Y.Buffer:e,An=Y.Symbol,Ni=Y.Uint8Array,Uc=Bi?Bi.allocUnsafe:e,ji=Kc(Ie.getPrototypeOf,Ie),Bc=Ie.create,Nc=Mr.propertyIsEnumerable,Ji=Ki.splice,jc=An?An.isConcatSpreadable:e,$r=An?An.iterator:e,$n=An?An.toStringTag:e,Qi=function(){try{var i=ir(Ie,"defineProperty");return i({},"",{}),i}catch{}}(),Vg=Y.clearTimeout!==nt.clearTimeout&&Y.clearTimeout,Ag=ne&&ne.now!==nt.Date.now&&ne.now,Fg=Y.setTimeout!==nt.setTimeout&&Y.setTimeout,Hi=Be.ceil,Ei=Be.floor,ko=Ie.getOwnPropertySymbols,Xg=Bi?Bi.isBuffer:e,Jc=Y.isFinite,kg=Ki.join,Dg=Kc(Ie.keys,Ie),Ne=Be.max,st=Be.min,zg=ne.now,Og=Y.parseInt,Qc=Be.random,Kg=Ki.reverse,Do=ir(Y,"DataView"),ei=ir(Y,"Map"),zo=ir(Y,"Promise"),Lr=ir(Y,"Set"),ti=ir(Y,"WeakMap"),ni=ir(Ie,"create"),qi=ti&&new ti,Sr={},Rg=sr(Do),Yg=sr(ei),Ug=sr(zo),Bg=sr(Lr),Ng=sr(ti),$i=An?An.prototype:e,ri=$i?$i.valueOf:e,Hc=$i?$i.toString:e;function x(i){if(De(i)&&!fe(i)&&!(i instanceof Me)){if(i instanceof Ft)return i;if(Ze.call(i,"__wrapped__"))return Eu(i)}return new Ft(i)}var Tr=function(){function i(){}return function(o){if(!Fe(o))return{};if(Bc)return Bc(o);i.prototype=o;var h=new i;return i.prototype=e,h}}();function es(){}function Ft(i,o){this.__wrapped__=i,this.__actions__=[],this.__chain__=!!o,this.__index__=0,this.__values__=e}x.templateSettings={escape:Nt,evaluate:jt,interpolate:Wn,variable:"",imports:{_:x}},x.prototype=es.prototype,x.prototype.constructor=x,Ft.prototype=Tr(es.prototype),Ft.prototype.constructor=Ft;function Me(i){this.__wrapped__=i,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=xe,this.__views__=[]}function jg(){var i=new Me(this.__wrapped__);return i.__actions__=mt(this.__actions__),i.__dir__=this.__dir__,i.__filtered__=this.__filtered__,i.__iteratees__=mt(this.__iteratees__),i.__takeCount__=this.__takeCount__,i.__views__=mt(this.__views__),i}function Jg(){if(this.__filtered__){var i=new Me(this);i.__dir__=-1,i.__filtered__=!0}else i=this.clone(),i.__dir__*=-1;return i}function Qg(){var i=this.__wrapped__.value(),o=this.__dir__,h=fe(i),g=o<0,w=h?i.length:0,M=a1(0,w,this.__views__),Z=M.start,W=M.end,A=W-Z,U=g?W:Z-1,B=this.__iteratees__,j=B.length,$=0,re=st(A,this.__takeCount__);if(!h||!g&&w==A&&re==A)return bu(i,this.__actions__);var le=[];e:for(;A--&&$<re;){U+=o;for(var ge=-1,ce=i[U];++ge<j;){var _e=B[ge],Le=_e.iteratee,St=_e.type,dt=Le(ce);if(St==q)ce=dt;else if(!dt){if(St==Q)continue e;break e}}le[$++]=ce}return le}Me.prototype=Tr(es.prototype),Me.prototype.constructor=Me;function er(i){var o=-1,h=i==null?0:i.length;for(this.clear();++o<h;){var g=i[o];this.set(g[0],g[1])}}function Hg(){this.__data__=ni?ni(null):{},this.size=0}function Eg(i){var o=this.has(i)&&delete this.__data__[i];return this.size-=o?1:0,o}function qg(i){var o=this.__data__;if(ni){var h=o[i];return h===u?e:h}return Ze.call(o,i)?o[i]:e}function $g(i){var o=this.__data__;return ni?o[i]!==e:Ze.call(o,i)}function ey(i,o){var h=this.__data__;return this.size+=this.has(i)?0:1,h[i]=ni&&o===e?u:o,this}er.prototype.clear=Hg,er.prototype.delete=Eg,er.prototype.get=qg,er.prototype.has=$g,er.prototype.set=ey;function dn(i){var o=-1,h=i==null?0:i.length;for(this.clear();++o<h;){var g=i[o];this.set(g[0],g[1])}}function ty(){this.__data__=[],this.size=0}function ny(i){var o=this.__data__,h=ts(o,i);if(h<0)return!1;var g=o.length-1;return h==g?o.pop():Ji.call(o,h,1),--this.size,!0}function ry(i){var o=this.__data__,h=ts(o,i);return h<0?e:o[h][1]}function iy(i){return ts(this.__data__,i)>-1}function sy(i,o){var h=this.__data__,g=ts(h,i);return g<0?(++this.size,h.push([i,o])):h[g][1]=o,this}dn.prototype.clear=ty,dn.prototype.delete=ny,dn.prototype.get=ry,dn.prototype.has=iy,dn.prototype.set=sy;function fn(i){var o=-1,h=i==null?0:i.length;for(this.clear();++o<h;){var g=i[o];this.set(g[0],g[1])}}function oy(){this.size=0,this.__data__={hash:new er,map:new(ei||dn),string:new er}}function ay(i){var o=fs(this,i).delete(i);return this.size-=o?1:0,o}function ly(i){return fs(this,i).get(i)}function cy(i){return fs(this,i).has(i)}function uy(i,o){var h=fs(this,i),g=h.size;return h.set(i,o),this.size+=h.size==g?0:1,this}fn.prototype.clear=oy,fn.prototype.delete=ay,fn.prototype.get=ly,fn.prototype.has=cy,fn.prototype.set=uy;function tr(i){var o=-1,h=i==null?0:i.length;for(this.__data__=new fn;++o<h;)this.add(i[o])}function hy(i){return this.__data__.set(i,u),this}function dy(i){return this.__data__.has(i)}tr.prototype.add=tr.prototype.push=hy,tr.prototype.has=dy;function Qt(i){var o=this.__data__=new dn(i);this.size=o.size}function fy(){this.__data__=new dn,this.size=0}function py(i){var o=this.__data__,h=o.delete(i);return this.size=o.size,h}function my(i){return this.__data__.get(i)}function gy(i){return this.__data__.has(i)}function yy(i,o){var h=this.__data__;if(h instanceof dn){var g=h.__data__;if(!ei||g.length<r-1)return g.push([i,o]),this.size=++h.size,this;h=this.__data__=new fn(g)}return h.set(i,o),this.size=h.size,this}Qt.prototype.clear=fy,Qt.prototype.delete=py,Qt.prototype.get=my,Qt.prototype.has=gy,Qt.prototype.set=yy;function Ec(i,o){var h=fe(i),g=!h&&or(i),w=!h&&!g&&zn(i),M=!h&&!g&&!w&&Wr(i),Z=h||g||w||M,W=Z?Vo(i.length,Gg):[],A=W.length;for(var U in i)(o||Ze.call(i,U))&&!(Z&&(U=="length"||w&&(U=="offset"||U=="parent")||M&&(U=="buffer"||U=="byteLength"||U=="byteOffset")||yn(U,A)))&&W.push(U);return W}function qc(i){var o=i.length;return o?i[Ho(0,o-1)]:e}function vy(i,o){return ps(mt(i),nr(o,0,i.length))}function wy(i){return ps(mt(i))}function Oo(i,o,h){(h!==e&&!Ht(i[o],h)||h===e&&!(o in i))&&pn(i,o,h)}function ii(i,o,h){var g=i[o];(!(Ze.call(i,o)&&Ht(g,h))||h===e&&!(o in i))&&pn(i,o,h)}function ts(i,o){for(var h=i.length;h--;)if(Ht(i[h][0],o))return h;return-1}function by(i,o,h,g){return Fn(i,function(w,M,Z){o(g,w,h(w),Z)}),g}function $c(i,o){return i&&an(o,He(o),i)}function xy(i,o){return i&&an(o,yt(o),i)}function pn(i,o,h){o=="__proto__"&&Qi?Qi(i,o,{configurable:!0,enumerable:!0,value:h,writable:!0}):i[o]=h}function Ko(i,o){for(var h=-1,g=o.length,w=z(g),M=i==null;++h<g;)w[h]=M?e:xa(i,o[h]);return w}function nr(i,o,h){return i===i&&(h!==e&&(i=i<=h?i:h),o!==e&&(i=i>=o?i:o)),i}function Xt(i,o,h,g,w,M){var Z,W=o&f,A=o&y,U=o&v;if(h&&(Z=w?h(i,g,w,M):h(i)),Z!==e)return Z;if(!Fe(i))return i;var B=fe(i);if(B){if(Z=c1(i),!W)return mt(i,Z)}else{var j=ot(i),$=j==hn||j==Tn;if(zn(i))return Mu(i,W);if(j==Wt||j==Ye||$&&!w){if(Z=A||$?{}:Ru(i),!W)return A?qy(i,xy(Z,i)):Ey(i,$c(Z,i))}else{if(!We[j])return w?i:{};Z=u1(i,j,W)}}M||(M=new Qt);var re=M.get(i);if(re)return re;M.set(i,Z),yh(i)?i.forEach(function(ce){Z.add(Xt(ce,o,h,ce,i,M))}):mh(i)&&i.forEach(function(ce,_e){Z.set(_e,Xt(ce,o,h,_e,i,M))});var le=U?A?aa:oa:A?yt:He,ge=B?e:le(i);return Vt(ge||i,function(ce,_e){ge&&(_e=ce,ce=i[_e]),ii(Z,_e,Xt(ce,o,h,_e,i,M))}),Z}function _y(i){var o=He(i);return function(h){return eu(h,i,o)}}function eu(i,o,h){var g=h.length;if(i==null)return!g;for(i=Ie(i);g--;){var w=h[g],M=o[w],Z=i[w];if(Z===e&&!(w in i)||!M(Z))return!1}return!0}function tu(i,o,h){if(typeof i!="function")throw new At(l);return hi(function(){i.apply(e,h)},o)}function si(i,o,h,g){var w=-1,M=Di,Z=!0,W=i.length,A=[],U=o.length;if(!W)return A;h&&(o=Ve(o,_t(h))),g?(M=Go,Z=!1):o.length>=r&&(M=qr,Z=!1,o=new tr(o));e:for(;++w<W;){var B=i[w],j=h==null?B:h(B);if(B=g||B!==0?B:0,Z&&j===j){for(var $=U;$--;)if(o[$]===j)continue e;A.push(B)}else M(o,j,g)||A.push(B)}return A}var Fn=Zu(on),nu=Zu(Yo,!0);function My(i,o){var h=!0;return Fn(i,function(g,w,M){return h=!!o(g,w,M),h}),h}function ns(i,o,h){for(var g=-1,w=i.length;++g<w;){var M=i[g],Z=o(M);if(Z!=null&&(W===e?Z===Z&&!Lt(Z):h(Z,W)))var W=Z,A=M}return A}function Ly(i,o,h,g){var w=i.length;for(h=pe(h),h<0&&(h=-h>w?0:w+h),g=g===e||g>w?w:pe(g),g<0&&(g+=w),g=h>g?0:wh(g);h<g;)i[h++]=o;return i}function ru(i,o){var h=[];return Fn(i,function(g,w,M){o(g,w,M)&&h.push(g)}),h}function rt(i,o,h,g,w){var M=-1,Z=i.length;for(h||(h=d1),w||(w=[]);++M<Z;){var W=i[M];o>0&&h(W)?o>1?rt(W,o-1,h,g,w):Cn(w,W):g||(w[w.length]=W)}return w}var Ro=Iu(),iu=Iu(!0);function on(i,o){return i&&Ro(i,o,He)}function Yo(i,o){return i&&iu(i,o,He)}function rs(i,o){return Pn(o,function(h){return vn(i[h])})}function rr(i,o){o=kn(o,i);for(var h=0,g=o.length;i!=null&&h<g;)i=i[ln(o[h++])];return h&&h==g?i:e}function su(i,o,h){var g=o(i);return fe(i)?g:Cn(g,h(i))}function ut(i){return i==null?i===e?jn:It:$n&&$n in Ie(i)?o1(i):w1(i)}function Uo(i,o){return i>o}function Sy(i,o){return i!=null&&Ze.call(i,o)}function Ty(i,o){return i!=null&&o in Ie(i)}function Gy(i,o,h){return i>=st(o,h)&&i<Ne(o,h)}function Bo(i,o,h){for(var g=h?Go:Di,w=i[0].length,M=i.length,Z=M,W=z(M),A=1/0,U=[];Z--;){var B=i[Z];Z&&o&&(B=Ve(B,_t(o))),A=st(B.length,A),W[Z]=!h&&(o||w>=120&&B.length>=120)?new tr(Z&&B):e}B=i[0];var j=-1,$=W[0];e:for(;++j<w&&U.length<A;){var re=B[j],le=o?o(re):re;if(re=h||re!==0?re:0,!($?qr($,le):g(U,le,h))){for(Z=M;--Z;){var ge=W[Z];if(!(ge?qr(ge,le):g(i[Z],le,h)))continue e}$&&$.push(le),U.push(re)}}return U}function Zy(i,o,h,g){return on(i,function(w,M,Z){o(g,h(w),M,Z)}),g}function oi(i,o,h){o=kn(o,i),i=Nu(i,o);var g=i==null?i:i[ln(Dt(o))];return g==null?e:xt(g,i,h)}function ou(i){return De(i)&&ut(i)==Ye}function Iy(i){return De(i)&&ut(i)==In}function Wy(i){return De(i)&&ut(i)==ct}function ai(i,o,h,g,w){return i===o?!0:i==null||o==null||!De(i)&&!De(o)?i!==i&&o!==o:Py(i,o,h,g,ai,w)}function Py(i,o,h,g,w,M){var Z=fe(i),W=fe(o),A=Z?je:ot(i),U=W?je:ot(o);A=A==Ye?Wt:A,U=U==Ye?Wt:U;var B=A==Wt,j=U==Wt,$=A==U;if($&&zn(i)){if(!zn(o))return!1;Z=!0,B=!1}if($&&!B)return M||(M=new Qt),Z||Wr(i)?zu(i,o,h,g,w,M):i1(i,o,A,h,g,w,M);if(!(h&b)){var re=B&&Ze.call(i,"__wrapped__"),le=j&&Ze.call(o,"__wrapped__");if(re||le){var ge=re?i.value():i,ce=le?o.value():o;return M||(M=new Qt),w(ge,ce,h,g,M)}}return $?(M||(M=new Qt),s1(i,o,h,g,w,M)):!1}function Cy(i){return De(i)&&ot(i)==Ae}function No(i,o,h,g){var w=h.length,M=w,Z=!g;if(i==null)return!M;for(i=Ie(i);w--;){var W=h[w];if(Z&&W[2]?W[1]!==i[W[0]]:!(W[0]in i))return!1}for(;++w<M;){W=h[w];var A=W[0],U=i[A],B=W[1];if(Z&&W[2]){if(U===e&&!(A in i))return!1}else{var j=new Qt;if(g)var $=g(U,B,A,i,o,j);if(!($===e?ai(B,U,b|T,g,j):$))return!1}}return!0}function au(i){if(!Fe(i)||p1(i))return!1;var o=vn(i)?Cg:_0;return o.test(sr(i))}function Vy(i){return De(i)&&ut(i)==Nn}function Ay(i){return De(i)&&ot(i)==bt}function Fy(i){return De(i)&&bs(i.length)&&!!Ce[ut(i)]}function lu(i){return typeof i=="function"?i:i==null?vt:typeof i=="object"?fe(i)?hu(i[0],i[1]):uu(i):Wh(i)}function jo(i){if(!ui(i))return Dg(i);var o=[];for(var h in Ie(i))Ze.call(i,h)&&h!="constructor"&&o.push(h);return o}function Xy(i){if(!Fe(i))return v1(i);var o=ui(i),h=[];for(var g in i)g=="constructor"&&(o||!Ze.call(i,g))||h.push(g);return h}function Jo(i,o){return i<o}function cu(i,o){var h=-1,g=gt(i)?z(i.length):[];return Fn(i,function(w,M,Z){g[++h]=o(w,M,Z)}),g}function uu(i){var o=ca(i);return o.length==1&&o[0][2]?Uu(o[0][0],o[0][1]):function(h){return h===i||No(h,i,o)}}function hu(i,o){return ha(i)&&Yu(o)?Uu(ln(i),o):function(h){var g=xa(h,i);return g===e&&g===o?_a(h,i):ai(o,g,b|T)}}function is(i,o,h,g,w){i!==o&&Ro(o,function(M,Z){if(w||(w=new Qt),Fe(M))ky(i,o,Z,h,is,g,w);else{var W=g?g(fa(i,Z),M,Z+"",i,o,w):e;W===e&&(W=M),Oo(i,Z,W)}},yt)}function ky(i,o,h,g,w,M,Z){var W=fa(i,h),A=fa(o,h),U=Z.get(A);if(U){Oo(i,h,U);return}var B=M?M(W,A,h+"",i,o,Z):e,j=B===e;if(j){var $=fe(A),re=!$&&zn(A),le=!$&&!re&&Wr(A);B=A,$||re||le?fe(W)?B=W:Oe(W)?B=mt(W):re?(j=!1,B=Mu(A,!0)):le?(j=!1,B=Lu(A,!0)):B=[]:di(A)||or(A)?(B=W,or(W)?B=bh(W):(!Fe(W)||vn(W))&&(B=Ru(A))):j=!1}j&&(Z.set(A,B),w(B,A,g,M,Z),Z.delete(A)),Oo(i,h,B)}function du(i,o){var h=i.length;if(h)return o+=o<0?h:0,yn(o,h)?i[o]:e}function fu(i,o,h){o.length?o=Ve(o,function(M){return fe(M)?function(Z){return rr(Z,M.length===1?M[0]:M)}:M}):o=[vt];var g=-1;o=Ve(o,_t(ae()));var w=cu(i,function(M,Z,W){var A=Ve(o,function(U){return U(M)});return{criteria:A,index:++g,value:M}});return ug(w,function(M,Z){return Hy(M,Z,h)})}function Dy(i,o){return pu(i,o,function(h,g){return _a(i,g)})}function pu(i,o,h){for(var g=-1,w=o.length,M={};++g<w;){var Z=o[g],W=rr(i,Z);h(W,Z)&&li(M,kn(Z,i),W)}return M}function zy(i){return function(o){return rr(o,i)}}function Qo(i,o,h,g){var w=g?cg:wr,M=-1,Z=o.length,W=i;for(i===o&&(o=mt(o)),h&&(W=Ve(i,_t(h)));++M<Z;)for(var A=0,U=o[M],B=h?h(U):U;(A=w(W,B,A,g))>-1;)W!==i&&Ji.call(W,A,1),Ji.call(i,A,1);return i}function mu(i,o){for(var h=i?o.length:0,g=h-1;h--;){var w=o[h];if(h==g||w!==M){var M=w;yn(w)?Ji.call(i,w,1):$o(i,w)}}return i}function Ho(i,o){return i+Ei(Qc()*(o-i+1))}function Oy(i,o,h,g){for(var w=-1,M=Ne(Hi((o-i)/(h||1)),0),Z=z(M);M--;)Z[g?M:++w]=i,i+=h;return Z}function Eo(i,o){var h="";if(!i||o<1||o>ie)return h;do o%2&&(h+=i),o=Ei(o/2),o&&(i+=i);while(o);return h}function ye(i,o){return pa(Bu(i,o,vt),i+"")}function Ky(i){return qc(Pr(i))}function Ry(i,o){var h=Pr(i);return ps(h,nr(o,0,h.length))}function li(i,o,h,g){if(!Fe(i))return i;o=kn(o,i);for(var w=-1,M=o.length,Z=M-1,W=i;W!=null&&++w<M;){var A=ln(o[w]),U=h;if(A==="__proto__"||A==="constructor"||A==="prototype")return i;if(w!=Z){var B=W[A];U=g?g(B,A,W):e,U===e&&(U=Fe(B)?B:yn(o[w+1])?[]:{})}ii(W,A,U),W=W[A]}return i}var gu=qi?function(i,o){return qi.set(i,o),i}:vt,Yy=Qi?function(i,o){return Qi(i,"toString",{configurable:!0,enumerable:!1,value:La(o),writable:!0})}:vt;function Uy(i){return ps(Pr(i))}function kt(i,o,h){var g=-1,w=i.length;o<0&&(o=-o>w?0:w+o),h=h>w?w:h,h<0&&(h+=w),w=o>h?0:h-o>>>0,o>>>=0;for(var M=z(w);++g<w;)M[g]=i[g+o];return M}function By(i,o){var h;return Fn(i,function(g,w,M){return h=o(g,w,M),!h}),!!h}function ss(i,o,h){var g=0,w=i==null?g:i.length;if(typeof o=="number"&&o===o&&w<=ve){for(;g<w;){var M=g+w>>>1,Z=i[M];Z!==null&&!Lt(Z)&&(h?Z<=o:Z<o)?g=M+1:w=M}return w}return qo(i,o,vt,h)}function qo(i,o,h,g){var w=0,M=i==null?0:i.length;if(M===0)return 0;o=h(o);for(var Z=o!==o,W=o===null,A=Lt(o),U=o===e;w<M;){var B=Ei((w+M)/2),j=h(i[B]),$=j!==e,re=j===null,le=j===j,ge=Lt(j);if(Z)var ce=g||le;else U?ce=le&&(g||$):W?ce=le&&$&&(g||!re):A?ce=le&&$&&!re&&(g||!ge):re||ge?ce=!1:ce=g?j<=o:j<o;ce?w=B+1:M=B}return st(M,he)}function yu(i,o){for(var h=-1,g=i.length,w=0,M=[];++h<g;){var Z=i[h],W=o?o(Z):Z;if(!h||!Ht(W,A)){var A=W;M[w++]=Z===0?0:Z}}return M}function vu(i){return typeof i=="number"?i:Lt(i)?me:+i}function Mt(i){if(typeof i=="string")return i;if(fe(i))return Ve(i,Mt)+"";if(Lt(i))return Hc?Hc.call(i):"";var o=i+"";return o=="0"&&1/i==-oe?"-0":o}function Xn(i,o,h){var g=-1,w=Di,M=i.length,Z=!0,W=[],A=W;if(h)Z=!1,w=Go;else if(M>=r){var U=o?null:n1(i);if(U)return Oi(U);Z=!1,w=qr,A=new tr}else A=o?[]:W;e:for(;++g<M;){var B=i[g],j=o?o(B):B;if(B=h||B!==0?B:0,Z&&j===j){for(var $=A.length;$--;)if(A[$]===j)continue e;o&&A.push(j),W.push(B)}else w(A,j,h)||(A!==W&&A.push(j),W.push(B))}return W}function $o(i,o){return o=kn(o,i),i=Nu(i,o),i==null||delete i[ln(Dt(o))]}function wu(i,o,h,g){return li(i,o,h(rr(i,o)),g)}function os(i,o,h,g){for(var w=i.length,M=g?w:-1;(g?M--:++M<w)&&o(i[M],M,i););return h?kt(i,g?0:M,g?M+1:w):kt(i,g?M+1:0,g?w:M)}function bu(i,o){var h=i;return h instanceof Me&&(h=h.value()),Zo(o,function(g,w){return w.func.apply(w.thisArg,Cn([g],w.args))},h)}function ea(i,o,h){var g=i.length;if(g<2)return g?Xn(i[0]):[];for(var w=-1,M=z(g);++w<g;)for(var Z=i[w],W=-1;++W<g;)W!=w&&(M[w]=si(M[w]||Z,i[W],o,h));return Xn(rt(M,1),o,h)}function xu(i,o,h){for(var g=-1,w=i.length,M=o.length,Z={};++g<w;){var W=g<M?o[g]:e;h(Z,i[g],W)}return Z}function ta(i){return Oe(i)?i:[]}function na(i){return typeof i=="function"?i:vt}function kn(i,o){return fe(i)?i:ha(i,o)?[i]:Hu(Ge(i))}var Ny=ye;function Dn(i,o,h){var g=i.length;return h=h===e?g:h,!o&&h>=g?i:kt(i,o,h)}var _u=Vg||function(i){return nt.clearTimeout(i)};function Mu(i,o){if(o)return i.slice();var h=i.length,g=Uc?Uc(h):new i.constructor(h);return i.copy(g),g}function ra(i){var o=new i.constructor(i.byteLength);return new Ni(o).set(new Ni(i)),o}function jy(i,o){var h=o?ra(i.buffer):i.buffer;return new i.constructor(h,i.byteOffset,i.byteLength)}function Jy(i){var o=new i.constructor(i.source,oc.exec(i));return o.lastIndex=i.lastIndex,o}function Qy(i){return ri?Ie(ri.call(i)):{}}function Lu(i,o){var h=o?ra(i.buffer):i.buffer;return new i.constructor(h,i.byteOffset,i.length)}function Su(i,o){if(i!==o){var h=i!==e,g=i===null,w=i===i,M=Lt(i),Z=o!==e,W=o===null,A=o===o,U=Lt(o);if(!W&&!U&&!M&&i>o||M&&Z&&A&&!W&&!U||g&&Z&&A||!h&&A||!w)return 1;if(!g&&!M&&!U&&i<o||U&&h&&w&&!g&&!M||W&&h&&w||!Z&&w||!A)return-1}return 0}function Hy(i,o,h){for(var g=-1,w=i.criteria,M=o.criteria,Z=w.length,W=h.length;++g<Z;){var A=Su(w[g],M[g]);if(A){if(g>=W)return A;var U=h[g];return A*(U=="desc"?-1:1)}}return i.index-o.index}function Tu(i,o,h,g){for(var w=-1,M=i.length,Z=h.length,W=-1,A=o.length,U=Ne(M-Z,0),B=z(A+U),j=!g;++W<A;)B[W]=o[W];for(;++w<Z;)(j||w<M)&&(B[h[w]]=i[w]);for(;U--;)B[W++]=i[w++];return B}function Gu(i,o,h,g){for(var w=-1,M=i.length,Z=-1,W=h.length,A=-1,U=o.length,B=Ne(M-W,0),j=z(B+U),$=!g;++w<B;)j[w]=i[w];for(var re=w;++A<U;)j[re+A]=o[A];for(;++Z<W;)($||w<M)&&(j[re+h[Z]]=i[w++]);return j}function mt(i,o){var h=-1,g=i.length;for(o||(o=z(g));++h<g;)o[h]=i[h];return o}function an(i,o,h,g){var w=!h;h||(h={});for(var M=-1,Z=o.length;++M<Z;){var W=o[M],A=g?g(h[W],i[W],W,h,i):e;A===e&&(A=i[W]),w?pn(h,W,A):ii(h,W,A)}return h}function Ey(i,o){return an(i,ua(i),o)}function qy(i,o){return an(i,Ou(i),o)}function as(i,o){return function(h,g){var w=fe(h)?rg:by,M=o?o():{};return w(h,i,ae(g,2),M)}}function Gr(i){return ye(function(o,h){var g=-1,w=h.length,M=w>1?h[w-1]:e,Z=w>2?h[2]:e;for(M=i.length>3&&typeof M=="function"?(w--,M):e,Z&&ht(h[0],h[1],Z)&&(M=w<3?e:M,w=1),o=Ie(o);++g<w;){var W=h[g];W&&i(o,W,g,M)}return o})}function Zu(i,o){return function(h,g){if(h==null)return h;if(!gt(h))return i(h,g);for(var w=h.length,M=o?w:-1,Z=Ie(h);(o?M--:++M<w)&&g(Z[M],M,Z)!==!1;);return h}}function Iu(i){return function(o,h,g){for(var w=-1,M=Ie(o),Z=g(o),W=Z.length;W--;){var A=Z[i?W:++w];if(h(M[A],A,M)===!1)break}return o}}function $y(i,o,h){var g=o&_,w=ci(i);function M(){var Z=this&&this!==nt&&this instanceof M?w:i;return Z.apply(g?h:this,arguments)}return M}function Wu(i){return function(o){o=Ge(o);var h=br(o)?Jt(o):e,g=h?h[0]:o.charAt(0),w=h?Dn(h,1).join(""):o.slice(1);return g[i]()+w}}function Zr(i){return function(o){return Zo(Zh(Gh(o).replace(Y0,"")),i,"")}}function ci(i){return function(){var o=arguments;switch(o.length){case 0:return new i;case 1:return new i(o[0]);case 2:return new i(o[0],o[1]);case 3:return new i(o[0],o[1],o[2]);case 4:return new i(o[0],o[1],o[2],o[3]);case 5:return new i(o[0],o[1],o[2],o[3],o[4]);case 6:return new i(o[0],o[1],o[2],o[3],o[4],o[5]);case 7:return new i(o[0],o[1],o[2],o[3],o[4],o[5],o[6])}var h=Tr(i.prototype),g=i.apply(h,o);return Fe(g)?g:h}}function e1(i,o,h){var g=ci(i);function w(){for(var M=arguments.length,Z=z(M),W=M,A=Ir(w);W--;)Z[W]=arguments[W];var U=M<3&&Z[0]!==A&&Z[M-1]!==A?[]:Vn(Z,A);if(M-=U.length,M<h)return Fu(i,o,ls,w.placeholder,e,Z,U,e,e,h-M);var B=this&&this!==nt&&this instanceof w?g:i;return xt(B,this,Z)}return w}function Pu(i){return function(o,h,g){var w=Ie(o);if(!gt(o)){var M=ae(h,3);o=He(o),h=function(W){return M(w[W],W,w)}}var Z=i(o,h,g);return Z>-1?w[M?o[Z]:Z]:e}}function Cu(i){return gn(function(o){var h=o.length,g=h,w=Ft.prototype.thru;for(i&&o.reverse();g--;){var M=o[g];if(typeof M!="function")throw new At(l);if(w&&!Z&&ds(M)=="wrapper")var Z=new Ft([],!0)}for(g=Z?g:h;++g<h;){M=o[g];var W=ds(M),A=W=="wrapper"?la(M):e;A&&da(A[0])&&A[1]==(O|I|K|V)&&!A[4].length&&A[9]==1?Z=Z[ds(A[0])].apply(Z,A[3]):Z=M.length==1&&da(M)?Z[W]():Z.thru(M)}return function(){var U=arguments,B=U[0];if(Z&&U.length==1&&fe(B))return Z.plant(B).value();for(var j=0,$=h?o[j].apply(this,U):B;++j<h;)$=o[j].call(this,$);return $}})}function ls(i,o,h,g,w,M,Z,W,A,U){var B=o&O,j=o&_,$=o&S,re=o&(I|F),le=o&R,ge=$?e:ci(i);function ce(){for(var _e=arguments.length,Le=z(_e),St=_e;St--;)Le[St]=arguments[St];if(re)var dt=Ir(ce),Tt=dg(Le,dt);if(g&&(Le=Tu(Le,g,w,re)),M&&(Le=Gu(Le,M,Z,re)),_e-=Tt,re&&_e<U){var Ke=Vn(Le,dt);return Fu(i,o,ls,ce.placeholder,h,Le,Ke,W,A,U-_e)}var Et=j?h:this,bn=$?Et[i]:i;return _e=Le.length,W?Le=b1(Le,W):le&&_e>1&&Le.reverse(),B&&A<_e&&(Le.length=A),this&&this!==nt&&this instanceof ce&&(bn=ge||ci(bn)),bn.apply(Et,Le)}return ce}function Vu(i,o){return function(h,g){return Zy(h,i,o(g),{})}}function cs(i,o){return function(h,g){var w;if(h===e&&g===e)return o;if(h!==e&&(w=h),g!==e){if(w===e)return g;typeof h=="string"||typeof g=="string"?(h=Mt(h),g=Mt(g)):(h=vu(h),g=vu(g)),w=i(h,g)}return w}}function ia(i){return gn(function(o){return o=Ve(o,_t(ae())),ye(function(h){var g=this;return i(o,function(w){return xt(w,g,h)})})})}function us(i,o){o=o===e?" ":Mt(o);var h=o.length;if(h<2)return h?Eo(o,i):o;var g=Eo(o,Hi(i/xr(o)));return br(o)?Dn(Jt(g),0,i).join(""):g.slice(0,i)}function t1(i,o,h,g){var w=o&_,M=ci(i);function Z(){for(var W=-1,A=arguments.length,U=-1,B=g.length,j=z(B+A),$=this&&this!==nt&&this instanceof Z?M:i;++U<B;)j[U]=g[U];for(;A--;)j[U++]=arguments[++W];return xt($,w?h:this,j)}return Z}function Au(i){return function(o,h,g){return g&&typeof g!="number"&&ht(o,h,g)&&(h=g=e),o=wn(o),h===e?(h=o,o=0):h=wn(h),g=g===e?o<h?1:-1:wn(g),Oy(o,h,g,i)}}function hs(i){return function(o,h){return typeof o=="string"&&typeof h=="string"||(o=zt(o),h=zt(h)),i(o,h)}}function Fu(i,o,h,g,w,M,Z,W,A,U){var B=o&I,j=B?Z:e,$=B?e:Z,re=B?M:e,le=B?e:M;o|=B?K:D,o&=~(B?D:K),o&L||(o&=-4);var ge=[i,o,w,re,j,le,$,W,A,U],ce=h.apply(e,ge);return da(i)&&ju(ce,ge),ce.placeholder=g,Ju(ce,i,o)}function sa(i){var o=Be[i];return function(h,g){if(h=zt(h),g=g==null?0:st(pe(g),292),g&&Jc(h)){var w=(Ge(h)+"e").split("e"),M=o(w[0]+"e"+(+w[1]+g));return w=(Ge(M)+"e").split("e"),+(w[0]+"e"+(+w[1]-g))}return o(h)}}var n1=Lr&&1/Oi(new Lr([,-0]))[1]==oe?function(i){return new Lr(i)}:Ga;function Xu(i){return function(o){var h=ot(o);return h==Ae?Fo(o):h==bt?wg(o):hg(o,i(o))}}function mn(i,o,h,g,w,M,Z,W){var A=o&S;if(!A&&typeof i!="function")throw new At(l);var U=g?g.length:0;if(U||(o&=-97,g=w=e),Z=Z===e?Z:Ne(pe(Z),0),W=W===e?W:pe(W),U-=w?w.length:0,o&D){var B=g,j=w;g=w=e}var $=A?e:la(i),re=[i,o,h,g,w,B,j,M,Z,W];if($&&y1(re,$),i=re[0],o=re[1],h=re[2],g=re[3],w=re[4],W=re[9]=re[9]===e?A?0:i.length:Ne(re[9]-U,0),!W&&o&(I|F)&&(o&=-25),!o||o==_)var le=$y(i,o,h);else o==I||o==F?le=e1(i,o,W):(o==K||o==(_|K))&&!w.length?le=t1(i,o,h,g):le=ls.apply(e,re);var ge=$?gu:ju;return Ju(ge(le,re),i,o)}function ku(i,o,h,g){return i===e||Ht(i,Mr[h])&&!Ze.call(g,h)?o:i}function Du(i,o,h,g,w,M){return Fe(i)&&Fe(o)&&(M.set(o,i),is(i,o,e,Du,M),M.delete(o)),i}function r1(i){return di(i)?e:i}function zu(i,o,h,g,w,M){var Z=h&b,W=i.length,A=o.length;if(W!=A&&!(Z&&A>W))return!1;var U=M.get(i),B=M.get(o);if(U&&B)return U==o&&B==i;var j=-1,$=!0,re=h&T?new tr:e;for(M.set(i,o),M.set(o,i);++j<W;){var le=i[j],ge=o[j];if(g)var ce=Z?g(ge,le,j,o,i,M):g(le,ge,j,i,o,M);if(ce!==e){if(ce)continue;$=!1;break}if(re){if(!Io(o,function(_e,Le){if(!qr(re,Le)&&(le===_e||w(le,_e,h,g,M)))return re.push(Le)})){$=!1;break}}else if(!(le===ge||w(le,ge,h,g,M))){$=!1;break}}return M.delete(i),M.delete(o),$}function i1(i,o,h,g,w,M,Z){switch(h){case sn:if(i.byteLength!=o.byteLength||i.byteOffset!=o.byteOffset)return!1;i=i.buffer,o=o.buffer;case In:return!(i.byteLength!=o.byteLength||!M(new Ni(i),new Ni(o)));case Qe:case ct:case Ut:return Ht(+i,+o);case Ue:return i.name==o.name&&i.message==o.message;case Nn:case Gn:return i==o+"";case Ae:var W=Fo;case bt:var A=g&b;if(W||(W=Oi),i.size!=o.size&&!A)return!1;var U=Z.get(i);if(U)return U==o;g|=T,Z.set(i,o);var B=zu(W(i),W(o),g,w,M,Z);return Z.delete(i),B;case Zn:if(ri)return ri.call(i)==ri.call(o)}return!1}function s1(i,o,h,g,w,M){var Z=h&b,W=oa(i),A=W.length,U=oa(o),B=U.length;if(A!=B&&!Z)return!1;for(var j=A;j--;){var $=W[j];if(!(Z?$ in o:Ze.call(o,$)))return!1}var re=M.get(i),le=M.get(o);if(re&&le)return re==o&&le==i;var ge=!0;M.set(i,o),M.set(o,i);for(var ce=Z;++j<A;){$=W[j];var _e=i[$],Le=o[$];if(g)var St=Z?g(Le,_e,$,o,i,M):g(_e,Le,$,i,o,M);if(!(St===e?_e===Le||w(_e,Le,h,g,M):St)){ge=!1;break}ce||(ce=$=="constructor")}if(ge&&!ce){var dt=i.constructor,Tt=o.constructor;dt!=Tt&&"constructor"in i&&"constructor"in o&&!(typeof dt=="function"&&dt instanceof dt&&typeof Tt=="function"&&Tt instanceof Tt)&&(ge=!1)}return M.delete(i),M.delete(o),ge}function gn(i){return pa(Bu(i,e,eh),i+"")}function oa(i){return su(i,He,ua)}function aa(i){return su(i,yt,Ou)}var la=qi?function(i){return qi.get(i)}:Ga;function ds(i){for(var o=i.name+"",h=Sr[o],g=Ze.call(Sr,o)?h.length:0;g--;){var w=h[g],M=w.func;if(M==null||M==i)return w.name}return o}function Ir(i){var o=Ze.call(x,"placeholder")?x:i;return o.placeholder}function ae(){var i=x.iteratee||Sa;return i=i===Sa?lu:i,arguments.length?i(arguments[0],arguments[1]):i}function fs(i,o){var h=i.__data__;return f1(o)?h[typeof o=="string"?"string":"hash"]:h.map}function ca(i){for(var o=He(i),h=o.length;h--;){var g=o[h],w=i[g];o[h]=[g,w,Yu(w)]}return o}function ir(i,o){var h=gg(i,o);return au(h)?h:e}function o1(i){var o=Ze.call(i,$n),h=i[$n];try{i[$n]=e;var g=!0}catch{}var w=Ui.call(i);return g&&(o?i[$n]=h:delete i[$n]),w}var ua=ko?function(i){return i==null?[]:(i=Ie(i),Pn(ko(i),function(o){return Nc.call(i,o)}))}:Za,Ou=ko?function(i){for(var o=[];i;)Cn(o,ua(i)),i=ji(i);return o}:Za,ot=ut;(Do&&ot(new Do(new ArrayBuffer(1)))!=sn||ei&&ot(new ei)!=Ae||zo&&ot(zo.resolve())!=jr||Lr&&ot(new Lr)!=bt||ti&&ot(new ti)!=Jn)&&(ot=function(i){var o=ut(i),h=o==Wt?i.constructor:e,g=h?sr(h):"";if(g)switch(g){case Rg:return sn;case Yg:return Ae;case Ug:return jr;case Bg:return bt;case Ng:return Jn}return o});function a1(i,o,h){for(var g=-1,w=h.length;++g<w;){var M=h[g],Z=M.size;switch(M.type){case"drop":i+=Z;break;case"dropRight":o-=Z;break;case"take":o=st(o,i+Z);break;case"takeRight":i=Ne(i,o-Z);break}}return{start:i,end:o}}function l1(i){var o=i.match(p0);return o?o[1].split(m0):[]}function Ku(i,o,h){o=kn(o,i);for(var g=-1,w=o.length,M=!1;++g<w;){var Z=ln(o[g]);if(!(M=i!=null&&h(i,Z)))break;i=i[Z]}return M||++g!=w?M:(w=i==null?0:i.length,!!w&&bs(w)&&yn(Z,w)&&(fe(i)||or(i)))}function c1(i){var o=i.length,h=new i.constructor(o);return o&&typeof i[0]=="string"&&Ze.call(i,"index")&&(h.index=i.index,h.input=i.input),h}function Ru(i){return typeof i.constructor=="function"&&!ui(i)?Tr(ji(i)):{}}function u1(i,o,h){var g=i.constructor;switch(o){case In:return ra(i);case Qe:case ct:return new g(+i);case sn:return jy(i,h);case Jr:case Qr:case mr:case Hr:case Er:case gr:case Qn:case X:case E:return Lu(i,h);case Ae:return new g;case Ut:case Gn:return new g(i);case Nn:return Jy(i);case bt:return new g;case Zn:return Qy(i)}}function h1(i,o){var h=o.length;if(!h)return i;var g=h-1;return o[g]=(h>1?"& ":"")+o[g],o=o.join(h>2?", ":" "),i.replace(f0,`{
|
|
546
|
+
*/Ti.exports,function(a,t){(function(){var e,n="4.17.21",r=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",l="Expected a function",c="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",d=500,p="__lodash_placeholder__",f=1,y=2,v=4,b=1,T=2,_=1,S=2,L=4,I=8,F=16,K=32,D=64,O=128,V=256,R=512,P=30,k="...",N=800,H=16,Q=1,q=2,J=3,oe=1/0,ie=9007199254740991,te=17976931348623157e292,me=NaN,xe=4294967295,he=xe-1,ve=xe>>>1,ke=[["ary",O],["bind",_],["bindKey",S],["curry",I],["curryRight",F],["flip",R],["partial",K],["partialRight",D],["rearg",V]],Ye="[object Arguments]",je="[object Array]",Je="[object AsyncFunction]",Qe="[object Boolean]",ct="[object Date]",pt="[object DOMException]",Ue="[object Error]",hn="[object Function]",Gn="[object GeneratorFunction]",Ae="[object Map]",Ut="[object Number]",Wt="[object Null]",Pt="[object Object]",jr="[object Promise]",Vi="[object Proxy]",Nn="[object RegExp]",bt="[object Set]",Zn="[object String]",In="[object Symbol]",jn="[object Undefined]",Jn="[object WeakMap]",yo="[object WeakSet]",Wn="[object ArrayBuffer]",sn="[object DataView]",Jr="[object Float32Array]",Qr="[object Float64Array]",mr="[object Int8Array]",Hr="[object Int16Array]",Er="[object Int32Array]",gr="[object Uint8Array]",Qn="[object Uint8ClampedArray]",X="[object Uint16Array]",E="[object Uint32Array]",ue=/\b__p \+= '';/g,Se=/\b(__p \+=) '' \+/g,Re=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ct=/&(?:amp|lt|gt|quot|#39);/g,Bt=/[&<>"']/g,sc=RegExp(Ct.source),Ai=RegExp(Bt.source),Nt=/<%-([\s\S]+?)%>/g,jt=/<%([\s\S]+?)%>/g,Pn=/<%=([\s\S]+?)%>/g,Hn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,En=/^\w*$/,yr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vo=/[\\^$.*+?()[\]{}|]/g,h0=RegExp(vo.source),wo=/^\s+/,d0=/\s/,f0=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,p0=/\{\n\/\* \[wrapped with (.+)\] \*/,m0=/,? & /,g0=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,y0=/[()=,{}\[\]\/\s]/,v0=/\\(\\)?/g,w0=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,oc=/\w*$/,b0=/^[-+]0x[0-9a-f]+$/i,x0=/^0b[01]+$/i,_0=/^\[object .+?Constructor\]$/,M0=/^0o[0-7]+$/i,L0=/^(?:0|[1-9]\d*)$/,S0=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Fi=/($^)/,T0=/['\n\r\u2028\u2029\\]/g,Xi="\\ud800-\\udfff",G0="\\u0300-\\u036f",Z0="\\ufe20-\\ufe2f",I0="\\u20d0-\\u20ff",ac=G0+Z0+I0,lc="\\u2700-\\u27bf",cc="a-z\\xdf-\\xf6\\xf8-\\xff",W0="\\xac\\xb1\\xd7\\xf7",P0="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",C0="\\u2000-\\u206f",V0=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",uc="A-Z\\xc0-\\xd6\\xd8-\\xde",hc="\\ufe0e\\ufe0f",dc=W0+P0+C0+V0,bo="['’]",A0="["+Xi+"]",fc="["+dc+"]",ki="["+ac+"]",pc="\\d+",F0="["+lc+"]",mc="["+cc+"]",gc="[^"+Xi+dc+pc+lc+cc+uc+"]",xo="\\ud83c[\\udffb-\\udfff]",X0="(?:"+ki+"|"+xo+")",yc="[^"+Xi+"]",_o="(?:\\ud83c[\\udde6-\\uddff]){2}",Mo="[\\ud800-\\udbff][\\udc00-\\udfff]",vr="["+uc+"]",vc="\\u200d",wc="(?:"+mc+"|"+gc+")",k0="(?:"+vr+"|"+gc+")",bc="(?:"+bo+"(?:d|ll|m|re|s|t|ve))?",xc="(?:"+bo+"(?:D|LL|M|RE|S|T|VE))?",_c=X0+"?",Mc="["+hc+"]?",D0="(?:"+vc+"(?:"+[yc,_o,Mo].join("|")+")"+Mc+_c+")*",z0="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",O0="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Lc=Mc+_c+D0,K0="(?:"+[F0,_o,Mo].join("|")+")"+Lc,R0="(?:"+[yc+ki+"?",ki,_o,Mo,A0].join("|")+")",Y0=RegExp(bo,"g"),U0=RegExp(ki,"g"),Lo=RegExp(xo+"(?="+xo+")|"+R0+Lc,"g"),B0=RegExp([vr+"?"+mc+"+"+bc+"(?="+[fc,vr,"$"].join("|")+")",k0+"+"+xc+"(?="+[fc,vr+wc,"$"].join("|")+")",vr+"?"+wc+"+"+bc,vr+"+"+xc,O0,z0,pc,K0].join("|"),"g"),N0=RegExp("["+vc+Xi+ac+hc+"]"),j0=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,J0=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Q0=-1,Ce={};Ce[Jr]=Ce[Qr]=Ce[mr]=Ce[Hr]=Ce[Er]=Ce[gr]=Ce[Qn]=Ce[X]=Ce[E]=!0,Ce[Ye]=Ce[je]=Ce[Wn]=Ce[Qe]=Ce[sn]=Ce[ct]=Ce[Ue]=Ce[hn]=Ce[Ae]=Ce[Ut]=Ce[Pt]=Ce[Nn]=Ce[bt]=Ce[Zn]=Ce[Jn]=!1;var We={};We[Ye]=We[je]=We[Wn]=We[sn]=We[Qe]=We[ct]=We[Jr]=We[Qr]=We[mr]=We[Hr]=We[Er]=We[Ae]=We[Ut]=We[Pt]=We[Nn]=We[bt]=We[Zn]=We[In]=We[gr]=We[Qn]=We[X]=We[E]=!0,We[Ue]=We[hn]=We[Jn]=!1;var H0={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",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"',"'":"'"},$0={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},eg=parseFloat,tg=parseInt,Sc=typeof Yr=="object"&&Yr&&Yr.Object===Object&&Yr,ng=typeof self=="object"&&self&&self.Object===Object&&self,nt=Sc||ng||Function("return this")(),So=t&&!t.nodeType&&t,qn=So&&!0&&a&&!a.nodeType&&a,Tc=qn&&qn.exports===So,To=Tc&&Sc.process,Vt=function(){try{var C=qn&&qn.require&&qn.require("util").types;return C||To&&To.binding&&To.binding("util")}catch{}}(),Gc=Vt&&Vt.isArrayBuffer,Zc=Vt&&Vt.isDate,Ic=Vt&&Vt.isMap,Wc=Vt&&Vt.isRegExp,Pc=Vt&&Vt.isSet,Cc=Vt&&Vt.isTypedArray;function xt(C,Y,z){switch(z.length){case 0:return C.call(Y);case 1:return C.call(Y,z[0]);case 2:return C.call(Y,z[0],z[1]);case 3:return C.call(Y,z[0],z[1],z[2])}return C.apply(Y,z)}function rg(C,Y,z,ne){for(var de=-1,Te=C==null?0:C.length;++de<Te;){var Be=C[de];Y(ne,Be,z(Be),C)}return ne}function At(C,Y){for(var z=-1,ne=C==null?0:C.length;++z<ne&&Y(C[z],z,C)!==!1;);return C}function ig(C,Y){for(var z=C==null?0:C.length;z--&&Y(C[z],z,C)!==!1;);return C}function Vc(C,Y){for(var z=-1,ne=C==null?0:C.length;++z<ne;)if(!Y(C[z],z,C))return!1;return!0}function Cn(C,Y){for(var z=-1,ne=C==null?0:C.length,de=0,Te=[];++z<ne;){var Be=C[z];Y(Be,z,C)&&(Te[de++]=Be)}return Te}function Di(C,Y){var z=C==null?0:C.length;return!!z&&wr(C,Y,0)>-1}function Go(C,Y,z){for(var ne=-1,de=C==null?0:C.length;++ne<de;)if(z(Y,C[ne]))return!0;return!1}function Ve(C,Y){for(var z=-1,ne=C==null?0:C.length,de=Array(ne);++z<ne;)de[z]=Y(C[z],z,C);return de}function Vn(C,Y){for(var z=-1,ne=Y.length,de=C.length;++z<ne;)C[de+z]=Y[z];return C}function Zo(C,Y,z,ne){var de=-1,Te=C==null?0:C.length;for(ne&&Te&&(z=C[++de]);++de<Te;)z=Y(z,C[de],de,C);return z}function sg(C,Y,z,ne){var de=C==null?0:C.length;for(ne&&de&&(z=C[--de]);de--;)z=Y(z,C[de],de,C);return z}function Io(C,Y){for(var z=-1,ne=C==null?0:C.length;++z<ne;)if(Y(C[z],z,C))return!0;return!1}var og=Wo("length");function ag(C){return C.split("")}function lg(C){return C.match(g0)||[]}function Ac(C,Y,z){var ne;return z(C,function(de,Te,Be){if(Y(de,Te,Be))return ne=Te,!1}),ne}function zi(C,Y,z,ne){for(var de=C.length,Te=z+(ne?1:-1);ne?Te--:++Te<de;)if(Y(C[Te],Te,C))return Te;return-1}function wr(C,Y,z){return Y===Y?bg(C,Y,z):zi(C,Fc,z)}function cg(C,Y,z,ne){for(var de=z-1,Te=C.length;++de<Te;)if(ne(C[de],Y))return de;return-1}function Fc(C){return C!==C}function Xc(C,Y){var z=C==null?0:C.length;return z?Co(C,Y)/z:me}function Wo(C){return function(Y){return Y==null?e:Y[C]}}function Po(C){return function(Y){return C==null?e:C[Y]}}function kc(C,Y,z,ne,de){return de(C,function(Te,Be,Ie){z=ne?(ne=!1,Te):Y(z,Te,Be,Ie)}),z}function ug(C,Y){var z=C.length;for(C.sort(Y);z--;)C[z]=C[z].value;return C}function Co(C,Y){for(var z,ne=-1,de=C.length;++ne<de;){var Te=Y(C[ne]);Te!==e&&(z=z===e?Te:z+Te)}return z}function Vo(C,Y){for(var z=-1,ne=Array(C);++z<C;)ne[z]=Y(z);return ne}function hg(C,Y){return Ve(Y,function(z){return[z,C[z]]})}function Dc(C){return C&&C.slice(0,Rc(C)+1).replace(wo,"")}function _t(C){return function(Y){return C(Y)}}function Ao(C,Y){return Ve(Y,function(z){return C[z]})}function qr(C,Y){return C.has(Y)}function zc(C,Y){for(var z=-1,ne=C.length;++z<ne&&wr(Y,C[z],0)>-1;);return z}function Oc(C,Y){for(var z=C.length;z--&&wr(Y,C[z],0)>-1;);return z}function dg(C,Y){for(var z=C.length,ne=0;z--;)C[z]===Y&&++ne;return ne}var fg=Po(H0),pg=Po(E0);function mg(C){return"\\"+$0[C]}function gg(C,Y){return C==null?e:C[Y]}function br(C){return N0.test(C)}function yg(C){return j0.test(C)}function vg(C){for(var Y,z=[];!(Y=C.next()).done;)z.push(Y.value);return z}function Fo(C){var Y=-1,z=Array(C.size);return C.forEach(function(ne,de){z[++Y]=[de,ne]}),z}function Kc(C,Y){return function(z){return C(Y(z))}}function An(C,Y){for(var z=-1,ne=C.length,de=0,Te=[];++z<ne;){var Be=C[z];(Be===Y||Be===p)&&(C[z]=p,Te[de++]=z)}return Te}function Oi(C){var Y=-1,z=Array(C.size);return C.forEach(function(ne){z[++Y]=ne}),z}function wg(C){var Y=-1,z=Array(C.size);return C.forEach(function(ne){z[++Y]=[ne,ne]}),z}function bg(C,Y,z){for(var ne=z-1,de=C.length;++ne<de;)if(C[ne]===Y)return ne;return-1}function xg(C,Y,z){for(var ne=z+1;ne--;)if(C[ne]===Y)return ne;return ne}function xr(C){return br(C)?Mg(C):og(C)}function Jt(C){return br(C)?Lg(C):ag(C)}function Rc(C){for(var Y=C.length;Y--&&d0.test(C.charAt(Y)););return Y}var _g=Po(q0);function Mg(C){for(var Y=Lo.lastIndex=0;Lo.test(C);)++Y;return Y}function Lg(C){return C.match(Lo)||[]}function Sg(C){return C.match(B0)||[]}var Tg=function C(Y){Y=Y==null?nt:_r.defaults(nt.Object(),Y,_r.pick(nt,J0));var z=Y.Array,ne=Y.Date,de=Y.Error,Te=Y.Function,Be=Y.Math,Ie=Y.Object,Xo=Y.RegExp,Gg=Y.String,Ft=Y.TypeError,Ki=z.prototype,Zg=Te.prototype,Mr=Ie.prototype,Ri=Y["__core-js_shared__"],Yi=Zg.toString,Ze=Mr.hasOwnProperty,Ig=0,Yc=function(){var i=/[^.]+$/.exec(Ri&&Ri.keys&&Ri.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""}(),Ui=Mr.toString,Wg=Yi.call(Ie),Pg=nt._,Cg=Xo("^"+Yi.call(Ze).replace(vo,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Bi=Tc?Y.Buffer:e,Fn=Y.Symbol,Ni=Y.Uint8Array,Uc=Bi?Bi.allocUnsafe:e,ji=Kc(Ie.getPrototypeOf,Ie),Bc=Ie.create,Nc=Mr.propertyIsEnumerable,Ji=Ki.splice,jc=Fn?Fn.isConcatSpreadable:e,$r=Fn?Fn.iterator:e,$n=Fn?Fn.toStringTag:e,Qi=function(){try{var i=ir(Ie,"defineProperty");return i({},"",{}),i}catch{}}(),Vg=Y.clearTimeout!==nt.clearTimeout&&Y.clearTimeout,Ag=ne&&ne.now!==nt.Date.now&&ne.now,Fg=Y.setTimeout!==nt.setTimeout&&Y.setTimeout,Hi=Be.ceil,Ei=Be.floor,ko=Ie.getOwnPropertySymbols,Xg=Bi?Bi.isBuffer:e,Jc=Y.isFinite,kg=Ki.join,Dg=Kc(Ie.keys,Ie),Ne=Be.max,st=Be.min,zg=ne.now,Og=Y.parseInt,Qc=Be.random,Kg=Ki.reverse,Do=ir(Y,"DataView"),ei=ir(Y,"Map"),zo=ir(Y,"Promise"),Lr=ir(Y,"Set"),ti=ir(Y,"WeakMap"),ni=ir(Ie,"create"),qi=ti&&new ti,Sr={},Rg=sr(Do),Yg=sr(ei),Ug=sr(zo),Bg=sr(Lr),Ng=sr(ti),$i=Fn?Fn.prototype:e,ri=$i?$i.valueOf:e,Hc=$i?$i.toString:e;function x(i){if(De(i)&&!fe(i)&&!(i instanceof Me)){if(i instanceof Xt)return i;if(Ze.call(i,"__wrapped__"))return Eu(i)}return new Xt(i)}var Tr=function(){function i(){}return function(o){if(!Fe(o))return{};if(Bc)return Bc(o);i.prototype=o;var h=new i;return i.prototype=e,h}}();function es(){}function Xt(i,o){this.__wrapped__=i,this.__actions__=[],this.__chain__=!!o,this.__index__=0,this.__values__=e}x.templateSettings={escape:Nt,evaluate:jt,interpolate:Pn,variable:"",imports:{_:x}},x.prototype=es.prototype,x.prototype.constructor=x,Xt.prototype=Tr(es.prototype),Xt.prototype.constructor=Xt;function Me(i){this.__wrapped__=i,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=xe,this.__views__=[]}function jg(){var i=new Me(this.__wrapped__);return i.__actions__=mt(this.__actions__),i.__dir__=this.__dir__,i.__filtered__=this.__filtered__,i.__iteratees__=mt(this.__iteratees__),i.__takeCount__=this.__takeCount__,i.__views__=mt(this.__views__),i}function Jg(){if(this.__filtered__){var i=new Me(this);i.__dir__=-1,i.__filtered__=!0}else i=this.clone(),i.__dir__*=-1;return i}function Qg(){var i=this.__wrapped__.value(),o=this.__dir__,h=fe(i),g=o<0,w=h?i.length:0,M=a1(0,w,this.__views__),Z=M.start,W=M.end,A=W-Z,U=g?W:Z-1,B=this.__iteratees__,j=B.length,$=0,re=st(A,this.__takeCount__);if(!h||!g&&w==A&&re==A)return bu(i,this.__actions__);var le=[];e:for(;A--&&$<re;){U+=o;for(var ge=-1,ce=i[U];++ge<j;){var _e=B[ge],Le=_e.iteratee,St=_e.type,dt=Le(ce);if(St==q)ce=dt;else if(!dt){if(St==Q)continue e;break e}}le[$++]=ce}return le}Me.prototype=Tr(es.prototype),Me.prototype.constructor=Me;function er(i){var o=-1,h=i==null?0:i.length;for(this.clear();++o<h;){var g=i[o];this.set(g[0],g[1])}}function Hg(){this.__data__=ni?ni(null):{},this.size=0}function Eg(i){var o=this.has(i)&&delete this.__data__[i];return this.size-=o?1:0,o}function qg(i){var o=this.__data__;if(ni){var h=o[i];return h===u?e:h}return Ze.call(o,i)?o[i]:e}function $g(i){var o=this.__data__;return ni?o[i]!==e:Ze.call(o,i)}function ey(i,o){var h=this.__data__;return this.size+=this.has(i)?0:1,h[i]=ni&&o===e?u:o,this}er.prototype.clear=Hg,er.prototype.delete=Eg,er.prototype.get=qg,er.prototype.has=$g,er.prototype.set=ey;function dn(i){var o=-1,h=i==null?0:i.length;for(this.clear();++o<h;){var g=i[o];this.set(g[0],g[1])}}function ty(){this.__data__=[],this.size=0}function ny(i){var o=this.__data__,h=ts(o,i);if(h<0)return!1;var g=o.length-1;return h==g?o.pop():Ji.call(o,h,1),--this.size,!0}function ry(i){var o=this.__data__,h=ts(o,i);return h<0?e:o[h][1]}function iy(i){return ts(this.__data__,i)>-1}function sy(i,o){var h=this.__data__,g=ts(h,i);return g<0?(++this.size,h.push([i,o])):h[g][1]=o,this}dn.prototype.clear=ty,dn.prototype.delete=ny,dn.prototype.get=ry,dn.prototype.has=iy,dn.prototype.set=sy;function fn(i){var o=-1,h=i==null?0:i.length;for(this.clear();++o<h;){var g=i[o];this.set(g[0],g[1])}}function oy(){this.size=0,this.__data__={hash:new er,map:new(ei||dn),string:new er}}function ay(i){var o=fs(this,i).delete(i);return this.size-=o?1:0,o}function ly(i){return fs(this,i).get(i)}function cy(i){return fs(this,i).has(i)}function uy(i,o){var h=fs(this,i),g=h.size;return h.set(i,o),this.size+=h.size==g?0:1,this}fn.prototype.clear=oy,fn.prototype.delete=ay,fn.prototype.get=ly,fn.prototype.has=cy,fn.prototype.set=uy;function tr(i){var o=-1,h=i==null?0:i.length;for(this.__data__=new fn;++o<h;)this.add(i[o])}function hy(i){return this.__data__.set(i,u),this}function dy(i){return this.__data__.has(i)}tr.prototype.add=tr.prototype.push=hy,tr.prototype.has=dy;function Qt(i){var o=this.__data__=new dn(i);this.size=o.size}function fy(){this.__data__=new dn,this.size=0}function py(i){var o=this.__data__,h=o.delete(i);return this.size=o.size,h}function my(i){return this.__data__.get(i)}function gy(i){return this.__data__.has(i)}function yy(i,o){var h=this.__data__;if(h instanceof dn){var g=h.__data__;if(!ei||g.length<r-1)return g.push([i,o]),this.size=++h.size,this;h=this.__data__=new fn(g)}return h.set(i,o),this.size=h.size,this}Qt.prototype.clear=fy,Qt.prototype.delete=py,Qt.prototype.get=my,Qt.prototype.has=gy,Qt.prototype.set=yy;function Ec(i,o){var h=fe(i),g=!h&&or(i),w=!h&&!g&&On(i),M=!h&&!g&&!w&&Wr(i),Z=h||g||w||M,W=Z?Vo(i.length,Gg):[],A=W.length;for(var U in i)(o||Ze.call(i,U))&&!(Z&&(U=="length"||w&&(U=="offset"||U=="parent")||M&&(U=="buffer"||U=="byteLength"||U=="byteOffset")||yn(U,A)))&&W.push(U);return W}function qc(i){var o=i.length;return o?i[Ho(0,o-1)]:e}function vy(i,o){return ps(mt(i),nr(o,0,i.length))}function wy(i){return ps(mt(i))}function Oo(i,o,h){(h!==e&&!Ht(i[o],h)||h===e&&!(o in i))&&pn(i,o,h)}function ii(i,o,h){var g=i[o];(!(Ze.call(i,o)&&Ht(g,h))||h===e&&!(o in i))&&pn(i,o,h)}function ts(i,o){for(var h=i.length;h--;)if(Ht(i[h][0],o))return h;return-1}function by(i,o,h,g){return Xn(i,function(w,M,Z){o(g,w,h(w),Z)}),g}function $c(i,o){return i&&an(o,He(o),i)}function xy(i,o){return i&&an(o,yt(o),i)}function pn(i,o,h){o=="__proto__"&&Qi?Qi(i,o,{configurable:!0,enumerable:!0,value:h,writable:!0}):i[o]=h}function Ko(i,o){for(var h=-1,g=o.length,w=z(g),M=i==null;++h<g;)w[h]=M?e:xa(i,o[h]);return w}function nr(i,o,h){return i===i&&(h!==e&&(i=i<=h?i:h),o!==e&&(i=i>=o?i:o)),i}function kt(i,o,h,g,w,M){var Z,W=o&f,A=o&y,U=o&v;if(h&&(Z=w?h(i,g,w,M):h(i)),Z!==e)return Z;if(!Fe(i))return i;var B=fe(i);if(B){if(Z=c1(i),!W)return mt(i,Z)}else{var j=ot(i),$=j==hn||j==Gn;if(On(i))return Mu(i,W);if(j==Pt||j==Ye||$&&!w){if(Z=A||$?{}:Ru(i),!W)return A?qy(i,xy(Z,i)):Ey(i,$c(Z,i))}else{if(!We[j])return w?i:{};Z=u1(i,j,W)}}M||(M=new Qt);var re=M.get(i);if(re)return re;M.set(i,Z),yh(i)?i.forEach(function(ce){Z.add(kt(ce,o,h,ce,i,M))}):mh(i)&&i.forEach(function(ce,_e){Z.set(_e,kt(ce,o,h,_e,i,M))});var le=U?A?aa:oa:A?yt:He,ge=B?e:le(i);return At(ge||i,function(ce,_e){ge&&(_e=ce,ce=i[_e]),ii(Z,_e,kt(ce,o,h,_e,i,M))}),Z}function _y(i){var o=He(i);return function(h){return eu(h,i,o)}}function eu(i,o,h){var g=h.length;if(i==null)return!g;for(i=Ie(i);g--;){var w=h[g],M=o[w],Z=i[w];if(Z===e&&!(w in i)||!M(Z))return!1}return!0}function tu(i,o,h){if(typeof i!="function")throw new Ft(l);return hi(function(){i.apply(e,h)},o)}function si(i,o,h,g){var w=-1,M=Di,Z=!0,W=i.length,A=[],U=o.length;if(!W)return A;h&&(o=Ve(o,_t(h))),g?(M=Go,Z=!1):o.length>=r&&(M=qr,Z=!1,o=new tr(o));e:for(;++w<W;){var B=i[w],j=h==null?B:h(B);if(B=g||B!==0?B:0,Z&&j===j){for(var $=U;$--;)if(o[$]===j)continue e;A.push(B)}else M(o,j,g)||A.push(B)}return A}var Xn=Zu(on),nu=Zu(Yo,!0);function My(i,o){var h=!0;return Xn(i,function(g,w,M){return h=!!o(g,w,M),h}),h}function ns(i,o,h){for(var g=-1,w=i.length;++g<w;){var M=i[g],Z=o(M);if(Z!=null&&(W===e?Z===Z&&!Lt(Z):h(Z,W)))var W=Z,A=M}return A}function Ly(i,o,h,g){var w=i.length;for(h=pe(h),h<0&&(h=-h>w?0:w+h),g=g===e||g>w?w:pe(g),g<0&&(g+=w),g=h>g?0:wh(g);h<g;)i[h++]=o;return i}function ru(i,o){var h=[];return Xn(i,function(g,w,M){o(g,w,M)&&h.push(g)}),h}function rt(i,o,h,g,w){var M=-1,Z=i.length;for(h||(h=d1),w||(w=[]);++M<Z;){var W=i[M];o>0&&h(W)?o>1?rt(W,o-1,h,g,w):Vn(w,W):g||(w[w.length]=W)}return w}var Ro=Iu(),iu=Iu(!0);function on(i,o){return i&&Ro(i,o,He)}function Yo(i,o){return i&&iu(i,o,He)}function rs(i,o){return Cn(o,function(h){return vn(i[h])})}function rr(i,o){o=Dn(o,i);for(var h=0,g=o.length;i!=null&&h<g;)i=i[ln(o[h++])];return h&&h==g?i:e}function su(i,o,h){var g=o(i);return fe(i)?g:Vn(g,h(i))}function ut(i){return i==null?i===e?jn:Wt:$n&&$n in Ie(i)?o1(i):w1(i)}function Uo(i,o){return i>o}function Sy(i,o){return i!=null&&Ze.call(i,o)}function Ty(i,o){return i!=null&&o in Ie(i)}function Gy(i,o,h){return i>=st(o,h)&&i<Ne(o,h)}function Bo(i,o,h){for(var g=h?Go:Di,w=i[0].length,M=i.length,Z=M,W=z(M),A=1/0,U=[];Z--;){var B=i[Z];Z&&o&&(B=Ve(B,_t(o))),A=st(B.length,A),W[Z]=!h&&(o||w>=120&&B.length>=120)?new tr(Z&&B):e}B=i[0];var j=-1,$=W[0];e:for(;++j<w&&U.length<A;){var re=B[j],le=o?o(re):re;if(re=h||re!==0?re:0,!($?qr($,le):g(U,le,h))){for(Z=M;--Z;){var ge=W[Z];if(!(ge?qr(ge,le):g(i[Z],le,h)))continue e}$&&$.push(le),U.push(re)}}return U}function Zy(i,o,h,g){return on(i,function(w,M,Z){o(g,h(w),M,Z)}),g}function oi(i,o,h){o=Dn(o,i),i=Nu(i,o);var g=i==null?i:i[ln(zt(o))];return g==null?e:xt(g,i,h)}function ou(i){return De(i)&&ut(i)==Ye}function Iy(i){return De(i)&&ut(i)==Wn}function Wy(i){return De(i)&&ut(i)==ct}function ai(i,o,h,g,w){return i===o?!0:i==null||o==null||!De(i)&&!De(o)?i!==i&&o!==o:Py(i,o,h,g,ai,w)}function Py(i,o,h,g,w,M){var Z=fe(i),W=fe(o),A=Z?je:ot(i),U=W?je:ot(o);A=A==Ye?Pt:A,U=U==Ye?Pt:U;var B=A==Pt,j=U==Pt,$=A==U;if($&&On(i)){if(!On(o))return!1;Z=!0,B=!1}if($&&!B)return M||(M=new Qt),Z||Wr(i)?zu(i,o,h,g,w,M):i1(i,o,A,h,g,w,M);if(!(h&b)){var re=B&&Ze.call(i,"__wrapped__"),le=j&&Ze.call(o,"__wrapped__");if(re||le){var ge=re?i.value():i,ce=le?o.value():o;return M||(M=new Qt),w(ge,ce,h,g,M)}}return $?(M||(M=new Qt),s1(i,o,h,g,w,M)):!1}function Cy(i){return De(i)&&ot(i)==Ae}function No(i,o,h,g){var w=h.length,M=w,Z=!g;if(i==null)return!M;for(i=Ie(i);w--;){var W=h[w];if(Z&&W[2]?W[1]!==i[W[0]]:!(W[0]in i))return!1}for(;++w<M;){W=h[w];var A=W[0],U=i[A],B=W[1];if(Z&&W[2]){if(U===e&&!(A in i))return!1}else{var j=new Qt;if(g)var $=g(U,B,A,i,o,j);if(!($===e?ai(B,U,b|T,g,j):$))return!1}}return!0}function au(i){if(!Fe(i)||p1(i))return!1;var o=vn(i)?Cg:_0;return o.test(sr(i))}function Vy(i){return De(i)&&ut(i)==Nn}function Ay(i){return De(i)&&ot(i)==bt}function Fy(i){return De(i)&&bs(i.length)&&!!Ce[ut(i)]}function lu(i){return typeof i=="function"?i:i==null?vt:typeof i=="object"?fe(i)?hu(i[0],i[1]):uu(i):Wh(i)}function jo(i){if(!ui(i))return Dg(i);var o=[];for(var h in Ie(i))Ze.call(i,h)&&h!="constructor"&&o.push(h);return o}function Xy(i){if(!Fe(i))return v1(i);var o=ui(i),h=[];for(var g in i)g=="constructor"&&(o||!Ze.call(i,g))||h.push(g);return h}function Jo(i,o){return i<o}function cu(i,o){var h=-1,g=gt(i)?z(i.length):[];return Xn(i,function(w,M,Z){g[++h]=o(w,M,Z)}),g}function uu(i){var o=ca(i);return o.length==1&&o[0][2]?Uu(o[0][0],o[0][1]):function(h){return h===i||No(h,i,o)}}function hu(i,o){return ha(i)&&Yu(o)?Uu(ln(i),o):function(h){var g=xa(h,i);return g===e&&g===o?_a(h,i):ai(o,g,b|T)}}function is(i,o,h,g,w){i!==o&&Ro(o,function(M,Z){if(w||(w=new Qt),Fe(M))ky(i,o,Z,h,is,g,w);else{var W=g?g(fa(i,Z),M,Z+"",i,o,w):e;W===e&&(W=M),Oo(i,Z,W)}},yt)}function ky(i,o,h,g,w,M,Z){var W=fa(i,h),A=fa(o,h),U=Z.get(A);if(U){Oo(i,h,U);return}var B=M?M(W,A,h+"",i,o,Z):e,j=B===e;if(j){var $=fe(A),re=!$&&On(A),le=!$&&!re&&Wr(A);B=A,$||re||le?fe(W)?B=W:Oe(W)?B=mt(W):re?(j=!1,B=Mu(A,!0)):le?(j=!1,B=Lu(A,!0)):B=[]:di(A)||or(A)?(B=W,or(W)?B=bh(W):(!Fe(W)||vn(W))&&(B=Ru(A))):j=!1}j&&(Z.set(A,B),w(B,A,g,M,Z),Z.delete(A)),Oo(i,h,B)}function du(i,o){var h=i.length;if(h)return o+=o<0?h:0,yn(o,h)?i[o]:e}function fu(i,o,h){o.length?o=Ve(o,function(M){return fe(M)?function(Z){return rr(Z,M.length===1?M[0]:M)}:M}):o=[vt];var g=-1;o=Ve(o,_t(ae()));var w=cu(i,function(M,Z,W){var A=Ve(o,function(U){return U(M)});return{criteria:A,index:++g,value:M}});return ug(w,function(M,Z){return Hy(M,Z,h)})}function Dy(i,o){return pu(i,o,function(h,g){return _a(i,g)})}function pu(i,o,h){for(var g=-1,w=o.length,M={};++g<w;){var Z=o[g],W=rr(i,Z);h(W,Z)&&li(M,Dn(Z,i),W)}return M}function zy(i){return function(o){return rr(o,i)}}function Qo(i,o,h,g){var w=g?cg:wr,M=-1,Z=o.length,W=i;for(i===o&&(o=mt(o)),h&&(W=Ve(i,_t(h)));++M<Z;)for(var A=0,U=o[M],B=h?h(U):U;(A=w(W,B,A,g))>-1;)W!==i&&Ji.call(W,A,1),Ji.call(i,A,1);return i}function mu(i,o){for(var h=i?o.length:0,g=h-1;h--;){var w=o[h];if(h==g||w!==M){var M=w;yn(w)?Ji.call(i,w,1):$o(i,w)}}return i}function Ho(i,o){return i+Ei(Qc()*(o-i+1))}function Oy(i,o,h,g){for(var w=-1,M=Ne(Hi((o-i)/(h||1)),0),Z=z(M);M--;)Z[g?M:++w]=i,i+=h;return Z}function Eo(i,o){var h="";if(!i||o<1||o>ie)return h;do o%2&&(h+=i),o=Ei(o/2),o&&(i+=i);while(o);return h}function ye(i,o){return pa(Bu(i,o,vt),i+"")}function Ky(i){return qc(Pr(i))}function Ry(i,o){var h=Pr(i);return ps(h,nr(o,0,h.length))}function li(i,o,h,g){if(!Fe(i))return i;o=Dn(o,i);for(var w=-1,M=o.length,Z=M-1,W=i;W!=null&&++w<M;){var A=ln(o[w]),U=h;if(A==="__proto__"||A==="constructor"||A==="prototype")return i;if(w!=Z){var B=W[A];U=g?g(B,A,W):e,U===e&&(U=Fe(B)?B:yn(o[w+1])?[]:{})}ii(W,A,U),W=W[A]}return i}var gu=qi?function(i,o){return qi.set(i,o),i}:vt,Yy=Qi?function(i,o){return Qi(i,"toString",{configurable:!0,enumerable:!1,value:La(o),writable:!0})}:vt;function Uy(i){return ps(Pr(i))}function Dt(i,o,h){var g=-1,w=i.length;o<0&&(o=-o>w?0:w+o),h=h>w?w:h,h<0&&(h+=w),w=o>h?0:h-o>>>0,o>>>=0;for(var M=z(w);++g<w;)M[g]=i[g+o];return M}function By(i,o){var h;return Xn(i,function(g,w,M){return h=o(g,w,M),!h}),!!h}function ss(i,o,h){var g=0,w=i==null?g:i.length;if(typeof o=="number"&&o===o&&w<=ve){for(;g<w;){var M=g+w>>>1,Z=i[M];Z!==null&&!Lt(Z)&&(h?Z<=o:Z<o)?g=M+1:w=M}return w}return qo(i,o,vt,h)}function qo(i,o,h,g){var w=0,M=i==null?0:i.length;if(M===0)return 0;o=h(o);for(var Z=o!==o,W=o===null,A=Lt(o),U=o===e;w<M;){var B=Ei((w+M)/2),j=h(i[B]),$=j!==e,re=j===null,le=j===j,ge=Lt(j);if(Z)var ce=g||le;else U?ce=le&&(g||$):W?ce=le&&$&&(g||!re):A?ce=le&&$&&!re&&(g||!ge):re||ge?ce=!1:ce=g?j<=o:j<o;ce?w=B+1:M=B}return st(M,he)}function yu(i,o){for(var h=-1,g=i.length,w=0,M=[];++h<g;){var Z=i[h],W=o?o(Z):Z;if(!h||!Ht(W,A)){var A=W;M[w++]=Z===0?0:Z}}return M}function vu(i){return typeof i=="number"?i:Lt(i)?me:+i}function Mt(i){if(typeof i=="string")return i;if(fe(i))return Ve(i,Mt)+"";if(Lt(i))return Hc?Hc.call(i):"";var o=i+"";return o=="0"&&1/i==-oe?"-0":o}function kn(i,o,h){var g=-1,w=Di,M=i.length,Z=!0,W=[],A=W;if(h)Z=!1,w=Go;else if(M>=r){var U=o?null:n1(i);if(U)return Oi(U);Z=!1,w=qr,A=new tr}else A=o?[]:W;e:for(;++g<M;){var B=i[g],j=o?o(B):B;if(B=h||B!==0?B:0,Z&&j===j){for(var $=A.length;$--;)if(A[$]===j)continue e;o&&A.push(j),W.push(B)}else w(A,j,h)||(A!==W&&A.push(j),W.push(B))}return W}function $o(i,o){return o=Dn(o,i),i=Nu(i,o),i==null||delete i[ln(zt(o))]}function wu(i,o,h,g){return li(i,o,h(rr(i,o)),g)}function os(i,o,h,g){for(var w=i.length,M=g?w:-1;(g?M--:++M<w)&&o(i[M],M,i););return h?Dt(i,g?0:M,g?M+1:w):Dt(i,g?M+1:0,g?w:M)}function bu(i,o){var h=i;return h instanceof Me&&(h=h.value()),Zo(o,function(g,w){return w.func.apply(w.thisArg,Vn([g],w.args))},h)}function ea(i,o,h){var g=i.length;if(g<2)return g?kn(i[0]):[];for(var w=-1,M=z(g);++w<g;)for(var Z=i[w],W=-1;++W<g;)W!=w&&(M[w]=si(M[w]||Z,i[W],o,h));return kn(rt(M,1),o,h)}function xu(i,o,h){for(var g=-1,w=i.length,M=o.length,Z={};++g<w;){var W=g<M?o[g]:e;h(Z,i[g],W)}return Z}function ta(i){return Oe(i)?i:[]}function na(i){return typeof i=="function"?i:vt}function Dn(i,o){return fe(i)?i:ha(i,o)?[i]:Hu(Ge(i))}var Ny=ye;function zn(i,o,h){var g=i.length;return h=h===e?g:h,!o&&h>=g?i:Dt(i,o,h)}var _u=Vg||function(i){return nt.clearTimeout(i)};function Mu(i,o){if(o)return i.slice();var h=i.length,g=Uc?Uc(h):new i.constructor(h);return i.copy(g),g}function ra(i){var o=new i.constructor(i.byteLength);return new Ni(o).set(new Ni(i)),o}function jy(i,o){var h=o?ra(i.buffer):i.buffer;return new i.constructor(h,i.byteOffset,i.byteLength)}function Jy(i){var o=new i.constructor(i.source,oc.exec(i));return o.lastIndex=i.lastIndex,o}function Qy(i){return ri?Ie(ri.call(i)):{}}function Lu(i,o){var h=o?ra(i.buffer):i.buffer;return new i.constructor(h,i.byteOffset,i.length)}function Su(i,o){if(i!==o){var h=i!==e,g=i===null,w=i===i,M=Lt(i),Z=o!==e,W=o===null,A=o===o,U=Lt(o);if(!W&&!U&&!M&&i>o||M&&Z&&A&&!W&&!U||g&&Z&&A||!h&&A||!w)return 1;if(!g&&!M&&!U&&i<o||U&&h&&w&&!g&&!M||W&&h&&w||!Z&&w||!A)return-1}return 0}function Hy(i,o,h){for(var g=-1,w=i.criteria,M=o.criteria,Z=w.length,W=h.length;++g<Z;){var A=Su(w[g],M[g]);if(A){if(g>=W)return A;var U=h[g];return A*(U=="desc"?-1:1)}}return i.index-o.index}function Tu(i,o,h,g){for(var w=-1,M=i.length,Z=h.length,W=-1,A=o.length,U=Ne(M-Z,0),B=z(A+U),j=!g;++W<A;)B[W]=o[W];for(;++w<Z;)(j||w<M)&&(B[h[w]]=i[w]);for(;U--;)B[W++]=i[w++];return B}function Gu(i,o,h,g){for(var w=-1,M=i.length,Z=-1,W=h.length,A=-1,U=o.length,B=Ne(M-W,0),j=z(B+U),$=!g;++w<B;)j[w]=i[w];for(var re=w;++A<U;)j[re+A]=o[A];for(;++Z<W;)($||w<M)&&(j[re+h[Z]]=i[w++]);return j}function mt(i,o){var h=-1,g=i.length;for(o||(o=z(g));++h<g;)o[h]=i[h];return o}function an(i,o,h,g){var w=!h;h||(h={});for(var M=-1,Z=o.length;++M<Z;){var W=o[M],A=g?g(h[W],i[W],W,h,i):e;A===e&&(A=i[W]),w?pn(h,W,A):ii(h,W,A)}return h}function Ey(i,o){return an(i,ua(i),o)}function qy(i,o){return an(i,Ou(i),o)}function as(i,o){return function(h,g){var w=fe(h)?rg:by,M=o?o():{};return w(h,i,ae(g,2),M)}}function Gr(i){return ye(function(o,h){var g=-1,w=h.length,M=w>1?h[w-1]:e,Z=w>2?h[2]:e;for(M=i.length>3&&typeof M=="function"?(w--,M):e,Z&&ht(h[0],h[1],Z)&&(M=w<3?e:M,w=1),o=Ie(o);++g<w;){var W=h[g];W&&i(o,W,g,M)}return o})}function Zu(i,o){return function(h,g){if(h==null)return h;if(!gt(h))return i(h,g);for(var w=h.length,M=o?w:-1,Z=Ie(h);(o?M--:++M<w)&&g(Z[M],M,Z)!==!1;);return h}}function Iu(i){return function(o,h,g){for(var w=-1,M=Ie(o),Z=g(o),W=Z.length;W--;){var A=Z[i?W:++w];if(h(M[A],A,M)===!1)break}return o}}function $y(i,o,h){var g=o&_,w=ci(i);function M(){var Z=this&&this!==nt&&this instanceof M?w:i;return Z.apply(g?h:this,arguments)}return M}function Wu(i){return function(o){o=Ge(o);var h=br(o)?Jt(o):e,g=h?h[0]:o.charAt(0),w=h?zn(h,1).join(""):o.slice(1);return g[i]()+w}}function Zr(i){return function(o){return Zo(Zh(Gh(o).replace(Y0,"")),i,"")}}function ci(i){return function(){var o=arguments;switch(o.length){case 0:return new i;case 1:return new i(o[0]);case 2:return new i(o[0],o[1]);case 3:return new i(o[0],o[1],o[2]);case 4:return new i(o[0],o[1],o[2],o[3]);case 5:return new i(o[0],o[1],o[2],o[3],o[4]);case 6:return new i(o[0],o[1],o[2],o[3],o[4],o[5]);case 7:return new i(o[0],o[1],o[2],o[3],o[4],o[5],o[6])}var h=Tr(i.prototype),g=i.apply(h,o);return Fe(g)?g:h}}function e1(i,o,h){var g=ci(i);function w(){for(var M=arguments.length,Z=z(M),W=M,A=Ir(w);W--;)Z[W]=arguments[W];var U=M<3&&Z[0]!==A&&Z[M-1]!==A?[]:An(Z,A);if(M-=U.length,M<h)return Fu(i,o,ls,w.placeholder,e,Z,U,e,e,h-M);var B=this&&this!==nt&&this instanceof w?g:i;return xt(B,this,Z)}return w}function Pu(i){return function(o,h,g){var w=Ie(o);if(!gt(o)){var M=ae(h,3);o=He(o),h=function(W){return M(w[W],W,w)}}var Z=i(o,h,g);return Z>-1?w[M?o[Z]:Z]:e}}function Cu(i){return gn(function(o){var h=o.length,g=h,w=Xt.prototype.thru;for(i&&o.reverse();g--;){var M=o[g];if(typeof M!="function")throw new Ft(l);if(w&&!Z&&ds(M)=="wrapper")var Z=new Xt([],!0)}for(g=Z?g:h;++g<h;){M=o[g];var W=ds(M),A=W=="wrapper"?la(M):e;A&&da(A[0])&&A[1]==(O|I|K|V)&&!A[4].length&&A[9]==1?Z=Z[ds(A[0])].apply(Z,A[3]):Z=M.length==1&&da(M)?Z[W]():Z.thru(M)}return function(){var U=arguments,B=U[0];if(Z&&U.length==1&&fe(B))return Z.plant(B).value();for(var j=0,$=h?o[j].apply(this,U):B;++j<h;)$=o[j].call(this,$);return $}})}function ls(i,o,h,g,w,M,Z,W,A,U){var B=o&O,j=o&_,$=o&S,re=o&(I|F),le=o&R,ge=$?e:ci(i);function ce(){for(var _e=arguments.length,Le=z(_e),St=_e;St--;)Le[St]=arguments[St];if(re)var dt=Ir(ce),Tt=dg(Le,dt);if(g&&(Le=Tu(Le,g,w,re)),M&&(Le=Gu(Le,M,Z,re)),_e-=Tt,re&&_e<U){var Ke=An(Le,dt);return Fu(i,o,ls,ce.placeholder,h,Le,Ke,W,A,U-_e)}var Et=j?h:this,bn=$?Et[i]:i;return _e=Le.length,W?Le=b1(Le,W):le&&_e>1&&Le.reverse(),B&&A<_e&&(Le.length=A),this&&this!==nt&&this instanceof ce&&(bn=ge||ci(bn)),bn.apply(Et,Le)}return ce}function Vu(i,o){return function(h,g){return Zy(h,i,o(g),{})}}function cs(i,o){return function(h,g){var w;if(h===e&&g===e)return o;if(h!==e&&(w=h),g!==e){if(w===e)return g;typeof h=="string"||typeof g=="string"?(h=Mt(h),g=Mt(g)):(h=vu(h),g=vu(g)),w=i(h,g)}return w}}function ia(i){return gn(function(o){return o=Ve(o,_t(ae())),ye(function(h){var g=this;return i(o,function(w){return xt(w,g,h)})})})}function us(i,o){o=o===e?" ":Mt(o);var h=o.length;if(h<2)return h?Eo(o,i):o;var g=Eo(o,Hi(i/xr(o)));return br(o)?zn(Jt(g),0,i).join(""):g.slice(0,i)}function t1(i,o,h,g){var w=o&_,M=ci(i);function Z(){for(var W=-1,A=arguments.length,U=-1,B=g.length,j=z(B+A),$=this&&this!==nt&&this instanceof Z?M:i;++U<B;)j[U]=g[U];for(;A--;)j[U++]=arguments[++W];return xt($,w?h:this,j)}return Z}function Au(i){return function(o,h,g){return g&&typeof g!="number"&&ht(o,h,g)&&(h=g=e),o=wn(o),h===e?(h=o,o=0):h=wn(h),g=g===e?o<h?1:-1:wn(g),Oy(o,h,g,i)}}function hs(i){return function(o,h){return typeof o=="string"&&typeof h=="string"||(o=Ot(o),h=Ot(h)),i(o,h)}}function Fu(i,o,h,g,w,M,Z,W,A,U){var B=o&I,j=B?Z:e,$=B?e:Z,re=B?M:e,le=B?e:M;o|=B?K:D,o&=~(B?D:K),o&L||(o&=-4);var ge=[i,o,w,re,j,le,$,W,A,U],ce=h.apply(e,ge);return da(i)&&ju(ce,ge),ce.placeholder=g,Ju(ce,i,o)}function sa(i){var o=Be[i];return function(h,g){if(h=Ot(h),g=g==null?0:st(pe(g),292),g&&Jc(h)){var w=(Ge(h)+"e").split("e"),M=o(w[0]+"e"+(+w[1]+g));return w=(Ge(M)+"e").split("e"),+(w[0]+"e"+(+w[1]-g))}return o(h)}}var n1=Lr&&1/Oi(new Lr([,-0]))[1]==oe?function(i){return new Lr(i)}:Ga;function Xu(i){return function(o){var h=ot(o);return h==Ae?Fo(o):h==bt?wg(o):hg(o,i(o))}}function mn(i,o,h,g,w,M,Z,W){var A=o&S;if(!A&&typeof i!="function")throw new Ft(l);var U=g?g.length:0;if(U||(o&=-97,g=w=e),Z=Z===e?Z:Ne(pe(Z),0),W=W===e?W:pe(W),U-=w?w.length:0,o&D){var B=g,j=w;g=w=e}var $=A?e:la(i),re=[i,o,h,g,w,B,j,M,Z,W];if($&&y1(re,$),i=re[0],o=re[1],h=re[2],g=re[3],w=re[4],W=re[9]=re[9]===e?A?0:i.length:Ne(re[9]-U,0),!W&&o&(I|F)&&(o&=-25),!o||o==_)var le=$y(i,o,h);else o==I||o==F?le=e1(i,o,W):(o==K||o==(_|K))&&!w.length?le=t1(i,o,h,g):le=ls.apply(e,re);var ge=$?gu:ju;return Ju(ge(le,re),i,o)}function ku(i,o,h,g){return i===e||Ht(i,Mr[h])&&!Ze.call(g,h)?o:i}function Du(i,o,h,g,w,M){return Fe(i)&&Fe(o)&&(M.set(o,i),is(i,o,e,Du,M),M.delete(o)),i}function r1(i){return di(i)?e:i}function zu(i,o,h,g,w,M){var Z=h&b,W=i.length,A=o.length;if(W!=A&&!(Z&&A>W))return!1;var U=M.get(i),B=M.get(o);if(U&&B)return U==o&&B==i;var j=-1,$=!0,re=h&T?new tr:e;for(M.set(i,o),M.set(o,i);++j<W;){var le=i[j],ge=o[j];if(g)var ce=Z?g(ge,le,j,o,i,M):g(le,ge,j,i,o,M);if(ce!==e){if(ce)continue;$=!1;break}if(re){if(!Io(o,function(_e,Le){if(!qr(re,Le)&&(le===_e||w(le,_e,h,g,M)))return re.push(Le)})){$=!1;break}}else if(!(le===ge||w(le,ge,h,g,M))){$=!1;break}}return M.delete(i),M.delete(o),$}function i1(i,o,h,g,w,M,Z){switch(h){case sn:if(i.byteLength!=o.byteLength||i.byteOffset!=o.byteOffset)return!1;i=i.buffer,o=o.buffer;case Wn:return!(i.byteLength!=o.byteLength||!M(new Ni(i),new Ni(o)));case Qe:case ct:case Ut:return Ht(+i,+o);case Ue:return i.name==o.name&&i.message==o.message;case Nn:case Zn:return i==o+"";case Ae:var W=Fo;case bt:var A=g&b;if(W||(W=Oi),i.size!=o.size&&!A)return!1;var U=Z.get(i);if(U)return U==o;g|=T,Z.set(i,o);var B=zu(W(i),W(o),g,w,M,Z);return Z.delete(i),B;case In:if(ri)return ri.call(i)==ri.call(o)}return!1}function s1(i,o,h,g,w,M){var Z=h&b,W=oa(i),A=W.length,U=oa(o),B=U.length;if(A!=B&&!Z)return!1;for(var j=A;j--;){var $=W[j];if(!(Z?$ in o:Ze.call(o,$)))return!1}var re=M.get(i),le=M.get(o);if(re&&le)return re==o&&le==i;var ge=!0;M.set(i,o),M.set(o,i);for(var ce=Z;++j<A;){$=W[j];var _e=i[$],Le=o[$];if(g)var St=Z?g(Le,_e,$,o,i,M):g(_e,Le,$,i,o,M);if(!(St===e?_e===Le||w(_e,Le,h,g,M):St)){ge=!1;break}ce||(ce=$=="constructor")}if(ge&&!ce){var dt=i.constructor,Tt=o.constructor;dt!=Tt&&"constructor"in i&&"constructor"in o&&!(typeof dt=="function"&&dt instanceof dt&&typeof Tt=="function"&&Tt instanceof Tt)&&(ge=!1)}return M.delete(i),M.delete(o),ge}function gn(i){return pa(Bu(i,e,eh),i+"")}function oa(i){return su(i,He,ua)}function aa(i){return su(i,yt,Ou)}var la=qi?function(i){return qi.get(i)}:Ga;function ds(i){for(var o=i.name+"",h=Sr[o],g=Ze.call(Sr,o)?h.length:0;g--;){var w=h[g],M=w.func;if(M==null||M==i)return w.name}return o}function Ir(i){var o=Ze.call(x,"placeholder")?x:i;return o.placeholder}function ae(){var i=x.iteratee||Sa;return i=i===Sa?lu:i,arguments.length?i(arguments[0],arguments[1]):i}function fs(i,o){var h=i.__data__;return f1(o)?h[typeof o=="string"?"string":"hash"]:h.map}function ca(i){for(var o=He(i),h=o.length;h--;){var g=o[h],w=i[g];o[h]=[g,w,Yu(w)]}return o}function ir(i,o){var h=gg(i,o);return au(h)?h:e}function o1(i){var o=Ze.call(i,$n),h=i[$n];try{i[$n]=e;var g=!0}catch{}var w=Ui.call(i);return g&&(o?i[$n]=h:delete i[$n]),w}var ua=ko?function(i){return i==null?[]:(i=Ie(i),Cn(ko(i),function(o){return Nc.call(i,o)}))}:Za,Ou=ko?function(i){for(var o=[];i;)Vn(o,ua(i)),i=ji(i);return o}:Za,ot=ut;(Do&&ot(new Do(new ArrayBuffer(1)))!=sn||ei&&ot(new ei)!=Ae||zo&&ot(zo.resolve())!=jr||Lr&&ot(new Lr)!=bt||ti&&ot(new ti)!=Jn)&&(ot=function(i){var o=ut(i),h=o==Pt?i.constructor:e,g=h?sr(h):"";if(g)switch(g){case Rg:return sn;case Yg:return Ae;case Ug:return jr;case Bg:return bt;case Ng:return Jn}return o});function a1(i,o,h){for(var g=-1,w=h.length;++g<w;){var M=h[g],Z=M.size;switch(M.type){case"drop":i+=Z;break;case"dropRight":o-=Z;break;case"take":o=st(o,i+Z);break;case"takeRight":i=Ne(i,o-Z);break}}return{start:i,end:o}}function l1(i){var o=i.match(p0);return o?o[1].split(m0):[]}function Ku(i,o,h){o=Dn(o,i);for(var g=-1,w=o.length,M=!1;++g<w;){var Z=ln(o[g]);if(!(M=i!=null&&h(i,Z)))break;i=i[Z]}return M||++g!=w?M:(w=i==null?0:i.length,!!w&&bs(w)&&yn(Z,w)&&(fe(i)||or(i)))}function c1(i){var o=i.length,h=new i.constructor(o);return o&&typeof i[0]=="string"&&Ze.call(i,"index")&&(h.index=i.index,h.input=i.input),h}function Ru(i){return typeof i.constructor=="function"&&!ui(i)?Tr(ji(i)):{}}function u1(i,o,h){var g=i.constructor;switch(o){case Wn:return ra(i);case Qe:case ct:return new g(+i);case sn:return jy(i,h);case Jr:case Qr:case mr:case Hr:case Er:case gr:case Qn:case X:case E:return Lu(i,h);case Ae:return new g;case Ut:case Zn:return new g(i);case Nn:return Jy(i);case bt:return new g;case In:return Qy(i)}}function h1(i,o){var h=o.length;if(!h)return i;var g=h-1;return o[g]=(h>1?"& ":"")+o[g],o=o.join(h>2?", ":" "),i.replace(f0,`{
|
|
547
547
|
/* [wrapped with `+o+`] */
|
|
548
|
-
`)}function d1(i){return fe(i)||or(i)||!!(jc&&i&&i[jc])}function yn(i,o){var h=typeof i;return o=o??ie,!!o&&(h=="number"||h!="symbol"&&L0.test(i))&&i>-1&&i%1==0&&i<o}function ht(i,o,h){if(!Fe(h))return!1;var g=typeof o;return(g=="number"?gt(h)&&yn(o,h.length):g=="string"&&o in h)?Ht(h[o],i):!1}function ha(i,o){if(fe(i))return!1;var h=typeof i;return h=="number"||h=="symbol"||h=="boolean"||i==null||Lt(i)?!0:En.test(i)||!Hn.test(i)||o!=null&&i in Ie(o)}function f1(i){var o=typeof i;return o=="string"||o=="number"||o=="symbol"||o=="boolean"?i!=="__proto__":i===null}function da(i){var o=ds(i),h=x[o];if(typeof h!="function"||!(o in Me.prototype))return!1;if(i===h)return!0;var g=la(h);return!!g&&i===g[0]}function p1(i){return!!Yc&&Yc in i}var m1=Ri?vn:Ia;function ui(i){var o=i&&i.constructor,h=typeof o=="function"&&o.prototype||Mr;return i===h}function Yu(i){return i===i&&!Fe(i)}function Uu(i,o){return function(h){return h==null?!1:h[i]===o&&(o!==e||i in Ie(h))}}function g1(i){var o=vs(i,function(g){return h.size===d&&h.clear(),g}),h=o.cache;return o}function y1(i,o){var h=i[1],g=o[1],w=h|g,M=w<(_|S|O),Z=g==O&&h==I||g==O&&h==V&&i[7].length<=o[8]||g==(O|V)&&o[7].length<=o[8]&&h==I;if(!(M||Z))return i;g&_&&(i[2]=o[2],w|=h&_?0:L);var W=o[3];if(W){var A=i[3];i[3]=A?Tu(A,W,o[4]):W,i[4]=A?Vn(i[3],p):o[4]}return W=o[5],W&&(A=i[5],i[5]=A?Gu(A,W,o[6]):W,i[6]=A?Vn(i[5],p):o[6]),W=o[7],W&&(i[7]=W),g&O&&(i[8]=i[8]==null?o[8]:st(i[8],o[8])),i[9]==null&&(i[9]=o[9]),i[0]=o[0],i[1]=w,i}function v1(i){var o=[];if(i!=null)for(var h in Ie(i))o.push(h);return o}function w1(i){return Ui.call(i)}function Bu(i,o,h){return o=Ne(o===e?i.length-1:o,0),function(){for(var g=arguments,w=-1,M=Ne(g.length-o,0),Z=z(M);++w<M;)Z[w]=g[o+w];w=-1;for(var W=z(o+1);++w<o;)W[w]=g[w];return W[o]=h(Z),xt(i,this,W)}}function Nu(i,o){return o.length<2?i:rr(i,kt(o,0,-1))}function b1(i,o){for(var h=i.length,g=st(o.length,h),w=mt(i);g--;){var M=o[g];i[g]=yn(M,h)?w[M]:e}return i}function fa(i,o){if(!(o==="constructor"&&typeof i[o]=="function")&&o!="__proto__")return i[o]}var ju=Qu(gu),hi=Fg||function(i,o){return nt.setTimeout(i,o)},pa=Qu(Yy);function Ju(i,o,h){var g=o+"";return pa(i,h1(g,x1(l1(g),h)))}function Qu(i){var o=0,h=0;return function(){var g=zg(),w=H-(g-h);if(h=g,w>0){if(++o>=N)return arguments[0]}else o=0;return i.apply(e,arguments)}}function ps(i,o){var h=-1,g=i.length,w=g-1;for(o=o===e?g:o;++h<o;){var M=Ho(h,w),Z=i[M];i[M]=i[h],i[h]=Z}return i.length=o,i}var Hu=g1(function(i){var o=[];return i.charCodeAt(0)===46&&o.push(""),i.replace(yr,function(h,g,w,M){o.push(w?M.replace(v0,"$1"):g||h)}),o});function ln(i){if(typeof i=="string"||Lt(i))return i;var o=i+"";return o=="0"&&1/i==-oe?"-0":o}function sr(i){if(i!=null){try{return Yi.call(i)}catch{}try{return i+""}catch{}}return""}function x1(i,o){return Vt(ke,function(h){var g="_."+h[0];o&h[1]&&!Di(i,g)&&i.push(g)}),i.sort()}function Eu(i){if(i instanceof Me)return i.clone();var o=new Ft(i.__wrapped__,i.__chain__);return o.__actions__=mt(i.__actions__),o.__index__=i.__index__,o.__values__=i.__values__,o}function _1(i,o,h){(h?ht(i,o,h):o===e)?o=1:o=Ne(pe(o),0);var g=i==null?0:i.length;if(!g||o<1)return[];for(var w=0,M=0,Z=z(Hi(g/o));w<g;)Z[M++]=kt(i,w,w+=o);return Z}function M1(i){for(var o=-1,h=i==null?0:i.length,g=0,w=[];++o<h;){var M=i[o];M&&(w[g++]=M)}return w}function L1(){var i=arguments.length;if(!i)return[];for(var o=z(i-1),h=arguments[0],g=i;g--;)o[g-1]=arguments[g];return Cn(fe(h)?mt(h):[h],rt(o,1))}var S1=ye(function(i,o){return Oe(i)?si(i,rt(o,1,Oe,!0)):[]}),T1=ye(function(i,o){var h=Dt(o);return Oe(h)&&(h=e),Oe(i)?si(i,rt(o,1,Oe,!0),ae(h,2)):[]}),G1=ye(function(i,o){var h=Dt(o);return Oe(h)&&(h=e),Oe(i)?si(i,rt(o,1,Oe,!0),e,h):[]});function Z1(i,o,h){var g=i==null?0:i.length;return g?(o=h||o===e?1:pe(o),kt(i,o<0?0:o,g)):[]}function I1(i,o,h){var g=i==null?0:i.length;return g?(o=h||o===e?1:pe(o),o=g-o,kt(i,0,o<0?0:o)):[]}function W1(i,o){return i&&i.length?os(i,ae(o,3),!0,!0):[]}function P1(i,o){return i&&i.length?os(i,ae(o,3),!0):[]}function C1(i,o,h,g){var w=i==null?0:i.length;return w?(h&&typeof h!="number"&&ht(i,o,h)&&(h=0,g=w),Ly(i,o,h,g)):[]}function qu(i,o,h){var g=i==null?0:i.length;if(!g)return-1;var w=h==null?0:pe(h);return w<0&&(w=Ne(g+w,0)),zi(i,ae(o,3),w)}function $u(i,o,h){var g=i==null?0:i.length;if(!g)return-1;var w=g-1;return h!==e&&(w=pe(h),w=h<0?Ne(g+w,0):st(w,g-1)),zi(i,ae(o,3),w,!0)}function eh(i){var o=i==null?0:i.length;return o?rt(i,1):[]}function V1(i){var o=i==null?0:i.length;return o?rt(i,oe):[]}function A1(i,o){var h=i==null?0:i.length;return h?(o=o===e?1:pe(o),rt(i,o)):[]}function F1(i){for(var o=-1,h=i==null?0:i.length,g={};++o<h;){var w=i[o];g[w[0]]=w[1]}return g}function th(i){return i&&i.length?i[0]:e}function X1(i,o,h){var g=i==null?0:i.length;if(!g)return-1;var w=h==null?0:pe(h);return w<0&&(w=Ne(g+w,0)),wr(i,o,w)}function k1(i){var o=i==null?0:i.length;return o?kt(i,0,-1):[]}var D1=ye(function(i){var o=Ve(i,ta);return o.length&&o[0]===i[0]?Bo(o):[]}),z1=ye(function(i){var o=Dt(i),h=Ve(i,ta);return o===Dt(h)?o=e:h.pop(),h.length&&h[0]===i[0]?Bo(h,ae(o,2)):[]}),O1=ye(function(i){var o=Dt(i),h=Ve(i,ta);return o=typeof o=="function"?o:e,o&&h.pop(),h.length&&h[0]===i[0]?Bo(h,e,o):[]});function K1(i,o){return i==null?"":kg.call(i,o)}function Dt(i){var o=i==null?0:i.length;return o?i[o-1]:e}function R1(i,o,h){var g=i==null?0:i.length;if(!g)return-1;var w=g;return h!==e&&(w=pe(h),w=w<0?Ne(g+w,0):st(w,g-1)),o===o?xg(i,o,w):zi(i,Fc,w,!0)}function Y1(i,o){return i&&i.length?du(i,pe(o)):e}var U1=ye(nh);function nh(i,o){return i&&i.length&&o&&o.length?Qo(i,o):i}function B1(i,o,h){return i&&i.length&&o&&o.length?Qo(i,o,ae(h,2)):i}function N1(i,o,h){return i&&i.length&&o&&o.length?Qo(i,o,e,h):i}var j1=gn(function(i,o){var h=i==null?0:i.length,g=Ko(i,o);return mu(i,Ve(o,function(w){return yn(w,h)?+w:w}).sort(Su)),g});function J1(i,o){var h=[];if(!(i&&i.length))return h;var g=-1,w=[],M=i.length;for(o=ae(o,3);++g<M;){var Z=i[g];o(Z,g,i)&&(h.push(Z),w.push(g))}return mu(i,w),h}function ma(i){return i==null?i:Kg.call(i)}function Q1(i,o,h){var g=i==null?0:i.length;return g?(h&&typeof h!="number"&&ht(i,o,h)?(o=0,h=g):(o=o==null?0:pe(o),h=h===e?g:pe(h)),kt(i,o,h)):[]}function H1(i,o){return ss(i,o)}function E1(i,o,h){return qo(i,o,ae(h,2))}function q1(i,o){var h=i==null?0:i.length;if(h){var g=ss(i,o);if(g<h&&Ht(i[g],o))return g}return-1}function $1(i,o){return ss(i,o,!0)}function ev(i,o,h){return qo(i,o,ae(h,2),!0)}function tv(i,o){var h=i==null?0:i.length;if(h){var g=ss(i,o,!0)-1;if(Ht(i[g],o))return g}return-1}function nv(i){return i&&i.length?yu(i):[]}function rv(i,o){return i&&i.length?yu(i,ae(o,2)):[]}function iv(i){var o=i==null?0:i.length;return o?kt(i,1,o):[]}function sv(i,o,h){return i&&i.length?(o=h||o===e?1:pe(o),kt(i,0,o<0?0:o)):[]}function ov(i,o,h){var g=i==null?0:i.length;return g?(o=h||o===e?1:pe(o),o=g-o,kt(i,o<0?0:o,g)):[]}function av(i,o){return i&&i.length?os(i,ae(o,3),!1,!0):[]}function lv(i,o){return i&&i.length?os(i,ae(o,3)):[]}var cv=ye(function(i){return Xn(rt(i,1,Oe,!0))}),uv=ye(function(i){var o=Dt(i);return Oe(o)&&(o=e),Xn(rt(i,1,Oe,!0),ae(o,2))}),hv=ye(function(i){var o=Dt(i);return o=typeof o=="function"?o:e,Xn(rt(i,1,Oe,!0),e,o)});function dv(i){return i&&i.length?Xn(i):[]}function fv(i,o){return i&&i.length?Xn(i,ae(o,2)):[]}function pv(i,o){return o=typeof o=="function"?o:e,i&&i.length?Xn(i,e,o):[]}function ga(i){if(!(i&&i.length))return[];var o=0;return i=Pn(i,function(h){if(Oe(h))return o=Ne(h.length,o),!0}),Vo(o,function(h){return Ve(i,Wo(h))})}function rh(i,o){if(!(i&&i.length))return[];var h=ga(i);return o==null?h:Ve(h,function(g){return xt(o,e,g)})}var mv=ye(function(i,o){return Oe(i)?si(i,o):[]}),gv=ye(function(i){return ea(Pn(i,Oe))}),yv=ye(function(i){var o=Dt(i);return Oe(o)&&(o=e),ea(Pn(i,Oe),ae(o,2))}),vv=ye(function(i){var o=Dt(i);return o=typeof o=="function"?o:e,ea(Pn(i,Oe),e,o)}),wv=ye(ga);function bv(i,o){return xu(i||[],o||[],ii)}function xv(i,o){return xu(i||[],o||[],li)}var _v=ye(function(i){var o=i.length,h=o>1?i[o-1]:e;return h=typeof h=="function"?(i.pop(),h):e,rh(i,h)});function ih(i){var o=x(i);return o.__chain__=!0,o}function Mv(i,o){return o(i),i}function ms(i,o){return o(i)}var Lv=gn(function(i){var o=i.length,h=o?i[0]:0,g=this.__wrapped__,w=function(M){return Ko(M,i)};return o>1||this.__actions__.length||!(g instanceof Me)||!yn(h)?this.thru(w):(g=g.slice(h,+h+(o?1:0)),g.__actions__.push({func:ms,args:[w],thisArg:e}),new Ft(g,this.__chain__).thru(function(M){return o&&!M.length&&M.push(e),M}))});function Sv(){return ih(this)}function Tv(){return new Ft(this.value(),this.__chain__)}function Gv(){this.__values__===e&&(this.__values__=vh(this.value()));var i=this.__index__>=this.__values__.length,o=i?e:this.__values__[this.__index__++];return{done:i,value:o}}function Zv(){return this}function Iv(i){for(var o,h=this;h instanceof es;){var g=Eu(h);g.__index__=0,g.__values__=e,o?w.__wrapped__=g:o=g;var w=g;h=h.__wrapped__}return w.__wrapped__=i,o}function Wv(){var i=this.__wrapped__;if(i instanceof Me){var o=i;return this.__actions__.length&&(o=new Me(this)),o=o.reverse(),o.__actions__.push({func:ms,args:[ma],thisArg:e}),new Ft(o,this.__chain__)}return this.thru(ma)}function Pv(){return bu(this.__wrapped__,this.__actions__)}var Cv=as(function(i,o,h){Ze.call(i,h)?++i[h]:pn(i,h,1)});function Vv(i,o,h){var g=fe(i)?Vc:My;return h&&ht(i,o,h)&&(o=e),g(i,ae(o,3))}function Av(i,o){var h=fe(i)?Pn:ru;return h(i,ae(o,3))}var Fv=Pu(qu),Xv=Pu($u);function kv(i,o){return rt(gs(i,o),1)}function Dv(i,o){return rt(gs(i,o),oe)}function zv(i,o,h){return h=h===e?1:pe(h),rt(gs(i,o),h)}function sh(i,o){var h=fe(i)?Vt:Fn;return h(i,ae(o,3))}function oh(i,o){var h=fe(i)?ig:nu;return h(i,ae(o,3))}var Ov=as(function(i,o,h){Ze.call(i,h)?i[h].push(o):pn(i,h,[o])});function Kv(i,o,h,g){i=gt(i)?i:Pr(i),h=h&&!g?pe(h):0;var w=i.length;return h<0&&(h=Ne(w+h,0)),xs(i)?h<=w&&i.indexOf(o,h)>-1:!!w&&wr(i,o,h)>-1}var Rv=ye(function(i,o,h){var g=-1,w=typeof o=="function",M=gt(i)?z(i.length):[];return Fn(i,function(Z){M[++g]=w?xt(o,Z,h):oi(Z,o,h)}),M}),Yv=as(function(i,o,h){pn(i,h,o)});function gs(i,o){var h=fe(i)?Ve:cu;return h(i,ae(o,3))}function Uv(i,o,h,g){return i==null?[]:(fe(o)||(o=o==null?[]:[o]),h=g?e:h,fe(h)||(h=h==null?[]:[h]),fu(i,o,h))}var Bv=as(function(i,o,h){i[h?0:1].push(o)},function(){return[[],[]]});function Nv(i,o,h){var g=fe(i)?Zo:kc,w=arguments.length<3;return g(i,ae(o,4),h,w,Fn)}function jv(i,o,h){var g=fe(i)?sg:kc,w=arguments.length<3;return g(i,ae(o,4),h,w,nu)}function Jv(i,o){var h=fe(i)?Pn:ru;return h(i,ws(ae(o,3)))}function Qv(i){var o=fe(i)?qc:Ky;return o(i)}function Hv(i,o,h){(h?ht(i,o,h):o===e)?o=1:o=pe(o);var g=fe(i)?vy:Ry;return g(i,o)}function Ev(i){var o=fe(i)?wy:Uy;return o(i)}function qv(i){if(i==null)return 0;if(gt(i))return xs(i)?xr(i):i.length;var o=ot(i);return o==Ae||o==bt?i.size:jo(i).length}function $v(i,o,h){var g=fe(i)?Io:By;return h&&ht(i,o,h)&&(o=e),g(i,ae(o,3))}var ew=ye(function(i,o){if(i==null)return[];var h=o.length;return h>1&&ht(i,o[0],o[1])?o=[]:h>2&&ht(o[0],o[1],o[2])&&(o=[o[0]]),fu(i,rt(o,1),[])}),ys=Ag||function(){return nt.Date.now()};function tw(i,o){if(typeof o!="function")throw new At(l);return i=pe(i),function(){if(--i<1)return o.apply(this,arguments)}}function ah(i,o,h){return o=h?e:o,o=i&&o==null?i.length:o,mn(i,O,e,e,e,e,o)}function lh(i,o){var h;if(typeof o!="function")throw new At(l);return i=pe(i),function(){return--i>0&&(h=o.apply(this,arguments)),i<=1&&(o=e),h}}var ya=ye(function(i,o,h){var g=_;if(h.length){var w=Vn(h,Ir(ya));g|=K}return mn(i,g,o,h,w)}),ch=ye(function(i,o,h){var g=_|S;if(h.length){var w=Vn(h,Ir(ch));g|=K}return mn(o,g,i,h,w)});function uh(i,o,h){o=h?e:o;var g=mn(i,I,e,e,e,e,e,o);return g.placeholder=uh.placeholder,g}function hh(i,o,h){o=h?e:o;var g=mn(i,F,e,e,e,e,e,o);return g.placeholder=hh.placeholder,g}function dh(i,o,h){var g,w,M,Z,W,A,U=0,B=!1,j=!1,$=!0;if(typeof i!="function")throw new At(l);o=zt(o)||0,Fe(h)&&(B=!!h.leading,j="maxWait"in h,M=j?Ne(zt(h.maxWait)||0,o):M,$="trailing"in h?!!h.trailing:$);function re(Ke){var Et=g,bn=w;return g=w=e,U=Ke,Z=i.apply(bn,Et),Z}function le(Ke){return U=Ke,W=hi(_e,o),B?re(Ke):Z}function ge(Ke){var Et=Ke-A,bn=Ke-U,Ph=o-Et;return j?st(Ph,M-bn):Ph}function ce(Ke){var Et=Ke-A,bn=Ke-U;return A===e||Et>=o||Et<0||j&&bn>=M}function _e(){var Ke=ys();if(ce(Ke))return Le(Ke);W=hi(_e,ge(Ke))}function Le(Ke){return W=e,$&&g?re(Ke):(g=w=e,Z)}function St(){W!==e&&_u(W),U=0,g=A=w=W=e}function dt(){return W===e?Z:Le(ys())}function Tt(){var Ke=ys(),Et=ce(Ke);if(g=arguments,w=this,A=Ke,Et){if(W===e)return le(A);if(j)return _u(W),W=hi(_e,o),re(A)}return W===e&&(W=hi(_e,o)),Z}return Tt.cancel=St,Tt.flush=dt,Tt}var nw=ye(function(i,o){return tu(i,1,o)}),rw=ye(function(i,o,h){return tu(i,zt(o)||0,h)});function iw(i){return mn(i,R)}function vs(i,o){if(typeof i!="function"||o!=null&&typeof o!="function")throw new At(l);var h=function(){var g=arguments,w=o?o.apply(this,g):g[0],M=h.cache;if(M.has(w))return M.get(w);var Z=i.apply(this,g);return h.cache=M.set(w,Z)||M,Z};return h.cache=new(vs.Cache||fn),h}vs.Cache=fn;function ws(i){if(typeof i!="function")throw new At(l);return function(){var o=arguments;switch(o.length){case 0:return!i.call(this);case 1:return!i.call(this,o[0]);case 2:return!i.call(this,o[0],o[1]);case 3:return!i.call(this,o[0],o[1],o[2])}return!i.apply(this,o)}}function sw(i){return lh(2,i)}var ow=Ny(function(i,o){o=o.length==1&&fe(o[0])?Ve(o[0],_t(ae())):Ve(rt(o,1),_t(ae()));var h=o.length;return ye(function(g){for(var w=-1,M=st(g.length,h);++w<M;)g[w]=o[w].call(this,g[w]);return xt(i,this,g)})}),va=ye(function(i,o){var h=Vn(o,Ir(va));return mn(i,K,e,o,h)}),fh=ye(function(i,o){var h=Vn(o,Ir(fh));return mn(i,D,e,o,h)}),aw=gn(function(i,o){return mn(i,V,e,e,e,o)});function lw(i,o){if(typeof i!="function")throw new At(l);return o=o===e?o:pe(o),ye(i,o)}function cw(i,o){if(typeof i!="function")throw new At(l);return o=o==null?0:Ne(pe(o),0),ye(function(h){var g=h[o],w=Dn(h,0,o);return g&&Cn(w,g),xt(i,this,w)})}function uw(i,o,h){var g=!0,w=!0;if(typeof i!="function")throw new At(l);return Fe(h)&&(g="leading"in h?!!h.leading:g,w="trailing"in h?!!h.trailing:w),dh(i,o,{leading:g,maxWait:o,trailing:w})}function hw(i){return ah(i,1)}function dw(i,o){return va(na(o),i)}function fw(){if(!arguments.length)return[];var i=arguments[0];return fe(i)?i:[i]}function pw(i){return Xt(i,v)}function mw(i,o){return o=typeof o=="function"?o:e,Xt(i,v,o)}function gw(i){return Xt(i,f|v)}function yw(i,o){return o=typeof o=="function"?o:e,Xt(i,f|v,o)}function vw(i,o){return o==null||eu(i,o,He(o))}function Ht(i,o){return i===o||i!==i&&o!==o}var ww=hs(Uo),bw=hs(function(i,o){return i>=o}),or=ou(function(){return arguments}())?ou:function(i){return De(i)&&Ze.call(i,"callee")&&!Nc.call(i,"callee")},fe=z.isArray,xw=Gc?_t(Gc):Iy;function gt(i){return i!=null&&bs(i.length)&&!vn(i)}function Oe(i){return De(i)&>(i)}function _w(i){return i===!0||i===!1||De(i)&&ut(i)==Qe}var zn=Xg||Ia,Mw=Zc?_t(Zc):Wy;function Lw(i){return De(i)&&i.nodeType===1&&!di(i)}function Sw(i){if(i==null)return!0;if(gt(i)&&(fe(i)||typeof i=="string"||typeof i.splice=="function"||zn(i)||Wr(i)||or(i)))return!i.length;var o=ot(i);if(o==Ae||o==bt)return!i.size;if(ui(i))return!jo(i).length;for(var h in i)if(Ze.call(i,h))return!1;return!0}function Tw(i,o){return ai(i,o)}function Gw(i,o,h){h=typeof h=="function"?h:e;var g=h?h(i,o):e;return g===e?ai(i,o,e,h):!!g}function wa(i){if(!De(i))return!1;var o=ut(i);return o==Ue||o==pt||typeof i.message=="string"&&typeof i.name=="string"&&!di(i)}function Zw(i){return typeof i=="number"&&Jc(i)}function vn(i){if(!Fe(i))return!1;var o=ut(i);return o==hn||o==Tn||o==Je||o==Vi}function ph(i){return typeof i=="number"&&i==pe(i)}function bs(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=ie}function Fe(i){var o=typeof i;return i!=null&&(o=="object"||o=="function")}function De(i){return i!=null&&typeof i=="object"}var mh=Ic?_t(Ic):Cy;function Iw(i,o){return i===o||No(i,o,ca(o))}function Ww(i,o,h){return h=typeof h=="function"?h:e,No(i,o,ca(o),h)}function Pw(i){return gh(i)&&i!=+i}function Cw(i){if(m1(i))throw new de(s);return au(i)}function Vw(i){return i===null}function Aw(i){return i==null}function gh(i){return typeof i=="number"||De(i)&&ut(i)==Ut}function di(i){if(!De(i)||ut(i)!=Wt)return!1;var o=ji(i);if(o===null)return!0;var h=Ze.call(o,"constructor")&&o.constructor;return typeof h=="function"&&h instanceof h&&Yi.call(h)==Wg}var ba=Wc?_t(Wc):Vy;function Fw(i){return ph(i)&&i>=-ie&&i<=ie}var yh=Pc?_t(Pc):Ay;function xs(i){return typeof i=="string"||!fe(i)&&De(i)&&ut(i)==Gn}function Lt(i){return typeof i=="symbol"||De(i)&&ut(i)==Zn}var Wr=Cc?_t(Cc):Fy;function Xw(i){return i===e}function kw(i){return De(i)&&ot(i)==Jn}function Dw(i){return De(i)&&ut(i)==yo}var zw=hs(Jo),Ow=hs(function(i,o){return i<=o});function vh(i){if(!i)return[];if(gt(i))return xs(i)?Jt(i):mt(i);if($r&&i[$r])return vg(i[$r]());var o=ot(i),h=o==Ae?Fo:o==bt?Oi:Pr;return h(i)}function wn(i){if(!i)return i===0?i:0;if(i=zt(i),i===oe||i===-oe){var o=i<0?-1:1;return o*ee}return i===i?i:0}function pe(i){var o=wn(i),h=o%1;return o===o?h?o-h:o:0}function wh(i){return i?nr(pe(i),0,xe):0}function zt(i){if(typeof i=="number")return i;if(Lt(i))return me;if(Fe(i)){var o=typeof i.valueOf=="function"?i.valueOf():i;i=Fe(o)?o+"":o}if(typeof i!="string")return i===0?i:+i;i=Dc(i);var h=x0.test(i);return h||M0.test(i)?tg(i.slice(2),h?2:8):b0.test(i)?me:+i}function bh(i){return an(i,yt(i))}function Kw(i){return i?nr(pe(i),-ie,ie):i===0?i:0}function Ge(i){return i==null?"":Mt(i)}var Rw=Gr(function(i,o){if(ui(o)||gt(o)){an(o,He(o),i);return}for(var h in o)Ze.call(o,h)&&ii(i,h,o[h])}),xh=Gr(function(i,o){an(o,yt(o),i)}),_s=Gr(function(i,o,h,g){an(o,yt(o),i,g)}),Yw=Gr(function(i,o,h,g){an(o,He(o),i,g)}),Uw=gn(Ko);function Bw(i,o){var h=Tr(i);return o==null?h:$c(h,o)}var Nw=ye(function(i,o){i=Ie(i);var h=-1,g=o.length,w=g>2?o[2]:e;for(w&&ht(o[0],o[1],w)&&(g=1);++h<g;)for(var M=o[h],Z=yt(M),W=-1,A=Z.length;++W<A;){var U=Z[W],B=i[U];(B===e||Ht(B,Mr[U])&&!Ze.call(i,U))&&(i[U]=M[U])}return i}),jw=ye(function(i){return i.push(e,Du),xt(_h,e,i)});function Jw(i,o){return Ac(i,ae(o,3),on)}function Qw(i,o){return Ac(i,ae(o,3),Yo)}function Hw(i,o){return i==null?i:Ro(i,ae(o,3),yt)}function Ew(i,o){return i==null?i:iu(i,ae(o,3),yt)}function qw(i,o){return i&&on(i,ae(o,3))}function $w(i,o){return i&&Yo(i,ae(o,3))}function eb(i){return i==null?[]:rs(i,He(i))}function tb(i){return i==null?[]:rs(i,yt(i))}function xa(i,o,h){var g=i==null?e:rr(i,o);return g===e?h:g}function nb(i,o){return i!=null&&Ku(i,o,Sy)}function _a(i,o){return i!=null&&Ku(i,o,Ty)}var rb=Vu(function(i,o,h){o!=null&&typeof o.toString!="function"&&(o=Ui.call(o)),i[o]=h},La(vt)),ib=Vu(function(i,o,h){o!=null&&typeof o.toString!="function"&&(o=Ui.call(o)),Ze.call(i,o)?i[o].push(h):i[o]=[h]},ae),sb=ye(oi);function He(i){return gt(i)?Ec(i):jo(i)}function yt(i){return gt(i)?Ec(i,!0):Xy(i)}function ob(i,o){var h={};return o=ae(o,3),on(i,function(g,w,M){pn(h,o(g,w,M),g)}),h}function ab(i,o){var h={};return o=ae(o,3),on(i,function(g,w,M){pn(h,w,o(g,w,M))}),h}var lb=Gr(function(i,o,h){is(i,o,h)}),_h=Gr(function(i,o,h,g){is(i,o,h,g)}),cb=gn(function(i,o){var h={};if(i==null)return h;var g=!1;o=Ve(o,function(M){return M=kn(M,i),g||(g=M.length>1),M}),an(i,aa(i),h),g&&(h=Xt(h,f|y|v,r1));for(var w=o.length;w--;)$o(h,o[w]);return h});function ub(i,o){return Mh(i,ws(ae(o)))}var hb=gn(function(i,o){return i==null?{}:Dy(i,o)});function Mh(i,o){if(i==null)return{};var h=Ve(aa(i),function(g){return[g]});return o=ae(o),pu(i,h,function(g,w){return o(g,w[0])})}function db(i,o,h){o=kn(o,i);var g=-1,w=o.length;for(w||(w=1,i=e);++g<w;){var M=i==null?e:i[ln(o[g])];M===e&&(g=w,M=h),i=vn(M)?M.call(i):M}return i}function fb(i,o,h){return i==null?i:li(i,o,h)}function pb(i,o,h,g){return g=typeof g=="function"?g:e,i==null?i:li(i,o,h,g)}var Lh=Xu(He),Sh=Xu(yt);function mb(i,o,h){var g=fe(i),w=g||zn(i)||Wr(i);if(o=ae(o,4),h==null){var M=i&&i.constructor;w?h=g?new M:[]:Fe(i)?h=vn(M)?Tr(ji(i)):{}:h={}}return(w?Vt:on)(i,function(Z,W,A){return o(h,Z,W,A)}),h}function gb(i,o){return i==null?!0:$o(i,o)}function yb(i,o,h){return i==null?i:wu(i,o,na(h))}function vb(i,o,h,g){return g=typeof g=="function"?g:e,i==null?i:wu(i,o,na(h),g)}function Pr(i){return i==null?[]:Ao(i,He(i))}function wb(i){return i==null?[]:Ao(i,yt(i))}function bb(i,o,h){return h===e&&(h=o,o=e),h!==e&&(h=zt(h),h=h===h?h:0),o!==e&&(o=zt(o),o=o===o?o:0),nr(zt(i),o,h)}function xb(i,o,h){return o=wn(o),h===e?(h=o,o=0):h=wn(h),i=zt(i),Gy(i,o,h)}function _b(i,o,h){if(h&&typeof h!="boolean"&&ht(i,o,h)&&(o=h=e),h===e&&(typeof o=="boolean"?(h=o,o=e):typeof i=="boolean"&&(h=i,i=e)),i===e&&o===e?(i=0,o=1):(i=wn(i),o===e?(o=i,i=0):o=wn(o)),i>o){var g=i;i=o,o=g}if(h||i%1||o%1){var w=Qc();return st(i+w*(o-i+eg("1e-"+((w+"").length-1))),o)}return Ho(i,o)}var Mb=Zr(function(i,o,h){return o=o.toLowerCase(),i+(h?Th(o):o)});function Th(i){return Ma(Ge(i).toLowerCase())}function Gh(i){return i=Ge(i),i&&i.replace(S0,fg).replace(U0,"")}function Lb(i,o,h){i=Ge(i),o=Mt(o);var g=i.length;h=h===e?g:nr(pe(h),0,g);var w=h;return h-=o.length,h>=0&&i.slice(h,w)==o}function Sb(i){return i=Ge(i),i&&Ai.test(i)?i.replace(Bt,pg):i}function Tb(i){return i=Ge(i),i&&h0.test(i)?i.replace(vo,"\\$&"):i}var Gb=Zr(function(i,o,h){return i+(h?"-":"")+o.toLowerCase()}),Zb=Zr(function(i,o,h){return i+(h?" ":"")+o.toLowerCase()}),Ib=Wu("toLowerCase");function Wb(i,o,h){i=Ge(i),o=pe(o);var g=o?xr(i):0;if(!o||g>=o)return i;var w=(o-g)/2;return us(Ei(w),h)+i+us(Hi(w),h)}function Pb(i,o,h){i=Ge(i),o=pe(o);var g=o?xr(i):0;return o&&g<o?i+us(o-g,h):i}function Cb(i,o,h){i=Ge(i),o=pe(o);var g=o?xr(i):0;return o&&g<o?us(o-g,h)+i:i}function Vb(i,o,h){return h||o==null?o=0:o&&(o=+o),Og(Ge(i).replace(wo,""),o||0)}function Ab(i,o,h){return(h?ht(i,o,h):o===e)?o=1:o=pe(o),Eo(Ge(i),o)}function Fb(){var i=arguments,o=Ge(i[0]);return i.length<3?o:o.replace(i[1],i[2])}var Xb=Zr(function(i,o,h){return i+(h?"_":"")+o.toLowerCase()});function kb(i,o,h){return h&&typeof h!="number"&&ht(i,o,h)&&(o=h=e),h=h===e?xe:h>>>0,h?(i=Ge(i),i&&(typeof o=="string"||o!=null&&!ba(o))&&(o=Mt(o),!o&&br(i))?Dn(Jt(i),0,h):i.split(o,h)):[]}var Db=Zr(function(i,o,h){return i+(h?" ":"")+Ma(o)});function zb(i,o,h){return i=Ge(i),h=h==null?0:nr(pe(h),0,i.length),o=Mt(o),i.slice(h,h+o.length)==o}function Ob(i,o,h){var g=x.templateSettings;h&&ht(i,o,h)&&(o=e),i=Ge(i),o=_s({},o,g,ku);var w=_s({},o.imports,g.imports,ku),M=He(w),Z=Ao(w,M),W,A,U=0,B=o.interpolate||Fi,j="__p += '",$=Xo((o.escape||Fi).source+"|"+B.source+"|"+(B===Wn?w0:Fi).source+"|"+(o.evaluate||Fi).source+"|$","g"),re="//# sourceURL="+(Ze.call(o,"sourceURL")?(o.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Q0+"]")+`
|
|
548
|
+
`)}function d1(i){return fe(i)||or(i)||!!(jc&&i&&i[jc])}function yn(i,o){var h=typeof i;return o=o??ie,!!o&&(h=="number"||h!="symbol"&&L0.test(i))&&i>-1&&i%1==0&&i<o}function ht(i,o,h){if(!Fe(h))return!1;var g=typeof o;return(g=="number"?gt(h)&&yn(o,h.length):g=="string"&&o in h)?Ht(h[o],i):!1}function ha(i,o){if(fe(i))return!1;var h=typeof i;return h=="number"||h=="symbol"||h=="boolean"||i==null||Lt(i)?!0:En.test(i)||!Hn.test(i)||o!=null&&i in Ie(o)}function f1(i){var o=typeof i;return o=="string"||o=="number"||o=="symbol"||o=="boolean"?i!=="__proto__":i===null}function da(i){var o=ds(i),h=x[o];if(typeof h!="function"||!(o in Me.prototype))return!1;if(i===h)return!0;var g=la(h);return!!g&&i===g[0]}function p1(i){return!!Yc&&Yc in i}var m1=Ri?vn:Ia;function ui(i){var o=i&&i.constructor,h=typeof o=="function"&&o.prototype||Mr;return i===h}function Yu(i){return i===i&&!Fe(i)}function Uu(i,o){return function(h){return h==null?!1:h[i]===o&&(o!==e||i in Ie(h))}}function g1(i){var o=vs(i,function(g){return h.size===d&&h.clear(),g}),h=o.cache;return o}function y1(i,o){var h=i[1],g=o[1],w=h|g,M=w<(_|S|O),Z=g==O&&h==I||g==O&&h==V&&i[7].length<=o[8]||g==(O|V)&&o[7].length<=o[8]&&h==I;if(!(M||Z))return i;g&_&&(i[2]=o[2],w|=h&_?0:L);var W=o[3];if(W){var A=i[3];i[3]=A?Tu(A,W,o[4]):W,i[4]=A?An(i[3],p):o[4]}return W=o[5],W&&(A=i[5],i[5]=A?Gu(A,W,o[6]):W,i[6]=A?An(i[5],p):o[6]),W=o[7],W&&(i[7]=W),g&O&&(i[8]=i[8]==null?o[8]:st(i[8],o[8])),i[9]==null&&(i[9]=o[9]),i[0]=o[0],i[1]=w,i}function v1(i){var o=[];if(i!=null)for(var h in Ie(i))o.push(h);return o}function w1(i){return Ui.call(i)}function Bu(i,o,h){return o=Ne(o===e?i.length-1:o,0),function(){for(var g=arguments,w=-1,M=Ne(g.length-o,0),Z=z(M);++w<M;)Z[w]=g[o+w];w=-1;for(var W=z(o+1);++w<o;)W[w]=g[w];return W[o]=h(Z),xt(i,this,W)}}function Nu(i,o){return o.length<2?i:rr(i,Dt(o,0,-1))}function b1(i,o){for(var h=i.length,g=st(o.length,h),w=mt(i);g--;){var M=o[g];i[g]=yn(M,h)?w[M]:e}return i}function fa(i,o){if(!(o==="constructor"&&typeof i[o]=="function")&&o!="__proto__")return i[o]}var ju=Qu(gu),hi=Fg||function(i,o){return nt.setTimeout(i,o)},pa=Qu(Yy);function Ju(i,o,h){var g=o+"";return pa(i,h1(g,x1(l1(g),h)))}function Qu(i){var o=0,h=0;return function(){var g=zg(),w=H-(g-h);if(h=g,w>0){if(++o>=N)return arguments[0]}else o=0;return i.apply(e,arguments)}}function ps(i,o){var h=-1,g=i.length,w=g-1;for(o=o===e?g:o;++h<o;){var M=Ho(h,w),Z=i[M];i[M]=i[h],i[h]=Z}return i.length=o,i}var Hu=g1(function(i){var o=[];return i.charCodeAt(0)===46&&o.push(""),i.replace(yr,function(h,g,w,M){o.push(w?M.replace(v0,"$1"):g||h)}),o});function ln(i){if(typeof i=="string"||Lt(i))return i;var o=i+"";return o=="0"&&1/i==-oe?"-0":o}function sr(i){if(i!=null){try{return Yi.call(i)}catch{}try{return i+""}catch{}}return""}function x1(i,o){return At(ke,function(h){var g="_."+h[0];o&h[1]&&!Di(i,g)&&i.push(g)}),i.sort()}function Eu(i){if(i instanceof Me)return i.clone();var o=new Xt(i.__wrapped__,i.__chain__);return o.__actions__=mt(i.__actions__),o.__index__=i.__index__,o.__values__=i.__values__,o}function _1(i,o,h){(h?ht(i,o,h):o===e)?o=1:o=Ne(pe(o),0);var g=i==null?0:i.length;if(!g||o<1)return[];for(var w=0,M=0,Z=z(Hi(g/o));w<g;)Z[M++]=Dt(i,w,w+=o);return Z}function M1(i){for(var o=-1,h=i==null?0:i.length,g=0,w=[];++o<h;){var M=i[o];M&&(w[g++]=M)}return w}function L1(){var i=arguments.length;if(!i)return[];for(var o=z(i-1),h=arguments[0],g=i;g--;)o[g-1]=arguments[g];return Vn(fe(h)?mt(h):[h],rt(o,1))}var S1=ye(function(i,o){return Oe(i)?si(i,rt(o,1,Oe,!0)):[]}),T1=ye(function(i,o){var h=zt(o);return Oe(h)&&(h=e),Oe(i)?si(i,rt(o,1,Oe,!0),ae(h,2)):[]}),G1=ye(function(i,o){var h=zt(o);return Oe(h)&&(h=e),Oe(i)?si(i,rt(o,1,Oe,!0),e,h):[]});function Z1(i,o,h){var g=i==null?0:i.length;return g?(o=h||o===e?1:pe(o),Dt(i,o<0?0:o,g)):[]}function I1(i,o,h){var g=i==null?0:i.length;return g?(o=h||o===e?1:pe(o),o=g-o,Dt(i,0,o<0?0:o)):[]}function W1(i,o){return i&&i.length?os(i,ae(o,3),!0,!0):[]}function P1(i,o){return i&&i.length?os(i,ae(o,3),!0):[]}function C1(i,o,h,g){var w=i==null?0:i.length;return w?(h&&typeof h!="number"&&ht(i,o,h)&&(h=0,g=w),Ly(i,o,h,g)):[]}function qu(i,o,h){var g=i==null?0:i.length;if(!g)return-1;var w=h==null?0:pe(h);return w<0&&(w=Ne(g+w,0)),zi(i,ae(o,3),w)}function $u(i,o,h){var g=i==null?0:i.length;if(!g)return-1;var w=g-1;return h!==e&&(w=pe(h),w=h<0?Ne(g+w,0):st(w,g-1)),zi(i,ae(o,3),w,!0)}function eh(i){var o=i==null?0:i.length;return o?rt(i,1):[]}function V1(i){var o=i==null?0:i.length;return o?rt(i,oe):[]}function A1(i,o){var h=i==null?0:i.length;return h?(o=o===e?1:pe(o),rt(i,o)):[]}function F1(i){for(var o=-1,h=i==null?0:i.length,g={};++o<h;){var w=i[o];g[w[0]]=w[1]}return g}function th(i){return i&&i.length?i[0]:e}function X1(i,o,h){var g=i==null?0:i.length;if(!g)return-1;var w=h==null?0:pe(h);return w<0&&(w=Ne(g+w,0)),wr(i,o,w)}function k1(i){var o=i==null?0:i.length;return o?Dt(i,0,-1):[]}var D1=ye(function(i){var o=Ve(i,ta);return o.length&&o[0]===i[0]?Bo(o):[]}),z1=ye(function(i){var o=zt(i),h=Ve(i,ta);return o===zt(h)?o=e:h.pop(),h.length&&h[0]===i[0]?Bo(h,ae(o,2)):[]}),O1=ye(function(i){var o=zt(i),h=Ve(i,ta);return o=typeof o=="function"?o:e,o&&h.pop(),h.length&&h[0]===i[0]?Bo(h,e,o):[]});function K1(i,o){return i==null?"":kg.call(i,o)}function zt(i){var o=i==null?0:i.length;return o?i[o-1]:e}function R1(i,o,h){var g=i==null?0:i.length;if(!g)return-1;var w=g;return h!==e&&(w=pe(h),w=w<0?Ne(g+w,0):st(w,g-1)),o===o?xg(i,o,w):zi(i,Fc,w,!0)}function Y1(i,o){return i&&i.length?du(i,pe(o)):e}var U1=ye(nh);function nh(i,o){return i&&i.length&&o&&o.length?Qo(i,o):i}function B1(i,o,h){return i&&i.length&&o&&o.length?Qo(i,o,ae(h,2)):i}function N1(i,o,h){return i&&i.length&&o&&o.length?Qo(i,o,e,h):i}var j1=gn(function(i,o){var h=i==null?0:i.length,g=Ko(i,o);return mu(i,Ve(o,function(w){return yn(w,h)?+w:w}).sort(Su)),g});function J1(i,o){var h=[];if(!(i&&i.length))return h;var g=-1,w=[],M=i.length;for(o=ae(o,3);++g<M;){var Z=i[g];o(Z,g,i)&&(h.push(Z),w.push(g))}return mu(i,w),h}function ma(i){return i==null?i:Kg.call(i)}function Q1(i,o,h){var g=i==null?0:i.length;return g?(h&&typeof h!="number"&&ht(i,o,h)?(o=0,h=g):(o=o==null?0:pe(o),h=h===e?g:pe(h)),Dt(i,o,h)):[]}function H1(i,o){return ss(i,o)}function E1(i,o,h){return qo(i,o,ae(h,2))}function q1(i,o){var h=i==null?0:i.length;if(h){var g=ss(i,o);if(g<h&&Ht(i[g],o))return g}return-1}function $1(i,o){return ss(i,o,!0)}function ev(i,o,h){return qo(i,o,ae(h,2),!0)}function tv(i,o){var h=i==null?0:i.length;if(h){var g=ss(i,o,!0)-1;if(Ht(i[g],o))return g}return-1}function nv(i){return i&&i.length?yu(i):[]}function rv(i,o){return i&&i.length?yu(i,ae(o,2)):[]}function iv(i){var o=i==null?0:i.length;return o?Dt(i,1,o):[]}function sv(i,o,h){return i&&i.length?(o=h||o===e?1:pe(o),Dt(i,0,o<0?0:o)):[]}function ov(i,o,h){var g=i==null?0:i.length;return g?(o=h||o===e?1:pe(o),o=g-o,Dt(i,o<0?0:o,g)):[]}function av(i,o){return i&&i.length?os(i,ae(o,3),!1,!0):[]}function lv(i,o){return i&&i.length?os(i,ae(o,3)):[]}var cv=ye(function(i){return kn(rt(i,1,Oe,!0))}),uv=ye(function(i){var o=zt(i);return Oe(o)&&(o=e),kn(rt(i,1,Oe,!0),ae(o,2))}),hv=ye(function(i){var o=zt(i);return o=typeof o=="function"?o:e,kn(rt(i,1,Oe,!0),e,o)});function dv(i){return i&&i.length?kn(i):[]}function fv(i,o){return i&&i.length?kn(i,ae(o,2)):[]}function pv(i,o){return o=typeof o=="function"?o:e,i&&i.length?kn(i,e,o):[]}function ga(i){if(!(i&&i.length))return[];var o=0;return i=Cn(i,function(h){if(Oe(h))return o=Ne(h.length,o),!0}),Vo(o,function(h){return Ve(i,Wo(h))})}function rh(i,o){if(!(i&&i.length))return[];var h=ga(i);return o==null?h:Ve(h,function(g){return xt(o,e,g)})}var mv=ye(function(i,o){return Oe(i)?si(i,o):[]}),gv=ye(function(i){return ea(Cn(i,Oe))}),yv=ye(function(i){var o=zt(i);return Oe(o)&&(o=e),ea(Cn(i,Oe),ae(o,2))}),vv=ye(function(i){var o=zt(i);return o=typeof o=="function"?o:e,ea(Cn(i,Oe),e,o)}),wv=ye(ga);function bv(i,o){return xu(i||[],o||[],ii)}function xv(i,o){return xu(i||[],o||[],li)}var _v=ye(function(i){var o=i.length,h=o>1?i[o-1]:e;return h=typeof h=="function"?(i.pop(),h):e,rh(i,h)});function ih(i){var o=x(i);return o.__chain__=!0,o}function Mv(i,o){return o(i),i}function ms(i,o){return o(i)}var Lv=gn(function(i){var o=i.length,h=o?i[0]:0,g=this.__wrapped__,w=function(M){return Ko(M,i)};return o>1||this.__actions__.length||!(g instanceof Me)||!yn(h)?this.thru(w):(g=g.slice(h,+h+(o?1:0)),g.__actions__.push({func:ms,args:[w],thisArg:e}),new Xt(g,this.__chain__).thru(function(M){return o&&!M.length&&M.push(e),M}))});function Sv(){return ih(this)}function Tv(){return new Xt(this.value(),this.__chain__)}function Gv(){this.__values__===e&&(this.__values__=vh(this.value()));var i=this.__index__>=this.__values__.length,o=i?e:this.__values__[this.__index__++];return{done:i,value:o}}function Zv(){return this}function Iv(i){for(var o,h=this;h instanceof es;){var g=Eu(h);g.__index__=0,g.__values__=e,o?w.__wrapped__=g:o=g;var w=g;h=h.__wrapped__}return w.__wrapped__=i,o}function Wv(){var i=this.__wrapped__;if(i instanceof Me){var o=i;return this.__actions__.length&&(o=new Me(this)),o=o.reverse(),o.__actions__.push({func:ms,args:[ma],thisArg:e}),new Xt(o,this.__chain__)}return this.thru(ma)}function Pv(){return bu(this.__wrapped__,this.__actions__)}var Cv=as(function(i,o,h){Ze.call(i,h)?++i[h]:pn(i,h,1)});function Vv(i,o,h){var g=fe(i)?Vc:My;return h&&ht(i,o,h)&&(o=e),g(i,ae(o,3))}function Av(i,o){var h=fe(i)?Cn:ru;return h(i,ae(o,3))}var Fv=Pu(qu),Xv=Pu($u);function kv(i,o){return rt(gs(i,o),1)}function Dv(i,o){return rt(gs(i,o),oe)}function zv(i,o,h){return h=h===e?1:pe(h),rt(gs(i,o),h)}function sh(i,o){var h=fe(i)?At:Xn;return h(i,ae(o,3))}function oh(i,o){var h=fe(i)?ig:nu;return h(i,ae(o,3))}var Ov=as(function(i,o,h){Ze.call(i,h)?i[h].push(o):pn(i,h,[o])});function Kv(i,o,h,g){i=gt(i)?i:Pr(i),h=h&&!g?pe(h):0;var w=i.length;return h<0&&(h=Ne(w+h,0)),xs(i)?h<=w&&i.indexOf(o,h)>-1:!!w&&wr(i,o,h)>-1}var Rv=ye(function(i,o,h){var g=-1,w=typeof o=="function",M=gt(i)?z(i.length):[];return Xn(i,function(Z){M[++g]=w?xt(o,Z,h):oi(Z,o,h)}),M}),Yv=as(function(i,o,h){pn(i,h,o)});function gs(i,o){var h=fe(i)?Ve:cu;return h(i,ae(o,3))}function Uv(i,o,h,g){return i==null?[]:(fe(o)||(o=o==null?[]:[o]),h=g?e:h,fe(h)||(h=h==null?[]:[h]),fu(i,o,h))}var Bv=as(function(i,o,h){i[h?0:1].push(o)},function(){return[[],[]]});function Nv(i,o,h){var g=fe(i)?Zo:kc,w=arguments.length<3;return g(i,ae(o,4),h,w,Xn)}function jv(i,o,h){var g=fe(i)?sg:kc,w=arguments.length<3;return g(i,ae(o,4),h,w,nu)}function Jv(i,o){var h=fe(i)?Cn:ru;return h(i,ws(ae(o,3)))}function Qv(i){var o=fe(i)?qc:Ky;return o(i)}function Hv(i,o,h){(h?ht(i,o,h):o===e)?o=1:o=pe(o);var g=fe(i)?vy:Ry;return g(i,o)}function Ev(i){var o=fe(i)?wy:Uy;return o(i)}function qv(i){if(i==null)return 0;if(gt(i))return xs(i)?xr(i):i.length;var o=ot(i);return o==Ae||o==bt?i.size:jo(i).length}function $v(i,o,h){var g=fe(i)?Io:By;return h&&ht(i,o,h)&&(o=e),g(i,ae(o,3))}var ew=ye(function(i,o){if(i==null)return[];var h=o.length;return h>1&&ht(i,o[0],o[1])?o=[]:h>2&&ht(o[0],o[1],o[2])&&(o=[o[0]]),fu(i,rt(o,1),[])}),ys=Ag||function(){return nt.Date.now()};function tw(i,o){if(typeof o!="function")throw new Ft(l);return i=pe(i),function(){if(--i<1)return o.apply(this,arguments)}}function ah(i,o,h){return o=h?e:o,o=i&&o==null?i.length:o,mn(i,O,e,e,e,e,o)}function lh(i,o){var h;if(typeof o!="function")throw new Ft(l);return i=pe(i),function(){return--i>0&&(h=o.apply(this,arguments)),i<=1&&(o=e),h}}var ya=ye(function(i,o,h){var g=_;if(h.length){var w=An(h,Ir(ya));g|=K}return mn(i,g,o,h,w)}),ch=ye(function(i,o,h){var g=_|S;if(h.length){var w=An(h,Ir(ch));g|=K}return mn(o,g,i,h,w)});function uh(i,o,h){o=h?e:o;var g=mn(i,I,e,e,e,e,e,o);return g.placeholder=uh.placeholder,g}function hh(i,o,h){o=h?e:o;var g=mn(i,F,e,e,e,e,e,o);return g.placeholder=hh.placeholder,g}function dh(i,o,h){var g,w,M,Z,W,A,U=0,B=!1,j=!1,$=!0;if(typeof i!="function")throw new Ft(l);o=Ot(o)||0,Fe(h)&&(B=!!h.leading,j="maxWait"in h,M=j?Ne(Ot(h.maxWait)||0,o):M,$="trailing"in h?!!h.trailing:$);function re(Ke){var Et=g,bn=w;return g=w=e,U=Ke,Z=i.apply(bn,Et),Z}function le(Ke){return U=Ke,W=hi(_e,o),B?re(Ke):Z}function ge(Ke){var Et=Ke-A,bn=Ke-U,Ph=o-Et;return j?st(Ph,M-bn):Ph}function ce(Ke){var Et=Ke-A,bn=Ke-U;return A===e||Et>=o||Et<0||j&&bn>=M}function _e(){var Ke=ys();if(ce(Ke))return Le(Ke);W=hi(_e,ge(Ke))}function Le(Ke){return W=e,$&&g?re(Ke):(g=w=e,Z)}function St(){W!==e&&_u(W),U=0,g=A=w=W=e}function dt(){return W===e?Z:Le(ys())}function Tt(){var Ke=ys(),Et=ce(Ke);if(g=arguments,w=this,A=Ke,Et){if(W===e)return le(A);if(j)return _u(W),W=hi(_e,o),re(A)}return W===e&&(W=hi(_e,o)),Z}return Tt.cancel=St,Tt.flush=dt,Tt}var nw=ye(function(i,o){return tu(i,1,o)}),rw=ye(function(i,o,h){return tu(i,Ot(o)||0,h)});function iw(i){return mn(i,R)}function vs(i,o){if(typeof i!="function"||o!=null&&typeof o!="function")throw new Ft(l);var h=function(){var g=arguments,w=o?o.apply(this,g):g[0],M=h.cache;if(M.has(w))return M.get(w);var Z=i.apply(this,g);return h.cache=M.set(w,Z)||M,Z};return h.cache=new(vs.Cache||fn),h}vs.Cache=fn;function ws(i){if(typeof i!="function")throw new Ft(l);return function(){var o=arguments;switch(o.length){case 0:return!i.call(this);case 1:return!i.call(this,o[0]);case 2:return!i.call(this,o[0],o[1]);case 3:return!i.call(this,o[0],o[1],o[2])}return!i.apply(this,o)}}function sw(i){return lh(2,i)}var ow=Ny(function(i,o){o=o.length==1&&fe(o[0])?Ve(o[0],_t(ae())):Ve(rt(o,1),_t(ae()));var h=o.length;return ye(function(g){for(var w=-1,M=st(g.length,h);++w<M;)g[w]=o[w].call(this,g[w]);return xt(i,this,g)})}),va=ye(function(i,o){var h=An(o,Ir(va));return mn(i,K,e,o,h)}),fh=ye(function(i,o){var h=An(o,Ir(fh));return mn(i,D,e,o,h)}),aw=gn(function(i,o){return mn(i,V,e,e,e,o)});function lw(i,o){if(typeof i!="function")throw new Ft(l);return o=o===e?o:pe(o),ye(i,o)}function cw(i,o){if(typeof i!="function")throw new Ft(l);return o=o==null?0:Ne(pe(o),0),ye(function(h){var g=h[o],w=zn(h,0,o);return g&&Vn(w,g),xt(i,this,w)})}function uw(i,o,h){var g=!0,w=!0;if(typeof i!="function")throw new Ft(l);return Fe(h)&&(g="leading"in h?!!h.leading:g,w="trailing"in h?!!h.trailing:w),dh(i,o,{leading:g,maxWait:o,trailing:w})}function hw(i){return ah(i,1)}function dw(i,o){return va(na(o),i)}function fw(){if(!arguments.length)return[];var i=arguments[0];return fe(i)?i:[i]}function pw(i){return kt(i,v)}function mw(i,o){return o=typeof o=="function"?o:e,kt(i,v,o)}function gw(i){return kt(i,f|v)}function yw(i,o){return o=typeof o=="function"?o:e,kt(i,f|v,o)}function vw(i,o){return o==null||eu(i,o,He(o))}function Ht(i,o){return i===o||i!==i&&o!==o}var ww=hs(Uo),bw=hs(function(i,o){return i>=o}),or=ou(function(){return arguments}())?ou:function(i){return De(i)&&Ze.call(i,"callee")&&!Nc.call(i,"callee")},fe=z.isArray,xw=Gc?_t(Gc):Iy;function gt(i){return i!=null&&bs(i.length)&&!vn(i)}function Oe(i){return De(i)&>(i)}function _w(i){return i===!0||i===!1||De(i)&&ut(i)==Qe}var On=Xg||Ia,Mw=Zc?_t(Zc):Wy;function Lw(i){return De(i)&&i.nodeType===1&&!di(i)}function Sw(i){if(i==null)return!0;if(gt(i)&&(fe(i)||typeof i=="string"||typeof i.splice=="function"||On(i)||Wr(i)||or(i)))return!i.length;var o=ot(i);if(o==Ae||o==bt)return!i.size;if(ui(i))return!jo(i).length;for(var h in i)if(Ze.call(i,h))return!1;return!0}function Tw(i,o){return ai(i,o)}function Gw(i,o,h){h=typeof h=="function"?h:e;var g=h?h(i,o):e;return g===e?ai(i,o,e,h):!!g}function wa(i){if(!De(i))return!1;var o=ut(i);return o==Ue||o==pt||typeof i.message=="string"&&typeof i.name=="string"&&!di(i)}function Zw(i){return typeof i=="number"&&Jc(i)}function vn(i){if(!Fe(i))return!1;var o=ut(i);return o==hn||o==Gn||o==Je||o==Vi}function ph(i){return typeof i=="number"&&i==pe(i)}function bs(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=ie}function Fe(i){var o=typeof i;return i!=null&&(o=="object"||o=="function")}function De(i){return i!=null&&typeof i=="object"}var mh=Ic?_t(Ic):Cy;function Iw(i,o){return i===o||No(i,o,ca(o))}function Ww(i,o,h){return h=typeof h=="function"?h:e,No(i,o,ca(o),h)}function Pw(i){return gh(i)&&i!=+i}function Cw(i){if(m1(i))throw new de(s);return au(i)}function Vw(i){return i===null}function Aw(i){return i==null}function gh(i){return typeof i=="number"||De(i)&&ut(i)==Ut}function di(i){if(!De(i)||ut(i)!=Pt)return!1;var o=ji(i);if(o===null)return!0;var h=Ze.call(o,"constructor")&&o.constructor;return typeof h=="function"&&h instanceof h&&Yi.call(h)==Wg}var ba=Wc?_t(Wc):Vy;function Fw(i){return ph(i)&&i>=-ie&&i<=ie}var yh=Pc?_t(Pc):Ay;function xs(i){return typeof i=="string"||!fe(i)&&De(i)&&ut(i)==Zn}function Lt(i){return typeof i=="symbol"||De(i)&&ut(i)==In}var Wr=Cc?_t(Cc):Fy;function Xw(i){return i===e}function kw(i){return De(i)&&ot(i)==Jn}function Dw(i){return De(i)&&ut(i)==yo}var zw=hs(Jo),Ow=hs(function(i,o){return i<=o});function vh(i){if(!i)return[];if(gt(i))return xs(i)?Jt(i):mt(i);if($r&&i[$r])return vg(i[$r]());var o=ot(i),h=o==Ae?Fo:o==bt?Oi:Pr;return h(i)}function wn(i){if(!i)return i===0?i:0;if(i=Ot(i),i===oe||i===-oe){var o=i<0?-1:1;return o*te}return i===i?i:0}function pe(i){var o=wn(i),h=o%1;return o===o?h?o-h:o:0}function wh(i){return i?nr(pe(i),0,xe):0}function Ot(i){if(typeof i=="number")return i;if(Lt(i))return me;if(Fe(i)){var o=typeof i.valueOf=="function"?i.valueOf():i;i=Fe(o)?o+"":o}if(typeof i!="string")return i===0?i:+i;i=Dc(i);var h=x0.test(i);return h||M0.test(i)?tg(i.slice(2),h?2:8):b0.test(i)?me:+i}function bh(i){return an(i,yt(i))}function Kw(i){return i?nr(pe(i),-ie,ie):i===0?i:0}function Ge(i){return i==null?"":Mt(i)}var Rw=Gr(function(i,o){if(ui(o)||gt(o)){an(o,He(o),i);return}for(var h in o)Ze.call(o,h)&&ii(i,h,o[h])}),xh=Gr(function(i,o){an(o,yt(o),i)}),_s=Gr(function(i,o,h,g){an(o,yt(o),i,g)}),Yw=Gr(function(i,o,h,g){an(o,He(o),i,g)}),Uw=gn(Ko);function Bw(i,o){var h=Tr(i);return o==null?h:$c(h,o)}var Nw=ye(function(i,o){i=Ie(i);var h=-1,g=o.length,w=g>2?o[2]:e;for(w&&ht(o[0],o[1],w)&&(g=1);++h<g;)for(var M=o[h],Z=yt(M),W=-1,A=Z.length;++W<A;){var U=Z[W],B=i[U];(B===e||Ht(B,Mr[U])&&!Ze.call(i,U))&&(i[U]=M[U])}return i}),jw=ye(function(i){return i.push(e,Du),xt(_h,e,i)});function Jw(i,o){return Ac(i,ae(o,3),on)}function Qw(i,o){return Ac(i,ae(o,3),Yo)}function Hw(i,o){return i==null?i:Ro(i,ae(o,3),yt)}function Ew(i,o){return i==null?i:iu(i,ae(o,3),yt)}function qw(i,o){return i&&on(i,ae(o,3))}function $w(i,o){return i&&Yo(i,ae(o,3))}function eb(i){return i==null?[]:rs(i,He(i))}function tb(i){return i==null?[]:rs(i,yt(i))}function xa(i,o,h){var g=i==null?e:rr(i,o);return g===e?h:g}function nb(i,o){return i!=null&&Ku(i,o,Sy)}function _a(i,o){return i!=null&&Ku(i,o,Ty)}var rb=Vu(function(i,o,h){o!=null&&typeof o.toString!="function"&&(o=Ui.call(o)),i[o]=h},La(vt)),ib=Vu(function(i,o,h){o!=null&&typeof o.toString!="function"&&(o=Ui.call(o)),Ze.call(i,o)?i[o].push(h):i[o]=[h]},ae),sb=ye(oi);function He(i){return gt(i)?Ec(i):jo(i)}function yt(i){return gt(i)?Ec(i,!0):Xy(i)}function ob(i,o){var h={};return o=ae(o,3),on(i,function(g,w,M){pn(h,o(g,w,M),g)}),h}function ab(i,o){var h={};return o=ae(o,3),on(i,function(g,w,M){pn(h,w,o(g,w,M))}),h}var lb=Gr(function(i,o,h){is(i,o,h)}),_h=Gr(function(i,o,h,g){is(i,o,h,g)}),cb=gn(function(i,o){var h={};if(i==null)return h;var g=!1;o=Ve(o,function(M){return M=Dn(M,i),g||(g=M.length>1),M}),an(i,aa(i),h),g&&(h=kt(h,f|y|v,r1));for(var w=o.length;w--;)$o(h,o[w]);return h});function ub(i,o){return Mh(i,ws(ae(o)))}var hb=gn(function(i,o){return i==null?{}:Dy(i,o)});function Mh(i,o){if(i==null)return{};var h=Ve(aa(i),function(g){return[g]});return o=ae(o),pu(i,h,function(g,w){return o(g,w[0])})}function db(i,o,h){o=Dn(o,i);var g=-1,w=o.length;for(w||(w=1,i=e);++g<w;){var M=i==null?e:i[ln(o[g])];M===e&&(g=w,M=h),i=vn(M)?M.call(i):M}return i}function fb(i,o,h){return i==null?i:li(i,o,h)}function pb(i,o,h,g){return g=typeof g=="function"?g:e,i==null?i:li(i,o,h,g)}var Lh=Xu(He),Sh=Xu(yt);function mb(i,o,h){var g=fe(i),w=g||On(i)||Wr(i);if(o=ae(o,4),h==null){var M=i&&i.constructor;w?h=g?new M:[]:Fe(i)?h=vn(M)?Tr(ji(i)):{}:h={}}return(w?At:on)(i,function(Z,W,A){return o(h,Z,W,A)}),h}function gb(i,o){return i==null?!0:$o(i,o)}function yb(i,o,h){return i==null?i:wu(i,o,na(h))}function vb(i,o,h,g){return g=typeof g=="function"?g:e,i==null?i:wu(i,o,na(h),g)}function Pr(i){return i==null?[]:Ao(i,He(i))}function wb(i){return i==null?[]:Ao(i,yt(i))}function bb(i,o,h){return h===e&&(h=o,o=e),h!==e&&(h=Ot(h),h=h===h?h:0),o!==e&&(o=Ot(o),o=o===o?o:0),nr(Ot(i),o,h)}function xb(i,o,h){return o=wn(o),h===e?(h=o,o=0):h=wn(h),i=Ot(i),Gy(i,o,h)}function _b(i,o,h){if(h&&typeof h!="boolean"&&ht(i,o,h)&&(o=h=e),h===e&&(typeof o=="boolean"?(h=o,o=e):typeof i=="boolean"&&(h=i,i=e)),i===e&&o===e?(i=0,o=1):(i=wn(i),o===e?(o=i,i=0):o=wn(o)),i>o){var g=i;i=o,o=g}if(h||i%1||o%1){var w=Qc();return st(i+w*(o-i+eg("1e-"+((w+"").length-1))),o)}return Ho(i,o)}var Mb=Zr(function(i,o,h){return o=o.toLowerCase(),i+(h?Th(o):o)});function Th(i){return Ma(Ge(i).toLowerCase())}function Gh(i){return i=Ge(i),i&&i.replace(S0,fg).replace(U0,"")}function Lb(i,o,h){i=Ge(i),o=Mt(o);var g=i.length;h=h===e?g:nr(pe(h),0,g);var w=h;return h-=o.length,h>=0&&i.slice(h,w)==o}function Sb(i){return i=Ge(i),i&&Ai.test(i)?i.replace(Bt,pg):i}function Tb(i){return i=Ge(i),i&&h0.test(i)?i.replace(vo,"\\$&"):i}var Gb=Zr(function(i,o,h){return i+(h?"-":"")+o.toLowerCase()}),Zb=Zr(function(i,o,h){return i+(h?" ":"")+o.toLowerCase()}),Ib=Wu("toLowerCase");function Wb(i,o,h){i=Ge(i),o=pe(o);var g=o?xr(i):0;if(!o||g>=o)return i;var w=(o-g)/2;return us(Ei(w),h)+i+us(Hi(w),h)}function Pb(i,o,h){i=Ge(i),o=pe(o);var g=o?xr(i):0;return o&&g<o?i+us(o-g,h):i}function Cb(i,o,h){i=Ge(i),o=pe(o);var g=o?xr(i):0;return o&&g<o?us(o-g,h)+i:i}function Vb(i,o,h){return h||o==null?o=0:o&&(o=+o),Og(Ge(i).replace(wo,""),o||0)}function Ab(i,o,h){return(h?ht(i,o,h):o===e)?o=1:o=pe(o),Eo(Ge(i),o)}function Fb(){var i=arguments,o=Ge(i[0]);return i.length<3?o:o.replace(i[1],i[2])}var Xb=Zr(function(i,o,h){return i+(h?"_":"")+o.toLowerCase()});function kb(i,o,h){return h&&typeof h!="number"&&ht(i,o,h)&&(o=h=e),h=h===e?xe:h>>>0,h?(i=Ge(i),i&&(typeof o=="string"||o!=null&&!ba(o))&&(o=Mt(o),!o&&br(i))?zn(Jt(i),0,h):i.split(o,h)):[]}var Db=Zr(function(i,o,h){return i+(h?" ":"")+Ma(o)});function zb(i,o,h){return i=Ge(i),h=h==null?0:nr(pe(h),0,i.length),o=Mt(o),i.slice(h,h+o.length)==o}function Ob(i,o,h){var g=x.templateSettings;h&&ht(i,o,h)&&(o=e),i=Ge(i),o=_s({},o,g,ku);var w=_s({},o.imports,g.imports,ku),M=He(w),Z=Ao(w,M),W,A,U=0,B=o.interpolate||Fi,j="__p += '",$=Xo((o.escape||Fi).source+"|"+B.source+"|"+(B===Pn?w0:Fi).source+"|"+(o.evaluate||Fi).source+"|$","g"),re="//# sourceURL="+(Ze.call(o,"sourceURL")?(o.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Q0+"]")+`
|
|
549
549
|
`;i.replace($,function(ce,_e,Le,St,dt,Tt){return Le||(Le=St),j+=i.slice(U,Tt).replace(T0,mg),_e&&(W=!0,j+=`' +
|
|
550
550
|
__e(`+_e+`) +
|
|
551
551
|
'`),dt&&(A=!0,j+=`';
|
|
@@ -562,7 +562,7 @@ __p += '`),Le&&(j+=`' +
|
|
|
562
562
|
function print() { __p += __j.call(arguments, '') }
|
|
563
563
|
`:`;
|
|
564
564
|
`)+j+`return __p
|
|
565
|
-
}`;var ge=Ih(function(){return Te(M,re+"return "+j).apply(e,Z)});if(ge.source=j,wa(ge))throw ge;return ge}function Kb(i){return Ge(i).toLowerCase()}function Rb(i){return Ge(i).toUpperCase()}function Yb(i,o,h){if(i=Ge(i),i&&(h||o===e))return Dc(i);if(!i||!(o=Mt(o)))return i;var g=Jt(i),w=Jt(o),M=zc(g,w),Z=Oc(g,w)+1;return Dn(g,M,Z).join("")}function Ub(i,o,h){if(i=Ge(i),i&&(h||o===e))return i.slice(0,Rc(i)+1);if(!i||!(o=Mt(o)))return i;var g=Jt(i),w=Oc(g,Jt(o))+1;return Dn(g,0,w).join("")}function Bb(i,o,h){if(i=Ge(i),i&&(h||o===e))return i.replace(wo,"");if(!i||!(o=Mt(o)))return i;var g=Jt(i),w=zc(g,Jt(o));return Dn(g,w).join("")}function Nb(i,o){var h=P,g=k;if(Fe(o)){var w="separator"in o?o.separator:w;h="length"in o?pe(o.length):h,g="omission"in o?Mt(o.omission):g}i=Ge(i);var M=i.length;if(br(i)){var Z=Jt(i);M=Z.length}if(h>=M)return i;var W=h-xr(g);if(W<1)return g;var A=Z?Dn(Z,0,W).join(""):i.slice(0,W);if(w===e)return A+g;if(Z&&(W+=A.length-W),ba(w)){if(i.slice(W).search(w)){var U,B=A;for(w.global||(w=Xo(w.source,Ge(oc.exec(w))+"g")),w.lastIndex=0;U=w.exec(B);)var j=U.index;A=A.slice(0,j===e?W:j)}}else if(i.indexOf(Mt(w),W)!=W){var $=A.lastIndexOf(w);$>-1&&(A=A.slice(0,$))}return A+g}function jb(i){return i=Ge(i),i&&sc.test(i)?i.replace(Pt,_g):i}var Jb=Zr(function(i,o,h){return i+(h?" ":"")+o.toUpperCase()}),Ma=Wu("toUpperCase");function Zh(i,o,h){return i=Ge(i),o=h?e:o,o===e?yg(i)?Sg(i):lg(i):i.match(o)||[]}var Ih=ye(function(i,o){try{return xt(i,e,o)}catch(h){return wa(h)?h:new de(h)}}),Qb=gn(function(i,o){return Vt(o,function(h){h=ln(h),pn(i,h,ya(i[h],i))}),i});function Hb(i){var o=i==null?0:i.length,h=ae();return i=o?Ve(i,function(g){if(typeof g[1]!="function")throw new At(l);return[h(g[0]),g[1]]}):[],ye(function(g){for(var w=-1;++w<o;){var M=i[w];if(xt(M[0],this,g))return xt(M[1],this,g)}})}function Eb(i){return _y(Xt(i,f))}function La(i){return function(){return i}}function qb(i,o){return i==null||i!==i?o:i}var $b=Cu(),ex=Cu(!0);function vt(i){return i}function Sa(i){return lu(typeof i=="function"?i:Xt(i,f))}function tx(i){return uu(Xt(i,f))}function nx(i,o){return hu(i,Xt(o,f))}var rx=ye(function(i,o){return function(h){return oi(h,i,o)}}),ix=ye(function(i,o){return function(h){return oi(i,h,o)}});function Ta(i,o,h){var g=He(o),w=rs(o,g);h==null&&!(Fe(o)&&(w.length||!g.length))&&(h=o,o=i,i=this,w=rs(o,He(o)));var M=!(Fe(h)&&"chain"in h)||!!h.chain,Z=vn(i);return Vt(w,function(W){var A=o[W];i[W]=A,Z&&(i.prototype[W]=function(){var U=this.__chain__;if(M||U){var B=i(this.__wrapped__),j=B.__actions__=mt(this.__actions__);return j.push({func:A,args:arguments,thisArg:i}),B.__chain__=U,B}return A.apply(i,Cn([this.value()],arguments))})}),i}function sx(){return nt._===this&&(nt._=Pg),this}function Ga(){}function ox(i){return i=pe(i),ye(function(o){return du(o,i)})}var ax=ia(Ve),lx=ia(Vc),cx=ia(Io);function Wh(i){return ha(i)?Wo(ln(i)):zy(i)}function ux(i){return function(o){return i==null?e:rr(i,o)}}var hx=Au(),dx=Au(!0);function Za(){return[]}function Ia(){return!1}function fx(){return{}}function px(){return""}function mx(){return!0}function gx(i,o){if(i=pe(i),i<1||i>ie)return[];var h=xe,g=st(i,xe);o=ae(o),i-=xe;for(var w=Vo(g,o);++h<i;)o(h);return w}function yx(i){return fe(i)?Ve(i,ln):Lt(i)?[i]:mt(Hu(Ge(i)))}function vx(i){var o=++Ig;return Ge(i)+o}var wx=cs(function(i,o){return i+o},0),bx=sa("ceil"),xx=cs(function(i,o){return i/o},1),_x=sa("floor");function Mx(i){return i&&i.length?ns(i,vt,Uo):e}function Lx(i,o){return i&&i.length?ns(i,ae(o,2),Uo):e}function Sx(i){return Xc(i,vt)}function Tx(i,o){return Xc(i,ae(o,2))}function Gx(i){return i&&i.length?ns(i,vt,Jo):e}function Zx(i,o){return i&&i.length?ns(i,ae(o,2),Jo):e}var Ix=cs(function(i,o){return i*o},1),Wx=sa("round"),Px=cs(function(i,o){return i-o},0);function Cx(i){return i&&i.length?Co(i,vt):0}function Vx(i,o){return i&&i.length?Co(i,ae(o,2)):0}return x.after=tw,x.ary=ah,x.assign=Rw,x.assignIn=xh,x.assignInWith=_s,x.assignWith=Yw,x.at=Uw,x.before=lh,x.bind=ya,x.bindAll=Qb,x.bindKey=ch,x.castArray=fw,x.chain=ih,x.chunk=_1,x.compact=M1,x.concat=L1,x.cond=Hb,x.conforms=Eb,x.constant=La,x.countBy=Cv,x.create=Bw,x.curry=uh,x.curryRight=hh,x.debounce=dh,x.defaults=Nw,x.defaultsDeep=jw,x.defer=nw,x.delay=rw,x.difference=S1,x.differenceBy=T1,x.differenceWith=G1,x.drop=Z1,x.dropRight=I1,x.dropRightWhile=W1,x.dropWhile=P1,x.fill=C1,x.filter=Av,x.flatMap=kv,x.flatMapDeep=Dv,x.flatMapDepth=zv,x.flatten=eh,x.flattenDeep=V1,x.flattenDepth=A1,x.flip=iw,x.flow=$b,x.flowRight=ex,x.fromPairs=F1,x.functions=eb,x.functionsIn=tb,x.groupBy=Ov,x.initial=k1,x.intersection=D1,x.intersectionBy=z1,x.intersectionWith=O1,x.invert=rb,x.invertBy=ib,x.invokeMap=Rv,x.iteratee=Sa,x.keyBy=Yv,x.keys=He,x.keysIn=yt,x.map=gs,x.mapKeys=ob,x.mapValues=ab,x.matches=tx,x.matchesProperty=nx,x.memoize=vs,x.merge=lb,x.mergeWith=_h,x.method=rx,x.methodOf=ix,x.mixin=Ta,x.negate=ws,x.nthArg=ox,x.omit=cb,x.omitBy=ub,x.once=sw,x.orderBy=Uv,x.over=ax,x.overArgs=ow,x.overEvery=lx,x.overSome=cx,x.partial=va,x.partialRight=fh,x.partition=Bv,x.pick=hb,x.pickBy=Mh,x.property=Wh,x.propertyOf=ux,x.pull=U1,x.pullAll=nh,x.pullAllBy=B1,x.pullAllWith=N1,x.pullAt=j1,x.range=hx,x.rangeRight=dx,x.rearg=aw,x.reject=Jv,x.remove=J1,x.rest=lw,x.reverse=ma,x.sampleSize=Hv,x.set=fb,x.setWith=pb,x.shuffle=Ev,x.slice=Q1,x.sortBy=ew,x.sortedUniq=nv,x.sortedUniqBy=rv,x.split=kb,x.spread=cw,x.tail=iv,x.take=sv,x.takeRight=ov,x.takeRightWhile=av,x.takeWhile=lv,x.tap=Mv,x.throttle=uw,x.thru=ms,x.toArray=vh,x.toPairs=Lh,x.toPairsIn=Sh,x.toPath=yx,x.toPlainObject=bh,x.transform=mb,x.unary=hw,x.union=cv,x.unionBy=uv,x.unionWith=hv,x.uniq=dv,x.uniqBy=fv,x.uniqWith=pv,x.unset=gb,x.unzip=ga,x.unzipWith=rh,x.update=yb,x.updateWith=vb,x.values=Pr,x.valuesIn=wb,x.without=mv,x.words=Zh,x.wrap=dw,x.xor=gv,x.xorBy=yv,x.xorWith=vv,x.zip=wv,x.zipObject=bv,x.zipObjectDeep=xv,x.zipWith=_v,x.entries=Lh,x.entriesIn=Sh,x.extend=xh,x.extendWith=_s,Ta(x,x),x.add=wx,x.attempt=Ih,x.camelCase=Mb,x.capitalize=Th,x.ceil=bx,x.clamp=bb,x.clone=pw,x.cloneDeep=gw,x.cloneDeepWith=yw,x.cloneWith=mw,x.conformsTo=vw,x.deburr=Gh,x.defaultTo=qb,x.divide=xx,x.endsWith=Lb,x.eq=Ht,x.escape=Sb,x.escapeRegExp=Tb,x.every=Vv,x.find=Fv,x.findIndex=qu,x.findKey=Jw,x.findLast=Xv,x.findLastIndex=$u,x.findLastKey=Qw,x.floor=_x,x.forEach=sh,x.forEachRight=oh,x.forIn=Hw,x.forInRight=Ew,x.forOwn=qw,x.forOwnRight=$w,x.get=xa,x.gt=ww,x.gte=bw,x.has=nb,x.hasIn=_a,x.head=th,x.identity=vt,x.includes=Kv,x.indexOf=X1,x.inRange=xb,x.invoke=sb,x.isArguments=or,x.isArray=fe,x.isArrayBuffer=xw,x.isArrayLike=gt,x.isArrayLikeObject=Oe,x.isBoolean=_w,x.isBuffer=zn,x.isDate=Mw,x.isElement=Lw,x.isEmpty=Sw,x.isEqual=Tw,x.isEqualWith=Gw,x.isError=wa,x.isFinite=Zw,x.isFunction=vn,x.isInteger=ph,x.isLength=bs,x.isMap=mh,x.isMatch=Iw,x.isMatchWith=Ww,x.isNaN=Pw,x.isNative=Cw,x.isNil=Aw,x.isNull=Vw,x.isNumber=gh,x.isObject=Fe,x.isObjectLike=De,x.isPlainObject=di,x.isRegExp=ba,x.isSafeInteger=Fw,x.isSet=yh,x.isString=xs,x.isSymbol=Lt,x.isTypedArray=Wr,x.isUndefined=Xw,x.isWeakMap=kw,x.isWeakSet=Dw,x.join=K1,x.kebabCase=Gb,x.last=Dt,x.lastIndexOf=R1,x.lowerCase=Zb,x.lowerFirst=Ib,x.lt=zw,x.lte=Ow,x.max=Mx,x.maxBy=Lx,x.mean=Sx,x.meanBy=Tx,x.min=Gx,x.minBy=Zx,x.stubArray=Za,x.stubFalse=Ia,x.stubObject=fx,x.stubString=px,x.stubTrue=mx,x.multiply=Ix,x.nth=Y1,x.noConflict=sx,x.noop=Ga,x.now=ys,x.pad=Wb,x.padEnd=Pb,x.padStart=Cb,x.parseInt=Vb,x.random=_b,x.reduce=Nv,x.reduceRight=jv,x.repeat=Ab,x.replace=Fb,x.result=db,x.round=Wx,x.runInContext=C,x.sample=Qv,x.size=qv,x.snakeCase=Xb,x.some=$v,x.sortedIndex=H1,x.sortedIndexBy=E1,x.sortedIndexOf=q1,x.sortedLastIndex=$1,x.sortedLastIndexBy=ev,x.sortedLastIndexOf=tv,x.startCase=Db,x.startsWith=zb,x.subtract=Px,x.sum=Cx,x.sumBy=Vx,x.template=Ob,x.times=gx,x.toFinite=wn,x.toInteger=pe,x.toLength=wh,x.toLower=Kb,x.toNumber=zt,x.toSafeInteger=Kw,x.toString=Ge,x.toUpper=Rb,x.trim=Yb,x.trimEnd=Ub,x.trimStart=Bb,x.truncate=Nb,x.unescape=jb,x.uniqueId=vx,x.upperCase=Jb,x.upperFirst=Ma,x.each=sh,x.eachRight=oh,x.first=th,Ta(x,function(){var i={};return on(x,function(o,h){Ze.call(x.prototype,h)||(i[h]=o)}),i}(),{chain:!1}),x.VERSION=n,Vt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(i){x[i].placeholder=x}),Vt(["drop","take"],function(i,o){Me.prototype[i]=function(h){h=h===e?1:Ne(pe(h),0);var g=this.__filtered__&&!o?new Me(this):this.clone();return g.__filtered__?g.__takeCount__=st(h,g.__takeCount__):g.__views__.push({size:st(h,xe),type:i+(g.__dir__<0?"Right":"")}),g},Me.prototype[i+"Right"]=function(h){return this.reverse()[i](h).reverse()}}),Vt(["filter","map","takeWhile"],function(i,o){var h=o+1,g=h==Q||h==J;Me.prototype[i]=function(w){var M=this.clone();return M.__iteratees__.push({iteratee:ae(w,3),type:h}),M.__filtered__=M.__filtered__||g,M}}),Vt(["head","last"],function(i,o){var h="take"+(o?"Right":"");Me.prototype[i]=function(){return this[h](1).value()[0]}}),Vt(["initial","tail"],function(i,o){var h="drop"+(o?"":"Right");Me.prototype[i]=function(){return this.__filtered__?new Me(this):this[h](1)}}),Me.prototype.compact=function(){return this.filter(vt)},Me.prototype.find=function(i){return this.filter(i).head()},Me.prototype.findLast=function(i){return this.reverse().find(i)},Me.prototype.invokeMap=ye(function(i,o){return typeof i=="function"?new Me(this):this.map(function(h){return oi(h,i,o)})}),Me.prototype.reject=function(i){return this.filter(ws(ae(i)))},Me.prototype.slice=function(i,o){i=pe(i);var h=this;return h.__filtered__&&(i>0||o<0)?new Me(h):(i<0?h=h.takeRight(-i):i&&(h=h.drop(i)),o!==e&&(o=pe(o),h=o<0?h.dropRight(-o):h.take(o-i)),h)},Me.prototype.takeRightWhile=function(i){return this.reverse().takeWhile(i).reverse()},Me.prototype.toArray=function(){return this.take(xe)},on(Me.prototype,function(i,o){var h=/^(?:filter|find|map|reject)|While$/.test(o),g=/^(?:head|last)$/.test(o),w=x[g?"take"+(o=="last"?"Right":""):o],M=g||/^find/.test(o);w&&(x.prototype[o]=function(){var Z=this.__wrapped__,W=g?[1]:arguments,A=Z instanceof Me,U=W[0],B=A||fe(Z),j=function(_e){var Le=w.apply(x,Cn([_e],W));return g&&$?Le[0]:Le};B&&h&&typeof U=="function"&&U.length!=1&&(A=B=!1);var $=this.__chain__,re=!!this.__actions__.length,le=M&&!$,ge=A&&!re;if(!M&&B){Z=ge?Z:new Me(this);var ce=i.apply(Z,W);return ce.__actions__.push({func:ms,args:[j],thisArg:e}),new Ft(ce,$)}return le&&ge?i.apply(this,W):(ce=this.thru(j),le?g?ce.value()[0]:ce.value():ce)})}),Vt(["pop","push","shift","sort","splice","unshift"],function(i){var o=Ki[i],h=/^(?:push|sort|unshift)$/.test(i)?"tap":"thru",g=/^(?:pop|shift)$/.test(i);x.prototype[i]=function(){var w=arguments;if(g&&!this.__chain__){var M=this.value();return o.apply(fe(M)?M:[],w)}return this[h](function(Z){return o.apply(fe(Z)?Z:[],w)})}}),on(Me.prototype,function(i,o){var h=x[o];if(h){var g=h.name+"";Ze.call(Sr,g)||(Sr[g]=[]),Sr[g].push({name:o,func:h})}}),Sr[ls(e,S).name]=[{name:"wrapper",func:e}],Me.prototype.clone=jg,Me.prototype.reverse=Jg,Me.prototype.value=Qg,x.prototype.at=Lv,x.prototype.chain=Sv,x.prototype.commit=Tv,x.prototype.next=Gv,x.prototype.plant=Iv,x.prototype.reverse=Wv,x.prototype.toJSON=x.prototype.valueOf=x.prototype.value=Pv,x.prototype.first=x.prototype.head,$r&&(x.prototype[$r]=Zv),x},_r=Tg();qn?((qn.exports=_r)._=_r,So._=_r):nt._=_r}).call(Yr)}(Ti,Ti.exports);var _p=Ti.exports;let Ur=class extends Yn{constructor(e){super(e);G(this,"_baseType","Point");this._threeGeometry=this._createThreeGeometry(),this._style&&this._style.applyTo(this._threeGeometry)}_coordsTransform(){const e=this.getMap(),n=new m.Vector3(this._geometry.coordinates[0],this._geometry.coordinates[1],this._geometry.coordinates[2]||0);return e?e.geo2world(n):n}_toThreeJSGeometry(){}_createThreeGeometry(){return new m.Points(new m.BufferGeometry,new m.PointsMaterial({size:1,color:8947848}))}};const Mp={};class no extends Ur{constructor(e){super(e);G(this,"_type","Maker")}async _toThreeJSGeometry(){this._position=this._coordsTransform(),this._style&&(this._threeGeometry&&this._disposeGeometry(),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}async _createObject(e){switch(e.config.type){case"basic-point":return xl(e.config,new m.Vector3(0,0,0));case"icon-point":return _l(e.config,this._position);case"icon-label-point":return Nf(e.config,this.getMap(),this._position);default:throw new Error(`不支持的样式类型: ${e.config.type}`)}}_calculateCollisionBoundingBox(e,n){if(!this.visible||!this._threeGeometry||!e||!n)return null;try{switch(this._style?.config.type){case"icon-point":return this._calculateSpriteBoundingBox(this._threeGeometry);default:return this._getFallbackBoundingBox()}}catch(r){return console.warn(`Maker ${this._id} 包围盒计算失败:`,r),this._getFallbackBoundingBox()}}_calculateSpriteBoundingBox(e){try{const r=Math.max(Math.abs(e.scale.x),Math.abs(e.scale.y))/.002;return console.log("Sprite尺寸估算:",{spriteScale:{x:e.scale.x,y:e.scale.y},计算尺寸:r,使用尺寸:r}),{width:r,height:r,offsetX:-r/2,offsetY:-r/2}}catch{return{width:20,height:20,offsetX:-10,offsetY:-10}}}_getFallbackBoundingBox(){switch(this.getStyle()?.config.type){case"icon-point":case"icon-label-point":return{width:20,height:20,offsetX:-10,offsetY:-10};case"basic-point":return{width:10,height:10,offsetX:-5,offsetY:-5};default:return{width:15,height:15,offsetX:-7.5,offsetY:-7.5}}}}no.mergeOptions(Mp);class Cl extends Yn{constructor(e){super(e);G(this,"_baseType","Line");G(this,"_vertexPoints");this._threeGeometry=this._createThreeGeometry(),this._vertexPoints=[0,0,0],this._style&&this._style.applyTo(this._threeGeometry)}_coordsTransform(){const e=this.getMap(),n=this._geometry,r=e?.prjcenter;if(this._geometry.type==="LineString"){let l=n.coordinates.map(u=>{const d=new m.Vector3(u[0],u[1],u[2]||0);return(e?e.geo2world(d):d).sub(r)}),c=l.flatMap(u=>[u.x,u.y,u.z]);return{_position:l,_vertexPoints:c}}}_toThreeJSGeometry(){}_createThreeGeometry(){const e=new yi,n=new Xr({color:8947848,linewidth:.1,dashed:!1,resolution:new m.Vector2(window.innerWidth,window.innerHeight)});return new Os(e,n)}}const Lp={};class ro extends Cl{constructor(e){super(e);G(this,"_type","LineString")}async _toThreeJSGeometry(){let{_vertexPoints:e}=this._coordsTransform();this._vertexPoints=e,this._style&&(this._threeGeometry&&this._disposeGeometry(),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}async _createObject(e){switch(e.config.type){case"basic-line":return $s(e.config,this._vertexPoints);default:throw new Error(`不支持的样式类型: ${e.config.type}`)}}_updateGeometry(){const e=this.getMap();if(this._disposeGeometry(),this._threeGeometry){const r=this._threeGeometry.geometry;r.setPositions(this._vertexPoints),r.computeBoundingSphere(),r.computeBoundingBox(),this._threeGeometry.position.add(e?.prjcenter),this.add(this._threeGeometry),this.updateMatrixWorld(!0),this._tryProcessQueue()}}}ro.mergeOptions(Lp);class Sp extends Yn{constructor(e){super(e);G(this,"_baseType","Surface");G(this,"_vertexPoints");this._threeGeometry=this._createThreeGeometry(),this._vertexPoints=[0,0,0],this._style&&this._style.applyTo(this._threeGeometry)}_coordsTransform(){const e=this.getMap(),n=e?.prjcenter,r=this._geometry;if(!r)throw new Error("几何数据未定义");if(r.type==="Polygon"){const s=r.coordinates;let l=[],c=[];return s.forEach(u=>{const d=u.map(p=>{const f=new m.Vector3(p[0],p[1],p[2]||0);return(e?e.geo2world(f):f).sub(n)});l.push(d),c.push(...d.flatMap(p=>[p.x,p.y,p.z]))}),{_positions:l,_vertexPoints:c}}else if(r.type==="MultiPolygon"){const s=r.coordinates;let l=[],c=[];return s.forEach(u=>{const d=[];u.forEach(p=>{const f=p.map(y=>{const v=new m.Vector3(y[0],y[1],y[2]||0);return(e?e.geo2world(v):v).sub(n)});d.push(f),c.push(...f.flatMap(y=>[y.x,y.y,y.z]))}),l.push(d)}),{_positions:l,_vertexPoints:c}}else throw new Error(`不支持的几何类型: ${r.type}`)}_updateGeometry(){const e=this._style?.config.type;if(this.clear(),!this._threeGeometry||!this._vertexPoints?.length){console.warn("无法更新几何体:缺少几何体或顶点数据");return}const n=this._threeGeometry,r=n.geometry,s=this.getMap();try{if(e==="basic-polygon"){const l=r.getAttribute("position");if(l.count*3!==this._vertexPoints.length)throw new Error(`顶点数量不匹配: ${l.count} 预期, 实际 ${this._vertexPoints.length/3}`);l.array.set(this._vertexPoints),l.needsUpdate=!0,this._threeGeometry.renderOrder=999,r.computeBoundingSphere(),r.computeBoundingBox(),this._threeGeometry.position.add(s?.prjcenter),this.add(this._threeGeometry),n.updateMatrix(),this.updateMatrixWorld(!0)}else(e==="extrude-polygon"||e?.includes("water"))&&(this._threeGeometry.renderOrder=999,this._threeGeometry.position.add(s?.prjcenter),this._threeGeometry.updateMatrix(),this.add(this._threeGeometry))}catch(l){throw console.error("更新多边形位置失败:",l),l}}_createThreeGeometry(){const e=new yi,n=new Xr({color:8947848,linewidth:.1,dashed:!1,resolution:new m.Vector2(window.innerWidth,window.innerHeight)});return new Os(e,n)}}const Tp={};class Vl extends Sp{constructor(e){super(e);G(this,"_type","Polygon")}async _toThreeJSGeometry(){let{_vertexPoints:e}=this._coordsTransform();this._vertexPoints=e,this._style&&(this._threeGeometry&&this.remove(this._threeGeometry),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}async _createObject(e){switch(e.config.type){case"basic-polygon":return zf(e.config,this._vertexPoints);case"extrude-polygon":return Of(e.config,this._vertexPoints);case"water":return Kf(e.config,this.getMap(),this._vertexPoints);case"base-water":return Rf(e.config,this._vertexPoints);default:throw new Error(`不支持的样式类型: ${e.config.type}`)}}_calculateCollisionBoundingBox(){return null}}Vl.mergeOptions(Tp);const Gp={};class Al extends Cl{constructor(e){super(e);G(this,"_type","MultiLineString");G(this,"_lineObjects",[]);G(this,"_linesContainer");this._linesContainer=new m.Group}async _toThreeJSGeometry(){const{_position:e}=this._coordsTransform(),n=this.getMap();if(this.clearLines(),this._disposeGeometry(),this._style){for(const r of e){const s=r.flatMap(c=>[c.x,c.y,c.z]),l=await this._createLineObject(this._style,s);l.position.add(n?.prjcenter),l.updateMatrixWorld(!0),this._lineObjects.push(l),this._linesContainer.add(l),this._threeGeometry=this._linesContainer}this.add(this._threeGeometry),this._updateContainer(),this.updateMatrixWorld(!0),this._threeGeometry.updateMatrixWorld(!0),this._tryProcessQueue()}}async _createLineObject(e,n){switch(e.config.type){case"basic-line":return $s(e.config,n);default:throw new Error(`不支持的样式类型: ${e.config.type}`)}}_coordsTransform(){const e=this.getMap(),n=this._geometry;if(this._geometry.type==="MultiLineString"){const r=e?.prjcenter;return{_position:n.coordinates.map(l=>l.map(c=>{const u=new m.Vector3(c[0],c[1],c[2]||0);return(e?e.geo2world(u):u).sub(r)}))}}}_updateContainer(){this._linesContainer.updateMatrixWorld(!0)}clearLines(){this._lineObjects.forEach(e=>{this._linesContainer.remove(e),e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()}),this._lineObjects=[]}_updateGeometry(){this._toThreeJSGeometry()}_disposeObject(){}}Al.mergeOptions(Gp);class Zp extends wt.MeshStandardMaterial{constructor(e={}){const{shaderOption:n,...r}=e;super({color:"rgb(58,126,182)",roughness:.7,metalness:.1,transparent:!0,opacity:.9,envMapIntensity:.8,...r});G(this,"shaderOption");G(this,"clock");G(this,"time");G(this,"startTime");this.shaderOption={minY:0,maxY:100,minRate:.3,maxRate:1.5,effects:{diffusion:{enabled:!1,color:new wt.Color("#9ECDEC"),width:20,speed:1,maxDistance:100,center:void 0},flow:{enabled:!1,color:new wt.Color("#00E4FF"),range:10,speed:20},sweep:{enabled:!1,color:new wt.Color("#FFFFFF"),width:1.5,speed:10}},...n},this.clock=new wt.Clock,this.time={value:0},this.startTime={value:0},this.animate()}onBeforeCompile(e){const{minY:n,maxY:r,minRate:s,maxRate:l,effects:c}=this.shaderOption,u=r-n;e.uniforms={...e.uniforms,time:this.time,uStartTime:this.startTime,uMinY:{value:n},uMaxY:{value:r},uHeightRange:{value:u},uMinRate:{value:s},uMaxRate:{value:l},uDiffusionEnabled:{value:c?.diffusion?.enabled?1:0},uDiffusionColor:{value:c?.diffusion?.color||new wt.Color("#9ECDEC")},uDiffusionWidth:{value:c?.diffusion?.width||20},uDiffusionSpeed:{value:c?.diffusion?.speed||1},uDiffusionMaxDistance:{value:c?.diffusion?.maxDistance||100},uDiffusionCenter:{value:c?.diffusion?.center||new wt.Vector3(0,0,0)},uFlowEnabled:{value:c?.flow?.enabled?1:0},uFlowColor:{value:c?.flow?.color||new wt.Color("#00E4FF")},uFlowRange:{value:c?.flow?.range||10},uFlowSpeed:{value:c?.flow?.speed||20},uSweepEnabled:{value:c?.sweep?.enabled?1:0},uSweepColor:{value:c?.sweep?.color||new wt.Color("#FFFFFF")},uSweepWidth:{value:c?.sweep?.width||1.5},uSweepSpeed:{value:c?.sweep?.speed||10}},e.vertexShader=`
|
|
565
|
+
}`;var ge=Ih(function(){return Te(M,re+"return "+j).apply(e,Z)});if(ge.source=j,wa(ge))throw ge;return ge}function Kb(i){return Ge(i).toLowerCase()}function Rb(i){return Ge(i).toUpperCase()}function Yb(i,o,h){if(i=Ge(i),i&&(h||o===e))return Dc(i);if(!i||!(o=Mt(o)))return i;var g=Jt(i),w=Jt(o),M=zc(g,w),Z=Oc(g,w)+1;return zn(g,M,Z).join("")}function Ub(i,o,h){if(i=Ge(i),i&&(h||o===e))return i.slice(0,Rc(i)+1);if(!i||!(o=Mt(o)))return i;var g=Jt(i),w=Oc(g,Jt(o))+1;return zn(g,0,w).join("")}function Bb(i,o,h){if(i=Ge(i),i&&(h||o===e))return i.replace(wo,"");if(!i||!(o=Mt(o)))return i;var g=Jt(i),w=zc(g,Jt(o));return zn(g,w).join("")}function Nb(i,o){var h=P,g=k;if(Fe(o)){var w="separator"in o?o.separator:w;h="length"in o?pe(o.length):h,g="omission"in o?Mt(o.omission):g}i=Ge(i);var M=i.length;if(br(i)){var Z=Jt(i);M=Z.length}if(h>=M)return i;var W=h-xr(g);if(W<1)return g;var A=Z?zn(Z,0,W).join(""):i.slice(0,W);if(w===e)return A+g;if(Z&&(W+=A.length-W),ba(w)){if(i.slice(W).search(w)){var U,B=A;for(w.global||(w=Xo(w.source,Ge(oc.exec(w))+"g")),w.lastIndex=0;U=w.exec(B);)var j=U.index;A=A.slice(0,j===e?W:j)}}else if(i.indexOf(Mt(w),W)!=W){var $=A.lastIndexOf(w);$>-1&&(A=A.slice(0,$))}return A+g}function jb(i){return i=Ge(i),i&&sc.test(i)?i.replace(Ct,_g):i}var Jb=Zr(function(i,o,h){return i+(h?" ":"")+o.toUpperCase()}),Ma=Wu("toUpperCase");function Zh(i,o,h){return i=Ge(i),o=h?e:o,o===e?yg(i)?Sg(i):lg(i):i.match(o)||[]}var Ih=ye(function(i,o){try{return xt(i,e,o)}catch(h){return wa(h)?h:new de(h)}}),Qb=gn(function(i,o){return At(o,function(h){h=ln(h),pn(i,h,ya(i[h],i))}),i});function Hb(i){var o=i==null?0:i.length,h=ae();return i=o?Ve(i,function(g){if(typeof g[1]!="function")throw new Ft(l);return[h(g[0]),g[1]]}):[],ye(function(g){for(var w=-1;++w<o;){var M=i[w];if(xt(M[0],this,g))return xt(M[1],this,g)}})}function Eb(i){return _y(kt(i,f))}function La(i){return function(){return i}}function qb(i,o){return i==null||i!==i?o:i}var $b=Cu(),ex=Cu(!0);function vt(i){return i}function Sa(i){return lu(typeof i=="function"?i:kt(i,f))}function tx(i){return uu(kt(i,f))}function nx(i,o){return hu(i,kt(o,f))}var rx=ye(function(i,o){return function(h){return oi(h,i,o)}}),ix=ye(function(i,o){return function(h){return oi(i,h,o)}});function Ta(i,o,h){var g=He(o),w=rs(o,g);h==null&&!(Fe(o)&&(w.length||!g.length))&&(h=o,o=i,i=this,w=rs(o,He(o)));var M=!(Fe(h)&&"chain"in h)||!!h.chain,Z=vn(i);return At(w,function(W){var A=o[W];i[W]=A,Z&&(i.prototype[W]=function(){var U=this.__chain__;if(M||U){var B=i(this.__wrapped__),j=B.__actions__=mt(this.__actions__);return j.push({func:A,args:arguments,thisArg:i}),B.__chain__=U,B}return A.apply(i,Vn([this.value()],arguments))})}),i}function sx(){return nt._===this&&(nt._=Pg),this}function Ga(){}function ox(i){return i=pe(i),ye(function(o){return du(o,i)})}var ax=ia(Ve),lx=ia(Vc),cx=ia(Io);function Wh(i){return ha(i)?Wo(ln(i)):zy(i)}function ux(i){return function(o){return i==null?e:rr(i,o)}}var hx=Au(),dx=Au(!0);function Za(){return[]}function Ia(){return!1}function fx(){return{}}function px(){return""}function mx(){return!0}function gx(i,o){if(i=pe(i),i<1||i>ie)return[];var h=xe,g=st(i,xe);o=ae(o),i-=xe;for(var w=Vo(g,o);++h<i;)o(h);return w}function yx(i){return fe(i)?Ve(i,ln):Lt(i)?[i]:mt(Hu(Ge(i)))}function vx(i){var o=++Ig;return Ge(i)+o}var wx=cs(function(i,o){return i+o},0),bx=sa("ceil"),xx=cs(function(i,o){return i/o},1),_x=sa("floor");function Mx(i){return i&&i.length?ns(i,vt,Uo):e}function Lx(i,o){return i&&i.length?ns(i,ae(o,2),Uo):e}function Sx(i){return Xc(i,vt)}function Tx(i,o){return Xc(i,ae(o,2))}function Gx(i){return i&&i.length?ns(i,vt,Jo):e}function Zx(i,o){return i&&i.length?ns(i,ae(o,2),Jo):e}var Ix=cs(function(i,o){return i*o},1),Wx=sa("round"),Px=cs(function(i,o){return i-o},0);function Cx(i){return i&&i.length?Co(i,vt):0}function Vx(i,o){return i&&i.length?Co(i,ae(o,2)):0}return x.after=tw,x.ary=ah,x.assign=Rw,x.assignIn=xh,x.assignInWith=_s,x.assignWith=Yw,x.at=Uw,x.before=lh,x.bind=ya,x.bindAll=Qb,x.bindKey=ch,x.castArray=fw,x.chain=ih,x.chunk=_1,x.compact=M1,x.concat=L1,x.cond=Hb,x.conforms=Eb,x.constant=La,x.countBy=Cv,x.create=Bw,x.curry=uh,x.curryRight=hh,x.debounce=dh,x.defaults=Nw,x.defaultsDeep=jw,x.defer=nw,x.delay=rw,x.difference=S1,x.differenceBy=T1,x.differenceWith=G1,x.drop=Z1,x.dropRight=I1,x.dropRightWhile=W1,x.dropWhile=P1,x.fill=C1,x.filter=Av,x.flatMap=kv,x.flatMapDeep=Dv,x.flatMapDepth=zv,x.flatten=eh,x.flattenDeep=V1,x.flattenDepth=A1,x.flip=iw,x.flow=$b,x.flowRight=ex,x.fromPairs=F1,x.functions=eb,x.functionsIn=tb,x.groupBy=Ov,x.initial=k1,x.intersection=D1,x.intersectionBy=z1,x.intersectionWith=O1,x.invert=rb,x.invertBy=ib,x.invokeMap=Rv,x.iteratee=Sa,x.keyBy=Yv,x.keys=He,x.keysIn=yt,x.map=gs,x.mapKeys=ob,x.mapValues=ab,x.matches=tx,x.matchesProperty=nx,x.memoize=vs,x.merge=lb,x.mergeWith=_h,x.method=rx,x.methodOf=ix,x.mixin=Ta,x.negate=ws,x.nthArg=ox,x.omit=cb,x.omitBy=ub,x.once=sw,x.orderBy=Uv,x.over=ax,x.overArgs=ow,x.overEvery=lx,x.overSome=cx,x.partial=va,x.partialRight=fh,x.partition=Bv,x.pick=hb,x.pickBy=Mh,x.property=Wh,x.propertyOf=ux,x.pull=U1,x.pullAll=nh,x.pullAllBy=B1,x.pullAllWith=N1,x.pullAt=j1,x.range=hx,x.rangeRight=dx,x.rearg=aw,x.reject=Jv,x.remove=J1,x.rest=lw,x.reverse=ma,x.sampleSize=Hv,x.set=fb,x.setWith=pb,x.shuffle=Ev,x.slice=Q1,x.sortBy=ew,x.sortedUniq=nv,x.sortedUniqBy=rv,x.split=kb,x.spread=cw,x.tail=iv,x.take=sv,x.takeRight=ov,x.takeRightWhile=av,x.takeWhile=lv,x.tap=Mv,x.throttle=uw,x.thru=ms,x.toArray=vh,x.toPairs=Lh,x.toPairsIn=Sh,x.toPath=yx,x.toPlainObject=bh,x.transform=mb,x.unary=hw,x.union=cv,x.unionBy=uv,x.unionWith=hv,x.uniq=dv,x.uniqBy=fv,x.uniqWith=pv,x.unset=gb,x.unzip=ga,x.unzipWith=rh,x.update=yb,x.updateWith=vb,x.values=Pr,x.valuesIn=wb,x.without=mv,x.words=Zh,x.wrap=dw,x.xor=gv,x.xorBy=yv,x.xorWith=vv,x.zip=wv,x.zipObject=bv,x.zipObjectDeep=xv,x.zipWith=_v,x.entries=Lh,x.entriesIn=Sh,x.extend=xh,x.extendWith=_s,Ta(x,x),x.add=wx,x.attempt=Ih,x.camelCase=Mb,x.capitalize=Th,x.ceil=bx,x.clamp=bb,x.clone=pw,x.cloneDeep=gw,x.cloneDeepWith=yw,x.cloneWith=mw,x.conformsTo=vw,x.deburr=Gh,x.defaultTo=qb,x.divide=xx,x.endsWith=Lb,x.eq=Ht,x.escape=Sb,x.escapeRegExp=Tb,x.every=Vv,x.find=Fv,x.findIndex=qu,x.findKey=Jw,x.findLast=Xv,x.findLastIndex=$u,x.findLastKey=Qw,x.floor=_x,x.forEach=sh,x.forEachRight=oh,x.forIn=Hw,x.forInRight=Ew,x.forOwn=qw,x.forOwnRight=$w,x.get=xa,x.gt=ww,x.gte=bw,x.has=nb,x.hasIn=_a,x.head=th,x.identity=vt,x.includes=Kv,x.indexOf=X1,x.inRange=xb,x.invoke=sb,x.isArguments=or,x.isArray=fe,x.isArrayBuffer=xw,x.isArrayLike=gt,x.isArrayLikeObject=Oe,x.isBoolean=_w,x.isBuffer=On,x.isDate=Mw,x.isElement=Lw,x.isEmpty=Sw,x.isEqual=Tw,x.isEqualWith=Gw,x.isError=wa,x.isFinite=Zw,x.isFunction=vn,x.isInteger=ph,x.isLength=bs,x.isMap=mh,x.isMatch=Iw,x.isMatchWith=Ww,x.isNaN=Pw,x.isNative=Cw,x.isNil=Aw,x.isNull=Vw,x.isNumber=gh,x.isObject=Fe,x.isObjectLike=De,x.isPlainObject=di,x.isRegExp=ba,x.isSafeInteger=Fw,x.isSet=yh,x.isString=xs,x.isSymbol=Lt,x.isTypedArray=Wr,x.isUndefined=Xw,x.isWeakMap=kw,x.isWeakSet=Dw,x.join=K1,x.kebabCase=Gb,x.last=zt,x.lastIndexOf=R1,x.lowerCase=Zb,x.lowerFirst=Ib,x.lt=zw,x.lte=Ow,x.max=Mx,x.maxBy=Lx,x.mean=Sx,x.meanBy=Tx,x.min=Gx,x.minBy=Zx,x.stubArray=Za,x.stubFalse=Ia,x.stubObject=fx,x.stubString=px,x.stubTrue=mx,x.multiply=Ix,x.nth=Y1,x.noConflict=sx,x.noop=Ga,x.now=ys,x.pad=Wb,x.padEnd=Pb,x.padStart=Cb,x.parseInt=Vb,x.random=_b,x.reduce=Nv,x.reduceRight=jv,x.repeat=Ab,x.replace=Fb,x.result=db,x.round=Wx,x.runInContext=C,x.sample=Qv,x.size=qv,x.snakeCase=Xb,x.some=$v,x.sortedIndex=H1,x.sortedIndexBy=E1,x.sortedIndexOf=q1,x.sortedLastIndex=$1,x.sortedLastIndexBy=ev,x.sortedLastIndexOf=tv,x.startCase=Db,x.startsWith=zb,x.subtract=Px,x.sum=Cx,x.sumBy=Vx,x.template=Ob,x.times=gx,x.toFinite=wn,x.toInteger=pe,x.toLength=wh,x.toLower=Kb,x.toNumber=Ot,x.toSafeInteger=Kw,x.toString=Ge,x.toUpper=Rb,x.trim=Yb,x.trimEnd=Ub,x.trimStart=Bb,x.truncate=Nb,x.unescape=jb,x.uniqueId=vx,x.upperCase=Jb,x.upperFirst=Ma,x.each=sh,x.eachRight=oh,x.first=th,Ta(x,function(){var i={};return on(x,function(o,h){Ze.call(x.prototype,h)||(i[h]=o)}),i}(),{chain:!1}),x.VERSION=n,At(["bind","bindKey","curry","curryRight","partial","partialRight"],function(i){x[i].placeholder=x}),At(["drop","take"],function(i,o){Me.prototype[i]=function(h){h=h===e?1:Ne(pe(h),0);var g=this.__filtered__&&!o?new Me(this):this.clone();return g.__filtered__?g.__takeCount__=st(h,g.__takeCount__):g.__views__.push({size:st(h,xe),type:i+(g.__dir__<0?"Right":"")}),g},Me.prototype[i+"Right"]=function(h){return this.reverse()[i](h).reverse()}}),At(["filter","map","takeWhile"],function(i,o){var h=o+1,g=h==Q||h==J;Me.prototype[i]=function(w){var M=this.clone();return M.__iteratees__.push({iteratee:ae(w,3),type:h}),M.__filtered__=M.__filtered__||g,M}}),At(["head","last"],function(i,o){var h="take"+(o?"Right":"");Me.prototype[i]=function(){return this[h](1).value()[0]}}),At(["initial","tail"],function(i,o){var h="drop"+(o?"":"Right");Me.prototype[i]=function(){return this.__filtered__?new Me(this):this[h](1)}}),Me.prototype.compact=function(){return this.filter(vt)},Me.prototype.find=function(i){return this.filter(i).head()},Me.prototype.findLast=function(i){return this.reverse().find(i)},Me.prototype.invokeMap=ye(function(i,o){return typeof i=="function"?new Me(this):this.map(function(h){return oi(h,i,o)})}),Me.prototype.reject=function(i){return this.filter(ws(ae(i)))},Me.prototype.slice=function(i,o){i=pe(i);var h=this;return h.__filtered__&&(i>0||o<0)?new Me(h):(i<0?h=h.takeRight(-i):i&&(h=h.drop(i)),o!==e&&(o=pe(o),h=o<0?h.dropRight(-o):h.take(o-i)),h)},Me.prototype.takeRightWhile=function(i){return this.reverse().takeWhile(i).reverse()},Me.prototype.toArray=function(){return this.take(xe)},on(Me.prototype,function(i,o){var h=/^(?:filter|find|map|reject)|While$/.test(o),g=/^(?:head|last)$/.test(o),w=x[g?"take"+(o=="last"?"Right":""):o],M=g||/^find/.test(o);w&&(x.prototype[o]=function(){var Z=this.__wrapped__,W=g?[1]:arguments,A=Z instanceof Me,U=W[0],B=A||fe(Z),j=function(_e){var Le=w.apply(x,Vn([_e],W));return g&&$?Le[0]:Le};B&&h&&typeof U=="function"&&U.length!=1&&(A=B=!1);var $=this.__chain__,re=!!this.__actions__.length,le=M&&!$,ge=A&&!re;if(!M&&B){Z=ge?Z:new Me(this);var ce=i.apply(Z,W);return ce.__actions__.push({func:ms,args:[j],thisArg:e}),new Xt(ce,$)}return le&&ge?i.apply(this,W):(ce=this.thru(j),le?g?ce.value()[0]:ce.value():ce)})}),At(["pop","push","shift","sort","splice","unshift"],function(i){var o=Ki[i],h=/^(?:push|sort|unshift)$/.test(i)?"tap":"thru",g=/^(?:pop|shift)$/.test(i);x.prototype[i]=function(){var w=arguments;if(g&&!this.__chain__){var M=this.value();return o.apply(fe(M)?M:[],w)}return this[h](function(Z){return o.apply(fe(Z)?Z:[],w)})}}),on(Me.prototype,function(i,o){var h=x[o];if(h){var g=h.name+"";Ze.call(Sr,g)||(Sr[g]=[]),Sr[g].push({name:o,func:h})}}),Sr[ls(e,S).name]=[{name:"wrapper",func:e}],Me.prototype.clone=jg,Me.prototype.reverse=Jg,Me.prototype.value=Qg,x.prototype.at=Lv,x.prototype.chain=Sv,x.prototype.commit=Tv,x.prototype.next=Gv,x.prototype.plant=Iv,x.prototype.reverse=Wv,x.prototype.toJSON=x.prototype.valueOf=x.prototype.value=Pv,x.prototype.first=x.prototype.head,$r&&(x.prototype[$r]=Zv),x},_r=Tg();qn?((qn.exports=_r)._=_r,So._=_r):nt._=_r}).call(Yr)}(Ti,Ti.exports);var _p=Ti.exports;let Ur=class extends Ln{constructor(e){super(e);G(this,"_baseType","Point");this._threeGeometry=this._createThreeGeometry(),this._style&&this._style.applyTo(this._threeGeometry)}_coordsTransform(){const e=this.getMap(),n=new m.Vector3(this._geometry.coordinates[0],this._geometry.coordinates[1],this._geometry.coordinates[2]||0);return e?e.geo2world(n):n}_toThreeJSGeometry(){}_createThreeGeometry(){return new m.Points(new m.BufferGeometry,new m.PointsMaterial({size:1,color:8947848}))}};const Mp={};class no extends Ur{constructor(e){super(e);G(this,"_type","Maker")}async _toThreeJSGeometry(){this._position=this._coordsTransform(),this._style&&(this._threeGeometry&&this._disposeGeometry(),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}async _createObject(e){switch(e.config.type){case"basic-point":return xl(e.config,new m.Vector3(0,0,0));case"icon-point":return _l(e.config,this._position);case"icon-label-point":return Nf(e.config,this.getMap(),this._position);default:throw new Error(`不支持的样式类型: ${e.config.type}`)}}_calculateCollisionBoundingBox(e,n){if(!this.visible||!this._threeGeometry||!e||!n)return null;try{switch(this._style?.config.type){case"icon-point":return this._calculateSpriteBoundingBox(this._threeGeometry);default:return this._getFallbackBoundingBox()}}catch(r){return console.warn(`Maker ${this._id} 包围盒计算失败:`,r),this._getFallbackBoundingBox()}}_calculateSpriteBoundingBox(e){try{const r=Math.max(Math.abs(e.scale.x),Math.abs(e.scale.y))/.002;return console.log("Sprite尺寸估算:",{spriteScale:{x:e.scale.x,y:e.scale.y},计算尺寸:r,使用尺寸:r}),{width:r,height:r,offsetX:-r/2,offsetY:-r/2}}catch{return{width:20,height:20,offsetX:-10,offsetY:-10}}}_getFallbackBoundingBox(){switch(this.getStyle()?.config.type){case"icon-point":case"icon-label-point":return{width:20,height:20,offsetX:-10,offsetY:-10};case"basic-point":return{width:10,height:10,offsetX:-5,offsetY:-5};default:return{width:15,height:15,offsetX:-7.5,offsetY:-7.5}}}}no.mergeOptions(Mp);class Cl extends Ln{constructor(e){super(e);G(this,"_baseType","Line");G(this,"_vertexPoints");this._threeGeometry=this._createThreeGeometry(),this._vertexPoints=[0,0,0],this._style&&this._style.applyTo(this._threeGeometry)}_coordsTransform(){const e=this.getMap(),n=this._geometry,r=e?.prjcenter;if(this._geometry.type==="LineString"){let l=n.coordinates.map(u=>{const d=new m.Vector3(u[0],u[1],u[2]||0);return(e?e.geo2world(d):d).sub(r)}),c=l.flatMap(u=>[u.x,u.y,u.z]);return{_position:l,_vertexPoints:c}}}_toThreeJSGeometry(){}_createThreeGeometry(){const e=new yi,n=new Xr({color:8947848,linewidth:.1,dashed:!1,resolution:new m.Vector2(window.innerWidth,window.innerHeight)});return new Os(e,n)}}const Lp={};class ro extends Cl{constructor(e){super(e);G(this,"_type","LineString")}async _toThreeJSGeometry(){let{_vertexPoints:e}=this._coordsTransform();this._vertexPoints=e,this._style&&(this._threeGeometry&&this._disposeGeometry(),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}async _createObject(e){switch(e.config.type){case"basic-line":return $s(e.config,this._vertexPoints);default:throw new Error(`不支持的样式类型: ${e.config.type}`)}}_updateGeometry(){const e=this.getMap();if(this._disposeGeometry(),this._threeGeometry){const r=this._threeGeometry.geometry;r.setPositions(this._vertexPoints),r.computeBoundingSphere(),r.computeBoundingBox(),this._threeGeometry.position.add(e?.prjcenter),this.add(this._threeGeometry),this.updateMatrixWorld(!0),this._tryProcessQueue()}}}ro.mergeOptions(Lp);class Sp extends Ln{constructor(e){super(e);G(this,"_baseType","Surface");G(this,"_vertexPoints");this._threeGeometry=this._createThreeGeometry(),this._vertexPoints=[0,0,0],this._style&&this._style.applyTo(this._threeGeometry)}_coordsTransform(){const e=this.getMap(),n=e?.prjcenter,r=this._geometry;if(!r)throw new Error("几何数据未定义");if(r.type==="Polygon"){const s=r.coordinates;let l=[],c=[];return s.forEach(u=>{const d=u.map(p=>{const f=new m.Vector3(p[0],p[1],p[2]||0);return(e?e.geo2world(f):f).sub(n)});l.push(d),c.push(...d.flatMap(p=>[p.x,p.y,p.z]))}),{_positions:l,_vertexPoints:c}}else if(r.type==="MultiPolygon"){const s=r.coordinates;let l=[],c=[];return s.forEach(u=>{const d=[];u.forEach(p=>{const f=p.map(y=>{const v=new m.Vector3(y[0],y[1],y[2]||0);return(e?e.geo2world(v):v).sub(n)});d.push(f),c.push(...f.flatMap(y=>[y.x,y.y,y.z]))}),l.push(d)}),{_positions:l,_vertexPoints:c}}else throw new Error(`不支持的几何类型: ${r.type}`)}_updateGeometry(){const e=this._style?.config.type;if(this.clear(),!this._threeGeometry||!this._vertexPoints?.length){console.warn("无法更新几何体:缺少几何体或顶点数据");return}const n=this._threeGeometry,r=n.geometry,s=this.getMap();try{if(e==="basic-polygon"){const l=r.getAttribute("position");if(l.count*3!==this._vertexPoints.length)throw new Error(`顶点数量不匹配: ${l.count} 预期, 实际 ${this._vertexPoints.length/3}`);l.array.set(this._vertexPoints),l.needsUpdate=!0,this._threeGeometry.renderOrder=999,r.computeBoundingSphere(),r.computeBoundingBox(),this._threeGeometry.position.add(s?.prjcenter),this.add(this._threeGeometry),n.updateMatrix(),this.updateMatrixWorld(!0)}else(e==="extrude-polygon"||e?.includes("water"))&&(this._threeGeometry.renderOrder=999,this._threeGeometry.position.add(s?.prjcenter),this._threeGeometry.updateMatrix(),this.add(this._threeGeometry))}catch(l){throw console.error("更新多边形位置失败:",l),l}}_createThreeGeometry(){const e=new yi,n=new Xr({color:8947848,linewidth:.1,dashed:!1,resolution:new m.Vector2(window.innerWidth,window.innerHeight)});return new Os(e,n)}}const Tp={};class Vl extends Sp{constructor(e){super(e);G(this,"_type","Polygon")}async _toThreeJSGeometry(){let{_vertexPoints:e}=this._coordsTransform();this._vertexPoints=e,this._style&&(this._threeGeometry&&this.remove(this._threeGeometry),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}async _createObject(e){switch(e.config.type){case"basic-polygon":return zf(e.config,this._vertexPoints);case"extrude-polygon":return Of(e.config,this._vertexPoints);case"water":return Kf(e.config,this.getMap(),this._vertexPoints);case"base-water":return Rf(e.config,this._vertexPoints);default:throw new Error(`不支持的样式类型: ${e.config.type}`)}}_calculateCollisionBoundingBox(){return null}}Vl.mergeOptions(Tp);const Gp={};class Al extends Cl{constructor(e){super(e);G(this,"_type","MultiLineString");G(this,"_lineObjects",[]);G(this,"_linesContainer");this._linesContainer=new m.Group}async _toThreeJSGeometry(){const{_position:e}=this._coordsTransform(),n=this.getMap();if(this.clearLines(),this._disposeGeometry(),this._style){for(const r of e){const s=r.flatMap(c=>[c.x,c.y,c.z]),l=await this._createLineObject(this._style,s);l.position.add(n?.prjcenter),l.updateMatrixWorld(!0),this._lineObjects.push(l),this._linesContainer.add(l),this._threeGeometry=this._linesContainer}this.add(this._threeGeometry),this._updateContainer(),this.updateMatrixWorld(!0),this._threeGeometry.updateMatrixWorld(!0),this._tryProcessQueue()}}async _createLineObject(e,n){switch(e.config.type){case"basic-line":return $s(e.config,n);default:throw new Error(`不支持的样式类型: ${e.config.type}`)}}_coordsTransform(){const e=this.getMap(),n=this._geometry;if(this._geometry.type==="MultiLineString"){const r=e?.prjcenter;return{_position:n.coordinates.map(l=>l.map(c=>{const u=new m.Vector3(c[0],c[1],c[2]||0);return(e?e.geo2world(u):u).sub(r)}))}}}_updateContainer(){this._linesContainer.updateMatrixWorld(!0)}clearLines(){this._lineObjects.forEach(e=>{this._linesContainer.remove(e),e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()}),this._lineObjects=[]}_updateGeometry(){this._toThreeJSGeometry()}_disposeObject(){}}Al.mergeOptions(Gp);class Zp extends wt.MeshStandardMaterial{constructor(e={}){const{shaderOption:n,...r}=e;super({color:"rgb(58,126,182)",roughness:.7,metalness:.1,transparent:!0,opacity:.9,envMapIntensity:.8,...r});G(this,"shaderOption");G(this,"clock");G(this,"time");G(this,"startTime");this.shaderOption={minY:0,maxY:100,minRate:.3,maxRate:1.5,effects:{diffusion:{enabled:!1,color:new wt.Color("#9ECDEC"),width:20,speed:1,maxDistance:100,center:void 0},flow:{enabled:!1,color:new wt.Color("#00E4FF"),range:10,speed:20},sweep:{enabled:!1,color:new wt.Color("#FFFFFF"),width:1.5,speed:10}},...n},this.clock=new wt.Clock,this.time={value:0},this.startTime={value:0},this.animate()}onBeforeCompile(e){const{minY:n,maxY:r,minRate:s,maxRate:l,effects:c}=this.shaderOption,u=r-n;e.uniforms={...e.uniforms,time:this.time,uStartTime:this.startTime,uMinY:{value:n},uMaxY:{value:r},uHeightRange:{value:u},uMinRate:{value:s},uMaxRate:{value:l},uDiffusionEnabled:{value:c?.diffusion?.enabled?1:0},uDiffusionColor:{value:c?.diffusion?.color||new wt.Color("#9ECDEC")},uDiffusionWidth:{value:c?.diffusion?.width||20},uDiffusionSpeed:{value:c?.diffusion?.speed||1},uDiffusionMaxDistance:{value:c?.diffusion?.maxDistance||100},uDiffusionCenter:{value:c?.diffusion?.center||new wt.Vector3(0,0,0)},uFlowEnabled:{value:c?.flow?.enabled?1:0},uFlowColor:{value:c?.flow?.color||new wt.Color("#00E4FF")},uFlowRange:{value:c?.flow?.range||10},uFlowSpeed:{value:c?.flow?.speed||20},uSweepEnabled:{value:c?.sweep?.enabled?1:0},uSweepColor:{value:c?.sweep?.color||new wt.Color("#FFFFFF")},uSweepWidth:{value:c?.sweep?.width||1.5},uSweepSpeed:{value:c?.sweep?.speed||10}},e.vertexShader=`
|
|
566
566
|
varying vec3 vWorldPosition;
|
|
567
567
|
varying vec3 vPosition;
|
|
568
568
|
varying float vHeight;
|
|
@@ -652,9 +652,9 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
652
652
|
diffuseColor.rgb = mix(uSweepColor, diffuseColor.rgb, 1.0 - sweepFactor);
|
|
653
653
|
}
|
|
654
654
|
}
|
|
655
|
-
`)}setDiffusionFromObject(e){if(!this.shaderOption.effects?.diffusion)return;const n=new wt.Box3().setFromObject(e);if(n.isEmpty())return;const r=new wt.Vector3;n.getCenter(r);const s=[new wt.Vector3(n.min.x,n.min.y,n.min.z),new wt.Vector3(n.max.x,n.max.y,n.max.z)];let l=0;s.forEach(c=>{const u=r.distanceTo(c);u>l&&(l=u)}),this.shaderOption.effects.diffusion={...this.shaderOption.effects.diffusion,center:r,maxDistance:l},this.needsUpdate=!0}updateBoundingBox(e,n){this.shaderOption.minY=e,this.shaderOption.maxY=n,this.needsUpdate=!0}updateEffects(e){this.shaderOption.effects={...this.shaderOption.effects,...e},this.needsUpdate=!0}animate(){requestAnimationFrame(()=>this.animate()),this.time.value=this.clock.getElapsedTime(),this.startTime.value<1&&(this.startTime.value+=.01)}}const Ip={emissive:!1,emissiveIntensity:1,emissiveColor:"#ffffff"};class Fl extends Ur{constructor(e){super(e);G(this,"_type","Model");G(this,"_emissive",!1);G(this,"_emissiveIntensity",1);G(this,"_emissiveColor","#ffffff");G(this,"_mixer",null);G(this,"_currentAction",null);G(this,"_animations",[]);G(this,"_clock",new m.Clock);G(this,"_autoUpdate",!0);G(this,"_animationRequestId",null);G(this,"_iscity",!1);this._emissive=e.emissive||!1,this._emissiveIntensity=e.emissiveIntensity||1,this._emissiveColor=e.emissiveColor||"#ffffff",this.castShadow=e.castShadow||!1,this.receiveShadow=e.receiveShadow||!1,this._iscity=e.iscity||!1}async _toThreeJSGeometry(){this._position=this._coordsTransform(),this._style&&(this._threeGeometry&&this._disposeGeometry(),this.modelunino=await this._createObject(this._style),this._threeGeometry=this.modelunino.model,this._threeGeometry.userData._type="Model",this.modelunino.animations&&this.modelunino.animations.length>0&&(this._animations=this.modelunino.animations,this._mixer=new m.AnimationMixer(this._threeGeometry),this._startAnimationLoop(),this.playAnimation({name:this._animations[0].name,loop:!0,speed:1.5,fadeInDuration:.5,fadeOutDuration:.3})),this._updateGeometry(),this.setShadows({cast:this.castShadow,receive:this.receiveShadow}),this._applyEmissionProperties(),this._iscity&&this._rendercity())}async _createObject(e){switch(e.config.type){case"fbx":case"gltf":return Df(e.config,this._position);default:throw new Error(`不支持的样式类型: ${e.config.type}`)}}_applyEmissionProperties(){this._threeGeometry&&this._threeGeometry.traverse(e=>{if("material"in e){const n=e.material;n&&(n.emissiveIntensity=this._emissive?this._emissiveIntensity:0,n.emissive&&n.emissive.setStyle(this._emissiveColor))}})}get emissive(){return this._emissive}set emissive(e){this._emissive=e,this._applyEmissionProperties()}get emissiveIntensity(){return this._emissiveIntensity}set emissiveIntensity(e){this._emissiveIntensity=e,this._applyEmissionProperties()}get emissiveColor(){return this._emissiveColor}set emissiveColor(e){this._emissiveColor=e,this._applyEmissionProperties()}setEmission(e,n,r){this._emissive=e,n!==void 0&&(this._emissiveIntensity=n),r!==void 0&&(this._emissiveColor=r),this._applyEmissionProperties()}async setShadows(e){this.castShadow=e.cast,this.receiveShadow=e.receive,this._threeGeometry&&this._threeGeometry.traverse(n=>{n.isMesh&&n.material&&(n.castShadow=e.cast,n.receiveShadow=e.receive)})}playAnimation(e){if(!this._mixer||this._animations.length===0){console.warn("模型没有可用的动画");return}this._currentAction&&(e.fadeOutDuration&&e.fadeOutDuration>0?this._currentAction.fadeOut(e.fadeOutDuration):this._currentAction.stop());const n=typeof e.name=="number"?this._animations[e.name]:this._animations.find(r=>r.name===e.name);if(!n){console.warn(`找不到动画: ${e.name}`);return}this._currentAction=this._mixer.clipAction(n),this._currentAction.setLoop(e.loop?m.LoopRepeat:m.LoopOnce,e.loop?1/0:1),this._currentAction.timeScale=e.speed||1,this._currentAction.time=e.startAt||0,this._currentAction.setEffectiveWeight(e.weight||1),e.fadeInDuration&&e.fadeInDuration>0&&this._currentAction.fadeIn(e.fadeInDuration),this._currentAction.play(),this._autoUpdate&&this._animationRequestId===null&&this._startAnimationLoop()}stopAnimation(e={}){this._currentAction&&(e.fadeDuration&&e.fadeDuration>0?(this._currentAction.fadeOut(e.fadeDuration),setTimeout(()=>{this._currentAction&&(this._currentAction.stop(),this._currentAction=null)},e.fadeDuration*1e3)):(this._currentAction.stop(),this._currentAction=null))}setAnimationPaused(e){this._currentAction&&(this._currentAction.paused=e.paused)}setAnimationSpeed(e){this._currentAction&&(this._currentAction.timeScale=e.speed)}updateAnimation(e){this._mixer&&this._mixer.update(e.deltaTime)}getAnimationNames(){return this._animations.map(e=>e.name)}getCurrentAnimationName(){return this._currentAction?this._currentAction.getClip().name:null}getAnimationDuration(e){let n;return typeof e.name=="number"?n=this._animations[e.name]:n=this._animations.find(r=>r.name===e.name),n?n.duration:null}dispose(){this._stopAnimationLoop(),this._mixer&&(this._mixer.stopAllAction(),this._mixer.uncacheRoot(this._threeGeometry)),super.dispose()}_startAnimationLoop(){if(!this._autoUpdate||this._animationRequestId!==null)return;const e=()=>{if(this._mixer){const n=this._clock.getDelta();this._mixer.update(n)}this._animationRequestId=requestAnimationFrame(e)};this._clock.start(),this._animationRequestId=requestAnimationFrame(e)}_stopAnimationLoop(){this._animationRequestId!==null&&(cancelAnimationFrame(this._animationRequestId),this._animationRequestId=null),this._clock.stop()}setAutoUpdate(e){this._autoUpdate=e,e?this._startAnimationLoop():this._stopAnimationLoop()}_rendercity(){this.traverse(async e=>{if(e instanceof m.Mesh&&e.material){if(e.castShadow=!0,e.name==="building"){const n=new Zp({color:new m.Color("#6BA7EC").multiplyScalar(1.8),opacity:.95,shaderOption:{minY:0,maxY:50,minRate:.3,maxRate:1.5,effects:{diffusion:{enabled:!0,color:new m.Color("#FFFFF"),width:300,speed:.05},flow:{enabled:!1,color:new m.Color("#FFFFF"),range:1e3,speed:3e3},sweep:{enabled:!0,color:new m.Color("#ffffff"),width:3,speed:5}}}}),r=new m.Box3().setFromObject(e);n.updateBoundingBox(r.min.y,r.max.y),n.setDiffusionFromObject(e),e.material=n,e.material.needsUpdate=!0}e.name==="grass"&&(e.castShadow=!1,e.receiveShadow=!0,e.material.color=new m.Color("#81e4d8ff)").multiplyScalar(.7),e.material.metalness=.2,e.material.roughness=.8,["metalnessMap","normalMap","roughnessMap","specularColorMap"].forEach(n=>{const r=e.material[n];r&&(r.wrapS=r.wrapT=m.RepeatWrapping,r.repeat.set(.3,.3),r.needsUpdate=!0)}),e.material.normalScale=new m.Vector2(3,3))}})}}Fl.mergeOptions(Ip);const Wp={};class Xl extends Ur{constructor(e){super(e);G(this,"_type","Cloud")}async _toThreeJSGeometry(){this._position=this._coordsTransform(),this._style&&(this._threeGeometry&&this._disposeGeometry(),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}_updateGeometry(){this._disposeGeometry();const e=this.getLayer();this._threeGeometry&&(this._threeGeometry.position.copy(this._position),this._threeGeometry.renderOrder=1e3,e&&(e._clouds.add(this._threeGeometry),e._clouds.updateMatrixWorld()))}async _createObject(e){switch(e.config.type){case"cloud":return Yf(e.config,this._position);default:throw new Error(`不支持的样式类型: ${e.config.type}`)}}}Xl.mergeOptions(Wp);const Pp={};class kl extends Ur{constructor(e){super(e);G(this,"_type","Label")}async _toThreeJSGeometry(){this._position=this._coordsTransform(),this._style&&(this._threeGeometry&&this._disposeGeometry(),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}async _createObject(e){switch(e.config.type){case"canvas-label-fixed":return Bf(e.config,new m.Vector3(0,0,0),this.getMap());case"canvas-label":return Uf(e.config,new m.Vector3(0,0,0));default:throw new Error(`不支持的样式类型: ${e.config.type}`)}}}kl.mergeOptions(Pp);const Cp={};class Dl extends Ur{constructor(e){super(e);G(this,"_type","TPoints");G(this,"_geometries");this._geometries=e.geometries}async _toThreeJSGeometry(){this._position=this._coordsTransform(),this._style&&(this._threeGeometry&&this._disposeGeometry(),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}_updateGeometry(){this._threeGeometry&&(this._threeGeometry.points&&this.add(this._threeGeometry.points),this._threeGeometry.InstancedCol&&this.add(this._threeGeometry.InstancedCol),this.updateMatrixWorld(!0))}async _createObject(e){switch(e.config.type){case"light":return Qf(e.config,this._geometries,this.getMap());default:throw new Error(`不支持的样式类型: ${e.config.type}`)}}}Dl.mergeOptions(Cp);function Gi(a,t){if(!a||a===!0)return!0;if(!Array.isArray(a))return!!a;switch(a[0]){case"all":return a.slice(1).every(n=>Gi(n,t));case"any":return a.slice(1).some(n=>Gi(n,t));case"!":return!Gi(a[1],t);case"==":{const n=it(a[1],t),r=it(a[2],t);return Zi(n)==Zi(r)}case"!=":{const n=it(a[1],t),r=it(a[2],t);return Zi(n)!=Zi(r)}case">":{const n=it(a[1],t),r=it(a[2],t);return Ln(n)>Ln(r)}case"<":{const n=it(a[1],t),r=it(a[2],t);return Ln(n)<Ln(r)}case">=":{const n=it(a[1],t),r=it(a[2],t);return Ln(n)>=Ln(r)}case"<=":{const n=it(a[1],t),r=it(a[2],t);return Ln(n)<=Ln(r)}case"in":{const n=it(a[1],t);return a.slice(2).map(s=>it(s,t)).includes(n)}case"!in":{const n=it(a[1],t);return!a.slice(2).map(s=>it(s,t)).includes(n)}case"has":{const n=a[1];return t!=null&&Object.prototype.hasOwnProperty.call(t,n)}case"!has":{const n=a[1];return!(t!=null&&Object.prototype.hasOwnProperty.call(t,n))}default:return!0}}function it(a,t){if(Array.isArray(a))switch(a[0]){case"get":return t?t[a[1]]:void 0;default:return a}return a}function Zi(a){if(a==null)return null;if(typeof a=="string"){const t=Number(a);if(!isNaN(t)&&a.trim()!=="")return t}return typeof a=="boolean"?a?1:0:a}function Ln(a){if(a==null)return 0;if(typeof a=="number")return a;if(typeof a=="boolean")return a?1:0;if(typeof a=="string"){const t=Number(a);return isNaN(t)?0:t}return Number(a)}class Vp extends Un{constructor(e,n){super(e,n);G(this,"TILE_SIZE");G(this,"EXTENT");G(this,"style");G(this,"_tileFeatureMap",new Map);G(this,"_activeFeatureFilter");this.TILE_SIZE=n.tileSize??256,this.EXTENT=n.extent??4096,this.style=n.style||[],this._onMapUpdate=this._onMapUpdate.bind(this)}processTileData(e,n){const r=this.getMap(),s=`${e.z}-${e.x}-${e.y}`,l=this._tileFeatureMap.get(s);if(l&&l.length>0){l.forEach(p=>{p.visible=!0,this.children.some(f=>f&&p&&f.uuid===p.uuid)||p.addTo(this)});return}const c=n.vectorData;if(!c||!c.layers||!r||this.style.length===0)return;const u=[],d=this.style;Object.keys(c.layers).forEach(p=>{const f=c.layers[p];for(let y=0;y<f.length;y++){const v=f[y],b=v.geometry;if(this._activeFeatureFilter&&!this._activeFeatureFilter(v.properties))continue;let T=null;for(const _ of d)if(this._evaluateFilter(_.filter,v.properties,p,v.geometry.type)){T=_.style;break}if(T){const _={isVectorTile:!0,tileZ:e.z,tileX:e.x,tileY:e.y,rawCoordinates:b,extent:this.EXTENT,tileSize:this.TILE_SIZE},S=this._createFeatureInstance(v.geometry,v.geometry.type,T,v.properties);S&&(S.userData.tileData=_,S.style=Kt.create(T),S.addTo(this),S.initializeGeometry(),u.push(S))}}}),this._tileFeatureMap.set(s,u)}_evaluateFilter(e,n,r,s){if(!e||e===!0)return!0;const l={...n,$layer:r,$type:s};return Gi(e,l)}hideFeaturesByTileKey(e){const n=this._tileFeatureMap.get(e);n&&n.forEach(r=>{r.visible=!1})}removeFeaturesByTileKey(e){this._removeFeaturesByTileKey(e)}_removeFeaturesByTileKey(e){const n=this._tileFeatureMap.get(e);n&&(n.forEach(r=>{r._remove()}),this._tileFeatureMap.delete(e))}_createFeatureInstance(e,n,r,s){const c={geometry:{ismvt:!0,...e},style:r,userData:s};switch(n){case"Point":return new no(c);case"LineString":return new ro(c);default:return null}}setFeatureFilter(e){this._activeFeatureFilter=e}clearFeatureFilter(){this._activeFeatureFilter=void 0}setOpacity(e){this.opacity=e,this._tileFeatureMap.forEach(n=>{n.forEach(r=>{r.material&&(r.material.opacity=e,r.material.transparent=e<1)})})}_onMapUpdate(){}validateFeature(e){return e instanceof Yn}dispose(){this._tileFeatureMap.forEach((e,n)=>{this._removeFeaturesByTileKey(n)}),super.dispose()}}class zl extends Mi{constructor(e,n){super(e,n);G(this,"isTileLayer",!0);G(this,"layerType","base");G(this,"isBaseLayer",!1);G(this,"_enabled",!0);G(this,"_visible",!0);G(this,"_rootTile");G(this,"_loader");G(this,"_LODThreshold",1);G(this,"isSceneLayer",!1);G(this,"opacity",1);G(this,"source");G(this,"projection");G(this,"minLevel",2);G(this,"maxLevel",19);this.layerId=e,this.source=n.source,this.projection=n.projection,this.minLevel=n.minLevel??2,this.maxLevel=n.maxLevel??19,this._LODThreshold=n.LODThreshold??1,this.opacity=n.opacity??1,this.name=`Layer-${e}`,this._loader=this.createLoader(),this._rootTile=new nn,this._rootTile.matrixAutoUpdate=!0,this._rootTile.scale.set(this.projection.mapWidth,this.projection.mapHeight,1),this.add(this._rootTile),this._rootTile.updateMatrix(),this.layerId=e,this.name==="Layer-label-layer"&&this.position.set(0,0,1)}get LODThreshold(){return this._LODThreshold}set LODThreshold(e){this._LODThreshold=e}get loader(){return this._loader}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._rootTile&&(this._rootTile.visible=e&&this._visible)}get ivisible(){return this._visible&&super._visible}set ivisible(e){this._visible=e,this._rootTile&&(this._rootTile.visible=e&&this._enabled)}update(e){if(!(!this._enabled||!this._visible)){try{this._rootTile.update({camera:e,loader:this._loader,minLevel:this.minLevel,maxLevel:this.maxLevel,LODThreshold:this.LODThreshold})}catch{}console.groupEnd()}}_debugTileTree(){this._rootTile.traverse(e=>{e.isTile&&(e.loaded,e.visible,e.inFrustum,e.loaded)})}_getLODThreshold(){return 1}_getCurrentTileLevel(){let e=0;return this._rootTile.traverse(n=>{n.isTile&&n.loaded&&(e=Math.max(e,n.z))}),`最大层级: ${e}`}dispose(){this.remove(this._rootTile),this._rootTile.reload(this._loader)}reload(){this._rootTile.reload(this._loader)}setElevation(e){this.position.y=e,this.updateMatrix(),this.updateMatrixWorld(!0)}raiseElevation(e){this.position.z+=e,this.updateMatrix(),this.updateMatrixWorld(!0)}getElevation(){return this.position.y}}class Ol extends m.LoadingManager{constructor(){super(...arguments);G(this,"onParseEnd")}parseEnd(e){this.onParseEnd&&this.onParseEnd(e)}}const Xe={manager:new Ol,demLoaderMap:new Map,meshLoaderMap:new Map,imgLoaderMap:new Map,registerMaterialLoader(a){Xe.imgLoaderMap.set(a.dataType,a),a.info.author=a.info.author??Ms.name},registerGeometryLoader(a){Xe.demLoaderMap.set(a.dataType,a),a.info.author=a.info.author??Ms.name},registerMeshLoader(a){Xe.meshLoaderMap.set(a.dataType,a),a.info.author=a.info.author??Ms.name},getMaterialLoader(a){const t=Xe.imgLoaderMap.get(a.dataType);if(t)return t;throw`Source dataType "${a.dataType}" is not support!`},getGeometryLoader(a){const t=Xe.demLoaderMap.get(a.dataType);if(t)return t;throw`Source dataType "${a.dataType}" is not support!`},getMeshLoader(a){const t=Xe.meshLoaderMap.get(a.dataType);if(t)return t;throw`Source dataType "${a.dataType}" is not support!`}};class Ap{constructor(t){G(this,"worker");this.worker=t()}async run(t,e){return new Promise(n=>{this.worker.onmessage=r=>{n(r.data)},this.worker.postMessage(t,e)})}terminate(){this.worker.terminate()}}const Fp=4096,Kl=Math.PI;function io(a,t){const e=Math.floor(a[0]*t),n=Math.floor(a[1]*t),r=Math.floor((a[2]-a[0])*t),s=Math.floor((a[3]-a[1])*t);return{sx:e,sy:n,sw:r,sh:s}}function so(a,t,e,n){if(n<a.minLevel)return{url:void 0,clipBounds:[0,0,1,1]};if(n<=a.maxLevel)return{url:a._getUrl(t,e,n),clipBounds:[0,0,1,1]};const r=Xp(t,e,n,a.maxLevel),s=r.parentNO;return{url:a._getUrl(s.x,s.y,s.z),clipBounds:r.bounds}}function Xp(a,t,e,n){const r=e-n,s={x:a>>r,y:t>>r,z:e-r},l=Math.pow(2,r),c=Math.pow(.5,r),u=a%l/l-.5+c/2,d=t%l/l-.5+c/2,p=new m.Vector2(u,d),f=new m.Box2().setFromCenterAndSize(p,new m.Vector2(c,c)),y=[f.min.x+.5,f.min.y+.5,f.max.x+.5,f.max.y+.5];return{parentNO:s,bounds:y}}function oo(a,t,e,n,r=Fp){const{x:s,y:l}=a,c=(t+s/r)/Math.pow(2,n),u=(e+l/r)/Math.pow(2,n),d=c*360-180,f=Math.atan(Math.sinh(Kl*(1-2*u)))*180/Kl;return[parseFloat(d.toFixed(8)),parseFloat(f.toFixed(8))]}function kp(a,t,e,n){if(!a||!a.coordinates)throw new Error("无效的geometry数据格式");const r={type:a.type,coordinates:null};function s(l){if(typeof l=="object"&&l.x!==void 0&&l.y!==void 0)return oo(l,t,e,n);if(Array.isArray(l)&&l.length>0){const c=l[0];return typeof c=="object"&&c.x!==void 0&&c.y!==void 0?l.map(u=>oo(u,t,e,n)):l.map(u=>s(u))}return l}return r.coordinates=s(a.coordinates),r}class Ii{constructor(){G(this,"_imgSource",[]);G(this,"_demSource");G(this,"_vtSource");G(this,"manager",Xe.manager)}get imgSource(){return this._imgSource}set imgSource(t){this._imgSource=t}get demSource(){return this._demSource}set demSource(t){this._demSource=t}get vtSource(){return this._vtSource}set vtSource(t){this._vtSource=t}async load(t){const e=await this.loadGeometry(t),n=await this.loadMaterial(t);console.assert(!!n&&!!e);for(let r=0;r<n.length;r++)e.addGroup(0,1/0,r);return{materials:n,geometry:e}}unload(t){const e=t.material,n=t.geometry;for(let r=0;r<e.length;r++)e[r].dispose();n.dispose()}async loadGeometry(t){let e;if(this.demSource&&t.z>=this.demSource.minLevel&&this._isBoundsInSourceBounds(this.demSource,t.bounds)){const n=Xe.getGeometryLoader(this.demSource),r=this.demSource;e=await n.load({source:r,...t}).catch(s=>(console.error("Load material error",r.dataType,t.x,t.y,t.z),new m.PlaneGeometry)),e.addEventListener("dispose",()=>{n.unload&&n.unload(e)})}else if(this.vtSource&&t.z>=this.vtSource.minLevel&&this._isBoundsInSourceBounds(this.vtSource,t.bounds)){const n=Xe.getMeshLoader(this.vtSource),r=this.vtSource;e=await n.load({source:r,...t}).catch(s=>(console.error("Load geometry error",r.dataType,t.x,t.y,t.z),new m.PlaneGeometry)),e.addEventListener("dispose",()=>{n.unload&&n.unload(e)})}else e=new m.PlaneGeometry;return e}async loadMaterial(t){const n=this.imgSource.filter(r=>t.z>=r.minLevel&&this._isBoundsInSourceBounds(r,t.bounds)).map(async r=>{const s=Xe.getMaterialLoader(r),l=await s.load({source:r,...t}).catch(u=>(console.error("Load material error",r.dataType,t.x,t.y,t.z),new m.MeshBasicMaterial)),c=u=>{s.unload&&s.unload(u.target),u.target.removeEventListener("dispose",c)};return l instanceof m.MeshBasicMaterial||l.addEventListener("dispose",c),l});return Promise.all(n)}_isBoundsInSourceBounds(t,e){const n=t._projectionBounds;return!(e[2]<n[0]||e[3]<n[1]||e[0]>n[2]||e[1]>n[3])}}function Br(...a){const t=a,e=t&&t.length>1&&t[0].constructor||null;if(!e)throw new Error("concatenateTypedArrays - incorrect quantity of arguments or arguments have incompatible data types");const n=t.reduce((l,c)=>l+c.length,0),r=new e(n);let s=0;for(const l of t)r.set(l,s),s+=l.length;return r}function Rl(a,t,e,n){const r=n?zp(n,a.position.value):Dp(t),s=r.length,l=new Float32Array(s*6),c=new Float32Array(s*4),u=new t.constructor(s*6),d=new Float32Array(s*6);for(let f=0;f<s;f++)Op({edge:r[f],edgeIndex:f,attributes:a,skirtHeight:e,newPosition:l,newTexcoord0:c,newTriangles:u,newNormals:d});a.position.value=Br(a.position.value,l),a.texcoord.value=Br(a.texcoord.value,c),a.normal.value=Br(a.normal.value,d);const p=Br(t,u);return{attributes:a,indices:p}}function Dp(a){const t=[],e=Array.isArray(a)?a:Array.from(a);for(let r=0;r<e.length;r+=3){const s=e[r],l=e[r+1],c=e[r+2];t.push([s,l],[l,c],[c,s])}t.sort(([r,s],[l,c])=>{const u=Math.min(r,s),d=Math.min(l,c);return u!==d?u-d:Math.max(r,s)-Math.max(l,c)});const n=[];for(let r=0;r<t.length;r++)r+1<t.length&&t[r][0]===t[r+1][1]&&t[r][1]===t[r+1][0]?r++:n.push(t[r]);return n}function zp(a,t){const e=(r,s)=>{r.sort(s)};e(a.westIndices,(r,s)=>t[3*r+1]-t[3*s+1]),e(a.eastIndices,(r,s)=>t[3*s+1]-t[3*r+1]),e(a.southIndices,(r,s)=>t[3*s]-t[3*r]),e(a.northIndices,(r,s)=>t[3*r]-t[3*s]);const n=[];return Object.values(a).forEach(r=>{if(r.length>1)for(let s=0;s<r.length-1;s++)n.push([r[s],r[s+1]])}),n}function Op({edge:a,edgeIndex:t,attributes:e,skirtHeight:n,newPosition:r,newTexcoord0:s,newTriangles:l,newNormals:c}){const u=e.position.value.length,d=t*2,p=d+1;r.set(e.position.value.subarray(a[0]*3,a[0]*3+3),d*3),r[d*3+2]=r[d*3+2]-n,r.set(e.position.value.subarray(a[1]*3,a[1]*3+3),p*3),r[p*3+2]=r[p*3+2]-n,s.set(e.texcoord.value.subarray(a[0]*2,a[0]*2+2),d*2),s.set(e.texcoord.value.subarray(a[1]*2,a[1]*2+2),p*2);const f=t*2*3;l[f]=a[0],l[f+1]=u/3+p,l[f+2]=a[1],l[f+3]=u/3+p,l[f+4]=a[0],l[f+5]=u/3+d,c[f]=0,c[f+1]=0,c[f+2]=1,c[f+3]=0,c[f+4]=0,c[f+5]=1}function Yl(a){if(a.length<4)throw new Error(`DEM数组长度必须大于4,当前长度: ${a.length}!`);const t=Math.floor(Math.sqrt(a.length)),e=t,n=t,r=ao(n,e);return{attributes:Kp(a,n,e),indices:r}}function Kp(a,t,e){const n=e*t,r=new Float32Array(n*3),s=new Float32Array(n*2);let l=0;for(let c=0;c<t;c++)for(let u=0;u<e;u++){const d=u/(e-1),p=c/(t-1);s[l*2]=d,s[l*2+1]=p,r[l*3]=d-.5,r[l*3+1]=p-.5,r[l*3+2]=a[(t-c-1)*e+u],l++}return{position:{value:r,size:3},texcoord:{value:s,size:2},normal:{value:lo(r,ao(t,e)),size:3}}}function ao(a,t){const e=6*(t-1)*(a-1),n=new Uint16Array(e);let r=0;for(let s=0;s<a-1;s++)for(let l=0;l<t-1;l++){const c=s*t+l,u=c+1,d=c+t,p=d+1,f=r*6;n[f]=c,n[f+1]=u,n[f+2]=d,n[f+3]=d,n[f+4]=u,n[f+5]=p,r++}return n}function lo(a,t){const e=new Float32Array(a.length);for(let n=0;n<t.length;n+=3){const r=t[n]*3,s=t[n+1]*3,l=t[n+2]*3,c=a[r],u=a[r+1],d=a[r+2],p=a[s],f=a[s+1],y=a[s+2],v=a[l],b=a[l+1],T=a[l+2],_=p-c,S=f-u,L=y-d,I=v-c,F=b-u,K=T-d,D=S*K-L*F,O=L*I-_*K,V=_*F-S*I,R=Math.sqrt(D*D+O*O+V*V),P=[0,0,1];if(R>0){const k=1/R;P[0]=D*k,P[1]=O*k,P[2]=V*k}for(let k=0;k<3;k++)e[r+k]=e[s+k]=e[l+k]=P[k]}return e}class dr extends m.PlaneGeometry{constructor(){super(...arguments);G(this,"type","TileGeometry")}setData(e,n=1e3){let r=e instanceof Float32Array?Yl(e):e;r=Rl(r.attributes,r.indices,n);const{attributes:s,indices:l}=r;return this.setIndex(new m.BufferAttribute(l,1)),this.setAttribute("position",new m.BufferAttribute(s.position.value,s.position.size)),this.setAttribute("uv",new m.BufferAttribute(s.texcoord.value,s.texcoord.size)),this.setAttribute("normal",new m.BufferAttribute(s.normal.value,s.normal.size)),this.computeBoundingBox(),this.computeBoundingSphere(),this}}class Ul{constructor(t=257){G(this,"gridSize");G(this,"numTriangles");G(this,"numParentTriangles");G(this,"indices");G(this,"coords");this.gridSize=t;const e=t-1;if(e&e-1)throw new Error(`Expected grid size to be 2^n+1, got ${t}.`);this.numTriangles=e*e*2-2,this.numParentTriangles=this.numTriangles-e*e,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(this.numTriangles*4);for(let n=0;n<this.numTriangles;n++){let r=n+2,s=0,l=0,c=0,u=0,d=0,p=0;for(r&1?c=u=d=e:s=l=p=e;(r>>=1)>1;){const y=s+c>>1,v=l+u>>1;r&1?(c=s,u=l,s=d,l=p):(s=c,l=u,c=d,u=p),d=y,p=v}const f=n*4;this.coords[f+0]=s,this.coords[f+1]=l,this.coords[f+2]=c,this.coords[f+3]=u}}createTile(t){return new Rp(t,this)}}class Rp{constructor(t,e){G(this,"martini");G(this,"terrain");G(this,"errors");const n=e.gridSize;if(t.length!==n*n)throw new Error(`Expected terrain data of length ${n*n} (${n} x ${n}), got ${t.length}.`);this.terrain=t,this.martini=e,this.errors=new Float32Array(t.length),this.update()}update(){const{numTriangles:t,numParentTriangles:e,coords:n,gridSize:r}=this.martini,{terrain:s,errors:l}=this;for(let c=t-1;c>=0;c--){const u=c*4,d=n[u+0],p=n[u+1],f=n[u+2],y=n[u+3],v=d+f>>1,b=p+y>>1,T=v+b-p,_=b+d-v,S=(s[p*r+d]+s[y*r+f])/2,L=b*r+v,I=Math.abs(S-s[L]);if(l[L]=Math.max(l[L],I),c<e){const F=(p+_>>1)*r+(d+T>>1),K=(y+_>>1)*r+(f+T>>1);l[L]=Math.max(l[L],l[F],l[K])}}}getGeometryData(t=0){const{gridSize:e,indices:n}=this.martini,{errors:r}=this;let s=0,l=0;const c=e-1;let u,d,p=0;n.fill(0);function f(L,I,F,K,D,O){const V=L+F>>1,R=I+K>>1;Math.abs(L-D)+Math.abs(I-O)>1&&r[R*e+V]>t?(f(D,O,L,I,V,R),f(F,K,D,O,V,R)):(u=I*e+L,d=K*e+F,p=O*e+D,n[u]===0&&(n[u]=++s),n[d]===0&&(n[d]=++s),n[p]===0&&(n[p]=++s),l++)}f(0,0,c,c,c,0),f(c,c,0,0,0,c);const y=s*2,v=l*3,b=new Uint16Array(y),T=new Uint32Array(v);let _=0;function S(L,I,F,K,D,O){const V=L+F>>1,R=I+K>>1;if(Math.abs(L-D)+Math.abs(I-O)>1&&r[R*e+V]>t)S(D,O,L,I,V,R),S(F,K,D,O,V,R);else{const P=n[I*e+L]-1,k=n[K*e+F]-1,N=n[O*e+D]-1;b[2*P]=L,b[2*P+1]=I,b[2*k]=F,b[2*k+1]=K,b[2*N]=D,b[2*N+1]=O,T[_++]=P,T[_++]=k,T[_++]=N}}return S(0,0,c,c,c,0),S(c,c,0,0,0,c),{attributes:this._getMeshAttributes(this.terrain,b,T),indices:T}}_getMeshAttributes(t,e,n){const r=Math.floor(Math.sqrt(t.length)),s=r-1,l=e.length/2,c=new Float32Array(l*3),u=new Float32Array(l*2);for(let p=0;p<l;p++){const f=e[p*2],y=e[p*2+1],v=y*r+f;c[3*p+0]=f/s-.5,c[3*p+1]=.5-y/s,c[3*p+2]=t[v],u[2*p+0]=f/s,u[2*p+1]=1-y/s}const d=lo(c,n);return{position:{value:c,size:3},texcoord:{value:u,size:2},normal:{value:d,size:3}}}}class co{constructor(){G(this,"info",{version:"0.10.0",description:"Terrain loader base class"});G(this,"dataType","")}async load(t){const{source:e,x:n,y:r,z:s}=t,{url:l,clipBounds:c}=so(e,n,r,s);if(!l)return new dr;const u=await this.doLoad(l,{source:e,x:n,y:r,z:s,bounds:c});return Xe.manager.parseEnd(l),u}}class uo extends m.MeshStandardMaterial{constructor(t={}){super({transparent:!0,side:m.FrontSide,...t})}setTexture(t){this.map=t,this.needsUpdate=!0}dispose(){const t=this.map;t&&(t.image instanceof ImageBitmap&&t.image.close(),t.dispose())}}var tt=(a=>(a[a.Unknown=0]="Unknown",a[a.Point=1]="Point",a[a.Linestring=2]="Linestring",a[a.Polygon=3]="Polygon",a))(tt||{});class Bl{render(t,e,n,r,s=1){switch(t.lineCap="round",t.lineJoin="round",(r.shadowBlur??0)>0&&(t.shadowBlur=r.shadowBlur??2,t.shadowColor=r.shadowColor??"black",t.shadowOffsetX=r.shadowOffset?r.shadowOffset[0]:0,t.shadowOffsetY=r.shadowOffset?r.shadowOffset[1]:0),e){case tt.Point:t.textAlign="center",t.textBaseline="middle",t.font=r.font??"14px Arial",t.fillStyle=r.fontColor??"white",this._renderPointText(t,n,s,r.textField??"name",r.fontOffset??[0,-8]);break;case tt.Linestring:this._renderLineString(t,n,s);break;case tt.Polygon:this._renderPolygon(t,n,s);break;default:console.warn(`Unknown feature type: ${e}`)}(r.fill||e===tt.Point)&&(t.globalAlpha=r.fillOpacity||.5,t.fillStyle=r.fillColor||r.color||"#3388ff",t.fill(r.fillRule||"evenodd")),(r.stroke??!0)&&(r.weight??1)>0&&(t.globalAlpha=r.opacity||1,t.lineWidth=r.weight||1,t.strokeStyle=r.color||"#3388ff",t.setLineDash(r.dashArray||[]),t.stroke())}_renderPointText(t,e,n=1,r="name",s=[0,0]){const l=e.geometry;t.beginPath();for(const u of l)for(let d=0;d<u.length;d++){const p=u[d];t.arc(p.x*n,p.y*n,2,0,2*Math.PI)}const c=e.properties;c&&c[r]&&t.fillText(c[r],l[0][0].x*n+s[0],l[0][0].y*n+s[1])}_renderLineString(t,e,n){const r=e.geometry;t.beginPath();for(const s of r)for(let l=0;l<s.length;l++){const{x:c,y:u}=s[l];l===0?t.moveTo(c*n,u*n):t.lineTo(c*n,u*n)}}_renderPolygon(t,e,n){const r=e.geometry;t.beginPath();for(let s=0;s<r.length;s++){const l=r[s];for(let c=0;c<l.length;c++){const{x:u,y:d}=l[c];c===0?t.moveTo(u*n,d*n):t.lineTo(u*n,d*n)}t.closePath()}}}class ho{constructor(){G(this,"info",{version:"0.10.0",description:"Image loader base class"});G(this,"dataType","")}async load(t){const{source:e,x:n,y:r,z:s}=t,l=new uo,{url:c,clipBounds:u}=so(e,n,r,s);if(c){const d=await this.doLoad(c,{source:e,x:n,y:r,z:s,bounds:u});l.map=d,Xe.manager.parseEnd(c)}return l}}class Yp{constructor(){G(this,"info",{version:"0.10.0",description:"Canvas tile abstract loader"});G(this,"dataType","")}async load(t){const e=this._creatCanvasContext(256,256);this.drawTile(e,t);const n=new m.CanvasTexture(e.canvas.transferToImageBitmap());return new uo({transparent:!0,map:n,opacity:t.source.opacity})}_creatCanvasContext(t,e){const r=new OffscreenCanvas(t,e).getContext("2d");if(!r)throw new Error("create canvas context failed");return r.scale(1,-1),r.translate(0,-e),r}}class Up extends ho{constructor(){super(...arguments);G(this,"info",{version:"0.10.0",description:"Tile image loader. It can load xyz tile image."});G(this,"dataType","image");G(this,"loader",new m.ImageLoader(Xe.manager))}async doLoad(e,n){const r=await this.loader.loadAsync(e).catch(c=>new Image(1,1)),s=new m.Texture;s.colorSpace=m.SRGBColorSpace;const{bounds:l}=n;return l[2]-l[0]<1?s.image=Bp(r,l):s.image=r,s.needsUpdate=!0,s}}function Bp(a,t){const e=a.width,n=new OffscreenCanvas(e,e),r=n.getContext("2d"),{sx:s,sy:l,sw:c,sh:u}=io(t,a.width);return r.drawImage(a,s,l,c,u,0,0,e,e),n}const Np=`{
|
|
655
|
+
`)}setDiffusionFromObject(e){if(!this.shaderOption.effects?.diffusion)return;const n=new wt.Box3().setFromObject(e);if(n.isEmpty())return;const r=new wt.Vector3;n.getCenter(r);const s=[new wt.Vector3(n.min.x,n.min.y,n.min.z),new wt.Vector3(n.max.x,n.max.y,n.max.z)];let l=0;s.forEach(c=>{const u=r.distanceTo(c);u>l&&(l=u)}),this.shaderOption.effects.diffusion={...this.shaderOption.effects.diffusion,center:r,maxDistance:l},this.needsUpdate=!0}updateBoundingBox(e,n){this.shaderOption.minY=e,this.shaderOption.maxY=n,this.needsUpdate=!0}updateEffects(e){this.shaderOption.effects={...this.shaderOption.effects,...e},this.needsUpdate=!0}animate(){requestAnimationFrame(()=>this.animate()),this.time.value=this.clock.getElapsedTime(),this.startTime.value<1&&(this.startTime.value+=.01)}}const Ip={emissive:!1,emissiveIntensity:1,emissiveColor:"#ffffff"};class Fl extends Ur{constructor(e){super(e);G(this,"_type","Model");G(this,"_emissive",!1);G(this,"_emissiveIntensity",1);G(this,"_emissiveColor","#ffffff");G(this,"_mixer",null);G(this,"_currentAction",null);G(this,"_animations",[]);G(this,"_clock",new m.Clock);G(this,"_autoUpdate",!0);G(this,"_animationRequestId",null);G(this,"_iscity",!1);this._emissive=e.emissive||!1,this._emissiveIntensity=e.emissiveIntensity||1,this._emissiveColor=e.emissiveColor||"#ffffff",this.castShadow=e.castShadow||!1,this.receiveShadow=e.receiveShadow||!1,this._iscity=e.iscity||!1}async _toThreeJSGeometry(){this._position=this._coordsTransform(),this._style&&(this._threeGeometry&&this._disposeGeometry(),this.modelunino=await this._createObject(this._style),this._threeGeometry=this.modelunino.model,this._threeGeometry.userData._type="Model",this.modelunino.animations&&this.modelunino.animations.length>0&&(this._animations=this.modelunino.animations,this._mixer=new m.AnimationMixer(this._threeGeometry),this._startAnimationLoop(),this.playAnimation({name:this._animations[0].name,loop:!0,speed:1.5,fadeInDuration:.5,fadeOutDuration:.3})),this._updateGeometry(),this.setShadows({cast:this.castShadow,receive:this.receiveShadow}),this._applyEmissionProperties(),this._iscity&&this._rendercity())}async _createObject(e){switch(e.config.type){case"fbx":case"gltf":return Df(e.config,this._position);default:throw new Error(`不支持的样式类型: ${e.config.type}`)}}_applyEmissionProperties(){this._threeGeometry&&this._threeGeometry.traverse(e=>{if("material"in e){const n=e.material;n&&(n.emissiveIntensity=this._emissive?this._emissiveIntensity:0,n.emissive&&n.emissive.setStyle(this._emissiveColor))}})}get emissive(){return this._emissive}set emissive(e){this._emissive=e,this._applyEmissionProperties()}get emissiveIntensity(){return this._emissiveIntensity}set emissiveIntensity(e){this._emissiveIntensity=e,this._applyEmissionProperties()}get emissiveColor(){return this._emissiveColor}set emissiveColor(e){this._emissiveColor=e,this._applyEmissionProperties()}setEmission(e,n,r){this._emissive=e,n!==void 0&&(this._emissiveIntensity=n),r!==void 0&&(this._emissiveColor=r),this._applyEmissionProperties()}async setShadows(e){this.castShadow=e.cast,this.receiveShadow=e.receive,this._threeGeometry&&this._threeGeometry.traverse(n=>{n.isMesh&&n.material&&(n.castShadow=e.cast,n.receiveShadow=e.receive)})}playAnimation(e){if(!this._mixer||this._animations.length===0){console.warn("模型没有可用的动画");return}this._currentAction&&(e.fadeOutDuration&&e.fadeOutDuration>0?this._currentAction.fadeOut(e.fadeOutDuration):this._currentAction.stop());const n=typeof e.name=="number"?this._animations[e.name]:this._animations.find(r=>r.name===e.name);if(!n){console.warn(`找不到动画: ${e.name}`);return}this._currentAction=this._mixer.clipAction(n),this._currentAction.setLoop(e.loop?m.LoopRepeat:m.LoopOnce,e.loop?1/0:1),this._currentAction.timeScale=e.speed||1,this._currentAction.time=e.startAt||0,this._currentAction.setEffectiveWeight(e.weight||1),e.fadeInDuration&&e.fadeInDuration>0&&this._currentAction.fadeIn(e.fadeInDuration),this._currentAction.play(),this._autoUpdate&&this._animationRequestId===null&&this._startAnimationLoop()}stopAnimation(e={}){this._currentAction&&(e.fadeDuration&&e.fadeDuration>0?(this._currentAction.fadeOut(e.fadeDuration),setTimeout(()=>{this._currentAction&&(this._currentAction.stop(),this._currentAction=null)},e.fadeDuration*1e3)):(this._currentAction.stop(),this._currentAction=null))}setAnimationPaused(e){this._currentAction&&(this._currentAction.paused=e.paused)}setAnimationSpeed(e){this._currentAction&&(this._currentAction.timeScale=e.speed)}updateAnimation(e){this._mixer&&this._mixer.update(e.deltaTime)}getAnimationNames(){return this._animations.map(e=>e.name)}getCurrentAnimationName(){return this._currentAction?this._currentAction.getClip().name:null}getAnimationDuration(e){let n;return typeof e.name=="number"?n=this._animations[e.name]:n=this._animations.find(r=>r.name===e.name),n?n.duration:null}dispose(){this._stopAnimationLoop(),this._mixer&&(this._mixer.stopAllAction(),this._mixer.uncacheRoot(this._threeGeometry)),super.dispose()}_startAnimationLoop(){if(!this._autoUpdate||this._animationRequestId!==null)return;const e=()=>{if(this._mixer){const n=this._clock.getDelta();this._mixer.update(n)}this._animationRequestId=requestAnimationFrame(e)};this._clock.start(),this._animationRequestId=requestAnimationFrame(e)}_stopAnimationLoop(){this._animationRequestId!==null&&(cancelAnimationFrame(this._animationRequestId),this._animationRequestId=null),this._clock.stop()}setAutoUpdate(e){this._autoUpdate=e,e?this._startAnimationLoop():this._stopAnimationLoop()}_rendercity(){this.traverse(async e=>{if(e instanceof m.Mesh&&e.material){if(e.castShadow=!0,e.name==="building"){const n=new Zp({color:new m.Color("#6BA7EC").multiplyScalar(1.8),opacity:.95,shaderOption:{minY:0,maxY:50,minRate:.3,maxRate:1.5,effects:{diffusion:{enabled:!0,color:new m.Color("#FFFFF"),width:300,speed:.05},flow:{enabled:!1,color:new m.Color("#FFFFF"),range:1e3,speed:3e3},sweep:{enabled:!0,color:new m.Color("#ffffff"),width:3,speed:5}}}}),r=new m.Box3().setFromObject(e);n.updateBoundingBox(r.min.y,r.max.y),n.setDiffusionFromObject(e),e.material=n,e.material.needsUpdate=!0}e.name==="grass"&&(e.castShadow=!1,e.receiveShadow=!0,e.material.color=new m.Color("#81e4d8ff)").multiplyScalar(.7),e.material.metalness=.2,e.material.roughness=.8,["metalnessMap","normalMap","roughnessMap","specularColorMap"].forEach(n=>{const r=e.material[n];r&&(r.wrapS=r.wrapT=m.RepeatWrapping,r.repeat.set(.3,.3),r.needsUpdate=!0)}),e.material.normalScale=new m.Vector2(3,3))}})}}Fl.mergeOptions(Ip);const Wp={};class Xl extends Ur{constructor(e){super(e);G(this,"_type","Cloud")}async _toThreeJSGeometry(){this._position=this._coordsTransform(),this._style&&(this._threeGeometry&&this._disposeGeometry(),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}_updateGeometry(){this._disposeGeometry();const e=this.getLayer();this._threeGeometry&&(this._threeGeometry.position.copy(this._position),this._threeGeometry.renderOrder=1e3,e&&(e._clouds.add(this._threeGeometry),e._clouds.updateMatrixWorld()))}async _createObject(e){switch(e.config.type){case"cloud":return Yf(e.config,this._position);default:throw new Error(`不支持的样式类型: ${e.config.type}`)}}}Xl.mergeOptions(Wp);const Pp={};class kl extends Ur{constructor(e){super(e);G(this,"_type","Label")}async _toThreeJSGeometry(){this._position=this._coordsTransform(),this._style&&(this._threeGeometry&&this._disposeGeometry(),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}async _createObject(e){switch(e.config.type){case"canvas-label-fixed":return Bf(e.config,new m.Vector3(0,0,0),this.getMap());case"canvas-label":return Uf(e.config,new m.Vector3(0,0,0));default:throw new Error(`不支持的样式类型: ${e.config.type}`)}}}kl.mergeOptions(Pp);const Cp={};class Dl extends Ur{constructor(e){super(e);G(this,"_type","TPoints");G(this,"_geometries");this._geometries=e.geometries}async _toThreeJSGeometry(){this._position=this._coordsTransform(),this._style&&(this._threeGeometry&&this._disposeGeometry(),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}_updateGeometry(){this._threeGeometry&&(this._threeGeometry.points&&this.add(this._threeGeometry.points),this._threeGeometry.InstancedCol&&this.add(this._threeGeometry.InstancedCol),this.updateMatrixWorld(!0))}async _createObject(e){switch(e.config.type){case"light":return Qf(e.config,this._geometries,this.getMap());default:throw new Error(`不支持的样式类型: ${e.config.type}`)}}}Dl.mergeOptions(Cp);function Gi(a,t){if(!a||a===!0)return!0;if(!Array.isArray(a))return!!a;switch(a[0]){case"all":return a.slice(1).every(n=>Gi(n,t));case"any":return a.slice(1).some(n=>Gi(n,t));case"!":return!Gi(a[1],t);case"==":{const n=it(a[1],t),r=it(a[2],t);return Zi(n)==Zi(r)}case"!=":{const n=it(a[1],t),r=it(a[2],t);return Zi(n)!=Zi(r)}case">":{const n=it(a[1],t),r=it(a[2],t);return Sn(n)>Sn(r)}case"<":{const n=it(a[1],t),r=it(a[2],t);return Sn(n)<Sn(r)}case">=":{const n=it(a[1],t),r=it(a[2],t);return Sn(n)>=Sn(r)}case"<=":{const n=it(a[1],t),r=it(a[2],t);return Sn(n)<=Sn(r)}case"in":{const n=it(a[1],t);return a.slice(2).map(s=>it(s,t)).includes(n)}case"!in":{const n=it(a[1],t);return!a.slice(2).map(s=>it(s,t)).includes(n)}case"has":{const n=a[1];return t!=null&&Object.prototype.hasOwnProperty.call(t,n)}case"!has":{const n=a[1];return!(t!=null&&Object.prototype.hasOwnProperty.call(t,n))}default:return!0}}function it(a,t){if(Array.isArray(a))switch(a[0]){case"get":return t?t[a[1]]:void 0;default:return a}return a}function Zi(a){if(a==null)return null;if(typeof a=="string"){const t=Number(a);if(!isNaN(t)&&a.trim()!=="")return t}return typeof a=="boolean"?a?1:0:a}function Sn(a){if(a==null)return 0;if(typeof a=="number")return a;if(typeof a=="boolean")return a?1:0;if(typeof a=="string"){const t=Number(a);return isNaN(t)?0:t}return Number(a)}class Vp extends Un{constructor(e,n){super(e,n);G(this,"TILE_SIZE");G(this,"EXTENT");G(this,"style");G(this,"_tileFeatureMap",new Map);G(this,"_activeFeatureFilter");this.TILE_SIZE=n.tileSize??256,this.EXTENT=n.extent??4096,this.style=n.style||[],this._onMapUpdate=this._onMapUpdate.bind(this)}processTileData(e,n){const r=this.getMap(),s=`${e.z}-${e.x}-${e.y}`,l=this._tileFeatureMap.get(s);if(l&&l.length>0){l.forEach(p=>{p.visible=!0,this.children.some(f=>f&&p&&f.uuid===p.uuid)||p.addTo(this)});return}const c=n.vectorData;if(!c||!c.layers||!r||this.style.length===0)return;const u=[],d=this.style;Object.keys(c.layers).forEach(p=>{const f=c.layers[p];for(let y=0;y<f.length;y++){const v=f[y],b=v.geometry;if(this._activeFeatureFilter&&!this._activeFeatureFilter(v.properties))continue;let T=null;for(const _ of d)if(this._evaluateFilter(_.filter,v.properties,p,v.geometry.type)){T=_.style;break}if(T){const _={isVectorTile:!0,tileZ:e.z,tileX:e.x,tileY:e.y,rawCoordinates:b,extent:this.EXTENT,tileSize:this.TILE_SIZE},S=this._createFeatureInstance(v.geometry,v.geometry.type,T,v.properties);S&&(S.userData.tileData=_,S.style=It.create(T),S.addTo(this),S.initializeGeometry(),u.push(S))}}}),this._tileFeatureMap.set(s,u)}_evaluateFilter(e,n,r,s){if(!e||e===!0)return!0;const l={...n,$layer:r,$type:s};return Gi(e,l)}hideFeaturesByTileKey(e){const n=this._tileFeatureMap.get(e);n&&n.forEach(r=>{r.visible=!1})}removeFeaturesByTileKey(e){this._removeFeaturesByTileKey(e)}_removeFeaturesByTileKey(e){const n=this._tileFeatureMap.get(e);n&&(n.forEach(r=>{r._remove()}),this._tileFeatureMap.delete(e))}_createFeatureInstance(e,n,r,s){const c={geometry:{ismvt:!0,...e},style:r,userData:s};switch(n){case"Point":return new no(c);case"LineString":return new ro(c);default:return null}}setFeatureFilter(e){this._activeFeatureFilter=e}clearFeatureFilter(){this._activeFeatureFilter=void 0}setOpacity(e){this.opacity=e,this._tileFeatureMap.forEach(n=>{n.forEach(r=>{r.material&&(r.material.opacity=e,r.material.transparent=e<1)})})}_onMapUpdate(){}validateFeature(e){return e instanceof Ln}dispose(){this._tileFeatureMap.forEach((e,n)=>{this._removeFeaturesByTileKey(n)}),super.dispose()}}class zl extends Mi{constructor(e,n){super(e,n);G(this,"isTileLayer",!0);G(this,"layerType","base");G(this,"isBaseLayer",!1);G(this,"_enabled",!0);G(this,"_visible",!0);G(this,"_rootTile");G(this,"_loader");G(this,"_LODThreshold",1);G(this,"isSceneLayer",!1);G(this,"opacity",1);G(this,"source");G(this,"projection");G(this,"minLevel",2);G(this,"maxLevel",19);this.layerId=e,this.source=n.source,this.projection=n.projection,this.minLevel=n.minLevel??2,this.maxLevel=n.maxLevel??19,this._LODThreshold=n.LODThreshold??1,this.opacity=n.opacity??1,this.name=`Layer-${e}`,this._loader=this.createLoader(),this._rootTile=new nn,this._rootTile.matrixAutoUpdate=!0,this._rootTile.scale.set(this.projection.mapWidth,this.projection.mapHeight,1),this.add(this._rootTile),this._rootTile.updateMatrix(),this.layerId=e,this.name==="Layer-label-layer"&&this.position.set(0,0,1)}get LODThreshold(){return this._LODThreshold}set LODThreshold(e){this._LODThreshold=e}get loader(){return this._loader}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._rootTile&&(this._rootTile.visible=e&&this._visible)}get ivisible(){return this._visible&&super._visible}set ivisible(e){this._visible=e,this._rootTile&&(this._rootTile.visible=e&&this._enabled)}update(e){if(!(!this._enabled||!this._visible)){try{this._rootTile.update({camera:e,loader:this._loader,minLevel:this.minLevel,maxLevel:this.maxLevel,LODThreshold:this.LODThreshold})}catch{}console.groupEnd()}}_debugTileTree(){this._rootTile.traverse(e=>{e.isTile&&(e.loaded,e.visible,e.inFrustum,e.loaded)})}_getLODThreshold(){return 1}_getCurrentTileLevel(){let e=0;return this._rootTile.traverse(n=>{n.isTile&&n.loaded&&(e=Math.max(e,n.z))}),`最大层级: ${e}`}dispose(){this.remove(this._rootTile),this._rootTile.reload(this._loader)}reload(){this._rootTile.reload(this._loader)}setElevation(e){this.position.y=e,this.updateMatrix(),this.updateMatrixWorld(!0)}raiseElevation(e){this.position.z+=e,this.updateMatrix(),this.updateMatrixWorld(!0)}getElevation(){return this.position.y}}class Ol extends m.LoadingManager{constructor(){super(...arguments);G(this,"onParseEnd")}parseEnd(e){this.onParseEnd&&this.onParseEnd(e)}}const Xe={manager:new Ol,demLoaderMap:new Map,meshLoaderMap:new Map,imgLoaderMap:new Map,registerMaterialLoader(a){Xe.imgLoaderMap.set(a.dataType,a),a.info.author=a.info.author??Ms.name},registerGeometryLoader(a){Xe.demLoaderMap.set(a.dataType,a),a.info.author=a.info.author??Ms.name},registerMeshLoader(a){Xe.meshLoaderMap.set(a.dataType,a),a.info.author=a.info.author??Ms.name},getMaterialLoader(a){const t=Xe.imgLoaderMap.get(a.dataType);if(t)return t;throw`Source dataType "${a.dataType}" is not support!`},getGeometryLoader(a){const t=Xe.demLoaderMap.get(a.dataType);if(t)return t;throw`Source dataType "${a.dataType}" is not support!`},getMeshLoader(a){const t=Xe.meshLoaderMap.get(a.dataType);if(t)return t;throw`Source dataType "${a.dataType}" is not support!`}};class Ap{constructor(t){G(this,"worker");this.worker=t()}async run(t,e){return new Promise(n=>{this.worker.onmessage=r=>{n(r.data)},this.worker.postMessage(t,e)})}terminate(){this.worker.terminate()}}const Fp=4096,Kl=Math.PI;function io(a,t){const e=Math.floor(a[0]*t),n=Math.floor(a[1]*t),r=Math.floor((a[2]-a[0])*t),s=Math.floor((a[3]-a[1])*t);return{sx:e,sy:n,sw:r,sh:s}}function so(a,t,e,n){if(n<a.minLevel)return{url:void 0,clipBounds:[0,0,1,1]};if(n<=a.maxLevel)return{url:a._getUrl(t,e,n),clipBounds:[0,0,1,1]};const r=Xp(t,e,n,a.maxLevel),s=r.parentNO;return{url:a._getUrl(s.x,s.y,s.z),clipBounds:r.bounds}}function Xp(a,t,e,n){const r=e-n,s={x:a>>r,y:t>>r,z:e-r},l=Math.pow(2,r),c=Math.pow(.5,r),u=a%l/l-.5+c/2,d=t%l/l-.5+c/2,p=new m.Vector2(u,d),f=new m.Box2().setFromCenterAndSize(p,new m.Vector2(c,c)),y=[f.min.x+.5,f.min.y+.5,f.max.x+.5,f.max.y+.5];return{parentNO:s,bounds:y}}function oo(a,t,e,n,r=Fp){const{x:s,y:l}=a,c=(t+s/r)/Math.pow(2,n),u=(e+l/r)/Math.pow(2,n),d=c*360-180,f=Math.atan(Math.sinh(Kl*(1-2*u)))*180/Kl;return[parseFloat(d.toFixed(8)),parseFloat(f.toFixed(8))]}function kp(a,t,e,n){if(!a||!a.coordinates)throw new Error("无效的geometry数据格式");const r={type:a.type,coordinates:null};function s(l){if(typeof l=="object"&&l.x!==void 0&&l.y!==void 0)return oo(l,t,e,n);if(Array.isArray(l)&&l.length>0){const c=l[0];return typeof c=="object"&&c.x!==void 0&&c.y!==void 0?l.map(u=>oo(u,t,e,n)):l.map(u=>s(u))}return l}return r.coordinates=s(a.coordinates),r}class Ii{constructor(){G(this,"_imgSource",[]);G(this,"_demSource");G(this,"_vtSource");G(this,"manager",Xe.manager)}get imgSource(){return this._imgSource}set imgSource(t){this._imgSource=t}get demSource(){return this._demSource}set demSource(t){this._demSource=t}get vtSource(){return this._vtSource}set vtSource(t){this._vtSource=t}async load(t){const e=await this.loadGeometry(t),n=await this.loadMaterial(t);console.assert(!!n&&!!e);for(let r=0;r<n.length;r++)e.addGroup(0,1/0,r);return{materials:n,geometry:e}}unload(t){const e=t.material,n=t.geometry;for(let r=0;r<e.length;r++)e[r].dispose();n.dispose()}async loadGeometry(t){let e;if(this.demSource&&t.z>=this.demSource.minLevel&&this._isBoundsInSourceBounds(this.demSource,t.bounds)){const n=Xe.getGeometryLoader(this.demSource),r=this.demSource;e=await n.load({source:r,...t}).catch(s=>(console.error("Load material error",r.dataType,t.x,t.y,t.z),new m.PlaneGeometry)),e.addEventListener("dispose",()=>{n.unload&&n.unload(e)})}else if(this.vtSource&&t.z>=this.vtSource.minLevel&&this._isBoundsInSourceBounds(this.vtSource,t.bounds)){const n=Xe.getMeshLoader(this.vtSource),r=this.vtSource;e=await n.load({source:r,...t}).catch(s=>(console.error("Load geometry error",r.dataType,t.x,t.y,t.z),new m.PlaneGeometry)),e.addEventListener("dispose",()=>{n.unload&&n.unload(e)})}else e=new m.PlaneGeometry;return e}async loadMaterial(t){const n=this.imgSource.filter(r=>t.z>=r.minLevel&&this._isBoundsInSourceBounds(r,t.bounds)).map(async r=>{const s=Xe.getMaterialLoader(r),l=await s.load({source:r,...t}).catch(u=>(console.error("Load material error",r.dataType,t.x,t.y,t.z),new m.MeshBasicMaterial)),c=u=>{s.unload&&s.unload(u.target),u.target.removeEventListener("dispose",c)};return l instanceof m.MeshBasicMaterial||l.addEventListener("dispose",c),l});return Promise.all(n)}_isBoundsInSourceBounds(t,e){const n=t._projectionBounds;return!(e[2]<n[0]||e[3]<n[1]||e[0]>n[2]||e[1]>n[3])}}function Br(...a){const t=a,e=t&&t.length>1&&t[0].constructor||null;if(!e)throw new Error("concatenateTypedArrays - incorrect quantity of arguments or arguments have incompatible data types");const n=t.reduce((l,c)=>l+c.length,0),r=new e(n);let s=0;for(const l of t)r.set(l,s),s+=l.length;return r}function Rl(a,t,e,n){const r=n?zp(n,a.position.value):Dp(t),s=r.length,l=new Float32Array(s*6),c=new Float32Array(s*4),u=new t.constructor(s*6),d=new Float32Array(s*6);for(let f=0;f<s;f++)Op({edge:r[f],edgeIndex:f,attributes:a,skirtHeight:e,newPosition:l,newTexcoord0:c,newTriangles:u,newNormals:d});a.position.value=Br(a.position.value,l),a.texcoord.value=Br(a.texcoord.value,c),a.normal.value=Br(a.normal.value,d);const p=Br(t,u);return{attributes:a,indices:p}}function Dp(a){const t=[],e=Array.isArray(a)?a:Array.from(a);for(let r=0;r<e.length;r+=3){const s=e[r],l=e[r+1],c=e[r+2];t.push([s,l],[l,c],[c,s])}t.sort(([r,s],[l,c])=>{const u=Math.min(r,s),d=Math.min(l,c);return u!==d?u-d:Math.max(r,s)-Math.max(l,c)});const n=[];for(let r=0;r<t.length;r++)r+1<t.length&&t[r][0]===t[r+1][1]&&t[r][1]===t[r+1][0]?r++:n.push(t[r]);return n}function zp(a,t){const e=(r,s)=>{r.sort(s)};e(a.westIndices,(r,s)=>t[3*r+1]-t[3*s+1]),e(a.eastIndices,(r,s)=>t[3*s+1]-t[3*r+1]),e(a.southIndices,(r,s)=>t[3*s]-t[3*r]),e(a.northIndices,(r,s)=>t[3*r]-t[3*s]);const n=[];return Object.values(a).forEach(r=>{if(r.length>1)for(let s=0;s<r.length-1;s++)n.push([r[s],r[s+1]])}),n}function Op({edge:a,edgeIndex:t,attributes:e,skirtHeight:n,newPosition:r,newTexcoord0:s,newTriangles:l,newNormals:c}){const u=e.position.value.length,d=t*2,p=d+1;r.set(e.position.value.subarray(a[0]*3,a[0]*3+3),d*3),r[d*3+2]=r[d*3+2]-n,r.set(e.position.value.subarray(a[1]*3,a[1]*3+3),p*3),r[p*3+2]=r[p*3+2]-n,s.set(e.texcoord.value.subarray(a[0]*2,a[0]*2+2),d*2),s.set(e.texcoord.value.subarray(a[1]*2,a[1]*2+2),p*2);const f=t*2*3;l[f]=a[0],l[f+1]=u/3+p,l[f+2]=a[1],l[f+3]=u/3+p,l[f+4]=a[0],l[f+5]=u/3+d,c[f]=0,c[f+1]=0,c[f+2]=1,c[f+3]=0,c[f+4]=0,c[f+5]=1}function Yl(a){if(a.length<4)throw new Error(`DEM数组长度必须大于4,当前长度: ${a.length}!`);const t=Math.floor(Math.sqrt(a.length)),e=t,n=t,r=ao(n,e);return{attributes:Kp(a,n,e),indices:r}}function Kp(a,t,e){const n=e*t,r=new Float32Array(n*3),s=new Float32Array(n*2);let l=0;for(let c=0;c<t;c++)for(let u=0;u<e;u++){const d=u/(e-1),p=c/(t-1);s[l*2]=d,s[l*2+1]=p,r[l*3]=d-.5,r[l*3+1]=p-.5,r[l*3+2]=a[(t-c-1)*e+u],l++}return{position:{value:r,size:3},texcoord:{value:s,size:2},normal:{value:lo(r,ao(t,e)),size:3}}}function ao(a,t){const e=6*(t-1)*(a-1),n=new Uint16Array(e);let r=0;for(let s=0;s<a-1;s++)for(let l=0;l<t-1;l++){const c=s*t+l,u=c+1,d=c+t,p=d+1,f=r*6;n[f]=c,n[f+1]=u,n[f+2]=d,n[f+3]=d,n[f+4]=u,n[f+5]=p,r++}return n}function lo(a,t){const e=new Float32Array(a.length);for(let n=0;n<t.length;n+=3){const r=t[n]*3,s=t[n+1]*3,l=t[n+2]*3,c=a[r],u=a[r+1],d=a[r+2],p=a[s],f=a[s+1],y=a[s+2],v=a[l],b=a[l+1],T=a[l+2],_=p-c,S=f-u,L=y-d,I=v-c,F=b-u,K=T-d,D=S*K-L*F,O=L*I-_*K,V=_*F-S*I,R=Math.sqrt(D*D+O*O+V*V),P=[0,0,1];if(R>0){const k=1/R;P[0]=D*k,P[1]=O*k,P[2]=V*k}for(let k=0;k<3;k++)e[r+k]=e[s+k]=e[l+k]=P[k]}return e}class dr extends m.PlaneGeometry{constructor(){super(...arguments);G(this,"type","TileGeometry")}setData(e,n=1e3){let r=e instanceof Float32Array?Yl(e):e;r=Rl(r.attributes,r.indices,n);const{attributes:s,indices:l}=r;return this.setIndex(new m.BufferAttribute(l,1)),this.setAttribute("position",new m.BufferAttribute(s.position.value,s.position.size)),this.setAttribute("uv",new m.BufferAttribute(s.texcoord.value,s.texcoord.size)),this.setAttribute("normal",new m.BufferAttribute(s.normal.value,s.normal.size)),this.computeBoundingBox(),this.computeBoundingSphere(),this}}class Ul{constructor(t=257){G(this,"gridSize");G(this,"numTriangles");G(this,"numParentTriangles");G(this,"indices");G(this,"coords");this.gridSize=t;const e=t-1;if(e&e-1)throw new Error(`Expected grid size to be 2^n+1, got ${t}.`);this.numTriangles=e*e*2-2,this.numParentTriangles=this.numTriangles-e*e,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(this.numTriangles*4);for(let n=0;n<this.numTriangles;n++){let r=n+2,s=0,l=0,c=0,u=0,d=0,p=0;for(r&1?c=u=d=e:s=l=p=e;(r>>=1)>1;){const y=s+c>>1,v=l+u>>1;r&1?(c=s,u=l,s=d,l=p):(s=c,l=u,c=d,u=p),d=y,p=v}const f=n*4;this.coords[f+0]=s,this.coords[f+1]=l,this.coords[f+2]=c,this.coords[f+3]=u}}createTile(t){return new Rp(t,this)}}class Rp{constructor(t,e){G(this,"martini");G(this,"terrain");G(this,"errors");const n=e.gridSize;if(t.length!==n*n)throw new Error(`Expected terrain data of length ${n*n} (${n} x ${n}), got ${t.length}.`);this.terrain=t,this.martini=e,this.errors=new Float32Array(t.length),this.update()}update(){const{numTriangles:t,numParentTriangles:e,coords:n,gridSize:r}=this.martini,{terrain:s,errors:l}=this;for(let c=t-1;c>=0;c--){const u=c*4,d=n[u+0],p=n[u+1],f=n[u+2],y=n[u+3],v=d+f>>1,b=p+y>>1,T=v+b-p,_=b+d-v,S=(s[p*r+d]+s[y*r+f])/2,L=b*r+v,I=Math.abs(S-s[L]);if(l[L]=Math.max(l[L],I),c<e){const F=(p+_>>1)*r+(d+T>>1),K=(y+_>>1)*r+(f+T>>1);l[L]=Math.max(l[L],l[F],l[K])}}}getGeometryData(t=0){const{gridSize:e,indices:n}=this.martini,{errors:r}=this;let s=0,l=0;const c=e-1;let u,d,p=0;n.fill(0);function f(L,I,F,K,D,O){const V=L+F>>1,R=I+K>>1;Math.abs(L-D)+Math.abs(I-O)>1&&r[R*e+V]>t?(f(D,O,L,I,V,R),f(F,K,D,O,V,R)):(u=I*e+L,d=K*e+F,p=O*e+D,n[u]===0&&(n[u]=++s),n[d]===0&&(n[d]=++s),n[p]===0&&(n[p]=++s),l++)}f(0,0,c,c,c,0),f(c,c,0,0,0,c);const y=s*2,v=l*3,b=new Uint16Array(y),T=new Uint32Array(v);let _=0;function S(L,I,F,K,D,O){const V=L+F>>1,R=I+K>>1;if(Math.abs(L-D)+Math.abs(I-O)>1&&r[R*e+V]>t)S(D,O,L,I,V,R),S(F,K,D,O,V,R);else{const P=n[I*e+L]-1,k=n[K*e+F]-1,N=n[O*e+D]-1;b[2*P]=L,b[2*P+1]=I,b[2*k]=F,b[2*k+1]=K,b[2*N]=D,b[2*N+1]=O,T[_++]=P,T[_++]=k,T[_++]=N}}return S(0,0,c,c,c,0),S(c,c,0,0,0,c),{attributes:this._getMeshAttributes(this.terrain,b,T),indices:T}}_getMeshAttributes(t,e,n){const r=Math.floor(Math.sqrt(t.length)),s=r-1,l=e.length/2,c=new Float32Array(l*3),u=new Float32Array(l*2);for(let p=0;p<l;p++){const f=e[p*2],y=e[p*2+1],v=y*r+f;c[3*p+0]=f/s-.5,c[3*p+1]=.5-y/s,c[3*p+2]=t[v],u[2*p+0]=f/s,u[2*p+1]=1-y/s}const d=lo(c,n);return{position:{value:c,size:3},texcoord:{value:u,size:2},normal:{value:d,size:3}}}}class co{constructor(){G(this,"info",{version:"0.10.0",description:"Terrain loader base class"});G(this,"dataType","")}async load(t){const{source:e,x:n,y:r,z:s}=t,{url:l,clipBounds:c}=so(e,n,r,s);if(!l)return new dr;const u=await this.doLoad(l,{source:e,x:n,y:r,z:s,bounds:c});return Xe.manager.parseEnd(l),u}}class uo extends m.MeshStandardMaterial{constructor(t={}){super({transparent:!0,side:m.FrontSide,...t})}setTexture(t){this.map=t,this.needsUpdate=!0}dispose(){const t=this.map;t&&(t.image instanceof ImageBitmap&&t.image.close(),t.dispose())}}var tt=(a=>(a[a.Unknown=0]="Unknown",a[a.Point=1]="Point",a[a.Linestring=2]="Linestring",a[a.Polygon=3]="Polygon",a))(tt||{});class Bl{render(t,e,n,r,s=1){switch(t.lineCap="round",t.lineJoin="round",(r.shadowBlur??0)>0&&(t.shadowBlur=r.shadowBlur??2,t.shadowColor=r.shadowColor??"black",t.shadowOffsetX=r.shadowOffset?r.shadowOffset[0]:0,t.shadowOffsetY=r.shadowOffset?r.shadowOffset[1]:0),e){case tt.Point:t.textAlign="center",t.textBaseline="middle",t.font=r.font??"14px Arial",t.fillStyle=r.fontColor??"white",this._renderPointText(t,n,s,r.textField??"name",r.fontOffset??[0,-8]);break;case tt.Linestring:this._renderLineString(t,n,s);break;case tt.Polygon:this._renderPolygon(t,n,s);break;default:console.warn(`Unknown feature type: ${e}`)}(r.fill||e===tt.Point)&&(t.globalAlpha=r.fillOpacity||.5,t.fillStyle=r.fillColor||r.color||"#3388ff",t.fill(r.fillRule||"evenodd")),(r.stroke??!0)&&(r.weight??1)>0&&(t.globalAlpha=r.opacity||1,t.lineWidth=r.weight||1,t.strokeStyle=r.color||"#3388ff",t.setLineDash(r.dashArray||[]),t.stroke())}_renderPointText(t,e,n=1,r="name",s=[0,0]){const l=e.geometry;t.beginPath();for(const u of l)for(let d=0;d<u.length;d++){const p=u[d];t.arc(p.x*n,p.y*n,2,0,2*Math.PI)}const c=e.properties;c&&c[r]&&t.fillText(c[r],l[0][0].x*n+s[0],l[0][0].y*n+s[1])}_renderLineString(t,e,n){const r=e.geometry;t.beginPath();for(const s of r)for(let l=0;l<s.length;l++){const{x:c,y:u}=s[l];l===0?t.moveTo(c*n,u*n):t.lineTo(c*n,u*n)}}_renderPolygon(t,e,n){const r=e.geometry;t.beginPath();for(let s=0;s<r.length;s++){const l=r[s];for(let c=0;c<l.length;c++){const{x:u,y:d}=l[c];c===0?t.moveTo(u*n,d*n):t.lineTo(u*n,d*n)}t.closePath()}}}class ho{constructor(){G(this,"info",{version:"0.10.0",description:"Image loader base class"});G(this,"dataType","")}async load(t){const{source:e,x:n,y:r,z:s}=t,l=new uo,{url:c,clipBounds:u}=so(e,n,r,s);if(c){const d=await this.doLoad(c,{source:e,x:n,y:r,z:s,bounds:u});l.map=d,Xe.manager.parseEnd(c)}return l}}class Yp{constructor(){G(this,"info",{version:"0.10.0",description:"Canvas tile abstract loader"});G(this,"dataType","")}async load(t){const e=this._creatCanvasContext(256,256);this.drawTile(e,t);const n=new m.CanvasTexture(e.canvas.transferToImageBitmap());return new uo({transparent:!0,map:n,opacity:t.source.opacity})}_creatCanvasContext(t,e){const r=new OffscreenCanvas(t,e).getContext("2d");if(!r)throw new Error("create canvas context failed");return r.scale(1,-1),r.translate(0,-e),r}}class Up extends ho{constructor(){super(...arguments);G(this,"info",{version:"0.10.0",description:"Tile image loader. It can load xyz tile image."});G(this,"dataType","image");G(this,"loader",new m.ImageLoader(Xe.manager))}async doLoad(e,n){const r=await this.loader.loadAsync(e).catch(c=>new Image(1,1)),s=new m.Texture;s.colorSpace=m.SRGBColorSpace;const{bounds:l}=n;return l[2]-l[0]<1?s.image=Bp(r,l):s.image=r,s.needsUpdate=!0,s}}function Bp(a,t){const e=a.width,n=new OffscreenCanvas(e,e),r=n.getContext("2d"),{sx:s,sy:l,sw:c,sh:u}=io(t,a.width);return r.drawImage(a,s,l,c,u,0,0,e,e),n}const Np=`{
|
|
656
656
|
"name": "@terra.gl/core",
|
|
657
|
-
"version": "0.0.1-alpha.
|
|
657
|
+
"version": "0.0.1-alpha.8",
|
|
658
658
|
"type": "module",
|
|
659
659
|
"files": [
|
|
660
660
|
"dist"
|
|
@@ -720,4 +720,4 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
720
720
|
"vue": "^3.5.18"
|
|
721
721
|
}
|
|
722
722
|
}
|
|
723
|
-
`;class Rt{constructor(t){G(this,"dataType","image");G(this,"attribution","isource");G(this,"minLevel",0);G(this,"maxLevel",18);G(this,"projectionID","3857");G(this,"url","");G(this,"subdomains",[]);G(this,"s","");G(this,"opacity",1);G(this,"isTMS",!1);G(this,"bounds",[-180,-85,180,85]);G(this,"_projectionBounds",[-1/0,-1/0,1/0,1/0]);G(this,"tileMaterial");Object.assign(this,t)}getUrl(t,e,n){const r={...this,x:t,y:e,z:n};return jp(this.url,r)}_getUrl(t,e,n){const r=this.subdomains.length;if(r>0){const l=Math.floor(Math.random()*r);this.s=this.subdomains[l]}const s=this.isTMS?Math.pow(2,n)-1-e:e;return this.getUrl(t,s,n)}static create(t){return new Rt(t)}}function jp(a,t){const e=/\{ *([\w_-]+) *\}/g;return a.replace(e,(n,r)=>{const s=t[r]??(()=>{throw new Error(`source url template error, No value provided for variable: ${n}`)})();return typeof s=="function"?s(t):s})}const{version:Jp,author:Qp}=JSON.parse(Np);function Hp(a,t=100){return new Promise(e=>{const n=setInterval(()=>{a&&(clearInterval(n),e())},t)})}function fo(a){return Xe.registerMaterialLoader(a),a}function po(a){return Xe.registerGeometryLoader(a),a}function Nl(a){return Xe.registerMeshLoader(a),a}fo(new Up);const jl="dmFyIGNlPU9iamVjdC5kZWZpbmVQcm9wZXJ0eTt2YXIgbWU9KGosWixxKT0+WiBpbiBqP2NlKGosWix7ZW51bWVyYWJsZTohMCxjb25maWd1cmFibGU6ITAsd3JpdGFibGU6ITAsdmFsdWU6cX0pOmpbWl09cTt2YXIgTj0oaixaLHEpPT5tZShqLHR5cGVvZiBaIT0ic3ltYm9sIj9aKyIiOloscSk7KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGooQSxwKXtjb25zdCBrPW5ldyBGbG9hdDMyQXJyYXkoQS5sZW5ndGgpO2ZvcihsZXQgVT0wO1U8cC5sZW5ndGg7VSs9Myl7Y29uc3QgYT1wW1VdKjMsZT1wW1UrMV0qMyxyPXBbVSsyXSozLHM9QVthXSx0PUFbYSsxXSxuPUFbYSsyXSxoPUFbZV0saT1BW2UrMV0sbz1BW2UrMl0sYz1BW3JdLHU9QVtyKzFdLG09QVtyKzJdLHc9aC1zLGw9aS10LGY9by1uLGc9Yy1zLE09dS10LFY9bS1uLGQ9bCpWLWYqTSx5PWYqZy13KlYsST13Kk0tbCpnLHo9TWF0aC5zcXJ0KGQqZCt5KnkrSSpJKSx4PVswLDAsMV07aWYoej4wKXtjb25zdCB2PTEvejt4WzBdPWQqdix4WzFdPXkqdix4WzJdPUkqdn1mb3IobGV0IHY9MDt2PDM7disrKWtbYSt2XT1rW2Urdl09a1tyK3ZdPXhbdl19cmV0dXJuIGt9Y2xhc3MgWntjb25zdHJ1Y3RvcihwPTI1Nyl7Tih0aGlzLCJncmlkU2l6ZSIpO04odGhpcywibnVtVHJpYW5nbGVzIik7Tih0aGlzLCJudW1QYXJlbnRUcmlhbmdsZXMiKTtOKHRoaXMsImluZGljZXMiKTtOKHRoaXMsImNvb3JkcyIpO3RoaXMuZ3JpZFNp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kqcCk7cmV0dXJue3N4Omssc3k6VSxzdzphLHNoOmV9fXNlbGYub25tZXNzYWdlPUE9Pntjb25zdCBwPUEuZGF0YSxrPXNlKHAuZGVtRGF0YSxwLnoscC5jbGlwQm91bmRzKTtzZWxmLnBvc3RNZXNzYWdlKGspfX0pKCk7Cg==",Ep=a=>Uint8Array.from(atob(a),t=>t.charCodeAt(0)),Jl=typeof self<"u"&&self.Blob&&new Blob([Ep(jl)],{type:"text/javascript;charset=utf-8"});function qp(a){let t;try{if(t=Jl&&(self.URL||self.webkitURL).createObjectURL(Jl),!t)throw"";const e=new Worker(t,{name:a?.name});return e.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),e}catch{return new Worker("data:text/javascript;base64,"+jl,{name:a?.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}/* Copyright 2015-2021 Esri. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 @preserve */const $p=function(){var a={};a.defaultNoDataValue=-34027999387901484e22,a.decode=function(l,c){c=c||{};var u=c.encodedMaskData||c.encodedMaskData===null,d=r(l,c.inputOffset||0,u),p=c.noDataValue!==null?c.noDataValue:a.defaultNoDataValue,f=t(d,c.pixelType||Float32Array,c.encodedMaskData,p,c.returnMask),y={width:d.width,height:d.height,pixelData:f.resultPixels,minValue:f.minValue,maxValue:d.pixels.maxValue,noDataValue:p};return f.resultMask&&(y.maskData=f.resultMask),c.returnEncodedMask&&d.mask&&(y.encodedMaskData=d.mask.bitset?d.mask.bitset:null),c.returnFileInfo&&(y.fileInfo=e(d),c.computeUsedBitDepths&&(y.fileInfo.bitDepths=n(d))),y};var t=function(l,c,u,d,p){var f=0,y=l.pixels.numBlocksX,v=l.pixels.numBlocksY,b=Math.floor(l.width/y),T=Math.floor(l.height/v),_=2*l.maxZError,S=Number.MAX_VALUE,L;u=u||(l.mask?l.mask.bitset:null);var I,F;I=new c(l.width*l.height),p&&u&&(F=new Uint8Array(l.width*l.height));for(var K=new Float32Array(b*T),D,O,V=0;V<=v;V++){var R=V!==v?T:l.height%v;if(R!==0)for(var P=0;P<=y;P++){var k=P!==y?b:l.width%y;if(k!==0){var N=V*l.width*T+P*b,H=l.width-k,Q=l.pixels.blocks[f],q,J,oe;Q.encoding<2?(Q.encoding===0?q=Q.rawData:(s(Q.stuffedData,Q.bitsPerPixel,Q.numValidPixels,Q.offset,_,K,l.pixels.maxValue),q=K),J=0):Q.encoding===2?oe=0:oe=Q.offset;var ie;if(u)for(O=0;O<R;O++){for(N&7&&(ie=u[N>>3],ie<<=N&7),D=0;D<k;D++)N&7||(ie=u[N>>3]),ie&128?(F&&(F[N]=1),L=Q.encoding<2?q[J++]:oe,S=S>L?L:S,I[N++]=L):(F&&(F[N]=0),I[N++]=d),ie<<=1;N+=H}else if(Q.encoding<2)for(O=0;O<R;O++){for(D=0;D<k;D++)L=q[J++],S=S>L?L:S,I[N++]=L;N+=H}else for(S=S>oe?oe:S,O=0;O<R;O++){for(D=0;D<k;D++)I[N++]=oe;N+=H}if(Q.encoding===1&&J!==Q.numValidPixels)throw"Block and Mask do not match";f++}}}return{resultPixels:I,resultMask:F,minValue:S}},e=function(l){return{fileIdentifierString:l.fileIdentifierString,fileVersion:l.fileVersion,imageType:l.imageType,height:l.height,width:l.width,maxZError:l.maxZError,eofOffset:l.eofOffset,mask:l.mask?{numBlocksX:l.mask.numBlocksX,numBlocksY:l.mask.numBlocksY,numBytes:l.mask.numBytes,maxValue:l.mask.maxValue}:null,pixels:{numBlocksX:l.pixels.numBlocksX,numBlocksY:l.pixels.numBlocksY,numBytes:l.pixels.numBytes,maxValue:l.pixels.maxValue,noDataValue:l.noDataValue}}},n=function(l){for(var c=l.pixels.numBlocksX*l.pixels.numBlocksY,u={},d=0;d<c;d++){var p=l.pixels.blocks[d];p.encoding===0?u.float32=!0:p.encoding===1?u[p.bitsPerPixel]=!0:u[0]=!0}return Object.keys(u)},r=function(l,c,u){var d={},p=new Uint8Array(l,c,10);if(d.fileIdentifierString=String.fromCharCode.apply(null,p),d.fileIdentifierString.trim()!=="CntZImage")throw"Unexpected file identifier string: "+d.fileIdentifierString;c+=10;var f=new DataView(l,c,24);if(d.fileVersion=f.getInt32(0,!0),d.imageType=f.getInt32(4,!0),d.height=f.getUint32(8,!0),d.width=f.getUint32(12,!0),d.maxZError=f.getFloat64(16,!0),c+=24,!u)if(f=new DataView(l,c,16),d.mask={},d.mask.numBlocksY=f.getUint32(0,!0),d.mask.numBlocksX=f.getUint32(4,!0),d.mask.numBytes=f.getUint32(8,!0),d.mask.maxValue=f.getFloat32(12,!0),c+=16,d.mask.numBytes>0){var y=new Uint8Array(Math.ceil(d.width*d.height/8));f=new DataView(l,c,d.mask.numBytes);var v=f.getInt16(0,!0),b=2,T=0;do{if(v>0)for(;v--;)y[T++]=f.getUint8(b++);else{var _=f.getUint8(b++);for(v=-v;v--;)y[T++]=_}v=f.getInt16(b,!0),b+=2}while(b<d.mask.numBytes);if(v!==-32768||T<y.length)throw"Unexpected end of mask RLE encoding";d.mask.bitset=y,c+=d.mask.numBytes}else d.mask.numBytes|d.mask.numBlocksY|d.mask.maxValue||(d.mask.bitset=new Uint8Array(Math.ceil(d.width*d.height/8)));f=new DataView(l,c,16),d.pixels={},d.pixels.numBlocksY=f.getUint32(0,!0),d.pixels.numBlocksX=f.getUint32(4,!0),d.pixels.numBytes=f.getUint32(8,!0),d.pixels.maxValue=f.getFloat32(12,!0),c+=16;var S=d.pixels.numBlocksX,L=d.pixels.numBlocksY,I=S+(d.width%S>0?1:0),F=L+(d.height%L>0?1:0);d.pixels.blocks=new Array(I*F);for(var K=0,D=0;D<F;D++)for(var O=0;O<I;O++){var V=0,R=l.byteLength-c;f=new DataView(l,c,Math.min(10,R));var P={};d.pixels.blocks[K++]=P;var k=f.getUint8(0);if(V++,P.encoding=k&63,P.encoding>3)throw"Invalid block encoding ("+P.encoding+")";if(P.encoding===2){c++;continue}if(k!==0&&k!==2){if(k>>=6,P.offsetType=k,k===2)P.offset=f.getInt8(1),V++;else if(k===1)P.offset=f.getInt16(1,!0),V+=2;else if(k===0)P.offset=f.getFloat32(1,!0),V+=4;else throw"Invalid block offset type";if(P.encoding===1)if(k=f.getUint8(V),V++,P.bitsPerPixel=k&63,k>>=6,P.numValidPixelsType=k,k===2)P.numValidPixels=f.getUint8(V),V++;else if(k===1)P.numValidPixels=f.getUint16(V,!0),V+=2;else if(k===0)P.numValidPixels=f.getUint32(V,!0),V+=4;else throw"Invalid valid pixel count type"}if(c+=V,P.encoding!==3){var N,H;if(P.encoding===0){var Q=(d.pixels.numBytes-1)/4;if(Q!==Math.floor(Q))throw"uncompressed block has invalid length";N=new ArrayBuffer(Q*4),H=new Uint8Array(N),H.set(new Uint8Array(l,c,Q*4));var q=new Float32Array(N);P.rawData=q,c+=Q*4}else if(P.encoding===1){var J=Math.ceil(P.numValidPixels*P.bitsPerPixel/8),oe=Math.ceil(J/4);N=new ArrayBuffer(oe*4),H=new Uint8Array(N),H.set(new Uint8Array(l,c,J)),P.stuffedData=new Uint32Array(N),c+=J}}}return d.eofOffset=c,d},s=function(l,c,u,d,p,f,y){var v=(1<<c)-1,b=0,T,_=0,S,L,I=Math.ceil((y-d)/p),F=l.length*4-Math.ceil(c*u/8);for(l[l.length-1]<<=8*F,T=0;T<u;T++){if(_===0&&(L=l[b++],_=32),_>=c)S=L>>>_-c&v,_-=c;else{var K=c-_;S=(L&v)<<K&v,L=l[b++],_=32-K,S+=L>>>_}f[T]=S<I?d+S*p:y}return f};return a}(),em=function(){var a={unstuff:function(r,s,l,c,u,d,p,f){var y=(1<<l)-1,v=0,b,T=0,_,S,L,I,F=r.length*4-Math.ceil(l*c/8);if(r[r.length-1]<<=8*F,u)for(b=0;b<c;b++)T===0&&(S=r[v++],T=32),T>=l?(_=S>>>T-l&y,T-=l):(L=l-T,_=(S&y)<<L&y,S=r[v++],T=32-L,_+=S>>>T),s[b]=u[_];else for(I=Math.ceil((f-d)/p),b=0;b<c;b++)T===0&&(S=r[v++],T=32),T>=l?(_=S>>>T-l&y,T-=l):(L=l-T,_=(S&y)<<L&y,S=r[v++],T=32-L,_+=S>>>T),s[b]=_<I?d+_*p:f},unstuffLUT:function(r,s,l,c,u,d){var p=(1<<s)-1,f=0,y=0,v=0,b=0,T=0,_,S=[],L=r.length*4-Math.ceil(s*l/8);r[r.length-1]<<=8*L;var I=Math.ceil((d-c)/u);for(y=0;y<l;y++)b===0&&(_=r[f++],b=32),b>=s?(T=_>>>b-s&p,b-=s):(v=s-b,T=(_&p)<<v&p,_=r[f++],b=32-v,T+=_>>>b),S[y]=T<I?c+T*u:d;return S.unshift(c),S},unstuff2:function(r,s,l,c,u,d,p,f){var y=(1<<l)-1,v=0,b,T=0,_=0,S,L,I;if(u)for(b=0;b<c;b++)T===0&&(L=r[v++],T=32,_=0),T>=l?(S=L>>>_&y,T-=l,_+=l):(I=l-T,S=L>>>_&y,L=r[v++],T=32-I,S|=(L&(1<<I)-1)<<l-I,_=I),s[b]=u[S];else{var F=Math.ceil((f-d)/p);for(b=0;b<c;b++)T===0&&(L=r[v++],T=32,_=0),T>=l?(S=L>>>_&y,T-=l,_+=l):(I=l-T,S=L>>>_&y,L=r[v++],T=32-I,S|=(L&(1<<I)-1)<<l-I,_=I),s[b]=S<F?d+S*p:f}return s},unstuffLUT2:function(r,s,l,c,u,d){var p=(1<<s)-1,f=0,y=0,v=0,b=0,T=0,_=0,S,L=[],I=Math.ceil((d-c)/u);for(y=0;y<l;y++)b===0&&(S=r[f++],b=32,_=0),b>=s?(T=S>>>_&p,b-=s,_+=s):(v=s-b,T=S>>>_&p,S=r[f++],b=32-v,T|=(S&(1<<v)-1)<<s-v,_=v),L[y]=T<I?c+T*u:d;return L.unshift(c),L},originalUnstuff:function(r,s,l,c){var u=(1<<l)-1,d=0,p,f=0,y,v,b,T=r.length*4-Math.ceil(l*c/8);for(r[r.length-1]<<=8*T,p=0;p<c;p++)f===0&&(v=r[d++],f=32),f>=l?(y=v>>>f-l&u,f-=l):(b=l-f,y=(v&u)<<b&u,v=r[d++],f=32-b,y+=v>>>f),s[p]=y;return s},originalUnstuff2:function(r,s,l,c){var u=(1<<l)-1,d=0,p,f=0,y=0,v,b,T;for(p=0;p<c;p++)f===0&&(b=r[d++],f=32,y=0),f>=l?(v=b>>>y&u,f-=l,y+=l):(T=l-f,v=b>>>y&u,b=r[d++],f=32-T,v|=(b&(1<<T)-1)<<l-T,y=T),s[p]=v;return s}},t={HUFFMAN_LUT_BITS_MAX:12,computeChecksumFletcher32:function(r){for(var s=65535,l=65535,c=r.length,u=Math.floor(c/2),d=0;u;){var p=u>=359?359:u;u-=p;do s+=r[d++]<<8,l+=s+=r[d++];while(--p);s=(s&65535)+(s>>>16),l=(l&65535)+(l>>>16)}return c&1&&(l+=s+=r[d]<<8),s=(s&65535)+(s>>>16),l=(l&65535)+(l>>>16),(l<<16|s)>>>0},readHeaderInfo:function(r,s){var l=s.ptr,c=new Uint8Array(r,l,6),u={};if(u.fileIdentifierString=String.fromCharCode.apply(null,c),u.fileIdentifierString.lastIndexOf("Lerc2",0)!==0)throw"Unexpected file identifier string (expect Lerc2 ): "+u.fileIdentifierString;l+=6;var d=new DataView(r,l,8),p=d.getInt32(0,!0);u.fileVersion=p,l+=4,p>=3&&(u.checksum=d.getUint32(4,!0),l+=4),d=new DataView(r,l,12),u.height=d.getUint32(0,!0),u.width=d.getUint32(4,!0),l+=8,p>=4?(u.numDims=d.getUint32(8,!0),l+=4):u.numDims=1,d=new DataView(r,l,40),u.numValidPixel=d.getUint32(0,!0),u.microBlockSize=d.getInt32(4,!0),u.blobSize=d.getInt32(8,!0),u.imageType=d.getInt32(12,!0),u.maxZError=d.getFloat64(16,!0),u.zMin=d.getFloat64(24,!0),u.zMax=d.getFloat64(32,!0),l+=40,s.headerInfo=u,s.ptr=l;var f,y;if(p>=3&&(y=p>=4?52:48,f=this.computeChecksumFletcher32(new Uint8Array(r,l-y,u.blobSize-14)),f!==u.checksum))throw"Checksum failed.";return!0},checkMinMaxRanges:function(r,s){var l=s.headerInfo,c=this.getDataTypeArray(l.imageType),u=l.numDims*this.getDataTypeSize(l.imageType),d=this.readSubArray(r,s.ptr,c,u),p=this.readSubArray(r,s.ptr+u,c,u);s.ptr+=2*u;var f,y=!0;for(f=0;f<l.numDims;f++)if(d[f]!==p[f]){y=!1;break}return l.minValues=d,l.maxValues=p,y},readSubArray:function(r,s,l,c){var u;if(l===Uint8Array)u=new Uint8Array(r,s,c);else{var d=new ArrayBuffer(c),p=new Uint8Array(d);p.set(new Uint8Array(r,s,c)),u=new l(d)}return u},readMask:function(r,s){var l=s.ptr,c=s.headerInfo,u=c.width*c.height,d=c.numValidPixel,p=new DataView(r,l,4),f={};if(f.numBytes=p.getUint32(0,!0),l+=4,(d===0||u===d)&&f.numBytes!==0)throw"invalid mask";var y,v;if(d===0)y=new Uint8Array(Math.ceil(u/8)),f.bitset=y,v=new Uint8Array(u),s.pixels.resultMask=v,l+=f.numBytes;else if(f.numBytes>0){y=new Uint8Array(Math.ceil(u/8)),p=new DataView(r,l,f.numBytes);var b=p.getInt16(0,!0),T=2,_=0,S=0;do{if(b>0)for(;b--;)y[_++]=p.getUint8(T++);else for(S=p.getUint8(T++),b=-b;b--;)y[_++]=S;b=p.getInt16(T,!0),T+=2}while(T<f.numBytes);if(b!==-32768||_<y.length)throw"Unexpected end of mask RLE encoding";v=new Uint8Array(u);var L=0,I=0;for(I=0;I<u;I++)I&7?(L=y[I>>3],L<<=I&7):L=y[I>>3],L&128&&(v[I]=1);s.pixels.resultMask=v,f.bitset=y,l+=f.numBytes}return s.ptr=l,s.mask=f,!0},readDataOneSweep:function(r,s,l,c){var u=s.ptr,d=s.headerInfo,p=d.numDims,f=d.width*d.height,y=d.imageType,v=d.numValidPixel*t.getDataTypeSize(y)*p,b,T=s.pixels.resultMask;if(l===Uint8Array)b=new Uint8Array(r,u,v);else{var _=new ArrayBuffer(v),S=new Uint8Array(_);S.set(new Uint8Array(r,u,v)),b=new l(_)}if(b.length===f*p)c?s.pixels.resultPixels=t.swapDimensionOrder(b,f,p,l,!0):s.pixels.resultPixels=b;else{s.pixels.resultPixels=new l(f*p);var L=0,I=0,F=0,K=0;if(p>1){if(c){for(I=0;I<f;I++)if(T[I])for(K=I,F=0;F<p;F++,K+=f)s.pixels.resultPixels[K]=b[L++]}else for(I=0;I<f;I++)if(T[I])for(K=I*p,F=0;F<p;F++)s.pixels.resultPixels[K+F]=b[L++]}else for(I=0;I<f;I++)T[I]&&(s.pixels.resultPixels[I]=b[L++])}return u+=v,s.ptr=u,!0},readHuffmanTree:function(r,s){var l=this.HUFFMAN_LUT_BITS_MAX,c=new DataView(r,s.ptr,16);s.ptr+=16;var u=c.getInt32(0,!0);if(u<2)throw"unsupported Huffman version";var d=c.getInt32(4,!0),p=c.getInt32(8,!0),f=c.getInt32(12,!0);if(p>=f)return!1;var y=new Uint32Array(f-p);t.decodeBits(r,s,y);var v=[],b,T,_,S;for(b=p;b<f;b++)T=b-(b<d?0:d),v[T]={first:y[b-p],second:null};var L=r.byteLength-s.ptr,I=Math.ceil(L/4),F=new ArrayBuffer(I*4),K=new Uint8Array(F);K.set(new Uint8Array(r,s.ptr,L));var D=new Uint32Array(F),O=0,V,R=0;for(V=D[0],b=p;b<f;b++)T=b-(b<d?0:d),S=v[T].first,S>0&&(v[T].second=V<<O>>>32-S,32-O>=S?(O+=S,O===32&&(O=0,R++,V=D[R])):(O+=S-32,R++,V=D[R],v[T].second|=V>>>32-O));var P=0,k=0,N=new e;for(b=0;b<v.length;b++)v[b]!==void 0&&(P=Math.max(P,v[b].first));P>=l?k=l:k=P;var H=[],Q,q,J,oe,ie,ee;for(b=p;b<f;b++)if(T=b-(b<d?0:d),S=v[T].first,S>0)if(Q=[S,T],S<=k)for(q=v[T].second<<k-S,J=1<<k-S,_=0;_<J;_++)H[q|_]=Q;else for(q=v[T].second,ee=N,oe=S-1;oe>=0;oe--)ie=q>>>oe&1,ie?(ee.right||(ee.right=new e),ee=ee.right):(ee.left||(ee.left=new e),ee=ee.left),oe===0&&!ee.val&&(ee.val=Q[1]);return{decodeLut:H,numBitsLUTQick:k,numBitsLUT:P,tree:N,stuffedData:D,srcPtr:R,bitPos:O}},readHuffman:function(r,s,l,c){var u=s.headerInfo,d=u.numDims,p=s.headerInfo.height,f=s.headerInfo.width,y=f*p,v=this.readHuffmanTree(r,s),b=v.decodeLut,T=v.tree,_=v.stuffedData,S=v.srcPtr,L=v.bitPos,I=v.numBitsLUTQick,F=v.numBitsLUT,K=s.headerInfo.imageType===0?128:0,D,O,V,R=s.pixels.resultMask,P,k,N,H,Q,q,J,oe=0;L>0&&(S++,L=0);var ie=_[S],ee=s.encodeMode===1,me=new l(y*d),xe=me,he;if(d<2||ee){for(he=0;he<d;he++)if(d>1&&(xe=new l(me.buffer,y*he,y),oe=0),s.headerInfo.numValidPixel===f*p)for(q=0,H=0;H<p;H++)for(Q=0;Q<f;Q++,q++){if(O=0,P=ie<<L>>>32-I,k=P,32-L<I&&(P|=_[S+1]>>>64-L-I,k=P),b[k])O=b[k][1],L+=b[k][0];else for(P=ie<<L>>>32-F,k=P,32-L<F&&(P|=_[S+1]>>>64-L-F,k=P),D=T,J=0;J<F;J++)if(N=P>>>F-J-1&1,D=N?D.right:D.left,!(D.left||D.right)){O=D.val,L=L+J+1;break}L>=32&&(L-=32,S++,ie=_[S]),V=O-K,ee?(Q>0?V+=oe:H>0?V+=xe[q-f]:V+=oe,V&=255,xe[q]=V,oe=V):xe[q]=V}else for(q=0,H=0;H<p;H++)for(Q=0;Q<f;Q++,q++)if(R[q]){if(O=0,P=ie<<L>>>32-I,k=P,32-L<I&&(P|=_[S+1]>>>64-L-I,k=P),b[k])O=b[k][1],L+=b[k][0];else for(P=ie<<L>>>32-F,k=P,32-L<F&&(P|=_[S+1]>>>64-L-F,k=P),D=T,J=0;J<F;J++)if(N=P>>>F-J-1&1,D=N?D.right:D.left,!(D.left||D.right)){O=D.val,L=L+J+1;break}L>=32&&(L-=32,S++,ie=_[S]),V=O-K,ee?(Q>0&&R[q-1]?V+=oe:H>0&&R[q-f]?V+=xe[q-f]:V+=oe,V&=255,xe[q]=V,oe=V):xe[q]=V}}else for(q=0,H=0;H<p;H++)for(Q=0;Q<f;Q++)if(q=H*f+Q,!R||R[q])for(he=0;he<d;he++,q+=y){if(O=0,P=ie<<L>>>32-I,k=P,32-L<I&&(P|=_[S+1]>>>64-L-I,k=P),b[k])O=b[k][1],L+=b[k][0];else for(P=ie<<L>>>32-F,k=P,32-L<F&&(P|=_[S+1]>>>64-L-F,k=P),D=T,J=0;J<F;J++)if(N=P>>>F-J-1&1,D=N?D.right:D.left,!(D.left||D.right)){O=D.val,L=L+J+1;break}L>=32&&(L-=32,S++,ie=_[S]),V=O-K,xe[q]=V}s.ptr=s.ptr+(S+1)*4+(L>0?4:0),s.pixels.resultPixels=me,d>1&&!c&&(s.pixels.resultPixels=t.swapDimensionOrder(me,y,d,l))},decodeBits:function(r,s,l,c,u){{var d=s.headerInfo,p=d.fileVersion,f=0,y=r.byteLength-s.ptr>=5?5:r.byteLength-s.ptr,v=new DataView(r,s.ptr,y),b=v.getUint8(0);f++;var T=b>>6,_=T===0?4:3-T,S=(b&32)>0,L=b&31,I=0;if(_===1)I=v.getUint8(f),f++;else if(_===2)I=v.getUint16(f,!0),f+=2;else if(_===4)I=v.getUint32(f,!0),f+=4;else throw"Invalid valid pixel count type";var F=2*d.maxZError,K,D,O,V,R,P,k,N,H,Q=d.numDims>1?d.maxValues[u]:d.zMax;if(S){for(s.counter.lut++,N=v.getUint8(f),f++,V=Math.ceil((N-1)*L/8),R=Math.ceil(V/4),D=new ArrayBuffer(R*4),O=new Uint8Array(D),s.ptr+=f,O.set(new Uint8Array(r,s.ptr,V)),k=new Uint32Array(D),s.ptr+=V,H=0;N-1>>>H;)H++;V=Math.ceil(I*H/8),R=Math.ceil(V/4),D=new ArrayBuffer(R*4),O=new Uint8Array(D),O.set(new Uint8Array(r,s.ptr,V)),K=new Uint32Array(D),s.ptr+=V,p>=3?P=a.unstuffLUT2(k,L,N-1,c,F,Q):P=a.unstuffLUT(k,L,N-1,c,F,Q),p>=3?a.unstuff2(K,l,H,I,P):a.unstuff(K,l,H,I,P)}else s.counter.bitstuffer++,H=L,s.ptr+=f,H>0&&(V=Math.ceil(I*H/8),R=Math.ceil(V/4),D=new ArrayBuffer(R*4),O=new Uint8Array(D),O.set(new Uint8Array(r,s.ptr,V)),K=new Uint32Array(D),s.ptr+=V,p>=3?c==null?a.originalUnstuff2(K,l,H,I):a.unstuff2(K,l,H,I,!1,c,F,Q):c==null?a.originalUnstuff(K,l,H,I):a.unstuff(K,l,H,I,!1,c,F,Q))}},readTiles:function(r,s,l,c){var u=s.headerInfo,d=u.width,p=u.height,f=d*p,y=u.microBlockSize,v=u.imageType,b=t.getDataTypeSize(v),T=Math.ceil(d/y),_=Math.ceil(p/y);s.pixels.numBlocksY=_,s.pixels.numBlocksX=T,s.pixels.ptr=0;var S=0,L=0,I=0,F=0,K=0,D=0,O=0,V=0,R=0,P=0,k=0,N=0,H=0,Q=0,q=0,J=0,oe,ie,ee,me,xe,he,ve=new l(y*y),ke=p%y||y,Ye=d%y||y,je,Je,Qe=u.numDims,ct,pt=s.pixels.resultMask,Ue=s.pixels.resultPixels,hn=u.fileVersion,Tn=hn>=5?14:15,Ae,Ut=u.zMax,It;for(I=0;I<_;I++)for(K=I!==_-1?y:ke,F=0;F<T;F++)for(D=F!==T-1?y:Ye,k=I*d*y+F*y,N=d-D,ct=0;ct<Qe;ct++){if(Qe>1?(It=Ue,k=I*d*y+F*y,Ue=new l(s.pixels.resultPixels.buffer,f*ct*b,f),Ut=u.maxValues[ct]):It=null,O=r.byteLength-s.ptr,oe=new DataView(r,s.ptr,Math.min(10,O)),ie={},J=0,V=oe.getUint8(0),J++,Ae=u.fileVersion>=5?V&4:0,R=V>>6&255,P=V>>2&Tn,P!==(F*y>>3&Tn)||Ae&&ct===0)throw"integrity issue";if(he=V&3,he>3)throw s.ptr+=J,"Invalid block encoding ("+he+")";if(he===2){if(Ae)if(pt)for(S=0;S<K;S++)for(L=0;L<D;L++)pt[k]&&(Ue[k]=It[k]),k++;else for(S=0;S<K;S++)for(L=0;L<D;L++)Ue[k]=It[k],k++;s.counter.constant++,s.ptr+=J;continue}else if(he===0){if(Ae)throw"integrity issue";if(s.counter.uncompressed++,s.ptr+=J,H=K*D*b,Q=r.byteLength-s.ptr,H=H<Q?H:Q,ee=new ArrayBuffer(H%b===0?H:H+b-H%b),me=new Uint8Array(ee),me.set(new Uint8Array(r,s.ptr,H)),xe=new l(ee),q=0,pt)for(S=0;S<K;S++){for(L=0;L<D;L++)pt[k]&&(Ue[k]=xe[q++]),k++;k+=N}else for(S=0;S<K;S++){for(L=0;L<D;L++)Ue[k++]=xe[q++];k+=N}s.ptr+=q*b}else if(je=t.getDataTypeUsed(Ae&&v<6?4:v,R),Je=t.getOnePixel(ie,J,je,oe),J+=t.getDataTypeSize(je),he===3)if(s.ptr+=J,s.counter.constantoffset++,pt)for(S=0;S<K;S++){for(L=0;L<D;L++)pt[k]&&(Ue[k]=Ae?Math.min(Ut,It[k]+Je):Je),k++;k+=N}else for(S=0;S<K;S++){for(L=0;L<D;L++)Ue[k]=Ae?Math.min(Ut,It[k]+Je):Je,k++;k+=N}else if(s.ptr+=J,t.decodeBits(r,s,ve,Je,ct),J=0,Ae)if(pt)for(S=0;S<K;S++){for(L=0;L<D;L++)pt[k]&&(Ue[k]=ve[J++]+It[k]),k++;k+=N}else for(S=0;S<K;S++){for(L=0;L<D;L++)Ue[k]=ve[J++]+It[k],k++;k+=N}else if(pt)for(S=0;S<K;S++){for(L=0;L<D;L++)pt[k]&&(Ue[k]=ve[J++]),k++;k+=N}else for(S=0;S<K;S++){for(L=0;L<D;L++)Ue[k++]=ve[J++];k+=N}}Qe>1&&!c&&(s.pixels.resultPixels=t.swapDimensionOrder(s.pixels.resultPixels,f,Qe,l))},formatFileInfo:function(r){return{fileIdentifierString:r.headerInfo.fileIdentifierString,fileVersion:r.headerInfo.fileVersion,imageType:r.headerInfo.imageType,height:r.headerInfo.height,width:r.headerInfo.width,numValidPixel:r.headerInfo.numValidPixel,microBlockSize:r.headerInfo.microBlockSize,blobSize:r.headerInfo.blobSize,maxZError:r.headerInfo.maxZError,pixelType:t.getPixelType(r.headerInfo.imageType),eofOffset:r.eofOffset,mask:r.mask?{numBytes:r.mask.numBytes}:null,pixels:{numBlocksX:r.pixels.numBlocksX,numBlocksY:r.pixels.numBlocksY,maxValue:r.headerInfo.zMax,minValue:r.headerInfo.zMin,noDataValue:r.noDataValue}}},constructConstantSurface:function(r,s){var l=r.headerInfo.zMax,c=r.headerInfo.zMin,u=r.headerInfo.maxValues,d=r.headerInfo.numDims,p=r.headerInfo.height*r.headerInfo.width,f=0,y=0,v=0,b=r.pixels.resultMask,T=r.pixels.resultPixels;if(b)if(d>1){if(s)for(f=0;f<d;f++)for(v=f*p,l=u[f],y=0;y<p;y++)b[y]&&(T[v+y]=l);else for(y=0;y<p;y++)if(b[y])for(v=y*d,f=0;f<d;f++)T[v+d]=u[f]}else for(y=0;y<p;y++)b[y]&&(T[y]=l);else if(d>1&&c!==l)if(s)for(f=0;f<d;f++)for(v=f*p,l=u[f],y=0;y<p;y++)T[v+y]=l;else for(y=0;y<p;y++)for(v=y*d,f=0;f<d;f++)T[v+f]=u[f];else for(y=0;y<p*d;y++)T[y]=l},getDataTypeArray:function(r){var s;switch(r){case 0:s=Int8Array;break;case 1:s=Uint8Array;break;case 2:s=Int16Array;break;case 3:s=Uint16Array;break;case 4:s=Int32Array;break;case 5:s=Uint32Array;break;case 6:s=Float32Array;break;case 7:s=Float64Array;break;default:s=Float32Array}return s},getPixelType:function(r){var s;switch(r){case 0:s="S8";break;case 1:s="U8";break;case 2:s="S16";break;case 3:s="U16";break;case 4:s="S32";break;case 5:s="U32";break;case 6:s="F32";break;case 7:s="F64";break;default:s="F32"}return s},isValidPixelValue:function(r,s){if(s==null)return!1;var l;switch(r){case 0:l=s>=-128&&s<=127;break;case 1:l=s>=0&&s<=255;break;case 2:l=s>=-32768&&s<=32767;break;case 3:l=s>=0&&s<=65536;break;case 4:l=s>=-2147483648&&s<=2147483647;break;case 5:l=s>=0&&s<=4294967296;break;case 6:l=s>=-34027999387901484e22&&s<=34027999387901484e22;break;case 7:l=s>=-17976931348623157e292&&s<=17976931348623157e292;break;default:l=!1}return l},getDataTypeSize:function(r){var s=0;switch(r){case 0:case 1:s=1;break;case 2:case 3:s=2;break;case 4:case 5:case 6:s=4;break;case 7:s=8;break;default:s=r}return s},getDataTypeUsed:function(r,s){var l=r;switch(r){case 2:case 4:l=r-s;break;case 3:case 5:l=r-2*s;break;case 6:s===0?l=r:s===1?l=2:l=1;break;case 7:s===0?l=r:l=r-2*s+1;break;default:l=r;break}return l},getOnePixel:function(r,s,l,c){var u=0;switch(l){case 0:u=c.getInt8(s);break;case 1:u=c.getUint8(s);break;case 2:u=c.getInt16(s,!0);break;case 3:u=c.getUint16(s,!0);break;case 4:u=c.getInt32(s,!0);break;case 5:u=c.getUInt32(s,!0);break;case 6:u=c.getFloat32(s,!0);break;case 7:u=c.getFloat64(s,!0);break;default:throw"the decoder does not understand this pixel type"}return u},swapDimensionOrder:function(r,s,l,c,u){var d=0,p=0,f=0,y=0,v=r;if(l>1)if(v=new c(s*l),u)for(d=0;d<s;d++)for(y=d,f=0;f<l;f++,y+=s)v[y]=r[p++];else for(d=0;d<s;d++)for(y=d,f=0;f<l;f++,y+=s)v[p++]=r[y];return v}},e=function(r,s,l){this.val=r,this.left=s,this.right=l},n={decode:function(r,s){s=s||{};var l=s.noDataValue,c=0,u={};if(u.ptr=s.inputOffset||0,u.pixels={},!!t.readHeaderInfo(r,u)){var d=u.headerInfo,p=d.fileVersion,f=t.getDataTypeArray(d.imageType);if(p>5)throw"unsupported lerc version 2."+p;t.readMask(r,u),d.numValidPixel!==d.width*d.height&&!u.pixels.resultMask&&(u.pixels.resultMask=s.maskData);var y=d.width*d.height;u.pixels.resultPixels=new f(y*d.numDims),u.counter={onesweep:0,uncompressed:0,lut:0,bitstuffer:0,constant:0,constantoffset:0};var v=!s.returnPixelInterleavedDims;if(d.numValidPixel!==0)if(d.zMax===d.zMin)t.constructConstantSurface(u,v);else if(p>=4&&t.checkMinMaxRanges(r,u))t.constructConstantSurface(u,v);else{var b=new DataView(r,u.ptr,2),T=b.getUint8(0);if(u.ptr++,T)t.readDataOneSweep(r,u,f,v);else if(p>1&&d.imageType<=1&&Math.abs(d.maxZError-.5)<1e-5){var _=b.getUint8(1);if(u.ptr++,u.encodeMode=_,_>2||p<4&&_>1)throw"Invalid Huffman flag "+_;_?t.readHuffman(r,u,f,v):t.readTiles(r,u,f,v)}else t.readTiles(r,u,f,v)}u.eofOffset=u.ptr;var S;s.inputOffset?(S=u.headerInfo.blobSize+s.inputOffset-u.ptr,Math.abs(S)>=1&&(u.eofOffset=s.inputOffset+u.headerInfo.blobSize)):(S=u.headerInfo.blobSize-u.ptr,Math.abs(S)>=1&&(u.eofOffset=u.headerInfo.blobSize));var L={width:d.width,height:d.height,pixelData:u.pixels.resultPixels,minValue:d.zMin,maxValue:d.zMax,validPixelCount:d.numValidPixel,dimCount:d.numDims,dimStats:{minValues:d.minValues,maxValues:d.maxValues},maskData:u.pixels.resultMask};if(u.pixels.resultMask&&t.isValidPixelValue(d.imageType,l)){var I=u.pixels.resultMask;for(c=0;c<y;c++)I[c]||(L.pixelData[c]=l);L.noDataValue=l}return u.noDataValue=l,s.returnFileInfo&&(L.fileInfo=t.formatFileInfo(u)),L}},getBandCount:function(r){var s=0,l=0,c={};for(c.ptr=0,c.pixels={};l<r.byteLength-58;)t.readHeaderInfo(r,c),l+=c.headerInfo.blobSize,s++,c.ptr=l;return s}};return n}();var tm=function(){var a=new ArrayBuffer(4),t=new Uint8Array(a),e=new Uint32Array(a);return e[0]=1,t[0]===1}(),nm={decode:function(a,t){if(!tm)throw"Big endian system is not supported.";t=t||{};var e=t.inputOffset||0,n=new Uint8Array(a,e,10),r=String.fromCharCode.apply(null,n),s,l;if(r.trim()==="CntZImage")s=$p,l=1;else if(r.substring(0,5)==="Lerc2")s=em,l=2;else throw"Unexpected file identifier string: "+r;for(var c=0,u=a.byteLength-10,d,p=[],f,y,v={width:0,height:0,pixels:[],pixelType:t.pixelType,mask:null,statistics:[]},b=0;e<u;){var T=s.decode(a,{inputOffset:e,encodedMaskData:d,maskData:y,returnMask:c===0,returnEncodedMask:c===0,returnFileInfo:!0,returnPixelInterleavedDims:t.returnPixelInterleavedDims,pixelType:t.pixelType||null,noDataValue:t.noDataValue||null});e=T.fileInfo.eofOffset,y=T.maskData,c===0&&(d=T.encodedMaskData,v.width=T.width,v.height=T.height,v.dimCount=T.dimCount||1,v.pixelType=T.pixelType||T.fileInfo.pixelType,v.mask=y),l>1&&(y&&p.push(y),T.fileInfo.mask&&T.fileInfo.mask.numBytes>0&&b++),c++,v.pixels.push(T.pixelData),v.statistics.push({minValue:T.minValue,maxValue:T.maxValue,noDataValue:T.noDataValue,dimStats:T.dimStats})}var _,S,L;if(l>1&&b>1){for(L=v.width*v.height,v.bandMasks=p,y=new Uint8Array(L),y.set(p[0]),_=1;_<p.length;_++)for(f=p[_],S=0;S<L;S++)y[S]=y[S]&f[S];v.maskData=y}return v}};const rm={0:7e3,1:6e3,2:5e3,3:4e3,4:3e3,5:2500,6:2e3,7:1500,8:800,9:500,10:200,11:100,12:40,13:12,14:5,15:2,16:1,17:.5,18:.2,19:.1,20:.01};function im(a){const{height:t,width:e,pixels:n}=nm.decode(a),r=new Float32Array(t*e);for(let s=0;s<r.length;s++)r[s]=n[0][s];return{array:r,width:e,height:t}}function sm(a,t,e){let n=im(a);e[2]-e[0]<1&&(n=om(n,e));const{array:r,width:s}=n,c=new Ul(s).createTile(r),u=rm[t]||0;return c.getGeometryData(u)}function om(a,t){function e(c,u,d,p,f,y,v,b){const T=new Float32Array(f*y);for(let S=0;S<y;S++)for(let L=0;L<f;L++){const I=(S+p)*u+(L+d),F=S*f+L;T[F]=c[I]}const _=new Float32Array(b*v);for(let S=0;S<b;S++)for(let L=0;L<v;L++){const I=S*b+L,F=Math.round(L*y/b),D=Math.round(S*f/v)*f+F;_[I]=T[D]}return _}const n=am(t,a.width),r=n.sw+1,s=n.sh+1;return{array:e(a.array,a.width,n.sx,n.sy,n.sw,n.sh,r,s),width:r,height:s}}function am(a,t){const e=Math.floor(a[0]*t),n=Math.floor(a[1]*t),r=Math.floor((a[2]-a[0])*t),s=Math.floor((a[3]-a[1])*t);return{sx:e,sy:n,sw:r,sh:s}}const lm=10;class cm extends co{constructor(){super();G(this,"info",{version:"0.10.0",description:"Tile LERC terrain loader. It can load ArcGis-lerc format terrain data."});G(this,"dataType","lerc");G(this,"fileLoader",new m.FileLoader(Xe.manager));G(this,"_workerPool",new qs(0));this.fileLoader.setResponseType("arraybuffer"),this._workerPool.setWorkerCreator(()=>new qp)}async doLoad(e,n){this._workerPool.pool===0&&this._workerPool.setWorkerLimit(lm);const{z:r,bounds:s}=n,l=await this.fileLoader.loadAsync(e).catch(()=>new Float32Array(256*256)),c=sm(l,r,s);return new dr().setData(c)}}po(new cm);const Ql="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGModCl7cmV0dXJuIGEodC5kYXRhKX1mdW5jdGlvbiBhKHQpe2Z1bmN0aW9uIG4oZSx1KXtjb25zdCByPXUqNCxbaSxmLGcsbF09ZS5zbGljZShyLHIrNCk7cmV0dXJuIGw9PT0wPzA6LTFlNCsoaTw8MTZ8Zjw8OHxnKSouMX1jb25zdCBvPXQubGVuZ3RoPj4+MixzPW5ldyBGbG9hdDMyQXJyYXkobyk7Zm9yKGxldCBlPTA7ZTxvO2UrKylzW2VdPW4odCxlKTtyZXR1cm4gc31zZWxmLm9ubWVzc2FnZT10PT57Y29uc3Qgbj1jKHQuZGF0YS5pbWdEYXRhKTtzZWxmLnBvc3RNZXNzYWdlKG4pfX0pKCk7Cg==",um=a=>Uint8Array.from(atob(a),t=>t.charCodeAt(0)),Hl=typeof self<"u"&&self.Blob&&new Blob([um(Ql)],{type:"text/javascript;charset=utf-8"});function hm(a){let t;try{if(t=Hl&&(self.URL||self.webkitURL).createObjectURL(Hl),!t)throw"";const e=new Worker(t,{name:a?.name});return e.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),e}catch{return new Worker("data:text/javascript;base64,"+Ql,{name:a?.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}const dm=10;class fm extends co{constructor(){super();G(this,"info",{version:"0.10.0",description:"Mapbox-RGB terrain loader, It can load Mapbox-RGB terrain data."});G(this,"dataType","terrain-rgb");G(this,"imageLoader",new m.ImageLoader(Xe.manager));G(this,"_workerPool",new qs(0));this._workerPool.setWorkerCreator(()=>new hm)}async doLoad(e,n){const r=await this.imageLoader.loadAsync(e).catch(d=>new Image),s=m.MathUtils.clamp((n.z+2)*3,2,64),l=pm(r,n.bounds,s);let c;this._workerPool.pool===0&&this._workerPool.setWorkerLimit(dm),c=(await this._workerPool.postMessage({imgData:l},[l.data.buffer])).data;const u=new dr;return u.setData(c),u}}function pm(a,t,e){const n=io(t,a.width);e=Math.min(e,n.sw);const s=new OffscreenCanvas(e,e).getContext("2d");return s.imageSmoothingEnabled=!1,s.drawImage(a,n.sx,n.sy,n.sw,n.sh,0,0,e,e),s.getImageData(0,0,e,e)}po(new fm);function Sn(a,t){this.x=a,this.y=t}Sn.prototype={clone(){return new Sn(this.x,this.y)},add(a){return this.clone()._add(a)},sub(a){return this.clone()._sub(a)},multByPoint(a){return this.clone()._multByPoint(a)},divByPoint(a){return this.clone()._divByPoint(a)},mult(a){return this.clone()._mult(a)},div(a){return this.clone()._div(a)},rotate(a){return this.clone()._rotate(a)},rotateAround(a,t){return this.clone()._rotateAround(a,t)},matMult(a){return this.clone()._matMult(a)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(a){return this.x===a.x&&this.y===a.y},dist(a){return Math.sqrt(this.distSqr(a))},distSqr(a){const t=a.x-this.x,e=a.y-this.y;return t*t+e*e},angle(){return Math.atan2(this.y,this.x)},angleTo(a){return Math.atan2(this.y-a.y,this.x-a.x)},angleWith(a){return this.angleWithSep(a.x,a.y)},angleWithSep(a,t){return Math.atan2(this.x*t-this.y*a,this.x*a+this.y*t)},_matMult(a){const t=a[0]*this.x+a[1]*this.y,e=a[2]*this.x+a[3]*this.y;return this.x=t,this.y=e,this},_add(a){return this.x+=a.x,this.y+=a.y,this},_sub(a){return this.x-=a.x,this.y-=a.y,this},_mult(a){return this.x*=a,this.y*=a,this},_div(a){return this.x/=a,this.y/=a,this},_multByPoint(a){return this.x*=a.x,this.y*=a.y,this},_divByPoint(a){return this.x/=a.x,this.y/=a.y,this},_unit(){return this._div(this.mag()),this},_perp(){const a=this.y;return this.y=this.x,this.x=-a,this},_rotate(a){const t=Math.cos(a),e=Math.sin(a),n=t*this.x-e*this.y,r=e*this.x+t*this.y;return this.x=n,this.y=r,this},_rotateAround(a,t){const e=Math.cos(a),n=Math.sin(a),r=t.x+e*(this.x-t.x)-n*(this.y-t.y),s=t.y+n*(this.x-t.x)+e*(this.y-t.y);return this.x=r,this.y=s,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Sn},Sn.convert=function(a){if(a instanceof Sn)return a;if(Array.isArray(a))return new Sn(+a[0],+a[1]);if(a.x!==void 0&&a.y!==void 0)return new Sn(+a.x,+a.y);throw new Error("Expected [x, y] or {x, y} point format")};class El{constructor(t,e,n,r,s){this.properties={},this.extent=n,this.type=0,this.id=void 0,this._pbf=t,this._geometry=-1,this._keys=r,this._values=s,t.readFields(mm,this,e)}loadGeometry(){const t=this._pbf;t.pos=this._geometry;const e=t.readVarint()+t.pos,n=[];let r,s=1,l=0,c=0,u=0;for(;t.pos<e;){if(l<=0){const d=t.readVarint();s=d&7,l=d>>3}if(l--,s===1||s===2)c+=t.readSVarint(),u+=t.readSVarint(),s===1&&(r&&n.push(r),r=[]),r&&r.push(new Sn(c,u));else if(s===7)r&&r.push(r[0].clone());else throw new Error(`unknown command ${s}`)}return r&&n.push(r),n}bbox(){const t=this._pbf;t.pos=this._geometry;const e=t.readVarint()+t.pos;let n=1,r=0,s=0,l=0,c=1/0,u=-1/0,d=1/0,p=-1/0;for(;t.pos<e;){if(r<=0){const f=t.readVarint();n=f&7,r=f>>3}if(r--,n===1||n===2)s+=t.readSVarint(),l+=t.readSVarint(),s<c&&(c=s),s>u&&(u=s),l<d&&(d=l),l>p&&(p=l);else if(n!==7)throw new Error(`unknown command ${n}`)}return[c,d,u,p]}toGeoJSON(t,e,n){const r=this.extent*Math.pow(2,n),s=this.extent*t,l=this.extent*e,c=this.loadGeometry();function u(y){return[(y.x+s)*360/r-180,360/Math.PI*Math.atan(Math.exp((1-(y.y+l)*2/r)*Math.PI))-90]}function d(y){return y.map(u)}let p;if(this.type===1){const y=[];for(const b of c)y.push(b[0]);const v=d(y);p=y.length===1?{type:"Point",coordinates:v[0]}:{type:"MultiPoint",coordinates:v}}else if(this.type===2){const y=c.map(d);p=y.length===1?{type:"LineString",coordinates:y[0]}:{type:"MultiLineString",coordinates:y}}else if(this.type===3){const y=ym(c),v=[];for(const b of y)v.push(b.map(d));p=v.length===1?{type:"Polygon",coordinates:v[0]}:{type:"MultiPolygon",coordinates:v}}else throw new Error("unknown feature type");const f={type:"Feature",geometry:p,properties:this.properties};return this.id!=null&&(f.id=this.id),f}}El.types=["Unknown","Point","LineString","Polygon"];function mm(a,t,e){a===1?t.id=e.readVarint():a===2?gm(e,t):a===3?t.type=e.readVarint():a===4&&(t._geometry=e.pos)}function gm(a,t){const e=a.readVarint()+a.pos;for(;a.pos<e;){const n=t._keys[a.readVarint()],r=t._values[a.readVarint()];t.properties[n]=r}}function ym(a){const t=a.length;if(t<=1)return[a];const e=[];let n,r;for(let s=0;s<t;s++){const l=vm(a[s]);l!==0&&(r===void 0&&(r=l<0),r===l<0?(n&&e.push(n),n=[a[s]]):n&&n.push(a[s]))}return n&&e.push(n),e}function vm(a){let t=0;for(let e=0,n=a.length,r=n-1,s,l;e<n;r=e++)s=a[e],l=a[r],t+=(l.x-s.x)*(s.y+l.y);return t}let wm=class{constructor(t,e){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(bm,this,e),this.length=this._features.length}feature(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];const e=this._pbf.readVarint()+this._pbf.pos;return new El(this._pbf,e,this.extent,this._keys,this._values)}};function bm(a,t,e){a===15?t.version=e.readVarint():a===1?t.name=e.readString():a===5?t.extent=e.readVarint():a===2?t._features.push(e.pos):a===3?t._keys.push(e.readString()):a===4&&t._values.push(xm(e))}function xm(a){let t=null;const e=a.readVarint()+a.pos;for(;a.pos<e;){const n=a.readVarint()>>3;t=n===1?a.readString():n===2?a.readFloat():n===3?a.readDouble():n===4?a.readVarint64():n===5?a.readVarint():n===6?a.readSVarint():n===7?a.readBoolean():null}if(t==null)throw new Error("unknown feature value");return t}class _m{constructor(t,e){this.layers=t.readFields(Mm,{},e)}}function Mm(a,t,e){if(a===3){const n=new wm(e,e.readVarint()+e.pos);n.length&&(t[n.name]=n)}}const mo=65536*65536,ql=1/mo,Lm=12,$l=typeof TextDecoder>"u"?null:new TextDecoder("utf-8"),go=0,Wi=1,Nr=2,Pi=5;class Sm{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(t,e,n=this.length){for(;this.pos<n;){const r=this.readVarint(),s=r>>3,l=this.pos;this.type=r&7,t(s,e,this),this.pos===l&&this.skip(r)}return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*mo;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*mo;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const e=this.buf;let n,r;return r=e[this.pos++],n=r&127,r<128||(r=e[this.pos++],n|=(r&127)<<7,r<128)||(r=e[this.pos++],n|=(r&127)<<14,r<128)||(r=e[this.pos++],n|=(r&127)<<21,r<128)?n:(r=e[this.pos],n|=(r&15)<<28,Tm(n,t,this))}readVarint64(){return this.readVarint(!0)}readSVarint(){const t=this.readVarint();return t%2===1?(t+1)/-2:t/2}readBoolean(){return!!this.readVarint()}readString(){const t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=Lm&&$l?$l.decode(this.buf.subarray(e,t)):zm(this.buf,e,t)}readBytes(){const t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){const n=this.readPackedEnd();for(;this.pos<n;)t.push(this.readVarint(e));return t}readPackedSVarint(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFloat());return t}readPackedDouble(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed64());return t}readPackedEnd(){return this.type===Nr?this.readVarint()+this.pos:this.pos+1}skip(t){const e=t&7;if(e===go)for(;this.buf[this.pos++]>127;);else if(e===Nr)this.pos=this.readVarint()+this.pos;else if(e===Pi)this.pos+=4;else if(e===Wi)this.pos+=8;else throw new Error(`Unimplemented type: ${e}`)}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e<this.pos+t;)e*=2;if(e!==this.length){const n=new Uint8Array(e);n.set(this.buf),this.buf=n,this.dataView=new DataView(n.buffer),this.length=e}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeSFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,t&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*ql),!0),this.pos+=8}writeSFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,t&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*ql),!0),this.pos+=8}writeVarint(t){if(t=+t||0,t>268435455||t<0){Gm(t,this);return}this.realloc(4),this.buf[this.pos++]=t&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=t>>>7&127)))}writeSVarint(t){this.writeVarint(t<0?-t*2-1:t*2)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(t.length*4),this.pos++;const e=this.pos;this.pos=Om(this.buf,t,this.pos);const n=this.pos-e;n>=128&&ec(e,n,this),this.pos=e-1,this.writeVarint(n),this.pos+=n}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){const e=t.length;this.writeVarint(e),this.realloc(e);for(let n=0;n<e;n++)this.buf[this.pos++]=t[n]}writeRawMessage(t,e){this.pos++;const n=this.pos;t(e,this);const r=this.pos-n;r>=128&&ec(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r}writeMessage(t,e,n){this.writeTag(t,Nr),this.writeRawMessage(e,n)}writePackedVarint(t,e){e.length&&this.writeMessage(t,Wm,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,Pm,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,Am,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,Cm,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,Vm,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,Fm,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,Xm,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,km,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,Dm,e)}writeBytesField(t,e){this.writeTag(t,Nr),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,Pi),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,Pi),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,Wi),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,Wi),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,go),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,go),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,Nr),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,Pi),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,Wi),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}}function Tm(a,t,e){const n=e.buf;let r,s;if(s=n[e.pos++],r=(s&112)>>4,s<128||(s=n[e.pos++],r|=(s&127)<<3,s<128)||(s=n[e.pos++],r|=(s&127)<<10,s<128)||(s=n[e.pos++],r|=(s&127)<<17,s<128)||(s=n[e.pos++],r|=(s&127)<<24,s<128)||(s=n[e.pos++],r|=(s&1)<<31,s<128))return fr(a,r,t);throw new Error("Expected varint not more than 10 bytes")}function fr(a,t,e){return e?t*4294967296+(a>>>0):(t>>>0)*4294967296+(a>>>0)}function Gm(a,t){let e,n;if(a>=0?(e=a%4294967296|0,n=a/4294967296|0):(e=~(-a%4294967296),n=~(-a/4294967296),e^4294967295?e=e+1|0:(e=0,n=n+1|0)),a>=18446744073709552e3||a<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),Zm(e,n,t),Im(n,t)}function Zm(a,t,e){e.buf[e.pos++]=a&127|128,a>>>=7,e.buf[e.pos++]=a&127|128,a>>>=7,e.buf[e.pos++]=a&127|128,a>>>=7,e.buf[e.pos++]=a&127|128,a>>>=7,e.buf[e.pos]=a&127}function Im(a,t){const e=(a&7)<<4;t.buf[t.pos++]|=e|((a>>>=3)?128:0),a&&(t.buf[t.pos++]=a&127|((a>>>=7)?128:0),a&&(t.buf[t.pos++]=a&127|((a>>>=7)?128:0),a&&(t.buf[t.pos++]=a&127|((a>>>=7)?128:0),a&&(t.buf[t.pos++]=a&127|((a>>>=7)?128:0),a&&(t.buf[t.pos++]=a&127)))))}function ec(a,t,e){const n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));e.realloc(n);for(let r=e.pos-1;r>=a;r--)e.buf[r+n]=e.buf[r]}function Wm(a,t){for(let e=0;e<a.length;e++)t.writeVarint(a[e])}function Pm(a,t){for(let e=0;e<a.length;e++)t.writeSVarint(a[e])}function Cm(a,t){for(let e=0;e<a.length;e++)t.writeFloat(a[e])}function Vm(a,t){for(let e=0;e<a.length;e++)t.writeDouble(a[e])}function Am(a,t){for(let e=0;e<a.length;e++)t.writeBoolean(a[e])}function Fm(a,t){for(let e=0;e<a.length;e++)t.writeFixed32(a[e])}function Xm(a,t){for(let e=0;e<a.length;e++)t.writeSFixed32(a[e])}function km(a,t){for(let e=0;e<a.length;e++)t.writeFixed64(a[e])}function Dm(a,t){for(let e=0;e<a.length;e++)t.writeSFixed64(a[e])}function zm(a,t,e){let n="",r=t;for(;r<e;){const s=a[r];let l=null,c=s>239?4:s>223?3:s>191?2:1;if(r+c>e)break;let u,d,p;c===1?s<128&&(l=s):c===2?(u=a[r+1],(u&192)===128&&(l=(s&31)<<6|u&63,l<=127&&(l=null))):c===3?(u=a[r+1],d=a[r+2],(u&192)===128&&(d&192)===128&&(l=(s&15)<<12|(u&63)<<6|d&63,(l<=2047||l>=55296&&l<=57343)&&(l=null))):c===4&&(u=a[r+1],d=a[r+2],p=a[r+3],(u&192)===128&&(d&192)===128&&(p&192)===128&&(l=(s&15)<<18|(u&63)<<12|(d&63)<<6|p&63,(l<=65535||l>=1114112)&&(l=null))),l===null?(l=65533,c=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|l&1023),n+=String.fromCharCode(l),r+=c}return n}function Om(a,t,e){for(let n=0,r,s;n<t.length;n++){if(r=t.charCodeAt(n),r>55295&&r<57344)if(s)if(r<56320){a[e++]=239,a[e++]=191,a[e++]=189,s=r;continue}else r=s-55296<<10|r-56320|65536,s=null;else{r>56319||n+1===t.length?(a[e++]=239,a[e++]=191,a[e++]=189):s=r;continue}else s&&(a[e++]=239,a[e++]=191,a[e++]=189,s=null);r<128?a[e++]=r:(r<2048?a[e++]=r>>6|192:(r<65536?a[e++]=r>>12|224:(a[e++]=r>>18|240,a[e++]=r>>12&63|128),a[e++]=r>>6&63|128),a[e++]=r&63|128)}return e}class Km extends ho{constructor(){super();G(this,"dataType","mvt");G(this,"_loader",new m.FileLoader(Xe.manager));G(this,"_render",new Bl);console.log("MVTLoader constructor"),this._loader.setResponseType("arraybuffer")}async doLoad(e,n){const r=await this._loader.loadAsync(e),s=new _m(new Sm(r)),l=this.drawTile(s,n.source.style,n.z);return console.log("drawTile",l),new m.CanvasTexture(l)}drawTile(e,n,r){const u=new OffscreenCanvas(256,256).getContext("2d");if(u){if(n)for(const d in n.layer){const p=n.layer[d];if(n&&(r<(p.minLevel??1)||r>(p.maxLevel??20)))continue;const f=e.layers[d];if(f){const y=256/f.extent;this._renderLayer(u,f,p,y)}}else for(const d in e.layers){const p=e.layers[d],f=256/p.extent;this._renderLayer(u,p,void 0,f)}return u.canvas}else throw new Error("Canvas context is not available")}_renderLayer(e,n,r,s=1){e.save();for(let l=0;l<n.length;l++){const c=n.feature(l);this._renderFeature(e,c,r,s)}return e.restore(),this}_renderFeature(e,n,r={},s=1){const l=[tt.Unknown,tt.Point,tt.Linestring,tt.Polygon][n.type],c={geometry:n.loadGeometry(),properties:n.properties};this._render.render(e,l,c,r,s)}_convertToGeoJSONFeature(e,n){const r=this._convertGeometryToGeoJSON(e.geometry,n);return r?{type:"Feature",geometry:r,properties:e.properties||{},id:e.id}:null}_convertGeometryToGeoJSON(e,n){switch(n){case tt.Point:return this._convertPointGeometry(e);case tt.Linestring:return this._convertLineGeometry(e);case tt.Polygon:return this._convertPolygonGeometry(e);default:return console.warn("未知的几何类型:",n),null}}_convertPointGeometry(e){const n=[];for(const r of e)for(const s of r)n.push([s.x,s.y]);return n.length===0?null:n.length===1?{type:"Point",coordinates:n[0]}:{type:"MultiPoint",coordinates:n}}_convertLineGeometry(e){const n=[];for(const r of e){const s=[];for(const l of r)s.push([l.x,l.y]);s.length>=2&&n.push(s)}return n.length===0?null:n.length===1?{type:"LineString",coordinates:n[0]}:{type:"MultiLineString",coordinates:n}}_convertPolygonGeometry(e){const n=[];let r=[];for(const s of e){const l=[];for(const c of s)l.push([c.x,c.y]);l.length>=4&&(this._isRingClockwise(l)||r.length===0?(r.length>0&&n.push(r),r=[l]):r.push(l))}return r.length>0&&n.push(r),n.length===0?null:n.length===1?{type:"Polygon",coordinates:n[0]}:{type:"MultiPolygon",coordinates:n}}_isRingClockwise(e){let n=0;for(let r=0;r<e.length-1;r++){const[s,l]=e[r],[c,u]=e[r+1];n+=(c-s)*(u+l)}return n>0}convertVectorTileToGeoJSON(e){const n=[];for(const r in e.layers){const s=e.layers[r];for(let l=0;l<s.length;l++){const c=s.feature(l),u=[tt.Unknown,tt.Point,tt.Linestring,tt.Polygon][c.type],d={geometry:c.loadGeometry(),properties:c.properties},p=this._convertToGeoJSONFeature(d,u);p&&(p.properties._layer=r,n.push(p))}}return{type:"FeatureCollection",features:n}}}fo(new Km);const tc="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IF89MjMyODMwNjQzNjUzODY5NjNlLTI2LG09MTIsUD10eXBlb2YgVGV4dERlY29kZXI+InUiP251bGw6bmV3IFRleHREZWNvZGVyKCJ1dGYtOCIpLGc9MCx5PTEsRj0yLHA9NTtjbGFzcyBNe2NvbnN0cnVjdG9yKHQ9bmV3IFVpbnQ4QXJyYXkoMTYpKXt0aGlzLmJ1Zj1BcnJheUJ1ZmZlci5pc1ZpZXcodCk/dDpuZXcgVWludDhBcnJheSh0KSx0aGlzLmRhdGFWaWV3PW5ldyBEYXRhVmlldyh0aGlzLmJ1Zi5idWZmZXIpLHRoaXMucG9zPTAsdGhpcy50eXBlPTAsdGhpcy5sZW5ndGg9dGhpcy5idWYubGVuZ3RofXJlYWRGaWVsZHModCxlLHI9dGhpcy5sZW5ndGgpe2Zvcig7dGhpcy5wb3M8cjspe2NvbnN0IHM9dGhpcy5yZWFkVmFyaW50KCksbj1zPj4zLG89dGhpcy5wb3M7dGhpcy50eXBlPXMmNyx0KG4sZSx0aGlzKSx0aGlzLnBvcz09PW8mJnRoaXMuc2tpcChzKX1yZXR1cm4gZX1yZWFkTWVzc2FnZSh0LGUpe3JldHVybiB0aGlzLnJlYWRGaWVsZHModCxlLHRoaXMucmVhZFZhcmludCgpK3RoaXMucG9zKX1yZWFkRml4ZWQzMigpe2NvbnN0IHQ9dGhpcy5kYXRhVmlldy5nZXRVaW50MzIodGhpcy5wb3MsITApO3JldHVybiB0aGlzLnBvcys9NCx0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RGaWVsZHMoWSx7fSxlKX19ZnVuY3Rpb24gWShpLHQsZSl7aWYoaT09PTMpe2NvbnN0IHI9bmV3IFgoZSxlLnJlYWRWYXJpbnQoKStlLnBvcyk7ci5sZW5ndGgmJih0W3IubmFtZV09cil9fWFzeW5jIGZ1bmN0aW9uIEsoaSx0LGUscil7dHJ5e2NvbnN0IHM9UShpLHQsZSxyKTtyZXR1cm57eDp0LHk6ZSx6OnIsbGF5ZXJzOnMsdGltZXN0YW1wOkRhdGUubm93KCksZGF0YUZvcm1hdDoibXZ0In19Y2F0Y2gocyl7dGhyb3cgY29uc29sZS5lcnJvcigi6Kej5p6Q55+i6YeP55Om54mH5pWw5o2u5pe25Ye66ZSZOiIscyksc319ZnVuY3Rpb24gUShpLHQsZSxyKXtjb25zdCBzPW5ldyBNKGkpLG49bmV3IHoocyksbz17fTtmb3IoY29uc3QgaCBpbiBuLmxheWVycyl7Y29uc3QgYT1uLmxheWVyc1toXSxkPVtdO2ZvcihsZXQgdT0wO3U8YS5sZW5ndGg7dSsrKXtjb25zdCBsPWEuZmVhdHVyZSh1KS50b0dlb0pTT04odCxlLHIpO2QucHVzaChsKX1vW2hdPWR9cmV0dXJuIG99c2VsZi5vbm1lc3NhZ2U9YXN5bmMgaT0+e2NvbnN0IHQ9aS5kYXRhO3RyeXtjb25zdCBlPWF3YWl0IEsodC5hcnJheUJ1ZmZlcix0LngsdC55LHQueik7c2VsZi5wb3N0TWVzc2FnZShlKX1jYXRjaChlKXtjb25zb2xlLmVycm9yKCJXb3JrZXIgTVZUIOino+aekOWksei0pToiLGUpLHNlbGYucG9zdE1lc3NhZ2Uoe2Vycm9yOmUubWVzc2FnZX0pfX19KSgpOwo=",Rm=a=>Uint8Array.from(atob(a),t=>t.charCodeAt(0)),nc=typeof self<"u"&&self.Blob&&new Blob([Rm(tc)],{type:"text/javascript;charset=utf-8"});function Ym(a){let t;try{if(t=nc&&(self.URL||self.webkitURL).createObjectURL(nc),!t)throw"";const e=new Worker(t,{name:a?.name});return e.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),e}catch{return new Worker("data:text/javascript;base64,"+tc,{name:a?.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}const Um=10;class Bm{constructor(){G(this,"info",{version:"1.0.0",description:"Vector Tile loader for Mapbox Vector Tile format. It can load and parse MVT data."});G(this,"dataType","VectorTile");G(this,"fileLoader",new m.FileLoader(Xe.manager));G(this,"_workerPool",new qs(0));this.fileLoader.setResponseType("arraybuffer"),this._workerPool.setWorkerCreator(()=>new Ym)}async load(t){const{source:e,x:n,y:r,z:s}=t,l=typeof e._getUrl=="function"?e._getUrl(n,r,s):this.buildTileUrl(e.url,n,r,s);if(!l)return this.createErrorGeometry(n,r,s,new Error("VectorTileLoader: source._getUrl 返回空 URL"));this._workerPool.pool===0&&this._workerPool.setWorkerLimit(Um);try{const c=await this.fetchVectorData(l),u={arrayBuffer:c,x:n,y:r,z:s},p=(await this._workerPool.postMessage(u,[c])).data;if(p.error)throw new Error(p.error);const f=this.createGeometryWithVectorData(p,t);return Xe.manager.parseEnd(l),f}catch(c){return this.createErrorGeometry(n,r,s,c)}}async fetchVectorData(t){try{const e=await this.fileLoader.loadAsync(t);if(!e||e.byteLength===0)throw new Error("Empty response");return e}catch(e){throw new Error(`Failed to fetch vector tile: ${e.message}`)}}calculateTileBounds(t,e,n){const r=4007501668557849e-8/Math.pow(2,n),s=-20037508342789244e-9+t*r,l=s+r,c=20037508342789244e-9-(e+1)*r,u=c+r;return{min:new m.Vector2(s,c),max:new m.Vector2(l,u),world:new m.Vector2(r,r)}}buildTileUrl(t,e,n,r){return t.replace("{x}",e.toString()).replace("{y}",n.toString()).replace("{z}",r.toString()).replace("{-y}",(Math.pow(2,r)-1-n).toString())}createGeometryWithVectorData(t,e){const n=new dr;return n.userData={vectorData:t,tileInfo:{x:e.x,y:e.y,z:e.z,bounds:e.bounds},metadata:{dataType:"vector-tile",version:"1.0.0",loadedAt:Date.now()}},n}createErrorGeometry(t,e,n,r){const s=new dr;return s.userData={vectorData:{x:t,y:e,z:n,layers:{},totalFeatures:0,bounds:this.calculateTileBounds(t,e,n),error:r.message,timestamp:Date.now(),dataFormat:"error"},tileInfo:{x:t,y:e,z:n,bounds:[0,0,0,0]},metadata:{dataType:"vector-tile-error",error:!0,errorMessage:r.message}},s}unload(t){t.userData?.vectorData&&(t.userData.vectorData=null),t.dispose&&t.dispose()}static getVectorData(t){return t.userData?.vectorData||null}static hasValidVectorData(t){const e=this.getVectorData(t);return e&&!e.error&&e.totalFeatures>0}static getLayerNames(t){const e=this.getVectorData(t);return e?Object.keys(e.layers||{}):[]}static getFeaturesByLayer(t,e){return this.getVectorData(t)?.layers?.[e]?.convertedFeatures||[]}}Nl(new Bm);class rc extends zl{constructor(e,n){super(e,n);G(this,"layerType","vector");G(this,"_tileDataMap",new Map);G(this,"_renderer");G(this,"_style");G(this,"_feaList",[]);G(this,"_collision",!1);G(this,"_renderAltitude",0);if(!n.style)throw new Error("VectorTileLayer 必须提供样式配置");this._style=n.style,this._collision=n.collision||!1,this._featureFilter=n.featureFilter,this._renderAltitude=n.altitude||0,this._rootTile.setDataOnlyMode(!0),this._setupDataModeAndListenersForChildren(),this._setupLifeCycleListeners()}_setupDataModeAndListenersForChildren(){const e=n=>{n!==this._rootTile&&n.setDataOnlyMode(!0),this._addShownListenerToTile(n),this._addUnloadListenerToTile(n)};this._rootTile.addEventListener("tile-created",n=>{const r=n.tile;e(r)}),this._rootTile.traverse(n=>{n.isTile&&e(n)})}_addShownListenerToTile(e){const n=r=>{const s=r.tile,l=`${s.z}-${s.x}-${s.y}`,c=!!this._renderer,u=this._tileDataMap.get(l);c&&u&&this._renderer.processTileData(s,u.data)};e.addEventListener("tile-shown",n)}_addUnloadListenerToTile(e){const n=r=>{const s=r.tile||r.target,l=`${s.z}-${s.x}-${s.y}`;if(this._renderer)try{this._renderer.removeFeaturesByTileKey(l)}catch{}this._tileDataMap.delete(l)};e.addEventListener("unload",n)}setAltitude(e){return super.setAltitude(0),this._renderAltitude=e,this._renderer&&this._renderer.setAltitude(e),this}getAltitude(){return this._renderAltitude}_addHiddenListenerToTile(e){const n=r=>{const s=r.tile,l=`${s.z}-${s.x}-${s.y}`;if(this._renderer)try{this._renderer.hideFeaturesByTileKey(l)}catch{}};e.addEventListener("tile-hidden",n)}_setupLifeCycleListeners(){this._rootTile.addEventListener("tile-loaded",e=>{const n=e.tile,r=`${n.z}-${n.x}-${n.y}`,s=this.getVectorDataFromTile(n);if(!s){console.warn(`[VectorTileLayer] Tile ${r} loaded but has no vector data.`);return}if(s.vectorData?.dataFormat==="mvt"&&this._tileDataMap.set(r,{data:s,tile:n,timestamp:Date.now(),pending:!1}),n.showing&&this._renderer&&s.vectorData?.dataFormat==="mvt")try{this._renderer.processTileData(n,s)}catch{}})}getVectorDataFromTile(e){return!e.geometry||!e.getVectorData()?null:e.getVectorData()}createLoader(){const e=new Ii;return e.vtSource=this.source,e}getVisibleVectorTiles(){const e=[];return this._rootTile.traverse(n=>{if(n.isTile&&n.loaded&&n.inFrustum){const r=`${n.z}-${n.x}-${n.y}`,s=this._tileDataMap.get(r);s&&e.push({tileKey:r,data:s.data,tile:s.tile})}}),e}getAllVectorData(){return new Map(this._tileDataMap)}getVectorData(e,n,r){const s=`${r}-${e}-${n}`,l=this._tileDataMap.get(s);return l?l.data:null}setFeatureFilter(e){this._featureFilter=e,this._renderer&&this._renderer.setFeatureFilter(e)}clearFeatureFilter(){this._featureFilter=void 0,this._renderer&&this._renderer.clearFeatureFilter()}setOpacity(e){this.opacity=e,this._renderer&&this._renderer.setOpacity(e)}update(e){!this.enabled||!this.visible||super.update(e)}dispose(){this._renderer&&this._renderer.dispose(),super.dispose()}_setRenderer(e){this._renderer=e}_getRenderer(){return this._renderer||null}getStyle(){return this._style}}class Nm{constructor(...t){}}const jm={};let pr=class Ch extends Qs(xi(_i(Nm))){constructor(e,n){Ys(e,"container","Map container element must be specified");const r=["center","basemap"];for(const d of r)cl(n,d);const l={...n,viewer:{...{viewer:{antialias:!0,stencil:!0,logarithmicDepthBuffer:!0}}.viewer,...n.viewer}};super(l);G(this,"viewer");G(this,"tilemap");G(this,"center");G(this,"prjcenter");G(this,"_layerContainer");G(this,"_EventMap",{loaded:{listened:!1}});G(this,"_canvasManager",new tp);G(this,"collisionEngine");G(this,"_onLoadHooks");this.tilemap=this.initTileMap(l.basemap),this.center=this.options.center,this.viewer=new ul(e,{...l.viewer,map:this}),this.tilemap.receiveShadow=!0,this.viewer.scene.add(this.tilemap);const c=this.tilemap.geo2world(new m.Vector3(this.center[0],this.center[1],0)),u=this.tilemap.geo2world(new m.Vector3(this.center[0],this.center[1]-.03,this.center[2]||1e3));this.prjcenter=c,console.log(c,"centerPostion"),this.viewer.camera.position.copy(u),this.viewer.camera.lookAt(c),this.viewer.controls.target.copy(c),this._layerContainer=new ep,this.viewer.scene.add(this._layerContainer),this.collisionEngine=new xp(this.viewer.renderer,{padding:8,updateInterval:16,animationDuration:200,maxFeaturesPerFrame:2e4,strategies:{priority:!0,grouping:!0,proximity:!0}}),this.on("control-change",_p.debounce(d=>{this.collisionEngine.update(d.camera)},10,{leading:!1,trailing:!0})),this._callOnLoadHooks()}static addOnLoadHook(e,...n){const r=typeof e=="function"?e:function(){this[e].apply(this,n)},s=this.prototype;return s._onLoadHooks=s._onLoadHooks||[],s._onLoadHooks.push(r),this}_callOnLoadHooks(){const e=Ch.prototype;if(e._onLoadHooks)for(let n=0,r=e._onLoadHooks.length;n<r;n++)e._onLoadHooks[n].call(this)}initTileMap(e){const n=new bi({...e});try{if(e.Baselayers?.length)for(const r of e.Baselayers)r.isBaseLayer=!0,n.addLayer(r)}catch(r){console.error("💥 诊断失败:",r)}return n.rotateX(-Math.PI/2),n.receiveShadow=!0,n.addEventListener("ready",()=>{const r={timestamp:Wf(),targrt:this};this._EventMap.loaded={listened:!0},this.trigger("loaded",r)}),n}addLayer(e,...n){if(!e)return this;Array.isArray(e)||(e=[e]),n?.length&&(e=e.concat(n)),n?.length&&(e=e.concat(n));for(let r=0,s=e.length;r<s;r++){const l=e[r],c=l.getId();if(Js(c))throw new Error("Invalid id for the layer: "+c);l.isTileLayer?this.addTileLayer(l):this.addRegularLayer(l)}return this}removeLayer(e){const n=this._layerContainer.getLayerById(e);return n?(this._layerContainer.remove(n),console.log(`✅ 图层从场景移除: ${e}`),n.isTileLayer&&(this.tilemap.removeLayer(e),console.log(`✅ 瓦片图层从管理器移除: ${e}`)),n instanceof Un&&n?._collision,!0):(console.warn(`⚠️ 图层不存在: ${e}`),!1)}addRegularLayer(e){const n=e.getId();this._layerContainer.add(e),e._bindMap(this),e instanceof Un&&e?._collision&&(this.collisionEngine.registerLayer(e),e.setCollisionEngine(this.collisionEngine)),console.log(`📁 普通图层已添加到场景: ${n}`)}addTileLayer(e){if(this.tilemap.addLayer(e),e._bindMap(this),e instanceof rc){const n=new Vp(e.getId()+"-vtrender",{altitude:e.getAltitude(),style:e.getStyle(),collision:e._collision});e._setRenderer(n),this.addRegularLayer(n)}return this}clearLayers(){return this._layerContainer.clear(),this.tilemap.clearLayers(),this}getLayers(){return[...this._layerContainer.getLayers(),...this.tilemap.getLayers()]}getLayerById(e){const n=this._layerContainer.getLayerById(e);return n||this.tilemap.getLayer(e)}geo2world(e){return this.tilemap.geo2world(e)}world2geo(e){return this.tilemap.world2geo(e)}geo2map(e){return this.tilemap.geo2map(e)}_getCanvas(e=40,n=30,r){return this._canvasManager.getCanvas(e,n,1,r)}getContainer(){return this.viewer.container}getRenderer(){return this.viewer.renderer}getCamera(){return this.viewer.camera}_findFeaturesAt(e){const n=this,r=n.getRenderer(),s=n.getCamera(),l=r.domElement.getBoundingClientRect(),c=e.x/l.width*2-1,u=-(e.y/l.height)*2+1,d=new m.Raycaster;d.setFromCamera(new m.Vector2(c,u),s);const p=n.getLayers().filter(y=>!y?.isSceneLayer);return d.intersectObjects(p,!0).sort((y,v)=>y.distance-v.distance).map(y=>{let v=y.object.parent;return v?.parent?._type==="Model"&&(v=v.parent),{feature:v,distance:y.distance,object:y.object}})}_getEventPosition(e){let n,r;if("touches"in e){if(e.touches.length===0)return null;n=e.touches[0].clientX,r=e.touches[0].clientY}else n=e.clientX,r=e.clientY;const s=this.getContainer();if(!s)return null;const l=s.getBoundingClientRect();return{x:n-l.left,y:r-l.top}}get isInteracting(){return this.viewer.isInteracting}identify(){}};pr.mergeOptions(jm);function ic(a,t,e){const{currentTarget:n,clientX:r,clientY:s}=a;if(n instanceof HTMLElement){const l=n.clientWidth,c=n.clientHeight,u=new m.Vector2(r/l*2-1,-(s/c)*2+1);return t.getLocalInfoFromScreen(e,u)?.location}else return}const Jm=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout"];pr.prototype._removeDomEvents=function(){console.log("removeDomEvents",this)},pr.prototype._registerDomEvents=function(){const a=this.viewer.container;a&&Jm.forEach(t=>{a.addEventListener(t,e=>{let n=ic(e,this.tilemap,this.viewer.camera),r={target:this,originEvent:e,eventName:t,screenXY:{X:e.screenX,Y:e.screenY}};if(n){let s=[n.x,n.y,n.z];r={target:this,originEvent:e,coordinate:s,eventName:t,screenXY:{X:e.screenX,Y:e.screenY}}}this.trigger(t,r)})})};const Qm=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","touchstart","touchmove","touchend"];class Hm extends ml{constructor(){super(...arguments);G(this,"_registeredEvents",[]);G(this,"_eventCommon",e=>{e.type==="click"&&Date.now()-this._mouseDownTime>300||this._handleEvent(e,e.type)})}addHooks(){const n=this.target.getContainer();n&&Qm.forEach(r=>{n.addEventListener(r,this._eventCommon),this._registeredEvents.push(r)})}removeHooks(){const n=this.target.getContainer();n&&this._registeredEvents.length>0&&(this._registeredEvents.forEach(r=>{const s=r;n.removeEventListener(s,this._eventCommon)}),this._registeredEvents=[])}_handleEvent(e,n){const r=this.target;if(this._shouldIgnoreEvent())return;const s=r._getEventPosition(e);if(!s)return;const l=r._findFeaturesAt(s);if(l.length===0)return;const c=l[0].feature;switch(n){case"click":this._handleClickEvent(c,e);break;default:c&&this._fireFeatureEvent(c,n,e)}}_handleClickEvent(e,n){if(!e)return;this._fireFeatureEvent(e,"click",n);const r=e.getLayer();r&&r.trigger("featureclick",{feature:e,domEvent:n,type:"featureclick"})}handleMoveEvent(e,n){if(!e)return;this._fireFeatureEvent(e,n.type,n);const r=e.getLayer();r&&r.trigger("feature"+n.type,{feature:e,domEvent:n,type:"feature"+n.type})}_fireFeatureEvent(e,n,r){const s=this.target;let l=ic(r,s.tilemap,s.viewer.camera);if(!l)return;let c=[l.x,l.y,l.z],u={target:e,originEvent:r,coordinate:c,eventName:n,screenXY:{X:r.screenX,Y:r.screenY}};e.trigger(n,u)}_shouldIgnoreEvent(){return!!this.target.isInteracting}}pr.mergeOptions({FeatureEvents:!0,onlyVisibleFeatureEvents:!0}),pr.addOnLoadHook("addHandler","FeatureEvents",Hm);class Em extends Rt{constructor(e){super(e);G(this,"dataType","image");G(this,"attribution","天地图");G(this,"token","");G(this,"style","img_w");G(this,"subdomains","01234");G(this,"url","https://t{s}.tianditu.gov.cn/DataServer?T={style}&x={x}&y={y}&l={z}&tk={token}");if(Object.assign(this,e),!this.token)throw new Error("天地图访问令牌(token)是必填参数")}}class qm extends Rt{constructor(e){super(e);G(this,"dataType","quantized-mesh");G(this,"attribution","天地图");G(this,"token","");G(this,"subdomains","01234");G(this,"url","https://t{s}.tianditu.gov.cn/mapservice/swdx?T=elv_c&tk={token}&x={x}&y={y}&l={z}");if(Object.assign(this,e),!this.token)throw new Error("天地图访问令牌(token)是必填参数")}}class $m extends Rt{constructor(e){super({...e,url:e.urlTemplate,isTMS:e.isTMS||!1});G(this,"minLevel",2);G(this,"maxLevel",24)}getUrl(e,n,r){const s=this.isTMS?Math.pow(2,r)-1-n:n;return If(this.url,{...this,x:e,y:s,z:r,tileMatrix:r,tileRow:s,tileCol:e})}}class e0 extends Rt{constructor(e){super(e);G(this,"dataType","image");G(this,"attribution","ArcGIS");G(this,"style","World_Imagery");G(this,"url","https://services.arcgisonline.com/arcgis/rest/services/{style}/MapServer/tile/{z}/{y}/{x}");Object.assign(this,e)}}class t0 extends Rt{constructor(e){super(e);G(this,"dataType","lerc");G(this,"attribution","ArcGIS");G(this,"minLevel",6);G(this,"maxLevel",13);G(this,"url","https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer/tile/{z}/{y}/{x}");Object.assign(this,e)}}class n0 extends Rt{constructor(e){super(e);G(this,"token","");G(this,"format","webp");G(this,"style","cm2myr6qx001t01pi0sf7estf");G(this,"attribution","MapBox");G(this,"maxLevel",25);G(this,"url","https://api.mapbox.com/styles/v1/criska/cm2myr6qx001t01pi0sf7estf/tiles/256/{z}/{x}/{y}?access_token={token}&format={format}");if(Object.assign(this,e),!this.token)throw new Error("MapBox访问令牌(token)是必填参数")}}class r0 extends Rt{constructor(e){super(e);G(this,"dataType","mvt");G(this,"style",{layer:[]});Object.assign(this,e)}}class i0 extends Rt{constructor(e){super(e);G(this,"dataType","VectorTile");G(this,"attribution","ArcGIS");G(this,"minLevel",1);G(this,"maxLevel",21);G(this,"url","https://api.maptiler.com/tiles/v3/{z}/{x}/{y}.pbf?key=uKYsZQZpm72WlbSgH9B7");Object.assign(this,e)}}class s0 extends Un{constructor(t,e){super(t,e)}validateFeature(t){return t._baseType==="Line"}}class o0 extends Un{constructor(t,e){super(t,e)}validateFeature(t){return t._baseType==="Point"}}class a0 extends Un{constructor(t,e){super(t,e)}validateFeature(t){return t._baseType==="Surface"}}class l0 extends Un{constructor(e,n){super(e,n);G(this,"_clouds",null);const r=["texture"];for(const s of r)cl(n,s);this._createClouds(n.texture)}async _createClouds(e){const n=await Kt._loadTexture(e),r=new Ff({texture:n,material:m.MeshBasicMaterial});r.castShadow=!0,r.renderOrder=99999,this._clouds=r}validateFeature(e){return e._type==="Cloud"}animate(e,n){this._clouds&&this._clouds.update(this.map.viewer.camera,n,e)}}class c0 extends zl{constructor(e,n){super(e,n);G(this,"layerType","raster")}createLoader(){const e=new Ii;return Array.isArray(this.source)?e.imgSource=this.source:e.imgSource=[this.source],e}}class u0 extends c0{constructor(e,n){super(e,n);G(this,"layerType","wmts");G(this,"_layerName");G(this,"_style");G(this,"_matrixSet");this._layerName=n.layerName,this._style=n.style||"default",this._matrixSet=n.matrixSet||"GoogleMapsCompatible"}get layerName(){return this._layerName}get style(){return this._style}get matrixSet(){return this._matrixSet}createLoader(){const e=new Ii;return Array.isArray(this.source)?e.imgSource=this.source:e.imgSource=[this.source],e}update(e){this.loader&&super.update(e)}}console.log("%c✨ terra.gl V"+Vh+" ","color:rgb(255, 255, 255); font-weight: bold; background: linear-gradient(90deg, #ffb6c1, #ff69b4); padding: 5px; border-radius: 5px;"),te.ArcGisDemSource=t0,te.ArcGisSource=e0,te.CloudsLayer=l0,te.EventClass=Ns,te.ICloud=Xl,te.Label=kl,te.LineLayer=s0,te.LineString=ro,te.LoaderFactory=Xe,te.MVTGeoSource=i0,te.MVTSource=r0,te.Maker=no,te.Map=pr,te.MapBoxSource=n0,te.Martini=Ul,te.Model=Fl,te.MultiLineString=Al,te.PointLayer=o0,te.Polygon=Vl,te.PolygonLayer=a0,te.ProjectFactory=Tf,te.PromiseWorker=Ap,te.TDTQMSource=qm,te.TDTSource=Em,te.TPoints=Dl,te.Tile=nn,te.TileCanvasLoader=Yp,te.TileGeometry=dr,te.TileGeometryLoader=co,te.TileLoader=Ii,te.TileLoadingManager=Ol,te.TileMap=bi,te.TileMaterial=uo,te.TileMaterialLoader=ho,te.TileSource=Rt,te.VectorFeatureTypes=tt,te.VectorTileLayer=rc,te.VectorTileRender=Bl,te.Viewer=ul,te.WMTSSource=$m,te.WMTSTileLayer=u0,te.addSkirt=Rl,te.author=Qp,te.concatenateTypedArrays=Br,te.convertGeometryToWGS84=kp,te.createBillboards=Zf,te.getBoundsCoord=io,te.getGeometryDataFromDem=Yl,te.getGridIndices=ao,te.getLocalInfoFromRay=Us,te.getLocalInfoFromScreen=pl,te.getLocalInfoFromWorld=Bs,te.getNormals=lo,te.getSafeTileUrlAndBounds=so,te.registerDEMLoader=po,te.registerImgLoader=fo,te.registerMeshLoader=Nl,te.vector2ToWGS84=oo,te.version=Jp,te.waitFor=Hp,Object.defineProperty(te,Symbol.toStringTag,{value:"Module"})});
|
|
723
|
+
`;class Rt{constructor(t){G(this,"dataType","image");G(this,"attribution","isource");G(this,"minLevel",0);G(this,"maxLevel",18);G(this,"projectionID","3857");G(this,"url","");G(this,"subdomains",[]);G(this,"s","");G(this,"opacity",1);G(this,"isTMS",!1);G(this,"bounds",[-180,-85,180,85]);G(this,"_projectionBounds",[-1/0,-1/0,1/0,1/0]);G(this,"tileMaterial");Object.assign(this,t)}getUrl(t,e,n){const r={...this,x:t,y:e,z:n};return jp(this.url,r)}_getUrl(t,e,n){const r=this.subdomains.length;if(r>0){const l=Math.floor(Math.random()*r);this.s=this.subdomains[l]}const s=this.isTMS?Math.pow(2,n)-1-e:e;return this.getUrl(t,s,n)}static create(t){return new Rt(t)}}function jp(a,t){const e=/\{ *([\w_-]+) *\}/g;return a.replace(e,(n,r)=>{const s=t[r]??(()=>{throw new Error(`source url template error, No value provided for variable: ${n}`)})();return typeof s=="function"?s(t):s})}const{version:Jp,author:Qp}=JSON.parse(Np);function Hp(a,t=100){return new Promise(e=>{const n=setInterval(()=>{a&&(clearInterval(n),e())},t)})}function fo(a){return Xe.registerMaterialLoader(a),a}function po(a){return Xe.registerGeometryLoader(a),a}function Nl(a){return Xe.registerMeshLoader(a),a}fo(new Up);const jl="dmFyIGNlPU9iamVjdC5kZWZpbmVQcm9wZXJ0eTt2YXIgbWU9KGosWixxKT0+WiBpbiBqP2NlKGosWix7ZW51bWVyYWJsZTohMCxjb25maWd1cmFibGU6ITAsd3JpdGFibGU6ITAsdmFsdWU6cX0pOmpbWl09cTt2YXIgTj0oaixaLHEpPT5tZShqLHR5cGVvZiBaIT0ic3ltYm9sIj9aKyIiOloscSk7KGZ1bmN0aW9uKCl7InV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JuIHMuZ2V0R2VvbWV0cnlEYXRhKHQpfWZ1bmN0aW9uIGZlKEEscCl7ZnVuY3Rpb24gayhzLHQsbixoLGksbyxjLHUpe2NvbnN0IG09bmV3IEZsb2F0MzJBcnJheShpKm8pO2ZvcihsZXQgbD0wO2w8bztsKyspZm9yKGxldCBmPTA7ZjxpO2YrKyl7Y29uc3QgZz0obCtoKSp0KyhmK24pLE09bCppK2Y7bVtNXT1zW2ddfWNvbnN0IHc9bmV3IEZsb2F0MzJBcnJheSh1KmMpO2ZvcihsZXQgbD0wO2w8dTtsKyspZm9yKGxldCBmPTA7ZjxjO2YrKyl7Y29uc3QgZz1sKnUrZixNPU1hdGgucm91bmQoZipvL3UpLGQ9TWF0aC5yb3VuZChsKmkvYykqaStNO3dbZ109bVtkXX1yZXR1cm4gd31jb25zdCBVPW9lKHAsQS53aWR0aCksYT1VLnN3KzEsZT1VLnNoKzE7cmV0dXJue2FycmF5OmsoQS5hcnJheSxBLndpZHRoLFUuc3gsVS5zeSxVLnN3LFUuc2gsYSxlKSx3aWR0aDphLGhlaWdodDplfX1mdW5jdGlvbiBvZShBLHApe2NvbnN0IGs9TWF0aC5mbG9vcihBWzBdKnApLFU9TWF0aC5mbG9vcihBWzFdKnApLGE9TWF0aC5mbG9vcigoQVsyXS1BWzBdKSpwKSxlPU1hdGguZmxvb3IoKEFbM10tQVsxXSkqcCk7cmV0dXJue3N4Omssc3k6VSxzdzphLHNoOmV9fXNlbGYub25tZXNzYWdlPUE9Pntjb25zdCBwPUEuZGF0YSxrPXNlKHAuZGVtRGF0YSxwLnoscC5jbGlwQm91bmRzKTtzZWxmLnBvc3RNZXNzYWdlKGspfX0pKCk7Cg==",Ep=a=>Uint8Array.from(atob(a),t=>t.charCodeAt(0)),Jl=typeof self<"u"&&self.Blob&&new Blob([Ep(jl)],{type:"text/javascript;charset=utf-8"});function qp(a){let t;try{if(t=Jl&&(self.URL||self.webkitURL).createObjectURL(Jl),!t)throw"";const e=new Worker(t,{name:a?.name});return e.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),e}catch{return new Worker("data:text/javascript;base64,"+jl,{name:a?.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}/* Copyright 2015-2021 Esri. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 @preserve */const $p=function(){var a={};a.defaultNoDataValue=-34027999387901484e22,a.decode=function(l,c){c=c||{};var u=c.encodedMaskData||c.encodedMaskData===null,d=r(l,c.inputOffset||0,u),p=c.noDataValue!==null?c.noDataValue:a.defaultNoDataValue,f=t(d,c.pixelType||Float32Array,c.encodedMaskData,p,c.returnMask),y={width:d.width,height:d.height,pixelData:f.resultPixels,minValue:f.minValue,maxValue:d.pixels.maxValue,noDataValue:p};return f.resultMask&&(y.maskData=f.resultMask),c.returnEncodedMask&&d.mask&&(y.encodedMaskData=d.mask.bitset?d.mask.bitset:null),c.returnFileInfo&&(y.fileInfo=e(d),c.computeUsedBitDepths&&(y.fileInfo.bitDepths=n(d))),y};var t=function(l,c,u,d,p){var f=0,y=l.pixels.numBlocksX,v=l.pixels.numBlocksY,b=Math.floor(l.width/y),T=Math.floor(l.height/v),_=2*l.maxZError,S=Number.MAX_VALUE,L;u=u||(l.mask?l.mask.bitset:null);var I,F;I=new c(l.width*l.height),p&&u&&(F=new Uint8Array(l.width*l.height));for(var K=new Float32Array(b*T),D,O,V=0;V<=v;V++){var R=V!==v?T:l.height%v;if(R!==0)for(var P=0;P<=y;P++){var k=P!==y?b:l.width%y;if(k!==0){var N=V*l.width*T+P*b,H=l.width-k,Q=l.pixels.blocks[f],q,J,oe;Q.encoding<2?(Q.encoding===0?q=Q.rawData:(s(Q.stuffedData,Q.bitsPerPixel,Q.numValidPixels,Q.offset,_,K,l.pixels.maxValue),q=K),J=0):Q.encoding===2?oe=0:oe=Q.offset;var ie;if(u)for(O=0;O<R;O++){for(N&7&&(ie=u[N>>3],ie<<=N&7),D=0;D<k;D++)N&7||(ie=u[N>>3]),ie&128?(F&&(F[N]=1),L=Q.encoding<2?q[J++]:oe,S=S>L?L:S,I[N++]=L):(F&&(F[N]=0),I[N++]=d),ie<<=1;N+=H}else if(Q.encoding<2)for(O=0;O<R;O++){for(D=0;D<k;D++)L=q[J++],S=S>L?L:S,I[N++]=L;N+=H}else for(S=S>oe?oe:S,O=0;O<R;O++){for(D=0;D<k;D++)I[N++]=oe;N+=H}if(Q.encoding===1&&J!==Q.numValidPixels)throw"Block and Mask do not match";f++}}}return{resultPixels:I,resultMask:F,minValue:S}},e=function(l){return{fileIdentifierString:l.fileIdentifierString,fileVersion:l.fileVersion,imageType:l.imageType,height:l.height,width:l.width,maxZError:l.maxZError,eofOffset:l.eofOffset,mask:l.mask?{numBlocksX:l.mask.numBlocksX,numBlocksY:l.mask.numBlocksY,numBytes:l.mask.numBytes,maxValue:l.mask.maxValue}:null,pixels:{numBlocksX:l.pixels.numBlocksX,numBlocksY:l.pixels.numBlocksY,numBytes:l.pixels.numBytes,maxValue:l.pixels.maxValue,noDataValue:l.noDataValue}}},n=function(l){for(var c=l.pixels.numBlocksX*l.pixels.numBlocksY,u={},d=0;d<c;d++){var p=l.pixels.blocks[d];p.encoding===0?u.float32=!0:p.encoding===1?u[p.bitsPerPixel]=!0:u[0]=!0}return Object.keys(u)},r=function(l,c,u){var d={},p=new Uint8Array(l,c,10);if(d.fileIdentifierString=String.fromCharCode.apply(null,p),d.fileIdentifierString.trim()!=="CntZImage")throw"Unexpected file identifier string: "+d.fileIdentifierString;c+=10;var f=new DataView(l,c,24);if(d.fileVersion=f.getInt32(0,!0),d.imageType=f.getInt32(4,!0),d.height=f.getUint32(8,!0),d.width=f.getUint32(12,!0),d.maxZError=f.getFloat64(16,!0),c+=24,!u)if(f=new DataView(l,c,16),d.mask={},d.mask.numBlocksY=f.getUint32(0,!0),d.mask.numBlocksX=f.getUint32(4,!0),d.mask.numBytes=f.getUint32(8,!0),d.mask.maxValue=f.getFloat32(12,!0),c+=16,d.mask.numBytes>0){var y=new Uint8Array(Math.ceil(d.width*d.height/8));f=new DataView(l,c,d.mask.numBytes);var v=f.getInt16(0,!0),b=2,T=0;do{if(v>0)for(;v--;)y[T++]=f.getUint8(b++);else{var _=f.getUint8(b++);for(v=-v;v--;)y[T++]=_}v=f.getInt16(b,!0),b+=2}while(b<d.mask.numBytes);if(v!==-32768||T<y.length)throw"Unexpected end of mask RLE encoding";d.mask.bitset=y,c+=d.mask.numBytes}else d.mask.numBytes|d.mask.numBlocksY|d.mask.maxValue||(d.mask.bitset=new Uint8Array(Math.ceil(d.width*d.height/8)));f=new DataView(l,c,16),d.pixels={},d.pixels.numBlocksY=f.getUint32(0,!0),d.pixels.numBlocksX=f.getUint32(4,!0),d.pixels.numBytes=f.getUint32(8,!0),d.pixels.maxValue=f.getFloat32(12,!0),c+=16;var S=d.pixels.numBlocksX,L=d.pixels.numBlocksY,I=S+(d.width%S>0?1:0),F=L+(d.height%L>0?1:0);d.pixels.blocks=new Array(I*F);for(var K=0,D=0;D<F;D++)for(var O=0;O<I;O++){var V=0,R=l.byteLength-c;f=new DataView(l,c,Math.min(10,R));var P={};d.pixels.blocks[K++]=P;var k=f.getUint8(0);if(V++,P.encoding=k&63,P.encoding>3)throw"Invalid block encoding ("+P.encoding+")";if(P.encoding===2){c++;continue}if(k!==0&&k!==2){if(k>>=6,P.offsetType=k,k===2)P.offset=f.getInt8(1),V++;else if(k===1)P.offset=f.getInt16(1,!0),V+=2;else if(k===0)P.offset=f.getFloat32(1,!0),V+=4;else throw"Invalid block offset type";if(P.encoding===1)if(k=f.getUint8(V),V++,P.bitsPerPixel=k&63,k>>=6,P.numValidPixelsType=k,k===2)P.numValidPixels=f.getUint8(V),V++;else if(k===1)P.numValidPixels=f.getUint16(V,!0),V+=2;else if(k===0)P.numValidPixels=f.getUint32(V,!0),V+=4;else throw"Invalid valid pixel count type"}if(c+=V,P.encoding!==3){var N,H;if(P.encoding===0){var Q=(d.pixels.numBytes-1)/4;if(Q!==Math.floor(Q))throw"uncompressed block has invalid length";N=new ArrayBuffer(Q*4),H=new Uint8Array(N),H.set(new Uint8Array(l,c,Q*4));var q=new Float32Array(N);P.rawData=q,c+=Q*4}else if(P.encoding===1){var J=Math.ceil(P.numValidPixels*P.bitsPerPixel/8),oe=Math.ceil(J/4);N=new ArrayBuffer(oe*4),H=new Uint8Array(N),H.set(new Uint8Array(l,c,J)),P.stuffedData=new Uint32Array(N),c+=J}}}return d.eofOffset=c,d},s=function(l,c,u,d,p,f,y){var v=(1<<c)-1,b=0,T,_=0,S,L,I=Math.ceil((y-d)/p),F=l.length*4-Math.ceil(c*u/8);for(l[l.length-1]<<=8*F,T=0;T<u;T++){if(_===0&&(L=l[b++],_=32),_>=c)S=L>>>_-c&v,_-=c;else{var K=c-_;S=(L&v)<<K&v,L=l[b++],_=32-K,S+=L>>>_}f[T]=S<I?d+S*p:y}return f};return a}(),em=function(){var a={unstuff:function(r,s,l,c,u,d,p,f){var y=(1<<l)-1,v=0,b,T=0,_,S,L,I,F=r.length*4-Math.ceil(l*c/8);if(r[r.length-1]<<=8*F,u)for(b=0;b<c;b++)T===0&&(S=r[v++],T=32),T>=l?(_=S>>>T-l&y,T-=l):(L=l-T,_=(S&y)<<L&y,S=r[v++],T=32-L,_+=S>>>T),s[b]=u[_];else for(I=Math.ceil((f-d)/p),b=0;b<c;b++)T===0&&(S=r[v++],T=32),T>=l?(_=S>>>T-l&y,T-=l):(L=l-T,_=(S&y)<<L&y,S=r[v++],T=32-L,_+=S>>>T),s[b]=_<I?d+_*p:f},unstuffLUT:function(r,s,l,c,u,d){var p=(1<<s)-1,f=0,y=0,v=0,b=0,T=0,_,S=[],L=r.length*4-Math.ceil(s*l/8);r[r.length-1]<<=8*L;var I=Math.ceil((d-c)/u);for(y=0;y<l;y++)b===0&&(_=r[f++],b=32),b>=s?(T=_>>>b-s&p,b-=s):(v=s-b,T=(_&p)<<v&p,_=r[f++],b=32-v,T+=_>>>b),S[y]=T<I?c+T*u:d;return S.unshift(c),S},unstuff2:function(r,s,l,c,u,d,p,f){var y=(1<<l)-1,v=0,b,T=0,_=0,S,L,I;if(u)for(b=0;b<c;b++)T===0&&(L=r[v++],T=32,_=0),T>=l?(S=L>>>_&y,T-=l,_+=l):(I=l-T,S=L>>>_&y,L=r[v++],T=32-I,S|=(L&(1<<I)-1)<<l-I,_=I),s[b]=u[S];else{var F=Math.ceil((f-d)/p);for(b=0;b<c;b++)T===0&&(L=r[v++],T=32,_=0),T>=l?(S=L>>>_&y,T-=l,_+=l):(I=l-T,S=L>>>_&y,L=r[v++],T=32-I,S|=(L&(1<<I)-1)<<l-I,_=I),s[b]=S<F?d+S*p:f}return s},unstuffLUT2:function(r,s,l,c,u,d){var p=(1<<s)-1,f=0,y=0,v=0,b=0,T=0,_=0,S,L=[],I=Math.ceil((d-c)/u);for(y=0;y<l;y++)b===0&&(S=r[f++],b=32,_=0),b>=s?(T=S>>>_&p,b-=s,_+=s):(v=s-b,T=S>>>_&p,S=r[f++],b=32-v,T|=(S&(1<<v)-1)<<s-v,_=v),L[y]=T<I?c+T*u:d;return L.unshift(c),L},originalUnstuff:function(r,s,l,c){var u=(1<<l)-1,d=0,p,f=0,y,v,b,T=r.length*4-Math.ceil(l*c/8);for(r[r.length-1]<<=8*T,p=0;p<c;p++)f===0&&(v=r[d++],f=32),f>=l?(y=v>>>f-l&u,f-=l):(b=l-f,y=(v&u)<<b&u,v=r[d++],f=32-b,y+=v>>>f),s[p]=y;return s},originalUnstuff2:function(r,s,l,c){var u=(1<<l)-1,d=0,p,f=0,y=0,v,b,T;for(p=0;p<c;p++)f===0&&(b=r[d++],f=32,y=0),f>=l?(v=b>>>y&u,f-=l,y+=l):(T=l-f,v=b>>>y&u,b=r[d++],f=32-T,v|=(b&(1<<T)-1)<<l-T,y=T),s[p]=v;return s}},t={HUFFMAN_LUT_BITS_MAX:12,computeChecksumFletcher32:function(r){for(var s=65535,l=65535,c=r.length,u=Math.floor(c/2),d=0;u;){var p=u>=359?359:u;u-=p;do s+=r[d++]<<8,l+=s+=r[d++];while(--p);s=(s&65535)+(s>>>16),l=(l&65535)+(l>>>16)}return c&1&&(l+=s+=r[d]<<8),s=(s&65535)+(s>>>16),l=(l&65535)+(l>>>16),(l<<16|s)>>>0},readHeaderInfo:function(r,s){var l=s.ptr,c=new Uint8Array(r,l,6),u={};if(u.fileIdentifierString=String.fromCharCode.apply(null,c),u.fileIdentifierString.lastIndexOf("Lerc2",0)!==0)throw"Unexpected file identifier string (expect Lerc2 ): "+u.fileIdentifierString;l+=6;var d=new DataView(r,l,8),p=d.getInt32(0,!0);u.fileVersion=p,l+=4,p>=3&&(u.checksum=d.getUint32(4,!0),l+=4),d=new DataView(r,l,12),u.height=d.getUint32(0,!0),u.width=d.getUint32(4,!0),l+=8,p>=4?(u.numDims=d.getUint32(8,!0),l+=4):u.numDims=1,d=new DataView(r,l,40),u.numValidPixel=d.getUint32(0,!0),u.microBlockSize=d.getInt32(4,!0),u.blobSize=d.getInt32(8,!0),u.imageType=d.getInt32(12,!0),u.maxZError=d.getFloat64(16,!0),u.zMin=d.getFloat64(24,!0),u.zMax=d.getFloat64(32,!0),l+=40,s.headerInfo=u,s.ptr=l;var f,y;if(p>=3&&(y=p>=4?52:48,f=this.computeChecksumFletcher32(new Uint8Array(r,l-y,u.blobSize-14)),f!==u.checksum))throw"Checksum failed.";return!0},checkMinMaxRanges:function(r,s){var l=s.headerInfo,c=this.getDataTypeArray(l.imageType),u=l.numDims*this.getDataTypeSize(l.imageType),d=this.readSubArray(r,s.ptr,c,u),p=this.readSubArray(r,s.ptr+u,c,u);s.ptr+=2*u;var f,y=!0;for(f=0;f<l.numDims;f++)if(d[f]!==p[f]){y=!1;break}return l.minValues=d,l.maxValues=p,y},readSubArray:function(r,s,l,c){var u;if(l===Uint8Array)u=new Uint8Array(r,s,c);else{var d=new ArrayBuffer(c),p=new Uint8Array(d);p.set(new Uint8Array(r,s,c)),u=new l(d)}return u},readMask:function(r,s){var l=s.ptr,c=s.headerInfo,u=c.width*c.height,d=c.numValidPixel,p=new DataView(r,l,4),f={};if(f.numBytes=p.getUint32(0,!0),l+=4,(d===0||u===d)&&f.numBytes!==0)throw"invalid mask";var y,v;if(d===0)y=new Uint8Array(Math.ceil(u/8)),f.bitset=y,v=new Uint8Array(u),s.pixels.resultMask=v,l+=f.numBytes;else if(f.numBytes>0){y=new Uint8Array(Math.ceil(u/8)),p=new DataView(r,l,f.numBytes);var b=p.getInt16(0,!0),T=2,_=0,S=0;do{if(b>0)for(;b--;)y[_++]=p.getUint8(T++);else for(S=p.getUint8(T++),b=-b;b--;)y[_++]=S;b=p.getInt16(T,!0),T+=2}while(T<f.numBytes);if(b!==-32768||_<y.length)throw"Unexpected end of mask RLE encoding";v=new Uint8Array(u);var L=0,I=0;for(I=0;I<u;I++)I&7?(L=y[I>>3],L<<=I&7):L=y[I>>3],L&128&&(v[I]=1);s.pixels.resultMask=v,f.bitset=y,l+=f.numBytes}return s.ptr=l,s.mask=f,!0},readDataOneSweep:function(r,s,l,c){var u=s.ptr,d=s.headerInfo,p=d.numDims,f=d.width*d.height,y=d.imageType,v=d.numValidPixel*t.getDataTypeSize(y)*p,b,T=s.pixels.resultMask;if(l===Uint8Array)b=new Uint8Array(r,u,v);else{var _=new ArrayBuffer(v),S=new Uint8Array(_);S.set(new Uint8Array(r,u,v)),b=new l(_)}if(b.length===f*p)c?s.pixels.resultPixels=t.swapDimensionOrder(b,f,p,l,!0):s.pixels.resultPixels=b;else{s.pixels.resultPixels=new l(f*p);var L=0,I=0,F=0,K=0;if(p>1){if(c){for(I=0;I<f;I++)if(T[I])for(K=I,F=0;F<p;F++,K+=f)s.pixels.resultPixels[K]=b[L++]}else for(I=0;I<f;I++)if(T[I])for(K=I*p,F=0;F<p;F++)s.pixels.resultPixels[K+F]=b[L++]}else for(I=0;I<f;I++)T[I]&&(s.pixels.resultPixels[I]=b[L++])}return u+=v,s.ptr=u,!0},readHuffmanTree:function(r,s){var l=this.HUFFMAN_LUT_BITS_MAX,c=new DataView(r,s.ptr,16);s.ptr+=16;var u=c.getInt32(0,!0);if(u<2)throw"unsupported Huffman version";var d=c.getInt32(4,!0),p=c.getInt32(8,!0),f=c.getInt32(12,!0);if(p>=f)return!1;var y=new Uint32Array(f-p);t.decodeBits(r,s,y);var v=[],b,T,_,S;for(b=p;b<f;b++)T=b-(b<d?0:d),v[T]={first:y[b-p],second:null};var L=r.byteLength-s.ptr,I=Math.ceil(L/4),F=new ArrayBuffer(I*4),K=new Uint8Array(F);K.set(new Uint8Array(r,s.ptr,L));var D=new Uint32Array(F),O=0,V,R=0;for(V=D[0],b=p;b<f;b++)T=b-(b<d?0:d),S=v[T].first,S>0&&(v[T].second=V<<O>>>32-S,32-O>=S?(O+=S,O===32&&(O=0,R++,V=D[R])):(O+=S-32,R++,V=D[R],v[T].second|=V>>>32-O));var P=0,k=0,N=new e;for(b=0;b<v.length;b++)v[b]!==void 0&&(P=Math.max(P,v[b].first));P>=l?k=l:k=P;var H=[],Q,q,J,oe,ie,te;for(b=p;b<f;b++)if(T=b-(b<d?0:d),S=v[T].first,S>0)if(Q=[S,T],S<=k)for(q=v[T].second<<k-S,J=1<<k-S,_=0;_<J;_++)H[q|_]=Q;else for(q=v[T].second,te=N,oe=S-1;oe>=0;oe--)ie=q>>>oe&1,ie?(te.right||(te.right=new e),te=te.right):(te.left||(te.left=new e),te=te.left),oe===0&&!te.val&&(te.val=Q[1]);return{decodeLut:H,numBitsLUTQick:k,numBitsLUT:P,tree:N,stuffedData:D,srcPtr:R,bitPos:O}},readHuffman:function(r,s,l,c){var u=s.headerInfo,d=u.numDims,p=s.headerInfo.height,f=s.headerInfo.width,y=f*p,v=this.readHuffmanTree(r,s),b=v.decodeLut,T=v.tree,_=v.stuffedData,S=v.srcPtr,L=v.bitPos,I=v.numBitsLUTQick,F=v.numBitsLUT,K=s.headerInfo.imageType===0?128:0,D,O,V,R=s.pixels.resultMask,P,k,N,H,Q,q,J,oe=0;L>0&&(S++,L=0);var ie=_[S],te=s.encodeMode===1,me=new l(y*d),xe=me,he;if(d<2||te){for(he=0;he<d;he++)if(d>1&&(xe=new l(me.buffer,y*he,y),oe=0),s.headerInfo.numValidPixel===f*p)for(q=0,H=0;H<p;H++)for(Q=0;Q<f;Q++,q++){if(O=0,P=ie<<L>>>32-I,k=P,32-L<I&&(P|=_[S+1]>>>64-L-I,k=P),b[k])O=b[k][1],L+=b[k][0];else for(P=ie<<L>>>32-F,k=P,32-L<F&&(P|=_[S+1]>>>64-L-F,k=P),D=T,J=0;J<F;J++)if(N=P>>>F-J-1&1,D=N?D.right:D.left,!(D.left||D.right)){O=D.val,L=L+J+1;break}L>=32&&(L-=32,S++,ie=_[S]),V=O-K,te?(Q>0?V+=oe:H>0?V+=xe[q-f]:V+=oe,V&=255,xe[q]=V,oe=V):xe[q]=V}else for(q=0,H=0;H<p;H++)for(Q=0;Q<f;Q++,q++)if(R[q]){if(O=0,P=ie<<L>>>32-I,k=P,32-L<I&&(P|=_[S+1]>>>64-L-I,k=P),b[k])O=b[k][1],L+=b[k][0];else for(P=ie<<L>>>32-F,k=P,32-L<F&&(P|=_[S+1]>>>64-L-F,k=P),D=T,J=0;J<F;J++)if(N=P>>>F-J-1&1,D=N?D.right:D.left,!(D.left||D.right)){O=D.val,L=L+J+1;break}L>=32&&(L-=32,S++,ie=_[S]),V=O-K,te?(Q>0&&R[q-1]?V+=oe:H>0&&R[q-f]?V+=xe[q-f]:V+=oe,V&=255,xe[q]=V,oe=V):xe[q]=V}}else for(q=0,H=0;H<p;H++)for(Q=0;Q<f;Q++)if(q=H*f+Q,!R||R[q])for(he=0;he<d;he++,q+=y){if(O=0,P=ie<<L>>>32-I,k=P,32-L<I&&(P|=_[S+1]>>>64-L-I,k=P),b[k])O=b[k][1],L+=b[k][0];else for(P=ie<<L>>>32-F,k=P,32-L<F&&(P|=_[S+1]>>>64-L-F,k=P),D=T,J=0;J<F;J++)if(N=P>>>F-J-1&1,D=N?D.right:D.left,!(D.left||D.right)){O=D.val,L=L+J+1;break}L>=32&&(L-=32,S++,ie=_[S]),V=O-K,xe[q]=V}s.ptr=s.ptr+(S+1)*4+(L>0?4:0),s.pixels.resultPixels=me,d>1&&!c&&(s.pixels.resultPixels=t.swapDimensionOrder(me,y,d,l))},decodeBits:function(r,s,l,c,u){{var d=s.headerInfo,p=d.fileVersion,f=0,y=r.byteLength-s.ptr>=5?5:r.byteLength-s.ptr,v=new DataView(r,s.ptr,y),b=v.getUint8(0);f++;var T=b>>6,_=T===0?4:3-T,S=(b&32)>0,L=b&31,I=0;if(_===1)I=v.getUint8(f),f++;else if(_===2)I=v.getUint16(f,!0),f+=2;else if(_===4)I=v.getUint32(f,!0),f+=4;else throw"Invalid valid pixel count type";var F=2*d.maxZError,K,D,O,V,R,P,k,N,H,Q=d.numDims>1?d.maxValues[u]:d.zMax;if(S){for(s.counter.lut++,N=v.getUint8(f),f++,V=Math.ceil((N-1)*L/8),R=Math.ceil(V/4),D=new ArrayBuffer(R*4),O=new Uint8Array(D),s.ptr+=f,O.set(new Uint8Array(r,s.ptr,V)),k=new Uint32Array(D),s.ptr+=V,H=0;N-1>>>H;)H++;V=Math.ceil(I*H/8),R=Math.ceil(V/4),D=new ArrayBuffer(R*4),O=new Uint8Array(D),O.set(new Uint8Array(r,s.ptr,V)),K=new Uint32Array(D),s.ptr+=V,p>=3?P=a.unstuffLUT2(k,L,N-1,c,F,Q):P=a.unstuffLUT(k,L,N-1,c,F,Q),p>=3?a.unstuff2(K,l,H,I,P):a.unstuff(K,l,H,I,P)}else s.counter.bitstuffer++,H=L,s.ptr+=f,H>0&&(V=Math.ceil(I*H/8),R=Math.ceil(V/4),D=new ArrayBuffer(R*4),O=new Uint8Array(D),O.set(new Uint8Array(r,s.ptr,V)),K=new Uint32Array(D),s.ptr+=V,p>=3?c==null?a.originalUnstuff2(K,l,H,I):a.unstuff2(K,l,H,I,!1,c,F,Q):c==null?a.originalUnstuff(K,l,H,I):a.unstuff(K,l,H,I,!1,c,F,Q))}},readTiles:function(r,s,l,c){var u=s.headerInfo,d=u.width,p=u.height,f=d*p,y=u.microBlockSize,v=u.imageType,b=t.getDataTypeSize(v),T=Math.ceil(d/y),_=Math.ceil(p/y);s.pixels.numBlocksY=_,s.pixels.numBlocksX=T,s.pixels.ptr=0;var S=0,L=0,I=0,F=0,K=0,D=0,O=0,V=0,R=0,P=0,k=0,N=0,H=0,Q=0,q=0,J=0,oe,ie,te,me,xe,he,ve=new l(y*y),ke=p%y||y,Ye=d%y||y,je,Je,Qe=u.numDims,ct,pt=s.pixels.resultMask,Ue=s.pixels.resultPixels,hn=u.fileVersion,Gn=hn>=5?14:15,Ae,Ut=u.zMax,Wt;for(I=0;I<_;I++)for(K=I!==_-1?y:ke,F=0;F<T;F++)for(D=F!==T-1?y:Ye,k=I*d*y+F*y,N=d-D,ct=0;ct<Qe;ct++){if(Qe>1?(Wt=Ue,k=I*d*y+F*y,Ue=new l(s.pixels.resultPixels.buffer,f*ct*b,f),Ut=u.maxValues[ct]):Wt=null,O=r.byteLength-s.ptr,oe=new DataView(r,s.ptr,Math.min(10,O)),ie={},J=0,V=oe.getUint8(0),J++,Ae=u.fileVersion>=5?V&4:0,R=V>>6&255,P=V>>2&Gn,P!==(F*y>>3&Gn)||Ae&&ct===0)throw"integrity issue";if(he=V&3,he>3)throw s.ptr+=J,"Invalid block encoding ("+he+")";if(he===2){if(Ae)if(pt)for(S=0;S<K;S++)for(L=0;L<D;L++)pt[k]&&(Ue[k]=Wt[k]),k++;else for(S=0;S<K;S++)for(L=0;L<D;L++)Ue[k]=Wt[k],k++;s.counter.constant++,s.ptr+=J;continue}else if(he===0){if(Ae)throw"integrity issue";if(s.counter.uncompressed++,s.ptr+=J,H=K*D*b,Q=r.byteLength-s.ptr,H=H<Q?H:Q,te=new ArrayBuffer(H%b===0?H:H+b-H%b),me=new Uint8Array(te),me.set(new Uint8Array(r,s.ptr,H)),xe=new l(te),q=0,pt)for(S=0;S<K;S++){for(L=0;L<D;L++)pt[k]&&(Ue[k]=xe[q++]),k++;k+=N}else for(S=0;S<K;S++){for(L=0;L<D;L++)Ue[k++]=xe[q++];k+=N}s.ptr+=q*b}else if(je=t.getDataTypeUsed(Ae&&v<6?4:v,R),Je=t.getOnePixel(ie,J,je,oe),J+=t.getDataTypeSize(je),he===3)if(s.ptr+=J,s.counter.constantoffset++,pt)for(S=0;S<K;S++){for(L=0;L<D;L++)pt[k]&&(Ue[k]=Ae?Math.min(Ut,Wt[k]+Je):Je),k++;k+=N}else for(S=0;S<K;S++){for(L=0;L<D;L++)Ue[k]=Ae?Math.min(Ut,Wt[k]+Je):Je,k++;k+=N}else if(s.ptr+=J,t.decodeBits(r,s,ve,Je,ct),J=0,Ae)if(pt)for(S=0;S<K;S++){for(L=0;L<D;L++)pt[k]&&(Ue[k]=ve[J++]+Wt[k]),k++;k+=N}else for(S=0;S<K;S++){for(L=0;L<D;L++)Ue[k]=ve[J++]+Wt[k],k++;k+=N}else if(pt)for(S=0;S<K;S++){for(L=0;L<D;L++)pt[k]&&(Ue[k]=ve[J++]),k++;k+=N}else for(S=0;S<K;S++){for(L=0;L<D;L++)Ue[k++]=ve[J++];k+=N}}Qe>1&&!c&&(s.pixels.resultPixels=t.swapDimensionOrder(s.pixels.resultPixels,f,Qe,l))},formatFileInfo:function(r){return{fileIdentifierString:r.headerInfo.fileIdentifierString,fileVersion:r.headerInfo.fileVersion,imageType:r.headerInfo.imageType,height:r.headerInfo.height,width:r.headerInfo.width,numValidPixel:r.headerInfo.numValidPixel,microBlockSize:r.headerInfo.microBlockSize,blobSize:r.headerInfo.blobSize,maxZError:r.headerInfo.maxZError,pixelType:t.getPixelType(r.headerInfo.imageType),eofOffset:r.eofOffset,mask:r.mask?{numBytes:r.mask.numBytes}:null,pixels:{numBlocksX:r.pixels.numBlocksX,numBlocksY:r.pixels.numBlocksY,maxValue:r.headerInfo.zMax,minValue:r.headerInfo.zMin,noDataValue:r.noDataValue}}},constructConstantSurface:function(r,s){var l=r.headerInfo.zMax,c=r.headerInfo.zMin,u=r.headerInfo.maxValues,d=r.headerInfo.numDims,p=r.headerInfo.height*r.headerInfo.width,f=0,y=0,v=0,b=r.pixels.resultMask,T=r.pixels.resultPixels;if(b)if(d>1){if(s)for(f=0;f<d;f++)for(v=f*p,l=u[f],y=0;y<p;y++)b[y]&&(T[v+y]=l);else for(y=0;y<p;y++)if(b[y])for(v=y*d,f=0;f<d;f++)T[v+d]=u[f]}else for(y=0;y<p;y++)b[y]&&(T[y]=l);else if(d>1&&c!==l)if(s)for(f=0;f<d;f++)for(v=f*p,l=u[f],y=0;y<p;y++)T[v+y]=l;else for(y=0;y<p;y++)for(v=y*d,f=0;f<d;f++)T[v+f]=u[f];else for(y=0;y<p*d;y++)T[y]=l},getDataTypeArray:function(r){var s;switch(r){case 0:s=Int8Array;break;case 1:s=Uint8Array;break;case 2:s=Int16Array;break;case 3:s=Uint16Array;break;case 4:s=Int32Array;break;case 5:s=Uint32Array;break;case 6:s=Float32Array;break;case 7:s=Float64Array;break;default:s=Float32Array}return s},getPixelType:function(r){var s;switch(r){case 0:s="S8";break;case 1:s="U8";break;case 2:s="S16";break;case 3:s="U16";break;case 4:s="S32";break;case 5:s="U32";break;case 6:s="F32";break;case 7:s="F64";break;default:s="F32"}return s},isValidPixelValue:function(r,s){if(s==null)return!1;var l;switch(r){case 0:l=s>=-128&&s<=127;break;case 1:l=s>=0&&s<=255;break;case 2:l=s>=-32768&&s<=32767;break;case 3:l=s>=0&&s<=65536;break;case 4:l=s>=-2147483648&&s<=2147483647;break;case 5:l=s>=0&&s<=4294967296;break;case 6:l=s>=-34027999387901484e22&&s<=34027999387901484e22;break;case 7:l=s>=-17976931348623157e292&&s<=17976931348623157e292;break;default:l=!1}return l},getDataTypeSize:function(r){var s=0;switch(r){case 0:case 1:s=1;break;case 2:case 3:s=2;break;case 4:case 5:case 6:s=4;break;case 7:s=8;break;default:s=r}return s},getDataTypeUsed:function(r,s){var l=r;switch(r){case 2:case 4:l=r-s;break;case 3:case 5:l=r-2*s;break;case 6:s===0?l=r:s===1?l=2:l=1;break;case 7:s===0?l=r:l=r-2*s+1;break;default:l=r;break}return l},getOnePixel:function(r,s,l,c){var u=0;switch(l){case 0:u=c.getInt8(s);break;case 1:u=c.getUint8(s);break;case 2:u=c.getInt16(s,!0);break;case 3:u=c.getUint16(s,!0);break;case 4:u=c.getInt32(s,!0);break;case 5:u=c.getUInt32(s,!0);break;case 6:u=c.getFloat32(s,!0);break;case 7:u=c.getFloat64(s,!0);break;default:throw"the decoder does not understand this pixel type"}return u},swapDimensionOrder:function(r,s,l,c,u){var d=0,p=0,f=0,y=0,v=r;if(l>1)if(v=new c(s*l),u)for(d=0;d<s;d++)for(y=d,f=0;f<l;f++,y+=s)v[y]=r[p++];else for(d=0;d<s;d++)for(y=d,f=0;f<l;f++,y+=s)v[p++]=r[y];return v}},e=function(r,s,l){this.val=r,this.left=s,this.right=l},n={decode:function(r,s){s=s||{};var l=s.noDataValue,c=0,u={};if(u.ptr=s.inputOffset||0,u.pixels={},!!t.readHeaderInfo(r,u)){var d=u.headerInfo,p=d.fileVersion,f=t.getDataTypeArray(d.imageType);if(p>5)throw"unsupported lerc version 2."+p;t.readMask(r,u),d.numValidPixel!==d.width*d.height&&!u.pixels.resultMask&&(u.pixels.resultMask=s.maskData);var y=d.width*d.height;u.pixels.resultPixels=new f(y*d.numDims),u.counter={onesweep:0,uncompressed:0,lut:0,bitstuffer:0,constant:0,constantoffset:0};var v=!s.returnPixelInterleavedDims;if(d.numValidPixel!==0)if(d.zMax===d.zMin)t.constructConstantSurface(u,v);else if(p>=4&&t.checkMinMaxRanges(r,u))t.constructConstantSurface(u,v);else{var b=new DataView(r,u.ptr,2),T=b.getUint8(0);if(u.ptr++,T)t.readDataOneSweep(r,u,f,v);else if(p>1&&d.imageType<=1&&Math.abs(d.maxZError-.5)<1e-5){var _=b.getUint8(1);if(u.ptr++,u.encodeMode=_,_>2||p<4&&_>1)throw"Invalid Huffman flag "+_;_?t.readHuffman(r,u,f,v):t.readTiles(r,u,f,v)}else t.readTiles(r,u,f,v)}u.eofOffset=u.ptr;var S;s.inputOffset?(S=u.headerInfo.blobSize+s.inputOffset-u.ptr,Math.abs(S)>=1&&(u.eofOffset=s.inputOffset+u.headerInfo.blobSize)):(S=u.headerInfo.blobSize-u.ptr,Math.abs(S)>=1&&(u.eofOffset=u.headerInfo.blobSize));var L={width:d.width,height:d.height,pixelData:u.pixels.resultPixels,minValue:d.zMin,maxValue:d.zMax,validPixelCount:d.numValidPixel,dimCount:d.numDims,dimStats:{minValues:d.minValues,maxValues:d.maxValues},maskData:u.pixels.resultMask};if(u.pixels.resultMask&&t.isValidPixelValue(d.imageType,l)){var I=u.pixels.resultMask;for(c=0;c<y;c++)I[c]||(L.pixelData[c]=l);L.noDataValue=l}return u.noDataValue=l,s.returnFileInfo&&(L.fileInfo=t.formatFileInfo(u)),L}},getBandCount:function(r){var s=0,l=0,c={};for(c.ptr=0,c.pixels={};l<r.byteLength-58;)t.readHeaderInfo(r,c),l+=c.headerInfo.blobSize,s++,c.ptr=l;return s}};return n}();var tm=function(){var a=new ArrayBuffer(4),t=new Uint8Array(a),e=new Uint32Array(a);return e[0]=1,t[0]===1}(),nm={decode:function(a,t){if(!tm)throw"Big endian system is not supported.";t=t||{};var e=t.inputOffset||0,n=new Uint8Array(a,e,10),r=String.fromCharCode.apply(null,n),s,l;if(r.trim()==="CntZImage")s=$p,l=1;else if(r.substring(0,5)==="Lerc2")s=em,l=2;else throw"Unexpected file identifier string: "+r;for(var c=0,u=a.byteLength-10,d,p=[],f,y,v={width:0,height:0,pixels:[],pixelType:t.pixelType,mask:null,statistics:[]},b=0;e<u;){var T=s.decode(a,{inputOffset:e,encodedMaskData:d,maskData:y,returnMask:c===0,returnEncodedMask:c===0,returnFileInfo:!0,returnPixelInterleavedDims:t.returnPixelInterleavedDims,pixelType:t.pixelType||null,noDataValue:t.noDataValue||null});e=T.fileInfo.eofOffset,y=T.maskData,c===0&&(d=T.encodedMaskData,v.width=T.width,v.height=T.height,v.dimCount=T.dimCount||1,v.pixelType=T.pixelType||T.fileInfo.pixelType,v.mask=y),l>1&&(y&&p.push(y),T.fileInfo.mask&&T.fileInfo.mask.numBytes>0&&b++),c++,v.pixels.push(T.pixelData),v.statistics.push({minValue:T.minValue,maxValue:T.maxValue,noDataValue:T.noDataValue,dimStats:T.dimStats})}var _,S,L;if(l>1&&b>1){for(L=v.width*v.height,v.bandMasks=p,y=new Uint8Array(L),y.set(p[0]),_=1;_<p.length;_++)for(f=p[_],S=0;S<L;S++)y[S]=y[S]&f[S];v.maskData=y}return v}};const rm={0:7e3,1:6e3,2:5e3,3:4e3,4:3e3,5:2500,6:2e3,7:1500,8:800,9:500,10:200,11:100,12:40,13:12,14:5,15:2,16:1,17:.5,18:.2,19:.1,20:.01};function im(a){const{height:t,width:e,pixels:n}=nm.decode(a),r=new Float32Array(t*e);for(let s=0;s<r.length;s++)r[s]=n[0][s];return{array:r,width:e,height:t}}function sm(a,t,e){let n=im(a);e[2]-e[0]<1&&(n=om(n,e));const{array:r,width:s}=n,c=new Ul(s).createTile(r),u=rm[t]||0;return c.getGeometryData(u)}function om(a,t){function e(c,u,d,p,f,y,v,b){const T=new Float32Array(f*y);for(let S=0;S<y;S++)for(let L=0;L<f;L++){const I=(S+p)*u+(L+d),F=S*f+L;T[F]=c[I]}const _=new Float32Array(b*v);for(let S=0;S<b;S++)for(let L=0;L<v;L++){const I=S*b+L,F=Math.round(L*y/b),D=Math.round(S*f/v)*f+F;_[I]=T[D]}return _}const n=am(t,a.width),r=n.sw+1,s=n.sh+1;return{array:e(a.array,a.width,n.sx,n.sy,n.sw,n.sh,r,s),width:r,height:s}}function am(a,t){const e=Math.floor(a[0]*t),n=Math.floor(a[1]*t),r=Math.floor((a[2]-a[0])*t),s=Math.floor((a[3]-a[1])*t);return{sx:e,sy:n,sw:r,sh:s}}const lm=10;class cm extends co{constructor(){super();G(this,"info",{version:"0.10.0",description:"Tile LERC terrain loader. It can load ArcGis-lerc format terrain data."});G(this,"dataType","lerc");G(this,"fileLoader",new m.FileLoader(Xe.manager));G(this,"_workerPool",new qs(0));this.fileLoader.setResponseType("arraybuffer"),this._workerPool.setWorkerCreator(()=>new qp)}async doLoad(e,n){this._workerPool.pool===0&&this._workerPool.setWorkerLimit(lm);const{z:r,bounds:s}=n,l=await this.fileLoader.loadAsync(e).catch(()=>new Float32Array(256*256)),c=sm(l,r,s);return new dr().setData(c)}}po(new cm);const Ql="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGModCl7cmV0dXJuIGEodC5kYXRhKX1mdW5jdGlvbiBhKHQpe2Z1bmN0aW9uIG4oZSx1KXtjb25zdCByPXUqNCxbaSxmLGcsbF09ZS5zbGljZShyLHIrNCk7cmV0dXJuIGw9PT0wPzA6LTFlNCsoaTw8MTZ8Zjw8OHxnKSouMX1jb25zdCBvPXQubGVuZ3RoPj4+MixzPW5ldyBGbG9hdDMyQXJyYXkobyk7Zm9yKGxldCBlPTA7ZTxvO2UrKylzW2VdPW4odCxlKTtyZXR1cm4gc31zZWxmLm9ubWVzc2FnZT10PT57Y29uc3Qgbj1jKHQuZGF0YS5pbWdEYXRhKTtzZWxmLnBvc3RNZXNzYWdlKG4pfX0pKCk7Cg==",um=a=>Uint8Array.from(atob(a),t=>t.charCodeAt(0)),Hl=typeof self<"u"&&self.Blob&&new Blob([um(Ql)],{type:"text/javascript;charset=utf-8"});function hm(a){let t;try{if(t=Hl&&(self.URL||self.webkitURL).createObjectURL(Hl),!t)throw"";const e=new Worker(t,{name:a?.name});return e.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),e}catch{return new Worker("data:text/javascript;base64,"+Ql,{name:a?.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}const dm=10;class fm extends co{constructor(){super();G(this,"info",{version:"0.10.0",description:"Mapbox-RGB terrain loader, It can load Mapbox-RGB terrain data."});G(this,"dataType","terrain-rgb");G(this,"imageLoader",new m.ImageLoader(Xe.manager));G(this,"_workerPool",new qs(0));this._workerPool.setWorkerCreator(()=>new hm)}async doLoad(e,n){const r=await this.imageLoader.loadAsync(e).catch(d=>new Image),s=m.MathUtils.clamp((n.z+2)*3,2,64),l=pm(r,n.bounds,s);let c;this._workerPool.pool===0&&this._workerPool.setWorkerLimit(dm),c=(await this._workerPool.postMessage({imgData:l},[l.data.buffer])).data;const u=new dr;return u.setData(c),u}}function pm(a,t,e){const n=io(t,a.width);e=Math.min(e,n.sw);const s=new OffscreenCanvas(e,e).getContext("2d");return s.imageSmoothingEnabled=!1,s.drawImage(a,n.sx,n.sy,n.sw,n.sh,0,0,e,e),s.getImageData(0,0,e,e)}po(new fm);function Tn(a,t){this.x=a,this.y=t}Tn.prototype={clone(){return new Tn(this.x,this.y)},add(a){return this.clone()._add(a)},sub(a){return this.clone()._sub(a)},multByPoint(a){return this.clone()._multByPoint(a)},divByPoint(a){return this.clone()._divByPoint(a)},mult(a){return this.clone()._mult(a)},div(a){return this.clone()._div(a)},rotate(a){return this.clone()._rotate(a)},rotateAround(a,t){return this.clone()._rotateAround(a,t)},matMult(a){return this.clone()._matMult(a)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(a){return this.x===a.x&&this.y===a.y},dist(a){return Math.sqrt(this.distSqr(a))},distSqr(a){const t=a.x-this.x,e=a.y-this.y;return t*t+e*e},angle(){return Math.atan2(this.y,this.x)},angleTo(a){return Math.atan2(this.y-a.y,this.x-a.x)},angleWith(a){return this.angleWithSep(a.x,a.y)},angleWithSep(a,t){return Math.atan2(this.x*t-this.y*a,this.x*a+this.y*t)},_matMult(a){const t=a[0]*this.x+a[1]*this.y,e=a[2]*this.x+a[3]*this.y;return this.x=t,this.y=e,this},_add(a){return this.x+=a.x,this.y+=a.y,this},_sub(a){return this.x-=a.x,this.y-=a.y,this},_mult(a){return this.x*=a,this.y*=a,this},_div(a){return this.x/=a,this.y/=a,this},_multByPoint(a){return this.x*=a.x,this.y*=a.y,this},_divByPoint(a){return this.x/=a.x,this.y/=a.y,this},_unit(){return this._div(this.mag()),this},_perp(){const a=this.y;return this.y=this.x,this.x=-a,this},_rotate(a){const t=Math.cos(a),e=Math.sin(a),n=t*this.x-e*this.y,r=e*this.x+t*this.y;return this.x=n,this.y=r,this},_rotateAround(a,t){const e=Math.cos(a),n=Math.sin(a),r=t.x+e*(this.x-t.x)-n*(this.y-t.y),s=t.y+n*(this.x-t.x)+e*(this.y-t.y);return this.x=r,this.y=s,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Tn},Tn.convert=function(a){if(a instanceof Tn)return a;if(Array.isArray(a))return new Tn(+a[0],+a[1]);if(a.x!==void 0&&a.y!==void 0)return new Tn(+a.x,+a.y);throw new Error("Expected [x, y] or {x, y} point format")};class El{constructor(t,e,n,r,s){this.properties={},this.extent=n,this.type=0,this.id=void 0,this._pbf=t,this._geometry=-1,this._keys=r,this._values=s,t.readFields(mm,this,e)}loadGeometry(){const t=this._pbf;t.pos=this._geometry;const e=t.readVarint()+t.pos,n=[];let r,s=1,l=0,c=0,u=0;for(;t.pos<e;){if(l<=0){const d=t.readVarint();s=d&7,l=d>>3}if(l--,s===1||s===2)c+=t.readSVarint(),u+=t.readSVarint(),s===1&&(r&&n.push(r),r=[]),r&&r.push(new Tn(c,u));else if(s===7)r&&r.push(r[0].clone());else throw new Error(`unknown command ${s}`)}return r&&n.push(r),n}bbox(){const t=this._pbf;t.pos=this._geometry;const e=t.readVarint()+t.pos;let n=1,r=0,s=0,l=0,c=1/0,u=-1/0,d=1/0,p=-1/0;for(;t.pos<e;){if(r<=0){const f=t.readVarint();n=f&7,r=f>>3}if(r--,n===1||n===2)s+=t.readSVarint(),l+=t.readSVarint(),s<c&&(c=s),s>u&&(u=s),l<d&&(d=l),l>p&&(p=l);else if(n!==7)throw new Error(`unknown command ${n}`)}return[c,d,u,p]}toGeoJSON(t,e,n){const r=this.extent*Math.pow(2,n),s=this.extent*t,l=this.extent*e,c=this.loadGeometry();function u(y){return[(y.x+s)*360/r-180,360/Math.PI*Math.atan(Math.exp((1-(y.y+l)*2/r)*Math.PI))-90]}function d(y){return y.map(u)}let p;if(this.type===1){const y=[];for(const b of c)y.push(b[0]);const v=d(y);p=y.length===1?{type:"Point",coordinates:v[0]}:{type:"MultiPoint",coordinates:v}}else if(this.type===2){const y=c.map(d);p=y.length===1?{type:"LineString",coordinates:y[0]}:{type:"MultiLineString",coordinates:y}}else if(this.type===3){const y=ym(c),v=[];for(const b of y)v.push(b.map(d));p=v.length===1?{type:"Polygon",coordinates:v[0]}:{type:"MultiPolygon",coordinates:v}}else throw new Error("unknown feature type");const f={type:"Feature",geometry:p,properties:this.properties};return this.id!=null&&(f.id=this.id),f}}El.types=["Unknown","Point","LineString","Polygon"];function mm(a,t,e){a===1?t.id=e.readVarint():a===2?gm(e,t):a===3?t.type=e.readVarint():a===4&&(t._geometry=e.pos)}function gm(a,t){const e=a.readVarint()+a.pos;for(;a.pos<e;){const n=t._keys[a.readVarint()],r=t._values[a.readVarint()];t.properties[n]=r}}function ym(a){const t=a.length;if(t<=1)return[a];const e=[];let n,r;for(let s=0;s<t;s++){const l=vm(a[s]);l!==0&&(r===void 0&&(r=l<0),r===l<0?(n&&e.push(n),n=[a[s]]):n&&n.push(a[s]))}return n&&e.push(n),e}function vm(a){let t=0;for(let e=0,n=a.length,r=n-1,s,l;e<n;r=e++)s=a[e],l=a[r],t+=(l.x-s.x)*(s.y+l.y);return t}let wm=class{constructor(t,e){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(bm,this,e),this.length=this._features.length}feature(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];const e=this._pbf.readVarint()+this._pbf.pos;return new El(this._pbf,e,this.extent,this._keys,this._values)}};function bm(a,t,e){a===15?t.version=e.readVarint():a===1?t.name=e.readString():a===5?t.extent=e.readVarint():a===2?t._features.push(e.pos):a===3?t._keys.push(e.readString()):a===4&&t._values.push(xm(e))}function xm(a){let t=null;const e=a.readVarint()+a.pos;for(;a.pos<e;){const n=a.readVarint()>>3;t=n===1?a.readString():n===2?a.readFloat():n===3?a.readDouble():n===4?a.readVarint64():n===5?a.readVarint():n===6?a.readSVarint():n===7?a.readBoolean():null}if(t==null)throw new Error("unknown feature value");return t}class _m{constructor(t,e){this.layers=t.readFields(Mm,{},e)}}function Mm(a,t,e){if(a===3){const n=new wm(e,e.readVarint()+e.pos);n.length&&(t[n.name]=n)}}const mo=65536*65536,ql=1/mo,Lm=12,$l=typeof TextDecoder>"u"?null:new TextDecoder("utf-8"),go=0,Wi=1,Nr=2,Pi=5;class Sm{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(t,e,n=this.length){for(;this.pos<n;){const r=this.readVarint(),s=r>>3,l=this.pos;this.type=r&7,t(s,e,this),this.pos===l&&this.skip(r)}return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*mo;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*mo;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const e=this.buf;let n,r;return r=e[this.pos++],n=r&127,r<128||(r=e[this.pos++],n|=(r&127)<<7,r<128)||(r=e[this.pos++],n|=(r&127)<<14,r<128)||(r=e[this.pos++],n|=(r&127)<<21,r<128)?n:(r=e[this.pos],n|=(r&15)<<28,Tm(n,t,this))}readVarint64(){return this.readVarint(!0)}readSVarint(){const t=this.readVarint();return t%2===1?(t+1)/-2:t/2}readBoolean(){return!!this.readVarint()}readString(){const t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=Lm&&$l?$l.decode(this.buf.subarray(e,t)):zm(this.buf,e,t)}readBytes(){const t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){const n=this.readPackedEnd();for(;this.pos<n;)t.push(this.readVarint(e));return t}readPackedSVarint(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFloat());return t}readPackedDouble(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed64());return t}readPackedEnd(){return this.type===Nr?this.readVarint()+this.pos:this.pos+1}skip(t){const e=t&7;if(e===go)for(;this.buf[this.pos++]>127;);else if(e===Nr)this.pos=this.readVarint()+this.pos;else if(e===Pi)this.pos+=4;else if(e===Wi)this.pos+=8;else throw new Error(`Unimplemented type: ${e}`)}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e<this.pos+t;)e*=2;if(e!==this.length){const n=new Uint8Array(e);n.set(this.buf),this.buf=n,this.dataView=new DataView(n.buffer),this.length=e}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeSFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,t&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*ql),!0),this.pos+=8}writeSFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,t&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*ql),!0),this.pos+=8}writeVarint(t){if(t=+t||0,t>268435455||t<0){Gm(t,this);return}this.realloc(4),this.buf[this.pos++]=t&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=t>>>7&127)))}writeSVarint(t){this.writeVarint(t<0?-t*2-1:t*2)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(t.length*4),this.pos++;const e=this.pos;this.pos=Om(this.buf,t,this.pos);const n=this.pos-e;n>=128&&ec(e,n,this),this.pos=e-1,this.writeVarint(n),this.pos+=n}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){const e=t.length;this.writeVarint(e),this.realloc(e);for(let n=0;n<e;n++)this.buf[this.pos++]=t[n]}writeRawMessage(t,e){this.pos++;const n=this.pos;t(e,this);const r=this.pos-n;r>=128&&ec(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r}writeMessage(t,e,n){this.writeTag(t,Nr),this.writeRawMessage(e,n)}writePackedVarint(t,e){e.length&&this.writeMessage(t,Wm,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,Pm,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,Am,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,Cm,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,Vm,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,Fm,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,Xm,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,km,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,Dm,e)}writeBytesField(t,e){this.writeTag(t,Nr),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,Pi),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,Pi),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,Wi),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,Wi),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,go),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,go),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,Nr),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,Pi),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,Wi),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}}function Tm(a,t,e){const n=e.buf;let r,s;if(s=n[e.pos++],r=(s&112)>>4,s<128||(s=n[e.pos++],r|=(s&127)<<3,s<128)||(s=n[e.pos++],r|=(s&127)<<10,s<128)||(s=n[e.pos++],r|=(s&127)<<17,s<128)||(s=n[e.pos++],r|=(s&127)<<24,s<128)||(s=n[e.pos++],r|=(s&1)<<31,s<128))return fr(a,r,t);throw new Error("Expected varint not more than 10 bytes")}function fr(a,t,e){return e?t*4294967296+(a>>>0):(t>>>0)*4294967296+(a>>>0)}function Gm(a,t){let e,n;if(a>=0?(e=a%4294967296|0,n=a/4294967296|0):(e=~(-a%4294967296),n=~(-a/4294967296),e^4294967295?e=e+1|0:(e=0,n=n+1|0)),a>=18446744073709552e3||a<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),Zm(e,n,t),Im(n,t)}function Zm(a,t,e){e.buf[e.pos++]=a&127|128,a>>>=7,e.buf[e.pos++]=a&127|128,a>>>=7,e.buf[e.pos++]=a&127|128,a>>>=7,e.buf[e.pos++]=a&127|128,a>>>=7,e.buf[e.pos]=a&127}function Im(a,t){const e=(a&7)<<4;t.buf[t.pos++]|=e|((a>>>=3)?128:0),a&&(t.buf[t.pos++]=a&127|((a>>>=7)?128:0),a&&(t.buf[t.pos++]=a&127|((a>>>=7)?128:0),a&&(t.buf[t.pos++]=a&127|((a>>>=7)?128:0),a&&(t.buf[t.pos++]=a&127|((a>>>=7)?128:0),a&&(t.buf[t.pos++]=a&127)))))}function ec(a,t,e){const n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));e.realloc(n);for(let r=e.pos-1;r>=a;r--)e.buf[r+n]=e.buf[r]}function Wm(a,t){for(let e=0;e<a.length;e++)t.writeVarint(a[e])}function Pm(a,t){for(let e=0;e<a.length;e++)t.writeSVarint(a[e])}function Cm(a,t){for(let e=0;e<a.length;e++)t.writeFloat(a[e])}function Vm(a,t){for(let e=0;e<a.length;e++)t.writeDouble(a[e])}function Am(a,t){for(let e=0;e<a.length;e++)t.writeBoolean(a[e])}function Fm(a,t){for(let e=0;e<a.length;e++)t.writeFixed32(a[e])}function Xm(a,t){for(let e=0;e<a.length;e++)t.writeSFixed32(a[e])}function km(a,t){for(let e=0;e<a.length;e++)t.writeFixed64(a[e])}function Dm(a,t){for(let e=0;e<a.length;e++)t.writeSFixed64(a[e])}function zm(a,t,e){let n="",r=t;for(;r<e;){const s=a[r];let l=null,c=s>239?4:s>223?3:s>191?2:1;if(r+c>e)break;let u,d,p;c===1?s<128&&(l=s):c===2?(u=a[r+1],(u&192)===128&&(l=(s&31)<<6|u&63,l<=127&&(l=null))):c===3?(u=a[r+1],d=a[r+2],(u&192)===128&&(d&192)===128&&(l=(s&15)<<12|(u&63)<<6|d&63,(l<=2047||l>=55296&&l<=57343)&&(l=null))):c===4&&(u=a[r+1],d=a[r+2],p=a[r+3],(u&192)===128&&(d&192)===128&&(p&192)===128&&(l=(s&15)<<18|(u&63)<<12|(d&63)<<6|p&63,(l<=65535||l>=1114112)&&(l=null))),l===null?(l=65533,c=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|l&1023),n+=String.fromCharCode(l),r+=c}return n}function Om(a,t,e){for(let n=0,r,s;n<t.length;n++){if(r=t.charCodeAt(n),r>55295&&r<57344)if(s)if(r<56320){a[e++]=239,a[e++]=191,a[e++]=189,s=r;continue}else r=s-55296<<10|r-56320|65536,s=null;else{r>56319||n+1===t.length?(a[e++]=239,a[e++]=191,a[e++]=189):s=r;continue}else s&&(a[e++]=239,a[e++]=191,a[e++]=189,s=null);r<128?a[e++]=r:(r<2048?a[e++]=r>>6|192:(r<65536?a[e++]=r>>12|224:(a[e++]=r>>18|240,a[e++]=r>>12&63|128),a[e++]=r>>6&63|128),a[e++]=r&63|128)}return e}class Km extends ho{constructor(){super();G(this,"dataType","mvt");G(this,"_loader",new m.FileLoader(Xe.manager));G(this,"_render",new Bl);console.log("MVTLoader constructor"),this._loader.setResponseType("arraybuffer")}async doLoad(e,n){const r=await this._loader.loadAsync(e),s=new _m(new Sm(r)),l=this.drawTile(s,n.source.style,n.z);return console.log("drawTile",l),new m.CanvasTexture(l)}drawTile(e,n,r){const u=new OffscreenCanvas(256,256).getContext("2d");if(u){if(n)for(const d in n.layer){const p=n.layer[d];if(n&&(r<(p.minLevel??1)||r>(p.maxLevel??20)))continue;const f=e.layers[d];if(f){const y=256/f.extent;this._renderLayer(u,f,p,y)}}else for(const d in e.layers){const p=e.layers[d],f=256/p.extent;this._renderLayer(u,p,void 0,f)}return u.canvas}else throw new Error("Canvas context is not available")}_renderLayer(e,n,r,s=1){e.save();for(let l=0;l<n.length;l++){const c=n.feature(l);this._renderFeature(e,c,r,s)}return e.restore(),this}_renderFeature(e,n,r={},s=1){const l=[tt.Unknown,tt.Point,tt.Linestring,tt.Polygon][n.type],c={geometry:n.loadGeometry(),properties:n.properties};this._render.render(e,l,c,r,s)}_convertToGeoJSONFeature(e,n){const r=this._convertGeometryToGeoJSON(e.geometry,n);return r?{type:"Feature",geometry:r,properties:e.properties||{},id:e.id}:null}_convertGeometryToGeoJSON(e,n){switch(n){case tt.Point:return this._convertPointGeometry(e);case tt.Linestring:return this._convertLineGeometry(e);case tt.Polygon:return this._convertPolygonGeometry(e);default:return console.warn("未知的几何类型:",n),null}}_convertPointGeometry(e){const n=[];for(const r of e)for(const s of r)n.push([s.x,s.y]);return n.length===0?null:n.length===1?{type:"Point",coordinates:n[0]}:{type:"MultiPoint",coordinates:n}}_convertLineGeometry(e){const n=[];for(const r of e){const s=[];for(const l of r)s.push([l.x,l.y]);s.length>=2&&n.push(s)}return n.length===0?null:n.length===1?{type:"LineString",coordinates:n[0]}:{type:"MultiLineString",coordinates:n}}_convertPolygonGeometry(e){const n=[];let r=[];for(const s of e){const l=[];for(const c of s)l.push([c.x,c.y]);l.length>=4&&(this._isRingClockwise(l)||r.length===0?(r.length>0&&n.push(r),r=[l]):r.push(l))}return r.length>0&&n.push(r),n.length===0?null:n.length===1?{type:"Polygon",coordinates:n[0]}:{type:"MultiPolygon",coordinates:n}}_isRingClockwise(e){let n=0;for(let r=0;r<e.length-1;r++){const[s,l]=e[r],[c,u]=e[r+1];n+=(c-s)*(u+l)}return n>0}convertVectorTileToGeoJSON(e){const n=[];for(const r in e.layers){const s=e.layers[r];for(let l=0;l<s.length;l++){const c=s.feature(l),u=[tt.Unknown,tt.Point,tt.Linestring,tt.Polygon][c.type],d={geometry:c.loadGeometry(),properties:c.properties},p=this._convertToGeoJSONFeature(d,u);p&&(p.properties._layer=r,n.push(p))}}return{type:"FeatureCollection",features:n}}}fo(new Km);const tc="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IF89MjMyODMwNjQzNjUzODY5NjNlLTI2LG09MTIsUD10eXBlb2YgVG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cigi6Kej5p6Q55+i6YeP55Om54mH5pWw5o2u5pe25Ye66ZSZOiIscyksc319ZnVuY3Rpb24gUShpLHQsZSxyKXtjb25zdCBzPW5ldyBNKGkpLG49bmV3IHoocyksbz17fTtmb3IoY29uc3QgaCBpbiBuLmxheWVycyl7Y29uc3QgYT1uLmxheWVyc1toXSxkPVtdO2ZvcihsZXQgdT0wO3U8YS5sZW5ndGg7dSsrKXtjb25zdCBsPWEuZmVhdHVyZSh1KS50b0dlb0pTT04odCxlLHIpO2QucHVzaChsKX1vW2hdPWR9cmV0dXJuIG99c2VsZi5vbm1lc3NhZ2U9YXN5bmMgaT0+e2NvbnN0IHQ9aS5kYXRhO3RyeXtjb25zdCBlPWF3YWl0IEsodC5hcnJheUJ1ZmZlcix0LngsdC55LHQueik7c2VsZi5wb3N0TWVzc2FnZShlKX1jYXRjaChlKXtjb25zb2xlLmVycm9yKCJXb3JrZXIgTVZUIOino+aekOWksei0pToiLGUpLHNlbGYucG9zdE1lc3NhZ2Uoe2Vycm9yOmUubWVzc2FnZX0pfX19KSgpOwo=",Rm=a=>Uint8Array.from(atob(a),t=>t.charCodeAt(0)),nc=typeof self<"u"&&self.Blob&&new Blob([Rm(tc)],{type:"text/javascript;charset=utf-8"});function Ym(a){let t;try{if(t=nc&&(self.URL||self.webkitURL).createObjectURL(nc),!t)throw"";const e=new Worker(t,{name:a?.name});return e.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),e}catch{return new Worker("data:text/javascript;base64,"+tc,{name:a?.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}const Um=10;class Bm{constructor(){G(this,"info",{version:"1.0.0",description:"Vector Tile loader for Mapbox Vector Tile format. It can load and parse MVT data."});G(this,"dataType","VectorTile");G(this,"fileLoader",new m.FileLoader(Xe.manager));G(this,"_workerPool",new qs(0));this.fileLoader.setResponseType("arraybuffer"),this._workerPool.setWorkerCreator(()=>new Ym)}async load(t){const{source:e,x:n,y:r,z:s}=t,l=typeof e._getUrl=="function"?e._getUrl(n,r,s):this.buildTileUrl(e.url,n,r,s);if(!l)return this.createErrorGeometry(n,r,s,new Error("VectorTileLoader: source._getUrl 返回空 URL"));this._workerPool.pool===0&&this._workerPool.setWorkerLimit(Um);try{const c=await this.fetchVectorData(l),u={arrayBuffer:c,x:n,y:r,z:s},p=(await this._workerPool.postMessage(u,[c])).data;if(p.error)throw new Error(p.error);const f=this.createGeometryWithVectorData(p,t);return Xe.manager.parseEnd(l),f}catch(c){return this.createErrorGeometry(n,r,s,c)}}async fetchVectorData(t){try{const e=await this.fileLoader.loadAsync(t);if(!e||e.byteLength===0)throw new Error("Empty response");return e}catch(e){throw new Error(`Failed to fetch vector tile: ${e.message}`)}}calculateTileBounds(t,e,n){const r=4007501668557849e-8/Math.pow(2,n),s=-20037508342789244e-9+t*r,l=s+r,c=20037508342789244e-9-(e+1)*r,u=c+r;return{min:new m.Vector2(s,c),max:new m.Vector2(l,u),world:new m.Vector2(r,r)}}buildTileUrl(t,e,n,r){return t.replace("{x}",e.toString()).replace("{y}",n.toString()).replace("{z}",r.toString()).replace("{-y}",(Math.pow(2,r)-1-n).toString())}createGeometryWithVectorData(t,e){const n=new dr;return n.userData={vectorData:t,tileInfo:{x:e.x,y:e.y,z:e.z,bounds:e.bounds},metadata:{dataType:"vector-tile",version:"1.0.0",loadedAt:Date.now()}},n}createErrorGeometry(t,e,n,r){const s=new dr;return s.userData={vectorData:{x:t,y:e,z:n,layers:{},totalFeatures:0,bounds:this.calculateTileBounds(t,e,n),error:r.message,timestamp:Date.now(),dataFormat:"error"},tileInfo:{x:t,y:e,z:n,bounds:[0,0,0,0]},metadata:{dataType:"vector-tile-error",error:!0,errorMessage:r.message}},s}unload(t){t.userData?.vectorData&&(t.userData.vectorData=null),t.dispose&&t.dispose()}static getVectorData(t){return t.userData?.vectorData||null}static hasValidVectorData(t){const e=this.getVectorData(t);return e&&!e.error&&e.totalFeatures>0}static getLayerNames(t){const e=this.getVectorData(t);return e?Object.keys(e.layers||{}):[]}static getFeaturesByLayer(t,e){return this.getVectorData(t)?.layers?.[e]?.convertedFeatures||[]}}Nl(new Bm);class rc extends zl{constructor(e,n){super(e,n);G(this,"layerType","vector");G(this,"_tileDataMap",new Map);G(this,"_renderer");G(this,"_style");G(this,"_feaList",[]);G(this,"_collision",!1);G(this,"_renderAltitude",0);if(!n.style)throw new Error("VectorTileLayer 必须提供样式配置");this._style=n.style,this._collision=n.collision||!1,this._featureFilter=n.featureFilter,this._renderAltitude=n.altitude||0,this._rootTile.setDataOnlyMode(!0),this._setupDataModeAndListenersForChildren(),this._setupLifeCycleListeners()}_setupDataModeAndListenersForChildren(){const e=n=>{n!==this._rootTile&&n.setDataOnlyMode(!0),this._addShownListenerToTile(n),this._addUnloadListenerToTile(n)};this._rootTile.addEventListener("tile-created",n=>{const r=n.tile;e(r)}),this._rootTile.traverse(n=>{n.isTile&&e(n)})}_addShownListenerToTile(e){const n=r=>{const s=r.tile,l=`${s.z}-${s.x}-${s.y}`,c=!!this._renderer,u=this._tileDataMap.get(l);c&&u&&this._renderer.processTileData(s,u.data)};e.addEventListener("tile-shown",n)}_addUnloadListenerToTile(e){const n=r=>{const s=r.tile||r.target,l=`${s.z}-${s.x}-${s.y}`;if(this._renderer)try{this._renderer.removeFeaturesByTileKey(l)}catch{}this._tileDataMap.delete(l)};e.addEventListener("unload",n)}setAltitude(e){return super.setAltitude(0),this._renderAltitude=e,this._renderer&&this._renderer.setAltitude(e),this}getAltitude(){return this._renderAltitude}_addHiddenListenerToTile(e){const n=r=>{const s=r.tile,l=`${s.z}-${s.x}-${s.y}`;if(this._renderer)try{this._renderer.hideFeaturesByTileKey(l)}catch{}};e.addEventListener("tile-hidden",n)}_setupLifeCycleListeners(){this._rootTile.addEventListener("tile-loaded",e=>{const n=e.tile,r=`${n.z}-${n.x}-${n.y}`,s=this.getVectorDataFromTile(n);if(!s){console.warn(`[VectorTileLayer] Tile ${r} loaded but has no vector data.`);return}if(s.vectorData?.dataFormat==="mvt"&&this._tileDataMap.set(r,{data:s,tile:n,timestamp:Date.now(),pending:!1}),n.showing&&this._renderer&&s.vectorData?.dataFormat==="mvt")try{this._renderer.processTileData(n,s)}catch{}})}getVectorDataFromTile(e){return!e.geometry||!e.getVectorData()?null:e.getVectorData()}createLoader(){const e=new Ii;return e.vtSource=this.source,e}getVisibleVectorTiles(){const e=[];return this._rootTile.traverse(n=>{if(n.isTile&&n.loaded&&n.inFrustum){const r=`${n.z}-${n.x}-${n.y}`,s=this._tileDataMap.get(r);s&&e.push({tileKey:r,data:s.data,tile:s.tile})}}),e}getAllVectorData(){return new Map(this._tileDataMap)}getVectorData(e,n,r){const s=`${r}-${e}-${n}`,l=this._tileDataMap.get(s);return l?l.data:null}setFeatureFilter(e){this._featureFilter=e,this._renderer&&this._renderer.setFeatureFilter(e)}clearFeatureFilter(){this._featureFilter=void 0,this._renderer&&this._renderer.clearFeatureFilter()}setOpacity(e){this.opacity=e,this._renderer&&this._renderer.setOpacity(e)}update(e){!this.enabled||!this.visible||super.update(e)}dispose(){this._renderer&&this._renderer.dispose(),super.dispose()}_setRenderer(e){this._renderer=e}_getRenderer(){return this._renderer||null}getStyle(){return this._style}}class Nm{constructor(...t){}}const jm={};let pr=class Ch extends Qs(xi(_i(Nm))){constructor(e,n){Ys(e,"container","Map container element must be specified");const r=["center","basemap"];for(const d of r)cl(n,d);const l={...n,viewer:{...{viewer:{antialias:!0,stencil:!0,logarithmicDepthBuffer:!0}}.viewer,...n.viewer}};super(l);G(this,"viewer");G(this,"tilemap");G(this,"center");G(this,"prjcenter");G(this,"_layerContainer");G(this,"_EventMap",{loaded:{listened:!1}});G(this,"_canvasManager",new tp);G(this,"collisionEngine");G(this,"_onLoadHooks");this.tilemap=this.initTileMap(l.basemap),this.center=this.options.center,this.viewer=new ul(e,{...l.viewer,map:this}),this.tilemap.receiveShadow=!0,this.viewer.scene.add(this.tilemap);const c=this.tilemap.geo2world(new m.Vector3(this.center[0],this.center[1],0)),u=this.tilemap.geo2world(new m.Vector3(this.center[0],this.center[1]-.03,this.center[2]||1e3));this.prjcenter=c,console.log(c,"centerPostion"),this.viewer.camera.position.copy(u),this.viewer.camera.lookAt(c),this.viewer.controls.target.copy(c),this._layerContainer=new ep,this.viewer.scene.add(this._layerContainer),this.collisionEngine=new xp(this.viewer.renderer,{padding:8,updateInterval:16,animationDuration:200,maxFeaturesPerFrame:2e4,strategies:{priority:!0,grouping:!0,proximity:!0}}),this.on("control-change",_p.debounce(d=>{this.collisionEngine.update(d.camera)},10,{leading:!1,trailing:!0})),this._callOnLoadHooks()}static addOnLoadHook(e,...n){const r=typeof e=="function"?e:function(){this[e].apply(this,n)},s=this.prototype;return s._onLoadHooks=s._onLoadHooks||[],s._onLoadHooks.push(r),this}_callOnLoadHooks(){const e=Ch.prototype;if(e._onLoadHooks)for(let n=0,r=e._onLoadHooks.length;n<r;n++)e._onLoadHooks[n].call(this)}initTileMap(e){const n=new bi({...e});try{if(e.Baselayers?.length)for(const r of e.Baselayers)r.isBaseLayer=!0,n.addLayer(r)}catch(r){console.error("💥 诊断失败:",r)}return n.rotateX(-Math.PI/2),n.receiveShadow=!0,n.addEventListener("ready",()=>{const r={timestamp:Wf(),targrt:this};this._EventMap.loaded={listened:!0},this.trigger("loaded",r)}),n}addLayer(e,...n){if(!e)return this;Array.isArray(e)||(e=[e]),n?.length&&(e=e.concat(n)),n?.length&&(e=e.concat(n));for(let r=0,s=e.length;r<s;r++){const l=e[r],c=l.getId();if(Js(c))throw new Error("Invalid id for the layer: "+c);l.isTileLayer?this.addTileLayer(l):this.addRegularLayer(l)}return this}removeLayer(e){const n=this._layerContainer.getLayerById(e);return n?(this._layerContainer.remove(n),console.log(`✅ 图层从场景移除: ${e}`),n.isTileLayer&&(this.tilemap.removeLayer(e),console.log(`✅ 瓦片图层从管理器移除: ${e}`)),n instanceof Un&&n?._collision,!0):(console.warn(`⚠️ 图层不存在: ${e}`),!1)}addRegularLayer(e){const n=e.getId();this._layerContainer.add(e),e._bindMap(this),e instanceof Un&&e?._collision&&(this.collisionEngine.registerLayer(e),e.setCollisionEngine(this.collisionEngine)),console.log(`📁 普通图层已添加到场景: ${n}`)}addTileLayer(e){if(this.tilemap.addLayer(e),e._bindMap(this),e instanceof rc){const n=new Vp(e.getId()+"-vtrender",{altitude:e.getAltitude(),style:e.getStyle(),collision:e._collision});e._setRenderer(n),this.addRegularLayer(n)}return this}clearLayers(){return this._layerContainer.clear(),this.tilemap.clearLayers(),this}getLayers(){return[...this._layerContainer.getLayers(),...this.tilemap.getLayers()]}getLayerById(e){const n=this._layerContainer.getLayerById(e);return n||this.tilemap.getLayer(e)}geo2world(e){return this.tilemap.geo2world(e)}world2geo(e){return this.tilemap.world2geo(e)}geo2map(e){return this.tilemap.geo2map(e)}_getCanvas(e=40,n=30,r){return this._canvasManager.getCanvas(e,n,1,r)}getContainer(){return this.viewer.container}getRenderer(){return this.viewer.renderer}getCamera(){return this.viewer.camera}_findFeaturesAt(e){const n=this,r=n.getRenderer(),s=n.getCamera(),l=r.domElement.getBoundingClientRect(),c=e.x/l.width*2-1,u=-(e.y/l.height)*2+1,d=new m.Raycaster;d.setFromCamera(new m.Vector2(c,u),s);const p=n.getLayers().filter(v=>!v?.isSceneLayer),f=d.intersectObjects(p,!0);return f.find(v=>{let b=v.object.parent;return b?.parent?._type==="Model"&&(b=b.parent),!(b instanceof Ln)})?[]:f.sort((v,b)=>v.distance-b.distance).map(v=>{let b=v.object.parent;return b?.parent?._type==="Model"&&(b=b.parent),{feature:b,distance:v.distance,object:v.object}})}_getEventPosition(e){let n,r;if("touches"in e){if(e.touches.length===0)return null;n=e.touches[0].clientX,r=e.touches[0].clientY}else n=e.clientX,r=e.clientY;const s=this.getContainer();if(!s)return null;const l=s.getBoundingClientRect();return{x:n-l.left,y:r-l.top}}get isInteracting(){return this.viewer.isInteracting}identify(){}};pr.mergeOptions(jm);function ic(a,t,e){const{currentTarget:n,clientX:r,clientY:s}=a;if(n instanceof HTMLElement){const l=n.clientWidth,c=n.clientHeight,u=new m.Vector2(r/l*2-1,-(s/c)*2+1);return t.getLocalInfoFromScreen(e,u)?.location}else return}const Jm=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout"];pr.prototype._removeDomEvents=function(){console.log("removeDomEvents",this)},pr.prototype._registerDomEvents=function(){const a=this.viewer.container;a&&Jm.forEach(t=>{a.addEventListener(t,e=>{let n=ic(e,this.tilemap,this.viewer.camera),r={target:this,originEvent:e,eventName:t,screenXY:{X:e.screenX,Y:e.screenY}};if(n){let s=[n.x,n.y,n.z];r={target:this,originEvent:e,coordinate:s,eventName:t,screenXY:{X:e.screenX,Y:e.screenY}}}this.trigger(t,r)})})};const Qm=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","touchstart","touchmove","touchend"];class Hm extends ml{constructor(){super(...arguments);G(this,"_registeredEvents",[]);G(this,"_eventCommon",e=>{e.type==="click"&&Date.now()-this._mouseDownTime>300||this._handleEvent(e,e.type)})}addHooks(){const n=this.target.getContainer();n&&Qm.forEach(r=>{n.addEventListener(r,this._eventCommon),this._registeredEvents.push(r)})}removeHooks(){const n=this.target.getContainer();n&&this._registeredEvents.length>0&&(this._registeredEvents.forEach(r=>{const s=r;n.removeEventListener(s,this._eventCommon)}),this._registeredEvents=[])}_handleEvent(e,n){const r=this.target;if(this._shouldIgnoreEvent())return;const s=r._getEventPosition(e);if(!s)return;const l=r._findFeaturesAt(s);if(l.length===0)return;const c=l[0].feature;switch(n){case"click":this._handleClickEvent(c,e);break;default:c&&this._fireFeatureEvent(c,n,e)}}_handleClickEvent(e,n){if(!e)return;this._fireFeatureEvent(e,"click",n);const r=e.getLayer();r&&r.trigger("featureclick",{feature:e,domEvent:n,type:"featureclick"})}handleMoveEvent(e,n){if(!e)return;this._fireFeatureEvent(e,n.type,n);const r=e.getLayer();r&&r.trigger("feature"+n.type,{feature:e,domEvent:n,type:"feature"+n.type})}_fireFeatureEvent(e,n,r){const s=this.target;let l=ic(r,s.tilemap,s.viewer.camera);if(!l)return;let c=[l.x,l.y,l.z],u={target:e,originEvent:r,coordinate:c,eventName:n,screenXY:{X:r.screenX,Y:r.screenY}};e.trigger(n,u)}_shouldIgnoreEvent(){return!!this.target.isInteracting}}pr.mergeOptions({FeatureEvents:!0,onlyVisibleFeatureEvents:!0}),pr.addOnLoadHook("addHandler","FeatureEvents",Hm);class Em extends Rt{constructor(e){super(e);G(this,"dataType","image");G(this,"attribution","天地图");G(this,"token","");G(this,"style","img_w");G(this,"subdomains","01234");G(this,"url","https://t{s}.tianditu.gov.cn/DataServer?T={style}&x={x}&y={y}&l={z}&tk={token}");if(Object.assign(this,e),!this.token)throw new Error("天地图访问令牌(token)是必填参数")}}class qm extends Rt{constructor(e){super(e);G(this,"dataType","quantized-mesh");G(this,"attribution","天地图");G(this,"token","");G(this,"subdomains","01234");G(this,"url","https://t{s}.tianditu.gov.cn/mapservice/swdx?T=elv_c&tk={token}&x={x}&y={y}&l={z}");if(Object.assign(this,e),!this.token)throw new Error("天地图访问令牌(token)是必填参数")}}class $m extends Rt{constructor(e){super({...e,url:e.urlTemplate,isTMS:e.isTMS||!1});G(this,"minLevel",2);G(this,"maxLevel",24)}getUrl(e,n,r){const s=this.isTMS?Math.pow(2,r)-1-n:n;return If(this.url,{...this,x:e,y:s,z:r,tileMatrix:r,tileRow:s,tileCol:e})}}class e0 extends Rt{constructor(e){super(e);G(this,"dataType","image");G(this,"attribution","ArcGIS");G(this,"style","World_Imagery");G(this,"url","https://services.arcgisonline.com/arcgis/rest/services/{style}/MapServer/tile/{z}/{y}/{x}");Object.assign(this,e)}}class t0 extends Rt{constructor(e){super(e);G(this,"dataType","lerc");G(this,"attribution","ArcGIS");G(this,"minLevel",6);G(this,"maxLevel",13);G(this,"url","https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer/tile/{z}/{y}/{x}");Object.assign(this,e)}}class n0 extends Rt{constructor(e){super(e);G(this,"token","");G(this,"format","webp");G(this,"style","cm2myr6qx001t01pi0sf7estf");G(this,"attribution","MapBox");G(this,"maxLevel",25);G(this,"url","https://api.mapbox.com/styles/v1/criska/cm2myr6qx001t01pi0sf7estf/tiles/256/{z}/{x}/{y}?access_token={token}&format={format}");if(Object.assign(this,e),!this.token)throw new Error("MapBox访问令牌(token)是必填参数")}}class r0 extends Rt{constructor(e){super(e);G(this,"dataType","mvt");G(this,"style",{layer:[]});Object.assign(this,e)}}class i0 extends Rt{constructor(e){super(e);G(this,"dataType","VectorTile");G(this,"attribution","ArcGIS");G(this,"minLevel",1);G(this,"maxLevel",21);G(this,"url","https://api.maptiler.com/tiles/v3/{z}/{x}/{y}.pbf?key=uKYsZQZpm72WlbSgH9B7");Object.assign(this,e)}}class s0 extends Un{constructor(t,e){super(t,e)}validateFeature(t){return t._baseType==="Line"}}class o0 extends Un{constructor(t,e){super(t,e)}validateFeature(t){return t._baseType==="Point"}}class a0 extends Un{constructor(t,e){super(t,e)}validateFeature(t){return t._baseType==="Surface"}}class l0 extends Un{constructor(e,n){super(e,n);G(this,"_clouds",null);const r=["texture"];for(const s of r)cl(n,s);this._createClouds(n.texture)}async _createClouds(e){const n=await It._loadTexture(e),r=new Ff({texture:n,material:m.MeshBasicMaterial});r.castShadow=!0,r.renderOrder=99999,this._clouds=r}validateFeature(e){return e._type==="Cloud"}animate(e,n){this._clouds&&this._clouds.update(this.map.viewer.camera,n,e)}}class c0 extends zl{constructor(e,n){super(e,n);G(this,"layerType","raster")}createLoader(){const e=new Ii;return Array.isArray(this.source)?e.imgSource=this.source:e.imgSource=[this.source],e}}class u0 extends c0{constructor(e,n){super(e,n);G(this,"layerType","wmts");G(this,"_layerName");G(this,"_style");G(this,"_matrixSet");this._layerName=n.layerName,this._style=n.style||"default",this._matrixSet=n.matrixSet||"GoogleMapsCompatible"}get layerName(){return this._layerName}get style(){return this._style}get matrixSet(){return this._matrixSet}createLoader(){const e=new Ii;return Array.isArray(this.source)?e.imgSource=this.source:e.imgSource=[this.source],e}update(e){this.loader&&super.update(e)}}console.log("%c✨ terra.gl V"+Vh+" ","color:rgb(255, 255, 255); font-weight: bold; background: linear-gradient(90deg, #ffb6c1, #ff69b4); padding: 5px; border-radius: 5px;"),ee.ArcGisDemSource=t0,ee.ArcGisSource=e0,ee.CloudsLayer=l0,ee.EventClass=Ns,ee.ICloud=Xl,ee.Label=kl,ee.LineLayer=s0,ee.LineString=ro,ee.LoaderFactory=Xe,ee.MVTGeoSource=i0,ee.MVTSource=r0,ee.Maker=no,ee.Map=pr,ee.MapBoxSource=n0,ee.Martini=Ul,ee.Model=Fl,ee.MultiLineString=Al,ee.PointLayer=o0,ee.Polygon=Vl,ee.PolygonLayer=a0,ee.ProjectFactory=Tf,ee.PromiseWorker=Ap,ee.Style=It,ee.TDTQMSource=qm,ee.TDTSource=Em,ee.TPoints=Dl,ee.Tile=nn,ee.TileCanvasLoader=Yp,ee.TileGeometry=dr,ee.TileGeometryLoader=co,ee.TileLoader=Ii,ee.TileLoadingManager=Ol,ee.TileMap=bi,ee.TileMaterial=uo,ee.TileMaterialLoader=ho,ee.TileSource=Rt,ee.VectorFeatureTypes=tt,ee.VectorTileLayer=rc,ee.VectorTileRender=Bl,ee.Viewer=ul,ee.WMTSSource=$m,ee.WMTSTileLayer=u0,ee.addSkirt=Rl,ee.author=Qp,ee.concatenateTypedArrays=Br,ee.convertGeometryToWGS84=kp,ee.createBillboards=Zf,ee.getBoundsCoord=io,ee.getGeometryDataFromDem=Yl,ee.getGridIndices=ao,ee.getLocalInfoFromRay=Us,ee.getLocalInfoFromScreen=pl,ee.getLocalInfoFromWorld=Bs,ee.getNormals=lo,ee.getSafeTileUrlAndBounds=so,ee.registerDEMLoader=po,ee.registerImgLoader=fo,ee.registerMeshLoader=Nl,ee.vector2ToWGS84=oo,ee.version=Jp,ee.waitFor=Hp,Object.defineProperty(ee,Symbol.toStringTag,{value:"Module"})});
|