UNPKG

geotiff

Version:

GeoTIFF image decoding in JavaScript

1 lines 558 kB
!function(A,I){"object"==typeof exports&&"undefined"!=typeof module?I(exports):"function"==typeof define&&define.amd?define(["exports"],I):I((A="undefined"!=typeof globalThis?globalThis:A||self).GeoTIFF={})}(this,(function(A){"use strict";function I(A,I,g){return I in A?Object.defineProperty(A,I,{value:g,enumerable:!0,configurable:!0,writable:!0}):A[I]=g,A}function g(A){if(Array.isArray(A))return A}function B(A,I){(null==I||I>A.length)&&(I=A.length);for(var g=0,B=new Array(I);g<I;g++)B[g]=A[g];return B}function C(A,I){if(A){if("string"==typeof A)return B(A,I);var g=Object.prototype.toString.call(A).slice(8,-1);return"Object"===g&&A.constructor&&(g=A.constructor.name),"Map"===g||"Set"===g?Array.from(A):"Arguments"===g||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(g)?B(A,I):void 0}}function Q(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function E(A,I){return g(A)||function(A,I){var g=null==A?null:"undefined"!=typeof Symbol&&A[Symbol.iterator]||A["@@iterator"];if(null!=g){var B,C,Q=[],E=!0,i=!1;try{for(g=g.call(A);!(E=(B=g.next()).done)&&(Q.push(B.value),!I||Q.length!==I);E=!0);}catch(A){i=!0,C=A}finally{try{E||null==g.return||g.return()}finally{if(i)throw C}}return Q}}(A,I)||C(A,I)||Q()}function i(A,I,g,B,C,Q,E){try{var i=A[Q](E),e=i.value}catch(A){return void g(A)}i.done?I(e):Promise.resolve(e).then(B,C)}function e(A){return function(){var I=this,g=arguments;return new Promise((function(B,C){var Q=A.apply(I,g);function E(A){i(Q,B,C,E,e,"next",A)}function e(A){i(Q,B,C,E,e,"throw",A)}E(void 0)}))}}function t(A,I){for(var g=0;g<I.length;g++){var B=I[g];B.enumerable=B.enumerable||!1,B.configurable=!0,"value"in B&&(B.writable=!0),Object.defineProperty(A,B.key,B)}}function r(A,I,g){return I&&t(A.prototype,I),g&&t(A,g),A}function o(A,I){return o=Object.setPrototypeOf||function(A,I){return A.__proto__=I,A},o(A,I)}function a(A,I){if("function"!=typeof I&&null!==I)throw new TypeError("Super expression must either be null or a function");A.prototype=Object.create(I&&I.prototype,{constructor:{value:A,writable:!0,configurable:!0}}),I&&o(A,I)}function n(A){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(A){return typeof A}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},n(A)}function s(A){if(void 0===A)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return A}function h(A,I){if(I&&("object"===n(I)||"function"==typeof I))return I;if(void 0!==I)throw new TypeError("Derived constructors may only return object or undefined");return s(A)}function c(A){return c=Object.setPrototypeOf?Object.getPrototypeOf:function(A){return A.__proto__||Object.getPrototypeOf(A)},c(A)}function D(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(A){return!1}}function w(A,I,g){return w=D()?Reflect.construct:function(A,I,g){var B=[null];B.push.apply(B,I);var C=new(Function.bind.apply(A,B));return g&&o(C,g.prototype),C},w.apply(null,arguments)}function y(A){var I="function"==typeof Map?new Map:void 0;return y=function(A){if(null===A||(g=A,-1===Function.toString.call(g).indexOf("[native code]")))return A;var g;if("function"!=typeof A)throw new TypeError("Super expression must either be null or a function");if(void 0!==I){if(I.has(A))return I.get(A);I.set(A,B)}function B(){return w(A,arguments,c(this).constructor)}return B.prototype=Object.create(A.prototype,{constructor:{value:B,enumerable:!1,writable:!0,configurable:!0}}),o(B,A)},y(A)}function f(A,I){if(!(A instanceof I))throw new TypeError("Cannot call a class as a function")}var u={exports:{}};!function(A){var I=function(A){var I,g=Object.prototype,B=g.hasOwnProperty,C="function"==typeof Symbol?Symbol:{},Q=C.iterator||"@@iterator",E=C.asyncIterator||"@@asyncIterator",i=C.toStringTag||"@@toStringTag";function e(A,I,g){return Object.defineProperty(A,I,{value:g,enumerable:!0,configurable:!0,writable:!0}),A[I]}try{e({},"")}catch(A){e=function(A,I,g){return A[I]=g}}function t(A,I,g,B){var C=I&&I.prototype instanceof D?I:D,Q=Object.create(C.prototype),E=new R(B||[]);return Q._invoke=function(A,I,g){var B=o;return function(C,Q){if(B===s)throw new Error("Generator is already running");if(B===h){if("throw"===C)throw Q;return U()}for(g.method=C,g.arg=Q;;){var E=g.delegate;if(E){var i=k(E,g);if(i){if(i===c)continue;return i}}if("next"===g.method)g.sent=g._sent=g.arg;else if("throw"===g.method){if(B===o)throw B=h,g.arg;g.dispatchException(g.arg)}else"return"===g.method&&g.abrupt("return",g.arg);B=s;var e=r(A,I,g);if("normal"===e.type){if(B=g.done?h:a,e.arg===c)continue;return{value:e.arg,done:g.done}}"throw"===e.type&&(B=h,g.method="throw",g.arg=e.arg)}}}(A,g,E),Q}function r(A,I,g){try{return{type:"normal",arg:A.call(I,g)}}catch(A){return{type:"throw",arg:A}}}A.wrap=t;var o="suspendedStart",a="suspendedYield",s="executing",h="completed",c={};function D(){}function w(){}function y(){}var f={};e(f,Q,(function(){return this}));var u=Object.getPrototypeOf,l=u&&u(u(L([])));l&&l!==g&&B.call(l,Q)&&(f=l);var S=y.prototype=D.prototype=Object.create(f);function G(A){["next","throw","return"].forEach((function(I){e(A,I,(function(A){return this._invoke(I,A)}))}))}function N(A,I){function g(C,Q,E,i){var e=r(A[C],A,Q);if("throw"!==e.type){var t=e.arg,o=t.value;return o&&"object"===n(o)&&B.call(o,"__await")?I.resolve(o.__await).then((function(A){g("next",A,E,i)}),(function(A){g("throw",A,E,i)})):I.resolve(o).then((function(A){t.value=A,E(t)}),(function(A){return g("throw",A,E,i)}))}i(e.arg)}var C;this._invoke=function(A,B){function Q(){return new I((function(I,C){g(A,B,I,C)}))}return C=C?C.then(Q,Q):Q()}}function k(A,g){var B=A.iterator[g.method];if(B===I){if(g.delegate=null,"throw"===g.method){if(A.iterator.return&&(g.method="return",g.arg=I,k(A,g),"throw"===g.method))return c;g.method="throw",g.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var C=r(B,A.iterator,g.arg);if("throw"===C.type)return g.method="throw",g.arg=C.arg,g.delegate=null,c;var Q=C.arg;return Q?Q.done?(g[A.resultName]=Q.value,g.next=A.nextLoc,"return"!==g.method&&(g.method="next",g.arg=I),g.delegate=null,c):Q:(g.method="throw",g.arg=new TypeError("iterator result is not an object"),g.delegate=null,c)}function F(A){var I={tryLoc:A[0]};1 in A&&(I.catchLoc=A[1]),2 in A&&(I.finallyLoc=A[2],I.afterLoc=A[3]),this.tryEntries.push(I)}function d(A){var I=A.completion||{};I.type="normal",delete I.arg,A.completion=I}function R(A){this.tryEntries=[{tryLoc:"root"}],A.forEach(F,this),this.reset(!0)}function L(A){if(A){var g=A[Q];if(g)return g.call(A);if("function"==typeof A.next)return A;if(!isNaN(A.length)){var C=-1,E=function g(){for(;++C<A.length;)if(B.call(A,C))return g.value=A[C],g.done=!1,g;return g.value=I,g.done=!0,g};return E.next=E}}return{next:U}}function U(){return{value:I,done:!0}}return w.prototype=y,e(S,"constructor",y),e(y,"constructor",w),w.displayName=e(y,i,"GeneratorFunction"),A.isGeneratorFunction=function(A){var I="function"==typeof A&&A.constructor;return!!I&&(I===w||"GeneratorFunction"===(I.displayName||I.name))},A.mark=function(A){return Object.setPrototypeOf?Object.setPrototypeOf(A,y):(A.__proto__=y,e(A,i,"GeneratorFunction")),A.prototype=Object.create(S),A},A.awrap=function(A){return{__await:A}},G(N.prototype),e(N.prototype,E,(function(){return this})),A.AsyncIterator=N,A.async=function(I,g,B,C,Q){void 0===Q&&(Q=Promise);var E=new N(t(I,g,B,C),Q);return A.isGeneratorFunction(g)?E:E.next().then((function(A){return A.done?A.value:E.next()}))},G(S),e(S,i,"Generator"),e(S,Q,(function(){return this})),e(S,"toString",(function(){return"[object Generator]"})),A.keys=function(A){var I=[];for(var g in A)I.push(g);return I.reverse(),function g(){for(;I.length;){var B=I.pop();if(B in A)return g.value=B,g.done=!1,g}return g.done=!0,g}},A.values=L,R.prototype={constructor:R,reset:function(A){if(this.prev=0,this.next=0,this.sent=this._sent=I,this.done=!1,this.delegate=null,this.method="next",this.arg=I,this.tryEntries.forEach(d),!A)for(var g in this)"t"===g.charAt(0)&&B.call(this,g)&&!isNaN(+g.slice(1))&&(this[g]=I)},stop:function(){this.done=!0;var A=this.tryEntries[0].completion;if("throw"===A.type)throw A.arg;return this.rval},dispatchException:function(A){if(this.done)throw A;var g=this;function C(B,C){return i.type="throw",i.arg=A,g.next=B,C&&(g.method="next",g.arg=I),!!C}for(var Q=this.tryEntries.length-1;Q>=0;--Q){var E=this.tryEntries[Q],i=E.completion;if("root"===E.tryLoc)return C("end");if(E.tryLoc<=this.prev){var e=B.call(E,"catchLoc"),t=B.call(E,"finallyLoc");if(e&&t){if(this.prev<E.catchLoc)return C(E.catchLoc,!0);if(this.prev<E.finallyLoc)return C(E.finallyLoc)}else if(e){if(this.prev<E.catchLoc)return C(E.catchLoc,!0)}else{if(!t)throw new Error("try statement without catch or finally");if(this.prev<E.finallyLoc)return C(E.finallyLoc)}}}},abrupt:function(A,I){for(var g=this.tryEntries.length-1;g>=0;--g){var C=this.tryEntries[g];if(C.tryLoc<=this.prev&&B.call(C,"finallyLoc")&&this.prev<C.finallyLoc){var Q=C;break}}Q&&("break"===A||"continue"===A)&&Q.tryLoc<=I&&I<=Q.finallyLoc&&(Q=null);var E=Q?Q.completion:{};return E.type=A,E.arg=I,Q?(this.method="next",this.next=Q.finallyLoc,c):this.complete(E)},complete:function(A,I){if("throw"===A.type)throw A.arg;return"break"===A.type||"continue"===A.type?this.next=A.arg:"return"===A.type?(this.rval=this.arg=A.arg,this.method="return",this.next="end"):"normal"===A.type&&I&&(this.next=I),c},finish:function(A){for(var I=this.tryEntries.length-1;I>=0;--I){var g=this.tryEntries[I];if(g.finallyLoc===A)return this.complete(g.completion,g.afterLoc),d(g),c}},catch:function(A){for(var I=this.tryEntries.length-1;I>=0;--I){var g=this.tryEntries[I];if(g.tryLoc===A){var B=g.completion;if("throw"===B.type){var C=B.arg;d(g)}return C}}throw new Error("illegal catch attempt")},delegateYield:function(A,g,B){return this.delegate={iterator:L(A),resultName:g,nextLoc:B},"next"===this.method&&(this.arg=I),c}},A}(A.exports);try{regeneratorRuntime=I}catch(A){"object"===("undefined"==typeof globalThis?"undefined":n(globalThis))?globalThis.regeneratorRuntime=I:Function("r","regeneratorRuntime = r")(I)}}(u);var l=u.exports;function S(A){if("undefined"!=typeof Symbol&&null!=A[Symbol.iterator]||null!=A["@@iterator"])return Array.from(A)}function G(A){return function(A){if(Array.isArray(A))return B(A)}(A)||S(A)||C(A)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}for(var N=new ArrayBuffer(4),k=new Float32Array(N),F=new Uint32Array(N),d=new Uint32Array(512),R=new Uint32Array(512),L=0;L<256;++L){var U=L-127;U<-27?(d[L]=0,d[256|L]=32768,R[L]=24,R[256|L]=24):U<-14?(d[L]=1024>>-U-14,d[256|L]=1024>>-U-14|32768,R[L]=-U-1,R[256|L]=-U-1):U<=15?(d[L]=U+15<<10,d[256|L]=U+15<<10|32768,R[L]=13,R[256|L]=13):U<128?(d[L]=31744,d[256|L]=64512,R[L]=24,R[256|L]=24):(d[L]=31744,d[256|L]=64512,R[L]=13,R[256|L]=13)}var Y=new Uint32Array(2048),p=new Uint32Array(64),K=new Uint32Array(64);Y[0]=0;for(var M=1;M<1024;++M){for(var J=M<<13,m=0;0==(8388608&J);)m-=8388608,J<<=1;J&=-8388609,m+=947912704,Y[M]=J|m}for(var H=1024;H<2048;++H)Y[H]=939524096+(H-1024<<13);p[0]=0;for(var b=1;b<31;++b)p[b]=b<<23;p[31]=1199570944,p[32]=2147483648;for(var v=33;v<63;++v)p[v]=2147483648+(v-32<<23);p[63]=3347054592,K[0]=0;for(var q=1;q<64;++q)K[q]=32===q?0:1024;function x(A){var I=A>>10;return F[0]=Y[K[I]+(1023&A)]+p[I],k[0]}var O=Reflect.getPrototypeOf(Uint8Array).prototype,T=Reflect.getOwnPropertyDescriptor(O,Symbol.toStringTag).get;var P=Object.prototype.toString;function j(A){return!!ArrayBuffer.isView(A)&&(!function(A){return void 0!==T.call(A)}(A)&&"[object DataView]"===P.call(A))}function Z(A,I){if(!j(A))throw new TypeError("First argument to getFloat16 function must be a DataView");for(var g=arguments.length,B=new Array(g>2?g-2:0),C=2;C<g;C++)B[C-2]=arguments[C];return x(A.getUint16.apply(A,[I].concat(B)))}function W(A,I,g){var B=g&&g.debug||!1;B&&console.log("[xml-utils] getting "+I+" in "+A);for(var C="object"===n(A)?A.outer:A,Q=C.slice(0,C.indexOf(">")+1),E=['"',"'"],i=0;i<E.length;i++){var e=E[i],t=I+"\\="+e+"([^"+e+"]*)"+e;B&&console.log("[xml-utils] pattern:",t);var r=new RegExp(t).exec(Q);if(B&&console.log("[xml-utils] match:",r),r)return r[1]}}function V(A,I,g){var B=new RegExp(I).exec(A.slice(g));return B?g+B.index+B[0].length-1:-1}function z(A,I){var g=new RegExp(I,"g"),B=A.match(g);return B?B.length:0}function X(A,I,g){var B=g&&g.debug||!1,C=!(g&&!1===typeof g.nested),Q=g&&g.startIndex||0;B&&console.log("[xml-utils] starting findTagByName with",I," and ",g);var E=function(A,I,g){var B=new RegExp(I).exec(A.slice(g));return B?g+B.index:-1}(A,"<".concat(I,"[ \n>/]"),Q);if(B&&console.log("[xml-utils] start:",E),-1!==E){var i=A.slice(E+I.length),e=V(i,"^[^<]*[ /]>",0),t=-1!==e&&"/"===i[e-1];if(B&&console.log("[xml-utils] selfClosing:",t),!1===t)if(C)for(var r=0,o=1,a=0;-1!==(e=V(i,"[ /]"+I+">",r));){var n=i.substring(r,e+1);if(o+=z(n,"<"+I+"[ \n\t>]"),(a+=z(n,"</"+I+">"))>=o)break;r=e}else e=V(i,"[ /]"+I+">",0);var s=E+I.length+e+1;if(B&&console.log("[xml-utils] end:",s),-1!==s){var h=A.slice(E,s);return{inner:t?null:h.slice(h.indexOf(">")+1,h.lastIndexOf("<")),outer:h,start:E,end:s}}}}function _(A,I,g){for(var B,C=[],Q=g&&g.debug||!1,E=!g||"boolean"!=typeof g.nested||g.nested,i=g&&g.startIndex||0;B=X(A,I,{debug:Q,startIndex:i});)i=E?B.start+1+I.length:B.end,C.push(B);return Q&&console.log("findTagsByName found",C.length,"tags"),C}var $={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"},AA={};for(var IA in $)$.hasOwnProperty(IA)&&(AA[$[IA]]=parseInt(IA,10));var gA={256:"SHORT",257:"SHORT",258:"SHORT",259:"SHORT",262:"SHORT",270:"ASCII",271:"ASCII",272:"ASCII",273:"LONG",274:"SHORT",277:"SHORT",278:"LONG",279:"LONG",282:"RATIONAL",283:"RATIONAL",284:"SHORT",286:"SHORT",287:"RATIONAL",296:"SHORT",297:"SHORT",305:"ASCII",306:"ASCII",315:"ASCII",338:"SHORT",339:"SHORT",513:"LONG",514:"LONG",1024:"SHORT",1025:"SHORT",1026:"ASCII",2048:"SHORT",2049:"ASCII",2052:"SHORT",2054:"SHORT",2060:"SHORT",3072:"SHORT",3073:"ASCII",3076:"SHORT",4096:"SHORT",4097:"ASCII",4099:"SHORT",33432:"ASCII",33550:"DOUBLE",33922:"DOUBLE",34264:"DOUBLE",34665:"LONG",34735:"SHORT",34736:"DOUBLE",34737:"ASCII",42113:"ASCII"},BA=[AA.BitsPerSample,AA.ExtraSamples,AA.SampleFormat,AA.StripByteCounts,AA.StripOffsets,AA.StripRowCounts,AA.TileByteCounts,AA.TileOffsets,AA.SubIFDs],CA={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"},QA={};for(var EA in CA)CA.hasOwnProperty(EA)&&(QA[CA[EA]]=parseInt(EA,10));var iA={WhiteIsZero:0,BlackIsZero:1,RGB:2,Palette:3,TransparencyMask:4,CMYK:5,YCbCr:6,CIELab:8,ICCLab:9},eA={Unspecified:0,Assocalpha:1,Unassalpha:2},tA={Version:0,AddCompression:1},rA={None:0,Deflate:1,Zstandard:2},oA={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"},aA={};for(var nA in oA)oA.hasOwnProperty(nA)&&(aA[oA[nA]]=parseInt(nA,10));var sA=Object.freeze({__proto__:null,fieldTagNames:$,fieldTags:AA,fieldTagTypes:gA,arrayFields:BA,fieldTypeNames:CA,fieldTypes:QA,registerTag:function(A,I){var g=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,B=arguments.length>3&&void 0!==arguments[3]&&arguments[3];AA[I]=A,$[A]=I,g&&(QA[I]=g),B&&BA.push(A)},photometricInterpretations:iA,ExtraSamplesValues:eA,LercParameters:tA,LercAddCompression:rA,geoKeyNames:oA,geoKeys:aA});function hA(A,I){for(var g,B=A.width,C=A.height,Q=new Uint8Array(B*C*3),E=0,i=0;E<A.length;++E,i+=3)g=256-A[E]/I*256,Q[i]=g,Q[i+1]=g,Q[i+2]=g;return Q}function cA(A,I){for(var g,B=A.width,C=A.height,Q=new Uint8Array(B*C*3),E=0,i=0;E<A.length;++E,i+=3)g=A[E]/I*256,Q[i]=g,Q[i+1]=g,Q[i+2]=g;return Q}function DA(A,I){for(var g=A.width,B=A.height,C=new Uint8Array(g*B*3),Q=I.length/3,E=I.length/3*2,i=0,e=0;i<A.length;++i,e+=3){var t=A[i];C[e]=I[t]/65536*256,C[e+1]=I[t+Q]/65536*256,C[e+2]=I[t+E]/65536*256}return C}function wA(A){for(var I=A.width,g=A.height,B=new Uint8Array(I*g*3),C=0,Q=0;C<A.length;C+=4,Q+=3){var E=A[C],i=A[C+1],e=A[C+2],t=A[C+3];B[Q]=(255-E)/256*255*((255-t)/256),B[Q+1]=(255-i)/256*255*((255-t)/256),B[Q+2]=(255-e)/256*255*((255-t)/256)}return B}function yA(A){for(var I=A.width,g=A.height,B=new Uint8ClampedArray(I*g*3),C=0,Q=0;C<A.length;C+=3,Q+=3){var E=A[C],i=A[C+1],e=A[C+2];B[Q]=E+1.402*(e-128),B[Q+1]=E-.34414*(i-128)-.71414*(e-128),B[Q+2]=E+1.772*(i-128)}return B}function fA(A){for(var I=A.width,g=A.height,B=new Uint8Array(I*g*3),C=0,Q=0;C<A.length;C+=3,Q+=3){var E=(A[C+0]+16)/116,i=(A[C+1]<<24>>24)/500+E,e=E-(A[C+2]<<24>>24)/200,t=void 0,r=void 0,o=void 0;r=-.9689*(i=.95047*(i*i*i>.008856?i*i*i:(i-16/116)/7.787))+1.8758*(E=1*(E*E*E>.008856?E*E*E:(E-16/116)/7.787))+.0415*(e=1.08883*(e*e*e>.008856?e*e*e:(e-16/116)/7.787)),o=.0557*i+-.204*E+1.057*e,t=(t=3.2406*i+-1.5372*E+-.4986*e)>.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t,r=r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r,o=o>.0031308?1.055*Math.pow(o,1/2.4)-.055:12.92*o,B[Q]=255*Math.max(0,Math.min(1,t)),B[Q+1]=255*Math.max(0,Math.min(1,r)),B[Q+2]=255*Math.max(0,Math.min(1,o))}return B}var uA=Object.freeze({__proto__:null,fromWhiteIsZero:hA,fromBlackIsZero:cA,fromPalette:DA,fromCMYK:wA,fromYCbCr:yA,fromCIELab:fA}),lA=new Map,SA=new Map;function GA(A,I){var g=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];Array.isArray(A)||(A=[A]),A.forEach((function(A){lA.set(A,I),SA.set(A,g)}))}function NA(A){return kA.apply(this,arguments)}function kA(){return(kA=e(l.mark((function A(I){var g,B;return l.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:if(g=lA.get(I.Compression)){A.next=3;break}throw new Error("Unknown compression method identifier: ".concat(I.Compression));case 3:return A.next=5,g();case 5:return B=A.sent,A.abrupt("return",new B(I));case 7:case"end":return A.stop()}}),A)})))).apply(this,arguments)}function FA(A){return SA.get(A.Compression)}function dA(A,I,g){var B=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return new(Object.getPrototypeOf(A).constructor)(I*g*B)}function RA(A,I,g,B,C){var Q=I/B,E=g/C;return A.map((function(A){for(var i=dA(A,B,C),e=0;e<C;++e)for(var t=Math.min(Math.round(E*e),g-1),r=0;r<B;++r){var o=Math.min(Math.round(Q*r),I-1),a=A[t*I+o];i[e*B+r]=a}return i}))}function LA(A,I,g){return(1-g)*A+g*I}function UA(A,I,g,B,C){var Q=I/B,E=g/C;return A.map((function(A){for(var i=dA(A,B,C),e=0;e<C;++e)for(var t=E*e,r=Math.floor(t),o=Math.min(Math.ceil(t),g-1),a=0;a<B;++a){var n=Q*a,s=n%1,h=Math.floor(n),c=Math.min(Math.ceil(n),I-1),D=A[r*I+h],w=A[r*I+c],y=A[o*I+h],f=A[o*I+c],u=LA(LA(D,w,s),LA(y,f,s),t%1);i[e*B+a]=u}return i}))}function YA(A,I,g,B,C){var Q=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"nearest";switch(Q.toLowerCase()){case"nearest":return RA(A,I,g,B,C);case"bilinear":case"linear":return UA(A,I,g,B,C);default:throw new Error("Unsupported resampling method: '".concat(Q,"'"))}}function pA(A,I,g,B,C,Q){for(var E=I/B,i=g/C,e=dA(A,B,C,Q),t=0;t<C;++t)for(var r=Math.min(Math.round(i*t),g-1),o=0;o<B;++o)for(var a=Math.min(Math.round(E*o),I-1),n=0;n<Q;++n){var s=A[r*I*Q+a*Q+n];e[t*B*Q+o*Q+n]=s}return e}function KA(A,I,g,B,C,Q){for(var E=I/B,i=g/C,e=dA(A,B,C,Q),t=0;t<C;++t)for(var r=i*t,o=Math.floor(r),a=Math.min(Math.ceil(r),g-1),n=0;n<B;++n)for(var s=E*n,h=s%1,c=Math.floor(s),D=Math.min(Math.ceil(s),I-1),w=0;w<Q;++w){var y=A[o*I*Q+c*Q+w],f=A[o*I*Q+D*Q+w],u=A[a*I*Q+c*Q+w],l=A[a*I*Q+D*Q+w],S=LA(LA(y,f,h),LA(u,l,h),r%1);e[t*B*Q+n*Q+w]=S}return e}function MA(A,I,g,B,C,Q){var E=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"nearest";switch(E.toLowerCase()){case"nearest":return pA(A,I,g,B,C,Q);case"bilinear":case"linear":return KA(A,I,g,B,C,Q);default:throw new Error("Unsupported resampling method: '".concat(E,"'"))}}function JA(A,I,g){for(var B=0,C=I;C<g;++C)B+=A[C];return B}function mA(A,I,g){switch(A){case 1:if(I<=8)return new Uint8Array(g);if(I<=16)return new Uint16Array(g);if(I<=32)return new Uint32Array(g);break;case 2:if(8===I)return new Int8Array(g);if(16===I)return new Int16Array(g);if(32===I)return new Int32Array(g);break;case 3:switch(I){case 16:case 32:return new Float32Array(g);case 64:return new Float64Array(g)}}throw Error("Unsupported data format/bitsPerSample")}function HA(A,I){return(1!==A&&2!==A||!(I<=32)||I%8!=0)&&(3!==A||16!==I&&32!==I&&64!==I)}function bA(A,I,g,B,C,Q,E){var i=new DataView(A),e=2===g?1:B,t=mA(I,C,2===g?E*Q:E*Q*B),r=parseInt("1".repeat(C),2);if(1===I){var o=Q*(1===g?B*C:C);0!=(7&o)&&(o=o+7&-8);for(var a=0;a<E;++a)for(var n=a*o,s=0;s<Q;++s)for(var h=n+s*e*C,c=0;c<e;++c){var D=h+c*C,w=(a*Q+s)*e+c,y=Math.floor(D/8),f=D%8;if(f+C<=8)t[w]=i.getUint8(y)>>8-C-f&r;else if(f+C<=16)t[w]=i.getUint16(y)>>16-C-f&r;else if(f+C<=24){var u=i.getUint16(y)<<8|i.getUint8(y+2);t[w]=u>>24-C-f&r}else t[w]=i.getUint32(y)>>32-C-f&r}}return t.buffer}GA([void 0,1],(function(){return Promise.resolve().then((function(){return _g})).then((function(A){return A.default}))}),!1),GA(5,(function(){return Promise.resolve().then((function(){return BB})).then((function(A){return A.default}))})),GA(6,(function(){throw new Error("old style JPEG compression is not supported.")})),GA(7,(function(){return Promise.resolve().then((function(){return yB})).then((function(A){return A.default}))})),GA([8,32946],(function(){return Promise.resolve().then((function(){return RC})).then((function(A){return A.default}))})),GA(32773,(function(){return Promise.resolve().then((function(){return YC})).then((function(A){return A.default}))})),GA(34887,(function(){return Promise.resolve().then((function(){return WC})).then(function(){var A=e(l.mark((function A(I){return l.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return A.next=2,I.zstd.init();case 2:return A.abrupt("return",I);case 3:case"end":return A.stop()}}),A)})));return function(I){return A.apply(this,arguments)}}()).then((function(A){return A.default}))})),GA(5e4,(function(){return Promise.resolve().then((function(){return BQ})).then(function(){var A=e(l.mark((function A(I){return l.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return A.next=2,I.zstd.init();case 2:return A.abrupt("return",I);case 3:case"end":return A.stop()}}),A)})));return function(I){return A.apply(this,arguments)}}()).then((function(A){return A.default}))})),GA(50001,(function(){return Promise.resolve().then((function(){return EQ})).then((function(A){return A.default}))}),!1);var vA=function(){function A(I,g,B,C,Q,E){f(this,A),this.fileDirectory=I,this.geoKeys=g,this.dataView=B,this.littleEndian=C,this.tiles=Q?{}:null,this.isTiled=!I.StripOffsets;var i=I.PlanarConfiguration;if(this.planarConfiguration=void 0===i?1:i,1!==this.planarConfiguration&&2!==this.planarConfiguration)throw new Error("Invalid planar configuration.");this.source=E}var I,g,B,C;return r(A,[{key:"getFileDirectory",value:function(){return this.fileDirectory}},{key:"getGeoKeys",value:function(){return this.geoKeys}},{key:"getWidth",value:function(){return this.fileDirectory.ImageWidth}},{key:"getHeight",value:function(){return this.fileDirectory.ImageLength}},{key:"getSamplesPerPixel",value:function(){return void 0!==this.fileDirectory.SamplesPerPixel?this.fileDirectory.SamplesPerPixel:1}},{key:"getTileWidth",value:function(){return this.isTiled?this.fileDirectory.TileWidth:this.getWidth()}},{key:"getTileHeight",value:function(){return this.isTiled?this.fileDirectory.TileLength:void 0!==this.fileDirectory.RowsPerStrip?Math.min(this.fileDirectory.RowsPerStrip,this.getHeight()):this.getHeight()}},{key:"getBlockWidth",value:function(){return this.getTileWidth()}},{key:"getBlockHeight",value:function(A){return this.isTiled||(A+1)*this.getTileHeight()<=this.getHeight()?this.getTileHeight():this.getHeight()-A*this.getTileHeight()}},{key:"getBytesPerPixel",value:function(){for(var A=0,I=0;I<this.fileDirectory.BitsPerSample.length;++I)A+=this.getSampleByteSize(I);return A}},{key:"getSampleByteSize",value:function(A){if(A>=this.fileDirectory.BitsPerSample.length)throw new RangeError("Sample index ".concat(A," is out of range."));return Math.ceil(this.fileDirectory.BitsPerSample[A]/8)}},{key:"getReaderForSample",value:function(A){var I=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[A]:1,g=this.fileDirectory.BitsPerSample[A];switch(I){case 1:if(g<=8)return DataView.prototype.getUint8;if(g<=16)return DataView.prototype.getUint16;if(g<=32)return DataView.prototype.getUint32;break;case 2:if(g<=8)return DataView.prototype.getInt8;if(g<=16)return DataView.prototype.getInt16;if(g<=32)return DataView.prototype.getInt32;break;case 3:switch(g){case 16:return function(A,I){return Z(this,A,I)};case 32:return DataView.prototype.getFloat32;case 64:return DataView.prototype.getFloat64}}throw Error("Unsupported data format/bitsPerSample")}},{key:"getSampleFormat",value:function(){var A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[A]:1}},{key:"getBitsPerSample",value:function(){var A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.fileDirectory.BitsPerSample[A]}},{key:"getArrayForSample",value:function(A,I){return mA(this.getSampleFormat(A),this.getBitsPerSample(A),I)}},{key:"getTileOrStrip",value:(C=e(l.mark((function A(I,g,B,C,Q){var E,i,t,r,o,a,n,s,h,c,D,w=this;return l.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:if(E=Math.ceil(this.getWidth()/this.getTileWidth()),i=Math.ceil(this.getHeight()/this.getTileHeight()),r=this.tiles,1===this.planarConfiguration?t=g*E+I:2===this.planarConfiguration&&(t=B*E*i+g*E+I),this.isTiled?(o=this.fileDirectory.TileOffsets[t],a=this.fileDirectory.TileByteCounts[t]):(o=this.fileDirectory.StripOffsets[t],a=this.fileDirectory.StripByteCounts[t]),0!==a){A.next=12;break}return n=this.getBlockHeight(g)*this.getTileWidth(),s=2===this.planarConfiguration?this.getSampleByteSize(B):this.getBytesPerPixel(),h=new ArrayBuffer(n*s),this.getArrayForSample(B,h).fill(this.getGDALNoData()||0),A.abrupt("return",{x:I,y:g,sample:B,data:h});case 12:return A.next=14,this.source.fetch([{offset:o,length:a}],Q);case 14:return c=A.sent[0],null!==r&&r[t]?D=r[t]:(D=e(l.mark((function A(){var I,B,Q;return l.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return A.next=2,C.decode(w.fileDirectory,c);case 2:return I=A.sent,B=w.getSampleFormat(),Q=w.getBitsPerSample(),HA(B,Q)&&(I=bA(I,B,w.planarConfiguration,w.getSamplesPerPixel(),Q,w.getTileWidth(),w.getBlockHeight(g))),A.abrupt("return",I);case 7:case"end":return A.stop()}}),A)})))(),null!==r&&(r[t]=D)),A.t0=I,A.t1=g,A.t2=B,A.next=21,D;case 21:return A.t3=A.sent,A.abrupt("return",{x:A.t0,y:A.t1,sample:A.t2,data:A.t3});case 23:case"end":return A.stop()}}),A,this)}))),function(A,I,g,B,Q){return C.apply(this,arguments)})},{key:"_readRaster",value:(B=e(l.mark((function A(I,g,B,C,Q,E,i,e,t){var r,o,a,n,s,h,c,D,w,y,f,u,S,G,N,k,F,d,R,L,U,Y=this;return l.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:for(r=this.getTileWidth(),o=this.getTileHeight(),a=this.getWidth(),n=this.getHeight(),s=Math.max(Math.floor(I[0]/r),0),h=Math.min(Math.ceil(I[2]/r),Math.ceil(a/r)),c=Math.max(Math.floor(I[1]/o),0),D=Math.min(Math.ceil(I[3]/o),Math.ceil(n/o)),w=I[2]-I[0],y=this.getBytesPerPixel(),f=[],u=[],S=0;S<g.length;++S)1===this.planarConfiguration?f.push(JA(this.fileDirectory.BitsPerSample,0,g[S])/8):f.push(0),u.push(this.getReaderForSample(g[S]));for(G=[],N=this.littleEndian,k=c;k<D;++k)for(F=s;F<h;++F)for(d=void 0,1===this.planarConfiguration&&(d=this.getTileOrStrip(F,k,0,Q,t)),R=function(A){var E=A,i=g[A];2===Y.planarConfiguration&&(y=Y.getSampleByteSize(i),d=Y.getTileOrStrip(F,k,i,Q,t));var e=d.then((function(A){for(var Q=A.data,i=new DataView(Q),e=Y.getBlockHeight(A.y),t=A.y*o,s=A.x*r,h=t+e,c=(A.x+1)*r,D=u[E],l=Math.min(e,e-(h-I[3]),n-t),S=Math.min(r,r-(c-I[2]),a-s),G=Math.max(0,I[1]-t);G<l;++G)for(var k=Math.max(0,I[0]-s);k<S;++k){var F=(G*r+k)*y,d=D.call(i,F+f[E],N),R=void 0;C?(R=(G+t-I[1])*w*g.length+(k+s-I[0])*g.length+E,B[R]=d):(R=(G+t-I[1])*w+k+s-I[0],B[E][R]=d)}}));G.push(e)},L=0;L<g.length;++L)R(L);return A.next=18,Promise.all(G);case 18:if(!(E&&I[2]-I[0]!==E||i&&I[3]-I[1]!==i)){A.next=23;break}return(U=C?MA(B,I[2]-I[0],I[3]-I[1],E,i,g.length,e):YA(B,I[2]-I[0],I[3]-I[1],E,i,e)).width=E,U.height=i,A.abrupt("return",U);case 23:return B.width=E||I[2]-I[0],B.height=i||I[3]-I[1],A.abrupt("return",B);case 26:case"end":return A.stop()}}),A,this)}))),function(A,I,g,C,Q,E,i,e,t){return B.apply(this,arguments)})},{key:"readRasters",value:(g=e(l.mark((function A(){var I,g,B,C,Q,E,i,e,t,r,o,a,n,s,h,c,D,w,y,f,u,S,G,N,k,F,d=arguments;return l.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:if(I=d.length>0&&void 0!==d[0]?d[0]:{},g=I.window,B=I.samples,C=void 0===B?[]:B,Q=I.interleave,E=I.pool,i=void 0===E?null:E,e=I.width,t=I.height,r=I.resampleMethod,o=I.fillValue,a=I.signal,!((n=g||[0,0,this.getWidth(),this.getHeight()])[0]>n[2]||n[1]>n[3])){A.next=4;break}throw new Error("Invalid subsets");case 4:if(s=n[2]-n[0],h=n[3]-n[1],c=s*h,D=this.getSamplesPerPixel(),C&&C.length){A.next=12;break}for(w=0;w<D;++w)C.push(w);A.next=19;break;case 12:y=0;case 13:if(!(y<C.length)){A.next=19;break}if(!(C[y]>=D)){A.next=16;break}return A.abrupt("return",Promise.reject(new RangeError("Invalid sample index '".concat(C[y],"'."))));case 16:++y,A.next=13;break;case 19:if(Q)u=this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,S=Math.max.apply(null,this.fileDirectory.BitsPerSample),f=mA(u,S,c*C.length),o&&f.fill(o);else for(f=[],G=0;G<C.length;++G)N=this.getArrayForSample(C[G],c),Array.isArray(o)&&G<o.length?N.fill(o[G]):o&&!Array.isArray(o)&&N.fill(o),f.push(N);if(A.t0=i,A.t0){A.next=25;break}return A.next=24,NA(this.fileDirectory);case 24:A.t0=A.sent;case 25:return k=A.t0,A.next=28,this._readRaster(n,C,f,Q,k,e,t,r,a);case 28:return F=A.sent,A.abrupt("return",F);case 30:case"end":return A.stop()}}),A,this)}))),function(){return g.apply(this,arguments)})},{key:"readRGB",value:(I=e(l.mark((function A(){var I,g,B,C,Q,E,i,e,t,r,o,a,n,s,h,c,D,w,y,f,u,S,G,N,k,F,d,R=arguments;return l.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:if(I=R.length>0&&void 0!==R[0]?R[0]:{},g=I.window,B=I.interleave,C=void 0===B||B,Q=I.pool,E=void 0===Q?null:Q,i=I.width,e=I.height,t=I.resampleMethod,r=I.enableAlpha,o=void 0!==r&&r,a=I.signal,!((n=g||[0,0,this.getWidth(),this.getHeight()])[0]>n[2]||n[1]>n[3])){A.next=4;break}throw new Error("Invalid subsets");case 4:if((s=this.fileDirectory.PhotometricInterpretation)!==iA.RGB){A.next=9;break}if(h=[0,1,2],this.fileDirectory.ExtraSamples!==eA.Unspecified&&o)for(h=[],c=0;c<this.fileDirectory.BitsPerSample.length;c+=1)h.push(c);return A.abrupt("return",this.readRasters({window:g,interleave:C,samples:h,pool:E,width:i,height:e,resampleMethod:t,signal:a}));case 9:A.t0=s,A.next=A.t0===iA.WhiteIsZero||A.t0===iA.BlackIsZero||A.t0===iA.Palette?12:A.t0===iA.CMYK?14:A.t0===iA.YCbCr||A.t0===iA.CIELab?16:18;break;case 12:return D=[0],A.abrupt("break",19);case 14:return D=[0,1,2,3],A.abrupt("break",19);case 16:return D=[0,1,2],A.abrupt("break",19);case 18:throw new Error("Invalid or unsupported photometric interpretation.");case 19:return w={window:n,interleave:!0,samples:D,pool:E,width:i,height:e,resampleMethod:t,signal:a},y=this.fileDirectory,A.next=23,this.readRasters(w);case 23:f=A.sent,u=Math.pow(2,this.fileDirectory.BitsPerSample[0]),A.t1=s,A.next=A.t1===iA.WhiteIsZero?28:A.t1===iA.BlackIsZero?30:A.t1===iA.Palette?32:A.t1===iA.CMYK?34:A.t1===iA.YCbCr?36:A.t1===iA.CIELab?38:40;break;case 28:return S=hA(f,u),A.abrupt("break",41);case 30:return S=cA(f,u),A.abrupt("break",41);case 32:return S=DA(f,y.ColorMap),A.abrupt("break",41);case 34:return S=wA(f),A.abrupt("break",41);case 36:return S=yA(f),A.abrupt("break",41);case 38:return S=fA(f),A.abrupt("break",41);case 40:throw new Error("Unsupported photometric interpretation.");case 41:if(!C){for(G=new Uint8Array(S.length/3),N=new Uint8Array(S.length/3),k=new Uint8Array(S.length/3),F=0,d=0;F<S.length;F+=3,++d)G[d]=S[F],N[d]=S[F+1],k[d]=S[F+2];S=[G,N,k]}return S.width=f.width,S.height=f.height,A.abrupt("return",S);case 45:case"end":return A.stop()}}),A,this)}))),function(){return I.apply(this,arguments)})},{key:"getTiePoints",value:function(){if(!this.fileDirectory.ModelTiepoint)return[];for(var A=[],I=0;I<this.fileDirectory.ModelTiepoint.length;I+=6)A.push({i:this.fileDirectory.ModelTiepoint[I],j:this.fileDirectory.ModelTiepoint[I+1],k:this.fileDirectory.ModelTiepoint[I+2],x:this.fileDirectory.ModelTiepoint[I+3],y:this.fileDirectory.ModelTiepoint[I+4],z:this.fileDirectory.ModelTiepoint[I+5]});return A}},{key:"getGDALMetadata",value:function(){var A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,I={};if(!this.fileDirectory.GDAL_METADATA)return null;var g=this.fileDirectory.GDAL_METADATA,B=_(g,"Item");B=null===A?B.filter((function(A){return void 0===W(A,"sample")})):B.filter((function(I){return Number(W(I,"sample"))===A}));for(var C=0;C<B.length;++C){var Q=B[C];I[W(Q,"name")]=Q.inner}return I}},{key:"getGDALNoData",value:function(){if(!this.fileDirectory.GDAL_NODATA)return null;var A=this.fileDirectory.GDAL_NODATA;return Number(A.substring(0,A.length-1))}},{key:"getOrigin",value:function(){var A=this.fileDirectory.ModelTiepoint,I=this.fileDirectory.ModelTransformation;if(A&&6===A.length)return[A[3],A[4],A[5]];if(I)return[I[3],I[7],I[11]];throw new Error("The image does not have an affine transformation.")}},{key:"getResolution",value:function(){var A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,I=this.fileDirectory.ModelPixelScale,g=this.fileDirectory.ModelTransformation;if(I)return[I[0],-I[1],I[2]];if(g)return 0===g[1]&&0===g[4]?[g[0],-g[5],g[10]]:[Math.sqrt(g[0]*g[0]+g[4]*g[4]),-Math.sqrt(g[1]*g[1]+g[5]*g[5]),g[10]];if(A){var B=A.getResolution(),C=E(B,3),Q=C[0],i=C[1],e=C[2];return[Q*A.getWidth()/this.getWidth(),i*A.getHeight()/this.getHeight(),e*A.getWidth()/this.getWidth()]}throw new Error("The image does not have an affine transformation.")}},{key:"pixelIsArea",value:function(){return 1===this.geoKeys.GTRasterTypeGeoKey}},{key:"getBoundingBox",value:function(){var A=arguments.length>0&&void 0!==arguments[0]&&arguments[0],I=this.getHeight(),g=this.getWidth();if(this.fileDirectory.ModelTransformation&&!A){var B=E(this.fileDirectory.ModelTransformation,8),C=B[0],Q=B[1];B[2];var i=B[3],e=B[4],t=B[5];B[6];var r=B[7],o=[[0,0],[0,I],[g,0],[g,I]],a=o.map((function(A){var I=E(A,2),g=I[0],B=I[1];return[i+C*g+Q*B,r+e*g+t*B]})),n=a.map((function(A){return A[0]})),s=a.map((function(A){return A[1]}));return[Math.min.apply(Math,G(n)),Math.min.apply(Math,G(s)),Math.max.apply(Math,G(n)),Math.max.apply(Math,G(s))]}var h=this.getOrigin(),c=this.getResolution(),D=h[0],w=h[1],y=D+c[0]*g,f=w+c[1]*I;return[Math.min(D,y),Math.min(w,f),Math.max(D,y),Math.max(w,f)]}}]),A}(),qA=vA,xA=function(){function A(I){f(this,A),this._dataView=new DataView(I)}return r(A,[{key:"buffer",get:function(){return this._dataView.buffer}},{key:"getUint64",value:function(A,I){var g,B=this.getUint32(A,I),C=this.getUint32(A+4,I);if(I){if(g=B+Math.pow(2,32)*C,!Number.isSafeInteger(g))throw new Error("".concat(g," exceeds MAX_SAFE_INTEGER. ")+"Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues");return g}if(g=Math.pow(2,32)*B+C,!Number.isSafeInteger(g))throw new Error("".concat(g," exceeds MAX_SAFE_INTEGER. ")+"Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues");return g}},{key:"getInt64",value:function(A,I){for(var g=0,B=(128&this._dataView.getUint8(A+(I?7:0)))>0,C=!0,Q=0;Q<8;Q++){var E=this._dataView.getUint8(A+(I?Q:7-Q));B&&(C?0!==E&&(E=255&~(E-1),C=!1):E=255&~E),g+=E*Math.pow(256,Q)}return B&&(g=-g),g}},{key:"getUint8",value:function(A,I){return this._dataView.getUint8(A,I)}},{key:"getInt8",value:function(A,I){return this._dataView.getInt8(A,I)}},{key:"getUint16",value:function(A,I){return this._dataView.getUint16(A,I)}},{key:"getInt16",value:function(A,I){return this._dataView.getInt16(A,I)}},{key:"getUint32",value:function(A,I){return this._dataView.getUint32(A,I)}},{key:"getInt32",value:function(A,I){return this._dataView.getInt32(A,I)}},{key:"getFloat16",value:function(A,I){return Z(this._dataView,A,I)}},{key:"getFloat32",value:function(A,I){return this._dataView.getFloat32(A,I)}},{key:"getFloat64",value:function(A,I){return this._dataView.getFloat64(A,I)}}]),A}(),OA=function(){function A(I,g,B,C){f(this,A),this._dataView=new DataView(I),this._sliceOffset=g,this._littleEndian=B,this._bigTiff=C}return r(A,[{key:"sliceOffset",get:function(){return this._sliceOffset}},{key:"sliceTop",get:function(){return this._sliceOffset+this.buffer.byteLength}},{key:"littleEndian",get:function(){return this._littleEndian}},{key:"bigTiff",get:function(){return this._bigTiff}},{key:"buffer",get:function(){return this._dataView.buffer}},{key:"covers",value:function(A,I){return this.sliceOffset<=A&&this.sliceTop>=A+I}},{key:"readUint8",value:function(A){return this._dataView.getUint8(A-this._sliceOffset,this._littleEndian)}},{key:"readInt8",value:function(A){return this._dataView.getInt8(A-this._sliceOffset,this._littleEndian)}},{key:"readUint16",value:function(A){return this._dataView.getUint16(A-this._sliceOffset,this._littleEndian)}},{key:"readInt16",value:function(A){return this._dataView.getInt16(A-this._sliceOffset,this._littleEndian)}},{key:"readUint32",value:function(A){return this._dataView.getUint32(A-this._sliceOffset,this._littleEndian)}},{key:"readInt32",value:function(A){return this._dataView.getInt32(A-this._sliceOffset,this._littleEndian)}},{key:"readFloat32",value:function(A){return this._dataView.getFloat32(A-this._sliceOffset,this._littleEndian)}},{key:"readFloat64",value:function(A){return this._dataView.getFloat64(A-this._sliceOffset,this._littleEndian)}},{key:"readUint64",value:function(A){var I,g=this.readUint32(A),B=this.readUint32(A+4);if(this._littleEndian){if(I=g+Math.pow(2,32)*B,!Number.isSafeInteger(I))throw new Error("".concat(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=Math.pow(2,32)*g+B,!Number.isSafeInteger(I))throw new Error("".concat(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}},{key:"readInt64",value:function(A){for(var I=0,g=(128&this._dataView.getUint8(A+(this._littleEndian?7:0)))>0,B=!0,C=0;C<8;C++){var Q=this._dataView.getUint8(A+(this._littleEndian?C:7-C));g&&(B?0!==Q&&(Q=255&~(Q-1),B=!1):Q=255&~Q),I+=Q*Math.pow(256,C)}return g&&(I=-I),I}},{key:"readOffset",value:function(A){return this._bigTiff?this.readUint64(A):this.readUint32(A)}}]),A}();function TA(A,I){if(null==A)return{};var g,B,C=function(A,I){if(null==A)return{};var g,B,C={},Q=Object.keys(A);for(B=0;B<Q.length;B++)g=Q[B],I.indexOf(g)>=0||(C[g]=A[g]);return C}(A,I);if(Object.getOwnPropertySymbols){var Q=Object.getOwnPropertySymbols(A);for(B=0;B<Q.length;B++)g=Q[B],I.indexOf(g)>=0||Object.prototype.propertyIsEnumerable.call(A,g)&&(C[g]=A[g])}return C}var PA="undefined"!=typeof Worker?Worker:void 0;function jA(){var A='function A(A,I,g){return I in A?Object.defineProperty(A,I,{value:g,enumerable:!0,configurable:!0,writable:!0}):A[I]=g,A}function I(A,I){if(null==A)return{};var g,B,C=function(A,I){if(null==A)return{};var g,B,C={},Q=Object.keys(A);for(B=0;B<Q.length;B++)g=Q[B],I.indexOf(g)>=0||(C[g]=A[g]);return C}(A,I);if(Object.getOwnPropertySymbols){var Q=Object.getOwnPropertySymbols(A);for(B=0;B<Q.length;B++)g=Q[B],I.indexOf(g)>=0||Object.prototype.propertyIsEnumerable.call(A,g)&&(C[g]=A[g])}return C}function g(A,I,g,B,C,Q,E){try{var i=A[Q](E),o=i.value}catch(A){return void g(A)}i.done?I(o):Promise.resolve(o).then(B,C)}function B(A){return function(){var I=this,B=arguments;return new Promise((function(C,Q){var E=A.apply(I,B);function i(A){g(E,C,Q,i,o,"next",A)}function o(A){g(E,C,Q,i,o,"throw",A)}i(void 0)}))}}function C(A){return C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(A){return typeof A}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},C(A)}var Q={exports:{}};!function(A){var I=function(A){var I,g=Object.prototype,B=g.hasOwnProperty,Q="function"==typeof Symbol?Symbol:{},E=Q.iterator||"@@iterator",i=Q.asyncIterator||"@@asyncIterator",o=Q.toStringTag||"@@toStringTag";function e(A,I,g){return Object.defineProperty(A,I,{value:g,enumerable:!0,configurable:!0,writable:!0}),A[I]}try{e({},"")}catch(A){e=function(A,I,g){return A[I]=g}}function t(A,I,g,B){var C=I&&I.prototype instanceof h?I:h,Q=Object.create(C.prototype),E=new u(B||[]);return Q._invoke=function(A,I,g){var B=r;return function(C,Q){if(B===n)throw new Error("Generator is already running");if(B===D){if("throw"===C)throw Q;return d()}for(g.method=C,g.arg=Q;;){var E=g.delegate;if(E){var i=R(E,g);if(i){if(i===w)continue;return i}}if("next"===g.method)g.sent=g._sent=g.arg;else if("throw"===g.method){if(B===r)throw B=D,g.arg;g.dispatchException(g.arg)}else"return"===g.method&&g.abrupt("return",g.arg);B=n;var o=a(A,I,g);if("normal"===o.type){if(B=g.done?D:s,o.arg===w)continue;return{value:o.arg,done:g.done}}"throw"===o.type&&(B=D,g.method="throw",g.arg=o.arg)}}}(A,g,E),Q}function a(A,I,g){try{return{type:"normal",arg:A.call(I,g)}}catch(A){return{type:"throw",arg:A}}}A.wrap=t;var r="suspendedStart",s="suspendedYield",n="executing",D="completed",w={};function h(){}function y(){}function c(){}var G={};e(G,E,(function(){return this}));var S=Object.getPrototypeOf,N=S&&S(S(Y([])));N&&N!==g&&B.call(N,E)&&(G=N);var F=c.prototype=h.prototype=Object.create(G);function f(A){["next","throw","return"].forEach((function(I){e(A,I,(function(A){return this._invoke(I,A)}))}))}function k(A,I){function g(Q,E,i,o){var e=a(A[Q],A,E);if("throw"!==e.type){var t=e.arg,r=t.value;return r&&"object"===C(r)&&B.call(r,"__await")?I.resolve(r.__await).then((function(A){g("next",A,i,o)}),(function(A){g("throw",A,i,o)})):I.resolve(r).then((function(A){t.value=A,i(t)}),(function(A){return g("throw",A,i,o)}))}o(e.arg)}var Q;this._invoke=function(A,B){function C(){return new I((function(I,C){g(A,B,I,C)}))}return Q=Q?Q.then(C,C):C()}}function R(A,g){var B=A.iterator[g.method];if(B===I){if(g.delegate=null,"throw"===g.method){if(A.iterator.return&&(g.method="return",g.arg=I,R(A,g),"throw"===g.method))return w;g.method="throw",g.arg=new TypeError("The iterator does not provide a \'throw\' method")}return w}var C=a(B,A.iterator,g.arg);if("throw"===C.type)return g.method="throw",g.arg=C.arg,g.delegate=null,w;var Q=C.arg;return Q?Q.done?(g[A.resultName]=Q.value,g.next=A.nextLoc,"return"!==g.method&&(g.method="next",g.arg=I),g.delegate=null,w):Q:(g.method="throw",g.arg=new TypeError("iterator result is not an object"),g.delegate=null,w)}function L(A){var I={tryLoc:A[0]};1 in A&&(I.catchLoc=A[1]),2 in A&&(I.finallyLoc=A[2],I.afterLoc=A[3]),this.tryEntries.push(I)}function U(A){var I=A.completion||{};I.type="normal",delete I.arg,A.completion=I}function u(A){this.tryEntries=[{tryLoc:"root"}],A.forEach(L,this),this.reset(!0)}function Y(A){if(A){var g=A[E];if(g)return g.call(A);if("function"==typeof A.next)return A;if(!isNaN(A.length)){var C=-1,Q=function g(){for(;++C<A.length;)if(B.call(A,C))return g.value=A[C],g.done=!1,g;return g.value=I,g.done=!0,g};return Q.next=Q}}return{next:d}}function d(){return{value:I,done:!0}}return y.prototype=c,e(F,"constructor",c),e(c,"constructor",y),y.displayName=e(c,o,"GeneratorFunction"),A.isGeneratorFunction=function(A){var I="function"==typeof A&&A.constructor;return!!I&&(I===y||"GeneratorFunction"===(I.displayName||I.name))},A.mark=function(A){return Object.setPrototypeOf?Object.setPrototypeOf(A,c):(A.__proto__=c,e(A,o,"GeneratorFunction")),A.prototype=Object.create(F),A},A.awrap=function(A){return{__await:A}},f(k.prototype),e(k.prototype,i,(function(){return this})),A.AsyncIterator=k,A.async=function(I,g,B,C,Q){void 0===Q&&(Q=Promise);var E=new k(t(I,g,B,C),Q);return A.isGeneratorFunction(g)?E:E.next().then((function(A){return A.done?A.value:E.next()}))},f(F),e(F,o,"Generator"),e(F,E,(function(){return this})),e(F,"toString",(function(){return"[object Generator]"})),A.keys=function(A){var I=[];for(var g in A)I.push(g);return I.reverse(),function g(){for(;I.length;){var B=I.pop();if(B in A)return g.value=B,g.done=!1,g}return g.done=!0,g}},A.values=Y,u.prototype={constructor:u,reset:function(A){if(this.prev=0,this.next=0,this.sent=this._sent=I,this.done=!1,this.delegate=null,this.method="next",this.arg=I,this.tryEntries.forEach(U),!A)for(var g in this)"t"===g.charAt(0)&&B.call(this,g)&&!isNaN(+g.slice(1))&&(this[g]=I)},stop:function(){this.done=!0;var A=this.tryEntries[0].completion;if("throw"===A.type)throw A.arg;return this.rval},dispatchException:function(A){if(this.done)throw A;var g=this;function C(B,C){return i.type="throw",i.arg=A,g.next=B,C&&(g.method="next",g.arg=I),!!C}for(var Q=this.tryEntries.length-1;Q>=0;--Q){var E=this.tryEntries[Q],i=E.completion;if("root"===E.tryLoc)return C("end");if(E.tryLoc<=this.prev){var o=B.call(E,"catchLoc"),e=B.call(E,"finallyLoc");if(o&&e){if(this.prev<E.catchLoc)return C(E.catchLoc,!0);if(this.prev<E.finallyLoc)return C(E.finallyLoc)}else if(o){if(this.prev<E.catchLoc)return C(E.catchLoc,!0)}else{if(!e)throw new Error("try statement without catch or finally");if(this.prev<E.finallyLoc)return C(E.finallyLoc)}}}},abrupt:function(A,I){for(var g=this.tryEntries.length-1;g>=0;--g){var C=this.tryEntries[g];if(C.tryLoc<=this.prev&&B.call(C,"finallyLoc")&&this.prev<C.finallyLoc){var Q=C;break}}Q&&("break"===A||"continue"===A)&&Q.tryLoc<=I&&I<=Q.finallyLoc&&(Q=null);var E=Q?Q.completion:{};return E.type=A,E.arg=I,Q?(this.method="next",this.next=Q.finallyLoc,w):this.complete(E)},complete:function(A,I){if("throw"===A.type)throw A.arg;return"break"===A.type||"continue"===A.type?this.next=A.arg:"return"===A.type?(this.rval=this.arg=A.arg,this.method="return",this.next="end"):"normal"===A.type&&I&&(this.next=I),w},finish:function(A){for(var I=this.tryEntries.length-1;I>=0;--I){var g=this.tryEntries[I];if(g.finallyLoc===A)return this.complete(g.completion,g.afterLoc),U(g),w}},catch:function(A){for(var