@terra.gl/core 0.0.1-alpha.63 → 0.0.1-alpha.65

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(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 uf(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 ht=uf(p),df="0.0.1-alpha.63",wo={name:"Criska"};var ur=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(),o=n,a=0,c=t(new ur.Panel("FPS","#0ff","#002")),h=t(new ur.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var d=t(new ur.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>=o+1e3&&(c.update(a*1e3/(m-o),100),o=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}};ur.Panel=function(r,e,t){var i=1/0,n=0,o=Math.round,a=o(window.devicePixelRatio||1),c=80*a,h=48*a,d=3*a,m=2*a,f=3*a,g=15*a,v=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,v,w),x.fillStyle=t,x.globalAlpha=.9,x.fillRect(f,g,v,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(o(L)+" "+r+" ("+o(i)+"-"+o(n)+")",d,m),x.drawImage(b,f+a,g,v-a,w,f,g,v-a,w),x.fillRect(f+v-a,g,a,w),x.fillStyle=t,x.globalAlpha=.9,x.fillRect(f+v-a,g,a,o((1-L/M)*w))}}};const qr=parseInt(p.REVISION.replace(/\D+/g,"")),bo=qr>=125?"uv1":"uv2";function Fl(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 o=r.clone();return o.setIndex(n),o.clearGroups(),o}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),r}var kt=Uint8Array,Di=Uint16Array,xo=Uint32Array,Ol=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]),Dl=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]),ff=new kt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),zl=function(r,e){for(var t=new Di(31),i=0;i<31;++i)t[i]=e+=1<<r[i-1];for(var n=new xo(t[30]),i=1;i<30;++i)for(var o=t[i];o<t[i+1];++o)n[o]=o-t[i]<<5|i;return[t,n]},Xl=zl(Ol,2),Ul=Xl[0],pf=Xl[1];Ul[28]=258,pf[258]=28;for(var mf=zl(Dl,0),gf=mf[0],Mo=new Di(32768),Ze=0;Ze<32768;++Ze){var zi=(Ze&43690)>>>1|(Ze&21845)<<1;zi=(zi&52428)>>>2|(zi&13107)<<2,zi=(zi&61680)>>>4|(zi&3855)<<4,Mo[Ze]=((zi&65280)>>>8|(zi&255)<<8)>>>1}for(var dr=function(r,e,t){for(var i=r.length,n=0,o=new Di(e);n<i;++n)++o[r[n]-1];var a=new Di(e);for(n=0;n<e;++n)a[n]=a[n-1]+o[n-1]<<1;var c;if(t){c=new Di(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[Mo[f]>>>h]=d}else for(c=new Di(i),n=0;n<i;++n)r[n]&&(c[n]=Mo[a[r[n]-1]++]>>>15-r[n]);return c},fr=new kt(288),Ze=0;Ze<144;++Ze)fr[Ze]=8;for(var Ze=144;Ze<256;++Ze)fr[Ze]=9;for(var Ze=256;Ze<280;++Ze)fr[Ze]=7;for(var Ze=280;Ze<288;++Ze)fr[Ze]=8;for(var kl=new kt(32),Ze=0;Ze<32;++Ze)kl[Ze]=5;var yf=dr(fr,9,1),vf=dr(kl,5,1),So=function(r){for(var e=r[0],t=1;t<r.length;++t)r[t]>e&&(e=r[t]);return e},ei=function(r,e,t){var i=e/8|0;return(r[i]|r[i+1]<<8)>>(e&7)&t},Lo=function(r,e){var t=e/8|0;return(r[t]|r[t+1]<<8|r[t+2]<<16)>>(e&7)},_f=function(r){return(r/8|0)+(r&7&&1)},wf=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var i=new(r instanceof Di?Di:r instanceof xo?xo:kt)(t-e);return i.set(r.subarray(e,t)),i},bf=function(r,e,t){var i=r.length;if(!i||t&&!t.l&&i<5)return e||new kt(0);var n=!e||t,o=!t||t.i;t||(t={}),e||(e=new kt(i*3));var a=function(ft){var He=e.length;if(ft>He){var Re=new kt(Math.max(He*2,ft));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,v=t.n,w=i*8;do{if(!m){t.f=c=ei(r,h,1);var b=ei(r,h+1,3);if(h+=3,b)if(b==1)m=yf,f=vf,g=9,v=5;else if(b==2){var C=ei(r,h,31)+257,W=ei(r,h+10,15)+4,z=C+ei(r,h+5,31)+1;h+=14;for(var D=new kt(z),X=new kt(19),I=0;I<W;++I)X[ff[I]]=ei(r,h+I*3,7);h+=W*3;for(var K=So(X),V=(1<<K)-1,G=dr(X,K,1),I=0;I<z;){var k=G[ei(r,h,V)];h+=k&15;var x=k>>>4;if(x<16)D[I++]=x;else{var j=0,Y=0;for(x==16?(Y=3+ei(r,h,3),h+=2,j=D[I-1]):x==17?(Y=3+ei(r,h,7),h+=3):x==18&&(Y=11+ei(r,h,127),h+=7);Y--;)D[I++]=j}}var H=D.subarray(0,C),Q=D.subarray(C);g=So(H),v=So(Q),m=dr(H,g,1),f=dr(Q,v,1)}else throw"invalid block type";else{var x=_f(h)+4,L=r[x-4]|r[x-3]<<8,M=x+L;if(M>i){if(o)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(o)throw"unexpected EOF";break}}n&&a(d+131072);for(var re=(1<<g)-1,ne=(1<<v)-1,le=h;;le=h){var j=m[Lo(r,h)&re],de=j>>>4;if(h+=j&15,h>w){if(o)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=Ol[I];ge=ei(r,h,(1<<fe)-1)+Ul[I],h+=fe}var Se=f[Lo(r,h)&ne],rt=Se>>>4;if(!Se)throw"invalid distance";h+=Se&15;var Q=gf[rt];if(rt>3){var fe=Dl[rt];Q+=Lo(r,h)&(1<<fe)-1,h+=fe}if(h>w){if(o)throw"unexpected EOF";break}n&&a(d+131072);for(var st=d+ge;d<st;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=st}}t.l=m,t.p=le,t.b=d,m&&(c=1,t.m=g,t.d=f,t.n=v)}while(!c);return d==e.length?e:wf(e,0,d)},xf=new kt(0),Mf=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 Sf(r,e){return bf((Mf(r),r.subarray(2,-4)),e)}var Lf=typeof TextDecoder<"u"&&new TextDecoder,Pf=0;try{Lf.decode(xf,{stream:!0}),Pf=1}catch{}class Cf extends p.Mesh{constructor(e,t={}){super(e),this.isWater=!0;const i=this,n=t.textureWidth!==void 0?t.textureWidth:512,o=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),v=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,z=new p.Matrix4,D=new p.Vector3(0,0,-1),X=new p.Vector4,I=new p.Vector3,K=new p.Vector3,V=new p.Vector4,G=new p.Matrix4,k=new p.PerspectiveCamera,j=new p.WebGLRenderTarget(n,o),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:`
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 uf(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 ht=uf(p),df="0.0.1-alpha.65",wo={name:"Criska"};var ur=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(),o=n,a=0,c=t(new ur.Panel("FPS","#0ff","#002")),h=t(new ur.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var d=t(new ur.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>=o+1e3&&(c.update(a*1e3/(m-o),100),o=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}};ur.Panel=function(r,e,t){var i=1/0,n=0,o=Math.round,a=o(window.devicePixelRatio||1),c=80*a,h=48*a,d=3*a,m=2*a,f=3*a,g=15*a,v=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,v,w),x.fillStyle=t,x.globalAlpha=.9,x.fillRect(f,g,v,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(o(L)+" "+r+" ("+o(i)+"-"+o(n)+")",d,m),x.drawImage(b,f+a,g,v-a,w,f,g,v-a,w),x.fillRect(f+v-a,g,a,w),x.fillStyle=t,x.globalAlpha=.9,x.fillRect(f+v-a,g,a,o((1-L/M)*w))}}};const qr=parseInt(p.REVISION.replace(/\D+/g,"")),bo=qr>=125?"uv1":"uv2";function Fl(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 o=r.clone();return o.setIndex(n),o.clearGroups(),o}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),r}var kt=Uint8Array,Di=Uint16Array,xo=Uint32Array,Ol=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]),Dl=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]),ff=new kt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),zl=function(r,e){for(var t=new Di(31),i=0;i<31;++i)t[i]=e+=1<<r[i-1];for(var n=new xo(t[30]),i=1;i<30;++i)for(var o=t[i];o<t[i+1];++o)n[o]=o-t[i]<<5|i;return[t,n]},Xl=zl(Ol,2),Ul=Xl[0],pf=Xl[1];Ul[28]=258,pf[258]=28;for(var mf=zl(Dl,0),gf=mf[0],Mo=new Di(32768),Ze=0;Ze<32768;++Ze){var zi=(Ze&43690)>>>1|(Ze&21845)<<1;zi=(zi&52428)>>>2|(zi&13107)<<2,zi=(zi&61680)>>>4|(zi&3855)<<4,Mo[Ze]=((zi&65280)>>>8|(zi&255)<<8)>>>1}for(var dr=function(r,e,t){for(var i=r.length,n=0,o=new Di(e);n<i;++n)++o[r[n]-1];var a=new Di(e);for(n=0;n<e;++n)a[n]=a[n-1]+o[n-1]<<1;var c;if(t){c=new Di(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[Mo[f]>>>h]=d}else for(c=new Di(i),n=0;n<i;++n)r[n]&&(c[n]=Mo[a[r[n]-1]++]>>>15-r[n]);return c},fr=new kt(288),Ze=0;Ze<144;++Ze)fr[Ze]=8;for(var Ze=144;Ze<256;++Ze)fr[Ze]=9;for(var Ze=256;Ze<280;++Ze)fr[Ze]=7;for(var Ze=280;Ze<288;++Ze)fr[Ze]=8;for(var kl=new kt(32),Ze=0;Ze<32;++Ze)kl[Ze]=5;var yf=dr(fr,9,1),vf=dr(kl,5,1),So=function(r){for(var e=r[0],t=1;t<r.length;++t)r[t]>e&&(e=r[t]);return e},ei=function(r,e,t){var i=e/8|0;return(r[i]|r[i+1]<<8)>>(e&7)&t},Lo=function(r,e){var t=e/8|0;return(r[t]|r[t+1]<<8|r[t+2]<<16)>>(e&7)},_f=function(r){return(r/8|0)+(r&7&&1)},wf=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var i=new(r instanceof Di?Di:r instanceof xo?xo:kt)(t-e);return i.set(r.subarray(e,t)),i},bf=function(r,e,t){var i=r.length;if(!i||t&&!t.l&&i<5)return e||new kt(0);var n=!e||t,o=!t||t.i;t||(t={}),e||(e=new kt(i*3));var a=function(ft){var He=e.length;if(ft>He){var Re=new kt(Math.max(He*2,ft));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,v=t.n,w=i*8;do{if(!m){t.f=c=ei(r,h,1);var b=ei(r,h+1,3);if(h+=3,b)if(b==1)m=yf,f=vf,g=9,v=5;else if(b==2){var C=ei(r,h,31)+257,W=ei(r,h+10,15)+4,z=C+ei(r,h+5,31)+1;h+=14;for(var D=new kt(z),X=new kt(19),I=0;I<W;++I)X[ff[I]]=ei(r,h+I*3,7);h+=W*3;for(var K=So(X),V=(1<<K)-1,G=dr(X,K,1),I=0;I<z;){var k=G[ei(r,h,V)];h+=k&15;var x=k>>>4;if(x<16)D[I++]=x;else{var j=0,Y=0;for(x==16?(Y=3+ei(r,h,3),h+=2,j=D[I-1]):x==17?(Y=3+ei(r,h,7),h+=3):x==18&&(Y=11+ei(r,h,127),h+=7);Y--;)D[I++]=j}}var H=D.subarray(0,C),Q=D.subarray(C);g=So(H),v=So(Q),m=dr(H,g,1),f=dr(Q,v,1)}else throw"invalid block type";else{var x=_f(h)+4,L=r[x-4]|r[x-3]<<8,M=x+L;if(M>i){if(o)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(o)throw"unexpected EOF";break}}n&&a(d+131072);for(var re=(1<<g)-1,ne=(1<<v)-1,le=h;;le=h){var j=m[Lo(r,h)&re],de=j>>>4;if(h+=j&15,h>w){if(o)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=Ol[I];ge=ei(r,h,(1<<fe)-1)+Ul[I],h+=fe}var Se=f[Lo(r,h)&ne],rt=Se>>>4;if(!Se)throw"invalid distance";h+=Se&15;var Q=gf[rt];if(rt>3){var fe=Dl[rt];Q+=Lo(r,h)&(1<<fe)-1,h+=fe}if(h>w){if(o)throw"unexpected EOF";break}n&&a(d+131072);for(var st=d+ge;d<st;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=st}}t.l=m,t.p=le,t.b=d,m&&(c=1,t.m=g,t.d=f,t.n=v)}while(!c);return d==e.length?e:wf(e,0,d)},xf=new kt(0),Mf=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 Sf(r,e){return bf((Mf(r),r.subarray(2,-4)),e)}var Lf=typeof TextDecoder<"u"&&new TextDecoder,Pf=0;try{Lf.decode(xf,{stream:!0}),Pf=1}catch{}class Cf extends p.Mesh{constructor(e,t={}){super(e),this.isWater=!0;const i=this,n=t.textureWidth!==void 0?t.textureWidth:512,o=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),v=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,z=new p.Matrix4,D=new p.Vector3(0,0,-1),X=new p.Vector4,I=new p.Vector3,K=new p.Vector3,V=new p.Vector4,G=new p.Matrix4,k=new p.PerspectiveCamera,j=new p.WebGLRenderTarget(n,o),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
 
@@ -617,7 +617,7 @@
617
617
  #include <premultiplied_alpha_fragment>
618
618
 
619
619
  }
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 Oo=new p.Vector4,dc=new p.Vector3,fc=new p.Vector3,$e=new p.Vector4,qe=new p.Vector4,di=new p.Vector4,Do=new p.Vector3,zo=new p.Matrix4,et=new p.Line3,pc=new p.Vector3,ss=new p.Box3,os=new p.Sphere,fi=new p.Vector4;let pi,gn;function mc(r,e,t){return fi.set(0,0,-e,1).applyMatrix4(r.projectionMatrix),fi.multiplyScalar(1/fi.w),fi.x=gn/t.width,fi.y=gn/t.height,fi.applyMatrix4(r.projectionMatrixInverse),fi.multiplyScalar(1/fi.w),Math.abs(Math.max(fi.x,fi.y))}function rm(r,e){const t=r.matrixWorld,i=r.geometry,n=i.attributes.instanceStart,o=i.attributes.instanceEnd,a=Math.min(i.instanceCount,n.count);for(let c=0,h=a;c<h;c++){et.start.fromBufferAttribute(n,c),et.end.fromBufferAttribute(o,c),et.applyMatrix4(t);const d=new p.Vector3,m=new p.Vector3;pi.distanceSqToSegment(et.start,et.end,m,d),m.distanceTo(d)<gn*.5&&e.push({point:m,pointOnLine:d,distance:pi.origin.distanceTo(m),object:r,face:null,faceIndex:c,uv:null,[bo]:null})}}function sm(r,e,t){const i=e.projectionMatrix,o=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;pi.at(1,di),di.w=1,di.applyMatrix4(e.matrixWorldInverse),di.applyMatrix4(i),di.multiplyScalar(1/di.w),di.x*=o.x/2,di.y*=o.y/2,di.z=0,Do.copy(di),zo.multiplyMatrices(e.matrixWorldInverse,a);for(let g=0,v=m;g<v;g++){if($e.fromBufferAttribute(h,g),qe.fromBufferAttribute(d,g),$e.w=1,qe.w=1,$e.applyMatrix4(zo),qe.applyMatrix4(zo),$e.z>f&&qe.z>f)continue;if($e.z>f){const C=$e.z-qe.z,W=($e.z-f)/C;$e.lerp(qe,W)}else if(qe.z>f){const C=qe.z-$e.z,W=(qe.z-f)/C;qe.lerp($e,W)}$e.applyMatrix4(i),qe.applyMatrix4(i),$e.multiplyScalar(1/$e.w),qe.multiplyScalar(1/qe.w),$e.x*=o.x/2,$e.y*=o.y/2,qe.x*=o.x/2,qe.y*=o.y/2,et.start.copy($e),et.start.z=0,et.end.copy(qe),et.end.z=0;const b=et.closestPointToPointParameter(Do,!0);et.at(b,pc);const x=p.MathUtils.lerp($e.z,qe.z,b),L=x>=-1&&x<=1,M=Do.distanceTo(pc)<gn*.5;if(L&&M){et.start.fromBufferAttribute(h,g),et.end.fromBufferAttribute(d,g),et.start.applyMatrix4(a),et.end.applyMatrix4(a);const C=new p.Vector3,W=new p.Vector3;pi.distanceSqToSegment(et.start,et.end,W,C),t.push({point:W,pointOnLine:C,distance:pi.origin.distanceTo(W),object:r,face:null,faceIndex:g,uv:null,[bo]:null})}}}class om extends p.Mesh{constructor(e=new uc,t=new gr({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)dc.fromBufferAttribute(t,a),fc.fromBufferAttribute(i,a),n[c]=c===0?0:n[c-1],n[c+1]=n[c]+dc.distanceTo(fc);const o=new p.InstancedInterleavedBuffer(n,2,1);return e.setAttribute("instanceDistanceStart",new p.InterleavedBufferAttribute(o,1,0)),e.setAttribute("instanceDistanceEnd",new p.InterleavedBufferAttribute(o,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 o=e.params.Line2!==void 0&&e.params.Line2.threshold||0;pi=e.ray;const a=this.matrixWorld,c=this.geometry,h=this.material;gn=h.linewidth+o,c.boundingSphere===null&&c.computeBoundingSphere(),os.copy(c.boundingSphere).applyMatrix4(a);let d;if(i)d=gn*.5;else{const f=Math.max(n.near,os.distanceToPoint(pi.origin));d=mc(n,f,h.resolution)}if(os.radius+=d,pi.intersectsSphere(os)===!1)return;c.boundingBox===null&&c.computeBoundingBox(),ss.copy(c.boundingBox).applyMatrix4(a);let m;if(i)m=gn*.5;else{const f=Math.max(n.near,ss.distanceToPoint(pi.origin));m=mc(n,f,h.resolution)}ss.expandByScalar(m),pi.intersectsBox(ss)!==!1&&(i?rm(this,t):sm(this,n,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(Oo),this.material.uniforms.resolution.value.set(Oo.z,Oo.w))}}class yr extends om{constructor(e=new rs,t=new gr({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}var Ui=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-Ui.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?Ui.Bounce.In(r*2)*.5:Ui.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}}}}),vr=function(){return performance.now()},am=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=vr()),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 o=this._tweens[i[n]],a=!t;o&&o.update(e,a)===!1&&!t&&delete this._tweens[i[n]]}i=Object.keys(this._tweensAddedDuringUpdate)}return!0},r}(),Xo={Linear:function(r,e){var t=r.length-1,i=t*e,n=Math.floor(i),o=Xo.Utils.Linear;return e<0?o(r[0],r[1],i):e>1?o(r[t],r[t-1],t-i):o(r[n],r[n+1>t?t:n+1],i-n)},Utils:{Linear:function(r,e,t){return(e-r)*t+r}}},gc=function(){function r(){}return r.nextId=function(){return r._nextId++},r._nextId=0,r}(),Uo=new am,as=function(){function r(e,t){t===void 0&&(t=Uo),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=Ui.Linear.None,this._interpolationFunction=Xo.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=gc.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=vr()),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 o in this._valuesEnd)n[o]=this._valuesEnd[o];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,o){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],v=0,w=f.length;v<w;v+=1){var b=this._handleRelativeValue(c,f[v]);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],o)}else(typeof t[a]>"u"||o)&&(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=vr()),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=vr()),!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=Uo),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=Ui.Linear.None),this._easingFunction=e,this},r.prototype.interpolation=function(e){return e===void 0&&(e=Xo.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=vr()),t===void 0&&(t=!0),this._isPaused)return!0;var o,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 v=Math.min(Math.trunc((c-this._duration)/h)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=v);for(o in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[o]=="string"&&(this._valuesStartRepeat[o]=this._valuesStartRepeat[o]+parseFloat(this._valuesEnd[o])),this._yoyo&&this._swapEndStartRepeatValues(o),this._valuesStart[o]=this._valuesStartRepeat[o];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=h*v,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 o in i)if(t[o]!==void 0){var a=t[o]||0,c=i[o],h=Array.isArray(e[o]),d=Array.isArray(c),m=!h&&d;m?e[o]=this._interpolationFunction(c,n):typeof c=="object"&&c?this._updateProperties(e[o],a,c,n):(c=this._handleRelativeValue(a,c),typeof c=="number"&&(e[o]=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}();gc.nextId;var mi=Uo;mi.getAll.bind(mi),mi.removeAll.bind(mi),mi.add.bind(mi),mi.remove.bind(mi);var lm=mi.update.bind(mi);function ko(r,e,t){if(r==null||r==="")throw new Error(t||`Parameter "${e}" is required but received: ${r}`);return r}function yc(r,e,t){const i=e.split(".");let n=r;for(const o of i){if(n[o]===void 0||n[o]===null)throw new Error(`Property "${e}" is required but missing at path: "${o}"`);n=n[o]}return n}function cm(r,e,t,i=0,n=1){const o=(r-e)*(n-i)/(t-e)+i,a=Math.min(i,n),c=Math.max(i,n);return o<a?a:o>c?c:o||0}var hm=Object.defineProperty,um=(r,e,t)=>e in r?hm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,vc=(r,e,t)=>um(r,typeof e!="symbol"?e+"":e,t);class Ko{constructor(){vc(this,"_dispatcher",new p.EventDispatcher),vc(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 dm(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 No(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 ls(r){return r==null}function _r(r){return ls(r)?!1:typeof r=="function"||r.constructor!==null&&r.constructor===Function}function _c(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"),o=r.getMinutes().toString().padStart(2,"0"),a=r.getSeconds().toString().padStart(2,"0");return`${e}-${t}-${i} ${n}:${o}:${a}`}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,Bo=(r,e,t)=>pm(r,typeof e!="symbol"?e+"":e,t);class mm{}class cs extends Ki(yn(mm)){constructor(e){super(),Bo(this,"target"),Bo(this,"dom"),Bo(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 wc=Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"&&!process.versions.electron&&!process.versions.nw&&!process.versions["node-webkit"];let wr={};function bc(){return window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI}if(!wc){const r=navigator.userAgent.toLowerCase(),e=document.documentElement||{style:{}},t="ActiveXObject"in window,i=r.indexOf("webkit")!==-1,n=r.indexOf("phantom")!==-1,o=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,v="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!o,w="MozPerspective"in e.style,b="OTransition"in e.style,x=(g||v||w)&&!b&&!n,L=typeof window<"u"&&_r(window.createImageBitmap),M=typeof window<"u"&&_r(window.ResizeObserver),C=typeof window<"u"&&_r(window.btoa),W=typeof window<"u"&&_r(window.Proxy),z=typeof window<"u"&&_r(window.requestIdleCallback);let D=0;if(a){const k=r.match(/chrome\/([\d.]+)/);D=k?k[1]:0}const X=!n&&(f||"ontouchstart"in window||"DocumentTouch"in window&&document instanceof window.DocumentTouch),I=typeof window<"u"&&"WebGLRenderingContext"in window,K=bc();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{}wr={IS_NODE:wc,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:o,chrome:a,chromeVersion:D,safari:!a&&r.indexOf("safari")!==-1,phantomjs:n,ie3d:g,webkit3d:v,gecko3d:w,opera12:b,any3d:x,iosWeixin:h,mobile:d,mobileWebkit:d&&i,mobileWebkit3d:d&&v,mobileOpera:d&&"opera"in window,mobileGecko:d&&c,touch:!!X,msPointer:!!m,pointer:!!f,retina:K>1,devicePixelRatio:K,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:z,checkDevicePixelRatio:()=>{if(typeof window<"u"&&wr.monitorDPRChange){const k=bc(),j=k!==wr.devicePixelRatio;return j&&(wr.devicePixelRatio=k),j}return!1}}}const gm=wr;var ym=Object.defineProperty,vm=(r,e,t)=>e in r?ym(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ki=(r,e,t)=>vm(r,typeof e!="symbol"?e+"":e,t);function Ki(r){return class extends r{constructor(...e){super(...e),ki(this,"eventClass",new Ko),ki(this,"on",this.eventClass.on.bind(this.eventClass)),ki(this,"trigger",this.eventClass.trigger.bind(this.eventClass)),ki(this,"off",this.eventClass.off.bind(this.eventClass)),this.eventClass=new Ko}}}function yn(r){return class extends r{constructor(...e){super(...e),ki(this,"options"),ki(this,"_isUpdatingOptions"),ki(this,"_initHooksCalled"),ki(this,"_initHooks");const t=Object.getPrototypeOf(this).options||{},i=No({},t,e[0]||{});this.setOptions(i),this.callInitHooks(),this._isUpdatingOptions=!1}proxyOptions(){return gm.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")||ls(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 cs&&(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={},No(t.options,e),this}static addInitHook(e,...t){const i=typeof e=="function"?e:function(){this[e].apply(this,t)},n=this.prototype,o=Object.getPrototypeOf(n);return(!n._initHooks||n._initHooks===o._initHooks)&&(n._initHooks=[]),n._initHooks.push(i),this}static include(...e){for(let t=0;t<e.length;t++)No(this.prototype,e[t]);return this}}}var _m=Object.defineProperty,wm=(r,e,t)=>e in r?_m(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ae=(r,e,t)=>wm(r,typeof e!="symbol"?e+"":e,t);const hs=`
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 Oo=new p.Vector4,dc=new p.Vector3,fc=new p.Vector3,$e=new p.Vector4,qe=new p.Vector4,di=new p.Vector4,Do=new p.Vector3,zo=new p.Matrix4,et=new p.Line3,pc=new p.Vector3,ss=new p.Box3,os=new p.Sphere,fi=new p.Vector4;let pi,gn;function mc(r,e,t){return fi.set(0,0,-e,1).applyMatrix4(r.projectionMatrix),fi.multiplyScalar(1/fi.w),fi.x=gn/t.width,fi.y=gn/t.height,fi.applyMatrix4(r.projectionMatrixInverse),fi.multiplyScalar(1/fi.w),Math.abs(Math.max(fi.x,fi.y))}function rm(r,e){const t=r.matrixWorld,i=r.geometry,n=i.attributes.instanceStart,o=i.attributes.instanceEnd,a=Math.min(i.instanceCount,n.count);for(let c=0,h=a;c<h;c++){et.start.fromBufferAttribute(n,c),et.end.fromBufferAttribute(o,c),et.applyMatrix4(t);const d=new p.Vector3,m=new p.Vector3;pi.distanceSqToSegment(et.start,et.end,m,d),m.distanceTo(d)<gn*.5&&e.push({point:m,pointOnLine:d,distance:pi.origin.distanceTo(m),object:r,face:null,faceIndex:c,uv:null,[bo]:null})}}function sm(r,e,t){const i=e.projectionMatrix,o=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;pi.at(1,di),di.w=1,di.applyMatrix4(e.matrixWorldInverse),di.applyMatrix4(i),di.multiplyScalar(1/di.w),di.x*=o.x/2,di.y*=o.y/2,di.z=0,Do.copy(di),zo.multiplyMatrices(e.matrixWorldInverse,a);for(let g=0,v=m;g<v;g++){if($e.fromBufferAttribute(h,g),qe.fromBufferAttribute(d,g),$e.w=1,qe.w=1,$e.applyMatrix4(zo),qe.applyMatrix4(zo),$e.z>f&&qe.z>f)continue;if($e.z>f){const C=$e.z-qe.z,W=($e.z-f)/C;$e.lerp(qe,W)}else if(qe.z>f){const C=qe.z-$e.z,W=(qe.z-f)/C;qe.lerp($e,W)}$e.applyMatrix4(i),qe.applyMatrix4(i),$e.multiplyScalar(1/$e.w),qe.multiplyScalar(1/qe.w),$e.x*=o.x/2,$e.y*=o.y/2,qe.x*=o.x/2,qe.y*=o.y/2,et.start.copy($e),et.start.z=0,et.end.copy(qe),et.end.z=0;const b=et.closestPointToPointParameter(Do,!0);et.at(b,pc);const x=p.MathUtils.lerp($e.z,qe.z,b),L=x>=-1&&x<=1,M=Do.distanceTo(pc)<gn*.5;if(L&&M){et.start.fromBufferAttribute(h,g),et.end.fromBufferAttribute(d,g),et.start.applyMatrix4(a),et.end.applyMatrix4(a);const C=new p.Vector3,W=new p.Vector3;pi.distanceSqToSegment(et.start,et.end,W,C),t.push({point:W,pointOnLine:C,distance:pi.origin.distanceTo(W),object:r,face:null,faceIndex:g,uv:null,[bo]:null})}}}class om extends p.Mesh{constructor(e=new uc,t=new gr({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)dc.fromBufferAttribute(t,a),fc.fromBufferAttribute(i,a),n[c]=c===0?0:n[c-1],n[c+1]=n[c]+dc.distanceTo(fc);const o=new p.InstancedInterleavedBuffer(n,2,1);return e.setAttribute("instanceDistanceStart",new p.InterleavedBufferAttribute(o,1,0)),e.setAttribute("instanceDistanceEnd",new p.InterleavedBufferAttribute(o,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 o=e.params.Line2!==void 0&&e.params.Line2.threshold||0;pi=e.ray;const a=this.matrixWorld,c=this.geometry,h=this.material;gn=h.linewidth+o,c.boundingSphere===null&&c.computeBoundingSphere(),os.copy(c.boundingSphere).applyMatrix4(a);let d;if(i)d=gn*.5;else{const f=Math.max(n.near,os.distanceToPoint(pi.origin));d=mc(n,f,h.resolution)}if(os.radius+=d,pi.intersectsSphere(os)===!1)return;c.boundingBox===null&&c.computeBoundingBox(),ss.copy(c.boundingBox).applyMatrix4(a);let m;if(i)m=gn*.5;else{const f=Math.max(n.near,ss.distanceToPoint(pi.origin));m=mc(n,f,h.resolution)}ss.expandByScalar(m),pi.intersectsBox(ss)!==!1&&(i?rm(this,t):sm(this,n,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(Oo),this.material.uniforms.resolution.value.set(Oo.z,Oo.w))}}class yr extends om{constructor(e=new rs,t=new gr({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}var Ui=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-Ui.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?Ui.Bounce.In(r*2)*.5:Ui.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}}}}),vr=function(){return performance.now()},am=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=vr()),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 o=this._tweens[i[n]],a=!t;o&&o.update(e,a)===!1&&!t&&delete this._tweens[i[n]]}i=Object.keys(this._tweensAddedDuringUpdate)}return!0},r}(),Xo={Linear:function(r,e){var t=r.length-1,i=t*e,n=Math.floor(i),o=Xo.Utils.Linear;return e<0?o(r[0],r[1],i):e>1?o(r[t],r[t-1],t-i):o(r[n],r[n+1>t?t:n+1],i-n)},Utils:{Linear:function(r,e,t){return(e-r)*t+r}}},gc=function(){function r(){}return r.nextId=function(){return r._nextId++},r._nextId=0,r}(),Uo=new am,as=function(){function r(e,t){t===void 0&&(t=Uo),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=Ui.Linear.None,this._interpolationFunction=Xo.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=gc.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=vr()),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 o in this._valuesEnd)n[o]=this._valuesEnd[o];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,o){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],v=0,w=f.length;v<w;v+=1){var b=this._handleRelativeValue(c,f[v]);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],o)}else(typeof t[a]>"u"||o)&&(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=vr()),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=vr()),!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=Uo),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=Ui.Linear.None),this._easingFunction=e,this},r.prototype.interpolation=function(e){return e===void 0&&(e=Xo.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=vr()),t===void 0&&(t=!0),this._isPaused)return!0;var o,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 v=Math.min(Math.trunc((c-this._duration)/h)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=v);for(o in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[o]=="string"&&(this._valuesStartRepeat[o]=this._valuesStartRepeat[o]+parseFloat(this._valuesEnd[o])),this._yoyo&&this._swapEndStartRepeatValues(o),this._valuesStart[o]=this._valuesStartRepeat[o];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=h*v,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 o in i)if(t[o]!==void 0){var a=t[o]||0,c=i[o],h=Array.isArray(e[o]),d=Array.isArray(c),m=!h&&d;m?e[o]=this._interpolationFunction(c,n):typeof c=="object"&&c?this._updateProperties(e[o],a,c,n):(c=this._handleRelativeValue(a,c),typeof c=="number"&&(e[o]=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}();gc.nextId;var mi=Uo;mi.getAll.bind(mi),mi.removeAll.bind(mi),mi.add.bind(mi),mi.remove.bind(mi);var lm=mi.update.bind(mi);function ko(r,e,t){if(r==null||r==="")throw new Error(t||`Parameter "${e}" is required but received: ${r}`);return r}function yc(r,e,t){const i=e.split(".");let n=r;for(const o of i){if(n[o]===void 0||n[o]===null)throw new Error(`Property "${e}" is required but missing at path: "${o}"`);n=n[o]}return n}function cm(r,e,t,i=0,n=1){const o=(r-e)*(n-i)/(t-e)+i,a=Math.min(i,n),c=Math.max(i,n);return o<a?a:o>c?c:o||0}var hm=Object.defineProperty,um=(r,e,t)=>e in r?hm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,vc=(r,e,t)=>um(r,typeof e!="symbol"?e+"":e,t);class Ko{constructor(){vc(this,"_dispatcher",new p.EventDispatcher),vc(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 dm(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 No(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 ls(r){return r==null}function _r(r){return ls(r)?!1:typeof r=="function"||r.constructor!==null&&r.constructor===Function}function _c(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"),o=r.getMinutes().toString().padStart(2,"0"),a=r.getSeconds().toString().padStart(2,"0");return`${e}-${t}-${i} ${n}:${o}:${a}`}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,Bo=(r,e,t)=>pm(r,typeof e!="symbol"?e+"":e,t);class mm{}class cs extends Ki(yn(mm)){constructor(e){super(),Bo(this,"target"),Bo(this,"dom"),Bo(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 wc=Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"&&!process.versions.electron&&!process.versions.nw&&!process.versions["node-webkit"];let wr={};function bc(){return window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI}if(!wc){const r=navigator.userAgent.toLowerCase(),e=document.documentElement||{style:{}},t="ActiveXObject"in window,i=r.indexOf("webkit")!==-1,n=r.indexOf("phantom")!==-1,o=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,v="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!o,w="MozPerspective"in e.style,b="OTransition"in e.style,x=(g||v||w)&&!b&&!n,L=typeof window<"u"&&_r(window.createImageBitmap),M=typeof window<"u"&&_r(window.ResizeObserver),C=typeof window<"u"&&_r(window.btoa),W=typeof window<"u"&&_r(window.Proxy),z=typeof window<"u"&&_r(window.requestIdleCallback);let D=0;if(a){const k=r.match(/chrome\/([\d.]+)/);D=k?k[1]:0}const X=!n&&(f||"ontouchstart"in window||"DocumentTouch"in window&&document instanceof window.DocumentTouch),I=typeof window<"u"&&"WebGLRenderingContext"in window,K=bc();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{}wr={IS_NODE:wc,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:o,chrome:a,chromeVersion:D,safari:!a&&r.indexOf("safari")!==-1,phantomjs:n,ie3d:g,webkit3d:v,gecko3d:w,opera12:b,any3d:x,iosWeixin:h,mobile:d,mobileWebkit:d&&i,mobileWebkit3d:d&&v,mobileOpera:d&&"opera"in window,mobileGecko:d&&c,touch:!!X,msPointer:!!m,pointer:!!f,retina:K>1,devicePixelRatio:K,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:z,checkDevicePixelRatio:()=>{if(typeof window<"u"&&wr.monitorDPRChange){const k=bc(),j=k!==wr.devicePixelRatio;return j&&(wr.devicePixelRatio=k),j}return!1}}}const gm=wr;var ym=Object.defineProperty,vm=(r,e,t)=>e in r?ym(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ki=(r,e,t)=>vm(r,typeof e!="symbol"?e+"":e,t);function Ki(r){return class extends r{constructor(...e){super(...e),ki(this,"eventClass",new Ko),ki(this,"on",this.eventClass.on.bind(this.eventClass)),ki(this,"trigger",this.eventClass.trigger.bind(this.eventClass)),ki(this,"off",this.eventClass.off.bind(this.eventClass)),this.eventClass=new Ko}}}function yn(r){return class extends r{constructor(...e){super(...e),ki(this,"options"),ki(this,"_isUpdatingOptions"),ki(this,"_initHooksCalled"),ki(this,"_initHooks");const t=Object.getPrototypeOf(this).options||{},i=No({},t,e[0]||{});this.setOptions(i),this.callInitHooks(),this._isUpdatingOptions=!1}proxyOptions(){return gm.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")||ls(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 cs&&(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={},No(t.options,e),this}static addInitHook(e,...t){const i=typeof e=="function"?e:function(){this[e].apply(this,t)},n=this.prototype,o=Object.getPrototypeOf(n);return(!n._initHooks||n._initHooks===o._initHooks)&&(n._initHooks=[]),n._initHooks.push(i),this}static include(...e){for(let t=0;t<e.length;t++)No(this.prototype,e[t]);return this}}}var _m=Object.defineProperty,wm=(r,e,t)=>e in r?_m(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ve=(r,e,t)=>wm(r,typeof e!="symbol"?e+"":e,t);const hs=`
621
621
  varying vec2 vUv;
622
622
  void main() {
623
623
  vUv = uv;
@@ -834,7 +834,7 @@
834
834
  void main() {
835
835
  gl_FragColor = vec4(1.0, 1.0, 1.0, flashOpacity);
836
836
  }
837
- `;class xc{constructor(e,t,i){Ae(this,"lines",[]),Ae(this,"flashOpacity",1),Ae(this,"_decay");const n=(this._rand(i,0)-.5)*e*1.5,o=t*.9,a=-t*.9,c=e*.1,h=[];let d=n,m=o;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,o,a,c,i);this._addGlow(f);for(const g of h){const v=g.y-t*(.12+this._rand(g.seed,77)*.2),w=this._buildPath(g.x,g.y,v,c*.4,g.seed);this._addGlow(w)}this._decay=.025+this._rand(i,55)*.02}_buildPath(e,t,i,n,o){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(o,f*.17+5)-.5)*n;const v=1-g*.55;d.push(new p.Vector3(m*v,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 o=new p.BufferGeometry().setFromPoints(e),a=new p.Line(o,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 Lm{constructor(e){Ae(this,"_scene"),Ae(this,"_hw",1),Ae(this,"_hh",1),Ae(this,"_bolts",[]),Ae(this,"_flashMesh",null),Ae(this,"_flashOpacity",0),Ae(this,"_flickerLeft",0),Ae(this,"_flickerTick",0),Ae(this,"_intervalMin",5e3),Ae(this,"_intervalMax",15e3),Ae(this,"_lastTriggerTime",0),Ae(this,"_nextInterval",0),this._scene=e,this._resetNextInterval()}setTriggerInterval(e,t){this._intervalMin=e,this._intervalMax=t}getTriggerInterval(){return[this._intervalMin,this._intervalMax]}trigger(){const e=new xc(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 xc(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:hs,fragmentShader:Sm,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){(t??Date.now())-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 o of this._bolts[n].lines)this._scene.remove(o);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 Mc{constructor(e,t,i={}){Ae(this,"scene"),Ae(this,"camera"),Ae(this,"mesh"),Ae(this,"rainMaterial"),Ae(this,"snowMaterial"),Ae(this,"fogMaterial"),Ae(this,"lightningSystem"),Ae(this,"_type",null),Ae(this,"_activeMaterial",null),this.scene=new p.Scene,this.scene.autoClear=!1;const n=e/2,o=t/2;this.camera=new p.OrthographicCamera(-n,n,o,-o,.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:hs,fragmentShader:bm,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:hs,fragmentShader:xm,transparent:!0,depthTest:!1,depthWrite:!1,uniforms:{iTime:{value:0},aspectRatio:{value:e/t}}}),this.fogMaterial=new p.ShaderMaterial({vertexShader:hs,fragmentShader:Mm,transparent:!0,depthTest:!1,depthWrite:!1,uniforms:{iTime:{value:0},fogSpeed:{value:i.speed??1},fogOpacity:{value:i.opacity??1}}}),this.lightningSystem=new Lm(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;switch(e){case"rain":this._activeMaterial=this.rainMaterial;break;case"snow":this._activeMaterial=this.snowMaterial;break;case"fog":this._activeMaterial=this.fogMaterial;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 Pm=Object.defineProperty,Cm=(r,e,t)=>e in r?Pm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ve=(r,e,t)=>Cm(r,typeof e!="symbol"?e+"":e,t);const Tm=Ki(yn(p.EventDispatcher));class Sc extends Tm{constructor(e,t={}){super(),Ve(this,"scene"),Ve(this,"renderer"),Ve(this,"camera"),Ve(this,"controls"),Ve(this,"ambLight"),Ve(this,"dirLight"),Ve(this,"auxDirLight"),Ve(this,"clouds",null),Ve(this,"container"),Ve(this,"_clock",new p.Clock),Ve(this,"stats"),Ve(this,"_animationCallbacks",new Set),Ve(this,"_fogFactor",1),Ve(this,"_sceneSize",5e4*2),Ve(this,"_weatherEffect",null),Ve(this,"gorund"),Ve(this,"map"),Ve(this,"centerPostion"),Ve(this,"_isInteracting",!1),Ve(this,"debug",!1),Ve(this,"flyTween",null),Ve(this,"composer"),Ve(this,"renderPass"),Ve(this,"bloomPass"),Ve(this,"calculateCameraPosition",(g,v,w,b)=>{const x=new p.Vector3(0,v*Math.cos(w),v*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:o=!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,o),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(),v=this.container?this.width:window.innerWidth,w=this.container?this.height:window.innerHeight,b=v*g,x=w*g,L=new p.WebGLRenderTarget(b,x,{format:p.RGBAFormat});L.samples=4,this.composer=new Hf(this.renderer,L),this.renderPass=new qf(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 Bf(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 ur,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,o=>{t.background=o},void 0,o=>{console.error("Error loading skybox:",o),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 tm().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 Of(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 o=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/o*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=o/(a+5)*this.fogFactor*.1);const d=a>6e4;i.minAzimuthAngle=d?0:-1/0,i.maxAzimuthAngle=d?0:1/0,i.maxPolarAngle=cm(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 v=new p.CameraHelper(f.shadow.camera);v.name="dirLightCameraHelper",this.scene.add(v)}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 o=new p.DirectionalLight(16777215,n);o.position.set(e,t,i);const a=new p.Object3D;return a.position.copy(this.centerPostion),this.scene.add(a),o.target=a,o.castShadow=!1,o}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)),lm(),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 o=this.camera.position;new as(o).to({y:2e7,z:0},500).chain(new as(o).to(t,2e3).easing(Ui.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,o=e.cameraCoord,a=e.duration??2e3,c=e.delay??0,h=e.complete,d=!!e.curvePath;if(!n||!o)return;const m=this.map.geo2world(new p.Vector3(n[0],n[1],0)),f=this.map.geo2world(new p.Vector3(o[0],o[1],o[2]));if(!t||!i||!m||!f)return;const g=i.target.clone(),v=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=[v,v.clone().lerp(b,.33),v.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 as(M).to({t:1,x:w.x,y:w.y,z:w.z},a).easing(Ui.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:v.x,py:v.y,pz:v.z};this.flyTween=new as(x).to({tx:w.x,ty:w.y,tz:w.z,px:b.x,py:b.y,pz:b.z},a).easing(Ui.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,o=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,o,c,h),v=this.map.world2geo(g);this.flyToAdvanced({center:[i[0],i[1],0],cameraCoord:[v.x,v.y,v.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 Mc(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 br=(r=>(r[r.none=0]="none",r[r.create=1]="create",r[r.remove=2]="remove",r))(br||{});function Gm(r,e){const t=r.position.clone().setZ(r.maxZ).applyMatrix4(r.matrixWorld);return e.distanceTo(t)}function Wm(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 Zm(r){return r.distToCamera/r.sizeInWorld*.8}function Vm(r,e,t,i){const n=Zm(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 Im(r,e,t,i){const n=[],o=i+1,a=e*2,c=0,h=.25;{const d=t*2,m=new p.Vector3(.5,.5,1),f=new Ni(a,d,o),g=new Ni(a+1,d,o),v=new Ni(a,d+1,o),w=new Ni(a+1,d+1,o);f.position.set(-h,h,c),f.scale.copy(m),g.position.set(h,h,c),g.scale.copy(m),v.position.set(-h,-h,c),v.scale.copy(m),w.position.set(h,-h,c),w.scale.copy(m),n.push(f,g,v,w)}return n}var Am=Object.defineProperty,Fm=(r,e,t)=>e in r?Am(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,tt=(r,e,t)=>Fm(r,typeof e!="symbol"?e+"":e,t);const Om=10,Dm=new p.InstancedBufferGeometry,zm=new p.Vector3,Xm=new p.Matrix4,Um=new p.Box3(new p.Vector3(-.5,-.5,0),new p.Vector3(.5,.5,1)),Lc=new p.Frustum,Pc=class $r extends p.Mesh{constructor(e=0,t=0,i=0){super(Dm,[]),tt(this,"_dataOnlyMode",!1),tt(this,"vectorData",null),tt(this,"x"),tt(this,"y"),tt(this,"z"),tt(this,"isTile",!0),tt(this,"parent",null),tt(this,"children",[]),tt(this,"_ready",!1),tt(this,"_isDummy",!1),tt(this,"_showing",!1),tt(this,"_maxZ",0),tt(this,"distToCamera",0),tt(this,"sizeInWorld",0),tt(this,"_loaded",!1),tt(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 $r._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($r.downloadThreads>Om)return{action:br.none};let t=[];const{loader:i,minLevel:n,maxLevel:o,LODThreshold:a}=e,c=Vm(this,n,o,a);return c===br.create&&(t=Im(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){$r._downloadThreads++;const{x:t,y:i,z:n}=this;if(this._dataOnlyMode)try{const o=await e.load({x:t,y:i,z:n,bounds:[-1/0,-1/0,1/0,1/0]});this.vectorData=o.geometry?.userData||{},this._loaded=!0,this.dispatchEvent({type:"vector-data-loaded",data:this.vectorData,tile:this})}catch(o){console.error(`数据模式加载失败 ${n}/${t}/${i}:`,o),this._loaded=!1}else{const o=await e.load({x:t,y:i,z:n,bounds:[-1/0,-1/0,1/0,1/0]});this.material=o.materials,this.geometry=o.geometry,this.maxZ=this.geometry.boundingBox?.max.z||0,this._loaded=!0}return $r._downloadThreads--,this}_init(){this.updateMatrix(),this.updateMatrixWorld(),this.sizeInWorld=Wm(this)}update(e){if(console.assert(this.z===0),!this.parent)return this;Lc.setFromProjectionMatrix(Xm.multiplyMatrices(e.camera.projectionMatrix,e.camera.matrixWorldInverse));const t=e.camera.getWorldPosition(zm);return this.traverse(i=>{i.receiveShadow=this.receiveShadow,i.castShadow=this.castShadow;const n=Um.clone().applyMatrix4(i.matrixWorld);n.max.setY(9e3),i.inFrustum=Lc.intersectsBox(n),i.distToCamera=Gm(i,t);const{action:o,newTiles:a}=i.LOD(e);this._doAction(i,o,a,e)}),this._checkReady(),this}_doAction(e,t,i,n){return t===br.create?i?.forEach(o=>{o._init(),o._isDummy=o.z<n.minLevel,this.dispatchEvent({type:"tile-created",tile:o}),o.isDummy||o._load(n.loader).then(()=>{o._checkVisible(),this.dispatchEvent({type:"tile-loaded",tile:o})})}):t===br.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}};tt(Pc,"_downloadThreads",0);let Ni=Pc;var km=Object.defineProperty,Km=(r,e,t)=>e in r?km(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Nm=(r,e,t)=>Km(r,e+"",t);class Cc{constructor(e=0){Nm(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,o=this.mapHeight/2,a=e/Math.pow(2,i)*n-n/2,c=o-t/Math.pow(2,i)*o*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),o=this.getTileXYZproj(e+1,t+1,i);return[Math.min(n.x,o.x),Math.min(n.y,o.y),Math.max(n.x,o.x),Math.max(n.y,o.y)]}getLonLatBoundsFromXYZ(e,t,i){const n=this.getProjBoundsFromXYZ(e,t,i),o=this.unProject(n[0],n[1]),a=this.unProject(n[2],n[3]);return[o.lon,o.lat,a.lon,a.lat]}}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,us=(r,e,t)=>Ym(r,typeof e!="symbol"?e+"":e,t);const xr=6378e3;class Tc extends Cc{constructor(){super(...arguments),us(this,"ID","3857"),us(this,"mapWidth",2*Math.PI*xr),us(this,"mapHeight",this.mapWidth),us(this,"mapDepth",1)}project(e,t){const i=(e-this.lon0)*(Math.PI/180),n=t*(Math.PI/180),o=xr*i,a=xr*Math.log(Math.tan(Math.PI/4+n/2));return{x:o,y:a}}unProject(e,t){let i=e/xr*(180/Math.PI)+this.lon0;return i>180&&(i-=360),{lat:(2*Math.atan(Math.exp(t/xr))-Math.PI/2)*(180/Math.PI),lon:i}}}var Rm=Object.defineProperty,jm=(r,e,t)=>e in r?Rm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ds=(r,e,t)=>jm(r,typeof e!="symbol"?e+"":e,t);class Jm extends Cc{constructor(){super(...arguments),ds(this,"ID","4326"),ds(this,"mapWidth",36e3),ds(this,"mapHeight",18e3),ds(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 Qm={createFromID:(r="3857",e)=>{let t;switch(r){case"3857":t=new Tc(e);break;case"4326":t=new Jm(e);break;default:throw new Error(`Projection ID: ${r} is not supported.`)}return t}};function Yo(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 Ni){const o=r.worldToLocal(n.point.clone()),a=r.map2geo(o);return Object.assign(n,{location:a})}}function Ro(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 Yo(r,n)}function Gc(r,e,t){const i=new p.Raycaster;return i.setFromCamera(t,r),Yo(e,i)}function Hm(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,o=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,o-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 Em(r,e=128){const t=new p.CanvasTexture(Hm(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 $m=Object.defineProperty,qm=(r,e,t)=>e in r?$m(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,gi=(r,e,t)=>qm(r,typeof e!="symbol"?e+"":e,t);class fs extends p.Mesh{constructor(e){super(),gi(this,"name","map"),gi(this,"_clock",new p.Clock),gi(this,"isLOD",!0),gi(this,"autoUpdate",!0),gi(this,"updateInterval",100),gi(this,"_minLevel",2),gi(this,"_layers",new Map),gi(this,"_maxLevel",24),gi(this,"_projection",new Tc(0)),gi(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 fs(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 Ro(this,t)}getLocalInfoFromWorld(e){return Ro(this,e)}getLocalInfoFromScreen(e,t){return Gc(e,this,t)}get downloading(){return Ni.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 eg=Object.defineProperty,tg=(r,e,t)=>e in r?eg(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ig=(r,e,t)=>tg(r,e+"",t);function jo(r){return class extends r{constructor(...t){super(...t),ig(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 ng=Object.defineProperty,rg=(r,e,t)=>e in r?ng(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,vn=(r,e,t)=>rg(r,typeof e!="symbol"?e+"":e,t);const sg={attribution:"",visible:!0,opacity:1,zIndex:0,isSceneLayer:!1,altitude:0};class ps extends jo(Ki(yn(p.Group))){constructor(e,t){super(),vn(this,"_id"),vn(this,"opacity",1),vn(this,"_animationCallbacks",new Set),vn(this,"isSceneLayer",!1),vn(this,"_altitude",0),vn(this,"depthOffset"),vn(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,o)=>{this.animate?.(i,n,o)});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)}`}}ps.mergeOptions(sg);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,Mr=(r,e,t)=>ag(r,typeof e!="symbol"?e+"":e,t);const Wc=class cf{constructor(e){Mr(this,"_cache",new Map),Mr(this,"_gltfLoader"),Mr(this,"_fbxLoader"),Mr(this,"_dracoLoader"),this._gltfLoader=new tp(e),this._fbxLoader=new Np(e)}static init(e){return this._instance||(this._instance=new cf(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 o=await this._gltfLoader.loadAsync(e.url);i=o.scene,n=o.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(o=>({...o,name:o.name||"unnamed"}))||[]}}catch(o){throw console.error(`Failed to load ${e.type} model 加载${e.type}模型失败:`,e.url,o),o}}_initDracoLoader(e="/draco/"){this._dracoLoader||(this._dracoLoader=new im,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(o=>({...o,name:o.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()}};Mr(Wc,"_instance");let Zc=Wc;const Jo=(r,e)=>{"updateRanges"in r?r.updateRanges[0]=e:r.updateRange=e},Vc=new p.Matrix4,ms=new p.Vector3,gs=new p.Quaternion,Ic=new p.Vector3,Ac=new p.Quaternion,Sr=new p.Vector3,lg=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;
837
+ `;class xc{constructor(e,t,i){Ve(this,"lines",[]),Ve(this,"flashOpacity",1),Ve(this,"_decay");const n=(this._rand(i,0)-.5)*e*1.5,o=t*.9,a=-t*.9,c=e*.1,h=[];let d=n,m=o;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,o,a,c,i);this._addGlow(f);for(const g of h){const v=g.y-t*(.12+this._rand(g.seed,77)*.2),w=this._buildPath(g.x,g.y,v,c*.4,g.seed);this._addGlow(w)}this._decay=.025+this._rand(i,55)*.02}_buildPath(e,t,i,n,o){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(o,f*.17+5)-.5)*n;const v=1-g*.55;d.push(new p.Vector3(m*v,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 o=new p.BufferGeometry().setFromPoints(e),a=new p.Line(o,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 Lm{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 xc(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 xc(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:hs,fragmentShader:Sm,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 o of this._bolts[n].lines)this._scene.remove(o);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 Mc{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,o=t/2;this.camera=new p.OrthographicCamera(-n,n,o,-o,.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:hs,fragmentShader:bm,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:hs,fragmentShader:xm,transparent:!0,depthTest:!1,depthWrite:!1,uniforms:{iTime:{value:0},aspectRatio:{value:e/t}}}),this.fogMaterial=new p.ShaderMaterial({vertexShader:hs,fragmentShader:Mm,transparent:!0,depthTest:!1,depthWrite:!1,uniforms:{iTime:{value:0},fogSpeed:{value:i.speed??1},fogOpacity:{value:i.opacity??1}}}),this.lightningSystem=new Lm(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 Pm=Object.defineProperty,Cm=(r,e,t)=>e in r?Pm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ie=(r,e,t)=>Cm(r,typeof e!="symbol"?e+"":e,t);const Tm=Ki(yn(p.EventDispatcher));class Sc extends Tm{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,v,w,b)=>{const x=new p.Vector3(0,v*Math.cos(w),v*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:o=!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,o),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(),v=this.container?this.width:window.innerWidth,w=this.container?this.height:window.innerHeight,b=v*g,x=w*g,L=new p.WebGLRenderTarget(b,x,{format:p.RGBAFormat});L.samples=4,this.composer=new Hf(this.renderer,L),this.renderPass=new qf(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 Bf(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 ur,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,o=>{t.background=o},void 0,o=>{console.error("Error loading skybox:",o),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 tm().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 Of(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 o=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/o*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=o/(a+5)*this.fogFactor*.1);const d=a>6e4;i.minAzimuthAngle=d?0:-1/0,i.maxAzimuthAngle=d?0:1/0,i.maxPolarAngle=cm(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 v=new p.CameraHelper(f.shadow.camera);v.name="dirLightCameraHelper",this.scene.add(v)}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 o=new p.DirectionalLight(16777215,n);o.position.set(e,t,i);const a=new p.Object3D;return a.position.copy(this.centerPostion),this.scene.add(a),o.target=a,o.castShadow=!1,o}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)),lm(),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 o=this.camera.position;new as(o).to({y:2e7,z:0},500).chain(new as(o).to(t,2e3).easing(Ui.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,o=e.cameraCoord,a=e.duration??2e3,c=e.delay??0,h=e.complete,d=!!e.curvePath;if(!n||!o)return;const m=this.map.geo2world(new p.Vector3(n[0],n[1],0)),f=this.map.geo2world(new p.Vector3(o[0],o[1],o[2]));if(!t||!i||!m||!f)return;const g=i.target.clone(),v=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=[v,v.clone().lerp(b,.33),v.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 as(M).to({t:1,x:w.x,y:w.y,z:w.z},a).easing(Ui.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:v.x,py:v.y,pz:v.z};this.flyTween=new as(x).to({tx:w.x,ty:w.y,tz:w.z,px:b.x,py:b.y,pz:b.z},a).easing(Ui.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,o=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,o,c,h),v=this.map.world2geo(g);this.flyToAdvanced({center:[i[0],i[1],0],cameraCoord:[v.x,v.y,v.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 Mc(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 br=(r=>(r[r.none=0]="none",r[r.create=1]="create",r[r.remove=2]="remove",r))(br||{});function Gm(r,e){const t=r.position.clone().setZ(r.maxZ).applyMatrix4(r.matrixWorld);return e.distanceTo(t)}function Wm(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 Zm(r){return r.distToCamera/r.sizeInWorld*.8}function Vm(r,e,t,i){const n=Zm(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 Im(r,e,t,i){const n=[],o=i+1,a=e*2,c=0,h=.25;{const d=t*2,m=new p.Vector3(.5,.5,1),f=new Ni(a,d,o),g=new Ni(a+1,d,o),v=new Ni(a,d+1,o),w=new Ni(a+1,d+1,o);f.position.set(-h,h,c),f.scale.copy(m),g.position.set(h,h,c),g.scale.copy(m),v.position.set(-h,-h,c),v.scale.copy(m),w.position.set(h,-h,c),w.scale.copy(m),n.push(f,g,v,w)}return n}var Am=Object.defineProperty,Fm=(r,e,t)=>e in r?Am(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,tt=(r,e,t)=>Fm(r,typeof e!="symbol"?e+"":e,t);const Om=10,Dm=new p.InstancedBufferGeometry,zm=new p.Vector3,Xm=new p.Matrix4,Um=new p.Box3(new p.Vector3(-.5,-.5,0),new p.Vector3(.5,.5,1)),Lc=new p.Frustum,Pc=class $r extends p.Mesh{constructor(e=0,t=0,i=0){super(Dm,[]),tt(this,"_dataOnlyMode",!1),tt(this,"vectorData",null),tt(this,"x"),tt(this,"y"),tt(this,"z"),tt(this,"isTile",!0),tt(this,"parent",null),tt(this,"children",[]),tt(this,"_ready",!1),tt(this,"_isDummy",!1),tt(this,"_showing",!1),tt(this,"_maxZ",0),tt(this,"distToCamera",0),tt(this,"sizeInWorld",0),tt(this,"_loaded",!1),tt(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 $r._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($r.downloadThreads>Om)return{action:br.none};let t=[];const{loader:i,minLevel:n,maxLevel:o,LODThreshold:a}=e,c=Vm(this,n,o,a);return c===br.create&&(t=Im(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){$r._downloadThreads++;const{x:t,y:i,z:n}=this;if(this._dataOnlyMode)try{const o=await e.load({x:t,y:i,z:n,bounds:[-1/0,-1/0,1/0,1/0]});this.vectorData=o.geometry?.userData||{},this._loaded=!0,this.dispatchEvent({type:"vector-data-loaded",data:this.vectorData,tile:this})}catch(o){console.error(`数据模式加载失败 ${n}/${t}/${i}:`,o),this._loaded=!1}else{const o=await e.load({x:t,y:i,z:n,bounds:[-1/0,-1/0,1/0,1/0]});this.material=o.materials,this.geometry=o.geometry,this.maxZ=this.geometry.boundingBox?.max.z||0,this._loaded=!0}return $r._downloadThreads--,this}_init(){this.updateMatrix(),this.updateMatrixWorld(),this.sizeInWorld=Wm(this)}update(e){if(console.assert(this.z===0),!this.parent)return this;Lc.setFromProjectionMatrix(Xm.multiplyMatrices(e.camera.projectionMatrix,e.camera.matrixWorldInverse));const t=e.camera.getWorldPosition(zm);return this.traverse(i=>{i.receiveShadow=this.receiveShadow,i.castShadow=this.castShadow;const n=Um.clone().applyMatrix4(i.matrixWorld);n.max.setY(9e3),i.inFrustum=Lc.intersectsBox(n),i.distToCamera=Gm(i,t);const{action:o,newTiles:a}=i.LOD(e);this._doAction(i,o,a,e)}),this._checkReady(),this}_doAction(e,t,i,n){return t===br.create?i?.forEach(o=>{o._init(),o._isDummy=o.z<n.minLevel,this.dispatchEvent({type:"tile-created",tile:o}),o.isDummy||o._load(n.loader).then(()=>{o._checkVisible(),this.dispatchEvent({type:"tile-loaded",tile:o})})}):t===br.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}};tt(Pc,"_downloadThreads",0);let Ni=Pc;var km=Object.defineProperty,Km=(r,e,t)=>e in r?km(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Nm=(r,e,t)=>Km(r,e+"",t);class Cc{constructor(e=0){Nm(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,o=this.mapHeight/2,a=e/Math.pow(2,i)*n-n/2,c=o-t/Math.pow(2,i)*o*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),o=this.getTileXYZproj(e+1,t+1,i);return[Math.min(n.x,o.x),Math.min(n.y,o.y),Math.max(n.x,o.x),Math.max(n.y,o.y)]}getLonLatBoundsFromXYZ(e,t,i){const n=this.getProjBoundsFromXYZ(e,t,i),o=this.unProject(n[0],n[1]),a=this.unProject(n[2],n[3]);return[o.lon,o.lat,a.lon,a.lat]}}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,us=(r,e,t)=>Ym(r,typeof e!="symbol"?e+"":e,t);const xr=6378e3;class Tc extends Cc{constructor(){super(...arguments),us(this,"ID","3857"),us(this,"mapWidth",2*Math.PI*xr),us(this,"mapHeight",this.mapWidth),us(this,"mapDepth",1)}project(e,t){const i=(e-this.lon0)*(Math.PI/180),n=t*(Math.PI/180),o=xr*i,a=xr*Math.log(Math.tan(Math.PI/4+n/2));return{x:o,y:a}}unProject(e,t){let i=e/xr*(180/Math.PI)+this.lon0;return i>180&&(i-=360),{lat:(2*Math.atan(Math.exp(t/xr))-Math.PI/2)*(180/Math.PI),lon:i}}}var Rm=Object.defineProperty,jm=(r,e,t)=>e in r?Rm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ds=(r,e,t)=>jm(r,typeof e!="symbol"?e+"":e,t);class Jm extends Cc{constructor(){super(...arguments),ds(this,"ID","4326"),ds(this,"mapWidth",36e3),ds(this,"mapHeight",18e3),ds(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 Qm={createFromID:(r="3857",e)=>{let t;switch(r){case"3857":t=new Tc(e);break;case"4326":t=new Jm(e);break;default:throw new Error(`Projection ID: ${r} is not supported.`)}return t}};function Yo(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 Ni){const o=r.worldToLocal(n.point.clone()),a=r.map2geo(o);return Object.assign(n,{location:a})}}function Ro(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 Yo(r,n)}function Gc(r,e,t){const i=new p.Raycaster;return i.setFromCamera(t,r),Yo(e,i)}function Hm(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,o=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,o-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 Em(r,e=128){const t=new p.CanvasTexture(Hm(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 $m=Object.defineProperty,qm=(r,e,t)=>e in r?$m(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,gi=(r,e,t)=>qm(r,typeof e!="symbol"?e+"":e,t);class fs extends p.Mesh{constructor(e){super(),gi(this,"name","map"),gi(this,"_clock",new p.Clock),gi(this,"isLOD",!0),gi(this,"autoUpdate",!0),gi(this,"updateInterval",100),gi(this,"_minLevel",2),gi(this,"_layers",new Map),gi(this,"_maxLevel",24),gi(this,"_projection",new Tc(0)),gi(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 fs(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 Ro(this,t)}getLocalInfoFromWorld(e){return Ro(this,e)}getLocalInfoFromScreen(e,t){return Gc(e,this,t)}get downloading(){return Ni.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 eg=Object.defineProperty,tg=(r,e,t)=>e in r?eg(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ig=(r,e,t)=>tg(r,e+"",t);function jo(r){return class extends r{constructor(...t){super(...t),ig(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 ng=Object.defineProperty,rg=(r,e,t)=>e in r?ng(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,vn=(r,e,t)=>rg(r,typeof e!="symbol"?e+"":e,t);const sg={attribution:"",visible:!0,opacity:1,zIndex:0,isSceneLayer:!1,altitude:0};class ps extends jo(Ki(yn(p.Group))){constructor(e,t){super(),vn(this,"_id"),vn(this,"opacity",1),vn(this,"_animationCallbacks",new Set),vn(this,"isSceneLayer",!1),vn(this,"_altitude",0),vn(this,"depthOffset"),vn(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,o)=>{this.animate?.(i,n,o)});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)}`}}ps.mergeOptions(sg);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,Mr=(r,e,t)=>ag(r,typeof e!="symbol"?e+"":e,t);const Wc=class cf{constructor(e){Mr(this,"_cache",new Map),Mr(this,"_gltfLoader"),Mr(this,"_fbxLoader"),Mr(this,"_dracoLoader"),this._gltfLoader=new tp(e),this._fbxLoader=new Np(e)}static init(e){return this._instance||(this._instance=new cf(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 o=await this._gltfLoader.loadAsync(e.url);i=o.scene,n=o.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(o=>({...o,name:o.name||"unnamed"}))||[]}}catch(o){throw console.error(`Failed to load ${e.type} model 加载${e.type}模型失败:`,e.url,o),o}}_initDracoLoader(e="/draco/"){this._dracoLoader||(this._dracoLoader=new im,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(o=>({...o,name:o.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()}};Mr(Wc,"_instance");let Zc=Wc;const Jo=(r,e)=>{"updateRanges"in r?r.updateRanges[0]=e:r.updateRange=e},Vc=new p.Matrix4,ms=new p.Vector3,gs=new p.Quaternion,Ic=new p.Vector3,Ac=new p.Quaternion,Sr=new p.Vector3,lg=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;
838
838
  varying float vOpacity;
839
839
  `+t.vertexShader.replace("#include <fog_vertex>",`#include <fog_vertex>
840
840
  vOpacity = cloudOpacity;
@@ -972,7 +972,7 @@
972
972
  #include <clipping_planes_fragment>
973
973
  vec2 coord = gl_PointCoord - vec2(0.5);
974
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=>{i instanceof p.Mesh&&(Array.isArray(i.material)?i.material:[i.material]).forEach(o=>{t.color!==void 0&&o.color.set(t.color),t.opacity!==void 0&&(o.opacity=t.opacity,o.transparent=t.opacity<1),t.wireframe!==void 0&&(o.wireframe=t.wireframe),o.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(Dn._textureCache.has(e))return Dn._textureCache.get(e);const t=await new Promise((i,n)=>{Dn._textureLoader.load(e,i,void 0,n)});return t.needsUpdate=!0,Dn._textureCache.set(e,t),t}static create(e){return e instanceof Dn?e:new Dn(e)}};kc($o,"_textureCache",new Map),kc($o,"_textureLoader",new p.TextureLoader);let Mt=$o;const it=[];for(let r=0;r<256;++r)it.push((r+256).toString(16).slice(1));function Vg(r,e=0){return(it[r[e+0]]+it[r[e+1]]+it[r[e+2]]+it[r[e+3]]+"-"+it[r[e+4]]+it[r[e+5]]+"-"+it[r[e+6]]+it[r[e+7]]+"-"+it[r[e+8]]+it[r[e+9]]+"-"+it[r[e+10]]+it[r[e+11]]+it[r[e+12]]+it[r[e+13]]+it[r[e+14]]+it[r[e+15]]).toLowerCase()}let qo;const Ig=new Uint8Array(16);function Ag(){if(!qo){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");qo=crypto.getRandomValues.bind(crypto)}return qo(Ig)}const Kc={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Fg(r,e,t){if(Kc.randomUUID&&!r)return Kc.randomUUID();r=r||{};const i=r.random??r.rng?.()??Ag();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,Vg(i)}var Nc=(r=>(r.POINT="point",r.LINE_VERTEX="line_vertex",r.POLYGON_CENTER="polygon_center",r.LABEL="label",r.ICON="icon",r.CLUSTER="cluster",r))(Nc||{}),yi=(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))(yi||{}),Og=Object.defineProperty,Dg=(r,e,t)=>e in r?Og(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Lr=(r,e,t)=>Dg(r,typeof e!="symbol"?e+"":e,t);class zg extends cs{constructor(){super(...arguments),Lr(this,"_isDragging",!1),Lr(this,"_lastCoord",null),Lr(this,"_boundOnMouseDown",this._onMouseDown.bind(this)),Lr(this,"_boundOnMouseMove",this._onMouseMove.bind(this)),Lr(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],o=n(i.coordinates);i.coordinates=o,this.target._onPositionChanged(!0)}}var Xg=Object.defineProperty,Ug=(r,e,t)=>e in r?Xg(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Zt=(r,e,t)=>Ug(r,typeof e!="symbol"?e+"":e,t);class ut extends jo(Ki(yn(p.Object3D))){constructor(e){super(),Zt(this,"_position"),Zt(this,"_threeGeometry"),Zt(this,"_geometry"),Zt(this,"_layer"),Zt(this,"_style"),Zt(this,"_id"),Zt(this,"_styleQueue",[]),Zt(this,"_isApplyingStyle",!1),Zt(this,"_isGeometryInitializing",!1),Zt(this,"_bloomConfig"),Zt(this,"_collisionState",{visible:!0,reason:yi.NO_COLLISION,collidedWith:[],timestamp:Date.now()}),Zt(this,"_collisionConfig",{enabled:!0,priority:50,padding:4,minZoom:0,maxZoom:24}),Zt(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=Fg(),this.addHandler("draggable",zg)}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 Mt?e:new Mt(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(o=>{if(o instanceof p.Points&&o.material){const a=o.material;o.userData=o.userData||{},o.userData.__bloomBackup||(o.userData.__bloomBackup={size:a.size,sizeAttenuation:a.sizeAttenuation});const c=o.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(o.type==="Sprite"&&o.material){const a=o.material;o.userData=o.userData||{},o.userData.__bloomBackup||(o.userData.__bloomBackup={color:a.color?a.color.clone():null,opacity:a.opacity??1});const c=o.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(o.isLine2&&o.material){const a=o.material;o.userData=o.userData||{},o.userData.__bloomBackup||(o.userData.__bloomBackup={color:a.color?a.color.clone():null,opacity:a.opacity??1});const c=o.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}o instanceof p.Mesh&&o.material&&(Array.isArray(o.material)?o.material:[o.material]).forEach(c=>{o.userData=o.userData||{},o.userData.__bloomBackup||(o.userData.__bloomBackup={emissiveIntensity:c.emissiveIntensity??0,emissiveColor:c.emissive?c.emissive.clone():null,color:c.color?c.color.clone():null});const h=o.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 o=1;o<=t;o++)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,o<t){const c=i*Math.pow(2,o-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 Mt(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 Nc.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=yi.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,yi.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:o,height:a}=t.domElement,c=[];n.forEach(z=>{const D=z.clone().project(e),X=(D.x*.5+.5)*o,I=(-D.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(z=>{h=Math.min(h,z.x),d=Math.max(d,z.x),m=Math.min(m,z.y),f=Math.max(f,z.y)});const g=d-h,v=f-m,w=4,b=Math.max(g,w),x=Math.max(v,w),L=new p.Vector3;i.getCenter(L);const M=L.clone().project(e),C=(M.x*.5+.5)*o,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:o,tileX:a,tileY:c,extent:h,tileSize:d}=i,m=(e/h-.5)*d,f=(.5-t/h)*d;return n.tileIDToWorldCenter(o,a,c).clone().add(new p.Vector3(m,f,0)).sub(n.prjcenter)}}var kg=Object.defineProperty,Kg=(r,e,t)=>e in r?kg(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Bc=(r,e,t)=>Kg(r,typeof e!="symbol"?e+"":e,t);class Bi extends ps{constructor(e,t){super(e,t),Bc(this,"_feaList"),Bc(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 ut))&&!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,o;for(let a=0,c=this._feaList.length;a<c;a++)n=this._feaList[a],t?o=e.call(t,n):o=e(n),o&&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 ut||(e[t]=this.removeFeature(e[t])),!(!e[t]||this!==e[t].getLayer())&&e[t]._remove();return this}clear(){const e=this._feaList.slice();for(const t of e)t._remove();return this}onRemoveFeature(e){if(!e)return;const t=e.getLayer();if(!t||t!==this)return;const i=this._findInList(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,o;for(;i<=n;){if(o=Math.floor((i+n)/2),this._feaList[o]===e)return o;i=o+1}return-1}_disposeFeatureResources(e){try{e.geometry&&e.geometry.dispose&&e.geometry.dispose(),e.material&&(Array.isArray(e.material)?e.material.forEach(t=>t.dispose?.()):e.material.dispose&&e.material.dispose()),e instanceof p.Object3D&&e.traverse(t=>{t!==e&&this._disposeFeatureResources(t)})}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 Ng=Object.defineProperty,Bg=(r,e,t)=>e in r?Ng(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Yc=(r,e,t)=>Bg(r,typeof e!="symbol"?e+"":e,t);class Yg extends p.Group{constructor(){super(...arguments),Yc(this,"_layers",new Set),Yc(this,"_layerids",new Set)}add(...e){return e.forEach(t=>{if(!(t instanceof ps))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 Rg=Object.defineProperty,jg=(r,e,t)=>e in r?Rg(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Jg=(r,e,t)=>jg(r,e+"",t);class Qg{constructor(){Jg(this,"canvasDict",{})}getCanvas(e=40,t=30,i=1,n){const o=Math.ceil(e*i),a=Math.ceil(t*i),c=n?`${o}_${a}_${n}`:`${o}_${a}`;if(!this.canvasDict[c]){const m=document.createElement("canvas");m.width=o,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 Hg(r){const e=+this._x.call(null,r),t=+this._y.call(null,r);return Rc(this.cover(e,t),e,t,r)}function Rc(r,e,t,i){if(isNaN(e)||isNaN(t))return r;var n,o=r._root,a={data:i},c=r._x0,h=r._y0,d=r._x1,m=r._y1,f,g,v,w,b,x,L,M;if(!o)return r._root=a,r;for(;o.length;)if((b=e>=(f=(c+d)/2))?c=f:d=f,(x=t>=(g=(h+m)/2))?h=g:m=g,n=o,!(o=o[L=x<<1|b]))return n[L]=a,r;if(v=+r._x.call(null,o.data),w=+r._y.call(null,o.data),e===v&&t===w)return a.next=o,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|v>=f));return n[M]=o,n[L]=a,r}function Eg(r){var e,t,i=r.length,n,o,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(o=+this._y.call(null,e))||(a[t]=n,c[t]=o,n<h&&(h=n),n>m&&(m=n),o<d&&(d=o),o>f&&(f=o));if(h>m||d>f)return this;for(this.cover(h,d).cover(m,f),t=0;t<i;++t)Rc(this,a[t],c[t],r[t]);return this}function $g(r,e){if(isNaN(r=+r)||isNaN(e=+e))return this;var t=this._x0,i=this._y0,n=this._x1,o=this._y1;if(isNaN(t))n=(t=Math.floor(r))+1,o=(i=Math.floor(e))+1;else{for(var a=n-t||1,c=this._root,h,d;t>r||r>=n||i>e||e>=o;)switch(d=(e<i)<<1|r<t,h=new Array(4),h[d]=c,c=h,a*=2,d){case 0:n=t+a,o=i+a;break;case 1:t=n-a,o=i+a;break;case 2:n=t+a,i=o-a;break;case 3:t=n-a,i=o-a;break}this._root&&this._root.length&&(this._root=c)}return this._x0=t,this._y0=i,this._x1=n,this._y1=o,this}function qg(){var r=[];return this.visit(function(e){if(!e.length)do r.push(e.data);while(e=e.next)}),r}function e0(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 yt(r,e,t,i,n){this.node=r,this.x0=e,this.y0=t,this.x1=i,this.y1=n}function t0(r,e,t){var i,n=this._x0,o=this._y0,a,c,h,d,m=this._x1,f=this._y1,g=[],v=this._root,w,b;for(v&&g.push(new yt(v,n,o,m,f)),t==null?t=1/0:(n=r-t,o=e-t,m=r+t,f=e+t,t*=t);w=g.pop();)if(!(!(v=w.node)||(a=w.x0)>m||(c=w.y0)>f||(h=w.x1)<n||(d=w.y1)<o))if(v.length){var x=(a+h)/2,L=(c+d)/2;g.push(new yt(v[3],x,L,h,d),new yt(v[2],a,L,x,d),new yt(v[1],x,c,h,L),new yt(v[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,v.data),C=e-+this._y.call(null,v.data),W=M*M+C*C;if(W<t){var z=Math.sqrt(t=W);n=r-z,o=e-z,m=r+z,f=e+z,i=v.data}}return i}function i0(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,o,a=this._x0,c=this._y0,h=this._x1,d=this._y1,m,f,g,v,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>=(v=(c+d)/2))?c=v:d=v,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(o=t.next)&&delete t.next,n?(o?n.next=o:delete n.next,this):e?(o?e[x]=o: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=o,this)}function n0(r){for(var e=0,t=r.length;e<t;++e)this.remove(r[e]);return this}function r0(){return this._root}function s0(){var r=0;return this.visit(function(e){if(!e.length)do++r;while(e=e.next)}),r}function o0(r){var e=[],t,i=this._root,n,o,a,c,h;for(i&&e.push(new yt(i,this._x0,this._y0,this._x1,this._y1));t=e.pop();)if(!r(i=t.node,o=t.x0,a=t.y0,c=t.x1,h=t.y1)&&i.length){var d=(o+c)/2,m=(a+h)/2;(n=i[3])&&e.push(new yt(n,d,m,c,h)),(n=i[2])&&e.push(new yt(n,o,m,d,h)),(n=i[1])&&e.push(new yt(n,d,a,c,m)),(n=i[0])&&e.push(new yt(n,o,a,d,m))}return this}function a0(r){var e=[],t=[],i;for(this._root&&e.push(new yt(this._root,this._x0,this._y0,this._x1,this._y1));i=e.pop();){var n=i.node;if(n.length){var o,a=i.x0,c=i.y0,h=i.x1,d=i.y1,m=(a+h)/2,f=(c+d)/2;(o=n[0])&&e.push(new yt(o,a,c,m,f)),(o=n[1])&&e.push(new yt(o,m,c,h,f)),(o=n[2])&&e.push(new yt(o,a,f,m,d)),(o=n[3])&&e.push(new yt(o,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 l0(r){return r[0]}function c0(r){return arguments.length?(this._x=r,this):this._x}function h0(r){return r[1]}function u0(r){return arguments.length?(this._y=r,this):this._y}function jc(r,e,t){var i=new ea(e??l0,t??h0,NaN,NaN,NaN,NaN);return r==null?i:i.addAll(r)}function ea(r,e,t,i,n,o){this._x=r,this._y=e,this._x0=t,this._y0=i,this._x1=n,this._y1=o,this._root=void 0}function Jc(r){for(var e={data:r.data},t=e;r=r.next;)t=t.next={data:r.data};return e}var vt=jc.prototype=ea.prototype;vt.copy=function(){var r=new ea(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=Jc(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]=Jc(i));return r},vt.add=Hg,vt.addAll=Eg,vt.cover=$g,vt.data=qg,vt.extent=e0,vt.find=t0,vt.remove=i0,vt.removeAll=n0,vt.root=r0,vt.size=s0,vt.visit=o0,vt.visitAfter=a0,vt.x=c0,vt.y=u0;var d0=Object.defineProperty,f0=(r,e,t)=>e in r?d0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Qc=(r,e,t)=>f0(r,typeof e!="symbol"?e+"":e,t);class Hc{constructor(e){Qc(this,"_quadtree"),Qc(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,o,a,c,h)=>this._checkNodeCollision(i,o,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=jc().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,o){const a=(t+n)/2,c=(i+o)/2,h=n-t,d=o-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 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 g0{constructor(){Ec(this,"_strategies",new Map),Ec(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:yi.NO_COLLISION,collidedWith:[],timestamp:t.timestamp})});for(const n of this._executionOrder){const o=this._strategies.get(n);if(o?.enabled)try{const a=await o.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 y0=Object.defineProperty,v0=(r,e,t)=>e in r?y0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,_n=(r,e,t)=>v0(r,typeof e!="symbol"?e+"":e,t);class _0{constructor(){_n(this,"frameStats",new Map),_n(this,"summaryStats",{totalFrames:0,averageFrameTime:0,averageFPS:0,minFrameTime:1/0,maxFrameTime:0,totalFeaturesProcessed:0}),_n(this,"sampleWindowSize",60),_n(this,"currentFrameId",0),_n(this,"lastReportTime",0),_n(this,"reportInterval",5e3),_n(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,o)=>n+o,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,o)=>{t.has(o)||t.set(o,[]),t.get(o).push(n)})}),Array.from(t.entries()).map(([i,n])=>({name:i,averageTime:n.reduce((o,a)=>o+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 o=i.map(a=>a.memoryUsage).filter(a=>a>0);if(o.length>0){const a=o.reduce((c,h)=>c+h,0)/o.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 w0=Object.defineProperty,b0=(r,e,t)=>e in r?w0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ys=(r,e,t)=>b0(r,typeof e!="symbol"?e+"":e,t);class x0{constructor(){ys(this,"name","priority"),ys(this,"enabled",!0),ys(this,"weight",1),ys(this,"description","Priority-based avoidance strategy, smaller value means higher priority 基于优先级的避让策略,数值越小优先级越高")}async execute(e,t,i){const n=[],o=new Hc(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=o.findCollisions(h);d.length===0?(o.addBoxes([h]),n.push({featureId:h.featureId,visible:!0,reason:yi.NO_COLLISION,collidedWith:[],timestamp:t.timestamp})):d.some(f=>f.priority<h.priority)?n.push({featureId:h.featureId,visible:!1,reason:yi.PRIORITY_LOST,collidedWith:d.map(f=>f.featureId),timestamp:t.timestamp}):(o.addBoxes([h]),n.push({featureId:h.featureId,visible:!0,reason:yi.NO_COLLISION,collidedWith:[],timestamp:t.timestamp}),d.forEach(f=>{n.push({featureId:f.featureId,visible:!1,reason:yi.PRIORITY_LOST,collidedWith:[h.featureId],timestamp:t.timestamp})}))}),n}}var M0=Object.defineProperty,S0=(r,e,t)=>e in r?M0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Yi=(r,e,t)=>S0(r,typeof e!="symbol"?e+"":e,t);class L0{constructor(e,t={}){this.renderer=e,Yi(this,"_quadTreeManager"),Yi(this,"_strategyOrchestrator"),Yi(this,"_performanceMonitor"),Yi(this,"_layers",new Set),Yi(this,"_config"),Yi(this,"_isUpdating",!1),Yi(this,"_lastUpdateTime",0),Yi(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 o=await this._strategyOrchestrator.executeStrategies(n,i);await this._applyCollisionResults(o,n),this._performanceMonitor.endFrame(this._frameCount,{featureCount:n.length,visibleCount:Array.from(o.values()).filter(a=>a.visible).length,hiddenCount:Array.from(o.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,yi.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 Hc(e),this._strategyOrchestrator=new g0,this._performanceMonitor=new _0,this._strategyOrchestrator.registerStrategy(new x0,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 ut);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 o=e.get(n._id);return o&&n.setCollisionVisibility(o.visible,o.reason),Promise.resolve()});await Promise.all(i)}_setupViewportResizeHandler(){new ResizeObserver(t=>{t.forEach(i=>{const{width:n,height:o}=i.contentRect;this._quadTreeManager.updateViewport({width:n,height:o})})}).observe(this.renderer.domElement)}_setupPerformanceMonitoring(){setInterval(()=>{const e=this.getPerformanceStats();e.frameRate<30&&console.warn("避让系统性能警告:",e)},5e3)}}var Pr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},vs={exports:{}};vs.exports,function(r,e){(function(){var t,i="4.17.21",n=200,o="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,v=4,w=1,b=2,x=1,L=2,M=4,C=8,W=16,z=32,D=64,X=128,I=256,K=512,V=30,G="...",k=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,rt=[["ary",X],["bind",x],["bindKey",L],["curry",C],["curryRight",W],["flip",K],["partial",z],["partialRight",D],["rearg",I]],st="[object Arguments]",ft="[object Array]",He="[object AsyncFunction]",Re="[object Boolean]",je="[object Date]",ot="[object DOMException]",Xe="[object Error]",It="[object Function]",Bt="[object GeneratorFunction]",Ce="[object Map]",at="[object Number]",pt="[object Null]",Pt="[object Object]",bn="[object Promise]",Rn="[object Proxy]",xn="[object RegExp]",At="[object Set]",$i="[object String]",qi="[object Symbol]",Mn="[object Undefined]",Sn="[object WeakMap]",xa="[object WeakSet]",en="[object ArrayBuffer]",wi="[object DataView]",Ir="[object Float32Array]",Ar="[object Float64Array]",jn="[object Int8Array]",Fr="[object Int16Array]",Or="[object Int32Array]",Jn="[object Uint8Array]",Ln="[object Uint8ClampedArray]",O="[object Uint16Array]",E="[object Uint32Array]",ce=/\b__p \+= '';/g,Me=/\b(__p \+=) '' \+/g,Ye=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Yt=/&(?:amp|lt|gt|quot|#39);/g,si=/[&<>"']/g,Fh=RegExp(Yt.source),Ws=RegExp(si.source),oi=/<%-([\s\S]+?)%>/g,ai=/<%([\s\S]+?)%>/g,tn=/<%=([\s\S]+?)%>/g,Pn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Cn=/^\w*$/,Qn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ma=/[\\^$.*+?()[\]{}|]/g,gw=RegExp(Ma.source),Sa=/^\s+/,yw=/\s/,vw=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,_w=/\{\n\/\* \[wrapped with (.+)\] \*/,ww=/,? & /,bw=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,xw=/[()=,{}\[\]\/\s]/,Mw=/\\(\\)?/g,Sw=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Oh=/\w*$/,Lw=/^[-+]0x[0-9a-f]+$/i,Pw=/^0b[01]+$/i,Cw=/^\[object .+?Constructor\]$/,Tw=/^0o[0-7]+$/i,Gw=/^(?:0|[1-9]\d*)$/,Ww=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Zs=/($^)/,Zw=/['\n\r\u2028\u2029\\]/g,Vs="\\ud800-\\udfff",Vw="\\u0300-\\u036f",Iw="\\ufe20-\\ufe2f",Aw="\\u20d0-\\u20ff",Dh=Vw+Iw+Aw,zh="\\u2700-\\u27bf",Xh="a-z\\xdf-\\xf6\\xf8-\\xff",Fw="\\xac\\xb1\\xd7\\xf7",Ow="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Dw="\\u2000-\\u206f",zw=" \\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",Uh="A-Z\\xc0-\\xd6\\xd8-\\xde",kh="\\ufe0e\\ufe0f",Kh=Fw+Ow+Dw+zw,La="['’]",Xw="["+Vs+"]",Nh="["+Kh+"]",Is="["+Dh+"]",Bh="\\d+",Uw="["+zh+"]",Yh="["+Xh+"]",Rh="[^"+Vs+Kh+Bh+zh+Xh+Uh+"]",Pa="\\ud83c[\\udffb-\\udfff]",kw="(?:"+Is+"|"+Pa+")",jh="[^"+Vs+"]",Ca="(?:\\ud83c[\\udde6-\\uddff]){2}",Ta="[\\ud800-\\udbff][\\udc00-\\udfff]",Hn="["+Uh+"]",Jh="\\u200d",Qh="(?:"+Yh+"|"+Rh+")",Kw="(?:"+Hn+"|"+Rh+")",Hh="(?:"+La+"(?:d|ll|m|re|s|t|ve))?",Eh="(?:"+La+"(?:D|LL|M|RE|S|T|VE))?",$h=kw+"?",qh="["+kh+"]?",Nw="(?:"+Jh+"(?:"+[jh,Ca,Ta].join("|")+")"+qh+$h+")*",Bw="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Yw="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",eu=qh+$h+Nw,Rw="(?:"+[Uw,Ca,Ta].join("|")+")"+eu,jw="(?:"+[jh+Is+"?",Is,Ca,Ta,Xw].join("|")+")",Jw=RegExp(La,"g"),Qw=RegExp(Is,"g"),Ga=RegExp(Pa+"(?="+Pa+")|"+jw+eu,"g"),Hw=RegExp([Hn+"?"+Yh+"+"+Hh+"(?="+[Nh,Hn,"$"].join("|")+")",Kw+"+"+Eh+"(?="+[Nh,Hn+Qh,"$"].join("|")+")",Hn+"?"+Qh+"+"+Hh,Hn+"+"+Eh,Yw,Bw,Bh,Rw].join("|"),"g"),Ew=RegExp("["+Jh+Vs+Dh+kh+"]"),$w=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,qw=["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"],eb=-1,Ie={};Ie[Ir]=Ie[Ar]=Ie[jn]=Ie[Fr]=Ie[Or]=Ie[Jn]=Ie[Ln]=Ie[O]=Ie[E]=!0,Ie[st]=Ie[ft]=Ie[en]=Ie[Re]=Ie[wi]=Ie[je]=Ie[Xe]=Ie[It]=Ie[Ce]=Ie[at]=Ie[Pt]=Ie[xn]=Ie[At]=Ie[$i]=Ie[Sn]=!1;var We={};We[st]=We[ft]=We[en]=We[wi]=We[Re]=We[je]=We[Ir]=We[Ar]=We[jn]=We[Fr]=We[Or]=We[Ce]=We[at]=We[Pt]=We[xn]=We[At]=We[$i]=We[qi]=We[Jn]=We[Ln]=We[O]=We[E]=!0,We[Xe]=We[It]=We[Sn]=!1;var tb={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"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"},ib={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},nb={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},rb={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},sb=parseFloat,ob=parseInt,tu=typeof Pr=="object"&&Pr&&Pr.Object===Object&&Pr,ab=typeof self=="object"&&self&&self.Object===Object&&self,lt=tu||ab||Function("return this")(),Wa=e&&!e.nodeType&&e,Tn=Wa&&!0&&r&&!r.nodeType&&r,iu=Tn&&Tn.exports===Wa,Za=iu&&tu.process,Rt=function(){try{var A=Tn&&Tn.require&&Tn.require("util").types;return A||Za&&Za.binding&&Za.binding("util")}catch{}}(),nu=Rt&&Rt.isArrayBuffer,ru=Rt&&Rt.isDate,su=Rt&&Rt.isMap,ou=Rt&&Rt.isRegExp,au=Rt&&Rt.isSet,lu=Rt&&Rt.isTypedArray;function Ft(A,N,U){switch(U.length){case 0:return A.call(N);case 1:return A.call(N,U[0]);case 2:return A.call(N,U[0],U[1]);case 3:return A.call(N,U[0],U[1],U[2])}return A.apply(N,U)}function lb(A,N,U,ee){for(var he=-1,Le=A==null?0:A.length;++he<Le;){var Je=A[he];N(ee,Je,U(Je),A)}return ee}function jt(A,N){for(var U=-1,ee=A==null?0:A.length;++U<ee&&N(A[U],U,A)!==!1;);return A}function cb(A,N){for(var U=A==null?0:A.length;U--&&N(A[U],U,A)!==!1;);return A}function cu(A,N){for(var U=-1,ee=A==null?0:A.length;++U<ee;)if(!N(A[U],U,A))return!1;return!0}function nn(A,N){for(var U=-1,ee=A==null?0:A.length,he=0,Le=[];++U<ee;){var Je=A[U];N(Je,U,A)&&(Le[he++]=Je)}return Le}function As(A,N){var U=A==null?0:A.length;return!!U&&En(A,N,0)>-1}function Va(A,N,U){for(var ee=-1,he=A==null?0:A.length;++ee<he;)if(U(N,A[ee]))return!0;return!1}function Fe(A,N){for(var U=-1,ee=A==null?0:A.length,he=Array(ee);++U<ee;)he[U]=N(A[U],U,A);return he}function rn(A,N){for(var U=-1,ee=N.length,he=A.length;++U<ee;)A[he+U]=N[U];return A}function Ia(A,N,U,ee){var he=-1,Le=A==null?0:A.length;for(ee&&Le&&(U=A[++he]);++he<Le;)U=N(U,A[he],he,A);return U}function hb(A,N,U,ee){var he=A==null?0:A.length;for(ee&&he&&(U=A[--he]);he--;)U=N(U,A[he],he,A);return U}function Aa(A,N){for(var U=-1,ee=A==null?0:A.length;++U<ee;)if(N(A[U],U,A))return!0;return!1}var ub=Fa("length");function db(A){return A.split("")}function fb(A){return A.match(bw)||[]}function hu(A,N,U){var ee;return U(A,function(he,Le,Je){if(N(he,Le,Je))return ee=Le,!1}),ee}function Fs(A,N,U,ee){for(var he=A.length,Le=U+(ee?1:-1);ee?Le--:++Le<he;)if(N(A[Le],Le,A))return Le;return-1}function En(A,N,U){return N===N?Lb(A,N,U):Fs(A,uu,U)}function pb(A,N,U,ee){for(var he=U-1,Le=A.length;++he<Le;)if(ee(A[he],N))return he;return-1}function uu(A){return A!==A}function du(A,N){var U=A==null?0:A.length;return U?Da(A,N)/U:de}function Fa(A){return function(N){return N==null?t:N[A]}}function Oa(A){return function(N){return A==null?t:A[N]}}function fu(A,N,U,ee,he){return he(A,function(Le,Je,Ge){U=ee?(ee=!1,Le):N(U,Le,Je,Ge)}),U}function mb(A,N){var U=A.length;for(A.sort(N);U--;)A[U]=A[U].value;return A}function Da(A,N){for(var U,ee=-1,he=A.length;++ee<he;){var Le=N(A[ee]);Le!==t&&(U=U===t?Le:U+Le)}return U}function za(A,N){for(var U=-1,ee=Array(A);++U<A;)ee[U]=N(U);return ee}function gb(A,N){return Fe(N,function(U){return[U,A[U]]})}function pu(A){return A&&A.slice(0,vu(A)+1).replace(Sa,"")}function Ot(A){return function(N){return A(N)}}function Xa(A,N){return Fe(N,function(U){return A[U]})}function Dr(A,N){return A.has(N)}function mu(A,N){for(var U=-1,ee=A.length;++U<ee&&En(N,A[U],0)>-1;);return U}function gu(A,N){for(var U=A.length;U--&&En(N,A[U],0)>-1;);return U}function yb(A,N){for(var U=A.length,ee=0;U--;)A[U]===N&&++ee;return ee}var vb=Oa(tb),_b=Oa(ib);function wb(A){return"\\"+rb[A]}function bb(A,N){return A==null?t:A[N]}function $n(A){return Ew.test(A)}function xb(A){return $w.test(A)}function Mb(A){for(var N,U=[];!(N=A.next()).done;)U.push(N.value);return U}function Ua(A){var N=-1,U=Array(A.size);return A.forEach(function(ee,he){U[++N]=[he,ee]}),U}function yu(A,N){return function(U){return A(N(U))}}function sn(A,N){for(var U=-1,ee=A.length,he=0,Le=[];++U<ee;){var Je=A[U];(Je===N||Je===m)&&(A[U]=m,Le[he++]=U)}return Le}function Os(A){var N=-1,U=Array(A.size);return A.forEach(function(ee){U[++N]=ee}),U}function Sb(A){var N=-1,U=Array(A.size);return A.forEach(function(ee){U[++N]=[ee,ee]}),U}function Lb(A,N,U){for(var ee=U-1,he=A.length;++ee<he;)if(A[ee]===N)return ee;return-1}function Pb(A,N,U){for(var ee=U+1;ee--;)if(A[ee]===N)return ee;return ee}function qn(A){return $n(A)?Tb(A):ub(A)}function li(A){return $n(A)?Gb(A):db(A)}function vu(A){for(var N=A.length;N--&&yw.test(A.charAt(N)););return N}var Cb=Oa(nb);function Tb(A){for(var N=Ga.lastIndex=0;Ga.test(A);)++N;return N}function Gb(A){return A.match(Ga)||[]}function Wb(A){return A.match(Hw)||[]}var Zb=function A(N){N=N==null?lt:er.defaults(lt.Object(),N,er.pick(lt,qw));var U=N.Array,ee=N.Date,he=N.Error,Le=N.Function,Je=N.Math,Ge=N.Object,ka=N.RegExp,Vb=N.String,Jt=N.TypeError,Ds=U.prototype,Ib=Le.prototype,tr=Ge.prototype,zs=N["__core-js_shared__"],Xs=Ib.toString,Te=tr.hasOwnProperty,Ab=0,_u=function(){var s=/[^.]+$/.exec(zs&&zs.keys&&zs.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}(),Us=tr.toString,Fb=Xs.call(Ge),Ob=lt._,Db=ka("^"+Xs.call(Te).replace(Ma,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ks=iu?N.Buffer:t,on=N.Symbol,Ks=N.Uint8Array,wu=ks?ks.allocUnsafe:t,Ns=yu(Ge.getPrototypeOf,Ge),bu=Ge.create,xu=tr.propertyIsEnumerable,Bs=Ds.splice,Mu=on?on.isConcatSpreadable:t,zr=on?on.iterator:t,Gn=on?on.toStringTag:t,Ys=function(){try{var s=An(Ge,"defineProperty");return s({},"",{}),s}catch{}}(),zb=N.clearTimeout!==lt.clearTimeout&&N.clearTimeout,Xb=ee&&ee.now!==lt.Date.now&&ee.now,Ub=N.setTimeout!==lt.setTimeout&&N.setTimeout,Rs=Je.ceil,js=Je.floor,Ka=Ge.getOwnPropertySymbols,kb=ks?ks.isBuffer:t,Su=N.isFinite,Kb=Ds.join,Nb=yu(Ge.keys,Ge),Qe=Je.max,mt=Je.min,Bb=ee.now,Yb=N.parseInt,Lu=Je.random,Rb=Ds.reverse,Na=An(N,"DataView"),Xr=An(N,"Map"),Ba=An(N,"Promise"),ir=An(N,"Set"),Ur=An(N,"WeakMap"),kr=An(Ge,"create"),Js=Ur&&new Ur,nr={},jb=Fn(Na),Jb=Fn(Xr),Qb=Fn(Ba),Hb=Fn(ir),Eb=Fn(Ur),Qs=on?on.prototype:t,Kr=Qs?Qs.valueOf:t,Pu=Qs?Qs.toString:t;function S(s){if(Ue(s)&&!ue(s)&&!(s instanceof be)){if(s instanceof Qt)return s;if(Te.call(s,"__wrapped__"))return Cd(s)}return new Qt(s)}var rr=function(){function s(){}return function(l){if(!Oe(l))return{};if(bu)return bu(l);s.prototype=l;var u=new s;return s.prototype=t,u}}();function Hs(){}function Qt(s,l){this.__wrapped__=s,this.__actions__=[],this.__chain__=!!l,this.__index__=0,this.__values__=t}S.templateSettings={escape:oi,evaluate:ai,interpolate:tn,variable:"",imports:{_:S}},S.prototype=Hs.prototype,S.prototype.constructor=S,Qt.prototype=rr(Hs.prototype),Qt.prototype.constructor=Qt;function be(s){this.__wrapped__=s,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=ge,this.__views__=[]}function $b(){var s=new be(this.__wrapped__);return s.__actions__=Ct(this.__actions__),s.__dir__=this.__dir__,s.__filtered__=this.__filtered__,s.__iteratees__=Ct(this.__iteratees__),s.__takeCount__=this.__takeCount__,s.__views__=Ct(this.__views__),s}function qb(){if(this.__filtered__){var s=new be(this);s.__dir__=-1,s.__filtered__=!0}else s=this.clone(),s.__dir__*=-1;return s}function e1(){var s=this.__wrapped__.value(),l=this.__dir__,u=ue(s),y=l<0,_=u?s.length:0,P=dx(0,_,this.__views__),T=P.start,Z=P.end,F=Z-T,B=y?Z:T-1,R=this.__iteratees__,J=R.length,$=0,te=mt(F,this.__takeCount__);if(!u||!y&&_==F&&te==F)return Hu(s,this.__actions__);var oe=[];e:for(;F--&&$<te;){B+=l;for(var me=-1,ae=s[B];++me<J;){var we=R[me],xe=we.iteratee,Xt=we.type,bt=xe(ae);if(Xt==H)ae=bt;else if(!bt){if(Xt==Y)continue e;break e}}oe[$++]=ae}return oe}be.prototype=rr(Hs.prototype),be.prototype.constructor=be;function Wn(s){var l=-1,u=s==null?0:s.length;for(this.clear();++l<u;){var y=s[l];this.set(y[0],y[1])}}function t1(){this.__data__=kr?kr(null):{},this.size=0}function i1(s){var l=this.has(s)&&delete this.__data__[s];return this.size-=l?1:0,l}function n1(s){var l=this.__data__;if(kr){var u=l[s];return u===h?t:u}return Te.call(l,s)?l[s]:t}function r1(s){var l=this.__data__;return kr?l[s]!==t:Te.call(l,s)}function s1(s,l){var u=this.__data__;return this.size+=this.has(s)?0:1,u[s]=kr&&l===t?h:l,this}Wn.prototype.clear=t1,Wn.prototype.delete=i1,Wn.prototype.get=n1,Wn.prototype.has=r1,Wn.prototype.set=s1;function Ti(s){var l=-1,u=s==null?0:s.length;for(this.clear();++l<u;){var y=s[l];this.set(y[0],y[1])}}function o1(){this.__data__=[],this.size=0}function a1(s){var l=this.__data__,u=Es(l,s);if(u<0)return!1;var y=l.length-1;return u==y?l.pop():Bs.call(l,u,1),--this.size,!0}function l1(s){var l=this.__data__,u=Es(l,s);return u<0?t:l[u][1]}function c1(s){return Es(this.__data__,s)>-1}function h1(s,l){var u=this.__data__,y=Es(u,s);return y<0?(++this.size,u.push([s,l])):u[y][1]=l,this}Ti.prototype.clear=o1,Ti.prototype.delete=a1,Ti.prototype.get=l1,Ti.prototype.has=c1,Ti.prototype.set=h1;function Gi(s){var l=-1,u=s==null?0:s.length;for(this.clear();++l<u;){var y=s[l];this.set(y[0],y[1])}}function u1(){this.size=0,this.__data__={hash:new Wn,map:new(Xr||Ti),string:new Wn}}function d1(s){var l=co(this,s).delete(s);return this.size-=l?1:0,l}function f1(s){return co(this,s).get(s)}function p1(s){return co(this,s).has(s)}function m1(s,l){var u=co(this,s),y=u.size;return u.set(s,l),this.size+=u.size==y?0:1,this}Gi.prototype.clear=u1,Gi.prototype.delete=d1,Gi.prototype.get=f1,Gi.prototype.has=p1,Gi.prototype.set=m1;function Zn(s){var l=-1,u=s==null?0:s.length;for(this.__data__=new Gi;++l<u;)this.add(s[l])}function g1(s){return this.__data__.set(s,h),this}function y1(s){return this.__data__.has(s)}Zn.prototype.add=Zn.prototype.push=g1,Zn.prototype.has=y1;function ci(s){var l=this.__data__=new Ti(s);this.size=l.size}function v1(){this.__data__=new Ti,this.size=0}function _1(s){var l=this.__data__,u=l.delete(s);return this.size=l.size,u}function w1(s){return this.__data__.get(s)}function b1(s){return this.__data__.has(s)}function x1(s,l){var u=this.__data__;if(u instanceof Ti){var y=u.__data__;if(!Xr||y.length<n-1)return y.push([s,l]),this.size=++u.size,this;u=this.__data__=new Gi(y)}return u.set(s,l),this.size=u.size,this}ci.prototype.clear=v1,ci.prototype.delete=_1,ci.prototype.get=w1,ci.prototype.has=b1,ci.prototype.set=x1;function Cu(s,l){var u=ue(s),y=!u&&On(s),_=!u&&!y&&un(s),P=!u&&!y&&!_&&lr(s),T=u||y||_||P,Z=T?za(s.length,Vb):[],F=Z.length;for(var B in s)(l||Te.call(s,B))&&!(T&&(B=="length"||_&&(B=="offset"||B=="parent")||P&&(B=="buffer"||B=="byteLength"||B=="byteOffset")||Ii(B,F)))&&Z.push(B);return Z}function Tu(s){var l=s.length;return l?s[tl(0,l-1)]:t}function M1(s,l){return ho(Ct(s),Vn(l,0,s.length))}function S1(s){return ho(Ct(s))}function Ya(s,l,u){(u!==t&&!hi(s[l],u)||u===t&&!(l in s))&&Wi(s,l,u)}function Nr(s,l,u){var y=s[l];(!(Te.call(s,l)&&hi(y,u))||u===t&&!(l in s))&&Wi(s,l,u)}function Es(s,l){for(var u=s.length;u--;)if(hi(s[u][0],l))return u;return-1}function L1(s,l,u,y){return an(s,function(_,P,T){l(y,_,u(_),T)}),y}function Gu(s,l){return s&&xi(l,Ee(l),s)}function P1(s,l){return s&&xi(l,Gt(l),s)}function Wi(s,l,u){l=="__proto__"&&Ys?Ys(s,l,{configurable:!0,enumerable:!0,value:u,writable:!0}):s[l]=u}function Ra(s,l){for(var u=-1,y=l.length,_=U(y),P=s==null;++u<y;)_[u]=P?t:Pl(s,l[u]);return _}function Vn(s,l,u){return s===s&&(u!==t&&(s=s<=u?s:u),l!==t&&(s=s>=l?s:l)),s}function Ht(s,l,u,y,_,P){var T,Z=l&f,F=l&g,B=l&v;if(u&&(T=_?u(s,y,_,P):u(s)),T!==t)return T;if(!Oe(s))return s;var R=ue(s);if(R){if(T=px(s),!Z)return Ct(s,T)}else{var J=gt(s),$=J==It||J==Bt;if(un(s))return qu(s,Z);if(J==Pt||J==st||$&&!_){if(T=F||$?{}:vd(s),!Z)return F?nx(s,P1(T,s)):ix(s,Gu(T,s))}else{if(!We[J])return _?s:{};T=mx(s,J,Z)}}P||(P=new ci);var te=P.get(s);if(te)return te;P.set(s,T),jd(s)?s.forEach(function(ae){T.add(Ht(ae,l,u,ae,s,P))}):Yd(s)&&s.forEach(function(ae,we){T.set(we,Ht(ae,l,u,we,s,P))});var oe=B?F?dl:ul:F?Gt:Ee,me=R?t:oe(s);return jt(me||s,function(ae,we){me&&(we=ae,ae=s[we]),Nr(T,we,Ht(ae,l,u,we,s,P))}),T}function C1(s){var l=Ee(s);return function(u){return Wu(u,s,l)}}function Wu(s,l,u){var y=u.length;if(s==null)return!y;for(s=Ge(s);y--;){var _=u[y],P=l[_],T=s[_];if(T===t&&!(_ in s)||!P(T))return!1}return!0}function Zu(s,l,u){if(typeof s!="function")throw new Jt(a);return Hr(function(){s.apply(t,u)},l)}function Br(s,l,u,y){var _=-1,P=As,T=!0,Z=s.length,F=[],B=l.length;if(!Z)return F;u&&(l=Fe(l,Ot(u))),y?(P=Va,T=!1):l.length>=n&&(P=Dr,T=!1,l=new Zn(l));e:for(;++_<Z;){var R=s[_],J=u==null?R:u(R);if(R=y||R!==0?R:0,T&&J===J){for(var $=B;$--;)if(l[$]===J)continue e;F.push(R)}else P(l,J,y)||F.push(R)}return F}var an=rd(bi),Vu=rd(Ja,!0);function T1(s,l){var u=!0;return an(s,function(y,_,P){return u=!!l(y,_,P),u}),u}function $s(s,l,u){for(var y=-1,_=s.length;++y<_;){var P=s[y],T=l(P);if(T!=null&&(Z===t?T===T&&!zt(T):u(T,Z)))var Z=T,F=P}return F}function G1(s,l,u,y){var _=s.length;for(u=pe(u),u<0&&(u=-u>_?0:_+u),y=y===t||y>_?_:pe(y),y<0&&(y+=_),y=u>y?0:Qd(y);u<y;)s[u++]=l;return s}function Iu(s,l){var u=[];return an(s,function(y,_,P){l(y,_,P)&&u.push(y)}),u}function ct(s,l,u,y,_){var P=-1,T=s.length;for(u||(u=yx),_||(_=[]);++P<T;){var Z=s[P];l>0&&u(Z)?l>1?ct(Z,l-1,u,y,_):rn(_,Z):y||(_[_.length]=Z)}return _}var ja=sd(),Au=sd(!0);function bi(s,l){return s&&ja(s,l,Ee)}function Ja(s,l){return s&&Au(s,l,Ee)}function qs(s,l){return nn(l,function(u){return Ai(s[u])})}function In(s,l){l=cn(l,s);for(var u=0,y=l.length;s!=null&&u<y;)s=s[Mi(l[u++])];return u&&u==y?s:t}function Fu(s,l,u){var y=l(s);return ue(s)?y:rn(y,u(s))}function _t(s){return s==null?s===t?Mn:pt:Gn&&Gn in Ge(s)?ux(s):Sx(s)}function Qa(s,l){return s>l}function W1(s,l){return s!=null&&Te.call(s,l)}function Z1(s,l){return s!=null&&l in Ge(s)}function V1(s,l,u){return s>=mt(l,u)&&s<Qe(l,u)}function Ha(s,l,u){for(var y=u?Va:As,_=s[0].length,P=s.length,T=P,Z=U(P),F=1/0,B=[];T--;){var R=s[T];T&&l&&(R=Fe(R,Ot(l))),F=mt(R.length,F),Z[T]=!u&&(l||_>=120&&R.length>=120)?new Zn(T&&R):t}R=s[0];var J=-1,$=Z[0];e:for(;++J<_&&B.length<F;){var te=R[J],oe=l?l(te):te;if(te=u||te!==0?te:0,!($?Dr($,oe):y(B,oe,u))){for(T=P;--T;){var me=Z[T];if(!(me?Dr(me,oe):y(s[T],oe,u)))continue e}$&&$.push(oe),B.push(te)}}return B}function I1(s,l,u,y){return bi(s,function(_,P,T){l(y,u(_),P,T)}),y}function Yr(s,l,u){l=cn(l,s),s=xd(s,l);var y=s==null?s:s[Mi($t(l))];return y==null?t:Ft(y,s,u)}function Ou(s){return Ue(s)&&_t(s)==st}function A1(s){return Ue(s)&&_t(s)==en}function F1(s){return Ue(s)&&_t(s)==je}function Rr(s,l,u,y,_){return s===l?!0:s==null||l==null||!Ue(s)&&!Ue(l)?s!==s&&l!==l:O1(s,l,u,y,Rr,_)}function O1(s,l,u,y,_,P){var T=ue(s),Z=ue(l),F=T?ft:gt(s),B=Z?ft:gt(l);F=F==st?Pt:F,B=B==st?Pt:B;var R=F==Pt,J=B==Pt,$=F==B;if($&&un(s)){if(!un(l))return!1;T=!0,R=!1}if($&&!R)return P||(P=new ci),T||lr(s)?md(s,l,u,y,_,P):cx(s,l,F,u,y,_,P);if(!(u&w)){var te=R&&Te.call(s,"__wrapped__"),oe=J&&Te.call(l,"__wrapped__");if(te||oe){var me=te?s.value():s,ae=oe?l.value():l;return P||(P=new ci),_(me,ae,u,y,P)}}return $?(P||(P=new ci),hx(s,l,u,y,_,P)):!1}function D1(s){return Ue(s)&&gt(s)==Ce}function Ea(s,l,u,y){var _=u.length,P=_,T=!y;if(s==null)return!P;for(s=Ge(s);_--;){var Z=u[_];if(T&&Z[2]?Z[1]!==s[Z[0]]:!(Z[0]in s))return!1}for(;++_<P;){Z=u[_];var F=Z[0],B=s[F],R=Z[1];if(T&&Z[2]){if(B===t&&!(F in s))return!1}else{var J=new ci;if(y)var $=y(B,R,F,s,l,J);if(!($===t?Rr(R,B,w|b,y,J):$))return!1}}return!0}function Du(s){if(!Oe(s)||_x(s))return!1;var l=Ai(s)?Db:Cw;return l.test(Fn(s))}function z1(s){return Ue(s)&&_t(s)==xn}function X1(s){return Ue(s)&&gt(s)==At}function U1(s){return Ue(s)&&yo(s.length)&&!!Ie[_t(s)]}function zu(s){return typeof s=="function"?s:s==null?Wt:typeof s=="object"?ue(s)?ku(s[0],s[1]):Uu(s):af(s)}function $a(s){if(!Qr(s))return Nb(s);var l=[];for(var u in Ge(s))Te.call(s,u)&&u!="constructor"&&l.push(u);return l}function k1(s){if(!Oe(s))return Mx(s);var l=Qr(s),u=[];for(var y in s)y=="constructor"&&(l||!Te.call(s,y))||u.push(y);return u}function qa(s,l){return s<l}function Xu(s,l){var u=-1,y=Tt(s)?U(s.length):[];return an(s,function(_,P,T){y[++u]=l(_,P,T)}),y}function Uu(s){var l=pl(s);return l.length==1&&l[0][2]?wd(l[0][0],l[0][1]):function(u){return u===s||Ea(u,s,l)}}function ku(s,l){return gl(s)&&_d(l)?wd(Mi(s),l):function(u){var y=Pl(u,s);return y===t&&y===l?Cl(u,s):Rr(l,y,w|b)}}function eo(s,l,u,y,_){s!==l&&ja(l,function(P,T){if(_||(_=new ci),Oe(P))K1(s,l,T,u,eo,y,_);else{var Z=y?y(vl(s,T),P,T+"",s,l,_):t;Z===t&&(Z=P),Ya(s,T,Z)}},Gt)}function K1(s,l,u,y,_,P,T){var Z=vl(s,u),F=vl(l,u),B=T.get(F);if(B){Ya(s,u,B);return}var R=P?P(Z,F,u+"",s,l,T):t,J=R===t;if(J){var $=ue(F),te=!$&&un(F),oe=!$&&!te&&lr(F);R=F,$||te||oe?ue(Z)?R=Z:Ke(Z)?R=Ct(Z):te?(J=!1,R=qu(F,!0)):oe?(J=!1,R=ed(F,!0)):R=[]:Er(F)||On(F)?(R=Z,On(Z)?R=Hd(Z):(!Oe(Z)||Ai(Z))&&(R=vd(F))):J=!1}J&&(T.set(F,R),_(R,F,y,P,T),T.delete(F)),Ya(s,u,R)}function Ku(s,l){var u=s.length;if(u)return l+=l<0?u:0,Ii(l,u)?s[l]:t}function Nu(s,l,u){l.length?l=Fe(l,function(P){return ue(P)?function(T){return In(T,P.length===1?P[0]:P)}:P}):l=[Wt];var y=-1;l=Fe(l,Ot(se()));var _=Xu(s,function(P,T,Z){var F=Fe(l,function(B){return B(P)});return{criteria:F,index:++y,value:P}});return mb(_,function(P,T){return tx(P,T,u)})}function N1(s,l){return Bu(s,l,function(u,y){return Cl(s,y)})}function Bu(s,l,u){for(var y=-1,_=l.length,P={};++y<_;){var T=l[y],Z=In(s,T);u(Z,T)&&jr(P,cn(T,s),Z)}return P}function B1(s){return function(l){return In(l,s)}}function el(s,l,u,y){var _=y?pb:En,P=-1,T=l.length,Z=s;for(s===l&&(l=Ct(l)),u&&(Z=Fe(s,Ot(u)));++P<T;)for(var F=0,B=l[P],R=u?u(B):B;(F=_(Z,R,F,y))>-1;)Z!==s&&Bs.call(Z,F,1),Bs.call(s,F,1);return s}function Yu(s,l){for(var u=s?l.length:0,y=u-1;u--;){var _=l[u];if(u==y||_!==P){var P=_;Ii(_)?Bs.call(s,_,1):rl(s,_)}}return s}function tl(s,l){return s+js(Lu()*(l-s+1))}function Y1(s,l,u,y){for(var _=-1,P=Qe(Rs((l-s)/(u||1)),0),T=U(P);P--;)T[y?P:++_]=s,s+=u;return T}function il(s,l){var u="";if(!s||l<1||l>ne)return u;do l%2&&(u+=s),l=js(l/2),l&&(s+=s);while(l);return u}function ye(s,l){return _l(bd(s,l,Wt),s+"")}function R1(s){return Tu(cr(s))}function j1(s,l){var u=cr(s);return ho(u,Vn(l,0,u.length))}function jr(s,l,u,y){if(!Oe(s))return s;l=cn(l,s);for(var _=-1,P=l.length,T=P-1,Z=s;Z!=null&&++_<P;){var F=Mi(l[_]),B=u;if(F==="__proto__"||F==="constructor"||F==="prototype")return s;if(_!=T){var R=Z[F];B=y?y(R,F,Z):t,B===t&&(B=Oe(R)?R:Ii(l[_+1])?[]:{})}Nr(Z,F,B),Z=Z[F]}return s}var Ru=Js?function(s,l){return Js.set(s,l),s}:Wt,J1=Ys?function(s,l){return Ys(s,"toString",{configurable:!0,enumerable:!1,value:Gl(l),writable:!0})}:Wt;function Q1(s){return ho(cr(s))}function Et(s,l,u){var y=-1,_=s.length;l<0&&(l=-l>_?0:_+l),u=u>_?_:u,u<0&&(u+=_),_=l>u?0:u-l>>>0,l>>>=0;for(var P=U(_);++y<_;)P[y]=s[y+l];return P}function H1(s,l){var u;return an(s,function(y,_,P){return u=l(y,_,P),!u}),!!u}function to(s,l,u){var y=0,_=s==null?y:s.length;if(typeof l=="number"&&l===l&&_<=Se){for(;y<_;){var P=y+_>>>1,T=s[P];T!==null&&!zt(T)&&(u?T<=l:T<l)?y=P+1:_=P}return _}return nl(s,l,Wt,u)}function nl(s,l,u,y){var _=0,P=s==null?0:s.length;if(P===0)return 0;l=u(l);for(var T=l!==l,Z=l===null,F=zt(l),B=l===t;_<P;){var R=js((_+P)/2),J=u(s[R]),$=J!==t,te=J===null,oe=J===J,me=zt(J);if(T)var ae=y||oe;else B?ae=oe&&(y||$):Z?ae=oe&&$&&(y||!te):F?ae=oe&&$&&!te&&(y||!me):te||me?ae=!1:ae=y?J<=l:J<l;ae?_=R+1:P=R}return mt(P,fe)}function ju(s,l){for(var u=-1,y=s.length,_=0,P=[];++u<y;){var T=s[u],Z=l?l(T):T;if(!u||!hi(Z,F)){var F=Z;P[_++]=T===0?0:T}}return P}function Ju(s){return typeof s=="number"?s:zt(s)?de:+s}function Dt(s){if(typeof s=="string")return s;if(ue(s))return Fe(s,Dt)+"";if(zt(s))return Pu?Pu.call(s):"";var l=s+"";return l=="0"&&1/s==-re?"-0":l}function ln(s,l,u){var y=-1,_=As,P=s.length,T=!0,Z=[],F=Z;if(u)T=!1,_=Va;else if(P>=n){var B=l?null:ax(s);if(B)return Os(B);T=!1,_=Dr,F=new Zn}else F=l?[]:Z;e:for(;++y<P;){var R=s[y],J=l?l(R):R;if(R=u||R!==0?R:0,T&&J===J){for(var $=F.length;$--;)if(F[$]===J)continue e;l&&F.push(J),Z.push(R)}else _(F,J,u)||(F!==Z&&F.push(J),Z.push(R))}return Z}function rl(s,l){return l=cn(l,s),s=xd(s,l),s==null||delete s[Mi($t(l))]}function Qu(s,l,u,y){return jr(s,l,u(In(s,l)),y)}function io(s,l,u,y){for(var _=s.length,P=y?_:-1;(y?P--:++P<_)&&l(s[P],P,s););return u?Et(s,y?0:P,y?P+1:_):Et(s,y?P+1:0,y?_:P)}function Hu(s,l){var u=s;return u instanceof be&&(u=u.value()),Ia(l,function(y,_){return _.func.apply(_.thisArg,rn([y],_.args))},u)}function sl(s,l,u){var y=s.length;if(y<2)return y?ln(s[0]):[];for(var _=-1,P=U(y);++_<y;)for(var T=s[_],Z=-1;++Z<y;)Z!=_&&(P[_]=Br(P[_]||T,s[Z],l,u));return ln(ct(P,1),l,u)}function Eu(s,l,u){for(var y=-1,_=s.length,P=l.length,T={};++y<_;){var Z=y<P?l[y]:t;u(T,s[y],Z)}return T}function ol(s){return Ke(s)?s:[]}function al(s){return typeof s=="function"?s:Wt}function cn(s,l){return ue(s)?s:gl(s,l)?[s]:Pd(Pe(s))}var E1=ye;function hn(s,l,u){var y=s.length;return u=u===t?y:u,!l&&u>=y?s:Et(s,l,u)}var $u=zb||function(s){return lt.clearTimeout(s)};function qu(s,l){if(l)return s.slice();var u=s.length,y=wu?wu(u):new s.constructor(u);return s.copy(y),y}function ll(s){var l=new s.constructor(s.byteLength);return new Ks(l).set(new Ks(s)),l}function $1(s,l){var u=l?ll(s.buffer):s.buffer;return new s.constructor(u,s.byteOffset,s.byteLength)}function q1(s){var l=new s.constructor(s.source,Oh.exec(s));return l.lastIndex=s.lastIndex,l}function ex(s){return Kr?Ge(Kr.call(s)):{}}function ed(s,l){var u=l?ll(s.buffer):s.buffer;return new s.constructor(u,s.byteOffset,s.length)}function td(s,l){if(s!==l){var u=s!==t,y=s===null,_=s===s,P=zt(s),T=l!==t,Z=l===null,F=l===l,B=zt(l);if(!Z&&!B&&!P&&s>l||P&&T&&F&&!Z&&!B||y&&T&&F||!u&&F||!_)return 1;if(!y&&!P&&!B&&s<l||B&&u&&_&&!y&&!P||Z&&u&&_||!T&&_||!F)return-1}return 0}function tx(s,l,u){for(var y=-1,_=s.criteria,P=l.criteria,T=_.length,Z=u.length;++y<T;){var F=td(_[y],P[y]);if(F){if(y>=Z)return F;var B=u[y];return F*(B=="desc"?-1:1)}}return s.index-l.index}function id(s,l,u,y){for(var _=-1,P=s.length,T=u.length,Z=-1,F=l.length,B=Qe(P-T,0),R=U(F+B),J=!y;++Z<F;)R[Z]=l[Z];for(;++_<T;)(J||_<P)&&(R[u[_]]=s[_]);for(;B--;)R[Z++]=s[_++];return R}function nd(s,l,u,y){for(var _=-1,P=s.length,T=-1,Z=u.length,F=-1,B=l.length,R=Qe(P-Z,0),J=U(R+B),$=!y;++_<R;)J[_]=s[_];for(var te=_;++F<B;)J[te+F]=l[F];for(;++T<Z;)($||_<P)&&(J[te+u[T]]=s[_++]);return J}function Ct(s,l){var u=-1,y=s.length;for(l||(l=U(y));++u<y;)l[u]=s[u];return l}function xi(s,l,u,y){var _=!u;u||(u={});for(var P=-1,T=l.length;++P<T;){var Z=l[P],F=y?y(u[Z],s[Z],Z,u,s):t;F===t&&(F=s[Z]),_?Wi(u,Z,F):Nr(u,Z,F)}return u}function ix(s,l){return xi(s,ml(s),l)}function nx(s,l){return xi(s,gd(s),l)}function no(s,l){return function(u,y){var _=ue(u)?lb:L1,P=l?l():{};return _(u,s,se(y,2),P)}}function sr(s){return ye(function(l,u){var y=-1,_=u.length,P=_>1?u[_-1]:t,T=_>2?u[2]:t;for(P=s.length>3&&typeof P=="function"?(_--,P):t,T&&wt(u[0],u[1],T)&&(P=_<3?t:P,_=1),l=Ge(l);++y<_;){var Z=u[y];Z&&s(l,Z,y,P)}return l})}function rd(s,l){return function(u,y){if(u==null)return u;if(!Tt(u))return s(u,y);for(var _=u.length,P=l?_:-1,T=Ge(u);(l?P--:++P<_)&&y(T[P],P,T)!==!1;);return u}}function sd(s){return function(l,u,y){for(var _=-1,P=Ge(l),T=y(l),Z=T.length;Z--;){var F=T[s?Z:++_];if(u(P[F],F,P)===!1)break}return l}}function rx(s,l,u){var y=l&x,_=Jr(s);function P(){var T=this&&this!==lt&&this instanceof P?_:s;return T.apply(y?u:this,arguments)}return P}function od(s){return function(l){l=Pe(l);var u=$n(l)?li(l):t,y=u?u[0]:l.charAt(0),_=u?hn(u,1).join(""):l.slice(1);return y[s]()+_}}function or(s){return function(l){return Ia(sf(rf(l).replace(Jw,"")),s,"")}}function Jr(s){return function(){var l=arguments;switch(l.length){case 0:return new s;case 1:return new s(l[0]);case 2:return new s(l[0],l[1]);case 3:return new s(l[0],l[1],l[2]);case 4:return new s(l[0],l[1],l[2],l[3]);case 5:return new s(l[0],l[1],l[2],l[3],l[4]);case 6:return new s(l[0],l[1],l[2],l[3],l[4],l[5]);case 7:return new s(l[0],l[1],l[2],l[3],l[4],l[5],l[6])}var u=rr(s.prototype),y=s.apply(u,l);return Oe(y)?y:u}}function sx(s,l,u){var y=Jr(s);function _(){for(var P=arguments.length,T=U(P),Z=P,F=ar(_);Z--;)T[Z]=arguments[Z];var B=P<3&&T[0]!==F&&T[P-1]!==F?[]:sn(T,F);if(P-=B.length,P<u)return ud(s,l,ro,_.placeholder,t,T,B,t,t,u-P);var R=this&&this!==lt&&this instanceof _?y:s;return Ft(R,this,T)}return _}function ad(s){return function(l,u,y){var _=Ge(l);if(!Tt(l)){var P=se(u,3);l=Ee(l),u=function(Z){return P(_[Z],Z,_)}}var T=s(l,u,y);return T>-1?_[P?l[T]:T]:t}}function ld(s){return Vi(function(l){var u=l.length,y=u,_=Qt.prototype.thru;for(s&&l.reverse();y--;){var P=l[y];if(typeof P!="function")throw new Jt(a);if(_&&!T&&lo(P)=="wrapper")var T=new Qt([],!0)}for(y=T?y:u;++y<u;){P=l[y];var Z=lo(P),F=Z=="wrapper"?fl(P):t;F&&yl(F[0])&&F[1]==(X|C|z|I)&&!F[4].length&&F[9]==1?T=T[lo(F[0])].apply(T,F[3]):T=P.length==1&&yl(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,$=u?l[J].apply(this,B):R;++J<u;)$=l[J].call(this,$);return $}})}function ro(s,l,u,y,_,P,T,Z,F,B){var R=l&X,J=l&x,$=l&L,te=l&(C|W),oe=l&K,me=$?t:Jr(s);function ae(){for(var we=arguments.length,xe=U(we),Xt=we;Xt--;)xe[Xt]=arguments[Xt];if(te)var bt=ar(ae),Ut=yb(xe,bt);if(y&&(xe=id(xe,y,_,te)),P&&(xe=nd(xe,P,T,te)),we-=Ut,te&&we<B){var Ne=sn(xe,bt);return ud(s,l,ro,ae.placeholder,u,xe,Ne,Z,F,B-we)}var ui=J?u:this,Oi=$?ui[s]:s;return we=xe.length,Z?xe=Lx(xe,Z):oe&&we>1&&xe.reverse(),R&&F<we&&(xe.length=F),this&&this!==lt&&this instanceof ae&&(Oi=me||Jr(Oi)),Oi.apply(ui,xe)}return ae}function cd(s,l){return function(u,y){return I1(u,s,l(y),{})}}function so(s,l){return function(u,y){var _;if(u===t&&y===t)return l;if(u!==t&&(_=u),y!==t){if(_===t)return y;typeof u=="string"||typeof y=="string"?(u=Dt(u),y=Dt(y)):(u=Ju(u),y=Ju(y)),_=s(u,y)}return _}}function cl(s){return Vi(function(l){return l=Fe(l,Ot(se())),ye(function(u){var y=this;return s(l,function(_){return Ft(_,y,u)})})})}function oo(s,l){l=l===t?" ":Dt(l);var u=l.length;if(u<2)return u?il(l,s):l;var y=il(l,Rs(s/qn(l)));return $n(l)?hn(li(y),0,s).join(""):y.slice(0,s)}function ox(s,l,u,y){var _=l&x,P=Jr(s);function T(){for(var Z=-1,F=arguments.length,B=-1,R=y.length,J=U(R+F),$=this&&this!==lt&&this instanceof T?P:s;++B<R;)J[B]=y[B];for(;F--;)J[B++]=arguments[++Z];return Ft($,_?u:this,J)}return T}function hd(s){return function(l,u,y){return y&&typeof y!="number"&&wt(l,u,y)&&(u=y=t),l=Fi(l),u===t?(u=l,l=0):u=Fi(u),y=y===t?l<u?1:-1:Fi(y),Y1(l,u,y,s)}}function ao(s){return function(l,u){return typeof l=="string"&&typeof u=="string"||(l=qt(l),u=qt(u)),s(l,u)}}function ud(s,l,u,y,_,P,T,Z,F,B){var R=l&C,J=R?T:t,$=R?t:T,te=R?P:t,oe=R?t:P;l|=R?z:D,l&=~(R?D:z),l&M||(l&=-4);var me=[s,l,_,te,J,oe,$,Z,F,B],ae=u.apply(t,me);return yl(s)&&Md(ae,me),ae.placeholder=y,Sd(ae,s,l)}function hl(s){var l=Je[s];return function(u,y){if(u=qt(u),y=y==null?0:mt(pe(y),292),y&&Su(u)){var _=(Pe(u)+"e").split("e"),P=l(_[0]+"e"+(+_[1]+y));return _=(Pe(P)+"e").split("e"),+(_[0]+"e"+(+_[1]-y))}return l(u)}}var ax=ir&&1/Os(new ir([,-0]))[1]==re?function(s){return new ir(s)}:Vl;function dd(s){return function(l){var u=gt(l);return u==Ce?Ua(l):u==At?Sb(l):gb(l,s(l))}}function Zi(s,l,u,y,_,P,T,Z){var F=l&L;if(!F&&typeof s!="function")throw new Jt(a);var B=y?y.length:0;if(B||(l&=-97,y=_=t),T=T===t?T:Qe(pe(T),0),Z=Z===t?Z:pe(Z),B-=_?_.length:0,l&D){var R=y,J=_;y=_=t}var $=F?t:fl(s),te=[s,l,u,y,_,R,J,P,T,Z];if($&&xx(te,$),s=te[0],l=te[1],u=te[2],y=te[3],_=te[4],Z=te[9]=te[9]===t?F?0:s.length:Qe(te[9]-B,0),!Z&&l&(C|W)&&(l&=-25),!l||l==x)var oe=rx(s,l,u);else l==C||l==W?oe=sx(s,l,Z):(l==z||l==(x|z))&&!_.length?oe=ox(s,l,u,y):oe=ro.apply(t,te);var me=$?Ru:Md;return Sd(me(oe,te),s,l)}function fd(s,l,u,y){return s===t||hi(s,tr[u])&&!Te.call(y,u)?l:s}function pd(s,l,u,y,_,P){return Oe(s)&&Oe(l)&&(P.set(l,s),eo(s,l,t,pd,P),P.delete(l)),s}function lx(s){return Er(s)?t:s}function md(s,l,u,y,_,P){var T=u&w,Z=s.length,F=l.length;if(Z!=F&&!(T&&F>Z))return!1;var B=P.get(s),R=P.get(l);if(B&&R)return B==l&&R==s;var J=-1,$=!0,te=u&b?new Zn:t;for(P.set(s,l),P.set(l,s);++J<Z;){var oe=s[J],me=l[J];if(y)var ae=T?y(me,oe,J,l,s,P):y(oe,me,J,s,l,P);if(ae!==t){if(ae)continue;$=!1;break}if(te){if(!Aa(l,function(we,xe){if(!Dr(te,xe)&&(oe===we||_(oe,we,u,y,P)))return te.push(xe)})){$=!1;break}}else if(!(oe===me||_(oe,me,u,y,P))){$=!1;break}}return P.delete(s),P.delete(l),$}function cx(s,l,u,y,_,P,T){switch(u){case wi:if(s.byteLength!=l.byteLength||s.byteOffset!=l.byteOffset)return!1;s=s.buffer,l=l.buffer;case en:return!(s.byteLength!=l.byteLength||!P(new Ks(s),new Ks(l)));case Re:case je:case at:return hi(+s,+l);case Xe:return s.name==l.name&&s.message==l.message;case xn:case $i:return s==l+"";case Ce:var Z=Ua;case At:var F=y&w;if(Z||(Z=Os),s.size!=l.size&&!F)return!1;var B=T.get(s);if(B)return B==l;y|=b,T.set(s,l);var R=md(Z(s),Z(l),y,_,P,T);return T.delete(s),R;case qi:if(Kr)return Kr.call(s)==Kr.call(l)}return!1}function hx(s,l,u,y,_,P){var T=u&w,Z=ul(s),F=Z.length,B=ul(l),R=B.length;if(F!=R&&!T)return!1;for(var J=F;J--;){var $=Z[J];if(!(T?$ in l:Te.call(l,$)))return!1}var te=P.get(s),oe=P.get(l);if(te&&oe)return te==l&&oe==s;var me=!0;P.set(s,l),P.set(l,s);for(var ae=T;++J<F;){$=Z[J];var we=s[$],xe=l[$];if(y)var Xt=T?y(xe,we,$,l,s,P):y(we,xe,$,s,l,P);if(!(Xt===t?we===xe||_(we,xe,u,y,P):Xt)){me=!1;break}ae||(ae=$=="constructor")}if(me&&!ae){var bt=s.constructor,Ut=l.constructor;bt!=Ut&&"constructor"in s&&"constructor"in l&&!(typeof bt=="function"&&bt instanceof bt&&typeof Ut=="function"&&Ut instanceof Ut)&&(me=!1)}return P.delete(s),P.delete(l),me}function Vi(s){return _l(bd(s,t,Wd),s+"")}function ul(s){return Fu(s,Ee,ml)}function dl(s){return Fu(s,Gt,gd)}var fl=Js?function(s){return Js.get(s)}:Vl;function lo(s){for(var l=s.name+"",u=nr[l],y=Te.call(nr,l)?u.length:0;y--;){var _=u[y],P=_.func;if(P==null||P==s)return _.name}return l}function ar(s){var l=Te.call(S,"placeholder")?S:s;return l.placeholder}function se(){var s=S.iteratee||Wl;return s=s===Wl?zu:s,arguments.length?s(arguments[0],arguments[1]):s}function co(s,l){var u=s.__data__;return vx(l)?u[typeof l=="string"?"string":"hash"]:u.map}function pl(s){for(var l=Ee(s),u=l.length;u--;){var y=l[u],_=s[y];l[u]=[y,_,_d(_)]}return l}function An(s,l){var u=bb(s,l);return Du(u)?u:t}function ux(s){var l=Te.call(s,Gn),u=s[Gn];try{s[Gn]=t;var y=!0}catch{}var _=Us.call(s);return y&&(l?s[Gn]=u:delete s[Gn]),_}var ml=Ka?function(s){return s==null?[]:(s=Ge(s),nn(Ka(s),function(l){return xu.call(s,l)}))}:Il,gd=Ka?function(s){for(var l=[];s;)rn(l,ml(s)),s=Ns(s);return l}:Il,gt=_t;(Na&&gt(new Na(new ArrayBuffer(1)))!=wi||Xr&&gt(new Xr)!=Ce||Ba&&gt(Ba.resolve())!=bn||ir&&gt(new ir)!=At||Ur&&gt(new Ur)!=Sn)&&(gt=function(s){var l=_t(s),u=l==Pt?s.constructor:t,y=u?Fn(u):"";if(y)switch(y){case jb:return wi;case Jb:return Ce;case Qb:return bn;case Hb:return At;case Eb:return Sn}return l});function dx(s,l,u){for(var y=-1,_=u.length;++y<_;){var P=u[y],T=P.size;switch(P.type){case"drop":s+=T;break;case"dropRight":l-=T;break;case"take":l=mt(l,s+T);break;case"takeRight":s=Qe(s,l-T);break}}return{start:s,end:l}}function fx(s){var l=s.match(_w);return l?l[1].split(ww):[]}function yd(s,l,u){l=cn(l,s);for(var y=-1,_=l.length,P=!1;++y<_;){var T=Mi(l[y]);if(!(P=s!=null&&u(s,T)))break;s=s[T]}return P||++y!=_?P:(_=s==null?0:s.length,!!_&&yo(_)&&Ii(T,_)&&(ue(s)||On(s)))}function px(s){var l=s.length,u=new s.constructor(l);return l&&typeof s[0]=="string"&&Te.call(s,"index")&&(u.index=s.index,u.input=s.input),u}function vd(s){return typeof s.constructor=="function"&&!Qr(s)?rr(Ns(s)):{}}function mx(s,l,u){var y=s.constructor;switch(l){case en:return ll(s);case Re:case je:return new y(+s);case wi:return $1(s,u);case Ir:case Ar:case jn:case Fr:case Or:case Jn:case Ln:case O:case E:return ed(s,u);case Ce:return new y;case at:case $i:return new y(s);case xn:return q1(s);case At:return new y;case qi:return ex(s)}}function gx(s,l){var u=l.length;if(!u)return s;var y=u-1;return l[y]=(u>1?"& ":"")+l[y],l=l.join(u>2?", ":" "),s.replace(vw,`{
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=>{i instanceof p.Mesh&&(Array.isArray(i.material)?i.material:[i.material]).forEach(o=>{t.color!==void 0&&o.color.set(t.color),t.opacity!==void 0&&(o.opacity=t.opacity,o.transparent=t.opacity<1),t.wireframe!==void 0&&(o.wireframe=t.wireframe),o.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(Dn._textureCache.has(e))return Dn._textureCache.get(e);const t=await new Promise((i,n)=>{Dn._textureLoader.load(e,i,void 0,n)});return t.needsUpdate=!0,Dn._textureCache.set(e,t),t}static create(e){return e instanceof Dn?e:new Dn(e)}};kc($o,"_textureCache",new Map),kc($o,"_textureLoader",new p.TextureLoader);let Mt=$o;const it=[];for(let r=0;r<256;++r)it.push((r+256).toString(16).slice(1));function Vg(r,e=0){return(it[r[e+0]]+it[r[e+1]]+it[r[e+2]]+it[r[e+3]]+"-"+it[r[e+4]]+it[r[e+5]]+"-"+it[r[e+6]]+it[r[e+7]]+"-"+it[r[e+8]]+it[r[e+9]]+"-"+it[r[e+10]]+it[r[e+11]]+it[r[e+12]]+it[r[e+13]]+it[r[e+14]]+it[r[e+15]]).toLowerCase()}let qo;const Ig=new Uint8Array(16);function Ag(){if(!qo){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");qo=crypto.getRandomValues.bind(crypto)}return qo(Ig)}const Kc={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Fg(r,e,t){if(Kc.randomUUID&&!r)return Kc.randomUUID();r=r||{};const i=r.random??r.rng?.()??Ag();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,Vg(i)}var Nc=(r=>(r.POINT="point",r.LINE_VERTEX="line_vertex",r.POLYGON_CENTER="polygon_center",r.LABEL="label",r.ICON="icon",r.CLUSTER="cluster",r))(Nc||{}),yi=(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))(yi||{}),Og=Object.defineProperty,Dg=(r,e,t)=>e in r?Og(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Lr=(r,e,t)=>Dg(r,typeof e!="symbol"?e+"":e,t);class zg extends cs{constructor(){super(...arguments),Lr(this,"_isDragging",!1),Lr(this,"_lastCoord",null),Lr(this,"_boundOnMouseDown",this._onMouseDown.bind(this)),Lr(this,"_boundOnMouseMove",this._onMouseMove.bind(this)),Lr(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],o=n(i.coordinates);i.coordinates=o,this.target._onPositionChanged(!0)}}var Xg=Object.defineProperty,Ug=(r,e,t)=>e in r?Xg(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Zt=(r,e,t)=>Ug(r,typeof e!="symbol"?e+"":e,t);class ut extends jo(Ki(yn(p.Object3D))){constructor(e){super(),Zt(this,"_position"),Zt(this,"_threeGeometry"),Zt(this,"_geometry"),Zt(this,"_layer"),Zt(this,"_style"),Zt(this,"_id"),Zt(this,"_styleQueue",[]),Zt(this,"_isApplyingStyle",!1),Zt(this,"_isGeometryInitializing",!1),Zt(this,"_bloomConfig"),Zt(this,"_collisionState",{visible:!0,reason:yi.NO_COLLISION,collidedWith:[],timestamp:Date.now()}),Zt(this,"_collisionConfig",{enabled:!0,priority:50,padding:4,minZoom:0,maxZoom:24}),Zt(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=Fg(),this.addHandler("draggable",zg)}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 Mt?e:new Mt(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(o=>{if(o instanceof p.Points&&o.material){const a=o.material;o.userData=o.userData||{},o.userData.__bloomBackup||(o.userData.__bloomBackup={size:a.size,sizeAttenuation:a.sizeAttenuation});const c=o.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(o.type==="Sprite"&&o.material){const a=o.material;o.userData=o.userData||{},o.userData.__bloomBackup||(o.userData.__bloomBackup={color:a.color?a.color.clone():null,opacity:a.opacity??1});const c=o.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(o.isLine2&&o.material){const a=o.material;o.userData=o.userData||{},o.userData.__bloomBackup||(o.userData.__bloomBackup={color:a.color?a.color.clone():null,opacity:a.opacity??1});const c=o.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}o instanceof p.Mesh&&o.material&&(Array.isArray(o.material)?o.material:[o.material]).forEach(c=>{o.userData=o.userData||{},o.userData.__bloomBackup||(o.userData.__bloomBackup={emissiveIntensity:c.emissiveIntensity??0,emissiveColor:c.emissive?c.emissive.clone():null,color:c.color?c.color.clone():null});const h=o.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 o=1;o<=t;o++)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,o<t){const c=i*Math.pow(2,o-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 Mt(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 Nc.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=yi.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,yi.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:o,height:a}=t.domElement,c=[];n.forEach(z=>{const D=z.clone().project(e),X=(D.x*.5+.5)*o,I=(-D.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(z=>{h=Math.min(h,z.x),d=Math.max(d,z.x),m=Math.min(m,z.y),f=Math.max(f,z.y)});const g=d-h,v=f-m,w=4,b=Math.max(g,w),x=Math.max(v,w),L=new p.Vector3;i.getCenter(L);const M=L.clone().project(e),C=(M.x*.5+.5)*o,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:o,tileX:a,tileY:c,extent:h,tileSize:d}=i,m=(e/h-.5)*d,f=(.5-t/h)*d;return n.tileIDToWorldCenter(o,a,c).clone().add(new p.Vector3(m,f,0)).sub(n.prjcenter)}}var kg=Object.defineProperty,Kg=(r,e,t)=>e in r?kg(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Bc=(r,e,t)=>Kg(r,typeof e!="symbol"?e+"":e,t);class Bi extends ps{constructor(e,t){super(e,t),Bc(this,"_feaList"),Bc(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 ut))&&!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,o;for(let a=0,c=this._feaList.length;a<c;a++)n=this._feaList[a],t?o=e.call(t,n):o=e(n),o&&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 ut||(e[t]=this.removeFeature(e[t])),!(!e[t]||this!==e[t].getLayer())&&e[t]._remove();return this}clear(){const e=this._feaList.slice();for(const t of e)t._remove();return this}onRemoveFeature(e){if(!e)return;const t=e.getLayer();if(!t||t!==this)return;const i=this._findInList(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,o;for(;i<=n;){if(o=Math.floor((i+n)/2),this._feaList[o]===e)return o;i=o+1}return-1}_disposeFeatureResources(e){try{e.geometry&&e.geometry.dispose&&e.geometry.dispose(),e.material&&(Array.isArray(e.material)?e.material.forEach(t=>t.dispose?.()):e.material.dispose&&e.material.dispose()),e instanceof p.Object3D&&e.traverse(t=>{t!==e&&this._disposeFeatureResources(t)})}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 Ng=Object.defineProperty,Bg=(r,e,t)=>e in r?Ng(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Yc=(r,e,t)=>Bg(r,typeof e!="symbol"?e+"":e,t);class Yg extends p.Group{constructor(){super(...arguments),Yc(this,"_layers",new Set),Yc(this,"_layerids",new Set)}add(...e){return e.forEach(t=>{if(!(t instanceof ps))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 Rg=Object.defineProperty,jg=(r,e,t)=>e in r?Rg(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Jg=(r,e,t)=>jg(r,e+"",t);class Qg{constructor(){Jg(this,"canvasDict",{})}getCanvas(e=40,t=30,i=1,n){const o=Math.ceil(e*i),a=Math.ceil(t*i),c=n?`${o}_${a}_${n}`:`${o}_${a}`;if(!this.canvasDict[c]){const m=document.createElement("canvas");m.width=o,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 Hg(r){const e=+this._x.call(null,r),t=+this._y.call(null,r);return Rc(this.cover(e,t),e,t,r)}function Rc(r,e,t,i){if(isNaN(e)||isNaN(t))return r;var n,o=r._root,a={data:i},c=r._x0,h=r._y0,d=r._x1,m=r._y1,f,g,v,w,b,x,L,M;if(!o)return r._root=a,r;for(;o.length;)if((b=e>=(f=(c+d)/2))?c=f:d=f,(x=t>=(g=(h+m)/2))?h=g:m=g,n=o,!(o=o[L=x<<1|b]))return n[L]=a,r;if(v=+r._x.call(null,o.data),w=+r._y.call(null,o.data),e===v&&t===w)return a.next=o,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|v>=f));return n[M]=o,n[L]=a,r}function Eg(r){var e,t,i=r.length,n,o,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(o=+this._y.call(null,e))||(a[t]=n,c[t]=o,n<h&&(h=n),n>m&&(m=n),o<d&&(d=o),o>f&&(f=o));if(h>m||d>f)return this;for(this.cover(h,d).cover(m,f),t=0;t<i;++t)Rc(this,a[t],c[t],r[t]);return this}function $g(r,e){if(isNaN(r=+r)||isNaN(e=+e))return this;var t=this._x0,i=this._y0,n=this._x1,o=this._y1;if(isNaN(t))n=(t=Math.floor(r))+1,o=(i=Math.floor(e))+1;else{for(var a=n-t||1,c=this._root,h,d;t>r||r>=n||i>e||e>=o;)switch(d=(e<i)<<1|r<t,h=new Array(4),h[d]=c,c=h,a*=2,d){case 0:n=t+a,o=i+a;break;case 1:t=n-a,o=i+a;break;case 2:n=t+a,i=o-a;break;case 3:t=n-a,i=o-a;break}this._root&&this._root.length&&(this._root=c)}return this._x0=t,this._y0=i,this._x1=n,this._y1=o,this}function qg(){var r=[];return this.visit(function(e){if(!e.length)do r.push(e.data);while(e=e.next)}),r}function e0(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 yt(r,e,t,i,n){this.node=r,this.x0=e,this.y0=t,this.x1=i,this.y1=n}function t0(r,e,t){var i,n=this._x0,o=this._y0,a,c,h,d,m=this._x1,f=this._y1,g=[],v=this._root,w,b;for(v&&g.push(new yt(v,n,o,m,f)),t==null?t=1/0:(n=r-t,o=e-t,m=r+t,f=e+t,t*=t);w=g.pop();)if(!(!(v=w.node)||(a=w.x0)>m||(c=w.y0)>f||(h=w.x1)<n||(d=w.y1)<o))if(v.length){var x=(a+h)/2,L=(c+d)/2;g.push(new yt(v[3],x,L,h,d),new yt(v[2],a,L,x,d),new yt(v[1],x,c,h,L),new yt(v[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,v.data),C=e-+this._y.call(null,v.data),W=M*M+C*C;if(W<t){var z=Math.sqrt(t=W);n=r-z,o=e-z,m=r+z,f=e+z,i=v.data}}return i}function i0(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,o,a=this._x0,c=this._y0,h=this._x1,d=this._y1,m,f,g,v,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>=(v=(c+d)/2))?c=v:d=v,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(o=t.next)&&delete t.next,n?(o?n.next=o:delete n.next,this):e?(o?e[x]=o: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=o,this)}function n0(r){for(var e=0,t=r.length;e<t;++e)this.remove(r[e]);return this}function r0(){return this._root}function s0(){var r=0;return this.visit(function(e){if(!e.length)do++r;while(e=e.next)}),r}function o0(r){var e=[],t,i=this._root,n,o,a,c,h;for(i&&e.push(new yt(i,this._x0,this._y0,this._x1,this._y1));t=e.pop();)if(!r(i=t.node,o=t.x0,a=t.y0,c=t.x1,h=t.y1)&&i.length){var d=(o+c)/2,m=(a+h)/2;(n=i[3])&&e.push(new yt(n,d,m,c,h)),(n=i[2])&&e.push(new yt(n,o,m,d,h)),(n=i[1])&&e.push(new yt(n,d,a,c,m)),(n=i[0])&&e.push(new yt(n,o,a,d,m))}return this}function a0(r){var e=[],t=[],i;for(this._root&&e.push(new yt(this._root,this._x0,this._y0,this._x1,this._y1));i=e.pop();){var n=i.node;if(n.length){var o,a=i.x0,c=i.y0,h=i.x1,d=i.y1,m=(a+h)/2,f=(c+d)/2;(o=n[0])&&e.push(new yt(o,a,c,m,f)),(o=n[1])&&e.push(new yt(o,m,c,h,f)),(o=n[2])&&e.push(new yt(o,a,f,m,d)),(o=n[3])&&e.push(new yt(o,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 l0(r){return r[0]}function c0(r){return arguments.length?(this._x=r,this):this._x}function h0(r){return r[1]}function u0(r){return arguments.length?(this._y=r,this):this._y}function jc(r,e,t){var i=new ea(e??l0,t??h0,NaN,NaN,NaN,NaN);return r==null?i:i.addAll(r)}function ea(r,e,t,i,n,o){this._x=r,this._y=e,this._x0=t,this._y0=i,this._x1=n,this._y1=o,this._root=void 0}function Jc(r){for(var e={data:r.data},t=e;r=r.next;)t=t.next={data:r.data};return e}var vt=jc.prototype=ea.prototype;vt.copy=function(){var r=new ea(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=Jc(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]=Jc(i));return r},vt.add=Hg,vt.addAll=Eg,vt.cover=$g,vt.data=qg,vt.extent=e0,vt.find=t0,vt.remove=i0,vt.removeAll=n0,vt.root=r0,vt.size=s0,vt.visit=o0,vt.visitAfter=a0,vt.x=c0,vt.y=u0;var d0=Object.defineProperty,f0=(r,e,t)=>e in r?d0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Qc=(r,e,t)=>f0(r,typeof e!="symbol"?e+"":e,t);class Hc{constructor(e){Qc(this,"_quadtree"),Qc(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,o,a,c,h)=>this._checkNodeCollision(i,o,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=jc().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,o){const a=(t+n)/2,c=(i+o)/2,h=n-t,d=o-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 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 g0{constructor(){Ec(this,"_strategies",new Map),Ec(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:yi.NO_COLLISION,collidedWith:[],timestamp:t.timestamp})});for(const n of this._executionOrder){const o=this._strategies.get(n);if(o?.enabled)try{const a=await o.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 y0=Object.defineProperty,v0=(r,e,t)=>e in r?y0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,_n=(r,e,t)=>v0(r,typeof e!="symbol"?e+"":e,t);class _0{constructor(){_n(this,"frameStats",new Map),_n(this,"summaryStats",{totalFrames:0,averageFrameTime:0,averageFPS:0,minFrameTime:1/0,maxFrameTime:0,totalFeaturesProcessed:0}),_n(this,"sampleWindowSize",60),_n(this,"currentFrameId",0),_n(this,"lastReportTime",0),_n(this,"reportInterval",5e3),_n(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,o)=>n+o,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,o)=>{t.has(o)||t.set(o,[]),t.get(o).push(n)})}),Array.from(t.entries()).map(([i,n])=>({name:i,averageTime:n.reduce((o,a)=>o+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 o=i.map(a=>a.memoryUsage).filter(a=>a>0);if(o.length>0){const a=o.reduce((c,h)=>c+h,0)/o.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 w0=Object.defineProperty,b0=(r,e,t)=>e in r?w0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ys=(r,e,t)=>b0(r,typeof e!="symbol"?e+"":e,t);class x0{constructor(){ys(this,"name","priority"),ys(this,"enabled",!0),ys(this,"weight",1),ys(this,"description","Priority-based avoidance strategy, smaller value means higher priority 基于优先级的避让策略,数值越小优先级越高")}async execute(e,t,i){const n=[],o=new Hc(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=o.findCollisions(h);d.length===0?(o.addBoxes([h]),n.push({featureId:h.featureId,visible:!0,reason:yi.NO_COLLISION,collidedWith:[],timestamp:t.timestamp})):d.some(f=>f.priority<h.priority)?n.push({featureId:h.featureId,visible:!1,reason:yi.PRIORITY_LOST,collidedWith:d.map(f=>f.featureId),timestamp:t.timestamp}):(o.addBoxes([h]),n.push({featureId:h.featureId,visible:!0,reason:yi.NO_COLLISION,collidedWith:[],timestamp:t.timestamp}),d.forEach(f=>{n.push({featureId:f.featureId,visible:!1,reason:yi.PRIORITY_LOST,collidedWith:[h.featureId],timestamp:t.timestamp})}))}),n}}var M0=Object.defineProperty,S0=(r,e,t)=>e in r?M0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Yi=(r,e,t)=>S0(r,typeof e!="symbol"?e+"":e,t);class L0{constructor(e,t={}){this.renderer=e,Yi(this,"_quadTreeManager"),Yi(this,"_strategyOrchestrator"),Yi(this,"_performanceMonitor"),Yi(this,"_layers",new Set),Yi(this,"_config"),Yi(this,"_isUpdating",!1),Yi(this,"_lastUpdateTime",0),Yi(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 o=await this._strategyOrchestrator.executeStrategies(n,i);await this._applyCollisionResults(o,n),this._performanceMonitor.endFrame(this._frameCount,{featureCount:n.length,visibleCount:Array.from(o.values()).filter(a=>a.visible).length,hiddenCount:Array.from(o.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,yi.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 Hc(e),this._strategyOrchestrator=new g0,this._performanceMonitor=new _0,this._strategyOrchestrator.registerStrategy(new x0,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 ut);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 o=e.get(n._id);return o&&n.setCollisionVisibility(o.visible,o.reason),Promise.resolve()});await Promise.all(i)}_setupViewportResizeHandler(){new ResizeObserver(t=>{t.forEach(i=>{const{width:n,height:o}=i.contentRect;this._quadTreeManager.updateViewport({width:n,height:o})})}).observe(this.renderer.domElement)}_setupPerformanceMonitoring(){setInterval(()=>{const e=this.getPerformanceStats();e.frameRate<30&&console.warn("避让系统性能警告:",e)},5e3)}}var Pr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},vs={exports:{}};vs.exports,function(r,e){(function(){var t,i="4.17.21",n=200,o="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,v=4,w=1,b=2,x=1,L=2,M=4,C=8,W=16,z=32,D=64,X=128,I=256,K=512,V=30,G="...",k=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,rt=[["ary",X],["bind",x],["bindKey",L],["curry",C],["curryRight",W],["flip",K],["partial",z],["partialRight",D],["rearg",I]],st="[object Arguments]",ft="[object Array]",He="[object AsyncFunction]",Re="[object Boolean]",je="[object Date]",ot="[object DOMException]",Xe="[object Error]",It="[object Function]",Bt="[object GeneratorFunction]",Ce="[object Map]",at="[object Number]",pt="[object Null]",Pt="[object Object]",bn="[object Promise]",Rn="[object Proxy]",xn="[object RegExp]",At="[object Set]",$i="[object String]",qi="[object Symbol]",Mn="[object Undefined]",Sn="[object WeakMap]",xa="[object WeakSet]",en="[object ArrayBuffer]",wi="[object DataView]",Ir="[object Float32Array]",Ar="[object Float64Array]",jn="[object Int8Array]",Fr="[object Int16Array]",Or="[object Int32Array]",Jn="[object Uint8Array]",Ln="[object Uint8ClampedArray]",O="[object Uint16Array]",E="[object Uint32Array]",ce=/\b__p \+= '';/g,Me=/\b(__p \+=) '' \+/g,Ye=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Yt=/&(?:amp|lt|gt|quot|#39);/g,si=/[&<>"']/g,Fh=RegExp(Yt.source),Ws=RegExp(si.source),oi=/<%-([\s\S]+?)%>/g,ai=/<%([\s\S]+?)%>/g,tn=/<%=([\s\S]+?)%>/g,Pn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Cn=/^\w*$/,Qn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ma=/[\\^$.*+?()[\]{}|]/g,gw=RegExp(Ma.source),Sa=/^\s+/,yw=/\s/,vw=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,_w=/\{\n\/\* \[wrapped with (.+)\] \*/,ww=/,? & /,bw=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,xw=/[()=,{}\[\]\/\s]/,Mw=/\\(\\)?/g,Sw=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Oh=/\w*$/,Lw=/^[-+]0x[0-9a-f]+$/i,Pw=/^0b[01]+$/i,Cw=/^\[object .+?Constructor\]$/,Tw=/^0o[0-7]+$/i,Gw=/^(?:0|[1-9]\d*)$/,Ww=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Zs=/($^)/,Zw=/['\n\r\u2028\u2029\\]/g,Vs="\\ud800-\\udfff",Vw="\\u0300-\\u036f",Iw="\\ufe20-\\ufe2f",Aw="\\u20d0-\\u20ff",Dh=Vw+Iw+Aw,zh="\\u2700-\\u27bf",Xh="a-z\\xdf-\\xf6\\xf8-\\xff",Fw="\\xac\\xb1\\xd7\\xf7",Ow="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Dw="\\u2000-\\u206f",zw=" \\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",Uh="A-Z\\xc0-\\xd6\\xd8-\\xde",kh="\\ufe0e\\ufe0f",Kh=Fw+Ow+Dw+zw,La="['’]",Xw="["+Vs+"]",Nh="["+Kh+"]",Is="["+Dh+"]",Bh="\\d+",Uw="["+zh+"]",Yh="["+Xh+"]",Rh="[^"+Vs+Kh+Bh+zh+Xh+Uh+"]",Pa="\\ud83c[\\udffb-\\udfff]",kw="(?:"+Is+"|"+Pa+")",jh="[^"+Vs+"]",Ca="(?:\\ud83c[\\udde6-\\uddff]){2}",Ta="[\\ud800-\\udbff][\\udc00-\\udfff]",Hn="["+Uh+"]",Jh="\\u200d",Qh="(?:"+Yh+"|"+Rh+")",Kw="(?:"+Hn+"|"+Rh+")",Hh="(?:"+La+"(?:d|ll|m|re|s|t|ve))?",Eh="(?:"+La+"(?:D|LL|M|RE|S|T|VE))?",$h=kw+"?",qh="["+kh+"]?",Nw="(?:"+Jh+"(?:"+[jh,Ca,Ta].join("|")+")"+qh+$h+")*",Bw="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Yw="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",eu=qh+$h+Nw,Rw="(?:"+[Uw,Ca,Ta].join("|")+")"+eu,jw="(?:"+[jh+Is+"?",Is,Ca,Ta,Xw].join("|")+")",Jw=RegExp(La,"g"),Qw=RegExp(Is,"g"),Ga=RegExp(Pa+"(?="+Pa+")|"+jw+eu,"g"),Hw=RegExp([Hn+"?"+Yh+"+"+Hh+"(?="+[Nh,Hn,"$"].join("|")+")",Kw+"+"+Eh+"(?="+[Nh,Hn+Qh,"$"].join("|")+")",Hn+"?"+Qh+"+"+Hh,Hn+"+"+Eh,Yw,Bw,Bh,Rw].join("|"),"g"),Ew=RegExp("["+Jh+Vs+Dh+kh+"]"),$w=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,qw=["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"],eb=-1,Ae={};Ae[Ir]=Ae[Ar]=Ae[jn]=Ae[Fr]=Ae[Or]=Ae[Jn]=Ae[Ln]=Ae[O]=Ae[E]=!0,Ae[st]=Ae[ft]=Ae[en]=Ae[Re]=Ae[wi]=Ae[je]=Ae[Xe]=Ae[It]=Ae[Ce]=Ae[at]=Ae[Pt]=Ae[xn]=Ae[At]=Ae[$i]=Ae[Sn]=!1;var We={};We[st]=We[ft]=We[en]=We[wi]=We[Re]=We[je]=We[Ir]=We[Ar]=We[jn]=We[Fr]=We[Or]=We[Ce]=We[at]=We[Pt]=We[xn]=We[At]=We[$i]=We[qi]=We[Jn]=We[Ln]=We[O]=We[E]=!0,We[Xe]=We[It]=We[Sn]=!1;var tb={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"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"},ib={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},nb={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},rb={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},sb=parseFloat,ob=parseInt,tu=typeof Pr=="object"&&Pr&&Pr.Object===Object&&Pr,ab=typeof self=="object"&&self&&self.Object===Object&&self,lt=tu||ab||Function("return this")(),Wa=e&&!e.nodeType&&e,Tn=Wa&&!0&&r&&!r.nodeType&&r,iu=Tn&&Tn.exports===Wa,Za=iu&&tu.process,Rt=function(){try{var A=Tn&&Tn.require&&Tn.require("util").types;return A||Za&&Za.binding&&Za.binding("util")}catch{}}(),nu=Rt&&Rt.isArrayBuffer,ru=Rt&&Rt.isDate,su=Rt&&Rt.isMap,ou=Rt&&Rt.isRegExp,au=Rt&&Rt.isSet,lu=Rt&&Rt.isTypedArray;function Ft(A,N,U){switch(U.length){case 0:return A.call(N);case 1:return A.call(N,U[0]);case 2:return A.call(N,U[0],U[1]);case 3:return A.call(N,U[0],U[1],U[2])}return A.apply(N,U)}function lb(A,N,U,ee){for(var he=-1,Le=A==null?0:A.length;++he<Le;){var Je=A[he];N(ee,Je,U(Je),A)}return ee}function jt(A,N){for(var U=-1,ee=A==null?0:A.length;++U<ee&&N(A[U],U,A)!==!1;);return A}function cb(A,N){for(var U=A==null?0:A.length;U--&&N(A[U],U,A)!==!1;);return A}function cu(A,N){for(var U=-1,ee=A==null?0:A.length;++U<ee;)if(!N(A[U],U,A))return!1;return!0}function nn(A,N){for(var U=-1,ee=A==null?0:A.length,he=0,Le=[];++U<ee;){var Je=A[U];N(Je,U,A)&&(Le[he++]=Je)}return Le}function As(A,N){var U=A==null?0:A.length;return!!U&&En(A,N,0)>-1}function Va(A,N,U){for(var ee=-1,he=A==null?0:A.length;++ee<he;)if(U(N,A[ee]))return!0;return!1}function Fe(A,N){for(var U=-1,ee=A==null?0:A.length,he=Array(ee);++U<ee;)he[U]=N(A[U],U,A);return he}function rn(A,N){for(var U=-1,ee=N.length,he=A.length;++U<ee;)A[he+U]=N[U];return A}function Ia(A,N,U,ee){var he=-1,Le=A==null?0:A.length;for(ee&&Le&&(U=A[++he]);++he<Le;)U=N(U,A[he],he,A);return U}function hb(A,N,U,ee){var he=A==null?0:A.length;for(ee&&he&&(U=A[--he]);he--;)U=N(U,A[he],he,A);return U}function Aa(A,N){for(var U=-1,ee=A==null?0:A.length;++U<ee;)if(N(A[U],U,A))return!0;return!1}var ub=Fa("length");function db(A){return A.split("")}function fb(A){return A.match(bw)||[]}function hu(A,N,U){var ee;return U(A,function(he,Le,Je){if(N(he,Le,Je))return ee=Le,!1}),ee}function Fs(A,N,U,ee){for(var he=A.length,Le=U+(ee?1:-1);ee?Le--:++Le<he;)if(N(A[Le],Le,A))return Le;return-1}function En(A,N,U){return N===N?Lb(A,N,U):Fs(A,uu,U)}function pb(A,N,U,ee){for(var he=U-1,Le=A.length;++he<Le;)if(ee(A[he],N))return he;return-1}function uu(A){return A!==A}function du(A,N){var U=A==null?0:A.length;return U?Da(A,N)/U:de}function Fa(A){return function(N){return N==null?t:N[A]}}function Oa(A){return function(N){return A==null?t:A[N]}}function fu(A,N,U,ee,he){return he(A,function(Le,Je,Ge){U=ee?(ee=!1,Le):N(U,Le,Je,Ge)}),U}function mb(A,N){var U=A.length;for(A.sort(N);U--;)A[U]=A[U].value;return A}function Da(A,N){for(var U,ee=-1,he=A.length;++ee<he;){var Le=N(A[ee]);Le!==t&&(U=U===t?Le:U+Le)}return U}function za(A,N){for(var U=-1,ee=Array(A);++U<A;)ee[U]=N(U);return ee}function gb(A,N){return Fe(N,function(U){return[U,A[U]]})}function pu(A){return A&&A.slice(0,vu(A)+1).replace(Sa,"")}function Ot(A){return function(N){return A(N)}}function Xa(A,N){return Fe(N,function(U){return A[U]})}function Dr(A,N){return A.has(N)}function mu(A,N){for(var U=-1,ee=A.length;++U<ee&&En(N,A[U],0)>-1;);return U}function gu(A,N){for(var U=A.length;U--&&En(N,A[U],0)>-1;);return U}function yb(A,N){for(var U=A.length,ee=0;U--;)A[U]===N&&++ee;return ee}var vb=Oa(tb),_b=Oa(ib);function wb(A){return"\\"+rb[A]}function bb(A,N){return A==null?t:A[N]}function $n(A){return Ew.test(A)}function xb(A){return $w.test(A)}function Mb(A){for(var N,U=[];!(N=A.next()).done;)U.push(N.value);return U}function Ua(A){var N=-1,U=Array(A.size);return A.forEach(function(ee,he){U[++N]=[he,ee]}),U}function yu(A,N){return function(U){return A(N(U))}}function sn(A,N){for(var U=-1,ee=A.length,he=0,Le=[];++U<ee;){var Je=A[U];(Je===N||Je===m)&&(A[U]=m,Le[he++]=U)}return Le}function Os(A){var N=-1,U=Array(A.size);return A.forEach(function(ee){U[++N]=ee}),U}function Sb(A){var N=-1,U=Array(A.size);return A.forEach(function(ee){U[++N]=[ee,ee]}),U}function Lb(A,N,U){for(var ee=U-1,he=A.length;++ee<he;)if(A[ee]===N)return ee;return-1}function Pb(A,N,U){for(var ee=U+1;ee--;)if(A[ee]===N)return ee;return ee}function qn(A){return $n(A)?Tb(A):ub(A)}function li(A){return $n(A)?Gb(A):db(A)}function vu(A){for(var N=A.length;N--&&yw.test(A.charAt(N)););return N}var Cb=Oa(nb);function Tb(A){for(var N=Ga.lastIndex=0;Ga.test(A);)++N;return N}function Gb(A){return A.match(Ga)||[]}function Wb(A){return A.match(Hw)||[]}var Zb=function A(N){N=N==null?lt:er.defaults(lt.Object(),N,er.pick(lt,qw));var U=N.Array,ee=N.Date,he=N.Error,Le=N.Function,Je=N.Math,Ge=N.Object,ka=N.RegExp,Vb=N.String,Jt=N.TypeError,Ds=U.prototype,Ib=Le.prototype,tr=Ge.prototype,zs=N["__core-js_shared__"],Xs=Ib.toString,Te=tr.hasOwnProperty,Ab=0,_u=function(){var s=/[^.]+$/.exec(zs&&zs.keys&&zs.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}(),Us=tr.toString,Fb=Xs.call(Ge),Ob=lt._,Db=ka("^"+Xs.call(Te).replace(Ma,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ks=iu?N.Buffer:t,on=N.Symbol,Ks=N.Uint8Array,wu=ks?ks.allocUnsafe:t,Ns=yu(Ge.getPrototypeOf,Ge),bu=Ge.create,xu=tr.propertyIsEnumerable,Bs=Ds.splice,Mu=on?on.isConcatSpreadable:t,zr=on?on.iterator:t,Gn=on?on.toStringTag:t,Ys=function(){try{var s=An(Ge,"defineProperty");return s({},"",{}),s}catch{}}(),zb=N.clearTimeout!==lt.clearTimeout&&N.clearTimeout,Xb=ee&&ee.now!==lt.Date.now&&ee.now,Ub=N.setTimeout!==lt.setTimeout&&N.setTimeout,Rs=Je.ceil,js=Je.floor,Ka=Ge.getOwnPropertySymbols,kb=ks?ks.isBuffer:t,Su=N.isFinite,Kb=Ds.join,Nb=yu(Ge.keys,Ge),Qe=Je.max,mt=Je.min,Bb=ee.now,Yb=N.parseInt,Lu=Je.random,Rb=Ds.reverse,Na=An(N,"DataView"),Xr=An(N,"Map"),Ba=An(N,"Promise"),ir=An(N,"Set"),Ur=An(N,"WeakMap"),kr=An(Ge,"create"),Js=Ur&&new Ur,nr={},jb=Fn(Na),Jb=Fn(Xr),Qb=Fn(Ba),Hb=Fn(ir),Eb=Fn(Ur),Qs=on?on.prototype:t,Kr=Qs?Qs.valueOf:t,Pu=Qs?Qs.toString:t;function S(s){if(Ue(s)&&!ue(s)&&!(s instanceof be)){if(s instanceof Qt)return s;if(Te.call(s,"__wrapped__"))return Cd(s)}return new Qt(s)}var rr=function(){function s(){}return function(l){if(!Oe(l))return{};if(bu)return bu(l);s.prototype=l;var u=new s;return s.prototype=t,u}}();function Hs(){}function Qt(s,l){this.__wrapped__=s,this.__actions__=[],this.__chain__=!!l,this.__index__=0,this.__values__=t}S.templateSettings={escape:oi,evaluate:ai,interpolate:tn,variable:"",imports:{_:S}},S.prototype=Hs.prototype,S.prototype.constructor=S,Qt.prototype=rr(Hs.prototype),Qt.prototype.constructor=Qt;function be(s){this.__wrapped__=s,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=ge,this.__views__=[]}function $b(){var s=new be(this.__wrapped__);return s.__actions__=Ct(this.__actions__),s.__dir__=this.__dir__,s.__filtered__=this.__filtered__,s.__iteratees__=Ct(this.__iteratees__),s.__takeCount__=this.__takeCount__,s.__views__=Ct(this.__views__),s}function qb(){if(this.__filtered__){var s=new be(this);s.__dir__=-1,s.__filtered__=!0}else s=this.clone(),s.__dir__*=-1;return s}function e1(){var s=this.__wrapped__.value(),l=this.__dir__,u=ue(s),y=l<0,_=u?s.length:0,P=dx(0,_,this.__views__),T=P.start,Z=P.end,F=Z-T,B=y?Z:T-1,R=this.__iteratees__,J=R.length,$=0,te=mt(F,this.__takeCount__);if(!u||!y&&_==F&&te==F)return Hu(s,this.__actions__);var oe=[];e:for(;F--&&$<te;){B+=l;for(var me=-1,ae=s[B];++me<J;){var we=R[me],xe=we.iteratee,Xt=we.type,bt=xe(ae);if(Xt==H)ae=bt;else if(!bt){if(Xt==Y)continue e;break e}}oe[$++]=ae}return oe}be.prototype=rr(Hs.prototype),be.prototype.constructor=be;function Wn(s){var l=-1,u=s==null?0:s.length;for(this.clear();++l<u;){var y=s[l];this.set(y[0],y[1])}}function t1(){this.__data__=kr?kr(null):{},this.size=0}function i1(s){var l=this.has(s)&&delete this.__data__[s];return this.size-=l?1:0,l}function n1(s){var l=this.__data__;if(kr){var u=l[s];return u===h?t:u}return Te.call(l,s)?l[s]:t}function r1(s){var l=this.__data__;return kr?l[s]!==t:Te.call(l,s)}function s1(s,l){var u=this.__data__;return this.size+=this.has(s)?0:1,u[s]=kr&&l===t?h:l,this}Wn.prototype.clear=t1,Wn.prototype.delete=i1,Wn.prototype.get=n1,Wn.prototype.has=r1,Wn.prototype.set=s1;function Ti(s){var l=-1,u=s==null?0:s.length;for(this.clear();++l<u;){var y=s[l];this.set(y[0],y[1])}}function o1(){this.__data__=[],this.size=0}function a1(s){var l=this.__data__,u=Es(l,s);if(u<0)return!1;var y=l.length-1;return u==y?l.pop():Bs.call(l,u,1),--this.size,!0}function l1(s){var l=this.__data__,u=Es(l,s);return u<0?t:l[u][1]}function c1(s){return Es(this.__data__,s)>-1}function h1(s,l){var u=this.__data__,y=Es(u,s);return y<0?(++this.size,u.push([s,l])):u[y][1]=l,this}Ti.prototype.clear=o1,Ti.prototype.delete=a1,Ti.prototype.get=l1,Ti.prototype.has=c1,Ti.prototype.set=h1;function Gi(s){var l=-1,u=s==null?0:s.length;for(this.clear();++l<u;){var y=s[l];this.set(y[0],y[1])}}function u1(){this.size=0,this.__data__={hash:new Wn,map:new(Xr||Ti),string:new Wn}}function d1(s){var l=co(this,s).delete(s);return this.size-=l?1:0,l}function f1(s){return co(this,s).get(s)}function p1(s){return co(this,s).has(s)}function m1(s,l){var u=co(this,s),y=u.size;return u.set(s,l),this.size+=u.size==y?0:1,this}Gi.prototype.clear=u1,Gi.prototype.delete=d1,Gi.prototype.get=f1,Gi.prototype.has=p1,Gi.prototype.set=m1;function Zn(s){var l=-1,u=s==null?0:s.length;for(this.__data__=new Gi;++l<u;)this.add(s[l])}function g1(s){return this.__data__.set(s,h),this}function y1(s){return this.__data__.has(s)}Zn.prototype.add=Zn.prototype.push=g1,Zn.prototype.has=y1;function ci(s){var l=this.__data__=new Ti(s);this.size=l.size}function v1(){this.__data__=new Ti,this.size=0}function _1(s){var l=this.__data__,u=l.delete(s);return this.size=l.size,u}function w1(s){return this.__data__.get(s)}function b1(s){return this.__data__.has(s)}function x1(s,l){var u=this.__data__;if(u instanceof Ti){var y=u.__data__;if(!Xr||y.length<n-1)return y.push([s,l]),this.size=++u.size,this;u=this.__data__=new Gi(y)}return u.set(s,l),this.size=u.size,this}ci.prototype.clear=v1,ci.prototype.delete=_1,ci.prototype.get=w1,ci.prototype.has=b1,ci.prototype.set=x1;function Cu(s,l){var u=ue(s),y=!u&&On(s),_=!u&&!y&&un(s),P=!u&&!y&&!_&&lr(s),T=u||y||_||P,Z=T?za(s.length,Vb):[],F=Z.length;for(var B in s)(l||Te.call(s,B))&&!(T&&(B=="length"||_&&(B=="offset"||B=="parent")||P&&(B=="buffer"||B=="byteLength"||B=="byteOffset")||Ii(B,F)))&&Z.push(B);return Z}function Tu(s){var l=s.length;return l?s[tl(0,l-1)]:t}function M1(s,l){return ho(Ct(s),Vn(l,0,s.length))}function S1(s){return ho(Ct(s))}function Ya(s,l,u){(u!==t&&!hi(s[l],u)||u===t&&!(l in s))&&Wi(s,l,u)}function Nr(s,l,u){var y=s[l];(!(Te.call(s,l)&&hi(y,u))||u===t&&!(l in s))&&Wi(s,l,u)}function Es(s,l){for(var u=s.length;u--;)if(hi(s[u][0],l))return u;return-1}function L1(s,l,u,y){return an(s,function(_,P,T){l(y,_,u(_),T)}),y}function Gu(s,l){return s&&xi(l,Ee(l),s)}function P1(s,l){return s&&xi(l,Gt(l),s)}function Wi(s,l,u){l=="__proto__"&&Ys?Ys(s,l,{configurable:!0,enumerable:!0,value:u,writable:!0}):s[l]=u}function Ra(s,l){for(var u=-1,y=l.length,_=U(y),P=s==null;++u<y;)_[u]=P?t:Pl(s,l[u]);return _}function Vn(s,l,u){return s===s&&(u!==t&&(s=s<=u?s:u),l!==t&&(s=s>=l?s:l)),s}function Ht(s,l,u,y,_,P){var T,Z=l&f,F=l&g,B=l&v;if(u&&(T=_?u(s,y,_,P):u(s)),T!==t)return T;if(!Oe(s))return s;var R=ue(s);if(R){if(T=px(s),!Z)return Ct(s,T)}else{var J=gt(s),$=J==It||J==Bt;if(un(s))return qu(s,Z);if(J==Pt||J==st||$&&!_){if(T=F||$?{}:vd(s),!Z)return F?nx(s,P1(T,s)):ix(s,Gu(T,s))}else{if(!We[J])return _?s:{};T=mx(s,J,Z)}}P||(P=new ci);var te=P.get(s);if(te)return te;P.set(s,T),jd(s)?s.forEach(function(ae){T.add(Ht(ae,l,u,ae,s,P))}):Yd(s)&&s.forEach(function(ae,we){T.set(we,Ht(ae,l,u,we,s,P))});var oe=B?F?dl:ul:F?Gt:Ee,me=R?t:oe(s);return jt(me||s,function(ae,we){me&&(we=ae,ae=s[we]),Nr(T,we,Ht(ae,l,u,we,s,P))}),T}function C1(s){var l=Ee(s);return function(u){return Wu(u,s,l)}}function Wu(s,l,u){var y=u.length;if(s==null)return!y;for(s=Ge(s);y--;){var _=u[y],P=l[_],T=s[_];if(T===t&&!(_ in s)||!P(T))return!1}return!0}function Zu(s,l,u){if(typeof s!="function")throw new Jt(a);return Hr(function(){s.apply(t,u)},l)}function Br(s,l,u,y){var _=-1,P=As,T=!0,Z=s.length,F=[],B=l.length;if(!Z)return F;u&&(l=Fe(l,Ot(u))),y?(P=Va,T=!1):l.length>=n&&(P=Dr,T=!1,l=new Zn(l));e:for(;++_<Z;){var R=s[_],J=u==null?R:u(R);if(R=y||R!==0?R:0,T&&J===J){for(var $=B;$--;)if(l[$]===J)continue e;F.push(R)}else P(l,J,y)||F.push(R)}return F}var an=rd(bi),Vu=rd(Ja,!0);function T1(s,l){var u=!0;return an(s,function(y,_,P){return u=!!l(y,_,P),u}),u}function $s(s,l,u){for(var y=-1,_=s.length;++y<_;){var P=s[y],T=l(P);if(T!=null&&(Z===t?T===T&&!zt(T):u(T,Z)))var Z=T,F=P}return F}function G1(s,l,u,y){var _=s.length;for(u=pe(u),u<0&&(u=-u>_?0:_+u),y=y===t||y>_?_:pe(y),y<0&&(y+=_),y=u>y?0:Qd(y);u<y;)s[u++]=l;return s}function Iu(s,l){var u=[];return an(s,function(y,_,P){l(y,_,P)&&u.push(y)}),u}function ct(s,l,u,y,_){var P=-1,T=s.length;for(u||(u=yx),_||(_=[]);++P<T;){var Z=s[P];l>0&&u(Z)?l>1?ct(Z,l-1,u,y,_):rn(_,Z):y||(_[_.length]=Z)}return _}var ja=sd(),Au=sd(!0);function bi(s,l){return s&&ja(s,l,Ee)}function Ja(s,l){return s&&Au(s,l,Ee)}function qs(s,l){return nn(l,function(u){return Ai(s[u])})}function In(s,l){l=cn(l,s);for(var u=0,y=l.length;s!=null&&u<y;)s=s[Mi(l[u++])];return u&&u==y?s:t}function Fu(s,l,u){var y=l(s);return ue(s)?y:rn(y,u(s))}function _t(s){return s==null?s===t?Mn:pt:Gn&&Gn in Ge(s)?ux(s):Sx(s)}function Qa(s,l){return s>l}function W1(s,l){return s!=null&&Te.call(s,l)}function Z1(s,l){return s!=null&&l in Ge(s)}function V1(s,l,u){return s>=mt(l,u)&&s<Qe(l,u)}function Ha(s,l,u){for(var y=u?Va:As,_=s[0].length,P=s.length,T=P,Z=U(P),F=1/0,B=[];T--;){var R=s[T];T&&l&&(R=Fe(R,Ot(l))),F=mt(R.length,F),Z[T]=!u&&(l||_>=120&&R.length>=120)?new Zn(T&&R):t}R=s[0];var J=-1,$=Z[0];e:for(;++J<_&&B.length<F;){var te=R[J],oe=l?l(te):te;if(te=u||te!==0?te:0,!($?Dr($,oe):y(B,oe,u))){for(T=P;--T;){var me=Z[T];if(!(me?Dr(me,oe):y(s[T],oe,u)))continue e}$&&$.push(oe),B.push(te)}}return B}function I1(s,l,u,y){return bi(s,function(_,P,T){l(y,u(_),P,T)}),y}function Yr(s,l,u){l=cn(l,s),s=xd(s,l);var y=s==null?s:s[Mi($t(l))];return y==null?t:Ft(y,s,u)}function Ou(s){return Ue(s)&&_t(s)==st}function A1(s){return Ue(s)&&_t(s)==en}function F1(s){return Ue(s)&&_t(s)==je}function Rr(s,l,u,y,_){return s===l?!0:s==null||l==null||!Ue(s)&&!Ue(l)?s!==s&&l!==l:O1(s,l,u,y,Rr,_)}function O1(s,l,u,y,_,P){var T=ue(s),Z=ue(l),F=T?ft:gt(s),B=Z?ft:gt(l);F=F==st?Pt:F,B=B==st?Pt:B;var R=F==Pt,J=B==Pt,$=F==B;if($&&un(s)){if(!un(l))return!1;T=!0,R=!1}if($&&!R)return P||(P=new ci),T||lr(s)?md(s,l,u,y,_,P):cx(s,l,F,u,y,_,P);if(!(u&w)){var te=R&&Te.call(s,"__wrapped__"),oe=J&&Te.call(l,"__wrapped__");if(te||oe){var me=te?s.value():s,ae=oe?l.value():l;return P||(P=new ci),_(me,ae,u,y,P)}}return $?(P||(P=new ci),hx(s,l,u,y,_,P)):!1}function D1(s){return Ue(s)&&gt(s)==Ce}function Ea(s,l,u,y){var _=u.length,P=_,T=!y;if(s==null)return!P;for(s=Ge(s);_--;){var Z=u[_];if(T&&Z[2]?Z[1]!==s[Z[0]]:!(Z[0]in s))return!1}for(;++_<P;){Z=u[_];var F=Z[0],B=s[F],R=Z[1];if(T&&Z[2]){if(B===t&&!(F in s))return!1}else{var J=new ci;if(y)var $=y(B,R,F,s,l,J);if(!($===t?Rr(R,B,w|b,y,J):$))return!1}}return!0}function Du(s){if(!Oe(s)||_x(s))return!1;var l=Ai(s)?Db:Cw;return l.test(Fn(s))}function z1(s){return Ue(s)&&_t(s)==xn}function X1(s){return Ue(s)&&gt(s)==At}function U1(s){return Ue(s)&&yo(s.length)&&!!Ae[_t(s)]}function zu(s){return typeof s=="function"?s:s==null?Wt:typeof s=="object"?ue(s)?ku(s[0],s[1]):Uu(s):af(s)}function $a(s){if(!Qr(s))return Nb(s);var l=[];for(var u in Ge(s))Te.call(s,u)&&u!="constructor"&&l.push(u);return l}function k1(s){if(!Oe(s))return Mx(s);var l=Qr(s),u=[];for(var y in s)y=="constructor"&&(l||!Te.call(s,y))||u.push(y);return u}function qa(s,l){return s<l}function Xu(s,l){var u=-1,y=Tt(s)?U(s.length):[];return an(s,function(_,P,T){y[++u]=l(_,P,T)}),y}function Uu(s){var l=pl(s);return l.length==1&&l[0][2]?wd(l[0][0],l[0][1]):function(u){return u===s||Ea(u,s,l)}}function ku(s,l){return gl(s)&&_d(l)?wd(Mi(s),l):function(u){var y=Pl(u,s);return y===t&&y===l?Cl(u,s):Rr(l,y,w|b)}}function eo(s,l,u,y,_){s!==l&&ja(l,function(P,T){if(_||(_=new ci),Oe(P))K1(s,l,T,u,eo,y,_);else{var Z=y?y(vl(s,T),P,T+"",s,l,_):t;Z===t&&(Z=P),Ya(s,T,Z)}},Gt)}function K1(s,l,u,y,_,P,T){var Z=vl(s,u),F=vl(l,u),B=T.get(F);if(B){Ya(s,u,B);return}var R=P?P(Z,F,u+"",s,l,T):t,J=R===t;if(J){var $=ue(F),te=!$&&un(F),oe=!$&&!te&&lr(F);R=F,$||te||oe?ue(Z)?R=Z:Ke(Z)?R=Ct(Z):te?(J=!1,R=qu(F,!0)):oe?(J=!1,R=ed(F,!0)):R=[]:Er(F)||On(F)?(R=Z,On(Z)?R=Hd(Z):(!Oe(Z)||Ai(Z))&&(R=vd(F))):J=!1}J&&(T.set(F,R),_(R,F,y,P,T),T.delete(F)),Ya(s,u,R)}function Ku(s,l){var u=s.length;if(u)return l+=l<0?u:0,Ii(l,u)?s[l]:t}function Nu(s,l,u){l.length?l=Fe(l,function(P){return ue(P)?function(T){return In(T,P.length===1?P[0]:P)}:P}):l=[Wt];var y=-1;l=Fe(l,Ot(se()));var _=Xu(s,function(P,T,Z){var F=Fe(l,function(B){return B(P)});return{criteria:F,index:++y,value:P}});return mb(_,function(P,T){return tx(P,T,u)})}function N1(s,l){return Bu(s,l,function(u,y){return Cl(s,y)})}function Bu(s,l,u){for(var y=-1,_=l.length,P={};++y<_;){var T=l[y],Z=In(s,T);u(Z,T)&&jr(P,cn(T,s),Z)}return P}function B1(s){return function(l){return In(l,s)}}function el(s,l,u,y){var _=y?pb:En,P=-1,T=l.length,Z=s;for(s===l&&(l=Ct(l)),u&&(Z=Fe(s,Ot(u)));++P<T;)for(var F=0,B=l[P],R=u?u(B):B;(F=_(Z,R,F,y))>-1;)Z!==s&&Bs.call(Z,F,1),Bs.call(s,F,1);return s}function Yu(s,l){for(var u=s?l.length:0,y=u-1;u--;){var _=l[u];if(u==y||_!==P){var P=_;Ii(_)?Bs.call(s,_,1):rl(s,_)}}return s}function tl(s,l){return s+js(Lu()*(l-s+1))}function Y1(s,l,u,y){for(var _=-1,P=Qe(Rs((l-s)/(u||1)),0),T=U(P);P--;)T[y?P:++_]=s,s+=u;return T}function il(s,l){var u="";if(!s||l<1||l>ne)return u;do l%2&&(u+=s),l=js(l/2),l&&(s+=s);while(l);return u}function ye(s,l){return _l(bd(s,l,Wt),s+"")}function R1(s){return Tu(cr(s))}function j1(s,l){var u=cr(s);return ho(u,Vn(l,0,u.length))}function jr(s,l,u,y){if(!Oe(s))return s;l=cn(l,s);for(var _=-1,P=l.length,T=P-1,Z=s;Z!=null&&++_<P;){var F=Mi(l[_]),B=u;if(F==="__proto__"||F==="constructor"||F==="prototype")return s;if(_!=T){var R=Z[F];B=y?y(R,F,Z):t,B===t&&(B=Oe(R)?R:Ii(l[_+1])?[]:{})}Nr(Z,F,B),Z=Z[F]}return s}var Ru=Js?function(s,l){return Js.set(s,l),s}:Wt,J1=Ys?function(s,l){return Ys(s,"toString",{configurable:!0,enumerable:!1,value:Gl(l),writable:!0})}:Wt;function Q1(s){return ho(cr(s))}function Et(s,l,u){var y=-1,_=s.length;l<0&&(l=-l>_?0:_+l),u=u>_?_:u,u<0&&(u+=_),_=l>u?0:u-l>>>0,l>>>=0;for(var P=U(_);++y<_;)P[y]=s[y+l];return P}function H1(s,l){var u;return an(s,function(y,_,P){return u=l(y,_,P),!u}),!!u}function to(s,l,u){var y=0,_=s==null?y:s.length;if(typeof l=="number"&&l===l&&_<=Se){for(;y<_;){var P=y+_>>>1,T=s[P];T!==null&&!zt(T)&&(u?T<=l:T<l)?y=P+1:_=P}return _}return nl(s,l,Wt,u)}function nl(s,l,u,y){var _=0,P=s==null?0:s.length;if(P===0)return 0;l=u(l);for(var T=l!==l,Z=l===null,F=zt(l),B=l===t;_<P;){var R=js((_+P)/2),J=u(s[R]),$=J!==t,te=J===null,oe=J===J,me=zt(J);if(T)var ae=y||oe;else B?ae=oe&&(y||$):Z?ae=oe&&$&&(y||!te):F?ae=oe&&$&&!te&&(y||!me):te||me?ae=!1:ae=y?J<=l:J<l;ae?_=R+1:P=R}return mt(P,fe)}function ju(s,l){for(var u=-1,y=s.length,_=0,P=[];++u<y;){var T=s[u],Z=l?l(T):T;if(!u||!hi(Z,F)){var F=Z;P[_++]=T===0?0:T}}return P}function Ju(s){return typeof s=="number"?s:zt(s)?de:+s}function Dt(s){if(typeof s=="string")return s;if(ue(s))return Fe(s,Dt)+"";if(zt(s))return Pu?Pu.call(s):"";var l=s+"";return l=="0"&&1/s==-re?"-0":l}function ln(s,l,u){var y=-1,_=As,P=s.length,T=!0,Z=[],F=Z;if(u)T=!1,_=Va;else if(P>=n){var B=l?null:ax(s);if(B)return Os(B);T=!1,_=Dr,F=new Zn}else F=l?[]:Z;e:for(;++y<P;){var R=s[y],J=l?l(R):R;if(R=u||R!==0?R:0,T&&J===J){for(var $=F.length;$--;)if(F[$]===J)continue e;l&&F.push(J),Z.push(R)}else _(F,J,u)||(F!==Z&&F.push(J),Z.push(R))}return Z}function rl(s,l){return l=cn(l,s),s=xd(s,l),s==null||delete s[Mi($t(l))]}function Qu(s,l,u,y){return jr(s,l,u(In(s,l)),y)}function io(s,l,u,y){for(var _=s.length,P=y?_:-1;(y?P--:++P<_)&&l(s[P],P,s););return u?Et(s,y?0:P,y?P+1:_):Et(s,y?P+1:0,y?_:P)}function Hu(s,l){var u=s;return u instanceof be&&(u=u.value()),Ia(l,function(y,_){return _.func.apply(_.thisArg,rn([y],_.args))},u)}function sl(s,l,u){var y=s.length;if(y<2)return y?ln(s[0]):[];for(var _=-1,P=U(y);++_<y;)for(var T=s[_],Z=-1;++Z<y;)Z!=_&&(P[_]=Br(P[_]||T,s[Z],l,u));return ln(ct(P,1),l,u)}function Eu(s,l,u){for(var y=-1,_=s.length,P=l.length,T={};++y<_;){var Z=y<P?l[y]:t;u(T,s[y],Z)}return T}function ol(s){return Ke(s)?s:[]}function al(s){return typeof s=="function"?s:Wt}function cn(s,l){return ue(s)?s:gl(s,l)?[s]:Pd(Pe(s))}var E1=ye;function hn(s,l,u){var y=s.length;return u=u===t?y:u,!l&&u>=y?s:Et(s,l,u)}var $u=zb||function(s){return lt.clearTimeout(s)};function qu(s,l){if(l)return s.slice();var u=s.length,y=wu?wu(u):new s.constructor(u);return s.copy(y),y}function ll(s){var l=new s.constructor(s.byteLength);return new Ks(l).set(new Ks(s)),l}function $1(s,l){var u=l?ll(s.buffer):s.buffer;return new s.constructor(u,s.byteOffset,s.byteLength)}function q1(s){var l=new s.constructor(s.source,Oh.exec(s));return l.lastIndex=s.lastIndex,l}function ex(s){return Kr?Ge(Kr.call(s)):{}}function ed(s,l){var u=l?ll(s.buffer):s.buffer;return new s.constructor(u,s.byteOffset,s.length)}function td(s,l){if(s!==l){var u=s!==t,y=s===null,_=s===s,P=zt(s),T=l!==t,Z=l===null,F=l===l,B=zt(l);if(!Z&&!B&&!P&&s>l||P&&T&&F&&!Z&&!B||y&&T&&F||!u&&F||!_)return 1;if(!y&&!P&&!B&&s<l||B&&u&&_&&!y&&!P||Z&&u&&_||!T&&_||!F)return-1}return 0}function tx(s,l,u){for(var y=-1,_=s.criteria,P=l.criteria,T=_.length,Z=u.length;++y<T;){var F=td(_[y],P[y]);if(F){if(y>=Z)return F;var B=u[y];return F*(B=="desc"?-1:1)}}return s.index-l.index}function id(s,l,u,y){for(var _=-1,P=s.length,T=u.length,Z=-1,F=l.length,B=Qe(P-T,0),R=U(F+B),J=!y;++Z<F;)R[Z]=l[Z];for(;++_<T;)(J||_<P)&&(R[u[_]]=s[_]);for(;B--;)R[Z++]=s[_++];return R}function nd(s,l,u,y){for(var _=-1,P=s.length,T=-1,Z=u.length,F=-1,B=l.length,R=Qe(P-Z,0),J=U(R+B),$=!y;++_<R;)J[_]=s[_];for(var te=_;++F<B;)J[te+F]=l[F];for(;++T<Z;)($||_<P)&&(J[te+u[T]]=s[_++]);return J}function Ct(s,l){var u=-1,y=s.length;for(l||(l=U(y));++u<y;)l[u]=s[u];return l}function xi(s,l,u,y){var _=!u;u||(u={});for(var P=-1,T=l.length;++P<T;){var Z=l[P],F=y?y(u[Z],s[Z],Z,u,s):t;F===t&&(F=s[Z]),_?Wi(u,Z,F):Nr(u,Z,F)}return u}function ix(s,l){return xi(s,ml(s),l)}function nx(s,l){return xi(s,gd(s),l)}function no(s,l){return function(u,y){var _=ue(u)?lb:L1,P=l?l():{};return _(u,s,se(y,2),P)}}function sr(s){return ye(function(l,u){var y=-1,_=u.length,P=_>1?u[_-1]:t,T=_>2?u[2]:t;for(P=s.length>3&&typeof P=="function"?(_--,P):t,T&&wt(u[0],u[1],T)&&(P=_<3?t:P,_=1),l=Ge(l);++y<_;){var Z=u[y];Z&&s(l,Z,y,P)}return l})}function rd(s,l){return function(u,y){if(u==null)return u;if(!Tt(u))return s(u,y);for(var _=u.length,P=l?_:-1,T=Ge(u);(l?P--:++P<_)&&y(T[P],P,T)!==!1;);return u}}function sd(s){return function(l,u,y){for(var _=-1,P=Ge(l),T=y(l),Z=T.length;Z--;){var F=T[s?Z:++_];if(u(P[F],F,P)===!1)break}return l}}function rx(s,l,u){var y=l&x,_=Jr(s);function P(){var T=this&&this!==lt&&this instanceof P?_:s;return T.apply(y?u:this,arguments)}return P}function od(s){return function(l){l=Pe(l);var u=$n(l)?li(l):t,y=u?u[0]:l.charAt(0),_=u?hn(u,1).join(""):l.slice(1);return y[s]()+_}}function or(s){return function(l){return Ia(sf(rf(l).replace(Jw,"")),s,"")}}function Jr(s){return function(){var l=arguments;switch(l.length){case 0:return new s;case 1:return new s(l[0]);case 2:return new s(l[0],l[1]);case 3:return new s(l[0],l[1],l[2]);case 4:return new s(l[0],l[1],l[2],l[3]);case 5:return new s(l[0],l[1],l[2],l[3],l[4]);case 6:return new s(l[0],l[1],l[2],l[3],l[4],l[5]);case 7:return new s(l[0],l[1],l[2],l[3],l[4],l[5],l[6])}var u=rr(s.prototype),y=s.apply(u,l);return Oe(y)?y:u}}function sx(s,l,u){var y=Jr(s);function _(){for(var P=arguments.length,T=U(P),Z=P,F=ar(_);Z--;)T[Z]=arguments[Z];var B=P<3&&T[0]!==F&&T[P-1]!==F?[]:sn(T,F);if(P-=B.length,P<u)return ud(s,l,ro,_.placeholder,t,T,B,t,t,u-P);var R=this&&this!==lt&&this instanceof _?y:s;return Ft(R,this,T)}return _}function ad(s){return function(l,u,y){var _=Ge(l);if(!Tt(l)){var P=se(u,3);l=Ee(l),u=function(Z){return P(_[Z],Z,_)}}var T=s(l,u,y);return T>-1?_[P?l[T]:T]:t}}function ld(s){return Vi(function(l){var u=l.length,y=u,_=Qt.prototype.thru;for(s&&l.reverse();y--;){var P=l[y];if(typeof P!="function")throw new Jt(a);if(_&&!T&&lo(P)=="wrapper")var T=new Qt([],!0)}for(y=T?y:u;++y<u;){P=l[y];var Z=lo(P),F=Z=="wrapper"?fl(P):t;F&&yl(F[0])&&F[1]==(X|C|z|I)&&!F[4].length&&F[9]==1?T=T[lo(F[0])].apply(T,F[3]):T=P.length==1&&yl(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,$=u?l[J].apply(this,B):R;++J<u;)$=l[J].call(this,$);return $}})}function ro(s,l,u,y,_,P,T,Z,F,B){var R=l&X,J=l&x,$=l&L,te=l&(C|W),oe=l&K,me=$?t:Jr(s);function ae(){for(var we=arguments.length,xe=U(we),Xt=we;Xt--;)xe[Xt]=arguments[Xt];if(te)var bt=ar(ae),Ut=yb(xe,bt);if(y&&(xe=id(xe,y,_,te)),P&&(xe=nd(xe,P,T,te)),we-=Ut,te&&we<B){var Ne=sn(xe,bt);return ud(s,l,ro,ae.placeholder,u,xe,Ne,Z,F,B-we)}var ui=J?u:this,Oi=$?ui[s]:s;return we=xe.length,Z?xe=Lx(xe,Z):oe&&we>1&&xe.reverse(),R&&F<we&&(xe.length=F),this&&this!==lt&&this instanceof ae&&(Oi=me||Jr(Oi)),Oi.apply(ui,xe)}return ae}function cd(s,l){return function(u,y){return I1(u,s,l(y),{})}}function so(s,l){return function(u,y){var _;if(u===t&&y===t)return l;if(u!==t&&(_=u),y!==t){if(_===t)return y;typeof u=="string"||typeof y=="string"?(u=Dt(u),y=Dt(y)):(u=Ju(u),y=Ju(y)),_=s(u,y)}return _}}function cl(s){return Vi(function(l){return l=Fe(l,Ot(se())),ye(function(u){var y=this;return s(l,function(_){return Ft(_,y,u)})})})}function oo(s,l){l=l===t?" ":Dt(l);var u=l.length;if(u<2)return u?il(l,s):l;var y=il(l,Rs(s/qn(l)));return $n(l)?hn(li(y),0,s).join(""):y.slice(0,s)}function ox(s,l,u,y){var _=l&x,P=Jr(s);function T(){for(var Z=-1,F=arguments.length,B=-1,R=y.length,J=U(R+F),$=this&&this!==lt&&this instanceof T?P:s;++B<R;)J[B]=y[B];for(;F--;)J[B++]=arguments[++Z];return Ft($,_?u:this,J)}return T}function hd(s){return function(l,u,y){return y&&typeof y!="number"&&wt(l,u,y)&&(u=y=t),l=Fi(l),u===t?(u=l,l=0):u=Fi(u),y=y===t?l<u?1:-1:Fi(y),Y1(l,u,y,s)}}function ao(s){return function(l,u){return typeof l=="string"&&typeof u=="string"||(l=qt(l),u=qt(u)),s(l,u)}}function ud(s,l,u,y,_,P,T,Z,F,B){var R=l&C,J=R?T:t,$=R?t:T,te=R?P:t,oe=R?t:P;l|=R?z:D,l&=~(R?D:z),l&M||(l&=-4);var me=[s,l,_,te,J,oe,$,Z,F,B],ae=u.apply(t,me);return yl(s)&&Md(ae,me),ae.placeholder=y,Sd(ae,s,l)}function hl(s){var l=Je[s];return function(u,y){if(u=qt(u),y=y==null?0:mt(pe(y),292),y&&Su(u)){var _=(Pe(u)+"e").split("e"),P=l(_[0]+"e"+(+_[1]+y));return _=(Pe(P)+"e").split("e"),+(_[0]+"e"+(+_[1]-y))}return l(u)}}var ax=ir&&1/Os(new ir([,-0]))[1]==re?function(s){return new ir(s)}:Vl;function dd(s){return function(l){var u=gt(l);return u==Ce?Ua(l):u==At?Sb(l):gb(l,s(l))}}function Zi(s,l,u,y,_,P,T,Z){var F=l&L;if(!F&&typeof s!="function")throw new Jt(a);var B=y?y.length:0;if(B||(l&=-97,y=_=t),T=T===t?T:Qe(pe(T),0),Z=Z===t?Z:pe(Z),B-=_?_.length:0,l&D){var R=y,J=_;y=_=t}var $=F?t:fl(s),te=[s,l,u,y,_,R,J,P,T,Z];if($&&xx(te,$),s=te[0],l=te[1],u=te[2],y=te[3],_=te[4],Z=te[9]=te[9]===t?F?0:s.length:Qe(te[9]-B,0),!Z&&l&(C|W)&&(l&=-25),!l||l==x)var oe=rx(s,l,u);else l==C||l==W?oe=sx(s,l,Z):(l==z||l==(x|z))&&!_.length?oe=ox(s,l,u,y):oe=ro.apply(t,te);var me=$?Ru:Md;return Sd(me(oe,te),s,l)}function fd(s,l,u,y){return s===t||hi(s,tr[u])&&!Te.call(y,u)?l:s}function pd(s,l,u,y,_,P){return Oe(s)&&Oe(l)&&(P.set(l,s),eo(s,l,t,pd,P),P.delete(l)),s}function lx(s){return Er(s)?t:s}function md(s,l,u,y,_,P){var T=u&w,Z=s.length,F=l.length;if(Z!=F&&!(T&&F>Z))return!1;var B=P.get(s),R=P.get(l);if(B&&R)return B==l&&R==s;var J=-1,$=!0,te=u&b?new Zn:t;for(P.set(s,l),P.set(l,s);++J<Z;){var oe=s[J],me=l[J];if(y)var ae=T?y(me,oe,J,l,s,P):y(oe,me,J,s,l,P);if(ae!==t){if(ae)continue;$=!1;break}if(te){if(!Aa(l,function(we,xe){if(!Dr(te,xe)&&(oe===we||_(oe,we,u,y,P)))return te.push(xe)})){$=!1;break}}else if(!(oe===me||_(oe,me,u,y,P))){$=!1;break}}return P.delete(s),P.delete(l),$}function cx(s,l,u,y,_,P,T){switch(u){case wi:if(s.byteLength!=l.byteLength||s.byteOffset!=l.byteOffset)return!1;s=s.buffer,l=l.buffer;case en:return!(s.byteLength!=l.byteLength||!P(new Ks(s),new Ks(l)));case Re:case je:case at:return hi(+s,+l);case Xe:return s.name==l.name&&s.message==l.message;case xn:case $i:return s==l+"";case Ce:var Z=Ua;case At:var F=y&w;if(Z||(Z=Os),s.size!=l.size&&!F)return!1;var B=T.get(s);if(B)return B==l;y|=b,T.set(s,l);var R=md(Z(s),Z(l),y,_,P,T);return T.delete(s),R;case qi:if(Kr)return Kr.call(s)==Kr.call(l)}return!1}function hx(s,l,u,y,_,P){var T=u&w,Z=ul(s),F=Z.length,B=ul(l),R=B.length;if(F!=R&&!T)return!1;for(var J=F;J--;){var $=Z[J];if(!(T?$ in l:Te.call(l,$)))return!1}var te=P.get(s),oe=P.get(l);if(te&&oe)return te==l&&oe==s;var me=!0;P.set(s,l),P.set(l,s);for(var ae=T;++J<F;){$=Z[J];var we=s[$],xe=l[$];if(y)var Xt=T?y(xe,we,$,l,s,P):y(we,xe,$,s,l,P);if(!(Xt===t?we===xe||_(we,xe,u,y,P):Xt)){me=!1;break}ae||(ae=$=="constructor")}if(me&&!ae){var bt=s.constructor,Ut=l.constructor;bt!=Ut&&"constructor"in s&&"constructor"in l&&!(typeof bt=="function"&&bt instanceof bt&&typeof Ut=="function"&&Ut instanceof Ut)&&(me=!1)}return P.delete(s),P.delete(l),me}function Vi(s){return _l(bd(s,t,Wd),s+"")}function ul(s){return Fu(s,Ee,ml)}function dl(s){return Fu(s,Gt,gd)}var fl=Js?function(s){return Js.get(s)}:Vl;function lo(s){for(var l=s.name+"",u=nr[l],y=Te.call(nr,l)?u.length:0;y--;){var _=u[y],P=_.func;if(P==null||P==s)return _.name}return l}function ar(s){var l=Te.call(S,"placeholder")?S:s;return l.placeholder}function se(){var s=S.iteratee||Wl;return s=s===Wl?zu:s,arguments.length?s(arguments[0],arguments[1]):s}function co(s,l){var u=s.__data__;return vx(l)?u[typeof l=="string"?"string":"hash"]:u.map}function pl(s){for(var l=Ee(s),u=l.length;u--;){var y=l[u],_=s[y];l[u]=[y,_,_d(_)]}return l}function An(s,l){var u=bb(s,l);return Du(u)?u:t}function ux(s){var l=Te.call(s,Gn),u=s[Gn];try{s[Gn]=t;var y=!0}catch{}var _=Us.call(s);return y&&(l?s[Gn]=u:delete s[Gn]),_}var ml=Ka?function(s){return s==null?[]:(s=Ge(s),nn(Ka(s),function(l){return xu.call(s,l)}))}:Il,gd=Ka?function(s){for(var l=[];s;)rn(l,ml(s)),s=Ns(s);return l}:Il,gt=_t;(Na&&gt(new Na(new ArrayBuffer(1)))!=wi||Xr&&gt(new Xr)!=Ce||Ba&&gt(Ba.resolve())!=bn||ir&&gt(new ir)!=At||Ur&&gt(new Ur)!=Sn)&&(gt=function(s){var l=_t(s),u=l==Pt?s.constructor:t,y=u?Fn(u):"";if(y)switch(y){case jb:return wi;case Jb:return Ce;case Qb:return bn;case Hb:return At;case Eb:return Sn}return l});function dx(s,l,u){for(var y=-1,_=u.length;++y<_;){var P=u[y],T=P.size;switch(P.type){case"drop":s+=T;break;case"dropRight":l-=T;break;case"take":l=mt(l,s+T);break;case"takeRight":s=Qe(s,l-T);break}}return{start:s,end:l}}function fx(s){var l=s.match(_w);return l?l[1].split(ww):[]}function yd(s,l,u){l=cn(l,s);for(var y=-1,_=l.length,P=!1;++y<_;){var T=Mi(l[y]);if(!(P=s!=null&&u(s,T)))break;s=s[T]}return P||++y!=_?P:(_=s==null?0:s.length,!!_&&yo(_)&&Ii(T,_)&&(ue(s)||On(s)))}function px(s){var l=s.length,u=new s.constructor(l);return l&&typeof s[0]=="string"&&Te.call(s,"index")&&(u.index=s.index,u.input=s.input),u}function vd(s){return typeof s.constructor=="function"&&!Qr(s)?rr(Ns(s)):{}}function mx(s,l,u){var y=s.constructor;switch(l){case en:return ll(s);case Re:case je:return new y(+s);case wi:return $1(s,u);case Ir:case Ar:case jn:case Fr:case Or:case Jn:case Ln:case O:case E:return ed(s,u);case Ce:return new y;case at:case $i:return new y(s);case xn:return q1(s);case At:return new y;case qi:return ex(s)}}function gx(s,l){var u=l.length;if(!u)return s;var y=u-1;return l[y]=(u>1?"& ":"")+l[y],l=l.join(u>2?", ":" "),s.replace(vw,`{
976
976
  /* [wrapped with `+l+`] */
977
977
  `)}function yx(s){return ue(s)||On(s)||!!(Mu&&s&&s[Mu])}function Ii(s,l){var u=typeof s;return l=l??ne,!!l&&(u=="number"||u!="symbol"&&Gw.test(s))&&s>-1&&s%1==0&&s<l}function wt(s,l,u){if(!Oe(u))return!1;var y=typeof l;return(y=="number"?Tt(u)&&Ii(l,u.length):y=="string"&&l in u)?hi(u[l],s):!1}function gl(s,l){if(ue(s))return!1;var u=typeof s;return u=="number"||u=="symbol"||u=="boolean"||s==null||zt(s)?!0:Cn.test(s)||!Pn.test(s)||l!=null&&s in Ge(l)}function vx(s){var l=typeof s;return l=="string"||l=="number"||l=="symbol"||l=="boolean"?s!=="__proto__":s===null}function yl(s){var l=lo(s),u=S[l];if(typeof u!="function"||!(l in be.prototype))return!1;if(s===u)return!0;var y=fl(u);return!!y&&s===y[0]}function _x(s){return!!_u&&_u in s}var wx=zs?Ai:Al;function Qr(s){var l=s&&s.constructor,u=typeof l=="function"&&l.prototype||tr;return s===u}function _d(s){return s===s&&!Oe(s)}function wd(s,l){return function(u){return u==null?!1:u[s]===l&&(l!==t||s in Ge(u))}}function bx(s){var l=mo(s,function(y){return u.size===d&&u.clear(),y}),u=l.cache;return l}function xx(s,l){var u=s[1],y=l[1],_=u|y,P=_<(x|L|X),T=y==X&&u==C||y==X&&u==I&&s[7].length<=l[8]||y==(X|I)&&l[7].length<=l[8]&&u==C;if(!(P||T))return s;y&x&&(s[2]=l[2],_|=u&x?0:M);var Z=l[3];if(Z){var F=s[3];s[3]=F?id(F,Z,l[4]):Z,s[4]=F?sn(s[3],m):l[4]}return Z=l[5],Z&&(F=s[5],s[5]=F?nd(F,Z,l[6]):Z,s[6]=F?sn(s[5],m):l[6]),Z=l[7],Z&&(s[7]=Z),y&X&&(s[8]=s[8]==null?l[8]:mt(s[8],l[8])),s[9]==null&&(s[9]=l[9]),s[0]=l[0],s[1]=_,s}function Mx(s){var l=[];if(s!=null)for(var u in Ge(s))l.push(u);return l}function Sx(s){return Us.call(s)}function bd(s,l,u){return l=Qe(l===t?s.length-1:l,0),function(){for(var y=arguments,_=-1,P=Qe(y.length-l,0),T=U(P);++_<P;)T[_]=y[l+_];_=-1;for(var Z=U(l+1);++_<l;)Z[_]=y[_];return Z[l]=u(T),Ft(s,this,Z)}}function xd(s,l){return l.length<2?s:In(s,Et(l,0,-1))}function Lx(s,l){for(var u=s.length,y=mt(l.length,u),_=Ct(s);y--;){var P=l[y];s[y]=Ii(P,u)?_[P]:t}return s}function vl(s,l){if(!(l==="constructor"&&typeof s[l]=="function")&&l!="__proto__")return s[l]}var Md=Ld(Ru),Hr=Ub||function(s,l){return lt.setTimeout(s,l)},_l=Ld(J1);function Sd(s,l,u){var y=l+"";return _l(s,gx(y,Px(fx(y),u)))}function Ld(s){var l=0,u=0;return function(){var y=Bb(),_=j-(y-u);if(u=y,_>0){if(++l>=k)return arguments[0]}else l=0;return s.apply(t,arguments)}}function ho(s,l){var u=-1,y=s.length,_=y-1;for(l=l===t?y:l;++u<l;){var P=tl(u,_),T=s[P];s[P]=s[u],s[u]=T}return s.length=l,s}var Pd=bx(function(s){var l=[];return s.charCodeAt(0)===46&&l.push(""),s.replace(Qn,function(u,y,_,P){l.push(_?P.replace(Mw,"$1"):y||u)}),l});function Mi(s){if(typeof s=="string"||zt(s))return s;var l=s+"";return l=="0"&&1/s==-re?"-0":l}function Fn(s){if(s!=null){try{return Xs.call(s)}catch{}try{return s+""}catch{}}return""}function Px(s,l){return jt(rt,function(u){var y="_."+u[0];l&u[1]&&!As(s,y)&&s.push(y)}),s.sort()}function Cd(s){if(s instanceof be)return s.clone();var l=new Qt(s.__wrapped__,s.__chain__);return l.__actions__=Ct(s.__actions__),l.__index__=s.__index__,l.__values__=s.__values__,l}function Cx(s,l,u){(u?wt(s,l,u):l===t)?l=1:l=Qe(pe(l),0);var y=s==null?0:s.length;if(!y||l<1)return[];for(var _=0,P=0,T=U(Rs(y/l));_<y;)T[P++]=Et(s,_,_+=l);return T}function Tx(s){for(var l=-1,u=s==null?0:s.length,y=0,_=[];++l<u;){var P=s[l];P&&(_[y++]=P)}return _}function Gx(){var s=arguments.length;if(!s)return[];for(var l=U(s-1),u=arguments[0],y=s;y--;)l[y-1]=arguments[y];return rn(ue(u)?Ct(u):[u],ct(l,1))}var Wx=ye(function(s,l){return Ke(s)?Br(s,ct(l,1,Ke,!0)):[]}),Zx=ye(function(s,l){var u=$t(l);return Ke(u)&&(u=t),Ke(s)?Br(s,ct(l,1,Ke,!0),se(u,2)):[]}),Vx=ye(function(s,l){var u=$t(l);return Ke(u)&&(u=t),Ke(s)?Br(s,ct(l,1,Ke,!0),t,u):[]});function Ix(s,l,u){var y=s==null?0:s.length;return y?(l=u||l===t?1:pe(l),Et(s,l<0?0:l,y)):[]}function Ax(s,l,u){var y=s==null?0:s.length;return y?(l=u||l===t?1:pe(l),l=y-l,Et(s,0,l<0?0:l)):[]}function Fx(s,l){return s&&s.length?io(s,se(l,3),!0,!0):[]}function Ox(s,l){return s&&s.length?io(s,se(l,3),!0):[]}function Dx(s,l,u,y){var _=s==null?0:s.length;return _?(u&&typeof u!="number"&&wt(s,l,u)&&(u=0,y=_),G1(s,l,u,y)):[]}function Td(s,l,u){var y=s==null?0:s.length;if(!y)return-1;var _=u==null?0:pe(u);return _<0&&(_=Qe(y+_,0)),Fs(s,se(l,3),_)}function Gd(s,l,u){var y=s==null?0:s.length;if(!y)return-1;var _=y-1;return u!==t&&(_=pe(u),_=u<0?Qe(y+_,0):mt(_,y-1)),Fs(s,se(l,3),_,!0)}function Wd(s){var l=s==null?0:s.length;return l?ct(s,1):[]}function zx(s){var l=s==null?0:s.length;return l?ct(s,re):[]}function Xx(s,l){var u=s==null?0:s.length;return u?(l=l===t?1:pe(l),ct(s,l)):[]}function Ux(s){for(var l=-1,u=s==null?0:s.length,y={};++l<u;){var _=s[l];y[_[0]]=_[1]}return y}function Zd(s){return s&&s.length?s[0]:t}function kx(s,l,u){var y=s==null?0:s.length;if(!y)return-1;var _=u==null?0:pe(u);return _<0&&(_=Qe(y+_,0)),En(s,l,_)}function Kx(s){var l=s==null?0:s.length;return l?Et(s,0,-1):[]}var Nx=ye(function(s){var l=Fe(s,ol);return l.length&&l[0]===s[0]?Ha(l):[]}),Bx=ye(function(s){var l=$t(s),u=Fe(s,ol);return l===$t(u)?l=t:u.pop(),u.length&&u[0]===s[0]?Ha(u,se(l,2)):[]}),Yx=ye(function(s){var l=$t(s),u=Fe(s,ol);return l=typeof l=="function"?l:t,l&&u.pop(),u.length&&u[0]===s[0]?Ha(u,t,l):[]});function Rx(s,l){return s==null?"":Kb.call(s,l)}function $t(s){var l=s==null?0:s.length;return l?s[l-1]:t}function jx(s,l,u){var y=s==null?0:s.length;if(!y)return-1;var _=y;return u!==t&&(_=pe(u),_=_<0?Qe(y+_,0):mt(_,y-1)),l===l?Pb(s,l,_):Fs(s,uu,_,!0)}function Jx(s,l){return s&&s.length?Ku(s,pe(l)):t}var Qx=ye(Vd);function Vd(s,l){return s&&s.length&&l&&l.length?el(s,l):s}function Hx(s,l,u){return s&&s.length&&l&&l.length?el(s,l,se(u,2)):s}function Ex(s,l,u){return s&&s.length&&l&&l.length?el(s,l,t,u):s}var $x=Vi(function(s,l){var u=s==null?0:s.length,y=Ra(s,l);return Yu(s,Fe(l,function(_){return Ii(_,u)?+_:_}).sort(td)),y});function qx(s,l){var u=[];if(!(s&&s.length))return u;var y=-1,_=[],P=s.length;for(l=se(l,3);++y<P;){var T=s[y];l(T,y,s)&&(u.push(T),_.push(y))}return Yu(s,_),u}function wl(s){return s==null?s:Rb.call(s)}function eM(s,l,u){var y=s==null?0:s.length;return y?(u&&typeof u!="number"&&wt(s,l,u)?(l=0,u=y):(l=l==null?0:pe(l),u=u===t?y:pe(u)),Et(s,l,u)):[]}function tM(s,l){return to(s,l)}function iM(s,l,u){return nl(s,l,se(u,2))}function nM(s,l){var u=s==null?0:s.length;if(u){var y=to(s,l);if(y<u&&hi(s[y],l))return y}return-1}function rM(s,l){return to(s,l,!0)}function sM(s,l,u){return nl(s,l,se(u,2),!0)}function oM(s,l){var u=s==null?0:s.length;if(u){var y=to(s,l,!0)-1;if(hi(s[y],l))return y}return-1}function aM(s){return s&&s.length?ju(s):[]}function lM(s,l){return s&&s.length?ju(s,se(l,2)):[]}function cM(s){var l=s==null?0:s.length;return l?Et(s,1,l):[]}function hM(s,l,u){return s&&s.length?(l=u||l===t?1:pe(l),Et(s,0,l<0?0:l)):[]}function uM(s,l,u){var y=s==null?0:s.length;return y?(l=u||l===t?1:pe(l),l=y-l,Et(s,l<0?0:l,y)):[]}function dM(s,l){return s&&s.length?io(s,se(l,3),!1,!0):[]}function fM(s,l){return s&&s.length?io(s,se(l,3)):[]}var pM=ye(function(s){return ln(ct(s,1,Ke,!0))}),mM=ye(function(s){var l=$t(s);return Ke(l)&&(l=t),ln(ct(s,1,Ke,!0),se(l,2))}),gM=ye(function(s){var l=$t(s);return l=typeof l=="function"?l:t,ln(ct(s,1,Ke,!0),t,l)});function yM(s){return s&&s.length?ln(s):[]}function vM(s,l){return s&&s.length?ln(s,se(l,2)):[]}function _M(s,l){return l=typeof l=="function"?l:t,s&&s.length?ln(s,t,l):[]}function bl(s){if(!(s&&s.length))return[];var l=0;return s=nn(s,function(u){if(Ke(u))return l=Qe(u.length,l),!0}),za(l,function(u){return Fe(s,Fa(u))})}function Id(s,l){if(!(s&&s.length))return[];var u=bl(s);return l==null?u:Fe(u,function(y){return Ft(l,t,y)})}var wM=ye(function(s,l){return Ke(s)?Br(s,l):[]}),bM=ye(function(s){return sl(nn(s,Ke))}),xM=ye(function(s){var l=$t(s);return Ke(l)&&(l=t),sl(nn(s,Ke),se(l,2))}),MM=ye(function(s){var l=$t(s);return l=typeof l=="function"?l:t,sl(nn(s,Ke),t,l)}),SM=ye(bl);function LM(s,l){return Eu(s||[],l||[],Nr)}function PM(s,l){return Eu(s||[],l||[],jr)}var CM=ye(function(s){var l=s.length,u=l>1?s[l-1]:t;return u=typeof u=="function"?(s.pop(),u):t,Id(s,u)});function Ad(s){var l=S(s);return l.__chain__=!0,l}function TM(s,l){return l(s),s}function uo(s,l){return l(s)}var GM=Vi(function(s){var l=s.length,u=l?s[0]:0,y=this.__wrapped__,_=function(P){return Ra(P,s)};return l>1||this.__actions__.length||!(y instanceof be)||!Ii(u)?this.thru(_):(y=y.slice(u,+u+(l?1:0)),y.__actions__.push({func:uo,args:[_],thisArg:t}),new Qt(y,this.__chain__).thru(function(P){return l&&!P.length&&P.push(t),P}))});function WM(){return Ad(this)}function ZM(){return new Qt(this.value(),this.__chain__)}function VM(){this.__values__===t&&(this.__values__=Jd(this.value()));var s=this.__index__>=this.__values__.length,l=s?t:this.__values__[this.__index__++];return{done:s,value:l}}function IM(){return this}function AM(s){for(var l,u=this;u instanceof Hs;){var y=Cd(u);y.__index__=0,y.__values__=t,l?_.__wrapped__=y:l=y;var _=y;u=u.__wrapped__}return _.__wrapped__=s,l}function FM(){var s=this.__wrapped__;if(s instanceof be){var l=s;return this.__actions__.length&&(l=new be(this)),l=l.reverse(),l.__actions__.push({func:uo,args:[wl],thisArg:t}),new Qt(l,this.__chain__)}return this.thru(wl)}function OM(){return Hu(this.__wrapped__,this.__actions__)}var DM=no(function(s,l,u){Te.call(s,u)?++s[u]:Wi(s,u,1)});function zM(s,l,u){var y=ue(s)?cu:T1;return u&&wt(s,l,u)&&(l=t),y(s,se(l,3))}function XM(s,l){var u=ue(s)?nn:Iu;return u(s,se(l,3))}var UM=ad(Td),kM=ad(Gd);function KM(s,l){return ct(fo(s,l),1)}function NM(s,l){return ct(fo(s,l),re)}function BM(s,l,u){return u=u===t?1:pe(u),ct(fo(s,l),u)}function Fd(s,l){var u=ue(s)?jt:an;return u(s,se(l,3))}function Od(s,l){var u=ue(s)?cb:Vu;return u(s,se(l,3))}var YM=no(function(s,l,u){Te.call(s,u)?s[u].push(l):Wi(s,u,[l])});function RM(s,l,u,y){s=Tt(s)?s:cr(s),u=u&&!y?pe(u):0;var _=s.length;return u<0&&(u=Qe(_+u,0)),vo(s)?u<=_&&s.indexOf(l,u)>-1:!!_&&En(s,l,u)>-1}var jM=ye(function(s,l,u){var y=-1,_=typeof l=="function",P=Tt(s)?U(s.length):[];return an(s,function(T){P[++y]=_?Ft(l,T,u):Yr(T,l,u)}),P}),JM=no(function(s,l,u){Wi(s,u,l)});function fo(s,l){var u=ue(s)?Fe:Xu;return u(s,se(l,3))}function QM(s,l,u,y){return s==null?[]:(ue(l)||(l=l==null?[]:[l]),u=y?t:u,ue(u)||(u=u==null?[]:[u]),Nu(s,l,u))}var HM=no(function(s,l,u){s[u?0:1].push(l)},function(){return[[],[]]});function EM(s,l,u){var y=ue(s)?Ia:fu,_=arguments.length<3;return y(s,se(l,4),u,_,an)}function $M(s,l,u){var y=ue(s)?hb:fu,_=arguments.length<3;return y(s,se(l,4),u,_,Vu)}function qM(s,l){var u=ue(s)?nn:Iu;return u(s,go(se(l,3)))}function eS(s){var l=ue(s)?Tu:R1;return l(s)}function tS(s,l,u){(u?wt(s,l,u):l===t)?l=1:l=pe(l);var y=ue(s)?M1:j1;return y(s,l)}function iS(s){var l=ue(s)?S1:Q1;return l(s)}function nS(s){if(s==null)return 0;if(Tt(s))return vo(s)?qn(s):s.length;var l=gt(s);return l==Ce||l==At?s.size:$a(s).length}function rS(s,l,u){var y=ue(s)?Aa:H1;return u&&wt(s,l,u)&&(l=t),y(s,se(l,3))}var sS=ye(function(s,l){if(s==null)return[];var u=l.length;return u>1&&wt(s,l[0],l[1])?l=[]:u>2&&wt(l[0],l[1],l[2])&&(l=[l[0]]),Nu(s,ct(l,1),[])}),po=Xb||function(){return lt.Date.now()};function oS(s,l){if(typeof l!="function")throw new Jt(a);return s=pe(s),function(){if(--s<1)return l.apply(this,arguments)}}function Dd(s,l,u){return l=u?t:l,l=s&&l==null?s.length:l,Zi(s,X,t,t,t,t,l)}function zd(s,l){var u;if(typeof l!="function")throw new Jt(a);return s=pe(s),function(){return--s>0&&(u=l.apply(this,arguments)),s<=1&&(l=t),u}}var xl=ye(function(s,l,u){var y=x;if(u.length){var _=sn(u,ar(xl));y|=z}return Zi(s,y,l,u,_)}),Xd=ye(function(s,l,u){var y=x|L;if(u.length){var _=sn(u,ar(Xd));y|=z}return Zi(l,y,s,u,_)});function Ud(s,l,u){l=u?t:l;var y=Zi(s,C,t,t,t,t,t,l);return y.placeholder=Ud.placeholder,y}function kd(s,l,u){l=u?t:l;var y=Zi(s,W,t,t,t,t,t,l);return y.placeholder=kd.placeholder,y}function Kd(s,l,u){var y,_,P,T,Z,F,B=0,R=!1,J=!1,$=!0;if(typeof s!="function")throw new Jt(a);l=qt(l)||0,Oe(u)&&(R=!!u.leading,J="maxWait"in u,P=J?Qe(qt(u.maxWait)||0,l):P,$="trailing"in u?!!u.trailing:$);function te(Ne){var ui=y,Oi=_;return y=_=t,B=Ne,T=s.apply(Oi,ui),T}function oe(Ne){return B=Ne,Z=Hr(we,l),R?te(Ne):T}function me(Ne){var ui=Ne-F,Oi=Ne-B,lf=l-ui;return J?mt(lf,P-Oi):lf}function ae(Ne){var ui=Ne-F,Oi=Ne-B;return F===t||ui>=l||ui<0||J&&Oi>=P}function we(){var Ne=po();if(ae(Ne))return xe(Ne);Z=Hr(we,me(Ne))}function xe(Ne){return Z=t,$&&y?te(Ne):(y=_=t,T)}function Xt(){Z!==t&&$u(Z),B=0,y=F=_=Z=t}function bt(){return Z===t?T:xe(po())}function Ut(){var Ne=po(),ui=ae(Ne);if(y=arguments,_=this,F=Ne,ui){if(Z===t)return oe(F);if(J)return $u(Z),Z=Hr(we,l),te(F)}return Z===t&&(Z=Hr(we,l)),T}return Ut.cancel=Xt,Ut.flush=bt,Ut}var aS=ye(function(s,l){return Zu(s,1,l)}),lS=ye(function(s,l,u){return Zu(s,qt(l)||0,u)});function cS(s){return Zi(s,K)}function mo(s,l){if(typeof s!="function"||l!=null&&typeof l!="function")throw new Jt(a);var u=function(){var y=arguments,_=l?l.apply(this,y):y[0],P=u.cache;if(P.has(_))return P.get(_);var T=s.apply(this,y);return u.cache=P.set(_,T)||P,T};return u.cache=new(mo.Cache||Gi),u}mo.Cache=Gi;function go(s){if(typeof s!="function")throw new Jt(a);return function(){var l=arguments;switch(l.length){case 0:return!s.call(this);case 1:return!s.call(this,l[0]);case 2:return!s.call(this,l[0],l[1]);case 3:return!s.call(this,l[0],l[1],l[2])}return!s.apply(this,l)}}function hS(s){return zd(2,s)}var uS=E1(function(s,l){l=l.length==1&&ue(l[0])?Fe(l[0],Ot(se())):Fe(ct(l,1),Ot(se()));var u=l.length;return ye(function(y){for(var _=-1,P=mt(y.length,u);++_<P;)y[_]=l[_].call(this,y[_]);return Ft(s,this,y)})}),Ml=ye(function(s,l){var u=sn(l,ar(Ml));return Zi(s,z,t,l,u)}),Nd=ye(function(s,l){var u=sn(l,ar(Nd));return Zi(s,D,t,l,u)}),dS=Vi(function(s,l){return Zi(s,I,t,t,t,l)});function fS(s,l){if(typeof s!="function")throw new Jt(a);return l=l===t?l:pe(l),ye(s,l)}function pS(s,l){if(typeof s!="function")throw new Jt(a);return l=l==null?0:Qe(pe(l),0),ye(function(u){var y=u[l],_=hn(u,0,l);return y&&rn(_,y),Ft(s,this,_)})}function mS(s,l,u){var y=!0,_=!0;if(typeof s!="function")throw new Jt(a);return Oe(u)&&(y="leading"in u?!!u.leading:y,_="trailing"in u?!!u.trailing:_),Kd(s,l,{leading:y,maxWait:l,trailing:_})}function gS(s){return Dd(s,1)}function yS(s,l){return Ml(al(l),s)}function vS(){if(!arguments.length)return[];var s=arguments[0];return ue(s)?s:[s]}function _S(s){return Ht(s,v)}function wS(s,l){return l=typeof l=="function"?l:t,Ht(s,v,l)}function bS(s){return Ht(s,f|v)}function xS(s,l){return l=typeof l=="function"?l:t,Ht(s,f|v,l)}function MS(s,l){return l==null||Wu(s,l,Ee(l))}function hi(s,l){return s===l||s!==s&&l!==l}var SS=ao(Qa),LS=ao(function(s,l){return s>=l}),On=Ou(function(){return arguments}())?Ou:function(s){return Ue(s)&&Te.call(s,"callee")&&!xu.call(s,"callee")},ue=U.isArray,PS=nu?Ot(nu):A1;function Tt(s){return s!=null&&yo(s.length)&&!Ai(s)}function Ke(s){return Ue(s)&&Tt(s)}function CS(s){return s===!0||s===!1||Ue(s)&&_t(s)==Re}var un=kb||Al,TS=ru?Ot(ru):F1;function GS(s){return Ue(s)&&s.nodeType===1&&!Er(s)}function WS(s){if(s==null)return!0;if(Tt(s)&&(ue(s)||typeof s=="string"||typeof s.splice=="function"||un(s)||lr(s)||On(s)))return!s.length;var l=gt(s);if(l==Ce||l==At)return!s.size;if(Qr(s))return!$a(s).length;for(var u in s)if(Te.call(s,u))return!1;return!0}function ZS(s,l){return Rr(s,l)}function VS(s,l,u){u=typeof u=="function"?u:t;var y=u?u(s,l):t;return y===t?Rr(s,l,t,u):!!y}function Sl(s){if(!Ue(s))return!1;var l=_t(s);return l==Xe||l==ot||typeof s.message=="string"&&typeof s.name=="string"&&!Er(s)}function IS(s){return typeof s=="number"&&Su(s)}function Ai(s){if(!Oe(s))return!1;var l=_t(s);return l==It||l==Bt||l==He||l==Rn}function Bd(s){return typeof s=="number"&&s==pe(s)}function yo(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=ne}function Oe(s){var l=typeof s;return s!=null&&(l=="object"||l=="function")}function Ue(s){return s!=null&&typeof s=="object"}var Yd=su?Ot(su):D1;function AS(s,l){return s===l||Ea(s,l,pl(l))}function FS(s,l,u){return u=typeof u=="function"?u:t,Ea(s,l,pl(l),u)}function OS(s){return Rd(s)&&s!=+s}function DS(s){if(wx(s))throw new he(o);return Du(s)}function zS(s){return s===null}function XS(s){return s==null}function Rd(s){return typeof s=="number"||Ue(s)&&_t(s)==at}function Er(s){if(!Ue(s)||_t(s)!=Pt)return!1;var l=Ns(s);if(l===null)return!0;var u=Te.call(l,"constructor")&&l.constructor;return typeof u=="function"&&u instanceof u&&Xs.call(u)==Fb}var Ll=ou?Ot(ou):z1;function US(s){return Bd(s)&&s>=-ne&&s<=ne}var jd=au?Ot(au):X1;function vo(s){return typeof s=="string"||!ue(s)&&Ue(s)&&_t(s)==$i}function zt(s){return typeof s=="symbol"||Ue(s)&&_t(s)==qi}var lr=lu?Ot(lu):U1;function kS(s){return s===t}function KS(s){return Ue(s)&&gt(s)==Sn}function NS(s){return Ue(s)&&_t(s)==xa}var BS=ao(qa),YS=ao(function(s,l){return s<=l});function Jd(s){if(!s)return[];if(Tt(s))return vo(s)?li(s):Ct(s);if(zr&&s[zr])return Mb(s[zr]());var l=gt(s),u=l==Ce?Ua:l==At?Os:cr;return u(s)}function Fi(s){if(!s)return s===0?s:0;if(s=qt(s),s===re||s===-re){var l=s<0?-1:1;return l*le}return s===s?s:0}function pe(s){var l=Fi(s),u=l%1;return l===l?u?l-u:l:0}function Qd(s){return s?Vn(pe(s),0,ge):0}function qt(s){if(typeof s=="number")return s;if(zt(s))return de;if(Oe(s)){var l=typeof s.valueOf=="function"?s.valueOf():s;s=Oe(l)?l+"":l}if(typeof s!="string")return s===0?s:+s;s=pu(s);var u=Pw.test(s);return u||Tw.test(s)?ob(s.slice(2),u?2:8):Lw.test(s)?de:+s}function Hd(s){return xi(s,Gt(s))}function RS(s){return s?Vn(pe(s),-ne,ne):s===0?s:0}function Pe(s){return s==null?"":Dt(s)}var jS=sr(function(s,l){if(Qr(l)||Tt(l)){xi(l,Ee(l),s);return}for(var u in l)Te.call(l,u)&&Nr(s,u,l[u])}),Ed=sr(function(s,l){xi(l,Gt(l),s)}),_o=sr(function(s,l,u,y){xi(l,Gt(l),s,y)}),JS=sr(function(s,l,u,y){xi(l,Ee(l),s,y)}),QS=Vi(Ra);function HS(s,l){var u=rr(s);return l==null?u:Gu(u,l)}var ES=ye(function(s,l){s=Ge(s);var u=-1,y=l.length,_=y>2?l[2]:t;for(_&&wt(l[0],l[1],_)&&(y=1);++u<y;)for(var P=l[u],T=Gt(P),Z=-1,F=T.length;++Z<F;){var B=T[Z],R=s[B];(R===t||hi(R,tr[B])&&!Te.call(s,B))&&(s[B]=P[B])}return s}),$S=ye(function(s){return s.push(t,pd),Ft($d,t,s)});function qS(s,l){return hu(s,se(l,3),bi)}function e2(s,l){return hu(s,se(l,3),Ja)}function t2(s,l){return s==null?s:ja(s,se(l,3),Gt)}function i2(s,l){return s==null?s:Au(s,se(l,3),Gt)}function n2(s,l){return s&&bi(s,se(l,3))}function r2(s,l){return s&&Ja(s,se(l,3))}function s2(s){return s==null?[]:qs(s,Ee(s))}function o2(s){return s==null?[]:qs(s,Gt(s))}function Pl(s,l,u){var y=s==null?t:In(s,l);return y===t?u:y}function a2(s,l){return s!=null&&yd(s,l,W1)}function Cl(s,l){return s!=null&&yd(s,l,Z1)}var l2=cd(function(s,l,u){l!=null&&typeof l.toString!="function"&&(l=Us.call(l)),s[l]=u},Gl(Wt)),c2=cd(function(s,l,u){l!=null&&typeof l.toString!="function"&&(l=Us.call(l)),Te.call(s,l)?s[l].push(u):s[l]=[u]},se),h2=ye(Yr);function Ee(s){return Tt(s)?Cu(s):$a(s)}function Gt(s){return Tt(s)?Cu(s,!0):k1(s)}function u2(s,l){var u={};return l=se(l,3),bi(s,function(y,_,P){Wi(u,l(y,_,P),y)}),u}function d2(s,l){var u={};return l=se(l,3),bi(s,function(y,_,P){Wi(u,_,l(y,_,P))}),u}var f2=sr(function(s,l,u){eo(s,l,u)}),$d=sr(function(s,l,u,y){eo(s,l,u,y)}),p2=Vi(function(s,l){var u={};if(s==null)return u;var y=!1;l=Fe(l,function(P){return P=cn(P,s),y||(y=P.length>1),P}),xi(s,dl(s),u),y&&(u=Ht(u,f|g|v,lx));for(var _=l.length;_--;)rl(u,l[_]);return u});function m2(s,l){return qd(s,go(se(l)))}var g2=Vi(function(s,l){return s==null?{}:N1(s,l)});function qd(s,l){if(s==null)return{};var u=Fe(dl(s),function(y){return[y]});return l=se(l),Bu(s,u,function(y,_){return l(y,_[0])})}function y2(s,l,u){l=cn(l,s);var y=-1,_=l.length;for(_||(_=1,s=t);++y<_;){var P=s==null?t:s[Mi(l[y])];P===t&&(y=_,P=u),s=Ai(P)?P.call(s):P}return s}function v2(s,l,u){return s==null?s:jr(s,l,u)}function _2(s,l,u,y){return y=typeof y=="function"?y:t,s==null?s:jr(s,l,u,y)}var ef=dd(Ee),tf=dd(Gt);function w2(s,l,u){var y=ue(s),_=y||un(s)||lr(s);if(l=se(l,4),u==null){var P=s&&s.constructor;_?u=y?new P:[]:Oe(s)?u=Ai(P)?rr(Ns(s)):{}:u={}}return(_?jt:bi)(s,function(T,Z,F){return l(u,T,Z,F)}),u}function b2(s,l){return s==null?!0:rl(s,l)}function x2(s,l,u){return s==null?s:Qu(s,l,al(u))}function M2(s,l,u,y){return y=typeof y=="function"?y:t,s==null?s:Qu(s,l,al(u),y)}function cr(s){return s==null?[]:Xa(s,Ee(s))}function S2(s){return s==null?[]:Xa(s,Gt(s))}function L2(s,l,u){return u===t&&(u=l,l=t),u!==t&&(u=qt(u),u=u===u?u:0),l!==t&&(l=qt(l),l=l===l?l:0),Vn(qt(s),l,u)}function P2(s,l,u){return l=Fi(l),u===t?(u=l,l=0):u=Fi(u),s=qt(s),V1(s,l,u)}function C2(s,l,u){if(u&&typeof u!="boolean"&&wt(s,l,u)&&(l=u=t),u===t&&(typeof l=="boolean"?(u=l,l=t):typeof s=="boolean"&&(u=s,s=t)),s===t&&l===t?(s=0,l=1):(s=Fi(s),l===t?(l=s,s=0):l=Fi(l)),s>l){var y=s;s=l,l=y}if(u||s%1||l%1){var _=Lu();return mt(s+_*(l-s+sb("1e-"+((_+"").length-1))),l)}return tl(s,l)}var T2=or(function(s,l,u){return l=l.toLowerCase(),s+(u?nf(l):l)});function nf(s){return Tl(Pe(s).toLowerCase())}function rf(s){return s=Pe(s),s&&s.replace(Ww,vb).replace(Qw,"")}function G2(s,l,u){s=Pe(s),l=Dt(l);var y=s.length;u=u===t?y:Vn(pe(u),0,y);var _=u;return u-=l.length,u>=0&&s.slice(u,_)==l}function W2(s){return s=Pe(s),s&&Ws.test(s)?s.replace(si,_b):s}function Z2(s){return s=Pe(s),s&&gw.test(s)?s.replace(Ma,"\\$&"):s}var V2=or(function(s,l,u){return s+(u?"-":"")+l.toLowerCase()}),I2=or(function(s,l,u){return s+(u?" ":"")+l.toLowerCase()}),A2=od("toLowerCase");function F2(s,l,u){s=Pe(s),l=pe(l);var y=l?qn(s):0;if(!l||y>=l)return s;var _=(l-y)/2;return oo(js(_),u)+s+oo(Rs(_),u)}function O2(s,l,u){s=Pe(s),l=pe(l);var y=l?qn(s):0;return l&&y<l?s+oo(l-y,u):s}function D2(s,l,u){s=Pe(s),l=pe(l);var y=l?qn(s):0;return l&&y<l?oo(l-y,u)+s:s}function z2(s,l,u){return u||l==null?l=0:l&&(l=+l),Yb(Pe(s).replace(Sa,""),l||0)}function X2(s,l,u){return(u?wt(s,l,u):l===t)?l=1:l=pe(l),il(Pe(s),l)}function U2(){var s=arguments,l=Pe(s[0]);return s.length<3?l:l.replace(s[1],s[2])}var k2=or(function(s,l,u){return s+(u?"_":"")+l.toLowerCase()});function K2(s,l,u){return u&&typeof u!="number"&&wt(s,l,u)&&(l=u=t),u=u===t?ge:u>>>0,u?(s=Pe(s),s&&(typeof l=="string"||l!=null&&!Ll(l))&&(l=Dt(l),!l&&$n(s))?hn(li(s),0,u):s.split(l,u)):[]}var N2=or(function(s,l,u){return s+(u?" ":"")+Tl(l)});function B2(s,l,u){return s=Pe(s),u=u==null?0:Vn(pe(u),0,s.length),l=Dt(l),s.slice(u,u+l.length)==l}function Y2(s,l,u){var y=S.templateSettings;u&&wt(s,l,u)&&(l=t),s=Pe(s),l=_o({},l,y,fd);var _=_o({},l.imports,y.imports,fd),P=Ee(_),T=Xa(_,P),Z,F,B=0,R=l.interpolate||Zs,J="__p += '",$=ka((l.escape||Zs).source+"|"+R.source+"|"+(R===tn?Sw:Zs).source+"|"+(l.evaluate||Zs).source+"|$","g"),te="//# sourceURL="+(Te.call(l,"sourceURL")?(l.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++eb+"]")+`
978
978
  `;s.replace($,function(ae,we,xe,Xt,bt,Ut){return xe||(xe=Xt),J+=s.slice(B,Ut).replace(Zw,wb),we&&(Z=!0,J+=`' +
@@ -1121,7 +1121,7 @@ function print() { __p += __j.call(arguments, '') }
1121
1121
  }
1122
1122
  `)}setDiffusionFromObject(e){if(!this.shaderOption.effects?.diffusion)return;const t=new ht.Box3().setFromObject(e);if(t.isEmpty())return;const i=new ht.Vector3;t.getCenter(i);const n=[new ht.Vector3(t.min.x,t.min.y,t.min.z),new ht.Vector3(t.max.x,t.max.y,t.max.z)];let o=0;n.forEach(a=>{const c=i.distanceTo(a);c>o&&(o=c)}),this.shaderOption.effects.diffusion={...this.shaderOption.effects.diffusion,center:i,maxDistance:o},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 q0=Object.defineProperty,ey=(r,e,t)=>e in r?q0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ii=(r,e,t)=>ey(r,typeof e!="symbol"?e+"":e,t);const ty={emissive:!1,emissiveIntensity:1,emissiveColor:"#ffffff"};class ih extends ti{constructor(e){super(e),ii(this,"_type","Model"),ii(this,"_emissive",!1),ii(this,"_emissiveIntensity",1),ii(this,"_emissiveColor","#ffffff"),ii(this,"_mixer",null),ii(this,"_currentAction",null),ii(this,"_animations",[]),ii(this,"_clock",new p.Clock),ii(this,"_autoUpdate",!0),ii(this,"_animationRequestId",null),ii(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:_c(),targrt:this})}}async _createObject(e){switch(e.config.type){case"fbx":case"gltf":return fg(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 v=m[g],w=m[g+2],b=d.x+v,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 o;if(n.type==="Polygon")o=n.coordinates;else if(n.type==="MultiPolygon"){if(!n.coordinates.length)return null;o=n.coordinates[0]}else return null;if(!o.length||!o[0].length)return null;const a=o[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)),o=n[n.length-1];if(o&&(o.geometry||o.feature)){const a=this._computeOverlayVertices(o);a&&a.length>=3&&(t={color:new p.Color(o.color??"#00FF88"),opacity:o.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 $0({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}),o=new p.Box3().setFromObject(i);n.updateBoundingBox(o.min.y,o.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 o=i.material[n];o&&(o.wrapS=o.wrapT=p.RepeatWrapping,o.repeat.set(.3,.3),o.needsUpdate=!0)}),i.material.normalScale=new p.Vector2(3,3))}})}}ih.mergeOptions(ty);var iy=Object.defineProperty,ny=(r,e,t)=>e in r?iy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ry=(r,e,t)=>ny(r,e+"",t);const sy={};class nh extends ti{constructor(e){super(e),ry(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 vg(e.config,this._position);default:throw new Error(`Unsupported style type: ${e.config.type}`)}}}nh.mergeOptions(sy);var oy=Object.defineProperty,ay=(r,e,t)=>e in r?oy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ly=(r,e,t)=>ay(r,e+"",t);const cy={};class rh extends ti{constructor(e){super(e),ly(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 wg(e.config,new p.Vector3(0,0,0),this.getMap());case"canvas-label":return _g(e.config,new p.Vector3(0,0,0));default:throw new Error(`Unsupported style type: ${e.config.type}`)}}}rh.mergeOptions(cy);var hy=Object.defineProperty,uy=(r,e,t)=>e in r?hy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,sh=(r,e,t)=>uy(r,typeof e!="symbol"?e+"":e,t);const dy={};class oh extends ti{constructor(e){super(e),sh(this,"_type","TPoints"),sh(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 Gg(e.config,this._geometries,this.getMap());default:throw new Error(`Unsupported style type: ${e.config.type}`)}}}oh.mergeOptions(dy);var fy=Object.defineProperty,py=(r,e,t)=>e in r?fy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ri=(r,e,t)=>py(r,typeof e!="symbol"?e+"":e,t);class Tr extends Ki(Object){constructor(e,t){super(),Ri(this,"options"),Ri(this,"map"),Ri(this,"_sprite",null),Ri(this,"_isDragging",!1),Ri(this,"_dragStartPosition",null),Ri(this,"_lastCoordinate",null),Ri(this,"_boundOnMouseMove",null),Ri(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,o=64/2-2;i.clearRect(0,0,t.width,t.height),i.beginPath(),i.arc(n,n,o,0,2*Math.PI),i.fillStyle="#000000",i.fill(),i.beginPath(),i.arc(n,n,o-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 v=d.getPixelRatio(),w=this.options.size*v;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],o=this.map.world2geo(this.options.position),a=this.map.geo2world(new p.Vector3(t[0],t[1],o.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 na(r,e,t){const{currentTarget:i,clientX:n,clientY:o}=r;if(i instanceof HTMLElement){const a=i.clientWidth,c=i.clientHeight,h=new p.Vector2(n/a*2-1,-(o/c)*2+1);return e.getLocalInfoFromScreen(t,h)?.location}else return}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,dt=(r,e,t)=>gy(r,typeof e!="symbol"?e+"":e,t);class yy extends cs{constructor(e,t){super(e),dt(this,"options"),dt(this,"_handles",[]),dt(this,"_middleHandles",[]),dt(this,"_middleHandleColor","rgba(255, 255, 255, 0.6)"),dt(this,"_editing",!1),dt(this,"_shadow",null),dt(this,"_shadowSnapshot",null),dt(this,"_updating",!1),dt(this,"_history",[]),dt(this,"_historyIndex",-1),dt(this,"_draggableOriginalState",!1),dt(this,"_boundOnMapMouseMove",null),dt(this,"_boundOnMapClick",null),dt(this,"_boundOnMapMouseDown",null),dt(this,"_boundOnFeatureDragging",null),dt(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 ti?this._createPointHandles(e,t):this.target instanceof St?this._createLineStringHandles(e,t):this.target instanceof vi&&this._createPolygonHandles(e,t)}_createPointHandles(e,t){const i=e.coordinates,n=t.geo2world(new p.Vector3(i[0],i[1],i[2]||0)),o=new Tr({position:n,index:0,symbol:0,size:this.options.handleSize,color:this.options.handleColor},t);o.on("dragstart",a=>{this._onHandleDragStart(a,0)}),o.on("dragging",a=>{this._onHandleDragging(a,0)}),o.on("dragend",a=>{this._onHandleDragEnd(a,0)}),this._handles.push(o)}_createLineStringHandles(e,t){const i=e.coordinates;i.forEach((n,o)=>{const a=t.geo2world(new p.Vector3(n[0],n[1],n[2]||0)),c=new Tr({position:a,index:o,symbol:0,size:this.options.handleSize,color:this.options.handleColor},t);c.on("dragstart",h=>{this._onHandleDragStart(h,o)}),c.on("dragging",h=>{this._onHandleDragging(h,o)}),c.on("dragend",h=>{this._onHandleDragEnd(h,o)}),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 ti?c.coordinates=[a.x,a.y,a.z]:this.target instanceof St&&(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 ti?i.coordinates:i.coordinates[t]}),this.target.trigger("editvertex",{index:t,coordinate:this.target instanceof ti?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((o,a)=>{if(!o||o.length<3)return;const c=o[0][0]===o[o.length-1][0]&&o[0][1]===o[o.length-1][1]?o.length-1:o.length;for(let h=0;h<c;h++){const d=o[h],m=t.geo2world(new p.Vector3(d[0],d[1],d[2]||0)),f=new Tr({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(o,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 o=e.target.getPosition();if(!this._getMap())return;const c=this._fixHandlePointCoordinates(o,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,o=n.coordinates;this._addHistory(n.coordinates),this.target.trigger("handledragend",{index:t,ringIndex:i,coordinate:o[i]?.[t]||null}),this.target.trigger("editvertex",{index:t,ringIndex:i,coordinate:o[i]?.[t]||null})}_updateHandlePositions(){const e=this.target._geometry,t=this._getMap();if(t){if(this.target instanceof ti){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 St)e.coordinates.forEach((n,o)=>{const a=t.geo2world(new p.Vector3(n[0],n[1],n[2]||0));this._handles[o]&&this._handles[o].updatePosition(a)});else if(this.target instanceof vi){const i=e.coordinates;let n=0;i.forEach(o=>{const a=o[0][0]===o[o.length-1][0]&&o[0][1]===o[o.length-1][1]?o.length-1:o.length;for(let c=0;c<a;c++){const h=o[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 St){const n=e.coordinates;for(let o=0;o<n.length-1&&!(i>=this._middleHandles.length);o++){const a=n[o],c=n[o+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 vi&&e.coordinates.forEach(o=>{const a=o[0][0]===o[o.length-1][0]&&o[0][1]===o[o.length-1][1]?o.length-1:o.length;for(let c=0;c<a&&!(i>=this._middleHandles.length);c++){const h=(c+1)%a,d=o[c],m=o[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,o=t.viewer.renderer.domElement,a=o.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=na({currentTarget:o,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 o=e.originEvent;if(!o)return;const a=new p.Vector2(o.offsetX/i.viewer.renderer.domElement.clientWidth*2-1,-(o.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),o.stopPropagation&&o.stopPropagation(),o.preventDefault&&o.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(),o=i._ringIndex||0;let a=null;if(this.target instanceof St){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 vi){const h=t.coordinates[o];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:o,coordinate:a})}_createLineStringMiddleHandles(e,t){for(let i=0;i<e.length-1;i++){const n=e[i],o=e[i+1],a=[(n[0]+o[0])/2,(n[1]+o[1])/2,((n[2]||0)+(o[2]||0))/2],c=t.geo2world(new p.Vector3(a[0],a[1],a[2])),h=new Tr({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 o=0;o<n;o++){const a=(o+1)%n,c=e[o],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 Tr({position:m,index:o,symbol:1,size:this.options.handleSize,color:this._middleHandleColor,opacity:.6},i);f._ringIndex=t,f.on("dragstart",g=>{this._onMiddleHandleClick(o,"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 St)this._handles.forEach((e,t)=>{e._index=t});else if(this.target instanceof vi){let e=0;this.target._geometry.coordinates.forEach((n,o)=>{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=o),e++})}}_fixHandlePointCoordinates(e,t,i=0){const n=this._getMap();if(!n)return e;const o=this.target._geometry;let a=null;if(this.target instanceof ti)a=o.coordinates;else if(this.target instanceof St)a=o.coordinates[t];else if(this.target instanceof vi){const h=o.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}}ut.prototype.startEdit=function(r){return this.options?.editable?(this._editor&&this.endEdit(),this._editor=new yy(this,r),this._editor.enable(),this):(console.warn("Feature is not editable. Set editable option to true."),this)},ut.prototype.endEdit=function(){return this._editor&&(this._editor.disable(),this._editor.remove(),delete this._editor),this},ut.prototype.isEditing=function(){return this._editor?this._editor.isEditing():!1},ut.prototype.cancelEdit=function(){return this._editor&&this._editor.cancel(),this},ut.prototype.undoEdit=function(){return this._editor&&this._editor.undo(),this},ut.prototype.redoEdit=function(){return this._editor&&this._editor.redo(),this};function _s(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=>_s(i,e));case"any":return r.slice(1).some(i=>_s(i,e));case"!":return!_s(r[1],e);case"==":{const i=De(r[1],e),n=De(r[2],e);return ws(i)==ws(n)}case"!=":{const i=De(r[1],e),n=De(r[2],e);return ws(i)!=ws(n)}case">":{const i=De(r[1],e),n=De(r[2],e);return ji(i)>ji(n)}case"<":{const i=De(r[1],e),n=De(r[2],e);return ji(i)<ji(n)}case">=":{const i=De(r[1],e),n=De(r[2],e);return ji(i)>=ji(n)}case"<=":{const i=De(r[1],e),n=De(r[2],e);return ji(i)<=ji(n)}case"in":{const i=De(r[1],e);return r.slice(2).map(o=>De(o,e)).includes(i)}case"!in":{const i=De(r[1],e);return!r.slice(2).map(o=>De(o,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=De(r[1],e),n=De(r[2],e);return String(i).toLowerCase().includes(String(n).toLowerCase())}case"starts-with":{const i=De(r[1],e),n=De(r[2],e);return String(i).toLowerCase().startsWith(String(n).toLowerCase())}case"ends-with":{const i=De(r[1],e),n=De(r[2],e);return String(i).toLowerCase().endsWith(String(n).toLowerCase())}default:return!0}}function De(r,e){if(Array.isArray(r))switch(r[0]){case"get":return e?e[r[1]]:void 0;default:return r}return r}function ws(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 ji(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 vy=Object.defineProperty,_y=(r,e,t)=>e in r?vy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,kn=(r,e,t)=>_y(r,typeof e!="symbol"?e+"":e,t);class bs extends Bi{constructor(e,t){super(e,t),kn(this,"TILE_SIZE"),kn(this,"EXTENT"),kn(this,"style"),kn(this,"interactive",!1),kn(this,"_tileFeatureMap",new Map),kn(this,"_activeFeatureFilter"),this.TILE_SIZE=t.tileSize??256,this.EXTENT=t.extent??4096,this.style=t.style||[],this._onMapUpdate=this._onMapUpdate.bind(this)}processTileData(e,t){const i=this.getMap(),n=`${e.z}-${e.x}-${e.y}`,o=this._tileFeatureMap.get(n);if(o&&o.length>0){o.forEach(d=>{d.visible=!0,this.children.some(m=>m&&d&&m.uuid===d.uuid)||d.addTo(this)});return}const a=t.vectorData;if(!a||!a.layers||!i||this.style.length===0)return;const c=[],h=this.style;Object.keys(a.layers).forEach(d=>{const m=a.layers[d];for(let f=0;f<m.length;f++){const g=m[f],v=g.geometry;if(this._activeFeatureFilter&&!this._activeFeatureFilter(g.properties))continue;let w=null;for(const b of h)if(this._evaluateFilter(b.filter,g.properties,d,g.geometry.type)){w=b.style;break}if(w){const b={isVectorTile:!0,tileZ:e.z,tileX:e.x,tileY:e.y,rawCoordinates:v,extent:this.EXTENT,tileSize:this.TILE_SIZE},x=this._createFeatureInstance(g.geometry,g.geometry.type,w,{layerName:d,...g.properties});x&&(x.userData.tileData=b,x.style=Mt.create(w),x.addTo(this),x.initializeGeometry(),c.push(x))}}}),this._tileFeatureMap.set(n,c)}_evaluateFilter(e,t,i,n){if(!e||e===!0)return!0;const o={...t,$layer:i,$type:n};return _s(e,o)}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);t&&(t.forEach(i=>{i._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 Pi(a);case"LineString":return new St(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.style=e,this._tileFeatureMap.forEach((i,n)=>{const o=t.get(n);if(!o||!o.data||!o.data.vectorData)return;const a=o.data.vectorData;i.forEach(c=>{const h=c.userData,d=c.userData.tileData?.rawCoordinates?.type;let m="";if(a&&a.layers){for(const[g,v]of Object.entries(a.layers))if(v.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=Mt.create(t),e.initializeGeometry()}validateFeature(e){return e instanceof ut}dispose(){this._tileFeatureMap.forEach((e,t)=>{this._removeFeaturesByTileKey(t)})}}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,Lt=(r,e,t)=>by(r,typeof e!="symbol"?e+"":e,t);class ah extends ps{constructor(e,t){super(e,t),this.layerId=e,Lt(this,"isTileLayer",!0),Lt(this,"layerType","base"),Lt(this,"isBaseLayer",!1),Lt(this,"_enabled",!0),Lt(this,"_visible",!0),Lt(this,"_rootTile"),Lt(this,"_loader"),Lt(this,"_LODThreshold",1),Lt(this,"isSceneLayer",!1),Lt(this,"opacity",1),Lt(this,"source"),Lt(this,"projection"),Lt(this,"minLevel",2),Lt(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 Ni,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 xy=Object.defineProperty,My=(r,e,t)=>e in r?xy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Sy=(r,e,t)=>My(r,e+"",t);class lh extends p.LoadingManager{constructor(){super(...arguments),Sy(this,"onParseEnd")}parseEnd(e){this.onParseEnd&&this.onParseEnd(e)}}const ze={manager:new lh,demLoaderMap:new Map,meshLoaderMap:new Map,imgLoaderMap:new Map,registerMaterialLoader(r){ze.imgLoaderMap.set(r.dataType,r),r.info.author=r.info.author??wo.name},registerGeometryLoader(r){ze.demLoaderMap.set(r.dataType,r),r.info.author=r.info.author??wo.name},registerMeshLoader(r){ze.meshLoaderMap.set(r.dataType,r),r.info.author=r.info.author??wo.name},getMaterialLoader(r){const e=ze.imgLoaderMap.get(r.dataType);if(e)return e;throw`Source dataType "${r.dataType}" is not support!`},getGeometryLoader(r){const e=ze.demLoaderMap.get(r.dataType);if(e)return e;throw`Source dataType "${r.dataType}" is not support!`},getMeshLoader(r){const e=ze.meshLoaderMap.get(r.dataType);if(e)return e;throw`Source dataType "${r.dataType}" is not support!`}};var Ly=Object.defineProperty,Py=(r,e,t)=>e in r?Ly(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Cy=(r,e,t)=>Py(r,e+"",t);class Ty{constructor(e){Cy(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 Gy=4096,ch=Math.PI;function ra(r,e){const t=Math.floor(r[0]*e),i=Math.floor(r[1]*e),n=Math.floor((r[2]-r[0])*e),o=Math.floor((r[3]-r[1])*e);return{sx:t,sy:i,sw:n,sh:o}}function sa(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=Wy(e,t,i,r.maxLevel),o=n.parentNO;return{url:r._getUrl(o.x,o.y,o.z),clipBounds:n.bounds}}function Wy(r,e,t,i){const n=t-i,o={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:o,bounds:g}}function oa(r,e,t,i,n=Gy){const{x:o,y:a}=r,c=(e+o/n)/Math.pow(2,i),h=(t+a/n)/Math.pow(2,i),d=c*360-180,f=Math.atan(Math.sinh(ch*(1-2*h)))*180/ch;return[parseFloat(d.toFixed(8)),parseFloat(f.toFixed(8))]}function Zy(r,e,t,i){if(!r||!r.coordinates)throw new Error("无效的geometry数据格式");const n={type:r.type,coordinates:null};function o(a){if(typeof a=="object"&&a.x!==void 0&&a.y!==void 0)return oa(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=>oa(h,e,t,i)):a.map(h=>o(h))}return a}return n.coordinates=o(r.coordinates),n}var Vy=Object.defineProperty,Iy=(r,e,t)=>e in r?Vy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,xs=(r,e,t)=>Iy(r,typeof e!="symbol"?e+"":e,t);class Ms{constructor(){xs(this,"_imgSource",[]),xs(this,"_demSource"),xs(this,"_vtSource"),xs(this,"manager",ze.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=ze.getGeometryLoader(this.demSource),n=this.demSource;t=await i.load({source:n,...e}).catch(o=>(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=ze.getMeshLoader(this.vtSource),n=this.vtSource;t=await i.load({source:n,...e}).catch(o=>(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 o=ze.getMaterialLoader(n),a=await o.load({source:n,...e}).catch(h=>(console.error("Load material error",n.dataType,e.x,e.y,e.z),new p.MeshBasicMaterial)),c=h=>{o.unload&&o.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 Gr(...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 o=0;for(const a of e)n.set(a,o),o+=a.length;return n}function hh(r,e,t,i){const n=i?Fy(i,r.position.value):Ay(e),o=n.length,a=new Float32Array(o*6),c=new Float32Array(o*4),h=new e.constructor(o*6),d=new Float32Array(o*6);for(let f=0;f<o;f++)Oy({edge:n[f],edgeIndex:f,attributes:r,skirtHeight:t,newPosition:a,newTexcoord0:c,newTriangles:h,newNormals:d});r.position.value=Gr(r.position.value,a),r.texcoord.value=Gr(r.texcoord.value,c),r.normal.value=Gr(r.normal.value,d);const m=Gr(e,h);return{attributes:r,indices:m}}function Ay(r){const e=[],t=Array.isArray(r)?r:Array.from(r);for(let n=0;n<t.length;n+=3){const o=t[n],a=t[n+1],c=t[n+2];e.push([o,a],[a,c],[c,o])}e.sort(([n,o],[a,c])=>{const h=Math.min(n,o),d=Math.min(a,c);return h!==d?h-d:Math.max(n,o)-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 Fy(r,e){const t=(n,o)=>{n.sort(o)};t(r.westIndices,(n,o)=>e[3*n+1]-e[3*o+1]),t(r.eastIndices,(n,o)=>e[3*o+1]-e[3*n+1]),t(r.southIndices,(n,o)=>e[3*o]-e[3*n]),t(r.northIndices,(n,o)=>e[3*n]-e[3*o]);const i=[];return Object.values(r).forEach(n=>{if(n.length>1)for(let o=0;o<n.length-1;o++)i.push([n[o],n[o+1]])}),i}function Oy({edge:r,edgeIndex:e,attributes:t,skirtHeight:i,newPosition:n,newTexcoord0:o,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,o.set(t.texcoord.value.subarray(r[0]*2,r[0]*2+2),d*2),o.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 uh(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=aa(i,t);return{attributes:Dy(r,i,t),indices:n}}function Dy(r,e,t){const i=t*e,n=new Float32Array(i*3),o=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);o[a*2]=d,o[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:o,size:2},normal:{value:la(n,aa(e,t)),size:3}}}function aa(r,e){const t=6*(e-1)*(r-1),i=new Uint16Array(t);let n=0;for(let o=0;o<r-1;o++)for(let a=0;a<e-1;a++){const c=o*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 la(r,e){const t=new Float32Array(r.length);for(let i=0;i<e.length;i+=3){const n=e[i]*3,o=e[i+1]*3,a=e[i+2]*3,c=r[n],h=r[n+1],d=r[n+2],m=r[o],f=r[o+1],g=r[o+2],v=r[a],w=r[a+1],b=r[a+2],x=m-c,L=f-h,M=g-d,C=v-c,W=w-h,z=b-d,D=L*z-M*W,X=M*C-x*z,I=x*W-L*C,K=Math.sqrt(D*D+X*X+I*I),V=[0,0,1];if(K>0){const G=1/K;V[0]=D*G,V[1]=X*G,V[2]=I*G}for(let G=0;G<3;G++)t[n+G]=t[o+G]=t[a+G]=V[G]}return t}var zy=Object.defineProperty,Xy=(r,e,t)=>e in r?zy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Uy=(r,e,t)=>Xy(r,e+"",t);class Kn extends p.PlaneGeometry{constructor(){super(...arguments),Uy(this,"type","TileGeometry")}setData(e,t=1e3){let i=e instanceof Float32Array?uh(e):e;i=hh(i.attributes,i.indices,t);const{attributes:n,indices:o}=i;return this.setIndex(new p.BufferAttribute(o,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,Ky=(r,e,t)=>e in r?ky(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ji=(r,e,t)=>Ky(r,typeof e!="symbol"?e+"":e,t);class dh{constructor(e=257){Ji(this,"gridSize"),Ji(this,"numTriangles"),Ji(this,"numParentTriangles"),Ji(this,"indices"),Ji(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,o=0,a=0,c=0,h=0,d=0,m=0;for(n&1?c=h=d=t:o=a=m=t;(n>>=1)>1;){const g=o+c>>1,v=a+h>>1;n&1?(c=o,h=a,o=d,a=m):(o=c,a=h,c=d,h=m),d=g,m=v}const f=i*4;this.coords[f+0]=o,this.coords[f+1]=a,this.coords[f+2]=c,this.coords[f+3]=h}}createTile(e){return new Ny(e,this)}}class Ny{constructor(e,t){Ji(this,"martini"),Ji(this,"terrain"),Ji(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:o,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],v=d+f>>1,w=m+g>>1,b=v+w-m,x=w+d-v,L=(o[m*n+d]+o[g*n+f])/2,M=w*n+v,C=Math.abs(L-o[M]);if(a[M]=Math.max(a[M],C),c<t){const W=(m+x>>1)*n+(d+b>>1),z=(g+x>>1)*n+(f+b>>1);a[M]=Math.max(a[M],a[W],a[z])}}}getGeometryData(e=0){const{gridSize:t,indices:i}=this.martini,{errors:n}=this;let o=0,a=0;const c=t-1;let h,d,m=0;i.fill(0);function f(M,C,W,z,D,X){const I=M+W>>1,K=C+z>>1;Math.abs(M-D)+Math.abs(C-X)>1&&n[K*t+I]>e?(f(D,X,M,C,I,K),f(W,z,D,X,I,K)):(h=C*t+M,d=z*t+W,m=X*t+D,i[h]===0&&(i[h]=++o),i[d]===0&&(i[d]=++o),i[m]===0&&(i[m]=++o),a++)}f(0,0,c,c,c,0),f(c,c,0,0,0,c);const g=o*2,v=a*3,w=new Uint16Array(g),b=new Uint32Array(v);let x=0;function L(M,C,W,z,D,X){const I=M+W>>1,K=C+z>>1;if(Math.abs(M-D)+Math.abs(C-X)>1&&n[K*t+I]>e)L(D,X,M,C,I,K),L(W,z,D,X,I,K);else{const V=i[C*t+M]-1,G=i[z*t+W]-1,k=i[X*t+D]-1;w[2*V]=M,w[2*V+1]=C,w[2*G]=W,w[2*G+1]=z,w[2*k]=D,w[2*k+1]=X,b[x++]=V,b[x++]=G,b[x++]=k}}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)),o=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],v=g*n+f;c[3*m+0]=f/o-.5,c[3*m+1]=.5-g/o,c[3*m+2]=e[v],h[2*m+0]=f/o,h[2*m+1]=1-g/o}const d=la(c,i);return{position:{value:c,size:3},texcoord:{value:h,size:2},normal:{value:d,size:3}}}}var By=Object.defineProperty,Yy=(r,e,t)=>e in r?By(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,fh=(r,e,t)=>Yy(r,typeof e!="symbol"?e+"":e,t);class ca{constructor(){fh(this,"info",{version:"0.10.0",description:"Terrain loader base class"}),fh(this,"dataType","")}async load(e){const{source:t,x:i,y:n,z:o}=e,{url:a,clipBounds:c}=sa(t,i,n,o);if(!a)return new Kn;const h=await this.doLoad(a,{source:t,x:i,y:n,z:o,bounds:c});return ze.manager.parseEnd(a),h}}class ha 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 nt=(r=>(r[r.Unknown=0]="Unknown",r[r.Point=1]="Point",r[r.Linestring=2]="Linestring",r[r.Polygon=3]="Polygon",r))(nt||{});class ph{render(e,t,i,n,o=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 nt.Point:e.textAlign="center",e.textBaseline="middle",e.font=n.font??"14px Arial",e.fillStyle=n.fontColor??"white",this._renderPointText(e,i,o,n.textField??"name",n.fontOffset??[0,-8]);break;case nt.Linestring:this._renderLineString(e,i,o);break;case nt.Polygon:this._renderPolygon(e,i,o);break;default:console.warn(`Unknown feature type: ${t}`)}(n.fill||t===nt.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",o=[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+o[0],a[0][0].y*i+o[1])}_renderLineString(e,t,i){const n=t.geometry;e.beginPath();for(const o of n)for(let a=0;a<o.length;a++){const{x:c,y:h}=o[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 o=0;o<n.length;o++){const a=n[o];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 Ry=Object.defineProperty,jy=(r,e,t)=>e in r?Ry(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,mh=(r,e,t)=>jy(r,typeof e!="symbol"?e+"":e,t);class ua{constructor(){mh(this,"info",{version:"0.10.0",description:"Image loader base class"}),mh(this,"dataType","")}async load(e){const{source:t,x:i,y:n,z:o}=e,a=new ha({}),{url:c,clipBounds:h}=sa(t,i,n,o);if(c){const d=await this.doLoad(c,{source:t,x:i,y:n,z:o,bounds:h});a.map=d,ze.manager.parseEnd(c)}return a}}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,gh=(r,e,t)=>Qy(r,typeof e!="symbol"?e+"":e,t);class Hy{constructor(){gh(this,"info",{version:"0.10.0",description:"Canvas tile abstract loader"}),gh(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 ha({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 Ey=Object.defineProperty,$y=(r,e,t)=>e in r?Ey(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,da=(r,e,t)=>$y(r,typeof e!="symbol"?e+"":e,t);class qy extends ua{constructor(){super(...arguments),da(this,"info",{version:"0.10.0",description:"Tile image loader. It can load xyz tile image."}),da(this,"dataType","image"),da(this,"loader",new p.ImageLoader(ze.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:o}=t;return o[2]-o[0]<1?n.image=ev(i,o):n.image=i,n.needsUpdate=!0,n}}function ev(r,e){const t=r.width,i=new OffscreenCanvas(t,t),n=i.getContext("2d"),{sx:o,sy:a,sw:c,sh:h}=ra(e,r.width);return n.drawImage(r,o,a,c,h,0,0,t,t),i}const tv=`{
1123
1123
  "name": "@terra.gl/core",
1124
- "version": "0.0.1-alpha.63",
1124
+ "version": "0.0.1-alpha.65",
1125
1125
  "type": "module",
1126
1126
  "files": [
1127
1127
  "dist"