PageSourceSearch

https://quenaris.vercel.app/assets/geotiff-bundle-BxzDHvdf.js

js quenaris.vercel.app collected 2026-10-03 07:33:51 UTC 34,747 bytes, 6 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/deflate-aRC4zbRa.js","assets/pako.esm-BkaqWuDM.js","assets/lerc-BoMzOj4X.js","assets/leaflet-bundle-AX0SPjbQ.js"])))=>i.map(i=>d[i]);
2function S(r){return(e,...t)=>Ve(r,e,t)}function R(r,e){return S(xe(r,e).get)}const{apply:Ve,getOwnPropertyDescriptor:xe,getPrototypeOf:se,ownKeys:Ke}=Reflect,{iterator:Y,toStringTag:ve}=Symbol,ke=Object,{create:oe,defineProperty:je}=ke,Ye=Array,Xe=Ye.prototype,we=Xe[Y],qe=S(we),me=ArrayBuffer,ze=me.prototype;R(ze,"byteLength");const ye=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:null;ye&&R(ye.prototype,"byteLength");const Te=se(Uint8Array);Te.from;const E=Te.prototype;E[Y];S(E.keys);S(E.values);S(E.entries);S(E.set);S(E.reverse);S(E.fill);S(E.copyWithin);S(E.sort);S(E.slice);S(E.subarray);R(E,"buffer");R(E,"byteOffset");R(E,"length");R(E,ve);const He=Uint8Array,Ae=Uint16Array,ae=Uint32Array,$e=Float32Array,j=se([][Y]()),De=S(j.next),Ze=S(function*(){}().next),Je=se(j),Qe=DataView.prototype,We=S(Qe.getUint16),le=WeakMap,Ie=le.prototype,Se=S(Ie.get),et=S(Ie.set),be=new le,tt=oe(null,{next:{value:function(){const e=Se(be,this);return De(e)}},[Y]:{value:function(){return this}}});function rt(r){if(r[Y]===we&&j.next===De)return r;const e=oe(tt);return et(be,e,qe(r)),e}const it=new le,nt=oe(Je,{next:{value:function(){const e=Se(it,this);return Ze(e)},writable:!0,configurable:!0}});for(const r of Ke(j))r!=="next"&&je(nt,r,xe(j,r));const Ee=new me(4),st=new $e(Ee),ot=new ae(Ee),O=new Ae(512),G=new He(512);for(let r=0;r<256;++r){const e=r-127;e<-24?(O[r]=0,O[r|256]=32768,G[r]=24,G[r|256]=24):e<-14?(O[r]=1024>>-e-14,O[r|256]=1024>>-e-14|32768,G[r]=-e-1,G[r|256]=-e-1):e<=15?(O[r]=e+15<<10,O[r|256]=e+15<<10|32768,G[r]=13,G[r|256]=13):e<128?(O[r]=31744,O[r|256]=64512,G[r]=24,G[r|256]=24):(O[r]=31744,O[r|256]=64512,G[r]=13,G[r|256]=13)}const ce=new ae(2048);for(let r=1;r<1024;++r){let e=r<<13,t=0;for(;!(e&8388608);)e<<=1,t-=8388608;e&=-8388609,t+=947912704,ce[r]=e|t}for(let r=1024;r<2048;++r)ce[r]=939524096+(r-1024<<13);const L=new ae(64);for(let r=1;r<31;++r)L[r]=r<<23;L[31]=1199570944;L[32]=2147483648;for(let r=33;r<63;++r)L[r]=2147483648+(r-32<<23);L[63]=3347054592;const Pe=new Ae(64);for(let r=1;r<64;++r)r!==32&&(Pe[r]=1024);function at(r){const e=r>>10;return ot[0]=ce[Pe[e]+(r&1023)]+L[e],st[0]}function Oe(r,e,...t){return at(We(r,e,...rt(t)))}function ee(r,e,t){const n=typeof r=="object"?r.outer:r,i=n.slice(0,n.indexOf(">")+1),s=['"',"'"];for(let a=0;a<s.length;a++){const o=s[a],l=e+"\\="+o+"([^"+o+"]*)"+o,f=new RegExp(l).exec(i);if(f)return f[1]}}function lt(r,e,t){const i=new RegExp(e).exec(r.slice(t));return i?t+i.index:-1}function te(r,e,t){const i=new RegExp(e).exec(r.slice(t));return i?t+i.index+i[0].length-1:-1}function de(r,e){const t=new RegExp(e,"g"),n=r.match(t);return n?n.length:0}function ct(r,e,t){const n=t&&t.debug||!1,i=!(t&&typeof t.nested===!1),s=t&&t.startIndex||
20;n&&console.log("[xml-utils] starting findTagByName with",e," and ",t);const a=lt(r,`<${e}[ 
3>/]`,s);if(n&&console.log("[xml-utils] start:",a),a===-1)return;const o=r.slice(a+e.length);let l=te(o,"^[^<]*[ /]>",0);const c=l!==-1&&o[l-1]==="/";if(n&&console.log("[xml-utils] selfClosing:",c),c===!1)if(i){let g=0,u=1,p=0;for(;(l=te(o,"[ /]"+e+">",g))!==-1;){const y=o.substring(g,l+1);if(u+=de(y,"<"+e+`[ 
4	>]`),p+=de(y,"</"+e+">"),p>=u)break;g=l}}else l=te(o,"[ /]"+e+">",0);const f=a+e.length+l+1;if(n&&console.log("[xml-utils] end:",f),f===-1)return;const h=r.slice(a,f);let d;return c?d=null:d=h.slice(h.indexOf(">")+1,h.lastIndexOf("<")),{inner:d,outer:h,start:a,end:f}}function ft(r,e,t){const n=[];let s=0,a;for(;a=ct(r,e,{debug:!1,startIndex:s});)s=a.start+1+e.length,n.push(a);return n}const k={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",34412:"CZ_LSMINFO",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"},M={};for(const r in k)k.hasOwnProperty(r)&&(M[k[r]]=parseInt(r,10));const ht=[M.BitsPerSample,M.ExtraSamples,M.SampleFormat,M.StripByteCounts,M.StripOffsets,M.StripRowCounts,M.TileByteCounts,M.TileOffsets,M.SubIFDs],re={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"},w={};for(const r in re)re.hasOwnProperty(r)&&(w[re[r]]=parseInt(r,10));const P={WhiteIsZero:0,BlackIsZero:1,RGB:2,Palette:3,CMYK:5,YCbCr:6,CIELab:8},ut={Unspecified:0},Ht={AddCompression:1},$t={None:0,Deflate:1,Zstandard:2},gt={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 yt(r,e){const{width:t,height:n}=r,i=new Uint8Array(t*n*3);let s;for(let a=0,o=0;a<r.length;++a,o+=3)s=256-r[a]/e*256,i[o]=s,i[o+1]=s,i[o+2]=s;return i}function dt(r,e){const{width:t,height:n}=r,i=new Uint8Array(t*n*3);let s;for(let a=0,o=0;a<r.length;++a,o+=3)s=r[a]/e*256,i[o]=s,i[o+1]=s,i[o+2]=s;return i}function pt(r,e){const{width:t,height:n}=r,i=new Uint8Array(t*n*3),s=e.length/3,a=e.length/3*2;for(let o=0,l=0;o<r.length;++o,l+=3){const c=r[o];i[l]=e[c]/65536*256,i[l+1]=e[c+s]/65536*256,i[l+2]=e[c+a]/65536*256}return i}function xt(r){const{width:e,height:t}=r,n=new Uint8Array(e*t*3);for(let i=0,s=0;i<r.length;i+=4,s+=3){const a=r[i],o=r[i+1],l=r[i+2],c=r[i+3];n[s]=255*((255-a)/256)*((255-c)/256),n[s+1]=255*((255-o)/256)*((255-c)/256),n[s+2]=255*((255-l)/256)*((255-c)/256)}return n}function wt(r){const{width:e,height:t}=r,n=new Uint8ClampedArray(e*t*3);for(let i=0,s=0;i<r.length;i+=3,s+=3){const a=r[i],o=r[i+1],l=r[i+2];n[s]=a+1.402*(l-128),n[s+1]=a-.34414*(o-128)-.71414*(l-128),n[s+2]=a+1.772*(o-128)}return n}const mt=.95047,Tt=1,At=1.08883;function Dt(r){const{width:e,height:t}=r,n=new Uint8Array(e*t*3);for(let i=0,s=0;i<r.length;i+=3,s+=3){const a=r[i+0],o=r[i+1]<<24>>24,l=r[i+2]<<24>>24;let c=(a+16)/116,f=o/500+c,h=c-l/200,d,g,u;f=mt*(f*f*f>.008856?f*f*f:(f-16/116)/7.787),c=Tt*(c*c*c>.008856?c*c*c:(c-16/116)/7.787),h=At*(h*h*h>.008856?h*h*h:(h-16/116)/7.787),d=f*3.2406+c*-1.5372+h*-.4986,g=f*-.9689+c*1.8758+h*.0415,u=f*.0557+c*-.204+h*1.057,d=d>.0031308?1.055*d**(1/2.4)-.055:12.92*d,g=g>.0031308?1.055*g**(1/2.4)-.055:12.92*g,u=u>.0031308?1.055*u**(1/2.4)-.055:12.92*u,n[s]=Math.max(0,Math.min(1,d))*255,n[s+1]=Math.max(0,Math.min(1,g))*255,n[s+2]=Math.max(0,Math.min(1,u))*255}return n}const It="modulepreload",St=function(r){return"/"+r},pe={},F=function(e,t,n){let i=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),o=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=Promise.allSettled(t.map(l=>{if(l=St(l),l in pe)return;pe[l]=!0;const c=l.endsWith(".css"),f=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${f}`))return;const h=document.createElement("link");
4if(h.rel=c?"stylesheet":It,c||(h.as="script"),h.crossOrigin="",h.href=l,o&&h.setAttribute("nonce",o),document.head.appendChild(h),c)return new Promise((d,g)=>{h.addEventListener("load",d),h.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${l}`)))})}))}function s(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return i.then(a=>{for(const o of a||[])o.status==="rejected"&&s(o.reason);return e().catch(s)})},Ge=new Map,bt=new Map;function _(r,e,t=!0){Array.isArray(r)||(r=[r]),r.forEach(n=>{Ge.set(n,e),bt.set(n,t)})}async function Et(r){const e=Ge.get(r.Compression);if(!e)throw new Error(`Unknown compression method identifier: ${r.Compression}`);const t=await e();return new t(r)}_([void 0,1],()=>F(()=>import("./raw-B1tBpw1o.js"),[]).then(r=>r.default),!1);_(5,()=>F(()=>import("./lzw-BGYFUFd2.js"),[]).then(r=>r.default));_(6,()=>{throw new Error("old style JPEG compression is not supported.")});_(7,()=>F(()=>import("./jpeg-Cd_UuL6B.js"),[]).then(r=>r.default));_([8,32946],()=>F(()=>import("./deflate-aRC4zbRa.js"),__vite__mapDeps([0,1])).then(r=>r.default));_(32773,()=>F(()=>import("./packbits-DN_mitvU.js"),[]).then(r=>r.default));_(34887,()=>F(()=>import("./lerc-BoMzOj4X.js"),__vite__mapDeps([2,1,3])).then(async r=>(await r.zstd.init(),r)).then(r=>r.default));_(5e4,()=>F(()=>import("./zstd-BKCev_-v.js"),[]).then(async r=>(await r.zstd.init(),r)).then(r=>r.default));_(50001,()=>F(()=>import("./webimage-B8gmb79s.js"),[]).then(r=>r.default),!1);function J(r,e,t,n=1){return new(Object.getPrototypeOf(r)).constructor(e*t*n)}function Pt(r,e,t,n,i){const s=e/n,a=t/i;return r.map(o=>{const l=J(o,n,i);for(let c=0;c<i;++c){const f=Math.min(Math.round(a*c),t-1);for(let h=0;h<n;++h){const d=Math.min(Math.round(s*h),e-1),g=o[f*e+d];l[c*n+h]=g}}return l})}function C(r,e,t){return(1-t)*r+t*e}function Ot(r,e,t,n,i){const s=e/n,a=t/i;return r.map(o=>{const l=J(o,n,i);for(let c=0;c<i;++c){const f=a*c,h=Math.floor(f),d=Math.min(Math.ceil(f),t-1);for(let g=0;g<n;++g){const u=s*g,p=u%1,y=Math.floor(u),m=Math.min(Math.ceil(u),e-1),x=o[h*e+y],A=o[h*e+m],D=o[d*e+y],T=o[d*e+m],I=C(C(x,A,p),C(D,T,p),f%1);l[c*n+g]=I}}return l})}function Gt(r,e,t,n,i,s="nearest"){switch(s.toLowerCase()){case"nearest":return Pt(r,e,t,n,i);case"bilinear":case"linear":return Ot(r,e,t,n,i);default:throw new Error(`Unsupported resampling method: '${s}'`)}}function Mt(r,e,t,n,i,s){const a=e/n,o=t/i,l=J(r,n,i,s);for(let c=0;c<i;++c){const f=Math.min(Math.round(o*c),t-1);for(let h=0;h<n;++h){const d=Math.min(Math.round(a*h),e-1);for(let g=0;g<s;++g){const u=r[f*e*s+d*s+g];l[c*n*s+h*s+g]=u}}}return l}function _t(r,e,t,n,i,s){const a=e/n,o=t/i,l=J(r,n,i,s);for(let c=0;c<i;++c){const f=o*c,h=Math.floor(f),d=Math.min(Math.ceil(f),t-1);for(let g=0;g<n;++g){const u=a*g,p=u%1,y=Math.floor(u),m=Math.min(Math.ceil(u),e-1);for(let x=0;x<s;++x){const A=r[h*e*s+y*s+x],D=r[h*e*s+m*s+x],T=r[d*e*s+y*s+x],I=r[d*e*s+m*s+x],U=C(C(A,D,p),C(T,I,p),f%1);l[c*n*s+g*s+x]=U}}}return l}function Ft(r,e,t,n,i,s,a="nearest"){switch(a.toLowerCase()){case"nearest":return Mt(r,e,t,n,i,s);case"bilinear":case"linear":return _t(r,e,t,n,i,s);default:throw new Error(`Unsupported resampling method: '${a}'`)}}function Ut(r,e,t){let n=0;for(let i=e;i<t;++i)n+=r[i];return n}function ie(r,e,t){switch(r){case 1:if(e<=8)return new Uint8Array(t);if(e<=16)return new Uint16Array(t);if(e<=32)return new Uint32Array(t);break;case 2:if(e===8)return new Int8Array(t);if(e===16)return new Int16Array(t);if(e===32)return new Int32Array(t);break;case 3:switch(e){case 16:case 32:return new Float32Array(t);case 64:return new Float64Array(t)}break}throw Error("Unsupported data format/bitsPerSample")}function Bt(r,e){return(r===1||r===2)&&e<=32&&e%8===0?!1:!(r===3&&(e===16||e===32||e===64))}function Ct(r,e,t,n,i,s,a){const o=new DataView(r),l=t===2?a*s:a*s*n,c=t===2?1:n,f=ie(e,i,l),h=parseInt("1".repeat(i),2);if(e===1){let d;t===1?d=n*i:d=i;let g=s*d;g&7&&(g=g+7&-8);for(let u=0;u<a;++u){const p=u*g;
4for(let y=0;y<s;++y){const m=p+y*c*i;for(let x=0;x<c;++x){const A=m+x*i,D=(u*s+y)*c+x,T=Math.floor(A/8),I=A%8;if(I+i<=8)f[D]=o.getUint8(T)>>8-i-I&h;else if(I+i<=16)f[D]=o.getUint16(T)>>16-i-I&h;else if(I+i<=24){const U=o.getUint16(T)<<8|o.getUint8(T+2);f[D]=U>>24-i-I&h}else f[D]=o.getUint32(T)>>32-i-I&h}}}}return f.buffer}class Rt{constructor(e,t,n,i,s,a){this.fileDirectory=e,this.geoKeys=t,this.dataView=n,this.littleEndian=i,this.tiles=s?{}:null,this.isTiled=!e.StripOffsets;const o=e.PlanarConfiguration;if(this.planarConfiguration=typeof o>"u"?1:o,this.planarConfiguration!==1&&this.planarConfiguration!==2)throw new Error("Invalid planar configuration.");this.source=a}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 t=0;t<this.fileDirectory.BitsPerSample.length;++t)e+=this.getSampleByteSize(t);return e}getSampleByteSize(e){if(e>=this.fileDirectory.BitsPerSample.length)throw new RangeError(`Sample index ${e} is out of range.`);return Math.ceil(this.fileDirectory.BitsPerSample[e]/8)}getReaderForSample(e){const t=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1,n=this.fileDirectory.BitsPerSample[e];switch(t){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,s){return Oe(this,i,s)};case 32:return DataView.prototype.getFloat32;case 64:return DataView.prototype.getFloat64}break}throw Error("Unsupported data format/bitsPerSample")}getSampleFormat(e=0){return this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1}getBitsPerSample(e=0){return this.fileDirectory.BitsPerSample[e]}getArrayForSample(e,t){const n=this.getSampleFormat(e),i=this.getBitsPerSample(e);return ie(n,i,t)}async getTileOrStrip(e,t,n,i,s){const a=Math.ceil(this.getWidth()/this.getTileWidth()),o=Math.ceil(this.getHeight()/this.getTileHeight());let l;const{tiles:c}=this;this.planarConfiguration===1?l=t*a+e:this.planarConfiguration===2&&(l=n*a*o+t*a+e);let f,h;if(this.isTiled?(f=this.fileDirectory.TileOffsets[l],h=this.fileDirectory.TileByteCounts[l]):(f=this.fileDirectory.StripOffsets[l],h=this.fileDirectory.StripByteCounts[l]),h===0){const u=this.getBlockHeight(t)*this.getTileWidth(),p=this.planarConfiguration===2?this.getSampleByteSize(n):this.getBytesPerPixel(),y=new ArrayBuffer(u*p);return this.getArrayForSample(n,y).fill(this.getGDALNoData()||0),{x:e,y:t,sample:n,data:y}}const d=(await this.source.fetch([{offset:f,length:h}],s))[0];let g;return c===null||!c[l]?(g=(async()=>{let u=await i.decode(this.fileDirectory,d);const p=this.getSampleFormat(),y=this.getBitsPerSample();return Bt(p,y)&&(u=Ct(u,p,this.planarConfiguration,this.getSamplesPerPixel(),y,this.getTileWidth(),this.getBlockHeight(t))),u})(),c!==null&&(c[l]=g)):g=c[l],{x:e,y:t,sample:n,data:await g}}async _readRaster(e,t,n,i,s,a,o,l,c){const f=this.getTileWidth(),h=this.getTileHeight(),d=this.getWidth(),g=this.getHeight(),u=Math.max(Math.floor(e[0]/f),0),p=Math.min(Math.ceil(e[2]/f),Math.ceil(d/f)),y=Math.max(Math.floor(e[1]/h),0),m=Math.min(Math.ceil(e[3]/h),Math.ceil(g/h)),x=e[2]-e[0];let A=this.getBytesPerPixel();const D=[],T=[];for(let b=0;b<t.length;++b)this.planarConfiguration===1?D.push(Ut(this.fileDirectory.BitsPerSample,0,t[b])/8):D.push(0),T.push(this.getReaderForSample(t[b]));const I=[],{littleEndian:U}=this;for(let b=y;b<m;++b)for(let X=u;X<p;++X){let Q;this.planarConfiguration===1&&(Q=this.getTileOrStrip(X,b,0,s,c));for(let q=0;q<t.length;++q){const z=q,ue=t[q];this.planarConfiguration===2&&(A=this.getSampleByteSize(ue),Q=this.getTileOrStrip(X,b,ue,s,c));const Me=Q.then(N=>{const _e=N.data,Fe=new DataView(_e),W=this.getBlockHeight(N.y),V=N.y*h,H=N.x*f,Ue=V+W,Be=(N.x+1)
4*f,Ce=T[z],Re=Math.min(W,W-(Ue-e[3]),g-V),Le=Math.min(f,f-(Be-e[2]),d-H);for(let K=Math.max(0,e[1]-V);K<Re;++K)for(let v=Math.max(0,e[0]-H);v<Le;++v){const Ne=(K*f+v)*A,ge=Ce.call(Fe,Ne+D[z],U);let $;i?($=(K+V-e[1])*x*t.length+(v+H-e[0])*t.length+z,n[$]=ge):($=(K+V-e[1])*x+v+H-e[0],n[z][$]=ge)}});I.push(Me)}}if(await Promise.all(I),a&&e[2]-e[0]!==a||o&&e[3]-e[1]!==o){let b;return i?b=Ft(n,e[2]-e[0],e[3]-e[1],a,o,t.length,l):b=Gt(n,e[2]-e[0],e[3]-e[1],a,o,l),b.width=a,b.height=o,b}return n.width=a||e[2]-e[0],n.height=o||e[3]-e[1],n}async readRasters({window:e,samples:t=[],interleave:n,pool:i=null,width:s,height:a,resampleMethod:o,fillValue:l,signal:c}={}){const f=e||[0,0,this.getWidth(),this.getHeight()];if(f[0]>f[2]||f[1]>f[3])throw new Error("Invalid subsets");const h=f[2]-f[0],d=f[3]-f[1],g=h*d,u=this.getSamplesPerPixel();if(!t||!t.length)for(let x=0;x<u;++x)t.push(x);else for(let x=0;x<t.length;++x)if(t[x]>=u)return Promise.reject(new RangeError(`Invalid sample index '${t[x]}'.`));let p;if(n){const x=this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,A=Math.max.apply(null,this.fileDirectory.BitsPerSample);p=ie(x,A,g*t.length),l&&p.fill(l)}else{p=[];for(let x=0;x<t.length;++x){const A=this.getArrayForSample(t[x],g);Array.isArray(l)&&x<l.length?A.fill(l[x]):l&&!Array.isArray(l)&&A.fill(l),p.push(A)}}const y=i||await Et(this.fileDirectory);return await this._readRaster(f,t,p,n,y,s,a,o,c)}async readRGB({window:e,interleave:t=!0,pool:n=null,width:i,height:s,resampleMethod:a,enableAlpha:o=!1,signal:l}={}){const c=e||[0,0,this.getWidth(),this.getHeight()];if(c[0]>c[2]||c[1]>c[3])throw new Error("Invalid subsets");const f=this.fileDirectory.PhotometricInterpretation;if(f===P.RGB){let m=[0,1,2];if(this.fileDirectory.ExtraSamples!==ut.Unspecified&&o){m=[];for(let x=0;x<this.fileDirectory.BitsPerSample.length;x+=1)m.push(x)}return this.readRasters({window:e,interleave:t,samples:m,pool:n,width:i,height:s,resampleMethod:a,signal:l})}let h;switch(f){case P.WhiteIsZero:case P.BlackIsZero:case P.Palette:h=[0];break;case P.CMYK:h=[0,1,2,3];break;case P.YCbCr:case P.CIELab:h=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const d={window:c,interleave:!0,samples:h,pool:n,width:i,height:s,resampleMethod:a,signal:l},{fileDirectory:g}=this,u=await this.readRasters(d),p=2**this.fileDirectory.BitsPerSample[0];let y;switch(f){case P.WhiteIsZero:y=yt(u,p);break;case P.BlackIsZero:y=dt(u,p);break;case P.Palette:y=pt(u,g.ColorMap);break;case P.CMYK:y=xt(u);break;case P.YCbCr:y=wt(u);break;case P.CIELab:y=Dt(u);break;default:throw new Error("Unsupported photometric interpretation.")}if(!t){const m=new Uint8Array(y.length/3),x=new Uint8Array(y.length/3),A=new Uint8Array(y.length/3);for(let D=0,T=0;D<y.length;D+=3,++T)m[T]=y[D],x[T]=y[D+1],A[T]=y[D+2];y=[m,x,A]}return y.width=u.width,y.height=u.height,y}getTiePoints(){if(!this.fileDirectory.ModelTiepoint)return[];const e=[];for(let t=0;t<this.fileDirectory.ModelTiepoint.length;t+=6)e.push({i:this.fileDirectory.ModelTiepoint[t],j:this.fileDirectory.ModelTiepoint[t+1],k:this.fileDirectory.ModelTiepoint[t+2],x:this.fileDirectory.ModelTiepoint[t+3],y:this.fileDirectory.ModelTiepoint[t+4],z:this.fileDirectory.ModelTiepoint[t+5]});return e}getGDALMetadata(e=null){const t={};if(!this.fileDirectory.GDAL_METADATA)return null;const n=this.fileDirectory.GDAL_METADATA;let i=ft(n,"Item");e===null?i=i.filter(s=>ee(s,"sample")===void 0):i=i.filter(s=>Number(ee(s,"sample"))===e);for(let s=0;s<i.length;++s){const a=i[s];t[ee(a,"name")]=a.inner}return t}getGDALNoData(){if(!this.fileDirectory.GDAL_NODATA)return null;const e=this.fileDirectory.GDAL_NODATA;return Number(e.substring(0,e.length-1))}getOrigin(){const e=this.fileDirectory.ModelTiepoint,t=this.fileDirectory.ModelTransformation;if(e&&e.length===6)return[e[3],e[4],e[5]];if(t)return[t[3],t[7],t[11]];throw new Error("The image does not have an affine transformation.")}getResolution(e=null){const t=this.fileDirectory.ModelPixelScale,n=this.fileDirectory.ModelTransformation;if(t)return[t[0],-t[1],t[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,s,a]=e.getResolution();return[i*e.getWidth()/this.getWidth(),s*e.getHeight()/this.getHeight(),a*e.getWidth()/this.getWidth()]}throw new Error("The image does not have an affine transformation.")}pixelIsArea(){return this.geoKeys.GTRasterTypeGeoKey===1}getBoundingBox(e=!1){const t=this.getHeight(),n=this.getWidth();if(this.fileDirectory.ModelTransformation&&!e){const[i,s,a,o,l,c,f,h]=this.fileDirectory.ModelTransformation,g=[[0,0],[0,t],[n,0],[n,t]].map(([y,m])=>[o+i*y+s*m,h+l*y+c*m]),u=g.map(y=>y[0]),p=g.map(y=>y[1]);return[Math.min(...u),Math.min(...p),Math.max(...u),Math.max(...p)]}else{const i=this.getOrigin(),s=this.getResolution(),a=i[0],o=i[1],l=a+s[0]*n,c=o+s[1]*t;return[Math.min(a,l),Math.min(o,c),Math.max(a,l),Math.max(o,c)]}}}class Lt{constructor(e){this._dataView=new DataView(e)}get buffer(){return this._dataView.buffer}
4getUint64(e,t){const n=this.getUint32(e,t),i=this.getUint32(e+4,t);let s;if(t){if(s=n+2**32*i,!Number.isSafeInteger(s))throw new Error(`${s} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return s}if(s=2**32*n+i,!Number.isSafeInteger(s))throw new Error(`${s} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return s}getInt64(e,t){let n=0;const i=(this._dataView.getUint8(e+(t?7:0))&128)>0;let s=!0;for(let a=0;a<8;a++){let o=this._dataView.getUint8(e+(t?a:7-a));i&&(s?o!==0&&(o=~(o-1)&255,s=!1):o=~o&255),n+=o*256**a}return i&&(n=-n),n}getUint8(e,t){return this._dataView.getUint8(e,t)}getInt8(e,t){return this._dataView.getInt8(e,t)}getUint16(e,t){return this._dataView.getUint16(e,t)}getInt16(e,t){return this._dataView.getInt16(e,t)}getUint32(e,t){return this._dataView.getUint32(e,t)}getInt32(e,t){return this._dataView.getInt32(e,t)}getFloat16(e,t){return Oe(this._dataView,e,t)}getFloat32(e,t){return this._dataView.getFloat32(e,t)}getFloat64(e,t){return this._dataView.getFloat64(e,t)}}class Nt{constructor(e,t,n,i){this._dataView=new DataView(e),this._sliceOffset=t,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,t){return this.sliceOffset<=e&&this.sliceTop>=e+t}readUint8(e){return this._dataView.getUint8(e-this._sliceOffset,this._littleEndian)}readInt8(e){return this._dataView.getInt8(e-this._sliceOffset,this._littleEndian)}readUint16(e){return this._dataView.getUint16(e-this._sliceOffset,this._littleEndian)}readInt16(e){return this._dataView.getInt16(e-this._sliceOffset,this._littleEndian)}readUint32(e){return this._dataView.getUint32(e-this._sliceOffset,this._littleEndian)}readInt32(e){return this._dataView.getInt32(e-this._sliceOffset,this._littleEndian)}readFloat32(e){return this._dataView.getFloat32(e-this._sliceOffset,this._littleEndian)}readFloat64(e){return this._dataView.getFloat64(e-this._sliceOffset,this._littleEndian)}readUint64(e){const t=this.readUint32(e),n=this.readUint32(e+4);let i;if(this._littleEndian){if(i=t+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*t+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 t=0;const n=(this._dataView.getUint8(e+(this._littleEndian?7:0))&128)>0;let i=!0;for(let s=0;s<8;s++){let a=this._dataView.getUint8(e+(this._littleEndian?s:7-s));n&&(i?a!==0&&(a=~(a-1)&255,i=!1):a=~a&255),t+=a*256**s}return n&&(t=-t),t}readOffset(e){return this._bigTiff?this.readUint64(e):this.readUint32(e)}}class Vt{async fetch(e,t=void 0){return Promise.all(e.map(n=>this.fetchSlice(n,t)))}async fetchSlice(e){throw new Error(`fetching of slice ${e} not possible, not implemented`)}get fileSize(){return null}async close(){}}class fe extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,fe),this.name="AbortError"}}class Kt extends Vt{constructor(e){super(),this.arrayBuffer=e}fetchSlice(e,t){if(t&&t.aborted)throw new fe("Request aborted");return this.arrayBuffer.slice(e.offset,e.offset+e.length)}}function vt(r){return new Kt(r)}function kt(r,e){let t=r.length-e,n=0;do{for(let i=e;i>0;i--)r[n+e]+=r[n],n++;t-=e}while(t>0)}function jt(r,e,t){let n=0,i=r.length;const s=i/t;for(;i>e;){for(let o=e;o>0;--o)r[n+e]+=r[n],++n;i-=e}const a=r.slice();for(let o=0;o<s;++o)for(let l=0;l<t;++l)r[t*o+l]=a[(t-l-1)*s+o]}function Yt(r,e,t,n,i,s){if(e===1)return r;for(let l=0;l<i.length;++l){if(i[l]%8!==0)throw new Error("When decoding with predictor, only multiple of 8 bits are supported.");
4if(i[l]!==i[0])throw new Error("When decoding with predictor, all samples must have the same size.")}const a=i[0]/8,o=s===2?1:i.length;for(let l=0;l<n&&!(l*o*t*a>=r.byteLength);++l){let c;if(e===2){switch(i[0]){case 8:c=new Uint8Array(r,l*o*t*a,o*t*a);break;case 16:c=new Uint16Array(r,l*o*t*a,o*t*a/2);break;case 32:c=new Uint32Array(r,l*o*t*a,o*t*a/4);break;default:throw new Error(`Predictor 2 not allowed with ${i[0]} bits per sample.`)}kt(c,o)}else e===3&&(c=new Uint8Array(r,l*o*t*a,o*t*a),jt(c,o,a))}return r}class Zt{async decode(e,t){const n=await this.decodeBlock(t),i=e.Predictor||1;if(i!==1){const s=!e.StripOffsets,a=s?e.TileWidth:e.ImageWidth,o=s?e.TileLength:e.RowsPerStrip||e.ImageLength;return Yt(n,i,a,o,e.BitsPerSample,e.PlanarConfiguration)}return n}}function ne(r){switch(r){case w.BYTE:case w.ASCII:case w.SBYTE:case w.UNDEFINED:return 1;case w.SHORT:case w.SSHORT:return 2;case w.LONG:case w.SLONG:case w.FLOAT:case w.IFD:return 4;case w.RATIONAL:case w.SRATIONAL:case w.DOUBLE:case w.LONG8:case w.SLONG8:case w.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${r}`)}}function Xt(r){const e=r.GeoKeyDirectory;if(!e)return null;const t={};for(let n=4;n<=e[3]*4;n+=4){const i=gt[e[n]],s=e[n+1]?k[e[n+1]]:null,a=e[n+2],o=e[n+3];let l=null;if(!s)l=o;else{if(l=r[s],typeof l>"u"||l===null)throw new Error(`Could not get value of geoKey '${i}'.`);typeof l=="string"?l=l.substring(o,o+a-1):l.subarray&&(l=l.subarray(o,o+a),a===1&&(l=l[0]))}t[i]=l}return t}function B(r,e,t,n){let i=null,s=null;const a=ne(e);switch(e){case w.BYTE:case w.ASCII:case w.UNDEFINED:i=new Uint8Array(t),s=r.readUint8;break;case w.SBYTE:i=new Int8Array(t),s=r.readInt8;break;case w.SHORT:i=new Uint16Array(t),s=r.readUint16;break;case w.SSHORT:i=new Int16Array(t),s=r.readInt16;break;case w.LONG:case w.IFD:i=new Uint32Array(t),s=r.readUint32;break;case w.SLONG:i=new Int32Array(t),s=r.readInt32;break;case w.LONG8:case w.IFD8:i=new Array(t),s=r.readUint64;break;case w.SLONG8:i=new Array(t),s=r.readInt64;break;case w.RATIONAL:i=new Uint32Array(t*2),s=r.readUint32;break;case w.SRATIONAL:i=new Int32Array(t*2),s=r.readInt32;break;case w.FLOAT:i=new Float32Array(t),s=r.readFloat32;break;case w.DOUBLE:i=new Float64Array(t),s=r.readFloat64;break;default:throw new RangeError(`Invalid field type: ${e}`)}if(e===w.RATIONAL||e===w.SRATIONAL)for(let o=0;o<t;o+=2)i[o]=s.call(r,n+o*a),i[o+1]=s.call(r,n+(o*a+4));else for(let o=0;o<t;++o)i[o]=s.call(r,n+o*a);return e===w.ASCII?new TextDecoder("utf-8").decode(i):i}class qt{constructor(e,t,n,i){this.fileDirectory=e,this.rawFileDirectory=t,this.geoKeyDirectory=n,this.nextIFDByteOffset=i}}
4class Z extends Error{constructor(e){super(`No image at index ${e}`),this.index=e}}class zt{async readRasters(e={}){const{window:t,width:n,height:i}=e;let{resX:s,resY:a,bbox:o}=e;const l=await this.getImage();let c=l;const f=await this.getImageCount(),h=l.getBoundingBox();if(t&&o)throw new Error('Both "bbox" and "window" passed.');if(n||i){if(t){const[u,p]=l.getOrigin(),[y,m]=l.getResolution();o=[u+t[0]*y,p+t[1]*m,u+t[2]*y,p+t[3]*m]}const g=o||h;if(n){if(s)throw new Error("Both width and resX passed");s=(g[2]-g[0])/n}if(i){if(a)throw new Error("Both width and resY passed");a=(g[3]-g[1])/i}}if(s||a){const g=[];for(let u=0;u<f;++u){const p=await this.getImage(u),{SubfileType:y,NewSubfileType:m}=p.fileDirectory;(u===0||y===2||m&1)&&g.push(p)}g.sort((u,p)=>u.getWidth()-p.getWidth());for(let u=0;u<g.length;++u){const p=g[u],y=(h[2]-h[0])/p.getWidth(),m=(h[3]-h[1])/p.getHeight();if(c=p,s&&s>y||a&&a>m)break}}let d=t;if(o){const[g,u]=l.getOrigin(),[p,y]=c.getResolution(l);d=[Math.round((o[0]-g)/p),Math.round((o[1]-u)/y),Math.round((o[2]-g)/p),Math.round((o[3]-u)/y)],d=[Math.min(d[0],d[2]),Math.min(d[1],d[3]),Math.max(d[0],d[2]),Math.max(d[1],d[3])]}return c.readRasters({...e,window:d})}}class he extends zt{constructor(e,t,n,i,s={}){super(),this.source=e,this.littleEndian=t,this.bigTiff=n,this.firstIFDOffset=i,this.cache=s.cache||!1,this.ifdRequests=[],this.ghostValues=null}async getSlice(e,t){const n=this.bigTiff?4048:1024;return new Nt((await this.source.fetch([{offset:e,length:typeof t<"u"?t:n}]))[0],e,this.littleEndian,this.bigTiff)}async parseFileDirectoryAt(e){const t=this.bigTiff?20:12,n=this.bigTiff?8:2;
4let i=await this.getSlice(e);const s=this.bigTiff?i.readUint64(e):i.readUint16(e),a=s*t+(this.bigTiff?16:6);i.covers(e,a)||(i=await this.getSlice(e,a));const o={},l=new Map;let c=e+(this.bigTiff?8:2);for(let d=0;d<s;c+=t,++d){const g=i.readUint16(c),u=i.readUint16(c+2),p=this.bigTiff?i.readUint64(c+4):i.readUint32(c+4);let y,m;const x=ne(u),A=c+(this.bigTiff?12:8);if(x*p<=(this.bigTiff?8:4))y=B(i,u,p,A);else{const T=i.readOffset(A),I=ne(u)*p;if(i.covers(T,I))y=B(i,u,p,T);else{const U=await this.getSlice(T,I);y=B(U,u,p,T)}}p===1&&ht.indexOf(g)===-1&&!(u===w.RATIONAL||u===w.SRATIONAL)?m=y[0]:m=y;const D=k[g];D&&(o[D]=m),l.set(g,m)}const f=Xt(o),h=i.readOffset(e+n+t*s);return new qt(o,l,f,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(t){throw t instanceof Z?new Z(e):t}return this.ifdRequests[e]=(async()=>{const t=await this.ifdRequests[e-1];if(t.nextIFDByteOffset===0)throw new Z(e);return this.parseFileDirectoryAt(t.nextIFDByteOffset)})(),this.ifdRequests[e]}async getImage(e=0){const t=await this.requestIFD(e);return new Rt(t.fileDirectory,t.geoKeyDirectory,this.dataView,this.littleEndian,this.cache,this.source)}async getImageCount(){let e=0,t=!0;for(;t;)try{await this.requestIFD(e),++e}catch(n){if(n instanceof Z)t=!1;else throw n}return e}async getGhostValues(){const e=this.bigTiff?16:8;if(this.ghostValues)return this.ghostValues;const t="GDAL_STRUCTURAL_METADATA_SIZE=",n=t.length+100;
4let i=await this.getSlice(e,n);if(t===B(i,w.ASCII,t.length,e)){const a=B(i,w.ASCII,n,e).split(`
5`)[0],o=Number(a.split("=")[1].split(" ")[0])+a.length;o>n&&(i=await this.getSlice(e,o));const l=B(i,w.ASCII,o,e);this.ghostValues={},l.split(`
6`).filter(c=>c.length>0).map(c=>c.split("=")).forEach(([c,f])=>{this.ghostValues[c]=f})}return this.ghostValues}static async fromSource(e,t,n){const i=(await e.fetch([{offset:0,length:1024}],n))[0],s=new Lt(i),a=s.getUint16(0,0);let o;if(a===18761)o=!0;else if(a===19789)o=!1;else throw new TypeError("Invalid byte order value.");const l=s.getUint16(2,o);let c;if(l===42)c=!1;else if(l===43){if(c=!0,s.getUint16(4,o)!==8)throw new Error("Unsupported offset byte-size.")}else throw new TypeError("Invalid magic number.");const f=c?s.getUint64(8,o):s.getUint32(4,o);return new he(e,o,c,f,t)}close(){return typeof this.source.close=="function"?this.source.close():!1}}async function Jt(r,e){return he.fromSource(vt(r),e)}export{Zt as B,Ht as L,$t as a,Jt as f};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.