qy-vue-plugins 0.1.27 → 0.1.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{MapView-CuJvhcA4.js → MapView-CnMvgFvE.js} +2 -2
- package/dist/chunks/{MapView-BH4pj8R5.js → MapView-CxOMifz_.js} +15 -13
- package/dist/chunks/{lerc-DOkenKh5.js → lerc-C7MAadkC.js} +1 -1
- package/dist/chunks/{lerc-BFT59NbM.js → lerc-DTA61BLm.js} +1 -1
- package/dist/mapbox/MapView.cjs +1 -1
- package/dist/mapbox/MapView.mjs +1 -1
- package/dist/mapbox/widgets/ShapeDialog.cjs +1 -1
- package/dist/mapbox/widgets/ShapeDialog.mjs +1 -1
- package/dist/mapbox.cjs +1 -1
- package/dist/mapbox.mjs +1 -1
- package/dist/qy-vue-plugins.css +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";const U=require("vue"),ge=require("mapbox-gl"),Pt=require("./mapStore-Dir9bFfQ.js"),Lt=require("./map-CAu4wyVU.js"),N=require("./utils-7p2Zpotx.js"),le=require("./EventKeys-BLmCVdTJ.js"),Le=require("./constant-Bc8XErtI.js"),Dt=require("@turf/turf"),De=require("./ProvideKeys-jy8dfV9u.js"),ut=require("./_commonjsHelpers-DwGv2jUC.js"),Ct=require("./_plugin-vue_export-helper-BHFhmbuH.js");function Et(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const n=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,n.get?n:{enumerable:!0,get:()=>t[o]})}}return e.default=t,Object.freeze(e)}const Ce=Et(Dt);function X(t){return(e,...o)=>At(t,e,o)}function pe(t,e){return X(ft(t,e).get)}const{apply:At,getOwnPropertyDescriptor:ft,getPrototypeOf:Ve,ownKeys:Mt}=Reflect,{iterator:Te,toStringTag:Ot}=Symbol,Nt=Object,{create:je,defineProperty:Rt}=Nt,Ft=Array,Bt=Ft.prototype,dt=Bt[Te],Gt=X(dt),ht=ArrayBuffer,kt=ht.prototype;pe(kt,"byteLength");const ot=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:null;ot&&pe(ot.prototype,"byteLength");const gt=Ve(Uint8Array);gt.from;const W=gt.prototype;W[Te];X(W.keys);X(W.values);X(W.entries);X(W.set);X(W.reverse);X(W.fill);X(W.copyWithin);X(W.sort);X(W.slice);X(W.subarray);pe(W,"buffer");pe(W,"byteOffset");pe(W,"length");pe(W,Ot);const Ut=Uint8Array,yt=Uint16Array,qe=Uint32Array,Kt=Float32Array,Se=Ve([][Te]()),mt=X(Se.next),Vt=X(function*(){}().next),jt=Ve(Se),qt=DataView.prototype,zt=X(qt.getUint16),ze=WeakMap,pt=ze.prototype,xt=X(pt.get),Yt=X(pt.set),It=new ze,$t=je(null,{next:{value:function(){const e=xt(It,this);return mt(e)}},[Te]:{value:function(){return this}}});function Zt(t){if(t[Te]===dt&&Se.next===mt)return t;const e=je($t);return Yt(It,e,Gt(t)),e}const Xt=new ze,Jt=je(jt,{next:{value:function(){const e=xt(Xt,this);return Vt(e)},writable:!0,configurable:!0}});for(const t of Mt(Se))t!=="next"&&Rt(Jt,t,ft(Se,t));const wt=new ht(4),Ht=new Kt(wt),Qt=new qe(wt),ie=new yt(512),ne=new Ut(512);for(let t=0;t<256;++t){const e=t-127;e<-24?(ie[t]=0,ie[t|256]=32768,ne[t]=24,ne[t|256]=24):e<-14?(ie[t]=1024>>-e-14,ie[t|256]=1024>>-e-14|32768,ne[t]=-e-1,ne[t|256]=-e-1):e<=15?(ie[t]=e+15<<10,ie[t|256]=e+15<<10|32768,ne[t]=13,ne[t|256]=13):e<128?(ie[t]=31744,ie[t|256]=64512,ne[t]=24,ne[t|256]=24):(ie[t]=31744,ie[t|256]=64512,ne[t]=13,ne[t|256]=13)}const Ye=new qe(2048);for(let t=1;t<1024;++t){let e=t<<13,o=0;for(;(e&8388608)===0;)e<<=1,o-=8388608;e&=-8388609,o+=947912704,Ye[t]=e|o}for(let t=1024;t<2048;++t)Ye[t]=939524096+(t-1024<<13);const xe=new qe(64);for(let t=1;t<31;++t)xe[t]=t<<23;xe[31]=1199570944;xe[32]=2147483648;for(let t=33;t<63;++t)xe[t]=2147483648+(t-32<<23);xe[63]=3347054592;const vt=new yt(64);for(let t=1;t<64;++t)t!==32&&(vt[t]=1024);function Wt(t){const e=t>>10;return Qt[0]=Ye[vt[e]+(t&1023)]+xe[e],Ht[0]}function St(t,e,...o){return Wt(zt(t,e,...Zt(o)))}var Ee={exports:{}},it;function _t(){if(it)return Ee.exports;it=1;function t(e,o,n){const i=n&&n.debug||!1;i&&console.log("[xml-utils] getting "+o+" in "+e);const r=typeof e=="object"?e.outer:e,c=r.slice(0,r.indexOf(">")+1),s=['"',"'"];for(let u=0;u<s.length;u++){const l=s[u],h=o+"\\="+l+"([^"+l+"]*)"+l;i&&console.log("[xml-utils] pattern:",h);const m=new RegExp(h).exec(c);if(i&&console.log("[xml-utils] match:",m),m)return m[1]}}return Ee.exports=t,Ee.exports.default=t,Ee.exports}var er=_t();const Ge=ut.getDefaultExportFromCjs(er);var Ae={exports:{}},Me={exports:{}},Oe={exports:{}},nt;function tr(){if(nt)return Oe.exports;nt=1;function t(e,o,n){const r=new RegExp(o).exec(e.slice(n));return r?n+r.index:-1}return Oe.exports=t,Oe.exports.default=t,Oe.exports}var Ne={exports:{}},at;function rr(){if(at)return Ne.exports;at=1;function t(e,o,n){const r=new RegExp(o).exec(e.slice(n));return r?n+r.index+r[0].length-1:-1}return Ne.exports=t,Ne.exports.default=t,Ne.exports}var Re={exports:{}},st;function or(){if(st)return Re.exports;st=1;function t(e,o){const n=new RegExp(o,"g"),i=e.match(n);return i?i.length:0}return Re.exports=t,Re.exports.default=t,Re.exports}var lt;function ir(){if(lt)return Me.exports;lt=1;const t=tr(),e=rr(),o=or();function n(i,r,c){const s=c&&c.debug||!1,u=!(c&&typeof c.nested===!1),l=c&&c.startIndex||0;s&&console.log("[xml-utils] starting findTagByName with",r," and ",c);const h=t(i,`<${r}[
|
|
2
2
|
>/]`,l);if(s&&console.log("[xml-utils] start:",h),h===-1)return;const y=i.slice(h+r.length);let m=e(y,"^[^<]*[ /]>",0);const g=m!==-1&&y[m-1]==="/";if(s&&console.log("[xml-utils] selfClosing:",g),g===!1)if(u){let b=0,S=1,v=0;for(;(m=e(y,"[ /]"+r+">",b))!==-1;){const R=y.substring(b,m+1);if(S+=o(R,"<"+r+`[
|
|
3
|
-
>]`),v+=o(R,"</"+r+">"),v>=S)break;b=m}}else m=e(y,"[ /]"+r+">",0);const d=h+r.length+m+1;if(s&&console.log("[xml-utils] end:",d),d===-1)return;const w=i.slice(h,d);let p;return g?p=null:p=w.slice(w.indexOf(">")+1,w.lastIndexOf("<")),{inner:p,outer:w,start:h,end:d}}return Me.exports=n,Me.exports.default=n,Me.exports}var ct;function nr(){if(ct)return Ae.exports;ct=1;const t=ir();function e(o,n,i){const r=[],c=i&&i.debug||!1,s=i&&typeof i.nested=="boolean"?i.nested:!0;let u=i&&i.startIndex||0,l;for(;l=t(o,n,{debug:c,startIndex:u});)s?u=l.start+1+n.length:u=l.end,r.push(l);return c&&console.log("findTagsByName found",r.length,"tags"),r}return Ae.exports=e,Ae.exports.default=e,Ae.exports}var ar=nr();const sr=ut.getDefaultExportFromCjs(ar),ve={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"},ae={};for(const t in ve)ve.hasOwnProperty(t)&&(ae[ve[t]]=parseInt(t,10));const lr=[ae.BitsPerSample,ae.ExtraSamples,ae.SampleFormat,ae.StripByteCounts,ae.StripOffsets,ae.StripRowCounts,ae.TileByteCounts,ae.TileOffsets,ae.SubIFDs],ke={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"},F={};for(const t in ke)ke.hasOwnProperty(t)&&(F[ke[t]]=parseInt(t,10));const ee={WhiteIsZero:0,BlackIsZero:1,RGB:2,Palette:3,CMYK:5,YCbCr:6,CIELab:8},cr={Unspecified:0},ur={AddCompression:1},fr={None:0,Deflate:1,Zstandard:2},dr={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 hr(t,e){const{width:o,height:n}=t,i=new Uint8Array(o*n*3);let r;for(let c=0,s=0;c<t.length;++c,s+=3)r=256-t[c]/e*256,i[s]=r,i[s+1]=r,i[s+2]=r;return i}function gr(t,e){const{width:o,height:n}=t,i=new Uint8Array(o*n*3);let r;for(let c=0,s=0;c<t.length;++c,s+=3)r=t[c]/e*256,i[s]=r,i[s+1]=r,i[s+2]=r;return i}function yr(t,e){const{width:o,height:n}=t,i=new Uint8Array(o*n*3),r=e.length/3,c=e.length/3*2;for(let s=0,u=0;s<t.length;++s,u+=3){const l=t[s];i[u]=e[l]/65536*256,i[u+1]=e[l+r]/65536*256,i[u+2]=e[l+c]/65536*256}return i}function mr(t){const{width:e,height:o}=t,n=new Uint8Array(e*o*3);for(let i=0,r=0;i<t.length;i+=4,r+=3){const c=t[i],s=t[i+1],u=t[i+2],l=t[i+3];n[r]=255*((255-c)/256)*((255-l)/256),n[r+1]=255*((255-s)/256)*((255-l)/256),n[r+2]=255*((255-u)/256)*((255-l)/256)}return n}function pr(t){const{width:e,height:o}=t,n=new Uint8ClampedArray(e*o*3);for(let i=0,r=0;i<t.length;i+=3,r+=3){const c=t[i],s=t[i+1],u=t[i+2];n[r]=c+1.402*(u-128),n[r+1]=c-.34414*(s-128)-.71414*(u-128),n[r+2]=c+1.772*(s-128)}return n}const xr=.95047,Ir=1,wr=1.08883;function vr(t){const{width:e,height:o}=t,n=new Uint8Array(e*o*3);for(let i=0,r=0;i<t.length;i+=3,r+=3){const c=t[i+0],s=t[i+1]<<24>>24,u=t[i+2]<<24>>24;let l=(c+16)/116,h=s/500+l,y=l-u/200,m,g,d;h=xr*(h*h*h>.008856?h*h*h:(h-16/116)/7.787),l=Ir*(l*l*l>.008856?l*l*l:(l-16/116)/7.787),y=wr*(y*y*y>.008856?y*y*y:(y-16/116)/7.787),m=h*3.2406+l*-1.5372+y*-.4986,g=h*-.9689+l*1.8758+y*.0415,d=h*.0557+l*-.204+y*1.057,m=m>.0031308?1.055*m**(1/2.4)-.055:12.92*m,g=g>.0031308?1.055*g**(1/2.4)-.055:12.92*g,d=d>.0031308?1.055*d**(1/2.4)-.055:12.92*d,n[r]=Math.max(0,Math.min(1,m))*255,n[r+1]=Math.max(0,Math.min(1,g))*255,n[r+2]=Math.max(0,Math.min(1,d))*255}return n}const Tt=new Map;function ce(t,e){Array.isArray(t)||(t=[t]),t.forEach(o=>Tt.set(o,e))}async function Sr(t){const e=Tt.get(t.Compression);if(!e)throw new Error(`Unknown compression method identifier: ${t.Compression}`);const o=await e();return new o(t)}ce([void 0,1],()=>Promise.resolve().then(()=>require("./raw-Cm78EGPL.js")).then(t=>t.default));ce(5,()=>Promise.resolve().then(()=>require("./lzw-Cbi9AOTI.js")).then(t=>t.default));ce(6,()=>{throw new Error("old style JPEG compression is not supported.")});ce(7,()=>Promise.resolve().then(()=>require("./jpeg-ClJ__b4h.js")).then(t=>t.default));ce([8,32946],()=>Promise.resolve().then(()=>require("./deflate-DEFE2aFp.js")).then(t=>t.default));ce(32773,()=>Promise.resolve().then(()=>require("./packbits-BXw9Z-3g.js")).then(t=>t.default));ce(34887,()=>Promise.resolve().then(()=>require("./lerc-BFT59NbM.js")).then(async t=>(await t.zstd.init(),t)).then(t=>t.default));ce(50001,()=>Promise.resolve().then(()=>require("./webimage-CCSZWcNO.js")).then(t=>t.default));function Be(t,e,o,n=1){return new(Object.getPrototypeOf(t)).constructor(e*o*n)}function Tr(t,e,o,n,i){const r=e/n,c=o/i;return t.map(s=>{const u=Be(s,n,i);for(let l=0;l<i;++l){const h=Math.min(Math.round(c*l),o-1);for(let y=0;y<n;++y){const m=Math.min(Math.round(r*y),e-1),g=s[h*e+m];u[l*n+y]=g}}return u})}function me(t,e,o){return(1-o)*t+o*e}function br(t,e,o,n,i){const r=e/n,c=o/i;return t.map(s=>{const u=Be(s,n,i);for(let l=0;l<i;++l){const h=c*l,y=Math.floor(h),m=Math.min(Math.ceil(h),o-1);for(let g=0;g<n;++g){const d=r*g,w=d%1,p=Math.floor(d),b=Math.min(Math.ceil(d),e-1),S=s[y*e+p],v=s[y*e+b],R=s[m*e+p],B=s[m*e+b],V=me(me(S,v,w),me(R,B,w),h%1);u[l*n+g]=V}}return u})}function Pr(t,e,o,n,i,r="nearest"){switch(r.toLowerCase()){case"nearest":return Tr(t,e,o,n,i);case"bilinear":case"linear":return br(t,e,o,n,i);default:throw new Error(`Unsupported resampling method: '${r}'`)}}function Lr(t,e,o,n,i,r){const c=e/n,s=o/i,u=Be(t,n,i,r);for(let l=0;l<i;++l){const h=Math.min(Math.round(s*l),o-1);for(let y=0;y<n;++y){const m=Math.min(Math.round(c*y),e-1);for(let g=0;g<r;++g){const d=t[h*e*r+m*r+g];u[l*n*r+y*r+g]=d}}}return u}function Dr(t,e,o,n,i,r){const c=e/n,s=o/i,u=Be(t,n,i,r);for(let l=0;l<i;++l){const h=s*l,y=Math.floor(h),m=Math.min(Math.ceil(h),o-1);for(let g=0;g<n;++g){const d=c*g,w=d%1,p=Math.floor(d),b=Math.min(Math.ceil(d),e-1);for(let S=0;S<r;++S){const v=t[y*e*r+p*r+S],R=t[y*e*r+b*r+S],B=t[m*e*r+p*r+S],V=t[m*e*r+b*r+S],J=me(me(v,R,w),me(B,V,w),h%1);u[l*n*r+g*r+S]=J}}}return u}function Cr(t,e,o,n,i,r,c="nearest"){switch(c.toLowerCase()){case"nearest":return Lr(t,e,o,n,i,r);case"bilinear":case"linear":return Dr(t,e,o,n,i,r);default:throw new Error(`Unsupported resampling method: '${c}'`)}}function Er(t,e,o){let n=0;for(let i=e;i<o;++i)n+=t[i];return n}function Ue(t,e,o){switch(t){case 1:if(e<=8)return new Uint8Array(o);if(e<=16)return new Uint16Array(o);if(e<=32)return new Uint32Array(o);break;case 2:if(e===8)return new Int8Array(o);if(e===16)return new Int16Array(o);if(e===32)return new Int32Array(o);break;case 3:switch(e){case 16:case 32:return new Float32Array(o);case 64:return new Float64Array(o)}break}throw Error("Unsupported data format/bitsPerSample")}function Ar(t,e){return(t===1||t===2)&&e<=32&&e%8===0?!1:!(t===3&&(e===16||e===32||e===64))}function Mr(t,e,o,n,i,r,c){const s=new DataView(t),u=o===2?c*r:c*r*n,l=o===2?1:n,h=Ue(e,i,u),y=parseInt("1".repeat(i),2);if(e===1){let m;o===1?m=n*i:m=i;let g=r*m;(g&7)!==0&&(g=g+7&-8);for(let d=0;d<c;++d){const w=d*g;for(let p=0;p<r;++p){const b=w+p*l*i;for(let S=0;S<l;++S){const v=b+S*i,R=(d*r+p)*l+S,B=Math.floor(v/8),V=v%8;if(V+i<=8)h[R]=s.getUint8(B)>>8-i-V&y;else if(V+i<=16)h[R]=s.getUint16(B)>>16-i-V&y;else if(V+i<=24){const J=s.getUint16(B)<<8|s.getUint8(B+2);h[R]=J>>24-i-V&y}else h[R]=s.getUint32(B)>>32-i-V&y}}}}return h.buffer}class Or{constructor(e,o,n,i,r,c){this.fileDirectory=e,this.geoKeys=o,this.dataView=n,this.littleEndian=i,this.tiles=r?{}:null,this.isTiled=!e.StripOffsets;const s=e.PlanarConfiguration;if(this.planarConfiguration=typeof s>"u"?1:s,this.planarConfiguration!==1&&this.planarConfiguration!==2)throw new Error("Invalid planar configuration.");this.source=c}getFileDirectory(){return this.fileDirectory}getGeoKeys(){return this.geoKeys}getWidth(){return this.fileDirectory.ImageWidth}getHeight(){return this.fileDirectory.ImageLength}getSamplesPerPixel(){return typeof this.fileDirectory.SamplesPerPixel<"u"?this.fileDirectory.SamplesPerPixel:1}getTileWidth(){return this.isTiled?this.fileDirectory.TileWidth:this.getWidth()}getTileHeight(){return this.isTiled?this.fileDirectory.TileLength:typeof this.fileDirectory.RowsPerStrip<"u"?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 o=0;o<this.fileDirectory.BitsPerSample.length;++o)e+=this.getSampleByteSize(o);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 o=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1,n=this.fileDirectory.BitsPerSample[e];switch(o){case 1:if(n<=8)return DataView.prototype.getUint8;if(n<=16)return DataView.prototype.getUint16;if(n<=32)return DataView.prototype.getUint32;break;case 2:if(n<=8)return DataView.prototype.getInt8;if(n<=16)return DataView.prototype.getInt16;if(n<=32)return DataView.prototype.getInt32;break;case 3:switch(n){case 16:return function(i,r){return St(this,i,r)};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,o){const n=this.getSampleFormat(e),i=this.getBitsPerSample(e);return Ue(n,i,o)}async getTileOrStrip(e,o,n,i,r){const c=Math.ceil(this.getWidth()/this.getTileWidth()),s=Math.ceil(this.getHeight()/this.getTileHeight());let u;const{tiles:l}=this;this.planarConfiguration===1?u=o*c+e:this.planarConfiguration===2&&(u=n*c*s+o*c+e);let h,y;this.isTiled?(h=this.fileDirectory.TileOffsets[u],y=this.fileDirectory.TileByteCounts[u]):(h=this.fileDirectory.StripOffsets[u],y=this.fileDirectory.StripByteCounts[u]);const m=(await this.source.fetch([{offset:h,length:y}],r))[0];let g;return l===null||!l[u]?(g=(async()=>{let d=await i.decode(this.fileDirectory,m);const w=this.getSampleFormat(),p=this.getBitsPerSample();return Ar(w,p)&&(d=Mr(d,w,this.planarConfiguration,this.getSamplesPerPixel(),p,this.getTileWidth(),this.getBlockHeight(o))),d})(),l!==null&&(l[u]=g)):g=l[u],{x:e,y:o,sample:n,data:await g}}async _readRaster(e,o,n,i,r,c,s,u,l){const h=this.getTileWidth(),y=this.getTileHeight(),m=this.getWidth(),g=this.getHeight(),d=Math.max(Math.floor(e[0]/h),0),w=Math.min(Math.ceil(e[2]/h),Math.ceil(m/h)),p=Math.max(Math.floor(e[1]/y),0),b=Math.min(Math.ceil(e[3]/y),Math.ceil(g/y)),S=e[2]-e[0];let v=this.getBytesPerPixel();const R=[],B=[];for(let O=0;O<o.length;++O)this.planarConfiguration===1?R.push(Er(this.fileDirectory.BitsPerSample,0,o[O])/8):R.push(0),B.push(this.getReaderForSample(o[O]));const V=[],{littleEndian:J}=this;for(let O=p;O<b;++O)for(let Y=d;Y<w;++Y){let q;this.planarConfiguration===1&&(q=this.getTileOrStrip(Y,O,0,r,l));for(let $=0;$<o.length;++$){const z=$,te=o[$];this.planarConfiguration===2&&(v=this.getSampleByteSize(te),q=this.getTileOrStrip(Y,O,te,r,l));const re=q.then(_=>{const ue=_.data,Ie=new DataView(ue),fe=this.getBlockHeight(_.y),se=_.y*y,de=_.x*h,be=se+fe,a=(_.x+1)*h,f=B[z],I=Math.min(fe,fe-(be-e[3]),g-se),D=Math.min(h,h-(a-e[2]),m-de);for(let T=Math.max(0,e[1]-se);T<I;++T)for(let x=Math.max(0,e[0]-de);x<D;++x){const A=(T*h+x)*v,C=f.call(Ie,A+R[z],J);let k;i?(k=(T+se-e[1])*S*o.length+(x+de-e[0])*o.length+z,n[k]=C):(k=(T+se-e[1])*S+x+de-e[0],n[z][k]=C)}});V.push(re)}}if(await Promise.all(V),c&&e[2]-e[0]!==c||s&&e[3]-e[1]!==s){let O;return i?O=Cr(n,e[2]-e[0],e[3]-e[1],c,s,o.length,u):O=Pr(n,e[2]-e[0],e[3]-e[1],c,s,u),O.width=c,O.height=s,O}return n.width=c||e[2]-e[0],n.height=s||e[3]-e[1],n}async readRasters({window:e,samples:o=[],interleave:n,pool:i=null,width:r,height:c,resampleMethod:s,fillValue:u,signal:l}={}){const h=e||[0,0,this.getWidth(),this.getHeight()];if(h[0]>h[2]||h[1]>h[3])throw new Error("Invalid subsets");const y=h[2]-h[0],m=h[3]-h[1],g=y*m,d=this.getSamplesPerPixel();if(!o||!o.length)for(let S=0;S<d;++S)o.push(S);else for(let S=0;S<o.length;++S)if(o[S]>=d)return Promise.reject(new RangeError(`Invalid sample index '${o[S]}'.`));let w;if(n){const S=this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,v=Math.max.apply(null,this.fileDirectory.BitsPerSample);w=Ue(S,v,g*o.length),u&&w.fill(u)}else{w=[];for(let S=0;S<o.length;++S){const v=this.getArrayForSample(o[S],g);Array.isArray(u)&&S<u.length?v.fill(u[S]):u&&!Array.isArray(u)&&v.fill(u),w.push(v)}}const p=i||await Sr(this.fileDirectory);return await this._readRaster(h,o,w,n,p,r,c,s,l)}async readRGB({window:e,interleave:o=!0,pool:n=null,width:i,height:r,resampleMethod:c,enableAlpha:s=!1,signal:u}={}){const l=e||[0,0,this.getWidth(),this.getHeight()];if(l[0]>l[2]||l[1]>l[3])throw new Error("Invalid subsets");const h=this.fileDirectory.PhotometricInterpretation;if(h===ee.RGB){let b=[0,1,2];if(this.fileDirectory.ExtraSamples!==cr.Unspecified&&s){b=[];for(let S=0;S<this.fileDirectory.BitsPerSample.length;S+=1)b.push(S)}return this.readRasters({window:e,interleave:o,samples:b,pool:n,width:i,height:r,resampleMethod:c,signal:u})}let y;switch(h){case ee.WhiteIsZero:case ee.BlackIsZero:case ee.Palette:y=[0];break;case ee.CMYK:y=[0,1,2,3];break;case ee.YCbCr:case ee.CIELab:y=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const m={window:l,interleave:!0,samples:y,pool:n,width:i,height:r,resampleMethod:c,signal:u},{fileDirectory:g}=this,d=await this.readRasters(m),w=2**this.fileDirectory.BitsPerSample[0];let p;switch(h){case ee.WhiteIsZero:p=hr(d,w);break;case ee.BlackIsZero:p=gr(d,w);break;case ee.Palette:p=yr(d,g.ColorMap);break;case ee.CMYK:p=mr(d);break;case ee.YCbCr:p=pr(d);break;case ee.CIELab:p=vr(d);break;default:throw new Error("Unsupported photometric interpretation.")}if(!o){const b=new Uint8Array(p.length/3),S=new Uint8Array(p.length/3),v=new Uint8Array(p.length/3);for(let R=0,B=0;R<p.length;R+=3,++B)b[B]=p[R],S[B]=p[R+1],v[B]=p[R+2];p=[b,S,v]}return p.width=d.width,p.height=d.height,p}getTiePoints(){if(!this.fileDirectory.ModelTiepoint)return[];const e=[];for(let o=0;o<this.fileDirectory.ModelTiepoint.length;o+=6)e.push({i:this.fileDirectory.ModelTiepoint[o],j:this.fileDirectory.ModelTiepoint[o+1],k:this.fileDirectory.ModelTiepoint[o+2],x:this.fileDirectory.ModelTiepoint[o+3],y:this.fileDirectory.ModelTiepoint[o+4],z:this.fileDirectory.ModelTiepoint[o+5]});return e}getGDALMetadata(e=null){const o={};if(!this.fileDirectory.GDAL_METADATA)return null;const n=this.fileDirectory.GDAL_METADATA;let i=sr(n,"Item");e===null?i=i.filter(r=>Ge(r,"sample")===void 0):i=i.filter(r=>Number(Ge(r,"sample"))===e);for(let r=0;r<i.length;++r){const c=i[r];o[Ge(c,"name")]=c.inner}return o}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,o=this.fileDirectory.ModelTransformation;if(e&&e.length===6)return[e[3],e[4],e[5]];if(o)return[o[3],o[7],o[11]];throw new Error("The image does not have an affine transformation.")}getResolution(e=null){const o=this.fileDirectory.ModelPixelScale,n=this.fileDirectory.ModelTransformation;if(o)return[o[0],-o[1],o[2]];if(n)return n[1]===0&&n[4]===0?[n[0],-n[5],n[10]]:[Math.sqrt(n[0]*n[0]+n[4]*n[4]),-Math.sqrt(n[1]*n[1]+n[5]*n[5]),n[10]];if(e){const[i,r,c]=e.getResolution();return[i*e.getWidth()/this.getWidth(),r*e.getHeight()/this.getHeight(),c*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 o=this.getHeight(),n=this.getWidth();if(this.fileDirectory.ModelTransformation&&!e){const[i,r,c,s,u,l,h,y]=this.fileDirectory.ModelTransformation,g=[[0,0],[0,o],[n,0],[n,o]].map(([p,b])=>[s+i*p+r*b,y+u*p+l*b]),d=g.map(p=>p[0]),w=g.map(p=>p[1]);return[Math.min(...d),Math.min(...w),Math.max(...d),Math.max(...w)]}else{const i=this.getOrigin(),r=this.getResolution(),c=i[0],s=i[1],u=c+r[0]*n,l=s+r[1]*o;return[Math.min(c,u),Math.min(s,l),Math.max(c,u),Math.max(s,l)]}}}class Nr{constructor(e){this._dataView=new DataView(e)}get buffer(){return this._dataView.buffer}getUint64(e,o){const n=this.getUint32(e,o),i=this.getUint32(e+4,o);let r;if(o){if(r=n+2**32*i,!Number.isSafeInteger(r))throw new Error(`${r} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return r}if(r=2**32*n+i,!Number.isSafeInteger(r))throw new Error(`${r} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return r}getInt64(e,o){let n=0;const i=(this._dataView.getUint8(e+(o?7:0))&128)>0;let r=!0;for(let c=0;c<8;c++){let s=this._dataView.getUint8(e+(o?c:7-c));i&&(r?s!==0&&(s=~(s-1)&255,r=!1):s=~s&255),n+=s*256**c}return i&&(n=-n),n}getUint8(e,o){return this._dataView.getUint8(e,o)}getInt8(e,o){return this._dataView.getInt8(e,o)}getUint16(e,o){return this._dataView.getUint16(e,o)}getInt16(e,o){return this._dataView.getInt16(e,o)}getUint32(e,o){return this._dataView.getUint32(e,o)}getInt32(e,o){return this._dataView.getInt32(e,o)}getFloat16(e,o){return St(this._dataView,e,o)}getFloat32(e,o){return this._dataView.getFloat32(e,o)}getFloat64(e,o){return this._dataView.getFloat64(e,o)}}class Rr{constructor(e,o,n,i){this._dataView=new DataView(e),this._sliceOffset=o,this._littleEndian=n,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,o){return this.sliceOffset<=e&&this.sliceTop>=e+o}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 o=this.readUint32(e),n=this.readUint32(e+4);let i;if(this._littleEndian){if(i=o+2**32*n,!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=2**32*o+n,!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 o=0;const n=(this._dataView.getUint8(e+(this._littleEndian?7:0))&128)>0;let i=!0;for(let r=0;r<8;r++){let c=this._dataView.getUint8(e+(this._littleEndian?r:7-r));n&&(i?c!==0&&(c=~(c-1)&255,i=!1):c=~c&255),o+=c*256**r}return n&&(o=-o),o}readOffset(e){return this._bigTiff?this.readUint64(e):this.readUint32(e)}}class Fr{async fetch(e,o=void 0){return Promise.all(e.map(n=>this.fetchSlice(n,o)))}async fetchSlice(e){throw new Error(`fetching of slice ${e} not possible, not implemented`)}get fileSize(){return null}async close(){}}class $e extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,$e),this.name="AbortError"}}class Br extends Fr{constructor(e){super(),this.arrayBuffer=e}fetchSlice(e,o){if(o&&o.aborted)throw new $e("Request aborted");return this.arrayBuffer.slice(e.offset,e.offset+e.length)}}function Gr(t){return new Br(t)}function Ke(t){switch(t){case F.BYTE:case F.ASCII:case F.SBYTE:case F.UNDEFINED:return 1;case F.SHORT:case F.SSHORT:return 2;case F.LONG:case F.SLONG:case F.FLOAT:case F.IFD:return 4;case F.RATIONAL:case F.SRATIONAL:case F.DOUBLE:case F.LONG8:case F.SLONG8:case F.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${t}`)}}function kr(t){const e=t.GeoKeyDirectory;if(!e)return null;const o={};for(let n=4;n<=e[3]*4;n+=4){const i=dr[e[n]],r=e[n+1]?ve[e[n+1]]:null,c=e[n+2],s=e[n+3];let u=null;if(!r)u=s;else{if(u=t[r],typeof u>"u"||u===null)throw new Error(`Could not get value of geoKey '${i}'.`);typeof u=="string"?u=u.substring(s,s+c-1):u.subarray&&(u=u.subarray(s,s+c),c===1&&(u=u[0]))}o[i]=u}return o}function ye(t,e,o,n){let i=null,r=null;const c=Ke(e);switch(e){case F.BYTE:case F.ASCII:case F.UNDEFINED:i=new Uint8Array(o),r=t.readUint8;break;case F.SBYTE:i=new Int8Array(o),r=t.readInt8;break;case F.SHORT:i=new Uint16Array(o),r=t.readUint16;break;case F.SSHORT:i=new Int16Array(o),r=t.readInt16;break;case F.LONG:case F.IFD:i=new Uint32Array(o),r=t.readUint32;break;case F.SLONG:i=new Int32Array(o),r=t.readInt32;break;case F.LONG8:case F.IFD8:i=new Array(o),r=t.readUint64;break;case F.SLONG8:i=new Array(o),r=t.readInt64;break;case F.RATIONAL:i=new Uint32Array(o*2),r=t.readUint32;break;case F.SRATIONAL:i=new Int32Array(o*2),r=t.readInt32;break;case F.FLOAT:i=new Float32Array(o),r=t.readFloat32;break;case F.DOUBLE:i=new Float64Array(o),r=t.readFloat64;break;default:throw new RangeError(`Invalid field type: ${e}`)}if(e===F.RATIONAL||e===F.SRATIONAL)for(let s=0;s<o;s+=2)i[s]=r.call(t,n+s*c),i[s+1]=r.call(t,n+(s*c+4));else for(let s=0;s<o;++s)i[s]=r.call(t,n+s*c);return e===F.ASCII?new TextDecoder("utf-8").decode(i):i}class Ur{constructor(e,o,n){this.fileDirectory=e,this.geoKeyDirectory=o,this.nextIFDByteOffset=n}}class Fe extends Error{constructor(e){super(`No image at index ${e}`),this.index=e}}class Kr{async readRasters(e={}){const{window:o,width:n,height:i}=e;let{resX:r,resY:c,bbox:s}=e;const u=await this.getImage();let l=u;const h=await this.getImageCount(),y=u.getBoundingBox();if(o&&s)throw new Error('Both "bbox" and "window" passed.');if(n||i){if(o){const[d,w]=u.getOrigin(),[p,b]=u.getResolution();s=[d+o[0]*p,w+o[1]*b,d+o[2]*p,w+o[3]*b]}const g=s||y;if(n){if(r)throw new Error("Both width and resX passed");r=(g[2]-g[0])/n}if(i){if(c)throw new Error("Both width and resY passed");c=(g[3]-g[1])/i}}if(r||c){const g=[];for(let d=0;d<h;++d){const w=await this.getImage(d),{SubfileType:p,NewSubfileType:b}=w.fileDirectory;(d===0||p===2||b&1)&&g.push(w)}g.sort((d,w)=>d.getWidth()-w.getWidth());for(let d=0;d<g.length;++d){const w=g[d],p=(y[2]-y[0])/w.getWidth(),b=(y[3]-y[1])/w.getHeight();if(l=w,r&&r>p||c&&c>b)break}}let m=o;if(s){const[g,d]=u.getOrigin(),[w,p]=l.getResolution(u);m=[Math.round((s[0]-g)/w),Math.round((s[1]-d)/p),Math.round((s[2]-g)/w),Math.round((s[3]-d)/p)],m=[Math.min(m[0],m[2]),Math.min(m[1],m[3]),Math.max(m[0],m[2]),Math.max(m[1],m[3])]}return l.readRasters({...e,window:m})}}class Ze extends Kr{constructor(e,o,n,i,r={}){super(),this.source=e,this.littleEndian=o,this.bigTiff=n,this.firstIFDOffset=i,this.cache=r.cache||!1,this.ifdRequests=[],this.ghostValues=null}async getSlice(e,o){const n=this.bigTiff?4048:1024;return new Rr((await this.source.fetch([{offset:e,length:typeof o<"u"?o:n}]))[0],e,this.littleEndian,this.bigTiff)}async parseFileDirectoryAt(e){const o=this.bigTiff?20:12,n=this.bigTiff?8:2;let i=await this.getSlice(e);const r=this.bigTiff?i.readUint64(e):i.readUint16(e),c=r*o+(this.bigTiff?16:6);i.covers(e,c)||(i=await this.getSlice(e,c));const s={};let u=e+(this.bigTiff?8:2);for(let y=0;y<r;u+=o,++y){const m=i.readUint16(u),g=i.readUint16(u+2),d=this.bigTiff?i.readUint64(u+4):i.readUint32(u+4);let w,p;const b=Ke(g),S=u+(this.bigTiff?12:8);if(b*d<=(this.bigTiff?8:4))w=ye(i,g,d,S);else{const v=i.readOffset(S),R=Ke(g)*d;if(i.covers(v,R))w=ye(i,g,d,v);else{const B=await this.getSlice(v,R);w=ye(B,g,d,v)}}d===1&&lr.indexOf(m)===-1&&!(g===F.RATIONAL||g===F.SRATIONAL)?p=w[0]:p=w,s[ve[m]]=p}const l=kr(s),h=i.readOffset(e+n+o*r);return new Ur(s,l,h)}async requestIFD(e){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(o){throw o instanceof Fe?new Fe(e):o}return this.ifdRequests[e]=(async()=>{const o=await this.ifdRequests[e-1];if(o.nextIFDByteOffset===0)throw new Fe(e);return this.parseFileDirectoryAt(o.nextIFDByteOffset)})(),this.ifdRequests[e]}async getImage(e=0){const o=await this.requestIFD(e);return new Or(o.fileDirectory,o.geoKeyDirectory,this.dataView,this.littleEndian,this.cache,this.source)}async getImageCount(){let e=0,o=!0;for(;o;)try{await this.requestIFD(e),++e}catch(n){if(n instanceof Fe)o=!1;else throw n}return e}async getGhostValues(){const e=this.bigTiff?16:8;if(this.ghostValues)return this.ghostValues;const o="GDAL_STRUCTURAL_METADATA_SIZE=",n=o.length+100;let i=await this.getSlice(e,n);if(o===ye(i,F.ASCII,o.length,e)){const c=ye(i,F.ASCII,n,e).split(`
|
|
3
|
+
>]`),v+=o(R,"</"+r+">"),v>=S)break;b=m}}else m=e(y,"[ /]"+r+">",0);const d=h+r.length+m+1;if(s&&console.log("[xml-utils] end:",d),d===-1)return;const w=i.slice(h,d);let p;return g?p=null:p=w.slice(w.indexOf(">")+1,w.lastIndexOf("<")),{inner:p,outer:w,start:h,end:d}}return Me.exports=n,Me.exports.default=n,Me.exports}var ct;function nr(){if(ct)return Ae.exports;ct=1;const t=ir();function e(o,n,i){const r=[],c=i&&i.debug||!1,s=i&&typeof i.nested=="boolean"?i.nested:!0;let u=i&&i.startIndex||0,l;for(;l=t(o,n,{debug:c,startIndex:u});)s?u=l.start+1+n.length:u=l.end,r.push(l);return c&&console.log("findTagsByName found",r.length,"tags"),r}return Ae.exports=e,Ae.exports.default=e,Ae.exports}var ar=nr();const sr=ut.getDefaultExportFromCjs(ar),ve={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"},ae={};for(const t in ve)ve.hasOwnProperty(t)&&(ae[ve[t]]=parseInt(t,10));const lr=[ae.BitsPerSample,ae.ExtraSamples,ae.SampleFormat,ae.StripByteCounts,ae.StripOffsets,ae.StripRowCounts,ae.TileByteCounts,ae.TileOffsets,ae.SubIFDs],ke={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"},F={};for(const t in ke)ke.hasOwnProperty(t)&&(F[ke[t]]=parseInt(t,10));const ee={WhiteIsZero:0,BlackIsZero:1,RGB:2,Palette:3,CMYK:5,YCbCr:6,CIELab:8},cr={Unspecified:0},ur={AddCompression:1},fr={None:0,Deflate:1,Zstandard:2},dr={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 hr(t,e){const{width:o,height:n}=t,i=new Uint8Array(o*n*3);let r;for(let c=0,s=0;c<t.length;++c,s+=3)r=256-t[c]/e*256,i[s]=r,i[s+1]=r,i[s+2]=r;return i}function gr(t,e){const{width:o,height:n}=t,i=new Uint8Array(o*n*3);let r;for(let c=0,s=0;c<t.length;++c,s+=3)r=t[c]/e*256,i[s]=r,i[s+1]=r,i[s+2]=r;return i}function yr(t,e){const{width:o,height:n}=t,i=new Uint8Array(o*n*3),r=e.length/3,c=e.length/3*2;for(let s=0,u=0;s<t.length;++s,u+=3){const l=t[s];i[u]=e[l]/65536*256,i[u+1]=e[l+r]/65536*256,i[u+2]=e[l+c]/65536*256}return i}function mr(t){const{width:e,height:o}=t,n=new Uint8Array(e*o*3);for(let i=0,r=0;i<t.length;i+=4,r+=3){const c=t[i],s=t[i+1],u=t[i+2],l=t[i+3];n[r]=255*((255-c)/256)*((255-l)/256),n[r+1]=255*((255-s)/256)*((255-l)/256),n[r+2]=255*((255-u)/256)*((255-l)/256)}return n}function pr(t){const{width:e,height:o}=t,n=new Uint8ClampedArray(e*o*3);for(let i=0,r=0;i<t.length;i+=3,r+=3){const c=t[i],s=t[i+1],u=t[i+2];n[r]=c+1.402*(u-128),n[r+1]=c-.34414*(s-128)-.71414*(u-128),n[r+2]=c+1.772*(s-128)}return n}const xr=.95047,Ir=1,wr=1.08883;function vr(t){const{width:e,height:o}=t,n=new Uint8Array(e*o*3);for(let i=0,r=0;i<t.length;i+=3,r+=3){const c=t[i+0],s=t[i+1]<<24>>24,u=t[i+2]<<24>>24;let l=(c+16)/116,h=s/500+l,y=l-u/200,m,g,d;h=xr*(h*h*h>.008856?h*h*h:(h-16/116)/7.787),l=Ir*(l*l*l>.008856?l*l*l:(l-16/116)/7.787),y=wr*(y*y*y>.008856?y*y*y:(y-16/116)/7.787),m=h*3.2406+l*-1.5372+y*-.4986,g=h*-.9689+l*1.8758+y*.0415,d=h*.0557+l*-.204+y*1.057,m=m>.0031308?1.055*m**(1/2.4)-.055:12.92*m,g=g>.0031308?1.055*g**(1/2.4)-.055:12.92*g,d=d>.0031308?1.055*d**(1/2.4)-.055:12.92*d,n[r]=Math.max(0,Math.min(1,m))*255,n[r+1]=Math.max(0,Math.min(1,g))*255,n[r+2]=Math.max(0,Math.min(1,d))*255}return n}const Tt=new Map;function ce(t,e){Array.isArray(t)||(t=[t]),t.forEach(o=>Tt.set(o,e))}async function Sr(t){const e=Tt.get(t.Compression);if(!e)throw new Error(`Unknown compression method identifier: ${t.Compression}`);const o=await e();return new o(t)}ce([void 0,1],()=>Promise.resolve().then(()=>require("./raw-Cm78EGPL.js")).then(t=>t.default));ce(5,()=>Promise.resolve().then(()=>require("./lzw-Cbi9AOTI.js")).then(t=>t.default));ce(6,()=>{throw new Error("old style JPEG compression is not supported.")});ce(7,()=>Promise.resolve().then(()=>require("./jpeg-ClJ__b4h.js")).then(t=>t.default));ce([8,32946],()=>Promise.resolve().then(()=>require("./deflate-DEFE2aFp.js")).then(t=>t.default));ce(32773,()=>Promise.resolve().then(()=>require("./packbits-BXw9Z-3g.js")).then(t=>t.default));ce(34887,()=>Promise.resolve().then(()=>require("./lerc-DTA61BLm.js")).then(async t=>(await t.zstd.init(),t)).then(t=>t.default));ce(50001,()=>Promise.resolve().then(()=>require("./webimage-CCSZWcNO.js")).then(t=>t.default));function Be(t,e,o,n=1){return new(Object.getPrototypeOf(t)).constructor(e*o*n)}function Tr(t,e,o,n,i){const r=e/n,c=o/i;return t.map(s=>{const u=Be(s,n,i);for(let l=0;l<i;++l){const h=Math.min(Math.round(c*l),o-1);for(let y=0;y<n;++y){const m=Math.min(Math.round(r*y),e-1),g=s[h*e+m];u[l*n+y]=g}}return u})}function me(t,e,o){return(1-o)*t+o*e}function br(t,e,o,n,i){const r=e/n,c=o/i;return t.map(s=>{const u=Be(s,n,i);for(let l=0;l<i;++l){const h=c*l,y=Math.floor(h),m=Math.min(Math.ceil(h),o-1);for(let g=0;g<n;++g){const d=r*g,w=d%1,p=Math.floor(d),b=Math.min(Math.ceil(d),e-1),S=s[y*e+p],v=s[y*e+b],R=s[m*e+p],B=s[m*e+b],V=me(me(S,v,w),me(R,B,w),h%1);u[l*n+g]=V}}return u})}function Pr(t,e,o,n,i,r="nearest"){switch(r.toLowerCase()){case"nearest":return Tr(t,e,o,n,i);case"bilinear":case"linear":return br(t,e,o,n,i);default:throw new Error(`Unsupported resampling method: '${r}'`)}}function Lr(t,e,o,n,i,r){const c=e/n,s=o/i,u=Be(t,n,i,r);for(let l=0;l<i;++l){const h=Math.min(Math.round(s*l),o-1);for(let y=0;y<n;++y){const m=Math.min(Math.round(c*y),e-1);for(let g=0;g<r;++g){const d=t[h*e*r+m*r+g];u[l*n*r+y*r+g]=d}}}return u}function Dr(t,e,o,n,i,r){const c=e/n,s=o/i,u=Be(t,n,i,r);for(let l=0;l<i;++l){const h=s*l,y=Math.floor(h),m=Math.min(Math.ceil(h),o-1);for(let g=0;g<n;++g){const d=c*g,w=d%1,p=Math.floor(d),b=Math.min(Math.ceil(d),e-1);for(let S=0;S<r;++S){const v=t[y*e*r+p*r+S],R=t[y*e*r+b*r+S],B=t[m*e*r+p*r+S],V=t[m*e*r+b*r+S],J=me(me(v,R,w),me(B,V,w),h%1);u[l*n*r+g*r+S]=J}}}return u}function Cr(t,e,o,n,i,r,c="nearest"){switch(c.toLowerCase()){case"nearest":return Lr(t,e,o,n,i,r);case"bilinear":case"linear":return Dr(t,e,o,n,i,r);default:throw new Error(`Unsupported resampling method: '${c}'`)}}function Er(t,e,o){let n=0;for(let i=e;i<o;++i)n+=t[i];return n}function Ue(t,e,o){switch(t){case 1:if(e<=8)return new Uint8Array(o);if(e<=16)return new Uint16Array(o);if(e<=32)return new Uint32Array(o);break;case 2:if(e===8)return new Int8Array(o);if(e===16)return new Int16Array(o);if(e===32)return new Int32Array(o);break;case 3:switch(e){case 16:case 32:return new Float32Array(o);case 64:return new Float64Array(o)}break}throw Error("Unsupported data format/bitsPerSample")}function Ar(t,e){return(t===1||t===2)&&e<=32&&e%8===0?!1:!(t===3&&(e===16||e===32||e===64))}function Mr(t,e,o,n,i,r,c){const s=new DataView(t),u=o===2?c*r:c*r*n,l=o===2?1:n,h=Ue(e,i,u),y=parseInt("1".repeat(i),2);if(e===1){let m;o===1?m=n*i:m=i;let g=r*m;(g&7)!==0&&(g=g+7&-8);for(let d=0;d<c;++d){const w=d*g;for(let p=0;p<r;++p){const b=w+p*l*i;for(let S=0;S<l;++S){const v=b+S*i,R=(d*r+p)*l+S,B=Math.floor(v/8),V=v%8;if(V+i<=8)h[R]=s.getUint8(B)>>8-i-V&y;else if(V+i<=16)h[R]=s.getUint16(B)>>16-i-V&y;else if(V+i<=24){const J=s.getUint16(B)<<8|s.getUint8(B+2);h[R]=J>>24-i-V&y}else h[R]=s.getUint32(B)>>32-i-V&y}}}}return h.buffer}class Or{constructor(e,o,n,i,r,c){this.fileDirectory=e,this.geoKeys=o,this.dataView=n,this.littleEndian=i,this.tiles=r?{}:null,this.isTiled=!e.StripOffsets;const s=e.PlanarConfiguration;if(this.planarConfiguration=typeof s>"u"?1:s,this.planarConfiguration!==1&&this.planarConfiguration!==2)throw new Error("Invalid planar configuration.");this.source=c}getFileDirectory(){return this.fileDirectory}getGeoKeys(){return this.geoKeys}getWidth(){return this.fileDirectory.ImageWidth}getHeight(){return this.fileDirectory.ImageLength}getSamplesPerPixel(){return typeof this.fileDirectory.SamplesPerPixel<"u"?this.fileDirectory.SamplesPerPixel:1}getTileWidth(){return this.isTiled?this.fileDirectory.TileWidth:this.getWidth()}getTileHeight(){return this.isTiled?this.fileDirectory.TileLength:typeof this.fileDirectory.RowsPerStrip<"u"?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 o=0;o<this.fileDirectory.BitsPerSample.length;++o)e+=this.getSampleByteSize(o);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 o=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1,n=this.fileDirectory.BitsPerSample[e];switch(o){case 1:if(n<=8)return DataView.prototype.getUint8;if(n<=16)return DataView.prototype.getUint16;if(n<=32)return DataView.prototype.getUint32;break;case 2:if(n<=8)return DataView.prototype.getInt8;if(n<=16)return DataView.prototype.getInt16;if(n<=32)return DataView.prototype.getInt32;break;case 3:switch(n){case 16:return function(i,r){return St(this,i,r)};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,o){const n=this.getSampleFormat(e),i=this.getBitsPerSample(e);return Ue(n,i,o)}async getTileOrStrip(e,o,n,i,r){const c=Math.ceil(this.getWidth()/this.getTileWidth()),s=Math.ceil(this.getHeight()/this.getTileHeight());let u;const{tiles:l}=this;this.planarConfiguration===1?u=o*c+e:this.planarConfiguration===2&&(u=n*c*s+o*c+e);let h,y;this.isTiled?(h=this.fileDirectory.TileOffsets[u],y=this.fileDirectory.TileByteCounts[u]):(h=this.fileDirectory.StripOffsets[u],y=this.fileDirectory.StripByteCounts[u]);const m=(await this.source.fetch([{offset:h,length:y}],r))[0];let g;return l===null||!l[u]?(g=(async()=>{let d=await i.decode(this.fileDirectory,m);const w=this.getSampleFormat(),p=this.getBitsPerSample();return Ar(w,p)&&(d=Mr(d,w,this.planarConfiguration,this.getSamplesPerPixel(),p,this.getTileWidth(),this.getBlockHeight(o))),d})(),l!==null&&(l[u]=g)):g=l[u],{x:e,y:o,sample:n,data:await g}}async _readRaster(e,o,n,i,r,c,s,u,l){const h=this.getTileWidth(),y=this.getTileHeight(),m=this.getWidth(),g=this.getHeight(),d=Math.max(Math.floor(e[0]/h),0),w=Math.min(Math.ceil(e[2]/h),Math.ceil(m/h)),p=Math.max(Math.floor(e[1]/y),0),b=Math.min(Math.ceil(e[3]/y),Math.ceil(g/y)),S=e[2]-e[0];let v=this.getBytesPerPixel();const R=[],B=[];for(let O=0;O<o.length;++O)this.planarConfiguration===1?R.push(Er(this.fileDirectory.BitsPerSample,0,o[O])/8):R.push(0),B.push(this.getReaderForSample(o[O]));const V=[],{littleEndian:J}=this;for(let O=p;O<b;++O)for(let Y=d;Y<w;++Y){let q;this.planarConfiguration===1&&(q=this.getTileOrStrip(Y,O,0,r,l));for(let $=0;$<o.length;++$){const z=$,te=o[$];this.planarConfiguration===2&&(v=this.getSampleByteSize(te),q=this.getTileOrStrip(Y,O,te,r,l));const re=q.then(_=>{const ue=_.data,Ie=new DataView(ue),fe=this.getBlockHeight(_.y),se=_.y*y,de=_.x*h,be=se+fe,a=(_.x+1)*h,f=B[z],I=Math.min(fe,fe-(be-e[3]),g-se),D=Math.min(h,h-(a-e[2]),m-de);for(let T=Math.max(0,e[1]-se);T<I;++T)for(let x=Math.max(0,e[0]-de);x<D;++x){const A=(T*h+x)*v,C=f.call(Ie,A+R[z],J);let k;i?(k=(T+se-e[1])*S*o.length+(x+de-e[0])*o.length+z,n[k]=C):(k=(T+se-e[1])*S+x+de-e[0],n[z][k]=C)}});V.push(re)}}if(await Promise.all(V),c&&e[2]-e[0]!==c||s&&e[3]-e[1]!==s){let O;return i?O=Cr(n,e[2]-e[0],e[3]-e[1],c,s,o.length,u):O=Pr(n,e[2]-e[0],e[3]-e[1],c,s,u),O.width=c,O.height=s,O}return n.width=c||e[2]-e[0],n.height=s||e[3]-e[1],n}async readRasters({window:e,samples:o=[],interleave:n,pool:i=null,width:r,height:c,resampleMethod:s,fillValue:u,signal:l}={}){const h=e||[0,0,this.getWidth(),this.getHeight()];if(h[0]>h[2]||h[1]>h[3])throw new Error("Invalid subsets");const y=h[2]-h[0],m=h[3]-h[1],g=y*m,d=this.getSamplesPerPixel();if(!o||!o.length)for(let S=0;S<d;++S)o.push(S);else for(let S=0;S<o.length;++S)if(o[S]>=d)return Promise.reject(new RangeError(`Invalid sample index '${o[S]}'.`));let w;if(n){const S=this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,v=Math.max.apply(null,this.fileDirectory.BitsPerSample);w=Ue(S,v,g*o.length),u&&w.fill(u)}else{w=[];for(let S=0;S<o.length;++S){const v=this.getArrayForSample(o[S],g);Array.isArray(u)&&S<u.length?v.fill(u[S]):u&&!Array.isArray(u)&&v.fill(u),w.push(v)}}const p=i||await Sr(this.fileDirectory);return await this._readRaster(h,o,w,n,p,r,c,s,l)}async readRGB({window:e,interleave:o=!0,pool:n=null,width:i,height:r,resampleMethod:c,enableAlpha:s=!1,signal:u}={}){const l=e||[0,0,this.getWidth(),this.getHeight()];if(l[0]>l[2]||l[1]>l[3])throw new Error("Invalid subsets");const h=this.fileDirectory.PhotometricInterpretation;if(h===ee.RGB){let b=[0,1,2];if(this.fileDirectory.ExtraSamples!==cr.Unspecified&&s){b=[];for(let S=0;S<this.fileDirectory.BitsPerSample.length;S+=1)b.push(S)}return this.readRasters({window:e,interleave:o,samples:b,pool:n,width:i,height:r,resampleMethod:c,signal:u})}let y;switch(h){case ee.WhiteIsZero:case ee.BlackIsZero:case ee.Palette:y=[0];break;case ee.CMYK:y=[0,1,2,3];break;case ee.YCbCr:case ee.CIELab:y=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const m={window:l,interleave:!0,samples:y,pool:n,width:i,height:r,resampleMethod:c,signal:u},{fileDirectory:g}=this,d=await this.readRasters(m),w=2**this.fileDirectory.BitsPerSample[0];let p;switch(h){case ee.WhiteIsZero:p=hr(d,w);break;case ee.BlackIsZero:p=gr(d,w);break;case ee.Palette:p=yr(d,g.ColorMap);break;case ee.CMYK:p=mr(d);break;case ee.YCbCr:p=pr(d);break;case ee.CIELab:p=vr(d);break;default:throw new Error("Unsupported photometric interpretation.")}if(!o){const b=new Uint8Array(p.length/3),S=new Uint8Array(p.length/3),v=new Uint8Array(p.length/3);for(let R=0,B=0;R<p.length;R+=3,++B)b[B]=p[R],S[B]=p[R+1],v[B]=p[R+2];p=[b,S,v]}return p.width=d.width,p.height=d.height,p}getTiePoints(){if(!this.fileDirectory.ModelTiepoint)return[];const e=[];for(let o=0;o<this.fileDirectory.ModelTiepoint.length;o+=6)e.push({i:this.fileDirectory.ModelTiepoint[o],j:this.fileDirectory.ModelTiepoint[o+1],k:this.fileDirectory.ModelTiepoint[o+2],x:this.fileDirectory.ModelTiepoint[o+3],y:this.fileDirectory.ModelTiepoint[o+4],z:this.fileDirectory.ModelTiepoint[o+5]});return e}getGDALMetadata(e=null){const o={};if(!this.fileDirectory.GDAL_METADATA)return null;const n=this.fileDirectory.GDAL_METADATA;let i=sr(n,"Item");e===null?i=i.filter(r=>Ge(r,"sample")===void 0):i=i.filter(r=>Number(Ge(r,"sample"))===e);for(let r=0;r<i.length;++r){const c=i[r];o[Ge(c,"name")]=c.inner}return o}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,o=this.fileDirectory.ModelTransformation;if(e&&e.length===6)return[e[3],e[4],e[5]];if(o)return[o[3],o[7],o[11]];throw new Error("The image does not have an affine transformation.")}getResolution(e=null){const o=this.fileDirectory.ModelPixelScale,n=this.fileDirectory.ModelTransformation;if(o)return[o[0],-o[1],o[2]];if(n)return n[1]===0&&n[4]===0?[n[0],-n[5],n[10]]:[Math.sqrt(n[0]*n[0]+n[4]*n[4]),-Math.sqrt(n[1]*n[1]+n[5]*n[5]),n[10]];if(e){const[i,r,c]=e.getResolution();return[i*e.getWidth()/this.getWidth(),r*e.getHeight()/this.getHeight(),c*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 o=this.getHeight(),n=this.getWidth();if(this.fileDirectory.ModelTransformation&&!e){const[i,r,c,s,u,l,h,y]=this.fileDirectory.ModelTransformation,g=[[0,0],[0,o],[n,0],[n,o]].map(([p,b])=>[s+i*p+r*b,y+u*p+l*b]),d=g.map(p=>p[0]),w=g.map(p=>p[1]);return[Math.min(...d),Math.min(...w),Math.max(...d),Math.max(...w)]}else{const i=this.getOrigin(),r=this.getResolution(),c=i[0],s=i[1],u=c+r[0]*n,l=s+r[1]*o;return[Math.min(c,u),Math.min(s,l),Math.max(c,u),Math.max(s,l)]}}}class Nr{constructor(e){this._dataView=new DataView(e)}get buffer(){return this._dataView.buffer}getUint64(e,o){const n=this.getUint32(e,o),i=this.getUint32(e+4,o);let r;if(o){if(r=n+2**32*i,!Number.isSafeInteger(r))throw new Error(`${r} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return r}if(r=2**32*n+i,!Number.isSafeInteger(r))throw new Error(`${r} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return r}getInt64(e,o){let n=0;const i=(this._dataView.getUint8(e+(o?7:0))&128)>0;let r=!0;for(let c=0;c<8;c++){let s=this._dataView.getUint8(e+(o?c:7-c));i&&(r?s!==0&&(s=~(s-1)&255,r=!1):s=~s&255),n+=s*256**c}return i&&(n=-n),n}getUint8(e,o){return this._dataView.getUint8(e,o)}getInt8(e,o){return this._dataView.getInt8(e,o)}getUint16(e,o){return this._dataView.getUint16(e,o)}getInt16(e,o){return this._dataView.getInt16(e,o)}getUint32(e,o){return this._dataView.getUint32(e,o)}getInt32(e,o){return this._dataView.getInt32(e,o)}getFloat16(e,o){return St(this._dataView,e,o)}getFloat32(e,o){return this._dataView.getFloat32(e,o)}getFloat64(e,o){return this._dataView.getFloat64(e,o)}}class Rr{constructor(e,o,n,i){this._dataView=new DataView(e),this._sliceOffset=o,this._littleEndian=n,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,o){return this.sliceOffset<=e&&this.sliceTop>=e+o}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 o=this.readUint32(e),n=this.readUint32(e+4);let i;if(this._littleEndian){if(i=o+2**32*n,!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=2**32*o+n,!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 o=0;const n=(this._dataView.getUint8(e+(this._littleEndian?7:0))&128)>0;let i=!0;for(let r=0;r<8;r++){let c=this._dataView.getUint8(e+(this._littleEndian?r:7-r));n&&(i?c!==0&&(c=~(c-1)&255,i=!1):c=~c&255),o+=c*256**r}return n&&(o=-o),o}readOffset(e){return this._bigTiff?this.readUint64(e):this.readUint32(e)}}class Fr{async fetch(e,o=void 0){return Promise.all(e.map(n=>this.fetchSlice(n,o)))}async fetchSlice(e){throw new Error(`fetching of slice ${e} not possible, not implemented`)}get fileSize(){return null}async close(){}}class $e extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,$e),this.name="AbortError"}}class Br extends Fr{constructor(e){super(),this.arrayBuffer=e}fetchSlice(e,o){if(o&&o.aborted)throw new $e("Request aborted");return this.arrayBuffer.slice(e.offset,e.offset+e.length)}}function Gr(t){return new Br(t)}function Ke(t){switch(t){case F.BYTE:case F.ASCII:case F.SBYTE:case F.UNDEFINED:return 1;case F.SHORT:case F.SSHORT:return 2;case F.LONG:case F.SLONG:case F.FLOAT:case F.IFD:return 4;case F.RATIONAL:case F.SRATIONAL:case F.DOUBLE:case F.LONG8:case F.SLONG8:case F.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${t}`)}}function kr(t){const e=t.GeoKeyDirectory;if(!e)return null;const o={};for(let n=4;n<=e[3]*4;n+=4){const i=dr[e[n]],r=e[n+1]?ve[e[n+1]]:null,c=e[n+2],s=e[n+3];let u=null;if(!r)u=s;else{if(u=t[r],typeof u>"u"||u===null)throw new Error(`Could not get value of geoKey '${i}'.`);typeof u=="string"?u=u.substring(s,s+c-1):u.subarray&&(u=u.subarray(s,s+c),c===1&&(u=u[0]))}o[i]=u}return o}function ye(t,e,o,n){let i=null,r=null;const c=Ke(e);switch(e){case F.BYTE:case F.ASCII:case F.UNDEFINED:i=new Uint8Array(o),r=t.readUint8;break;case F.SBYTE:i=new Int8Array(o),r=t.readInt8;break;case F.SHORT:i=new Uint16Array(o),r=t.readUint16;break;case F.SSHORT:i=new Int16Array(o),r=t.readInt16;break;case F.LONG:case F.IFD:i=new Uint32Array(o),r=t.readUint32;break;case F.SLONG:i=new Int32Array(o),r=t.readInt32;break;case F.LONG8:case F.IFD8:i=new Array(o),r=t.readUint64;break;case F.SLONG8:i=new Array(o),r=t.readInt64;break;case F.RATIONAL:i=new Uint32Array(o*2),r=t.readUint32;break;case F.SRATIONAL:i=new Int32Array(o*2),r=t.readInt32;break;case F.FLOAT:i=new Float32Array(o),r=t.readFloat32;break;case F.DOUBLE:i=new Float64Array(o),r=t.readFloat64;break;default:throw new RangeError(`Invalid field type: ${e}`)}if(e===F.RATIONAL||e===F.SRATIONAL)for(let s=0;s<o;s+=2)i[s]=r.call(t,n+s*c),i[s+1]=r.call(t,n+(s*c+4));else for(let s=0;s<o;++s)i[s]=r.call(t,n+s*c);return e===F.ASCII?new TextDecoder("utf-8").decode(i):i}class Ur{constructor(e,o,n){this.fileDirectory=e,this.geoKeyDirectory=o,this.nextIFDByteOffset=n}}class Fe extends Error{constructor(e){super(`No image at index ${e}`),this.index=e}}class Kr{async readRasters(e={}){const{window:o,width:n,height:i}=e;let{resX:r,resY:c,bbox:s}=e;const u=await this.getImage();let l=u;const h=await this.getImageCount(),y=u.getBoundingBox();if(o&&s)throw new Error('Both "bbox" and "window" passed.');if(n||i){if(o){const[d,w]=u.getOrigin(),[p,b]=u.getResolution();s=[d+o[0]*p,w+o[1]*b,d+o[2]*p,w+o[3]*b]}const g=s||y;if(n){if(r)throw new Error("Both width and resX passed");r=(g[2]-g[0])/n}if(i){if(c)throw new Error("Both width and resY passed");c=(g[3]-g[1])/i}}if(r||c){const g=[];for(let d=0;d<h;++d){const w=await this.getImage(d),{SubfileType:p,NewSubfileType:b}=w.fileDirectory;(d===0||p===2||b&1)&&g.push(w)}g.sort((d,w)=>d.getWidth()-w.getWidth());for(let d=0;d<g.length;++d){const w=g[d],p=(y[2]-y[0])/w.getWidth(),b=(y[3]-y[1])/w.getHeight();if(l=w,r&&r>p||c&&c>b)break}}let m=o;if(s){const[g,d]=u.getOrigin(),[w,p]=l.getResolution(u);m=[Math.round((s[0]-g)/w),Math.round((s[1]-d)/p),Math.round((s[2]-g)/w),Math.round((s[3]-d)/p)],m=[Math.min(m[0],m[2]),Math.min(m[1],m[3]),Math.max(m[0],m[2]),Math.max(m[1],m[3])]}return l.readRasters({...e,window:m})}}class Ze extends Kr{constructor(e,o,n,i,r={}){super(),this.source=e,this.littleEndian=o,this.bigTiff=n,this.firstIFDOffset=i,this.cache=r.cache||!1,this.ifdRequests=[],this.ghostValues=null}async getSlice(e,o){const n=this.bigTiff?4048:1024;return new Rr((await this.source.fetch([{offset:e,length:typeof o<"u"?o:n}]))[0],e,this.littleEndian,this.bigTiff)}async parseFileDirectoryAt(e){const o=this.bigTiff?20:12,n=this.bigTiff?8:2;let i=await this.getSlice(e);const r=this.bigTiff?i.readUint64(e):i.readUint16(e),c=r*o+(this.bigTiff?16:6);i.covers(e,c)||(i=await this.getSlice(e,c));const s={};let u=e+(this.bigTiff?8:2);for(let y=0;y<r;u+=o,++y){const m=i.readUint16(u),g=i.readUint16(u+2),d=this.bigTiff?i.readUint64(u+4):i.readUint32(u+4);let w,p;const b=Ke(g),S=u+(this.bigTiff?12:8);if(b*d<=(this.bigTiff?8:4))w=ye(i,g,d,S);else{const v=i.readOffset(S),R=Ke(g)*d;if(i.covers(v,R))w=ye(i,g,d,v);else{const B=await this.getSlice(v,R);w=ye(B,g,d,v)}}d===1&&lr.indexOf(m)===-1&&!(g===F.RATIONAL||g===F.SRATIONAL)?p=w[0]:p=w,s[ve[m]]=p}const l=kr(s),h=i.readOffset(e+n+o*r);return new Ur(s,l,h)}async requestIFD(e){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(o){throw o instanceof Fe?new Fe(e):o}return this.ifdRequests[e]=(async()=>{const o=await this.ifdRequests[e-1];if(o.nextIFDByteOffset===0)throw new Fe(e);return this.parseFileDirectoryAt(o.nextIFDByteOffset)})(),this.ifdRequests[e]}async getImage(e=0){const o=await this.requestIFD(e);return new Or(o.fileDirectory,o.geoKeyDirectory,this.dataView,this.littleEndian,this.cache,this.source)}async getImageCount(){let e=0,o=!0;for(;o;)try{await this.requestIFD(e),++e}catch(n){if(n instanceof Fe)o=!1;else throw n}return e}async getGhostValues(){const e=this.bigTiff?16:8;if(this.ghostValues)return this.ghostValues;const o="GDAL_STRUCTURAL_METADATA_SIZE=",n=o.length+100;let i=await this.getSlice(e,n);if(o===ye(i,F.ASCII,o.length,e)){const c=ye(i,F.ASCII,n,e).split(`
|
|
4
4
|
`)[0],s=Number(c.split("=")[1].split(" ")[0])+c.length;s>n&&(i=await this.getSlice(e,s));const u=ye(i,F.ASCII,s,e);this.ghostValues={},u.split(`
|
|
5
|
-
`).filter(l=>l.length>0).map(l=>l.split("=")).forEach(([l,h])=>{this.ghostValues[l]=h})}return this.ghostValues}static async fromSource(e,o,n){const i=(await e.fetch([{offset:0,length:1024}],n))[0],r=new Nr(i),c=r.getUint16(0,0);let s;if(c===18761)s=!0;else if(c===19789)s=!1;else throw new TypeError("Invalid byte order value.");const u=r.getUint16(2,s);let l;if(u===42)l=!1;else if(u===43){if(l=!0,r.getUint16(4,s)!==8)throw new Error("Unsupported offset byte-size.")}else throw new TypeError("Invalid magic number.");const h=l?r.getUint64(8,s):r.getUint32(4,s);return new Ze(e,s,l,h,o)}close(){return typeof this.source.close=="function"?this.source.close():!1}}async function Vr(t,e){return Ze.fromSource(Gr(t),e)}function jr(t){const e=U.ref([]);let o=null,n={min:null,max:null,originalMin:null,originalMax:null,bounds:[]};async function i(l,h=["#000000","#FFFFFF"]){console.log("Adding TIF layer with URL/File:",l,h);const y=`tif-layer-${new Date().getTime()}`;if(l instanceof File){const m=await N.readFileAsArrayBuffer(l);await r(m,h,y),e.value.push(y)}else if(typeof l=="string"){const g=await(await fetch(l)).arrayBuffer();await r(g,h,y),e.value.push(y)}return{tifId:y,dataRange:n}}async function r(l,h=["#000000","#FFFFFF"],y="geotiff-layer"){var O;const g=await(await Vr(l)).getImage(),d=g.getWidth(),w=g.getHeight(),p=g.fileDirectory||{};console.log("fileDirectory",p);const b=parseInt(p.GDAL_NODATA);console.log("GDAL_NODATA",typeof b,b);const S=N.calculateBounds(g),v=await g.readRasters();o={image:g,data:v,width:d,height:w},console.log("GeoTIFF data loaded:",o);const R=Array.isArray(v)?v:[v];let B=1/0,V=-1/0;for(const Y of R)for(const q of Y)q>-1e10&&q!=b&&(B=Math.min(B,q),V=Math.max(V,q));(!isFinite(B)||!isFinite(V)||B>=V)&&(console.warn("无效的数据范围,使用默认值"),B=0,V=255),n={min:B,max:V,originalMin:B,originalMax:V,bounds:S},console.log("Data range calculated:",n);const J=u(v,d,w,h,b);if(!J){console.error("Failed to create image data from GeoTIFF.");return}c(J,d,w,S,y),(O=t.value)==null||O.fitBounds([[S[0],S[1]],[S[2],S[3]]],{padding:50})}function c(l,h,y,m,g="geotiff-layer"){var v,R,B,V;const d=g,w=g+"-source";(v=t.value)!=null&&v.getLayer(d)&&t.value.removeLayer(d),(R=t.value)!=null&&R.getSource(w)&&t.value.removeSource(w);const p=document.createElement("canvas");p.width=h,p.height=y;const b=p.getContext("2d");b==null||b.putImageData(l,0,0);const S=p.toDataURL("image/png");(B=t.value)==null||B.addSource(w,{type:"image",url:S,coordinates:[[m[0],m[3]],[m[2],m[3]],[m[2],m[1]],[m[0],m[1]]]}),(V=t.value)==null||V.addLayer({id:d,type:"raster",source:w,paint:{"raster-opacity":.8}})}function s(l){var g,d;const h=l,y=l+"-source";(g=t.value)!=null&&g.getLayer(h)&&t.value.removeLayer(h),(d=t.value)!=null&&d.getSource(y)&&t.value.removeSource(y);const m=e.value.indexOf(l);m!==-1&&e.value.splice(m,1)}function u(l,h,y,m,g=null){const d=document.createElement("canvas");d.width=h,d.height=y;const w=d.getContext("2d"),p=w==null?void 0:w.createImageData(h,y),b=Array.isArray(l)?l:[l],S=h*y;let v=n.min,R=n.max;(v===null||R===null)&&(v=0,R=255);const B=m.map(N.hexToRgb),V=B.length;function J(O){if(V===1||O<=0)return B[0];if(O>=1)return B[V-1];const Y=1/(V-1),q=Math.floor(O/Y),$=(O-q*Y)/Y,z=B[q],te=B[Math.min(q+1,V-1)];return[Math.round(z[0]+(te[0]-z[0])*$),Math.round(z[1]+(te[1]-z[1])*$),Math.round(z[2]+(te[2]-z[2])*$)]}for(let O=0;O<S;O++){let Y,q,$,z;const te=b[0][O];if(g!==null&&te===g)Y=q=$=0,z=0;else if(b.length>=3)g!==null&&(b[0][O]===g||b[1][O]===g||b[2][O]===g)?(Y=q=$=0,z=0):(Y=Math.floor(255*N.clamp((b[0][O]-v)/(R-v),0,1)),q=Math.floor(255*N.clamp((b[1][O]-v)/(R-v),0,1)),$=Math.floor(255*N.clamp((b[2][O]-v)/(R-v),0,1)),z=255);else if(b.length===1){const re=b[0][O];if(re<v)z=0,Y=q=$=0;else if(re>R)Y=255,q=$=0,z=255;else{const _=(re-v)/(R-v),ue=.15,Ie=(_-ue)/(1-ue);[Y,q,$]=J(Ie),z=255}}else{const _=(b[0][O]-v)/(R-v);_<.15?(Y=q=$=0,z=0):(Y=q=$=Math.floor(255*(_-.15)/.85),z=255)}p.data[O*4]=Y,p.data[O*4+1]=q,p.data[O*4+2]=$,p.data[O*4+3]=z}return w==null||w.putImageData(p,0,0),p}return{addTifLayer:i,processGeoTIFF:r,removeTifLayer:s}}const qr=["id"],zr={class:"left-bar"},Yr={class:"right-bar"},$r={class:"bottom-bar"},Zr=U.defineComponent({name:"MapView",__name:"MapView",props:{mapRootId:{default:"mapbox-map"},tdtToken:{},mapBoxToken:{},maxZoom:{default:17},minZoom:{default:3},zoom:{default:10},pitch:{default:60},hasScale:{type:Boolean,default:!0},scalePosition:{default:"bottom-right"},center:{},dbfDataRequest:{type:Function},researchDataRequest:{type:Function},dialogConfig:{default:()=>({center:!1,top:"50px",customClass:"hiper-map-dialog"})},loadIcon:{type:Boolean,default:!0}},emits:["mapReady"],setup(t,{expose:e,emit:o}){const n=U.useTemplateRef("mapRoot"),i=Pt.useMapStore();t.dialogConfig&&i.setDialogConfig(t.dialogConfig);const r=U.ref(),{addTifLayer:c,processGeoTIFF:s,removeTifLayer:u}=jr(r),l=o,h=()=>{var f;ge.accessToken=t.mapBoxToken;const a=i.mapInstances[t.mapRootId];if(r.value=new ge.Map({container:t.mapRootId,style:i.getCurrentMapStyle(t.mapRootId),center:a.center,zoom:a.zoom,pitch:a.pitch,bearing:0,antialias:!0,maxZoom:a.maxZoom,minZoom:a.minZoom,attributionControl:!1}),r.value.on("load",()=>{r.value&&($(),l("mapReady",r.value)),le.mapLoadedBus.emit({mapRootId:t.mapRootId})}),r.value.on("zoomend",()=>{var I;i.setZoom(t.mapRootId,((I=r.value)==null?void 0:I.getZoom())||0)}),t.hasScale){const I=new ge.ScaleControl({maxWidth:80,unit:"metric"});(f=r.value)==null||f.addControl(I,t.scalePosition)}r.value.on("load",()=>{})},y=()=>{var a,f;(a=r.value)==null||a.setStyle(i.getCurrentMapStyle(t.mapRootId)),(f=r.value)==null||f.once("styledata",()=>{console.log("地图样式更新完成,重新加载图层"),d.value.forEach(I=>{w(I)}),le.mapStyleChangedBus.emit({mapRootId:t.mapRootId})})},m=U.ref(!1),g=()=>{if(r.value){const a=i.mapInstances[t.mapRootId];m.value=!0,r.value.flyTo({center:a.center,zoom:a.zoom,bearing:0,pitch:a.threeDPitch,duration:2e3}),a.is3DMode=a.threeDPitch>0,a.pitch=a.threeDPitch,setTimeout(()=>{m.value=!1},2e3)}},d=U.ref([]),w=a=>{var I;if(!r.value){console.warn("地图实例未初始化,无法添加图层");return}const f=d.value.find(D=>D.id===a.id);if(f?Object.assign(f,a):d.value.push(a),a.geoJSON)console.log("渲染geoJSON---->"),b(a);else{const D=N.getLayerId(a);((I=r.value)==null?void 0:I.getLayer(D))==null?(console.log("首次渲染---->"),S(a)):(console.log("非首次渲染---->更新图层"),p(a,JSON.parse(a.layerPaintConfig)))}};function p(a,f){var k,P,M,G,E,L,j,Z,Q,H,oe,we,he,Xe,Je,He,Qe,We;f.fillColorList&&f.fillColorList.length&&(f.fillColorList=f.fillColorList.filter(K=>K.key&&K.value||K.type=="default"));const I=N.getLayerType(a);console.log("currentLayerType--->",I);const D=JSON.parse(JSON.stringify(f));console.log("newStyleConfig---->",D);const T=N.getFillStyle(D);console.log("newFillColorConfig---->",T);const x=N.getOutLineStyle(D);if(console.log("outlineStyle---->",x),I=="fill"&&T&&x)(k=r.value)==null||k.setPaintProperty(N.getLayerId(a),"fill-color",T["fill-color"]),(P=r.value)==null||P.setPaintProperty(N.getLayerId(a),"fill-opacity",T["fill-opacity"]),(M=r.value)==null||M.setPaintProperty(N.getLayerId(a),"fill-outline-color",T["fill-outline-color"]),x&&x["line-color"]&&((G=r.value)==null||G.setPaintProperty(N.getLayerId(a)+"-outline","line-color",x["line-color"])),x&&x["line-opacity"],x&&x["line-width"]&&((E=r.value)==null||E.setPaintProperty(N.getLayerId(a)+"-outline","line-width",x["line-width"])),(L=r.value)==null||L.setPaintProperty(N.getLayerId(a)+"-outline","line-dasharray",[]),x&&x["line-dasharray"]&&(console.log("outlineStyle['line-dasharray']----->",x["line-dasharray"]),(j=r.value)==null||j.setPaintProperty(N.getLayerId(a)+"-outline","line-dasharray",x["line-dasharray"]));else if(I=="line")x&&x["line-color"]&&((Z=r.value)==null||Z.setPaintProperty(N.getLayerId(a),"line-color",x["line-color"])),x&&x["line-opacity"]&&((Q=r.value)==null||Q.setPaintProperty(N.getLayerId(a),"line-opacity",x["line-opacity"])),x&&x["line-width"]&&((H=r.value)==null||H.setPaintProperty(N.getLayerId(a),"line-width",x["line-width"])),(oe=r.value)==null||oe.setPaintProperty(N.getLayerId(a),"line-dasharray",[]),x&&x["line-dasharray"]&&((we=r.value)==null||we.setPaintProperty(N.getLayerId(a),"line-dasharray",x["line-dasharray"]));else if(I=="circle"){const K=N.getCircleStyle(D);K&&K["circle-color"]&&((he=r.value)==null||he.setPaintProperty(N.getLayerId(a),"circle-color",K["circle-color"])),K&&K["circle-opacity"]&&((Xe=r.value)==null||Xe.setPaintProperty(N.getLayerId(a),"circle-opacity",K["circle-opacity"])),K&&K["circle-radius"]&&((Je=r.value)==null||Je.setPaintProperty(N.getLayerId(a),"circle-radius",K["circle-radius"])),K&&K["circle-stroke-color"]&&((He=r.value)==null||He.setPaintProperty(N.getLayerId(a),"circle-stroke-color",K["circle-stroke-color"])),K&&K["circle-stroke-width"]&&((Qe=r.value)==null||Qe.setPaintProperty(N.getLayerId(a),"circle-stroke-width",K["circle-stroke-width"]))}else if(I=="symbol"){const K=N.getCircleStyle(D);K&&K["icon-image"]&&((We=r.value)==null||We.setLayoutProperty(N.getLayerId(a),"icon-image",K["icon-image"]))}const A=[];let{symbolConfigList:C}=D;C=C.filter(K=>K.fontSize&&K.field&&K.textColor),C.forEach((K,Jr)=>{var _e,et,tt,rt;const Pe="points-symbol-"+a.id+K.field,bt=N.getSourceId(a);((_e=r.value)==null?void 0:_e.getLayer(Pe))?((tt=r.value)==null||tt.setLayoutProperty(Pe,"text-size",K.fontSize),(rt=r.value)==null||rt.setPaintProperty(Pe,"text-color",K.textColor)):((et=r.value)==null||et.addLayer({id:Pe,type:"symbol",source:bt,layout:{visibility:"visible","text-field":["get",K.field],"text-size":K.fontSize,"symbol-avoid-edges":!0,"icon-image":"circle-11","text-ignore-placement":!1,"text-max-angle":38},paint:{"text-color":K.textColor}}),A.push(K.field))})}function b(a){var x,A,C,k,P,M,G,E,L,j;if(!a.customLayerConfig||!a.geoJSON){console.warn("图层配置缺失,无法渲染图层");return}const f=JSON.parse(a.customLayerConfig),I=N.getLayerId(a);((x=r.value)==null?void 0:x.getLayer(I))!==void 0&&(console.warn(`图层 ${I} 已存在,无法重复添加`),(A=r.value)==null||A.removeLayer(I),(C=r.value)==null||C.removeSource(I));const T=JSON.parse(a.geoJSON);switch(a.layerType){case"symbol":const Z={id:I,type:"symbol",source:{type:"geojson",data:{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"Point",coordinates:T.features[0].geometry.coordinates},properties:{title:a.layerName||f.iconName,icon:`${f.iconName}`}}]}},layout:{"icon-image":"{icon}","icon-size":.1,"icon-anchor":"center","text-field":"{title}","text-font":["Open Sans Semibold","Arial Unicode MS Bold"],"text-offset":[0,1.8],"text-anchor":"center","text-size":12,"text-allow-overlap":!0,"text-optional":!0},paint:{"text-color":f.textColor,"text-halo-color":"rgba(0,0,0,0.32)","text-halo-width":1,"text-halo-blur":2,"text-translate":[0,0]}};(k=r.value)==null||k.addLayer(Z);break;case"line":const Q={id:I,type:"line",source:{type:"geojson",data:T},layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":f.lineColor,"line-width":Number(f.lineWidth)}};f.lineStyle=="dotted"&&(Q.paint["line-dasharray"]=[5.2,5.2]),(P=r.value)==null||P.addLayer(Q);break;case"shape":let H=I+"-outline";const oe={id:H,type:"line",source:{type:"geojson",data:JSON.parse(a.geoJSON)},layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":f.fillColor,"line-width":Number(f.lineWidth)}};((M=r.value)==null?void 0:M.getLayer(H))!==void 0&&((G=r.value)==null||G.removeLayer(H),(E=r.value)==null||E.removeSource(H)),(L=r.value)==null||L.addLayer(oe);const he={id:I,type:"fill",source:{type:"geojson",data:T},layout:{},paint:{"fill-color":f.fillColor,"fill-opacity":.32}};(j=r.value)==null||j.addLayer(he);break}}function S(a){var C,k,P,M,G;console.log("加载图层---->",a);const f=N.getLayerId(a),I=N.getSourceId(a);console.log("sourceId--->",I);const D=N.parseStyleConfig(a);console.log("styleConfig",D);const T=N.getLayerType(a);((C=r.value)==null?void 0:C.getSource(I))||(P=r.value)==null||P.addSource(I,{type:"geojson",data:(k=a.url)==null?void 0:k.replace("bjhweb","bjh")}),console.log("layerType--->",T);const A={id:f,source:I,name:f,layout:{visibility:"visible"},type:T};if(T!="symbol")A.paint=N.getLayerStyle(a);else{const E=N.getLayerStyle(a);A.layout={visibility:"visible","symbol-placement":"line","symbol-spacing":10,"icon-size":.1,"icon-keep-upright":!0,"icon-rotate":0,"icon-allow-overlap":!0,...E}}if(console.log("layerConfig--->",A),(M=r.value)==null||M.addLayer(A),T=="fill"){const E=N.getOutLineStyle(D);(G=r.value)==null||G.addLayer({id:f+"-outline",source:I,name:f+"-outline",layout:{visibility:"visible","line-join":"round","line-cap":"round"},type:"line",paint:{"line-color":E["line-color"],"line-width":E["line-width"],"line-dasharray":E["line-dasharray"]||[]}})}}const v=U.ref([]);function R(a){if(!r.value){console.warn("地图实例未初始化,无法添加调查数据图层");return}q(a);const f=a.pointInfo?a.pointInfo:JSON.parse(a.rowDataInstance??"{}");let I=null;if(f.latitude&&f.longitude&&(I=[parseFloat(f.longitude),parseFloat(f.latitude)]),f.latitudeStart&&f.longitudeStart&&(I=[parseFloat(f.longitudeStart),parseFloat(f.latitudeStart)]),a.layerType=="line"){const D={outlineColor:"#02d2e0",outlineWidth:3};let T=a.layerPaintConfig?JSON.parse(a.layerPaintConfig):D;if(!a.lineInfo){console.error("调查数据缺失,无法添加线图层");return}const x=a.lineInfo;let A=[];I&&I.length&&A.push(I),x.forEach(L=>{A.push([Number(L.longitude),Number(L.latitude)])});const k={type:"geojson",data:{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"LineString",coordinates:A}}]}},P=`${a.id}-geo-line-source`,M=r.value.getSource(P),G=`${a.id}-geo-line-layer`,E=r.value.getLayer(G);if(A.length>0){M||r.value.addSource(P,k),E&&r.value.removeLayer(G);let L={"line-color":T.outlineColor,"line-width":T.outlineWidth,"line-opacity":1};switch(T.outlineStyle){case"simple-dash":L["line-dasharray"]=[2,2];break;case"dot-dash":L["line-dasharray"]=[1,2,3,2];break;case"long-dash":L["line-dasharray"]=[4,2];break;case"dot-line":L["line-dasharray"]=[.1,2];break;case"complex-pattern":L["line-dasharray"]=[2,2,1,2];break}r.value.addLayer({id:G,type:"line",source:P,paint:L})}r.value.easeTo({zoom:17,center:A[0]})}else{const D={pointTintColor:"#02d2e0",pointRenderType:"points"};let T=a.layerPaintConfig?JSON.parse(a.layerPaintConfig):D;if(console.log("走这里---->",a),!a.lineInfo){console.error("调查数据缺失,无法添加点图层");return}if(!r.value){console.warn("地图实例未初始化,无法添加点图层");return}a.lineInfo.forEach(x=>{var E;let A=[0,0];x.latitude&&x.longitude&&(A=[Number(x.longitude),Number(x.latitude)]),x.latitudeStart&&x.longitudeStart&&(A=[Number(x.longitudeStart),Number(x.latitudeStart)]),console.log("layerPaintConfig.pointRenderType ",T);const C=document.createElement("div");if(T.pointRenderType=="icons"){C.className="research-location-icon-el";const L=document.createElement("img");L.className="research-location-img-el",L.src=Le.mapIconBaseUrl+T.currentMapIconName,C.appendChild(L)}else{C.className="research-location-point";const L=document.createElement("div");L.className="research-location-point-content",C.appendChild(L);const j=document.createElement("div");j.className="research-location-point-content-inner",j.style.backgroundColor=T.pointTintColor?T.pointTintColor:"#02d2e0",L.appendChild(j);const Z=document.createElement("div");Z.className="research-location-point-line",C.appendChild(Z)}C.onclick=L=>{Y(L,JSON.parse(a.rowDataInstance??"{}"))};const k=`${a.id}-research-point`,P=v.value.find(L=>L.id==k);P&&P.marker&&((E=P.marker)==null||E.remove());let M=new ge.Marker(C).setLngLat(A).setOffset([0,-22]).addTo(r.value),G=-1;v.value.forEach((L,j)=>{L.id==k&&(G=j)}),G>-1?v.value[G].marker=M:v.value.push({id:k,marker:M})})}J()}const B=U.ref(),V=U.ref();function J(){B.value&&B.value.hidePopup(),V.value&&V.value.hidePopup(),O.value&&O.value.hidePopup()}const O=U.ref();function Y(a,f){const{clientX:I,clientY:D}=a,T=I+28,x=D-60;O.value.showPopup(T,x,f)}function q(a){const f=d.value.find(I=>I.id===a.id);f?Object.assign(f,a):d.value.push(a)}function $(){if(!t.loadIcon)return Promise.resolve(!0);if(!r.value)return Promise.reject(new Error("地图实例未初始化,无法加载图标资源"));const a=Le.mapIconNameList.map(f=>new Promise((I,D)=>{var T;(T=r.value)==null||T.loadImage(Le.mapIconBaseUrl+f.fileName,(x,A)=>{var C;x?D(x):(A&&((C=r.value)==null||C.addImage(f.fileName,A)),I(!0))})}));return Promise.all(a)}function z(a){var x,A,C,k,P,M,G,E;console.log("removeThirdPartyLayer---->",a);const f=N.getLayerId(a),I=N.getLayerType(a),D=(x=r.value)==null?void 0:x.getLayer(f);console.log("currentLayerType---->",I,D);let T=-1;if(d.value.forEach((L,j)=>{L.id==a.id&&(T=j)}),T>-1&&d.value.splice(T,1),D){const L=(A=r.value)==null?void 0:A.getLayer(f);if(L){const j=L.source;(C=r.value)==null||C.removeLayer(f),a.geoJSON&&j&&((k=r.value)==null||k.removeSource(j))}}if(I=="fill"){console.log("移除边框----->");const L=f+"-outline",j=(P=r.value)==null?void 0:P.getLayer(L),Z=(M=r.value)==null?void 0:M.getLayer(L);if(Z){const Q=Z.source;j&&((G=r.value)==null||G.removeLayer(L)),a.geoJSON&&Q&&((E=r.value)==null||E.removeSource(Q))}}J()}U.watch(()=>{var a;return(a=i.mapInstances[t.mapRootId])==null?void 0:a.activeMapLayer},()=>{r.value&&y()},{immediate:!0}),U.watch(()=>{var a;return(a=i.mapInstances[t.mapRootId])==null?void 0:a.zoom},()=>{r.value&&!m.value&&r.value.flyTo({zoom:i.mapInstances[t.mapRootId].zoom,duration:500})},{immediate:!0}),U.watch(()=>{var a;return(a=i.mapInstances[t.mapRootId])==null?void 0:a.pitch},()=>{r.value&&!m.value&&(i.isDragging?r.value.setPitch(i.mapInstances[t.mapRootId].pitch):r.value.flyTo({pitch:i.mapInstances[t.mapRootId].pitch,duration:1e3}))},{immediate:!0}),U.watch(()=>{var a;return(a=i.mapInstances[t.mapRootId])==null?void 0:a.bearing},()=>{r.value&&!m.value&&(i.isDragging?r.value.setBearing(i.mapInstances[t.mapRootId].bearing):r.value.flyTo({bearing:i.mapInstances[t.mapRootId].bearing,duration:1e3}))},{immediate:!0});const te=a=>{r.value&&(r.value.flyTo({zoom:4,duration:400}),setTimeout(async()=>{var T,x,A,C,k;if(!a)return;let f=N.getSourceId(a);if(a.geoJSON&&(f=N.getLayerId(a)),a.url&&!a.geoJSON)try{const P=a.url.replace("bjhweb","bjh"),G=await(await fetch(P)).json();if(G&&G.features&&G.features.length>0){const E=Ce.bbox(G);if(E&&!re(E)){(T=r.value)==null||T.fitBounds([[E[0],E[1]],[E[2],E[3]]],{padding:{top:50,bottom:50,left:50,right:50}});return}}}catch(P){console.warn("从URL获取GeoJSON数据失败,尝试其他方法",P)}const I=(x=r.value)==null?void 0:x.getSource(f);if(I&&I._data&&I._data.features){const P=I._data,M=Ce.bbox(P);if(!re(M)){(A=r.value)==null||A.fitBounds([[M[0],M[1]],[M[2],M[3]]],{padding:{top:50,bottom:50,left:50,right:50}});return}}const D=(C=r.value)==null?void 0:C.querySourceFeatures(f);if(D&&D.length>0){const P=Ce.featureCollection(D),M=Ce.bbox(P);re(M)?console.warn("获取的边界框无效"):(k=r.value)==null||k.fitBounds([[M[0],M[1]],[M[2],M[3]]],{padding:{top:50,bottom:50,left:50,right:50}})}else console.warn("没有查询到图层数据")},500))};function re(a){return a[0]===1/0||a[1]===1/0||a[2]===-1/0||a[3]===-1/0||isNaN(a[0])||isNaN(a[1])||isNaN(a[2])||isNaN(a[3])}U.provide("resetMapView",g),U.provide("mapRootId",t.mapRootId),t.dbfDataRequest&&U.provide(De.dbfDataRequestKey,t.dbfDataRequest),t.researchDataRequest&&U.provide(De.researchDataRequestKey,t.researchDataRequest),U.provide(De.mapInstanceKey,r),U.provide(De.thirdPartyLayersKey,d);const _=({mapRootId:a,layer:f})=>{a===a&&(console.log("接收到渲染地理数据事件",f),f.layerDataType=="research"&&w(f))};le.renderGeographicDataKeyBus.on(_),e({mapInstance:r,initMap:h,handleSetMapStyle:y,resetMapView:g,addThirdPartyLayer:w,addResearchMapLayer:R,addTifLayer:c,processGeoTIFF:s,removeTifLayer:u}),U.onBeforeMount(()=>{i.mapInstances[t.mapRootId]={maxZoom:t.maxZoom,minZoom:t.minZoom,zoom:t.zoom,pitch:t.pitch,threeDPitch:t.pitch,center:t.center||[120.1551,30.2741],bearing:0,is3DMode:t.pitch>0,activeMapLayer:Lt.MapLayerType.SATELLITE,mapHeight:600,mapWidth:600,mapX:0,mapY:0}});function ue(a){var D,T,x,A;q(a);const f={outlineColor:"#02d2e0",outlineWidth:3,outlineOpacity:.72,pointTintColor:"#02d2e0"};let I=a.layerPaintConfig?JSON.parse(a.layerPaintConfig):f;if(console.log("layerPaintConfig--->",I),I.pointRenderType&&I.pointRenderType=="heatMap"){let C=a.id+"-source",k=a.id+"-layer",P=[];a.children&&a.children.forEach(M=>{let G=[0,0];const E=JSON.parse(M.rowDataInstance);E.latitude&&E.longitude&&(G=[Number(E.longitude),Number(E.latitude)]),E.latitudeStart&&E.longitudeStart&&(G=[Number(E.longitudeStart),Number(E.latitudeStart)]),P.push({type:"Feature",properties:{},geometry:{type:"Point",coordinates:G}})}),(D=r.value)==null||D.addSource(C,{type:"geojson",data:{type:"FeatureCollection",features:P}}),(T=r.value)==null||T.addLayer({id:k,type:"heatmap",source:C,maxzoom:9,paint:{"heatmap-weight":1,"heatmap-intensity":["interpolate",["linear"],["zoom"],0,1,9,3],"heatmap-color":["interpolate",["linear"],["heatmap-density"],0,"rgba(33,102,172,0)",.2,"blue",.4,"cyan",.6,"lime",.8,"yellow",1,"red"],"heatmap-radius":["interpolate",["linear"],["zoom"],0,2,9,20],"heatmap-opacity":["interpolate",["linear"],["zoom"],7,1,9,0]}})}else I.pointRenderType&&I.pointRenderType=="icons"?(console.log("走这里----->, icons",v.value),console.log("mapLayer.children",a.children),(x=a.children)==null||x.forEach(C=>{var j;let k=[0,0];const P=JSON.parse(C.rowDataInstance);P.latitude&&P.longitude&&(k=[Number(P.longitude),Number(P.latitude)]),P.latitudeStart&&P.longitudeStart&&(k=[Number(P.longitudeStart),Number(P.latitudeStart)]);const M=document.createElement("div");M.className="research-location-icon-el";const G=document.createElement("img");G.className="research-location-img-el",G.src=Le.mapIconBaseUrl+I.currentMapIconName,M.appendChild(G);const E=`${C.id}-research-point`,L=v.value.find(Z=>Z.id==E);if(L&&L.marker&&((j=L.marker)==null||j.remove()),r.value){let Z=new ge.Marker(M).setLngLat(k).setOffset([0,-22]).addTo(r.value),Q=-1;v.value.forEach((H,oe)=>{H.id==E&&(Q=oe)}),Q>-1?v.value[Q].marker=Z:v.value.push({id:E,marker:Z})}})):(A=a.children)==null||A.forEach(C=>{var Q;let k=[0,0];const P=JSON.parse(C.rowDataInstance);P.latitude&&P.longitude&&(k=[Number(P.longitude),Number(P.latitude)]),P.latitudeStart&&P.longitudeStart&&(k=[Number(P.longitudeStart),Number(P.latitudeStart)]);const M=document.createElement("div");M.className="research-location-point";const G=document.createElement("div");G.className="research-location-point-content",M.appendChild(G);const E=document.createElement("div");E.className="research-location-point-content-inner",E.style.backgroundColor=I.pointTintColor?I.pointTintColor:"#02d2e0",G.appendChild(E);const L=document.createElement("div");L.className="research-location-point-line",M.appendChild(L),M.onclick=H=>{console.log(H)};const j=`${C.id}-research-point`,Z=v.value.find(H=>H.id==j);if(Z&&Z.marker&&((Q=Z.marker)==null||Q.remove()),r.value){let H=new ge.Marker(M).setLngLat(k).setOffset([0,-22]).addTo(r.value),oe=-1;v.value.forEach((we,he)=>{we.id==j&&(oe=he)}),oe>-1?v.value[oe].marker=H:v.value.push({id:j,marker:H})}});J()}function Ie(a){var x,A,C;se(a);const f=`${a.id}-geo-line-layer`,I=`${a.id}-research-point`;((x=r.value)==null?void 0:x.getLayer(f))&&((A=r.value)==null||A.removeLayer(f));let T=-1;v.value.forEach((k,P)=>{k.id==I&&(T=P)}),T>-1&&(v.value[T].marker&&((C=v.value[T].marker)==null||C.remove()),v.value.splice(T,1)),J()}const fe=async({mapRootId:a,topic:f,visible:I,delLayer:D})=>{var T;if(console.log("接收到图层切换事件",t.mapRootId,a,f),a===t.mapRootId&&r.value)if(I)if(console.log("delLayer",D),D&&(console.log("mmb: 删除图层",f),z(f)),f.layerType=="species-group")ue(f);else if(f.layerDataType=="research"){if(f.layerType=="line"||f.layerType=="symbol"){if(!f.lineInfo){const x=await((T=t.researchDataRequest)==null?void 0:T.call(t,f));if(x){const{lineInfo:A,pointInfo:C}=x;f.lineInfo=A,f.pointInfo=C}}R(f)}}else w(f);else f.layerType=="species-group"?de(f):f.layerDataType=="research"?Ie(f):z(f)};function se(a){let f=-1;d.value.forEach((I,D)=>{I.id==a.id&&(f=D)}),f>-1&&d.value.splice(f,1)}function de(a){var f,I,D;if(se(a),a.layerPaintConfig){const T=JSON.parse(a.layerPaintConfig);if(T&&T.pointRenderType=="heatMap"){let x=a.id+"-source",A=a.id+"-layer";(f=r.value)==null||f.removeLayer(A),(I=r.value)==null||I.removeSource(x)}else(D=a.children)==null||D.forEach(x=>{var M,G,E;const A=`${x.id}-geo-line-layer`,C=`${x.id}-research-point`;((M=r.value)==null?void 0:M.getLayer(A))&&((G=r.value)==null||G.removeLayer(A));let P=-1;v.value.forEach((L,j)=>{L.id==C&&(P=j)}),P>-1&&(v.value[P].marker&&((E=v.value[P].marker)==null||E.remove()),v.value.splice(P,1))})}J()}const be=({mapRootId:a,layer:f})=>{console.log("接收到定位到图层中心事件",f),a===t.mapRootId&&r.value&&te(f)};return U.onMounted(()=>{var a,f,I,D;i.setMapBoxToken(t.mapBoxToken),i.setTdtToken(t.tdtToken),i.setMaxZoom(t.mapRootId,t.maxZoom),i.setMinZoom(t.mapRootId,t.minZoom),i.setZoom(t.mapRootId,t.zoom),i.setPitch(t.mapRootId,t.pitch),i.setThreeDPitch(t.mapRootId,t.pitch),t.center&&Array.isArray(t.center)&&t.center.length>0?(i.setCenter(t.mapRootId,t.center),h()):navigator.geolocation.getCurrentPosition(T=>{const{latitude:x,longitude:A}=T.coords;i.setCenter(t.mapRootId,[A,x]),h()},()=>{i.setCenter(t.mapRootId,[104.1954,35.8617]),i.setZoom(t.mapRootId,4),h()}),i.mapInstances[t.mapRootId]&&(i.mapInstances[t.mapRootId].mapHeight=((a=n.value)==null?void 0:a.clientHeight)??600,i.mapInstances[t.mapRootId].mapWidth=((f=n.value)==null?void 0:f.clientWidth)??600,i.mapInstances[t.mapRootId].mapX=((I=n.value)==null?void 0:I.getBoundingClientRect().left)??600,i.mapInstances[t.mapRootId].mapY=((D=n.value)==null?void 0:D.getBoundingClientRect().top)??600),console.log("mapStore.mapInstances[mapRootId]--->",t.mapRootId),le.toggleGeographicLayerKeyBus.on(fe),le.locateToLayerCenterKeyBus.on(be)}),U.onUnmounted(()=>{console.log("组件卸载,清理事件监听"),le.renderGeographicDataKeyBus.off(_),le.toggleGeographicLayerKeyBus.off(fe),le.locateToLayerCenterKeyBus.off(be)}),(a,f)=>(U.openBlock(),U.createElementBlock("div",{class:"qy-map",ref_key:"mapRoot",ref:n},[U.createElementVNode("div",{class:"hiper-map-warper",id:a.mapRootId},[U.createElementVNode("div",zr,[U.renderSlot(a.$slots,"leftBar",{},void 0,!0)]),U.createElementVNode("div",Yr,[U.renderSlot(a.$slots,"rightBar",{},void 0,!0)]),U.createElementVNode("div",{class:"top-bar",style:U.normalizeStyle({left:U.unref(i).topicVisible?U.unref(i).topicWidth+50+"px":"70px"})},[U.renderSlot(a.$slots,"topBar",{},void 0,!0)],4),U.createElementVNode("div",$r,[U.renderSlot(a.$slots,"bottomBar",{},void 0,!0)]),U.renderSlot(a.$slots,"default",{},void 0,!0)],8,qr)],512))}}),Xr=Ct._export_sfc(Zr,[["__scopeId","data-v-a16ccb9f"]]);exports.LercAddCompression=fr;exports.LercParameters=ur;exports.MapView=Xr;
|
|
5
|
+
`).filter(l=>l.length>0).map(l=>l.split("=")).forEach(([l,h])=>{this.ghostValues[l]=h})}return this.ghostValues}static async fromSource(e,o,n){const i=(await e.fetch([{offset:0,length:1024}],n))[0],r=new Nr(i),c=r.getUint16(0,0);let s;if(c===18761)s=!0;else if(c===19789)s=!1;else throw new TypeError("Invalid byte order value.");const u=r.getUint16(2,s);let l;if(u===42)l=!1;else if(u===43){if(l=!0,r.getUint16(4,s)!==8)throw new Error("Unsupported offset byte-size.")}else throw new TypeError("Invalid magic number.");const h=l?r.getUint64(8,s):r.getUint32(4,s);return new Ze(e,s,l,h,o)}close(){return typeof this.source.close=="function"?this.source.close():!1}}async function Vr(t,e){return Ze.fromSource(Gr(t),e)}function jr(t){const e=U.ref([]);let o=null,n={min:null,max:null,originalMin:null,originalMax:null,bounds:[]};async function i(l,h=["#000000","#FFFFFF"]){console.log("Adding TIF layer with URL/File:",l,h);const y=`tif-layer-${new Date().getTime()}`;if(l instanceof File){const m=await N.readFileAsArrayBuffer(l);await r(m,h,y),e.value.push(y)}else if(typeof l=="string"){const g=await(await fetch(l)).arrayBuffer();await r(g,h,y),e.value.push(y)}return{tifId:y,dataRange:n}}async function r(l,h=["#000000","#FFFFFF"],y="geotiff-layer"){var O;const g=await(await Vr(l)).getImage(),d=g.getWidth(),w=g.getHeight(),p=g.fileDirectory||{};console.log("fileDirectory",p);const b=parseInt(p.GDAL_NODATA);console.log("GDAL_NODATA",typeof b,b);const S=N.calculateBounds(g),v=await g.readRasters();o={image:g,data:v,width:d,height:w},console.log("GeoTIFF data loaded:",o);const R=Array.isArray(v)?v:[v];let B=1/0,V=-1/0;for(const Y of R)for(const q of Y)q>-1e10&&q!=b&&(B=Math.min(B,q),V=Math.max(V,q));(!isFinite(B)||!isFinite(V)||B>=V)&&(console.warn("无效的数据范围,使用默认值"),B=0,V=255),n={min:B,max:V,originalMin:B,originalMax:V,bounds:S},console.log("Data range calculated:",n);const J=u(v,d,w,h,b);if(!J){console.error("Failed to create image data from GeoTIFF.");return}c(J,d,w,S,y),(O=t.value)==null||O.fitBounds([[S[0],S[1]],[S[2],S[3]]],{padding:50})}function c(l,h,y,m,g="geotiff-layer"){var v,R,B,V;const d=g,w=g+"-source";(v=t.value)!=null&&v.getLayer(d)&&t.value.removeLayer(d),(R=t.value)!=null&&R.getSource(w)&&t.value.removeSource(w);const p=document.createElement("canvas");p.width=h,p.height=y;const b=p.getContext("2d");b==null||b.putImageData(l,0,0);const S=p.toDataURL("image/png");(B=t.value)==null||B.addSource(w,{type:"image",url:S,coordinates:[[m[0],m[3]],[m[2],m[3]],[m[2],m[1]],[m[0],m[1]]]}),(V=t.value)==null||V.addLayer({id:d,type:"raster",source:w,paint:{"raster-opacity":.8}})}function s(l){var g,d;const h=l,y=l+"-source";(g=t.value)!=null&&g.getLayer(h)&&t.value.removeLayer(h),(d=t.value)!=null&&d.getSource(y)&&t.value.removeSource(y);const m=e.value.indexOf(l);m!==-1&&e.value.splice(m,1)}function u(l,h,y,m,g=null){const d=document.createElement("canvas");d.width=h,d.height=y;const w=d.getContext("2d"),p=w==null?void 0:w.createImageData(h,y),b=Array.isArray(l)?l:[l],S=h*y;let v=n.min,R=n.max;(v===null||R===null)&&(v=0,R=255);const B=m.map(N.hexToRgb),V=B.length;function J(O){if(V===1||O<=0)return B[0];if(O>=1)return B[V-1];const Y=1/(V-1),q=Math.floor(O/Y),$=(O-q*Y)/Y,z=B[q],te=B[Math.min(q+1,V-1)];return[Math.round(z[0]+(te[0]-z[0])*$),Math.round(z[1]+(te[1]-z[1])*$),Math.round(z[2]+(te[2]-z[2])*$)]}for(let O=0;O<S;O++){let Y,q,$,z;const te=b[0][O];if(g!==null&&te===g)Y=q=$=0,z=0;else if(b.length>=3)g!==null&&(b[0][O]===g||b[1][O]===g||b[2][O]===g)?(Y=q=$=0,z=0):(Y=Math.floor(255*N.clamp((b[0][O]-v)/(R-v),0,1)),q=Math.floor(255*N.clamp((b[1][O]-v)/(R-v),0,1)),$=Math.floor(255*N.clamp((b[2][O]-v)/(R-v),0,1)),z=255);else if(b.length===1){const re=b[0][O];if(re<v)z=0,Y=q=$=0;else if(re>R)Y=255,q=$=0,z=255;else{const _=(re-v)/(R-v),ue=.15,Ie=(_-ue)/(1-ue);[Y,q,$]=J(Ie),z=255}}else{const _=(b[0][O]-v)/(R-v);_<.15?(Y=q=$=0,z=0):(Y=q=$=Math.floor(255*(_-.15)/.85),z=255)}p.data[O*4]=Y,p.data[O*4+1]=q,p.data[O*4+2]=$,p.data[O*4+3]=z}return w==null||w.putImageData(p,0,0),p}return{addTifLayer:i,processGeoTIFF:r,removeTifLayer:s}}const qr=["id"],zr={class:"left-bar"},Yr={class:"right-bar"},$r={class:"bottom-bar"},Zr=U.defineComponent({name:"MapView",__name:"MapView",props:{mapRootId:{default:"mapbox-map"},tdtToken:{},mapBoxToken:{},maxZoom:{default:17},minZoom:{default:3},zoom:{default:10},pitch:{default:60},hasScale:{type:Boolean,default:!0},scalePosition:{default:"bottom-right"},center:{},dbfDataRequest:{type:Function},researchDataRequest:{type:Function},dialogConfig:{default:()=>({center:!1,top:"50px",customClass:"hiper-map-dialog"})},loadIcon:{type:Boolean,default:!0}},emits:["mapReady"],setup(t,{expose:e,emit:o}){const n=U.useTemplateRef("mapRoot"),i=Pt.useMapStore();t.dialogConfig&&i.setDialogConfig(t.dialogConfig);const r=U.ref(),{addTifLayer:c,processGeoTIFF:s,removeTifLayer:u}=jr(r),l=o,h=()=>{var f;ge.accessToken=t.mapBoxToken;const a=i.mapInstances[t.mapRootId];if(console.log("_mapInstance",a),r.value=new ge.Map({container:t.mapRootId,style:i.getCurrentMapStyle(t.mapRootId),center:a.center,zoom:a.zoom,pitch:a.pitch,bearing:0,antialias:!0,maxZoom:a.maxZoom,minZoom:a.minZoom,attributionControl:!1}),r.value.on("load",()=>{r.value&&($(),l("mapReady",r.value)),le.mapLoadedBus.emit({mapRootId:t.mapRootId})}),r.value.on("zoomend",()=>{var I;i.setZoom(t.mapRootId,((I=r.value)==null?void 0:I.getZoom())||0)}),t.hasScale){const I=new ge.ScaleControl({maxWidth:80,unit:"metric"});(f=r.value)==null||f.addControl(I,t.scalePosition)}r.value.on("load",()=>{})},y=()=>{var a,f;(a=r.value)==null||a.setStyle(i.getCurrentMapStyle(t.mapRootId)),(f=r.value)==null||f.once("styledata",()=>{console.log("地图样式更新完成,重新加载图层"),d.value.forEach(I=>{w(I)}),le.mapStyleChangedBus.emit({mapRootId:t.mapRootId})})},m=U.ref(!1),g=()=>{if(r.value){const a=i.mapInstances[t.mapRootId];m.value=!0,r.value.flyTo({center:a.center,zoom:a.zoom,bearing:0,pitch:a.threeDPitch,duration:2e3}),a.is3DMode=a.threeDPitch>0,a.pitch=a.threeDPitch,setTimeout(()=>{m.value=!1},2e3)}},d=U.ref([]),w=a=>{var I;if(!r.value){console.warn("地图实例未初始化,无法添加图层");return}const f=d.value.find(D=>D.id===a.id);if(f?Object.assign(f,a):d.value.push(a),a.geoJSON)console.log("渲染geoJSON---->"),b(a);else{const D=N.getLayerId(a);((I=r.value)==null?void 0:I.getLayer(D))==null?(console.log("首次渲染---->"),S(a)):(console.log("非首次渲染---->更新图层"),p(a,JSON.parse(a.layerPaintConfig)))}};function p(a,f){var k,P,M,G,E,L,j,Z,Q,H,oe,we,he,Xe,Je,He,Qe,We;f.fillColorList&&f.fillColorList.length&&(f.fillColorList=f.fillColorList.filter(K=>K.key&&K.value||K.type=="default"));const I=N.getLayerType(a);console.log("currentLayerType--->",I);const D=JSON.parse(JSON.stringify(f));console.log("newStyleConfig---->",D);const T=N.getFillStyle(D);console.log("newFillColorConfig---->",T);const x=N.getOutLineStyle(D);if(console.log("outlineStyle---->",x),I=="fill"&&T&&x)(k=r.value)==null||k.setPaintProperty(N.getLayerId(a),"fill-color",T["fill-color"]),(P=r.value)==null||P.setPaintProperty(N.getLayerId(a),"fill-opacity",T["fill-opacity"]),(M=r.value)==null||M.setPaintProperty(N.getLayerId(a),"fill-outline-color",T["fill-outline-color"]),x&&x["line-color"]&&((G=r.value)==null||G.setPaintProperty(N.getLayerId(a)+"-outline","line-color",x["line-color"])),x&&x["line-opacity"],x&&x["line-width"]&&((E=r.value)==null||E.setPaintProperty(N.getLayerId(a)+"-outline","line-width",x["line-width"])),(L=r.value)==null||L.setPaintProperty(N.getLayerId(a)+"-outline","line-dasharray",[]),x&&x["line-dasharray"]&&(console.log("outlineStyle['line-dasharray']----->",x["line-dasharray"]),(j=r.value)==null||j.setPaintProperty(N.getLayerId(a)+"-outline","line-dasharray",x["line-dasharray"]));else if(I=="line")x&&x["line-color"]&&((Z=r.value)==null||Z.setPaintProperty(N.getLayerId(a),"line-color",x["line-color"])),x&&x["line-opacity"]&&((Q=r.value)==null||Q.setPaintProperty(N.getLayerId(a),"line-opacity",x["line-opacity"])),x&&x["line-width"]&&((H=r.value)==null||H.setPaintProperty(N.getLayerId(a),"line-width",x["line-width"])),(oe=r.value)==null||oe.setPaintProperty(N.getLayerId(a),"line-dasharray",[]),x&&x["line-dasharray"]&&((we=r.value)==null||we.setPaintProperty(N.getLayerId(a),"line-dasharray",x["line-dasharray"]));else if(I=="circle"){const K=N.getCircleStyle(D);K&&K["circle-color"]&&((he=r.value)==null||he.setPaintProperty(N.getLayerId(a),"circle-color",K["circle-color"])),K&&K["circle-opacity"]&&((Xe=r.value)==null||Xe.setPaintProperty(N.getLayerId(a),"circle-opacity",K["circle-opacity"])),K&&K["circle-radius"]&&((Je=r.value)==null||Je.setPaintProperty(N.getLayerId(a),"circle-radius",K["circle-radius"])),K&&K["circle-stroke-color"]&&((He=r.value)==null||He.setPaintProperty(N.getLayerId(a),"circle-stroke-color",K["circle-stroke-color"])),K&&K["circle-stroke-width"]&&((Qe=r.value)==null||Qe.setPaintProperty(N.getLayerId(a),"circle-stroke-width",K["circle-stroke-width"]))}else if(I=="symbol"){const K=N.getCircleStyle(D);K&&K["icon-image"]&&((We=r.value)==null||We.setLayoutProperty(N.getLayerId(a),"icon-image",K["icon-image"]))}const A=[];let{symbolConfigList:C}=D;C=C.filter(K=>K.fontSize&&K.field&&K.textColor),C.forEach((K,Jr)=>{var _e,et,tt,rt;const Pe="points-symbol-"+a.id+K.field,bt=N.getSourceId(a);((_e=r.value)==null?void 0:_e.getLayer(Pe))?((tt=r.value)==null||tt.setLayoutProperty(Pe,"text-size",K.fontSize),(rt=r.value)==null||rt.setPaintProperty(Pe,"text-color",K.textColor)):((et=r.value)==null||et.addLayer({id:Pe,type:"symbol",source:bt,layout:{visibility:"visible","text-field":["get",K.field],"text-size":K.fontSize,"symbol-avoid-edges":!0,"icon-image":"circle-11","text-ignore-placement":!1,"text-max-angle":38},paint:{"text-color":K.textColor}}),A.push(K.field))})}function b(a){var x,A,C,k,P,M,G,E,L,j;if(!a.customLayerConfig||!a.geoJSON){console.warn("图层配置缺失,无法渲染图层");return}const f=JSON.parse(a.customLayerConfig),I=N.getLayerId(a);((x=r.value)==null?void 0:x.getLayer(I))!==void 0&&(console.warn(`图层 ${I} 已存在,无法重复添加`),(A=r.value)==null||A.removeLayer(I),(C=r.value)==null||C.removeSource(I));const T=JSON.parse(a.geoJSON);switch(a.layerType){case"symbol":const Z={id:I,type:"symbol",source:{type:"geojson",data:{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"Point",coordinates:T.features[0].geometry.coordinates},properties:{title:a.layerName||f.iconName,icon:`${f.iconName}`}}]}},layout:{"icon-image":"{icon}","icon-size":.1,"icon-anchor":"center","text-field":"{title}","text-font":["Open Sans Semibold","Arial Unicode MS Bold"],"text-offset":[0,1.8],"text-anchor":"center","text-size":12,"text-allow-overlap":!0,"text-optional":!0},paint:{"text-color":f.textColor,"text-halo-color":"rgba(0,0,0,0.32)","text-halo-width":1,"text-halo-blur":2,"text-translate":[0,0]}};(k=r.value)==null||k.addLayer(Z);break;case"line":const Q={id:I,type:"line",source:{type:"geojson",data:T},layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":f.lineColor,"line-width":Number(f.lineWidth)}};f.lineStyle=="dotted"&&(Q.paint["line-dasharray"]=[5.2,5.2]),(P=r.value)==null||P.addLayer(Q);break;case"shape":let H=I+"-outline";const oe={id:H,type:"line",source:{type:"geojson",data:JSON.parse(a.geoJSON)},layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":f.fillColor,"line-width":Number(f.lineWidth)}};((M=r.value)==null?void 0:M.getLayer(H))!==void 0&&((G=r.value)==null||G.removeLayer(H),(E=r.value)==null||E.removeSource(H)),(L=r.value)==null||L.addLayer(oe);const he={id:I,type:"fill",source:{type:"geojson",data:T},layout:{},paint:{"fill-color":f.fillColor,"fill-opacity":.32}};(j=r.value)==null||j.addLayer(he);break}}function S(a){var C,k,P,M,G;console.log("加载图层---->",a);const f=N.getLayerId(a),I=N.getSourceId(a);console.log("sourceId--->",I);const D=N.parseStyleConfig(a);console.log("styleConfig",D);const T=N.getLayerType(a);((C=r.value)==null?void 0:C.getSource(I))||(P=r.value)==null||P.addSource(I,{type:"geojson",data:(k=a.url)==null?void 0:k.replace("bjhweb","bjh")}),console.log("layerType--->",T);const A={id:f,source:I,name:f,layout:{visibility:"visible"},type:T};if(T!="symbol")A.paint=N.getLayerStyle(a);else{const E=N.getLayerStyle(a);A.layout={visibility:"visible","symbol-placement":"line","symbol-spacing":10,"icon-size":.1,"icon-keep-upright":!0,"icon-rotate":0,"icon-allow-overlap":!0,...E}}if(console.log("layerConfig--->",A),(M=r.value)==null||M.addLayer(A),T=="fill"){const E=N.getOutLineStyle(D);(G=r.value)==null||G.addLayer({id:f+"-outline",source:I,name:f+"-outline",layout:{visibility:"visible","line-join":"round","line-cap":"round"},type:"line",paint:{"line-color":E["line-color"],"line-width":E["line-width"],"line-dasharray":E["line-dasharray"]||[]}})}}const v=U.ref([]);function R(a){if(!r.value){console.warn("地图实例未初始化,无法添加调查数据图层");return}q(a);const f=a.pointInfo?a.pointInfo:JSON.parse(a.rowDataInstance??"{}");let I=null;if(f.latitude&&f.longitude&&(I=[parseFloat(f.longitude),parseFloat(f.latitude)]),f.latitudeStart&&f.longitudeStart&&(I=[parseFloat(f.longitudeStart),parseFloat(f.latitudeStart)]),a.layerType=="line"){const D={outlineColor:"#02d2e0",outlineWidth:3};let T=a.layerPaintConfig?JSON.parse(a.layerPaintConfig):D;if(!a.lineInfo){console.error("调查数据缺失,无法添加线图层");return}const x=a.lineInfo;let A=[];I&&I.length&&A.push(I),x.forEach(L=>{A.push([Number(L.longitude),Number(L.latitude)])});const k={type:"geojson",data:{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"LineString",coordinates:A}}]}},P=`${a.id}-geo-line-source`,M=r.value.getSource(P),G=`${a.id}-geo-line-layer`,E=r.value.getLayer(G);if(A.length>0){M||r.value.addSource(P,k),E&&r.value.removeLayer(G);let L={"line-color":T.outlineColor,"line-width":T.outlineWidth,"line-opacity":1};switch(T.outlineStyle){case"simple-dash":L["line-dasharray"]=[2,2];break;case"dot-dash":L["line-dasharray"]=[1,2,3,2];break;case"long-dash":L["line-dasharray"]=[4,2];break;case"dot-line":L["line-dasharray"]=[.1,2];break;case"complex-pattern":L["line-dasharray"]=[2,2,1,2];break}r.value.addLayer({id:G,type:"line",source:P,paint:L})}r.value.easeTo({zoom:17,center:A[0]})}else{const D={pointTintColor:"#02d2e0",pointRenderType:"points"};let T=a.layerPaintConfig?JSON.parse(a.layerPaintConfig):D;if(console.log("走这里---->",a),!a.lineInfo){console.error("调查数据缺失,无法添加点图层");return}if(!r.value){console.warn("地图实例未初始化,无法添加点图层");return}a.lineInfo.forEach(x=>{var E;let A=[0,0];x.latitude&&x.longitude&&(A=[Number(x.longitude),Number(x.latitude)]),x.latitudeStart&&x.longitudeStart&&(A=[Number(x.longitudeStart),Number(x.latitudeStart)]),console.log("layerPaintConfig.pointRenderType ",T);const C=document.createElement("div");if(T.pointRenderType=="icons"){C.className="research-location-icon-el";const L=document.createElement("img");L.className="research-location-img-el",L.src=Le.mapIconBaseUrl+T.currentMapIconName,C.appendChild(L)}else{C.className="research-location-point";const L=document.createElement("div");L.className="research-location-point-content",C.appendChild(L);const j=document.createElement("div");j.className="research-location-point-content-inner",j.style.backgroundColor=T.pointTintColor?T.pointTintColor:"#02d2e0",L.appendChild(j);const Z=document.createElement("div");Z.className="research-location-point-line",C.appendChild(Z)}C.onclick=L=>{Y(L,JSON.parse(a.rowDataInstance??"{}"))};const k=`${a.id}-research-point`,P=v.value.find(L=>L.id==k);P&&P.marker&&((E=P.marker)==null||E.remove());let M=new ge.Marker(C).setLngLat(A).setOffset([0,-22]).addTo(r.value),G=-1;v.value.forEach((L,j)=>{L.id==k&&(G=j)}),G>-1?v.value[G].marker=M:v.value.push({id:k,marker:M})})}J()}const B=U.ref(),V=U.ref();function J(){B.value&&B.value.hidePopup(),V.value&&V.value.hidePopup(),O.value&&O.value.hidePopup()}const O=U.ref();function Y(a,f){const{clientX:I,clientY:D}=a,T=I+28,x=D-60;O.value.showPopup(T,x,f)}function q(a){const f=d.value.find(I=>I.id===a.id);f?Object.assign(f,a):d.value.push(a)}function $(){if(!t.loadIcon)return Promise.resolve(!0);if(!r.value)return Promise.reject(new Error("地图实例未初始化,无法加载图标资源"));const a=Le.mapIconNameList.map(f=>new Promise((I,D)=>{var T;(T=r.value)==null||T.loadImage(Le.mapIconBaseUrl+f.fileName,(x,A)=>{var C;x?D(x):(A&&((C=r.value)==null||C.addImage(f.fileName,A)),I(!0))})}));return Promise.all(a)}function z(a){var x,A,C,k,P,M,G,E;console.log("removeThirdPartyLayer---->",a);const f=N.getLayerId(a),I=N.getLayerType(a),D=(x=r.value)==null?void 0:x.getLayer(f);console.log("currentLayerType---->",I,D);let T=-1;if(d.value.forEach((L,j)=>{L.id==a.id&&(T=j)}),T>-1&&d.value.splice(T,1),D){const L=(A=r.value)==null?void 0:A.getLayer(f);if(L){const j=L.source;(C=r.value)==null||C.removeLayer(f),a.geoJSON&&j&&((k=r.value)==null||k.removeSource(j))}}if(I=="fill"){console.log("移除边框----->");const L=f+"-outline",j=(P=r.value)==null?void 0:P.getLayer(L),Z=(M=r.value)==null?void 0:M.getLayer(L);if(Z){const Q=Z.source;j&&((G=r.value)==null||G.removeLayer(L)),a.geoJSON&&Q&&((E=r.value)==null||E.removeSource(Q))}}J()}U.watch(()=>{var a;return(a=i.mapInstances[t.mapRootId])==null?void 0:a.activeMapLayer},()=>{r.value&&y()},{immediate:!0}),U.watch(()=>{var a;return(a=i.mapInstances[t.mapRootId])==null?void 0:a.zoom},()=>{r.value&&!m.value&&r.value.flyTo({zoom:i.mapInstances[t.mapRootId].zoom,duration:500})},{immediate:!0}),U.watch(()=>{var a;return(a=i.mapInstances[t.mapRootId])==null?void 0:a.pitch},()=>{r.value&&!m.value&&(i.isDragging?r.value.setPitch(i.mapInstances[t.mapRootId].pitch):r.value.flyTo({pitch:i.mapInstances[t.mapRootId].pitch,duration:1e3}))},{immediate:!0}),U.watch(()=>{var a;return(a=i.mapInstances[t.mapRootId])==null?void 0:a.bearing},()=>{r.value&&!m.value&&(i.isDragging?r.value.setBearing(i.mapInstances[t.mapRootId].bearing):r.value.flyTo({bearing:i.mapInstances[t.mapRootId].bearing,duration:1e3}))},{immediate:!0});const te=a=>{r.value&&(r.value.flyTo({zoom:4,duration:400}),setTimeout(async()=>{var T,x,A,C,k;if(!a)return;let f=N.getSourceId(a);if(a.geoJSON&&(f=N.getLayerId(a)),a.url&&!a.geoJSON)try{const P=a.url.replace("bjhweb","bjh"),G=await(await fetch(P)).json();if(G&&G.features&&G.features.length>0){const E=Ce.bbox(G);if(E&&!re(E)){(T=r.value)==null||T.fitBounds([[E[0],E[1]],[E[2],E[3]]],{padding:{top:50,bottom:50,left:50,right:50}});return}}}catch(P){console.warn("从URL获取GeoJSON数据失败,尝试其他方法",P)}const I=(x=r.value)==null?void 0:x.getSource(f);if(I&&I._data&&I._data.features){const P=I._data,M=Ce.bbox(P);if(!re(M)){(A=r.value)==null||A.fitBounds([[M[0],M[1]],[M[2],M[3]]],{padding:{top:50,bottom:50,left:50,right:50}});return}}const D=(C=r.value)==null?void 0:C.querySourceFeatures(f);if(D&&D.length>0){const P=Ce.featureCollection(D),M=Ce.bbox(P);re(M)?console.warn("获取的边界框无效"):(k=r.value)==null||k.fitBounds([[M[0],M[1]],[M[2],M[3]]],{padding:{top:50,bottom:50,left:50,right:50}})}else console.warn("没有查询到图层数据")},500))};function re(a){return a[0]===1/0||a[1]===1/0||a[2]===-1/0||a[3]===-1/0||isNaN(a[0])||isNaN(a[1])||isNaN(a[2])||isNaN(a[3])}U.provide("resetMapView",g),U.provide("mapRootId",t.mapRootId),t.dbfDataRequest&&U.provide(De.dbfDataRequestKey,t.dbfDataRequest),t.researchDataRequest&&U.provide(De.researchDataRequestKey,t.researchDataRequest),U.provide(De.mapInstanceKey,r),U.provide(De.thirdPartyLayersKey,d);const _=({mapRootId:a,layer:f})=>{a===a&&(console.log("接收到渲染地理数据事件",f),f.layerDataType=="research"&&w(f))};le.renderGeographicDataKeyBus.on(_),e({mapInstance:r,initMap:h,handleSetMapStyle:y,resetMapView:g,addThirdPartyLayer:w,addResearchMapLayer:R,addTifLayer:c,processGeoTIFF:s,removeTifLayer:u}),U.onBeforeMount(()=>{i.mapInstances[t.mapRootId]={maxZoom:t.maxZoom,minZoom:t.minZoom,zoom:t.zoom,pitch:t.pitch,threeDPitch:t.pitch,center:t.center||[120.1551,30.2741],bearing:0,is3DMode:t.pitch>0,activeMapLayer:Lt.MapLayerType.SATELLITE,mapHeight:600,mapWidth:600,mapX:0,mapY:0}});function ue(a){var D,T,x,A;q(a);const f={outlineColor:"#02d2e0",outlineWidth:3,outlineOpacity:.72,pointTintColor:"#02d2e0"};let I=a.layerPaintConfig?JSON.parse(a.layerPaintConfig):f;if(console.log("layerPaintConfig--->",I),I.pointRenderType&&I.pointRenderType=="heatMap"){let C=a.id+"-source",k=a.id+"-layer",P=[];a.children&&a.children.forEach(M=>{let G=[0,0];const E=JSON.parse(M.rowDataInstance);E.latitude&&E.longitude&&(G=[Number(E.longitude),Number(E.latitude)]),E.latitudeStart&&E.longitudeStart&&(G=[Number(E.longitudeStart),Number(E.latitudeStart)]),P.push({type:"Feature",properties:{},geometry:{type:"Point",coordinates:G}})}),(D=r.value)==null||D.addSource(C,{type:"geojson",data:{type:"FeatureCollection",features:P}}),(T=r.value)==null||T.addLayer({id:k,type:"heatmap",source:C,maxzoom:9,paint:{"heatmap-weight":1,"heatmap-intensity":["interpolate",["linear"],["zoom"],0,1,9,3],"heatmap-color":["interpolate",["linear"],["heatmap-density"],0,"rgba(33,102,172,0)",.2,"blue",.4,"cyan",.6,"lime",.8,"yellow",1,"red"],"heatmap-radius":["interpolate",["linear"],["zoom"],0,2,9,20],"heatmap-opacity":["interpolate",["linear"],["zoom"],7,1,9,0]}})}else I.pointRenderType&&I.pointRenderType=="icons"?(console.log("走这里----->, icons",v.value),console.log("mapLayer.children",a.children),(x=a.children)==null||x.forEach(C=>{var j;let k=[0,0];const P=JSON.parse(C.rowDataInstance);P.latitude&&P.longitude&&(k=[Number(P.longitude),Number(P.latitude)]),P.latitudeStart&&P.longitudeStart&&(k=[Number(P.longitudeStart),Number(P.latitudeStart)]);const M=document.createElement("div");M.className="research-location-icon-el";const G=document.createElement("img");G.className="research-location-img-el",G.src=Le.mapIconBaseUrl+I.currentMapIconName,M.appendChild(G);const E=`${C.id}-research-point`,L=v.value.find(Z=>Z.id==E);if(L&&L.marker&&((j=L.marker)==null||j.remove()),r.value){let Z=new ge.Marker(M).setLngLat(k).setOffset([0,-22]).addTo(r.value),Q=-1;v.value.forEach((H,oe)=>{H.id==E&&(Q=oe)}),Q>-1?v.value[Q].marker=Z:v.value.push({id:E,marker:Z})}})):(A=a.children)==null||A.forEach(C=>{var Q;let k=[0,0];const P=JSON.parse(C.rowDataInstance);P.latitude&&P.longitude&&(k=[Number(P.longitude),Number(P.latitude)]),P.latitudeStart&&P.longitudeStart&&(k=[Number(P.longitudeStart),Number(P.latitudeStart)]);const M=document.createElement("div");M.className="research-location-point";const G=document.createElement("div");G.className="research-location-point-content",M.appendChild(G);const E=document.createElement("div");E.className="research-location-point-content-inner",E.style.backgroundColor=I.pointTintColor?I.pointTintColor:"#02d2e0",G.appendChild(E);const L=document.createElement("div");L.className="research-location-point-line",M.appendChild(L),M.onclick=H=>{console.log(H)};const j=`${C.id}-research-point`,Z=v.value.find(H=>H.id==j);if(Z&&Z.marker&&((Q=Z.marker)==null||Q.remove()),r.value){let H=new ge.Marker(M).setLngLat(k).setOffset([0,-22]).addTo(r.value),oe=-1;v.value.forEach((we,he)=>{we.id==j&&(oe=he)}),oe>-1?v.value[oe].marker=H:v.value.push({id:j,marker:H})}});J()}function Ie(a){var x,A,C;se(a);const f=`${a.id}-geo-line-layer`,I=`${a.id}-research-point`;((x=r.value)==null?void 0:x.getLayer(f))&&((A=r.value)==null||A.removeLayer(f));let T=-1;v.value.forEach((k,P)=>{k.id==I&&(T=P)}),T>-1&&(v.value[T].marker&&((C=v.value[T].marker)==null||C.remove()),v.value.splice(T,1)),J()}const fe=async({mapRootId:a,topic:f,visible:I,delLayer:D})=>{var T;if(console.log("接收到图层切换事件",t.mapRootId,a,f),a===t.mapRootId&&r.value)if(I)if(console.log("delLayer",D),D&&(console.log("mmb: 删除图层",f),z(f)),f.layerType=="species-group")ue(f);else if(f.layerDataType=="research"){if(f.layerType=="line"||f.layerType=="symbol"){if(!f.lineInfo){const x=await((T=t.researchDataRequest)==null?void 0:T.call(t,f));if(x){const{lineInfo:A,pointInfo:C}=x;f.lineInfo=A,f.pointInfo=C}}R(f)}}else w(f);else f.layerType=="species-group"?de(f):f.layerDataType=="research"?Ie(f):z(f)};function se(a){let f=-1;d.value.forEach((I,D)=>{I.id==a.id&&(f=D)}),f>-1&&d.value.splice(f,1)}function de(a){var f,I,D;if(se(a),a.layerPaintConfig){const T=JSON.parse(a.layerPaintConfig);if(T&&T.pointRenderType=="heatMap"){let x=a.id+"-source",A=a.id+"-layer";(f=r.value)==null||f.removeLayer(A),(I=r.value)==null||I.removeSource(x)}else(D=a.children)==null||D.forEach(x=>{var M,G,E;const A=`${x.id}-geo-line-layer`,C=`${x.id}-research-point`;((M=r.value)==null?void 0:M.getLayer(A))&&((G=r.value)==null||G.removeLayer(A));let P=-1;v.value.forEach((L,j)=>{L.id==C&&(P=j)}),P>-1&&(v.value[P].marker&&((E=v.value[P].marker)==null||E.remove()),v.value.splice(P,1))})}J()}const be=({mapRootId:a,layer:f})=>{console.log("接收到定位到图层中心事件",f),a===t.mapRootId&&r.value&&te(f)};return U.onMounted(()=>{i.setMapBoxToken(t.mapBoxToken),i.setTdtToken(t.tdtToken),i.setMaxZoom(t.mapRootId,t.maxZoom),i.setMinZoom(t.mapRootId,t.minZoom),i.setZoom(t.mapRootId,t.zoom),i.setPitch(t.mapRootId,t.pitch),setTimeout(()=>{var a,f,I,D;i.setThreeDPitch(t.mapRootId,t.pitch),t.center&&Array.isArray(t.center)&&t.center.length>0?(i.setCenter(t.mapRootId,t.center),h()):navigator.geolocation.getCurrentPosition(T=>{const{latitude:x,longitude:A}=T.coords;i.setCenter(t.mapRootId,[A,x]),h()},()=>{i.setCenter(t.mapRootId,[104.1954,35.8617]),i.setZoom(t.mapRootId,4),h()}),i.mapInstances[t.mapRootId]&&(i.mapInstances[t.mapRootId].mapHeight=((a=n.value)==null?void 0:a.clientHeight)??600,i.mapInstances[t.mapRootId].mapWidth=((f=n.value)==null?void 0:f.clientWidth)??600,i.mapInstances[t.mapRootId].mapX=((I=n.value)==null?void 0:I.getBoundingClientRect().left)??600,i.mapInstances[t.mapRootId].mapY=((D=n.value)==null?void 0:D.getBoundingClientRect().top)??600)},200),console.log("mapStore.mapInstances[mapRootId]--->",t.mapRootId),le.toggleGeographicLayerKeyBus.on(fe),le.locateToLayerCenterKeyBus.on(be)}),U.onUnmounted(()=>{console.log("组件卸载,清理事件监听"),le.renderGeographicDataKeyBus.off(_),le.toggleGeographicLayerKeyBus.off(fe),le.locateToLayerCenterKeyBus.off(be)}),(a,f)=>(U.openBlock(),U.createElementBlock("div",{class:"qy-map",ref_key:"mapRoot",ref:n},[U.createElementVNode("div",{class:"hiper-map-warper",id:a.mapRootId},[U.createElementVNode("div",zr,[U.renderSlot(a.$slots,"leftBar",{},void 0,!0)]),U.createElementVNode("div",Yr,[U.renderSlot(a.$slots,"rightBar",{},void 0,!0)]),U.createElementVNode("div",{class:"top-bar",style:U.normalizeStyle({left:U.unref(i).topicVisible?U.unref(i).topicWidth+50+"px":"70px"})},[U.renderSlot(a.$slots,"topBar",{},void 0,!0)],4),U.createElementVNode("div",$r,[U.renderSlot(a.$slots,"bottomBar",{},void 0,!0)]),U.renderSlot(a.$slots,"default",{},void 0,!0)],8,qr)],512))}}),Xr=Ct._export_sfc(Zr,[["__scopeId","data-v-ffadd8e0"]]);exports.LercAddCompression=fr;exports.LercParameters=ur;exports.MapView=Xr;
|
|
@@ -521,7 +521,7 @@ le([8, 32946], () => import("./deflate-DbhbvOaP.js").then((t) => t.default));
|
|
|
521
521
|
le(32773, () => import("./packbits-BuzK6gM3.js").then((t) => t.default));
|
|
522
522
|
le(
|
|
523
523
|
34887,
|
|
524
|
-
() => import("./lerc-
|
|
524
|
+
() => import("./lerc-C7MAadkC.js").then(async (t) => (await t.zstd.init(), t)).then((t) => t.default)
|
|
525
525
|
);
|
|
526
526
|
le(50001, () => import("./webimage--SJddlky.js").then((t) => t.default));
|
|
527
527
|
function Ge(t, e, r, n = 1) {
|
|
@@ -2015,7 +2015,7 @@ const pr = ["id"], xr = { class: "left-bar" }, wr = { class: "right-bar" }, Ir =
|
|
|
2015
2015
|
var u;
|
|
2016
2016
|
ge.accessToken = t.mapBoxToken;
|
|
2017
2017
|
const a = o.mapInstances[t.mapRootId];
|
|
2018
|
-
if (i.value = new ge.Map({
|
|
2018
|
+
if (console.log("_mapInstance", a), i.value = new ge.Map({
|
|
2019
2019
|
container: t.mapRootId,
|
|
2020
2020
|
style: o.getCurrentMapStyle(t.mapRootId),
|
|
2021
2021
|
center: a.center,
|
|
@@ -2773,16 +2773,18 @@ const pr = ["id"], xr = { class: "left-bar" }, wr = { class: "right-bar" }, Ir =
|
|
|
2773
2773
|
console.log("接收到定位到图层中心事件", u), a === t.mapRootId && i.value && ee(u);
|
|
2774
2774
|
};
|
|
2775
2775
|
return Kt(() => {
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
(
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2776
|
+
o.setMapBoxToken(t.mapBoxToken), o.setTdtToken(t.tdtToken), o.setMaxZoom(t.mapRootId, t.maxZoom), o.setMinZoom(t.mapRootId, t.minZoom), o.setZoom(t.mapRootId, t.zoom), o.setPitch(t.mapRootId, t.pitch), setTimeout(() => {
|
|
2777
|
+
var a, u, w, C;
|
|
2778
|
+
o.setThreeDPitch(t.mapRootId, t.pitch), t.center && Array.isArray(t.center) && t.center.length > 0 ? (o.setCenter(t.mapRootId, t.center), h()) : navigator.geolocation.getCurrentPosition(
|
|
2779
|
+
(T) => {
|
|
2780
|
+
const { latitude: x, longitude: E } = T.coords;
|
|
2781
|
+
o.setCenter(t.mapRootId, [E, x]), h();
|
|
2782
|
+
},
|
|
2783
|
+
() => {
|
|
2784
|
+
o.setCenter(t.mapRootId, [104.1954, 35.8617]), o.setZoom(t.mapRootId, 4), h();
|
|
2785
|
+
}
|
|
2786
|
+
), o.mapInstances[t.mapRootId] && (o.mapInstances[t.mapRootId].mapHeight = ((a = n.value) == null ? void 0 : a.clientHeight) ?? 600, o.mapInstances[t.mapRootId].mapWidth = ((u = n.value) == null ? void 0 : u.clientWidth) ?? 600, o.mapInstances[t.mapRootId].mapX = ((w = n.value) == null ? void 0 : w.getBoundingClientRect().left) ?? 600, o.mapInstances[t.mapRootId].mapY = ((C = n.value) == null ? void 0 : C.getBoundingClientRect().top) ?? 600);
|
|
2787
|
+
}, 200), console.log("mapStore.mapInstances[mapRootId]--->", t.mapRootId), ht.on(fe), gt.on(De);
|
|
2786
2788
|
}), Vt(() => {
|
|
2787
2789
|
console.log("组件卸载,清理事件监听"), dt.off(W), ht.off(fe), gt.off(De);
|
|
2788
2790
|
}), (a, u) => (zt(), jt("div", {
|
|
@@ -2813,7 +2815,7 @@ const pr = ["id"], xr = { class: "left-bar" }, wr = { class: "right-bar" }, Ir =
|
|
|
2813
2815
|
], 8, pr)
|
|
2814
2816
|
], 512));
|
|
2815
2817
|
}
|
|
2816
|
-
}), Br = /* @__PURE__ */ ni(vr, [["__scopeId", "data-v-
|
|
2818
|
+
}), Br = /* @__PURE__ */ ni(vr, [["__scopeId", "data-v-ffadd8e0"]]);
|
|
2817
2819
|
export {
|
|
2818
2820
|
Nr as L,
|
|
2819
2821
|
Br as M,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as sA } from "./pako.esm-Bx5X36Wo.js";
|
|
2
2
|
import { g as DA } from "./_commonjsHelpers-C6fGbg64.js";
|
|
3
3
|
import { B as nA } from "./basedecoder-PoXbLGBV.js";
|
|
4
|
-
import { L as fA, a as gA } from "./MapView-
|
|
4
|
+
import { L as fA, a as gA } from "./MapView-CxOMifz_.js";
|
|
5
5
|
var BA = { exports: {} }, iA;
|
|
6
6
|
function tA() {
|
|
7
7
|
return iA || (iA = 1, function(j) {
|