@terra.gl/core 0.0.1-alpha.75 → 0.0.1-alpha.76

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as yt from "three";
2
2
  import { REVISION as mf, TrianglesDrawMode as nb, TriangleFanDrawMode as ec, TriangleStripDrawMode as gf, Mesh as Ze, Vector3 as O, Color as he, FrontSide as ua, Plane as yf, Matrix4 as Le, Vector4 as Mi, PerspectiveCamera as cr, WebGLRenderTarget as Dr, UniformsUtils as dr, UniformsLib as aa, ShaderMaterial as At, MOUSE as wn, TOUCH as bn, Spherical as ad, Quaternion as bi, OrthographicCamera as hr, Vector2 as ce, Ray as rb, PlaneGeometry as Ti, HalfFloatType as rr, AdditiveBlending as yc, MeshBasicMaterial as xi, RGBAFormat as _f, LinearFilter as Wn, NoBlending as sb, Clock as da, Loader as _c, LoaderUtils as Xr, FileLoader as Zn, MeshPhysicalMaterial as Oi, SpotLight as vf, PointLight as tc, DirectionalLight as la, InstancedMesh as vc, InstancedBufferAttribute as ic, Object3D as Si, TextureLoader as zs, ImageBitmapLoader as ob, BufferAttribute as Mt, InterleavedBuffer as ab, InterleavedBufferAttribute as sr, LinearMipmapLinearFilter as Os, NearestMipmapLinearFilter as lb, LinearMipmapNearestFilter as cb, NearestMipmapNearestFilter as hb, NearestFilter as wf, RepeatWrapping as Li, MirroredRepeatWrapping as ub, ClampToEdgeWrapping as nc, PointsMaterial as fa, Material as Gl, LineBasicMaterial as wc, MeshStandardMaterial as Ds, DoubleSide as Yr, PropertyBinding as As, BufferGeometry as Bt, SkinnedMesh as bf, LineSegments as db, Line as bc, LineLoop as fb, Points as Br, Group as ci, MathUtils as wt, Skeleton as xf, AnimationClip as Tf, Bone as rc, InterpolateDiscrete as pb, InterpolateLinear as Sf, Texture as Ur, VectorKeyframeTrack as sc, NumberKeyframeTrack as oc, QuaternionKeyframeTrack as ac, Interpolant as mb, Box3 as mr, Sphere as xc, Curve as gb, MeshPhongMaterial as Rs, MeshLambertMaterial as Mf, EquirectangularReflectionMapping as yb, AmbientLight as Lf, Float32BufferAttribute as xn, Uint16BufferAttribute as _b, Matrix3 as vb, Euler as Ls, DataTextureLoader as wb, FloatType as ra, DataUtils as Ao, InstancedBufferGeometry as Pf, InstancedInterleavedBuffer as lc, WireframeGeometry as bb, Line3 as xb, EventDispatcher as Cf, Scene as Gf, FogExp2 as ld, CubeTextureLoader as Tb, WebGLRenderer as Sb, PCFSoftShadowMap as Mb, ACESFilmicToneMapping as Lb, SRGBColorSpace as Kr, CameraHelper as Pb, CubicBezierCurve3 as Cb, Frustum as Gb, Raycaster as Fs, CanvasTexture as gr, SpriteMaterial as Rn, Sprite as Vi, DynamicDrawUsage as cd, NormalBlending as Wf, CurvePath as Zf, LineCurve3 as kr, QuadraticBezierCurve3 as Rf, TubeGeometry as Wb, BackSide as Zb, Shape as Rb, ShapeGeometry as Ib, CylinderGeometry as Eb, AnimationMixer as Ab, LoopRepeat as Fb, LoopOnce as Vb, LoadingManager as zb, Box2 as Ob, ImageLoader as If } from "three";
3
- const Db = "0.0.1-alpha.75", Wl = {
3
+ const Db = "0.0.1-alpha.76", Wl = {
4
4
  name: "Criska"
5
5
  };
6
6
  var Is = function() {
@@ -17084,7 +17084,7 @@ class RM extends vi {
17084
17084
  this._threeGeometry && this._threeGeometry.traverse((e) => {
17085
17085
  if ("material" in e) {
17086
17086
  const t = e.material;
17087
- t && (t.emissiveIntensity = this._emissive ? this._emissiveIntensity : 0, t.emissive && t.emissive.setStyle(this._emissiveColor));
17087
+ t && (t.emissiveIntensity = this._emissive ? this._emissiveIntensity : 0, this._emissive ? (t.emissive && (this._emissiveColor === "#ffffff" && t.color ? t.emissive.copy(t.color) : t.emissive.setStyle(this._emissiveColor)), t.map && !t.emissiveMap && (t.emissiveMap = t.map, t.needsUpdate = !0)) : t.emissiveMap && t.emissiveMap === t.map && (t.emissiveMap = null, t.needsUpdate = !0));
17088
17088
  }
17089
17089
  });
17090
17090
  }
@@ -19785,7 +19785,7 @@ function F2(r, e) {
19785
19785
  }
19786
19786
  const V2 = `{
19787
19787
  "name": "@terra.gl/core",
19788
- "version": "0.0.1-alpha.75",
19788
+ "version": "0.0.1-alpha.76",
19789
19789
  "type": "module",
19790
19790
  "files": [
19791
19791
  "dist"
@@ -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 mf(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const ut=mf(p),gf="0.0.1-alpha.75",xo={name:"Criska"};var gr=function(){var r=0,e=document.createElement("div");e.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",e.addEventListener("click",function(m){m.preventDefault(),i(++r%e.children.length)},!1);function t(m){return e.appendChild(m.dom),m}function i(m){for(var f=0;f<e.children.length;f++)e.children[f].style.display=f===m?"block":"none";r=m}var n=(performance||Date).now(),s=n,a=0,c=t(new gr.Panel("FPS","#0ff","#002")),h=t(new gr.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var d=t(new gr.Panel("MB","#f08","#201"));return i(0),{REVISION:16,dom:e,addPanel:t,showPanel:i,begin:function(){n=(performance||Date).now()},end:function(){a++;var m=(performance||Date).now();if(h.update(m-n,200),m>=s+1e3&&(c.update(a*1e3/(m-s),100),s=m,a=0,d)){var f=performance.memory;d.update(f.usedJSHeapSize/1048576,f.jsHeapSizeLimit/1048576)}return m},update:function(){n=this.end()},domElement:e,setMode:i}};gr.Panel=function(r,e,t){var i=1/0,n=0,s=Math.round,a=s(window.devicePixelRatio||1),c=80*a,h=48*a,d=3*a,m=2*a,f=3*a,g=15*a,_=74*a,w=30*a,b=document.createElement("canvas");b.width=c,b.height=h,b.style.cssText="width:80px;height:48px";var x=b.getContext("2d");return x.font="bold "+9*a+"px Helvetica,Arial,sans-serif",x.textBaseline="top",x.fillStyle=t,x.fillRect(0,0,c,h),x.fillStyle=e,x.fillText(r,d,m),x.fillRect(f,g,_,w),x.fillStyle=t,x.globalAlpha=.9,x.fillRect(f,g,_,w),{dom:b,update:function(L,M){i=Math.min(i,L),n=Math.max(n,L),x.fillStyle=t,x.globalAlpha=1,x.fillRect(0,0,c,g),x.fillStyle=e,x.fillText(s(L)+" "+r+" ("+s(i)+"-"+s(n)+")",d,m),x.drawImage(b,f+a,g,_-a,w,f,g,_-a,w),x.fillRect(f+_-a,g,a,w),x.fillStyle=t,x.globalAlpha=.9,x.fillRect(f+_-a,g,a,s((1-L/M)*w))}}};const ns=parseInt(p.REVISION.replace(/\D+/g,"")),Mo=ns>=125?"uv1":"uv2";function Dl(r,e){if(e===p.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),r;if(e===p.TriangleFanDrawMode||e===p.TriangleStripDrawMode){let t=r.getIndex();if(t===null){const a=[],c=r.getAttribute("position");if(c!==void 0){for(let h=0;h<c.count;h++)a.push(h);r.setIndex(a),t=r.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),r}const i=t.count-2,n=[];if(t)if(e===p.TriangleFanDrawMode)for(let a=1;a<=i;a++)n.push(t.getX(0)),n.push(t.getX(a)),n.push(t.getX(a+1));else for(let a=0;a<i;a++)a%2===0?(n.push(t.getX(a)),n.push(t.getX(a+1)),n.push(t.getX(a+2))):(n.push(t.getX(a+2)),n.push(t.getX(a+1)),n.push(t.getX(a)));n.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=r.clone();return s.setIndex(n),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),r}var Kt=Uint8Array,Xi=Uint16Array,So=Uint32Array,Xl=new Kt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),kl=new Kt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),yf=new Kt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ul=function(r,e){for(var t=new Xi(31),i=0;i<31;++i)t[i]=e+=1<<r[i-1];for(var n=new So(t[30]),i=1;i<30;++i)for(var s=t[i];s<t[i+1];++s)n[s]=s-t[i]<<5|i;return[t,n]},Nl=Ul(Xl,2),Kl=Nl[0],_f=Nl[1];Kl[28]=258,_f[258]=28;for(var vf=Ul(kl,0),wf=vf[0],Lo=new Xi(32768),Ze=0;Ze<32768;++Ze){var ki=(Ze&43690)>>>1|(Ze&21845)<<1;ki=(ki&52428)>>>2|(ki&13107)<<2,ki=(ki&61680)>>>4|(ki&3855)<<4,Lo[Ze]=((ki&65280)>>>8|(ki&255)<<8)>>>1}for(var yr=function(r,e,t){for(var i=r.length,n=0,s=new Xi(e);n<i;++n)++s[r[n]-1];var a=new Xi(e);for(n=0;n<e;++n)a[n]=a[n-1]+s[n-1]<<1;var c;if(t){c=new Xi(1<<e);var h=15-e;for(n=0;n<i;++n)if(r[n])for(var d=n<<4|r[n],m=e-r[n],f=a[r[n]-1]++<<m,g=f|(1<<m)-1;f<=g;++f)c[Lo[f]>>>h]=d}else for(c=new Xi(i),n=0;n<i;++n)r[n]&&(c[n]=Lo[a[r[n]-1]++]>>>15-r[n]);return c},_r=new Kt(288),Ze=0;Ze<144;++Ze)_r[Ze]=8;for(var Ze=144;Ze<256;++Ze)_r[Ze]=9;for(var Ze=256;Ze<280;++Ze)_r[Ze]=7;for(var Ze=280;Ze<288;++Ze)_r[Ze]=8;for(var Bl=new Kt(32),Ze=0;Ze<32;++Ze)Bl[Ze]=5;var bf=yr(_r,9,1),xf=yr(Bl,5,1),Po=function(r){for(var e=r[0],t=1;t<r.length;++t)r[t]>e&&(e=r[t]);return e},ii=function(r,e,t){var i=e/8|0;return(r[i]|r[i+1]<<8)>>(e&7)&t},Co=function(r,e){var t=e/8|0;return(r[t]|r[t+1]<<8|r[t+2]<<16)>>(e&7)},Mf=function(r){return(r/8|0)+(r&7&&1)},Sf=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var i=new(r instanceof Xi?Xi:r instanceof So?So:Kt)(t-e);return i.set(r.subarray(e,t)),i},Lf=function(r,e,t){var i=r.length;if(!i||t&&!t.l&&i<5)return e||new Kt(0);var n=!e||t,s=!t||t.i;t||(t={}),e||(e=new Kt(i*3));var a=function(pt){var $e=e.length;if(pt>$e){var je=new Kt(Math.max($e*2,pt));je.set(e),e=je}},c=t.f||0,h=t.p||0,d=t.b||0,m=t.l,f=t.d,g=t.m,_=t.n,w=i*8;do{if(!m){t.f=c=ii(r,h,1);var b=ii(r,h+1,3);if(h+=3,b)if(b==1)m=bf,f=xf,g=9,_=5;else if(b==2){var C=ii(r,h,31)+257,W=ii(r,h+10,15)+4,D=C+ii(r,h+5,31)+1;h+=14;for(var z=new Kt(D),X=new Kt(19),I=0;I<W;++I)X[yf[I]]=ii(r,h+I*3,7);h+=W*3;for(var U=Po(X),V=(1<<U)-1,G=yr(X,U,1),I=0;I<D;){var N=G[ii(r,h,V)];h+=N&15;var x=N>>>4;if(x<16)z[I++]=x;else{var j=0,Y=0;for(x==16?(Y=3+ii(r,h,3),h+=2,j=z[I-1]):x==17?(Y=3+ii(r,h,7),h+=3):x==18&&(Y=11+ii(r,h,127),h+=7);Y--;)z[I++]=j}}var H=z.subarray(0,C),Q=z.subarray(C);g=Po(H),_=Po(Q),m=yr(H,g,1),f=yr(Q,_,1)}else throw"invalid block type";else{var x=Mf(h)+4,L=r[x-4]|r[x-3]<<8,M=x+L;if(M>i){if(s)throw"unexpected EOF";break}n&&a(d+L),e.set(r.subarray(x,M),d),t.b=d+=L,t.p=h=M*8;continue}if(h>w){if(s)throw"unexpected EOF";break}}n&&a(d+131072);for(var re=(1<<g)-1,ne=(1<<_)-1,le=h;;le=h){var j=m[Co(r,h)&re],de=j>>>4;if(h+=j&15,h>w){if(s)throw"unexpected EOF";break}if(!j)throw"invalid length/literal";if(de<256)e[d++]=de;else if(de==256){le=h,m=null;break}else{var ge=de-254;if(de>264){var I=de-257,fe=Xl[I];ge=ii(r,h,(1<<fe)-1)+Kl[I],h+=fe}var Se=f[Co(r,h)&ne],st=Se>>>4;if(!Se)throw"invalid distance";h+=Se&15;var Q=wf[st];if(st>3){var fe=kl[st];Q+=Co(r,h)&(1<<fe)-1,h+=fe}if(h>w){if(s)throw"unexpected EOF";break}n&&a(d+131072);for(var ot=d+ge;d<ot;d+=4)e[d]=e[d-Q],e[d+1]=e[d+1-Q],e[d+2]=e[d+2-Q],e[d+3]=e[d+3-Q];d=ot}}t.l=m,t.p=le,t.b=d,m&&(c=1,t.m=g,t.d=f,t.n=_)}while(!c);return d==e.length?e:Sf(e,0,d)},Pf=new Kt(0),Cf=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 Tf(r,e){return Lf((Cf(r),r.subarray(2,-4)),e)}var Gf=typeof TextDecoder<"u"&&new TextDecoder,Wf=0;try{Gf.decode(Pf,{stream:!0}),Wf=1}catch{}class Zf extends p.Mesh{constructor(e,t={}){super(e),this.isWater=!0;const i=this,n=t.textureWidth!==void 0?t.textureWidth:512,s=t.textureHeight!==void 0?t.textureHeight:512,a=t.clipBias!==void 0?t.clipBias:0,c=t.alpha!==void 0?t.alpha:1,h=t.time!==void 0?t.time:0,d=t.waterNormals!==void 0?t.waterNormals:null,m=t.sunDirection!==void 0?t.sunDirection:new p.Vector3(.70707,.70707,0),f=new p.Color(t.sunColor!==void 0?t.sunColor:16777215),g=new p.Color(t.waterColor!==void 0?t.waterColor:8355711),_=t.eye!==void 0?t.eye:new p.Vector3(0,0,0),w=t.distortionScale!==void 0?t.distortionScale:20,b=t.side!==void 0?t.side:p.FrontSide,x=t.fog!==void 0?t.fog:!1,L=new p.Plane,M=new p.Vector3,C=new p.Vector3,W=new p.Vector3,D=new p.Matrix4,z=new p.Vector3(0,0,-1),X=new p.Vector4,I=new p.Vector3,U=new p.Vector3,V=new p.Vector4,G=new p.Matrix4,N=new p.PerspectiveCamera,j=new p.WebGLRenderTarget(n,s),Y={uniforms:p.UniformsUtils.merge([p.UniformsLib.fog,p.UniformsLib.lights,{normalSampler:{value:null},mirrorSampler:{value:null},alpha:{value:1},time:{value:0},size:{value:1},distortionScale:{value:20},textureMatrix:{value:new p.Matrix4},sunColor:{value:new p.Color(8355711)},sunDirection:{value:new p.Vector3(.70707,.70707,0)},eye:{value:new p.Vector3},waterColor:{value:new p.Color(5592405)}}]),vertexShader:`
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 mf(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const ut=mf(p),gf="0.0.1-alpha.76",xo={name:"Criska"};var gr=function(){var r=0,e=document.createElement("div");e.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",e.addEventListener("click",function(m){m.preventDefault(),i(++r%e.children.length)},!1);function t(m){return e.appendChild(m.dom),m}function i(m){for(var f=0;f<e.children.length;f++)e.children[f].style.display=f===m?"block":"none";r=m}var n=(performance||Date).now(),s=n,a=0,c=t(new gr.Panel("FPS","#0ff","#002")),h=t(new gr.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var d=t(new gr.Panel("MB","#f08","#201"));return i(0),{REVISION:16,dom:e,addPanel:t,showPanel:i,begin:function(){n=(performance||Date).now()},end:function(){a++;var m=(performance||Date).now();if(h.update(m-n,200),m>=s+1e3&&(c.update(a*1e3/(m-s),100),s=m,a=0,d)){var f=performance.memory;d.update(f.usedJSHeapSize/1048576,f.jsHeapSizeLimit/1048576)}return m},update:function(){n=this.end()},domElement:e,setMode:i}};gr.Panel=function(r,e,t){var i=1/0,n=0,s=Math.round,a=s(window.devicePixelRatio||1),c=80*a,h=48*a,d=3*a,m=2*a,f=3*a,g=15*a,_=74*a,w=30*a,b=document.createElement("canvas");b.width=c,b.height=h,b.style.cssText="width:80px;height:48px";var x=b.getContext("2d");return x.font="bold "+9*a+"px Helvetica,Arial,sans-serif",x.textBaseline="top",x.fillStyle=t,x.fillRect(0,0,c,h),x.fillStyle=e,x.fillText(r,d,m),x.fillRect(f,g,_,w),x.fillStyle=t,x.globalAlpha=.9,x.fillRect(f,g,_,w),{dom:b,update:function(L,M){i=Math.min(i,L),n=Math.max(n,L),x.fillStyle=t,x.globalAlpha=1,x.fillRect(0,0,c,g),x.fillStyle=e,x.fillText(s(L)+" "+r+" ("+s(i)+"-"+s(n)+")",d,m),x.drawImage(b,f+a,g,_-a,w,f,g,_-a,w),x.fillRect(f+_-a,g,a,w),x.fillStyle=t,x.globalAlpha=.9,x.fillRect(f+_-a,g,a,s((1-L/M)*w))}}};const ns=parseInt(p.REVISION.replace(/\D+/g,"")),Mo=ns>=125?"uv1":"uv2";function Dl(r,e){if(e===p.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),r;if(e===p.TriangleFanDrawMode||e===p.TriangleStripDrawMode){let t=r.getIndex();if(t===null){const a=[],c=r.getAttribute("position");if(c!==void 0){for(let h=0;h<c.count;h++)a.push(h);r.setIndex(a),t=r.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),r}const i=t.count-2,n=[];if(t)if(e===p.TriangleFanDrawMode)for(let a=1;a<=i;a++)n.push(t.getX(0)),n.push(t.getX(a)),n.push(t.getX(a+1));else for(let a=0;a<i;a++)a%2===0?(n.push(t.getX(a)),n.push(t.getX(a+1)),n.push(t.getX(a+2))):(n.push(t.getX(a+2)),n.push(t.getX(a+1)),n.push(t.getX(a)));n.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=r.clone();return s.setIndex(n),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),r}var Kt=Uint8Array,Xi=Uint16Array,So=Uint32Array,Xl=new Kt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),kl=new Kt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),yf=new Kt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ul=function(r,e){for(var t=new Xi(31),i=0;i<31;++i)t[i]=e+=1<<r[i-1];for(var n=new So(t[30]),i=1;i<30;++i)for(var s=t[i];s<t[i+1];++s)n[s]=s-t[i]<<5|i;return[t,n]},Nl=Ul(Xl,2),Kl=Nl[0],_f=Nl[1];Kl[28]=258,_f[258]=28;for(var vf=Ul(kl,0),wf=vf[0],Lo=new Xi(32768),Ze=0;Ze<32768;++Ze){var ki=(Ze&43690)>>>1|(Ze&21845)<<1;ki=(ki&52428)>>>2|(ki&13107)<<2,ki=(ki&61680)>>>4|(ki&3855)<<4,Lo[Ze]=((ki&65280)>>>8|(ki&255)<<8)>>>1}for(var yr=function(r,e,t){for(var i=r.length,n=0,s=new Xi(e);n<i;++n)++s[r[n]-1];var a=new Xi(e);for(n=0;n<e;++n)a[n]=a[n-1]+s[n-1]<<1;var c;if(t){c=new Xi(1<<e);var h=15-e;for(n=0;n<i;++n)if(r[n])for(var d=n<<4|r[n],m=e-r[n],f=a[r[n]-1]++<<m,g=f|(1<<m)-1;f<=g;++f)c[Lo[f]>>>h]=d}else for(c=new Xi(i),n=0;n<i;++n)r[n]&&(c[n]=Lo[a[r[n]-1]++]>>>15-r[n]);return c},_r=new Kt(288),Ze=0;Ze<144;++Ze)_r[Ze]=8;for(var Ze=144;Ze<256;++Ze)_r[Ze]=9;for(var Ze=256;Ze<280;++Ze)_r[Ze]=7;for(var Ze=280;Ze<288;++Ze)_r[Ze]=8;for(var Bl=new Kt(32),Ze=0;Ze<32;++Ze)Bl[Ze]=5;var bf=yr(_r,9,1),xf=yr(Bl,5,1),Po=function(r){for(var e=r[0],t=1;t<r.length;++t)r[t]>e&&(e=r[t]);return e},ii=function(r,e,t){var i=e/8|0;return(r[i]|r[i+1]<<8)>>(e&7)&t},Co=function(r,e){var t=e/8|0;return(r[t]|r[t+1]<<8|r[t+2]<<16)>>(e&7)},Mf=function(r){return(r/8|0)+(r&7&&1)},Sf=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var i=new(r instanceof Xi?Xi:r instanceof So?So:Kt)(t-e);return i.set(r.subarray(e,t)),i},Lf=function(r,e,t){var i=r.length;if(!i||t&&!t.l&&i<5)return e||new Kt(0);var n=!e||t,s=!t||t.i;t||(t={}),e||(e=new Kt(i*3));var a=function(pt){var $e=e.length;if(pt>$e){var je=new Kt(Math.max($e*2,pt));je.set(e),e=je}},c=t.f||0,h=t.p||0,d=t.b||0,m=t.l,f=t.d,g=t.m,_=t.n,w=i*8;do{if(!m){t.f=c=ii(r,h,1);var b=ii(r,h+1,3);if(h+=3,b)if(b==1)m=bf,f=xf,g=9,_=5;else if(b==2){var C=ii(r,h,31)+257,W=ii(r,h+10,15)+4,D=C+ii(r,h+5,31)+1;h+=14;for(var z=new Kt(D),X=new Kt(19),I=0;I<W;++I)X[yf[I]]=ii(r,h+I*3,7);h+=W*3;for(var U=Po(X),V=(1<<U)-1,G=yr(X,U,1),I=0;I<D;){var N=G[ii(r,h,V)];h+=N&15;var x=N>>>4;if(x<16)z[I++]=x;else{var j=0,Y=0;for(x==16?(Y=3+ii(r,h,3),h+=2,j=z[I-1]):x==17?(Y=3+ii(r,h,7),h+=3):x==18&&(Y=11+ii(r,h,127),h+=7);Y--;)z[I++]=j}}var H=z.subarray(0,C),Q=z.subarray(C);g=Po(H),_=Po(Q),m=yr(H,g,1),f=yr(Q,_,1)}else throw"invalid block type";else{var x=Mf(h)+4,L=r[x-4]|r[x-3]<<8,M=x+L;if(M>i){if(s)throw"unexpected EOF";break}n&&a(d+L),e.set(r.subarray(x,M),d),t.b=d+=L,t.p=h=M*8;continue}if(h>w){if(s)throw"unexpected EOF";break}}n&&a(d+131072);for(var re=(1<<g)-1,ne=(1<<_)-1,le=h;;le=h){var j=m[Co(r,h)&re],de=j>>>4;if(h+=j&15,h>w){if(s)throw"unexpected EOF";break}if(!j)throw"invalid length/literal";if(de<256)e[d++]=de;else if(de==256){le=h,m=null;break}else{var ge=de-254;if(de>264){var I=de-257,fe=Xl[I];ge=ii(r,h,(1<<fe)-1)+Kl[I],h+=fe}var Se=f[Co(r,h)&ne],st=Se>>>4;if(!Se)throw"invalid distance";h+=Se&15;var Q=wf[st];if(st>3){var fe=kl[st];Q+=Co(r,h)&(1<<fe)-1,h+=fe}if(h>w){if(s)throw"unexpected EOF";break}n&&a(d+131072);for(var ot=d+ge;d<ot;d+=4)e[d]=e[d-Q],e[d+1]=e[d+1-Q],e[d+2]=e[d+2-Q],e[d+3]=e[d+3-Q];d=ot}}t.l=m,t.p=le,t.b=d,m&&(c=1,t.m=g,t.d=f,t.n=_)}while(!c);return d==e.length?e:Sf(e,0,d)},Pf=new Kt(0),Cf=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 Tf(r,e){return Lf((Cf(r),r.subarray(2,-4)),e)}var Gf=typeof TextDecoder<"u"&&new TextDecoder,Wf=0;try{Gf.decode(Pf,{stream:!0}),Wf=1}catch{}class Zf extends p.Mesh{constructor(e,t={}){super(e),this.isWater=!0;const i=this,n=t.textureWidth!==void 0?t.textureWidth:512,s=t.textureHeight!==void 0?t.textureHeight:512,a=t.clipBias!==void 0?t.clipBias:0,c=t.alpha!==void 0?t.alpha:1,h=t.time!==void 0?t.time:0,d=t.waterNormals!==void 0?t.waterNormals:null,m=t.sunDirection!==void 0?t.sunDirection:new p.Vector3(.70707,.70707,0),f=new p.Color(t.sunColor!==void 0?t.sunColor:16777215),g=new p.Color(t.waterColor!==void 0?t.waterColor:8355711),_=t.eye!==void 0?t.eye:new p.Vector3(0,0,0),w=t.distortionScale!==void 0?t.distortionScale:20,b=t.side!==void 0?t.side:p.FrontSide,x=t.fog!==void 0?t.fog:!1,L=new p.Plane,M=new p.Vector3,C=new p.Vector3,W=new p.Vector3,D=new p.Matrix4,z=new p.Vector3(0,0,-1),X=new p.Vector4,I=new p.Vector3,U=new p.Vector3,V=new p.Vector4,G=new p.Matrix4,N=new p.PerspectiveCamera,j=new p.WebGLRenderTarget(n,s),Y={uniforms:p.UniformsUtils.merge([p.UniformsLib.fog,p.UniformsLib.lights,{normalSampler:{value:null},mirrorSampler:{value:null},alpha:{value:1},time:{value:0},size:{value:1},distortionScale:{value:20},textureMatrix:{value:new p.Matrix4},sunColor:{value:new p.Color(8355711)},sunDirection:{value:new p.Vector3(.70707,.70707,0)},eye:{value:new p.Vector3},waterColor:{value:new p.Color(5592405)}}]),vertexShader:`
2
2
  uniform mat4 textureMatrix;
3
3
  uniform float time;
4
4
 
@@ -1119,9 +1119,9 @@ function print() { __p += __j.call(arguments, '') }
1119
1119
  );
1120
1120
  }
1121
1121
  }
1122
- `)}setDiffusionFromObject(e){if(!this.shaderOption.effects?.diffusion)return;const t=new ut.Box3().setFromObject(e);if(t.isEmpty())return;const i=new ut.Vector3;t.getCenter(i);const n=[new ut.Vector3(t.min.x,t.min.y,t.min.z),new ut.Vector3(t.max.x,t.max.y,t.max.z)];let s=0;n.forEach(a=>{const c=i.distanceTo(a);c>s&&(s=c)}),this.shaderOption.effects.diffusion={...this.shaderOption.effects.diffusion,center:i,maxDistance:s},this.needsUpdate=!0}updateBoundingBox(e,t){this.shaderOption.minY=e,this.shaderOption.maxY=t,this.needsUpdate=!0}updateEffects(e){this.shaderOption.effects={...this.shaderOption.effects,...e},this.needsUpdate=!0}animate(){requestAnimationFrame(()=>this.animate()),this.time.value=this.clock.getElapsedTime(),this.startTime.value<1&&(this.startTime.value+=.01)}}var iy=Object.defineProperty,ny=(r,e,t)=>e in r?iy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ri=(r,e,t)=>ny(r,typeof e!="symbol"?e+"":e,t);const ry={emissive:!1,emissiveIntensity:1,emissiveColor:"#ffffff"};class sh extends ni{constructor(e){super(e),ri(this,"_type","Model"),ri(this,"_emissive",!1),ri(this,"_emissiveIntensity",1),ri(this,"_emissiveColor","#ffffff"),ri(this,"_mixer",null),ri(this,"_currentAction",null),ri(this,"_animations",[]),ri(this,"_clock",new p.Clock),ri(this,"_autoUpdate",!0),ri(this,"_animationRequestId",null),ri(this,"_iscity",!1),this._emissive=e.emissive||!1,this._emissiveIntensity=e.emissiveIntensity||1,this._emissiveColor=e.emissiveColor||"#ffffff",this.castShadow=e.castShadow||!1,this.receiveShadow=e.receiveShadow||!1,this._iscity=e.iscity||!1}async _toThreeJSGeometry(){if(this._position=this._coordsTransform(),this._style){if(this._threeGeometry&&this._disposeGeometry(),this.modelunino=await this._createObject(this._style),this._threeGeometry=this.modelunino.model,!this._threeGeometry){console.error("Model load failed: model returned by _createObject is undefined"),console.error("模型加载失败:_createObject返回的model为undefined");return}this._threeGeometry.userData._type="Model",this.modelunino.animations&&this.modelunino.animations.length>0&&(this._animations=this.modelunino.animations,this._mixer=new p.AnimationMixer(this._threeGeometry),this._startAnimationLoop(),this.playAnimation({name:this._animations[0].name,loop:!0,speed:1.5,fadeInDuration:.5,fadeOutDuration:.3})),this._updateGeometry(),this.setShadows({cast:this.castShadow,receive:this.receiveShadow}),this._applyEmissionProperties(),this._iscity&&this._rendercity(),this.trigger("loaded",{timestamp:xc(),targrt:this})}}async _createObject(e){switch(e.config.type){case"fbx":case"gltf":return gg(e.config,this._position);default:throw new Error(`Unsupported style type: ${e.config.type}`)}}_applyEmissionProperties(){this._threeGeometry&&this._threeGeometry.traverse(e=>{if("material"in e){const t=e.material;t&&(t.emissiveIntensity=this._emissive?this._emissiveIntensity:0,t.emissive&&t.emissive.setStyle(this._emissiveColor))}})}get emissive(){return this._emissive}set emissive(e){this._emissive=e,this._applyEmissionProperties()}get emissiveIntensity(){return this._emissiveIntensity}set emissiveIntensity(e){this._emissiveIntensity=e,this._applyEmissionProperties()}get emissiveColor(){return this._emissiveColor}set emissiveColor(e){this._emissiveColor=e,this._applyEmissionProperties()}setEmission(e,t,i){this._emissive=e,t!==void 0&&(this._emissiveIntensity=t),i!==void 0&&(this._emissiveColor=i),this._applyEmissionProperties()}async setShadows(e){this.castShadow=e.cast,this.receiveShadow=e.receive,this._threeGeometry&&this._threeGeometry.traverse(t=>{t.isMesh&&t.material&&(t.castShadow=e.cast,t.receiveShadow=e.receive)})}playAnimation(e){if(!this._mixer||this._animations.length===0){console.warn("No available animations for model"),console.warn("模型没有可用的动画");return}this._currentAction&&(e.fadeOutDuration&&e.fadeOutDuration>0?this._currentAction.fadeOut(e.fadeOutDuration):this._currentAction.stop());const t=typeof e.name=="number"?this._animations[e.name]:this._animations.find(i=>i.name===e.name);if(!t){console.warn(`Animation not found: ${e.name}`),console.warn(`找不到动画: ${e.name}`);return}this._currentAction=this._mixer.clipAction(t),this._currentAction.setLoop(e.loop?p.LoopRepeat:p.LoopOnce,e.loop?1/0:1),this._currentAction.timeScale=e.speed||1,this._currentAction.time=e.startAt||0,this._currentAction.setEffectiveWeight(e.weight||1),e.fadeInDuration&&e.fadeInDuration>0&&this._currentAction.fadeIn(e.fadeInDuration),this._currentAction.play(),this._autoUpdate&&this._animationRequestId===null&&this._startAnimationLoop()}stopAnimation(e={}){this._currentAction&&(e.fadeDuration&&e.fadeDuration>0?(this._currentAction.fadeOut(e.fadeDuration),setTimeout(()=>{this._currentAction&&(this._currentAction.stop(),this._currentAction=null)},e.fadeDuration*1e3)):(this._currentAction.stop(),this._currentAction=null))}setAnimationPaused(e){this._currentAction&&(this._currentAction.paused=e.paused)}setAnimationSpeed(e){this._currentAction&&(this._currentAction.timeScale=e.speed)}updateAnimation(e){this._mixer&&this._mixer.update(e.deltaTime)}getAnimationNames(){return this._animations.map(e=>e.name)}getCurrentAnimationName(){return this._currentAction?this._currentAction.getClip().name:null}getAnimationDuration(e){let t;return typeof e.name=="number"?t=this._animations[e.name]:t=this._animations.find(i=>i.name===e.name),t?t.duration:null}dispose(){this._stopAnimationLoop(),this._mixer&&(this._mixer.stopAllAction(),this._mixer.uncacheRoot(this._threeGeometry)),super.dispose()}_startAnimationLoop(){if(!this._autoUpdate||this._animationRequestId!==null)return;const e=()=>{if(this._mixer){const t=this._clock.getDelta();this._mixer.update(t)}this._animationRequestId=requestAnimationFrame(e)};this._clock.start(),this._animationRequestId=requestAnimationFrame(e)}_stopAnimationLoop(){this._animationRequestId!==null&&(cancelAnimationFrame(this._animationRequestId),this._animationRequestId=null),this._clock.stop()}setAutoUpdate(e){this._autoUpdate=e,e?this._startAnimationLoop():this._stopAnimationLoop()}_computeOverlayVertices(e){const t=e.feature;if(t&&Array.isArray(t._vertexPoints)&&t._vertexPoints.length>=6){const h=t.getMap?.()||this.getMap();if(h&&h.prjcenter){const d=h.prjcenter,m=t._vertexPoints,f=[];for(let g=0;g+2<m.length;g+=3){const _=m[g],w=m[g+2],b=d.x+_,x=d.z+w;f.push(new p.Vector2(b,x))}if(f.length>=3)return f}}const i=this.getMap();if(!i||!e.geometry)return null;const n=e.geometry;let s;if(n.type==="Polygon")s=n.coordinates;else if(n.type==="MultiPolygon"){if(!n.coordinates.length)return null;s=n.coordinates[0]}else return null;if(!s.length||!s[0].length)return null;const a=s[0],c=[];for(const h of a){const d=h[0],m=h[1],f=i.geo2world(new p.Vector3(d,m,0));c.push(new p.Vector2(f.x,f.z))}return c.length<3?null:c}_rendercity(){const e=this.getLayer();let t=null;if(e&&e.getRegionOverlays){const i=e.getRegionOverlays()||[];if(i.length){const n=i.filter(a=>(a.mode??"overlay")==="overlay").sort((a,c)=>(a.zIndex??0)-(c.zIndex??0)),s=n[n.length-1];if(s&&(s.geometry||s.feature)){const a=this._computeOverlayVertices(s);a&&a.length>=3&&(t={color:new p.Color(s.color??"#00FF88"),opacity:s.opacity??.3,vertices:a})}}}this.traverse(async i=>{if(i instanceof p.Mesh&&i.material){if(i.castShadow=!0,i.name==="building"){const n=new ty({color:new p.Color("#6BA7EC").multiplyScalar(1.8),opacity:.9,shaderOption:{minY:0,maxY:50,minRate:.3,maxRate:1.5,effects:{diffusion:{enabled:!0,color:new p.Color("#FFFFF"),width:300,speed:.05},flow:{enabled:!1,color:new p.Color("#FFFFF"),range:1e3,speed:3e3},sweep:{enabled:!0,color:new p.Color("#ffffff"),width:3,speed:5}}},regionOverlay:t||void 0}),s=new p.Box3().setFromObject(i);n.updateBoundingBox(s.min.y,s.max.y),n.setDiffusionFromObject(i),i.receiveShadow=!1,i.material=n,i.material.needsUpdate=!0}i.name==="grass"&&(i.castShadow=!1,i.receiveShadow=!0,i.material.color=new p.Color("#81e4d8ff)").multiplyScalar(.7),i.material.metalness=.2,i.material.roughness=.8,["metalnessMap","normalMap","roughnessMap","specularColorMap"].forEach(n=>{const s=i.material[n];s&&(s.wrapS=s.wrapT=p.RepeatWrapping,s.repeat.set(.3,.3),s.needsUpdate=!0)}),i.material.normalScale=new p.Vector2(3,3))}})}}sh.mergeOptions(ry);var sy=Object.defineProperty,oy=(r,e,t)=>e in r?sy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ay=(r,e,t)=>oy(r,e+"",t);const ly={};class oh extends ni{constructor(e){super(e),ay(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 bg(e.config,this._position);default:throw new Error(`Unsupported style type: ${e.config.type}`)}}}oh.mergeOptions(ly);var cy=Object.defineProperty,hy=(r,e,t)=>e in r?cy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,uy=(r,e,t)=>hy(r,e+"",t);const dy={};class ah extends ni{constructor(e){super(e),uy(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 Mg(e.config,new p.Vector3(0,0,0),this.getMap());case"canvas-label":return xg(e.config,new p.Vector3(0,0,0));default:throw new Error(`Unsupported style type: ${e.config.type}`)}}}ah.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,lh=(r,e,t)=>py(r,typeof e!="symbol"?e+"":e,t);const my={};class ch extends ni{constructor(e){super(e),lh(this,"_type","TPoints"),lh(this,"_geometries"),this._geometries=e.geometries}async _toThreeJSGeometry(){this._position=this._coordsTransform(),this._style&&(this._threeGeometry&&this._disposeGeometry(),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}_updateGeometry(){this._threeGeometry&&(this._threeGeometry.points&&this.add(this._threeGeometry.points),this._threeGeometry.InstancedCol&&this.add(this._threeGeometry.InstancedCol),this.updateMatrixWorld(!0))}async _createObject(e){switch(e.config.type){case"light":return Vg(e.config,this._geometries,this.getMap());default:throw new Error(`Unsupported style type: ${e.config.type}`)}}}ch.mergeOptions(my);var gy=Object.defineProperty,yy=(r,e,t)=>e in r?gy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Qi=(r,e,t)=>yy(r,typeof e!="symbol"?e+"":e,t);class Vr extends Yi(Object){constructor(e,t){super(),Qi(this,"options"),Qi(this,"map"),Qi(this,"_sprite",null),Qi(this,"_isDragging",!1),Qi(this,"_dragStartPosition",null),Qi(this,"_lastCoordinate",null),Qi(this,"_boundOnMouseMove",null),Qi(this,"_boundOnMouseUp",null),this.map=t,this.options={position:e.position,index:e.index,symbol:e.symbol??0,size:e.size??8,color:e.color??"#ffffff",opacity:e.opacity??.9,draggable:e.draggable??!0},this._createSprite(),this._boundOnMouseMove=this._onMouseMove.bind(this),this._boundOnMouseUp=this._onMouseUp.bind(this)}_createSprite(){const t=document.createElement("canvas"),i=t.getContext("2d");t.width=64,t.height=64;const n=64/2,s=64/2-2;i.clearRect(0,0,t.width,t.height),i.beginPath(),i.arc(n,n,s,0,2*Math.PI),i.fillStyle="#000000",i.fill(),i.beginPath(),i.arc(n,n,s-2,0,2*Math.PI),i.fillStyle=this.options.color,i.fill();const a=new p.CanvasTexture(t);a.needsUpdate=!0;const c=new p.SpriteMaterial({map:a,opacity:this.options.opacity,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!0});this._sprite=new p.Sprite(c),this._sprite.position.copy(this.options.position),this._sprite.renderOrder=999999;const h=new p.Vector2;this._sprite.onBeforeRender=(d,m,f)=>{if(!this._sprite||!f)return;const g=f.position.distanceTo(this._sprite.position);d.getSize(h);const _=d.getPixelRatio(),w=this.options.size*_;let b=1;if(f.isPerspectiveCamera){const x=f.fov*Math.PI/180,L=2*Math.tan(x/2)*g;b=w/h.y*L}else if(f.isOrthographicCamera){const x=f.top,L=f.bottom,M=Math.abs(x-L)/f.zoom;b=w/h.y*M}this._sprite.scale.set(b,b,1)},this._sprite._editHandle=this,this.map.viewer.scene.add(this._sprite)}updatePosition(e){this.options.position=e,this._sprite&&this._sprite.position.copy(e)}getPosition(){return this.options.position.clone()}getIndex(){return this.options.index}getSymbol(){return this.options.symbol}getSprite(){return this._sprite}intersect(e){return!this._sprite||!this.options.draggable?!1:e.intersectObject(this._sprite).length>0}startDrag(e){this.options.draggable&&(this._isDragging=!0,this._dragStartPosition=this.options.position.clone(),this._lastCoordinate=e,this.map.viewer.config("draggable",!1),this.map.on("mousemove",this._boundOnMouseMove),this.map.on("mouseup",this._boundOnMouseUp),this.trigger("dragstart",{target:this,coordinate:e,position:this.options.position.clone()}))}_onMouseMove(e){if(!this._isDragging||!this._lastCoordinate)return;const t=e.coordinate,i=t[0]-this._lastCoordinate[0],n=t[1]-this._lastCoordinate[1],s=this.map.world2geo(this.options.position),a=this.map.geo2world(new p.Vector3(t[0],t[1],s.z));this.updatePosition(a),this._lastCoordinate=t,this.trigger("dragging",{target:this,coordinate:t,position:this.options.position.clone(),offset:{dx:i,dy:n}})}_onMouseUp(e){this._isDragging&&(this._isDragging=!1,this.map.viewer.config("draggable",!0),this.map.off("mousemove",this._boundOnMouseMove),this.map.off("mouseup",this._boundOnMouseUp),this.trigger("dragend",{target:this,coordinate:e.coordinate,position:this.options.position.clone(),startPosition:this._dragStartPosition}),this._dragStartPosition=null,this._lastCoordinate=null)}show(){this._sprite&&(this._sprite.visible=!0)}hide(){this._sprite&&(this._sprite.visible=!1)}remove(){if(this._isDragging&&(this._isDragging=!1,this.map.viewer.config("draggable",!0),this.map.off("mousemove",this._boundOnMouseMove),this.map.off("mouseup",this._boundOnMouseUp)),this._sprite){this.map.viewer.scene.remove(this._sprite);const e=this._sprite.material;e.map&&e.map.dispose(),e.dispose(),this._sprite=null}this._dragStartPosition=null,this._lastCoordinate=null,this._boundOnMouseMove=null,this._boundOnMouseUp=null}}function sa(r,e,t){const{currentTarget:i,clientX:n,clientY:s}=r;if(i instanceof HTMLElement){const a=i.clientWidth,c=i.clientHeight,h=new p.Vector2(n/a*2-1,-(s/c)*2+1);return e.getLocalInfoFromScreen(t,h)?.location}else return}var _y=Object.defineProperty,vy=(r,e,t)=>e in r?_y(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ft=(r,e,t)=>vy(r,typeof e!="symbol"?e+"":e,t);class wy extends ds{constructor(e,t){super(e),ft(this,"options"),ft(this,"_handles",[]),ft(this,"_middleHandles",[]),ft(this,"_middleHandleColor","rgba(255, 255, 255, 0.6)"),ft(this,"_editing",!1),ft(this,"_shadow",null),ft(this,"_shadowSnapshot",null),ft(this,"_updating",!1),ft(this,"_history",[]),ft(this,"_historyIndex",-1),ft(this,"_draggableOriginalState",!1),ft(this,"_boundOnMapMouseMove",null),ft(this,"_boundOnMapClick",null),ft(this,"_boundOnMapMouseDown",null),ft(this,"_boundOnFeatureDragging",null),ft(this,"_boundOnFeatureDragEnd",null),this.options={handleSize:t?.handleSize??8,handleColor:t?.handleColor??"#ffffff",showMiddleHandles:t?.showMiddleHandles??!1,maxHistorySize:t?.maxHistorySize??20,removeVertexOn:t?.removeVertexOn??"contextmenu"},this._boundOnMapMouseMove=this._onMapMouseMove.bind(this),this._boundOnMapClick=this._onMapClick.bind(this),this._boundOnMapMouseDown=this._onMapMouseDown.bind(this),this._boundOnFeatureDragging=this._onFeatureDragging.bind(this),this._boundOnFeatureDragEnd=this._onFeatureDragEnd.bind(this)}enable(){return this._editing?this:(super.enable(),this._editing=!0,this._createShadow(),this._saveSnapshot(),this._setFeatureEditingStyle(!0),this._createHandles(),this.target.trigger("editstart"),this._draggableOriginalState=this.target.options.draggable||!1,this._draggableOriginalState||(this.target.options.draggable=!0,this.target.draggable&&this.target.draggable.enable()),this)}disable(){return this._editing?(super.disable(),this._editing=!1,this._clearHandles(),this._setFeatureEditingStyle(!1),this._draggableOriginalState||(this.target.options.draggable=!1,this.target.draggable&&this.target.draggable.disable()),this._draggableOriginalState=!1,this._updateCoordFromShadow(),this._removeShadow(),this.target.trigger("editend"),this):this}addHooks(){const e=this._getMap();e&&(e.on("mousemove",this._boundOnMapMouseMove),e.on("click",this._boundOnMapClick),e.viewer.container&&e.viewer.container.addEventListener("mousedown",this._boundOnMapMouseDown,!0),this.options.removeVertexOn==="contextmenu"&&e.on("contextmenu",this._boundOnMapClick)),this.target.on("dragging",this._boundOnFeatureDragging),this.target.on("dragend",this._boundOnFeatureDragEnd)}removeHooks(){const e=this._getMap();e&&(e.off("mousemove",this._boundOnMapMouseMove),e.off("click",this._boundOnMapClick),e.viewer.container&&e.viewer.container.removeEventListener("mousedown",this._boundOnMapMouseDown,!0),this.options.removeVertexOn==="contextmenu"&&e.off("contextmenu",this._boundOnMapClick)),this.target.off("dragging",this._boundOnFeatureDragging),this.target.off("dragend",this._boundOnFeatureDragEnd)}isEditing(){return this._editing}_createShadow(){this._shadow=null}_removeShadow(){this._shadow&&(this._shadow=null),this._shadowSnapshot=null}_updateCoordFromShadow(e=!1){e&&!this._updating&&this.target._onPositionChanged(!0)}_saveSnapshot(){const e=this.target._geometry;this._shadowSnapshot={type:e.type,coordinates:JSON.parse(JSON.stringify(e.coordinates))},this._addHistory(e.coordinates)}_addHistory(e){this._historyIndex<this._history.length-1&&(this._history=this._history.slice(0,this._historyIndex+1)),this._history.push({coordinates:JSON.parse(JSON.stringify(e)),timestamp:Date.now()}),this._history.length>this.options.maxHistorySize?this._history.shift():this._historyIndex++}undo(){if(this._historyIndex>0){this._historyIndex--;const e=this._history[this._historyIndex];this._restoreCoordinates(e.coordinates),this.target.trigger("editundo")}return this}redo(){if(this._historyIndex<this._history.length-1){this._historyIndex++;const e=this._history[this._historyIndex];this._restoreCoordinates(e.coordinates),this.target.trigger("editredo")}return this}_restoreCoordinates(e){const t=this.target._geometry;t.coordinates=JSON.parse(JSON.stringify(e)),this.target._onPositionChanged(!0),this._updateHandlePositions()}cancel(){return this._shadowSnapshot&&this._restoreCoordinates(this._shadowSnapshot.coordinates),this.disable(),this}_createHandles(){const e=this.target._geometry,t=this._getMap();if(!t){console.warn("[FeatureEditHandler] No map found, cannot create handles");return}this.target instanceof ni?this._createPointHandles(e,t):this.target instanceof Lt?this._createLineStringHandles(e,t):this.target instanceof wi&&this._createPolygonHandles(e,t)}_createPointHandles(e,t){const i=e.coordinates,n=t.geo2world(new p.Vector3(i[0],i[1],i[2]||0)),s=new Vr({position:n,index:0,symbol:0,size:this.options.handleSize,color:this.options.handleColor},t);s.on("dragstart",a=>{this._onHandleDragStart(a,0)}),s.on("dragging",a=>{this._onHandleDragging(a,0)}),s.on("dragend",a=>{this._onHandleDragEnd(a,0)}),this._handles.push(s)}_createLineStringHandles(e,t){const i=e.coordinates;i.forEach((n,s)=>{const a=t.geo2world(new p.Vector3(n[0],n[1],n[2]||0)),c=new Vr({position:a,index:s,symbol:0,size:this.options.handleSize,color:this.options.handleColor},t);c.on("dragstart",h=>{this._onHandleDragStart(h,s)}),c.on("dragging",h=>{this._onHandleDragging(h,s)}),c.on("dragend",h=>{this._onHandleDragEnd(h,s)}),this._handles.push(c)}),this.options.showMiddleHandles&&this._createLineStringMiddleHandles(i,t)}_onHandleDragging(e,t){this._updating=!0;const n=e.target.getPosition();if(!this._getMap())return;const a=this._fixHandlePointCoordinates(n,t),c=this.target._geometry;this.target instanceof ni?c.coordinates=[a.x,a.y,a.z]:this.target instanceof Lt&&(c.coordinates[t]=[a.x,a.y,a.z]),this.target._onPositionChanged(!0),this.target.trigger("handledragging",{index:t,coordinate:[a.x,a.y,a.z]}),this.target.trigger("editing",{index:t,coordinate:[a.x,a.y,a.z]}),this._updating=!1}_onHandleDragStart(e,t){this._updating=!0,this.target.trigger("handledragstart",{index:t,coordinate:e.coordinate})}_onHandleDragEnd(e,t){this._updating=!1;const i=this.target._geometry;this._addHistory(i.coordinates),this.target.trigger("handledragend",{index:t,coordinate:this.target instanceof ni?i.coordinates:i.coordinates[t]}),this.target.trigger("editvertex",{index:t,coordinate:this.target instanceof ni?i.coordinates:i.coordinates[t]})}_createPolygonHandles(e,t){const i=e.coordinates;if(!i||!Array.isArray(i)||i.length===0){console.warn("[FeatureEditHandler] Invalid polygon coordinates");return}i.forEach((s,a)=>{if(!s||s.length<3)return;const c=s[0][0]===s[s.length-1][0]&&s[0][1]===s[s.length-1][1]?s.length-1:s.length;for(let h=0;h<c;h++){const d=s[h],m=t.geo2world(new p.Vector3(d[0],d[1],d[2]||0)),f=new Vr({position:m,index:h,symbol:0,size:this.options.handleSize,color:this.options.handleColor},t);f._ringIndex=a,f.on("dragstart",g=>{this._onPolygonHandleDragStart(g,h,a)}),f.on("dragging",g=>{this._onPolygonHandleDragging(g,h,a)}),f.on("dragend",g=>{this._onPolygonHandleDragEnd(g,h,a)}),this._handles.push(f)}this.options.showMiddleHandles&&this._createPolygonMiddleHandles(s,a,t)})}_onPolygonHandleDragStart(e,t,i){this._updating=!0,this.target.trigger("handledragstart",{index:t,ringIndex:i,coordinate:e.coordinate})}_onPolygonHandleDragging(e,t,i){const s=e.target.getPosition();if(!this._getMap())return;const c=this._fixHandlePointCoordinates(s,t,i),d=this.target._geometry.coordinates;if(d[i]&&d[i][t]&&(d[i][t]=[c.x,c.y,c.z],t===0&&d[i].length>1)){const m=d[i].length-1;d[i][m]=[c.x,c.y,c.z]}this.target._onPositionChanged(!0),this.target.trigger("handledragging",{index:t,ringIndex:i,coordinate:[c.x,c.y,c.z]}),this.target.trigger("editing",{index:t,ringIndex:i,coordinate:[c.x,c.y,c.z]})}_onPolygonHandleDragEnd(e,t,i){this._updating=!1;const n=this.target._geometry,s=n.coordinates;this._addHistory(n.coordinates),this.target.trigger("handledragend",{index:t,ringIndex:i,coordinate:s[i]?.[t]||null}),this.target.trigger("editvertex",{index:t,ringIndex:i,coordinate:s[i]?.[t]||null})}_updateHandlePositions(){const e=this.target._geometry,t=this._getMap();if(t){if(this.target instanceof ni){const i=e.coordinates,n=t.geo2world(new p.Vector3(i[0],i[1],i[2]||0));this._handles[0]&&this._handles[0].updatePosition(n)}else if(this.target instanceof Lt)e.coordinates.forEach((n,s)=>{const a=t.geo2world(new p.Vector3(n[0],n[1],n[2]||0));this._handles[s]&&this._handles[s].updatePosition(a)});else if(this.target instanceof wi){const i=e.coordinates;let n=0;i.forEach(s=>{const a=s[0][0]===s[s.length-1][0]&&s[0][1]===s[s.length-1][1]?s.length-1:s.length;for(let c=0;c<a;c++){const h=s[c],d=t.geo2world(new p.Vector3(h[0],h[1],h[2]||0));this._handles[n]&&this._handles[n].updatePosition(d),n++}})}}}_clearHandles(){this._handles.forEach(e=>e.remove()),this._handles=[],this._middleHandles.forEach(e=>e.remove()),this._middleHandles=[]}_onFeatureDragging(e){this._updateHandlePositions(),this.options.showMiddleHandles&&this._updateMiddleHandlePositions()}_onFeatureDragEnd(e){const t=this.target._geometry;this._addHistory(t.coordinates),this._updateHandlePositions(),this.options.showMiddleHandles&&this._updateMiddleHandlePositions()}_updateMiddleHandlePositions(){const e=this.target._geometry,t=this._getMap();if(!t)return;let i=0;if(this.target instanceof Lt){const n=e.coordinates;for(let s=0;s<n.length-1&&!(i>=this._middleHandles.length);s++){const a=n[s],c=n[s+1],h=[(a[0]+c[0])/2,(a[1]+c[1])/2,((a[2]||0)+(c[2]||0))/2],d=t.geo2world(new p.Vector3(h[0],h[1],h[2]));this._middleHandles[i].updatePosition(d),i++}}else this.target instanceof wi&&e.coordinates.forEach(s=>{const a=s[0][0]===s[s.length-1][0]&&s[0][1]===s[s.length-1][1]?s.length-1:s.length;for(let c=0;c<a&&!(i>=this._middleHandles.length);c++){const h=(c+1)%a,d=s[c],m=s[h],f=[(d[0]+m[0])/2,(d[1]+m[1])/2,((d[2]||0)+(m[2]||0))/2],g=t.geo2world(new p.Vector3(f[0],f[1],f[2]));this._middleHandles[i].updatePosition(g),i++}})}_onMapMouseDown(e){const t=this._getMap();if(!t)return;const i=new p.Raycaster;i.params.Points={threshold:.5};const n=e,s=t.viewer.renderer.domElement,a=s.getBoundingClientRect(),c=new p.Vector2((n.clientX-a.left)/a.width*2-1,-((n.clientY-a.top)/a.height)*2+1);i.setFromCamera(c,t.viewer.camera);const h=[...this._handles,...this._middleHandles];for(const d of h)if(d.intersect(i)){const m=sa({currentTarget:s,clientX:n.clientX,clientY:n.clientY},t.tilemap,t.viewer.camera);m&&(d.startDrag([m.x,m.y]),n.stopPropagation&&n.stopPropagation(),n.stopImmediatePropagation&&n.stopImmediatePropagation(),n.preventDefault&&n.preventDefault());return}}_onMapMouseMove(e){}_onMapClick(e){if(!(e.type===this.options.removeVertexOn))return;const i=this._getMap();if(!i)return;const n=new p.Raycaster;n.params.Points={threshold:.5};const s=e.originEvent;if(!s)return;const a=new p.Vector2(s.offsetX/i.viewer.renderer.domElement.clientWidth*2-1,-(s.offsetY/i.viewer.renderer.domElement.clientHeight)*2+1);n.setFromCamera(a,i.viewer.camera);for(let c=0;c<this._handles.length;c++)if(this._handles[c].intersect(n)){this._removeVertex(c),s.stopPropagation&&s.stopPropagation(),s.preventDefault&&s.preventDefault();return}}_setFeatureEditingStyle(e){const t=this.target._threeGeometry;t&&t.traverse(i=>{i.material&&(e?Array.isArray(i.material)?i.material.forEach(n=>{n.userData._originalOpacity||(n.userData._originalOpacity=n.opacity),n.opacity=Math.min(n.opacity*.6,.6),n.transparent=!0}):(i.material.userData._originalOpacity||(i.material.userData._originalOpacity=i.material.opacity),i.material.opacity=Math.min(i.material.opacity*.6,.6),i.material.transparent=!0):Array.isArray(i.material)?i.material.forEach(n=>{n.userData._originalOpacity!==void 0&&(n.opacity=n.userData._originalOpacity,delete n.userData._originalOpacity)}):i.material.userData._originalOpacity!==void 0&&(i.material.opacity=i.material.userData._originalOpacity,delete i.material.userData._originalOpacity))})}_removeVertex(e){const t=this.target._geometry,i=this._handles[e],n=i.getIndex(),s=i._ringIndex||0;let a=null;if(this.target instanceof Lt){const c=t.coordinates;if(c.length<=2){console.warn("[FeatureEditHandler] LineString requires at least 2 vertices");return}a=c[n],c.splice(n,1)}else if(this.target instanceof wi){const h=t.coordinates[s];if(!h)return;const d=h.length>1&&h[0][0]===h[h.length-1][0]&&h[0][1]===h[h.length-1][1],m=d?4:3;if(h.length<=m){console.warn("[FeatureEditHandler] Polygon ring requires at least 3 vertices");return}a=h[n],h.splice(n,1),d&&n===0&&h.length>0&&(h[h.length-1]=[...h[0]])}else return;this.target._onPositionChanged(!0),i.remove(),this._handles.splice(e,1),this._updateHandleIndices(),this._addHistory(t.coordinates),this.target.trigger("handleremove",{index:n,ringIndex:s,coordinate:a})}_createLineStringMiddleHandles(e,t){for(let i=0;i<e.length-1;i++){const n=e[i],s=e[i+1],a=[(n[0]+s[0])/2,(n[1]+s[1])/2,((n[2]||0)+(s[2]||0))/2],c=t.geo2world(new p.Vector3(a[0],a[1],a[2])),h=new Vr({position:c,index:i,symbol:1,size:this.options.handleSize,color:this._middleHandleColor,opacity:.6},t);h.on("dragstart",d=>{this._onMiddleHandleClick(i,"LineString",0)}),this._middleHandles.push(h)}}_createPolygonMiddleHandles(e,t,i){const n=e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]?e.length-1:e.length;for(let s=0;s<n;s++){const a=(s+1)%n,c=e[s],h=e[a],d=[(c[0]+h[0])/2,(c[1]+h[1])/2,((c[2]||0)+(h[2]||0))/2],m=i.geo2world(new p.Vector3(d[0],d[1],d[2])),f=new Vr({position:m,index:s,symbol:1,size:this.options.handleSize,color:this._middleHandleColor,opacity:.6},i);f._ringIndex=t,f.on("dragstart",g=>{this._onMiddleHandleClick(s,"Polygon",t)}),this._middleHandles.push(f)}}_onMiddleHandleClick(e,t,i){const n=this.target._geometry;if(this._getMap()){if(t==="LineString"){const a=n.coordinates,c=a[e],h=a[e+1],d=[(c[0]+h[0])/2,(c[1]+h[1])/2,((c[2]||0)+(h[2]||0))/2];a.splice(e+1,0,d)}else if(t==="Polygon"){const c=n.coordinates[i];if(!c)return;const h=c[0][0]===c[c.length-1][0]&&c[0][1]===c[c.length-1][1]?c.length-1:c.length,d=(e+1)%h,m=c[e],f=c[d],g=[(m[0]+f[0])/2,(m[1]+f[1])/2,((m[2]||0)+(f[2]||0))/2];c.splice(e+1,0,g),c.length>1&&c[0][0]===c[c.length-1][0]&&c[0][1]===c[c.length-1][1]&&e===h-1&&(c[c.length-1]=[...c[0]])}this.target._onPositionChanged(!0),this._clearHandles(),this._createHandles(),this._addHistory(n.coordinates),this.target.trigger("vertexinsert",{index:e+1,ringIndex:i})}}_updateHandleIndices(){if(this.target instanceof Lt)this._handles.forEach((e,t)=>{e._index=t});else if(this.target instanceof wi){let e=0;this.target._geometry.coordinates.forEach((n,s)=>{const a=n[0][0]===n[n.length-1][0]&&n[0][1]===n[n.length-1][1]?n.length-1:n.length;for(let c=0;c<a;c++)this._handles[e]&&(this._handles[e]._index=c,this._handles[e]._ringIndex=s),e++})}}_fixHandlePointCoordinates(e,t,i=0){const n=this._getMap();if(!n)return e;const s=this.target._geometry;let a=null;if(this.target instanceof ni)a=s.coordinates;else if(this.target instanceof Lt)a=s.coordinates[t];else if(this.target instanceof wi){const h=s.coordinates;h[i]&&h[i][t]&&(a=h[i][t])}if(!a||!a[2]||a[2]===0)return n.world2geo(e);const c=n.world2geo(e);return c.z=a[2],c}_getMap(){return this.target.getMap()}remove(){this.disable(),this._history=[],this._historyIndex=-1,this._shadow=null,this._shadowSnapshot=null,this._boundOnMapMouseMove=null,this._boundOnMapClick=null,this._boundOnMapMouseDown=null}}dt.prototype.startEdit=function(r){return this.options?.editable?(this._editor&&this.endEdit(),this._editor=new wy(this,r),this._editor.enable(),this):(console.warn("Feature is not editable. Set editable option to true."),this)},dt.prototype.endEdit=function(){return this._editor&&(this._editor.disable(),this._editor.remove(),delete this._editor),this},dt.prototype.isEditing=function(){return this._editor?this._editor.isEditing():!1},dt.prototype.cancelEdit=function(){return this._editor&&this._editor.cancel(),this},dt.prototype.undoEdit=function(){return this._editor&&this._editor.undo(),this},dt.prototype.redoEdit=function(){return this._editor&&this._editor.redo(),this};function bs(r,e){if(!r||r===!0)return!0;if(!Array.isArray(r))return!!r;switch(r[0]){case"all":return r.slice(1).every(i=>bs(i,e));case"any":return r.slice(1).some(i=>bs(i,e));case"!":return!bs(r[1],e);case"==":{const i=ze(r[1],e),n=ze(r[2],e);return xs(i)==xs(n)}case"!=":{const i=ze(r[1],e),n=ze(r[2],e);return xs(i)!=xs(n)}case">":{const i=ze(r[1],e),n=ze(r[2],e);return Hi(i)>Hi(n)}case"<":{const i=ze(r[1],e),n=ze(r[2],e);return Hi(i)<Hi(n)}case">=":{const i=ze(r[1],e),n=ze(r[2],e);return Hi(i)>=Hi(n)}case"<=":{const i=ze(r[1],e),n=ze(r[2],e);return Hi(i)<=Hi(n)}case"in":{const i=ze(r[1],e);return r.slice(2).map(s=>ze(s,e)).includes(i)}case"!in":{const i=ze(r[1],e);return!r.slice(2).map(s=>ze(s,e)).includes(i)}case"has":{const i=r[1];return e!=null&&Object.prototype.hasOwnProperty.call(e,i)}case"!has":{const i=r[1];return!(e!=null&&Object.prototype.hasOwnProperty.call(e,i))}case"like":case"contains":{const i=ze(r[1],e),n=ze(r[2],e);return String(i).toLowerCase().includes(String(n).toLowerCase())}case"starts-with":{const i=ze(r[1],e),n=ze(r[2],e);return String(i).toLowerCase().startsWith(String(n).toLowerCase())}case"ends-with":{const i=ze(r[1],e),n=ze(r[2],e);return String(i).toLowerCase().endsWith(String(n).toLowerCase())}default:return!0}}function ze(r,e){if(Array.isArray(r))switch(r[0]){case"get":return e?e[r[1]]:void 0;default:return r}return r}function xs(r){if(r==null)return null;if(typeof r=="string"){const e=Number(r);if(!isNaN(e)&&r.trim()!=="")return e}return typeof r=="boolean"?r?1:0:r}function Hi(r){if(r==null)return 0;if(typeof r=="number")return r;if(typeof r=="boolean")return r?1:0;if(typeof r=="string"){const e=Number(r);return isNaN(e)?0:e}return Number(r)}var by=Object.defineProperty,xy=(r,e,t)=>e in r?by(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,It=(r,e,t)=>xy(r,typeof e!="symbol"?e+"":e,t);class Ms extends ji{constructor(e,t){super(e,t),It(this,"TILE_SIZE"),It(this,"EXTENT"),It(this,"style"),It(this,"interactive",!1),It(this,"_tileFeatureMap",new Map),It(this,"_activeFeatureFilter"),It(this,"_layerStyleMapCache",null),It(this,"_lastBuiltStyleMap",null),It(this,"_addedFeatureIds",new Set),It(this,"_styleInstanceCache",new Map),It(this,"_totalProcessTime",0),It(this,"_processCount",0),It(this,"_totalFeatureCount",0),this.TILE_SIZE=t.tileSize??256,this.EXTENT=t.extent??4096,this.style=t.style||[],this._onMapUpdate=this._onMapUpdate.bind(this)}getProcessStats(){return{totalTime:this._totalProcessTime,processCount:this._processCount,totalFeatures:this._totalFeatureCount,avgTime:this._processCount>0?this._totalProcessTime/this._processCount:0}}resetProcessStats(){this._totalProcessTime=0,this._processCount=0,this._totalFeatureCount=0}processTileData(e,t){const i=this.getMap(),n=`${e.z}-${e.x}-${e.y}`,s=performance.now(),a=this._tileFeatureMap.get(n);if(a&&a.length>0){for(let w=0;w<a.length;w++){const b=a[w];b.visible=!0,this._addedFeatureIds.has(b.uuid)||(b.addTo(this),this._addedFeatureIds.add(b.uuid))}return}const c=t.vectorData;if(!c||!c.layers||!i||this.style.length===0)return;const h=[],d=this.style,m=this._activeFeatureFilter;let f=this._layerStyleMapCache;(!f||f!==this._lastBuiltStyleMap)&&(f=this._buildLayerStyleMap(d),this._layerStyleMapCache=f,this._lastBuiltStyleMap=f);let g=0;Object.keys(c.layers).forEach(w=>{const b=c.layers[w],x=f.get(w)||d;for(let L=0;L<b.length;L++){g++;const M=b[L],C=M.geometry,W=M.properties;if(m&&!m(W))continue;let D=null;for(let z=0;z<x.length;z++){const X=x[z];if(this._evaluateFilter(X.filter,W,w,M.geometry.type)){D=X.style;break}}if(D){const z={isVectorTile:!0,tileZ:e.z,tileX:e.x,tileY:e.y,rawCoordinates:C,extent:this.EXTENT,tileSize:this.TILE_SIZE},X=this._createFeatureInstance(M.geometry,M.geometry.type,D,{layerName:w,...M.properties});if(X){X.userData.tileData=z;const I=JSON.stringify(D);let U=this._styleInstanceCache.get(I);U||(U=St.create(D),this._styleInstanceCache.set(I,U)),X.style=U,X.addTo(this),this._addedFeatureIds.add(X.uuid),X.initializeGeometry(),h.push(X)}}}}),this._tileFeatureMap.set(n,h);const _=performance.now()-s;this._totalProcessTime+=_,this._processCount++,this._totalFeatureCount+=h.length,this.interactive&&console.log(`[processTileData] ${n} 处理 (${g} -> ${h.length} features) 耗时: ${_.toFixed(2)}ms | 累计: ${this._totalProcessTime.toFixed(2)}ms (${this._processCount}次, ${this._totalFeatureCount}个feature)`)}_evaluateFilter(e,t,i,n){if(!e||e===!0)return!0;const s={...t,$layer:i,$type:n};return bs(e,s)}_buildLayerStyleMap(e){const t=new Map;for(let i=0;i<e.length;i++){const n=e[i],s=n.filter;if(s&&typeof s=="object"&&s.$layer){const a=Array.isArray(s.$layer)?s.$layer[0]:s.$layer;t.has(a)||t.set(a,[]),t.get(a).push(n)}}return t}hideFeaturesByTileKey(e){const t=this._tileFeatureMap.get(e);t&&t.forEach(i=>{i.visible=!1})}removeFeaturesByTileKey(e){this._removeFeaturesByTileKey(e)}_removeFeaturesByTileKey(e){const t=this._tileFeatureMap.get(e);if(t){for(let i=0;i<t.length;i++){const n=t[i];this._addedFeatureIds.delete(n.uuid),n._remove()}this._tileFeatureMap.delete(e)}}_createFeatureInstance(e,t,i,n){const a={geometry:{ismvt:!0,...e},style:i,userData:n};switch(t){case"Point":return new Ti(a);case"LineString":return new Lt(a);default:return null}}setFeatureFilter(e){this._activeFeatureFilter=e}clearFeatureFilter(){this._activeFeatureFilter=void 0}setOpacity(e){this.opacity=e,this._tileFeatureMap.forEach(t=>{t.forEach(i=>{i.material&&(i.material.opacity=e,i.material.transparent=e<1)})})}_onMapUpdate(){}updateStyle(e,t){if(!e||!Array.isArray(e)){console.warn("[VectorTileRenderLayer] updateStyle called with invalid style rules.");return}this._layerStyleMapCache=null,this._lastBuiltStyleMap=null,this.style=e,this._tileFeatureMap.forEach((i,n)=>{const s=t.get(n);if(!s||!s.data||!s.data.vectorData)return;const a=s.data.vectorData;i.forEach(c=>{const h=c.userData,d=c.userData.tileData?.rawCoordinates?.type;let m="";if(a&&a.layers){for(const[g,_]of Object.entries(a.layers))if(_.some(b=>b.properties===h||JSON.stringify(b.properties)===JSON.stringify(h))){m=g;break}}if(this._activeFeatureFilter&&!this._activeFeatureFilter(h)){c.visible=!1;return}let f=null;for(const g of e)if(this._evaluateFilter(g.filter,h,m,d)){f=g.style;break}f?(this._applyStyleToFeature(c,f),c.visible=!0):c.visible=!1})})}_applyStyleToFeature(e,t){e.style=St.create(t),e.initializeGeometry()}validateFeature(e){return e instanceof dt}dispose(){this._tileFeatureMap.forEach((e,t)=>{this._removeFeaturesByTileKey(t)})}}var My=Object.defineProperty,Sy=(r,e,t)=>e in r?My(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Pt=(r,e,t)=>Sy(r,typeof e!="symbol"?e+"":e,t);class hh extends Pr{constructor(e,t){super(e,t),this.layerId=e,Pt(this,"isTileLayer",!0),Pt(this,"layerType","base"),Pt(this,"isBaseLayer",!1),Pt(this,"_enabled",!0),Pt(this,"_visible",!0),Pt(this,"_rootTile"),Pt(this,"_loader"),Pt(this,"_LODThreshold",1),Pt(this,"isSceneLayer",!1),Pt(this,"opacity",1),Pt(this,"source"),Pt(this,"projection"),Pt(this,"minLevel",2),Pt(this,"maxLevel",19),this.source=t.source,this.projection=t.projection,this.minLevel=t.minLevel??2,this.maxLevel=t.maxLevel??19,this._LODThreshold=t.LODThreshold??1,this.opacity=t.opacity??1,this.name=`Layer-${e}`,this._loader=this.createLoader(),this._rootTile=new Ri,this._rootTile.matrixAutoUpdate=!0,this._rootTile.scale.set(this.projection.mapWidth,this.projection.mapHeight,1),this.add(this._rootTile),this._rootTile.updateMatrix(),this.layerId=e,this.name==="Layer-label-layer"&&this.position.set(0,0,1)}get LODThreshold(){return this._LODThreshold}set LODThreshold(e){this._LODThreshold=e}get loader(){return this._loader}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._rootTile&&(this._rootTile.visible=e&&this._visible)}get ivisible(){return this._visible&&super._visible}set ivisible(e){this._visible=e,this._rootTile&&(this._rootTile.visible=e&&this._enabled)}update(e){if(!(!this._enabled||!this._visible)){try{this._rootTile.update({camera:e,loader:this._loader,minLevel:this.minLevel,maxLevel:this.maxLevel,LODThreshold:this.LODThreshold})}catch{}console.groupEnd()}}_debugTileTree(){this._rootTile.traverse(e=>{e.isTile&&(e.loaded,e.visible,e.inFrustum,e.loaded)})}_getLODThreshold(){return 1}_getCurrentTileLevel(){let e=0;return this._rootTile.traverse(t=>{t.isTile&&t.loaded&&(e=Math.max(e,t.z))}),`最大层级: ${e}`}dispose(){this.remove(this._rootTile),this._rootTile.reload(this._loader)}reload(){this._rootTile.reload(this._loader)}setElevation(e){this.position.y=e,this.updateMatrix(),this.updateMatrixWorld(!0)}raiseElevation(e){this.position.z+=e,this.updateMatrix(),this.updateMatrixWorld(!0)}getElevation(){return this.position.y}}var 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 uh extends p.LoadingManager{constructor(){super(...arguments),Cy(this,"onParseEnd")}parseEnd(e){this.onParseEnd&&this.onParseEnd(e)}}const De={manager:new uh,demLoaderMap:new Map,meshLoaderMap:new Map,imgLoaderMap:new Map,registerMaterialLoader(r){De.imgLoaderMap.set(r.dataType,r),r.info.author=r.info.author??xo.name},registerGeometryLoader(r){De.demLoaderMap.set(r.dataType,r),r.info.author=r.info.author??xo.name},registerMeshLoader(r){De.meshLoaderMap.set(r.dataType,r),r.info.author=r.info.author??xo.name},getMaterialLoader(r){const e=De.imgLoaderMap.get(r.dataType);if(e)return e;throw`Source dataType "${r.dataType}" is not support!`},getGeometryLoader(r){const e=De.demLoaderMap.get(r.dataType);if(e)return e;throw`Source dataType "${r.dataType}" is not support!`},getMeshLoader(r){const e=De.meshLoaderMap.get(r.dataType);if(e)return e;throw`Source dataType "${r.dataType}" is not support!`}};var Ty=Object.defineProperty,Gy=(r,e,t)=>e in r?Ty(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Wy=(r,e,t)=>Gy(r,e+"",t);class Zy{constructor(e){Wy(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 Vy=4096,dh=Math.PI;function oa(r,e){const t=Math.floor(r[0]*e),i=Math.floor(r[1]*e),n=Math.floor((r[2]-r[0])*e),s=Math.floor((r[3]-r[1])*e);return{sx:t,sy:i,sw:n,sh:s}}function aa(r,e,t,i){if(i<r.minLevel)return{url:void 0,clipBounds:[0,0,1,1]};if(i<=r.maxLevel)return{url:r._getUrl(e,t,i),clipBounds:[0,0,1,1]};const n=Iy(e,t,i,r.maxLevel),s=n.parentNO;return{url:r._getUrl(s.x,s.y,s.z),clipBounds:n.bounds}}function Iy(r,e,t,i){const n=t-i,s={x:r>>n,y:e>>n,z:t-n},a=Math.pow(2,n),c=Math.pow(.5,n),h=r%a/a-.5+c/2,d=e%a/a-.5+c/2,m=new p.Vector2(h,d),f=new p.Box2().setFromCenterAndSize(m,new p.Vector2(c,c)),g=[f.min.x+.5,f.min.y+.5,f.max.x+.5,f.max.y+.5];return{parentNO:s,bounds:g}}function la(r,e,t,i,n=Vy){const{x:s,y:a}=r,c=(e+s/n)/Math.pow(2,i),h=(t+a/n)/Math.pow(2,i),d=c*360-180,f=Math.atan(Math.sinh(dh*(1-2*h)))*180/dh;return[parseFloat(d.toFixed(8)),parseFloat(f.toFixed(8))]}function Ay(r,e,t,i){if(!r||!r.coordinates)throw new Error("无效的geometry数据格式");const n={type:r.type,coordinates:null};function s(a){if(typeof a=="object"&&a.x!==void 0&&a.y!==void 0)return la(a,e,t,i);if(Array.isArray(a)&&a.length>0){const c=a[0];return typeof c=="object"&&c.x!==void 0&&c.y!==void 0?a.map(h=>la(h,e,t,i)):a.map(h=>s(h))}return a}return n.coordinates=s(r.coordinates),n}var Fy=Object.defineProperty,Oy=(r,e,t)=>e in r?Fy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ss=(r,e,t)=>Oy(r,typeof e!="symbol"?e+"":e,t);class Ls{constructor(){Ss(this,"_imgSource",[]),Ss(this,"_demSource"),Ss(this,"_vtSource"),Ss(this,"manager",De.manager)}get imgSource(){return this._imgSource}set imgSource(e){this._imgSource=e}get demSource(){return this._demSource}set demSource(e){this._demSource=e}get vtSource(){return this._vtSource}set vtSource(e){this._vtSource=e}async load(e){const t=await this.loadGeometry(e),i=await this.loadMaterial(e);console.assert(!!i&&!!t);for(let n=0;n<i.length;n++)t.addGroup(0,1/0,n);return{materials:i,geometry:t}}unload(e){const t=e.material,i=e.geometry;for(let n=0;n<t.length;n++)t[n].dispose();i.dispose()}async loadGeometry(e){let t;if(this.demSource&&e.z>=this.demSource.minLevel&&this._isBoundsInSourceBounds(this.demSource,e.bounds)){const i=De.getGeometryLoader(this.demSource),n=this.demSource;t=await i.load({source:n,...e}).catch(s=>(console.error("Load material error",n.dataType,e.x,e.y,e.z),new p.PlaneGeometry)),t.addEventListener("dispose",()=>{i.unload&&i.unload(t)})}else if(this.vtSource&&e.z>=this.vtSource.minLevel&&this._isBoundsInSourceBounds(this.vtSource,e.bounds)){const i=De.getMeshLoader(this.vtSource),n=this.vtSource;t=await i.load({source:n,...e}).catch(s=>(console.error("Load geometry error",n.dataType,e.x,e.y,e.z),new p.PlaneGeometry)),t.addEventListener("dispose",()=>{i.unload&&i.unload(t)})}else t=new p.PlaneGeometry;return t}async loadMaterial(e){const i=this.imgSource.filter(n=>e.z>=n.minLevel&&this._isBoundsInSourceBounds(n,e.bounds)).map(async n=>{const s=De.getMaterialLoader(n),a=await s.load({source:n,...e}).catch(h=>(console.error("Load material error",n.dataType,e.x,e.y,e.z),new p.MeshBasicMaterial)),c=h=>{s.unload&&s.unload(h.target),h.target.removeEventListener("dispose",c)};return a instanceof p.MeshBasicMaterial||a.addEventListener("dispose",c),a});return Promise.all(i)}_isBoundsInSourceBounds(e,t){const i=e._projectionBounds;return!(t[2]<i[0]||t[3]<i[1]||t[0]>i[2]||t[1]>i[3])}}function Ir(...r){const e=r,t=e&&e.length>1&&e[0].constructor||null;if(!t)throw new Error("concatenateTypedArrays - incorrect quantity of arguments or arguments have incompatible data types");const i=e.reduce((a,c)=>a+c.length,0),n=new t(i);let s=0;for(const a of e)n.set(a,s),s+=a.length;return n}function fh(r,e,t,i){const n=i?Dy(i,r.position.value):zy(e),s=n.length,a=new Float32Array(s*6),c=new Float32Array(s*4),h=new e.constructor(s*6),d=new Float32Array(s*6);for(let f=0;f<s;f++)Xy({edge:n[f],edgeIndex:f,attributes:r,skirtHeight:t,newPosition:a,newTexcoord0:c,newTriangles:h,newNormals:d});r.position.value=Ir(r.position.value,a),r.texcoord.value=Ir(r.texcoord.value,c),r.normal.value=Ir(r.normal.value,d);const m=Ir(e,h);return{attributes:r,indices:m}}function zy(r){const e=[],t=Array.isArray(r)?r:Array.from(r);for(let n=0;n<t.length;n+=3){const s=t[n],a=t[n+1],c=t[n+2];e.push([s,a],[a,c],[c,s])}e.sort(([n,s],[a,c])=>{const h=Math.min(n,s),d=Math.min(a,c);return h!==d?h-d:Math.max(n,s)-Math.max(a,c)});const i=[];for(let n=0;n<e.length;n++)n+1<e.length&&e[n][0]===e[n+1][1]&&e[n][1]===e[n+1][0]?n++:i.push(e[n]);return i}function Dy(r,e){const t=(n,s)=>{n.sort(s)};t(r.westIndices,(n,s)=>e[3*n+1]-e[3*s+1]),t(r.eastIndices,(n,s)=>e[3*s+1]-e[3*n+1]),t(r.southIndices,(n,s)=>e[3*s]-e[3*n]),t(r.northIndices,(n,s)=>e[3*n]-e[3*s]);const i=[];return Object.values(r).forEach(n=>{if(n.length>1)for(let s=0;s<n.length-1;s++)i.push([n[s],n[s+1]])}),i}function Xy({edge:r,edgeIndex:e,attributes:t,skirtHeight:i,newPosition:n,newTexcoord0:s,newTriangles:a,newNormals:c}){const h=t.position.value.length,d=e*2,m=d+1;n.set(t.position.value.subarray(r[0]*3,r[0]*3+3),d*3),n[d*3+2]=n[d*3+2]-i,n.set(t.position.value.subarray(r[1]*3,r[1]*3+3),m*3),n[m*3+2]=n[m*3+2]-i,s.set(t.texcoord.value.subarray(r[0]*2,r[0]*2+2),d*2),s.set(t.texcoord.value.subarray(r[1]*2,r[1]*2+2),m*2);const f=e*2*3;a[f]=r[0],a[f+1]=h/3+m,a[f+2]=r[1],a[f+3]=h/3+m,a[f+4]=r[0],a[f+5]=h/3+d,c[f]=0,c[f+1]=0,c[f+2]=1,c[f+3]=0,c[f+4]=0,c[f+5]=1}function ph(r){if(r.length<4)throw new Error(`DEM数组长度必须大于4,当前长度: ${r.length}!`);const e=Math.floor(Math.sqrt(r.length)),t=e,i=e,n=ca(i,t);return{attributes:ky(r,i,t),indices:n}}function ky(r,e,t){const i=t*e,n=new Float32Array(i*3),s=new Float32Array(i*2);let a=0;for(let c=0;c<e;c++)for(let h=0;h<t;h++){const d=h/(t-1),m=c/(e-1);s[a*2]=d,s[a*2+1]=m,n[a*3]=d-.5,n[a*3+1]=m-.5,n[a*3+2]=r[(e-c-1)*t+h],a++}return{position:{value:n,size:3},texcoord:{value:s,size:2},normal:{value:ha(n,ca(e,t)),size:3}}}function ca(r,e){const t=6*(e-1)*(r-1),i=new Uint16Array(t);let n=0;for(let s=0;s<r-1;s++)for(let a=0;a<e-1;a++){const c=s*e+a,h=c+1,d=c+e,m=d+1,f=n*6;i[f]=c,i[f+1]=h,i[f+2]=d,i[f+3]=d,i[f+4]=h,i[f+5]=m,n++}return i}function ha(r,e){const t=new Float32Array(r.length);for(let i=0;i<e.length;i+=3){const n=e[i]*3,s=e[i+1]*3,a=e[i+2]*3,c=r[n],h=r[n+1],d=r[n+2],m=r[s],f=r[s+1],g=r[s+2],_=r[a],w=r[a+1],b=r[a+2],x=m-c,L=f-h,M=g-d,C=_-c,W=w-h,D=b-d,z=L*D-M*W,X=M*C-x*D,I=x*W-L*C,U=Math.sqrt(z*z+X*X+I*I),V=[0,0,1];if(U>0){const G=1/U;V[0]=z*G,V[1]=X*G,V[2]=I*G}for(let G=0;G<3;G++)t[n+G]=t[s+G]=t[a+G]=V[G]}return t}var Uy=Object.defineProperty,Ny=(r,e,t)=>e in r?Uy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ky=(r,e,t)=>Ny(r,e+"",t);class jn extends p.PlaneGeometry{constructor(){super(...arguments),Ky(this,"type","TileGeometry")}setData(e,t=1e3){let i=e instanceof Float32Array?ph(e):e;i=fh(i.attributes,i.indices,t);const{attributes:n,indices:s}=i;return this.setIndex(new p.BufferAttribute(s,1)),this.setAttribute("position",new p.BufferAttribute(n.position.value,n.position.size)),this.setAttribute("uv",new p.BufferAttribute(n.texcoord.value,n.texcoord.size)),this.setAttribute("normal",new p.BufferAttribute(n.normal.value,n.normal.size)),this.computeBoundingBox(),this.computeBoundingSphere(),this}}var By=Object.defineProperty,Yy=(r,e,t)=>e in r?By(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,$i=(r,e,t)=>Yy(r,typeof e!="symbol"?e+"":e,t);class mh{constructor(e=257){$i(this,"gridSize"),$i(this,"numTriangles"),$i(this,"numParentTriangles"),$i(this,"indices"),$i(this,"coords"),this.gridSize=e;const t=e-1;if(t&t-1)throw new Error(`Expected grid size to be 2^n+1, got ${e}.`);this.numTriangles=t*t*2-2,this.numParentTriangles=this.numTriangles-t*t,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(this.numTriangles*4);for(let i=0;i<this.numTriangles;i++){let n=i+2,s=0,a=0,c=0,h=0,d=0,m=0;for(n&1?c=h=d=t:s=a=m=t;(n>>=1)>1;){const g=s+c>>1,_=a+h>>1;n&1?(c=s,h=a,s=d,a=m):(s=c,a=h,c=d,h=m),d=g,m=_}const f=i*4;this.coords[f+0]=s,this.coords[f+1]=a,this.coords[f+2]=c,this.coords[f+3]=h}}createTile(e){return new Ry(e,this)}}class Ry{constructor(e,t){$i(this,"martini"),$i(this,"terrain"),$i(this,"errors");const i=t.gridSize;if(e.length!==i*i)throw new Error(`Expected terrain data of length ${i*i} (${i} x ${i}), got ${e.length}.`);this.terrain=e,this.martini=t,this.errors=new Float32Array(e.length),this.update()}update(){const{numTriangles:e,numParentTriangles:t,coords:i,gridSize:n}=this.martini,{terrain:s,errors:a}=this;for(let c=e-1;c>=0;c--){const h=c*4,d=i[h+0],m=i[h+1],f=i[h+2],g=i[h+3],_=d+f>>1,w=m+g>>1,b=_+w-m,x=w+d-_,L=(s[m*n+d]+s[g*n+f])/2,M=w*n+_,C=Math.abs(L-s[M]);if(a[M]=Math.max(a[M],C),c<t){const W=(m+x>>1)*n+(d+b>>1),D=(g+x>>1)*n+(f+b>>1);a[M]=Math.max(a[M],a[W],a[D])}}}getGeometryData(e=0){const{gridSize:t,indices:i}=this.martini,{errors:n}=this;let s=0,a=0;const c=t-1;let h,d,m=0;i.fill(0);function f(M,C,W,D,z,X){const I=M+W>>1,U=C+D>>1;Math.abs(M-z)+Math.abs(C-X)>1&&n[U*t+I]>e?(f(z,X,M,C,I,U),f(W,D,z,X,I,U)):(h=C*t+M,d=D*t+W,m=X*t+z,i[h]===0&&(i[h]=++s),i[d]===0&&(i[d]=++s),i[m]===0&&(i[m]=++s),a++)}f(0,0,c,c,c,0),f(c,c,0,0,0,c);const g=s*2,_=a*3,w=new Uint16Array(g),b=new Uint32Array(_);let x=0;function L(M,C,W,D,z,X){const I=M+W>>1,U=C+D>>1;if(Math.abs(M-z)+Math.abs(C-X)>1&&n[U*t+I]>e)L(z,X,M,C,I,U),L(W,D,z,X,I,U);else{const V=i[C*t+M]-1,G=i[D*t+W]-1,N=i[X*t+z]-1;w[2*V]=M,w[2*V+1]=C,w[2*G]=W,w[2*G+1]=D,w[2*N]=z,w[2*N+1]=X,b[x++]=V,b[x++]=G,b[x++]=N}}return L(0,0,c,c,c,0),L(c,c,0,0,0,c),{attributes:this._getMeshAttributes(this.terrain,w,b),indices:b}}_getMeshAttributes(e,t,i){const n=Math.floor(Math.sqrt(e.length)),s=n-1,a=t.length/2,c=new Float32Array(a*3),h=new Float32Array(a*2);for(let m=0;m<a;m++){const f=t[m*2],g=t[m*2+1],_=g*n+f;c[3*m+0]=f/s-.5,c[3*m+1]=.5-g/s,c[3*m+2]=e[_],h[2*m+0]=f/s,h[2*m+1]=1-g/s}const d=ha(c,i);return{position:{value:c,size:3},texcoord:{value:h,size:2},normal:{value:d,size:3}}}}var jy=Object.defineProperty,Jy=(r,e,t)=>e in r?jy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,gh=(r,e,t)=>Jy(r,typeof e!="symbol"?e+"":e,t);class ua{constructor(){gh(this,"info",{version:"0.10.0",description:"Terrain loader base class"}),gh(this,"dataType","")}async load(e){const{source:t,x:i,y:n,z:s}=e,{url:a,clipBounds:c}=aa(t,i,n,s);if(!a)return new jn;const h=await this.doLoad(a,{source:t,x:i,y:n,z:s,bounds:c});return De.manager.parseEnd(a),h}}class da extends p.MeshStandardMaterial{constructor(e={}){super({transparent:!0,side:p.FrontSide,...e})}setTexture(e){this.map=e,this.needsUpdate=!0}dispose(){const e=this.map;e&&(e.image instanceof ImageBitmap&&e.image.close(),e.dispose())}}var rt=(r=>(r[r.Unknown=0]="Unknown",r[r.Point=1]="Point",r[r.Linestring=2]="Linestring",r[r.Polygon=3]="Polygon",r))(rt||{});class yh{render(e,t,i,n,s=1){switch(e.lineCap="round",e.lineJoin="round",(n.shadowBlur??0)>0&&(e.shadowBlur=n.shadowBlur??2,e.shadowColor=n.shadowColor??"black",e.shadowOffsetX=n.shadowOffset?n.shadowOffset[0]:0,e.shadowOffsetY=n.shadowOffset?n.shadowOffset[1]:0),t){case rt.Point:e.textAlign="center",e.textBaseline="middle",e.font=n.font??"14px Arial",e.fillStyle=n.fontColor??"white",this._renderPointText(e,i,s,n.textField??"name",n.fontOffset??[0,-8]);break;case rt.Linestring:this._renderLineString(e,i,s);break;case rt.Polygon:this._renderPolygon(e,i,s);break;default:console.warn(`Unknown feature type: ${t}`)}(n.fill||t===rt.Point)&&(e.globalAlpha=n.fillOpacity||.5,e.fillStyle=n.fillColor||n.color||"#3388ff",e.fill(n.fillRule||"evenodd")),(n.stroke??!0)&&(n.weight??1)>0&&(e.globalAlpha=n.opacity||1,e.lineWidth=n.weight||1,e.strokeStyle=n.color||"#3388ff",e.setLineDash(n.dashArray||[]),e.stroke())}_renderPointText(e,t,i=1,n="name",s=[0,0]){const a=t.geometry;e.beginPath();for(const h of a)for(let d=0;d<h.length;d++){const m=h[d];e.arc(m.x*i,m.y*i,2,0,2*Math.PI)}const c=t.properties;c&&c[n]&&e.fillText(c[n],a[0][0].x*i+s[0],a[0][0].y*i+s[1])}_renderLineString(e,t,i){const n=t.geometry;e.beginPath();for(const s of n)for(let a=0;a<s.length;a++){const{x:c,y:h}=s[a];a===0?e.moveTo(c*i,h*i):e.lineTo(c*i,h*i)}}_renderPolygon(e,t,i){const n=t.geometry;e.beginPath();for(let s=0;s<n.length;s++){const a=n[s];for(let c=0;c<a.length;c++){const{x:h,y:d}=a[c];c===0?e.moveTo(h*i,d*i):e.lineTo(h*i,d*i)}e.closePath()}}}var Qy=Object.defineProperty,Hy=(r,e,t)=>e in r?Qy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,_h=(r,e,t)=>Hy(r,typeof e!="symbol"?e+"":e,t);class fa{constructor(){_h(this,"info",{version:"0.10.0",description:"Image loader base class"}),_h(this,"dataType","")}async load(e){const{source:t,x:i,y:n,z:s}=e,a=new da({}),{url:c,clipBounds:h}=aa(t,i,n,s);if(c){const d=await this.doLoad(c,{source:t,x:i,y:n,z:s,bounds:h});a.map=d,De.manager.parseEnd(c)}return a}}var $y=Object.defineProperty,Ey=(r,e,t)=>e in r?$y(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,vh=(r,e,t)=>Ey(r,typeof e!="symbol"?e+"":e,t);class qy{constructor(){vh(this,"info",{version:"0.10.0",description:"Canvas tile abstract loader"}),vh(this,"dataType","")}async load(e){const t=this._creatCanvasContext(256,256);this.drawTile(t,e);const i=new p.CanvasTexture(t.canvas.transferToImageBitmap());return new da({transparent:!0,map:i,opacity:e.source.opacity})}_creatCanvasContext(e,t){const n=new OffscreenCanvas(e,t).getContext("2d");if(!n)throw new Error("create canvas context failed");return n.scale(1,-1),n.translate(0,-t),n}}var e_=Object.defineProperty,t_=(r,e,t)=>e in r?e_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,pa=(r,e,t)=>t_(r,typeof e!="symbol"?e+"":e,t);class i_ extends fa{constructor(){super(...arguments),pa(this,"info",{version:"0.10.0",description:"Tile image loader. It can load xyz tile image."}),pa(this,"dataType","image"),pa(this,"loader",new p.ImageLoader(De.manager))}async doLoad(e,t){const i=await this.loader.loadAsync(e).catch(a=>new Image(1,1)),n=new p.Texture;n.colorSpace=p.SRGBColorSpace;const{bounds:s}=t;return s[2]-s[0]<1?n.image=n_(i,s):n.image=i,n.needsUpdate=!0,n}}function n_(r,e){const t=r.width,i=new OffscreenCanvas(t,t),n=i.getContext("2d"),{sx:s,sy:a,sw:c,sh:h}=oa(e,r.width);return n.drawImage(r,s,a,c,h,0,0,t,t),i}const r_=`{
1122
+ `)}setDiffusionFromObject(e){if(!this.shaderOption.effects?.diffusion)return;const t=new ut.Box3().setFromObject(e);if(t.isEmpty())return;const i=new ut.Vector3;t.getCenter(i);const n=[new ut.Vector3(t.min.x,t.min.y,t.min.z),new ut.Vector3(t.max.x,t.max.y,t.max.z)];let s=0;n.forEach(a=>{const c=i.distanceTo(a);c>s&&(s=c)}),this.shaderOption.effects.diffusion={...this.shaderOption.effects.diffusion,center:i,maxDistance:s},this.needsUpdate=!0}updateBoundingBox(e,t){this.shaderOption.minY=e,this.shaderOption.maxY=t,this.needsUpdate=!0}updateEffects(e){this.shaderOption.effects={...this.shaderOption.effects,...e},this.needsUpdate=!0}animate(){requestAnimationFrame(()=>this.animate()),this.time.value=this.clock.getElapsedTime(),this.startTime.value<1&&(this.startTime.value+=.01)}}var iy=Object.defineProperty,ny=(r,e,t)=>e in r?iy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ri=(r,e,t)=>ny(r,typeof e!="symbol"?e+"":e,t);const ry={emissive:!1,emissiveIntensity:1,emissiveColor:"#ffffff"};class sh extends ni{constructor(e){super(e),ri(this,"_type","Model"),ri(this,"_emissive",!1),ri(this,"_emissiveIntensity",1),ri(this,"_emissiveColor","#ffffff"),ri(this,"_mixer",null),ri(this,"_currentAction",null),ri(this,"_animations",[]),ri(this,"_clock",new p.Clock),ri(this,"_autoUpdate",!0),ri(this,"_animationRequestId",null),ri(this,"_iscity",!1),this._emissive=e.emissive||!1,this._emissiveIntensity=e.emissiveIntensity||1,this._emissiveColor=e.emissiveColor||"#ffffff",this.castShadow=e.castShadow||!1,this.receiveShadow=e.receiveShadow||!1,this._iscity=e.iscity||!1}async _toThreeJSGeometry(){if(this._position=this._coordsTransform(),this._style){if(this._threeGeometry&&this._disposeGeometry(),this.modelunino=await this._createObject(this._style),this._threeGeometry=this.modelunino.model,!this._threeGeometry){console.error("Model load failed: model returned by _createObject is undefined"),console.error("模型加载失败:_createObject返回的model为undefined");return}this._threeGeometry.userData._type="Model",this.modelunino.animations&&this.modelunino.animations.length>0&&(this._animations=this.modelunino.animations,this._mixer=new p.AnimationMixer(this._threeGeometry),this._startAnimationLoop(),this.playAnimation({name:this._animations[0].name,loop:!0,speed:1.5,fadeInDuration:.5,fadeOutDuration:.3})),this._updateGeometry(),this.setShadows({cast:this.castShadow,receive:this.receiveShadow}),this._applyEmissionProperties(),this._iscity&&this._rendercity(),this.trigger("loaded",{timestamp:xc(),targrt:this})}}async _createObject(e){switch(e.config.type){case"fbx":case"gltf":return gg(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,this._emissive?(t.emissive&&(this._emissiveColor==="#ffffff"&&t.color?t.emissive.copy(t.color):t.emissive.setStyle(this._emissiveColor)),t.map&&!t.emissiveMap&&(t.emissiveMap=t.map,t.needsUpdate=!0)):t.emissiveMap&&t.emissiveMap===t.map&&(t.emissiveMap=null,t.needsUpdate=!0))}})}get emissive(){return this._emissive}set emissive(e){this._emissive=e,this._applyEmissionProperties()}get emissiveIntensity(){return this._emissiveIntensity}set emissiveIntensity(e){this._emissiveIntensity=e,this._applyEmissionProperties()}get emissiveColor(){return this._emissiveColor}set emissiveColor(e){this._emissiveColor=e,this._applyEmissionProperties()}setEmission(e,t,i){this._emissive=e,t!==void 0&&(this._emissiveIntensity=t),i!==void 0&&(this._emissiveColor=i),this._applyEmissionProperties()}async setShadows(e){this.castShadow=e.cast,this.receiveShadow=e.receive,this._threeGeometry&&this._threeGeometry.traverse(t=>{t.isMesh&&t.material&&(t.castShadow=e.cast,t.receiveShadow=e.receive)})}playAnimation(e){if(!this._mixer||this._animations.length===0){console.warn("No available animations for model"),console.warn("模型没有可用的动画");return}this._currentAction&&(e.fadeOutDuration&&e.fadeOutDuration>0?this._currentAction.fadeOut(e.fadeOutDuration):this._currentAction.stop());const t=typeof e.name=="number"?this._animations[e.name]:this._animations.find(i=>i.name===e.name);if(!t){console.warn(`Animation not found: ${e.name}`),console.warn(`找不到动画: ${e.name}`);return}this._currentAction=this._mixer.clipAction(t),this._currentAction.setLoop(e.loop?p.LoopRepeat:p.LoopOnce,e.loop?1/0:1),this._currentAction.timeScale=e.speed||1,this._currentAction.time=e.startAt||0,this._currentAction.setEffectiveWeight(e.weight||1),e.fadeInDuration&&e.fadeInDuration>0&&this._currentAction.fadeIn(e.fadeInDuration),this._currentAction.play(),this._autoUpdate&&this._animationRequestId===null&&this._startAnimationLoop()}stopAnimation(e={}){this._currentAction&&(e.fadeDuration&&e.fadeDuration>0?(this._currentAction.fadeOut(e.fadeDuration),setTimeout(()=>{this._currentAction&&(this._currentAction.stop(),this._currentAction=null)},e.fadeDuration*1e3)):(this._currentAction.stop(),this._currentAction=null))}setAnimationPaused(e){this._currentAction&&(this._currentAction.paused=e.paused)}setAnimationSpeed(e){this._currentAction&&(this._currentAction.timeScale=e.speed)}updateAnimation(e){this._mixer&&this._mixer.update(e.deltaTime)}getAnimationNames(){return this._animations.map(e=>e.name)}getCurrentAnimationName(){return this._currentAction?this._currentAction.getClip().name:null}getAnimationDuration(e){let t;return typeof e.name=="number"?t=this._animations[e.name]:t=this._animations.find(i=>i.name===e.name),t?t.duration:null}dispose(){this._stopAnimationLoop(),this._mixer&&(this._mixer.stopAllAction(),this._mixer.uncacheRoot(this._threeGeometry)),super.dispose()}_startAnimationLoop(){if(!this._autoUpdate||this._animationRequestId!==null)return;const e=()=>{if(this._mixer){const t=this._clock.getDelta();this._mixer.update(t)}this._animationRequestId=requestAnimationFrame(e)};this._clock.start(),this._animationRequestId=requestAnimationFrame(e)}_stopAnimationLoop(){this._animationRequestId!==null&&(cancelAnimationFrame(this._animationRequestId),this._animationRequestId=null),this._clock.stop()}setAutoUpdate(e){this._autoUpdate=e,e?this._startAnimationLoop():this._stopAnimationLoop()}_computeOverlayVertices(e){const t=e.feature;if(t&&Array.isArray(t._vertexPoints)&&t._vertexPoints.length>=6){const h=t.getMap?.()||this.getMap();if(h&&h.prjcenter){const d=h.prjcenter,m=t._vertexPoints,f=[];for(let g=0;g+2<m.length;g+=3){const _=m[g],w=m[g+2],b=d.x+_,x=d.z+w;f.push(new p.Vector2(b,x))}if(f.length>=3)return f}}const i=this.getMap();if(!i||!e.geometry)return null;const n=e.geometry;let s;if(n.type==="Polygon")s=n.coordinates;else if(n.type==="MultiPolygon"){if(!n.coordinates.length)return null;s=n.coordinates[0]}else return null;if(!s.length||!s[0].length)return null;const a=s[0],c=[];for(const h of a){const d=h[0],m=h[1],f=i.geo2world(new p.Vector3(d,m,0));c.push(new p.Vector2(f.x,f.z))}return c.length<3?null:c}_rendercity(){const e=this.getLayer();let t=null;if(e&&e.getRegionOverlays){const i=e.getRegionOverlays()||[];if(i.length){const n=i.filter(a=>(a.mode??"overlay")==="overlay").sort((a,c)=>(a.zIndex??0)-(c.zIndex??0)),s=n[n.length-1];if(s&&(s.geometry||s.feature)){const a=this._computeOverlayVertices(s);a&&a.length>=3&&(t={color:new p.Color(s.color??"#00FF88"),opacity:s.opacity??.3,vertices:a})}}}this.traverse(async i=>{if(i instanceof p.Mesh&&i.material){if(i.castShadow=!0,i.name==="building"){const n=new ty({color:new p.Color("#6BA7EC").multiplyScalar(1.8),opacity:.9,shaderOption:{minY:0,maxY:50,minRate:.3,maxRate:1.5,effects:{diffusion:{enabled:!0,color:new p.Color("#FFFFF"),width:300,speed:.05},flow:{enabled:!1,color:new p.Color("#FFFFF"),range:1e3,speed:3e3},sweep:{enabled:!0,color:new p.Color("#ffffff"),width:3,speed:5}}},regionOverlay:t||void 0}),s=new p.Box3().setFromObject(i);n.updateBoundingBox(s.min.y,s.max.y),n.setDiffusionFromObject(i),i.receiveShadow=!1,i.material=n,i.material.needsUpdate=!0}i.name==="grass"&&(i.castShadow=!1,i.receiveShadow=!0,i.material.color=new p.Color("#81e4d8ff)").multiplyScalar(.7),i.material.metalness=.2,i.material.roughness=.8,["metalnessMap","normalMap","roughnessMap","specularColorMap"].forEach(n=>{const s=i.material[n];s&&(s.wrapS=s.wrapT=p.RepeatWrapping,s.repeat.set(.3,.3),s.needsUpdate=!0)}),i.material.normalScale=new p.Vector2(3,3))}})}}sh.mergeOptions(ry);var sy=Object.defineProperty,oy=(r,e,t)=>e in r?sy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ay=(r,e,t)=>oy(r,e+"",t);const ly={};class oh extends ni{constructor(e){super(e),ay(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 bg(e.config,this._position);default:throw new Error(`Unsupported style type: ${e.config.type}`)}}}oh.mergeOptions(ly);var cy=Object.defineProperty,hy=(r,e,t)=>e in r?cy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,uy=(r,e,t)=>hy(r,e+"",t);const dy={};class ah extends ni{constructor(e){super(e),uy(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 Mg(e.config,new p.Vector3(0,0,0),this.getMap());case"canvas-label":return xg(e.config,new p.Vector3(0,0,0));default:throw new Error(`Unsupported style type: ${e.config.type}`)}}}ah.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,lh=(r,e,t)=>py(r,typeof e!="symbol"?e+"":e,t);const my={};class ch extends ni{constructor(e){super(e),lh(this,"_type","TPoints"),lh(this,"_geometries"),this._geometries=e.geometries}async _toThreeJSGeometry(){this._position=this._coordsTransform(),this._style&&(this._threeGeometry&&this._disposeGeometry(),this._threeGeometry=await this._createObject(this._style),this._updateGeometry())}_updateGeometry(){this._threeGeometry&&(this._threeGeometry.points&&this.add(this._threeGeometry.points),this._threeGeometry.InstancedCol&&this.add(this._threeGeometry.InstancedCol),this.updateMatrixWorld(!0))}async _createObject(e){switch(e.config.type){case"light":return Vg(e.config,this._geometries,this.getMap());default:throw new Error(`Unsupported style type: ${e.config.type}`)}}}ch.mergeOptions(my);var gy=Object.defineProperty,yy=(r,e,t)=>e in r?gy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Qi=(r,e,t)=>yy(r,typeof e!="symbol"?e+"":e,t);class Vr extends Yi(Object){constructor(e,t){super(),Qi(this,"options"),Qi(this,"map"),Qi(this,"_sprite",null),Qi(this,"_isDragging",!1),Qi(this,"_dragStartPosition",null),Qi(this,"_lastCoordinate",null),Qi(this,"_boundOnMouseMove",null),Qi(this,"_boundOnMouseUp",null),this.map=t,this.options={position:e.position,index:e.index,symbol:e.symbol??0,size:e.size??8,color:e.color??"#ffffff",opacity:e.opacity??.9,draggable:e.draggable??!0},this._createSprite(),this._boundOnMouseMove=this._onMouseMove.bind(this),this._boundOnMouseUp=this._onMouseUp.bind(this)}_createSprite(){const t=document.createElement("canvas"),i=t.getContext("2d");t.width=64,t.height=64;const n=64/2,s=64/2-2;i.clearRect(0,0,t.width,t.height),i.beginPath(),i.arc(n,n,s,0,2*Math.PI),i.fillStyle="#000000",i.fill(),i.beginPath(),i.arc(n,n,s-2,0,2*Math.PI),i.fillStyle=this.options.color,i.fill();const a=new p.CanvasTexture(t);a.needsUpdate=!0;const c=new p.SpriteMaterial({map:a,opacity:this.options.opacity,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!0});this._sprite=new p.Sprite(c),this._sprite.position.copy(this.options.position),this._sprite.renderOrder=999999;const h=new p.Vector2;this._sprite.onBeforeRender=(d,m,f)=>{if(!this._sprite||!f)return;const g=f.position.distanceTo(this._sprite.position);d.getSize(h);const _=d.getPixelRatio(),w=this.options.size*_;let b=1;if(f.isPerspectiveCamera){const x=f.fov*Math.PI/180,L=2*Math.tan(x/2)*g;b=w/h.y*L}else if(f.isOrthographicCamera){const x=f.top,L=f.bottom,M=Math.abs(x-L)/f.zoom;b=w/h.y*M}this._sprite.scale.set(b,b,1)},this._sprite._editHandle=this,this.map.viewer.scene.add(this._sprite)}updatePosition(e){this.options.position=e,this._sprite&&this._sprite.position.copy(e)}getPosition(){return this.options.position.clone()}getIndex(){return this.options.index}getSymbol(){return this.options.symbol}getSprite(){return this._sprite}intersect(e){return!this._sprite||!this.options.draggable?!1:e.intersectObject(this._sprite).length>0}startDrag(e){this.options.draggable&&(this._isDragging=!0,this._dragStartPosition=this.options.position.clone(),this._lastCoordinate=e,this.map.viewer.config("draggable",!1),this.map.on("mousemove",this._boundOnMouseMove),this.map.on("mouseup",this._boundOnMouseUp),this.trigger("dragstart",{target:this,coordinate:e,position:this.options.position.clone()}))}_onMouseMove(e){if(!this._isDragging||!this._lastCoordinate)return;const t=e.coordinate,i=t[0]-this._lastCoordinate[0],n=t[1]-this._lastCoordinate[1],s=this.map.world2geo(this.options.position),a=this.map.geo2world(new p.Vector3(t[0],t[1],s.z));this.updatePosition(a),this._lastCoordinate=t,this.trigger("dragging",{target:this,coordinate:t,position:this.options.position.clone(),offset:{dx:i,dy:n}})}_onMouseUp(e){this._isDragging&&(this._isDragging=!1,this.map.viewer.config("draggable",!0),this.map.off("mousemove",this._boundOnMouseMove),this.map.off("mouseup",this._boundOnMouseUp),this.trigger("dragend",{target:this,coordinate:e.coordinate,position:this.options.position.clone(),startPosition:this._dragStartPosition}),this._dragStartPosition=null,this._lastCoordinate=null)}show(){this._sprite&&(this._sprite.visible=!0)}hide(){this._sprite&&(this._sprite.visible=!1)}remove(){if(this._isDragging&&(this._isDragging=!1,this.map.viewer.config("draggable",!0),this.map.off("mousemove",this._boundOnMouseMove),this.map.off("mouseup",this._boundOnMouseUp)),this._sprite){this.map.viewer.scene.remove(this._sprite);const e=this._sprite.material;e.map&&e.map.dispose(),e.dispose(),this._sprite=null}this._dragStartPosition=null,this._lastCoordinate=null,this._boundOnMouseMove=null,this._boundOnMouseUp=null}}function sa(r,e,t){const{currentTarget:i,clientX:n,clientY:s}=r;if(i instanceof HTMLElement){const a=i.clientWidth,c=i.clientHeight,h=new p.Vector2(n/a*2-1,-(s/c)*2+1);return e.getLocalInfoFromScreen(t,h)?.location}else return}var _y=Object.defineProperty,vy=(r,e,t)=>e in r?_y(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ft=(r,e,t)=>vy(r,typeof e!="symbol"?e+"":e,t);class wy extends ds{constructor(e,t){super(e),ft(this,"options"),ft(this,"_handles",[]),ft(this,"_middleHandles",[]),ft(this,"_middleHandleColor","rgba(255, 255, 255, 0.6)"),ft(this,"_editing",!1),ft(this,"_shadow",null),ft(this,"_shadowSnapshot",null),ft(this,"_updating",!1),ft(this,"_history",[]),ft(this,"_historyIndex",-1),ft(this,"_draggableOriginalState",!1),ft(this,"_boundOnMapMouseMove",null),ft(this,"_boundOnMapClick",null),ft(this,"_boundOnMapMouseDown",null),ft(this,"_boundOnFeatureDragging",null),ft(this,"_boundOnFeatureDragEnd",null),this.options={handleSize:t?.handleSize??8,handleColor:t?.handleColor??"#ffffff",showMiddleHandles:t?.showMiddleHandles??!1,maxHistorySize:t?.maxHistorySize??20,removeVertexOn:t?.removeVertexOn??"contextmenu"},this._boundOnMapMouseMove=this._onMapMouseMove.bind(this),this._boundOnMapClick=this._onMapClick.bind(this),this._boundOnMapMouseDown=this._onMapMouseDown.bind(this),this._boundOnFeatureDragging=this._onFeatureDragging.bind(this),this._boundOnFeatureDragEnd=this._onFeatureDragEnd.bind(this)}enable(){return this._editing?this:(super.enable(),this._editing=!0,this._createShadow(),this._saveSnapshot(),this._setFeatureEditingStyle(!0),this._createHandles(),this.target.trigger("editstart"),this._draggableOriginalState=this.target.options.draggable||!1,this._draggableOriginalState||(this.target.options.draggable=!0,this.target.draggable&&this.target.draggable.enable()),this)}disable(){return this._editing?(super.disable(),this._editing=!1,this._clearHandles(),this._setFeatureEditingStyle(!1),this._draggableOriginalState||(this.target.options.draggable=!1,this.target.draggable&&this.target.draggable.disable()),this._draggableOriginalState=!1,this._updateCoordFromShadow(),this._removeShadow(),this.target.trigger("editend"),this):this}addHooks(){const e=this._getMap();e&&(e.on("mousemove",this._boundOnMapMouseMove),e.on("click",this._boundOnMapClick),e.viewer.container&&e.viewer.container.addEventListener("mousedown",this._boundOnMapMouseDown,!0),this.options.removeVertexOn==="contextmenu"&&e.on("contextmenu",this._boundOnMapClick)),this.target.on("dragging",this._boundOnFeatureDragging),this.target.on("dragend",this._boundOnFeatureDragEnd)}removeHooks(){const e=this._getMap();e&&(e.off("mousemove",this._boundOnMapMouseMove),e.off("click",this._boundOnMapClick),e.viewer.container&&e.viewer.container.removeEventListener("mousedown",this._boundOnMapMouseDown,!0),this.options.removeVertexOn==="contextmenu"&&e.off("contextmenu",this._boundOnMapClick)),this.target.off("dragging",this._boundOnFeatureDragging),this.target.off("dragend",this._boundOnFeatureDragEnd)}isEditing(){return this._editing}_createShadow(){this._shadow=null}_removeShadow(){this._shadow&&(this._shadow=null),this._shadowSnapshot=null}_updateCoordFromShadow(e=!1){e&&!this._updating&&this.target._onPositionChanged(!0)}_saveSnapshot(){const e=this.target._geometry;this._shadowSnapshot={type:e.type,coordinates:JSON.parse(JSON.stringify(e.coordinates))},this._addHistory(e.coordinates)}_addHistory(e){this._historyIndex<this._history.length-1&&(this._history=this._history.slice(0,this._historyIndex+1)),this._history.push({coordinates:JSON.parse(JSON.stringify(e)),timestamp:Date.now()}),this._history.length>this.options.maxHistorySize?this._history.shift():this._historyIndex++}undo(){if(this._historyIndex>0){this._historyIndex--;const e=this._history[this._historyIndex];this._restoreCoordinates(e.coordinates),this.target.trigger("editundo")}return this}redo(){if(this._historyIndex<this._history.length-1){this._historyIndex++;const e=this._history[this._historyIndex];this._restoreCoordinates(e.coordinates),this.target.trigger("editredo")}return this}_restoreCoordinates(e){const t=this.target._geometry;t.coordinates=JSON.parse(JSON.stringify(e)),this.target._onPositionChanged(!0),this._updateHandlePositions()}cancel(){return this._shadowSnapshot&&this._restoreCoordinates(this._shadowSnapshot.coordinates),this.disable(),this}_createHandles(){const e=this.target._geometry,t=this._getMap();if(!t){console.warn("[FeatureEditHandler] No map found, cannot create handles");return}this.target instanceof ni?this._createPointHandles(e,t):this.target instanceof Lt?this._createLineStringHandles(e,t):this.target instanceof wi&&this._createPolygonHandles(e,t)}_createPointHandles(e,t){const i=e.coordinates,n=t.geo2world(new p.Vector3(i[0],i[1],i[2]||0)),s=new Vr({position:n,index:0,symbol:0,size:this.options.handleSize,color:this.options.handleColor},t);s.on("dragstart",a=>{this._onHandleDragStart(a,0)}),s.on("dragging",a=>{this._onHandleDragging(a,0)}),s.on("dragend",a=>{this._onHandleDragEnd(a,0)}),this._handles.push(s)}_createLineStringHandles(e,t){const i=e.coordinates;i.forEach((n,s)=>{const a=t.geo2world(new p.Vector3(n[0],n[1],n[2]||0)),c=new Vr({position:a,index:s,symbol:0,size:this.options.handleSize,color:this.options.handleColor},t);c.on("dragstart",h=>{this._onHandleDragStart(h,s)}),c.on("dragging",h=>{this._onHandleDragging(h,s)}),c.on("dragend",h=>{this._onHandleDragEnd(h,s)}),this._handles.push(c)}),this.options.showMiddleHandles&&this._createLineStringMiddleHandles(i,t)}_onHandleDragging(e,t){this._updating=!0;const n=e.target.getPosition();if(!this._getMap())return;const a=this._fixHandlePointCoordinates(n,t),c=this.target._geometry;this.target instanceof ni?c.coordinates=[a.x,a.y,a.z]:this.target instanceof Lt&&(c.coordinates[t]=[a.x,a.y,a.z]),this.target._onPositionChanged(!0),this.target.trigger("handledragging",{index:t,coordinate:[a.x,a.y,a.z]}),this.target.trigger("editing",{index:t,coordinate:[a.x,a.y,a.z]}),this._updating=!1}_onHandleDragStart(e,t){this._updating=!0,this.target.trigger("handledragstart",{index:t,coordinate:e.coordinate})}_onHandleDragEnd(e,t){this._updating=!1;const i=this.target._geometry;this._addHistory(i.coordinates),this.target.trigger("handledragend",{index:t,coordinate:this.target instanceof ni?i.coordinates:i.coordinates[t]}),this.target.trigger("editvertex",{index:t,coordinate:this.target instanceof ni?i.coordinates:i.coordinates[t]})}_createPolygonHandles(e,t){const i=e.coordinates;if(!i||!Array.isArray(i)||i.length===0){console.warn("[FeatureEditHandler] Invalid polygon coordinates");return}i.forEach((s,a)=>{if(!s||s.length<3)return;const c=s[0][0]===s[s.length-1][0]&&s[0][1]===s[s.length-1][1]?s.length-1:s.length;for(let h=0;h<c;h++){const d=s[h],m=t.geo2world(new p.Vector3(d[0],d[1],d[2]||0)),f=new Vr({position:m,index:h,symbol:0,size:this.options.handleSize,color:this.options.handleColor},t);f._ringIndex=a,f.on("dragstart",g=>{this._onPolygonHandleDragStart(g,h,a)}),f.on("dragging",g=>{this._onPolygonHandleDragging(g,h,a)}),f.on("dragend",g=>{this._onPolygonHandleDragEnd(g,h,a)}),this._handles.push(f)}this.options.showMiddleHandles&&this._createPolygonMiddleHandles(s,a,t)})}_onPolygonHandleDragStart(e,t,i){this._updating=!0,this.target.trigger("handledragstart",{index:t,ringIndex:i,coordinate:e.coordinate})}_onPolygonHandleDragging(e,t,i){const s=e.target.getPosition();if(!this._getMap())return;const c=this._fixHandlePointCoordinates(s,t,i),d=this.target._geometry.coordinates;if(d[i]&&d[i][t]&&(d[i][t]=[c.x,c.y,c.z],t===0&&d[i].length>1)){const m=d[i].length-1;d[i][m]=[c.x,c.y,c.z]}this.target._onPositionChanged(!0),this.target.trigger("handledragging",{index:t,ringIndex:i,coordinate:[c.x,c.y,c.z]}),this.target.trigger("editing",{index:t,ringIndex:i,coordinate:[c.x,c.y,c.z]})}_onPolygonHandleDragEnd(e,t,i){this._updating=!1;const n=this.target._geometry,s=n.coordinates;this._addHistory(n.coordinates),this.target.trigger("handledragend",{index:t,ringIndex:i,coordinate:s[i]?.[t]||null}),this.target.trigger("editvertex",{index:t,ringIndex:i,coordinate:s[i]?.[t]||null})}_updateHandlePositions(){const e=this.target._geometry,t=this._getMap();if(t){if(this.target instanceof ni){const i=e.coordinates,n=t.geo2world(new p.Vector3(i[0],i[1],i[2]||0));this._handles[0]&&this._handles[0].updatePosition(n)}else if(this.target instanceof Lt)e.coordinates.forEach((n,s)=>{const a=t.geo2world(new p.Vector3(n[0],n[1],n[2]||0));this._handles[s]&&this._handles[s].updatePosition(a)});else if(this.target instanceof wi){const i=e.coordinates;let n=0;i.forEach(s=>{const a=s[0][0]===s[s.length-1][0]&&s[0][1]===s[s.length-1][1]?s.length-1:s.length;for(let c=0;c<a;c++){const h=s[c],d=t.geo2world(new p.Vector3(h[0],h[1],h[2]||0));this._handles[n]&&this._handles[n].updatePosition(d),n++}})}}}_clearHandles(){this._handles.forEach(e=>e.remove()),this._handles=[],this._middleHandles.forEach(e=>e.remove()),this._middleHandles=[]}_onFeatureDragging(e){this._updateHandlePositions(),this.options.showMiddleHandles&&this._updateMiddleHandlePositions()}_onFeatureDragEnd(e){const t=this.target._geometry;this._addHistory(t.coordinates),this._updateHandlePositions(),this.options.showMiddleHandles&&this._updateMiddleHandlePositions()}_updateMiddleHandlePositions(){const e=this.target._geometry,t=this._getMap();if(!t)return;let i=0;if(this.target instanceof Lt){const n=e.coordinates;for(let s=0;s<n.length-1&&!(i>=this._middleHandles.length);s++){const a=n[s],c=n[s+1],h=[(a[0]+c[0])/2,(a[1]+c[1])/2,((a[2]||0)+(c[2]||0))/2],d=t.geo2world(new p.Vector3(h[0],h[1],h[2]));this._middleHandles[i].updatePosition(d),i++}}else this.target instanceof wi&&e.coordinates.forEach(s=>{const a=s[0][0]===s[s.length-1][0]&&s[0][1]===s[s.length-1][1]?s.length-1:s.length;for(let c=0;c<a&&!(i>=this._middleHandles.length);c++){const h=(c+1)%a,d=s[c],m=s[h],f=[(d[0]+m[0])/2,(d[1]+m[1])/2,((d[2]||0)+(m[2]||0))/2],g=t.geo2world(new p.Vector3(f[0],f[1],f[2]));this._middleHandles[i].updatePosition(g),i++}})}_onMapMouseDown(e){const t=this._getMap();if(!t)return;const i=new p.Raycaster;i.params.Points={threshold:.5};const n=e,s=t.viewer.renderer.domElement,a=s.getBoundingClientRect(),c=new p.Vector2((n.clientX-a.left)/a.width*2-1,-((n.clientY-a.top)/a.height)*2+1);i.setFromCamera(c,t.viewer.camera);const h=[...this._handles,...this._middleHandles];for(const d of h)if(d.intersect(i)){const m=sa({currentTarget:s,clientX:n.clientX,clientY:n.clientY},t.tilemap,t.viewer.camera);m&&(d.startDrag([m.x,m.y]),n.stopPropagation&&n.stopPropagation(),n.stopImmediatePropagation&&n.stopImmediatePropagation(),n.preventDefault&&n.preventDefault());return}}_onMapMouseMove(e){}_onMapClick(e){if(!(e.type===this.options.removeVertexOn))return;const i=this._getMap();if(!i)return;const n=new p.Raycaster;n.params.Points={threshold:.5};const s=e.originEvent;if(!s)return;const a=new p.Vector2(s.offsetX/i.viewer.renderer.domElement.clientWidth*2-1,-(s.offsetY/i.viewer.renderer.domElement.clientHeight)*2+1);n.setFromCamera(a,i.viewer.camera);for(let c=0;c<this._handles.length;c++)if(this._handles[c].intersect(n)){this._removeVertex(c),s.stopPropagation&&s.stopPropagation(),s.preventDefault&&s.preventDefault();return}}_setFeatureEditingStyle(e){const t=this.target._threeGeometry;t&&t.traverse(i=>{i.material&&(e?Array.isArray(i.material)?i.material.forEach(n=>{n.userData._originalOpacity||(n.userData._originalOpacity=n.opacity),n.opacity=Math.min(n.opacity*.6,.6),n.transparent=!0}):(i.material.userData._originalOpacity||(i.material.userData._originalOpacity=i.material.opacity),i.material.opacity=Math.min(i.material.opacity*.6,.6),i.material.transparent=!0):Array.isArray(i.material)?i.material.forEach(n=>{n.userData._originalOpacity!==void 0&&(n.opacity=n.userData._originalOpacity,delete n.userData._originalOpacity)}):i.material.userData._originalOpacity!==void 0&&(i.material.opacity=i.material.userData._originalOpacity,delete i.material.userData._originalOpacity))})}_removeVertex(e){const t=this.target._geometry,i=this._handles[e],n=i.getIndex(),s=i._ringIndex||0;let a=null;if(this.target instanceof Lt){const c=t.coordinates;if(c.length<=2){console.warn("[FeatureEditHandler] LineString requires at least 2 vertices");return}a=c[n],c.splice(n,1)}else if(this.target instanceof wi){const h=t.coordinates[s];if(!h)return;const d=h.length>1&&h[0][0]===h[h.length-1][0]&&h[0][1]===h[h.length-1][1],m=d?4:3;if(h.length<=m){console.warn("[FeatureEditHandler] Polygon ring requires at least 3 vertices");return}a=h[n],h.splice(n,1),d&&n===0&&h.length>0&&(h[h.length-1]=[...h[0]])}else return;this.target._onPositionChanged(!0),i.remove(),this._handles.splice(e,1),this._updateHandleIndices(),this._addHistory(t.coordinates),this.target.trigger("handleremove",{index:n,ringIndex:s,coordinate:a})}_createLineStringMiddleHandles(e,t){for(let i=0;i<e.length-1;i++){const n=e[i],s=e[i+1],a=[(n[0]+s[0])/2,(n[1]+s[1])/2,((n[2]||0)+(s[2]||0))/2],c=t.geo2world(new p.Vector3(a[0],a[1],a[2])),h=new Vr({position:c,index:i,symbol:1,size:this.options.handleSize,color:this._middleHandleColor,opacity:.6},t);h.on("dragstart",d=>{this._onMiddleHandleClick(i,"LineString",0)}),this._middleHandles.push(h)}}_createPolygonMiddleHandles(e,t,i){const n=e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]?e.length-1:e.length;for(let s=0;s<n;s++){const a=(s+1)%n,c=e[s],h=e[a],d=[(c[0]+h[0])/2,(c[1]+h[1])/2,((c[2]||0)+(h[2]||0))/2],m=i.geo2world(new p.Vector3(d[0],d[1],d[2])),f=new Vr({position:m,index:s,symbol:1,size:this.options.handleSize,color:this._middleHandleColor,opacity:.6},i);f._ringIndex=t,f.on("dragstart",g=>{this._onMiddleHandleClick(s,"Polygon",t)}),this._middleHandles.push(f)}}_onMiddleHandleClick(e,t,i){const n=this.target._geometry;if(this._getMap()){if(t==="LineString"){const a=n.coordinates,c=a[e],h=a[e+1],d=[(c[0]+h[0])/2,(c[1]+h[1])/2,((c[2]||0)+(h[2]||0))/2];a.splice(e+1,0,d)}else if(t==="Polygon"){const c=n.coordinates[i];if(!c)return;const h=c[0][0]===c[c.length-1][0]&&c[0][1]===c[c.length-1][1]?c.length-1:c.length,d=(e+1)%h,m=c[e],f=c[d],g=[(m[0]+f[0])/2,(m[1]+f[1])/2,((m[2]||0)+(f[2]||0))/2];c.splice(e+1,0,g),c.length>1&&c[0][0]===c[c.length-1][0]&&c[0][1]===c[c.length-1][1]&&e===h-1&&(c[c.length-1]=[...c[0]])}this.target._onPositionChanged(!0),this._clearHandles(),this._createHandles(),this._addHistory(n.coordinates),this.target.trigger("vertexinsert",{index:e+1,ringIndex:i})}}_updateHandleIndices(){if(this.target instanceof Lt)this._handles.forEach((e,t)=>{e._index=t});else if(this.target instanceof wi){let e=0;this.target._geometry.coordinates.forEach((n,s)=>{const a=n[0][0]===n[n.length-1][0]&&n[0][1]===n[n.length-1][1]?n.length-1:n.length;for(let c=0;c<a;c++)this._handles[e]&&(this._handles[e]._index=c,this._handles[e]._ringIndex=s),e++})}}_fixHandlePointCoordinates(e,t,i=0){const n=this._getMap();if(!n)return e;const s=this.target._geometry;let a=null;if(this.target instanceof ni)a=s.coordinates;else if(this.target instanceof Lt)a=s.coordinates[t];else if(this.target instanceof wi){const h=s.coordinates;h[i]&&h[i][t]&&(a=h[i][t])}if(!a||!a[2]||a[2]===0)return n.world2geo(e);const c=n.world2geo(e);return c.z=a[2],c}_getMap(){return this.target.getMap()}remove(){this.disable(),this._history=[],this._historyIndex=-1,this._shadow=null,this._shadowSnapshot=null,this._boundOnMapMouseMove=null,this._boundOnMapClick=null,this._boundOnMapMouseDown=null}}dt.prototype.startEdit=function(r){return this.options?.editable?(this._editor&&this.endEdit(),this._editor=new wy(this,r),this._editor.enable(),this):(console.warn("Feature is not editable. Set editable option to true."),this)},dt.prototype.endEdit=function(){return this._editor&&(this._editor.disable(),this._editor.remove(),delete this._editor),this},dt.prototype.isEditing=function(){return this._editor?this._editor.isEditing():!1},dt.prototype.cancelEdit=function(){return this._editor&&this._editor.cancel(),this},dt.prototype.undoEdit=function(){return this._editor&&this._editor.undo(),this},dt.prototype.redoEdit=function(){return this._editor&&this._editor.redo(),this};function bs(r,e){if(!r||r===!0)return!0;if(!Array.isArray(r))return!!r;switch(r[0]){case"all":return r.slice(1).every(i=>bs(i,e));case"any":return r.slice(1).some(i=>bs(i,e));case"!":return!bs(r[1],e);case"==":{const i=ze(r[1],e),n=ze(r[2],e);return xs(i)==xs(n)}case"!=":{const i=ze(r[1],e),n=ze(r[2],e);return xs(i)!=xs(n)}case">":{const i=ze(r[1],e),n=ze(r[2],e);return Hi(i)>Hi(n)}case"<":{const i=ze(r[1],e),n=ze(r[2],e);return Hi(i)<Hi(n)}case">=":{const i=ze(r[1],e),n=ze(r[2],e);return Hi(i)>=Hi(n)}case"<=":{const i=ze(r[1],e),n=ze(r[2],e);return Hi(i)<=Hi(n)}case"in":{const i=ze(r[1],e);return r.slice(2).map(s=>ze(s,e)).includes(i)}case"!in":{const i=ze(r[1],e);return!r.slice(2).map(s=>ze(s,e)).includes(i)}case"has":{const i=r[1];return e!=null&&Object.prototype.hasOwnProperty.call(e,i)}case"!has":{const i=r[1];return!(e!=null&&Object.prototype.hasOwnProperty.call(e,i))}case"like":case"contains":{const i=ze(r[1],e),n=ze(r[2],e);return String(i).toLowerCase().includes(String(n).toLowerCase())}case"starts-with":{const i=ze(r[1],e),n=ze(r[2],e);return String(i).toLowerCase().startsWith(String(n).toLowerCase())}case"ends-with":{const i=ze(r[1],e),n=ze(r[2],e);return String(i).toLowerCase().endsWith(String(n).toLowerCase())}default:return!0}}function ze(r,e){if(Array.isArray(r))switch(r[0]){case"get":return e?e[r[1]]:void 0;default:return r}return r}function xs(r){if(r==null)return null;if(typeof r=="string"){const e=Number(r);if(!isNaN(e)&&r.trim()!=="")return e}return typeof r=="boolean"?r?1:0:r}function Hi(r){if(r==null)return 0;if(typeof r=="number")return r;if(typeof r=="boolean")return r?1:0;if(typeof r=="string"){const e=Number(r);return isNaN(e)?0:e}return Number(r)}var by=Object.defineProperty,xy=(r,e,t)=>e in r?by(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,It=(r,e,t)=>xy(r,typeof e!="symbol"?e+"":e,t);class Ms extends ji{constructor(e,t){super(e,t),It(this,"TILE_SIZE"),It(this,"EXTENT"),It(this,"style"),It(this,"interactive",!1),It(this,"_tileFeatureMap",new Map),It(this,"_activeFeatureFilter"),It(this,"_layerStyleMapCache",null),It(this,"_lastBuiltStyleMap",null),It(this,"_addedFeatureIds",new Set),It(this,"_styleInstanceCache",new Map),It(this,"_totalProcessTime",0),It(this,"_processCount",0),It(this,"_totalFeatureCount",0),this.TILE_SIZE=t.tileSize??256,this.EXTENT=t.extent??4096,this.style=t.style||[],this._onMapUpdate=this._onMapUpdate.bind(this)}getProcessStats(){return{totalTime:this._totalProcessTime,processCount:this._processCount,totalFeatures:this._totalFeatureCount,avgTime:this._processCount>0?this._totalProcessTime/this._processCount:0}}resetProcessStats(){this._totalProcessTime=0,this._processCount=0,this._totalFeatureCount=0}processTileData(e,t){const i=this.getMap(),n=`${e.z}-${e.x}-${e.y}`,s=performance.now(),a=this._tileFeatureMap.get(n);if(a&&a.length>0){for(let w=0;w<a.length;w++){const b=a[w];b.visible=!0,this._addedFeatureIds.has(b.uuid)||(b.addTo(this),this._addedFeatureIds.add(b.uuid))}return}const c=t.vectorData;if(!c||!c.layers||!i||this.style.length===0)return;const h=[],d=this.style,m=this._activeFeatureFilter;let f=this._layerStyleMapCache;(!f||f!==this._lastBuiltStyleMap)&&(f=this._buildLayerStyleMap(d),this._layerStyleMapCache=f,this._lastBuiltStyleMap=f);let g=0;Object.keys(c.layers).forEach(w=>{const b=c.layers[w],x=f.get(w)||d;for(let L=0;L<b.length;L++){g++;const M=b[L],C=M.geometry,W=M.properties;if(m&&!m(W))continue;let D=null;for(let z=0;z<x.length;z++){const X=x[z];if(this._evaluateFilter(X.filter,W,w,M.geometry.type)){D=X.style;break}}if(D){const z={isVectorTile:!0,tileZ:e.z,tileX:e.x,tileY:e.y,rawCoordinates:C,extent:this.EXTENT,tileSize:this.TILE_SIZE},X=this._createFeatureInstance(M.geometry,M.geometry.type,D,{layerName:w,...M.properties});if(X){X.userData.tileData=z;const I=JSON.stringify(D);let U=this._styleInstanceCache.get(I);U||(U=St.create(D),this._styleInstanceCache.set(I,U)),X.style=U,X.addTo(this),this._addedFeatureIds.add(X.uuid),X.initializeGeometry(),h.push(X)}}}}),this._tileFeatureMap.set(n,h);const _=performance.now()-s;this._totalProcessTime+=_,this._processCount++,this._totalFeatureCount+=h.length,this.interactive&&console.log(`[processTileData] ${n} 处理 (${g} -> ${h.length} features) 耗时: ${_.toFixed(2)}ms | 累计: ${this._totalProcessTime.toFixed(2)}ms (${this._processCount}次, ${this._totalFeatureCount}个feature)`)}_evaluateFilter(e,t,i,n){if(!e||e===!0)return!0;const s={...t,$layer:i,$type:n};return bs(e,s)}_buildLayerStyleMap(e){const t=new Map;for(let i=0;i<e.length;i++){const n=e[i],s=n.filter;if(s&&typeof s=="object"&&s.$layer){const a=Array.isArray(s.$layer)?s.$layer[0]:s.$layer;t.has(a)||t.set(a,[]),t.get(a).push(n)}}return t}hideFeaturesByTileKey(e){const t=this._tileFeatureMap.get(e);t&&t.forEach(i=>{i.visible=!1})}removeFeaturesByTileKey(e){this._removeFeaturesByTileKey(e)}_removeFeaturesByTileKey(e){const t=this._tileFeatureMap.get(e);if(t){for(let i=0;i<t.length;i++){const n=t[i];this._addedFeatureIds.delete(n.uuid),n._remove()}this._tileFeatureMap.delete(e)}}_createFeatureInstance(e,t,i,n){const a={geometry:{ismvt:!0,...e},style:i,userData:n};switch(t){case"Point":return new Ti(a);case"LineString":return new Lt(a);default:return null}}setFeatureFilter(e){this._activeFeatureFilter=e}clearFeatureFilter(){this._activeFeatureFilter=void 0}setOpacity(e){this.opacity=e,this._tileFeatureMap.forEach(t=>{t.forEach(i=>{i.material&&(i.material.opacity=e,i.material.transparent=e<1)})})}_onMapUpdate(){}updateStyle(e,t){if(!e||!Array.isArray(e)){console.warn("[VectorTileRenderLayer] updateStyle called with invalid style rules.");return}this._layerStyleMapCache=null,this._lastBuiltStyleMap=null,this.style=e,this._tileFeatureMap.forEach((i,n)=>{const s=t.get(n);if(!s||!s.data||!s.data.vectorData)return;const a=s.data.vectorData;i.forEach(c=>{const h=c.userData,d=c.userData.tileData?.rawCoordinates?.type;let m="";if(a&&a.layers){for(const[g,_]of Object.entries(a.layers))if(_.some(b=>b.properties===h||JSON.stringify(b.properties)===JSON.stringify(h))){m=g;break}}if(this._activeFeatureFilter&&!this._activeFeatureFilter(h)){c.visible=!1;return}let f=null;for(const g of e)if(this._evaluateFilter(g.filter,h,m,d)){f=g.style;break}f?(this._applyStyleToFeature(c,f),c.visible=!0):c.visible=!1})})}_applyStyleToFeature(e,t){e.style=St.create(t),e.initializeGeometry()}validateFeature(e){return e instanceof dt}dispose(){this._tileFeatureMap.forEach((e,t)=>{this._removeFeaturesByTileKey(t)})}}var My=Object.defineProperty,Sy=(r,e,t)=>e in r?My(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Pt=(r,e,t)=>Sy(r,typeof e!="symbol"?e+"":e,t);class hh extends Pr{constructor(e,t){super(e,t),this.layerId=e,Pt(this,"isTileLayer",!0),Pt(this,"layerType","base"),Pt(this,"isBaseLayer",!1),Pt(this,"_enabled",!0),Pt(this,"_visible",!0),Pt(this,"_rootTile"),Pt(this,"_loader"),Pt(this,"_LODThreshold",1),Pt(this,"isSceneLayer",!1),Pt(this,"opacity",1),Pt(this,"source"),Pt(this,"projection"),Pt(this,"minLevel",2),Pt(this,"maxLevel",19),this.source=t.source,this.projection=t.projection,this.minLevel=t.minLevel??2,this.maxLevel=t.maxLevel??19,this._LODThreshold=t.LODThreshold??1,this.opacity=t.opacity??1,this.name=`Layer-${e}`,this._loader=this.createLoader(),this._rootTile=new Ri,this._rootTile.matrixAutoUpdate=!0,this._rootTile.scale.set(this.projection.mapWidth,this.projection.mapHeight,1),this.add(this._rootTile),this._rootTile.updateMatrix(),this.layerId=e,this.name==="Layer-label-layer"&&this.position.set(0,0,1)}get LODThreshold(){return this._LODThreshold}set LODThreshold(e){this._LODThreshold=e}get loader(){return this._loader}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._rootTile&&(this._rootTile.visible=e&&this._visible)}get ivisible(){return this._visible&&super._visible}set ivisible(e){this._visible=e,this._rootTile&&(this._rootTile.visible=e&&this._enabled)}update(e){if(!(!this._enabled||!this._visible)){try{this._rootTile.update({camera:e,loader:this._loader,minLevel:this.minLevel,maxLevel:this.maxLevel,LODThreshold:this.LODThreshold})}catch{}console.groupEnd()}}_debugTileTree(){this._rootTile.traverse(e=>{e.isTile&&(e.loaded,e.visible,e.inFrustum,e.loaded)})}_getLODThreshold(){return 1}_getCurrentTileLevel(){let e=0;return this._rootTile.traverse(t=>{t.isTile&&t.loaded&&(e=Math.max(e,t.z))}),`最大层级: ${e}`}dispose(){this.remove(this._rootTile),this._rootTile.reload(this._loader)}reload(){this._rootTile.reload(this._loader)}setElevation(e){this.position.y=e,this.updateMatrix(),this.updateMatrixWorld(!0)}raiseElevation(e){this.position.z+=e,this.updateMatrix(),this.updateMatrixWorld(!0)}getElevation(){return this.position.y}}var 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 uh extends p.LoadingManager{constructor(){super(...arguments),Cy(this,"onParseEnd")}parseEnd(e){this.onParseEnd&&this.onParseEnd(e)}}const De={manager:new uh,demLoaderMap:new Map,meshLoaderMap:new Map,imgLoaderMap:new Map,registerMaterialLoader(r){De.imgLoaderMap.set(r.dataType,r),r.info.author=r.info.author??xo.name},registerGeometryLoader(r){De.demLoaderMap.set(r.dataType,r),r.info.author=r.info.author??xo.name},registerMeshLoader(r){De.meshLoaderMap.set(r.dataType,r),r.info.author=r.info.author??xo.name},getMaterialLoader(r){const e=De.imgLoaderMap.get(r.dataType);if(e)return e;throw`Source dataType "${r.dataType}" is not support!`},getGeometryLoader(r){const e=De.demLoaderMap.get(r.dataType);if(e)return e;throw`Source dataType "${r.dataType}" is not support!`},getMeshLoader(r){const e=De.meshLoaderMap.get(r.dataType);if(e)return e;throw`Source dataType "${r.dataType}" is not support!`}};var Ty=Object.defineProperty,Gy=(r,e,t)=>e in r?Ty(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Wy=(r,e,t)=>Gy(r,e+"",t);class Zy{constructor(e){Wy(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 Vy=4096,dh=Math.PI;function oa(r,e){const t=Math.floor(r[0]*e),i=Math.floor(r[1]*e),n=Math.floor((r[2]-r[0])*e),s=Math.floor((r[3]-r[1])*e);return{sx:t,sy:i,sw:n,sh:s}}function aa(r,e,t,i){if(i<r.minLevel)return{url:void 0,clipBounds:[0,0,1,1]};if(i<=r.maxLevel)return{url:r._getUrl(e,t,i),clipBounds:[0,0,1,1]};const n=Iy(e,t,i,r.maxLevel),s=n.parentNO;return{url:r._getUrl(s.x,s.y,s.z),clipBounds:n.bounds}}function Iy(r,e,t,i){const n=t-i,s={x:r>>n,y:e>>n,z:t-n},a=Math.pow(2,n),c=Math.pow(.5,n),h=r%a/a-.5+c/2,d=e%a/a-.5+c/2,m=new p.Vector2(h,d),f=new p.Box2().setFromCenterAndSize(m,new p.Vector2(c,c)),g=[f.min.x+.5,f.min.y+.5,f.max.x+.5,f.max.y+.5];return{parentNO:s,bounds:g}}function la(r,e,t,i,n=Vy){const{x:s,y:a}=r,c=(e+s/n)/Math.pow(2,i),h=(t+a/n)/Math.pow(2,i),d=c*360-180,f=Math.atan(Math.sinh(dh*(1-2*h)))*180/dh;return[parseFloat(d.toFixed(8)),parseFloat(f.toFixed(8))]}function Ay(r,e,t,i){if(!r||!r.coordinates)throw new Error("无效的geometry数据格式");const n={type:r.type,coordinates:null};function s(a){if(typeof a=="object"&&a.x!==void 0&&a.y!==void 0)return la(a,e,t,i);if(Array.isArray(a)&&a.length>0){const c=a[0];return typeof c=="object"&&c.x!==void 0&&c.y!==void 0?a.map(h=>la(h,e,t,i)):a.map(h=>s(h))}return a}return n.coordinates=s(r.coordinates),n}var Fy=Object.defineProperty,Oy=(r,e,t)=>e in r?Fy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ss=(r,e,t)=>Oy(r,typeof e!="symbol"?e+"":e,t);class Ls{constructor(){Ss(this,"_imgSource",[]),Ss(this,"_demSource"),Ss(this,"_vtSource"),Ss(this,"manager",De.manager)}get imgSource(){return this._imgSource}set imgSource(e){this._imgSource=e}get demSource(){return this._demSource}set demSource(e){this._demSource=e}get vtSource(){return this._vtSource}set vtSource(e){this._vtSource=e}async load(e){const t=await this.loadGeometry(e),i=await this.loadMaterial(e);console.assert(!!i&&!!t);for(let n=0;n<i.length;n++)t.addGroup(0,1/0,n);return{materials:i,geometry:t}}unload(e){const t=e.material,i=e.geometry;for(let n=0;n<t.length;n++)t[n].dispose();i.dispose()}async loadGeometry(e){let t;if(this.demSource&&e.z>=this.demSource.minLevel&&this._isBoundsInSourceBounds(this.demSource,e.bounds)){const i=De.getGeometryLoader(this.demSource),n=this.demSource;t=await i.load({source:n,...e}).catch(s=>(console.error("Load material error",n.dataType,e.x,e.y,e.z),new p.PlaneGeometry)),t.addEventListener("dispose",()=>{i.unload&&i.unload(t)})}else if(this.vtSource&&e.z>=this.vtSource.minLevel&&this._isBoundsInSourceBounds(this.vtSource,e.bounds)){const i=De.getMeshLoader(this.vtSource),n=this.vtSource;t=await i.load({source:n,...e}).catch(s=>(console.error("Load geometry error",n.dataType,e.x,e.y,e.z),new p.PlaneGeometry)),t.addEventListener("dispose",()=>{i.unload&&i.unload(t)})}else t=new p.PlaneGeometry;return t}async loadMaterial(e){const i=this.imgSource.filter(n=>e.z>=n.minLevel&&this._isBoundsInSourceBounds(n,e.bounds)).map(async n=>{const s=De.getMaterialLoader(n),a=await s.load({source:n,...e}).catch(h=>(console.error("Load material error",n.dataType,e.x,e.y,e.z),new p.MeshBasicMaterial)),c=h=>{s.unload&&s.unload(h.target),h.target.removeEventListener("dispose",c)};return a instanceof p.MeshBasicMaterial||a.addEventListener("dispose",c),a});return Promise.all(i)}_isBoundsInSourceBounds(e,t){const i=e._projectionBounds;return!(t[2]<i[0]||t[3]<i[1]||t[0]>i[2]||t[1]>i[3])}}function Ir(...r){const e=r,t=e&&e.length>1&&e[0].constructor||null;if(!t)throw new Error("concatenateTypedArrays - incorrect quantity of arguments or arguments have incompatible data types");const i=e.reduce((a,c)=>a+c.length,0),n=new t(i);let s=0;for(const a of e)n.set(a,s),s+=a.length;return n}function fh(r,e,t,i){const n=i?Dy(i,r.position.value):zy(e),s=n.length,a=new Float32Array(s*6),c=new Float32Array(s*4),h=new e.constructor(s*6),d=new Float32Array(s*6);for(let f=0;f<s;f++)Xy({edge:n[f],edgeIndex:f,attributes:r,skirtHeight:t,newPosition:a,newTexcoord0:c,newTriangles:h,newNormals:d});r.position.value=Ir(r.position.value,a),r.texcoord.value=Ir(r.texcoord.value,c),r.normal.value=Ir(r.normal.value,d);const m=Ir(e,h);return{attributes:r,indices:m}}function zy(r){const e=[],t=Array.isArray(r)?r:Array.from(r);for(let n=0;n<t.length;n+=3){const s=t[n],a=t[n+1],c=t[n+2];e.push([s,a],[a,c],[c,s])}e.sort(([n,s],[a,c])=>{const h=Math.min(n,s),d=Math.min(a,c);return h!==d?h-d:Math.max(n,s)-Math.max(a,c)});const i=[];for(let n=0;n<e.length;n++)n+1<e.length&&e[n][0]===e[n+1][1]&&e[n][1]===e[n+1][0]?n++:i.push(e[n]);return i}function Dy(r,e){const t=(n,s)=>{n.sort(s)};t(r.westIndices,(n,s)=>e[3*n+1]-e[3*s+1]),t(r.eastIndices,(n,s)=>e[3*s+1]-e[3*n+1]),t(r.southIndices,(n,s)=>e[3*s]-e[3*n]),t(r.northIndices,(n,s)=>e[3*n]-e[3*s]);const i=[];return Object.values(r).forEach(n=>{if(n.length>1)for(let s=0;s<n.length-1;s++)i.push([n[s],n[s+1]])}),i}function Xy({edge:r,edgeIndex:e,attributes:t,skirtHeight:i,newPosition:n,newTexcoord0:s,newTriangles:a,newNormals:c}){const h=t.position.value.length,d=e*2,m=d+1;n.set(t.position.value.subarray(r[0]*3,r[0]*3+3),d*3),n[d*3+2]=n[d*3+2]-i,n.set(t.position.value.subarray(r[1]*3,r[1]*3+3),m*3),n[m*3+2]=n[m*3+2]-i,s.set(t.texcoord.value.subarray(r[0]*2,r[0]*2+2),d*2),s.set(t.texcoord.value.subarray(r[1]*2,r[1]*2+2),m*2);const f=e*2*3;a[f]=r[0],a[f+1]=h/3+m,a[f+2]=r[1],a[f+3]=h/3+m,a[f+4]=r[0],a[f+5]=h/3+d,c[f]=0,c[f+1]=0,c[f+2]=1,c[f+3]=0,c[f+4]=0,c[f+5]=1}function ph(r){if(r.length<4)throw new Error(`DEM数组长度必须大于4,当前长度: ${r.length}!`);const e=Math.floor(Math.sqrt(r.length)),t=e,i=e,n=ca(i,t);return{attributes:ky(r,i,t),indices:n}}function ky(r,e,t){const i=t*e,n=new Float32Array(i*3),s=new Float32Array(i*2);let a=0;for(let c=0;c<e;c++)for(let h=0;h<t;h++){const d=h/(t-1),m=c/(e-1);s[a*2]=d,s[a*2+1]=m,n[a*3]=d-.5,n[a*3+1]=m-.5,n[a*3+2]=r[(e-c-1)*t+h],a++}return{position:{value:n,size:3},texcoord:{value:s,size:2},normal:{value:ha(n,ca(e,t)),size:3}}}function ca(r,e){const t=6*(e-1)*(r-1),i=new Uint16Array(t);let n=0;for(let s=0;s<r-1;s++)for(let a=0;a<e-1;a++){const c=s*e+a,h=c+1,d=c+e,m=d+1,f=n*6;i[f]=c,i[f+1]=h,i[f+2]=d,i[f+3]=d,i[f+4]=h,i[f+5]=m,n++}return i}function ha(r,e){const t=new Float32Array(r.length);for(let i=0;i<e.length;i+=3){const n=e[i]*3,s=e[i+1]*3,a=e[i+2]*3,c=r[n],h=r[n+1],d=r[n+2],m=r[s],f=r[s+1],g=r[s+2],_=r[a],w=r[a+1],b=r[a+2],x=m-c,L=f-h,M=g-d,C=_-c,W=w-h,D=b-d,z=L*D-M*W,X=M*C-x*D,I=x*W-L*C,U=Math.sqrt(z*z+X*X+I*I),V=[0,0,1];if(U>0){const G=1/U;V[0]=z*G,V[1]=X*G,V[2]=I*G}for(let G=0;G<3;G++)t[n+G]=t[s+G]=t[a+G]=V[G]}return t}var Uy=Object.defineProperty,Ny=(r,e,t)=>e in r?Uy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ky=(r,e,t)=>Ny(r,e+"",t);class jn extends p.PlaneGeometry{constructor(){super(...arguments),Ky(this,"type","TileGeometry")}setData(e,t=1e3){let i=e instanceof Float32Array?ph(e):e;i=fh(i.attributes,i.indices,t);const{attributes:n,indices:s}=i;return this.setIndex(new p.BufferAttribute(s,1)),this.setAttribute("position",new p.BufferAttribute(n.position.value,n.position.size)),this.setAttribute("uv",new p.BufferAttribute(n.texcoord.value,n.texcoord.size)),this.setAttribute("normal",new p.BufferAttribute(n.normal.value,n.normal.size)),this.computeBoundingBox(),this.computeBoundingSphere(),this}}var By=Object.defineProperty,Yy=(r,e,t)=>e in r?By(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,$i=(r,e,t)=>Yy(r,typeof e!="symbol"?e+"":e,t);class mh{constructor(e=257){$i(this,"gridSize"),$i(this,"numTriangles"),$i(this,"numParentTriangles"),$i(this,"indices"),$i(this,"coords"),this.gridSize=e;const t=e-1;if(t&t-1)throw new Error(`Expected grid size to be 2^n+1, got ${e}.`);this.numTriangles=t*t*2-2,this.numParentTriangles=this.numTriangles-t*t,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(this.numTriangles*4);for(let i=0;i<this.numTriangles;i++){let n=i+2,s=0,a=0,c=0,h=0,d=0,m=0;for(n&1?c=h=d=t:s=a=m=t;(n>>=1)>1;){const g=s+c>>1,_=a+h>>1;n&1?(c=s,h=a,s=d,a=m):(s=c,a=h,c=d,h=m),d=g,m=_}const f=i*4;this.coords[f+0]=s,this.coords[f+1]=a,this.coords[f+2]=c,this.coords[f+3]=h}}createTile(e){return new Ry(e,this)}}class Ry{constructor(e,t){$i(this,"martini"),$i(this,"terrain"),$i(this,"errors");const i=t.gridSize;if(e.length!==i*i)throw new Error(`Expected terrain data of length ${i*i} (${i} x ${i}), got ${e.length}.`);this.terrain=e,this.martini=t,this.errors=new Float32Array(e.length),this.update()}update(){const{numTriangles:e,numParentTriangles:t,coords:i,gridSize:n}=this.martini,{terrain:s,errors:a}=this;for(let c=e-1;c>=0;c--){const h=c*4,d=i[h+0],m=i[h+1],f=i[h+2],g=i[h+3],_=d+f>>1,w=m+g>>1,b=_+w-m,x=w+d-_,L=(s[m*n+d]+s[g*n+f])/2,M=w*n+_,C=Math.abs(L-s[M]);if(a[M]=Math.max(a[M],C),c<t){const W=(m+x>>1)*n+(d+b>>1),D=(g+x>>1)*n+(f+b>>1);a[M]=Math.max(a[M],a[W],a[D])}}}getGeometryData(e=0){const{gridSize:t,indices:i}=this.martini,{errors:n}=this;let s=0,a=0;const c=t-1;let h,d,m=0;i.fill(0);function f(M,C,W,D,z,X){const I=M+W>>1,U=C+D>>1;Math.abs(M-z)+Math.abs(C-X)>1&&n[U*t+I]>e?(f(z,X,M,C,I,U),f(W,D,z,X,I,U)):(h=C*t+M,d=D*t+W,m=X*t+z,i[h]===0&&(i[h]=++s),i[d]===0&&(i[d]=++s),i[m]===0&&(i[m]=++s),a++)}f(0,0,c,c,c,0),f(c,c,0,0,0,c);const g=s*2,_=a*3,w=new Uint16Array(g),b=new Uint32Array(_);let x=0;function L(M,C,W,D,z,X){const I=M+W>>1,U=C+D>>1;if(Math.abs(M-z)+Math.abs(C-X)>1&&n[U*t+I]>e)L(z,X,M,C,I,U),L(W,D,z,X,I,U);else{const V=i[C*t+M]-1,G=i[D*t+W]-1,N=i[X*t+z]-1;w[2*V]=M,w[2*V+1]=C,w[2*G]=W,w[2*G+1]=D,w[2*N]=z,w[2*N+1]=X,b[x++]=V,b[x++]=G,b[x++]=N}}return L(0,0,c,c,c,0),L(c,c,0,0,0,c),{attributes:this._getMeshAttributes(this.terrain,w,b),indices:b}}_getMeshAttributes(e,t,i){const n=Math.floor(Math.sqrt(e.length)),s=n-1,a=t.length/2,c=new Float32Array(a*3),h=new Float32Array(a*2);for(let m=0;m<a;m++){const f=t[m*2],g=t[m*2+1],_=g*n+f;c[3*m+0]=f/s-.5,c[3*m+1]=.5-g/s,c[3*m+2]=e[_],h[2*m+0]=f/s,h[2*m+1]=1-g/s}const d=ha(c,i);return{position:{value:c,size:3},texcoord:{value:h,size:2},normal:{value:d,size:3}}}}var jy=Object.defineProperty,Jy=(r,e,t)=>e in r?jy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,gh=(r,e,t)=>Jy(r,typeof e!="symbol"?e+"":e,t);class ua{constructor(){gh(this,"info",{version:"0.10.0",description:"Terrain loader base class"}),gh(this,"dataType","")}async load(e){const{source:t,x:i,y:n,z:s}=e,{url:a,clipBounds:c}=aa(t,i,n,s);if(!a)return new jn;const h=await this.doLoad(a,{source:t,x:i,y:n,z:s,bounds:c});return De.manager.parseEnd(a),h}}class da extends p.MeshStandardMaterial{constructor(e={}){super({transparent:!0,side:p.FrontSide,...e})}setTexture(e){this.map=e,this.needsUpdate=!0}dispose(){const e=this.map;e&&(e.image instanceof ImageBitmap&&e.image.close(),e.dispose())}}var rt=(r=>(r[r.Unknown=0]="Unknown",r[r.Point=1]="Point",r[r.Linestring=2]="Linestring",r[r.Polygon=3]="Polygon",r))(rt||{});class yh{render(e,t,i,n,s=1){switch(e.lineCap="round",e.lineJoin="round",(n.shadowBlur??0)>0&&(e.shadowBlur=n.shadowBlur??2,e.shadowColor=n.shadowColor??"black",e.shadowOffsetX=n.shadowOffset?n.shadowOffset[0]:0,e.shadowOffsetY=n.shadowOffset?n.shadowOffset[1]:0),t){case rt.Point:e.textAlign="center",e.textBaseline="middle",e.font=n.font??"14px Arial",e.fillStyle=n.fontColor??"white",this._renderPointText(e,i,s,n.textField??"name",n.fontOffset??[0,-8]);break;case rt.Linestring:this._renderLineString(e,i,s);break;case rt.Polygon:this._renderPolygon(e,i,s);break;default:console.warn(`Unknown feature type: ${t}`)}(n.fill||t===rt.Point)&&(e.globalAlpha=n.fillOpacity||.5,e.fillStyle=n.fillColor||n.color||"#3388ff",e.fill(n.fillRule||"evenodd")),(n.stroke??!0)&&(n.weight??1)>0&&(e.globalAlpha=n.opacity||1,e.lineWidth=n.weight||1,e.strokeStyle=n.color||"#3388ff",e.setLineDash(n.dashArray||[]),e.stroke())}_renderPointText(e,t,i=1,n="name",s=[0,0]){const a=t.geometry;e.beginPath();for(const h of a)for(let d=0;d<h.length;d++){const m=h[d];e.arc(m.x*i,m.y*i,2,0,2*Math.PI)}const c=t.properties;c&&c[n]&&e.fillText(c[n],a[0][0].x*i+s[0],a[0][0].y*i+s[1])}_renderLineString(e,t,i){const n=t.geometry;e.beginPath();for(const s of n)for(let a=0;a<s.length;a++){const{x:c,y:h}=s[a];a===0?e.moveTo(c*i,h*i):e.lineTo(c*i,h*i)}}_renderPolygon(e,t,i){const n=t.geometry;e.beginPath();for(let s=0;s<n.length;s++){const a=n[s];for(let c=0;c<a.length;c++){const{x:h,y:d}=a[c];c===0?e.moveTo(h*i,d*i):e.lineTo(h*i,d*i)}e.closePath()}}}var Qy=Object.defineProperty,Hy=(r,e,t)=>e in r?Qy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,_h=(r,e,t)=>Hy(r,typeof e!="symbol"?e+"":e,t);class fa{constructor(){_h(this,"info",{version:"0.10.0",description:"Image loader base class"}),_h(this,"dataType","")}async load(e){const{source:t,x:i,y:n,z:s}=e,a=new da({}),{url:c,clipBounds:h}=aa(t,i,n,s);if(c){const d=await this.doLoad(c,{source:t,x:i,y:n,z:s,bounds:h});a.map=d,De.manager.parseEnd(c)}return a}}var $y=Object.defineProperty,Ey=(r,e,t)=>e in r?$y(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,vh=(r,e,t)=>Ey(r,typeof e!="symbol"?e+"":e,t);class qy{constructor(){vh(this,"info",{version:"0.10.0",description:"Canvas tile abstract loader"}),vh(this,"dataType","")}async load(e){const t=this._creatCanvasContext(256,256);this.drawTile(t,e);const i=new p.CanvasTexture(t.canvas.transferToImageBitmap());return new da({transparent:!0,map:i,opacity:e.source.opacity})}_creatCanvasContext(e,t){const n=new OffscreenCanvas(e,t).getContext("2d");if(!n)throw new Error("create canvas context failed");return n.scale(1,-1),n.translate(0,-t),n}}var e_=Object.defineProperty,t_=(r,e,t)=>e in r?e_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,pa=(r,e,t)=>t_(r,typeof e!="symbol"?e+"":e,t);class i_ extends fa{constructor(){super(...arguments),pa(this,"info",{version:"0.10.0",description:"Tile image loader. It can load xyz tile image."}),pa(this,"dataType","image"),pa(this,"loader",new p.ImageLoader(De.manager))}async doLoad(e,t){const i=await this.loader.loadAsync(e).catch(a=>new Image(1,1)),n=new p.Texture;n.colorSpace=p.SRGBColorSpace;const{bounds:s}=t;return s[2]-s[0]<1?n.image=n_(i,s):n.image=i,n.needsUpdate=!0,n}}function n_(r,e){const t=r.width,i=new OffscreenCanvas(t,t),n=i.getContext("2d"),{sx:s,sy:a,sw:c,sh:h}=oa(e,r.width);return n.drawImage(r,s,a,c,h,0,0,t,t),i}const r_=`{
1123
1123
  "name": "@terra.gl/core",
1124
- "version": "0.0.1-alpha.75",
1124
+ "version": "0.0.1-alpha.76",
1125
1125
  "type": "module",
1126
1126
  "files": [
1127
1127
  "dist"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@terra.gl/core",
3
- "version": "0.0.1-alpha.75",
3
+ "version": "0.0.1-alpha.76",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"