@terra.gl/core 0.0.1-alpha.7 → 0.0.1-alpha.71

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.
@@ -1,4 +1,4 @@
1
- (function(te,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("three")):typeof define=="function"&&define.amd?define(["exports","three"],m):(te=typeof globalThis<"u"?globalThis:te||self,m(te["terra-gl"]={},te.THREE))})(this,function(te,m){"use strict";var Ax=Object.defineProperty;var Fx=(te,m,ar)=>m in te?Ax(te,m,{enumerable:!0,configurable:!0,writable:!0,value:ar}):te[m]=ar;var G=(te,m,ar)=>Fx(te,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.7",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},Ot=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=Ot(a,u,1);var T=Ot(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=Ot(a,u,31)+257,F=Ot(a,u+10,15)+4,K=I+Ot(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]]=Ot(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[Ot(a,u,P)];u+=N&15;var _=N>>>4;if(_<16)D[V++]=_;else{var H=0,Q=0;for(_==16?(Q=3+Ot(a,u,3),u+=2,H=D[V-1]):_==17?(Q=3+Ot(a,u,7),u+=3):_==18&&(Q=11+Ot(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,ee=u;;ee=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){ee=u,p=null;break}else{var xe=me-254;if(me>264){var V=me-257,he=Pa[V];xe=Ot(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=ee,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:`
1
+ (function(q,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("three")):typeof define=="function"&&define.amd?define(["exports","three"],p):(q=typeof globalThis<"u"?globalThis:q||self,p(q["terra-gl"]={},q.THREE))})(this,function(q,p){"use strict";function pf(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const ut=pf(p),mf="0.0.1-alpha.71",xo={name:"Criska"};var gr=function(){var r=0,e=document.createElement("div");e.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",e.addEventListener("click",function(m){m.preventDefault(),i(++r%e.children.length)},!1);function t(m){return e.appendChild(m.dom),m}function i(m){for(var f=0;f<e.children.length;f++)e.children[f].style.display=f===m?"block":"none";r=m}var n=(performance||Date).now(),s=n,a=0,c=t(new gr.Panel("FPS","#0ff","#002")),h=t(new gr.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var d=t(new gr.Panel("MB","#f08","#201"));return i(0),{REVISION:16,dom:e,addPanel:t,showPanel:i,begin:function(){n=(performance||Date).now()},end:function(){a++;var m=(performance||Date).now();if(h.update(m-n,200),m>=s+1e3&&(c.update(a*1e3/(m-s),100),s=m,a=0,d)){var f=performance.memory;d.update(f.usedJSHeapSize/1048576,f.jsHeapSizeLimit/1048576)}return m},update:function(){n=this.end()},domElement:e,setMode:i}};gr.Panel=function(r,e,t){var i=1/0,n=0,s=Math.round,a=s(window.devicePixelRatio||1),c=80*a,h=48*a,d=3*a,m=2*a,f=3*a,g=15*a,_=74*a,w=30*a,b=document.createElement("canvas");b.width=c,b.height=h,b.style.cssText="width:80px;height:48px";var x=b.getContext("2d");return x.font="bold "+9*a+"px Helvetica,Arial,sans-serif",x.textBaseline="top",x.fillStyle=t,x.fillRect(0,0,c,h),x.fillStyle=e,x.fillText(r,d,m),x.fillRect(f,g,_,w),x.fillStyle=t,x.globalAlpha=.9,x.fillRect(f,g,_,w),{dom:b,update:function(L,M){i=Math.min(i,L),n=Math.max(n,L),x.fillStyle=t,x.globalAlpha=1,x.fillRect(0,0,c,g),x.fillStyle=e,x.fillText(s(L)+" "+r+" ("+s(i)+"-"+s(n)+")",d,m),x.drawImage(b,f+a,g,_-a,w,f,g,_-a,w),x.fillRect(f+_-a,g,a,w),x.fillStyle=t,x.globalAlpha=.9,x.fillRect(f+_-a,g,a,s((1-L/M)*w))}}};const ns=parseInt(p.REVISION.replace(/\D+/g,"")),Mo=ns>=125?"uv1":"uv2";function Dl(r,e){if(e===p.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),r;if(e===p.TriangleFanDrawMode||e===p.TriangleStripDrawMode){let t=r.getIndex();if(t===null){const a=[],c=r.getAttribute("position");if(c!==void 0){for(let h=0;h<c.count;h++)a.push(h);r.setIndex(a),t=r.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),r}const i=t.count-2,n=[];if(t)if(e===p.TriangleFanDrawMode)for(let a=1;a<=i;a++)n.push(t.getX(0)),n.push(t.getX(a)),n.push(t.getX(a+1));else for(let a=0;a<i;a++)a%2===0?(n.push(t.getX(a)),n.push(t.getX(a+1)),n.push(t.getX(a+2))):(n.push(t.getX(a+2)),n.push(t.getX(a+1)),n.push(t.getX(a)));n.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=r.clone();return s.setIndex(n),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),r}var Kt=Uint8Array,Xi=Uint16Array,So=Uint32Array,Xl=new Kt([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]),kl=new Kt([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]),gf=new Kt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ul=function(r,e){for(var t=new Xi(31),i=0;i<31;++i)t[i]=e+=1<<r[i-1];for(var n=new So(t[30]),i=1;i<30;++i)for(var s=t[i];s<t[i+1];++s)n[s]=s-t[i]<<5|i;return[t,n]},Nl=Ul(Xl,2),Kl=Nl[0],yf=Nl[1];Kl[28]=258,yf[258]=28;for(var _f=Ul(kl,0),vf=_f[0],Lo=new Xi(32768),Ze=0;Ze<32768;++Ze){var ki=(Ze&43690)>>>1|(Ze&21845)<<1;ki=(ki&52428)>>>2|(ki&13107)<<2,ki=(ki&61680)>>>4|(ki&3855)<<4,Lo[Ze]=((ki&65280)>>>8|(ki&255)<<8)>>>1}for(var yr=function(r,e,t){for(var i=r.length,n=0,s=new Xi(e);n<i;++n)++s[r[n]-1];var a=new Xi(e);for(n=0;n<e;++n)a[n]=a[n-1]+s[n-1]<<1;var c;if(t){c=new Xi(1<<e);var h=15-e;for(n=0;n<i;++n)if(r[n])for(var d=n<<4|r[n],m=e-r[n],f=a[r[n]-1]++<<m,g=f|(1<<m)-1;f<=g;++f)c[Lo[f]>>>h]=d}else for(c=new Xi(i),n=0;n<i;++n)r[n]&&(c[n]=Lo[a[r[n]-1]++]>>>15-r[n]);return c},_r=new Kt(288),Ze=0;Ze<144;++Ze)_r[Ze]=8;for(var Ze=144;Ze<256;++Ze)_r[Ze]=9;for(var Ze=256;Ze<280;++Ze)_r[Ze]=7;for(var Ze=280;Ze<288;++Ze)_r[Ze]=8;for(var Bl=new Kt(32),Ze=0;Ze<32;++Ze)Bl[Ze]=5;var wf=yr(_r,9,1),bf=yr(Bl,5,1),Po=function(r){for(var e=r[0],t=1;t<r.length;++t)r[t]>e&&(e=r[t]);return e},ii=function(r,e,t){var i=e/8|0;return(r[i]|r[i+1]<<8)>>(e&7)&t},Co=function(r,e){var t=e/8|0;return(r[t]|r[t+1]<<8|r[t+2]<<16)>>(e&7)},xf=function(r){return(r/8|0)+(r&7&&1)},Mf=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var i=new(r instanceof Xi?Xi:r instanceof So?So:Kt)(t-e);return i.set(r.subarray(e,t)),i},Sf=function(r,e,t){var i=r.length;if(!i||t&&!t.l&&i<5)return e||new Kt(0);var n=!e||t,s=!t||t.i;t||(t={}),e||(e=new Kt(i*3));var a=function(pt){var $e=e.length;if(pt>$e){var Re=new Kt(Math.max($e*2,pt));Re.set(e),e=Re}},c=t.f||0,h=t.p||0,d=t.b||0,m=t.l,f=t.d,g=t.m,_=t.n,w=i*8;do{if(!m){t.f=c=ii(r,h,1);var b=ii(r,h+1,3);if(h+=3,b)if(b==1)m=wf,f=bf,g=9,_=5;else if(b==2){var C=ii(r,h,31)+257,W=ii(r,h+10,15)+4,D=C+ii(r,h+5,31)+1;h+=14;for(var z=new Kt(D),X=new Kt(19),I=0;I<W;++I)X[gf[I]]=ii(r,h+I*3,7);h+=W*3;for(var U=Po(X),V=(1<<U)-1,G=yr(X,U,1),I=0;I<D;){var N=G[ii(r,h,V)];h+=N&15;var x=N>>>4;if(x<16)z[I++]=x;else{var j=0,Y=0;for(x==16?(Y=3+ii(r,h,3),h+=2,j=z[I-1]):x==17?(Y=3+ii(r,h,7),h+=3):x==18&&(Y=11+ii(r,h,127),h+=7);Y--;)z[I++]=j}}var H=z.subarray(0,C),Q=z.subarray(C);g=Po(H),_=Po(Q),m=yr(H,g,1),f=yr(Q,_,1)}else throw"invalid block type";else{var x=xf(h)+4,L=r[x-4]|r[x-3]<<8,M=x+L;if(M>i){if(s)throw"unexpected EOF";break}n&&a(d+L),e.set(r.subarray(x,M),d),t.b=d+=L,t.p=h=M*8;continue}if(h>w){if(s)throw"unexpected EOF";break}}n&&a(d+131072);for(var re=(1<<g)-1,ne=(1<<_)-1,le=h;;le=h){var j=m[Co(r,h)&re],de=j>>>4;if(h+=j&15,h>w){if(s)throw"unexpected EOF";break}if(!j)throw"invalid length/literal";if(de<256)e[d++]=de;else if(de==256){le=h,m=null;break}else{var ge=de-254;if(de>264){var I=de-257,fe=Xl[I];ge=ii(r,h,(1<<fe)-1)+Kl[I],h+=fe}var Se=f[Co(r,h)&ne],st=Se>>>4;if(!Se)throw"invalid distance";h+=Se&15;var Q=vf[st];if(st>3){var fe=kl[st];Q+=Co(r,h)&(1<<fe)-1,h+=fe}if(h>w){if(s)throw"unexpected EOF";break}n&&a(d+131072);for(var ot=d+ge;d<ot;d+=4)e[d]=e[d-Q],e[d+1]=e[d+1-Q],e[d+2]=e[d+2-Q],e[d+3]=e[d+3-Q];d=ot}}t.l=m,t.p=le,t.b=d,m&&(c=1,t.m=g,t.d=f,t.n=_)}while(!c);return d==e.length?e:Mf(e,0,d)},Lf=new Kt(0),Pf=function(r){if((r[0]&15)!=8||r[0]>>>4>7||(r[0]<<8|r[1])%31)throw"invalid zlib data";if(r[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function Cf(r,e){return Sf((Pf(r),r.subarray(2,-4)),e)}var Tf=typeof TextDecoder<"u"&&new TextDecoder,Gf=0;try{Tf.decode(Lf,{stream:!0}),Gf=1}catch{}class Wf extends p.Mesh{constructor(e,t={}){super(e),this.isWater=!0;const i=this,n=t.textureWidth!==void 0?t.textureWidth:512,s=t.textureHeight!==void 0?t.textureHeight:512,a=t.clipBias!==void 0?t.clipBias:0,c=t.alpha!==void 0?t.alpha:1,h=t.time!==void 0?t.time:0,d=t.waterNormals!==void 0?t.waterNormals:null,m=t.sunDirection!==void 0?t.sunDirection:new p.Vector3(.70707,.70707,0),f=new p.Color(t.sunColor!==void 0?t.sunColor:16777215),g=new p.Color(t.waterColor!==void 0?t.waterColor:8355711),_=t.eye!==void 0?t.eye:new p.Vector3(0,0,0),w=t.distortionScale!==void 0?t.distortionScale:20,b=t.side!==void 0?t.side:p.FrontSide,x=t.fog!==void 0?t.fog:!1,L=new p.Plane,M=new p.Vector3,C=new p.Vector3,W=new p.Vector3,D=new p.Matrix4,z=new p.Vector3(0,0,-1),X=new p.Vector4,I=new p.Vector3,U=new p.Vector3,V=new p.Vector4,G=new p.Matrix4,N=new p.PerspectiveCamera,j=new p.WebGLRenderTarget(n,s),Y={uniforms:p.UniformsUtils.merge([p.UniformsLib.fog,p.UniformsLib.lights,{normalSampler:{value:null},mirrorSampler:{value:null},alpha:{value:1},time:{value:0},size:{value:1},distortionScale:{value:20},textureMatrix:{value:new p.Matrix4},sunColor:{value:new p.Color(8355711)},sunDirection:{value:new p.Vector3(.70707,.70707,0)},eye:{value:new p.Vector3},waterColor:{value:new p.Color(5592405)}}]),vertexShader:`
2
2
  uniform mat4 textureMatrix;
3
3
  uniform float time;
4
4
 
@@ -92,14 +92,124 @@
92
92
  gl_FragColor = vec4( outgoingLight, alpha );
93
93
 
94
94
  #include <tonemapping_fragment>
95
- #include <${fi>=154?"colorspace_fragment":"encodings_fragment"}>
95
+ #include <${ns>=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=`
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
- `;q=f(V),q!==!1;){if(Q.string+=q+`
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 ee=0,me;for(;ee<q&&Q<V.byteLength;){me=V[Q++];const he=me>128;if(he&&(me-=128),(me===0||ee+me>q)&&l(3,"bad scanline data"),he){const ve=V[Q++];for(let ke=0;ke<me;ke++)oe[ee++]=ve}else oe.set(V.subarray(Q,Q+me),ee),ee+=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
- `);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:`
97
+ }`},H=new p.ShaderMaterial({fragmentShader:Y.fragmentShader,vertexShader:Y.vertexShader,uniforms:p.UniformsUtils.clone(Y.uniforms),lights:!0,side:b,fog:x});H.uniforms.mirrorSampler.value=j.texture,H.uniforms.textureMatrix.value=G,H.uniforms.alpha.value=c,H.uniforms.time.value=h,H.uniforms.normalSampler.value=d,H.uniforms.sunColor.value=f,H.uniforms.waterColor.value=g,H.uniforms.sunDirection.value=m,H.uniforms.distortionScale.value=w,H.uniforms.eye.value=_,i.material=H,i.onBeforeRender=function(Q,re,ne){if(C.setFromMatrixPosition(i.matrixWorld),W.setFromMatrixPosition(ne.matrixWorld),D.extractRotation(i.matrixWorld),M.set(0,0,1),M.applyMatrix4(D),I.subVectors(C,W),I.dot(M)>0)return;I.reflect(M).negate(),I.add(C),D.extractRotation(ne.matrixWorld),z.set(0,0,-1),z.applyMatrix4(D),z.add(W),U.subVectors(C,z),U.reflect(M).negate(),U.add(C),N.position.copy(I),N.up.set(0,1,0),N.up.applyMatrix4(D),N.up.reflect(M),N.lookAt(U),N.far=ne.far,N.updateMatrixWorld(),N.projectionMatrix.copy(ne.projectionMatrix),G.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),G.multiply(N.projectionMatrix),G.multiply(N.matrixWorldInverse),L.setFromNormalAndCoplanarPoint(M,C),L.applyMatrix4(N.matrixWorldInverse),X.set(L.normal.x,L.normal.y,L.normal.z,L.constant);const le=N.projectionMatrix;V.x=(Math.sign(X.x)+le.elements[8])/le.elements[0],V.y=(Math.sign(X.y)+le.elements[9])/le.elements[5],V.z=-1,V.w=(1+le.elements[10])/le.elements[14],X.multiplyScalar(2/X.dot(V)),le.elements[2]=X.x,le.elements[6]=X.y,le.elements[10]=X.z+1-a,le.elements[14]=X.w,_.setFromMatrixPosition(ne.matrixWorld);const de=Q.getRenderTarget(),ge=Q.xr.enabled,fe=Q.shadowMap.autoUpdate;i.visible=!1,Q.xr.enabled=!1,Q.shadowMap.autoUpdate=!1,Q.setRenderTarget(j),Q.state.buffers.depth.setMask(!0),Q.autoClear===!1&&Q.clear(),Q.render(re,N),i.visible=!0,Q.xr.enabled=ge,Q.shadowMap.autoUpdate=fe,Q.setRenderTarget(de);const Se=ne.viewport;Se!==void 0&&Q.state.viewport(Se)}}}var Zf=Object.defineProperty,Vf=(r,e,t)=>e in r?Zf(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,If=(r,e,t)=>(Vf(r,e+"",t),t);class Af{constructor(){If(this,"_listeners")}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const n=this._listeners[e];if(n!==void 0){const s=n.indexOf(t);s!==-1&&n.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const n=i.slice(0);for(let s=0,a=n.length;s<a;s++)n[s].call(this,e);e.target=null}}}var Ff=Object.defineProperty,Of=(r,e,t)=>e in r?Ff(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ie=(r,e,t)=>(Of(r,typeof e!="symbol"?e+"":e,t),t);const rs=new p.Ray,Yl=new p.Plane,zf=Math.cos(70*(Math.PI/180)),Rl=(r,e)=>(r%e+e)%e;class Df extends Af{constructor(e,t){super(),ie(this,"object"),ie(this,"domElement"),ie(this,"enabled",!0),ie(this,"target",new p.Vector3),ie(this,"minDistance",0),ie(this,"maxDistance",1/0),ie(this,"minZoom",0),ie(this,"maxZoom",1/0),ie(this,"minPolarAngle",0),ie(this,"maxPolarAngle",Math.PI),ie(this,"minAzimuthAngle",-1/0),ie(this,"maxAzimuthAngle",1/0),ie(this,"enableDamping",!1),ie(this,"dampingFactor",.05),ie(this,"enableZoom",!0),ie(this,"zoomSpeed",1),ie(this,"enableRotate",!0),ie(this,"rotateSpeed",1),ie(this,"enablePan",!0),ie(this,"panSpeed",1),ie(this,"screenSpacePanning",!0),ie(this,"keyPanSpeed",7),ie(this,"zoomToCursor",!1),ie(this,"autoRotate",!1),ie(this,"autoRotateSpeed",2),ie(this,"reverseOrbit",!1),ie(this,"reverseHorizontalOrbit",!1),ie(this,"reverseVerticalOrbit",!1),ie(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),ie(this,"mouseButtons",{LEFT:p.MOUSE.ROTATE,MIDDLE:p.MOUSE.DOLLY,RIGHT:p.MOUSE.PAN}),ie(this,"touches",{ONE:p.TOUCH.ROTATE,TWO:p.TOUCH.DOLLY_PAN}),ie(this,"target0"),ie(this,"position0"),ie(this,"zoom0"),ie(this,"_domElementKeyEvents",null),ie(this,"getPolarAngle"),ie(this,"getAzimuthalAngle"),ie(this,"setPolarAngle"),ie(this,"setAzimuthalAngle"),ie(this,"getDistance"),ie(this,"getZoomScale"),ie(this,"listenToKeyEvents"),ie(this,"stopListenToKeyEvents"),ie(this,"saveState"),ie(this,"reset"),ie(this,"update"),ie(this,"connect"),ie(this,"dispose"),ie(this,"dollyIn"),ie(this,"dollyOut"),ie(this,"getScale"),ie(this,"setScale"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>m.phi,this.getAzimuthalAngle=()=>m.theta,this.setPolarAngle=O=>{let $=Rl(O,2*Math.PI),ce=m.phi;ce<0&&(ce+=2*Math.PI),$<0&&($+=2*Math.PI);let Me=Math.abs($-ce);2*Math.PI-Me<Me&&($<ce?$+=2*Math.PI:ce+=2*Math.PI),f.phi=$-ce,i.update()},this.setAzimuthalAngle=O=>{let $=Rl(O,2*Math.PI),ce=m.theta;ce<0&&(ce+=2*Math.PI),$<0&&($+=2*Math.PI);let Me=Math.abs($-ce);2*Math.PI-Me<Me&&($<ce?$+=2*Math.PI:ce+=2*Math.PI),f.theta=$-ce,i.update()},this.getDistance=()=>i.object.position.distanceTo(i.target),this.listenToKeyEvents=O=>{O.addEventListener("keydown",xi),this._domElementKeyEvents=O},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",xi),this._domElementKeyEvents=null},this.saveState=()=>{i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object.zoom},this.reset=()=>{i.target.copy(i.target0),i.object.position.copy(i.position0),i.object.zoom=i.zoom0,i.object.updateProjectionMatrix(),i.dispatchEvent(n),i.update(),h=c.NONE},this.update=(()=>{const O=new p.Vector3,$=new p.Vector3(0,1,0),ce=new p.Quaternion().setFromUnitVectors(e.up,$),Me=ce.clone().invert(),Ye=new p.Vector3,jt=new p.Quaternion,ai=2*Math.PI;return function(){const Vs=i.object.position;ce.setFromUnitVectors(e.up,$),Me.copy(ce).invert(),O.copy(Vs).sub(i.target),O.applyQuaternion(ce),m.setFromVector3(O),i.autoRotate&&h===c.NONE&&Y(N()),i.enableDamping?(m.theta+=f.theta*i.dampingFactor,m.phi+=f.phi*i.dampingFactor):(m.theta+=f.theta,m.phi+=f.phi);let li=i.minAzimuthAngle,ci=i.maxAzimuthAngle;isFinite(li)&&isFinite(ci)&&(li<-Math.PI?li+=ai:li>Math.PI&&(li-=ai),ci<-Math.PI?ci+=ai:ci>Math.PI&&(ci-=ai),li<=ci?m.theta=Math.max(li,Math.min(ci,m.theta)):m.theta=m.theta>(li+ci)/2?Math.max(li,m.theta):Math.min(ci,m.theta)),m.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,m.phi)),m.makeSafe(),i.enableDamping===!0?i.target.addScaledVector(_,i.dampingFactor):i.target.add(_),i.zoomToCursor&&U||i.object.isOrthographicCamera?m.radius=Se(m.radius):m.radius=Se(m.radius*g),O.setFromSpherical(m),O.applyQuaternion(Me),Vs.copy(i.target).add(O),i.object.matrixAutoUpdate||i.object.updateMatrix(),i.object.lookAt(i.target),i.enableDamping===!0?(f.theta*=1-i.dampingFactor,f.phi*=1-i.dampingFactor,_.multiplyScalar(1-i.dampingFactor)):(f.set(0,0,0),_.set(0,0,0));let sn=!1;if(i.zoomToCursor&&U){let Vn=null;if(i.object instanceof p.PerspectiveCamera&&i.object.isPerspectiveCamera){const In=O.length();Vn=Se(In*g);const er=In-Vn;i.object.position.addScaledVector(X,er),i.object.updateMatrixWorld()}else if(i.object.isOrthographicCamera){const In=new p.Vector3(I.x,I.y,0);In.unproject(i.object),i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/g)),i.object.updateProjectionMatrix(),sn=!0;const er=new p.Vector3(I.x,I.y,0);er.unproject(i.object),i.object.position.sub(er).add(In),i.object.updateMatrixWorld(),Vn=O.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),i.zoomToCursor=!1;Vn!==null&&(i.screenSpacePanning?i.target.set(0,0,-1).transformDirection(i.object.matrix).multiplyScalar(Vn).add(i.object.position):(rs.origin.copy(i.object.position),rs.direction.set(0,0,-1).transformDirection(i.object.matrix),Math.abs(i.object.up.dot(rs.direction))<zf?e.lookAt(i.target):(Yl.setFromNormalAndCoplanarPoint(i.object.up,i.target),rs.intersectPlane(Yl,i.target))))}else i.object instanceof p.OrthographicCamera&&i.object.isOrthographicCamera&&(sn=g!==1,sn&&(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/g)),i.object.updateProjectionMatrix()));return g=1,U=!1,sn||Ye.distanceToSquared(i.object.position)>d||8*(1-jt.dot(i.object.quaternion))>d?(i.dispatchEvent(n),Ye.copy(i.object.position),jt.copy(i.object.quaternion),sn=!1,!0):!1}})(),this.connect=O=>{i.domElement=O,i.domElement.style.touchAction="none",i.domElement.addEventListener("contextmenu",En),i.domElement.addEventListener("pointerdown",tn),i.domElement.addEventListener("pointercancel",Gn),i.domElement.addEventListener("wheel",rn)},this.dispose=()=>{var O,$,ce,Me,Ye,jt;i.domElement&&(i.domElement.style.touchAction="auto"),(O=i.domElement)==null||O.removeEventListener("contextmenu",En),($=i.domElement)==null||$.removeEventListener("pointerdown",tn),(ce=i.domElement)==null||ce.removeEventListener("pointercancel",Gn),(Me=i.domElement)==null||Me.removeEventListener("wheel",rn),(Ye=i.domElement)==null||Ye.ownerDocument.removeEventListener("pointermove",nn),(jt=i.domElement)==null||jt.ownerDocument.removeEventListener("pointerup",Gn),i._domElementKeyEvents!==null&&i._domElementKeyEvents.removeEventListener("keydown",xi)};const i=this,n={type:"change"},s={type:"start"},a={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 h=c.NONE;const d=1e-6,m=new p.Spherical,f=new p.Spherical;let g=1;const _=new p.Vector3,w=new p.Vector2,b=new p.Vector2,x=new p.Vector2,L=new p.Vector2,M=new p.Vector2,C=new p.Vector2,W=new p.Vector2,D=new p.Vector2,z=new p.Vector2,X=new p.Vector3,I=new p.Vector2;let U=!1;const V=[],G={};function N(){return 2*Math.PI/60/60*i.autoRotateSpeed}function j(){return Math.pow(.95,i.zoomSpeed)}function Y(O){i.reverseOrbit||i.reverseHorizontalOrbit?f.theta+=O:f.theta-=O}function H(O){i.reverseOrbit||i.reverseVerticalOrbit?f.phi+=O:f.phi-=O}const Q=(()=>{const O=new p.Vector3;return function(ce,Me){O.setFromMatrixColumn(Me,0),O.multiplyScalar(-ce),_.add(O)}})(),re=(()=>{const O=new p.Vector3;return function(ce,Me){i.screenSpacePanning===!0?O.setFromMatrixColumn(Me,1):(O.setFromMatrixColumn(Me,0),O.crossVectors(i.object.up,O)),O.multiplyScalar(ce),_.add(O)}})(),ne=(()=>{const O=new p.Vector3;return function(ce,Me){const Ye=i.domElement;if(Ye&&i.object instanceof p.PerspectiveCamera&&i.object.isPerspectiveCamera){const jt=i.object.position;O.copy(jt).sub(i.target);let ai=O.length();ai*=Math.tan(i.object.fov/2*Math.PI/180),Q(2*ce*ai/Ye.clientHeight,i.object.matrix),re(2*Me*ai/Ye.clientHeight,i.object.matrix)}else Ye&&i.object instanceof p.OrthographicCamera&&i.object.isOrthographicCamera?(Q(ce*(i.object.right-i.object.left)/i.object.zoom/Ye.clientWidth,i.object.matrix),re(Me*(i.object.top-i.object.bottom)/i.object.zoom/Ye.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}})();function le(O){i.object instanceof p.PerspectiveCamera&&i.object.isPerspectiveCamera||i.object instanceof p.OrthographicCamera&&i.object.isOrthographicCamera?g=O:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function de(O){le(g/O)}function ge(O){le(g*O)}function fe(O){if(!i.zoomToCursor||!i.domElement)return;U=!0;const $=i.domElement.getBoundingClientRect(),ce=O.clientX-$.left,Me=O.clientY-$.top,Ye=$.width,jt=$.height;I.x=ce/Ye*2-1,I.y=-(Me/jt)*2+1,X.set(I.x,I.y,1).unproject(i.object).sub(i.object.position).normalize()}function Se(O){return Math.max(i.minDistance,Math.min(i.maxDistance,O))}function st(O){w.set(O.clientX,O.clientY)}function ot(O){fe(O),W.set(O.clientX,O.clientY)}function pt(O){L.set(O.clientX,O.clientY)}function $e(O){b.set(O.clientX,O.clientY),x.subVectors(b,w).multiplyScalar(i.rotateSpeed);const $=i.domElement;$&&(Y(2*Math.PI*x.x/$.clientHeight),H(2*Math.PI*x.y/$.clientHeight)),w.copy(b),i.update()}function Re(O){D.set(O.clientX,O.clientY),z.subVectors(D,W),z.y>0?de(j()):z.y<0&&ge(j()),W.copy(D),i.update()}function je(O){M.set(O.clientX,O.clientY),C.subVectors(M,L).multiplyScalar(i.panSpeed),ne(C.x,C.y),L.copy(M),i.update()}function at(O){fe(O),O.deltaY<0?ge(j()):O.deltaY>0&&de(j()),i.update()}function Xe(O){let $=!1;switch(O.code){case i.keys.UP:ne(0,i.keyPanSpeed),$=!0;break;case i.keys.BOTTOM:ne(0,-i.keyPanSpeed),$=!0;break;case i.keys.LEFT:ne(i.keyPanSpeed,0),$=!0;break;case i.keys.RIGHT:ne(-i.keyPanSpeed,0),$=!0;break}$&&(O.preventDefault(),i.update())}function Ft(){if(V.length==1)w.set(V[0].pageX,V[0].pageY);else{const O=.5*(V[0].pageX+V[1].pageX),$=.5*(V[0].pageY+V[1].pageY);w.set(O,$)}}function Rt(){if(V.length==1)L.set(V[0].pageX,V[0].pageY);else{const O=.5*(V[0].pageX+V[1].pageX),$=.5*(V[0].pageY+V[1].pageY);L.set(O,$)}}function Ce(){const O=V[0].pageX-V[1].pageX,$=V[0].pageY-V[1].pageY,ce=Math.sqrt(O*O+$*$);W.set(0,ce)}function lt(){i.enableZoom&&Ce(),i.enablePan&&Rt()}function mt(){i.enableZoom&&Ce(),i.enableRotate&&Ft()}function Ct(O){if(V.length==1)b.set(O.pageX,O.pageY);else{const ce=Zn(O),Me=.5*(O.pageX+ce.x),Ye=.5*(O.pageY+ce.y);b.set(Me,Ye)}x.subVectors(b,w).multiplyScalar(i.rotateSpeed);const $=i.domElement;$&&(Y(2*Math.PI*x.x/$.clientHeight),H(2*Math.PI*x.y/$.clientHeight)),w.copy(b)}function Cn(O){if(V.length==1)M.set(O.pageX,O.pageY);else{const $=Zn(O),ce=.5*(O.pageX+$.x),Me=.5*(O.pageY+$.y);M.set(ce,Me)}C.subVectors(M,L).multiplyScalar(i.panSpeed),ne(C.x,C.y),L.copy(M)}function $n(O){const $=Zn(O),ce=O.pageX-$.x,Me=O.pageY-$.y,Ye=Math.sqrt(ce*ce+Me*Me);D.set(0,Ye),z.set(0,Math.pow(D.y/W.y,i.zoomSpeed)),de(z.y),W.copy(D)}function Tn(O){i.enableZoom&&$n(O),i.enablePan&&Cn(O)}function Ot(O){i.enableZoom&&$n(O),i.enableRotate&&Ct(O)}function tn(O){var $,ce;i.enabled!==!1&&(V.length===0&&(($=i.domElement)==null||$.ownerDocument.addEventListener("pointermove",nn),(ce=i.domElement)==null||ce.ownerDocument.addEventListener("pointerup",Gn)),Xr(O),O.pointerType==="touch"?zr(O):Wn(O))}function nn(O){i.enabled!==!1&&(O.pointerType==="touch"?Dr(O):La(O))}function Gn(O){var $,ce,Me;kr(O),V.length===0&&(($=i.domElement)==null||$.releasePointerCapture(O.pointerId),(ce=i.domElement)==null||ce.ownerDocument.removeEventListener("pointermove",nn),(Me=i.domElement)==null||Me.ownerDocument.removeEventListener("pointerup",Gn)),i.dispatchEvent(a),h=c.NONE}function Wn(O){let $;switch(O.button){case 0:$=i.mouseButtons.LEFT;break;case 1:$=i.mouseButtons.MIDDLE;break;case 2:$=i.mouseButtons.RIGHT;break;default:$=-1}switch($){case p.MOUSE.DOLLY:if(i.enableZoom===!1)return;ot(O),h=c.DOLLY;break;case p.MOUSE.ROTATE:if(O.ctrlKey||O.metaKey||O.shiftKey){if(i.enablePan===!1)return;pt(O),h=c.PAN}else{if(i.enableRotate===!1)return;st(O),h=c.ROTATE}break;case p.MOUSE.PAN:if(O.ctrlKey||O.metaKey||O.shiftKey){if(i.enableRotate===!1)return;st(O),h=c.ROTATE}else{if(i.enablePan===!1)return;pt(O),h=c.PAN}break;default:h=c.NONE}h!==c.NONE&&i.dispatchEvent(s)}function La(O){if(i.enabled!==!1)switch(h){case c.ROTATE:if(i.enableRotate===!1)return;$e(O);break;case c.DOLLY:if(i.enableZoom===!1)return;Re(O);break;case c.PAN:if(i.enablePan===!1)return;je(O);break}}function rn(O){i.enabled===!1||i.enableZoom===!1||h!==c.NONE&&h!==c.ROTATE||(O.preventDefault(),i.dispatchEvent(s),at(O),i.dispatchEvent(a))}function xi(O){i.enabled===!1||i.enablePan===!1||Xe(O)}function zr(O){switch(qn(O),V.length){case 1:switch(i.touches.ONE){case p.TOUCH.ROTATE:if(i.enableRotate===!1)return;Ft(),h=c.TOUCH_ROTATE;break;case p.TOUCH.PAN:if(i.enablePan===!1)return;Rt(),h=c.TOUCH_PAN;break;default:h=c.NONE}break;case 2:switch(i.touches.TWO){case p.TOUCH.DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;lt(),h=c.TOUCH_DOLLY_PAN;break;case p.TOUCH.DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;mt(),h=c.TOUCH_DOLLY_ROTATE;break;default:h=c.NONE}break;default:h=c.NONE}h!==c.NONE&&i.dispatchEvent(s)}function Dr(O){switch(qn(O),h){case c.TOUCH_ROTATE:if(i.enableRotate===!1)return;Ct(O),i.update();break;case c.TOUCH_PAN:if(i.enablePan===!1)return;Cn(O),i.update();break;case c.TOUCH_DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;Tn(O),i.update();break;case c.TOUCH_DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;Ot(O),i.update();break;default:h=c.NONE}}function En(O){i.enabled!==!1&&O.preventDefault()}function Xr(O){V.push(O)}function kr(O){delete G[O.pointerId];for(let $=0;$<V.length;$++)if(V[$].pointerId==O.pointerId){V.splice($,1);return}}function qn(O){let $=G[O.pointerId];$===void 0&&($=new p.Vector2,G[O.pointerId]=$),$.set(O.pageX,O.pageY)}function Zn(O){const $=O.pointerId===V[0].pointerId?V[1]:V[0];return G[$.pointerId]}this.dollyIn=(O=j())=>{ge(O),i.update()},this.dollyOut=(O=j())=>{de(O),i.update()},this.getScale=()=>g,this.setScale=O=>{le(O),i.update()},this.getZoomScale=()=>j(),t!==void 0&&this.connect(t),this.update()}}class Xf extends Df{constructor(e,t){super(e,t),this.screenSpacePanning=!1,this.mouseButtons.LEFT=p.MOUSE.PAN,this.mouseButtons.RIGHT=p.MOUSE.ROTATE,this.touches.ONE=p.TOUCH.PAN,this.touches.TWO=p.TOUCH.DOLLY_ROTATE}}var kf=Object.defineProperty,Uf=(r,e,t)=>e in r?kf(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,mn=(r,e,t)=>(Uf(r,typeof e!="symbol"?e+"":e,t),t);class vr{constructor(){mn(this,"enabled",!0),mn(this,"needsSwap",!0),mn(this,"clear",!1),mn(this,"renderToScreen",!1)}setSize(e,t){}render(e,t,i,n,s){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}class jl{constructor(e){mn(this,"camera",new p.OrthographicCamera(-1,1,1,-1,0,1)),mn(this,"geometry",new p.PlaneGeometry(2,2)),mn(this,"mesh"),this.mesh=new p.Mesh(this.geometry,e)}get material(){return this.mesh.material}set material(e){this.mesh.material=e}dispose(){this.mesh.geometry.dispose()}render(e){e.render(this.mesh,this.camera)}}var Nf=Object.defineProperty,Kf=(r,e,t)=>e in r?Nf(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ss=(r,e,t)=>(Kf(r,typeof e!="symbol"?e+"":e,t),t);class Jl extends vr{constructor(e,t="tDiffuse"){super(),ss(this,"textureID"),ss(this,"uniforms"),ss(this,"material"),ss(this,"fsQuad"),this.textureID=t,e instanceof p.ShaderMaterial?(this.uniforms=e.uniforms,this.material=e):(this.uniforms=p.UniformsUtils.clone(e.uniforms),this.material=new p.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new jl(this.material)}render(e,t,i){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=i.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.fsQuad.dispose(),this.material.dispose()}}const To={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`
98
+ varying vec2 vUv;
99
+
100
+ void main() {
101
+
102
+ vUv = uv;
103
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
104
+
105
+ }
106
+ `,fragmentShader:`
107
+ uniform float opacity;
108
+
109
+ uniform sampler2D tDiffuse;
110
+
111
+ varying vec2 vUv;
112
+
113
+ void main() {
114
+
115
+ vec4 texel = texture2D( tDiffuse, vUv );
116
+ gl_FragColor = opacity * texel;
117
+
118
+ }
119
+ `},Bf={uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new p.Color(0)},defaultOpacity:{value:0}},vertexShader:`
120
+ varying vec2 vUv;
121
+
122
+ void main() {
123
+
124
+ vUv = uv;
125
+
126
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
127
+
128
+ }
129
+ `,fragmentShader:`
130
+ uniform sampler2D tDiffuse;
131
+ uniform vec3 defaultColor;
132
+ uniform float defaultOpacity;
133
+ uniform float luminosityThreshold;
134
+ uniform float smoothWidth;
135
+
136
+ varying vec2 vUv;
137
+
138
+ void main() {
139
+
140
+ vec4 texel = texture2D( tDiffuse, vUv );
141
+
142
+ vec3 luma = vec3( 0.299, 0.587, 0.114 );
143
+
144
+ float v = dot( texel.xyz, luma );
145
+
146
+ vec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );
147
+
148
+ float alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );
149
+
150
+ gl_FragColor = mix( outputColor, texel, alpha );
151
+
152
+ }
153
+ `};var Yf=Object.defineProperty,Rf=(r,e,t)=>e in r?Yf(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ql=(r,e,t)=>(Rf(r,typeof e!="symbol"?e+"":e,t),t);const jf=(()=>{const r=class extends vr{constructor(t,i,n,s){super(),this.strength=i!==void 0?i:1,this.radius=n,this.threshold=s,this.resolution=t!==void 0?new p.Vector2(t.x,t.y):new p.Vector2(256,256),this.clearColor=new p.Color(0,0,0),this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let a=Math.round(this.resolution.x/2),c=Math.round(this.resolution.y/2);this.renderTargetBright=new p.WebGLRenderTarget(a,c,{type:p.HalfFloatType}),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let g=0;g<this.nMips;g++){const _=new p.WebGLRenderTarget(a,c,{type:p.HalfFloatType});_.texture.name="UnrealBloomPass.h"+g,_.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(_);const w=new p.WebGLRenderTarget(a,c,{type:p.HalfFloatType});w.texture.name="UnrealBloomPass.v"+g,w.texture.generateMipmaps=!1,this.renderTargetsVertical.push(w),a=Math.round(a/2),c=Math.round(c/2)}const h=Bf;this.highPassUniforms=p.UniformsUtils.clone(h.uniforms),this.highPassUniforms.luminosityThreshold.value=s,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new p.ShaderMaterial({uniforms:this.highPassUniforms,vertexShader:h.vertexShader,fragmentShader:h.fragmentShader,defines:{}}),this.separableBlurMaterials=[];const d=[3,5,7,9,11];a=Math.round(this.resolution.x/2),c=Math.round(this.resolution.y/2);for(let g=0;g<this.nMips;g++)this.separableBlurMaterials.push(this.getSeperableBlurMaterial(d[g])),this.separableBlurMaterials[g].uniforms.texSize.value=new p.Vector2(a,c),a=Math.round(a/2),c=Math.round(c/2);this.compositeMaterial=this.getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=i,this.compositeMaterial.uniforms.bloomRadius.value=.1,this.compositeMaterial.needsUpdate=!0;const m=[1,.8,.6,.4,.2];this.compositeMaterial.uniforms.bloomFactors.value=m,this.bloomTintColors=[new p.Vector3(1,1,1),new p.Vector3(1,1,1),new p.Vector3(1,1,1),new p.Vector3(1,1,1),new p.Vector3(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors;const f=To;this.copyUniforms=p.UniformsUtils.clone(f.uniforms),this.copyUniforms.opacity.value=1,this.materialCopy=new p.ShaderMaterial({uniforms:this.copyUniforms,vertexShader:f.vertexShader,fragmentShader:f.fragmentShader,blending:p.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this._oldClearColor=new p.Color,this.oldClearAlpha=1,this.basic=new p.MeshBasicMaterial,this.fsQuad=new jl(null)}dispose(){for(let t=0;t<this.renderTargetsHorizontal.length;t++)this.renderTargetsHorizontal[t].dispose();for(let t=0;t<this.renderTargetsVertical.length;t++)this.renderTargetsVertical[t].dispose();this.renderTargetBright.dispose();for(let t=0;t<this.separableBlurMaterials.length;t++)this.separableBlurMaterials[t].dispose();this.compositeMaterial.dispose(),this.materialCopy.dispose(),this.basic.dispose(),this.fsQuad.dispose()}setSize(t,i){let n=Math.round(t/2),s=Math.round(i/2);this.renderTargetBright.setSize(n,s);for(let a=0;a<this.nMips;a++)this.renderTargetsHorizontal[a].setSize(n,s),this.renderTargetsVertical[a].setSize(n,s),this.separableBlurMaterials[a].uniforms.texSize.value=new p.Vector2(n,s),n=Math.round(n/2),s=Math.round(s/2)}render(t,i,n,s,a){t.getClearColor(this._oldClearColor),this.oldClearAlpha=t.getClearAlpha();const c=t.autoClear;t.autoClear=!1,t.setClearColor(this.clearColor,0),a&&t.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=n.texture,t.setRenderTarget(null),t.clear(),this.fsQuad.render(t)),this.highPassUniforms.tDiffuse.value=n.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,t.setRenderTarget(this.renderTargetBright),t.clear(),this.fsQuad.render(t);let h=this.renderTargetBright;for(let d=0;d<this.nMips;d++)this.fsQuad.material=this.separableBlurMaterials[d],this.separableBlurMaterials[d].uniforms.colorTexture.value=h.texture,this.separableBlurMaterials[d].uniforms.direction.value=r.BlurDirectionX,t.setRenderTarget(this.renderTargetsHorizontal[d]),t.clear(),this.fsQuad.render(t),this.separableBlurMaterials[d].uniforms.colorTexture.value=this.renderTargetsHorizontal[d].texture,this.separableBlurMaterials[d].uniforms.direction.value=r.BlurDirectionY,t.setRenderTarget(this.renderTargetsVertical[d]),t.clear(),this.fsQuad.render(t),h=this.renderTargetsVertical[d];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,t.setRenderTarget(this.renderTargetsHorizontal[0]),t.clear(),this.fsQuad.render(t),this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,a&&t.state.buffers.stencil.setTest(!0),this.renderToScreen?(t.setRenderTarget(null),this.fsQuad.render(t)):(t.setRenderTarget(n),this.fsQuad.render(t)),t.setClearColor(this._oldClearColor,this.oldClearAlpha),t.autoClear=c}getSeperableBlurMaterial(t){return new p.ShaderMaterial({defines:{KERNEL_RADIUS:t,SIGMA:t},uniforms:{colorTexture:{value:null},texSize:{value:new p.Vector2(.5,.5)},direction:{value:new p.Vector2(.5,.5)}},vertexShader:`varying vec2 vUv;
154
+ void main() {
155
+ vUv = uv;
156
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
157
+ }`,fragmentShader:`#include <common>
158
+ varying vec2 vUv;
159
+ uniform sampler2D colorTexture;
160
+ uniform vec2 texSize;
161
+ uniform vec2 direction;
162
+
163
+ float gaussianPdf(in float x, in float sigma) {
164
+ return 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;
165
+ }
166
+ void main() {
167
+ vec2 invSize = 1.0 / texSize;
168
+ float fSigma = float(SIGMA);
169
+ float weightSum = gaussianPdf(0.0, fSigma);
170
+ vec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum;
171
+ for( int i = 1; i < KERNEL_RADIUS; i ++ ) {
172
+ float x = float(i);
173
+ float w = gaussianPdf(x, fSigma);
174
+ vec2 uvOffset = direction * invSize * x;
175
+ vec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb;
176
+ vec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb;
177
+ diffuseSum += (sample1 + sample2) * w;
178
+ weightSum += 2.0 * w;
179
+ }
180
+ gl_FragColor = vec4(diffuseSum/weightSum, 1.0);
181
+ }`})}getCompositeMaterial(t){return new p.ShaderMaterial({defines:{NUM_MIPS:t},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:`varying vec2 vUv;
182
+ void main() {
183
+ vUv = uv;
184
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
185
+ }`,fragmentShader:`varying vec2 vUv;
186
+ uniform sampler2D blurTexture1;
187
+ uniform sampler2D blurTexture2;
188
+ uniform sampler2D blurTexture3;
189
+ uniform sampler2D blurTexture4;
190
+ uniform sampler2D blurTexture5;
191
+ uniform float bloomStrength;
192
+ uniform float bloomRadius;
193
+ uniform float bloomFactors[NUM_MIPS];
194
+ uniform vec3 bloomTintColors[NUM_MIPS];
195
+
196
+ float lerpBloomFactor(const in float factor) {
197
+ float mirrorFactor = 1.2 - factor;
198
+ return mix(factor, mirrorFactor, bloomRadius);
199
+ }
200
+
201
+ void main() {
202
+ gl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +
203
+ lerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +
204
+ lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +
205
+ lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +
206
+ lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );
207
+ }`})}};let e=r;return Ql(e,"BlurDirectionX",new p.Vector2(1,0)),Ql(e,"BlurDirectionY",new p.Vector2(0,1)),e})();var Jf=Object.defineProperty,Qf=(r,e,t)=>e in r?Jf(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Go=(r,e,t)=>(Qf(r,typeof e!="symbol"?e+"":e,t),t);class Hl extends vr{constructor(e,t){super(),Go(this,"scene"),Go(this,"camera"),Go(this,"inverse"),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,i){const n=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0);let a,c;this.inverse?(a=0,c=1):(a=1,c=0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(n.REPLACE,n.REPLACE,n.REPLACE),s.buffers.stencil.setFunc(n.ALWAYS,a,4294967295),s.buffers.stencil.setClear(c),s.buffers.stencil.setLocked(!0),e.setRenderTarget(i),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(n.EQUAL,1,4294967295),s.buffers.stencil.setOp(n.KEEP,n.KEEP,n.KEEP),s.buffers.stencil.setLocked(!0)}}class Hf extends vr{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}var $f=Object.defineProperty,Ef=(r,e,t)=>e in r?$f(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Bt=(r,e,t)=>(Ef(r,typeof e!="symbol"?e+"":e,t),t);class qf{constructor(e,t){if(Bt(this,"renderer"),Bt(this,"_pixelRatio"),Bt(this,"_width"),Bt(this,"_height"),Bt(this,"renderTarget1"),Bt(this,"renderTarget2"),Bt(this,"writeBuffer"),Bt(this,"readBuffer"),Bt(this,"renderToScreen"),Bt(this,"passes",[]),Bt(this,"copyPass"),Bt(this,"clock"),this.renderer=e,t===void 0){const i={minFilter:p.LinearFilter,magFilter:p.LinearFilter,format:p.RGBAFormat},n=e.getSize(new p.Vector2);this._pixelRatio=e.getPixelRatio(),this._width=n.width,this._height=n.height,t=new p.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio,i),t.texture.name="EffectComposer.rt1"}else this._pixelRatio=1,this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,To===void 0&&console.error("THREE.EffectComposer relies on CopyShader"),Jl===void 0&&console.error("THREE.EffectComposer relies on ShaderPass"),this.copyPass=new Jl(To),this.copyPass.material.blending=p.NoBlending,this.clock=new p.Clock}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){e===void 0&&(e=this.clock.getDelta());const t=this.renderer.getRenderTarget();let i=!1;const n=this.passes.length;for(let s=0;s<n;s++){const a=this.passes[s];if(a.enabled!==!1){if(a.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(s),a.render(this.renderer,this.writeBuffer,this.readBuffer,e,i),a.needsSwap){if(i){const c=this.renderer.getContext(),h=this.renderer.state.buffers.stencil;h.setFunc(c.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),h.setFunc(c.EQUAL,1,4294967295)}this.swapBuffers()}Hl!==void 0&&(a instanceof Hl?i=!0:a instanceof Hf&&(i=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(e===void 0){const t=this.renderer.getSize(new p.Vector2);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,e=this.renderTarget1.clone(),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;const i=this._width*this._pixelRatio,n=this._height*this._pixelRatio;this.renderTarget1.setSize(i,n),this.renderTarget2.setSize(i,n);for(let s=0;s<this.passes.length;s++)this.passes[s].setSize(i,n)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}var ep=Object.defineProperty,tp=(r,e,t)=>e in r?ep(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,gn=(r,e,t)=>(tp(r,typeof e!="symbol"?e+"":e,t),t);class ip extends vr{constructor(e,t,i,n,s=0){super(),gn(this,"scene"),gn(this,"camera"),gn(this,"overrideMaterial"),gn(this,"clearColor"),gn(this,"clearAlpha"),gn(this,"clearDepth",!1),gn(this,"_oldClearColor",new p.Color),this.scene=e,this.camera=t,this.overrideMaterial=i,this.clearColor=n,this.clearAlpha=s,this.clear=!0,this.needsSwap=!1}render(e,t,i){let n=e.autoClear;e.autoClear=!1;let s,a=null;this.overrideMaterial!==void 0&&(a=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this._oldClearColor),s=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:i),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor&&e.setClearColor(this._oldClearColor,s),this.overrideMaterial!==void 0&&(this.scene.overrideMaterial=a),e.autoClear=n}}function Bn(r){if(typeof TextDecoder<"u")return new TextDecoder().decode(r);let e="";for(let t=0,i=r.length;t<i;t++)e+=String.fromCharCode(r[t]);try{return decodeURIComponent(escape(e))}catch{return e}}const yn="srgb",Pi="srgb-linear",$l=3001,np=3e3;class rp extends p.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new cp(t)}),this.register(function(t){return new hp(t)}),this.register(function(t){return new vp(t)}),this.register(function(t){return new wp(t)}),this.register(function(t){return new bp(t)}),this.register(function(t){return new dp(t)}),this.register(function(t){return new fp(t)}),this.register(function(t){return new pp(t)}),this.register(function(t){return new mp(t)}),this.register(function(t){return new lp(t)}),this.register(function(t){return new gp(t)}),this.register(function(t){return new up(t)}),this.register(function(t){return new _p(t)}),this.register(function(t){return new yp(t)}),this.register(function(t){return new op(t)}),this.register(function(t){return new xp(t)}),this.register(function(t){return new Mp(t)})}load(e,t,i,n){const s=this;let a;if(this.resourcePath!=="")a=this.resourcePath;else if(this.path!==""){const d=p.LoaderUtils.extractUrlBase(e);a=p.LoaderUtils.resolveURL(d,this.path)}else a=p.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const c=function(d){n?n(d):console.error(d),s.manager.itemError(e),s.manager.itemEnd(e)},h=new p.FileLoader(this.manager);h.setPath(this.path),h.setResponseType("arraybuffer"),h.setRequestHeader(this.requestHeader),h.setWithCredentials(this.withCredentials),h.load(e,function(d){try{s.parse(d,a,function(m){t(m),s.manager.itemEnd(e)},c)}catch(m){c(m)}},i,c)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,i,n){let s;const a={},c={};if(typeof e=="string")s=JSON.parse(e);else if(e instanceof ArrayBuffer)if(Bn(new Uint8Array(e.slice(0,4)))===El){try{a[_e.KHR_BINARY_GLTF]=new Sp(e)}catch(m){n&&n(m);return}s=JSON.parse(a[_e.KHR_BINARY_GLTF].content)}else s=JSON.parse(Bn(new Uint8Array(e)));else s=e;if(s.asset===void 0||s.asset.version[0]<2){n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const h=new zp(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});h.fileLoader.setRequestHeader(this.requestHeader);for(let d=0;d<this.pluginCallbacks.length;d++){const m=this.pluginCallbacks[d](h);m.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),c[m.name]=m,a[m.name]=!0}if(s.extensionsUsed)for(let d=0;d<s.extensionsUsed.length;++d){const m=s.extensionsUsed[d],f=s.extensionsRequired||[];switch(m){case _e.KHR_MATERIALS_UNLIT:a[m]=new ap;break;case _e.KHR_DRACO_MESH_COMPRESSION:a[m]=new Lp(s,this.dracoLoader);break;case _e.KHR_TEXTURE_TRANSFORM:a[m]=new Pp;break;case _e.KHR_MESH_QUANTIZATION:a[m]=new Cp;break;default:f.indexOf(m)>=0&&c[m]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+m+'".')}}h.setExtensions(a),h.setPlugins(c),h.parse(i,n)}parseAsync(e,t){const i=this;return new Promise(function(n,s){i.parse(e,t,n,s)})}}function sp(){let r={};return{get:function(e){return r[e]},add:function(e,t){r[e]=t},remove:function(e){delete r[e]},removeAll:function(){r={}}}}const _e={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 op{constructor(e){this.parser=e,this.name=_e.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let i=0,n=t.length;i<n;i++){const s=t[i];s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){const t=this.parser,i="light:"+e;let n=t.cache.get(i);if(n)return n;const s=t.json,h=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e];let d;const m=new p.Color(16777215);h.color!==void 0&&m.setRGB(h.color[0],h.color[1],h.color[2],Pi);const f=h.range!==void 0?h.range:0;switch(h.type){case"directional":d=new p.DirectionalLight(m),d.target.position.set(0,0,-1),d.add(d.target);break;case"point":d=new p.PointLight(m),d.distance=f;break;case"spot":d=new p.SpotLight(m),d.distance=f,h.spot=h.spot||{},h.spot.innerConeAngle=h.spot.innerConeAngle!==void 0?h.spot.innerConeAngle:0,h.spot.outerConeAngle=h.spot.outerConeAngle!==void 0?h.spot.outerConeAngle:Math.PI/4,d.angle=h.spot.outerConeAngle,d.penumbra=1-h.spot.innerConeAngle/h.spot.outerConeAngle,d.target.position.set(0,0,-1),d.add(d.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+h.type)}return d.position.set(0,0,0),d.decay=2,Ci(d,h),h.intensity!==void 0&&(d.intensity=h.intensity),d.name=t.createUniqueName(h.name||"light_"+e),n=Promise.resolve(d),t.cache.add(i,n),n}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,i=this.parser,s=i.json.nodes[e],c=(s.extensions&&s.extensions[this.name]||{}).light;return c===void 0?null:this._loadLight(c).then(function(h){return i._getNodeRef(t.cache,c,h)})}}class ap{constructor(){this.name=_e.KHR_MATERIALS_UNLIT}getMaterialType(){return p.MeshBasicMaterial}extendParams(e,t,i){const n=[];e.color=new p.Color(1,1,1),e.opacity=1;const s=t.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){const a=s.baseColorFactor;e.color.setRGB(a[0],a[1],a[2],Pi),e.opacity=a[3]}s.baseColorTexture!==void 0&&n.push(i.assignTexture(e,"map",s.baseColorTexture,yn))}return Promise.all(n)}}class lp{constructor(e){this.parser=e,this.name=_e.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=n.extensions[this.name].emissiveStrength;return s!==void 0&&(t.emissiveIntensity=s),Promise.resolve()}}class cp{constructor(e){this.parser=e,this.name=_e.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],a=n.extensions[this.name];if(a.clearcoatFactor!==void 0&&(t.clearcoat=a.clearcoatFactor),a.clearcoatTexture!==void 0&&s.push(i.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),a.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),a.clearcoatRoughnessTexture!==void 0&&s.push(i.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),a.clearcoatNormalTexture!==void 0&&(s.push(i.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),a.clearcoatNormalTexture.scale!==void 0)){const c=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new p.Vector2(c,c)}return Promise.all(s)}}class hp{constructor(e){this.parser=e,this.name=_e.KHR_MATERIALS_DISPERSION}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=n.extensions[this.name];return t.dispersion=s.dispersion!==void 0?s.dispersion:0,Promise.resolve()}}class up{constructor(e){this.parser=e,this.name=_e.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],a=n.extensions[this.name];return a.iridescenceFactor!==void 0&&(t.iridescence=a.iridescenceFactor),a.iridescenceTexture!==void 0&&s.push(i.assignTexture(t,"iridescenceMap",a.iridescenceTexture)),a.iridescenceIor!==void 0&&(t.iridescenceIOR=a.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),a.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),a.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),a.iridescenceThicknessTexture!==void 0&&s.push(i.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(s)}}class dp{constructor(e){this.parser=e,this.name=_e.KHR_MATERIALS_SHEEN}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[];t.sheenColor=new p.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const a=n.extensions[this.name];if(a.sheenColorFactor!==void 0){const c=a.sheenColorFactor;t.sheenColor.setRGB(c[0],c[1],c[2],Pi)}return a.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=a.sheenRoughnessFactor),a.sheenColorTexture!==void 0&&s.push(i.assignTexture(t,"sheenColorMap",a.sheenColorTexture,yn)),a.sheenRoughnessTexture!==void 0&&s.push(i.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(s)}}class fp{constructor(e){this.parser=e,this.name=_e.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],a=n.extensions[this.name];return a.transmissionFactor!==void 0&&(t.transmission=a.transmissionFactor),a.transmissionTexture!==void 0&&s.push(i.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(s)}}class pp{constructor(e){this.parser=e,this.name=_e.KHR_MATERIALS_VOLUME}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],a=n.extensions[this.name];t.thickness=a.thicknessFactor!==void 0?a.thicknessFactor:0,a.thicknessTexture!==void 0&&s.push(i.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||1/0;const c=a.attenuationColor||[1,1,1];return t.attenuationColor=new p.Color().setRGB(c[0],c[1],c[2],Pi),Promise.all(s)}}class mp{constructor(e){this.parser=e,this.name=_e.KHR_MATERIALS_IOR}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=n.extensions[this.name];return t.ior=s.ior!==void 0?s.ior:1.5,Promise.resolve()}}class gp{constructor(e){this.parser=e,this.name=_e.KHR_MATERIALS_SPECULAR}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],a=n.extensions[this.name];t.specularIntensity=a.specularFactor!==void 0?a.specularFactor:1,a.specularTexture!==void 0&&s.push(i.assignTexture(t,"specularIntensityMap",a.specularTexture));const c=a.specularColorFactor||[1,1,1];return t.specularColor=new p.Color().setRGB(c[0],c[1],c[2],Pi),a.specularColorTexture!==void 0&&s.push(i.assignTexture(t,"specularColorMap",a.specularColorTexture,yn)),Promise.all(s)}}class yp{constructor(e){this.parser=e,this.name=_e.EXT_MATERIALS_BUMP}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],a=n.extensions[this.name];return t.bumpScale=a.bumpFactor!==void 0?a.bumpFactor:1,a.bumpTexture!==void 0&&s.push(i.assignTexture(t,"bumpMap",a.bumpTexture)),Promise.all(s)}}class _p{constructor(e){this.parser=e,this.name=_e.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:p.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],a=n.extensions[this.name];return a.anisotropyStrength!==void 0&&(t.anisotropy=a.anisotropyStrength),a.anisotropyRotation!==void 0&&(t.anisotropyRotation=a.anisotropyRotation),a.anisotropyTexture!==void 0&&s.push(i.assignTexture(t,"anisotropyMap",a.anisotropyTexture)),Promise.all(s)}}class vp{constructor(e){this.parser=e,this.name=_e.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,i=t.json,n=i.textures[e];if(!n.extensions||!n.extensions[this.name])return null;const s=n.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(i.extensionsRequired&&i.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,a)}}class wp{constructor(e){this.parser=e,this.name=_e.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,n=i.json,s=n.textures[e];if(!s.extensions||!s.extensions[t])return null;const a=s.extensions[t],c=n.images[a.source];let h=i.textureLoader;if(c.uri){const d=i.options.manager.getHandler(c.uri);d!==null&&(h=d)}return this.detectSupport().then(function(d){if(d)return i.loadTextureImage(e,a.source,h);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class bp{constructor(e){this.parser=e,this.name=_e.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,n=i.json,s=n.textures[e];if(!s.extensions||!s.extensions[t])return null;const a=s.extensions[t],c=n.images[a.source];let h=i.textureLoader;if(c.uri){const d=i.options.manager.getHandler(c.uri);d!==null&&(h=d)}return this.detectSupport().then(function(d){if(d)return i.loadTextureImage(e,a.source,h);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class xp{constructor(e){this.name=_e.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,i=t.bufferViews[e];if(i.extensions&&i.extensions[this.name]){const n=i.extensions[this.name],s=this.parser.getDependency("buffer",n.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.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 h=n.byteOffset||0,d=n.byteLength||0,m=n.count,f=n.byteStride,g=new Uint8Array(c,h,d);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(m,f,g,n.mode,n.filter).then(function(_){return _.buffer}):a.ready.then(function(){const _=new ArrayBuffer(m*f);return a.decodeGltfBuffer(new Uint8Array(_),m,f,g,n.mode,n.filter),_})})}else return null}}class Mp{constructor(e){this.name=_e.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,i=t.nodes[e];if(!i.extensions||!i.extensions[this.name]||i.mesh===void 0)return null;const n=t.meshes[i.mesh];for(const d of n.primitives)if(d.mode!==Yt.TRIANGLES&&d.mode!==Yt.TRIANGLE_STRIP&&d.mode!==Yt.TRIANGLE_FAN&&d.mode!==void 0)return null;const a=i.extensions[this.name].attributes,c=[],h={};for(const d in a)c.push(this.parser.getDependency("accessor",a[d]).then(m=>(h[d]=m,h[d])));return c.length<1?null:(c.push(this.parser.createNodeMesh(e)),Promise.all(c).then(d=>{const m=d.pop(),f=m.isGroup?m.children:[m],g=d[0].count,_=[];for(const w of f){const b=new p.Matrix4,x=new p.Vector3,L=new p.Quaternion,M=new p.Vector3(1,1,1),C=new p.InstancedMesh(w.geometry,w.material,g);for(let W=0;W<g;W++)h.TRANSLATION&&x.fromBufferAttribute(h.TRANSLATION,W),h.ROTATION&&L.fromBufferAttribute(h.ROTATION,W),h.SCALE&&M.fromBufferAttribute(h.SCALE,W),C.setMatrixAt(W,b.compose(x,L,M));for(const W in h)if(W==="_COLOR_0"){const D=h[W];C.instanceColor=new p.InstancedBufferAttribute(D.array,D.itemSize,D.normalized)}else W!=="TRANSLATION"&&W!=="ROTATION"&&W!=="SCALE"&&w.geometry.setAttribute(W,h[W]);p.Object3D.prototype.copy.call(C,w),this.parser.assignFinalMaterial(C),_.push(C)}return m.isGroup?(m.clear(),m.add(..._),m):_[0]}))}}const El="glTF",wr=12,ql={JSON:1313821514,BIN:5130562};class Sp{constructor(e){this.name=_e.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,wr);if(this.header={magic:Bn(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==El)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-wr,n=new DataView(e,wr);let s=0;for(;s<i;){const a=n.getUint32(s,!0);s+=4;const c=n.getUint32(s,!0);if(s+=4,c===ql.JSON){const h=new Uint8Array(e,wr+s,a);this.content=Bn(h)}else if(c===ql.BIN){const h=wr+s;this.body=e.slice(h,h+a)}s+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Lp{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=_e.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const i=this.json,n=this.dracoLoader,s=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,c={},h={},d={};for(const m in a){const f=Zo[m]||m.toLowerCase();c[f]=a[m]}for(const m in e.attributes){const f=Zo[m]||m.toLowerCase();if(a[m]!==void 0){const g=i.accessors[e.attributes[m]],_=Yn[g.componentType];d[f]=_.name,h[f]=g.normalized===!0}}return t.getDependency("bufferView",s).then(function(m){return new Promise(function(f,g){n.decodeDracoFile(m,function(_){for(const w in _.attributes){const b=_.attributes[w],x=h[w];x!==void 0&&(b.normalized=x)}f(_)},c,d,Pi,g)})})}}class Pp{constructor(){this.name=_e.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class Cp{constructor(){this.name=_e.KHR_MESH_QUANTIZATION}}class ec extends p.Interpolant{constructor(e,t,i,n){super(e,t,i,n)}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,n=this.valueSize,s=e*n*3+n;for(let a=0;a!==n;a++)t[a]=i[s+a];return t}interpolate_(e,t,i,n){const s=this.resultBuffer,a=this.sampleValues,c=this.valueSize,h=c*2,d=c*3,m=n-t,f=(i-t)/m,g=f*f,_=g*f,w=e*d,b=w-d,x=-2*_+3*g,L=_-g,M=1-x,C=L-g+f;for(let W=0;W!==c;W++){const D=a[b+W+c],z=a[b+W+h]*m,X=a[w+W+c],I=a[w+W]*m;s[W]=M*D+C*z+x*X+L*I}return s}}const Tp=new p.Quaternion;class Gp extends ec{interpolate_(e,t,i,n){const s=super.interpolate_(e,t,i,n);return Tp.fromArray(s).normalize().toArray(s),s}}const Yt={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},Yn={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},tc={9728:p.NearestFilter,9729:p.LinearFilter,9984:p.NearestMipmapNearestFilter,9985:p.LinearMipmapNearestFilter,9986:p.NearestMipmapLinearFilter,9987:p.LinearMipmapLinearFilter},ic={33071:p.ClampToEdgeWrapping,33648:p.MirroredRepeatWrapping,10497:p.RepeatWrapping},Wo={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Zo={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",...ns>=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"},Ui={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Wp={CUBICSPLINE:void 0,LINEAR:p.InterpolateLinear,STEP:p.InterpolateDiscrete},Vo={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Zp(r){return r.DefaultMaterial===void 0&&(r.DefaultMaterial=new p.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:p.FrontSide})),r.DefaultMaterial}function _n(r,e,t){for(const i in t.extensions)r[i]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[i]=t.extensions[i])}function Ci(r,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(r.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Vp(r,e,t){let i=!1,n=!1,s=!1;for(let d=0,m=e.length;d<m;d++){const f=e[d];if(f.POSITION!==void 0&&(i=!0),f.NORMAL!==void 0&&(n=!0),f.COLOR_0!==void 0&&(s=!0),i&&n&&s)break}if(!i&&!n&&!s)return Promise.resolve(r);const a=[],c=[],h=[];for(let d=0,m=e.length;d<m;d++){const f=e[d];if(i){const g=f.POSITION!==void 0?t.getDependency("accessor",f.POSITION):r.attributes.position;a.push(g)}if(n){const g=f.NORMAL!==void 0?t.getDependency("accessor",f.NORMAL):r.attributes.normal;c.push(g)}if(s){const g=f.COLOR_0!==void 0?t.getDependency("accessor",f.COLOR_0):r.attributes.color;h.push(g)}}return Promise.all([Promise.all(a),Promise.all(c),Promise.all(h)]).then(function(d){const m=d[0],f=d[1],g=d[2];return i&&(r.morphAttributes.position=m),n&&(r.morphAttributes.normal=f),s&&(r.morphAttributes.color=g),r.morphTargetsRelative=!0,r})}function Ip(r,e){if(r.updateMorphTargets(),e.weights!==void 0)for(let t=0,i=e.weights.length;t<i;t++)r.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(r.morphTargetInfluences.length===t.length){r.morphTargetDictionary={};for(let i=0,n=t.length;i<n;i++)r.morphTargetDictionary[t[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Ap(r){let e;const t=r.extensions&&r.extensions[_e.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Io(t.attributes):e=r.indices+":"+Io(r.attributes)+":"+r.mode,r.targets!==void 0)for(let i=0,n=r.targets.length;i<n;i++)e+=":"+Io(r.targets[i]);return e}function Io(r){let e="";const t=Object.keys(r).sort();for(let i=0,n=t.length;i<n;i++)e+=t[i]+":"+r[t[i]]+";";return e}function Ao(r){switch(r){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 Fp(r){return r.search(/\.jpe?g($|\?)/i)>0||r.search(/^data\:image\/jpeg/)===0?"image/jpeg":r.search(/\.webp($|\?)/i)>0||r.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const Op=new p.Matrix4;class zp{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new sp,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 i=!1,n=!1,s=-1;typeof navigator<"u"&&typeof navigator.userAgent<"u"&&(i=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,n=navigator.userAgent.indexOf("Firefox")>-1,s=n?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||i||n&&s<98?this.textureLoader=new p.TextureLoader(this.options.manager):this.textureLoader=new p.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new p.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const i=this,n=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(a){return a._markDefs&&a._markDefs()}),Promise.all(this._invokeAll(function(a){return a.beforeRoot&&a.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(a){const c={scene:a[0][n.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:n.asset,parser:i,userData:{}};return _n(s,c,n),Ci(c,n),Promise.all(i._invokeAll(function(h){return h.afterRoot&&h.afterRoot(c)})).then(function(){for(const h of c.scenes)h.updateMatrixWorld();e(c)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let n=0,s=t.length;n<s;n++){const a=t[n].joints;for(let c=0,h=a.length;c<h;c++)e[a[c]].isBone=!0}for(let n=0,s=e.length;n<s;n++){const a=e[n];a.mesh!==void 0&&(this._addNodeRef(this.meshCache,a.mesh),a.skin!==void 0&&(i[a.mesh].isSkinnedMesh=!0)),a.camera!==void 0&&this._addNodeRef(this.cameraCache,a.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,i){if(e.refs[t]<=1)return i;const n=i.clone(),s=(a,c)=>{const h=this.associations.get(a);h!=null&&this.associations.set(c,h);for(const[d,m]of a.children.entries())s(m,c.children[d])};return s(i,n),n.name+="_instance_"+e.uses[t]++,n}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let i=0;i<t.length;i++){const n=e(t[i]);if(n)return n}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const i=[];for(let n=0;n<t.length;n++){const s=e(t[n]);s&&i.push(s)}return i}getDependency(e,t){const i=e+":"+t;let n=this.cache.get(i);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this._invokeOne(function(s){return s.loadNode&&s.loadNode(t)});break;case"mesh":n=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(t)});break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(t)});break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(t)});break;case"texture":n=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(t)});break;case"skin":n=this.loadSkin(t);break;case"animation":n=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(t)});break;case"camera":n=this.loadCamera(t);break;default:if(n=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(e,t)}),!n)throw new Error("Unknown type: "+e);break}this.cache.add(i,n)}return n}getDependencies(e){let t=this.cache.get(e);if(!t){const i=this,n=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(n.map(function(s,a){return i.getDependency(e,a)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],i=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[_e.KHR_BINARY_GLTF].body);const n=this.options;return new Promise(function(s,a){i.load(p.LoaderUtils.resolveURL(t.uri,n.path),s,void 0,function(){a(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(i){const n=t.byteLength||0,s=t.byteOffset||0;return i.slice(s,s+n)})}loadAccessor(e){const t=this,i=this.json,n=this.json.accessors[e];if(n.bufferView===void 0&&n.sparse===void 0){const a=Wo[n.type],c=Yn[n.componentType],h=n.normalized===!0,d=new c(n.count*a);return Promise.resolve(new p.BufferAttribute(d,a,h))}const s=[];return n.bufferView!==void 0?s.push(this.getDependency("bufferView",n.bufferView)):s.push(null),n.sparse!==void 0&&(s.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(s).then(function(a){const c=a[0],h=Wo[n.type],d=Yn[n.componentType],m=d.BYTES_PER_ELEMENT,f=m*h,g=n.byteOffset||0,_=n.bufferView!==void 0?i.bufferViews[n.bufferView].byteStride:void 0,w=n.normalized===!0;let b,x;if(_&&_!==f){const L=Math.floor(g/_),M="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+L+":"+n.count;let C=t.cache.get(M);C||(b=new d(c,L*_,n.count*_/m),C=new p.InterleavedBuffer(b,_/m),t.cache.add(M,C)),x=new p.InterleavedBufferAttribute(C,h,g%_/m,w)}else c===null?b=new d(n.count*h):b=new d(c,g,n.count*h),x=new p.BufferAttribute(b,h,w);if(n.sparse!==void 0){const L=Wo.SCALAR,M=Yn[n.sparse.indices.componentType],C=n.sparse.indices.byteOffset||0,W=n.sparse.values.byteOffset||0,D=new M(a[1],C,n.sparse.count*L),z=new d(a[2],W,n.sparse.count*h);c!==null&&(x=new p.BufferAttribute(x.array.slice(),x.itemSize,x.normalized));for(let X=0,I=D.length;X<I;X++){const U=D[X];if(x.setX(U,z[X*h]),h>=2&&x.setY(U,z[X*h+1]),h>=3&&x.setZ(U,z[X*h+2]),h>=4&&x.setW(U,z[X*h+3]),h>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return x})}loadTexture(e){const t=this.json,i=this.options,s=t.textures[e].source,a=t.images[s];let c=this.textureLoader;if(a.uri){const h=i.manager.getHandler(a.uri);h!==null&&(c=h)}return this.loadTextureImage(e,s,c)}loadTextureImage(e,t,i){const n=this,s=this.json,a=s.textures[e],c=s.images[t],h=(c.uri||c.bufferView)+":"+a.sampler;if(this.textureCache[h])return this.textureCache[h];const d=this.loadImageSource(t,i).then(function(m){m.flipY=!1,m.name=a.name||c.name||"",m.name===""&&typeof c.uri=="string"&&c.uri.startsWith("data:image/")===!1&&(m.name=c.uri);const g=(s.samplers||{})[a.sampler]||{};return m.magFilter=tc[g.magFilter]||p.LinearFilter,m.minFilter=tc[g.minFilter]||p.LinearMipmapLinearFilter,m.wrapS=ic[g.wrapS]||p.RepeatWrapping,m.wrapT=ic[g.wrapT]||p.RepeatWrapping,n.associations.set(m,{textures:e}),m}).catch(function(){return null});return this.textureCache[h]=d,d}loadImageSource(e,t){const i=this,n=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(f=>f.clone());const a=n.images[e],c=self.URL||self.webkitURL;let h=a.uri||"",d=!1;if(a.bufferView!==void 0)h=i.getDependency("bufferView",a.bufferView).then(function(f){d=!0;const g=new Blob([f],{type:a.mimeType});return h=c.createObjectURL(g),h});else if(a.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const m=Promise.resolve(h).then(function(f){return new Promise(function(g,_){let w=g;t.isImageBitmapLoader===!0&&(w=function(b){const x=new p.Texture(b);x.needsUpdate=!0,g(x)}),t.load(p.LoaderUtils.resolveURL(f,s.path),w,void 0,_)})}).then(function(f){return d===!0&&c.revokeObjectURL(h),Ci(f,a),f.userData.mimeType=a.mimeType||Fp(a.uri),f}).catch(function(f){throw console.error("THREE.GLTFLoader: Couldn't load texture",h),f});return this.sourceCache[e]=m,m}assignTexture(e,t,i,n){const s=this;return this.getDependency("texture",i.index).then(function(a){if(!a)return null;if(i.texCoord!==void 0&&i.texCoord>0&&(a=a.clone(),a.channel=i.texCoord),s.extensions[_e.KHR_TEXTURE_TRANSFORM]){const c=i.extensions!==void 0?i.extensions[_e.KHR_TEXTURE_TRANSFORM]:void 0;if(c){const h=s.associations.get(a);a=s.extensions[_e.KHR_TEXTURE_TRANSFORM].extendTexture(a,c),s.associations.set(a,h)}}return n!==void 0&&(typeof n=="number"&&(n=n===$l?yn:Pi),"colorSpace"in a?a.colorSpace=n:a.encoding=n===yn?$l:np),e[t]=a,a})}assignFinalMaterial(e){const t=e.geometry;let i=e.material;const n=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){const c="PointsMaterial:"+i.uuid;let h=this.cache.get(c);h||(h=new p.PointsMaterial,p.Material.prototype.copy.call(h,i),h.color.copy(i.color),h.map=i.map,h.sizeAttenuation=!1,this.cache.add(c,h)),i=h}else if(e.isLine){const c="LineBasicMaterial:"+i.uuid;let h=this.cache.get(c);h||(h=new p.LineBasicMaterial,p.Material.prototype.copy.call(h,i),h.color.copy(i.color),h.map=i.map,this.cache.add(c,h)),i=h}if(n||s||a){let c="ClonedMaterial:"+i.uuid+":";n&&(c+="derivative-tangents:"),s&&(c+="vertex-colors:"),a&&(c+="flat-shading:");let h=this.cache.get(c);h||(h=i.clone(),s&&(h.vertexColors=!0),a&&(h.flatShading=!0),n&&(h.normalScale&&(h.normalScale.y*=-1),h.clearcoatNormalScale&&(h.clearcoatNormalScale.y*=-1)),this.cache.add(c,h),this.associations.set(h,this.associations.get(i))),i=h}e.material=i}getMaterialType(){return p.MeshStandardMaterial}loadMaterial(e){const t=this,i=this.json,n=this.extensions,s=i.materials[e];let a;const c={},h=s.extensions||{},d=[];if(h[_e.KHR_MATERIALS_UNLIT]){const f=n[_e.KHR_MATERIALS_UNLIT];a=f.getMaterialType(),d.push(f.extendParams(c,s,t))}else{const f=s.pbrMetallicRoughness||{};if(c.color=new p.Color(1,1,1),c.opacity=1,Array.isArray(f.baseColorFactor)){const g=f.baseColorFactor;c.color.setRGB(g[0],g[1],g[2],Pi),c.opacity=g[3]}f.baseColorTexture!==void 0&&d.push(t.assignTexture(c,"map",f.baseColorTexture,yn)),c.metalness=f.metallicFactor!==void 0?f.metallicFactor:1,c.roughness=f.roughnessFactor!==void 0?f.roughnessFactor:1,f.metallicRoughnessTexture!==void 0&&(d.push(t.assignTexture(c,"metalnessMap",f.metallicRoughnessTexture)),d.push(t.assignTexture(c,"roughnessMap",f.metallicRoughnessTexture))),a=this._invokeOne(function(g){return g.getMaterialType&&g.getMaterialType(e)}),d.push(Promise.all(this._invokeAll(function(g){return g.extendMaterialParams&&g.extendMaterialParams(e,c)})))}s.doubleSided===!0&&(c.side=p.DoubleSide);const m=s.alphaMode||Vo.OPAQUE;if(m===Vo.BLEND?(c.transparent=!0,c.depthWrite=!1):(c.transparent=!1,m===Vo.MASK&&(c.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&a!==p.MeshBasicMaterial&&(d.push(t.assignTexture(c,"normalMap",s.normalTexture)),c.normalScale=new p.Vector2(1,1),s.normalTexture.scale!==void 0)){const f=s.normalTexture.scale;c.normalScale.set(f,f)}if(s.occlusionTexture!==void 0&&a!==p.MeshBasicMaterial&&(d.push(t.assignTexture(c,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(c.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&a!==p.MeshBasicMaterial){const f=s.emissiveFactor;c.emissive=new p.Color().setRGB(f[0],f[1],f[2],Pi)}return s.emissiveTexture!==void 0&&a!==p.MeshBasicMaterial&&d.push(t.assignTexture(c,"emissiveMap",s.emissiveTexture,yn)),Promise.all(d).then(function(){const f=new a(c);return s.name&&(f.name=s.name),Ci(f,s),t.associations.set(f,{materials:e}),s.extensions&&_n(n,f,s),f})}createUniqueName(e){const t=p.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,i=this.extensions,n=this.primitiveCache;function s(c){return i[_e.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(c,t).then(function(h){return nc(h,c,t)})}const a=[];for(let c=0,h=e.length;c<h;c++){const d=e[c],m=Ap(d),f=n[m];if(f)a.push(f.promise);else{let g;d.extensions&&d.extensions[_e.KHR_DRACO_MESH_COMPRESSION]?g=s(d):g=nc(new p.BufferGeometry,d,t),n[m]={primitive:d,promise:g},a.push(g)}}return Promise.all(a)}loadMesh(e){const t=this,i=this.json,n=this.extensions,s=i.meshes[e],a=s.primitives,c=[];for(let h=0,d=a.length;h<d;h++){const m=a[h].material===void 0?Zp(this.cache):this.getDependency("material",a[h].material);c.push(m)}return c.push(t.loadGeometries(a)),Promise.all(c).then(function(h){const d=h.slice(0,h.length-1),m=h[h.length-1],f=[];for(let _=0,w=m.length;_<w;_++){const b=m[_],x=a[_];let L;const M=d[_];if(x.mode===Yt.TRIANGLES||x.mode===Yt.TRIANGLE_STRIP||x.mode===Yt.TRIANGLE_FAN||x.mode===void 0)L=s.isSkinnedMesh===!0?new p.SkinnedMesh(b,M):new p.Mesh(b,M),L.isSkinnedMesh===!0&&L.normalizeSkinWeights(),x.mode===Yt.TRIANGLE_STRIP?L.geometry=Dl(L.geometry,p.TriangleStripDrawMode):x.mode===Yt.TRIANGLE_FAN&&(L.geometry=Dl(L.geometry,p.TriangleFanDrawMode));else if(x.mode===Yt.LINES)L=new p.LineSegments(b,M);else if(x.mode===Yt.LINE_STRIP)L=new p.Line(b,M);else if(x.mode===Yt.LINE_LOOP)L=new p.LineLoop(b,M);else if(x.mode===Yt.POINTS)L=new p.Points(b,M);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+x.mode);Object.keys(L.geometry.morphAttributes).length>0&&Ip(L,s),L.name=t.createUniqueName(s.name||"mesh_"+e),Ci(L,s),x.extensions&&_n(n,L,x),t.assignFinalMaterial(L),f.push(L)}for(let _=0,w=f.length;_<w;_++)t.associations.set(f[_],{meshes:e,primitives:_});if(f.length===1)return s.extensions&&_n(n,f[0],s),f[0];const g=new p.Group;s.extensions&&_n(n,g,s),t.associations.set(g,{meshes:e});for(let _=0,w=f.length;_<w;_++)g.add(f[_]);return g})}loadCamera(e){let t;const i=this.json.cameras[e],n=i[i.type];if(!n){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return i.type==="perspective"?t=new p.PerspectiveCamera(p.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):i.type==="orthographic"&&(t=new p.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),i.name&&(t.name=this.createUniqueName(i.name)),Ci(t,i),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],i=[];for(let n=0,s=t.joints.length;n<s;n++)i.push(this._loadNodeShallow(t.joints[n]));return t.inverseBindMatrices!==void 0?i.push(this.getDependency("accessor",t.inverseBindMatrices)):i.push(null),Promise.all(i).then(function(n){const s=n.pop(),a=n,c=[],h=[];for(let d=0,m=a.length;d<m;d++){const f=a[d];if(f){c.push(f);const g=new p.Matrix4;s!==null&&g.fromArray(s.array,d*16),h.push(g)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[d])}return new p.Skeleton(c,h)})}loadAnimation(e){const t=this.json,i=this,n=t.animations[e],s=n.name?n.name:"animation_"+e,a=[],c=[],h=[],d=[],m=[];for(let f=0,g=n.channels.length;f<g;f++){const _=n.channels[f],w=n.samplers[_.sampler],b=_.target,x=b.node,L=n.parameters!==void 0?n.parameters[w.input]:w.input,M=n.parameters!==void 0?n.parameters[w.output]:w.output;b.node!==void 0&&(a.push(this.getDependency("node",x)),c.push(this.getDependency("accessor",L)),h.push(this.getDependency("accessor",M)),d.push(w),m.push(b))}return Promise.all([Promise.all(a),Promise.all(c),Promise.all(h),Promise.all(d),Promise.all(m)]).then(function(f){const g=f[0],_=f[1],w=f[2],b=f[3],x=f[4],L=[];for(let M=0,C=g.length;M<C;M++){const W=g[M],D=_[M],z=w[M],X=b[M],I=x[M];if(W===void 0)continue;W.updateMatrix&&W.updateMatrix();const U=i._createAnimationTracks(W,D,z,X,I);if(U)for(let V=0;V<U.length;V++)L.push(U[V])}return new p.AnimationClip(s,void 0,L)})}createNodeMesh(e){const t=this.json,i=this,n=t.nodes[e];return n.mesh===void 0?null:i.getDependency("mesh",n.mesh).then(function(s){const a=i._getNodeRef(i.meshCache,n.mesh,s);return n.weights!==void 0&&a.traverse(function(c){if(c.isMesh)for(let h=0,d=n.weights.length;h<d;h++)c.morphTargetInfluences[h]=n.weights[h]}),a})}loadNode(e){const t=this.json,i=this,n=t.nodes[e],s=i._loadNodeShallow(e),a=[],c=n.children||[];for(let d=0,m=c.length;d<m;d++)a.push(i.getDependency("node",c[d]));const h=n.skin===void 0?Promise.resolve(null):i.getDependency("skin",n.skin);return Promise.all([s,Promise.all(a),h]).then(function(d){const m=d[0],f=d[1],g=d[2];g!==null&&m.traverse(function(_){_.isSkinnedMesh&&_.bind(g,Op)});for(let _=0,w=f.length;_<w;_++)m.add(f[_]);return m})}_loadNodeShallow(e){const t=this.json,i=this.extensions,n=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const s=t.nodes[e],a=s.name?n.createUniqueName(s.name):"",c=[],h=n._invokeOne(function(d){return d.createNodeMesh&&d.createNodeMesh(e)});return h&&c.push(h),s.camera!==void 0&&c.push(n.getDependency("camera",s.camera).then(function(d){return n._getNodeRef(n.cameraCache,s.camera,d)})),n._invokeAll(function(d){return d.createNodeAttachment&&d.createNodeAttachment(e)}).forEach(function(d){c.push(d)}),this.nodeCache[e]=Promise.all(c).then(function(d){let m;if(s.isBone===!0?m=new p.Bone:d.length>1?m=new p.Group:d.length===1?m=d[0]:m=new p.Object3D,m!==d[0])for(let f=0,g=d.length;f<g;f++)m.add(d[f]);if(s.name&&(m.userData.name=s.name,m.name=a),Ci(m,s),s.extensions&&_n(i,m,s),s.matrix!==void 0){const f=new p.Matrix4;f.fromArray(s.matrix),m.applyMatrix4(f)}else s.translation!==void 0&&m.position.fromArray(s.translation),s.rotation!==void 0&&m.quaternion.fromArray(s.rotation),s.scale!==void 0&&m.scale.fromArray(s.scale);return n.associations.has(m)||n.associations.set(m,{}),n.associations.get(m).nodes=e,m}),this.nodeCache[e]}loadScene(e){const t=this.extensions,i=this.json.scenes[e],n=this,s=new p.Group;i.name&&(s.name=n.createUniqueName(i.name)),Ci(s,i),i.extensions&&_n(t,s,i);const a=i.nodes||[],c=[];for(let h=0,d=a.length;h<d;h++)c.push(n.getDependency("node",a[h]));return Promise.all(c).then(function(h){for(let m=0,f=h.length;m<f;m++)s.add(h[m]);const d=m=>{const f=new Map;for(const[g,_]of n.associations)(g instanceof p.Material||g instanceof p.Texture)&&f.set(g,_);return m.traverse(g=>{const _=n.associations.get(g);_!=null&&f.set(g,_)}),f};return n.associations=d(s),s})}_createAnimationTracks(e,t,i,n,s){const a=[],c=e.name?e.name:e.uuid,h=[];Ui[s.path]===Ui.weights?e.traverse(function(g){g.morphTargetInfluences&&h.push(g.name?g.name:g.uuid)}):h.push(c);let d;switch(Ui[s.path]){case Ui.weights:d=p.NumberKeyframeTrack;break;case Ui.rotation:d=p.QuaternionKeyframeTrack;break;case Ui.position:case Ui.scale:d=p.VectorKeyframeTrack;break;default:switch(i.itemSize){case 1:d=p.NumberKeyframeTrack;break;case 2:case 3:default:d=p.VectorKeyframeTrack;break}break}const m=n.interpolation!==void 0?Wp[n.interpolation]:p.InterpolateLinear,f=this._getArrayFromAccessor(i);for(let g=0,_=h.length;g<_;g++){const w=new d(h[g]+"."+Ui[s.path],t.array,f,m);n.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(w),a.push(w)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const i=Ao(t.constructor),n=new Float32Array(t.length);for(let s=0,a=t.length;s<a;s++)n[s]=t[s]*i;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(i){const n=this instanceof p.QuaternionKeyframeTrack?Gp:ec;return new n(this.times,this.values,this.getValueSize()/3,i)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Dp(r,e,t){const i=e.attributes,n=new p.Box3;if(i.POSITION!==void 0){const c=t.json.accessors[i.POSITION],h=c.min,d=c.max;if(h!==void 0&&d!==void 0){if(n.set(new p.Vector3(h[0],h[1],h[2]),new p.Vector3(d[0],d[1],d[2])),c.normalized){const m=Ao(Yn[c.componentType]);n.min.multiplyScalar(m),n.max.multiplyScalar(m)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=e.targets;if(s!==void 0){const c=new p.Vector3,h=new p.Vector3;for(let d=0,m=s.length;d<m;d++){const f=s[d];if(f.POSITION!==void 0){const g=t.json.accessors[f.POSITION],_=g.min,w=g.max;if(_!==void 0&&w!==void 0){if(h.setX(Math.max(Math.abs(_[0]),Math.abs(w[0]))),h.setY(Math.max(Math.abs(_[1]),Math.abs(w[1]))),h.setZ(Math.max(Math.abs(_[2]),Math.abs(w[2]))),g.normalized){const b=Ao(Yn[g.componentType]);h.multiplyScalar(b)}c.max(h)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(c)}r.boundingBox=n;const a=new p.Sphere;n.getCenter(a.center),a.radius=n.min.distanceTo(n.max)/2,r.boundingSphere=a}function nc(r,e,t){const i=e.attributes,n=[];function s(a,c){return t.getDependency("accessor",a).then(function(h){r.setAttribute(c,h)})}for(const a in i){const c=Zo[a]||a.toLowerCase();c in r.attributes||n.push(s(i[a],c))}if(e.indices!==void 0&&!r.index){const a=t.getDependency("accessor",e.indices).then(function(c){r.setIndex(c)});n.push(a)}return Ci(r,e),Dp(r,e,t),Promise.all(n).then(function(){return e.targets!==void 0?Vp(r,e.targets,t):r})}function rc(r,e,t){const i=t.length-r-1;if(e>=t[i])return i-1;if(e<=t[r])return r;let n=r,s=i,a=Math.floor((n+s)/2);for(;e<t[a]||e>=t[a+1];)e<t[a]?s=a:n=a,a=Math.floor((n+s)/2);return a}function Xp(r,e,t,i){const n=[],s=[],a=[];n[0]=1;for(let c=1;c<=t;++c){s[c]=e-i[r+1-c],a[c]=i[r+c]-e;let h=0;for(let d=0;d<c;++d){const m=a[d+1],f=s[c-d],g=n[d]/(m+f);n[d]=h+m*g,h=f*g}n[c]=h}return n}function kp(r,e,t,i){const n=rc(r,i,e),s=Xp(n,i,r,e),a=new p.Vector4(0,0,0,0);for(let c=0;c<=r;++c){const h=t[n-r+c],d=s[c],m=h.w*d;a.x+=h.x*m,a.y+=h.y*m,a.z+=h.z*m,a.w+=h.w*d}return a}function Up(r,e,t,i,n){const s=[];for(let f=0;f<=t;++f)s[f]=0;const a=[];for(let f=0;f<=i;++f)a[f]=s.slice(0);const c=[];for(let f=0;f<=t;++f)c[f]=s.slice(0);c[0][0]=1;const h=s.slice(0),d=s.slice(0);for(let f=1;f<=t;++f){h[f]=e-n[r+1-f],d[f]=n[r+f]-e;let g=0;for(let _=0;_<f;++_){const w=d[_+1],b=h[f-_];c[f][_]=w+b;const x=c[_][f-1]/c[f][_];c[_][f]=g+w*x,g=b*x}c[f][f]=g}for(let f=0;f<=t;++f)a[0][f]=c[f][t];for(let f=0;f<=t;++f){let g=0,_=1;const w=[];for(let b=0;b<=t;++b)w[b]=s.slice(0);w[0][0]=1;for(let b=1;b<=i;++b){let x=0;const L=f-b,M=t-b;f>=b&&(w[_][0]=w[g][0]/c[M+1][L],x=w[_][0]*c[L][M]);const C=L>=-1?1:-L,W=f-1<=M?b-1:t-f;for(let z=C;z<=W;++z)w[_][z]=(w[g][z]-w[g][z-1])/c[M+1][L+z],x+=w[_][z]*c[L+z][M];f<=M&&(w[_][b]=-w[g][b-1]/c[M+1][f],x+=w[_][b]*c[f][M]),a[b][f]=x;const D=g;g=_,_=D}}let m=t;for(let f=1;f<=i;++f){for(let g=0;g<=t;++g)a[f][g]*=m;m*=t-f}return a}function Np(r,e,t,i,n){const s=n<r?n:r,a=[],c=rc(r,i,e),h=Up(c,i,r,s,e),d=[];for(let m=0;m<t.length;++m){const f=t[m].clone(),g=f.w;f.x*=g,f.y*=g,f.z*=g,d[m]=f}for(let m=0;m<=s;++m){const f=d[c-r].clone().multiplyScalar(h[m][0]);for(let g=1;g<=r;++g)f.add(d[c-r+g].clone().multiplyScalar(h[m][g]));a[m]=f}for(let m=s+1;m<=n+1;++m)a[m]=new p.Vector4(0,0,0);return a}function Kp(r,e){let t=1;for(let n=2;n<=r;++n)t*=n;let i=1;for(let n=2;n<=e;++n)i*=n;for(let n=2;n<=r-e;++n)i*=n;return t/i}function Bp(r){const e=r.length,t=[],i=[];for(let s=0;s<e;++s){const a=r[s];t[s]=new p.Vector3(a.x,a.y,a.z),i[s]=a.w}const n=[];for(let s=0;s<e;++s){const a=t[s].clone();for(let c=1;c<=s;++c)a.sub(n[s-c].clone().multiplyScalar(Kp(s,c)*i[c]));n[s]=a.divideScalar(i[0])}return n}function Yp(r,e,t,i,n){const s=Np(r,e,t,i,n);return Bp(s)}class sc extends p.Curve{constructor(e,t,i,n,s){super(),this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=n||0,this.endKnot=s||this.knots.length-1;for(let a=0;a<i.length;++a){const c=i[a];this.controlPoints[a]=new p.Vector4(c.x,c.y,c.z,c.w)}}getPoint(e,t){const i=t||new p.Vector3,n=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),s=kp(this.degree,this.knots,this.controlPoints,n);return s.w!=1&&s.divideScalar(s.w),i.set(s.x,s.y,s.z)}getTangent(e,t){const i=t||new p.Vector3,n=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),s=Yp(this.degree,this.knots,this.controlPoints,n,1);return i.copy(s[1]).normalize(),i}}let ve,Ue,Mt;class Rp extends p.Loader{constructor(e){super(e)}load(e,t,i,n){const s=this,a=s.path===""?p.LoaderUtils.extractUrlBase(e):s.path,c=new p.FileLoader(this.manager);c.setPath(s.path),c.setResponseType("arraybuffer"),c.setRequestHeader(s.requestHeader),c.setWithCredentials(s.withCredentials),c.load(e,function(h){try{t(s.parse(h,a))}catch(d){n?n(d):console.error(d),s.manager.itemError(e)}},i,n)}parse(e,t){if(Ep(e))ve=new $p().parse(e);else{const n=uc(e);if(!qp(n))throw new Error("THREE.FBXLoader: Unknown format.");if(lc(n)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+lc(n));ve=new Hp().parse(n)}const i=new p.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new jp(i,this.manager).parse(ve)}}class jp{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){Ue=this.parseConnections();const e=this.parseImages(),t=this.parseTextures(e),i=this.parseMaterials(t),n=this.parseDeformers(),s=new Jp().parse(n);return this.parseScene(n,s,i),Mt}parseConnections(){const e=new Map;return"Connections"in ve&&ve.Connections.connections.forEach(function(i){const n=i[0],s=i[1],a=i[2];e.has(n)||e.set(n,{parents:[],children:[]});const c={ID:s,relationship:a};e.get(n).parents.push(c),e.has(s)||e.set(s,{parents:[],children:[]});const h={ID:n,relationship:a};e.get(s).children.push(h)}),e}parseImages(){const e={},t={};if("Video"in ve.Objects){const i=ve.Objects.Video;for(const n in i){const s=i[n],a=parseInt(n);if(e[a]=s.RelativeFilename||s.Filename,"Content"in s){const c=s.Content instanceof ArrayBuffer&&s.Content.byteLength>0,h=typeof s.Content=="string"&&s.Content!=="";if(c||h){const d=this.parseImage(i[n]);t[s.RelativeFilename||s.Filename]=d}}}}for(const i in e){const n=e[i];t[n]!==void 0?e[i]=t[n]:e[i]=e[i].split("\\").pop()}return e}parseImage(e){const t=e.Content,i=e.RelativeFilename||e.Filename,n=i.slice(i.lastIndexOf(".")+1).toLowerCase();let s;switch(n){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 ",i),s="image/tga";break;default:console.warn('FBXLoader: Image type "'+n+'" is not supported.');return}if(typeof t=="string")return"data:"+s+";base64,"+t;{const a=new Uint8Array(t);return window.URL.createObjectURL(new Blob([a],{type:s}))}}parseTextures(e){const t=new Map;if("Texture"in ve.Objects){const i=ve.Objects.Texture;for(const n in i){const s=this.parseTexture(i[n],e);t.set(parseInt(n),s)}}return t}parseTexture(e,t){const i=this.loadTexture(e,t);i.ID=e.id,i.name=e.attrName;const n=e.WrapModeU,s=e.WrapModeV,a=n!==void 0?n.value:0,c=s!==void 0?s.value:0;if(i.wrapS=a===0?p.RepeatWrapping:p.ClampToEdgeWrapping,i.wrapT=c===0?p.RepeatWrapping:p.ClampToEdgeWrapping,"Scaling"in e){const h=e.Scaling.value;i.repeat.x=h[0],i.repeat.y=h[1]}return i}loadTexture(e,t){let i;const n=this.textureLoader.path,s=Ue.get(e.id).children;s!==void 0&&s.length>0&&t[s[0].ID]!==void 0&&(i=t[s[0].ID],(i.indexOf("blob:")===0||i.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let a;const c=e.FileName.slice(-3).toLowerCase();if(c==="tga"){const h=this.manager.getHandler(".tga");h===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),a=new p.Texture):(h.setPath(this.textureLoader.path),a=h.load(i))}else c==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),a=new p.Texture):a=this.textureLoader.load(i);return this.textureLoader.setPath(n),a}parseMaterials(e){const t=new Map;if("Material"in ve.Objects){const i=ve.Objects.Material;for(const n in i){const s=this.parseMaterial(i[n],e);s!==null&&t.set(parseInt(n),s)}}return t}parseMaterial(e,t){const i=e.id,n=e.attrName;let s=e.ShadingModel;if(typeof s=="object"&&(s=s.value),!Ue.has(i))return null;const a=this.parseParameters(e,t,i);let c;switch(s.toLowerCase()){case"phong":c=new p.MeshPhongMaterial;break;case"lambert":c=new p.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',s),c=new p.MeshPhongMaterial;break}return c.setValues(a),c.name=n,c}parseParameters(e,t,i){const n={};e.BumpFactor&&(n.bumpScale=e.BumpFactor.value),e.Diffuse?n.color=new p.Color().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(n.color=new p.Color().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(n.displacementScale=e.DisplacementFactor.value),e.Emissive?n.emissive=new p.Color().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(n.emissive=new p.Color().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(n.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(n.opacity=parseFloat(e.Opacity.value)),n.opacity<1&&(n.transparent=!0),e.ReflectionFactor&&(n.reflectivity=e.ReflectionFactor.value),e.Shininess&&(n.shininess=e.Shininess.value),e.Specular?n.specular=new p.Color().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(n.specular=new p.Color().fromArray(e.SpecularColor.value));const s=this;return Ue.get(i).children.forEach(function(a){const c=a.relationship;switch(c){case"Bump":n.bumpMap=s.getTexture(t,a.ID);break;case"Maya|TEX_ao_map":n.aoMap=s.getTexture(t,a.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":n.map=s.getTexture(t,a.ID),n.map!==void 0&&("colorSpace"in n.map?n.map.colorSpace="srgb":n.map.encoding=3001);break;case"DisplacementColor":n.displacementMap=s.getTexture(t,a.ID);break;case"EmissiveColor":n.emissiveMap=s.getTexture(t,a.ID),n.emissiveMap!==void 0&&("colorSpace"in n.emissiveMap?n.emissiveMap.colorSpace="srgb":n.emissiveMap.encoding=3001);break;case"NormalMap":case"Maya|TEX_normal_map":n.normalMap=s.getTexture(t,a.ID);break;case"ReflectionColor":n.envMap=s.getTexture(t,a.ID),n.envMap!==void 0&&(n.envMap.mapping=p.EquirectangularReflectionMapping,"colorSpace"in n.envMap?n.envMap.colorSpace="srgb":n.envMap.encoding=3001);break;case"SpecularColor":n.specularMap=s.getTexture(t,a.ID),n.specularMap!==void 0&&("colorSpace"in n.specularMap?n.specularMap.colorSpace="srgb":n.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":n.alphaMap=s.getTexture(t,a.ID),n.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}}),n}getTexture(e,t){return"LayeredTexture"in ve.Objects&&t in ve.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Ue.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in ve.Objects){const i=ve.Objects.Deformer;for(const n in i){const s=i[n],a=Ue.get(parseInt(n));if(s.attrType==="Skin"){const c=this.parseSkeleton(a,i);c.ID=n,a.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),c.geometryID=a.parents[0].ID,e[n]=c}else if(s.attrType==="BlendShape"){const c={id:n};c.rawTargets=this.parseMorphTargets(a,i),c.id=n,a.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[n]=c}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const i=[];return e.children.forEach(function(n){const s=t[n.ID];if(s.attrType!=="Cluster")return;const a={ID:n.ID,indices:[],weights:[],transformLink:new p.Matrix4().fromArray(s.TransformLink.a)};"Indexes"in s&&(a.indices=s.Indexes.a,a.weights=s.Weights.a),i.push(a)}),{rawBones:i,bones:[]}}parseMorphTargets(e,t){const i=[];for(let n=0;n<e.children.length;n++){const s=e.children[n],a=t[s.ID],c={name:a.attrName,initialWeight:a.DeformPercent,id:a.id,fullWeights:a.FullWeights.a};if(a.attrType!=="BlendShapeChannel")return;c.geoID=Ue.get(parseInt(s.ID)).children.filter(function(h){return h.relationship===void 0})[0].ID,i.push(c)}return i}parseScene(e,t,i){Mt=new p.Group;const n=this.parseModels(e.skeletons,t,i),s=ve.Objects.Model,a=this;n.forEach(function(h){const d=s[h.ID];a.setLookAtProperties(h,d),Ue.get(h.ID).parents.forEach(function(f){const g=n.get(f.ID);g!==void 0&&g.add(h)}),h.parent===null&&Mt.add(h)}),this.bindSkeleton(e.skeletons,t,n),this.createAmbientLight(),Mt.traverse(function(h){if(h.userData.transformData){h.parent&&(h.userData.transformData.parentMatrix=h.parent.matrix,h.userData.transformData.parentMatrixWorld=h.parent.matrixWorld);const d=cc(h.userData.transformData);h.applyMatrix4(d),h.updateWorldMatrix()}});const c=new Qp().parse();Mt.children.length===1&&Mt.children[0].isGroup&&(Mt.children[0].animations=c,Mt=Mt.children[0]),Mt.animations=c}parseModels(e,t,i){const n=new Map,s=ve.Objects.Model;for(const a in s){const c=parseInt(a),h=s[a],d=Ue.get(c);let m=this.buildSkeleton(d,e,c,h.attrName);if(!m){switch(h.attrType){case"Camera":m=this.createCamera(d);break;case"Light":m=this.createLight(d);break;case"Mesh":m=this.createMesh(d,t,i);break;case"NurbsCurve":m=this.createCurve(d,t);break;case"LimbNode":case"Root":m=new p.Bone;break;case"Null":default:m=new p.Group;break}m.name=h.attrName?p.PropertyBinding.sanitizeNodeName(h.attrName):"",m.ID=c}this.getTransformData(m,h),n.set(c,m)}return n}buildSkeleton(e,t,i,n){let s=null;return e.parents.forEach(function(a){for(const c in t){const h=t[c];h.rawBones.forEach(function(d,m){if(d.ID===a.ID){const f=s;s=new p.Bone,s.matrixWorld.copy(d.transformLink),s.name=n?p.PropertyBinding.sanitizeNodeName(n):"",s.ID=i,h.bones[m]=s,f!==null&&s.add(f)}})}}),s}createCamera(e){let t,i;if(e.children.forEach(function(n){const s=ve.Objects.NodeAttribute[n.ID];s!==void 0&&(i=s)}),i===void 0)t=new p.Object3D;else{let n=0;i.CameraProjectionType!==void 0&&i.CameraProjectionType.value===1&&(n=1);let s=1;i.NearPlane!==void 0&&(s=i.NearPlane.value/1e3);let a=1e3;i.FarPlane!==void 0&&(a=i.FarPlane.value/1e3);let c=window.innerWidth,h=window.innerHeight;i.AspectWidth!==void 0&&i.AspectHeight!==void 0&&(c=i.AspectWidth.value,h=i.AspectHeight.value);const d=c/h;let m=45;i.FieldOfView!==void 0&&(m=i.FieldOfView.value);const f=i.FocalLength?i.FocalLength.value:null;switch(n){case 0:t=new p.PerspectiveCamera(m,d,s,a),f!==null&&t.setFocalLength(f);break;case 1:t=new p.OrthographicCamera(-c/2,c/2,h/2,-h/2,s,a);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+n+"."),t=new p.Object3D;break}}return t}createLight(e){let t,i;if(e.children.forEach(function(n){const s=ve.Objects.NodeAttribute[n.ID];s!==void 0&&(i=s)}),i===void 0)t=new p.Object3D;else{let n;i.LightType===void 0?n=0:n=i.LightType.value;let s=16777215;i.Color!==void 0&&(s=new p.Color().fromArray(i.Color.value));let a=i.Intensity===void 0?1:i.Intensity.value/100;i.CastLightOnObject!==void 0&&i.CastLightOnObject.value===0&&(a=0);let c=0;i.FarAttenuationEnd!==void 0&&(i.EnableFarAttenuation!==void 0&&i.EnableFarAttenuation.value===0?c=0:c=i.FarAttenuationEnd.value);const h=1;switch(n){case 0:t=new p.PointLight(s,a,c,h);break;case 1:t=new p.DirectionalLight(s,a);break;case 2:let d=Math.PI/3;i.InnerAngle!==void 0&&(d=p.MathUtils.degToRad(i.InnerAngle.value));let m=0;i.OuterAngle!==void 0&&(m=p.MathUtils.degToRad(i.OuterAngle.value),m=Math.max(m,1)),t=new p.SpotLight(s,a,c,d,m,h);break;default:console.warn("THREE.FBXLoader: Unknown light type "+i.LightType.value+", defaulting to a PointLight."),t=new p.PointLight(s,a);break}i.CastShadows!==void 0&&i.CastShadows.value===1&&(t.castShadow=!0)}return t}createMesh(e,t,i){let n,s=null,a=null;const c=[];return e.children.forEach(function(h){t.has(h.ID)&&(s=t.get(h.ID)),i.has(h.ID)&&c.push(i.get(h.ID))}),c.length>1?a=c:c.length>0?a=c[0]:(a=new p.MeshPhongMaterial({color:13421772}),c.push(a)),"color"in s.attributes&&c.forEach(function(h){h.vertexColors=!0}),s.FBX_Deformer?(n=new p.SkinnedMesh(s,a),n.normalizeSkinWeights()):n=new p.Mesh(s,a),n}createCurve(e,t){const i=e.children.reduce(function(s,a){return t.has(a.ID)&&(s=t.get(a.ID)),s},null),n=new p.LineBasicMaterial({color:3342591,linewidth:1});return new p.Line(i,n)}getTransformData(e,t){const i={};"InheritType"in t&&(i.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?i.eulerOrder=hc(t.RotationOrder.value):i.eulerOrder="ZYX","Lcl_Translation"in t&&(i.translation=t.Lcl_Translation.value),"PreRotation"in t&&(i.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(i.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(i.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(i.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(i.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(i.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(i.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(i.rotationPivot=t.RotationPivot.value),e.userData.transformData=i}setLookAtProperties(e,t){"LookAtProperty"in t&&Ue.get(e.ID).children.forEach(function(n){if(n.relationship==="LookAtProperty"){const s=ve.Objects.Model[n.ID];if("Lcl_Translation"in s){const a=s.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(a),Mt.add(e.target)):e.lookAt(new p.Vector3().fromArray(a))}}})}bindSkeleton(e,t,i){const n=this.parsePoseNodes();for(const s in e){const a=e[s];Ue.get(parseInt(a.ID)).parents.forEach(function(h){if(t.has(h.ID)){const d=h.ID;Ue.get(d).parents.forEach(function(f){i.has(f.ID)&&i.get(f.ID).bind(new p.Skeleton(a.bones),n[f.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in ve.Objects){const t=ve.Objects.Pose;for(const i in t)if(t[i].attrType==="BindPose"&&t[i].NbPoseNodes>0){const n=t[i].PoseNode;Array.isArray(n)?n.forEach(function(s){e[s.Node]=new p.Matrix4().fromArray(s.Matrix.a)}):e[n.Node]=new p.Matrix4().fromArray(n.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in ve&&"AmbientColor"in ve.GlobalSettings){const e=ve.GlobalSettings.AmbientColor.value,t=e[0],i=e[1],n=e[2];if(t!==0||i!==0||n!==0){const s=new p.Color(t,i,n);Mt.add(new p.AmbientLight(s,1))}}}}class Jp{parse(e){const t=new Map;if("Geometry"in ve.Objects){const i=ve.Objects.Geometry;for(const n in i){const s=Ue.get(parseInt(n)),a=this.parseGeometry(s,i[n],e);t.set(parseInt(n),a)}}return t}parseGeometry(e,t,i){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,i);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,i){const n=i.skeletons,s=[],a=e.parents.map(function(f){return ve.Objects.Model[f.ID]});if(a.length===0)return;const c=e.children.reduce(function(f,g){return n[g.ID]!==void 0&&(f=n[g.ID]),f},null);e.children.forEach(function(f){i.morphTargets[f.ID]!==void 0&&s.push(i.morphTargets[f.ID])});const h=a[0],d={};"RotationOrder"in h&&(d.eulerOrder=hc(h.RotationOrder.value)),"InheritType"in h&&(d.inheritType=parseInt(h.InheritType.value)),"GeometricTranslation"in h&&(d.translation=h.GeometricTranslation.value),"GeometricRotation"in h&&(d.rotation=h.GeometricRotation.value),"GeometricScaling"in h&&(d.scale=h.GeometricScaling.value);const m=cc(d);return this.genGeometry(t,c,s,m)}genGeometry(e,t,i,n){const s=new p.BufferGeometry;e.attrName&&(s.name=e.attrName);const a=this.parseGeoNode(e,t),c=this.genBuffers(a),h=new p.Float32BufferAttribute(c.vertex,3);if(h.applyMatrix4(n),s.setAttribute("position",h),c.colors.length>0&&s.setAttribute("color",new p.Float32BufferAttribute(c.colors,3)),t&&(s.setAttribute("skinIndex",new p.Uint16BufferAttribute(c.weightsIndices,4)),s.setAttribute("skinWeight",new p.Float32BufferAttribute(c.vertexWeights,4)),s.FBX_Deformer=t),c.normal.length>0){const d=new p.Matrix3().getNormalMatrix(n),m=new p.Float32BufferAttribute(c.normal,3);m.applyNormalMatrix(d),s.setAttribute("normal",m)}if(c.uvs.forEach(function(d,m){Mo==="uv2"&&m++;const f=m===0?"uv":`uv${m}`;s.setAttribute(f,new p.Float32BufferAttribute(c.uvs[m],2))}),a.material&&a.material.mappingType!=="AllSame"){let d=c.materialIndex[0],m=0;if(c.materialIndex.forEach(function(f,g){f!==d&&(s.addGroup(m,g-m,d),d=f,m=g)}),s.groups.length>0){const f=s.groups[s.groups.length-1],g=f.start+f.count;g!==c.materialIndex.length&&s.addGroup(g,c.materialIndex.length-g,d)}s.groups.length===0&&s.addGroup(0,c.materialIndex.length,c.materialIndex[0])}return this.addMorphTargets(s,e,i,n),s}parseGeoNode(e,t){const i={};if(i.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],i.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(i.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(i.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(i.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){i.uv=[];let n=0;for(;e.LayerElementUV[n];)e.LayerElementUV[n].UV&&i.uv.push(this.parseUVs(e.LayerElementUV[n])),n++}return i.weightTable={},t!==null&&(i.skeleton=t,t.rawBones.forEach(function(n,s){n.indices.forEach(function(a,c){i.weightTable[a]===void 0&&(i.weightTable[a]=[]),i.weightTable[a].push({id:s,weight:n.weights[c]})})})),i}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let i=0,n=0,s=!1,a=[],c=[],h=[],d=[],m=[],f=[];const g=this;return e.vertexIndices.forEach(function(_,w){let b,x=!1;_<0&&(_=_^-1,x=!0);let L=[],M=[];if(a.push(_*3,_*3+1,_*3+2),e.color){const C=os(w,i,_,e.color);h.push(C[0],C[1],C[2])}if(e.skeleton){if(e.weightTable[_]!==void 0&&e.weightTable[_].forEach(function(C){M.push(C.weight),L.push(C.id)}),M.length>4){s||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),s=!0);const C=[0,0,0,0],W=[0,0,0,0];M.forEach(function(D,z){let X=D,I=L[z];W.forEach(function(U,V,G){if(X>U){G[V]=X,X=U;const N=C[V];C[V]=I,I=N}})}),L=C,M=W}for(;M.length<4;)M.push(0),L.push(0);for(let C=0;C<4;++C)m.push(M[C]),f.push(L[C])}if(e.normal){const C=os(w,i,_,e.normal);c.push(C[0],C[1],C[2])}e.material&&e.material.mappingType!=="AllSame"&&(b=os(w,i,_,e.material)[0]),e.uv&&e.uv.forEach(function(C,W){const D=os(w,i,_,C);d[W]===void 0&&(d[W]=[]),d[W].push(D[0]),d[W].push(D[1])}),n++,x&&(g.genFace(t,e,a,b,c,h,d,m,f,n),i++,n=0,a=[],c=[],h=[],d=[],m=[],f=[])}),t}genFace(e,t,i,n,s,a,c,h,d,m){for(let f=2;f<m;f++)e.vertex.push(t.vertexPositions[i[0]]),e.vertex.push(t.vertexPositions[i[1]]),e.vertex.push(t.vertexPositions[i[2]]),e.vertex.push(t.vertexPositions[i[(f-1)*3]]),e.vertex.push(t.vertexPositions[i[(f-1)*3+1]]),e.vertex.push(t.vertexPositions[i[(f-1)*3+2]]),e.vertex.push(t.vertexPositions[i[f*3]]),e.vertex.push(t.vertexPositions[i[f*3+1]]),e.vertex.push(t.vertexPositions[i[f*3+2]]),t.skeleton&&(e.vertexWeights.push(h[0]),e.vertexWeights.push(h[1]),e.vertexWeights.push(h[2]),e.vertexWeights.push(h[3]),e.vertexWeights.push(h[(f-1)*4]),e.vertexWeights.push(h[(f-1)*4+1]),e.vertexWeights.push(h[(f-1)*4+2]),e.vertexWeights.push(h[(f-1)*4+3]),e.vertexWeights.push(h[f*4]),e.vertexWeights.push(h[f*4+1]),e.vertexWeights.push(h[f*4+2]),e.vertexWeights.push(h[f*4+3]),e.weightsIndices.push(d[0]),e.weightsIndices.push(d[1]),e.weightsIndices.push(d[2]),e.weightsIndices.push(d[3]),e.weightsIndices.push(d[(f-1)*4]),e.weightsIndices.push(d[(f-1)*4+1]),e.weightsIndices.push(d[(f-1)*4+2]),e.weightsIndices.push(d[(f-1)*4+3]),e.weightsIndices.push(d[f*4]),e.weightsIndices.push(d[f*4+1]),e.weightsIndices.push(d[f*4+2]),e.weightsIndices.push(d[f*4+3])),t.color&&(e.colors.push(a[0]),e.colors.push(a[1]),e.colors.push(a[2]),e.colors.push(a[(f-1)*3]),e.colors.push(a[(f-1)*3+1]),e.colors.push(a[(f-1)*3+2]),e.colors.push(a[f*3]),e.colors.push(a[f*3+1]),e.colors.push(a[f*3+2])),t.material&&t.material.mappingType!=="AllSame"&&(e.materialIndex.push(n),e.materialIndex.push(n),e.materialIndex.push(n)),t.normal&&(e.normal.push(s[0]),e.normal.push(s[1]),e.normal.push(s[2]),e.normal.push(s[(f-1)*3]),e.normal.push(s[(f-1)*3+1]),e.normal.push(s[(f-1)*3+2]),e.normal.push(s[f*3]),e.normal.push(s[f*3+1]),e.normal.push(s[f*3+2])),t.uv&&t.uv.forEach(function(g,_){e.uvs[_]===void 0&&(e.uvs[_]=[]),e.uvs[_].push(c[_][0]),e.uvs[_].push(c[_][1]),e.uvs[_].push(c[_][(f-1)*2]),e.uvs[_].push(c[_][(f-1)*2+1]),e.uvs[_].push(c[_][f*2]),e.uvs[_].push(c[_][f*2+1])})}addMorphTargets(e,t,i,n){if(i.length===0)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];const s=this;i.forEach(function(a){a.rawTargets.forEach(function(c){const h=ve.Objects.Geometry[c.geoID];h!==void 0&&s.genMorphGeometry(e,t,h,n,c.name)})})}genMorphGeometry(e,t,i,n,s){const a=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],c=i.Vertices!==void 0?i.Vertices.a:[],h=i.Indexes!==void 0?i.Indexes.a:[],d=e.attributes.position.count*3,m=new Float32Array(d);for(let w=0;w<h.length;w++){const b=h[w]*3;m[b]=c[w*3],m[b+1]=c[w*3+1],m[b+2]=c[w*3+2]}const f={vertexIndices:a,vertexPositions:m},g=this.genBuffers(f),_=new p.Float32BufferAttribute(g.vertex,3);_.name=s||i.attrName,_.applyMatrix4(n),e.morphAttributes.position.push(_)}parseNormals(e){const t=e.MappingInformationType,i=e.ReferenceInformationType,n=e.Normals.a;let s=[];return i==="IndexToDirect"&&("NormalIndex"in e?s=e.NormalIndex.a:"NormalsIndex"in e&&(s=e.NormalsIndex.a)),{dataSize:3,buffer:n,indices:s,mappingType:t,referenceType:i}}parseUVs(e){const t=e.MappingInformationType,i=e.ReferenceInformationType,n=e.UV.a;let s=[];return i==="IndexToDirect"&&(s=e.UVIndex.a),{dataSize:2,buffer:n,indices:s,mappingType:t,referenceType:i}}parseVertexColors(e){const t=e.MappingInformationType,i=e.ReferenceInformationType,n=e.Colors.a;let s=[];return i==="IndexToDirect"&&(s=e.ColorIndex.a),{dataSize:4,buffer:n,indices:s,mappingType:t,referenceType:i}}parseMaterialIndices(e){const t=e.MappingInformationType,i=e.ReferenceInformationType;if(t==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:i};const n=e.Materials.a,s=[];for(let a=0;a<n.length;++a)s.push(a);return{dataSize:1,buffer:n,indices:s,mappingType:t,referenceType:i}}parseNurbsGeometry(e){if(sc===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 p.BufferGeometry;const t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new p.BufferGeometry;const i=t-1,n=e.KnotVector.a,s=[],a=e.Points.a;for(let f=0,g=a.length;f<g;f+=4)s.push(new p.Vector4().fromArray(a,f));let c,h;if(e.Form==="Closed")s.push(s[0]);else if(e.Form==="Periodic"){c=i,h=n.length-1-c;for(let f=0;f<i;++f)s.push(s[f])}const m=new sc(i,n,s,c,h).getPoints(s.length*12);return new p.BufferGeometry().setFromPoints(m)}}class Qp{parse(){const e=[],t=this.parseClips();if(t!==void 0)for(const i in t){const n=t[i],s=this.addClip(n);e.push(s)}return e}parseClips(){if(ve.Objects.AnimationCurve===void 0)return;const e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);const t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}parseAnimationCurveNodes(){const e=ve.Objects.AnimationCurveNode,t=new Map;for(const i in e){const n=e[i];if(n.attrName.match(/S|R|T|DeformPercent/)!==null){const s={id:n.id,attr:n.attrName,curves:{}};t.set(s.id,s)}}return t}parseAnimationCurves(e){const t=ve.Objects.AnimationCurve;for(const i in t){const n={id:t[i].id,times:t[i].KeyTime.a.map(em),values:t[i].KeyValueFloat.a},s=Ue.get(n.id);if(s!==void 0){const a=s.parents[0].ID,c=s.parents[0].relationship;c.match(/X/)?e.get(a).curves.x=n:c.match(/Y/)?e.get(a).curves.y=n:c.match(/Z/)?e.get(a).curves.z=n:c.match(/d|DeformPercent/)&&e.has(a)&&(e.get(a).curves.morph=n)}}}parseAnimationLayers(e){const t=ve.Objects.AnimationLayer,i=new Map;for(const n in t){const s=[],a=Ue.get(parseInt(n));a!==void 0&&(a.children.forEach(function(h,d){if(e.has(h.ID)){const m=e.get(h.ID);if(m.curves.x!==void 0||m.curves.y!==void 0||m.curves.z!==void 0){if(s[d]===void 0){const f=Ue.get(h.ID).parents.filter(function(g){return g.relationship!==void 0})[0].ID;if(f!==void 0){const g=ve.Objects.Model[f.toString()];if(g===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",h);return}const _={modelName:g.attrName?p.PropertyBinding.sanitizeNodeName(g.attrName):"",ID:g.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};Mt.traverse(function(w){w.ID===g.id&&(_.transform=w.matrix,w.userData.transformData&&(_.eulerOrder=w.userData.transformData.eulerOrder))}),_.transform||(_.transform=new p.Matrix4),"PreRotation"in g&&(_.preRotation=g.PreRotation.value),"PostRotation"in g&&(_.postRotation=g.PostRotation.value),s[d]=_}}s[d]&&(s[d][m.attr]=m)}else if(m.curves.morph!==void 0){if(s[d]===void 0){const f=Ue.get(h.ID).parents.filter(function(L){return L.relationship!==void 0})[0].ID,g=Ue.get(f).parents[0].ID,_=Ue.get(g).parents[0].ID,w=Ue.get(_).parents[0].ID,b=ve.Objects.Model[w],x={modelName:b.attrName?p.PropertyBinding.sanitizeNodeName(b.attrName):"",morphName:ve.Objects.Deformer[f].attrName};s[d]=x}s[d][m.attr]=m}}}),i.set(parseInt(n),s))}return i}parseAnimStacks(e){const t=ve.Objects.AnimationStack,i={};for(const n in t){const s=Ue.get(parseInt(n)).children;s.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const a=e.get(s[0].ID);i[n]={name:t[n].attrName,layer:a}}return i}addClip(e){let t=[];const i=this;return e.layer.forEach(function(n){t=t.concat(i.generateTracks(n))}),new p.AnimationClip(e.name,-1,t)}generateTracks(e){const t=[];let i=new p.Vector3,n=new p.Quaternion,s=new p.Vector3;if(e.transform&&e.transform.decompose(i,n,s),i=i.toArray(),n=new p.Euler().setFromQuaternion(n,e.eulerOrder).toArray(),s=s.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const a=this.generateVectorTrack(e.modelName,e.T.curves,i,"position");a!==void 0&&t.push(a)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const a=this.generateRotationTrack(e.modelName,e.R.curves,n,e.preRotation,e.postRotation,e.eulerOrder);a!==void 0&&t.push(a)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const a=this.generateVectorTrack(e.modelName,e.S.curves,s,"scale");a!==void 0&&t.push(a)}if(e.DeformPercent!==void 0){const a=this.generateMorphTrack(e);a!==void 0&&t.push(a)}return t}generateVectorTrack(e,t,i,n){const s=this.getTimesForAllAxes(t),a=this.getKeyframeTrackValues(s,t,i);return new p.VectorKeyframeTrack(e+"."+n,s,a)}generateRotationTrack(e,t,i,n,s,a){t.x!==void 0&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(p.MathUtils.degToRad)),t.y!==void 0&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(p.MathUtils.degToRad)),t.z!==void 0&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(p.MathUtils.degToRad));const c=this.getTimesForAllAxes(t),h=this.getKeyframeTrackValues(c,t,i);n!==void 0&&(n=n.map(p.MathUtils.degToRad),n.push(a),n=new p.Euler().fromArray(n),n=new p.Quaternion().setFromEuler(n)),s!==void 0&&(s=s.map(p.MathUtils.degToRad),s.push(a),s=new p.Euler().fromArray(s),s=new p.Quaternion().setFromEuler(s).invert());const d=new p.Quaternion,m=new p.Euler,f=[];for(let g=0;g<h.length;g+=3)m.set(h[g],h[g+1],h[g+2],a),d.setFromEuler(m),n!==void 0&&d.premultiply(n),s!==void 0&&d.multiply(s),d.toArray(f,g/3*4);return new p.QuaternionKeyframeTrack(e+".quaternion",c,f)}generateMorphTrack(e){const t=e.DeformPercent.curves.morph,i=t.values.map(function(s){return s/100}),n=Mt.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new p.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+n+"]",t.times,i)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(i,n){return i-n}),t.length>1){let i=1,n=t[0];for(let s=1;s<t.length;s++){const a=t[s];a!==n&&(t[i]=a,n=a,i++)}t=t.slice(0,i)}return t}getKeyframeTrackValues(e,t,i){const n=i,s=[];let a=-1,c=-1,h=-1;return e.forEach(function(d){if(t.x&&(a=t.x.times.indexOf(d)),t.y&&(c=t.y.times.indexOf(d)),t.z&&(h=t.z.times.indexOf(d)),a!==-1){const m=t.x.values[a];s.push(m),n[0]=m}else s.push(n[0]);if(c!==-1){const m=t.y.values[c];s.push(m),n[1]=m}else s.push(n[1]);if(h!==-1){const m=t.z.values[h];s.push(m),n[2]=m}else s.push(n[2])}),s}interpolateRotations(e){for(let t=1;t<e.values.length;t++){const i=e.values[t-1],n=e.values[t]-i,s=Math.abs(n);if(s>=180){const a=s/180,c=n/a;let h=i+c;const d=e.times[t-1],f=(e.times[t]-d)/a;let g=d+f;const _=[],w=[];for(;g<e.times[t];)_.push(g),g+=f,w.push(h),h+=c;e.times=dc(e.times,t,_),e.values=dc(e.values,t,w)}}}}class Hp{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new ac,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,i=e.split(/[\r\n]+/);return i.forEach(function(n,s){const a=n.match(/^[\s\t]*;/),c=n.match(/^[\s\t]*$/);if(a||c)return;const h=n.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),d=n.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),m=n.match("^\\t{"+(t.currentIndent-1)+"}}");h?t.parseNodeBegin(n,h):d?t.parseNodeProperty(n,d,i[++s]):m?t.popStack():n.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(n)}),this.allNodes}parseNodeBegin(e,t){const i=t[1].trim().replace(/^"/,"").replace(/"$/,""),n=t[2].split(",").map(function(h){return h.trim().replace(/^"/,"").replace(/"$/,"")}),s={name:i},a=this.parseNodeAttr(n),c=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(i,s):i in c?(i==="PoseNode"?c.PoseNode.push(s):c[i].id!==void 0&&(c[i]={},c[i][c[i].id]=c[i]),a.id!==""&&(c[i][a.id]=s)):typeof a.id=="number"?(c[i]={},c[i][a.id]=s):i!=="Properties70"&&(i==="PoseNode"?c[i]=[s]:c[i]=s),typeof a.id=="number"&&(s.id=a.id),a.name!==""&&(s.attrName=a.name),a.type!==""&&(s.attrType=a.type),this.pushStack(s)}parseNodeAttr(e){let t=e[0];e[0]!==""&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let i="",n="";return e.length>1&&(i=e[1].replace(/^(\w+)::/,""),n=e[2]),{id:t,name:i,type:n}}parseNodeProperty(e,t,i){let n=t[1].replace(/^"/,"").replace(/"$/,"").trim(),s=t[2].replace(/^"/,"").replace(/"$/,"").trim();n==="Content"&&s===","&&(s=i.replace(/"/g,"").replace(/,$/,"").trim());const a=this.getCurrentNode();if(a.name==="Properties70"){this.parseNodeSpecialProperty(e,n,s);return}if(n==="C"){const h=s.split(",").slice(1),d=parseInt(h[0]),m=parseInt(h[1]);let f=s.split(",").slice(3);f=f.map(function(g){return g.trim().replace(/^"/,"")}),n="connections",s=[d,m],im(s,f),a[n]===void 0&&(a[n]=[])}n==="Node"&&(a.id=s),n in a&&Array.isArray(a[n])?a[n].push(s):n!=="a"?a[n]=s:a.a=s,this.setCurrentProp(a,n),n==="a"&&s.slice(-1)!==","&&(a.a=Oo(s))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=Oo(t.a))}parseNodeSpecialProperty(e,t,i){const n=i.split('",').map(function(m){return m.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=n[0],a=n[1],c=n[2],h=n[3];let d=n[4];switch(a){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=Oo(d);break}this.getPrevNode()[s]={type:a,type2:c,flag:h,value:d},this.setCurrentProp(this.getPrevNode(),s)}}class $p{parse(e){const t=new oc(e);t.skip(23);const i=t.getUint32();if(i<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+i);const n=new ac;for(;!this.endOfContent(t);){const s=this.parseNode(t,i);s!==null&&n.add(s.name,s)}return n}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const i={},n=t>=7500?e.getUint64():e.getUint32(),s=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const a=e.getUint8(),c=e.getString(a);if(n===0)return null;const h=[];for(let g=0;g<s;g++)h.push(this.parseProperty(e));const d=h.length>0?h[0]:"",m=h.length>1?h[1]:"",f=h.length>2?h[2]:"";for(i.singleProperty=s===1&&e.getOffset()===n;n>e.getOffset();){const g=this.parseNode(e,t);g!==null&&this.parseSubNode(c,i,g)}return i.propertyList=h,typeof d=="number"&&(i.id=d),m!==""&&(i.attrName=m),f!==""&&(i.attrType=f),c!==""&&(i.name=c),i}parseSubNode(e,t,i){if(i.singleProperty===!0){const n=i.propertyList[0];Array.isArray(n)?(t[i.name]=i,i.a=n):t[i.name]=n}else if(e==="Connections"&&i.name==="C"){const n=[];i.propertyList.forEach(function(s,a){a!==0&&n.push(s)}),t.connections===void 0&&(t.connections=[]),t.connections.push(n)}else if(i.name==="Properties70")Object.keys(i).forEach(function(s){t[s]=i[s]});else if(e==="Properties70"&&i.name==="P"){let n=i.propertyList[0],s=i.propertyList[1];const a=i.propertyList[2],c=i.propertyList[3];let h;n.indexOf("Lcl ")===0&&(n=n.replace("Lcl ","Lcl_")),s.indexOf("Lcl ")===0&&(s=s.replace("Lcl ","Lcl_")),s==="Color"||s==="ColorRGB"||s==="Vector"||s==="Vector3D"||s.indexOf("Lcl_")===0?h=[i.propertyList[4],i.propertyList[5],i.propertyList[6]]:h=i.propertyList[4],t[n]={type:s,type2:a,flag:c,value:h}}else t[i.name]===void 0?typeof i.id=="number"?(t[i.name]={},t[i.name][i.id]=i):t[i.name]=i:i.name==="PoseNode"?(Array.isArray(t[i.name])||(t[i.name]=[t[i.name]]),t[i.name].push(i)):t[i.name][i.id]===void 0&&(t[i.name][i.id]=i)}parseProperty(e){const t=e.getString(1);let i;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return i=e.getUint32(),e.getArrayBuffer(i);case"S":return i=e.getUint32(),e.getString(i);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const n=e.getUint32(),s=e.getUint32(),a=e.getUint32();if(s===0)switch(t){case"b":case"c":return e.getBooleanArray(n);case"d":return e.getFloat64Array(n);case"f":return e.getFloat32Array(n);case"i":return e.getInt32Array(n);case"l":return e.getInt64Array(n)}const c=Cf(new Uint8Array(e.getArrayBuffer(a))),h=new oc(c.buffer);switch(t){case"b":case"c":return h.getBooleanArray(n);case"d":return h.getFloat64Array(n);case"f":return h.getFloat32Array(n);case"i":return h.getInt32Array(n);case"l":return h.getInt64Array(n)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class oc{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let i=0;i<e;i++)t.push(this.getBoolean());return t}getUint8(){const e=this.dv.getUint8(this.offset);return this.offset+=1,e}getInt16(){const e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}getInt32(){const e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}getInt32Array(e){const t=[];for(let i=0;i<e;i++)t.push(this.getInt32());return t}getUint32(){const e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}getInt64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t&2147483648?(t=~t&4294967295,e=~e&4294967295,e===4294967295&&(t=t+1&4294967295),e=e+1&4294967295,-(t*4294967296+e)):t*4294967296+e}getInt64Array(e){const t=[];for(let i=0;i<e;i++)t.push(this.getInt64());return t}getUint64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t*4294967296+e}getFloat32(){const e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){const t=[];for(let i=0;i<e;i++)t.push(this.getFloat32());return t}getFloat64(){const e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}getFloat64Array(e){const t=[];for(let i=0;i<e;i++)t.push(this.getFloat64());return t}getArrayBuffer(e){const t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}getString(e){let t=[];for(let n=0;n<e;n++)t[n]=this.getUint8();const i=t.indexOf(0);return i>=0&&(t=t.slice(0,i)),Bn(new Uint8Array(t))}}class ac{add(e,t){this[e]=t}}function Ep(r){const e="Kaydara FBX Binary \0";return r.byteLength>=e.length&&e===uc(r,0,e.length)}function qp(r){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function i(n){const s=r[n-1];return r=r.slice(t+n),t++,s}for(let n=0;n<e.length;++n)if(i(1)===e[n])return!1;return!0}function lc(r){const e=/FBXVersion: (\d+)/,t=r.match(e);if(t)return parseInt(t[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function em(r){return r/46186158e3}const tm=[];function os(r,e,t,i){let n;switch(i.mappingType){case"ByPolygonVertex":n=r;break;case"ByPolygon":n=e;break;case"ByVertice":n=t;break;case"AllSame":n=i.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+i.mappingType)}i.referenceType==="IndexToDirect"&&(n=i.indices[n]);const s=n*i.dataSize,a=s+i.dataSize;return nm(tm,i.buffer,s,a)}const Fo=new p.Euler,Rn=new p.Vector3;function cc(r){const e=new p.Matrix4,t=new p.Matrix4,i=new p.Matrix4,n=new p.Matrix4,s=new p.Matrix4,a=new p.Matrix4,c=new p.Matrix4,h=new p.Matrix4,d=new p.Matrix4,m=new p.Matrix4,f=new p.Matrix4,g=new p.Matrix4,_=r.inheritType?r.inheritType:0;if(r.translation&&e.setPosition(Rn.fromArray(r.translation)),r.preRotation){const V=r.preRotation.map(p.MathUtils.degToRad);V.push(r.eulerOrder),t.makeRotationFromEuler(Fo.fromArray(V))}if(r.rotation){const V=r.rotation.map(p.MathUtils.degToRad);V.push(r.eulerOrder),i.makeRotationFromEuler(Fo.fromArray(V))}if(r.postRotation){const V=r.postRotation.map(p.MathUtils.degToRad);V.push(r.eulerOrder),n.makeRotationFromEuler(Fo.fromArray(V)),n.invert()}r.scale&&s.scale(Rn.fromArray(r.scale)),r.scalingOffset&&c.setPosition(Rn.fromArray(r.scalingOffset)),r.scalingPivot&&a.setPosition(Rn.fromArray(r.scalingPivot)),r.rotationOffset&&h.setPosition(Rn.fromArray(r.rotationOffset)),r.rotationPivot&&d.setPosition(Rn.fromArray(r.rotationPivot)),r.parentMatrixWorld&&(f.copy(r.parentMatrix),m.copy(r.parentMatrixWorld));const w=t.clone().multiply(i).multiply(n),b=new p.Matrix4;b.extractRotation(m);const x=new p.Matrix4;x.copyPosition(m);const L=x.clone().invert().multiply(m),M=b.clone().invert().multiply(L),C=s,W=new p.Matrix4;if(_===0)W.copy(b).multiply(w).multiply(M).multiply(C);else if(_===1)W.copy(b).multiply(M).multiply(w).multiply(C);else{const G=new p.Matrix4().scale(new p.Vector3().setFromMatrixScale(f)).clone().invert(),N=M.clone().multiply(G);W.copy(b).multiply(w).multiply(N).multiply(C)}const D=d.clone().invert(),z=a.clone().invert();let X=e.clone().multiply(h).multiply(d).multiply(t).multiply(i).multiply(n).multiply(D).multiply(c).multiply(a).multiply(s).multiply(z);const I=new p.Matrix4().copyPosition(X),U=m.clone().multiply(I);return g.copyPosition(U),X=g.clone().multiply(W),X.premultiply(m.invert()),X}function hc(r){r=r||0;const e=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return r===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),e[0]):e[r]}function Oo(r){return r.split(",").map(function(t){return parseFloat(t)})}function uc(r,e,t){return e===void 0&&(e=0),t===void 0&&(t=r.byteLength),Bn(new Uint8Array(r,e,t))}function im(r,e){for(let t=0,i=r.length,n=e.length;t<n;t++,i++)r[i]=e[t]}function nm(r,e,t,i){for(let n=t,s=0;n<i;n++,s++)r[s]=e[n];return r}function dc(r,e,t){return r.slice(0,e).concat(t).concat(r.slice(e))}class rm extends p.DataTextureLoader{constructor(e){super(e),this.type=p.HalfFloatType}parse(e){const a=function(I,U){switch(I){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(U||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(U||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(U||""));default:case 4:throw new Error("THREE.RGBELoader: Memory Error: "+(U||""))}},m=`
208
+ `,f=function(I,U,V){U=U||1024;let N=I.pos,j=-1,Y=0,H="",Q=String.fromCharCode.apply(null,new Uint16Array(I.subarray(N,N+128)));for(;0>(j=Q.indexOf(m))&&Y<U&&N<I.byteLength;)H+=Q,Y+=Q.length,N+=128,Q+=String.fromCharCode.apply(null,new Uint16Array(I.subarray(N,N+128)));return-1<j?(I.pos+=Y+j+1,H+Q.slice(0,j)):!1},g=function(I){const U=/^#\?(\S+)/,V=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,G=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,N=/^\s*FORMAT=(\S+)\s*$/,j=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,Y={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let H,Q;for((I.pos>=I.byteLength||!(H=f(I)))&&a(1,"no header found"),(Q=H.match(U))||a(3,"bad initial token"),Y.valid|=1,Y.programtype=Q[1],Y.string+=H+`
209
+ `;H=f(I),H!==!1;){if(Y.string+=H+`
210
+ `,H.charAt(0)==="#"){Y.comments+=H+`
211
+ `;continue}if((Q=H.match(V))&&(Y.gamma=parseFloat(Q[1])),(Q=H.match(G))&&(Y.exposure=parseFloat(Q[1])),(Q=H.match(N))&&(Y.valid|=2,Y.format=Q[1]),(Q=H.match(j))&&(Y.valid|=4,Y.height=parseInt(Q[1],10),Y.width=parseInt(Q[2],10)),Y.valid&2&&Y.valid&4)break}return Y.valid&2||a(3,"missing format specifier"),Y.valid&4||a(3,"missing image size specifier"),Y},_=function(I,U,V){const G=U;if(G<8||G>32767||I[0]!==2||I[1]!==2||I[2]&128)return new Uint8Array(I);G!==(I[2]<<8|I[3])&&a(3,"wrong scanline width");const N=new Uint8Array(4*U*V);N.length||a(4,"unable to allocate buffer space");let j=0,Y=0;const H=4*G,Q=new Uint8Array(4),re=new Uint8Array(H);let ne=V;for(;ne>0&&Y<I.byteLength;){Y+4>I.byteLength&&a(1),Q[0]=I[Y++],Q[1]=I[Y++],Q[2]=I[Y++],Q[3]=I[Y++],(Q[0]!=2||Q[1]!=2||(Q[2]<<8|Q[3])!=G)&&a(3,"bad rgbe scanline format");let le=0,de;for(;le<H&&Y<I.byteLength;){de=I[Y++];const fe=de>128;if(fe&&(de-=128),(de===0||le+de>H)&&a(3,"bad scanline data"),fe){const Se=I[Y++];for(let st=0;st<de;st++)re[le++]=Se}else re.set(I.subarray(Y,Y+de),le),le+=de,Y+=de}const ge=G;for(let fe=0;fe<ge;fe++){let Se=0;N[j]=re[fe+Se],Se+=G,N[j+1]=re[fe+Se],Se+=G,N[j+2]=re[fe+Se],Se+=G,N[j+3]=re[fe+Se],j+=4}ne--}return N},w=function(I,U,V,G){const N=I[U+3],j=Math.pow(2,N-128)/255;V[G+0]=I[U+0]*j,V[G+1]=I[U+1]*j,V[G+2]=I[U+2]*j,V[G+3]=1},b=function(I,U,V,G){const N=I[U+3],j=Math.pow(2,N-128)/255;V[G+0]=p.DataUtils.toHalfFloat(Math.min(I[U+0]*j,65504)),V[G+1]=p.DataUtils.toHalfFloat(Math.min(I[U+1]*j,65504)),V[G+2]=p.DataUtils.toHalfFloat(Math.min(I[U+2]*j,65504)),V[G+3]=p.DataUtils.toHalfFloat(1)},x=new Uint8Array(e);x.pos=0;const L=g(x),M=L.width,C=L.height,W=_(x.subarray(x.pos),M,C);let D,z,X;switch(this.type){case p.FloatType:X=W.length/4;const I=new Float32Array(X*4);for(let V=0;V<X;V++)w(W,V*4,I,V*4);D=I,z=p.FloatType;break;case p.HalfFloatType:X=W.length/4;const U=new Uint16Array(X*4);for(let V=0;V<X;V++)b(W,V*4,U,V*4);D=U,z=p.HalfFloatType;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:M,height:C,data:D,header:L.string,gamma:L.gamma,exposure:L.exposure,type:z}}setDataType(e){return this.type=e,this}load(e,t,i,n){function s(a,c){switch(a.type){case p.FloatType:case p.HalfFloatType:"colorSpace"in a?a.colorSpace="srgb-linear":a.encoding=3e3,a.minFilter=p.LinearFilter,a.magFilter=p.LinearFilter,a.generateMipmaps=!1,a.flipY=!0;break}t&&t(a,c)}return super.load(e,s,i,n)}}const zo=new WeakMap;class sm extends p.Loader{constructor(e){super(e),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(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,i,n){const s=new p.FileLoader(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,a=>{const c={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(a,c).then(t).catch(n)},i,n)}decodeDracoFile(e,t,i,n){const s={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!i};this.decodeGeometry(e,s).then(t)}decodeGeometry(e,t){for(const h in t.attributeTypes){const d=t.attributeTypes[h];d.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[h]=d.name)}const i=JSON.stringify(t);if(zo.has(e)){const h=zo.get(e);if(h.key===i)return h.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let n;const s=this.workerNextTaskID++,a=e.byteLength,c=this._getWorker(s,a).then(h=>(n=h,new Promise((d,m)=>{n._callbacks[s]={resolve:d,reject:m},n.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(h=>this._createGeometry(h.geometry));return c.catch(()=>!0).then(()=>{n&&s&&this._releaseTask(n,s)}),zo.set(e,{key:i,promise:c}),c}_createGeometry(e){const t=new p.BufferGeometry;e.index&&t.setIndex(new p.BufferAttribute(e.index.array,1));for(let i=0;i<e.attributes.length;i++){const n=e.attributes[i],s=n.name,a=n.array,c=n.itemSize;t.setAttribute(s,new p.BufferAttribute(a,c))}return t}_loadLibrary(e,t){const i=new p.FileLoader(this.manager);return i.setPath(this.decoderPath),i.setResponseType(t),i.setWithCredentials(this.withCredentials),new Promise((n,s)=>{i.load(e,n,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(i=>{const n=i[0];e||(this.decoderConfig.wasmBinary=i[1]);const s=om.toString(),a=["/* draco decoder */",n,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(`
212
+ `);this.workerSourceURL=URL.createObjectURL(new Blob([a]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const n=new Worker(this.workerSourceURL);n._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:this.decoderConfig}),n.onmessage=function(s){const a=s.data;switch(a.type){case"decode":n._callbacks[a.id].resolve(a);break;case"error":n._callbacks[a.id].reject(a);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+a.type+'"')}},this.workerPool.push(n)}else this.workerPool.sort(function(n,s){return n._taskLoad>s._taskLoad?-1:1});const i=this.workerPool[this.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}function om(){let r,e;onmessage=function(a){const c=a.data;switch(c.type){case"init":r=c.decoderConfig,e=new Promise(function(m){r.onModuleLoaded=function(f){m({draco:f})},DracoDecoderModule(r)});break;case"decode":const h=c.buffer,d=c.taskConfig;e.then(m=>{const f=m.draco,g=new f.Decoder,_=new f.DecoderBuffer;_.Init(new Int8Array(h),h.byteLength);try{const w=t(f,g,_,d),b=w.attributes.map(x=>x.array.buffer);w.index&&b.push(w.index.array.buffer),self.postMessage({type:"decode",id:c.id,geometry:w},b)}catch(w){console.error(w),self.postMessage({type:"error",id:c.id,error:w.message})}finally{f.destroy(_),f.destroy(g)}});break}};function t(a,c,h,d){const m=d.attributeIDs,f=d.attributeTypes;let g,_;const w=c.GetEncodedGeometryType(h);if(w===a.TRIANGULAR_MESH)g=new a.Mesh,_=c.DecodeBufferToMesh(h,g);else if(w===a.POINT_CLOUD)g=new a.PointCloud,_=c.DecodeBufferToPointCloud(h,g);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!_.ok()||g.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+_.error_msg());const b={index:null,attributes:[]};for(const x in m){const L=self[f[x]];let M,C;if(d.useUniqueIDs)C=m[x],M=c.GetAttributeByUniqueId(g,C);else{if(C=c.GetAttributeId(g,a[m[x]]),C===-1)continue;M=c.GetAttribute(g,C)}b.attributes.push(n(a,c,g,x,L,M))}return w===a.TRIANGULAR_MESH&&(b.index=i(a,c,g)),a.destroy(g),b}function i(a,c,h){const m=h.num_faces()*3,f=m*4,g=a._malloc(f);c.GetTrianglesUInt32Array(h,f,g);const _=new Uint32Array(a.HEAPF32.buffer,g,m).slice();return a._free(g),{array:_,itemSize:1}}function n(a,c,h,d,m,f){const g=f.num_components(),w=h.num_points()*g,b=w*m.BYTES_PER_ELEMENT,x=s(a,m),L=a._malloc(b);c.GetAttributeDataArrayForAllPoints(h,f,x,b,L);const M=new m(a.HEAPF32.buffer,L,w).slice();return a._free(L),{name:d,array:M,itemSize:g}}function s(a,c){switch(c){case Float32Array:return a.DT_FLOAT32;case Int8Array:return a.DT_INT8;case Int16Array:return a.DT_INT16;case Int32Array:return a.DT_INT32;case Uint8Array:return a.DT_UINT8;case Uint16Array:return a.DT_UINT16;case Uint32Array:return a.DT_UINT32}}}const fc=new p.Box3,as=new p.Vector3;class pc extends p.InstancedBufferGeometry{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new p.Float32BufferAttribute(e,3)),this.setAttribute("uv",new p.Float32BufferAttribute(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,i=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),i.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const i=new p.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceStart",new p.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceEnd",new p.InterleavedBufferAttribute(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e,t=3){let i;e instanceof Float32Array?i=e:Array.isArray(e)&&(i=new Float32Array(e));const n=new p.InstancedInterleavedBuffer(i,t*2,1);return this.setAttribute("instanceColorStart",new p.InterleavedBufferAttribute(n,t,0)),this.setAttribute("instanceColorEnd",new p.InterleavedBufferAttribute(n,t,t)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new p.WireframeGeometry(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new p.Box3);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),fc.setFromBufferAttribute(t),this.boundingBox.union(fc))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new p.Sphere),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let n=0;for(let s=0,a=e.count;s<a;s++)as.fromBufferAttribute(e,s),n=Math.max(n,i.distanceToSquared(as)),as.fromBufferAttribute(t,s),n=Math.max(n,i.distanceToSquared(as));this.boundingSphere.radius=Math.sqrt(n),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(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}class Ni extends pc{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const t=e.length-3,i=new Float32Array(2*t);for(let n=0;n<t;n+=3)i[2*n]=e[n],i[2*n+1]=e[n+1],i[2*n+2]=e[n+2],i[2*n+3]=e[n+3],i[2*n+4]=e[n+4],i[2*n+5]=e[n+5];return super.setPositions(i),this}setColors(e,t=3){const i=e.length-t,n=new Float32Array(2*i);if(t===3)for(let s=0;s<i;s+=t)n[2*s]=e[s],n[2*s+1]=e[s+1],n[2*s+2]=e[s+2],n[2*s+3]=e[s+3],n[2*s+4]=e[s+4],n[2*s+5]=e[s+5];else for(let s=0;s<i;s+=t)n[2*s]=e[s],n[2*s+1]=e[s+1],n[2*s+2]=e[s+2],n[2*s+3]=e[s+3],n[2*s+4]=e[s+4],n[2*s+5]=e[s+5],n[2*s+6]=e[s+6],n[2*s+7]=e[s+7];return super.setColors(n,t),this}fromLine(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}}class vn extends p.ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:p.UniformsUtils.clone(p.UniformsUtils.merge([p.UniformsLib.common,p.UniformsLib.fog,{worldUnits:{value:1},linewidth:{value:1},resolution:{value:new p.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}}])),vertexShader:`
103
213
  #include <common>
104
214
  #include <fog_pars_vertex>
105
215
  #include <logdepthbuf_pars_vertex>
@@ -502,19 +612,341 @@
502
612
  gl_FragColor = diffuseColor;
503
613
 
504
614
  #include <tonemapping_fragment>
505
- #include <${fi>=154?"colorspace_fragment":"encodings_fragment"}>
615
+ #include <${ns>=154?"colorspace_fragment":"encodings_fragment"}>
506
616
  #include <fog_fragment>
507
617
  #include <premultiplied_alpha_fragment>
508
618
 
509
619
  }
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;
620
+ `,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(t){this.uniforms.diffuse.value=t}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(t){t===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashed:{enumerable:!0,get:function(){return"USE_DASH"in this.defines},set(t){!!t!="USE_DASH"in this.defines&&(this.needsUpdate=!0),t===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},alphaToCoverage:{enumerable:!0,get:function(){return"USE_ALPHA_TO_COVERAGE"in this.defines},set:function(t){!!t!="USE_ALPHA_TO_COVERAGE"in this.defines&&(this.needsUpdate=!0),t===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}const Do=new p.Vector4,mc=new p.Vector3,gc=new p.Vector3,qe=new p.Vector4,et=new p.Vector4,pi=new p.Vector4,Xo=new p.Vector3,ko=new p.Matrix4,tt=new p.Line3,yc=new p.Vector3,ls=new p.Box3,cs=new p.Sphere,mi=new p.Vector4;let gi,wn;function _c(r,e,t){return mi.set(0,0,-e,1).applyMatrix4(r.projectionMatrix),mi.multiplyScalar(1/mi.w),mi.x=wn/t.width,mi.y=wn/t.height,mi.applyMatrix4(r.projectionMatrixInverse),mi.multiplyScalar(1/mi.w),Math.abs(Math.max(mi.x,mi.y))}function am(r,e){const t=r.matrixWorld,i=r.geometry,n=i.attributes.instanceStart,s=i.attributes.instanceEnd,a=Math.min(i.instanceCount,n.count);for(let c=0,h=a;c<h;c++){tt.start.fromBufferAttribute(n,c),tt.end.fromBufferAttribute(s,c),tt.applyMatrix4(t);const d=new p.Vector3,m=new p.Vector3;gi.distanceSqToSegment(tt.start,tt.end,m,d),m.distanceTo(d)<wn*.5&&e.push({point:m,pointOnLine:d,distance:gi.origin.distanceTo(m),object:r,face:null,faceIndex:c,uv:null,[Mo]:null})}}function lm(r,e,t){const i=e.projectionMatrix,s=r.material.resolution,a=r.matrixWorld,c=r.geometry,h=c.attributes.instanceStart,d=c.attributes.instanceEnd,m=Math.min(c.instanceCount,h.count),f=-e.near;gi.at(1,pi),pi.w=1,pi.applyMatrix4(e.matrixWorldInverse),pi.applyMatrix4(i),pi.multiplyScalar(1/pi.w),pi.x*=s.x/2,pi.y*=s.y/2,pi.z=0,Xo.copy(pi),ko.multiplyMatrices(e.matrixWorldInverse,a);for(let g=0,_=m;g<_;g++){if(qe.fromBufferAttribute(h,g),et.fromBufferAttribute(d,g),qe.w=1,et.w=1,qe.applyMatrix4(ko),et.applyMatrix4(ko),qe.z>f&&et.z>f)continue;if(qe.z>f){const C=qe.z-et.z,W=(qe.z-f)/C;qe.lerp(et,W)}else if(et.z>f){const C=et.z-qe.z,W=(et.z-f)/C;et.lerp(qe,W)}qe.applyMatrix4(i),et.applyMatrix4(i),qe.multiplyScalar(1/qe.w),et.multiplyScalar(1/et.w),qe.x*=s.x/2,qe.y*=s.y/2,et.x*=s.x/2,et.y*=s.y/2,tt.start.copy(qe),tt.start.z=0,tt.end.copy(et),tt.end.z=0;const b=tt.closestPointToPointParameter(Xo,!0);tt.at(b,yc);const x=p.MathUtils.lerp(qe.z,et.z,b),L=x>=-1&&x<=1,M=Xo.distanceTo(yc)<wn*.5;if(L&&M){tt.start.fromBufferAttribute(h,g),tt.end.fromBufferAttribute(d,g),tt.start.applyMatrix4(a),tt.end.applyMatrix4(a);const C=new p.Vector3,W=new p.Vector3;gi.distanceSqToSegment(tt.start,tt.end,W,C),t.push({point:W,pointOnLine:C,distance:gi.origin.distanceTo(W),object:r,face:null,faceIndex:g,uv:null,[Mo]:null})}}}class cm extends p.Mesh{constructor(e=new pc,t=new vn({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,n=new Float32Array(2*t.count);for(let a=0,c=0,h=t.count;a<h;a++,c+=2)mc.fromBufferAttribute(t,a),gc.fromBufferAttribute(i,a),n[c]=c===0?0:n[c-1],n[c+1]=n[c]+mc.distanceTo(gc);const s=new p.InstancedInterleavedBuffer(n,2,1);return e.setAttribute("instanceDistanceStart",new p.InterleavedBufferAttribute(s,1,0)),e.setAttribute("instanceDistanceEnd",new p.InterleavedBufferAttribute(s,1,1)),this}raycast(e,t){const i=this.material.worldUnits,n=e.camera;n===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;gi=e.ray;const a=this.matrixWorld,c=this.geometry,h=this.material;wn=h.linewidth+s,c.boundingSphere===null&&c.computeBoundingSphere(),cs.copy(c.boundingSphere).applyMatrix4(a);let d;if(i)d=wn*.5;else{const f=Math.max(n.near,cs.distanceToPoint(gi.origin));d=_c(n,f,h.resolution)}if(cs.radius+=d,gi.intersectsSphere(cs)===!1)return;c.boundingBox===null&&c.computeBoundingBox(),ls.copy(c.boundingBox).applyMatrix4(a);let m;if(i)m=wn*.5;else{const f=Math.max(n.near,ls.distanceToPoint(gi.origin));m=_c(n,f,h.resolution)}ls.expandByScalar(m),gi.intersectsBox(ls)!==!1&&(i?am(this,t):lm(this,n,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(Do),this.material.uniforms.resolution.value.set(Do.z,Do.w))}}class bn extends cm{constructor(e=new Ni,t=new vn({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}var Ki=Object.freeze({Linear:Object.freeze({None:function(r){return r},In:function(r){return this.None(r)},Out:function(r){return this.None(r)},InOut:function(r){return this.None(r)}}),Quadratic:Object.freeze({In:function(r){return r*r},Out:function(r){return r*(2-r)},InOut:function(r){return(r*=2)<1?.5*r*r:-.5*(--r*(r-2)-1)}}),Cubic:Object.freeze({In:function(r){return r*r*r},Out:function(r){return--r*r*r+1},InOut:function(r){return(r*=2)<1?.5*r*r*r:.5*((r-=2)*r*r+2)}}),Quartic:Object.freeze({In:function(r){return r*r*r*r},Out:function(r){return 1- --r*r*r*r},InOut:function(r){return(r*=2)<1?.5*r*r*r*r:-.5*((r-=2)*r*r*r-2)}}),Quintic:Object.freeze({In:function(r){return r*r*r*r*r},Out:function(r){return--r*r*r*r*r+1},InOut:function(r){return(r*=2)<1?.5*r*r*r*r*r:.5*((r-=2)*r*r*r*r+2)}}),Sinusoidal:Object.freeze({In:function(r){return 1-Math.sin((1-r)*Math.PI/2)},Out:function(r){return Math.sin(r*Math.PI/2)},InOut:function(r){return .5*(1-Math.sin(Math.PI*(.5-r)))}}),Exponential:Object.freeze({In:function(r){return r===0?0:Math.pow(1024,r-1)},Out:function(r){return r===1?1:1-Math.pow(2,-10*r)},InOut:function(r){return r===0?0:r===1?1:(r*=2)<1?.5*Math.pow(1024,r-1):.5*(-Math.pow(2,-10*(r-1))+2)}}),Circular:Object.freeze({In:function(r){return 1-Math.sqrt(1-r*r)},Out:function(r){return Math.sqrt(1- --r*r)},InOut:function(r){return(r*=2)<1?-.5*(Math.sqrt(1-r*r)-1):.5*(Math.sqrt(1-(r-=2)*r)+1)}}),Elastic:Object.freeze({In:function(r){return r===0?0:r===1?1:-Math.pow(2,10*(r-1))*Math.sin((r-1.1)*5*Math.PI)},Out:function(r){return r===0?0:r===1?1:Math.pow(2,-10*r)*Math.sin((r-.1)*5*Math.PI)+1},InOut:function(r){return r===0?0:r===1?1:(r*=2,r<1?-.5*Math.pow(2,10*(r-1))*Math.sin((r-1.1)*5*Math.PI):.5*Math.pow(2,-10*(r-1))*Math.sin((r-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(r){var e=1.70158;return r===1?1:r*r*((e+1)*r-e)},Out:function(r){var e=1.70158;return r===0?0:--r*r*((e+1)*r+e)+1},InOut:function(r){var e=2.5949095;return(r*=2)<1?.5*(r*r*((e+1)*r-e)):.5*((r-=2)*r*((e+1)*r+e)+2)}}),Bounce:Object.freeze({In:function(r){return 1-Ki.Bounce.Out(1-r)},Out:function(r){return r<1/2.75?7.5625*r*r:r<2/2.75?7.5625*(r-=1.5/2.75)*r+.75:r<2.5/2.75?7.5625*(r-=2.25/2.75)*r+.9375:7.5625*(r-=2.625/2.75)*r+.984375},InOut:function(r){return r<.5?Ki.Bounce.In(r*2)*.5:Ki.Bounce.Out(r*2-1)*.5+.5}}),generatePow:function(r){return r===void 0&&(r=4),r=r<Number.EPSILON?Number.EPSILON:r,r=r>1e4?1e4:r,{In:function(e){return Math.pow(e,r)},Out:function(e){return 1-Math.pow(1-e,r)},InOut:function(e){return e<.5?Math.pow(e*2,r)/2:(1-Math.pow(2-e*2,r))/2+.5}}}}),br=function(){return performance.now()},hm=function(){function r(){this._tweens={},this._tweensAddedDuringUpdate={}}return r.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(t){return e._tweens[t]})},r.prototype.removeAll=function(){this._tweens={}},r.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},r.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},r.prototype.update=function(e,t){e===void 0&&(e=br()),t===void 0&&(t=!1);var i=Object.keys(this._tweens);if(i.length===0)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var n=0;n<i.length;n++){var s=this._tweens[i[n]],a=!t;s&&s.update(e,a)===!1&&!t&&delete this._tweens[i[n]]}i=Object.keys(this._tweensAddedDuringUpdate)}return!0},r}(),Uo={Linear:function(r,e){var t=r.length-1,i=t*e,n=Math.floor(i),s=Uo.Utils.Linear;return e<0?s(r[0],r[1],i):e>1?s(r[t],r[t-1],t-i):s(r[n],r[n+1>t?t:n+1],i-n)},Utils:{Linear:function(r,e,t){return(e-r)*t+r}}},vc=function(){function r(){}return r.nextId=function(){return r._nextId++},r._nextId=0,r}(),No=new hm,hs=function(){function r(e,t){t===void 0&&(t=No),this._object=e,this._group=t,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=Ki.Linear.None,this._interpolationFunction=Uo.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=vc.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return r.prototype.getId=function(){return this._id},r.prototype.isPlaying=function(){return this._isPlaying},r.prototype.isPaused=function(){return this._isPaused},r.prototype.getDuration=function(){return this._duration},r.prototype.to=function(e,t){if(t===void 0&&(t=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=e,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this},r.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},r.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},r.prototype.start=function(e,t){if(e===void 0&&(e=br()),t===void 0&&(t=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var i in this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var n={};for(var s in this._valuesEnd)n[s]=this._valuesEnd[s];this._valuesEnd=n}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},r.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},r.prototype._setupProperties=function(e,t,i,n,s){for(var a in i){var c=e[a],h=Array.isArray(c),d=h?"array":typeof c,m=!h&&Array.isArray(i[a]);if(!(d==="undefined"||d==="function")){if(m){var f=i[a];if(f.length===0)continue;for(var g=[c],_=0,w=f.length;_<w;_+=1){var b=this._handleRelativeValue(c,f[_]);if(isNaN(b)){m=!1,console.warn("Found invalid interpolation list. Skipping.");break}g.push(b)}m&&(i[a]=g)}if((d==="object"||h)&&c&&!m){t[a]=h?[]:{};var x=c;for(var L in x)t[a][L]=x[L];n[a]=h?[]:{};var f=i[a];if(!this._isDynamic){var M={};for(var L in f)M[L]=f[L];i[a]=f=M}this._setupProperties(x,t[a],f,n[a],s)}else(typeof t[a]>"u"||s)&&(t[a]=c),h||(t[a]*=1),m?n[a]=i[a].slice().reverse():n[a]=t[a]||0}}},r.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},r.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},r.prototype.pause=function(e){return e===void 0&&(e=br()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this),this)},r.prototype.resume=function(e){return e===void 0&&(e=br()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},r.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},r.prototype.group=function(e){return e===void 0&&(e=No),this._group=e,this},r.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},r.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},r.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},r.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},r.prototype.easing=function(e){return e===void 0&&(e=Ki.Linear.None),this._easingFunction=e,this},r.prototype.interpolation=function(e){return e===void 0&&(e=Uo.Linear),this._interpolationFunction=e,this},r.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},r.prototype.onStart=function(e){return this._onStartCallback=e,this},r.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},r.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},r.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},r.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},r.prototype.onStop=function(e){return this._onStopCallback=e,this},r.prototype.update=function(e,t){var i=this,n;if(e===void 0&&(e=br()),t===void 0&&(t=!0),this._isPaused)return!0;var s,a=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>a)return!1;t&&this.start(e,!0)}if(this._goToEnd=!1,e<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=e-this._startTime,h=this._duration+((n=this._repeatDelayTime)!==null&&n!==void 0?n:this._delayTime),d=this._duration+this._repeat*h,m=function(){if(i._duration===0||c>d)return 1;var x=Math.trunc(c/h),L=c-x*h,M=Math.min(L/i._duration,1);return M===0&&c===i._duration?1:M},f=m(),g=this._easingFunction(f);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,g),this._onUpdateCallback&&this._onUpdateCallback(this._object,f),this._duration===0||c>=this._duration)if(this._repeat>0){var _=Math.min(Math.trunc((c-this._duration)/h)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=_);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+=h*_,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var w=0,b=this._chainedTweens.length;w<b;w++)this._chainedTweens[w].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},r.prototype._updateProperties=function(e,t,i,n){for(var s in i)if(t[s]!==void 0){var a=t[s]||0,c=i[s],h=Array.isArray(e[s]),d=Array.isArray(c),m=!h&&d;m?e[s]=this._interpolationFunction(c,n):typeof c=="object"&&c?this._updateProperties(e[s],a,c,n):(c=this._handleRelativeValue(a,c),typeof c=="number"&&(e[s]=a+(c-a)*n))}},r.prototype._handleRelativeValue=function(e,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?e+parseFloat(t):parseFloat(t)},r.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],i=this._valuesEnd[e];typeof i=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(i):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=t},r}();vc.nextId;var yi=No;yi.getAll.bind(yi),yi.removeAll.bind(yi),yi.add.bind(yi),yi.remove.bind(yi);var um=yi.update.bind(yi);function Ko(r,e,t){if(r==null||r==="")throw new Error(t||`Parameter "${e}" is required but received: ${r}`);return r}function wc(r,e,t){const i=e.split(".");let n=r;for(const s of i){if(n[s]===void 0||n[s]===null)throw new Error(`Property "${e}" is required but missing at path: "${s}"`);n=n[s]}return n}function dm(r,e,t,i=0,n=1){const s=(r-e)*(n-i)/(t-e)+i,a=Math.min(i,n),c=Math.max(i,n);return s<a?a:s>c?c:s||0}var fm=Object.defineProperty,pm=(r,e,t)=>e in r?fm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,bc=(r,e,t)=>pm(r,typeof e!="symbol"?e+"":e,t);class Bo{constructor(){bc(this,"_dispatcher",new p.EventDispatcher),bc(this,"_listenerMap",new Map)}on(e,t){const i=n=>t(n.data||n);return this._listenerMap.has(e)||this._listenerMap.set(e,new Map),this._listenerMap.get(e).set(t,i),this._dispatcher.addEventListener(e,i),this}once(e,t){const i=n=>{this.off(e,i),t(n.data||n)};return this.on(e,i)}off(e,t){const i=this._listenerMap.get(e);if(!i)return this;const n=i.get(t);return n&&(this._dispatcher.removeEventListener(e,n),i.delete(t),i.size===0&&this._listenerMap.delete(e)),this}trigger(e,t){const i={type:e,data:t};return this._dispatcher.dispatchEvent(i),this}get threeEventDispatcher(){return this._dispatcher}}function mm(r,e){return r.replace(/\{(\w+)\}/g,(t,i)=>{if(e.hasOwnProperty(i)){const n=e[i];return n!==void 0?String(n):t}throw new Error(`缺少必要参数: ${i}`)})}function Yo(r,...e){for(let t=0;t<e.length;t++){const i=e[t];for(const n in i)r[n]=i[n]}return r}function us(r){return r==null}function xr(r){return us(r)?!1:typeof r=="function"||r.constructor!==null&&r.constructor===Function}function xc(r=new Date){const e=r.getFullYear().toString(),t=(r.getMonth()+1).toString().padStart(2,"0"),i=r.getDate().toString().padStart(2,"0"),n=r.getHours().toString().padStart(2,"0"),s=r.getMinutes().toString().padStart(2,"0"),a=r.getSeconds().toString().padStart(2,"0");return`${e}-${t}-${i} ${n}:${s}:${a}`}var gm=Object.defineProperty,ym=(r,e,t)=>e in r?gm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ro=(r,e,t)=>ym(r,typeof e!="symbol"?e+"":e,t);class _m{}class ds extends Yi(xn(_m)){constructor(e){super(),Ro(this,"target"),Ro(this,"dom"),Ro(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 Mc=Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"&&!process.versions.electron&&!process.versions.nw&&!process.versions["node-webkit"];let Mr={};function Sc(){return window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI}if(!Mc){const r=navigator.userAgent.toLowerCase(),e=document.documentElement||{style:{}},t="ActiveXObject"in window,i=r.indexOf("webkit")!==-1,n=r.indexOf("phantom")!==-1,s=r.search("android [23]")!==-1,a=r.indexOf("chrome")!==-1,c=r.indexOf("gecko")!==-1&&!i&&!("opera"in window)&&!t,h=/iphone/i.test(r)&&/micromessenger/i.test(r),d=typeof orientation<"u"||r.indexOf("mobile")!==-1,m=!window.PointerEvent&&"MSPointerEvent"in window,f=window.PointerEvent&&navigator.pointerEnabled||m,g=t&&"transition"in e.style,_="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!s,w="MozPerspective"in e.style,b="OTransition"in e.style,x=(g||_||w)&&!b&&!n,L=typeof window<"u"&&xr(window.createImageBitmap),M=typeof window<"u"&&xr(window.ResizeObserver),C=typeof window<"u"&&xr(window.btoa),W=typeof window<"u"&&xr(window.Proxy),D=typeof window<"u"&&xr(window.requestIdleCallback);let z=0;if(a){const N=r.match(/chrome\/([\d.]+)/);z=N?N[1]:0}const X=!n&&(f||"ontouchstart"in window||"DocumentTouch"in window&&document instanceof window.DocumentTouch),I=typeof window<"u"&&"WebGLRenderingContext"in window,U=Sc();let V=!1;try{new OffscreenCanvas(2,2).getContext("2d"),V=!0}catch{V=!1}let G=!1;try{window.addEventListener("testPassive",()=>{},{get passive(){return G=!0,!0}})}catch{}Mr={IS_NODE:Mc,isTest:!1,ie:t,ielt9:t&&!document.addEventListener,edge:"msLaunchUri"in navigator&&!("documentMode"in document),webkit:i,gecko:c,android:r.indexOf("android")!==-1,android23:s,chrome:a,chromeVersion:z,safari:!a&&r.indexOf("safari")!==-1,phantomjs:n,ie3d:g,webkit3d:_,gecko3d:w,opera12:b,any3d:x,iosWeixin:h,mobile:d,mobileWebkit:d&&i,mobileWebkit3d:d&&_,mobileOpera:d&&"opera"in window,mobileGecko:d&&c,touch:!!X,msPointer:!!m,pointer:!!f,retina:U>1,devicePixelRatio:U,language:navigator.browserLanguage?navigator.browserLanguage:navigator.language,ie9:t&&document.documentMode===9,ie10:t&&document.documentMode===10,webgl:I,imageBitMap:L,resizeObserver:M,btoa:C,decodeImageInWorker:V,monitorDPRChange:!0,supportsPassive:G,proxy:W,requestIdleCallback:D,checkDevicePixelRatio:()=>{if(typeof window<"u"&&Mr.monitorDPRChange){const N=Sc(),j=N!==Mr.devicePixelRatio;return j&&(Mr.devicePixelRatio=N),j}return!1}}}const vm=Mr;var wm=Object.defineProperty,bm=(r,e,t)=>e in r?wm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Bi=(r,e,t)=>bm(r,typeof e!="symbol"?e+"":e,t);function Yi(r){return class extends r{constructor(...e){super(...e),Bi(this,"eventClass",new Bo),Bi(this,"on",this.eventClass.on.bind(this.eventClass)),Bi(this,"trigger",this.eventClass.trigger.bind(this.eventClass)),Bi(this,"off",this.eventClass.off.bind(this.eventClass)),this.eventClass=new Bo}}}function xn(r){return class extends r{constructor(...e){super(...e),Bi(this,"options"),Bi(this,"_isUpdatingOptions"),Bi(this,"_initHooksCalled"),Bi(this,"_initHooks");const t=Object.getPrototypeOf(this).options||{},i=Yo({},t,e[0]||{});this.setOptions(i),this.callInitHooks(),this._isUpdatingOptions=!1}proxyOptions(){return vm.proxy?(this.options=new Proxy(this.options,{set:(e,t,i)=>{if(t=t,e[t]===i||(e[t]=i,this._isUpdatingOptions))return!0;const n={};return n[t]=i,this.config(n),!0}}),this):this}callInitHooks(){const e=Object.getPrototypeOf(this);return this._visitInitHooks(e),this}setOptions(e){if((!this.hasOwnProperty("options")||us(this.options))&&(this.options=this.options?Object.create(this.options):{}),!e)return this;for(const t in e)this.options[t]=e[t];return this}config(e,t){if(this._isUpdatingOptions=!0,e){if(arguments.length===2&&typeof e=="string"){const i={};i[e]=t,e=i}e=e;for(const i in e)this.options[i]=e[i],this[i]&&this[i]instanceof ds&&(e[i]?this[i].enable():this[i].disable());this.onConfig(e),this._isUpdatingOptions=!1}else{const i={};for(const n in this.options)this.options.hasOwnProperty(n)&&(i[n]=this.options[n]);return this._isUpdatingOptions=!1,i}return this}onConfig(e){}_visitInitHooks(e){if(this._initHooksCalled)return;const t=Object.getPrototypeOf(e);t._visitInitHooks&&t._visitInitHooks.call(this,t),this._initHooksCalled=!0;const i=e._initHooks;if(i&&i!==t._initHooks)for(let n=0;n<i.length;n++)i[n].call(this)}static mergeOptions(e){const t=this.prototype,i=Object.getPrototypeOf(t);return t.hasOwnProperty("options")?t.options===i.options&&(t.options=Object.create(t.options)):t.options={},Yo(t.options,e),this}static addInitHook(e,...t){const i=typeof e=="function"?e:function(){this[e].apply(this,t)},n=this.prototype,s=Object.getPrototypeOf(n);return(!n._initHooks||n._initHooks===s._initHooks)&&(n._initHooks=[]),n._initHooks.push(i),this}static include(...e){for(let t=0;t<e.length;t++)Yo(this.prototype,e[t]);return this}}}var xm=Object.defineProperty,Mm=(r,e,t)=>e in r?xm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ve=(r,e,t)=>Mm(r,typeof e!="symbol"?e+"":e,t);const fs=`
621
+ varying vec2 vUv;
622
+ void main() {
623
+ vUv = uv;
624
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
625
+ }
626
+ `,Sm=`
627
+ varying vec2 vUv;
628
+ uniform float iTime;
629
+ uniform float rainSpeed;
630
+ uniform float rainAngle;
631
+ uniform float rainIntensity;
632
+
633
+ float PI = 3.1415926;
634
+
635
+ float random(in vec2 uv) {
636
+ return fract(sin(dot(uv.xy, vec2(12.9898, 78.233))) * 43758.5453123);
637
+ }
638
+
639
+ float noise(in vec2 uv) {
640
+ vec2 i = floor(uv);
641
+ vec2 f = fract(uv);
642
+ f = f * f * (3.0 - 2.0 * f);
643
+ float lb = random(i + vec2(0.0, 0.0));
644
+ float rb = random(i + vec2(1.0, 0.0));
645
+ float lt = random(i + vec2(0.0, 1.0));
646
+ float rt = random(i + vec2(1.0, 1.0));
647
+ return mix(mix(lb, rb, f.x), mix(lt, rt, f.x), f.y);
648
+ }
649
+
650
+ // 原始的 rain 函数,保留其复杂逻辑
651
+ float rainOriginal(vec2 uv, float intensity, float speed) {
652
+ float travelTime = (iTime * 0.2) + 0.1;
653
+ vec2 tiling = vec2(1.0, 0.01);
654
+ float scale = max(intensity, 0.001);
655
+ vec2 offset = vec2(travelTime * 0.5 + uv.x * 0.2, travelTime * 0.2);
656
+ vec2 st = uv * tiling / scale + offset;
657
+ float rain = 0.1;
658
+ float f = fract(noise(st * 200.5) * noise(st * 125.5) * speed);
659
+ f = clamp(pow(abs(f), 15.0) * 1.5 * (rain * rain * 125.0), 0.0, 0.25 * intensity);
660
+ return f;
661
+ }
662
+
663
+ // 深度层函数,调用原始逻辑但参数不同
664
+ float rainLayer(vec2 uv, float depth, float speedMult, float intensityMult) {
665
+ // 调整原始函数的参数以体现深度
666
+ float adjustedIntensity = rainIntensity * intensityMult * max(0.1, 1.0 - depth * 0.6);
667
+ float adjustedSpeed = rainSpeed * speedMult;
668
+ return rainOriginal(uv, adjustedIntensity, adjustedSpeed);
669
+ }
670
+
671
+ mat2 rotate2d(float angle) {
672
+ return mat2(cos(angle), -sin(angle), sin(angle), cos(angle));
673
+ }
674
+
675
+ void main() {
676
+ mat2 rot = rotate2d(rainAngle * PI);
677
+ vec2 rotatedUv = vUv * rot;
678
+
679
+ // 两层深度:前景(快、浓)、远景(慢、淡)
680
+ float rain = 0.0;
681
+ rain += rainLayer(rotatedUv, 0.0, 1.3, 0.7); // 前景:较快、较浓
682
+ rain += rainLayer(rotatedUv, 1.0, 0.7, 0.3); // 远景:较慢、较淡
683
+
684
+ if (rain <= 0.01) {
685
+ discard;
686
+ return;
687
+ }
688
+
689
+ // 雨滴颜色略带灰蓝,更自然
690
+ vec3 col = vec3(0.75, 0.8, 0.85);
691
+ gl_FragColor = vec4(col, rain);
692
+ }
693
+ `,Lm=`
694
+ varying vec2 vUv;
695
+ uniform float iTime;
696
+ uniform float aspectRatio; // 屏幕宽高比,修正非正方形屏幕上的椭圆问题
697
+
698
+ void main() {
699
+ float snow = 0.0;
700
+ for (int k = 0; k < 6; k++) {
701
+ for (int i = 0; i < 12; i++) {
702
+ float cellSize = 2.0 + (float(i) * 3.0);
703
+ float downSpeed = 0.3 + (sin(iTime * 0.4 + float(k + i * 20)) + 1.0) * 0.00008;
704
+ vec2 uv = vUv + vec2(
705
+ 0.01 * sin((iTime + float(k * 6185)) * 0.6 + float(i)) * (5.0 / float(i)),
706
+ downSpeed * (iTime + float(k * 1352)) * (1.0 / float(i))
707
+ );
708
+ vec2 uvStep = (ceil((uv) * cellSize - vec2(0.5, 0.5)) / cellSize);
709
+ float x = fract(sin(dot(uvStep.xy, vec2(12.9898 + float(k) * 12.0, 78.233 + float(k) * 315.156))) * 43758.5453 + float(k) * 12.0) - 0.5;
710
+ float y = fract(sin(dot(uvStep.xy, vec2(62.2364 + float(k) * 23.0, 94.674 + float(k) * 95.0))) * 62159.8432 + float(k) * 12.0) - 0.5;
711
+ float randomMagnitude = sin(iTime * 2.5 + float(k) * 1.618) * 0.5 / cellSize;
712
+ // 极坐标扰动:只对半径扰动,方向角保持不变,保证正圆
713
+ float angle = atan(y, x);
714
+ float r = length(vec2(x, y));
715
+ float offsetMag = r * randomMagnitude;
716
+ vec2 offset = vec2(cos(angle), sin(angle)) * offsetMag;
717
+ // 将 uv.x 按宽高比缩放,使 distance 计算在正方形空间中进行,保证圆点为正圆
718
+ vec2 uvCorrected = vec2(uv.x * aspectRatio, uv.y);
719
+ vec2 centerCorrected = vec2(uvStep.x * aspectRatio, uvStep.y);
720
+ float d = 5.0 * distance(centerCorrected + offset, uvCorrected);
721
+ float omiVal = fract(sin(dot(uvStep.xy, vec2(32.4691, 94.615))) * 31572.1684);
722
+ if (omiVal < 0.08 ? true : false) {
723
+ float newd = (x + 1.0) * 0.4 * clamp(1.9 - d * (15.0 + (x * 6.3)) * (cellSize / 1.4), 0.0, 1.0);
724
+ snow += newd;
725
+ }
726
+ }
727
+ }
728
+ gl_FragColor = vec4(1.0, 1.0, 1.0, snow);
729
+ }
730
+ `,Pm=`
731
+ varying vec2 vUv;
732
+ uniform float iTime;
733
+ uniform float fogSpeed;
734
+ uniform float fogOpacity;
735
+
736
+ float cloudDensity = 1.0;
737
+ float noisiness = 0.35;
738
+ float speed = 0.1;
739
+ float cloudHeight = 0.5;
740
+
741
+ vec3 mod289(vec3 x) {
742
+ return x - floor(x * (1.0 / 289.0)) * 289.0;
743
+ }
744
+
745
+ vec4 mod289(vec4 x) {
746
+ return x - floor(x * (1.0 / 289.0)) * 289.0;
747
+ }
748
+
749
+ vec4 permute(vec4 x) {
750
+ return mod289(((x * 34.0) + 1.0) * x);
751
+ }
752
+
753
+ vec4 taylorInvSqrt(vec4 r) {
754
+ return 1.79284291400159 - 0.85373472095314 * r;
755
+ }
756
+
757
+ float snoise(vec3 v) {
758
+ const vec2 C = vec2(1.0/6.0, 1.0/3.0);
759
+ const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);
760
+ vec3 i = floor(v + dot(v, C.yyy));
761
+ vec3 x0 = v - i + dot(i, C.xxx);
762
+ vec3 g = step(x0.yzx, x0.xyz);
763
+ vec3 l = 1.0 - g;
764
+ vec3 i1 = min(g.xyz, l.zxy);
765
+ vec3 i2 = max(g.xyz, l.zxy);
766
+ vec3 x1 = x0 - i1 + C.xxx;
767
+ vec3 x2 = x0 - i2 + C.yyy;
768
+ vec3 x3 = x0 - D.yyy;
769
+ i = mod289(i);
770
+ vec4 p = permute(permute(permute(
771
+ i.z + vec4(0.0, i1.z, i2.z, 1.0)) +
772
+ i.y + vec4(0.0, i1.y, i2.y, 1.0)) +
773
+ i.x + vec4(0.0, i1.x, i2.x, 1.0));
774
+ float n_ = 0.142857142857;
775
+ vec3 ns = n_ * D.wyz - D.xzx;
776
+ vec4 j = p - 49.0 * floor(p * ns.z * ns.z);
777
+ vec4 x_ = floor(j * ns.z);
778
+ vec4 y_ = floor(j - 7.0 * x_);
779
+ vec4 x = x_ * ns.x + ns.yyyy;
780
+ vec4 y = y_ * ns.x + ns.yyyy;
781
+ vec4 h = 1.0 - abs(x) - abs(y);
782
+ vec4 b0 = vec4(x.xy, y.xy);
783
+ vec4 b1 = vec4(x.zw, y.zw);
784
+ vec4 s0 = floor(b0) * 2.0 + 1.0;
785
+ vec4 s1 = floor(b1) * 2.0 + 1.0;
786
+ vec4 sh = -step(h, vec4(0.0));
787
+ vec4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;
788
+ vec4 a1 = b1.xzyw + s1.xzyw * sh.zzww;
789
+ vec3 p0 = vec3(a0.xy, h.x);
790
+ vec3 p1 = vec3(a0.zw, h.y);
791
+ vec3 p2 = vec3(a1.xy, h.z);
792
+ vec3 p3 = vec3(a1.zw, h.w);
793
+ vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2,p2), dot(p3,p3)));
794
+ p0 *= norm.x; p1 *= norm.y; p2 *= norm.z; p3 *= norm.w;
795
+ vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);
796
+ m = m * m;
797
+ return 42.0 * dot(m*m, vec4(dot(p0,x0), dot(p1,x1), dot(p2,x2), dot(p3,x3)));
798
+ }
799
+
800
+ const float maximum = 1.0/1.0 + 1.0/2.0 + 1.0/3.0 + 1.0/4.0 + 1.0/5.0 + 1.0/6.0 + 1.0/7.0 + 1.0/8.0;
801
+
802
+ float fBm(vec3 uv) {
803
+ float sum = 0.0;
804
+ for (int i = 0; i < 8; ++i) {
805
+ float f = float(i+1);
806
+ sum += snoise(uv * f) / f;
807
+ }
808
+ return sum / maximum;
809
+ }
810
+
811
+ float gradient(vec2 uv) {
812
+ return (1.0 - uv.y * uv.y * cloudHeight);
813
+ }
814
+
815
+ void main() {
816
+ vec2 uv = vUv;
817
+ vec3 p = vec3(uv, iTime * speed);
818
+ vec3 offset = vec3(
819
+ sin(iTime * fogSpeed * 3.0),
820
+ sin(iTime * fogSpeed),
821
+ sin(iTime * fogSpeed * 2.0)
822
+ );
823
+ vec2 duv = vec2(fBm(p), fBm(p + offset)) * noisiness;
824
+ float q = gradient(uv + duv) * cloudDensity;
825
+ if (q <= 0.0) {
826
+ discard;
827
+ return;
828
+ }
829
+ gl_FragColor = vec4(vec3(1.0), q * fogOpacity);
830
+ }
831
+ `,Cm=`
832
+ varying vec2 vUv;
833
+ uniform float flashOpacity;
834
+ void main() {
835
+ gl_FragColor = vec4(1.0, 1.0, 1.0, flashOpacity);
836
+ }
837
+ `;class Lc{constructor(e,t,i){Ve(this,"lines",[]),Ve(this,"flashOpacity",1),Ve(this,"_decay");const n=(this._rand(i,0)-.5)*e*1.5,s=t*.9,a=-t*.9,c=e*.1,h=[];let d=n,m=s;for(;m>a;)m-=t*(.025+this._rand(i,m*.1)*.035),d+=(this._rand(i,m*.2)-.5)*c,this._rand(i,m*.3+99)<.22&&m>a+t*.4&&h.push({x:d,y:m,seed:i+h.length*137.508});const f=this._buildPath(n,s,a,c,i);this._addGlow(f);for(const g of h){const _=g.y-t*(.12+this._rand(g.seed,77)*.2),w=this._buildPath(g.x,g.y,_,c*.4,g.seed);this._addGlow(w)}this._decay=.025+this._rand(i,55)*.02}_buildPath(e,t,i,n,s){const a=t-i,c=32,h=a/c,d=[new p.Vector3(e,t,0)];let m=e;for(let f=1;f<=c;f++){const g=f/c;m+=(this._rand(s,f*.17+5)-.5)*n;const _=1-g*.55;d.push(new p.Vector3(m*_,t-f*h,0))}return d}_rand(e,t){const i=Math.sin(e+t)*43758.5453;return i-Math.floor(i)}_addGlow(e){if(e.length<2)return;const t=[[.25,8961023],[.55,10079487],[1,16777215]];for(const[i,n]of t){const s=new p.BufferGeometry().setFromPoints(e),a=new p.Line(s,new p.LineBasicMaterial({color:n,transparent:!0,opacity:i,depthTest:!1,depthWrite:!1}));this.lines.push(a)}}isDead(){return this.flashOpacity<=0}fade(e){this.flashOpacity=Math.max(0,this.flashOpacity-this._decay*e*60);for(const t of this.lines)t.material.opacity=this.flashOpacity}dispose(){for(const e of this.lines)e.geometry.dispose(),e.material.dispose();this.lines.length=0}}class Tm{constructor(e){Ve(this,"_scene"),Ve(this,"_hw",1),Ve(this,"_hh",1),Ve(this,"_bolts",[]),Ve(this,"_flashMesh",null),Ve(this,"_flashOpacity",0),Ve(this,"_flickerLeft",0),Ve(this,"_flickerTick",0),Ve(this,"_intervalMin",5e3),Ve(this,"_intervalMax",15e3),Ve(this,"_lastTriggerTime",0),Ve(this,"_nextInterval",0),Ve(this,"_enabled",!1),this._scene=e,this._resetNextInterval()}setEnabled(e){this._enabled=e,e||(this._flashOpacity=0,this._flashMesh&&(this._flashMesh.visible=!1))}setTriggerInterval(e,t){this._intervalMin=e,this._intervalMax=t}getTriggerInterval(){return[this._intervalMin,this._intervalMax]}trigger(){const e=new Lc(this._hw,this._hh,Math.random()*9999);for(const t of e.lines)this._scene.add(t);if(this._bolts.push(e),Math.random()<.5){const t=new Lc(this._hw,this._hh,Math.random()*9999);for(const i of t.lines)this._scene.add(i);this._bolts.push(t)}if(!this._flashMesh){const t=new p.PlaneGeometry(this._hw*2,this._hh*2),i=new p.ShaderMaterial({vertexShader:fs,fragmentShader:Cm,transparent:!0,depthTest:!1,depthWrite:!1,uniforms:{flashOpacity:{value:0}}});this._flashMesh=new p.Mesh(t,i),this._flashMesh.renderOrder=999,this._scene.add(this._flashMesh)}this._flashMesh.visible=!0,this._flashOpacity=1,this._flickerLeft=2+Math.floor(Math.random()*4),this._flickerTick=0,this._lastTriggerTime=Date.now(),this._resetNextInterval()}_resetNextInterval(){this._nextInterval=this._intervalMin+Math.random()*(this._intervalMax-this._intervalMin)}update(e,t){const i=t??Date.now();this._enabled&&i-this._lastTriggerTime>this._nextInterval&&this.trigger(),this._flickerTick++,this._flickerTick%3===0&&this._flickerLeft>0&&(this._flickerLeft--,this._flickerLeft%2===0?this._flashOpacity=.9+Math.random()*.1:this._flashOpacity*=.1),this._flashOpacity=Math.max(0,this._flashOpacity-e*3.5),this._flashMesh&&(this._flashMesh.material.uniforms.flashOpacity.value=this._flashOpacity,this._flashMesh.visible=this._flashOpacity>.005);for(let n=this._bolts.length-1;n>=0;n--)if(this._bolts[n].fade(e),this._bolts[n].isDead()){for(const s of this._bolts[n].lines)this._scene.remove(s);this._bolts[n].dispose(),this._bolts.splice(n,1)}}resize(e,t){this._hw=e,this._hh=t,this._flashMesh&&(this._flashMesh.geometry.dispose(),this._flashMesh.geometry=new p.PlaneGeometry(e*2,t*2))}dispose(){for(const e of this._bolts){for(const t of e.lines)this._scene.remove(t);e.dispose()}this._bolts=[],this._flashMesh&&(this._flashMesh.geometry.dispose(),this._flashMesh.material.dispose(),this._scene.remove(this._flashMesh),this._flashMesh=null)}}class Pc{constructor(e,t,i={}){Ve(this,"scene"),Ve(this,"camera"),Ve(this,"mesh"),Ve(this,"rainMaterial"),Ve(this,"snowMaterial"),Ve(this,"fogMaterial"),Ve(this,"lightningSystem"),Ve(this,"_type",null),Ve(this,"_activeMaterial",null),this.scene=new p.Scene,this.scene.autoClear=!1;const n=e/2,s=t/2;this.camera=new p.OrthographicCamera(-n,n,s,-s,.1,10),this.camera.position.z=5;const a=new p.PlaneGeometry(e,t);this.mesh=new p.Mesh(a),this.mesh.position.z=1,this.scene.add(this.mesh),this.rainMaterial=new p.ShaderMaterial({vertexShader:fs,fragmentShader:Sm,transparent:!0,depthTest:!1,depthWrite:!1,uniforms:{iTime:{value:0},rainSpeed:{value:i.speed??3},rainAngle:{value:i.rainAngle??-.1},rainIntensity:{value:i.rainIntensity??1}}}),this.snowMaterial=new p.ShaderMaterial({vertexShader:fs,fragmentShader:Lm,transparent:!0,depthTest:!1,depthWrite:!1,uniforms:{iTime:{value:0},aspectRatio:{value:e/t}}}),this.fogMaterial=new p.ShaderMaterial({vertexShader:fs,fragmentShader:Pm,transparent:!0,depthTest:!1,depthWrite:!1,uniforms:{iTime:{value:0},fogSpeed:{value:i.speed??1},fogOpacity:{value:i.opacity??1}}}),this.lightningSystem=new Tm(this.scene),i.type&&this.setWeather(i.type),i.speed!==void 0&&this.setSpeed(i.speed),i.opacity!==void 0&&this.setOpacity(i.opacity),i.rainIntensity!==void 0&&this.setRainIntensity(i.rainIntensity)}get type(){return this._type}setWeather(e){if(this._type=e,e===null)return this._activeMaterial=null,this.mesh.material=null,this.lightningSystem.setEnabled(!1),this;switch(e){case"rain":this._activeMaterial=this.rainMaterial,this.lightningSystem.setEnabled(!0);break;case"snow":this._activeMaterial=this.snowMaterial,this.lightningSystem.setEnabled(!1);break;case"fog":this._activeMaterial=this.fogMaterial,this.lightningSystem.setEnabled(!1);break}return this.mesh.material=this._activeMaterial,this}setSpeed(e){return this.rainMaterial.uniforms.rainSpeed&&(this.rainMaterial.uniforms.rainSpeed.value=e),this.fogMaterial.uniforms.fogSpeed&&(this.fogMaterial.uniforms.fogSpeed.value=e),this}setOpacity(e){return this.fogMaterial.uniforms.fogOpacity&&(this.fogMaterial.uniforms.fogOpacity.value=e),this}setRainAngle(e){return this.rainMaterial.uniforms.rainAngle&&(this.rainMaterial.uniforms.rainAngle.value=e),this}setRainIntensity(e){return this.rainMaterial.uniforms.rainIntensity&&(this.rainMaterial.uniforms.rainIntensity.value=e),this}triggerLightning(){this.lightningSystem.trigger()}update(e){if(this._activeMaterial){const t=this._activeMaterial.uniforms.iTime.value+e;this._activeMaterial.uniforms.iTime.value=t}this.lightningSystem.update(e,Date.now())}resize(e,t){const i=e/2,n=t/2;this.camera.left=-i,this.camera.right=i,this.camera.top=n,this.camera.bottom=-n,this.camera.updateProjectionMatrix(),this.snowMaterial.uniforms.aspectRatio&&(this.snowMaterial.uniforms.aspectRatio.value=e/t),this.mesh.geometry.dispose(),this.mesh.geometry=new p.PlaneGeometry(e,t),this.lightningSystem.resize(i,n)}dispose(){this.rainMaterial.dispose(),this.snowMaterial.dispose(),this.fogMaterial.dispose(),this.mesh.geometry.dispose(),this.lightningSystem.dispose()}}var Gm=Object.defineProperty,Wm=(r,e,t)=>e in r?Gm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ie=(r,e,t)=>Wm(r,typeof e!="symbol"?e+"":e,t);const Zm=Yi(xn(p.EventDispatcher));class Cc extends Zm{constructor(e,t={}){super(),Ie(this,"scene"),Ie(this,"renderer"),Ie(this,"camera"),Ie(this,"controls"),Ie(this,"ambLight"),Ie(this,"dirLight"),Ie(this,"auxDirLight"),Ie(this,"clouds",null),Ie(this,"container"),Ie(this,"_clock",new p.Clock),Ie(this,"stats"),Ie(this,"_animationCallbacks",new Set),Ie(this,"_fogFactor",1),Ie(this,"_sceneSize",5e4*2),Ie(this,"_weatherEffect",null),Ie(this,"gorund"),Ie(this,"map"),Ie(this,"centerPostion"),Ie(this,"_isInteracting",!1),Ie(this,"debug",!1),Ie(this,"flyTween",null),Ie(this,"composer"),Ie(this,"renderPass"),Ie(this,"bloomPass"),Ie(this,"calculateCameraPosition",(g,_,w,b)=>{const x=new p.Vector3(0,_*Math.cos(w),_*Math.sin(w));return x.applyAxisAngle(new p.Vector3(0,1,0),b),new p.Vector3(g.x+x.x,g.y+x.y,g.z+x.z)}),this.setOptions(t);const{antialias:i=!1,stencil:n=!0,logarithmicDepthBuffer:s=!0,skybox:a,map:c,bloom:h,minDistance:d,maxDistance:m,draggable:f=!0}=t;if(this.map=c,this.centerPostion=this.map.geo2world(new p.Vector3(this.map.center[0],this.map.center[1],0)),this.renderer=this._createRenderer(i,n,s),this.scene=this._createScene(a),this.camera=this._createCamera(),e&&this.addTo(e),this.controls=this._createControls(d,m),this.controls.enabled=f!==!1,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),h&&h.enabled){const g=this.renderer.getPixelRatio(),_=this.container?this.width:window.innerWidth,w=this.container?this.height:window.innerHeight,b=_*g,x=w*g,L=new p.WebGLRenderTarget(b,x,{format:p.RGBAFormat});L.samples=4,this.composer=new qf(this.renderer,L),this.renderPass=new ip(this.scene,this.camera),this.composer.addPass(this.renderPass);const M=h?.strength??1.5,C=h?.radius??1,W=h?.threshold??.7;this.bloomPass=new jf(new p.Vector2(b,x),M,C,W),this.composer.addPass(this.bloomPass)}this.renderer.setAnimationLoop(this.animate.bind(this)),this._initWeather(),this.debug=t.debug||!1,this.flyTween=null,this.debug&&(this.stats=new gr,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 t=typeof e=="string"?document.querySelector(e):e;if(t instanceof HTMLElement)this.container=t,t.appendChild(this.renderer.domElement),new ResizeObserver(this.resize.bind(this)).observe(t);else throw`${e} not found!}`;return this}_createScene(e){const t=new p.Scene,i=e?.defaultColor||"rgb(21,48,94)";if(t.background=new p.Color(i),t.fog=new p.FogExp2(i,2e-4),e?.files){const n=new p.CubeTextureLoader;e.path&&n.setPath(e.path),n.load(e.files,s=>{t.background=s},void 0,s=>{console.error("Error loading skybox:",s),t.background=new p.Color(i)})}else e?.hdr&&this._loadHDRWithPMREM(t,e);return t}async _loadHDRWithPMREM(e,t){try{if(t){const n=await new rm().setPath(t.path||"").setDataType(p.FloatType).loadAsync(t.hdr);n.colorSpace=this.renderer.outputColorSpace,n.mapping=303,n.needsUpdate=!0,e.background=n,e.environment=n}}catch(i){console.error("加载HDR失败:",i),e.background=new p.Color(t?.defaultColor||14414079)}}_createRenderer(e,t,i){const n=new p.WebGLRenderer({antialias:e,logarithmicDepthBuffer:i,stencil:t,alpha:!0,precision:"highp",powerPreference:"high-performance",failIfMajorPerformanceCaveat:!0});return n.debug.checkShaderErrors=!0,n.sortObjects=!0,n.setPixelRatio(window.devicePixelRatio),n.domElement.tabIndex=0,n.shadowMap.enabled=!0,n.shadowMap.needsUpdate=!0,n.shadowMap.type=p.PCFSoftShadowMap,n.toneMapping=p.ACESFilmicToneMapping,n.toneMappingExposure=1,n.outputColorSpace=p.SRGBColorSpace,n.autoClear=!1,n}_createCamera(){return new p.PerspectiveCamera(45,this.getAspect(),.1,this._sceneSize*2)}_createControls(e,t){const i=new Xf(this.camera,this.renderer.domElement),n=Math.PI/2.1;return i.screenSpacePanning=!1,i.minDistance=e??.1,i.maxDistance=t??6e4,i.maxPolarAngle=n,i.enableDamping=!0,i.dampingFactor=.08,i.keyPanSpeed=1,i.listenToKeyEvents(this.renderer.domElement),i.addEventListener("change",()=>{const s=Math.max(i.getPolarAngle(),.1),a=Math.max(i.getDistance(),100);i.zoomSpeed=Math.max(Math.log(a/1e3),1)+3;const c=3e5*2;i.maxDistance>c*.95&&(i.maxDistance=c*.95),this.camera.far=p.MathUtils.clamp(a/s*8,100,c),this.camera.near=p.MathUtils.clamp(this.camera.far/1e3,.001,1),this.camera.updateProjectionMatrix(),this.scene.fog instanceof p.FogExp2&&(this.scene.fog.density=s/(a+5)*this.fogFactor*.1);const d=a>6e4;i.minAzimuthAngle=d?0:-1/0,i.maxAzimuthAngle=d?0:1/0,i.maxPolarAngle=dm(i.getDistance(),0,7e4,n,0),this.map?.trigger("control-change",{type:"control-change",control:i,camera:this.camera,target:this.map})}),i.addEventListener("start",()=>{this._isInteracting=!0,this.map?.trigger("control-start",{type:"control-start",control:i,camera:this.camera,target:this.map})}),i.addEventListener("end",()=>{this._isInteracting=!1,this.map?.trigger("control-end",{type:"control-end",control:i,camera:this.camera,target:this.map})}),i}_createAmbLight(){return new p.AmbientLight(16777215,.1)}_createDirLight(){const f=new p.DirectionalLight("rgb(255, 255, 255)",3);f.position.set(this.centerPostion.x+55e3*1.2,55e3*2,this.centerPostion.z+55e3*1);const g=new p.Object3D;if(g.position.copy(this.centerPostion),this.scene.add(g),f.target=g,f.castShadow=!0,f.shadow.mapSize.width=1024*10,f.shadow.mapSize.height=1024*10,f.shadow.camera.near=1,f.shadow.camera.far=192500,f.shadow.camera.left=-55e3,f.shadow.camera.bottom=-55e3,f.shadow.camera.top=55e3,f.shadow.camera.right=55e3,f.shadow.radius=1,f.shadow.bias=-0,this.debug){const _=new p.CameraHelper(f.shadow.camera);_.name="dirLightCameraHelper",this.scene.add(_)}return f}_createAuxDirLight(){const a=this._createAuxLightInstance(this.centerPostion.x+-66e3,82500,this.centerPostion.z+-55e3,.5);a.name="AuxDirLight_BackFill",this.scene.add(a),this.scene.add(a.target);const m=this._createAuxLightInstance(this.centerPostion.x+55e3*-1,55e3*1.5,this.centerPostion.z+55e3*1.2,.5);m.name="AuxDirLight_LeftRim",this.scene.add(m),this.scene.add(m.target);const w=this._createAuxLightInstance(this.centerPostion.x+55e3*1,55e3*1.5,this.centerPostion.z+55e3*-1.2,.5);return w.name="AuxDirLight_RightRim",this.scene.add(w),this.scene.add(w.target),a}_createAuxLightInstance(e,t,i,n){const s=new p.DirectionalLight(16777215,n);s.position.set(e,t,i);const a=new p.Object3D;return a.position.copy(this.centerPostion),this.scene.add(a),s.target=a,s.castShadow=!1,s}resize(){const e=this.width,t=this.height;if(this.renderer.setSize(e,t),this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this._weatherEffect&&this._weatherEffect.resize(e,t),this.composer){const i=this.renderer.getPixelRatio();this.composer.setSize(e*i,t*i),this.composer.render()}else this.renderer.render(this.scene,this.camera);return this}addAnimationCallback(e){return this._animationCallbacks.add(e),()=>this._animationCallbacks.delete(e)}animate(){const e=this._clock.getDelta(),t=this._clock.getElapsedTime();this._animationCallbacks.forEach(i=>i(e,t,this)),this.controls.update(),this.renderer.clear(),this.composer?this.composer.render():this.renderer.render(this.scene,this.camera),this._weatherEffect?.type&&(this._weatherEffect.update(e),this.renderer.render(this._weatherEffect.scene,this._weatherEffect.camera)),um(),this.stats&&this.stats.update(),this.dispatchEvent({type:"update",delta:e})}flyTo(e,t,i=!0,n){if(this.controls.target.copy(e),i){const s=this.camera.position;new hs(s).to({y:2e7,z:0},500).chain(new hs(s).to(t,2e3).easing(Ki.Quintic.Out).onComplete(a=>n&&n(a))).start()}else this.camera.position.copy(t)}flyToAdvanced(e){const t=this.camera,i=this.controls,n=e.center,s=e.cameraCoord,a=e.duration??2e3,c=e.delay??0,h=e.complete,d=!!e.curvePath;if(!n||!s)return;const m=this.map.geo2world(new p.Vector3(n[0],n[1],0)),f=this.map.geo2world(new p.Vector3(s[0],s[1],s[2]));if(!t||!i||!m||!f)return;const g=i.target.clone(),_=t.position.clone(),w=new p.Vector3(m.x,m.y,m.z),b=new p.Vector3(f.x,f.y,f.z);if(this.flyTween&&(this.flyTween.stop(),this.flyTween=null),d){const x=[_,_.clone().lerp(b,.33),_.clone().lerp(b,.67),b],L=new p.CubicBezierCurve3(...x),M={t:0,x:g.x,y:g.y,z:g.z};this.flyTween=new hs(M).to({t:1,x:w.x,y:w.y,z:w.z},a).easing(Ki.Quadratic.InOut).onUpdate(()=>{const C=L.getPoint(M.t),W=new p.Vector3(M.x,M.y,M.z);t.position.copy(C),t.lookAt(W),t.updateProjectionMatrix(),i.target.copy(W),i.update()})}else{const x={tx:g.x,ty:g.y,tz:g.z,px:_.x,py:_.y,pz:_.z};this.flyTween=new hs(x).to({tx:w.x,ty:w.y,tz:w.z,px:b.x,py:b.y,pz:b.z},a).easing(Ki.Quadratic.InOut).onUpdate(()=>{const L=new p.Vector3(x.tx,x.ty,x.tz),M=new p.Vector3(x.px,x.py,x.pz);t.position.copy(M),t.lookAt(L),i.target.copy(L),i.update()})}this.flyTween&&(this.flyTween.onComplete(()=>{this.flyTween&&(this.flyTween.stop(),this.flyTween=null),h&&h()}),c>0?setTimeout(()=>{this.flyTween&&this.flyTween.start()},c):this.flyTween.start())}onConfig(e){if("draggable"in e){const t=e.draggable;this.controls&&(this.controls.enabled=t!==!1)}}flyToPoint(e){const{controls:t}=this,i=e.center,n=e.duration??2e3,s=typeof e.distance=="number"?e.distance:typeof e.altitude=="number"?e.altitude:t.getDistance(),a=w=>w*Math.PI/180;let c;if(typeof e.polarDeg=="number"){const w=e.polarDeg<=0?.1:e.polarDeg;c=a(w)}else typeof e.polarAngle=="number"?c=e.polarAngle<=0?a(.1):e.polarAngle:c=t.getPolarAngle();const h=typeof e.azimuthDeg=="number"?a(e.azimuthDeg):e.azimuthAngle||t.getAzimuthalAngle(),d=e.complete,m=!!e.curvePath,f=this.map.geo2world(new p.Vector3(i[0],i[1],0)),g=this.calculateCameraPosition(f,s,c,h),_=this.map.world2geo(g);this.flyToAdvanced({center:[i[0],i[1],0],cameraCoord:[_.x,_.y,_.z||0],duration:n,complete:d,curvePath:m})}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,t]=this.getWidthHeight();return e/t}getWidthHeight(){let e=window.innerWidth,t=window.innerHeight;return[e,t]}_createGorund(){const e=this.centerPostion,t=new p.MeshStandardMaterial({transparent:!1,color:new p.Color("rgb(45,52,60)").multiplyScalar(.7),metalness:.2,roughness:1}),i=new p.PlaneGeometry(this._sceneSize*2,this._sceneSize*2),n=new p.Mesh(i,t);return n.name="地面",n.castShadow=!1,n.receiveShadow=!1,n.position.y=0,n.position.add(e),n.rotateX(-Math.PI/2),n.visible=!1,n}_initWeather(){const e=this.width,t=this.height;this._weatherEffect=new Pc(e,t);const i=this.options;if(i.weather){const n=i.weather;n.type&&this._weatherEffect.setWeather(n.type),n.speed!==void 0&&this._weatherEffect.setSpeed(n.speed),n.opacity!==void 0&&this._weatherEffect.setOpacity(n.opacity),n.rainAngle!==void 0&&this._weatherEffect.setRainAngle(n.rainAngle),n.rainIntensity!==void 0&&this._weatherEffect.setRainIntensity(n.rainIntensity)}}setWeather(e,t={}){return this._weatherEffect?(this._weatherEffect.setWeather(e),t.speed!==void 0&&this._weatherEffect.setSpeed(t.speed),t.opacity!==void 0&&this._weatherEffect.setOpacity(t.opacity),t.rainAngle!==void 0&&this._weatherEffect.setRainAngle(t.rainAngle),t.rainIntensity!==void 0&&this._weatherEffect.setRainIntensity(t.rainIntensity),this):this}getWeatherEffect(){return this._weatherEffect}setWeatherSpeed(e){return this._weatherEffect?.setSpeed(e),this}setWeatherOpacity(e){return this._weatherEffect?.setOpacity(e),this}setWeatherRainAngle(e){return this._weatherEffect?.setRainAngle(e),this}setWeatherRainIntensity(e){return this._weatherEffect?.setRainIntensity(e),this}destroy(){try{this.renderer.setAnimationLoop(null),this._animationCallbacks.clear(),this._weatherEffect&&(this._weatherEffect.dispose(),this._weatherEffect=null),this.map=null,this.controls&&this.controls.dispose(),this.scene&&(this.scene.traverse(e=>{e.geometry&&e.geometry.dispose(),e.material&&(Array.isArray(e.material)?e.material.forEach(t=>{this._disposeMaterial(t)}):this._disposeMaterial(e.material))}),this.scene.clear()),this.composer&&(this.bloomPass&&this.bloomPass.dispose?.(),this.renderPass&&this.renderPass.dispose?.(),this.composer=null,this.renderPass=null,this.bloomPass=null),this.renderer&&(this.renderer.dispose(),this.container&&this.renderer.domElement.parentNode===this.container&&this.container.removeChild(this.renderer.domElement)),this.stats&&this.stats.dom.parentNode&&this.stats.dom.parentNode.removeChild(this.stats.dom)}catch(e){console.error("❌ 销毁Viewer时出错:",e)}}_disposeMaterial(e){if(!e)return;["map","lightMap","bumpMap","normalMap","specularMap","envMap","alphaMap","aoMap","displacementMap","emissiveMap","gradientMap","metalnessMap","roughnessMap"].forEach(i=>{e[i]&&e[i].dispose()}),e.dispose()}}var Sr=(r=>(r[r.none=0]="none",r[r.create=1]="create",r[r.remove=2]="remove",r))(Sr||{});function Vm(r,e){const t=r.position.clone().setZ(r.maxZ).applyMatrix4(r.matrixWorld);return e.distanceTo(t)}function Im(r){const e=r.scale,t=new p.Vector3(-e.x,-e.y,0).applyMatrix4(r.matrixWorld),i=new p.Vector3(e.x,e.y,0).applyMatrix4(r.matrixWorld);return t.sub(i).length()}function Am(r){return r.distToCamera/r.sizeInWorld*.8}function Fm(r,e,t,i){const n=Am(r);if(r.isLeaf){if(r.inFrustum&&r.z<t&&(r.z<e||r.showing)&&(r.z<e||n<i))return 1}else if(r.z>=e&&(r.z>t||n>i))return 2;return 0}function Om(r,e,t,i){const n=[],s=i+1,a=e*2,c=0,h=.25;{const d=t*2,m=new p.Vector3(.5,.5,1),f=new Ri(a,d,s),g=new Ri(a+1,d,s),_=new Ri(a,d+1,s),w=new Ri(a+1,d+1,s);f.position.set(-h,h,c),f.scale.copy(m),g.position.set(h,h,c),g.scale.copy(m),_.position.set(-h,-h,c),_.scale.copy(m),w.position.set(h,-h,c),w.scale.copy(m),n.push(f,g,_,w)}return n}var zm=Object.defineProperty,Dm=(r,e,t)=>e in r?zm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,it=(r,e,t)=>Dm(r,typeof e!="symbol"?e+"":e,t);const Xm=10,km=new p.InstancedBufferGeometry,Um=new p.Vector3,Nm=new p.Matrix4,Km=new p.Box3(new p.Vector3(-.5,-.5,0),new p.Vector3(.5,.5,1)),Tc=new p.Frustum,Gc=class is extends p.Mesh{constructor(e=0,t=0,i=0){super(km,[]),it(this,"_dataOnlyMode",!1),it(this,"vectorData",null),it(this,"x"),it(this,"y"),it(this,"z"),it(this,"isTile",!0),it(this,"parent",null),it(this,"children",[]),it(this,"_ready",!1),it(this,"_isDummy",!1),it(this,"_showing",!1),it(this,"_maxZ",0),it(this,"distToCamera",0),it(this,"sizeInWorld",0),it(this,"_loaded",!1),it(this,"_inFrustum",!1),this.x=e,this.y=t,this.z=i,this.name=`Tile ${i}-${e}-${t}`,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 is._downloadThreads}get isDummy(){return this._isDummy}get showing(){return this._showing}set showing(e){const t=this._showing;this._showing=e,this.material.forEach(i=>i.visible=e),t===!1&&this._showing===!0&&this._loaded&&this.dispatchEvent({type:"tile-shown",tile:this}),t===!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(t=>{t.isTile&&t.traverse(e)})}traverseVisible(e){this.visible&&(e(this),this.children.forEach(t=>{t.isTile&&t.traverseVisible(e)}))}raycast(e,t){this.showing&&this.loaded&&this.isTile&&super.raycast(e,t)}LOD(e){if(is.downloadThreads>Xm)return{action:Sr.none};let t=[];const{loader:i,minLevel:n,maxLevel:s,LODThreshold:a}=e,c=Fm(this,n,s,a);return c===Sr.create&&(t=Om(i,this.x,this.y,this.z),this.add(...t)),{action:c,newTiles:t}}_checkVisible(){const e=this.parent;if(e&&e.isTile){const t=e.children.filter(n=>n.isTile),i=t.every(n=>n.loaded);e.showing=!i,t.forEach(n=>n.showing=i)}return this}async _load(e){is._downloadThreads++;const{x:t,y:i,z:n}=this;if(this._dataOnlyMode)try{const s=await e.load({x:t,y:i,z:n,bounds:[-1/0,-1/0,1/0,1/0]});this.vectorData=s.geometry?.userData||{},this._loaded=!0,this.dispatchEvent({type:"vector-data-loaded",data:this.vectorData,tile:this})}catch(s){console.error(`数据模式加载失败 ${n}/${t}/${i}:`,s),this._loaded=!1}else{const s=await e.load({x:t,y:i,z:n,bounds:[-1/0,-1/0,1/0,1/0]});this.material=s.materials,this.geometry=s.geometry,this.maxZ=this.geometry.boundingBox?.max.z||0,this._loaded=!0}return is._downloadThreads--,this}_init(){this.updateMatrix(),this.updateMatrixWorld(),this.sizeInWorld=Im(this)}update(e){if(console.assert(this.z===0),!this.parent)return this;Tc.setFromProjectionMatrix(Nm.multiplyMatrices(e.camera.projectionMatrix,e.camera.matrixWorldInverse));const t=e.camera.getWorldPosition(Um);return this.traverse(i=>{i.receiveShadow=this.receiveShadow,i.castShadow=this.castShadow;const n=Km.clone().applyMatrix4(i.matrixWorld);n.max.setY(9e3),i.inFrustum=Tc.intersectsBox(n),i.distToCamera=Vm(i,t);const{action:s,newTiles:a}=i.LOD(e);this._doAction(i,s,a,e)}),this._checkReady(),this}_doAction(e,t,i,n){return t===Sr.create?i?.forEach(s=>{s._init(),s._isDummy=s.z<n.minLevel,this.dispatchEvent({type:"tile-created",tile:s}),s.isDummy||s._load(n.loader).then(()=>{s._checkVisible(),this.dispatchEvent({type:"tile-loaded",tile:s})})}):t===Sr.remove&&(e.showing=!0,e._unLoad(!1,n.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,t){return e&&this.isTile&&!this.isDummy&&(this.dispatchEvent({type:"unload"}),t?.unload?.(this)),this.children.forEach(i=>i._unLoad(!0,t)),this.clear(),this}};it(Gc,"_downloadThreads",0);let Ri=Gc;var Bm=Object.defineProperty,Ym=(r,e,t)=>e in r?Bm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Rm=(r,e,t)=>Ym(r,e+"",t);class Wc{constructor(e=0){Rm(this,"_lon0",0),this._lon0=e}get lon0(){return this._lon0}getTileXWithCenterLon(e,t){const i=Math.pow(2,t);let n=e+Math.round(i/360*this._lon0);return n>=i?n-=i:n<0&&(n+=i),n}getTileXYZproj(e,t,i){const n=this.mapWidth,s=this.mapHeight/2,a=e/Math.pow(2,i)*n-n/2,c=s-t/Math.pow(2,i)*s*2;return{x:a,y:c}}getProjBoundsFromLonLat(e){const t=e[0]===-180&&e[2]===180,i=this.project(e[0]+(t?this._lon0:0),e[1]),n=this.project(e[2]+(t?this._lon0:0),e[3]);return[Math.min(i.x,n.x),Math.min(i.y,n.y),Math.max(i.x,n.x),Math.max(i.y,n.y)]}getProjBoundsFromXYZ(e,t,i){const n=this.getTileXYZproj(e,t,i),s=this.getTileXYZproj(e+1,t+1,i);return[Math.min(n.x,s.x),Math.min(n.y,s.y),Math.max(n.x,s.x),Math.max(n.y,s.y)]}getLonLatBoundsFromXYZ(e,t,i){const n=this.getProjBoundsFromXYZ(e,t,i),s=this.unProject(n[0],n[1]),a=this.unProject(n[2],n[3]);return[s.lon,s.lat,a.lon,a.lat]}}var jm=Object.defineProperty,Jm=(r,e,t)=>e in r?jm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ps=(r,e,t)=>Jm(r,typeof e!="symbol"?e+"":e,t);const Lr=6378e3;class Zc extends Wc{constructor(){super(...arguments),ps(this,"ID","3857"),ps(this,"mapWidth",2*Math.PI*Lr),ps(this,"mapHeight",this.mapWidth),ps(this,"mapDepth",1)}project(e,t){const i=(e-this.lon0)*(Math.PI/180),n=t*(Math.PI/180),s=Lr*i,a=Lr*Math.log(Math.tan(Math.PI/4+n/2));return{x:s,y:a}}unProject(e,t){let i=e/Lr*(180/Math.PI)+this.lon0;return i>180&&(i-=360),{lat:(2*Math.atan(Math.exp(t/Lr))-Math.PI/2)*(180/Math.PI),lon:i}}}var Qm=Object.defineProperty,Hm=(r,e,t)=>e in r?Qm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ms=(r,e,t)=>Hm(r,typeof e!="symbol"?e+"":e,t);class $m extends Wc{constructor(){super(...arguments),ms(this,"ID","4326"),ms(this,"mapWidth",36e3),ms(this,"mapHeight",18e3),ms(this,"mapDepth",1)}project(e,t){return{x:(e-this.lon0)*100,y:t*100}}unProject(e,t){return{lon:e/100+this.lon0,lat:t/100}}}const Em={createFromID:(r="3857",e)=>{let t;switch(r){case"3857":t=new Zc(e);break;case"4326":t=new $m(e);break;default:throw new Error(`Projection ID: ${r} is not supported.`)}return t}};function jo(r,e){const t=r.getLayers().find(n=>n.isBaseLayer===!0)?._rootTile,i=e.intersectObjects([t]);for(const n of i)if(n.object instanceof Ri){const s=r.worldToLocal(n.point.clone()),a=r.map2geo(s);return Object.assign(n,{location:a})}}function Jo(r,e){const t=new p.Vector3(0,-1,0),i=new p.Vector3(e.x,10*1e3,e.z),n=new p.Raycaster(i,t);return jo(r,n)}function Vc(r,e,t){const i=new p.Raycaster;return i.setFromCamera(t,r),jo(e,i)}function qm(r,e=128){const t=document.createElement("canvas"),i=t.getContext("2d");if(!i)throw new Error("Failed to get canvas context");t.width=e,t.height=e;const n=e/2,s=e/2;return i.imageSmoothingEnabled=!1,i.fillStyle="#000022",i.strokeStyle="DarkGoldenrod",i.lineWidth=5,i.moveTo(n,3),i.lineTo(n,e),i.stroke(),i.closePath(),i.lineWidth=2,i.beginPath(),i.roundRect(2,2,e-4,s-8,10),i.closePath(),i.fill(),i.stroke(),i.font="24px Arial",i.fillStyle="Goldenrod",i.strokeStyle="black",i.textAlign="center",i.textBaseline="top",i.strokeText(r,n,20),i.fillText(r,n,20),t}function eg(r,e=128){const t=new p.CanvasTexture(qm(r,e)),i=new p.SpriteMaterial({map:t,sizeAttenuation:!1}),n=new p.Sprite(i);return n.visible=!1,n.center.set(.5,.3),n.scale.setScalar(.11),n.renderOrder=999,n}var tg=Object.defineProperty,ig=(r,e,t)=>e in r?tg(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,_i=(r,e,t)=>ig(r,typeof e!="symbol"?e+"":e,t);class gs extends p.Mesh{constructor(e){super(),_i(this,"name","map"),_i(this,"_clock",new p.Clock),_i(this,"isLOD",!0),_i(this,"autoUpdate",!0),_i(this,"updateInterval",100),_i(this,"_minLevel",2),_i(this,"_layers",new Map),_i(this,"_maxLevel",24),_i(this,"_projection",new Zc(0)),_i(this,"_LODThreshold",1),this.up.set(0,0,1);const{minLevel:t=2,maxLevel:i=19}=e;this.minLevel=t,this.maxLevel=i}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 gs(e)}update(e){if(!this.autoUpdate)return;const t=this._clock.getElapsedTime();t>this.updateInterval/1e3&&(this._layers.forEach(i=>{i.enabled&&i.visible&&i.update(e)}),this._clock.start(),this.dispatchEvent({type:"update",delta:t}))}dispose(){this.removeFromParent()}geo2pos(e){return this.geo2map(e)}geo2map(e){const t=this.projection.project(e.x,e.y);return new p.Vector3(t.x,t.y,e.z)}geo2world(e){return this.localToWorld(this.geo2map(e))}pos2geo(e){return this.map2geo(e)}map2geo(e){const t=this.projection.unProject(e.x,e.y);return new p.Vector3(t.lon,t.lat,e.z)}world2geo(e){return this.pos2geo(this.worldToLocal(e.clone()))}getLocalInfoFromGeo(e){const t=this.geo2world(e);return Jo(this,t)}getLocalInfoFromWorld(e){return Jo(this,e)}getLocalInfoFromScreen(e,t){return Vc(e,this,t)}get downloading(){return Ri.downloadThreads}addLayer(e){return this._layers.has(e.layerId)&&console.warn(`Layer ${e.layerid} already exists, will be replaced 图层 ${e.layerid} 已存在,将被替换`),this._layers.set(e.layerId,e),this.add(e),this}removeLayer(e){const t=this._layers.get(e);return t?(this._layers.delete(e),this.remove(t),t.dispose(),!0):(console.warn(`⚠️ Layer ${e} does not exist 图层 ${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(),this}getLayers(){return Array.from(this._layers.values())}getApproxZoomLevel(){let e=this.minLevel;const t=this.getLayers().find(n=>n.isBaseLayer===!0);return!t||!t._rootTile||t._rootTile.traverseVisible(n=>{n.showing&&n.inFrustum&&(e=Math.max(e,n.z))}),e}getDataZoom(){let e=this.minLevel;const t=this.getLayers().find(n=>n.isBaseLayer===!0);return!t||!t._rootTile||t._rootTile.traverseVisible(n=>{n.showing&&n.inFrustum&&(e=Math.max(e,n.z))}),e}}var ng=Object.defineProperty,rg=(r,e,t)=>e in r?ng(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,sg=(r,e,t)=>rg(r,e+"",t);function Qo(r){return class extends r{constructor(...t){super(...t),sg(this,"_handlers"),this._handlers=[]}addHandler(t,i){if(!i)return this;if(this._handlers||(this._handlers=[]),this[t])return this[t].enable(),this;const n=this[t]=new i(this);return this._handlers.push(n),this.options[t]&&n.enable(),this}removeHandler(t){if(!t)return this;const i=this[t];if(i&&this._handlers){const n=this._handlers.indexOf(i);n>=0&&this._handlers.splice(n,1),this[t].remove(),delete this[t]}return this}_clearHandlers(){if(this._handlers){for(let t=0,i=this._handlers.length;t<i;t++)this._handlers[t].remove();this._handlers=[]}}}}var og=Object.defineProperty,ag=(r,e,t)=>e in r?og(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Mn=(r,e,t)=>ag(r,typeof e!="symbol"?e+"":e,t);const lg={attribution:"",visible:!0,opacity:1,zIndex:0,isSceneLayer:!1,altitude:0};class Pr extends Qo(Yi(xn(p.Group))){constructor(e,t){super(),Mn(this,"_id"),Mn(this,"opacity",1),Mn(this,"_animationCallbacks",new Set),Mn(this,"isSceneLayer",!1),Mn(this,"_altitude",0),Mn(this,"depthOffset"),Mn(this,"_regionOverlays",[]),Ko(e,"id","Layer ID must be specified 图层ID必须指定"),t&&(this.setOptions(t),this.opacity=t.opacity||1,this.isSceneLayer=t.isSceneLayer??!1,t.altitude!==void 0&&this.setAltitude(t.altitude)),this._id=e,typeof this.animate=="function"&&this._registerAnimate()}getId(){return this._id}addTo(e){return e.addLayer(this),this}getZIndex(){const e=this.options||{};return typeof e.zIndex=="number"?e.zIndex:0}getDepthOffset(){const e=this.options||{};return typeof e.depthOffset=="number"?e.depthOffset:0}getOpacity(){return this.opacity}setOpacity(e){this.opacity=e,this.traverse(t=>{"material"in t&&(Array.isArray(t.material)?t.material:[t.material]).forEach(n=>{"opacity"in n&&(n.transparent=e<1,n.opacity=e,n.needsUpdate=!0)}),t instanceof p.Sprite&&(t.material.opacity=e,t.material.transparent=e<1,t.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 t=e.viewer.addAnimationCallback((i,n,s)=>{this.animate?.(i,n,s)});this._animationCallbacks.add(t)}_clearAnimationCallbacks(){this._animationCallbacks.forEach(e=>e()),this._animationCallbacks.clear()}getOptions(){return{...this.options}}setRegionOverlays(e){return this._regionOverlays=(e||[]).map(t=>({id:t.id??this._generateRegionOverlayId(),color:t.color??"#00FF88",opacity:t.opacity??.3,mode:t.mode??"overlay",zIndex:t.zIndex??0,geometry:t.geometry,feature:t.feature})),this}addRegionOverlay(e){const t=e.id??this._generateRegionOverlayId(),i={id:t,color:e.color??"#00FF88",opacity:e.opacity??.3,mode:e.mode??"overlay",zIndex:e.zIndex??0,geometry:e.geometry,feature:e.feature};return this._regionOverlays.push(i),t}removeRegionOverlay(e){return this._regionOverlays=this._regionOverlays.filter(t=>t.id!==e),this}clearRegionOverlays(){return this._regionOverlays=[],this}getRegionOverlays(){return this._regionOverlays.slice()}_generateRegionOverlayId(){return`region-overlay-${Date.now()}-${Math.random().toString(16).slice(2)}`}}Pr.mergeOptions(lg);var cg=Object.defineProperty,hg=(r,e,t)=>e in r?cg(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Cr=(r,e,t)=>hg(r,typeof e!="symbol"?e+"":e,t);const Ic=class df{constructor(e){Cr(this,"_cache",new Map),Cr(this,"_gltfLoader"),Cr(this,"_fbxLoader"),Cr(this,"_dracoLoader"),this._gltfLoader=new rp(e),this._fbxLoader=new Rp(e)}static init(e){return this._instance||(this._instance=new df(e)),this._instance}async load(e){const t=`${e.type}:${e.url}`;if(this._cache.has(t))return this._cloneCachedModel(t,e);e.type==="gltf"&&e.dracoOptions?.enable&&this._initDracoLoader(e.dracoOptions.decoderPath);let i,n;try{if(e.type==="gltf"){const s=await this._gltfLoader.loadAsync(e.url);i=s.scene,n=s.animations}else i=await this._fbxLoader.loadAsync(e.url),n=i.animations;return this._cache.set(t,{model:i,animations:n}),{model:this._processModel(i.clone(),e),animations:n?.map(s=>({...s,name:s.name||"unnamed"}))||[]}}catch(s){throw console.error(`Failed to load ${e.type} model 加载${e.type}模型失败:`,e.url,s),s}}_initDracoLoader(e="/draco/"){this._dracoLoader||(this._dracoLoader=new sm,this._dracoLoader.setDecoderPath(e),this._gltfLoader.setDRACOLoader(this._dracoLoader))}_cloneCachedModel(e,t){const i=this._cache.get(e),n=i.model.clone();return{model:this._processModel(n,t),animations:i.animations?.map(s=>({...s,name:s.name||"unnamed"}))||[]}}_processModel(e,t){return t.position&&e.position.copy(t.position),t.scale&&(typeof t.scale=="number"?e.scale.setScalar(t.scale):t.scale.x!==void 0||t.scale.y!==void 0||t.scale.z!==void 0?(t.scale.x!==void 0&&(e.scale.x=t.scale.x),t.scale.y!==void 0&&(e.scale.y=t.scale.y),t.scale.z!==void 0&&(e.scale.z=t.scale.z)):e.scale.copy(t.scale)),t.rotation&&e.rotation.set(t.rotation.x,t.rotation.y,t.rotation.z),t.materialOverrides&&e.traverse(i=>{if(i instanceof p.Mesh&&i.material){const n=t.materialOverrides[i.name];n&&(i.material=n)}}),e.traverse(i=>{i instanceof p.Mesh&&i.material}),e}clearCache(){this._cache.clear()}static clearCache(){this._instance&&this._instance.clearCache()}};Cr(Ic,"_instance");let Ac=Ic;const Ho=(r,e)=>{"updateRanges"in r?r.updateRanges[0]=e:r.updateRange=e},Fc=new p.Matrix4,ys=new p.Vector3,_s=new p.Quaternion,Oc=new p.Vector3,zc=new p.Quaternion,Tr=new p.Vector3,ug=r=>class extends r{constructor(){super();const e=parseInt(p.REVISION.replace(/\D+/g,""))>=154?"opaque_fragment":"output_fragment";this.onBeforeCompile=t=>{t.vertexShader=`attribute float cloudOpacity;
511
838
  varying float vOpacity;
512
- `+e.vertexShader.replace("#include <fog_vertex>",`#include <fog_vertex>
839
+ `+t.vertexShader.replace("#include <fog_vertex>",`#include <fog_vertex>
513
840
  vOpacity = cloudOpacity;
514
- `),e.fragmentShader=`varying float vOpacity;
515
- `+e.fragmentShader.replace(`#include <${t}>`,`#include <${t}>
841
+ `),t.fragmentShader=`varying float vOpacity;
842
+ `+t.fragmentShader.replace(`#include <${e}>`,`#include <${e}>
516
843
  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 Kt._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:`
844
+ `)}}};class dg extends p.Group{constructor({limit:e=200,range:t,material:i=p.MeshLambertMaterial,texture:n,frustumCulled:s=!0}={}){super(),this.name="Clouds",this.ref=this;const a=this,c=new p.PlaneGeometry(1,1),h=new Float32Array(Array.from({length:e},()=>1)),d=new Float32Array(Array.from({length:e},()=>[1,1,1]).flat()),m=new p.InstancedBufferAttribute(h,1);m.setUsage(p.DynamicDrawUsage),c.setAttribute("cloudOpacity",m);const f=ug(i),g=new f;g.map=n,g.transparent=!0,g.depthWrite=!1,g.needsUpdate=!0,this.cloudMaterial=g,this.instance=new p.InstancedMesh(c,g,e);const _=this.instance;_.matrixAutoUpdate=!1,_.frustumCulled=s,_.instanceColor=new p.InstancedBufferAttribute(d,3),_.instanceColor.setUsage(p.DynamicDrawUsage),a.add(_);const w=[],b=()=>{const X=w.length;let I=0;for(let U=0;U<this.ref.children.length;U++){const V=this.ref.children[U];V.cloudStateArray&&(I+=V.cloudStateArray.length)}if(X===I)return w;w.length=0;for(let U=0;U<this.ref.children.length;U++){const V=this.ref.children[U];V.cloudStateArray&&w.push(...V.cloudStateArray)}return x(),w},x=()=>{const X=Math.min(e,t!==void 0?t:e,w.length);_.count=X,Ho(_.instanceMatrix,{offset:0,count:X*16}),_.instanceColor&&Ho(_.instanceColor,{offset:0,count:X*3}),Ho(_.geometry.attributes.cloudOpacity,{offset:0,count:X})};let L=0,M=0,C;const W=new p.Quaternion,D=new p.Vector3(0,0,1),z=new p.Vector3;this.update=(X,I,U)=>{L=I,Fc.copy(_.matrixWorld).invert(),X.matrixWorld.decompose(Oc,zc,Tr);const V=b();for(M=0;M<V.length;M++)C=V[M],C.ref.matrixWorld.decompose(ys,_s,Tr),ys.add(z.copy(C.position).applyQuaternion(_s).multiply(Tr)),_s.copy(zc).multiply(W.setFromAxisAngle(D,C.rotation+=U*C.rotationFactor)),Tr.multiplyScalar(C.volume+(1+Math.sin(L*C.density*C.speed))/2*C.growth),C.matrix.compose(ys,_s,Tr).premultiply(Fc),C.dist=ys.distanceTo(Oc);for(V.sort((G,N)=>N.dist-G.dist),M=0;M<V.length;M++)C=V[M],h[M]=C.opacity*(C.dist<C.fade-1?C.dist/C.fade:1),_.setMatrixAt(M,C.matrix),_.setColorAt(M,C.color);_.geometry.attributes.cloudOpacity.needsUpdate=!0,_.instanceMatrix.needsUpdate=!0,_.instanceColor&&(_.instanceColor.needsUpdate=!0)}}}let fg=0;class pg extends p.Group{constructor({opacity:e=1,speed:t=0,bounds:i=new p.Vector3().fromArray([5,1,1]),segments:n=20,color:s=new p.Color("#ffffff"),fade:a=10,volume:c=6,smallestVolume:h=.25,distribute:d=null,growth:m=4,concentrate:f="inside",seed:g=Math.random()}={}){super(),this.name="cloud_"+fg++,this.seed=g,this.segments=n,this.bounds=i,this.concentrate=f,this.volume=c,this.smallestVolume=h,this.distribute=d,this.growth=m,this.speed=t,this.fade=a,this.opacity=e,this.color=s,this.ref=this,this.cloudStateArray=[],this.updateCloud()}updateCloudStateArray(){if(this.cloudStateArray.length===this.segments)return;const{segments:e,uuid:t}=this;if(this.cloudStateArray.length>this.segments)this.cloudStateArray.splice(0,this.cloudStateArray.length-this.segments);else for(let i=this.cloudStateArray.length;i<e;i++)this.cloudStateArray.push({segments:e,bounds:new p.Vector3(1,1,1),position:new p.Vector3,uuid:t,index:i,ref:this,dist:0,matrix:new p.Matrix4,volume:0,length:0,speed:0,growth:0,opacity:1,fade:0,density:0,rotation:i*(Math.PI/e),rotationFactor:0,color:new p.Color})}updateCloud(){const{volume:e,color:t,speed:i,growth:n,opacity:s,fade:a,bounds:c,seed:h,cloudStateArray:d,distribute:m,segments:f,concentrate:g,smallestVolume:_}=this;this.updateCloudStateArray();let w=0;function b(){const x=Math.sin(h+w)*1e4;return w++,x-Math.floor(x)}d.forEach((x,L)=>{x.segments=f,x.volume=e,x.color=t,x.speed=i,x.growth=n,x.opacity=s,x.fade=a,x.bounds.copy(c),x.density=Math.max(.5,b()),x.rotationFactor=Math.max(.2,.5*b())*i;const M=m?.(x,L);if(M||f>1){var C;x.position.copy(x.bounds).multiply((C=M?.point)!==null&&C!==void 0?C:{x:b()*2-1,y:b()*2-1,z:b()*2-1})}const W=Math.abs(x.position.x),D=Math.abs(x.position.y),z=Math.abs(x.position.z),X=Math.max(W,D,z);x.length=1,W===X&&(x.length-=W/x.bounds.x),D===X&&(x.length-=D/x.bounds.y),z===X&&(x.length-=z/x.bounds.z),x.volume=(M?.volume!==void 0?M.volume:Math.max(Math.max(0,_),g==="random"?b():g==="inside"?x.length:1-x.length))*e})}}class $o{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,t){const i=this.workersResolve[e];if(i&&i(t),this.queue.length){const{resolve:n,msg:s,transfer:a}=this.queue.shift();this.workersResolve[e]=n,this.workers[e].postMessage(s,a)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise(i=>{const n=this._getIdleWorker();n!==-1?(this._initWorker(n),this.workerStatus|=1<<n,this.workersResolve[n]=i,this.workers[n].postMessage(e,t)):this.queue.push({resolve:i,msg:e,transfer:t})})}dispose(){this.workers.forEach(e=>e.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}function Sn(r,e){const t=new p.BufferGeometry;t.setAttribute("position",new p.BufferAttribute(new Float32Array([0,0,0]),3));const i=r.sizeAttenuation??!0,n=i?r.size*.002:r.size,s=new p.PointsMaterial({size:n,color:r.color||16777215,sizeAttenuation:i,depthTest:r.depthTest??!0,depthWrite:r.depthWrite??!0});s.onBeforeCompile=c=>{c.fragmentShader=c.fragmentShader.replace("#include <clipping_planes_fragment>",`
845
+ #include <clipping_planes_fragment>
846
+ vec2 coord = gl_PointCoord - vec2(0.5);
847
+ if(length(coord) > 0.5) discard;
848
+ `)};const a=new p.Points(t,s);return a.position.copy(e),a}async function Dc(r,e){let t=null;try{t=await St._loadTexture(r.url),t.magFilter=p.LinearFilter,t.minFilter=p.LinearMipmapLinearFilter,t.colorSpace=p.SRGBColorSpace,t.generateMipmaps=!0,t.premultiplyAlpha=!1,t.needsUpdate=!0}catch(d){console.error("IconPoint texture load failed:",r.url,d)}const i=new p.SpriteMaterial({map:t??null,color:r.color||16777215,transparent:r.transparent??!0,opacity:r.opacity??1,sizeAttenuation:r.sizeAttenuation??!0,depthTest:r.depthTest??!0,depthWrite:r.depthWrite??!0,premultipliedAlpha:!1,blending:p.NormalBlending}),n=new p.Sprite(i),s=.002,a=r.size;let c,h;if(Array.isArray(a))[c,h]=a;else{const d=typeof a=="number"?a:32;if(t&&t.image?.width&&t.image?.height){const m=t.image,f=m.width/m.height||1;h=d,c=d*f}else c=d,h=d}return n.scale.set(c*s,h*s,1),r.rotation&&(n.rotation.z=r.rotation),r.anchor&&n.center.set(r.anchor[0],r.anchor[1]),n.position.copy(e),n}function Eo(r,e){let t;e instanceof Float32Array?t=Array.from(e):Array.isArray(e)&&typeof e[0]=="number"?t=e:t=e.flatMap(a=>[a.x,a.y,a.z]);const i=new Ni;i.setPositions(t);const n=new vn({color:new p.Color(r.color??16777215).getHex(),linewidth:r.width??2,transparent:r.transparent??!0,opacity:r.opacity??1,dashed:!!r.dashArray,dashScale:r.dashArray?.[0]??1,dashSize:r.dashArray?.[0]??1,gapSize:r.dashArray?.[1]??0,resolution:new p.Vector2(window.innerWidth,window.innerHeight),alphaToCoverage:!1,depthTest:r.depthTest??!0,depthWrite:r.depthWrite??!0});window.addEventListener("resize",()=>{n.resolution.set(window.innerWidth,window.innerHeight)});const s=new bn(i,n);return s.computeLineDistances(),s}function Xc(r,e){let t=[];if(Array.isArray(e)&&typeof e[0]=="number")for(let b=0;b<e.length;b+=3)t.push(new p.Vector3(e[b],e[b+1],e[b+2]));else if(e instanceof Float32Array)for(let b=0;b<e.length;b+=3)t.push(new p.Vector3(e[b],e[b+1],e[b+2]));else t=e;if(t.length<2)return new p.Mesh;const i=new p.CurvePath,n=r.cornerRadius||5;if(t.length===2||n<=0)for(let b=0;b<t.length-1;b++){const x=new p.LineCurve3(t[b],t[b+1]);i.curves.push(x)}else{let b=t[0];for(let x=1;x<t.length-1;x++){const L=b,M=t[x],C=t[x+1],W=new p.Vector3().subVectors(M,L),D=new p.Vector3().subVectors(C,M),z=W.length(),X=D.length(),I=Math.min(z,X)*.4,U=Math.min(n,I);W.normalize().multiplyScalar(z-U),D.normalize().multiplyScalar(U);const V=new p.Vector3().addVectors(L,W),G=new p.Vector3().addVectors(M,D);i.curves.push(new p.LineCurve3(L,V)),i.curves.push(new p.QuadraticBezierCurve3(V,M,G)),b=G}i.curves.push(new p.LineCurve3(b,t[t.length-1]))}const s=r.radius||2,a=r.radialSegments||8,c=r.tubularSegments||64,h=new p.TubeGeometry(i,c,s,a,!1),d=5,m=new p.MeshPhongMaterial({color:r.color||"#19bbd5",side:p.DoubleSide,emissive:new p.Color(r.color||"#19bbd5"),emissiveIntensity:.6*d,transparent:!0});m.defines={USE_UV:""};const g={totalLength:{value:i.getLength()},stripeOffset:{value:0},stripeWidth:{value:r.stripeWidth||10},stripeSpacing:{value:r.stripeSpacing||20},stripeColor:{value:new p.Color(r.stripeColor||"#096be3")},speedFactor:{value:r.speed||10},bloomBoost:{value:d}};m.onBeforeCompile=b=>{b.uniforms.totalLength=g.totalLength,b.uniforms.stripeOffset=g.stripeOffset,b.uniforms.stripeWidth=g.stripeWidth,b.uniforms.stripeSpacing=g.stripeSpacing,b.uniforms.stripeColor=g.stripeColor,b.uniforms.bloomBoost=g.bloomBoost,b.fragmentShader=`
849
+ uniform float totalLength;
850
+ uniform float stripeOffset;
851
+ uniform float stripeWidth;
852
+ uniform float stripeSpacing;
853
+ uniform vec3 stripeColor;
854
+ uniform float bloomBoost;
855
+ ${b.fragmentShader}
856
+ `.replace("#include <color_fragment>",`#include <color_fragment>
857
+ // 计算条纹模式(用于漫反射)
858
+ float pattern = mod((vUv.x - stripeOffset) * totalLength / (stripeWidth + stripeSpacing), 1.0);
859
+ float isStripe = step(pattern, stripeWidth / (stripeWidth + stripeSpacing));
860
+
861
+ // 混合条纹颜色
862
+ diffuseColor.rgb = mix(diffuseColor.rgb, stripeColor, isStripe);
863
+
864
+ // 条纹区域再额外提亮,让 bloom 更明显
865
+ if (isStripe > 0.5) {
866
+ diffuseColor.rgb += stripeColor * (3.0 * bloomBoost);
867
+ }
868
+ `).replace("#include <emissivemap_fragment>",`#include <emissivemap_fragment>
869
+ // 计算条纹模式(用于自发光)
870
+ float pattern_e = mod((vUv.x - stripeOffset) * totalLength / (stripeWidth + stripeSpacing), 1.0);
871
+ float isStripe_e = step(pattern_e, stripeWidth / (stripeWidth + stripeSpacing));
872
+
873
+ // 自发光通道也叠加一遍,进一步抬高亮度
874
+ totalEmissiveRadiance += stripeColor * isStripe_e * (3.0 * bloomBoost);
875
+ `)};const _=new p.Mesh(h,m);let w=0;return _.onBeforeRender=()=>{const b=performance.now(),x=w?(b-w)/1e3:.016;w=b;const L=g.speedFactor.value/g.totalLength.value*10;g.stripeOffset.value-=x*L,g.stripeOffset.value=g.stripeOffset.value%1},_}function kc(r,e){let t=[];if(Array.isArray(e)&&typeof e[0]=="number")for(let C=0;C<e.length;C+=3)t.push(new p.Vector3(e[C],e[C+1],e[C+2]));else if(e instanceof Float32Array)for(let C=0;C<e.length;C+=3)t.push(new p.Vector3(e[C],e[C+1],e[C+2]));else t=e;if(t.length<2)return new p.Mesh;const i=new p.CurvePath,n=r.cornerRadius||5;if(t.length===2||n<=0)for(let C=0;C<t.length-1;C++){const W=new p.LineCurve3(t[C],t[C+1]);i.curves.push(W)}else{let C=t[0];for(let W=1;W<t.length-1;W++){const D=C,z=t[W],X=t[W+1],I=new p.Vector3().subVectors(z,D),U=new p.Vector3().subVectors(X,z),V=I.length(),G=U.length(),N=Math.min(V,G)*.4,j=Math.min(n,N);I.normalize().multiplyScalar(V-j),U.normalize().multiplyScalar(j);const Y=new p.Vector3().addVectors(D,I),H=new p.Vector3().addVectors(z,U);i.curves.push(new p.LineCurve3(D,Y)),i.curves.push(new p.QuadraticBezierCurve3(Y,z,H)),C=H}i.curves.push(new p.LineCurve3(C,t[t.length-1]))}const s=r.width||4,c=i.getPoints(128),h=[],d=[],m=[];let f=0;const g=i.getLength();for(let C=0;C<c.length;C++){const W=c[C];let D;C===0?D=new p.Vector3().subVectors(c[1],c[0]):C===c.length-1?D=new p.Vector3().subVectors(c[C],c[C-1]):D=new p.Vector3().subVectors(c[C+1],c[C-1]),D.y=0,D.normalize();const z=new p.Vector3(-D.z,0,D.x),X=s/2,I=new p.Vector3(W.x+z.x*X,W.y,W.z+z.z*X),U=new p.Vector3(W.x-z.x*X,W.y,W.z-z.z*X);h.push(I.x,I.y,I.z),h.push(U.x,U.y,U.z),C>0&&(f+=c[C].distanceTo(c[C-1]));const V=f/g;if(d.push(V,0),d.push(V,1),C<c.length-1){const G=C*2;m.push(G,G+1,G+2),m.push(G+1,G+3,G+2)}}const _=new p.BufferGeometry;_.setAttribute("position",new p.BufferAttribute(new Float32Array(h),3)),_.setAttribute("uv",new p.BufferAttribute(new Float32Array(d),2)),_.setIndex(m),_.computeVertexNormals();const w=5,b=new p.MeshPhongMaterial({color:r.color||"#0ED5FD",side:p.DoubleSide,emissive:new p.Color(r.color||"#0ED5FD"),emissiveIntensity:5,transparent:!0});b.defines={USE_UV:""};const x={totalLength:{value:g},stripeOffset:{value:0},arrowLength:{value:r.arrowLength||20},arrowSpacing:{value:r.arrowSpacing||80},arrowColor:{value:new p.Color(r.color||"#0ED5FD")},speedFactor:{value:r.speed||10},bloomBoost:{value:w}};b.onBeforeCompile=C=>{C.uniforms.totalLength=x.totalLength,C.uniforms.stripeOffset=x.stripeOffset,C.uniforms.arrowLength=x.arrowLength,C.uniforms.arrowSpacing=x.arrowSpacing,C.uniforms.arrowColor=x.arrowColor,C.uniforms.bloomBoost=x.bloomBoost,C.fragmentShader=C.fragmentShader.replace("uniform vec3 diffuse;",`uniform vec3 diffuse;
876
+ uniform float totalLength;
877
+ uniform float stripeOffset;
878
+ uniform float arrowLength;
879
+ uniform float arrowSpacing;
880
+ uniform vec3 arrowColor;
881
+ uniform float bloomBoost;`),C.fragmentShader=C.fragmentShader.replace("#include <color_fragment>",`#include <color_fragment>
882
+ {
883
+ float tpat = arrowLength + arrowSpacing;
884
+ float posi = mod((vUv.x - stripeOffset) * totalLength, tpat);
885
+ float inArrow = step(posi, arrowLength);
886
+ float npos = posi / arrowLength;
887
+
888
+ float centerDist = abs(vUv.y - 0.5);
889
+
890
+ float h0 = step(npos, 0.5);
891
+ float headWidth = mix(0.0, 1.5, npos / 0.5);
892
+ float shaftWidth = 0.6;
893
+ float arrowWidth = mix(shaftWidth, headWidth, h0);
894
+ float arrowShape = step(centerDist, arrowWidth * 0.5);
895
+
896
+ float mask = inArrow * arrowShape;
897
+ mask = clamp(mask, 0.0, 1.0);
898
+
899
+ diffuseColor.rgb = arrowColor;
900
+ diffuseColor.a = mask;
901
+ }`),C.fragmentShader=C.fragmentShader.replace("#include <emissivemap_fragment>",`#include <emissivemap_fragment>
902
+ {
903
+ float tpat2 = arrowLength + arrowSpacing;
904
+ float posi2 = mod((vUv.x - stripeOffset) * totalLength, tpat2);
905
+ float inArrow2 = step(posi2, arrowLength);
906
+ float npos2 = posi2 / arrowLength;
907
+
908
+ float centerDist2 = abs(vUv.y - 0.5);
909
+
910
+ float h02 = step(npos2, 0.5);
911
+ float headWidth2 = mix(0.0, 1.5, npos2 / 0.5);
912
+ float shaftWidth2 = 0.6;
913
+ float arrowWidth2 = mix(shaftWidth2, headWidth2, h02);
914
+ float arrowShape2 = step(centerDist2, arrowWidth2 * 0.5);
915
+
916
+ float mask2 = inArrow2 * arrowShape2;
917
+ mask2 = clamp(mask2, 0.0, 1.0);
918
+
919
+ totalEmissiveRadiance += arrowColor * mask2 * 0.5;
920
+ }`)};const L=new p.Mesh(_,b);let M=0;return L.onBeforeRender=()=>{const C=performance.now(),W=M?(C-M)/1e3:.016;M=C;const D=x.speedFactor.value/x.totalLength.value*10;x.stripeOffset.value-=W*D,x.stripeOffset.value=x.stripeOffset.value%1},L}async function Uc(r,e){let t=[];if(Array.isArray(e)&&typeof e[0]=="number"){const G=e;for(let N=0;N<G.length;N+=3)t.push(new p.Vector3(G[N],G[N+1],G[N+2]))}else if(e instanceof Float32Array)for(let G=0;G<e.length;G+=3)t.push(new p.Vector3(e[G],e[G+1],e[G+2]));else t=e;if(t.length<2)return new p.Mesh;const i=(r.width??10)*.5,n=[],s=[],a=[];let c=0;const h=[0];for(let G=1;G<t.length;G++){const N=t[G].distanceTo(t[G-1]);c+=N,h.push(c)}if(c===0)return new p.Mesh;const d=r.repeat??1,m=[],f=[];for(let G=0;G<t.length;G++){let N=new p.Vector3;G===0?N.subVectors(t[G+1],t[G]):G===t.length-1?N.subVectors(t[G],t[G-1]):N.subVectors(t[G+1],t[G-1]),N.normalize();const j=new p.Vector3(0,1,0);let Y=new p.Vector3().crossVectors(N,j);Y.lengthSq()<1e-10?Y.set(1,0,0):Y.normalize(),m.push(t[G].clone().add(Y.clone().multiplyScalar(-i))),f.push(t[G].clone().add(Y.clone().multiplyScalar(i)))}let g=0,_=0;for(let G=1;G<m.length;G++)g+=m[G].distanceTo(m[G-1]),_+=f[G].distanceTo(f[G-1]);if((g+_)/2===0)return new p.Mesh;for(let G=0;G<t.length;G++){n.push(m[G].x,m[G].y,m[G].z,f[G].x,f[G].y,f[G].z);const N=h[G]/c*d;s.push(N,0,N,1)}const b=t.length-1;for(let G=0;G<b;G++){const N=G*2,j=G*2+1,Y=(G+1)*2,H=(G+1)*2+1;a.push(N,Y,j),a.push(Y,H,j)}const x=new p.BufferGeometry;x.setAttribute("position",new p.BufferAttribute(new Float32Array(n),3)),x.setAttribute("uv",new p.BufferAttribute(new Float32Array(s),2)),x.setIndex(a),x.computeBoundingBox(),x.computeVertexNormals();const L=await St._loadTexture(r.flowTexture);L.wrapS=p.RepeatWrapping,L.wrapT=p.RepeatWrapping,L.anisotropy=4,L.needsUpdate=!0;const M=new p.Color(r.color??16777215),W={uMap:{value:L},uColor:{value:M},uOpacity:{value:r.opacity??1},uOffset:{value:0},uBloomBoost:{value:5}},D=r.depthOffset??1,z=D!==0,X=new p.ShaderMaterial({uniforms:W,vertexShader:`
921
+ varying vec2 vUv;
922
+ void main() {
923
+ vUv = uv;
924
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
925
+ }
926
+ `,fragmentShader:`
927
+ uniform sampler2D uMap;
928
+ uniform vec3 uColor;
929
+ uniform float uOpacity;
930
+ uniform float uOffset;
931
+ uniform float uBloomBoost;
932
+ varying vec2 vUv;
933
+
934
+ void main() {
935
+ // 关键修复:修正UV滚动计算,确保方向正确[3](@ref)
936
+ vec2 uv = vec2(fract(vUv.x + uOffset), vUv.y);
937
+ vec4 texColor = texture2D(uMap, uv);
938
+
939
+ // 添加alpha测试,完全透明的片元直接丢弃
940
+ if (texColor.a < 0.01) discard;
941
+
942
+ float alpha = texColor.a * uOpacity;
943
+ vec3 baseColor = texColor.rgb * uColor;
944
+ // 使用更自然的颜色增强公式
945
+ vec3 finalColor = baseColor * uBloomBoost;
946
+
947
+ gl_FragColor = vec4(finalColor, alpha);
948
+ }
949
+ `,transparent:r.transparent??!0,depthTest:r.depthTest??!0,depthWrite:r.depthWrite??!1,blending:p.AdditiveBlending,side:p.DoubleSide,polygonOffset:z,polygonOffsetFactor:-D,polygonOffsetUnits:-D}),I=new p.Mesh(x,X);let U=0;I.onBeforeRender=()=>{const G=performance.now(),N=U?(G-U)/1e3:.016;U=G;const j=r.speed??10;W.uOffset.value=V(W.uOffset.value-N*j/c)};function V(G){return G-Math.floor(G)}return I}async function mg(r,e){const t=r.type||(r.url.toLowerCase().endsWith(".fbx")?"fbx":"gltf");return await Ac.init().load({...r,type:t,position:e})}function gg(r,e){const{geometry:t,center:i,avgY:n}=qo(e),s=r.depthOffset??0,a=s!==0,c=new p.MeshBasicMaterial({color:new p.Color(r.color??16777215),transparent:r.transparent??!0,opacity:r.opacity??1,wireframe:r.wireframe??!1,side:r.side==="back"?p.BackSide:r.side==="double"?p.DoubleSide:p.FrontSide,polygonOffset:a,polygonOffsetFactor:a?s:0,polygonOffsetUnits:a?s:0,depthTest:r.depthTest??!0,depthWrite:r.depthWrite??!0}),h=new p.Mesh(t,c);if(h.rotation.x=-Math.PI/2,h.position.set(i.x,n,i.z),(r.borderWidth??0)>0){const f={color:r.borderColor??r.color??0,width:r.borderWidth},g=[];for(let w=0;w<e.length;w+=3){const b=e[w],x=e[w+2];g.push(b-i.x,-(x-i.z),0)}const _=Eo(f,g);h.add(_)}return h}function yg(r,e){const t=r.extrude?.height||2e3,i=[],n=[],s=[];for(let f=0;f<e.length;f+=3){const g=e[f],_=e[f+1],w=e[f+2];n.push(new p.Vector3(g,_,w)),s.push(new p.Vector3(g,_+t,w))}i.push(...n,...s);const a=new p.BufferGeometry;a.setFromPoints(i);const c=[],h=n.length;for(let f=0;f<h;f++){const g=(f+1)%h;c.push(f,f+h,g),c.push(g,f+h,g+h)}for(let f=2;f<h;f++)c.push(0,f-1,f),c.push(h,h+f-1,h+f);a.setIndex(c),a.computeVertexNormals();const d=new p.ShaderMaterial({uniforms:{uColor:{value:new p.Color(r.color??16777215)},uOpacity:{value:r.opacity??1},uBrightness:{value:1.2}},vertexShader:`
518
950
  varying vec3 vWorldPosition;
519
951
  varying vec3 vNormal;
520
952
  void main() {
@@ -536,33 +968,30 @@
536
968
  gl_FragColor = vec4(finalColor, uOpacity);
537
969
  if (uOpacity >= 0.99) gl_FragDepthEXT = gl_FragCoord.z;
538
970
  }
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:{}};/**
540
- * @license
541
- * Lodash <https://lodash.com/>
542
- * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
543
- * Released under MIT license <https://lodash.com/license>
544
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
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]=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"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"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={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},q0={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},$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,`{
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)&&gt(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+"]")+`
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
- __e(`+_e+`) +
551
- '`),dt&&(A=!0,j+=`';
552
- `+dt+`;
553
- __p += '`),Le&&(j+=`' +
554
- ((__t = (`+Le+`)) == null ? '' : __t) +
555
- '`),U=Tt+ce.length,ce}),j+=`';
556
- `;var le=Ze.call(o,"variable")&&o.variable;if(!le)j=`with (obj) {
557
- `+j+`
971
+ `,transparent:r.transparent??!0,side:p.DoubleSide,depthTest:r.depthTest??!0,depthWrite:r.depthWrite??!0});return new p.Mesh(a,d)}function _g(r,e,t){const{geometry:i,center:n,avgY:s}=qo(t),a=new Wf(i,{textureWidth:512,textureHeight:512,waterNormals:new p.TextureLoader().load(r.normalMap,function(d){d.wrapS=d.wrapT=p.RepeatWrapping}),waterColor:r.color||"#19AAEE",sunColor:r.sunColor||"#05FFF8",distortionScale:1,alpha:r.opacity||.8}),c=a.onBeforeRender,h=a.onAfterRender;return a.onBeforeRender=(d,m,f,g,_,w)=>{e.tilemap.autoUpdate=!1,c.call(a,d,m,f,g,_,w)},a.onAfterRender=(d,m,f,g,_,w)=>{e.tilemap.autoUpdate=!0,h.call(a,d,m,f,g,_,w)},a.material.uniforms.size.value=.1,a.rotation.x=-Math.PI/2,a.position.set(n.x,s,n.z),e.viewer.addEventListener("update",()=>{a.material.uniforms.time.value+=1/60}),a}function qo(r){let e=0;for(let a=1;a<r.length;a+=3)e+=r[a];e/=r.length/3;const t={x:0,z:0},i=[];for(let a=0;a<r.length;a+=3)t.x+=r[a],t.z+=r[a+2];t.x/=r.length/3,t.z/=r.length/3;for(let a=0;a<r.length;a+=3)i.push(new p.Vector2(r[a]-t.x,-(r[a+2]-t.z)));const n=new p.Shape(i);return{geometry:new p.ShapeGeometry(n),center:t,avgY:e}}async function vg(r,e){const{geometry:t,center:i,avgY:n}=qo(e),s=await St._loadTexture(r.normalMap),a=await St._loadTexture(r.normalMap);s.wrapS=s.wrapT=p.RepeatWrapping,a.wrapS=a.wrapT=p.RepeatWrapping,s.repeat.set(.015,.015),a.repeat.set(.005,.005);const c=new p.MeshStandardMaterial({color:new p.Color(r.color).multiplyScalar(3.5),roughness:.1,metalness:.8,transparent:r.transparent??!0,opacity:.9,fog:!1,normalMap:s,normalScale:new p.Vector2(1.5,1.5),envMapIntensity:2,depthTest:r.depthTest??!0,depthWrite:r.depthWrite??!0}),h=new p.Mesh(t,c);h.rotation.x=-Math.PI/2,h.position.set(i.x,n+.15,i.z),h.castShadow=!1,h.receiveShadow=!0;let d=0;return h.onBeforeRender=()=>{const m=performance.now(),f=d?(m-d)/1e3:.016;s.offset.x+=f*.08,s.offset.y+=f*.03,a.offset.x-=f*.12,a.offset.y+=f*.02,h.position.y=n+.5+Math.sin(m*.02)*.02,d=m},h}function wg(r,e){r.color=new p.Color(r.hexcolor),r.boundstext&&(r.bounds=new p.Vector3(r.boundstext.x,r.boundstext.y,r.boundstext.z));const t=new pg(r);return t.castShadow=!0,t.scale.setScalar(50),t.position.copy(e),t}async function bg(r,e){const i={...{fontSizeDpi: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,fixedSize:50},...r};i.screenSpaceSize==null&&i.fixedSize!=null&&(i.screenSpaceSize=i.fixedSize);const s=(typeof window<"u"&&window.devicePixelRatio||1)*4,a=r.screenSpaceSize!=null||r.fixedSize!=null;if(r.fontSizeDpi==null&&a){const z=r.screenSpaceSize??r.fixedSize??i.screenSpaceSize;i.fontSizeDpi=z*s}i.fontSizeDpi=Math.min(Math.max(i.fontSizeDpi,8),128);const c=document.createElement("canvas"),h=c.getContext("2d");if(!h)throw new Error("canvas context is null");const d=`${i.fontStyle} ${i.fontWeight} ${i.fontSizeDpi}px ${i.fontFamily}`;h.font=d;const m=i.showBackground?20:0,f=100,g=50,_=h.measureText(i.text),w=Math.max(f,_.width+m*2),b=Math.max(g,i.fontSizeDpi*1.5+m*2);c.width=Math.min(w,2048),c.height=Math.min(b,2048),h.clearRect(0,0,c.width,c.height),h.font=d,i.showBackground&&(i.bgStyle===1?(h.fillStyle=i.bgColor,h.globalAlpha=i.bgOpacity,h.beginPath(),Nc(h,m/2,m/2,c.width-m,c.height-m,i.roundRectRadius),h.fill(),h.globalAlpha=1,h.shadowColor=i.shadowColor,h.shadowBlur=i.shadowBlur,h.shadowOffsetX=i.shadowOffsetX,h.shadowOffsetY=i.shadowOffsetY):(h.fillStyle=i.bgColor,h.globalAlpha=i.bgOpacity,h.beginPath(),Kc(h,c.width/2,c.height/2,c.width*.8,c.height*.8,i.roundRectRadius,i.bubblePointerHeight,i.bubblePointerWidth),h.fill(),h.globalAlpha=1,h.strokeStyle=i.bubbleBorderColor,h.lineWidth=i.bubbleBorderWidth,h.stroke())),h.textAlign="center",h.textBaseline="middle",i.strokeWidth>0&&(h.strokeStyle=i.strokeColor,h.lineWidth=i.strokeWidth,h.lineJoin="round",h.strokeText(i.text,c.width/2,c.height/2)),h.fillStyle=i.textColor,h.fillText(i.text,c.width/2,c.height/2),h.shadowColor="transparent";const x=new p.CanvasTexture(c);x.magFilter=p.NearestFilter,x.minFilter=p.LinearMipmapLinearFilter,x.anisotropy=16;const L=new p.SpriteMaterial({map:x,transparent:r.transparent??!0,depthTest:r.depthTest??!0,depthWrite:r.depthWrite??!0,fog:!1}),M=new p.Sprite(L),C=i.screenSpaceSize??i.fixedSize;M.scale.set(c.width*C/100,c.height*C/100,1);const W=r.anchor||[.5,.5],D=r.textOffset||{x:0,y:0};return M.center.set(W[0]-D.x/c.width,W[1]+D.y/c.height),e&&M.position.copy(e),M}async function xg(r,e,t){const n={...{fontSizeDpi: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},...r};n.screenSpaceSize==null&&r.fixedSize!=null&&(n.screenSpaceSize=r.fixedSize);const a=(typeof window<"u"&&window.devicePixelRatio||1)*4;r.fontSizeDpi==null&&(n.fontSizeDpi=n.screenSpaceSize*a),n.fontSizeDpi=Math.max(n.fontSizeDpi,8);const c=document.createElement("canvas"),h=c.getContext("2d");if(!h)throw new Error("Failed to get canvas context");const d=`${n.fontStyle} ${n.fontWeight} ${n.fontSizeDpi}px ${n.fontFamily}`;h.font=d;const m=n.showBackground?20:0,f=100,g=50,_=h.measureText(n.text),w=Math.max(f,_.width+m*2),b=Math.max(g,n.fontSizeDpi*1.5+m*2);c.width=Math.min(w,2048),c.height=Math.min(b,2048),h.clearRect(0,0,c.width,c.height),h.font=d,n.showBackground&&(n.bgStyle===1?(h.fillStyle=n.bgColor,h.globalAlpha=n.bgOpacity,h.beginPath(),Nc(h,m/2,m/2,c.width-m,c.height-m,n.roundRectRadius),h.fill(),h.globalAlpha=1,h.shadowColor=n.shadowColor,h.shadowBlur=n.shadowBlur,h.shadowOffsetX=n.shadowOffsetX,h.shadowOffsetY=n.shadowOffsetY):(h.fillStyle=n.bgColor,h.globalAlpha=n.bgOpacity,h.beginPath(),Kc(h,c.width/2,c.height/2,c.width*.8,c.height*.8,n.roundRectRadius,n.bubblePointerHeight,n.bubblePointerWidth),h.fill(),h.globalAlpha=1,h.strokeStyle=n.bubbleBorderColor,h.lineWidth=n.bubbleBorderWidth,h.stroke())),h.textAlign="center",h.textBaseline="middle",n.strokeWidth>0&&(h.strokeStyle=n.strokeColor,h.lineWidth=n.strokeWidth,h.lineJoin="round",h.strokeText(n.text,c.width/2,c.height/2)),h.fillStyle=n.textColor,h.fillText(n.text,c.width/2,c.height/2),h.shadowColor="transparent";const x=new p.CanvasTexture(c),L=new p.SpriteMaterial({map:x,transparent:r.transparent??!0,depthTest:r.depthTest??!0,depthWrite:r.depthWrite??!0,fog:!1}),M=new p.Sprite(L),C=r.anchor||[.5,.5],W=r.textOffset||{x:0,y:0},D=n.screenSpaceSize,z=D*(c.width/c.height);M.center.set(C[0]-W.x/z,C[1]+W.y/D),M.position.copy(e),M.userData.isLabel=!0;const X=()=>{if(!M.visible)return;const U=t.viewer.camera.position.distanceTo(M.position);if(U>n.maxVisibleDistance){M.visible=!1;return}M.visible=!0;const V=new p.Vector2;t.viewer.renderer.getSize(V);const G=V.height,N=p.MathUtils.degToRad(t.viewer.camera.fov),j=typeof window<"u"&&window.devicePixelRatio||1,H=n.screenSpaceSize*j/c.height*(2*U*Math.tan(N/2)/G);M.scale.set(H*c.width,H*c.height,1),M.lookAt(t.viewer.camera.position)};X();const I=()=>X();return M.addEventListener("dispose",()=>{t.viewer.renderer.domElement.removeEventListener("resize",X)}),t.viewer.renderer.domElement.addEventListener("resize",X),t.viewer.camera.addEventListener("change",X),M.onBeforeRender=I,M}async function Mg(r,e){const t=r.size??r.iconSize,i={text:r.text||"",iconSize:t,fontSize:r.fontSize??12,fontFamily:r.fontFamily||"微软雅黑",fontWeight:r.fontWeight??400,padding:{top:3,right:6,bottom:3,left:6,...r.padding},bgColor:r.bgColor||"#ffffff",bgOpacity:r.bgOpacity??1,textColor:r.textColor||"#000000",strokeColor:r.strokeColor||"#000000",strokeWidth:r.strokeWidth??0,iconScale:r.iconScale??1,renderbg:r.renderbg??!0,textOffset:r.textOffset??{x:-40,y:-19},depthTest:r.depthTest??!1,depthWrite:r.depthWrite??!1,transparent:r.transparent??!0,canvasScale:4};let n=null;if(r.url)try{n=await Wg(r.url)}catch{console.error("Label icon load failed:",r.url)}const{canvas:s,width:a,height:c,center:h}=await Sg(i,n),d=new p.Texture(s);d.generateMipmaps=!0,d.minFilter=p.LinearMipmapLinearFilter,d.magFilter=p.LinearFilter,d.colorSpace=p.SRGBColorSpace,d.premultiplyAlpha=!1,d.needsUpdate=!0;const m=new p.SpriteMaterial({map:d,transparent:i.transparent??!0,depthTest:i.depthTest??!0,depthWrite:i.depthWrite??!0,blending:p.NormalBlending,sizeAttenuation:!1,premultipliedAlpha:!1,alphaTest:.05}),f=new p.Sprite(m),g=.002;return f.scale.set(a*g,c*g,1),r.anchor?f.center.set(r.anchor[0],r.anchor[1]):f.center.set(h[0],h[1]),e&&f.position.copy(e),f}async function Sg(r,e){return new Promise(t=>{const{text:i,fontSize:n,fontFamily:s,padding:a,bgColor:c,textColor:h,strokeColor:d,strokeWidth:m,iconScale:f,canvasScale:g,renderbg:_,textOffset:w,iconSize:b,fontWeight:x,bgOpacity:L}=r,M=e!==null;let C=0,W=0;if(M&&e){const Ce=e.naturalWidth||e.width||1,lt=e.naturalHeight||e.height||1,mt=Ce/lt||1;Array.isArray(b)?(C=b[0],W=b[1]):typeof b=="number"?(W=b,C=b*mt):(C=Ce,W=lt)}else Array.isArray(b)?(C=b[0],W=b[1]):typeof b=="number"&&(C=b,W=b);const z=document.createElement("canvas").getContext("2d"),X=`${x} ${n}px ${s}`;z.font=X;const I=Pg(z,i,n),{width:U,ascent:V,descent:G}=I,N=M?C/2:0,j=M?W/2:0,Y=N+w.x,H=j+w.y,Q=Y-a.left,re=Y+U+a.right,ne=H-V-a.top,le=H+G+a.bottom;let de,ge,fe,Se;M?(de=Math.min(0,Q),ge=Math.min(0,ne),fe=Math.max(C,re),Se=Math.max(W,le)):(de=Q,ge=ne,fe=re,Se=le);const st=Math.ceil(fe-de),ot=Math.ceil(Se-ge),{canvas:pt,ctx:$e}=Lg(st,ot,g),Re=-de,je=-ge;if(M&&e&&C>0&&W>0){const Ce=C*f,lt=W*f,mt=(C-Ce)/2,Ct=(W-lt)/2,Cn=Re+mt,$n=je+Ct;$e.drawImage(e,Cn,$n,Ce,lt)}const at=Re+Y,Xe=je+H;_&&c&&c!=="transparent"&&Tg($e,at,Xe,U,V,G,a,c,L),$e.font=X,Gg($e,i,at,Xe,h,m,d);let Ft,Rt;M&&C>0&&W>0?(Ft=(Re+N)/st,Rt=(je+j)/ot):(Ft=.5,Rt=.5),t({canvas:pt,width:st,height:ot,center:[Ft,1-Rt]})})}function Nc(r,e,t,i,n,s){r.beginPath(),r.moveTo(e+s,t),r.lineTo(e+i-s,t),r.quadraticCurveTo(e+i,t,e+i,t+s),r.lineTo(e+i,t+n-s),r.quadraticCurveTo(e+i,t+n,e+i-s,t+n),r.lineTo(e+s,t+n),r.quadraticCurveTo(e,t+n,e,t+n-s),r.lineTo(e,t+s),r.quadraticCurveTo(e,t,e+s,t),r.closePath()}function Kc(r,e,t,i,n,s,a,c){if(i<=0)throw new Error("Width must be positive");if(n<=0)throw new Error("Height must be positive");if(s<0)throw new Error("Radius cannot be negative");const h=i,d=n,m=Math.min(s,i/2,n/2),f=a??10,g=c??15;r.beginPath(),r.moveTo(e-h/2+m,t-d/2),r.lineTo(e+h/2-m,t-d/2),r.quadraticCurveTo(e+h/2,t-d/2,e+h/2,t-d/2+m),r.lineTo(e+h/2,t+d/2-m),r.quadraticCurveTo(e+h/2,t+d/2,e+h/2-m,t+d/2),r.lineTo(e+g/2,t+d/2),r.lineTo(e,t+d/2+f),r.lineTo(e-g/2,t+d/2),r.lineTo(e-h/2+m,t+d/2),r.quadraticCurveTo(e-h/2,t+d/2,e-h/2,t+d/2-m),r.lineTo(e-h/2,t-d/2+m),r.quadraticCurveTo(e-h/2,t-d/2,e-h/2+m,t-d/2),r.closePath()}function Lg(r,e,t){const i=document.createElement("canvas");i.width=Math.ceil(r*t),i.height=Math.ceil(e*t);const n=i.getContext("2d",{alpha:!0});return n.scale(t,t),n.imageSmoothingEnabled=!1,{canvas:i,ctx:n}}function Pg(r,e,t){const i=r.measureText(e);return{width:i.width,ascent:i.actualBoundingBoxAscent||t*.8,descent:i.actualBoundingBoxDescent||t*.2,totalHeight:(i.actualBoundingBoxAscent||t*.8)+(i.actualBoundingBoxDescent||t*.2)}}function Cg(r,e,t,i,n,s){r.beginPath(),r.moveTo(e+s,t),r.lineTo(e+i-s,t),r.arcTo(e+i,t,e+i,t+s,s),r.lineTo(e+i,t+n-s),r.arcTo(e+i,t+n,e+i-s,t+n,s),r.lineTo(e+s,t+n),r.arcTo(e,t+n,e,t+n-s,s),r.lineTo(e,t+s),r.arcTo(e,t,e+s,t,s),r.closePath()}function Tg(r,e,t,i,n,s,a,c,h=1){const d=e-a.left,m=t-n-a.top,f=i+a.left+a.right,g=n+s+a.top+a.bottom;r.save(),r.globalAlpha=h,r.fillStyle=c,Cg(r,d,m,f,g,2),r.fill(),r.restore()}function Gg(r,e,t,i,n,s,a){r.save(),r.textBaseline="alphabetic",r.textAlign="left",s>0&&(r.strokeStyle=a,r.lineWidth=s,r.lineJoin="round",r.strokeText(e,t,i)),r.fillStyle=n,r.fillText(e,t,i),r.restore()}function Wg(r){return new Promise((e,t)=>{const i=new Image;i.crossOrigin="Anonymous",i.onload=()=>e(i),i.onerror=n=>t(new Error(`Failed to load image: ${r} ${n}`)),i.src=r})}async function Zg(r,e,t){const n=new p.CylinderGeometry(.2,.2,24,12),s=new p.MeshBasicMaterial({color:r.color}),a=await St._loadTexture(r.icon),c=new p.PointsMaterial({size:80*window.innerHeight/window.innerHeight,fog:!1,opacity:1,transparent:r.transparent??!0,toneMapped:!1,blending:p.AdditiveBlending,map:a,sizeAttenuation:!0,depthTest:r.depthTest??!0,depthWrite:r.depthWrite??!1}),h=new p.InstancedMesh(n,s,e.length);h.position.add(t.prjcenter),h.castShadow=!0;const d=new p.Object3D,m=[];for(let w=0;w<e.length;w++){const b=e[w],x=new p.Vector3(b.coordinates[0],b.coordinates[1],b.coordinates[2]||0),M=t.geo2world(x).sub(t.prjcenter);d.position.copy(M),d.updateMatrix(),h.setMatrixAt(w,d.matrix),m.push(M.x,0,M.z)}const f=new Float32Array(m),g=new p.BufferGeometry;g.setAttribute("position",new p.BufferAttribute(f,3));const _=new p.Points(g,c);return _.position.add(t.prjcenter),_.position.y=1.5*10,_.renderOrder=99999999,_.visible=!0,{points:_,InstancedCol:h}}var Vg=Object.defineProperty,Ig=(r,e,t)=>e in r?Vg(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Bc=(r,e,t)=>Ig(r,typeof e!="symbol"?e+"":e,t);const ea=class Kn{constructor(e){this.config=e}async applyTo(e){if(!e)return!1;try{switch(e.visible=this.config.visible!==!1,this.config.type){case"basic-point":case"icon-point":case"icon-label-point":return this._applyPointStyle(e);case"basic-line":return this._applyLineStyle(e);case"flow-tube-line":return this._applyFlowLineStyle(e);case"arrow-line":return this._applyArrowLineStyle(e);case"flow-texture-line":return this._applyFlowTextureLineStyle(e);case"gltf":case"fbx":return this._applyModelStyle(e);case"basic-polygon":return this._applyPolygonStyle(e);case"extrude-polygon":return this._applyExtrudeStyle(e);case"water":case"base-water":return this._applyWaterStyle(e);case"cloud":return this._applyCloudStyle(e);case"canvas-label":case"canvas-label-fixed":return this._applyTextSpriteStyle(e);case"light":return this._applyLightStyle(e);case"custom":return this._applyCustomStyle(e);default:throw new Error("Unknown style type")}}catch(t){return console.error("Style apply failed:",t),e.visible=!1,!1}}async _applyPointStyle(e){const t=this.config;return t.type==="icon-point"?await this._applyIconPoint(e,t):t.type==="basic-point"?this._applyBasicPoint(e,t):t.type==="icon-label-point"&&this._applyIconLabelPoint(e,t),!0}async _applyIconPoint(e,t){return!0}_applyBasicPoint(e,t){let i;if(e instanceof p.Points)i=e;else if(i=Sn(t,e.position),i.position.copy(e.position),i.rotation.copy(e.rotation),i.scale.copy(e.scale),e.parent){let a=e.parent;a._threeGeometry=i,a._updateGeometry()}const n=i.material,s=t.sizeAttenuation;n.size=s?t.size*.002:t.size,t.color&&n.color.set(t.color),n.sizeAttenuation=s??!1,n.onBeforeCompile=a=>{a.fragmentShader=a.fragmentShader.replace("#include <clipping_planes_fragment>",`
972
+ #include <clipping_planes_fragment>
973
+ vec2 coord = gl_PointCoord - vec2(0.5);
974
+ if(length(coord) > 0.5) discard;
975
+ `)},n.needsUpdate=!0}_applyIconLabelPoint(e,t){return!0}_applyLineStyle(e){const t=this.config;if(e.isLine2){const n=e.material;return t.color!==void 0&&n.color.set(t.color),t.width!==void 0&&(n.linewidth=t.width),t.opacity!==void 0&&(n.opacity=t.opacity,n.transparent=t.opacity<1),n.needsUpdate=!0,!0}if(e.parent){let i=e.parent;i._toThreeJSGeometry&&i._toThreeJSGeometry()}return!0}_applyFlowLineStyle(e){return!0}_applyArrowLineStyle(e){return!0}_applyFlowTextureLineStyle(e){return!0}_applyPolygonStyle(e){const t=this.config;return e.traverse(i=>{if(i instanceof p.Mesh&&(Array.isArray(i.material)?i.material:[i.material]).forEach(s=>{t.color!==void 0&&s.color.set(t.color),t.opacity!==void 0&&(s.opacity=t.opacity,s.transparent=t.opacity<1),t.wireframe!==void 0&&(s.wireframe=t.wireframe),s.needsUpdate=!0}),i.isLine2){const s=i.material;t.borderColor!==void 0&&s.color.set(t.borderColor),t.borderWidth!==void 0&&(s.linewidth=t.borderWidth),t.opacity!==void 0&&(s.opacity=t.opacity,s.transparent=t.opacity<1),s.needsUpdate=!0}}),!0}_applyExtrudeStyle(e){return!0}_applyWaterStyle(e){return!0}_applyCloudStyle(e){return!0}_applyTextSpriteStyle(e){return!0}_applyLightStyle(e){return!0}async _applyModelStyle(e){return!0}async _applyCustomStyle(e){const i=await this.config.build();return e instanceof p.Group&&(e.clear(),e.add(i)),!0}static async _loadTexture(e){if(Kn._textureCache.has(e))return Kn._textureCache.get(e);const t=await new Promise((i,n)=>{Kn._textureLoader.load(e,i,void 0,n)});return t.needsUpdate=!0,Kn._textureCache.set(e,t),t}static create(e){return e instanceof Kn?e:new Kn(e)}};Bc(ea,"_textureCache",new Map),Bc(ea,"_textureLoader",new p.TextureLoader);let St=ea;const nt=[];for(let r=0;r<256;++r)nt.push((r+256).toString(16).slice(1));function Ag(r,e=0){return(nt[r[e+0]]+nt[r[e+1]]+nt[r[e+2]]+nt[r[e+3]]+"-"+nt[r[e+4]]+nt[r[e+5]]+"-"+nt[r[e+6]]+nt[r[e+7]]+"-"+nt[r[e+8]]+nt[r[e+9]]+"-"+nt[r[e+10]]+nt[r[e+11]]+nt[r[e+12]]+nt[r[e+13]]+nt[r[e+14]]+nt[r[e+15]]).toLowerCase()}let ta;const Fg=new Uint8Array(16);function Og(){if(!ta){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ta=crypto.getRandomValues.bind(crypto)}return ta(Fg)}const Yc={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function zg(r,e,t){if(Yc.randomUUID&&!r)return Yc.randomUUID();r=r||{};const i=r.random??r.rng?.()??Og();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,Ag(i)}var Rc=(r=>(r.POINT="point",r.LINE_VERTEX="line_vertex",r.POLYGON_CENTER="polygon_center",r.LABEL="label",r.ICON="icon",r.CLUSTER="cluster",r))(Rc||{}),vi=(r=>(r.NO_COLLISION="no_collision",r.PRIORITY_LOST="priority_lost",r.OUT_OF_VIEWPORT="out_of_viewport",r.ZOOM_FILTERED="zoom_filtered",r.MANUAL_HIDDEN="manual_hidden",r.GROUP_COLLISION="group_collision",r))(vi||{}),Dg=Object.defineProperty,Xg=(r,e,t)=>e in r?Dg(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Gr=(r,e,t)=>Xg(r,typeof e!="symbol"?e+"":e,t);class kg extends ds{constructor(){super(...arguments),Gr(this,"_isDragging",!1),Gr(this,"_lastCoord",null),Gr(this,"_boundOnMouseDown",this._onMouseDown.bind(this)),Gr(this,"_boundOnMouseMove",this._onMouseMove.bind(this)),Gr(this,"_boundOnMouseUp",this._onMouseUp.bind(this))}addHooks(){this.target.on("mousedown",this._boundOnMouseDown)}removeHooks(){this.target.off("mousedown",this._boundOnMouseDown),this._stopDrag()}_onMouseDown(e){const t=this.target.getMap();!t||!this.target.options.draggable||(this._isDragging=!0,this._lastCoord=e.coordinate,t.viewer.config("draggable",!1),t.on("mousemove",this._boundOnMouseMove),t.on("mouseup",this._boundOnMouseUp),this.target.trigger("dragstart",e))}_onMouseMove(e){if(!this._isDragging||!this._lastCoord||!e.coordinate)return;const t=e.coordinate,i=t[0]-this._lastCoord[0],n=t[1]-this._lastCoord[1];Math.abs(i)<1e-8&&Math.abs(n)<1e-8||(this._translate(i,n),this._lastCoord=t,this.target.trigger("dragging",e))}_onMouseUp(e){this._stopDrag(),this.target.trigger("dragend",e)}_stopDrag(){this._isDragging=!1;const e=this.target.getMap();e&&(e.viewer.config("draggable",!0),e.off("mousemove",this._boundOnMouseMove),e.off("mouseup",this._boundOnMouseUp))}_translate(e,t){const i=this.target._geometry;if(!i||!i.coordinates)return;const n=a=>Array.isArray(a[0])?a.map(n):[a[0]+e,a[1]+t],s=n(i.coordinates);i.coordinates=s,this.target._onPositionChanged(!0)}}var Ug=Object.defineProperty,Ng=(r,e,t)=>e in r?Ug(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Vt=(r,e,t)=>Ng(r,typeof e!="symbol"?e+"":e,t);class dt extends Qo(Yi(xn(p.Object3D))){constructor(e){super(),Vt(this,"_position"),Vt(this,"_threeGeometry"),Vt(this,"_geometry"),Vt(this,"_layer"),Vt(this,"_style"),Vt(this,"_id"),Vt(this,"_styleQueue",[]),Vt(this,"_isApplyingStyle",!1),Vt(this,"_isGeometryInitializing",!1),Vt(this,"_bloomConfig"),Vt(this,"_collisionState",{visible:!0,reason:vi.NO_COLLISION,collidedWith:[],timestamp:Date.now()}),Vt(this,"_collisionConfig",{enabled:!0,priority:50,padding:4,minZoom:0,maxZoom:24}),Vt(this,"_animationRef",null),Ko(e.geometry,"geometry","geometry must be specified"),this._geometry=e.geometry,this._position=new p.Vector3(0,0,0),this._threeGeometry=new p.Object3D,this.options={draggable:e.draggable||!1,editable:e.editable||!1},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=zg(),this.addHandler("draggable",kg)}async initializeGeometry(){if(!(this._isGeometryInitializing||this._threeGeometry)){this._isGeometryInitializing=!0;try{await this._toThreeJSGeometry(),this._processStyleQueue()}finally{this._isGeometryInitializing=!1}}}_updateGeometryPositions(){this._toThreeJSGeometry()}setStyle(e){const t=e instanceof St?e:new St(e);this._style=t;const i=JSON.parse(JSON.stringify(t.config));return this._styleQueue.push(i),this._tryProcessQueue(),this}getStyle(){return this._style}setBloom(e,t){const i=this._bloomConfig||{intensity:1,color:"#ffffff"};return this._bloomConfig={enabled:e,intensity:t?.intensity??i.intensity,color:t?.color??i.color},this._threeGeometry&&this._applyBloomToObject(this._threeGeometry),this}getBloom(){return this._bloomConfig}_applyBloomToObject(e){if(!this._bloomConfig)return;const{enabled:t,intensity:i,color:n}=this._bloomConfig;e.traverse(s=>{if(s instanceof p.Points&&s.material){const a=s.material;s.userData=s.userData||{},s.userData.__bloomBackup||(s.userData.__bloomBackup={size:a.size,sizeAttenuation:a.sizeAttenuation});const c=s.userData.__bloomBackup;t?(a.size=c.size*(1+i),a.sizeAttenuation=!1):(a.size=c.size,a.sizeAttenuation=c.sizeAttenuation),a.needsUpdate=!0;return}if(s.type==="Sprite"&&s.material){const a=s.material;s.userData=s.userData||{},s.userData.__bloomBackup||(s.userData.__bloomBackup={color:a.color?a.color.clone():null,opacity:a.opacity??1});const c=s.userData.__bloomBackup;t?(a.color&&c.color&&(a.color.copy(c.color),n&&n!=="#ffffff"&&a.color.setStyle(n),a.color.multiplyScalar(1+i*2)),a.opacity=Math.min(1,(c.opacity??1)*(1+i*.3))):(c.color&&a.color&&a.color.copy(c.color),a.opacity=c.opacity),a.needsUpdate=!0;return}if(s.isLine2&&s.material){const a=s.material;s.userData=s.userData||{},s.userData.__bloomBackup||(s.userData.__bloomBackup={color:a.color?a.color.clone():null,opacity:a.opacity??1});const c=s.userData.__bloomBackup;t?(a.color&&c.color&&(a.color.copy(c.color),n&&n!=="#ffffff"&&a.color.setStyle(n),a.color.multiplyScalar(1+i*2)),a.opacity=Math.min(1,(c.opacity??1)*(1+i*.3))):(c.color&&a.color&&a.color.copy(c.color),a.opacity=c.opacity),a.needsUpdate=!0;return}s instanceof p.Mesh&&s.material&&(Array.isArray(s.material)?s.material:[s.material]).forEach(c=>{s.userData=s.userData||{},s.userData.__bloomBackup||(s.userData.__bloomBackup={emissiveIntensity:c.emissiveIntensity??0,emissiveColor:c.emissive?c.emissive.clone():null,color:c.color?c.color.clone():null});const h=s.userData.__bloomBackup;t?"emissive"in c&&c.emissive?(c.emissiveIntensity=i,n&&n!=="#ffffff"&&c.emissive.setStyle?c.emissive.setStyle(n):h.color&&c.emissive&&c.emissive.copy(h.color)):c.color&&(h.color&&c.color.copy(h.color),n&&n!=="#ffffff"?c.color.setStyle(n):c.color.multiplyScalar(1+i*.3)):("emissiveIntensity"in c&&(c.emissiveIntensity=h.emissiveIntensity!==void 0?h.emissiveIntensity:0),h.emissiveColor&&c.emissive&&c.emissive.copy(h.emissiveColor),h.color&&c.color&&c.color.copy(h.color)),c.needsUpdate=!0})})}async _applyStyleWithRetry(e,t=3,i=100){let n=null;for(let s=1;s<=t;s++)try{this._threeGeometry.parent||(this.add(this._threeGeometry),await new Promise(c=>requestAnimationFrame(c))),await e.applyTo(this._threeGeometry);const a=e.config;if(a.bloom!==void 0){const c=a.bloom;typeof c=="boolean"?this._bloomConfig={enabled:c,intensity:1,color:"#ffffff"}:this._bloomConfig={enabled:c.enabled??!0,intensity:c.intensity??1,color:c.color??"#ffffff"}}this._bloomConfig&&this._threeGeometry&&this._applyBloomToObject(this._threeGeometry);return}catch(a){if(n=a,s<t){const c=i*Math.pow(2,s-1);await new Promise(h=>setTimeout(h,c))}}throw n||new Error("样式应用失败,重试次数耗尽")}async _processStyleQueue(){if(!this._threeGeometry||this._isApplyingStyle||this._styleQueue.length===0)return;this._isApplyingStyle=!0;const e=this._styleQueue[0];try{const t=new St(JSON.parse(JSON.stringify(e)));await this._applyStyleWithRetry(t),this._styleQueue.shift(),this._styleQueue.length>0&&await this._processStyleQueue()}catch(t){throw t}finally{this._isApplyingStyle=!1,this._styleQueue.length>0&&this._tryProcessQueue()}}_tryProcessQueue(){this._threeGeometry&&!this._isApplyingStyle&&this._styleQueue.length>0?this._processStyleQueue().catch(t=>{this._isApplyingStyle=!1,this._tryProcessQueue(),console.warn(t)}):!this._threeGeometry&&!this._isGeometryInitializing&&this.initializeGeometry()}addTo(e){return e.addFeature(this),this}getLayer(){return this._layer||null}getMap(){return this._layer?this._layer.getMap():null}setCoordinates(e){return this._geometry.coordinates=e,this._onPositionChanged(),this}_onPositionChanged(e=!1){e&&this._threeGeometry?this._updateGeometryPositions():this._toThreeJSGeometry(),this.trigger("positionchange")}getCenter(){return this._geometry.type==="Point"?this._geometry.coordinates:[0,0]}_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?.userData?._type==="Model"?this._threeGeometry.renderOrder=0:this._threeGeometry.renderOrder=99,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 p.Mesh?(e.geometry?.dispose(),Array.isArray(e.material)?e.material.forEach(t=>t.dispose()):e.material?.dispose()):"isLine"in e&&e.isLine&&(e.geometry?.dispose(),e.material?.dispose())}))}get collidable(){return this._collisionConfig.enabled}get collisionType(){return Rc.POINT}getCollisionPriority(){return this.userData.collisionPriority??this._style?.config.collisionPriority??this._collisionConfig.priority}getScreenBoundingBox(e,t){if(!this.collidable)return null;try{const i=new p.Vector3;this._threeGeometry.getWorldPosition(i);const n=i.clone().project(e);if(!(n.x>=-1.1&&n.x<=1.1&&n.y>=-1.1&&n.y<=1.1&&n.z>=-1&&n.z<=1))return null;const{width:a,height:c}=t.domElement,h=(n.x*.5+.5)*a,d=(-n.y*.5+.5)*c,m=this._calculateCollisionBoundingBox(e,t);return m?{id:this._id,x:h+m.offsetX,y:d+m.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(i){return console.warn(`Feature ${this._id} 包围盒计算失败:`,i),null}}setCollisionVisibility(e,t=vi.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:t,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,vi.MANUAL_HIDDEN),this}_applyVisibilityAlpha(e){this.traverse(t=>{t instanceof p.Mesh&&(Array.isArray(t.material)?t.material.forEach(i=>{i.opacity!==void 0&&(i.opacity=e)}):t.material.opacity!==void 0&&(t.material.opacity=e))})}_applyFinalAlpha(e){this._applyVisibilityAlpha(e),this.traverse(t=>{t instanceof p.Mesh&&(t.material.needsUpdate=!0)})}getCollisionData(){return{featureType:this.constructor.name,userData:this.userData,styleConfig:this._style?.config}}_calculateCollisionBoundingBox(e,t){if(!this.visible||!this._threeGeometry||!e||!t)return null;try{const i=new p.Box3().setFromObject(this._threeGeometry);if(i.isEmpty())return this._getFallbackBoundingBox();const n=[new p.Vector3(i.min.x,i.min.y,i.min.z),new p.Vector3(i.max.x,i.min.y,i.min.z),new p.Vector3(i.min.x,i.max.y,i.min.z),new p.Vector3(i.max.x,i.max.y,i.min.z),new p.Vector3(i.min.x,i.min.y,i.max.z),new p.Vector3(i.max.x,i.min.y,i.max.z),new p.Vector3(i.min.x,i.max.y,i.max.z),new p.Vector3(i.max.x,i.max.y,i.max.z)],{width:s,height:a}=t.domElement,c=[];n.forEach(D=>{const z=D.clone().project(e),X=(z.x*.5+.5)*s,I=(-z.y*.5+.5)*a;c.push(new p.Vector2(X,I))});let h=1/0,d=-1/0,m=1/0,f=-1/0;c.forEach(D=>{h=Math.min(h,D.x),d=Math.max(d,D.x),m=Math.min(m,D.y),f=Math.max(f,D.y)});const g=d-h,_=f-m,w=4,b=Math.max(g,w),x=Math.max(_,w),L=new p.Vector3;i.getCenter(L);const M=L.clone().project(e),C=(M.x*.5+.5)*s,W=(-M.y*.5+.5)*a;return{width:b,height:x,offsetX:h-C,offsetY:m-W}}catch(i){return console.warn("Bounding box calculation failed 包围盒计算失败:",i),this._getFallbackBoundingBox()}}_getFallbackBoundingBox(){return{width:20,height:20,offsetX:-10,offsetY:-10}}_tileCoordToLocalWorld(e,t,i,n){const{tileZ:s,tileX:a,tileY:c,extent:h,tileSize:d}=i,m=(e/h-.5)*d,f=(.5-t/h)*d;return n.tileIDToWorldCenter(s,a,c).clone().add(new p.Vector3(m,f,0)).sub(n.prjcenter)}}var Kg=Object.defineProperty,Bg=(r,e,t)=>e in r?Kg(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,jc=(r,e,t)=>Bg(r,typeof e!="symbol"?e+"":e,t);class ji extends Pr{constructor(e,t){super(e,t),jc(this,"_feaList"),jc(this,"_collision",!1),this._feaList=[],t?.collision&&(this._collision=!0)}addFeature(e){const t=Array.isArray(e)?e:[e];for(const i of t)if(!(!i||!(i instanceof dt))&&!i.getLayer()){if(!this.validateFeature(i)){console.error(`Feature ${i.id} does not match the layer's type requirements`);continue}i._bindLayer(this),this._feaList.push(i),i.getMap()&&i._toThreeJSGeometry(),this._clouds&&(this.map.viewer.scene.add(this._clouds),console.log("我是云朵被添加cloud",this.map.viewer.scene)),this.add(i)}return this}getFeatures(e,t){if(!e)return this._feaList.slice(0);const i=[];let n,s;for(let a=0,c=this._feaList.length;a<c;a++)n=this._feaList[a],t?s=e.call(t,n):s=e(n),s&&i.push(n);return i}getCount(){return this._feaList.length}isEmpty(){return!this._feaList.length}removeFeature(e){if(!Array.isArray(e))return this.removeFeature([e]);for(let t=e.length-1;t>=0;t--)e[t]instanceof dt||(e[t]=this.removeFeature(e[t])),!(!e[t]||this!==e[t].getLayer())&&e[t]._remove();return this}clear(){if(this._feaList.length===0)return this;this._isClearing=!0;const e=this._feaList.slice();for(const t of e)t._remove();return e.length>0&&this.remove(...e),this._feaList=[],this._isClearing=!1,this}onRemoveFeature(e){if(!e)return;const t=e.getLayer();if(!(!t||t!==this)){if(!this._isClearing){const i=this._feaList.indexOf(e);i>=0&&this._feaList.splice(i,1),e.parent&&e.parent===this?this.remove(e):console.warn("Feature parent mismatch:",e.parent)}this._disposeFeatureResources(e)}}_findInList(e){const t=this._feaList.length;if(t===0)return-1;let i=0,n=t-1,s;for(;i<=n;){if(s=Math.floor((i+n)/2),this._feaList[s]===e)return s;i=s+1}return-1}_disposeFeatureResources(e){try{e instanceof p.Object3D&&e.traverse(t=>{t.geometry&&t.geometry.dispose&&t.geometry.dispose(),t.material&&(Array.isArray(t.material)?t.material.forEach(i=>i?.dispose?.()):t.material.dispose&&t.material.dispose())})}catch(t){console.error("Error disposing feature resources:",t)}}_mergedGeometry(){this.traverse(e=>{e.isMesh&&e.geometry&&e.material&&console.log("Merging geometry 几何体合并中",e)})}setCollisionEngine(e){return this._collisionEngine=e,this}}var Yg=Object.defineProperty,Rg=(r,e,t)=>e in r?Yg(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Jc=(r,e,t)=>Rg(r,typeof e!="symbol"?e+"":e,t);class jg extends p.Group{constructor(){super(...arguments),Jc(this,"_layers",new Set),Jc(this,"_layerids",new Set)}add(...e){return e.forEach(t=>{if(!(t instanceof Pr))throw new Error("LayerContainer can only contain Layer instances! LayerContainer只能包含Layer实例!");const i=t.getId();if(this._layerids.has(i))throw new Error(`Layer with ID '${i}' already exists in the container! ID为'${i}'的图层已存在于容器中!`);this._layers.add(t),this._layerids.add(i),super.add(t)}),this}remove(...e){return e.forEach(t=>{this._layers.delete(t),this._layerids.delete(t.getId()),super.remove(t)}),this}getLayers(){return Array.from(this._layers)}getLayerById(e){for(const t of this._layers)if(t.getId()===e)return t}clearLayers(){return this._layers.clear(),this._layerids.clear(),super.clear(),this}}var Jg=Object.defineProperty,Qg=(r,e,t)=>e in r?Jg(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Hg=(r,e,t)=>Qg(r,e+"",t);class $g{constructor(){Hg(this,"canvasDict",{})}getCanvas(e=40,t=30,i=1,n){const s=Math.ceil(e*i),a=Math.ceil(t*i),c=n?`${s}_${a}_${n}`:`${s}_${a}`;if(!this.canvasDict[c]){const m=document.createElement("canvas");m.width=s,m.height=a,this.canvasDict[c]=m}const h=this.canvasDict[c],d=h.getContext("2d");return d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,h.width,h.height),d.scale(i,i),h}}function Eg(r){const e=+this._x.call(null,r),t=+this._y.call(null,r);return Qc(this.cover(e,t),e,t,r)}function Qc(r,e,t,i){if(isNaN(e)||isNaN(t))return r;var n,s=r._root,a={data:i},c=r._x0,h=r._y0,d=r._x1,m=r._y1,f,g,_,w,b,x,L,M;if(!s)return r._root=a,r;for(;s.length;)if((b=e>=(f=(c+d)/2))?c=f:d=f,(x=t>=(g=(h+m)/2))?h=g:m=g,n=s,!(s=s[L=x<<1|b]))return n[L]=a,r;if(_=+r._x.call(null,s.data),w=+r._y.call(null,s.data),e===_&&t===w)return a.next=s,n?n[L]=a:r._root=a,r;do n=n?n[L]=new Array(4):r._root=new Array(4),(b=e>=(f=(c+d)/2))?c=f:d=f,(x=t>=(g=(h+m)/2))?h=g:m=g;while((L=x<<1|b)===(M=(w>=g)<<1|_>=f));return n[M]=s,n[L]=a,r}function qg(r){var e,t,i=r.length,n,s,a=new Array(i),c=new Array(i),h=1/0,d=1/0,m=-1/0,f=-1/0;for(t=0;t<i;++t)isNaN(n=+this._x.call(null,e=r[t]))||isNaN(s=+this._y.call(null,e))||(a[t]=n,c[t]=s,n<h&&(h=n),n>m&&(m=n),s<d&&(d=s),s>f&&(f=s));if(h>m||d>f)return this;for(this.cover(h,d).cover(m,f),t=0;t<i;++t)Qc(this,a[t],c[t],r[t]);return this}function e0(r,e){if(isNaN(r=+r)||isNaN(e=+e))return this;var t=this._x0,i=this._y0,n=this._x1,s=this._y1;if(isNaN(t))n=(t=Math.floor(r))+1,s=(i=Math.floor(e))+1;else{for(var a=n-t||1,c=this._root,h,d;t>r||r>=n||i>e||e>=s;)switch(d=(e<i)<<1|r<t,h=new Array(4),h[d]=c,c=h,a*=2,d){case 0:n=t+a,s=i+a;break;case 1:t=n-a,s=i+a;break;case 2:n=t+a,i=s-a;break;case 3:t=n-a,i=s-a;break}this._root&&this._root.length&&(this._root=c)}return this._x0=t,this._y0=i,this._x1=n,this._y1=s,this}function t0(){var r=[];return this.visit(function(e){if(!e.length)do r.push(e.data);while(e=e.next)}),r}function i0(r){return arguments.length?this.cover(+r[0][0],+r[0][1]).cover(+r[1][0],+r[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function _t(r,e,t,i,n){this.node=r,this.x0=e,this.y0=t,this.x1=i,this.y1=n}function n0(r,e,t){var i,n=this._x0,s=this._y0,a,c,h,d,m=this._x1,f=this._y1,g=[],_=this._root,w,b;for(_&&g.push(new _t(_,n,s,m,f)),t==null?t=1/0:(n=r-t,s=e-t,m=r+t,f=e+t,t*=t);w=g.pop();)if(!(!(_=w.node)||(a=w.x0)>m||(c=w.y0)>f||(h=w.x1)<n||(d=w.y1)<s))if(_.length){var x=(a+h)/2,L=(c+d)/2;g.push(new _t(_[3],x,L,h,d),new _t(_[2],a,L,x,d),new _t(_[1],x,c,h,L),new _t(_[0],a,c,x,L)),(b=(e>=L)<<1|r>=x)&&(w=g[g.length-1],g[g.length-1]=g[g.length-1-b],g[g.length-1-b]=w)}else{var M=r-+this._x.call(null,_.data),C=e-+this._y.call(null,_.data),W=M*M+C*C;if(W<t){var D=Math.sqrt(t=W);n=r-D,s=e-D,m=r+D,f=e+D,i=_.data}}return i}function r0(r){if(isNaN(m=+this._x.call(null,r))||isNaN(f=+this._y.call(null,r)))return this;var e,t=this._root,i,n,s,a=this._x0,c=this._y0,h=this._x1,d=this._y1,m,f,g,_,w,b,x,L;if(!t)return this;if(t.length)for(;;){if((w=m>=(g=(a+h)/2))?a=g:h=g,(b=f>=(_=(c+d)/2))?c=_:d=_,e=t,!(t=t[x=b<<1|w]))return this;if(!t.length)break;(e[x+1&3]||e[x+2&3]||e[x+3&3])&&(i=e,L=x)}for(;t.data!==r;)if(n=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,n?(s?n.next=s:delete n.next,this):e?(s?e[x]=s:delete e[x],(t=e[0]||e[1]||e[2]||e[3])&&t===(e[3]||e[2]||e[1]||e[0])&&!t.length&&(i?i[L]=t:this._root=t),this):(this._root=s,this)}function s0(r){for(var e=0,t=r.length;e<t;++e)this.remove(r[e]);return this}function o0(){return this._root}function a0(){var r=0;return this.visit(function(e){if(!e.length)do++r;while(e=e.next)}),r}function l0(r){var e=[],t,i=this._root,n,s,a,c,h;for(i&&e.push(new _t(i,this._x0,this._y0,this._x1,this._y1));t=e.pop();)if(!r(i=t.node,s=t.x0,a=t.y0,c=t.x1,h=t.y1)&&i.length){var d=(s+c)/2,m=(a+h)/2;(n=i[3])&&e.push(new _t(n,d,m,c,h)),(n=i[2])&&e.push(new _t(n,s,m,d,h)),(n=i[1])&&e.push(new _t(n,d,a,c,m)),(n=i[0])&&e.push(new _t(n,s,a,d,m))}return this}function c0(r){var e=[],t=[],i;for(this._root&&e.push(new _t(this._root,this._x0,this._y0,this._x1,this._y1));i=e.pop();){var n=i.node;if(n.length){var s,a=i.x0,c=i.y0,h=i.x1,d=i.y1,m=(a+h)/2,f=(c+d)/2;(s=n[0])&&e.push(new _t(s,a,c,m,f)),(s=n[1])&&e.push(new _t(s,m,c,h,f)),(s=n[2])&&e.push(new _t(s,a,f,m,d)),(s=n[3])&&e.push(new _t(s,m,f,h,d))}t.push(i)}for(;i=t.pop();)r(i.node,i.x0,i.y0,i.x1,i.y1);return this}function h0(r){return r[0]}function u0(r){return arguments.length?(this._x=r,this):this._x}function d0(r){return r[1]}function f0(r){return arguments.length?(this._y=r,this):this._y}function Hc(r,e,t){var i=new ia(e??h0,t??d0,NaN,NaN,NaN,NaN);return r==null?i:i.addAll(r)}function ia(r,e,t,i,n,s){this._x=r,this._y=e,this._x0=t,this._y0=i,this._x1=n,this._y1=s,this._root=void 0}function $c(r){for(var e={data:r.data},t=e;r=r.next;)t=t.next={data:r.data};return e}var vt=Hc.prototype=ia.prototype;vt.copy=function(){var r=new ia(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,t,i;if(!e)return r;if(!e.length)return r._root=$c(e),r;for(t=[{source:e,target:r._root=new Array(4)}];e=t.pop();)for(var n=0;n<4;++n)(i=e.source[n])&&(i.length?t.push({source:i,target:e.target[n]=new Array(4)}):e.target[n]=$c(i));return r},vt.add=Eg,vt.addAll=qg,vt.cover=e0,vt.data=t0,vt.extent=i0,vt.find=n0,vt.remove=r0,vt.removeAll=s0,vt.root=o0,vt.size=a0,vt.visit=l0,vt.visitAfter=c0,vt.x=u0,vt.y=f0;var p0=Object.defineProperty,m0=(r,e,t)=>e in r?p0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ec=(r,e,t)=>m0(r,typeof e!="symbol"?e+"":e,t);class qc{constructor(e){Ec(this,"_quadtree"),Ec(this,"_viewport"),this._viewport=e,this._rebuildQuadTree()}updateViewport(e){(e.width!==this._viewport.width||e.height!==this._viewport.height)&&(this._viewport=e,this._rebuildQuadTree())}addBoxes(e){e.forEach(t=>{this._isBoxInViewport(t)&&this._quadtree.add(t)})}findCollisions(e){const t=[],i=this._getSearchBounds(e);return this._quadtree.visit((n,s,a,c,h)=>this._checkNodeCollision(i,s,a,c,h)?(n.length||this._getNodeData(n).forEach(m=>{m.id!==e.id&&this._checkBoxCollision(e,m)&&t.push(m)}),!1):void 0),t}clear(){this._rebuildQuadTree()}getAllBoxes(){const e=[];return this._quadtree.visit(t=>{if(!t.length){const i=this._getNodeData(t);e.push(...i)}return!1}),e}_rebuildQuadTree(){this._quadtree=Hc().x(e=>e.x).y(e=>e.y).extent([[0,0],[this._viewport.width,this._viewport.height]])}_isBoxInViewport(e){const t=e.width/2,i=e.height/2;return e.x+t>=0&&e.x-t<=this._viewport.width&&e.y+i>=0&&e.y-i<=this._viewport.height}_getSearchBounds(e){return{x:e.x,y:e.y,width:e.width*2,height:e.height*2}}_checkNodeCollision(e,t,i,n,s){const a=(t+n)/2,c=(i+s)/2,h=n-t,d=s-i;return Math.abs(e.x-a)*2<e.width+h&&Math.abs(e.y-c)*2<e.height+d}_checkBoxCollision(e,t){return Math.abs(e.x-t.x)*2<e.width+t.width&&Math.abs(e.y-t.y)*2<e.height+t.height}_getNodeData(e){return e?Array.isArray(e.data)?e.data:e.data?[e.data]:[]:[]}removeBox(e){const i=this.getAllBoxes().filter(n=>n.id!==e);this.clear(),i.length>0&&this.addBoxes(i)}}var g0=Object.defineProperty,y0=(r,e,t)=>e in r?g0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,eh=(r,e,t)=>y0(r,typeof e!="symbol"?e+"":e,t);class _0{constructor(){eh(this,"_strategies",new Map),eh(this,"_executionOrder",[])}registerStrategy(e,t){return this._strategies.set(e.name,e),t!==void 0?this._executionOrder.splice(t,0,e.name):this._executionOrder.push(e.name),this}async executeStrategies(e,t){const i=new Map;e.forEach(n=>{i.set(n._id,{featureId:n._id,visible:!0,reason:vi.NO_COLLISION,collidedWith:[],timestamp:t.timestamp})});for(const n of this._executionOrder){const s=this._strategies.get(n);if(s?.enabled)try{const a=await s.execute(e,t,i);this._mergeResults(i,a)}catch(a){console.error(`Strategy ${n} execution failed: 策略 ${n} 执行失败:`,a)}}return i}_mergeResults(e,t){t.forEach(i=>{const n=e.get(i.featureId);n&&!n.visible||e.set(i.featureId,i)})}}var v0=Object.defineProperty,w0=(r,e,t)=>e in r?v0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ln=(r,e,t)=>w0(r,typeof e!="symbol"?e+"":e,t);class b0{constructor(){Ln(this,"frameStats",new Map),Ln(this,"summaryStats",{totalFrames:0,averageFrameTime:0,averageFPS:0,minFrameTime:1/0,maxFrameTime:0,totalFeaturesProcessed:0}),Ln(this,"sampleWindowSize",60),Ln(this,"currentFrameId",0),Ln(this,"lastReportTime",0),Ln(this,"reportInterval",5e3),Ln(this,"performanceThresholds",{criticalFrameTime:33,warningFrameTime:16,idealFrameTime:8}),this.lastReportTime=Date.now()}startFrame(e){this.currentFrameId=e;const t={frameId:e,startTime:performance.now(),endTime:0,duration:0,featureCount:0,visibleCount:0,hiddenCount:0,collisionChecks:0,memoryUsage:0,strategyTimes:new Map};this.frameStats.set(e,t),this.cleanupOldFrames()}endFrame(e,t){const i=this.frameStats.get(e);if(!i)return;const n=performance.now();i.endTime=n,i.duration=n-i.startTime,t&&Object.assign(i,t),"memory"in performance&&(i.memoryUsage=performance.memory.usedJSHeapSize),this.updateSummaryStats(i),this.maybeOutputReport()}recordStrategyTime(e,t){const i=this.frameStats.get(this.currentFrameId);i&&i.strategyTimes.set(e,t)}recordCollisionChecks(e){const t=this.frameStats.get(this.currentFrameId);t&&(t.collisionChecks+=e)}getStats(){const e=this.getRecentFrames(this.sampleWindowSize),t=this.calculateFPS(e),i=this.calculateAverageFrameTime(e);return{summary:{...this.summaryStats},recent:{fps:t,frameTime:i,frameTimeStdDev:this.calculateFrameTimeStdDev(e),averageFeaturesPerFrame:this.calculateAverageFeatures(e),performanceLevel:this.getPerformanceLevel(i)},currentFrame:this.frameStats.get(this.currentFrameId)||null,strategies:this.getStrategyPerformance(e),warnings:this.getPerformanceWarnings(e)}}getDetailedReport(){const e=this.getRecentFrames(this.sampleWindowSize),t=this.getStats();return{...t,frameHistory:Array.from(e.values()),trends:this.calculateTrends(e),recommendations:this.getPerformanceRecommendations(t)}}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((t,i)=>t-i).slice(0,this.frameStats.size-this.sampleWindowSize).forEach(t=>{this.frameStats.delete(t)})}updateSummaryStats(e){this.summaryStats.totalFrames++,this.summaryStats.totalFeaturesProcessed+=e.featureCount||0,this.summaryStats.averageFrameTime=(this.summaryStats.averageFrameTime*(this.summaryStats.totalFrames-1)+e.duration)/this.summaryStats.totalFrames,this.summaryStats.minFrameTime=Math.min(this.summaryStats.minFrameTime,e.duration),this.summaryStats.maxFrameTime=Math.max(this.summaryStats.maxFrameTime,e.duration),this.summaryStats.averageFPS=1e3/this.summaryStats.averageFrameTime}maybeOutputReport(){const e=Date.now();if(e-this.lastReportTime>=this.reportInterval){const t=this.getStats();t.warnings.length>0?console.warn("避让系统性能报告:",t):console.log("避让系统性能正常:",t),this.lastReportTime=e}}getRecentFrames(e){return Array.from(this.frameStats.values()).slice(-e).filter(i=>i.duration>0)}calculateFPS(e){if(e.length===0)return 0;const t=this.calculateAverageFrameTime(e);return t>0?1e3/t:0}calculateAverageFrameTime(e){return e.length===0?0:e.reduce((t,i)=>t+i.duration,0)/e.length}calculateFrameTimeStdDev(e){if(e.length===0)return 0;const t=this.calculateAverageFrameTime(e),i=e.map(n=>Math.pow(n.duration-t,2));return Math.sqrt(i.reduce((n,s)=>n+s,0)/e.length)}calculateAverageFeatures(e){return e.length===0?0:e.reduce((t,i)=>t+(i.featureCount||0),0)/e.length}getPerformanceLevel(e){return e>this.performanceThresholds.criticalFrameTime?"critical":e>this.performanceThresholds.warningFrameTime?"warning":e>this.performanceThresholds.idealFrameTime?"good":"excellent"}getStrategyPerformance(e){const t=new Map;return e.forEach(i=>{i.strategyTimes.forEach((n,s)=>{t.has(s)||t.set(s,[]),t.get(s).push(n)})}),Array.from(t.entries()).map(([i,n])=>({name:i,averageTime:n.reduce((s,a)=>s+a,0)/n.length,maxTime:Math.max(...n),minTime:Math.min(...n),callCount:n.length}))}getPerformanceWarnings(e){const t=[],i=e.slice(-30);if(i.length===0)return t;const n=this.calculateAverageFrameTime(i);n>this.performanceThresholds.criticalFrameTime?t.push({type:"critical",message:`帧率过低: ${Math.round(1e3/n)}fps`,suggestion:"考虑减少要素数量或简化避让策略"}):n>this.performanceThresholds.warningFrameTime&&t.push({type:"warning",message:`帧率较低: ${Math.round(1e3/n)}fps`,suggestion:"建议优化避让算法或增加更新间隔"});const s=i.map(a=>a.memoryUsage).filter(a=>a>0);if(s.length>0){const a=s.reduce((c,h)=>c+h,0)/s.length;a>100*1024*1024&&t.push({type:"warning",message:`内存使用较高: ${(a/1024/1024).toFixed(1)}MB`,suggestion:"检查内存泄漏,及时清理无用资源"})}return t}calculateTrends(e){if(e.length<2)return{frameTime:"stable",fps:"stable",features:"stable"};const t=e.slice(0,Math.floor(e.length/2)),i=e.slice(Math.floor(e.length/2)),n=this.calculateAverageFrameTime(t),a=(this.calculateAverageFrameTime(i)-n)/n*100;return{frameTime:Math.abs(a)<5?"stable":a>0?"worsening":"improving",fps:Math.abs(a)<5?"stable":a>0?"improving":"worsening",features:"stable"}}getPerformanceRecommendations(e){const t=[];return e.recent.performanceLevel==="critical"&&(t.push("建议启用要素抽样或聚合显示"),t.push("考虑增加避让更新间隔时间"),t.push("检查是否有不必要的避让策略")),e.recent.averageFeaturesPerFrame>5e3&&t.push("要素数量过多,建议启用LOD分级"),e.strategies.forEach(i=>{i.averageTime>10&&t.push(`策略 "${i.name}" 执行时间较长,考虑优化`)}),t}}var x0=Object.defineProperty,M0=(r,e,t)=>e in r?x0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,vs=(r,e,t)=>M0(r,typeof e!="symbol"?e+"":e,t);class S0{constructor(){vs(this,"name","priority"),vs(this,"enabled",!0),vs(this,"weight",1),vs(this,"description","Priority-based avoidance strategy, smaller value means higher priority 基于优先级的避让策略,数值越小优先级越高")}async execute(e,t,i){const n=[],s=new qc(t.viewport),a=[],c=new Map;return e.forEach(h=>{if(!h.collidable)return;const d=h.getScreenBoundingBox(t.camera,t.renderer);d&&(a.push(d),c.set(h._id,h),i?.get(h._id)?.visible)}),a.sort((h,d)=>h.priority-d.priority),a.forEach(h=>{const d=s.findCollisions(h);d.length===0?(s.addBoxes([h]),n.push({featureId:h.featureId,visible:!0,reason:vi.NO_COLLISION,collidedWith:[],timestamp:t.timestamp})):d.some(f=>f.priority<h.priority)?n.push({featureId:h.featureId,visible:!1,reason:vi.PRIORITY_LOST,collidedWith:d.map(f=>f.featureId),timestamp:t.timestamp}):(s.addBoxes([h]),n.push({featureId:h.featureId,visible:!0,reason:vi.NO_COLLISION,collidedWith:[],timestamp:t.timestamp}),d.forEach(f=>{n.push({featureId:f.featureId,visible:!1,reason:vi.PRIORITY_LOST,collidedWith:[h.featureId],timestamp:t.timestamp})}))}),n}}var L0=Object.defineProperty,P0=(r,e,t)=>e in r?L0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ji=(r,e,t)=>P0(r,typeof e!="symbol"?e+"":e,t);class C0{constructor(e,t={}){this.renderer=e,Ji(this,"_quadTreeManager"),Ji(this,"_strategyOrchestrator"),Ji(this,"_performanceMonitor"),Ji(this,"_layers",new Set),Ji(this,"_config"),Ji(this,"_isUpdating",!1),Ji(this,"_lastUpdateTime",0),Ji(this,"_frameCount",0),this._config={enabled:!0,padding:4,updateInterval:0,animationDuration:300,maxFeaturesPerFrame:2e3,viewportMargin:50,strategies:{priority:!0,grouping:!1,proximity:!1},...t},this._initializeComponents(),this._setupPerformanceMonitoring()}async update(e){if(!this._config.enabled||this._isUpdating)return;const t=Date.now();if(!(this._config.updateInterval>0&&t-this._lastUpdateTime<this._config.updateInterval)){this._isUpdating=!0,this._frameCount++;try{this._resetAllFeaturesVisibility();const i=this._createCollisionContext(e,t),n=this._collectCollidableFeatures();if(n.length===0)return;this._performanceMonitor.startFrame(this._frameCount);const s=await this._strategyOrchestrator.executeStrategies(n,i);await this._applyCollisionResults(s,n),this._performanceMonitor.endFrame(this._frameCount,{featureCount:n.length,visibleCount:Array.from(s.values()).filter(a=>a.visible).length,hiddenCount:Array.from(s.values()).filter(a=>!a.visible).length}),this._lastUpdateTime=t}catch(i){console.error("避让引擎更新失败:",i)}finally{this._isUpdating=!1}}}_resetAllFeaturesVisibility(){this._layers.forEach(e=>{e.getFeatures().filter(i=>i.collidable).forEach(i=>{i.setCollisionVisibility(!0,vi.NO_COLLISION)})})}registerLayer(e){return this._layers.add(e),this}unregisterLayer(e){return this._layers.delete(e),this}setConfig(e){return Object.assign(this._config,e),this}getPerformanceStats(){return this._performanceMonitor.getStats()}_initializeComponents(){const e={width:this.renderer.domElement.width,height:this.renderer.domElement.height};this._quadTreeManager=new qc(e),this._strategyOrchestrator=new _0,this._performanceMonitor=new b0,this._strategyOrchestrator.registerStrategy(new S0,0),this._setupViewportResizeHandler()}_createCollisionContext(e,t){return{camera:e,renderer:this.renderer,viewport:{width:this.renderer.domElement.width,height:this.renderer.domElement.height},zoomLevel:e.position.z,timestamp:t,frameNumber:this._frameCount}}_collectCollidableFeatures(){const e=[];return this._layers.forEach(t=>{const i=t.getFeatures().filter(n=>n.collidable&&n instanceof dt);if(e.length+i.length>this._config.maxFeaturesPerFrame){console.warn(`达到每帧最大要素处理限制: ${this._config.maxFeaturesPerFrame}`);return}e.push(...i)}),e}async _applyCollisionResults(e,t){const i=t.map(n=>{const s=e.get(n._id);return s&&n.setCollisionVisibility(s.visible,s.reason),Promise.resolve()});await Promise.all(i)}_setupViewportResizeHandler(){new ResizeObserver(t=>{t.forEach(i=>{const{width:n,height:s}=i.contentRect;this._quadTreeManager.updateViewport({width:n,height:s})})}).observe(this.renderer.domElement)}_setupPerformanceMonitoring(){setInterval(()=>{const e=this.getPerformanceStats();e.frameRate<30&&console.warn("避让系统性能警告:",e)},5e3)}}var Wr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ws={exports:{}};ws.exports,function(r,e){(function(){var t,i="4.17.21",n=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",c="Invalid `variable` option passed into `_.template`",h="__lodash_hash_undefined__",d=500,m="__lodash_placeholder__",f=1,g=2,_=4,w=1,b=2,x=1,L=2,M=4,C=8,W=16,D=32,z=64,X=128,I=256,U=512,V=30,G="...",N=800,j=16,Y=1,H=2,Q=3,re=1/0,ne=9007199254740991,le=17976931348623157e292,de=NaN,ge=4294967295,fe=ge-1,Se=ge>>>1,st=[["ary",X],["bind",x],["bindKey",L],["curry",C],["curryRight",W],["flip",U],["partial",D],["partialRight",z],["rearg",I]],ot="[object Arguments]",pt="[object Array]",$e="[object AsyncFunction]",Re="[object Boolean]",je="[object Date]",at="[object DOMException]",Xe="[object Error]",Ft="[object Function]",Rt="[object GeneratorFunction]",Ce="[object Map]",lt="[object Number]",mt="[object Null]",Ct="[object Object]",Cn="[object Promise]",$n="[object Proxy]",Tn="[object RegExp]",Ot="[object Set]",tn="[object String]",nn="[object Symbol]",Gn="[object Undefined]",Wn="[object WeakMap]",La="[object WeakSet]",rn="[object ArrayBuffer]",xi="[object DataView]",zr="[object Float32Array]",Dr="[object Float64Array]",En="[object Int8Array]",Xr="[object Int16Array]",kr="[object Int32Array]",qn="[object Uint8Array]",Zn="[object Uint8ClampedArray]",O="[object Uint16Array]",$="[object Uint32Array]",ce=/\b__p \+= '';/g,Me=/\b(__p \+=) '' \+/g,Ye=/(__e\(.*?\)|\b__t\)) \+\n'';/g,jt=/&(?:amp|lt|gt|quot|#39);/g,ai=/[&<>"']/g,Dh=RegExp(jt.source),Vs=RegExp(ai.source),li=/<%-([\s\S]+?)%>/g,ci=/<%([\s\S]+?)%>/g,sn=/<%=([\s\S]+?)%>/g,Vn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,In=/^\w*$/,er=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Pa=/[\\^$.*+?()[\]{}|]/g,Lw=RegExp(Pa.source),Ca=/^\s+/,Pw=/\s/,Cw=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Tw=/\{\n\/\* \[wrapped with (.+)\] \*/,Gw=/,? & /,Ww=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Zw=/[()=,{}\[\]\/\s]/,Vw=/\\(\\)?/g,Iw=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Xh=/\w*$/,Aw=/^[-+]0x[0-9a-f]+$/i,Fw=/^0b[01]+$/i,Ow=/^\[object .+?Constructor\]$/,zw=/^0o[0-7]+$/i,Dw=/^(?:0|[1-9]\d*)$/,Xw=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Is=/($^)/,kw=/['\n\r\u2028\u2029\\]/g,As="\\ud800-\\udfff",Uw="\\u0300-\\u036f",Nw="\\ufe20-\\ufe2f",Kw="\\u20d0-\\u20ff",kh=Uw+Nw+Kw,Uh="\\u2700-\\u27bf",Nh="a-z\\xdf-\\xf6\\xf8-\\xff",Bw="\\xac\\xb1\\xd7\\xf7",Yw="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Rw="\\u2000-\\u206f",jw=" \\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",Kh="A-Z\\xc0-\\xd6\\xd8-\\xde",Bh="\\ufe0e\\ufe0f",Yh=Bw+Yw+Rw+jw,Ta="['’]",Jw="["+As+"]",Rh="["+Yh+"]",Fs="["+kh+"]",jh="\\d+",Qw="["+Uh+"]",Jh="["+Nh+"]",Qh="[^"+As+Yh+jh+Uh+Nh+Kh+"]",Ga="\\ud83c[\\udffb-\\udfff]",Hw="(?:"+Fs+"|"+Ga+")",Hh="[^"+As+"]",Wa="(?:\\ud83c[\\udde6-\\uddff]){2}",Za="[\\ud800-\\udbff][\\udc00-\\udfff]",tr="["+Kh+"]",$h="\\u200d",Eh="(?:"+Jh+"|"+Qh+")",$w="(?:"+tr+"|"+Qh+")",qh="(?:"+Ta+"(?:d|ll|m|re|s|t|ve))?",eu="(?:"+Ta+"(?:D|LL|M|RE|S|T|VE))?",tu=Hw+"?",iu="["+Bh+"]?",Ew="(?:"+$h+"(?:"+[Hh,Wa,Za].join("|")+")"+iu+tu+")*",qw="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",eb="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",nu=iu+tu+Ew,tb="(?:"+[Qw,Wa,Za].join("|")+")"+nu,ib="(?:"+[Hh+Fs+"?",Fs,Wa,Za,Jw].join("|")+")",nb=RegExp(Ta,"g"),rb=RegExp(Fs,"g"),Va=RegExp(Ga+"(?="+Ga+")|"+ib+nu,"g"),sb=RegExp([tr+"?"+Jh+"+"+qh+"(?="+[Rh,tr,"$"].join("|")+")",$w+"+"+eu+"(?="+[Rh,tr+Eh,"$"].join("|")+")",tr+"?"+Eh+"+"+qh,tr+"+"+eu,eb,qw,jh,tb].join("|"),"g"),ob=RegExp("["+$h+As+kh+Bh+"]"),ab=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,lb=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","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:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"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"},ub={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},db={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},fb={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},pb=parseFloat,mb=parseInt,ru=typeof Wr=="object"&&Wr&&Wr.Object===Object&&Wr,gb=typeof self=="object"&&self&&self.Object===Object&&self,ct=ru||gb||Function("return this")(),Ia=e&&!e.nodeType&&e,An=Ia&&!0&&r&&!r.nodeType&&r,su=An&&An.exports===Ia,Aa=su&&ru.process,Jt=function(){try{var A=An&&An.require&&An.require("util").types;return A||Aa&&Aa.binding&&Aa.binding("util")}catch{}}(),ou=Jt&&Jt.isArrayBuffer,au=Jt&&Jt.isDate,lu=Jt&&Jt.isMap,cu=Jt&&Jt.isRegExp,hu=Jt&&Jt.isSet,uu=Jt&&Jt.isTypedArray;function zt(A,K,k){switch(k.length){case 0:return A.call(K);case 1:return A.call(K,k[0]);case 2:return A.call(K,k[0],k[1]);case 3:return A.call(K,k[0],k[1],k[2])}return A.apply(K,k)}function yb(A,K,k,ee){for(var he=-1,Le=A==null?0:A.length;++he<Le;){var Je=A[he];K(ee,Je,k(Je),A)}return ee}function Qt(A,K){for(var k=-1,ee=A==null?0:A.length;++k<ee&&K(A[k],k,A)!==!1;);return A}function _b(A,K){for(var k=A==null?0:A.length;k--&&K(A[k],k,A)!==!1;);return A}function du(A,K){for(var k=-1,ee=A==null?0:A.length;++k<ee;)if(!K(A[k],k,A))return!1;return!0}function on(A,K){for(var k=-1,ee=A==null?0:A.length,he=0,Le=[];++k<ee;){var Je=A[k];K(Je,k,A)&&(Le[he++]=Je)}return Le}function Os(A,K){var k=A==null?0:A.length;return!!k&&ir(A,K,0)>-1}function Fa(A,K,k){for(var ee=-1,he=A==null?0:A.length;++ee<he;)if(k(K,A[ee]))return!0;return!1}function Fe(A,K){for(var k=-1,ee=A==null?0:A.length,he=Array(ee);++k<ee;)he[k]=K(A[k],k,A);return he}function an(A,K){for(var k=-1,ee=K.length,he=A.length;++k<ee;)A[he+k]=K[k];return A}function Oa(A,K,k,ee){var he=-1,Le=A==null?0:A.length;for(ee&&Le&&(k=A[++he]);++he<Le;)k=K(k,A[he],he,A);return k}function vb(A,K,k,ee){var he=A==null?0:A.length;for(ee&&he&&(k=A[--he]);he--;)k=K(k,A[he],he,A);return k}function za(A,K){for(var k=-1,ee=A==null?0:A.length;++k<ee;)if(K(A[k],k,A))return!0;return!1}var wb=Da("length");function bb(A){return A.split("")}function xb(A){return A.match(Ww)||[]}function fu(A,K,k){var ee;return k(A,function(he,Le,Je){if(K(he,Le,Je))return ee=Le,!1}),ee}function zs(A,K,k,ee){for(var he=A.length,Le=k+(ee?1:-1);ee?Le--:++Le<he;)if(K(A[Le],Le,A))return Le;return-1}function ir(A,K,k){return K===K?Ab(A,K,k):zs(A,pu,k)}function Mb(A,K,k,ee){for(var he=k-1,Le=A.length;++he<Le;)if(ee(A[he],K))return he;return-1}function pu(A){return A!==A}function mu(A,K){var k=A==null?0:A.length;return k?ka(A,K)/k:de}function Da(A){return function(K){return K==null?t:K[A]}}function Xa(A){return function(K){return A==null?t:A[K]}}function gu(A,K,k,ee,he){return he(A,function(Le,Je,Ge){k=ee?(ee=!1,Le):K(k,Le,Je,Ge)}),k}function Sb(A,K){var k=A.length;for(A.sort(K);k--;)A[k]=A[k].value;return A}function ka(A,K){for(var k,ee=-1,he=A.length;++ee<he;){var Le=K(A[ee]);Le!==t&&(k=k===t?Le:k+Le)}return k}function Ua(A,K){for(var k=-1,ee=Array(A);++k<A;)ee[k]=K(k);return ee}function Lb(A,K){return Fe(K,function(k){return[k,A[k]]})}function yu(A){return A&&A.slice(0,bu(A)+1).replace(Ca,"")}function Dt(A){return function(K){return A(K)}}function Na(A,K){return Fe(K,function(k){return A[k]})}function Ur(A,K){return A.has(K)}function _u(A,K){for(var k=-1,ee=A.length;++k<ee&&ir(K,A[k],0)>-1;);return k}function vu(A,K){for(var k=A.length;k--&&ir(K,A[k],0)>-1;);return k}function Pb(A,K){for(var k=A.length,ee=0;k--;)A[k]===K&&++ee;return ee}var Cb=Xa(hb),Tb=Xa(ub);function Gb(A){return"\\"+fb[A]}function Wb(A,K){return A==null?t:A[K]}function nr(A){return ob.test(A)}function Zb(A){return ab.test(A)}function Vb(A){for(var K,k=[];!(K=A.next()).done;)k.push(K.value);return k}function Ka(A){var K=-1,k=Array(A.size);return A.forEach(function(ee,he){k[++K]=[he,ee]}),k}function wu(A,K){return function(k){return A(K(k))}}function ln(A,K){for(var k=-1,ee=A.length,he=0,Le=[];++k<ee;){var Je=A[k];(Je===K||Je===m)&&(A[k]=m,Le[he++]=k)}return Le}function Ds(A){var K=-1,k=Array(A.size);return A.forEach(function(ee){k[++K]=ee}),k}function Ib(A){var K=-1,k=Array(A.size);return A.forEach(function(ee){k[++K]=[ee,ee]}),k}function Ab(A,K,k){for(var ee=k-1,he=A.length;++ee<he;)if(A[ee]===K)return ee;return-1}function Fb(A,K,k){for(var ee=k+1;ee--;)if(A[ee]===K)return ee;return ee}function rr(A){return nr(A)?zb(A):wb(A)}function hi(A){return nr(A)?Db(A):bb(A)}function bu(A){for(var K=A.length;K--&&Pw.test(A.charAt(K)););return K}var Ob=Xa(db);function zb(A){for(var K=Va.lastIndex=0;Va.test(A);)++K;return K}function Db(A){return A.match(Va)||[]}function Xb(A){return A.match(sb)||[]}var kb=function A(K){K=K==null?ct:sr.defaults(ct.Object(),K,sr.pick(ct,lb));var k=K.Array,ee=K.Date,he=K.Error,Le=K.Function,Je=K.Math,Ge=K.Object,Ba=K.RegExp,Ub=K.String,Ht=K.TypeError,Xs=k.prototype,Nb=Le.prototype,or=Ge.prototype,ks=K["__core-js_shared__"],Us=Nb.toString,Te=or.hasOwnProperty,Kb=0,xu=function(){var o=/[^.]+$/.exec(ks&&ks.keys&&ks.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""}(),Ns=or.toString,Bb=Us.call(Ge),Yb=ct._,Rb=Ba("^"+Us.call(Te).replace(Pa,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ks=su?K.Buffer:t,cn=K.Symbol,Bs=K.Uint8Array,Mu=Ks?Ks.allocUnsafe:t,Ys=wu(Ge.getPrototypeOf,Ge),Su=Ge.create,Lu=or.propertyIsEnumerable,Rs=Xs.splice,Pu=cn?cn.isConcatSpreadable:t,Nr=cn?cn.iterator:t,Fn=cn?cn.toStringTag:t,js=function(){try{var o=kn(Ge,"defineProperty");return o({},"",{}),o}catch{}}(),jb=K.clearTimeout!==ct.clearTimeout&&K.clearTimeout,Jb=ee&&ee.now!==ct.Date.now&&ee.now,Qb=K.setTimeout!==ct.setTimeout&&K.setTimeout,Js=Je.ceil,Qs=Je.floor,Ya=Ge.getOwnPropertySymbols,Hb=Ks?Ks.isBuffer:t,Cu=K.isFinite,$b=Xs.join,Eb=wu(Ge.keys,Ge),Qe=Je.max,gt=Je.min,qb=ee.now,e1=K.parseInt,Tu=Je.random,t1=Xs.reverse,Ra=kn(K,"DataView"),Kr=kn(K,"Map"),ja=kn(K,"Promise"),ar=kn(K,"Set"),Br=kn(K,"WeakMap"),Yr=kn(Ge,"create"),Hs=Br&&new Br,lr={},i1=Un(Ra),n1=Un(Kr),r1=Un(ja),s1=Un(ar),o1=Un(Br),$s=cn?cn.prototype:t,Rr=$s?$s.valueOf:t,Gu=$s?$s.toString:t;function S(o){if(ke(o)&&!ue(o)&&!(o instanceof be)){if(o instanceof $t)return o;if(Te.call(o,"__wrapped__"))return Wd(o)}return new $t(o)}var cr=function(){function o(){}return function(l){if(!Oe(l))return{};if(Su)return Su(l);o.prototype=l;var u=new o;return o.prototype=t,u}}();function Es(){}function $t(o,l){this.__wrapped__=o,this.__actions__=[],this.__chain__=!!l,this.__index__=0,this.__values__=t}S.templateSettings={escape:li,evaluate:ci,interpolate:sn,variable:"",imports:{_:S}},S.prototype=Es.prototype,S.prototype.constructor=S,$t.prototype=cr(Es.prototype),$t.prototype.constructor=$t;function be(o){this.__wrapped__=o,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=ge,this.__views__=[]}function a1(){var o=new be(this.__wrapped__);return o.__actions__=Tt(this.__actions__),o.__dir__=this.__dir__,o.__filtered__=this.__filtered__,o.__iteratees__=Tt(this.__iteratees__),o.__takeCount__=this.__takeCount__,o.__views__=Tt(this.__views__),o}function l1(){if(this.__filtered__){var o=new be(this);o.__dir__=-1,o.__filtered__=!0}else o=this.clone(),o.__dir__*=-1;return o}function c1(){var o=this.__wrapped__.value(),l=this.__dir__,u=ue(o),y=l<0,v=u?o.length:0,P=bx(0,v,this.__views__),T=P.start,Z=P.end,F=Z-T,B=y?Z:T-1,R=this.__iteratees__,J=R.length,E=0,te=gt(F,this.__takeCount__);if(!u||!y&&v==F&&te==F)return qu(o,this.__actions__);var oe=[];e:for(;F--&&E<te;){B+=l;for(var me=-1,ae=o[B];++me<J;){var we=R[me],xe=we.iteratee,Ut=we.type,xt=xe(ae);if(Ut==H)ae=xt;else if(!xt){if(Ut==Y)continue e;break e}}oe[E++]=ae}return oe}be.prototype=cr(Es.prototype),be.prototype.constructor=be;function On(o){var l=-1,u=o==null?0:o.length;for(this.clear();++l<u;){var y=o[l];this.set(y[0],y[1])}}function h1(){this.__data__=Yr?Yr(null):{},this.size=0}function u1(o){var l=this.has(o)&&delete this.__data__[o];return this.size-=l?1:0,l}function d1(o){var l=this.__data__;if(Yr){var u=l[o];return u===h?t:u}return Te.call(l,o)?l[o]:t}function f1(o){var l=this.__data__;return Yr?l[o]!==t:Te.call(l,o)}function p1(o,l){var u=this.__data__;return this.size+=this.has(o)?0:1,u[o]=Yr&&l===t?h:l,this}On.prototype.clear=h1,On.prototype.delete=u1,On.prototype.get=d1,On.prototype.has=f1,On.prototype.set=p1;function Wi(o){var l=-1,u=o==null?0:o.length;for(this.clear();++l<u;){var y=o[l];this.set(y[0],y[1])}}function m1(){this.__data__=[],this.size=0}function g1(o){var l=this.__data__,u=qs(l,o);if(u<0)return!1;var y=l.length-1;return u==y?l.pop():Rs.call(l,u,1),--this.size,!0}function y1(o){var l=this.__data__,u=qs(l,o);return u<0?t:l[u][1]}function _1(o){return qs(this.__data__,o)>-1}function v1(o,l){var u=this.__data__,y=qs(u,o);return y<0?(++this.size,u.push([o,l])):u[y][1]=l,this}Wi.prototype.clear=m1,Wi.prototype.delete=g1,Wi.prototype.get=y1,Wi.prototype.has=_1,Wi.prototype.set=v1;function Zi(o){var l=-1,u=o==null?0:o.length;for(this.clear();++l<u;){var y=o[l];this.set(y[0],y[1])}}function w1(){this.size=0,this.__data__={hash:new On,map:new(Kr||Wi),string:new On}}function b1(o){var l=uo(this,o).delete(o);return this.size-=l?1:0,l}function x1(o){return uo(this,o).get(o)}function M1(o){return uo(this,o).has(o)}function S1(o,l){var u=uo(this,o),y=u.size;return u.set(o,l),this.size+=u.size==y?0:1,this}Zi.prototype.clear=w1,Zi.prototype.delete=b1,Zi.prototype.get=x1,Zi.prototype.has=M1,Zi.prototype.set=S1;function zn(o){var l=-1,u=o==null?0:o.length;for(this.__data__=new Zi;++l<u;)this.add(o[l])}function L1(o){return this.__data__.set(o,h),this}function P1(o){return this.__data__.has(o)}zn.prototype.add=zn.prototype.push=L1,zn.prototype.has=P1;function ui(o){var l=this.__data__=new Wi(o);this.size=l.size}function C1(){this.__data__=new Wi,this.size=0}function T1(o){var l=this.__data__,u=l.delete(o);return this.size=l.size,u}function G1(o){return this.__data__.get(o)}function W1(o){return this.__data__.has(o)}function Z1(o,l){var u=this.__data__;if(u instanceof Wi){var y=u.__data__;if(!Kr||y.length<n-1)return y.push([o,l]),this.size=++u.size,this;u=this.__data__=new Zi(y)}return u.set(o,l),this.size=u.size,this}ui.prototype.clear=C1,ui.prototype.delete=T1,ui.prototype.get=G1,ui.prototype.has=W1,ui.prototype.set=Z1;function Wu(o,l){var u=ue(o),y=!u&&Nn(o),v=!u&&!y&&pn(o),P=!u&&!y&&!v&&fr(o),T=u||y||v||P,Z=T?Ua(o.length,Ub):[],F=Z.length;for(var B in o)(l||Te.call(o,B))&&!(T&&(B=="length"||v&&(B=="offset"||B=="parent")||P&&(B=="buffer"||B=="byteLength"||B=="byteOffset")||Fi(B,F)))&&Z.push(B);return Z}function Zu(o){var l=o.length;return l?o[rl(0,l-1)]:t}function V1(o,l){return fo(Tt(o),Dn(l,0,o.length))}function I1(o){return fo(Tt(o))}function Ja(o,l,u){(u!==t&&!di(o[l],u)||u===t&&!(l in o))&&Vi(o,l,u)}function jr(o,l,u){var y=o[l];(!(Te.call(o,l)&&di(y,u))||u===t&&!(l in o))&&Vi(o,l,u)}function qs(o,l){for(var u=o.length;u--;)if(di(o[u][0],l))return u;return-1}function A1(o,l,u,y){return hn(o,function(v,P,T){l(y,v,u(v),T)}),y}function Vu(o,l){return o&&Si(l,Ee(l),o)}function F1(o,l){return o&&Si(l,Wt(l),o)}function Vi(o,l,u){l=="__proto__"&&js?js(o,l,{configurable:!0,enumerable:!0,value:u,writable:!0}):o[l]=u}function Qa(o,l){for(var u=-1,y=l.length,v=k(y),P=o==null;++u<y;)v[u]=P?t:Gl(o,l[u]);return v}function Dn(o,l,u){return o===o&&(u!==t&&(o=o<=u?o:u),l!==t&&(o=o>=l?o:l)),o}function Et(o,l,u,y,v,P){var T,Z=l&f,F=l&g,B=l&_;if(u&&(T=v?u(o,y,v,P):u(o)),T!==t)return T;if(!Oe(o))return o;var R=ue(o);if(R){if(T=Mx(o),!Z)return Tt(o,T)}else{var J=yt(o),E=J==Ft||J==Rt;if(pn(o))return id(o,Z);if(J==Ct||J==ot||E&&!v){if(T=F||E?{}:bd(o),!Z)return F?dx(o,F1(T,o)):ux(o,Vu(T,o))}else{if(!We[J])return v?o:{};T=Sx(o,J,Z)}}P||(P=new ui);var te=P.get(o);if(te)return te;P.set(o,T),Hd(o)?o.forEach(function(ae){T.add(Et(ae,l,u,ae,o,P))}):Jd(o)&&o.forEach(function(ae,we){T.set(we,Et(ae,l,u,we,o,P))});var oe=B?F?ml:pl:F?Wt:Ee,me=R?t:oe(o);return Qt(me||o,function(ae,we){me&&(we=ae,ae=o[we]),jr(T,we,Et(ae,l,u,we,o,P))}),T}function O1(o){var l=Ee(o);return function(u){return Iu(u,o,l)}}function Iu(o,l,u){var y=u.length;if(o==null)return!y;for(o=Ge(o);y--;){var v=u[y],P=l[v],T=o[v];if(T===t&&!(v in o)||!P(T))return!1}return!0}function Au(o,l,u){if(typeof o!="function")throw new Ht(a);return es(function(){o.apply(t,u)},l)}function Jr(o,l,u,y){var v=-1,P=Os,T=!0,Z=o.length,F=[],B=l.length;if(!Z)return F;u&&(l=Fe(l,Dt(u))),y?(P=Fa,T=!1):l.length>=n&&(P=Ur,T=!1,l=new zn(l));e:for(;++v<Z;){var R=o[v],J=u==null?R:u(R);if(R=y||R!==0?R:0,T&&J===J){for(var E=B;E--;)if(l[E]===J)continue e;F.push(R)}else P(l,J,y)||F.push(R)}return F}var hn=ad(Mi),Fu=ad($a,!0);function z1(o,l){var u=!0;return hn(o,function(y,v,P){return u=!!l(y,v,P),u}),u}function eo(o,l,u){for(var y=-1,v=o.length;++y<v;){var P=o[y],T=l(P);if(T!=null&&(Z===t?T===T&&!kt(T):u(T,Z)))var Z=T,F=P}return F}function D1(o,l,u,y){var v=o.length;for(u=pe(u),u<0&&(u=-u>v?0:v+u),y=y===t||y>v?v:pe(y),y<0&&(y+=v),y=u>y?0:Ed(y);u<y;)o[u++]=l;return o}function Ou(o,l){var u=[];return hn(o,function(y,v,P){l(y,v,P)&&u.push(y)}),u}function ht(o,l,u,y,v){var P=-1,T=o.length;for(u||(u=Px),v||(v=[]);++P<T;){var Z=o[P];l>0&&u(Z)?l>1?ht(Z,l-1,u,y,v):an(v,Z):y||(v[v.length]=Z)}return v}var Ha=ld(),zu=ld(!0);function Mi(o,l){return o&&Ha(o,l,Ee)}function $a(o,l){return o&&zu(o,l,Ee)}function to(o,l){return on(l,function(u){return Oi(o[u])})}function Xn(o,l){l=dn(l,o);for(var u=0,y=l.length;o!=null&&u<y;)o=o[Li(l[u++])];return u&&u==y?o:t}function Du(o,l,u){var y=l(o);return ue(o)?y:an(y,u(o))}function wt(o){return o==null?o===t?Gn:mt:Fn&&Fn in Ge(o)?wx(o):Ix(o)}function Ea(o,l){return o>l}function X1(o,l){return o!=null&&Te.call(o,l)}function k1(o,l){return o!=null&&l in Ge(o)}function U1(o,l,u){return o>=gt(l,u)&&o<Qe(l,u)}function qa(o,l,u){for(var y=u?Fa:Os,v=o[0].length,P=o.length,T=P,Z=k(P),F=1/0,B=[];T--;){var R=o[T];T&&l&&(R=Fe(R,Dt(l))),F=gt(R.length,F),Z[T]=!u&&(l||v>=120&&R.length>=120)?new zn(T&&R):t}R=o[0];var J=-1,E=Z[0];e:for(;++J<v&&B.length<F;){var te=R[J],oe=l?l(te):te;if(te=u||te!==0?te:0,!(E?Ur(E,oe):y(B,oe,u))){for(T=P;--T;){var me=Z[T];if(!(me?Ur(me,oe):y(o[T],oe,u)))continue e}E&&E.push(oe),B.push(te)}}return B}function N1(o,l,u,y){return Mi(o,function(v,P,T){l(y,u(v),P,T)}),y}function Qr(o,l,u){l=dn(l,o),o=Ld(o,l);var y=o==null?o:o[Li(ei(l))];return y==null?t:zt(y,o,u)}function Xu(o){return ke(o)&&wt(o)==ot}function K1(o){return ke(o)&&wt(o)==rn}function B1(o){return ke(o)&&wt(o)==je}function Hr(o,l,u,y,v){return o===l?!0:o==null||l==null||!ke(o)&&!ke(l)?o!==o&&l!==l:Y1(o,l,u,y,Hr,v)}function Y1(o,l,u,y,v,P){var T=ue(o),Z=ue(l),F=T?pt:yt(o),B=Z?pt:yt(l);F=F==ot?Ct:F,B=B==ot?Ct:B;var R=F==Ct,J=B==Ct,E=F==B;if(E&&pn(o)){if(!pn(l))return!1;T=!0,R=!1}if(E&&!R)return P||(P=new ui),T||fr(o)?_d(o,l,u,y,v,P):_x(o,l,F,u,y,v,P);if(!(u&w)){var te=R&&Te.call(o,"__wrapped__"),oe=J&&Te.call(l,"__wrapped__");if(te||oe){var me=te?o.value():o,ae=oe?l.value():l;return P||(P=new ui),v(me,ae,u,y,P)}}return E?(P||(P=new ui),vx(o,l,u,y,v,P)):!1}function R1(o){return ke(o)&&yt(o)==Ce}function el(o,l,u,y){var v=u.length,P=v,T=!y;if(o==null)return!P;for(o=Ge(o);v--;){var Z=u[v];if(T&&Z[2]?Z[1]!==o[Z[0]]:!(Z[0]in o))return!1}for(;++v<P;){Z=u[v];var F=Z[0],B=o[F],R=Z[1];if(T&&Z[2]){if(B===t&&!(F in o))return!1}else{var J=new ui;if(y)var E=y(B,R,F,o,l,J);if(!(E===t?Hr(R,B,w|b,y,J):E))return!1}}return!0}function ku(o){if(!Oe(o)||Tx(o))return!1;var l=Oi(o)?Rb:Ow;return l.test(Un(o))}function j1(o){return ke(o)&&wt(o)==Tn}function J1(o){return ke(o)&&yt(o)==Ot}function Q1(o){return ke(o)&&vo(o.length)&&!!Ae[wt(o)]}function Uu(o){return typeof o=="function"?o:o==null?Zt:typeof o=="object"?ue(o)?Bu(o[0],o[1]):Ku(o):hf(o)}function tl(o){if(!qr(o))return Eb(o);var l=[];for(var u in Ge(o))Te.call(o,u)&&u!="constructor"&&l.push(u);return l}function H1(o){if(!Oe(o))return Vx(o);var l=qr(o),u=[];for(var y in o)y=="constructor"&&(l||!Te.call(o,y))||u.push(y);return u}function il(o,l){return o<l}function Nu(o,l){var u=-1,y=Gt(o)?k(o.length):[];return hn(o,function(v,P,T){y[++u]=l(v,P,T)}),y}function Ku(o){var l=yl(o);return l.length==1&&l[0][2]?Md(l[0][0],l[0][1]):function(u){return u===o||el(u,o,l)}}function Bu(o,l){return vl(o)&&xd(l)?Md(Li(o),l):function(u){var y=Gl(u,o);return y===t&&y===l?Wl(u,o):Hr(l,y,w|b)}}function io(o,l,u,y,v){o!==l&&Ha(l,function(P,T){if(v||(v=new ui),Oe(P))$1(o,l,T,u,io,y,v);else{var Z=y?y(bl(o,T),P,T+"",o,l,v):t;Z===t&&(Z=P),Ja(o,T,Z)}},Wt)}function $1(o,l,u,y,v,P,T){var Z=bl(o,u),F=bl(l,u),B=T.get(F);if(B){Ja(o,u,B);return}var R=P?P(Z,F,u+"",o,l,T):t,J=R===t;if(J){var E=ue(F),te=!E&&pn(F),oe=!E&&!te&&fr(F);R=F,E||te||oe?ue(Z)?R=Z:Ne(Z)?R=Tt(Z):te?(J=!1,R=id(F,!0)):oe?(J=!1,R=nd(F,!0)):R=[]:ts(F)||Nn(F)?(R=Z,Nn(Z)?R=qd(Z):(!Oe(Z)||Oi(Z))&&(R=bd(F))):J=!1}J&&(T.set(F,R),v(R,F,y,P,T),T.delete(F)),Ja(o,u,R)}function Yu(o,l){var u=o.length;if(u)return l+=l<0?u:0,Fi(l,u)?o[l]:t}function Ru(o,l,u){l.length?l=Fe(l,function(P){return ue(P)?function(T){return Xn(T,P.length===1?P[0]:P)}:P}):l=[Zt];var y=-1;l=Fe(l,Dt(se()));var v=Nu(o,function(P,T,Z){var F=Fe(l,function(B){return B(P)});return{criteria:F,index:++y,value:P}});return Sb(v,function(P,T){return hx(P,T,u)})}function E1(o,l){return ju(o,l,function(u,y){return Wl(o,y)})}function ju(o,l,u){for(var y=-1,v=l.length,P={};++y<v;){var T=l[y],Z=Xn(o,T);u(Z,T)&&$r(P,dn(T,o),Z)}return P}function q1(o){return function(l){return Xn(l,o)}}function nl(o,l,u,y){var v=y?Mb:ir,P=-1,T=l.length,Z=o;for(o===l&&(l=Tt(l)),u&&(Z=Fe(o,Dt(u)));++P<T;)for(var F=0,B=l[P],R=u?u(B):B;(F=v(Z,R,F,y))>-1;)Z!==o&&Rs.call(Z,F,1),Rs.call(o,F,1);return o}function Ju(o,l){for(var u=o?l.length:0,y=u-1;u--;){var v=l[u];if(u==y||v!==P){var P=v;Fi(v)?Rs.call(o,v,1):al(o,v)}}return o}function rl(o,l){return o+Qs(Tu()*(l-o+1))}function ex(o,l,u,y){for(var v=-1,P=Qe(Js((l-o)/(u||1)),0),T=k(P);P--;)T[y?P:++v]=o,o+=u;return T}function sl(o,l){var u="";if(!o||l<1||l>ne)return u;do l%2&&(u+=o),l=Qs(l/2),l&&(o+=o);while(l);return u}function ye(o,l){return xl(Sd(o,l,Zt),o+"")}function tx(o){return Zu(pr(o))}function ix(o,l){var u=pr(o);return fo(u,Dn(l,0,u.length))}function $r(o,l,u,y){if(!Oe(o))return o;l=dn(l,o);for(var v=-1,P=l.length,T=P-1,Z=o;Z!=null&&++v<P;){var F=Li(l[v]),B=u;if(F==="__proto__"||F==="constructor"||F==="prototype")return o;if(v!=T){var R=Z[F];B=y?y(R,F,Z):t,B===t&&(B=Oe(R)?R:Fi(l[v+1])?[]:{})}jr(Z,F,B),Z=Z[F]}return o}var Qu=Hs?function(o,l){return Hs.set(o,l),o}:Zt,nx=js?function(o,l){return js(o,"toString",{configurable:!0,enumerable:!1,value:Vl(l),writable:!0})}:Zt;function rx(o){return fo(pr(o))}function qt(o,l,u){var y=-1,v=o.length;l<0&&(l=-l>v?0:v+l),u=u>v?v:u,u<0&&(u+=v),v=l>u?0:u-l>>>0,l>>>=0;for(var P=k(v);++y<v;)P[y]=o[y+l];return P}function sx(o,l){var u;return hn(o,function(y,v,P){return u=l(y,v,P),!u}),!!u}function no(o,l,u){var y=0,v=o==null?y:o.length;if(typeof l=="number"&&l===l&&v<=Se){for(;y<v;){var P=y+v>>>1,T=o[P];T!==null&&!kt(T)&&(u?T<=l:T<l)?y=P+1:v=P}return v}return ol(o,l,Zt,u)}function ol(o,l,u,y){var v=0,P=o==null?0:o.length;if(P===0)return 0;l=u(l);for(var T=l!==l,Z=l===null,F=kt(l),B=l===t;v<P;){var R=Qs((v+P)/2),J=u(o[R]),E=J!==t,te=J===null,oe=J===J,me=kt(J);if(T)var ae=y||oe;else B?ae=oe&&(y||E):Z?ae=oe&&E&&(y||!te):F?ae=oe&&E&&!te&&(y||!me):te||me?ae=!1:ae=y?J<=l:J<l;ae?v=R+1:P=R}return gt(P,fe)}function Hu(o,l){for(var u=-1,y=o.length,v=0,P=[];++u<y;){var T=o[u],Z=l?l(T):T;if(!u||!di(Z,F)){var F=Z;P[v++]=T===0?0:T}}return P}function $u(o){return typeof o=="number"?o:kt(o)?de:+o}function Xt(o){if(typeof o=="string")return o;if(ue(o))return Fe(o,Xt)+"";if(kt(o))return Gu?Gu.call(o):"";var l=o+"";return l=="0"&&1/o==-re?"-0":l}function un(o,l,u){var y=-1,v=Os,P=o.length,T=!0,Z=[],F=Z;if(u)T=!1,v=Fa;else if(P>=n){var B=l?null:gx(o);if(B)return Ds(B);T=!1,v=Ur,F=new zn}else F=l?[]:Z;e:for(;++y<P;){var R=o[y],J=l?l(R):R;if(R=u||R!==0?R:0,T&&J===J){for(var E=F.length;E--;)if(F[E]===J)continue e;l&&F.push(J),Z.push(R)}else v(F,J,u)||(F!==Z&&F.push(J),Z.push(R))}return Z}function al(o,l){return l=dn(l,o),o=Ld(o,l),o==null||delete o[Li(ei(l))]}function Eu(o,l,u,y){return $r(o,l,u(Xn(o,l)),y)}function ro(o,l,u,y){for(var v=o.length,P=y?v:-1;(y?P--:++P<v)&&l(o[P],P,o););return u?qt(o,y?0:P,y?P+1:v):qt(o,y?P+1:0,y?v:P)}function qu(o,l){var u=o;return u instanceof be&&(u=u.value()),Oa(l,function(y,v){return v.func.apply(v.thisArg,an([y],v.args))},u)}function ll(o,l,u){var y=o.length;if(y<2)return y?un(o[0]):[];for(var v=-1,P=k(y);++v<y;)for(var T=o[v],Z=-1;++Z<y;)Z!=v&&(P[v]=Jr(P[v]||T,o[Z],l,u));return un(ht(P,1),l,u)}function ed(o,l,u){for(var y=-1,v=o.length,P=l.length,T={};++y<v;){var Z=y<P?l[y]:t;u(T,o[y],Z)}return T}function cl(o){return Ne(o)?o:[]}function hl(o){return typeof o=="function"?o:Zt}function dn(o,l){return ue(o)?o:vl(o,l)?[o]:Gd(Pe(o))}var ox=ye;function fn(o,l,u){var y=o.length;return u=u===t?y:u,!l&&u>=y?o:qt(o,l,u)}var td=jb||function(o){return ct.clearTimeout(o)};function id(o,l){if(l)return o.slice();var u=o.length,y=Mu?Mu(u):new o.constructor(u);return o.copy(y),y}function ul(o){var l=new o.constructor(o.byteLength);return new Bs(l).set(new Bs(o)),l}function ax(o,l){var u=l?ul(o.buffer):o.buffer;return new o.constructor(u,o.byteOffset,o.byteLength)}function lx(o){var l=new o.constructor(o.source,Xh.exec(o));return l.lastIndex=o.lastIndex,l}function cx(o){return Rr?Ge(Rr.call(o)):{}}function nd(o,l){var u=l?ul(o.buffer):o.buffer;return new o.constructor(u,o.byteOffset,o.length)}function rd(o,l){if(o!==l){var u=o!==t,y=o===null,v=o===o,P=kt(o),T=l!==t,Z=l===null,F=l===l,B=kt(l);if(!Z&&!B&&!P&&o>l||P&&T&&F&&!Z&&!B||y&&T&&F||!u&&F||!v)return 1;if(!y&&!P&&!B&&o<l||B&&u&&v&&!y&&!P||Z&&u&&v||!T&&v||!F)return-1}return 0}function hx(o,l,u){for(var y=-1,v=o.criteria,P=l.criteria,T=v.length,Z=u.length;++y<T;){var F=rd(v[y],P[y]);if(F){if(y>=Z)return F;var B=u[y];return F*(B=="desc"?-1:1)}}return o.index-l.index}function sd(o,l,u,y){for(var v=-1,P=o.length,T=u.length,Z=-1,F=l.length,B=Qe(P-T,0),R=k(F+B),J=!y;++Z<F;)R[Z]=l[Z];for(;++v<T;)(J||v<P)&&(R[u[v]]=o[v]);for(;B--;)R[Z++]=o[v++];return R}function od(o,l,u,y){for(var v=-1,P=o.length,T=-1,Z=u.length,F=-1,B=l.length,R=Qe(P-Z,0),J=k(R+B),E=!y;++v<R;)J[v]=o[v];for(var te=v;++F<B;)J[te+F]=l[F];for(;++T<Z;)(E||v<P)&&(J[te+u[T]]=o[v++]);return J}function Tt(o,l){var u=-1,y=o.length;for(l||(l=k(y));++u<y;)l[u]=o[u];return l}function Si(o,l,u,y){var v=!u;u||(u={});for(var P=-1,T=l.length;++P<T;){var Z=l[P],F=y?y(u[Z],o[Z],Z,u,o):t;F===t&&(F=o[Z]),v?Vi(u,Z,F):jr(u,Z,F)}return u}function ux(o,l){return Si(o,_l(o),l)}function dx(o,l){return Si(o,vd(o),l)}function so(o,l){return function(u,y){var v=ue(u)?yb:A1,P=l?l():{};return v(u,o,se(y,2),P)}}function hr(o){return ye(function(l,u){var y=-1,v=u.length,P=v>1?u[v-1]:t,T=v>2?u[2]:t;for(P=o.length>3&&typeof P=="function"?(v--,P):t,T&&bt(u[0],u[1],T)&&(P=v<3?t:P,v=1),l=Ge(l);++y<v;){var Z=u[y];Z&&o(l,Z,y,P)}return l})}function ad(o,l){return function(u,y){if(u==null)return u;if(!Gt(u))return o(u,y);for(var v=u.length,P=l?v:-1,T=Ge(u);(l?P--:++P<v)&&y(T[P],P,T)!==!1;);return u}}function ld(o){return function(l,u,y){for(var v=-1,P=Ge(l),T=y(l),Z=T.length;Z--;){var F=T[o?Z:++v];if(u(P[F],F,P)===!1)break}return l}}function fx(o,l,u){var y=l&x,v=Er(o);function P(){var T=this&&this!==ct&&this instanceof P?v:o;return T.apply(y?u:this,arguments)}return P}function cd(o){return function(l){l=Pe(l);var u=nr(l)?hi(l):t,y=u?u[0]:l.charAt(0),v=u?fn(u,1).join(""):l.slice(1);return y[o]()+v}}function ur(o){return function(l){return Oa(lf(af(l).replace(nb,"")),o,"")}}function Er(o){return function(){var l=arguments;switch(l.length){case 0:return new o;case 1:return new o(l[0]);case 2:return new o(l[0],l[1]);case 3:return new o(l[0],l[1],l[2]);case 4:return new o(l[0],l[1],l[2],l[3]);case 5:return new o(l[0],l[1],l[2],l[3],l[4]);case 6:return new o(l[0],l[1],l[2],l[3],l[4],l[5]);case 7:return new o(l[0],l[1],l[2],l[3],l[4],l[5],l[6])}var u=cr(o.prototype),y=o.apply(u,l);return Oe(y)?y:u}}function px(o,l,u){var y=Er(o);function v(){for(var P=arguments.length,T=k(P),Z=P,F=dr(v);Z--;)T[Z]=arguments[Z];var B=P<3&&T[0]!==F&&T[P-1]!==F?[]:ln(T,F);if(P-=B.length,P<u)return pd(o,l,oo,v.placeholder,t,T,B,t,t,u-P);var R=this&&this!==ct&&this instanceof v?y:o;return zt(R,this,T)}return v}function hd(o){return function(l,u,y){var v=Ge(l);if(!Gt(l)){var P=se(u,3);l=Ee(l),u=function(Z){return P(v[Z],Z,v)}}var T=o(l,u,y);return T>-1?v[P?l[T]:T]:t}}function ud(o){return Ai(function(l){var u=l.length,y=u,v=$t.prototype.thru;for(o&&l.reverse();y--;){var P=l[y];if(typeof P!="function")throw new Ht(a);if(v&&!T&&ho(P)=="wrapper")var T=new $t([],!0)}for(y=T?y:u;++y<u;){P=l[y];var Z=ho(P),F=Z=="wrapper"?gl(P):t;F&&wl(F[0])&&F[1]==(X|C|D|I)&&!F[4].length&&F[9]==1?T=T[ho(F[0])].apply(T,F[3]):T=P.length==1&&wl(P)?T[Z]():T.thru(P)}return function(){var B=arguments,R=B[0];if(T&&B.length==1&&ue(R))return T.plant(R).value();for(var J=0,E=u?l[J].apply(this,B):R;++J<u;)E=l[J].call(this,E);return E}})}function oo(o,l,u,y,v,P,T,Z,F,B){var R=l&X,J=l&x,E=l&L,te=l&(C|W),oe=l&U,me=E?t:Er(o);function ae(){for(var we=arguments.length,xe=k(we),Ut=we;Ut--;)xe[Ut]=arguments[Ut];if(te)var xt=dr(ae),Nt=Pb(xe,xt);if(y&&(xe=sd(xe,y,v,te)),P&&(xe=od(xe,P,T,te)),we-=Nt,te&&we<B){var Ke=ln(xe,xt);return pd(o,l,oo,ae.placeholder,u,xe,Ke,Z,F,B-we)}var fi=J?u:this,Di=E?fi[o]:o;return we=xe.length,Z?xe=Ax(xe,Z):oe&&we>1&&xe.reverse(),R&&F<we&&(xe.length=F),this&&this!==ct&&this instanceof ae&&(Di=me||Er(Di)),Di.apply(fi,xe)}return ae}function dd(o,l){return function(u,y){return N1(u,o,l(y),{})}}function ao(o,l){return function(u,y){var v;if(u===t&&y===t)return l;if(u!==t&&(v=u),y!==t){if(v===t)return y;typeof u=="string"||typeof y=="string"?(u=Xt(u),y=Xt(y)):(u=$u(u),y=$u(y)),v=o(u,y)}return v}}function dl(o){return Ai(function(l){return l=Fe(l,Dt(se())),ye(function(u){var y=this;return o(l,function(v){return zt(v,y,u)})})})}function lo(o,l){l=l===t?" ":Xt(l);var u=l.length;if(u<2)return u?sl(l,o):l;var y=sl(l,Js(o/rr(l)));return nr(l)?fn(hi(y),0,o).join(""):y.slice(0,o)}function mx(o,l,u,y){var v=l&x,P=Er(o);function T(){for(var Z=-1,F=arguments.length,B=-1,R=y.length,J=k(R+F),E=this&&this!==ct&&this instanceof T?P:o;++B<R;)J[B]=y[B];for(;F--;)J[B++]=arguments[++Z];return zt(E,v?u:this,J)}return T}function fd(o){return function(l,u,y){return y&&typeof y!="number"&&bt(l,u,y)&&(u=y=t),l=zi(l),u===t?(u=l,l=0):u=zi(u),y=y===t?l<u?1:-1:zi(y),ex(l,u,y,o)}}function co(o){return function(l,u){return typeof l=="string"&&typeof u=="string"||(l=ti(l),u=ti(u)),o(l,u)}}function pd(o,l,u,y,v,P,T,Z,F,B){var R=l&C,J=R?T:t,E=R?t:T,te=R?P:t,oe=R?t:P;l|=R?D:z,l&=~(R?z:D),l&M||(l&=-4);var me=[o,l,v,te,J,oe,E,Z,F,B],ae=u.apply(t,me);return wl(o)&&Pd(ae,me),ae.placeholder=y,Cd(ae,o,l)}function fl(o){var l=Je[o];return function(u,y){if(u=ti(u),y=y==null?0:gt(pe(y),292),y&&Cu(u)){var v=(Pe(u)+"e").split("e"),P=l(v[0]+"e"+(+v[1]+y));return v=(Pe(P)+"e").split("e"),+(v[0]+"e"+(+v[1]-y))}return l(u)}}var gx=ar&&1/Ds(new ar([,-0]))[1]==re?function(o){return new ar(o)}:Fl;function md(o){return function(l){var u=yt(l);return u==Ce?Ka(l):u==Ot?Ib(l):Lb(l,o(l))}}function Ii(o,l,u,y,v,P,T,Z){var F=l&L;if(!F&&typeof o!="function")throw new Ht(a);var B=y?y.length:0;if(B||(l&=-97,y=v=t),T=T===t?T:Qe(pe(T),0),Z=Z===t?Z:pe(Z),B-=v?v.length:0,l&z){var R=y,J=v;y=v=t}var E=F?t:gl(o),te=[o,l,u,y,v,R,J,P,T,Z];if(E&&Zx(te,E),o=te[0],l=te[1],u=te[2],y=te[3],v=te[4],Z=te[9]=te[9]===t?F?0:o.length:Qe(te[9]-B,0),!Z&&l&(C|W)&&(l&=-25),!l||l==x)var oe=fx(o,l,u);else l==C||l==W?oe=px(o,l,Z):(l==D||l==(x|D))&&!v.length?oe=mx(o,l,u,y):oe=oo.apply(t,te);var me=E?Qu:Pd;return Cd(me(oe,te),o,l)}function gd(o,l,u,y){return o===t||di(o,or[u])&&!Te.call(y,u)?l:o}function yd(o,l,u,y,v,P){return Oe(o)&&Oe(l)&&(P.set(l,o),io(o,l,t,yd,P),P.delete(l)),o}function yx(o){return ts(o)?t:o}function _d(o,l,u,y,v,P){var T=u&w,Z=o.length,F=l.length;if(Z!=F&&!(T&&F>Z))return!1;var B=P.get(o),R=P.get(l);if(B&&R)return B==l&&R==o;var J=-1,E=!0,te=u&b?new zn:t;for(P.set(o,l),P.set(l,o);++J<Z;){var oe=o[J],me=l[J];if(y)var ae=T?y(me,oe,J,l,o,P):y(oe,me,J,o,l,P);if(ae!==t){if(ae)continue;E=!1;break}if(te){if(!za(l,function(we,xe){if(!Ur(te,xe)&&(oe===we||v(oe,we,u,y,P)))return te.push(xe)})){E=!1;break}}else if(!(oe===me||v(oe,me,u,y,P))){E=!1;break}}return P.delete(o),P.delete(l),E}function _x(o,l,u,y,v,P,T){switch(u){case xi:if(o.byteLength!=l.byteLength||o.byteOffset!=l.byteOffset)return!1;o=o.buffer,l=l.buffer;case rn:return!(o.byteLength!=l.byteLength||!P(new Bs(o),new Bs(l)));case Re:case je:case lt:return di(+o,+l);case Xe:return o.name==l.name&&o.message==l.message;case Tn:case tn:return o==l+"";case Ce:var Z=Ka;case Ot:var F=y&w;if(Z||(Z=Ds),o.size!=l.size&&!F)return!1;var B=T.get(o);if(B)return B==l;y|=b,T.set(o,l);var R=_d(Z(o),Z(l),y,v,P,T);return T.delete(o),R;case nn:if(Rr)return Rr.call(o)==Rr.call(l)}return!1}function vx(o,l,u,y,v,P){var T=u&w,Z=pl(o),F=Z.length,B=pl(l),R=B.length;if(F!=R&&!T)return!1;for(var J=F;J--;){var E=Z[J];if(!(T?E in l:Te.call(l,E)))return!1}var te=P.get(o),oe=P.get(l);if(te&&oe)return te==l&&oe==o;var me=!0;P.set(o,l),P.set(l,o);for(var ae=T;++J<F;){E=Z[J];var we=o[E],xe=l[E];if(y)var Ut=T?y(xe,we,E,l,o,P):y(we,xe,E,o,l,P);if(!(Ut===t?we===xe||v(we,xe,u,y,P):Ut)){me=!1;break}ae||(ae=E=="constructor")}if(me&&!ae){var xt=o.constructor,Nt=l.constructor;xt!=Nt&&"constructor"in o&&"constructor"in l&&!(typeof xt=="function"&&xt instanceof xt&&typeof Nt=="function"&&Nt instanceof Nt)&&(me=!1)}return P.delete(o),P.delete(l),me}function Ai(o){return xl(Sd(o,t,Id),o+"")}function pl(o){return Du(o,Ee,_l)}function ml(o){return Du(o,Wt,vd)}var gl=Hs?function(o){return Hs.get(o)}:Fl;function ho(o){for(var l=o.name+"",u=lr[l],y=Te.call(lr,l)?u.length:0;y--;){var v=u[y],P=v.func;if(P==null||P==o)return v.name}return l}function dr(o){var l=Te.call(S,"placeholder")?S:o;return l.placeholder}function se(){var o=S.iteratee||Il;return o=o===Il?Uu:o,arguments.length?o(arguments[0],arguments[1]):o}function uo(o,l){var u=o.__data__;return Cx(l)?u[typeof l=="string"?"string":"hash"]:u.map}function yl(o){for(var l=Ee(o),u=l.length;u--;){var y=l[u],v=o[y];l[u]=[y,v,xd(v)]}return l}function kn(o,l){var u=Wb(o,l);return ku(u)?u:t}function wx(o){var l=Te.call(o,Fn),u=o[Fn];try{o[Fn]=t;var y=!0}catch{}var v=Ns.call(o);return y&&(l?o[Fn]=u:delete o[Fn]),v}var _l=Ya?function(o){return o==null?[]:(o=Ge(o),on(Ya(o),function(l){return Lu.call(o,l)}))}:Ol,vd=Ya?function(o){for(var l=[];o;)an(l,_l(o)),o=Ys(o);return l}:Ol,yt=wt;(Ra&&yt(new Ra(new ArrayBuffer(1)))!=xi||Kr&&yt(new Kr)!=Ce||ja&&yt(ja.resolve())!=Cn||ar&&yt(new ar)!=Ot||Br&&yt(new Br)!=Wn)&&(yt=function(o){var l=wt(o),u=l==Ct?o.constructor:t,y=u?Un(u):"";if(y)switch(y){case i1:return xi;case n1:return Ce;case r1:return Cn;case s1:return Ot;case o1:return Wn}return l});function bx(o,l,u){for(var y=-1,v=u.length;++y<v;){var P=u[y],T=P.size;switch(P.type){case"drop":o+=T;break;case"dropRight":l-=T;break;case"take":l=gt(l,o+T);break;case"takeRight":o=Qe(o,l-T);break}}return{start:o,end:l}}function xx(o){var l=o.match(Tw);return l?l[1].split(Gw):[]}function wd(o,l,u){l=dn(l,o);for(var y=-1,v=l.length,P=!1;++y<v;){var T=Li(l[y]);if(!(P=o!=null&&u(o,T)))break;o=o[T]}return P||++y!=v?P:(v=o==null?0:o.length,!!v&&vo(v)&&Fi(T,v)&&(ue(o)||Nn(o)))}function Mx(o){var l=o.length,u=new o.constructor(l);return l&&typeof o[0]=="string"&&Te.call(o,"index")&&(u.index=o.index,u.input=o.input),u}function bd(o){return typeof o.constructor=="function"&&!qr(o)?cr(Ys(o)):{}}function Sx(o,l,u){var y=o.constructor;switch(l){case rn:return ul(o);case Re:case je:return new y(+o);case xi:return ax(o,u);case zr:case Dr:case En:case Xr:case kr:case qn:case Zn:case O:case $:return nd(o,u);case Ce:return new y;case lt:case tn:return new y(o);case Tn:return lx(o);case Ot:return new y;case nn:return cx(o)}}function Lx(o,l){var u=l.length;if(!u)return o;var y=u-1;return l[y]=(u>1?"& ":"")+l[y],l=l.join(u>2?", ":" "),o.replace(Cw,`{
976
+ /* [wrapped with `+l+`] */
977
+ `)}function Px(o){return ue(o)||Nn(o)||!!(Pu&&o&&o[Pu])}function Fi(o,l){var u=typeof o;return l=l??ne,!!l&&(u=="number"||u!="symbol"&&Dw.test(o))&&o>-1&&o%1==0&&o<l}function bt(o,l,u){if(!Oe(u))return!1;var y=typeof l;return(y=="number"?Gt(u)&&Fi(l,u.length):y=="string"&&l in u)?di(u[l],o):!1}function vl(o,l){if(ue(o))return!1;var u=typeof o;return u=="number"||u=="symbol"||u=="boolean"||o==null||kt(o)?!0:In.test(o)||!Vn.test(o)||l!=null&&o in Ge(l)}function Cx(o){var l=typeof o;return l=="string"||l=="number"||l=="symbol"||l=="boolean"?o!=="__proto__":o===null}function wl(o){var l=ho(o),u=S[l];if(typeof u!="function"||!(l in be.prototype))return!1;if(o===u)return!0;var y=gl(u);return!!y&&o===y[0]}function Tx(o){return!!xu&&xu in o}var Gx=ks?Oi:zl;function qr(o){var l=o&&o.constructor,u=typeof l=="function"&&l.prototype||or;return o===u}function xd(o){return o===o&&!Oe(o)}function Md(o,l){return function(u){return u==null?!1:u[o]===l&&(l!==t||o in Ge(u))}}function Wx(o){var l=yo(o,function(y){return u.size===d&&u.clear(),y}),u=l.cache;return l}function Zx(o,l){var u=o[1],y=l[1],v=u|y,P=v<(x|L|X),T=y==X&&u==C||y==X&&u==I&&o[7].length<=l[8]||y==(X|I)&&l[7].length<=l[8]&&u==C;if(!(P||T))return o;y&x&&(o[2]=l[2],v|=u&x?0:M);var Z=l[3];if(Z){var F=o[3];o[3]=F?sd(F,Z,l[4]):Z,o[4]=F?ln(o[3],m):l[4]}return Z=l[5],Z&&(F=o[5],o[5]=F?od(F,Z,l[6]):Z,o[6]=F?ln(o[5],m):l[6]),Z=l[7],Z&&(o[7]=Z),y&X&&(o[8]=o[8]==null?l[8]:gt(o[8],l[8])),o[9]==null&&(o[9]=l[9]),o[0]=l[0],o[1]=v,o}function Vx(o){var l=[];if(o!=null)for(var u in Ge(o))l.push(u);return l}function Ix(o){return Ns.call(o)}function Sd(o,l,u){return l=Qe(l===t?o.length-1:l,0),function(){for(var y=arguments,v=-1,P=Qe(y.length-l,0),T=k(P);++v<P;)T[v]=y[l+v];v=-1;for(var Z=k(l+1);++v<l;)Z[v]=y[v];return Z[l]=u(T),zt(o,this,Z)}}function Ld(o,l){return l.length<2?o:Xn(o,qt(l,0,-1))}function Ax(o,l){for(var u=o.length,y=gt(l.length,u),v=Tt(o);y--;){var P=l[y];o[y]=Fi(P,u)?v[P]:t}return o}function bl(o,l){if(!(l==="constructor"&&typeof o[l]=="function")&&l!="__proto__")return o[l]}var Pd=Td(Qu),es=Qb||function(o,l){return ct.setTimeout(o,l)},xl=Td(nx);function Cd(o,l,u){var y=l+"";return xl(o,Lx(y,Fx(xx(y),u)))}function Td(o){var l=0,u=0;return function(){var y=qb(),v=j-(y-u);if(u=y,v>0){if(++l>=N)return arguments[0]}else l=0;return o.apply(t,arguments)}}function fo(o,l){var u=-1,y=o.length,v=y-1;for(l=l===t?y:l;++u<l;){var P=rl(u,v),T=o[P];o[P]=o[u],o[u]=T}return o.length=l,o}var Gd=Wx(function(o){var l=[];return o.charCodeAt(0)===46&&l.push(""),o.replace(er,function(u,y,v,P){l.push(v?P.replace(Vw,"$1"):y||u)}),l});function Li(o){if(typeof o=="string"||kt(o))return o;var l=o+"";return l=="0"&&1/o==-re?"-0":l}function Un(o){if(o!=null){try{return Us.call(o)}catch{}try{return o+""}catch{}}return""}function Fx(o,l){return Qt(st,function(u){var y="_."+u[0];l&u[1]&&!Os(o,y)&&o.push(y)}),o.sort()}function Wd(o){if(o instanceof be)return o.clone();var l=new $t(o.__wrapped__,o.__chain__);return l.__actions__=Tt(o.__actions__),l.__index__=o.__index__,l.__values__=o.__values__,l}function Ox(o,l,u){(u?bt(o,l,u):l===t)?l=1:l=Qe(pe(l),0);var y=o==null?0:o.length;if(!y||l<1)return[];for(var v=0,P=0,T=k(Js(y/l));v<y;)T[P++]=qt(o,v,v+=l);return T}function zx(o){for(var l=-1,u=o==null?0:o.length,y=0,v=[];++l<u;){var P=o[l];P&&(v[y++]=P)}return v}function Dx(){var o=arguments.length;if(!o)return[];for(var l=k(o-1),u=arguments[0],y=o;y--;)l[y-1]=arguments[y];return an(ue(u)?Tt(u):[u],ht(l,1))}var Xx=ye(function(o,l){return Ne(o)?Jr(o,ht(l,1,Ne,!0)):[]}),kx=ye(function(o,l){var u=ei(l);return Ne(u)&&(u=t),Ne(o)?Jr(o,ht(l,1,Ne,!0),se(u,2)):[]}),Ux=ye(function(o,l){var u=ei(l);return Ne(u)&&(u=t),Ne(o)?Jr(o,ht(l,1,Ne,!0),t,u):[]});function Nx(o,l,u){var y=o==null?0:o.length;return y?(l=u||l===t?1:pe(l),qt(o,l<0?0:l,y)):[]}function Kx(o,l,u){var y=o==null?0:o.length;return y?(l=u||l===t?1:pe(l),l=y-l,qt(o,0,l<0?0:l)):[]}function Bx(o,l){return o&&o.length?ro(o,se(l,3),!0,!0):[]}function Yx(o,l){return o&&o.length?ro(o,se(l,3),!0):[]}function Rx(o,l,u,y){var v=o==null?0:o.length;return v?(u&&typeof u!="number"&&bt(o,l,u)&&(u=0,y=v),D1(o,l,u,y)):[]}function Zd(o,l,u){var y=o==null?0:o.length;if(!y)return-1;var v=u==null?0:pe(u);return v<0&&(v=Qe(y+v,0)),zs(o,se(l,3),v)}function Vd(o,l,u){var y=o==null?0:o.length;if(!y)return-1;var v=y-1;return u!==t&&(v=pe(u),v=u<0?Qe(y+v,0):gt(v,y-1)),zs(o,se(l,3),v,!0)}function Id(o){var l=o==null?0:o.length;return l?ht(o,1):[]}function jx(o){var l=o==null?0:o.length;return l?ht(o,re):[]}function Jx(o,l){var u=o==null?0:o.length;return u?(l=l===t?1:pe(l),ht(o,l)):[]}function Qx(o){for(var l=-1,u=o==null?0:o.length,y={};++l<u;){var v=o[l];y[v[0]]=v[1]}return y}function Ad(o){return o&&o.length?o[0]:t}function Hx(o,l,u){var y=o==null?0:o.length;if(!y)return-1;var v=u==null?0:pe(u);return v<0&&(v=Qe(y+v,0)),ir(o,l,v)}function $x(o){var l=o==null?0:o.length;return l?qt(o,0,-1):[]}var Ex=ye(function(o){var l=Fe(o,cl);return l.length&&l[0]===o[0]?qa(l):[]}),qx=ye(function(o){var l=ei(o),u=Fe(o,cl);return l===ei(u)?l=t:u.pop(),u.length&&u[0]===o[0]?qa(u,se(l,2)):[]}),eM=ye(function(o){var l=ei(o),u=Fe(o,cl);return l=typeof l=="function"?l:t,l&&u.pop(),u.length&&u[0]===o[0]?qa(u,t,l):[]});function tM(o,l){return o==null?"":$b.call(o,l)}function ei(o){var l=o==null?0:o.length;return l?o[l-1]:t}function iM(o,l,u){var y=o==null?0:o.length;if(!y)return-1;var v=y;return u!==t&&(v=pe(u),v=v<0?Qe(y+v,0):gt(v,y-1)),l===l?Fb(o,l,v):zs(o,pu,v,!0)}function nM(o,l){return o&&o.length?Yu(o,pe(l)):t}var rM=ye(Fd);function Fd(o,l){return o&&o.length&&l&&l.length?nl(o,l):o}function sM(o,l,u){return o&&o.length&&l&&l.length?nl(o,l,se(u,2)):o}function oM(o,l,u){return o&&o.length&&l&&l.length?nl(o,l,t,u):o}var aM=Ai(function(o,l){var u=o==null?0:o.length,y=Qa(o,l);return Ju(o,Fe(l,function(v){return Fi(v,u)?+v:v}).sort(rd)),y});function lM(o,l){var u=[];if(!(o&&o.length))return u;var y=-1,v=[],P=o.length;for(l=se(l,3);++y<P;){var T=o[y];l(T,y,o)&&(u.push(T),v.push(y))}return Ju(o,v),u}function Ml(o){return o==null?o:t1.call(o)}function cM(o,l,u){var y=o==null?0:o.length;return y?(u&&typeof u!="number"&&bt(o,l,u)?(l=0,u=y):(l=l==null?0:pe(l),u=u===t?y:pe(u)),qt(o,l,u)):[]}function hM(o,l){return no(o,l)}function uM(o,l,u){return ol(o,l,se(u,2))}function dM(o,l){var u=o==null?0:o.length;if(u){var y=no(o,l);if(y<u&&di(o[y],l))return y}return-1}function fM(o,l){return no(o,l,!0)}function pM(o,l,u){return ol(o,l,se(u,2),!0)}function mM(o,l){var u=o==null?0:o.length;if(u){var y=no(o,l,!0)-1;if(di(o[y],l))return y}return-1}function gM(o){return o&&o.length?Hu(o):[]}function yM(o,l){return o&&o.length?Hu(o,se(l,2)):[]}function _M(o){var l=o==null?0:o.length;return l?qt(o,1,l):[]}function vM(o,l,u){return o&&o.length?(l=u||l===t?1:pe(l),qt(o,0,l<0?0:l)):[]}function wM(o,l,u){var y=o==null?0:o.length;return y?(l=u||l===t?1:pe(l),l=y-l,qt(o,l<0?0:l,y)):[]}function bM(o,l){return o&&o.length?ro(o,se(l,3),!1,!0):[]}function xM(o,l){return o&&o.length?ro(o,se(l,3)):[]}var MM=ye(function(o){return un(ht(o,1,Ne,!0))}),SM=ye(function(o){var l=ei(o);return Ne(l)&&(l=t),un(ht(o,1,Ne,!0),se(l,2))}),LM=ye(function(o){var l=ei(o);return l=typeof l=="function"?l:t,un(ht(o,1,Ne,!0),t,l)});function PM(o){return o&&o.length?un(o):[]}function CM(o,l){return o&&o.length?un(o,se(l,2)):[]}function TM(o,l){return l=typeof l=="function"?l:t,o&&o.length?un(o,t,l):[]}function Sl(o){if(!(o&&o.length))return[];var l=0;return o=on(o,function(u){if(Ne(u))return l=Qe(u.length,l),!0}),Ua(l,function(u){return Fe(o,Da(u))})}function Od(o,l){if(!(o&&o.length))return[];var u=Sl(o);return l==null?u:Fe(u,function(y){return zt(l,t,y)})}var GM=ye(function(o,l){return Ne(o)?Jr(o,l):[]}),WM=ye(function(o){return ll(on(o,Ne))}),ZM=ye(function(o){var l=ei(o);return Ne(l)&&(l=t),ll(on(o,Ne),se(l,2))}),VM=ye(function(o){var l=ei(o);return l=typeof l=="function"?l:t,ll(on(o,Ne),t,l)}),IM=ye(Sl);function AM(o,l){return ed(o||[],l||[],jr)}function FM(o,l){return ed(o||[],l||[],$r)}var OM=ye(function(o){var l=o.length,u=l>1?o[l-1]:t;return u=typeof u=="function"?(o.pop(),u):t,Od(o,u)});function zd(o){var l=S(o);return l.__chain__=!0,l}function zM(o,l){return l(o),o}function po(o,l){return l(o)}var DM=Ai(function(o){var l=o.length,u=l?o[0]:0,y=this.__wrapped__,v=function(P){return Qa(P,o)};return l>1||this.__actions__.length||!(y instanceof be)||!Fi(u)?this.thru(v):(y=y.slice(u,+u+(l?1:0)),y.__actions__.push({func:po,args:[v],thisArg:t}),new $t(y,this.__chain__).thru(function(P){return l&&!P.length&&P.push(t),P}))});function XM(){return zd(this)}function kM(){return new $t(this.value(),this.__chain__)}function UM(){this.__values__===t&&(this.__values__=$d(this.value()));var o=this.__index__>=this.__values__.length,l=o?t:this.__values__[this.__index__++];return{done:o,value:l}}function NM(){return this}function KM(o){for(var l,u=this;u instanceof Es;){var y=Wd(u);y.__index__=0,y.__values__=t,l?v.__wrapped__=y:l=y;var v=y;u=u.__wrapped__}return v.__wrapped__=o,l}function BM(){var o=this.__wrapped__;if(o instanceof be){var l=o;return this.__actions__.length&&(l=new be(this)),l=l.reverse(),l.__actions__.push({func:po,args:[Ml],thisArg:t}),new $t(l,this.__chain__)}return this.thru(Ml)}function YM(){return qu(this.__wrapped__,this.__actions__)}var RM=so(function(o,l,u){Te.call(o,u)?++o[u]:Vi(o,u,1)});function jM(o,l,u){var y=ue(o)?du:z1;return u&&bt(o,l,u)&&(l=t),y(o,se(l,3))}function JM(o,l){var u=ue(o)?on:Ou;return u(o,se(l,3))}var QM=hd(Zd),HM=hd(Vd);function $M(o,l){return ht(mo(o,l),1)}function EM(o,l){return ht(mo(o,l),re)}function qM(o,l,u){return u=u===t?1:pe(u),ht(mo(o,l),u)}function Dd(o,l){var u=ue(o)?Qt:hn;return u(o,se(l,3))}function Xd(o,l){var u=ue(o)?_b:Fu;return u(o,se(l,3))}var eS=so(function(o,l,u){Te.call(o,u)?o[u].push(l):Vi(o,u,[l])});function tS(o,l,u,y){o=Gt(o)?o:pr(o),u=u&&!y?pe(u):0;var v=o.length;return u<0&&(u=Qe(v+u,0)),wo(o)?u<=v&&o.indexOf(l,u)>-1:!!v&&ir(o,l,u)>-1}var iS=ye(function(o,l,u){var y=-1,v=typeof l=="function",P=Gt(o)?k(o.length):[];return hn(o,function(T){P[++y]=v?zt(l,T,u):Qr(T,l,u)}),P}),nS=so(function(o,l,u){Vi(o,u,l)});function mo(o,l){var u=ue(o)?Fe:Nu;return u(o,se(l,3))}function rS(o,l,u,y){return o==null?[]:(ue(l)||(l=l==null?[]:[l]),u=y?t:u,ue(u)||(u=u==null?[]:[u]),Ru(o,l,u))}var sS=so(function(o,l,u){o[u?0:1].push(l)},function(){return[[],[]]});function oS(o,l,u){var y=ue(o)?Oa:gu,v=arguments.length<3;return y(o,se(l,4),u,v,hn)}function aS(o,l,u){var y=ue(o)?vb:gu,v=arguments.length<3;return y(o,se(l,4),u,v,Fu)}function lS(o,l){var u=ue(o)?on:Ou;return u(o,_o(se(l,3)))}function cS(o){var l=ue(o)?Zu:tx;return l(o)}function hS(o,l,u){(u?bt(o,l,u):l===t)?l=1:l=pe(l);var y=ue(o)?V1:ix;return y(o,l)}function uS(o){var l=ue(o)?I1:rx;return l(o)}function dS(o){if(o==null)return 0;if(Gt(o))return wo(o)?rr(o):o.length;var l=yt(o);return l==Ce||l==Ot?o.size:tl(o).length}function fS(o,l,u){var y=ue(o)?za:sx;return u&&bt(o,l,u)&&(l=t),y(o,se(l,3))}var pS=ye(function(o,l){if(o==null)return[];var u=l.length;return u>1&&bt(o,l[0],l[1])?l=[]:u>2&&bt(l[0],l[1],l[2])&&(l=[l[0]]),Ru(o,ht(l,1),[])}),go=Jb||function(){return ct.Date.now()};function mS(o,l){if(typeof l!="function")throw new Ht(a);return o=pe(o),function(){if(--o<1)return l.apply(this,arguments)}}function kd(o,l,u){return l=u?t:l,l=o&&l==null?o.length:l,Ii(o,X,t,t,t,t,l)}function Ud(o,l){var u;if(typeof l!="function")throw new Ht(a);return o=pe(o),function(){return--o>0&&(u=l.apply(this,arguments)),o<=1&&(l=t),u}}var Ll=ye(function(o,l,u){var y=x;if(u.length){var v=ln(u,dr(Ll));y|=D}return Ii(o,y,l,u,v)}),Nd=ye(function(o,l,u){var y=x|L;if(u.length){var v=ln(u,dr(Nd));y|=D}return Ii(l,y,o,u,v)});function Kd(o,l,u){l=u?t:l;var y=Ii(o,C,t,t,t,t,t,l);return y.placeholder=Kd.placeholder,y}function Bd(o,l,u){l=u?t:l;var y=Ii(o,W,t,t,t,t,t,l);return y.placeholder=Bd.placeholder,y}function Yd(o,l,u){var y,v,P,T,Z,F,B=0,R=!1,J=!1,E=!0;if(typeof o!="function")throw new Ht(a);l=ti(l)||0,Oe(u)&&(R=!!u.leading,J="maxWait"in u,P=J?Qe(ti(u.maxWait)||0,l):P,E="trailing"in u?!!u.trailing:E);function te(Ke){var fi=y,Di=v;return y=v=t,B=Ke,T=o.apply(Di,fi),T}function oe(Ke){return B=Ke,Z=es(we,l),R?te(Ke):T}function me(Ke){var fi=Ke-F,Di=Ke-B,uf=l-fi;return J?gt(uf,P-Di):uf}function ae(Ke){var fi=Ke-F,Di=Ke-B;return F===t||fi>=l||fi<0||J&&Di>=P}function we(){var Ke=go();if(ae(Ke))return xe(Ke);Z=es(we,me(Ke))}function xe(Ke){return Z=t,E&&y?te(Ke):(y=v=t,T)}function Ut(){Z!==t&&td(Z),B=0,y=F=v=Z=t}function xt(){return Z===t?T:xe(go())}function Nt(){var Ke=go(),fi=ae(Ke);if(y=arguments,v=this,F=Ke,fi){if(Z===t)return oe(F);if(J)return td(Z),Z=es(we,l),te(F)}return Z===t&&(Z=es(we,l)),T}return Nt.cancel=Ut,Nt.flush=xt,Nt}var gS=ye(function(o,l){return Au(o,1,l)}),yS=ye(function(o,l,u){return Au(o,ti(l)||0,u)});function _S(o){return Ii(o,U)}function yo(o,l){if(typeof o!="function"||l!=null&&typeof l!="function")throw new Ht(a);var u=function(){var y=arguments,v=l?l.apply(this,y):y[0],P=u.cache;if(P.has(v))return P.get(v);var T=o.apply(this,y);return u.cache=P.set(v,T)||P,T};return u.cache=new(yo.Cache||Zi),u}yo.Cache=Zi;function _o(o){if(typeof o!="function")throw new Ht(a);return function(){var l=arguments;switch(l.length){case 0:return!o.call(this);case 1:return!o.call(this,l[0]);case 2:return!o.call(this,l[0],l[1]);case 3:return!o.call(this,l[0],l[1],l[2])}return!o.apply(this,l)}}function vS(o){return Ud(2,o)}var wS=ox(function(o,l){l=l.length==1&&ue(l[0])?Fe(l[0],Dt(se())):Fe(ht(l,1),Dt(se()));var u=l.length;return ye(function(y){for(var v=-1,P=gt(y.length,u);++v<P;)y[v]=l[v].call(this,y[v]);return zt(o,this,y)})}),Pl=ye(function(o,l){var u=ln(l,dr(Pl));return Ii(o,D,t,l,u)}),Rd=ye(function(o,l){var u=ln(l,dr(Rd));return Ii(o,z,t,l,u)}),bS=Ai(function(o,l){return Ii(o,I,t,t,t,l)});function xS(o,l){if(typeof o!="function")throw new Ht(a);return l=l===t?l:pe(l),ye(o,l)}function MS(o,l){if(typeof o!="function")throw new Ht(a);return l=l==null?0:Qe(pe(l),0),ye(function(u){var y=u[l],v=fn(u,0,l);return y&&an(v,y),zt(o,this,v)})}function SS(o,l,u){var y=!0,v=!0;if(typeof o!="function")throw new Ht(a);return Oe(u)&&(y="leading"in u?!!u.leading:y,v="trailing"in u?!!u.trailing:v),Yd(o,l,{leading:y,maxWait:l,trailing:v})}function LS(o){return kd(o,1)}function PS(o,l){return Pl(hl(l),o)}function CS(){if(!arguments.length)return[];var o=arguments[0];return ue(o)?o:[o]}function TS(o){return Et(o,_)}function GS(o,l){return l=typeof l=="function"?l:t,Et(o,_,l)}function WS(o){return Et(o,f|_)}function ZS(o,l){return l=typeof l=="function"?l:t,Et(o,f|_,l)}function VS(o,l){return l==null||Iu(o,l,Ee(l))}function di(o,l){return o===l||o!==o&&l!==l}var IS=co(Ea),AS=co(function(o,l){return o>=l}),Nn=Xu(function(){return arguments}())?Xu:function(o){return ke(o)&&Te.call(o,"callee")&&!Lu.call(o,"callee")},ue=k.isArray,FS=ou?Dt(ou):K1;function Gt(o){return o!=null&&vo(o.length)&&!Oi(o)}function Ne(o){return ke(o)&&Gt(o)}function OS(o){return o===!0||o===!1||ke(o)&&wt(o)==Re}var pn=Hb||zl,zS=au?Dt(au):B1;function DS(o){return ke(o)&&o.nodeType===1&&!ts(o)}function XS(o){if(o==null)return!0;if(Gt(o)&&(ue(o)||typeof o=="string"||typeof o.splice=="function"||pn(o)||fr(o)||Nn(o)))return!o.length;var l=yt(o);if(l==Ce||l==Ot)return!o.size;if(qr(o))return!tl(o).length;for(var u in o)if(Te.call(o,u))return!1;return!0}function kS(o,l){return Hr(o,l)}function US(o,l,u){u=typeof u=="function"?u:t;var y=u?u(o,l):t;return y===t?Hr(o,l,t,u):!!y}function Cl(o){if(!ke(o))return!1;var l=wt(o);return l==Xe||l==at||typeof o.message=="string"&&typeof o.name=="string"&&!ts(o)}function NS(o){return typeof o=="number"&&Cu(o)}function Oi(o){if(!Oe(o))return!1;var l=wt(o);return l==Ft||l==Rt||l==$e||l==$n}function jd(o){return typeof o=="number"&&o==pe(o)}function vo(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=ne}function Oe(o){var l=typeof o;return o!=null&&(l=="object"||l=="function")}function ke(o){return o!=null&&typeof o=="object"}var Jd=lu?Dt(lu):R1;function KS(o,l){return o===l||el(o,l,yl(l))}function BS(o,l,u){return u=typeof u=="function"?u:t,el(o,l,yl(l),u)}function YS(o){return Qd(o)&&o!=+o}function RS(o){if(Gx(o))throw new he(s);return ku(o)}function jS(o){return o===null}function JS(o){return o==null}function Qd(o){return typeof o=="number"||ke(o)&&wt(o)==lt}function ts(o){if(!ke(o)||wt(o)!=Ct)return!1;var l=Ys(o);if(l===null)return!0;var u=Te.call(l,"constructor")&&l.constructor;return typeof u=="function"&&u instanceof u&&Us.call(u)==Bb}var Tl=cu?Dt(cu):j1;function QS(o){return jd(o)&&o>=-ne&&o<=ne}var Hd=hu?Dt(hu):J1;function wo(o){return typeof o=="string"||!ue(o)&&ke(o)&&wt(o)==tn}function kt(o){return typeof o=="symbol"||ke(o)&&wt(o)==nn}var fr=uu?Dt(uu):Q1;function HS(o){return o===t}function $S(o){return ke(o)&&yt(o)==Wn}function ES(o){return ke(o)&&wt(o)==La}var qS=co(il),e2=co(function(o,l){return o<=l});function $d(o){if(!o)return[];if(Gt(o))return wo(o)?hi(o):Tt(o);if(Nr&&o[Nr])return Vb(o[Nr]());var l=yt(o),u=l==Ce?Ka:l==Ot?Ds:pr;return u(o)}function zi(o){if(!o)return o===0?o:0;if(o=ti(o),o===re||o===-re){var l=o<0?-1:1;return l*le}return o===o?o:0}function pe(o){var l=zi(o),u=l%1;return l===l?u?l-u:l:0}function Ed(o){return o?Dn(pe(o),0,ge):0}function ti(o){if(typeof o=="number")return o;if(kt(o))return de;if(Oe(o)){var l=typeof o.valueOf=="function"?o.valueOf():o;o=Oe(l)?l+"":l}if(typeof o!="string")return o===0?o:+o;o=yu(o);var u=Fw.test(o);return u||zw.test(o)?mb(o.slice(2),u?2:8):Aw.test(o)?de:+o}function qd(o){return Si(o,Wt(o))}function t2(o){return o?Dn(pe(o),-ne,ne):o===0?o:0}function Pe(o){return o==null?"":Xt(o)}var i2=hr(function(o,l){if(qr(l)||Gt(l)){Si(l,Ee(l),o);return}for(var u in l)Te.call(l,u)&&jr(o,u,l[u])}),ef=hr(function(o,l){Si(l,Wt(l),o)}),bo=hr(function(o,l,u,y){Si(l,Wt(l),o,y)}),n2=hr(function(o,l,u,y){Si(l,Ee(l),o,y)}),r2=Ai(Qa);function s2(o,l){var u=cr(o);return l==null?u:Vu(u,l)}var o2=ye(function(o,l){o=Ge(o);var u=-1,y=l.length,v=y>2?l[2]:t;for(v&&bt(l[0],l[1],v)&&(y=1);++u<y;)for(var P=l[u],T=Wt(P),Z=-1,F=T.length;++Z<F;){var B=T[Z],R=o[B];(R===t||di(R,or[B])&&!Te.call(o,B))&&(o[B]=P[B])}return o}),a2=ye(function(o){return o.push(t,yd),zt(tf,t,o)});function l2(o,l){return fu(o,se(l,3),Mi)}function c2(o,l){return fu(o,se(l,3),$a)}function h2(o,l){return o==null?o:Ha(o,se(l,3),Wt)}function u2(o,l){return o==null?o:zu(o,se(l,3),Wt)}function d2(o,l){return o&&Mi(o,se(l,3))}function f2(o,l){return o&&$a(o,se(l,3))}function p2(o){return o==null?[]:to(o,Ee(o))}function m2(o){return o==null?[]:to(o,Wt(o))}function Gl(o,l,u){var y=o==null?t:Xn(o,l);return y===t?u:y}function g2(o,l){return o!=null&&wd(o,l,X1)}function Wl(o,l){return o!=null&&wd(o,l,k1)}var y2=dd(function(o,l,u){l!=null&&typeof l.toString!="function"&&(l=Ns.call(l)),o[l]=u},Vl(Zt)),_2=dd(function(o,l,u){l!=null&&typeof l.toString!="function"&&(l=Ns.call(l)),Te.call(o,l)?o[l].push(u):o[l]=[u]},se),v2=ye(Qr);function Ee(o){return Gt(o)?Wu(o):tl(o)}function Wt(o){return Gt(o)?Wu(o,!0):H1(o)}function w2(o,l){var u={};return l=se(l,3),Mi(o,function(y,v,P){Vi(u,l(y,v,P),y)}),u}function b2(o,l){var u={};return l=se(l,3),Mi(o,function(y,v,P){Vi(u,v,l(y,v,P))}),u}var x2=hr(function(o,l,u){io(o,l,u)}),tf=hr(function(o,l,u,y){io(o,l,u,y)}),M2=Ai(function(o,l){var u={};if(o==null)return u;var y=!1;l=Fe(l,function(P){return P=dn(P,o),y||(y=P.length>1),P}),Si(o,ml(o),u),y&&(u=Et(u,f|g|_,yx));for(var v=l.length;v--;)al(u,l[v]);return u});function S2(o,l){return nf(o,_o(se(l)))}var L2=Ai(function(o,l){return o==null?{}:E1(o,l)});function nf(o,l){if(o==null)return{};var u=Fe(ml(o),function(y){return[y]});return l=se(l),ju(o,u,function(y,v){return l(y,v[0])})}function P2(o,l,u){l=dn(l,o);var y=-1,v=l.length;for(v||(v=1,o=t);++y<v;){var P=o==null?t:o[Li(l[y])];P===t&&(y=v,P=u),o=Oi(P)?P.call(o):P}return o}function C2(o,l,u){return o==null?o:$r(o,l,u)}function T2(o,l,u,y){return y=typeof y=="function"?y:t,o==null?o:$r(o,l,u,y)}var rf=md(Ee),sf=md(Wt);function G2(o,l,u){var y=ue(o),v=y||pn(o)||fr(o);if(l=se(l,4),u==null){var P=o&&o.constructor;v?u=y?new P:[]:Oe(o)?u=Oi(P)?cr(Ys(o)):{}:u={}}return(v?Qt:Mi)(o,function(T,Z,F){return l(u,T,Z,F)}),u}function W2(o,l){return o==null?!0:al(o,l)}function Z2(o,l,u){return o==null?o:Eu(o,l,hl(u))}function V2(o,l,u,y){return y=typeof y=="function"?y:t,o==null?o:Eu(o,l,hl(u),y)}function pr(o){return o==null?[]:Na(o,Ee(o))}function I2(o){return o==null?[]:Na(o,Wt(o))}function A2(o,l,u){return u===t&&(u=l,l=t),u!==t&&(u=ti(u),u=u===u?u:0),l!==t&&(l=ti(l),l=l===l?l:0),Dn(ti(o),l,u)}function F2(o,l,u){return l=zi(l),u===t?(u=l,l=0):u=zi(u),o=ti(o),U1(o,l,u)}function O2(o,l,u){if(u&&typeof u!="boolean"&&bt(o,l,u)&&(l=u=t),u===t&&(typeof l=="boolean"?(u=l,l=t):typeof o=="boolean"&&(u=o,o=t)),o===t&&l===t?(o=0,l=1):(o=zi(o),l===t?(l=o,o=0):l=zi(l)),o>l){var y=o;o=l,l=y}if(u||o%1||l%1){var v=Tu();return gt(o+v*(l-o+pb("1e-"+((v+"").length-1))),l)}return rl(o,l)}var z2=ur(function(o,l,u){return l=l.toLowerCase(),o+(u?of(l):l)});function of(o){return Zl(Pe(o).toLowerCase())}function af(o){return o=Pe(o),o&&o.replace(Xw,Cb).replace(rb,"")}function D2(o,l,u){o=Pe(o),l=Xt(l);var y=o.length;u=u===t?y:Dn(pe(u),0,y);var v=u;return u-=l.length,u>=0&&o.slice(u,v)==l}function X2(o){return o=Pe(o),o&&Vs.test(o)?o.replace(ai,Tb):o}function k2(o){return o=Pe(o),o&&Lw.test(o)?o.replace(Pa,"\\$&"):o}var U2=ur(function(o,l,u){return o+(u?"-":"")+l.toLowerCase()}),N2=ur(function(o,l,u){return o+(u?" ":"")+l.toLowerCase()}),K2=cd("toLowerCase");function B2(o,l,u){o=Pe(o),l=pe(l);var y=l?rr(o):0;if(!l||y>=l)return o;var v=(l-y)/2;return lo(Qs(v),u)+o+lo(Js(v),u)}function Y2(o,l,u){o=Pe(o),l=pe(l);var y=l?rr(o):0;return l&&y<l?o+lo(l-y,u):o}function R2(o,l,u){o=Pe(o),l=pe(l);var y=l?rr(o):0;return l&&y<l?lo(l-y,u)+o:o}function j2(o,l,u){return u||l==null?l=0:l&&(l=+l),e1(Pe(o).replace(Ca,""),l||0)}function J2(o,l,u){return(u?bt(o,l,u):l===t)?l=1:l=pe(l),sl(Pe(o),l)}function Q2(){var o=arguments,l=Pe(o[0]);return o.length<3?l:l.replace(o[1],o[2])}var H2=ur(function(o,l,u){return o+(u?"_":"")+l.toLowerCase()});function $2(o,l,u){return u&&typeof u!="number"&&bt(o,l,u)&&(l=u=t),u=u===t?ge:u>>>0,u?(o=Pe(o),o&&(typeof l=="string"||l!=null&&!Tl(l))&&(l=Xt(l),!l&&nr(o))?fn(hi(o),0,u):o.split(l,u)):[]}var E2=ur(function(o,l,u){return o+(u?" ":"")+Zl(l)});function q2(o,l,u){return o=Pe(o),u=u==null?0:Dn(pe(u),0,o.length),l=Xt(l),o.slice(u,u+l.length)==l}function eL(o,l,u){var y=S.templateSettings;u&&bt(o,l,u)&&(l=t),o=Pe(o),l=bo({},l,y,gd);var v=bo({},l.imports,y.imports,gd),P=Ee(v),T=Na(v,P),Z,F,B=0,R=l.interpolate||Is,J="__p += '",E=Ba((l.escape||Is).source+"|"+R.source+"|"+(R===sn?Iw:Is).source+"|"+(l.evaluate||Is).source+"|$","g"),te="//# sourceURL="+(Te.call(l,"sourceURL")?(l.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++cb+"]")+`
978
+ `;o.replace(E,function(ae,we,xe,Ut,xt,Nt){return xe||(xe=Ut),J+=o.slice(B,Nt).replace(kw,Gb),we&&(Z=!0,J+=`' +
979
+ __e(`+we+`) +
980
+ '`),xt&&(F=!0,J+=`';
981
+ `+xt+`;
982
+ __p += '`),xe&&(J+=`' +
983
+ ((__t = (`+xe+`)) == null ? '' : __t) +
984
+ '`),B=Nt+ae.length,ae}),J+=`';
985
+ `;var oe=Te.call(l,"variable")&&l.variable;if(!oe)J=`with (obj) {
986
+ `+J+`
558
987
  }
559
- `;else if(y0.test(le))throw new de(c);j=(A?j.replace(ue,""):j).replace(Se,"$1").replace(Re,"$1;"),j="function("+(le||"obj")+`) {
560
- `+(le?"":`obj || (obj = {});
561
- `)+"var __t, __p = ''"+(W?", __e = _.escape":"")+(A?`, __j = Array.prototype.join;
988
+ `;else if(Zw.test(oe))throw new he(c);J=(F?J.replace(ce,""):J).replace(Me,"$1").replace(Ye,"$1;"),J="function("+(oe||"obj")+`) {
989
+ `+(oe?"":`obj || (obj = {});
990
+ `)+"var __t, __p = ''"+(Z?", __e = _.escape":"")+(F?`, __j = Array.prototype.join;
562
991
  function print() { __p += __j.call(arguments, '') }
563
992
  `:`;
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=`
993
+ `)+J+`return __p
994
+ }`;var me=cf(function(){return Le(P,te+"return "+J).apply(t,T)});if(me.source=J,Cl(me))throw me;return me}function tL(o){return Pe(o).toLowerCase()}function iL(o){return Pe(o).toUpperCase()}function nL(o,l,u){if(o=Pe(o),o&&(u||l===t))return yu(o);if(!o||!(l=Xt(l)))return o;var y=hi(o),v=hi(l),P=_u(y,v),T=vu(y,v)+1;return fn(y,P,T).join("")}function rL(o,l,u){if(o=Pe(o),o&&(u||l===t))return o.slice(0,bu(o)+1);if(!o||!(l=Xt(l)))return o;var y=hi(o),v=vu(y,hi(l))+1;return fn(y,0,v).join("")}function sL(o,l,u){if(o=Pe(o),o&&(u||l===t))return o.replace(Ca,"");if(!o||!(l=Xt(l)))return o;var y=hi(o),v=_u(y,hi(l));return fn(y,v).join("")}function oL(o,l){var u=V,y=G;if(Oe(l)){var v="separator"in l?l.separator:v;u="length"in l?pe(l.length):u,y="omission"in l?Xt(l.omission):y}o=Pe(o);var P=o.length;if(nr(o)){var T=hi(o);P=T.length}if(u>=P)return o;var Z=u-rr(y);if(Z<1)return y;var F=T?fn(T,0,Z).join(""):o.slice(0,Z);if(v===t)return F+y;if(T&&(Z+=F.length-Z),Tl(v)){if(o.slice(Z).search(v)){var B,R=F;for(v.global||(v=Ba(v.source,Pe(Xh.exec(v))+"g")),v.lastIndex=0;B=v.exec(R);)var J=B.index;F=F.slice(0,J===t?Z:J)}}else if(o.indexOf(Xt(v),Z)!=Z){var E=F.lastIndexOf(v);E>-1&&(F=F.slice(0,E))}return F+y}function aL(o){return o=Pe(o),o&&Dh.test(o)?o.replace(jt,Ob):o}var lL=ur(function(o,l,u){return o+(u?" ":"")+l.toUpperCase()}),Zl=cd("toUpperCase");function lf(o,l,u){return o=Pe(o),l=u?t:l,l===t?Zb(o)?Xb(o):xb(o):o.match(l)||[]}var cf=ye(function(o,l){try{return zt(o,t,l)}catch(u){return Cl(u)?u:new he(u)}}),cL=Ai(function(o,l){return Qt(l,function(u){u=Li(u),Vi(o,u,Ll(o[u],o))}),o});function hL(o){var l=o==null?0:o.length,u=se();return o=l?Fe(o,function(y){if(typeof y[1]!="function")throw new Ht(a);return[u(y[0]),y[1]]}):[],ye(function(y){for(var v=-1;++v<l;){var P=o[v];if(zt(P[0],this,y))return zt(P[1],this,y)}})}function uL(o){return O1(Et(o,f))}function Vl(o){return function(){return o}}function dL(o,l){return o==null||o!==o?l:o}var fL=ud(),pL=ud(!0);function Zt(o){return o}function Il(o){return Uu(typeof o=="function"?o:Et(o,f))}function mL(o){return Ku(Et(o,f))}function gL(o,l){return Bu(o,Et(l,f))}var yL=ye(function(o,l){return function(u){return Qr(u,o,l)}}),_L=ye(function(o,l){return function(u){return Qr(o,u,l)}});function Al(o,l,u){var y=Ee(l),v=to(l,y);u==null&&!(Oe(l)&&(v.length||!y.length))&&(u=l,l=o,o=this,v=to(l,Ee(l)));var P=!(Oe(u)&&"chain"in u)||!!u.chain,T=Oi(o);return Qt(v,function(Z){var F=l[Z];o[Z]=F,T&&(o.prototype[Z]=function(){var B=this.__chain__;if(P||B){var R=o(this.__wrapped__),J=R.__actions__=Tt(this.__actions__);return J.push({func:F,args:arguments,thisArg:o}),R.__chain__=B,R}return F.apply(o,an([this.value()],arguments))})}),o}function vL(){return ct._===this&&(ct._=Yb),this}function Fl(){}function wL(o){return o=pe(o),ye(function(l){return Yu(l,o)})}var bL=dl(Fe),xL=dl(du),ML=dl(za);function hf(o){return vl(o)?Da(Li(o)):q1(o)}function SL(o){return function(l){return o==null?t:Xn(o,l)}}var LL=fd(),PL=fd(!0);function Ol(){return[]}function zl(){return!1}function CL(){return{}}function TL(){return""}function GL(){return!0}function WL(o,l){if(o=pe(o),o<1||o>ne)return[];var u=ge,y=gt(o,ge);l=se(l),o-=ge;for(var v=Ua(y,l);++u<o;)l(u);return v}function ZL(o){return ue(o)?Fe(o,Li):kt(o)?[o]:Tt(Gd(Pe(o)))}function VL(o){var l=++Kb;return Pe(o)+l}var IL=ao(function(o,l){return o+l},0),AL=fl("ceil"),FL=ao(function(o,l){return o/l},1),OL=fl("floor");function zL(o){return o&&o.length?eo(o,Zt,Ea):t}function DL(o,l){return o&&o.length?eo(o,se(l,2),Ea):t}function XL(o){return mu(o,Zt)}function kL(o,l){return mu(o,se(l,2))}function UL(o){return o&&o.length?eo(o,Zt,il):t}function NL(o,l){return o&&o.length?eo(o,se(l,2),il):t}var KL=ao(function(o,l){return o*l},1),BL=fl("round"),YL=ao(function(o,l){return o-l},0);function RL(o){return o&&o.length?ka(o,Zt):0}function jL(o,l){return o&&o.length?ka(o,se(l,2)):0}return S.after=mS,S.ary=kd,S.assign=i2,S.assignIn=ef,S.assignInWith=bo,S.assignWith=n2,S.at=r2,S.before=Ud,S.bind=Ll,S.bindAll=cL,S.bindKey=Nd,S.castArray=CS,S.chain=zd,S.chunk=Ox,S.compact=zx,S.concat=Dx,S.cond=hL,S.conforms=uL,S.constant=Vl,S.countBy=RM,S.create=s2,S.curry=Kd,S.curryRight=Bd,S.debounce=Yd,S.defaults=o2,S.defaultsDeep=a2,S.defer=gS,S.delay=yS,S.difference=Xx,S.differenceBy=kx,S.differenceWith=Ux,S.drop=Nx,S.dropRight=Kx,S.dropRightWhile=Bx,S.dropWhile=Yx,S.fill=Rx,S.filter=JM,S.flatMap=$M,S.flatMapDeep=EM,S.flatMapDepth=qM,S.flatten=Id,S.flattenDeep=jx,S.flattenDepth=Jx,S.flip=_S,S.flow=fL,S.flowRight=pL,S.fromPairs=Qx,S.functions=p2,S.functionsIn=m2,S.groupBy=eS,S.initial=$x,S.intersection=Ex,S.intersectionBy=qx,S.intersectionWith=eM,S.invert=y2,S.invertBy=_2,S.invokeMap=iS,S.iteratee=Il,S.keyBy=nS,S.keys=Ee,S.keysIn=Wt,S.map=mo,S.mapKeys=w2,S.mapValues=b2,S.matches=mL,S.matchesProperty=gL,S.memoize=yo,S.merge=x2,S.mergeWith=tf,S.method=yL,S.methodOf=_L,S.mixin=Al,S.negate=_o,S.nthArg=wL,S.omit=M2,S.omitBy=S2,S.once=vS,S.orderBy=rS,S.over=bL,S.overArgs=wS,S.overEvery=xL,S.overSome=ML,S.partial=Pl,S.partialRight=Rd,S.partition=sS,S.pick=L2,S.pickBy=nf,S.property=hf,S.propertyOf=SL,S.pull=rM,S.pullAll=Fd,S.pullAllBy=sM,S.pullAllWith=oM,S.pullAt=aM,S.range=LL,S.rangeRight=PL,S.rearg=bS,S.reject=lS,S.remove=lM,S.rest=xS,S.reverse=Ml,S.sampleSize=hS,S.set=C2,S.setWith=T2,S.shuffle=uS,S.slice=cM,S.sortBy=pS,S.sortedUniq=gM,S.sortedUniqBy=yM,S.split=$2,S.spread=MS,S.tail=_M,S.take=vM,S.takeRight=wM,S.takeRightWhile=bM,S.takeWhile=xM,S.tap=zM,S.throttle=SS,S.thru=po,S.toArray=$d,S.toPairs=rf,S.toPairsIn=sf,S.toPath=ZL,S.toPlainObject=qd,S.transform=G2,S.unary=LS,S.union=MM,S.unionBy=SM,S.unionWith=LM,S.uniq=PM,S.uniqBy=CM,S.uniqWith=TM,S.unset=W2,S.unzip=Sl,S.unzipWith=Od,S.update=Z2,S.updateWith=V2,S.values=pr,S.valuesIn=I2,S.without=GM,S.words=lf,S.wrap=PS,S.xor=WM,S.xorBy=ZM,S.xorWith=VM,S.zip=IM,S.zipObject=AM,S.zipObjectDeep=FM,S.zipWith=OM,S.entries=rf,S.entriesIn=sf,S.extend=ef,S.extendWith=bo,Al(S,S),S.add=IL,S.attempt=cf,S.camelCase=z2,S.capitalize=of,S.ceil=AL,S.clamp=A2,S.clone=TS,S.cloneDeep=WS,S.cloneDeepWith=ZS,S.cloneWith=GS,S.conformsTo=VS,S.deburr=af,S.defaultTo=dL,S.divide=FL,S.endsWith=D2,S.eq=di,S.escape=X2,S.escapeRegExp=k2,S.every=jM,S.find=QM,S.findIndex=Zd,S.findKey=l2,S.findLast=HM,S.findLastIndex=Vd,S.findLastKey=c2,S.floor=OL,S.forEach=Dd,S.forEachRight=Xd,S.forIn=h2,S.forInRight=u2,S.forOwn=d2,S.forOwnRight=f2,S.get=Gl,S.gt=IS,S.gte=AS,S.has=g2,S.hasIn=Wl,S.head=Ad,S.identity=Zt,S.includes=tS,S.indexOf=Hx,S.inRange=F2,S.invoke=v2,S.isArguments=Nn,S.isArray=ue,S.isArrayBuffer=FS,S.isArrayLike=Gt,S.isArrayLikeObject=Ne,S.isBoolean=OS,S.isBuffer=pn,S.isDate=zS,S.isElement=DS,S.isEmpty=XS,S.isEqual=kS,S.isEqualWith=US,S.isError=Cl,S.isFinite=NS,S.isFunction=Oi,S.isInteger=jd,S.isLength=vo,S.isMap=Jd,S.isMatch=KS,S.isMatchWith=BS,S.isNaN=YS,S.isNative=RS,S.isNil=JS,S.isNull=jS,S.isNumber=Qd,S.isObject=Oe,S.isObjectLike=ke,S.isPlainObject=ts,S.isRegExp=Tl,S.isSafeInteger=QS,S.isSet=Hd,S.isString=wo,S.isSymbol=kt,S.isTypedArray=fr,S.isUndefined=HS,S.isWeakMap=$S,S.isWeakSet=ES,S.join=tM,S.kebabCase=U2,S.last=ei,S.lastIndexOf=iM,S.lowerCase=N2,S.lowerFirst=K2,S.lt=qS,S.lte=e2,S.max=zL,S.maxBy=DL,S.mean=XL,S.meanBy=kL,S.min=UL,S.minBy=NL,S.stubArray=Ol,S.stubFalse=zl,S.stubObject=CL,S.stubString=TL,S.stubTrue=GL,S.multiply=KL,S.nth=nM,S.noConflict=vL,S.noop=Fl,S.now=go,S.pad=B2,S.padEnd=Y2,S.padStart=R2,S.parseInt=j2,S.random=O2,S.reduce=oS,S.reduceRight=aS,S.repeat=J2,S.replace=Q2,S.result=P2,S.round=BL,S.runInContext=A,S.sample=cS,S.size=dS,S.snakeCase=H2,S.some=fS,S.sortedIndex=hM,S.sortedIndexBy=uM,S.sortedIndexOf=dM,S.sortedLastIndex=fM,S.sortedLastIndexBy=pM,S.sortedLastIndexOf=mM,S.startCase=E2,S.startsWith=q2,S.subtract=YL,S.sum=RL,S.sumBy=jL,S.template=eL,S.times=WL,S.toFinite=zi,S.toInteger=pe,S.toLength=Ed,S.toLower=tL,S.toNumber=ti,S.toSafeInteger=t2,S.toString=Pe,S.toUpper=iL,S.trim=nL,S.trimEnd=rL,S.trimStart=sL,S.truncate=oL,S.unescape=aL,S.uniqueId=VL,S.upperCase=lL,S.upperFirst=Zl,S.each=Dd,S.eachRight=Xd,S.first=Ad,Al(S,function(){var o={};return Mi(S,function(l,u){Te.call(S.prototype,u)||(o[u]=l)}),o}(),{chain:!1}),S.VERSION=i,Qt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){S[o].placeholder=S}),Qt(["drop","take"],function(o,l){be.prototype[o]=function(u){u=u===t?1:Qe(pe(u),0);var y=this.__filtered__&&!l?new be(this):this.clone();return y.__filtered__?y.__takeCount__=gt(u,y.__takeCount__):y.__views__.push({size:gt(u,ge),type:o+(y.__dir__<0?"Right":"")}),y},be.prototype[o+"Right"]=function(u){return this.reverse()[o](u).reverse()}}),Qt(["filter","map","takeWhile"],function(o,l){var u=l+1,y=u==Y||u==Q;be.prototype[o]=function(v){var P=this.clone();return P.__iteratees__.push({iteratee:se(v,3),type:u}),P.__filtered__=P.__filtered__||y,P}}),Qt(["head","last"],function(o,l){var u="take"+(l?"Right":"");be.prototype[o]=function(){return this[u](1).value()[0]}}),Qt(["initial","tail"],function(o,l){var u="drop"+(l?"":"Right");be.prototype[o]=function(){return this.__filtered__?new be(this):this[u](1)}}),be.prototype.compact=function(){return this.filter(Zt)},be.prototype.find=function(o){return this.filter(o).head()},be.prototype.findLast=function(o){return this.reverse().find(o)},be.prototype.invokeMap=ye(function(o,l){return typeof o=="function"?new be(this):this.map(function(u){return Qr(u,o,l)})}),be.prototype.reject=function(o){return this.filter(_o(se(o)))},be.prototype.slice=function(o,l){o=pe(o);var u=this;return u.__filtered__&&(o>0||l<0)?new be(u):(o<0?u=u.takeRight(-o):o&&(u=u.drop(o)),l!==t&&(l=pe(l),u=l<0?u.dropRight(-l):u.take(l-o)),u)},be.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},be.prototype.toArray=function(){return this.take(ge)},Mi(be.prototype,function(o,l){var u=/^(?:filter|find|map|reject)|While$/.test(l),y=/^(?:head|last)$/.test(l),v=S[y?"take"+(l=="last"?"Right":""):l],P=y||/^find/.test(l);v&&(S.prototype[l]=function(){var T=this.__wrapped__,Z=y?[1]:arguments,F=T instanceof be,B=Z[0],R=F||ue(T),J=function(we){var xe=v.apply(S,an([we],Z));return y&&E?xe[0]:xe};R&&u&&typeof B=="function"&&B.length!=1&&(F=R=!1);var E=this.__chain__,te=!!this.__actions__.length,oe=P&&!E,me=F&&!te;if(!P&&R){T=me?T:new be(this);var ae=o.apply(T,Z);return ae.__actions__.push({func:po,args:[J],thisArg:t}),new $t(ae,E)}return oe&&me?o.apply(this,Z):(ae=this.thru(J),oe?y?ae.value()[0]:ae.value():ae)})}),Qt(["pop","push","shift","sort","splice","unshift"],function(o){var l=Xs[o],u=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",y=/^(?:pop|shift)$/.test(o);S.prototype[o]=function(){var v=arguments;if(y&&!this.__chain__){var P=this.value();return l.apply(ue(P)?P:[],v)}return this[u](function(T){return l.apply(ue(T)?T:[],v)})}}),Mi(be.prototype,function(o,l){var u=S[l];if(u){var y=u.name+"";Te.call(lr,y)||(lr[y]=[]),lr[y].push({name:l,func:u})}}),lr[oo(t,L).name]=[{name:"wrapper",func:t}],be.prototype.clone=a1,be.prototype.reverse=l1,be.prototype.value=c1,S.prototype.at=DM,S.prototype.chain=XM,S.prototype.commit=kM,S.prototype.next=UM,S.prototype.plant=KM,S.prototype.reverse=BM,S.prototype.toJSON=S.prototype.valueOf=S.prototype.value=YM,S.prototype.first=S.prototype.head,Nr&&(S.prototype[Nr]=NM),S},sr=kb();An?((An.exports=sr)._=sr,Ia._=sr):ct._=sr}).call(Wr)}(ws,ws.exports);var T0=ws.exports,G0=Object.defineProperty,W0=(r,e,t)=>e in r?G0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Z0=(r,e,t)=>W0(r,e+"",t);let ni=class extends dt{constructor(e){super(e),Z0(this,"_baseType","Point"),this._threeGeometry=this._createThreeGeometry(),this._style&&this._style.applyTo(this._threeGeometry)}_coordsTransform(){const e=this.getMap(),t=new p.Vector3(this._geometry.coordinates[0],this._geometry.coordinates[1],this._geometry.coordinates[2]||0);return e?e.geo2world(t):t}_toThreeJSGeometry(){}_updateGeometryPositions(){const e=this._coordsTransform();if(this._position=e,this._threeGeometry){const t=this.getMap();t?.prjcenter?this._threeGeometry.position.copy(e).sub(t.prjcenter):this._threeGeometry.position.copy(e),this.children.includes(this._threeGeometry)||this.add(this._threeGeometry),this.updateMatrixWorld(!0)}else this._toThreeJSGeometry()}_createThreeGeometry(){return new p.Points(new p.BufferGeometry,new p.PointsMaterial({size:1,color:8947848}))}};var V0=Object.defineProperty,I0=(r,e,t)=>e in r?V0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,A0=(r,e,t)=>I0(r,e+"",t);const F0={};class Ti extends ni{constructor(e){super(e),A0(this,"_type","Marker")}async _toThreeJSGeometry(){this._position=this._coordsTransform(),this._style&&(this._threeGeometry&&this._disposeGeometry(),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}_updateGeometryPositions(){this._position=this._coordsTransform(),this._threeGeometry?(this._threeGeometry.position.copy(this._position),this.children.includes(this._threeGeometry)||this.add(this._threeGeometry),this.updateMatrixWorld(!0),this._threeGeometry.updateMatrixWorld(!0)):this._toThreeJSGeometry()}async _createObject(e){switch(e.config.type){case"basic-point":return Sn(e.config,new p.Vector3(0,0,0));case"icon-point":return Dc(e.config,this._position);case"icon-label-point":return Mg(e.config,this._position);default:throw new Error(`不支持的样式类型: ${e.config.type}`)}}_calculateCollisionBoundingBox(e,t){if(!this.visible||!this._threeGeometry||!e||!t)return null;try{switch(this._style?.config.type){case"icon-point":return this._calculateSpriteBoundingBox(this._threeGeometry);default:return this._getFallbackBoundingBox()}}catch(i){return console.warn(`Marker ${this._id} bounding box calculation failed:`,i),console.warn(`Marker ${this._id} 包围盒计算失败:`,i),this._getFallbackBoundingBox()}}_calculateSpriteBoundingBox(e){try{const i=Math.max(Math.abs(e.scale.x),Math.abs(e.scale.y))/.002;return{width:i,height:i,offsetX:-i/2,offsetY:-i/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}}}}Ti.mergeOptions(F0);var O0=Object.defineProperty,z0=(r,e,t)=>e in r?O0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,th=(r,e,t)=>z0(r,typeof e!="symbol"?e+"":e,t);class ih extends dt{constructor(e){super(e),th(this,"_baseType","Line"),th(this,"_vertexPoints"),this._threeGeometry=this._createThreeGeometry(),this._vertexPoints=[0,0,0],this._style&&this._style.applyTo(this._threeGeometry)}_coordsTransform(){const e=this.getMap(),t=this._geometry,i=e?.prjcenter;if(this._geometry.type==="LineString"){let s=t.coordinates.map(c=>{const h=new p.Vector3(c[0],c[1],c[2]||0);return(e?e.geo2world(h):h).sub(i)}),a=s.flatMap(c=>[c.x,c.y,c.z]);return{_position:s,_vertexPoints:a}}}_toThreeJSGeometry(){}_createThreeGeometry(){const e=new Ni,t=new vn({color:8947848,linewidth:.1,dashed:!1,resolution:new p.Vector2(window.innerWidth,window.innerHeight)});return new bn(e,t)}}var D0=Object.defineProperty,X0=(r,e,t)=>e in r?D0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,k0=(r,e,t)=>X0(r,e+"",t);const U0={};class Lt extends ih{constructor(e){super(e),k0(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())}_updateGeometryPositions(){let{_vertexPoints:e}=this._coordsTransform();if(this._vertexPoints=e,this._threeGeometry&&(this._threeGeometry.isLine2||this._threeGeometry instanceof bn)){const n=this._threeGeometry.geometry;n.setPositions(this._vertexPoints),n.computeBoundingSphere(),n.computeBoundingBox();const s=this.getMap();s?.prjcenter&&this._threeGeometry.position.set(s.prjcenter.x,s.prjcenter.y,s.prjcenter.z),this.children.includes(this._threeGeometry)||this.add(this._threeGeometry),this.updateMatrixWorld(!0),this._threeGeometry.updateMatrixWorld(!0)}else console.warn("[LineString] _updateGeometryPositions: Geometry type mismatch, fallback to full rebuild",{hasGeometry:!!this._threeGeometry,geometryType:this._threeGeometry?.constructor?.name,isLine2:this._threeGeometry?.isLine2}),this._toThreeJSGeometry()}async _createObject(e){switch(e.config.type){case"basic-line":return Eo(e.config,this._vertexPoints);case"flow-tube-line":return Xc(e.config,this._vertexPoints);case"arrow-line":return kc(e.config,this._vertexPoints);case"flow-texture-line":return await Uc(e.config,this._vertexPoints);default:throw new Error(`Unsupported style type: ${e.config.type}`)}}_updateGeometry(){const e=this.getMap();if(this._threeGeometry){if(this._threeGeometry instanceof bn){const i=this._threeGeometry.geometry;i.setPositions(this._vertexPoints),i.computeBoundingSphere(),i.computeBoundingBox()}this._threeGeometry.position.add(e?.prjcenter),this._threeGeometry.renderOrder=99,this.add(this._threeGeometry),this.updateMatrixWorld(!0),this._tryProcessQueue()}}}Lt.mergeOptions(U0);var N0=Object.defineProperty,K0=(r,e,t)=>e in r?N0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,nh=(r,e,t)=>K0(r,typeof e!="symbol"?e+"":e,t);class B0 extends dt{constructor(e){super(e),nh(this,"_baseType","Surface"),nh(this,"_vertexPoints"),this._threeGeometry=this._createThreeGeometry(),this._vertexPoints=[0,0,0],this._style&&this._style.applyTo(this._threeGeometry)}_coordsTransform(){const e=this.getMap(),t=e?.prjcenter,i=this._geometry;if(!i)throw new Error("Geometry data undefined");if(i.type==="Polygon"){const n=i.coordinates;let s=[],a=[];return n.forEach(c=>{const h=c.map(d=>{const m=new p.Vector3(d[0],d[1],d[2]||0);return(e?e.geo2world(m):m).sub(t)});s.push(h),a.push(...h.flatMap(d=>[d.x,d.y,d.z]))}),{_positions:s,_vertexPoints:a}}else if(i.type==="MultiPolygon"){const n=i.coordinates;let s=[],a=[];return n.forEach(c=>{const h=[];c.forEach(d=>{const m=d.map(f=>{const g=new p.Vector3(f[0],f[1],f[2]||0);return(e?e.geo2world(g):g).sub(t)});h.push(m),a.push(...m.flatMap(f=>[f.x,f.y,f.z]))}),s.push(h)}),{_positions:s,_vertexPoints:a}}else throw new Error(`Unsupported geometry type: ${i.type}`)}_updateGeometry(){const e=this._style?.config.type;if(this.clear(),!this._threeGeometry||!this._vertexPoints?.length){console.warn("Cannot update geometry: missing geometry or vertex data");return}const t=this.getMap();try{e==="basic-polygon"?(this._threeGeometry.renderOrder=90,this._threeGeometry.position.add(t?.prjcenter),this._threeGeometry.updateMatrix(),this.add(this._threeGeometry)):(e==="extrude-polygon"||e?.includes("water"))&&(this._threeGeometry.renderOrder=90,this._threeGeometry.position.add(t?.prjcenter),this._threeGeometry.updateMatrix(),this.add(this._threeGeometry))}catch(i){throw console.error("Failed to update polygon position:",i),i}}_createThreeGeometry(){const e=new Ni,t=new vn({color:8947848,linewidth:.1,dashed:!1,resolution:new p.Vector2(window.innerWidth,window.innerHeight)});return new bn(e,t)}}var Y0=Object.defineProperty,R0=(r,e,t)=>e in r?Y0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,j0=(r,e,t)=>R0(r,e+"",t);const J0={};class wi extends B0{constructor(e){super(e),j0(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(),await this._style.applyTo(this._threeGeometry))}_updateGeometryPositions(){const e=this._style?.config.type;console.warn("[Polygon] _updateGeometryPositions: Fallback to full rebuild",{styleType:e,hasGeometry:!!this._threeGeometry}),this._toThreeJSGeometry()}async _createObject(e){switch(e.config.type){case"basic-polygon":return gg(e.config,this._vertexPoints);case"extrude-polygon":return yg(e.config,this._vertexPoints);case"water":return _g(e.config,this.getMap(),this._vertexPoints);case"base-water":return vg(e.config,this._vertexPoints);default:throw new Error(`Unsupported style type: ${e.config.type}`)}}_calculateCollisionBoundingBox(){return null}}wi.mergeOptions(J0);var Q0=Object.defineProperty,H0=(r,e,t)=>e in r?Q0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,na=(r,e,t)=>H0(r,typeof e!="symbol"?e+"":e,t);const $0={};class rh extends ih{constructor(e){super(e),na(this,"_type","MultiLineString"),na(this,"_lineObjects",[]),na(this,"_linesContainer"),this._linesContainer=new p.Group}async _toThreeJSGeometry(){const{_position:e}=this._coordsTransform(),t=this.getMap();if(this.clearLines(),this._disposeGeometry(),this._style){for(const i of e){const n=i.flatMap(a=>[a.x,a.y,a.z]),s=await this._createLineObject(this._style,n);s.position.add(t?.prjcenter),s.updateMatrixWorld(!0),s.renderOrder=99,this._lineObjects.push(s),this._linesContainer.add(s)}this._linesContainer.renderOrder=99,this._threeGeometry=this._linesContainer,this.add(this._threeGeometry),this._updateContainer(),this.updateMatrixWorld(!0),this._threeGeometry.updateMatrixWorld(!0),this._tryProcessQueue()}}async _createLineObject(e,t){switch(e.config.type){case"basic-line":return Eo(e.config,t);case"flow-tube-line":return Xc(e.config,t);case"arrow-line":return kc(e.config,t);case"flow-texture-line":return await Uc(e.config,t);default:throw new Error(`Unsupported style type: ${e.config.type}`)}}_coordsTransform(){const e=this.getMap(),t=this._geometry;if(this._geometry.type==="MultiLineString"){const i=e?.prjcenter;return{_position:t.coordinates.map(s=>s.map(a=>{const c=new p.Vector3(a[0],a[1],a[2]||0);return(e?e.geo2world(c):c).sub(i)}))}}}_updateContainer(){this._linesContainer.updateMatrixWorld(!0)}clearLines(){this._lineObjects.forEach(e=>{this._linesContainer.remove(e),e.geometry&&e.geometry.dispose(),e.material&&(Array.isArray(e.material)?e.material.forEach(t=>t.dispose()):e.material.dispose())}),this._lineObjects=[]}_updateGeometry(){this._toThreeJSGeometry()}_disposeObject(){}}rh.mergeOptions($0);var E0=Object.defineProperty,q0=(r,e,t)=>e in r?E0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Zr=(r,e,t)=>q0(r,typeof e!="symbol"?e+"":e,t);const ra=64;class ey extends ut.MeshStandardMaterial{constructor(e={}){const{shaderOption:t,regionOverlay:i,...n}=e;if(super({color:"rgb(58,126,182)",roughness:.7,metalness:.1,transparent:!0,opacity:.9,envMapIntensity:.8,depthWrite:!0,depthTest:!0,...n}),Zr(this,"shaderOption"),Zr(this,"clock"),Zr(this,"time"),Zr(this,"startTime"),Zr(this,"regionOverlay"),i&&i.vertices&&i.vertices.length>0){const s=i.vertices.slice(0,ra).map(c=>c.clone()),a=s.length;for(;s.length<ra;)s.push(new ut.Vector2(0,0));this.regionOverlay={color:i.color,opacity:i.opacity,vertices:s,vertexCount:a}}this.shaderOption={minY:0,maxY:100,minRate:.3,maxRate:1.5,effects:{diffusion:{enabled:!1,color:new ut.Color("#9ECDEC"),width:20,speed:1,maxDistance:100,center:void 0},flow:{enabled:!1,color:new ut.Color("#00E4FF"),range:10,speed:20},sweep:{enabled:!1,color:new ut.Color("#FFFFFF"),width:1.5,speed:10}},...t},this.clock=new ut.Clock,this.time={value:0},this.startTime={value:0},this.animate()}onBeforeCompile(e){const{minY:t,maxY:i,minRate:n,maxRate:s,effects:a}=this.shaderOption,c=i-t,h=!!this.regionOverlay;e.uniforms={...e.uniforms,time:this.time,uStartTime:this.startTime,uMinY:{value:t},uMaxY:{value:i},uHeightRange:{value:c},uMinRate:{value:n},uMaxRate:{value:s},uDiffusionEnabled:{value:a?.diffusion?.enabled?1:0},uDiffusionColor:{value:a?.diffusion?.color||new ut.Color("#9ECDEC")},uDiffusionWidth:{value:a?.diffusion?.width||20},uDiffusionSpeed:{value:a?.diffusion?.speed||1},uDiffusionMaxDistance:{value:a?.diffusion?.maxDistance||100},uDiffusionCenter:{value:a?.diffusion?.center||new ut.Vector3(0,0,0)},uFlowEnabled:{value:a?.flow?.enabled?1:0},uFlowColor:{value:a?.flow?.color||new ut.Color("#00E4FF")},uFlowRange:{value:a?.flow?.range||10},uFlowSpeed:{value:a?.flow?.speed||20},uSweepEnabled:{value:a?.sweep?.enabled?1:0},uSweepColor:{value:a?.sweep?.color||new ut.Color("#FFFFFF")},uSweepWidth:{value:a?.sweep?.width||1.5},uSweepSpeed:{value:a?.sweep?.speed||10},uRegionOverlayEnabled:{value:h?1:0},uRegionOverlayColor:{value:this.regionOverlay?.color||new ut.Color("#00FF88")},uRegionOverlayOpacity:{value:this.regionOverlay?.opacity??0},uRegionOverlayVertexCount:{value:this.regionOverlay?.vertexCount??0},uRegionOverlayVertices:{value:this.regionOverlay?.vertices||new Array(ra).fill(0).map(()=>new ut.Vector2(0,0))}},e.vertexShader=`
566
995
  varying vec3 vWorldPosition;
567
996
  varying vec3 vPosition;
568
997
  varying float vHeight;
@@ -574,6 +1003,7 @@ function print() { __p += __j.call(arguments, '') }
574
1003
  vHeight = position.y;
575
1004
  `),e.fragmentShader=`
576
1005
  #define PI 3.141592653589793
1006
+ #define REGION_OVERLAY_MAX_VERTS 64
577
1007
  varying vec3 vWorldPosition;
578
1008
  varying vec3 vPosition;
579
1009
  varying float vHeight;
@@ -598,6 +1028,14 @@ function print() { __p += __j.call(arguments, '') }
598
1028
  uniform vec3 uSweepColor;
599
1029
  uniform float uSweepWidth;
600
1030
  uniform float uSweepSpeed;
1031
+
1032
+ // 区域多边形外衣相关 uniform 声明(之前缺少)
1033
+ uniform int uRegionOverlayEnabled;
1034
+ uniform vec3 uRegionOverlayColor;
1035
+ uniform float uRegionOverlayOpacity;
1036
+ uniform int uRegionOverlayVertexCount;
1037
+ uniform vec2 uRegionOverlayVertices[REGION_OVERLAY_MAX_VERTS];
1038
+
601
1039
 
602
1040
  float distanceTo(vec2 src, vec2 dst) {
603
1041
  return distance(src, dst);
@@ -652,9 +1090,38 @@ function print() { __p += __j.call(arguments, '') }
652
1090
  diffuseColor.rgb = mix(uSweepColor, diffuseColor.rgb, 1.0 - sweepFactor);
653
1091
  }
654
1092
  }
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=`{
1093
+ // 区域多边形外衣叠色(Ray casting 判定点是否在多边形内)
1094
+ if (uRegionOverlayEnabled == 1 && uRegionOverlayOpacity > 0.0 && uRegionOverlayVertexCount >= 3) {
1095
+ vec2 p = vec2(vWorldPosition.x, vWorldPosition.z);
1096
+ bool inside = false;
1097
+ int j = 0;
1098
+ for (int i = 0; i < REGION_OVERLAY_MAX_VERTS; i++) {
1099
+ if (i >= uRegionOverlayVertexCount) break;
1100
+ if (i == 0) {
1101
+ j = uRegionOverlayVertexCount - 1;
1102
+ }
1103
+ vec2 pi = uRegionOverlayVertices[i];
1104
+ vec2 pj = uRegionOverlayVertices[j];
1105
+
1106
+ bool intersect = ((pi.y > p.y) != (pj.y > p.y)) &&
1107
+ (p.x < (pj.x - pi.x) * (p.y - pi.y) / (pj.y - pi.y + 1e-6) + pi.x);
1108
+ if (intersect) {
1109
+ inside = !inside;
1110
+ }
1111
+ j = i;
1112
+ }
1113
+
1114
+ if (inside) {
1115
+ diffuseColor.rgb = mix(
1116
+ diffuseColor.rgb,
1117
+ uRegionOverlayColor,
1118
+ clamp(uRegionOverlayOpacity, 0.0, 1.0)
1119
+ );
1120
+ }
1121
+ }
1122
+ `)}setDiffusionFromObject(e){if(!this.shaderOption.effects?.diffusion)return;const t=new ut.Box3().setFromObject(e);if(t.isEmpty())return;const i=new ut.Vector3;t.getCenter(i);const n=[new ut.Vector3(t.min.x,t.min.y,t.min.z),new ut.Vector3(t.max.x,t.max.y,t.max.z)];let s=0;n.forEach(a=>{const c=i.distanceTo(a);c>s&&(s=c)}),this.shaderOption.effects.diffusion={...this.shaderOption.effects.diffusion,center:i,maxDistance:s},this.needsUpdate=!0}updateBoundingBox(e,t){this.shaderOption.minY=e,this.shaderOption.maxY=t,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)}}var ty=Object.defineProperty,iy=(r,e,t)=>e in r?ty(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ri=(r,e,t)=>iy(r,typeof e!="symbol"?e+"":e,t);const ny={emissive:!1,emissiveIntensity:1,emissiveColor:"#ffffff"};class sh extends ni{constructor(e){super(e),ri(this,"_type","Model"),ri(this,"_emissive",!1),ri(this,"_emissiveIntensity",1),ri(this,"_emissiveColor","#ffffff"),ri(this,"_mixer",null),ri(this,"_currentAction",null),ri(this,"_animations",[]),ri(this,"_clock",new p.Clock),ri(this,"_autoUpdate",!0),ri(this,"_animationRequestId",null),ri(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(){if(this._position=this._coordsTransform(),this._style){if(this._threeGeometry&&this._disposeGeometry(),this.modelunino=await this._createObject(this._style),this._threeGeometry=this.modelunino.model,!this._threeGeometry){console.error("Model load failed: model returned by _createObject is undefined"),console.error("模型加载失败:_createObject返回的model为undefined");return}this._threeGeometry.userData._type="Model",this.modelunino.animations&&this.modelunino.animations.length>0&&(this._animations=this.modelunino.animations,this._mixer=new p.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(),this.trigger("loaded",{timestamp:xc(),targrt:this})}}async _createObject(e){switch(e.config.type){case"fbx":case"gltf":return mg(e.config,this._position);default:throw new Error(`Unsupported style type: ${e.config.type}`)}}_applyEmissionProperties(){this._threeGeometry&&this._threeGeometry.traverse(e=>{if("material"in e){const t=e.material;t&&(t.emissiveIntensity=this._emissive?this._emissiveIntensity:0,t.emissive&&t.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,t,i){this._emissive=e,t!==void 0&&(this._emissiveIntensity=t),i!==void 0&&(this._emissiveColor=i),this._applyEmissionProperties()}async setShadows(e){this.castShadow=e.cast,this.receiveShadow=e.receive,this._threeGeometry&&this._threeGeometry.traverse(t=>{t.isMesh&&t.material&&(t.castShadow=e.cast,t.receiveShadow=e.receive)})}playAnimation(e){if(!this._mixer||this._animations.length===0){console.warn("No available animations for model"),console.warn("模型没有可用的动画");return}this._currentAction&&(e.fadeOutDuration&&e.fadeOutDuration>0?this._currentAction.fadeOut(e.fadeOutDuration):this._currentAction.stop());const t=typeof e.name=="number"?this._animations[e.name]:this._animations.find(i=>i.name===e.name);if(!t){console.warn(`Animation not found: ${e.name}`),console.warn(`找不到动画: ${e.name}`);return}this._currentAction=this._mixer.clipAction(t),this._currentAction.setLoop(e.loop?p.LoopRepeat:p.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 t;return typeof e.name=="number"?t=this._animations[e.name]:t=this._animations.find(i=>i.name===e.name),t?t.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 t=this._clock.getDelta();this._mixer.update(t)}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()}_computeOverlayVertices(e){const t=e.feature;if(t&&Array.isArray(t._vertexPoints)&&t._vertexPoints.length>=6){const h=t.getMap?.()||this.getMap();if(h&&h.prjcenter){const d=h.prjcenter,m=t._vertexPoints,f=[];for(let g=0;g+2<m.length;g+=3){const _=m[g],w=m[g+2],b=d.x+_,x=d.z+w;f.push(new p.Vector2(b,x))}if(f.length>=3)return f}}const i=this.getMap();if(!i||!e.geometry)return null;const n=e.geometry;let s;if(n.type==="Polygon")s=n.coordinates;else if(n.type==="MultiPolygon"){if(!n.coordinates.length)return null;s=n.coordinates[0]}else return null;if(!s.length||!s[0].length)return null;const a=s[0],c=[];for(const h of a){const d=h[0],m=h[1],f=i.geo2world(new p.Vector3(d,m,0));c.push(new p.Vector2(f.x,f.z))}return c.length<3?null:c}_rendercity(){const e=this.getLayer();let t=null;if(e&&e.getRegionOverlays){const i=e.getRegionOverlays()||[];if(i.length){const n=i.filter(a=>(a.mode??"overlay")==="overlay").sort((a,c)=>(a.zIndex??0)-(c.zIndex??0)),s=n[n.length-1];if(s&&(s.geometry||s.feature)){const a=this._computeOverlayVertices(s);a&&a.length>=3&&(t={color:new p.Color(s.color??"#00FF88"),opacity:s.opacity??.3,vertices:a})}}}this.traverse(async i=>{if(i instanceof p.Mesh&&i.material){if(i.castShadow=!0,i.name==="building"){const n=new ey({color:new p.Color("#6BA7EC").multiplyScalar(1.8),opacity:.9,shaderOption:{minY:0,maxY:50,minRate:.3,maxRate:1.5,effects:{diffusion:{enabled:!0,color:new p.Color("#FFFFF"),width:300,speed:.05},flow:{enabled:!1,color:new p.Color("#FFFFF"),range:1e3,speed:3e3},sweep:{enabled:!0,color:new p.Color("#ffffff"),width:3,speed:5}}},regionOverlay:t||void 0}),s=new p.Box3().setFromObject(i);n.updateBoundingBox(s.min.y,s.max.y),n.setDiffusionFromObject(i),i.receiveShadow=!1,i.material=n,i.material.needsUpdate=!0}i.name==="grass"&&(i.castShadow=!1,i.receiveShadow=!0,i.material.color=new p.Color("#81e4d8ff)").multiplyScalar(.7),i.material.metalness=.2,i.material.roughness=.8,["metalnessMap","normalMap","roughnessMap","specularColorMap"].forEach(n=>{const s=i.material[n];s&&(s.wrapS=s.wrapT=p.RepeatWrapping,s.repeat.set(.3,.3),s.needsUpdate=!0)}),i.material.normalScale=new p.Vector2(3,3))}})}}sh.mergeOptions(ny);var ry=Object.defineProperty,sy=(r,e,t)=>e in r?ry(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,oy=(r,e,t)=>sy(r,e+"",t);const ay={};class oh extends ni{constructor(e){super(e),oy(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=99,e&&(e._clouds.add(this._threeGeometry),e._clouds.updateMatrixWorld()))}async _createObject(e){switch(e.config.type){case"cloud":return wg(e.config,this._position);default:throw new Error(`Unsupported style type: ${e.config.type}`)}}}oh.mergeOptions(ay);var ly=Object.defineProperty,cy=(r,e,t)=>e in r?ly(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,hy=(r,e,t)=>cy(r,e+"",t);const uy={};class ah extends ni{constructor(e){super(e),hy(this,"_type","Label")}async _toThreeJSGeometry(){this._position=this._coordsTransform(),this._style&&(this._threeGeometry&&this._disposeGeometry(),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}_updateGeometryPositions(){this._position=this._coordsTransform(),this._threeGeometry?(this._threeGeometry.position.copy(this._position),this.children.includes(this._threeGeometry)||this.add(this._threeGeometry),this.updateMatrixWorld(!0),this._threeGeometry.updateMatrixWorld(!0)):this._toThreeJSGeometry()}async _createObject(e){switch(e.config.type){case"canvas-label-fixed":return xg(e.config,new p.Vector3(0,0,0),this.getMap());case"canvas-label":return bg(e.config,new p.Vector3(0,0,0));default:throw new Error(`Unsupported style type: ${e.config.type}`)}}}ah.mergeOptions(uy);var dy=Object.defineProperty,fy=(r,e,t)=>e in r?dy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,lh=(r,e,t)=>fy(r,typeof e!="symbol"?e+"":e,t);const py={};class ch extends ni{constructor(e){super(e),lh(this,"_type","TPoints"),lh(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 Zg(e.config,this._geometries,this.getMap());default:throw new Error(`Unsupported style type: ${e.config.type}`)}}}ch.mergeOptions(py);var my=Object.defineProperty,gy=(r,e,t)=>e in r?my(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Qi=(r,e,t)=>gy(r,typeof e!="symbol"?e+"":e,t);class Vr extends Yi(Object){constructor(e,t){super(),Qi(this,"options"),Qi(this,"map"),Qi(this,"_sprite",null),Qi(this,"_isDragging",!1),Qi(this,"_dragStartPosition",null),Qi(this,"_lastCoordinate",null),Qi(this,"_boundOnMouseMove",null),Qi(this,"_boundOnMouseUp",null),this.map=t,this.options={position:e.position,index:e.index,symbol:e.symbol??0,size:e.size??8,color:e.color??"#ffffff",opacity:e.opacity??.9,draggable:e.draggable??!0},this._createSprite(),this._boundOnMouseMove=this._onMouseMove.bind(this),this._boundOnMouseUp=this._onMouseUp.bind(this)}_createSprite(){const t=document.createElement("canvas"),i=t.getContext("2d");t.width=64,t.height=64;const n=64/2,s=64/2-2;i.clearRect(0,0,t.width,t.height),i.beginPath(),i.arc(n,n,s,0,2*Math.PI),i.fillStyle="#000000",i.fill(),i.beginPath(),i.arc(n,n,s-2,0,2*Math.PI),i.fillStyle=this.options.color,i.fill();const a=new p.CanvasTexture(t);a.needsUpdate=!0;const c=new p.SpriteMaterial({map:a,opacity:this.options.opacity,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!0});this._sprite=new p.Sprite(c),this._sprite.position.copy(this.options.position),this._sprite.renderOrder=999999;const h=new p.Vector2;this._sprite.onBeforeRender=(d,m,f)=>{if(!this._sprite||!f)return;const g=f.position.distanceTo(this._sprite.position);d.getSize(h);const _=d.getPixelRatio(),w=this.options.size*_;let b=1;if(f.isPerspectiveCamera){const x=f.fov*Math.PI/180,L=2*Math.tan(x/2)*g;b=w/h.y*L}else if(f.isOrthographicCamera){const x=f.top,L=f.bottom,M=Math.abs(x-L)/f.zoom;b=w/h.y*M}this._sprite.scale.set(b,b,1)},this._sprite._editHandle=this,this.map.viewer.scene.add(this._sprite)}updatePosition(e){this.options.position=e,this._sprite&&this._sprite.position.copy(e)}getPosition(){return this.options.position.clone()}getIndex(){return this.options.index}getSymbol(){return this.options.symbol}getSprite(){return this._sprite}intersect(e){return!this._sprite||!this.options.draggable?!1:e.intersectObject(this._sprite).length>0}startDrag(e){this.options.draggable&&(this._isDragging=!0,this._dragStartPosition=this.options.position.clone(),this._lastCoordinate=e,this.map.viewer.config("draggable",!1),this.map.on("mousemove",this._boundOnMouseMove),this.map.on("mouseup",this._boundOnMouseUp),this.trigger("dragstart",{target:this,coordinate:e,position:this.options.position.clone()}))}_onMouseMove(e){if(!this._isDragging||!this._lastCoordinate)return;const t=e.coordinate,i=t[0]-this._lastCoordinate[0],n=t[1]-this._lastCoordinate[1],s=this.map.world2geo(this.options.position),a=this.map.geo2world(new p.Vector3(t[0],t[1],s.z));this.updatePosition(a),this._lastCoordinate=t,this.trigger("dragging",{target:this,coordinate:t,position:this.options.position.clone(),offset:{dx:i,dy:n}})}_onMouseUp(e){this._isDragging&&(this._isDragging=!1,this.map.viewer.config("draggable",!0),this.map.off("mousemove",this._boundOnMouseMove),this.map.off("mouseup",this._boundOnMouseUp),this.trigger("dragend",{target:this,coordinate:e.coordinate,position:this.options.position.clone(),startPosition:this._dragStartPosition}),this._dragStartPosition=null,this._lastCoordinate=null)}show(){this._sprite&&(this._sprite.visible=!0)}hide(){this._sprite&&(this._sprite.visible=!1)}remove(){if(this._isDragging&&(this._isDragging=!1,this.map.viewer.config("draggable",!0),this.map.off("mousemove",this._boundOnMouseMove),this.map.off("mouseup",this._boundOnMouseUp)),this._sprite){this.map.viewer.scene.remove(this._sprite);const e=this._sprite.material;e.map&&e.map.dispose(),e.dispose(),this._sprite=null}this._dragStartPosition=null,this._lastCoordinate=null,this._boundOnMouseMove=null,this._boundOnMouseUp=null}}function sa(r,e,t){const{currentTarget:i,clientX:n,clientY:s}=r;if(i instanceof HTMLElement){const a=i.clientWidth,c=i.clientHeight,h=new p.Vector2(n/a*2-1,-(s/c)*2+1);return e.getLocalInfoFromScreen(t,h)?.location}else return}var yy=Object.defineProperty,_y=(r,e,t)=>e in r?yy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ft=(r,e,t)=>_y(r,typeof e!="symbol"?e+"":e,t);class vy extends ds{constructor(e,t){super(e),ft(this,"options"),ft(this,"_handles",[]),ft(this,"_middleHandles",[]),ft(this,"_middleHandleColor","rgba(255, 255, 255, 0.6)"),ft(this,"_editing",!1),ft(this,"_shadow",null),ft(this,"_shadowSnapshot",null),ft(this,"_updating",!1),ft(this,"_history",[]),ft(this,"_historyIndex",-1),ft(this,"_draggableOriginalState",!1),ft(this,"_boundOnMapMouseMove",null),ft(this,"_boundOnMapClick",null),ft(this,"_boundOnMapMouseDown",null),ft(this,"_boundOnFeatureDragging",null),ft(this,"_boundOnFeatureDragEnd",null),this.options={handleSize:t?.handleSize??8,handleColor:t?.handleColor??"#ffffff",showMiddleHandles:t?.showMiddleHandles??!1,maxHistorySize:t?.maxHistorySize??20,removeVertexOn:t?.removeVertexOn??"contextmenu"},this._boundOnMapMouseMove=this._onMapMouseMove.bind(this),this._boundOnMapClick=this._onMapClick.bind(this),this._boundOnMapMouseDown=this._onMapMouseDown.bind(this),this._boundOnFeatureDragging=this._onFeatureDragging.bind(this),this._boundOnFeatureDragEnd=this._onFeatureDragEnd.bind(this)}enable(){return this._editing?this:(super.enable(),this._editing=!0,this._createShadow(),this._saveSnapshot(),this._setFeatureEditingStyle(!0),this._createHandles(),this.target.trigger("editstart"),this._draggableOriginalState=this.target.options.draggable||!1,this._draggableOriginalState||(this.target.options.draggable=!0,this.target.draggable&&this.target.draggable.enable()),this)}disable(){return this._editing?(super.disable(),this._editing=!1,this._clearHandles(),this._setFeatureEditingStyle(!1),this._draggableOriginalState||(this.target.options.draggable=!1,this.target.draggable&&this.target.draggable.disable()),this._draggableOriginalState=!1,this._updateCoordFromShadow(),this._removeShadow(),this.target.trigger("editend"),this):this}addHooks(){const e=this._getMap();e&&(e.on("mousemove",this._boundOnMapMouseMove),e.on("click",this._boundOnMapClick),e.viewer.container&&e.viewer.container.addEventListener("mousedown",this._boundOnMapMouseDown,!0),this.options.removeVertexOn==="contextmenu"&&e.on("contextmenu",this._boundOnMapClick)),this.target.on("dragging",this._boundOnFeatureDragging),this.target.on("dragend",this._boundOnFeatureDragEnd)}removeHooks(){const e=this._getMap();e&&(e.off("mousemove",this._boundOnMapMouseMove),e.off("click",this._boundOnMapClick),e.viewer.container&&e.viewer.container.removeEventListener("mousedown",this._boundOnMapMouseDown,!0),this.options.removeVertexOn==="contextmenu"&&e.off("contextmenu",this._boundOnMapClick)),this.target.off("dragging",this._boundOnFeatureDragging),this.target.off("dragend",this._boundOnFeatureDragEnd)}isEditing(){return this._editing}_createShadow(){this._shadow=null}_removeShadow(){this._shadow&&(this._shadow=null),this._shadowSnapshot=null}_updateCoordFromShadow(e=!1){e&&!this._updating&&this.target._onPositionChanged(!0)}_saveSnapshot(){const e=this.target._geometry;this._shadowSnapshot={type:e.type,coordinates:JSON.parse(JSON.stringify(e.coordinates))},this._addHistory(e.coordinates)}_addHistory(e){this._historyIndex<this._history.length-1&&(this._history=this._history.slice(0,this._historyIndex+1)),this._history.push({coordinates:JSON.parse(JSON.stringify(e)),timestamp:Date.now()}),this._history.length>this.options.maxHistorySize?this._history.shift():this._historyIndex++}undo(){if(this._historyIndex>0){this._historyIndex--;const e=this._history[this._historyIndex];this._restoreCoordinates(e.coordinates),this.target.trigger("editundo")}return this}redo(){if(this._historyIndex<this._history.length-1){this._historyIndex++;const e=this._history[this._historyIndex];this._restoreCoordinates(e.coordinates),this.target.trigger("editredo")}return this}_restoreCoordinates(e){const t=this.target._geometry;t.coordinates=JSON.parse(JSON.stringify(e)),this.target._onPositionChanged(!0),this._updateHandlePositions()}cancel(){return this._shadowSnapshot&&this._restoreCoordinates(this._shadowSnapshot.coordinates),this.disable(),this}_createHandles(){const e=this.target._geometry,t=this._getMap();if(!t){console.warn("[FeatureEditHandler] No map found, cannot create handles");return}this.target instanceof ni?this._createPointHandles(e,t):this.target instanceof Lt?this._createLineStringHandles(e,t):this.target instanceof wi&&this._createPolygonHandles(e,t)}_createPointHandles(e,t){const i=e.coordinates,n=t.geo2world(new p.Vector3(i[0],i[1],i[2]||0)),s=new Vr({position:n,index:0,symbol:0,size:this.options.handleSize,color:this.options.handleColor},t);s.on("dragstart",a=>{this._onHandleDragStart(a,0)}),s.on("dragging",a=>{this._onHandleDragging(a,0)}),s.on("dragend",a=>{this._onHandleDragEnd(a,0)}),this._handles.push(s)}_createLineStringHandles(e,t){const i=e.coordinates;i.forEach((n,s)=>{const a=t.geo2world(new p.Vector3(n[0],n[1],n[2]||0)),c=new Vr({position:a,index:s,symbol:0,size:this.options.handleSize,color:this.options.handleColor},t);c.on("dragstart",h=>{this._onHandleDragStart(h,s)}),c.on("dragging",h=>{this._onHandleDragging(h,s)}),c.on("dragend",h=>{this._onHandleDragEnd(h,s)}),this._handles.push(c)}),this.options.showMiddleHandles&&this._createLineStringMiddleHandles(i,t)}_onHandleDragging(e,t){this._updating=!0;const n=e.target.getPosition();if(!this._getMap())return;const a=this._fixHandlePointCoordinates(n,t),c=this.target._geometry;this.target instanceof ni?c.coordinates=[a.x,a.y,a.z]:this.target instanceof Lt&&(c.coordinates[t]=[a.x,a.y,a.z]),this.target._onPositionChanged(!0),this.target.trigger("handledragging",{index:t,coordinate:[a.x,a.y,a.z]}),this.target.trigger("editing",{index:t,coordinate:[a.x,a.y,a.z]}),this._updating=!1}_onHandleDragStart(e,t){this._updating=!0,this.target.trigger("handledragstart",{index:t,coordinate:e.coordinate})}_onHandleDragEnd(e,t){this._updating=!1;const i=this.target._geometry;this._addHistory(i.coordinates),this.target.trigger("handledragend",{index:t,coordinate:this.target instanceof ni?i.coordinates:i.coordinates[t]}),this.target.trigger("editvertex",{index:t,coordinate:this.target instanceof ni?i.coordinates:i.coordinates[t]})}_createPolygonHandles(e,t){const i=e.coordinates;if(!i||!Array.isArray(i)||i.length===0){console.warn("[FeatureEditHandler] Invalid polygon coordinates");return}i.forEach((s,a)=>{if(!s||s.length<3)return;const c=s[0][0]===s[s.length-1][0]&&s[0][1]===s[s.length-1][1]?s.length-1:s.length;for(let h=0;h<c;h++){const d=s[h],m=t.geo2world(new p.Vector3(d[0],d[1],d[2]||0)),f=new Vr({position:m,index:h,symbol:0,size:this.options.handleSize,color:this.options.handleColor},t);f._ringIndex=a,f.on("dragstart",g=>{this._onPolygonHandleDragStart(g,h,a)}),f.on("dragging",g=>{this._onPolygonHandleDragging(g,h,a)}),f.on("dragend",g=>{this._onPolygonHandleDragEnd(g,h,a)}),this._handles.push(f)}this.options.showMiddleHandles&&this._createPolygonMiddleHandles(s,a,t)})}_onPolygonHandleDragStart(e,t,i){this._updating=!0,this.target.trigger("handledragstart",{index:t,ringIndex:i,coordinate:e.coordinate})}_onPolygonHandleDragging(e,t,i){const s=e.target.getPosition();if(!this._getMap())return;const c=this._fixHandlePointCoordinates(s,t,i),d=this.target._geometry.coordinates;if(d[i]&&d[i][t]&&(d[i][t]=[c.x,c.y,c.z],t===0&&d[i].length>1)){const m=d[i].length-1;d[i][m]=[c.x,c.y,c.z]}this.target._onPositionChanged(!0),this.target.trigger("handledragging",{index:t,ringIndex:i,coordinate:[c.x,c.y,c.z]}),this.target.trigger("editing",{index:t,ringIndex:i,coordinate:[c.x,c.y,c.z]})}_onPolygonHandleDragEnd(e,t,i){this._updating=!1;const n=this.target._geometry,s=n.coordinates;this._addHistory(n.coordinates),this.target.trigger("handledragend",{index:t,ringIndex:i,coordinate:s[i]?.[t]||null}),this.target.trigger("editvertex",{index:t,ringIndex:i,coordinate:s[i]?.[t]||null})}_updateHandlePositions(){const e=this.target._geometry,t=this._getMap();if(t){if(this.target instanceof ni){const i=e.coordinates,n=t.geo2world(new p.Vector3(i[0],i[1],i[2]||0));this._handles[0]&&this._handles[0].updatePosition(n)}else if(this.target instanceof Lt)e.coordinates.forEach((n,s)=>{const a=t.geo2world(new p.Vector3(n[0],n[1],n[2]||0));this._handles[s]&&this._handles[s].updatePosition(a)});else if(this.target instanceof wi){const i=e.coordinates;let n=0;i.forEach(s=>{const a=s[0][0]===s[s.length-1][0]&&s[0][1]===s[s.length-1][1]?s.length-1:s.length;for(let c=0;c<a;c++){const h=s[c],d=t.geo2world(new p.Vector3(h[0],h[1],h[2]||0));this._handles[n]&&this._handles[n].updatePosition(d),n++}})}}}_clearHandles(){this._handles.forEach(e=>e.remove()),this._handles=[],this._middleHandles.forEach(e=>e.remove()),this._middleHandles=[]}_onFeatureDragging(e){this._updateHandlePositions(),this.options.showMiddleHandles&&this._updateMiddleHandlePositions()}_onFeatureDragEnd(e){const t=this.target._geometry;this._addHistory(t.coordinates),this._updateHandlePositions(),this.options.showMiddleHandles&&this._updateMiddleHandlePositions()}_updateMiddleHandlePositions(){const e=this.target._geometry,t=this._getMap();if(!t)return;let i=0;if(this.target instanceof Lt){const n=e.coordinates;for(let s=0;s<n.length-1&&!(i>=this._middleHandles.length);s++){const a=n[s],c=n[s+1],h=[(a[0]+c[0])/2,(a[1]+c[1])/2,((a[2]||0)+(c[2]||0))/2],d=t.geo2world(new p.Vector3(h[0],h[1],h[2]));this._middleHandles[i].updatePosition(d),i++}}else this.target instanceof wi&&e.coordinates.forEach(s=>{const a=s[0][0]===s[s.length-1][0]&&s[0][1]===s[s.length-1][1]?s.length-1:s.length;for(let c=0;c<a&&!(i>=this._middleHandles.length);c++){const h=(c+1)%a,d=s[c],m=s[h],f=[(d[0]+m[0])/2,(d[1]+m[1])/2,((d[2]||0)+(m[2]||0))/2],g=t.geo2world(new p.Vector3(f[0],f[1],f[2]));this._middleHandles[i].updatePosition(g),i++}})}_onMapMouseDown(e){const t=this._getMap();if(!t)return;const i=new p.Raycaster;i.params.Points={threshold:.5};const n=e,s=t.viewer.renderer.domElement,a=s.getBoundingClientRect(),c=new p.Vector2((n.clientX-a.left)/a.width*2-1,-((n.clientY-a.top)/a.height)*2+1);i.setFromCamera(c,t.viewer.camera);const h=[...this._handles,...this._middleHandles];for(const d of h)if(d.intersect(i)){const m=sa({currentTarget:s,clientX:n.clientX,clientY:n.clientY},t.tilemap,t.viewer.camera);m&&(d.startDrag([m.x,m.y]),n.stopPropagation&&n.stopPropagation(),n.stopImmediatePropagation&&n.stopImmediatePropagation(),n.preventDefault&&n.preventDefault());return}}_onMapMouseMove(e){}_onMapClick(e){if(!(e.type===this.options.removeVertexOn))return;const i=this._getMap();if(!i)return;const n=new p.Raycaster;n.params.Points={threshold:.5};const s=e.originEvent;if(!s)return;const a=new p.Vector2(s.offsetX/i.viewer.renderer.domElement.clientWidth*2-1,-(s.offsetY/i.viewer.renderer.domElement.clientHeight)*2+1);n.setFromCamera(a,i.viewer.camera);for(let c=0;c<this._handles.length;c++)if(this._handles[c].intersect(n)){this._removeVertex(c),s.stopPropagation&&s.stopPropagation(),s.preventDefault&&s.preventDefault();return}}_setFeatureEditingStyle(e){const t=this.target._threeGeometry;t&&t.traverse(i=>{i.material&&(e?Array.isArray(i.material)?i.material.forEach(n=>{n.userData._originalOpacity||(n.userData._originalOpacity=n.opacity),n.opacity=Math.min(n.opacity*.6,.6),n.transparent=!0}):(i.material.userData._originalOpacity||(i.material.userData._originalOpacity=i.material.opacity),i.material.opacity=Math.min(i.material.opacity*.6,.6),i.material.transparent=!0):Array.isArray(i.material)?i.material.forEach(n=>{n.userData._originalOpacity!==void 0&&(n.opacity=n.userData._originalOpacity,delete n.userData._originalOpacity)}):i.material.userData._originalOpacity!==void 0&&(i.material.opacity=i.material.userData._originalOpacity,delete i.material.userData._originalOpacity))})}_removeVertex(e){const t=this.target._geometry,i=this._handles[e],n=i.getIndex(),s=i._ringIndex||0;let a=null;if(this.target instanceof Lt){const c=t.coordinates;if(c.length<=2){console.warn("[FeatureEditHandler] LineString requires at least 2 vertices");return}a=c[n],c.splice(n,1)}else if(this.target instanceof wi){const h=t.coordinates[s];if(!h)return;const d=h.length>1&&h[0][0]===h[h.length-1][0]&&h[0][1]===h[h.length-1][1],m=d?4:3;if(h.length<=m){console.warn("[FeatureEditHandler] Polygon ring requires at least 3 vertices");return}a=h[n],h.splice(n,1),d&&n===0&&h.length>0&&(h[h.length-1]=[...h[0]])}else return;this.target._onPositionChanged(!0),i.remove(),this._handles.splice(e,1),this._updateHandleIndices(),this._addHistory(t.coordinates),this.target.trigger("handleremove",{index:n,ringIndex:s,coordinate:a})}_createLineStringMiddleHandles(e,t){for(let i=0;i<e.length-1;i++){const n=e[i],s=e[i+1],a=[(n[0]+s[0])/2,(n[1]+s[1])/2,((n[2]||0)+(s[2]||0))/2],c=t.geo2world(new p.Vector3(a[0],a[1],a[2])),h=new Vr({position:c,index:i,symbol:1,size:this.options.handleSize,color:this._middleHandleColor,opacity:.6},t);h.on("dragstart",d=>{this._onMiddleHandleClick(i,"LineString",0)}),this._middleHandles.push(h)}}_createPolygonMiddleHandles(e,t,i){const n=e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]?e.length-1:e.length;for(let s=0;s<n;s++){const a=(s+1)%n,c=e[s],h=e[a],d=[(c[0]+h[0])/2,(c[1]+h[1])/2,((c[2]||0)+(h[2]||0))/2],m=i.geo2world(new p.Vector3(d[0],d[1],d[2])),f=new Vr({position:m,index:s,symbol:1,size:this.options.handleSize,color:this._middleHandleColor,opacity:.6},i);f._ringIndex=t,f.on("dragstart",g=>{this._onMiddleHandleClick(s,"Polygon",t)}),this._middleHandles.push(f)}}_onMiddleHandleClick(e,t,i){const n=this.target._geometry;if(this._getMap()){if(t==="LineString"){const a=n.coordinates,c=a[e],h=a[e+1],d=[(c[0]+h[0])/2,(c[1]+h[1])/2,((c[2]||0)+(h[2]||0))/2];a.splice(e+1,0,d)}else if(t==="Polygon"){const c=n.coordinates[i];if(!c)return;const h=c[0][0]===c[c.length-1][0]&&c[0][1]===c[c.length-1][1]?c.length-1:c.length,d=(e+1)%h,m=c[e],f=c[d],g=[(m[0]+f[0])/2,(m[1]+f[1])/2,((m[2]||0)+(f[2]||0))/2];c.splice(e+1,0,g),c.length>1&&c[0][0]===c[c.length-1][0]&&c[0][1]===c[c.length-1][1]&&e===h-1&&(c[c.length-1]=[...c[0]])}this.target._onPositionChanged(!0),this._clearHandles(),this._createHandles(),this._addHistory(n.coordinates),this.target.trigger("vertexinsert",{index:e+1,ringIndex:i})}}_updateHandleIndices(){if(this.target instanceof Lt)this._handles.forEach((e,t)=>{e._index=t});else if(this.target instanceof wi){let e=0;this.target._geometry.coordinates.forEach((n,s)=>{const a=n[0][0]===n[n.length-1][0]&&n[0][1]===n[n.length-1][1]?n.length-1:n.length;for(let c=0;c<a;c++)this._handles[e]&&(this._handles[e]._index=c,this._handles[e]._ringIndex=s),e++})}}_fixHandlePointCoordinates(e,t,i=0){const n=this._getMap();if(!n)return e;const s=this.target._geometry;let a=null;if(this.target instanceof ni)a=s.coordinates;else if(this.target instanceof Lt)a=s.coordinates[t];else if(this.target instanceof wi){const h=s.coordinates;h[i]&&h[i][t]&&(a=h[i][t])}if(!a||!a[2]||a[2]===0)return n.world2geo(e);const c=n.world2geo(e);return c.z=a[2],c}_getMap(){return this.target.getMap()}remove(){this.disable(),this._history=[],this._historyIndex=-1,this._shadow=null,this._shadowSnapshot=null,this._boundOnMapMouseMove=null,this._boundOnMapClick=null,this._boundOnMapMouseDown=null}}dt.prototype.startEdit=function(r){return this.options?.editable?(this._editor&&this.endEdit(),this._editor=new vy(this,r),this._editor.enable(),this):(console.warn("Feature is not editable. Set editable option to true."),this)},dt.prototype.endEdit=function(){return this._editor&&(this._editor.disable(),this._editor.remove(),delete this._editor),this},dt.prototype.isEditing=function(){return this._editor?this._editor.isEditing():!1},dt.prototype.cancelEdit=function(){return this._editor&&this._editor.cancel(),this},dt.prototype.undoEdit=function(){return this._editor&&this._editor.undo(),this},dt.prototype.redoEdit=function(){return this._editor&&this._editor.redo(),this};function bs(r,e){if(!r||r===!0)return!0;if(!Array.isArray(r))return!!r;switch(r[0]){case"all":return r.slice(1).every(i=>bs(i,e));case"any":return r.slice(1).some(i=>bs(i,e));case"!":return!bs(r[1],e);case"==":{const i=ze(r[1],e),n=ze(r[2],e);return xs(i)==xs(n)}case"!=":{const i=ze(r[1],e),n=ze(r[2],e);return xs(i)!=xs(n)}case">":{const i=ze(r[1],e),n=ze(r[2],e);return Hi(i)>Hi(n)}case"<":{const i=ze(r[1],e),n=ze(r[2],e);return Hi(i)<Hi(n)}case">=":{const i=ze(r[1],e),n=ze(r[2],e);return Hi(i)>=Hi(n)}case"<=":{const i=ze(r[1],e),n=ze(r[2],e);return Hi(i)<=Hi(n)}case"in":{const i=ze(r[1],e);return r.slice(2).map(s=>ze(s,e)).includes(i)}case"!in":{const i=ze(r[1],e);return!r.slice(2).map(s=>ze(s,e)).includes(i)}case"has":{const i=r[1];return e!=null&&Object.prototype.hasOwnProperty.call(e,i)}case"!has":{const i=r[1];return!(e!=null&&Object.prototype.hasOwnProperty.call(e,i))}case"like":case"contains":{const i=ze(r[1],e),n=ze(r[2],e);return String(i).toLowerCase().includes(String(n).toLowerCase())}case"starts-with":{const i=ze(r[1],e),n=ze(r[2],e);return String(i).toLowerCase().startsWith(String(n).toLowerCase())}case"ends-with":{const i=ze(r[1],e),n=ze(r[2],e);return String(i).toLowerCase().endsWith(String(n).toLowerCase())}default:return!0}}function ze(r,e){if(Array.isArray(r))switch(r[0]){case"get":return e?e[r[1]]:void 0;default:return r}return r}function xs(r){if(r==null)return null;if(typeof r=="string"){const e=Number(r);if(!isNaN(e)&&r.trim()!=="")return e}return typeof r=="boolean"?r?1:0:r}function Hi(r){if(r==null)return 0;if(typeof r=="number")return r;if(typeof r=="boolean")return r?1:0;if(typeof r=="string"){const e=Number(r);return isNaN(e)?0:e}return Number(r)}var wy=Object.defineProperty,by=(r,e,t)=>e in r?wy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,It=(r,e,t)=>by(r,typeof e!="symbol"?e+"":e,t);class Ms extends ji{constructor(e,t){super(e,t),It(this,"TILE_SIZE"),It(this,"EXTENT"),It(this,"style"),It(this,"interactive",!1),It(this,"_tileFeatureMap",new Map),It(this,"_activeFeatureFilter"),It(this,"_layerStyleMapCache",null),It(this,"_lastBuiltStyleMap",null),It(this,"_addedFeatureIds",new Set),It(this,"_styleInstanceCache",new Map),It(this,"_totalProcessTime",0),It(this,"_processCount",0),It(this,"_totalFeatureCount",0),this.TILE_SIZE=t.tileSize??256,this.EXTENT=t.extent??4096,this.style=t.style||[],this._onMapUpdate=this._onMapUpdate.bind(this)}getProcessStats(){return{totalTime:this._totalProcessTime,processCount:this._processCount,totalFeatures:this._totalFeatureCount,avgTime:this._processCount>0?this._totalProcessTime/this._processCount:0}}resetProcessStats(){this._totalProcessTime=0,this._processCount=0,this._totalFeatureCount=0}processTileData(e,t){const i=this.getMap(),n=`${e.z}-${e.x}-${e.y}`,s=performance.now(),a=this._tileFeatureMap.get(n);if(a&&a.length>0){for(let w=0;w<a.length;w++){const b=a[w];b.visible=!0,this._addedFeatureIds.has(b.uuid)||(b.addTo(this),this._addedFeatureIds.add(b.uuid))}return}const c=t.vectorData;if(!c||!c.layers||!i||this.style.length===0)return;const h=[],d=this.style,m=this._activeFeatureFilter;let f=this._layerStyleMapCache;(!f||f!==this._lastBuiltStyleMap)&&(f=this._buildLayerStyleMap(d),this._layerStyleMapCache=f,this._lastBuiltStyleMap=f);let g=0;Object.keys(c.layers).forEach(w=>{const b=c.layers[w],x=f.get(w)||d;for(let L=0;L<b.length;L++){g++;const M=b[L],C=M.geometry,W=M.properties;if(m&&!m(W))continue;let D=null;for(let z=0;z<x.length;z++){const X=x[z];if(this._evaluateFilter(X.filter,W,w,M.geometry.type)){D=X.style;break}}if(D){const z={isVectorTile:!0,tileZ:e.z,tileX:e.x,tileY:e.y,rawCoordinates:C,extent:this.EXTENT,tileSize:this.TILE_SIZE},X=this._createFeatureInstance(M.geometry,M.geometry.type,D,{layerName:w,...M.properties});if(X){X.userData.tileData=z;const I=JSON.stringify(D);let U=this._styleInstanceCache.get(I);U||(U=St.create(D),this._styleInstanceCache.set(I,U)),X.style=U,X.addTo(this),this._addedFeatureIds.add(X.uuid),X.initializeGeometry(),h.push(X)}}}}),this._tileFeatureMap.set(n,h);const _=performance.now()-s;this._totalProcessTime+=_,this._processCount++,this._totalFeatureCount+=h.length,this.interactive&&console.log(`[processTileData] ${n} 处理 (${g} -> ${h.length} features) 耗时: ${_.toFixed(2)}ms | 累计: ${this._totalProcessTime.toFixed(2)}ms (${this._processCount}次, ${this._totalFeatureCount}个feature)`)}_evaluateFilter(e,t,i,n){if(!e||e===!0)return!0;const s={...t,$layer:i,$type:n};return bs(e,s)}_buildLayerStyleMap(e){const t=new Map;for(let i=0;i<e.length;i++){const n=e[i],s=n.filter;if(s&&typeof s=="object"&&s.$layer){const a=Array.isArray(s.$layer)?s.$layer[0]:s.$layer;t.has(a)||t.set(a,[]),t.get(a).push(n)}}return t}hideFeaturesByTileKey(e){const t=this._tileFeatureMap.get(e);t&&t.forEach(i=>{i.visible=!1})}removeFeaturesByTileKey(e){this._removeFeaturesByTileKey(e)}_removeFeaturesByTileKey(e){const t=this._tileFeatureMap.get(e);if(t){for(let i=0;i<t.length;i++){const n=t[i];this._addedFeatureIds.delete(n.uuid),n._remove()}this._tileFeatureMap.delete(e)}}_createFeatureInstance(e,t,i,n){const a={geometry:{ismvt:!0,...e},style:i,userData:n};switch(t){case"Point":return new Ti(a);case"LineString":return new Lt(a);default:return null}}setFeatureFilter(e){this._activeFeatureFilter=e}clearFeatureFilter(){this._activeFeatureFilter=void 0}setOpacity(e){this.opacity=e,this._tileFeatureMap.forEach(t=>{t.forEach(i=>{i.material&&(i.material.opacity=e,i.material.transparent=e<1)})})}_onMapUpdate(){}updateStyle(e,t){if(!e||!Array.isArray(e)){console.warn("[VectorTileRenderLayer] updateStyle called with invalid style rules.");return}this._layerStyleMapCache=null,this._lastBuiltStyleMap=null,this.style=e,this._tileFeatureMap.forEach((i,n)=>{const s=t.get(n);if(!s||!s.data||!s.data.vectorData)return;const a=s.data.vectorData;i.forEach(c=>{const h=c.userData,d=c.userData.tileData?.rawCoordinates?.type;let m="";if(a&&a.layers){for(const[g,_]of Object.entries(a.layers))if(_.some(b=>b.properties===h||JSON.stringify(b.properties)===JSON.stringify(h))){m=g;break}}if(this._activeFeatureFilter&&!this._activeFeatureFilter(h)){c.visible=!1;return}let f=null;for(const g of e)if(this._evaluateFilter(g.filter,h,m,d)){f=g.style;break}f?(this._applyStyleToFeature(c,f),c.visible=!0):c.visible=!1})})}_applyStyleToFeature(e,t){e.style=St.create(t),e.initializeGeometry()}validateFeature(e){return e instanceof dt}dispose(){this._tileFeatureMap.forEach((e,t)=>{this._removeFeaturesByTileKey(t)})}}var xy=Object.defineProperty,My=(r,e,t)=>e in r?xy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Pt=(r,e,t)=>My(r,typeof e!="symbol"?e+"":e,t);class hh extends Pr{constructor(e,t){super(e,t),this.layerId=e,Pt(this,"isTileLayer",!0),Pt(this,"layerType","base"),Pt(this,"isBaseLayer",!1),Pt(this,"_enabled",!0),Pt(this,"_visible",!0),Pt(this,"_rootTile"),Pt(this,"_loader"),Pt(this,"_LODThreshold",1),Pt(this,"isSceneLayer",!1),Pt(this,"opacity",1),Pt(this,"source"),Pt(this,"projection"),Pt(this,"minLevel",2),Pt(this,"maxLevel",19),this.source=t.source,this.projection=t.projection,this.minLevel=t.minLevel??2,this.maxLevel=t.maxLevel??19,this._LODThreshold=t.LODThreshold??1,this.opacity=t.opacity??1,this.name=`Layer-${e}`,this._loader=this.createLoader(),this._rootTile=new Ri,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(t=>{t.isTile&&t.loaded&&(e=Math.max(e,t.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}}var Sy=Object.defineProperty,Ly=(r,e,t)=>e in r?Sy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Py=(r,e,t)=>Ly(r,e+"",t);class uh extends p.LoadingManager{constructor(){super(...arguments),Py(this,"onParseEnd")}parseEnd(e){this.onParseEnd&&this.onParseEnd(e)}}const De={manager:new uh,demLoaderMap:new Map,meshLoaderMap:new Map,imgLoaderMap:new Map,registerMaterialLoader(r){De.imgLoaderMap.set(r.dataType,r),r.info.author=r.info.author??xo.name},registerGeometryLoader(r){De.demLoaderMap.set(r.dataType,r),r.info.author=r.info.author??xo.name},registerMeshLoader(r){De.meshLoaderMap.set(r.dataType,r),r.info.author=r.info.author??xo.name},getMaterialLoader(r){const e=De.imgLoaderMap.get(r.dataType);if(e)return e;throw`Source dataType "${r.dataType}" is not support!`},getGeometryLoader(r){const e=De.demLoaderMap.get(r.dataType);if(e)return e;throw`Source dataType "${r.dataType}" is not support!`},getMeshLoader(r){const e=De.meshLoaderMap.get(r.dataType);if(e)return e;throw`Source dataType "${r.dataType}" is not support!`}};var Cy=Object.defineProperty,Ty=(r,e,t)=>e in r?Cy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Gy=(r,e,t)=>Ty(r,e+"",t);class Wy{constructor(e){Gy(this,"worker"),this.worker=e()}async run(e,t){return new Promise(i=>{this.worker.onmessage=n=>{i(n.data)},this.worker.postMessage(e,t)})}terminate(){this.worker.terminate()}}const Zy=4096,dh=Math.PI;function oa(r,e){const t=Math.floor(r[0]*e),i=Math.floor(r[1]*e),n=Math.floor((r[2]-r[0])*e),s=Math.floor((r[3]-r[1])*e);return{sx:t,sy:i,sw:n,sh:s}}function aa(r,e,t,i){if(i<r.minLevel)return{url:void 0,clipBounds:[0,0,1,1]};if(i<=r.maxLevel)return{url:r._getUrl(e,t,i),clipBounds:[0,0,1,1]};const n=Vy(e,t,i,r.maxLevel),s=n.parentNO;return{url:r._getUrl(s.x,s.y,s.z),clipBounds:n.bounds}}function Vy(r,e,t,i){const n=t-i,s={x:r>>n,y:e>>n,z:t-n},a=Math.pow(2,n),c=Math.pow(.5,n),h=r%a/a-.5+c/2,d=e%a/a-.5+c/2,m=new p.Vector2(h,d),f=new p.Box2().setFromCenterAndSize(m,new p.Vector2(c,c)),g=[f.min.x+.5,f.min.y+.5,f.max.x+.5,f.max.y+.5];return{parentNO:s,bounds:g}}function la(r,e,t,i,n=Zy){const{x:s,y:a}=r,c=(e+s/n)/Math.pow(2,i),h=(t+a/n)/Math.pow(2,i),d=c*360-180,f=Math.atan(Math.sinh(dh*(1-2*h)))*180/dh;return[parseFloat(d.toFixed(8)),parseFloat(f.toFixed(8))]}function Iy(r,e,t,i){if(!r||!r.coordinates)throw new Error("无效的geometry数据格式");const n={type:r.type,coordinates:null};function s(a){if(typeof a=="object"&&a.x!==void 0&&a.y!==void 0)return la(a,e,t,i);if(Array.isArray(a)&&a.length>0){const c=a[0];return typeof c=="object"&&c.x!==void 0&&c.y!==void 0?a.map(h=>la(h,e,t,i)):a.map(h=>s(h))}return a}return n.coordinates=s(r.coordinates),n}var Ay=Object.defineProperty,Fy=(r,e,t)=>e in r?Ay(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ss=(r,e,t)=>Fy(r,typeof e!="symbol"?e+"":e,t);class Ls{constructor(){Ss(this,"_imgSource",[]),Ss(this,"_demSource"),Ss(this,"_vtSource"),Ss(this,"manager",De.manager)}get imgSource(){return this._imgSource}set imgSource(e){this._imgSource=e}get demSource(){return this._demSource}set demSource(e){this._demSource=e}get vtSource(){return this._vtSource}set vtSource(e){this._vtSource=e}async load(e){const t=await this.loadGeometry(e),i=await this.loadMaterial(e);console.assert(!!i&&!!t);for(let n=0;n<i.length;n++)t.addGroup(0,1/0,n);return{materials:i,geometry:t}}unload(e){const t=e.material,i=e.geometry;for(let n=0;n<t.length;n++)t[n].dispose();i.dispose()}async loadGeometry(e){let t;if(this.demSource&&e.z>=this.demSource.minLevel&&this._isBoundsInSourceBounds(this.demSource,e.bounds)){const i=De.getGeometryLoader(this.demSource),n=this.demSource;t=await i.load({source:n,...e}).catch(s=>(console.error("Load material error",n.dataType,e.x,e.y,e.z),new p.PlaneGeometry)),t.addEventListener("dispose",()=>{i.unload&&i.unload(t)})}else if(this.vtSource&&e.z>=this.vtSource.minLevel&&this._isBoundsInSourceBounds(this.vtSource,e.bounds)){const i=De.getMeshLoader(this.vtSource),n=this.vtSource;t=await i.load({source:n,...e}).catch(s=>(console.error("Load geometry error",n.dataType,e.x,e.y,e.z),new p.PlaneGeometry)),t.addEventListener("dispose",()=>{i.unload&&i.unload(t)})}else t=new p.PlaneGeometry;return t}async loadMaterial(e){const i=this.imgSource.filter(n=>e.z>=n.minLevel&&this._isBoundsInSourceBounds(n,e.bounds)).map(async n=>{const s=De.getMaterialLoader(n),a=await s.load({source:n,...e}).catch(h=>(console.error("Load material error",n.dataType,e.x,e.y,e.z),new p.MeshBasicMaterial)),c=h=>{s.unload&&s.unload(h.target),h.target.removeEventListener("dispose",c)};return a instanceof p.MeshBasicMaterial||a.addEventListener("dispose",c),a});return Promise.all(i)}_isBoundsInSourceBounds(e,t){const i=e._projectionBounds;return!(t[2]<i[0]||t[3]<i[1]||t[0]>i[2]||t[1]>i[3])}}function Ir(...r){const e=r,t=e&&e.length>1&&e[0].constructor||null;if(!t)throw new Error("concatenateTypedArrays - incorrect quantity of arguments or arguments have incompatible data types");const i=e.reduce((a,c)=>a+c.length,0),n=new t(i);let s=0;for(const a of e)n.set(a,s),s+=a.length;return n}function fh(r,e,t,i){const n=i?zy(i,r.position.value):Oy(e),s=n.length,a=new Float32Array(s*6),c=new Float32Array(s*4),h=new e.constructor(s*6),d=new Float32Array(s*6);for(let f=0;f<s;f++)Dy({edge:n[f],edgeIndex:f,attributes:r,skirtHeight:t,newPosition:a,newTexcoord0:c,newTriangles:h,newNormals:d});r.position.value=Ir(r.position.value,a),r.texcoord.value=Ir(r.texcoord.value,c),r.normal.value=Ir(r.normal.value,d);const m=Ir(e,h);return{attributes:r,indices:m}}function Oy(r){const e=[],t=Array.isArray(r)?r:Array.from(r);for(let n=0;n<t.length;n+=3){const s=t[n],a=t[n+1],c=t[n+2];e.push([s,a],[a,c],[c,s])}e.sort(([n,s],[a,c])=>{const h=Math.min(n,s),d=Math.min(a,c);return h!==d?h-d:Math.max(n,s)-Math.max(a,c)});const i=[];for(let n=0;n<e.length;n++)n+1<e.length&&e[n][0]===e[n+1][1]&&e[n][1]===e[n+1][0]?n++:i.push(e[n]);return i}function zy(r,e){const t=(n,s)=>{n.sort(s)};t(r.westIndices,(n,s)=>e[3*n+1]-e[3*s+1]),t(r.eastIndices,(n,s)=>e[3*s+1]-e[3*n+1]),t(r.southIndices,(n,s)=>e[3*s]-e[3*n]),t(r.northIndices,(n,s)=>e[3*n]-e[3*s]);const i=[];return Object.values(r).forEach(n=>{if(n.length>1)for(let s=0;s<n.length-1;s++)i.push([n[s],n[s+1]])}),i}function Dy({edge:r,edgeIndex:e,attributes:t,skirtHeight:i,newPosition:n,newTexcoord0:s,newTriangles:a,newNormals:c}){const h=t.position.value.length,d=e*2,m=d+1;n.set(t.position.value.subarray(r[0]*3,r[0]*3+3),d*3),n[d*3+2]=n[d*3+2]-i,n.set(t.position.value.subarray(r[1]*3,r[1]*3+3),m*3),n[m*3+2]=n[m*3+2]-i,s.set(t.texcoord.value.subarray(r[0]*2,r[0]*2+2),d*2),s.set(t.texcoord.value.subarray(r[1]*2,r[1]*2+2),m*2);const f=e*2*3;a[f]=r[0],a[f+1]=h/3+m,a[f+2]=r[1],a[f+3]=h/3+m,a[f+4]=r[0],a[f+5]=h/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 ph(r){if(r.length<4)throw new Error(`DEM数组长度必须大于4,当前长度: ${r.length}!`);const e=Math.floor(Math.sqrt(r.length)),t=e,i=e,n=ca(i,t);return{attributes:Xy(r,i,t),indices:n}}function Xy(r,e,t){const i=t*e,n=new Float32Array(i*3),s=new Float32Array(i*2);let a=0;for(let c=0;c<e;c++)for(let h=0;h<t;h++){const d=h/(t-1),m=c/(e-1);s[a*2]=d,s[a*2+1]=m,n[a*3]=d-.5,n[a*3+1]=m-.5,n[a*3+2]=r[(e-c-1)*t+h],a++}return{position:{value:n,size:3},texcoord:{value:s,size:2},normal:{value:ha(n,ca(e,t)),size:3}}}function ca(r,e){const t=6*(e-1)*(r-1),i=new Uint16Array(t);let n=0;for(let s=0;s<r-1;s++)for(let a=0;a<e-1;a++){const c=s*e+a,h=c+1,d=c+e,m=d+1,f=n*6;i[f]=c,i[f+1]=h,i[f+2]=d,i[f+3]=d,i[f+4]=h,i[f+5]=m,n++}return i}function ha(r,e){const t=new Float32Array(r.length);for(let i=0;i<e.length;i+=3){const n=e[i]*3,s=e[i+1]*3,a=e[i+2]*3,c=r[n],h=r[n+1],d=r[n+2],m=r[s],f=r[s+1],g=r[s+2],_=r[a],w=r[a+1],b=r[a+2],x=m-c,L=f-h,M=g-d,C=_-c,W=w-h,D=b-d,z=L*D-M*W,X=M*C-x*D,I=x*W-L*C,U=Math.sqrt(z*z+X*X+I*I),V=[0,0,1];if(U>0){const G=1/U;V[0]=z*G,V[1]=X*G,V[2]=I*G}for(let G=0;G<3;G++)t[n+G]=t[s+G]=t[a+G]=V[G]}return t}var ky=Object.defineProperty,Uy=(r,e,t)=>e in r?ky(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ny=(r,e,t)=>Uy(r,e+"",t);class jn extends p.PlaneGeometry{constructor(){super(...arguments),Ny(this,"type","TileGeometry")}setData(e,t=1e3){let i=e instanceof Float32Array?ph(e):e;i=fh(i.attributes,i.indices,t);const{attributes:n,indices:s}=i;return this.setIndex(new p.BufferAttribute(s,1)),this.setAttribute("position",new p.BufferAttribute(n.position.value,n.position.size)),this.setAttribute("uv",new p.BufferAttribute(n.texcoord.value,n.texcoord.size)),this.setAttribute("normal",new p.BufferAttribute(n.normal.value,n.normal.size)),this.computeBoundingBox(),this.computeBoundingSphere(),this}}var Ky=Object.defineProperty,By=(r,e,t)=>e in r?Ky(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,$i=(r,e,t)=>By(r,typeof e!="symbol"?e+"":e,t);class mh{constructor(e=257){$i(this,"gridSize"),$i(this,"numTriangles"),$i(this,"numParentTriangles"),$i(this,"indices"),$i(this,"coords"),this.gridSize=e;const t=e-1;if(t&t-1)throw new Error(`Expected grid size to be 2^n+1, got ${e}.`);this.numTriangles=t*t*2-2,this.numParentTriangles=this.numTriangles-t*t,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(this.numTriangles*4);for(let i=0;i<this.numTriangles;i++){let n=i+2,s=0,a=0,c=0,h=0,d=0,m=0;for(n&1?c=h=d=t:s=a=m=t;(n>>=1)>1;){const g=s+c>>1,_=a+h>>1;n&1?(c=s,h=a,s=d,a=m):(s=c,a=h,c=d,h=m),d=g,m=_}const f=i*4;this.coords[f+0]=s,this.coords[f+1]=a,this.coords[f+2]=c,this.coords[f+3]=h}}createTile(e){return new Yy(e,this)}}class Yy{constructor(e,t){$i(this,"martini"),$i(this,"terrain"),$i(this,"errors");const i=t.gridSize;if(e.length!==i*i)throw new Error(`Expected terrain data of length ${i*i} (${i} x ${i}), got ${e.length}.`);this.terrain=e,this.martini=t,this.errors=new Float32Array(e.length),this.update()}update(){const{numTriangles:e,numParentTriangles:t,coords:i,gridSize:n}=this.martini,{terrain:s,errors:a}=this;for(let c=e-1;c>=0;c--){const h=c*4,d=i[h+0],m=i[h+1],f=i[h+2],g=i[h+3],_=d+f>>1,w=m+g>>1,b=_+w-m,x=w+d-_,L=(s[m*n+d]+s[g*n+f])/2,M=w*n+_,C=Math.abs(L-s[M]);if(a[M]=Math.max(a[M],C),c<t){const W=(m+x>>1)*n+(d+b>>1),D=(g+x>>1)*n+(f+b>>1);a[M]=Math.max(a[M],a[W],a[D])}}}getGeometryData(e=0){const{gridSize:t,indices:i}=this.martini,{errors:n}=this;let s=0,a=0;const c=t-1;let h,d,m=0;i.fill(0);function f(M,C,W,D,z,X){const I=M+W>>1,U=C+D>>1;Math.abs(M-z)+Math.abs(C-X)>1&&n[U*t+I]>e?(f(z,X,M,C,I,U),f(W,D,z,X,I,U)):(h=C*t+M,d=D*t+W,m=X*t+z,i[h]===0&&(i[h]=++s),i[d]===0&&(i[d]=++s),i[m]===0&&(i[m]=++s),a++)}f(0,0,c,c,c,0),f(c,c,0,0,0,c);const g=s*2,_=a*3,w=new Uint16Array(g),b=new Uint32Array(_);let x=0;function L(M,C,W,D,z,X){const I=M+W>>1,U=C+D>>1;if(Math.abs(M-z)+Math.abs(C-X)>1&&n[U*t+I]>e)L(z,X,M,C,I,U),L(W,D,z,X,I,U);else{const V=i[C*t+M]-1,G=i[D*t+W]-1,N=i[X*t+z]-1;w[2*V]=M,w[2*V+1]=C,w[2*G]=W,w[2*G+1]=D,w[2*N]=z,w[2*N+1]=X,b[x++]=V,b[x++]=G,b[x++]=N}}return L(0,0,c,c,c,0),L(c,c,0,0,0,c),{attributes:this._getMeshAttributes(this.terrain,w,b),indices:b}}_getMeshAttributes(e,t,i){const n=Math.floor(Math.sqrt(e.length)),s=n-1,a=t.length/2,c=new Float32Array(a*3),h=new Float32Array(a*2);for(let m=0;m<a;m++){const f=t[m*2],g=t[m*2+1],_=g*n+f;c[3*m+0]=f/s-.5,c[3*m+1]=.5-g/s,c[3*m+2]=e[_],h[2*m+0]=f/s,h[2*m+1]=1-g/s}const d=ha(c,i);return{position:{value:c,size:3},texcoord:{value:h,size:2},normal:{value:d,size:3}}}}var Ry=Object.defineProperty,jy=(r,e,t)=>e in r?Ry(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,gh=(r,e,t)=>jy(r,typeof e!="symbol"?e+"":e,t);class ua{constructor(){gh(this,"info",{version:"0.10.0",description:"Terrain loader base class"}),gh(this,"dataType","")}async load(e){const{source:t,x:i,y:n,z:s}=e,{url:a,clipBounds:c}=aa(t,i,n,s);if(!a)return new jn;const h=await this.doLoad(a,{source:t,x:i,y:n,z:s,bounds:c});return De.manager.parseEnd(a),h}}class da extends p.MeshStandardMaterial{constructor(e={}){super({transparent:!0,side:p.FrontSide,...e})}setTexture(e){this.map=e,this.needsUpdate=!0}dispose(){const e=this.map;e&&(e.image instanceof ImageBitmap&&e.image.close(),e.dispose())}}var rt=(r=>(r[r.Unknown=0]="Unknown",r[r.Point=1]="Point",r[r.Linestring=2]="Linestring",r[r.Polygon=3]="Polygon",r))(rt||{});class yh{render(e,t,i,n,s=1){switch(e.lineCap="round",e.lineJoin="round",(n.shadowBlur??0)>0&&(e.shadowBlur=n.shadowBlur??2,e.shadowColor=n.shadowColor??"black",e.shadowOffsetX=n.shadowOffset?n.shadowOffset[0]:0,e.shadowOffsetY=n.shadowOffset?n.shadowOffset[1]:0),t){case rt.Point:e.textAlign="center",e.textBaseline="middle",e.font=n.font??"14px Arial",e.fillStyle=n.fontColor??"white",this._renderPointText(e,i,s,n.textField??"name",n.fontOffset??[0,-8]);break;case rt.Linestring:this._renderLineString(e,i,s);break;case rt.Polygon:this._renderPolygon(e,i,s);break;default:console.warn(`Unknown feature type: ${t}`)}(n.fill||t===rt.Point)&&(e.globalAlpha=n.fillOpacity||.5,e.fillStyle=n.fillColor||n.color||"#3388ff",e.fill(n.fillRule||"evenodd")),(n.stroke??!0)&&(n.weight??1)>0&&(e.globalAlpha=n.opacity||1,e.lineWidth=n.weight||1,e.strokeStyle=n.color||"#3388ff",e.setLineDash(n.dashArray||[]),e.stroke())}_renderPointText(e,t,i=1,n="name",s=[0,0]){const a=t.geometry;e.beginPath();for(const h of a)for(let d=0;d<h.length;d++){const m=h[d];e.arc(m.x*i,m.y*i,2,0,2*Math.PI)}const c=t.properties;c&&c[n]&&e.fillText(c[n],a[0][0].x*i+s[0],a[0][0].y*i+s[1])}_renderLineString(e,t,i){const n=t.geometry;e.beginPath();for(const s of n)for(let a=0;a<s.length;a++){const{x:c,y:h}=s[a];a===0?e.moveTo(c*i,h*i):e.lineTo(c*i,h*i)}}_renderPolygon(e,t,i){const n=t.geometry;e.beginPath();for(let s=0;s<n.length;s++){const a=n[s];for(let c=0;c<a.length;c++){const{x:h,y:d}=a[c];c===0?e.moveTo(h*i,d*i):e.lineTo(h*i,d*i)}e.closePath()}}}var Jy=Object.defineProperty,Qy=(r,e,t)=>e in r?Jy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,_h=(r,e,t)=>Qy(r,typeof e!="symbol"?e+"":e,t);class fa{constructor(){_h(this,"info",{version:"0.10.0",description:"Image loader base class"}),_h(this,"dataType","")}async load(e){const{source:t,x:i,y:n,z:s}=e,a=new da({}),{url:c,clipBounds:h}=aa(t,i,n,s);if(c){const d=await this.doLoad(c,{source:t,x:i,y:n,z:s,bounds:h});a.map=d,De.manager.parseEnd(c)}return a}}var Hy=Object.defineProperty,$y=(r,e,t)=>e in r?Hy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,vh=(r,e,t)=>$y(r,typeof e!="symbol"?e+"":e,t);class Ey{constructor(){vh(this,"info",{version:"0.10.0",description:"Canvas tile abstract loader"}),vh(this,"dataType","")}async load(e){const t=this._creatCanvasContext(256,256);this.drawTile(t,e);const i=new p.CanvasTexture(t.canvas.transferToImageBitmap());return new da({transparent:!0,map:i,opacity:e.source.opacity})}_creatCanvasContext(e,t){const n=new OffscreenCanvas(e,t).getContext("2d");if(!n)throw new Error("create canvas context failed");return n.scale(1,-1),n.translate(0,-t),n}}var qy=Object.defineProperty,e_=(r,e,t)=>e in r?qy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,pa=(r,e,t)=>e_(r,typeof e!="symbol"?e+"":e,t);class t_ extends fa{constructor(){super(...arguments),pa(this,"info",{version:"0.10.0",description:"Tile image loader. It can load xyz tile image."}),pa(this,"dataType","image"),pa(this,"loader",new p.ImageLoader(De.manager))}async doLoad(e,t){const i=await this.loader.loadAsync(e).catch(a=>new Image(1,1)),n=new p.Texture;n.colorSpace=p.SRGBColorSpace;const{bounds:s}=t;return s[2]-s[0]<1?n.image=i_(i,s):n.image=i,n.needsUpdate=!0,n}}function i_(r,e){const t=r.width,i=new OffscreenCanvas(t,t),n=i.getContext("2d"),{sx:s,sy:a,sw:c,sh:h}=oa(e,r.width);return n.drawImage(r,s,a,c,h,0,0,t,t),i}const n_=`{
656
1123
  "name": "@terra.gl/core",
657
- "version": "0.0.1-alpha.7",
1124
+ "version": "0.0.1-alpha.71",
658
1125
  "type": "module",
659
1126
  "files": [
660
1127
  "dist"
@@ -670,10 +1137,10 @@ function print() { __p += __j.call(arguments, '') }
670
1137
  }
671
1138
  },
672
1139
  "author": {
673
- "name": "criska"
1140
+ "name": "Criska"
674
1141
  },
675
1142
  "description": "a map using threejs",
676
- "license": "MIT",
1143
+ "license": "Apache-2.0",
677
1144
  "keywords": [
678
1145
  "three",
679
1146
  "gis",
@@ -685,8 +1152,11 @@ function print() { __p += __j.call(arguments, '') }
685
1152
  ],
686
1153
  "scripts": {
687
1154
  "dev": "vite build --watch",
688
- "build": "tsc && vite build",
689
- "doc": "npx typedoc --options typedoc.json"
1155
+ "build": "tsc && vite build && node copy-extra-to-dist.cjs",
1156
+ "docs:build-plugin": "tsc --project docs/typedoc-plugins",
1157
+ "docs:generate": "npx rimraf docs/jsdoc && npx tsc --noEmit false --declaration false --outDir dist-docs-temp --removeComments false && npx jsdoc -c jsdoc.json && npx rimraf dist-docs-temp",
1158
+ "docs:typedoc": "npx typedoc --options typedoc.json",
1159
+ "changelog": "npx conventional-changelog-cli -p angular -i CHANGELOG.md -s --commit-path ."
690
1160
  },
691
1161
  "peerDependencies": {
692
1162
  "three": "^0.171.0"
@@ -698,10 +1168,6 @@ function print() { __p += __j.call(arguments, '') }
698
1168
  "dependencies": {
699
1169
  "@mapbox/vector-tile": "^2.0.4",
700
1170
  "@pmndrs/vanilla": "^1.20.4",
701
- "@takram/three-atmosphere": "^0.11.2",
702
- "@takram/three-clouds": "^0.2.2",
703
- "@takram/three-geospatial": "^0.2.1",
704
- "@takram/three-geospatial-effects": "^0.3.1",
705
1171
  "@types/earcut": "^3.0.0",
706
1172
  "@types/geojson": "^7946.0.16",
707
1173
  "d3-quadtree": "^3.0.1",
@@ -714,10 +1180,19 @@ function print() { __p += __j.call(arguments, '') }
714
1180
  "devDependencies": {
715
1181
  "@types/lodash": "^4.17.20",
716
1182
  "@types/node": "^24.2.0",
1183
+ "jsdoc": "^4.0.5",
1184
+ "rimraf": "^6.1.2",
717
1185
  "typedoc": "^0.28.8",
718
- "typedoc-plugin-markdown": "^4.7.1",
719
- "typedoc-vitepress-theme": "^1.0.0-next.0",
1186
+ "typedoc-vitepress-theme": "^1.1.2",
720
1187
  "vue": "^3.5.18"
721
1188
  }
722
1189
  }
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+WiBpbiBqP2NlKGosWix7ZW51bWVyYWJsZTohMCxjb25maWd1cmFibGU6ITAsd3JpdGFibGU6ITAsdmFsdWU6cX0pOmpbWl09cTt2YXIgTj0oaixaLHEpPT5tZShqLHR5cGVvZiBaIT0ic3ltYm9sIj9aKyIiOloscSk7KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGooQSxwKXtjb25zdCBrPW5ldyBGbG9hdDMyQXJyYXkoQS5sZW5ndGgpO2Zvc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HUpe2NvbnN0IG09bmV3IEZsb2F0MzJBcnJheShpKm8pO2ZvcihsZXQgbD0wO2w8bztsKyspZm9yKGxldCBmPTA7ZjxpO2YrKyl7Y29uc3QgZz0obCtoKSp0KyhmK24pLE09bCppK2Y7bVtNXT1zW2ddfWNvbnN0IHc9bmV3IEZsb2F0MzJBcnJheSh1KmMpO2ZvcihsZXQgbD0wO2w8dTtsKyspZm9yKGxldCBmPTA7ZjxjO2YrKyl7Y29uc3QgZz1sKnUrZixNPU1hdGgucm91bmQoZipvL3UpLGQ9TWF0aC5yb3VuZChsKmkvYykqaStNO3dbZ109bVtkXX1yZXR1cm4gd31jb25zdCBVPW9lKHAsQS53aWR0aCksYT1VLnN3KzEsZT1VLnNoKzE7cmV0dXJue2FycmF5OmsoQS5hcnJheSxBLndpZHRoLFUuc3gsVS5zeSxVLnN3LFUuc2gsYSxlKSx3aWR0aDphLGhlaWdodDplfX1mdW5jdGlvbiBvZShBLHApe2NvbnN0IGs9TWF0aC5mbG9vcihBWzBdKnApLFU9TWF0aC5mbG9vcihBWzFdKnApLGE9TWF0aC5mbG9vcigoQVsyXS1BWzBdKSpwKSxlPU1hdGguZmxvb3IoKEFbM10tQVsxXSkqcCk7cmV0dXJue3N4Omssc3k6VSxzdzphLHNoOmV9fXNlbGYub25tZXNzYWdlPUE9Pntjb25zdCBwPUEuZGF0YSxrPXNlKHAuZGVtRGF0YSxwLnoscC5jbGlwQm91bmRzKTtzZWxmLnBvc3RNZXNzYWdlKGspfX0pKCk7Cg==",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+InUiP251bGw6bmV3IFRleHREZWNvZGVyKCJ1dGYtOCIpLGc9MCx5PTEsRj0yLHA9NTtjbGFzcyBN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dCBzPW5ldyBNKGkpLG49bmV3IHoocyksbz17fTtmb3IoY29uc3QgaCBpbiBuLmxheWVycyl7Y29uc3QgYT1uLmxheWVyc1toXSxkPVtdO2ZvcihsZXQgdT0wO3U8YS5sZW5ndGg7dSsrKXtjb25zdCBsPWEuZmVhdHVyZSh1KS50b0dlb0pTT04odCxlLHIpO2QucHVzaChsKX1vW2hdPWR9cmV0dXJuIG99c2VsZi5vbm1lc3NhZ2U9YXN5bmMgaT0+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"})});
1190
+ `;var r_=Object.defineProperty,s_=(r,e,t)=>e in r?r_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,At=(r,e,t)=>s_(r,typeof e!="symbol"?e+"":e,t);class si{constructor(e){At(this,"dataType","image"),At(this,"attribution","isource"),At(this,"minLevel",0),At(this,"maxLevel",18),At(this,"projectionID","3857"),At(this,"url",""),At(this,"subdomains",[]),At(this,"s",""),At(this,"opacity",1),At(this,"isTMS",!1),At(this,"bounds",[-180,-85,180,85]),At(this,"_projectionBounds",[-1/0,-1/0,1/0,1/0]),At(this,"tileMaterial"),Object.assign(this,e)}getUrl(e,t,i){const n={...this,x:e,y:t,z:i};return o_(this.url,n)}_getUrl(e,t,i){const n=this.subdomains.length;if(n>0){const a=Math.floor(Math.random()*n);this.s=this.subdomains[a]}const s=this.isTMS?Math.pow(2,i)-1-t:t;return this.getUrl(e,s,i)}static create(e){return new si(e)}}function o_(r,e){const t=/\{ *([\w_-]+) *\}/g;return r.replace(t,(i,n)=>{const s=e[n]??(()=>{throw new Error(`source url template error, No value provided for variable: ${i}`)})();return typeof s=="function"?s(e):s})}const{version:a_,author:l_}=JSON.parse(n_);function c_(r,e=100){return new Promise(t=>{const i=setInterval(()=>{r&&(clearInterval(i),t())},e)})}function ma(r){return De.registerMaterialLoader(r),r}function ga(r){return De.registerGeometryLoader(r),r}function wh(r){return De.registerMeshLoader(r),r}ma(new t_);const bh="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIEsoayxkKXtjb25zdCB5PW5ldyBGbG9hdDMyQXJyYXkoay5sZW5ndGgpO2ZvcihsZXQgVj0wO1Y8ZC5sZW5ndGg7Vis9Myl7Y29uc3QgYT1kW1ZdKjMsZT1kW1YrMV0qMyxyPWRbVisyXSozLHM9a1thXSx0PWtbYSsxXSxuPWtbYSsyXSxoPWtbZV0saT1rW2UrMV0sbz1rW2UrMl0sYz1rW3JdLHU9a1tyKzFdLG09a1tyKzJdLHc9aC1zLGw9aS10LGY9by1uLGc9Yy1zLE09dS10LEQ9bS1uLHA9bCpELWYqTSxVPWYqZy13KkQsST13Kk0tbCpnLHo9TWF0aC5zcXJ0KHAqcCtVKlUrSSpJKSx4PVswLDAsMV07aWYoej4wKXtjb25zdCB2PTEvejt4WzBdPXAqdix4WzFdPVUqdix4WzJdPUkqdn1mb3IobGV0IHY9MDt2PDM7disrKXlbYSt2XT15W2Urdl09eVtyK3ZdPXhbdl19cmV0dXJuIHl9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bnN0IHk9TWF0aC5mbG9vcihrWzBdKmQpLFY9TWF0aC5mbG9vcihrWzFdKmQpLGE9TWF0aC5mbG9vcigoa1syXS1rWzBdKSpkKSxlPU1hdGguZmxvb3IoKGtbM10ta1sxXSkqZCk7cmV0dXJue3N4Onksc3k6VixzdzphLHNoOmV9fXNlbGYub25tZXNzYWdlPWs9Pntjb25zdCBkPWsuZGF0YSx5PW9lKGQuZGVtRGF0YSxkLnosZC5jbGlwQm91bmRzKTtzZWxmLnBvc3RNZXNzYWdlKHkpfX0pKCk7Cg==",h_=r=>Uint8Array.from(atob(r),e=>e.charCodeAt(0)),xh=typeof self<"u"&&self.Blob&&new Blob([h_(bh)],{type:"text/javascript;charset=utf-8"});function u_(r){let e;try{if(e=xh&&(self.URL||self.webkitURL).createObjectURL(xh),!e)throw"";const t=new Worker(e,{name:r?.name});return t.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),t}catch{return new Worker("data:text/javascript;base64,"+bh,{name:r?.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}const d_=function(){var r={};r.defaultNoDataValue=-34027999387901484e22,r.decode=function(a,c){c=c||{};var h=c.encodedMaskData||c.encodedMaskData===null,d=n(a,c.inputOffset||0,h),m=c.noDataValue!==null?c.noDataValue:r.defaultNoDataValue,f=e(d,c.pixelType||Float32Array,c.encodedMaskData,m,c.returnMask),g={width:d.width,height:d.height,pixelData:f.resultPixels,minValue:f.minValue,maxValue:d.pixels.maxValue,noDataValue:m};return f.resultMask&&(g.maskData=f.resultMask),c.returnEncodedMask&&d.mask&&(g.encodedMaskData=d.mask.bitset?d.mask.bitset:null),c.returnFileInfo&&(g.fileInfo=t(d),c.computeUsedBitDepths&&(g.fileInfo.bitDepths=i(d))),g};var e=function(a,c,h,d,m){var f=0,g=a.pixels.numBlocksX,_=a.pixels.numBlocksY,w=Math.floor(a.width/g),b=Math.floor(a.height/_),x=2*a.maxZError,L=Number.MAX_VALUE,M;h=h||(a.mask?a.mask.bitset:null);var C,W;C=new c(a.width*a.height),m&&h&&(W=new Uint8Array(a.width*a.height));for(var D=new Float32Array(w*b),z,X,I=0;I<=_;I++){var U=I!==_?b:a.height%_;if(U!==0)for(var V=0;V<=g;V++){var G=V!==g?w:a.width%g;if(G!==0){var N=I*a.width*b+V*w,j=a.width-G,Y=a.pixels.blocks[f],H,Q,re;Y.encoding<2?(Y.encoding===0?H=Y.rawData:(s(Y.stuffedData,Y.bitsPerPixel,Y.numValidPixels,Y.offset,x,D,a.pixels.maxValue),H=D),Q=0):Y.encoding===2?re=0:re=Y.offset;var ne;if(h)for(X=0;X<U;X++){for(N&7&&(ne=h[N>>3],ne<<=N&7),z=0;z<G;z++)N&7||(ne=h[N>>3]),ne&128?(W&&(W[N]=1),M=Y.encoding<2?H[Q++]:re,L=L>M?M:L,C[N++]=M):(W&&(W[N]=0),C[N++]=d),ne<<=1;N+=j}else if(Y.encoding<2)for(X=0;X<U;X++){for(z=0;z<G;z++)M=H[Q++],L=L>M?M:L,C[N++]=M;N+=j}else for(L=L>re?re:L,X=0;X<U;X++){for(z=0;z<G;z++)C[N++]=re;N+=j}if(Y.encoding===1&&Q!==Y.numValidPixels)throw"Block and Mask do not match";f++}}}return{resultPixels:C,resultMask:W,minValue:L}},t=function(a){return{fileIdentifierString:a.fileIdentifierString,fileVersion:a.fileVersion,imageType:a.imageType,height:a.height,width:a.width,maxZError:a.maxZError,eofOffset:a.eofOffset,mask:a.mask?{numBlocksX:a.mask.numBlocksX,numBlocksY:a.mask.numBlocksY,numBytes:a.mask.numBytes,maxValue:a.mask.maxValue}:null,pixels:{numBlocksX:a.pixels.numBlocksX,numBlocksY:a.pixels.numBlocksY,numBytes:a.pixels.numBytes,maxValue:a.pixels.maxValue,noDataValue:a.noDataValue}}},i=function(a){for(var c=a.pixels.numBlocksX*a.pixels.numBlocksY,h={},d=0;d<c;d++){var m=a.pixels.blocks[d];m.encoding===0?h.float32=!0:m.encoding===1?h[m.bitsPerPixel]=!0:h[0]=!0}return Object.keys(h)},n=function(a,c,h){var d={},m=new Uint8Array(a,c,10);if(d.fileIdentifierString=String.fromCharCode.apply(null,m),d.fileIdentifierString.trim()!=="CntZImage")throw"Unexpected file identifier string: "+d.fileIdentifierString;c+=10;var f=new DataView(a,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,!h)if(f=new DataView(a,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 g=new Uint8Array(Math.ceil(d.width*d.height/8));f=new DataView(a,c,d.mask.numBytes);var _=f.getInt16(0,!0),w=2,b=0;do{if(_>0)for(;_--;)g[b++]=f.getUint8(w++);else{var x=f.getUint8(w++);for(_=-_;_--;)g[b++]=x}_=f.getInt16(w,!0),w+=2}while(w<d.mask.numBytes);if(_!==-32768||b<g.length)throw"Unexpected end of mask RLE encoding";d.mask.bitset=g,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(a,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 L=d.pixels.numBlocksX,M=d.pixels.numBlocksY,C=L+(d.width%L>0?1:0),W=M+(d.height%M>0?1:0);d.pixels.blocks=new Array(C*W);for(var D=0,z=0;z<W;z++)for(var X=0;X<C;X++){var I=0,U=a.byteLength-c;f=new DataView(a,c,Math.min(10,U));var V={};d.pixels.blocks[D++]=V;var G=f.getUint8(0);if(I++,V.encoding=G&63,V.encoding>3)throw"Invalid block encoding ("+V.encoding+")";if(V.encoding===2){c++;continue}if(G!==0&&G!==2){if(G>>=6,V.offsetType=G,G===2)V.offset=f.getInt8(1),I++;else if(G===1)V.offset=f.getInt16(1,!0),I+=2;else if(G===0)V.offset=f.getFloat32(1,!0),I+=4;else throw"Invalid block offset type";if(V.encoding===1)if(G=f.getUint8(I),I++,V.bitsPerPixel=G&63,G>>=6,V.numValidPixelsType=G,G===2)V.numValidPixels=f.getUint8(I),I++;else if(G===1)V.numValidPixels=f.getUint16(I,!0),I+=2;else if(G===0)V.numValidPixels=f.getUint32(I,!0),I+=4;else throw"Invalid valid pixel count type"}if(c+=I,V.encoding!==3){var N,j;if(V.encoding===0){var Y=(d.pixels.numBytes-1)/4;if(Y!==Math.floor(Y))throw"uncompressed block has invalid length";N=new ArrayBuffer(Y*4),j=new Uint8Array(N),j.set(new Uint8Array(a,c,Y*4));var H=new Float32Array(N);V.rawData=H,c+=Y*4}else if(V.encoding===1){var Q=Math.ceil(V.numValidPixels*V.bitsPerPixel/8),re=Math.ceil(Q/4);N=new ArrayBuffer(re*4),j=new Uint8Array(N),j.set(new Uint8Array(a,c,Q)),V.stuffedData=new Uint32Array(N),c+=Q}}}return d.eofOffset=c,d},s=function(a,c,h,d,m,f,g){var _=(1<<c)-1,w=0,b,x=0,L,M,C=Math.ceil((g-d)/m),W=a.length*4-Math.ceil(c*h/8);for(a[a.length-1]<<=8*W,b=0;b<h;b++){if(x===0&&(M=a[w++],x=32),x>=c)L=M>>>x-c&_,x-=c;else{var D=c-x;L=(M&_)<<D&_,M=a[w++],x=32-D,L+=M>>>x}f[b]=L<C?d+L*m:g}return f};return r}(),f_=function(){var r={unstuff:function(n,s,a,c,h,d,m,f){var g=(1<<a)-1,_=0,w,b=0,x,L,M,C,W=n.length*4-Math.ceil(a*c/8);if(n[n.length-1]<<=8*W,h)for(w=0;w<c;w++)b===0&&(L=n[_++],b=32),b>=a?(x=L>>>b-a&g,b-=a):(M=a-b,x=(L&g)<<M&g,L=n[_++],b=32-M,x+=L>>>b),s[w]=h[x];else for(C=Math.ceil((f-d)/m),w=0;w<c;w++)b===0&&(L=n[_++],b=32),b>=a?(x=L>>>b-a&g,b-=a):(M=a-b,x=(L&g)<<M&g,L=n[_++],b=32-M,x+=L>>>b),s[w]=x<C?d+x*m:f},unstuffLUT:function(n,s,a,c,h,d){var m=(1<<s)-1,f=0,g=0,_=0,w=0,b=0,x,L=[],M=n.length*4-Math.ceil(s*a/8);n[n.length-1]<<=8*M;var C=Math.ceil((d-c)/h);for(g=0;g<a;g++)w===0&&(x=n[f++],w=32),w>=s?(b=x>>>w-s&m,w-=s):(_=s-w,b=(x&m)<<_&m,x=n[f++],w=32-_,b+=x>>>w),L[g]=b<C?c+b*h:d;return L.unshift(c),L},unstuff2:function(n,s,a,c,h,d,m,f){var g=(1<<a)-1,_=0,w,b=0,x=0,L,M,C;if(h)for(w=0;w<c;w++)b===0&&(M=n[_++],b=32,x=0),b>=a?(L=M>>>x&g,b-=a,x+=a):(C=a-b,L=M>>>x&g,M=n[_++],b=32-C,L|=(M&(1<<C)-1)<<a-C,x=C),s[w]=h[L];else{var W=Math.ceil((f-d)/m);for(w=0;w<c;w++)b===0&&(M=n[_++],b=32,x=0),b>=a?(L=M>>>x&g,b-=a,x+=a):(C=a-b,L=M>>>x&g,M=n[_++],b=32-C,L|=(M&(1<<C)-1)<<a-C,x=C),s[w]=L<W?d+L*m:f}return s},unstuffLUT2:function(n,s,a,c,h,d){var m=(1<<s)-1,f=0,g=0,_=0,w=0,b=0,x=0,L,M=[],C=Math.ceil((d-c)/h);for(g=0;g<a;g++)w===0&&(L=n[f++],w=32,x=0),w>=s?(b=L>>>x&m,w-=s,x+=s):(_=s-w,b=L>>>x&m,L=n[f++],w=32-_,b|=(L&(1<<_)-1)<<s-_,x=_),M[g]=b<C?c+b*h:d;return M.unshift(c),M},originalUnstuff:function(n,s,a,c){var h=(1<<a)-1,d=0,m,f=0,g,_,w,b=n.length*4-Math.ceil(a*c/8);for(n[n.length-1]<<=8*b,m=0;m<c;m++)f===0&&(_=n[d++],f=32),f>=a?(g=_>>>f-a&h,f-=a):(w=a-f,g=(_&h)<<w&h,_=n[d++],f=32-w,g+=_>>>f),s[m]=g;return s},originalUnstuff2:function(n,s,a,c){var h=(1<<a)-1,d=0,m,f=0,g=0,_,w,b;for(m=0;m<c;m++)f===0&&(w=n[d++],f=32,g=0),f>=a?(_=w>>>g&h,f-=a,g+=a):(b=a-f,_=w>>>g&h,w=n[d++],f=32-b,_|=(w&(1<<b)-1)<<a-b,g=b),s[m]=_;return s}},e={HUFFMAN_LUT_BITS_MAX:12,computeChecksumFletcher32:function(n){for(var s=65535,a=65535,c=n.length,h=Math.floor(c/2),d=0;h;){var m=h>=359?359:h;h-=m;do s+=n[d++]<<8,a+=s+=n[d++];while(--m);s=(s&65535)+(s>>>16),a=(a&65535)+(a>>>16)}return c&1&&(a+=s+=n[d]<<8),s=(s&65535)+(s>>>16),a=(a&65535)+(a>>>16),(a<<16|s)>>>0},readHeaderInfo:function(n,s){var a=s.ptr,c=new Uint8Array(n,a,6),h={};if(h.fileIdentifierString=String.fromCharCode.apply(null,c),h.fileIdentifierString.lastIndexOf("Lerc2",0)!==0)throw"Unexpected file identifier string (expect Lerc2 ): "+h.fileIdentifierString;a+=6;var d=new DataView(n,a,8),m=d.getInt32(0,!0);h.fileVersion=m,a+=4,m>=3&&(h.checksum=d.getUint32(4,!0),a+=4),d=new DataView(n,a,12),h.height=d.getUint32(0,!0),h.width=d.getUint32(4,!0),a+=8,m>=4?(h.numDims=d.getUint32(8,!0),a+=4):h.numDims=1,d=new DataView(n,a,40),h.numValidPixel=d.getUint32(0,!0),h.microBlockSize=d.getInt32(4,!0),h.blobSize=d.getInt32(8,!0),h.imageType=d.getInt32(12,!0),h.maxZError=d.getFloat64(16,!0),h.zMin=d.getFloat64(24,!0),h.zMax=d.getFloat64(32,!0),a+=40,s.headerInfo=h,s.ptr=a;var f,g;if(m>=3&&(g=m>=4?52:48,f=this.computeChecksumFletcher32(new Uint8Array(n,a-g,h.blobSize-14)),f!==h.checksum))throw"Checksum failed.";return!0},checkMinMaxRanges:function(n,s){var a=s.headerInfo,c=this.getDataTypeArray(a.imageType),h=a.numDims*this.getDataTypeSize(a.imageType),d=this.readSubArray(n,s.ptr,c,h),m=this.readSubArray(n,s.ptr+h,c,h);s.ptr+=2*h;var f,g=!0;for(f=0;f<a.numDims;f++)if(d[f]!==m[f]){g=!1;break}return a.minValues=d,a.maxValues=m,g},readSubArray:function(n,s,a,c){var h;if(a===Uint8Array)h=new Uint8Array(n,s,c);else{var d=new ArrayBuffer(c),m=new Uint8Array(d);m.set(new Uint8Array(n,s,c)),h=new a(d)}return h},readMask:function(n,s){var a=s.ptr,c=s.headerInfo,h=c.width*c.height,d=c.numValidPixel,m=new DataView(n,a,4),f={};if(f.numBytes=m.getUint32(0,!0),a+=4,(d===0||h===d)&&f.numBytes!==0)throw"invalid mask";var g,_;if(d===0)g=new Uint8Array(Math.ceil(h/8)),f.bitset=g,_=new Uint8Array(h),s.pixels.resultMask=_,a+=f.numBytes;else if(f.numBytes>0){g=new Uint8Array(Math.ceil(h/8)),m=new DataView(n,a,f.numBytes);var w=m.getInt16(0,!0),b=2,x=0,L=0;do{if(w>0)for(;w--;)g[x++]=m.getUint8(b++);else for(L=m.getUint8(b++),w=-w;w--;)g[x++]=L;w=m.getInt16(b,!0),b+=2}while(b<f.numBytes);if(w!==-32768||x<g.length)throw"Unexpected end of mask RLE encoding";_=new Uint8Array(h);var M=0,C=0;for(C=0;C<h;C++)C&7?(M=g[C>>3],M<<=C&7):M=g[C>>3],M&128&&(_[C]=1);s.pixels.resultMask=_,f.bitset=g,a+=f.numBytes}return s.ptr=a,s.mask=f,!0},readDataOneSweep:function(n,s,a,c){var h=s.ptr,d=s.headerInfo,m=d.numDims,f=d.width*d.height,g=d.imageType,_=d.numValidPixel*e.getDataTypeSize(g)*m,w,b=s.pixels.resultMask;if(a===Uint8Array)w=new Uint8Array(n,h,_);else{var x=new ArrayBuffer(_),L=new Uint8Array(x);L.set(new Uint8Array(n,h,_)),w=new a(x)}if(w.length===f*m)c?s.pixels.resultPixels=e.swapDimensionOrder(w,f,m,a,!0):s.pixels.resultPixels=w;else{s.pixels.resultPixels=new a(f*m);var M=0,C=0,W=0,D=0;if(m>1){if(c){for(C=0;C<f;C++)if(b[C])for(D=C,W=0;W<m;W++,D+=f)s.pixels.resultPixels[D]=w[M++]}else for(C=0;C<f;C++)if(b[C])for(D=C*m,W=0;W<m;W++)s.pixels.resultPixels[D+W]=w[M++]}else for(C=0;C<f;C++)b[C]&&(s.pixels.resultPixels[C]=w[M++])}return h+=_,s.ptr=h,!0},readHuffmanTree:function(n,s){var a=this.HUFFMAN_LUT_BITS_MAX,c=new DataView(n,s.ptr,16);s.ptr+=16;var h=c.getInt32(0,!0);if(h<2)throw"unsupported Huffman version";var d=c.getInt32(4,!0),m=c.getInt32(8,!0),f=c.getInt32(12,!0);if(m>=f)return!1;var g=new Uint32Array(f-m);e.decodeBits(n,s,g);var _=[],w,b,x,L;for(w=m;w<f;w++)b=w-(w<d?0:d),_[b]={first:g[w-m],second:null};var M=n.byteLength-s.ptr,C=Math.ceil(M/4),W=new ArrayBuffer(C*4),D=new Uint8Array(W);D.set(new Uint8Array(n,s.ptr,M));var z=new Uint32Array(W),X=0,I,U=0;for(I=z[0],w=m;w<f;w++)b=w-(w<d?0:d),L=_[b].first,L>0&&(_[b].second=I<<X>>>32-L,32-X>=L?(X+=L,X===32&&(X=0,U++,I=z[U])):(X+=L-32,U++,I=z[U],_[b].second|=I>>>32-X));var V=0,G=0,N=new t;for(w=0;w<_.length;w++)_[w]!==void 0&&(V=Math.max(V,_[w].first));V>=a?G=a:G=V;var j=[],Y,H,Q,re,ne,le;for(w=m;w<f;w++)if(b=w-(w<d?0:d),L=_[b].first,L>0)if(Y=[L,b],L<=G)for(H=_[b].second<<G-L,Q=1<<G-L,x=0;x<Q;x++)j[H|x]=Y;else for(H=_[b].second,le=N,re=L-1;re>=0;re--)ne=H>>>re&1,ne?(le.right||(le.right=new t),le=le.right):(le.left||(le.left=new t),le=le.left),re===0&&!le.val&&(le.val=Y[1]);return{decodeLut:j,numBitsLUTQick:G,numBitsLUT:V,tree:N,stuffedData:z,srcPtr:U,bitPos:X}},readHuffman:function(n,s,a,c){var h=s.headerInfo,d=h.numDims,m=s.headerInfo.height,f=s.headerInfo.width,g=f*m,_=this.readHuffmanTree(n,s),w=_.decodeLut,b=_.tree,x=_.stuffedData,L=_.srcPtr,M=_.bitPos,C=_.numBitsLUTQick,W=_.numBitsLUT,D=s.headerInfo.imageType===0?128:0,z,X,I,U=s.pixels.resultMask,V,G,N,j,Y,H,Q,re=0;M>0&&(L++,M=0);var ne=x[L],le=s.encodeMode===1,de=new a(g*d),ge=de,fe;if(d<2||le){for(fe=0;fe<d;fe++)if(d>1&&(ge=new a(de.buffer,g*fe,g),re=0),s.headerInfo.numValidPixel===f*m)for(H=0,j=0;j<m;j++)for(Y=0;Y<f;Y++,H++){if(X=0,V=ne<<M>>>32-C,G=V,32-M<C&&(V|=x[L+1]>>>64-M-C,G=V),w[G])X=w[G][1],M+=w[G][0];else for(V=ne<<M>>>32-W,G=V,32-M<W&&(V|=x[L+1]>>>64-M-W,G=V),z=b,Q=0;Q<W;Q++)if(N=V>>>W-Q-1&1,z=N?z.right:z.left,!(z.left||z.right)){X=z.val,M=M+Q+1;break}M>=32&&(M-=32,L++,ne=x[L]),I=X-D,le?(Y>0?I+=re:j>0?I+=ge[H-f]:I+=re,I&=255,ge[H]=I,re=I):ge[H]=I}else for(H=0,j=0;j<m;j++)for(Y=0;Y<f;Y++,H++)if(U[H]){if(X=0,V=ne<<M>>>32-C,G=V,32-M<C&&(V|=x[L+1]>>>64-M-C,G=V),w[G])X=w[G][1],M+=w[G][0];else for(V=ne<<M>>>32-W,G=V,32-M<W&&(V|=x[L+1]>>>64-M-W,G=V),z=b,Q=0;Q<W;Q++)if(N=V>>>W-Q-1&1,z=N?z.right:z.left,!(z.left||z.right)){X=z.val,M=M+Q+1;break}M>=32&&(M-=32,L++,ne=x[L]),I=X-D,le?(Y>0&&U[H-1]?I+=re:j>0&&U[H-f]?I+=ge[H-f]:I+=re,I&=255,ge[H]=I,re=I):ge[H]=I}}else for(H=0,j=0;j<m;j++)for(Y=0;Y<f;Y++)if(H=j*f+Y,!U||U[H])for(fe=0;fe<d;fe++,H+=g){if(X=0,V=ne<<M>>>32-C,G=V,32-M<C&&(V|=x[L+1]>>>64-M-C,G=V),w[G])X=w[G][1],M+=w[G][0];else for(V=ne<<M>>>32-W,G=V,32-M<W&&(V|=x[L+1]>>>64-M-W,G=V),z=b,Q=0;Q<W;Q++)if(N=V>>>W-Q-1&1,z=N?z.right:z.left,!(z.left||z.right)){X=z.val,M=M+Q+1;break}M>=32&&(M-=32,L++,ne=x[L]),I=X-D,ge[H]=I}s.ptr=s.ptr+(L+1)*4+(M>0?4:0),s.pixels.resultPixels=de,d>1&&!c&&(s.pixels.resultPixels=e.swapDimensionOrder(de,g,d,a))},decodeBits:function(n,s,a,c,h){{var d=s.headerInfo,m=d.fileVersion,f=0,g=n.byteLength-s.ptr>=5?5:n.byteLength-s.ptr,_=new DataView(n,s.ptr,g),w=_.getUint8(0);f++;var b=w>>6,x=b===0?4:3-b,L=(w&32)>0,M=w&31,C=0;if(x===1)C=_.getUint8(f),f++;else if(x===2)C=_.getUint16(f,!0),f+=2;else if(x===4)C=_.getUint32(f,!0),f+=4;else throw"Invalid valid pixel count type";var W=2*d.maxZError,D,z,X,I,U,V,G,N,j,Y=d.numDims>1?d.maxValues[h]:d.zMax;if(L){for(s.counter.lut++,N=_.getUint8(f),f++,I=Math.ceil((N-1)*M/8),U=Math.ceil(I/4),z=new ArrayBuffer(U*4),X=new Uint8Array(z),s.ptr+=f,X.set(new Uint8Array(n,s.ptr,I)),G=new Uint32Array(z),s.ptr+=I,j=0;N-1>>>j;)j++;I=Math.ceil(C*j/8),U=Math.ceil(I/4),z=new ArrayBuffer(U*4),X=new Uint8Array(z),X.set(new Uint8Array(n,s.ptr,I)),D=new Uint32Array(z),s.ptr+=I,m>=3?V=r.unstuffLUT2(G,M,N-1,c,W,Y):V=r.unstuffLUT(G,M,N-1,c,W,Y),m>=3?r.unstuff2(D,a,j,C,V):r.unstuff(D,a,j,C,V)}else s.counter.bitstuffer++,j=M,s.ptr+=f,j>0&&(I=Math.ceil(C*j/8),U=Math.ceil(I/4),z=new ArrayBuffer(U*4),X=new Uint8Array(z),X.set(new Uint8Array(n,s.ptr,I)),D=new Uint32Array(z),s.ptr+=I,m>=3?c==null?r.originalUnstuff2(D,a,j,C):r.unstuff2(D,a,j,C,!1,c,W,Y):c==null?r.originalUnstuff(D,a,j,C):r.unstuff(D,a,j,C,!1,c,W,Y))}},readTiles:function(n,s,a,c){var h=s.headerInfo,d=h.width,m=h.height,f=d*m,g=h.microBlockSize,_=h.imageType,w=e.getDataTypeSize(_),b=Math.ceil(d/g),x=Math.ceil(m/g);s.pixels.numBlocksY=x,s.pixels.numBlocksX=b,s.pixels.ptr=0;var L=0,M=0,C=0,W=0,D=0,z=0,X=0,I=0,U=0,V=0,G=0,N=0,j=0,Y=0,H=0,Q=0,re,ne,le,de,ge,fe,Se=new a(g*g),st=m%g||g,ot=d%g||g,pt,$e,Re=h.numDims,je,at=s.pixels.resultMask,Xe=s.pixels.resultPixels,Ft=h.fileVersion,Rt=Ft>=5?14:15,Ce,lt=h.zMax,mt;for(C=0;C<x;C++)for(D=C!==x-1?g:st,W=0;W<b;W++)for(z=W!==b-1?g:ot,G=C*d*g+W*g,N=d-z,je=0;je<Re;je++){if(Re>1?(mt=Xe,G=C*d*g+W*g,Xe=new a(s.pixels.resultPixels.buffer,f*je*w,f),lt=h.maxValues[je]):mt=null,X=n.byteLength-s.ptr,re=new DataView(n,s.ptr,Math.min(10,X)),ne={},Q=0,I=re.getUint8(0),Q++,Ce=h.fileVersion>=5?I&4:0,U=I>>6&255,V=I>>2&Rt,V!==(W*g>>3&Rt)||Ce&&je===0)throw"integrity issue";if(fe=I&3,fe>3)throw s.ptr+=Q,"Invalid block encoding ("+fe+")";if(fe===2){if(Ce)if(at)for(L=0;L<D;L++)for(M=0;M<z;M++)at[G]&&(Xe[G]=mt[G]),G++;else for(L=0;L<D;L++)for(M=0;M<z;M++)Xe[G]=mt[G],G++;s.counter.constant++,s.ptr+=Q;continue}else if(fe===0){if(Ce)throw"integrity issue";if(s.counter.uncompressed++,s.ptr+=Q,j=D*z*w,Y=n.byteLength-s.ptr,j=j<Y?j:Y,le=new ArrayBuffer(j%w===0?j:j+w-j%w),de=new Uint8Array(le),de.set(new Uint8Array(n,s.ptr,j)),ge=new a(le),H=0,at)for(L=0;L<D;L++){for(M=0;M<z;M++)at[G]&&(Xe[G]=ge[H++]),G++;G+=N}else for(L=0;L<D;L++){for(M=0;M<z;M++)Xe[G++]=ge[H++];G+=N}s.ptr+=H*w}else if(pt=e.getDataTypeUsed(Ce&&_<6?4:_,U),$e=e.getOnePixel(ne,Q,pt,re),Q+=e.getDataTypeSize(pt),fe===3)if(s.ptr+=Q,s.counter.constantoffset++,at)for(L=0;L<D;L++){for(M=0;M<z;M++)at[G]&&(Xe[G]=Ce?Math.min(lt,mt[G]+$e):$e),G++;G+=N}else for(L=0;L<D;L++){for(M=0;M<z;M++)Xe[G]=Ce?Math.min(lt,mt[G]+$e):$e,G++;G+=N}else if(s.ptr+=Q,e.decodeBits(n,s,Se,$e,je),Q=0,Ce)if(at)for(L=0;L<D;L++){for(M=0;M<z;M++)at[G]&&(Xe[G]=Se[Q++]+mt[G]),G++;G+=N}else for(L=0;L<D;L++){for(M=0;M<z;M++)Xe[G]=Se[Q++]+mt[G],G++;G+=N}else if(at)for(L=0;L<D;L++){for(M=0;M<z;M++)at[G]&&(Xe[G]=Se[Q++]),G++;G+=N}else for(L=0;L<D;L++){for(M=0;M<z;M++)Xe[G++]=Se[Q++];G+=N}}Re>1&&!c&&(s.pixels.resultPixels=e.swapDimensionOrder(s.pixels.resultPixels,f,Re,a))},formatFileInfo:function(n){return{fileIdentifierString:n.headerInfo.fileIdentifierString,fileVersion:n.headerInfo.fileVersion,imageType:n.headerInfo.imageType,height:n.headerInfo.height,width:n.headerInfo.width,numValidPixel:n.headerInfo.numValidPixel,microBlockSize:n.headerInfo.microBlockSize,blobSize:n.headerInfo.blobSize,maxZError:n.headerInfo.maxZError,pixelType:e.getPixelType(n.headerInfo.imageType),eofOffset:n.eofOffset,mask:n.mask?{numBytes:n.mask.numBytes}:null,pixels:{numBlocksX:n.pixels.numBlocksX,numBlocksY:n.pixels.numBlocksY,maxValue:n.headerInfo.zMax,minValue:n.headerInfo.zMin,noDataValue:n.noDataValue}}},constructConstantSurface:function(n,s){var a=n.headerInfo.zMax,c=n.headerInfo.zMin,h=n.headerInfo.maxValues,d=n.headerInfo.numDims,m=n.headerInfo.height*n.headerInfo.width,f=0,g=0,_=0,w=n.pixels.resultMask,b=n.pixels.resultPixels;if(w)if(d>1){if(s)for(f=0;f<d;f++)for(_=f*m,a=h[f],g=0;g<m;g++)w[g]&&(b[_+g]=a);else for(g=0;g<m;g++)if(w[g])for(_=g*d,f=0;f<d;f++)b[_+d]=h[f]}else for(g=0;g<m;g++)w[g]&&(b[g]=a);else if(d>1&&c!==a)if(s)for(f=0;f<d;f++)for(_=f*m,a=h[f],g=0;g<m;g++)b[_+g]=a;else for(g=0;g<m;g++)for(_=g*d,f=0;f<d;f++)b[_+f]=h[f];else for(g=0;g<m*d;g++)b[g]=a},getDataTypeArray:function(n){var s;switch(n){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(n){var s;switch(n){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(n,s){if(s==null)return!1;var a;switch(n){case 0:a=s>=-128&&s<=127;break;case 1:a=s>=0&&s<=255;break;case 2:a=s>=-32768&&s<=32767;break;case 3:a=s>=0&&s<=65536;break;case 4:a=s>=-2147483648&&s<=2147483647;break;case 5:a=s>=0&&s<=4294967296;break;case 6:a=s>=-34027999387901484e22&&s<=34027999387901484e22;break;case 7:a=s>=-17976931348623157e292&&s<=17976931348623157e292;break;default:a=!1}return a},getDataTypeSize:function(n){var s=0;switch(n){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=n}return s},getDataTypeUsed:function(n,s){var a=n;switch(n){case 2:case 4:a=n-s;break;case 3:case 5:a=n-2*s;break;case 6:s===0?a=n:s===1?a=2:a=1;break;case 7:s===0?a=n:a=n-2*s+1;break;default:a=n;break}return a},getOnePixel:function(n,s,a,c){var h=0;switch(a){case 0:h=c.getInt8(s);break;case 1:h=c.getUint8(s);break;case 2:h=c.getInt16(s,!0);break;case 3:h=c.getUint16(s,!0);break;case 4:h=c.getInt32(s,!0);break;case 5:h=c.getUInt32(s,!0);break;case 6:h=c.getFloat32(s,!0);break;case 7:h=c.getFloat64(s,!0);break;default:throw"the decoder does not understand this pixel type"}return h},swapDimensionOrder:function(n,s,a,c,h){var d=0,m=0,f=0,g=0,_=n;if(a>1)if(_=new c(s*a),h)for(d=0;d<s;d++)for(g=d,f=0;f<a;f++,g+=s)_[g]=n[m++];else for(d=0;d<s;d++)for(g=d,f=0;f<a;f++,g+=s)_[m++]=n[g];return _}},t=function(n,s,a){this.val=n,this.left=s,this.right=a},i={decode:function(n,s){s=s||{};var a=s.noDataValue,c=0,h={};if(h.ptr=s.inputOffset||0,h.pixels={},!!e.readHeaderInfo(n,h)){var d=h.headerInfo,m=d.fileVersion,f=e.getDataTypeArray(d.imageType);if(m>5)throw"unsupported lerc version 2."+m;e.readMask(n,h),d.numValidPixel!==d.width*d.height&&!h.pixels.resultMask&&(h.pixels.resultMask=s.maskData);var g=d.width*d.height;h.pixels.resultPixels=new f(g*d.numDims),h.counter={onesweep:0,uncompressed:0,lut:0,bitstuffer:0,constant:0,constantoffset:0};var _=!s.returnPixelInterleavedDims;if(d.numValidPixel!==0)if(d.zMax===d.zMin)e.constructConstantSurface(h,_);else if(m>=4&&e.checkMinMaxRanges(n,h))e.constructConstantSurface(h,_);else{var w=new DataView(n,h.ptr,2),b=w.getUint8(0);if(h.ptr++,b)e.readDataOneSweep(n,h,f,_);else if(m>1&&d.imageType<=1&&Math.abs(d.maxZError-.5)<1e-5){var x=w.getUint8(1);if(h.ptr++,h.encodeMode=x,x>2||m<4&&x>1)throw"Invalid Huffman flag "+x;x?e.readHuffman(n,h,f,_):e.readTiles(n,h,f,_)}else e.readTiles(n,h,f,_)}h.eofOffset=h.ptr;var L;s.inputOffset?(L=h.headerInfo.blobSize+s.inputOffset-h.ptr,Math.abs(L)>=1&&(h.eofOffset=s.inputOffset+h.headerInfo.blobSize)):(L=h.headerInfo.blobSize-h.ptr,Math.abs(L)>=1&&(h.eofOffset=h.headerInfo.blobSize));var M={width:d.width,height:d.height,pixelData:h.pixels.resultPixels,minValue:d.zMin,maxValue:d.zMax,validPixelCount:d.numValidPixel,dimCount:d.numDims,dimStats:{minValues:d.minValues,maxValues:d.maxValues},maskData:h.pixels.resultMask};if(h.pixels.resultMask&&e.isValidPixelValue(d.imageType,a)){var C=h.pixels.resultMask;for(c=0;c<g;c++)C[c]||(M.pixelData[c]=a);M.noDataValue=a}return h.noDataValue=a,s.returnFileInfo&&(M.fileInfo=e.formatFileInfo(h)),M}},getBandCount:function(n){var s=0,a=0,c={};for(c.ptr=0,c.pixels={};a<n.byteLength-58;)e.readHeaderInfo(n,c),a+=c.headerInfo.blobSize,s++,c.ptr=a;return s}};return i}();var p_=function(){var r=new ArrayBuffer(4),e=new Uint8Array(r),t=new Uint32Array(r);return t[0]=1,e[0]===1}(),m_={decode:function(r,e){if(!p_)throw"Big endian system is not supported.";e=e||{};var t=e.inputOffset||0,i=new Uint8Array(r,t,10),n=String.fromCharCode.apply(null,i),s,a;if(n.trim()==="CntZImage")s=d_,a=1;else if(n.substring(0,5)==="Lerc2")s=f_,a=2;else throw"Unexpected file identifier string: "+n;for(var c=0,h=r.byteLength-10,d,m=[],f,g,_={width:0,height:0,pixels:[],pixelType:e.pixelType,mask:null,statistics:[]},w=0;t<h;){var b=s.decode(r,{inputOffset:t,encodedMaskData:d,maskData:g,returnMask:c===0,returnEncodedMask:c===0,returnFileInfo:!0,returnPixelInterleavedDims:e.returnPixelInterleavedDims,pixelType:e.pixelType||null,noDataValue:e.noDataValue||null});t=b.fileInfo.eofOffset,g=b.maskData,c===0&&(d=b.encodedMaskData,_.width=b.width,_.height=b.height,_.dimCount=b.dimCount||1,_.pixelType=b.pixelType||b.fileInfo.pixelType,_.mask=g),a>1&&(g&&m.push(g),b.fileInfo.mask&&b.fileInfo.mask.numBytes>0&&w++),c++,_.pixels.push(b.pixelData),_.statistics.push({minValue:b.minValue,maxValue:b.maxValue,noDataValue:b.noDataValue,dimStats:b.dimStats})}var x,L,M;if(a>1&&w>1){for(M=_.width*_.height,_.bandMasks=m,g=new Uint8Array(M),g.set(m[0]),x=1;x<m.length;x++)for(f=m[x],L=0;L<M;L++)g[L]=g[L]&f[L];_.maskData=g}return _}};const g_={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 y_(r){const{height:e,width:t,pixels:i}=m_.decode(r),n=new Float32Array(e*t);for(let s=0;s<n.length;s++)n[s]=i[0][s];return{array:n,width:t,height:e}}function __(r,e,t){let i=y_(r);t[2]-t[0]<1&&(i=v_(i,t));const{array:n,width:s}=i,c=new mh(s).createTile(n),h=g_[e]||0;return c.getGeometryData(h)}function v_(r,e){function t(c,h,d,m,f,g,_,w){const b=new Float32Array(f*g);for(let L=0;L<g;L++)for(let M=0;M<f;M++){const C=(L+m)*h+(M+d),W=L*f+M;b[W]=c[C]}const x=new Float32Array(w*_);for(let L=0;L<w;L++)for(let M=0;M<_;M++){const C=L*w+M,W=Math.round(M*g/w),z=Math.round(L*f/_)*f+W;x[C]=b[z]}return x}const i=w_(e,r.width),n=i.sw+1,s=i.sh+1;return{array:t(r.array,r.width,i.sx,i.sy,i.sw,i.sh,n,s),width:n,height:s}}function w_(r,e){const t=Math.floor(r[0]*e),i=Math.floor(r[1]*e),n=Math.floor((r[2]-r[0])*e),s=Math.floor((r[3]-r[1])*e);return{sx:t,sy:i,sw:n,sh:s}}var b_=Object.defineProperty,x_=(r,e,t)=>e in r?b_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ps=(r,e,t)=>x_(r,typeof e!="symbol"?e+"":e,t);const M_=10;class S_ extends ua{constructor(){super(),Ps(this,"info",{version:"0.10.0",description:"Tile LERC terrain loader. It can load ArcGis-lerc format terrain data."}),Ps(this,"dataType","lerc"),Ps(this,"fileLoader",new p.FileLoader(De.manager)),Ps(this,"_workerPool",new $o(0)),this.fileLoader.setResponseType("arraybuffer"),this._workerPool.setWorkerCreator(()=>new u_)}async doLoad(e,t){this._workerPool.pool===0&&this._workerPool.setWorkerLimit(M_);const{z:i,bounds:n}=t,s=await this.fileLoader.loadAsync(e).catch(()=>new Float32Array(256*256)),a=__(s,i,n);return new jn().setData(a)}}ga(new S_);const Mh="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGModCl7cmV0dXJuIGEodC5kYXRhKX1mdW5jdGlvbiBhKHQpe2Z1bmN0aW9uIG4oZSx1KXtjb25zdCByPXUqNCxbaSxmLGcsbF09ZS5zbGljZShyLHIrNCk7cmV0dXJuIGw9PT0wPzA6LTFlNCsoaTw8MTZ8Zjw8OHxnKSouMX1jb25zdCBvPXQubGVuZ3RoPj4+MixzPW5ldyBGbG9hdDMyQXJyYXkobyk7Zm9yKGxldCBlPTA7ZTxvO2UrKylzW2VdPW4odCxlKTtyZXR1cm4gc31zZWxmLm9ubWVzc2FnZT10PT57Y29uc3Qgbj1jKHQuZGF0YS5pbWdEYXRhKTtzZWxmLnBvc3RNZXNzYWdlKG4pfX0pKCk7Cg==",L_=r=>Uint8Array.from(atob(r),e=>e.charCodeAt(0)),Sh=typeof self<"u"&&self.Blob&&new Blob([L_(Mh)],{type:"text/javascript;charset=utf-8"});function P_(r){let e;try{if(e=Sh&&(self.URL||self.webkitURL).createObjectURL(Sh),!e)throw"";const t=new Worker(e,{name:r?.name});return t.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),t}catch{return new Worker("data:text/javascript;base64,"+Mh,{name:r?.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}var C_=Object.defineProperty,T_=(r,e,t)=>e in r?C_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Cs=(r,e,t)=>T_(r,typeof e!="symbol"?e+"":e,t);const G_=10;class W_ extends ua{constructor(){super(),Cs(this,"info",{version:"0.10.0",description:"Mapbox-RGB terrain loader, It can load Mapbox-RGB terrain data."}),Cs(this,"dataType","terrain-rgb"),Cs(this,"imageLoader",new p.ImageLoader(De.manager)),Cs(this,"_workerPool",new $o(0)),this._workerPool.setWorkerCreator(()=>new P_)}async doLoad(e,t){const i=await this.imageLoader.loadAsync(e).catch(h=>new Image),n=p.MathUtils.clamp((t.z+2)*3,2,64),s=Z_(i,t.bounds,n);let a;this._workerPool.pool===0&&this._workerPool.setWorkerLimit(G_),a=(await this._workerPool.postMessage({imgData:s},[s.data.buffer])).data;const c=new jn;return c.setData(a),c}}function Z_(r,e,t){const i=oa(e,r.width);t=Math.min(t,i.sw);const s=new OffscreenCanvas(t,t).getContext("2d");return s.imageSmoothingEnabled=!1,s.drawImage(r,i.sx,i.sy,i.sw,i.sh,0,0,t,t),s.getImageData(0,0,t,t)}ga(new W_);function Ei(r,e){this.x=r,this.y=e}Ei.prototype={clone(){return new Ei(this.x,this.y)},add(r){return this.clone()._add(r)},sub(r){return this.clone()._sub(r)},multByPoint(r){return this.clone()._multByPoint(r)},divByPoint(r){return this.clone()._divByPoint(r)},mult(r){return this.clone()._mult(r)},div(r){return this.clone()._div(r)},rotate(r){return this.clone()._rotate(r)},rotateAround(r,e){return this.clone()._rotateAround(r,e)},matMult(r){return this.clone()._matMult(r)},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(r){return this.x===r.x&&this.y===r.y},dist(r){return Math.sqrt(this.distSqr(r))},distSqr(r){const e=r.x-this.x,t=r.y-this.y;return e*e+t*t},angle(){return Math.atan2(this.y,this.x)},angleTo(r){return Math.atan2(this.y-r.y,this.x-r.x)},angleWith(r){return this.angleWithSep(r.x,r.y)},angleWithSep(r,e){return Math.atan2(this.x*e-this.y*r,this.x*r+this.y*e)},_matMult(r){const e=r[0]*this.x+r[1]*this.y,t=r[2]*this.x+r[3]*this.y;return this.x=e,this.y=t,this},_add(r){return this.x+=r.x,this.y+=r.y,this},_sub(r){return this.x-=r.x,this.y-=r.y,this},_mult(r){return this.x*=r,this.y*=r,this},_div(r){return this.x/=r,this.y/=r,this},_multByPoint(r){return this.x*=r.x,this.y*=r.y,this},_divByPoint(r){return this.x/=r.x,this.y/=r.y,this},_unit(){return this._div(this.mag()),this},_perp(){const r=this.y;return this.y=this.x,this.x=-r,this},_rotate(r){const e=Math.cos(r),t=Math.sin(r),i=e*this.x-t*this.y,n=t*this.x+e*this.y;return this.x=i,this.y=n,this},_rotateAround(r,e){const t=Math.cos(r),i=Math.sin(r),n=e.x+t*(this.x-e.x)-i*(this.y-e.y),s=e.y+i*(this.x-e.x)+t*(this.y-e.y);return this.x=n,this.y=s,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Ei},Ei.convert=function(r){if(r instanceof Ei)return r;if(Array.isArray(r))return new Ei(+r[0],+r[1]);if(r.x!==void 0&&r.y!==void 0)return new Ei(+r.x,+r.y);throw new Error("Expected [x, y] or {x, y} point format")};class Lh{constructor(e,t,i,n,s){this.properties={},this.extent=i,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=n,this._values=s,e.readFields(V_,this,t)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos,i=[];let n,s=1,a=0,c=0,h=0;for(;e.pos<t;){if(a<=0){const d=e.readVarint();s=d&7,a=d>>3}if(a--,s===1||s===2)c+=e.readSVarint(),h+=e.readSVarint(),s===1&&(n&&i.push(n),n=[]),n&&n.push(new Ei(c,h));else if(s===7)n&&n.push(n[0].clone());else throw new Error(`unknown command ${s}`)}return n&&i.push(n),i}bbox(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos;let i=1,n=0,s=0,a=0,c=1/0,h=-1/0,d=1/0,m=-1/0;for(;e.pos<t;){if(n<=0){const f=e.readVarint();i=f&7,n=f>>3}if(n--,i===1||i===2)s+=e.readSVarint(),a+=e.readSVarint(),s<c&&(c=s),s>h&&(h=s),a<d&&(d=a),a>m&&(m=a);else if(i!==7)throw new Error(`unknown command ${i}`)}return[c,d,h,m]}toGeoJSON(e,t,i){const n=this.extent*Math.pow(2,i),s=this.extent*e,a=this.extent*t,c=this.loadGeometry();function h(g){return[(g.x+s)*360/n-180,360/Math.PI*Math.atan(Math.exp((1-(g.y+a)*2/n)*Math.PI))-90]}function d(g){return g.map(h)}let m;if(this.type===1){const g=[];for(const w of c)g.push(w[0]);const _=d(g);m=g.length===1?{type:"Point",coordinates:_[0]}:{type:"MultiPoint",coordinates:_}}else if(this.type===2){const g=c.map(d);m=g.length===1?{type:"LineString",coordinates:g[0]}:{type:"MultiLineString",coordinates:g}}else if(this.type===3){const g=A_(c),_=[];for(const w of g)_.push(w.map(d));m=_.length===1?{type:"Polygon",coordinates:_[0]}:{type:"MultiPolygon",coordinates:_}}else throw new Error("unknown feature type");const f={type:"Feature",geometry:m,properties:this.properties};return this.id!=null&&(f.id=this.id),f}}Lh.types=["Unknown","Point","LineString","Polygon"];function V_(r,e,t){r===1?e.id=t.readVarint():r===2?I_(t,e):r===3?e.type=t.readVarint():r===4&&(e._geometry=t.pos)}function I_(r,e){const t=r.readVarint()+r.pos;for(;r.pos<t;){const i=e._keys[r.readVarint()],n=e._values[r.readVarint()];e.properties[i]=n}}function A_(r){const e=r.length;if(e<=1)return[r];const t=[];let i,n;for(let s=0;s<e;s++){const a=F_(r[s]);a!==0&&(n===void 0&&(n=a<0),n===a<0?(i&&t.push(i),i=[r[s]]):i&&i.push(r[s]))}return i&&t.push(i),t}function F_(r){let e=0;for(let t=0,i=r.length,n=i-1,s,a;t<i;n=t++)s=r[t],a=r[n],e+=(a.x-s.x)*(s.y+a.y);return e}let O_=class{constructor(e,t){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(z_,this,t),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const t=this._pbf.readVarint()+this._pbf.pos;return new Lh(this._pbf,t,this.extent,this._keys,this._values)}};function z_(r,e,t){r===15?e.version=t.readVarint():r===1?e.name=t.readString():r===5?e.extent=t.readVarint():r===2?e._features.push(t.pos):r===3?e._keys.push(t.readString()):r===4&&e._values.push(D_(t))}function D_(r){let e=null;const t=r.readVarint()+r.pos;for(;r.pos<t;){const i=r.readVarint()>>3;e=i===1?r.readString():i===2?r.readFloat():i===3?r.readDouble():i===4?r.readVarint64():i===5?r.readVarint():i===6?r.readSVarint():i===7?r.readBoolean():null}if(e==null)throw new Error("unknown feature value");return e}class X_{constructor(e,t){this.layers=e.readFields(k_,{},t)}}function k_(r,e,t){if(r===3){const i=new O_(t,t.readVarint()+t.pos);i.length&&(e[i.name]=i)}}const ya=65536*65536,Ph=1/ya,U_=12,Ch=typeof TextDecoder>"u"?null:new TextDecoder("utf-8"),_a=0,Ts=1,Ar=2,Gs=5;class N_{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,t,i=this.length){for(;this.pos<i;){const n=this.readVarint(),s=n>>3,a=this.pos;this.type=n&7,e(s,t,this),this.pos===a&&this.skip(n)}return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*ya;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*ya;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const t=this.buf;let i,n;return n=t[this.pos++],i=n&127,n<128||(n=t[this.pos++],i|=(n&127)<<7,n<128)||(n=t[this.pos++],i|=(n&127)<<14,n<128)||(n=t[this.pos++],i|=(n&127)<<21,n<128)?i:(n=t[this.pos],i|=(n&15)<<28,K_(i,e,this))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2===1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){const e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=U_&&Ch?Ch.decode(this.buf.subarray(t,e)):iv(this.buf,t,e)}readBytes(){const e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===Ar?this.readVarint()+this.pos:this.pos+1}skip(e){const t=e&7;if(t===_a)for(;this.buf[this.pos++]>127;);else if(t===Ar)this.pos=this.readVarint()+this.pos;else if(t===Gs)this.pos+=4;else if(t===Ts)this.pos+=8;else throw new Error(`Unimplemented type: ${t}`)}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){const i=new Uint8Array(t);i.set(this.buf),this.buf=i,this.dataView=new DataView(i.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Ph),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Ph),!0),this.pos+=8}writeVarint(e){if(e=+e||0,e>268435455||e<0){B_(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))}writeSVarint(e){this.writeVarint(e<0?-e*2-1:e*2)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(e.length*4),this.pos++;const t=this.pos;this.pos=nv(this.buf,e,this.pos);const i=this.pos-t;i>=128&&Th(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const t=e.length;this.writeVarint(t),this.realloc(t);for(let i=0;i<t;i++)this.buf[this.pos++]=e[i]}writeRawMessage(e,t){this.pos++;const i=this.pos;e(t,this);const n=this.pos-i;n>=128&&Th(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n}writeMessage(e,t,i){this.writeTag(e,Ar),this.writeRawMessage(t,i)}writePackedVarint(e,t){t.length&&this.writeMessage(e,j_,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,J_,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,$_,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,Q_,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,H_,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,E_,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,q_,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,ev,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,tv,t)}writeBytesField(e,t){this.writeTag(e,Ar),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,Gs),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,Gs),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,Ts),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,Ts),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,_a),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,_a),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,Ar),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,Gs),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,Ts),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}}function K_(r,e,t){const i=t.buf;let n,s;if(s=i[t.pos++],n=(s&112)>>4,s<128||(s=i[t.pos++],n|=(s&127)<<3,s<128)||(s=i[t.pos++],n|=(s&127)<<10,s<128)||(s=i[t.pos++],n|=(s&127)<<17,s<128)||(s=i[t.pos++],n|=(s&127)<<24,s<128)||(s=i[t.pos++],n|=(s&1)<<31,s<128))return Jn(r,n,e);throw new Error("Expected varint not more than 10 bytes")}function Jn(r,e,t){return t?e*4294967296+(r>>>0):(e>>>0)*4294967296+(r>>>0)}function B_(r,e){let t,i;if(r>=0?(t=r%4294967296|0,i=r/4294967296|0):(t=~(-r%4294967296),i=~(-r/4294967296),t^4294967295?t=t+1|0:(t=0,i=i+1|0)),r>=18446744073709552e3||r<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),Y_(t,i,e),R_(i,e)}function Y_(r,e,t){t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos]=r&127}function R_(r,e){const t=(r&7)<<4;e.buf[e.pos++]|=t|((r>>>=3)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127)))))}function Th(r,e,t){const i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));t.realloc(i);for(let n=t.pos-1;n>=r;n--)t.buf[n+i]=t.buf[n]}function j_(r,e){for(let t=0;t<r.length;t++)e.writeVarint(r[t])}function J_(r,e){for(let t=0;t<r.length;t++)e.writeSVarint(r[t])}function Q_(r,e){for(let t=0;t<r.length;t++)e.writeFloat(r[t])}function H_(r,e){for(let t=0;t<r.length;t++)e.writeDouble(r[t])}function $_(r,e){for(let t=0;t<r.length;t++)e.writeBoolean(r[t])}function E_(r,e){for(let t=0;t<r.length;t++)e.writeFixed32(r[t])}function q_(r,e){for(let t=0;t<r.length;t++)e.writeSFixed32(r[t])}function ev(r,e){for(let t=0;t<r.length;t++)e.writeFixed64(r[t])}function tv(r,e){for(let t=0;t<r.length;t++)e.writeSFixed64(r[t])}function iv(r,e,t){let i="",n=e;for(;n<t;){const s=r[n];let a=null,c=s>239?4:s>223?3:s>191?2:1;if(n+c>t)break;let h,d,m;c===1?s<128&&(a=s):c===2?(h=r[n+1],(h&192)===128&&(a=(s&31)<<6|h&63,a<=127&&(a=null))):c===3?(h=r[n+1],d=r[n+2],(h&192)===128&&(d&192)===128&&(a=(s&15)<<12|(h&63)<<6|d&63,(a<=2047||a>=55296&&a<=57343)&&(a=null))):c===4&&(h=r[n+1],d=r[n+2],m=r[n+3],(h&192)===128&&(d&192)===128&&(m&192)===128&&(a=(s&15)<<18|(h&63)<<12|(d&63)<<6|m&63,(a<=65535||a>=1114112)&&(a=null))),a===null?(a=65533,c=1):a>65535&&(a-=65536,i+=String.fromCharCode(a>>>10&1023|55296),a=56320|a&1023),i+=String.fromCharCode(a),n+=c}return i}function nv(r,e,t){for(let i=0,n,s;i<e.length;i++){if(n=e.charCodeAt(i),n>55295&&n<57344)if(s)if(n<56320){r[t++]=239,r[t++]=191,r[t++]=189,s=n;continue}else n=s-55296<<10|n-56320|65536,s=null;else{n>56319||i+1===e.length?(r[t++]=239,r[t++]=191,r[t++]=189):s=n;continue}else s&&(r[t++]=239,r[t++]=191,r[t++]=189,s=null);n<128?r[t++]=n:(n<2048?r[t++]=n>>6|192:(n<65536?r[t++]=n>>12|224:(r[t++]=n>>18|240,r[t++]=n>>12&63|128),r[t++]=n>>6&63|128),r[t++]=n&63|128)}return t}var rv=Object.defineProperty,sv=(r,e,t)=>e in r?rv(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,va=(r,e,t)=>sv(r,typeof e!="symbol"?e+"":e,t);class ov extends fa{constructor(){super(),va(this,"dataType","mvt"),va(this,"_loader",new p.FileLoader(De.manager)),va(this,"_render",new yh),this._loader.setResponseType("arraybuffer")}async doLoad(e,t){const i=await this._loader.loadAsync(e),n=new X_(new N_(i)),s=this.drawTile(n,t.source.style,t.z);return new p.CanvasTexture(s)}drawTile(e,t,i){const c=new OffscreenCanvas(256,256).getContext("2d");if(c){if(t)for(const h in t.layer){const d=t.layer[h];if(t&&(i<(d.minLevel??1)||i>(d.maxLevel??20)))continue;const m=e.layers[h];if(m){const f=256/m.extent;this._renderLayer(c,m,d,f)}}else for(const h in e.layers){const d=e.layers[h],m=256/d.extent;this._renderLayer(c,d,void 0,m)}return c.canvas}else throw new Error("Canvas context is not available")}_renderLayer(e,t,i,n=1){e.save();for(let s=0;s<t.length;s++){const a=t.feature(s);this._renderFeature(e,a,i,n)}return e.restore(),this}_renderFeature(e,t,i={},n=1){const s=[rt.Unknown,rt.Point,rt.Linestring,rt.Polygon][t.type],a={geometry:t.loadGeometry(),properties:t.properties};this._render.render(e,s,a,i,n)}_convertToGeoJSONFeature(e,t){const i=this._convertGeometryToGeoJSON(e.geometry,t);return i?{type:"Feature",geometry:i,properties:e.properties||{},id:e.id}:null}_convertGeometryToGeoJSON(e,t){switch(t){case rt.Point:return this._convertPointGeometry(e);case rt.Linestring:return this._convertLineGeometry(e);case rt.Polygon:return this._convertPolygonGeometry(e);default:return console.warn("未知的几何类型:",t),null}}_convertPointGeometry(e){const t=[];for(const i of e)for(const n of i)t.push([n.x,n.y]);return t.length===0?null:t.length===1?{type:"Point",coordinates:t[0]}:{type:"MultiPoint",coordinates:t}}_convertLineGeometry(e){const t=[];for(const i of e){const n=[];for(const s of i)n.push([s.x,s.y]);n.length>=2&&t.push(n)}return t.length===0?null:t.length===1?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t}}_convertPolygonGeometry(e){const t=[];let i=[];for(const n of e){const s=[];for(const a of n)s.push([a.x,a.y]);s.length>=4&&(this._isRingClockwise(s)||i.length===0?(i.length>0&&t.push(i),i=[s]):i.push(s))}return i.length>0&&t.push(i),t.length===0?null:t.length===1?{type:"Polygon",coordinates:t[0]}:{type:"MultiPolygon",coordinates:t}}_isRingClockwise(e){let t=0;for(let i=0;i<e.length-1;i++){const[n,s]=e[i],[a,c]=e[i+1];t+=(a-n)*(c+s)}return t>0}convertVectorTileToGeoJSON(e){const t=[];for(const i in e.layers){const n=e.layers[i];for(let s=0;s<n.length;s++){const a=n.feature(s),c=[rt.Unknown,rt.Point,rt.Linestring,rt.Polygon][a.type],h={geometry:a.loadGeometry(),properties:a.properties},d=this._convertToGeoJSONFeature(h,c);d&&(d.properties._layer=i,t.push(d))}}return{type:"FeatureCollection",features:t}}}ma(new ov);const Gh="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IF89MjMyODMwNjQzNjUzODY5NjNlLTI2LG09MTIsUD10eXBlb2YgVGV4dERlY29kZXI+InUiP251bGw6bmV3IFRleHREZWNvZGVyKCJ1dGYtOCIpLGc9MCx5PTEsRj0yLHA9NTtjbGFzcyBNe2NvbnN0cnVjdG9yKHQ9bmV3IFVpbnQ4QXJyYXkoMTYpKXt0aGlzLmJ1Zj1BcnJheUJ1ZmZlci5pc1ZpZXcodCk/dDpuZXcgVWludDhBcnJheSh0KSx0aGlzLmRhdGFWaWV3PW5ldyBEYXRhVmlldyh0aGlzLmJ1Zi5idWZmZXIpLHRoaXMucG9zPTAsdGhpcy50eXBlPTAsdGhpcy5sZW5ndGg9dGhpcy5idWYubGVuZ3RofXJlYWRGaWVsZHModCxlLHI9dGhpcy5sZW5ndG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jb25zdCBlPWF3YWl0IEsodC5hcnJheUJ1ZmZlcix0LngsdC55LHQueik7c2VsZi5wb3N0TWVzc2FnZShlKX1jYXRjaChlKXtjb25zb2xlLmVycm9yKCJXb3JrZXIgTVZUIOino+aekOWksei0pToiLGUpLHNlbGYucG9zdE1lc3NhZ2Uoe2Vycm9yOmUubWVzc2FnZX0pfX19KSgpOwo=",av=r=>Uint8Array.from(atob(r),e=>e.charCodeAt(0)),Wh=typeof self<"u"&&self.Blob&&new Blob([av(Gh)],{type:"text/javascript;charset=utf-8"});function lv(r){let e;try{if(e=Wh&&(self.URL||self.webkitURL).createObjectURL(Wh),!e)throw"";const t=new Worker(e,{name:r?.name});return t.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),t}catch{return new Worker("data:text/javascript;base64,"+Gh,{name:r?.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}var cv=Object.defineProperty,hv=(r,e,t)=>e in r?cv(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ws=(r,e,t)=>hv(r,typeof e!="symbol"?e+"":e,t);const uv=10;class dv{constructor(){Ws(this,"info",{version:"1.0.0",description:"Vector Tile loader for Mapbox Vector Tile format. It can load and parse MVT data."}),Ws(this,"dataType","VectorTile"),Ws(this,"fileLoader",new p.FileLoader(De.manager)),Ws(this,"_workerPool",new $o(0)),this.fileLoader.setResponseType("arraybuffer"),this._workerPool.setWorkerCreator(()=>new lv)}async load(e){const{source:t,x:i,y:n,z:s}=e,a=typeof t._getUrl=="function"?t._getUrl(i,n,s):this.buildTileUrl(t.url,i,n,s);if(!a)return this.createErrorGeometry(i,n,s,new Error("VectorTileLoader: source._getUrl 返回空 URL"));this._workerPool.pool===0&&this._workerPool.setWorkerLimit(uv);try{const c=await this.fetchVectorData(a),h={arrayBuffer:c,x:i,y:n,z:s},m=(await this._workerPool.postMessage(h,[c])).data;if(m.error)throw new Error(m.error);const f=this.createGeometryWithVectorData(m,e);return De.manager.parseEnd(a),f}catch(c){return this.createErrorGeometry(i,n,s,c)}}async fetchVectorData(e){try{const t=await this.fileLoader.loadAsync(e);if(!t||t.byteLength===0)throw new Error("Empty response");return t}catch(t){throw new Error(`Failed to fetch vector tile: ${t.message}`)}}calculateTileBounds(e,t,i){const n=4007501668557849e-8/Math.pow(2,i),s=-20037508342789244e-9+e*n,a=s+n,c=20037508342789244e-9-(t+1)*n,h=c+n;return{min:new p.Vector2(s,c),max:new p.Vector2(a,h),world:new p.Vector2(n,n)}}buildTileUrl(e,t,i,n){return e.replace("{x}",t.toString()).replace("{y}",i.toString()).replace("{z}",n.toString()).replace("{-y}",(Math.pow(2,n)-1-i).toString())}createGeometryWithVectorData(e,t){const i=new jn;return i.userData={vectorData:e,tileInfo:{x:t.x,y:t.y,z:t.z,bounds:t.bounds},metadata:{dataType:"vector-tile",version:"1.0.0",loadedAt:Date.now()}},i}createErrorGeometry(e,t,i,n){const s=new jn;return s.userData={vectorData:{x:e,y:t,z:i,layers:{},totalFeatures:0,bounds:this.calculateTileBounds(e,t,i),error:n.message,timestamp:Date.now(),dataFormat:"error"},tileInfo:{x:e,y:t,z:i,bounds:[0,0,0,0]},metadata:{dataType:"vector-tile-error",error:!0,errorMessage:n.message}},s}unload(e){e.userData?.vectorData&&(e.userData.vectorData=null),e.dispose&&e.dispose()}static getVectorData(e){return e.userData?.vectorData||null}static hasValidVectorData(e){const t=this.getVectorData(e);return t&&!t.error&&t.totalFeatures>0}static getLayerNames(e){const t=this.getVectorData(e);return t?Object.keys(t.layers||{}):[]}static getFeaturesByLayer(e,t){return this.getVectorData(e)?.layers?.[t]?.convertedFeatures||[]}}wh(new dv);var fv=Object.defineProperty,pv=(r,e,t)=>e in r?fv(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,qi=(r,e,t)=>pv(r,typeof e!="symbol"?e+"":e,t);class wa extends hh{constructor(e,t){if(super(e,t),qi(this,"layerType","vector"),qi(this,"_tileDataMap",new Map),qi(this,"_renderer"),qi(this,"_style"),qi(this,"_feaList",[]),qi(this,"_collision",!1),qi(this,"_renderAltitude",0),qi(this,"_eventsBound",!1),!t.style)throw new Error("VectorTileLayer must provide style configuration! VectorTileLayer 必须提供样式配置");this._style=t.style,this._collision=t.collision||!1,this._featureFilter=t.featureFilter,this._renderAltitude=t.altitude||0,this._rootTile.setDataOnlyMode(!0),this._setupDataModeAndListenersForChildren(),this._setupLifeCycleListeners()}_setupDataModeAndListenersForChildren(){const e=t=>{t!==this._rootTile&&t.setDataOnlyMode(!0),this._addShownListenerToTile(t),this._addUnloadListenerToTile(t)};this._rootTile.addEventListener("tile-created",t=>{const i=t.tile;e(i)}),this._rootTile.traverse(t=>{t.isTile&&e(t)})}_addShownListenerToTile(e){const t=i=>{const n=i.tile,s=`${n.z}-${n.x}-${n.y}`,a=!!this._renderer,c=this._tileDataMap.get(s);a&&c&&this._renderer.processTileData(n,c.data)};e.addEventListener("tile-shown",t)}_addUnloadListenerToTile(e){const t=i=>{const n=i.tile||i.target,s=`${n.z}-${n.x}-${n.y}`;if(this._renderer)try{this._renderer.removeFeaturesByTileKey(s)}catch{}this._tileDataMap.delete(s)};e.addEventListener("unload",t)}setAltitude(e){return super.setAltitude(0),this._renderAltitude=e,this._renderer&&this._renderer.setAltitude(e),this}getAltitude(){return this._renderAltitude}_addHiddenListenerToTile(e){const t=i=>{const n=i.tile,s=`${n.z}-${n.x}-${n.y}`;if(this._renderer)try{this._renderer.hideFeaturesByTileKey(s)}catch{}};e.addEventListener("tile-hidden",t)}_setupLifeCycleListeners(){this._rootTile.addEventListener("tile-loaded",e=>{const t=e.tile,i=`${t.z}-${t.x}-${t.y}`,n=this.getVectorDataFromTile(t);if(!n){console.warn(`[VectorTileLayer] Tile ${i} loaded but has no vector data.`);return}if(n.vectorData?.dataFormat==="mvt"&&this._tileDataMap.set(i,{data:n,tile:t,timestamp:Date.now(),pending:!1}),t.showing&&this._renderer&&n.vectorData?.dataFormat==="mvt")try{this._renderer.processTileData(t,n)}catch{}})}getVectorDataFromTile(e){return!e.geometry||!e.getVectorData()?null:e.getVectorData()}createLoader(){const e=new Ls;return e.vtSource=this.source,e}getVisibleVectorTiles(){const e=[];return this._rootTile.traverse(t=>{if(t.isTile&&t.loaded&&t.inFrustum){const i=`${t.z}-${t.x}-${t.y}`,n=this._tileDataMap.get(i);n&&e.push({tileKey:i,data:n.data,tile:n.tile})}}),e}getAllVectorData(){return new Map(this._tileDataMap)}getVectorData(e,t,i){const n=`${i}-${e}-${t}`,s=this._tileDataMap.get(n);return s?s.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)}hide(){return super.hide(),this._renderer&&this._renderer.hide(),this}show(){return super.show(),this._renderer&&this._renderer.show(),this}update(e){!this.enabled||!this.visible||super.update(e)}dispose(){this._renderer&&this._renderer.dispose(),super.dispose()}setFeaturePickingEnabled(e){this.options.enableFeaturePicking=e,this._renderer&&(this._renderer.interactive=e,e&&!this._eventsBound&&this._bindRendererEvents(this._renderer))}_bindRendererEvents(e){if(this._eventsBound)return;["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu"].forEach(i=>{const n="feature"+i;e.on(n,s=>{this.trigger(n,s)})}),this._eventsBound=!0}_setRenderer(e){this._renderer=e,this._eventsBound=!1,this.options.enableFeaturePicking&&this._bindRendererEvents(e)}_getRenderer(){return this._renderer||null}getProcessStats(){return this._renderer?this._renderer.getProcessStats():null}resetProcessStats(){this._renderer?.resetProcessStats()}getStyle(){return this._style}setStyle(e){if(this._style=e,this._renderer){this._renderer.style=e;const t=performance.now();let i=0;this._tileDataMap.forEach((a,c)=>{this._renderer.removeFeaturesByTileKey(c)}),this.getVisibleVectorTiles().forEach(({tile:a,data:c})=>{this._renderer.processTileData(a,c),i++});const s=performance.now()-t;console.log(`[setStyle] 重新处理 ${i} 个瓦片 耗时: ${s.toFixed(2)}ms`)}return this}setSymbol(e){return this.setStyle(e)}}var mv=Object.defineProperty,gv=(r,e,t)=>e in r?mv(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Be=(r,e,t)=>gv(r,typeof e!="symbol"?e+"":e,t);class yv{constructor(...e){}}const _v={};let Pn=class ff extends Qo(Yi(xn(yv))){constructor(e,t){Ko(e,"container","Map container element must be specified");const i=["center","basemap"];for(const W of i)wc(t,W);const s={...t,viewer:{...{viewer:{antialias:!0,stencil:!0,logarithmicDepthBuffer:!0}}.viewer,...t.viewer}};super(s),Be(this,"viewer"),Be(this,"tilemap"),Be(this,"center"),Be(this,"prjcenter"),Be(this,"_layerContainer"),Be(this,"_EventMap",{loaded:{listened:!1}}),Be(this,"_canvasManager",new $g),Be(this,"collisionEngine"),Be(this,"_onLoadHooks"),Be(this,"_minZoom",0),Be(this,"_maxZoom",22),Be(this,"_ZOOM_MIN_CONST",0),Be(this,"_ZOOM_MAX_CONST",22),Be(this,"_minZoomDistance",500),Be(this,"_maxZoomDistance",8e4),Be(this,"_isZooming",!1),Be(this,"_zoomStartValue",0),Be(this,"_lastZoomForControls",0),Be(this,"_overZoom",0),Be(this,"_lastCameraDistance",0),this.tilemap=this.initTileMap(s.basemap),this.center=this.options.center,this.viewer=new Cc(e,{...s.viewer,map:this}),this.tilemap.receiveShadow=!0,this.viewer.scene.add(this.tilemap);const a=this.tilemap.geo2world(new p.Vector3(this.center[0],this.center[1],0));this.prjcenter=a;const c=this.options.viewer??{};this.viewer.flyToPoint({center:this.center,distance:typeof this.center[2]=="number"?this.center[2]:void 0,polarDeg:typeof c.polarDeg=="number"?c.polarDeg:void 0,azimuthDeg:typeof c.azimuthDeg=="number"?c.azimuthDeg:void 0,polarAngle:c.polarAngle,azimuthAngle:c.azimuthAngle,duration:0,curvePath:!1}),this._minZoomDistance=this.viewer.controls.minDistance,this._maxZoomDistance=this.viewer.controls.maxDistance;const h=this._getCameraDistance();this._lastCameraDistance=h,this._layerContainer=new jg,this.viewer.scene.add(this._layerContainer);const d=this.viewer.controls;this._minZoomDistance=typeof d?.minDistance=="number"?d.minDistance:500,this._maxZoomDistance=typeof d?.maxDistance=="number"?d.maxDistance:8e4;const f=this.tilemap.getLayers().find(W=>W.isBaseLayer===!0)?.minLevel??this.tilemap.minLevel;this._minZoom=Math.max(this._ZOOM_MIN_CONST,Math.min(this._ZOOM_MAX_CONST,f)),this._maxZoom=this._ZOOM_MAX_CONST;const g=this.prjcenter,w=this.viewer.camera.position.clone().clone().sub(g).normalize(),x=us(t.zoom)?13:t.zoom,L=Math.max(this._minZoom,Math.min(this._maxZoom,x)),M=this._computeDistanceFromZoom(L);a.clone().addScaledVector(w,M);const C=this.getZoom();this._lastZoomForControls=C,this._zoomStartValue=C,this.collisionEngine=new C0(this.viewer.renderer,{padding:8,updateInterval:16,animationDuration:200,maxFeaturesPerFrame:2e4,strategies:{priority:!0,grouping:!0,proximity:!0}}),this.on("control-change",T0.debounce(W=>{if(!this.tilemap||!this.collisionEngine)return;const D=this.tilemap,z=D.getDataZoom(),I=D.getLayers().find(H=>H.isBaseLayer===!0)?.maxLevel??D.maxLevel,U=this._getCameraDistance(),V=U-this._lastCameraDistance;this._lastCameraDistance=U;const{max:G}=this._getViewZoomRange(),N=Math.max(0,G-I);z<I?this._overZoom=0:V<-.001?this._overZoom=Math.min(this._overZoom+1,N):V>.001&&(this._overZoom=Math.max(this._overZoom-1,0));const j=this.getZoom();Math.abs(j-this._lastZoomForControls)>.001&&(this._isZooming?this.trigger("zooming",{from:this._zoomStartValue,to:j}):(this._isZooming=!0,this._zoomStartValue=this._lastZoomForControls,this.trigger("zoomstart",{from:this._zoomStartValue,to:j})),this._lastZoomForControls=j),this.collisionEngine.update(W.camera)},10,{leading:!1,trailing:!0})),this.on("control-end",()=>{this._isZooming&&(this._isZooming=!1,this.trigger("zoomend",{from:this._zoomStartValue,to:this.getZoom()}))}),this._callOnLoadHooks()}static addOnLoadHook(e,...t){const i=typeof e=="function"?e:function(){this[e].apply(this,t)},n=this.prototype;return n._onLoadHooks=n._onLoadHooks||[],n._onLoadHooks.push(i),this}_callOnLoadHooks(){const e=ff.prototype;if(e._onLoadHooks)for(let t=0,i=e._onLoadHooks.length;t<i;t++)e._onLoadHooks[t].call(this)}getZoom(){const e=this.tilemap,t=e.getDataZoom(),n=e.getLayers().find(s=>s.isBaseLayer===!0)?.maxLevel??e.maxLevel;return t<n?t:n+this._overZoom}getDataZoom(){return this.tilemap.getDataZoom()}getMinZoom(){return this._minZoom}getMaxZoom(){return this._maxZoom}setZoomRange(e,t){if(e>t){const n=e;e=t,t=n}this._minZoom=e,this._maxZoom=t;const i=this.viewer.controls;if(i){const n=this._computeDistanceFromZoom(this._maxZoom),s=this._computeDistanceFromZoom(this._minZoom);i.minDistance=n,i.maxDistance=s}return this}setMinZoom(e){return this.setZoomRange(e,this._maxZoom)}setMaxZoom(e){return this.setZoomRange(this._minZoom,e)}setZoom(e){const t=this.getMinZoom(),i=this.getMaxZoom(),n=Math.max(t,Math.min(i,e)),s=this.getZoom(),a=this._computeDistanceFromZoom(n),c=this.viewer.controls,h=c?.target??this.prjcenter,d=this.viewer.camera,m=d.position.clone().sub(h).normalize();return d.position.copy(h).addScaledVector(m,a),d.updateProjectionMatrix(),typeof c?.update=="function"&&c.update(),this._lastZoomForControls=n,this.trigger("zoomend",{from:s,to:this.getZoom()}),this}zoomIn(e=1){return this.setZoom(this.getZoom()+e)}zoomOut(e=1){return this.setZoom(this.getZoom()-e)}_computeDistanceFromZoom(e){const t=this._ZOOM_MIN_CONST,i=this._ZOOM_MAX_CONST,n=this._minZoomDistance,s=this._maxZoomDistance;if(n<=0||n>=s){const m=Math.max(t,Math.min(i,e)),f=(i-m)/(i-t);return n+f*(s-n)}const c=(Math.max(t,Math.min(i,e))-t)/(i-t),h=n/s;return s*Math.pow(h,c)}initTileMap(e){const t=new gs({...e});try{if(e.Baselayers?.length)for(const i of e.Baselayers)i.isBaseLayer=!0,t.addLayer(i)}catch(i){console.error("💥 Diagnostic failed 诊断失败:",i)}return t.rotateX(-Math.PI/2),t.receiveShadow=!0,setTimeout(()=>{const i={timestamp:xc(),targrt:this};this._EventMap.loaded={listened:!0},this.trigger("loaded",i)},0),t}addLayer(e,...t){if(!e)return this;Array.isArray(e)||(e=[e]),t?.length&&(e=e.concat(t)),t?.length&&(e=e.concat(t));for(let i=0,n=e.length;i<n;i++){const s=e[i],a=s.getId();if(us(a))throw new Error("Invalid id for the layer: "+a);s.isTileLayer?this.addTileLayer(s):this.addRegularLayer(s)}return this}removeLayer(e){const t=typeof e=="string"?e:e.getId(),i=this.tilemap.getLayer(t);if(i){if(i instanceof wa){const s=i._getRenderer();s&&this._layerContainer.remove(s)}return this.tilemap.removeLayer(t),!0}const n=this._layerContainer.getLayerById(t);return n?(this._layerContainer.remove(n),n instanceof ji&&n?._collision,!0):(console.warn(`⚠️ Layer does not exist 图层不存在: ${t}`),!1)}addRegularLayer(e){this._layerContainer.add(e),e._bindMap(this),e instanceof ji&&e?._collision&&(this.collisionEngine.registerLayer(e),e.setCollisionEngine(this.collisionEngine))}addTileLayer(e){if(this.tilemap.addLayer(e),e._bindMap(this),e instanceof wa){const t=e.options||{},i=new Ms(e.getId()+"-vtrender",{altitude:e.getAltitude(),style:e.getStyle(),collision:e._collision,zIndex:typeof t.zIndex=="number"?t.zIndex:void 0,depthOffset:typeof t.depthOffset=="number"?t.depthOffset:void 0});t.enableFeaturePicking&&(i.interactive=!0),e._setRenderer(i),this.addRegularLayer(i)}return this}clearLayers(){return this._layerContainer.clear(),this.tilemap.clearLayers(),this}getLayers(){const e=this._layerContainer.getLayers().filter(i=>!(i instanceof Ms)),t=this.tilemap.getLayers();return[...e,...t]}getLayerById(e){const t=this._layerContainer.getLayerById(e);return t?t instanceof Ms?void 0:t: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,t=30,i){return this._canvasManager.getCanvas(e,t,1,i)}getContainer(){return this.viewer.container}getRenderer(){return this.viewer.renderer}getCamera(){return this.viewer.camera}_findFeaturesAt(e){const t=this,i=t.getRenderer(),n=t.getCamera(),s=i.domElement.getBoundingClientRect(),a=e.x/s.width*2-1,c=-(e.y/s.height)*2+1,h=new p.Raycaster;h.setFromCamera(new p.Vector2(a,c),n);const d=[...t.getLayers(),...t._layerContainer.getLayers().filter(g=>g instanceof Ms&&g.interactive)].filter(g=>!g?.isSceneLayer&&g?.visible===!0),f=h.intersectObjects(d,!0).map(g=>{let _=g.object,w=null;for(;_;){if(_ instanceof dt){w=_;break}_=_.parent}if(!w||w.visible===!1)return null;const b=t.world2geo(g.point);return{feature:w,distance:g.distance,object:g.object,intersectcoordinate:[b.x,b.y,b.z]}}).filter(g=>!!g);return f.length?f.sort((g,_)=>(g?.distance??0)-(_?.distance??0)):[]}getCenter(){const e=this.viewer.controls.target.clone(),t=this.world2geo(e);return[t.x,t.y,t.z]}_getEventPosition(e){let t,i;if("touches"in e){if(e.touches.length===0)return null;t=e.touches[0].clientX,i=e.touches[0].clientY}else t=e.clientX,i=e.clientY;const n=this.getContainer();if(!n)return null;const s=n.getBoundingClientRect();return{x:t-s.left,y:i-s.top}}get isInteracting(){return this.viewer?this.viewer.isInteracting:!1}_getCameraDistance(){const e=this.viewer.controls,t=this.viewer.camera,i=e?.target??this.prjcenter;return e&&typeof e.getDistance=="function"?e.getDistance():t.position.distanceTo(i)}_getViewZoomRange(){const e=this.viewer.controls,t=typeof e?.minDistance=="number"?e.minDistance:this._minZoomDistance,i=typeof e?.maxDistance=="number"?e.maxDistance:this._maxZoomDistance;if(t<=0||t>=i){const f=this.tilemap.getDataZoom();return{min:f,max:f}}const n=i/t,s=Math.log2(n),a=this.tilemap.getLayers().find(f=>f.isBaseLayer===!0),c=a?.minLevel??this.tilemap.minLevel,h=a?.maxLevel??this.tilemap.maxLevel,d=c,m=h+s;return{min:d,max:m}}flyTo(e){this.viewer.flyToAdvanced(e)}flyToPoint(e){this.viewer.flyToPoint(e)}destroy(){try{this._clearHandlers(),["control-change","control-start","control-end","zoomstart","zooming","zoomend","loaded"].forEach(t=>{const i=this._listenerMap?.get(t);i&&i.forEach((n,s)=>{this.off(t,s)})}),this.clearLayers(),Ac.clearCache(),this.collisionEngine&&(this.collisionEngine=null),this._layerContainer&&(this._layerContainer.clear(),this._layerContainer=null),this.tilemap&&(this.tilemap.dispose(),this.tilemap=null),this._canvasManager&&(this._canvasManager=null),this.viewer&&(this.viewer.destroy(),this.viewer=null),this._EventMap={loaded:{listened:!1}}}catch(e){console.error("Error destroying map 销毁地图时出错:",e)}}};Pn.mergeOptions(_v);const vv=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout"];Pn.prototype._removeDomEvents=function(){},Pn.prototype._registerDomEvents=function(){const r=this.viewer.container;if(r){let t=null;vv.forEach(i=>{r.addEventListener(i,n=>{if(!this.viewer||!this.tilemap)return;if(i==="mousedown"&&(t={x:n.clientX,y:n.clientY}),i==="click"&&t){const c=n.clientX-t.x,h=n.clientY-t.y;if(Math.sqrt(c*c+h*h)>5)return}let s=sa(n,this.tilemap,this.viewer.camera),a={target:this,originEvent:n,eventName:i,screenXY:{X:n.screenX,Y:n.screenY}};if(s){let c=[s.x,s.y,s.z];a={target:this,originEvent:n,coordinate:c,eventName:i,screenXY:{X:n.screenX,Y:n.screenY}}}this.trigger(i,a)})})}},Pn.addOnLoadHook("_registerDomEvents");var wv=Object.defineProperty,bv=(r,e,t)=>e in r?wv(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ba=(r,e,t)=>bv(r,typeof e!="symbol"?e+"":e,t);const xv=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","touchstart","touchmove","touchend"];class Mv extends ds{constructor(){super(...arguments),ba(this,"_registeredEvents",[]),ba(this,"_mouseDownTime",0),ba(this,"_eventCommon",e=>{(e.type==="mousedown"||e.type==="touchstart")&&(this._mouseDownTime=Date.now()),!(e.type==="click"&&Date.now()-this._mouseDownTime>300)&&this._handleEvent(e,e.type)})}addHooks(){const t=this.target.getContainer();t&&xv.forEach(i=>{t.addEventListener(i,this._eventCommon),this._registeredEvents.push(i)})}removeHooks(){const t=this.target.getContainer();t&&this._registeredEvents.length>0&&(this._registeredEvents.forEach(i=>{const n=i;t.removeEventListener(n,this._eventCommon)}),this._registeredEvents=[])}_handleEvent(e,t){const i=this.target;if(!i||!i.viewer||this._shouldIgnoreEvent(t)||(t==="mousemove"||t==="mouseenter"||t==="mouseleave"||t==="mouseover"||t==="mouseout"||t==="touchmove")&&!i.getLayers().some(h=>!h.isSceneLayer&&h._feaList?.length>0))return;const n=i._getEventPosition(e);if(!n)return;const s=i._findFeaturesAt(n);if(s.length===0)return;const a=s[0].feature;switch(t){case"click":this._handleClickEvent(a,e);break;case"mousemove":case"mouseenter":case"mouseleave":case"mouseover":case"mouseout":case"touchmove":this.handleMoveEvent(a,e);break;default:if(a){this._fireFeatureEvent(a,t,e);const c=a.getLayer();c&&c.trigger("feature"+t,{feature:a,domEvent:e,type:"feature"+t})}}}_handleClickEvent(e,t){if(!e)return;this._fireFeatureEvent(e,"click",t);const i=e.getLayer();i&&i.trigger("featureclick",{feature:e,domEvent:t,type:"featureclick"})}handleMoveEvent(e,t){if(!e)return;this._fireFeatureEvent(e,t.type,t);const i=e.getLayer();i&&i.trigger("feature"+t.type,{feature:e,domEvent:t,type:"feature"+t.type})}_fireFeatureEvent(e,t,i){const n=this.target;if(!n||!n.tilemap||!n.viewer)return;let s=i,a,c;if("touches"in i){const f=i.touches[0]||i.changedTouches[0];if(!f)return;s={currentTarget:i.currentTarget,clientX:f.clientX,clientY:f.clientY},a=f.screenX,c=f.screenY}else{const f=i;s=f,a=f.screenX,c=f.screenY}const h=sa(s,n.tilemap,n.viewer.camera);if(!h)return;const d=[h.x,h.y,h.z],m={target:e,originEvent:i,coordinate:d,eventName:t,screenXY:{X:a,Y:c}};e.trigger(t,m)}_shouldIgnoreEvent(e){const t=this.target;return t.viewer?e==="mousedown"||e==="touchstart"?!1:!!t.isInteracting:!0}}Pn.mergeOptions({FeatureEvents:!0,onlyVisibleFeatureEvents:!0}),Pn.addOnLoadHook("addHandler","FeatureEvents",Mv);var Sv=Object.defineProperty,Lv=(r,e,t)=>e in r?Sv(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,bi=(r,e,t)=>Lv(r,typeof e!="symbol"?e+"":e,t);let Pv=class{constructor(...e){}};const Zh=class mr extends Yi(xn(Pv)){constructor(e={}){super(e),bi(this,"_owner"),bi(this,"_map"),bi(this,"_worldPosition"),bi(this,"_coordinate"),bi(this,"_dom"),bi(this,"_visible",!1),bi(this,"_boundMapHandlers",new Map),bi(this,"_viewerUpdateHandler"),bi(this,"_positionedOnce",!1)}_getClassName(){return"UIComponent"}getOffset(){return{x:this.options.dx??0,y:this.options.dy??0}}addTo(e){if(!e)return this;this._owner=e;const t=typeof e.getMap=="function"?e.getMap():e;return t?(this._map=t,this._bindMapEvents(!0),this.options.single&&(mr._singletons.forEach(i=>{i!==this&&i.options.single&&i._map===t&&i.hide()}),mr._singletons.add(this)),this.onAdd&&this.onAdd(),this.trigger("add",{owner:e,map:t}),this):this}remove(){const e=this._map;return this.hideDom(),this._bindMapEvents(!1),this.options.single&&mr._singletons.delete(this),this.onRemove&&this.onRemove(),this.trigger("remove",{owner:this._owner,map:e}),this._owner=void 0,this._map=void 0,this}show(e){const t=this._map??(this._owner&&typeof this._owner.getMap=="function"?this._owner.getMap():void 0);if(!t)return this;if(this._map=t,this.options.single&&(mr._singletons.forEach(i=>{i!==this&&i.options.single&&i._map===t&&i.isVisible()&&i.hide()}),mr._singletons.add(this)),!this._dom){const i=this.buildOn();this._dom=i,i.style.position="absolute",typeof this.options.zIndex=="number"&&(i.style.zIndex=String(this.options.zIndex));const n=t.getContainer();if(!n)return this;n.appendChild(i)}return this._coordinate=e?[...e]:void 0,this._visible=!0,this._positionedOnce=!1,this._dom&&(this._dom.style.display="none"),this.trigger("show",{owner:this._owner,map:t}),this}hide(){return this._visible=!1,this._dom&&(this._dom.style.display="none"),this._coordinate=void 0,this.trigger("hide",{owner:this._owner,map:this._map}),this}hideDom(){return this._dom&&this._dom.parentElement&&(this._dom.parentElement.removeChild(this._dom),this.onDomRemove&&this.onDomRemove()),this._dom=void 0,this._visible=!1,this._coordinate=void 0,this}getMap(){return this._map}isVisible(){return this._visible}_bindMapEvents(e){const t=this._map;if(!t)return;const i=t,n=e?"on":"off",s=(a,c)=>{e?this._boundMapHandlers.set(a,c):this._boundMapHandlers.delete(a)};if(e){const a=()=>{this._visible&&this._updatePosition()};i[n]("control-change",a),s("control-change",a);const c=t.viewer;if(c&&!this._viewerUpdateHandler){const h=()=>{this._visible&&this._updatePosition()};this._viewerUpdateHandler=h,c.addEventListener("update",h)}}else{this._boundMapHandlers.forEach((c,h)=>{i[n](h,c)}),this._boundMapHandlers.clear();const a=t.viewer;a&&this._viewerUpdateHandler&&(a.removeEventListener("update",this._viewerUpdateHandler),this._viewerUpdateHandler=void 0)}}_resolveWorldPosition(){const e=this._map;if(!e)return;if(this._coordinate){const[i,n,s=0]=this._coordinate,a=new p.Vector3(i,n,s);return e.geo2world(a)}const t=this._owner;if(t&&t._geometry){const i=t._geometry;if(i&&(i.type==="Point"||i.type==="MultiPoint")){let n;if(i.type==="Point"?n=i.coordinates:i.type==="MultiPoint"&&Array.isArray(i.coordinates)&&i.coordinates.length>0&&(n=i.coordinates[0]),n&&n.length>=2){const s=new p.Vector3(n[0],n[1],n[2]??0);return e.geo2world(s)}}if(t._threeGeometry&&typeof t._threeGeometry.getWorldPosition=="function"){const n=new p.Vector3;if(t._threeGeometry.getWorldPosition(n),!(n.x===0&&n.y===0&&n.z===0))return n}if(t._position instanceof p.Vector3){const n=t._position;if(!(n.x===0&&n.y===0&&n.z===0))return n.clone()}}if(t&&typeof t.getWorldPosition=="function"){const i=new p.Vector3;return t.getWorldPosition(i),i}return e.prjcenter?.clone?.()??void 0}_updatePosition(){if(!this._dom||!this._map)return;if(this._visible){const h=this._resolveWorldPosition();if(!h){this._dom.style.display="none";return}this._worldPosition=h}if(!this._worldPosition)return;const e=this._map.viewer,t=e.camera,i=this._dom.style.display==="none";i&&(this._dom.style.visibility="hidden",this._dom.style.display=""),t.updateMatrixWorld();const n=this._worldPosition.clone().project(t);if(n.x<-1.1||n.x>1.1||n.y<-1.1||n.y>1.1||n.z<-1||n.z>1){this._dom.style.display="none",i&&(this._dom.style.visibility="");return}const s=(n.x*.5+.5)*e.width,a=(-n.y*.5+.5)*e.height,c=this.getOffset();if(this._dom.style.left=`${s+c.x}px`,this._dom.style.top=`${a+c.y}px`,i&&(this._dom.style.visibility=""),!this._positionedOnce){this._positionedOnce=!0,this._dom.style.display="none";return}this._dom.style.display=""}};bi(Zh,"_singletons",new Set);let xa=Zh;var Cv=Object.defineProperty,Tv=(r,e,t)=>e in r?Cv(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Vh=(r,e,t)=>Tv(r,typeof e!="symbol"?e+"":e,t);class Ma extends xa{constructor(e){super({single:!0,...e}),Vh(this,"_titleEl"),Vh(this,"_contentEl")}_getClassName(){return"InfoWindow"}buildOn(){if(this.options.custom){let c;this.options.content instanceof HTMLElement?c=this.options.content:(c=document.createElement("div"),typeof this.options.content=="string"&&(c.innerHTML=this.options.content));const h=this.options.containerClass;return h&&(Array.isArray(h)?h:[h]).forEach(m=>{c.classList.add(m)}),this.options.minWidth&&(c.style.minWidth=`${this.options.minWidth}px`),this.options.minHeight&&(c.style.minHeight=`${this.options.minHeight}px`),this._titleEl=void 0,this._contentEl=c,c}const e=document.createElement("div");e.className="terra-infowindow";const t=this.options.containerClass;t&&(Array.isArray(t)?t:[t]).forEach(h=>{e.classList.add(h)}),typeof this.options.zIndex=="number"&&(e.style.zIndex=String(this.options.zIndex)),this.options.minWidth&&(e.style.minWidth=`${this.options.minWidth}px`),this.options.minHeight&&(e.style.minHeight=`${this.options.minHeight}px`);const i=document.createElement("div");i.className="terra-infowindow-header";const n=document.createElement("div");n.className="terra-infowindow-title",this.options.title&&(n.innerText=this.options.title);const s=document.createElement("span");s.className="terra-infowindow-close",s.innerHTML="×",s.title="关闭",s.addEventListener("click",c=>{c.stopPropagation(),c.preventDefault(),this.close()}),s.addEventListener("mousedown",c=>{c.preventDefault()}),s.style.cursor="pointer",s.style.userSelect="none",i.appendChild(n),i.appendChild(s);const a=document.createElement("div");return a.className="terra-infowindow-content",this.options.content instanceof HTMLElement?a.appendChild(this.options.content):typeof this.options.content=="string"&&(a.innerHTML=this.options.content),e.appendChild(i),e.appendChild(a),this._titleEl=n,this._contentEl=a,e}getOffset(){const e=super.getOffset(),t=this._dom;if(!t)return e;const i=t.offsetWidth,n=t.offsetHeight,s=10;let a=e.x-i/2,c=e.y-n-s;const h=this._owner,d=this.getMap();if(h&&typeof h.getStyle=="function"&&d?.viewer){const f=h.getStyle?.()?.config,g=f?.type;if(f&&(g==="icon-point"||g==="icon-label-point")){const _=Array.isArray(f.anchor)?f.anchor:[.5,.5],w=typeof _[1]=="number"?_[1]:.5;let b=0;const x=h._threeGeometry;if(x&&x instanceof p.Sprite&&(b=this._getSpriteScreenHeight(x,d.viewer)),b<=0){let L=0;if(g==="icon-point"){const M=f.size;Array.isArray(M)?L=M[1]:typeof M=="number"&&(L=M)}else if(g==="icon-label-point"){const M=f.size??f.iconSize;Array.isArray(M)?L=M[1]:typeof M=="number"&&(L=M)}b=L*(1-w)}else b=b*(1-w);b>0&&(c-=b)}}return{x:a,y:c}}_getSpriteScreenHeight(e,t){try{const i=t.camera,n=t.renderer;if(!i||!n)return 0;const s=t.height||n.domElement.clientHeight;if(!(e.material.sizeAttenuation!==!1)){const D=i.projectionMatrix.elements[5];return e.scale.y*D*s/2}const h=new p.Vector3;e.getWorldPosition(h);const d=i.position.clone(),m=h.clone().sub(d).normalize(),f=new p.Vector3;f.crossVectors(i.up,m).normalize();const g=new p.Vector3;g.crossVectors(m,f).normalize();const _=e.scale.y*(1-e.center.y),w=e.scale.y*e.center.y,b=h.clone().add(g.clone().multiplyScalar(_)),x=h.clone().sub(g.clone().multiplyScalar(w)),L=b.clone().project(i),M=x.clone().project(i),C=(-L.y*.5+.5)*s,W=(-M.y*.5+.5)*s;return Math.abs(W-C)}catch(i){return console.warn("Failed to calculate sprite screen height: // 计算 sprite 屏幕高度失败:",i),0}}setTitle(e){return this.options.title=e,this._titleEl&&(this._titleEl.innerText=e??""),this}setContent(e){return this.options.content=e,this._contentEl?(this._contentEl.innerHTML="",e instanceof HTMLElement?this._contentEl.appendChild(e):this._contentEl.innerHTML=e,this):this}open(e){super.show(e);const t=this,i=()=>{!t._dom||!t._map||!t._visible||(t._positionedOnce=!0,t._updatePosition())},s=this.getMap()?.viewer;if(s&&typeof s.addEventListener=="function"){const a=()=>{s.removeEventListener("update",a),i()};s.addEventListener("update",a)}else requestAnimationFrame(i);return this}close(){return this.hide()}}dt.include({setInfoWindow(r){this.removeInfoWindow();let e;return r instanceof Ma?e=r:e=new Ma(r),this._infoWindow=e,this.getMap()&&e.addTo(this),this},getInfoWindow(){return this._infoWindow},openInfoWindow(r){const e=this._infoWindow;return e?(e.getMap()||this.getMap()&&e.addTo(this),requestAnimationFrame(()=>{e.open(r)}),this):this},closeInfoWindow(){return this._infoWindow&&this._infoWindow.close(),this},removeInfoWindow(){return this._infoWindow&&(this._infoWindow.remove(),this._infoWindow=void 0),this}});var Gv=Object.defineProperty,Wv=(r,e,t)=>e in r?Gv(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Sa=(r,e,t)=>Wv(r,typeof e!="symbol"?e+"":e,t);class Zv{constructor(...e){}}class Ih extends Yi(xn(Zv)){constructor(e={}){super(e),Sa(this,"_map"),Sa(this,"_enabled",!1),Sa(this,"_boundHandlers",new Map)}addTo(e){if(!e)return this;const t=e;return t._activeMapTool&&t._activeMapTool!==this&&t._activeMapTool.disable(),t._activeMapTool=this,this._map=e,this.onAdd&&this.onAdd(),this.enable(),this.trigger("add",{map:e}),this}getMap(){return this._map}enable(){return!this._map||this._enabled?this:(this._enabled=!0,this._bindEvents(),this.onEnable&&this.onEnable(),this.trigger("enable",{map:this._map}),this)}disable(){return!this._map||!this._enabled?this:(this._enabled=!1,this._unbindEvents(),this.onDisable&&this.onDisable(),this.trigger("disable",{map:this._map}),this)}isEnabled(){return!!this._enabled}remove(){if(!this._map)return this;this.disable();const e=this._map;return e._activeMapTool===this&&delete e._activeMapTool,this._map=void 0,this.trigger("remove"),this}_bindEvents(){const e=this._map;if(!e)return;const t=this.getEvents()||{};Object.keys(t).forEach(i=>{const n=t[i];if(!n)return;const s=a=>n.call(this,a);this._boundHandlers.set(i,s),e.on(i,s)})}_unbindEvents(){const e=this._map;e&&(this._boundHandlers.forEach((t,i)=>{e.off(i,t)}),this._boundHandlers.clear())}}var Vv=Object.defineProperty,Iv=(r,e,t)=>e in r?Vv(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Fr=(r,e,t)=>Iv(r,typeof e!="symbol"?e+"":e,t);class Av extends ji{constructor(e){super(e,{altitude:1})}validateFeature(e){return!!e}}const Ah={};class Qn extends Ih{constructor(e){super(e),Fr(this,"_modeDef"),Fr(this,"_clickCoords",[]),Fr(this,"_isDrawing",!1),Fr(this,"_geometry"),Fr(this,"_draftLayer"),this.options.once=this.options.once??!1,this._ensureMode()}static registerMode(e,t){Ah[e.toLowerCase()]=t}static getModeDefinition(e){return Ah[e.toLowerCase()]}getMode(){return(this.options.mode||"").toLowerCase()}setMode(e){return this._finishDrawingSilently(),this.options.mode=e,this._ensureMode(),this}setStyle(e){return e.geometryStyle!==void 0&&(this.options.geometryStyle=e.geometryStyle),Object.prototype.hasOwnProperty.call(e,"vertexStyle")&&(this.options.vertexStyle=e.vertexStyle??null),this}getEvents(){return{click:this._handleClick.bind(this),mousemove:this._handleMouseMove.bind(this),dblclick:this._handleDblClick.bind(this)}}onEnable(){this._ensureMode()}onDisable(){this._finishDrawingSilently(),this._destroyDraftLayer()}_ensureMode(){const e=this.getMode(),t=Qn.getModeDefinition(e);if(!t)throw new Error(`DrawTool: mode "${e}" 未注册,请先调用 DrawTool.registerMode`);this._modeDef=t}_handleClick(e){if(!this._modeDef||!e.coordinate)return;const t=e.coordinate,i=this._modeDef,n={...e,drawTool:this};this._isDrawing?(this._clickCoords.push(t),i.update(this._clickCoords,this._geometry,n),this.trigger("drawvertex",{coordinate:t,geometry:this._geometry,coords:[...this._clickCoords],originEvent:n})):(this._isDrawing=!0,this._clickCoords=[t],this._geometry=i.create(t,n),this.trigger("drawstart",{coordinate:t,geometry:this._geometry,coords:[...this._clickCoords],originEvent:n})),i.clickLimit&&this._clickCoords.length>=i.clickLimit&&this._finishDrawing(n)}_handleMouseMove(e){if(!this._modeDef||!this._isDrawing||!e.coordinate)return;const t=this._modeDef,i=[...this._clickCoords,e.coordinate],n={...e,drawTool:this};t.update(i,this._geometry,n),this.trigger("drawing",{coordinate:e.coordinate,geometry:this._geometry,coords:i,originEvent:n})}_handleDblClick(e){if(!this._modeDef||!this._isDrawing)return;const t={...e,drawTool:this};this._finishDrawing(t)}_finishDrawing(e){if(!this._modeDef||!this._isDrawing)return;const i=this._modeDef.generate(this._geometry,[...this._clickCoords]);this.trigger("drawend",{geometry:i,coords:[...this._clickCoords],originEvent:e}),this._isDrawing=!1,this._clickCoords=[],this._geometry=void 0,this.options.once&&this.disable()}_finishDrawingSilently(){this._isDrawing=!1,this._clickCoords=[],this._geometry=void 0}_getOrCreateDraftLayer(){if(this._draftLayer)return this._draftLayer;const e=this.getMap();if(!e)throw new Error("DrawTool: 尚未绑定地图,请先调用 addTo(map)");const t=`__draw_draft_${Date.now().toString(36)}`,i=new Av(t);return e.addLayer(i),this._draftLayer=i,i}_destroyDraftLayer(){const e=this.getMap();e&&this._draftLayer&&e.removeLayer(this._draftLayer.getId()),this._draftLayer=void 0}}const Fv={actions:["click","mousemove"],create(r,e){const t=e.drawTool,i=t._getOrCreateDraftLayer(),n=en(t.options.geometryStyle,{type:"basic-point",size:10,color:"#00ffff"}),s={type:"Point",coordinates:r},a=new Ti({geometry:s,style:n});return a.addTo(i),a.initializeGeometry(),{tool:t,draftLayer:i,draftMarker:a}},update(r,e,t){const i=e?.draftMarker;if(!i)return;const n=r[r.length-1];i._geometry={type:"Point",coordinates:n},i._position=i._coordsTransform(),i._toThreeJSGeometry&&i._toThreeJSGeometry()},generate(r,e){const t=r.tool;if(!e.length)return null;r.draftMarker&&(r.draftMarker._remove(),r.draftMarker=null);const i=en(t.options.geometryStyle,{type:"basic-point",size:10,color:"#00ffff"}),n=e[e.length-1];return new Ti({geometry:{type:"Point",coordinates:n},style:i})},clickLimit:1},Ov={actions:["click","mousemove","dblclick"],create(r,e){const t=e.drawTool,i=t._getOrCreateDraftLayer(),n=en(t.options.geometryStyle,{type:"basic-line",color:"#ff0000",width:2}),s=t.options.vertexStyle===null?void 0:en(t.options.vertexStyle,{type:"basic-point",size:8,color:"#00ffff"}),a={type:"LineString",coordinates:[r]},c=new Lt({geometry:a,style:n});c.addTo(i);const h=[];if(s){const d={type:"Point",coordinates:r},m=new Ti({geometry:d,style:s});m.addTo(i),h.push(m)}return{tool:t,draftLayer:i,draftLine:c,draftAnchors:h,lineStyle:n,vertexStyle:s}},update(r,e,t){if(!e)return;const i=e.draftLayer;if(!r||r.length<2)return;e.draftLine&&(e.draftLine._remove(),e.draftLine=null);const n={type:"LineString",coordinates:r},s=new Lt({geometry:n,style:e.lineStyle});if(s.addTo(i),e.draftLine=s,t.eventName==="click"&&e.vertexStyle){const c={type:"Point",coordinates:r[r.length-1]},h=new Ti({geometry:c,style:e.vertexStyle});h.addTo(i),e.draftAnchors.push(h)}},generate(r,e){const t=r.tool;if(!e.length)return null;if(r.draftLine&&(r.draftLine._remove(),r.draftLine=null),Array.isArray(r.draftAnchors)){for(const s of r.draftAnchors)s?._remove();r.draftAnchors=[]}const i=en(t.options.geometryStyle,{type:"basic-line",color:"#ff0000",width:2});return new Lt({geometry:{type:"LineString",coordinates:e},style:i})}},zv={actions:["click","mousemove","dblclick"],create(r,e){const t=e.drawTool,i=t._getOrCreateDraftLayer(),n=en(t.options.geometryStyle,{type:"basic-polygon",color:"#00ff00",opacity:.5}),s=t.options.vertexStyle===null?void 0:en(t.options.vertexStyle,{type:"basic-point",size:8,color:"#00ffff"}),a=[];if(s){const c={type:"Point",coordinates:r},h=new Ti({geometry:c,style:s});h.addTo(i),h.initializeGeometry(),a.push(h)}return{tool:t,draftLayer:i,draftPolygon:null,draftEdgeLine:null,draftAnchors:a,polygonStyle:n,vertexStyle:s}},update(r,e,t){if(!e)return;const i=e.draftLayer;if(t.eventName==="click"&&e.vertexStyle){const m={type:"Point",coordinates:r[r.length-1]},f=new Ti({geometry:m,style:e.vertexStyle});f.addTo(i),f.initializeGeometry(),e.draftAnchors.push(f)}if(!r||r.length<2){e.draftEdgeLine&&(e.draftEdgeLine._remove(),e.draftEdgeLine=null),e.draftPolygon&&(e.draftPolygon._remove(),e.draftPolygon=null);return}if(r.length===2){e.draftPolygon&&(e.draftPolygon._remove(),e.draftPolygon=null),e.draftEdgeLine&&(e.draftEdgeLine._remove(),e.draftEdgeLine=null);const d={type:"LineString",coordinates:r},m=e.polygonStyle?.config&&e.polygonStyle.config.color||"#00ff00",f=new St({type:"basic-line",color:m,width:2}),g=new Lt({geometry:d,style:f});g.addTo(i),e.draftEdgeLine=g;return}e.draftEdgeLine&&(e.draftEdgeLine._remove(),e.draftEdgeLine=null);const n=r.slice(),s=n[0],a=n[n.length-1];(s[0]!==a[0]||s[1]!==a[1]||(s[2]||0)!==(a[2]||0))&&n.push(s),e.draftPolygon&&(e.draftPolygon._remove(),e.draftPolygon=null);const c={type:"Polygon",coordinates:[n]},h=new wi({geometry:c,style:e.polygonStyle});h.addTo(i),e.draftPolygon=h},generate(r,e){const t=r.tool;if(e.length<3)return null;if(r.draftPolygon&&(r.draftPolygon._remove(),r.draftPolygon=null),r.draftEdgeLine&&(r.draftEdgeLine._remove(),r.draftEdgeLine=null),Array.isArray(r.draftAnchors)){for(const h of r.draftAnchors)h?._remove();r.draftAnchors=[]}const i=en(t.options.geometryStyle,{type:"basic-polygon",color:"#00ff00",opacity:.5}),n=e.slice(),s=n[0],a=n[n.length-1];return(s[0]!==a[0]||s[1]!==a[1]||(s[2]||0)!==(a[2]||0))&&n.push(s),new wi({geometry:{type:"Polygon",coordinates:[n]},style:i})}};Qn.registerMode("point",Fv),Qn.registerMode("line",Ov),Qn.registerMode("polygon",zv);function en(r,e){return St.create(r||e)}var Dv=Object.defineProperty,Xv=(r,e,t)=>e in r?Dv(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,oi=(r,e,t)=>Xv(r,typeof e!="symbol"?e+"":e,t);class kv extends si{constructor(e){if(super(e),oi(this,"dataType","image"),oi(this,"attribution","天地图"),oi(this,"token",""),oi(this,"style","img_w"),oi(this,"subdomains","01234"),oi(this,"url","https://t{s}.tianditu.gov.cn/DataServer?T={style}&x={x}&y={y}&l={z}&tk={token}"),Object.assign(this,e),!this.token)throw new Error("天地图访问令牌(token)是必填参数")}}class Uv extends si{constructor(e){if(super(e),oi(this,"dataType","quantized-mesh"),oi(this,"attribution","天地图"),oi(this,"token",""),oi(this,"subdomains","01234"),oi(this,"url","https://t{s}.tianditu.gov.cn/mapservice/swdx?T=elv_c&tk={token}&x={x}&y={y}&l={z}"),Object.assign(this,e),!this.token)throw new Error("天地图访问令牌(token)是必填参数")}}var Nv=Object.defineProperty,Kv=(r,e,t)=>e in r?Nv(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Fh=(r,e,t)=>Kv(r,typeof e!="symbol"?e+"":e,t);class Bv extends si{constructor(e){super({...e,url:e.urlTemplate,isTMS:e.isTMS||!1}),Fh(this,"minLevel",2),Fh(this,"maxLevel",24)}getUrl(e,t,i){const n=this.isTMS?Math.pow(2,i)-1-t:t;return mm(this.url,{...this,x:e,y:n,z:i,tileMatrix:i,tileRow:n,tileCol:e})}}var Yv=Object.defineProperty,Rv=(r,e,t)=>e in r?Yv(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Gi=(r,e,t)=>Rv(r,typeof e!="symbol"?e+"":e,t);class jv extends si{constructor(e){super(e),Gi(this,"dataType","image"),Gi(this,"attribution","ArcGIS"),Gi(this,"style","World_Imagery"),Gi(this,"url","https://services.arcgisonline.com/arcgis/rest/services/{style}/MapServer/tile/{z}/{y}/{x}"),Object.assign(this,e)}}class Jv extends si{constructor(e){super(e),Gi(this,"dataType","lerc"),Gi(this,"attribution","ArcGIS"),Gi(this,"minLevel",6),Gi(this,"maxLevel",13),Gi(this,"url","https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer/tile/{z}/{y}/{x}"),Object.assign(this,e)}}var Qv=Object.defineProperty,Hv=(r,e,t)=>e in r?Qv(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Hn=(r,e,t)=>Hv(r,typeof e!="symbol"?e+"":e,t);class $v extends si{constructor(e){if(super(e),Hn(this,"token",""),Hn(this,"format","webp"),Hn(this,"style","cm2myr6qx001t01pi0sf7estf"),Hn(this,"attribution","MapBox"),Hn(this,"maxLevel",25),Hn(this,"url","https://api.mapbox.com/styles/v1/criska/cm2myr6qx001t01pi0sf7estf/tiles/256/{z}/{x}/{y}?access_token={token}&format={format}"),Object.assign(this,e),!this.token)throw new Error("MapBox访问令牌(token)是必填参数")}}var Ev=Object.defineProperty,qv=(r,e,t)=>e in r?Ev(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Oh=(r,e,t)=>qv(r,typeof e!="symbol"?e+"":e,t);class ew extends si{constructor(e){super(e),Oh(this,"dataType","mvt"),Oh(this,"style",{layer:[]}),Object.assign(this,e)}}var tw=Object.defineProperty,iw=(r,e,t)=>e in r?tw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Or=(r,e,t)=>iw(r,typeof e!="symbol"?e+"":e,t);class nw extends si{constructor(e){super(e),Or(this,"dataType","VectorTile"),Or(this,"attribution","ArcGIS"),Or(this,"minLevel",1),Or(this,"maxLevel",21),Or(this,"url","https://api.maptiler.com/tiles/v3/{z}/{x}/{y}.pbf?key=uKYsZQZpm72WlbSgH9B7"),Object.assign(this,e)}}class rw extends ji{constructor(e,t){super(e,t)}validateFeature(e){return e._baseType==="Line"}}class sw extends ji{constructor(e,t){super(e,t)}validateFeature(e){return e._baseType==="Point"}}class ow extends ji{constructor(e,t){super(e,t)}validateFeature(e){return e._baseType==="Surface"}}var aw=Object.defineProperty,lw=(r,e,t)=>e in r?aw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,cw=(r,e,t)=>lw(r,e+"",t);class hw extends ji{constructor(e,t){super(e,t),cw(this,"_clouds",null);const i=["texture"];for(const n of i)wc(t,n);this._createClouds(t.texture)}async _createClouds(e){const t=await St._loadTexture(e),i=new dg({texture:t,material:p.MeshBasicMaterial});i.castShadow=!0,this._clouds=i}validateFeature(e){return e._type==="Cloud"}animate(e,t){this._clouds&&this._clouds.update(this.map.viewer.camera,t,e)}}var uw=Object.defineProperty,dw=(r,e,t)=>e in r?uw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,zh=(r,e,t)=>dw(r,typeof e!="symbol"?e+"":e,t);class fw extends xa{constructor(e){super({single:!1,...e}),zh(this,"_markerCoord"),zh(this,"_content"),this._markerCoord=[...e.coordinate],this._content=e.content}_getClassName(){return"UIMarker"}buildOn(){const e=document.createElement("div"),{width:t,height:i}=this.options;typeof t=="number"&&(e.style.width=`${t}px`),typeof i=="number"&&(e.style.height=`${i}px`);const n=this.options.containerClass;n&&(Array.isArray(n)?n:[n]).forEach(c=>e.classList.add(c));const s=this._content;return typeof s=="function"?s(e):s instanceof HTMLElement?e.appendChild(s):typeof s=="string"&&(e.innerHTML=s),e}getOffset(){const e=super.getOffset(),t=this._dom;if(!t)return e;const i=t.offsetWidth,n=t.offsetHeight;return{x:e.x-i/2,y:e.y-n/2}}show(e){return e&&(this._markerCoord=[...e]),super.show(this._markerCoord)}setCoordinates(e){return this._markerCoord=[...e],this.isVisible()&&super.show(this._markerCoord),this}getCoordinates(){return[...this._markerCoord]}getCenter(){return this.getCoordinates()}getAltitude(){const e=this._markerCoord;return typeof e[2]=="number"?e[2]:typeof this.options.altitude=="number"?this.options.altitude:0}setAltitude(e){const t=[...this._markerCoord];return t[2]=e,this._markerCoord=t,this.isVisible()&&super.show(this._markerCoord),this}setContent(e){this._content=e,this.options.content=e;const t=this._dom;return t?(t.innerHTML="",typeof e=="function"?e(t):e instanceof HTMLElement?t.appendChild(e):typeof e=="string"&&(t.innerHTML=e),this):this}getContent(){return this._content}addTo(e){return super.addTo(e),this.options.visible!==!1&&this.show(this.options.coordinate),this}}var pw=Object.defineProperty,mw=(r,e,t)=>e in r?pw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,He=(r,e,t)=>mw(r,typeof e!="symbol"?e+"":e,t);function gw(r){const e=new Date(r),t=e.getHours().toString().padStart(2,"0"),i=e.getMinutes().toString().padStart(2,"0"),n=e.getSeconds().toString().padStart(2,"0");return`${t}:${i}:${n}`}class yw extends Pr{constructor(e,t,i){super(e,i),He(this,"_trailLine",null),He(this,"_activeLine",null),He(this,"_marker",null),He(this,"_controlPointGroup",new p.Group),He(this,"_timeLabels",[]),He(this,"_points",[]),He(this,"_worldPoints",[]),He(this,"_timestamps",[]),He(this,"_totalDuration",0),He(this,"_state","idle"),He(this,"_currentTime",0),He(this,"_playbackSpeed",1),He(this,"_loop",!1),He(this,"_cameraMode","none"),He(this,"_cameraConfig",{mode:"none"}),He(this,"_prevControlsEnabled",!0),He(this,"_options"),He(this,"_gifStates",[]),this._options=i||{},this._playbackSpeed=i?.speed??1,this._loop=i?.loop??!1,i?.cameraFollow&&(this._cameraConfig={...i.cameraFollow},this._cameraMode=i.cameraFollow.mode),this.add(this._controlPointGroup),t&&t.points.length>0&&this._setDataInternal(t)}_bindMap(e){super._bindMap(e),this._points.length>0&&e&&this._buildAll().catch(t=>console.error("TrajectoryLayer build error:",t))}setData(e){this._disposeAll(),this._setDataInternal(e),this.map&&this._buildAll().catch(t=>console.error("TrajectoryLayer build error:",t))}_setDataInternal(e){this._points=[...e.points].sort((t,i)=>t.timestamp-i.timestamp),this._timestamps=this._points.map(t=>t.timestamp),e.duration!==void 0?this._totalDuration=e.duration:this._points.length>=2?this._totalDuration=this._timestamps[this._timestamps.length-1]-this._timestamps[0]:this._totalDuration=0,this._currentTime=0,this._state="idle"}play(){if(!(this._points.length<2)&&(this._state==="idle"&&this._currentTime>=this._totalDuration&&(this._currentTime=0),this._state="playing",this._cameraMode!=="none")){const e=this.getMap()?.viewer;e&&(e.controls.enabled=!1)}}pause(){if(this._state==="playing"&&(this._state="paused",this._cameraMode!=="none")){const e=this.getMap()?.viewer;e&&(e.controls.enabled=this._prevControlsEnabled)}}stop(){if(this._state="idle",this._currentTime=0,this._marker&&(this._marker.visible=!1),this._activeLine&&(this._activeLine.visible=!1),this._cameraMode!=="none"){const t=this.getMap()?.viewer;t&&(t.controls.enabled=this._prevControlsEnabled),this._cameraMode="none",this._cameraConfig={mode:"none"}}}seekTo(e){this._currentTime=Math.max(0,Math.min(e,this._totalDuration)),this._updateVisuals()}setSpeed(e){this._playbackSpeed=Math.max(.1,e)}setLoop(e){this._loop=e}setShowControlPoints(e){this._controlPointGroup.visible=e}setShowTimeLabels(e){for(const t of this._timeLabels)if(e){const i=this.getMap();i&&t.addTo(i)}else t.hide()}setCameraMode(e,t){const i=this._cameraMode;this._cameraMode=e;const n={"first-person":{distance:15,polarAngle:80,smoothing:.08},"third-person":{distance:500,polarAngle:5,smoothing:.08},none:{}};this._cameraConfig={...n[e],mode:e,...t};const a=this.getMap()?.viewer;a&&(i!=="none"&&e==="none"?a.controls.enabled=this._prevControlsEnabled:i==="none"&&e!=="none"&&(this._prevControlsEnabled=a.controls.enabled,a.controls.enabled=!1))}getCurrentTime(){return this._currentTime}getDuration(){return this._totalDuration}getPlaybackState(){return this._state}getSpeed(){return this._playbackSpeed}animate(e,t,i){this._updateGifTextures(),this._state==="playing"&&(this._points.length<2||(this._currentTime+=e*1e3*this._playbackSpeed,this._currentTime>=this._totalDuration&&(this._loop?this._currentTime=this._currentTime%this._totalDuration:(this._currentTime=this._totalDuration,this._state="idle",this._emitEvent("playback-end"))),this._updateVisuals(),this._updateCamera(i)))}async _buildAll(){const e=this.getMap();if(e){this._worldPoints=this._transformCoordinates(e),console.log("TrajectoryLayer: worldPoints count =",this._worldPoints.length),this._buildTrailLine(),this._buildActiveLine();try{await this._buildMarker()}catch(t){console.error("TrajectoryLayer: _buildMarker failed:",t)}try{await this._buildControlPoints()}catch(t){console.error("TrajectoryLayer: _buildControlPoints failed:",t)}this._buildTimeLabels(),this._updateTrailLine()}}_transformCoordinates(e){const t=e.prjcenter;return this._points.map(i=>{const n=new p.Vector3(i.coordinate[0],i.coordinate[1],i.coordinate[2]||0);return e.geo2world(n).sub(t)})}_buildTrailLine(){if(this._worldPoints.length<2)return;const e=this._options.trailStyle||{},t=new Ni;t.setPositions([0,0,0,0,0,0]);const i=new vn({color:new p.Color(e.color??"#4a90d9").getHex(),linewidth:e.width??2,transparent:!0,opacity:e.opacity??.5,resolution:new p.Vector2(window.innerWidth,window.innerHeight),depthTest:!0,depthWrite:!0}),n=()=>i.resolution.set(window.innerWidth,window.innerHeight);window.addEventListener("resize",n),i.__resizeHandler=n,this._trailLine=new bn(t,i),this._trailLine.computeLineDistances(),this._trailLine.position.copy(this.map.prjcenter),this.add(this._trailLine)}_buildActiveLine(){const e=this._options.activeTrailStyle||{},t=new Ni;t.setPositions([0,0,0,0,0,0]);const i=new vn({color:new p.Color(e.color??"#ff4444").getHex(),linewidth:e.width??3,transparent:!0,opacity:e.opacity??1,resolution:new p.Vector2(window.innerWidth,window.innerHeight),depthTest:!0,depthWrite:!0}),n=()=>i.resolution.set(window.innerWidth,window.innerHeight);window.addEventListener("resize",n),i.__resizeHandler=n,this._activeLine=new bn(t,i),this._activeLine.computeLineDistances(),this._activeLine.position.copy(this.map.prjcenter),this._activeLine.visible=!1,this.add(this._activeLine)}async _buildMarker(){const e=this._options.markerStyle||{},t=this.map.prjcenter;if(e.type==="icon"&&e.url){const i=await new Promise((h,d)=>{new p.TextureLoader().load(e.url,m=>h(m),void 0,m=>d(m))});i.colorSpace=p.SRGBColorSpace,i.needsUpdate=!0;const n=e.size??32,s=new p.SpriteMaterial({map:i,transparent:!0,depthWrite:!1,sizeAttenuation:!1}),a=new p.Sprite(s);a.scale.set(n,n,1);const c=e.anchor??[.5,.5];a.center.set(c[0],c[1]),this._marker=a,console.log("TrajectoryLayer: marker sprite created manually",{texWidth:i.image?.width,texHeight:i.image?.height,spriteScale:`(${a.scale.x}, ${a.scale.y}, ${a.scale.z})`})}else this._marker=Sn({color:e.color??"#ff0000",size:e.size??16,sizeAttenuation:!1},new p.Vector3(0,0,0));this._worldPoints.length>0&&this._marker.position.copy(this._worldPoints[0]),this._marker.position.add(t),this._marker.visible=!1,this.add(this._marker)}async _buildControlPoints(){if(!this._options.showControlPoints)return;const e=this._options.controlPointStyle||{},t=e.type??"point",i=this.map.prjcenter;for(;this._controlPointGroup.children.length>0;){const n=this._controlPointGroup.children[0];this._controlPointGroup.remove(n),n.traverse(s=>{"geometry"in s&&s.geometry&&s.geometry.dispose(),"material"in s&&s.material&&(Array.isArray(s.material)?s.material:[s.material]).forEach(c=>c.dispose())})}this._controlPointGroup.position.copy(i);for(let n=0;n<this._worldPoints.length;n++){const s=this._worldPoints[n].clone();let a;if(t==="icon"&&e.url)try{const c=await Dc({type:"icon-point",url:e.url,size:e.size??24,color:"#ffffff",sizeAttenuation:!0},s);if(c.material.map){const d=e.anchor??[.5,.5];c.center.set(d[0],d[1]),a=c}else console.warn("TrajectoryLayer: icon texture failed, fallback to basic point:",e.url),a=Sn({type:"basic-point",color:e.color??"#00ff00",size:e.size??12,sizeAttenuation:!1},s)}catch(c){console.warn("TrajectoryLayer: _createIconPoint error, fallback to basic point:",c),a=Sn({color:e.color??"#00ff00",size:e.size??12,sizeAttenuation:!1},s)}else t==="gif"&&e.url?a=await this._createGifControlPoint(e.url,s,e.size??32):a=Sn({color:e.color??"#00ff00",size:e.size??12,sizeAttenuation:!1},s);this._controlPointGroup.add(a)}}async _createGifControlPoint(e,t,i){return new Promise(n=>{const s=new Image;s.crossOrigin="anonymous",s.onload=()=>{const a=document.createElement("canvas");a.width=s.naturalWidth||s.width,a.height=s.naturalHeight||s.height;const c=a.getContext("2d");c.drawImage(s,0,0);const h=new p.CanvasTexture(a);h.colorSpace=p.SRGBColorSpace,h.needsUpdate=!0;const d=new p.SpriteMaterial({map:h,transparent:!0,sizeAttenuation:!0}),m=new p.Sprite(d),f=.002;m.scale.set(i*f,i*f,1),m.position.copy(t),this._gifStates.push({canvas:a,ctx:c,img:s,texture:h,lastFrameTime:performance.now(),frameIndex:0,loaded:!0}),n(m)},s.onerror=()=>{const a=Sn({color:"#ff0000",size:12,sizeAttenuation:!0},t);n(a)},s.src=e})}_updateGifTextures(){if(this._gifStates.length===0)return;const e=performance.now();for(const t of this._gifStates)t.loaded&&e-t.lastFrameTime>33&&(t.ctx.clearRect(0,0,t.canvas.width,t.canvas.height),t.ctx.drawImage(t.img,0,0),t.texture.needsUpdate=!0,t.lastFrameTime=e)}_buildTimeLabels(){if(!this._options.showTimeLabels)return;const e=this.getMap();if(!e)return;const t=this._options.timeFormat??gw,i=this._options.timeLabelContent;this._disposeTimeLabels();for(let n=0;n<this._points.length;n++){const s=this._points[n],a=i?i(s.timestamp):`<div style="
1191
+ background: rgba(0,0,0,0.7);
1192
+ color: #fff;
1193
+ padding: 2px 6px;
1194
+ border-radius: 3px;
1195
+ font-size: 11px;
1196
+ white-space: nowrap;
1197
+ pointer-events: none;
1198
+ ">${t(s.timestamp)}</div>`,c=new fw({coordinate:[s.coordinate[0],s.coordinate[1],s.coordinate[2]??0],content:a});c.addTo(e),this._timeLabels.push(c)}}_updateVisuals(){this._updateMarkerPosition(),this._updateActiveLine(),this._updateTrailLine()}_updateMarkerPosition(){if(!this._marker||this._worldPoints.length<2)return;const e=this._interpolatePosition(this._currentTime),t=this.map.prjcenter;this._marker.position.set(e.x+t.x,e.y+t.y,e.z+t.z),this._marker.visible=!0}_updateActiveLine(){if(!this._activeLine||this._worldPoints.length<2)return;const e=this._timestamps[0]+this._currentTime,t=[];for(let c=0;c<this._timestamps.length&&!(this._timestamps[c]>e);c++){const h=this._worldPoints[c];t.push(h.x,h.y,h.z)}const i=this._interpolatePosition(this._currentTime),n=t.length>0?t[t.length-3]:NaN,s=t.length>0?t[t.length-2]:NaN,a=t.length>0?t[t.length-1]:NaN;if((i.x!==n||i.y!==s||i.z!==a)&&t.push(i.x,i.y,i.z),t.length>=6){const c=this._activeLine.geometry,h=new Ni;h.setPositions(t),this._activeLine.geometry=h,c.dispose(),this._activeLine.visible=!0}}_updateTrailLine(){if(!this._trailLine||this._worldPoints.length<2)return;const e=this._interpolatePosition(this._currentTime),t=this._timestamps[0]+this._currentTime,i=[e.x,e.y,e.z];for(let n=0;n<this._timestamps.length;n++){if(this._timestamps[n]<=t)continue;const s=this._worldPoints[n];i.push(s.x,s.y,s.z)}if(i.length>=6){this._trailLine.visible=!0;const n=this._trailLine.geometry,s=new Ni;s.setPositions(i),this._trailLine.geometry=s,n.dispose(),this._trailLine.visible=!0}}_interpolatePosition(e){const t=this._timestamps,i=t[0]+e;if(i<=t[0])return this._worldPoints[0].clone();if(i>=t[t.length-1])return this._worldPoints[t.length-1].clone();let n=0,s=t.length-1;for(;n<s-1;){const d=n+s>>1;t[d]<=i?n=d:s=d}const a=t[n],c=t[s],h=c>a?Math.min(1,Math.max(0,(i-a)/(c-a))):0;return this._worldPoints[n].clone().lerp(this._worldPoints[s],h)}_computeCurrentHeading(){const e=this._timestamps,t=this._currentTime,n=e[0]+t;let s=0;for(let m=0;m<e.length-1;m++){if(e[m]<=n&&e[m+1]>n){s=m;break}m===e.length-2&&(s=m)}const a=this._worldPoints[s],c=this._worldPoints[Math.min(s+1,this._worldPoints.length-1)],h=c.x-a.x,d=c.z-a.z;return Math.atan2(h,d)}_updateCamera(e){if(this._cameraMode==="none"||!this._marker)return;const t=this._marker.position.clone(),i=this._computeCurrentHeading(),n=this._cameraConfig,s=n.smoothing??.08;if(this._cameraMode==="first-person"){const a=i+Math.PI,c=(n.polarAngle??80)*Math.PI/180,h=n.distance??15,d=e.calculateCameraPosition(t,h,c,a);e.camera.position.lerp(d,s),e.controls.target.lerp(t,s)}else if(this._cameraMode==="third-person"){const a=i+Math.PI,c=(n.polarAngle??5)*Math.PI/180,h=n.distance??500,d=e.calculateCameraPosition(t,h,c,a);e.camera.position.lerp(d,s),e.controls.target.lerp(t,s)}e.controls.update()}_disposeAll(){this._disposeTrailLine(),this._disposeActiveLine(),this._disposeMarker(),this._disposeControlPoints(),this._disposeTimeLabels(),this._disposeGifStates(),this._worldPoints=[]}_disposeTrailLine(){if(this._trailLine){this.remove(this._trailLine),this._trailLine.geometry.dispose();const e=this._trailLine.material;this._removeResizeHandler(e),e.dispose(),this._trailLine=null}}_disposeActiveLine(){if(this._activeLine){this.remove(this._activeLine),this._activeLine.geometry.dispose();const e=this._activeLine.material;this._removeResizeHandler(e),e.dispose(),this._activeLine=null}}_disposeMarker(){this._marker&&(this.remove(this._marker),this._marker.traverse(e=>{"geometry"in e&&e.geometry&&e.geometry.dispose(),"material"in e&&e.material&&(Array.isArray(e.material)?e.material:[e.material]).forEach(i=>i.dispose())}),this._marker=null)}_disposeControlPoints(){for(;this._controlPointGroup.children.length>0;){const e=this._controlPointGroup.children[0];this._controlPointGroup.remove(e),e.traverse(t=>{"geometry"in t&&t.geometry&&t.geometry.dispose(),"material"in t&&t.material&&(Array.isArray(t.material)?t.material:[t.material]).forEach(n=>n.dispose())})}}_disposeTimeLabels(){for(const e of this._timeLabels)e.remove();this._timeLabels=[]}_disposeGifStates(){for(const e of this._gifStates)e.texture.dispose(),e.canvas.width=0,e.canvas.height=0;this._gifStates=[]}_removeResizeHandler(e){const t=e.__resizeHandler;t&&window.removeEventListener("resize",t)}_emitEvent(e){this.trigger(e,{target:this})}destroy(){if(this.stop(),this._cameraMode!=="none"){const t=this.getMap()?.viewer;t&&(t.controls.enabled=this._prevControlsEnabled)}this._disposeAll()}}var _w=Object.defineProperty,vw=(r,e,t)=>e in r?_w(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ww=(r,e,t)=>vw(r,e+"",t);class bw extends hh{constructor(e,t){super(e,t),ww(this,"layerType","raster")}createLoader(){const e=new Ls;return Array.isArray(this.source)?e.imgSource=this.source:e.imgSource=[this.source],e}}var xw=Object.defineProperty,Mw=(r,e,t)=>e in r?xw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Zs=(r,e,t)=>Mw(r,typeof e!="symbol"?e+"":e,t);class Sw extends bw{constructor(e,t){super(e,t),Zs(this,"layerType","wmts"),Zs(this,"_layerName"),Zs(this,"_style"),Zs(this,"_matrixSet"),this._layerName=t.layerName,this._style=t.style||"default",this._matrixSet=t.matrixSet||"GoogleMapsCompatible"}get layerName(){return this._layerName}get style(){return this._style}get matrixSet(){return this._matrixSet}createLoader(){const e=new Ls;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"+mf+" ","color:rgb(255, 255, 255); font-weight: bold; background: linear-gradient(90deg, #ffb6c1, #ff69b4); padding: 5px; border-radius: 5px;"),q.ArcGisDemSource=Jv,q.ArcGisSource=jv,q.CloudsLayer=hw,q.DrawTool=Qn,q.EventClass=Bo,q.Feature=dt,q.ICloud=oh,q.InfoWindow=Ma,q.Label=ah,q.LineLayer=rw,q.LineString=Lt,q.LoaderFactory=De,q.MVTGeoSource=nw,q.MVTSource=ew,q.Map=Pn,q.MapBoxSource=$v,q.MapTool=Ih,q.Marker=Ti,q.Martini=mh,q.Model=sh,q.MultiLineString=rh,q.PointLayer=sw,q.Polygon=wi,q.PolygonLayer=ow,q.ProjectFactory=Em,q.PromiseWorker=Wy,q.Style=St,q.TDTQMSource=Uv,q.TDTSource=kv,q.TPoints=ch,q.Tile=Ri,q.TileCanvasLoader=Ey,q.TileGeometry=jn,q.TileGeometryLoader=ua,q.TileLoader=Ls,q.TileLoadingManager=uh,q.TileMap=gs,q.TileMaterial=da,q.TileMaterialLoader=fa,q.TileSource=si,q.TrajectoryLayer=yw,q.UIComponent=xa,q.VectorFeatureTypes=rt,q.VectorTileLayer=wa,q.VectorTileRender=yh,q.Viewer=Cc,q.WMTSSource=Bv,q.WMTSTileLayer=Sw,q.WeatherEffect=Pc,q.addSkirt=fh,q.author=l_,q.concatenateTypedArrays=Ir,q.convertGeometryToWGS84=Iy,q.createBillboards=eg,q.getBoundsCoord=oa,q.getGeometryDataFromDem=ph,q.getGridIndices=ca,q.getLocalInfoFromRay=jo,q.getLocalInfoFromScreen=Vc,q.getLocalInfoFromWorld=Jo,q.getNormals=ha,q.getSafeTileUrlAndBounds=aa,q.registerDEMLoader=ga,q.registerImgLoader=ma,q.registerMeshLoader=wh,q.vector2ToWGS84=la,q.version=a_,q.waitFor=c_,Object.defineProperty(q,Symbol.toStringTag,{value:"Module"})});