mixdashboards 1.1.48 → 1.1.49

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.
@@ -3984,7 +3984,7 @@ ${v}`},color:f.textColor,fontSize:f.textSize}}],yAxis:[{type:"value",nameGap:10,
3984
3984
  `)!==-1&&(e=e.replace(/\\\n/g,""));const r=e.split(`
3985
3985
  `);let i=[];for(let l=0,c=r.length;l<c;l++){const u=r[l].trimStart();if(u.length===0)continue;const d=u.charAt(0);if(d!=="#")if(d==="v"){const f=u.split(m$);switch(f[0]){case"v":t.vertices.push(parseFloat(f[1]),parseFloat(f[2]),parseFloat(f[3])),f.length>=7?(Mb.setRGB(parseFloat(f[4]),parseFloat(f[5]),parseFloat(f[6]),co),t.colors.push(Mb.r,Mb.g,Mb.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(f[1]),parseFloat(f[2]),parseFloat(f[3]));break;case"vt":t.uvs.push(parseFloat(f[1]),parseFloat(f[2]));break}}else if(d==="f"){const h=u.slice(1).trim().split(m$),p=[];for(let v=0,g=h.length;v<g;v++){const y=h[v];if(y.length>0){const b=y.split("/");p.push(b)}}const m=p[0];for(let v=1,g=p.length-1;v<g;v++){const y=p[v],b=p[v+1];t.addFace(m[0],y[0],b[0],m[1],y[1],b[1],m[2],y[2],b[2])}}else if(d==="l"){const f=u.substring(1).trim().split(" ");let h=[];const p=[];if(u.indexOf("/")===-1)h=f;else for(let m=0,v=f.length;m<v;m++){const g=f[m].split("/");g[0]!==""&&h.push(g[0]),g[1]!==""&&p.push(g[1])}t.addLineGeometry(h,p)}else if(d==="p"){const h=u.slice(1).trim().split(" ");t.addPointGeometry(h)}else if((i=$7t.exec(u))!==null){const f=(" "+i[0].slice(1).trim()).slice(1);t.startObject(f)}else if(tyt.test(u))t.object.startMaterial(u.substring(7).trim(),t.materialLibraries);else if(eyt.test(u))t.materialLibraries.push(u.substring(7).trim());else if(nyt.test(u))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(d==="s"){if(i=u.split(" "),i.length>1){const h=i[1].trim().toLowerCase();t.object.smooth=h!=="0"&&h!=="off"}else t.object.smooth=!0;const f=t.object.currentMaterial();f&&(f.smooth=t.object.smooth)}else{if(u==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+u+'"')}}t.finalize();const a=new ya;if(a.materialLibraries=[].concat(t.materialLibraries),!(t.objects.length===1&&t.objects[0].geometry.vertices.length===0)===!0)for(let l=0,c=t.objects.length;l<c;l++){const u=t.objects[l],d=u.geometry,f=u.materials,h=d.type==="Line",p=d.type==="Points";let m=!1;if(d.vertices.length===0)continue;const v=new Lr;v.setAttribute("position",new wa(d.vertices,3)),d.normals.length>0&&v.setAttribute("normal",new wa(d.normals,3)),d.colors.length>0&&(m=!0,v.setAttribute("color",new wa(d.colors,3))),d.hasUVIndices===!0&&v.setAttribute("uv",new wa(d.uvs,2));const g=[];for(let b=0,x=f.length;b<x;b++){const _=f[b],w=_.name+"_"+_.smooth+"_"+m;let S=t.materials[w];if(this.materials!==null){if(S=this.materials.create(_.name),h&&S&&!(S instanceof Us)){const C=new Us;Jl.prototype.copy.call(C,S),C.color.copy(S.color),S=C}else if(p&&S&&!(S instanceof a0)){const C=new a0({size:10,sizeAttenuation:!1});Jl.prototype.copy.call(C,S),C.color.copy(S.color),C.map=S.map,S=C}}S===void 0&&(h?S=new Us:p?S=new a0({size:1,sizeAttenuation:!1}):S=new s1e,S.name=_.name,S.flatShading=!_.smooth,S.vertexColors=m,t.materials[w]=S),g.push(S)}let y;if(g.length>1){for(let b=0,x=f.length;b<x;b++){const _=f[b];v.addGroup(_.groupStart,_.groupCount,b)}h?y=new hl(v,g):p?y=new Ap(v,g):y=new wi(v,g)}else h?y=new hl(v,g[0]):p?y=new Ap(v,g[0]):y=new wi(v,g[0]);y.name=u.name,a.add(y)}else if(t.vertices.length>0){const l=new a0({size:1,sizeAttenuation:!1}),c=new Lr;c.setAttribute("position",new wa(t.vertices,3)),t.colors.length>0&&t.colors[0]!==void 0&&(c.setAttribute("color",new wa(t.colors,3)),l.vertexColors=!0);const u=new Ap(c,l);a.add(u)}return a}}function Ms(n){return(e,...t)=>ayt(n,e,t)}function $g(n,e){return Ms(V0e(n,e).get)}const{apply:ayt,getOwnPropertyDescriptor:V0e,getPrototypeOf:AF,ownKeys:oyt}=Reflect,{iterator:j6,toStringTag:syt}=Symbol,lyt=Object,{create:TF,defineProperty:cyt}=lyt,uyt=Array,dyt=uyt.prototype,B0e=dyt[j6],fyt=Ms(B0e),F0e=ArrayBuffer,hyt=F0e.prototype;$g(hyt,"byteLength");const b$=typeof SharedArrayBuffer!="undefined"?SharedArrayBuffer:null;b$&&$g(b$.prototype,"byteLength");const z0e=AF(Uint8Array);z0e.from;const Ml=z0e.prototype;Ml[j6];Ms(Ml.keys);Ms(Ml.values);Ms(Ml.entries);Ms(Ml.set);Ms(Ml.reverse);Ms(Ml.fill);Ms(Ml.copyWithin);Ms(Ml.sort);Ms(Ml.slice);Ms(Ml.subarray);$g(Ml,"buffer");$g(Ml,"byteOffset");$g(Ml,"length");$g(Ml,syt);const pyt=Uint8Array,U0e=Uint16Array,MF=Uint32Array,myt=Float32Array,k8=AF([][j6]()),H0e=Ms(k8.next),vyt=Ms((function*(){})().next),gyt=AF(k8),yyt=DataView.prototype,byt=Ms(yyt.getUint16),DF=WeakMap,j0e=DF.prototype,G0e=Ms(j0e.get),xyt=Ms(j0e.set),Y0e=new DF,_yt=TF(null,{next:{value:function(){const e=G0e(Y0e,this);return H0e(e)}},[j6]:{value:function(){return this}}});function Syt(n){if(n[j6]===B0e&&k8.next===H0e)return n;const e=TF(_yt);return xyt(Y0e,e,fyt(n)),e}const wyt=new DF,Cyt=TF(gyt,{next:{value:function(){const e=G0e(wyt,this);return vyt(e)},writable:!0,configurable:!0}});for(const n of oyt(k8))n!=="next"&&cyt(Cyt,n,V0e(k8,n));const W0e=new F0e(4),Eyt=new myt(W0e),Ayt=new MF(W0e),L1=new U0e(512),N1=new pyt(512);for(let n=0;n<256;++n){const e=n-127;e<-24?(L1[n]=0,L1[n|256]=32768,N1[n]=24,N1[n|256]=24):e<-14?(L1[n]=1024>>-e-14,L1[n|256]=1024>>-e-14|32768,N1[n]=-e-1,N1[n|256]=-e-1):e<=15?(L1[n]=e+15<<10,L1[n|256]=e+15<<10|32768,N1[n]=13,N1[n|256]=13):e<128?(L1[n]=31744,L1[n|256]=64512,N1[n]=24,N1[n|256]=24):(L1[n]=31744,L1[n|256]=64512,N1[n]=13,N1[n|256]=13)}const LF=new MF(2048);for(let n=1;n<1024;++n){let e=n<<13,t=0;for(;(e&8388608)===0;)e<<=1,t-=8388608;e&=-8388609,t+=947912704,LF[n]=e|t}for(let n=1024;n<2048;++n)LF[n]=939524096+(n-1024<<13);const e4=new MF(64);for(let n=1;n<31;++n)e4[n]=n<<23;e4[31]=1199570944;e4[32]=2147483648;for(let n=33;n<63;++n)e4[n]=2147483648+(n-32<<23);e4[63]=3347054592;const X0e=new U0e(64);for(let n=1;n<64;++n)n!==32&&(X0e[n]=1024);function Tyt(n){const e=n>>10;return Ayt[0]=LF[X0e[e]+(n&1023)]+e4[e],Eyt[0]}function Z0e(n,e,...t){return Tyt(byt(n,e,...Syt(t)))}var Db={exports:{}},x$;function Myt(){if(x$)return Db.exports;x$=1;function n(e,t,r){const i=r&&r.debug||!1;i&&console.log("[xml-utils] getting "+t+" in "+e);const a=typeof e=="object"?e.outer:e,s=a.slice(0,a.indexOf(">")+1),l=['"',"'"];for(let c=0;c<l.length;c++){const u=l[c],d=t+"\\="+u+"([^"+u+"]*)"+u;i&&console.log("[xml-utils] pattern:",d);const h=new RegExp(d).exec(s);if(i&&console.log("[xml-utils] match:",h),h)return h[1]}}return Db.exports=n,Db.exports.default=n,Db.exports}var Dyt=Myt();const rL=hd(Dyt);var Lb={exports:{}},Nb={exports:{}},Ob={exports:{}},_$;function Lyt(){if(_$)return Ob.exports;_$=1;function n(e,t,r){const a=new RegExp(t).exec(e.slice(r));return a?r+a.index:-1}return Ob.exports=n,Ob.exports.default=n,Ob.exports}var Pb={exports:{}},S$;function Nyt(){if(S$)return Pb.exports;S$=1;function n(e,t,r){const a=new RegExp(t).exec(e.slice(r));return a?r+a.index+a[0].length-1:-1}return Pb.exports=n,Pb.exports.default=n,Pb.exports}var kb={exports:{}},w$;function Oyt(){if(w$)return kb.exports;w$=1;function n(e,t){const r=new RegExp(t,"g"),i=e.match(r);return i?i.length:0}return kb.exports=n,kb.exports.default=n,kb.exports}var C$;function Pyt(){if(C$)return Nb.exports;C$=1;const n=Lyt(),e=Nyt(),t=Oyt();function r(i,a,s){const l=s&&s.debug||!1,c=!(s&&typeof s.nested===!1),u=s&&s.startIndex||0;l&&console.log("[xml-utils] starting findTagByName with",a," and ",s);const d=n(i,`<${a}[
3986
3986
  >/]`,u);if(l&&console.log("[xml-utils] start:",d),d===-1)return;const f=i.slice(d+a.length);let h=e(f,"^[^<]*[ /]>",0);const p=h!==-1&&f[h-1]==="/";if(l&&console.log("[xml-utils] selfClosing:",p),p===!1)if(c){let y=0,b=1,x=0;for(;(h=e(f,"[ /]"+a+">",y))!==-1;){const _=f.substring(y,h+1);if(b+=t(_,"<"+a+`[
3987
- >]`),x+=t(_,"</"+a+">"),x>=b)break;y=h}}else h=e(f,"[ /]"+a+">",0);const m=d+a.length+h+1;if(l&&console.log("[xml-utils] end:",m),m===-1)return;const v=i.slice(d,m);let g;return p?g=null:g=v.slice(v.indexOf(">")+1,v.lastIndexOf("<")),{inner:g,outer:v,start:d,end:m}}return Nb.exports=r,Nb.exports.default=r,Nb.exports}var E$;function kyt(){if(E$)return Lb.exports;E$=1;const n=Pyt();function e(t,r,i){const a=[],s=i&&i.debug||!1,l=i&&typeof i.nested=="boolean"?i.nested:!0;let c=i&&i.startIndex||0,u;for(;u=n(t,r,{debug:s,startIndex:c});)l?c=u.start+1+r.length:c=u.end,a.push(u);return s&&console.log("findTagsByName found",a.length,"tags"),a}return Lb.exports=e,Lb.exports.default=e,Lb.exports}var Iyt=kyt();const Ryt=hd(Iyt),N9={315:"Artist",258:"BitsPerSample",265:"CellLength",264:"CellWidth",320:"ColorMap",259:"Compression",33432:"Copyright",306:"DateTime",338:"ExtraSamples",266:"FillOrder",289:"FreeByteCounts",288:"FreeOffsets",291:"GrayResponseCurve",290:"GrayResponseUnit",316:"HostComputer",270:"ImageDescription",257:"ImageLength",256:"ImageWidth",271:"Make",281:"MaxSampleValue",280:"MinSampleValue",272:"Model",254:"NewSubfileType",274:"Orientation",262:"PhotometricInterpretation",284:"PlanarConfiguration",296:"ResolutionUnit",278:"RowsPerStrip",277:"SamplesPerPixel",305:"Software",279:"StripByteCounts",273:"StripOffsets",255:"SubfileType",263:"Threshholding",282:"XResolution",283:"YResolution",326:"BadFaxLines",327:"CleanFaxData",343:"ClipPath",328:"ConsecutiveBadFaxLines",433:"Decode",434:"DefaultImageColor",269:"DocumentName",336:"DotRange",321:"HalftoneHints",346:"Indexed",347:"JPEGTables",285:"PageName",297:"PageNumber",317:"Predictor",319:"PrimaryChromaticities",532:"ReferenceBlackWhite",339:"SampleFormat",340:"SMinSampleValue",341:"SMaxSampleValue",559:"StripRowCounts",330:"SubIFDs",292:"T4Options",293:"T6Options",325:"TileByteCounts",323:"TileLength",324:"TileOffsets",322:"TileWidth",301:"TransferFunction",318:"WhitePoint",344:"XClipPathUnits",286:"XPosition",529:"YCbCrCoefficients",531:"YCbCrPositioning",530:"YCbCrSubSampling",345:"YClipPathUnits",287:"YPosition",37378:"ApertureValue",40961:"ColorSpace",36868:"DateTimeDigitized",36867:"DateTimeOriginal",34665:"Exif IFD",36864:"ExifVersion",33434:"ExposureTime",41728:"FileSource",37385:"Flash",40960:"FlashpixVersion",33437:"FNumber",42016:"ImageUniqueID",37384:"LightSource",37500:"MakerNote",37377:"ShutterSpeedValue",37510:"UserComment",33723:"IPTC",34675:"ICC Profile",700:"XMP",42112:"GDAL_METADATA",42113:"GDAL_NODATA",34377:"Photoshop",33550:"ModelPixelScale",33922:"ModelTiepoint",34264:"ModelTransformation",34735:"GeoKeyDirectory",34736:"GeoDoubleParams",34737:"GeoAsciiParams",50674:"LercParameters"},I1={};for(const n in N9)N9.hasOwnProperty(n)&&(I1[N9[n]]=parseInt(n,10));const Vyt=[I1.BitsPerSample,I1.ExtraSamples,I1.SampleFormat,I1.StripByteCounts,I1.StripOffsets,I1.StripRowCounts,I1.TileByteCounts,I1.TileOffsets,I1.SubIFDs],iL={1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE",13:"IFD",16:"LONG8",17:"SLONG8",18:"IFD8"},Qr={};for(const n in iL)iL.hasOwnProperty(n)&&(Qr[iL[n]]=parseInt(n,10));const cc={WhiteIsZero:0,BlackIsZero:1,RGB:2,Palette:3,CMYK:5,YCbCr:6,CIELab:8},Byt={Unspecified:0},Fyt={AddCompression:1},zyt={None:0,Deflate:1,Zstandard:2},Uyt={1024:"GTModelTypeGeoKey",1025:"GTRasterTypeGeoKey",1026:"GTCitationGeoKey",2048:"GeographicTypeGeoKey",2049:"GeogCitationGeoKey",2050:"GeogGeodeticDatumGeoKey",2051:"GeogPrimeMeridianGeoKey",2052:"GeogLinearUnitsGeoKey",2053:"GeogLinearUnitSizeGeoKey",2054:"GeogAngularUnitsGeoKey",2055:"GeogAngularUnitSizeGeoKey",2056:"GeogEllipsoidGeoKey",2057:"GeogSemiMajorAxisGeoKey",2058:"GeogSemiMinorAxisGeoKey",2059:"GeogInvFlatteningGeoKey",2060:"GeogAzimuthUnitsGeoKey",2061:"GeogPrimeMeridianLongGeoKey",2062:"GeogTOWGS84GeoKey",3072:"ProjectedCSTypeGeoKey",3073:"PCSCitationGeoKey",3074:"ProjectionGeoKey",3075:"ProjCoordTransGeoKey",3076:"ProjLinearUnitsGeoKey",3077:"ProjLinearUnitSizeGeoKey",3078:"ProjStdParallel1GeoKey",3079:"ProjStdParallel2GeoKey",3080:"ProjNatOriginLongGeoKey",3081:"ProjNatOriginLatGeoKey",3082:"ProjFalseEastingGeoKey",3083:"ProjFalseNorthingGeoKey",3084:"ProjFalseOriginLongGeoKey",3085:"ProjFalseOriginLatGeoKey",3086:"ProjFalseOriginEastingGeoKey",3087:"ProjFalseOriginNorthingGeoKey",3088:"ProjCenterLongGeoKey",3089:"ProjCenterLatGeoKey",3090:"ProjCenterEastingGeoKey",3091:"ProjCenterNorthingGeoKey",3092:"ProjScaleAtNatOriginGeoKey",3093:"ProjScaleAtCenterGeoKey",3094:"ProjAzimuthAngleGeoKey",3095:"ProjStraightVertPoleLongGeoKey",3096:"ProjRectifiedGridAngleGeoKey",4096:"VerticalCSTypeGeoKey",4097:"VerticalCitationGeoKey",4098:"VerticalDatumGeoKey",4099:"VerticalUnitsGeoKey"};function Hyt(n,e){const{width:t,height:r}=n,i=new Uint8Array(t*r*3);let a;for(let s=0,l=0;s<n.length;++s,l+=3)a=256-n[s]/e*256,i[l]=a,i[l+1]=a,i[l+2]=a;return i}function jyt(n,e){const{width:t,height:r}=n,i=new Uint8Array(t*r*3);let a;for(let s=0,l=0;s<n.length;++s,l+=3)a=n[s]/e*256,i[l]=a,i[l+1]=a,i[l+2]=a;return i}function Gyt(n,e){const{width:t,height:r}=n,i=new Uint8Array(t*r*3),a=e.length/3,s=e.length/3*2;for(let l=0,c=0;l<n.length;++l,c+=3){const u=n[l];i[c]=e[u]/65536*256,i[c+1]=e[u+a]/65536*256,i[c+2]=e[u+s]/65536*256}return i}function Yyt(n){const{width:e,height:t}=n,r=new Uint8Array(e*t*3);for(let i=0,a=0;i<n.length;i+=4,a+=3){const s=n[i],l=n[i+1],c=n[i+2],u=n[i+3];r[a]=255*((255-s)/256)*((255-u)/256),r[a+1]=255*((255-l)/256)*((255-u)/256),r[a+2]=255*((255-c)/256)*((255-u)/256)}return r}function Wyt(n){const{width:e,height:t}=n,r=new Uint8ClampedArray(e*t*3);for(let i=0,a=0;i<n.length;i+=3,a+=3){const s=n[i],l=n[i+1],c=n[i+2];r[a]=s+1.402*(c-128),r[a+1]=s-.34414*(l-128)-.71414*(c-128),r[a+2]=s+1.772*(l-128)}return r}const Xyt=.95047,Zyt=1,qyt=1.08883;function Kyt(n){const{width:e,height:t}=n,r=new Uint8Array(e*t*3);for(let i=0,a=0;i<n.length;i+=3,a+=3){const s=n[i+0],l=n[i+1]<<24>>24,c=n[i+2]<<24>>24;let u=(s+16)/116,d=l/500+u,f=u-c/200,h,p,m;d=Xyt*(d*d*d>.008856?d*d*d:(d-16/116)/7.787),u=Zyt*(u*u*u>.008856?u*u*u:(u-16/116)/7.787),f=qyt*(f*f*f>.008856?f*f*f:(f-16/116)/7.787),h=d*3.2406+u*-1.5372+f*-.4986,p=d*-.9689+u*1.8758+f*.0415,m=d*.0557+u*-.204+f*1.057,h=h>.0031308?1.055*fi(h,1/2.4)-.055:12.92*h,p=p>.0031308?1.055*fi(p,1/2.4)-.055:12.92*p,m=m>.0031308?1.055*fi(m,1/2.4)-.055:12.92*m,r[a]=Math.max(0,Math.min(1,h))*255,r[a+1]=Math.max(0,Math.min(1,p))*255,r[a+2]=Math.max(0,Math.min(1,m))*255}return r}const q0e=new Map;function kh(n,e){Array.isArray(n)||(n=[n]),n.forEach(t=>q0e.set(t,e))}function Jyt(n){return Ve(this,null,function*(){const e=q0e.get(n.Compression);if(!e)throw new Error(`Unknown compression method identifier: ${n.Compression}`);const t=yield e();return new t(n)})}kh([void 0,1],()=>Promise.resolve().then(()=>require("./raw-B_Sr9gDq.cjs")).then(n=>n.default));kh(5,()=>Promise.resolve().then(()=>require("./lzw-DA3XeqBg.cjs")).then(n=>n.default));kh(6,()=>{throw new Error("old style JPEG compression is not supported.")});kh(7,()=>Promise.resolve().then(()=>require("./jpeg-DLeEjPcb.cjs")).then(n=>n.default));kh([8,32946],()=>Promise.resolve().then(()=>require("./deflate-De_6nNhk.cjs")).then(n=>n.default));kh(32773,()=>Promise.resolve().then(()=>require("./packbits-fIig5HbM.cjs")).then(n=>n.default));kh(34887,()=>Promise.resolve().then(()=>require("./lerc-KuGWJpAs.cjs")).then(n=>Ve(null,null,function*(){return yield n.zstd.init(),n})).then(n=>n.default));kh(50001,()=>Promise.resolve().then(()=>require("./webimage-DQl5wElJ.cjs")).then(n=>n.default));function eE(n,e,t,r=1){return new(Object.getPrototypeOf(n)).constructor(e*t*r)}function Qyt(n,e,t,r,i){const a=e/r,s=t/i;return n.map(l=>{const c=eE(l,r,i);for(let u=0;u<i;++u){const d=Math.min(Math.round(s*u),t-1);for(let f=0;f<r;++f){const h=Math.min(Math.round(a*f),e-1),p=l[d*e+h];c[u*r+f]=p}}return c})}function Tv(n,e,t){return(1-t)*n+t*e}function $yt(n,e,t,r,i){const a=e/r,s=t/i;return n.map(l=>{const c=eE(l,r,i);for(let u=0;u<i;++u){const d=s*u,f=Math.floor(d),h=Math.min(Math.ceil(d),t-1);for(let p=0;p<r;++p){const m=a*p,v=m%1,g=Math.floor(m),y=Math.min(Math.ceil(m),e-1),b=l[f*e+g],x=l[f*e+y],_=l[h*e+g],w=l[h*e+y],S=Tv(Tv(b,x,v),Tv(_,w,v),d%1);c[u*r+p]=S}}return c})}function ebt(n,e,t,r,i,a="nearest"){switch(a.toLowerCase()){case"nearest":return Qyt(n,e,t,r,i);case"bilinear":case"linear":return $yt(n,e,t,r,i);default:throw new Error(`Unsupported resampling method: '${a}'`)}}function tbt(n,e,t,r,i,a){const s=e/r,l=t/i,c=eE(n,r,i,a);for(let u=0;u<i;++u){const d=Math.min(Math.round(l*u),t-1);for(let f=0;f<r;++f){const h=Math.min(Math.round(s*f),e-1);for(let p=0;p<a;++p){const m=n[d*e*a+h*a+p];c[u*r*a+f*a+p]=m}}}return c}function nbt(n,e,t,r,i,a){const s=e/r,l=t/i,c=eE(n,r,i,a);for(let u=0;u<i;++u){const d=l*u,f=Math.floor(d),h=Math.min(Math.ceil(d),t-1);for(let p=0;p<r;++p){const m=s*p,v=m%1,g=Math.floor(m),y=Math.min(Math.ceil(m),e-1);for(let b=0;b<a;++b){const x=n[f*e*a+g*a+b],_=n[f*e*a+y*a+b],w=n[h*e*a+g*a+b],S=n[h*e*a+y*a+b],C=Tv(Tv(x,_,v),Tv(w,S,v),d%1);c[u*r*a+p*a+b]=C}}}return c}function rbt(n,e,t,r,i,a,s="nearest"){switch(s.toLowerCase()){case"nearest":return tbt(n,e,t,r,i,a);case"bilinear":case"linear":return nbt(n,e,t,r,i,a);default:throw new Error(`Unsupported resampling method: '${s}'`)}}function ibt(n,e,t){let r=0;for(let i=e;i<t;++i)r+=n[i];return r}function Pk(n,e,t){switch(n){case 1:if(e<=8)return new Uint8Array(t);if(e<=16)return new Uint16Array(t);if(e<=32)return new Uint32Array(t);break;case 2:if(e===8)return new Int8Array(t);if(e===16)return new Int16Array(t);if(e===32)return new Int32Array(t);break;case 3:switch(e){case 16:case 32:return new Float32Array(t);case 64:return new Float64Array(t)}break}throw Error("Unsupported data format/bitsPerSample")}function abt(n,e){return(n===1||n===2)&&e<=32&&e%8===0?!1:!(n===3&&(e===16||e===32||e===64))}function obt(n,e,t,r,i,a,s){const l=new DataView(n),c=t===2?s*a:s*a*r,u=t===2?1:r,d=Pk(e,i,c),f=parseInt("1".repeat(i),2);if(e===1){let h;t===1?h=r*i:h=i;let p=a*h;(p&7)!==0&&(p=p+7&-8);for(let m=0;m<s;++m){const v=m*p;for(let g=0;g<a;++g){const y=v+g*u*i;for(let b=0;b<u;++b){const x=y+b*i,_=(m*a+g)*u+b,w=Math.floor(x/8),S=x%8;if(S+i<=8)d[_]=l.getUint8(w)>>8-i-S&f;else if(S+i<=16)d[_]=l.getUint16(w)>>16-i-S&f;else if(S+i<=24){const C=l.getUint16(w)<<8|l.getUint8(w+2);d[_]=C>>24-i-S&f}else d[_]=l.getUint32(w)>>32-i-S&f}}}}return d.buffer}class sbt{constructor(e,t,r,i,a,s){this.fileDirectory=e,this.geoKeys=t,this.dataView=r,this.littleEndian=i,this.tiles=a?{}:null,this.isTiled=!e.StripOffsets;const l=e.PlanarConfiguration;if(this.planarConfiguration=typeof l=="undefined"?1:l,this.planarConfiguration!==1&&this.planarConfiguration!==2)throw new Error("Invalid planar configuration.");this.source=s}getFileDirectory(){return this.fileDirectory}getGeoKeys(){return this.geoKeys}getWidth(){return this.fileDirectory.ImageWidth}getHeight(){return this.fileDirectory.ImageLength}getSamplesPerPixel(){return typeof this.fileDirectory.SamplesPerPixel!="undefined"?this.fileDirectory.SamplesPerPixel:1}getTileWidth(){return this.isTiled?this.fileDirectory.TileWidth:this.getWidth()}getTileHeight(){return this.isTiled?this.fileDirectory.TileLength:typeof this.fileDirectory.RowsPerStrip!="undefined"?Math.min(this.fileDirectory.RowsPerStrip,this.getHeight()):this.getHeight()}getBlockWidth(){return this.getTileWidth()}getBlockHeight(e){return this.isTiled||(e+1)*this.getTileHeight()<=this.getHeight()?this.getTileHeight():this.getHeight()-e*this.getTileHeight()}getBytesPerPixel(){let e=0;for(let t=0;t<this.fileDirectory.BitsPerSample.length;++t)e+=this.getSampleByteSize(t);return e}getSampleByteSize(e){if(e>=this.fileDirectory.BitsPerSample.length)throw new RangeError(`Sample index ${e} is out of range.`);return Math.ceil(this.fileDirectory.BitsPerSample[e]/8)}getReaderForSample(e){const t=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1,r=this.fileDirectory.BitsPerSample[e];switch(t){case 1:if(r<=8)return DataView.prototype.getUint8;if(r<=16)return DataView.prototype.getUint16;if(r<=32)return DataView.prototype.getUint32;break;case 2:if(r<=8)return DataView.prototype.getInt8;if(r<=16)return DataView.prototype.getInt16;if(r<=32)return DataView.prototype.getInt32;break;case 3:switch(r){case 16:return function(i,a){return Z0e(this,i,a)};case 32:return DataView.prototype.getFloat32;case 64:return DataView.prototype.getFloat64}break}throw Error("Unsupported data format/bitsPerSample")}getSampleFormat(e=0){return this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1}getBitsPerSample(e=0){return this.fileDirectory.BitsPerSample[e]}getArrayForSample(e,t){const r=this.getSampleFormat(e),i=this.getBitsPerSample(e);return Pk(r,i,t)}getTileOrStrip(e,t,r,i,a){return Ve(this,null,function*(){const s=Math.ceil(this.getWidth()/this.getTileWidth()),l=Math.ceil(this.getHeight()/this.getTileHeight());let c;const{tiles:u}=this;this.planarConfiguration===1?c=t*s+e:this.planarConfiguration===2&&(c=r*s*l+t*s+e);let d,f;this.isTiled?(d=this.fileDirectory.TileOffsets[c],f=this.fileDirectory.TileByteCounts[c]):(d=this.fileDirectory.StripOffsets[c],f=this.fileDirectory.StripByteCounts[c]);const h=(yield this.source.fetch([{offset:d,length:f}],a))[0];let p;return u===null||!u[c]?(p=Ve(this,null,function*(){let m=yield i.decode(this.fileDirectory,h);const v=this.getSampleFormat(),g=this.getBitsPerSample();return abt(v,g)&&(m=obt(m,v,this.planarConfiguration,this.getSamplesPerPixel(),g,this.getTileWidth(),this.getBlockHeight(t))),m}),u!==null&&(u[c]=p)):p=u[c],{x:e,y:t,sample:r,data:yield p}})}_readRaster(e,t,r,i,a,s,l,c,u){return Ve(this,null,function*(){const d=this.getTileWidth(),f=this.getTileHeight(),h=this.getWidth(),p=this.getHeight(),m=Math.max(Math.floor(e[0]/d),0),v=Math.min(Math.ceil(e[2]/d),Math.ceil(h/d)),g=Math.max(Math.floor(e[1]/f),0),y=Math.min(Math.ceil(e[3]/f),Math.ceil(p/f)),b=e[2]-e[0];let x=this.getBytesPerPixel();const _=[],w=[];for(let E=0;E<t.length;++E)this.planarConfiguration===1?_.push(ibt(this.fileDirectory.BitsPerSample,0,t[E])/8):_.push(0),w.push(this.getReaderForSample(t[E]));const S=[],{littleEndian:C}=this;for(let E=g;E<y;++E)for(let T=m;T<v;++T){let A;this.planarConfiguration===1&&(A=this.getTileOrStrip(T,E,0,a,u));for(let M=0;M<t.length;++M){const D=M,k=t[M];this.planarConfiguration===2&&(x=this.getSampleByteSize(k),A=this.getTileOrStrip(T,E,k,a,u));const P=A.then(I=>{const N=I.data,R=new DataView(N),V=this.getBlockHeight(I.y),B=I.y*f,F=I.x*d,G=B+V,U=(I.x+1)*d,z=w[D],j=Math.min(V,V-(G-e[3]),p-B),W=Math.min(d,d-(U-e[2]),h-F);for(let Y=Math.max(0,e[1]-B);Y<j;++Y)for(let re=Math.max(0,e[0]-F);re<W;++re){const Q=(Y*d+re)*x,$=z.call(R,Q+_[D],C);let ee;i?(ee=(Y+B-e[1])*b*t.length+(re+F-e[0])*t.length+D,r[ee]=$):(ee=(Y+B-e[1])*b+re+F-e[0],r[D][ee]=$)}});S.push(P)}}if(yield Promise.all(S),s&&e[2]-e[0]!==s||l&&e[3]-e[1]!==l){let E;return i?E=rbt(r,e[2]-e[0],e[3]-e[1],s,l,t.length,c):E=ebt(r,e[2]-e[0],e[3]-e[1],s,l,c),E.width=s,E.height=l,E}return r.width=s||e[2]-e[0],r.height=l||e[3]-e[1],r})}readRasters(){return Ve(this,arguments,function*({window:e,samples:t=[],interleave:r,pool:i=null,width:a,height:s,resampleMethod:l,fillValue:c,signal:u}={}){const d=e||[0,0,this.getWidth(),this.getHeight()];if(d[0]>d[2]||d[1]>d[3])throw new Error("Invalid subsets");const f=d[2]-d[0],h=d[3]-d[1],p=f*h,m=this.getSamplesPerPixel();if(!t||!t.length)for(let b=0;b<m;++b)t.push(b);else for(let b=0;b<t.length;++b)if(t[b]>=m)return Promise.reject(new RangeError(`Invalid sample index '${t[b]}'.`));let v;if(r){const b=this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,x=Math.max.apply(null,this.fileDirectory.BitsPerSample);v=Pk(b,x,p*t.length),c&&v.fill(c)}else{v=[];for(let b=0;b<t.length;++b){const x=this.getArrayForSample(t[b],p);Array.isArray(c)&&b<c.length?x.fill(c[b]):c&&!Array.isArray(c)&&x.fill(c),v.push(x)}}const g=i||(yield Jyt(this.fileDirectory));return yield this._readRaster(d,t,v,r,g,a,s,l,u)})}readRGB(){return Ve(this,arguments,function*({window:e,interleave:t=!0,pool:r=null,width:i,height:a,resampleMethod:s,enableAlpha:l=!1,signal:c}={}){const u=e||[0,0,this.getWidth(),this.getHeight()];if(u[0]>u[2]||u[1]>u[3])throw new Error("Invalid subsets");const d=this.fileDirectory.PhotometricInterpretation;if(d===cc.RGB){let y=[0,1,2];if(this.fileDirectory.ExtraSamples!==Byt.Unspecified&&l){y=[];for(let b=0;b<this.fileDirectory.BitsPerSample.length;b+=1)y.push(b)}return this.readRasters({window:e,interleave:t,samples:y,pool:r,width:i,height:a,resampleMethod:s,signal:c})}let f;switch(d){case cc.WhiteIsZero:case cc.BlackIsZero:case cc.Palette:f=[0];break;case cc.CMYK:f=[0,1,2,3];break;case cc.YCbCr:case cc.CIELab:f=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const h={window:u,interleave:!0,samples:f,pool:r,width:i,height:a,resampleMethod:s,signal:c},{fileDirectory:p}=this,m=yield this.readRasters(h),v=fi(2,this.fileDirectory.BitsPerSample[0]);let g;switch(d){case cc.WhiteIsZero:g=Hyt(m,v);break;case cc.BlackIsZero:g=jyt(m,v);break;case cc.Palette:g=Gyt(m,p.ColorMap);break;case cc.CMYK:g=Yyt(m);break;case cc.YCbCr:g=Wyt(m);break;case cc.CIELab:g=Kyt(m);break;default:throw new Error("Unsupported photometric interpretation.")}if(!t){const y=new Uint8Array(g.length/3),b=new Uint8Array(g.length/3),x=new Uint8Array(g.length/3);for(let _=0,w=0;_<g.length;_+=3,++w)y[w]=g[_],b[w]=g[_+1],x[w]=g[_+2];g=[y,b,x]}return g.width=m.width,g.height=m.height,g})}getTiePoints(){if(!this.fileDirectory.ModelTiepoint)return[];const e=[];for(let t=0;t<this.fileDirectory.ModelTiepoint.length;t+=6)e.push({i:this.fileDirectory.ModelTiepoint[t],j:this.fileDirectory.ModelTiepoint[t+1],k:this.fileDirectory.ModelTiepoint[t+2],x:this.fileDirectory.ModelTiepoint[t+3],y:this.fileDirectory.ModelTiepoint[t+4],z:this.fileDirectory.ModelTiepoint[t+5]});return e}getGDALMetadata(e=null){const t={};if(!this.fileDirectory.GDAL_METADATA)return null;const r=this.fileDirectory.GDAL_METADATA;let i=Ryt(r,"Item");e===null?i=i.filter(a=>rL(a,"sample")===void 0):i=i.filter(a=>Number(rL(a,"sample"))===e);for(let a=0;a<i.length;++a){const s=i[a];t[rL(s,"name")]=s.inner}return t}getGDALNoData(){if(!this.fileDirectory.GDAL_NODATA)return null;const e=this.fileDirectory.GDAL_NODATA;return Number(e.substring(0,e.length-1))}getOrigin(){const e=this.fileDirectory.ModelTiepoint,t=this.fileDirectory.ModelTransformation;if(e&&e.length===6)return[e[3],e[4],e[5]];if(t)return[t[3],t[7],t[11]];throw new Error("The image does not have an affine transformation.")}getResolution(e=null){const t=this.fileDirectory.ModelPixelScale,r=this.fileDirectory.ModelTransformation;if(t)return[t[0],-t[1],t[2]];if(r)return r[1]===0&&r[4]===0?[r[0],-r[5],r[10]]:[Math.sqrt(r[0]*r[0]+r[4]*r[4]),-Math.sqrt(r[1]*r[1]+r[5]*r[5]),r[10]];if(e){const[i,a,s]=e.getResolution();return[i*e.getWidth()/this.getWidth(),a*e.getHeight()/this.getHeight(),s*e.getWidth()/this.getWidth()]}throw new Error("The image does not have an affine transformation.")}pixelIsArea(){return this.geoKeys.GTRasterTypeGeoKey===1}getBoundingBox(e=!1){const t=this.getHeight(),r=this.getWidth();if(this.fileDirectory.ModelTransformation&&!e){const[i,a,s,l,c,u,d,f]=this.fileDirectory.ModelTransformation,p=[[0,0],[0,t],[r,0],[r,t]].map(([g,y])=>[l+i*g+a*y,f+c*g+u*y]),m=p.map(g=>g[0]),v=p.map(g=>g[1]);return[Math.min(...m),Math.min(...v),Math.max(...m),Math.max(...v)]}else{const i=this.getOrigin(),a=this.getResolution(),s=i[0],l=i[1],c=s+a[0]*r,u=l+a[1]*t;return[Math.min(s,c),Math.min(l,u),Math.max(s,c),Math.max(l,u)]}}}class lbt{constructor(e){this._dataView=new DataView(e)}get buffer(){return this._dataView.buffer}getUint64(e,t){const r=this.getUint32(e,t),i=this.getUint32(e+4,t);let a;if(t){if(a=r+fi(2,32)*i,!Number.isSafeInteger(a))throw new Error(`${a} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return a}if(a=fi(2,32)*r+i,!Number.isSafeInteger(a))throw new Error(`${a} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return a}getInt64(e,t){let r=0;const i=(this._dataView.getUint8(e+(t?7:0))&128)>0;let a=!0;for(let s=0;s<8;s++){let l=this._dataView.getUint8(e+(t?s:7-s));i&&(a?l!==0&&(l=~(l-1)&255,a=!1):l=~l&255),r+=l*fi(256,s)}return i&&(r=-r),r}getUint8(e,t){return this._dataView.getUint8(e,t)}getInt8(e,t){return this._dataView.getInt8(e,t)}getUint16(e,t){return this._dataView.getUint16(e,t)}getInt16(e,t){return this._dataView.getInt16(e,t)}getUint32(e,t){return this._dataView.getUint32(e,t)}getInt32(e,t){return this._dataView.getInt32(e,t)}getFloat16(e,t){return Z0e(this._dataView,e,t)}getFloat32(e,t){return this._dataView.getFloat32(e,t)}getFloat64(e,t){return this._dataView.getFloat64(e,t)}}class cbt{constructor(e,t,r,i){this._dataView=new DataView(e),this._sliceOffset=t,this._littleEndian=r,this._bigTiff=i}get sliceOffset(){return this._sliceOffset}get sliceTop(){return this._sliceOffset+this.buffer.byteLength}get littleEndian(){return this._littleEndian}get bigTiff(){return this._bigTiff}get buffer(){return this._dataView.buffer}covers(e,t){return this.sliceOffset<=e&&this.sliceTop>=e+t}readUint8(e){return this._dataView.getUint8(e-this._sliceOffset,this._littleEndian)}readInt8(e){return this._dataView.getInt8(e-this._sliceOffset,this._littleEndian)}readUint16(e){return this._dataView.getUint16(e-this._sliceOffset,this._littleEndian)}readInt16(e){return this._dataView.getInt16(e-this._sliceOffset,this._littleEndian)}readUint32(e){return this._dataView.getUint32(e-this._sliceOffset,this._littleEndian)}readInt32(e){return this._dataView.getInt32(e-this._sliceOffset,this._littleEndian)}readFloat32(e){return this._dataView.getFloat32(e-this._sliceOffset,this._littleEndian)}readFloat64(e){return this._dataView.getFloat64(e-this._sliceOffset,this._littleEndian)}readUint64(e){const t=this.readUint32(e),r=this.readUint32(e+4);let i;if(this._littleEndian){if(i=t+fi(2,32)*r,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}if(i=fi(2,32)*t+r,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}readInt64(e){let t=0;const r=(this._dataView.getUint8(e+(this._littleEndian?7:0))&128)>0;let i=!0;for(let a=0;a<8;a++){let s=this._dataView.getUint8(e+(this._littleEndian?a:7-a));r&&(i?s!==0&&(s=~(s-1)&255,i=!1):s=~s&255),t+=s*fi(256,a)}return r&&(t=-t),t}readOffset(e){return this._bigTiff?this.readUint64(e):this.readUint32(e)}}class ubt{fetch(e,t=void 0){return Ve(this,null,function*(){return Promise.all(e.map(r=>this.fetchSlice(r,t)))})}fetchSlice(e){return Ve(this,null,function*(){throw new Error(`fetching of slice ${e} not possible, not implemented`)})}get fileSize(){return null}close(){return Ve(this,null,function*(){})}}class NF extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,NF),this.name="AbortError"}}class dbt extends ubt{constructor(e){super(),this.arrayBuffer=e}fetchSlice(e,t){if(t&&t.aborted)throw new NF("Request aborted");return this.arrayBuffer.slice(e.offset,e.offset+e.length)}}function fbt(n){return new dbt(n)}function kk(n){switch(n){case Qr.BYTE:case Qr.ASCII:case Qr.SBYTE:case Qr.UNDEFINED:return 1;case Qr.SHORT:case Qr.SSHORT:return 2;case Qr.LONG:case Qr.SLONG:case Qr.FLOAT:case Qr.IFD:return 4;case Qr.RATIONAL:case Qr.SRATIONAL:case Qr.DOUBLE:case Qr.LONG8:case Qr.SLONG8:case Qr.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${n}`)}}function hbt(n){const e=n.GeoKeyDirectory;if(!e)return null;const t={};for(let r=4;r<=e[3]*4;r+=4){const i=Uyt[e[r]],a=e[r+1]?N9[e[r+1]]:null,s=e[r+2],l=e[r+3];let c=null;if(!a)c=l;else{if(c=n[a],typeof c=="undefined"||c===null)throw new Error(`Could not get value of geoKey '${i}'.`);typeof c=="string"?c=c.substring(l,l+s-1):c.subarray&&(c=c.subarray(l,l+s),s===1&&(c=c[0]))}t[i]=c}return t}function Mm(n,e,t,r){let i=null,a=null;const s=kk(e);switch(e){case Qr.BYTE:case Qr.ASCII:case Qr.UNDEFINED:i=new Uint8Array(t),a=n.readUint8;break;case Qr.SBYTE:i=new Int8Array(t),a=n.readInt8;break;case Qr.SHORT:i=new Uint16Array(t),a=n.readUint16;break;case Qr.SSHORT:i=new Int16Array(t),a=n.readInt16;break;case Qr.LONG:case Qr.IFD:i=new Uint32Array(t),a=n.readUint32;break;case Qr.SLONG:i=new Int32Array(t),a=n.readInt32;break;case Qr.LONG8:case Qr.IFD8:i=new Array(t),a=n.readUint64;break;case Qr.SLONG8:i=new Array(t),a=n.readInt64;break;case Qr.RATIONAL:i=new Uint32Array(t*2),a=n.readUint32;break;case Qr.SRATIONAL:i=new Int32Array(t*2),a=n.readInt32;break;case Qr.FLOAT:i=new Float32Array(t),a=n.readFloat32;break;case Qr.DOUBLE:i=new Float64Array(t),a=n.readFloat64;break;default:throw new RangeError(`Invalid field type: ${e}`)}if(e===Qr.RATIONAL||e===Qr.SRATIONAL)for(let l=0;l<t;l+=2)i[l]=a.call(n,r+l*s),i[l+1]=a.call(n,r+(l*s+4));else for(let l=0;l<t;++l)i[l]=a.call(n,r+l*s);return e===Qr.ASCII?new TextDecoder("utf-8").decode(i):i}class pbt{constructor(e,t,r){this.fileDirectory=e,this.geoKeyDirectory=t,this.nextIFDByteOffset=r}}class Ib extends Error{constructor(e){super(`No image at index ${e}`),this.index=e}}class mbt{readRasters(){return Ve(this,arguments,function*(e={}){const{window:t,width:r,height:i}=e;let{resX:a,resY:s,bbox:l}=e;const c=yield this.getImage();let u=c;const d=yield this.getImageCount(),f=c.getBoundingBox();if(t&&l)throw new Error('Both "bbox" and "window" passed.');if(r||i){if(t){const[m,v]=c.getOrigin(),[g,y]=c.getResolution();l=[m+t[0]*g,v+t[1]*y,m+t[2]*g,v+t[3]*y]}const p=l||f;if(r){if(a)throw new Error("Both width and resX passed");a=(p[2]-p[0])/r}if(i){if(s)throw new Error("Both width and resY passed");s=(p[3]-p[1])/i}}if(a||s){const p=[];for(let m=0;m<d;++m){const v=yield this.getImage(m),{SubfileType:g,NewSubfileType:y}=v.fileDirectory;(m===0||g===2||y&1)&&p.push(v)}p.sort((m,v)=>m.getWidth()-v.getWidth());for(let m=0;m<p.length;++m){const v=p[m],g=(f[2]-f[0])/v.getWidth(),y=(f[3]-f[1])/v.getHeight();if(u=v,a&&a>g||s&&s>y)break}}let h=t;if(l){const[p,m]=c.getOrigin(),[v,g]=u.getResolution(c);h=[Math.round((l[0]-p)/v),Math.round((l[1]-m)/g),Math.round((l[2]-p)/v),Math.round((l[3]-m)/g)],h=[Math.min(h[0],h[2]),Math.min(h[1],h[3]),Math.max(h[0],h[2]),Math.max(h[1],h[3])]}return u.readRasters(tt(Ne({},e),{window:h}))})}}class OF extends mbt{constructor(e,t,r,i,a={}){super(),this.source=e,this.littleEndian=t,this.bigTiff=r,this.firstIFDOffset=i,this.cache=a.cache||!1,this.ifdRequests=[],this.ghostValues=null}getSlice(e,t){return Ve(this,null,function*(){const r=this.bigTiff?4048:1024;return new cbt((yield this.source.fetch([{offset:e,length:typeof t!="undefined"?t:r}]))[0],e,this.littleEndian,this.bigTiff)})}parseFileDirectoryAt(e){return Ve(this,null,function*(){const t=this.bigTiff?20:12,r=this.bigTiff?8:2;let i=yield this.getSlice(e);const a=this.bigTiff?i.readUint64(e):i.readUint16(e),s=a*t+(this.bigTiff?16:6);i.covers(e,s)||(i=yield this.getSlice(e,s));const l={};let c=e+(this.bigTiff?8:2);for(let f=0;f<a;c+=t,++f){const h=i.readUint16(c),p=i.readUint16(c+2),m=this.bigTiff?i.readUint64(c+4):i.readUint32(c+4);let v,g;const y=kk(p),b=c+(this.bigTiff?12:8);if(y*m<=(this.bigTiff?8:4))v=Mm(i,p,m,b);else{const x=i.readOffset(b),_=kk(p)*m;if(i.covers(x,_))v=Mm(i,p,m,x);else{const w=yield this.getSlice(x,_);v=Mm(w,p,m,x)}}m===1&&Vyt.indexOf(h)===-1&&!(p===Qr.RATIONAL||p===Qr.SRATIONAL)?g=v[0]:g=v,l[N9[h]]=g}const u=hbt(l),d=i.readOffset(e+r+t*a);return new pbt(l,u,d)})}requestIFD(e){return Ve(this,null,function*(){if(this.ifdRequests[e])return this.ifdRequests[e];if(e===0)return this.ifdRequests[e]=this.parseFileDirectoryAt(this.firstIFDOffset),this.ifdRequests[e];if(!this.ifdRequests[e-1])try{this.ifdRequests[e-1]=this.requestIFD(e-1)}catch(t){throw t instanceof Ib?new Ib(e):t}return this.ifdRequests[e]=Ve(this,null,function*(){const t=yield this.ifdRequests[e-1];if(t.nextIFDByteOffset===0)throw new Ib(e);return this.parseFileDirectoryAt(t.nextIFDByteOffset)}),this.ifdRequests[e]})}getImage(e=0){return Ve(this,null,function*(){const t=yield this.requestIFD(e);return new sbt(t.fileDirectory,t.geoKeyDirectory,this.dataView,this.littleEndian,this.cache,this.source)})}getImageCount(){return Ve(this,null,function*(){let e=0,t=!0;for(;t;)try{yield this.requestIFD(e),++e}catch(r){if(r instanceof Ib)t=!1;else throw r}return e})}getGhostValues(){return Ve(this,null,function*(){const e=this.bigTiff?16:8;if(this.ghostValues)return this.ghostValues;const t="GDAL_STRUCTURAL_METADATA_SIZE=",r=t.length+100;let i=yield this.getSlice(e,r);if(t===Mm(i,Qr.ASCII,t.length,e)){const s=Mm(i,Qr.ASCII,r,e).split(`
3987
+ >]`),x+=t(_,"</"+a+">"),x>=b)break;y=h}}else h=e(f,"[ /]"+a+">",0);const m=d+a.length+h+1;if(l&&console.log("[xml-utils] end:",m),m===-1)return;const v=i.slice(d,m);let g;return p?g=null:g=v.slice(v.indexOf(">")+1,v.lastIndexOf("<")),{inner:g,outer:v,start:d,end:m}}return Nb.exports=r,Nb.exports.default=r,Nb.exports}var E$;function kyt(){if(E$)return Lb.exports;E$=1;const n=Pyt();function e(t,r,i){const a=[],s=i&&i.debug||!1,l=i&&typeof i.nested=="boolean"?i.nested:!0;let c=i&&i.startIndex||0,u;for(;u=n(t,r,{debug:s,startIndex:c});)l?c=u.start+1+r.length:c=u.end,a.push(u);return s&&console.log("findTagsByName found",a.length,"tags"),a}return Lb.exports=e,Lb.exports.default=e,Lb.exports}var Iyt=kyt();const Ryt=hd(Iyt),N9={315:"Artist",258:"BitsPerSample",265:"CellLength",264:"CellWidth",320:"ColorMap",259:"Compression",33432:"Copyright",306:"DateTime",338:"ExtraSamples",266:"FillOrder",289:"FreeByteCounts",288:"FreeOffsets",291:"GrayResponseCurve",290:"GrayResponseUnit",316:"HostComputer",270:"ImageDescription",257:"ImageLength",256:"ImageWidth",271:"Make",281:"MaxSampleValue",280:"MinSampleValue",272:"Model",254:"NewSubfileType",274:"Orientation",262:"PhotometricInterpretation",284:"PlanarConfiguration",296:"ResolutionUnit",278:"RowsPerStrip",277:"SamplesPerPixel",305:"Software",279:"StripByteCounts",273:"StripOffsets",255:"SubfileType",263:"Threshholding",282:"XResolution",283:"YResolution",326:"BadFaxLines",327:"CleanFaxData",343:"ClipPath",328:"ConsecutiveBadFaxLines",433:"Decode",434:"DefaultImageColor",269:"DocumentName",336:"DotRange",321:"HalftoneHints",346:"Indexed",347:"JPEGTables",285:"PageName",297:"PageNumber",317:"Predictor",319:"PrimaryChromaticities",532:"ReferenceBlackWhite",339:"SampleFormat",340:"SMinSampleValue",341:"SMaxSampleValue",559:"StripRowCounts",330:"SubIFDs",292:"T4Options",293:"T6Options",325:"TileByteCounts",323:"TileLength",324:"TileOffsets",322:"TileWidth",301:"TransferFunction",318:"WhitePoint",344:"XClipPathUnits",286:"XPosition",529:"YCbCrCoefficients",531:"YCbCrPositioning",530:"YCbCrSubSampling",345:"YClipPathUnits",287:"YPosition",37378:"ApertureValue",40961:"ColorSpace",36868:"DateTimeDigitized",36867:"DateTimeOriginal",34665:"Exif IFD",36864:"ExifVersion",33434:"ExposureTime",41728:"FileSource",37385:"Flash",40960:"FlashpixVersion",33437:"FNumber",42016:"ImageUniqueID",37384:"LightSource",37500:"MakerNote",37377:"ShutterSpeedValue",37510:"UserComment",33723:"IPTC",34675:"ICC Profile",700:"XMP",42112:"GDAL_METADATA",42113:"GDAL_NODATA",34377:"Photoshop",33550:"ModelPixelScale",33922:"ModelTiepoint",34264:"ModelTransformation",34735:"GeoKeyDirectory",34736:"GeoDoubleParams",34737:"GeoAsciiParams",50674:"LercParameters"},I1={};for(const n in N9)N9.hasOwnProperty(n)&&(I1[N9[n]]=parseInt(n,10));const Vyt=[I1.BitsPerSample,I1.ExtraSamples,I1.SampleFormat,I1.StripByteCounts,I1.StripOffsets,I1.StripRowCounts,I1.TileByteCounts,I1.TileOffsets,I1.SubIFDs],iL={1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE",13:"IFD",16:"LONG8",17:"SLONG8",18:"IFD8"},Qr={};for(const n in iL)iL.hasOwnProperty(n)&&(Qr[iL[n]]=parseInt(n,10));const cc={WhiteIsZero:0,BlackIsZero:1,RGB:2,Palette:3,CMYK:5,YCbCr:6,CIELab:8},Byt={Unspecified:0},Fyt={AddCompression:1},zyt={None:0,Deflate:1,Zstandard:2},Uyt={1024:"GTModelTypeGeoKey",1025:"GTRasterTypeGeoKey",1026:"GTCitationGeoKey",2048:"GeographicTypeGeoKey",2049:"GeogCitationGeoKey",2050:"GeogGeodeticDatumGeoKey",2051:"GeogPrimeMeridianGeoKey",2052:"GeogLinearUnitsGeoKey",2053:"GeogLinearUnitSizeGeoKey",2054:"GeogAngularUnitsGeoKey",2055:"GeogAngularUnitSizeGeoKey",2056:"GeogEllipsoidGeoKey",2057:"GeogSemiMajorAxisGeoKey",2058:"GeogSemiMinorAxisGeoKey",2059:"GeogInvFlatteningGeoKey",2060:"GeogAzimuthUnitsGeoKey",2061:"GeogPrimeMeridianLongGeoKey",2062:"GeogTOWGS84GeoKey",3072:"ProjectedCSTypeGeoKey",3073:"PCSCitationGeoKey",3074:"ProjectionGeoKey",3075:"ProjCoordTransGeoKey",3076:"ProjLinearUnitsGeoKey",3077:"ProjLinearUnitSizeGeoKey",3078:"ProjStdParallel1GeoKey",3079:"ProjStdParallel2GeoKey",3080:"ProjNatOriginLongGeoKey",3081:"ProjNatOriginLatGeoKey",3082:"ProjFalseEastingGeoKey",3083:"ProjFalseNorthingGeoKey",3084:"ProjFalseOriginLongGeoKey",3085:"ProjFalseOriginLatGeoKey",3086:"ProjFalseOriginEastingGeoKey",3087:"ProjFalseOriginNorthingGeoKey",3088:"ProjCenterLongGeoKey",3089:"ProjCenterLatGeoKey",3090:"ProjCenterEastingGeoKey",3091:"ProjCenterNorthingGeoKey",3092:"ProjScaleAtNatOriginGeoKey",3093:"ProjScaleAtCenterGeoKey",3094:"ProjAzimuthAngleGeoKey",3095:"ProjStraightVertPoleLongGeoKey",3096:"ProjRectifiedGridAngleGeoKey",4096:"VerticalCSTypeGeoKey",4097:"VerticalCitationGeoKey",4098:"VerticalDatumGeoKey",4099:"VerticalUnitsGeoKey"};function Hyt(n,e){const{width:t,height:r}=n,i=new Uint8Array(t*r*3);let a;for(let s=0,l=0;s<n.length;++s,l+=3)a=256-n[s]/e*256,i[l]=a,i[l+1]=a,i[l+2]=a;return i}function jyt(n,e){const{width:t,height:r}=n,i=new Uint8Array(t*r*3);let a;for(let s=0,l=0;s<n.length;++s,l+=3)a=n[s]/e*256,i[l]=a,i[l+1]=a,i[l+2]=a;return i}function Gyt(n,e){const{width:t,height:r}=n,i=new Uint8Array(t*r*3),a=e.length/3,s=e.length/3*2;for(let l=0,c=0;l<n.length;++l,c+=3){const u=n[l];i[c]=e[u]/65536*256,i[c+1]=e[u+a]/65536*256,i[c+2]=e[u+s]/65536*256}return i}function Yyt(n){const{width:e,height:t}=n,r=new Uint8Array(e*t*3);for(let i=0,a=0;i<n.length;i+=4,a+=3){const s=n[i],l=n[i+1],c=n[i+2],u=n[i+3];r[a]=255*((255-s)/256)*((255-u)/256),r[a+1]=255*((255-l)/256)*((255-u)/256),r[a+2]=255*((255-c)/256)*((255-u)/256)}return r}function Wyt(n){const{width:e,height:t}=n,r=new Uint8ClampedArray(e*t*3);for(let i=0,a=0;i<n.length;i+=3,a+=3){const s=n[i],l=n[i+1],c=n[i+2];r[a]=s+1.402*(c-128),r[a+1]=s-.34414*(l-128)-.71414*(c-128),r[a+2]=s+1.772*(l-128)}return r}const Xyt=.95047,Zyt=1,qyt=1.08883;function Kyt(n){const{width:e,height:t}=n,r=new Uint8Array(e*t*3);for(let i=0,a=0;i<n.length;i+=3,a+=3){const s=n[i+0],l=n[i+1]<<24>>24,c=n[i+2]<<24>>24;let u=(s+16)/116,d=l/500+u,f=u-c/200,h,p,m;d=Xyt*(d*d*d>.008856?d*d*d:(d-16/116)/7.787),u=Zyt*(u*u*u>.008856?u*u*u:(u-16/116)/7.787),f=qyt*(f*f*f>.008856?f*f*f:(f-16/116)/7.787),h=d*3.2406+u*-1.5372+f*-.4986,p=d*-.9689+u*1.8758+f*.0415,m=d*.0557+u*-.204+f*1.057,h=h>.0031308?1.055*fi(h,1/2.4)-.055:12.92*h,p=p>.0031308?1.055*fi(p,1/2.4)-.055:12.92*p,m=m>.0031308?1.055*fi(m,1/2.4)-.055:12.92*m,r[a]=Math.max(0,Math.min(1,h))*255,r[a+1]=Math.max(0,Math.min(1,p))*255,r[a+2]=Math.max(0,Math.min(1,m))*255}return r}const q0e=new Map;function kh(n,e){Array.isArray(n)||(n=[n]),n.forEach(t=>q0e.set(t,e))}function Jyt(n){return Ve(this,null,function*(){const e=q0e.get(n.Compression);if(!e)throw new Error(`Unknown compression method identifier: ${n.Compression}`);const t=yield e();return new t(n)})}kh([void 0,1],()=>Promise.resolve().then(()=>require("./raw-B_Sr9gDq.cjs")).then(n=>n.default));kh(5,()=>Promise.resolve().then(()=>require("./lzw-DA3XeqBg.cjs")).then(n=>n.default));kh(6,()=>{throw new Error("old style JPEG compression is not supported.")});kh(7,()=>Promise.resolve().then(()=>require("./jpeg-DLeEjPcb.cjs")).then(n=>n.default));kh([8,32946],()=>Promise.resolve().then(()=>require("./deflate-De_6nNhk.cjs")).then(n=>n.default));kh(32773,()=>Promise.resolve().then(()=>require("./packbits-fIig5HbM.cjs")).then(n=>n.default));kh(34887,()=>Promise.resolve().then(()=>require("./lerc-6cBhGhIQ.cjs")).then(n=>Ve(null,null,function*(){return yield n.zstd.init(),n})).then(n=>n.default));kh(50001,()=>Promise.resolve().then(()=>require("./webimage-DQl5wElJ.cjs")).then(n=>n.default));function eE(n,e,t,r=1){return new(Object.getPrototypeOf(n)).constructor(e*t*r)}function Qyt(n,e,t,r,i){const a=e/r,s=t/i;return n.map(l=>{const c=eE(l,r,i);for(let u=0;u<i;++u){const d=Math.min(Math.round(s*u),t-1);for(let f=0;f<r;++f){const h=Math.min(Math.round(a*f),e-1),p=l[d*e+h];c[u*r+f]=p}}return c})}function Tv(n,e,t){return(1-t)*n+t*e}function $yt(n,e,t,r,i){const a=e/r,s=t/i;return n.map(l=>{const c=eE(l,r,i);for(let u=0;u<i;++u){const d=s*u,f=Math.floor(d),h=Math.min(Math.ceil(d),t-1);for(let p=0;p<r;++p){const m=a*p,v=m%1,g=Math.floor(m),y=Math.min(Math.ceil(m),e-1),b=l[f*e+g],x=l[f*e+y],_=l[h*e+g],w=l[h*e+y],S=Tv(Tv(b,x,v),Tv(_,w,v),d%1);c[u*r+p]=S}}return c})}function ebt(n,e,t,r,i,a="nearest"){switch(a.toLowerCase()){case"nearest":return Qyt(n,e,t,r,i);case"bilinear":case"linear":return $yt(n,e,t,r,i);default:throw new Error(`Unsupported resampling method: '${a}'`)}}function tbt(n,e,t,r,i,a){const s=e/r,l=t/i,c=eE(n,r,i,a);for(let u=0;u<i;++u){const d=Math.min(Math.round(l*u),t-1);for(let f=0;f<r;++f){const h=Math.min(Math.round(s*f),e-1);for(let p=0;p<a;++p){const m=n[d*e*a+h*a+p];c[u*r*a+f*a+p]=m}}}return c}function nbt(n,e,t,r,i,a){const s=e/r,l=t/i,c=eE(n,r,i,a);for(let u=0;u<i;++u){const d=l*u,f=Math.floor(d),h=Math.min(Math.ceil(d),t-1);for(let p=0;p<r;++p){const m=s*p,v=m%1,g=Math.floor(m),y=Math.min(Math.ceil(m),e-1);for(let b=0;b<a;++b){const x=n[f*e*a+g*a+b],_=n[f*e*a+y*a+b],w=n[h*e*a+g*a+b],S=n[h*e*a+y*a+b],C=Tv(Tv(x,_,v),Tv(w,S,v),d%1);c[u*r*a+p*a+b]=C}}}return c}function rbt(n,e,t,r,i,a,s="nearest"){switch(s.toLowerCase()){case"nearest":return tbt(n,e,t,r,i,a);case"bilinear":case"linear":return nbt(n,e,t,r,i,a);default:throw new Error(`Unsupported resampling method: '${s}'`)}}function ibt(n,e,t){let r=0;for(let i=e;i<t;++i)r+=n[i];return r}function Pk(n,e,t){switch(n){case 1:if(e<=8)return new Uint8Array(t);if(e<=16)return new Uint16Array(t);if(e<=32)return new Uint32Array(t);break;case 2:if(e===8)return new Int8Array(t);if(e===16)return new Int16Array(t);if(e===32)return new Int32Array(t);break;case 3:switch(e){case 16:case 32:return new Float32Array(t);case 64:return new Float64Array(t)}break}throw Error("Unsupported data format/bitsPerSample")}function abt(n,e){return(n===1||n===2)&&e<=32&&e%8===0?!1:!(n===3&&(e===16||e===32||e===64))}function obt(n,e,t,r,i,a,s){const l=new DataView(n),c=t===2?s*a:s*a*r,u=t===2?1:r,d=Pk(e,i,c),f=parseInt("1".repeat(i),2);if(e===1){let h;t===1?h=r*i:h=i;let p=a*h;(p&7)!==0&&(p=p+7&-8);for(let m=0;m<s;++m){const v=m*p;for(let g=0;g<a;++g){const y=v+g*u*i;for(let b=0;b<u;++b){const x=y+b*i,_=(m*a+g)*u+b,w=Math.floor(x/8),S=x%8;if(S+i<=8)d[_]=l.getUint8(w)>>8-i-S&f;else if(S+i<=16)d[_]=l.getUint16(w)>>16-i-S&f;else if(S+i<=24){const C=l.getUint16(w)<<8|l.getUint8(w+2);d[_]=C>>24-i-S&f}else d[_]=l.getUint32(w)>>32-i-S&f}}}}return d.buffer}class sbt{constructor(e,t,r,i,a,s){this.fileDirectory=e,this.geoKeys=t,this.dataView=r,this.littleEndian=i,this.tiles=a?{}:null,this.isTiled=!e.StripOffsets;const l=e.PlanarConfiguration;if(this.planarConfiguration=typeof l=="undefined"?1:l,this.planarConfiguration!==1&&this.planarConfiguration!==2)throw new Error("Invalid planar configuration.");this.source=s}getFileDirectory(){return this.fileDirectory}getGeoKeys(){return this.geoKeys}getWidth(){return this.fileDirectory.ImageWidth}getHeight(){return this.fileDirectory.ImageLength}getSamplesPerPixel(){return typeof this.fileDirectory.SamplesPerPixel!="undefined"?this.fileDirectory.SamplesPerPixel:1}getTileWidth(){return this.isTiled?this.fileDirectory.TileWidth:this.getWidth()}getTileHeight(){return this.isTiled?this.fileDirectory.TileLength:typeof this.fileDirectory.RowsPerStrip!="undefined"?Math.min(this.fileDirectory.RowsPerStrip,this.getHeight()):this.getHeight()}getBlockWidth(){return this.getTileWidth()}getBlockHeight(e){return this.isTiled||(e+1)*this.getTileHeight()<=this.getHeight()?this.getTileHeight():this.getHeight()-e*this.getTileHeight()}getBytesPerPixel(){let e=0;for(let t=0;t<this.fileDirectory.BitsPerSample.length;++t)e+=this.getSampleByteSize(t);return e}getSampleByteSize(e){if(e>=this.fileDirectory.BitsPerSample.length)throw new RangeError(`Sample index ${e} is out of range.`);return Math.ceil(this.fileDirectory.BitsPerSample[e]/8)}getReaderForSample(e){const t=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1,r=this.fileDirectory.BitsPerSample[e];switch(t){case 1:if(r<=8)return DataView.prototype.getUint8;if(r<=16)return DataView.prototype.getUint16;if(r<=32)return DataView.prototype.getUint32;break;case 2:if(r<=8)return DataView.prototype.getInt8;if(r<=16)return DataView.prototype.getInt16;if(r<=32)return DataView.prototype.getInt32;break;case 3:switch(r){case 16:return function(i,a){return Z0e(this,i,a)};case 32:return DataView.prototype.getFloat32;case 64:return DataView.prototype.getFloat64}break}throw Error("Unsupported data format/bitsPerSample")}getSampleFormat(e=0){return this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1}getBitsPerSample(e=0){return this.fileDirectory.BitsPerSample[e]}getArrayForSample(e,t){const r=this.getSampleFormat(e),i=this.getBitsPerSample(e);return Pk(r,i,t)}getTileOrStrip(e,t,r,i,a){return Ve(this,null,function*(){const s=Math.ceil(this.getWidth()/this.getTileWidth()),l=Math.ceil(this.getHeight()/this.getTileHeight());let c;const{tiles:u}=this;this.planarConfiguration===1?c=t*s+e:this.planarConfiguration===2&&(c=r*s*l+t*s+e);let d,f;this.isTiled?(d=this.fileDirectory.TileOffsets[c],f=this.fileDirectory.TileByteCounts[c]):(d=this.fileDirectory.StripOffsets[c],f=this.fileDirectory.StripByteCounts[c]);const h=(yield this.source.fetch([{offset:d,length:f}],a))[0];let p;return u===null||!u[c]?(p=Ve(this,null,function*(){let m=yield i.decode(this.fileDirectory,h);const v=this.getSampleFormat(),g=this.getBitsPerSample();return abt(v,g)&&(m=obt(m,v,this.planarConfiguration,this.getSamplesPerPixel(),g,this.getTileWidth(),this.getBlockHeight(t))),m}),u!==null&&(u[c]=p)):p=u[c],{x:e,y:t,sample:r,data:yield p}})}_readRaster(e,t,r,i,a,s,l,c,u){return Ve(this,null,function*(){const d=this.getTileWidth(),f=this.getTileHeight(),h=this.getWidth(),p=this.getHeight(),m=Math.max(Math.floor(e[0]/d),0),v=Math.min(Math.ceil(e[2]/d),Math.ceil(h/d)),g=Math.max(Math.floor(e[1]/f),0),y=Math.min(Math.ceil(e[3]/f),Math.ceil(p/f)),b=e[2]-e[0];let x=this.getBytesPerPixel();const _=[],w=[];for(let E=0;E<t.length;++E)this.planarConfiguration===1?_.push(ibt(this.fileDirectory.BitsPerSample,0,t[E])/8):_.push(0),w.push(this.getReaderForSample(t[E]));const S=[],{littleEndian:C}=this;for(let E=g;E<y;++E)for(let T=m;T<v;++T){let A;this.planarConfiguration===1&&(A=this.getTileOrStrip(T,E,0,a,u));for(let M=0;M<t.length;++M){const D=M,k=t[M];this.planarConfiguration===2&&(x=this.getSampleByteSize(k),A=this.getTileOrStrip(T,E,k,a,u));const P=A.then(I=>{const N=I.data,R=new DataView(N),V=this.getBlockHeight(I.y),B=I.y*f,F=I.x*d,G=B+V,U=(I.x+1)*d,z=w[D],j=Math.min(V,V-(G-e[3]),p-B),W=Math.min(d,d-(U-e[2]),h-F);for(let Y=Math.max(0,e[1]-B);Y<j;++Y)for(let re=Math.max(0,e[0]-F);re<W;++re){const Q=(Y*d+re)*x,$=z.call(R,Q+_[D],C);let ee;i?(ee=(Y+B-e[1])*b*t.length+(re+F-e[0])*t.length+D,r[ee]=$):(ee=(Y+B-e[1])*b+re+F-e[0],r[D][ee]=$)}});S.push(P)}}if(yield Promise.all(S),s&&e[2]-e[0]!==s||l&&e[3]-e[1]!==l){let E;return i?E=rbt(r,e[2]-e[0],e[3]-e[1],s,l,t.length,c):E=ebt(r,e[2]-e[0],e[3]-e[1],s,l,c),E.width=s,E.height=l,E}return r.width=s||e[2]-e[0],r.height=l||e[3]-e[1],r})}readRasters(){return Ve(this,arguments,function*({window:e,samples:t=[],interleave:r,pool:i=null,width:a,height:s,resampleMethod:l,fillValue:c,signal:u}={}){const d=e||[0,0,this.getWidth(),this.getHeight()];if(d[0]>d[2]||d[1]>d[3])throw new Error("Invalid subsets");const f=d[2]-d[0],h=d[3]-d[1],p=f*h,m=this.getSamplesPerPixel();if(!t||!t.length)for(let b=0;b<m;++b)t.push(b);else for(let b=0;b<t.length;++b)if(t[b]>=m)return Promise.reject(new RangeError(`Invalid sample index '${t[b]}'.`));let v;if(r){const b=this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,x=Math.max.apply(null,this.fileDirectory.BitsPerSample);v=Pk(b,x,p*t.length),c&&v.fill(c)}else{v=[];for(let b=0;b<t.length;++b){const x=this.getArrayForSample(t[b],p);Array.isArray(c)&&b<c.length?x.fill(c[b]):c&&!Array.isArray(c)&&x.fill(c),v.push(x)}}const g=i||(yield Jyt(this.fileDirectory));return yield this._readRaster(d,t,v,r,g,a,s,l,u)})}readRGB(){return Ve(this,arguments,function*({window:e,interleave:t=!0,pool:r=null,width:i,height:a,resampleMethod:s,enableAlpha:l=!1,signal:c}={}){const u=e||[0,0,this.getWidth(),this.getHeight()];if(u[0]>u[2]||u[1]>u[3])throw new Error("Invalid subsets");const d=this.fileDirectory.PhotometricInterpretation;if(d===cc.RGB){let y=[0,1,2];if(this.fileDirectory.ExtraSamples!==Byt.Unspecified&&l){y=[];for(let b=0;b<this.fileDirectory.BitsPerSample.length;b+=1)y.push(b)}return this.readRasters({window:e,interleave:t,samples:y,pool:r,width:i,height:a,resampleMethod:s,signal:c})}let f;switch(d){case cc.WhiteIsZero:case cc.BlackIsZero:case cc.Palette:f=[0];break;case cc.CMYK:f=[0,1,2,3];break;case cc.YCbCr:case cc.CIELab:f=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const h={window:u,interleave:!0,samples:f,pool:r,width:i,height:a,resampleMethod:s,signal:c},{fileDirectory:p}=this,m=yield this.readRasters(h),v=fi(2,this.fileDirectory.BitsPerSample[0]);let g;switch(d){case cc.WhiteIsZero:g=Hyt(m,v);break;case cc.BlackIsZero:g=jyt(m,v);break;case cc.Palette:g=Gyt(m,p.ColorMap);break;case cc.CMYK:g=Yyt(m);break;case cc.YCbCr:g=Wyt(m);break;case cc.CIELab:g=Kyt(m);break;default:throw new Error("Unsupported photometric interpretation.")}if(!t){const y=new Uint8Array(g.length/3),b=new Uint8Array(g.length/3),x=new Uint8Array(g.length/3);for(let _=0,w=0;_<g.length;_+=3,++w)y[w]=g[_],b[w]=g[_+1],x[w]=g[_+2];g=[y,b,x]}return g.width=m.width,g.height=m.height,g})}getTiePoints(){if(!this.fileDirectory.ModelTiepoint)return[];const e=[];for(let t=0;t<this.fileDirectory.ModelTiepoint.length;t+=6)e.push({i:this.fileDirectory.ModelTiepoint[t],j:this.fileDirectory.ModelTiepoint[t+1],k:this.fileDirectory.ModelTiepoint[t+2],x:this.fileDirectory.ModelTiepoint[t+3],y:this.fileDirectory.ModelTiepoint[t+4],z:this.fileDirectory.ModelTiepoint[t+5]});return e}getGDALMetadata(e=null){const t={};if(!this.fileDirectory.GDAL_METADATA)return null;const r=this.fileDirectory.GDAL_METADATA;let i=Ryt(r,"Item");e===null?i=i.filter(a=>rL(a,"sample")===void 0):i=i.filter(a=>Number(rL(a,"sample"))===e);for(let a=0;a<i.length;++a){const s=i[a];t[rL(s,"name")]=s.inner}return t}getGDALNoData(){if(!this.fileDirectory.GDAL_NODATA)return null;const e=this.fileDirectory.GDAL_NODATA;return Number(e.substring(0,e.length-1))}getOrigin(){const e=this.fileDirectory.ModelTiepoint,t=this.fileDirectory.ModelTransformation;if(e&&e.length===6)return[e[3],e[4],e[5]];if(t)return[t[3],t[7],t[11]];throw new Error("The image does not have an affine transformation.")}getResolution(e=null){const t=this.fileDirectory.ModelPixelScale,r=this.fileDirectory.ModelTransformation;if(t)return[t[0],-t[1],t[2]];if(r)return r[1]===0&&r[4]===0?[r[0],-r[5],r[10]]:[Math.sqrt(r[0]*r[0]+r[4]*r[4]),-Math.sqrt(r[1]*r[1]+r[5]*r[5]),r[10]];if(e){const[i,a,s]=e.getResolution();return[i*e.getWidth()/this.getWidth(),a*e.getHeight()/this.getHeight(),s*e.getWidth()/this.getWidth()]}throw new Error("The image does not have an affine transformation.")}pixelIsArea(){return this.geoKeys.GTRasterTypeGeoKey===1}getBoundingBox(e=!1){const t=this.getHeight(),r=this.getWidth();if(this.fileDirectory.ModelTransformation&&!e){const[i,a,s,l,c,u,d,f]=this.fileDirectory.ModelTransformation,p=[[0,0],[0,t],[r,0],[r,t]].map(([g,y])=>[l+i*g+a*y,f+c*g+u*y]),m=p.map(g=>g[0]),v=p.map(g=>g[1]);return[Math.min(...m),Math.min(...v),Math.max(...m),Math.max(...v)]}else{const i=this.getOrigin(),a=this.getResolution(),s=i[0],l=i[1],c=s+a[0]*r,u=l+a[1]*t;return[Math.min(s,c),Math.min(l,u),Math.max(s,c),Math.max(l,u)]}}}class lbt{constructor(e){this._dataView=new DataView(e)}get buffer(){return this._dataView.buffer}getUint64(e,t){const r=this.getUint32(e,t),i=this.getUint32(e+4,t);let a;if(t){if(a=r+fi(2,32)*i,!Number.isSafeInteger(a))throw new Error(`${a} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return a}if(a=fi(2,32)*r+i,!Number.isSafeInteger(a))throw new Error(`${a} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return a}getInt64(e,t){let r=0;const i=(this._dataView.getUint8(e+(t?7:0))&128)>0;let a=!0;for(let s=0;s<8;s++){let l=this._dataView.getUint8(e+(t?s:7-s));i&&(a?l!==0&&(l=~(l-1)&255,a=!1):l=~l&255),r+=l*fi(256,s)}return i&&(r=-r),r}getUint8(e,t){return this._dataView.getUint8(e,t)}getInt8(e,t){return this._dataView.getInt8(e,t)}getUint16(e,t){return this._dataView.getUint16(e,t)}getInt16(e,t){return this._dataView.getInt16(e,t)}getUint32(e,t){return this._dataView.getUint32(e,t)}getInt32(e,t){return this._dataView.getInt32(e,t)}getFloat16(e,t){return Z0e(this._dataView,e,t)}getFloat32(e,t){return this._dataView.getFloat32(e,t)}getFloat64(e,t){return this._dataView.getFloat64(e,t)}}class cbt{constructor(e,t,r,i){this._dataView=new DataView(e),this._sliceOffset=t,this._littleEndian=r,this._bigTiff=i}get sliceOffset(){return this._sliceOffset}get sliceTop(){return this._sliceOffset+this.buffer.byteLength}get littleEndian(){return this._littleEndian}get bigTiff(){return this._bigTiff}get buffer(){return this._dataView.buffer}covers(e,t){return this.sliceOffset<=e&&this.sliceTop>=e+t}readUint8(e){return this._dataView.getUint8(e-this._sliceOffset,this._littleEndian)}readInt8(e){return this._dataView.getInt8(e-this._sliceOffset,this._littleEndian)}readUint16(e){return this._dataView.getUint16(e-this._sliceOffset,this._littleEndian)}readInt16(e){return this._dataView.getInt16(e-this._sliceOffset,this._littleEndian)}readUint32(e){return this._dataView.getUint32(e-this._sliceOffset,this._littleEndian)}readInt32(e){return this._dataView.getInt32(e-this._sliceOffset,this._littleEndian)}readFloat32(e){return this._dataView.getFloat32(e-this._sliceOffset,this._littleEndian)}readFloat64(e){return this._dataView.getFloat64(e-this._sliceOffset,this._littleEndian)}readUint64(e){const t=this.readUint32(e),r=this.readUint32(e+4);let i;if(this._littleEndian){if(i=t+fi(2,32)*r,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}if(i=fi(2,32)*t+r,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}readInt64(e){let t=0;const r=(this._dataView.getUint8(e+(this._littleEndian?7:0))&128)>0;let i=!0;for(let a=0;a<8;a++){let s=this._dataView.getUint8(e+(this._littleEndian?a:7-a));r&&(i?s!==0&&(s=~(s-1)&255,i=!1):s=~s&255),t+=s*fi(256,a)}return r&&(t=-t),t}readOffset(e){return this._bigTiff?this.readUint64(e):this.readUint32(e)}}class ubt{fetch(e,t=void 0){return Ve(this,null,function*(){return Promise.all(e.map(r=>this.fetchSlice(r,t)))})}fetchSlice(e){return Ve(this,null,function*(){throw new Error(`fetching of slice ${e} not possible, not implemented`)})}get fileSize(){return null}close(){return Ve(this,null,function*(){})}}class NF extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,NF),this.name="AbortError"}}class dbt extends ubt{constructor(e){super(),this.arrayBuffer=e}fetchSlice(e,t){if(t&&t.aborted)throw new NF("Request aborted");return this.arrayBuffer.slice(e.offset,e.offset+e.length)}}function fbt(n){return new dbt(n)}function kk(n){switch(n){case Qr.BYTE:case Qr.ASCII:case Qr.SBYTE:case Qr.UNDEFINED:return 1;case Qr.SHORT:case Qr.SSHORT:return 2;case Qr.LONG:case Qr.SLONG:case Qr.FLOAT:case Qr.IFD:return 4;case Qr.RATIONAL:case Qr.SRATIONAL:case Qr.DOUBLE:case Qr.LONG8:case Qr.SLONG8:case Qr.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${n}`)}}function hbt(n){const e=n.GeoKeyDirectory;if(!e)return null;const t={};for(let r=4;r<=e[3]*4;r+=4){const i=Uyt[e[r]],a=e[r+1]?N9[e[r+1]]:null,s=e[r+2],l=e[r+3];let c=null;if(!a)c=l;else{if(c=n[a],typeof c=="undefined"||c===null)throw new Error(`Could not get value of geoKey '${i}'.`);typeof c=="string"?c=c.substring(l,l+s-1):c.subarray&&(c=c.subarray(l,l+s),s===1&&(c=c[0]))}t[i]=c}return t}function Mm(n,e,t,r){let i=null,a=null;const s=kk(e);switch(e){case Qr.BYTE:case Qr.ASCII:case Qr.UNDEFINED:i=new Uint8Array(t),a=n.readUint8;break;case Qr.SBYTE:i=new Int8Array(t),a=n.readInt8;break;case Qr.SHORT:i=new Uint16Array(t),a=n.readUint16;break;case Qr.SSHORT:i=new Int16Array(t),a=n.readInt16;break;case Qr.LONG:case Qr.IFD:i=new Uint32Array(t),a=n.readUint32;break;case Qr.SLONG:i=new Int32Array(t),a=n.readInt32;break;case Qr.LONG8:case Qr.IFD8:i=new Array(t),a=n.readUint64;break;case Qr.SLONG8:i=new Array(t),a=n.readInt64;break;case Qr.RATIONAL:i=new Uint32Array(t*2),a=n.readUint32;break;case Qr.SRATIONAL:i=new Int32Array(t*2),a=n.readInt32;break;case Qr.FLOAT:i=new Float32Array(t),a=n.readFloat32;break;case Qr.DOUBLE:i=new Float64Array(t),a=n.readFloat64;break;default:throw new RangeError(`Invalid field type: ${e}`)}if(e===Qr.RATIONAL||e===Qr.SRATIONAL)for(let l=0;l<t;l+=2)i[l]=a.call(n,r+l*s),i[l+1]=a.call(n,r+(l*s+4));else for(let l=0;l<t;++l)i[l]=a.call(n,r+l*s);return e===Qr.ASCII?new TextDecoder("utf-8").decode(i):i}class pbt{constructor(e,t,r){this.fileDirectory=e,this.geoKeyDirectory=t,this.nextIFDByteOffset=r}}class Ib extends Error{constructor(e){super(`No image at index ${e}`),this.index=e}}class mbt{readRasters(){return Ve(this,arguments,function*(e={}){const{window:t,width:r,height:i}=e;let{resX:a,resY:s,bbox:l}=e;const c=yield this.getImage();let u=c;const d=yield this.getImageCount(),f=c.getBoundingBox();if(t&&l)throw new Error('Both "bbox" and "window" passed.');if(r||i){if(t){const[m,v]=c.getOrigin(),[g,y]=c.getResolution();l=[m+t[0]*g,v+t[1]*y,m+t[2]*g,v+t[3]*y]}const p=l||f;if(r){if(a)throw new Error("Both width and resX passed");a=(p[2]-p[0])/r}if(i){if(s)throw new Error("Both width and resY passed");s=(p[3]-p[1])/i}}if(a||s){const p=[];for(let m=0;m<d;++m){const v=yield this.getImage(m),{SubfileType:g,NewSubfileType:y}=v.fileDirectory;(m===0||g===2||y&1)&&p.push(v)}p.sort((m,v)=>m.getWidth()-v.getWidth());for(let m=0;m<p.length;++m){const v=p[m],g=(f[2]-f[0])/v.getWidth(),y=(f[3]-f[1])/v.getHeight();if(u=v,a&&a>g||s&&s>y)break}}let h=t;if(l){const[p,m]=c.getOrigin(),[v,g]=u.getResolution(c);h=[Math.round((l[0]-p)/v),Math.round((l[1]-m)/g),Math.round((l[2]-p)/v),Math.round((l[3]-m)/g)],h=[Math.min(h[0],h[2]),Math.min(h[1],h[3]),Math.max(h[0],h[2]),Math.max(h[1],h[3])]}return u.readRasters(tt(Ne({},e),{window:h}))})}}class OF extends mbt{constructor(e,t,r,i,a={}){super(),this.source=e,this.littleEndian=t,this.bigTiff=r,this.firstIFDOffset=i,this.cache=a.cache||!1,this.ifdRequests=[],this.ghostValues=null}getSlice(e,t){return Ve(this,null,function*(){const r=this.bigTiff?4048:1024;return new cbt((yield this.source.fetch([{offset:e,length:typeof t!="undefined"?t:r}]))[0],e,this.littleEndian,this.bigTiff)})}parseFileDirectoryAt(e){return Ve(this,null,function*(){const t=this.bigTiff?20:12,r=this.bigTiff?8:2;let i=yield this.getSlice(e);const a=this.bigTiff?i.readUint64(e):i.readUint16(e),s=a*t+(this.bigTiff?16:6);i.covers(e,s)||(i=yield this.getSlice(e,s));const l={};let c=e+(this.bigTiff?8:2);for(let f=0;f<a;c+=t,++f){const h=i.readUint16(c),p=i.readUint16(c+2),m=this.bigTiff?i.readUint64(c+4):i.readUint32(c+4);let v,g;const y=kk(p),b=c+(this.bigTiff?12:8);if(y*m<=(this.bigTiff?8:4))v=Mm(i,p,m,b);else{const x=i.readOffset(b),_=kk(p)*m;if(i.covers(x,_))v=Mm(i,p,m,x);else{const w=yield this.getSlice(x,_);v=Mm(w,p,m,x)}}m===1&&Vyt.indexOf(h)===-1&&!(p===Qr.RATIONAL||p===Qr.SRATIONAL)?g=v[0]:g=v,l[N9[h]]=g}const u=hbt(l),d=i.readOffset(e+r+t*a);return new pbt(l,u,d)})}requestIFD(e){return Ve(this,null,function*(){if(this.ifdRequests[e])return this.ifdRequests[e];if(e===0)return this.ifdRequests[e]=this.parseFileDirectoryAt(this.firstIFDOffset),this.ifdRequests[e];if(!this.ifdRequests[e-1])try{this.ifdRequests[e-1]=this.requestIFD(e-1)}catch(t){throw t instanceof Ib?new Ib(e):t}return this.ifdRequests[e]=Ve(this,null,function*(){const t=yield this.ifdRequests[e-1];if(t.nextIFDByteOffset===0)throw new Ib(e);return this.parseFileDirectoryAt(t.nextIFDByteOffset)}),this.ifdRequests[e]})}getImage(e=0){return Ve(this,null,function*(){const t=yield this.requestIFD(e);return new sbt(t.fileDirectory,t.geoKeyDirectory,this.dataView,this.littleEndian,this.cache,this.source)})}getImageCount(){return Ve(this,null,function*(){let e=0,t=!0;for(;t;)try{yield this.requestIFD(e),++e}catch(r){if(r instanceof Ib)t=!1;else throw r}return e})}getGhostValues(){return Ve(this,null,function*(){const e=this.bigTiff?16:8;if(this.ghostValues)return this.ghostValues;const t="GDAL_STRUCTURAL_METADATA_SIZE=",r=t.length+100;let i=yield this.getSlice(e,r);if(t===Mm(i,Qr.ASCII,t.length,e)){const s=Mm(i,Qr.ASCII,r,e).split(`
3988
3988
  `)[0],l=Number(s.split("=")[1].split(" ")[0])+s.length;l>r&&(i=yield this.getSlice(e,l));const c=Mm(i,Qr.ASCII,l,e);this.ghostValues={},c.split(`
3989
3989
  `).filter(u=>u.length>0).map(u=>u.split("=")).forEach(([u,d])=>{this.ghostValues[u]=d})}return this.ghostValues})}static fromSource(e,t,r){return Ve(this,null,function*(){const i=(yield e.fetch([{offset:0,length:1024}],r))[0],a=new lbt(i),s=a.getUint16(0,0);let l;if(s===18761)l=!0;else if(s===19789)l=!1;else throw new TypeError("Invalid byte order value.");const c=a.getUint16(2,l);let u;if(c===42)u=!1;else if(c===43){if(u=!0,a.getUint16(4,l)!==8)throw new Error("Unsupported offset byte-size.")}else throw new TypeError("Invalid magic number.");const d=u?a.getUint64(8,l):a.getUint32(4,l);return new OF(e,l,u,d,t)})}close(){return typeof this.source.close=="function"?this.source.close():!1}}function vbt(n,e){return Ve(this,null,function*(){return OF.fromSource(fbt(n),e)})}class gbt{constructor(e){this.scene=null,this.camera=null,this.renderer=null,this.controls=null,this.animationId=null,this.container=null,this.resizeHandler=null,this.dblClickHandler=null,this.animate=()=>{this.animationId=requestAnimationFrame(this.animate),this.controls&&this.controls.update(),this.renderer&&this.scene&&this.camera&&this.renderer.render(this.scene,this.camera)},this.container=e,this.init()}init(){if(!this.container)return;this.dispose();const e=this.container.clientWidth,t=this.container.clientHeight;this.scene=new B6,this.scene.background=new sr(16777215),this.camera=new ns(75,e/t,.1,1e4),this.camera.position.z=5,this.renderer=new V6({antialias:!0,alpha:!0}),this.renderer.setSize(e,t),this.renderer.setPixelRatio(window.devicePixelRatio),this.container.appendChild(this.renderer.domElement),this.controls=new JC(this.camera,this.renderer.domElement),this.controls.enableDamping=!0,this.controls.dampingFactor=.08,this.controls.screenSpacePanning=!0,this.controls.enablePan=!0,this.controls.minDistance=1,this.controls.maxDistance=5e3,this.controls.target.set(0,0,0),this.controls.update(),this.dblClickHandler=a=>{this.container&&this.container.contains(a.target)&&this.resetView()},this.container.addEventListener("dblclick",this.dblClickHandler);const r=new og(16777215,.6);this.scene.add(r);const i=new qf(16777215,.8);i.position.set(5,10,5),this.scene.add(i),this.resizeHandler=()=>this.onWindowResize(),window.addEventListener("resize",this.resizeHandler),this.animate()}onWindowResize(){if(!this.container||!this.camera||!this.renderer)return;const e=this.container.clientWidth,t=this.container.clientHeight;this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this.renderer.setSize(e,t)}resetView(){!this.camera||!this.controls||(this.camera.position.set(0,0,5),this.controls.target.set(0,0,0),this.camera.lookAt(0,0,0),this.controls.update())}fitCameraToObject(e){if(!this.camera||!this.controls)return;const t=new Wi().setFromObject(e),r=t.getSize(new it),i=t.getCenter(new it),a=Math.max(r.x,r.y,r.z)||1,s=this.camera.fov*(Math.PI/180),l=a/2/Math.tan(s/2)*1.6;this.camera.position.set(i.x,i.y,i.z+l),this.camera.near=Math.max(.1,l/1e3),this.camera.far=Math.max(1e4,l*10),this.camera.updateProjectionMatrix(),this.controls.target.copy(i),this.controls.update()}loadGeologyModel(e){return Ve(this,null,function*(){if(!this.scene||!e)return;e.toLowerCase().endsWith(".glb")||e.toLowerCase().endsWith(".gltf")?new k0e().load(e,i=>{this.scene.add(i.scene);const s=new Wi().setFromObject(i.scene).getSize(new it),c=4/(Math.max(s.x,s.y,s.z)||1);i.scene.scale.multiplyScalar(c),this.fitCameraToObject(i.scene)},void 0,i=>{console.error("Failed to load GLTF model:",i)}):new iyt().load(e,i=>{this.scene.add(i);const s=new Wi().setFromObject(i).getSize(new it),c=4/(Math.max(s.x,s.y,s.z)||1);i.scale.multiplyScalar(c),this.fitCameraToObject(i)},void 0,i=>{console.error("Failed to load OBJ model:",i)})})}loadDTMTerrain(e){return Ve(this,null,function*(){if(!(!this.scene||!e))try{const r=yield(yield fetch(e)).arrayBuffer(),a=yield(yield vbt(r)).getImage(),s=yield a.readRasters(),l=a.getWidth(),c=a.getHeight(),u=s[0],d=Math.max(1,Math.floor(Math.max(l,c)/100)),f=new Lr,h=[],p=[];let m=0;for(let y=0;y<u.length;y+=d)m=Math.max(m,u[y]);for(let y=0;y<c;y+=d)for(let b=0;b<l;b+=d){const x=y*l+b,_=(u[x]||0)/m*3-1.5;h.push(b/l*4-2,_,y/c*4-2);const w=u[x]/m,S=new sr().setHSL(.6-w*.6,1,.5);p.push(S.r,S.g,S.b)}f.setAttribute("position",new Or(new Float32Array(h),3)),f.setAttribute("color",new Or(new Float32Array(p),3)),f.computeVertexNormals();const v=new s1e({vertexColors:!0,side:zs}),g=new wi(f,v);this.scene.add(g),this.fitCameraToObject(g)}catch(t){console.error("Failed to load DTM TIFF:",t)}})}loadUAVImage(e){return Ve(this,null,function*(){if(!this.scene||!e)return;new d1e().load(e,r=>{const i=r.image.width/r.image.height,a=new Yg(4*i,4),s=new $c({map:r}),l=new wi(a,s);this.scene.add(l),this.fitCameraToObject(l)},void 0,r=>{console.error("Failed to load UAV image:",r)})})}clearScene(){if(!this.scene)return;for(;this.scene.children.length>0;){const r=this.scene.children[0];r instanceof wi&&(r.geometry.dispose(),Array.isArray(r.material)?r.material.forEach(i=>i.dispose()):r.material.dispose()),this.scene.remove(r)}const e=new og(16777215,.6);this.scene.add(e);const t=new qf(16777215,.8);t.position.set(5,10,5),this.scene.add(t)}dispose(){this.animationId&&cancelAnimationFrame(this.animationId),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=null),this.container&&this.dblClickHandler&&(this.container.removeEventListener("dblclick",this.dblClickHandler),this.dblClickHandler=null),this.controls&&(this.controls.dispose(),this.controls=null),this.renderer&&this.container&&this.renderer.domElement.parentNode===this.container&&this.container.removeChild(this.renderer.domElement),this.renderer&&this.renderer.dispose(),this.scene=null,this.camera=null,this.renderer=null,this.animationId=null}}const ybt={class:"filter-tabs"},bbt={class:"toolbar-right"},xbt={key:0,class:"pick-hint-bar"},_bt={class:"map-model-overlay"},Sbt={key:0,class:"map-mode-edit-tip"},wbt=["viewBox"],Cbt=["d","stroke"],Ebt=["x1","y1","x2","y2"],Abt=["onClick","onMouseenter"],Tbt={class:"point-bubble"},Mbt={class:"point-id"},Dbt=["innerHTML"],Lbt={class:"drawer-cards"},Nbt=["onClick"],Obt={class:"card-icon"},Pbt={class:"card-label"},kbt={class:"profile-dialog-header"},Ibt={class:"profile-header-btns"},Rbt={DEFAULT_ICON:Ei,ACTIVE_ICON:Ai,NAME_CN:"GNSS地图监测视图",NAME_EN:"GNSS Map Monitor View",ORDER:10,PLATFORM:["pc","screen"]},Vbt={bgColor:{value:"#0b1a31",type:"color",label:"setting.bgColor"},toolbarBg:{value:"#ffffff",type:"color",label:"工具栏背景色"},toolbarFontSize:{value:12,type:"number",label:"工具栏字体大小",min:10,max:20},geologyMapUrl:{value:"",type:"string",label:"地质模型地图URL"},dtmMapUrl:{value:"",type:"string",label:"DTM面地图URL"},uavMapUrl:{value:"",type:"string",label:"无人机地图URL"},satelliteMapUrl:{value:"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",type:"string",label:"Esri卫星影像URL"},mapCenterLon:{value:119.40331,type:"number",label:"地图中心经度",min:-180,max:180},mapCenterLat:{value:45.369465,type:"number",label:"地图中心纬度",min:-90,max:90},mapZoomLevel:{value:10,type:"number",label:"地图缩放级别",min:1,max:18},mapElevation:{value:1e3,type:"number",label:"参考高程(m)"},pointCount:{value:80,type:"number",label:"模拟监测点数量",min:20,max:200},linkChannel:{value:"gnss",type:"select",label:"联动频道",options:[{label:"GNSS监测",value:"gnss"},{label:"边坡监测",value:"slope"},{label:"自定义",value:"custom"}]},customChannel:{value:"",type:"string",label:"自定义频道名",showWhen:{linkChannel:"custom"}}},Bbt=[{name:"GNSS001",object_id:"",fvDeviceName:"",deviceType:"GNSS",x:1e3,y:400,elevation:"",region:"北帮",lineName:"北帮线",row1Label:"累计位移",row1FV:"",row1Unit:"mm",row2Label:"当前速度",row2FV:"",row2Unit:"mm/h",row3Label:"X/Y/H变化",row3FV:"",row3Unit:"mm",row4Label:"",row4FV:"",row4Unit:"",row5Label:"",row5FV:"",row5Unit:"",arrowXFV:"",arrowYFV:""},{name:"GNSS002",object_id:"",fvDeviceName:"",deviceType:"GNSS",x:1300,y:400,elevation:"",region:"北帮",lineName:"北帮线",row1Label:"累计位移",row1FV:"",row1Unit:"mm",row2Label:"当前速度",row2FV:"",row2Unit:"mm/h",row3Label:"X/Y/H变化",row3FV:"",row3Unit:"mm",row4Label:"",row4FV:"",row4Unit:"",row5Label:"",row5FV:"",row5Unit:"",arrowXFV:"",arrowYFV:""},{name:"GNSS003",object_id:"",fvDeviceName:"",deviceType:"GNSS",x:1600,y:400,elevation:"",region:"北帮",lineName:"北帮线",row1Label:"累计位移",row1FV:"",row1Unit:"mm",row2Label:"当前速度",row2FV:"",row2Unit:"mm/h",row3Label:"X/Y/H变化",row3FV:"",row3Unit:"mm",row4Label:"",row4FV:"",row4Unit:"",row5Label:"",row5FV:"",row5Unit:"",arrowXFV:"",arrowYFV:""},{name:"DEEP001",object_id:"",fvDeviceName:"",deviceType:"深部位移",x:500,y:1200,elevation:"",region:"西帮",lineName:"",row1Label:"深层位移",row1FV:"",row1Unit:"mm",row2Label:"测斜深度",row2FV:"",row2Unit:"m",row3Label:"",row3FV:"",row3Unit:"",row4Label:"",row4FV:"",row4Unit:"",row5Label:"",row5FV:"",row5Unit:"",arrowXFV:"",arrowYFV:""},{name:"RADAR001",object_id:"",fvDeviceName:"",deviceType:"雷达",x:2500,y:1e3,elevation:"",region:"东帮",lineName:"",row1Label:"形变量",row1FV:"",row1Unit:"mm",row2Label:"形变速度",row2FV:"",row2Unit:"mm/d",row3Label:"",row3FV:"",row3Unit:"",row4Label:"",row4FV:"",row4Unit:"",row5Label:"",row5FV:"",row5Unit:"",arrowXFV:"",arrowYFV:""},{name:"CRACK001",object_id:"",fvDeviceName:"",deviceType:"裂缝",x:1500,y:1250,elevation:"",region:"中央区",lineName:"",row1Label:"裂缝宽度",row1FV:"",row1Unit:"mm",row2Label:"开裂速度",row2FV:"",row2Unit:"mm/d",row3Label:"",row3FV:"",row3Unit:"",row4Label:"",row4FV:"",row4Unit:"",row5Label:"",row5FV:"",row5Unit:"",arrowXFV:"",arrowYFV:""},{name:"FIRE001",object_id:"",fvDeviceName:"",deviceType:"煤自燃",x:1200,y:2100,elevation:"",region:"南帮",lineName:"",row1Label:"温度",row1FV:"",row1Unit:"℃",row2Label:"CO浓度",row2FV:"",row2Unit:"ppm",row3Label:"",row3FV:"",row3Unit:"",row4Label:"",row4FV:"",row4Unit:"",row5Label:"",row5FV:"",row5Unit:"",arrowXFV:"",arrowYFV:""},{name:"WATER001",object_id:"",fvDeviceName:"",deviceType:"降雨",x:1800,y:2100,elevation:"",region:"南帮",lineName:"",row1Label:"降雨量",row1FV:"",row1Unit:"mm",row2Label:"雨强",row2FV:"",row2Unit:"mm/h",row3Label:"",row3FV:"",row3Unit:"",row4Label:"",row4FV:"",row4Unit:"",row5Label:"",row5FV:"",row5Unit:"",arrowXFV:"",arrowYFV:""}],Fbt=["object_id","name","fvDeviceName","deviceType","x","y","elevation","region","lineName","row1Label","row1FV","row1Unit","row2Label","row2FV","row2Unit","row3Label","row3FV","row3Unit","row4Label","row4FV","row4Unit","row5Label","row5FV","row5Unit","arrowXFV","arrowYFV"],zbt=["mosaic"],Ubt={useAlias:!1,multiObject:!0,source:"mosaic"},Hbt=200,jbt={DEFAULT:Rbt,OPTIONS:Vbt,DATA:Bbt,PARAMS:Fbt,SOURCE:zbt,COMMON:Ubt,ITEMS:Hbt},Gbt=o.defineComponent(tt(Ne({},jbt),{__name:"gnssMapView",props:{conf:{type:Object,default:()=>({})},mode:{type:String,default:"edit"},uid:{type:String,default:""},theme:{type:String,default:"light"}},setup(n){const e=n,t=3e3,r=2500,i={GNSS:"GNSS",gnss:"GNSS",DEEP:"DEEP",deep:"DEEP",深部位移:"DEEP",RADAR:"RADAR",radar:"RADAR",雷达:"RADAR",SURFACE:"SURFACE",surface:"SURFACE",地表:"SURFACE",CRACK:"CRACK",crack:"CRACK",裂缝:"CRACK",FIRE:"FIRE",fire:"FIRE",煤自燃:"FIRE",WATER:"WATER",water:"WATER",降雨:"WATER",GROUND:"GROUND",ground:"GROUND",地下水:"GROUND",STRESS:"STRESS",stress:"STRESS",应力:"STRESS",VIB:"VIB",vib:"VIB",爆破震动:"VIB",SAT:"SAT",sat:"SAT",遥感卫星:"SAT"},a={GNSS:"📍",DEEP:"⚓",RADAR:"📡",SURFACE:"📐",CRACK:"🧱",FIRE:"🔥",WATER:"💧",GROUND:"🌍",STRESS:"📊",VIB:"💥",SAT:"🛸"},s=[{key:"GNSS",label:"GNSS监测",icon:"📍"},{key:"DEEP",label:"深部位移监测",icon:"⚓"},{key:"RADAR",label:"雷达监测",icon:"📡"},{key:"SURFACE",label:"地质写实",icon:"📐"},{key:"CRACK",label:"裂缝监测",icon:"🧱"},{key:"FIRE",label:"煤自燃监测",icon:"🔥"},{key:"WATER",label:"降雨监测",icon:"💧"},{key:"GROUND",label:"地下水监测",icon:"🌍"},{key:"STRESS",label:"应力监测",icon:"📊"},{key:"VIB",label:"振动监测",icon:"💥"},{key:"SAT",label:"遥感监测",icon:"🛸"}],l=["#F57676","#FFA500","#fadb14","#66B1FF","#71C446"],c=[{name:"北帮",xRange:[800,2200],yRange:[200,600]},{name:"南帮",xRange:[800,2200],yRange:[1900,2300]},{name:"西帮",xRange:[200,700],yRange:[800,1700]},{name:"东帮",xRange:[2300,2800],yRange:[800,1700]},{name:"中央区",xRange:[1100,1900],yRange:[1e3,1500]}],u=["#F57676","#FFA500","#66B1FF","#71C446","#9254de","#13c2c2"];class d extends Cn{extractStyles(){var _e,ze,Pe,Be,at,ft,Mt,Vt,xn,sn,Tt,ct,At,Yt,un,Mn,Xt,Bn,_t;const Ie=(_e=this.props.conf)==null?void 0:_e.options,xe=((ze=Ie==null?void 0:Ie.linkChannel)==null?void 0:ze.value)||"gnss",he=((Pe=Ie==null?void 0:Ie.customChannel)==null?void 0:Pe.value)||"";return{bgColor:((Be=Ie==null?void 0:Ie.bgColor)==null?void 0:Be.value)||"#0b1a31",toolbarBg:((at=Ie==null?void 0:Ie.toolbarBg)==null?void 0:at.value)||"#ffffff",toolbarFontSize:((ft=Ie==null?void 0:Ie.toolbarFontSize)==null?void 0:ft.value)||12,geologyMapUrl:((Mt=Ie==null?void 0:Ie.geologyMapUrl)==null?void 0:Mt.value)||"",dtmMapUrl:((Vt=Ie==null?void 0:Ie.dtmMapUrl)==null?void 0:Vt.value)||"",uavMapUrl:((xn=Ie==null?void 0:Ie.uavMapUrl)==null?void 0:xn.value)||"",satelliteMapUrl:((sn=Ie==null?void 0:Ie.satelliteMapUrl)==null?void 0:sn.value)||"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",mapCenterLon:(ct=(Tt=Ie==null?void 0:Ie.mapCenterLon)==null?void 0:Tt.value)!=null?ct:119.40331,mapCenterLat:(Yt=(At=Ie==null?void 0:Ie.mapCenterLat)==null?void 0:At.value)!=null?Yt:45.369465,mapZoomLevel:(Mn=(un=Ie==null?void 0:Ie.mapZoomLevel)==null?void 0:un.value)!=null?Mn:10,mapElevation:(Bn=(Xt=Ie==null?void 0:Ie.mapElevation)==null?void 0:Xt.value)!=null?Bn:1e3,pointCount:((_t=Ie==null?void 0:Ie.pointCount)==null?void 0:_t.value)||80,linkChannel:xe==="custom"&&he?he:xe}}onLinkEvent(Ie){pe(Ie)}setSocketData(Ie){if(!(Ie!=null&&Ie.data))return;const xe=Ie.object_id||"";if(!xe)return;const he=_.value.find(Be=>Be.objectId===xe);if(!he)return;const _e=Ie.data,ze=Be=>{const at=parseFloat(Be);return isNaN(at)?String(Be):at.toFixed(2)};let Pe=!1;if(he.fvXCoord&&_e[he.fvXCoord]!=null){const Be=parseFloat(_e[he.fvXCoord]);isNaN(Be)||(he.x=Be,Pe=!0)}if(he.fvYCoord&&_e[he.fvYCoord]!=null){const Be=parseFloat(_e[he.fvYCoord]);isNaN(Be)||(he.y=Be,Pe=!0)}if(Pe&&K(_.value),he.fvDeviceName&&_e[he.fvDeviceName]!=null&&(he.liveValues.deviceName=String(_e[he.fvDeviceName])),he.fvElevation&&_e[he.fvElevation]!=null&&(he.liveValues.elevation=ze(_e[he.fvElevation])),he.rows.forEach((Be,at)=>{if(!Be.fv)return;const Mt=Be.fv.split("|").map(Vt=>Vt.trim()).map(Vt=>_e[Vt]!=null?ze(_e[Vt]):null).filter(Boolean);Mt.length&&(he.liveValues[`row_${at}`]=Mt.join("/"))}),he.arrowXFV&&_e[he.arrowXFV]!=null&&(he.liveValues.arrowX=ze(_e[he.arrowXFV])),he.arrowYFV&&_e[he.arrowYFV]!=null&&(he.liveValues.arrowY=ze(_e[he.arrowYFV])),he.arrowXFV||he.arrowYFV){const Be=parseFloat(he.liveValues.arrowX||"0")||0,at=parseFloat(he.liveValues.arrowY||"0")||0;(Be!==0||at!==0)&&(he.liveValues.arrowAngle=String(Math.round(Math.atan2(at,Be)*180/Math.PI*10)/10))}}}const f=new d(e,"gnssMapView");f.setupLifecycle();const h=f.getStyle(),p=o.ref(null),m=o.ref(null),v=o.ref(null),g=o.ref(null),y=o.ref(!1),b=o.reactive(new Set(s.map(Fe=>Fe.key)));let x=null;const _=o.ref([]),w=o.ref([]),S=o.reactive({scale:.4,posX:0,posY:0,displayMode:"geology",selectedRegion:"全部",selectedLine:"全部",selectedPoints:["__ALL__"]});let C=null,E=null;const T=o.ref(!1),A=o.reactive({x:0,y:0}),M=o.reactive({visible:!1,x:0,y:0,content:""}),D=o.reactive({picking:!1,pickedPoints:[],dialogVisible:!1});let k=null;const P=o.ref(""),I={onWheel:Fe=>{Fe.preventDefault(),Z(Fe)},onMousedown:Fe=>me(Fe),onMousemove:Fe=>be(Fe),onMouseup:()=>ye(),onMouseleave:()=>ye()},N=o.computed(()=>({backgroundColor:h.value.bgColor})),R=o.computed(()=>({geology:h.value.geologyMapUrl,dtm:h.value.dtmMapUrl,uav:h.value.uavMapUrl,leaflet:h.value.satelliteMapUrl})[S.displayMode]||""),V=o.computed(()=>({transform:`translate(${S.posX}px, ${S.posY}px) scale(${S.scale})`,width:t+"px",height:r+"px",backgroundImage:R.value?`url(${R.value})`:"none"})),B=o.computed(()=>{const Fe=new Set;return _.value.forEach(Ie=>{Ie.region&&Fe.add(Ie.region)}),Array.from(Fe)}),F=o.computed(()=>w.value.map(Fe=>Fe.name)),G=o.computed(()=>_.value.filter(Fe=>{const Ie=S.selectedRegion==="全部"||Fe.region===S.selectedRegion,xe=S.selectedLine==="全部"||Fe.lineName===S.selectedLine;return Ie&&xe}).map(Fe=>({value:Fe.id,label:`${Fe.deviceId}${Fe.region?`(${Fe.region})`:""}`}))),U=o.computed(()=>{const Fe=S.selectedPoints||[];if(Fe.length===0||Fe.includes("__ALL__"))return"全部监测点";if(Fe.length===1){const Ie=G.value.find(xe=>xe.value===Fe[0]);return(Ie==null?void 0:Ie.label)||"已选1个监测点"}return`已选${Fe.length}个监测点`}),z=o.computed(()=>{const Fe=S.selectedPoints||[],Ie=Fe.length===0||Fe.includes("__ALL__");return _.value.filter(xe=>{const he=b.has(xe.type),_e=S.selectedRegion==="全部"||xe.region===S.selectedRegion,ze=S.selectedLine==="全部"||xe.lineName===S.selectedLine,Pe=Ie||Fe.includes(xe.id);return he&&_e&&ze&&Pe})}),j=Fe=>{if(!Array.isArray(Fe)){S.selectedPoints=["__ALL__"];return}const Ie=new Set(G.value.map(he=>he.value));let xe=Fe.filter(he=>he==="__ALL__"||Ie.has(he));if(xe.includes("__ALL__")&&xe.length>1&&(xe=xe.filter(he=>he!=="__ALL__")),xe.length===0){S.selectedPoints=["__ALL__"];return}S.selectedPoints=xe},W=o.computed(()=>b.has("GNSS")?w.value.filter(Fe=>S.selectedRegion!=="全部"&&Fe.region!==S.selectedRegion||S.selectedLine!=="全部"&&Fe.name!==S.selectedLine?!1:Fe.pointIds.filter(xe=>z.value.some(he=>he.id===xe)).length>=2):[]),Y=Fe=>{const Ie=Fe.isOnline?l[Fe.alarmIdx]||"#71C446":"#999";return{left:Fe.x+"px",top:Fe.y+"px",backgroundColor:Ie,color:Ie}},re=Fe=>D.pickedPoints.some(Ie=>Ie.id===Fe.id),Q=o.computed(()=>{var Fe;return((Fe=e.conf)==null?void 0:Fe.data)||[]}),$=()=>{const Fe=Q.value;Fe.length>0?X(Fe):ne()},ee={GNSS:[{label:"累计位移",unit:"mm"},{label:"当前速度",unit:"mm/h"},{label:"X/Y/H变化",unit:"mm"}],DEEP:[{label:"深层位移",unit:"mm"},{label:"测斜深度",unit:"m"}],RADAR:[{label:"形变量",unit:"mm"},{label:"形变速度",unit:"mm/d"}],SURFACE:[{label:"垂直位移",unit:"mm"},{label:"水平位移",unit:"mm"}],CRACK:[{label:"裂缝宽度",unit:"mm"},{label:"开列速度",unit:"mm/d"}],FIRE:[{label:"温度",unit:"℃"},{label:"CO浓度",unit:"ppm"}],WATER:[{label:"降雨量",unit:"mm"},{label:"雨强",unit:"mm/h"}],GROUND:[{label:"水位",unit:"m"},{label:"渗透压力",unit:"kPa"}],STRESS:[{label:"应力值",unit:"MPa"},{label:"变化量",unit:"MPa"}],VIB:[{label:"振动速度",unit:"cm/s"},{label:"振动频率",unit:"Hz"}],SAT:[{label:"地表形变",unit:"mm"},{label:"变化速率",unit:"mm/y"}]},X=Fe=>{const Ie=[];Fe.forEach((xe,he)=>{var Yt,un,Mn,Xt,Bn,_t,gt,jt,zn,Ge;const _e=xe.name||xe.deviceId||"",ze=xe.deviceType||xe.type||"GNSS",Pe=i[ze]||i[(Yt=ze.toUpperCase)==null?void 0:Yt.call(ze)]||"GNSS",Be=xe.x,at=xe.y,ft=Be!==""&&Be!=null&&!isNaN(Number(Be)),Mt=at!==""&&at!=null&&!isNaN(Number(at)),Vt=ft?Number(Be):-9999,xn=Mt?Number(at):-9999,sn=ft?"":String(Be||""),Tt=Mt?"":String(at||""),ct=ee[Pe]||[],At=[];for(let pt=0;pt<5;pt++){const vt=xe[`row${pt+1}FV`]||"",Pt=xe[`row${pt+1}Label`]||((un=ct[pt])==null?void 0:un.label)||"",Ee=(Xt=xe[`row${pt+1}Unit`])!=null?Xt:((Mn=ct[pt])==null?void 0:Mn.unit)||"";(vt||Pt)&&At.push({label:Pt,fv:vt,unit:Ee})}if(At.length===0){xe.fvDisplacement&&At.push({label:((Bn=ct[0])==null?void 0:Bn.label)||"累计位移",fv:xe.fvDisplacement,unit:((_t=ct[0])==null?void 0:_t.unit)||xe.unitDisplacement||"mm"}),xe.fvSpeed&&At.push({label:((gt=ct[1])==null?void 0:gt.label)||"当前速度",fv:xe.fvSpeed,unit:((jt=ct[1])==null?void 0:jt.unit)||xe.unitSpeed||"mm/h"});const pt=[xe.fvX,xe.fvY,xe.fvH].filter(Boolean);pt.length&&At.push({label:((zn=ct[2])==null?void 0:zn.label)||"X/Y/H变化",fv:pt.join("|"),unit:((Ge=ct[2])==null?void 0:Ge.unit)||xe.unitXYH||"mm"})}Ie.push({id:_e||`pt-${he}`,type:Pe,alarmIdx:typeof xe.alarmIdx=="number"?xe.alarmIdx:4,isOnline:xe.isOnline!==!1,deviceId:_e||`${Pe}${he}`,region:xe.region||"未分区",x:Vt,y:xn,isOnDetectionLine:!!xe.lineName,lineName:xe.lineName||"",objectId:xe.object_id||"",fvDeviceName:xe.fvDeviceName||"",fvXCoord:sn,fvYCoord:Tt,fvElevation:xe.elevation||xe.高程||"",rows:At,arrowXFV:xe.arrowXFV||"",arrowYFV:xe.arrowYFV||"",liveValues:{}})}),_.value=Ie,K(Ie)},ne=()=>{const Fe=h.value.pointCount||80,Ie=Object.keys(a),xe=[],he=[],_e=60,ze={};c.forEach(Pe=>ze[Pe.name]=0);for(let Pe=0;Pe<Fe;Pe++){let Be=Ie[Pe%Ie.length];Pe<7?Be="RADAR":Be==="RADAR"&&(Be="GNSS");const at=Pe*7%5,ft=Pe%8!==0,Mt=c[Pe%c.length];let Vt=!1,xn="";Be==="GNSS"&&ze[Mt.name]<3&&(Vt=!0,xn=`${Mt.name}线`,ze[Mt.name]++);let sn=0,Tt=0,ct=0;for(;ct<100;){if(Vt){const Yt=ze[Mt.name]-1;Mt.name==="北帮"||Mt.name==="南帮"?(Tt=(Mt.yRange[0]+Mt.yRange[1])/2,sn=Mt.xRange[0]+300+Yt*250):(sn=(Mt.xRange[0]+Mt.xRange[1])/2,Tt=Mt.yRange[0]+300+Yt*250)}else sn=Mt.xRange[0]+Math.random()*(Mt.xRange[1]-Mt.xRange[0]),Tt=Mt.yRange[0]+Math.random()*(Mt.yRange[1]-Mt.yRange[0]);if(!he.some(Yt=>Math.hypot(sn-Yt.x,Tt-Yt.y)<_e))break;ct++}he.push({x:sn,y:Tt}),xe.push({id:`pt-${Pe}`,type:Be,alarmIdx:at,isOnline:ft,deviceId:`${Be}${Pe}`,region:Mt.name,x:sn,y:Tt,isOnDetectionLine:Vt,lineName:xn,objectId:"",fvDeviceName:"",fvXCoord:"",fvYCoord:"",fvElevation:"",rows:[],arrowXFV:"",arrowYFV:"",liveValues:{}})}_.value=xe,K(xe)},K=Fe=>{const Ie=new Map;Fe.filter(_e=>_e.lineName&&_e.x!==-9999&&_e.y!==-9999).forEach(_e=>{Ie.has(_e.lineName)||Ie.set(_e.lineName,[]),Ie.get(_e.lineName).push(_e)});const xe=[];let he=0;Ie.forEach((_e,ze)=>{var at,ft,Mt,Vt;const Pe=Math.abs(((at=_e[_e.length-1])==null?void 0:at.x)-((ft=_e[0])==null?void 0:ft.x)),Be=Math.abs(((Mt=_e[_e.length-1])==null?void 0:Mt.y)-((Vt=_e[0])==null?void 0:Vt.y));if(_e.sort((xn,sn)=>Pe>=Be?xn.x-sn.x:xn.y-sn.y),_e.length>=2){const xn=`M ${_e[0].x+16} ${_e[0].y+16} `+_e.slice(1).map(Tt=>`L ${Tt.x+16} ${Tt.y+16}`).join(" "),sn=_e[0].region||"";xe.push({name:ze,region:sn,color:u[he%u.length],path:xn,pointIds:_e.map(Tt=>Tt.id)}),he++}}),w.value=xe},Z=Fe=>{const Ie=p.value;if(!Ie)return;const xe=Math.min(Math.max(.15,S.scale+Fe.deltaY*-.001),2.5),he=Ie.getBoundingClientRect(),_e=Fe.clientX-he.left,ze=Fe.clientY-he.top,Pe=xe/S.scale;S.posX=_e-(_e-S.posX)*Pe,S.posY=ze-(ze-S.posY)*Pe,S.scale=xe},me=Fe=>{Fe.button===0&&(T.value=!0,A.x=Fe.clientX-S.posX,A.y=Fe.clientY-S.posY)},be=Fe=>{T.value&&(S.posX=Fe.clientX-A.x,S.posY=Fe.clientY-A.y)},ye=()=>{T.value=!1},ie=()=>{const Fe=p.value;if(!Fe){S.scale=.4,S.posX=0,S.posY=0;return}const Ie=Fe.clientWidth,xe=Fe.clientHeight;if(Ie===0||xe===0){S.scale=.4,S.posX=0,S.posY=0;return}const he=Ie/t,_e=xe/r,ze=Math.min(he,_e)*.9;S.scale=Math.max(.15,Math.min(ze,1.5)),S.posX=(Ie-t*S.scale)/2,S.posY=(xe-r*S.scale)/2},ue=Fe=>{if(e.mode!=="edit"){if(D.picking){const Ie=D.pickedPoints.findIndex(xe=>xe.id===Fe.id);if(Ie>=0){D.pickedPoints.splice(Ie,1);return}D.pickedPoints.length<2&&D.pickedPoints.push(Fe),D.pickedPoints.length===2&&(D.picking=!1,D.dialogVisible=!0);return}Fe.isOnline&&(P.value=Fe.id,setTimeout(()=>{P.value===Fe.id&&(P.value="")},3e3),f.publish({objectId:Fe.objectId,deviceId:Fe.deviceId,point:Fe.deviceId,deviceType:Fe.type,region:Fe.region,alarmIdx:Fe.alarmIdx}))}},le=(Fe,Ie)=>{var ze,Pe;M.visible=!0,M.x=Fe.clientX-(((ze=p.value)==null?void 0:ze.getBoundingClientRect().left)||0)+15,M.y=Fe.clientY-(((Pe=p.value)==null?void 0:Pe.getBoundingClientRect().top)||0)+15;const xe=Ie.liveValues;let he="";Ie.rows.forEach((Be,at)=>{var Vt;if(!Be.fv)return;const ft=(Vt=xe[`row_${at}`])!=null?Vt:"--",Mt=Be.label||"测量值";he+=`<div>${Mt}: <b style="color:#fff">${ft}</b>${Be.unit?" "+Be.unit:""}</div>`}),he||(he='<div style="color:rgba(255,255,255,0.4);font-size:11px">暂未配置测量字段</div>');const _e=Ie.fvDeviceName&&xe.deviceName?xe.deviceName:Ie.deviceId;M.content=`
3990
3990
  <b style="color:#85C6F1;">[${Ie.region}] ${_e}</b>
@@ -8991,4 +8991,4 @@ function sendPendingMessages() {\r
8991
8991
  // 清空待处理列表\r
8992
8992
  pendingMessages = [];\r
8993
8993
  }\r
8994
- `,Aln="MixDashboards-DataChannel";function Tln(){const n=localStorage.getItem("dashboardUseLocalToken");return n==="1"||n==="true"}function Mln(n){const e=o.ref(!1),t=new fI;let r=null;if(n)try{{const l=new Blob([Eln],{type:"application/javascript"}),c=URL.createObjectURL(l);r=new SharedWorker(c,{type:"classic",name:Aln}),console.log("✅ [BasePreview] SharedWorker 已创建 (内联 Blob,适配 npm 单包)")}}catch(l){console.warn("⚠️ [BasePreview] SharedWorker 创建失败:",l)}const i=()=>Ve(null,null,function*(){const l=localStorage.getItem("globalApiUrl"),c=localStorage.getItem("globalAppId"),u=localStorage.getItem("globalAppSecret"),d=localStorage.getItem("globalApiToken");if((Number(localStorage.getItem("dashboardIsMixiot")||"1")||0)===1)return!!d;if(!l&&!c&&!u)return!0;if(!l)return yield Ue.ElMessageBox.alert("请先在全局设置中配置平台地址","配置错误",{confirmButtonText:"确定",type:"warning"}),!1;if(!Tln()&&(!c||!u))return yield Ue.ElMessageBox.alert("请先在全局设置中配置授权编号和授权密钥","配置错误",{confirmButtonText:"确定",type:"warning"}),!1;if(!d)return yield Ue.ElMessageBox.alert("Token 不存在,请检查网络连接或重新配置授权信息","Token 错误",{confirmButtonText:"确定",type:"error"}),!1;try{return(yield bf.getValidToken())?!0:(yield Ue.ElMessageBox.alert("Token 无效或已过期,请重新配置授权信息","Token 错误",{confirmButtonText:"确定",type:"error"}),!1)}catch(h){return console.error("[预览] Token 验证失败:",h),yield Ue.ElMessageBox.alert("Token 验证失败,请检查网络连接或重新配置授权信息","Token 错误",{confirmButtonText:"确定",type:"error"}),!1}}),a=()=>Ve(null,null,function*(){var p;const l=localStorage.getItem("globalApiUrl"),c=localStorage.getItem("globalAppId"),u=localStorage.getItem("globalAppSecret");(Number(localStorage.getItem("dashboardIsMixiot")||"1")||0)===1?e.value=!!(l&&localStorage.getItem("globalApiToken")):e.value=!!(l&&c&&u);let f="";if(e.value)try{f=yield bf.getValidToken()}catch(m){console.error("[WebSocket] 获取 ApiProxy Token 失败:",m),Ue.ElMessage.error("获取平台 Token 失败,实时数据可能无法正常显示");return}else f=((p=xi.getUser())==null?void 0:p.token)||"";const h=B5e();r.port.postMessage({type:"reconnect",url:h,token:f,sysMode:localStorage.getItem("sys_mode")||"",useApiProxy:e.value})}),s=()=>Ve(null,null,function*(){if(!n){console.log("[F12][BasePreview] initDataConnection skipped (enableWebSocket=false)");return}try{const{getAuthToken:l}=yield Promise.resolve().then(()=>Pnt);let c="";try{c=yield l()}catch(p){if((p instanceof Error?p.message:String(p)).includes("本地登录 token 不存在,请先登录")){console.warn("[F12][BasePreview] initDataConnection skipped: no local token",p);return}else throw p}const u=localStorage.getItem("globalApiUrl")||"",d=Number(localStorage.getItem("dashboardIsMixiot")||"1")||0;console.log("[F12][BasePreview] initDataConnection config",{isMixiot:d,globalApiUrl:u,hasToken:!!c});const f=!!c&&d!==1&&!u;if(d!==1&&!u&&!c){Ue.ElMessage.error("请先在全局设置中配置平台地址"),console.error("[F12][BasePreview] initDataConnection abort: globalApiUrl missing in non-local mode");return}let h="";if(d===1||f){let m=(u||`${location.protocol}//${location.host}`).replace(/^http/,"ws");m.endsWith("/")||(m+="/"),h=`${m}ws/api`}else if(u){let p=u.replace(/^http/,"ws");p.endsWith("/")||(p+="/"),h=`${p}apiproxy/ws/api`}r&&(r.port.postMessage({type:"init_connection",url:h,token:c}),console.log("[F12][BasePreview] data connection initialized",{wsUrl:h}))}catch(l){console.error("[F12][BasePreview] initDataConnection failed:",l),Ue.ElMessage.error("数据连接初始化失败")}});return r&&(t.init(r),r.port.onmessage=l=>{t.processWorkerMessage(l)}),{sharedWorker:r,session:t,useApiProxy:e,checkApiProxyConfig:i,initWebSocketConnection:a,initDataConnection:s}}const Dte={pc_pro:"ProContainer",mobile_pro:"AppContainer",pc_dashboard:"ProContainer",mobile_dashboard:"AppContainer",screen_dashboard:"ShowContainer"};function Dln(n,e,t,r,i={}){const a=i.themeRootRef,s=()=>{var S;if(a!=null&&a.value)return a.value;const _=m(),w=(S=Dte[_])!=null?S:Dte[Ip];return w?document.getElementById(w):null},l=o.reactive({margin:[10,10],height:40}),c=o.computed(()=>{const _=Number(l.height);return typeof _=="number"&&!Number.isNaN(_)&&_>0?_:40});let u=null;const d=(_,w=40)=>{const S=Number(_);return typeof S=="number"&&!Number.isNaN(S)&&S>0?S:w},f=_=>(Array.isArray(_==null?void 0:_.layers)?_.layers:[]).flatMap(S=>Array.isArray(S==null?void 0:S.components)?S.components:[]),h=(_,w)=>{if(w<80)return!1;const S=f(_).map(C=>Number(C==null?void 0:C.h)).filter(C=>Number.isFinite(C)&&C>0);return S.length?Math.max(...S)<=5:!1},p=(_,w)=>h(_,w)?Math.max(1,Math.round(w/5)):w,m=()=>{var _;return i9((_=e.value)==null?void 0:_.type)},v=()=>{const _=n.value;if(!_)return;const w=m();let S=_.col||20;S=Math.max(1,S);const C=l.margin[0];if(w===Ff){const E=p(_,Math.max(1,_.col||100));let T=Number(_.screenHeight)||1080;T=T-(E+1)*C,l.height=d(T/E,40);return}if(w===Ip){const E=Math.max(1,Number(_.screenWidth)||1920),T=p(_,S),A=E-(T+1)*C;l.height=d(Math.round(A/T),40);return}if(w===Y1){const T=359-(S+1)*C;l.height=d(Math.round(T/S),40);return}},g=()=>{var S;const _=t.value;_&&(_.style.width="",_.style.height="",_.style.transform="",_.style.transformOrigin="");const w=m();if(w!==Ff){const C=s();C&&(C.style.width="",C.style.height="",C.style.transform="",C.style.transformOrigin="")}if(w===Ff){const C=n.value,E=Number(C==null?void 0:C.screenWidth),T=Number(C==null?void 0:C.screenHeight);if(!E||!T){v();return}const A=s();if(!A){v();return}const M=A,D=typeof window!="undefined"&&new URLSearchParams(window.location.search).get("embed")==="1",k=A.parentElement,I=(D?M==null?void 0:M.parentElement:null)||k||r.value||((S=t.value)==null?void 0:S.parentElement)||document.documentElement,N=I.getBoundingClientRect(),R=Math.max(1,N.width||I.clientWidth),V=Math.max(1,N.height||I.clientHeight),B=V/T,F=R/E,G=Math.min(F,B),U=(R-E*G)/2,z=(V-T*G)/2;A.style.width=`${E}px`,A.style.height=`${T}px`,A.style.transformOrigin="top left",A.style.transform=`scale(${G}, ${G}) translate(${U/G}px, ${z/G}px)`,v();return}v()},y=()=>{g()};return{grid:l,safeRowHeight:c,getHeight:v,autoSize:g,refitLayout:y,initResizeObserver:()=>{var w,S;const _=r.value||((S=(w=t.value)==null?void 0:w.parentElement)==null?void 0:S.parentElement)||t.value;_&&(u=new ResizeObserver(()=>{y()}),u.observe(_))},cleanup:()=>{u&&(u.disconnect(),u=null)}}}function Lln(n,e){n&&o.nextTick(()=>{var a;let t=0;n.querySelectorAll(".vgl-layout").forEach(s=>{t=Math.max(t,s.offsetHeight)});const r=((a=n.parentElement)==null?void 0:a.clientHeight)||n.clientHeight,i=Math.max(r,t+8);i>0?n.style.minHeight=`${i}px`:n.style.minHeight=""})}function Lte(n){n&&n.querySelectorAll(".vgl-layout").forEach(e=>{e.style.width="100%";const t=e.__resizeCallback;typeof t=="function"&&t({target:e,contentRect:e.getBoundingClientRect()})})}const Nln=["data-theme"],Oln=["id","data-theme"],Pln=["src"],kln=["data-layer-id"],Iln={key:1,class:"preview-global-loading","aria-busy":"true","aria-live":"polite"},Rln=o.defineComponent({name:"MixBasePreview",__name:"index",props:{script:{},uid:{},mixiotDashboardUid:{},enableWebSocket:{type:Boolean,default:!0},followHostTheme:{type:Boolean,default:!1},hostProMenuTitle:{default:""},hostMenuToSheetRules:{},isProduct:{type:Boolean,default:!1},agent:{default:""},releaseEmbedAgentOnUnmount:{type:Boolean,default:!0},mobileEmbed:{type:Boolean,default:!1}},emits:["ready"],setup(n,{expose:e,emit:t}){var Pt;const r=n,i=t,a=o.computed(()=>!!r.followHostTheme),s={pc_pro:"ProContainer",mobile_pro:"AppContainer",pc_dashboard:"ProContainer",mobile_dashboard:"AppContainer",screen_dashboard:"ShowContainer",pro:"ProContainer",app:"AppContainer",show:"ShowContainer"},l=o.ref({sheets:[],type:""}),c=o.computed(()=>{var Oe;const Ee=i9((Oe=l.value)==null?void 0:Oe.type);return Ee===Ip||Ee===Y1}),u=o.computed(()=>{var Ee;return i9((Ee=l.value)==null?void 0:Ee.type)===Y1}),d=o.computed(()=>!!r.mobileEmbed&&u.value),f=o.ref(0),h=o.computed(()=>l.value.sheets[f.value]),p=o.ref(null),m=o.ref(null),v=o.ref(null),{currentTheme:g,initTheme:y,cleanup:b}=vln(a),{grid:x,safeRowHeight:_,getHeight:w,autoSize:S,refitLayout:C,initResizeObserver:E,cleanup:T}=Dln(h,l,p,m,{themeRootRef:v}),{tabDisplayMode:A,isTabVisible:M,visibleSheetIndexes:D,visibleSheets:k,hideTabs:P,showTabs:I,getSheetItemStyle:N,sheetWrapStyle:R,checkItem:V,initTabTimer:B,cleanup:F}=gln(l,f,()=>Ae()),{orderedLayers:G,visibleModalType:U,visibleModalOpen:z,visibleModalRenderLayer:j,visibleModalSheet:W,visibleModalSheetStickyLayer:Y,showModal:re,hideModalLayer:Q,toggleModal:$,handleComponentEvent:ee,isComponentBoundToMarker:X,getModalContainerStyle:ne,handleLinkHubModalEvent:K}=yln(h,l,f),Z=o.ref({});let me={};const be=o.ref(!1),ye=o.ref(!0);let ie=0,ue=!1;typeof window!="undefined"&&(window.__mix_base_preview_active=!0);const le=o.ref(0);o.provide(kte,le);const oe=()=>Ve(null,null,function*(){yield o.nextTick(),yield new Promise(Ee=>requestAnimationFrame(()=>Ee())),yield new Promise(Ee=>requestAnimationFrame(()=>Ee()))}),de=()=>{S()},Ae=()=>Ve(null,null,function*(){var Oe;de(),yield oe();const Ee=(Oe=p.value)!=null?Oe:v.value;Lte(Ee),le.value++,yield oe(),Lte(Ee),se()}),pe=()=>Ve(null,null,function*(){window.__mix_preview_params=l.value,yield o.nextTick(),yield Ae()}),se=()=>{var Oe,ve,ce;if(i9((Oe=l.value)==null?void 0:Oe.type)!==Ip)return;const Ee=(ce=p.value)!=null?ce:(ve=v.value)==null?void 0:ve.querySelector(".layout .canvas");Lln(Ee)},Me=()=>{Ae(),se()},He=o.computed(()=>{var Ee;return(Ee=r.hostProMenuTitle)!=null?Ee:""}),ot=o.computed(()=>r.hostMenuToSheetRules),{activeDashboardUid:nt,boardSwitchEpoch:Re,showProAppMenu:Ze,visibleProMenuRows:qe,isProMenuGroupExpanded:je,toggleProMenuGroup:Je,applyProApplicationScript:$e,handleProMenuRowClick:kt,resetProMenu:Rt,getProAppActiveMenuTitle:xt,resolveInitialSheetIndexFromHostMenuTitle:Fe,applyHostMenuInitialSheet:Ie,firstVisibleSheetIndex:xe}=Cln(l,f,pe,me,He,ot),{sharedWorker:he,session:_e,initDataConnection:ze}=Mln((Pt=r.enableWebSocket)!=null?Pt:!0),Pe=Ee=>({x:Ee.x,y:Ee.y,w:Ee.w,h:Ee.h,i:Ee.i}),Be=o.computed(()=>{var Oe;const Ee=(Oe=h.value)==null?void 0:Oe.background;return Ee?Ee==="defaultBg1"?`url(${Psn})`:Ee==="defaultBg2"?`url(${ksn})`:Ee.startsWith("#")||Ee.startsWith("rgb")||Ee.startsWith("rgba")?Ee:"transparent":""}),at=o.ref("");let ft=null,Mt=0,Vt=null;const xn=()=>{ft&&(URL.revokeObjectURL(ft),ft=null)};function sn(){return Ve(this,null,function*(){var ce,Le;const Ee=(Le=(ce=h.value)==null?void 0:ce.background)==null?void 0:Le.trim(),Oe=++Mt;if(Vt==null||Vt.abort(),Vt=new AbortController,!Ee){xn(),at.value="";return}if(Ee==="defaultBg1"||Ee==="defaultBg2"){xn(),at.value="";return}if(Ee.startsWith("#")||Ee.startsWith("rgb")||Ee.startsWith("rgba")){xn(),at.value="";return}if(Ee.startsWith("blob:")||Ee.startsWith("data:")){xn(),at.value=Ee;return}const ve=OI(n9(Ee));if(!ve){xn(),at.value="";return}try{xn();const Ke={},yt=GC();yt&&(Ke.Authorization=`Bearer ${yt}`);const ht=yield fetch(ve,{mode:"cors",credentials:"include",signal:Vt.signal,headers:Ke});if(Oe!==Mt)return;if(!ht.ok){console.warn("[Preview] background fetch failed",ht.status,ve),at.value="";return}const Nt=yield ht.blob();if(Oe!==Mt)return;if(!Nt.size){at.value="";return}ft=URL.createObjectURL(Nt),at.value=ft}catch(Ke){if((Ke==null?void 0:Ke.name)==="AbortError"||Oe!==Mt)return;console.warn("[Preview] background fetch error",Ke),at.value=""}})}o.watch(()=>{var Ee;return(Ee=h.value)==null?void 0:Ee.background},()=>{sn()},{immediate:!0});const Tt=Ee=>Ve(null,null,function*(){if(!Ee||!be.value)return;const Oe=wp(Ee),ve=cCe(Ee),ce=rse(Oe||ve);if(ce){const Le=tse(ce);Le&&(A.value=Le)}(yield $e(Oe))||(Rt(),l.value=nse(ve||Ee,me),f.value=0,Ie(),yield pe())});function ct(Ee){var ce,Le;const Oe=Number((ce=Ee.order)!=null?ce:0),ve=Ee.isSticky?1e3+Oe:Oe;return{opacity:((Le=Ee.opacity)!=null?Le:100)/100,zIndex:ve,pointerEvents:"none"}}function At(){o.nextTick(()=>{se(),le.value++})}const Yt=Ee=>{var Le,Ke;const Oe=(Le=Ee==null?void 0:Ee.detail)==null?void 0:Le.layerId;if(typeof Oe!="string"||!Oe)return;const ve=(Ke=h.value)==null?void 0:Ke.layers;if(!(ve!=null&&ve.length)||!ve.some(yt=>yt.id===Oe))return;wte(ve,Oe,"top");const ce=ve.find(yt=>yt.id===Oe);ce&&(ce.visible=!0),At()},un=Ee=>{var Le,Ke;const Oe=(Le=Ee==null?void 0:Ee.detail)==null?void 0:Le.layerId;if(typeof Oe!="string"||!Oe)return;const ve=(Ke=h.value)==null?void 0:Ke.layers;if(!(ve!=null&&ve.length)||!ve.some(yt=>yt.id===Oe))return;wte(ve,Oe,"bottom");const ce=ve.find(yt=>yt.id===Oe);ce&&(ce.visible=!1),At()},Mn=Ee=>{const Oe=(Ee==null?void 0:Ee.detail)||{},ve=Oe.action||"show";if(!(!Oe.layerId&&ve!=="hide")){if(ve==="hide"){Q();return}if(ve==="toggle"){$(Oe);return}re(Oe)}},Xt=()=>Ve(null,null,function*(){return{}}),Bn=ua(),_t=new Set;let gt=null,jt=null;const zn=()=>{var Oe;const Ee=(Oe=m.value)!=null?Oe:v.value;!Ee||typeof IntersectionObserver=="undefined"||(jt==null||jt.disconnect(),jt=new IntersectionObserver(ve=>{ve.some(ce=>ce.isIntersecting&&ce.intersectionRatio>0)&&Ae()},{threshold:[0,.01]}),jt.observe(Ee))};o.onMounted(()=>Ve(null,null,function*(){(window.opener||window.parent!==window)&&document.body.classList.add("mix-preview-mode"),yield Ge(),window.addEventListener("mix-modal",Mn),window.addEventListener("mix-layer-bring-top",Yt),window.addEventListener("mix-layer-send-bottom",un),y(C);const Ee=yield Xt();Ee&&Object.keys(Ee).length>0&&sessionStorage.setItem("object_alias_uid_mapping",JSON.stringify(Ee));try{Z.value=yield F9.loadComponents(),me=yield F9.getAllExposedProps(),be.value=!0}catch(Oe){console.error("[BasePreview] elements 加载失败:",Oe),Z.value={},me={},be.value=!0}yield ze(),window.__mix_preview_params=l.value,yield o.nextTick(),C(),E(),zn(),gt=o.watch(()=>Bn.channels,Oe=>{!l.value||!l.value.sheets||l.value.sheets.length===0||Object.keys(Oe).forEach(ve=>{const ce=Oe[ve];if(!ce||!ce.topic)return;const Le=ce.topic.uniqueId;_t.has(Le)||(_t.add(Le),console.log("[LinkHub Modal] 检测到新事件:",{channel:ve,newEventId:Le,event:JSON.parse(JSON.stringify(ce))}),K(ve,ce))})},{deep:!0,immediate:!1}),o.nextTick(()=>{w(),se(),B()}),(l.value.type==="screen_dashboard"||l.value.type==="show")&&(o.nextTick(()=>{S()}),window.onresize=()=>{S()})}));const Ge=()=>Ve(null,null,function*(){var Le,Ke;const Ee=((Le=xi.getMixIotInfo())==null?void 0:Le.uid)||((Ke=xi.getUser())==null?void 0:Ke.uid);W5e(),GE();let Oe;try{Oe=yield Bt.http("get_user_final_data_permission",{user_uid:Ee},!0)}catch(yt){console.warn("[BasePreview] data permission preload failed, continue with default permission:",yt),GE();return}const ve={type:"black_list",entities:{}},ce=Oe==null?void 0:Oe.result;ce&&((ce.auth_type==="white_list"||ce.auth_type==="black_list")&&(ve.type=ce.auth_type),ce.entities&&typeof ce.entities=="object"&&(ve.entities=ce.entities)),sessionStorage.setItem(Pw,JSON.stringify(ve)),GE()});o.onUnmounted(()=>{ue=!0,Mt++,Vt==null||Vt.abort(),xn(),at.value="",typeof window!="undefined"&&(window.__mix_base_preview_active=!1),nH(!1),document.body.classList.remove("mix-preview-mode"),window.removeEventListener("mix-modal",Mn),window.removeEventListener("mix-layer-bring-top",Yt),window.removeEventListener("mix-layer-send-bottom",un),F(),b(),gt&&(gt(),gt=null),T(),jt&&(jt.disconnect(),jt=null),_e&&_e.close(),sessionStorage.removeItem("object_alias_uid_mapping"),r.releaseEmbedAgentOnUnmount&&jv("")}),o.watch(()=>r.isProduct,Ee=>nH(!!Ee),{immediate:!0}),o.watch(()=>r.agent,Ee=>jv(Ee),{immediate:!0}),o.watch(()=>[r.script,r.uid,be.value],ve=>Ve(null,[ve],function*([Ee,,Oe]){if(!Oe){ye.value=!0;return}const ce=++ie;ye.value=!0;try{yield Tt(Ee)}finally{if(ce!==ie||ue||(yield oe(),ce!==ie||ue)||(yield Ae(),ce!==ie||ue))return;ye.value=!1,i("ready")}}),{immediate:!0});const pt=Ee=>String(Ee!=null?Ee:"").trim().replace(/\s+/g," ");o.watch(()=>[pt(r.hostProMenuTitle),r.hostMenuToSheetRules],()=>{var ve;const Ee=((ve=l.value)==null?void 0:ve.sheets)||[];if(!Array.isArray(Ee)||Ee.length<=1)return;const Oe=Fe(Ee);if(r.hostMenuToSheetRules!==void 0)f.value=Oe>=0?Oe:xe(Ee);else{if(Oe<0)return;f.value=Oe}o.nextTick(()=>{de()})},{deep:!0}),o.watch(f,()=>{se(),Ae()}),o.watch(Re,()=>{Ae(),se()}),o.watch(()=>[l.value.type,G.value,x.height,f.value],()=>se(),{deep:!0}),o.provide("sharedWorker",he),o.provide("session",_e),o.provide("switchSheet",Ee=>{Ee>=0&&Ee<l.value.sheets.length&&(f.value=Ee)});function vt(Ee){var Le;const Oe=String(Ee!=null?Ee:"").trim();if(!Oe)return-1;const ve=((Le=l.value)==null?void 0:Le.sheets)||[],ce=ve.findIndex(Ke=>Ke&&(String(Ke.id)===Oe||String(Ke.name)===Oe||String(Ke.caption)===Oe));return ce>=0&&ce<ve.length?(f.value=ce,o.nextTick(()=>{de()}),ce):-1}return o.provide("switchSheetByPageKey",vt),e({switchSheetByPageKey:vt}),o.provide("getSheets",()=>l.value.sheets),o.provide("getCurrentSheet",()=>f.value),o.provide("getProAppActiveMenuTitle",xt),o.provide("boardSwitchEpoch",Re),o.provide("mixDashboardIsProduct",o.computed(()=>!!r.isProduct)),(Ee,Oe)=>(o.openBlock(),o.createElementBlock("div",{class:"mix-base-preview-outer w-[100%] h-full min-h-0 relative","data-theme":o.unref(g)},[l.value.sheets.length>0?(o.openBlock(),o.createElementBlock("div",{key:0,ref_key:"themeRootRef",ref:v,id:s[l.value.type],class:o.normalizeClass(["w-[100%] h-full min-h-0",{"mix-base-preview--fill":a.value,"mix-base-preview--pro-app":c.value,"is-mobile-preview":u.value&&!d.value,"is-mobile-embed-preview":d.value}]),"data-theme":o.unref(g)},[o.createElementVNode("div",{class:o.normalizeClass(["preview-shell",{"preview-shell--with-menu":o.unref(Ze)}])},[o.unref(Ze)?(o.openBlock(),o.createBlock(Usn,{key:0,theme:o.unref(g),rows:o.unref(qe),"active-dashboard-uid":o.unref(nt),"is-group-expanded":o.unref(je),onToggleGroup:o.unref(Je),onRowClick:o.unref(kt)},null,8,["theme","rows","active-dashboard-uid","is-group-expanded","onToggleGroup","onRowClick"])):o.createCommentVNode("",!0),o.createElementVNode("div",{ref_key:"previewStageRef",ref:m,class:o.normalizeClass(["preview-stage",{"preview-stage--pro-app":c.value}])},[o.createElementVNode("div",{class:"layout",style:o.normalizeStyle({background:Be.value,position:"relative"})},[h.value?(o.openBlock(),o.createElementBlock("div",{key:0,class:"canvas",ref_key:"canvasRef",ref:p},[at.value?(o.openBlock(),o.createElementBlock("img",{key:0,class:"sheet-bg-img",src:at.value,alt:"",draggable:"false"},null,8,Pln)):o.createCommentVNode("",!0),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(G),ve=>(o.openBlock(),o.createElementBlock("div",{key:ve.id,class:"layer-container","data-layer-id":ve.id,style:o.normalizeStyle(ct(ve))},[ve.visible?(o.openBlock(),o.createBlock(o.unref(fx),{key:0,layout:ve.components,"onUpdate:layout":ce=>ve.components=ce,"col-num":h.value.col,"row-height":o.unref(_),margin:o.unref(x).margin,"is-draggable":!1,"is-resizable":!1,"is-mirrored":!1,"vertical-compact":!1,"prevent-collision":!1,"allow-collision":!0,"use-css-transforms":!0,onLayoutReady:Me},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(ve.components,ce=>{var Le;return o.openBlock(),o.createBlock(o.unref(uv),o.mergeProps({key:ce.i},{ref_for:!0},Pe(ce),{"data-id":ce.id,"data-component-id":ce.id,style:{pointerEvents:"auto",visibility:o.unref(X)(ce.id)?"hidden":"visible",zIndex:(Le=ce.zIndex)!=null?Le:1},onClick:Ke=>o.unref(ee)(ce,"click"),onDblclick:Ke=>o.unref(ee)(ce,"dblclick")}),{default:o.withCtx(()=>[Z.value[ce.type]?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(Z.value[ce.type]),{key:0,conf:ce,theme:o.unref(g),uid:r.uid,"mixiot-dashboard-uid":r.mixiotDashboardUid,mode:"preview"},{default:o.withCtx(()=>[ce.type==="placeholder"&&Ee.$slots.placeholder?o.renderSlot(Ee.$slots,"placeholder",{key:0,id:ce.id,placeholderName:ce.name||ce.caption||ce.id,conf:ce},void 0,!0):o.createCommentVNode("",!0)]),_:2},1032,["conf","theme","uid","mixiot-dashboard-uid"])):o.createCommentVNode("",!0)]),_:2},1040,["data-id","data-component-id","style","onClick","onDblclick"])}),128))]),_:2},1032,["layout","onUpdate:layout","col-num","row-height","margin"])):o.createCommentVNode("",!0),ve.visible?(o.openBlock(),o.createBlock(C_,{key:1,layer:ve},null,8,["layer"])):o.createCommentVNode("",!0)],12,kln))),128))],512)):o.createCommentVNode("",!0)],4),o.unref(k).length>1&&o.unref(A)!=="hide"?(o.openBlock(),o.createBlock(Wsn,{key:0,"tab-display-mode":o.unref(A),"is-tab-visible":o.unref(M),"current-theme":o.unref(g),"sheet-wrap-style":o.unref(R),"visible-sheets":o.unref(k),"visible-sheet-indexes":o.unref(D),"current-sheet":f.value,"get-sheet-item-style":o.unref(N),onShowTabs:o.unref(I),onHideTabs:o.unref(P),onSelect:o.unref(V)},null,8,["tab-display-mode","is-tab-visible","current-theme","sheet-wrap-style","visible-sheets","visible-sheet-indexes","current-sheet","get-sheet-item-style","onShowTabs","onHideTabs","onSelect"])):o.createCommentVNode("",!0)],2)],2),o.unref(z)?(o.openBlock(),o.createBlock(mln,{key:0,"modal-type":o.unref(U),"modal-sheet":o.unref(W),"sticky-layer":o.unref(Y),"render-layer":o.unref(j),"sheet-col":h.value.col,"safe-row-height":o.unref(_),"grid-margin":o.unref(x).margin,"element-components":Z.value,theme:o.unref(g),uid:r.uid,"mixiot-dashboard-uid":r.mixiotDashboardUid,"container-style":o.unref(ne)(o.unref(j)),"get-grid-item-props":Pe,onClose:o.unref(Q)},null,8,["modal-type","modal-sheet","sticky-layer","render-layer","sheet-col","safe-row-height","grid-margin","element-components","theme","uid","mixiot-dashboard-uid","container-style","onClose"])):o.createCommentVNode("",!0)],10,Oln)):o.createCommentVNode("",!0),ye.value?(o.openBlock(),o.createElementBlock("div",Iln,[...Oe[0]||(Oe[0]=[o.createElementVNode("div",{class:"preview-global-loading__spinner"},null,-1),o.createElementVNode("span",{class:"preview-global-loading__text"},"加载中…",-1)])])):o.createCommentVNode("",!0)],8,Nln))}}),Lv=Dt(Rln,[["__scopeId","data-v-7d4f9b6f"]]),K8=o.defineComponent({name:"MixDesignShow",__name:"DesignShow",props:{script:{},uid:{},mixiotDashboardUid:{},enableWebSocket:{type:Boolean,default:!0},followHostTheme:{type:Boolean,default:!1},isProduct:{type:Boolean,default:!0},agent:{default:""},releaseEmbedAgentOnUnmount:{type:Boolean,default:!0}},emits:["ready"],setup(n,{emit:e}){const t=e,r=n;return(i,a)=>(o.openBlock(),o.createBlock(Lv,{script:r.script,uid:r.uid,"mixiot-dashboard-uid":r.mixiotDashboardUid,enableWebSocket:r.enableWebSocket,"follow-host-theme":r.followHostTheme,"is-product":r.isProduct,agent:r.agent,"release-embed-agent-on-unmount":r.releaseEmbedAgentOnUnmount,onReady:a[0]||(a[0]=s=>t("ready"))},o.createSlots({_:2},[i.$slots.placeholder?{name:"placeholder",fn:o.withCtx(s=>[o.renderSlot(i.$slots,"placeholder",o.normalizeProps(o.guardReactiveProps(s)))]),key:"0"}:void 0]),1032,["script","uid","mixiot-dashboard-uid","enableWebSocket","follow-host-theme","is-product","agent","release-embed-agent-on-unmount"]))}}),Vln="1.1.48";typeof console!="undefined"&&console.info&&console.info("[MixDashboards] 版本:",Vln);const Bln=[K8,u3,Mf],Fln=function(n){Bln.forEach(e=>{n.component(e.name||e.__name,e)})},zln={install:Fln,DesignShow:K8,DesignPro:u3,DesignApp:Mf};exports.LercAddCompression=zyt;exports.LercParameters=Fyt;exports._sfc_main=Mf;exports._sfc_main$1=u3;exports._sfc_main$2=K8;exports.configureAuth=m1e;exports.getAuthToken=g1e;exports.getDefaultExportFromCjs=hd;exports.getWsUrl=v1e;exports.index=zln;
8994
+ `,Aln="MixDashboards-DataChannel";function Tln(){const n=localStorage.getItem("dashboardUseLocalToken");return n==="1"||n==="true"}function Mln(n){const e=o.ref(!1),t=new fI;let r=null;if(n)try{{const l=new Blob([Eln],{type:"application/javascript"}),c=URL.createObjectURL(l);r=new SharedWorker(c,{type:"classic",name:Aln}),console.log("✅ [BasePreview] SharedWorker 已创建 (内联 Blob,适配 npm 单包)")}}catch(l){console.warn("⚠️ [BasePreview] SharedWorker 创建失败:",l)}const i=()=>Ve(null,null,function*(){const l=localStorage.getItem("globalApiUrl"),c=localStorage.getItem("globalAppId"),u=localStorage.getItem("globalAppSecret"),d=localStorage.getItem("globalApiToken");if((Number(localStorage.getItem("dashboardIsMixiot")||"1")||0)===1)return!!d;if(!l&&!c&&!u)return!0;if(!l)return yield Ue.ElMessageBox.alert("请先在全局设置中配置平台地址","配置错误",{confirmButtonText:"确定",type:"warning"}),!1;if(!Tln()&&(!c||!u))return yield Ue.ElMessageBox.alert("请先在全局设置中配置授权编号和授权密钥","配置错误",{confirmButtonText:"确定",type:"warning"}),!1;if(!d)return yield Ue.ElMessageBox.alert("Token 不存在,请检查网络连接或重新配置授权信息","Token 错误",{confirmButtonText:"确定",type:"error"}),!1;try{return(yield bf.getValidToken())?!0:(yield Ue.ElMessageBox.alert("Token 无效或已过期,请重新配置授权信息","Token 错误",{confirmButtonText:"确定",type:"error"}),!1)}catch(h){return console.error("[预览] Token 验证失败:",h),yield Ue.ElMessageBox.alert("Token 验证失败,请检查网络连接或重新配置授权信息","Token 错误",{confirmButtonText:"确定",type:"error"}),!1}}),a=()=>Ve(null,null,function*(){var p;const l=localStorage.getItem("globalApiUrl"),c=localStorage.getItem("globalAppId"),u=localStorage.getItem("globalAppSecret");(Number(localStorage.getItem("dashboardIsMixiot")||"1")||0)===1?e.value=!!(l&&localStorage.getItem("globalApiToken")):e.value=!!(l&&c&&u);let f="";if(e.value)try{f=yield bf.getValidToken()}catch(m){console.error("[WebSocket] 获取 ApiProxy Token 失败:",m),Ue.ElMessage.error("获取平台 Token 失败,实时数据可能无法正常显示");return}else f=((p=xi.getUser())==null?void 0:p.token)||"";const h=B5e();r.port.postMessage({type:"reconnect",url:h,token:f,sysMode:localStorage.getItem("sys_mode")||"",useApiProxy:e.value})}),s=()=>Ve(null,null,function*(){if(!n){console.log("[F12][BasePreview] initDataConnection skipped (enableWebSocket=false)");return}try{const{getAuthToken:l}=yield Promise.resolve().then(()=>Pnt);let c="";try{c=yield l()}catch(p){if((p instanceof Error?p.message:String(p)).includes("本地登录 token 不存在,请先登录")){console.warn("[F12][BasePreview] initDataConnection skipped: no local token",p);return}else throw p}const u=localStorage.getItem("globalApiUrl")||"",d=Number(localStorage.getItem("dashboardIsMixiot")||"1")||0;console.log("[F12][BasePreview] initDataConnection config",{isMixiot:d,globalApiUrl:u,hasToken:!!c});const f=!!c&&d!==1&&!u;if(d!==1&&!u&&!c){Ue.ElMessage.error("请先在全局设置中配置平台地址"),console.error("[F12][BasePreview] initDataConnection abort: globalApiUrl missing in non-local mode");return}let h="";if(d===1||f){let m=(u||`${location.protocol}//${location.host}`).replace(/^http/,"ws");m.endsWith("/")||(m+="/"),h=`${m}ws/api`}else if(u){let p=u.replace(/^http/,"ws");p.endsWith("/")||(p+="/"),h=`${p}apiproxy/ws/api`}r&&(r.port.postMessage({type:"init_connection",url:h,token:c}),console.log("[F12][BasePreview] data connection initialized",{wsUrl:h}))}catch(l){console.error("[F12][BasePreview] initDataConnection failed:",l),Ue.ElMessage.error("数据连接初始化失败")}});return r&&(t.init(r),r.port.onmessage=l=>{t.processWorkerMessage(l)}),{sharedWorker:r,session:t,useApiProxy:e,checkApiProxyConfig:i,initWebSocketConnection:a,initDataConnection:s}}const Dte={pc_pro:"ProContainer",mobile_pro:"AppContainer",pc_dashboard:"ProContainer",mobile_dashboard:"AppContainer",screen_dashboard:"ShowContainer"};function Dln(n,e,t,r,i={}){const a=i.themeRootRef,s=()=>{var S;if(a!=null&&a.value)return a.value;const _=m(),w=(S=Dte[_])!=null?S:Dte[Ip];return w?document.getElementById(w):null},l=o.reactive({margin:[10,10],height:40}),c=o.computed(()=>{const _=Number(l.height);return typeof _=="number"&&!Number.isNaN(_)&&_>0?_:40});let u=null;const d=(_,w=40)=>{const S=Number(_);return typeof S=="number"&&!Number.isNaN(S)&&S>0?S:w},f=_=>(Array.isArray(_==null?void 0:_.layers)?_.layers:[]).flatMap(S=>Array.isArray(S==null?void 0:S.components)?S.components:[]),h=(_,w)=>{if(w<80)return!1;const S=f(_).map(C=>Number(C==null?void 0:C.h)).filter(C=>Number.isFinite(C)&&C>0);return S.length?Math.max(...S)<=5:!1},p=(_,w)=>h(_,w)?Math.max(1,Math.round(w/5)):w,m=()=>{var _;return i9((_=e.value)==null?void 0:_.type)},v=()=>{const _=n.value;if(!_)return;const w=m();let S=_.col||20;S=Math.max(1,S);const C=l.margin[0];if(w===Ff){const E=p(_,Math.max(1,_.col||100));let T=Number(_.screenHeight)||1080;T=T-(E+1)*C,l.height=d(T/E,40);return}if(w===Ip){const E=Math.max(1,Number(_.screenWidth)||1920),T=p(_,S),A=E-(T+1)*C;l.height=d(Math.round(A/T),40);return}if(w===Y1){const T=359-(S+1)*C;l.height=d(Math.round(T/S),40);return}},g=()=>{var S;const _=t.value;_&&(_.style.width="",_.style.height="",_.style.transform="",_.style.transformOrigin="");const w=m();if(w!==Ff){const C=s();C&&(C.style.width="",C.style.height="",C.style.transform="",C.style.transformOrigin="")}if(w===Ff){const C=n.value,E=Number(C==null?void 0:C.screenWidth),T=Number(C==null?void 0:C.screenHeight);if(!E||!T){v();return}const A=s();if(!A){v();return}const M=A,D=typeof window!="undefined"&&new URLSearchParams(window.location.search).get("embed")==="1",k=A.parentElement,I=(D?M==null?void 0:M.parentElement:null)||k||r.value||((S=t.value)==null?void 0:S.parentElement)||document.documentElement,N=I.getBoundingClientRect(),R=Math.max(1,N.width||I.clientWidth),V=Math.max(1,N.height||I.clientHeight),B=V/T,F=R/E,G=Math.min(F,B),U=(R-E*G)/2,z=(V-T*G)/2;A.style.width=`${E}px`,A.style.height=`${T}px`,A.style.transformOrigin="top left",A.style.transform=`scale(${G}, ${G}) translate(${U/G}px, ${z/G}px)`,v();return}v()},y=()=>{g()};return{grid:l,safeRowHeight:c,getHeight:v,autoSize:g,refitLayout:y,initResizeObserver:()=>{var w,S;const _=r.value||((S=(w=t.value)==null?void 0:w.parentElement)==null?void 0:S.parentElement)||t.value;_&&(u=new ResizeObserver(()=>{y()}),u.observe(_))},cleanup:()=>{u&&(u.disconnect(),u=null)}}}function Lln(n,e){n&&o.nextTick(()=>{var a;let t=0;n.querySelectorAll(".vgl-layout").forEach(s=>{t=Math.max(t,s.offsetHeight)});const r=((a=n.parentElement)==null?void 0:a.clientHeight)||n.clientHeight,i=Math.max(r,t+8);i>0?n.style.minHeight=`${i}px`:n.style.minHeight=""})}function Lte(n){n&&n.querySelectorAll(".vgl-layout").forEach(e=>{e.style.width="100%";const t=e.__resizeCallback;typeof t=="function"&&t({target:e,contentRect:e.getBoundingClientRect()})})}const Nln=["data-theme"],Oln=["id","data-theme"],Pln=["src"],kln=["data-layer-id"],Iln={key:1,class:"preview-global-loading","aria-busy":"true","aria-live":"polite"},Rln=o.defineComponent({name:"MixBasePreview",__name:"index",props:{script:{},uid:{},mixiotDashboardUid:{},enableWebSocket:{type:Boolean,default:!0},followHostTheme:{type:Boolean,default:!1},hostProMenuTitle:{default:""},hostMenuToSheetRules:{},isProduct:{type:Boolean,default:!1},agent:{default:""},releaseEmbedAgentOnUnmount:{type:Boolean,default:!0},mobileEmbed:{type:Boolean,default:!1}},emits:["ready"],setup(n,{expose:e,emit:t}){var Pt;const r=n,i=t,a=o.computed(()=>!!r.followHostTheme),s={pc_pro:"ProContainer",mobile_pro:"AppContainer",pc_dashboard:"ProContainer",mobile_dashboard:"AppContainer",screen_dashboard:"ShowContainer",pro:"ProContainer",app:"AppContainer",show:"ShowContainer"},l=o.ref({sheets:[],type:""}),c=o.computed(()=>{var Oe;const Ee=i9((Oe=l.value)==null?void 0:Oe.type);return Ee===Ip||Ee===Y1}),u=o.computed(()=>{var Ee;return i9((Ee=l.value)==null?void 0:Ee.type)===Y1}),d=o.computed(()=>!!r.mobileEmbed&&u.value),f=o.ref(0),h=o.computed(()=>l.value.sheets[f.value]),p=o.ref(null),m=o.ref(null),v=o.ref(null),{currentTheme:g,initTheme:y,cleanup:b}=vln(a),{grid:x,safeRowHeight:_,getHeight:w,autoSize:S,refitLayout:C,initResizeObserver:E,cleanup:T}=Dln(h,l,p,m,{themeRootRef:v}),{tabDisplayMode:A,isTabVisible:M,visibleSheetIndexes:D,visibleSheets:k,hideTabs:P,showTabs:I,getSheetItemStyle:N,sheetWrapStyle:R,checkItem:V,initTabTimer:B,cleanup:F}=gln(l,f,()=>Ae()),{orderedLayers:G,visibleModalType:U,visibleModalOpen:z,visibleModalRenderLayer:j,visibleModalSheet:W,visibleModalSheetStickyLayer:Y,showModal:re,hideModalLayer:Q,toggleModal:$,handleComponentEvent:ee,isComponentBoundToMarker:X,getModalContainerStyle:ne,handleLinkHubModalEvent:K}=yln(h,l,f),Z=o.ref({});let me={};const be=o.ref(!1),ye=o.ref(!0);let ie=0,ue=!1;typeof window!="undefined"&&(window.__mix_base_preview_active=!0);const le=o.ref(0);o.provide(kte,le);const oe=()=>Ve(null,null,function*(){yield o.nextTick(),yield new Promise(Ee=>requestAnimationFrame(()=>Ee())),yield new Promise(Ee=>requestAnimationFrame(()=>Ee()))}),de=()=>{S()},Ae=()=>Ve(null,null,function*(){var Oe;de(),yield oe();const Ee=(Oe=p.value)!=null?Oe:v.value;Lte(Ee),le.value++,yield oe(),Lte(Ee),se()}),pe=()=>Ve(null,null,function*(){window.__mix_preview_params=l.value,yield o.nextTick(),yield Ae()}),se=()=>{var Oe,ve,ce;if(i9((Oe=l.value)==null?void 0:Oe.type)!==Ip)return;const Ee=(ce=p.value)!=null?ce:(ve=v.value)==null?void 0:ve.querySelector(".layout .canvas");Lln(Ee)},Me=()=>{Ae(),se()},He=o.computed(()=>{var Ee;return(Ee=r.hostProMenuTitle)!=null?Ee:""}),ot=o.computed(()=>r.hostMenuToSheetRules),{activeDashboardUid:nt,boardSwitchEpoch:Re,showProAppMenu:Ze,visibleProMenuRows:qe,isProMenuGroupExpanded:je,toggleProMenuGroup:Je,applyProApplicationScript:$e,handleProMenuRowClick:kt,resetProMenu:Rt,getProAppActiveMenuTitle:xt,resolveInitialSheetIndexFromHostMenuTitle:Fe,applyHostMenuInitialSheet:Ie,firstVisibleSheetIndex:xe}=Cln(l,f,pe,me,He,ot),{sharedWorker:he,session:_e,initDataConnection:ze}=Mln((Pt=r.enableWebSocket)!=null?Pt:!0),Pe=Ee=>({x:Ee.x,y:Ee.y,w:Ee.w,h:Ee.h,i:Ee.i}),Be=o.computed(()=>{var Oe;const Ee=(Oe=h.value)==null?void 0:Oe.background;return Ee?Ee==="defaultBg1"?`url(${Psn})`:Ee==="defaultBg2"?`url(${ksn})`:Ee.startsWith("#")||Ee.startsWith("rgb")||Ee.startsWith("rgba")?Ee:"transparent":""}),at=o.ref("");let ft=null,Mt=0,Vt=null;const xn=()=>{ft&&(URL.revokeObjectURL(ft),ft=null)};function sn(){return Ve(this,null,function*(){var ce,Le;const Ee=(Le=(ce=h.value)==null?void 0:ce.background)==null?void 0:Le.trim(),Oe=++Mt;if(Vt==null||Vt.abort(),Vt=new AbortController,!Ee){xn(),at.value="";return}if(Ee==="defaultBg1"||Ee==="defaultBg2"){xn(),at.value="";return}if(Ee.startsWith("#")||Ee.startsWith("rgb")||Ee.startsWith("rgba")){xn(),at.value="";return}if(Ee.startsWith("blob:")||Ee.startsWith("data:")){xn(),at.value=Ee;return}const ve=OI(n9(Ee));if(!ve){xn(),at.value="";return}try{xn();const Ke={},yt=GC();yt&&(Ke.Authorization=`Bearer ${yt}`);const ht=yield fetch(ve,{mode:"cors",credentials:"include",signal:Vt.signal,headers:Ke});if(Oe!==Mt)return;if(!ht.ok){console.warn("[Preview] background fetch failed",ht.status,ve),at.value="";return}const Nt=yield ht.blob();if(Oe!==Mt)return;if(!Nt.size){at.value="";return}ft=URL.createObjectURL(Nt),at.value=ft}catch(Ke){if((Ke==null?void 0:Ke.name)==="AbortError"||Oe!==Mt)return;console.warn("[Preview] background fetch error",Ke),at.value=""}})}o.watch(()=>{var Ee;return(Ee=h.value)==null?void 0:Ee.background},()=>{sn()},{immediate:!0});const Tt=Ee=>Ve(null,null,function*(){if(!Ee||!be.value)return;const Oe=wp(Ee),ve=cCe(Ee),ce=rse(Oe||ve);if(ce){const Le=tse(ce);Le&&(A.value=Le)}(yield $e(Oe))||(Rt(),l.value=nse(ve||Ee,me),f.value=0,Ie(),yield pe())});function ct(Ee){var ce,Le;const Oe=Number((ce=Ee.order)!=null?ce:0),ve=Ee.isSticky?1e3+Oe:Oe;return{opacity:((Le=Ee.opacity)!=null?Le:100)/100,zIndex:ve,pointerEvents:"none"}}function At(){o.nextTick(()=>{se(),le.value++})}const Yt=Ee=>{var Le,Ke;const Oe=(Le=Ee==null?void 0:Ee.detail)==null?void 0:Le.layerId;if(typeof Oe!="string"||!Oe)return;const ve=(Ke=h.value)==null?void 0:Ke.layers;if(!(ve!=null&&ve.length)||!ve.some(yt=>yt.id===Oe))return;wte(ve,Oe,"top");const ce=ve.find(yt=>yt.id===Oe);ce&&(ce.visible=!0),At()},un=Ee=>{var Le,Ke;const Oe=(Le=Ee==null?void 0:Ee.detail)==null?void 0:Le.layerId;if(typeof Oe!="string"||!Oe)return;const ve=(Ke=h.value)==null?void 0:Ke.layers;if(!(ve!=null&&ve.length)||!ve.some(yt=>yt.id===Oe))return;wte(ve,Oe,"bottom");const ce=ve.find(yt=>yt.id===Oe);ce&&(ce.visible=!1),At()},Mn=Ee=>{const Oe=(Ee==null?void 0:Ee.detail)||{},ve=Oe.action||"show";if(!(!Oe.layerId&&ve!=="hide")){if(ve==="hide"){Q();return}if(ve==="toggle"){$(Oe);return}re(Oe)}},Xt=()=>Ve(null,null,function*(){return{}}),Bn=ua(),_t=new Set;let gt=null,jt=null;const zn=()=>{var Oe;const Ee=(Oe=m.value)!=null?Oe:v.value;!Ee||typeof IntersectionObserver=="undefined"||(jt==null||jt.disconnect(),jt=new IntersectionObserver(ve=>{ve.some(ce=>ce.isIntersecting&&ce.intersectionRatio>0)&&Ae()},{threshold:[0,.01]}),jt.observe(Ee))};o.onMounted(()=>Ve(null,null,function*(){(window.opener||window.parent!==window)&&document.body.classList.add("mix-preview-mode"),yield Ge(),window.addEventListener("mix-modal",Mn),window.addEventListener("mix-layer-bring-top",Yt),window.addEventListener("mix-layer-send-bottom",un),y(C);const Ee=yield Xt();Ee&&Object.keys(Ee).length>0&&sessionStorage.setItem("object_alias_uid_mapping",JSON.stringify(Ee));try{Z.value=yield F9.loadComponents(),me=yield F9.getAllExposedProps(),be.value=!0}catch(Oe){console.error("[BasePreview] elements 加载失败:",Oe),Z.value={},me={},be.value=!0}yield ze(),window.__mix_preview_params=l.value,yield o.nextTick(),C(),E(),zn(),gt=o.watch(()=>Bn.channels,Oe=>{!l.value||!l.value.sheets||l.value.sheets.length===0||Object.keys(Oe).forEach(ve=>{const ce=Oe[ve];if(!ce||!ce.topic)return;const Le=ce.topic.uniqueId;_t.has(Le)||(_t.add(Le),console.log("[LinkHub Modal] 检测到新事件:",{channel:ve,newEventId:Le,event:JSON.parse(JSON.stringify(ce))}),K(ve,ce))})},{deep:!0,immediate:!1}),o.nextTick(()=>{w(),se(),B()}),(l.value.type==="screen_dashboard"||l.value.type==="show")&&(o.nextTick(()=>{S()}),window.onresize=()=>{S()})}));const Ge=()=>Ve(null,null,function*(){var Le,Ke;const Ee=((Le=xi.getMixIotInfo())==null?void 0:Le.uid)||((Ke=xi.getUser())==null?void 0:Ke.uid);W5e(),GE();let Oe;try{Oe=yield Bt.http("get_user_final_data_permission",{user_uid:Ee},!0)}catch(yt){console.warn("[BasePreview] data permission preload failed, continue with default permission:",yt),GE();return}const ve={type:"black_list",entities:{}},ce=Oe==null?void 0:Oe.result;ce&&((ce.auth_type==="white_list"||ce.auth_type==="black_list")&&(ve.type=ce.auth_type),ce.entities&&typeof ce.entities=="object"&&(ve.entities=ce.entities)),sessionStorage.setItem(Pw,JSON.stringify(ve)),GE()});o.onUnmounted(()=>{ue=!0,Mt++,Vt==null||Vt.abort(),xn(),at.value="",typeof window!="undefined"&&(window.__mix_base_preview_active=!1),nH(!1),document.body.classList.remove("mix-preview-mode"),window.removeEventListener("mix-modal",Mn),window.removeEventListener("mix-layer-bring-top",Yt),window.removeEventListener("mix-layer-send-bottom",un),F(),b(),gt&&(gt(),gt=null),T(),jt&&(jt.disconnect(),jt=null),_e&&_e.close(),sessionStorage.removeItem("object_alias_uid_mapping"),r.releaseEmbedAgentOnUnmount&&jv("")}),o.watch(()=>r.isProduct,Ee=>nH(!!Ee),{immediate:!0}),o.watch(()=>r.agent,Ee=>jv(Ee),{immediate:!0}),o.watch(()=>[r.script,r.uid,be.value],ve=>Ve(null,[ve],function*([Ee,,Oe]){if(!Oe){ye.value=!0;return}const ce=++ie;ye.value=!0;try{yield Tt(Ee)}finally{if(ce!==ie||ue||(yield oe(),ce!==ie||ue)||(yield Ae(),ce!==ie||ue))return;ye.value=!1,i("ready")}}),{immediate:!0});const pt=Ee=>String(Ee!=null?Ee:"").trim().replace(/\s+/g," ");o.watch(()=>[pt(r.hostProMenuTitle),r.hostMenuToSheetRules],()=>{var ve;const Ee=((ve=l.value)==null?void 0:ve.sheets)||[];if(!Array.isArray(Ee)||Ee.length<=1)return;const Oe=Fe(Ee);if(r.hostMenuToSheetRules!==void 0)f.value=Oe>=0?Oe:xe(Ee);else{if(Oe<0)return;f.value=Oe}o.nextTick(()=>{de()})},{deep:!0}),o.watch(f,()=>{se(),Ae()}),o.watch(Re,()=>{Ae(),se()}),o.watch(()=>[l.value.type,G.value,x.height,f.value],()=>se(),{deep:!0}),o.provide("sharedWorker",he),o.provide("session",_e),o.provide("switchSheet",Ee=>{Ee>=0&&Ee<l.value.sheets.length&&(f.value=Ee)});function vt(Ee){var Le;const Oe=String(Ee!=null?Ee:"").trim();if(!Oe)return-1;const ve=((Le=l.value)==null?void 0:Le.sheets)||[],ce=ve.findIndex(Ke=>Ke&&(String(Ke.id)===Oe||String(Ke.name)===Oe||String(Ke.caption)===Oe));return ce>=0&&ce<ve.length?(f.value=ce,o.nextTick(()=>{de()}),ce):-1}return o.provide("switchSheetByPageKey",vt),e({switchSheetByPageKey:vt}),o.provide("getSheets",()=>l.value.sheets),o.provide("getCurrentSheet",()=>f.value),o.provide("getProAppActiveMenuTitle",xt),o.provide("boardSwitchEpoch",Re),o.provide("mixDashboardIsProduct",o.computed(()=>!!r.isProduct)),(Ee,Oe)=>(o.openBlock(),o.createElementBlock("div",{class:"mix-base-preview-outer w-[100%] h-full min-h-0 relative","data-theme":o.unref(g)},[l.value.sheets.length>0?(o.openBlock(),o.createElementBlock("div",{key:0,ref_key:"themeRootRef",ref:v,id:s[l.value.type],class:o.normalizeClass(["w-[100%] h-full min-h-0",{"mix-base-preview--fill":a.value,"mix-base-preview--pro-app":c.value,"is-mobile-preview":u.value&&!d.value,"is-mobile-embed-preview":d.value}]),"data-theme":o.unref(g)},[o.createElementVNode("div",{class:o.normalizeClass(["preview-shell",{"preview-shell--with-menu":o.unref(Ze)}])},[o.unref(Ze)?(o.openBlock(),o.createBlock(Usn,{key:0,theme:o.unref(g),rows:o.unref(qe),"active-dashboard-uid":o.unref(nt),"is-group-expanded":o.unref(je),onToggleGroup:o.unref(Je),onRowClick:o.unref(kt)},null,8,["theme","rows","active-dashboard-uid","is-group-expanded","onToggleGroup","onRowClick"])):o.createCommentVNode("",!0),o.createElementVNode("div",{ref_key:"previewStageRef",ref:m,class:o.normalizeClass(["preview-stage",{"preview-stage--pro-app":c.value}])},[o.createElementVNode("div",{class:"layout",style:o.normalizeStyle({background:Be.value,position:"relative"})},[h.value?(o.openBlock(),o.createElementBlock("div",{key:0,class:"canvas",ref_key:"canvasRef",ref:p},[at.value?(o.openBlock(),o.createElementBlock("img",{key:0,class:"sheet-bg-img",src:at.value,alt:"",draggable:"false"},null,8,Pln)):o.createCommentVNode("",!0),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(G),ve=>(o.openBlock(),o.createElementBlock("div",{key:ve.id,class:"layer-container","data-layer-id":ve.id,style:o.normalizeStyle(ct(ve))},[ve.visible?(o.openBlock(),o.createBlock(o.unref(fx),{key:0,layout:ve.components,"onUpdate:layout":ce=>ve.components=ce,"col-num":h.value.col,"row-height":o.unref(_),margin:o.unref(x).margin,"is-draggable":!1,"is-resizable":!1,"is-mirrored":!1,"vertical-compact":!1,"prevent-collision":!1,"allow-collision":!0,"use-css-transforms":!0,onLayoutReady:Me},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(ve.components,ce=>{var Le;return o.openBlock(),o.createBlock(o.unref(uv),o.mergeProps({key:ce.i},{ref_for:!0},Pe(ce),{"data-id":ce.id,"data-component-id":ce.id,style:{pointerEvents:"auto",visibility:o.unref(X)(ce.id)?"hidden":"visible",zIndex:(Le=ce.zIndex)!=null?Le:1},onClick:Ke=>o.unref(ee)(ce,"click"),onDblclick:Ke=>o.unref(ee)(ce,"dblclick")}),{default:o.withCtx(()=>[Z.value[ce.type]?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(Z.value[ce.type]),{key:0,conf:ce,theme:o.unref(g),uid:r.uid,"mixiot-dashboard-uid":r.mixiotDashboardUid,mode:"preview"},{default:o.withCtx(()=>[ce.type==="placeholder"&&Ee.$slots.placeholder?o.renderSlot(Ee.$slots,"placeholder",{key:0,id:ce.id,placeholderName:ce.name||ce.caption||ce.id,conf:ce},void 0,!0):o.createCommentVNode("",!0)]),_:2},1032,["conf","theme","uid","mixiot-dashboard-uid"])):o.createCommentVNode("",!0)]),_:2},1040,["data-id","data-component-id","style","onClick","onDblclick"])}),128))]),_:2},1032,["layout","onUpdate:layout","col-num","row-height","margin"])):o.createCommentVNode("",!0),ve.visible?(o.openBlock(),o.createBlock(C_,{key:1,layer:ve},null,8,["layer"])):o.createCommentVNode("",!0)],12,kln))),128))],512)):o.createCommentVNode("",!0)],4),o.unref(k).length>1&&o.unref(A)!=="hide"?(o.openBlock(),o.createBlock(Wsn,{key:0,"tab-display-mode":o.unref(A),"is-tab-visible":o.unref(M),"current-theme":o.unref(g),"sheet-wrap-style":o.unref(R),"visible-sheets":o.unref(k),"visible-sheet-indexes":o.unref(D),"current-sheet":f.value,"get-sheet-item-style":o.unref(N),onShowTabs:o.unref(I),onHideTabs:o.unref(P),onSelect:o.unref(V)},null,8,["tab-display-mode","is-tab-visible","current-theme","sheet-wrap-style","visible-sheets","visible-sheet-indexes","current-sheet","get-sheet-item-style","onShowTabs","onHideTabs","onSelect"])):o.createCommentVNode("",!0)],2)],2),o.unref(z)?(o.openBlock(),o.createBlock(mln,{key:0,"modal-type":o.unref(U),"modal-sheet":o.unref(W),"sticky-layer":o.unref(Y),"render-layer":o.unref(j),"sheet-col":h.value.col,"safe-row-height":o.unref(_),"grid-margin":o.unref(x).margin,"element-components":Z.value,theme:o.unref(g),uid:r.uid,"mixiot-dashboard-uid":r.mixiotDashboardUid,"container-style":o.unref(ne)(o.unref(j)),"get-grid-item-props":Pe,onClose:o.unref(Q)},null,8,["modal-type","modal-sheet","sticky-layer","render-layer","sheet-col","safe-row-height","grid-margin","element-components","theme","uid","mixiot-dashboard-uid","container-style","onClose"])):o.createCommentVNode("",!0)],10,Oln)):o.createCommentVNode("",!0),ye.value?(o.openBlock(),o.createElementBlock("div",Iln,[...Oe[0]||(Oe[0]=[o.createElementVNode("div",{class:"preview-global-loading__spinner"},null,-1),o.createElementVNode("span",{class:"preview-global-loading__text"},"加载中…",-1)])])):o.createCommentVNode("",!0)],8,Nln))}}),Lv=Dt(Rln,[["__scopeId","data-v-7d4f9b6f"]]),K8=o.defineComponent({name:"MixDesignShow",__name:"DesignShow",props:{script:{},uid:{},mixiotDashboardUid:{},enableWebSocket:{type:Boolean,default:!0},followHostTheme:{type:Boolean,default:!1},isProduct:{type:Boolean,default:!0},agent:{default:""},releaseEmbedAgentOnUnmount:{type:Boolean,default:!0}},emits:["ready"],setup(n,{emit:e}){const t=e,r=n;return(i,a)=>(o.openBlock(),o.createBlock(Lv,{script:r.script,uid:r.uid,"mixiot-dashboard-uid":r.mixiotDashboardUid,enableWebSocket:r.enableWebSocket,"follow-host-theme":r.followHostTheme,"is-product":r.isProduct,agent:r.agent,"release-embed-agent-on-unmount":r.releaseEmbedAgentOnUnmount,onReady:a[0]||(a[0]=s=>t("ready"))},o.createSlots({_:2},[i.$slots.placeholder?{name:"placeholder",fn:o.withCtx(s=>[o.renderSlot(i.$slots,"placeholder",o.normalizeProps(o.guardReactiveProps(s)))]),key:"0"}:void 0]),1032,["script","uid","mixiot-dashboard-uid","enableWebSocket","follow-host-theme","is-product","agent","release-embed-agent-on-unmount"]))}}),Vln="1.1.49";typeof console!="undefined"&&console.info&&console.info("[MixDashboards] 版本:",Vln);const Bln=[K8,u3,Mf],Fln=function(n){Bln.forEach(e=>{n.component(e.name||e.__name,e)})},zln={install:Fln,DesignShow:K8,DesignPro:u3,DesignApp:Mf};exports.LercAddCompression=zyt;exports.LercParameters=Fyt;exports._sfc_main=Mf;exports._sfc_main$1=u3;exports._sfc_main$2=K8;exports.configureAuth=m1e;exports.getAuthToken=g1e;exports.getDefaultExportFromCjs=hd;exports.getWsUrl=v1e;exports.index=zln;
@@ -156557,7 +156557,7 @@ jh([8, 32946], () => import("./deflate-Dp_sL4b4.js").then((n) => n.default));
156557
156557
  jh(32773, () => import("./packbits-AaardaO4.js").then((n) => n.default));
156558
156558
  jh(
156559
156559
  34887,
156560
- () => import("./lerc-BhYMK9_B.js").then((n) => Xe(null, null, function* () {
156560
+ () => import("./lerc-CCrStQFG.js").then((n) => Xe(null, null, function* () {
156561
156561
  return yield n.zstd.init(), n;
156562
156562
  })).then((n) => n.default)
156563
156563
  );
@@ -228343,7 +228343,7 @@ const ndn = ["data-theme"], idn = ["id", "data-theme"], rdn = ["src"], adn = ["d
228343
228343
  } : void 0
228344
228344
  ]), 1032, ["script", "uid", "mixiot-dashboard-uid", "enableWebSocket", "follow-host-theme", "is-product", "agent", "release-embed-agent-on-unmount"]));
228345
228345
  }
228346
- }), ldn = "1.1.48";
228346
+ }), ldn = "1.1.49";
228347
228347
  typeof console != "undefined" && console.info && console.info("[MixDashboards] 版本:", ldn);
228348
228348
  const cdn = [YA, t5, S3], udn = function(n) {
228349
228349
  cdn.forEach((e) => {