UNPKG

323 kBJavaScriptView Raw
1!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.GeoRaster=t():e.GeoRaster=t()}("undefined"!=typeof self?self:this,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=43)}([function(e,t){e.exports=require("stream")},function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return i})),r.d(t,"c",(function(){return o})),r.d(t,"d",(function(){return s})),r.d(t,"e",(function(){return a}));const n=Symbol("thread.errors"),i=Symbol("thread.events"),o=Symbol("thread.terminate"),s=Symbol("thread.transferable"),a=Symbol("thread.worker")},function(e,t){e.exports=require("url")},function(e,t,r){"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?e.exports=r(69):e.exports=r(71)},function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return s}));const n={deserialize:e=>Object.assign(Error(e.message),{name:e.name,stack:e.stack}),serialize:e=>({__error_marker:"$$error",message:e.message,name:e.name,stack:e.stack})};let i={deserialize(e){return(t=e)&&"object"==typeof t&&"__error_marker"in t&&"$$error"===t.__error_marker?n.deserialize(e):e;var t},serialize:e=>e instanceof Error?n.serialize(e):e};function o(e){return i.deserialize(e)}function s(e){return i.serialize(e)}},function(e,t){e.exports=require("zlib")},function(e,t,r){try{var n=r(13);if("function"!=typeof n.inherits)throw"";e.exports=n.inherits}catch(t){e.exports=r(52)}},function(e,t,r){"use strict";var n=r(17),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=f;var o=Object.create(r(12));o.inherits=r(6);var s=r(26),a=r(29);o.inherits(f,s);for(var c=i(a.prototype),l=0;l<c.length;l++){var u=c[l];f.prototype[u]||(f.prototype[u]=a.prototype[u])}function f(e){if(!(this instanceof f))return new f(e);s.call(this,e),a.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",h)}function h(){this.allowHalfOpen||this._writableState.ended||n.nextTick(d,this)}function d(e){e.end()}Object.defineProperty(f.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(f.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),f.prototype._destroy=function(e,t){this.push(null),this.end(),n.nextTick(t,e)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return p})),r.d(t,"b",(function(){return g}));var n={};let i;function o(){return i||(i=function(){try{throw new Error}catch(e){const t=(""+e.stack).match(/(https?|file|ftp|chrome-extension|moz-extension):\/\/[^)\n]+/g);if(t)return(""+t[0]).replace(/^((?:https?|file|ftp|chrome-extension|moz-extension):\/\/.+)?\/[^/]+(?:\?.*)?$/,"$1")+"/"}return"/"}()),i}r.r(n),r.d(n,"defaultPoolSize",(function(){return s})),r.d(n,"getWorkerImplementation",(function(){return u})),r.d(n,"isWorkerRuntime",(function(){return f}));const s="undefined"!=typeof navigator&&navigator.hardwareConcurrency?navigator.hardwareConcurrency:4,a=e=>/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(e);function c(e){const t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}let l;function u(){return l||(l=function(){if("undefined"==typeof Worker)return class{constructor(){throw Error("No web worker implementation available. You might have tried to spawn a worker within a worker in a browser that doesn't support workers in workers.")}};class e extends Worker{constructor(e,t){var r,n;"string"==typeof e&&t&&t._baseURL?e=new URL(e,t._baseURL):"string"==typeof e&&!a(e)&&o().match(/^file:\/\//i)&&(e=new URL(e,o().replace(/\/[^\/]+$/,"/")),(null===(r=null==t?void 0:t.CORSWorkaround)||void 0===r||r)&&(e=c(`importScripts(${JSON.stringify(e)});`))),"string"==typeof e&&a(e)&&(null===(n=null==t?void 0:t.CORSWorkaround)||void 0===n||n)&&(e=c(`importScripts(${JSON.stringify(e)});`)),super(e,t)}}class t extends e{constructor(e,t){super(window.URL.createObjectURL(e),t)}static fromText(e,r){const n=new window.Blob([e],{type:"text/javascript"});return new t(n,r)}}return{blob:t,default:e}}()),l}function f(){const e="undefined"!=typeof self&&"undefined"!=typeof Window&&self instanceof Window;return!("undefined"==typeof self||!self.postMessage||e)}var h=r(38);const d="undefined"!=typeof process&&"browser"!==process.arch&&"pid"in process?h:n,p=d.defaultPoolSize,g=d.getWorkerImplementation;d.isWorkerRuntime},function(e,t){e.exports=require("http")},function(e,t){e.exports=require("path")},function(e,t,r){"use strict";var n,i;r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return i})),function(e){e.cancel="cancel",e.run="run"}(n||(n={})),function(e){e.error="error",e.init="init",e.result="result",e.running="running",e.uncaughtError="uncaughtError"}(i||(i={}))},function(e,t,r){function n(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===n(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===n(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===n(e)},t.isError=function(e){return"[object Error]"===n(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(15).Buffer.isBuffer},function(e,t){e.exports=require("util")},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(1);function i(e){throw Error(e)}const o={errors:e=>e[n.a]||i("Error observable not found. Make sure to pass a thread instance as returned by the spawn() promise."),events:e=>e[n.b]||i("Events observable not found. Make sure to pass a thread instance as returned by the spawn() promise."),terminate:e=>e[n.c]()}},function(e,t){e.exports=require("buffer")},function(e,t){e.exports=require("fs")},function(e,t,r){"use strict";"undefined"==typeof process||!process.version||0===process.version.indexOf("v0.")||0===process.version.indexOf("v1.")&&0!==process.version.indexOf("v1.8.")?e.exports={nextTick:function(e,t,r,n){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var i,o,s=arguments.length;switch(s){case 0:case 1:return process.nextTick(e);case 2:return process.nextTick((function(){e.call(null,t)}));case 3:return process.nextTick((function(){e.call(null,t,r)}));case 4:return process.nextTick((function(){e.call(null,t,r,n)}));default:for(i=new Array(s-1),o=0;o<i.length;)i[o++]=arguments[o];return process.nextTick((function(){e.apply(null,i)}))}}}:e.exports=process},function(e,t,r){var n=r(15),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=s),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},function(e,t,r){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var n in r)i(r,n)&&(e[n]=r[n])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var o={arraySet:function(e,t,r,n,i){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+n),i);else for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){var t,r,n,i,o,s;for(n=0,t=0,r=e.length;t<r;t++)n+=e[t].length;for(s=new Uint8Array(n),i=0,t=0,r=e.length;t<r;t++)o=e[t],s.set(o,i),i+=o.length;return s}},s={arraySet:function(e,t,r,n,i){for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){return[].concat.apply([],e)}};t.setTyped=function(e){e?(t.Buf8=Uint8Array,t.Buf16=Uint16Array,t.Buf32=Int32Array,t.assign(t,o)):(t.Buf8=Array,t.Buf16=Array,t.Buf32=Array,t.assign(t,s))},t.setTyped(n)},function(e,t){e.exports=require("https")},function(e,t,r){"use strict";const n=()=>"function"==typeof Symbol,i=e=>n()&&Boolean(Symbol[e]),o=e=>i(e)?Symbol[e]:"@@"+e;i("asyncIterator")||(Symbol.asyncIterator=Symbol.asyncIterator||Symbol.for("Symbol.asyncIterator"));const s=o("iterator"),a=o("observable"),c=o("species");function l(e,t){const r=e[t];if(null!=r){if("function"!=typeof r)throw new TypeError(r+" is not a function");return r}}function u(e){let t=e.constructor;return void 0!==t&&(t=t[c],null===t&&(t=void 0)),void 0!==t?t:w}function f(e){f.log?f.log(e):setTimeout(()=>{throw e},0)}function h(e){Promise.resolve().then(()=>{try{e()}catch(e){f(e)}})}function d(e){const t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{const e=l(t,"unsubscribe");e&&e.call(t)}}catch(e){f(e)}}function p(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function g(e,t,r){e._state="running";const n=e._observer;try{const i=n?l(n,t):void 0;switch(t){case"next":i&&i.call(n,r);break;case"error":if(p(e),!i)throw r;i.call(n,r);break;case"complete":p(e),i&&i.call(n)}}catch(e){f(e)}"closed"===e._state?d(e):"running"===e._state&&(e._state="ready")}function m(e,t,r){if("closed"!==e._state)return"buffering"===e._state?(e._queue=e._queue||[],void e._queue.push({type:t,value:r})):"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:r}],void h(()=>function(e){const t=e._queue;if(t){e._queue=void 0,e._state="ready";for(const r of t)if(g(e,r.type,r.value),"closed"===e._state)break}}(e))):void g(e,t,r)}class b{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";const r=new y(this);try{this._cleanup=t.call(void 0,r)}catch(e){r.error(e)}"initializing"===this._state&&(this._state="ready")}get closed(){return"closed"===this._state}unsubscribe(){"closed"!==this._state&&(p(this),d(this))}}class y{constructor(e){this._subscription=e}get closed(){return"closed"===this._subscription._state}next(e){m(this._subscription,"next",e)}error(e){m(this._subscription,"error",e)}complete(){m(this._subscription,"complete")}}class w{constructor(e){if(!(this instanceof w))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw new TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e,t,r){return"object"==typeof e&&null!==e||(e={next:e,error:t,complete:r}),new b(e,this._subscriber)}pipe(e,...t){let r=this;for(const n of[e,...t])r=n(r);return r}tap(e,t,r){const n="object"!=typeof e||null===e?{next:e,error:t,complete:r}:e;return new w(e=>this.subscribe({next(t){n.next&&n.next(t),e.next(t)},error(t){n.error&&n.error(t),e.error(t)},complete(){n.complete&&n.complete(),e.complete()},start(e){n.start&&n.start(e)}}))}forEach(e){return new Promise((t,r)=>{if("function"!=typeof e)return void r(new TypeError(e+" is not a function"));function n(){i.unsubscribe(),t(void 0)}const i=this.subscribe({next(t){try{e(t,n)}catch(e){r(e),i.unsubscribe()}},error(e){r(e)},complete(){t(void 0)}})})}map(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(u(this))(t=>this.subscribe({next(r){let n=r;try{n=e(r)}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}filter(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(u(this))(t=>this.subscribe({next(r){try{if(!e(r))return}catch(e){return t.error(e)}t.next(r)},error(e){t.error(e)},complete(){t.complete()}}))}reduce(e,t){if("function"!=typeof e)throw new TypeError(e+" is not a function");const r=u(this),n=arguments.length>1;let i=!1,o=t;return new r(t=>this.subscribe({next(r){const s=!i;if(i=!0,!s||n)try{o=e(o,r)}catch(e){return t.error(e)}else o=r},error(e){t.error(e)},complete(){if(!i&&!n)return t.error(new TypeError("Cannot reduce an empty sequence"));t.next(o),t.complete()}}))}concat(...e){const t=u(this);return new t(r=>{let n,i=0;return function o(s){n=s.subscribe({next(e){r.next(e)},error(e){r.error(e)},complete(){i===e.length?(n=void 0,r.complete()):o(t.from(e[i++]))}})}(this),()=>{n&&(n.unsubscribe(),n=void 0)}})}flatMap(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");const t=u(this);return new t(r=>{const n=[],i=this.subscribe({next(i){let s;if(e)try{s=e(i)}catch(e){return r.error(e)}else s=i;const a=t.from(s).subscribe({next(e){r.next(e)},error(e){r.error(e)},complete(){const e=n.indexOf(a);e>=0&&n.splice(e,1),o()}});n.push(a)},error(e){r.error(e)},complete(){o()}});function o(){i.closed&&0===n.length&&r.complete()}return()=>{n.forEach(e=>e.unsubscribe()),i.unsubscribe()}})}[(Symbol.observable,a)](){return this}static from(e){const t="function"==typeof this?this:w;if(null==e)throw new TypeError(e+" is not an object");const r=l(e,a);if(r){const n=r.call(e);if(Object(n)!==n)throw new TypeError(n+" is not an object");return function(e){return e instanceof w}(n)&&n.constructor===t?n:new t(e=>n.subscribe(e))}if(i("iterator")){const r=l(e,s);if(r)return new t(t=>{h(()=>{if(!t.closed){for(const n of r.call(e))if(t.next(n),t.closed)return;t.complete()}})})}if(Array.isArray(e))return new t(t=>{h(()=>{if(!t.closed){for(const r of e)if(t.next(r),t.closed)return;t.complete()}})});throw new TypeError(e+" is not observable")}static of(...e){return new("function"==typeof this?this:w)(t=>{h(()=>{if(!t.closed){for(const r of e)if(t.next(r),t.closed)return;t.complete()}})})}static get[c](){return this}}n()&&Object.defineProperty(w,Symbol("extensions"),{value:{symbol:a,hostReportError:f},configurable:!0});t.a=w},,function(e,t){e.exports=require("events")},function(e,t,r){"use strict";r.d(t,"a",(function(){return A}));var n=r(3),i=r.n(n),o=r(21),s=r(4);const a=()=>{};var c,l=r(1);!function(e){e.internalError="internalError",e.message="message",e.termination="termination"}(c||(c={}));var u=r(79);const f=()=>{},h=e=>e,d=e=>Promise.resolve().then(e);function p(e){throw e}class g extends o.a{constructor(e){super(t=>{const r=this,n=Object.assign(Object.assign({},t),{complete(){t.complete(),r.onCompletion()},error(e){t.error(e),r.onError(e)},next(e){t.next(e),r.onNext(e)}});try{return this.initHasRun=!0,e(n)}catch(e){n.error(e)}}),this.initHasRun=!1,this.fulfillmentCallbacks=[],this.rejectionCallbacks=[],this.firstValueSet=!1,this.state="pending"}onNext(e){this.firstValueSet||(this.firstValue=e,this.firstValueSet=!0)}onError(e){this.state="rejected",this.rejection=e;for(const t of this.rejectionCallbacks)d(()=>t(e))}onCompletion(){this.state="fulfilled";for(const e of this.fulfillmentCallbacks)d(()=>e(this.firstValue))}then(e,t){const r=e||h,n=t||p;let i=!1;return new Promise((e,t)=>{const o=r=>{if(!i){i=!0;try{e(n(r))}catch(e){t(e)}}};return this.initHasRun||this.subscribe({error:o}),"fulfilled"===this.state?e(r(this.firstValue)):"rejected"===this.state?(i=!0,e(n(this.rejection))):(this.fulfillmentCallbacks.push(t=>{try{e(r(t))}catch(e){o(e)}}),void this.rejectionCallbacks.push(o))})}catch(e){return this.then(void 0,e)}finally(e){const t=e||f;return this.then(e=>(t(),e),()=>t())}static from(e){return function(e){return e&&"function"==typeof e.then}(e)?new g(t=>{e.then(e=>{t.next(e),t.complete()},e=>{t.error(e)})}):super.from(e)}}var m=r(42),b=r(11);const y=i()("threads:master:messages");let w=1;function v(e,t){return new o.a(r=>{let n;const i=o=>{var a;if(y("Message from worker:",o.data),o.data&&o.data.uid===t)if((a=o.data)&&a.type===b.b.running)n=o.data.resultType;else if((e=>e&&e.type===b.b.result)(o.data))"promise"===n?(void 0!==o.data.payload&&r.next(Object(s.a)(o.data.payload)),r.complete(),e.removeEventListener("message",i)):(o.data.payload&&r.next(Object(s.a)(o.data.payload)),o.data.complete&&(r.complete(),e.removeEventListener("message",i)));else if((e=>e&&e.type===b.b.error)(o.data)){const t=Object(s.a)(o.data.error);r.error(t),e.removeEventListener("message",i)}};return e.addEventListener("message",i),()=>{if("observable"===n||!n){const r={type:b.a.cancel,uid:t};e.postMessage(r)}e.removeEventListener("message",i)}})}function _(e,t){return(...r)=>{const n=w++,{args:i,transferables:o}=function(e){if(0===e.length)return{args:[],transferables:[]};const t=[],r=[];for(const n of e)Object(m.a)(n)?(t.push(Object(s.b)(n.send)),r.push(...n.transferables)):t.push(Object(s.b)(n));return{args:t,transferables:0===r.length?r:(n=r,Array.from(new Set(n)))};var n}(r),a={type:b.a.run,uid:n,method:t,args:i};y("Sending command to run function to worker:",a);try{e.postMessage(a,o)}catch(e){return g.from(Promise.reject(e))}return g.from(Object(u.a)(v(e,n)))}}var k=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};const S=i()("threads:master:messages"),x=i()("threads:master:spawn"),E=i()("threads:master:thread-utils"),C="undefined"!=typeof process&&process.env.THREADS_WORKER_INIT_TIMEOUT?Number.parseInt(process.env.THREADS_WORKER_INIT_TIMEOUT,10):1e4;function T(e){const[t,r]=function(){let e,t=!1,r=a;return[new Promise(n=>{t?n(e):r=n}),n=>{t=!0,e=n,r(e)}]}();return{terminate:()=>k(this,void 0,void 0,(function*(){E("Terminating worker"),yield e.terminate(),r()})),termination:t}}function O(e,t,r,n){const i=r.filter(e=>e.type===c.internalError).map(e=>e.error);return Object.assign(e,{[l.a]:i,[l.b]:r,[l.c]:n,[l.e]:t})}function A(e,t){return k(this,void 0,void 0,(function*(){x("Initializing new thread");const r=t&&t.timeout?t.timeout:C,n=(yield function(e,t,r){return k(this,void 0,void 0,(function*(){let n;const i=new Promise((e,i)=>{n=setTimeout(()=>i(Error(r)),t)}),o=yield Promise.race([e,i]);return clearTimeout(n),o}))}(function(e){return new Promise((t,r)=>{const n=i=>{var o;S("Message from worker before finishing initialization:",i.data),(o=i.data)&&"init"===o.type?(e.removeEventListener("message",n),t(i.data)):(e=>e&&"uncaughtError"===e.type)(i.data)&&(e.removeEventListener("message",n),r(Object(s.a)(i.data.error)))};e.addEventListener("message",n)})}(e),r,`Timeout: Did not receive an init message from worker after ${r}ms. Make sure the worker calls expose().`)).exposed,{termination:i,terminate:a}=T(e),l=function(e,t){return new o.a(r=>{const n=e=>{const t={type:c.message,data:e.data};r.next(t)},i=e=>{E("Unhandled promise rejection event in thread:",e);const t={type:c.internalError,error:Error(e.reason)};r.next(t)};e.addEventListener("message",n),e.addEventListener("unhandledrejection",i),t.then(()=>{const t={type:c.termination};e.removeEventListener("message",n),e.removeEventListener("unhandledrejection",i),r.next(t),r.complete()})})}(e,i);if("function"===n.type){return O(_(e),e,l,a)}if("module"===n.type){return O(function(e,t){const r={};for(const n of t)r[n]=_(e,n);return r}(e,n.methods),e,l,a)}{const e=n.type;throw Error("Worker init message states unexpected type of expose(): "+e)}}))}},function(e,t,r){"use strict";r.d(t,"a",(function(){return m}));var n=r(3),i=r.n(n),o=r(41),s=r(79),a=r(21);function c(e){return Promise.all(e.map(e=>{const t=e=>({status:"fulfilled",value:e}),r=e=>({status:"rejected",reason:e}),n=Promise.resolve(e);try{return n.then(t,r)}catch(e){return Promise.reject(e)}}))}var l,u=r(8);!function(e){e.initialized="initialized",e.taskCanceled="taskCanceled",e.taskCompleted="taskCompleted",e.taskFailed="taskFailed",e.taskQueued="taskQueued",e.taskQueueDrained="taskQueueDrained",e.taskStart="taskStart",e.terminated="terminated"}(l||(l={}));var f=r(14),h=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};let d=1;class p{constructor(e,t){this.eventSubject=new o.a,this.initErrors=[],this.isClosing=!1,this.nextTaskID=1,this.taskQueue=[];const r="number"==typeof t?{size:t}:t||{},{size:n=u.a}=r;this.debug=i()("threads:pool:"+(r.name||String(d++)).replace(/\W/g," ").trim().replace(/\s+/g,"-")),this.options=r,this.workers=function(e,t){return function(e){const t=[];for(let r=0;r<e;r++)t.push(r);return t}(t).map(()=>({init:e(),runningTasks:[]}))}(e,n),this.eventObservable=Object(s.a)(a.a.from(this.eventSubject)),Promise.all(this.workers.map(e=>e.init)).then(()=>this.eventSubject.next({type:l.initialized,size:this.workers.length}),e=>{this.debug("Error while initializing pool worker:",e),this.eventSubject.error(e),this.initErrors.push(e)})}findIdlingWorker(){const{concurrency:e=1}=this.options;return this.workers.find(t=>t.runningTasks.length<e)}runPoolTask(e,t){return h(this,void 0,void 0,(function*(){const r=this.workers.indexOf(e)+1;this.debug(`Running task #${t.id} on worker #${r}...`),this.eventSubject.next({type:l.taskStart,taskID:t.id,workerID:r});try{const n=yield t.run(yield e.init);this.debug(`Task #${t.id} completed successfully`),this.eventSubject.next({type:l.taskCompleted,returnValue:n,taskID:t.id,workerID:r})}catch(e){this.debug(`Task #${t.id} failed`),this.eventSubject.next({type:l.taskFailed,taskID:t.id,error:e,workerID:r})}}))}run(e,t){return h(this,void 0,void 0,(function*(){const r=(()=>h(this,void 0,void 0,(function*(){var n;yield(n=0,new Promise(e=>setTimeout(e,n)));try{yield this.runPoolTask(e,t)}finally{e.runningTasks=e.runningTasks.filter(e=>e!==r),this.isClosing||this.scheduleWork()}})))();e.runningTasks.push(r)}))}scheduleWork(){this.debug("Attempt de-queueing a task in order to run it...");const e=this.findIdlingWorker();if(!e)return;const t=this.taskQueue.shift();if(!t)return this.debug("Task queue is empty"),void this.eventSubject.next({type:l.taskQueueDrained});this.run(e,t)}taskCompletion(e){return new Promise((t,r)=>{const n=this.events().subscribe(i=>{i.type===l.taskCompleted&&i.taskID===e?(n.unsubscribe(),t(i.returnValue)):i.type===l.taskFailed&&i.taskID===e?(n.unsubscribe(),r(i.error)):i.type===l.terminated&&(n.unsubscribe(),r(Error("Pool has been terminated before task was run.")))})})}settled(e=!1){return h(this,void 0,void 0,(function*(){const t=()=>{return e=this.workers,t=e=>e.runningTasks,e.reduce((e,r)=>[...e,...t(r)],[]);var e,t},r=[],n=this.eventObservable.subscribe(e=>{e.type===l.taskFailed&&r.push(e.error)});return this.initErrors.length>0?Promise.reject(this.initErrors[0]):e&&0===this.taskQueue.length?(yield c(t()),r):(yield new Promise((e,t)=>{const r=this.eventObservable.subscribe({next(t){t.type===l.taskQueueDrained&&(r.unsubscribe(),e(void 0))},error:t})}),yield c(t()),n.unsubscribe(),r)}))}completed(e=!1){return h(this,void 0,void 0,(function*(){const t=this.settled(e),r=new Promise((e,r)=>{const n=this.eventObservable.subscribe({next(i){i.type===l.taskQueueDrained?(n.unsubscribe(),e(t)):i.type===l.taskFailed&&(n.unsubscribe(),r(i.error))},error:r})}),n=yield Promise.race([t,r]);if(n.length>0)throw n[0]}))}events(){return this.eventObservable}queue(e){const{maxQueuedJobs:t=1/0}=this.options;if(this.isClosing)throw Error("Cannot schedule pool tasks after terminate() has been called.");if(this.initErrors.length>0)throw this.initErrors[0];const r=this.nextTaskID++,n=this.taskCompletion(r);n.catch(e=>{this.debug(`Task #${r} errored:`,e)});const i={id:r,run:e,cancel:()=>{-1!==this.taskQueue.indexOf(i)&&(this.taskQueue=this.taskQueue.filter(e=>e!==i),this.eventSubject.next({type:l.taskCanceled,taskID:i.id}))},then:n.then.bind(n)};if(this.taskQueue.length>=t)throw Error("Maximum number of pool tasks queued. Refusing to queue another one.\nThis usually happens for one of two reasons: We are either at peak workload right now or some tasks just won't finish, thus blocking the pool.");return this.debug(`Queueing task #${i.id}...`),this.taskQueue.push(i),this.eventSubject.next({type:l.taskQueued,taskID:i.id}),this.scheduleWork(),i}terminate(e){return h(this,void 0,void 0,(function*(){this.isClosing=!0,e||(yield this.completed(!0)),this.eventSubject.next({type:l.terminated,remainingQueue:[...this.taskQueue]}),this.eventSubject.complete(),yield Promise.all(this.workers.map(e=>h(this,void 0,void 0,(function*(){return f.a.terminate(yield e.init)}))))}))}}function g(e,t){return new p(e,t)}p.EventType=l,g.EventType=l;const m=g},function(e,t,r){"use strict";var n=r(17);e.exports=y;var i,o=r(51);y.ReadableState=b;r(23).EventEmitter;var s=function(e,t){return e.listeners(t).length},a=r(27),c=r(18).Buffer,l=global.Uint8Array||function(){};var u=Object.create(r(12));u.inherits=r(6);var f=r(13),h=void 0;h=f&&f.debuglog?f.debuglog("stream"):function(){};var d,p=r(53),g=r(28);u.inherits(y,a);var m=["error","close","destroy","pause","resume"];function b(e,t){e=e||{};var n=t instanceof(i=i||r(7));this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var o=e.highWaterMark,s=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=o||0===o?o:n&&(s||0===s)?s:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(d||(d=r(30).StringDecoder),this.decoder=new d(e.encoding),this.encoding=e.encoding)}function y(e){if(i=i||r(7),!(this instanceof y))return new y(e);this._readableState=new b(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),a.call(this)}function w(e,t,r,n,i){var o,s=e._readableState;null===t?(s.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,k(e)}(e,s)):(i||(o=function(e,t){var r;n=t,c.isBuffer(n)||n instanceof l||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var n;return r}(s,t)),o?e.emit("error",o):s.objectMode||t&&t.length>0?("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function(e){return c.from(e)}(t)),n?s.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):v(e,s,t,!0):s.ended?e.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?v(e,s,t,!1):x(e,s)):v(e,s,t,!1))):n||(s.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(s)}function v(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&k(e)),x(e,t)}Object.defineProperty(y.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),y.prototype.destroy=g.destroy,y.prototype._undestroy=g.undestroy,y.prototype._destroy=function(e,t){this.push(null),t(e)},y.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=c.from(e,t),t=""),r=!0),w(this,e,t,!1,r)},y.prototype.unshift=function(e){return w(this,e,null,!0,!1)},y.prototype.isPaused=function(){return!1===this._readableState.flowing},y.prototype.setEncoding=function(e){return d||(d=r(30).StringDecoder),this._readableState.decoder=new d(e),this._readableState.encoding=e,this};function _(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function k(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(h("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?n.nextTick(S,e):S(e))}function S(e){h("emit readable"),e.emit("readable"),O(e)}function x(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(E,e,t))}function E(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(h("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}function C(e){h("readable nexttick read 0"),e.read(0)}function T(e,t){t.reading||(h("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),O(e),t.flowing&&!t.reading&&e.read(0)}function O(e){var t=e._readableState;for(h("flow",t.flowing);t.flowing&&null!==e.read(););}function A(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var n;e<t.head.data.length?(n=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):n=e===t.head.data.length?t.shift():r?function(e,t){var r=t.head,n=1,i=r.data;e-=i.length;for(;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),0===(e-=s)){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++n}return t.length-=n,i}(e,t):function(e,t){var r=c.allocUnsafe(e),n=t.head,i=1;n.data.copy(r),e-=n.data.length;for(;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),0===(e-=s)){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++i}return t.length-=i,r}(e,t);return n}(e,t.buffer,t.decoder),r);var r}function P(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,n.nextTick(I,t,e))}function I(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function D(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}y.prototype.read=function(e){h("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return h("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?P(this):k(this),null;if(0===(e=_(e,t))&&t.ended)return 0===t.length&&P(this),null;var n,i=t.needReadable;return h("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&h("length less than watermark",i=!0),t.ended||t.reading?h("reading or ended",i=!1):i&&(h("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=_(r,t))),null===(n=e>0?A(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&P(this)),null!==n&&this.emit("data",n),n},y.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},y.prototype.pipe=function(e,t){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,h("pipe count=%d opts=%j",i.pipesCount,t);var a=(!t||!1!==t.end)&&e!==process.stdout&&e!==process.stderr?l:y;function c(t,n){h("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,h("cleanup"),e.removeListener("close",m),e.removeListener("finish",b),e.removeListener("drain",u),e.removeListener("error",g),e.removeListener("unpipe",c),r.removeListener("end",l),r.removeListener("end",y),r.removeListener("data",p),f=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||u())}function l(){h("onend"),e.end()}i.endEmitted?n.nextTick(a):r.once("end",a),e.on("unpipe",c);var u=function(e){return function(){var t=e._readableState;h("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&s(e,"data")&&(t.flowing=!0,O(e))}}(r);e.on("drain",u);var f=!1;var d=!1;function p(t){h("ondata"),d=!1,!1!==e.write(t)||d||((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==D(i.pipes,e))&&!f&&(h("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,d=!0),r.pause())}function g(t){h("onerror",t),y(),e.removeListener("error",g),0===s(e,"error")&&e.emit("error",t)}function m(){e.removeListener("finish",b),y()}function b(){h("onfinish"),e.removeListener("close",m),y()}function y(){h("unpipe"),r.unpipe(e)}return r.on("data",p),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",g),e.once("close",m),e.once("finish",b),e.emit("pipe",r),i.flowing||(h("pipe resume"),r.resume()),e},y.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,r);return this}var s=D(t.pipes,e);return-1===s||(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},y.prototype.on=function(e,t){var r=a.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var i=this._readableState;i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.emittedReadable=!1,i.reading?i.length&&k(this):n.nextTick(C,this))}return r},y.prototype.addListener=y.prototype.on,y.prototype.resume=function(){var e=this._readableState;return e.flowing||(h("resume"),e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(T,e,t))}(this,e)),this},y.prototype.pause=function(){return h("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(h("pause"),this._readableState.flowing=!1,this.emit("pause")),this},y.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(h("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){(h("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o<m.length;o++)e.on(m[o],this.emit.bind(this,m[o]));return this._read=function(t){h("wrapped _read",t),n&&(n=!1,e.resume())},this},Object.defineProperty(y.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),y._fromList=A},function(e,t,r){e.exports=r(0)},function(e,t,r){"use strict";var n=r(17);function i(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var r=this,o=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return o||s?(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||n.nextTick(i,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?(n.nextTick(i,r,e),r._writableState&&(r._writableState.errorEmitted=!0)):t&&t(e)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(e,t,r){"use strict";var n=r(17);function i(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;e.entry=null;for(;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}e.exports=m;var o,s=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:n.nextTick;m.WritableState=g;var a=Object.create(r(12));a.inherits=r(6);var c={deprecate:r(54)},l=r(27),u=r(18).Buffer,f=global.Uint8Array||function(){};var h,d=r(28);function p(){}function g(e,t){o=o||r(7),e=e||{};var a=t instanceof o;this.objectMode=!!e.objectMode,a&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var c=e.highWaterMark,l=e.writableHighWaterMark,u=this.objectMode?16:16384;this.highWaterMark=c||0===c?c:a&&(l||0===l)?l:u,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===e.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,i=r.sync,o=r.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,i,o){--t.pendingcb,r?(n.nextTick(o,i),n.nextTick(k,e,t),e._writableState.errorEmitted=!0,e.emit("error",i)):(o(i),e._writableState.errorEmitted=!0,e.emit("error",i),k(e,t))}(e,r,i,t,o);else{var a=v(r);a||r.corked||r.bufferProcessing||!r.bufferedRequest||w(e,r),i?s(y,e,r,a,o):y(e,r,a,o)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function m(e){if(o=o||r(7),!(h.call(m,this)||this instanceof o))return new m(e);this._writableState=new g(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),l.call(this)}function b(e,t,r,n,i,o,s){t.writelen=n,t.writecb=s,t.writing=!0,t.sync=!0,r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function y(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),k(e,t)}function w(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,o=new Array(n),s=t.corkedRequestsFree;s.entry=r;for(var a=0,c=!0;r;)o[a]=r,r.isBuf||(c=!1),r=r.next,a+=1;o.allBuffers=c,b(e,t,!0,t.length,o,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new i(t),t.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,u=r.encoding,f=r.callback;if(b(e,t,!1,t.objectMode?1:l.length,l,u,f),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function v(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function _(e,t){e._final((function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),k(e,t)}))}function k(e,t){var r=v(t);return r&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,n.nextTick(_,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),r}a.inherits(m,l),g.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(g.prototype,"buffer",{get:c.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(h=Function.prototype[Symbol.hasInstance],Object.defineProperty(m,Symbol.hasInstance,{value:function(e){return!!h.call(this,e)||this===m&&(e&&e._writableState instanceof g)}})):h=function(e){return e instanceof this},m.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},m.prototype.write=function(e,t,r){var i,o=this._writableState,s=!1,a=!o.objectMode&&(i=e,u.isBuffer(i)||i instanceof f);return a&&!u.isBuffer(e)&&(e=function(e){return u.from(e)}(e)),"function"==typeof t&&(r=t,t=null),a?t="buffer":t||(t=o.defaultEncoding),"function"!=typeof r&&(r=p),o.ended?function(e,t){var r=new Error("write after end");e.emit("error",r),n.nextTick(t,r)}(this,r):(a||function(e,t,r,i){var o=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),n.nextTick(i,s),o=!1),o}(this,o,e,r))&&(o.pendingcb++,s=function(e,t,r,n,i,o){if(!r){var s=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=u.from(t,r));return t}(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var c=t.length<t.highWaterMark;c||(t.needDrain=!0);if(t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else b(e,t,!1,a,n,i,o);return c}(this,o,a,e,t,r)),s},m.prototype.cork=function(){this._writableState.corked++},m.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||w(this,e))},m.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(m.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),m.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},m.prototype._writev=null,m.prototype.end=function(e,t,r){var i=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||i.finished||function(e,t,r){t.ending=!0,k(e,t),r&&(t.finished?n.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,i,r)},Object.defineProperty(m.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),m.prototype.destroy=d.destroy,m.prototype._undestroy=d.undestroy,m.prototype._destroy=function(e,t){this.end(),t(e)}},function(e,t,r){"use strict";var n=r(18).Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=c,this.end=l,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=u,this.end=f,t=3;break;default:return this.write=h,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function l(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function u(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}t.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},o.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},o.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var i=s(t[n]);if(i>=0)return i>0&&(e.lastNeed=i-1),i;if(--n<r||-2===i)return 0;if((i=s(t[n]))>=0)return i>0&&(e.lastNeed=i-2),i;if(--n<r||-2===i)return 0;if((i=s(t[n]))>=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,r){"use strict";e.exports=s;var n=r(7),i=Object.create(r(12));function o(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function s(e){if(!(this instanceof s))return new s(e);n.call(this,e),this._transformState={afterTransform:o.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",a)}function a(){var e=this;"function"==typeof this._flush?this._flush((function(t,r){c(e,t,r)})):c(this,null,null)}function c(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}i.inherits=r(6),i.inherits(s,n),s.prototype.push=function(e,t){return this._transformState.needTransform=!1,n.prototype.push.call(this,e,t)},s.prototype._transform=function(e,t,r){throw new Error("_transform() is not implemented")},s.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},s.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},s.prototype._destroy=function(e,t){var r=this;n.prototype._destroy.call(this,e,(function(e){t(e),r.emit("close")}))}},function(e,t,r){"use strict";(function(e){var n=r(76),i=r(25),o=r(24);const s="undefined"!=typeof navigator?navigator.hardwareConcurrency:null;t.a=class{constructor(t=s){const r=new n.a(e);this.pool=Object(i.a)(()=>Object(o.a)(r),t)}async decode(e,t){return new Promise((r,n)=>{this.pool.queue(async i=>{try{const n=await i(e,t);r(n)}catch(e){n(e)}})})}destroy(){this.pool.terminate(!0)}}}).call(this,r(66))},function(e,t,r){e.exports=function(e){function t(e){let r,i,o,s=null;function a(...e){if(!a.enabled)return;const n=a,i=Number(new Date),o=i-(r||i);n.diff=o,n.prev=r,n.curr=i,r=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(r,i)=>{if("%%"===r)return"%";s++;const o=t.formatters[i];if("function"==typeof o){const t=e[s];r=o.call(n,t),e.splice(s,1),s--}return r}),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=n,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(i!==t.namespaces&&(i=t.namespaces,o=t.enabled(e)),o),set:e=>{s=e}}),"function"==typeof t.init&&t.init(a),a}function n(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(i),...t.skips.map(i).map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(r=0;r<i;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=r(70),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(r=>{t[r]=e[r]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t}},function(e,t,r){"use strict";e.exports={countIn1D:function(e){return e.reduce((function(e,t){return void 0===e[t]?e[t]=1:e[t]++,e}),{})},countIn2D:function(e){return e.reduce((function(e,t){return t.forEach((function(t){void 0===e[t]?e[t]=1:e[t]++})),e}),{})},unflatten:function(e,t){for(var r=t.height,n=t.width,i=[],o=0;o<r;o++){var s=o*n,a=s+n;i.push(e.slice(s,a))}return i}}},function(e,t,r){"use strict";r.r(t),r.d(t,"globals",(function(){return n})),r.d(t,"rgb",(function(){return i})),r.d(t,"getDecoder",(function(){return B})),r.d(t,"setLogger",(function(){return _e})),r.d(t,"GeoTIFF",(function(){return Te})),r.d(t,"MultiGeoTIFF",(function(){return Oe})),r.d(t,"fromUrl",(function(){return Ae})),r.d(t,"fromArrayBuffer",(function(){return Pe})),r.d(t,"fromFile",(function(){return Ie})),r.d(t,"fromBlob",(function(){return De})),r.d(t,"fromUrls",(function(){return Me})),r.d(t,"writeArrayBuffer",(function(){return Re})),r.d(t,"Pool",(function(){return $.a}));var n={};r.r(n),r.d(n,"fieldTagNames",(function(){return a})),r.d(n,"fieldTags",(function(){return c})),r.d(n,"fieldTagTypes",(function(){return l})),r.d(n,"arrayFields",(function(){return u})),r.d(n,"fieldTypeNames",(function(){return f})),r.d(n,"fieldTypes",(function(){return h})),r.d(n,"photometricInterpretations",(function(){return d})),r.d(n,"ExtraSamplesValues",(function(){return p})),r.d(n,"geoKeyNames",(function(){return g})),r.d(n,"geoKeys",(function(){return m}));var i={};r.r(i),r.d(i,"fromWhiteIsZero",(function(){return b})),r.d(i,"fromBlackIsZero",(function(){return y})),r.d(i,"fromPalette",(function(){return w})),r.d(i,"fromCMYK",(function(){return v})),r.d(i,"fromYCbCr",(function(){return _})),r.d(i,"fromCIELab",(function(){return k}));var o=r(36),s=r.n(o);const a={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"},c={};for(const e in a)a.hasOwnProperty(e)&&(c[a[e]]=parseInt(e,10));const l={256:"SHORT",257:"SHORT",258:"SHORT",259:"SHORT",262:"SHORT",273:"LONG",274:"SHORT",277:"SHORT",278:"LONG",279:"LONG",282:"RATIONAL",283:"RATIONAL",284:"SHORT",286:"SHORT",287:"RATIONAL",296:"SHORT",305:"ASCII",306:"ASCII",338:"SHORT",339:"SHORT",513:"LONG",514:"LONG",1024:"SHORT",1025:"SHORT",2048:"SHORT",2049:"ASCII",33550:"DOUBLE",33922:"DOUBLE",34665:"LONG",34735:"SHORT",34737:"ASCII",42113:"ASCII"},u=[c.BitsPerSample,c.ExtraSamples,c.SampleFormat,c.StripByteCounts,c.StripOffsets,c.StripRowCounts,c.TileByteCounts,c.TileOffsets],f={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"},h={};for(const e in f)f.hasOwnProperty(e)&&(h[f[e]]=parseInt(e,10));const d={WhiteIsZero:0,BlackIsZero:1,RGB:2,Palette:3,TransparencyMask:4,CMYK:5,YCbCr:6,CIELab:8,ICCLab:9},p={Unspecified:0,Assocalpha:1,Unassalpha:2},g={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"},m={};for(const e in g)g.hasOwnProperty(e)&&(m[g[e]]=parseInt(e,10));function b(e,t){const{width:r,height:n}=e,i=new Uint8Array(r*n*3);let o;for(let r=0,n=0;r<e.length;++r,n+=3)o=256-e[r]/t*256,i[n]=o,i[n+1]=o,i[n+2]=o;return i}function y(e,t){const{width:r,height:n}=e,i=new Uint8Array(r*n*3);let o;for(let r=0,n=0;r<e.length;++r,n+=3)o=e[r]/t*256,i[n]=o,i[n+1]=o,i[n+2]=o;return i}function w(e,t){const{width:r,height:n}=e,i=new Uint8Array(r*n*3),o=t.length/3,s=t.length/3*2;for(let r=0,n=0;r<e.length;++r,n+=3){const a=e[r];i[n]=t[a]/65536*256,i[n+1]=t[a+o]/65536*256,i[n+2]=t[a+s]/65536*256}return i}function v(e){const{width:t,height:r}=e,n=new Uint8Array(t*r*3);for(let t=0,r=0;t<e.length;t+=4,r+=3){const i=e[t],o=e[t+1],s=e[t+2],a=e[t+3];n[r]=(255-i)/256*255*((255-a)/256),n[r+1]=(255-o)/256*255*((255-a)/256),n[r+2]=(255-s)/256*255*((255-a)/256)}return n}function _(e){const{width:t,height:r}=e,n=new Uint8ClampedArray(t*r*3);for(let t=0,r=0;t<e.length;t+=3,r+=3){const i=e[t],o=e[t+1],s=e[t+2];n[r]=i+1.402*(s-128),n[r+1]=i-.34414*(o-128)-.71414*(s-128),n[r+2]=i+1.772*(o-128)}return n}function k(e){const{width:t,height:r}=e,n=new Uint8Array(t*r*3);for(let t=0,r=0;t<e.length;t+=3,r+=3){let i,o,s,a=(e[t+0]+16)/116,c=(e[t+1]<<24>>24)/500+a,l=a-(e[t+2]<<24>>24)/200;c=.95047*(c*c*c>.008856?c*c*c:(c-16/116)/7.787),a=1*(a*a*a>.008856?a*a*a:(a-16/116)/7.787),l=1.08883*(l*l*l>.008856?l*l*l:(l-16/116)/7.787),i=3.2406*c+-1.5372*a+-.4986*l,o=-.9689*c+1.8758*a+.0415*l,s=.0557*c+-.204*a+1.057*l,i=i>.0031308?1.055*i**(1/2.4)-.055:12.92*i,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,n[r]=255*Math.max(0,Math.min(1,i)),n[r+1]=255*Math.max(0,Math.min(1,o)),n[r+2]=255*Math.max(0,Math.min(1,s))}return n}function S(e,t){let r=e.length-t,n=0;do{for(let r=t;r>0;r--)e[n+t]+=e[n],n++;r-=t}while(r>0)}function x(e,t,r){let n=0,i=e.length;const o=i/r;for(;i>t;){for(let r=t;r>0;--r)e[n+t]+=e[n],++n;i-=t}const s=e.slice();for(let t=0;t<o;++t)for(let n=0;n<r;++n)e[r*t+n]=s[(r-n-1)*o+t]}class E{decode(e,t){const r=this.decodeBlock(t),n=e.Predictor||1;if(1!==n){const t=!e.StripOffsets;return function(e,t,r,n,i,o){if(!t||1===t)return e;for(let e=0;e<i.length;++e){if(i[e]%8!=0)throw new Error("When decoding with predictor, only multiple of 8 bits are supported.");if(i[e]!==i[0])throw new Error("When decoding with predictor, all samples must have the same size.")}const s=i[0]/8,a=2===o?1:i.length;for(let o=0;o<n&&!(o*a*r*s>=e.byteLength);++o){let n;if(2===t){switch(i[0]){case 8:n=new Uint8Array(e,o*a*r*s,a*r*s);break;case 16:n=new Uint16Array(e,o*a*r*s,a*r*s/2);break;case 32:n=new Uint32Array(e,o*a*r*s,a*r*s/4);break;default:throw new Error(`Predictor 2 not allowed with ${i[0]} bits per sample.`)}S(n,a)}else 3===t&&(n=new Uint8Array(e,o*a*r*s,a*r*s),x(n,a,s))}return e}(r,n,t?e.TileWidth:e.ImageWidth,t?e.TileLength:e.RowsPerStrip||e.ImageLength,e.BitsPerSample,e.PlanarConfiguration)}return r}}class C extends E{decodeBlock(e){return e}}function T(e,t){for(let r=t.length-1;r>=0;r--)e.push(t[r]);return e}function O(e){const t=new Uint16Array(4093),r=new Uint8Array(4093);for(let e=0;e<=257;e++)t[e]=4096,r[e]=e;let n=258,i=9,o=0;function s(){n=258,i=9}function a(e){const t=function(e,t,r){const n=t%8,i=Math.floor(t/8),o=8-n,s=t+r-8*(i+1);let a=8*(i+2)-(t+r);const c=8*(i+2)-t;if(a=Math.max(0,a),i>=e.length)return console.warn("ran off the end of the buffer before finding EOI_CODE (end on input code)"),257;let l=e[i]&2**(8-n)-1;l<<=r-o;let u=l;if(i+1<e.length){let t=e[i+1]>>>a;t<<=Math.max(0,r-c),u+=t}if(s>8&&i+2<e.length){const n=8*(i+3)-(t+r);u+=e[i+2]>>>n}return u}(e,o,i);return o+=i,t}function c(e,i){return r[n]=i,t[n]=e,n++,n-1}function l(e){const n=[];for(let i=e;4096!==i;i=t[i])n.push(r[i]);return n}const u=[];s();const f=new Uint8Array(e);let h,d=a(f);for(;257!==d;){if(256===d){for(s(),d=a(f);256===d;)d=a(f);if(257===d)break;if(d>256)throw new Error("corrupted code at scanline "+d);T(u,l(d)),h=d}else if(d<n){const e=l(d);T(u,e),c(h,e[e.length-1]),h=d}else{const e=l(h);if(!e)throw new Error(`Bogus entry. Not in dictionary, ${h} / ${n}, position: ${o}`);T(u,e),u.push(e[e.length-1]),c(h,e[e.length-1]),h=d}n+1>=2**i&&(12===i?h=void 0:i++),d=a(f)}return new Uint8Array(u)}class A extends E{decodeBlock(e){return O(e).buffer}}const P=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]);function I(e,t){let r=0;const n=[];let i=16;for(;i>0&&!e[i-1];)--i;n.push({children:[],index:0});let o,s=n[0];for(let a=0;a<i;a++){for(let i=0;i<e[a];i++){for(s=n.pop(),s.children[s.index]=t[r];s.index>0;)s=n.pop();for(s.index++,n.push(s);n.length<=a;)n.push(o={children:[],index:0}),s.children[s.index]=o.children,s=o;r++}a+1<i&&(n.push(o={children:[],index:0}),s.children[s.index]=o.children,s=o)}return n[0].children}function D(e,t,r,n,i,o,s,a,c){const{mcusPerLine:l,progressive:u}=r,f=t;let h=t,d=0,p=0;function g(){if(p>0)return p--,d>>p&1;if(d=e[h++],255===d){const t=e[h++];if(t)throw new Error("unexpected marker: "+(d<<8|t).toString(16))}return p=7,d>>>7}function m(e){let t,r=e;for(;null!==(t=g());){if(r=r[t],"number"==typeof r)return r;if("object"!=typeof r)throw new Error("invalid huffman sequence")}return null}function b(e){let t=e,r=0;for(;t>0;){const e=g();if(null===e)return;r=r<<1|e,--t}return r}function y(e){const t=b(e);return t>=1<<e-1?t:t+(-1<<e)+1}let w=0;let v,_=0;function k(e,t,r,n,i){const o=r%l,s=(r/l|0)*e.v+n,a=o*e.h+i;t(e,e.blocks[s][a])}function S(e,t,r){const n=r/e.blocksPerLine|0,i=r%e.blocksPerLine;t(e,e.blocks[n][i])}const x=n.length;let E,C,T,O,A,I;I=u?0===o?0===a?function(e,t){const r=m(e.huffmanTableDC),n=0===r?0:y(r)<<c;e.pred+=n,t[0]=e.pred}:function(e,t){t[0]|=g()<<c}:0===a?function(e,t){if(w>0)return void w--;let r=o;const n=s;for(;r<=n;){const n=m(e.huffmanTableAC),i=15&n,o=n>>4;if(0===i){if(o<15){w=b(o)+(1<<o)-1;break}r+=16}else{r+=o;t[P[r]]=y(i)*(1<<c),r++}}}:function(e,t){let r=o;const n=s;let i=0;for(;r<=n;){const n=P[r],o=t[n]<0?-1:1;switch(_){case 0:{const t=m(e.huffmanTableAC),r=15&t;if(i=t>>4,0===r)i<15?(w=b(i)+(1<<i),_=4):(i=16,_=1);else{if(1!==r)throw new Error("invalid ACn encoding");v=y(r),_=i?2:3}continue}case 1:case 2:t[n]?t[n]+=(g()<<c)*o:(i--,0===i&&(_=2===_?3:0));break;case 3:t[n]?t[n]+=(g()<<c)*o:(t[n]=v<<c,_=0);break;case 4:t[n]&&(t[n]+=(g()<<c)*o)}r++}4===_&&(w--,0===w&&(_=0))}:function(e,t){const r=m(e.huffmanTableDC),n=0===r?0:y(r);e.pred+=n,t[0]=e.pred;let i=1;for(;i<64;){const r=m(e.huffmanTableAC),n=15&r,o=r>>4;if(0===n){if(o<15)break;i+=16}else{i+=o;t[P[i]]=y(n),i++}}};let D,M,R=0;M=1===x?n[0].blocksPerLine*n[0].blocksPerColumn:l*r.mcusPerColumn;const F=i||M;for(;R<M;){for(C=0;C<x;C++)n[C].pred=0;if(w=0,1===x)for(E=n[0],A=0;A<F;A++)S(E,I,R),R++;else for(A=0;A<F;A++){for(C=0;C<x;C++){E=n[C];const{h:e,v:t}=E;for(T=0;T<t;T++)for(O=0;O<e;O++)k(E,I,R,T,O)}if(R++,R===M)break}if(p=0,D=e[h]<<8|e[h+1],D<65280)throw new Error("marker was not found");if(!(D>=65488&&D<=65495))break;h+=2}return h-f}function M(e,t){const r=[],{blocksPerLine:n,blocksPerColumn:i}=t,o=n<<3,s=new Int32Array(64),a=new Uint8Array(64);function c(e,r,n){const i=t.quantizationTable;let o,s,a,c,l,u,f,h,d;const p=n;let g;for(g=0;g<64;g++)p[g]=e[g]*i[g];for(g=0;g<8;++g){const e=8*g;0!==p[1+e]||0!==p[2+e]||0!==p[3+e]||0!==p[4+e]||0!==p[5+e]||0!==p[6+e]||0!==p[7+e]?(o=5793*p[0+e]+128>>8,s=5793*p[4+e]+128>>8,a=p[2+e],c=p[6+e],l=2896*(p[1+e]-p[7+e])+128>>8,h=2896*(p[1+e]+p[7+e])+128>>8,u=p[3+e]<<4,f=p[5+e]<<4,d=o-s+1>>1,o=o+s+1>>1,s=d,d=3784*a+1567*c+128>>8,a=1567*a-3784*c+128>>8,c=d,d=l-f+1>>1,l=l+f+1>>1,f=d,d=h+u+1>>1,u=h-u+1>>1,h=d,d=o-c+1>>1,o=o+c+1>>1,c=d,d=s-a+1>>1,s=s+a+1>>1,a=d,d=2276*l+3406*h+2048>>12,l=3406*l-2276*h+2048>>12,h=d,d=799*u+4017*f+2048>>12,u=4017*u-799*f+2048>>12,f=d,p[0+e]=o+h,p[7+e]=o-h,p[1+e]=s+f,p[6+e]=s-f,p[2+e]=a+u,p[5+e]=a-u,p[3+e]=c+l,p[4+e]=c-l):(d=5793*p[0+e]+512>>10,p[0+e]=d,p[1+e]=d,p[2+e]=d,p[3+e]=d,p[4+e]=d,p[5+e]=d,p[6+e]=d,p[7+e]=d)}for(g=0;g<8;++g){const e=g;0!==p[8+e]||0!==p[16+e]||0!==p[24+e]||0!==p[32+e]||0!==p[40+e]||0!==p[48+e]||0!==p[56+e]?(o=5793*p[0+e]+2048>>12,s=5793*p[32+e]+2048>>12,a=p[16+e],c=p[48+e],l=2896*(p[8+e]-p[56+e])+2048>>12,h=2896*(p[8+e]+p[56+e])+2048>>12,u=p[24+e],f=p[40+e],d=o-s+1>>1,o=o+s+1>>1,s=d,d=3784*a+1567*c+2048>>12,a=1567*a-3784*c+2048>>12,c=d,d=l-f+1>>1,l=l+f+1>>1,f=d,d=h+u+1>>1,u=h-u+1>>1,h=d,d=o-c+1>>1,o=o+c+1>>1,c=d,d=s-a+1>>1,s=s+a+1>>1,a=d,d=2276*l+3406*h+2048>>12,l=3406*l-2276*h+2048>>12,h=d,d=799*u+4017*f+2048>>12,u=4017*u-799*f+2048>>12,f=d,p[0+e]=o+h,p[56+e]=o-h,p[8+e]=s+f,p[48+e]=s-f,p[16+e]=a+u,p[40+e]=a-u,p[24+e]=c+l,p[32+e]=c-l):(d=5793*n[g+0]+8192>>14,p[0+e]=d,p[8+e]=d,p[16+e]=d,p[24+e]=d,p[32+e]=d,p[40+e]=d,p[48+e]=d,p[56+e]=d)}for(g=0;g<64;++g){const e=128+(p[g]+8>>4);r[g]=e<0?0:e>255?255:e}}for(let e=0;e<i;e++){const i=e<<3;for(let e=0;e<8;e++)r.push(new Uint8Array(o));for(let o=0;o<n;o++){c(t.blocks[e][o],a,s);let n=0;const l=o<<3;for(let e=0;e<8;e++){const t=r[i+e];for(let e=0;e<8;e++)t[l+e]=a[n++]}}}return r}class R{constructor(){this.jfif=null,this.adobe=null,this.quantizationTables=[],this.huffmanTablesAC=[],this.huffmanTablesDC=[],this.resetFrames()}resetFrames(){this.frames=[]}parse(e){let t=0;function r(){const r=e[t]<<8|e[t+1];return t+=2,r}function n(){const n=r(),i=e.subarray(t,t+n-2);return t+=i.length,i}function i(e){let t,r,n=0,i=0;for(r in e.components)e.components.hasOwnProperty(r)&&(t=e.components[r],n<t.h&&(n=t.h),i<t.v&&(i=t.v));const o=Math.ceil(e.samplesPerLine/8/n),s=Math.ceil(e.scanLines/8/i);for(r in e.components)if(e.components.hasOwnProperty(r)){t=e.components[r];const a=Math.ceil(Math.ceil(e.samplesPerLine/8)*t.h/n),c=Math.ceil(Math.ceil(e.scanLines/8)*t.v/i),l=o*t.h,u=s*t.v,f=[];for(let e=0;e<u;e++){const e=[];for(let t=0;t<l;t++)e.push(new Int32Array(64));f.push(e)}t.blocksPerLine=a,t.blocksPerColumn=c,t.blocks=f}e.maxH=n,e.maxV=i,e.mcusPerLine=o,e.mcusPerColumn=s}let o=r();if(65496!==o)throw new Error("SOI not found");for(o=r();65497!==o;){switch(o){case 65280:break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:{const e=n();65504===o&&74===e[0]&&70===e[1]&&73===e[2]&&70===e[3]&&0===e[4]&&(this.jfif={version:{major:e[5],minor:e[6]},densityUnits:e[7],xDensity:e[8]<<8|e[9],yDensity:e[10]<<8|e[11],thumbWidth:e[12],thumbHeight:e[13],thumbData:e.subarray(14,14+3*e[12]*e[13])}),65518===o&&65===e[0]&&100===e[1]&&111===e[2]&&98===e[3]&&101===e[4]&&0===e[5]&&(this.adobe={version:e[6],flags0:e[7]<<8|e[8],flags1:e[9]<<8|e[10],transformCode:e[11]});break}case 65499:{const n=r()+t-2;for(;t<n;){const n=e[t++],i=new Int32Array(64);if(n>>4==0)for(let r=0;r<64;r++){i[P[r]]=e[t++]}else{if(n>>4!=1)throw new Error("DQT: invalid table spec");for(let e=0;e<64;e++){i[P[e]]=r()}}this.quantizationTables[15&n]=i}break}case 65472:case 65473:case 65474:{r();const n={extended:65473===o,progressive:65474===o,precision:e[t++],scanLines:r(),samplesPerLine:r(),components:{},componentsOrder:[]},s=e[t++];let a;for(let r=0;r<s;r++){a=e[t];const r=e[t+1]>>4,i=15&e[t+1],o=e[t+2];n.componentsOrder.push(a),n.components[a]={h:r,v:i,quantizationIdx:o},t+=3}i(n),this.frames.push(n);break}case 65476:{const n=r();for(let r=2;r<n;){const n=e[t++],i=new Uint8Array(16);let o=0;for(let r=0;r<16;r++,t++)i[r]=e[t],o+=i[r];const s=new Uint8Array(o);for(let r=0;r<o;r++,t++)s[r]=e[t];r+=17+o,n>>4==0?this.huffmanTablesDC[15&n]=I(i,s):this.huffmanTablesAC[15&n]=I(i,s)}break}case 65501:r(),this.resetInterval=r();break;case 65498:{r();const n=e[t++],i=[],o=this.frames[0];for(let r=0;r<n;r++){const r=o.components[e[t++]],n=e[t++];r.huffmanTableDC=this.huffmanTablesDC[n>>4],r.huffmanTableAC=this.huffmanTablesAC[15&n],i.push(r)}const s=e[t++],a=e[t++],c=e[t++],l=D(e,t,o,i,this.resetInterval,s,a,c>>4,15&c);t+=l;break}case 65535:255!==e[t]&&t--;break;default:if(255===e[t-3]&&e[t-2]>=192&&e[t-2]<=254){t-=3;break}throw new Error("unknown JPEG marker "+o.toString(16))}o=r()}}getResult(){const{frames:e}=this;if(0===this.frames.length)throw new Error("no frames were decoded");this.frames.length>1&&console.warn("more than one frame is not supported");for(let e=0;e<this.frames.length;e++){const t=this.frames[e].components;for(const e of Object.keys(t))t[e].quantizationTable=this.quantizationTables[t[e].quantizationIdx],delete t[e].quantizationIdx}const t=e[0],{components:r,componentsOrder:n}=t,i=[],o=t.samplesPerLine,s=t.scanLines;for(let e=0;e<n.length;e++){const o=r[n[e]];i.push({lines:M(0,o),scaleX:o.h/t.maxH,scaleY:o.v/t.maxV})}const a=new Uint8Array(o*s*i.length);let c=0;for(let e=0;e<s;++e)for(let t=0;t<o;++t)for(let r=0;r<i.length;++r){const n=i[r];a[c]=n.lines[0|e*n.scaleY][0|t*n.scaleX],++c}return a}}class F extends E{constructor(e){super(),this.reader=new R,e.JPEGTables&&this.reader.parse(e.JPEGTables)}decodeBlock(e){return this.reader.resetFrames(),this.reader.parse(new Uint8Array(e)),this.reader.getResult().buffer}}var j=r(37);class L extends E{decodeBlock(e){return Object(j.inflate)(new Uint8Array(e)).buffer}}class U extends E{decodeBlock(e){const t=new DataView(e),r=[];for(let n=0;n<e.byteLength;++n){let e=t.getInt8(n);if(e<0){const i=t.getUint8(n+1);e=-e;for(let t=0;t<=e;++t)r.push(i);n+=1}else{for(let i=0;i<=e;++i)r.push(t.getUint8(n+i+1));n+=e+1}}return new Uint8Array(r).buffer}}function B(e){switch(e.Compression){case void 0:case 1:return new C;case 5:return new A;case 6:throw new Error("old style JPEG compression is not supported.");case 7:return new F(e);case 8:case 32946:return new L;case 32773:return new U;default:throw new Error("Unknown compression method identifier: "+e.Compression)}}function N(e,t,r,n=1){return new(Object.getPrototypeOf(e).constructor)(t*r*n)}function G(e,t,r){return(1-r)*e+r*t}function W(e,t,r,n,i,o="nearest"){switch(o.toLowerCase()){case"nearest":return function(e,t,r,n,i){const o=t/n,s=r/i;return e.map(e=>{const a=N(e,n,i);for(let c=0;c<i;++c){const i=Math.min(Math.round(s*c),r-1);for(let r=0;r<n;++r){const s=Math.min(Math.round(o*r),t-1),l=e[i*t+s];a[c*n+r]=l}}return a})}(e,t,r,n,i);case"bilinear":case"linear":return function(e,t,r,n,i){const o=t/n,s=r/i;return e.map(e=>{const a=N(e,n,i);for(let c=0;c<i;++c){const i=s*c,l=Math.floor(i),u=Math.min(Math.ceil(i),r-1);for(let r=0;r<n;++r){const s=o*r,f=s%1,h=Math.floor(s),d=Math.min(Math.ceil(s),t-1),p=e[l*t+h],g=e[l*t+d],m=e[u*t+h],b=e[u*t+d],y=G(G(p,g,f),G(m,b,f),i%1);a[c*n+r]=y}}return a})}(e,t,r,n,i);default:throw new Error(`Unsupported resampling method: '${o}'`)}}function q(e,t,r,n,i,o,s="nearest"){switch(s.toLowerCase()){case"nearest":return function(e,t,r,n,i,o){const s=t/n,a=r/i,c=N(e,n,i,o);for(let l=0;l<i;++l){const i=Math.min(Math.round(a*l),r-1);for(let r=0;r<n;++r){const a=Math.min(Math.round(s*r),t-1);for(let s=0;s<o;++s){const u=e[i*t*o+a*o+s];c[l*n*o+r*o+s]=u}}}return c}(e,t,r,n,i,o);case"bilinear":case"linear":return function(e,t,r,n,i,o){const s=t/n,a=r/i,c=N(e,n,i,o);for(let l=0;l<i;++l){const i=a*l,u=Math.floor(i),f=Math.min(Math.ceil(i),r-1);for(let r=0;r<n;++r){const a=s*r,h=a%1,d=Math.floor(a),p=Math.min(Math.ceil(a),t-1);for(let s=0;s<o;++s){const a=e[u*t*o+d*o+s],g=e[u*t*o+p*o+s],m=e[f*t*o+d*o+s],b=e[f*t*o+p*o+s],y=G(G(a,g,h),G(m,b,h),i%1);c[l*n*o+r*o+s]=y}}}return c}(e,t,r,n,i,o);default:throw new Error(`Unsupported resampling method: '${s}'`)}}function K(e,t,r){let n=0;for(let i=t;i<r;++i)n+=e[i];return n}function z(e,t,r){switch(e){case 1:switch(t){case 8:return new Uint8Array(r);case 16:return new Uint16Array(r);case 32:return new Uint32Array(r)}break;case 2:switch(t){case 8:return new Int8Array(r);case 16:return new Int16Array(r);case 32:return new Int32Array(r)}break;case 3:switch(t){case 32:return new Float32Array(r);case 64:return new Float64Array(r)}}throw Error("Unsupported data format/bitsPerSample")}var H=class{constructor(e,t,r,n,i,o){this.fileDirectory=e,this.geoKeys=t,this.dataView=r,this.littleEndian=n,this.tiles=i?{}:null,this.isTiled=!e.StripOffsets;const s=e.PlanarConfiguration;if(this.planarConfiguration=void 0===s?1:s,1!==this.planarConfiguration&&2!==this.planarConfiguration)throw new Error("Invalid planar configuration.");this.source=o}getFileDirectory(){return this.fileDirectory}getGeoKeys(){return this.geoKeys}getWidth(){return this.fileDirectory.ImageWidth}getHeight(){return this.fileDirectory.ImageLength}getSamplesPerPixel(){return this.fileDirectory.SamplesPerPixel}getTileWidth(){return this.isTiled?this.fileDirectory.TileWidth:this.getWidth()}getTileHeight(){return this.isTiled?this.fileDirectory.TileLength:void 0!==this.fileDirectory.RowsPerStrip?Math.min(this.fileDirectory.RowsPerStrip,this.getHeight()):this.getHeight()}getBytesPerPixel(){let e=0;for(let t=0;t<this.fileDirectory.BitsPerSample.length;++t){const r=this.fileDirectory.BitsPerSample[t];if(r%8!=0)throw new Error(`Sample bit-width of ${r} is not supported.`);if(r!==this.fileDirectory.BitsPerSample[0])throw new Error("Differing size of samples in a pixel are not supported.");e+=r}return e/8}getSampleByteSize(e){if(e>=this.fileDirectory.BitsPerSample.length)throw new RangeError(`Sample index ${e} is out of range.`);const t=this.fileDirectory.BitsPerSample[e];if(t%8!=0)throw new Error(`Sample bit-width of ${t} is not supported.`);return t/8}getReaderForSample(e){const t=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1,r=this.fileDirectory.BitsPerSample[e];switch(t){case 1:switch(r){case 8:return DataView.prototype.getUint8;case 16:return DataView.prototype.getUint16;case 32:return DataView.prototype.getUint32}break;case 2:switch(r){case 8:return DataView.prototype.getInt8;case 16:return DataView.prototype.getInt16;case 32:return DataView.prototype.getInt32}break;case 3:switch(r){case 32:return DataView.prototype.getFloat32;case 64:return DataView.prototype.getFloat64}}throw Error("Unsupported data format/bitsPerSample")}getArrayForSample(e,t){return z(this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1,this.fileDirectory.BitsPerSample[e],t)}async getTileOrStrip(e,t,r,n){const i=Math.ceil(this.getWidth()/this.getTileWidth()),o=Math.ceil(this.getHeight()/this.getTileHeight());let s;const{tiles:a}=this;let c,l;1===this.planarConfiguration?s=t*i+e:2===this.planarConfiguration&&(s=r*i*o+t*i+e),this.isTiled?(c=this.fileDirectory.TileOffsets[s],l=this.fileDirectory.TileByteCounts[s]):(c=this.fileDirectory.StripOffsets[s],l=this.fileDirectory.StripByteCounts[s]);const u=await this.source.fetch(c,l);let f;return null===a?f=n.decode(this.fileDirectory,u):a[s]||(f=n.decode(this.fileDirectory,u),a[s]=f),{x:e,y:t,sample:r,data:await f}}async _readRaster(e,t,r,n,i,o,s,a){const c=this.getTileWidth(),l=this.getTileHeight(),u=Math.max(Math.floor(e[0]/c),0),f=Math.min(Math.ceil(e[2]/c),Math.ceil(this.getWidth()/this.getTileWidth())),h=Math.max(Math.floor(e[1]/l),0),d=Math.min(Math.ceil(e[3]/l),Math.ceil(this.getHeight()/this.getTileHeight())),p=e[2]-e[0];let g=this.getBytesPerPixel();const m=[],b=[];for(let e=0;e<t.length;++e)1===this.planarConfiguration?m.push(K(this.fileDirectory.BitsPerSample,0,t[e])/8):m.push(0),b.push(this.getReaderForSample(t[e]));const y=[],{littleEndian:w}=this;for(let o=h;o<d;++o)for(let s=u;s<f;++s)for(let a=0;a<t.length;++a){const u=a,f=t[a];2===this.planarConfiguration&&(g=this.getSampleByteSize(f));const h=this.getTileOrStrip(s,o,f,i);y.push(h),h.then(i=>{const o=i.data,s=new DataView(o),a=i.y*l,f=i.x*c,h=(i.y+1)*l,d=(i.x+1)*c,y=b[u],v=Math.min(l,l-(h-e[3])),_=Math.min(c,c-(d-e[2]));for(let i=Math.max(0,e[1]-a);i<v;++i)for(let o=Math.max(0,e[0]-f);o<_;++o){const l=(i*c+o)*g,h=y.call(s,l+m[u],w);let d;n?(d=(i+a-e[1])*p*t.length+(o+f-e[0])*t.length+u,r[d]=h):(d=(i+a-e[1])*p+o+f-e[0],r[u][d]=h)}})}if(await Promise.all(y),o&&e[2]-e[0]!==o||s&&e[3]-e[1]!==s){let i;return i=n?q(r,e[2]-e[0],e[3]-e[1],o,s,t.length,a):W(r,e[2]-e[0],e[3]-e[1],o,s,a),i.width=o,i.height=s,i}return r.width=o||e[2]-e[0],r.height=s||e[3]-e[1],r}async readRasters({window:e,samples:t=[],interleave:r,pool:n=null,width:i,height:o,resampleMethod:s,fillValue:a}={}){const c=e||[0,0,this.getWidth(),this.getHeight()];if(c[0]>c[2]||c[1]>c[3])throw new Error("Invalid subsets");const l=(c[2]-c[0])*(c[3]-c[1]);if(t&&t.length){for(let e=0;e<t.length;++e)if(t[e]>=this.fileDirectory.SamplesPerPixel)return Promise.reject(new RangeError(`Invalid sample index '${t[e]}'.`))}else for(let e=0;e<this.fileDirectory.SamplesPerPixel;++e)t.push(e);let u;if(r){u=z(this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,Math.max.apply(null,this.fileDirectory.BitsPerSample),l*t.length),a&&u.fill(a)}else{u=[];for(let e=0;e<t.length;++e){const r=this.getArrayForSample(t[e],l);Array.isArray(a)&&e<a.length?r.fill(a[e]):a&&!Array.isArray(a)&&r.fill(a),u.push(r)}}const f=n||B(this.fileDirectory);return await this._readRaster(c,t,u,r,f,i,o,s)}async readRGB({window:e,pool:t=null,width:r,height:n,resampleMethod:i,enableAlpha:o=!1}={}){const s=e||[0,0,this.getWidth(),this.getHeight()];if(s[0]>s[2]||s[1]>s[3])throw new Error("Invalid subsets");const a=this.fileDirectory.PhotometricInterpretation;if(a===d.RGB){let i=[0,1,2];if(this.fileDirectory.ExtraSamples!==p.Unspecified&&o){i=[];for(let e=0;e<this.fileDirectory.BitsPerSample.length;e+=1)i.push(e)}return this.readRasters({window:e,interleave:!0,samples:i,pool:t,width:r,height:n})}let c;switch(a){case d.WhiteIsZero:case d.BlackIsZero:case d.Palette:c=[0];break;case d.CMYK:c=[0,1,2,3];break;case d.YCbCr:case d.CIELab:c=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const l={window:s,interleave:!0,samples:c,pool:t,width:r,height:n,resampleMethod:i},{fileDirectory:u}=this,f=await this.readRasters(l),h=2**this.fileDirectory.BitsPerSample[0];let g;switch(a){case d.WhiteIsZero:g=b(f,h);break;case d.BlackIsZero:g=y(f,h);break;case d.Palette:g=w(f,u.ColorMap);break;case d.CMYK:g=v(f);break;case d.YCbCr:g=_(f);break;case d.CIELab:g=k(f);break;default:throw new Error("Unsupported photometric interpretation.")}return g.width=f.width,g.height=f.height,g}getTiePoints(){if(!this.fileDirectory.ModelTiepoint)return[];const e=[];for(let t=0;t<this.fileDirectory.ModelTiepoint.length;t+=6)e.push({i:this.fileDirectory.ModelTiepoint[t],j:this.fileDirectory.ModelTiepoint[t+1],k:this.fileDirectory.ModelTiepoint[t+2],x:this.fileDirectory.ModelTiepoint[t+3],y:this.fileDirectory.ModelTiepoint[t+4],z:this.fileDirectory.ModelTiepoint[t+5]});return e}getGDALMetadata(e=null){const t={};if(!this.fileDirectory.GDAL_METADATA)return null;const r=this.fileDirectory.GDAL_METADATA,n=s()(r.substring(0,r.length-1));if(!n[0].tagName)throw new Error("Failed to parse GDAL metadata XML.");const i=n[0];if("GDALMetadata"!==i.tagName)throw new Error("Unexpected GDAL metadata XML tag.");let o=i.children.filter(e=>"Item"===e.tagName);e&&(o=o.filter(t=>Number(t.attributes.sample)===e));for(let e=0;e<o.length;++e){const r=o[e];t[r.attributes.name]=r.children[0]}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&&6===e.length)return[e[3],e[4],e[5]];if(t)return[t[3],t[7],t[11]];throw new Error("The image does not have an affine transformation.")}getResolution(e=null){const t=this.fileDirectory.ModelPixelScale,r=this.fileDirectory.ModelTransformation;if(t)return[t[0],-t[1],t[2]];if(r)return[r[0],r[5],r[10]];if(e){const[t,r,n]=e.getResolution();return[t*e.getWidth()/this.getWidth(),r*e.getHeight()/this.getHeight(),n*e.getWidth()/this.getWidth()]}throw new Error("The image does not have an affine transformation.")}pixelIsArea(){return 1===this.geoKeys.GTRasterTypeGeoKey}getBoundingBox(){const e=this.getOrigin(),t=this.getResolution(),r=e[0],n=e[1],i=r+t[0]*this.getWidth(),o=n+t[1]*this.getHeight();return[Math.min(r,i),Math.min(n,o),Math.max(r,i),Math.max(n,o)]}};class V{constructor(e){this._dataView=new DataView(e)}get buffer(){return this._dataView.buffer}getUint64(e,t){const r=this.getUint32(e,t),n=this.getUint32(e+4,t);let i;if(t){if(i=r+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*r+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}getInt64(e,t){let r=0;const n=(128&this._dataView.getUint8(e+(t?7:0)))>0;let i=!0;for(let o=0;o<8;o++){let s=this._dataView.getUint8(e+(t?o:7-o));n&&(i?0!==s&&(s=255&~(s-1),i=!1):s=255&~s),r+=s*256**o}return n&&(r=-r),r}getUint8(e,t){return this._dataView.getUint8(e,t)}getInt8(e,t){return this._dataView.getInt8(e,t)}getUint16(e,t){return this._dataView.getUint16(e,t)}getInt16(e,t){return this._dataView.getInt16(e,t)}getUint32(e,t){return this._dataView.getUint32(e,t)}getInt32(e,t){return this._dataView.getInt32(e,t)}getFloat32(e,t){return this._dataView.getFloat32(e,t)}getFloat64(e,t){return this._dataView.getFloat64(e,t)}}class Z{constructor(e,t,r,n){this._dataView=new DataView(e),this._sliceOffset=t,this._littleEndian=r,this._bigTiff=n}get sliceOffset(){return this._sliceOffset}get sliceTop(){return this._sliceOffset+this.buffer.byteLength}get littleEndian(){return this._littleEndian}get bigTiff(){return this._bigTiff}get buffer(){return this._dataView.buffer}covers(e,t){return this.sliceOffset<=e&&this.sliceTop>=e+t}readUint8(e){return this._dataView.getUint8(e-this._sliceOffset,this._littleEndian)}readInt8(e){return this._dataView.getInt8(e-this._sliceOffset,this._littleEndian)}readUint16(e){return this._dataView.getUint16(e-this._sliceOffset,this._littleEndian)}readInt16(e){return this._dataView.getInt16(e-this._sliceOffset,this._littleEndian)}readUint32(e){return this._dataView.getUint32(e-this._sliceOffset,this._littleEndian)}readInt32(e){return this._dataView.getInt32(e-this._sliceOffset,this._littleEndian)}readFloat32(e){return this._dataView.getFloat32(e-this._sliceOffset,this._littleEndian)}readFloat64(e){return this._dataView.getFloat64(e-this._sliceOffset,this._littleEndian)}readUint64(e){const t=this.readUint32(e),r=this.readUint32(e+4);let n;if(this._littleEndian){if(n=t+2**32*r,!Number.isSafeInteger(n))throw new Error(n+" exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues");return n}if(n=2**32*t+r,!Number.isSafeInteger(n))throw new Error(n+" exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues");return n}readInt64(e){let t=0;const r=(128&this._dataView.getUint8(e+(this._littleEndian?7:0)))>0;let n=!0;for(let i=0;i<8;i++){let o=this._dataView.getUint8(e+(this._littleEndian?i:7-i));r&&(n?0!==o&&(o=255&~(o-1),n=!1):o=255&~o),t+=o*256**i}return r&&(t=-t),t}readOffset(e){return this._bigTiff?this.readUint64(e):this.readUint32(e)}}var $=r(32),Y=r(15),Q=r(16),X=r(9),J=r.n(X),ee=r(20),te=r.n(ee),re=r(2),ne=r.n(re);class ie{constructor(e,{blockSize:t=65536}={}){this.retrievalFunction=e,this.blockSize=t,this.blockRequests=new Map,this.blocks=new Map,this.blockIdsAwaitingRequest=null}async fetch(e,t,r=!1){const n=e+t,i=[],o=[],s=[];for(let t=Math.floor(e/this.blockSize)*this.blockSize;t<n;t+=this.blockSize){const e=Math.floor(t/this.blockSize);this.blocks.has(e)||this.blockRequests.has(e)||o.push(e),this.blockRequests.has(e)&&s.push(this.blockRequests.get(e)),i.push(e)}if(this.blockIdsAwaitingRequest)for(let e=0;e<o.length;++e){const t=o[e];this.blockIdsAwaitingRequest.add(t)}else this.blockIdsAwaitingRequest=new Set(o);if(r||await async function(e){return new Promise(t=>setTimeout(t,e))}(),this.blockIdsAwaitingRequest){const e=function(e){if(0===e.length)return[];const t=[];let r=[];t.push(r);for(let n=0;n<e.length;++n)0===n||e[n]===e[n-1]+1?r.push(e[n]):(r=[e[n]],t.push(r));return t}(Array.from(this.blockIdsAwaitingRequest).sort());for(const t of e){const e=this.requestData(t[0]*this.blockSize,t.length*this.blockSize);for(let r=0;r<t.length;++r){const n=t[r];this.blockRequests.set(n,(async()=>{const t=await e,i=r*this.blockSize,o=Math.min(i+this.blockSize,t.data.byteLength),s=t.data.slice(i,o);this.blockRequests.delete(n),this.blocks.set(n,{data:s,offset:t.offset+i,length:s.byteLength,top:t.offset+o})})())}}this.blockIdsAwaitingRequest=null}const a=[];for(const e of o)this.blockRequests.has(e)&&a.push(this.blockRequests.get(e));await Promise.all(a),await Promise.all(s);return function(e,t,r){const n=t+r,i=new ArrayBuffer(r),o=new Uint8Array(i);for(const r of e){const e=r.offset-t,i=r.top-n;let s,a=0,c=0;e<0?a=-e:e>0&&(c=e),s=i<0?r.length-a:n-r.offset-a;const l=new Uint8Array(r.data,a,s);o.set(l,c)}return i}(i.map(e=>this.blocks.get(e)),e,t)}async requestData(e,t){const r=await this.retrievalFunction(e,t);return r.length?r.length!==r.data.byteLength&&(r.data=r.data.slice(0,r.length)):r.length=r.data.byteLength,r.top=r.offset+r.length,r}}function oe(e,t){const{forceXHR:r}=t;if("function"==typeof fetch&&!r)return function(e,{headers:t={},blockSize:r}={}){return new ie(async(r,n)=>{const i=await fetch(e,{headers:{...t,Range:`bytes=${r}-${r+n-1}`}});if(i.ok){if(206===i.status){return{data:i.arrayBuffer?await i.arrayBuffer():(await i.buffer()).buffer,offset:r,length:n}}{const e=i.arrayBuffer?await i.arrayBuffer():(await i.buffer()).buffer;return{data:e,offset:0,length:e.byteLength}}}throw new Error("Error fetching data.")},{blockSize:r})}(e,t);if("undefined"!=typeof XMLHttpRequest)return function(e,{headers:t={},blockSize:r}={}){return new ie(async(r,n)=>new Promise((i,o)=>{const s=new XMLHttpRequest;s.open("GET",e),s.responseType="arraybuffer";const a={...t,Range:`bytes=${r}-${r+n-1}`};for(const[e,t]of Object.entries(a))s.setRequestHeader(e,t);s.onload=()=>{const e=s.response;206===s.status?i({data:e,offset:r,length:n}):i({data:e,offset:0,length:e.byteLength})},s.onerror=o,s.send()}),{blockSize:r})}(e,t);if(J.a.get)return function(e,{headers:t={},blockSize:r}={}){return new ie(async(r,n)=>new Promise((i,o)=>{const s=ne.a.parse(e);("http:"===s.protocol?J.a:te.a).get({...s,headers:{...t,Range:`bytes=${r}-${r+n-1}`}},e=>{const t=[];e.on("data",e=>{t.push(e)}),e.on("end",()=>{const e=Y.Buffer.concat(t).buffer;i({data:e,offset:r,length:e.byteLength})})}).on("error",o)}),{blockSize:r})}(e,t);throw new Error("No remote source available")}function se(e){const t=function(e,t,r){return new Promise((n,i)=>{Object(Q.open)(e,t,r,(e,t)=>{e?i(e):n(t)})})}(e,"r");return{async fetch(e,r){const n=await t,{buffer:i}=await function(...e){return new Promise((t,r)=>{Object(Q.read)(...e,(e,n,i)=>{e?r(e):t({bytesRead:n,buffer:i})})})}(n,Y.Buffer.alloc(r),0,r,e);return i.buffer},async close(){const e=await t;return await function(e){return new Promise((t,r)=>{Object(Q.close)(e,e=>{e?r(e):t()})})}(e)}}}function ae(e,t){for(const r in t)t.hasOwnProperty(r)&&(e[r]=t[r])}function ce(e,t){if(e.length<t.length)return!1;return e.substr(e.length-t.length)===t}function le(e){const t={};for(const r in e)if(e.hasOwnProperty(r)){t[e[r]]=r}return t}function ue(e,t){const r=[];for(let n=0;n<e;n++)r.push(t(n));return r}const fe=le(a),he=le(g),de={};ae(de,fe),ae(de,he);const pe=le(f),ge={nextZero:(e,t)=>{let r=t;for(;0!==e[r];)r++;return r},readUshort:(e,t)=>e[t]<<8|e[t+1],readShort:(e,t)=>{const r=ge.ui8;return r[0]=e[t+1],r[1]=e[t+0],ge.i16[0]},readInt:(e,t)=>{const r=ge.ui8;return r[0]=e[t+3],r[1]=e[t+2],r[2]=e[t+1],r[3]=e[t+0],ge.i32[0]},readUint:(e,t)=>{const r=ge.ui8;return r[0]=e[t+3],r[1]=e[t+2],r[2]=e[t+1],r[3]=e[t+0],ge.ui32[0]},readASCII:(e,t,r)=>r.map(r=>String.fromCharCode(e[t+r])).join(""),readFloat:(e,t)=>{const r=ge.ui8;return ue(4,n=>{r[n]=e[t+3-n]}),ge.fl32[0]},readDouble:(e,t)=>{const r=ge.ui8;return ue(8,n=>{r[n]=e[t+7-n]}),ge.fl64[0]},writeUshort:(e,t,r)=>{e[t]=r>>8&255,e[t+1]=255&r},writeUint:(e,t,r)=>{e[t]=r>>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=r>>0&255},writeASCII:(e,t,r)=>{ue(r.length,n=>{e[t+n]=r.charCodeAt(n)})},ui8:new Uint8Array(8)};ge.fl64=new Float64Array(ge.ui8.buffer),ge.writeDouble=(e,t,r)=>{ge.fl64[0]=r,ue(8,r=>{e[t+r]=ge.ui8[7-r]})};const me=e=>{const t=new Uint8Array(1e3);let r=4;const n=ge;t[0]=77,t[1]=77,t[3]=42;let i=8;if(n.writeUint(t,r,i),r+=4,e.forEach((r,o)=>{const s=((e,t,r,n)=>{let i=r;const o=Object.keys(n).filter(e=>null!=e&&"undefined"!==e);e.writeUshort(t,i,o.length),i+=2;let s=i+12*o.length+4;for(const r of o){let o=null;"number"==typeof r?o=r:"string"==typeof r&&(o=parseInt(r,10));const a=l[o],c=pe[a];if(null==a||void 0===a||void 0===a)throw new Error("unknown type of tag: "+o);let u=n[r];if(void 0===u)throw new Error("failed to get value for key "+r);"ASCII"===a&&"string"==typeof u&&!1===ce(u,"\0")&&(u+="\0");const f=u.length;e.writeUshort(t,i,o),i+=2,e.writeUshort(t,i,c),i+=2,e.writeUint(t,i,f),i+=4;let h=[-1,1,1,2,4,8,0,0,0,0,0,0,8][c]*f,d=i;h>4&&(e.writeUint(t,i,s),d=s),"ASCII"===a?e.writeASCII(t,d,u):"SHORT"===a?ue(f,r=>{e.writeUshort(t,d+2*r,u[r])}):"LONG"===a?ue(f,r=>{e.writeUint(t,d+4*r,u[r])}):"RATIONAL"===a?ue(f,r=>{e.writeUint(t,d+8*r,Math.round(1e4*u[r])),e.writeUint(t,d+8*r+4,1e4)}):"DOUBLE"===a&&ue(f,r=>{e.writeDouble(t,d+8*r,u[r])}),h>4&&(h+=1&h,s+=h),i+=4}return[i,s]})(n,t,i,r);i=s[1],o<e.length-1&&n.writeUint(t,s[0],i)}),t.slice)return t.slice(0,i).buffer;const o=new Uint8Array(i);for(let e=0;e<i;e++)o[e]=t[e];return o.buffer},be=[["Compression",1],["PlanarConfiguration",1],["XPosition",0],["YPosition",0],["ResolutionUnit",1],["ExtraSamples",0],["GeoAsciiParams","WGS 84\0"],["ModelTiepoint",[0,0,0,-180,90,0]],["GTModelTypeGeoKey",2],["GTRasterTypeGeoKey",1],["GeographicTypeGeoKey",4326],["GeogCitationGeoKey","WGS 84"]];function ye(e,t){let r,n,i,o;"number"==typeof e[0]?(r=t.height||t.ImageLength,i=t.width||t.ImageWidth,n=e.length/(r*i),o=e):(n=e.length,r=e[0].length,i=e[0][0].length,o=[],ue(r,t=>{ue(i,r=>{ue(n,n=>{o.push(e[n][t][r])})})})),t.ImageLength=r,delete t.height,t.ImageWidth=i,delete t.width,t.BitsPerSample||(t.BitsPerSample=ue(n,()=>8)),be.forEach(e=>{const r=e[0];if(!t[r]){const n=e[1];t[r]=n}}),t.PhotometricInterpretation||(t.PhotometricInterpretation=3===t.BitsPerSample.length?2:1),t.SamplesPerPixel||(t.SamplesPerPixel=[n]),t.StripByteCounts||(t.StripByteCounts=[n*r*i]),t.ModelPixelScale||(t.ModelPixelScale=[360/i,180/r,0]),t.SampleFormat||(t.SampleFormat=ue(n,()=>1));const s=Object.keys(t).filter(e=>ce(e,"GeoKey")).sort((e,t)=>de[e]-de[t]);if(!t.GeoKeyDirectory){const e=[1,1,0,s.length];s.forEach(r=>{const n=Number(de[r]);let i,o,s;e.push(n),"SHORT"===l[n]?(i=1,o=0,s=t[r]):"GeogCitationGeoKey"===r?(i=t.GeoAsciiParams.length,o=Number(de.GeoAsciiParams),s=0):console.log("[geotiff.js] couldn't get TIFFTagLocation for "+r),e.push(o),e.push(i),e.push(s)}),t.GeoKeyDirectory=e}for(const e in s)s.hasOwnProperty(e)&&delete t[e];["Compression","ExtraSamples","GeographicTypeGeoKey","GTModelTypeGeoKey","GTRasterTypeGeoKey","ImageLength","ImageWidth","PhotometricInterpretation","PlanarConfiguration","ResolutionUnit","SamplesPerPixel","XPosition","YPosition"].forEach(e=>{var r;t[e]&&(t[e]=(r=t[e],Array.isArray(r)?r:[r]))});const a=(e=>{const t={};for(const r in e)"StripOffsets"!==r&&(de[r]||console.error(r,"not in name2code:",Object.keys(de)),t[de[r]]=e[r]);return t})(t);return((e,t,r,n)=>{if(null==r)throw new Error("you passed into encodeImage a width of type "+r);if(null==t)throw new Error("you passed into encodeImage a width of type "+t);const i={256:[t],257:[r],273:[1e3],278:[r],305:"geotiff.js"};if(n)for(const e in n)n.hasOwnProperty(e)&&(i[e]=n[e]);const o=new Uint8Array(me([i])),s=new Uint8Array(e),a=i[277],c=new Uint8Array(1e3+t*r*a);return ue(o.length,e=>{c[e]=o[e]}),function(e,t){const{length:r}=e;for(let n=0;n<r;n++)t(e[n],n)}(s,(e,t)=>{c[1e3+t]=e}),c.buffer})(o,i,r,a)}class we{log(){}info(){}warn(){}error(){}time(){}timeEnd(){}}let ve=new we;function _e(e=new we){ve=e}function ke(e){switch(e){case h.BYTE:case h.ASCII:case h.SBYTE:case h.UNDEFINED:return 1;case h.SHORT:case h.SSHORT:return 2;case h.LONG:case h.SLONG:case h.FLOAT:case h.IFD:return 4;case h.RATIONAL:case h.SRATIONAL:case h.DOUBLE:case h.LONG8:case h.SLONG8:case h.IFD8:return 8;default:throw new RangeError("Invalid field type: "+e)}}function Se(e,t,r,n){let i=null,o=null;const s=ke(t);switch(t){case h.BYTE:case h.ASCII:case h.UNDEFINED:i=new Uint8Array(r),o=e.readUint8;break;case h.SBYTE:i=new Int8Array(r),o=e.readInt8;break;case h.SHORT:i=new Uint16Array(r),o=e.readUint16;break;case h.SSHORT:i=new Int16Array(r),o=e.readInt16;break;case h.LONG:case h.IFD:i=new Uint32Array(r),o=e.readUint32;break;case h.SLONG:i=new Int32Array(r),o=e.readInt32;break;case h.LONG8:case h.IFD8:i=new Array(r),o=e.readUint64;break;case h.SLONG8:i=new Array(r),o=e.readInt64;break;case h.RATIONAL:i=new Uint32Array(2*r),o=e.readUint32;break;case h.SRATIONAL:i=new Int32Array(2*r),o=e.readInt32;break;case h.FLOAT:i=new Float32Array(r),o=e.readFloat32;break;case h.DOUBLE:i=new Float64Array(r),o=e.readFloat64;break;default:throw new RangeError("Invalid field type: "+t)}if(t!==h.RATIONAL&&t!==h.SRATIONAL)for(let t=0;t<r;++t)i[t]=o.call(e,n+t*s);else for(let t=0;t<r;t+=2)i[t]=o.call(e,n+t*s),i[t+1]=o.call(e,n+(t*s+4));return t===h.ASCII?String.fromCharCode.apply(null,i):i}class xe{constructor(e,t,r){this.fileDirectory=e,this.geoKeyDirectory=t,this.nextIFDByteOffset=r}}class Ee extends Error{constructor(e){super("No image at index "+e),this.index=e}}class Ce{async readRasters(e={}){const{window:t,width:r,height:n}=e;let{resX:i,resY:o,bbox:s}=e;const a=await this.getImage();let c=a;const l=await this.getImageCount(),u=a.getBoundingBox();if(t&&s)throw new Error('Both "bbox" and "window" passed.');if(r||n){if(t){const[e,r]=a.getOrigin(),[n,i]=a.getResolution();s=[e+t[0]*n,r+t[1]*i,e+t[2]*n,r+t[3]*i]}const e=s||u;if(r){if(i)throw new Error("Both width and resX passed");i=(e[2]-e[0])/r}if(n){if(o)throw new Error("Both width and resY passed");o=(e[3]-e[1])/n}}if(i||o){const e=[];for(let t=0;t<l;++t){const r=await this.getImage(t),{SubfileType:n,NewSubfileType:i}=r.fileDirectory;(0===t||2===n||1&i)&&e.push(r)}e.sort((e,t)=>e.getWidth()-t.getWidth());for(let t=0;t<e.length;++t){const r=e[t],n=(u[2]-u[0])/r.getWidth(),s=(u[3]-u[1])/r.getHeight();if(c=r,i&&i>n||o&&o>s)break}}let f=t;if(s){const[e,t]=a.getOrigin(),[r,n]=c.getResolution(a);f=[Math.round((s[0]-e)/r),Math.round((s[1]-t)/n),Math.round((s[2]-e)/r),Math.round((s[3]-t)/n)],f=[Math.min(f[0],f[2]),Math.min(f[1],f[3]),Math.max(f[0],f[2]),Math.max(f[1],f[3])]}return c.readRasters({...e,window:f})}}class Te extends Ce{constructor(e,t,r,n,i={}){super(),this.source=e,this.littleEndian=t,this.bigTiff=r,this.firstIFDOffset=n,this.cache=i.cache||!1,this.ifdRequests=[],this.ghostValues=null}async getSlice(e,t){const r=this.bigTiff?4048:1024;return new Z(await this.source.fetch(e,void 0!==t?t:r),e,this.littleEndian,this.bigTiff)}async parseFileDirectoryAt(e){const t=this.bigTiff?20:12,r=this.bigTiff?8:2;let n=await this.getSlice(e);const i=this.bigTiff?n.readUint64(e):n.readUint16(e),o=i*t+(this.bigTiff?16:6);n.covers(e,o)||(n=await this.getSlice(e,o));const s={};let c=e+(this.bigTiff?8:2);for(let e=0;e<i;c+=t,++e){const e=n.readUint16(c),t=n.readUint16(c+2),r=this.bigTiff?n.readUint64(c+4):n.readUint32(c+4);let i,o;const l=ke(t),f=c+(this.bigTiff?12:8);if(l*r<=(this.bigTiff?8:4))i=Se(n,t,r,f);else{const e=n.readOffset(f),o=ke(t)*r;if(n.covers(e,o))i=Se(n,t,r,e);else{i=Se(await this.getSlice(e,o),t,r,e)}}o=1===r&&-1===u.indexOf(e)&&t!==h.RATIONAL&&t!==h.SRATIONAL?i[0]:i,s[a[e]]=o}const l=function(e){const t=e.GeoKeyDirectory;if(!t)return null;const r={};for(let n=4;n<=4*t[3];n+=4){const i=g[t[n]],o=t[n+1]?a[t[n+1]]:null,s=t[n+2],c=t[n+3];let l=null;if(o){if(l=e[o],null==l)throw new Error(`Could not get value of geoKey '${i}'.`);"string"==typeof l?l=l.substring(c,c+s-1):l.subarray&&(l=l.subarray(c,c+s),1===s&&(l=l[0]))}else l=c;r[i]=l}return r}(s),f=n.readOffset(e+r+t*i);return new xe(s,l,f)}async requestIFD(e){if(this.ifdRequests[e])return this.ifdRequests[e];if(0===e)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){if(t instanceof Ee)throw new Ee(e);throw t}return this.ifdRequests[e]=(async()=>{const t=await this.ifdRequests[e-1];if(0===t.nextIFDByteOffset)throw new Ee(e);return this.parseFileDirectoryAt(t.nextIFDByteOffset)})(),this.ifdRequests[e]}async getImage(e=0){const t=await this.requestIFD(e);return new H(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(e){if(!(e instanceof Ee))throw e;t=!1}return e}async getGhostValues(){const e=this.bigTiff?16:8;if(this.ghostValues)return this.ghostValues;const t="GDAL_STRUCTURAL_METADATA_SIZE=",r=t.length+100;let n=await this.getSlice(e,r);if(t===Se(n,h.ASCII,t.length,e)){const t=Se(n,h.ASCII,r,e).split("\n")[0],i=Number(t.split("=")[1].split(" ")[0])+t.length;i>r&&(n=await this.getSlice(e,i));const o=Se(n,h.ASCII,i,e);this.ghostValues={},o.split("\n").filter(e=>e.length>0).map(e=>e.split("=")).forEach(([e,t])=>{this.ghostValues[e]=t})}return this.ghostValues}static async fromSource(e,t){const r=await e.fetch(0,1024),n=new V(r),i=n.getUint16(0,0);let o;if(18761===i)o=!0;else{if(19789!==i)throw new TypeError("Invalid byte order value.");o=!1}const s=n.getUint16(2,o);let a;if(42===s)a=!1;else{if(43!==s)throw new TypeError("Invalid magic number.");a=!0;if(8!==n.getUint16(4,o))throw new Error("Unsupported offset byte-size.")}const c=a?n.getUint64(8,o):n.getUint32(4,o);return new Te(e,o,a,c,t)}close(){return"function"==typeof this.source.close&&this.source.close()}}t.default=Te;class Oe extends Ce{constructor(e,t){super(),this.mainFile=e,this.overviewFiles=t,this.imageFiles=[e].concat(t),this.fileDirectoriesPerFile=null,this.fileDirectoriesPerFileParsing=null,this.imageCount=null}async parseFileDirectoriesPerFile(){const e=[this.mainFile.parseFileDirectoryAt(this.mainFile.firstIFDOffset)].concat(this.overviewFiles.map(e=>e.parseFileDirectoryAt(e.firstIFDOffset)));return this.fileDirectoriesPerFile=await Promise.all(e),this.fileDirectoriesPerFile}async getImage(e=0){await this.getImageCount(),await this.parseFileDirectoriesPerFile();let t=0,r=0;for(let n=0;n<this.imageFiles.length;n++){const i=this.imageFiles[n];for(let o=0;o<this.imageCounts[n];o++){if(e===t){const e=await i.requestIFD(r);return new H(e.fileDirectory,i.geoKeyDirectory,i.dataView,i.littleEndian,i.cache,i.source)}t++,r++}r=0}throw new RangeError("Invalid image index")}async getImageCount(){if(null!==this.imageCount)return this.imageCount;const e=[this.mainFile.getImageCount()].concat(this.overviewFiles.map(e=>e.getImageCount()));return this.imageCounts=await Promise.all(e),this.imageCount=this.imageCounts.reduce((e,t)=>e+t,0),this.imageCount}}async function Ae(e,t={}){return Te.fromSource(oe(e,t))}async function Pe(e){return Te.fromSource(function(e){return{fetch:async(t,r)=>e.slice(t,t+r)}}(e))}async function Ie(e){return Te.fromSource(se(e))}async function De(e){return Te.fromSource((t=e,{fetch:async(e,r)=>new Promise((n,i)=>{const o=t.slice(e,e+r),s=new FileReader;s.onload=e=>n(e.target.result),s.onerror=i,s.readAsArrayBuffer(o)})}));var t}async function Me(e,t=[],r={}){const n=await Te.fromSource(oe(e,r)),i=await Promise.all(t.map(e=>Te.fromSource(oe(e,r))));return new Oe(n,i)}async function Re(e,t){return ye(e,t)}},function(e,t,r){function n(e,t){"use strict";var r=(t=t||{}).pos||0,i="<".charCodeAt(0),o=">".charCodeAt(0),s="-".charCodeAt(0),a="/".charCodeAt(0),c="!".charCodeAt(0),l="'".charCodeAt(0),u='"'.charCodeAt(0);function f(){for(var t=[];e[r];)if(e.charCodeAt(r)==i){if(e.charCodeAt(r+1)===a)return(r=e.indexOf(">",r))+1&&(r+=1),t;if(e.charCodeAt(r+1)===c){if(e.charCodeAt(r+2)==s){for(;-1!==r&&(e.charCodeAt(r)!==o||e.charCodeAt(r-1)!=s||e.charCodeAt(r-2)!=s||-1==r);)r=e.indexOf(">",r+1);-1===r&&(r=e.length)}else for(r+=2;e.charCodeAt(r)!==o&&e[r];)r++;r++;continue}var n=g();t.push(n)}else{var l=h();l.trim().length>0&&t.push(l),r++}return t}function h(){var t=r;return-2===(r=e.indexOf("<",r)-1)&&(r=e.length),e.slice(t,r+1)}function d(){for(var t=r;-1==="\n\t>/= ".indexOf(e[r])&&e[r];)r++;return e.slice(t,r)}var p=t.noChildNodes||["img","br","input","meta","link"];function g(){r++;const t=d(),n={};let i=[];for(;e.charCodeAt(r)!==o&&e[r];){var s=e.charCodeAt(r);if(s>64&&s<91||s>96&&s<123){for(var c=d(),h=e.charCodeAt(r);h&&h!==l&&h!==u&&!(h>64&&h<91||h>96&&h<123)&&h!==o;)r++,h=e.charCodeAt(r);if(h===l||h===u){var g=m();if(-1===r)return{tagName:t,attributes:n,children:i}}else g=null,r--;n[c]=g}r++}if(e.charCodeAt(r-1)!==a)if("script"==t){var b=r+1;r=e.indexOf("<\/script>",r),i=[e.slice(b,r-1)],r+=9}else if("style"==t){b=r+1;r=e.indexOf("</style>",r),i=[e.slice(b,r-1)],r+=8}else-1==p.indexOf(t)&&(r++,i=f());else r++;return{tagName:t,attributes:n,children:i}}function m(){var t=e[r],n=++r;return r=e.indexOf(t,n),e.slice(n,r)}var b,y=null;if(void 0!==t.attrValue){t.attrName=t.attrName||"id";for(y=[];-1!==(b=void 0,b=new RegExp("\\s"+t.attrName+"\\s*=['\"]"+t.attrValue+"['\"]").exec(e),r=b?b.index:-1);)-1!==(r=e.lastIndexOf("<",r))&&y.push(g()),e=e.substr(r),r=0}else y=t.parseNode?g():f();return t.filter&&(y=n.filter(y,t.filter)),t.setPos&&(y.pos=r),y}n.simplify=function(e){var t={};if(!e.length)return"";if(1===e.length&&"string"==typeof e[0])return e[0];for(var r in e.forEach((function(e){if("object"==typeof e){t[e.tagName]||(t[e.tagName]=[]);var r=n.simplify(e.children||[]);t[e.tagName].push(r),e.attributes&&(r._attributes=e.attributes)}})),t)1==t[r].length&&(t[r]=t[r][0]);return t},n.filter=function(e,t){var r=[];return e.forEach((function(e){if("object"==typeof e&&t(e)&&r.push(e),e.children){var i=n.filter(e.children,t);r=r.concat(i)}})),r},n.stringify=function(e){var t="";function r(e){if(e)for(var r=0;r<e.length;r++)"string"==typeof e[r]?t+=e[r].trim():n(e[r])}function n(e){for(var n in t+="<"+e.tagName,e.attributes)null===e.attributes[n]?t+=" "+n:-1===e.attributes[n].indexOf('"')?t+=" "+n+'="'+e.attributes[n].trim()+'"':t+=" "+n+"='"+e.attributes[n].trim()+"'";t+=">",r(e.children),t+="</"+e.tagName+">"}return r(e),t},n.toContentString=function(e){if(Array.isArray(e)){var t="";return e.forEach((function(e){t=(t+=" "+n.toContentString(e)).trim()})),t}return"object"==typeof e?n.toContentString(e.children):" "+e},n.getElementById=function(e,t,r){var i=n(e,{attrValue:t});return r?n.simplify(i):i[0]},n.getElementsByClassName=function(e,t,r){const i=n(e,{attrName:"class",attrValue:"[a-zA-Z0-9-s ]*"+t+"[a-zA-Z0-9-s ]*"});return r?n.simplify(i):i},n.parseStream=function(e,t){if("string"==typeof t&&(t=t.length+2),"string"==typeof e){var i=r(16);e=i.createReadStream(e,{start:t}),t=0}var o=t,s="";return e.on("data",(function(t){s+=t;for(var r=0;;){if(!(o=s.indexOf("<",o)+1))return void(o=r);if("/"!==s[o+1]){var i=n(s,{pos:o-1,parseNode:!0,setPos:!0});if((o=i.pos)>s.length-1||o<r)return s=s.slice(r),o=0,void(r=0);e.emit("xml",i),r=o}else o+=1,r=pos}})),e.on("end",(function(){console.log("end")})),e},n.transformStream=function(e){const t=r(49);"string"==typeof e&&(e=e.length+2);var i=e||0,o="";return t({readableObjectMode:!0},(function(e,t,r){o+=e;for(var s=0;;){if(!(i=o.indexOf("<",i)+1))return i=s,r();if("/"!==o[i+1]){var a=n(o,{pos:i-1,parseNode:!0,setPos:!0});if((i=a.pos)>o.length-1||i<s)return o=o.slice(s),i=0,s=0,r();this.push(a),s=i}else i+=1,s=pos}r()}))},e.exports=n,n.xml=n},function(e,t,r){"use strict";var n=r(56),i=r(19),o=r(61),s=r(62),a=r(63),c=r(64),l=r(65),u=Object.prototype.toString;function f(e){if(!(this instanceof f))return new f(e);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var r=n.inflateInit2(this.strm,t.windowBits);if(r!==s.Z_OK)throw new Error(a[r]);if(this.header=new l,n.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=o.string2buf(t.dictionary):"[object ArrayBuffer]"===u.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=n.inflateSetDictionary(this.strm,t.dictionary))!==s.Z_OK))throw new Error(a[r])}function h(e,t){var r=new f(t);if(r.push(e,!0),r.err)throw r.msg||a[r.err];return r.result}f.prototype.push=function(e,t){var r,a,c,l,f,h=this.strm,d=this.options.chunkSize,p=this.options.dictionary,g=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?s.Z_FINISH:s.Z_NO_FLUSH,"string"==typeof e?h.input=o.binstring2buf(e):"[object ArrayBuffer]"===u.call(e)?h.input=new Uint8Array(e):h.input=e,h.next_in=0,h.avail_in=h.input.length;do{if(0===h.avail_out&&(h.output=new i.Buf8(d),h.next_out=0,h.avail_out=d),(r=n.inflate(h,s.Z_NO_FLUSH))===s.Z_NEED_DICT&&p&&(r=n.inflateSetDictionary(this.strm,p)),r===s.Z_BUF_ERROR&&!0===g&&(r=s.Z_OK,g=!1),r!==s.Z_STREAM_END&&r!==s.Z_OK)return this.onEnd(r),this.ended=!0,!1;h.next_out&&(0!==h.avail_out&&r!==s.Z_STREAM_END&&(0!==h.avail_in||a!==s.Z_FINISH&&a!==s.Z_SYNC_FLUSH)||("string"===this.options.to?(c=o.utf8border(h.output,h.next_out),l=h.next_out-c,f=o.buf2string(h.output,c),h.next_out=l,h.avail_out=d-l,l&&i.arraySet(h.output,h.output,c,l,0),this.onData(f)):this.onData(i.shrinkBuf(h.output,h.next_out)))),0===h.avail_in&&0===h.avail_out&&(g=!0)}while((h.avail_in>0||0===h.avail_out)&&r!==s.Z_STREAM_END);return r===s.Z_STREAM_END&&(a=s.Z_FINISH),a===s.Z_FINISH?(r=n.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===s.Z_OK):a!==s.Z_SYNC_FLUSH||(this.onEnd(s.Z_OK),h.avail_out=0,!0)},f.prototype.onData=function(e){this.chunks.push(e)},f.prototype.onEnd=function(e){e===s.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Inflate=f,t.inflate=h,t.inflateRaw=function(e,t){return(t=t||{}).raw=!0,h(e,t)},t.ungzip=h},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,"defaultPoolSize",(function(){return defaultPoolSize})),__webpack_require__.d(__webpack_exports__,"getWorkerImplementation",(function(){return getWorkerImplementation})),__webpack_require__.d(__webpack_exports__,"isWorkerRuntime",(function(){return isWorkerRuntime}));var callsites__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(39),callsites__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(callsites__WEBPACK_IMPORTED_MODULE_0__),events__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(23),events__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(events__WEBPACK_IMPORTED_MODULE_1__),os__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(40),os__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__.n(os__WEBPACK_IMPORTED_MODULE_2__),path__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(10),path__WEBPACK_IMPORTED_MODULE_3___default=__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__),url__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(2),url__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(url__WEBPACK_IMPORTED_MODULE_4__);let tsNodeAvailable;const defaultPoolSize=Object(os__WEBPACK_IMPORTED_MODULE_2__.cpus)().length;function detectTsNode(){if("function"==typeof require)return!1;if(tsNodeAvailable)return tsNodeAvailable;try{eval("require").resolve("ts-node"),tsNodeAvailable=!0}catch(e){if(!e||"MODULE_NOT_FOUND"!==e.code)throw e;tsNodeAvailable=!1}return tsNodeAvailable}function createTsNodeModule(e){return`\n require("ts-node/register/transpile-only");\n require(${JSON.stringify(e)});\n `}function rebaseScriptPath(e,t){const r=callsites__WEBPACK_IMPORTED_MODULE_0___default()().find(e=>{const r=e.getFileName();return Boolean(r&&!r.match(t)&&!r.match(/[\/\\]master[\/\\]implementation/)&&!r.match(/^internal\/process/))}),n=r?r.getFileName():null;let i=n||null;i&&i.startsWith("file:")&&(i=Object(url__WEBPACK_IMPORTED_MODULE_4__.fileURLToPath)(i));return i?path__WEBPACK_IMPORTED_MODULE_3__.join(path__WEBPACK_IMPORTED_MODULE_3__.dirname(i),e):e}function resolveScriptPath(scriptPath,baseURL){const makeRelative=filePath=>path__WEBPACK_IMPORTED_MODULE_3__.isAbsolute(filePath)?filePath:path__WEBPACK_IMPORTED_MODULE_3__.join(baseURL||eval("__dirname"),filePath),workerFilePath="function"==typeof require?require.resolve(makeRelative(scriptPath)):eval("require").resolve(makeRelative(rebaseScriptPath(scriptPath,/[\/\\]worker_threads[\/\\]/)));return workerFilePath}function initWorkerThreadsWorker(){const NativeWorker="function"==typeof require?require("worker_threads").Worker:eval("require")("worker_threads").Worker;let allWorkers=[];class Worker extends NativeWorker{constructor(e,t){const r=t&&t.fromSource?null:resolveScriptPath(e,(t||{})._baseURL);if(r)r.match(/\.tsx?$/i)&&detectTsNode()?super(createTsNodeModule(r),Object.assign(Object.assign({},t),{eval:!0})):r.match(/\.asar[\/\\]/)?super(r.replace(/\.asar([\/\\])/,".asar.unpacked$1"),t):super(r,t);else{super(e,Object.assign(Object.assign({},t),{eval:!0}))}this.mappedEventListeners=new WeakMap,allWorkers.push(this)}addEventListener(e,t){const r=e=>{t({data:e})};this.mappedEventListeners.set(t,r),this.on(e,r)}removeEventListener(e,t){const r=this.mappedEventListeners.get(t)||t;this.off(e,r)}}const terminateWorkersAndMaster=()=>{Promise.all(allWorkers.map(e=>e.terminate())).then(()=>process.exit(0),()=>process.exit(1)),allWorkers=[]};process.on("SIGINT",()=>terminateWorkersAndMaster()),process.on("SIGTERM",()=>terminateWorkersAndMaster());class BlobWorker extends Worker{constructor(e,t){super(Buffer.from(e).toString("utf-8"),Object.assign(Object.assign({},t),{fromSource:!0}))}static fromText(e,t){return new Worker(e,Object.assign(Object.assign({},t),{fromSource:!0}))}}return{blob:BlobWorker,default:Worker}}function initTinyWorker(){const e=__webpack_require__(67);let t=[];class r extends e{constructor(e,r){const n=r&&r.fromSource?null:"win32"===process.platform?"file:///"+resolveScriptPath(e).replace(/\\/g,"/"):resolveScriptPath(e);if(n)n.match(/\.tsx?$/i)&&detectTsNode()?super(new Function(createTsNodeModule(resolveScriptPath(e))),[],{esm:!0}):n.match(/\.asar[\/\\]/)?super(n.replace(/\.asar([\/\\])/,".asar.unpacked$1"),[],{esm:!0}):super(n,[],{esm:!0});else{super(new Function(e),[],{esm:!0})}t.push(this),this.emitter=new events__WEBPACK_IMPORTED_MODULE_1__.EventEmitter,this.onerror=e=>this.emitter.emit("error",e),this.onmessage=e=>this.emitter.emit("message",e)}addEventListener(e,t){this.emitter.addListener(e,t)}removeEventListener(e,t){this.emitter.removeListener(e,t)}terminate(){return t=t.filter(e=>e!==this),super.terminate()}}const n=()=>{Promise.all(t.map(e=>e.terminate())).then(()=>process.exit(0),()=>process.exit(1)),t=[]};process.on("SIGINT",()=>n()),process.on("SIGTERM",()=>n());return{blob:class extends r{constructor(e,t){super(Buffer.from(e).toString("utf-8"),Object.assign(Object.assign({},t),{fromSource:!0}))}static fromText(e,t){return new r(e,Object.assign(Object.assign({},t),{fromSource:!0}))}},default:r}}let implementation,isTinyWorker;function selectWorkerImplementation(){try{return isTinyWorker=!1,initWorkerThreadsWorker()}catch(e){return console.debug("Node worker_threads not available. Trying to fall back to tiny-worker polyfill..."),isTinyWorker=!0,initTinyWorker()}}function getWorkerImplementation(){return implementation||(implementation=selectWorkerImplementation()),implementation}function isWorkerRuntime(){if(isTinyWorker)return!("undefined"==typeof self||!self.postMessage);{const isMainThread="function"==typeof require?require("worker_threads").isMainThread:eval("require")("worker_threads").isMainThread;return!isMainThread}}},function(e,t,r){"use strict";const n=()=>{const e=Error.prepareStackTrace;Error.prepareStackTrace=(e,t)=>t;const t=(new Error).stack.slice(1);return Error.prepareStackTrace=e,t};e.exports=n,e.exports.default=n},function(e,t){e.exports=require("os")},function(e,t,r){"use strict";var n=r(21);class i extends n.a{constructor(){super(e=>(this._observers.add(e),()=>this._observers.delete(e))),this._observers=new Set}next(e){for(const t of this._observers)t.next(e)}error(e){for(const t of this._observers)t.error(e)}complete(){for(const e of this._observers)e.complete()}}t.a=i},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(1);function i(e){return e&&"object"==typeof e&&e[n.d]}},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=f(r(44)),s=f(r(46)),a=f(r(48)),c=r(34),l=r(35),u=f(r(75));function f(e){return e&&e.__esModule?e:{default:e}}function h(e,t){var r=t.left,n=t.top,i=t.right,o=t.bottom,s=t.width,a=t.height,l=t.resampleMethod;return e.readRasters({window:[r,n,i,o],width:s,height:a,resampleMethod:l||"bilinear"}).then((function(e){return e.map((function(e){return(0,c.unflatten)(e,{height:a,width:s})}))}))}var d=function(){function e(t,r,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),i&&console.log("starting GeoRaster.constructor with",t,r),this._web_worker_is_available="undefined"!=typeof window&&"undefined"!==window.Worker,this._blob_is_available="undefined"!=typeof Blob,this._url_is_available="undefined"!=typeof URL,"object"===(void 0===t?"undefined":n(t))&&t.constructor&&"Buffer"===t.constructor.name&&!1===Buffer.isBuffer(t)&&(t=new Buffer(t)),"string"==typeof t?(i&&console.log("data is a url"),this._data=t,this._url=t,this.rasterType="geotiff",this.sourceType="url"):"undefined"!=typeof Buffer&&Buffer.isBuffer(t)?(i&&console.log("data is a buffer"),this._data=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),this.rasterType="geotiff",this.sourceType="Buffer"):t instanceof ArrayBuffer?(this._data=t,this.rasterType="geotiff",this.sourceType="ArrayBuffer"):Array.isArray(t)&&r&&(this._data=t,this.rasterType="object",this._metadata=r),i&&console.log("this after construction:",this)}return i(e,[{key:"preinitialize",value:function(e){var t=this;if(e&&console.log("starting preinitialize"),this._url){var r=this._url+".ovr";return function(e){try{return(0,o.default)(e,{method:"HEAD"}).then((function(e){return 200===e.status})).catch((function(e){return!1}))}catch(e){return Promise.resolve(!1)}}(r).then((function(n){return e&&console.log("overview exists:",n),n?(0,l.fromUrls)(t._url,[r],{cache:!0,forceXHR:!1}):(0,l.fromUrl)(t._url,{cache:!0,forceXHR:!1})}))}return Promise.resolve()}},{key:"initialize",value:function(e){var t=this;return this.preinitialize(e).then((function(r){return new Promise((function(n,i){if(e&&console.log("starting GeoRaster.initialize"),e&&console.log("this",t),"object"===t.rasterType||"geotiff"===t.rasterType||"tiff"===t.rasterType)if(t._web_worker_is_available){var o=new s.default;o.onmessage=function(i){e&&console.log("main thread received message:",i);var o=i.data;for(var s in o)t[s]=o[s];t._url&&(t._geotiff=r,t.getValues=function(e){return h(this._geotiff,e)}),t.toCanvas=function(e){return(0,u.default)(this,e)},n(t)},e&&console.log("about to postMessage"),t._data instanceof ArrayBuffer?o.postMessage({data:t._data,rasterType:t.rasterType,sourceType:t.sourceType,metadata:t._metadata},[t._data]):o.postMessage({data:t._data,rasterType:t.rasterType,sourceType:t.sourceType,metadata:t._metadata})}else e&&console.log("web worker is not available"),(0,a.default)({data:t._data,rasterType:t.rasterType,sourceType:t.sourceType,metadata:t._metadata},e).then((function(i){e&&console.log("result:",i),t._url&&(i._geotiff=r,i.getValues=function(e){return h(this._geotiff,e)}),i.toCanvas=function(e){return(0,u.default)(this,e)},n(i)})).catch(i);else i("couldn't find a way to parse")}))}))}}]),e}(),p=function(e,t,r){if(r&&console.log("starting parseGeoraster with ",e,t),void 0===e){throw Error("[Georaster.parseGeoraster] Error. You passed in undefined to parseGeoraster. We can't make a raster out of nothing!")}return new d(e,t,r).initialize(r)};void 0!==e.exports&&(e.exports=p),"undefined"!=typeof window?window.parseGeoraster=p:"undefined"!=typeof self&&(self.parseGeoraster=p)},function(e,t,r){const n=r(45),i=n.default||n,o=function(e,t){return/^\/\//.test(e)&&(e="https:"+e),i.call(this,e,t)};o.ponyfill=!0,e.exports=t=o,t.fetch=o,t.Headers=n.Headers,t.Request=n.Request,t.Response=n.Response,t.default=o},function(e,t,r){"use strict";r.r(t),r.d(t,"Headers",(function(){return A})),r.d(t,"Request",(function(){return q})),r.d(t,"Response",(function(){return L})),r.d(t,"FetchError",(function(){return h}));var n=r(0),i=r(9),o=r(2),s=r(20),a=r(5);const c=n.Readable,l=Symbol("buffer"),u=Symbol("type");class f{constructor(){this[u]="";const e=arguments[0],t=arguments[1],r=[];let n=0;if(e){const t=e,i=Number(t.length);for(let e=0;e<i;e++){const i=t[e];let o;o=i instanceof Buffer?i:ArrayBuffer.isView(i)?Buffer.from(i.buffer,i.byteOffset,i.byteLength):i instanceof ArrayBuffer?Buffer.from(i):i instanceof f?i[l]:Buffer.from("string"==typeof i?i:String(i)),n+=o.length,r.push(o)}}this[l]=Buffer.concat(r);let i=t&&void 0!==t.type&&String(t.type).toLowerCase();i&&!/[^\u0020-\u007E]/.test(i)&&(this[u]=i)}get size(){return this[l].length}get type(){return this[u]}text(){return Promise.resolve(this[l].toString())}arrayBuffer(){const e=this[l],t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return Promise.resolve(t)}stream(){const e=new c;return e._read=function(){},e.push(this[l]),e.push(null),e}toString(){return"[object Blob]"}slice(){const e=this.size,t=arguments[0],r=arguments[1];let n,i;n=void 0===t?0:t<0?Math.max(e+t,0):Math.min(t,e),i=void 0===r?e:r<0?Math.max(e+r,0):Math.min(r,e);const o=Math.max(i-n,0),s=this[l].slice(n,n+o),a=new f([],{type:arguments[2]});return a[l]=s,a}}function h(e,t,r){Error.call(this,e),this.message=e,this.type=t,r&&(this.code=this.errno=r.code),Error.captureStackTrace(this,this.constructor)}let d;Object.defineProperties(f.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}}),Object.defineProperty(f.prototype,Symbol.toStringTag,{value:"Blob",writable:!1,enumerable:!1,configurable:!0}),h.prototype=Object.create(Error.prototype),h.prototype.constructor=h,h.prototype.name="FetchError";try{d=require("encoding").convert}catch(e){}const p=Symbol("Body internals"),g=n.PassThrough;function m(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.size;let o=void 0===i?0:i;var s=r.timeout;let a=void 0===s?0:s;null==e?e=null:y(e)?e=Buffer.from(e.toString()):w(e)||Buffer.isBuffer(e)||("[object ArrayBuffer]"===Object.prototype.toString.call(e)?e=Buffer.from(e):ArrayBuffer.isView(e)?e=Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof n||(e=Buffer.from(String(e)))),this[p]={body:e,disturbed:!1,error:null},this.size=o,this.timeout=a,e instanceof n&&e.on("error",(function(e){const r="AbortError"===e.name?e:new h(`Invalid response body while trying to fetch ${t.url}: ${e.message}`,"system",e);t[p].error=r}))}function b(){var e=this;if(this[p].disturbed)return m.Promise.reject(new TypeError("body used already for: "+this.url));if(this[p].disturbed=!0,this[p].error)return m.Promise.reject(this[p].error);let t=this.body;if(null===t)return m.Promise.resolve(Buffer.alloc(0));if(w(t)&&(t=t.stream()),Buffer.isBuffer(t))return m.Promise.resolve(t);if(!(t instanceof n))return m.Promise.resolve(Buffer.alloc(0));let r=[],i=0,o=!1;return new m.Promise((function(n,s){let a;e.timeout&&(a=setTimeout((function(){o=!0,s(new h(`Response timeout while trying to fetch ${e.url} (over ${e.timeout}ms)`,"body-timeout"))}),e.timeout)),t.on("error",(function(t){"AbortError"===t.name?(o=!0,s(t)):s(new h(`Invalid response body while trying to fetch ${e.url}: ${t.message}`,"system",t))})),t.on("data",(function(t){if(!o&&null!==t){if(e.size&&i+t.length>e.size)return o=!0,void s(new h(`content size at ${e.url} over limit: ${e.size}`,"max-size"));i+=t.length,r.push(t)}})),t.on("end",(function(){if(!o){clearTimeout(a);try{n(Buffer.concat(r,i))}catch(t){s(new h(`Could not create Buffer from response body for ${e.url}: ${t.message}`,"system",t))}}}))}))}function y(e){return"object"==typeof e&&"function"==typeof e.append&&"function"==typeof e.delete&&"function"==typeof e.get&&"function"==typeof e.getAll&&"function"==typeof e.has&&"function"==typeof e.set&&("URLSearchParams"===e.constructor.name||"[object URLSearchParams]"===Object.prototype.toString.call(e)||"function"==typeof e.sort)}function w(e){return"object"==typeof e&&"function"==typeof e.arrayBuffer&&"string"==typeof e.type&&"function"==typeof e.stream&&"function"==typeof e.constructor&&"string"==typeof e.constructor.name&&/^(Blob|File)$/.test(e.constructor.name)&&/^(Blob|File)$/.test(e[Symbol.toStringTag])}function v(e){let t,r,i=e.body;if(e.bodyUsed)throw new Error("cannot clone body after it is used");return i instanceof n&&"function"!=typeof i.getBoundary&&(t=new g,r=new g,i.pipe(t),i.pipe(r),e[p].body=t,i=r),i}function _(e){return null===e?null:"string"==typeof e?"text/plain;charset=UTF-8":y(e)?"application/x-www-form-urlencoded;charset=UTF-8":w(e)?e.type||null:Buffer.isBuffer(e)||"[object ArrayBuffer]"===Object.prototype.toString.call(e)||ArrayBuffer.isView(e)?null:"function"==typeof e.getBoundary?"multipart/form-data;boundary="+e.getBoundary():e instanceof n?null:"text/plain;charset=UTF-8"}function k(e){const t=e.body;return null===t?0:w(t)?t.size:Buffer.isBuffer(t)?t.length:t&&"function"==typeof t.getLengthSync&&(t._lengthRetrievers&&0==t._lengthRetrievers.length||t.hasKnownLength&&t.hasKnownLength())?t.getLengthSync():null}m.prototype={get body(){return this[p].body},get bodyUsed(){return this[p].disturbed},arrayBuffer(){return b.call(this).then((function(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}))},blob(){let e=this.headers&&this.headers.get("content-type")||"";return b.call(this).then((function(t){return Object.assign(new f([],{type:e.toLowerCase()}),{[l]:t})}))},json(){var e=this;return b.call(this).then((function(t){try{return JSON.parse(t.toString())}catch(t){return m.Promise.reject(new h(`invalid json response body at ${e.url} reason: ${t.message}`,"invalid-json"))}}))},text(){return b.call(this).then((function(e){return e.toString()}))},buffer(){return b.call(this)},textConverted(){var e=this;return b.call(this).then((function(t){return function(e,t){if("function"!=typeof d)throw new Error("The package `encoding` must be installed to use the textConverted() function");const r=t.get("content-type");let n,i,o="utf-8";r&&(n=/charset=([^;]*)/i.exec(r));i=e.slice(0,1024).toString(),!n&&i&&(n=/<meta.+?charset=(['"])(.+?)\1/i.exec(i));!n&&i&&(n=/<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(i),n||(n=/<meta[\s]+?content=(['"])(.+?)\1[\s]+?http-equiv=(['"])content-type\3/i.exec(i),n&&n.pop()),n&&(n=/charset=(.*)/i.exec(n.pop())));!n&&i&&(n=/<\?xml.+?encoding=(['"])(.+?)\1/i.exec(i));n&&(o=n.pop(),"gb2312"!==o&&"gbk"!==o||(o="gb18030"));return d(e,"UTF-8",o).toString()}(t,e.headers)}))}},Object.defineProperties(m.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0}}),m.mixIn=function(e){for(const t of Object.getOwnPropertyNames(m.prototype))if(!(t in e)){const r=Object.getOwnPropertyDescriptor(m.prototype,t);Object.defineProperty(e,t,r)}},m.Promise=global.Promise;const S=/[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/,x=/[^\t\x20-\x7e\x80-\xff]/;function E(e){if(e=""+e,S.test(e)||""===e)throw new TypeError(e+" is not a legal HTTP header name")}function C(e){if(e=""+e,x.test(e))throw new TypeError(e+" is not a legal HTTP header value")}function T(e,t){t=t.toLowerCase();for(const r in e)if(r.toLowerCase()===t)return r}const O=Symbol("map");class A{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;if(this[O]=Object.create(null),e instanceof A){const t=e.raw(),r=Object.keys(t);for(const e of r)for(const r of t[e])this.append(e,r)}else if(null==e);else{if("object"!=typeof e)throw new TypeError("Provided initializer must be an object");{const t=e[Symbol.iterator];if(null!=t){if("function"!=typeof t)throw new TypeError("Header pairs must be iterable");const r=[];for(const t of e){if("object"!=typeof t||"function"!=typeof t[Symbol.iterator])throw new TypeError("Each header pair must be iterable");r.push(Array.from(t))}for(const e of r){if(2!==e.length)throw new TypeError("Each header pair must be a name/value tuple");this.append(e[0],e[1])}}else for(const t of Object.keys(e)){const r=e[t];this.append(t,r)}}}}get(e){E(e=""+e);const t=T(this[O],e);return void 0===t?null:this[O][t].join(", ")}forEach(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=P(this),n=0;for(;n<r.length;){var i=r[n];const o=i[0],s=i[1];e.call(t,s,o,this),r=P(this),n++}}set(e,t){t=""+t,E(e=""+e),C(t);const r=T(this[O],e);this[O][void 0!==r?r:e]=[t]}append(e,t){t=""+t,E(e=""+e),C(t);const r=T(this[O],e);void 0!==r?this[O][r].push(t):this[O][e]=[t]}has(e){return E(e=""+e),void 0!==T(this[O],e)}delete(e){E(e=""+e);const t=T(this[O],e);void 0!==t&&delete this[O][t]}raw(){return this[O]}keys(){return D(this,"key")}values(){return D(this,"value")}[Symbol.iterator](){return D(this,"key+value")}}function P(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"key+value";const r=Object.keys(e[O]).sort();return r.map("key"===t?function(e){return e.toLowerCase()}:"value"===t?function(t){return e[O][t].join(", ")}:function(t){return[t.toLowerCase(),e[O][t].join(", ")]})}A.prototype.entries=A.prototype[Symbol.iterator],Object.defineProperty(A.prototype,Symbol.toStringTag,{value:"Headers",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(A.prototype,{get:{enumerable:!0},forEach:{enumerable:!0},set:{enumerable:!0},append:{enumerable:!0},has:{enumerable:!0},delete:{enumerable:!0},keys:{enumerable:!0},values:{enumerable:!0},entries:{enumerable:!0}});const I=Symbol("internal");function D(e,t){const r=Object.create(M);return r[I]={target:e,kind:t,index:0},r}const M=Object.setPrototypeOf({next(){if(!this||Object.getPrototypeOf(this)!==M)throw new TypeError("Value of `this` is not a HeadersIterator");var e=this[I];const t=e.target,r=e.kind,n=e.index,i=P(t,r);return n>=i.length?{value:void 0,done:!0}:(this[I].index=n+1,{value:i[n],done:!1})}},Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));function R(e){const t=Object.assign({__proto__:null},e[O]),r=T(e[O],"Host");return void 0!==r&&(t[r]=t[r][0]),t}Object.defineProperty(M,Symbol.toStringTag,{value:"HeadersIterator",writable:!1,enumerable:!1,configurable:!0});const F=Symbol("Response internals"),j=i.STATUS_CODES;class L{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};m.call(this,e,t);const r=t.status||200,n=new A(t.headers);if(null!=e&&!n.has("Content-Type")){const t=_(e);t&&n.append("Content-Type",t)}this[F]={url:t.url,status:r,statusText:t.statusText||j[r],headers:n,counter:t.counter}}get url(){return this[F].url||""}get status(){return this[F].status}get ok(){return this[F].status>=200&&this[F].status<300}get redirected(){return this[F].counter>0}get statusText(){return this[F].statusText}get headers(){return this[F].headers}clone(){return new L(v(this),{url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected})}}m.mixIn(L.prototype),Object.defineProperties(L.prototype,{url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}}),Object.defineProperty(L.prototype,Symbol.toStringTag,{value:"Response",writable:!1,enumerable:!1,configurable:!0});const U=Symbol("Request internals"),B=o.parse,N=o.format,G="destroy"in n.Readable.prototype;function W(e){return"object"==typeof e&&"object"==typeof e[U]}class q{constructor(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};W(e)?t=B(e.url):(t=e&&e.href?B(e.href):B(""+e),e={});let n=r.method||e.method||"GET";if(n=n.toUpperCase(),(null!=r.body||W(e)&&null!==e.body)&&("GET"===n||"HEAD"===n))throw new TypeError("Request with GET/HEAD method cannot have body");let i=null!=r.body?r.body:W(e)&&null!==e.body?v(e):null;m.call(this,i,{timeout:r.timeout||e.timeout||0,size:r.size||e.size||0});const o=new A(r.headers||e.headers||{});if(null!=i&&!o.has("Content-Type")){const e=_(i);e&&o.append("Content-Type",e)}let s=W(e)?e.signal:null;if("signal"in r&&(s=r.signal),null!=s&&!function(e){const t=e&&"object"==typeof e&&Object.getPrototypeOf(e);return!(!t||"AbortSignal"!==t.constructor.name)}(s))throw new TypeError("Expected signal to be an instanceof AbortSignal");this[U]={method:n,redirect:r.redirect||e.redirect||"follow",headers:o,parsedURL:t,signal:s},this.follow=void 0!==r.follow?r.follow:void 0!==e.follow?e.follow:20,this.compress=void 0!==r.compress?r.compress:void 0===e.compress||e.compress,this.counter=r.counter||e.counter||0,this.agent=r.agent||e.agent}get method(){return this[U].method}get url(){return N(this[U].parsedURL)}get headers(){return this[U].headers}get redirect(){return this[U].redirect}get signal(){return this[U].signal}clone(){return new q(this)}}function K(e){Error.call(this,e),this.type="aborted",this.message=e,Error.captureStackTrace(this,this.constructor)}m.mixIn(q.prototype),Object.defineProperty(q.prototype,Symbol.toStringTag,{value:"Request",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(q.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0}}),K.prototype=Object.create(Error.prototype),K.prototype.constructor=K,K.prototype.name="AbortError";const z=n.PassThrough,H=o.resolve;function V(e,t){if(!V.Promise)throw new Error("native promise missing, set fetch.Promise to your favorite alternative");return m.Promise=V.Promise,new V.Promise((function(r,o){const c=new q(e,t),l=function(e){const t=e[U].parsedURL,r=new A(e[U].headers);if(r.has("Accept")||r.set("Accept","*/*"),!t.protocol||!t.hostname)throw new TypeError("Only absolute URLs are supported");if(!/^https?:$/.test(t.protocol))throw new TypeError("Only HTTP(S) protocols are supported");if(e.signal&&e.body instanceof n.Readable&&!G)throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8");let i=null;if(null==e.body&&/^(POST|PUT)$/i.test(e.method)&&(i="0"),null!=e.body){const t=k(e);"number"==typeof t&&(i=String(t))}i&&r.set("Content-Length",i),r.has("User-Agent")||r.set("User-Agent","node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"),e.compress&&!r.has("Accept-Encoding")&&r.set("Accept-Encoding","gzip,deflate");let o=e.agent;return"function"==typeof o&&(o=o(t)),r.has("Connection")||o||r.set("Connection","close"),Object.assign({},t,{method:e.method,headers:R(r),agent:o})}(c),u=("https:"===l.protocol?s:i).request,f=c.signal;let d=null;const p=function(){let e=new K("The user aborted a request.");o(e),c.body&&c.body instanceof n.Readable&&c.body.destroy(e),d&&d.body&&d.body.emit("error",e)};if(f&&f.aborted)return void p();const g=function(){p(),y()},m=u(l);let b;function y(){m.abort(),f&&f.removeEventListener("abort",g),clearTimeout(b)}f&&f.addEventListener("abort",g),c.timeout&&m.once("socket",(function(e){b=setTimeout((function(){o(new h("network timeout at: "+c.url,"request-timeout")),y()}),c.timeout)})),m.on("error",(function(e){o(new h(`request to ${c.url} failed, reason: ${e.message}`,"system",e)),y()})),m.on("response",(function(e){clearTimeout(b);const t=function(e){const t=new A;for(const r of Object.keys(e))if(!S.test(r))if(Array.isArray(e[r]))for(const n of e[r])x.test(n)||(void 0===t[O][r]?t[O][r]=[n]:t[O][r].push(n));else x.test(e[r])||(t[O][r]=[e[r]]);return t}(e.headers);if(V.isRedirect(e.statusCode)){const n=t.get("Location"),i=null===n?null:H(c.url,n);switch(c.redirect){case"error":return o(new h("uri requested responds with a redirect, redirect mode is set to error: "+c.url,"no-redirect")),void y();case"manual":if(null!==i)try{t.set("Location",i)}catch(e){o(e)}break;case"follow":if(null===i)break;if(c.counter>=c.follow)return o(new h("maximum redirect reached at: "+c.url,"max-redirect")),void y();const n={headers:new A(c.headers),follow:c.follow,counter:c.counter+1,agent:c.agent,compress:c.compress,method:c.method,body:c.body,signal:c.signal,timeout:c.timeout,size:c.size};return 303!==e.statusCode&&c.body&&null===k(c)?(o(new h("Cannot follow redirect with body being a readable stream","unsupported-redirect")),void y()):(303!==e.statusCode&&(301!==e.statusCode&&302!==e.statusCode||"POST"!==c.method)||(n.method="GET",n.body=void 0,n.headers.delete("content-length")),r(V(new q(i,n))),void y())}}e.once("end",(function(){f&&f.removeEventListener("abort",g)}));let n=e.pipe(new z);const i={url:c.url,status:e.statusCode,statusText:e.statusMessage,headers:t,size:c.size,timeout:c.timeout,counter:c.counter},s=t.get("Content-Encoding");if(!c.compress||"HEAD"===c.method||null===s||204===e.statusCode||304===e.statusCode)return d=new L(n,i),void r(d);const l={flush:a.Z_SYNC_FLUSH,finishFlush:a.Z_SYNC_FLUSH};if("gzip"==s||"x-gzip"==s)return n=n.pipe(a.createGunzip(l)),d=new L(n,i),void r(d);if("deflate"!=s&&"x-deflate"!=s){if("br"==s&&"function"==typeof a.createBrotliDecompress)return n=n.pipe(a.createBrotliDecompress()),d=new L(n,i),void r(d);d=new L(n,i),r(d)}else{e.pipe(new z).once("data",(function(e){n=8==(15&e[0])?n.pipe(a.createInflate()):n.pipe(a.createInflateRaw()),d=new L(n,i),r(d)}))}})),function(e,t){const r=t.body;null===r?e.end():w(r)?r.stream().pipe(e):Buffer.isBuffer(r)?(e.write(r),e.end()):r.pipe(e)}(m,c)}))}V.isRedirect=function(e){return 301===e||302===e||303===e||307===e||308===e},V.Promise=global.Promise,t.default=V},function(e,t,r){"use strict";e.exports=function(){return r(47)('!function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=41)}([function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return i})),r.d(t,"c",(function(){return o})),r.d(t,"d",(function(){return s})),r.d(t,"e",(function(){return a}));const n=Symbol("thread.errors"),i=Symbol("thread.events"),o=Symbol("thread.terminate"),s=Symbol("thread.transferable"),a=Symbol("thread.worker")},function(e,t,r){"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?e.exports=r(62):e.exports=r(64)},function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return s}));const n={deserialize:e=>Object.assign(Error(e.message),{name:e.name,stack:e.stack}),serialize:e=>({__error_marker:"$$error",message:e.message,name:e.name,stack:e.stack})};let i={deserialize(e){return(t=e)&&"object"==typeof t&&"__error_marker"in t&&"$$error"===t.__error_marker?n.deserialize(e):e;var t},serialize:e=>e instanceof Error?n.serialize(e):e};function o(e){return i.deserialize(e)}function s(e){return i.serialize(e)}},function(e,t,r){try{var n=r(9);if("function"!=typeof n.inherits)throw"";e.exports=n.inherits}catch(t){e.exports=r(45)}},function(e,t,r){"use strict";var n=r(13),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=f;var o=Object.create(r(8));o.inherits=r(3);var s=r(24),a=r(27);o.inherits(f,s);for(var c=i(a.prototype),l=0;l<c.length;l++){var u=c[l];f.prototype[u]||(f.prototype[u]=a.prototype[u])}function f(e){if(!(this instanceof f))return new f(e);s.call(this,e),a.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",h)}function h(){this.allowHalfOpen||this._writableState.ended||n.nextTick(d,this)}function d(e){e.end()}Object.defineProperty(f.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(f.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),f.prototype._destroy=function(e,t){this.push(null),this.end(),n.nextTick(t,e)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return p})),r.d(t,"b",(function(){return g}));var n={};let i;function o(){return i||(i=function(){try{throw new Error}catch(e){const t=(""+e.stack).match(/(https?|file|ftp|chrome-extension|moz-extension):\\/\\/[^)\\n]+/g);if(t)return(""+t[0]).replace(/^((?:https?|file|ftp|chrome-extension|moz-extension):\\/\\/.+)?\\/[^/]+(?:\\?.*)?$/,"$1")+"/"}return"/"}()),i}r.r(n),r.d(n,"defaultPoolSize",(function(){return s})),r.d(n,"getWorkerImplementation",(function(){return u})),r.d(n,"isWorkerRuntime",(function(){return f}));const s="undefined"!=typeof navigator&&navigator.hardwareConcurrency?navigator.hardwareConcurrency:4,a=e=>/^[a-zA-Z][a-zA-Z\\d+\\-.]*:/.test(e);function c(e){const t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}let l;function u(){return l||(l=function(){if("undefined"==typeof Worker)return class{constructor(){throw Error("No web worker implementation available. You might have tried to spawn a worker within a worker in a browser that doesn\'t support workers in workers.")}};class e extends Worker{constructor(e,t){var r,n;"string"==typeof e&&t&&t._baseURL?e=new URL(e,t._baseURL):"string"==typeof e&&!a(e)&&o().match(/^file:\\/\\//i)&&(e=new URL(e,o().replace(/\\/[^\\/]+$/,"/")),(null===(r=null==t?void 0:t.CORSWorkaround)||void 0===r||r)&&(e=c(`importScripts(${JSON.stringify(e)});`))),"string"==typeof e&&a(e)&&(null===(n=null==t?void 0:t.CORSWorkaround)||void 0===n||n)&&(e=c(`importScripts(${JSON.stringify(e)});`)),super(e,t)}}class t extends e{constructor(e,t){super(window.URL.createObjectURL(e),t)}static fromText(e,r){const n=new window.Blob([e],{type:"text/javascript"});return new t(n,r)}}return{blob:t,default:e}}()),l}function f(){const e="undefined"!=typeof self&&"undefined"!=typeof Window&&self instanceof Window;return!("undefined"==typeof self||!self.postMessage||e)}var h=r(35);const d="undefined"!=typeof process&&"browser"!==process.arch&&"pid"in process?h:n,p=d.defaultPoolSize,g=d.getWorkerImplementation;d.isWorkerRuntime},function(e,t){e.exports=require("path")},function(e,t,r){"use strict";var n,i;r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return i})),function(e){e.cancel="cancel",e.run="run"}(n||(n={})),function(e){e.error="error",e.init="init",e.result="result",e.running="running",e.uncaughtError="uncaughtError"}(i||(i={}))},function(e,t,r){function n(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===n(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===n(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===n(e)},t.isError=function(e){return"[object Error]"===n(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(11).Buffer.isBuffer},function(e,t){e.exports=require("util")},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0);function i(e){throw Error(e)}const o={errors:e=>e[n.a]||i("Error observable not found. Make sure to pass a thread instance as returned by the spawn() promise."),events:e=>e[n.b]||i("Events observable not found. Make sure to pass a thread instance as returned by the spawn() promise."),terminate:e=>e[n.c]()}},function(e,t){e.exports=require("buffer")},function(e,t){e.exports=require("fs")},function(e,t,r){"use strict";"undefined"==typeof process||!process.version||0===process.version.indexOf("v0.")||0===process.version.indexOf("v1.")&&0!==process.version.indexOf("v1.8.")?e.exports={nextTick:function(e,t,r,n){if("function"!=typeof e)throw new TypeError(\'"callback" argument must be a function\');var i,o,s=arguments.length;switch(s){case 0:case 1:return process.nextTick(e);case 2:return process.nextTick((function(){e.call(null,t)}));case 3:return process.nextTick((function(){e.call(null,t,r)}));case 4:return process.nextTick((function(){e.call(null,t,r,n)}));default:for(i=new Array(s-1),o=0;o<i.length;)i[o++]=arguments[o];return process.nextTick((function(){e.apply(null,i)}))}}}:e.exports=process},function(e,t,r){var n=r(11),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=s),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},function(e,t,r){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var n in r)i(r,n)&&(e[n]=r[n])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var o={arraySet:function(e,t,r,n,i){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+n),i);else for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){var t,r,n,i,o,s;for(n=0,t=0,r=e.length;t<r;t++)n+=e[t].length;for(s=new Uint8Array(n),i=0,t=0,r=e.length;t<r;t++)o=e[t],s.set(o,i),i+=o.length;return s}},s={arraySet:function(e,t,r,n,i){for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){return[].concat.apply([],e)}};t.setTyped=function(e){e?(t.Buf8=Uint8Array,t.Buf16=Uint16Array,t.Buf32=Int32Array,t.assign(t,o)):(t.Buf8=Array,t.Buf16=Array,t.Buf32=Array,t.assign(t,s))},t.setTyped(n)},function(e,t){e.exports=require("url")},function(e,t,r){"use strict";const n=()=>"function"==typeof Symbol,i=e=>n()&&Boolean(Symbol[e]),o=e=>i(e)?Symbol[e]:"@@"+e;i("asyncIterator")||(Symbol.asyncIterator=Symbol.asyncIterator||Symbol.for("Symbol.asyncIterator"));const s=o("iterator"),a=o("observable"),c=o("species");function l(e,t){const r=e[t];if(null!=r){if("function"!=typeof r)throw new TypeError(r+" is not a function");return r}}function u(e){let t=e.constructor;return void 0!==t&&(t=t[c],null===t&&(t=void 0)),void 0!==t?t:y}function f(e){f.log?f.log(e):setTimeout(()=>{throw e},0)}function h(e){Promise.resolve().then(()=>{try{e()}catch(e){f(e)}})}function d(e){const t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{const e=l(t,"unsubscribe");e&&e.call(t)}}catch(e){f(e)}}function p(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function g(e,t,r){e._state="running";const n=e._observer;try{const i=n?l(n,t):void 0;switch(t){case"next":i&&i.call(n,r);break;case"error":if(p(e),!i)throw r;i.call(n,r);break;case"complete":p(e),i&&i.call(n)}}catch(e){f(e)}"closed"===e._state?d(e):"running"===e._state&&(e._state="ready")}function m(e,t,r){if("closed"!==e._state)return"buffering"===e._state?(e._queue=e._queue||[],void e._queue.push({type:t,value:r})):"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:r}],void h(()=>function(e){const t=e._queue;if(t){e._queue=void 0,e._state="ready";for(const r of t)if(g(e,r.type,r.value),"closed"===e._state)break}}(e))):void g(e,t,r)}class b{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";const r=new w(this);try{this._cleanup=t.call(void 0,r)}catch(e){r.error(e)}"initializing"===this._state&&(this._state="ready")}get closed(){return"closed"===this._state}unsubscribe(){"closed"!==this._state&&(p(this),d(this))}}class w{constructor(e){this._subscription=e}get closed(){return"closed"===this._subscription._state}next(e){m(this._subscription,"next",e)}error(e){m(this._subscription,"error",e)}complete(){m(this._subscription,"complete")}}class y{constructor(e){if(!(this instanceof y))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw new TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e,t,r){return"object"==typeof e&&null!==e||(e={next:e,error:t,complete:r}),new b(e,this._subscriber)}pipe(e,...t){let r=this;for(const n of[e,...t])r=n(r);return r}tap(e,t,r){const n="object"!=typeof e||null===e?{next:e,error:t,complete:r}:e;return new y(e=>this.subscribe({next(t){n.next&&n.next(t),e.next(t)},error(t){n.error&&n.error(t),e.error(t)},complete(){n.complete&&n.complete(),e.complete()},start(e){n.start&&n.start(e)}}))}forEach(e){return new Promise((t,r)=>{if("function"!=typeof e)return void r(new TypeError(e+" is not a function"));function n(){i.unsubscribe(),t(void 0)}const i=this.subscribe({next(t){try{e(t,n)}catch(e){r(e),i.unsubscribe()}},error(e){r(e)},complete(){t(void 0)}})})}map(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(u(this))(t=>this.subscribe({next(r){let n=r;try{n=e(r)}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}filter(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(u(this))(t=>this.subscribe({next(r){try{if(!e(r))return}catch(e){return t.error(e)}t.next(r)},error(e){t.error(e)},complete(){t.complete()}}))}reduce(e,t){if("function"!=typeof e)throw new TypeError(e+" is not a function");const r=u(this),n=arguments.length>1;let i=!1,o=t;return new r(t=>this.subscribe({next(r){const s=!i;if(i=!0,!s||n)try{o=e(o,r)}catch(e){return t.error(e)}else o=r},error(e){t.error(e)},complete(){if(!i&&!n)return t.error(new TypeError("Cannot reduce an empty sequence"));t.next(o),t.complete()}}))}concat(...e){const t=u(this);return new t(r=>{let n,i=0;return function o(s){n=s.subscribe({next(e){r.next(e)},error(e){r.error(e)},complete(){i===e.length?(n=void 0,r.complete()):o(t.from(e[i++]))}})}(this),()=>{n&&(n.unsubscribe(),n=void 0)}})}flatMap(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");const t=u(this);return new t(r=>{const n=[],i=this.subscribe({next(i){let s;if(e)try{s=e(i)}catch(e){return r.error(e)}else s=i;const a=t.from(s).subscribe({next(e){r.next(e)},error(e){r.error(e)},complete(){const e=n.indexOf(a);e>=0&&n.splice(e,1),o()}});n.push(a)},error(e){r.error(e)},complete(){o()}});function o(){i.closed&&0===n.length&&r.complete()}return()=>{n.forEach(e=>e.unsubscribe()),i.unsubscribe()}})}[(Symbol.observable,a)](){return this}static from(e){const t="function"==typeof this?this:y;if(null==e)throw new TypeError(e+" is not an object");const r=l(e,a);if(r){const n=r.call(e);if(Object(n)!==n)throw new TypeError(n+" is not an object");return function(e){return e instanceof y}(n)&&n.constructor===t?n:new t(e=>n.subscribe(e))}if(i("iterator")){const r=l(e,s);if(r)return new t(t=>{h(()=>{if(!t.closed){for(const n of r.call(e))if(t.next(n),t.closed)return;t.complete()}})})}if(Array.isArray(e))return new t(t=>{h(()=>{if(!t.closed){for(const r of e)if(t.next(r),t.closed)return;t.complete()}})});throw new TypeError(e+" is not observable")}static of(...e){return new("function"==typeof this?this:y)(t=>{h(()=>{if(!t.closed){for(const r of e)if(t.next(r),t.closed)return;t.complete()}})})}static get[c](){return this}}n()&&Object.defineProperty(y,Symbol("extensions"),{value:{symbol:a,hostReportError:f},configurable:!0});t.a=y},,function(e,t){e.exports=require("events")},function(e,t,r){"use strict";r.d(t,"a",(function(){return A}));var n=r(1),i=r.n(n),o=r(17),s=r(2);const a=()=>{};var c,l=r(0);!function(e){e.internalError="internalError",e.message="message",e.termination="termination"}(c||(c={}));var u=r(73);const f=()=>{},h=e=>e,d=e=>Promise.resolve().then(e);function p(e){throw e}class g extends o.a{constructor(e){super(t=>{const r=this,n=Object.assign(Object.assign({},t),{complete(){t.complete(),r.onCompletion()},error(e){t.error(e),r.onError(e)},next(e){t.next(e),r.onNext(e)}});try{return this.initHasRun=!0,e(n)}catch(e){n.error(e)}}),this.initHasRun=!1,this.fulfillmentCallbacks=[],this.rejectionCallbacks=[],this.firstValueSet=!1,this.state="pending"}onNext(e){this.firstValueSet||(this.firstValue=e,this.firstValueSet=!0)}onError(e){this.state="rejected",this.rejection=e;for(const t of this.rejectionCallbacks)d(()=>t(e))}onCompletion(){this.state="fulfilled";for(const e of this.fulfillmentCallbacks)d(()=>e(this.firstValue))}then(e,t){const r=e||h,n=t||p;let i=!1;return new Promise((e,t)=>{const o=r=>{if(!i){i=!0;try{e(n(r))}catch(e){t(e)}}};return this.initHasRun||this.subscribe({error:o}),"fulfilled"===this.state?e(r(this.firstValue)):"rejected"===this.state?(i=!0,e(n(this.rejection))):(this.fulfillmentCallbacks.push(t=>{try{e(r(t))}catch(e){o(e)}}),void this.rejectionCallbacks.push(o))})}catch(e){return this.then(void 0,e)}finally(e){const t=e||f;return this.then(e=>(t(),e),()=>t())}static from(e){return function(e){return e&&"function"==typeof e.then}(e)?new g(t=>{e.then(e=>{t.next(e),t.complete()},e=>{t.error(e)})}):super.from(e)}}var m=r(39),b=r(7);const w=i()("threads:master:messages");let y=1;function v(e,t){return new o.a(r=>{let n;const i=o=>{var a;if(w("Message from worker:",o.data),o.data&&o.data.uid===t)if((a=o.data)&&a.type===b.b.running)n=o.data.resultType;else if((e=>e&&e.type===b.b.result)(o.data))"promise"===n?(void 0!==o.data.payload&&r.next(Object(s.a)(o.data.payload)),r.complete(),e.removeEventListener("message",i)):(o.data.payload&&r.next(Object(s.a)(o.data.payload)),o.data.complete&&(r.complete(),e.removeEventListener("message",i)));else if((e=>e&&e.type===b.b.error)(o.data)){const t=Object(s.a)(o.data.error);r.error(t),e.removeEventListener("message",i)}};return e.addEventListener("message",i),()=>{if("observable"===n||!n){const r={type:b.a.cancel,uid:t};e.postMessage(r)}e.removeEventListener("message",i)}})}function _(e,t){return(...r)=>{const n=y++,{args:i,transferables:o}=function(e){if(0===e.length)return{args:[],transferables:[]};const t=[],r=[];for(const n of e)Object(m.a)(n)?(t.push(Object(s.b)(n.send)),r.push(...n.transferables)):t.push(Object(s.b)(n));return{args:t,transferables:0===r.length?r:(n=r,Array.from(new Set(n)))};var n}(r),a={type:b.a.run,uid:n,method:t,args:i};w("Sending command to run function to worker:",a);try{e.postMessage(a,o)}catch(e){return g.from(Promise.reject(e))}return g.from(Object(u.a)(v(e,n)))}}var k=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};const S=i()("threads:master:messages"),x=i()("threads:master:spawn"),C=i()("threads:master:thread-utils"),E="undefined"!=typeof process&&process.env.THREADS_WORKER_INIT_TIMEOUT?Number.parseInt(process.env.THREADS_WORKER_INIT_TIMEOUT,10):1e4;function T(e){const[t,r]=function(){let e,t=!1,r=a;return[new Promise(n=>{t?n(e):r=n}),n=>{t=!0,e=n,r(e)}]}();return{terminate:()=>k(this,void 0,void 0,(function*(){C("Terminating worker"),yield e.terminate(),r()})),termination:t}}function O(e,t,r,n){const i=r.filter(e=>e.type===c.internalError).map(e=>e.error);return Object.assign(e,{[l.a]:i,[l.b]:r,[l.c]:n,[l.e]:t})}function A(e,t){return k(this,void 0,void 0,(function*(){x("Initializing new thread");const r=t&&t.timeout?t.timeout:E,n=(yield function(e,t,r){return k(this,void 0,void 0,(function*(){let n;const i=new Promise((e,i)=>{n=setTimeout(()=>i(Error(r)),t)}),o=yield Promise.race([e,i]);return clearTimeout(n),o}))}(function(e){return new Promise((t,r)=>{const n=i=>{var o;S("Message from worker before finishing initialization:",i.data),(o=i.data)&&"init"===o.type?(e.removeEventListener("message",n),t(i.data)):(e=>e&&"uncaughtError"===e.type)(i.data)&&(e.removeEventListener("message",n),r(Object(s.a)(i.data.error)))};e.addEventListener("message",n)})}(e),r,`Timeout: Did not receive an init message from worker after ${r}ms. Make sure the worker calls expose().`)).exposed,{termination:i,terminate:a}=T(e),l=function(e,t){return new o.a(r=>{const n=e=>{const t={type:c.message,data:e.data};r.next(t)},i=e=>{C("Unhandled promise rejection event in thread:",e);const t={type:c.internalError,error:Error(e.reason)};r.next(t)};e.addEventListener("message",n),e.addEventListener("unhandledrejection",i),t.then(()=>{const t={type:c.termination};e.removeEventListener("message",n),e.removeEventListener("unhandledrejection",i),r.next(t),r.complete()})})}(e,i);if("function"===n.type){return O(_(e),e,l,a)}if("module"===n.type){return O(function(e,t){const r={};for(const n of t)r[n]=_(e,n);return r}(e,n.methods),e,l,a)}{const e=n.type;throw Error("Worker init message states unexpected type of expose(): "+e)}}))}},function(e,t,r){"use strict";r.d(t,"a",(function(){return m}));var n=r(1),i=r.n(n),o=r(38),s=r(73),a=r(17);function c(e){return Promise.all(e.map(e=>{const t=e=>({status:"fulfilled",value:e}),r=e=>({status:"rejected",reason:e}),n=Promise.resolve(e);try{return n.then(t,r)}catch(e){return Promise.reject(e)}}))}var l,u=r(5);!function(e){e.initialized="initialized",e.taskCanceled="taskCanceled",e.taskCompleted="taskCompleted",e.taskFailed="taskFailed",e.taskQueued="taskQueued",e.taskQueueDrained="taskQueueDrained",e.taskStart="taskStart",e.terminated="terminated"}(l||(l={}));var f=r(10),h=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};let d=1;class p{constructor(e,t){this.eventSubject=new o.a,this.initErrors=[],this.isClosing=!1,this.nextTaskID=1,this.taskQueue=[];const r="number"==typeof t?{size:t}:t||{},{size:n=u.a}=r;this.debug=i()("threads:pool:"+(r.name||String(d++)).replace(/\\W/g," ").trim().replace(/\\s+/g,"-")),this.options=r,this.workers=function(e,t){return function(e){const t=[];for(let r=0;r<e;r++)t.push(r);return t}(t).map(()=>({init:e(),runningTasks:[]}))}(e,n),this.eventObservable=Object(s.a)(a.a.from(this.eventSubject)),Promise.all(this.workers.map(e=>e.init)).then(()=>this.eventSubject.next({type:l.initialized,size:this.workers.length}),e=>{this.debug("Error while initializing pool worker:",e),this.eventSubject.error(e),this.initErrors.push(e)})}findIdlingWorker(){const{concurrency:e=1}=this.options;return this.workers.find(t=>t.runningTasks.length<e)}runPoolTask(e,t){return h(this,void 0,void 0,(function*(){const r=this.workers.indexOf(e)+1;this.debug(`Running task #${t.id} on worker #${r}...`),this.eventSubject.next({type:l.taskStart,taskID:t.id,workerID:r});try{const n=yield t.run(yield e.init);this.debug(`Task #${t.id} completed successfully`),this.eventSubject.next({type:l.taskCompleted,returnValue:n,taskID:t.id,workerID:r})}catch(e){this.debug(`Task #${t.id} failed`),this.eventSubject.next({type:l.taskFailed,taskID:t.id,error:e,workerID:r})}}))}run(e,t){return h(this,void 0,void 0,(function*(){const r=(()=>h(this,void 0,void 0,(function*(){var n;yield(n=0,new Promise(e=>setTimeout(e,n)));try{yield this.runPoolTask(e,t)}finally{e.runningTasks=e.runningTasks.filter(e=>e!==r),this.isClosing||this.scheduleWork()}})))();e.runningTasks.push(r)}))}scheduleWork(){this.debug("Attempt de-queueing a task in order to run it...");const e=this.findIdlingWorker();if(!e)return;const t=this.taskQueue.shift();if(!t)return this.debug("Task queue is empty"),void this.eventSubject.next({type:l.taskQueueDrained});this.run(e,t)}taskCompletion(e){return new Promise((t,r)=>{const n=this.events().subscribe(i=>{i.type===l.taskCompleted&&i.taskID===e?(n.unsubscribe(),t(i.returnValue)):i.type===l.taskFailed&&i.taskID===e?(n.unsubscribe(),r(i.error)):i.type===l.terminated&&(n.unsubscribe(),r(Error("Pool has been terminated before task was run.")))})})}settled(e=!1){return h(this,void 0,void 0,(function*(){const t=()=>{return e=this.workers,t=e=>e.runningTasks,e.reduce((e,r)=>[...e,...t(r)],[]);var e,t},r=[],n=this.eventObservable.subscribe(e=>{e.type===l.taskFailed&&r.push(e.error)});return this.initErrors.length>0?Promise.reject(this.initErrors[0]):e&&0===this.taskQueue.length?(yield c(t()),r):(yield new Promise((e,t)=>{const r=this.eventObservable.subscribe({next(t){t.type===l.taskQueueDrained&&(r.unsubscribe(),e(void 0))},error:t})}),yield c(t()),n.unsubscribe(),r)}))}completed(e=!1){return h(this,void 0,void 0,(function*(){const t=this.settled(e),r=new Promise((e,r)=>{const n=this.eventObservable.subscribe({next(i){i.type===l.taskQueueDrained?(n.unsubscribe(),e(t)):i.type===l.taskFailed&&(n.unsubscribe(),r(i.error))},error:r})}),n=yield Promise.race([t,r]);if(n.length>0)throw n[0]}))}events(){return this.eventObservable}queue(e){const{maxQueuedJobs:t=1/0}=this.options;if(this.isClosing)throw Error("Cannot schedule pool tasks after terminate() has been called.");if(this.initErrors.length>0)throw this.initErrors[0];const r=this.nextTaskID++,n=this.taskCompletion(r);n.catch(e=>{this.debug(`Task #${r} errored:`,e)});const i={id:r,run:e,cancel:()=>{-1!==this.taskQueue.indexOf(i)&&(this.taskQueue=this.taskQueue.filter(e=>e!==i),this.eventSubject.next({type:l.taskCanceled,taskID:i.id}))},then:n.then.bind(n)};if(this.taskQueue.length>=t)throw Error("Maximum number of pool tasks queued. Refusing to queue another one.\\nThis usually happens for one of two reasons: We are either at peak workload right now or some tasks just won\'t finish, thus blocking the pool.");return this.debug(`Queueing task #${i.id}...`),this.taskQueue.push(i),this.eventSubject.next({type:l.taskQueued,taskID:i.id}),this.scheduleWork(),i}terminate(e){return h(this,void 0,void 0,(function*(){this.isClosing=!0,e||(yield this.completed(!0)),this.eventSubject.next({type:l.terminated,remainingQueue:[...this.taskQueue]}),this.eventSubject.complete(),yield Promise.all(this.workers.map(e=>h(this,void 0,void 0,(function*(){return f.a.terminate(yield e.init)}))))}))}}function g(e,t){return new p(e,t)}p.EventType=l,g.EventType=l;const m=g},function(e,t){e.exports=require("http")},function(e,t){e.exports=require("stream")},function(e,t,r){"use strict";var n=r(13);e.exports=w;var i,o=r(44);w.ReadableState=b;r(19).EventEmitter;var s=function(e,t){return e.listeners(t).length},a=r(25),c=r(14).Buffer,l=global.Uint8Array||function(){};var u=Object.create(r(8));u.inherits=r(3);var f=r(9),h=void 0;h=f&&f.debuglog?f.debuglog("stream"):function(){};var d,p=r(46),g=r(26);u.inherits(w,a);var m=["error","close","destroy","pause","resume"];function b(e,t){e=e||{};var n=t instanceof(i=i||r(4));this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var o=e.highWaterMark,s=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=o||0===o?o:n&&(s||0===s)?s:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(d||(d=r(28).StringDecoder),this.decoder=new d(e.encoding),this.encoding=e.encoding)}function w(e){if(i=i||r(4),!(this instanceof w))return new w(e);this._readableState=new b(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),a.call(this)}function y(e,t,r,n,i){var o,s=e._readableState;null===t?(s.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,k(e)}(e,s)):(i||(o=function(e,t){var r;n=t,c.isBuffer(n)||n instanceof l||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var n;return r}(s,t)),o?e.emit("error",o):s.objectMode||t&&t.length>0?("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function(e){return c.from(e)}(t)),n?s.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):v(e,s,t,!0):s.ended?e.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?v(e,s,t,!1):x(e,s)):v(e,s,t,!1))):n||(s.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(s)}function v(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&k(e)),x(e,t)}Object.defineProperty(w.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),w.prototype.destroy=g.destroy,w.prototype._undestroy=g.undestroy,w.prototype._destroy=function(e,t){this.push(null),t(e)},w.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=c.from(e,t),t=""),r=!0),y(this,e,t,!1,r)},w.prototype.unshift=function(e){return y(this,e,null,!0,!1)},w.prototype.isPaused=function(){return!1===this._readableState.flowing},w.prototype.setEncoding=function(e){return d||(d=r(28).StringDecoder),this._readableState.decoder=new d(e),this._readableState.encoding=e,this};function _(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function k(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(h("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?n.nextTick(S,e):S(e))}function S(e){h("emit readable"),e.emit("readable"),O(e)}function x(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(C,e,t))}function C(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(h("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}function E(e){h("readable nexttick read 0"),e.read(0)}function T(e,t){t.reading||(h("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),O(e),t.flowing&&!t.reading&&e.read(0)}function O(e){var t=e._readableState;for(h("flow",t.flowing);t.flowing&&null!==e.read(););}function A(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var n;e<t.head.data.length?(n=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):n=e===t.head.data.length?t.shift():r?function(e,t){var r=t.head,n=1,i=r.data;e-=i.length;for(;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),0===(e-=s)){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++n}return t.length-=n,i}(e,t):function(e,t){var r=c.allocUnsafe(e),n=t.head,i=1;n.data.copy(r),e-=n.data.length;for(;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),0===(e-=s)){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++i}return t.length-=i,r}(e,t);return n}(e,t.buffer,t.decoder),r);var r}function P(e){var t=e._readableState;if(t.length>0)throw new Error(\'"endReadable()" called on non-empty stream\');t.endEmitted||(t.ended=!0,n.nextTick(I,t,e))}function I(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function D(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}w.prototype.read=function(e){h("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return h("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?P(this):k(this),null;if(0===(e=_(e,t))&&t.ended)return 0===t.length&&P(this),null;var n,i=t.needReadable;return h("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&h("length less than watermark",i=!0),t.ended||t.reading?h("reading or ended",i=!1):i&&(h("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=_(r,t))),null===(n=e>0?A(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&P(this)),null!==n&&this.emit("data",n),n},w.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},w.prototype.pipe=function(e,t){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,h("pipe count=%d opts=%j",i.pipesCount,t);var a=(!t||!1!==t.end)&&e!==process.stdout&&e!==process.stderr?l:w;function c(t,n){h("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,h("cleanup"),e.removeListener("close",m),e.removeListener("finish",b),e.removeListener("drain",u),e.removeListener("error",g),e.removeListener("unpipe",c),r.removeListener("end",l),r.removeListener("end",w),r.removeListener("data",p),f=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||u())}function l(){h("onend"),e.end()}i.endEmitted?n.nextTick(a):r.once("end",a),e.on("unpipe",c);var u=function(e){return function(){var t=e._readableState;h("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&s(e,"data")&&(t.flowing=!0,O(e))}}(r);e.on("drain",u);var f=!1;var d=!1;function p(t){h("ondata"),d=!1,!1!==e.write(t)||d||((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==D(i.pipes,e))&&!f&&(h("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,d=!0),r.pause())}function g(t){h("onerror",t),w(),e.removeListener("error",g),0===s(e,"error")&&e.emit("error",t)}function m(){e.removeListener("finish",b),w()}function b(){h("onfinish"),e.removeListener("close",m),w()}function w(){h("unpipe"),r.unpipe(e)}return r.on("data",p),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",g),e.once("close",m),e.once("finish",b),e.emit("pipe",r),i.flowing||(h("pipe resume"),r.resume()),e},w.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,r);return this}var s=D(t.pipes,e);return-1===s||(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},w.prototype.on=function(e,t){var r=a.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var i=this._readableState;i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.emittedReadable=!1,i.reading?i.length&&k(this):n.nextTick(E,this))}return r},w.prototype.addListener=w.prototype.on,w.prototype.resume=function(){var e=this._readableState;return e.flowing||(h("resume"),e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(T,e,t))}(this,e)),this},w.prototype.pause=function(){return h("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(h("pause"),this._readableState.flowing=!1,this.emit("pause")),this},w.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(h("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){(h("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o<m.length;o++)e.on(m[o],this.emit.bind(this,m[o]));return this._read=function(t){h("wrapped _read",t),n&&(n=!1,e.resume())},this},Object.defineProperty(w.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),w._fromList=A},function(e,t,r){e.exports=r(23)},function(e,t,r){"use strict";var n=r(13);function i(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var r=this,o=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return o||s?(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||n.nextTick(i,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?(n.nextTick(i,r,e),r._writableState&&(r._writableState.errorEmitted=!0)):t&&t(e)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(e,t,r){"use strict";var n=r(13);function i(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;e.entry=null;for(;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}e.exports=m;var o,s=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:n.nextTick;m.WritableState=g;var a=Object.create(r(8));a.inherits=r(3);var c={deprecate:r(47)},l=r(25),u=r(14).Buffer,f=global.Uint8Array||function(){};var h,d=r(26);function p(){}function g(e,t){o=o||r(4),e=e||{};var a=t instanceof o;this.objectMode=!!e.objectMode,a&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var c=e.highWaterMark,l=e.writableHighWaterMark,u=this.objectMode?16:16384;this.highWaterMark=c||0===c?c:a&&(l||0===l)?l:u,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===e.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,i=r.sync,o=r.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,i,o){--t.pendingcb,r?(n.nextTick(o,i),n.nextTick(k,e,t),e._writableState.errorEmitted=!0,e.emit("error",i)):(o(i),e._writableState.errorEmitted=!0,e.emit("error",i),k(e,t))}(e,r,i,t,o);else{var a=v(r);a||r.corked||r.bufferProcessing||!r.bufferedRequest||y(e,r),i?s(w,e,r,a,o):w(e,r,a,o)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function m(e){if(o=o||r(4),!(h.call(m,this)||this instanceof o))return new m(e);this._writableState=new g(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),l.call(this)}function b(e,t,r,n,i,o,s){t.writelen=n,t.writecb=s,t.writing=!0,t.sync=!0,r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function w(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),k(e,t)}function y(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,o=new Array(n),s=t.corkedRequestsFree;s.entry=r;for(var a=0,c=!0;r;)o[a]=r,r.isBuf||(c=!1),r=r.next,a+=1;o.allBuffers=c,b(e,t,!0,t.length,o,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new i(t),t.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,u=r.encoding,f=r.callback;if(b(e,t,!1,t.objectMode?1:l.length,l,u,f),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function v(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function _(e,t){e._final((function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),k(e,t)}))}function k(e,t){var r=v(t);return r&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,n.nextTick(_,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),r}a.inherits(m,l),g.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(g.prototype,"buffer",{get:c.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(h=Function.prototype[Symbol.hasInstance],Object.defineProperty(m,Symbol.hasInstance,{value:function(e){return!!h.call(this,e)||this===m&&(e&&e._writableState instanceof g)}})):h=function(e){return e instanceof this},m.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},m.prototype.write=function(e,t,r){var i,o=this._writableState,s=!1,a=!o.objectMode&&(i=e,u.isBuffer(i)||i instanceof f);return a&&!u.isBuffer(e)&&(e=function(e){return u.from(e)}(e)),"function"==typeof t&&(r=t,t=null),a?t="buffer":t||(t=o.defaultEncoding),"function"!=typeof r&&(r=p),o.ended?function(e,t){var r=new Error("write after end");e.emit("error",r),n.nextTick(t,r)}(this,r):(a||function(e,t,r,i){var o=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),n.nextTick(i,s),o=!1),o}(this,o,e,r))&&(o.pendingcb++,s=function(e,t,r,n,i,o){if(!r){var s=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=u.from(t,r));return t}(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var c=t.length<t.highWaterMark;c||(t.needDrain=!0);if(t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else b(e,t,!1,a,n,i,o);return c}(this,o,a,e,t,r)),s},m.prototype.cork=function(){this._writableState.corked++},m.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||y(this,e))},m.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(m.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),m.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},m.prototype._writev=null,m.prototype.end=function(e,t,r){var i=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||i.finished||function(e,t,r){t.ending=!0,k(e,t),r&&(t.finished?n.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,i,r)},Object.defineProperty(m.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),m.prototype.destroy=d.destroy,m.prototype._undestroy=d.undestroy,m.prototype._destroy=function(e,t){this.end(),t(e)}},function(e,t,r){"use strict";var n=r(14).Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=c,this.end=l,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=u,this.end=f,t=3;break;default:return this.write=h,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function l(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function u(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}t.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},o.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},o.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var i=s(t[n]);if(i>=0)return i>0&&(e.lastNeed=i-1),i;if(--n<r||-2===i)return 0;if((i=s(t[n]))>=0)return i>0&&(e.lastNeed=i-2),i;if(--n<r||-2===i)return 0;if((i=s(t[n]))>=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,r){"use strict";e.exports=s;var n=r(4),i=Object.create(r(8));function o(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function s(e){if(!(this instanceof s))return new s(e);n.call(this,e),this._transformState={afterTransform:o.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",a)}function a(){var e=this;"function"==typeof this._flush?this._flush((function(t,r){c(e,t,r)})):c(this,null,null)}function c(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}i.inherits=r(3),i.inherits(s,n),s.prototype.push=function(e,t){return this._transformState.needTransform=!1,n.prototype.push.call(this,e,t)},s.prototype._transform=function(e,t,r){throw new Error("_transform() is not implemented")},s.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},s.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},s.prototype._destroy=function(e,t){var r=this;n.prototype._destroy.call(this,e,(function(e){t(e),r.emit("close")}))}},function(e,t,r){"use strict";(function(e){var n=r(70),i=r(21),o=r(20);const s="undefined"!=typeof navigator?navigator.hardwareConcurrency:null;t.a=class{constructor(t=s){const r=new n.a(e);this.pool=Object(i.a)(()=>Object(o.a)(r),t)}async decode(e,t){return new Promise((r,n)=>{this.pool.queue(async i=>{try{const n=await i(e,t);r(n)}catch(e){n(e)}})})}destroy(){this.pool.terminate(!0)}}}).call(this,r(59))},function(e,t,r){e.exports=function(e){function t(e){let r,i,o,s=null;function a(...e){if(!a.enabled)return;const n=a,i=Number(new Date),o=i-(r||i);n.diff=o,n.prev=r,n.curr=i,r=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(r,i)=>{if("%%"===r)return"%";s++;const o=t.formatters[i];if("function"==typeof o){const t=e[s];r=o.call(n,t),e.splice(s,1),s--}return r}),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=n,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(i!==t.namespaces&&(i=t.namespaces,o=t.enabled(e)),o),set:e=>{s=e}}),"function"==typeof t.init&&t.init(a),a}function n(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\\.\\*\\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(i),...t.skips.map(i).map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\\s,]+/),i=n.length;for(r=0;r<i;r++)n[r]&&("-"===(e=n[r].replace(/\\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=r(63),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(r=>{t[r]=e[r]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=function(e,t){return new Promise((function(r,l){try{t&&console.log("starting parseData with",e),t&&console.log("\\tGeoTIFF:","undefined"==typeof GeoTIFF?"undefined":i(GeoTIFF));var u={},f=void 0,h=void 0;if("object"===e.rasterType)u.values=e.data,u.height=f=e.metadata.height||u.values[0].length,u.width=h=e.metadata.width||u.values[0][0].length,u.pixelHeight=e.metadata.pixelHeight,u.pixelWidth=e.metadata.pixelWidth,u.projection=e.metadata.projection,u.xmin=e.metadata.xmin,u.ymax=e.metadata.ymax,u.noDataValue=e.metadata.noDataValue,u.numberOfRasters=u.values.length,u.xmax=u.xmin+u.width*u.pixelWidth,u.ymin=u.ymax-u.height*u.pixelHeight,u._data=null,r(c(u));else if("geotiff"===e.rasterType){u._data=e.data;var d=o.fromArrayBuffer;"url"===e.sourceType&&(d=o.fromUrl),t&&console.log("data.rasterType is geotiff"),r(d(e.data).then((function(r){return t&&console.log("geotiff:",r),r.getImage().then((function(r){try{t&&console.log("image:",r);var i=r.fileDirectory,o=r.getGeoKeys(),d=o.GeographicTypeGeoKey,p=o.ProjectedCSTypeGeoKey;u.projection=p||d,t&&console.log("projection:",u.projection),u.height=f=r.getHeight(),t&&console.log("result.height:",u.height),u.width=h=r.getWidth(),t&&console.log("result.width:",u.width);var g=r.getResolution(),m=n(g,2),b=m[0],w=m[1];u.pixelHeight=Math.abs(w),u.pixelWidth=Math.abs(b);var y=r.getOrigin(),v=n(y,2),_=v[0],k=v[1];return u.xmin=_,u.xmax=u.xmin+h*u.pixelWidth,u.ymax=k,u.ymin=u.ymax-f*u.pixelHeight,u.noDataValue=i.GDAL_NODATA?parseFloat(i.GDAL_NODATA):null,u.numberOfRasters=i.SamplesPerPixel,i.ColorMap&&(u.palette=(0,s.getPalette)(r)),"url"!==e.sourceType?r.readRasters().then((function(e){return u.values=e.map((function(e){return(0,a.unflatten)(e,{height:f,width:h})})),c(u)})):u}catch(e){l(e),console.error("[georaster] error parsing georaster:",e)}}))})))}}catch(e){l(e),console.error("[georaster] error parsing georaster:",e)}}))};var o=r(69),s=r(67),a=r(68);function c(e,t){var r=e.noDataValue,n=e.height,i=e.width;return new Promise((function(o,s){e.maxs=[],e.mins=[],e.ranges=[];for(var a=void 0,c=void 0,l=0;l<e.numberOfRasters;l++){var u=e.values[l];t&&console.log("[georaster] rows:",u);for(var f=0;f<n;f++)for(var h=u[f],d=0;d<i;d++){var p=h[d];p==r||isNaN(p)||(void 0===c||p<c?c=p:(void 0===a||p>a)&&(a=p))}e.maxs.push(a),e.mins.push(c),e.ranges.push(a-c)}o(e)}))}},function(e,t,r){function n(e,t){"use strict";var r=(t=t||{}).pos||0,i="<".charCodeAt(0),o=">".charCodeAt(0),s="-".charCodeAt(0),a="/".charCodeAt(0),c="!".charCodeAt(0),l="\'".charCodeAt(0),u=\'"\'.charCodeAt(0);function f(){for(var t=[];e[r];)if(e.charCodeAt(r)==i){if(e.charCodeAt(r+1)===a)return(r=e.indexOf(">",r))+1&&(r+=1),t;if(e.charCodeAt(r+1)===c){if(e.charCodeAt(r+2)==s){for(;-1!==r&&(e.charCodeAt(r)!==o||e.charCodeAt(r-1)!=s||e.charCodeAt(r-2)!=s||-1==r);)r=e.indexOf(">",r+1);-1===r&&(r=e.length)}else for(r+=2;e.charCodeAt(r)!==o&&e[r];)r++;r++;continue}var n=g();t.push(n)}else{var l=h();l.trim().length>0&&t.push(l),r++}return t}function h(){var t=r;return-2===(r=e.indexOf("<",r)-1)&&(r=e.length),e.slice(t,r+1)}function d(){for(var t=r;-1==="\\n\\t>/= ".indexOf(e[r])&&e[r];)r++;return e.slice(t,r)}var p=t.noChildNodes||["img","br","input","meta","link"];function g(){r++;const t=d(),n={};let i=[];for(;e.charCodeAt(r)!==o&&e[r];){var s=e.charCodeAt(r);if(s>64&&s<91||s>96&&s<123){for(var c=d(),h=e.charCodeAt(r);h&&h!==l&&h!==u&&!(h>64&&h<91||h>96&&h<123)&&h!==o;)r++,h=e.charCodeAt(r);if(h===l||h===u){var g=m();if(-1===r)return{tagName:t,attributes:n,children:i}}else g=null,r--;n[c]=g}r++}if(e.charCodeAt(r-1)!==a)if("script"==t){var b=r+1;r=e.indexOf("<\\/script>",r),i=[e.slice(b,r-1)],r+=9}else if("style"==t){b=r+1;r=e.indexOf("</style>",r),i=[e.slice(b,r-1)],r+=8}else-1==p.indexOf(t)&&(r++,i=f());else r++;return{tagName:t,attributes:n,children:i}}function m(){var t=e[r],n=++r;return r=e.indexOf(t,n),e.slice(n,r)}var b,w=null;if(void 0!==t.attrValue){t.attrName=t.attrName||"id";for(w=[];-1!==(b=void 0,b=new RegExp("\\\\s"+t.attrName+"\\\\s*=[\'\\"]"+t.attrValue+"[\'\\"]").exec(e),r=b?b.index:-1);)-1!==(r=e.lastIndexOf("<",r))&&w.push(g()),e=e.substr(r),r=0}else w=t.parseNode?g():f();return t.filter&&(w=n.filter(w,t.filter)),t.setPos&&(w.pos=r),w}n.simplify=function(e){var t={};if(!e.length)return"";if(1===e.length&&"string"==typeof e[0])return e[0];for(var r in e.forEach((function(e){if("object"==typeof e){t[e.tagName]||(t[e.tagName]=[]);var r=n.simplify(e.children||[]);t[e.tagName].push(r),e.attributes&&(r._attributes=e.attributes)}})),t)1==t[r].length&&(t[r]=t[r][0]);return t},n.filter=function(e,t){var r=[];return e.forEach((function(e){if("object"==typeof e&&t(e)&&r.push(e),e.children){var i=n.filter(e.children,t);r=r.concat(i)}})),r},n.stringify=function(e){var t="";function r(e){if(e)for(var r=0;r<e.length;r++)"string"==typeof e[r]?t+=e[r].trim():n(e[r])}function n(e){for(var n in t+="<"+e.tagName,e.attributes)null===e.attributes[n]?t+=" "+n:-1===e.attributes[n].indexOf(\'"\')?t+=" "+n+\'="\'+e.attributes[n].trim()+\'"\':t+=" "+n+"=\'"+e.attributes[n].trim()+"\'";t+=">",r(e.children),t+="</"+e.tagName+">"}return r(e),t},n.toContentString=function(e){if(Array.isArray(e)){var t="";return e.forEach((function(e){t=(t+=" "+n.toContentString(e)).trim()})),t}return"object"==typeof e?n.toContentString(e.children):" "+e},n.getElementById=function(e,t,r){var i=n(e,{attrValue:t});return r?n.simplify(i):i[0]},n.getElementsByClassName=function(e,t,r){const i=n(e,{attrName:"class",attrValue:"[a-zA-Z0-9-s ]*"+t+"[a-zA-Z0-9-s ]*"});return r?n.simplify(i):i},n.parseStream=function(e,t){if("string"==typeof t&&(t=t.length+2),"string"==typeof e){var i=r(12);e=i.createReadStream(e,{start:t}),t=0}var o=t,s="";return e.on("data",(function(t){s+=t;for(var r=0;;){if(!(o=s.indexOf("<",o)+1))return void(o=r);if("/"!==s[o+1]){var i=n(s,{pos:o-1,parseNode:!0,setPos:!0});if((o=i.pos)>s.length-1||o<r)return s=s.slice(r),o=0,void(r=0);e.emit("xml",i),r=o}else o+=1,r=pos}})),e.on("end",(function(){console.log("end")})),e},n.transformStream=function(e){const t=r(42);"string"==typeof e&&(e=e.length+2);var i=e||0,o="";return t({readableObjectMode:!0},(function(e,t,r){o+=e;for(var s=0;;){if(!(i=o.indexOf("<",i)+1))return i=s,r();if("/"!==o[i+1]){var a=n(o,{pos:i-1,parseNode:!0,setPos:!0});if((i=a.pos)>o.length-1||i<s)return o=o.slice(s),i=0,s=0,r();this.push(a),s=i}else i+=1,s=pos}r()}))},e.exports=n,n.xml=n},function(e,t,r){"use strict";var n=r(49),i=r(15),o=r(54),s=r(55),a=r(56),c=r(57),l=r(58),u=Object.prototype.toString;function f(e){if(!(this instanceof f))return new f(e);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var r=n.inflateInit2(this.strm,t.windowBits);if(r!==s.Z_OK)throw new Error(a[r]);if(this.header=new l,n.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=o.string2buf(t.dictionary):"[object ArrayBuffer]"===u.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=n.inflateSetDictionary(this.strm,t.dictionary))!==s.Z_OK))throw new Error(a[r])}function h(e,t){var r=new f(t);if(r.push(e,!0),r.err)throw r.msg||a[r.err];return r.result}f.prototype.push=function(e,t){var r,a,c,l,f,h=this.strm,d=this.options.chunkSize,p=this.options.dictionary,g=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?s.Z_FINISH:s.Z_NO_FLUSH,"string"==typeof e?h.input=o.binstring2buf(e):"[object ArrayBuffer]"===u.call(e)?h.input=new Uint8Array(e):h.input=e,h.next_in=0,h.avail_in=h.input.length;do{if(0===h.avail_out&&(h.output=new i.Buf8(d),h.next_out=0,h.avail_out=d),(r=n.inflate(h,s.Z_NO_FLUSH))===s.Z_NEED_DICT&&p&&(r=n.inflateSetDictionary(this.strm,p)),r===s.Z_BUF_ERROR&&!0===g&&(r=s.Z_OK,g=!1),r!==s.Z_STREAM_END&&r!==s.Z_OK)return this.onEnd(r),this.ended=!0,!1;h.next_out&&(0!==h.avail_out&&r!==s.Z_STREAM_END&&(0!==h.avail_in||a!==s.Z_FINISH&&a!==s.Z_SYNC_FLUSH)||("string"===this.options.to?(c=o.utf8border(h.output,h.next_out),l=h.next_out-c,f=o.buf2string(h.output,c),h.next_out=l,h.avail_out=d-l,l&&i.arraySet(h.output,h.output,c,l,0),this.onData(f)):this.onData(i.shrinkBuf(h.output,h.next_out)))),0===h.avail_in&&0===h.avail_out&&(g=!0)}while((h.avail_in>0||0===h.avail_out)&&r!==s.Z_STREAM_END);return r===s.Z_STREAM_END&&(a=s.Z_FINISH),a===s.Z_FINISH?(r=n.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===s.Z_OK):a!==s.Z_SYNC_FLUSH||(this.onEnd(s.Z_OK),h.avail_out=0,!0)},f.prototype.onData=function(e){this.chunks.push(e)},f.prototype.onEnd=function(e){e===s.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Inflate=f,t.inflate=h,t.inflateRaw=function(e,t){return(t=t||{}).raw=!0,h(e,t)},t.ungzip=h},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,"defaultPoolSize",(function(){return defaultPoolSize})),__webpack_require__.d(__webpack_exports__,"getWorkerImplementation",(function(){return getWorkerImplementation})),__webpack_require__.d(__webpack_exports__,"isWorkerRuntime",(function(){return isWorkerRuntime}));var callsites__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(36),callsites__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(callsites__WEBPACK_IMPORTED_MODULE_0__),events__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(19),events__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(events__WEBPACK_IMPORTED_MODULE_1__),os__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(37),os__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__.n(os__WEBPACK_IMPORTED_MODULE_2__),path__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(6),path__WEBPACK_IMPORTED_MODULE_3___default=__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__),url__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(16),url__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(url__WEBPACK_IMPORTED_MODULE_4__);let tsNodeAvailable;const defaultPoolSize=Object(os__WEBPACK_IMPORTED_MODULE_2__.cpus)().length;function detectTsNode(){if("function"==typeof require)return!1;if(tsNodeAvailable)return tsNodeAvailable;try{eval("require").resolve("ts-node"),tsNodeAvailable=!0}catch(e){if(!e||"MODULE_NOT_FOUND"!==e.code)throw e;tsNodeAvailable=!1}return tsNodeAvailable}function createTsNodeModule(e){return`\\n require("ts-node/register/transpile-only");\\n require(${JSON.stringify(e)});\\n `}function rebaseScriptPath(e,t){const r=callsites__WEBPACK_IMPORTED_MODULE_0___default()().find(e=>{const r=e.getFileName();return Boolean(r&&!r.match(t)&&!r.match(/[\\/\\\\]master[\\/\\\\]implementation/)&&!r.match(/^internal\\/process/))}),n=r?r.getFileName():null;let i=n||null;i&&i.startsWith("file:")&&(i=Object(url__WEBPACK_IMPORTED_MODULE_4__.fileURLToPath)(i));return i?path__WEBPACK_IMPORTED_MODULE_3__.join(path__WEBPACK_IMPORTED_MODULE_3__.dirname(i),e):e}function resolveScriptPath(scriptPath,baseURL){const makeRelative=filePath=>path__WEBPACK_IMPORTED_MODULE_3__.isAbsolute(filePath)?filePath:path__WEBPACK_IMPORTED_MODULE_3__.join(baseURL||eval("__dirname"),filePath),workerFilePath="function"==typeof require?require.resolve(makeRelative(scriptPath)):eval("require").resolve(makeRelative(rebaseScriptPath(scriptPath,/[\\/\\\\]worker_threads[\\/\\\\]/)));return workerFilePath}function initWorkerThreadsWorker(){const NativeWorker="function"==typeof require?require("worker_threads").Worker:eval("require")("worker_threads").Worker;let allWorkers=[];class Worker extends NativeWorker{constructor(e,t){const r=t&&t.fromSource?null:resolveScriptPath(e,(t||{})._baseURL);if(r)r.match(/\\.tsx?$/i)&&detectTsNode()?super(createTsNodeModule(r),Object.assign(Object.assign({},t),{eval:!0})):r.match(/\\.asar[\\/\\\\]/)?super(r.replace(/\\.asar([\\/\\\\])/,".asar.unpacked$1"),t):super(r,t);else{super(e,Object.assign(Object.assign({},t),{eval:!0}))}this.mappedEventListeners=new WeakMap,allWorkers.push(this)}addEventListener(e,t){const r=e=>{t({data:e})};this.mappedEventListeners.set(t,r),this.on(e,r)}removeEventListener(e,t){const r=this.mappedEventListeners.get(t)||t;this.off(e,r)}}const terminateWorkersAndMaster=()=>{Promise.all(allWorkers.map(e=>e.terminate())).then(()=>process.exit(0),()=>process.exit(1)),allWorkers=[]};process.on("SIGINT",()=>terminateWorkersAndMaster()),process.on("SIGTERM",()=>terminateWorkersAndMaster());class BlobWorker extends Worker{constructor(e,t){super(Buffer.from(e).toString("utf-8"),Object.assign(Object.assign({},t),{fromSource:!0}))}static fromText(e,t){return new Worker(e,Object.assign(Object.assign({},t),{fromSource:!0}))}}return{blob:BlobWorker,default:Worker}}function initTinyWorker(){const e=__webpack_require__(60);let t=[];class r extends e{constructor(e,r){const n=r&&r.fromSource?null:"win32"===process.platform?"file:///"+resolveScriptPath(e).replace(/\\\\/g,"/"):resolveScriptPath(e);if(n)n.match(/\\.tsx?$/i)&&detectTsNode()?super(new Function(createTsNodeModule(resolveScriptPath(e))),[],{esm:!0}):n.match(/\\.asar[\\/\\\\]/)?super(n.replace(/\\.asar([\\/\\\\])/,".asar.unpacked$1"),[],{esm:!0}):super(n,[],{esm:!0});else{super(new Function(e),[],{esm:!0})}t.push(this),this.emitter=new events__WEBPACK_IMPORTED_MODULE_1__.EventEmitter,this.onerror=e=>this.emitter.emit("error",e),this.onmessage=e=>this.emitter.emit("message",e)}addEventListener(e,t){this.emitter.addListener(e,t)}removeEventListener(e,t){this.emitter.removeListener(e,t)}terminate(){return t=t.filter(e=>e!==this),super.terminate()}}const n=()=>{Promise.all(t.map(e=>e.terminate())).then(()=>process.exit(0),()=>process.exit(1)),t=[]};process.on("SIGINT",()=>n()),process.on("SIGTERM",()=>n());return{blob:class extends r{constructor(e,t){super(Buffer.from(e).toString("utf-8"),Object.assign(Object.assign({},t),{fromSource:!0}))}static fromText(e,t){return new r(e,Object.assign(Object.assign({},t),{fromSource:!0}))}},default:r}}let implementation,isTinyWorker;function selectWorkerImplementation(){try{return isTinyWorker=!1,initWorkerThreadsWorker()}catch(e){return console.debug("Node worker_threads not available. Trying to fall back to tiny-worker polyfill..."),isTinyWorker=!0,initTinyWorker()}}function getWorkerImplementation(){return implementation||(implementation=selectWorkerImplementation()),implementation}function isWorkerRuntime(){if(isTinyWorker)return!("undefined"==typeof self||!self.postMessage);{const isMainThread="function"==typeof require?require("worker_threads").isMainThread:eval("require")("worker_threads").isMainThread;return!isMainThread}}},function(e,t,r){"use strict";const n=()=>{const e=Error.prepareStackTrace;Error.prepareStackTrace=(e,t)=>t;const t=(new Error).stack.slice(1);return Error.prepareStackTrace=e,t};e.exports=n,e.exports.default=n},function(e,t){e.exports=require("os")},function(e,t,r){"use strict";var n=r(17);class i extends n.a{constructor(){super(e=>(this._observers.add(e),()=>this._observers.delete(e))),this._observers=new Set}next(e){for(const t of this._observers)t.next(e)}error(e){for(const t of this._observers)t.error(e)}complete(){for(const e of this._observers)e.complete()}}t.a=i},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(0);function i(e){return e&&"object"==typeof e&&e[n.d]}},function(e,t){e.exports=require("https")},function(e,t,r){"use strict";r.r(t);var n=r(32),i=r.n(n);self;onmessage=e=>{const t=e.data;i()(t).then(e=>{e._data instanceof ArrayBuffer?postMessage(e,[e._data]):postMessage(e),close()})}},function(e,t,r){var n=r(43).Transform,i=r(3);function o(e){n.call(this,e),this._destroyed=!1}function s(e,t,r){r(null,e)}function a(e){return function(t,r,n){return"function"==typeof t&&(n=r,r=t,t={}),"function"!=typeof r&&(r=s),"function"!=typeof n&&(n=null),e(t,r,n)}}i(o,n),o.prototype.destroy=function(e){if(!this._destroyed){this._destroyed=!0;var t=this;process.nextTick((function(){e&&t.emit("error",e),t.emit("close")}))}},e.exports=a((function(e,t,r){var n=new o(e);return n._transform=t,r&&(n._flush=r),n})),e.exports.ctor=a((function(e,t,r){function n(t){if(!(this instanceof n))return new n(t);this.options=Object.assign({},e,t),o.call(this,this.options)}return i(n,o),n.prototype._transform=t,r&&(n.prototype._flush=r),n})),e.exports.obj=a((function(e,t,r){var n=new o(Object.assign({objectMode:!0,highWaterMark:16},e));return n._transform=t,r&&(n._flush=r),n}))},function(e,t,r){var n=r(23);"disable"===process.env.READABLE_STREAM&&n?(e.exports=n,(t=e.exports=n.Readable).Readable=n.Readable,t.Writable=n.Writable,t.Duplex=n.Duplex,t.Transform=n.Transform,t.PassThrough=n.PassThrough,t.Stream=n):((t=e.exports=r(24)).Stream=n||t,t.Readable=t,t.Writable=r(27),t.Duplex=r(4),t.Transform=r(29),t.PassThrough=r(48))},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},function(e,t,r){"use strict";var n=r(14).Buffer,i=r(9);e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},e.prototype.concat=function(e){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var t,r,i,o=n.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,r=o,i=a,t.copy(r,i),a+=s.data.length,s=s.next;return o},e}(),i&&i.inspect&&i.inspect.custom&&(e.exports.prototype[i.inspect.custom]=function(){var e=i.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t,r){e.exports=r(9).deprecate},function(e,t,r){"use strict";e.exports=o;var n=r(29),i=Object.create(r(8));function o(e){if(!(this instanceof o))return new o(e);n.call(this,e)}i.inherits=r(3),i.inherits(o,n),o.prototype._transform=function(e,t,r){r(null,e)}},function(e,t,r){"use strict";var n=r(15),i=r(50),o=r(51),s=r(52),a=r(53);function c(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function l(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function u(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new n.Buf32(852),t.distcode=t.distdyn=new n.Buf32(592),t.sane=1,t.back=-1,0):-2}function f(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,u(e)):-2}function h(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?-2:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,f(e))):-2}function d(e,t){var r,n;return e?(n=new l,e.state=n,n.window=null,0!==(r=h(e,t))&&(e.state=null),r):-2}var p,g,m=!0;function b(e){if(m){var t;for(p=new n.Buf32(512),g=new n.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(a(1,e.lens,0,288,p,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(2,e.lens,0,32,g,0,e.work,{bits:5}),m=!1}e.lencode=p,e.lenbits=9,e.distcode=g,e.distbits=5}function w(e,t,r,i){var o,s=e.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new n.Buf8(s.wsize)),i>=s.wsize?(n.arraySet(s.window,t,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):((o=s.wsize-s.wnext)>i&&(o=i),n.arraySet(s.window,t,r-i,o,s.wnext),(i-=o)?(n.arraySet(s.window,t,r-i,i,0),s.wnext=i,s.whave=s.wsize):(s.wnext+=o,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=o))),0}t.inflateReset=f,t.inflateReset2=h,t.inflateResetKeep=u,t.inflateInit=function(e){return d(e,15)},t.inflateInit2=d,t.inflate=function(e,t){var r,l,u,f,h,d,p,g,m,y,v,_,k,S,x,C,E,T,O,A,P,I,D,M,R=0,F=new n.Buf8(4),j=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return-2;12===(r=e.state).mode&&(r.mode=13),h=e.next_out,u=e.output,p=e.avail_out,f=e.next_in,l=e.input,d=e.avail_in,g=r.hold,m=r.bits,y=d,v=p,I=0;e:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;m<16;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}if(2&r.wrap&&35615===g){r.check=0,F[0]=255&g,F[1]=g>>>8&255,r.check=o(r.check,F,2,0),g=0,m=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&g)<<8)+(g>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&g)){e.msg="unknown compression method",r.mode=30;break}if(m-=4,P=8+(15&(g>>>=4)),0===r.wbits)r.wbits=P;else if(P>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<<P,e.adler=r.check=1,r.mode=512&g?10:12,g=0,m=0;break;case 2:for(;m<16;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}if(r.flags=g,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=30;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=30;break}r.head&&(r.head.text=g>>8&1),512&r.flags&&(F[0]=255&g,F[1]=g>>>8&255,r.check=o(r.check,F,2,0)),g=0,m=0,r.mode=3;case 3:for(;m<32;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}r.head&&(r.head.time=g),512&r.flags&&(F[0]=255&g,F[1]=g>>>8&255,F[2]=g>>>16&255,F[3]=g>>>24&255,r.check=o(r.check,F,4,0)),g=0,m=0,r.mode=4;case 4:for(;m<16;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}r.head&&(r.head.xflags=255&g,r.head.os=g>>8),512&r.flags&&(F[0]=255&g,F[1]=g>>>8&255,r.check=o(r.check,F,2,0)),g=0,m=0,r.mode=5;case 5:if(1024&r.flags){for(;m<16;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}r.length=g,r.head&&(r.head.extra_len=g),512&r.flags&&(F[0]=255&g,F[1]=g>>>8&255,r.check=o(r.check,F,2,0)),g=0,m=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((_=r.length)>d&&(_=d),_&&(r.head&&(P=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),n.arraySet(r.head.extra,l,f,_,P)),512&r.flags&&(r.check=o(r.check,l,_,f)),d-=_,f+=_,r.length-=_),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===d)break e;_=0;do{P=l[f+_++],r.head&&P&&r.length<65536&&(r.head.name+=String.fromCharCode(P))}while(P&&_<d);if(512&r.flags&&(r.check=o(r.check,l,_,f)),d-=_,f+=_,P)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===d)break e;_=0;do{P=l[f+_++],r.head&&P&&r.length<65536&&(r.head.comment+=String.fromCharCode(P))}while(P&&_<d);if(512&r.flags&&(r.check=o(r.check,l,_,f)),d-=_,f+=_,P)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;m<16;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}if(g!==(65535&r.check)){e.msg="header crc mismatch",r.mode=30;break}g=0,m=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;m<32;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}e.adler=r.check=c(g),g=0,m=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=h,e.avail_out=p,e.next_in=f,e.avail_in=d,r.hold=g,r.bits=m,2;e.adler=r.check=1,r.mode=12;case 12:if(5===t||6===t)break e;case 13:if(r.last){g>>>=7&m,m-=7&m,r.mode=27;break}for(;m<3;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}switch(r.last=1&g,m-=1,3&(g>>>=1)){case 0:r.mode=14;break;case 1:if(b(r),r.mode=20,6===t){g>>>=2,m-=2;break e}break;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}g>>>=2,m-=2;break;case 14:for(g>>>=7&m,m-=7&m;m<32;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}if((65535&g)!=(g>>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&g,g=0,m=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(_=r.length){if(_>d&&(_=d),_>p&&(_=p),0===_)break e;n.arraySet(u,l,f,_,h),d-=_,f+=_,p-=_,h+=_,r.length-=_;break}r.mode=12;break;case 17:for(;m<14;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}if(r.nlen=257+(31&g),g>>>=5,m-=5,r.ndist=1+(31&g),g>>>=5,m-=5,r.ncode=4+(15&g),g>>>=4,m-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=30;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;m<3;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}r.lens[j[r.have++]]=7&g,g>>>=3,m-=3}for(;r.have<19;)r.lens[j[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,D={bits:r.lenbits},I=a(0,r.lens,0,19,r.lencode,0,r.work,D),r.lenbits=D.bits,I){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;C=(R=r.lencode[g&(1<<r.lenbits)-1])>>>16&255,E=65535&R,!((x=R>>>24)<=m);){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}if(E<16)g>>>=x,m-=x,r.lens[r.have++]=E;else{if(16===E){for(M=x+2;m<M;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}if(g>>>=x,m-=x,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}P=r.lens[r.have-1],_=3+(3&g),g>>>=2,m-=2}else if(17===E){for(M=x+3;m<M;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}m-=x,P=0,_=3+(7&(g>>>=x)),g>>>=3,m-=3}else{for(M=x+7;m<M;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}m-=x,P=0,_=11+(127&(g>>>=x)),g>>>=7,m-=7}if(r.have+_>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;_--;)r.lens[r.have++]=P}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,D={bits:r.lenbits},I=a(1,r.lens,0,r.nlen,r.lencode,0,r.work,D),r.lenbits=D.bits,I){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,D={bits:r.distbits},I=a(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,D),r.distbits=D.bits,I){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(d>=6&&p>=258){e.next_out=h,e.avail_out=p,e.next_in=f,e.avail_in=d,r.hold=g,r.bits=m,s(e,v),h=e.next_out,u=e.output,p=e.avail_out,f=e.next_in,l=e.input,d=e.avail_in,g=r.hold,m=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;C=(R=r.lencode[g&(1<<r.lenbits)-1])>>>16&255,E=65535&R,!((x=R>>>24)<=m);){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}if(C&&0==(240&C)){for(T=x,O=C,A=E;C=(R=r.lencode[A+((g&(1<<T+O)-1)>>T)])>>>16&255,E=65535&R,!(T+(x=R>>>24)<=m);){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}g>>>=T,m-=T,r.back+=T}if(g>>>=x,m-=x,r.back+=x,r.length=E,0===C){r.mode=26;break}if(32&C){r.back=-1,r.mode=12;break}if(64&C){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&C,r.mode=22;case 22:if(r.extra){for(M=r.extra;m<M;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}r.length+=g&(1<<r.extra)-1,g>>>=r.extra,m-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;C=(R=r.distcode[g&(1<<r.distbits)-1])>>>16&255,E=65535&R,!((x=R>>>24)<=m);){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}if(0==(240&C)){for(T=x,O=C,A=E;C=(R=r.distcode[A+((g&(1<<T+O)-1)>>T)])>>>16&255,E=65535&R,!(T+(x=R>>>24)<=m);){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}g>>>=T,m-=T,r.back+=T}if(g>>>=x,m-=x,r.back+=x,64&C){e.msg="invalid distance code",r.mode=30;break}r.offset=E,r.extra=15&C,r.mode=24;case 24:if(r.extra){for(M=r.extra;m<M;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}r.offset+=g&(1<<r.extra)-1,g>>>=r.extra,m-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===p)break e;if(_=v-p,r.offset>_){if((_=r.offset-_)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}_>r.wnext?(_-=r.wnext,k=r.wsize-_):k=r.wnext-_,_>r.length&&(_=r.length),S=r.window}else S=u,k=h-r.offset,_=r.length;_>p&&(_=p),p-=_,r.length-=_;do{u[h++]=S[k++]}while(--_);0===r.length&&(r.mode=21);break;case 26:if(0===p)break e;u[h++]=r.length,p--,r.mode=21;break;case 27:if(r.wrap){for(;m<32;){if(0===d)break e;d--,g|=l[f++]<<m,m+=8}if(v-=p,e.total_out+=v,r.total+=v,v&&(e.adler=r.check=r.flags?o(r.check,u,v,h-v):i(r.check,u,v,h-v)),v=p,(r.flags?g:c(g))!==r.check){e.msg="incorrect data check",r.mode=30;break}g=0,m=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;m<32;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}if(g!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=30;break}g=0,m=0}r.mode=29;case 29:I=1;break e;case 30:I=-3;break e;case 31:return-4;case 32:default:return-2}return e.next_out=h,e.avail_out=p,e.next_in=f,e.avail_in=d,r.hold=g,r.bits=m,(r.wsize||v!==e.avail_out&&r.mode<30&&(r.mode<27||4!==t))&&w(e,e.output,e.next_out,v-e.avail_out)?(r.mode=31,-4):(y-=e.avail_in,v-=e.avail_out,e.total_in+=y,e.total_out+=v,r.total+=v,r.wrap&&v&&(e.adler=r.check=r.flags?o(r.check,u,v,e.next_out-v):i(r.check,u,v,e.next_out-v)),e.data_type=r.bits+(r.last?64:0)+(12===r.mode?128:0)+(20===r.mode||15===r.mode?256:0),(0===y&&0===v||4===t)&&0===I&&(I=-5),I)},t.inflateEnd=function(e){if(!e||!e.state)return-2;var t=e.state;return t.window&&(t.window=null),e.state=null,0},t.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?-2:(r.head=t,t.done=!1,0):-2},t.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?-2:11===r.mode&&i(1,t,n,0)!==r.check?-3:w(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,0):-2},t.inflateInfo="pako inflate (from Nodeca project)"},function(e,t,r){"use strict";e.exports=function(e,t,r,n){for(var i=65535&e|0,o=e>>>16&65535|0,s=0;0!==r;){r-=s=r>2e3?2e3:r;do{o=o+(i=i+t[n++]|0)|0}while(--s);i%=65521,o%=65521}return i|o<<16|0}},function(e,t,r){"use strict";var n=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();e.exports=function(e,t,r,i){var o=n,s=i+r;e^=-1;for(var a=i;a<s;a++)e=e>>>8^o[255&(e^t[a])];return-1^e}},function(e,t,r){"use strict";e.exports=function(e,t){var r,n,i,o,s,a,c,l,u,f,h,d,p,g,m,b,w,y,v,_,k,S,x,C,E;r=e.state,n=e.next_in,C=e.input,i=n+(e.avail_in-5),o=e.next_out,E=e.output,s=o-(t-e.avail_out),a=o+(e.avail_out-257),c=r.dmax,l=r.wsize,u=r.whave,f=r.wnext,h=r.window,d=r.hold,p=r.bits,g=r.lencode,m=r.distcode,b=(1<<r.lenbits)-1,w=(1<<r.distbits)-1;e:do{p<15&&(d+=C[n++]<<p,p+=8,d+=C[n++]<<p,p+=8),y=g[d&b];t:for(;;){if(d>>>=v=y>>>24,p-=v,0===(v=y>>>16&255))E[o++]=65535&y;else{if(!(16&v)){if(0==(64&v)){y=g[(65535&y)+(d&(1<<v)-1)];continue t}if(32&v){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}_=65535&y,(v&=15)&&(p<v&&(d+=C[n++]<<p,p+=8),_+=d&(1<<v)-1,d>>>=v,p-=v),p<15&&(d+=C[n++]<<p,p+=8,d+=C[n++]<<p,p+=8),y=m[d&w];r:for(;;){if(d>>>=v=y>>>24,p-=v,!(16&(v=y>>>16&255))){if(0==(64&v)){y=m[(65535&y)+(d&(1<<v)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(k=65535&y,p<(v&=15)&&(d+=C[n++]<<p,(p+=8)<v&&(d+=C[n++]<<p,p+=8)),(k+=d&(1<<v)-1)>c){e.msg="invalid distance too far back",r.mode=30;break e}if(d>>>=v,p-=v,k>(v=o-s)){if((v=k-v)>u&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(S=0,x=h,0===f){if(S+=l-v,v<_){_-=v;do{E[o++]=h[S++]}while(--v);S=o-k,x=E}}else if(f<v){if(S+=l+f-v,(v-=f)<_){_-=v;do{E[o++]=h[S++]}while(--v);if(S=0,f<_){_-=v=f;do{E[o++]=h[S++]}while(--v);S=o-k,x=E}}}else if(S+=f-v,v<_){_-=v;do{E[o++]=h[S++]}while(--v);S=o-k,x=E}for(;_>2;)E[o++]=x[S++],E[o++]=x[S++],E[o++]=x[S++],_-=3;_&&(E[o++]=x[S++],_>1&&(E[o++]=x[S++]))}else{S=o-k;do{E[o++]=E[S++],E[o++]=E[S++],E[o++]=E[S++],_-=3}while(_>2);_&&(E[o++]=E[S++],_>1&&(E[o++]=E[S++]))}break}}break}}while(n<i&&o<a);n-=_=p>>3,d&=(1<<(p-=_<<3))-1,e.next_in=n,e.next_out=o,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=o<a?a-o+257:257-(o-a),r.hold=d,r.bits=p}},function(e,t,r){"use strict";var n=r(15),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],s=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],a=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];e.exports=function(e,t,r,c,l,u,f,h){var d,p,g,m,b,w,y,v,_,k=h.bits,S=0,x=0,C=0,E=0,T=0,O=0,A=0,P=0,I=0,D=0,M=null,R=0,F=new n.Buf16(16),j=new n.Buf16(16),L=null,U=0;for(S=0;S<=15;S++)F[S]=0;for(x=0;x<c;x++)F[t[r+x]]++;for(T=k,E=15;E>=1&&0===F[E];E--);if(T>E&&(T=E),0===E)return l[u++]=20971520,l[u++]=20971520,h.bits=1,0;for(C=1;C<E&&0===F[C];C++);for(T<C&&(T=C),P=1,S=1;S<=15;S++)if(P<<=1,(P-=F[S])<0)return-1;if(P>0&&(0===e||1!==E))return-1;for(j[1]=0,S=1;S<15;S++)j[S+1]=j[S]+F[S];for(x=0;x<c;x++)0!==t[r+x]&&(f[j[t[r+x]]++]=x);if(0===e?(M=L=f,w=19):1===e?(M=i,R-=257,L=o,U-=257,w=256):(M=s,L=a,w=-1),D=0,x=0,S=C,b=u,O=T,A=0,g=-1,m=(I=1<<T)-1,1===e&&I>852||2===e&&I>592)return 1;for(;;){y=S-A,f[x]<w?(v=0,_=f[x]):f[x]>w?(v=L[U+f[x]],_=M[R+f[x]]):(v=96,_=0),d=1<<S-A,C=p=1<<O;do{l[b+(D>>A)+(p-=d)]=y<<24|v<<16|_|0}while(0!==p);for(d=1<<S-1;D&d;)d>>=1;if(0!==d?(D&=d-1,D+=d):D=0,x++,0==--F[S]){if(S===E)break;S=t[r+f[x]]}if(S>T&&(D&m)!==g){for(0===A&&(A=T),b+=C,P=1<<(O=S-A);O+A<E&&!((P-=F[O+A])<=0);)O++,P<<=1;if(I+=1<<O,1===e&&I>852||2===e&&I>592)return 1;l[g=D&m]=T<<24|O<<16|b-u|0}}return 0!==D&&(l[b+D]=S-A<<24|64<<16|0),h.bits=T,0}},function(e,t,r){"use strict";var n=r(15),i=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch(e){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){o=!1}for(var s=new n.Buf8(256),a=0;a<256;a++)s[a]=a>=252?6:a>=248?5:a>=240?4:a>=224?3:a>=192?2:1;function c(e,t){if(t<65534&&(e.subarray&&o||!e.subarray&&i))return String.fromCharCode.apply(null,n.shrinkBuf(e,t));for(var r="",s=0;s<t;s++)r+=String.fromCharCode(e[s]);return r}s[254]=s[254]=1,t.string2buf=function(e){var t,r,i,o,s,a=e.length,c=0;for(o=0;o<a;o++)55296==(64512&(r=e.charCodeAt(o)))&&o+1<a&&56320==(64512&(i=e.charCodeAt(o+1)))&&(r=65536+(r-55296<<10)+(i-56320),o++),c+=r<128?1:r<2048?2:r<65536?3:4;for(t=new n.Buf8(c),s=0,o=0;s<c;o++)55296==(64512&(r=e.charCodeAt(o)))&&o+1<a&&56320==(64512&(i=e.charCodeAt(o+1)))&&(r=65536+(r-55296<<10)+(i-56320),o++),r<128?t[s++]=r:r<2048?(t[s++]=192|r>>>6,t[s++]=128|63&r):r<65536?(t[s++]=224|r>>>12,t[s++]=128|r>>>6&63,t[s++]=128|63&r):(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63,t[s++]=128|r>>>6&63,t[s++]=128|63&r);return t},t.buf2binstring=function(e){return c(e,e.length)},t.binstring2buf=function(e){for(var t=new n.Buf8(e.length),r=0,i=t.length;r<i;r++)t[r]=e.charCodeAt(r);return t},t.buf2string=function(e,t){var r,n,i,o,a=t||e.length,l=new Array(2*a);for(n=0,r=0;r<a;)if((i=e[r++])<128)l[n++]=i;else if((o=s[i])>4)l[n++]=65533,r+=o-1;else{for(i&=2===o?31:3===o?15:7;o>1&&r<a;)i=i<<6|63&e[r++],o--;o>1?l[n++]=65533:i<65536?l[n++]=i:(i-=65536,l[n++]=55296|i>>10&1023,l[n++]=56320|1023&i)}return c(l,n)},t.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+s[e[r]]>t?r:t}},function(e,t,r){"use strict";e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},function(e,t,r){"use strict";e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},function(e,t,r){"use strict";e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},function(e,t,r){"use strict";e.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},function(e,t,r){e.exports=r.p+"0.ce4fa17e796500cc1eca.worker.worker.js"},function(e,t,r){"use strict";(function(t){var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=r(6),s=r(61).fork,a=o.join(t,"worker.js"),c=/^(error|message)$/,l={inspect:9229,debug:5858},u={min:1,max:300},f=function(){function e(t){var r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{cwd:process.cwd()};i(this,e);var c="function"==typeof t,f=c?t.toString():t;o.cwd||(o.cwd=process.cwd());var h=process.execArgv.filter((function(e){return/(debug|inspect)/.test(e)}));if(h.length>0&&!o.noDebugRedirection){o.execArgv||(h=Array.from(process.execArgv),o.execArgv=[]);var d=h.findIndex((function(e){return/^--inspect(-brk)?(=\\d+)?$/.test(e)})),p=h.findIndex((function(e){return/^--debug(-brk)?(=\\d+)?$/.test(e)})),g=d>=0?d:p;if(g>=0){var m=/^--(debug|inspect)(?:-brk)?(?:=(\\d+))?$/.exec(h[g]),b=l[m[1]];m[2]&&(b=parseInt(m[2])),h[g]="--"+m[1]+"="+(b+u.min+Math.floor(Math.random()*(u.max-u.min))),p>=0&&p!==g&&(m=/^(--debug)(?:-brk)?(.*)/.exec(h[p]),h[p]=m[1]+(m[2]?m[2]:""))}o.execArgv=o.execArgv.concat(h)}delete o.noDebugRedirection,this.child=s(a,n,o),this.onerror=void 0,this.onmessage=void 0,this.child.on("error",(function(e){r.onerror&&r.onerror.call(r,e)})),this.child.on("message",(function(e){var t=JSON.parse(e),n=void 0;!t.error&&r.onmessage&&r.onmessage.call(r,t),t.error&&r.onerror&&((n=new Error(t.error)).stack=t.stack,r.onerror.call(r,n))})),this.child.send({input:f,isfn:c,cwd:o.cwd,esm:o.esm})}return n(e,[{key:"addEventListener",value:function(e,t){c.test(e)&&(this["on"+e]=t)}},{key:"postMessage",value:function(e){this.child.send(JSON.stringify({data:e},null,0))}},{key:"terminate",value:function(){this.child.kill("SIGINT")}}],[{key:"setRange",value:function(e,t){return!(e>=t)&&(u.min=e,u.max=t,!0)}}]),e}();e.exports=f}).call(this,"/")},function(e,t){e.exports=require("child_process")},function(e,t,r){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,i=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(n++,"%c"===e&&(i=n))}),t.splice(i,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=r(31)(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},function(e,t){var r=1e3,n=6e4,i=60*n,o=24*i;function s(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}e.exports=function(e,t){t=t||{};var a=typeof e;if("string"===a&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var s=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*s;case"weeks":case"week":case"w":return 6048e5*s;case"days":case"day":case"d":return s*o;case"hours":case"hour":case"hrs":case"hr":case"h":return s*i;case"minutes":case"minute":case"mins":case"min":case"m":return s*n;case"seconds":case"second":case"secs":case"sec":case"s":return s*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}(e);if("number"===a&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=o)return s(e,t,o,"day");if(t>=i)return s(e,t,i,"hour");if(t>=n)return s(e,t,n,"minute");if(t>=r)return s(e,t,r,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=o)return Math.round(e/o)+"d";if(t>=i)return Math.round(e/i)+"h";if(t>=n)return Math.round(e/n)+"m";if(t>=r)return Math.round(e/r)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,r){const n=r(65),i=r(9);t.init=function(e){e.inspectOpts={};const r=Object.keys(t.inspectOpts);for(let n=0;n<r.length;n++)e.inspectOpts[r[n]]=t.inspectOpts[r[n]]},t.log=function(...e){return process.stderr.write(i.format(...e)+"\\n")},t.formatArgs=function(r){const{namespace:n,useColors:i}=this;if(i){const t=this.color,i="[3"+(t<8?t:"8;5;"+t),o=` ${i};1m${n} `;r[0]=o+r[0].split("\\n").join("\\n"+o),r.push(i+"m+"+e.exports.humanize(this.diff)+"")}else r[0]=function(){if(t.inspectOpts.hideDate)return"";return(new Date).toISOString()+" "}()+n+" "+r[0]},t.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},t.load=function(){return process.env.DEBUG},t.useColors=function(){return"colors"in t.inspectOpts?Boolean(t.inspectOpts.colors):n.isatty(process.stderr.fd)},t.destroy=i.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=r(66);e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{const r=t.substring(6).toLowerCase().replace(/_([a-z])/g,(e,t)=>t.toUpperCase());let n=process.env[t];return n=!!/^(yes|on|true|enabled)$/i.test(n)||!/^(no|off|false|disabled)$/i.test(n)&&("null"===n?null:Number(n)),e[r]=n,e},{}),e.exports=r(31)(t);const{formatters:o}=e.exports;o.o=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts).split("\\n").map(e=>e.trim()).join(" ")},o.O=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts)}},function(e,t){e.exports=require("tty")},function(e,t,r){"use strict";var n=process.argv,i=n.indexOf("--"),o=function(e){e="--"+e;var t=n.indexOf(e);return-1!==t&&(-1===i||t<i)};e.exports=!(!("FORCE_COLOR"in process.env)&&(o("no-color")||o("no-colors")||o("color=false")||!(o("color")||o("colors")||o("color=true")||o("color=always"))&&(process.stdout&&!process.stdout.isTTY||"win32"!==process.platform&&!("COLORTERM"in process.env)&&("dumb"===process.env.TERM||!/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(process.env.TERM)))))},function(e,t){e.exports={getPalette:(e,{debug:t=!1}={debug:!1})=>{t&&console.log("starting getPalette with image",e);const{fileDirectory:r}=e,{BitsPerSample:n,ColorMap:i,ImageLength:o,ImageWidth:s,PhotometricInterpretation:a,SampleFormat:c,SamplesPerPixel:l}=r;if(!i)throw new Error("[geotiff-palette]: the image does not contain a color map, so we can\'t make a palette.");const u=Math.pow(2,n);t&&console.log("[geotiff-palette]: count:",u);const f=i.length/3;if(t&&console.log("[geotiff-palette]: bandSize:",f),f!==u)throw new Error("[geotiff-palette]: can\'t handle situations where the color map has more or less values than the number of possible values in a raster");const h=f,d=h+f,p=[];for(let e=0;e<u;e++)p.push([Math.floor(i[e]/256),Math.floor(i[h+e]/256),Math.floor(i[d+e]/256),255]);return t&&console.log("[geotiff-palette]: result is ",p),p}}},function(e,t,r){"use strict";e.exports={countIn1D:function(e){return e.reduce((function(e,t){return void 0===e[t]?e[t]=1:e[t]++,e}),{})},countIn2D:function(e){return e.reduce((function(e,t){return t.forEach((function(t){void 0===e[t]?e[t]=1:e[t]++})),e}),{})},unflatten:function(e,t){for(var r=t.height,n=t.width,i=[],o=0;o<r;o++){var s=o*n,a=s+n;i.push(e.slice(s,a))}return i}}},function(e,t,r){"use strict";r.r(t),r.d(t,"globals",(function(){return n})),r.d(t,"rgb",(function(){return i})),r.d(t,"getDecoder",(function(){return N})),r.d(t,"setLogger",(function(){return _e})),r.d(t,"GeoTIFF",(function(){return Te})),r.d(t,"MultiGeoTIFF",(function(){return Oe})),r.d(t,"fromUrl",(function(){return Ae})),r.d(t,"fromArrayBuffer",(function(){return Pe})),r.d(t,"fromFile",(function(){return Ie})),r.d(t,"fromBlob",(function(){return De})),r.d(t,"fromUrls",(function(){return Me})),r.d(t,"writeArrayBuffer",(function(){return Re})),r.d(t,"Pool",(function(){return $.a}));var n={};r.r(n),r.d(n,"fieldTagNames",(function(){return a})),r.d(n,"fieldTags",(function(){return c})),r.d(n,"fieldTagTypes",(function(){return l})),r.d(n,"arrayFields",(function(){return u})),r.d(n,"fieldTypeNames",(function(){return f})),r.d(n,"fieldTypes",(function(){return h})),r.d(n,"photometricInterpretations",(function(){return d})),r.d(n,"ExtraSamplesValues",(function(){return p})),r.d(n,"geoKeyNames",(function(){return g})),r.d(n,"geoKeys",(function(){return m}));var i={};r.r(i),r.d(i,"fromWhiteIsZero",(function(){return b})),r.d(i,"fromBlackIsZero",(function(){return w})),r.d(i,"fromPalette",(function(){return y})),r.d(i,"fromCMYK",(function(){return v})),r.d(i,"fromYCbCr",(function(){return _})),r.d(i,"fromCIELab",(function(){return k}));var o=r(33),s=r.n(o);const a={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"},c={};for(const e in a)a.hasOwnProperty(e)&&(c[a[e]]=parseInt(e,10));const l={256:"SHORT",257:"SHORT",258:"SHORT",259:"SHORT",262:"SHORT",273:"LONG",274:"SHORT",277:"SHORT",278:"LONG",279:"LONG",282:"RATIONAL",283:"RATIONAL",284:"SHORT",286:"SHORT",287:"RATIONAL",296:"SHORT",305:"ASCII",306:"ASCII",338:"SHORT",339:"SHORT",513:"LONG",514:"LONG",1024:"SHORT",1025:"SHORT",2048:"SHORT",2049:"ASCII",33550:"DOUBLE",33922:"DOUBLE",34665:"LONG",34735:"SHORT",34737:"ASCII",42113:"ASCII"},u=[c.BitsPerSample,c.ExtraSamples,c.SampleFormat,c.StripByteCounts,c.StripOffsets,c.StripRowCounts,c.TileByteCounts,c.TileOffsets],f={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"},h={};for(const e in f)f.hasOwnProperty(e)&&(h[f[e]]=parseInt(e,10));const d={WhiteIsZero:0,BlackIsZero:1,RGB:2,Palette:3,TransparencyMask:4,CMYK:5,YCbCr:6,CIELab:8,ICCLab:9},p={Unspecified:0,Assocalpha:1,Unassalpha:2},g={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"},m={};for(const e in g)g.hasOwnProperty(e)&&(m[g[e]]=parseInt(e,10));function b(e,t){const{width:r,height:n}=e,i=new Uint8Array(r*n*3);let o;for(let r=0,n=0;r<e.length;++r,n+=3)o=256-e[r]/t*256,i[n]=o,i[n+1]=o,i[n+2]=o;return i}function w(e,t){const{width:r,height:n}=e,i=new Uint8Array(r*n*3);let o;for(let r=0,n=0;r<e.length;++r,n+=3)o=e[r]/t*256,i[n]=o,i[n+1]=o,i[n+2]=o;return i}function y(e,t){const{width:r,height:n}=e,i=new Uint8Array(r*n*3),o=t.length/3,s=t.length/3*2;for(let r=0,n=0;r<e.length;++r,n+=3){const a=e[r];i[n]=t[a]/65536*256,i[n+1]=t[a+o]/65536*256,i[n+2]=t[a+s]/65536*256}return i}function v(e){const{width:t,height:r}=e,n=new Uint8Array(t*r*3);for(let t=0,r=0;t<e.length;t+=4,r+=3){const i=e[t],o=e[t+1],s=e[t+2],a=e[t+3];n[r]=(255-i)/256*255*((255-a)/256),n[r+1]=(255-o)/256*255*((255-a)/256),n[r+2]=(255-s)/256*255*((255-a)/256)}return n}function _(e){const{width:t,height:r}=e,n=new Uint8ClampedArray(t*r*3);for(let t=0,r=0;t<e.length;t+=3,r+=3){const i=e[t],o=e[t+1],s=e[t+2];n[r]=i+1.402*(s-128),n[r+1]=i-.34414*(o-128)-.71414*(s-128),n[r+2]=i+1.772*(o-128)}return n}function k(e){const{width:t,height:r}=e,n=new Uint8Array(t*r*3);for(let t=0,r=0;t<e.length;t+=3,r+=3){let i,o,s,a=(e[t+0]+16)/116,c=(e[t+1]<<24>>24)/500+a,l=a-(e[t+2]<<24>>24)/200;c=.95047*(c*c*c>.008856?c*c*c:(c-16/116)/7.787),a=1*(a*a*a>.008856?a*a*a:(a-16/116)/7.787),l=1.08883*(l*l*l>.008856?l*l*l:(l-16/116)/7.787),i=3.2406*c+-1.5372*a+-.4986*l,o=-.9689*c+1.8758*a+.0415*l,s=.0557*c+-.204*a+1.057*l,i=i>.0031308?1.055*i**(1/2.4)-.055:12.92*i,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,n[r]=255*Math.max(0,Math.min(1,i)),n[r+1]=255*Math.max(0,Math.min(1,o)),n[r+2]=255*Math.max(0,Math.min(1,s))}return n}function S(e,t){let r=e.length-t,n=0;do{for(let r=t;r>0;r--)e[n+t]+=e[n],n++;r-=t}while(r>0)}function x(e,t,r){let n=0,i=e.length;const o=i/r;for(;i>t;){for(let r=t;r>0;--r)e[n+t]+=e[n],++n;i-=t}const s=e.slice();for(let t=0;t<o;++t)for(let n=0;n<r;++n)e[r*t+n]=s[(r-n-1)*o+t]}class C{decode(e,t){const r=this.decodeBlock(t),n=e.Predictor||1;if(1!==n){const t=!e.StripOffsets;return function(e,t,r,n,i,o){if(!t||1===t)return e;for(let e=0;e<i.length;++e){if(i[e]%8!=0)throw new Error("When decoding with predictor, only multiple of 8 bits are supported.");if(i[e]!==i[0])throw new Error("When decoding with predictor, all samples must have the same size.")}const s=i[0]/8,a=2===o?1:i.length;for(let o=0;o<n&&!(o*a*r*s>=e.byteLength);++o){let n;if(2===t){switch(i[0]){case 8:n=new Uint8Array(e,o*a*r*s,a*r*s);break;case 16:n=new Uint16Array(e,o*a*r*s,a*r*s/2);break;case 32:n=new Uint32Array(e,o*a*r*s,a*r*s/4);break;default:throw new Error(`Predictor 2 not allowed with ${i[0]} bits per sample.`)}S(n,a)}else 3===t&&(n=new Uint8Array(e,o*a*r*s,a*r*s),x(n,a,s))}return e}(r,n,t?e.TileWidth:e.ImageWidth,t?e.TileLength:e.RowsPerStrip||e.ImageLength,e.BitsPerSample,e.PlanarConfiguration)}return r}}class E extends C{decodeBlock(e){return e}}function T(e,t){for(let r=t.length-1;r>=0;r--)e.push(t[r]);return e}function O(e){const t=new Uint16Array(4093),r=new Uint8Array(4093);for(let e=0;e<=257;e++)t[e]=4096,r[e]=e;let n=258,i=9,o=0;function s(){n=258,i=9}function a(e){const t=function(e,t,r){const n=t%8,i=Math.floor(t/8),o=8-n,s=t+r-8*(i+1);let a=8*(i+2)-(t+r);const c=8*(i+2)-t;if(a=Math.max(0,a),i>=e.length)return console.warn("ran off the end of the buffer before finding EOI_CODE (end on input code)"),257;let l=e[i]&2**(8-n)-1;l<<=r-o;let u=l;if(i+1<e.length){let t=e[i+1]>>>a;t<<=Math.max(0,r-c),u+=t}if(s>8&&i+2<e.length){const n=8*(i+3)-(t+r);u+=e[i+2]>>>n}return u}(e,o,i);return o+=i,t}function c(e,i){return r[n]=i,t[n]=e,n++,n-1}function l(e){const n=[];for(let i=e;4096!==i;i=t[i])n.push(r[i]);return n}const u=[];s();const f=new Uint8Array(e);let h,d=a(f);for(;257!==d;){if(256===d){for(s(),d=a(f);256===d;)d=a(f);if(257===d)break;if(d>256)throw new Error("corrupted code at scanline "+d);T(u,l(d)),h=d}else if(d<n){const e=l(d);T(u,e),c(h,e[e.length-1]),h=d}else{const e=l(h);if(!e)throw new Error(`Bogus entry. Not in dictionary, ${h} / ${n}, position: ${o}`);T(u,e),u.push(e[e.length-1]),c(h,e[e.length-1]),h=d}n+1>=2**i&&(12===i?h=void 0:i++),d=a(f)}return new Uint8Array(u)}class A extends C{decodeBlock(e){return O(e).buffer}}const P=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]);function I(e,t){let r=0;const n=[];let i=16;for(;i>0&&!e[i-1];)--i;n.push({children:[],index:0});let o,s=n[0];for(let a=0;a<i;a++){for(let i=0;i<e[a];i++){for(s=n.pop(),s.children[s.index]=t[r];s.index>0;)s=n.pop();for(s.index++,n.push(s);n.length<=a;)n.push(o={children:[],index:0}),s.children[s.index]=o.children,s=o;r++}a+1<i&&(n.push(o={children:[],index:0}),s.children[s.index]=o.children,s=o)}return n[0].children}function D(e,t,r,n,i,o,s,a,c){const{mcusPerLine:l,progressive:u}=r,f=t;let h=t,d=0,p=0;function g(){if(p>0)return p--,d>>p&1;if(d=e[h++],255===d){const t=e[h++];if(t)throw new Error("unexpected marker: "+(d<<8|t).toString(16))}return p=7,d>>>7}function m(e){let t,r=e;for(;null!==(t=g());){if(r=r[t],"number"==typeof r)return r;if("object"!=typeof r)throw new Error("invalid huffman sequence")}return null}function b(e){let t=e,r=0;for(;t>0;){const e=g();if(null===e)return;r=r<<1|e,--t}return r}function w(e){const t=b(e);return t>=1<<e-1?t:t+(-1<<e)+1}let y=0;let v,_=0;function k(e,t,r,n,i){const o=r%l,s=(r/l|0)*e.v+n,a=o*e.h+i;t(e,e.blocks[s][a])}function S(e,t,r){const n=r/e.blocksPerLine|0,i=r%e.blocksPerLine;t(e,e.blocks[n][i])}const x=n.length;let C,E,T,O,A,I;I=u?0===o?0===a?function(e,t){const r=m(e.huffmanTableDC),n=0===r?0:w(r)<<c;e.pred+=n,t[0]=e.pred}:function(e,t){t[0]|=g()<<c}:0===a?function(e,t){if(y>0)return void y--;let r=o;const n=s;for(;r<=n;){const n=m(e.huffmanTableAC),i=15&n,o=n>>4;if(0===i){if(o<15){y=b(o)+(1<<o)-1;break}r+=16}else{r+=o;t[P[r]]=w(i)*(1<<c),r++}}}:function(e,t){let r=o;const n=s;let i=0;for(;r<=n;){const n=P[r],o=t[n]<0?-1:1;switch(_){case 0:{const t=m(e.huffmanTableAC),r=15&t;if(i=t>>4,0===r)i<15?(y=b(i)+(1<<i),_=4):(i=16,_=1);else{if(1!==r)throw new Error("invalid ACn encoding");v=w(r),_=i?2:3}continue}case 1:case 2:t[n]?t[n]+=(g()<<c)*o:(i--,0===i&&(_=2===_?3:0));break;case 3:t[n]?t[n]+=(g()<<c)*o:(t[n]=v<<c,_=0);break;case 4:t[n]&&(t[n]+=(g()<<c)*o)}r++}4===_&&(y--,0===y&&(_=0))}:function(e,t){const r=m(e.huffmanTableDC),n=0===r?0:w(r);e.pred+=n,t[0]=e.pred;let i=1;for(;i<64;){const r=m(e.huffmanTableAC),n=15&r,o=r>>4;if(0===n){if(o<15)break;i+=16}else{i+=o;t[P[i]]=w(n),i++}}};let D,M,R=0;M=1===x?n[0].blocksPerLine*n[0].blocksPerColumn:l*r.mcusPerColumn;const F=i||M;for(;R<M;){for(E=0;E<x;E++)n[E].pred=0;if(y=0,1===x)for(C=n[0],A=0;A<F;A++)S(C,I,R),R++;else for(A=0;A<F;A++){for(E=0;E<x;E++){C=n[E];const{h:e,v:t}=C;for(T=0;T<t;T++)for(O=0;O<e;O++)k(C,I,R,T,O)}if(R++,R===M)break}if(p=0,D=e[h]<<8|e[h+1],D<65280)throw new Error("marker was not found");if(!(D>=65488&&D<=65495))break;h+=2}return h-f}function M(e,t){const r=[],{blocksPerLine:n,blocksPerColumn:i}=t,o=n<<3,s=new Int32Array(64),a=new Uint8Array(64);function c(e,r,n){const i=t.quantizationTable;let o,s,a,c,l,u,f,h,d;const p=n;let g;for(g=0;g<64;g++)p[g]=e[g]*i[g];for(g=0;g<8;++g){const e=8*g;0!==p[1+e]||0!==p[2+e]||0!==p[3+e]||0!==p[4+e]||0!==p[5+e]||0!==p[6+e]||0!==p[7+e]?(o=5793*p[0+e]+128>>8,s=5793*p[4+e]+128>>8,a=p[2+e],c=p[6+e],l=2896*(p[1+e]-p[7+e])+128>>8,h=2896*(p[1+e]+p[7+e])+128>>8,u=p[3+e]<<4,f=p[5+e]<<4,d=o-s+1>>1,o=o+s+1>>1,s=d,d=3784*a+1567*c+128>>8,a=1567*a-3784*c+128>>8,c=d,d=l-f+1>>1,l=l+f+1>>1,f=d,d=h+u+1>>1,u=h-u+1>>1,h=d,d=o-c+1>>1,o=o+c+1>>1,c=d,d=s-a+1>>1,s=s+a+1>>1,a=d,d=2276*l+3406*h+2048>>12,l=3406*l-2276*h+2048>>12,h=d,d=799*u+4017*f+2048>>12,u=4017*u-799*f+2048>>12,f=d,p[0+e]=o+h,p[7+e]=o-h,p[1+e]=s+f,p[6+e]=s-f,p[2+e]=a+u,p[5+e]=a-u,p[3+e]=c+l,p[4+e]=c-l):(d=5793*p[0+e]+512>>10,p[0+e]=d,p[1+e]=d,p[2+e]=d,p[3+e]=d,p[4+e]=d,p[5+e]=d,p[6+e]=d,p[7+e]=d)}for(g=0;g<8;++g){const e=g;0!==p[8+e]||0!==p[16+e]||0!==p[24+e]||0!==p[32+e]||0!==p[40+e]||0!==p[48+e]||0!==p[56+e]?(o=5793*p[0+e]+2048>>12,s=5793*p[32+e]+2048>>12,a=p[16+e],c=p[48+e],l=2896*(p[8+e]-p[56+e])+2048>>12,h=2896*(p[8+e]+p[56+e])+2048>>12,u=p[24+e],f=p[40+e],d=o-s+1>>1,o=o+s+1>>1,s=d,d=3784*a+1567*c+2048>>12,a=1567*a-3784*c+2048>>12,c=d,d=l-f+1>>1,l=l+f+1>>1,f=d,d=h+u+1>>1,u=h-u+1>>1,h=d,d=o-c+1>>1,o=o+c+1>>1,c=d,d=s-a+1>>1,s=s+a+1>>1,a=d,d=2276*l+3406*h+2048>>12,l=3406*l-2276*h+2048>>12,h=d,d=799*u+4017*f+2048>>12,u=4017*u-799*f+2048>>12,f=d,p[0+e]=o+h,p[56+e]=o-h,p[8+e]=s+f,p[48+e]=s-f,p[16+e]=a+u,p[40+e]=a-u,p[24+e]=c+l,p[32+e]=c-l):(d=5793*n[g+0]+8192>>14,p[0+e]=d,p[8+e]=d,p[16+e]=d,p[24+e]=d,p[32+e]=d,p[40+e]=d,p[48+e]=d,p[56+e]=d)}for(g=0;g<64;++g){const e=128+(p[g]+8>>4);r[g]=e<0?0:e>255?255:e}}for(let e=0;e<i;e++){const i=e<<3;for(let e=0;e<8;e++)r.push(new Uint8Array(o));for(let o=0;o<n;o++){c(t.blocks[e][o],a,s);let n=0;const l=o<<3;for(let e=0;e<8;e++){const t=r[i+e];for(let e=0;e<8;e++)t[l+e]=a[n++]}}}return r}class R{constructor(){this.jfif=null,this.adobe=null,this.quantizationTables=[],this.huffmanTablesAC=[],this.huffmanTablesDC=[],this.resetFrames()}resetFrames(){this.frames=[]}parse(e){let t=0;function r(){const r=e[t]<<8|e[t+1];return t+=2,r}function n(){const n=r(),i=e.subarray(t,t+n-2);return t+=i.length,i}function i(e){let t,r,n=0,i=0;for(r in e.components)e.components.hasOwnProperty(r)&&(t=e.components[r],n<t.h&&(n=t.h),i<t.v&&(i=t.v));const o=Math.ceil(e.samplesPerLine/8/n),s=Math.ceil(e.scanLines/8/i);for(r in e.components)if(e.components.hasOwnProperty(r)){t=e.components[r];const a=Math.ceil(Math.ceil(e.samplesPerLine/8)*t.h/n),c=Math.ceil(Math.ceil(e.scanLines/8)*t.v/i),l=o*t.h,u=s*t.v,f=[];for(let e=0;e<u;e++){const e=[];for(let t=0;t<l;t++)e.push(new Int32Array(64));f.push(e)}t.blocksPerLine=a,t.blocksPerColumn=c,t.blocks=f}e.maxH=n,e.maxV=i,e.mcusPerLine=o,e.mcusPerColumn=s}let o=r();if(65496!==o)throw new Error("SOI not found");for(o=r();65497!==o;){switch(o){case 65280:break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:{const e=n();65504===o&&74===e[0]&&70===e[1]&&73===e[2]&&70===e[3]&&0===e[4]&&(this.jfif={version:{major:e[5],minor:e[6]},densityUnits:e[7],xDensity:e[8]<<8|e[9],yDensity:e[10]<<8|e[11],thumbWidth:e[12],thumbHeight:e[13],thumbData:e.subarray(14,14+3*e[12]*e[13])}),65518===o&&65===e[0]&&100===e[1]&&111===e[2]&&98===e[3]&&101===e[4]&&0===e[5]&&(this.adobe={version:e[6],flags0:e[7]<<8|e[8],flags1:e[9]<<8|e[10],transformCode:e[11]});break}case 65499:{const n=r()+t-2;for(;t<n;){const n=e[t++],i=new Int32Array(64);if(n>>4==0)for(let r=0;r<64;r++){i[P[r]]=e[t++]}else{if(n>>4!=1)throw new Error("DQT: invalid table spec");for(let e=0;e<64;e++){i[P[e]]=r()}}this.quantizationTables[15&n]=i}break}case 65472:case 65473:case 65474:{r();const n={extended:65473===o,progressive:65474===o,precision:e[t++],scanLines:r(),samplesPerLine:r(),components:{},componentsOrder:[]},s=e[t++];let a;for(let r=0;r<s;r++){a=e[t];const r=e[t+1]>>4,i=15&e[t+1],o=e[t+2];n.componentsOrder.push(a),n.components[a]={h:r,v:i,quantizationIdx:o},t+=3}i(n),this.frames.push(n);break}case 65476:{const n=r();for(let r=2;r<n;){const n=e[t++],i=new Uint8Array(16);let o=0;for(let r=0;r<16;r++,t++)i[r]=e[t],o+=i[r];const s=new Uint8Array(o);for(let r=0;r<o;r++,t++)s[r]=e[t];r+=17+o,n>>4==0?this.huffmanTablesDC[15&n]=I(i,s):this.huffmanTablesAC[15&n]=I(i,s)}break}case 65501:r(),this.resetInterval=r();break;case 65498:{r();const n=e[t++],i=[],o=this.frames[0];for(let r=0;r<n;r++){const r=o.components[e[t++]],n=e[t++];r.huffmanTableDC=this.huffmanTablesDC[n>>4],r.huffmanTableAC=this.huffmanTablesAC[15&n],i.push(r)}const s=e[t++],a=e[t++],c=e[t++],l=D(e,t,o,i,this.resetInterval,s,a,c>>4,15&c);t+=l;break}case 65535:255!==e[t]&&t--;break;default:if(255===e[t-3]&&e[t-2]>=192&&e[t-2]<=254){t-=3;break}throw new Error("unknown JPEG marker "+o.toString(16))}o=r()}}getResult(){const{frames:e}=this;if(0===this.frames.length)throw new Error("no frames were decoded");this.frames.length>1&&console.warn("more than one frame is not supported");for(let e=0;e<this.frames.length;e++){const t=this.frames[e].components;for(const e of Object.keys(t))t[e].quantizationTable=this.quantizationTables[t[e].quantizationIdx],delete t[e].quantizationIdx}const t=e[0],{components:r,componentsOrder:n}=t,i=[],o=t.samplesPerLine,s=t.scanLines;for(let e=0;e<n.length;e++){const o=r[n[e]];i.push({lines:M(0,o),scaleX:o.h/t.maxH,scaleY:o.v/t.maxV})}const a=new Uint8Array(o*s*i.length);let c=0;for(let e=0;e<s;++e)for(let t=0;t<o;++t)for(let r=0;r<i.length;++r){const n=i[r];a[c]=n.lines[0|e*n.scaleY][0|t*n.scaleX],++c}return a}}class F extends C{constructor(e){super(),this.reader=new R,e.JPEGTables&&this.reader.parse(e.JPEGTables)}decodeBlock(e){return this.reader.resetFrames(),this.reader.parse(new Uint8Array(e)),this.reader.getResult().buffer}}var j=r(34);class L extends C{decodeBlock(e){return Object(j.inflate)(new Uint8Array(e)).buffer}}class U extends C{decodeBlock(e){const t=new DataView(e),r=[];for(let n=0;n<e.byteLength;++n){let e=t.getInt8(n);if(e<0){const i=t.getUint8(n+1);e=-e;for(let t=0;t<=e;++t)r.push(i);n+=1}else{for(let i=0;i<=e;++i)r.push(t.getUint8(n+i+1));n+=e+1}}return new Uint8Array(r).buffer}}function N(e){switch(e.Compression){case void 0:case 1:return new E;case 5:return new A;case 6:throw new Error("old style JPEG compression is not supported.");case 7:return new F(e);case 8:case 32946:return new L;case 32773:return new U;default:throw new Error("Unknown compression method identifier: "+e.Compression)}}function B(e,t,r,n=1){return new(Object.getPrototypeOf(e).constructor)(t*r*n)}function G(e,t,r){return(1-r)*e+r*t}function W(e,t,r,n,i,o="nearest"){switch(o.toLowerCase()){case"nearest":return function(e,t,r,n,i){const o=t/n,s=r/i;return e.map(e=>{const a=B(e,n,i);for(let c=0;c<i;++c){const i=Math.min(Math.round(s*c),r-1);for(let r=0;r<n;++r){const s=Math.min(Math.round(o*r),t-1),l=e[i*t+s];a[c*n+r]=l}}return a})}(e,t,r,n,i);case"bilinear":case"linear":return function(e,t,r,n,i){const o=t/n,s=r/i;return e.map(e=>{const a=B(e,n,i);for(let c=0;c<i;++c){const i=s*c,l=Math.floor(i),u=Math.min(Math.ceil(i),r-1);for(let r=0;r<n;++r){const s=o*r,f=s%1,h=Math.floor(s),d=Math.min(Math.ceil(s),t-1),p=e[l*t+h],g=e[l*t+d],m=e[u*t+h],b=e[u*t+d],w=G(G(p,g,f),G(m,b,f),i%1);a[c*n+r]=w}}return a})}(e,t,r,n,i);default:throw new Error(`Unsupported resampling method: \'${o}\'`)}}function q(e,t,r,n,i,o,s="nearest"){switch(s.toLowerCase()){case"nearest":return function(e,t,r,n,i,o){const s=t/n,a=r/i,c=B(e,n,i,o);for(let l=0;l<i;++l){const i=Math.min(Math.round(a*l),r-1);for(let r=0;r<n;++r){const a=Math.min(Math.round(s*r),t-1);for(let s=0;s<o;++s){const u=e[i*t*o+a*o+s];c[l*n*o+r*o+s]=u}}}return c}(e,t,r,n,i,o);case"bilinear":case"linear":return function(e,t,r,n,i,o){const s=t/n,a=r/i,c=B(e,n,i,o);for(let l=0;l<i;++l){const i=a*l,u=Math.floor(i),f=Math.min(Math.ceil(i),r-1);for(let r=0;r<n;++r){const a=s*r,h=a%1,d=Math.floor(a),p=Math.min(Math.ceil(a),t-1);for(let s=0;s<o;++s){const a=e[u*t*o+d*o+s],g=e[u*t*o+p*o+s],m=e[f*t*o+d*o+s],b=e[f*t*o+p*o+s],w=G(G(a,g,h),G(m,b,h),i%1);c[l*n*o+r*o+s]=w}}}return c}(e,t,r,n,i,o);default:throw new Error(`Unsupported resampling method: \'${s}\'`)}}function K(e,t,r){let n=0;for(let i=t;i<r;++i)n+=e[i];return n}function z(e,t,r){switch(e){case 1:switch(t){case 8:return new Uint8Array(r);case 16:return new Uint16Array(r);case 32:return new Uint32Array(r)}break;case 2:switch(t){case 8:return new Int8Array(r);case 16:return new Int16Array(r);case 32:return new Int32Array(r)}break;case 3:switch(t){case 32:return new Float32Array(r);case 64:return new Float64Array(r)}}throw Error("Unsupported data format/bitsPerSample")}var H=class{constructor(e,t,r,n,i,o){this.fileDirectory=e,this.geoKeys=t,this.dataView=r,this.littleEndian=n,this.tiles=i?{}:null,this.isTiled=!e.StripOffsets;const s=e.PlanarConfiguration;if(this.planarConfiguration=void 0===s?1:s,1!==this.planarConfiguration&&2!==this.planarConfiguration)throw new Error("Invalid planar configuration.");this.source=o}getFileDirectory(){return this.fileDirectory}getGeoKeys(){return this.geoKeys}getWidth(){return this.fileDirectory.ImageWidth}getHeight(){return this.fileDirectory.ImageLength}getSamplesPerPixel(){return this.fileDirectory.SamplesPerPixel}getTileWidth(){return this.isTiled?this.fileDirectory.TileWidth:this.getWidth()}getTileHeight(){return this.isTiled?this.fileDirectory.TileLength:void 0!==this.fileDirectory.RowsPerStrip?Math.min(this.fileDirectory.RowsPerStrip,this.getHeight()):this.getHeight()}getBytesPerPixel(){let e=0;for(let t=0;t<this.fileDirectory.BitsPerSample.length;++t){const r=this.fileDirectory.BitsPerSample[t];if(r%8!=0)throw new Error(`Sample bit-width of ${r} is not supported.`);if(r!==this.fileDirectory.BitsPerSample[0])throw new Error("Differing size of samples in a pixel are not supported.");e+=r}return e/8}getSampleByteSize(e){if(e>=this.fileDirectory.BitsPerSample.length)throw new RangeError(`Sample index ${e} is out of range.`);const t=this.fileDirectory.BitsPerSample[e];if(t%8!=0)throw new Error(`Sample bit-width of ${t} is not supported.`);return t/8}getReaderForSample(e){const t=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1,r=this.fileDirectory.BitsPerSample[e];switch(t){case 1:switch(r){case 8:return DataView.prototype.getUint8;case 16:return DataView.prototype.getUint16;case 32:return DataView.prototype.getUint32}break;case 2:switch(r){case 8:return DataView.prototype.getInt8;case 16:return DataView.prototype.getInt16;case 32:return DataView.prototype.getInt32}break;case 3:switch(r){case 32:return DataView.prototype.getFloat32;case 64:return DataView.prototype.getFloat64}}throw Error("Unsupported data format/bitsPerSample")}getArrayForSample(e,t){return z(this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1,this.fileDirectory.BitsPerSample[e],t)}async getTileOrStrip(e,t,r,n){const i=Math.ceil(this.getWidth()/this.getTileWidth()),o=Math.ceil(this.getHeight()/this.getTileHeight());let s;const{tiles:a}=this;let c,l;1===this.planarConfiguration?s=t*i+e:2===this.planarConfiguration&&(s=r*i*o+t*i+e),this.isTiled?(c=this.fileDirectory.TileOffsets[s],l=this.fileDirectory.TileByteCounts[s]):(c=this.fileDirectory.StripOffsets[s],l=this.fileDirectory.StripByteCounts[s]);const u=await this.source.fetch(c,l);let f;return null===a?f=n.decode(this.fileDirectory,u):a[s]||(f=n.decode(this.fileDirectory,u),a[s]=f),{x:e,y:t,sample:r,data:await f}}async _readRaster(e,t,r,n,i,o,s,a){const c=this.getTileWidth(),l=this.getTileHeight(),u=Math.max(Math.floor(e[0]/c),0),f=Math.min(Math.ceil(e[2]/c),Math.ceil(this.getWidth()/this.getTileWidth())),h=Math.max(Math.floor(e[1]/l),0),d=Math.min(Math.ceil(e[3]/l),Math.ceil(this.getHeight()/this.getTileHeight())),p=e[2]-e[0];let g=this.getBytesPerPixel();const m=[],b=[];for(let e=0;e<t.length;++e)1===this.planarConfiguration?m.push(K(this.fileDirectory.BitsPerSample,0,t[e])/8):m.push(0),b.push(this.getReaderForSample(t[e]));const w=[],{littleEndian:y}=this;for(let o=h;o<d;++o)for(let s=u;s<f;++s)for(let a=0;a<t.length;++a){const u=a,f=t[a];2===this.planarConfiguration&&(g=this.getSampleByteSize(f));const h=this.getTileOrStrip(s,o,f,i);w.push(h),h.then(i=>{const o=i.data,s=new DataView(o),a=i.y*l,f=i.x*c,h=(i.y+1)*l,d=(i.x+1)*c,w=b[u],v=Math.min(l,l-(h-e[3])),_=Math.min(c,c-(d-e[2]));for(let i=Math.max(0,e[1]-a);i<v;++i)for(let o=Math.max(0,e[0]-f);o<_;++o){const l=(i*c+o)*g,h=w.call(s,l+m[u],y);let d;n?(d=(i+a-e[1])*p*t.length+(o+f-e[0])*t.length+u,r[d]=h):(d=(i+a-e[1])*p+o+f-e[0],r[u][d]=h)}})}if(await Promise.all(w),o&&e[2]-e[0]!==o||s&&e[3]-e[1]!==s){let i;return i=n?q(r,e[2]-e[0],e[3]-e[1],o,s,t.length,a):W(r,e[2]-e[0],e[3]-e[1],o,s,a),i.width=o,i.height=s,i}return r.width=o||e[2]-e[0],r.height=s||e[3]-e[1],r}async readRasters({window:e,samples:t=[],interleave:r,pool:n=null,width:i,height:o,resampleMethod:s,fillValue:a}={}){const c=e||[0,0,this.getWidth(),this.getHeight()];if(c[0]>c[2]||c[1]>c[3])throw new Error("Invalid subsets");const l=(c[2]-c[0])*(c[3]-c[1]);if(t&&t.length){for(let e=0;e<t.length;++e)if(t[e]>=this.fileDirectory.SamplesPerPixel)return Promise.reject(new RangeError(`Invalid sample index \'${t[e]}\'.`))}else for(let e=0;e<this.fileDirectory.SamplesPerPixel;++e)t.push(e);let u;if(r){u=z(this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,Math.max.apply(null,this.fileDirectory.BitsPerSample),l*t.length),a&&u.fill(a)}else{u=[];for(let e=0;e<t.length;++e){const r=this.getArrayForSample(t[e],l);Array.isArray(a)&&e<a.length?r.fill(a[e]):a&&!Array.isArray(a)&&r.fill(a),u.push(r)}}const f=n||N(this.fileDirectory);return await this._readRaster(c,t,u,r,f,i,o,s)}async readRGB({window:e,pool:t=null,width:r,height:n,resampleMethod:i,enableAlpha:o=!1}={}){const s=e||[0,0,this.getWidth(),this.getHeight()];if(s[0]>s[2]||s[1]>s[3])throw new Error("Invalid subsets");const a=this.fileDirectory.PhotometricInterpretation;if(a===d.RGB){let i=[0,1,2];if(this.fileDirectory.ExtraSamples!==p.Unspecified&&o){i=[];for(let e=0;e<this.fileDirectory.BitsPerSample.length;e+=1)i.push(e)}return this.readRasters({window:e,interleave:!0,samples:i,pool:t,width:r,height:n})}let c;switch(a){case d.WhiteIsZero:case d.BlackIsZero:case d.Palette:c=[0];break;case d.CMYK:c=[0,1,2,3];break;case d.YCbCr:case d.CIELab:c=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const l={window:s,interleave:!0,samples:c,pool:t,width:r,height:n,resampleMethod:i},{fileDirectory:u}=this,f=await this.readRasters(l),h=2**this.fileDirectory.BitsPerSample[0];let g;switch(a){case d.WhiteIsZero:g=b(f,h);break;case d.BlackIsZero:g=w(f,h);break;case d.Palette:g=y(f,u.ColorMap);break;case d.CMYK:g=v(f);break;case d.YCbCr:g=_(f);break;case d.CIELab:g=k(f);break;default:throw new Error("Unsupported photometric interpretation.")}return g.width=f.width,g.height=f.height,g}getTiePoints(){if(!this.fileDirectory.ModelTiepoint)return[];const e=[];for(let t=0;t<this.fileDirectory.ModelTiepoint.length;t+=6)e.push({i:this.fileDirectory.ModelTiepoint[t],j:this.fileDirectory.ModelTiepoint[t+1],k:this.fileDirectory.ModelTiepoint[t+2],x:this.fileDirectory.ModelTiepoint[t+3],y:this.fileDirectory.ModelTiepoint[t+4],z:this.fileDirectory.ModelTiepoint[t+5]});return e}getGDALMetadata(e=null){const t={};if(!this.fileDirectory.GDAL_METADATA)return null;const r=this.fileDirectory.GDAL_METADATA,n=s()(r.substring(0,r.length-1));if(!n[0].tagName)throw new Error("Failed to parse GDAL metadata XML.");const i=n[0];if("GDALMetadata"!==i.tagName)throw new Error("Unexpected GDAL metadata XML tag.");let o=i.children.filter(e=>"Item"===e.tagName);e&&(o=o.filter(t=>Number(t.attributes.sample)===e));for(let e=0;e<o.length;++e){const r=o[e];t[r.attributes.name]=r.children[0]}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&&6===e.length)return[e[3],e[4],e[5]];if(t)return[t[3],t[7],t[11]];throw new Error("The image does not have an affine transformation.")}getResolution(e=null){const t=this.fileDirectory.ModelPixelScale,r=this.fileDirectory.ModelTransformation;if(t)return[t[0],-t[1],t[2]];if(r)return[r[0],r[5],r[10]];if(e){const[t,r,n]=e.getResolution();return[t*e.getWidth()/this.getWidth(),r*e.getHeight()/this.getHeight(),n*e.getWidth()/this.getWidth()]}throw new Error("The image does not have an affine transformation.")}pixelIsArea(){return 1===this.geoKeys.GTRasterTypeGeoKey}getBoundingBox(){const e=this.getOrigin(),t=this.getResolution(),r=e[0],n=e[1],i=r+t[0]*this.getWidth(),o=n+t[1]*this.getHeight();return[Math.min(r,i),Math.min(n,o),Math.max(r,i),Math.max(n,o)]}};class V{constructor(e){this._dataView=new DataView(e)}get buffer(){return this._dataView.buffer}getUint64(e,t){const r=this.getUint32(e,t),n=this.getUint32(e+4,t);let i;if(t){if(i=r+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*r+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}getInt64(e,t){let r=0;const n=(128&this._dataView.getUint8(e+(t?7:0)))>0;let i=!0;for(let o=0;o<8;o++){let s=this._dataView.getUint8(e+(t?o:7-o));n&&(i?0!==s&&(s=255&~(s-1),i=!1):s=255&~s),r+=s*256**o}return n&&(r=-r),r}getUint8(e,t){return this._dataView.getUint8(e,t)}getInt8(e,t){return this._dataView.getInt8(e,t)}getUint16(e,t){return this._dataView.getUint16(e,t)}getInt16(e,t){return this._dataView.getInt16(e,t)}getUint32(e,t){return this._dataView.getUint32(e,t)}getInt32(e,t){return this._dataView.getInt32(e,t)}getFloat32(e,t){return this._dataView.getFloat32(e,t)}getFloat64(e,t){return this._dataView.getFloat64(e,t)}}class Z{constructor(e,t,r,n){this._dataView=new DataView(e),this._sliceOffset=t,this._littleEndian=r,this._bigTiff=n}get sliceOffset(){return this._sliceOffset}get sliceTop(){return this._sliceOffset+this.buffer.byteLength}get littleEndian(){return this._littleEndian}get bigTiff(){return this._bigTiff}get buffer(){return this._dataView.buffer}covers(e,t){return this.sliceOffset<=e&&this.sliceTop>=e+t}readUint8(e){return this._dataView.getUint8(e-this._sliceOffset,this._littleEndian)}readInt8(e){return this._dataView.getInt8(e-this._sliceOffset,this._littleEndian)}readUint16(e){return this._dataView.getUint16(e-this._sliceOffset,this._littleEndian)}readInt16(e){return this._dataView.getInt16(e-this._sliceOffset,this._littleEndian)}readUint32(e){return this._dataView.getUint32(e-this._sliceOffset,this._littleEndian)}readInt32(e){return this._dataView.getInt32(e-this._sliceOffset,this._littleEndian)}readFloat32(e){return this._dataView.getFloat32(e-this._sliceOffset,this._littleEndian)}readFloat64(e){return this._dataView.getFloat64(e-this._sliceOffset,this._littleEndian)}readUint64(e){const t=this.readUint32(e),r=this.readUint32(e+4);let n;if(this._littleEndian){if(n=t+2**32*r,!Number.isSafeInteger(n))throw new Error(n+" exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues");return n}if(n=2**32*t+r,!Number.isSafeInteger(n))throw new Error(n+" exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues");return n}readInt64(e){let t=0;const r=(128&this._dataView.getUint8(e+(this._littleEndian?7:0)))>0;let n=!0;for(let i=0;i<8;i++){let o=this._dataView.getUint8(e+(this._littleEndian?i:7-i));r&&(n?0!==o&&(o=255&~(o-1),n=!1):o=255&~o),t+=o*256**i}return r&&(t=-t),t}readOffset(e){return this._bigTiff?this.readUint64(e):this.readUint32(e)}}var $=r(30),Y=r(11),Q=r(12),X=r(22),J=r.n(X),ee=r(40),te=r.n(ee),re=r(16),ne=r.n(re);class ie{constructor(e,{blockSize:t=65536}={}){this.retrievalFunction=e,this.blockSize=t,this.blockRequests=new Map,this.blocks=new Map,this.blockIdsAwaitingRequest=null}async fetch(e,t,r=!1){const n=e+t,i=[],o=[],s=[];for(let t=Math.floor(e/this.blockSize)*this.blockSize;t<n;t+=this.blockSize){const e=Math.floor(t/this.blockSize);this.blocks.has(e)||this.blockRequests.has(e)||o.push(e),this.blockRequests.has(e)&&s.push(this.blockRequests.get(e)),i.push(e)}if(this.blockIdsAwaitingRequest)for(let e=0;e<o.length;++e){const t=o[e];this.blockIdsAwaitingRequest.add(t)}else this.blockIdsAwaitingRequest=new Set(o);if(r||await async function(e){return new Promise(t=>setTimeout(t,e))}(),this.blockIdsAwaitingRequest){const e=function(e){if(0===e.length)return[];const t=[];let r=[];t.push(r);for(let n=0;n<e.length;++n)0===n||e[n]===e[n-1]+1?r.push(e[n]):(r=[e[n]],t.push(r));return t}(Array.from(this.blockIdsAwaitingRequest).sort());for(const t of e){const e=this.requestData(t[0]*this.blockSize,t.length*this.blockSize);for(let r=0;r<t.length;++r){const n=t[r];this.blockRequests.set(n,(async()=>{const t=await e,i=r*this.blockSize,o=Math.min(i+this.blockSize,t.data.byteLength),s=t.data.slice(i,o);this.blockRequests.delete(n),this.blocks.set(n,{data:s,offset:t.offset+i,length:s.byteLength,top:t.offset+o})})())}}this.blockIdsAwaitingRequest=null}const a=[];for(const e of o)this.blockRequests.has(e)&&a.push(this.blockRequests.get(e));await Promise.all(a),await Promise.all(s);return function(e,t,r){const n=t+r,i=new ArrayBuffer(r),o=new Uint8Array(i);for(const r of e){const e=r.offset-t,i=r.top-n;let s,a=0,c=0;e<0?a=-e:e>0&&(c=e),s=i<0?r.length-a:n-r.offset-a;const l=new Uint8Array(r.data,a,s);o.set(l,c)}return i}(i.map(e=>this.blocks.get(e)),e,t)}async requestData(e,t){const r=await this.retrievalFunction(e,t);return r.length?r.length!==r.data.byteLength&&(r.data=r.data.slice(0,r.length)):r.length=r.data.byteLength,r.top=r.offset+r.length,r}}function oe(e,t){const{forceXHR:r}=t;if("function"==typeof fetch&&!r)return function(e,{headers:t={},blockSize:r}={}){return new ie(async(r,n)=>{const i=await fetch(e,{headers:{...t,Range:`bytes=${r}-${r+n-1}`}});if(i.ok){if(206===i.status){return{data:i.arrayBuffer?await i.arrayBuffer():(await i.buffer()).buffer,offset:r,length:n}}{const e=i.arrayBuffer?await i.arrayBuffer():(await i.buffer()).buffer;return{data:e,offset:0,length:e.byteLength}}}throw new Error("Error fetching data.")},{blockSize:r})}(e,t);if("undefined"!=typeof XMLHttpRequest)return function(e,{headers:t={},blockSize:r}={}){return new ie(async(r,n)=>new Promise((i,o)=>{const s=new XMLHttpRequest;s.open("GET",e),s.responseType="arraybuffer";const a={...t,Range:`bytes=${r}-${r+n-1}`};for(const[e,t]of Object.entries(a))s.setRequestHeader(e,t);s.onload=()=>{const e=s.response;206===s.status?i({data:e,offset:r,length:n}):i({data:e,offset:0,length:e.byteLength})},s.onerror=o,s.send()}),{blockSize:r})}(e,t);if(J.a.get)return function(e,{headers:t={},blockSize:r}={}){return new ie(async(r,n)=>new Promise((i,o)=>{const s=ne.a.parse(e);("http:"===s.protocol?J.a:te.a).get({...s,headers:{...t,Range:`bytes=${r}-${r+n-1}`}},e=>{const t=[];e.on("data",e=>{t.push(e)}),e.on("end",()=>{const e=Y.Buffer.concat(t).buffer;i({data:e,offset:r,length:e.byteLength})})}).on("error",o)}),{blockSize:r})}(e,t);throw new Error("No remote source available")}function se(e){const t=function(e,t,r){return new Promise((n,i)=>{Object(Q.open)(e,t,r,(e,t)=>{e?i(e):n(t)})})}(e,"r");return{async fetch(e,r){const n=await t,{buffer:i}=await function(...e){return new Promise((t,r)=>{Object(Q.read)(...e,(e,n,i)=>{e?r(e):t({bytesRead:n,buffer:i})})})}(n,Y.Buffer.alloc(r),0,r,e);return i.buffer},async close(){const e=await t;return await function(e){return new Promise((t,r)=>{Object(Q.close)(e,e=>{e?r(e):t()})})}(e)}}}function ae(e,t){for(const r in t)t.hasOwnProperty(r)&&(e[r]=t[r])}function ce(e,t){if(e.length<t.length)return!1;return e.substr(e.length-t.length)===t}function le(e){const t={};for(const r in e)if(e.hasOwnProperty(r)){t[e[r]]=r}return t}function ue(e,t){const r=[];for(let n=0;n<e;n++)r.push(t(n));return r}const fe=le(a),he=le(g),de={};ae(de,fe),ae(de,he);const pe=le(f),ge={nextZero:(e,t)=>{let r=t;for(;0!==e[r];)r++;return r},readUshort:(e,t)=>e[t]<<8|e[t+1],readShort:(e,t)=>{const r=ge.ui8;return r[0]=e[t+1],r[1]=e[t+0],ge.i16[0]},readInt:(e,t)=>{const r=ge.ui8;return r[0]=e[t+3],r[1]=e[t+2],r[2]=e[t+1],r[3]=e[t+0],ge.i32[0]},readUint:(e,t)=>{const r=ge.ui8;return r[0]=e[t+3],r[1]=e[t+2],r[2]=e[t+1],r[3]=e[t+0],ge.ui32[0]},readASCII:(e,t,r)=>r.map(r=>String.fromCharCode(e[t+r])).join(""),readFloat:(e,t)=>{const r=ge.ui8;return ue(4,n=>{r[n]=e[t+3-n]}),ge.fl32[0]},readDouble:(e,t)=>{const r=ge.ui8;return ue(8,n=>{r[n]=e[t+7-n]}),ge.fl64[0]},writeUshort:(e,t,r)=>{e[t]=r>>8&255,e[t+1]=255&r},writeUint:(e,t,r)=>{e[t]=r>>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=r>>0&255},writeASCII:(e,t,r)=>{ue(r.length,n=>{e[t+n]=r.charCodeAt(n)})},ui8:new Uint8Array(8)};ge.fl64=new Float64Array(ge.ui8.buffer),ge.writeDouble=(e,t,r)=>{ge.fl64[0]=r,ue(8,r=>{e[t+r]=ge.ui8[7-r]})};const me=e=>{const t=new Uint8Array(1e3);let r=4;const n=ge;t[0]=77,t[1]=77,t[3]=42;let i=8;if(n.writeUint(t,r,i),r+=4,e.forEach((r,o)=>{const s=((e,t,r,n)=>{let i=r;const o=Object.keys(n).filter(e=>null!=e&&"undefined"!==e);e.writeUshort(t,i,o.length),i+=2;let s=i+12*o.length+4;for(const r of o){let o=null;"number"==typeof r?o=r:"string"==typeof r&&(o=parseInt(r,10));const a=l[o],c=pe[a];if(null==a||void 0===a||void 0===a)throw new Error("unknown type of tag: "+o);let u=n[r];if(void 0===u)throw new Error("failed to get value for key "+r);"ASCII"===a&&"string"==typeof u&&!1===ce(u,"\\0")&&(u+="\\0");const f=u.length;e.writeUshort(t,i,o),i+=2,e.writeUshort(t,i,c),i+=2,e.writeUint(t,i,f),i+=4;let h=[-1,1,1,2,4,8,0,0,0,0,0,0,8][c]*f,d=i;h>4&&(e.writeUint(t,i,s),d=s),"ASCII"===a?e.writeASCII(t,d,u):"SHORT"===a?ue(f,r=>{e.writeUshort(t,d+2*r,u[r])}):"LONG"===a?ue(f,r=>{e.writeUint(t,d+4*r,u[r])}):"RATIONAL"===a?ue(f,r=>{e.writeUint(t,d+8*r,Math.round(1e4*u[r])),e.writeUint(t,d+8*r+4,1e4)}):"DOUBLE"===a&&ue(f,r=>{e.writeDouble(t,d+8*r,u[r])}),h>4&&(h+=1&h,s+=h),i+=4}return[i,s]})(n,t,i,r);i=s[1],o<e.length-1&&n.writeUint(t,s[0],i)}),t.slice)return t.slice(0,i).buffer;const o=new Uint8Array(i);for(let e=0;e<i;e++)o[e]=t[e];return o.buffer},be=[["Compression",1],["PlanarConfiguration",1],["XPosition",0],["YPosition",0],["ResolutionUnit",1],["ExtraSamples",0],["GeoAsciiParams","WGS 84\\0"],["ModelTiepoint",[0,0,0,-180,90,0]],["GTModelTypeGeoKey",2],["GTRasterTypeGeoKey",1],["GeographicTypeGeoKey",4326],["GeogCitationGeoKey","WGS 84"]];function we(e,t){let r,n,i,o;"number"==typeof e[0]?(r=t.height||t.ImageLength,i=t.width||t.ImageWidth,n=e.length/(r*i),o=e):(n=e.length,r=e[0].length,i=e[0][0].length,o=[],ue(r,t=>{ue(i,r=>{ue(n,n=>{o.push(e[n][t][r])})})})),t.ImageLength=r,delete t.height,t.ImageWidth=i,delete t.width,t.BitsPerSample||(t.BitsPerSample=ue(n,()=>8)),be.forEach(e=>{const r=e[0];if(!t[r]){const n=e[1];t[r]=n}}),t.PhotometricInterpretation||(t.PhotometricInterpretation=3===t.BitsPerSample.length?2:1),t.SamplesPerPixel||(t.SamplesPerPixel=[n]),t.StripByteCounts||(t.StripByteCounts=[n*r*i]),t.ModelPixelScale||(t.ModelPixelScale=[360/i,180/r,0]),t.SampleFormat||(t.SampleFormat=ue(n,()=>1));const s=Object.keys(t).filter(e=>ce(e,"GeoKey")).sort((e,t)=>de[e]-de[t]);if(!t.GeoKeyDirectory){const e=[1,1,0,s.length];s.forEach(r=>{const n=Number(de[r]);let i,o,s;e.push(n),"SHORT"===l[n]?(i=1,o=0,s=t[r]):"GeogCitationGeoKey"===r?(i=t.GeoAsciiParams.length,o=Number(de.GeoAsciiParams),s=0):console.log("[geotiff.js] couldn\'t get TIFFTagLocation for "+r),e.push(o),e.push(i),e.push(s)}),t.GeoKeyDirectory=e}for(const e in s)s.hasOwnProperty(e)&&delete t[e];["Compression","ExtraSamples","GeographicTypeGeoKey","GTModelTypeGeoKey","GTRasterTypeGeoKey","ImageLength","ImageWidth","PhotometricInterpretation","PlanarConfiguration","ResolutionUnit","SamplesPerPixel","XPosition","YPosition"].forEach(e=>{var r;t[e]&&(t[e]=(r=t[e],Array.isArray(r)?r:[r]))});const a=(e=>{const t={};for(const r in e)"StripOffsets"!==r&&(de[r]||console.error(r,"not in name2code:",Object.keys(de)),t[de[r]]=e[r]);return t})(t);return((e,t,r,n)=>{if(null==r)throw new Error("you passed into encodeImage a width of type "+r);if(null==t)throw new Error("you passed into encodeImage a width of type "+t);const i={256:[t],257:[r],273:[1e3],278:[r],305:"geotiff.js"};if(n)for(const e in n)n.hasOwnProperty(e)&&(i[e]=n[e]);const o=new Uint8Array(me([i])),s=new Uint8Array(e),a=i[277],c=new Uint8Array(1e3+t*r*a);return ue(o.length,e=>{c[e]=o[e]}),function(e,t){const{length:r}=e;for(let n=0;n<r;n++)t(e[n],n)}(s,(e,t)=>{c[1e3+t]=e}),c.buffer})(o,i,r,a)}class ye{log(){}info(){}warn(){}error(){}time(){}timeEnd(){}}let ve=new ye;function _e(e=new ye){ve=e}function ke(e){switch(e){case h.BYTE:case h.ASCII:case h.SBYTE:case h.UNDEFINED:return 1;case h.SHORT:case h.SSHORT:return 2;case h.LONG:case h.SLONG:case h.FLOAT:case h.IFD:return 4;case h.RATIONAL:case h.SRATIONAL:case h.DOUBLE:case h.LONG8:case h.SLONG8:case h.IFD8:return 8;default:throw new RangeError("Invalid field type: "+e)}}function Se(e,t,r,n){let i=null,o=null;const s=ke(t);switch(t){case h.BYTE:case h.ASCII:case h.UNDEFINED:i=new Uint8Array(r),o=e.readUint8;break;case h.SBYTE:i=new Int8Array(r),o=e.readInt8;break;case h.SHORT:i=new Uint16Array(r),o=e.readUint16;break;case h.SSHORT:i=new Int16Array(r),o=e.readInt16;break;case h.LONG:case h.IFD:i=new Uint32Array(r),o=e.readUint32;break;case h.SLONG:i=new Int32Array(r),o=e.readInt32;break;case h.LONG8:case h.IFD8:i=new Array(r),o=e.readUint64;break;case h.SLONG8:i=new Array(r),o=e.readInt64;break;case h.RATIONAL:i=new Uint32Array(2*r),o=e.readUint32;break;case h.SRATIONAL:i=new Int32Array(2*r),o=e.readInt32;break;case h.FLOAT:i=new Float32Array(r),o=e.readFloat32;break;case h.DOUBLE:i=new Float64Array(r),o=e.readFloat64;break;default:throw new RangeError("Invalid field type: "+t)}if(t!==h.RATIONAL&&t!==h.SRATIONAL)for(let t=0;t<r;++t)i[t]=o.call(e,n+t*s);else for(let t=0;t<r;t+=2)i[t]=o.call(e,n+t*s),i[t+1]=o.call(e,n+(t*s+4));return t===h.ASCII?String.fromCharCode.apply(null,i):i}class xe{constructor(e,t,r){this.fileDirectory=e,this.geoKeyDirectory=t,this.nextIFDByteOffset=r}}class Ce extends Error{constructor(e){super("No image at index "+e),this.index=e}}class Ee{async readRasters(e={}){const{window:t,width:r,height:n}=e;let{resX:i,resY:o,bbox:s}=e;const a=await this.getImage();let c=a;const l=await this.getImageCount(),u=a.getBoundingBox();if(t&&s)throw new Error(\'Both "bbox" and "window" passed.\');if(r||n){if(t){const[e,r]=a.getOrigin(),[n,i]=a.getResolution();s=[e+t[0]*n,r+t[1]*i,e+t[2]*n,r+t[3]*i]}const e=s||u;if(r){if(i)throw new Error("Both width and resX passed");i=(e[2]-e[0])/r}if(n){if(o)throw new Error("Both width and resY passed");o=(e[3]-e[1])/n}}if(i||o){const e=[];for(let t=0;t<l;++t){const r=await this.getImage(t),{SubfileType:n,NewSubfileType:i}=r.fileDirectory;(0===t||2===n||1&i)&&e.push(r)}e.sort((e,t)=>e.getWidth()-t.getWidth());for(let t=0;t<e.length;++t){const r=e[t],n=(u[2]-u[0])/r.getWidth(),s=(u[3]-u[1])/r.getHeight();if(c=r,i&&i>n||o&&o>s)break}}let f=t;if(s){const[e,t]=a.getOrigin(),[r,n]=c.getResolution(a);f=[Math.round((s[0]-e)/r),Math.round((s[1]-t)/n),Math.round((s[2]-e)/r),Math.round((s[3]-t)/n)],f=[Math.min(f[0],f[2]),Math.min(f[1],f[3]),Math.max(f[0],f[2]),Math.max(f[1],f[3])]}return c.readRasters({...e,window:f})}}class Te extends Ee{constructor(e,t,r,n,i={}){super(),this.source=e,this.littleEndian=t,this.bigTiff=r,this.firstIFDOffset=n,this.cache=i.cache||!1,this.ifdRequests=[],this.ghostValues=null}async getSlice(e,t){const r=this.bigTiff?4048:1024;return new Z(await this.source.fetch(e,void 0!==t?t:r),e,this.littleEndian,this.bigTiff)}async parseFileDirectoryAt(e){const t=this.bigTiff?20:12,r=this.bigTiff?8:2;let n=await this.getSlice(e);const i=this.bigTiff?n.readUint64(e):n.readUint16(e),o=i*t+(this.bigTiff?16:6);n.covers(e,o)||(n=await this.getSlice(e,o));const s={};let c=e+(this.bigTiff?8:2);for(let e=0;e<i;c+=t,++e){const e=n.readUint16(c),t=n.readUint16(c+2),r=this.bigTiff?n.readUint64(c+4):n.readUint32(c+4);let i,o;const l=ke(t),f=c+(this.bigTiff?12:8);if(l*r<=(this.bigTiff?8:4))i=Se(n,t,r,f);else{const e=n.readOffset(f),o=ke(t)*r;if(n.covers(e,o))i=Se(n,t,r,e);else{i=Se(await this.getSlice(e,o),t,r,e)}}o=1===r&&-1===u.indexOf(e)&&t!==h.RATIONAL&&t!==h.SRATIONAL?i[0]:i,s[a[e]]=o}const l=function(e){const t=e.GeoKeyDirectory;if(!t)return null;const r={};for(let n=4;n<=4*t[3];n+=4){const i=g[t[n]],o=t[n+1]?a[t[n+1]]:null,s=t[n+2],c=t[n+3];let l=null;if(o){if(l=e[o],null==l)throw new Error(`Could not get value of geoKey \'${i}\'.`);"string"==typeof l?l=l.substring(c,c+s-1):l.subarray&&(l=l.subarray(c,c+s),1===s&&(l=l[0]))}else l=c;r[i]=l}return r}(s),f=n.readOffset(e+r+t*i);return new xe(s,l,f)}async requestIFD(e){if(this.ifdRequests[e])return this.ifdRequests[e];if(0===e)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){if(t instanceof Ce)throw new Ce(e);throw t}return this.ifdRequests[e]=(async()=>{const t=await this.ifdRequests[e-1];if(0===t.nextIFDByteOffset)throw new Ce(e);return this.parseFileDirectoryAt(t.nextIFDByteOffset)})(),this.ifdRequests[e]}async getImage(e=0){const t=await this.requestIFD(e);return new H(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(e){if(!(e instanceof Ce))throw e;t=!1}return e}async getGhostValues(){const e=this.bigTiff?16:8;if(this.ghostValues)return this.ghostValues;const t="GDAL_STRUCTURAL_METADATA_SIZE=",r=t.length+100;let n=await this.getSlice(e,r);if(t===Se(n,h.ASCII,t.length,e)){const t=Se(n,h.ASCII,r,e).split("\\n")[0],i=Number(t.split("=")[1].split(" ")[0])+t.length;i>r&&(n=await this.getSlice(e,i));const o=Se(n,h.ASCII,i,e);this.ghostValues={},o.split("\\n").filter(e=>e.length>0).map(e=>e.split("=")).forEach(([e,t])=>{this.ghostValues[e]=t})}return this.ghostValues}static async fromSource(e,t){const r=await e.fetch(0,1024),n=new V(r),i=n.getUint16(0,0);let o;if(18761===i)o=!0;else{if(19789!==i)throw new TypeError("Invalid byte order value.");o=!1}const s=n.getUint16(2,o);let a;if(42===s)a=!1;else{if(43!==s)throw new TypeError("Invalid magic number.");a=!0;if(8!==n.getUint16(4,o))throw new Error("Unsupported offset byte-size.")}const c=a?n.getUint64(8,o):n.getUint32(4,o);return new Te(e,o,a,c,t)}close(){return"function"==typeof this.source.close&&this.source.close()}}t.default=Te;class Oe extends Ee{constructor(e,t){super(),this.mainFile=e,this.overviewFiles=t,this.imageFiles=[e].concat(t),this.fileDirectoriesPerFile=null,this.fileDirectoriesPerFileParsing=null,this.imageCount=null}async parseFileDirectoriesPerFile(){const e=[this.mainFile.parseFileDirectoryAt(this.mainFile.firstIFDOffset)].concat(this.overviewFiles.map(e=>e.parseFileDirectoryAt(e.firstIFDOffset)));return this.fileDirectoriesPerFile=await Promise.all(e),this.fileDirectoriesPerFile}async getImage(e=0){await this.getImageCount(),await this.parseFileDirectoriesPerFile();let t=0,r=0;for(let n=0;n<this.imageFiles.length;n++){const i=this.imageFiles[n];for(let o=0;o<this.imageCounts[n];o++){if(e===t){const e=await i.requestIFD(r);return new H(e.fileDirectory,i.geoKeyDirectory,i.dataView,i.littleEndian,i.cache,i.source)}t++,r++}r=0}throw new RangeError("Invalid image index")}async getImageCount(){if(null!==this.imageCount)return this.imageCount;const e=[this.mainFile.getImageCount()].concat(this.overviewFiles.map(e=>e.getImageCount()));return this.imageCounts=await Promise.all(e),this.imageCount=this.imageCounts.reduce((e,t)=>e+t,0),this.imageCount}}async function Ae(e,t={}){return Te.fromSource(oe(e,t))}async function Pe(e){return Te.fromSource(function(e){return{fetch:async(t,r)=>e.slice(t,t+r)}}(e))}async function Ie(e){return Te.fromSource(se(e))}async function De(e){return Te.fromSource((t=e,{fetch:async(e,r)=>new Promise((n,i)=>{const o=t.slice(e,e+r),s=new FileReader;s.onload=e=>n(e.target.result),s.onerror=i,s.readAsArrayBuffer(o)})}));var t}async function Me(e,t=[],r={}){const n=await Te.fromSource(oe(e,r)),i=await Promise.all(t.map(e=>Te.fromSource(oe(e,r))));return new Oe(n,i)}async function Re(e,t){return we(e,t)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(5);Object(n.b)().blob;const i=Object(n.b)().default},,,function(e,t,r){"use strict";var n=r(17),i=r(38);var o=function(e){"function"==typeof e?e():e&&"function"==typeof e.unsubscribe&&e.unsubscribe()};t.a=function(e){const t=new i.a;let r,s=0;return new n.a(n=>{r||(r=e.subscribe(t));const i=t.subscribe(n);return s++,()=>{s--,i.unsubscribe(),0===s&&(o(r),r=void 0)}})}}]);',null)}},function(e,t,r){"use strict";var n=window.URL||window.webkitURL;e.exports=function(e,t){try{try{var r;try{(r=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder)).append(e),r=r.getBlob()}catch(t){r=new Blob([e])}return new Worker(n.createObjectURL(r))}catch(t){return new Worker("data:application/javascript,"+encodeURIComponent(e))}}catch(e){if(!t)throw Error("Inline worker is not supported");return new Worker(t)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=function(e,t){return new Promise((function(r,l){try{t&&console.log("starting parseData with",e),t&&console.log("\tGeoTIFF:","undefined"==typeof GeoTIFF?"undefined":i(GeoTIFF));var u={},f=void 0,h=void 0;if("object"===e.rasterType)u.values=e.data,u.height=f=e.metadata.height||u.values[0].length,u.width=h=e.metadata.width||u.values[0][0].length,u.pixelHeight=e.metadata.pixelHeight,u.pixelWidth=e.metadata.pixelWidth,u.projection=e.metadata.projection,u.xmin=e.metadata.xmin,u.ymax=e.metadata.ymax,u.noDataValue=e.metadata.noDataValue,u.numberOfRasters=u.values.length,u.xmax=u.xmin+u.width*u.pixelWidth,u.ymin=u.ymax-u.height*u.pixelHeight,u._data=null,r(c(u));else if("geotiff"===e.rasterType){u._data=e.data;var d=o.fromArrayBuffer;"url"===e.sourceType&&(d=o.fromUrl),t&&console.log("data.rasterType is geotiff"),r(d(e.data).then((function(r){return t&&console.log("geotiff:",r),r.getImage().then((function(r){try{t&&console.log("image:",r);var i=r.fileDirectory,o=r.getGeoKeys(),d=o.GeographicTypeGeoKey,p=o.ProjectedCSTypeGeoKey;u.projection=p||d,t&&console.log("projection:",u.projection),u.height=f=r.getHeight(),t&&console.log("result.height:",u.height),u.width=h=r.getWidth(),t&&console.log("result.width:",u.width);var g=r.getResolution(),m=n(g,2),b=m[0],y=m[1];u.pixelHeight=Math.abs(y),u.pixelWidth=Math.abs(b);var w=r.getOrigin(),v=n(w,2),_=v[0],k=v[1];return u.xmin=_,u.xmax=u.xmin+h*u.pixelWidth,u.ymax=k,u.ymin=u.ymax-f*u.pixelHeight,u.noDataValue=i.GDAL_NODATA?parseFloat(i.GDAL_NODATA):null,u.numberOfRasters=i.SamplesPerPixel,i.ColorMap&&(u.palette=(0,s.getPalette)(r)),"url"!==e.sourceType?r.readRasters().then((function(e){return u.values=e.map((function(e){return(0,a.unflatten)(e,{height:f,width:h})})),c(u)})):u}catch(e){l(e),console.error("[georaster] error parsing georaster:",e)}}))})))}}catch(e){l(e),console.error("[georaster] error parsing georaster:",e)}}))};var o=r(35),s=r(74),a=r(34);function c(e,t){var r=e.noDataValue,n=e.height,i=e.width;return new Promise((function(o,s){e.maxs=[],e.mins=[],e.ranges=[];for(var a=void 0,c=void 0,l=0;l<e.numberOfRasters;l++){var u=e.values[l];t&&console.log("[georaster] rows:",u);for(var f=0;f<n;f++)for(var h=u[f],d=0;d<i;d++){var p=h[d];p==r||isNaN(p)||(void 0===c||p<c?c=p:(void 0===a||p>a)&&(a=p))}e.maxs.push(a),e.mins.push(c),e.ranges.push(a-c)}o(e)}))}},function(e,t,r){var n=r(50).Transform,i=r(6);function o(e){n.call(this,e),this._destroyed=!1}function s(e,t,r){r(null,e)}function a(e){return function(t,r,n){return"function"==typeof t&&(n=r,r=t,t={}),"function"!=typeof r&&(r=s),"function"!=typeof n&&(n=null),e(t,r,n)}}i(o,n),o.prototype.destroy=function(e){if(!this._destroyed){this._destroyed=!0;var t=this;process.nextTick((function(){e&&t.emit("error",e),t.emit("close")}))}},e.exports=a((function(e,t,r){var n=new o(e);return n._transform=t,r&&(n._flush=r),n})),e.exports.ctor=a((function(e,t,r){function n(t){if(!(this instanceof n))return new n(t);this.options=Object.assign({},e,t),o.call(this,this.options)}return i(n,o),n.prototype._transform=t,r&&(n.prototype._flush=r),n})),e.exports.obj=a((function(e,t,r){var n=new o(Object.assign({objectMode:!0,highWaterMark:16},e));return n._transform=t,r&&(n._flush=r),n}))},function(e,t,r){var n=r(0);"disable"===process.env.READABLE_STREAM&&n?(e.exports=n,(t=e.exports=n.Readable).Readable=n.Readable,t.Writable=n.Writable,t.Duplex=n.Duplex,t.Transform=n.Transform,t.PassThrough=n.PassThrough,t.Stream=n):((t=e.exports=r(26)).Stream=n||t,t.Readable=t,t.Writable=r(29),t.Duplex=r(7),t.Transform=r(31),t.PassThrough=r(55))},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},function(e,t,r){"use strict";var n=r(18).Buffer,i=r(13);e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},e.prototype.concat=function(e){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var t,r,i,o=n.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,r=o,i=a,t.copy(r,i),a+=s.data.length,s=s.next;return o},e}(),i&&i.inspect&&i.inspect.custom&&(e.exports.prototype[i.inspect.custom]=function(){var e=i.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t,r){e.exports=r(13).deprecate},function(e,t,r){"use strict";e.exports=o;var n=r(31),i=Object.create(r(12));function o(e){if(!(this instanceof o))return new o(e);n.call(this,e)}i.inherits=r(6),i.inherits(o,n),o.prototype._transform=function(e,t,r){r(null,e)}},function(e,t,r){"use strict";var n=r(19),i=r(57),o=r(58),s=r(59),a=r(60);function c(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function l(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function u(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new n.Buf32(852),t.distcode=t.distdyn=new n.Buf32(592),t.sane=1,t.back=-1,0):-2}function f(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,u(e)):-2}function h(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?-2:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,f(e))):-2}function d(e,t){var r,n;return e?(n=new l,e.state=n,n.window=null,0!==(r=h(e,t))&&(e.state=null),r):-2}var p,g,m=!0;function b(e){if(m){var t;for(p=new n.Buf32(512),g=new n.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(a(1,e.lens,0,288,p,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(2,e.lens,0,32,g,0,e.work,{bits:5}),m=!1}e.lencode=p,e.lenbits=9,e.distcode=g,e.distbits=5}function y(e,t,r,i){var o,s=e.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new n.Buf8(s.wsize)),i>=s.wsize?(n.arraySet(s.window,t,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):((o=s.wsize-s.wnext)>i&&(o=i),n.arraySet(s.window,t,r-i,o,s.wnext),(i-=o)?(n.arraySet(s.window,t,r-i,i,0),s.wnext=i,s.whave=s.wsize):(s.wnext+=o,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=o))),0}t.inflateReset=f,t.inflateReset2=h,t.inflateResetKeep=u,t.inflateInit=function(e){return d(e,15)},t.inflateInit2=d,t.inflate=function(e,t){var r,l,u,f,h,d,p,g,m,w,v,_,k,S,x,E,C,T,O,A,P,I,D,M,R=0,F=new n.Buf8(4),j=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return-2;12===(r=e.state).mode&&(r.mode=13),h=e.next_out,u=e.output,p=e.avail_out,f=e.next_in,l=e.input,d=e.avail_in,g=r.hold,m=r.bits,w=d,v=p,I=0;e:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;m<16;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}if(2&r.wrap&&35615===g){r.check=0,F[0]=255&g,F[1]=g>>>8&255,r.check=o(r.check,F,2,0),g=0,m=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&g)<<8)+(g>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&g)){e.msg="unknown compression method",r.mode=30;break}if(m-=4,P=8+(15&(g>>>=4)),0===r.wbits)r.wbits=P;else if(P>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<<P,e.adler=r.check=1,r.mode=512&g?10:12,g=0,m=0;break;case 2:for(;m<16;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}if(r.flags=g,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=30;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=30;break}r.head&&(r.head.text=g>>8&1),512&r.flags&&(F[0]=255&g,F[1]=g>>>8&255,r.check=o(r.check,F,2,0)),g=0,m=0,r.mode=3;case 3:for(;m<32;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}r.head&&(r.head.time=g),512&r.flags&&(F[0]=255&g,F[1]=g>>>8&255,F[2]=g>>>16&255,F[3]=g>>>24&255,r.check=o(r.check,F,4,0)),g=0,m=0,r.mode=4;case 4:for(;m<16;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}r.head&&(r.head.xflags=255&g,r.head.os=g>>8),512&r.flags&&(F[0]=255&g,F[1]=g>>>8&255,r.check=o(r.check,F,2,0)),g=0,m=0,r.mode=5;case 5:if(1024&r.flags){for(;m<16;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}r.length=g,r.head&&(r.head.extra_len=g),512&r.flags&&(F[0]=255&g,F[1]=g>>>8&255,r.check=o(r.check,F,2,0)),g=0,m=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((_=r.length)>d&&(_=d),_&&(r.head&&(P=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),n.arraySet(r.head.extra,l,f,_,P)),512&r.flags&&(r.check=o(r.check,l,_,f)),d-=_,f+=_,r.length-=_),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===d)break e;_=0;do{P=l[f+_++],r.head&&P&&r.length<65536&&(r.head.name+=String.fromCharCode(P))}while(P&&_<d);if(512&r.flags&&(r.check=o(r.check,l,_,f)),d-=_,f+=_,P)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===d)break e;_=0;do{P=l[f+_++],r.head&&P&&r.length<65536&&(r.head.comment+=String.fromCharCode(P))}while(P&&_<d);if(512&r.flags&&(r.check=o(r.check,l,_,f)),d-=_,f+=_,P)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;m<16;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}if(g!==(65535&r.check)){e.msg="header crc mismatch",r.mode=30;break}g=0,m=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;m<32;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}e.adler=r.check=c(g),g=0,m=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=h,e.avail_out=p,e.next_in=f,e.avail_in=d,r.hold=g,r.bits=m,2;e.adler=r.check=1,r.mode=12;case 12:if(5===t||6===t)break e;case 13:if(r.last){g>>>=7&m,m-=7&m,r.mode=27;break}for(;m<3;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}switch(r.last=1&g,m-=1,3&(g>>>=1)){case 0:r.mode=14;break;case 1:if(b(r),r.mode=20,6===t){g>>>=2,m-=2;break e}break;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}g>>>=2,m-=2;break;case 14:for(g>>>=7&m,m-=7&m;m<32;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}if((65535&g)!=(g>>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&g,g=0,m=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(_=r.length){if(_>d&&(_=d),_>p&&(_=p),0===_)break e;n.arraySet(u,l,f,_,h),d-=_,f+=_,p-=_,h+=_,r.length-=_;break}r.mode=12;break;case 17:for(;m<14;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}if(r.nlen=257+(31&g),g>>>=5,m-=5,r.ndist=1+(31&g),g>>>=5,m-=5,r.ncode=4+(15&g),g>>>=4,m-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=30;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;m<3;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}r.lens[j[r.have++]]=7&g,g>>>=3,m-=3}for(;r.have<19;)r.lens[j[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,D={bits:r.lenbits},I=a(0,r.lens,0,19,r.lencode,0,r.work,D),r.lenbits=D.bits,I){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;E=(R=r.lencode[g&(1<<r.lenbits)-1])>>>16&255,C=65535&R,!((x=R>>>24)<=m);){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}if(C<16)g>>>=x,m-=x,r.lens[r.have++]=C;else{if(16===C){for(M=x+2;m<M;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}if(g>>>=x,m-=x,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}P=r.lens[r.have-1],_=3+(3&g),g>>>=2,m-=2}else if(17===C){for(M=x+3;m<M;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}m-=x,P=0,_=3+(7&(g>>>=x)),g>>>=3,m-=3}else{for(M=x+7;m<M;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}m-=x,P=0,_=11+(127&(g>>>=x)),g>>>=7,m-=7}if(r.have+_>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;_--;)r.lens[r.have++]=P}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,D={bits:r.lenbits},I=a(1,r.lens,0,r.nlen,r.lencode,0,r.work,D),r.lenbits=D.bits,I){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,D={bits:r.distbits},I=a(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,D),r.distbits=D.bits,I){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(d>=6&&p>=258){e.next_out=h,e.avail_out=p,e.next_in=f,e.avail_in=d,r.hold=g,r.bits=m,s(e,v),h=e.next_out,u=e.output,p=e.avail_out,f=e.next_in,l=e.input,d=e.avail_in,g=r.hold,m=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;E=(R=r.lencode[g&(1<<r.lenbits)-1])>>>16&255,C=65535&R,!((x=R>>>24)<=m);){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}if(E&&0==(240&E)){for(T=x,O=E,A=C;E=(R=r.lencode[A+((g&(1<<T+O)-1)>>T)])>>>16&255,C=65535&R,!(T+(x=R>>>24)<=m);){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}g>>>=T,m-=T,r.back+=T}if(g>>>=x,m-=x,r.back+=x,r.length=C,0===E){r.mode=26;break}if(32&E){r.back=-1,r.mode=12;break}if(64&E){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&E,r.mode=22;case 22:if(r.extra){for(M=r.extra;m<M;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}r.length+=g&(1<<r.extra)-1,g>>>=r.extra,m-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;E=(R=r.distcode[g&(1<<r.distbits)-1])>>>16&255,C=65535&R,!((x=R>>>24)<=m);){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}if(0==(240&E)){for(T=x,O=E,A=C;E=(R=r.distcode[A+((g&(1<<T+O)-1)>>T)])>>>16&255,C=65535&R,!(T+(x=R>>>24)<=m);){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}g>>>=T,m-=T,r.back+=T}if(g>>>=x,m-=x,r.back+=x,64&E){e.msg="invalid distance code",r.mode=30;break}r.offset=C,r.extra=15&E,r.mode=24;case 24:if(r.extra){for(M=r.extra;m<M;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}r.offset+=g&(1<<r.extra)-1,g>>>=r.extra,m-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===p)break e;if(_=v-p,r.offset>_){if((_=r.offset-_)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}_>r.wnext?(_-=r.wnext,k=r.wsize-_):k=r.wnext-_,_>r.length&&(_=r.length),S=r.window}else S=u,k=h-r.offset,_=r.length;_>p&&(_=p),p-=_,r.length-=_;do{u[h++]=S[k++]}while(--_);0===r.length&&(r.mode=21);break;case 26:if(0===p)break e;u[h++]=r.length,p--,r.mode=21;break;case 27:if(r.wrap){for(;m<32;){if(0===d)break e;d--,g|=l[f++]<<m,m+=8}if(v-=p,e.total_out+=v,r.total+=v,v&&(e.adler=r.check=r.flags?o(r.check,u,v,h-v):i(r.check,u,v,h-v)),v=p,(r.flags?g:c(g))!==r.check){e.msg="incorrect data check",r.mode=30;break}g=0,m=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;m<32;){if(0===d)break e;d--,g+=l[f++]<<m,m+=8}if(g!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=30;break}g=0,m=0}r.mode=29;case 29:I=1;break e;case 30:I=-3;break e;case 31:return-4;case 32:default:return-2}return e.next_out=h,e.avail_out=p,e.next_in=f,e.avail_in=d,r.hold=g,r.bits=m,(r.wsize||v!==e.avail_out&&r.mode<30&&(r.mode<27||4!==t))&&y(e,e.output,e.next_out,v-e.avail_out)?(r.mode=31,-4):(w-=e.avail_in,v-=e.avail_out,e.total_in+=w,e.total_out+=v,r.total+=v,r.wrap&&v&&(e.adler=r.check=r.flags?o(r.check,u,v,e.next_out-v):i(r.check,u,v,e.next_out-v)),e.data_type=r.bits+(r.last?64:0)+(12===r.mode?128:0)+(20===r.mode||15===r.mode?256:0),(0===w&&0===v||4===t)&&0===I&&(I=-5),I)},t.inflateEnd=function(e){if(!e||!e.state)return-2;var t=e.state;return t.window&&(t.window=null),e.state=null,0},t.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?-2:(r.head=t,t.done=!1,0):-2},t.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?-2:11===r.mode&&i(1,t,n,0)!==r.check?-3:y(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,0):-2},t.inflateInfo="pako inflate (from Nodeca project)"},function(e,t,r){"use strict";e.exports=function(e,t,r,n){for(var i=65535&e|0,o=e>>>16&65535|0,s=0;0!==r;){r-=s=r>2e3?2e3:r;do{o=o+(i=i+t[n++]|0)|0}while(--s);i%=65521,o%=65521}return i|o<<16|0}},function(e,t,r){"use strict";var n=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();e.exports=function(e,t,r,i){var o=n,s=i+r;e^=-1;for(var a=i;a<s;a++)e=e>>>8^o[255&(e^t[a])];return-1^e}},function(e,t,r){"use strict";e.exports=function(e,t){var r,n,i,o,s,a,c,l,u,f,h,d,p,g,m,b,y,w,v,_,k,S,x,E,C;r=e.state,n=e.next_in,E=e.input,i=n+(e.avail_in-5),o=e.next_out,C=e.output,s=o-(t-e.avail_out),a=o+(e.avail_out-257),c=r.dmax,l=r.wsize,u=r.whave,f=r.wnext,h=r.window,d=r.hold,p=r.bits,g=r.lencode,m=r.distcode,b=(1<<r.lenbits)-1,y=(1<<r.distbits)-1;e:do{p<15&&(d+=E[n++]<<p,p+=8,d+=E[n++]<<p,p+=8),w=g[d&b];t:for(;;){if(d>>>=v=w>>>24,p-=v,0===(v=w>>>16&255))C[o++]=65535&w;else{if(!(16&v)){if(0==(64&v)){w=g[(65535&w)+(d&(1<<v)-1)];continue t}if(32&v){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}_=65535&w,(v&=15)&&(p<v&&(d+=E[n++]<<p,p+=8),_+=d&(1<<v)-1,d>>>=v,p-=v),p<15&&(d+=E[n++]<<p,p+=8,d+=E[n++]<<p,p+=8),w=m[d&y];r:for(;;){if(d>>>=v=w>>>24,p-=v,!(16&(v=w>>>16&255))){if(0==(64&v)){w=m[(65535&w)+(d&(1<<v)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(k=65535&w,p<(v&=15)&&(d+=E[n++]<<p,(p+=8)<v&&(d+=E[n++]<<p,p+=8)),(k+=d&(1<<v)-1)>c){e.msg="invalid distance too far back",r.mode=30;break e}if(d>>>=v,p-=v,k>(v=o-s)){if((v=k-v)>u&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(S=0,x=h,0===f){if(S+=l-v,v<_){_-=v;do{C[o++]=h[S++]}while(--v);S=o-k,x=C}}else if(f<v){if(S+=l+f-v,(v-=f)<_){_-=v;do{C[o++]=h[S++]}while(--v);if(S=0,f<_){_-=v=f;do{C[o++]=h[S++]}while(--v);S=o-k,x=C}}}else if(S+=f-v,v<_){_-=v;do{C[o++]=h[S++]}while(--v);S=o-k,x=C}for(;_>2;)C[o++]=x[S++],C[o++]=x[S++],C[o++]=x[S++],_-=3;_&&(C[o++]=x[S++],_>1&&(C[o++]=x[S++]))}else{S=o-k;do{C[o++]=C[S++],C[o++]=C[S++],C[o++]=C[S++],_-=3}while(_>2);_&&(C[o++]=C[S++],_>1&&(C[o++]=C[S++]))}break}}break}}while(n<i&&o<a);n-=_=p>>3,d&=(1<<(p-=_<<3))-1,e.next_in=n,e.next_out=o,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=o<a?a-o+257:257-(o-a),r.hold=d,r.bits=p}},function(e,t,r){"use strict";var n=r(19),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],s=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],a=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];e.exports=function(e,t,r,c,l,u,f,h){var d,p,g,m,b,y,w,v,_,k=h.bits,S=0,x=0,E=0,C=0,T=0,O=0,A=0,P=0,I=0,D=0,M=null,R=0,F=new n.Buf16(16),j=new n.Buf16(16),L=null,U=0;for(S=0;S<=15;S++)F[S]=0;for(x=0;x<c;x++)F[t[r+x]]++;for(T=k,C=15;C>=1&&0===F[C];C--);if(T>C&&(T=C),0===C)return l[u++]=20971520,l[u++]=20971520,h.bits=1,0;for(E=1;E<C&&0===F[E];E++);for(T<E&&(T=E),P=1,S=1;S<=15;S++)if(P<<=1,(P-=F[S])<0)return-1;if(P>0&&(0===e||1!==C))return-1;for(j[1]=0,S=1;S<15;S++)j[S+1]=j[S]+F[S];for(x=0;x<c;x++)0!==t[r+x]&&(f[j[t[r+x]]++]=x);if(0===e?(M=L=f,y=19):1===e?(M=i,R-=257,L=o,U-=257,y=256):(M=s,L=a,y=-1),D=0,x=0,S=E,b=u,O=T,A=0,g=-1,m=(I=1<<T)-1,1===e&&I>852||2===e&&I>592)return 1;for(;;){w=S-A,f[x]<y?(v=0,_=f[x]):f[x]>y?(v=L[U+f[x]],_=M[R+f[x]]):(v=96,_=0),d=1<<S-A,E=p=1<<O;do{l[b+(D>>A)+(p-=d)]=w<<24|v<<16|_|0}while(0!==p);for(d=1<<S-1;D&d;)d>>=1;if(0!==d?(D&=d-1,D+=d):D=0,x++,0==--F[S]){if(S===C)break;S=t[r+f[x]]}if(S>T&&(D&m)!==g){for(0===A&&(A=T),b+=E,P=1<<(O=S-A);O+A<C&&!((P-=F[O+A])<=0);)O++,P<<=1;if(I+=1<<O,1===e&&I>852||2===e&&I>592)return 1;l[g=D&m]=T<<24|O<<16|b-u|0}}return 0!==D&&(l[b+D]=S-A<<24|64<<16|0),h.bits=T,0}},function(e,t,r){"use strict";var n=r(19),i=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch(e){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){o=!1}for(var s=new n.Buf8(256),a=0;a<256;a++)s[a]=a>=252?6:a>=248?5:a>=240?4:a>=224?3:a>=192?2:1;function c(e,t){if(t<65534&&(e.subarray&&o||!e.subarray&&i))return String.fromCharCode.apply(null,n.shrinkBuf(e,t));for(var r="",s=0;s<t;s++)r+=String.fromCharCode(e[s]);return r}s[254]=s[254]=1,t.string2buf=function(e){var t,r,i,o,s,a=e.length,c=0;for(o=0;o<a;o++)55296==(64512&(r=e.charCodeAt(o)))&&o+1<a&&56320==(64512&(i=e.charCodeAt(o+1)))&&(r=65536+(r-55296<<10)+(i-56320),o++),c+=r<128?1:r<2048?2:r<65536?3:4;for(t=new n.Buf8(c),s=0,o=0;s<c;o++)55296==(64512&(r=e.charCodeAt(o)))&&o+1<a&&56320==(64512&(i=e.charCodeAt(o+1)))&&(r=65536+(r-55296<<10)+(i-56320),o++),r<128?t[s++]=r:r<2048?(t[s++]=192|r>>>6,t[s++]=128|63&r):r<65536?(t[s++]=224|r>>>12,t[s++]=128|r>>>6&63,t[s++]=128|63&r):(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63,t[s++]=128|r>>>6&63,t[s++]=128|63&r);return t},t.buf2binstring=function(e){return c(e,e.length)},t.binstring2buf=function(e){for(var t=new n.Buf8(e.length),r=0,i=t.length;r<i;r++)t[r]=e.charCodeAt(r);return t},t.buf2string=function(e,t){var r,n,i,o,a=t||e.length,l=new Array(2*a);for(n=0,r=0;r<a;)if((i=e[r++])<128)l[n++]=i;else if((o=s[i])>4)l[n++]=65533,r+=o-1;else{for(i&=2===o?31:3===o?15:7;o>1&&r<a;)i=i<<6|63&e[r++],o--;o>1?l[n++]=65533:i<65536?l[n++]=i:(i-=65536,l[n++]=55296|i>>10&1023,l[n++]=56320|1023&i)}return c(l,n)},t.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+s[e[r]]>t?r:t}},function(e,t,r){"use strict";e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},function(e,t,r){"use strict";e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},function(e,t,r){"use strict";e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},function(e,t,r){"use strict";e.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},function(e,t,r){e.exports=r.p+"0.georaster.bundle.min.worker.js"},function(e,t,r){"use strict";(function(t){var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=r(10),s=r(68).fork,a=o.join(t,"worker.js"),c=/^(error|message)$/,l={inspect:9229,debug:5858},u={min:1,max:300},f=function(){function e(t){var r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{cwd:process.cwd()};i(this,e);var c="function"==typeof t,f=c?t.toString():t;o.cwd||(o.cwd=process.cwd());var h=process.execArgv.filter((function(e){return/(debug|inspect)/.test(e)}));if(h.length>0&&!o.noDebugRedirection){o.execArgv||(h=Array.from(process.execArgv),o.execArgv=[]);var d=h.findIndex((function(e){return/^--inspect(-brk)?(=\d+)?$/.test(e)})),p=h.findIndex((function(e){return/^--debug(-brk)?(=\d+)?$/.test(e)})),g=d>=0?d:p;if(g>=0){var m=/^--(debug|inspect)(?:-brk)?(?:=(\d+))?$/.exec(h[g]),b=l[m[1]];m[2]&&(b=parseInt(m[2])),h[g]="--"+m[1]+"="+(b+u.min+Math.floor(Math.random()*(u.max-u.min))),p>=0&&p!==g&&(m=/^(--debug)(?:-brk)?(.*)/.exec(h[p]),h[p]=m[1]+(m[2]?m[2]:""))}o.execArgv=o.execArgv.concat(h)}delete o.noDebugRedirection,this.child=s(a,n,o),this.onerror=void 0,this.onmessage=void 0,this.child.on("error",(function(e){r.onerror&&r.onerror.call(r,e)})),this.child.on("message",(function(e){var t=JSON.parse(e),n=void 0;!t.error&&r.onmessage&&r.onmessage.call(r,t),t.error&&r.onerror&&((n=new Error(t.error)).stack=t.stack,r.onerror.call(r,n))})),this.child.send({input:f,isfn:c,cwd:o.cwd,esm:o.esm})}return n(e,[{key:"addEventListener",value:function(e,t){c.test(e)&&(this["on"+e]=t)}},{key:"postMessage",value:function(e){this.child.send(JSON.stringify({data:e},null,0))}},{key:"terminate",value:function(){this.child.kill("SIGINT")}}],[{key:"setRange",value:function(e,t){return!(e>=t)&&(u.min=e,u.max=t,!0)}}]),e}();e.exports=f}).call(this,"/")},function(e,t){e.exports=require("child_process")},function(e,t,r){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,i=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(n++,"%c"===e&&(i=n))}),t.splice(i,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=r(33)(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},function(e,t){var r=1e3,n=6e4,i=60*n,o=24*i;function s(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}e.exports=function(e,t){t=t||{};var a=typeof e;if("string"===a&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var s=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*s;case"weeks":case"week":case"w":return 6048e5*s;case"days":case"day":case"d":return s*o;case"hours":case"hour":case"hrs":case"hr":case"h":return s*i;case"minutes":case"minute":case"mins":case"min":case"m":return s*n;case"seconds":case"second":case"secs":case"sec":case"s":return s*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}(e);if("number"===a&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=o)return s(e,t,o,"day");if(t>=i)return s(e,t,i,"hour");if(t>=n)return s(e,t,n,"minute");if(t>=r)return s(e,t,r,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=o)return Math.round(e/o)+"d";if(t>=i)return Math.round(e/i)+"h";if(t>=n)return Math.round(e/n)+"m";if(t>=r)return Math.round(e/r)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,r){const n=r(72),i=r(13);t.init=function(e){e.inspectOpts={};const r=Object.keys(t.inspectOpts);for(let n=0;n<r.length;n++)e.inspectOpts[r[n]]=t.inspectOpts[r[n]]},t.log=function(...e){return process.stderr.write(i.format(...e)+"\n")},t.formatArgs=function(r){const{namespace:n,useColors:i}=this;if(i){const t=this.color,i="[3"+(t<8?t:"8;5;"+t),o=` ${i};1m${n} `;r[0]=o+r[0].split("\n").join("\n"+o),r.push(i+"m+"+e.exports.humanize(this.diff)+"")}else r[0]=function(){if(t.inspectOpts.hideDate)return"";return(new Date).toISOString()+" "}()+n+" "+r[0]},t.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},t.load=function(){return process.env.DEBUG},t.useColors=function(){return"colors"in t.inspectOpts?Boolean(t.inspectOpts.colors):n.isatty(process.stderr.fd)},t.destroy=i.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=r(73);e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{const r=t.substring(6).toLowerCase().replace(/_([a-z])/g,(e,t)=>t.toUpperCase());let n=process.env[t];return n=!!/^(yes|on|true|enabled)$/i.test(n)||!/^(no|off|false|disabled)$/i.test(n)&&("null"===n?null:Number(n)),e[r]=n,e},{}),e.exports=r(33)(t);const{formatters:o}=e.exports;o.o=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts).split("\n").map(e=>e.trim()).join(" ")},o.O=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts)}},function(e,t){e.exports=require("tty")},function(e,t,r){"use strict";var n=process.argv,i=n.indexOf("--"),o=function(e){e="--"+e;var t=n.indexOf(e);return-1!==t&&(-1===i||t<i)};e.exports=!(!("FORCE_COLOR"in process.env)&&(o("no-color")||o("no-colors")||o("color=false")||!(o("color")||o("colors")||o("color=true")||o("color=always"))&&(process.stdout&&!process.stdout.isTTY||"win32"!==process.platform&&!("COLORTERM"in process.env)&&("dumb"===process.env.TERM||!/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(process.env.TERM)))))},function(e,t){e.exports={getPalette:(e,{debug:t=!1}={debug:!1})=>{t&&console.log("starting getPalette with image",e);const{fileDirectory:r}=e,{BitsPerSample:n,ColorMap:i,ImageLength:o,ImageWidth:s,PhotometricInterpretation:a,SampleFormat:c,SamplesPerPixel:l}=r;if(!i)throw new Error("[geotiff-palette]: the image does not contain a color map, so we can't make a palette.");const u=Math.pow(2,n);t&&console.log("[geotiff-palette]: count:",u);const f=i.length/3;if(t&&console.log("[geotiff-palette]: bandSize:",f),f!==u)throw new Error("[geotiff-palette]: can't handle situations where the color map has more or less values than the number of possible values in a raster");const h=f,d=h+f,p=[];for(let e=0;e<u;e++)p.push([Math.floor(i[e]/256),Math.floor(i[h+e]/256),Math.floor(i[d+e]/256),255]);return t&&console.log("[geotiff-palette]: result is ",p),p}}},function(e,t,r){"use strict";function n(e,t){if("undefined"==typeof ImageData)throw"toCanvas is not supported in your environment";{const r=document.createElement("CANVAS"),n=t&&t.height?Math.min(e.height,t.height):Math.min(e.height,100),i=t&&t.width?Math.min(e.width,t.width):Math.min(e.width,100);r.height=n,r.width=i,r.style.minHeight="200px",r.style.minWidth="400px",r.style.maxWidth="100%";const o=r.getContext("2d"),s=function(e,t,r){if(e.values){const{noDataValue:n,mins:i,ranges:o,values:s}=e,a=s.length,c=e.width/t,l=e.height/r,u=new Uint8ClampedArray(t*r*4);for(let e=0;e<r;e++)for(let r=0;r<t;r++){const f=Math.round(e*l),h=Math.round(r*c),d=s.map(e=>{try{return e[f][h]}catch(e){console.error(e)}});if(d.every(e=>void 0!==e&&e!==n)){const n=e*(4*t)+4*r;if(1===a){const e=Math.round(d[0]),t=Math.round((e-i[0])/o[0]*255);u[n]=t,u[n+1]=t,u[n+2]=t,u[n+3]=255}else if(3===a)try{const[e,t,r]=d;u[n]=e,u[n+1]=t,u[n+2]=r,u[n+3]=255}catch(e){console.error(e)}else if(4===a)try{const[e,t,r,i]=d;u[n]=e,u[n+1]=t,u[n+2]=r,u[n+3]=i}catch(e){console.error(e)}}}return new ImageData(u,t,r)}}(e,i,n);return o.putImageData(s,0,0),r}}r.r(t),r.d(t,"default",(function(){return n}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(8);Object(n.b)().blob;const i=Object(n.b)().default},,,function(e,t,r){"use strict";var n=r(21),i=r(41);var o=function(e){"function"==typeof e?e():e&&"function"==typeof e.unsubscribe&&e.unsubscribe()};t.a=function(e){const t=new i.a;let r,s=0;return new n.a(n=>{r||(r=e.subscribe(t));const i=t.subscribe(n);return s++,()=>{s--,i.unsubscribe(),0===s&&(o(r),r=void 0)}})}}])}));
\No newline at end of file