@basemaps/lambda-tiler 6.32.2 → 6.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var $g=Object.create;var Wa=Object.defineProperty;var qg=Object.getOwnPropertyDescriptor;var Fg=Object.getOwnPropertyNames;var Wg=Object.getPrototypeOf,Hg=Object.prototype.hasOwnProperty;var Gg=(t,e,r)=>e in t?Wa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Ha=(t,e)=>()=>(t&&(e=t(t=0)),e);var V=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Zd=(t,e)=>{for(var r in e)Wa(t,r,{get:e[r],enumerable:!0})},Yd=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Fg(e))!Hg.call(t,n)&&n!==r&&Wa(t,n,{get:()=>e[n],enumerable:!(i=qg(e,n))||i.enumerable});return t};var de=(t,e,r)=>(r=t!=null?$g(Wg(t)):{},Yd(e||!t||!t.__esModule?Wa(r,"default",{value:t,enumerable:!0}):r,t)),Vg=t=>Yd(Wa({},"__esModule",{value:!0}),t);var Hc=(t,e,r)=>(Gg(t,typeof e!="symbol"?e+"":e,r),r),Xd=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)};var Ee=(t,e,r)=>(Xd(t,e,"read from private field"),r?r.call(t):e.get(t)),bt=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},Ze=(t,e,r,i)=>(Xd(t,e,"write to private field"),i?i.call(t,r):e.set(t,r),r),Gc=(t,e,r,i)=>({set _(n){Ze(t,e,n,r)},get _(){return Ee(t,e,i)}});var r2=V(ql=>{"use strict";Object.defineProperty(ql,"__esModule",{value:!0});ql.Nztm2000Quad=void 0;ql.Nztm2000Quad={type:"TileMatrixSetType",title:"LINZ NZTM2000 Map Tile Grid V2",abstract:"",identifier:"NZTM2000Quad",supportedCRS:"https://www.opengis.net/def/crs/EPSG/0/2193",boundingBox:{type:"BoundingBoxType",crs:"https://www.opengis.net/def/crs/EPSG/0/2193",lowerCorner:[419435.9938,-32605867284e-4],upperCorner:[104381901652e-4,6758167443e-3]},tileMatrix:[{type:"TileMatrixType",identifier:"0",scaleDenominator:139770566007179e-6,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:1,matrixHeight:1},{type:"TileMatrixType",identifier:"1",scaleDenominator:698852830035895e-7,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:2,matrixHeight:2},{type:"TileMatrixType",identifier:"2",scaleDenominator:3494264150179475e-8,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:4,matrixHeight:4},{type:"TileMatrixType",identifier:"3",scaleDenominator:17471320750897374e-9,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:8,matrixHeight:8},{type:"TileMatrixType",identifier:"4",scaleDenominator:8735660375448687e-9,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:16,matrixHeight:16},{type:"TileMatrixType",identifier:"5",scaleDenominator:4.3678301877243435e6,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:32,matrixHeight:32},{type:"TileMatrixType",identifier:"6",scaleDenominator:2.1839150938621718e6,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:64,matrixHeight:64},{type:"TileMatrixType",identifier:"7",scaleDenominator:1.0919575469310859e6,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:128,matrixHeight:128},{type:"TileMatrixType",identifier:"8",scaleDenominator:545978.7734655429,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:256,matrixHeight:256},{type:"TileMatrixType",identifier:"9",scaleDenominator:272989.38673277147,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:512,matrixHeight:512},{type:"TileMatrixType",identifier:"10",scaleDenominator:136494.69336638573,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:1024,matrixHeight:1024},{type:"TileMatrixType",identifier:"11",scaleDenominator:68247.34668319287,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:2048,matrixHeight:2048},{type:"TileMatrixType",identifier:"12",scaleDenominator:34123.67334159643,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:4096,matrixHeight:4096},{type:"TileMatrixType",identifier:"13",scaleDenominator:17061.836670798217,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:8192,matrixHeight:8192},{type:"TileMatrixType",identifier:"14",scaleDenominator:8530.918335399108,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:16384,matrixHeight:16384},{type:"TileMatrixType",identifier:"15",scaleDenominator:4265.459167699554,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:32768,matrixHeight:32768},{type:"TileMatrixType",identifier:"16",scaleDenominator:2132.729583849777,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:65536,matrixHeight:65536},{type:"TileMatrixType",identifier:"17",scaleDenominator:1066.3647919248886,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:131072,matrixHeight:131072},{type:"TileMatrixType",identifier:"18",scaleDenominator:533.1823959624443,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:262144,matrixHeight:262144},{type:"TileMatrixType",identifier:"19",scaleDenominator:266.59119798122214,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:524288,matrixHeight:524288},{type:"TileMatrixType",identifier:"20",scaleDenominator:133.29559899061107,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:1048576,matrixHeight:1048576},{type:"TileMatrixType",identifier:"21",scaleDenominator:66.64779949530553,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:2097152,matrixHeight:2097152}]}});var i2=V(Fl=>{"use strict";Object.defineProperty(Fl,"__esModule",{value:!0});Fl.Nztm2000=void 0;Fl.Nztm2000={type:"TileMatrixSetType",title:"LINZ NZTM2000 Map Tile Grid",abstract:"See https://www.linz.govt.nz/data/linz-data-service/guides-and-documentation/nztm2000-map-tile-service-schema",identifier:"NZTM2000",supportedCRS:"https://www.opengis.net/def/crs/EPSG/0/2193",boundingBox:{type:"BoundingBoxType",crs:"https://www.opengis.net/def/crs/EPSG/0/2193",lowerCorner:[3087e3,274e3],upperCorner:[7173e3,3327e3]},tileMatrix:[{type:"TileMatrixType",identifier:"0",scaleDenominator:32e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:2,matrixHeight:4},{type:"TileMatrixType",identifier:"1",scaleDenominator:16e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:4,matrixHeight:8},{type:"TileMatrixType",identifier:"2",scaleDenominator:8e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:8,matrixHeight:16},{type:"TileMatrixType",identifier:"3",scaleDenominator:4e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:16,matrixHeight:32},{type:"TileMatrixType",identifier:"4",scaleDenominator:2e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:32,matrixHeight:64},{type:"TileMatrixType",identifier:"5",scaleDenominator:1e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:64,matrixHeight:128},{type:"TileMatrixType",identifier:"6",scaleDenominator:5e5,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:128,matrixHeight:256},{type:"TileMatrixType",identifier:"7",scaleDenominator:25e4,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:256,matrixHeight:512},{type:"TileMatrixType",identifier:"8",scaleDenominator:1e5,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:640,matrixHeight:1280},{type:"TileMatrixType",identifier:"9",scaleDenominator:5e4,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:1280,matrixHeight:2560},{type:"TileMatrixType",identifier:"10",scaleDenominator:25e3,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:2560,matrixHeight:5120},{type:"TileMatrixType",identifier:"11",scaleDenominator:1e4,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:6400,matrixHeight:12800},{type:"TileMatrixType",identifier:"12",scaleDenominator:5e3,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:12800,matrixHeight:25600},{type:"TileMatrixType",identifier:"13",scaleDenominator:2500,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:25600,matrixHeight:51200},{type:"TileMatrixType",identifier:"14",scaleDenominator:1e3,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:64e3,matrixHeight:128e3},{type:"TileMatrixType",identifier:"15",scaleDenominator:500,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:128e3,matrixHeight:256e3},{type:"TileMatrixType",identifier:"16",scaleDenominator:250,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:256e3,matrixHeight:512e3}]}});var n2=V(yo=>{"use strict";Object.defineProperty(yo,"__esModule",{value:!0});yo.Nztm2000=yo.Nztm2000Quad=void 0;var Yg=r2();Object.defineProperty(yo,"Nztm2000Quad",{enumerable:!0,get:function(){return Yg.Nztm2000Quad}});var Xg=i2();Object.defineProperty(yo,"Nztm2000",{enumerable:!0,get:function(){return Xg.Nztm2000}})});var Yn=V((Gl,s2)=>{(function(t,e){typeof Gl=="object"&&typeof s2<"u"?e(Gl):typeof define=="function"&&define.amd?define(["exports"],e):e(t.ULID={})})(Gl,function(t){"use strict";function e(C){var I=new Error(C);return I.source="ulid",I}var r="0123456789ABCDEFGHJKMNPQRSTVWXYZ",i=r.length,n=Math.pow(2,48)-1,o=10,a=16;function h(C,I,k){return I>C.length-1?C:C.substr(0,I)+k+C.substr(I+1)}function d(C){for(var I=void 0,k=C.length,B=void 0,z=void 0,H=i-1;!I&&k-->=0;){if(B=C[k],z=r.indexOf(B),z===-1)throw e("incorrectly encoded string");if(z===H){C=h(C,k,r[0]);continue}I=h(C,k,r[z+1])}if(typeof I=="string")return I;throw e("cannot increment this string")}function m(C){var I=Math.floor(C()*i);return I===i&&(I=i-1),r.charAt(I)}function p(C,I){if(isNaN(C))throw new Error(C+" must be a number");if(C>n)throw e("cannot encode time greater than "+n);if(C<0)throw e("time must be positive");if(Number.isInteger(C)===!1)throw e("time must be an integer");for(var k=void 0,B="";I>0;I--)k=C%i,B=r.charAt(k)+B,C=(C-k)/i;return B}function M(C,I){for(var k="";C>0;C--)k=m(I)+k;return k}function R(C){if(C.length!==o+a)throw e("malformed ulid");var I=C.substr(0,o).split("").reverse().reduce(function(k,B,z){var H=r.indexOf(B);if(H===-1)throw e("invalid character found: "+B);return k+=H*Math.pow(i,z)},0);if(I>n)throw e("malformed ulid, timestamp too large");return I}function x(){var C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,I=arguments[1];I||(I=typeof window<"u"?window:null);var k=I&&(I.crypto||I.msCrypto);if(k)return function(){var z=new Uint8Array(1);return k.getRandomValues(z),z[0]/255};try{var B=require("crypto");return function(){return B.randomBytes(1).readUInt8()/255}}catch{}if(C){try{console.error("secure crypto unusable, falling back to insecure Math.random()!")}catch{}return function(){return Math.random()}}throw e("secure crypto unusable, insecure Math.random not allowed")}function w(C){return C||(C=x()),function(k){return isNaN(k)&&(k=Date.now()),p(k,o)+M(a,C)}}function E(C){C||(C=x());var I=0,k=void 0;return function(z){if(isNaN(z)&&(z=Date.now()),z<=I){var H=k=d(k);return p(I,o)+H}I=z;var J=k=M(a,C);return p(z,o)+J}}var T=w();t.replaceCharAt=h,t.incrementBase32=d,t.randomChar=m,t.encodeTime=p,t.encodeRandom=M,t.decodeTime=R,t.detectPrng=x,t.factory=w,t.monotonicFactory=E,t.ulid=T,Object.defineProperty(t,"__esModule",{value:!0})})});var a2=V((VM,o2)=>{"use strict";function ry(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var i=0;i<t.length;i++){var n=t.charAt(i),o=n.charCodeAt(0);if(e[o]!==255)throw new TypeError(n+" is ambiguous");e[o]=i}var a=t.length,h=t.charAt(0),d=Math.log(a)/Math.log(256),m=Math.log(256)/Math.log(a);function p(x){if(x instanceof Uint8Array||(ArrayBuffer.isView(x)?x=new Uint8Array(x.buffer,x.byteOffset,x.byteLength):Array.isArray(x)&&(x=Uint8Array.from(x))),!(x instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(x.length===0)return"";for(var w=0,E=0,T=0,C=x.length;T!==C&&x[T]===0;)T++,w++;for(var I=(C-T)*m+1>>>0,k=new Uint8Array(I);T!==C;){for(var B=x[T],z=0,H=I-1;(B!==0||z<E)&&H!==-1;H--,z++)B+=256*k[H]>>>0,k[H]=B%a>>>0,B=B/a>>>0;if(B!==0)throw new Error("Non-zero carry");E=z,T++}for(var J=I-E;J!==I&&k[J]===0;)J++;for(var se=h.repeat(w);J<I;++J)se+=t.charAt(k[J]);return se}function M(x){if(typeof x!="string")throw new TypeError("Expected String");if(x.length===0)return new Uint8Array;for(var w=0,E=0,T=0;x[w]===h;)E++,w++;for(var C=(x.length-w)*d+1>>>0,I=new Uint8Array(C);x[w];){var k=e[x.charCodeAt(w)];if(k===255)return;for(var B=0,z=C-1;(k!==0||B<T)&&z!==-1;z--,B++)k+=a*I[z]>>>0,I[z]=k%256>>>0,k=k/256>>>0;if(k!==0)throw new Error("Non-zero carry");T=B,w++}for(var H=C-T;H!==C&&I[H]===0;)H++;for(var J=new Uint8Array(E+(C-H)),se=E;H!==C;)J[se++]=I[H++];return J}function R(x){var w=M(x);if(w)return w;throw new Error("Non-base"+a+" character")}return{encode:p,decodeUnsafe:M,decode:R}}o2.exports=ry});var y2=V((Yl,g2)=>{(function(t,e){typeof Yl=="object"&&typeof g2<"u"?e(Yl):typeof define=="function"&&define.amd?define(["exports"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.WebStreamsPolyfill={}))})(Yl,function(t){"use strict";let e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol:u=>`Symbol(${u})`;function r(){}function i(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global}let n=i();function o(u){return typeof u=="object"&&u!==null||typeof u=="function"}let a=r,h=Promise,d=Promise.prototype.then,m=Promise.resolve.bind(h),p=Promise.reject.bind(h);function M(u){return new h(u)}function R(u){return m(u)}function x(u){return p(u)}function w(u,f,_){return d.call(u,f,_)}function E(u,f,_){w(w(u,f,_),void 0,a)}function T(u,f){E(u,f)}function C(u,f){E(u,void 0,f)}function I(u,f,_){return w(u,f,_)}function k(u){w(u,void 0,a)}let B=(()=>{let u=n&&n.queueMicrotask;if(typeof u=="function")return u;let f=R(void 0);return _=>w(f,_)})();function z(u,f,_){if(typeof u!="function")throw new TypeError("Argument is not a function");return Function.prototype.apply.call(u,f,_)}function H(u,f,_){try{return R(z(u,f,_))}catch(P){return x(P)}}let J=16384;class se{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(f){let _=this._back,P=_;_._elements.length===J-1&&(P={_elements:[],_next:void 0}),_._elements.push(f),P!==_&&(this._back=P,_._next=P),++this._size}shift(){let f=this._front,_=f,P=this._cursor,N=P+1,j=f._elements,q=j[P];return N===J&&(_=f._next,N=0),--this._size,this._cursor=N,f!==_&&(this._front=_),j[P]=void 0,q}forEach(f){let _=this._cursor,P=this._front,N=P._elements;for(;(_!==N.length||P._next!==void 0)&&!(_===N.length&&(P=P._next,N=P._elements,_=0,N.length===0));)f(N[_]),++_}peek(){let f=this._front,_=this._cursor;return f._elements[_]}}function Me(u,f){u._ownerReadableStream=f,f._reader=u,f._state==="readable"?st(u):f._state==="closed"?di(u):zt(u,f._storedError)}function Ue(u,f){let _=u._ownerReadableStream;return er(_,f)}function Te(u){u._ownerReadableStream._state==="readable"?fa(u,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):$h(u,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),u._ownerReadableStream._reader=void 0,u._ownerReadableStream=void 0}function Ne(u){return new TypeError("Cannot "+u+" a stream using a released reader")}function st(u){u._closedPromise=M((f,_)=>{u._closedPromise_resolve=f,u._closedPromise_reject=_})}function zt(u,f){st(u),fa(u,f)}function di(u){st(u),In(u)}function fa(u,f){u._closedPromise_reject!==void 0&&(k(u._closedPromise),u._closedPromise_reject(f),u._closedPromise_resolve=void 0,u._closedPromise_reject=void 0)}function $h(u,f){zt(u,f)}function In(u){u._closedPromise_resolve!==void 0&&(u._closedPromise_resolve(void 0),u._closedPromise_resolve=void 0,u._closedPromise_reject=void 0)}let da=e("[[AbortSteps]]"),hr=e("[[ErrorSteps]]"),ma=e("[[CancelSteps]]"),Is=e("[[PullSteps]]"),mi=Number.isFinite||function(u){return typeof u=="number"&&isFinite(u)},qh=Math.trunc||function(u){return u<0?Math.ceil(u):Math.floor(u)};function Fh(u){return typeof u=="object"||typeof u=="function"}function at(u,f){if(u!==void 0&&!Fh(u))throw new TypeError(`${f} is not an object.`)}function Xt(u,f){if(typeof u!="function")throw new TypeError(`${f} is not a function.`)}function j1(u){return typeof u=="object"&&u!==null||typeof u=="function"}function ft(u,f){if(!j1(u))throw new TypeError(`${f} is not an object.`)}function Tr(u,f,_){if(u===void 0)throw new TypeError(`Parameter ${f} is required in '${_}'.`)}function pa(u,f,_){if(u===void 0)throw new TypeError(`${f} is required in '${_}'.`)}function ga(u){return Number(u)}function $1(u){return u===0?0:u}function Wh(u){return $1(qh(u))}function q1(u,f){let P=Number.MAX_SAFE_INTEGER,N=Number(u);if(N=$1(N),!mi(N))throw new TypeError(`${f} is not a finite number`);if(N=Wh(N),N<0||N>P)throw new TypeError(`${f} is outside the accepted range of ${0} to ${P}, inclusive`);return!mi(N)||N===0?0:N}function ya(u,f){if(!Kr(u))throw new TypeError(`${f} is not a ReadableStream.`)}function ji(u){return new Z(u)}function F1(u,f){u._reader._readRequests.push(f)}function Ps(u,f,_){let N=u._reader._readRequests.shift();_?N._closeSteps():N._chunkSteps(f)}function Tt(u){return u._reader._readRequests.length}function $i(u){let f=u._reader;return!(f===void 0||!ot(f))}class Z{constructor(f){if(Tr(f,1,"ReadableStreamDefaultReader"),ya(f,"First parameter"),Jr(f))throw new TypeError("This stream has already been locked for exclusive reading by another reader");Me(this,f),this._readRequests=new se}get closed(){return ot(this)?this._closedPromise:x(Os("closed"))}cancel(f=void 0){return ot(this)?this._ownerReadableStream===void 0?x(Ne("cancel")):Ue(this,f):x(Os("cancel"))}read(){if(!ot(this))return x(Os("read"));if(this._ownerReadableStream===void 0)return x(Ne("read from"));let f,_,P=M((j,q)=>{f=j,_=q});return Ir(this,{_chunkSteps:j=>f({value:j,done:!1}),_closeSteps:()=>f({value:void 0,done:!0}),_errorSteps:j=>_(j)}),P}releaseLock(){if(!ot(this))throw Os("releaseLock");if(this._ownerReadableStream!==void 0){if(this._readRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");Te(this)}}}Object.defineProperties(Z.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Z.prototype,e.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});function ot(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_readRequests")?!1:u instanceof Z}function Ir(u,f){let _=u._ownerReadableStream;_._disturbed=!0,_._state==="closed"?f._closeSteps():_._state==="errored"?f._errorSteps(_._storedError):_._readableStreamController[Is](f)}function Os(u){return new TypeError(`ReadableStreamDefaultReader.prototype.${u} can only be used on a ReadableStreamDefaultReader`)}let W1=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class H1{constructor(f,_){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=f,this._preventCancel=_}next(){let f=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?I(this._ongoingPromise,f,f):f(),this._ongoingPromise}return(f){let _=()=>this._returnSteps(f);return this._ongoingPromise?I(this._ongoingPromise,_,_):_()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});let f=this._reader;if(f._ownerReadableStream===void 0)return x(Ne("iterate"));let _,P,N=M((q,te)=>{_=q,P=te});return Ir(f,{_chunkSteps:q=>{this._ongoingPromise=void 0,B(()=>_({value:q,done:!1}))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,Te(f),_({value:void 0,done:!0})},_errorSteps:q=>{this._ongoingPromise=void 0,this._isFinished=!0,Te(f),P(q)}}),N}_returnSteps(f){if(this._isFinished)return Promise.resolve({value:f,done:!0});this._isFinished=!0;let _=this._reader;if(_._ownerReadableStream===void 0)return x(Ne("finish iterating"));if(!this._preventCancel){let P=Ue(_,f);return Te(_),I(P,()=>({value:f,done:!0}))}return Te(_),R({value:f,done:!0})}}let G1={next(){return V1(this)?this._asyncIteratorImpl.next():x(ba("next"))},return(u){return V1(this)?this._asyncIteratorImpl.return(u):x(ba("return"))}};W1!==void 0&&Object.setPrototypeOf(G1,W1);function Hh(u,f){let _=ji(u),P=new H1(_,f),N=Object.create(G1);return N._asyncIteratorImpl=P,N}function V1(u){if(!o(u)||!Object.prototype.hasOwnProperty.call(u,"_asyncIteratorImpl"))return!1;try{return u._asyncIteratorImpl instanceof H1}catch{return!1}}function ba(u){return new TypeError(`ReadableStreamAsyncIterator.${u} can only be used on a ReadableSteamAsyncIterator`)}let K1=Number.isNaN||function(u){return u!==u};function Pn(u){return u.slice()}function J1(u,f,_,P,N){new Uint8Array(u).set(new Uint8Array(_,P,N),f)}function va(u){return u}function pi(u){return!1}function wa(u,f,_){if(u.slice)return u.slice(f,_);let P=_-f,N=new ArrayBuffer(P);return J1(N,0,u,f,P),N}function Gh(u){return!(typeof u!="number"||K1(u)||u<0)}function Z1(u){let f=wa(u.buffer,u.byteOffset,u.byteOffset+u.byteLength);return new Uint8Array(f)}function _a(u){let f=u._queue.shift();return u._queueTotalSize-=f.size,u._queueTotalSize<0&&(u._queueTotalSize=0),f.value}function ue(u,f,_){if(!Gh(_)||_===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");u._queue.push({value:f,size:_}),u._queueTotalSize+=_}function Vh(u){return u._queue.peek().value}function Fr(u){u._queue=new se,u._queueTotalSize=0}class On{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!ks(this))throw qi("view");return this._view}respond(f){if(!ks(this))throw qi("respond");if(Tr(f,1,"respond"),f=q1(f,"First parameter"),this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");pi(this._view.buffer),Ln(this._associatedReadableByteStreamController,f)}respondWithNewView(f){if(!ks(this))throw qi("respondWithNewView");if(Tr(f,1,"respondWithNewView"),!ArrayBuffer.isView(f))throw new TypeError("You can only respond with array buffer views");if(this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");pi(f.buffer),Nn(this._associatedReadableByteStreamController,f)}}Object.defineProperties(On.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(On.prototype,e.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class Ke{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!gi(this))throw Fi("byobRequest");return Ea(this)}get desiredSize(){if(!gi(this))throw Fi("desiredSize");return Ra(this)}close(){if(!gi(this))throw Fi("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");let f=this._controlledReadableByteStream._state;if(f!=="readable")throw new TypeError(`The stream (in ${f} state) is not in the readable state and cannot be closed`);Wr(this)}enqueue(f){if(!gi(this))throw Fi("enqueue");if(Tr(f,1,"enqueue"),!ArrayBuffer.isView(f))throw new TypeError("chunk must be an array buffer view");if(f.byteLength===0)throw new TypeError("chunk must have non-zero byteLength");if(f.buffer.byteLength===0)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");let _=this._controlledReadableByteStream._state;if(_!=="readable")throw new TypeError(`The stream (in ${_} state) is not in the readable state and cannot be enqueued to`);Ds(this,f)}error(f=void 0){if(!gi(this))throw Fi("error");Ut(this,f)}[ma](f){Y1(this),Fr(this);let _=this._cancelAlgorithm(f);return Bs(this),_}[Is](f){let _=this._controlledReadableByteStream;if(this._queueTotalSize>0){let N=this._queue.shift();this._queueTotalSize-=N.byteLength,Q1(this);let j=new Uint8Array(N.buffer,N.byteOffset,N.byteLength);f._chunkSteps(j);return}let P=this._autoAllocateChunkSize;if(P!==void 0){let N;try{N=new ArrayBuffer(P)}catch(q){f._errorSteps(q);return}let j={buffer:N,bufferByteLength:P,byteOffset:0,byteLength:P,bytesFilled:0,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(j)}F1(_,f),yi(this)}}Object.defineProperties(Ke.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Ke.prototype,e.toStringTag,{value:"ReadableByteStreamController",configurable:!0});function gi(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_controlledReadableByteStream")?!1:u instanceof Ke}function ks(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_associatedReadableByteStreamController")?!1:u instanceof On}function yi(u){if(!Zh(u))return;if(u._pulling){u._pullAgain=!0;return}u._pulling=!0;let _=u._pullAlgorithm();E(_,()=>{u._pulling=!1,u._pullAgain&&(u._pullAgain=!1,yi(u))},P=>{Ut(u,P)})}function Y1(u){Sa(u),u._pendingPullIntos=new se}function xa(u,f){let _=!1;u._state==="closed"&&(_=!0);let P=bi(f);f.readerType==="default"?Ps(u,P,_):It(u,P,_)}function bi(u){let f=u.bytesFilled,_=u.elementSize;return new u.viewConstructor(u.buffer,u.byteOffset,f/_)}function Ls(u,f,_,P){u._queue.push({buffer:f,byteOffset:_,byteLength:P}),u._queueTotalSize+=P}function X1(u,f){let _=f.elementSize,P=f.bytesFilled-f.bytesFilled%_,N=Math.min(u._queueTotalSize,f.byteLength-f.bytesFilled),j=f.bytesFilled+N,q=j-j%_,te=N,ce=!1;q>P&&(te=q-f.bytesFilled,ce=!0);let we=u._queue;for(;te>0;){let Ie=we.peek(),Pe=Math.min(te,Ie.byteLength),et=f.byteOffset+f.bytesFilled;J1(f.buffer,et,Ie.buffer,Ie.byteOffset,Pe),Ie.byteLength===Pe?we.shift():(Ie.byteOffset+=Pe,Ie.byteLength-=Pe),u._queueTotalSize-=Pe,Ns(u,Pe,f),te-=Pe}return ce}function Ns(u,f,_){_.bytesFilled+=f}function Q1(u){u._queueTotalSize===0&&u._closeRequested?(Bs(u),Hn(u._controlledReadableByteStream)):yi(u)}function Sa(u){u._byobRequest!==null&&(u._byobRequest._associatedReadableByteStreamController=void 0,u._byobRequest._view=null,u._byobRequest=null)}function el(u){for(;u._pendingPullIntos.length>0;){if(u._queueTotalSize===0)return;let f=u._pendingPullIntos.peek();X1(u,f)&&(kn(u),xa(u._controlledReadableByteStream,f))}}function Kh(u,f,_){let P=u._controlledReadableByteStream,N=1;f.constructor!==DataView&&(N=f.constructor.BYTES_PER_ELEMENT);let j=f.constructor,q=f.buffer,te={buffer:q,bufferByteLength:q.byteLength,byteOffset:f.byteOffset,byteLength:f.byteLength,bytesFilled:0,elementSize:N,viewConstructor:j,readerType:"byob"};if(u._pendingPullIntos.length>0){u._pendingPullIntos.push(te),Ca(P,_);return}if(P._state==="closed"){let ce=new j(te.buffer,te.byteOffset,0);_._closeSteps(ce);return}if(u._queueTotalSize>0){if(X1(u,te)){let ce=bi(te);Q1(u),_._chunkSteps(ce);return}if(u._closeRequested){let ce=new TypeError("Insufficient bytes to fill elements in the given buffer");Ut(u,ce),_._errorSteps(ce);return}}u._pendingPullIntos.push(te),Ca(P,_),yi(u)}function cr(u,f){let _=u._controlledReadableByteStream;if(Us(_))for(;Aa(_)>0;){let P=kn(u);xa(_,P)}}function Jh(u,f,_){if(Ns(u,f,_),_.bytesFilled<_.elementSize)return;kn(u);let P=_.bytesFilled%_.elementSize;if(P>0){let N=_.byteOffset+_.bytesFilled,j=wa(_.buffer,N-P,N);Ls(u,j,0,j.byteLength)}_.bytesFilled-=P,xa(u._controlledReadableByteStream,_),el(u)}function Ma(u,f){let _=u._pendingPullIntos.peek();Sa(u),u._controlledReadableByteStream._state==="closed"?cr(u):Jh(u,f,_),yi(u)}function kn(u){return u._pendingPullIntos.shift()}function Zh(u){let f=u._controlledReadableByteStream;return f._state!=="readable"||u._closeRequested||!u._started?!1:!!($i(f)&&Tt(f)>0||Us(f)&&Aa(f)>0||Ra(u)>0)}function Bs(u){u._pullAlgorithm=void 0,u._cancelAlgorithm=void 0}function Wr(u){let f=u._controlledReadableByteStream;if(!(u._closeRequested||f._state!=="readable")){if(u._queueTotalSize>0){u._closeRequested=!0;return}if(u._pendingPullIntos.length>0&&u._pendingPullIntos.peek().bytesFilled>0){let P=new TypeError("Insufficient bytes to fill elements in the given buffer");throw Ut(u,P),P}Bs(u),Hn(f)}}function Ds(u,f){let _=u._controlledReadableByteStream;if(u._closeRequested||_._state!=="readable")return;let P=f.buffer,N=f.byteOffset,j=f.byteLength,q=P;if(u._pendingPullIntos.length>0){let te=u._pendingPullIntos.peek();pi(te.buffer),te.buffer=te.buffer}if(Sa(u),$i(_))if(Tt(_)===0)Ls(u,q,N,j);else{u._pendingPullIntos.length>0&&kn(u);let te=new Uint8Array(q,N,j);Ps(_,te,!1)}else Us(_)?(Ls(u,q,N,j),el(u)):Ls(u,q,N,j);yi(u)}function Ut(u,f){let _=u._controlledReadableByteStream;_._state==="readable"&&(Y1(u),Fr(u),Bs(u),Ml(_,f))}function Ea(u){if(u._byobRequest===null&&u._pendingPullIntos.length>0){let f=u._pendingPullIntos.peek(),_=new Uint8Array(f.buffer,f.byteOffset+f.bytesFilled,f.byteLength-f.bytesFilled),P=Object.create(On.prototype);Yh(P,u,_),u._byobRequest=P}return u._byobRequest}function Ra(u){let f=u._controlledReadableByteStream._state;return f==="errored"?null:f==="closed"?0:u._strategyHWM-u._queueTotalSize}function Ln(u,f){let _=u._pendingPullIntos.peek();if(u._controlledReadableByteStream._state==="closed"){if(f!==0)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(f===0)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(_.bytesFilled+f>_.byteLength)throw new RangeError("bytesWritten out of range")}_.buffer=_.buffer,Ma(u,f)}function Nn(u,f){let _=u._pendingPullIntos.peek();if(u._controlledReadableByteStream._state==="closed"){if(f.byteLength!==0)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(f.byteLength===0)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(_.byteOffset+_.bytesFilled!==f.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(_.bufferByteLength!==f.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(_.bytesFilled+f.byteLength>_.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");let N=f.byteLength;_.buffer=f.buffer,Ma(u,N)}function tl(u,f,_,P,N,j,q){f._controlledReadableByteStream=u,f._pullAgain=!1,f._pulling=!1,f._byobRequest=null,f._queue=f._queueTotalSize=void 0,Fr(f),f._closeRequested=!1,f._started=!1,f._strategyHWM=j,f._pullAlgorithm=P,f._cancelAlgorithm=N,f._autoAllocateChunkSize=q,f._pendingPullIntos=new se,u._readableStreamController=f;let te=_();E(R(te),()=>{f._started=!0,yi(f)},ce=>{Ut(f,ce)})}function rl(u,f,_){let P=Object.create(Ke.prototype),N=()=>{},j=()=>R(void 0),q=()=>R(void 0);f.start!==void 0&&(N=()=>f.start(P)),f.pull!==void 0&&(j=()=>f.pull(P)),f.cancel!==void 0&&(q=ce=>f.cancel(ce));let te=f.autoAllocateChunkSize;if(te===0)throw new TypeError("autoAllocateChunkSize must be greater than 0");tl(u,P,N,j,q,_,te)}function Yh(u,f,_){u._associatedReadableByteStreamController=f,u._view=_}function qi(u){return new TypeError(`ReadableStreamBYOBRequest.prototype.${u} can only be used on a ReadableStreamBYOBRequest`)}function Fi(u){return new TypeError(`ReadableByteStreamController.prototype.${u} can only be used on a ReadableByteStreamController`)}function zs(u){return new Wi(u)}function Ca(u,f){u._reader._readIntoRequests.push(f)}function It(u,f,_){let N=u._reader._readIntoRequests.shift();_?N._closeSteps(f):N._chunkSteps(f)}function Aa(u){return u._reader._readIntoRequests.length}function Us(u){let f=u._reader;return!(f===void 0||!jt(f))}class Wi{constructor(f){if(Tr(f,1,"ReadableStreamBYOBReader"),ya(f,"First parameter"),Jr(f))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!gi(f._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");Me(this,f),this._readIntoRequests=new se}get closed(){return jt(this)?this._closedPromise:x(pt("closed"))}cancel(f=void 0){return jt(this)?this._ownerReadableStream===void 0?x(Ne("cancel")):Ue(this,f):x(pt("cancel"))}read(f){if(!jt(this))return x(pt("read"));if(!ArrayBuffer.isView(f))return x(new TypeError("view must be an array buffer view"));if(f.byteLength===0)return x(new TypeError("view must have non-zero byteLength"));if(f.buffer.byteLength===0)return x(new TypeError("view's buffer must have non-zero byteLength"));if(pi(f.buffer),this._ownerReadableStream===void 0)return x(Ne("read from"));let _,P,N=M((q,te)=>{_=q,P=te});return mt(this,f,{_chunkSteps:q=>_({value:q,done:!1}),_closeSteps:q=>_({value:q,done:!0}),_errorSteps:q=>P(q)}),N}releaseLock(){if(!jt(this))throw pt("releaseLock");if(this._ownerReadableStream!==void 0){if(this._readIntoRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");Te(this)}}}Object.defineProperties(Wi.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Wi.prototype,e.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});function jt(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_readIntoRequests")?!1:u instanceof Wi}function mt(u,f,_){let P=u._ownerReadableStream;P._disturbed=!0,P._state==="errored"?_._errorSteps(P._storedError):Kh(P._readableStreamController,f,_)}function pt(u){return new TypeError(`ReadableStreamBYOBReader.prototype.${u} can only be used on a ReadableStreamBYOBReader`)}function Pr(u,f){let{highWaterMark:_}=u;if(_===void 0)return f;if(K1(_)||_<0)throw new RangeError("Invalid highWaterMark");return _}function Hr(u){let{size:f}=u;return f||(()=>1)}function js(u,f){at(u,f);let _=u?.highWaterMark,P=u?.size;return{highWaterMark:_===void 0?void 0:ga(_),size:P===void 0?void 0:il(P,`${f} has member 'size' that`)}}function il(u,f){return Xt(u,f),_=>ga(u(_))}function Xh(u,f){at(u,f);let _=u?.abort,P=u?.close,N=u?.start,j=u?.type,q=u?.write;return{abort:_===void 0?void 0:nl(_,u,`${f} has member 'abort' that`),close:P===void 0?void 0:Ta(P,u,`${f} has member 'close' that`),start:N===void 0?void 0:sl(N,u,`${f} has member 'start' that`),write:q===void 0?void 0:Qh(q,u,`${f} has member 'write' that`),type:j}}function nl(u,f,_){return Xt(u,_),P=>H(u,f,[P])}function Ta(u,f,_){return Xt(u,_),()=>H(u,f,[])}function sl(u,f,_){return Xt(u,_),P=>z(u,f,[P])}function Qh(u,f,_){return Xt(u,_),(P,N)=>H(u,f,[P,N])}function $s(u,f){if(!Gi(u))throw new TypeError(`${f} is not a WritableStream.`)}function ec(u){if(typeof u!="object"||u===null)return!1;try{return typeof u.aborted=="boolean"}catch{return!1}}let tc=typeof AbortController=="function";function rc(){if(tc)return new AbortController}class Hi{constructor(f={},_={}){f===void 0?f=null:ft(f,"First parameter");let P=js(_,"Second parameter"),N=Xh(f,"First parameter");if(ll(this),N.type!==void 0)throw new RangeError("Invalid type is specified");let q=Hr(P),te=Pr(P,1);fc(this,N,te,q)}get locked(){if(!Gi(this))throw Js("locked");return Vi(this)}abort(f=void 0){return Gi(this)?Vi(this)?x(new TypeError("Cannot abort a stream that already has a writer")):Or(this,f):x(Js("abort"))}close(){return Gi(this)?Vi(this)?x(new TypeError("Cannot close a stream that already has a writer")):fr(this)?x(new TypeError("Cannot close an already-closing stream")):ul(this):x(Js("close"))}getWriter(){if(!Gi(this))throw Js("getWriter");return ol(this)}}Object.defineProperties(Hi.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Hi.prototype,e.toStringTag,{value:"WritableStream",configurable:!0});function ol(u){return new Ki(u)}function al(u,f,_,P,N=1,j=()=>1){let q=Object.create(Hi.prototype);ll(q);let te=Object.create(Ji.prototype);return ka(q,te,u,f,_,P,N,j),q}function ll(u){u._state="writable",u._storedError=void 0,u._writer=void 0,u._writableStreamController=void 0,u._writeRequests=new se,u._inFlightWriteRequest=void 0,u._closeRequest=void 0,u._inFlightCloseRequest=void 0,u._pendingAbortRequest=void 0,u._backpressure=!1}function Gi(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_writableStreamController")?!1:u instanceof Hi}function Vi(u){return u._writer!==void 0}function Or(u,f){var _;if(u._state==="closed"||u._state==="errored")return R(void 0);u._writableStreamController._abortReason=f,(_=u._writableStreamController._abortController)===null||_===void 0||_.abort();let P=u._state;if(P==="closed"||P==="errored")return R(void 0);if(u._pendingAbortRequest!==void 0)return u._pendingAbortRequest._promise;let N=!1;P==="erroring"&&(N=!0,f=void 0);let j=M((q,te)=>{u._pendingAbortRequest={_promise:void 0,_resolve:q,_reject:te,_reason:f,_wasAlreadyErroring:N}});return u._pendingAbortRequest._promise=j,N||Fs(u,f),j}function ul(u){let f=u._state;if(f==="closed"||f==="errored")return x(new TypeError(`The stream (in ${f} state) is not in the writable state and cannot be closed`));let _=M((N,j)=>{let q={_resolve:N,_reject:j};u._closeRequest=q}),P=u._writer;return P!==void 0&&u._backpressure&&f==="writable"&&za(P),dc(u._writableStreamController),_}function ic(u){return M((_,P)=>{let N={_resolve:_,_reject:P};u._writeRequests.push(N)})}function qs(u,f){if(u._state==="writable"){Fs(u,f);return}Ws(u)}function Fs(u,f){let _=u._writableStreamController;u._state="erroring",u._storedError=f;let P=u._writer;P!==void 0&&Pa(P,f),!lc(u)&&_._started&&Ws(u)}function Ws(u){u._state="errored",u._writableStreamController[hr]();let f=u._storedError;if(u._writeRequests.forEach(N=>{N._reject(f)}),u._writeRequests=new se,u._pendingAbortRequest===void 0){vi(u);return}let _=u._pendingAbortRequest;if(u._pendingAbortRequest=void 0,_._wasAlreadyErroring){_._reject(f),vi(u);return}let P=u._writableStreamController[da](_._reason);E(P,()=>{_._resolve(),vi(u)},N=>{_._reject(N),vi(u)})}function nc(u){u._inFlightWriteRequest._resolve(void 0),u._inFlightWriteRequest=void 0}function sc(u,f){u._inFlightWriteRequest._reject(f),u._inFlightWriteRequest=void 0,qs(u,f)}function oc(u){u._inFlightCloseRequest._resolve(void 0),u._inFlightCloseRequest=void 0,u._state==="erroring"&&(u._storedError=void 0,u._pendingAbortRequest!==void 0&&(u._pendingAbortRequest._resolve(),u._pendingAbortRequest=void 0)),u._state="closed";let _=u._writer;_!==void 0&&gl(_)}function ac(u,f){u._inFlightCloseRequest._reject(f),u._inFlightCloseRequest=void 0,u._pendingAbortRequest!==void 0&&(u._pendingAbortRequest._reject(f),u._pendingAbortRequest=void 0),qs(u,f)}function fr(u){return!(u._closeRequest===void 0&&u._inFlightCloseRequest===void 0)}function lc(u){return!(u._inFlightWriteRequest===void 0&&u._inFlightCloseRequest===void 0)}function uc(u){u._inFlightCloseRequest=u._closeRequest,u._closeRequest=void 0}function hl(u){u._inFlightWriteRequest=u._writeRequests.shift()}function vi(u){u._closeRequest!==void 0&&(u._closeRequest._reject(u._storedError),u._closeRequest=void 0);let f=u._writer;f!==void 0&&Ba(f,u._storedError)}function Ia(u,f){let _=u._writer;_!==void 0&&f!==u._backpressure&&(f?wc(_):za(_)),u._backpressure=f}class Ki{constructor(f){if(Tr(f,1,"WritableStreamDefaultWriter"),$s(f,"First parameter"),Vi(f))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=f,f._writer=this;let _=f._state;if(_==="writable")!fr(f)&&f._backpressure?Zs(this):yl(this),Zi(this);else if(_==="erroring")Da(this,f._storedError),Zi(this);else if(_==="closed")yl(this),bc(this);else{let P=f._storedError;Da(this,P),pl(this,P)}}get closed(){return wi(this)?this._closedPromise:x(_i("closed"))}get desiredSize(){if(!wi(this))throw _i("desiredSize");if(this._ownerWritableStream===void 0)throw zn("desiredSize");return Qt(this)}get ready(){return wi(this)?this._readyPromise:x(_i("ready"))}abort(f=void 0){return wi(this)?this._ownerWritableStream===void 0?x(zn("abort")):hc(this,f):x(_i("abort"))}close(){if(!wi(this))return x(_i("close"));let f=this._ownerWritableStream;return f===void 0?x(zn("close")):fr(f)?x(new TypeError("Cannot close an already-closing stream")):cl(this)}releaseLock(){if(!wi(this))throw _i("releaseLock");this._ownerWritableStream!==void 0&&fl(this)}write(f=void 0){return wi(this)?this._ownerWritableStream===void 0?x(zn("write to")):dl(this,f):x(_i("write"))}}Object.defineProperties(Ki.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Ki.prototype,e.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});function wi(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_ownerWritableStream")?!1:u instanceof Ki}function hc(u,f){let _=u._ownerWritableStream;return Or(_,f)}function cl(u){let f=u._ownerWritableStream;return ul(f)}function cc(u){let f=u._ownerWritableStream,_=f._state;return fr(f)||_==="closed"?R(void 0):_==="errored"?x(f._storedError):cl(u)}function Hs(u,f){u._closedPromiseState==="pending"?Ba(u,f):vc(u,f)}function Pa(u,f){u._readyPromiseState==="pending"?bl(u,f):_c(u,f)}function Qt(u){let f=u._ownerWritableStream,_=f._state;return _==="errored"||_==="erroring"?null:_==="closed"?0:Bn(f._writableStreamController)}function fl(u){let f=u._ownerWritableStream,_=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");Pa(u,_),Hs(u,_),f._writer=void 0,u._ownerWritableStream=void 0}function dl(u,f){let _=u._ownerWritableStream,P=_._writableStreamController,N=mc(P,f);if(_!==u._ownerWritableStream)return x(zn("write to"));let j=_._state;if(j==="errored")return x(_._storedError);if(fr(_)||j==="closed")return x(new TypeError("The stream is closing or closed and cannot be written to"));if(j==="erroring")return x(_._storedError);let q=ic(_);return pc(P,f,N),q}let Gs={};class Ji{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!Oa(this))throw Na("abortReason");return this._abortReason}get signal(){if(!Oa(this))throw Na("signal");if(this._abortController===void 0)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(f=void 0){if(!Oa(this))throw Na("error");this._controlledWritableStream._state==="writable"&&ml(this,f)}[da](f){let _=this._abortAlgorithm(f);return Vs(this),_}[hr](){Fr(this)}}Object.defineProperties(Ji.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Ji.prototype,e.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});function Oa(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_controlledWritableStream")?!1:u instanceof Ji}function ka(u,f,_,P,N,j,q,te){f._controlledWritableStream=u,u._writableStreamController=f,f._queue=void 0,f._queueTotalSize=void 0,Fr(f),f._abortReason=void 0,f._abortController=rc(),f._started=!1,f._strategySizeAlgorithm=te,f._strategyHWM=q,f._writeAlgorithm=P,f._closeAlgorithm=N,f._abortAlgorithm=j;let ce=Dn(f);Ia(u,ce);let we=_(),Ie=R(we);E(Ie,()=>{f._started=!0,Ks(f)},Pe=>{f._started=!0,qs(u,Pe)})}function fc(u,f,_,P){let N=Object.create(Ji.prototype),j=()=>{},q=()=>R(void 0),te=()=>R(void 0),ce=()=>R(void 0);f.start!==void 0&&(j=()=>f.start(N)),f.write!==void 0&&(q=we=>f.write(we,N)),f.close!==void 0&&(te=()=>f.close()),f.abort!==void 0&&(ce=we=>f.abort(we)),ka(u,N,j,q,te,ce,_,P)}function Vs(u){u._writeAlgorithm=void 0,u._closeAlgorithm=void 0,u._abortAlgorithm=void 0,u._strategySizeAlgorithm=void 0}function dc(u){ue(u,Gs,0),Ks(u)}function mc(u,f){try{return u._strategySizeAlgorithm(f)}catch(_){return La(u,_),1}}function Bn(u){return u._strategyHWM-u._queueTotalSize}function pc(u,f,_){try{ue(u,f,_)}catch(N){La(u,N);return}let P=u._controlledWritableStream;if(!fr(P)&&P._state==="writable"){let N=Dn(u);Ia(P,N)}Ks(u)}function Ks(u){let f=u._controlledWritableStream;if(!u._started||f._inFlightWriteRequest!==void 0)return;if(f._state==="erroring"){Ws(f);return}if(u._queue.length===0)return;let P=Vh(u);P===Gs?gc(u):yc(u,P)}function La(u,f){u._controlledWritableStream._state==="writable"&&ml(u,f)}function gc(u){let f=u._controlledWritableStream;uc(f),_a(u);let _=u._closeAlgorithm();Vs(u),E(_,()=>{oc(f)},P=>{ac(f,P)})}function yc(u,f){let _=u._controlledWritableStream;hl(_);let P=u._writeAlgorithm(f);E(P,()=>{nc(_);let N=_._state;if(_a(u),!fr(_)&&N==="writable"){let j=Dn(u);Ia(_,j)}Ks(u)},N=>{_._state==="writable"&&Vs(u),sc(_,N)})}function Dn(u){return Bn(u)<=0}function ml(u,f){let _=u._controlledWritableStream;Vs(u),Fs(_,f)}function Js(u){return new TypeError(`WritableStream.prototype.${u} can only be used on a WritableStream`)}function Na(u){return new TypeError(`WritableStreamDefaultController.prototype.${u} can only be used on a WritableStreamDefaultController`)}function _i(u){return new TypeError(`WritableStreamDefaultWriter.prototype.${u} can only be used on a WritableStreamDefaultWriter`)}function zn(u){return new TypeError("Cannot "+u+" a stream using a released writer")}function Zi(u){u._closedPromise=M((f,_)=>{u._closedPromise_resolve=f,u._closedPromise_reject=_,u._closedPromiseState="pending"})}function pl(u,f){Zi(u),Ba(u,f)}function bc(u){Zi(u),gl(u)}function Ba(u,f){u._closedPromise_reject!==void 0&&(k(u._closedPromise),u._closedPromise_reject(f),u._closedPromise_resolve=void 0,u._closedPromise_reject=void 0,u._closedPromiseState="rejected")}function vc(u,f){pl(u,f)}function gl(u){u._closedPromise_resolve!==void 0&&(u._closedPromise_resolve(void 0),u._closedPromise_resolve=void 0,u._closedPromise_reject=void 0,u._closedPromiseState="resolved")}function Zs(u){u._readyPromise=M((f,_)=>{u._readyPromise_resolve=f,u._readyPromise_reject=_}),u._readyPromiseState="pending"}function Da(u,f){Zs(u),bl(u,f)}function yl(u){Zs(u),za(u)}function bl(u,f){u._readyPromise_reject!==void 0&&(k(u._readyPromise),u._readyPromise_reject(f),u._readyPromise_resolve=void 0,u._readyPromise_reject=void 0,u._readyPromiseState="rejected")}function wc(u){Zs(u)}function _c(u,f){Da(u,f)}function za(u){u._readyPromise_resolve!==void 0&&(u._readyPromise_resolve(void 0),u._readyPromise_resolve=void 0,u._readyPromise_reject=void 0,u._readyPromiseState="fulfilled")}let vl=typeof DOMException<"u"?DOMException:void 0;function xc(u){if(!(typeof u=="function"||typeof u=="object"))return!1;try{return new u,!0}catch{return!1}}function Sc(){let u=function(_,P){this.message=_||"",this.name=P||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};return u.prototype=Object.create(Error.prototype),Object.defineProperty(u.prototype,"constructor",{value:u,writable:!0,configurable:!0}),u}let Mc=xc(vl)?vl:Sc();function xi(u,f,_,P,N,j){let q=ji(u),te=ol(f);u._disturbed=!0;let ce=!1,we=R(void 0);return M((Ie,Pe)=>{let et;if(j!==void 0){if(et=()=>{let ne=new Mc("Aborted","AbortError"),pe=[];P||pe.push(()=>f._state==="writable"?Or(f,ne):R(void 0)),N||pe.push(()=>u._state==="readable"?er(u,ne):R(void 0)),_t(()=>Promise.all(pe.map(je=>je())),!0,ne)},j.aborted){et();return}j.addEventListener("abort",et)}function tr(){return M((ne,pe)=>{function je(Pt){Pt?ne():w(tn(),je,pe)}je(!1)})}function tn(){return ce?R(!0):w(te._readyPromise,()=>M((ne,pe)=>{Ir(q,{_chunkSteps:je=>{we=w(dl(te,je),void 0,r),ne(!1)},_closeSteps:()=>ne(!0),_errorSteps:pe})}))}if(kr(u,q._closedPromise,ne=>{P?$t(!0,ne):_t(()=>Or(f,ne),!0,ne)}),kr(f,te._closedPromise,ne=>{N?$t(!0,ne):_t(()=>er(u,ne),!0,ne)}),yt(u,q._closedPromise,()=>{_?$t():_t(()=>cc(te))}),fr(f)||f._state==="closed"){let ne=new TypeError("the destination writable stream closed before all data could be piped to it");N?$t(!0,ne):_t(()=>er(u,ne),!0,ne)}k(tr());function Yr(){let ne=we;return w(we,()=>ne!==we?Yr():void 0)}function kr(ne,pe,je){ne._state==="errored"?je(ne._storedError):C(pe,je)}function yt(ne,pe,je){ne._state==="closed"?je():T(pe,je)}function _t(ne,pe,je){if(ce)return;ce=!0,f._state==="writable"&&!fr(f)?T(Yr(),Pt):Pt();function Pt(){E(ne(),()=>Lr(pe,je),rn=>Lr(!0,rn))}}function $t(ne,pe){ce||(ce=!0,f._state==="writable"&&!fr(f)?T(Yr(),()=>Lr(ne,pe)):Lr(ne,pe))}function Lr(ne,pe){fl(te),Te(q),j!==void 0&&j.removeEventListener("abort",et),ne?Pe(pe):Ie(void 0)}})}class Yi{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Ys(this))throw eo("desiredSize");return Ua(this)}close(){if(!Ys(this))throw eo("close");if(!Xi(this))throw new TypeError("The stream is not in a state that permits close");jn(this)}enqueue(f=void 0){if(!Ys(this))throw eo("enqueue");if(!Xi(this))throw new TypeError("The stream is not in a state that permits enqueue");return Qs(this,f)}error(f=void 0){if(!Ys(this))throw eo("error");Gr(this,f)}[ma](f){Fr(this);let _=this._cancelAlgorithm(f);return Xs(this),_}[Is](f){let _=this._controlledReadableStream;if(this._queue.length>0){let P=_a(this);this._closeRequested&&this._queue.length===0?(Xs(this),Hn(_)):Un(this),f._chunkSteps(P)}else F1(_,f),Un(this)}}Object.defineProperties(Yi.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Yi.prototype,e.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});function Ys(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_controlledReadableStream")?!1:u instanceof Yi}function Un(u){if(!wl(u))return;if(u._pulling){u._pullAgain=!0;return}u._pulling=!0;let _=u._pullAlgorithm();E(_,()=>{u._pulling=!1,u._pullAgain&&(u._pullAgain=!1,Un(u))},P=>{Gr(u,P)})}function wl(u){let f=u._controlledReadableStream;return!Xi(u)||!u._started?!1:!!(Jr(f)&&Tt(f)>0||Ua(u)>0)}function Xs(u){u._pullAlgorithm=void 0,u._cancelAlgorithm=void 0,u._strategySizeAlgorithm=void 0}function jn(u){if(!Xi(u))return;let f=u._controlledReadableStream;u._closeRequested=!0,u._queue.length===0&&(Xs(u),Hn(f))}function Qs(u,f){if(!Xi(u))return;let _=u._controlledReadableStream;if(Jr(_)&&Tt(_)>0)Ps(_,f,!1);else{let P;try{P=u._strategySizeAlgorithm(f)}catch(N){throw Gr(u,N),N}try{ue(u,f,P)}catch(N){throw Gr(u,N),N}}Un(u)}function Gr(u,f){let _=u._controlledReadableStream;_._state==="readable"&&(Fr(u),Xs(u),Ml(_,f))}function Ua(u){let f=u._controlledReadableStream._state;return f==="errored"?null:f==="closed"?0:u._strategyHWM-u._queueTotalSize}function Ec(u){return!wl(u)}function Xi(u){let f=u._controlledReadableStream._state;return!u._closeRequested&&f==="readable"}function _l(u,f,_,P,N,j,q){f._controlledReadableStream=u,f._queue=void 0,f._queueTotalSize=void 0,Fr(f),f._started=!1,f._closeRequested=!1,f._pullAgain=!1,f._pulling=!1,f._strategySizeAlgorithm=q,f._strategyHWM=j,f._pullAlgorithm=P,f._cancelAlgorithm=N,u._readableStreamController=f;let te=_();E(R(te),()=>{f._started=!0,Un(f)},ce=>{Gr(f,ce)})}function Rc(u,f,_,P){let N=Object.create(Yi.prototype),j=()=>{},q=()=>R(void 0),te=()=>R(void 0);f.start!==void 0&&(j=()=>f.start(N)),f.pull!==void 0&&(q=()=>f.pull(N)),f.cancel!==void 0&&(te=ce=>f.cancel(ce)),_l(u,N,j,q,te,_,P)}function eo(u){return new TypeError(`ReadableStreamDefaultController.prototype.${u} can only be used on a ReadableStreamDefaultController`)}function Cc(u,f){return gi(u._readableStreamController)?gt(u):Ac(u)}function Ac(u,f){let _=ji(u),P=!1,N=!1,j=!1,q=!1,te,ce,we,Ie,Pe,et=M(yt=>{Pe=yt});function tr(){return P?(N=!0,R(void 0)):(P=!0,Ir(_,{_chunkSteps:_t=>{B(()=>{N=!1;let $t=_t,Lr=_t;j||Qs(we._readableStreamController,$t),q||Qs(Ie._readableStreamController,Lr),P=!1,N&&tr()})},_closeSteps:()=>{P=!1,j||jn(we._readableStreamController),q||jn(Ie._readableStreamController),(!j||!q)&&Pe(void 0)},_errorSteps:()=>{P=!1}}),R(void 0))}function tn(yt){if(j=!0,te=yt,q){let _t=Pn([te,ce]),$t=er(u,_t);Pe($t)}return et}function Yr(yt){if(q=!0,ce=yt,j){let _t=Pn([te,ce]),$t=er(u,_t);Pe($t)}return et}function kr(){}return we=dr(kr,tr,tn),Ie=dr(kr,tr,Yr),C(_._closedPromise,yt=>{Gr(we._readableStreamController,yt),Gr(Ie._readableStreamController,yt),(!j||!q)&&Pe(void 0)}),[we,Ie]}function gt(u){let f=ji(u),_=!1,P=!1,N=!1,j=!1,q=!1,te,ce,we,Ie,Pe,et=M(ne=>{Pe=ne});function tr(ne){C(ne._closedPromise,pe=>{ne===f&&(Ut(we._readableStreamController,pe),Ut(Ie._readableStreamController,pe),(!j||!q)&&Pe(void 0))})}function tn(){jt(f)&&(Te(f),f=ji(u),tr(f)),Ir(f,{_chunkSteps:pe=>{B(()=>{P=!1,N=!1;let je=pe,Pt=pe;if(!j&&!q)try{Pt=Z1(pe)}catch(rn){Ut(we._readableStreamController,rn),Ut(Ie._readableStreamController,rn),Pe(er(u,rn));return}j||Ds(we._readableStreamController,je),q||Ds(Ie._readableStreamController,Pt),_=!1,P?kr():N&&yt()})},_closeSteps:()=>{_=!1,j||Wr(we._readableStreamController),q||Wr(Ie._readableStreamController),we._readableStreamController._pendingPullIntos.length>0&&Ln(we._readableStreamController,0),Ie._readableStreamController._pendingPullIntos.length>0&&Ln(Ie._readableStreamController,0),(!j||!q)&&Pe(void 0)},_errorSteps:()=>{_=!1}})}function Yr(ne,pe){ot(f)&&(Te(f),f=zs(u),tr(f));let je=pe?Ie:we,Pt=pe?we:Ie;mt(f,ne,{_chunkSteps:nn=>{B(()=>{P=!1,N=!1;let sn=pe?q:j;if(pe?j:q)sn||Nn(je._readableStreamController,nn);else{let Dl;try{Dl=Z1(nn)}catch($a){Ut(je._readableStreamController,$a),Ut(Pt._readableStreamController,$a),Pe(er(u,$a));return}sn||Nn(je._readableStreamController,nn),Ds(Pt._readableStreamController,Dl)}_=!1,P?kr():N&&yt()})},_closeSteps:nn=>{_=!1;let sn=pe?q:j,uo=pe?j:q;sn||Wr(je._readableStreamController),uo||Wr(Pt._readableStreamController),nn!==void 0&&(sn||Nn(je._readableStreamController,nn),!uo&&Pt._readableStreamController._pendingPullIntos.length>0&&Ln(Pt._readableStreamController,0)),(!sn||!uo)&&Pe(void 0)},_errorSteps:()=>{_=!1}})}function kr(){if(_)return P=!0,R(void 0);_=!0;let ne=Ea(we._readableStreamController);return ne===null?tn():Yr(ne._view,!1),R(void 0)}function yt(){if(_)return N=!0,R(void 0);_=!0;let ne=Ea(Ie._readableStreamController);return ne===null?tn():Yr(ne._view,!0),R(void 0)}function _t(ne){if(j=!0,te=ne,q){let pe=Pn([te,ce]),je=er(u,pe);Pe(je)}return et}function $t(ne){if(q=!0,ce=ne,j){let pe=Pn([te,ce]),je=er(u,pe);Pe(je)}return et}function Lr(){}return we=Sl(Lr,kr,_t),Ie=Sl(Lr,yt,$t),tr(f),[we,Ie]}function $n(u,f){at(u,f);let _=u,P=_?.autoAllocateChunkSize,N=_?.cancel,j=_?.pull,q=_?.start,te=_?.type;return{autoAllocateChunkSize:P===void 0?void 0:q1(P,`${f} has member 'autoAllocateChunkSize' that`),cancel:N===void 0?void 0:qn(N,_,`${f} has member 'cancel' that`),pull:j===void 0?void 0:Fn(j,_,`${f} has member 'pull' that`),start:q===void 0?void 0:Wn(q,_,`${f} has member 'start' that`),type:te===void 0?void 0:Qi(te,`${f} has member 'type' that`)}}function qn(u,f,_){return Xt(u,_),P=>H(u,f,[P])}function Fn(u,f,_){return Xt(u,_),P=>H(u,f,[P])}function Wn(u,f,_){return Xt(u,_),P=>z(u,f,[P])}function Qi(u,f){if(u=`${u}`,u!=="bytes")throw new TypeError(`${f} '${u}' is not a valid enumeration value for ReadableStreamType`);return u}function en(u,f){at(u,f);let _=u?.mode;return{mode:_===void 0?void 0:to(_,`${f} has member 'mode' that`)}}function to(u,f){if(u=`${u}`,u!=="byob")throw new TypeError(`${f} '${u}' is not a valid enumeration value for ReadableStreamReaderMode`);return u}function Tc(u,f){at(u,f);let _=u?.preventCancel;return{preventCancel:Boolean(_)}}function xl(u,f){at(u,f);let _=u?.preventAbort,P=u?.preventCancel,N=u?.preventClose,j=u?.signal;return j!==void 0&&Ic(j,`${f} has member 'signal' that`),{preventAbort:Boolean(_),preventCancel:Boolean(P),preventClose:Boolean(N),signal:j}}function Ic(u,f){if(!ec(u))throw new TypeError(`${f} is not an AbortSignal.`)}function Pc(u,f){at(u,f);let _=u?.readable;pa(_,"readable","ReadableWritablePair"),ya(_,`${f} has member 'readable' that`);let P=u?.writable;return pa(P,"writable","ReadableWritablePair"),$s(P,`${f} has member 'writable' that`),{readable:_,writable:P}}class Vr{constructor(f={},_={}){f===void 0?f=null:ft(f,"First parameter");let P=js(_,"Second parameter"),N=$n(f,"First parameter");if(ja(this),N.type==="bytes"){if(P.size!==void 0)throw new RangeError("The strategy for a byte stream cannot have a size function");let j=Pr(P,0);rl(this,N,j)}else{let j=Hr(P),q=Pr(P,1);Rc(this,N,q,j)}}get locked(){if(!Kr(this))throw Si("locked");return Jr(this)}cancel(f=void 0){return Kr(this)?Jr(this)?x(new TypeError("Cannot cancel a stream that already has a reader")):er(this,f):x(Si("cancel"))}getReader(f=void 0){if(!Kr(this))throw Si("getReader");return en(f,"First parameter").mode===void 0?ji(this):zs(this)}pipeThrough(f,_={}){if(!Kr(this))throw Si("pipeThrough");Tr(f,1,"pipeThrough");let P=Pc(f,"First parameter"),N=xl(_,"Second parameter");if(Jr(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(Vi(P.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");let j=xi(this,P.writable,N.preventClose,N.preventAbort,N.preventCancel,N.signal);return k(j),P.readable}pipeTo(f,_={}){if(!Kr(this))return x(Si("pipeTo"));if(f===void 0)return x("Parameter 1 is required in 'pipeTo'.");if(!Gi(f))return x(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let P;try{P=xl(_,"Second parameter")}catch(N){return x(N)}return Jr(this)?x(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):Vi(f)?x(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):xi(this,f,P.preventClose,P.preventAbort,P.preventCancel,P.signal)}tee(){if(!Kr(this))throw Si("tee");let f=Cc(this);return Pn(f)}values(f=void 0){if(!Kr(this))throw Si("values");let _=Tc(f,"First parameter");return Hh(this,_.preventCancel)}}Object.defineProperties(Vr.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Vr.prototype,e.toStringTag,{value:"ReadableStream",configurable:!0}),typeof e.asyncIterator=="symbol"&&Object.defineProperty(Vr.prototype,e.asyncIterator,{value:Vr.prototype.values,writable:!0,configurable:!0});function dr(u,f,_,P=1,N=()=>1){let j=Object.create(Vr.prototype);ja(j);let q=Object.create(Yi.prototype);return _l(j,q,u,f,_,P,N),j}function Sl(u,f,_){let P=Object.create(Vr.prototype);ja(P);let N=Object.create(Ke.prototype);return tl(P,N,u,f,_,0,void 0),P}function ja(u){u._state="readable",u._reader=void 0,u._storedError=void 0,u._disturbed=!1}function Kr(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_readableStreamController")?!1:u instanceof Vr}function Jr(u){return u._reader!==void 0}function er(u,f){if(u._disturbed=!0,u._state==="closed")return R(void 0);if(u._state==="errored")return x(u._storedError);Hn(u);let _=u._reader;_!==void 0&&jt(_)&&(_._readIntoRequests.forEach(N=>{N._closeSteps(void 0)}),_._readIntoRequests=new se);let P=u._readableStreamController[ma](f);return I(P,r)}function Hn(u){u._state="closed";let f=u._reader;f!==void 0&&(In(f),ot(f)&&(f._readRequests.forEach(_=>{_._closeSteps()}),f._readRequests=new se))}function Ml(u,f){u._state="errored",u._storedError=f;let _=u._reader;_!==void 0&&(fa(_,f),ot(_)?(_._readRequests.forEach(P=>{P._errorSteps(f)}),_._readRequests=new se):(_._readIntoRequests.forEach(P=>{P._errorSteps(f)}),_._readIntoRequests=new se))}function Si(u){return new TypeError(`ReadableStream.prototype.${u} can only be used on a ReadableStream`)}function El(u,f){at(u,f);let _=u?.highWaterMark;return pa(_,"highWaterMark","QueuingStrategyInit"),{highWaterMark:ga(_)}}let Rl=u=>u.byteLength;Object.defineProperty(Rl,"name",{value:"size",configurable:!0});class ro{constructor(f){Tr(f,1,"ByteLengthQueuingStrategy"),f=El(f,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=f.highWaterMark}get highWaterMark(){if(!Al(this))throw Cl("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!Al(this))throw Cl("size");return Rl}}Object.defineProperties(ro.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(ro.prototype,e.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});function Cl(u){return new TypeError(`ByteLengthQueuingStrategy.prototype.${u} can only be used on a ByteLengthQueuingStrategy`)}function Al(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_byteLengthQueuingStrategyHighWaterMark")?!1:u instanceof ro}let Tl=()=>1;Object.defineProperty(Tl,"name",{value:"size",configurable:!0});class io{constructor(f){Tr(f,1,"CountQueuingStrategy"),f=El(f,"First parameter"),this._countQueuingStrategyHighWaterMark=f.highWaterMark}get highWaterMark(){if(!Pl(this))throw Il("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!Pl(this))throw Il("size");return Tl}}Object.defineProperties(io.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(io.prototype,e.toStringTag,{value:"CountQueuingStrategy",configurable:!0});function Il(u){return new TypeError(`CountQueuingStrategy.prototype.${u} can only be used on a CountQueuingStrategy`)}function Pl(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_countQueuingStrategyHighWaterMark")?!1:u instanceof io}function Zr(u,f){at(u,f);let _=u?.flush,P=u?.readableType,N=u?.start,j=u?.transform,q=u?.writableType;return{flush:_===void 0?void 0:Oc(_,u,`${f} has member 'flush' that`),readableType:P,start:N===void 0?void 0:kc(N,u,`${f} has member 'start' that`),transform:j===void 0?void 0:Lc(j,u,`${f} has member 'transform' that`),writableType:q}}function Oc(u,f,_){return Xt(u,_),P=>H(u,f,[P])}function kc(u,f,_){return Xt(u,_),P=>z(u,f,[P])}function Lc(u,f,_){return Xt(u,_),(P,N)=>H(u,f,[P,N])}class no{constructor(f={},_={},P={}){f===void 0&&(f=null);let N=js(_,"Second parameter"),j=js(P,"Third parameter"),q=Zr(f,"First parameter");if(q.readableType!==void 0)throw new RangeError("Invalid readableType specified");if(q.writableType!==void 0)throw new RangeError("Invalid writableType specified");let te=Pr(j,0),ce=Hr(j),we=Pr(N,1),Ie=Hr(N),Pe,et=M(tr=>{Pe=tr});Nc(this,et,we,Ie,te,ce),Dc(this,q),q.start!==void 0?Pe(q.start(this._transformStreamController)):Pe(void 0)}get readable(){if(!Ol(this))throw Bl("readable");return this._readable}get writable(){if(!Ol(this))throw Bl("writable");return this._writable}}Object.defineProperties(no.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(no.prototype,e.toStringTag,{value:"TransformStream",configurable:!0});function Nc(u,f,_,P,N,j){function q(){return f}function te(et){return jc(u,et)}function ce(et){return $c(u,et)}function we(){return qc(u)}u._writable=al(q,te,we,ce,_,P);function Ie(){return Fc(u)}function Pe(et){return oo(u,et),R(void 0)}u._readable=dr(q,Ie,Pe,N,j),u._backpressure=void 0,u._backpressureChangePromise=void 0,u._backpressureChangePromise_resolve=void 0,ao(u,!0),u._transformStreamController=void 0}function Ol(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_transformStreamController")?!1:u instanceof no}function so(u,f){Gr(u._readable._readableStreamController,f),oo(u,f)}function oo(u,f){kl(u._transformStreamController),La(u._writable._writableStreamController,f),u._backpressure&&ao(u,!1)}function ao(u,f){u._backpressureChangePromise!==void 0&&u._backpressureChangePromise_resolve(),u._backpressureChangePromise=M(_=>{u._backpressureChangePromise_resolve=_}),u._backpressure=f}class Gn{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!lo(this))throw Vn("desiredSize");let f=this._controlledTransformStream._readable._readableStreamController;return Ua(f)}enqueue(f=void 0){if(!lo(this))throw Vn("enqueue");Ll(this,f)}error(f=void 0){if(!lo(this))throw Vn("error");zc(this,f)}terminate(){if(!lo(this))throw Vn("terminate");Uc(this)}}Object.defineProperties(Gn.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Gn.prototype,e.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});function lo(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_controlledTransformStream")?!1:u instanceof Gn}function Bc(u,f,_,P){f._controlledTransformStream=u,u._transformStreamController=f,f._transformAlgorithm=_,f._flushAlgorithm=P}function Dc(u,f){let _=Object.create(Gn.prototype),P=j=>{try{return Ll(_,j),R(void 0)}catch(q){return x(q)}},N=()=>R(void 0);f.transform!==void 0&&(P=j=>f.transform(j,_)),f.flush!==void 0&&(N=()=>f.flush(_)),Bc(u,_,P,N)}function kl(u){u._transformAlgorithm=void 0,u._flushAlgorithm=void 0}function Ll(u,f){let _=u._controlledTransformStream,P=_._readable._readableStreamController;if(!Xi(P))throw new TypeError("Readable side is not in a state that permits enqueue");try{Qs(P,f)}catch(j){throw oo(_,j),_._readable._storedError}Ec(P)!==_._backpressure&&ao(_,!0)}function zc(u,f){so(u._controlledTransformStream,f)}function Nl(u,f){let _=u._transformAlgorithm(f);return I(_,void 0,P=>{throw so(u._controlledTransformStream,P),P})}function Uc(u){let f=u._controlledTransformStream,_=f._readable._readableStreamController;jn(_);let P=new TypeError("TransformStream terminated");oo(f,P)}function jc(u,f){let _=u._transformStreamController;if(u._backpressure){let P=u._backpressureChangePromise;return I(P,()=>{let N=u._writable;if(N._state==="erroring")throw N._storedError;return Nl(_,f)})}return Nl(_,f)}function $c(u,f){return so(u,f),R(void 0)}function qc(u){let f=u._readable,_=u._transformStreamController,P=_._flushAlgorithm();return kl(_),I(P,()=>{if(f._state==="errored")throw f._storedError;jn(f._readableStreamController)},N=>{throw so(u,N),f._storedError})}function Fc(u){return ao(u,!1),u._backpressureChangePromise}function Vn(u){return new TypeError(`TransformStreamDefaultController.prototype.${u} can only be used on a TransformStreamDefaultController`)}function Bl(u){return new TypeError(`TransformStream.prototype.${u} can only be used on a TransformStream`)}t.ByteLengthQueuingStrategy=ro,t.CountQueuingStrategy=io,t.ReadableByteStreamController=Ke,t.ReadableStream=Vr,t.ReadableStreamBYOBReader=Wi,t.ReadableStreamBYOBRequest=On,t.ReadableStreamDefaultController=Yi,t.ReadableStreamDefaultReader=Z,t.TransformStream=no,t.TransformStreamDefaultController=Gn,t.WritableStream=Hi,t.WritableStreamDefaultController=Ji,t.WritableStreamDefaultWriter=Ki,Object.defineProperty(t,"__esModule",{value:!0})})});var b2=V(()=>{if(!globalThis.ReadableStream)try{let t=require("process"),{emitWarning:e}=t;try{t.emitWarning=()=>{},Object.assign(globalThis,require("stream/web")),t.emitWarning=e}catch(r){throw t.emitWarning=e,r}}catch{Object.assign(globalThis,y2())}try{let{Blob:t}=require("buffer");t&&!t.prototype.stream&&(t.prototype.stream=function(r){let i=0,n=this;return new ReadableStream({type:"bytes",async pull(o){let h=await n.slice(i,Math.min(n.size,i+65536)).arrayBuffer();i+=h.byteLength,o.enqueue(new Uint8Array(h)),i===n.size&&o.close()}})})}catch{}});async function*Yc(t,e=!0){for(let r of t)if("stream"in r)yield*r.stream();else if(ArrayBuffer.isView(r))if(e){let i=r.byteOffset,n=r.byteOffset+r.byteLength;for(;i!==n;){let o=Math.min(n-i,v2),a=r.buffer.slice(i,i+o);i+=a.byteLength,yield new Uint8Array(a)}}else yield r;else{let i=0,n=r;for(;i!==n.size;){let a=await n.slice(i,Math.min(n.size,i+v2)).arrayBuffer();i+=a.byteLength,yield new Uint8Array(a)}}}var RE,v2,Ci,Za,vo,Xl,wo,w2,uy,Ai,Ya=Ha(()=>{RE=de(b2(),1);v2=65536;w2=(wo=class{constructor(e=[],r={}){bt(this,Ci,[]);bt(this,Za,"");bt(this,vo,0);bt(this,Xl,"transparent");if(typeof e!="object"||e===null)throw new TypeError("Failed to construct 'Blob': The provided value cannot be converted to a sequence.");if(typeof e[Symbol.iterator]!="function")throw new TypeError("Failed to construct 'Blob': The object must have a callable @@iterator property.");if(typeof r!="object"&&typeof r!="function")throw new TypeError("Failed to construct 'Blob': parameter 2 cannot convert to dictionary.");r===null&&(r={});let i=new TextEncoder;for(let o of e){let a;ArrayBuffer.isView(o)?a=new Uint8Array(o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)):o instanceof ArrayBuffer?a=new Uint8Array(o.slice(0)):o instanceof wo?a=o:a=i.encode(`${o}`),Ze(this,vo,Ee(this,vo)+(ArrayBuffer.isView(a)?a.byteLength:a.size)),Ee(this,Ci).push(a)}Ze(this,Xl,`${r.endings===void 0?"transparent":r.endings}`);let n=r.type===void 0?"":String(r.type);Ze(this,Za,/^[\x20-\x7E]*$/.test(n)?n:"")}get size(){return Ee(this,vo)}get type(){return Ee(this,Za)}async text(){let e=new TextDecoder,r="";for await(let i of Yc(Ee(this,Ci),!1))r+=e.decode(i,{stream:!0});return r+=e.decode(),r}async arrayBuffer(){let e=new Uint8Array(this.size),r=0;for await(let i of Yc(Ee(this,Ci),!1))e.set(i,r),r+=i.length;return e.buffer}stream(){let e=Yc(Ee(this,Ci),!0);return new globalThis.ReadableStream({type:"bytes",async pull(r){let i=await e.next();i.done?r.close():r.enqueue(i.value)},async cancel(){await e.return()}})}slice(e=0,r=this.size,i=""){let{size:n}=this,o=e<0?Math.max(n+e,0):Math.min(e,n),a=r<0?Math.max(n+r,0):Math.min(r,n),h=Math.max(a-o,0),d=Ee(this,Ci),m=[],p=0;for(let R of d){if(p>=h)break;let x=ArrayBuffer.isView(R)?R.byteLength:R.size;if(o&&x<=o)o-=x,a-=x;else{let w;ArrayBuffer.isView(R)?(w=R.subarray(o,Math.min(x,a)),p+=w.byteLength):(w=R.slice(o,Math.min(x,a)),p+=w.size),a-=x,m.push(w),o=0}}let M=new wo([],{type:String(i).toLowerCase()});return Ze(M,vo,h),Ze(M,Ci,m),M}get[Symbol.toStringTag](){return"Blob"}static[Symbol.hasInstance](e){return e&&typeof e=="object"&&typeof e.constructor=="function"&&(typeof e.stream=="function"||typeof e.arrayBuffer=="function")&&/^(Blob|File)$/.test(e[Symbol.toStringTag])}},Ci=new WeakMap,Za=new WeakMap,vo=new WeakMap,Xl=new WeakMap,wo);Object.defineProperties(w2.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}});uy=w2,Ai=uy});var Xa,Qa,_2,hy,cy,_o,Xc=Ha(()=>{Ya();hy=(_2=class extends Ai{constructor(r,i,n={}){if(arguments.length<2)throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`);super(r,n);bt(this,Xa,0);bt(this,Qa,"");n===null&&(n={});let o=n.lastModified===void 0?Date.now():Number(n.lastModified);Number.isNaN(o)||Ze(this,Xa,o),Ze(this,Qa,String(i))}get name(){return Ee(this,Qa)}get lastModified(){return Ee(this,Xa)}get[Symbol.toStringTag](){return"File"}static[Symbol.hasInstance](r){return!!r&&r instanceof Ai&&/^(File)$/.test(r[Symbol.toStringTag])}},Xa=new WeakMap,Qa=new WeakMap,_2),cy=hy,_o=cy});function E2(t,e=Ai){var r=`${x2()}${x2()}`.replace(/\./g,"").slice(-28).padStart(32,"-"),i=[],n=`--${r}\r
1
+ var Wg=Object.create;var Wa=Object.defineProperty;var Hg=Object.getOwnPropertyDescriptor;var Gg=Object.getOwnPropertyNames;var Vg=Object.getPrototypeOf,Kg=Object.prototype.hasOwnProperty;var Jg=(t,e,r)=>e in t?Wa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Ha=(t,e)=>()=>(t&&(e=t(t=0)),e);var V=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Yd=(t,e)=>{for(var r in e)Wa(t,r,{get:e[r],enumerable:!0})},Xd=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Gg(e))!Kg.call(t,n)&&n!==r&&Wa(t,n,{get:()=>e[n],enumerable:!(i=Hg(e,n))||i.enumerable});return t};var de=(t,e,r)=>(r=t!=null?Wg(Vg(t)):{},Xd(e||!t||!t.__esModule?Wa(r,"default",{value:t,enumerable:!0}):r,t)),Zg=t=>Xd(Wa({},"__esModule",{value:!0}),t);var Hc=(t,e,r)=>(Jg(t,typeof e!="symbol"?e+"":e,r),r),Qd=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)};var Ee=(t,e,r)=>(Qd(t,e,"read from private field"),r?r.call(t):e.get(t)),bt=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},Ze=(t,e,r,i)=>(Qd(t,e,"write to private field"),i?i.call(t,r):e.set(t,r),r),Gc=(t,e,r,i)=>({set _(n){Ze(t,e,n,r)},get _(){return Ee(t,e,i)}});var i2=V(ql=>{"use strict";Object.defineProperty(ql,"__esModule",{value:!0});ql.Nztm2000Quad=void 0;ql.Nztm2000Quad={type:"TileMatrixSetType",title:"LINZ NZTM2000 Map Tile Grid V2",abstract:"",identifier:"NZTM2000Quad",supportedCRS:"https://www.opengis.net/def/crs/EPSG/0/2193",boundingBox:{type:"BoundingBoxType",crs:"https://www.opengis.net/def/crs/EPSG/0/2193",lowerCorner:[419435.9938,-32605867284e-4],upperCorner:[104381901652e-4,6758167443e-3]},tileMatrix:[{type:"TileMatrixType",identifier:"0",scaleDenominator:139770566007179e-6,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:1,matrixHeight:1},{type:"TileMatrixType",identifier:"1",scaleDenominator:698852830035895e-7,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:2,matrixHeight:2},{type:"TileMatrixType",identifier:"2",scaleDenominator:3494264150179475e-8,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:4,matrixHeight:4},{type:"TileMatrixType",identifier:"3",scaleDenominator:17471320750897374e-9,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:8,matrixHeight:8},{type:"TileMatrixType",identifier:"4",scaleDenominator:8735660375448687e-9,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:16,matrixHeight:16},{type:"TileMatrixType",identifier:"5",scaleDenominator:4.3678301877243435e6,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:32,matrixHeight:32},{type:"TileMatrixType",identifier:"6",scaleDenominator:2.1839150938621718e6,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:64,matrixHeight:64},{type:"TileMatrixType",identifier:"7",scaleDenominator:1.0919575469310859e6,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:128,matrixHeight:128},{type:"TileMatrixType",identifier:"8",scaleDenominator:545978.7734655429,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:256,matrixHeight:256},{type:"TileMatrixType",identifier:"9",scaleDenominator:272989.38673277147,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:512,matrixHeight:512},{type:"TileMatrixType",identifier:"10",scaleDenominator:136494.69336638573,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:1024,matrixHeight:1024},{type:"TileMatrixType",identifier:"11",scaleDenominator:68247.34668319287,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:2048,matrixHeight:2048},{type:"TileMatrixType",identifier:"12",scaleDenominator:34123.67334159643,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:4096,matrixHeight:4096},{type:"TileMatrixType",identifier:"13",scaleDenominator:17061.836670798217,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:8192,matrixHeight:8192},{type:"TileMatrixType",identifier:"14",scaleDenominator:8530.918335399108,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:16384,matrixHeight:16384},{type:"TileMatrixType",identifier:"15",scaleDenominator:4265.459167699554,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:32768,matrixHeight:32768},{type:"TileMatrixType",identifier:"16",scaleDenominator:2132.729583849777,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:65536,matrixHeight:65536},{type:"TileMatrixType",identifier:"17",scaleDenominator:1066.3647919248886,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:131072,matrixHeight:131072},{type:"TileMatrixType",identifier:"18",scaleDenominator:533.1823959624443,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:262144,matrixHeight:262144},{type:"TileMatrixType",identifier:"19",scaleDenominator:266.59119798122214,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:524288,matrixHeight:524288},{type:"TileMatrixType",identifier:"20",scaleDenominator:133.29559899061107,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:1048576,matrixHeight:1048576},{type:"TileMatrixType",identifier:"21",scaleDenominator:66.64779949530553,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:2097152,matrixHeight:2097152}]}});var n2=V(Fl=>{"use strict";Object.defineProperty(Fl,"__esModule",{value:!0});Fl.Nztm2000=void 0;Fl.Nztm2000={type:"TileMatrixSetType",title:"LINZ NZTM2000 Map Tile Grid",abstract:"See https://www.linz.govt.nz/data/linz-data-service/guides-and-documentation/nztm2000-map-tile-service-schema",identifier:"NZTM2000",supportedCRS:"https://www.opengis.net/def/crs/EPSG/0/2193",boundingBox:{type:"BoundingBoxType",crs:"https://www.opengis.net/def/crs/EPSG/0/2193",lowerCorner:[3087e3,274e3],upperCorner:[7173e3,3327e3]},tileMatrix:[{type:"TileMatrixType",identifier:"0",scaleDenominator:32e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:2,matrixHeight:4},{type:"TileMatrixType",identifier:"1",scaleDenominator:16e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:4,matrixHeight:8},{type:"TileMatrixType",identifier:"2",scaleDenominator:8e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:8,matrixHeight:16},{type:"TileMatrixType",identifier:"3",scaleDenominator:4e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:16,matrixHeight:32},{type:"TileMatrixType",identifier:"4",scaleDenominator:2e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:32,matrixHeight:64},{type:"TileMatrixType",identifier:"5",scaleDenominator:1e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:64,matrixHeight:128},{type:"TileMatrixType",identifier:"6",scaleDenominator:5e5,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:128,matrixHeight:256},{type:"TileMatrixType",identifier:"7",scaleDenominator:25e4,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:256,matrixHeight:512},{type:"TileMatrixType",identifier:"8",scaleDenominator:1e5,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:640,matrixHeight:1280},{type:"TileMatrixType",identifier:"9",scaleDenominator:5e4,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:1280,matrixHeight:2560},{type:"TileMatrixType",identifier:"10",scaleDenominator:25e3,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:2560,matrixHeight:5120},{type:"TileMatrixType",identifier:"11",scaleDenominator:1e4,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:6400,matrixHeight:12800},{type:"TileMatrixType",identifier:"12",scaleDenominator:5e3,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:12800,matrixHeight:25600},{type:"TileMatrixType",identifier:"13",scaleDenominator:2500,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:25600,matrixHeight:51200},{type:"TileMatrixType",identifier:"14",scaleDenominator:1e3,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:64e3,matrixHeight:128e3},{type:"TileMatrixType",identifier:"15",scaleDenominator:500,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:128e3,matrixHeight:256e3},{type:"TileMatrixType",identifier:"16",scaleDenominator:250,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:256e3,matrixHeight:512e3}]}});var s2=V(go=>{"use strict";Object.defineProperty(go,"__esModule",{value:!0});go.Nztm2000=go.Nztm2000Quad=void 0;var ey=i2();Object.defineProperty(go,"Nztm2000Quad",{enumerable:!0,get:function(){return ey.Nztm2000Quad}});var ty=n2();Object.defineProperty(go,"Nztm2000",{enumerable:!0,get:function(){return ty.Nztm2000}})});var yo=V((Gl,o2)=>{(function(t,e){typeof Gl=="object"&&typeof o2<"u"?e(Gl):typeof define=="function"&&define.amd?define(["exports"],e):e(t.ULID={})})(Gl,function(t){"use strict";function e(C){var I=new Error(C);return I.source="ulid",I}var r="0123456789ABCDEFGHJKMNPQRSTVWXYZ",i=r.length,n=Math.pow(2,48)-1,o=10,a=16;function h(C,I,k){return I>C.length-1?C:C.substr(0,I)+k+C.substr(I+1)}function d(C){for(var I=void 0,k=C.length,B=void 0,z=void 0,H=i-1;!I&&k-->=0;){if(B=C[k],z=r.indexOf(B),z===-1)throw e("incorrectly encoded string");if(z===H){C=h(C,k,r[0]);continue}I=h(C,k,r[z+1])}if(typeof I=="string")return I;throw e("cannot increment this string")}function m(C){var I=Math.floor(C()*i);return I===i&&(I=i-1),r.charAt(I)}function p(C,I){if(isNaN(C))throw new Error(C+" must be a number");if(C>n)throw e("cannot encode time greater than "+n);if(C<0)throw e("time must be positive");if(Number.isInteger(C)===!1)throw e("time must be an integer");for(var k=void 0,B="";I>0;I--)k=C%i,B=r.charAt(k)+B,C=(C-k)/i;return B}function M(C,I){for(var k="";C>0;C--)k=m(I)+k;return k}function R(C){if(C.length!==o+a)throw e("malformed ulid");var I=C.substr(0,o).split("").reverse().reduce(function(k,B,z){var H=r.indexOf(B);if(H===-1)throw e("invalid character found: "+B);return k+=H*Math.pow(i,z)},0);if(I>n)throw e("malformed ulid, timestamp too large");return I}function x(){var C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,I=arguments[1];I||(I=typeof window<"u"?window:null);var k=I&&(I.crypto||I.msCrypto);if(k)return function(){var z=new Uint8Array(1);return k.getRandomValues(z),z[0]/255};try{var B=require("crypto");return function(){return B.randomBytes(1).readUInt8()/255}}catch{}if(C){try{console.error("secure crypto unusable, falling back to insecure Math.random()!")}catch{}return function(){return Math.random()}}throw e("secure crypto unusable, insecure Math.random not allowed")}function w(C){return C||(C=x()),function(k){return isNaN(k)&&(k=Date.now()),p(k,o)+M(a,C)}}function E(C){C||(C=x());var I=0,k=void 0;return function(z){if(isNaN(z)&&(z=Date.now()),z<=I){var H=k=d(k);return p(I,o)+H}I=z;var J=k=M(a,C);return p(z,o)+J}}var T=w();t.replaceCharAt=h,t.incrementBase32=d,t.randomChar=m,t.encodeTime=p,t.encodeRandom=M,t.decodeTime=R,t.detectPrng=x,t.factory=w,t.monotonicFactory=E,t.ulid=T,Object.defineProperty(t,"__esModule",{value:!0})})});var l2=V((GM,a2)=>{"use strict";function sy(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var i=0;i<t.length;i++){var n=t.charAt(i),o=n.charCodeAt(0);if(e[o]!==255)throw new TypeError(n+" is ambiguous");e[o]=i}var a=t.length,h=t.charAt(0),d=Math.log(a)/Math.log(256),m=Math.log(256)/Math.log(a);function p(x){if(x instanceof Uint8Array||(ArrayBuffer.isView(x)?x=new Uint8Array(x.buffer,x.byteOffset,x.byteLength):Array.isArray(x)&&(x=Uint8Array.from(x))),!(x instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(x.length===0)return"";for(var w=0,E=0,T=0,C=x.length;T!==C&&x[T]===0;)T++,w++;for(var I=(C-T)*m+1>>>0,k=new Uint8Array(I);T!==C;){for(var B=x[T],z=0,H=I-1;(B!==0||z<E)&&H!==-1;H--,z++)B+=256*k[H]>>>0,k[H]=B%a>>>0,B=B/a>>>0;if(B!==0)throw new Error("Non-zero carry");E=z,T++}for(var J=I-E;J!==I&&k[J]===0;)J++;for(var se=h.repeat(w);J<I;++J)se+=t.charAt(k[J]);return se}function M(x){if(typeof x!="string")throw new TypeError("Expected String");if(x.length===0)return new Uint8Array;for(var w=0,E=0,T=0;x[w]===h;)E++,w++;for(var C=(x.length-w)*d+1>>>0,I=new Uint8Array(C);x[w];){var k=e[x.charCodeAt(w)];if(k===255)return;for(var B=0,z=C-1;(k!==0||B<T)&&z!==-1;z--,B++)k+=a*I[z]>>>0,I[z]=k%256>>>0,k=k/256>>>0;if(k!==0)throw new Error("Non-zero carry");T=B,w++}for(var H=C-T;H!==C&&I[H]===0;)H++;for(var J=new Uint8Array(E+(C-H)),se=E;H!==C;)J[se++]=I[H++];return J}function R(x){var w=M(x);if(w)return w;throw new Error("Non-base"+a+" character")}return{encode:p,decodeUnsafe:M,decode:R}}a2.exports=sy});var b2=V((Yl,y2)=>{(function(t,e){typeof Yl=="object"&&typeof y2<"u"?e(Yl):typeof define=="function"&&define.amd?define(["exports"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.WebStreamsPolyfill={}))})(Yl,function(t){"use strict";let e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol:u=>`Symbol(${u})`;function r(){}function i(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global}let n=i();function o(u){return typeof u=="object"&&u!==null||typeof u=="function"}let a=r,h=Promise,d=Promise.prototype.then,m=Promise.resolve.bind(h),p=Promise.reject.bind(h);function M(u){return new h(u)}function R(u){return m(u)}function x(u){return p(u)}function w(u,f,_){return d.call(u,f,_)}function E(u,f,_){w(w(u,f,_),void 0,a)}function T(u,f){E(u,f)}function C(u,f){E(u,void 0,f)}function I(u,f,_){return w(u,f,_)}function k(u){w(u,void 0,a)}let B=(()=>{let u=n&&n.queueMicrotask;if(typeof u=="function")return u;let f=R(void 0);return _=>w(f,_)})();function z(u,f,_){if(typeof u!="function")throw new TypeError("Argument is not a function");return Function.prototype.apply.call(u,f,_)}function H(u,f,_){try{return R(z(u,f,_))}catch(P){return x(P)}}let J=16384;class se{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(f){let _=this._back,P=_;_._elements.length===J-1&&(P={_elements:[],_next:void 0}),_._elements.push(f),P!==_&&(this._back=P,_._next=P),++this._size}shift(){let f=this._front,_=f,P=this._cursor,N=P+1,j=f._elements,q=j[P];return N===J&&(_=f._next,N=0),--this._size,this._cursor=N,f!==_&&(this._front=_),j[P]=void 0,q}forEach(f){let _=this._cursor,P=this._front,N=P._elements;for(;(_!==N.length||P._next!==void 0)&&!(_===N.length&&(P=P._next,N=P._elements,_=0,N.length===0));)f(N[_]),++_}peek(){let f=this._front,_=this._cursor;return f._elements[_]}}function Me(u,f){u._ownerReadableStream=f,f._reader=u,f._state==="readable"?st(u):f._state==="closed"?di(u):zt(u,f._storedError)}function Ue(u,f){let _=u._ownerReadableStream;return tr(_,f)}function Te(u){u._ownerReadableStream._state==="readable"?fa(u,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):$h(u,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),u._ownerReadableStream._reader=void 0,u._ownerReadableStream=void 0}function Ne(u){return new TypeError("Cannot "+u+" a stream using a released reader")}function st(u){u._closedPromise=M((f,_)=>{u._closedPromise_resolve=f,u._closedPromise_reject=_})}function zt(u,f){st(u),fa(u,f)}function di(u){st(u),In(u)}function fa(u,f){u._closedPromise_reject!==void 0&&(k(u._closedPromise),u._closedPromise_reject(f),u._closedPromise_resolve=void 0,u._closedPromise_reject=void 0)}function $h(u,f){zt(u,f)}function In(u){u._closedPromise_resolve!==void 0&&(u._closedPromise_resolve(void 0),u._closedPromise_resolve=void 0,u._closedPromise_reject=void 0)}let da=e("[[AbortSteps]]"),hr=e("[[ErrorSteps]]"),ma=e("[[CancelSteps]]"),Ts=e("[[PullSteps]]"),mi=Number.isFinite||function(u){return typeof u=="number"&&isFinite(u)},qh=Math.trunc||function(u){return u<0?Math.ceil(u):Math.floor(u)};function Fh(u){return typeof u=="object"||typeof u=="function"}function at(u,f){if(u!==void 0&&!Fh(u))throw new TypeError(`${f} is not an object.`)}function Qt(u,f){if(typeof u!="function")throw new TypeError(`${f} is not a function.`)}function j1(u){return typeof u=="object"&&u!==null||typeof u=="function"}function ft(u,f){if(!j1(u))throw new TypeError(`${f} is not an object.`)}function Tr(u,f,_){if(u===void 0)throw new TypeError(`Parameter ${f} is required in '${_}'.`)}function pa(u,f,_){if(u===void 0)throw new TypeError(`${f} is required in '${_}'.`)}function ga(u){return Number(u)}function $1(u){return u===0?0:u}function Wh(u){return $1(qh(u))}function q1(u,f){let P=Number.MAX_SAFE_INTEGER,N=Number(u);if(N=$1(N),!mi(N))throw new TypeError(`${f} is not a finite number`);if(N=Wh(N),N<0||N>P)throw new TypeError(`${f} is outside the accepted range of ${0} to ${P}, inclusive`);return!mi(N)||N===0?0:N}function ya(u,f){if(!Kr(u))throw new TypeError(`${f} is not a ReadableStream.`)}function ji(u){return new Z(u)}function F1(u,f){u._reader._readRequests.push(f)}function Is(u,f,_){let N=u._reader._readRequests.shift();_?N._closeSteps():N._chunkSteps(f)}function Tt(u){return u._reader._readRequests.length}function $i(u){let f=u._reader;return!(f===void 0||!ot(f))}class Z{constructor(f){if(Tr(f,1,"ReadableStreamDefaultReader"),ya(f,"First parameter"),Jr(f))throw new TypeError("This stream has already been locked for exclusive reading by another reader");Me(this,f),this._readRequests=new se}get closed(){return ot(this)?this._closedPromise:x(Ps("closed"))}cancel(f=void 0){return ot(this)?this._ownerReadableStream===void 0?x(Ne("cancel")):Ue(this,f):x(Ps("cancel"))}read(){if(!ot(this))return x(Ps("read"));if(this._ownerReadableStream===void 0)return x(Ne("read from"));let f,_,P=M((j,q)=>{f=j,_=q});return Ir(this,{_chunkSteps:j=>f({value:j,done:!1}),_closeSteps:()=>f({value:void 0,done:!0}),_errorSteps:j=>_(j)}),P}releaseLock(){if(!ot(this))throw Ps("releaseLock");if(this._ownerReadableStream!==void 0){if(this._readRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");Te(this)}}}Object.defineProperties(Z.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Z.prototype,e.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});function ot(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_readRequests")?!1:u instanceof Z}function Ir(u,f){let _=u._ownerReadableStream;_._disturbed=!0,_._state==="closed"?f._closeSteps():_._state==="errored"?f._errorSteps(_._storedError):_._readableStreamController[Ts](f)}function Ps(u){return new TypeError(`ReadableStreamDefaultReader.prototype.${u} can only be used on a ReadableStreamDefaultReader`)}let W1=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class H1{constructor(f,_){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=f,this._preventCancel=_}next(){let f=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?I(this._ongoingPromise,f,f):f(),this._ongoingPromise}return(f){let _=()=>this._returnSteps(f);return this._ongoingPromise?I(this._ongoingPromise,_,_):_()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});let f=this._reader;if(f._ownerReadableStream===void 0)return x(Ne("iterate"));let _,P,N=M((q,te)=>{_=q,P=te});return Ir(f,{_chunkSteps:q=>{this._ongoingPromise=void 0,B(()=>_({value:q,done:!1}))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,Te(f),_({value:void 0,done:!0})},_errorSteps:q=>{this._ongoingPromise=void 0,this._isFinished=!0,Te(f),P(q)}}),N}_returnSteps(f){if(this._isFinished)return Promise.resolve({value:f,done:!0});this._isFinished=!0;let _=this._reader;if(_._ownerReadableStream===void 0)return x(Ne("finish iterating"));if(!this._preventCancel){let P=Ue(_,f);return Te(_),I(P,()=>({value:f,done:!0}))}return Te(_),R({value:f,done:!0})}}let G1={next(){return V1(this)?this._asyncIteratorImpl.next():x(ba("next"))},return(u){return V1(this)?this._asyncIteratorImpl.return(u):x(ba("return"))}};W1!==void 0&&Object.setPrototypeOf(G1,W1);function Hh(u,f){let _=ji(u),P=new H1(_,f),N=Object.create(G1);return N._asyncIteratorImpl=P,N}function V1(u){if(!o(u)||!Object.prototype.hasOwnProperty.call(u,"_asyncIteratorImpl"))return!1;try{return u._asyncIteratorImpl instanceof H1}catch{return!1}}function ba(u){return new TypeError(`ReadableStreamAsyncIterator.${u} can only be used on a ReadableSteamAsyncIterator`)}let K1=Number.isNaN||function(u){return u!==u};function Pn(u){return u.slice()}function J1(u,f,_,P,N){new Uint8Array(u).set(new Uint8Array(_,P,N),f)}function va(u){return u}function pi(u){return!1}function wa(u,f,_){if(u.slice)return u.slice(f,_);let P=_-f,N=new ArrayBuffer(P);return J1(N,0,u,f,P),N}function Gh(u){return!(typeof u!="number"||K1(u)||u<0)}function Z1(u){let f=wa(u.buffer,u.byteOffset,u.byteOffset+u.byteLength);return new Uint8Array(f)}function _a(u){let f=u._queue.shift();return u._queueTotalSize-=f.size,u._queueTotalSize<0&&(u._queueTotalSize=0),f.value}function ue(u,f,_){if(!Gh(_)||_===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");u._queue.push({value:f,size:_}),u._queueTotalSize+=_}function Vh(u){return u._queue.peek().value}function Fr(u){u._queue=new se,u._queueTotalSize=0}class On{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!Os(this))throw qi("view");return this._view}respond(f){if(!Os(this))throw qi("respond");if(Tr(f,1,"respond"),f=q1(f,"First parameter"),this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");pi(this._view.buffer),Ln(this._associatedReadableByteStreamController,f)}respondWithNewView(f){if(!Os(this))throw qi("respondWithNewView");if(Tr(f,1,"respondWithNewView"),!ArrayBuffer.isView(f))throw new TypeError("You can only respond with array buffer views");if(this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");pi(f.buffer),Nn(this._associatedReadableByteStreamController,f)}}Object.defineProperties(On.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(On.prototype,e.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class Ke{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!gi(this))throw Fi("byobRequest");return Ea(this)}get desiredSize(){if(!gi(this))throw Fi("desiredSize");return Ra(this)}close(){if(!gi(this))throw Fi("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");let f=this._controlledReadableByteStream._state;if(f!=="readable")throw new TypeError(`The stream (in ${f} state) is not in the readable state and cannot be closed`);Wr(this)}enqueue(f){if(!gi(this))throw Fi("enqueue");if(Tr(f,1,"enqueue"),!ArrayBuffer.isView(f))throw new TypeError("chunk must be an array buffer view");if(f.byteLength===0)throw new TypeError("chunk must have non-zero byteLength");if(f.buffer.byteLength===0)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");let _=this._controlledReadableByteStream._state;if(_!=="readable")throw new TypeError(`The stream (in ${_} state) is not in the readable state and cannot be enqueued to`);Bs(this,f)}error(f=void 0){if(!gi(this))throw Fi("error");Ut(this,f)}[ma](f){Y1(this),Fr(this);let _=this._cancelAlgorithm(f);return Ns(this),_}[Ts](f){let _=this._controlledReadableByteStream;if(this._queueTotalSize>0){let N=this._queue.shift();this._queueTotalSize-=N.byteLength,Q1(this);let j=new Uint8Array(N.buffer,N.byteOffset,N.byteLength);f._chunkSteps(j);return}let P=this._autoAllocateChunkSize;if(P!==void 0){let N;try{N=new ArrayBuffer(P)}catch(q){f._errorSteps(q);return}let j={buffer:N,bufferByteLength:P,byteOffset:0,byteLength:P,bytesFilled:0,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(j)}F1(_,f),yi(this)}}Object.defineProperties(Ke.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Ke.prototype,e.toStringTag,{value:"ReadableByteStreamController",configurable:!0});function gi(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_controlledReadableByteStream")?!1:u instanceof Ke}function Os(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_associatedReadableByteStreamController")?!1:u instanceof On}function yi(u){if(!Zh(u))return;if(u._pulling){u._pullAgain=!0;return}u._pulling=!0;let _=u._pullAlgorithm();E(_,()=>{u._pulling=!1,u._pullAgain&&(u._pullAgain=!1,yi(u))},P=>{Ut(u,P)})}function Y1(u){Sa(u),u._pendingPullIntos=new se}function xa(u,f){let _=!1;u._state==="closed"&&(_=!0);let P=bi(f);f.readerType==="default"?Is(u,P,_):It(u,P,_)}function bi(u){let f=u.bytesFilled,_=u.elementSize;return new u.viewConstructor(u.buffer,u.byteOffset,f/_)}function ks(u,f,_,P){u._queue.push({buffer:f,byteOffset:_,byteLength:P}),u._queueTotalSize+=P}function X1(u,f){let _=f.elementSize,P=f.bytesFilled-f.bytesFilled%_,N=Math.min(u._queueTotalSize,f.byteLength-f.bytesFilled),j=f.bytesFilled+N,q=j-j%_,te=N,ce=!1;q>P&&(te=q-f.bytesFilled,ce=!0);let ve=u._queue;for(;te>0;){let Ie=ve.peek(),Pe=Math.min(te,Ie.byteLength),et=f.byteOffset+f.bytesFilled;J1(f.buffer,et,Ie.buffer,Ie.byteOffset,Pe),Ie.byteLength===Pe?ve.shift():(Ie.byteOffset+=Pe,Ie.byteLength-=Pe),u._queueTotalSize-=Pe,Ls(u,Pe,f),te-=Pe}return ce}function Ls(u,f,_){_.bytesFilled+=f}function Q1(u){u._queueTotalSize===0&&u._closeRequested?(Ns(u),Hn(u._controlledReadableByteStream)):yi(u)}function Sa(u){u._byobRequest!==null&&(u._byobRequest._associatedReadableByteStreamController=void 0,u._byobRequest._view=null,u._byobRequest=null)}function el(u){for(;u._pendingPullIntos.length>0;){if(u._queueTotalSize===0)return;let f=u._pendingPullIntos.peek();X1(u,f)&&(kn(u),xa(u._controlledReadableByteStream,f))}}function Kh(u,f,_){let P=u._controlledReadableByteStream,N=1;f.constructor!==DataView&&(N=f.constructor.BYTES_PER_ELEMENT);let j=f.constructor,q=f.buffer,te={buffer:q,bufferByteLength:q.byteLength,byteOffset:f.byteOffset,byteLength:f.byteLength,bytesFilled:0,elementSize:N,viewConstructor:j,readerType:"byob"};if(u._pendingPullIntos.length>0){u._pendingPullIntos.push(te),Ca(P,_);return}if(P._state==="closed"){let ce=new j(te.buffer,te.byteOffset,0);_._closeSteps(ce);return}if(u._queueTotalSize>0){if(X1(u,te)){let ce=bi(te);Q1(u),_._chunkSteps(ce);return}if(u._closeRequested){let ce=new TypeError("Insufficient bytes to fill elements in the given buffer");Ut(u,ce),_._errorSteps(ce);return}}u._pendingPullIntos.push(te),Ca(P,_),yi(u)}function cr(u,f){let _=u._controlledReadableByteStream;if(zs(_))for(;Aa(_)>0;){let P=kn(u);xa(_,P)}}function Jh(u,f,_){if(Ls(u,f,_),_.bytesFilled<_.elementSize)return;kn(u);let P=_.bytesFilled%_.elementSize;if(P>0){let N=_.byteOffset+_.bytesFilled,j=wa(_.buffer,N-P,N);ks(u,j,0,j.byteLength)}_.bytesFilled-=P,xa(u._controlledReadableByteStream,_),el(u)}function Ma(u,f){let _=u._pendingPullIntos.peek();Sa(u),u._controlledReadableByteStream._state==="closed"?cr(u):Jh(u,f,_),yi(u)}function kn(u){return u._pendingPullIntos.shift()}function Zh(u){let f=u._controlledReadableByteStream;return f._state!=="readable"||u._closeRequested||!u._started?!1:!!($i(f)&&Tt(f)>0||zs(f)&&Aa(f)>0||Ra(u)>0)}function Ns(u){u._pullAlgorithm=void 0,u._cancelAlgorithm=void 0}function Wr(u){let f=u._controlledReadableByteStream;if(!(u._closeRequested||f._state!=="readable")){if(u._queueTotalSize>0){u._closeRequested=!0;return}if(u._pendingPullIntos.length>0&&u._pendingPullIntos.peek().bytesFilled>0){let P=new TypeError("Insufficient bytes to fill elements in the given buffer");throw Ut(u,P),P}Ns(u),Hn(f)}}function Bs(u,f){let _=u._controlledReadableByteStream;if(u._closeRequested||_._state!=="readable")return;let P=f.buffer,N=f.byteOffset,j=f.byteLength,q=P;if(u._pendingPullIntos.length>0){let te=u._pendingPullIntos.peek();pi(te.buffer),te.buffer=te.buffer}if(Sa(u),$i(_))if(Tt(_)===0)ks(u,q,N,j);else{u._pendingPullIntos.length>0&&kn(u);let te=new Uint8Array(q,N,j);Is(_,te,!1)}else zs(_)?(ks(u,q,N,j),el(u)):ks(u,q,N,j);yi(u)}function Ut(u,f){let _=u._controlledReadableByteStream;_._state==="readable"&&(Y1(u),Fr(u),Ns(u),Ml(_,f))}function Ea(u){if(u._byobRequest===null&&u._pendingPullIntos.length>0){let f=u._pendingPullIntos.peek(),_=new Uint8Array(f.buffer,f.byteOffset+f.bytesFilled,f.byteLength-f.bytesFilled),P=Object.create(On.prototype);Yh(P,u,_),u._byobRequest=P}return u._byobRequest}function Ra(u){let f=u._controlledReadableByteStream._state;return f==="errored"?null:f==="closed"?0:u._strategyHWM-u._queueTotalSize}function Ln(u,f){let _=u._pendingPullIntos.peek();if(u._controlledReadableByteStream._state==="closed"){if(f!==0)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(f===0)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(_.bytesFilled+f>_.byteLength)throw new RangeError("bytesWritten out of range")}_.buffer=_.buffer,Ma(u,f)}function Nn(u,f){let _=u._pendingPullIntos.peek();if(u._controlledReadableByteStream._state==="closed"){if(f.byteLength!==0)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(f.byteLength===0)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(_.byteOffset+_.bytesFilled!==f.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(_.bufferByteLength!==f.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(_.bytesFilled+f.byteLength>_.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");let N=f.byteLength;_.buffer=f.buffer,Ma(u,N)}function tl(u,f,_,P,N,j,q){f._controlledReadableByteStream=u,f._pullAgain=!1,f._pulling=!1,f._byobRequest=null,f._queue=f._queueTotalSize=void 0,Fr(f),f._closeRequested=!1,f._started=!1,f._strategyHWM=j,f._pullAlgorithm=P,f._cancelAlgorithm=N,f._autoAllocateChunkSize=q,f._pendingPullIntos=new se,u._readableStreamController=f;let te=_();E(R(te),()=>{f._started=!0,yi(f)},ce=>{Ut(f,ce)})}function rl(u,f,_){let P=Object.create(Ke.prototype),N=()=>{},j=()=>R(void 0),q=()=>R(void 0);f.start!==void 0&&(N=()=>f.start(P)),f.pull!==void 0&&(j=()=>f.pull(P)),f.cancel!==void 0&&(q=ce=>f.cancel(ce));let te=f.autoAllocateChunkSize;if(te===0)throw new TypeError("autoAllocateChunkSize must be greater than 0");tl(u,P,N,j,q,_,te)}function Yh(u,f,_){u._associatedReadableByteStreamController=f,u._view=_}function qi(u){return new TypeError(`ReadableStreamBYOBRequest.prototype.${u} can only be used on a ReadableStreamBYOBRequest`)}function Fi(u){return new TypeError(`ReadableByteStreamController.prototype.${u} can only be used on a ReadableByteStreamController`)}function Ds(u){return new Wi(u)}function Ca(u,f){u._reader._readIntoRequests.push(f)}function It(u,f,_){let N=u._reader._readIntoRequests.shift();_?N._closeSteps(f):N._chunkSteps(f)}function Aa(u){return u._reader._readIntoRequests.length}function zs(u){let f=u._reader;return!(f===void 0||!jt(f))}class Wi{constructor(f){if(Tr(f,1,"ReadableStreamBYOBReader"),ya(f,"First parameter"),Jr(f))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!gi(f._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");Me(this,f),this._readIntoRequests=new se}get closed(){return jt(this)?this._closedPromise:x(pt("closed"))}cancel(f=void 0){return jt(this)?this._ownerReadableStream===void 0?x(Ne("cancel")):Ue(this,f):x(pt("cancel"))}read(f){if(!jt(this))return x(pt("read"));if(!ArrayBuffer.isView(f))return x(new TypeError("view must be an array buffer view"));if(f.byteLength===0)return x(new TypeError("view must have non-zero byteLength"));if(f.buffer.byteLength===0)return x(new TypeError("view's buffer must have non-zero byteLength"));if(pi(f.buffer),this._ownerReadableStream===void 0)return x(Ne("read from"));let _,P,N=M((q,te)=>{_=q,P=te});return mt(this,f,{_chunkSteps:q=>_({value:q,done:!1}),_closeSteps:q=>_({value:q,done:!0}),_errorSteps:q=>P(q)}),N}releaseLock(){if(!jt(this))throw pt("releaseLock");if(this._ownerReadableStream!==void 0){if(this._readIntoRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");Te(this)}}}Object.defineProperties(Wi.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Wi.prototype,e.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});function jt(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_readIntoRequests")?!1:u instanceof Wi}function mt(u,f,_){let P=u._ownerReadableStream;P._disturbed=!0,P._state==="errored"?_._errorSteps(P._storedError):Kh(P._readableStreamController,f,_)}function pt(u){return new TypeError(`ReadableStreamBYOBReader.prototype.${u} can only be used on a ReadableStreamBYOBReader`)}function Pr(u,f){let{highWaterMark:_}=u;if(_===void 0)return f;if(K1(_)||_<0)throw new RangeError("Invalid highWaterMark");return _}function Hr(u){let{size:f}=u;return f||(()=>1)}function Us(u,f){at(u,f);let _=u?.highWaterMark,P=u?.size;return{highWaterMark:_===void 0?void 0:ga(_),size:P===void 0?void 0:il(P,`${f} has member 'size' that`)}}function il(u,f){return Qt(u,f),_=>ga(u(_))}function Xh(u,f){at(u,f);let _=u?.abort,P=u?.close,N=u?.start,j=u?.type,q=u?.write;return{abort:_===void 0?void 0:nl(_,u,`${f} has member 'abort' that`),close:P===void 0?void 0:Ta(P,u,`${f} has member 'close' that`),start:N===void 0?void 0:sl(N,u,`${f} has member 'start' that`),write:q===void 0?void 0:Qh(q,u,`${f} has member 'write' that`),type:j}}function nl(u,f,_){return Qt(u,_),P=>H(u,f,[P])}function Ta(u,f,_){return Qt(u,_),()=>H(u,f,[])}function sl(u,f,_){return Qt(u,_),P=>z(u,f,[P])}function Qh(u,f,_){return Qt(u,_),(P,N)=>H(u,f,[P,N])}function js(u,f){if(!Gi(u))throw new TypeError(`${f} is not a WritableStream.`)}function ec(u){if(typeof u!="object"||u===null)return!1;try{return typeof u.aborted=="boolean"}catch{return!1}}let tc=typeof AbortController=="function";function rc(){if(tc)return new AbortController}class Hi{constructor(f={},_={}){f===void 0?f=null:ft(f,"First parameter");let P=Us(_,"Second parameter"),N=Xh(f,"First parameter");if(ll(this),N.type!==void 0)throw new RangeError("Invalid type is specified");let q=Hr(P),te=Pr(P,1);fc(this,N,te,q)}get locked(){if(!Gi(this))throw Ks("locked");return Vi(this)}abort(f=void 0){return Gi(this)?Vi(this)?x(new TypeError("Cannot abort a stream that already has a writer")):Or(this,f):x(Ks("abort"))}close(){return Gi(this)?Vi(this)?x(new TypeError("Cannot close a stream that already has a writer")):fr(this)?x(new TypeError("Cannot close an already-closing stream")):ul(this):x(Ks("close"))}getWriter(){if(!Gi(this))throw Ks("getWriter");return ol(this)}}Object.defineProperties(Hi.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Hi.prototype,e.toStringTag,{value:"WritableStream",configurable:!0});function ol(u){return new Ki(u)}function al(u,f,_,P,N=1,j=()=>1){let q=Object.create(Hi.prototype);ll(q);let te=Object.create(Ji.prototype);return ka(q,te,u,f,_,P,N,j),q}function ll(u){u._state="writable",u._storedError=void 0,u._writer=void 0,u._writableStreamController=void 0,u._writeRequests=new se,u._inFlightWriteRequest=void 0,u._closeRequest=void 0,u._inFlightCloseRequest=void 0,u._pendingAbortRequest=void 0,u._backpressure=!1}function Gi(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_writableStreamController")?!1:u instanceof Hi}function Vi(u){return u._writer!==void 0}function Or(u,f){var _;if(u._state==="closed"||u._state==="errored")return R(void 0);u._writableStreamController._abortReason=f,(_=u._writableStreamController._abortController)===null||_===void 0||_.abort();let P=u._state;if(P==="closed"||P==="errored")return R(void 0);if(u._pendingAbortRequest!==void 0)return u._pendingAbortRequest._promise;let N=!1;P==="erroring"&&(N=!0,f=void 0);let j=M((q,te)=>{u._pendingAbortRequest={_promise:void 0,_resolve:q,_reject:te,_reason:f,_wasAlreadyErroring:N}});return u._pendingAbortRequest._promise=j,N||qs(u,f),j}function ul(u){let f=u._state;if(f==="closed"||f==="errored")return x(new TypeError(`The stream (in ${f} state) is not in the writable state and cannot be closed`));let _=M((N,j)=>{let q={_resolve:N,_reject:j};u._closeRequest=q}),P=u._writer;return P!==void 0&&u._backpressure&&f==="writable"&&za(P),dc(u._writableStreamController),_}function ic(u){return M((_,P)=>{let N={_resolve:_,_reject:P};u._writeRequests.push(N)})}function $s(u,f){if(u._state==="writable"){qs(u,f);return}Fs(u)}function qs(u,f){let _=u._writableStreamController;u._state="erroring",u._storedError=f;let P=u._writer;P!==void 0&&Pa(P,f),!lc(u)&&_._started&&Fs(u)}function Fs(u){u._state="errored",u._writableStreamController[hr]();let f=u._storedError;if(u._writeRequests.forEach(N=>{N._reject(f)}),u._writeRequests=new se,u._pendingAbortRequest===void 0){vi(u);return}let _=u._pendingAbortRequest;if(u._pendingAbortRequest=void 0,_._wasAlreadyErroring){_._reject(f),vi(u);return}let P=u._writableStreamController[da](_._reason);E(P,()=>{_._resolve(),vi(u)},N=>{_._reject(N),vi(u)})}function nc(u){u._inFlightWriteRequest._resolve(void 0),u._inFlightWriteRequest=void 0}function sc(u,f){u._inFlightWriteRequest._reject(f),u._inFlightWriteRequest=void 0,$s(u,f)}function oc(u){u._inFlightCloseRequest._resolve(void 0),u._inFlightCloseRequest=void 0,u._state==="erroring"&&(u._storedError=void 0,u._pendingAbortRequest!==void 0&&(u._pendingAbortRequest._resolve(),u._pendingAbortRequest=void 0)),u._state="closed";let _=u._writer;_!==void 0&&gl(_)}function ac(u,f){u._inFlightCloseRequest._reject(f),u._inFlightCloseRequest=void 0,u._pendingAbortRequest!==void 0&&(u._pendingAbortRequest._reject(f),u._pendingAbortRequest=void 0),$s(u,f)}function fr(u){return!(u._closeRequest===void 0&&u._inFlightCloseRequest===void 0)}function lc(u){return!(u._inFlightWriteRequest===void 0&&u._inFlightCloseRequest===void 0)}function uc(u){u._inFlightCloseRequest=u._closeRequest,u._closeRequest=void 0}function hl(u){u._inFlightWriteRequest=u._writeRequests.shift()}function vi(u){u._closeRequest!==void 0&&(u._closeRequest._reject(u._storedError),u._closeRequest=void 0);let f=u._writer;f!==void 0&&Ba(f,u._storedError)}function Ia(u,f){let _=u._writer;_!==void 0&&f!==u._backpressure&&(f?wc(_):za(_)),u._backpressure=f}class Ki{constructor(f){if(Tr(f,1,"WritableStreamDefaultWriter"),js(f,"First parameter"),Vi(f))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=f,f._writer=this;let _=f._state;if(_==="writable")!fr(f)&&f._backpressure?Js(this):yl(this),Zi(this);else if(_==="erroring")Da(this,f._storedError),Zi(this);else if(_==="closed")yl(this),bc(this);else{let P=f._storedError;Da(this,P),pl(this,P)}}get closed(){return wi(this)?this._closedPromise:x(_i("closed"))}get desiredSize(){if(!wi(this))throw _i("desiredSize");if(this._ownerWritableStream===void 0)throw zn("desiredSize");return er(this)}get ready(){return wi(this)?this._readyPromise:x(_i("ready"))}abort(f=void 0){return wi(this)?this._ownerWritableStream===void 0?x(zn("abort")):hc(this,f):x(_i("abort"))}close(){if(!wi(this))return x(_i("close"));let f=this._ownerWritableStream;return f===void 0?x(zn("close")):fr(f)?x(new TypeError("Cannot close an already-closing stream")):cl(this)}releaseLock(){if(!wi(this))throw _i("releaseLock");this._ownerWritableStream!==void 0&&fl(this)}write(f=void 0){return wi(this)?this._ownerWritableStream===void 0?x(zn("write to")):dl(this,f):x(_i("write"))}}Object.defineProperties(Ki.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Ki.prototype,e.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});function wi(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_ownerWritableStream")?!1:u instanceof Ki}function hc(u,f){let _=u._ownerWritableStream;return Or(_,f)}function cl(u){let f=u._ownerWritableStream;return ul(f)}function cc(u){let f=u._ownerWritableStream,_=f._state;return fr(f)||_==="closed"?R(void 0):_==="errored"?x(f._storedError):cl(u)}function Ws(u,f){u._closedPromiseState==="pending"?Ba(u,f):vc(u,f)}function Pa(u,f){u._readyPromiseState==="pending"?bl(u,f):_c(u,f)}function er(u){let f=u._ownerWritableStream,_=f._state;return _==="errored"||_==="erroring"?null:_==="closed"?0:Bn(f._writableStreamController)}function fl(u){let f=u._ownerWritableStream,_=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");Pa(u,_),Ws(u,_),f._writer=void 0,u._ownerWritableStream=void 0}function dl(u,f){let _=u._ownerWritableStream,P=_._writableStreamController,N=mc(P,f);if(_!==u._ownerWritableStream)return x(zn("write to"));let j=_._state;if(j==="errored")return x(_._storedError);if(fr(_)||j==="closed")return x(new TypeError("The stream is closing or closed and cannot be written to"));if(j==="erroring")return x(_._storedError);let q=ic(_);return pc(P,f,N),q}let Hs={};class Ji{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!Oa(this))throw Na("abortReason");return this._abortReason}get signal(){if(!Oa(this))throw Na("signal");if(this._abortController===void 0)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(f=void 0){if(!Oa(this))throw Na("error");this._controlledWritableStream._state==="writable"&&ml(this,f)}[da](f){let _=this._abortAlgorithm(f);return Gs(this),_}[hr](){Fr(this)}}Object.defineProperties(Ji.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Ji.prototype,e.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});function Oa(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_controlledWritableStream")?!1:u instanceof Ji}function ka(u,f,_,P,N,j,q,te){f._controlledWritableStream=u,u._writableStreamController=f,f._queue=void 0,f._queueTotalSize=void 0,Fr(f),f._abortReason=void 0,f._abortController=rc(),f._started=!1,f._strategySizeAlgorithm=te,f._strategyHWM=q,f._writeAlgorithm=P,f._closeAlgorithm=N,f._abortAlgorithm=j;let ce=Dn(f);Ia(u,ce);let ve=_(),Ie=R(ve);E(Ie,()=>{f._started=!0,Vs(f)},Pe=>{f._started=!0,$s(u,Pe)})}function fc(u,f,_,P){let N=Object.create(Ji.prototype),j=()=>{},q=()=>R(void 0),te=()=>R(void 0),ce=()=>R(void 0);f.start!==void 0&&(j=()=>f.start(N)),f.write!==void 0&&(q=ve=>f.write(ve,N)),f.close!==void 0&&(te=()=>f.close()),f.abort!==void 0&&(ce=ve=>f.abort(ve)),ka(u,N,j,q,te,ce,_,P)}function Gs(u){u._writeAlgorithm=void 0,u._closeAlgorithm=void 0,u._abortAlgorithm=void 0,u._strategySizeAlgorithm=void 0}function dc(u){ue(u,Hs,0),Vs(u)}function mc(u,f){try{return u._strategySizeAlgorithm(f)}catch(_){return La(u,_),1}}function Bn(u){return u._strategyHWM-u._queueTotalSize}function pc(u,f,_){try{ue(u,f,_)}catch(N){La(u,N);return}let P=u._controlledWritableStream;if(!fr(P)&&P._state==="writable"){let N=Dn(u);Ia(P,N)}Vs(u)}function Vs(u){let f=u._controlledWritableStream;if(!u._started||f._inFlightWriteRequest!==void 0)return;if(f._state==="erroring"){Fs(f);return}if(u._queue.length===0)return;let P=Vh(u);P===Hs?gc(u):yc(u,P)}function La(u,f){u._controlledWritableStream._state==="writable"&&ml(u,f)}function gc(u){let f=u._controlledWritableStream;uc(f),_a(u);let _=u._closeAlgorithm();Gs(u),E(_,()=>{oc(f)},P=>{ac(f,P)})}function yc(u,f){let _=u._controlledWritableStream;hl(_);let P=u._writeAlgorithm(f);E(P,()=>{nc(_);let N=_._state;if(_a(u),!fr(_)&&N==="writable"){let j=Dn(u);Ia(_,j)}Vs(u)},N=>{_._state==="writable"&&Gs(u),sc(_,N)})}function Dn(u){return Bn(u)<=0}function ml(u,f){let _=u._controlledWritableStream;Gs(u),qs(_,f)}function Ks(u){return new TypeError(`WritableStream.prototype.${u} can only be used on a WritableStream`)}function Na(u){return new TypeError(`WritableStreamDefaultController.prototype.${u} can only be used on a WritableStreamDefaultController`)}function _i(u){return new TypeError(`WritableStreamDefaultWriter.prototype.${u} can only be used on a WritableStreamDefaultWriter`)}function zn(u){return new TypeError("Cannot "+u+" a stream using a released writer")}function Zi(u){u._closedPromise=M((f,_)=>{u._closedPromise_resolve=f,u._closedPromise_reject=_,u._closedPromiseState="pending"})}function pl(u,f){Zi(u),Ba(u,f)}function bc(u){Zi(u),gl(u)}function Ba(u,f){u._closedPromise_reject!==void 0&&(k(u._closedPromise),u._closedPromise_reject(f),u._closedPromise_resolve=void 0,u._closedPromise_reject=void 0,u._closedPromiseState="rejected")}function vc(u,f){pl(u,f)}function gl(u){u._closedPromise_resolve!==void 0&&(u._closedPromise_resolve(void 0),u._closedPromise_resolve=void 0,u._closedPromise_reject=void 0,u._closedPromiseState="resolved")}function Js(u){u._readyPromise=M((f,_)=>{u._readyPromise_resolve=f,u._readyPromise_reject=_}),u._readyPromiseState="pending"}function Da(u,f){Js(u),bl(u,f)}function yl(u){Js(u),za(u)}function bl(u,f){u._readyPromise_reject!==void 0&&(k(u._readyPromise),u._readyPromise_reject(f),u._readyPromise_resolve=void 0,u._readyPromise_reject=void 0,u._readyPromiseState="rejected")}function wc(u){Js(u)}function _c(u,f){Da(u,f)}function za(u){u._readyPromise_resolve!==void 0&&(u._readyPromise_resolve(void 0),u._readyPromise_resolve=void 0,u._readyPromise_reject=void 0,u._readyPromiseState="fulfilled")}let vl=typeof DOMException<"u"?DOMException:void 0;function xc(u){if(!(typeof u=="function"||typeof u=="object"))return!1;try{return new u,!0}catch{return!1}}function Sc(){let u=function(_,P){this.message=_||"",this.name=P||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};return u.prototype=Object.create(Error.prototype),Object.defineProperty(u.prototype,"constructor",{value:u,writable:!0,configurable:!0}),u}let Mc=xc(vl)?vl:Sc();function xi(u,f,_,P,N,j){let q=ji(u),te=ol(f);u._disturbed=!0;let ce=!1,ve=R(void 0);return M((Ie,Pe)=>{let et;if(j!==void 0){if(et=()=>{let ne=new Mc("Aborted","AbortError"),pe=[];P||pe.push(()=>f._state==="writable"?Or(f,ne):R(void 0)),N||pe.push(()=>u._state==="readable"?tr(u,ne):R(void 0)),_t(()=>Promise.all(pe.map(je=>je())),!0,ne)},j.aborted){et();return}j.addEventListener("abort",et)}function rr(){return M((ne,pe)=>{function je(Pt){Pt?ne():w(tn(),je,pe)}je(!1)})}function tn(){return ce?R(!0):w(te._readyPromise,()=>M((ne,pe)=>{Ir(q,{_chunkSteps:je=>{ve=w(dl(te,je),void 0,r),ne(!1)},_closeSteps:()=>ne(!0),_errorSteps:pe})}))}if(kr(u,q._closedPromise,ne=>{P?$t(!0,ne):_t(()=>Or(f,ne),!0,ne)}),kr(f,te._closedPromise,ne=>{N?$t(!0,ne):_t(()=>tr(u,ne),!0,ne)}),yt(u,q._closedPromise,()=>{_?$t():_t(()=>cc(te))}),fr(f)||f._state==="closed"){let ne=new TypeError("the destination writable stream closed before all data could be piped to it");N?$t(!0,ne):_t(()=>tr(u,ne),!0,ne)}k(rr());function Yr(){let ne=ve;return w(ve,()=>ne!==ve?Yr():void 0)}function kr(ne,pe,je){ne._state==="errored"?je(ne._storedError):C(pe,je)}function yt(ne,pe,je){ne._state==="closed"?je():T(pe,je)}function _t(ne,pe,je){if(ce)return;ce=!0,f._state==="writable"&&!fr(f)?T(Yr(),Pt):Pt();function Pt(){E(ne(),()=>Lr(pe,je),rn=>Lr(!0,rn))}}function $t(ne,pe){ce||(ce=!0,f._state==="writable"&&!fr(f)?T(Yr(),()=>Lr(ne,pe)):Lr(ne,pe))}function Lr(ne,pe){fl(te),Te(q),j!==void 0&&j.removeEventListener("abort",et),ne?Pe(pe):Ie(void 0)}})}class Yi{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Zs(this))throw Qs("desiredSize");return Ua(this)}close(){if(!Zs(this))throw Qs("close");if(!Xi(this))throw new TypeError("The stream is not in a state that permits close");jn(this)}enqueue(f=void 0){if(!Zs(this))throw Qs("enqueue");if(!Xi(this))throw new TypeError("The stream is not in a state that permits enqueue");return Xs(this,f)}error(f=void 0){if(!Zs(this))throw Qs("error");Gr(this,f)}[ma](f){Fr(this);let _=this._cancelAlgorithm(f);return Ys(this),_}[Ts](f){let _=this._controlledReadableStream;if(this._queue.length>0){let P=_a(this);this._closeRequested&&this._queue.length===0?(Ys(this),Hn(_)):Un(this),f._chunkSteps(P)}else F1(_,f),Un(this)}}Object.defineProperties(Yi.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Yi.prototype,e.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});function Zs(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_controlledReadableStream")?!1:u instanceof Yi}function Un(u){if(!wl(u))return;if(u._pulling){u._pullAgain=!0;return}u._pulling=!0;let _=u._pullAlgorithm();E(_,()=>{u._pulling=!1,u._pullAgain&&(u._pullAgain=!1,Un(u))},P=>{Gr(u,P)})}function wl(u){let f=u._controlledReadableStream;return!Xi(u)||!u._started?!1:!!(Jr(f)&&Tt(f)>0||Ua(u)>0)}function Ys(u){u._pullAlgorithm=void 0,u._cancelAlgorithm=void 0,u._strategySizeAlgorithm=void 0}function jn(u){if(!Xi(u))return;let f=u._controlledReadableStream;u._closeRequested=!0,u._queue.length===0&&(Ys(u),Hn(f))}function Xs(u,f){if(!Xi(u))return;let _=u._controlledReadableStream;if(Jr(_)&&Tt(_)>0)Is(_,f,!1);else{let P;try{P=u._strategySizeAlgorithm(f)}catch(N){throw Gr(u,N),N}try{ue(u,f,P)}catch(N){throw Gr(u,N),N}}Un(u)}function Gr(u,f){let _=u._controlledReadableStream;_._state==="readable"&&(Fr(u),Ys(u),Ml(_,f))}function Ua(u){let f=u._controlledReadableStream._state;return f==="errored"?null:f==="closed"?0:u._strategyHWM-u._queueTotalSize}function Ec(u){return!wl(u)}function Xi(u){let f=u._controlledReadableStream._state;return!u._closeRequested&&f==="readable"}function _l(u,f,_,P,N,j,q){f._controlledReadableStream=u,f._queue=void 0,f._queueTotalSize=void 0,Fr(f),f._started=!1,f._closeRequested=!1,f._pullAgain=!1,f._pulling=!1,f._strategySizeAlgorithm=q,f._strategyHWM=j,f._pullAlgorithm=P,f._cancelAlgorithm=N,u._readableStreamController=f;let te=_();E(R(te),()=>{f._started=!0,Un(f)},ce=>{Gr(f,ce)})}function Rc(u,f,_,P){let N=Object.create(Yi.prototype),j=()=>{},q=()=>R(void 0),te=()=>R(void 0);f.start!==void 0&&(j=()=>f.start(N)),f.pull!==void 0&&(q=()=>f.pull(N)),f.cancel!==void 0&&(te=ce=>f.cancel(ce)),_l(u,N,j,q,te,_,P)}function Qs(u){return new TypeError(`ReadableStreamDefaultController.prototype.${u} can only be used on a ReadableStreamDefaultController`)}function Cc(u,f){return gi(u._readableStreamController)?gt(u):Ac(u)}function Ac(u,f){let _=ji(u),P=!1,N=!1,j=!1,q=!1,te,ce,ve,Ie,Pe,et=M(yt=>{Pe=yt});function rr(){return P?(N=!0,R(void 0)):(P=!0,Ir(_,{_chunkSteps:_t=>{B(()=>{N=!1;let $t=_t,Lr=_t;j||Xs(ve._readableStreamController,$t),q||Xs(Ie._readableStreamController,Lr),P=!1,N&&rr()})},_closeSteps:()=>{P=!1,j||jn(ve._readableStreamController),q||jn(Ie._readableStreamController),(!j||!q)&&Pe(void 0)},_errorSteps:()=>{P=!1}}),R(void 0))}function tn(yt){if(j=!0,te=yt,q){let _t=Pn([te,ce]),$t=tr(u,_t);Pe($t)}return et}function Yr(yt){if(q=!0,ce=yt,j){let _t=Pn([te,ce]),$t=tr(u,_t);Pe($t)}return et}function kr(){}return ve=dr(kr,rr,tn),Ie=dr(kr,rr,Yr),C(_._closedPromise,yt=>{Gr(ve._readableStreamController,yt),Gr(Ie._readableStreamController,yt),(!j||!q)&&Pe(void 0)}),[ve,Ie]}function gt(u){let f=ji(u),_=!1,P=!1,N=!1,j=!1,q=!1,te,ce,ve,Ie,Pe,et=M(ne=>{Pe=ne});function rr(ne){C(ne._closedPromise,pe=>{ne===f&&(Ut(ve._readableStreamController,pe),Ut(Ie._readableStreamController,pe),(!j||!q)&&Pe(void 0))})}function tn(){jt(f)&&(Te(f),f=ji(u),rr(f)),Ir(f,{_chunkSteps:pe=>{B(()=>{P=!1,N=!1;let je=pe,Pt=pe;if(!j&&!q)try{Pt=Z1(pe)}catch(rn){Ut(ve._readableStreamController,rn),Ut(Ie._readableStreamController,rn),Pe(tr(u,rn));return}j||Bs(ve._readableStreamController,je),q||Bs(Ie._readableStreamController,Pt),_=!1,P?kr():N&&yt()})},_closeSteps:()=>{_=!1,j||Wr(ve._readableStreamController),q||Wr(Ie._readableStreamController),ve._readableStreamController._pendingPullIntos.length>0&&Ln(ve._readableStreamController,0),Ie._readableStreamController._pendingPullIntos.length>0&&Ln(Ie._readableStreamController,0),(!j||!q)&&Pe(void 0)},_errorSteps:()=>{_=!1}})}function Yr(ne,pe){ot(f)&&(Te(f),f=Ds(u),rr(f));let je=pe?Ie:ve,Pt=pe?ve:Ie;mt(f,ne,{_chunkSteps:nn=>{B(()=>{P=!1,N=!1;let sn=pe?q:j;if(pe?j:q)sn||Nn(je._readableStreamController,nn);else{let Dl;try{Dl=Z1(nn)}catch($a){Ut(je._readableStreamController,$a),Ut(Pt._readableStreamController,$a),Pe(tr(u,$a));return}sn||Nn(je._readableStreamController,nn),Bs(Pt._readableStreamController,Dl)}_=!1,P?kr():N&&yt()})},_closeSteps:nn=>{_=!1;let sn=pe?q:j,lo=pe?j:q;sn||Wr(je._readableStreamController),lo||Wr(Pt._readableStreamController),nn!==void 0&&(sn||Nn(je._readableStreamController,nn),!lo&&Pt._readableStreamController._pendingPullIntos.length>0&&Ln(Pt._readableStreamController,0)),(!sn||!lo)&&Pe(void 0)},_errorSteps:()=>{_=!1}})}function kr(){if(_)return P=!0,R(void 0);_=!0;let ne=Ea(ve._readableStreamController);return ne===null?tn():Yr(ne._view,!1),R(void 0)}function yt(){if(_)return N=!0,R(void 0);_=!0;let ne=Ea(Ie._readableStreamController);return ne===null?tn():Yr(ne._view,!0),R(void 0)}function _t(ne){if(j=!0,te=ne,q){let pe=Pn([te,ce]),je=tr(u,pe);Pe(je)}return et}function $t(ne){if(q=!0,ce=ne,j){let pe=Pn([te,ce]),je=tr(u,pe);Pe(je)}return et}function Lr(){}return ve=Sl(Lr,kr,_t),Ie=Sl(Lr,yt,$t),rr(f),[ve,Ie]}function $n(u,f){at(u,f);let _=u,P=_?.autoAllocateChunkSize,N=_?.cancel,j=_?.pull,q=_?.start,te=_?.type;return{autoAllocateChunkSize:P===void 0?void 0:q1(P,`${f} has member 'autoAllocateChunkSize' that`),cancel:N===void 0?void 0:qn(N,_,`${f} has member 'cancel' that`),pull:j===void 0?void 0:Fn(j,_,`${f} has member 'pull' that`),start:q===void 0?void 0:Wn(q,_,`${f} has member 'start' that`),type:te===void 0?void 0:Qi(te,`${f} has member 'type' that`)}}function qn(u,f,_){return Qt(u,_),P=>H(u,f,[P])}function Fn(u,f,_){return Qt(u,_),P=>H(u,f,[P])}function Wn(u,f,_){return Qt(u,_),P=>z(u,f,[P])}function Qi(u,f){if(u=`${u}`,u!=="bytes")throw new TypeError(`${f} '${u}' is not a valid enumeration value for ReadableStreamType`);return u}function en(u,f){at(u,f);let _=u?.mode;return{mode:_===void 0?void 0:eo(_,`${f} has member 'mode' that`)}}function eo(u,f){if(u=`${u}`,u!=="byob")throw new TypeError(`${f} '${u}' is not a valid enumeration value for ReadableStreamReaderMode`);return u}function Tc(u,f){at(u,f);let _=u?.preventCancel;return{preventCancel:Boolean(_)}}function xl(u,f){at(u,f);let _=u?.preventAbort,P=u?.preventCancel,N=u?.preventClose,j=u?.signal;return j!==void 0&&Ic(j,`${f} has member 'signal' that`),{preventAbort:Boolean(_),preventCancel:Boolean(P),preventClose:Boolean(N),signal:j}}function Ic(u,f){if(!ec(u))throw new TypeError(`${f} is not an AbortSignal.`)}function Pc(u,f){at(u,f);let _=u?.readable;pa(_,"readable","ReadableWritablePair"),ya(_,`${f} has member 'readable' that`);let P=u?.writable;return pa(P,"writable","ReadableWritablePair"),js(P,`${f} has member 'writable' that`),{readable:_,writable:P}}class Vr{constructor(f={},_={}){f===void 0?f=null:ft(f,"First parameter");let P=Us(_,"Second parameter"),N=$n(f,"First parameter");if(ja(this),N.type==="bytes"){if(P.size!==void 0)throw new RangeError("The strategy for a byte stream cannot have a size function");let j=Pr(P,0);rl(this,N,j)}else{let j=Hr(P),q=Pr(P,1);Rc(this,N,q,j)}}get locked(){if(!Kr(this))throw Si("locked");return Jr(this)}cancel(f=void 0){return Kr(this)?Jr(this)?x(new TypeError("Cannot cancel a stream that already has a reader")):tr(this,f):x(Si("cancel"))}getReader(f=void 0){if(!Kr(this))throw Si("getReader");return en(f,"First parameter").mode===void 0?ji(this):Ds(this)}pipeThrough(f,_={}){if(!Kr(this))throw Si("pipeThrough");Tr(f,1,"pipeThrough");let P=Pc(f,"First parameter"),N=xl(_,"Second parameter");if(Jr(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(Vi(P.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");let j=xi(this,P.writable,N.preventClose,N.preventAbort,N.preventCancel,N.signal);return k(j),P.readable}pipeTo(f,_={}){if(!Kr(this))return x(Si("pipeTo"));if(f===void 0)return x("Parameter 1 is required in 'pipeTo'.");if(!Gi(f))return x(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let P;try{P=xl(_,"Second parameter")}catch(N){return x(N)}return Jr(this)?x(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):Vi(f)?x(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):xi(this,f,P.preventClose,P.preventAbort,P.preventCancel,P.signal)}tee(){if(!Kr(this))throw Si("tee");let f=Cc(this);return Pn(f)}values(f=void 0){if(!Kr(this))throw Si("values");let _=Tc(f,"First parameter");return Hh(this,_.preventCancel)}}Object.defineProperties(Vr.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Vr.prototype,e.toStringTag,{value:"ReadableStream",configurable:!0}),typeof e.asyncIterator=="symbol"&&Object.defineProperty(Vr.prototype,e.asyncIterator,{value:Vr.prototype.values,writable:!0,configurable:!0});function dr(u,f,_,P=1,N=()=>1){let j=Object.create(Vr.prototype);ja(j);let q=Object.create(Yi.prototype);return _l(j,q,u,f,_,P,N),j}function Sl(u,f,_){let P=Object.create(Vr.prototype);ja(P);let N=Object.create(Ke.prototype);return tl(P,N,u,f,_,0,void 0),P}function ja(u){u._state="readable",u._reader=void 0,u._storedError=void 0,u._disturbed=!1}function Kr(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_readableStreamController")?!1:u instanceof Vr}function Jr(u){return u._reader!==void 0}function tr(u,f){if(u._disturbed=!0,u._state==="closed")return R(void 0);if(u._state==="errored")return x(u._storedError);Hn(u);let _=u._reader;_!==void 0&&jt(_)&&(_._readIntoRequests.forEach(N=>{N._closeSteps(void 0)}),_._readIntoRequests=new se);let P=u._readableStreamController[ma](f);return I(P,r)}function Hn(u){u._state="closed";let f=u._reader;f!==void 0&&(In(f),ot(f)&&(f._readRequests.forEach(_=>{_._closeSteps()}),f._readRequests=new se))}function Ml(u,f){u._state="errored",u._storedError=f;let _=u._reader;_!==void 0&&(fa(_,f),ot(_)?(_._readRequests.forEach(P=>{P._errorSteps(f)}),_._readRequests=new se):(_._readIntoRequests.forEach(P=>{P._errorSteps(f)}),_._readIntoRequests=new se))}function Si(u){return new TypeError(`ReadableStream.prototype.${u} can only be used on a ReadableStream`)}function El(u,f){at(u,f);let _=u?.highWaterMark;return pa(_,"highWaterMark","QueuingStrategyInit"),{highWaterMark:ga(_)}}let Rl=u=>u.byteLength;Object.defineProperty(Rl,"name",{value:"size",configurable:!0});class to{constructor(f){Tr(f,1,"ByteLengthQueuingStrategy"),f=El(f,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=f.highWaterMark}get highWaterMark(){if(!Al(this))throw Cl("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!Al(this))throw Cl("size");return Rl}}Object.defineProperties(to.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(to.prototype,e.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});function Cl(u){return new TypeError(`ByteLengthQueuingStrategy.prototype.${u} can only be used on a ByteLengthQueuingStrategy`)}function Al(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_byteLengthQueuingStrategyHighWaterMark")?!1:u instanceof to}let Tl=()=>1;Object.defineProperty(Tl,"name",{value:"size",configurable:!0});class ro{constructor(f){Tr(f,1,"CountQueuingStrategy"),f=El(f,"First parameter"),this._countQueuingStrategyHighWaterMark=f.highWaterMark}get highWaterMark(){if(!Pl(this))throw Il("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!Pl(this))throw Il("size");return Tl}}Object.defineProperties(ro.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(ro.prototype,e.toStringTag,{value:"CountQueuingStrategy",configurable:!0});function Il(u){return new TypeError(`CountQueuingStrategy.prototype.${u} can only be used on a CountQueuingStrategy`)}function Pl(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_countQueuingStrategyHighWaterMark")?!1:u instanceof ro}function Zr(u,f){at(u,f);let _=u?.flush,P=u?.readableType,N=u?.start,j=u?.transform,q=u?.writableType;return{flush:_===void 0?void 0:Oc(_,u,`${f} has member 'flush' that`),readableType:P,start:N===void 0?void 0:kc(N,u,`${f} has member 'start' that`),transform:j===void 0?void 0:Lc(j,u,`${f} has member 'transform' that`),writableType:q}}function Oc(u,f,_){return Qt(u,_),P=>H(u,f,[P])}function kc(u,f,_){return Qt(u,_),P=>z(u,f,[P])}function Lc(u,f,_){return Qt(u,_),(P,N)=>H(u,f,[P,N])}class io{constructor(f={},_={},P={}){f===void 0&&(f=null);let N=Us(_,"Second parameter"),j=Us(P,"Third parameter"),q=Zr(f,"First parameter");if(q.readableType!==void 0)throw new RangeError("Invalid readableType specified");if(q.writableType!==void 0)throw new RangeError("Invalid writableType specified");let te=Pr(j,0),ce=Hr(j),ve=Pr(N,1),Ie=Hr(N),Pe,et=M(rr=>{Pe=rr});Nc(this,et,ve,Ie,te,ce),Dc(this,q),q.start!==void 0?Pe(q.start(this._transformStreamController)):Pe(void 0)}get readable(){if(!Ol(this))throw Bl("readable");return this._readable}get writable(){if(!Ol(this))throw Bl("writable");return this._writable}}Object.defineProperties(io.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(io.prototype,e.toStringTag,{value:"TransformStream",configurable:!0});function Nc(u,f,_,P,N,j){function q(){return f}function te(et){return jc(u,et)}function ce(et){return $c(u,et)}function ve(){return qc(u)}u._writable=al(q,te,ve,ce,_,P);function Ie(){return Fc(u)}function Pe(et){return so(u,et),R(void 0)}u._readable=dr(q,Ie,Pe,N,j),u._backpressure=void 0,u._backpressureChangePromise=void 0,u._backpressureChangePromise_resolve=void 0,oo(u,!0),u._transformStreamController=void 0}function Ol(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_transformStreamController")?!1:u instanceof io}function no(u,f){Gr(u._readable._readableStreamController,f),so(u,f)}function so(u,f){kl(u._transformStreamController),La(u._writable._writableStreamController,f),u._backpressure&&oo(u,!1)}function oo(u,f){u._backpressureChangePromise!==void 0&&u._backpressureChangePromise_resolve(),u._backpressureChangePromise=M(_=>{u._backpressureChangePromise_resolve=_}),u._backpressure=f}class Gn{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!ao(this))throw Vn("desiredSize");let f=this._controlledTransformStream._readable._readableStreamController;return Ua(f)}enqueue(f=void 0){if(!ao(this))throw Vn("enqueue");Ll(this,f)}error(f=void 0){if(!ao(this))throw Vn("error");zc(this,f)}terminate(){if(!ao(this))throw Vn("terminate");Uc(this)}}Object.defineProperties(Gn.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Gn.prototype,e.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});function ao(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_controlledTransformStream")?!1:u instanceof Gn}function Bc(u,f,_,P){f._controlledTransformStream=u,u._transformStreamController=f,f._transformAlgorithm=_,f._flushAlgorithm=P}function Dc(u,f){let _=Object.create(Gn.prototype),P=j=>{try{return Ll(_,j),R(void 0)}catch(q){return x(q)}},N=()=>R(void 0);f.transform!==void 0&&(P=j=>f.transform(j,_)),f.flush!==void 0&&(N=()=>f.flush(_)),Bc(u,_,P,N)}function kl(u){u._transformAlgorithm=void 0,u._flushAlgorithm=void 0}function Ll(u,f){let _=u._controlledTransformStream,P=_._readable._readableStreamController;if(!Xi(P))throw new TypeError("Readable side is not in a state that permits enqueue");try{Xs(P,f)}catch(j){throw so(_,j),_._readable._storedError}Ec(P)!==_._backpressure&&oo(_,!0)}function zc(u,f){no(u._controlledTransformStream,f)}function Nl(u,f){let _=u._transformAlgorithm(f);return I(_,void 0,P=>{throw no(u._controlledTransformStream,P),P})}function Uc(u){let f=u._controlledTransformStream,_=f._readable._readableStreamController;jn(_);let P=new TypeError("TransformStream terminated");so(f,P)}function jc(u,f){let _=u._transformStreamController;if(u._backpressure){let P=u._backpressureChangePromise;return I(P,()=>{let N=u._writable;if(N._state==="erroring")throw N._storedError;return Nl(_,f)})}return Nl(_,f)}function $c(u,f){return no(u,f),R(void 0)}function qc(u){let f=u._readable,_=u._transformStreamController,P=_._flushAlgorithm();return kl(_),I(P,()=>{if(f._state==="errored")throw f._storedError;jn(f._readableStreamController)},N=>{throw no(u,N),f._storedError})}function Fc(u){return oo(u,!1),u._backpressureChangePromise}function Vn(u){return new TypeError(`TransformStreamDefaultController.prototype.${u} can only be used on a TransformStreamDefaultController`)}function Bl(u){return new TypeError(`TransformStream.prototype.${u} can only be used on a TransformStream`)}t.ByteLengthQueuingStrategy=to,t.CountQueuingStrategy=ro,t.ReadableByteStreamController=Ke,t.ReadableStream=Vr,t.ReadableStreamBYOBReader=Wi,t.ReadableStreamBYOBRequest=On,t.ReadableStreamDefaultController=Yi,t.ReadableStreamDefaultReader=Z,t.TransformStream=io,t.TransformStreamDefaultController=Gn,t.WritableStream=Hi,t.WritableStreamDefaultController=Ji,t.WritableStreamDefaultWriter=Ki,Object.defineProperty(t,"__esModule",{value:!0})})});var v2=V(()=>{if(!globalThis.ReadableStream)try{let t=require("process"),{emitWarning:e}=t;try{t.emitWarning=()=>{},Object.assign(globalThis,require("stream/web")),t.emitWarning=e}catch(r){throw t.emitWarning=e,r}}catch{Object.assign(globalThis,b2())}try{let{Blob:t}=require("buffer");t&&!t.prototype.stream&&(t.prototype.stream=function(r){let i=0,n=this;return new ReadableStream({type:"bytes",async pull(o){let h=await n.slice(i,Math.min(n.size,i+65536)).arrayBuffer();i+=h.byteLength,o.enqueue(new Uint8Array(h)),i===n.size&&o.close()}})})}catch{}});async function*Yc(t,e=!0){for(let r of t)if("stream"in r)yield*r.stream();else if(ArrayBuffer.isView(r))if(e){let i=r.byteOffset,n=r.byteOffset+r.byteLength;for(;i!==n;){let o=Math.min(n-i,w2),a=r.buffer.slice(i,i+o);i+=a.byteLength,yield new Uint8Array(a)}}else yield r;else{let i=0,n=r;for(;i!==n.size;){let a=await n.slice(i,Math.min(n.size,i+w2)).arrayBuffer();i+=a.byteLength,yield new Uint8Array(a)}}}var EE,w2,Ci,Za,vo,Xl,wo,_2,fy,Ai,Ya=Ha(()=>{EE=de(v2(),1);w2=65536;_2=(wo=class{constructor(e=[],r={}){bt(this,Ci,[]);bt(this,Za,"");bt(this,vo,0);bt(this,Xl,"transparent");if(typeof e!="object"||e===null)throw new TypeError("Failed to construct 'Blob': The provided value cannot be converted to a sequence.");if(typeof e[Symbol.iterator]!="function")throw new TypeError("Failed to construct 'Blob': The object must have a callable @@iterator property.");if(typeof r!="object"&&typeof r!="function")throw new TypeError("Failed to construct 'Blob': parameter 2 cannot convert to dictionary.");r===null&&(r={});let i=new TextEncoder;for(let o of e){let a;ArrayBuffer.isView(o)?a=new Uint8Array(o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)):o instanceof ArrayBuffer?a=new Uint8Array(o.slice(0)):o instanceof wo?a=o:a=i.encode(`${o}`),Ze(this,vo,Ee(this,vo)+(ArrayBuffer.isView(a)?a.byteLength:a.size)),Ee(this,Ci).push(a)}Ze(this,Xl,`${r.endings===void 0?"transparent":r.endings}`);let n=r.type===void 0?"":String(r.type);Ze(this,Za,/^[\x20-\x7E]*$/.test(n)?n:"")}get size(){return Ee(this,vo)}get type(){return Ee(this,Za)}async text(){let e=new TextDecoder,r="";for await(let i of Yc(Ee(this,Ci),!1))r+=e.decode(i,{stream:!0});return r+=e.decode(),r}async arrayBuffer(){let e=new Uint8Array(this.size),r=0;for await(let i of Yc(Ee(this,Ci),!1))e.set(i,r),r+=i.length;return e.buffer}stream(){let e=Yc(Ee(this,Ci),!0);return new globalThis.ReadableStream({type:"bytes",async pull(r){let i=await e.next();i.done?r.close():r.enqueue(i.value)},async cancel(){await e.return()}})}slice(e=0,r=this.size,i=""){let{size:n}=this,o=e<0?Math.max(n+e,0):Math.min(e,n),a=r<0?Math.max(n+r,0):Math.min(r,n),h=Math.max(a-o,0),d=Ee(this,Ci),m=[],p=0;for(let R of d){if(p>=h)break;let x=ArrayBuffer.isView(R)?R.byteLength:R.size;if(o&&x<=o)o-=x,a-=x;else{let w;ArrayBuffer.isView(R)?(w=R.subarray(o,Math.min(x,a)),p+=w.byteLength):(w=R.slice(o,Math.min(x,a)),p+=w.size),a-=x,m.push(w),o=0}}let M=new wo([],{type:String(i).toLowerCase()});return Ze(M,vo,h),Ze(M,Ci,m),M}get[Symbol.toStringTag](){return"Blob"}static[Symbol.hasInstance](e){return e&&typeof e=="object"&&typeof e.constructor=="function"&&(typeof e.stream=="function"||typeof e.arrayBuffer=="function")&&/^(Blob|File)$/.test(e[Symbol.toStringTag])}},Ci=new WeakMap,Za=new WeakMap,vo=new WeakMap,Xl=new WeakMap,wo);Object.defineProperties(_2.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}});fy=_2,Ai=fy});var Xa,Qa,x2,dy,my,_o,Xc=Ha(()=>{Ya();dy=(x2=class extends Ai{constructor(r,i,n={}){if(arguments.length<2)throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`);super(r,n);bt(this,Xa,0);bt(this,Qa,"");n===null&&(n={});let o=n.lastModified===void 0?Date.now():Number(n.lastModified);Number.isNaN(o)||Ze(this,Xa,o),Ze(this,Qa,String(i))}get name(){return Ee(this,Qa)}get lastModified(){return Ee(this,Xa)}get[Symbol.toStringTag](){return"File"}static[Symbol.hasInstance](r){return!!r&&r instanceof Ai&&/^(File)$/.test(r[Symbol.toStringTag])}},Xa=new WeakMap,Qa=new WeakMap,x2),my=dy,_o=my});function R2(t,e=Ai){var r=`${S2()}${S2()}`.replace(/\./g,"").slice(-28).padStart(32,"-"),i=[],n=`--${r}\r
2
2
  Content-Disposition: form-data; name="`;return t.forEach((o,a)=>typeof o=="string"?i.push(n+Qc(a)+`"\r
3
3
  \r
4
4
  ${o.replace(/\r(?!\n)|(?<!\r)\n/g,`\r
@@ -7,26 +7,26 @@ ${o.replace(/\r(?!\n)|(?<!\r)\n/g,`\r
7
7
  Content-Type: ${o.type||"application/octet-stream"}\r
8
8
  \r
9
9
  `,o,`\r
10
- `)),i.push(`--${r}--`),new e(i,{type:"multipart/form-data; boundary="+r})}var e1,fy,dy,x2,my,S2,Qc,Qn,mr,M2,es,Ql=Ha(()=>{Ya();Xc();({toStringTag:e1,iterator:fy,hasInstance:dy}=Symbol),x2=Math.random,my="append,set,get,getAll,delete,keys,values,entries,forEach,constructor".split(","),S2=(t,e,r)=>(t+="",/^(Blob|File)$/.test(e&&e[e1])?[(r=r!==void 0?r+"":e[e1]=="File"?e.name:"blob",t),e.name!==r||e[e1]=="blob"?new _o([e],r,e):e]:[t,e+""]),Qc=(t,e)=>(e?t:t.replace(/\r?\n|\r/g,`\r
11
- `)).replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),Qn=(t,e,r)=>{if(e.length<r)throw new TypeError(`Failed to execute '${t}' on 'FormData': ${r} arguments required, but only ${e.length} present.`)},es=(M2=class{constructor(...e){bt(this,mr,[]);if(e.length)throw new TypeError("Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.")}get[e1](){return"FormData"}[fy](){return this.entries()}static[dy](e){return e&&typeof e=="object"&&e[e1]==="FormData"&&!my.some(r=>typeof e[r]!="function")}append(...e){Qn("append",arguments,2),Ee(this,mr).push(S2(...e))}delete(e){Qn("delete",arguments,1),e+="",Ze(this,mr,Ee(this,mr).filter(([r])=>r!==e))}get(e){Qn("get",arguments,1),e+="";for(var r=Ee(this,mr),i=r.length,n=0;n<i;n++)if(r[n][0]===e)return r[n][1];return null}getAll(e,r){return Qn("getAll",arguments,1),r=[],e+="",Ee(this,mr).forEach(i=>i[0]===e&&r.push(i[1])),r}has(e){return Qn("has",arguments,1),e+="",Ee(this,mr).some(r=>r[0]===e)}forEach(e,r){Qn("forEach",arguments,1);for(var[i,n]of this)e.call(r,n,i,this)}set(...e){Qn("set",arguments,2);var r=[],i=!0;e=S2(...e),Ee(this,mr).forEach(n=>{n[0]===e[0]?i&&(i=!r.push(e)):r.push(n)}),i&&r.push(e),Ze(this,mr,r)}*entries(){yield*Ee(this,mr)}*keys(){for(var[e]of this)yield e}*values(){for(var[,e]of this)yield e}},mr=new WeakMap,M2)});var T2=V((UE,A2)=>{if(!globalThis.DOMException)try{let{MessageChannel:t}=require("worker_threads"),e=new t().port1,r=new ArrayBuffer;e.postMessage(r,[r,r])}catch(t){t.constructor.name==="DOMException"&&(globalThis.DOMException=t.constructor)}A2.exports=globalThis.DOMException});var r1,P2,py,ts,rs,tf,I2,rf=Ha(()=>{r1=require("fs"),P2=de(T2(),1);Xc();Ya();({stat:py}=r1.promises),tf=class{constructor(e){bt(this,ts,void 0);bt(this,rs,void 0);Ze(this,ts,e.path),Ze(this,rs,e.start),this.size=e.size,this.lastModified=e.lastModified}slice(e,r){return new tf({path:Ee(this,ts),lastModified:this.lastModified,size:r-e,start:Ee(this,rs)+e})}async*stream(){let{mtimeMs:e}=await py(Ee(this,ts));if(e>this.lastModified)throw new P2.default("The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.","NotReadableError");yield*(0,r1.createReadStream)(Ee(this,ts),{start:Ee(this,rs),end:Ee(this,rs)+this.size-1})}get[Symbol.toStringTag](){return"Blob"}},I2=tf;ts=new WeakMap,rs=new WeakMap});var k2={};Zd(k2,{toFormData:()=>xy});function _y(t){let e=t.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);if(!e)return;let r=e[2]||e[3]||"",i=r.slice(r.lastIndexOf("\\")+1);return i=i.replace(/%22/g,'"'),i=i.replace(/&#(\d{4});/g,(n,o)=>String.fromCharCode(o)),i}async function xy(t,e){if(!/multipart/i.test(e))throw new TypeError("Failed to fetch");let r=e.match(/boundary=(?:"([^"]+)"|([^;]+))/i);if(!r)throw new TypeError("no or bad content-type header, no multipart boundary");let i=new nf(r[1]||r[2]),n,o,a,h,d,m,p=[],M=new es,R=C=>{a+=T.decode(C,{stream:!0})},x=C=>{p.push(C)},w=()=>{let C=new _o(p,m,{type:d});M.append(h,C)},E=()=>{M.append(h,a)},T=new TextDecoder("utf-8");T.decode(),i.onPartBegin=function(){i.onPartData=R,i.onPartEnd=E,n="",o="",a="",h="",d="",m=null,p.length=0},i.onHeaderField=function(C){n+=T.decode(C,{stream:!0})},i.onHeaderValue=function(C){o+=T.decode(C,{stream:!0})},i.onHeaderEnd=function(){if(o+=T.decode(),n=n.toLowerCase(),n==="content-disposition"){let C=o.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);C&&(h=C[2]||C[3]||""),m=_y(o),m&&(i.onPartData=x,i.onPartEnd=w)}else n==="content-type"&&(d=o);o="",n=""};for await(let C of t)i.write(C);return i.end(),M}var ei,Ge,O2,un,tu,ru,gy,i1,yy,by,vy,wy,is,nf,L2=Ha(()=>{rf();Ql();ei=0,Ge={START_BOUNDARY:ei++,HEADER_FIELD_START:ei++,HEADER_FIELD:ei++,HEADER_VALUE_START:ei++,HEADER_VALUE:ei++,HEADER_VALUE_ALMOST_DONE:ei++,HEADERS_ALMOST_DONE:ei++,PART_DATA_START:ei++,PART_DATA:ei++,END:ei++},O2=1,un={PART_BOUNDARY:O2,LAST_BOUNDARY:O2*=2},tu=10,ru=13,gy=32,i1=45,yy=58,by=97,vy=122,wy=t=>t|32,is=()=>{},nf=class{constructor(e){this.index=0,this.flags=0,this.onHeaderEnd=is,this.onHeaderField=is,this.onHeadersEnd=is,this.onHeaderValue=is,this.onPartBegin=is,this.onPartData=is,this.onPartEnd=is,this.boundaryChars={},e=`\r
12
- --`+e;let r=new Uint8Array(e.length);for(let i=0;i<e.length;i++)r[i]=e.charCodeAt(i),this.boundaryChars[r[i]]=!0;this.boundary=r,this.lookbehind=new Uint8Array(this.boundary.length+8),this.state=Ge.START_BOUNDARY}write(e){let r=0,i=e.length,n=this.index,{lookbehind:o,boundary:a,boundaryChars:h,index:d,state:m,flags:p}=this,M=this.boundary.length,R=M-1,x=e.length,w,E,T=B=>{this[B+"Mark"]=r},C=B=>{delete this[B+"Mark"]},I=(B,z,H,J)=>{(z===void 0||z!==H)&&this[B](J&&J.subarray(z,H))},k=(B,z)=>{let H=B+"Mark";H in this&&(z?(I(B,this[H],r,e),delete this[H]):(I(B,this[H],e.length,e),this[H]=0))};for(r=0;r<i;r++)switch(w=e[r],m){case Ge.START_BOUNDARY:if(d===a.length-2){if(w===i1)p|=un.LAST_BOUNDARY;else if(w!==ru)return;d++;break}else if(d-1===a.length-2){if(p&un.LAST_BOUNDARY&&w===i1)m=Ge.END,p=0;else if(!(p&un.LAST_BOUNDARY)&&w===tu)d=0,I("onPartBegin"),m=Ge.HEADER_FIELD_START;else return;break}w!==a[d+2]&&(d=-2),w===a[d+2]&&d++;break;case Ge.HEADER_FIELD_START:m=Ge.HEADER_FIELD,T("onHeaderField"),d=0;case Ge.HEADER_FIELD:if(w===ru){C("onHeaderField"),m=Ge.HEADERS_ALMOST_DONE;break}if(d++,w===i1)break;if(w===yy){if(d===1)return;k("onHeaderField",!0),m=Ge.HEADER_VALUE_START;break}if(E=wy(w),E<by||E>vy)return;break;case Ge.HEADER_VALUE_START:if(w===gy)break;T("onHeaderValue"),m=Ge.HEADER_VALUE;case Ge.HEADER_VALUE:w===ru&&(k("onHeaderValue",!0),I("onHeaderEnd"),m=Ge.HEADER_VALUE_ALMOST_DONE);break;case Ge.HEADER_VALUE_ALMOST_DONE:if(w!==tu)return;m=Ge.HEADER_FIELD_START;break;case Ge.HEADERS_ALMOST_DONE:if(w!==tu)return;I("onHeadersEnd"),m=Ge.PART_DATA_START;break;case Ge.PART_DATA_START:m=Ge.PART_DATA,T("onPartData");case Ge.PART_DATA:if(n=d,d===0){for(r+=R;r<x&&!(e[r]in h);)r+=M;r-=R,w=e[r]}if(d<a.length)a[d]===w?(d===0&&k("onPartData",!0),d++):d=0;else if(d===a.length)d++,w===ru?p|=un.PART_BOUNDARY:w===i1?p|=un.LAST_BOUNDARY:d=0;else if(d-1===a.length)if(p&un.PART_BOUNDARY){if(d=0,w===tu){p&=~un.PART_BOUNDARY,I("onPartEnd"),I("onPartBegin"),m=Ge.HEADER_FIELD_START;break}}else p&un.LAST_BOUNDARY&&w===i1?(I("onPartEnd"),m=Ge.END,p=0):d=0;if(d>0)o[d-1]=w;else if(n>0){let B=new Uint8Array(o.buffer,o.byteOffset,o.byteLength);I("onPartData",0,n,B),n=0,T("onPartData"),r--}break;case Ge.END:break;default:throw new Error(`Unexpected state entered: ${m}`)}k("onHeaderField"),k("onHeaderValue"),k("onPartData"),this.index=d,this.state=m,this.flags=p}end(){if(this.state===Ge.HEADER_FIELD_START&&this.index===0||this.state===Ge.PART_DATA&&this.index===this.boundary.length)this.onPartEnd();else if(this.state!==Ge.END)throw new Error("MultipartParser.end(): stream ended unexpectedly")}}});var h5=V((IC,u5)=>{"use strict";var cf=t=>{if(!t)return;let e=t.cause;if(typeof e=="function"){let r=t.cause();return r instanceof Error?r:void 0}else return e instanceof Error?e:void 0},a5=(t,e)=>{if(!(t instanceof Error))return"";let r=t.stack||"";if(e.has(t))return r+`
10
+ `)),i.push(`--${r}--`),new e(i,{type:"multipart/form-data; boundary="+r})}var e1,py,gy,S2,yy,M2,Qc,Xn,mr,E2,Qn,Ql=Ha(()=>{Ya();Xc();({toStringTag:e1,iterator:py,hasInstance:gy}=Symbol),S2=Math.random,yy="append,set,get,getAll,delete,keys,values,entries,forEach,constructor".split(","),M2=(t,e,r)=>(t+="",/^(Blob|File)$/.test(e&&e[e1])?[(r=r!==void 0?r+"":e[e1]=="File"?e.name:"blob",t),e.name!==r||e[e1]=="blob"?new _o([e],r,e):e]:[t,e+""]),Qc=(t,e)=>(e?t:t.replace(/\r?\n|\r/g,`\r
11
+ `)).replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),Xn=(t,e,r)=>{if(e.length<r)throw new TypeError(`Failed to execute '${t}' on 'FormData': ${r} arguments required, but only ${e.length} present.`)},Qn=(E2=class{constructor(...e){bt(this,mr,[]);if(e.length)throw new TypeError("Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.")}get[e1](){return"FormData"}[py](){return this.entries()}static[gy](e){return e&&typeof e=="object"&&e[e1]==="FormData"&&!yy.some(r=>typeof e[r]!="function")}append(...e){Xn("append",arguments,2),Ee(this,mr).push(M2(...e))}delete(e){Xn("delete",arguments,1),e+="",Ze(this,mr,Ee(this,mr).filter(([r])=>r!==e))}get(e){Xn("get",arguments,1),e+="";for(var r=Ee(this,mr),i=r.length,n=0;n<i;n++)if(r[n][0]===e)return r[n][1];return null}getAll(e,r){return Xn("getAll",arguments,1),r=[],e+="",Ee(this,mr).forEach(i=>i[0]===e&&r.push(i[1])),r}has(e){return Xn("has",arguments,1),e+="",Ee(this,mr).some(r=>r[0]===e)}forEach(e,r){Xn("forEach",arguments,1);for(var[i,n]of this)e.call(r,n,i,this)}set(...e){Xn("set",arguments,2);var r=[],i=!0;e=M2(...e),Ee(this,mr).forEach(n=>{n[0]===e[0]?i&&(i=!r.push(e)):r.push(n)}),i&&r.push(e),Ze(this,mr,r)}*entries(){yield*Ee(this,mr)}*keys(){for(var[e]of this)yield e}*values(){for(var[,e]of this)yield e}},mr=new WeakMap,E2)});var I2=V((zE,T2)=>{if(!globalThis.DOMException)try{let{MessageChannel:t}=require("worker_threads"),e=new t().port1,r=new ArrayBuffer;e.postMessage(r,[r,r])}catch(t){t.constructor.name==="DOMException"&&(globalThis.DOMException=t.constructor)}T2.exports=globalThis.DOMException});var r1,O2,by,es,ts,tf,P2,rf=Ha(()=>{r1=require("fs"),O2=de(I2(),1);Xc();Ya();({stat:by}=r1.promises),tf=class{constructor(e){bt(this,es,void 0);bt(this,ts,void 0);Ze(this,es,e.path),Ze(this,ts,e.start),this.size=e.size,this.lastModified=e.lastModified}slice(e,r){return new tf({path:Ee(this,es),lastModified:this.lastModified,size:r-e,start:Ee(this,ts)+e})}async*stream(){let{mtimeMs:e}=await by(Ee(this,es));if(e>this.lastModified)throw new O2.default("The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.","NotReadableError");yield*(0,r1.createReadStream)(Ee(this,es),{start:Ee(this,ts),end:Ee(this,ts)+this.size-1})}get[Symbol.toStringTag](){return"Blob"}},P2=tf;es=new WeakMap,ts=new WeakMap});var L2={};Yd(L2,{toFormData:()=>Ey});function My(t){let e=t.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);if(!e)return;let r=e[2]||e[3]||"",i=r.slice(r.lastIndexOf("\\")+1);return i=i.replace(/%22/g,'"'),i=i.replace(/&#(\d{4});/g,(n,o)=>String.fromCharCode(o)),i}async function Ey(t,e){if(!/multipart/i.test(e))throw new TypeError("Failed to fetch");let r=e.match(/boundary=(?:"([^"]+)"|([^;]+))/i);if(!r)throw new TypeError("no or bad content-type header, no multipart boundary");let i=new nf(r[1]||r[2]),n,o,a,h,d,m,p=[],M=new Qn,R=C=>{a+=T.decode(C,{stream:!0})},x=C=>{p.push(C)},w=()=>{let C=new _o(p,m,{type:d});M.append(h,C)},E=()=>{M.append(h,a)},T=new TextDecoder("utf-8");T.decode(),i.onPartBegin=function(){i.onPartData=R,i.onPartEnd=E,n="",o="",a="",h="",d="",m=null,p.length=0},i.onHeaderField=function(C){n+=T.decode(C,{stream:!0})},i.onHeaderValue=function(C){o+=T.decode(C,{stream:!0})},i.onHeaderEnd=function(){if(o+=T.decode(),n=n.toLowerCase(),n==="content-disposition"){let C=o.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);C&&(h=C[2]||C[3]||""),m=My(o),m&&(i.onPartData=x,i.onPartEnd=w)}else n==="content-type"&&(d=o);o="",n=""};for await(let C of t)i.write(C);return i.end(),M}var ei,Ge,k2,un,tu,ru,vy,i1,wy,_y,xy,Sy,rs,nf,N2=Ha(()=>{rf();Ql();ei=0,Ge={START_BOUNDARY:ei++,HEADER_FIELD_START:ei++,HEADER_FIELD:ei++,HEADER_VALUE_START:ei++,HEADER_VALUE:ei++,HEADER_VALUE_ALMOST_DONE:ei++,HEADERS_ALMOST_DONE:ei++,PART_DATA_START:ei++,PART_DATA:ei++,END:ei++},k2=1,un={PART_BOUNDARY:k2,LAST_BOUNDARY:k2*=2},tu=10,ru=13,vy=32,i1=45,wy=58,_y=97,xy=122,Sy=t=>t|32,rs=()=>{},nf=class{constructor(e){this.index=0,this.flags=0,this.onHeaderEnd=rs,this.onHeaderField=rs,this.onHeadersEnd=rs,this.onHeaderValue=rs,this.onPartBegin=rs,this.onPartData=rs,this.onPartEnd=rs,this.boundaryChars={},e=`\r
12
+ --`+e;let r=new Uint8Array(e.length);for(let i=0;i<e.length;i++)r[i]=e.charCodeAt(i),this.boundaryChars[r[i]]=!0;this.boundary=r,this.lookbehind=new Uint8Array(this.boundary.length+8),this.state=Ge.START_BOUNDARY}write(e){let r=0,i=e.length,n=this.index,{lookbehind:o,boundary:a,boundaryChars:h,index:d,state:m,flags:p}=this,M=this.boundary.length,R=M-1,x=e.length,w,E,T=B=>{this[B+"Mark"]=r},C=B=>{delete this[B+"Mark"]},I=(B,z,H,J)=>{(z===void 0||z!==H)&&this[B](J&&J.subarray(z,H))},k=(B,z)=>{let H=B+"Mark";H in this&&(z?(I(B,this[H],r,e),delete this[H]):(I(B,this[H],e.length,e),this[H]=0))};for(r=0;r<i;r++)switch(w=e[r],m){case Ge.START_BOUNDARY:if(d===a.length-2){if(w===i1)p|=un.LAST_BOUNDARY;else if(w!==ru)return;d++;break}else if(d-1===a.length-2){if(p&un.LAST_BOUNDARY&&w===i1)m=Ge.END,p=0;else if(!(p&un.LAST_BOUNDARY)&&w===tu)d=0,I("onPartBegin"),m=Ge.HEADER_FIELD_START;else return;break}w!==a[d+2]&&(d=-2),w===a[d+2]&&d++;break;case Ge.HEADER_FIELD_START:m=Ge.HEADER_FIELD,T("onHeaderField"),d=0;case Ge.HEADER_FIELD:if(w===ru){C("onHeaderField"),m=Ge.HEADERS_ALMOST_DONE;break}if(d++,w===i1)break;if(w===wy){if(d===1)return;k("onHeaderField",!0),m=Ge.HEADER_VALUE_START;break}if(E=Sy(w),E<_y||E>xy)return;break;case Ge.HEADER_VALUE_START:if(w===vy)break;T("onHeaderValue"),m=Ge.HEADER_VALUE;case Ge.HEADER_VALUE:w===ru&&(k("onHeaderValue",!0),I("onHeaderEnd"),m=Ge.HEADER_VALUE_ALMOST_DONE);break;case Ge.HEADER_VALUE_ALMOST_DONE:if(w!==tu)return;m=Ge.HEADER_FIELD_START;break;case Ge.HEADERS_ALMOST_DONE:if(w!==tu)return;I("onHeadersEnd"),m=Ge.PART_DATA_START;break;case Ge.PART_DATA_START:m=Ge.PART_DATA,T("onPartData");case Ge.PART_DATA:if(n=d,d===0){for(r+=R;r<x&&!(e[r]in h);)r+=M;r-=R,w=e[r]}if(d<a.length)a[d]===w?(d===0&&k("onPartData",!0),d++):d=0;else if(d===a.length)d++,w===ru?p|=un.PART_BOUNDARY:w===i1?p|=un.LAST_BOUNDARY:d=0;else if(d-1===a.length)if(p&un.PART_BOUNDARY){if(d=0,w===tu){p&=~un.PART_BOUNDARY,I("onPartEnd"),I("onPartBegin"),m=Ge.HEADER_FIELD_START;break}}else p&un.LAST_BOUNDARY&&w===i1?(I("onPartEnd"),m=Ge.END,p=0):d=0;if(d>0)o[d-1]=w;else if(n>0){let B=new Uint8Array(o.buffer,o.byteOffset,o.byteLength);I("onPartData",0,n,B),n=0,T("onPartData"),r--}break;case Ge.END:break;default:throw new Error(`Unexpected state entered: ${m}`)}k("onHeaderField"),k("onHeaderValue"),k("onPartData"),this.index=d,this.state=m,this.flags=p}end(){if(this.state===Ge.HEADER_FIELD_START&&this.index===0||this.state===Ge.PART_DATA&&this.index===this.boundary.length)this.onPartEnd();else if(this.state!==Ge.END)throw new Error("MultipartParser.end(): stream ended unexpectedly")}}});var c5=V((TC,h5)=>{"use strict";var cf=t=>{if(!t)return;let e=t.cause;if(typeof e=="function"){let r=t.cause();return r instanceof Error?r:void 0}else return e instanceof Error?e:void 0},l5=(t,e)=>{if(!(t instanceof Error))return"";let r=t.stack||"";if(e.has(t))return r+`
13
13
  causes have become circular...`;let i=cf(t);return i?(e.add(t),r+`
14
- caused by: `+a5(i,e)):r},P8=t=>a5(t,new Set),l5=(t,e,r)=>{if(!(t instanceof Error))return"";let i=r?"":t.message||"";if(e.has(t))return i+": ...";let n=cf(t);if(n){e.add(t);let o=typeof t.cause=="function";return i+(o?"":": ")+l5(n,e,o)}else return i},O8=t=>l5(t,new Set);u5.exports={getErrorCause:cf,stackWithCauses:P8,messageWithCauses:O8}});var d5=V((PC,f5)=>{"use strict";f5.exports=mf;var{messageWithCauses:k8,stackWithCauses:L8}=h5(),{toString:N8}=Object.prototype,ff=Symbol("circular-ref-tag"),df=Symbol("pino-raw-err-ref"),c5=Object.create({},{type:{enumerable:!0,writable:!0,value:void 0},message:{enumerable:!0,writable:!0,value:void 0},stack:{enumerable:!0,writable:!0,value:void 0},aggregateErrors:{enumerable:!0,writable:!0,value:void 0},raw:{enumerable:!1,get:function(){return this[df]},set:function(t){this[df]=t}}});Object.defineProperty(c5,df,{writable:!0,value:{}});function mf(t){if(!(t instanceof Error))return t;t[ff]=void 0;let e=Object.create(c5);e.type=N8.call(t.constructor)==="[object Function]"?t.constructor.name:t.name,e.message=k8(t),e.stack=L8(t),global.AggregateError!==void 0&&t instanceof global.AggregateError&&Array.isArray(t.errors)&&(e.aggregateErrors=t.errors.map(r=>mf(r)));for(let r in t)if(e[r]===void 0){let i=t[r];i instanceof Error?r!=="cause"&&!Object.prototype.hasOwnProperty.call(i,ff)&&(e[r]=mf(i)):e[r]=i}return delete t[ff],e.raw=t,e}});var y5=V((OC,g5)=>{"use strict";g5.exports={mapHttpRequest:B8,reqSerializer:p5};var pf=Symbol("pino-raw-req-ref"),m5=Object.create({},{id:{enumerable:!0,writable:!0,value:""},method:{enumerable:!0,writable:!0,value:""},url:{enumerable:!0,writable:!0,value:""},query:{enumerable:!0,writable:!0,value:""},params:{enumerable:!0,writable:!0,value:""},headers:{enumerable:!0,writable:!0,value:{}},remoteAddress:{enumerable:!0,writable:!0,value:""},remotePort:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[pf]},set:function(t){this[pf]=t}}});Object.defineProperty(m5,pf,{writable:!0,value:{}});function p5(t){let e=t.info||t.socket,r=Object.create(m5);if(r.id=typeof t.id=="function"?t.id():t.id||(t.info?t.info.id:void 0),r.method=t.method,t.originalUrl)r.url=t.originalUrl;else{let i=t.path;r.url=typeof i=="string"?i:t.url?t.url.path||t.url:void 0}return t.query&&(r.query=t.query),t.params&&(r.params=t.params),r.headers=t.headers,r.remoteAddress=e&&e.remoteAddress,r.remotePort=e&&e.remotePort,r.raw=t.raw||t,r}function B8(t){return{req:p5(t)}}});var _5=V((kC,w5)=>{"use strict";w5.exports={mapHttpResponse:D8,resSerializer:v5};var gf=Symbol("pino-raw-res-ref"),b5=Object.create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[gf]},set:function(t){this[gf]=t}}});Object.defineProperty(b5,gf,{writable:!0,value:{}});function v5(t){let e=Object.create(b5);return e.statusCode=t.headersSent?t.statusCode:null,e.headers=t.getHeaders?t.getHeaders():t._headers,e.raw=t,e}function D8(t){return{res:v5(t)}}});var bf=V((LC,x5)=>{"use strict";var yf=d5(),pu=y5(),gu=_5();x5.exports={err:yf,mapHttpRequest:pu.mapHttpRequest,mapHttpResponse:gu.mapHttpResponse,req:pu.reqSerializer,res:gu.resSerializer,wrapErrorSerializer:function(e){return e===yf?e:function(i){return e(yf(i))}},wrapRequestSerializer:function(e){return e===pu.reqSerializer?e:function(i){return e(pu.reqSerializer(i))}},wrapResponseSerializer:function(e){return e===gu.resSerializer?e:function(i){return e(gu.resSerializer(i))}}}});var vf=V((NC,S5)=>{"use strict";function z8(t,e){return e}S5.exports=function(){let e=Error.prepareStackTrace;Error.prepareStackTrace=z8;let r=new Error().stack;if(Error.prepareStackTrace=e,!Array.isArray(r))return;let i=r.slice(2),n=[];for(let o of i)!o||n.push(o.getFileName());return n}});var E5=V((BC,M5)=>{"use strict";var{createContext:U8,runInContext:j8}=require("vm");M5.exports=$8;function $8(t={}){let{ERR_PATHS_MUST_BE_STRINGS:e=()=>"fast-redact - Paths must be (non-empty) strings",ERR_INVALID_PATH:r=i=>`fast-redact \u2013 Invalid path (${i})`}=t;return function({paths:n}){n.forEach(o=>{if(typeof o!="string")throw Error(e());try{if(/〇/.test(o))throw Error();let a=new Proxy({},{get:()=>a,set:()=>{throw Error()}}),h=(o[0]==="["?"":".")+o.replace(/^\*/,"\u3007").replace(/\.\*/g,".\u3007").replace(/\[\*\]/g,"[\u3007]");if(/\n|\r|;/.test(h)||/\/\*/.test(h))throw Error();j8(`
14
+ caused by: `+l5(i,e)):r},L8=t=>l5(t,new Set),u5=(t,e,r)=>{if(!(t instanceof Error))return"";let i=r?"":t.message||"";if(e.has(t))return i+": ...";let n=cf(t);if(n){e.add(t);let o=typeof t.cause=="function";return i+(o?"":": ")+u5(n,e,o)}else return i},N8=t=>u5(t,new Set);h5.exports={getErrorCause:cf,stackWithCauses:L8,messageWithCauses:N8}});var m5=V((IC,d5)=>{"use strict";d5.exports=mf;var{messageWithCauses:B8,stackWithCauses:D8}=c5(),{toString:z8}=Object.prototype,ff=Symbol("circular-ref-tag"),df=Symbol("pino-raw-err-ref"),f5=Object.create({},{type:{enumerable:!0,writable:!0,value:void 0},message:{enumerable:!0,writable:!0,value:void 0},stack:{enumerable:!0,writable:!0,value:void 0},aggregateErrors:{enumerable:!0,writable:!0,value:void 0},raw:{enumerable:!1,get:function(){return this[df]},set:function(t){this[df]=t}}});Object.defineProperty(f5,df,{writable:!0,value:{}});function mf(t){if(!(t instanceof Error))return t;t[ff]=void 0;let e=Object.create(f5);e.type=z8.call(t.constructor)==="[object Function]"?t.constructor.name:t.name,e.message=B8(t),e.stack=D8(t),global.AggregateError!==void 0&&t instanceof global.AggregateError&&Array.isArray(t.errors)&&(e.aggregateErrors=t.errors.map(r=>mf(r)));for(let r in t)if(e[r]===void 0){let i=t[r];i instanceof Error?r!=="cause"&&!Object.prototype.hasOwnProperty.call(i,ff)&&(e[r]=mf(i)):e[r]=i}return delete t[ff],e.raw=t,e}});var b5=V((PC,y5)=>{"use strict";y5.exports={mapHttpRequest:U8,reqSerializer:g5};var pf=Symbol("pino-raw-req-ref"),p5=Object.create({},{id:{enumerable:!0,writable:!0,value:""},method:{enumerable:!0,writable:!0,value:""},url:{enumerable:!0,writable:!0,value:""},query:{enumerable:!0,writable:!0,value:""},params:{enumerable:!0,writable:!0,value:""},headers:{enumerable:!0,writable:!0,value:{}},remoteAddress:{enumerable:!0,writable:!0,value:""},remotePort:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[pf]},set:function(t){this[pf]=t}}});Object.defineProperty(p5,pf,{writable:!0,value:{}});function g5(t){let e=t.info||t.socket,r=Object.create(p5);if(r.id=typeof t.id=="function"?t.id():t.id||(t.info?t.info.id:void 0),r.method=t.method,t.originalUrl)r.url=t.originalUrl;else{let i=t.path;r.url=typeof i=="string"?i:t.url?t.url.path||t.url:void 0}return t.query&&(r.query=t.query),t.params&&(r.params=t.params),r.headers=t.headers,r.remoteAddress=e&&e.remoteAddress,r.remotePort=e&&e.remotePort,r.raw=t.raw||t,r}function U8(t){return{req:g5(t)}}});var x5=V((OC,_5)=>{"use strict";_5.exports={mapHttpResponse:j8,resSerializer:w5};var gf=Symbol("pino-raw-res-ref"),v5=Object.create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[gf]},set:function(t){this[gf]=t}}});Object.defineProperty(v5,gf,{writable:!0,value:{}});function w5(t){let e=Object.create(v5);return e.statusCode=t.headersSent?t.statusCode:null,e.headers=t.getHeaders?t.getHeaders():t._headers,e.raw=t,e}function j8(t){return{res:w5(t)}}});var bf=V((kC,S5)=>{"use strict";var yf=m5(),pu=b5(),gu=x5();S5.exports={err:yf,mapHttpRequest:pu.mapHttpRequest,mapHttpResponse:gu.mapHttpResponse,req:pu.reqSerializer,res:gu.resSerializer,wrapErrorSerializer:function(e){return e===yf?e:function(i){return e(yf(i))}},wrapRequestSerializer:function(e){return e===pu.reqSerializer?e:function(i){return e(pu.reqSerializer(i))}},wrapResponseSerializer:function(e){return e===gu.resSerializer?e:function(i){return e(gu.resSerializer(i))}}}});var vf=V((LC,M5)=>{"use strict";function $8(t,e){return e}M5.exports=function(){let e=Error.prepareStackTrace;Error.prepareStackTrace=$8;let r=new Error().stack;if(Error.prepareStackTrace=e,!Array.isArray(r))return;let i=r.slice(2),n=[];for(let o of i)!o||n.push(o.getFileName());return n}});var R5=V((NC,E5)=>{"use strict";var{createContext:q8,runInContext:F8}=require("vm");E5.exports=W8;function W8(t={}){let{ERR_PATHS_MUST_BE_STRINGS:e=()=>"fast-redact - Paths must be (non-empty) strings",ERR_INVALID_PATH:r=i=>`fast-redact \u2013 Invalid path (${i})`}=t;return function({paths:n}){n.forEach(o=>{if(typeof o!="string")throw Error(e());try{if(/〇/.test(o))throw Error();let a=new Proxy({},{get:()=>a,set:()=>{throw Error()}}),h=(o[0]==="["?"":".")+o.replace(/^\*/,"\u3007").replace(/\.\*/g,".\u3007").replace(/\[\*\]/g,"[\u3007]");if(/\n|\r|;/.test(h)||/\/\*/.test(h))throw Error();F8(`
15
15
  (function () {
16
16
  'use strict'
17
17
  o${h}
18
18
  if ([o${h}].length !== 1) throw Error()
19
19
  })()
20
- `,U8({o:a,"\u3007":null}),{codeGeneration:{strings:!1,wasm:!1}})}catch{throw Error(r(o))}})}}});var yu=V((DC,R5)=>{"use strict";R5.exports=/[^.[\]]+|\[((?:.)*?)\]/g});var A5=V((zC,C5)=>{"use strict";var q8=yu();C5.exports=F8;function F8({paths:t}){let e=[];var r=0;let i=t.reduce(function(n,o,a){var h=o.match(q8).map(p=>p.replace(/'|"|`/g,""));let d=o[0]==="[";h=h.map(p=>p[0]==="["?p.substr(1,p.length-2):p);let m=h.indexOf("*");if(m>-1){let p=h.slice(0,m),M=p.join("."),R=h.slice(m+1,h.length),x=R.length>0;r++,e.push({before:p,beforeStr:M,after:R,nested:x})}else n[o]={path:h,val:void 0,precensored:!1,circle:"",escPath:JSON.stringify(o),leadingBracket:d};return n},{});return{wildcards:e,wcLen:r,secret:i}}});var I5=V((UC,T5)=>{"use strict";var W8=yu();T5.exports=H8;function H8({secret:t,serialize:e,wcLen:r,strict:i,isCensorFct:n,censorFctTakesPath:o},a){let h=Function("o",`
20
+ `,q8({o:a,"\u3007":null}),{codeGeneration:{strings:!1,wasm:!1}})}catch{throw Error(r(o))}})}}});var yu=V((BC,C5)=>{"use strict";C5.exports=/[^.[\]]+|\[((?:.)*?)\]/g});var T5=V((DC,A5)=>{"use strict";var H8=yu();A5.exports=G8;function G8({paths:t}){let e=[];var r=0;let i=t.reduce(function(n,o,a){var h=o.match(H8).map(p=>p.replace(/'|"|`/g,""));let d=o[0]==="[";h=h.map(p=>p[0]==="["?p.substr(1,p.length-2):p);let m=h.indexOf("*");if(m>-1){let p=h.slice(0,m),M=p.join("."),R=h.slice(m+1,h.length),x=R.length>0;r++,e.push({before:p,beforeStr:M,after:R,nested:x})}else n[o]={path:h,val:void 0,precensored:!1,circle:"",escPath:JSON.stringify(o),leadingBracket:d};return n},{});return{wildcards:e,wcLen:r,secret:i}}});var P5=V((zC,I5)=>{"use strict";var V8=yu();I5.exports=K8;function K8({secret:t,serialize:e,wcLen:r,strict:i,isCensorFct:n,censorFctTakesPath:o},a){let h=Function("o",`
21
21
  if (typeof o !== 'object' || o == null) {
22
- ${J8(i,e)}
22
+ ${X8(i,e)}
23
23
  }
24
24
  const { censor, secret } = this
25
- ${G8(t,n,o)}
25
+ ${J8(t,n,o)}
26
26
  this.compileRestore()
27
- ${V8(r>0,n,o)}
28
- ${K8(e)}
29
- `).bind(a);return e===!1&&(h.restore=d=>a.restore(d)),h}function G8(t,e,r){return Object.keys(t).map(i=>{let{escPath:n,leadingBracket:o,path:a}=t[i],h=o?1:0,d=o?"":".",m=[];for(var p;(p=W8.exec(i))!==null;){let[,w]=p,{index:E,input:T}=p;E>h&&m.push(T.substring(0,E-(w?0:1)))}var M=m.map(w=>`o${d}${w}`).join(" && ");M.length===0?M+=`o${d}${i} != null`:M+=` && o${d}${i} != null`;let R=`
27
+ ${Z8(r>0,n,o)}
28
+ ${Y8(e)}
29
+ `).bind(a);return e===!1&&(h.restore=d=>a.restore(d)),h}function J8(t,e,r){return Object.keys(t).map(i=>{let{escPath:n,leadingBracket:o,path:a}=t[i],h=o?1:0,d=o?"":".",m=[];for(var p;(p=V8.exec(i))!==null;){let[,w]=p,{index:E,input:T}=p;E>h&&m.push(T.substring(0,E-(w?0:1)))}var M=m.map(w=>`o${d}${w}`).join(" && ");M.length===0?M+=`o${d}${i} != null`:M+=` && o${d}${i} != null`;let R=`
30
30
  switch (true) {
31
31
  ${m.reverse().map(w=>`
32
32
  case o${d}${w} === censor:
@@ -47,7 +47,7 @@ caused by: `+a5(i,e)):r},P8=t=>a5(t,new Set),l5=(t,e,r)=>{if(!(t instanceof Erro
47
47
  }
48
48
  }
49
49
  `}).join(`
50
- `)}function V8(t,e,r){return t===!0?`
50
+ `)}function Z8(t,e,r){return t===!0?`
51
51
  {
52
52
  const { wildcards, wcLen, groupRedact, nestedRedact } = this
53
53
  for (var i = 0; i < wcLen; i++) {
@@ -58,16 +58,16 @@ caused by: `+a5(i,e)):r},P8=t=>a5(t,new Set),l5=(t,e,r)=>{if(!(t instanceof Erro
58
58
  } else secret[beforeStr] = groupRedact(o, before, censor, ${e}, ${r})
59
59
  }
60
60
  }
61
- `:""}function K8(t){return t===!1?"return o":`
61
+ `:""}function Y8(t){return t===!1?"return o":`
62
62
  var s = this.serialize(o)
63
63
  this.restore(o)
64
64
  return s
65
- `}function J8(t,e){return t===!0?"throw Error('fast-redact: primitives cannot be redacted')":e===!1?"return o":"return this.serialize(o)"}});var wf=V((jC,O5)=>{"use strict";O5.exports={groupRedact:Y8,groupRestore:Z8,nestedRedact:Q8,nestedRestore:X8};function Z8({keys:t,values:e,target:r}){if(r==null)return;let i=t.length;for(var n=0;n<i;n++){let o=t[n];r[o]=e[n]}}function Y8(t,e,r,i,n){let o=P5(t,e);if(o==null)return{keys:null,values:null,target:null,flat:!0};let a=Object.keys(o),h=a.length,d=e.length,m=n?[...e]:void 0,p=new Array(h);for(var M=0;M<h;M++){let R=a[M];p[M]=o[R],n?(m[d]=R,o[R]=r(o[R],m)):i?o[R]=r(o[R]):o[R]=r}return{keys:a,values:p,target:o,flat:!0}}function X8(t){let e=t.length;for(var r=0;r<e;r++){let{key:n,target:o,value:a}=t[r];if(bu(o,n)&&(o[n]=a),typeof o=="object"){let h=Object.keys(o);for(var i=0;i<h.length;i++){let d=h[i],m=o[d];bu(m,n)&&(m[n]=a)}}}}function Q8(t,e,r,i,n,o,a){let h=P5(e,r);if(h==null)return;let d=Object.keys(h),m=d.length;for(var p=0;p<m;p++){let M=d[p],{value:R,parent:x,exists:w}=e3(h,M,r,i,n,o,a);w===!0&&x!==null&&t.push({key:i[i.length-1],target:x,value:R})}return t}function bu(t,e){return t!=null?"hasOwn"in Object?Object.hasOwn(t,e):Object.prototype.hasOwnProperty.call(t,e):!1}function e3(t,e,r,i,n,o,a){let h=i.length,d=h-1,m=e;var p=-1,M,R,x,w=null,E=!0,T=null;if(x=M=t[e],typeof M!="object")return{value:null,parent:null,exists:E};for(;M!=null&&++p<h;){if(e=i[p],w=x,e!=="*"&&!T&&!(typeof M=="object"&&e in M)){E=!1;break}if(!(e==="*"&&(T=e,p!==d))){if(T){let I=Object.keys(M);for(var C=0;C<I.length;C++){let k=I[C],B=M[k],z=e==="*";(z||typeof B=="object"&&B!==null&&e in B)&&(z?x=B:x=B[e],R=p!==d?x:o?a?n(x,[...r,m,...i]):n(x):n,z?M[k]=R:B[e]=R===void 0&&n!==void 0||bu(B,e)&&R===x?B[e]:R)}T=null}else x=M[e],R=p!==d?x:o?a?n(x,[...r,m,...i]):n(x):n,M[e]=bu(M,e)&&R===x||R===void 0&&n!==void 0?M[e]:R,M=M[e];if(typeof M!="object")break}}return{value:x,parent:w,exists:E}}function P5(t,e){for(var r=-1,i=e.length,n=t;n!=null&&++r<i;)n=n[e[r]];return n}});var L5=V(($C,k5)=>{"use strict";var{groupRestore:t3,nestedRestore:r3}=wf();k5.exports=i3;function i3({secret:t,wcLen:e}){return function(){if(this.restore)return;let i=Object.keys(t),n=n3(t,i),o=e>0,a=o?{secret:t,groupRestore:t3,nestedRestore:r3}:{secret:t};this.restore=Function("o",s3(n,i,o)).bind(a)}}function n3(t,e){return e.map(r=>{let{circle:i,escPath:n,leadingBracket:o}=t[r],h=i?`o.${i} = secret[${n}].val`:`o${o?"":"."}${r} = secret[${n}].val`,d=`secret[${n}].val = undefined`;return`
65
+ `}function X8(t,e){return t===!0?"throw Error('fast-redact: primitives cannot be redacted')":e===!1?"return o":"return this.serialize(o)"}});var wf=V((UC,k5)=>{"use strict";k5.exports={groupRedact:e3,groupRestore:Q8,nestedRedact:r3,nestedRestore:t3};function Q8({keys:t,values:e,target:r}){if(r==null)return;let i=t.length;for(var n=0;n<i;n++){let o=t[n];r[o]=e[n]}}function e3(t,e,r,i,n){let o=O5(t,e);if(o==null)return{keys:null,values:null,target:null,flat:!0};let a=Object.keys(o),h=a.length,d=e.length,m=n?[...e]:void 0,p=new Array(h);for(var M=0;M<h;M++){let R=a[M];p[M]=o[R],n?(m[d]=R,o[R]=r(o[R],m)):i?o[R]=r(o[R]):o[R]=r}return{keys:a,values:p,target:o,flat:!0}}function t3(t){let e=t.length;for(var r=0;r<e;r++){let{key:n,target:o,value:a}=t[r];if(bu(o,n)&&(o[n]=a),typeof o=="object"){let h=Object.keys(o);for(var i=0;i<h.length;i++){let d=h[i],m=o[d];bu(m,n)&&(m[n]=a)}}}}function r3(t,e,r,i,n,o,a){let h=O5(e,r);if(h==null)return;let d=Object.keys(h),m=d.length;for(var p=0;p<m;p++){let M=d[p],{value:R,parent:x,exists:w}=i3(h,M,r,i,n,o,a);w===!0&&x!==null&&t.push({key:i[i.length-1],target:x,value:R})}return t}function bu(t,e){return t!=null?"hasOwn"in Object?Object.hasOwn(t,e):Object.prototype.hasOwnProperty.call(t,e):!1}function i3(t,e,r,i,n,o,a){let h=i.length,d=h-1,m=e;var p=-1,M,R,x,w=null,E=!0,T=null;if(x=M=t[e],typeof M!="object")return{value:null,parent:null,exists:E};for(;M!=null&&++p<h;){if(e=i[p],w=x,e!=="*"&&!T&&!(typeof M=="object"&&e in M)){E=!1;break}if(!(e==="*"&&(T=e,p!==d))){if(T){let I=Object.keys(M);for(var C=0;C<I.length;C++){let k=I[C],B=M[k],z=e==="*";(z||typeof B=="object"&&B!==null&&e in B)&&(z?x=B:x=B[e],R=p!==d?x:o?a?n(x,[...r,m,...i]):n(x):n,z?M[k]=R:B[e]=R===void 0&&n!==void 0||bu(B,e)&&R===x?B[e]:R)}T=null}else x=M[e],R=p!==d?x:o?a?n(x,[...r,m,...i]):n(x):n,M[e]=bu(M,e)&&R===x||R===void 0&&n!==void 0?M[e]:R,M=M[e];if(typeof M!="object")break}}return{value:x,parent:w,exists:E}}function O5(t,e){for(var r=-1,i=e.length,n=t;n!=null&&++r<i;)n=n[e[r]];return n}});var N5=V((jC,L5)=>{"use strict";var{groupRestore:n3,nestedRestore:s3}=wf();L5.exports=o3;function o3({secret:t,wcLen:e}){return function(){if(this.restore)return;let i=Object.keys(t),n=a3(t,i),o=e>0,a=o?{secret:t,groupRestore:n3,nestedRestore:s3}:{secret:t};this.restore=Function("o",l3(n,i,o)).bind(a)}}function a3(t,e){return e.map(r=>{let{circle:i,escPath:n,leadingBracket:o}=t[r],h=i?`o.${i} = secret[${n}].val`:`o${o?"":"."}${r} = secret[${n}].val`,d=`secret[${n}].val = undefined`;return`
66
66
  if (secret[${n}].val !== undefined) {
67
67
  try { ${h} } catch (e) {}
68
68
  ${d}
69
69
  }
70
- `}).join("")}function s3(t,e,r){return`
70
+ `}).join("")}function l3(t,e,r){return`
71
71
  const secret = this.secret
72
72
  ${r===!0?`
73
73
  const keys = Object.keys(secret)
@@ -82,39 +82,39 @@ caused by: `+a5(i,e)):r},P8=t=>a5(t,new Set),l5=(t,e,r)=>{if(!(t instanceof Erro
82
82
  `:""}
83
83
  ${t}
84
84
  return o
85
- `}});var B5=V((qC,N5)=>{"use strict";N5.exports=o3;function o3(t){let{secret:e,censor:r,compileRestore:i,serialize:n,groupRedact:o,nestedRedact:a,wildcards:h,wcLen:d}=t,m=[{secret:e,censor:r,compileRestore:i}];return n!==!1&&m.push({serialize:n}),d>0&&m.push({groupRedact:o,nestedRedact:a,wildcards:h,wcLen:d}),Object.assign(...m)}});var U5=V((FC,z5)=>{"use strict";var D5=E5(),a3=A5(),l3=I5(),u3=L5(),{groupRedact:h3,nestedRedact:c3}=wf(),f3=B5(),d3=yu(),m3=D5(),_f=t=>t;_f.restore=_f;var p3="[REDACTED]";xf.rx=d3;xf.validator=D5;z5.exports=xf;function xf(t={}){let e=Array.from(new Set(t.paths||[])),r="serialize"in t&&(t.serialize===!1||typeof t.serialize=="function")?t.serialize:JSON.stringify,i=t.remove;if(i===!0&&r!==JSON.stringify)throw Error("fast-redact \u2013 remove option may only be set when serializer is JSON.stringify");let n=i===!0?void 0:"censor"in t?t.censor:p3,o=typeof n=="function",a=o&&n.length>1;if(e.length===0)return r||_f;m3({paths:e,serialize:r,censor:n});let{wildcards:h,wcLen:d,secret:m}=a3({paths:e,censor:n}),p=u3({secret:m,wcLen:d}),M="strict"in t?t.strict:!0;return l3({secret:m,wcLen:d,serialize:r,strict:M,isCensorFct:o,censorFctTakesPath:a},f3({secret:m,censor:n,compileRestore:p,serialize:r,groupRedact:h3,nestedRedact:c3,wildcards:h,wcLen:d}))}});var Uo=V((WC,j5)=>{"use strict";var g3=Symbol("pino.setLevel"),y3=Symbol("pino.getLevel"),b3=Symbol("pino.levelVal"),v3=Symbol("pino.useLevelLabels"),w3=Symbol("pino.useOnlyCustomLevels"),_3=Symbol("pino.mixin"),x3=Symbol("pino.lsCache"),S3=Symbol("pino.chindings"),M3=Symbol("pino.asJson"),E3=Symbol("pino.write"),R3=Symbol("pino.redactFmt"),C3=Symbol("pino.time"),A3=Symbol("pino.timeSliceIndex"),T3=Symbol("pino.stream"),I3=Symbol("pino.stringify"),P3=Symbol("pino.stringifySafe"),O3=Symbol("pino.stringifiers"),k3=Symbol("pino.end"),L3=Symbol("pino.formatOpts"),N3=Symbol("pino.messageKey"),B3=Symbol("pino.nestedKey"),D3=Symbol("pino.nestedKeyStr"),z3=Symbol("pino.mixinMergeStrategy"),U3=Symbol("pino.wildcardFirst"),j3=Symbol.for("pino.serializers"),$3=Symbol.for("pino.formatters"),q3=Symbol.for("pino.hooks"),F3=Symbol.for("pino.metadata");j5.exports={setLevelSym:g3,getLevelSym:y3,levelValSym:b3,useLevelLabelsSym:v3,mixinSym:_3,lsCacheSym:x3,chindingsSym:S3,asJsonSym:M3,writeSym:E3,serializersSym:j3,redactFmtSym:R3,timeSym:C3,timeSliceIndexSym:A3,streamSym:T3,stringifySym:I3,stringifySafeSym:P3,stringifiersSym:O3,endSym:k3,formatOptsSym:L3,messageKeySym:N3,nestedKeySym:B3,wildcardFirstSym:U3,needsMetadataGsym:F3,useOnlyCustomLevelsSym:w3,formattersSym:$3,hooksSym:q3,nestedKeyStrSym:D3,mixinMergeStrategySym:z3}});var Ef=V((HC,W5)=>{"use strict";var Mf=U5(),{redactFmtSym:W3,wildcardFirstSym:vu}=Uo(),{rx:Sf,validator:H3}=Mf,$5=H3({ERR_PATHS_MUST_BE_STRINGS:()=>"pino \u2013 redacted paths must be strings",ERR_INVALID_PATH:t=>`pino \u2013 redact paths array contains an invalid path (${t})`}),q5="[Redacted]",F5=!1;function G3(t,e){let{paths:r,censor:i}=V3(t),n=r.reduce((h,d)=>{Sf.lastIndex=0;let m=Sf.exec(d),p=Sf.exec(d),M=m[1]!==void 0?m[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,"$1"):m[0];if(M==="*"&&(M=vu),p===null)return h[M]=null,h;if(h[M]===null)return h;let{index:R}=p,x=`${d.substr(R,d.length-1)}`;return h[M]=h[M]||[],M!==vu&&h[M].length===0&&h[M].push(...h[vu]||[]),M===vu&&Object.keys(h).forEach(function(w){h[w]&&h[w].push(x)}),h[M].push(x),h},{}),o={[W3]:Mf({paths:r,censor:i,serialize:e,strict:F5})},a=(...h)=>e(typeof i=="function"?i(...h):i);return[...Object.keys(n),...Object.getOwnPropertySymbols(n)].reduce((h,d)=>{if(n[d]===null)h[d]=m=>a(m,[d]);else{let m=typeof i=="function"?(p,M)=>i(p,[d,...M]):i;h[d]=Mf({paths:n[d],censor:m,serialize:e,strict:F5})}return h},o)}function V3(t){if(Array.isArray(t))return t={paths:t,censor:q5},$5(t),t;let{paths:e,censor:r=q5,remove:i}=t;if(Array.isArray(e)===!1)throw Error("pino \u2013 redact must contain an array of strings");return i===!0&&(r=void 0),$5({paths:e,censor:r}),{paths:e,censor:r}}W5.exports=G3});var G5=V((GC,H5)=>{"use strict";var K3=()=>"",J3=()=>`,"time":${Date.now()}`,Z3=()=>`,"time":${Math.round(Date.now()/1e3)}`,Y3=()=>`,"time":"${new Date(Date.now()).toISOString()}"`;H5.exports={nullTime:K3,epochTime:J3,unixTime:Z3,isoTime:Y3}});var K5=V((VC,V5)=>{"use strict";function X3(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}V5.exports=Q3;function Q3(t,e,r){var i=r&&r.stringify||X3,n=1;if(typeof t=="object"&&t!==null){var o=e.length+n;if(o===1)return t;var a=new Array(o);a[0]=i(t);for(var h=1;h<o;h++)a[h]=i(e[h]);return a.join(" ")}if(typeof t!="string")return t;var d=e.length;if(d===0)return t;for(var m="",p=1-n,M=-1,R=t&&t.length||0,x=0;x<R;){if(t.charCodeAt(x)===37&&x+1<R){switch(M=M>-1?M:0,t.charCodeAt(x+1)){case 100:case 102:if(p>=d||(M<x&&(m+=t.slice(M,x)),e[p]==null))break;m+=Number(e[p]),M=x=x+2;break;case 105:if(p>=d||(M<x&&(m+=t.slice(M,x)),e[p]==null))break;m+=Math.floor(Number(e[p])),M=x=x+2;break;case 79:case 111:case 106:if(p>=d||(M<x&&(m+=t.slice(M,x)),e[p]===void 0))break;var w=typeof e[p];if(w==="string"){m+="'"+e[p]+"'",M=x+2,x++;break}if(w==="function"){m+=e[p].name||"<anonymous>",M=x+2,x++;break}m+=i(e[p]),M=x+2,x++;break;case 115:if(p>=d)break;M<x&&(m+=t.slice(M,x)),m+=String(e[p]),M=x+2,x++;break;case 37:M<x&&(m+=t.slice(M,x)),m+="%",M=x+2,x++,p--;break}++p}++x}return M===-1?t:(M<R&&(m+=t.slice(M)),m)}});var Cf=V((KC,Rf)=>{"use strict";if(typeof SharedArrayBuffer<"u"&&typeof Atomics<"u"){let e=function(r){if((r>0&&r<1/0)===!1)throw typeof r!="number"&&typeof r!="bigint"?TypeError("sleep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");Atomics.wait(t,0,0,Number(r))},t=new Int32Array(new SharedArrayBuffer(4));Rf.exports=e}else{let t=function(e){if((e>0&&e<1/0)===!1)throw typeof e!="number"&&typeof e!="bigint"?TypeError("sleep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");let i=Date.now()+Number(e);for(;i>Date.now(););};Rf.exports=t}});var Q5=V((JC,X5)=>{"use strict";var Gt=require("fs"),e7=require("events"),t7=require("util").inherits,J5=require("path"),Z5=Cf(),Af=100,r7=16*1024;function Y5(t,e){e._opening=!0,e._writing=!0,e._asyncDrainScheduled=!1;function r(o,a){if(o){e._reopening=!1,e._writing=!1,e._opening=!1,e.sync?process.nextTick(()=>{e.listenerCount("error")>0&&e.emit("error",o)}):e.emit("error",o);return}e.fd=a,e.file=t,e._reopening=!1,e._opening=!1,e._writing=!1,e.sync?process.nextTick(()=>e.emit("ready")):e.emit("ready"),!e._reopening&&!e._writing&&e._len>e.minLength&&!e.destroyed&&jo(e)}let i=e.append?"a":"w",n=e.mode;if(e.sync)try{e.mkdir&&Gt.mkdirSync(J5.dirname(t),{recursive:!0});let o=Gt.openSync(t,i,n);r(null,o)}catch(o){throw r(o),o}else e.mkdir?Gt.mkdir(J5.dirname(t),{recursive:!0},o=>{if(o)return r(o);Gt.open(t,i,n,r)}):Gt.open(t,i,n,r)}function Vt(t){if(!(this instanceof Vt))return new Vt(t);let{fd:e,dest:r,minLength:i,maxLength:n,maxWrite:o,sync:a,append:h=!0,mode:d,mkdir:m,retryEAGAIN:p,fsync:M}=t||{};if(e=e||r,this._bufs=[],this._len=0,this.fd=-1,this._writing=!1,this._writingBuf="",this._ending=!1,this._reopening=!1,this._asyncDrainScheduled=!1,this._hwm=Math.max(i||0,16387),this.file=null,this.destroyed=!1,this.minLength=i||0,this.maxLength=n||0,this.maxWrite=o||r7,this.sync=a||!1,this._fsync=M||!1,this.append=h||!1,this.mode=d,this.retryEAGAIN=p||(()=>!0),this.mkdir=m||!1,typeof e=="number")this.fd=e,process.nextTick(()=>this.emit("ready"));else if(typeof e=="string")Y5(e,this);else throw new Error("SonicBoom supports only file descriptors and files");if(this.minLength>=this.maxWrite)throw new Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);this.release=(R,x)=>{if(R){if(R.code==="EAGAIN"&&this.retryEAGAIN(R,this._writingBuf.length,this._len-this._writingBuf.length))if(this.sync)try{Z5(Af),this.release(void 0,0)}catch(E){this.release(E)}else setTimeout(()=>{Gt.write(this.fd,this._writingBuf,"utf8",this.release)},Af);else this._writing=!1,this.emit("error",R);return}if(this.emit("write",x),this._len-=x,this._writingBuf=this._writingBuf.slice(x),this._writingBuf.length){if(!this.sync){Gt.write(this.fd,this._writingBuf,"utf8",this.release);return}try{do{let E=Gt.writeSync(this.fd,this._writingBuf,"utf8");this._len-=E,this._writingBuf=this._writingBuf.slice(E)}while(this._writingBuf)}catch(E){this.release(E);return}}this._fsync&&Gt.fsyncSync(this.fd);let w=this._len;this._reopening?(this._writing=!1,this._reopening=!1,this.reopen()):w>this.minLength?jo(this):this._ending?w>0?jo(this):(this._writing=!1,wu(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick(i7,this)):this.emit("drain"))},this.on("newListener",function(R){R==="drain"&&(this._asyncDrainScheduled=!1)})}function i7(t){t.listenerCount("drain")>0&&(t._asyncDrainScheduled=!1,t.emit("drain"))}t7(Vt,e7);Vt.prototype.write=function(t){if(this.destroyed)throw new Error("SonicBoom destroyed");let e=this._len+t.length,r=this._bufs;return this.maxLength&&e>this.maxLength?(this.emit("drop",t),this._len<this._hwm):(r.length===0||r[r.length-1].length+t.length>this.maxWrite?r.push(""+t):r[r.length-1]+=t,this._len=e,!this._writing&&this._len>=this.minLength&&jo(this),this._len<this._hwm)};Vt.prototype.flush=function(){if(this.destroyed)throw new Error("SonicBoom destroyed");this._writing||this.minLength<=0||(this._bufs.length===0&&this._bufs.push(""),jo(this))};Vt.prototype.reopen=function(t){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.reopen(t)});return}if(this._ending)return;if(!this.file)throw new Error("Unable to reopen a file descriptor, you must pass a file to SonicBoom");if(this._reopening=!0,this._writing)return;let e=this.fd;this.once("ready",()=>{e!==this.fd&&Gt.close(e,r=>{if(r)return this.emit("error",r)})}),Y5(t||this.file,this)};Vt.prototype.end=function(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.end()});return}this._ending||(this._ending=!0,!this._writing&&(this._len>0&&this.fd>=0?jo(this):wu(this)))};Vt.prototype.flushSync=function(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this.fd<0)throw new Error("sonic boom is not ready yet");for(!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift(this._writingBuf),this._writingBuf="");this._bufs.length;){let t=this._bufs[0];try{this._len-=Gt.writeSync(this.fd,t,"utf8"),this._bufs.shift()}catch(e){if(e.code!=="EAGAIN"||!this.retryEAGAIN(e,t.length,this._len-t.length))throw e;Z5(Af)}}};Vt.prototype.destroy=function(){this.destroyed||wu(this)};function jo(t){let e=t.release;if(t._writing=!0,t._writingBuf=t._writingBuf||t._bufs.shift()||"",t.sync)try{let r=Gt.writeSync(t.fd,t._writingBuf,"utf8");e(null,r)}catch(r){e(r)}else Gt.write(t.fd,t._writingBuf,"utf8",e)}function wu(t){if(t.fd===-1){t.once("ready",wu.bind(null,t));return}t.destroyed=!0,t._bufs=[],t.fd!==1&&t.fd!==2?Gt.close(t.fd,e):setImmediate(e);function e(r){if(r){t.emit("error",r);return}t._ending&&!t._writing&&t.emit("finish"),t.emit("close")}}Vt.SonicBoom=Vt;Vt.default=Vt;X5.exports=Vt});var Tf=V((ZC,s9)=>{"use strict";var dn={exit:[],beforeExit:[]},e9={exit:s7,beforeExit:o7},t9=new FinalizationRegistry(a7);function n7(t){dn[t].length>0||process.on(t,e9[t])}function r9(t){dn[t].length>0||process.removeListener(t,e9[t])}function s7(){i9("exit")}function o7(){i9("beforeExit")}function i9(t){for(let e of dn[t]){let r=e.deref(),i=e.fn;r!==void 0&&i(r,t)}}function a7(t){for(let e of["exit","beforeExit"]){let r=dn[e].indexOf(t);dn[e].splice(r,r+1),r9(e)}}function n9(t,e,r){if(e===void 0)throw new Error("the object can't be undefined");n7(t);let i=new WeakRef(e);i.fn=r,t9.register(e,i),dn[t].push(i)}function l7(t,e){n9("exit",t,e)}function u7(t,e){n9("beforeExit",t,e)}function h7(t){t9.unregister(t);for(let e of["exit","beforeExit"])dn[e]=dn[e].filter(r=>{let i=r.deref();return i&&i!==t}),r9(e)}s9.exports={register:l7,registerBeforeExit:u7,unregister:h7}});var a9=V((YC,o9)=>{"use strict";function c7(t,e,r,i,n){let o=Date.now()+i,a=Atomics.load(t,e);if(a===r){n(null,"ok");return}let h=a,d=m=>{Date.now()>o?n(null,"timed-out"):setTimeout(()=>{h=a,a=Atomics.load(t,e),a===h?d(m>=1e3?1e3:m*2):a===r?n(null,"ok"):n(null,"not-equal")},m)};d(1)}function f7(t,e,r,i,n){let o=Date.now()+i,a=Atomics.load(t,e);if(a!==r){n(null,"ok");return}let h=d=>{Date.now()>o?n(null,"timed-out"):setTimeout(()=>{a=Atomics.load(t,e),a!==r?n(null,"ok"):h(d>=1e3?1e3:d*2)},d)};h(1)}o9.exports={wait:c7,waitDiff:f7}});var u9=V((XC,l9)=>{"use strict";l9.exports={WRITE_INDEX:4,READ_INDEX:8}});var m9=V((eA,d9)=>{"use strict";var{EventEmitter:d7}=require("events"),{Worker:m7}=require("worker_threads"),{join:p7}=require("path"),{pathToFileURL:g7}=require("url"),{wait:y7}=a9(),{WRITE_INDEX:Kt,READ_INDEX:si}=u9(),b7=require("buffer"),v7=require("assert"),$=Symbol("kImpl"),w7=b7.constants.MAX_STRING_LENGTH,xu=class{constructor(e){this._value=e}deref(){return this._value}},_7=global.FinalizationRegistry||class{register(){}unregister(){}},x7=global.WeakRef||xu,h9=new _7(t=>{t.exited||t.terminate()});function S7(t,e){let{filename:r,workerData:i}=e,o=("__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{})["thread-stream-worker"]||p7(__dirname,"lib","worker.js"),a=new m7(o,{...e.workerOpts,workerData:{filename:r.indexOf("file://")===0?r:g7(r).href,dataBuf:t[$].dataBuf,stateBuf:t[$].stateBuf,workerData:i}});return a.stream=new xu(t),a.on("message",M7),a.on("exit",f9),h9.register(t,a),a}function c9(t){v7(!t[$].sync),t[$].needDrain&&(t[$].needDrain=!1,t.emit("drain"))}function _u(t){let e=Atomics.load(t[$].state,Kt),r=t[$].data.length-e;if(r>0){if(t[$].buf.length===0){t[$].flushing=!1,t[$].ending?Lf(t):t[$].needDrain&&process.nextTick(c9,t);return}let i=t[$].buf.slice(0,r),n=Buffer.byteLength(i);n<=r?(t[$].buf=t[$].buf.slice(r),Su(t,i,_u.bind(null,t))):t.flush(()=>{if(!t.destroyed){for(Atomics.store(t[$].state,si,0),Atomics.store(t[$].state,Kt,0);n>t[$].data.length;)r=r/2,i=t[$].buf.slice(0,r),n=Buffer.byteLength(i);t[$].buf=t[$].buf.slice(r),Su(t,i,_u.bind(null,t))}})}else if(r===0){if(e===0&&t[$].buf.length===0)return;t.flush(()=>{Atomics.store(t[$].state,si,0),Atomics.store(t[$].state,Kt,0),_u(t)})}else oi(t,new Error("overwritten"))}function M7(t){let e=this.stream.deref();if(e===void 0){this.exited=!0,this.terminate();return}switch(t.code){case"READY":this.stream=new x7(e),e.flush(()=>{e[$].ready=!0,e.emit("ready")});break;case"ERROR":oi(e,t.err);break;default:oi(e,new Error("this should not happen: "+t.code))}}function f9(t){let e=this.stream.deref();e!==void 0&&(h9.unregister(e),e.worker.exited=!0,e.worker.off("exit",f9),oi(e,t!==0?new Error("the worker thread exited"):null))}var Pf=class extends d7{constructor(e={}){if(super(),e.bufferSize<4)throw new Error("bufferSize must at least fit a 4-byte utf-8 char");this[$]={},this[$].stateBuf=new SharedArrayBuffer(128),this[$].state=new Int32Array(this[$].stateBuf),this[$].dataBuf=new SharedArrayBuffer(e.bufferSize||4*1024*1024),this[$].data=Buffer.from(this[$].dataBuf),this[$].sync=e.sync||!1,this[$].ending=!1,this[$].ended=!1,this[$].needDrain=!1,this[$].destroyed=!1,this[$].flushing=!1,this[$].ready=!1,this[$].finished=!1,this[$].errored=null,this[$].closed=!1,this[$].buf="",this.worker=S7(this,e)}write(e){if(this[$].destroyed)return Of(this,new Error("the worker has exited")),!1;if(this[$].ending)return Of(this,new Error("the worker is ending")),!1;if(this[$].flushing&&this[$].buf.length+e.length>=w7)try{If(this),this[$].flushing=!0}catch(r){return oi(this,r),!1}if(this[$].buf+=e,this[$].sync)try{return If(this),!0}catch(r){return oi(this,r),!1}return this[$].flushing||(this[$].flushing=!0,setImmediate(_u,this)),this[$].needDrain=this[$].data.length-this[$].buf.length-Atomics.load(this[$].state,Kt)<=0,!this[$].needDrain}end(){this[$].destroyed||(this[$].ending=!0,Lf(this))}flush(e){if(this[$].destroyed){typeof e=="function"&&process.nextTick(e,new Error("the worker has exited"));return}let r=Atomics.load(this[$].state,Kt);y7(this[$].state,si,r,1/0,(i,n)=>{if(i){oi(this,i),process.nextTick(e,i);return}if(n==="not-equal"){this.flush(e);return}process.nextTick(e)})}flushSync(){this[$].destroyed||(If(this),kf(this))}unref(){this.worker.unref()}ref(){this.worker.ref()}get ready(){return this[$].ready}get destroyed(){return this[$].destroyed}get closed(){return this[$].closed}get writable(){return!this[$].destroyed&&!this[$].ending}get writableEnded(){return this[$].ending}get writableFinished(){return this[$].finished}get writableNeedDrain(){return this[$].needDrain}get writableObjectMode(){return!1}get writableErrored(){return this[$].errored}};function Of(t,e){setImmediate(()=>{t.emit("error",e)})}function oi(t,e){t[$].destroyed||(t[$].destroyed=!0,e&&(t[$].errored=e,Of(t,e)),t.worker.exited?setImmediate(()=>{t[$].closed=!0,t.emit("close")}):t.worker.terminate().catch(()=>{}).then(()=>{t[$].closed=!0,t.emit("close")}))}function Su(t,e,r){let i=Atomics.load(t[$].state,Kt),n=Buffer.byteLength(e);return t[$].data.write(e,i),Atomics.store(t[$].state,Kt,i+n),Atomics.notify(t[$].state,Kt),r(),!0}function Lf(t){if(!(t[$].ended||!t[$].ending||t[$].flushing)){t[$].ended=!0;try{t.flushSync();let e=Atomics.load(t[$].state,si);Atomics.store(t[$].state,Kt,-1),Atomics.notify(t[$].state,Kt);let r=0;for(;e!==-1;){if(Atomics.wait(t[$].state,si,e,1e3),e=Atomics.load(t[$].state,si),e===-2){oi(t,new Error("end() failed"));return}if(++r===10){oi(t,new Error("end() took too long (10s)"));return}}process.nextTick(()=>{t[$].finished=!0,t.emit("finish")})}catch(e){oi(t,e)}}}function If(t){let e=()=>{t[$].ending?Lf(t):t[$].needDrain&&process.nextTick(c9,t)};for(t[$].flushing=!1;t[$].buf.length!==0;){let r=Atomics.load(t[$].state,Kt),i=t[$].data.length-r;if(i===0){kf(t),Atomics.store(t[$].state,si,0),Atomics.store(t[$].state,Kt,0);continue}else if(i<0)throw new Error("overwritten");let n=t[$].buf.slice(0,i),o=Buffer.byteLength(n);if(o<=i)t[$].buf=t[$].buf.slice(i),Su(t,n,e);else{for(kf(t),Atomics.store(t[$].state,si,0),Atomics.store(t[$].state,Kt,0);o>t[$].buf.length;)i=i/2,n=t[$].buf.slice(0,i),o=Buffer.byteLength(n);t[$].buf=t[$].buf.slice(i),Su(t,n,e)}}}function kf(t){if(t[$].flushing)throw new Error("unable to flush while flushing");let e=Atomics.load(t[$].state,Kt),r=0;for(;;){let i=Atomics.load(t[$].state,si);if(i===-2)throw Error("_flushSync failed");if(i!==e)Atomics.wait(t[$].state,si,i,1e3);else break;if(++r===10)throw new Error("_flushSync took too long (10s)")}}d9.exports=Pf});var Df=V((tA,p9)=>{"use strict";var{createRequire:E7}=require("module"),R7=vf(),{join:Nf,isAbsolute:C7}=require("path"),A7=Cf(),Bf=Tf(),T7=m9();function I7(t){Bf.register(t,O7),Bf.registerBeforeExit(t,k7),t.on("close",function(){Bf.unregister(t)})}function P7(t,e,r){let i=new T7({filename:t,workerData:e,workerOpts:r});i.on("ready",n),i.on("close",function(){process.removeListener("exit",o)}),process.on("exit",o);function n(){process.removeListener("exit",o),i.unref(),r.autoEnd!==!1&&I7(i)}function o(){i.closed||(i.flushSync(),A7(100),i.end())}return i}function O7(t){t.ref(),t.flushSync(),t.end(),t.once("close",function(){t.unref()})}function k7(t){t.flushSync()}function L7(t){let{pipeline:e,targets:r,levels:i,options:n={},worker:o={},caller:a=R7()}=t,h=typeof a=="string"?[a]:a,d="__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{},m=t.target;if(m&&r)throw new Error("only one of target or targets can be specified");return r?(m=d["pino-worker"]||Nf(__dirname,"worker.js"),n.targets=r.map(M=>({...M,target:p(M.target)}))):e&&(m=d["pino-pipeline-worker"]||Nf(__dirname,"worker-pipeline.js"),n.targets=e.map(M=>({...M,target:p(M.target)}))),i&&(n.levels=i),P7(p(m),n,o);function p(M){if(M=d[M]||M,C7(M)||M.indexOf("file://")===0)return M;if(M==="pino/file")return Nf(__dirname,"..","file.js");let R;for(let x of h)try{R=E7(x).resolve(M);break}catch{continue}if(!R)throw new Error(`unable to determine transport target for "${M}"`);return R}}p9.exports=L7});var Eu=V((rA,C9)=>{"use strict";var g9=K5(),{mapHttpRequest:N7,mapHttpResponse:B7}=bf(),zf=Q5(),y9=Tf(),{lsCacheSym:D7,chindingsSym:_9,writeSym:b9,serializersSym:x9,formatOptsSym:v9,endSym:z7,stringifiersSym:S9,stringifySym:M9,stringifySafeSym:Uf,wildcardFirstSym:E9,nestedKeySym:U7,formattersSym:R9,messageKeySym:j7,nestedKeyStrSym:$7}=Uo(),{isMainThread:q7}=require("worker_threads"),F7=Df();function h1(){}function W7(t,e){if(!e)return r;return function(...n){e.call(this,n,r,t)};function r(i,...n){if(typeof i=="object"){let o=i;i!==null&&(i.method&&i.headers&&i.socket?i=N7(i):typeof i.setHeader=="function"&&(i=B7(i)));let a;o===null&&n.length===0?a=[null]:(o=n.shift(),a=n),this[b9](i,g9(o,a,this[v9]),t)}else this[b9](null,g9(i,n,this[v9]),t)}}function w9(t){let e="",r=0,i=!1,n=255,o=t.length;if(o>100)return JSON.stringify(t);for(var a=0;a<o&&n>=32;a++)n=t.charCodeAt(a),(n===34||n===92)&&(e+=t.slice(r,a)+"\\",r=a,i=!0);return i?e+=t.slice(r):e=t,n<32?JSON.stringify(t):'"'+e+'"'}function H7(t,e,r,i){let n=this[M9],o=this[Uf],a=this[S9],h=this[z7],d=this[_9],m=this[x9],p=this[R9],M=this[j7],R=this[D7][r]+i;R=R+d;let x;p.log&&(t=p.log(t));let w=a[E9],E="";for(let C in t)if(x=t[C],Object.prototype.hasOwnProperty.call(t,C)&&x!==void 0){x=m[C]?m[C](x):x;let I=a[C]||w;switch(typeof x){case"undefined":case"function":continue;case"number":Number.isFinite(x)===!1&&(x=null);case"boolean":I&&(x=I(x));break;case"string":x=(I||w9)(x);break;default:x=(I||n)(x,o)}if(x===void 0)continue;E+=',"'+C+'":'+x}let T="";if(e!==void 0){x=m[M]?m[M](e):e;let C=a[M]||w;switch(typeof x){case"function":break;case"number":Number.isFinite(x)===!1&&(x=null);case"boolean":C&&(x=C(x)),T=',"'+M+'":'+x;break;case"string":x=(C||w9)(x),T=',"'+M+'":'+x;break;default:x=(C||n)(x,o),T=',"'+M+'":'+x}}return this[U7]&&E?R+this[$7]+E.slice(1)+"}"+T+h:R+E+T+h}function G7(t,e){let r,i=t[_9],n=t[M9],o=t[Uf],a=t[S9],h=a[E9],d=t[x9];e=t[R9].bindings(e);for(let p in e)if(r=e[p],(p!=="level"&&p!=="serializers"&&p!=="formatters"&&p!=="customLevels"&&e.hasOwnProperty(p)&&r!==void 0)===!0){if(r=d[p]?d[p](r):r,r=(a[p]||h||n)(r,o),r===void 0)continue;i+=',"'+p+'":'+r}return i}function V7(t){return t.write!==t.constructor.prototype.write}function Mu(t){let e=new zf(t);return e.on("error",r),!t.sync&&q7&&(y9.register(e,K7),e.on("close",function(){y9.unregister(e)})),e;function r(i){if(i.code==="EPIPE"){e.write=h1,e.end=h1,e.flushSync=h1,e.destroy=h1;return}e.removeListener("error",r),e.emit("error",i)}}function K7(t,e){t.destroyed||(e==="beforeExit"?(t.flush(),t.on("drain",function(){t.end()})):t.flushSync())}function J7(t){return function(r,i,n={},o){if(typeof n=="string")o=Mu({dest:n}),n={};else if(typeof o=="string"){if(n&&n.transport)throw Error("only one of option.transport or stream can be specified");o=Mu({dest:o})}else if(n instanceof zf||n.writable||n._writableState)o=n,n={};else if(n.transport){if(n.transport instanceof zf||n.transport.writable||n.transport._writableState)throw Error("option.transport do not allow stream, please pass to option directly. e.g. pino(transport)");if(n.transport.targets&&n.transport.targets.length&&n.formatters&&typeof n.formatters.level=="function")throw Error("option.transport.targets do not allow custom level formatters");let h;n.customLevels&&(h=n.useOnlyCustomLevels?n.customLevels:Object.assign({},n.levels,n.customLevels)),o=F7({caller:i,...n.transport,levels:h})}if(n=Object.assign({},t,n),n.serializers=Object.assign({},t.serializers,n.serializers),n.formatters=Object.assign({},t.formatters,n.formatters),n.prettyPrint)throw new Error("prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)");if("onTerminated"in n)throw Error("The onTerminated option has been removed, use pino.final instead");let{enabled:a}=n;return a===!1&&(n.level="silent"),o||(V7(process.stdout)?o=process.stdout:o=Mu({fd:process.stdout.fd})),{opts:n,stream:o}}}function Z7(t,e){try{return JSON.stringify(t)}catch{try{return(e||this[Uf])(t)}catch{return'"[unable to serialize, circular reference is too complex to analyze]"'}}}function Y7(t,e,r){return{level:t,bindings:e,log:r}}function X7(t){let e=Number(t);return typeof t=="string"&&Number.isFinite(e)?e:t}C9.exports={noop:h1,buildSafeSonicBoom:Mu,asChindings:G7,asJson:H7,genLog:W7,createArgsNormalizer:J7,stringify:Z7,buildFormatters:Y7,normalizeDestFileDescriptor:X7}});var Ru=V((iA,T9)=>{"use strict";var{lsCacheSym:Q7,levelValSym:jf,useOnlyCustomLevelsSym:eb,streamSym:tb,formattersSym:rb,hooksSym:ib}=Uo(),{noop:nb,genLog:ls}=Eu(),Dr={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},A9={fatal:t=>{let e=ls(Dr.fatal,t);return function(...r){let i=this[tb];if(e.call(this,...r),typeof i.flushSync=="function")try{i.flushSync()}catch{}}},error:t=>ls(Dr.error,t),warn:t=>ls(Dr.warn,t),info:t=>ls(Dr.info,t),debug:t=>ls(Dr.debug,t),trace:t=>ls(Dr.trace,t)},$f=Object.keys(Dr).reduce((t,e)=>(t[Dr[e]]=e,t),{}),sb=Object.keys($f).reduce((t,e)=>(t[e]='{"level":'+Number(e),t),{});function ob(t){let e=t[rb].level,{labels:r}=t.levels,i={};for(let n in r){let o=e(r[n],Number(n));i[n]=JSON.stringify(o).slice(0,-1)}return t[Q7]=i,t}function ab(t,e){if(e)return!1;switch(t){case"fatal":case"error":case"warn":case"info":case"debug":case"trace":return!0;default:return!1}}function lb(t){let{labels:e,values:r}=this.levels;if(typeof t=="number"){if(e[t]===void 0)throw Error("unknown level value"+t);t=e[t]}if(r[t]===void 0)throw Error("unknown level "+t);let i=this[jf],n=this[jf]=r[t],o=this[eb],a=this[ib].logMethod;for(let h in r){if(n>r[h]){this[h]=nb;continue}this[h]=ab(h,o)?A9[h](a):ls(r[h],a)}this.emit("level-change",t,n,e[i],i)}function ub(t){let{levels:e,levelVal:r}=this;return e&&e.labels?e.labels[r]:""}function hb(t){let{values:e}=this.levels,r=e[t];return r!==void 0&&r>=this[jf]}function cb(t=null,e=!1){let r=t?Object.keys(t).reduce((o,a)=>(o[t[a]]=a,o),{}):null,i=Object.assign(Object.create(Object.prototype,{Infinity:{value:"silent"}}),e?null:$f,r),n=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),e?null:Dr,t);return{labels:i,values:n}}function fb(t,e,r){if(typeof t=="number"){if(![].concat(Object.keys(e||{}).map(o=>e[o]),r?[]:Object.keys($f).map(o=>+o),1/0).includes(t))throw Error(`default level:${t} must be included in custom levels`);return}let i=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),r?null:Dr,e);if(!(t in i))throw Error(`default level:${t} must be included in custom levels`)}function db(t,e){let{labels:r,values:i}=t;for(let n in e){if(n in i)throw Error("levels cannot be overridden");if(e[n]in r)throw Error("pre-existing level values cannot be used for new levels")}}T9.exports={initialLsCache:sb,genLsCache:ob,levelMethods:A9,getLevel:ub,setLevel:lb,isLevelEnabled:hb,mappings:cb,levels:Dr,assertNoLevelCollisions:db,assertDefaultLevelFound:fb}});var qf=V((nA,I9)=>{"use strict";I9.exports={version:"8.3.0"}});var j9=V((oA,U9)=>{"use strict";var{EventEmitter:mb}=require("events"),{lsCacheSym:pb,levelValSym:gb,setLevelSym:Wf,getLevelSym:P9,chindingsSym:Hf,parsedChindingsSym:yb,mixinSym:bb,asJsonSym:N9,writeSym:vb,mixinMergeStrategySym:wb,timeSym:_b,timeSliceIndexSym:xb,streamSym:B9,serializersSym:us,formattersSym:Ff,useOnlyCustomLevelsSym:Sb,needsMetadataGsym:Mb,redactFmtSym:Eb,stringifySym:Rb,formatOptsSym:Cb,stringifiersSym:Ab}=Uo(),{getLevel:Tb,setLevel:Ib,isLevelEnabled:Pb,mappings:Ob,initialLsCache:kb,genLsCache:Lb,assertNoLevelCollisions:Nb}=Ru(),{asChindings:D9,asJson:Bb,buildFormatters:O9,stringify:k9}=Eu(),{version:Db}=qf(),zb=Ef(),Ub=class{},z9={constructor:Ub,child:jb,bindings:$b,setBindings:qb,flush:Gb,isLevelEnabled:Pb,version:Db,get level(){return this[P9]()},set level(t){this[Wf](t)},get levelVal(){return this[gb]},set levelVal(t){throw Error("levelVal is read-only")},[pb]:kb,[vb]:Wb,[N9]:Bb,[P9]:Tb,[Wf]:Ib};Object.setPrototypeOf(z9,mb.prototype);U9.exports=function(){return Object.create(z9)};var L9=t=>t;function jb(t,e){if(!t)throw Error("missing bindings for child Pino");e=e||{};let r=this[us],i=this[Ff],n=Object.create(this);if(e.hasOwnProperty("serializers")===!0){n[us]=Object.create(null);for(let p in r)n[us][p]=r[p];let d=Object.getOwnPropertySymbols(r);for(var o=0;o<d.length;o++){let p=d[o];n[us][p]=r[p]}for(let p in e.serializers)n[us][p]=e.serializers[p];let m=Object.getOwnPropertySymbols(e.serializers);for(var a=0;a<m.length;a++){let p=m[a];n[us][p]=e.serializers[p]}}else n[us]=r;if(e.hasOwnProperty("formatters")){let{level:d,bindings:m,log:p}=e.formatters;n[Ff]=O9(d||i.level,m||L9,p||i.log)}else n[Ff]=O9(i.level,L9,i.log);if(e.hasOwnProperty("customLevels")===!0&&(Nb(this.levels,e.customLevels),n.levels=Ob(e.customLevels,n[Sb]),Lb(n)),typeof e.redact=="object"&&e.redact!==null||Array.isArray(e.redact)){n.redact=e.redact;let d=zb(n.redact,k9),m={stringify:d[Eb]};n[Rb]=k9,n[Ab]=d,n[Cb]=m}n[Hf]=D9(n,t);let h=e.level||this.level;return n[Wf](h),n}function $b(){let e=`{${this[Hf].substr(1)}}`,r=JSON.parse(e);return delete r.pid,delete r.hostname,r}function qb(t){let e=D9(this,t);this[Hf]=e,delete this[yb]}function Fb(t,e){return Object.assign(e,t)}function Wb(t,e,r){let i=this[_b](),n=this[bb],o=this[wb]||Fb,a;t==null?a={}:t instanceof Error?(a={err:t},e===void 0&&(e=t.message)):(a=t,e===void 0&&t.err&&(e=t.err.message)),n&&(a=o(a,n(a,r)));let h=this[N9](a,e,r,i),d=this[B9];d[Mb]===!0&&(d.lastLevel=r,d.lastObj=a,d.lastMsg=e,d.lastTime=i.slice(this[xb]),d.lastLogger=this),d.write(h)}function Hb(){}function Gb(){let t=this[B9];"flush"in t&&t.flush(Hb)}});var W9=V((Yf,F9)=>{"use strict";var cs=Zf();cs.configure=Zf;cs.stringify=cs;cs.default=cs;Yf.stringify=cs;Yf.configure=Zf;F9.exports=cs;var Vb=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/,Kb=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/g,Jf=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000b","\\f","\\r","\\u000e","\\u000f","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001a","\\u001b","\\u001c","\\u001d","\\u001e","\\u001f","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\"];function Jb(t){if(t.length===2){let r=t.charCodeAt(1);return`${t[0]}\\u${r.toString(16)}`}let e=t.charCodeAt(0);return Jf.length>e?Jf[e]:`\\u${e.toString(16)}`}function mn(t){if(t.length<5e3&&!Vb.test(t))return t;if(t.length>100)return t.replace(Kb,Jb);let e="",r=0;for(let i=0;i<t.length;i++){let n=t.charCodeAt(i);if(n===34||n===92||n<32)e+=`${t.slice(r,i)}${Jf[n]}`,r=i+1;else if(n>=55296&&n<=57343){if(n<=56319&&i+1<t.length){let o=t.charCodeAt(i+1);if(o>=56320&&o<=57343){i++;continue}}e+=`${t.slice(r,i)}${`\\u${n.toString(16)}`}`,r=i+1}}return e+=t.slice(r),e}function Gf(t){if(t.length>200)return t.sort();for(let e=1;e<t.length;e++){let r=t[e],i=e;for(;i!==0&&t[i-1]>r;)t[i]=t[i-1],i--;t[i]=r}return t}var Zb=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Uint8Array)),Symbol.toStringTag).get;function Vf(t){return Zb.call(t)!==void 0&&t.length!==0}function Kf(t,e,r){t.length<r&&(r=t.length);let i=e===","?"":" ",n=`"0":${i}${t[0]}`;for(let o=1;o<r;o++)n+=`${e}"${o}":${i}${t[o]}`;return n}function Yb(t){if(t&&Object.prototype.hasOwnProperty.call(t,"circularValue")){var e=t.circularValue;if(typeof e=="string")return`"${e}"`;if(e==null)return e;if(e===Error||e===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function $9(t,e){if(t&&Object.prototype.hasOwnProperty.call(t,e)){var r=t[e];if(typeof r!="boolean")throw new TypeError(`The "${e}" argument must be of type boolean`)}return r===void 0?!0:r}function q9(t,e){if(t&&Object.prototype.hasOwnProperty.call(t,e)){var r=t[e];if(typeof r!="number")throw new TypeError(`The "${e}" argument must be of type number`);if(!Number.isInteger(r))throw new TypeError(`The "${e}" argument must be an integer`);if(r<1)throw new RangeError(`The "${e}" argument must be >= 1`)}return r===void 0?1/0:r}function hs(t){return t===1?"1 item":`${t} items`}function Xb(t){let e=new Set;for(let r of t)typeof r=="string"?e.add(r):typeof r=="number"&&e.add(String(r));return e}function Zf(t){let e=Yb(t),r=$9(t,"bigint"),i=$9(t,"deterministic"),n=q9(t,"maximumDepth"),o=q9(t,"maximumBreadth");function a(M,R,x,w,E,T){let C=R[M];switch(typeof C=="object"&&C!==null&&typeof C.toJSON=="function"&&(C=C.toJSON(M)),C=w.call(R,M,C),typeof C){case"string":return`"${mn(C)}"`;case"object":{if(C===null)return"null";if(x.indexOf(C)!==-1)return e;let I="",k=",",B=T;if(Array.isArray(C)){if(C.length===0)return"[]";if(n<x.length+1)return'"[Array]"';x.push(C),E!==""&&(T+=E,I+=`
85
+ `}});var D5=V(($C,B5)=>{"use strict";B5.exports=u3;function u3(t){let{secret:e,censor:r,compileRestore:i,serialize:n,groupRedact:o,nestedRedact:a,wildcards:h,wcLen:d}=t,m=[{secret:e,censor:r,compileRestore:i}];return n!==!1&&m.push({serialize:n}),d>0&&m.push({groupRedact:o,nestedRedact:a,wildcards:h,wcLen:d}),Object.assign(...m)}});var j5=V((qC,U5)=>{"use strict";var z5=R5(),h3=T5(),c3=P5(),f3=N5(),{groupRedact:d3,nestedRedact:m3}=wf(),p3=D5(),g3=yu(),y3=z5(),_f=t=>t;_f.restore=_f;var b3="[REDACTED]";xf.rx=g3;xf.validator=z5;U5.exports=xf;function xf(t={}){let e=Array.from(new Set(t.paths||[])),r="serialize"in t&&(t.serialize===!1||typeof t.serialize=="function")?t.serialize:JSON.stringify,i=t.remove;if(i===!0&&r!==JSON.stringify)throw Error("fast-redact \u2013 remove option may only be set when serializer is JSON.stringify");let n=i===!0?void 0:"censor"in t?t.censor:b3,o=typeof n=="function",a=o&&n.length>1;if(e.length===0)return r||_f;y3({paths:e,serialize:r,censor:n});let{wildcards:h,wcLen:d,secret:m}=h3({paths:e,censor:n}),p=f3({secret:m,wcLen:d}),M="strict"in t?t.strict:!0;return c3({secret:m,wcLen:d,serialize:r,strict:M,isCensorFct:o,censorFctTakesPath:a},p3({secret:m,censor:n,compileRestore:p,serialize:r,groupRedact:d3,nestedRedact:m3,wildcards:h,wcLen:d}))}});var Uo=V((FC,$5)=>{"use strict";var v3=Symbol("pino.setLevel"),w3=Symbol("pino.getLevel"),_3=Symbol("pino.levelVal"),x3=Symbol("pino.useLevelLabels"),S3=Symbol("pino.useOnlyCustomLevels"),M3=Symbol("pino.mixin"),E3=Symbol("pino.lsCache"),R3=Symbol("pino.chindings"),C3=Symbol("pino.asJson"),A3=Symbol("pino.write"),T3=Symbol("pino.redactFmt"),I3=Symbol("pino.time"),P3=Symbol("pino.timeSliceIndex"),O3=Symbol("pino.stream"),k3=Symbol("pino.stringify"),L3=Symbol("pino.stringifySafe"),N3=Symbol("pino.stringifiers"),B3=Symbol("pino.end"),D3=Symbol("pino.formatOpts"),z3=Symbol("pino.messageKey"),U3=Symbol("pino.nestedKey"),j3=Symbol("pino.nestedKeyStr"),$3=Symbol("pino.mixinMergeStrategy"),q3=Symbol("pino.wildcardFirst"),F3=Symbol.for("pino.serializers"),W3=Symbol.for("pino.formatters"),H3=Symbol.for("pino.hooks"),G3=Symbol.for("pino.metadata");$5.exports={setLevelSym:v3,getLevelSym:w3,levelValSym:_3,useLevelLabelsSym:x3,mixinSym:M3,lsCacheSym:E3,chindingsSym:R3,asJsonSym:C3,writeSym:A3,serializersSym:F3,redactFmtSym:T3,timeSym:I3,timeSliceIndexSym:P3,streamSym:O3,stringifySym:k3,stringifySafeSym:L3,stringifiersSym:N3,endSym:B3,formatOptsSym:D3,messageKeySym:z3,nestedKeySym:U3,wildcardFirstSym:q3,needsMetadataGsym:G3,useOnlyCustomLevelsSym:S3,formattersSym:W3,hooksSym:H3,nestedKeyStrSym:j3,mixinMergeStrategySym:$3}});var Ef=V((WC,H5)=>{"use strict";var Mf=j5(),{redactFmtSym:V3,wildcardFirstSym:vu}=Uo(),{rx:Sf,validator:K3}=Mf,q5=K3({ERR_PATHS_MUST_BE_STRINGS:()=>"pino \u2013 redacted paths must be strings",ERR_INVALID_PATH:t=>`pino \u2013 redact paths array contains an invalid path (${t})`}),F5="[Redacted]",W5=!1;function J3(t,e){let{paths:r,censor:i}=Z3(t),n=r.reduce((h,d)=>{Sf.lastIndex=0;let m=Sf.exec(d),p=Sf.exec(d),M=m[1]!==void 0?m[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,"$1"):m[0];if(M==="*"&&(M=vu),p===null)return h[M]=null,h;if(h[M]===null)return h;let{index:R}=p,x=`${d.substr(R,d.length-1)}`;return h[M]=h[M]||[],M!==vu&&h[M].length===0&&h[M].push(...h[vu]||[]),M===vu&&Object.keys(h).forEach(function(w){h[w]&&h[w].push(x)}),h[M].push(x),h},{}),o={[V3]:Mf({paths:r,censor:i,serialize:e,strict:W5})},a=(...h)=>e(typeof i=="function"?i(...h):i);return[...Object.keys(n),...Object.getOwnPropertySymbols(n)].reduce((h,d)=>{if(n[d]===null)h[d]=m=>a(m,[d]);else{let m=typeof i=="function"?(p,M)=>i(p,[d,...M]):i;h[d]=Mf({paths:n[d],censor:m,serialize:e,strict:W5})}return h},o)}function Z3(t){if(Array.isArray(t))return t={paths:t,censor:F5},q5(t),t;let{paths:e,censor:r=F5,remove:i}=t;if(Array.isArray(e)===!1)throw Error("pino \u2013 redact must contain an array of strings");return i===!0&&(r=void 0),q5({paths:e,censor:r}),{paths:e,censor:r}}H5.exports=J3});var V5=V((HC,G5)=>{"use strict";var Y3=()=>"",X3=()=>`,"time":${Date.now()}`,Q3=()=>`,"time":${Math.round(Date.now()/1e3)}`,e7=()=>`,"time":"${new Date(Date.now()).toISOString()}"`;G5.exports={nullTime:Y3,epochTime:X3,unixTime:Q3,isoTime:e7}});var J5=V((GC,K5)=>{"use strict";function t7(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}K5.exports=r7;function r7(t,e,r){var i=r&&r.stringify||t7,n=1;if(typeof t=="object"&&t!==null){var o=e.length+n;if(o===1)return t;var a=new Array(o);a[0]=i(t);for(var h=1;h<o;h++)a[h]=i(e[h]);return a.join(" ")}if(typeof t!="string")return t;var d=e.length;if(d===0)return t;for(var m="",p=1-n,M=-1,R=t&&t.length||0,x=0;x<R;){if(t.charCodeAt(x)===37&&x+1<R){switch(M=M>-1?M:0,t.charCodeAt(x+1)){case 100:case 102:if(p>=d||(M<x&&(m+=t.slice(M,x)),e[p]==null))break;m+=Number(e[p]),M=x=x+2;break;case 105:if(p>=d||(M<x&&(m+=t.slice(M,x)),e[p]==null))break;m+=Math.floor(Number(e[p])),M=x=x+2;break;case 79:case 111:case 106:if(p>=d||(M<x&&(m+=t.slice(M,x)),e[p]===void 0))break;var w=typeof e[p];if(w==="string"){m+="'"+e[p]+"'",M=x+2,x++;break}if(w==="function"){m+=e[p].name||"<anonymous>",M=x+2,x++;break}m+=i(e[p]),M=x+2,x++;break;case 115:if(p>=d)break;M<x&&(m+=t.slice(M,x)),m+=String(e[p]),M=x+2,x++;break;case 37:M<x&&(m+=t.slice(M,x)),m+="%",M=x+2,x++,p--;break}++p}++x}return M===-1?t:(M<R&&(m+=t.slice(M)),m)}});var Cf=V((VC,Rf)=>{"use strict";if(typeof SharedArrayBuffer<"u"&&typeof Atomics<"u"){let e=function(r){if((r>0&&r<1/0)===!1)throw typeof r!="number"&&typeof r!="bigint"?TypeError("sleep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");Atomics.wait(t,0,0,Number(r))},t=new Int32Array(new SharedArrayBuffer(4));Rf.exports=e}else{let t=function(e){if((e>0&&e<1/0)===!1)throw typeof e!="number"&&typeof e!="bigint"?TypeError("sleep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");let i=Date.now()+Number(e);for(;i>Date.now(););};Rf.exports=t}});var e9=V((KC,Q5)=>{"use strict";var Gt=require("fs"),i7=require("events"),n7=require("util").inherits,Z5=require("path"),Y5=Cf(),Af=100,s7=16*1024;function X5(t,e){e._opening=!0,e._writing=!0,e._asyncDrainScheduled=!1;function r(o,a){if(o){e._reopening=!1,e._writing=!1,e._opening=!1,e.sync?process.nextTick(()=>{e.listenerCount("error")>0&&e.emit("error",o)}):e.emit("error",o);return}e.fd=a,e.file=t,e._reopening=!1,e._opening=!1,e._writing=!1,e.sync?process.nextTick(()=>e.emit("ready")):e.emit("ready"),!e._reopening&&!e._writing&&e._len>e.minLength&&!e.destroyed&&jo(e)}let i=e.append?"a":"w",n=e.mode;if(e.sync)try{e.mkdir&&Gt.mkdirSync(Z5.dirname(t),{recursive:!0});let o=Gt.openSync(t,i,n);r(null,o)}catch(o){throw r(o),o}else e.mkdir?Gt.mkdir(Z5.dirname(t),{recursive:!0},o=>{if(o)return r(o);Gt.open(t,i,n,r)}):Gt.open(t,i,n,r)}function Vt(t){if(!(this instanceof Vt))return new Vt(t);let{fd:e,dest:r,minLength:i,maxLength:n,maxWrite:o,sync:a,append:h=!0,mode:d,mkdir:m,retryEAGAIN:p,fsync:M}=t||{};if(e=e||r,this._bufs=[],this._len=0,this.fd=-1,this._writing=!1,this._writingBuf="",this._ending=!1,this._reopening=!1,this._asyncDrainScheduled=!1,this._hwm=Math.max(i||0,16387),this.file=null,this.destroyed=!1,this.minLength=i||0,this.maxLength=n||0,this.maxWrite=o||s7,this.sync=a||!1,this._fsync=M||!1,this.append=h||!1,this.mode=d,this.retryEAGAIN=p||(()=>!0),this.mkdir=m||!1,typeof e=="number")this.fd=e,process.nextTick(()=>this.emit("ready"));else if(typeof e=="string")X5(e,this);else throw new Error("SonicBoom supports only file descriptors and files");if(this.minLength>=this.maxWrite)throw new Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);this.release=(R,x)=>{if(R){if(R.code==="EAGAIN"&&this.retryEAGAIN(R,this._writingBuf.length,this._len-this._writingBuf.length))if(this.sync)try{Y5(Af),this.release(void 0,0)}catch(E){this.release(E)}else setTimeout(()=>{Gt.write(this.fd,this._writingBuf,"utf8",this.release)},Af);else this._writing=!1,this.emit("error",R);return}if(this.emit("write",x),this._len-=x,this._writingBuf=this._writingBuf.slice(x),this._writingBuf.length){if(!this.sync){Gt.write(this.fd,this._writingBuf,"utf8",this.release);return}try{do{let E=Gt.writeSync(this.fd,this._writingBuf,"utf8");this._len-=E,this._writingBuf=this._writingBuf.slice(E)}while(this._writingBuf)}catch(E){this.release(E);return}}this._fsync&&Gt.fsyncSync(this.fd);let w=this._len;this._reopening?(this._writing=!1,this._reopening=!1,this.reopen()):w>this.minLength?jo(this):this._ending?w>0?jo(this):(this._writing=!1,wu(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick(o7,this)):this.emit("drain"))},this.on("newListener",function(R){R==="drain"&&(this._asyncDrainScheduled=!1)})}function o7(t){t.listenerCount("drain")>0&&(t._asyncDrainScheduled=!1,t.emit("drain"))}n7(Vt,i7);Vt.prototype.write=function(t){if(this.destroyed)throw new Error("SonicBoom destroyed");let e=this._len+t.length,r=this._bufs;return this.maxLength&&e>this.maxLength?(this.emit("drop",t),this._len<this._hwm):(r.length===0||r[r.length-1].length+t.length>this.maxWrite?r.push(""+t):r[r.length-1]+=t,this._len=e,!this._writing&&this._len>=this.minLength&&jo(this),this._len<this._hwm)};Vt.prototype.flush=function(){if(this.destroyed)throw new Error("SonicBoom destroyed");this._writing||this.minLength<=0||(this._bufs.length===0&&this._bufs.push(""),jo(this))};Vt.prototype.reopen=function(t){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.reopen(t)});return}if(this._ending)return;if(!this.file)throw new Error("Unable to reopen a file descriptor, you must pass a file to SonicBoom");if(this._reopening=!0,this._writing)return;let e=this.fd;this.once("ready",()=>{e!==this.fd&&Gt.close(e,r=>{if(r)return this.emit("error",r)})}),X5(t||this.file,this)};Vt.prototype.end=function(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.end()});return}this._ending||(this._ending=!0,!this._writing&&(this._len>0&&this.fd>=0?jo(this):wu(this)))};Vt.prototype.flushSync=function(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this.fd<0)throw new Error("sonic boom is not ready yet");for(!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift(this._writingBuf),this._writingBuf="");this._bufs.length;){let t=this._bufs[0];try{this._len-=Gt.writeSync(this.fd,t,"utf8"),this._bufs.shift()}catch(e){if(e.code!=="EAGAIN"||!this.retryEAGAIN(e,t.length,this._len-t.length))throw e;Y5(Af)}}};Vt.prototype.destroy=function(){this.destroyed||wu(this)};function jo(t){let e=t.release;if(t._writing=!0,t._writingBuf=t._writingBuf||t._bufs.shift()||"",t.sync)try{let r=Gt.writeSync(t.fd,t._writingBuf,"utf8");e(null,r)}catch(r){e(r)}else Gt.write(t.fd,t._writingBuf,"utf8",e)}function wu(t){if(t.fd===-1){t.once("ready",wu.bind(null,t));return}t.destroyed=!0,t._bufs=[],t.fd!==1&&t.fd!==2?Gt.close(t.fd,e):setImmediate(e);function e(r){if(r){t.emit("error",r);return}t._ending&&!t._writing&&t.emit("finish"),t.emit("close")}}Vt.SonicBoom=Vt;Vt.default=Vt;Q5.exports=Vt});var Tf=V((JC,o9)=>{"use strict";var dn={exit:[],beforeExit:[]},t9={exit:l7,beforeExit:u7},r9=new FinalizationRegistry(h7);function a7(t){dn[t].length>0||process.on(t,t9[t])}function i9(t){dn[t].length>0||process.removeListener(t,t9[t])}function l7(){n9("exit")}function u7(){n9("beforeExit")}function n9(t){for(let e of dn[t]){let r=e.deref(),i=e.fn;r!==void 0&&i(r,t)}}function h7(t){for(let e of["exit","beforeExit"]){let r=dn[e].indexOf(t);dn[e].splice(r,r+1),i9(e)}}function s9(t,e,r){if(e===void 0)throw new Error("the object can't be undefined");a7(t);let i=new WeakRef(e);i.fn=r,r9.register(e,i),dn[t].push(i)}function c7(t,e){s9("exit",t,e)}function f7(t,e){s9("beforeExit",t,e)}function d7(t){r9.unregister(t);for(let e of["exit","beforeExit"])dn[e]=dn[e].filter(r=>{let i=r.deref();return i&&i!==t}),i9(e)}o9.exports={register:c7,registerBeforeExit:f7,unregister:d7}});var l9=V((ZC,a9)=>{"use strict";function m7(t,e,r,i,n){let o=Date.now()+i,a=Atomics.load(t,e);if(a===r){n(null,"ok");return}let h=a,d=m=>{Date.now()>o?n(null,"timed-out"):setTimeout(()=>{h=a,a=Atomics.load(t,e),a===h?d(m>=1e3?1e3:m*2):a===r?n(null,"ok"):n(null,"not-equal")},m)};d(1)}function p7(t,e,r,i,n){let o=Date.now()+i,a=Atomics.load(t,e);if(a!==r){n(null,"ok");return}let h=d=>{Date.now()>o?n(null,"timed-out"):setTimeout(()=>{a=Atomics.load(t,e),a!==r?n(null,"ok"):h(d>=1e3?1e3:d*2)},d)};h(1)}a9.exports={wait:m7,waitDiff:p7}});var h9=V((YC,u9)=>{"use strict";u9.exports={WRITE_INDEX:4,READ_INDEX:8}});var p9=V((QC,m9)=>{"use strict";var{EventEmitter:g7}=require("events"),{Worker:y7}=require("worker_threads"),{join:b7}=require("path"),{pathToFileURL:v7}=require("url"),{wait:w7}=l9(),{WRITE_INDEX:Kt,READ_INDEX:si}=h9(),_7=require("buffer"),x7=require("assert"),$=Symbol("kImpl"),S7=_7.constants.MAX_STRING_LENGTH,xu=class{constructor(e){this._value=e}deref(){return this._value}},M7=global.FinalizationRegistry||class{register(){}unregister(){}},E7=global.WeakRef||xu,c9=new M7(t=>{t.exited||t.terminate()});function R7(t,e){let{filename:r,workerData:i}=e,o=("__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{})["thread-stream-worker"]||b7(__dirname,"lib","worker.js"),a=new y7(o,{...e.workerOpts,workerData:{filename:r.indexOf("file://")===0?r:v7(r).href,dataBuf:t[$].dataBuf,stateBuf:t[$].stateBuf,workerData:i}});return a.stream=new xu(t),a.on("message",C7),a.on("exit",d9),c9.register(t,a),a}function f9(t){x7(!t[$].sync),t[$].needDrain&&(t[$].needDrain=!1,t.emit("drain"))}function _u(t){let e=Atomics.load(t[$].state,Kt),r=t[$].data.length-e;if(r>0){if(t[$].buf.length===0){t[$].flushing=!1,t[$].ending?Lf(t):t[$].needDrain&&process.nextTick(f9,t);return}let i=t[$].buf.slice(0,r),n=Buffer.byteLength(i);n<=r?(t[$].buf=t[$].buf.slice(r),Su(t,i,_u.bind(null,t))):t.flush(()=>{if(!t.destroyed){for(Atomics.store(t[$].state,si,0),Atomics.store(t[$].state,Kt,0);n>t[$].data.length;)r=r/2,i=t[$].buf.slice(0,r),n=Buffer.byteLength(i);t[$].buf=t[$].buf.slice(r),Su(t,i,_u.bind(null,t))}})}else if(r===0){if(e===0&&t[$].buf.length===0)return;t.flush(()=>{Atomics.store(t[$].state,si,0),Atomics.store(t[$].state,Kt,0),_u(t)})}else oi(t,new Error("overwritten"))}function C7(t){let e=this.stream.deref();if(e===void 0){this.exited=!0,this.terminate();return}switch(t.code){case"READY":this.stream=new E7(e),e.flush(()=>{e[$].ready=!0,e.emit("ready")});break;case"ERROR":oi(e,t.err);break;default:oi(e,new Error("this should not happen: "+t.code))}}function d9(t){let e=this.stream.deref();e!==void 0&&(c9.unregister(e),e.worker.exited=!0,e.worker.off("exit",d9),oi(e,t!==0?new Error("the worker thread exited"):null))}var Pf=class extends g7{constructor(e={}){if(super(),e.bufferSize<4)throw new Error("bufferSize must at least fit a 4-byte utf-8 char");this[$]={},this[$].stateBuf=new SharedArrayBuffer(128),this[$].state=new Int32Array(this[$].stateBuf),this[$].dataBuf=new SharedArrayBuffer(e.bufferSize||4*1024*1024),this[$].data=Buffer.from(this[$].dataBuf),this[$].sync=e.sync||!1,this[$].ending=!1,this[$].ended=!1,this[$].needDrain=!1,this[$].destroyed=!1,this[$].flushing=!1,this[$].ready=!1,this[$].finished=!1,this[$].errored=null,this[$].closed=!1,this[$].buf="",this.worker=R7(this,e)}write(e){if(this[$].destroyed)return Of(this,new Error("the worker has exited")),!1;if(this[$].ending)return Of(this,new Error("the worker is ending")),!1;if(this[$].flushing&&this[$].buf.length+e.length>=S7)try{If(this),this[$].flushing=!0}catch(r){return oi(this,r),!1}if(this[$].buf+=e,this[$].sync)try{return If(this),!0}catch(r){return oi(this,r),!1}return this[$].flushing||(this[$].flushing=!0,setImmediate(_u,this)),this[$].needDrain=this[$].data.length-this[$].buf.length-Atomics.load(this[$].state,Kt)<=0,!this[$].needDrain}end(){this[$].destroyed||(this[$].ending=!0,Lf(this))}flush(e){if(this[$].destroyed){typeof e=="function"&&process.nextTick(e,new Error("the worker has exited"));return}let r=Atomics.load(this[$].state,Kt);w7(this[$].state,si,r,1/0,(i,n)=>{if(i){oi(this,i),process.nextTick(e,i);return}if(n==="not-equal"){this.flush(e);return}process.nextTick(e)})}flushSync(){this[$].destroyed||(If(this),kf(this))}unref(){this.worker.unref()}ref(){this.worker.ref()}get ready(){return this[$].ready}get destroyed(){return this[$].destroyed}get closed(){return this[$].closed}get writable(){return!this[$].destroyed&&!this[$].ending}get writableEnded(){return this[$].ending}get writableFinished(){return this[$].finished}get writableNeedDrain(){return this[$].needDrain}get writableObjectMode(){return!1}get writableErrored(){return this[$].errored}};function Of(t,e){setImmediate(()=>{t.emit("error",e)})}function oi(t,e){t[$].destroyed||(t[$].destroyed=!0,e&&(t[$].errored=e,Of(t,e)),t.worker.exited?setImmediate(()=>{t[$].closed=!0,t.emit("close")}):t.worker.terminate().catch(()=>{}).then(()=>{t[$].closed=!0,t.emit("close")}))}function Su(t,e,r){let i=Atomics.load(t[$].state,Kt),n=Buffer.byteLength(e);return t[$].data.write(e,i),Atomics.store(t[$].state,Kt,i+n),Atomics.notify(t[$].state,Kt),r(),!0}function Lf(t){if(!(t[$].ended||!t[$].ending||t[$].flushing)){t[$].ended=!0;try{t.flushSync();let e=Atomics.load(t[$].state,si);Atomics.store(t[$].state,Kt,-1),Atomics.notify(t[$].state,Kt);let r=0;for(;e!==-1;){if(Atomics.wait(t[$].state,si,e,1e3),e=Atomics.load(t[$].state,si),e===-2){oi(t,new Error("end() failed"));return}if(++r===10){oi(t,new Error("end() took too long (10s)"));return}}process.nextTick(()=>{t[$].finished=!0,t.emit("finish")})}catch(e){oi(t,e)}}}function If(t){let e=()=>{t[$].ending?Lf(t):t[$].needDrain&&process.nextTick(f9,t)};for(t[$].flushing=!1;t[$].buf.length!==0;){let r=Atomics.load(t[$].state,Kt),i=t[$].data.length-r;if(i===0){kf(t),Atomics.store(t[$].state,si,0),Atomics.store(t[$].state,Kt,0);continue}else if(i<0)throw new Error("overwritten");let n=t[$].buf.slice(0,i),o=Buffer.byteLength(n);if(o<=i)t[$].buf=t[$].buf.slice(i),Su(t,n,e);else{for(kf(t),Atomics.store(t[$].state,si,0),Atomics.store(t[$].state,Kt,0);o>t[$].buf.length;)i=i/2,n=t[$].buf.slice(0,i),o=Buffer.byteLength(n);t[$].buf=t[$].buf.slice(i),Su(t,n,e)}}}function kf(t){if(t[$].flushing)throw new Error("unable to flush while flushing");let e=Atomics.load(t[$].state,Kt),r=0;for(;;){let i=Atomics.load(t[$].state,si);if(i===-2)throw Error("_flushSync failed");if(i!==e)Atomics.wait(t[$].state,si,i,1e3);else break;if(++r===10)throw new Error("_flushSync took too long (10s)")}}m9.exports=Pf});var Df=V((eA,g9)=>{"use strict";var{createRequire:A7}=require("module"),T7=vf(),{join:Nf,isAbsolute:I7}=require("path"),P7=Cf(),Bf=Tf(),O7=p9();function k7(t){Bf.register(t,N7),Bf.registerBeforeExit(t,B7),t.on("close",function(){Bf.unregister(t)})}function L7(t,e,r){let i=new O7({filename:t,workerData:e,workerOpts:r});i.on("ready",n),i.on("close",function(){process.removeListener("exit",o)}),process.on("exit",o);function n(){process.removeListener("exit",o),i.unref(),r.autoEnd!==!1&&k7(i)}function o(){i.closed||(i.flushSync(),P7(100),i.end())}return i}function N7(t){t.ref(),t.flushSync(),t.end(),t.once("close",function(){t.unref()})}function B7(t){t.flushSync()}function D7(t){let{pipeline:e,targets:r,levels:i,options:n={},worker:o={},caller:a=T7()}=t,h=typeof a=="string"?[a]:a,d="__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{},m=t.target;if(m&&r)throw new Error("only one of target or targets can be specified");return r?(m=d["pino-worker"]||Nf(__dirname,"worker.js"),n.targets=r.map(M=>({...M,target:p(M.target)}))):e&&(m=d["pino-pipeline-worker"]||Nf(__dirname,"worker-pipeline.js"),n.targets=e.map(M=>({...M,target:p(M.target)}))),i&&(n.levels=i),L7(p(m),n,o);function p(M){if(M=d[M]||M,I7(M)||M.indexOf("file://")===0)return M;if(M==="pino/file")return Nf(__dirname,"..","file.js");let R;for(let x of h)try{R=A7(x).resolve(M);break}catch{continue}if(!R)throw new Error(`unable to determine transport target for "${M}"`);return R}}g9.exports=D7});var Eu=V((tA,A9)=>{"use strict";var y9=J5(),{mapHttpRequest:z7,mapHttpResponse:U7}=bf(),zf=e9(),b9=Tf(),{lsCacheSym:j7,chindingsSym:x9,writeSym:v9,serializersSym:S9,formatOptsSym:w9,endSym:$7,stringifiersSym:M9,stringifySym:E9,stringifySafeSym:Uf,wildcardFirstSym:R9,nestedKeySym:q7,formattersSym:C9,messageKeySym:F7,nestedKeyStrSym:W7}=Uo(),{isMainThread:H7}=require("worker_threads"),G7=Df();function h1(){}function V7(t,e){if(!e)return r;return function(...n){e.call(this,n,r,t)};function r(i,...n){if(typeof i=="object"){let o=i;i!==null&&(i.method&&i.headers&&i.socket?i=z7(i):typeof i.setHeader=="function"&&(i=U7(i)));let a;o===null&&n.length===0?a=[null]:(o=n.shift(),a=n),this[v9](i,y9(o,a,this[w9]),t)}else this[v9](null,y9(i,n,this[w9]),t)}}function _9(t){let e="",r=0,i=!1,n=255,o=t.length;if(o>100)return JSON.stringify(t);for(var a=0;a<o&&n>=32;a++)n=t.charCodeAt(a),(n===34||n===92)&&(e+=t.slice(r,a)+"\\",r=a,i=!0);return i?e+=t.slice(r):e=t,n<32?JSON.stringify(t):'"'+e+'"'}function K7(t,e,r,i){let n=this[E9],o=this[Uf],a=this[M9],h=this[$7],d=this[x9],m=this[S9],p=this[C9],M=this[F7],R=this[j7][r]+i;R=R+d;let x;p.log&&(t=p.log(t));let w=a[R9],E="";for(let C in t)if(x=t[C],Object.prototype.hasOwnProperty.call(t,C)&&x!==void 0){x=m[C]?m[C](x):x;let I=a[C]||w;switch(typeof x){case"undefined":case"function":continue;case"number":Number.isFinite(x)===!1&&(x=null);case"boolean":I&&(x=I(x));break;case"string":x=(I||_9)(x);break;default:x=(I||n)(x,o)}if(x===void 0)continue;E+=',"'+C+'":'+x}let T="";if(e!==void 0){x=m[M]?m[M](e):e;let C=a[M]||w;switch(typeof x){case"function":break;case"number":Number.isFinite(x)===!1&&(x=null);case"boolean":C&&(x=C(x)),T=',"'+M+'":'+x;break;case"string":x=(C||_9)(x),T=',"'+M+'":'+x;break;default:x=(C||n)(x,o),T=',"'+M+'":'+x}}return this[q7]&&E?R+this[W7]+E.slice(1)+"}"+T+h:R+E+T+h}function J7(t,e){let r,i=t[x9],n=t[E9],o=t[Uf],a=t[M9],h=a[R9],d=t[S9];e=t[C9].bindings(e);for(let p in e)if(r=e[p],(p!=="level"&&p!=="serializers"&&p!=="formatters"&&p!=="customLevels"&&e.hasOwnProperty(p)&&r!==void 0)===!0){if(r=d[p]?d[p](r):r,r=(a[p]||h||n)(r,o),r===void 0)continue;i+=',"'+p+'":'+r}return i}function Z7(t){return t.write!==t.constructor.prototype.write}function Mu(t){let e=new zf(t);return e.on("error",r),!t.sync&&H7&&(b9.register(e,Y7),e.on("close",function(){b9.unregister(e)})),e;function r(i){if(i.code==="EPIPE"){e.write=h1,e.end=h1,e.flushSync=h1,e.destroy=h1;return}e.removeListener("error",r),e.emit("error",i)}}function Y7(t,e){t.destroyed||(e==="beforeExit"?(t.flush(),t.on("drain",function(){t.end()})):t.flushSync())}function X7(t){return function(r,i,n={},o){if(typeof n=="string")o=Mu({dest:n}),n={};else if(typeof o=="string"){if(n&&n.transport)throw Error("only one of option.transport or stream can be specified");o=Mu({dest:o})}else if(n instanceof zf||n.writable||n._writableState)o=n,n={};else if(n.transport){if(n.transport instanceof zf||n.transport.writable||n.transport._writableState)throw Error("option.transport do not allow stream, please pass to option directly. e.g. pino(transport)");if(n.transport.targets&&n.transport.targets.length&&n.formatters&&typeof n.formatters.level=="function")throw Error("option.transport.targets do not allow custom level formatters");let h;n.customLevels&&(h=n.useOnlyCustomLevels?n.customLevels:Object.assign({},n.levels,n.customLevels)),o=G7({caller:i,...n.transport,levels:h})}if(n=Object.assign({},t,n),n.serializers=Object.assign({},t.serializers,n.serializers),n.formatters=Object.assign({},t.formatters,n.formatters),n.prettyPrint)throw new Error("prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)");if("onTerminated"in n)throw Error("The onTerminated option has been removed, use pino.final instead");let{enabled:a}=n;return a===!1&&(n.level="silent"),o||(Z7(process.stdout)?o=process.stdout:o=Mu({fd:process.stdout.fd})),{opts:n,stream:o}}}function Q7(t,e){try{return JSON.stringify(t)}catch{try{return(e||this[Uf])(t)}catch{return'"[unable to serialize, circular reference is too complex to analyze]"'}}}function eb(t,e,r){return{level:t,bindings:e,log:r}}function tb(t){let e=Number(t);return typeof t=="string"&&Number.isFinite(e)?e:t}A9.exports={noop:h1,buildSafeSonicBoom:Mu,asChindings:J7,asJson:K7,genLog:V7,createArgsNormalizer:X7,stringify:Q7,buildFormatters:eb,normalizeDestFileDescriptor:tb}});var Ru=V((rA,I9)=>{"use strict";var{lsCacheSym:rb,levelValSym:jf,useOnlyCustomLevelsSym:ib,streamSym:nb,formattersSym:sb,hooksSym:ob}=Uo(),{noop:ab,genLog:as}=Eu(),Dr={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},T9={fatal:t=>{let e=as(Dr.fatal,t);return function(...r){let i=this[nb];if(e.call(this,...r),typeof i.flushSync=="function")try{i.flushSync()}catch{}}},error:t=>as(Dr.error,t),warn:t=>as(Dr.warn,t),info:t=>as(Dr.info,t),debug:t=>as(Dr.debug,t),trace:t=>as(Dr.trace,t)},$f=Object.keys(Dr).reduce((t,e)=>(t[Dr[e]]=e,t),{}),lb=Object.keys($f).reduce((t,e)=>(t[e]='{"level":'+Number(e),t),{});function ub(t){let e=t[sb].level,{labels:r}=t.levels,i={};for(let n in r){let o=e(r[n],Number(n));i[n]=JSON.stringify(o).slice(0,-1)}return t[rb]=i,t}function hb(t,e){if(e)return!1;switch(t){case"fatal":case"error":case"warn":case"info":case"debug":case"trace":return!0;default:return!1}}function cb(t){let{labels:e,values:r}=this.levels;if(typeof t=="number"){if(e[t]===void 0)throw Error("unknown level value"+t);t=e[t]}if(r[t]===void 0)throw Error("unknown level "+t);let i=this[jf],n=this[jf]=r[t],o=this[ib],a=this[ob].logMethod;for(let h in r){if(n>r[h]){this[h]=ab;continue}this[h]=hb(h,o)?T9[h](a):as(r[h],a)}this.emit("level-change",t,n,e[i],i)}function fb(t){let{levels:e,levelVal:r}=this;return e&&e.labels?e.labels[r]:""}function db(t){let{values:e}=this.levels,r=e[t];return r!==void 0&&r>=this[jf]}function mb(t=null,e=!1){let r=t?Object.keys(t).reduce((o,a)=>(o[t[a]]=a,o),{}):null,i=Object.assign(Object.create(Object.prototype,{Infinity:{value:"silent"}}),e?null:$f,r),n=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),e?null:Dr,t);return{labels:i,values:n}}function pb(t,e,r){if(typeof t=="number"){if(![].concat(Object.keys(e||{}).map(o=>e[o]),r?[]:Object.keys($f).map(o=>+o),1/0).includes(t))throw Error(`default level:${t} must be included in custom levels`);return}let i=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),r?null:Dr,e);if(!(t in i))throw Error(`default level:${t} must be included in custom levels`)}function gb(t,e){let{labels:r,values:i}=t;for(let n in e){if(n in i)throw Error("levels cannot be overridden");if(e[n]in r)throw Error("pre-existing level values cannot be used for new levels")}}I9.exports={initialLsCache:lb,genLsCache:ub,levelMethods:T9,getLevel:fb,setLevel:cb,isLevelEnabled:db,mappings:mb,levels:Dr,assertNoLevelCollisions:gb,assertDefaultLevelFound:pb}});var qf=V((iA,P9)=>{"use strict";P9.exports={version:"8.3.0"}});var $9=V((sA,j9)=>{"use strict";var{EventEmitter:yb}=require("events"),{lsCacheSym:bb,levelValSym:vb,setLevelSym:Wf,getLevelSym:O9,chindingsSym:Hf,parsedChindingsSym:wb,mixinSym:_b,asJsonSym:B9,writeSym:xb,mixinMergeStrategySym:Sb,timeSym:Mb,timeSliceIndexSym:Eb,streamSym:D9,serializersSym:ls,formattersSym:Ff,useOnlyCustomLevelsSym:Rb,needsMetadataGsym:Cb,redactFmtSym:Ab,stringifySym:Tb,formatOptsSym:Ib,stringifiersSym:Pb}=Uo(),{getLevel:Ob,setLevel:kb,isLevelEnabled:Lb,mappings:Nb,initialLsCache:Bb,genLsCache:Db,assertNoLevelCollisions:zb}=Ru(),{asChindings:z9,asJson:Ub,buildFormatters:k9,stringify:L9}=Eu(),{version:jb}=qf(),$b=Ef(),qb=class{},U9={constructor:qb,child:Fb,bindings:Wb,setBindings:Hb,flush:Jb,isLevelEnabled:Lb,version:jb,get level(){return this[O9]()},set level(t){this[Wf](t)},get levelVal(){return this[vb]},set levelVal(t){throw Error("levelVal is read-only")},[bb]:Bb,[xb]:Vb,[B9]:Ub,[O9]:Ob,[Wf]:kb};Object.setPrototypeOf(U9,yb.prototype);j9.exports=function(){return Object.create(U9)};var N9=t=>t;function Fb(t,e){if(!t)throw Error("missing bindings for child Pino");e=e||{};let r=this[ls],i=this[Ff],n=Object.create(this);if(e.hasOwnProperty("serializers")===!0){n[ls]=Object.create(null);for(let p in r)n[ls][p]=r[p];let d=Object.getOwnPropertySymbols(r);for(var o=0;o<d.length;o++){let p=d[o];n[ls][p]=r[p]}for(let p in e.serializers)n[ls][p]=e.serializers[p];let m=Object.getOwnPropertySymbols(e.serializers);for(var a=0;a<m.length;a++){let p=m[a];n[ls][p]=e.serializers[p]}}else n[ls]=r;if(e.hasOwnProperty("formatters")){let{level:d,bindings:m,log:p}=e.formatters;n[Ff]=k9(d||i.level,m||N9,p||i.log)}else n[Ff]=k9(i.level,N9,i.log);if(e.hasOwnProperty("customLevels")===!0&&(zb(this.levels,e.customLevels),n.levels=Nb(e.customLevels,n[Rb]),Db(n)),typeof e.redact=="object"&&e.redact!==null||Array.isArray(e.redact)){n.redact=e.redact;let d=$b(n.redact,L9),m={stringify:d[Ab]};n[Tb]=L9,n[Pb]=d,n[Ib]=m}n[Hf]=z9(n,t);let h=e.level||this.level;return n[Wf](h),n}function Wb(){let e=`{${this[Hf].substr(1)}}`,r=JSON.parse(e);return delete r.pid,delete r.hostname,r}function Hb(t){let e=z9(this,t);this[Hf]=e,delete this[wb]}function Gb(t,e){return Object.assign(e,t)}function Vb(t,e,r){let i=this[Mb](),n=this[_b],o=this[Sb]||Gb,a;t==null?a={}:t instanceof Error?(a={err:t},e===void 0&&(e=t.message)):(a=t,e===void 0&&t.err&&(e=t.err.message)),n&&(a=o(a,n(a,r)));let h=this[B9](a,e,r,i),d=this[D9];d[Cb]===!0&&(d.lastLevel=r,d.lastObj=a,d.lastMsg=e,d.lastTime=i.slice(this[Eb]),d.lastLogger=this),d.write(h)}function Kb(){}function Jb(){let t=this[D9];"flush"in t&&t.flush(Kb)}});var H9=V((Yf,W9)=>{"use strict";var hs=Zf();hs.configure=Zf;hs.stringify=hs;hs.default=hs;Yf.stringify=hs;Yf.configure=Zf;W9.exports=hs;var Zb=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/,Yb=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/g,Jf=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000b","\\f","\\r","\\u000e","\\u000f","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001a","\\u001b","\\u001c","\\u001d","\\u001e","\\u001f","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\"];function Xb(t){if(t.length===2){let r=t.charCodeAt(1);return`${t[0]}\\u${r.toString(16)}`}let e=t.charCodeAt(0);return Jf.length>e?Jf[e]:`\\u${e.toString(16)}`}function mn(t){if(t.length<5e3&&!Zb.test(t))return t;if(t.length>100)return t.replace(Yb,Xb);let e="",r=0;for(let i=0;i<t.length;i++){let n=t.charCodeAt(i);if(n===34||n===92||n<32)e+=`${t.slice(r,i)}${Jf[n]}`,r=i+1;else if(n>=55296&&n<=57343){if(n<=56319&&i+1<t.length){let o=t.charCodeAt(i+1);if(o>=56320&&o<=57343){i++;continue}}e+=`${t.slice(r,i)}${`\\u${n.toString(16)}`}`,r=i+1}}return e+=t.slice(r),e}function Gf(t){if(t.length>200)return t.sort();for(let e=1;e<t.length;e++){let r=t[e],i=e;for(;i!==0&&t[i-1]>r;)t[i]=t[i-1],i--;t[i]=r}return t}var Qb=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Uint8Array)),Symbol.toStringTag).get;function Vf(t){return Qb.call(t)!==void 0&&t.length!==0}function Kf(t,e,r){t.length<r&&(r=t.length);let i=e===","?"":" ",n=`"0":${i}${t[0]}`;for(let o=1;o<r;o++)n+=`${e}"${o}":${i}${t[o]}`;return n}function ev(t){if(t&&Object.prototype.hasOwnProperty.call(t,"circularValue")){var e=t.circularValue;if(typeof e=="string")return`"${e}"`;if(e==null)return e;if(e===Error||e===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function q9(t,e){if(t&&Object.prototype.hasOwnProperty.call(t,e)){var r=t[e];if(typeof r!="boolean")throw new TypeError(`The "${e}" argument must be of type boolean`)}return r===void 0?!0:r}function F9(t,e){if(t&&Object.prototype.hasOwnProperty.call(t,e)){var r=t[e];if(typeof r!="number")throw new TypeError(`The "${e}" argument must be of type number`);if(!Number.isInteger(r))throw new TypeError(`The "${e}" argument must be an integer`);if(r<1)throw new RangeError(`The "${e}" argument must be >= 1`)}return r===void 0?1/0:r}function us(t){return t===1?"1 item":`${t} items`}function tv(t){let e=new Set;for(let r of t)typeof r=="string"?e.add(r):typeof r=="number"&&e.add(String(r));return e}function Zf(t){let e=ev(t),r=q9(t,"bigint"),i=q9(t,"deterministic"),n=F9(t,"maximumDepth"),o=F9(t,"maximumBreadth");function a(M,R,x,w,E,T){let C=R[M];switch(typeof C=="object"&&C!==null&&typeof C.toJSON=="function"&&(C=C.toJSON(M)),C=w.call(R,M,C),typeof C){case"string":return`"${mn(C)}"`;case"object":{if(C===null)return"null";if(x.indexOf(C)!==-1)return e;let I="",k=",",B=T;if(Array.isArray(C)){if(C.length===0)return"[]";if(n<x.length+1)return'"[Array]"';x.push(C),E!==""&&(T+=E,I+=`
86
86
  ${T}`,k=`,
87
- ${T}`);let Ue=Math.min(C.length,o),Te=0;for(;Te<Ue-1;Te++){let st=a(Te,C,x,w,E,T);I+=st!==void 0?st:"null",I+=k}let Ne=a(Te,C,x,w,E,T);if(I+=Ne!==void 0?Ne:"null",C.length-1>o){let st=C.length-o-1;I+=`${k}"... ${hs(st)} not stringified"`}return E!==""&&(I+=`
87
+ ${T}`);let Ue=Math.min(C.length,o),Te=0;for(;Te<Ue-1;Te++){let st=a(Te,C,x,w,E,T);I+=st!==void 0?st:"null",I+=k}let Ne=a(Te,C,x,w,E,T);if(I+=Ne!==void 0?Ne:"null",C.length-1>o){let st=C.length-o-1;I+=`${k}"... ${us(st)} not stringified"`}return E!==""&&(I+=`
88
88
  ${B}`),x.pop(),`[${I}]`}let z=Object.keys(C),H=z.length;if(H===0)return"{}";if(n<x.length+1)return'"[Object]"';let J="",se="";E!==""&&(T+=E,k=`,
89
- ${T}`,J=" ");let Me=Math.min(H,o);Vf(C)&&(I+=Kf(C,k,o),z=z.slice(C.length),Me-=C.length,se=k),i&&(z=Gf(z)),x.push(C);for(let Ue=0;Ue<Me;Ue++){let Te=z[Ue],Ne=a(Te,C,x,w,E,T);Ne!==void 0&&(I+=`${se}"${mn(Te)}":${J}${Ne}`,se=k)}if(H>o){let Ue=H-o;I+=`${se}"...":${J}"${hs(Ue)} not stringified"`,se=k}return E!==""&&se.length>1&&(I=`
89
+ ${T}`,J=" ");let Me=Math.min(H,o);Vf(C)&&(I+=Kf(C,k,o),z=z.slice(C.length),Me-=C.length,se=k),i&&(z=Gf(z)),x.push(C);for(let Ue=0;Ue<Me;Ue++){let Te=z[Ue],Ne=a(Te,C,x,w,E,T);Ne!==void 0&&(I+=`${se}"${mn(Te)}":${J}${Ne}`,se=k)}if(H>o){let Ue=H-o;I+=`${se}"...":${J}"${us(Ue)} not stringified"`,se=k}return E!==""&&se.length>1&&(I=`
90
90
  ${T}${I}
91
91
  ${B}`),x.pop(),`{${I}}`}case"number":return isFinite(C)?String(C):"null";case"boolean":return C===!0?"true":"false";case"bigint":return r?String(C):void 0}}function h(M,R,x,w,E,T){switch(typeof R=="object"&&R!==null&&typeof R.toJSON=="function"&&(R=R.toJSON(M)),typeof R){case"string":return`"${mn(R)}"`;case"object":{if(R===null)return"null";if(x.indexOf(R)!==-1)return e;let C=T,I="",k=",";if(Array.isArray(R)){if(R.length===0)return"[]";if(n<x.length+1)return'"[Array]"';x.push(R),E!==""&&(T+=E,I+=`
92
92
  ${T}`,k=`,
93
- ${T}`);let H=Math.min(R.length,o),J=0;for(;J<H-1;J++){let Me=h(J,R[J],x,w,E,T);I+=Me!==void 0?Me:"null",I+=k}let se=h(J,R[J],x,w,E,T);if(I+=se!==void 0?se:"null",R.length-1>o){let Me=R.length-o-1;I+=`${k}"... ${hs(Me)} not stringified"`}return E!==""&&(I+=`
93
+ ${T}`);let H=Math.min(R.length,o),J=0;for(;J<H-1;J++){let Me=h(J,R[J],x,w,E,T);I+=Me!==void 0?Me:"null",I+=k}let se=h(J,R[J],x,w,E,T);if(I+=se!==void 0?se:"null",R.length-1>o){let Me=R.length-o-1;I+=`${k}"... ${us(Me)} not stringified"`}return E!==""&&(I+=`
94
94
  ${C}`),x.pop(),`[${I}]`}if(w.size===0)return"{}";x.push(R);let B="";E!==""&&(T+=E,k=`,
95
95
  ${T}`,B=" ");let z="";for(let H of w){let J=h(H,R[H],x,w,E,T);J!==void 0&&(I+=`${z}"${mn(H)}":${B}${J}`,z=k)}return E!==""&&z.length>1&&(I=`
96
96
  ${T}${I}
97
97
  ${C}`),x.pop(),`{${I}}`}case"number":return isFinite(R)?String(R):"null";case"boolean":return R===!0?"true":"false";case"bigint":return r?String(R):void 0}}function d(M,R,x,w,E){switch(typeof R){case"string":return`"${mn(R)}"`;case"object":{if(R===null)return"null";if(typeof R.toJSON=="function"){if(R=R.toJSON(M),typeof R!="object")return d(M,R,x,w,E);if(R===null)return"null"}if(x.indexOf(R)!==-1)return e;let T=E;if(Array.isArray(R)){if(R.length===0)return"[]";if(n<x.length+1)return'"[Array]"';x.push(R),E+=w;let J=`
98
98
  ${E}`,se=`,
99
- ${E}`,Me=Math.min(R.length,o),Ue=0;for(;Ue<Me-1;Ue++){let Ne=d(Ue,R[Ue],x,w,E);J+=Ne!==void 0?Ne:"null",J+=se}let Te=d(Ue,R[Ue],x,w,E);if(J+=Te!==void 0?Te:"null",R.length-1>o){let Ne=R.length-o-1;J+=`${se}"... ${hs(Ne)} not stringified"`}return J+=`
99
+ ${E}`,Me=Math.min(R.length,o),Ue=0;for(;Ue<Me-1;Ue++){let Ne=d(Ue,R[Ue],x,w,E);J+=Ne!==void 0?Ne:"null",J+=se}let Te=d(Ue,R[Ue],x,w,E);if(J+=Te!==void 0?Te:"null",R.length-1>o){let Ne=R.length-o-1;J+=`${se}"... ${us(Ne)} not stringified"`}return J+=`
100
100
  ${T}`,x.pop(),`[${J}]`}let C=Object.keys(R),I=C.length;if(I===0)return"{}";if(n<x.length+1)return'"[Object]"';E+=w;let k=`,
101
- ${E}`,B="",z="",H=Math.min(I,o);Vf(R)&&(B+=Kf(R,k,o),C=C.slice(R.length),H-=R.length,z=k),i&&(C=Gf(C)),x.push(R);for(let J=0;J<H;J++){let se=C[J],Me=d(se,R[se],x,w,E);Me!==void 0&&(B+=`${z}"${mn(se)}": ${Me}`,z=k)}if(I>o){let J=I-o;B+=`${z}"...": "${hs(J)} not stringified"`,z=k}return z!==""&&(B=`
101
+ ${E}`,B="",z="",H=Math.min(I,o);Vf(R)&&(B+=Kf(R,k,o),C=C.slice(R.length),H-=R.length,z=k),i&&(C=Gf(C)),x.push(R);for(let J=0;J<H;J++){let se=C[J],Me=d(se,R[se],x,w,E);Me!==void 0&&(B+=`${z}"${mn(se)}": ${Me}`,z=k)}if(I>o){let J=I-o;B+=`${z}"...": "${us(J)} not stringified"`,z=k}return z!==""&&(B=`
102
102
  ${E}${B}
103
- ${T}`),x.pop(),`{${B}}`}case"number":return isFinite(R)?String(R):"null";case"boolean":return R===!0?"true":"false";case"bigint":return r?String(R):void 0}}function m(M,R,x){switch(typeof R){case"string":return`"${mn(R)}"`;case"object":{if(R===null)return"null";if(typeof R.toJSON=="function"){if(R=R.toJSON(M),typeof R!="object")return m(M,R,x);if(R===null)return"null"}if(x.indexOf(R)!==-1)return e;let w="";if(Array.isArray(R)){if(R.length===0)return"[]";if(n<x.length+1)return'"[Array]"';x.push(R);let k=Math.min(R.length,o),B=0;for(;B<k-1;B++){let H=m(B,R[B],x);w+=H!==void 0?H:"null",w+=","}let z=m(B,R[B],x);if(w+=z!==void 0?z:"null",R.length-1>o){let H=R.length-o-1;w+=`,"... ${hs(H)} not stringified"`}return x.pop(),`[${w}]`}let E=Object.keys(R),T=E.length;if(T===0)return"{}";if(n<x.length+1)return'"[Object]"';let C="",I=Math.min(T,o);Vf(R)&&(w+=Kf(R,",",o),E=E.slice(R.length),I-=R.length,C=","),i&&(E=Gf(E)),x.push(R);for(let k=0;k<I;k++){let B=E[k],z=m(B,R[B],x);z!==void 0&&(w+=`${C}"${mn(B)}":${z}`,C=",")}if(T>o){let k=T-o;w+=`${C}"...":"${hs(k)} not stringified"`}return x.pop(),`{${w}}`}case"number":return isFinite(R)?String(R):"null";case"boolean":return R===!0?"true":"false";case"bigint":return r?String(R):void 0}}function p(M,R,x){if(arguments.length>1){let w="";if(typeof x=="number"?w=" ".repeat(Math.min(x,10)):typeof x=="string"&&(w=x.slice(0,10)),R!=null){if(typeof R=="function")return a("",{"":M},[],R,w,"");if(Array.isArray(R))return h("",M,[],Xb(R),w,"")}if(w.length!==0)return d("",M,[],w,"")}return m("",M,[])}return p}});var K9=V((aA,V9)=>{"use strict";var Xf=Symbol.for("pino.metadata"),{levels:H9}=Ru(),G9=Object.create(H9);G9.silent=1/0;var Qb=H9.info;function ev(t,e){let r=0;t=t||[],e=e||{dedupe:!1};let i=G9;e.levels&&typeof e.levels=="object"&&(i=e.levels);let n={write:o,add:h,flushSync:a,end:d,minLevel:0,streams:[],clone:m,[Xf]:!0};return Array.isArray(t)?t.forEach(h,n):h.call(n,t),t=null,n;function o(p){let M,R=this.lastLevel,{streams:x}=this,w;for(let E=0;E<x.length&&(M=x[E],M.level<=R);E++){if(w=M.stream,w[Xf]){let{lastTime:T,lastMsg:C,lastObj:I,lastLogger:k}=this;w.lastLevel=R,w.lastTime=T,w.lastMsg=C,w.lastObj=I,w.lastLogger=k}(!e.dedupe||M.level===R)&&w.write(p)}}function a(){for(let{stream:p}of this.streams)typeof p.flushSync=="function"&&p.flushSync()}function h(p){if(!p)return n;let M=typeof p.write=="function"||p.stream,R=p.write?p:p.stream;if(!M)throw Error("stream object needs to implement either StreamEntry or DestinationStream interface");let{streams:x}=this,w;typeof p.levelVal=="number"?w=p.levelVal:typeof p.level=="string"?w=i[p.level]:typeof p.level=="number"?w=p.level:w=Qb;let E={stream:R,level:w,levelVal:void 0,id:r++};return x.unshift(E),x.sort(tv),this.minLevel=x[0].level,n}function d(){for(let{stream:p}of this.streams)typeof p.flushSync=="function"&&p.flushSync(),p.end()}function m(p){let M=new Array(this.streams.length);for(let R=0;R<M.length;R++)M[R]={level:p,stream:this.streams[R].stream};return{write:o,add:h,minLevel:p,streams:M,clone:m,flushSync:a,[Xf]:!0}}}function tv(t,e){return t.level-e.level}V9.exports=ev});var t0=V((lA,_r)=>{"use strict";var rv=require("os"),rm=bf(),iv=vf(),nv=Ef(),im=G5(),sv=j9(),nm=Uo(),{configure:ov}=W9(),{assertDefaultLevelFound:av,mappings:sm,genLsCache:lv,levels:uv}=Ru(),{createArgsNormalizer:hv,asChindings:cv,buildSafeSonicBoom:J9,buildFormatters:fv,stringify:Cu,normalizeDestFileDescriptor:Z9,noop:dv}=Eu(),{version:mv}=qf(),{chindingsSym:Y9,redactFmtSym:pv,serializersSym:X9,timeSym:gv,timeSliceIndexSym:yv,streamSym:bv,stringifySym:Q9,stringifySafeSym:Qf,stringifiersSym:em,setLevelSym:vv,endSym:wv,formatOptsSym:_v,messageKeySym:xv,nestedKeySym:Sv,mixinSym:Mv,useOnlyCustomLevelsSym:Ev,formattersSym:tm,hooksSym:Rv,nestedKeyStrSym:Cv,mixinMergeStrategySym:Av}=nm,{epochTime:om,nullTime:Tv}=im,{pid:Iv}=process,Pv=rv.hostname(),Ov=rm.err,kv={level:"info",levels:uv,messageKey:"msg",nestedKey:null,enabled:!0,base:{pid:Iv,hostname:Pv},serializers:Object.assign(Object.create(null),{err:Ov}),formatters:Object.assign(Object.create(null),{bindings(t){return t},level(t,e){return{level:e}}}),hooks:{logMethod:void 0},timestamp:om,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100},Lv=hv(kv),Nv=Object.assign(Object.create(null),rm);function e0(...t){let e={},{opts:r,stream:i}=Lv(e,iv(),...t),{redact:n,crlf:o,serializers:a,timestamp:h,messageKey:d,nestedKey:m,base:p,name:M,level:R,customLevels:x,mixin:w,mixinMergeStrategy:E,useOnlyCustomLevels:T,formatters:C,hooks:I,depthLimit:k,edgeLimit:B}=r,z=ov({maximumDepth:k,maximumBreadth:B}),H=fv(C.level,C.bindings,C.log),J=n?nv(n,Cu):{},se=Cu.bind({[Qf]:z}),Me=n?{stringify:J[pv]}:{stringify:se},Ue="}"+(o?`\r
103
+ ${T}`),x.pop(),`{${B}}`}case"number":return isFinite(R)?String(R):"null";case"boolean":return R===!0?"true":"false";case"bigint":return r?String(R):void 0}}function m(M,R,x){switch(typeof R){case"string":return`"${mn(R)}"`;case"object":{if(R===null)return"null";if(typeof R.toJSON=="function"){if(R=R.toJSON(M),typeof R!="object")return m(M,R,x);if(R===null)return"null"}if(x.indexOf(R)!==-1)return e;let w="";if(Array.isArray(R)){if(R.length===0)return"[]";if(n<x.length+1)return'"[Array]"';x.push(R);let k=Math.min(R.length,o),B=0;for(;B<k-1;B++){let H=m(B,R[B],x);w+=H!==void 0?H:"null",w+=","}let z=m(B,R[B],x);if(w+=z!==void 0?z:"null",R.length-1>o){let H=R.length-o-1;w+=`,"... ${us(H)} not stringified"`}return x.pop(),`[${w}]`}let E=Object.keys(R),T=E.length;if(T===0)return"{}";if(n<x.length+1)return'"[Object]"';let C="",I=Math.min(T,o);Vf(R)&&(w+=Kf(R,",",o),E=E.slice(R.length),I-=R.length,C=","),i&&(E=Gf(E)),x.push(R);for(let k=0;k<I;k++){let B=E[k],z=m(B,R[B],x);z!==void 0&&(w+=`${C}"${mn(B)}":${z}`,C=",")}if(T>o){let k=T-o;w+=`${C}"...":"${us(k)} not stringified"`}return x.pop(),`{${w}}`}case"number":return isFinite(R)?String(R):"null";case"boolean":return R===!0?"true":"false";case"bigint":return r?String(R):void 0}}function p(M,R,x){if(arguments.length>1){let w="";if(typeof x=="number"?w=" ".repeat(Math.min(x,10)):typeof x=="string"&&(w=x.slice(0,10)),R!=null){if(typeof R=="function")return a("",{"":M},[],R,w,"");if(Array.isArray(R))return h("",M,[],tv(R),w,"")}if(w.length!==0)return d("",M,[],w,"")}return m("",M,[])}return p}});var J9=V((oA,K9)=>{"use strict";var Xf=Symbol.for("pino.metadata"),{levels:G9}=Ru(),V9=Object.create(G9);V9.silent=1/0;var rv=G9.info;function iv(t,e){let r=0;t=t||[],e=e||{dedupe:!1};let i=V9;e.levels&&typeof e.levels=="object"&&(i=e.levels);let n={write:o,add:h,flushSync:a,end:d,minLevel:0,streams:[],clone:m,[Xf]:!0};return Array.isArray(t)?t.forEach(h,n):h.call(n,t),t=null,n;function o(p){let M,R=this.lastLevel,{streams:x}=this,w;for(let E=0;E<x.length&&(M=x[E],M.level<=R);E++){if(w=M.stream,w[Xf]){let{lastTime:T,lastMsg:C,lastObj:I,lastLogger:k}=this;w.lastLevel=R,w.lastTime=T,w.lastMsg=C,w.lastObj=I,w.lastLogger=k}(!e.dedupe||M.level===R)&&w.write(p)}}function a(){for(let{stream:p}of this.streams)typeof p.flushSync=="function"&&p.flushSync()}function h(p){if(!p)return n;let M=typeof p.write=="function"||p.stream,R=p.write?p:p.stream;if(!M)throw Error("stream object needs to implement either StreamEntry or DestinationStream interface");let{streams:x}=this,w;typeof p.levelVal=="number"?w=p.levelVal:typeof p.level=="string"?w=i[p.level]:typeof p.level=="number"?w=p.level:w=rv;let E={stream:R,level:w,levelVal:void 0,id:r++};return x.unshift(E),x.sort(nv),this.minLevel=x[0].level,n}function d(){for(let{stream:p}of this.streams)typeof p.flushSync=="function"&&p.flushSync(),p.end()}function m(p){let M=new Array(this.streams.length);for(let R=0;R<M.length;R++)M[R]={level:p,stream:this.streams[R].stream};return{write:o,add:h,minLevel:p,streams:M,clone:m,flushSync:a,[Xf]:!0}}}function nv(t,e){return t.level-e.level}K9.exports=iv});var t0=V((aA,_r)=>{"use strict";var sv=require("os"),im=bf(),ov=vf(),av=Ef(),nm=V5(),lv=$9(),sm=Uo(),{configure:uv}=H9(),{assertDefaultLevelFound:hv,mappings:om,genLsCache:cv,levels:fv}=Ru(),{createArgsNormalizer:dv,asChindings:mv,buildSafeSonicBoom:Z9,buildFormatters:pv,stringify:Cu,normalizeDestFileDescriptor:Y9,noop:gv}=Eu(),{version:yv}=qf(),{chindingsSym:X9,redactFmtSym:bv,serializersSym:Q9,timeSym:vv,timeSliceIndexSym:wv,streamSym:_v,stringifySym:em,stringifySafeSym:Qf,stringifiersSym:tm,setLevelSym:xv,endSym:Sv,formatOptsSym:Mv,messageKeySym:Ev,nestedKeySym:Rv,mixinSym:Cv,useOnlyCustomLevelsSym:Av,formattersSym:rm,hooksSym:Tv,nestedKeyStrSym:Iv,mixinMergeStrategySym:Pv}=sm,{epochTime:am,nullTime:Ov}=nm,{pid:kv}=process,Lv=sv.hostname(),Nv=im.err,Bv={level:"info",levels:fv,messageKey:"msg",nestedKey:null,enabled:!0,base:{pid:kv,hostname:Lv},serializers:Object.assign(Object.create(null),{err:Nv}),formatters:Object.assign(Object.create(null),{bindings(t){return t},level(t,e){return{level:e}}}),hooks:{logMethod:void 0},timestamp:am,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100},Dv=dv(Bv),zv=Object.assign(Object.create(null),im);function e0(...t){let e={},{opts:r,stream:i}=Dv(e,ov(),...t),{redact:n,crlf:o,serializers:a,timestamp:h,messageKey:d,nestedKey:m,base:p,name:M,level:R,customLevels:x,mixin:w,mixinMergeStrategy:E,useOnlyCustomLevels:T,formatters:C,hooks:I,depthLimit:k,edgeLimit:B}=r,z=uv({maximumDepth:k,maximumBreadth:B}),H=pv(C.level,C.bindings,C.log),J=n?av(n,Cu):{},se=Cu.bind({[Qf]:z}),Me=n?{stringify:J[bv]}:{stringify:se},Ue="}"+(o?`\r
104
104
  `:`
105
- `),Te=cv.bind(null,{[Y9]:"",[X9]:a,[em]:J,[Q9]:Cu,[Qf]:z,[tm]:H}),Ne="";p!==null&&(M===void 0?Ne=Te(p):Ne=Te(Object.assign({},p,{name:M})));let st=h instanceof Function?h:h?om:Tv,zt=st().indexOf(":")+1;if(T&&!x)throw Error("customLevels is required if useOnlyCustomLevels is set true");if(w&&typeof w!="function")throw Error(`Unknown mixin type "${typeof w}" - expected "function"`);av(R,x,T);let di=sm(x,T);return Object.assign(e,{levels:di,[Ev]:T,[bv]:i,[gv]:st,[yv]:zt,[Q9]:Cu,[Qf]:z,[em]:J,[wv]:Ue,[_v]:Me,[xv]:d,[Sv]:m,[Cv]:m?`,${JSON.stringify(m)}:{`:"",[X9]:a,[Mv]:w,[Av]:E,[Y9]:Ne,[tm]:H,[Rv]:I,silent:dv}),Object.setPrototypeOf(e,sv()),lv(e),e[vv](R),e}_r.exports=e0;_r.exports.destination=(t=process.stdout.fd)=>typeof t=="object"?(t.dest=Z9(t.dest||process.stdout.fd),J9(t)):J9({dest:Z9(t),minLength:0});_r.exports.transport=Df();_r.exports.multistream=K9();_r.exports.levels=sm();_r.exports.stdSerializers=Nv;_r.exports.stdTimeFunctions=Object.assign({},im);_r.exports.symbols=nm;_r.exports.version=mv;_r.exports.default=e0;_r.exports.pino=e0});var hm=V((uA,c1)=>{"use strict";var Bv=process.env.TERM_PROGRAM==="Hyper",Dv=process.platform==="win32",am=process.platform==="linux",r0={ballotDisabled:"\u2612",ballotOff:"\u2610",ballotOn:"\u2611",bullet:"\u2022",bulletWhite:"\u25E6",fullBlock:"\u2588",heart:"\u2764",identicalTo:"\u2261",line:"\u2500",mark:"\u203B",middot:"\xB7",minus:"\uFF0D",multiplication:"\xD7",obelus:"\xF7",pencilDownRight:"\u270E",pencilRight:"\u270F",pencilUpRight:"\u2710",percent:"%",pilcrow2:"\u2761",pilcrow:"\xB6",plusMinus:"\xB1",section:"\xA7",starsOff:"\u2606",starsOn:"\u2605",upDownArrow:"\u2195"},lm=Object.assign({},r0,{check:"\u221A",cross:"\xD7",ellipsisLarge:"...",ellipsis:"...",info:"i",question:"?",questionSmall:"?",pointer:">",pointerSmall:"\xBB",radioOff:"( )",radioOn:"(*)",warning:"\u203C"}),um=Object.assign({},r0,{ballotCross:"\u2718",check:"\u2714",cross:"\u2716",ellipsisLarge:"\u22EF",ellipsis:"\u2026",info:"\u2139",question:"?",questionFull:"\uFF1F",questionSmall:"\uFE56",pointer:am?"\u25B8":"\u276F",pointerSmall:am?"\u2023":"\u203A",radioOff:"\u25EF",radioOn:"\u25C9",warning:"\u26A0"});c1.exports=Dv&&!Bv?lm:um;Reflect.defineProperty(c1.exports,"common",{enumerable:!1,value:r0});Reflect.defineProperty(c1.exports,"windows",{enumerable:!1,value:lm});Reflect.defineProperty(c1.exports,"other",{enumerable:!1,value:um})});var fm=V((hA,i0)=>{"use strict";var zv=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),Uv=/[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g,cm=()=>{let t={enabled:!0,visible:!0,styles:{},keys:{}};"FORCE_COLOR"in process.env&&(t.enabled=process.env.FORCE_COLOR!=="0");let e=o=>{let a=o.open=`\x1B[${o.codes[0]}m`,h=o.close=`\x1B[${o.codes[1]}m`,d=o.regex=new RegExp(`\\u001b\\[${o.codes[1]}m`,"g");return o.wrap=(m,p)=>{m.includes(h)&&(m=m.replace(d,h+a));let M=a+m+h;return p?M.replace(/\r*\n/g,`${h}$&${a}`):M},o},r=(o,a,h)=>typeof o=="function"?o(a):o.wrap(a,h),i=(o,a)=>{if(o===""||o==null)return"";if(t.enabled===!1)return o;if(t.visible===!1)return"";let h=""+o,d=h.includes(`
106
- `),m=a.length;for(m>0&&a.includes("unstyle")&&(a=[...new Set(["unstyle",...a])].reverse());m-- >0;)h=r(t.styles[a[m]],h,d);return h},n=(o,a,h)=>{t.styles[o]=e({name:o,codes:a}),(t.keys[h]||(t.keys[h]=[])).push(o),Reflect.defineProperty(t,o,{configurable:!0,enumerable:!0,set(m){t.alias(o,m)},get(){let m=p=>i(p,m.stack);return Reflect.setPrototypeOf(m,t),m.stack=this.stack?this.stack.concat(o):[o],m}})};return n("reset",[0,0],"modifier"),n("bold",[1,22],"modifier"),n("dim",[2,22],"modifier"),n("italic",[3,23],"modifier"),n("underline",[4,24],"modifier"),n("inverse",[7,27],"modifier"),n("hidden",[8,28],"modifier"),n("strikethrough",[9,29],"modifier"),n("black",[30,39],"color"),n("red",[31,39],"color"),n("green",[32,39],"color"),n("yellow",[33,39],"color"),n("blue",[34,39],"color"),n("magenta",[35,39],"color"),n("cyan",[36,39],"color"),n("white",[37,39],"color"),n("gray",[90,39],"color"),n("grey",[90,39],"color"),n("bgBlack",[40,49],"bg"),n("bgRed",[41,49],"bg"),n("bgGreen",[42,49],"bg"),n("bgYellow",[43,49],"bg"),n("bgBlue",[44,49],"bg"),n("bgMagenta",[45,49],"bg"),n("bgCyan",[46,49],"bg"),n("bgWhite",[47,49],"bg"),n("blackBright",[90,39],"bright"),n("redBright",[91,39],"bright"),n("greenBright",[92,39],"bright"),n("yellowBright",[93,39],"bright"),n("blueBright",[94,39],"bright"),n("magentaBright",[95,39],"bright"),n("cyanBright",[96,39],"bright"),n("whiteBright",[97,39],"bright"),n("bgBlackBright",[100,49],"bgBright"),n("bgRedBright",[101,49],"bgBright"),n("bgGreenBright",[102,49],"bgBright"),n("bgYellowBright",[103,49],"bgBright"),n("bgBlueBright",[104,49],"bgBright"),n("bgMagentaBright",[105,49],"bgBright"),n("bgCyanBright",[106,49],"bgBright"),n("bgWhiteBright",[107,49],"bgBright"),t.ansiRegex=Uv,t.hasColor=t.hasAnsi=o=>(t.ansiRegex.lastIndex=0,typeof o=="string"&&o!==""&&t.ansiRegex.test(o)),t.alias=(o,a)=>{let h=typeof a=="string"?t[a]:a;if(typeof h!="function")throw new TypeError("Expected alias to be the name of an existing color (string) or a function");h.stack||(Reflect.defineProperty(h,"name",{value:o}),t.styles[o]=h,h.stack=[o]),Reflect.defineProperty(t,o,{configurable:!0,enumerable:!0,set(d){t.alias(o,d)},get(){let d=m=>i(m,d.stack);return Reflect.setPrototypeOf(d,t),d.stack=this.stack?this.stack.concat(h.stack):h.stack,d}})},t.theme=o=>{if(!zv(o))throw new TypeError("Expected theme to be an object");for(let a of Object.keys(o))t.alias(a,o[a]);return t},t.alias("unstyle",o=>typeof o=="string"&&o!==""?(t.ansiRegex.lastIndex=0,o.replace(t.ansiRegex,"")):""),t.alias("noop",o=>o),t.none=t.clear=t.noop,t.stripColor=t.unstyle,t.symbols=hm(),t.define=n,t};i0.exports=cm();i0.exports.create=cm});var n0=V((fA,dm)=>{dm.exports=require("stream")});var ym=V((dA,gm)=>{"use strict";function mm(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function $v(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?mm(Object(r),!0).forEach(function(i){qv(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):mm(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function qv(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Fv(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function pm(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function Wv(t,e,r){return e&&pm(t.prototype,e),r&&pm(t,r),t}var Hv=require("buffer"),Au=Hv.Buffer,Gv=require("util"),s0=Gv.inspect,Vv=s0&&s0.custom||"inspect";function Kv(t,e,r){Au.prototype.copy.call(t,e,r)}gm.exports=function(){function t(){Fv(this,t),this.head=null,this.tail=null,this.length=0}return Wv(t,[{key:"push",value:function(r){var i={data:r,next:null};this.length>0?this.tail.next=i:this.head=i,this.tail=i,++this.length}},{key:"unshift",value:function(r){var i={data:r,next:this.head};this.length===0&&(this.tail=i),this.head=i,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var i=this.head,n=""+i.data;i=i.next;)n+=r+i.data;return n}},{key:"concat",value:function(r){if(this.length===0)return Au.alloc(0);for(var i=Au.allocUnsafe(r>>>0),n=this.head,o=0;n;)Kv(n.data,i,o),o+=n.data.length,n=n.next;return i}},{key:"consume",value:function(r,i){var n;return r<this.head.data.length?(n=this.head.data.slice(0,r),this.head.data=this.head.data.slice(r)):r===this.head.data.length?n=this.shift():n=i?this._getString(r):this._getBuffer(r),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(r){var i=this.head,n=1,o=i.data;for(r-=o.length;i=i.next;){var a=i.data,h=r>a.length?a.length:r;if(h===a.length?o+=a:o+=a.slice(0,r),r-=h,r===0){h===a.length?(++n,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=a.slice(h));break}++n}return this.length-=n,o}},{key:"_getBuffer",value:function(r){var i=Au.allocUnsafe(r),n=this.head,o=1;for(n.data.copy(i),r-=n.data.length;n=n.next;){var a=n.data,h=r>a.length?a.length:r;if(a.copy(i,i.length-r,0,h),r-=h,r===0){h===a.length?(++o,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=a.slice(h));break}++o}return this.length-=o,i}},{key:Vv,value:function(r,i){return s0(this,$v({},i,{depth:0,customInspect:!1}))}}]),t}()});var a0=V((mA,vm)=>{"use strict";function Jv(t,e){var r=this,i=this._readableState&&this._readableState.destroyed,n=this._writableState&&this._writableState.destroyed;return i||n?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(o0,this,t)):process.nextTick(o0,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(o){!e&&o?r._writableState?r._writableState.errorEmitted?process.nextTick(Tu,r):(r._writableState.errorEmitted=!0,process.nextTick(bm,r,o)):process.nextTick(bm,r,o):e?(process.nextTick(Tu,r),e(o)):process.nextTick(Tu,r)}),this)}function bm(t,e){o0(t,e),Tu(t)}function Tu(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function Zv(){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.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function o0(t,e){t.emit("error",e)}function Yv(t,e){var r=t._readableState,i=t._writableState;r&&r.autoDestroy||i&&i.autoDestroy?t.destroy(e):t.emit("error",e)}vm.exports={destroy:Jv,undestroy:Zv,errorOrDestroy:Yv}});var pn=V((pA,xm)=>{"use strict";var _m={};function xr(t,e,r){r||(r=Error);function i(o,a,h){return typeof e=="string"?e:e(o,a,h)}class n extends r{constructor(a,h,d){super(i(a,h,d))}}n.prototype.name=r.name,n.prototype.code=t,_m[t]=n}function wm(t,e){if(Array.isArray(t)){let r=t.length;return t=t.map(i=>String(i)),r>2?`one of ${e} ${t.slice(0,r-1).join(", ")}, or `+t[r-1]:r===2?`one of ${e} ${t[0]} or ${t[1]}`:`of ${e} ${t[0]}`}else return`of ${e} ${String(t)}`}function Xv(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function Qv(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function ew(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}xr("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);xr("ERR_INVALID_ARG_TYPE",function(t,e,r){let i;typeof e=="string"&&Xv(e,"not ")?(i="must not be",e=e.replace(/^not /,"")):i="must be";let n;if(Qv(t," argument"))n=`The ${t} ${i} ${wm(e,"type")}`;else{let o=ew(t,".")?"property":"argument";n=`The "${t}" ${o} ${i} ${wm(e,"type")}`}return n+=`. Received type ${typeof r}`,n},TypeError);xr("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");xr("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});xr("ERR_STREAM_PREMATURE_CLOSE","Premature close");xr("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});xr("ERR_MULTIPLE_CALLBACK","Callback called multiple times");xr("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");xr("ERR_STREAM_WRITE_AFTER_END","write after end");xr("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);xr("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);xr("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");xm.exports.codes=_m});var l0=V((gA,Sm)=>{"use strict";var tw=pn().codes.ERR_INVALID_OPT_VALUE;function rw(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function iw(t,e,r,i){var n=rw(e,i,r);if(n!=null){if(!(isFinite(n)&&Math.floor(n)===n)||n<0){var o=i?r:"highWaterMark";throw new tw(o,n)}return Math.floor(n)}return t.objectMode?16:16*1024}Sm.exports={getHighWaterMark:iw}});var Mm=V((yA,u0)=>{typeof Object.create=="function"?u0.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:u0.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}}});var $o=V((bA,c0)=>{try{if(h0=require("util"),typeof h0.inherits!="function")throw"";c0.exports=h0.inherits}catch{c0.exports=Mm()}var h0});var Rm=V((vA,Em)=>{Em.exports=require("util").deprecate});var m0=V((wA,Om)=>{"use strict";Om.exports=rt;function Am(t){var e=this;this.next=null,this.entry=null,this.finish=function(){Iw(e,t)}}var qo;rt.WritableState=d1;var nw={deprecate:Rm()},Tm=n0(),Pu=require("buffer").Buffer,sw=global.Uint8Array||function(){};function ow(t){return Pu.from(t)}function aw(t){return Pu.isBuffer(t)||t instanceof sw}var d0=a0(),lw=l0(),uw=lw.getHighWaterMark,gn=pn().codes,hw=gn.ERR_INVALID_ARG_TYPE,cw=gn.ERR_METHOD_NOT_IMPLEMENTED,fw=gn.ERR_MULTIPLE_CALLBACK,dw=gn.ERR_STREAM_CANNOT_PIPE,mw=gn.ERR_STREAM_DESTROYED,pw=gn.ERR_STREAM_NULL_VALUES,gw=gn.ERR_STREAM_WRITE_AFTER_END,yw=gn.ERR_UNKNOWN_ENCODING,Fo=d0.errorOrDestroy;$o()(rt,Tm);function bw(){}function d1(t,e,r){qo=qo||fs(),t=t||{},typeof r!="boolean"&&(r=e instanceof qo),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=uw(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var i=t.decodeStrings===!1;this.decodeStrings=!i,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(n){Ew(e,n)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new Am(this)}d1.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(d1.prototype,"buffer",{get:nw.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var Iu;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Iu=Function.prototype[Symbol.hasInstance],Object.defineProperty(rt,Symbol.hasInstance,{value:function(e){return Iu.call(this,e)?!0:this!==rt?!1:e&&e._writableState instanceof d1}})):Iu=function(e){return e instanceof this};function rt(t){qo=qo||fs();var e=this instanceof qo;if(!e&&!Iu.call(rt,this))return new rt(t);this._writableState=new d1(t,this,e),this.writable=!0,t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final)),Tm.call(this)}rt.prototype.pipe=function(){Fo(this,new dw)};function vw(t,e){var r=new gw;Fo(t,r),process.nextTick(e,r)}function ww(t,e,r,i){var n;return r===null?n=new pw:typeof r!="string"&&!e.objectMode&&(n=new hw("chunk",["string","Buffer"],r)),n?(Fo(t,n),process.nextTick(i,n),!1):!0}rt.prototype.write=function(t,e,r){var i=this._writableState,n=!1,o=!i.objectMode&&aw(t);return o&&!Pu.isBuffer(t)&&(t=ow(t)),typeof e=="function"&&(r=e,e=null),o?e="buffer":e||(e=i.defaultEncoding),typeof r!="function"&&(r=bw),i.ending?vw(this,r):(o||ww(this,i,t,r))&&(i.pendingcb++,n=xw(this,i,o,t,e,r)),n};rt.prototype.cork=function(){this._writableState.corked++};rt.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&Im(this,t))};rt.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new yw(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(rt.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function _w(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=Pu.from(e,r)),e}Object.defineProperty(rt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function xw(t,e,r,i,n,o){if(!r){var a=_w(e,i,n);i!==a&&(r=!0,n="buffer",i=a)}var h=e.objectMode?1:i.length;e.length+=h;var d=e.length<e.highWaterMark;if(d||(e.needDrain=!0),e.writing||e.corked){var m=e.lastBufferedRequest;e.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:o,next:null},m?m.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else f0(t,e,!1,h,i,n,o);return d}function f0(t,e,r,i,n,o,a){e.writelen=i,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new mw("write")):r?t._writev(n,e.onwrite):t._write(n,o,e.onwrite),e.sync=!1}function Sw(t,e,r,i,n){--e.pendingcb,r?(process.nextTick(n,i),process.nextTick(f1,t,e),t._writableState.errorEmitted=!0,Fo(t,i)):(n(i),t._writableState.errorEmitted=!0,Fo(t,i),f1(t,e))}function Mw(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}function Ew(t,e){var r=t._writableState,i=r.sync,n=r.writecb;if(typeof n!="function")throw new fw;if(Mw(r),e)Sw(t,r,i,e,n);else{var o=Pm(r)||t.destroyed;!o&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&Im(t,r),i?process.nextTick(Cm,t,r,o,n):Cm(t,r,o,n)}}function Cm(t,e,r,i){r||Rw(t,e),e.pendingcb--,i(),f1(t,e)}function Rw(t,e){e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}function Im(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var i=e.bufferedRequestCount,n=new Array(i),o=e.corkedRequestsFree;o.entry=r;for(var a=0,h=!0;r;)n[a]=r,r.isBuf||(h=!1),r=r.next,a+=1;n.allBuffers=h,f0(t,e,!0,e.length,n,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new Am(e),e.bufferedRequestCount=0}else{for(;r;){var d=r.chunk,m=r.encoding,p=r.callback,M=e.objectMode?1:d.length;if(f0(t,e,!1,M,d,m,p),r=r.next,e.bufferedRequestCount--,e.writing)break}r===null&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}rt.prototype._write=function(t,e,r){r(new cw("_write()"))};rt.prototype._writev=null;rt.prototype.end=function(t,e,r){var i=this._writableState;return typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null),t!=null&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||Tw(this,i,r),this};Object.defineProperty(rt.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function Pm(t){return t.ending&&t.length===0&&t.bufferedRequest===null&&!t.finished&&!t.writing}function Cw(t,e){t._final(function(r){e.pendingcb--,r&&Fo(t,r),e.prefinished=!0,t.emit("prefinish"),f1(t,e)})}function Aw(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.pendingcb++,e.finalCalled=!0,process.nextTick(Cw,t,e)):(e.prefinished=!0,t.emit("prefinish")))}function f1(t,e){var r=Pm(e);if(r&&(Aw(t,e),e.pendingcb===0&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return r}function Tw(t,e,r){e.ending=!0,f1(t,e),r&&(e.finished?process.nextTick(r):t.once("finish",r)),e.ended=!0,t.writable=!1}function Iw(t,e,r){var i=t.entry;for(t.entry=null;i;){var n=i.callback;e.pendingcb--,n(r),i=i.next}e.corkedRequestsFree.next=t}Object.defineProperty(rt.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){!this._writableState||(this._writableState.destroyed=e)}});rt.prototype.destroy=d0.destroy;rt.prototype._undestroy=d0.undestroy;rt.prototype._destroy=function(t,e){e(t)}});var fs=V((_A,Lm)=>{"use strict";var Pw=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};Lm.exports=ai;var km=y0(),g0=m0();$o()(ai,km);for(p0=Pw(g0.prototype),Ou=0;Ou<p0.length;Ou++)ku=p0[Ou],ai.prototype[ku]||(ai.prototype[ku]=g0.prototype[ku]);var p0,ku,Ou;function ai(t){if(!(this instanceof ai))return new ai(t);km.call(this,t),g0.call(this,t),this.allowHalfOpen=!0,t&&(t.readable===!1&&(this.readable=!1),t.writable===!1&&(this.writable=!1),t.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",Ow)))}Object.defineProperty(ai.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});Object.defineProperty(ai.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});Object.defineProperty(ai.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function Ow(){this._writableState.ended||process.nextTick(kw,this)}function kw(t){t.end()}Object.defineProperty(ai.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(e){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=e,this._writableState.destroyed=e)}})});var Dm=V((b0,Bm)=>{var Lu=require("buffer"),li=Lu.Buffer;function Nm(t,e){for(var r in t)e[r]=t[r]}li.from&&li.alloc&&li.allocUnsafe&&li.allocUnsafeSlow?Bm.exports=Lu:(Nm(Lu,b0),b0.Buffer=ds);function ds(t,e,r){return li(t,e,r)}ds.prototype=Object.create(li.prototype);Nm(li,ds);ds.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return li(t,e,r)};ds.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=li(t);return e!==void 0?typeof r=="string"?i.fill(e,r):i.fill(e):i.fill(0),i};ds.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return li(t)};ds.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Lu.SlowBuffer(t)}});var _0=V(Um=>{"use strict";var w0=Dm().Buffer,zm=w0.isEncoding||function(t){switch(t=""+t,t&&t.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 Lw(t){if(!t)return"utf8";for(var e;;)switch(t){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 t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function Nw(t){var e=Lw(t);if(typeof e!="string"&&(w0.isEncoding===zm||!zm(t)))throw new Error("Unknown encoding: "+t);return e||t}Um.StringDecoder=m1;function m1(t){this.encoding=Nw(t);var e;switch(this.encoding){case"utf16le":this.text=$w,this.end=qw,e=4;break;case"utf8":this.fillLast=zw,e=4;break;case"base64":this.text=Fw,this.end=Ww,e=3;break;default:this.write=Hw,this.end=Gw;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=w0.allocUnsafe(e)}m1.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""};m1.prototype.end=jw;m1.prototype.text=Uw;m1.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length};function v0(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function Bw(t,e,r){var i=e.length-1;if(i<r)return 0;var n=v0(e[i]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--i<r||n===-2?0:(n=v0(e[i]),n>=0?(n>0&&(t.lastNeed=n-2),n):--i<r||n===-2?0:(n=v0(e[i]),n>=0?(n>0&&(n===2?n=0:t.lastNeed=n-3),n):0))}function Dw(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function zw(t){var e=this.lastTotal-this.lastNeed,r=Dw(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function Uw(t,e){var r=Bw(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)}function jw(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function $w(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function qw(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function Fw(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function Ww(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Hw(t){return t.toString(this.encoding)}function Gw(t){return t&&t.length?this.write(t):""}});var Nu=V((SA,qm)=>{"use strict";var jm=pn().codes.ERR_STREAM_PREMATURE_CLOSE;function Vw(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];t.apply(this,i)}}}function Kw(){}function Jw(t){return t.setHeader&&typeof t.abort=="function"}function $m(t,e,r){if(typeof e=="function")return $m(t,null,e);e||(e={}),r=Vw(r||Kw);var i=e.readable||e.readable!==!1&&t.readable,n=e.writable||e.writable!==!1&&t.writable,o=function(){t.writable||h()},a=t._writableState&&t._writableState.finished,h=function(){n=!1,a=!0,i||r.call(t)},d=t._readableState&&t._readableState.endEmitted,m=function(){i=!1,d=!0,n||r.call(t)},p=function(w){r.call(t,w)},M=function(){var w;if(i&&!d)return(!t._readableState||!t._readableState.ended)&&(w=new jm),r.call(t,w);if(n&&!a)return(!t._writableState||!t._writableState.ended)&&(w=new jm),r.call(t,w)},R=function(){t.req.on("finish",h)};return Jw(t)?(t.on("complete",h),t.on("abort",M),t.req?R():t.on("request",R)):n&&!t._writableState&&(t.on("end",o),t.on("close",o)),t.on("end",m),t.on("finish",h),e.error!==!1&&t.on("error",p),t.on("close",M),function(){t.removeListener("complete",h),t.removeListener("abort",M),t.removeListener("request",R),t.req&&t.req.removeListener("finish",h),t.removeListener("end",o),t.removeListener("close",o),t.removeListener("finish",h),t.removeListener("end",m),t.removeListener("error",p),t.removeListener("close",M)}}qm.exports=$m});var Wm=V((MA,Fm)=>{"use strict";var Bu;function yn(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Zw=Nu(),bn=Symbol("lastResolve"),ms=Symbol("lastReject"),p1=Symbol("error"),Du=Symbol("ended"),ps=Symbol("lastPromise"),x0=Symbol("handlePromise"),gs=Symbol("stream");function vn(t,e){return{value:t,done:e}}function Yw(t){var e=t[bn];if(e!==null){var r=t[gs].read();r!==null&&(t[ps]=null,t[bn]=null,t[ms]=null,e(vn(r,!1)))}}function Xw(t){process.nextTick(Yw,t)}function Qw(t,e){return function(r,i){t.then(function(){if(e[Du]){r(vn(void 0,!0));return}e[x0](r,i)},i)}}var e_=Object.getPrototypeOf(function(){}),t_=Object.setPrototypeOf((Bu={get stream(){return this[gs]},next:function(){var e=this,r=this[p1];if(r!==null)return Promise.reject(r);if(this[Du])return Promise.resolve(vn(void 0,!0));if(this[gs].destroyed)return new Promise(function(a,h){process.nextTick(function(){e[p1]?h(e[p1]):a(vn(void 0,!0))})});var i=this[ps],n;if(i)n=new Promise(Qw(i,this));else{var o=this[gs].read();if(o!==null)return Promise.resolve(vn(o,!1));n=new Promise(this[x0])}return this[ps]=n,n}},yn(Bu,Symbol.asyncIterator,function(){return this}),yn(Bu,"return",function(){var e=this;return new Promise(function(r,i){e[gs].destroy(null,function(n){if(n){i(n);return}r(vn(void 0,!0))})})}),Bu),e_),r_=function(e){var r,i=Object.create(t_,(r={},yn(r,gs,{value:e,writable:!0}),yn(r,bn,{value:null,writable:!0}),yn(r,ms,{value:null,writable:!0}),yn(r,p1,{value:null,writable:!0}),yn(r,Du,{value:e._readableState.endEmitted,writable:!0}),yn(r,x0,{value:function(o,a){var h=i[gs].read();h?(i[ps]=null,i[bn]=null,i[ms]=null,o(vn(h,!1))):(i[bn]=o,i[ms]=a)},writable:!0}),r));return i[ps]=null,Zw(e,function(n){if(n&&n.code!=="ERR_STREAM_PREMATURE_CLOSE"){var o=i[ms];o!==null&&(i[ps]=null,i[bn]=null,i[ms]=null,o(n)),i[p1]=n;return}var a=i[bn];a!==null&&(i[ps]=null,i[bn]=null,i[ms]=null,a(vn(void 0,!0))),i[Du]=!0}),e.on("readable",Xw.bind(null,i)),i};Fm.exports=r_});var Km=V((EA,Vm)=>{"use strict";function Hm(t,e,r,i,n,o,a){try{var h=t[o](a),d=h.value}catch(m){r(m);return}h.done?e(d):Promise.resolve(d).then(i,n)}function i_(t){return function(){var e=this,r=arguments;return new Promise(function(i,n){var o=t.apply(e,r);function a(d){Hm(o,i,n,a,h,"next",d)}function h(d){Hm(o,i,n,a,h,"throw",d)}a(void 0)})}}function Gm(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function n_(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Gm(Object(r),!0).forEach(function(i){s_(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Gm(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function s_(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o_=pn().codes.ERR_INVALID_ARG_TYPE;function a_(t,e,r){var i;if(e&&typeof e.next=="function")i=e;else if(e&&e[Symbol.asyncIterator])i=e[Symbol.asyncIterator]();else if(e&&e[Symbol.iterator])i=e[Symbol.iterator]();else throw new o_("iterable",["Iterable"],e);var n=new t(n_({objectMode:!0},r)),o=!1;n._read=function(){o||(o=!0,a())};function a(){return h.apply(this,arguments)}function h(){return h=i_(function*(){try{var d=yield i.next(),m=d.value,p=d.done;p?n.push(null):n.push(yield m)?a():o=!1}catch(M){n.destroy(M)}}),h.apply(this,arguments)}return n}Vm.exports=a_});var y0=V((CA,np)=>{"use strict";np.exports=Oe;var Wo;Oe.ReadableState=Xm;var RA=require("events").EventEmitter,Ym=function(e,r){return e.listeners(r).length},y1=n0(),zu=require("buffer").Buffer,l_=global.Uint8Array||function(){};function u_(t){return zu.from(t)}function h_(t){return zu.isBuffer(t)||t instanceof l_}var S0=require("util"),ye;S0&&S0.debuglog?ye=S0.debuglog("stream"):ye=function(){};var c_=ym(),I0=a0(),f_=l0(),d_=f_.getHighWaterMark,Uu=pn().codes,m_=Uu.ERR_INVALID_ARG_TYPE,p_=Uu.ERR_STREAM_PUSH_AFTER_EOF,g_=Uu.ERR_METHOD_NOT_IMPLEMENTED,y_=Uu.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Ho,M0,E0;$o()(Oe,y1);var g1=I0.errorOrDestroy,R0=["error","close","destroy","pause","resume"];function b_(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}function Xm(t,e,r){Wo=Wo||fs(),t=t||{},typeof r!="boolean"&&(r=e instanceof Wo),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=d_(this,t,"readableHighWaterMark",r),this.buffer=new c_,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.paused=!0,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(Ho||(Ho=_0().StringDecoder),this.decoder=new Ho(t.encoding),this.encoding=t.encoding)}function Oe(t){if(Wo=Wo||fs(),!(this instanceof Oe))return new Oe(t);var e=this instanceof Wo;this._readableState=new Xm(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),y1.call(this)}Object.defineProperty(Oe.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){!this._readableState||(this._readableState.destroyed=e)}});Oe.prototype.destroy=I0.destroy;Oe.prototype._undestroy=I0.undestroy;Oe.prototype._destroy=function(t,e){e(t)};Oe.prototype.push=function(t,e){var r=this._readableState,i;return r.objectMode?i=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=zu.from(t,e),e=""),i=!0),Qm(this,t,e,!1,i)};Oe.prototype.unshift=function(t){return Qm(this,t,null,!0,!1)};function Qm(t,e,r,i,n){ye("readableAddChunk",e);var o=t._readableState;if(e===null)o.reading=!1,__(t,o);else{var a;if(n||(a=v_(o,e)),a)g1(t,a);else if(o.objectMode||e&&e.length>0)if(typeof e!="string"&&!o.objectMode&&Object.getPrototypeOf(e)!==zu.prototype&&(e=u_(e)),i)o.endEmitted?g1(t,new y_):C0(t,o,e,!0);else if(o.ended)g1(t,new p_);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||e.length!==0?C0(t,o,e,!1):T0(t,o)):C0(t,o,e,!1)}else i||(o.reading=!1,T0(t,o))}return!o.ended&&(o.length<o.highWaterMark||o.length===0)}function C0(t,e,r,i){e.flowing&&e.length===0&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&ju(t)),T0(t,e)}function v_(t,e){var r;return!h_(e)&&typeof e!="string"&&e!==void 0&&!t.objectMode&&(r=new m_("chunk",["string","Buffer","Uint8Array"],e)),r}Oe.prototype.isPaused=function(){return this._readableState.flowing===!1};Oe.prototype.setEncoding=function(t){Ho||(Ho=_0().StringDecoder);var e=new Ho(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,i="";r!==null;)i+=e.write(r.data),r=r.next;return this._readableState.buffer.clear(),i!==""&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var Jm=1073741824;function w_(t){return t>=Jm?t=Jm:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function Zm(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=w_(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}Oe.prototype.read=function(t){ye("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return ye("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?A0(this):ju(this),null;if(t=Zm(t,e),t===0&&e.ended)return e.length===0&&A0(this),null;var i=e.needReadable;ye("need readable",i),(e.length===0||e.length-t<e.highWaterMark)&&(i=!0,ye("length less than watermark",i)),e.ended||e.reading?(i=!1,ye("reading or ended",i)):i&&(ye("do read"),e.reading=!0,e.sync=!0,e.length===0&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=Zm(r,e)));var n;return t>0?n=rp(t,e):n=null,n===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&A0(this)),n!==null&&this.emit("data",n),n};function __(t,e){if(ye("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?ju(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,ep(t)))}}function ju(t){var e=t._readableState;ye("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(ye("emitReadable",e.flowing),e.emittedReadable=!0,process.nextTick(ep,t))}function ep(t){var e=t._readableState;ye("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,P0(t)}function T0(t,e){e.readingMore||(e.readingMore=!0,process.nextTick(x_,t,e))}function x_(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){var r=e.length;if(ye("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}Oe.prototype._read=function(t){g1(this,new g_("_read()"))};Oe.prototype.pipe=function(t,e){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t);break}i.pipesCount+=1,ye("pipe count=%d opts=%j",i.pipesCount,e);var n=(!e||e.end!==!1)&&t!==process.stdout&&t!==process.stderr,o=n?h:E;i.endEmitted?process.nextTick(o):r.once("end",o),t.on("unpipe",a);function a(T,C){ye("onunpipe"),T===r&&C&&C.hasUnpiped===!1&&(C.hasUnpiped=!0,p())}function h(){ye("onend"),t.end()}var d=S_(r);t.on("drain",d);var m=!1;function p(){ye("cleanup"),t.removeListener("close",x),t.removeListener("finish",w),t.removeListener("drain",d),t.removeListener("error",R),t.removeListener("unpipe",a),r.removeListener("end",h),r.removeListener("end",E),r.removeListener("data",M),m=!0,i.awaitDrain&&(!t._writableState||t._writableState.needDrain)&&d()}r.on("data",M);function M(T){ye("ondata");var C=t.write(T);ye("dest.write",C),C===!1&&((i.pipesCount===1&&i.pipes===t||i.pipesCount>1&&ip(i.pipes,t)!==-1)&&!m&&(ye("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function R(T){ye("onerror",T),E(),t.removeListener("error",R),Ym(t,"error")===0&&g1(t,T)}b_(t,"error",R);function x(){t.removeListener("finish",w),E()}t.once("close",x);function w(){ye("onfinish"),t.removeListener("close",x),E()}t.once("finish",w);function E(){ye("unpipe"),r.unpipe(t)}return t.emit("pipe",r),i.flowing||(ye("pipe resume"),r.resume()),t};function S_(t){return function(){var r=t._readableState;ye("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&Ym(t,"data")&&(r.flowing=!0,P0(t))}}Oe.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<n;o++)i[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=ip(e.pipes,t);return a===-1?this:(e.pipes.splice(a,1),e.pipesCount-=1,e.pipesCount===1&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r),this)};Oe.prototype.on=function(t,e){var r=y1.prototype.on.call(this,t,e),i=this._readableState;return t==="data"?(i.readableListening=this.listenerCount("readable")>0,i.flowing!==!1&&this.resume()):t==="readable"&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,ye("on readable",i.length,i.reading),i.length?ju(this):i.reading||process.nextTick(M_,this)),r};Oe.prototype.addListener=Oe.prototype.on;Oe.prototype.removeListener=function(t,e){var r=y1.prototype.removeListener.call(this,t,e);return t==="readable"&&process.nextTick(tp,this),r};Oe.prototype.removeAllListeners=function(t){var e=y1.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&process.nextTick(tp,this),e};function tp(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function M_(t){ye("readable nexttick read 0"),t.read(0)}Oe.prototype.resume=function(){var t=this._readableState;return t.flowing||(ye("resume"),t.flowing=!t.readableListening,E_(this,t)),t.paused=!1,this};function E_(t,e){e.resumeScheduled||(e.resumeScheduled=!0,process.nextTick(R_,t,e))}function R_(t,e){ye("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),P0(t),e.flowing&&!e.reading&&t.read(0)}Oe.prototype.pause=function(){return ye("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(ye("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function P0(t){var e=t._readableState;for(ye("flow",e.flowing);e.flowing&&t.read()!==null;);}Oe.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;t.on("end",function(){if(ye("wrapped end"),r.decoder&&!r.ended){var a=r.decoder.end();a&&a.length&&e.push(a)}e.push(null)}),t.on("data",function(a){if(ye("wrapped data"),r.decoder&&(a=r.decoder.write(a)),!(r.objectMode&&a==null)&&!(!r.objectMode&&(!a||!a.length))){var h=e.push(a);h||(i=!0,t.pause())}});for(var n in t)this[n]===void 0&&typeof t[n]=="function"&&(this[n]=function(h){return function(){return t[h].apply(t,arguments)}}(n));for(var o=0;o<R0.length;o++)t.on(R0[o],this.emit.bind(this,R0[o]));return this._read=function(a){ye("wrapped _read",a),i&&(i=!1,t.resume())},this};typeof Symbol=="function"&&(Oe.prototype[Symbol.asyncIterator]=function(){return M0===void 0&&(M0=Wm()),M0(this)});Object.defineProperty(Oe.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});Object.defineProperty(Oe.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}});Object.defineProperty(Oe.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}});Oe._fromList=rp;Object.defineProperty(Oe.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function rp(t,e){if(e.length===0)return null;var r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function A0(t){var e=t._readableState;ye("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,process.nextTick(C_,e,t))}function C_(t,e){if(ye("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}typeof Symbol=="function"&&(Oe.from=function(t,e){return E0===void 0&&(E0=Km()),E0(Oe,t,e)});function ip(t,e){for(var r=0,i=t.length;r<i;r++)if(t[r]===e)return r;return-1}});var O0=V((AA,op)=>{"use strict";op.exports=zi;var $u=pn().codes,A_=$u.ERR_METHOD_NOT_IMPLEMENTED,T_=$u.ERR_MULTIPLE_CALLBACK,I_=$u.ERR_TRANSFORM_ALREADY_TRANSFORMING,P_=$u.ERR_TRANSFORM_WITH_LENGTH_0,qu=fs();$o()(zi,qu);function O_(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(i===null)return this.emit("error",new T_);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}function zi(t){if(!(this instanceof zi))return new zi(t);qu.call(this,t),this._transformState={afterTransform:O_.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",k_)}function k_(){var t=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(e,r){sp(t,e,r)}):sp(this,null,null)}zi.prototype.push=function(t,e){return this._transformState.needTransform=!1,qu.prototype.push.call(this,t,e)};zi.prototype._transform=function(t,e,r){r(new A_("_transform()"))};zi.prototype._write=function(t,e,r){var i=this._transformState;if(i.writecb=r,i.writechunk=t,i.writeencoding=e,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}};zi.prototype._read=function(t){var e=this._transformState;e.writechunk!==null&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0};zi.prototype._destroy=function(t,e){qu.prototype._destroy.call(this,t,function(r){e(r)})};function sp(t,e,r){if(e)return t.emit("error",e);if(r!=null&&t.push(r),t._writableState.length)throw new P_;if(t._transformState.transforming)throw new I_;return t.push(null)}});var up=V((TA,lp)=>{"use strict";lp.exports=b1;var ap=O0();$o()(b1,ap);function b1(t){if(!(this instanceof b1))return new b1(t);ap.call(this,t)}b1.prototype._transform=function(t,e,r){r(null,t)}});var mp=V((IA,dp)=>{"use strict";var k0;function L_(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var fp=pn().codes,N_=fp.ERR_MISSING_ARGS,B_=fp.ERR_STREAM_DESTROYED;function hp(t){if(t)throw t}function D_(t){return t.setHeader&&typeof t.abort=="function"}function z_(t,e,r,i){i=L_(i);var n=!1;t.on("close",function(){n=!0}),k0===void 0&&(k0=Nu()),k0(t,{readable:e,writable:r},function(a){if(a)return i(a);n=!0,i()});var o=!1;return function(a){if(!n&&!o){if(o=!0,D_(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();i(a||new B_("pipe"))}}}function cp(t){t()}function U_(t,e){return t.pipe(e)}function j_(t){return!t.length||typeof t[t.length-1]!="function"?hp:t.pop()}function $_(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var i=j_(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new N_("streams");var n,o=e.map(function(a,h){var d=h<e.length-1,m=h>0;return z_(a,d,m,function(p){n||(n=p),p&&o.forEach(cp),!d&&(o.forEach(cp),i(n))})});return e.reduce(U_)}dp.exports=$_});var pp=V((Sr,w1)=>{var v1=require("stream");process.env.READABLE_STREAM==="disable"&&v1?(w1.exports=v1.Readable,Object.assign(w1.exports,v1),w1.exports.Stream=v1):(Sr=w1.exports=y0(),Sr.Stream=v1||Sr,Sr.Readable=Sr,Sr.Writable=m0(),Sr.Duplex=fs(),Sr.Transform=O0(),Sr.PassThrough=up(),Sr.finished=Nu(),Sr.pipeline=mp())});var vp=V((PA,bp)=>{"use strict";var{Transform:q_}=pp(),{StringDecoder:F_}=require("string_decoder"),wn=Symbol("last"),Fu=Symbol("decoder");function W_(t,e,r){var i;if(this.overflow){var n=this[Fu].write(t);if(i=n.split(this.matcher),i.length===1)return r();i.shift(),this.overflow=!1}else this[wn]+=this[Fu].write(t),i=this[wn].split(this.matcher);this[wn]=i.pop();for(var o=0;o<i.length;o++)yp(this,this.mapper(i[o]));if(this.overflow=this[wn].length>this.maxLength,this.overflow&&!this.skipOverflow)return r(new Error("maximum buffer reached"));r()}function H_(t){this[wn]+=this[Fu].end(),this[wn]&&yp(this,this.mapper(this[wn])),t()}function yp(t,e){e!==void 0&&t.push(e)}function gp(t){return t}function G_(t,e,r){switch(t=t||/\r?\n/,e=e||gp,r=r||{},arguments.length){case 1:typeof t=="function"?(e=t,t=/\r?\n/):typeof t=="object"&&!(t instanceof RegExp)&&(r=t,t=/\r?\n/);break;case 2:typeof t=="function"?(r=e,e=t,t=/\r?\n/):typeof e=="object"&&(r=e,e=gp)}r=Object.assign({},r),r.transform=W_,r.flush=H_,r.readableObjectMode=!0;let i=new q_(r);return i[wn]="",i[Fu]=new F_("utf8"),i.matcher=t,i.mapper=e,i.maxLength=r.maxLength,i.skipOverflow=r.skipOverflow,i.overflow=!1,i}bp.exports=G_});var Bp=V((bT,Np)=>{"use strict";Np.exports=Ku;Ku.polyline=Ku;Ku.polygon=ix;function Ku(t,e,r){var i=t.length,n=Ko(t[0],e),o=[],a,h,d,m,p;for(r||(r=[]),a=1;a<i;a++){for(h=t[a-1],d=t[a],m=p=Ko(d,e);;)if(n|m){if(n&m)break;n?(h=q0(h,d,n,e),n=Ko(h,e)):(d=q0(h,d,m,e),m=Ko(d,e))}else{o.push(h),m!==p?(o.push(d),a<i-1&&(r.push(o),o=[])):a===i-1&&o.push(d);break}n=p}return o.length&&r.push(o),r}function ix(t,e){var r,i,n,o,a,h,d;for(i=1;i<=8;i*=2){for(r=[],n=t[t.length-1],o=!(Ko(n,e)&i),a=0;a<t.length;a++)h=t[a],d=!(Ko(h,e)&i),d!==o&&r.push(q0(n,h,i,e)),d&&r.push(h),n=h,o=d;if(t=r,!t.length)break}return r}function q0(t,e,r,i){return r&8?[t[0]+(e[0]-t[0])*(i[3]-t[1])/(e[1]-t[1]),i[3]]:r&4?[t[0]+(e[0]-t[0])*(i[1]-t[1])/(e[1]-t[1]),i[1]]:r&2?[i[2],t[1]+(e[1]-t[1])*(i[2]-t[0])/(e[0]-t[0])]:r&1?[i[0],t[1]+(e[1]-t[1])*(i[0]-t[0])/(e[0]-t[0])]:null}function Ko(t,e){var r=0;return t[0]<e[0]?r|=1:t[0]>e[2]&&(r|=2),t[1]<e[1]?r|=4:t[1]>e[3]&&(r|=8),r}});var Dp=V((F0,W0)=>{(function(t,e){typeof F0=="object"&&typeof W0<"u"?W0.exports=e():typeof define=="function"&&define.amd?define(e):t.SplayTree=e()})(F0,function(){"use strict";var t=function(){function w(E,T){this.next=null,this.key=E,this.data=T,this.left=null,this.right=null}return w}();function e(w,E){return w>E?1:w<E?-1:0}function r(w,E,T){for(var C=new t(null,null),I=C,k=C;;){var B=T(w,E.key);if(B<0){if(E.left===null)break;if(T(w,E.left.key)<0){var z=E.left;if(E.left=z.right,z.right=E,E=z,E.left===null)break}k.left=E,k=E,E=E.left}else if(B>0){if(E.right===null)break;if(T(w,E.right.key)>0){var z=E.right;if(E.right=z.left,z.left=E,E=z,E.right===null)break}I.right=E,I=E,E=E.right}else break}return I.right=E.left,k.left=E.right,E.left=C.right,E.right=C.left,E}function i(w,E,T,C){var I=new t(w,E);if(T===null)return I.left=I.right=null,I;T=r(w,T,C);var k=C(w,T.key);return k<0?(I.left=T.left,I.right=T,T.left=null):k>=0&&(I.right=T.right,I.left=T,T.right=null),I}function n(w,E,T){var C=null,I=null;if(E){E=r(w,E,T);var k=T(E.key,w);k===0?(C=E.left,I=E.right):k<0?(I=E.right,E.right=null,C=E):(C=E.left,E.left=null,I=E)}return{left:C,right:I}}function o(w,E,T){return E===null?w:(w===null||(E=r(w.key,E,T),E.left=w),E)}function a(w,E,T,C,I){if(w){C(""+E+(T?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ")+I(w)+`
107
- `);var k=E+(T?" ":"\u2502 ");w.left&&a(w.left,k,!1,C,I),w.right&&a(w.right,k,!0,C,I)}}var h=function(){function w(E){E===void 0&&(E=e),this._root=null,this._size=0,this._comparator=E}return w.prototype.insert=function(E,T){return this._size++,this._root=i(E,T,this._root,this._comparator)},w.prototype.add=function(E,T){var C=new t(E,T);this._root===null&&(C.left=C.right=null,this._size++,this._root=C);var I=this._comparator,k=r(E,this._root,I),B=I(E,k.key);return B===0?this._root=k:(B<0?(C.left=k.left,C.right=k,k.left=null):B>0&&(C.right=k.right,C.left=k,k.right=null),this._size++,this._root=C),this._root},w.prototype.remove=function(E){this._root=this._remove(E,this._root,this._comparator)},w.prototype._remove=function(E,T,C){var I;if(T===null)return null;T=r(E,T,C);var k=C(E,T.key);return k===0?(T.left===null?I=T.right:(I=r(E,T.left,C),I.right=T.right),this._size--,I):T},w.prototype.pop=function(){var E=this._root;if(E){for(;E.left;)E=E.left;return this._root=r(E.key,this._root,this._comparator),this._root=this._remove(E.key,this._root,this._comparator),{key:E.key,data:E.data}}return null},w.prototype.findStatic=function(E){for(var T=this._root,C=this._comparator;T;){var I=C(E,T.key);if(I===0)return T;I<0?T=T.left:T=T.right}return null},w.prototype.find=function(E){return this._root&&(this._root=r(E,this._root,this._comparator),this._comparator(E,this._root.key)!==0)?null:this._root},w.prototype.contains=function(E){for(var T=this._root,C=this._comparator;T;){var I=C(E,T.key);if(I===0)return!0;I<0?T=T.left:T=T.right}return!1},w.prototype.forEach=function(E,T){for(var C=this._root,I=[],k=!1;!k;)C!==null?(I.push(C),C=C.left):I.length!==0?(C=I.pop(),E.call(T,C),C=C.right):k=!0;return this},w.prototype.range=function(E,T,C,I){for(var k=[],B=this._comparator,z=this._root,H;k.length!==0||z;)if(z)k.push(z),z=z.left;else{if(z=k.pop(),H=B(z.key,T),H>0)break;if(B(z.key,E)>=0&&C.call(I,z))return this;z=z.right}return this},w.prototype.keys=function(){var E=[];return this.forEach(function(T){var C=T.key;return E.push(C)}),E},w.prototype.values=function(){var E=[];return this.forEach(function(T){var C=T.data;return E.push(C)}),E},w.prototype.min=function(){return this._root?this.minNode(this._root).key:null},w.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},w.prototype.minNode=function(E){if(E===void 0&&(E=this._root),E)for(;E.left;)E=E.left;return E},w.prototype.maxNode=function(E){if(E===void 0&&(E=this._root),E)for(;E.right;)E=E.right;return E},w.prototype.at=function(E){for(var T=this._root,C=!1,I=0,k=[];!C;)if(T)k.push(T),T=T.left;else if(k.length>0){if(T=k.pop(),I===E)return T;I++,T=T.right}else C=!0;return null},w.prototype.next=function(E){var T=this._root,C=null;if(E.right){for(C=E.right;C.left;)C=C.left;return C}for(var I=this._comparator;T;){var k=I(E.key,T.key);if(k===0)break;k<0?(C=T,T=T.left):T=T.right}return C},w.prototype.prev=function(E){var T=this._root,C=null;if(E.left!==null){for(C=E.left;C.right;)C=C.right;return C}for(var I=this._comparator;T;){var k=I(E.key,T.key);if(k===0)break;k<0?T=T.left:(C=T,T=T.right)}return C},w.prototype.clear=function(){return this._root=null,this._size=0,this},w.prototype.toList=function(){return p(this._root)},w.prototype.load=function(E,T,C){T===void 0&&(T=[]),C===void 0&&(C=!1);var I=E.length,k=this._comparator;if(C&&x(E,T,0,I-1,k),this._root===null)this._root=d(E,T,0,I),this._size=I;else{var B=R(this.toList(),m(E,T),k);I=this._size+I,this._root=M({head:B},0,I)}return this},w.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(w.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),w.prototype.toString=function(E){E===void 0&&(E=function(C){return String(C.key)});var T=[];return a(this._root,"",!0,function(C){return T.push(C)},E),T.join("")},w.prototype.update=function(E,T,C){var I=this._comparator,k=n(E,this._root,I),B=k.left,z=k.right;I(E,T)<0?z=i(T,C,z,I):B=i(T,C,B,I),this._root=o(B,z,I)},w.prototype.split=function(E){return n(E,this._root,this._comparator)},w}();function d(w,E,T,C){var I=C-T;if(I>0){var k=T+Math.floor(I/2),B=w[k],z=E[k],H=new t(B,z);return H.left=d(w,E,T,k),H.right=d(w,E,k+1,C),H}return null}function m(w,E){for(var T=new t(null,null),C=T,I=0;I<w.length;I++)C=C.next=new t(w[I],E[I]);return C.next=null,T.next}function p(w){for(var E=w,T=[],C=!1,I=new t(null,null),k=I;!C;)E?(T.push(E),E=E.left):T.length>0?(E=k=k.next=T.pop(),E=E.right):C=!0;return k.next=null,I.next}function M(w,E,T){var C=T-E;if(C>0){var I=E+Math.floor(C/2),k=M(w,E,I),B=w.head;return B.left=k,w.head=w.head.next,B.right=M(w,I+1,T),B}return null}function R(w,E,T){for(var C=new t(null,null),I=C,k=w,B=E;k!==null&&B!==null;)T(k.key,B.key)<0?(I.next=k,k=k.next):(I.next=B,B=B.next),I=I.next;return k!==null?I.next=k:B!==null&&(I.next=B),C.next}function x(w,E,T,C,I){if(!(T>=C)){for(var k=w[T+C>>1],B=T-1,z=C+1;;){do B++;while(I(w[B],k)<0);do z--;while(I(w[z],k)>0);if(B>=z)break;var H=w[B];w[B]=w[z],w[z]=H,H=E[B],E[B]=E[z],E[z]=H}x(w,E,T,z,I),x(w,E,z+1,C,I)}}return h})});var Jp=V((vT,Kp)=>{"use strict";var nx=Dp();function sx(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var V0=sx(nx);function Mr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function zp(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function Nt(t,e,r){return e&&zp(t.prototype,e),r&&zp(t,r),t}var x1=function(e,r){return e.ll.x<=r.x&&r.x<=e.ur.x&&e.ll.y<=r.y&&r.y<=e.ur.y},H0=function(e,r){if(r.ur.x<e.ll.x||e.ur.x<r.ll.x||r.ur.y<e.ll.y||e.ur.y<r.ll.y)return null;var i=e.ll.x<r.ll.x?r.ll.x:e.ll.x,n=e.ur.x<r.ur.x?e.ur.x:r.ur.x,o=e.ll.y<r.ll.y?r.ll.y:e.ll.y,a=e.ur.y<r.ur.y?e.ur.y:r.ur.y;return{ll:{x:i,y:o},ur:{x:n,y:a}}},xn=Number.EPSILON;xn===void 0&&(xn=Math.pow(2,-52));var ox=xn*xn,G0=function(e,r){if(-xn<e&&e<xn&&-xn<r&&r<xn)return 0;var i=e-r;return i*i<ox*e*r?0:e<r?-1:1},ax=function(){function t(){Mr(this,t),this.reset()}return Nt(t,[{key:"reset",value:function(){this.xRounder=new Up,this.yRounder=new Up}},{key:"round",value:function(r,i){return{x:this.xRounder.round(r),y:this.yRounder.round(i)}}}]),t}(),Up=function(){function t(){Mr(this,t),this.tree=new V0.default,this.round(0)}return Nt(t,[{key:"round",value:function(r){var i=this.tree.add(r),n=this.tree.prev(i);if(n!==null&&G0(i.key,n.key)===0)return this.tree.remove(r),n.key;var o=this.tree.next(i);return o!==null&&G0(i.key,o.key)===0?(this.tree.remove(r),o.key):r}}]),t}(),M1=new ax,S1=function(e,r){return e.x*r.y-e.y*r.x},Vp=function(e,r){return e.x*r.x+e.y*r.y},jp=function(e,r,i){var n={x:r.x-e.x,y:r.y-e.y},o={x:i.x-e.x,y:i.y-e.y},a=S1(n,o);return G0(a,0)},Ju=function(e){return Math.sqrt(Vp(e,e))},lx=function(e,r,i){var n={x:r.x-e.x,y:r.y-e.y},o={x:i.x-e.x,y:i.y-e.y};return S1(o,n)/Ju(o)/Ju(n)},ux=function(e,r,i){var n={x:r.x-e.x,y:r.y-e.y},o={x:i.x-e.x,y:i.y-e.y};return Vp(o,n)/Ju(o)/Ju(n)},$p=function(e,r,i){return r.y===0?null:{x:e.x+r.x/r.y*(i-e.y),y:i}},qp=function(e,r,i){return r.x===0?null:{x:i,y:e.y+r.y/r.x*(i-e.x)}},hx=function(e,r,i,n){if(r.x===0)return qp(i,n,e.x);if(n.x===0)return qp(e,r,i.x);if(r.y===0)return $p(i,n,e.y);if(n.y===0)return $p(e,r,i.y);var o=S1(r,n);if(o==0)return null;var a={x:i.x-e.x,y:i.y-e.y},h=S1(a,r)/o,d=S1(a,n)/o,m=e.x+d*r.x,p=i.x+h*n.x,M=e.y+d*r.y,R=i.y+h*n.y,x=(m+p)/2,w=(M+R)/2;return{x,y:w}},ui=function(){Nt(t,null,[{key:"compare",value:function(r,i){var n=t.comparePoints(r.point,i.point);return n!==0?n:(r.point!==i.point&&r.link(i),r.isLeft!==i.isLeft?r.isLeft?1:-1:Zu.compare(r.segment,i.segment))}},{key:"comparePoints",value:function(r,i){return r.x<i.x?-1:r.x>i.x?1:r.y<i.y?-1:r.y>i.y?1:0}}]);function t(e,r){Mr(this,t),e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=r}return Nt(t,[{key:"link",value:function(r){if(r.point===this.point)throw new Error("Tried to link already linked events");for(var i=r.point.events,n=0,o=i.length;n<o;n++){var a=i[n];this.point.events.push(a),a.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var r=this.point.events.length,i=0;i<r;i++){var n=this.point.events[i];if(n.segment.consumedBy===void 0)for(var o=i+1;o<r;o++){var a=this.point.events[o];a.consumedBy===void 0&&n.otherSE.point.events===a.otherSE.point.events&&n.segment.consume(a.segment)}}}},{key:"getAvailableLinkedEvents",value:function(){for(var r=[],i=0,n=this.point.events.length;i<n;i++){var o=this.point.events[i];o!==this&&!o.segment.ringOut&&o.segment.isInResult()&&r.push(o)}return r}},{key:"getLeftmostComparator",value:function(r){var i=this,n=new Map,o=function(h){var d=h.otherSE;n.set(h,{sine:lx(i.point,r.point,d.point),cosine:ux(i.point,r.point,d.point)})};return function(a,h){n.has(a)||o(a),n.has(h)||o(h);var d=n.get(a),m=d.sine,p=d.cosine,M=n.get(h),R=M.sine,x=M.cosine;return m>=0&&R>=0?p<x?1:p>x?-1:0:m<0&&R<0?p<x?-1:p>x?1:0:R<m?-1:R>m?1:0}}}]),t}(),cx=0,Zu=function(){Nt(t,null,[{key:"compare",value:function(r,i){var n=r.leftSE.point.x,o=i.leftSE.point.x,a=r.rightSE.point.x,h=i.rightSE.point.x;if(h<n)return 1;if(a<o)return-1;var d=r.leftSE.point.y,m=i.leftSE.point.y,p=r.rightSE.point.y,M=i.rightSE.point.y;if(n<o){if(m<d&&m<p)return 1;if(m>d&&m>p)return-1;var R=r.comparePoint(i.leftSE.point);if(R<0)return 1;if(R>0)return-1;var x=i.comparePoint(r.rightSE.point);return x!==0?x:-1}if(n>o){if(d<m&&d<M)return-1;if(d>m&&d>M)return 1;var w=i.comparePoint(r.leftSE.point);if(w!==0)return w;var E=r.comparePoint(i.rightSE.point);return E<0?1:E>0?-1:1}if(d<m)return-1;if(d>m)return 1;if(a<h){var T=i.comparePoint(r.rightSE.point);if(T!==0)return T}if(a>h){var C=r.comparePoint(i.rightSE.point);if(C<0)return 1;if(C>0)return-1}if(a!==h){var I=p-d,k=a-n,B=M-m,z=h-o;if(I>k&&B<z)return 1;if(I<k&&B>z)return-1}return a>h?1:a<h||p<M?-1:p>M?1:r.id<i.id?-1:r.id>i.id?1:0}}]);function t(e,r,i,n){Mr(this,t),this.id=++cx,this.leftSE=e,e.segment=this,e.otherSE=r,this.rightSE=r,r.segment=this,r.otherSE=e,this.rings=i,this.windings=n}return Nt(t,[{key:"replaceRightSE",value:function(r){this.rightSE=r,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var r=this.leftSE.point.y,i=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:r<i?r:i},ur:{x:this.rightSE.point.x,y:r>i?r:i}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(r){return r.x===this.leftSE.point.x&&r.y===this.leftSE.point.y||r.x===this.rightSE.point.x&&r.y===this.rightSE.point.y}},{key:"comparePoint",value:function(r){if(this.isAnEndpoint(r))return 0;var i=this.leftSE.point,n=this.rightSE.point,o=this.vector();if(i.x===n.x)return r.x===i.x?0:r.x<i.x?1:-1;var a=(r.y-i.y)/o.y,h=i.x+a*o.x;if(r.x===h)return 0;var d=(r.x-i.x)/o.x,m=i.y+d*o.y;return r.y===m?0:r.y<m?-1:1}},{key:"getIntersection",value:function(r){var i=this.bbox(),n=r.bbox(),o=H0(i,n);if(o===null)return null;var a=this.leftSE.point,h=this.rightSE.point,d=r.leftSE.point,m=r.rightSE.point,p=x1(i,d)&&this.comparePoint(d)===0,M=x1(n,a)&&r.comparePoint(a)===0,R=x1(i,m)&&this.comparePoint(m)===0,x=x1(n,h)&&r.comparePoint(h)===0;if(M&&p)return x&&!R?h:!x&&R?m:null;if(M)return R&&a.x===m.x&&a.y===m.y?null:a;if(p)return x&&h.x===d.x&&h.y===d.y?null:d;if(x&&R)return null;if(x)return h;if(R)return m;var w=hx(a,this.vector(),d,r.vector());return w===null||!x1(o,w)?null:M1.round(w.x,w.y)}},{key:"split",value:function(r){var i=[],n=r.events!==void 0,o=new ui(r,!0),a=new ui(r,!1),h=this.rightSE;this.replaceRightSE(a),i.push(a),i.push(o);var d=new t(o,h,this.rings.slice(),this.windings.slice());return ui.comparePoints(d.leftSE.point,d.rightSE.point)>0&&d.swapEvents(),ui.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(o.checkForConsuming(),a.checkForConsuming()),i}},{key:"swapEvents",value:function(){var r=this.rightSE;this.rightSE=this.leftSE,this.leftSE=r,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var i=0,n=this.windings.length;i<n;i++)this.windings[i]*=-1}},{key:"consume",value:function(r){for(var i=this,n=r;i.consumedBy;)i=i.consumedBy;for(;n.consumedBy;)n=n.consumedBy;var o=t.compare(i,n);if(o!==0){if(o>0){var a=i;i=n,n=a}if(i.prev===n){var h=i;i=n,n=h}for(var d=0,m=n.rings.length;d<m;d++){var p=n.rings[d],M=n.windings[d],R=i.rings.indexOf(p);R===-1?(i.rings.push(p),i.windings.push(M)):i.windings[R]+=M}n.rings=null,n.windings=null,n.consumedBy=i,n.leftSE.consumedBy=i.leftSE,n.rightSE.consumedBy=i.rightSE}}},{key:"prevInResult",value:function(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}},{key:"beforeState",value:function(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{var r=this.prev.consumedBy||this.prev;this._beforeState=r.afterState()}return this._beforeState}},{key:"afterState",value:function(){if(this._afterState!==void 0)return this._afterState;var r=this.beforeState();this._afterState={rings:r.rings.slice(0),windings:r.windings.slice(0),multiPolys:[]};for(var i=this._afterState.rings,n=this._afterState.windings,o=this._afterState.multiPolys,a=0,h=this.rings.length;a<h;a++){var d=this.rings[a],m=this.windings[a],p=i.indexOf(d);p===-1?(i.push(d),n.push(m)):n[p]+=m}for(var M=[],R=[],x=0,w=i.length;x<w;x++)if(n[x]!==0){var E=i[x],T=E.poly;if(R.indexOf(T)===-1)if(E.isExterior)M.push(T);else{R.indexOf(T)===-1&&R.push(T);var C=M.indexOf(E.poly);C!==-1&&M.splice(C,1)}}for(var I=0,k=M.length;I<k;I++){var B=M[I].multiPoly;o.indexOf(B)===-1&&o.push(B)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;var r=this.beforeState().multiPolys,i=this.afterState().multiPolys;switch(Ur.type){case"union":{var n=r.length===0,o=i.length===0;this._isInResult=n!==o;break}case"intersection":{var a,h;r.length<i.length?(a=r.length,h=i.length):(a=i.length,h=r.length),this._isInResult=h===Ur.numMultiPolys&&a<h;break}case"xor":{var d=Math.abs(r.length-i.length);this._isInResult=d%2===1;break}case"difference":{var m=function(M){return M.length===1&&M[0].isSubject};this._isInResult=m(r)!==m(i);break}default:throw new Error("Unrecognized operation type found ".concat(Ur.type))}return this._isInResult}}],[{key:"fromRing",value:function(r,i,n){var o,a,h,d=ui.comparePoints(r,i);if(d<0)o=r,a=i,h=1;else if(d>0)o=i,a=r,h=-1;else throw new Error("Tried to create degenerate segment at [".concat(r.x,", ").concat(r.y,"]"));var m=new ui(o,!0),p=new ui(a,!1);return new t(m,p,[n],[h])}}]),t}(),Fp=function(){function t(e,r,i){if(Mr(this,t),!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=r,this.isExterior=i,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var n=M1.round(e[0][0],e[0][1]);this.bbox={ll:{x:n.x,y:n.y},ur:{x:n.x,y:n.y}};for(var o=n,a=1,h=e.length;a<h;a++){if(typeof e[a][0]!="number"||typeof e[a][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var d=M1.round(e[a][0],e[a][1]);d.x===o.x&&d.y===o.y||(this.segments.push(Zu.fromRing(o,d,this)),d.x<this.bbox.ll.x&&(this.bbox.ll.x=d.x),d.y<this.bbox.ll.y&&(this.bbox.ll.y=d.y),d.x>this.bbox.ur.x&&(this.bbox.ur.x=d.x),d.y>this.bbox.ur.y&&(this.bbox.ur.y=d.y),o=d)}(n.x!==o.x||n.y!==o.y)&&this.segments.push(Zu.fromRing(o,n,this))}return Nt(t,[{key:"getSweepEvents",value:function(){for(var r=[],i=0,n=this.segments.length;i<n;i++){var o=this.segments[i];r.push(o.leftSE),r.push(o.rightSE)}return r}}]),t}(),fx=function(){function t(e,r){if(Mr(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Fp(e[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var i=1,n=e.length;i<n;i++){var o=new Fp(e[i],this,!1);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=r}return Nt(t,[{key:"getSweepEvents",value:function(){for(var r=this.exteriorRing.getSweepEvents(),i=0,n=this.interiorRings.length;i<n;i++)for(var o=this.interiorRings[i].getSweepEvents(),a=0,h=o.length;a<h;a++)r.push(o[a]);return r}}]),t}(),Wp=function(){function t(e,r){if(Mr(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof e[0][0][0]=="number"&&(e=[e])}catch{}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var i=0,n=e.length;i<n;i++){var o=new fx(e[i],this);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=r}return Nt(t,[{key:"getSweepEvents",value:function(){for(var r=[],i=0,n=this.polys.length;i<n;i++)for(var o=this.polys[i].getSweepEvents(),a=0,h=o.length;a<h;a++)r.push(o[a]);return r}}]),t}(),dx=function(){Nt(t,null,[{key:"factory",value:function(r){for(var i=[],n=0,o=r.length;n<o;n++){var a=r[n];if(!(!a.isInResult()||a.ringOut)){for(var h=null,d=a.leftSE,m=a.rightSE,p=[d],M=d.point,R=[];h=d,d=m,p.push(d),d.point!==M;)for(;;){var x=d.getAvailableLinkedEvents();if(x.length===0){var w=p[0].point,E=p[p.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(w.x,",")+" ".concat(w.y,"]. Last matching segment found ends at")+" [".concat(E.x,", ").concat(E.y,"]."))}if(x.length===1){m=x[0].otherSE;break}for(var T=null,C=0,I=R.length;C<I;C++)if(R[C].point===d.point){T=C;break}if(T!==null){var k=R.splice(T)[0],B=p.splice(k.index);B.unshift(B[0].otherSE),i.push(new t(B.reverse()));continue}R.push({index:p.length,point:d.point});var z=d.getLeftmostComparator(h);m=x.sort(z)[0].otherSE;break}i.push(new t(p))}}return i}}]);function t(e){Mr(this,t),this.events=e;for(var r=0,i=e.length;r<i;r++)e[r].segment.ringOut=this;this.poly=null}return Nt(t,[{key:"getGeom",value:function(){for(var r=this.events[0].point,i=[r],n=1,o=this.events.length-1;n<o;n++){var a=this.events[n].point,h=this.events[n+1].point;jp(a,r,h)!==0&&(i.push(a),r=a)}if(i.length===1)return null;var d=i[0],m=i[1];jp(d,r,m)===0&&i.shift(),i.push(i[0]);for(var p=this.isExteriorRing()?1:-1,M=this.isExteriorRing()?0:i.length-1,R=this.isExteriorRing()?i.length:-1,x=[],w=M;w!=R;w+=p)x.push([i[w].x,i[w].y]);return x}},{key:"isExteriorRing",value:function(){if(this._isExteriorRing===void 0){var r=this.enclosingRing();this._isExteriorRing=r?!r.isExteriorRing():!0}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var r=this.events[0],i=1,n=this.events.length;i<n;i++){var o=this.events[i];ui.compare(r,o)>0&&(r=o)}for(var a=r.segment.prevInResult(),h=a?a.prevInResult():null;;){if(!a)return null;if(!h)return a.ringOut;if(h.ringOut!==a.ringOut)return h.ringOut.enclosingRing()!==a.ringOut?a.ringOut:a.ringOut.enclosingRing();a=h.prevInResult(),h=a?a.prevInResult():null}}}]),t}(),Hp=function(){function t(e){Mr(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return Nt(t,[{key:"addInterior",value:function(r){this.interiorRings.push(r),r.poly=this}},{key:"getGeom",value:function(){var r=[this.exteriorRing.getGeom()];if(r[0]===null)return null;for(var i=0,n=this.interiorRings.length;i<n;i++){var o=this.interiorRings[i].getGeom();o!==null&&r.push(o)}return r}}]),t}(),mx=function(){function t(e){Mr(this,t),this.rings=e,this.polys=this._composePolys(e)}return Nt(t,[{key:"getGeom",value:function(){for(var r=[],i=0,n=this.polys.length;i<n;i++){var o=this.polys[i].getGeom();o!==null&&r.push(o)}return r}},{key:"_composePolys",value:function(r){for(var i=[],n=0,o=r.length;n<o;n++){var a=r[n];if(!a.poly)if(a.isExteriorRing())i.push(new Hp(a));else{var h=a.enclosingRing();h.poly||i.push(new Hp(h)),h.poly.addInterior(a)}}return i}}]),t}(),px=function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Zu.compare;Mr(this,t),this.queue=e,this.tree=new V0.default(r),this.segments=[]}return Nt(t,[{key:"process",value:function(r){var i=r.segment,n=[];if(r.consumedBy)return r.isLeft?this.queue.remove(r.otherSE):this.tree.remove(i),n;var o=r.isLeft?this.tree.insert(i):this.tree.find(i);if(!o)throw new Error("Unable to find segment #".concat(i.id," ")+"[".concat(i.leftSE.point.x,", ").concat(i.leftSE.point.y,"] -> ")+"[".concat(i.rightSE.point.x,", ").concat(i.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var a=o,h=o,d=void 0,m=void 0;d===void 0;)a=this.tree.prev(a),a===null?d=null:a.key.consumedBy===void 0&&(d=a.key);for(;m===void 0;)h=this.tree.next(h),h===null?m=null:h.key.consumedBy===void 0&&(m=h.key);if(r.isLeft){var p=null;if(d){var M=d.getIntersection(i);if(M!==null&&(i.isAnEndpoint(M)||(p=M),!d.isAnEndpoint(M)))for(var R=this._splitSafely(d,M),x=0,w=R.length;x<w;x++)n.push(R[x])}var E=null;if(m){var T=m.getIntersection(i);if(T!==null&&(i.isAnEndpoint(T)||(E=T),!m.isAnEndpoint(T)))for(var C=this._splitSafely(m,T),I=0,k=C.length;I<k;I++)n.push(C[I])}if(p!==null||E!==null){var B=null;if(p===null)B=E;else if(E===null)B=p;else{var z=ui.comparePoints(p,E);B=z<=0?p:E}this.queue.remove(i.rightSE),n.push(i.rightSE);for(var H=i.split(B),J=0,se=H.length;J<se;J++)n.push(H[J])}n.length>0?(this.tree.remove(i),n.push(r)):(this.segments.push(i),i.prev=d)}else{if(d&&m){var Me=d.getIntersection(m);if(Me!==null){if(!d.isAnEndpoint(Me))for(var Ue=this._splitSafely(d,Me),Te=0,Ne=Ue.length;Te<Ne;Te++)n.push(Ue[Te]);if(!m.isAnEndpoint(Me))for(var st=this._splitSafely(m,Me),zt=0,di=st.length;zt<di;zt++)n.push(st[zt])}}this.tree.remove(i)}return n}},{key:"_splitSafely",value:function(r,i){this.tree.remove(r);var n=r.rightSE;this.queue.remove(n);var o=r.split(i);return o.push(n),r.consumedBy===void 0&&this.tree.insert(r),o}}]),t}(),Gp=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,gx=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,yx=function(){function t(){Mr(this,t)}return Nt(t,[{key:"run",value:function(r,i,n){Ur.type=r,M1.reset();for(var o=[new Wp(i,!0)],a=0,h=n.length;a<h;a++)o.push(new Wp(n[a],!1));if(Ur.numMultiPolys=o.length,Ur.type==="difference")for(var d=o[0],m=1;m<o.length;)H0(o[m].bbox,d.bbox)!==null?m++:o.splice(m,1);if(Ur.type==="intersection"){for(var p=0,M=o.length;p<M;p++)for(var R=o[p],x=p+1,w=o.length;x<w;x++)if(H0(R.bbox,o[x].bbox)===null)return[]}for(var E=new V0.default(ui.compare),T=0,C=o.length;T<C;T++)for(var I=o[T].getSweepEvents(),k=0,B=I.length;k<B;k++)if(E.insert(I[k]),E.size>Gp)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var z=new px(E),H=E.size,J=E.pop();J;){var se=J.key;if(E.size===H){var Me=se.segment;throw new Error("Unable to pop() ".concat(se.isLeft?"left":"right"," SweepEvent ")+"[".concat(se.point.x,", ").concat(se.point.y,"] from segment #").concat(Me.id," ")+"[".concat(Me.leftSE.point.x,", ").concat(Me.leftSE.point.y,"] -> ")+"[".concat(Me.rightSE.point.x,", ").concat(Me.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(E.size>Gp)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(z.segments.length>gx)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var Ue=z.process(se),Te=0,Ne=Ue.length;Te<Ne;Te++){var st=Ue[Te];st.consumedBy===void 0&&E.insert(st)}H=E.size,J=E.pop()}M1.reset();var zt=dx.factory(z.segments),di=new mx(zt);return di.getGeom()}}]),t}(),Ur=new yx,bx=function(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return Ur.run("union",e,i)},vx=function(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return Ur.run("intersection",e,i)},wx=function(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return Ur.run("xor",e,i)},_x=function(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return Ur.run("difference",e,i)},xx={union:bx,intersection:vx,xor:wx,difference:_x};Kp.exports=xx});var r6=V((J0,Z0)=>{(function(t,e){typeof J0=="object"&&typeof Z0<"u"?Z0.exports=e():typeof define=="function"&&define.amd?define(e):t.proj4=e()})(J0,function(){"use strict";var t=function(s){s("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),s("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),s("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"),s.WGS84=s["EPSG:4326"],s["EPSG:3785"]=s["EPSG:3857"],s.GOOGLE=s["EPSG:3857"],s["EPSG:900913"]=s["EPSG:3857"],s["EPSG:102113"]=s["EPSG:3857"]},e=1,r=2,i=3,n=4,o=5,a=6378137,h=6356752314e-3,d=.0066943799901413165,m=484813681109536e-20,p=Math.PI/2,M=.16666666666666666,R=.04722222222222222,x=.022156084656084655,w=1e-10,E=.017453292519943295,T=57.29577951308232,C=Math.PI/4,I=Math.PI*2,k=3.14159265359,B={};B.greenwich=0,B.lisbon=-9.131906111111,B.paris=2.337229166667,B.bogota=-74.080916666667,B.madrid=-3.687938888889,B.rome=12.452333333333,B.bern=7.439583333333,B.jakarta=106.807719444444,B.ferro=-17.666666666667,B.brussels=4.367975,B.stockholm=18.058277777778,B.athens=23.7163375,B.oslo=10.722916666667;var z={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}},H=/[\s_\-\/\(\)]/g;function J(s,l){if(s[l])return s[l];for(var c=Object.keys(s),y=l.toLowerCase().replace(H,""),g=-1,v,S;++g<c.length;)if(v=c[g],S=v.toLowerCase().replace(H,""),S===y)return s[v]}var se=function(s){var l={},c=s.split("+").map(function(b){return b.trim()}).filter(function(b){return b}).reduce(function(b,A){var O=A.split("=");return O.push(!0),b[O[0].toLowerCase()]=O[1],b},{}),y,g,v,S={proj:"projName",datum:"datumCode",rf:function(b){l.rf=parseFloat(b)},lat_0:function(b){l.lat0=b*E},lat_1:function(b){l.lat1=b*E},lat_2:function(b){l.lat2=b*E},lat_ts:function(b){l.lat_ts=b*E},lon_0:function(b){l.long0=b*E},lon_1:function(b){l.long1=b*E},lon_2:function(b){l.long2=b*E},alpha:function(b){l.alpha=parseFloat(b)*E},gamma:function(b){l.rectified_grid_angle=parseFloat(b)},lonc:function(b){l.longc=b*E},x_0:function(b){l.x0=parseFloat(b)},y_0:function(b){l.y0=parseFloat(b)},k_0:function(b){l.k0=parseFloat(b)},k:function(b){l.k0=parseFloat(b)},a:function(b){l.a=parseFloat(b)},b:function(b){l.b=parseFloat(b)},r_a:function(){l.R_A=!0},zone:function(b){l.zone=parseInt(b,10)},south:function(){l.utmSouth=!0},towgs84:function(b){l.datum_params=b.split(",").map(function(A){return parseFloat(A)})},to_meter:function(b){l.to_meter=parseFloat(b)},units:function(b){l.units=b;var A=J(z,b);A&&(l.to_meter=A.to_meter)},from_greenwich:function(b){l.from_greenwich=b*E},pm:function(b){var A=J(B,b);l.from_greenwich=(A||parseFloat(b))*E},nadgrids:function(b){b==="@null"?l.datumCode="none":l.nadgrids=b},axis:function(b){var A="ewnsud";b.length===3&&A.indexOf(b.substr(0,1))!==-1&&A.indexOf(b.substr(1,1))!==-1&&A.indexOf(b.substr(2,1))!==-1&&(l.axis=b)},approx:function(){l.approx=!0}};for(y in c)g=c[y],y in S?(v=S[y],typeof v=="function"?v(g):l[v]=g):l[y]=g;return typeof l.datumCode=="string"&&l.datumCode!=="WGS84"&&(l.datumCode=l.datumCode.toLowerCase()),l},Me=1,Ue=2,Te=3,Ne=4,st=5,zt=-1,di=/\s/,fa=/[A-Za-z]/,$h=/[A-Za-z84]/,In=/[,\]]/,da=/[\d\.E\-\+]/;function hr(s){if(typeof s!="string")throw new Error("not a string");this.text=s.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=Me}hr.prototype.readCharicter=function(){var s=this.text[this.place++];if(this.state!==Ne)for(;di.test(s);){if(this.place>=this.text.length)return;s=this.text[this.place++]}switch(this.state){case Me:return this.neutral(s);case Ue:return this.keyword(s);case Ne:return this.quoted(s);case st:return this.afterquote(s);case Te:return this.number(s);case zt:return}},hr.prototype.afterquote=function(s){if(s==='"'){this.word+='"',this.state=Ne;return}if(In.test(s)){this.word=this.word.trim(),this.afterItem(s);return}throw new Error(`havn't handled "`+s+'" in afterquote yet, index '+this.place)},hr.prototype.afterItem=function(s){if(s===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=Me;return}if(s==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=Me,this.currentObject=this.stack.pop(),this.currentObject||(this.state=zt);return}},hr.prototype.number=function(s){if(da.test(s)){this.word+=s;return}if(In.test(s)){this.word=parseFloat(this.word),this.afterItem(s);return}throw new Error(`havn't handled "`+s+'" in number yet, index '+this.place)},hr.prototype.quoted=function(s){if(s==='"'){this.state=st;return}this.word+=s},hr.prototype.keyword=function(s){if($h.test(s)){this.word+=s;return}if(s==="["){var l=[];l.push(this.word),this.level++,this.root===null?this.root=l:this.currentObject.push(l),this.stack.push(this.currentObject),this.currentObject=l,this.state=Me;return}if(In.test(s)){this.afterItem(s);return}throw new Error(`havn't handled "`+s+'" in keyword yet, index '+this.place)},hr.prototype.neutral=function(s){if(fa.test(s)){this.word=s,this.state=Ue;return}if(s==='"'){this.word="",this.state=Ne;return}if(da.test(s)){this.word=s,this.state=Te;return}if(In.test(s)){this.afterItem(s);return}throw new Error(`havn't handled "`+s+'" in neutral yet, index '+this.place)},hr.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===zt)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function ma(s){var l=new hr(s);return l.output()}function Is(s,l,c){Array.isArray(l)&&(c.unshift(l),l=null);var y=l?{}:s,g=c.reduce(function(v,S){return mi(S,v),v},y);l&&(s[l]=g)}function mi(s,l){if(!Array.isArray(s)){l[s]=!0;return}var c=s.shift();if(c==="PARAMETER"&&(c=s.shift()),s.length===1){if(Array.isArray(s[0])){l[c]={},mi(s[0],l[c]);return}l[c]=s[0];return}if(!s.length){l[c]=!0;return}if(c==="TOWGS84"){l[c]=s;return}if(c==="AXIS"){c in l||(l[c]=[]),l[c].push(s);return}Array.isArray(c)||(l[c]={});var y;switch(c){case"UNIT":case"PRIMEM":case"VERT_DATUM":l[c]={name:s[0].toLowerCase(),convert:s[1]},s.length===3&&mi(s[2],l[c]);return;case"SPHEROID":case"ELLIPSOID":l[c]={name:s[0],a:s[1],rf:s[2]},s.length===4&&mi(s[3],l[c]);return;case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"EDATUM":case"ENGINEERINGDATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":case"COMPD_CS":case"COMPOUNDCRS":case"ENGINEERINGCRS":case"ENGCRS":case"FITTED_CS":case"LOCAL_DATUM":case"DATUM":s[0]=["name",s[0]],Is(l,c,s);return;default:for(y=-1;++y<s.length;)if(!Array.isArray(s[y]))return mi(s,l[c]);return Is(l,c,s)}}var qh=.017453292519943295;function Fh(s,l){var c=l[0],y=l[1];!(c in s)&&y in s&&(s[c]=s[y],l.length===3&&(s[c]=l[2](s[c])))}function at(s){return s*qh}function Xt(s){if(s.type==="GEOGCS"?s.projName="longlat":s.type==="LOCAL_CS"?(s.projName="identity",s.local=!0):typeof s.PROJECTION=="object"?s.projName=Object.keys(s.PROJECTION)[0]:s.projName=s.PROJECTION,s.AXIS){for(var l="",c=0,y=s.AXIS.length;c<y;++c){var g=[s.AXIS[c][0].toLowerCase(),s.AXIS[c][1].toLowerCase()];g[0].indexOf("north")!==-1||(g[0]==="y"||g[0]==="lat")&&g[1]==="north"?l+="n":g[0].indexOf("south")!==-1||(g[0]==="y"||g[0]==="lat")&&g[1]==="south"?l+="s":g[0].indexOf("east")!==-1||(g[0]==="x"||g[0]==="lon")&&g[1]==="east"?l+="e":(g[0].indexOf("west")!==-1||(g[0]==="x"||g[0]==="lon")&&g[1]==="west")&&(l+="w")}l.length===2&&(l+="u"),l.length===3&&(s.axis=l)}s.UNIT&&(s.units=s.UNIT.name.toLowerCase(),s.units==="metre"&&(s.units="meter"),s.UNIT.convert&&(s.type==="GEOGCS"?s.DATUM&&s.DATUM.SPHEROID&&(s.to_meter=s.UNIT.convert*s.DATUM.SPHEROID.a):s.to_meter=s.UNIT.convert));var v=s.GEOGCS;s.type==="GEOGCS"&&(v=s),v&&(v.DATUM?s.datumCode=v.DATUM.name.toLowerCase():s.datumCode=v.name.toLowerCase(),s.datumCode.slice(0,2)==="d_"&&(s.datumCode=s.datumCode.slice(2)),(s.datumCode==="new_zealand_geodetic_datum_1949"||s.datumCode==="new_zealand_1949")&&(s.datumCode="nzgd49"),(s.datumCode==="wgs_1984"||s.datumCode==="world_geodetic_system_1984")&&(s.PROJECTION==="Mercator_Auxiliary_Sphere"&&(s.sphere=!0),s.datumCode="wgs84"),s.datumCode.slice(-6)==="_ferro"&&(s.datumCode=s.datumCode.slice(0,-6)),s.datumCode.slice(-8)==="_jakarta"&&(s.datumCode=s.datumCode.slice(0,-8)),~s.datumCode.indexOf("belge")&&(s.datumCode="rnb72"),v.DATUM&&v.DATUM.SPHEROID&&(s.ellps=v.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),s.ellps.toLowerCase().slice(0,13)==="international"&&(s.ellps="intl"),s.a=v.DATUM.SPHEROID.a,s.rf=parseFloat(v.DATUM.SPHEROID.rf,10)),v.DATUM&&v.DATUM.TOWGS84&&(s.datum_params=v.DATUM.TOWGS84),~s.datumCode.indexOf("osgb_1936")&&(s.datumCode="osgb36"),~s.datumCode.indexOf("osni_1952")&&(s.datumCode="osni52"),(~s.datumCode.indexOf("tm65")||~s.datumCode.indexOf("geodetic_datum_of_1965"))&&(s.datumCode="ire65"),s.datumCode==="ch1903+"&&(s.datumCode="ch1903"),~s.datumCode.indexOf("israel")&&(s.datumCode="isr93")),s.b&&!isFinite(s.b)&&(s.b=s.a);function S(O){var D=s.to_meter||1;return O*D}var b=function(O){return Fh(s,O)},A=[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",at],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",at],["x0","false_easting",S],["y0","false_northing",S],["long0","central_meridian",at],["lat0","latitude_of_origin",at],["lat0","standard_parallel_1",at],["lat1","standard_parallel_1",at],["lat2","standard_parallel_2",at],["azimuth","Azimuth"],["alpha","azimuth",at],["srsCode","name"]];A.forEach(b),!s.long0&&s.longc&&(s.projName==="Albers_Conic_Equal_Area"||s.projName==="Lambert_Azimuthal_Equal_Area")&&(s.long0=s.longc),!s.lat_ts&&s.lat1&&(s.projName==="Stereographic_South_Pole"||s.projName==="Polar Stereographic (variant B)")&&(s.lat0=at(s.lat1>0?90:-90),s.lat_ts=s.lat1)}var j1=function(s){var l=ma(s),c=l.shift(),y=l.shift();l.unshift(["name",y]),l.unshift(["type",c]);var g={};return mi(l,g),Xt(g),g};function ft(s){var l=this;if(arguments.length===2){var c=arguments[1];typeof c=="string"?c.charAt(0)==="+"?ft[s]=se(arguments[1]):ft[s]=j1(arguments[1]):ft[s]=c}else if(arguments.length===1){if(Array.isArray(s))return s.map(function(y){Array.isArray(y)?ft.apply(l,y):ft(y)});if(typeof s=="string"){if(s in ft)return ft[s]}else"EPSG"in s?ft["EPSG:"+s.EPSG]=s:"ESRI"in s?ft["ESRI:"+s.ESRI]=s:"IAU2000"in s?ft["IAU2000:"+s.IAU2000]=s:console.log(s);return}}t(ft);function Tr(s){return typeof s=="string"}function pa(s){return s in ft}var ga=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function $1(s){return ga.some(function(l){return s.indexOf(l)>-1})}var Wh=["3857","900913","3785","102113"];function q1(s){var l=J(s,"authority");if(!!l){var c=J(l,"epsg");return c&&Wh.indexOf(c)>-1}}function ya(s){var l=J(s,"extension");if(!!l)return J(l,"proj4")}function ji(s){return s[0]==="+"}function F1(s){if(Tr(s)){if(pa(s))return ft[s];if($1(s)){var l=j1(s);if(q1(l))return ft["EPSG:3857"];var c=ya(l);return c?se(c):l}if(ji(s))return se(s)}else return s}var Ps=function(s,l){s=s||{};var c,y;if(!l)return s;for(y in l)c=l[y],c!==void 0&&(s[y]=c);return s},Tt=function(s,l,c){var y=s*l;return c/Math.sqrt(1-y*y)},$i=function(s){return s<0?-1:1},Z=function(s){return Math.abs(s)<=k?s:s-$i(s)*I},ot=function(s,l,c){var y=s*c,g=.5*s;return y=Math.pow((1-y)/(1+y),g),Math.tan(.5*(p-l))/y},Ir=function(s,l){for(var c=.5*s,y,g,v=p-2*Math.atan(l),S=0;S<=15;S++)if(y=s*Math.sin(v),g=p-2*Math.atan(l*Math.pow((1-y)/(1+y),c))-v,v+=g,Math.abs(g)<=1e-10)return v;return-9999};function Os(){var s=this.b/this.a;this.es=1-s*s,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=Tt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function W1(s){var l=s.x,c=s.y;if(c*T>90&&c*T<-90&&l*T>180&&l*T<-180)return null;var y,g;if(Math.abs(Math.abs(c)-p)<=w)return null;if(this.sphere)y=this.x0+this.a*this.k0*Z(l-this.long0),g=this.y0+this.a*this.k0*Math.log(Math.tan(C+.5*c));else{var v=Math.sin(c),S=ot(this.e,c,v);y=this.x0+this.a*this.k0*Z(l-this.long0),g=this.y0-this.a*this.k0*Math.log(S)}return s.x=y,s.y=g,s}function H1(s){var l=s.x-this.x0,c=s.y-this.y0,y,g;if(this.sphere)g=p-2*Math.atan(Math.exp(-c/(this.a*this.k0)));else{var v=Math.exp(-c/(this.a*this.k0));if(g=Ir(this.e,v),g===-9999)return null}return y=Z(this.long0+l/(this.a*this.k0)),s.x=y,s.y=g,s}var G1=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"],Hh={init:Os,forward:W1,inverse:H1,names:G1};function V1(){}function ba(s){return s}var K1=["longlat","identity"],Pn={init:V1,forward:ba,inverse:ba,names:K1},J1=[Hh,Pn],va={},pi=[];function wa(s,l){var c=pi.length;return s.names?(pi[c]=s,s.names.forEach(function(y){va[y.toLowerCase()]=c}),this):(console.log(l),!0)}function Gh(s){if(!s)return!1;var l=s.toLowerCase();if(typeof va[l]<"u"&&pi[va[l]])return pi[va[l]]}function Z1(){J1.forEach(wa)}var _a={start:Z1,add:wa,get:Gh},ue={};ue.MERIT={a:6378137,rf:298.257,ellipseName:"MERIT 1983"},ue.SGS85={a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},ue.GRS80={a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},ue.IAU76={a:6378140,rf:298.257,ellipseName:"IAU 1976"},ue.airy={a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"},ue.APL4={a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},ue.NWL9D={a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},ue.mod_airy={a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"},ue.andrae={a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},ue.aust_SA={a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},ue.GRS67={a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},ue.bessel={a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"},ue.bess_nam={a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},ue.clrk66={a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"},ue.clrk80={a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."},ue.clrk58={a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"},ue.CPM={a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},ue.delmbr={a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},ue.engelis={a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"},ue.evrst30={a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"},ue.evrst48={a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"},ue.evrst56={a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"},ue.evrst69={a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"},ue.evrstSS={a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},ue.fschr60={a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},ue.fschr60m={a:6378155,rf:298.3,ellipseName:"Fischer 1960"},ue.fschr68={a:6378150,rf:298.3,ellipseName:"Fischer 1968"},ue.helmert={a:6378200,rf:298.3,ellipseName:"Helmert 1906"},ue.hough={a:6378270,rf:297,ellipseName:"Hough"},ue.intl={a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},ue.kaula={a:6378163,rf:298.24,ellipseName:"Kaula 1961"},ue.lerch={a:6378139,rf:298.257,ellipseName:"Lerch 1979"},ue.mprts={a:6397300,rf:191,ellipseName:"Maupertius 1738"},ue.new_intl={a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"},ue.plessis={a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},ue.krass={a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},ue.SEasia={a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"},ue.walbeck={a:6376896,b:63558348467e-4,ellipseName:"Walbeck"},ue.WGS60={a:6378165,rf:298.3,ellipseName:"WGS 60"},ue.WGS66={a:6378145,rf:298.25,ellipseName:"WGS 66"},ue.WGS7={a:6378135,rf:298.26,ellipseName:"WGS 72"};var Vh=ue.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};ue.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};function Fr(s,l,c,y){var g=s*s,v=l*l,S=(g-v)/g,b=0;y?(s*=1-S*(M+S*(R+S*x)),g=s*s,S=0):b=Math.sqrt(S);var A=(g-v)/v;return{es:S,e:b,ep2:A}}function On(s,l,c,y,g){if(!s){var v=J(ue,y);v||(v=Vh),s=v.a,l=v.b,c=v.rf}return c&&!l&&(l=(1-1/c)*s),(c===0||Math.abs(s-l)<w)&&(g=!0,l=s),{a:s,b:l,rf:c,sphere:g}}var Ke={};Ke.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},Ke.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},Ke.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},Ke.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},Ke.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},Ke.potsdam={towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},Ke.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},Ke.hermannskogel={towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},Ke.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},Ke.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},Ke.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},Ke.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},Ke.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"},Ke.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},Ke.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},Ke.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},Ke.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};function gi(s,l,c,y,g,v,S){var b={};return s===void 0||s==="none"?b.datum_type=o:b.datum_type=n,l&&(b.datum_params=l.map(parseFloat),(b.datum_params[0]!==0||b.datum_params[1]!==0||b.datum_params[2]!==0)&&(b.datum_type=e),b.datum_params.length>3&&(b.datum_params[3]!==0||b.datum_params[4]!==0||b.datum_params[5]!==0||b.datum_params[6]!==0)&&(b.datum_type=r,b.datum_params[3]*=m,b.datum_params[4]*=m,b.datum_params[5]*=m,b.datum_params[6]=b.datum_params[6]/1e6+1)),S&&(b.datum_type=i,b.grids=S),b.a=c,b.b=y,b.es=g,b.ep2=v,b}var ks={};function yi(s,l){var c=new DataView(l),y=Ls(c),g=X1(c,y);g.nSubgrids>1&&console.log("Only single NTv2 subgrids are currently supported, subsequent sub grids are ignored");var v=Q1(c,g,y),S={header:g,subgrids:v};return ks[s]=S,S}function Y1(s){if(s===void 0)return null;var l=s.split(",");return l.map(xa)}function xa(s){if(s.length===0)return null;var l=s[0]==="@";return l&&(s=s.slice(1)),s==="null"?{name:"null",mandatory:!l,grid:null,isNull:!0}:{name:s,mandatory:!l,grid:ks[s]||null,isNull:!1}}function bi(s){return s/3600*Math.PI/180}function Ls(s){var l=s.getInt32(8,!1);return l===11?!1:(l=s.getInt32(8,!0),l!==11&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian"),!0)}function X1(s,l){return{nFields:s.getInt32(8,l),nSubgridFields:s.getInt32(24,l),nSubgrids:s.getInt32(40,l),shiftType:Ns(s,56,56+8).trim(),fromSemiMajorAxis:s.getFloat64(120,l),fromSemiMinorAxis:s.getFloat64(136,l),toSemiMajorAxis:s.getFloat64(152,l),toSemiMinorAxis:s.getFloat64(168,l)}}function Ns(s,l,c){return String.fromCharCode.apply(null,new Uint8Array(s.buffer.slice(l,c)))}function Q1(s,l,c){for(var y=176,g=[],v=0;v<l.nSubgrids;v++){var S=el(s,y,c),b=Kh(s,y,S,c),A=Math.round(1+(S.upperLongitude-S.lowerLongitude)/S.longitudeInterval),O=Math.round(1+(S.upperLatitude-S.lowerLatitude)/S.latitudeInterval);g.push({ll:[bi(S.lowerLongitude),bi(S.lowerLatitude)],del:[bi(S.longitudeInterval),bi(S.latitudeInterval)],lim:[A,O],count:S.gridNodeCount,cvs:Sa(b)})}return g}function Sa(s){return s.map(function(l){return[bi(l.longitudeShift),bi(l.latitudeShift)]})}function el(s,l,c){return{name:Ns(s,l+8,l+16).trim(),parent:Ns(s,l+24,l+24+8).trim(),lowerLatitude:s.getFloat64(l+72,c),upperLatitude:s.getFloat64(l+88,c),lowerLongitude:s.getFloat64(l+104,c),upperLongitude:s.getFloat64(l+120,c),latitudeInterval:s.getFloat64(l+136,c),longitudeInterval:s.getFloat64(l+152,c),gridNodeCount:s.getInt32(l+168,c)}}function Kh(s,l,c,y){for(var g=l+176,v=16,S=[],b=0;b<c.gridNodeCount;b++){var A={latitudeShift:s.getFloat32(g+b*v,y),longitudeShift:s.getFloat32(g+b*v+4,y),latitudeAccuracy:s.getFloat32(g+b*v+8,y),longitudeAccuracy:s.getFloat32(g+b*v+12,y)};S.push(A)}return S}function cr(s,l){if(!(this instanceof cr))return new cr(s);l=l||function(O){if(O)throw O};var c=F1(s);if(typeof c!="object"){l(s);return}var y=cr.projections.get(c.projName);if(!y){l(s);return}if(c.datumCode&&c.datumCode!=="none"){var g=J(Ke,c.datumCode);g&&(c.datum_params=c.datum_params||(g.towgs84?g.towgs84.split(","):null),c.ellps=g.ellipse,c.datumName=g.datumName?g.datumName:c.datumCode)}c.k0=c.k0||1,c.axis=c.axis||"enu",c.ellps=c.ellps||"wgs84",c.lat1=c.lat1||c.lat0;var v=On(c.a,c.b,c.rf,c.ellps,c.sphere),S=Fr(v.a,v.b,v.rf,c.R_A),b=Y1(c.nadgrids),A=c.datum||gi(c.datumCode,c.datum_params,v.a,v.b,S.es,S.ep2,b);Ps(this,c),Ps(this,y),this.a=v.a,this.b=v.b,this.rf=v.rf,this.sphere=v.sphere,this.es=S.es,this.e=S.e,this.ep2=S.ep2,this.datum=A,this.init(),l(null,this)}cr.projections=_a,cr.projections.start();function Jh(s,l){return s.datum_type!==l.datum_type||s.a!==l.a||Math.abs(s.es-l.es)>5e-11?!1:s.datum_type===e?s.datum_params[0]===l.datum_params[0]&&s.datum_params[1]===l.datum_params[1]&&s.datum_params[2]===l.datum_params[2]:s.datum_type===r?s.datum_params[0]===l.datum_params[0]&&s.datum_params[1]===l.datum_params[1]&&s.datum_params[2]===l.datum_params[2]&&s.datum_params[3]===l.datum_params[3]&&s.datum_params[4]===l.datum_params[4]&&s.datum_params[5]===l.datum_params[5]&&s.datum_params[6]===l.datum_params[6]:!0}function Ma(s,l,c){var y=s.x,g=s.y,v=s.z?s.z:0,S,b,A,O;if(g<-p&&g>-1.001*p)g=-p;else if(g>p&&g<1.001*p)g=p;else{if(g<-p)return{x:-1/0,y:-1/0,z:s.z};if(g>p)return{x:1/0,y:1/0,z:s.z}}return y>Math.PI&&(y-=2*Math.PI),b=Math.sin(g),O=Math.cos(g),A=b*b,S=c/Math.sqrt(1-l*A),{x:(S+v)*O*Math.cos(y),y:(S+v)*O*Math.sin(y),z:(S*(1-l)+v)*b}}function kn(s,l,c,y){var g=1e-12,v=g*g,S=30,b,A,O,D,L,U,W,F,G,K,ie,he,ge,Fe=s.x,ke=s.y,De=s.z?s.z:0,St,tt,Xr;if(b=Math.sqrt(Fe*Fe+ke*ke),A=Math.sqrt(Fe*Fe+ke*ke+De*De),b/c<g){if(St=0,A/c<g)return tt=p,Xr=-y,{x:s.x,y:s.y,z:s.z}}else St=Math.atan2(ke,Fe);O=De/A,D=b/A,L=1/Math.sqrt(1-l*(2-l)*D*D),F=D*(1-l)*L,G=O*L,ge=0;do ge++,W=c/Math.sqrt(1-l*G*G),Xr=b*F+De*G-W*(1-l*G*G),U=l*W/(W+Xr),L=1/Math.sqrt(1-U*(2-U)*D*D),K=D*(1-U)*L,ie=O*L,he=ie*F-K*G,F=K,G=ie;while(he*he>v&&ge<S);return tt=Math.atan(ie/Math.abs(K)),{x:St,y:tt,z:Xr}}function Zh(s,l,c){if(l===e)return{x:s.x+c[0],y:s.y+c[1],z:s.z+c[2]};if(l===r){var y=c[0],g=c[1],v=c[2],S=c[3],b=c[4],A=c[5],O=c[6];return{x:O*(s.x-A*s.y+b*s.z)+y,y:O*(A*s.x+s.y-S*s.z)+g,z:O*(-b*s.x+S*s.y+s.z)+v}}}function Bs(s,l,c){if(l===e)return{x:s.x-c[0],y:s.y-c[1],z:s.z-c[2]};if(l===r){var y=c[0],g=c[1],v=c[2],S=c[3],b=c[4],A=c[5],O=c[6],D=(s.x-y)/O,L=(s.y-g)/O,U=(s.z-v)/O;return{x:D+A*L-b*U,y:-A*D+L+S*U,z:b*D-S*L+U}}}function Wr(s){return s===e||s===r}var Ds=function(s,l,c){if(Jh(s,l)||s.datum_type===o||l.datum_type===o)return c;var y=s.a,g=s.es;if(s.datum_type===i){var v=Ut(s,!1,c);if(v!==0)return;y=a,g=d}var S=l.a,b=l.b,A=l.es;if(l.datum_type===i&&(S=a,b=h,A=d),g===A&&y===S&&!Wr(s.datum_type)&&!Wr(l.datum_type))return c;if(c=Ma(c,g,y),Wr(s.datum_type)&&(c=Zh(c,s.datum_type,s.datum_params)),Wr(l.datum_type)&&(c=Bs(c,l.datum_type,l.datum_params)),c=kn(c,A,S,b),l.datum_type===i){var O=Ut(l,!0,c);if(O!==0)return}return c};function Ut(s,l,c){if(s.grids===null||s.grids.length===0)return console.log("Grid shift grids not found"),-1;for(var y={x:-c.x,y:c.y},g={x:Number.NaN,y:Number.NaN},v=[],S=0;S<s.grids.length;S++){var b=s.grids[S];if(v.push(b.name),b.isNull){g=y;break}if(b.grid===null){if(b.mandatory)return console.log("Unable to find mandatory grid '"+b.name+"'"),-1;continue}var A=b.grid.subgrids[0],O=(Math.abs(A.del[1])+Math.abs(A.del[0]))/1e4,D=A.ll[0]-O,L=A.ll[1]-O,U=A.ll[0]+(A.lim[0]-1)*A.del[0]+O,W=A.ll[1]+(A.lim[1]-1)*A.del[1]+O;if(!(L>y.y||D>y.x||W<y.y||U<y.x)&&(g=Ea(y,l,A),!isNaN(g.x)))break}return isNaN(g.x)?(console.log("Failed to find a grid shift table for location '"+-y.x*T+" "+y.y*T+" tried: '"+v+"'"),-1):(c.x=-g.x,c.y=g.y,0)}function Ea(s,l,c){var y={x:Number.NaN,y:Number.NaN};if(isNaN(s.x))return y;var g={x:s.x,y:s.y};g.x-=c.ll[0],g.y-=c.ll[1],g.x=Z(g.x-Math.PI)+Math.PI;var v=Ra(g,c);if(l){if(isNaN(v.x))return y;v.x=g.x-v.x,v.y=g.y-v.y;var S=9,b=1e-12,A,O;do{if(O=Ra(v,c),isNaN(O.x)){console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.");break}A={x:g.x-(O.x+v.x),y:g.y-(O.y+v.y)},v.x+=A.x,v.y+=A.y}while(S--&&Math.abs(A.x)>b&&Math.abs(A.y)>b);if(S<0)return console.log("Inverse grid shift iterator failed to converge."),y;y.x=Z(v.x+c.ll[0]),y.y=v.y+c.ll[1]}else isNaN(v.x)||(y.x=s.x+v.x,y.y=s.y+v.y);return y}function Ra(s,l){var c={x:s.x/l.del[0],y:s.y/l.del[1]},y={x:Math.floor(c.x),y:Math.floor(c.y)},g={x:c.x-1*y.x,y:c.y-1*y.y},v={x:Number.NaN,y:Number.NaN},S;if(y.x<0||y.x>=l.lim[0]||y.y<0||y.y>=l.lim[1])return v;S=y.y*l.lim[0]+y.x;var b={x:l.cvs[S][0],y:l.cvs[S][1]};S++;var A={x:l.cvs[S][0],y:l.cvs[S][1]};S+=l.lim[0];var O={x:l.cvs[S][0],y:l.cvs[S][1]};S--;var D={x:l.cvs[S][0],y:l.cvs[S][1]},L=g.x*g.y,U=g.x*(1-g.y),W=(1-g.x)*(1-g.y),F=(1-g.x)*g.y;return v.x=W*b.x+U*A.x+F*D.x+L*O.x,v.y=W*b.y+U*A.y+F*D.y+L*O.y,v}var Ln=function(s,l,c){var y=c.x,g=c.y,v=c.z||0,S,b,A,O={};for(A=0;A<3;A++)if(!(l&&A===2&&c.z===void 0))switch(A===0?(S=y,"ew".indexOf(s.axis[A])!==-1?b="x":b="y"):A===1?(S=g,"ns".indexOf(s.axis[A])!==-1?b="y":b="x"):(S=v,b="z"),s.axis[A]){case"e":O[b]=S;break;case"w":O[b]=-S;break;case"n":O[b]=S;break;case"s":O[b]=-S;break;case"u":c[b]!==void 0&&(O.z=S);break;case"d":c[b]!==void 0&&(O.z=-S);break;default:return null}return O},Nn=function(s){var l={x:s[0],y:s[1]};return s.length>2&&(l.z=s[2]),s.length>3&&(l.m=s[3]),l},tl=function(s){rl(s.x),rl(s.y)};function rl(s){if(typeof Number.isFinite=="function"){if(Number.isFinite(s))return;throw new TypeError("coordinates must be finite numbers")}if(typeof s!="number"||s!==s||!isFinite(s))throw new TypeError("coordinates must be finite numbers")}function Yh(s,l){return(s.datum.datum_type===e||s.datum.datum_type===r)&&l.datumCode!=="WGS84"||(l.datum.datum_type===e||l.datum.datum_type===r)&&s.datumCode!=="WGS84"}function qi(s,l,c,y){var g;if(Array.isArray(c)&&(c=Nn(c)),tl(c),s.datum&&l.datum&&Yh(s,l)&&(g=new cr("WGS84"),c=qi(s,g,c,y),s=g),y&&s.axis!=="enu"&&(c=Ln(s,!1,c)),s.projName==="longlat")c={x:c.x*E,y:c.y*E,z:c.z||0};else if(s.to_meter&&(c={x:c.x*s.to_meter,y:c.y*s.to_meter,z:c.z||0}),c=s.inverse(c),!c)return;if(s.from_greenwich&&(c.x+=s.from_greenwich),c=Ds(s.datum,l.datum,c),!!c)return l.from_greenwich&&(c={x:c.x-l.from_greenwich,y:c.y,z:c.z||0}),l.projName==="longlat"?c={x:c.x*T,y:c.y*T,z:c.z||0}:(c=l.forward(c),l.to_meter&&(c={x:c.x/l.to_meter,y:c.y/l.to_meter,z:c.z||0})),y&&l.axis!=="enu"?Ln(l,!0,c):c}var Fi=cr("WGS84");function zs(s,l,c,y){var g,v,S;return Array.isArray(c)?(g=qi(s,l,c,y)||{x:NaN,y:NaN},c.length>2?typeof s.name<"u"&&s.name==="geocent"||typeof l.name<"u"&&l.name==="geocent"?typeof g.z=="number"?[g.x,g.y,g.z].concat(c.splice(3)):[g.x,g.y,c[2]].concat(c.splice(3)):[g.x,g.y].concat(c.splice(2)):[g.x,g.y]):(v=qi(s,l,c,y),S=Object.keys(c),S.length===2||S.forEach(function(b){if(typeof s.name<"u"&&s.name==="geocent"||typeof l.name<"u"&&l.name==="geocent"){if(b==="x"||b==="y"||b==="z")return}else if(b==="x"||b==="y")return;v[b]=c[b]}),v)}function Ca(s){return s instanceof cr?s:s.oProj?s.oProj:cr(s)}function It(s,l,c){s=Ca(s);var y=!1,g;return typeof l>"u"?(l=s,s=Fi,y=!0):(typeof l.x<"u"||Array.isArray(l))&&(c=l,l=s,s=Fi,y=!0),l=Ca(l),c?zs(s,l,c):(g={forward:function(v,S){return zs(s,l,v,S)},inverse:function(v,S){return zs(l,s,v,S)}},y&&(g.oProj=l),g)}var Aa=6,Us="AJSAJS",Wi="AFAFAF",jt=65,mt=73,pt=79,Pr=86,Hr=90,js={forward:il,inverse:Xh,toPoint:nl};function il(s,l){return l=l||5,tc(Qh({lat:s[1],lon:s[0]}),l)}function Xh(s){var l=$s(al(s.toUpperCase()));return l.lat&&l.lon?[l.lon,l.lat,l.lon,l.lat]:[l.left,l.bottom,l.right,l.top]}function nl(s){var l=$s(al(s.toUpperCase()));return l.lat&&l.lon?[l.lon,l.lat]:[(l.left+l.right)/2,(l.top+l.bottom)/2]}function Ta(s){return s*(Math.PI/180)}function sl(s){return 180*(s/Math.PI)}function Qh(s){var l=s.lat,c=s.lon,y=6378137,g=.00669438,v=.9996,S,b,A,O,D,L,U,W=Ta(l),F=Ta(c),G,K;K=Math.floor((c+180)/6)+1,c===180&&(K=60),l>=56&&l<64&&c>=3&&c<12&&(K=32),l>=72&&l<84&&(c>=0&&c<9?K=31:c>=9&&c<21?K=33:c>=21&&c<33?K=35:c>=33&&c<42&&(K=37)),S=(K-1)*6-180+3,G=Ta(S),b=g/(1-g),A=y/Math.sqrt(1-g*Math.sin(W)*Math.sin(W)),O=Math.tan(W)*Math.tan(W),D=b*Math.cos(W)*Math.cos(W),L=Math.cos(W)*(F-G),U=y*((1-g/4-3*g*g/64-5*g*g*g/256)*W-(3*g/8+3*g*g/32+45*g*g*g/1024)*Math.sin(2*W)+(15*g*g/256+45*g*g*g/1024)*Math.sin(4*W)-35*g*g*g/3072*Math.sin(6*W));var ie=v*A*(L+(1-O+D)*L*L*L/6+(5-18*O+O*O+72*D-58*b)*L*L*L*L*L/120)+5e5,he=v*(U+A*Math.tan(W)*(L*L/2+(5-O+9*D+4*D*D)*L*L*L*L/24+(61-58*O+O*O+600*D-330*b)*L*L*L*L*L*L/720));return l<0&&(he+=1e7),{northing:Math.round(he),easting:Math.round(ie),zoneNumber:K,zoneLetter:ec(l)}}function $s(s){var l=s.northing,c=s.easting,y=s.zoneLetter,g=s.zoneNumber;if(g<0||g>60)return null;var v=.9996,S=6378137,b=.00669438,A,O=(1-Math.sqrt(1-b))/(1+Math.sqrt(1-b)),D,L,U,W,F,G,K,ie,he,ge=c-5e5,Fe=l;y<"N"&&(Fe-=1e7),K=(g-1)*6-180+3,A=b/(1-b),G=Fe/v,ie=G/(S*(1-b/4-3*b*b/64-5*b*b*b/256)),he=ie+(3*O/2-27*O*O*O/32)*Math.sin(2*ie)+(21*O*O/16-55*O*O*O*O/32)*Math.sin(4*ie)+151*O*O*O/96*Math.sin(6*ie),D=S/Math.sqrt(1-b*Math.sin(he)*Math.sin(he)),L=Math.tan(he)*Math.tan(he),U=A*Math.cos(he)*Math.cos(he),W=S*(1-b)/Math.pow(1-b*Math.sin(he)*Math.sin(he),1.5),F=ge/(D*v);var ke=he-D*Math.tan(he)/W*(F*F/2-(5+3*L+10*U-4*U*U-9*A)*F*F*F*F/24+(61+90*L+298*U+45*L*L-252*A-3*U*U)*F*F*F*F*F*F/720);ke=sl(ke);var De=(F-(1+2*L+U)*F*F*F/6+(5-2*U+28*L-3*U*U+8*A+24*L*L)*F*F*F*F*F/120)/Math.cos(he);De=K+sl(De);var St;if(s.accuracy){var tt=$s({northing:s.northing+s.accuracy,easting:s.easting+s.accuracy,zoneLetter:s.zoneLetter,zoneNumber:s.zoneNumber});St={top:tt.lat,right:tt.lon,bottom:ke,left:De}}else St={lat:ke,lon:De};return St}function ec(s){var l="Z";return 84>=s&&s>=72?l="X":72>s&&s>=64?l="W":64>s&&s>=56?l="V":56>s&&s>=48?l="U":48>s&&s>=40?l="T":40>s&&s>=32?l="S":32>s&&s>=24?l="R":24>s&&s>=16?l="Q":16>s&&s>=8?l="P":8>s&&s>=0?l="N":0>s&&s>=-8?l="M":-8>s&&s>=-16?l="L":-16>s&&s>=-24?l="K":-24>s&&s>=-32?l="J":-32>s&&s>=-40?l="H":-40>s&&s>=-48?l="G":-48>s&&s>=-56?l="F":-56>s&&s>=-64?l="E":-64>s&&s>=-72?l="D":-72>s&&s>=-80&&(l="C"),l}function tc(s,l){var c="00000"+s.easting,y="00000"+s.northing;return s.zoneNumber+s.zoneLetter+rc(s.easting,s.northing,s.zoneNumber)+c.substr(c.length-5,l)+y.substr(y.length-5,l)}function rc(s,l,c){var y=Hi(c),g=Math.floor(s/1e5),v=Math.floor(l/1e5)%20;return ol(g,v,y)}function Hi(s){var l=s%Aa;return l===0&&(l=Aa),l}function ol(s,l,c){var y=c-1,g=Us.charCodeAt(y),v=Wi.charCodeAt(y),S=g+s-1,b=v+l,A=!1;S>Hr&&(S=S-Hr+jt-1,A=!0),(S===mt||g<mt&&S>mt||(S>mt||g<mt)&&A)&&S++,(S===pt||g<pt&&S>pt||(S>pt||g<pt)&&A)&&(S++,S===mt&&S++),S>Hr&&(S=S-Hr+jt-1),b>Pr?(b=b-Pr+jt-1,A=!0):A=!1,(b===mt||v<mt&&b>mt||(b>mt||v<mt)&&A)&&b++,(b===pt||v<pt&&b>pt||(b>pt||v<pt)&&A)&&(b++,b===mt&&b++),b>Pr&&(b=b-Pr+jt-1);var O=String.fromCharCode(S)+String.fromCharCode(b);return O}function al(s){if(s&&s.length===0)throw"MGRSPoint coverting from nothing";for(var l=s.length,c=null,y="",g,v=0;!/[A-Z]/.test(g=s.charAt(v));){if(v>=2)throw"MGRSPoint bad conversion from: "+s;y+=g,v++}var S=parseInt(y,10);if(v===0||v+3>l)throw"MGRSPoint bad conversion from: "+s;var b=s.charAt(v++);if(b<="A"||b==="B"||b==="Y"||b>="Z"||b==="I"||b==="O")throw"MGRSPoint zone letter "+b+" not handled: "+s;c=s.substring(v,v+=2);for(var A=Hi(S),O=ll(c.charAt(0),A),D=Gi(c.charAt(1),A);D<Vi(b);)D+=2e6;var L=l-v;if(L%2!==0)throw`MGRSPoint has to have an even number
105
+ `),Te=mv.bind(null,{[X9]:"",[Q9]:a,[tm]:J,[em]:Cu,[Qf]:z,[rm]:H}),Ne="";p!==null&&(M===void 0?Ne=Te(p):Ne=Te(Object.assign({},p,{name:M})));let st=h instanceof Function?h:h?am:Ov,zt=st().indexOf(":")+1;if(T&&!x)throw Error("customLevels is required if useOnlyCustomLevels is set true");if(w&&typeof w!="function")throw Error(`Unknown mixin type "${typeof w}" - expected "function"`);hv(R,x,T);let di=om(x,T);return Object.assign(e,{levels:di,[Av]:T,[_v]:i,[vv]:st,[wv]:zt,[em]:Cu,[Qf]:z,[tm]:J,[Sv]:Ue,[Mv]:Me,[Ev]:d,[Rv]:m,[Iv]:m?`,${JSON.stringify(m)}:{`:"",[Q9]:a,[Cv]:w,[Pv]:E,[X9]:Ne,[rm]:H,[Tv]:I,silent:gv}),Object.setPrototypeOf(e,lv()),cv(e),e[xv](R),e}_r.exports=e0;_r.exports.destination=(t=process.stdout.fd)=>typeof t=="object"?(t.dest=Y9(t.dest||process.stdout.fd),Z9(t)):Z9({dest:Y9(t),minLength:0});_r.exports.transport=Df();_r.exports.multistream=J9();_r.exports.levels=om();_r.exports.stdSerializers=zv;_r.exports.stdTimeFunctions=Object.assign({},nm);_r.exports.symbols=sm;_r.exports.version=yv;_r.exports.default=e0;_r.exports.pino=e0});var cm=V((lA,c1)=>{"use strict";var Uv=process.env.TERM_PROGRAM==="Hyper",jv=process.platform==="win32",lm=process.platform==="linux",r0={ballotDisabled:"\u2612",ballotOff:"\u2610",ballotOn:"\u2611",bullet:"\u2022",bulletWhite:"\u25E6",fullBlock:"\u2588",heart:"\u2764",identicalTo:"\u2261",line:"\u2500",mark:"\u203B",middot:"\xB7",minus:"\uFF0D",multiplication:"\xD7",obelus:"\xF7",pencilDownRight:"\u270E",pencilRight:"\u270F",pencilUpRight:"\u2710",percent:"%",pilcrow2:"\u2761",pilcrow:"\xB6",plusMinus:"\xB1",section:"\xA7",starsOff:"\u2606",starsOn:"\u2605",upDownArrow:"\u2195"},um=Object.assign({},r0,{check:"\u221A",cross:"\xD7",ellipsisLarge:"...",ellipsis:"...",info:"i",question:"?",questionSmall:"?",pointer:">",pointerSmall:"\xBB",radioOff:"( )",radioOn:"(*)",warning:"\u203C"}),hm=Object.assign({},r0,{ballotCross:"\u2718",check:"\u2714",cross:"\u2716",ellipsisLarge:"\u22EF",ellipsis:"\u2026",info:"\u2139",question:"?",questionFull:"\uFF1F",questionSmall:"\uFE56",pointer:lm?"\u25B8":"\u276F",pointerSmall:lm?"\u2023":"\u203A",radioOff:"\u25EF",radioOn:"\u25C9",warning:"\u26A0"});c1.exports=jv&&!Uv?um:hm;Reflect.defineProperty(c1.exports,"common",{enumerable:!1,value:r0});Reflect.defineProperty(c1.exports,"windows",{enumerable:!1,value:um});Reflect.defineProperty(c1.exports,"other",{enumerable:!1,value:hm})});var dm=V((uA,i0)=>{"use strict";var $v=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),qv=/[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g,fm=()=>{let t={enabled:!0,visible:!0,styles:{},keys:{}};"FORCE_COLOR"in process.env&&(t.enabled=process.env.FORCE_COLOR!=="0");let e=o=>{let a=o.open=`\x1B[${o.codes[0]}m`,h=o.close=`\x1B[${o.codes[1]}m`,d=o.regex=new RegExp(`\\u001b\\[${o.codes[1]}m`,"g");return o.wrap=(m,p)=>{m.includes(h)&&(m=m.replace(d,h+a));let M=a+m+h;return p?M.replace(/\r*\n/g,`${h}$&${a}`):M},o},r=(o,a,h)=>typeof o=="function"?o(a):o.wrap(a,h),i=(o,a)=>{if(o===""||o==null)return"";if(t.enabled===!1)return o;if(t.visible===!1)return"";let h=""+o,d=h.includes(`
106
+ `),m=a.length;for(m>0&&a.includes("unstyle")&&(a=[...new Set(["unstyle",...a])].reverse());m-- >0;)h=r(t.styles[a[m]],h,d);return h},n=(o,a,h)=>{t.styles[o]=e({name:o,codes:a}),(t.keys[h]||(t.keys[h]=[])).push(o),Reflect.defineProperty(t,o,{configurable:!0,enumerable:!0,set(m){t.alias(o,m)},get(){let m=p=>i(p,m.stack);return Reflect.setPrototypeOf(m,t),m.stack=this.stack?this.stack.concat(o):[o],m}})};return n("reset",[0,0],"modifier"),n("bold",[1,22],"modifier"),n("dim",[2,22],"modifier"),n("italic",[3,23],"modifier"),n("underline",[4,24],"modifier"),n("inverse",[7,27],"modifier"),n("hidden",[8,28],"modifier"),n("strikethrough",[9,29],"modifier"),n("black",[30,39],"color"),n("red",[31,39],"color"),n("green",[32,39],"color"),n("yellow",[33,39],"color"),n("blue",[34,39],"color"),n("magenta",[35,39],"color"),n("cyan",[36,39],"color"),n("white",[37,39],"color"),n("gray",[90,39],"color"),n("grey",[90,39],"color"),n("bgBlack",[40,49],"bg"),n("bgRed",[41,49],"bg"),n("bgGreen",[42,49],"bg"),n("bgYellow",[43,49],"bg"),n("bgBlue",[44,49],"bg"),n("bgMagenta",[45,49],"bg"),n("bgCyan",[46,49],"bg"),n("bgWhite",[47,49],"bg"),n("blackBright",[90,39],"bright"),n("redBright",[91,39],"bright"),n("greenBright",[92,39],"bright"),n("yellowBright",[93,39],"bright"),n("blueBright",[94,39],"bright"),n("magentaBright",[95,39],"bright"),n("cyanBright",[96,39],"bright"),n("whiteBright",[97,39],"bright"),n("bgBlackBright",[100,49],"bgBright"),n("bgRedBright",[101,49],"bgBright"),n("bgGreenBright",[102,49],"bgBright"),n("bgYellowBright",[103,49],"bgBright"),n("bgBlueBright",[104,49],"bgBright"),n("bgMagentaBright",[105,49],"bgBright"),n("bgCyanBright",[106,49],"bgBright"),n("bgWhiteBright",[107,49],"bgBright"),t.ansiRegex=qv,t.hasColor=t.hasAnsi=o=>(t.ansiRegex.lastIndex=0,typeof o=="string"&&o!==""&&t.ansiRegex.test(o)),t.alias=(o,a)=>{let h=typeof a=="string"?t[a]:a;if(typeof h!="function")throw new TypeError("Expected alias to be the name of an existing color (string) or a function");h.stack||(Reflect.defineProperty(h,"name",{value:o}),t.styles[o]=h,h.stack=[o]),Reflect.defineProperty(t,o,{configurable:!0,enumerable:!0,set(d){t.alias(o,d)},get(){let d=m=>i(m,d.stack);return Reflect.setPrototypeOf(d,t),d.stack=this.stack?this.stack.concat(h.stack):h.stack,d}})},t.theme=o=>{if(!$v(o))throw new TypeError("Expected theme to be an object");for(let a of Object.keys(o))t.alias(a,o[a]);return t},t.alias("unstyle",o=>typeof o=="string"&&o!==""?(t.ansiRegex.lastIndex=0,o.replace(t.ansiRegex,"")):""),t.alias("noop",o=>o),t.none=t.clear=t.noop,t.stripColor=t.unstyle,t.symbols=cm(),t.define=n,t};i0.exports=fm();i0.exports.create=fm});var n0=V((cA,mm)=>{mm.exports=require("stream")});var bm=V((fA,ym)=>{"use strict";function pm(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Wv(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?pm(Object(r),!0).forEach(function(i){Hv(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):pm(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function Hv(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Gv(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function gm(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function Vv(t,e,r){return e&&gm(t.prototype,e),r&&gm(t,r),t}var Kv=require("buffer"),Au=Kv.Buffer,Jv=require("util"),s0=Jv.inspect,Zv=s0&&s0.custom||"inspect";function Yv(t,e,r){Au.prototype.copy.call(t,e,r)}ym.exports=function(){function t(){Gv(this,t),this.head=null,this.tail=null,this.length=0}return Vv(t,[{key:"push",value:function(r){var i={data:r,next:null};this.length>0?this.tail.next=i:this.head=i,this.tail=i,++this.length}},{key:"unshift",value:function(r){var i={data:r,next:this.head};this.length===0&&(this.tail=i),this.head=i,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var i=this.head,n=""+i.data;i=i.next;)n+=r+i.data;return n}},{key:"concat",value:function(r){if(this.length===0)return Au.alloc(0);for(var i=Au.allocUnsafe(r>>>0),n=this.head,o=0;n;)Yv(n.data,i,o),o+=n.data.length,n=n.next;return i}},{key:"consume",value:function(r,i){var n;return r<this.head.data.length?(n=this.head.data.slice(0,r),this.head.data=this.head.data.slice(r)):r===this.head.data.length?n=this.shift():n=i?this._getString(r):this._getBuffer(r),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(r){var i=this.head,n=1,o=i.data;for(r-=o.length;i=i.next;){var a=i.data,h=r>a.length?a.length:r;if(h===a.length?o+=a:o+=a.slice(0,r),r-=h,r===0){h===a.length?(++n,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=a.slice(h));break}++n}return this.length-=n,o}},{key:"_getBuffer",value:function(r){var i=Au.allocUnsafe(r),n=this.head,o=1;for(n.data.copy(i),r-=n.data.length;n=n.next;){var a=n.data,h=r>a.length?a.length:r;if(a.copy(i,i.length-r,0,h),r-=h,r===0){h===a.length?(++o,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=a.slice(h));break}++o}return this.length-=o,i}},{key:Zv,value:function(r,i){return s0(this,Wv({},i,{depth:0,customInspect:!1}))}}]),t}()});var a0=V((dA,wm)=>{"use strict";function Xv(t,e){var r=this,i=this._readableState&&this._readableState.destroyed,n=this._writableState&&this._writableState.destroyed;return i||n?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(o0,this,t)):process.nextTick(o0,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(o){!e&&o?r._writableState?r._writableState.errorEmitted?process.nextTick(Tu,r):(r._writableState.errorEmitted=!0,process.nextTick(vm,r,o)):process.nextTick(vm,r,o):e?(process.nextTick(Tu,r),e(o)):process.nextTick(Tu,r)}),this)}function vm(t,e){o0(t,e),Tu(t)}function Tu(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function Qv(){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.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function o0(t,e){t.emit("error",e)}function ew(t,e){var r=t._readableState,i=t._writableState;r&&r.autoDestroy||i&&i.autoDestroy?t.destroy(e):t.emit("error",e)}wm.exports={destroy:Xv,undestroy:Qv,errorOrDestroy:ew}});var pn=V((mA,Sm)=>{"use strict";var xm={};function xr(t,e,r){r||(r=Error);function i(o,a,h){return typeof e=="string"?e:e(o,a,h)}class n extends r{constructor(a,h,d){super(i(a,h,d))}}n.prototype.name=r.name,n.prototype.code=t,xm[t]=n}function _m(t,e){if(Array.isArray(t)){let r=t.length;return t=t.map(i=>String(i)),r>2?`one of ${e} ${t.slice(0,r-1).join(", ")}, or `+t[r-1]:r===2?`one of ${e} ${t[0]} or ${t[1]}`:`of ${e} ${t[0]}`}else return`of ${e} ${String(t)}`}function tw(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function rw(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function iw(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}xr("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);xr("ERR_INVALID_ARG_TYPE",function(t,e,r){let i;typeof e=="string"&&tw(e,"not ")?(i="must not be",e=e.replace(/^not /,"")):i="must be";let n;if(rw(t," argument"))n=`The ${t} ${i} ${_m(e,"type")}`;else{let o=iw(t,".")?"property":"argument";n=`The "${t}" ${o} ${i} ${_m(e,"type")}`}return n+=`. Received type ${typeof r}`,n},TypeError);xr("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");xr("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});xr("ERR_STREAM_PREMATURE_CLOSE","Premature close");xr("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});xr("ERR_MULTIPLE_CALLBACK","Callback called multiple times");xr("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");xr("ERR_STREAM_WRITE_AFTER_END","write after end");xr("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);xr("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);xr("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");Sm.exports.codes=xm});var l0=V((pA,Mm)=>{"use strict";var nw=pn().codes.ERR_INVALID_OPT_VALUE;function sw(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function ow(t,e,r,i){var n=sw(e,i,r);if(n!=null){if(!(isFinite(n)&&Math.floor(n)===n)||n<0){var o=i?r:"highWaterMark";throw new nw(o,n)}return Math.floor(n)}return t.objectMode?16:16*1024}Mm.exports={getHighWaterMark:ow}});var Em=V((gA,u0)=>{typeof Object.create=="function"?u0.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:u0.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}}});var $o=V((yA,c0)=>{try{if(h0=require("util"),typeof h0.inherits!="function")throw"";c0.exports=h0.inherits}catch{c0.exports=Em()}var h0});var Cm=V((bA,Rm)=>{Rm.exports=require("util").deprecate});var m0=V((vA,km)=>{"use strict";km.exports=rt;function Tm(t){var e=this;this.next=null,this.entry=null,this.finish=function(){kw(e,t)}}var qo;rt.WritableState=d1;var aw={deprecate:Cm()},Im=n0(),Pu=require("buffer").Buffer,lw=global.Uint8Array||function(){};function uw(t){return Pu.from(t)}function hw(t){return Pu.isBuffer(t)||t instanceof lw}var d0=a0(),cw=l0(),fw=cw.getHighWaterMark,gn=pn().codes,dw=gn.ERR_INVALID_ARG_TYPE,mw=gn.ERR_METHOD_NOT_IMPLEMENTED,pw=gn.ERR_MULTIPLE_CALLBACK,gw=gn.ERR_STREAM_CANNOT_PIPE,yw=gn.ERR_STREAM_DESTROYED,bw=gn.ERR_STREAM_NULL_VALUES,vw=gn.ERR_STREAM_WRITE_AFTER_END,ww=gn.ERR_UNKNOWN_ENCODING,Fo=d0.errorOrDestroy;$o()(rt,Im);function _w(){}function d1(t,e,r){qo=qo||cs(),t=t||{},typeof r!="boolean"&&(r=e instanceof qo),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=fw(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var i=t.decodeStrings===!1;this.decodeStrings=!i,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(n){Aw(e,n)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new Tm(this)}d1.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(d1.prototype,"buffer",{get:aw.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var Iu;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Iu=Function.prototype[Symbol.hasInstance],Object.defineProperty(rt,Symbol.hasInstance,{value:function(e){return Iu.call(this,e)?!0:this!==rt?!1:e&&e._writableState instanceof d1}})):Iu=function(e){return e instanceof this};function rt(t){qo=qo||cs();var e=this instanceof qo;if(!e&&!Iu.call(rt,this))return new rt(t);this._writableState=new d1(t,this,e),this.writable=!0,t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final)),Im.call(this)}rt.prototype.pipe=function(){Fo(this,new gw)};function xw(t,e){var r=new vw;Fo(t,r),process.nextTick(e,r)}function Sw(t,e,r,i){var n;return r===null?n=new bw:typeof r!="string"&&!e.objectMode&&(n=new dw("chunk",["string","Buffer"],r)),n?(Fo(t,n),process.nextTick(i,n),!1):!0}rt.prototype.write=function(t,e,r){var i=this._writableState,n=!1,o=!i.objectMode&&hw(t);return o&&!Pu.isBuffer(t)&&(t=uw(t)),typeof e=="function"&&(r=e,e=null),o?e="buffer":e||(e=i.defaultEncoding),typeof r!="function"&&(r=_w),i.ending?xw(this,r):(o||Sw(this,i,t,r))&&(i.pendingcb++,n=Ew(this,i,o,t,e,r)),n};rt.prototype.cork=function(){this._writableState.corked++};rt.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&Pm(this,t))};rt.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new ww(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(rt.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function Mw(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=Pu.from(e,r)),e}Object.defineProperty(rt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Ew(t,e,r,i,n,o){if(!r){var a=Mw(e,i,n);i!==a&&(r=!0,n="buffer",i=a)}var h=e.objectMode?1:i.length;e.length+=h;var d=e.length<e.highWaterMark;if(d||(e.needDrain=!0),e.writing||e.corked){var m=e.lastBufferedRequest;e.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:o,next:null},m?m.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else f0(t,e,!1,h,i,n,o);return d}function f0(t,e,r,i,n,o,a){e.writelen=i,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new yw("write")):r?t._writev(n,e.onwrite):t._write(n,o,e.onwrite),e.sync=!1}function Rw(t,e,r,i,n){--e.pendingcb,r?(process.nextTick(n,i),process.nextTick(f1,t,e),t._writableState.errorEmitted=!0,Fo(t,i)):(n(i),t._writableState.errorEmitted=!0,Fo(t,i),f1(t,e))}function Cw(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}function Aw(t,e){var r=t._writableState,i=r.sync,n=r.writecb;if(typeof n!="function")throw new pw;if(Cw(r),e)Rw(t,r,i,e,n);else{var o=Om(r)||t.destroyed;!o&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&Pm(t,r),i?process.nextTick(Am,t,r,o,n):Am(t,r,o,n)}}function Am(t,e,r,i){r||Tw(t,e),e.pendingcb--,i(),f1(t,e)}function Tw(t,e){e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}function Pm(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var i=e.bufferedRequestCount,n=new Array(i),o=e.corkedRequestsFree;o.entry=r;for(var a=0,h=!0;r;)n[a]=r,r.isBuf||(h=!1),r=r.next,a+=1;n.allBuffers=h,f0(t,e,!0,e.length,n,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new Tm(e),e.bufferedRequestCount=0}else{for(;r;){var d=r.chunk,m=r.encoding,p=r.callback,M=e.objectMode?1:d.length;if(f0(t,e,!1,M,d,m,p),r=r.next,e.bufferedRequestCount--,e.writing)break}r===null&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}rt.prototype._write=function(t,e,r){r(new mw("_write()"))};rt.prototype._writev=null;rt.prototype.end=function(t,e,r){var i=this._writableState;return typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null),t!=null&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||Ow(this,i,r),this};Object.defineProperty(rt.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function Om(t){return t.ending&&t.length===0&&t.bufferedRequest===null&&!t.finished&&!t.writing}function Iw(t,e){t._final(function(r){e.pendingcb--,r&&Fo(t,r),e.prefinished=!0,t.emit("prefinish"),f1(t,e)})}function Pw(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.pendingcb++,e.finalCalled=!0,process.nextTick(Iw,t,e)):(e.prefinished=!0,t.emit("prefinish")))}function f1(t,e){var r=Om(e);if(r&&(Pw(t,e),e.pendingcb===0&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return r}function Ow(t,e,r){e.ending=!0,f1(t,e),r&&(e.finished?process.nextTick(r):t.once("finish",r)),e.ended=!0,t.writable=!1}function kw(t,e,r){var i=t.entry;for(t.entry=null;i;){var n=i.callback;e.pendingcb--,n(r),i=i.next}e.corkedRequestsFree.next=t}Object.defineProperty(rt.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){!this._writableState||(this._writableState.destroyed=e)}});rt.prototype.destroy=d0.destroy;rt.prototype._undestroy=d0.undestroy;rt.prototype._destroy=function(t,e){e(t)}});var cs=V((wA,Nm)=>{"use strict";var Lw=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};Nm.exports=ai;var Lm=y0(),g0=m0();$o()(ai,Lm);for(p0=Lw(g0.prototype),Ou=0;Ou<p0.length;Ou++)ku=p0[Ou],ai.prototype[ku]||(ai.prototype[ku]=g0.prototype[ku]);var p0,ku,Ou;function ai(t){if(!(this instanceof ai))return new ai(t);Lm.call(this,t),g0.call(this,t),this.allowHalfOpen=!0,t&&(t.readable===!1&&(this.readable=!1),t.writable===!1&&(this.writable=!1),t.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",Nw)))}Object.defineProperty(ai.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});Object.defineProperty(ai.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});Object.defineProperty(ai.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function Nw(){this._writableState.ended||process.nextTick(Bw,this)}function Bw(t){t.end()}Object.defineProperty(ai.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(e){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=e,this._writableState.destroyed=e)}})});var zm=V((b0,Dm)=>{var Lu=require("buffer"),li=Lu.Buffer;function Bm(t,e){for(var r in t)e[r]=t[r]}li.from&&li.alloc&&li.allocUnsafe&&li.allocUnsafeSlow?Dm.exports=Lu:(Bm(Lu,b0),b0.Buffer=fs);function fs(t,e,r){return li(t,e,r)}fs.prototype=Object.create(li.prototype);Bm(li,fs);fs.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return li(t,e,r)};fs.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=li(t);return e!==void 0?typeof r=="string"?i.fill(e,r):i.fill(e):i.fill(0),i};fs.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return li(t)};fs.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Lu.SlowBuffer(t)}});var _0=V(jm=>{"use strict";var w0=zm().Buffer,Um=w0.isEncoding||function(t){switch(t=""+t,t&&t.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 Dw(t){if(!t)return"utf8";for(var e;;)switch(t){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 t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function zw(t){var e=Dw(t);if(typeof e!="string"&&(w0.isEncoding===Um||!Um(t)))throw new Error("Unknown encoding: "+t);return e||t}jm.StringDecoder=m1;function m1(t){this.encoding=zw(t);var e;switch(this.encoding){case"utf16le":this.text=Ww,this.end=Hw,e=4;break;case"utf8":this.fillLast=$w,e=4;break;case"base64":this.text=Gw,this.end=Vw,e=3;break;default:this.write=Kw,this.end=Jw;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=w0.allocUnsafe(e)}m1.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""};m1.prototype.end=Fw;m1.prototype.text=qw;m1.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length};function v0(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function Uw(t,e,r){var i=e.length-1;if(i<r)return 0;var n=v0(e[i]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--i<r||n===-2?0:(n=v0(e[i]),n>=0?(n>0&&(t.lastNeed=n-2),n):--i<r||n===-2?0:(n=v0(e[i]),n>=0?(n>0&&(n===2?n=0:t.lastNeed=n-3),n):0))}function jw(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function $w(t){var e=this.lastTotal-this.lastNeed,r=jw(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function qw(t,e){var r=Uw(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)}function Fw(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Ww(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function Hw(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function Gw(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function Vw(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Kw(t){return t.toString(this.encoding)}function Jw(t){return t&&t.length?this.write(t):""}});var Nu=V((xA,Fm)=>{"use strict";var $m=pn().codes.ERR_STREAM_PREMATURE_CLOSE;function Zw(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];t.apply(this,i)}}}function Yw(){}function Xw(t){return t.setHeader&&typeof t.abort=="function"}function qm(t,e,r){if(typeof e=="function")return qm(t,null,e);e||(e={}),r=Zw(r||Yw);var i=e.readable||e.readable!==!1&&t.readable,n=e.writable||e.writable!==!1&&t.writable,o=function(){t.writable||h()},a=t._writableState&&t._writableState.finished,h=function(){n=!1,a=!0,i||r.call(t)},d=t._readableState&&t._readableState.endEmitted,m=function(){i=!1,d=!0,n||r.call(t)},p=function(w){r.call(t,w)},M=function(){var w;if(i&&!d)return(!t._readableState||!t._readableState.ended)&&(w=new $m),r.call(t,w);if(n&&!a)return(!t._writableState||!t._writableState.ended)&&(w=new $m),r.call(t,w)},R=function(){t.req.on("finish",h)};return Xw(t)?(t.on("complete",h),t.on("abort",M),t.req?R():t.on("request",R)):n&&!t._writableState&&(t.on("end",o),t.on("close",o)),t.on("end",m),t.on("finish",h),e.error!==!1&&t.on("error",p),t.on("close",M),function(){t.removeListener("complete",h),t.removeListener("abort",M),t.removeListener("request",R),t.req&&t.req.removeListener("finish",h),t.removeListener("end",o),t.removeListener("close",o),t.removeListener("finish",h),t.removeListener("end",m),t.removeListener("error",p),t.removeListener("close",M)}}Fm.exports=qm});var Hm=V((SA,Wm)=>{"use strict";var Bu;function yn(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Qw=Nu(),bn=Symbol("lastResolve"),ds=Symbol("lastReject"),p1=Symbol("error"),Du=Symbol("ended"),ms=Symbol("lastPromise"),x0=Symbol("handlePromise"),ps=Symbol("stream");function vn(t,e){return{value:t,done:e}}function e_(t){var e=t[bn];if(e!==null){var r=t[ps].read();r!==null&&(t[ms]=null,t[bn]=null,t[ds]=null,e(vn(r,!1)))}}function t_(t){process.nextTick(e_,t)}function r_(t,e){return function(r,i){t.then(function(){if(e[Du]){r(vn(void 0,!0));return}e[x0](r,i)},i)}}var i_=Object.getPrototypeOf(function(){}),n_=Object.setPrototypeOf((Bu={get stream(){return this[ps]},next:function(){var e=this,r=this[p1];if(r!==null)return Promise.reject(r);if(this[Du])return Promise.resolve(vn(void 0,!0));if(this[ps].destroyed)return new Promise(function(a,h){process.nextTick(function(){e[p1]?h(e[p1]):a(vn(void 0,!0))})});var i=this[ms],n;if(i)n=new Promise(r_(i,this));else{var o=this[ps].read();if(o!==null)return Promise.resolve(vn(o,!1));n=new Promise(this[x0])}return this[ms]=n,n}},yn(Bu,Symbol.asyncIterator,function(){return this}),yn(Bu,"return",function(){var e=this;return new Promise(function(r,i){e[ps].destroy(null,function(n){if(n){i(n);return}r(vn(void 0,!0))})})}),Bu),i_),s_=function(e){var r,i=Object.create(n_,(r={},yn(r,ps,{value:e,writable:!0}),yn(r,bn,{value:null,writable:!0}),yn(r,ds,{value:null,writable:!0}),yn(r,p1,{value:null,writable:!0}),yn(r,Du,{value:e._readableState.endEmitted,writable:!0}),yn(r,x0,{value:function(o,a){var h=i[ps].read();h?(i[ms]=null,i[bn]=null,i[ds]=null,o(vn(h,!1))):(i[bn]=o,i[ds]=a)},writable:!0}),r));return i[ms]=null,Qw(e,function(n){if(n&&n.code!=="ERR_STREAM_PREMATURE_CLOSE"){var o=i[ds];o!==null&&(i[ms]=null,i[bn]=null,i[ds]=null,o(n)),i[p1]=n;return}var a=i[bn];a!==null&&(i[ms]=null,i[bn]=null,i[ds]=null,a(vn(void 0,!0))),i[Du]=!0}),e.on("readable",t_.bind(null,i)),i};Wm.exports=s_});var Jm=V((MA,Km)=>{"use strict";function Gm(t,e,r,i,n,o,a){try{var h=t[o](a),d=h.value}catch(m){r(m);return}h.done?e(d):Promise.resolve(d).then(i,n)}function o_(t){return function(){var e=this,r=arguments;return new Promise(function(i,n){var o=t.apply(e,r);function a(d){Gm(o,i,n,a,h,"next",d)}function h(d){Gm(o,i,n,a,h,"throw",d)}a(void 0)})}}function Vm(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function a_(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Vm(Object(r),!0).forEach(function(i){l_(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Vm(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function l_(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var u_=pn().codes.ERR_INVALID_ARG_TYPE;function h_(t,e,r){var i;if(e&&typeof e.next=="function")i=e;else if(e&&e[Symbol.asyncIterator])i=e[Symbol.asyncIterator]();else if(e&&e[Symbol.iterator])i=e[Symbol.iterator]();else throw new u_("iterable",["Iterable"],e);var n=new t(a_({objectMode:!0},r)),o=!1;n._read=function(){o||(o=!0,a())};function a(){return h.apply(this,arguments)}function h(){return h=o_(function*(){try{var d=yield i.next(),m=d.value,p=d.done;p?n.push(null):n.push(yield m)?a():o=!1}catch(M){n.destroy(M)}}),h.apply(this,arguments)}return n}Km.exports=h_});var y0=V((RA,sp)=>{"use strict";sp.exports=Oe;var Wo;Oe.ReadableState=Qm;var EA=require("events").EventEmitter,Xm=function(e,r){return e.listeners(r).length},y1=n0(),zu=require("buffer").Buffer,c_=global.Uint8Array||function(){};function f_(t){return zu.from(t)}function d_(t){return zu.isBuffer(t)||t instanceof c_}var S0=require("util"),ye;S0&&S0.debuglog?ye=S0.debuglog("stream"):ye=function(){};var m_=bm(),I0=a0(),p_=l0(),g_=p_.getHighWaterMark,Uu=pn().codes,y_=Uu.ERR_INVALID_ARG_TYPE,b_=Uu.ERR_STREAM_PUSH_AFTER_EOF,v_=Uu.ERR_METHOD_NOT_IMPLEMENTED,w_=Uu.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Ho,M0,E0;$o()(Oe,y1);var g1=I0.errorOrDestroy,R0=["error","close","destroy","pause","resume"];function __(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}function Qm(t,e,r){Wo=Wo||cs(),t=t||{},typeof r!="boolean"&&(r=e instanceof Wo),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=g_(this,t,"readableHighWaterMark",r),this.buffer=new m_,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.paused=!0,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(Ho||(Ho=_0().StringDecoder),this.decoder=new Ho(t.encoding),this.encoding=t.encoding)}function Oe(t){if(Wo=Wo||cs(),!(this instanceof Oe))return new Oe(t);var e=this instanceof Wo;this._readableState=new Qm(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),y1.call(this)}Object.defineProperty(Oe.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){!this._readableState||(this._readableState.destroyed=e)}});Oe.prototype.destroy=I0.destroy;Oe.prototype._undestroy=I0.undestroy;Oe.prototype._destroy=function(t,e){e(t)};Oe.prototype.push=function(t,e){var r=this._readableState,i;return r.objectMode?i=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=zu.from(t,e),e=""),i=!0),ep(this,t,e,!1,i)};Oe.prototype.unshift=function(t){return ep(this,t,null,!0,!1)};function ep(t,e,r,i,n){ye("readableAddChunk",e);var o=t._readableState;if(e===null)o.reading=!1,M_(t,o);else{var a;if(n||(a=x_(o,e)),a)g1(t,a);else if(o.objectMode||e&&e.length>0)if(typeof e!="string"&&!o.objectMode&&Object.getPrototypeOf(e)!==zu.prototype&&(e=f_(e)),i)o.endEmitted?g1(t,new w_):C0(t,o,e,!0);else if(o.ended)g1(t,new b_);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||e.length!==0?C0(t,o,e,!1):T0(t,o)):C0(t,o,e,!1)}else i||(o.reading=!1,T0(t,o))}return!o.ended&&(o.length<o.highWaterMark||o.length===0)}function C0(t,e,r,i){e.flowing&&e.length===0&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&ju(t)),T0(t,e)}function x_(t,e){var r;return!d_(e)&&typeof e!="string"&&e!==void 0&&!t.objectMode&&(r=new y_("chunk",["string","Buffer","Uint8Array"],e)),r}Oe.prototype.isPaused=function(){return this._readableState.flowing===!1};Oe.prototype.setEncoding=function(t){Ho||(Ho=_0().StringDecoder);var e=new Ho(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,i="";r!==null;)i+=e.write(r.data),r=r.next;return this._readableState.buffer.clear(),i!==""&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var Zm=1073741824;function S_(t){return t>=Zm?t=Zm:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function Ym(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=S_(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}Oe.prototype.read=function(t){ye("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return ye("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?A0(this):ju(this),null;if(t=Ym(t,e),t===0&&e.ended)return e.length===0&&A0(this),null;var i=e.needReadable;ye("need readable",i),(e.length===0||e.length-t<e.highWaterMark)&&(i=!0,ye("length less than watermark",i)),e.ended||e.reading?(i=!1,ye("reading or ended",i)):i&&(ye("do read"),e.reading=!0,e.sync=!0,e.length===0&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=Ym(r,e)));var n;return t>0?n=ip(t,e):n=null,n===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&A0(this)),n!==null&&this.emit("data",n),n};function M_(t,e){if(ye("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?ju(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,tp(t)))}}function ju(t){var e=t._readableState;ye("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(ye("emitReadable",e.flowing),e.emittedReadable=!0,process.nextTick(tp,t))}function tp(t){var e=t._readableState;ye("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,P0(t)}function T0(t,e){e.readingMore||(e.readingMore=!0,process.nextTick(E_,t,e))}function E_(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){var r=e.length;if(ye("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}Oe.prototype._read=function(t){g1(this,new v_("_read()"))};Oe.prototype.pipe=function(t,e){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t);break}i.pipesCount+=1,ye("pipe count=%d opts=%j",i.pipesCount,e);var n=(!e||e.end!==!1)&&t!==process.stdout&&t!==process.stderr,o=n?h:E;i.endEmitted?process.nextTick(o):r.once("end",o),t.on("unpipe",a);function a(T,C){ye("onunpipe"),T===r&&C&&C.hasUnpiped===!1&&(C.hasUnpiped=!0,p())}function h(){ye("onend"),t.end()}var d=R_(r);t.on("drain",d);var m=!1;function p(){ye("cleanup"),t.removeListener("close",x),t.removeListener("finish",w),t.removeListener("drain",d),t.removeListener("error",R),t.removeListener("unpipe",a),r.removeListener("end",h),r.removeListener("end",E),r.removeListener("data",M),m=!0,i.awaitDrain&&(!t._writableState||t._writableState.needDrain)&&d()}r.on("data",M);function M(T){ye("ondata");var C=t.write(T);ye("dest.write",C),C===!1&&((i.pipesCount===1&&i.pipes===t||i.pipesCount>1&&np(i.pipes,t)!==-1)&&!m&&(ye("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function R(T){ye("onerror",T),E(),t.removeListener("error",R),Xm(t,"error")===0&&g1(t,T)}__(t,"error",R);function x(){t.removeListener("finish",w),E()}t.once("close",x);function w(){ye("onfinish"),t.removeListener("close",x),E()}t.once("finish",w);function E(){ye("unpipe"),r.unpipe(t)}return t.emit("pipe",r),i.flowing||(ye("pipe resume"),r.resume()),t};function R_(t){return function(){var r=t._readableState;ye("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&Xm(t,"data")&&(r.flowing=!0,P0(t))}}Oe.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<n;o++)i[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=np(e.pipes,t);return a===-1?this:(e.pipes.splice(a,1),e.pipesCount-=1,e.pipesCount===1&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r),this)};Oe.prototype.on=function(t,e){var r=y1.prototype.on.call(this,t,e),i=this._readableState;return t==="data"?(i.readableListening=this.listenerCount("readable")>0,i.flowing!==!1&&this.resume()):t==="readable"&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,ye("on readable",i.length,i.reading),i.length?ju(this):i.reading||process.nextTick(C_,this)),r};Oe.prototype.addListener=Oe.prototype.on;Oe.prototype.removeListener=function(t,e){var r=y1.prototype.removeListener.call(this,t,e);return t==="readable"&&process.nextTick(rp,this),r};Oe.prototype.removeAllListeners=function(t){var e=y1.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&process.nextTick(rp,this),e};function rp(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function C_(t){ye("readable nexttick read 0"),t.read(0)}Oe.prototype.resume=function(){var t=this._readableState;return t.flowing||(ye("resume"),t.flowing=!t.readableListening,A_(this,t)),t.paused=!1,this};function A_(t,e){e.resumeScheduled||(e.resumeScheduled=!0,process.nextTick(T_,t,e))}function T_(t,e){ye("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),P0(t),e.flowing&&!e.reading&&t.read(0)}Oe.prototype.pause=function(){return ye("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(ye("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function P0(t){var e=t._readableState;for(ye("flow",e.flowing);e.flowing&&t.read()!==null;);}Oe.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;t.on("end",function(){if(ye("wrapped end"),r.decoder&&!r.ended){var a=r.decoder.end();a&&a.length&&e.push(a)}e.push(null)}),t.on("data",function(a){if(ye("wrapped data"),r.decoder&&(a=r.decoder.write(a)),!(r.objectMode&&a==null)&&!(!r.objectMode&&(!a||!a.length))){var h=e.push(a);h||(i=!0,t.pause())}});for(var n in t)this[n]===void 0&&typeof t[n]=="function"&&(this[n]=function(h){return function(){return t[h].apply(t,arguments)}}(n));for(var o=0;o<R0.length;o++)t.on(R0[o],this.emit.bind(this,R0[o]));return this._read=function(a){ye("wrapped _read",a),i&&(i=!1,t.resume())},this};typeof Symbol=="function"&&(Oe.prototype[Symbol.asyncIterator]=function(){return M0===void 0&&(M0=Hm()),M0(this)});Object.defineProperty(Oe.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});Object.defineProperty(Oe.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}});Object.defineProperty(Oe.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}});Oe._fromList=ip;Object.defineProperty(Oe.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function ip(t,e){if(e.length===0)return null;var r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function A0(t){var e=t._readableState;ye("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,process.nextTick(I_,e,t))}function I_(t,e){if(ye("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}typeof Symbol=="function"&&(Oe.from=function(t,e){return E0===void 0&&(E0=Jm()),E0(Oe,t,e)});function np(t,e){for(var r=0,i=t.length;r<i;r++)if(t[r]===e)return r;return-1}});var O0=V((CA,ap)=>{"use strict";ap.exports=zi;var $u=pn().codes,P_=$u.ERR_METHOD_NOT_IMPLEMENTED,O_=$u.ERR_MULTIPLE_CALLBACK,k_=$u.ERR_TRANSFORM_ALREADY_TRANSFORMING,L_=$u.ERR_TRANSFORM_WITH_LENGTH_0,qu=cs();$o()(zi,qu);function N_(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(i===null)return this.emit("error",new O_);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}function zi(t){if(!(this instanceof zi))return new zi(t);qu.call(this,t),this._transformState={afterTransform:N_.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",B_)}function B_(){var t=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(e,r){op(t,e,r)}):op(this,null,null)}zi.prototype.push=function(t,e){return this._transformState.needTransform=!1,qu.prototype.push.call(this,t,e)};zi.prototype._transform=function(t,e,r){r(new P_("_transform()"))};zi.prototype._write=function(t,e,r){var i=this._transformState;if(i.writecb=r,i.writechunk=t,i.writeencoding=e,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}};zi.prototype._read=function(t){var e=this._transformState;e.writechunk!==null&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0};zi.prototype._destroy=function(t,e){qu.prototype._destroy.call(this,t,function(r){e(r)})};function op(t,e,r){if(e)return t.emit("error",e);if(r!=null&&t.push(r),t._writableState.length)throw new L_;if(t._transformState.transforming)throw new k_;return t.push(null)}});var hp=V((AA,up)=>{"use strict";up.exports=b1;var lp=O0();$o()(b1,lp);function b1(t){if(!(this instanceof b1))return new b1(t);lp.call(this,t)}b1.prototype._transform=function(t,e,r){r(null,t)}});var pp=V((TA,mp)=>{"use strict";var k0;function D_(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var dp=pn().codes,z_=dp.ERR_MISSING_ARGS,U_=dp.ERR_STREAM_DESTROYED;function cp(t){if(t)throw t}function j_(t){return t.setHeader&&typeof t.abort=="function"}function $_(t,e,r,i){i=D_(i);var n=!1;t.on("close",function(){n=!0}),k0===void 0&&(k0=Nu()),k0(t,{readable:e,writable:r},function(a){if(a)return i(a);n=!0,i()});var o=!1;return function(a){if(!n&&!o){if(o=!0,j_(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();i(a||new U_("pipe"))}}}function fp(t){t()}function q_(t,e){return t.pipe(e)}function F_(t){return!t.length||typeof t[t.length-1]!="function"?cp:t.pop()}function W_(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var i=F_(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new z_("streams");var n,o=e.map(function(a,h){var d=h<e.length-1,m=h>0;return $_(a,d,m,function(p){n||(n=p),p&&o.forEach(fp),!d&&(o.forEach(fp),i(n))})});return e.reduce(q_)}mp.exports=W_});var gp=V((Sr,w1)=>{var v1=require("stream");process.env.READABLE_STREAM==="disable"&&v1?(w1.exports=v1.Readable,Object.assign(w1.exports,v1),w1.exports.Stream=v1):(Sr=w1.exports=y0(),Sr.Stream=v1||Sr,Sr.Readable=Sr,Sr.Writable=m0(),Sr.Duplex=cs(),Sr.Transform=O0(),Sr.PassThrough=hp(),Sr.finished=Nu(),Sr.pipeline=pp())});var wp=V((IA,vp)=>{"use strict";var{Transform:H_}=gp(),{StringDecoder:G_}=require("string_decoder"),wn=Symbol("last"),Fu=Symbol("decoder");function V_(t,e,r){var i;if(this.overflow){var n=this[Fu].write(t);if(i=n.split(this.matcher),i.length===1)return r();i.shift(),this.overflow=!1}else this[wn]+=this[Fu].write(t),i=this[wn].split(this.matcher);this[wn]=i.pop();for(var o=0;o<i.length;o++)bp(this,this.mapper(i[o]));if(this.overflow=this[wn].length>this.maxLength,this.overflow&&!this.skipOverflow)return r(new Error("maximum buffer reached"));r()}function K_(t){this[wn]+=this[Fu].end(),this[wn]&&bp(this,this.mapper(this[wn])),t()}function bp(t,e){e!==void 0&&t.push(e)}function yp(t){return t}function J_(t,e,r){switch(t=t||/\r?\n/,e=e||yp,r=r||{},arguments.length){case 1:typeof t=="function"?(e=t,t=/\r?\n/):typeof t=="object"&&!(t instanceof RegExp)&&(r=t,t=/\r?\n/);break;case 2:typeof t=="function"?(r=e,e=t,t=/\r?\n/):typeof e=="object"&&(r=e,e=yp)}r=Object.assign({},r),r.transform=V_,r.flush=K_,r.readableObjectMode=!0;let i=new H_(r);return i[wn]="",i[Fu]=new G_("utf8"),i.matcher=t,i.mapper=e,i.maxLength=r.maxLength,i.skipOverflow=r.skipOverflow,i.overflow=!1,i}vp.exports=J_});var zp=V((yT,Dp)=>{"use strict";Dp.exports=Ku;Ku.polyline=Ku;Ku.polygon=ox;function Ku(t,e,r){var i=t.length,n=Ko(t[0],e),o=[],a,h,d,m,p;for(r||(r=[]),a=1;a<i;a++){for(h=t[a-1],d=t[a],m=p=Ko(d,e);;)if(n|m){if(n&m)break;n?(h=F0(h,d,n,e),n=Ko(h,e)):(d=F0(h,d,m,e),m=Ko(d,e))}else{o.push(h),m!==p?(o.push(d),a<i-1&&(r.push(o),o=[])):a===i-1&&o.push(d);break}n=p}return o.length&&r.push(o),r}function ox(t,e){var r,i,n,o,a,h,d;for(i=1;i<=8;i*=2){for(r=[],n=t[t.length-1],o=!(Ko(n,e)&i),a=0;a<t.length;a++)h=t[a],d=!(Ko(h,e)&i),d!==o&&r.push(F0(n,h,i,e)),d&&r.push(h),n=h,o=d;if(t=r,!t.length)break}return r}function F0(t,e,r,i){return r&8?[t[0]+(e[0]-t[0])*(i[3]-t[1])/(e[1]-t[1]),i[3]]:r&4?[t[0]+(e[0]-t[0])*(i[1]-t[1])/(e[1]-t[1]),i[1]]:r&2?[i[2],t[1]+(e[1]-t[1])*(i[2]-t[0])/(e[0]-t[0])]:r&1?[i[0],t[1]+(e[1]-t[1])*(i[0]-t[0])/(e[0]-t[0])]:null}function Ko(t,e){var r=0;return t[0]<e[0]?r|=1:t[0]>e[2]&&(r|=2),t[1]<e[1]?r|=4:t[1]>e[3]&&(r|=8),r}});var Up=V((W0,H0)=>{(function(t,e){typeof W0=="object"&&typeof H0<"u"?H0.exports=e():typeof define=="function"&&define.amd?define(e):t.SplayTree=e()})(W0,function(){"use strict";var t=function(){function w(E,T){this.next=null,this.key=E,this.data=T,this.left=null,this.right=null}return w}();function e(w,E){return w>E?1:w<E?-1:0}function r(w,E,T){for(var C=new t(null,null),I=C,k=C;;){var B=T(w,E.key);if(B<0){if(E.left===null)break;if(T(w,E.left.key)<0){var z=E.left;if(E.left=z.right,z.right=E,E=z,E.left===null)break}k.left=E,k=E,E=E.left}else if(B>0){if(E.right===null)break;if(T(w,E.right.key)>0){var z=E.right;if(E.right=z.left,z.left=E,E=z,E.right===null)break}I.right=E,I=E,E=E.right}else break}return I.right=E.left,k.left=E.right,E.left=C.right,E.right=C.left,E}function i(w,E,T,C){var I=new t(w,E);if(T===null)return I.left=I.right=null,I;T=r(w,T,C);var k=C(w,T.key);return k<0?(I.left=T.left,I.right=T,T.left=null):k>=0&&(I.right=T.right,I.left=T,T.right=null),I}function n(w,E,T){var C=null,I=null;if(E){E=r(w,E,T);var k=T(E.key,w);k===0?(C=E.left,I=E.right):k<0?(I=E.right,E.right=null,C=E):(C=E.left,E.left=null,I=E)}return{left:C,right:I}}function o(w,E,T){return E===null?w:(w===null||(E=r(w.key,E,T),E.left=w),E)}function a(w,E,T,C,I){if(w){C(""+E+(T?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ")+I(w)+`
107
+ `);var k=E+(T?" ":"\u2502 ");w.left&&a(w.left,k,!1,C,I),w.right&&a(w.right,k,!0,C,I)}}var h=function(){function w(E){E===void 0&&(E=e),this._root=null,this._size=0,this._comparator=E}return w.prototype.insert=function(E,T){return this._size++,this._root=i(E,T,this._root,this._comparator)},w.prototype.add=function(E,T){var C=new t(E,T);this._root===null&&(C.left=C.right=null,this._size++,this._root=C);var I=this._comparator,k=r(E,this._root,I),B=I(E,k.key);return B===0?this._root=k:(B<0?(C.left=k.left,C.right=k,k.left=null):B>0&&(C.right=k.right,C.left=k,k.right=null),this._size++,this._root=C),this._root},w.prototype.remove=function(E){this._root=this._remove(E,this._root,this._comparator)},w.prototype._remove=function(E,T,C){var I;if(T===null)return null;T=r(E,T,C);var k=C(E,T.key);return k===0?(T.left===null?I=T.right:(I=r(E,T.left,C),I.right=T.right),this._size--,I):T},w.prototype.pop=function(){var E=this._root;if(E){for(;E.left;)E=E.left;return this._root=r(E.key,this._root,this._comparator),this._root=this._remove(E.key,this._root,this._comparator),{key:E.key,data:E.data}}return null},w.prototype.findStatic=function(E){for(var T=this._root,C=this._comparator;T;){var I=C(E,T.key);if(I===0)return T;I<0?T=T.left:T=T.right}return null},w.prototype.find=function(E){return this._root&&(this._root=r(E,this._root,this._comparator),this._comparator(E,this._root.key)!==0)?null:this._root},w.prototype.contains=function(E){for(var T=this._root,C=this._comparator;T;){var I=C(E,T.key);if(I===0)return!0;I<0?T=T.left:T=T.right}return!1},w.prototype.forEach=function(E,T){for(var C=this._root,I=[],k=!1;!k;)C!==null?(I.push(C),C=C.left):I.length!==0?(C=I.pop(),E.call(T,C),C=C.right):k=!0;return this},w.prototype.range=function(E,T,C,I){for(var k=[],B=this._comparator,z=this._root,H;k.length!==0||z;)if(z)k.push(z),z=z.left;else{if(z=k.pop(),H=B(z.key,T),H>0)break;if(B(z.key,E)>=0&&C.call(I,z))return this;z=z.right}return this},w.prototype.keys=function(){var E=[];return this.forEach(function(T){var C=T.key;return E.push(C)}),E},w.prototype.values=function(){var E=[];return this.forEach(function(T){var C=T.data;return E.push(C)}),E},w.prototype.min=function(){return this._root?this.minNode(this._root).key:null},w.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},w.prototype.minNode=function(E){if(E===void 0&&(E=this._root),E)for(;E.left;)E=E.left;return E},w.prototype.maxNode=function(E){if(E===void 0&&(E=this._root),E)for(;E.right;)E=E.right;return E},w.prototype.at=function(E){for(var T=this._root,C=!1,I=0,k=[];!C;)if(T)k.push(T),T=T.left;else if(k.length>0){if(T=k.pop(),I===E)return T;I++,T=T.right}else C=!0;return null},w.prototype.next=function(E){var T=this._root,C=null;if(E.right){for(C=E.right;C.left;)C=C.left;return C}for(var I=this._comparator;T;){var k=I(E.key,T.key);if(k===0)break;k<0?(C=T,T=T.left):T=T.right}return C},w.prototype.prev=function(E){var T=this._root,C=null;if(E.left!==null){for(C=E.left;C.right;)C=C.right;return C}for(var I=this._comparator;T;){var k=I(E.key,T.key);if(k===0)break;k<0?T=T.left:(C=T,T=T.right)}return C},w.prototype.clear=function(){return this._root=null,this._size=0,this},w.prototype.toList=function(){return p(this._root)},w.prototype.load=function(E,T,C){T===void 0&&(T=[]),C===void 0&&(C=!1);var I=E.length,k=this._comparator;if(C&&x(E,T,0,I-1,k),this._root===null)this._root=d(E,T,0,I),this._size=I;else{var B=R(this.toList(),m(E,T),k);I=this._size+I,this._root=M({head:B},0,I)}return this},w.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(w.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),w.prototype.toString=function(E){E===void 0&&(E=function(C){return String(C.key)});var T=[];return a(this._root,"",!0,function(C){return T.push(C)},E),T.join("")},w.prototype.update=function(E,T,C){var I=this._comparator,k=n(E,this._root,I),B=k.left,z=k.right;I(E,T)<0?z=i(T,C,z,I):B=i(T,C,B,I),this._root=o(B,z,I)},w.prototype.split=function(E){return n(E,this._root,this._comparator)},w}();function d(w,E,T,C){var I=C-T;if(I>0){var k=T+Math.floor(I/2),B=w[k],z=E[k],H=new t(B,z);return H.left=d(w,E,T,k),H.right=d(w,E,k+1,C),H}return null}function m(w,E){for(var T=new t(null,null),C=T,I=0;I<w.length;I++)C=C.next=new t(w[I],E[I]);return C.next=null,T.next}function p(w){for(var E=w,T=[],C=!1,I=new t(null,null),k=I;!C;)E?(T.push(E),E=E.left):T.length>0?(E=k=k.next=T.pop(),E=E.right):C=!0;return k.next=null,I.next}function M(w,E,T){var C=T-E;if(C>0){var I=E+Math.floor(C/2),k=M(w,E,I),B=w.head;return B.left=k,w.head=w.head.next,B.right=M(w,I+1,T),B}return null}function R(w,E,T){for(var C=new t(null,null),I=C,k=w,B=E;k!==null&&B!==null;)T(k.key,B.key)<0?(I.next=k,k=k.next):(I.next=B,B=B.next),I=I.next;return k!==null?I.next=k:B!==null&&(I.next=B),C.next}function x(w,E,T,C,I){if(!(T>=C)){for(var k=w[T+C>>1],B=T-1,z=C+1;;){do B++;while(I(w[B],k)<0);do z--;while(I(w[z],k)>0);if(B>=z)break;var H=w[B];w[B]=w[z],w[z]=H,H=E[B],E[B]=E[z],E[z]=H}x(w,E,T,z,I),x(w,E,z+1,C,I)}}return h})});var Yp=V((bT,Zp)=>{"use strict";var ax=Up();function lx(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var K0=lx(ax);function Mr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function jp(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function Nt(t,e,r){return e&&jp(t.prototype,e),r&&jp(t,r),t}var x1=function(e,r){return e.ll.x<=r.x&&r.x<=e.ur.x&&e.ll.y<=r.y&&r.y<=e.ur.y},G0=function(e,r){if(r.ur.x<e.ll.x||e.ur.x<r.ll.x||r.ur.y<e.ll.y||e.ur.y<r.ll.y)return null;var i=e.ll.x<r.ll.x?r.ll.x:e.ll.x,n=e.ur.x<r.ur.x?e.ur.x:r.ur.x,o=e.ll.y<r.ll.y?r.ll.y:e.ll.y,a=e.ur.y<r.ur.y?e.ur.y:r.ur.y;return{ll:{x:i,y:o},ur:{x:n,y:a}}},xn=Number.EPSILON;xn===void 0&&(xn=Math.pow(2,-52));var ux=xn*xn,V0=function(e,r){if(-xn<e&&e<xn&&-xn<r&&r<xn)return 0;var i=e-r;return i*i<ux*e*r?0:e<r?-1:1},hx=function(){function t(){Mr(this,t),this.reset()}return Nt(t,[{key:"reset",value:function(){this.xRounder=new $p,this.yRounder=new $p}},{key:"round",value:function(r,i){return{x:this.xRounder.round(r),y:this.yRounder.round(i)}}}]),t}(),$p=function(){function t(){Mr(this,t),this.tree=new K0.default,this.round(0)}return Nt(t,[{key:"round",value:function(r){var i=this.tree.add(r),n=this.tree.prev(i);if(n!==null&&V0(i.key,n.key)===0)return this.tree.remove(r),n.key;var o=this.tree.next(i);return o!==null&&V0(i.key,o.key)===0?(this.tree.remove(r),o.key):r}}]),t}(),M1=new hx,S1=function(e,r){return e.x*r.y-e.y*r.x},Jp=function(e,r){return e.x*r.x+e.y*r.y},qp=function(e,r,i){var n={x:r.x-e.x,y:r.y-e.y},o={x:i.x-e.x,y:i.y-e.y},a=S1(n,o);return V0(a,0)},Ju=function(e){return Math.sqrt(Jp(e,e))},cx=function(e,r,i){var n={x:r.x-e.x,y:r.y-e.y},o={x:i.x-e.x,y:i.y-e.y};return S1(o,n)/Ju(o)/Ju(n)},fx=function(e,r,i){var n={x:r.x-e.x,y:r.y-e.y},o={x:i.x-e.x,y:i.y-e.y};return Jp(o,n)/Ju(o)/Ju(n)},Fp=function(e,r,i){return r.y===0?null:{x:e.x+r.x/r.y*(i-e.y),y:i}},Wp=function(e,r,i){return r.x===0?null:{x:i,y:e.y+r.y/r.x*(i-e.x)}},dx=function(e,r,i,n){if(r.x===0)return Wp(i,n,e.x);if(n.x===0)return Wp(e,r,i.x);if(r.y===0)return Fp(i,n,e.y);if(n.y===0)return Fp(e,r,i.y);var o=S1(r,n);if(o==0)return null;var a={x:i.x-e.x,y:i.y-e.y},h=S1(a,r)/o,d=S1(a,n)/o,m=e.x+d*r.x,p=i.x+h*n.x,M=e.y+d*r.y,R=i.y+h*n.y,x=(m+p)/2,w=(M+R)/2;return{x,y:w}},ui=function(){Nt(t,null,[{key:"compare",value:function(r,i){var n=t.comparePoints(r.point,i.point);return n!==0?n:(r.point!==i.point&&r.link(i),r.isLeft!==i.isLeft?r.isLeft?1:-1:Zu.compare(r.segment,i.segment))}},{key:"comparePoints",value:function(r,i){return r.x<i.x?-1:r.x>i.x?1:r.y<i.y?-1:r.y>i.y?1:0}}]);function t(e,r){Mr(this,t),e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=r}return Nt(t,[{key:"link",value:function(r){if(r.point===this.point)throw new Error("Tried to link already linked events");for(var i=r.point.events,n=0,o=i.length;n<o;n++){var a=i[n];this.point.events.push(a),a.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var r=this.point.events.length,i=0;i<r;i++){var n=this.point.events[i];if(n.segment.consumedBy===void 0)for(var o=i+1;o<r;o++){var a=this.point.events[o];a.consumedBy===void 0&&n.otherSE.point.events===a.otherSE.point.events&&n.segment.consume(a.segment)}}}},{key:"getAvailableLinkedEvents",value:function(){for(var r=[],i=0,n=this.point.events.length;i<n;i++){var o=this.point.events[i];o!==this&&!o.segment.ringOut&&o.segment.isInResult()&&r.push(o)}return r}},{key:"getLeftmostComparator",value:function(r){var i=this,n=new Map,o=function(h){var d=h.otherSE;n.set(h,{sine:cx(i.point,r.point,d.point),cosine:fx(i.point,r.point,d.point)})};return function(a,h){n.has(a)||o(a),n.has(h)||o(h);var d=n.get(a),m=d.sine,p=d.cosine,M=n.get(h),R=M.sine,x=M.cosine;return m>=0&&R>=0?p<x?1:p>x?-1:0:m<0&&R<0?p<x?-1:p>x?1:0:R<m?-1:R>m?1:0}}}]),t}(),mx=0,Zu=function(){Nt(t,null,[{key:"compare",value:function(r,i){var n=r.leftSE.point.x,o=i.leftSE.point.x,a=r.rightSE.point.x,h=i.rightSE.point.x;if(h<n)return 1;if(a<o)return-1;var d=r.leftSE.point.y,m=i.leftSE.point.y,p=r.rightSE.point.y,M=i.rightSE.point.y;if(n<o){if(m<d&&m<p)return 1;if(m>d&&m>p)return-1;var R=r.comparePoint(i.leftSE.point);if(R<0)return 1;if(R>0)return-1;var x=i.comparePoint(r.rightSE.point);return x!==0?x:-1}if(n>o){if(d<m&&d<M)return-1;if(d>m&&d>M)return 1;var w=i.comparePoint(r.leftSE.point);if(w!==0)return w;var E=r.comparePoint(i.rightSE.point);return E<0?1:E>0?-1:1}if(d<m)return-1;if(d>m)return 1;if(a<h){var T=i.comparePoint(r.rightSE.point);if(T!==0)return T}if(a>h){var C=r.comparePoint(i.rightSE.point);if(C<0)return 1;if(C>0)return-1}if(a!==h){var I=p-d,k=a-n,B=M-m,z=h-o;if(I>k&&B<z)return 1;if(I<k&&B>z)return-1}return a>h?1:a<h||p<M?-1:p>M?1:r.id<i.id?-1:r.id>i.id?1:0}}]);function t(e,r,i,n){Mr(this,t),this.id=++mx,this.leftSE=e,e.segment=this,e.otherSE=r,this.rightSE=r,r.segment=this,r.otherSE=e,this.rings=i,this.windings=n}return Nt(t,[{key:"replaceRightSE",value:function(r){this.rightSE=r,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var r=this.leftSE.point.y,i=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:r<i?r:i},ur:{x:this.rightSE.point.x,y:r>i?r:i}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(r){return r.x===this.leftSE.point.x&&r.y===this.leftSE.point.y||r.x===this.rightSE.point.x&&r.y===this.rightSE.point.y}},{key:"comparePoint",value:function(r){if(this.isAnEndpoint(r))return 0;var i=this.leftSE.point,n=this.rightSE.point,o=this.vector();if(i.x===n.x)return r.x===i.x?0:r.x<i.x?1:-1;var a=(r.y-i.y)/o.y,h=i.x+a*o.x;if(r.x===h)return 0;var d=(r.x-i.x)/o.x,m=i.y+d*o.y;return r.y===m?0:r.y<m?-1:1}},{key:"getIntersection",value:function(r){var i=this.bbox(),n=r.bbox(),o=G0(i,n);if(o===null)return null;var a=this.leftSE.point,h=this.rightSE.point,d=r.leftSE.point,m=r.rightSE.point,p=x1(i,d)&&this.comparePoint(d)===0,M=x1(n,a)&&r.comparePoint(a)===0,R=x1(i,m)&&this.comparePoint(m)===0,x=x1(n,h)&&r.comparePoint(h)===0;if(M&&p)return x&&!R?h:!x&&R?m:null;if(M)return R&&a.x===m.x&&a.y===m.y?null:a;if(p)return x&&h.x===d.x&&h.y===d.y?null:d;if(x&&R)return null;if(x)return h;if(R)return m;var w=dx(a,this.vector(),d,r.vector());return w===null||!x1(o,w)?null:M1.round(w.x,w.y)}},{key:"split",value:function(r){var i=[],n=r.events!==void 0,o=new ui(r,!0),a=new ui(r,!1),h=this.rightSE;this.replaceRightSE(a),i.push(a),i.push(o);var d=new t(o,h,this.rings.slice(),this.windings.slice());return ui.comparePoints(d.leftSE.point,d.rightSE.point)>0&&d.swapEvents(),ui.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(o.checkForConsuming(),a.checkForConsuming()),i}},{key:"swapEvents",value:function(){var r=this.rightSE;this.rightSE=this.leftSE,this.leftSE=r,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var i=0,n=this.windings.length;i<n;i++)this.windings[i]*=-1}},{key:"consume",value:function(r){for(var i=this,n=r;i.consumedBy;)i=i.consumedBy;for(;n.consumedBy;)n=n.consumedBy;var o=t.compare(i,n);if(o!==0){if(o>0){var a=i;i=n,n=a}if(i.prev===n){var h=i;i=n,n=h}for(var d=0,m=n.rings.length;d<m;d++){var p=n.rings[d],M=n.windings[d],R=i.rings.indexOf(p);R===-1?(i.rings.push(p),i.windings.push(M)):i.windings[R]+=M}n.rings=null,n.windings=null,n.consumedBy=i,n.leftSE.consumedBy=i.leftSE,n.rightSE.consumedBy=i.rightSE}}},{key:"prevInResult",value:function(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}},{key:"beforeState",value:function(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{var r=this.prev.consumedBy||this.prev;this._beforeState=r.afterState()}return this._beforeState}},{key:"afterState",value:function(){if(this._afterState!==void 0)return this._afterState;var r=this.beforeState();this._afterState={rings:r.rings.slice(0),windings:r.windings.slice(0),multiPolys:[]};for(var i=this._afterState.rings,n=this._afterState.windings,o=this._afterState.multiPolys,a=0,h=this.rings.length;a<h;a++){var d=this.rings[a],m=this.windings[a],p=i.indexOf(d);p===-1?(i.push(d),n.push(m)):n[p]+=m}for(var M=[],R=[],x=0,w=i.length;x<w;x++)if(n[x]!==0){var E=i[x],T=E.poly;if(R.indexOf(T)===-1)if(E.isExterior)M.push(T);else{R.indexOf(T)===-1&&R.push(T);var C=M.indexOf(E.poly);C!==-1&&M.splice(C,1)}}for(var I=0,k=M.length;I<k;I++){var B=M[I].multiPoly;o.indexOf(B)===-1&&o.push(B)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;var r=this.beforeState().multiPolys,i=this.afterState().multiPolys;switch(Ur.type){case"union":{var n=r.length===0,o=i.length===0;this._isInResult=n!==o;break}case"intersection":{var a,h;r.length<i.length?(a=r.length,h=i.length):(a=i.length,h=r.length),this._isInResult=h===Ur.numMultiPolys&&a<h;break}case"xor":{var d=Math.abs(r.length-i.length);this._isInResult=d%2===1;break}case"difference":{var m=function(M){return M.length===1&&M[0].isSubject};this._isInResult=m(r)!==m(i);break}default:throw new Error("Unrecognized operation type found ".concat(Ur.type))}return this._isInResult}}],[{key:"fromRing",value:function(r,i,n){var o,a,h,d=ui.comparePoints(r,i);if(d<0)o=r,a=i,h=1;else if(d>0)o=i,a=r,h=-1;else throw new Error("Tried to create degenerate segment at [".concat(r.x,", ").concat(r.y,"]"));var m=new ui(o,!0),p=new ui(a,!1);return new t(m,p,[n],[h])}}]),t}(),Hp=function(){function t(e,r,i){if(Mr(this,t),!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=r,this.isExterior=i,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var n=M1.round(e[0][0],e[0][1]);this.bbox={ll:{x:n.x,y:n.y},ur:{x:n.x,y:n.y}};for(var o=n,a=1,h=e.length;a<h;a++){if(typeof e[a][0]!="number"||typeof e[a][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var d=M1.round(e[a][0],e[a][1]);d.x===o.x&&d.y===o.y||(this.segments.push(Zu.fromRing(o,d,this)),d.x<this.bbox.ll.x&&(this.bbox.ll.x=d.x),d.y<this.bbox.ll.y&&(this.bbox.ll.y=d.y),d.x>this.bbox.ur.x&&(this.bbox.ur.x=d.x),d.y>this.bbox.ur.y&&(this.bbox.ur.y=d.y),o=d)}(n.x!==o.x||n.y!==o.y)&&this.segments.push(Zu.fromRing(o,n,this))}return Nt(t,[{key:"getSweepEvents",value:function(){for(var r=[],i=0,n=this.segments.length;i<n;i++){var o=this.segments[i];r.push(o.leftSE),r.push(o.rightSE)}return r}}]),t}(),px=function(){function t(e,r){if(Mr(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Hp(e[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var i=1,n=e.length;i<n;i++){var o=new Hp(e[i],this,!1);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=r}return Nt(t,[{key:"getSweepEvents",value:function(){for(var r=this.exteriorRing.getSweepEvents(),i=0,n=this.interiorRings.length;i<n;i++)for(var o=this.interiorRings[i].getSweepEvents(),a=0,h=o.length;a<h;a++)r.push(o[a]);return r}}]),t}(),Gp=function(){function t(e,r){if(Mr(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof e[0][0][0]=="number"&&(e=[e])}catch{}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var i=0,n=e.length;i<n;i++){var o=new px(e[i],this);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=r}return Nt(t,[{key:"getSweepEvents",value:function(){for(var r=[],i=0,n=this.polys.length;i<n;i++)for(var o=this.polys[i].getSweepEvents(),a=0,h=o.length;a<h;a++)r.push(o[a]);return r}}]),t}(),gx=function(){Nt(t,null,[{key:"factory",value:function(r){for(var i=[],n=0,o=r.length;n<o;n++){var a=r[n];if(!(!a.isInResult()||a.ringOut)){for(var h=null,d=a.leftSE,m=a.rightSE,p=[d],M=d.point,R=[];h=d,d=m,p.push(d),d.point!==M;)for(;;){var x=d.getAvailableLinkedEvents();if(x.length===0){var w=p[0].point,E=p[p.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(w.x,",")+" ".concat(w.y,"]. Last matching segment found ends at")+" [".concat(E.x,", ").concat(E.y,"]."))}if(x.length===1){m=x[0].otherSE;break}for(var T=null,C=0,I=R.length;C<I;C++)if(R[C].point===d.point){T=C;break}if(T!==null){var k=R.splice(T)[0],B=p.splice(k.index);B.unshift(B[0].otherSE),i.push(new t(B.reverse()));continue}R.push({index:p.length,point:d.point});var z=d.getLeftmostComparator(h);m=x.sort(z)[0].otherSE;break}i.push(new t(p))}}return i}}]);function t(e){Mr(this,t),this.events=e;for(var r=0,i=e.length;r<i;r++)e[r].segment.ringOut=this;this.poly=null}return Nt(t,[{key:"getGeom",value:function(){for(var r=this.events[0].point,i=[r],n=1,o=this.events.length-1;n<o;n++){var a=this.events[n].point,h=this.events[n+1].point;qp(a,r,h)!==0&&(i.push(a),r=a)}if(i.length===1)return null;var d=i[0],m=i[1];qp(d,r,m)===0&&i.shift(),i.push(i[0]);for(var p=this.isExteriorRing()?1:-1,M=this.isExteriorRing()?0:i.length-1,R=this.isExteriorRing()?i.length:-1,x=[],w=M;w!=R;w+=p)x.push([i[w].x,i[w].y]);return x}},{key:"isExteriorRing",value:function(){if(this._isExteriorRing===void 0){var r=this.enclosingRing();this._isExteriorRing=r?!r.isExteriorRing():!0}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var r=this.events[0],i=1,n=this.events.length;i<n;i++){var o=this.events[i];ui.compare(r,o)>0&&(r=o)}for(var a=r.segment.prevInResult(),h=a?a.prevInResult():null;;){if(!a)return null;if(!h)return a.ringOut;if(h.ringOut!==a.ringOut)return h.ringOut.enclosingRing()!==a.ringOut?a.ringOut:a.ringOut.enclosingRing();a=h.prevInResult(),h=a?a.prevInResult():null}}}]),t}(),Vp=function(){function t(e){Mr(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return Nt(t,[{key:"addInterior",value:function(r){this.interiorRings.push(r),r.poly=this}},{key:"getGeom",value:function(){var r=[this.exteriorRing.getGeom()];if(r[0]===null)return null;for(var i=0,n=this.interiorRings.length;i<n;i++){var o=this.interiorRings[i].getGeom();o!==null&&r.push(o)}return r}}]),t}(),yx=function(){function t(e){Mr(this,t),this.rings=e,this.polys=this._composePolys(e)}return Nt(t,[{key:"getGeom",value:function(){for(var r=[],i=0,n=this.polys.length;i<n;i++){var o=this.polys[i].getGeom();o!==null&&r.push(o)}return r}},{key:"_composePolys",value:function(r){for(var i=[],n=0,o=r.length;n<o;n++){var a=r[n];if(!a.poly)if(a.isExteriorRing())i.push(new Vp(a));else{var h=a.enclosingRing();h.poly||i.push(new Vp(h)),h.poly.addInterior(a)}}return i}}]),t}(),bx=function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Zu.compare;Mr(this,t),this.queue=e,this.tree=new K0.default(r),this.segments=[]}return Nt(t,[{key:"process",value:function(r){var i=r.segment,n=[];if(r.consumedBy)return r.isLeft?this.queue.remove(r.otherSE):this.tree.remove(i),n;var o=r.isLeft?this.tree.insert(i):this.tree.find(i);if(!o)throw new Error("Unable to find segment #".concat(i.id," ")+"[".concat(i.leftSE.point.x,", ").concat(i.leftSE.point.y,"] -> ")+"[".concat(i.rightSE.point.x,", ").concat(i.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var a=o,h=o,d=void 0,m=void 0;d===void 0;)a=this.tree.prev(a),a===null?d=null:a.key.consumedBy===void 0&&(d=a.key);for(;m===void 0;)h=this.tree.next(h),h===null?m=null:h.key.consumedBy===void 0&&(m=h.key);if(r.isLeft){var p=null;if(d){var M=d.getIntersection(i);if(M!==null&&(i.isAnEndpoint(M)||(p=M),!d.isAnEndpoint(M)))for(var R=this._splitSafely(d,M),x=0,w=R.length;x<w;x++)n.push(R[x])}var E=null;if(m){var T=m.getIntersection(i);if(T!==null&&(i.isAnEndpoint(T)||(E=T),!m.isAnEndpoint(T)))for(var C=this._splitSafely(m,T),I=0,k=C.length;I<k;I++)n.push(C[I])}if(p!==null||E!==null){var B=null;if(p===null)B=E;else if(E===null)B=p;else{var z=ui.comparePoints(p,E);B=z<=0?p:E}this.queue.remove(i.rightSE),n.push(i.rightSE);for(var H=i.split(B),J=0,se=H.length;J<se;J++)n.push(H[J])}n.length>0?(this.tree.remove(i),n.push(r)):(this.segments.push(i),i.prev=d)}else{if(d&&m){var Me=d.getIntersection(m);if(Me!==null){if(!d.isAnEndpoint(Me))for(var Ue=this._splitSafely(d,Me),Te=0,Ne=Ue.length;Te<Ne;Te++)n.push(Ue[Te]);if(!m.isAnEndpoint(Me))for(var st=this._splitSafely(m,Me),zt=0,di=st.length;zt<di;zt++)n.push(st[zt])}}this.tree.remove(i)}return n}},{key:"_splitSafely",value:function(r,i){this.tree.remove(r);var n=r.rightSE;this.queue.remove(n);var o=r.split(i);return o.push(n),r.consumedBy===void 0&&this.tree.insert(r),o}}]),t}(),Kp=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,vx=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,wx=function(){function t(){Mr(this,t)}return Nt(t,[{key:"run",value:function(r,i,n){Ur.type=r,M1.reset();for(var o=[new Gp(i,!0)],a=0,h=n.length;a<h;a++)o.push(new Gp(n[a],!1));if(Ur.numMultiPolys=o.length,Ur.type==="difference")for(var d=o[0],m=1;m<o.length;)G0(o[m].bbox,d.bbox)!==null?m++:o.splice(m,1);if(Ur.type==="intersection"){for(var p=0,M=o.length;p<M;p++)for(var R=o[p],x=p+1,w=o.length;x<w;x++)if(G0(R.bbox,o[x].bbox)===null)return[]}for(var E=new K0.default(ui.compare),T=0,C=o.length;T<C;T++)for(var I=o[T].getSweepEvents(),k=0,B=I.length;k<B;k++)if(E.insert(I[k]),E.size>Kp)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var z=new bx(E),H=E.size,J=E.pop();J;){var se=J.key;if(E.size===H){var Me=se.segment;throw new Error("Unable to pop() ".concat(se.isLeft?"left":"right"," SweepEvent ")+"[".concat(se.point.x,", ").concat(se.point.y,"] from segment #").concat(Me.id," ")+"[".concat(Me.leftSE.point.x,", ").concat(Me.leftSE.point.y,"] -> ")+"[".concat(Me.rightSE.point.x,", ").concat(Me.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(E.size>Kp)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(z.segments.length>vx)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var Ue=z.process(se),Te=0,Ne=Ue.length;Te<Ne;Te++){var st=Ue[Te];st.consumedBy===void 0&&E.insert(st)}H=E.size,J=E.pop()}M1.reset();var zt=gx.factory(z.segments),di=new yx(zt);return di.getGeom()}}]),t}(),Ur=new wx,_x=function(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return Ur.run("union",e,i)},xx=function(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return Ur.run("intersection",e,i)},Sx=function(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return Ur.run("xor",e,i)},Mx=function(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return Ur.run("difference",e,i)},Ex={union:_x,intersection:xx,xor:Sx,difference:Mx};Zp.exports=Ex});var n6=V((Z0,Y0)=>{(function(t,e){typeof Z0=="object"&&typeof Y0<"u"?Y0.exports=e():typeof define=="function"&&define.amd?define(e):t.proj4=e()})(Z0,function(){"use strict";var t=function(s){s("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),s("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),s("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"),s.WGS84=s["EPSG:4326"],s["EPSG:3785"]=s["EPSG:3857"],s.GOOGLE=s["EPSG:3857"],s["EPSG:900913"]=s["EPSG:3857"],s["EPSG:102113"]=s["EPSG:3857"]},e=1,r=2,i=3,n=4,o=5,a=6378137,h=6356752314e-3,d=.0066943799901413165,m=484813681109536e-20,p=Math.PI/2,M=.16666666666666666,R=.04722222222222222,x=.022156084656084655,w=1e-10,E=.017453292519943295,T=57.29577951308232,C=Math.PI/4,I=Math.PI*2,k=3.14159265359,B={};B.greenwich=0,B.lisbon=-9.131906111111,B.paris=2.337229166667,B.bogota=-74.080916666667,B.madrid=-3.687938888889,B.rome=12.452333333333,B.bern=7.439583333333,B.jakarta=106.807719444444,B.ferro=-17.666666666667,B.brussels=4.367975,B.stockholm=18.058277777778,B.athens=23.7163375,B.oslo=10.722916666667;var z={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}},H=/[\s_\-\/\(\)]/g;function J(s,l){if(s[l])return s[l];for(var c=Object.keys(s),y=l.toLowerCase().replace(H,""),g=-1,v,S;++g<c.length;)if(v=c[g],S=v.toLowerCase().replace(H,""),S===y)return s[v]}var se=function(s){var l={},c=s.split("+").map(function(b){return b.trim()}).filter(function(b){return b}).reduce(function(b,A){var O=A.split("=");return O.push(!0),b[O[0].toLowerCase()]=O[1],b},{}),y,g,v,S={proj:"projName",datum:"datumCode",rf:function(b){l.rf=parseFloat(b)},lat_0:function(b){l.lat0=b*E},lat_1:function(b){l.lat1=b*E},lat_2:function(b){l.lat2=b*E},lat_ts:function(b){l.lat_ts=b*E},lon_0:function(b){l.long0=b*E},lon_1:function(b){l.long1=b*E},lon_2:function(b){l.long2=b*E},alpha:function(b){l.alpha=parseFloat(b)*E},gamma:function(b){l.rectified_grid_angle=parseFloat(b)},lonc:function(b){l.longc=b*E},x_0:function(b){l.x0=parseFloat(b)},y_0:function(b){l.y0=parseFloat(b)},k_0:function(b){l.k0=parseFloat(b)},k:function(b){l.k0=parseFloat(b)},a:function(b){l.a=parseFloat(b)},b:function(b){l.b=parseFloat(b)},r_a:function(){l.R_A=!0},zone:function(b){l.zone=parseInt(b,10)},south:function(){l.utmSouth=!0},towgs84:function(b){l.datum_params=b.split(",").map(function(A){return parseFloat(A)})},to_meter:function(b){l.to_meter=parseFloat(b)},units:function(b){l.units=b;var A=J(z,b);A&&(l.to_meter=A.to_meter)},from_greenwich:function(b){l.from_greenwich=b*E},pm:function(b){var A=J(B,b);l.from_greenwich=(A||parseFloat(b))*E},nadgrids:function(b){b==="@null"?l.datumCode="none":l.nadgrids=b},axis:function(b){var A="ewnsud";b.length===3&&A.indexOf(b.substr(0,1))!==-1&&A.indexOf(b.substr(1,1))!==-1&&A.indexOf(b.substr(2,1))!==-1&&(l.axis=b)},approx:function(){l.approx=!0}};for(y in c)g=c[y],y in S?(v=S[y],typeof v=="function"?v(g):l[v]=g):l[y]=g;return typeof l.datumCode=="string"&&l.datumCode!=="WGS84"&&(l.datumCode=l.datumCode.toLowerCase()),l},Me=1,Ue=2,Te=3,Ne=4,st=5,zt=-1,di=/\s/,fa=/[A-Za-z]/,$h=/[A-Za-z84]/,In=/[,\]]/,da=/[\d\.E\-\+]/;function hr(s){if(typeof s!="string")throw new Error("not a string");this.text=s.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=Me}hr.prototype.readCharicter=function(){var s=this.text[this.place++];if(this.state!==Ne)for(;di.test(s);){if(this.place>=this.text.length)return;s=this.text[this.place++]}switch(this.state){case Me:return this.neutral(s);case Ue:return this.keyword(s);case Ne:return this.quoted(s);case st:return this.afterquote(s);case Te:return this.number(s);case zt:return}},hr.prototype.afterquote=function(s){if(s==='"'){this.word+='"',this.state=Ne;return}if(In.test(s)){this.word=this.word.trim(),this.afterItem(s);return}throw new Error(`havn't handled "`+s+'" in afterquote yet, index '+this.place)},hr.prototype.afterItem=function(s){if(s===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=Me;return}if(s==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=Me,this.currentObject=this.stack.pop(),this.currentObject||(this.state=zt);return}},hr.prototype.number=function(s){if(da.test(s)){this.word+=s;return}if(In.test(s)){this.word=parseFloat(this.word),this.afterItem(s);return}throw new Error(`havn't handled "`+s+'" in number yet, index '+this.place)},hr.prototype.quoted=function(s){if(s==='"'){this.state=st;return}this.word+=s},hr.prototype.keyword=function(s){if($h.test(s)){this.word+=s;return}if(s==="["){var l=[];l.push(this.word),this.level++,this.root===null?this.root=l:this.currentObject.push(l),this.stack.push(this.currentObject),this.currentObject=l,this.state=Me;return}if(In.test(s)){this.afterItem(s);return}throw new Error(`havn't handled "`+s+'" in keyword yet, index '+this.place)},hr.prototype.neutral=function(s){if(fa.test(s)){this.word=s,this.state=Ue;return}if(s==='"'){this.word="",this.state=Ne;return}if(da.test(s)){this.word=s,this.state=Te;return}if(In.test(s)){this.afterItem(s);return}throw new Error(`havn't handled "`+s+'" in neutral yet, index '+this.place)},hr.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===zt)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function ma(s){var l=new hr(s);return l.output()}function Ts(s,l,c){Array.isArray(l)&&(c.unshift(l),l=null);var y=l?{}:s,g=c.reduce(function(v,S){return mi(S,v),v},y);l&&(s[l]=g)}function mi(s,l){if(!Array.isArray(s)){l[s]=!0;return}var c=s.shift();if(c==="PARAMETER"&&(c=s.shift()),s.length===1){if(Array.isArray(s[0])){l[c]={},mi(s[0],l[c]);return}l[c]=s[0];return}if(!s.length){l[c]=!0;return}if(c==="TOWGS84"){l[c]=s;return}if(c==="AXIS"){c in l||(l[c]=[]),l[c].push(s);return}Array.isArray(c)||(l[c]={});var y;switch(c){case"UNIT":case"PRIMEM":case"VERT_DATUM":l[c]={name:s[0].toLowerCase(),convert:s[1]},s.length===3&&mi(s[2],l[c]);return;case"SPHEROID":case"ELLIPSOID":l[c]={name:s[0],a:s[1],rf:s[2]},s.length===4&&mi(s[3],l[c]);return;case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"EDATUM":case"ENGINEERINGDATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":case"COMPD_CS":case"COMPOUNDCRS":case"ENGINEERINGCRS":case"ENGCRS":case"FITTED_CS":case"LOCAL_DATUM":case"DATUM":s[0]=["name",s[0]],Ts(l,c,s);return;default:for(y=-1;++y<s.length;)if(!Array.isArray(s[y]))return mi(s,l[c]);return Ts(l,c,s)}}var qh=.017453292519943295;function Fh(s,l){var c=l[0],y=l[1];!(c in s)&&y in s&&(s[c]=s[y],l.length===3&&(s[c]=l[2](s[c])))}function at(s){return s*qh}function Qt(s){if(s.type==="GEOGCS"?s.projName="longlat":s.type==="LOCAL_CS"?(s.projName="identity",s.local=!0):typeof s.PROJECTION=="object"?s.projName=Object.keys(s.PROJECTION)[0]:s.projName=s.PROJECTION,s.AXIS){for(var l="",c=0,y=s.AXIS.length;c<y;++c){var g=[s.AXIS[c][0].toLowerCase(),s.AXIS[c][1].toLowerCase()];g[0].indexOf("north")!==-1||(g[0]==="y"||g[0]==="lat")&&g[1]==="north"?l+="n":g[0].indexOf("south")!==-1||(g[0]==="y"||g[0]==="lat")&&g[1]==="south"?l+="s":g[0].indexOf("east")!==-1||(g[0]==="x"||g[0]==="lon")&&g[1]==="east"?l+="e":(g[0].indexOf("west")!==-1||(g[0]==="x"||g[0]==="lon")&&g[1]==="west")&&(l+="w")}l.length===2&&(l+="u"),l.length===3&&(s.axis=l)}s.UNIT&&(s.units=s.UNIT.name.toLowerCase(),s.units==="metre"&&(s.units="meter"),s.UNIT.convert&&(s.type==="GEOGCS"?s.DATUM&&s.DATUM.SPHEROID&&(s.to_meter=s.UNIT.convert*s.DATUM.SPHEROID.a):s.to_meter=s.UNIT.convert));var v=s.GEOGCS;s.type==="GEOGCS"&&(v=s),v&&(v.DATUM?s.datumCode=v.DATUM.name.toLowerCase():s.datumCode=v.name.toLowerCase(),s.datumCode.slice(0,2)==="d_"&&(s.datumCode=s.datumCode.slice(2)),(s.datumCode==="new_zealand_geodetic_datum_1949"||s.datumCode==="new_zealand_1949")&&(s.datumCode="nzgd49"),(s.datumCode==="wgs_1984"||s.datumCode==="world_geodetic_system_1984")&&(s.PROJECTION==="Mercator_Auxiliary_Sphere"&&(s.sphere=!0),s.datumCode="wgs84"),s.datumCode.slice(-6)==="_ferro"&&(s.datumCode=s.datumCode.slice(0,-6)),s.datumCode.slice(-8)==="_jakarta"&&(s.datumCode=s.datumCode.slice(0,-8)),~s.datumCode.indexOf("belge")&&(s.datumCode="rnb72"),v.DATUM&&v.DATUM.SPHEROID&&(s.ellps=v.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),s.ellps.toLowerCase().slice(0,13)==="international"&&(s.ellps="intl"),s.a=v.DATUM.SPHEROID.a,s.rf=parseFloat(v.DATUM.SPHEROID.rf,10)),v.DATUM&&v.DATUM.TOWGS84&&(s.datum_params=v.DATUM.TOWGS84),~s.datumCode.indexOf("osgb_1936")&&(s.datumCode="osgb36"),~s.datumCode.indexOf("osni_1952")&&(s.datumCode="osni52"),(~s.datumCode.indexOf("tm65")||~s.datumCode.indexOf("geodetic_datum_of_1965"))&&(s.datumCode="ire65"),s.datumCode==="ch1903+"&&(s.datumCode="ch1903"),~s.datumCode.indexOf("israel")&&(s.datumCode="isr93")),s.b&&!isFinite(s.b)&&(s.b=s.a);function S(O){var D=s.to_meter||1;return O*D}var b=function(O){return Fh(s,O)},A=[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",at],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",at],["x0","false_easting",S],["y0","false_northing",S],["long0","central_meridian",at],["lat0","latitude_of_origin",at],["lat0","standard_parallel_1",at],["lat1","standard_parallel_1",at],["lat2","standard_parallel_2",at],["azimuth","Azimuth"],["alpha","azimuth",at],["srsCode","name"]];A.forEach(b),!s.long0&&s.longc&&(s.projName==="Albers_Conic_Equal_Area"||s.projName==="Lambert_Azimuthal_Equal_Area")&&(s.long0=s.longc),!s.lat_ts&&s.lat1&&(s.projName==="Stereographic_South_Pole"||s.projName==="Polar Stereographic (variant B)")&&(s.lat0=at(s.lat1>0?90:-90),s.lat_ts=s.lat1)}var j1=function(s){var l=ma(s),c=l.shift(),y=l.shift();l.unshift(["name",y]),l.unshift(["type",c]);var g={};return mi(l,g),Qt(g),g};function ft(s){var l=this;if(arguments.length===2){var c=arguments[1];typeof c=="string"?c.charAt(0)==="+"?ft[s]=se(arguments[1]):ft[s]=j1(arguments[1]):ft[s]=c}else if(arguments.length===1){if(Array.isArray(s))return s.map(function(y){Array.isArray(y)?ft.apply(l,y):ft(y)});if(typeof s=="string"){if(s in ft)return ft[s]}else"EPSG"in s?ft["EPSG:"+s.EPSG]=s:"ESRI"in s?ft["ESRI:"+s.ESRI]=s:"IAU2000"in s?ft["IAU2000:"+s.IAU2000]=s:console.log(s);return}}t(ft);function Tr(s){return typeof s=="string"}function pa(s){return s in ft}var ga=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function $1(s){return ga.some(function(l){return s.indexOf(l)>-1})}var Wh=["3857","900913","3785","102113"];function q1(s){var l=J(s,"authority");if(!!l){var c=J(l,"epsg");return c&&Wh.indexOf(c)>-1}}function ya(s){var l=J(s,"extension");if(!!l)return J(l,"proj4")}function ji(s){return s[0]==="+"}function F1(s){if(Tr(s)){if(pa(s))return ft[s];if($1(s)){var l=j1(s);if(q1(l))return ft["EPSG:3857"];var c=ya(l);return c?se(c):l}if(ji(s))return se(s)}else return s}var Is=function(s,l){s=s||{};var c,y;if(!l)return s;for(y in l)c=l[y],c!==void 0&&(s[y]=c);return s},Tt=function(s,l,c){var y=s*l;return c/Math.sqrt(1-y*y)},$i=function(s){return s<0?-1:1},Z=function(s){return Math.abs(s)<=k?s:s-$i(s)*I},ot=function(s,l,c){var y=s*c,g=.5*s;return y=Math.pow((1-y)/(1+y),g),Math.tan(.5*(p-l))/y},Ir=function(s,l){for(var c=.5*s,y,g,v=p-2*Math.atan(l),S=0;S<=15;S++)if(y=s*Math.sin(v),g=p-2*Math.atan(l*Math.pow((1-y)/(1+y),c))-v,v+=g,Math.abs(g)<=1e-10)return v;return-9999};function Ps(){var s=this.b/this.a;this.es=1-s*s,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=Tt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function W1(s){var l=s.x,c=s.y;if(c*T>90&&c*T<-90&&l*T>180&&l*T<-180)return null;var y,g;if(Math.abs(Math.abs(c)-p)<=w)return null;if(this.sphere)y=this.x0+this.a*this.k0*Z(l-this.long0),g=this.y0+this.a*this.k0*Math.log(Math.tan(C+.5*c));else{var v=Math.sin(c),S=ot(this.e,c,v);y=this.x0+this.a*this.k0*Z(l-this.long0),g=this.y0-this.a*this.k0*Math.log(S)}return s.x=y,s.y=g,s}function H1(s){var l=s.x-this.x0,c=s.y-this.y0,y,g;if(this.sphere)g=p-2*Math.atan(Math.exp(-c/(this.a*this.k0)));else{var v=Math.exp(-c/(this.a*this.k0));if(g=Ir(this.e,v),g===-9999)return null}return y=Z(this.long0+l/(this.a*this.k0)),s.x=y,s.y=g,s}var G1=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"],Hh={init:Ps,forward:W1,inverse:H1,names:G1};function V1(){}function ba(s){return s}var K1=["longlat","identity"],Pn={init:V1,forward:ba,inverse:ba,names:K1},J1=[Hh,Pn],va={},pi=[];function wa(s,l){var c=pi.length;return s.names?(pi[c]=s,s.names.forEach(function(y){va[y.toLowerCase()]=c}),this):(console.log(l),!0)}function Gh(s){if(!s)return!1;var l=s.toLowerCase();if(typeof va[l]<"u"&&pi[va[l]])return pi[va[l]]}function Z1(){J1.forEach(wa)}var _a={start:Z1,add:wa,get:Gh},ue={};ue.MERIT={a:6378137,rf:298.257,ellipseName:"MERIT 1983"},ue.SGS85={a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},ue.GRS80={a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},ue.IAU76={a:6378140,rf:298.257,ellipseName:"IAU 1976"},ue.airy={a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"},ue.APL4={a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},ue.NWL9D={a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},ue.mod_airy={a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"},ue.andrae={a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},ue.aust_SA={a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},ue.GRS67={a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},ue.bessel={a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"},ue.bess_nam={a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},ue.clrk66={a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"},ue.clrk80={a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."},ue.clrk58={a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"},ue.CPM={a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},ue.delmbr={a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},ue.engelis={a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"},ue.evrst30={a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"},ue.evrst48={a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"},ue.evrst56={a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"},ue.evrst69={a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"},ue.evrstSS={a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},ue.fschr60={a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},ue.fschr60m={a:6378155,rf:298.3,ellipseName:"Fischer 1960"},ue.fschr68={a:6378150,rf:298.3,ellipseName:"Fischer 1968"},ue.helmert={a:6378200,rf:298.3,ellipseName:"Helmert 1906"},ue.hough={a:6378270,rf:297,ellipseName:"Hough"},ue.intl={a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},ue.kaula={a:6378163,rf:298.24,ellipseName:"Kaula 1961"},ue.lerch={a:6378139,rf:298.257,ellipseName:"Lerch 1979"},ue.mprts={a:6397300,rf:191,ellipseName:"Maupertius 1738"},ue.new_intl={a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"},ue.plessis={a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},ue.krass={a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},ue.SEasia={a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"},ue.walbeck={a:6376896,b:63558348467e-4,ellipseName:"Walbeck"},ue.WGS60={a:6378165,rf:298.3,ellipseName:"WGS 60"},ue.WGS66={a:6378145,rf:298.25,ellipseName:"WGS 66"},ue.WGS7={a:6378135,rf:298.26,ellipseName:"WGS 72"};var Vh=ue.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};ue.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};function Fr(s,l,c,y){var g=s*s,v=l*l,S=(g-v)/g,b=0;y?(s*=1-S*(M+S*(R+S*x)),g=s*s,S=0):b=Math.sqrt(S);var A=(g-v)/v;return{es:S,e:b,ep2:A}}function On(s,l,c,y,g){if(!s){var v=J(ue,y);v||(v=Vh),s=v.a,l=v.b,c=v.rf}return c&&!l&&(l=(1-1/c)*s),(c===0||Math.abs(s-l)<w)&&(g=!0,l=s),{a:s,b:l,rf:c,sphere:g}}var Ke={};Ke.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},Ke.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},Ke.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},Ke.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},Ke.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},Ke.potsdam={towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},Ke.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},Ke.hermannskogel={towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},Ke.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},Ke.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},Ke.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},Ke.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},Ke.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"},Ke.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},Ke.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},Ke.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},Ke.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};function gi(s,l,c,y,g,v,S){var b={};return s===void 0||s==="none"?b.datum_type=o:b.datum_type=n,l&&(b.datum_params=l.map(parseFloat),(b.datum_params[0]!==0||b.datum_params[1]!==0||b.datum_params[2]!==0)&&(b.datum_type=e),b.datum_params.length>3&&(b.datum_params[3]!==0||b.datum_params[4]!==0||b.datum_params[5]!==0||b.datum_params[6]!==0)&&(b.datum_type=r,b.datum_params[3]*=m,b.datum_params[4]*=m,b.datum_params[5]*=m,b.datum_params[6]=b.datum_params[6]/1e6+1)),S&&(b.datum_type=i,b.grids=S),b.a=c,b.b=y,b.es=g,b.ep2=v,b}var Os={};function yi(s,l){var c=new DataView(l),y=ks(c),g=X1(c,y);g.nSubgrids>1&&console.log("Only single NTv2 subgrids are currently supported, subsequent sub grids are ignored");var v=Q1(c,g,y),S={header:g,subgrids:v};return Os[s]=S,S}function Y1(s){if(s===void 0)return null;var l=s.split(",");return l.map(xa)}function xa(s){if(s.length===0)return null;var l=s[0]==="@";return l&&(s=s.slice(1)),s==="null"?{name:"null",mandatory:!l,grid:null,isNull:!0}:{name:s,mandatory:!l,grid:Os[s]||null,isNull:!1}}function bi(s){return s/3600*Math.PI/180}function ks(s){var l=s.getInt32(8,!1);return l===11?!1:(l=s.getInt32(8,!0),l!==11&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian"),!0)}function X1(s,l){return{nFields:s.getInt32(8,l),nSubgridFields:s.getInt32(24,l),nSubgrids:s.getInt32(40,l),shiftType:Ls(s,56,56+8).trim(),fromSemiMajorAxis:s.getFloat64(120,l),fromSemiMinorAxis:s.getFloat64(136,l),toSemiMajorAxis:s.getFloat64(152,l),toSemiMinorAxis:s.getFloat64(168,l)}}function Ls(s,l,c){return String.fromCharCode.apply(null,new Uint8Array(s.buffer.slice(l,c)))}function Q1(s,l,c){for(var y=176,g=[],v=0;v<l.nSubgrids;v++){var S=el(s,y,c),b=Kh(s,y,S,c),A=Math.round(1+(S.upperLongitude-S.lowerLongitude)/S.longitudeInterval),O=Math.round(1+(S.upperLatitude-S.lowerLatitude)/S.latitudeInterval);g.push({ll:[bi(S.lowerLongitude),bi(S.lowerLatitude)],del:[bi(S.longitudeInterval),bi(S.latitudeInterval)],lim:[A,O],count:S.gridNodeCount,cvs:Sa(b)})}return g}function Sa(s){return s.map(function(l){return[bi(l.longitudeShift),bi(l.latitudeShift)]})}function el(s,l,c){return{name:Ls(s,l+8,l+16).trim(),parent:Ls(s,l+24,l+24+8).trim(),lowerLatitude:s.getFloat64(l+72,c),upperLatitude:s.getFloat64(l+88,c),lowerLongitude:s.getFloat64(l+104,c),upperLongitude:s.getFloat64(l+120,c),latitudeInterval:s.getFloat64(l+136,c),longitudeInterval:s.getFloat64(l+152,c),gridNodeCount:s.getInt32(l+168,c)}}function Kh(s,l,c,y){for(var g=l+176,v=16,S=[],b=0;b<c.gridNodeCount;b++){var A={latitudeShift:s.getFloat32(g+b*v,y),longitudeShift:s.getFloat32(g+b*v+4,y),latitudeAccuracy:s.getFloat32(g+b*v+8,y),longitudeAccuracy:s.getFloat32(g+b*v+12,y)};S.push(A)}return S}function cr(s,l){if(!(this instanceof cr))return new cr(s);l=l||function(O){if(O)throw O};var c=F1(s);if(typeof c!="object"){l(s);return}var y=cr.projections.get(c.projName);if(!y){l(s);return}if(c.datumCode&&c.datumCode!=="none"){var g=J(Ke,c.datumCode);g&&(c.datum_params=c.datum_params||(g.towgs84?g.towgs84.split(","):null),c.ellps=g.ellipse,c.datumName=g.datumName?g.datumName:c.datumCode)}c.k0=c.k0||1,c.axis=c.axis||"enu",c.ellps=c.ellps||"wgs84",c.lat1=c.lat1||c.lat0;var v=On(c.a,c.b,c.rf,c.ellps,c.sphere),S=Fr(v.a,v.b,v.rf,c.R_A),b=Y1(c.nadgrids),A=c.datum||gi(c.datumCode,c.datum_params,v.a,v.b,S.es,S.ep2,b);Is(this,c),Is(this,y),this.a=v.a,this.b=v.b,this.rf=v.rf,this.sphere=v.sphere,this.es=S.es,this.e=S.e,this.ep2=S.ep2,this.datum=A,this.init(),l(null,this)}cr.projections=_a,cr.projections.start();function Jh(s,l){return s.datum_type!==l.datum_type||s.a!==l.a||Math.abs(s.es-l.es)>5e-11?!1:s.datum_type===e?s.datum_params[0]===l.datum_params[0]&&s.datum_params[1]===l.datum_params[1]&&s.datum_params[2]===l.datum_params[2]:s.datum_type===r?s.datum_params[0]===l.datum_params[0]&&s.datum_params[1]===l.datum_params[1]&&s.datum_params[2]===l.datum_params[2]&&s.datum_params[3]===l.datum_params[3]&&s.datum_params[4]===l.datum_params[4]&&s.datum_params[5]===l.datum_params[5]&&s.datum_params[6]===l.datum_params[6]:!0}function Ma(s,l,c){var y=s.x,g=s.y,v=s.z?s.z:0,S,b,A,O;if(g<-p&&g>-1.001*p)g=-p;else if(g>p&&g<1.001*p)g=p;else{if(g<-p)return{x:-1/0,y:-1/0,z:s.z};if(g>p)return{x:1/0,y:1/0,z:s.z}}return y>Math.PI&&(y-=2*Math.PI),b=Math.sin(g),O=Math.cos(g),A=b*b,S=c/Math.sqrt(1-l*A),{x:(S+v)*O*Math.cos(y),y:(S+v)*O*Math.sin(y),z:(S*(1-l)+v)*b}}function kn(s,l,c,y){var g=1e-12,v=g*g,S=30,b,A,O,D,L,U,W,F,G,K,ie,he,ge,Fe=s.x,ke=s.y,De=s.z?s.z:0,St,tt,Xr;if(b=Math.sqrt(Fe*Fe+ke*ke),A=Math.sqrt(Fe*Fe+ke*ke+De*De),b/c<g){if(St=0,A/c<g)return tt=p,Xr=-y,{x:s.x,y:s.y,z:s.z}}else St=Math.atan2(ke,Fe);O=De/A,D=b/A,L=1/Math.sqrt(1-l*(2-l)*D*D),F=D*(1-l)*L,G=O*L,ge=0;do ge++,W=c/Math.sqrt(1-l*G*G),Xr=b*F+De*G-W*(1-l*G*G),U=l*W/(W+Xr),L=1/Math.sqrt(1-U*(2-U)*D*D),K=D*(1-U)*L,ie=O*L,he=ie*F-K*G,F=K,G=ie;while(he*he>v&&ge<S);return tt=Math.atan(ie/Math.abs(K)),{x:St,y:tt,z:Xr}}function Zh(s,l,c){if(l===e)return{x:s.x+c[0],y:s.y+c[1],z:s.z+c[2]};if(l===r){var y=c[0],g=c[1],v=c[2],S=c[3],b=c[4],A=c[5],O=c[6];return{x:O*(s.x-A*s.y+b*s.z)+y,y:O*(A*s.x+s.y-S*s.z)+g,z:O*(-b*s.x+S*s.y+s.z)+v}}}function Ns(s,l,c){if(l===e)return{x:s.x-c[0],y:s.y-c[1],z:s.z-c[2]};if(l===r){var y=c[0],g=c[1],v=c[2],S=c[3],b=c[4],A=c[5],O=c[6],D=(s.x-y)/O,L=(s.y-g)/O,U=(s.z-v)/O;return{x:D+A*L-b*U,y:-A*D+L+S*U,z:b*D-S*L+U}}}function Wr(s){return s===e||s===r}var Bs=function(s,l,c){if(Jh(s,l)||s.datum_type===o||l.datum_type===o)return c;var y=s.a,g=s.es;if(s.datum_type===i){var v=Ut(s,!1,c);if(v!==0)return;y=a,g=d}var S=l.a,b=l.b,A=l.es;if(l.datum_type===i&&(S=a,b=h,A=d),g===A&&y===S&&!Wr(s.datum_type)&&!Wr(l.datum_type))return c;if(c=Ma(c,g,y),Wr(s.datum_type)&&(c=Zh(c,s.datum_type,s.datum_params)),Wr(l.datum_type)&&(c=Ns(c,l.datum_type,l.datum_params)),c=kn(c,A,S,b),l.datum_type===i){var O=Ut(l,!0,c);if(O!==0)return}return c};function Ut(s,l,c){if(s.grids===null||s.grids.length===0)return console.log("Grid shift grids not found"),-1;for(var y={x:-c.x,y:c.y},g={x:Number.NaN,y:Number.NaN},v=[],S=0;S<s.grids.length;S++){var b=s.grids[S];if(v.push(b.name),b.isNull){g=y;break}if(b.grid===null){if(b.mandatory)return console.log("Unable to find mandatory grid '"+b.name+"'"),-1;continue}var A=b.grid.subgrids[0],O=(Math.abs(A.del[1])+Math.abs(A.del[0]))/1e4,D=A.ll[0]-O,L=A.ll[1]-O,U=A.ll[0]+(A.lim[0]-1)*A.del[0]+O,W=A.ll[1]+(A.lim[1]-1)*A.del[1]+O;if(!(L>y.y||D>y.x||W<y.y||U<y.x)&&(g=Ea(y,l,A),!isNaN(g.x)))break}return isNaN(g.x)?(console.log("Failed to find a grid shift table for location '"+-y.x*T+" "+y.y*T+" tried: '"+v+"'"),-1):(c.x=-g.x,c.y=g.y,0)}function Ea(s,l,c){var y={x:Number.NaN,y:Number.NaN};if(isNaN(s.x))return y;var g={x:s.x,y:s.y};g.x-=c.ll[0],g.y-=c.ll[1],g.x=Z(g.x-Math.PI)+Math.PI;var v=Ra(g,c);if(l){if(isNaN(v.x))return y;v.x=g.x-v.x,v.y=g.y-v.y;var S=9,b=1e-12,A,O;do{if(O=Ra(v,c),isNaN(O.x)){console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.");break}A={x:g.x-(O.x+v.x),y:g.y-(O.y+v.y)},v.x+=A.x,v.y+=A.y}while(S--&&Math.abs(A.x)>b&&Math.abs(A.y)>b);if(S<0)return console.log("Inverse grid shift iterator failed to converge."),y;y.x=Z(v.x+c.ll[0]),y.y=v.y+c.ll[1]}else isNaN(v.x)||(y.x=s.x+v.x,y.y=s.y+v.y);return y}function Ra(s,l){var c={x:s.x/l.del[0],y:s.y/l.del[1]},y={x:Math.floor(c.x),y:Math.floor(c.y)},g={x:c.x-1*y.x,y:c.y-1*y.y},v={x:Number.NaN,y:Number.NaN},S;if(y.x<0||y.x>=l.lim[0]||y.y<0||y.y>=l.lim[1])return v;S=y.y*l.lim[0]+y.x;var b={x:l.cvs[S][0],y:l.cvs[S][1]};S++;var A={x:l.cvs[S][0],y:l.cvs[S][1]};S+=l.lim[0];var O={x:l.cvs[S][0],y:l.cvs[S][1]};S--;var D={x:l.cvs[S][0],y:l.cvs[S][1]},L=g.x*g.y,U=g.x*(1-g.y),W=(1-g.x)*(1-g.y),F=(1-g.x)*g.y;return v.x=W*b.x+U*A.x+F*D.x+L*O.x,v.y=W*b.y+U*A.y+F*D.y+L*O.y,v}var Ln=function(s,l,c){var y=c.x,g=c.y,v=c.z||0,S,b,A,O={};for(A=0;A<3;A++)if(!(l&&A===2&&c.z===void 0))switch(A===0?(S=y,"ew".indexOf(s.axis[A])!==-1?b="x":b="y"):A===1?(S=g,"ns".indexOf(s.axis[A])!==-1?b="y":b="x"):(S=v,b="z"),s.axis[A]){case"e":O[b]=S;break;case"w":O[b]=-S;break;case"n":O[b]=S;break;case"s":O[b]=-S;break;case"u":c[b]!==void 0&&(O.z=S);break;case"d":c[b]!==void 0&&(O.z=-S);break;default:return null}return O},Nn=function(s){var l={x:s[0],y:s[1]};return s.length>2&&(l.z=s[2]),s.length>3&&(l.m=s[3]),l},tl=function(s){rl(s.x),rl(s.y)};function rl(s){if(typeof Number.isFinite=="function"){if(Number.isFinite(s))return;throw new TypeError("coordinates must be finite numbers")}if(typeof s!="number"||s!==s||!isFinite(s))throw new TypeError("coordinates must be finite numbers")}function Yh(s,l){return(s.datum.datum_type===e||s.datum.datum_type===r)&&l.datumCode!=="WGS84"||(l.datum.datum_type===e||l.datum.datum_type===r)&&s.datumCode!=="WGS84"}function qi(s,l,c,y){var g;if(Array.isArray(c)&&(c=Nn(c)),tl(c),s.datum&&l.datum&&Yh(s,l)&&(g=new cr("WGS84"),c=qi(s,g,c,y),s=g),y&&s.axis!=="enu"&&(c=Ln(s,!1,c)),s.projName==="longlat")c={x:c.x*E,y:c.y*E,z:c.z||0};else if(s.to_meter&&(c={x:c.x*s.to_meter,y:c.y*s.to_meter,z:c.z||0}),c=s.inverse(c),!c)return;if(s.from_greenwich&&(c.x+=s.from_greenwich),c=Bs(s.datum,l.datum,c),!!c)return l.from_greenwich&&(c={x:c.x-l.from_greenwich,y:c.y,z:c.z||0}),l.projName==="longlat"?c={x:c.x*T,y:c.y*T,z:c.z||0}:(c=l.forward(c),l.to_meter&&(c={x:c.x/l.to_meter,y:c.y/l.to_meter,z:c.z||0})),y&&l.axis!=="enu"?Ln(l,!0,c):c}var Fi=cr("WGS84");function Ds(s,l,c,y){var g,v,S;return Array.isArray(c)?(g=qi(s,l,c,y)||{x:NaN,y:NaN},c.length>2?typeof s.name<"u"&&s.name==="geocent"||typeof l.name<"u"&&l.name==="geocent"?typeof g.z=="number"?[g.x,g.y,g.z].concat(c.splice(3)):[g.x,g.y,c[2]].concat(c.splice(3)):[g.x,g.y].concat(c.splice(2)):[g.x,g.y]):(v=qi(s,l,c,y),S=Object.keys(c),S.length===2||S.forEach(function(b){if(typeof s.name<"u"&&s.name==="geocent"||typeof l.name<"u"&&l.name==="geocent"){if(b==="x"||b==="y"||b==="z")return}else if(b==="x"||b==="y")return;v[b]=c[b]}),v)}function Ca(s){return s instanceof cr?s:s.oProj?s.oProj:cr(s)}function It(s,l,c){s=Ca(s);var y=!1,g;return typeof l>"u"?(l=s,s=Fi,y=!0):(typeof l.x<"u"||Array.isArray(l))&&(c=l,l=s,s=Fi,y=!0),l=Ca(l),c?Ds(s,l,c):(g={forward:function(v,S){return Ds(s,l,v,S)},inverse:function(v,S){return Ds(l,s,v,S)}},y&&(g.oProj=l),g)}var Aa=6,zs="AJSAJS",Wi="AFAFAF",jt=65,mt=73,pt=79,Pr=86,Hr=90,Us={forward:il,inverse:Xh,toPoint:nl};function il(s,l){return l=l||5,tc(Qh({lat:s[1],lon:s[0]}),l)}function Xh(s){var l=js(al(s.toUpperCase()));return l.lat&&l.lon?[l.lon,l.lat,l.lon,l.lat]:[l.left,l.bottom,l.right,l.top]}function nl(s){var l=js(al(s.toUpperCase()));return l.lat&&l.lon?[l.lon,l.lat]:[(l.left+l.right)/2,(l.top+l.bottom)/2]}function Ta(s){return s*(Math.PI/180)}function sl(s){return 180*(s/Math.PI)}function Qh(s){var l=s.lat,c=s.lon,y=6378137,g=.00669438,v=.9996,S,b,A,O,D,L,U,W=Ta(l),F=Ta(c),G,K;K=Math.floor((c+180)/6)+1,c===180&&(K=60),l>=56&&l<64&&c>=3&&c<12&&(K=32),l>=72&&l<84&&(c>=0&&c<9?K=31:c>=9&&c<21?K=33:c>=21&&c<33?K=35:c>=33&&c<42&&(K=37)),S=(K-1)*6-180+3,G=Ta(S),b=g/(1-g),A=y/Math.sqrt(1-g*Math.sin(W)*Math.sin(W)),O=Math.tan(W)*Math.tan(W),D=b*Math.cos(W)*Math.cos(W),L=Math.cos(W)*(F-G),U=y*((1-g/4-3*g*g/64-5*g*g*g/256)*W-(3*g/8+3*g*g/32+45*g*g*g/1024)*Math.sin(2*W)+(15*g*g/256+45*g*g*g/1024)*Math.sin(4*W)-35*g*g*g/3072*Math.sin(6*W));var ie=v*A*(L+(1-O+D)*L*L*L/6+(5-18*O+O*O+72*D-58*b)*L*L*L*L*L/120)+5e5,he=v*(U+A*Math.tan(W)*(L*L/2+(5-O+9*D+4*D*D)*L*L*L*L/24+(61-58*O+O*O+600*D-330*b)*L*L*L*L*L*L/720));return l<0&&(he+=1e7),{northing:Math.round(he),easting:Math.round(ie),zoneNumber:K,zoneLetter:ec(l)}}function js(s){var l=s.northing,c=s.easting,y=s.zoneLetter,g=s.zoneNumber;if(g<0||g>60)return null;var v=.9996,S=6378137,b=.00669438,A,O=(1-Math.sqrt(1-b))/(1+Math.sqrt(1-b)),D,L,U,W,F,G,K,ie,he,ge=c-5e5,Fe=l;y<"N"&&(Fe-=1e7),K=(g-1)*6-180+3,A=b/(1-b),G=Fe/v,ie=G/(S*(1-b/4-3*b*b/64-5*b*b*b/256)),he=ie+(3*O/2-27*O*O*O/32)*Math.sin(2*ie)+(21*O*O/16-55*O*O*O*O/32)*Math.sin(4*ie)+151*O*O*O/96*Math.sin(6*ie),D=S/Math.sqrt(1-b*Math.sin(he)*Math.sin(he)),L=Math.tan(he)*Math.tan(he),U=A*Math.cos(he)*Math.cos(he),W=S*(1-b)/Math.pow(1-b*Math.sin(he)*Math.sin(he),1.5),F=ge/(D*v);var ke=he-D*Math.tan(he)/W*(F*F/2-(5+3*L+10*U-4*U*U-9*A)*F*F*F*F/24+(61+90*L+298*U+45*L*L-252*A-3*U*U)*F*F*F*F*F*F/720);ke=sl(ke);var De=(F-(1+2*L+U)*F*F*F/6+(5-2*U+28*L-3*U*U+8*A+24*L*L)*F*F*F*F*F/120)/Math.cos(he);De=K+sl(De);var St;if(s.accuracy){var tt=js({northing:s.northing+s.accuracy,easting:s.easting+s.accuracy,zoneLetter:s.zoneLetter,zoneNumber:s.zoneNumber});St={top:tt.lat,right:tt.lon,bottom:ke,left:De}}else St={lat:ke,lon:De};return St}function ec(s){var l="Z";return 84>=s&&s>=72?l="X":72>s&&s>=64?l="W":64>s&&s>=56?l="V":56>s&&s>=48?l="U":48>s&&s>=40?l="T":40>s&&s>=32?l="S":32>s&&s>=24?l="R":24>s&&s>=16?l="Q":16>s&&s>=8?l="P":8>s&&s>=0?l="N":0>s&&s>=-8?l="M":-8>s&&s>=-16?l="L":-16>s&&s>=-24?l="K":-24>s&&s>=-32?l="J":-32>s&&s>=-40?l="H":-40>s&&s>=-48?l="G":-48>s&&s>=-56?l="F":-56>s&&s>=-64?l="E":-64>s&&s>=-72?l="D":-72>s&&s>=-80&&(l="C"),l}function tc(s,l){var c="00000"+s.easting,y="00000"+s.northing;return s.zoneNumber+s.zoneLetter+rc(s.easting,s.northing,s.zoneNumber)+c.substr(c.length-5,l)+y.substr(y.length-5,l)}function rc(s,l,c){var y=Hi(c),g=Math.floor(s/1e5),v=Math.floor(l/1e5)%20;return ol(g,v,y)}function Hi(s){var l=s%Aa;return l===0&&(l=Aa),l}function ol(s,l,c){var y=c-1,g=zs.charCodeAt(y),v=Wi.charCodeAt(y),S=g+s-1,b=v+l,A=!1;S>Hr&&(S=S-Hr+jt-1,A=!0),(S===mt||g<mt&&S>mt||(S>mt||g<mt)&&A)&&S++,(S===pt||g<pt&&S>pt||(S>pt||g<pt)&&A)&&(S++,S===mt&&S++),S>Hr&&(S=S-Hr+jt-1),b>Pr?(b=b-Pr+jt-1,A=!0):A=!1,(b===mt||v<mt&&b>mt||(b>mt||v<mt)&&A)&&b++,(b===pt||v<pt&&b>pt||(b>pt||v<pt)&&A)&&(b++,b===mt&&b++),b>Pr&&(b=b-Pr+jt-1);var O=String.fromCharCode(S)+String.fromCharCode(b);return O}function al(s){if(s&&s.length===0)throw"MGRSPoint coverting from nothing";for(var l=s.length,c=null,y="",g,v=0;!/[A-Z]/.test(g=s.charAt(v));){if(v>=2)throw"MGRSPoint bad conversion from: "+s;y+=g,v++}var S=parseInt(y,10);if(v===0||v+3>l)throw"MGRSPoint bad conversion from: "+s;var b=s.charAt(v++);if(b<="A"||b==="B"||b==="Y"||b>="Z"||b==="I"||b==="O")throw"MGRSPoint zone letter "+b+" not handled: "+s;c=s.substring(v,v+=2);for(var A=Hi(S),O=ll(c.charAt(0),A),D=Gi(c.charAt(1),A);D<Vi(b);)D+=2e6;var L=l-v;if(L%2!==0)throw`MGRSPoint has to have an even number
108
108
  of digits after the zone letter and two 100km letters - front
109
109
  half for easting meters, second half for
110
- northing meters`+s;var U=L/2,W=0,F=0,G,K,ie,he,ge;return U>0&&(G=1e5/Math.pow(10,U),K=s.substring(v,v+U),W=parseFloat(K)*G,ie=s.substring(v+U),F=parseFloat(ie)*G),he=W+O,ge=F+D,{easting:he,northing:ge,zoneLetter:b,zoneNumber:S,accuracy:G}}function ll(s,l){for(var c=Us.charCodeAt(l-1),y=1e5,g=!1;c!==s.charCodeAt(0);){if(c++,c===mt&&c++,c===pt&&c++,c>Hr){if(g)throw"Bad character: "+s;c=jt,g=!0}y+=1e5}return y}function Gi(s,l){if(s>"V")throw"MGRSPoint given invalid Northing "+s;for(var c=Wi.charCodeAt(l-1),y=0,g=!1;c!==s.charCodeAt(0);){if(c++,c===mt&&c++,c===pt&&c++,c>Pr){if(g)throw"Bad character: "+s;c=jt,g=!0}y+=1e5}return y}function Vi(s){var l;switch(s){case"C":l=11e5;break;case"D":l=2e6;break;case"E":l=28e5;break;case"F":l=37e5;break;case"G":l=46e5;break;case"H":l=55e5;break;case"J":l=64e5;break;case"K":l=73e5;break;case"L":l=82e5;break;case"M":l=91e5;break;case"N":l=0;break;case"P":l=8e5;break;case"Q":l=17e5;break;case"R":l=26e5;break;case"S":l=35e5;break;case"T":l=44e5;break;case"U":l=53e5;break;case"V":l=62e5;break;case"W":l=7e6;break;case"X":l=79e5;break;default:l=-1}if(l>=0)return l;throw"Invalid zone letter: "+s}function Or(s,l,c){if(!(this instanceof Or))return new Or(s,l,c);if(Array.isArray(s))this.x=s[0],this.y=s[1],this.z=s[2]||0;else if(typeof s=="object")this.x=s.x,this.y=s.y,this.z=s.z||0;else if(typeof s=="string"&&typeof l>"u"){var y=s.split(",");this.x=parseFloat(y[0],10),this.y=parseFloat(y[1],10),this.z=parseFloat(y[2],10)||0}else this.x=s,this.y=l,this.z=c||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}Or.fromMGRS=function(s){return new Or(nl(s))},Or.prototype.toMGRS=function(s){return il([this.x,this.y],s)};var ul=1,ic=.25,qs=.046875,Fs=.01953125,Ws=.01068115234375,nc=.75,sc=.46875,oc=.013020833333333334,ac=.007120768229166667,fr=.3645833333333333,lc=.005696614583333333,uc=.3076171875,hl=function(s){var l=[];l[0]=ul-s*(ic+s*(qs+s*(Fs+s*Ws))),l[1]=s*(nc-s*(qs+s*(Fs+s*Ws)));var c=s*s;return l[2]=c*(sc-s*(oc+s*ac)),c*=s,l[3]=c*(fr-s*lc),l[4]=c*s*uc,l},vi=function(s,l,c,y){return c*=l,l*=l,y[0]*s-c*(y[1]+l*(y[2]+l*(y[3]+l*y[4])))},Ia=20,Ki=function(s,l,c){for(var y=1/(1-l),g=s,v=Ia;v;--v){var S=Math.sin(g),b=1-l*S*S;if(b=(vi(g,S,Math.cos(g),c)-s)*(b*Math.sqrt(b))*y,g-=b,Math.abs(b)<w)return g}return g};function wi(){this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.es&&(this.en=hl(this.es),this.ml0=vi(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function hc(s){var l=s.x,c=s.y,y=Z(l-this.long0),g,v,S,b=Math.sin(c),A=Math.cos(c);if(this.es){var D=A*y,L=Math.pow(D,2),U=this.ep2*Math.pow(A,2),W=Math.pow(U,2),F=Math.abs(A)>w?Math.tan(c):0,G=Math.pow(F,2),K=Math.pow(G,2);g=1-this.es*Math.pow(b,2),D=D/Math.sqrt(g);var ie=vi(c,b,A,this.en);v=this.a*(this.k0*D*(1+L/6*(1-G+U+L/20*(5-18*G+K+14*U-58*G*U+L/42*(61+179*K-K*G-479*G)))))+this.x0,S=this.a*(this.k0*(ie-this.ml0+b*y*D/2*(1+L/12*(5-G+9*U+4*W+L/30*(61+K-58*G+270*U-330*G*U+L/56*(1385+543*K-K*G-3111*G))))))+this.y0}else{var O=A*Math.sin(y);if(Math.abs(Math.abs(O)-1)<w)return 93;if(v=.5*this.a*this.k0*Math.log((1+O)/(1-O))+this.x0,S=A*Math.cos(y)/Math.sqrt(1-Math.pow(O,2)),O=Math.abs(S),O>=1){if(O-1>w)return 93;S=0}else S=Math.acos(S);c<0&&(S=-S),S=this.a*this.k0*(S-this.lat0)+this.y0}return s.x=v,s.y=S,s}function cl(s){var l,c,y,g,v=(s.x-this.x0)*(1/this.a),S=(s.y-this.y0)*(1/this.a);if(this.es)if(l=this.ml0+S/this.k0,c=Ki(l,this.es,this.en),Math.abs(c)<p){var L=Math.sin(c),U=Math.cos(c),W=Math.abs(U)>w?Math.tan(c):0,F=this.ep2*Math.pow(U,2),G=Math.pow(F,2),K=Math.pow(W,2),ie=Math.pow(K,2);l=1-this.es*Math.pow(L,2);var he=v*Math.sqrt(l)/this.k0,ge=Math.pow(he,2);l=l*W,y=c-l*ge/(1-this.es)*.5*(1-ge/12*(5+3*K-9*F*K+F-4*G-ge/30*(61+90*K-252*F*K+45*ie+46*F-ge/56*(1385+3633*K+4095*ie+1574*ie*K)))),g=Z(this.long0+he*(1-ge/6*(1+2*K+F-ge/20*(5+28*K+24*ie+8*F*K+6*F-ge/42*(61+662*K+1320*ie+720*ie*K))))/U)}else y=p*$i(S),g=0;else{var b=Math.exp(v/this.k0),A=.5*(b-1/b),O=this.lat0+S/this.k0,D=Math.cos(O);l=Math.sqrt((1-Math.pow(D,2))/(1+Math.pow(A,2))),y=Math.asin(l),S<0&&(y=-y),A===0&&D===0?g=0:g=Z(Math.atan2(A,D)+this.long0)}return s.x=g,s.y=y,s}var cc=["Fast_Transverse_Mercator","Fast Transverse Mercator"],Hs={init:wi,forward:hc,inverse:cl,names:cc},Pa=function(s){var l=Math.exp(s);return l=(l-1/l)/2,l},Qt=function(s,l){s=Math.abs(s),l=Math.abs(l);var c=Math.max(s,l),y=Math.min(s,l)/(c||1);return c*Math.sqrt(1+Math.pow(y,2))},fl=function(s){var l=1+s,c=l-1;return c===0?s:s*Math.log(l)/c},dl=function(s){var l=Math.abs(s);return l=fl(l*(1+l/(Qt(1,l)+1))),s<0?-l:l},Gs=function(s,l){for(var c=2*Math.cos(2*l),y=s.length-1,g=s[y],v=0,S;--y>=0;)S=-v+c*g+s[y],v=g,g=S;return l+S*Math.sin(2*l)},Ji=function(s,l){for(var c=2*Math.cos(l),y=s.length-1,g=s[y],v=0,S;--y>=0;)S=-v+c*g+s[y],v=g,g=S;return Math.sin(l)*S},Oa=function(s){var l=Math.exp(s);return l=(l+1/l)/2,l},ka=function(s,l,c){for(var y=Math.sin(l),g=Math.cos(l),v=Pa(c),S=Oa(c),b=2*g*S,A=-2*y*v,O=s.length-1,D=s[O],L=0,U=0,W=0,F,G;--O>=0;)F=U,G=L,U=D,L=W,D=-F+b*U-A*L+s[O],W=-G+A*U+b*L;return b=y*S,A=g*v,[b*D-A*W,b*W+A*D]};function fc(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(Hs.init.apply(this),this.forward=Hs.forward,this.inverse=Hs.inverse),this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var s=this.es/(1+Math.sqrt(1-this.es)),l=s/(2-s),c=l;this.cgb[0]=l*(2+l*(-2/3+l*(-2+l*(116/45+l*(26/45+l*(-2854/675)))))),this.cbg[0]=l*(-2+l*(2/3+l*(4/3+l*(-82/45+l*(32/45+l*(4642/4725)))))),c=c*l,this.cgb[1]=c*(7/3+l*(-8/5+l*(-227/45+l*(2704/315+l*(2323/945))))),this.cbg[1]=c*(5/3+l*(-16/15+l*(-13/9+l*(904/315+l*(-1522/945))))),c=c*l,this.cgb[2]=c*(56/15+l*(-136/35+l*(-1262/105+l*(73814/2835)))),this.cbg[2]=c*(-26/15+l*(34/21+l*(8/5+l*(-12686/2835)))),c=c*l,this.cgb[3]=c*(4279/630+l*(-332/35+l*(-399572/14175))),this.cbg[3]=c*(1237/630+l*(-12/5+l*(-24832/14175))),c=c*l,this.cgb[4]=c*(4174/315+l*(-144838/6237)),this.cbg[4]=c*(-734/315+l*(109598/31185)),c=c*l,this.cgb[5]=c*(601676/22275),this.cbg[5]=c*(444337/155925),c=Math.pow(l,2),this.Qn=this.k0/(1+l)*(1+c*(1/4+c*(1/64+c/256))),this.utg[0]=l*(-.5+l*(2/3+l*(-37/96+l*(1/360+l*(81/512+l*(-96199/604800)))))),this.gtu[0]=l*(.5+l*(-2/3+l*(5/16+l*(41/180+l*(-127/288+l*(7891/37800)))))),this.utg[1]=c*(-1/48+l*(-1/15+l*(437/1440+l*(-46/105+l*(1118711/3870720))))),this.gtu[1]=c*(13/48+l*(-3/5+l*(557/1440+l*(281/630+l*(-1983433/1935360))))),c=c*l,this.utg[2]=c*(-17/480+l*(37/840+l*(209/4480+l*(-5569/90720)))),this.gtu[2]=c*(61/240+l*(-103/140+l*(15061/26880+l*(167603/181440)))),c=c*l,this.utg[3]=c*(-4397/161280+l*(11/504+l*(830251/7257600))),this.gtu[3]=c*(49561/161280+l*(-179/168+l*(6601661/7257600))),c=c*l,this.utg[4]=c*(-4583/161280+l*(108847/3991680)),this.gtu[4]=c*(34729/80640+l*(-3418889/1995840)),c=c*l,this.utg[5]=c*(-20648693/638668800),this.gtu[5]=c*(212378941/319334400);var y=Gs(this.cbg,this.lat0);this.Zb=-this.Qn*(y+Ji(this.gtu,2*y))}function Vs(s){var l=Z(s.x-this.long0),c=s.y;c=Gs(this.cbg,c);var y=Math.sin(c),g=Math.cos(c),v=Math.sin(l),S=Math.cos(l);c=Math.atan2(y,S*g),l=Math.atan2(v*g,Qt(y,g*S)),l=dl(Math.tan(l));var b=ka(this.gtu,2*c,2*l);c=c+b[0],l=l+b[1];var A,O;return Math.abs(l)<=2.623395162778?(A=this.a*(this.Qn*l)+this.x0,O=this.a*(this.Qn*c+this.Zb)+this.y0):(A=1/0,O=1/0),s.x=A,s.y=O,s}function dc(s){var l=(s.x-this.x0)*(1/this.a),c=(s.y-this.y0)*(1/this.a);c=(c-this.Zb)/this.Qn,l=l/this.Qn;var y,g;if(Math.abs(l)<=2.623395162778){var v=ka(this.utg,2*c,2*l);c=c+v[0],l=l+v[1],l=Math.atan(Pa(l));var S=Math.sin(c),b=Math.cos(c),A=Math.sin(l),O=Math.cos(l);c=Math.atan2(S*O,Qt(A,O*b)),l=Math.atan2(A,O*b),y=Z(l+this.long0),g=Gs(this.cgb,c)}else y=1/0,g=1/0;return s.x=y,s.y=g,s}var mc=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","tmerc"],Bn={init:fc,forward:Vs,inverse:dc,names:mc},pc=function(s,l){if(s===void 0){if(s=Math.floor((Z(l)+Math.PI)*30/Math.PI)+1,s<0)return 0;if(s>60)return 60}return s},Ks="etmerc";function La(){var s=pc(this.zone,this.long0);if(s===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(s)-183)*E,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,Bn.init.apply(this),this.forward=Bn.forward,this.inverse=Bn.inverse}var gc=["Universal Transverse Mercator System","utm"],yc={init:La,names:gc,dependsOn:Ks},Dn=function(s,l){return Math.pow((1-s)/(1+s),l)},ml=20;function Js(){var s=Math.sin(this.lat0),l=Math.cos(this.lat0);l*=l,this.rc=Math.sqrt(1-this.es)/(1-this.es*s*s),this.C=Math.sqrt(1+this.es*l*l/(1-this.es)),this.phic0=Math.asin(s/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+C)/(Math.pow(Math.tan(.5*this.lat0+C),this.C)*Dn(this.e*s,this.ratexp))}function Na(s){var l=s.x,c=s.y;return s.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*c+C),this.C)*Dn(this.e*Math.sin(c),this.ratexp))-p,s.x=this.C*l,s}function _i(s){for(var l=1e-14,c=s.x/this.C,y=s.y,g=Math.pow(Math.tan(.5*y+C)/this.K,1/this.C),v=ml;v>0&&(y=2*Math.atan(g*Dn(this.e*Math.sin(s.y),-.5*this.e))-p,!(Math.abs(y-s.y)<l));--v)s.y=y;return v?(s.x=c,s.y=y,s):null}var zn=["gauss"],Zi={init:Js,forward:Na,inverse:_i,names:zn};function pl(){Zi.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))}function bc(s){var l,c,y,g;return s.x=Z(s.x-this.long0),Zi.forward.apply(this,[s]),l=Math.sin(s.y),c=Math.cos(s.y),y=Math.cos(s.x),g=this.k0*this.R2/(1+this.sinc0*l+this.cosc0*c*y),s.x=g*c*Math.sin(s.x),s.y=g*(this.cosc0*l-this.sinc0*c*y),s.x=this.a*s.x+this.x0,s.y=this.a*s.y+this.y0,s}function Ba(s){var l,c,y,g,v;if(s.x=(s.x-this.x0)/this.a,s.y=(s.y-this.y0)/this.a,s.x/=this.k0,s.y/=this.k0,v=Math.sqrt(s.x*s.x+s.y*s.y)){var S=2*Math.atan2(v,this.R2);l=Math.sin(S),c=Math.cos(S),g=Math.asin(c*this.sinc0+s.y*l*this.cosc0/v),y=Math.atan2(s.x*l,v*this.cosc0*c-s.y*this.sinc0*l)}else g=this.phic0,y=0;return s.x=y,s.y=g,Zi.inverse.apply(this,[s]),s.x=Z(s.x+this.long0),s}var vc=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"],gl={init:pl,forward:bc,inverse:Ba,names:vc};function Zs(s,l,c){return l*=c,Math.tan(.5*(p+s))*Math.pow((1-l)/(1+l),.5*c)}function Da(){this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=w&&(this.k0=.5*(1+$i(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=w&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=w&&(this.k0=.5*this.cons*Tt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/ot(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=Tt(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-p,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function yl(s){var l=s.x,c=s.y,y=Math.sin(c),g=Math.cos(c),v,S,b,A,O,D,L=Z(l-this.long0);return Math.abs(Math.abs(l-this.long0)-Math.PI)<=w&&Math.abs(c+this.lat0)<=w?(s.x=NaN,s.y=NaN,s):this.sphere?(v=2*this.k0/(1+this.sinlat0*y+this.coslat0*g*Math.cos(L)),s.x=this.a*v*g*Math.sin(L)+this.x0,s.y=this.a*v*(this.coslat0*y-this.sinlat0*g*Math.cos(L))+this.y0,s):(S=2*Math.atan(this.ssfn_(c,y,this.e))-p,A=Math.cos(S),b=Math.sin(S),Math.abs(this.coslat0)<=w?(O=ot(this.e,c*this.con,this.con*y),D=2*this.a*this.k0*O/this.cons,s.x=this.x0+D*Math.sin(l-this.long0),s.y=this.y0-this.con*D*Math.cos(l-this.long0),s):(Math.abs(this.sinlat0)<w?(v=2*this.a*this.k0/(1+A*Math.cos(L)),s.y=v*b):(v=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*b+this.cosX0*A*Math.cos(L))),s.y=v*(this.cosX0*b-this.sinX0*A*Math.cos(L))+this.y0),s.x=v*A*Math.sin(L)+this.x0,s))}function bl(s){s.x-=this.x0,s.y-=this.y0;var l,c,y,g,v,S=Math.sqrt(s.x*s.x+s.y*s.y);if(this.sphere){var b=2*Math.atan(S/(2*this.a*this.k0));return l=this.long0,c=this.lat0,S<=w?(s.x=l,s.y=c,s):(c=Math.asin(Math.cos(b)*this.sinlat0+s.y*Math.sin(b)*this.coslat0/S),Math.abs(this.coslat0)<w?this.lat0>0?l=Z(this.long0+Math.atan2(s.x,-1*s.y)):l=Z(this.long0+Math.atan2(s.x,s.y)):l=Z(this.long0+Math.atan2(s.x*Math.sin(b),S*this.coslat0*Math.cos(b)-s.y*this.sinlat0*Math.sin(b))),s.x=l,s.y=c,s)}else if(Math.abs(this.coslat0)<=w){if(S<=w)return c=this.lat0,l=this.long0,s.x=l,s.y=c,s;s.x*=this.con,s.y*=this.con,y=S*this.cons/(2*this.a*this.k0),c=this.con*Ir(this.e,y),l=this.con*Z(this.con*this.long0+Math.atan2(s.x,-1*s.y))}else g=2*Math.atan(S*this.cosX0/(2*this.a*this.k0*this.ms1)),l=this.long0,S<=w?v=this.X0:(v=Math.asin(Math.cos(g)*this.sinX0+s.y*Math.sin(g)*this.cosX0/S),l=Z(this.long0+Math.atan2(s.x*Math.sin(g),S*this.cosX0*Math.cos(g)-s.y*this.sinX0*Math.sin(g)))),c=-1*Ir(this.e,Math.tan(.5*(p+v)));return s.x=l,s.y=c,s}var wc=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],_c={init:Da,forward:yl,inverse:bl,names:wc,ssfn_:Zs};function za(){var s=this.lat0;this.lambda0=this.long0;var l=Math.sin(s),c=this.a,y=this.rf,g=1/y,v=2*g-Math.pow(g,2),S=this.e=Math.sqrt(v);this.R=this.k0*c*Math.sqrt(1-v)/(1-v*Math.pow(l,2)),this.alpha=Math.sqrt(1+v/(1-v)*Math.pow(Math.cos(s),4)),this.b0=Math.asin(l/this.alpha);var b=Math.log(Math.tan(Math.PI/4+this.b0/2)),A=Math.log(Math.tan(Math.PI/4+s/2)),O=Math.log((1+S*l)/(1-S*l));this.K=b-this.alpha*A+this.alpha*S/2*O}function vl(s){var l=Math.log(Math.tan(Math.PI/4-s.y/2)),c=this.e/2*Math.log((1+this.e*Math.sin(s.y))/(1-this.e*Math.sin(s.y))),y=-this.alpha*(l+c)+this.K,g=2*(Math.atan(Math.exp(y))-Math.PI/4),v=this.alpha*(s.x-this.lambda0),S=Math.atan(Math.sin(v)/(Math.sin(this.b0)*Math.tan(g)+Math.cos(this.b0)*Math.cos(v))),b=Math.asin(Math.cos(this.b0)*Math.sin(g)-Math.sin(this.b0)*Math.cos(g)*Math.cos(v));return s.y=this.R/2*Math.log((1+Math.sin(b))/(1-Math.sin(b)))+this.y0,s.x=this.R*S+this.x0,s}function xc(s){for(var l=s.x-this.x0,c=s.y-this.y0,y=l/this.R,g=2*(Math.atan(Math.exp(c/this.R))-Math.PI/4),v=Math.asin(Math.cos(this.b0)*Math.sin(g)+Math.sin(this.b0)*Math.cos(g)*Math.cos(y)),S=Math.atan(Math.sin(y)/(Math.cos(this.b0)*Math.cos(y)-Math.sin(this.b0)*Math.tan(g))),b=this.lambda0+S/this.alpha,A=0,O=v,D=-1e3,L=0;Math.abs(O-D)>1e-7;){if(++L>20)return;A=1/this.alpha*(Math.log(Math.tan(Math.PI/4+v/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(O))/2)),D=O,O=2*Math.atan(Math.exp(A))-Math.PI/2}return s.x=b,s.y=O,s}var Sc=["somerc"],Mc={init:za,forward:vl,inverse:xc,names:Sc},xi=1e-7;function Yi(s){var l=["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],c=typeof s.PROJECTION=="object"?Object.keys(s.PROJECTION)[0]:s.PROJECTION;return"no_uoff"in s||"no_off"in s||l.indexOf(c)!==-1}function Ys(){var s,l,c,y,g,v,S,b,A,O,D=0,L,U=0,W=0,F=0,G=0,K=0,ie=0;this.no_off=Yi(this),this.no_rot="no_rot"in this;var he=!1;"alpha"in this&&(he=!0);var ge=!1;if("rectified_grid_angle"in this&&(ge=!0),he&&(ie=this.alpha),ge&&(D=this.rectified_grid_angle*E),he||ge)U=this.longc;else if(W=this.long1,G=this.lat1,F=this.long2,K=this.lat2,Math.abs(G-K)<=xi||(s=Math.abs(G))<=xi||Math.abs(s-p)<=xi||Math.abs(Math.abs(this.lat0)-p)<=xi||Math.abs(Math.abs(K)-p)<=xi)throw new Error;var Fe=1-this.es;l=Math.sqrt(Fe),Math.abs(this.lat0)>w?(b=Math.sin(this.lat0),c=Math.cos(this.lat0),s=1-this.es*b*b,this.B=c*c,this.B=Math.sqrt(1+this.es*this.B*this.B/Fe),this.A=this.B*this.k0*l/s,y=this.B*l/(c*Math.sqrt(s)),g=y*y-1,g<=0?g=0:(g=Math.sqrt(g),this.lat0<0&&(g=-g)),this.E=g+=y,this.E*=Math.pow(ot(this.e,this.lat0,b),this.B)):(this.B=1/l,this.A=this.k0,this.E=y=g=1),he||ge?(he?(L=Math.asin(Math.sin(ie)/y),ge||(D=ie)):(L=D,ie=Math.asin(y*Math.sin(L))),this.lam0=U-Math.asin(.5*(g-1/g)*Math.tan(L))/this.B):(v=Math.pow(ot(this.e,G,Math.sin(G)),this.B),S=Math.pow(ot(this.e,K,Math.sin(K)),this.B),g=this.E/v,A=(S-v)/(S+v),O=this.E*this.E,O=(O-S*v)/(O+S*v),s=W-F,s<-Math.pi?F-=I:s>Math.pi&&(F+=I),this.lam0=Z(.5*(W+F)-Math.atan(O*Math.tan(.5*this.B*(W-F))/A)/this.B),L=Math.atan(2*Math.sin(this.B*Z(W-this.lam0))/(g-1/g)),D=ie=Math.asin(y*Math.sin(L))),this.singam=Math.sin(L),this.cosgam=Math.cos(L),this.sinrot=Math.sin(D),this.cosrot=Math.cos(D),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(y*y-1)/Math.cos(ie))),this.lat0<0&&(this.u_0=-this.u_0)),g=.5*L,this.v_pole_n=this.ArB*Math.log(Math.tan(C-g)),this.v_pole_s=this.ArB*Math.log(Math.tan(C+g))}function Un(s){var l={},c,y,g,v,S,b,A,O;if(s.x=s.x-this.lam0,Math.abs(Math.abs(s.y)-p)>w){if(S=this.E/Math.pow(ot(this.e,s.y,Math.sin(s.y)),this.B),b=1/S,c=.5*(S-b),y=.5*(S+b),v=Math.sin(this.B*s.x),g=(c*this.singam-v*this.cosgam)/y,Math.abs(Math.abs(g)-1)<w)throw new Error;O=.5*this.ArB*Math.log((1-g)/(1+g)),b=Math.cos(this.B*s.x),Math.abs(b)<xi?A=this.A*s.x:A=this.ArB*Math.atan2(c*this.cosgam+v*this.singam,b)}else O=s.y>0?this.v_pole_n:this.v_pole_s,A=this.ArB*s.y;return this.no_rot?(l.x=A,l.y=O):(A-=this.u_0,l.x=O*this.cosrot+A*this.sinrot,l.y=A*this.cosrot-O*this.sinrot),l.x=this.a*l.x+this.x0,l.y=this.a*l.y+this.y0,l}function wl(s){var l,c,y,g,v,S,b,A={};if(s.x=(s.x-this.x0)*(1/this.a),s.y=(s.y-this.y0)*(1/this.a),this.no_rot?(c=s.y,l=s.x):(c=s.x*this.cosrot-s.y*this.sinrot,l=s.y*this.cosrot+s.x*this.sinrot+this.u_0),y=Math.exp(-this.BrA*c),g=.5*(y-1/y),v=.5*(y+1/y),S=Math.sin(this.BrA*l),b=(S*this.cosgam+g*this.singam)/v,Math.abs(Math.abs(b)-1)<w)A.x=0,A.y=b<0?-p:p;else{if(A.y=this.E/Math.sqrt((1+b)/(1-b)),A.y=Ir(this.e,Math.pow(A.y,1/this.B)),A.y===1/0)throw new Error;A.x=-this.rB*Math.atan2(g*this.cosgam-S*this.singam,Math.cos(this.BrA*l))}return A.x+=this.lam0,A}var Xs=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","Oblique_Mercator","omerc"],jn={init:Ys,forward:Un,inverse:wl,names:Xs};function Qs(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(Math.abs(this.lat1+this.lat2)<w)){var s=this.b/this.a;this.e=Math.sqrt(1-s*s);var l=Math.sin(this.lat1),c=Math.cos(this.lat1),y=Tt(this.e,l,c),g=ot(this.e,this.lat1,l),v=Math.sin(this.lat2),S=Math.cos(this.lat2),b=Tt(this.e,v,S),A=ot(this.e,this.lat2,v),O=ot(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>w?this.ns=Math.log(y/b)/Math.log(g/A):this.ns=l,isNaN(this.ns)&&(this.ns=l),this.f0=y/(this.ns*Math.pow(g,this.ns)),this.rh=this.a*this.f0*Math.pow(O,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function Gr(s){var l=s.x,c=s.y;Math.abs(2*Math.abs(c)-Math.PI)<=w&&(c=$i(c)*(p-2*w));var y=Math.abs(Math.abs(c)-p),g,v;if(y>w)g=ot(this.e,c,Math.sin(c)),v=this.a*this.f0*Math.pow(g,this.ns);else{if(y=c*this.ns,y<=0)return null;v=0}var S=this.ns*Z(l-this.long0);return s.x=this.k0*(v*Math.sin(S))+this.x0,s.y=this.k0*(this.rh-v*Math.cos(S))+this.y0,s}function Ua(s){var l,c,y,g,v,S=(s.x-this.x0)/this.k0,b=this.rh-(s.y-this.y0)/this.k0;this.ns>0?(l=Math.sqrt(S*S+b*b),c=1):(l=-Math.sqrt(S*S+b*b),c=-1);var A=0;if(l!==0&&(A=Math.atan2(c*S,c*b)),l!==0||this.ns>0){if(c=1/this.ns,y=Math.pow(l/(this.a*this.f0),c),g=Ir(this.e,y),g===-9999)return null}else g=-p;return v=Z(A/this.ns+this.long0),s.x=v,s.y=g,s}var Ec=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"],Xi={init:Qs,forward:Gr,inverse:Ua,names:Ec};function _l(){this.a=6377397155e-3,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.7417649320975901-.308341501185665),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function Rc(s){var l,c,y,g,v,S,b,A=s.x,O=s.y,D=Z(A-this.long0);return l=Math.pow((1+this.e*Math.sin(O))/(1-this.e*Math.sin(O)),this.alfa*this.e/2),c=2*(Math.atan(this.k*Math.pow(Math.tan(O/2+this.s45),this.alfa)/l)-this.s45),y=-D*this.alfa,g=Math.asin(Math.cos(this.ad)*Math.sin(c)+Math.sin(this.ad)*Math.cos(c)*Math.cos(y)),v=Math.asin(Math.cos(c)*Math.sin(y)/Math.cos(g)),S=this.n*v,b=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(g/2+this.s45),this.n),s.y=b*Math.cos(S)/1,s.x=b*Math.sin(S)/1,this.czech||(s.y*=-1,s.x*=-1),s}function eo(s){var l,c,y,g,v,S,b,A,O=s.x;s.x=s.y,s.y=O,this.czech||(s.y*=-1,s.x*=-1),S=Math.sqrt(s.x*s.x+s.y*s.y),v=Math.atan2(s.y,s.x),g=v/Math.sin(this.s0),y=2*(Math.atan(Math.pow(this.ro0/S,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),l=Math.asin(Math.cos(this.ad)*Math.sin(y)-Math.sin(this.ad)*Math.cos(y)*Math.cos(g)),c=Math.asin(Math.cos(y)*Math.sin(g)/Math.cos(l)),s.x=this.long0-c/this.alfa,b=l,A=0;var D=0;do s.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(l/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(b))/(1-this.e*Math.sin(b)),this.e/2))-this.s45),Math.abs(b-s.y)<1e-10&&(A=1),b=s.y,D+=1;while(A===0&&D<15);return D>=15?null:s}var Cc=["Krovak","krovak"],Ac={init:_l,forward:Rc,inverse:eo,names:Cc},gt=function(s,l,c,y,g){return s*g-l*Math.sin(2*g)+c*Math.sin(4*g)-y*Math.sin(6*g)},$n=function(s){return 1-.25*s*(1+s/16*(3+1.25*s))},qn=function(s){return .375*s*(1+.25*s*(1+.46875*s))},Fn=function(s){return .05859375*s*s*(1+.75*s)},Wn=function(s){return s*s*s*(35/3072)},Qi=function(s,l,c){var y=l*c;return s/Math.sqrt(1-y*y)},en=function(s){return Math.abs(s)<p?s:s-$i(s)*Math.PI},to=function(s,l,c,y,g){var v,S;v=s/l;for(var b=0;b<15;b++)if(S=(s-(l*v-c*Math.sin(2*v)+y*Math.sin(4*v)-g*Math.sin(6*v)))/(l-2*c*Math.cos(2*v)+4*y*Math.cos(4*v)-6*g*Math.cos(6*v)),v+=S,Math.abs(S)<=1e-10)return v;return NaN};function Tc(){this.sphere||(this.e0=$n(this.es),this.e1=qn(this.es),this.e2=Fn(this.es),this.e3=Wn(this.es),this.ml0=this.a*gt(this.e0,this.e1,this.e2,this.e3,this.lat0))}function xl(s){var l,c,y=s.x,g=s.y;if(y=Z(y-this.long0),this.sphere)l=this.a*Math.asin(Math.cos(g)*Math.sin(y)),c=this.a*(Math.atan2(Math.tan(g),Math.cos(y))-this.lat0);else{var v=Math.sin(g),S=Math.cos(g),b=Qi(this.a,this.e,v),A=Math.tan(g)*Math.tan(g),O=y*Math.cos(g),D=O*O,L=this.es*S*S/(1-this.es),U=this.a*gt(this.e0,this.e1,this.e2,this.e3,g);l=b*O*(1-D*A*(1/6-(8-A+8*L)*D/120)),c=U-this.ml0+b*v/S*D*(.5+(5-A+6*L)*D/24)}return s.x=l+this.x0,s.y=c+this.y0,s}function Ic(s){s.x-=this.x0,s.y-=this.y0;var l=s.x/this.a,c=s.y/this.a,y,g;if(this.sphere){var v=c+this.lat0;y=Math.asin(Math.sin(v)*Math.cos(l)),g=Math.atan2(Math.tan(l),Math.cos(v))}else{var S=this.ml0/this.a+c,b=to(S,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(b)-p)<=w)return s.x=this.long0,s.y=p,c<0&&(s.y*=-1),s;var A=Qi(this.a,this.e,Math.sin(b)),O=A*A*A/this.a/this.a*(1-this.es),D=Math.pow(Math.tan(b),2),L=l*this.a/A,U=L*L;y=b-A*Math.tan(b)/O*L*L*(.5-(1+3*D)*L*L/24),g=L*(1-U*(D/3+(1+3*D)*D*U/15))/Math.cos(b)}return s.x=Z(g+this.long0),s.y=en(y),s}var Pc=["Cassini","Cassini_Soldner","cass"],Vr={init:Tc,forward:xl,inverse:Ic,names:Pc},dr=function(s,l){var c;return s>1e-7?(c=s*l,(1-s*s)*(l/(1-c*c)-.5/s*Math.log((1-c)/(1+c)))):2*l},Sl=1,ja=2,Kr=3,Jr=4;function er(){var s=Math.abs(this.lat0);if(Math.abs(s-p)<w?this.mode=this.lat0<0?this.S_POLE:this.N_POLE:Math.abs(s)<w?this.mode=this.EQUIT:this.mode=this.OBLIQ,this.es>0){var l;switch(this.qp=dr(this.e,1),this.mmf=.5/(1-this.es),this.apa=Tl(this.es),this.mode){case this.N_POLE:this.dd=1;break;case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),l=Math.sin(this.lat0),this.sinb1=dr(this.e,l)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*l*l)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd;break}}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function Hn(s){var l,c,y,g,v,S,b,A,O,D,L=s.x,U=s.y;if(L=Z(L-this.long0),this.sphere){if(v=Math.sin(U),D=Math.cos(U),y=Math.cos(L),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(c=this.mode===this.EQUIT?1+D*y:1+this.sinph0*v+this.cosph0*D*y,c<=w)return null;c=Math.sqrt(2/c),l=c*D*Math.sin(L),c*=this.mode===this.EQUIT?v:this.cosph0*v-this.sinph0*D*y}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(y=-y),Math.abs(U+this.lat0)<w)return null;c=C-U*.5,c=2*(this.mode===this.S_POLE?Math.cos(c):Math.sin(c)),l=c*Math.sin(L),c*=y}}else{switch(b=0,A=0,O=0,y=Math.cos(L),g=Math.sin(L),v=Math.sin(U),S=dr(this.e,v),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(b=S/this.qp,A=Math.sqrt(1-b*b)),this.mode){case this.OBLIQ:O=1+this.sinb1*b+this.cosb1*A*y;break;case this.EQUIT:O=1+A*y;break;case this.N_POLE:O=p+U,S=this.qp-S;break;case this.S_POLE:O=U-p,S=this.qp+S;break}if(Math.abs(O)<w)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:O=Math.sqrt(2/O),this.mode===this.OBLIQ?c=this.ymf*O*(this.cosb1*b-this.sinb1*A*y):c=(O=Math.sqrt(2/(1+A*y)))*b*this.ymf,l=this.xmf*O*A*g;break;case this.N_POLE:case this.S_POLE:S>=0?(l=(O=Math.sqrt(S))*g,c=y*(this.mode===this.S_POLE?O:-O)):l=c=0;break}}return s.x=this.a*l+this.x0,s.y=this.a*c+this.y0,s}function Ml(s){s.x-=this.x0,s.y-=this.y0;var l=s.x/this.a,c=s.y/this.a,y,g,v,S,b,A,O;if(this.sphere){var D=0,L,U=0;if(L=Math.sqrt(l*l+c*c),g=L*.5,g>1)return null;switch(g=2*Math.asin(g),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(U=Math.sin(g),D=Math.cos(g)),this.mode){case this.EQUIT:g=Math.abs(L)<=w?0:Math.asin(c*U/L),l*=U,c=D*L;break;case this.OBLIQ:g=Math.abs(L)<=w?this.lat0:Math.asin(D*this.sinph0+c*U*this.cosph0/L),l*=U*this.cosph0,c=(D-Math.sin(g)*this.sinph0)*L;break;case this.N_POLE:c=-c,g=p-g;break;case this.S_POLE:g-=p;break}y=c===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(l,c)}else{if(O=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(l/=this.dd,c*=this.dd,A=Math.sqrt(l*l+c*c),A<w)return s.x=this.long0,s.y=this.lat0,s;S=2*Math.asin(.5*A/this.rq),v=Math.cos(S),l*=S=Math.sin(S),this.mode===this.OBLIQ?(O=v*this.sinb1+c*S*this.cosb1/A,b=this.qp*O,c=A*this.cosb1*v-c*this.sinb1*S):(O=c*S/A,b=this.qp*O,c=A*v)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(c=-c),b=l*l+c*c,!b)return s.x=this.long0,s.y=this.lat0,s;O=1-b/this.qp,this.mode===this.S_POLE&&(O=-O)}y=Math.atan2(l,c),g=io(Math.asin(O),this.apa)}return s.x=Z(this.long0+y),s.y=g,s}var Si=.3333333333333333,El=.17222222222222222,Rl=.10257936507936508,ro=.06388888888888888,Cl=.0664021164021164,Al=.016415012942191543;function Tl(s){var l,c=[];return c[0]=s*Si,l=s*s,c[0]+=l*El,c[1]=l*ro,l*=s,c[0]+=l*Rl,c[1]+=l*Cl,c[2]=l*Al,c}function io(s,l){var c=s+s;return s+l[0]*Math.sin(c)+l[1]*Math.sin(c+c)+l[2]*Math.sin(c+c+c)}var Il=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],Pl={init:er,forward:Hn,inverse:Ml,names:Il,S_POLE:Sl,N_POLE:ja,EQUIT:Kr,OBLIQ:Jr},Zr=function(s){return Math.abs(s)>1&&(s=s>1?1:-1),Math.asin(s)};function Oc(){Math.abs(this.lat1+this.lat2)<w||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=Tt(this.e3,this.sin_po,this.cos_po),this.qs1=dr(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=Tt(this.e3,this.sin_po,this.cos_po),this.qs2=dr(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=dr(this.e3,this.sin_po,this.cos_po),Math.abs(this.lat1-this.lat2)>w?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function kc(s){var l=s.x,c=s.y;this.sin_phi=Math.sin(c),this.cos_phi=Math.cos(c);var y=dr(this.e3,this.sin_phi,this.cos_phi),g=this.a*Math.sqrt(this.c-this.ns0*y)/this.ns0,v=this.ns0*Z(l-this.long0),S=g*Math.sin(v)+this.x0,b=this.rh-g*Math.cos(v)+this.y0;return s.x=S,s.y=b,s}function Lc(s){var l,c,y,g,v,S;return s.x-=this.x0,s.y=this.rh-s.y+this.y0,this.ns0>=0?(l=Math.sqrt(s.x*s.x+s.y*s.y),y=1):(l=-Math.sqrt(s.x*s.x+s.y*s.y),y=-1),g=0,l!==0&&(g=Math.atan2(y*s.x,y*s.y)),y=l*this.ns0/this.a,this.sphere?S=Math.asin((this.c-y*y)/(2*this.ns0)):(c=(this.c-y*y)/this.ns0,S=this.phi1z(this.e3,c)),v=Z(g/this.ns0+this.long0),s.x=v,s.y=S,s}function no(s,l){var c,y,g,v,S,b=Zr(.5*l);if(s<w)return b;for(var A=s*s,O=1;O<=25;O++)if(c=Math.sin(b),y=Math.cos(b),g=s*c,v=1-g*g,S=.5*v*v/y*(l/(1-A)-c/v+.5/s*Math.log((1-g)/(1+g))),b=b+S,Math.abs(S)<=1e-7)return b;return null}var Nc=["Albers_Conic_Equal_Area","Albers","aea"],Ol={init:Oc,forward:kc,inverse:Lc,names:Nc,phi1z:no};function so(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function oo(s){var l,c,y,g,v,S,b,A,O=s.x,D=s.y;return y=Z(O-this.long0),l=Math.sin(D),c=Math.cos(D),g=Math.cos(y),S=this.sin_p14*l+this.cos_p14*c*g,v=1,S>0||Math.abs(S)<=w?(b=this.x0+this.a*v*c*Math.sin(y)/S,A=this.y0+this.a*v*(this.cos_p14*l-this.sin_p14*c*g)/S):(b=this.x0+this.infinity_dist*c*Math.sin(y),A=this.y0+this.infinity_dist*(this.cos_p14*l-this.sin_p14*c*g)),s.x=b,s.y=A,s}function ao(s){var l,c,y,g,v,S;return s.x=(s.x-this.x0)/this.a,s.y=(s.y-this.y0)/this.a,s.x/=this.k0,s.y/=this.k0,(l=Math.sqrt(s.x*s.x+s.y*s.y))?(g=Math.atan2(l,this.rc),c=Math.sin(g),y=Math.cos(g),S=Zr(y*this.sin_p14+s.y*c*this.cos_p14/l),v=Math.atan2(s.x*c,l*this.cos_p14*y-s.y*this.sin_p14*c),v=Z(this.long0+v)):(S=this.phic0,v=0),s.x=v,s.y=S,s}var Gn=["gnom"],lo={init:so,forward:oo,inverse:ao,names:Gn},Bc=function(s,l){var c=1-(1-s*s)/(2*s)*Math.log((1-s)/(1+s));if(Math.abs(Math.abs(l)-c)<1e-6)return l<0?-1*p:p;for(var y=Math.asin(.5*l),g,v,S,b,A=0;A<30;A++)if(v=Math.sin(y),S=Math.cos(y),b=s*v,g=Math.pow(1-b*b,2)/(2*S)*(l/(1-s*s)-v/(1-b*b)+.5/s*Math.log((1-b)/(1+b))),y+=g,Math.abs(g)<=1e-10)return y;return NaN};function Dc(){this.sphere||(this.k0=Tt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function kl(s){var l=s.x,c=s.y,y,g,v=Z(l-this.long0);if(this.sphere)y=this.x0+this.a*v*Math.cos(this.lat_ts),g=this.y0+this.a*Math.sin(c)/Math.cos(this.lat_ts);else{var S=dr(this.e,Math.sin(c));y=this.x0+this.a*this.k0*v,g=this.y0+this.a*S*.5/this.k0}return s.x=y,s.y=g,s}function Ll(s){s.x-=this.x0,s.y-=this.y0;var l,c;return this.sphere?(l=Z(this.long0+s.x/this.a/Math.cos(this.lat_ts)),c=Math.asin(s.y/this.a*Math.cos(this.lat_ts))):(c=Bc(this.e,2*s.y*this.k0/this.a),l=Z(this.long0+s.x/(this.a*this.k0))),s.x=l,s.y=c,s}var zc=["cea"],Nl={init:Dc,forward:kl,inverse:Ll,names:zc};function Uc(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)}function jc(s){var l=s.x,c=s.y,y=Z(l-this.long0),g=en(c-this.lat0);return s.x=this.x0+this.a*y*this.rc,s.y=this.y0+this.a*g,s}function $c(s){var l=s.x,c=s.y;return s.x=Z(this.long0+(l-this.x0)/(this.a*this.rc)),s.y=en(this.lat0+(c-this.y0)/this.a),s}var qc=["Equirectangular","Equidistant_Cylindrical","eqc"],Fc={init:Uc,forward:jc,inverse:$c,names:qc},Vn=20;function Bl(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=$n(this.es),this.e1=qn(this.es),this.e2=Fn(this.es),this.e3=Wn(this.es),this.ml0=this.a*gt(this.e0,this.e1,this.e2,this.e3,this.lat0)}function u(s){var l=s.x,c=s.y,y,g,v,S=Z(l-this.long0);if(v=S*Math.sin(c),this.sphere)Math.abs(c)<=w?(y=this.a*S,g=-1*this.a*this.lat0):(y=this.a*Math.sin(v)/Math.tan(c),g=this.a*(en(c-this.lat0)+(1-Math.cos(v))/Math.tan(c)));else if(Math.abs(c)<=w)y=this.a*S,g=-1*this.ml0;else{var b=Qi(this.a,this.e,Math.sin(c))/Math.tan(c);y=b*Math.sin(v),g=this.a*gt(this.e0,this.e1,this.e2,this.e3,c)-this.ml0+b*(1-Math.cos(v))}return s.x=y+this.x0,s.y=g+this.y0,s}function f(s){var l,c,y,g,v,S,b,A,O;if(y=s.x-this.x0,g=s.y-this.y0,this.sphere)if(Math.abs(g+this.a*this.lat0)<=w)l=Z(y/this.a+this.long0),c=0;else{S=this.lat0+g/this.a,b=y*y/this.a/this.a+S*S,A=S;var D;for(v=Vn;v;--v)if(D=Math.tan(A),O=-1*(S*(A*D+1)-A-.5*(A*A+b)*D)/((A-S)/D-1),A+=O,Math.abs(O)<=w){c=A;break}l=Z(this.long0+Math.asin(y*Math.tan(A)/this.a)/Math.sin(c))}else if(Math.abs(g+this.ml0)<=w)c=0,l=Z(this.long0+y/this.a);else{S=(this.ml0+g)/this.a,b=y*y/this.a/this.a+S*S,A=S;var L,U,W,F,G;for(v=Vn;v;--v)if(G=this.e*Math.sin(A),L=Math.sqrt(1-G*G)*Math.tan(A),U=this.a*gt(this.e0,this.e1,this.e2,this.e3,A),W=this.e0-2*this.e1*Math.cos(2*A)+4*this.e2*Math.cos(4*A)-6*this.e3*Math.cos(6*A),F=U/this.a,O=(S*(L*F+1)-F-.5*L*(F*F+b))/(this.es*Math.sin(2*A)*(F*F+b-2*S*F)/(4*L)+(S-F)*(L*W-2/Math.sin(2*A))-W),A-=O,Math.abs(O)<=w){c=A;break}L=Math.sqrt(1-this.es*Math.pow(Math.sin(c),2))*Math.tan(c),l=Z(this.long0+Math.asin(y*L/this.a)/Math.sin(c))}return s.x=l,s.y=c,s}var _=["Polyconic","poly"],P={init:Bl,forward:u,inverse:f,names:_};function N(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function j(s){var l,c=s.x,y=s.y,g=y-this.lat0,v=c-this.long0,S=g/m*1e-5,b=v,A=1,O=0;for(l=1;l<=10;l++)A=A*S,O=O+this.A[l]*A;var D=O,L=b,U=1,W=0,F,G,K=0,ie=0;for(l=1;l<=6;l++)F=U*D-W*L,G=W*D+U*L,U=F,W=G,K=K+this.B_re[l]*U-this.B_im[l]*W,ie=ie+this.B_im[l]*U+this.B_re[l]*W;return s.x=ie*this.a+this.x0,s.y=K*this.a+this.y0,s}function q(s){var l,c=s.x,y=s.y,g=c-this.x0,v=y-this.y0,S=v/this.a,b=g/this.a,A=1,O=0,D,L,U=0,W=0;for(l=1;l<=6;l++)D=A*S-O*b,L=O*S+A*b,A=D,O=L,U=U+this.C_re[l]*A-this.C_im[l]*O,W=W+this.C_im[l]*A+this.C_re[l]*O;for(var F=0;F<this.iterations;F++){var G=U,K=W,ie,he,ge=S,Fe=b;for(l=2;l<=6;l++)ie=G*U-K*W,he=K*U+G*W,G=ie,K=he,ge=ge+(l-1)*(this.B_re[l]*G-this.B_im[l]*K),Fe=Fe+(l-1)*(this.B_im[l]*G+this.B_re[l]*K);G=1,K=0;var ke=this.B_re[1],De=this.B_im[1];for(l=2;l<=6;l++)ie=G*U-K*W,he=K*U+G*W,G=ie,K=he,ke=ke+l*(this.B_re[l]*G-this.B_im[l]*K),De=De+l*(this.B_im[l]*G+this.B_re[l]*K);var St=ke*ke+De*De;U=(ge*ke+Fe*De)/St,W=(Fe*ke-ge*De)/St}var tt=U,Xr=W,Kn=1,Jn=0;for(l=1;l<=9;l++)Kn=Kn*tt,Jn=Jn+this.D[l]*Kn;var jl=this.lat0+Jn*m*1e5,jg=this.long0+Xr;return s.x=jg,s.y=jl,s}var te=["New_Zealand_Map_Grid","nzmg"],ce={init:N,forward:j,inverse:q,names:te};function we(){}function Ie(s){var l=s.x,c=s.y,y=Z(l-this.long0),g=this.x0+this.a*y,v=this.y0+this.a*Math.log(Math.tan(Math.PI/4+c/2.5))*1.25;return s.x=g,s.y=v,s}function Pe(s){s.x-=this.x0,s.y-=this.y0;var l=Z(this.long0+s.x/this.a),c=2.5*(Math.atan(Math.exp(.8*s.y/this.a))-Math.PI/4);return s.x=l,s.y=c,s}var et=["Miller_Cylindrical","mill"],tr={init:we,forward:Ie,inverse:Pe,names:et},tn=20;function Yr(){this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=hl(this.es)}function kr(s){var l,c,y=s.x,g=s.y;if(y=Z(y-this.long0),this.sphere){if(!this.m)g=this.n!==1?Math.asin(this.n*Math.sin(g)):g;else for(var v=this.n*Math.sin(g),S=tn;S;--S){var b=(this.m*g+Math.sin(g)-v)/(this.m+Math.cos(g));if(g-=b,Math.abs(b)<w)break}l=this.a*this.C_x*y*(this.m+Math.cos(g)),c=this.a*this.C_y*g}else{var A=Math.sin(g),O=Math.cos(g);c=this.a*vi(g,A,O,this.en),l=this.a*y*O/Math.sqrt(1-this.es*A*A)}return s.x=l,s.y=c,s}function yt(s){var l,c,y,g;return s.x-=this.x0,y=s.x/this.a,s.y-=this.y0,l=s.y/this.a,this.sphere?(l/=this.C_y,y=y/(this.C_x*(this.m+Math.cos(l))),this.m?l=Zr((this.m*l+Math.sin(l))/this.n):this.n!==1&&(l=Zr(Math.sin(l)/this.n)),y=Z(y+this.long0),l=en(l)):(l=Ki(s.y/this.a,this.es,this.en),g=Math.abs(l),g<p?(g=Math.sin(l),c=this.long0+s.x*Math.sqrt(1-this.es*g*g)/(this.a*Math.cos(l)),y=Z(c)):g-w<p&&(y=this.long0)),s.x=y,s.y=l,s}var _t=["Sinusoidal","sinu"],$t={init:Yr,forward:kr,inverse:yt,names:_t};function Lr(){}function ne(s){for(var l=s.x,c=s.y,y=Z(l-this.long0),g=c,v=Math.PI*Math.sin(c);;){var S=-(g+Math.sin(g)-v)/(1+Math.cos(g));if(g+=S,Math.abs(S)<w)break}g/=2,Math.PI/2-Math.abs(c)<w&&(y=0);var b=.900316316158*this.a*y*Math.cos(g)+this.x0,A=1.4142135623731*this.a*Math.sin(g)+this.y0;return s.x=b,s.y=A,s}function pe(s){var l,c;s.x-=this.x0,s.y-=this.y0,c=s.y/(1.4142135623731*this.a),Math.abs(c)>.999999999999&&(c=.999999999999),l=Math.asin(c);var y=Z(this.long0+s.x/(.900316316158*this.a*Math.cos(l)));y<-Math.PI&&(y=-Math.PI),y>Math.PI&&(y=Math.PI),c=(2*l+Math.sin(2*l))/Math.PI,Math.abs(c)>1&&(c=1);var g=Math.asin(c);return s.x=y,s.y=g,s}var je=["Mollweide","moll"],Pt={init:Lr,forward:ne,inverse:pe,names:je};function rn(){Math.abs(this.lat1+this.lat2)<w||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=$n(this.es),this.e1=qn(this.es),this.e2=Fn(this.es),this.e3=Wn(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=Tt(this.e,this.sinphi,this.cosphi),this.ml1=gt(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<w?this.ns=this.sinphi:(this.sinphi=Math.sin(this.lat2),this.cosphi=Math.cos(this.lat2),this.ms2=Tt(this.e,this.sinphi,this.cosphi),this.ml2=gt(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=gt(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function nn(s){var l=s.x,c=s.y,y;if(this.sphere)y=this.a*(this.g-c);else{var g=gt(this.e0,this.e1,this.e2,this.e3,c);y=this.a*(this.g-g)}var v=this.ns*Z(l-this.long0),S=this.x0+y*Math.sin(v),b=this.y0+this.rh-y*Math.cos(v);return s.x=S,s.y=b,s}function sn(s){s.x-=this.x0,s.y=this.rh-s.y+this.y0;var l,c,y,g;this.ns>=0?(c=Math.sqrt(s.x*s.x+s.y*s.y),l=1):(c=-Math.sqrt(s.x*s.x+s.y*s.y),l=-1);var v=0;if(c!==0&&(v=Math.atan2(l*s.x,l*s.y)),this.sphere)return g=Z(this.long0+v/this.ns),y=en(this.g-c/this.a),s.x=g,s.y=y,s;var S=this.g-c/this.a;return y=to(S,this.e0,this.e1,this.e2,this.e3),g=Z(this.long0+v/this.ns),s.x=g,s.y=y,s}var uo=["Equidistant_Conic","eqdc"],Dl={init:rn,forward:nn,inverse:sn,names:uo};function $a(){this.R=this.a}function Y4(s){var l=s.x,c=s.y,y=Z(l-this.long0),g,v;Math.abs(c)<=w&&(g=this.x0+this.R*y,v=this.y0);var S=Zr(2*Math.abs(c/Math.PI));(Math.abs(y)<=w||Math.abs(Math.abs(c)-p)<=w)&&(g=this.x0,c>=0?v=this.y0+Math.PI*this.R*Math.tan(.5*S):v=this.y0+Math.PI*this.R*-Math.tan(.5*S));var b=.5*Math.abs(Math.PI/y-y/Math.PI),A=b*b,O=Math.sin(S),D=Math.cos(S),L=D/(O+D-1),U=L*L,W=L*(2/O-1),F=W*W,G=Math.PI*this.R*(b*(L-F)+Math.sqrt(A*(L-F)*(L-F)-(F+A)*(U-F)))/(F+A);y<0&&(G=-G),g=this.x0+G;var K=A+L;return G=Math.PI*this.R*(W*K-b*Math.sqrt((F+A)*(A+1)-K*K))/(F+A),c>=0?v=this.y0+G:v=this.y0-G,s.x=g,s.y=v,s}function X4(s){var l,c,y,g,v,S,b,A,O,D,L,U,W;return s.x-=this.x0,s.y-=this.y0,L=Math.PI*this.R,y=s.x/L,g=s.y/L,v=y*y+g*g,S=-Math.abs(g)*(1+v),b=S-2*g*g+y*y,A=-2*S+1+2*g*g+v*v,W=g*g/A+(2*b*b*b/A/A/A-9*S*b/A/A)/27,O=(S-b*b/3/A)/A,D=2*Math.sqrt(-O/3),L=3*W/O/D,Math.abs(L)>1&&(L>=0?L=1:L=-1),U=Math.acos(L)/3,s.y>=0?c=(-D*Math.cos(U+Math.PI/3)-b/3/A)*Math.PI:c=-(-D*Math.cos(U+Math.PI/3)-b/3/A)*Math.PI,Math.abs(y)<w?l=this.long0:l=Z(this.long0+Math.PI*(v-1+Math.sqrt(1+2*(y*y-g*g)+v*v))/2/y),s.x=l,s.y=c,s}var Q4=["Van_der_Grinten_I","VanDerGrinten","vandg"],eg={init:$a,forward:Y4,inverse:X4,names:Q4};function tg(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)}function rg(s){var l=s.x,c=s.y,y=Math.sin(s.y),g=Math.cos(s.y),v=Z(l-this.long0),S,b,A,O,D,L,U,W,F,G,K,ie,he,ge,Fe,ke,De,St,tt,Xr,Kn,Jn,jl;return this.sphere?Math.abs(this.sin_p12-1)<=w?(s.x=this.x0+this.a*(p-c)*Math.sin(v),s.y=this.y0-this.a*(p-c)*Math.cos(v),s):Math.abs(this.sin_p12+1)<=w?(s.x=this.x0+this.a*(p+c)*Math.sin(v),s.y=this.y0+this.a*(p+c)*Math.cos(v),s):(St=this.sin_p12*y+this.cos_p12*g*Math.cos(v),ke=Math.acos(St),De=ke?ke/Math.sin(ke):1,s.x=this.x0+this.a*De*g*Math.sin(v),s.y=this.y0+this.a*De*(this.cos_p12*y-this.sin_p12*g*Math.cos(v)),s):(S=$n(this.es),b=qn(this.es),A=Fn(this.es),O=Wn(this.es),Math.abs(this.sin_p12-1)<=w?(D=this.a*gt(S,b,A,O,p),L=this.a*gt(S,b,A,O,c),s.x=this.x0+(D-L)*Math.sin(v),s.y=this.y0-(D-L)*Math.cos(v),s):Math.abs(this.sin_p12+1)<=w?(D=this.a*gt(S,b,A,O,p),L=this.a*gt(S,b,A,O,c),s.x=this.x0+(D+L)*Math.sin(v),s.y=this.y0+(D+L)*Math.cos(v),s):(U=y/g,W=Qi(this.a,this.e,this.sin_p12),F=Qi(this.a,this.e,y),G=Math.atan((1-this.es)*U+this.es*W*this.sin_p12/(F*g)),K=Math.atan2(Math.sin(v),this.cos_p12*Math.tan(G)-this.sin_p12*Math.cos(v)),K===0?tt=Math.asin(this.cos_p12*Math.sin(G)-this.sin_p12*Math.cos(G)):Math.abs(Math.abs(K)-Math.PI)<=w?tt=-Math.asin(this.cos_p12*Math.sin(G)-this.sin_p12*Math.cos(G)):tt=Math.asin(Math.sin(v)*Math.cos(G)/Math.sin(K)),ie=this.e*this.sin_p12/Math.sqrt(1-this.es),he=this.e*this.cos_p12*Math.cos(K)/Math.sqrt(1-this.es),ge=ie*he,Fe=he*he,Xr=tt*tt,Kn=Xr*tt,Jn=Kn*tt,jl=Jn*tt,ke=W*tt*(1-Xr*Fe*(1-Fe)/6+Kn/8*ge*(1-2*Fe)+Jn/120*(Fe*(4-7*Fe)-3*ie*ie*(1-7*Fe))-jl/48*ge),s.x=this.x0+ke*Math.sin(K),s.y=this.y0+ke*Math.cos(K),s))}function ig(s){s.x-=this.x0,s.y-=this.y0;var l,c,y,g,v,S,b,A,O,D,L,U,W,F,G,K,ie,he,ge,Fe,ke,De,St,tt;return this.sphere?(l=Math.sqrt(s.x*s.x+s.y*s.y),l>2*p*this.a?void 0:(c=l/this.a,y=Math.sin(c),g=Math.cos(c),v=this.long0,Math.abs(l)<=w?S=this.lat0:(S=Zr(g*this.sin_p12+s.y*y*this.cos_p12/l),b=Math.abs(this.lat0)-p,Math.abs(b)<=w?this.lat0>=0?v=Z(this.long0+Math.atan2(s.x,-s.y)):v=Z(this.long0-Math.atan2(-s.x,s.y)):v=Z(this.long0+Math.atan2(s.x*y,l*this.cos_p12*g-s.y*this.sin_p12*y))),s.x=v,s.y=S,s)):(A=$n(this.es),O=qn(this.es),D=Fn(this.es),L=Wn(this.es),Math.abs(this.sin_p12-1)<=w?(U=this.a*gt(A,O,D,L,p),l=Math.sqrt(s.x*s.x+s.y*s.y),W=U-l,S=to(W/this.a,A,O,D,L),v=Z(this.long0+Math.atan2(s.x,-1*s.y)),s.x=v,s.y=S,s):Math.abs(this.sin_p12+1)<=w?(U=this.a*gt(A,O,D,L,p),l=Math.sqrt(s.x*s.x+s.y*s.y),W=l-U,S=to(W/this.a,A,O,D,L),v=Z(this.long0+Math.atan2(s.x,s.y)),s.x=v,s.y=S,s):(l=Math.sqrt(s.x*s.x+s.y*s.y),K=Math.atan2(s.x,s.y),F=Qi(this.a,this.e,this.sin_p12),ie=Math.cos(K),he=this.e*this.cos_p12*ie,ge=-he*he/(1-this.es),Fe=3*this.es*(1-ge)*this.sin_p12*this.cos_p12*ie/(1-this.es),ke=l/F,De=ke-ge*(1+ge)*Math.pow(ke,3)/6-Fe*(1+3*ge)*Math.pow(ke,4)/24,St=1-ge*De*De/2-ke*De*De*De/6,G=Math.asin(this.sin_p12*Math.cos(De)+this.cos_p12*Math.sin(De)*ie),v=Z(this.long0+Math.asin(Math.sin(K)*Math.sin(De)/Math.cos(G))),tt=Math.sin(G),S=Math.atan2((tt-this.es*St*this.sin_p12)*Math.tan(G),tt*(1-this.es)),s.x=v,s.y=S,s))}var ng=["Azimuthal_Equidistant","aeqd"],sg={init:tg,forward:rg,inverse:ig,names:ng};function og(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function ag(s){var l,c,y,g,v,S,b,A,O=s.x,D=s.y;return y=Z(O-this.long0),l=Math.sin(D),c=Math.cos(D),g=Math.cos(y),S=this.sin_p14*l+this.cos_p14*c*g,v=1,(S>0||Math.abs(S)<=w)&&(b=this.a*v*c*Math.sin(y),A=this.y0+this.a*v*(this.cos_p14*l-this.sin_p14*c*g)),s.x=b,s.y=A,s}function lg(s){var l,c,y,g,v,S,b;return s.x-=this.x0,s.y-=this.y0,l=Math.sqrt(s.x*s.x+s.y*s.y),c=Zr(l/this.a),y=Math.sin(c),g=Math.cos(c),S=this.long0,Math.abs(l)<=w?(b=this.lat0,s.x=S,s.y=b,s):(b=Zr(g*this.sin_p14+s.y*y*this.cos_p14/l),v=Math.abs(this.lat0)-p,Math.abs(v)<=w?(this.lat0>=0?S=Z(this.long0+Math.atan2(s.x,-s.y)):S=Z(this.long0-Math.atan2(-s.x,s.y)),s.x=S,s.y=b,s):(S=Z(this.long0+Math.atan2(s.x*y,l*this.cos_p14*g-s.y*this.sin_p14*y)),s.x=S,s.y=b,s))}var ug=["ortho"],hg={init:og,forward:ag,inverse:lg,names:ug},Xe={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},Be={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function cg(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=p-C/2?this.face=Xe.TOP:this.lat0<=-(p-C/2)?this.face=Xe.BOTTOM:Math.abs(this.long0)<=C?this.face=Xe.FRONT:Math.abs(this.long0)<=p+C?this.face=this.long0>0?Xe.RIGHT:Xe.LEFT:this.face=Xe.BACK,this.es!==0&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function fg(s){var l={x:0,y:0},c,y,g,v,S,b,A={value:0};if(s.x-=this.long0,this.es!==0?c=Math.atan(this.one_minus_f_squared*Math.tan(s.y)):c=s.y,y=s.x,this.face===Xe.TOP)v=p-c,y>=C&&y<=p+C?(A.value=Be.AREA_0,g=y-p):y>p+C||y<=-(p+C)?(A.value=Be.AREA_1,g=y>0?y-k:y+k):y>-(p+C)&&y<=-C?(A.value=Be.AREA_2,g=y+p):(A.value=Be.AREA_3,g=y);else if(this.face===Xe.BOTTOM)v=p+c,y>=C&&y<=p+C?(A.value=Be.AREA_0,g=-y+p):y<C&&y>=-C?(A.value=Be.AREA_1,g=-y):y<-C&&y>=-(p+C)?(A.value=Be.AREA_2,g=-y-p):(A.value=Be.AREA_3,g=y>0?-y+k:-y-k);else{var O,D,L,U,W,F,G;this.face===Xe.RIGHT?y=ho(y,+p):this.face===Xe.BACK?y=ho(y,+k):this.face===Xe.LEFT&&(y=ho(y,-p)),U=Math.sin(c),W=Math.cos(c),F=Math.sin(y),G=Math.cos(y),O=W*G,D=W*F,L=U,this.face===Xe.FRONT?(v=Math.acos(O),g=zl(v,L,D,A)):this.face===Xe.RIGHT?(v=Math.acos(D),g=zl(v,L,-O,A)):this.face===Xe.BACK?(v=Math.acos(-O),g=zl(v,L,-D,A)):this.face===Xe.LEFT?(v=Math.acos(-D),g=zl(v,L,O,A)):(v=g=0,A.value=Be.AREA_0)}return b=Math.atan(12/k*(g+Math.acos(Math.sin(g)*Math.cos(C))-p)),S=Math.sqrt((1-Math.cos(v))/(Math.cos(b)*Math.cos(b))/(1-Math.cos(Math.atan(1/Math.cos(g))))),A.value===Be.AREA_1?b+=p:A.value===Be.AREA_2?b+=k:A.value===Be.AREA_3&&(b+=1.5*k),l.x=S*Math.cos(b),l.y=S*Math.sin(b),l.x=l.x*this.a+this.x0,l.y=l.y*this.a+this.y0,s.x=l.x,s.y=l.y,s}function dg(s){var l={lam:0,phi:0},c,y,g,v,S,b,A,O,D,L={value:0};if(s.x=(s.x-this.x0)/this.a,s.y=(s.y-this.y0)/this.a,y=Math.atan(Math.sqrt(s.x*s.x+s.y*s.y)),c=Math.atan2(s.y,s.x),s.x>=0&&s.x>=Math.abs(s.y)?L.value=Be.AREA_0:s.y>=0&&s.y>=Math.abs(s.x)?(L.value=Be.AREA_1,c-=p):s.x<0&&-s.x>=Math.abs(s.y)?(L.value=Be.AREA_2,c=c<0?c+k:c-k):(L.value=Be.AREA_3,c+=p),D=k/12*Math.tan(c),S=Math.sin(D)/(Math.cos(D)-1/Math.sqrt(2)),b=Math.atan(S),g=Math.cos(c),v=Math.tan(y),A=1-g*g*v*v*(1-Math.cos(Math.atan(1/Math.cos(b)))),A<-1?A=-1:A>1&&(A=1),this.face===Xe.TOP)O=Math.acos(A),l.phi=p-O,L.value===Be.AREA_0?l.lam=b+p:L.value===Be.AREA_1?l.lam=b<0?b+k:b-k:L.value===Be.AREA_2?l.lam=b-p:l.lam=b;else if(this.face===Xe.BOTTOM)O=Math.acos(A),l.phi=O-p,L.value===Be.AREA_0?l.lam=-b+p:L.value===Be.AREA_1?l.lam=-b:L.value===Be.AREA_2?l.lam=-b-p:l.lam=b<0?-b-k:-b+k;else{var U,W,F;U=A,D=U*U,D>=1?F=0:F=Math.sqrt(1-D)*Math.sin(b),D+=F*F,D>=1?W=0:W=Math.sqrt(1-D),L.value===Be.AREA_1?(D=W,W=-F,F=D):L.value===Be.AREA_2?(W=-W,F=-F):L.value===Be.AREA_3&&(D=W,W=F,F=-D),this.face===Xe.RIGHT?(D=U,U=-W,W=D):this.face===Xe.BACK?(U=-U,W=-W):this.face===Xe.LEFT&&(D=U,U=W,W=-D),l.phi=Math.acos(-F)-p,l.lam=Math.atan2(W,U),this.face===Xe.RIGHT?l.lam=ho(l.lam,-p):this.face===Xe.BACK?l.lam=ho(l.lam,-k):this.face===Xe.LEFT&&(l.lam=ho(l.lam,+p))}if(this.es!==0){var G,K,ie;G=l.phi<0?1:0,K=Math.tan(l.phi),ie=this.b/Math.sqrt(K*K+this.one_minus_f_squared),l.phi=Math.atan(Math.sqrt(this.a*this.a-ie*ie)/(this.one_minus_f*ie)),G&&(l.phi=-l.phi)}return l.lam+=this.long0,s.x=l.lam,s.y=l.phi,s}function zl(s,l,c,y){var g;return s<w?(y.value=Be.AREA_0,g=0):(g=Math.atan2(l,c),Math.abs(g)<=C?y.value=Be.AREA_0:g>C&&g<=p+C?(y.value=Be.AREA_1,g-=p):g>p+C||g<=-(p+C)?(y.value=Be.AREA_2,g=g>=0?g-k:g+k):(y.value=Be.AREA_3,g+=p)),g}function ho(s,l){var c=s+l;return c<-k?c+=I:c>+k&&(c-=I),c}var mg=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],pg={init:cg,forward:fg,inverse:dg,names:mg},Wc=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-986701e-12],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,18736e-12],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,934959e-12],[.7986,-.00755338,-500009e-10,935324e-12],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],qa=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-126793e-14,422642e-15],[.124,.0124,507171e-14,-160604e-14],[.186,.0123999,-190189e-13,600152e-14],[.248,.0124002,710039e-13,-224e-10],[.31,.0123992,-264997e-12,835986e-13],[.372,.0124029,988983e-12,-311994e-12],[.434,.0123893,-369093e-11,-435621e-12],[.4958,.0123198,-102252e-10,-345523e-12],[.5571,.0121916,-154081e-10,-582288e-12],[.6176,.0119938,-241424e-10,-525327e-12],[.6769,.011713,-320223e-10,-516405e-12],[.7346,.0113541,-397684e-10,-609052e-12],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-140374e-14],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],Vd=.8487,Kd=1.3523,Jd=T/5,gg=1/Jd,co=18,Ul=function(s,l){return s[0]+l*(s[1]+l*(s[2]+l*s[3]))},yg=function(s,l){return s[1]+l*(2*s[2]+l*3*s[3])};function bg(s,l,c,y){for(var g=l;y;--y){var v=s(g);if(g-=v,Math.abs(v)<c)break}return g}function vg(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function wg(s){var l=Z(s.x-this.long0),c=Math.abs(s.y),y=Math.floor(c*Jd);y<0?y=0:y>=co&&(y=co-1),c=T*(c-gg*y);var g={x:Ul(Wc[y],c)*l,y:Ul(qa[y],c)};return s.y<0&&(g.y=-g.y),g.x=g.x*this.a*Vd+this.x0,g.y=g.y*this.a*Kd+this.y0,g}function _g(s){var l={x:(s.x-this.x0)/(this.a*Vd),y:Math.abs(s.y-this.y0)/(this.a*Kd)};if(l.y>=1)l.x/=Wc[co][0],l.y=s.y<0?-p:p;else{var c=Math.floor(l.y*co);for(c<0?c=0:c>=co&&(c=co-1);;)if(qa[c][0]>l.y)--c;else if(qa[c+1][0]<=l.y)++c;else break;var y=qa[c],g=5*(l.y-y[0])/(qa[c+1][0]-y[0]);g=bg(function(v){return(Ul(y,v)-l.y)/yg(y,v)},g,w,100),l.x/=Ul(Wc[c],g),l.y=(5*c+g)*E,s.y<0&&(l.y=-l.y)}return l.x=Z(l.x+this.long0),l}var xg=["Robinson","robin"],Sg={init:vg,forward:wg,inverse:_g,names:xg};function Mg(){this.name="geocent"}function Eg(s){var l=Ma(s,this.es,this.a);return l}function Rg(s){var l=kn(s,this.es,this.a,this.b);return l}var Cg=["Geocentric","geocentric","geocent","Geocent"],Ag={init:Mg,forward:Eg,inverse:Rg,names:Cg},xt={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},Fa={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};function Tg(){if(Object.keys(Fa).forEach(function(c){if(typeof this[c]>"u")this[c]=Fa[c].def;else{if(Fa[c].num&&isNaN(this[c]))throw new Error("Invalid parameter value, must be numeric "+c+" = "+this[c]);Fa[c].num&&(this[c]=parseFloat(this[c]))}Fa[c].degrees&&(this[c]=this[c]*E)}.bind(this)),Math.abs(Math.abs(this.lat0)-p)<w?this.mode=this.lat0<0?xt.S_POLE:xt.N_POLE:Math.abs(this.lat0)<w?this.mode=xt.EQUIT:(this.mode=xt.OBLIQ,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw new Error("Invalid height");this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var s=this.tilt,l=this.azi;this.cg=Math.cos(l),this.sg=Math.sin(l),this.cw=Math.cos(s),this.sw=Math.sin(s)}function Ig(s){s.x-=this.long0;var l=Math.sin(s.y),c=Math.cos(s.y),y=Math.cos(s.x),g,v;switch(this.mode){case xt.OBLIQ:v=this.sinph0*l+this.cosph0*c*y;break;case xt.EQUIT:v=c*y;break;case xt.S_POLE:v=-l;break;case xt.N_POLE:v=l;break}switch(v=this.pn1/(this.p-v),g=v*c*Math.sin(s.x),this.mode){case xt.OBLIQ:v*=this.cosph0*l-this.sinph0*c*y;break;case xt.EQUIT:v*=l;break;case xt.N_POLE:v*=-(c*y);break;case xt.S_POLE:v*=c*y;break}var S,b;return S=v*this.cg+g*this.sg,b=1/(S*this.sw*this.h1+this.cw),g=(g*this.cg-v*this.sg)*this.cw*b,v=S*b,s.x=g*this.a,s.y=v*this.a,s}function Pg(s){s.x/=this.a,s.y/=this.a;var l={x:s.x,y:s.y},c,y,g;g=1/(this.pn1-s.y*this.sw),c=this.pn1*s.x*g,y=this.pn1*s.y*this.cw*g,s.x=c*this.cg+y*this.sg,s.y=y*this.cg-c*this.sg;var v=Qt(s.x,s.y);if(Math.abs(v)<w)l.x=0,l.y=s.y;else{var S,b;switch(b=1-v*v*this.pfact,b=(this.p-Math.sqrt(b))/(this.pn1/v+v/this.pn1),S=Math.sqrt(1-b*b),this.mode){case xt.OBLIQ:l.y=Math.asin(S*this.sinph0+s.y*b*this.cosph0/v),s.y=(S-this.sinph0*Math.sin(l.y))*v,s.x*=b*this.cosph0;break;case xt.EQUIT:l.y=Math.asin(s.y*b/v),s.y=S*v,s.x*=b;break;case xt.N_POLE:l.y=Math.asin(S),s.y=-s.y;break;case xt.S_POLE:l.y=-Math.asin(S);break}l.x=Math.atan2(s.x,s.y)}return s.x=l.x+this.long0,s.y=l.y,s}var Og=["Tilted_Perspective","tpers"],kg={init:Tg,forward:Ig,inverse:Pg,names:Og};function Lg(){if(this.flip_axis=this.sweep==="x"?1:0,this.h=Number(this.h),this.radius_g_1=this.h/this.a,this.radius_g_1<=0||this.radius_g_1>1e10)throw new Error;if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,this.es!==0){var s=1-this.es,l=1/s;this.radius_p=Math.sqrt(s),this.radius_p2=s,this.radius_p_inv2=l,this.shape="ellipse"}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape="sphere";this.title||(this.title="Geostationary Satellite View")}function Ng(s){var l=s.x,c=s.y,y,g,v,S;if(l=l-this.long0,this.shape==="ellipse"){c=Math.atan(this.radius_p2*Math.tan(c));var b=this.radius_p/Qt(this.radius_p*Math.cos(c),Math.sin(c));if(g=b*Math.cos(l)*Math.cos(c),v=b*Math.sin(l)*Math.cos(c),S=b*Math.sin(c),(this.radius_g-g)*g-v*v-S*S*this.radius_p_inv2<0)return s.x=Number.NaN,s.y=Number.NaN,s;y=this.radius_g-g,this.flip_axis?(s.x=this.radius_g_1*Math.atan(v/Qt(S,y)),s.y=this.radius_g_1*Math.atan(S/y)):(s.x=this.radius_g_1*Math.atan(v/y),s.y=this.radius_g_1*Math.atan(S/Qt(v,y)))}else this.shape==="sphere"&&(y=Math.cos(c),g=Math.cos(l)*y,v=Math.sin(l)*y,S=Math.sin(c),y=this.radius_g-g,this.flip_axis?(s.x=this.radius_g_1*Math.atan(v/Qt(S,y)),s.y=this.radius_g_1*Math.atan(S/y)):(s.x=this.radius_g_1*Math.atan(v/y),s.y=this.radius_g_1*Math.atan(S/Qt(v,y))));return s.x=s.x*this.a,s.y=s.y*this.a,s}function Bg(s){var l=-1,c=0,y=0,g,v,S,b;if(s.x=s.x/this.a,s.y=s.y/this.a,this.shape==="ellipse"){this.flip_axis?(y=Math.tan(s.y/this.radius_g_1),c=Math.tan(s.x/this.radius_g_1)*Qt(1,y)):(c=Math.tan(s.x/this.radius_g_1),y=Math.tan(s.y/this.radius_g_1)*Qt(1,c));var A=y/this.radius_p;if(g=c*c+A*A+l*l,v=2*this.radius_g*l,S=v*v-4*g*this.C,S<0)return s.x=Number.NaN,s.y=Number.NaN,s;b=(-v-Math.sqrt(S))/(2*g),l=this.radius_g+b*l,c*=b,y*=b,s.x=Math.atan2(c,l),s.y=Math.atan(y*Math.cos(s.x)/l),s.y=Math.atan(this.radius_p_inv2*Math.tan(s.y))}else if(this.shape==="sphere"){if(this.flip_axis?(y=Math.tan(s.y/this.radius_g_1),c=Math.tan(s.x/this.radius_g_1)*Math.sqrt(1+y*y)):(c=Math.tan(s.x/this.radius_g_1),y=Math.tan(s.y/this.radius_g_1)*Math.sqrt(1+c*c)),g=c*c+y*y+l*l,v=2*this.radius_g*l,S=v*v-4*g*this.C,S<0)return s.x=Number.NaN,s.y=Number.NaN,s;b=(-v-Math.sqrt(S))/(2*g),l=this.radius_g+b*l,c*=b,y*=b,s.x=Math.atan2(c,l),s.y=Math.atan(y*Math.cos(s.x)/l)}return s.x=s.x+this.long0,s}var Dg=["Geostationary Satellite View","Geostationary_Satellite","geos"],zg={init:Lg,forward:Ng,inverse:Bg,names:Dg},Ug=function(s){s.Proj.projections.add(Hs),s.Proj.projections.add(Bn),s.Proj.projections.add(yc),s.Proj.projections.add(gl),s.Proj.projections.add(_c),s.Proj.projections.add(Mc),s.Proj.projections.add(jn),s.Proj.projections.add(Xi),s.Proj.projections.add(Ac),s.Proj.projections.add(Vr),s.Proj.projections.add(Pl),s.Proj.projections.add(Ol),s.Proj.projections.add(lo),s.Proj.projections.add(Nl),s.Proj.projections.add(Fc),s.Proj.projections.add(P),s.Proj.projections.add(ce),s.Proj.projections.add(tr),s.Proj.projections.add($t),s.Proj.projections.add(Pt),s.Proj.projections.add(Dl),s.Proj.projections.add(eg),s.Proj.projections.add(sg),s.Proj.projections.add(hg),s.Proj.projections.add(pg),s.Proj.projections.add(Sg),s.Proj.projections.add(Ag),s.Proj.projections.add(kg),s.Proj.projections.add(zg)};return It.defaultDatum="WGS84",It.Proj=cr,It.WGS84=new It.Proj("WGS84"),It.Point=Or,It.toPoint=Nn,It.defs=ft,It.nadgrid=yi,It.transform=qi,It.mgrs=js,It.version="2.8.0",Ug(It),It})});var R1=V((QI,p6)=>{p6.exports={ROOT:0,GROUP:1,POSITION:2,SET:3,RANGE:4,REPETITION:5,REFERENCE:6,CHAR:7}});var td=V(En=>{var ze=R1(),ed=()=>[{type:ze.RANGE,from:48,to:57}],g6=()=>[{type:ze.CHAR,value:95},{type:ze.RANGE,from:97,to:122},{type:ze.RANGE,from:65,to:90}].concat(ed()),y6=()=>[{type:ze.CHAR,value:9},{type:ze.CHAR,value:10},{type:ze.CHAR,value:11},{type:ze.CHAR,value:12},{type:ze.CHAR,value:13},{type:ze.CHAR,value:32},{type:ze.CHAR,value:160},{type:ze.CHAR,value:5760},{type:ze.RANGE,from:8192,to:8202},{type:ze.CHAR,value:8232},{type:ze.CHAR,value:8233},{type:ze.CHAR,value:8239},{type:ze.CHAR,value:8287},{type:ze.CHAR,value:12288},{type:ze.CHAR,value:65279}],Lx=()=>[{type:ze.CHAR,value:10},{type:ze.CHAR,value:13},{type:ze.CHAR,value:8232},{type:ze.CHAR,value:8233}];En.words=()=>({type:ze.SET,set:g6(),not:!1});En.notWords=()=>({type:ze.SET,set:g6(),not:!0});En.ints=()=>({type:ze.SET,set:ed(),not:!1});En.notInts=()=>({type:ze.SET,set:ed(),not:!0});En.whitespace=()=>({type:ze.SET,set:y6(),not:!1});En.notWhitespace=()=>({type:ze.SET,set:y6(),not:!0});En.anyChar=()=>({type:ze.SET,set:Lx(),not:!0})});var v6=V(C1=>{var b6=R1(),ta=td(),Nx="@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?",Bx={"0":0,t:9,n:10,v:11,f:12,r:13};C1.strToChars=function(t){var e=/(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|(0?[0-7]{2})|c([@A-Z[\\\]^?])|([0tnvfr]))/g;return t=t.replace(e,function(r,i,n,o,a,h,d,m){if(n)return r;var p=i?8:o?parseInt(o,16):a?parseInt(a,16):h?parseInt(h,8):d?Nx.indexOf(d):Bx[m],M=String.fromCharCode(p);return/[[\]{}^$.|?*+()]/.test(M)&&(M="\\"+M),M}),t};C1.tokenizeClass=(t,e)=>{for(var r=[],i=/\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(?:\\)?([^\]]))|(\])|(?:\\)?([^])/g,n,o;(n=i.exec(t))!=null;)if(n[1])r.push(ta.words());else if(n[2])r.push(ta.ints());else if(n[3])r.push(ta.whitespace());else if(n[4])r.push(ta.notWords());else if(n[5])r.push(ta.notInts());else if(n[6])r.push(ta.notWhitespace());else if(n[7])r.push({type:b6.RANGE,from:(n[8]||n[9]).charCodeAt(0),to:n[10].charCodeAt(0)});else if(o=n[12])r.push({type:b6.CHAR,value:o.charCodeAt(0)});else return[r,i.lastIndex];C1.error(e,"Unterminated character class")};C1.error=(t,e)=>{throw new SyntaxError("Invalid regular expression: /"+t+"/: "+e)}});var w6=V(A1=>{var Qu=R1();A1.wordBoundary=()=>({type:Qu.POSITION,value:"b"});A1.nonWordBoundary=()=>({type:Qu.POSITION,value:"B"});A1.begin=()=>({type:Qu.POSITION,value:"^"});A1.end=()=>({type:Qu.POSITION,value:"$"})});var _6=V((iP,rd)=>{var ra=v6(),Rr=R1(),xs=td(),eh=w6();rd.exports=t=>{var e=0,r,i,n={type:Rr.ROOT,stack:[]},o=n,a=n.stack,h=[],d=C=>{ra.error(t,`Nothing to repeat at column ${C-1}`)},m=ra.strToChars(t);for(r=m.length;e<r;)switch(i=m[e++],i){case"\\":switch(i=m[e++],i){case"b":a.push(eh.wordBoundary());break;case"B":a.push(eh.nonWordBoundary());break;case"w":a.push(xs.words());break;case"W":a.push(xs.notWords());break;case"d":a.push(xs.ints());break;case"D":a.push(xs.notInts());break;case"s":a.push(xs.whitespace());break;case"S":a.push(xs.notWhitespace());break;default:/\d/.test(i)?a.push({type:Rr.REFERENCE,value:parseInt(i,10)}):a.push({type:Rr.CHAR,value:i.charCodeAt(0)})}break;case"^":a.push(eh.begin());break;case"$":a.push(eh.end());break;case"[":var p;m[e]==="^"?(p=!0,e++):p=!1;var M=ra.tokenizeClass(m.slice(e),t);e+=M[1],a.push({type:Rr.SET,set:M[0],not:p});break;case".":a.push(xs.anyChar());break;case"(":var R={type:Rr.GROUP,stack:[],remember:!0};i=m[e],i==="?"&&(i=m[e+1],e+=2,i==="="?R.followedBy=!0:i==="!"?R.notFollowedBy=!0:i!==":"&&ra.error(t,`Invalid group, character '${i}' after '?' at column ${e-1}`),R.remember=!1),a.push(R),h.push(o),o=R,a=R.stack;break;case")":h.length===0&&ra.error(t,`Unmatched ) at column ${e-1}`),o=h.pop(),a=o.options?o.options[o.options.length-1]:o.stack;break;case"|":o.options||(o.options=[o.stack],delete o.stack);var x=[];o.options.push(x),a=x;break;case"{":var w=/^(\d+)(,(\d+)?)?\}/.exec(m.slice(e)),E,T;w!==null?(a.length===0&&d(e),E=parseInt(w[1],10),T=w[2]?w[3]?parseInt(w[3],10):1/0:E,e+=w[0].length,a.push({type:Rr.REPETITION,min:E,max:T,value:a.pop()})):a.push({type:Rr.CHAR,value:123});break;case"?":a.length===0&&d(e),a.push({type:Rr.REPETITION,min:0,max:1,value:a.pop()});break;case"+":a.length===0&&d(e),a.push({type:Rr.REPETITION,min:1,max:1/0,value:a.pop()});break;case"*":a.length===0&&d(e),a.push({type:Rr.REPETITION,min:0,max:1/0,value:a.pop()});break;default:a.push({type:Rr.CHAR,value:i.charCodeAt(0)})}return h.length!==0&&ra.error(t,"Unterminated group"),n};rd.exports.types=Rr});var M6=V((nP,S6)=>{"use strict";var x6=_6(),Dx=x6.types;S6.exports=function(t,e){e||(e={});var r=e.limit===void 0?25:e.limit;zx(t)?t=t.source:typeof t!="string"&&(t=String(t));try{t=x6(t)}catch{return!1}var i=0;return function n(o,a){var h,d,m;if(o.type===Dx.REPETITION&&(a++,i++,a>1||i>r))return!1;if(o.options){for(h=0,m=o.options.length;h<m;h++)if(d=n({stack:o.options[h]},a),!d)return!1}var p=o.stack||o.value&&o.value.stack;if(!p)return!0;for(h=0;h<p.length;h++)if(d=n(p[h],a),!d)return!1;return!0}(t,0)};function zx(t){return{}.toString.call(t)==="[object RegExp]"}});var R6=V((sP,E6)=>{"use strict";E6.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var i,n,o;if(Array.isArray(e)){if(i=e.length,i!=r.length)return!1;for(n=i;n--!==0;)if(!t(e[n],r[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(o=Object.keys(e),i=o.length,i!==Object.keys(r).length)return!1;for(n=i;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[n]))return!1;for(n=i;n--!==0;){var a=o[n];if(!t(e[a],r[a]))return!1}return!0}return e!==e&&r!==r}});var N6=V((oP,L6)=>{"use strict";var ia=" ",na="\u2502 ",C6="\u251C\u2500\u2500 ",A6="\u2514\u2500\u2500 ",T6="*",T1="/",I6=/(?=\/)/;function Ux(t){let e=t.name||"";return e=e.replace("bound","").trim(),e=(e||"anonymous")+"()",e}function P6(t){return Array.isArray(t)?t.map(e=>P6(e)):typeof t=="symbol"?t.toString():typeof t=="function"?Ux(t):t}function id(t,e){let r={},i=this.buildPrettyMeta(t);return Array.isArray(e)||(e=i?Reflect.ownKeys(i):[]),e.forEach(n=>{let o=typeof n=="symbol"?n.toString():n;i&&i[n]&&(r[o]=P6(i[n]))}),r}function jx(t,e={}){if(!this.buildPrettyMeta)throw new Error("buildPrettyMeta not defined");e.includeMeta=e.includeMeta||null;let r=[],i="";t.sort((o,a)=>!o.path||!a.path?0:o.path.localeCompare(a.path));for(let o=0;o<t.length;o++){let a=t[o],h=r.find(m=>a.path===m.path);if(h){h.handlers.push({method:a.method,opts:a.opts.constraints||void 0,meta:e.includeMeta?id.call(this,a,e.includeMeta):null});continue}let d={method:a.method,opts:a.opts.constraints||void 0,meta:e.includeMeta?id.call(this,a,e.includeMeta):null};r.push({path:a.path,methods:[a.method],opts:[a.opts],handlers:[d]})}if(!r.filter(o=>o.path===T1).length){let o={path:T1,truncatedPath:"",methods:[],opts:[],handlers:[{}]};r.filter(a=>a.path===T6).length?r.splice(1,0,o):r.unshift(o)}let n=$x(r);return n.forEach((o,a)=>{i+=O6(o,null,a===n.length-1,!1,!0),i+=`
111
- `}),i}function $x(t,e){e=e||T1;let r=[],i={result:r};return t.forEach((n,o)=>{let a=n.path.split(I6);a[0]!==T1&&a[0]!==T6&&(a=[T1,a[0].slice(1),...a.slice(1)]),a.reduce((h,d,m)=>{if(!h[d]){h[d]={result:[]};let p={path:d,children:h[d].result};m===a.length-1&&(p.handlers=n.handlers),h.result.push(p)}return h[d]},i)}),r}function O6(t,e,r,i,n){let o="";if(!i&&!n&&(o+=`
112
- `),i||(o+=`${e||""}${r?A6:C6}`),o+=`${t.path}`,t.handlers){let a=t.handlers.reduce((h,d)=>{let m=h.findIndex(p=>JSON.stringify(p.opts)===JSON.stringify(d.opts));return m!==-1?h[m].method=[h[m].method,d.method].join(", "):h.push(d),h},[]);a.forEach((h,d)=>{d>0&&(o+=`${i?"":e||""}${r?ia:na}${t.path}`),o+=` (${h.method||"-"})`,h.opts&&JSON.stringify(h.opts)!=="{}"&&(o+=` ${JSON.stringify(h.opts)}`),h.meta&&Reflect.ownKeys(h.meta).forEach((m,p)=>{o+=`
110
+ northing meters`+s;var U=L/2,W=0,F=0,G,K,ie,he,ge;return U>0&&(G=1e5/Math.pow(10,U),K=s.substring(v,v+U),W=parseFloat(K)*G,ie=s.substring(v+U),F=parseFloat(ie)*G),he=W+O,ge=F+D,{easting:he,northing:ge,zoneLetter:b,zoneNumber:S,accuracy:G}}function ll(s,l){for(var c=zs.charCodeAt(l-1),y=1e5,g=!1;c!==s.charCodeAt(0);){if(c++,c===mt&&c++,c===pt&&c++,c>Hr){if(g)throw"Bad character: "+s;c=jt,g=!0}y+=1e5}return y}function Gi(s,l){if(s>"V")throw"MGRSPoint given invalid Northing "+s;for(var c=Wi.charCodeAt(l-1),y=0,g=!1;c!==s.charCodeAt(0);){if(c++,c===mt&&c++,c===pt&&c++,c>Pr){if(g)throw"Bad character: "+s;c=jt,g=!0}y+=1e5}return y}function Vi(s){var l;switch(s){case"C":l=11e5;break;case"D":l=2e6;break;case"E":l=28e5;break;case"F":l=37e5;break;case"G":l=46e5;break;case"H":l=55e5;break;case"J":l=64e5;break;case"K":l=73e5;break;case"L":l=82e5;break;case"M":l=91e5;break;case"N":l=0;break;case"P":l=8e5;break;case"Q":l=17e5;break;case"R":l=26e5;break;case"S":l=35e5;break;case"T":l=44e5;break;case"U":l=53e5;break;case"V":l=62e5;break;case"W":l=7e6;break;case"X":l=79e5;break;default:l=-1}if(l>=0)return l;throw"Invalid zone letter: "+s}function Or(s,l,c){if(!(this instanceof Or))return new Or(s,l,c);if(Array.isArray(s))this.x=s[0],this.y=s[1],this.z=s[2]||0;else if(typeof s=="object")this.x=s.x,this.y=s.y,this.z=s.z||0;else if(typeof s=="string"&&typeof l>"u"){var y=s.split(",");this.x=parseFloat(y[0],10),this.y=parseFloat(y[1],10),this.z=parseFloat(y[2],10)||0}else this.x=s,this.y=l,this.z=c||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}Or.fromMGRS=function(s){return new Or(nl(s))},Or.prototype.toMGRS=function(s){return il([this.x,this.y],s)};var ul=1,ic=.25,$s=.046875,qs=.01953125,Fs=.01068115234375,nc=.75,sc=.46875,oc=.013020833333333334,ac=.007120768229166667,fr=.3645833333333333,lc=.005696614583333333,uc=.3076171875,hl=function(s){var l=[];l[0]=ul-s*(ic+s*($s+s*(qs+s*Fs))),l[1]=s*(nc-s*($s+s*(qs+s*Fs)));var c=s*s;return l[2]=c*(sc-s*(oc+s*ac)),c*=s,l[3]=c*(fr-s*lc),l[4]=c*s*uc,l},vi=function(s,l,c,y){return c*=l,l*=l,y[0]*s-c*(y[1]+l*(y[2]+l*(y[3]+l*y[4])))},Ia=20,Ki=function(s,l,c){for(var y=1/(1-l),g=s,v=Ia;v;--v){var S=Math.sin(g),b=1-l*S*S;if(b=(vi(g,S,Math.cos(g),c)-s)*(b*Math.sqrt(b))*y,g-=b,Math.abs(b)<w)return g}return g};function wi(){this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.es&&(this.en=hl(this.es),this.ml0=vi(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function hc(s){var l=s.x,c=s.y,y=Z(l-this.long0),g,v,S,b=Math.sin(c),A=Math.cos(c);if(this.es){var D=A*y,L=Math.pow(D,2),U=this.ep2*Math.pow(A,2),W=Math.pow(U,2),F=Math.abs(A)>w?Math.tan(c):0,G=Math.pow(F,2),K=Math.pow(G,2);g=1-this.es*Math.pow(b,2),D=D/Math.sqrt(g);var ie=vi(c,b,A,this.en);v=this.a*(this.k0*D*(1+L/6*(1-G+U+L/20*(5-18*G+K+14*U-58*G*U+L/42*(61+179*K-K*G-479*G)))))+this.x0,S=this.a*(this.k0*(ie-this.ml0+b*y*D/2*(1+L/12*(5-G+9*U+4*W+L/30*(61+K-58*G+270*U-330*G*U+L/56*(1385+543*K-K*G-3111*G))))))+this.y0}else{var O=A*Math.sin(y);if(Math.abs(Math.abs(O)-1)<w)return 93;if(v=.5*this.a*this.k0*Math.log((1+O)/(1-O))+this.x0,S=A*Math.cos(y)/Math.sqrt(1-Math.pow(O,2)),O=Math.abs(S),O>=1){if(O-1>w)return 93;S=0}else S=Math.acos(S);c<0&&(S=-S),S=this.a*this.k0*(S-this.lat0)+this.y0}return s.x=v,s.y=S,s}function cl(s){var l,c,y,g,v=(s.x-this.x0)*(1/this.a),S=(s.y-this.y0)*(1/this.a);if(this.es)if(l=this.ml0+S/this.k0,c=Ki(l,this.es,this.en),Math.abs(c)<p){var L=Math.sin(c),U=Math.cos(c),W=Math.abs(U)>w?Math.tan(c):0,F=this.ep2*Math.pow(U,2),G=Math.pow(F,2),K=Math.pow(W,2),ie=Math.pow(K,2);l=1-this.es*Math.pow(L,2);var he=v*Math.sqrt(l)/this.k0,ge=Math.pow(he,2);l=l*W,y=c-l*ge/(1-this.es)*.5*(1-ge/12*(5+3*K-9*F*K+F-4*G-ge/30*(61+90*K-252*F*K+45*ie+46*F-ge/56*(1385+3633*K+4095*ie+1574*ie*K)))),g=Z(this.long0+he*(1-ge/6*(1+2*K+F-ge/20*(5+28*K+24*ie+8*F*K+6*F-ge/42*(61+662*K+1320*ie+720*ie*K))))/U)}else y=p*$i(S),g=0;else{var b=Math.exp(v/this.k0),A=.5*(b-1/b),O=this.lat0+S/this.k0,D=Math.cos(O);l=Math.sqrt((1-Math.pow(D,2))/(1+Math.pow(A,2))),y=Math.asin(l),S<0&&(y=-y),A===0&&D===0?g=0:g=Z(Math.atan2(A,D)+this.long0)}return s.x=g,s.y=y,s}var cc=["Fast_Transverse_Mercator","Fast Transverse Mercator"],Ws={init:wi,forward:hc,inverse:cl,names:cc},Pa=function(s){var l=Math.exp(s);return l=(l-1/l)/2,l},er=function(s,l){s=Math.abs(s),l=Math.abs(l);var c=Math.max(s,l),y=Math.min(s,l)/(c||1);return c*Math.sqrt(1+Math.pow(y,2))},fl=function(s){var l=1+s,c=l-1;return c===0?s:s*Math.log(l)/c},dl=function(s){var l=Math.abs(s);return l=fl(l*(1+l/(er(1,l)+1))),s<0?-l:l},Hs=function(s,l){for(var c=2*Math.cos(2*l),y=s.length-1,g=s[y],v=0,S;--y>=0;)S=-v+c*g+s[y],v=g,g=S;return l+S*Math.sin(2*l)},Ji=function(s,l){for(var c=2*Math.cos(l),y=s.length-1,g=s[y],v=0,S;--y>=0;)S=-v+c*g+s[y],v=g,g=S;return Math.sin(l)*S},Oa=function(s){var l=Math.exp(s);return l=(l+1/l)/2,l},ka=function(s,l,c){for(var y=Math.sin(l),g=Math.cos(l),v=Pa(c),S=Oa(c),b=2*g*S,A=-2*y*v,O=s.length-1,D=s[O],L=0,U=0,W=0,F,G;--O>=0;)F=U,G=L,U=D,L=W,D=-F+b*U-A*L+s[O],W=-G+A*U+b*L;return b=y*S,A=g*v,[b*D-A*W,b*W+A*D]};function fc(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(Ws.init.apply(this),this.forward=Ws.forward,this.inverse=Ws.inverse),this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var s=this.es/(1+Math.sqrt(1-this.es)),l=s/(2-s),c=l;this.cgb[0]=l*(2+l*(-2/3+l*(-2+l*(116/45+l*(26/45+l*(-2854/675)))))),this.cbg[0]=l*(-2+l*(2/3+l*(4/3+l*(-82/45+l*(32/45+l*(4642/4725)))))),c=c*l,this.cgb[1]=c*(7/3+l*(-8/5+l*(-227/45+l*(2704/315+l*(2323/945))))),this.cbg[1]=c*(5/3+l*(-16/15+l*(-13/9+l*(904/315+l*(-1522/945))))),c=c*l,this.cgb[2]=c*(56/15+l*(-136/35+l*(-1262/105+l*(73814/2835)))),this.cbg[2]=c*(-26/15+l*(34/21+l*(8/5+l*(-12686/2835)))),c=c*l,this.cgb[3]=c*(4279/630+l*(-332/35+l*(-399572/14175))),this.cbg[3]=c*(1237/630+l*(-12/5+l*(-24832/14175))),c=c*l,this.cgb[4]=c*(4174/315+l*(-144838/6237)),this.cbg[4]=c*(-734/315+l*(109598/31185)),c=c*l,this.cgb[5]=c*(601676/22275),this.cbg[5]=c*(444337/155925),c=Math.pow(l,2),this.Qn=this.k0/(1+l)*(1+c*(1/4+c*(1/64+c/256))),this.utg[0]=l*(-.5+l*(2/3+l*(-37/96+l*(1/360+l*(81/512+l*(-96199/604800)))))),this.gtu[0]=l*(.5+l*(-2/3+l*(5/16+l*(41/180+l*(-127/288+l*(7891/37800)))))),this.utg[1]=c*(-1/48+l*(-1/15+l*(437/1440+l*(-46/105+l*(1118711/3870720))))),this.gtu[1]=c*(13/48+l*(-3/5+l*(557/1440+l*(281/630+l*(-1983433/1935360))))),c=c*l,this.utg[2]=c*(-17/480+l*(37/840+l*(209/4480+l*(-5569/90720)))),this.gtu[2]=c*(61/240+l*(-103/140+l*(15061/26880+l*(167603/181440)))),c=c*l,this.utg[3]=c*(-4397/161280+l*(11/504+l*(830251/7257600))),this.gtu[3]=c*(49561/161280+l*(-179/168+l*(6601661/7257600))),c=c*l,this.utg[4]=c*(-4583/161280+l*(108847/3991680)),this.gtu[4]=c*(34729/80640+l*(-3418889/1995840)),c=c*l,this.utg[5]=c*(-20648693/638668800),this.gtu[5]=c*(212378941/319334400);var y=Hs(this.cbg,this.lat0);this.Zb=-this.Qn*(y+Ji(this.gtu,2*y))}function Gs(s){var l=Z(s.x-this.long0),c=s.y;c=Hs(this.cbg,c);var y=Math.sin(c),g=Math.cos(c),v=Math.sin(l),S=Math.cos(l);c=Math.atan2(y,S*g),l=Math.atan2(v*g,er(y,g*S)),l=dl(Math.tan(l));var b=ka(this.gtu,2*c,2*l);c=c+b[0],l=l+b[1];var A,O;return Math.abs(l)<=2.623395162778?(A=this.a*(this.Qn*l)+this.x0,O=this.a*(this.Qn*c+this.Zb)+this.y0):(A=1/0,O=1/0),s.x=A,s.y=O,s}function dc(s){var l=(s.x-this.x0)*(1/this.a),c=(s.y-this.y0)*(1/this.a);c=(c-this.Zb)/this.Qn,l=l/this.Qn;var y,g;if(Math.abs(l)<=2.623395162778){var v=ka(this.utg,2*c,2*l);c=c+v[0],l=l+v[1],l=Math.atan(Pa(l));var S=Math.sin(c),b=Math.cos(c),A=Math.sin(l),O=Math.cos(l);c=Math.atan2(S*O,er(A,O*b)),l=Math.atan2(A,O*b),y=Z(l+this.long0),g=Hs(this.cgb,c)}else y=1/0,g=1/0;return s.x=y,s.y=g,s}var mc=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","tmerc"],Bn={init:fc,forward:Gs,inverse:dc,names:mc},pc=function(s,l){if(s===void 0){if(s=Math.floor((Z(l)+Math.PI)*30/Math.PI)+1,s<0)return 0;if(s>60)return 60}return s},Vs="etmerc";function La(){var s=pc(this.zone,this.long0);if(s===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(s)-183)*E,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,Bn.init.apply(this),this.forward=Bn.forward,this.inverse=Bn.inverse}var gc=["Universal Transverse Mercator System","utm"],yc={init:La,names:gc,dependsOn:Vs},Dn=function(s,l){return Math.pow((1-s)/(1+s),l)},ml=20;function Ks(){var s=Math.sin(this.lat0),l=Math.cos(this.lat0);l*=l,this.rc=Math.sqrt(1-this.es)/(1-this.es*s*s),this.C=Math.sqrt(1+this.es*l*l/(1-this.es)),this.phic0=Math.asin(s/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+C)/(Math.pow(Math.tan(.5*this.lat0+C),this.C)*Dn(this.e*s,this.ratexp))}function Na(s){var l=s.x,c=s.y;return s.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*c+C),this.C)*Dn(this.e*Math.sin(c),this.ratexp))-p,s.x=this.C*l,s}function _i(s){for(var l=1e-14,c=s.x/this.C,y=s.y,g=Math.pow(Math.tan(.5*y+C)/this.K,1/this.C),v=ml;v>0&&(y=2*Math.atan(g*Dn(this.e*Math.sin(s.y),-.5*this.e))-p,!(Math.abs(y-s.y)<l));--v)s.y=y;return v?(s.x=c,s.y=y,s):null}var zn=["gauss"],Zi={init:Ks,forward:Na,inverse:_i,names:zn};function pl(){Zi.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))}function bc(s){var l,c,y,g;return s.x=Z(s.x-this.long0),Zi.forward.apply(this,[s]),l=Math.sin(s.y),c=Math.cos(s.y),y=Math.cos(s.x),g=this.k0*this.R2/(1+this.sinc0*l+this.cosc0*c*y),s.x=g*c*Math.sin(s.x),s.y=g*(this.cosc0*l-this.sinc0*c*y),s.x=this.a*s.x+this.x0,s.y=this.a*s.y+this.y0,s}function Ba(s){var l,c,y,g,v;if(s.x=(s.x-this.x0)/this.a,s.y=(s.y-this.y0)/this.a,s.x/=this.k0,s.y/=this.k0,v=Math.sqrt(s.x*s.x+s.y*s.y)){var S=2*Math.atan2(v,this.R2);l=Math.sin(S),c=Math.cos(S),g=Math.asin(c*this.sinc0+s.y*l*this.cosc0/v),y=Math.atan2(s.x*l,v*this.cosc0*c-s.y*this.sinc0*l)}else g=this.phic0,y=0;return s.x=y,s.y=g,Zi.inverse.apply(this,[s]),s.x=Z(s.x+this.long0),s}var vc=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"],gl={init:pl,forward:bc,inverse:Ba,names:vc};function Js(s,l,c){return l*=c,Math.tan(.5*(p+s))*Math.pow((1-l)/(1+l),.5*c)}function Da(){this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=w&&(this.k0=.5*(1+$i(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=w&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=w&&(this.k0=.5*this.cons*Tt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/ot(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=Tt(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-p,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function yl(s){var l=s.x,c=s.y,y=Math.sin(c),g=Math.cos(c),v,S,b,A,O,D,L=Z(l-this.long0);return Math.abs(Math.abs(l-this.long0)-Math.PI)<=w&&Math.abs(c+this.lat0)<=w?(s.x=NaN,s.y=NaN,s):this.sphere?(v=2*this.k0/(1+this.sinlat0*y+this.coslat0*g*Math.cos(L)),s.x=this.a*v*g*Math.sin(L)+this.x0,s.y=this.a*v*(this.coslat0*y-this.sinlat0*g*Math.cos(L))+this.y0,s):(S=2*Math.atan(this.ssfn_(c,y,this.e))-p,A=Math.cos(S),b=Math.sin(S),Math.abs(this.coslat0)<=w?(O=ot(this.e,c*this.con,this.con*y),D=2*this.a*this.k0*O/this.cons,s.x=this.x0+D*Math.sin(l-this.long0),s.y=this.y0-this.con*D*Math.cos(l-this.long0),s):(Math.abs(this.sinlat0)<w?(v=2*this.a*this.k0/(1+A*Math.cos(L)),s.y=v*b):(v=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*b+this.cosX0*A*Math.cos(L))),s.y=v*(this.cosX0*b-this.sinX0*A*Math.cos(L))+this.y0),s.x=v*A*Math.sin(L)+this.x0,s))}function bl(s){s.x-=this.x0,s.y-=this.y0;var l,c,y,g,v,S=Math.sqrt(s.x*s.x+s.y*s.y);if(this.sphere){var b=2*Math.atan(S/(2*this.a*this.k0));return l=this.long0,c=this.lat0,S<=w?(s.x=l,s.y=c,s):(c=Math.asin(Math.cos(b)*this.sinlat0+s.y*Math.sin(b)*this.coslat0/S),Math.abs(this.coslat0)<w?this.lat0>0?l=Z(this.long0+Math.atan2(s.x,-1*s.y)):l=Z(this.long0+Math.atan2(s.x,s.y)):l=Z(this.long0+Math.atan2(s.x*Math.sin(b),S*this.coslat0*Math.cos(b)-s.y*this.sinlat0*Math.sin(b))),s.x=l,s.y=c,s)}else if(Math.abs(this.coslat0)<=w){if(S<=w)return c=this.lat0,l=this.long0,s.x=l,s.y=c,s;s.x*=this.con,s.y*=this.con,y=S*this.cons/(2*this.a*this.k0),c=this.con*Ir(this.e,y),l=this.con*Z(this.con*this.long0+Math.atan2(s.x,-1*s.y))}else g=2*Math.atan(S*this.cosX0/(2*this.a*this.k0*this.ms1)),l=this.long0,S<=w?v=this.X0:(v=Math.asin(Math.cos(g)*this.sinX0+s.y*Math.sin(g)*this.cosX0/S),l=Z(this.long0+Math.atan2(s.x*Math.sin(g),S*this.cosX0*Math.cos(g)-s.y*this.sinX0*Math.sin(g)))),c=-1*Ir(this.e,Math.tan(.5*(p+v)));return s.x=l,s.y=c,s}var wc=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],_c={init:Da,forward:yl,inverse:bl,names:wc,ssfn_:Js};function za(){var s=this.lat0;this.lambda0=this.long0;var l=Math.sin(s),c=this.a,y=this.rf,g=1/y,v=2*g-Math.pow(g,2),S=this.e=Math.sqrt(v);this.R=this.k0*c*Math.sqrt(1-v)/(1-v*Math.pow(l,2)),this.alpha=Math.sqrt(1+v/(1-v)*Math.pow(Math.cos(s),4)),this.b0=Math.asin(l/this.alpha);var b=Math.log(Math.tan(Math.PI/4+this.b0/2)),A=Math.log(Math.tan(Math.PI/4+s/2)),O=Math.log((1+S*l)/(1-S*l));this.K=b-this.alpha*A+this.alpha*S/2*O}function vl(s){var l=Math.log(Math.tan(Math.PI/4-s.y/2)),c=this.e/2*Math.log((1+this.e*Math.sin(s.y))/(1-this.e*Math.sin(s.y))),y=-this.alpha*(l+c)+this.K,g=2*(Math.atan(Math.exp(y))-Math.PI/4),v=this.alpha*(s.x-this.lambda0),S=Math.atan(Math.sin(v)/(Math.sin(this.b0)*Math.tan(g)+Math.cos(this.b0)*Math.cos(v))),b=Math.asin(Math.cos(this.b0)*Math.sin(g)-Math.sin(this.b0)*Math.cos(g)*Math.cos(v));return s.y=this.R/2*Math.log((1+Math.sin(b))/(1-Math.sin(b)))+this.y0,s.x=this.R*S+this.x0,s}function xc(s){for(var l=s.x-this.x0,c=s.y-this.y0,y=l/this.R,g=2*(Math.atan(Math.exp(c/this.R))-Math.PI/4),v=Math.asin(Math.cos(this.b0)*Math.sin(g)+Math.sin(this.b0)*Math.cos(g)*Math.cos(y)),S=Math.atan(Math.sin(y)/(Math.cos(this.b0)*Math.cos(y)-Math.sin(this.b0)*Math.tan(g))),b=this.lambda0+S/this.alpha,A=0,O=v,D=-1e3,L=0;Math.abs(O-D)>1e-7;){if(++L>20)return;A=1/this.alpha*(Math.log(Math.tan(Math.PI/4+v/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(O))/2)),D=O,O=2*Math.atan(Math.exp(A))-Math.PI/2}return s.x=b,s.y=O,s}var Sc=["somerc"],Mc={init:za,forward:vl,inverse:xc,names:Sc},xi=1e-7;function Yi(s){var l=["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],c=typeof s.PROJECTION=="object"?Object.keys(s.PROJECTION)[0]:s.PROJECTION;return"no_uoff"in s||"no_off"in s||l.indexOf(c)!==-1}function Zs(){var s,l,c,y,g,v,S,b,A,O,D=0,L,U=0,W=0,F=0,G=0,K=0,ie=0;this.no_off=Yi(this),this.no_rot="no_rot"in this;var he=!1;"alpha"in this&&(he=!0);var ge=!1;if("rectified_grid_angle"in this&&(ge=!0),he&&(ie=this.alpha),ge&&(D=this.rectified_grid_angle*E),he||ge)U=this.longc;else if(W=this.long1,G=this.lat1,F=this.long2,K=this.lat2,Math.abs(G-K)<=xi||(s=Math.abs(G))<=xi||Math.abs(s-p)<=xi||Math.abs(Math.abs(this.lat0)-p)<=xi||Math.abs(Math.abs(K)-p)<=xi)throw new Error;var Fe=1-this.es;l=Math.sqrt(Fe),Math.abs(this.lat0)>w?(b=Math.sin(this.lat0),c=Math.cos(this.lat0),s=1-this.es*b*b,this.B=c*c,this.B=Math.sqrt(1+this.es*this.B*this.B/Fe),this.A=this.B*this.k0*l/s,y=this.B*l/(c*Math.sqrt(s)),g=y*y-1,g<=0?g=0:(g=Math.sqrt(g),this.lat0<0&&(g=-g)),this.E=g+=y,this.E*=Math.pow(ot(this.e,this.lat0,b),this.B)):(this.B=1/l,this.A=this.k0,this.E=y=g=1),he||ge?(he?(L=Math.asin(Math.sin(ie)/y),ge||(D=ie)):(L=D,ie=Math.asin(y*Math.sin(L))),this.lam0=U-Math.asin(.5*(g-1/g)*Math.tan(L))/this.B):(v=Math.pow(ot(this.e,G,Math.sin(G)),this.B),S=Math.pow(ot(this.e,K,Math.sin(K)),this.B),g=this.E/v,A=(S-v)/(S+v),O=this.E*this.E,O=(O-S*v)/(O+S*v),s=W-F,s<-Math.pi?F-=I:s>Math.pi&&(F+=I),this.lam0=Z(.5*(W+F)-Math.atan(O*Math.tan(.5*this.B*(W-F))/A)/this.B),L=Math.atan(2*Math.sin(this.B*Z(W-this.lam0))/(g-1/g)),D=ie=Math.asin(y*Math.sin(L))),this.singam=Math.sin(L),this.cosgam=Math.cos(L),this.sinrot=Math.sin(D),this.cosrot=Math.cos(D),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(y*y-1)/Math.cos(ie))),this.lat0<0&&(this.u_0=-this.u_0)),g=.5*L,this.v_pole_n=this.ArB*Math.log(Math.tan(C-g)),this.v_pole_s=this.ArB*Math.log(Math.tan(C+g))}function Un(s){var l={},c,y,g,v,S,b,A,O;if(s.x=s.x-this.lam0,Math.abs(Math.abs(s.y)-p)>w){if(S=this.E/Math.pow(ot(this.e,s.y,Math.sin(s.y)),this.B),b=1/S,c=.5*(S-b),y=.5*(S+b),v=Math.sin(this.B*s.x),g=(c*this.singam-v*this.cosgam)/y,Math.abs(Math.abs(g)-1)<w)throw new Error;O=.5*this.ArB*Math.log((1-g)/(1+g)),b=Math.cos(this.B*s.x),Math.abs(b)<xi?A=this.A*s.x:A=this.ArB*Math.atan2(c*this.cosgam+v*this.singam,b)}else O=s.y>0?this.v_pole_n:this.v_pole_s,A=this.ArB*s.y;return this.no_rot?(l.x=A,l.y=O):(A-=this.u_0,l.x=O*this.cosrot+A*this.sinrot,l.y=A*this.cosrot-O*this.sinrot),l.x=this.a*l.x+this.x0,l.y=this.a*l.y+this.y0,l}function wl(s){var l,c,y,g,v,S,b,A={};if(s.x=(s.x-this.x0)*(1/this.a),s.y=(s.y-this.y0)*(1/this.a),this.no_rot?(c=s.y,l=s.x):(c=s.x*this.cosrot-s.y*this.sinrot,l=s.y*this.cosrot+s.x*this.sinrot+this.u_0),y=Math.exp(-this.BrA*c),g=.5*(y-1/y),v=.5*(y+1/y),S=Math.sin(this.BrA*l),b=(S*this.cosgam+g*this.singam)/v,Math.abs(Math.abs(b)-1)<w)A.x=0,A.y=b<0?-p:p;else{if(A.y=this.E/Math.sqrt((1+b)/(1-b)),A.y=Ir(this.e,Math.pow(A.y,1/this.B)),A.y===1/0)throw new Error;A.x=-this.rB*Math.atan2(g*this.cosgam-S*this.singam,Math.cos(this.BrA*l))}return A.x+=this.lam0,A}var Ys=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","Oblique_Mercator","omerc"],jn={init:Zs,forward:Un,inverse:wl,names:Ys};function Xs(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(Math.abs(this.lat1+this.lat2)<w)){var s=this.b/this.a;this.e=Math.sqrt(1-s*s);var l=Math.sin(this.lat1),c=Math.cos(this.lat1),y=Tt(this.e,l,c),g=ot(this.e,this.lat1,l),v=Math.sin(this.lat2),S=Math.cos(this.lat2),b=Tt(this.e,v,S),A=ot(this.e,this.lat2,v),O=ot(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>w?this.ns=Math.log(y/b)/Math.log(g/A):this.ns=l,isNaN(this.ns)&&(this.ns=l),this.f0=y/(this.ns*Math.pow(g,this.ns)),this.rh=this.a*this.f0*Math.pow(O,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function Gr(s){var l=s.x,c=s.y;Math.abs(2*Math.abs(c)-Math.PI)<=w&&(c=$i(c)*(p-2*w));var y=Math.abs(Math.abs(c)-p),g,v;if(y>w)g=ot(this.e,c,Math.sin(c)),v=this.a*this.f0*Math.pow(g,this.ns);else{if(y=c*this.ns,y<=0)return null;v=0}var S=this.ns*Z(l-this.long0);return s.x=this.k0*(v*Math.sin(S))+this.x0,s.y=this.k0*(this.rh-v*Math.cos(S))+this.y0,s}function Ua(s){var l,c,y,g,v,S=(s.x-this.x0)/this.k0,b=this.rh-(s.y-this.y0)/this.k0;this.ns>0?(l=Math.sqrt(S*S+b*b),c=1):(l=-Math.sqrt(S*S+b*b),c=-1);var A=0;if(l!==0&&(A=Math.atan2(c*S,c*b)),l!==0||this.ns>0){if(c=1/this.ns,y=Math.pow(l/(this.a*this.f0),c),g=Ir(this.e,y),g===-9999)return null}else g=-p;return v=Z(A/this.ns+this.long0),s.x=v,s.y=g,s}var Ec=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"],Xi={init:Xs,forward:Gr,inverse:Ua,names:Ec};function _l(){this.a=6377397155e-3,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.7417649320975901-.308341501185665),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function Rc(s){var l,c,y,g,v,S,b,A=s.x,O=s.y,D=Z(A-this.long0);return l=Math.pow((1+this.e*Math.sin(O))/(1-this.e*Math.sin(O)),this.alfa*this.e/2),c=2*(Math.atan(this.k*Math.pow(Math.tan(O/2+this.s45),this.alfa)/l)-this.s45),y=-D*this.alfa,g=Math.asin(Math.cos(this.ad)*Math.sin(c)+Math.sin(this.ad)*Math.cos(c)*Math.cos(y)),v=Math.asin(Math.cos(c)*Math.sin(y)/Math.cos(g)),S=this.n*v,b=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(g/2+this.s45),this.n),s.y=b*Math.cos(S)/1,s.x=b*Math.sin(S)/1,this.czech||(s.y*=-1,s.x*=-1),s}function Qs(s){var l,c,y,g,v,S,b,A,O=s.x;s.x=s.y,s.y=O,this.czech||(s.y*=-1,s.x*=-1),S=Math.sqrt(s.x*s.x+s.y*s.y),v=Math.atan2(s.y,s.x),g=v/Math.sin(this.s0),y=2*(Math.atan(Math.pow(this.ro0/S,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),l=Math.asin(Math.cos(this.ad)*Math.sin(y)-Math.sin(this.ad)*Math.cos(y)*Math.cos(g)),c=Math.asin(Math.cos(y)*Math.sin(g)/Math.cos(l)),s.x=this.long0-c/this.alfa,b=l,A=0;var D=0;do s.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(l/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(b))/(1-this.e*Math.sin(b)),this.e/2))-this.s45),Math.abs(b-s.y)<1e-10&&(A=1),b=s.y,D+=1;while(A===0&&D<15);return D>=15?null:s}var Cc=["Krovak","krovak"],Ac={init:_l,forward:Rc,inverse:Qs,names:Cc},gt=function(s,l,c,y,g){return s*g-l*Math.sin(2*g)+c*Math.sin(4*g)-y*Math.sin(6*g)},$n=function(s){return 1-.25*s*(1+s/16*(3+1.25*s))},qn=function(s){return .375*s*(1+.25*s*(1+.46875*s))},Fn=function(s){return .05859375*s*s*(1+.75*s)},Wn=function(s){return s*s*s*(35/3072)},Qi=function(s,l,c){var y=l*c;return s/Math.sqrt(1-y*y)},en=function(s){return Math.abs(s)<p?s:s-$i(s)*Math.PI},eo=function(s,l,c,y,g){var v,S;v=s/l;for(var b=0;b<15;b++)if(S=(s-(l*v-c*Math.sin(2*v)+y*Math.sin(4*v)-g*Math.sin(6*v)))/(l-2*c*Math.cos(2*v)+4*y*Math.cos(4*v)-6*g*Math.cos(6*v)),v+=S,Math.abs(S)<=1e-10)return v;return NaN};function Tc(){this.sphere||(this.e0=$n(this.es),this.e1=qn(this.es),this.e2=Fn(this.es),this.e3=Wn(this.es),this.ml0=this.a*gt(this.e0,this.e1,this.e2,this.e3,this.lat0))}function xl(s){var l,c,y=s.x,g=s.y;if(y=Z(y-this.long0),this.sphere)l=this.a*Math.asin(Math.cos(g)*Math.sin(y)),c=this.a*(Math.atan2(Math.tan(g),Math.cos(y))-this.lat0);else{var v=Math.sin(g),S=Math.cos(g),b=Qi(this.a,this.e,v),A=Math.tan(g)*Math.tan(g),O=y*Math.cos(g),D=O*O,L=this.es*S*S/(1-this.es),U=this.a*gt(this.e0,this.e1,this.e2,this.e3,g);l=b*O*(1-D*A*(1/6-(8-A+8*L)*D/120)),c=U-this.ml0+b*v/S*D*(.5+(5-A+6*L)*D/24)}return s.x=l+this.x0,s.y=c+this.y0,s}function Ic(s){s.x-=this.x0,s.y-=this.y0;var l=s.x/this.a,c=s.y/this.a,y,g;if(this.sphere){var v=c+this.lat0;y=Math.asin(Math.sin(v)*Math.cos(l)),g=Math.atan2(Math.tan(l),Math.cos(v))}else{var S=this.ml0/this.a+c,b=eo(S,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(b)-p)<=w)return s.x=this.long0,s.y=p,c<0&&(s.y*=-1),s;var A=Qi(this.a,this.e,Math.sin(b)),O=A*A*A/this.a/this.a*(1-this.es),D=Math.pow(Math.tan(b),2),L=l*this.a/A,U=L*L;y=b-A*Math.tan(b)/O*L*L*(.5-(1+3*D)*L*L/24),g=L*(1-U*(D/3+(1+3*D)*D*U/15))/Math.cos(b)}return s.x=Z(g+this.long0),s.y=en(y),s}var Pc=["Cassini","Cassini_Soldner","cass"],Vr={init:Tc,forward:xl,inverse:Ic,names:Pc},dr=function(s,l){var c;return s>1e-7?(c=s*l,(1-s*s)*(l/(1-c*c)-.5/s*Math.log((1-c)/(1+c)))):2*l},Sl=1,ja=2,Kr=3,Jr=4;function tr(){var s=Math.abs(this.lat0);if(Math.abs(s-p)<w?this.mode=this.lat0<0?this.S_POLE:this.N_POLE:Math.abs(s)<w?this.mode=this.EQUIT:this.mode=this.OBLIQ,this.es>0){var l;switch(this.qp=dr(this.e,1),this.mmf=.5/(1-this.es),this.apa=Tl(this.es),this.mode){case this.N_POLE:this.dd=1;break;case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),l=Math.sin(this.lat0),this.sinb1=dr(this.e,l)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*l*l)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd;break}}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function Hn(s){var l,c,y,g,v,S,b,A,O,D,L=s.x,U=s.y;if(L=Z(L-this.long0),this.sphere){if(v=Math.sin(U),D=Math.cos(U),y=Math.cos(L),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(c=this.mode===this.EQUIT?1+D*y:1+this.sinph0*v+this.cosph0*D*y,c<=w)return null;c=Math.sqrt(2/c),l=c*D*Math.sin(L),c*=this.mode===this.EQUIT?v:this.cosph0*v-this.sinph0*D*y}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(y=-y),Math.abs(U+this.lat0)<w)return null;c=C-U*.5,c=2*(this.mode===this.S_POLE?Math.cos(c):Math.sin(c)),l=c*Math.sin(L),c*=y}}else{switch(b=0,A=0,O=0,y=Math.cos(L),g=Math.sin(L),v=Math.sin(U),S=dr(this.e,v),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(b=S/this.qp,A=Math.sqrt(1-b*b)),this.mode){case this.OBLIQ:O=1+this.sinb1*b+this.cosb1*A*y;break;case this.EQUIT:O=1+A*y;break;case this.N_POLE:O=p+U,S=this.qp-S;break;case this.S_POLE:O=U-p,S=this.qp+S;break}if(Math.abs(O)<w)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:O=Math.sqrt(2/O),this.mode===this.OBLIQ?c=this.ymf*O*(this.cosb1*b-this.sinb1*A*y):c=(O=Math.sqrt(2/(1+A*y)))*b*this.ymf,l=this.xmf*O*A*g;break;case this.N_POLE:case this.S_POLE:S>=0?(l=(O=Math.sqrt(S))*g,c=y*(this.mode===this.S_POLE?O:-O)):l=c=0;break}}return s.x=this.a*l+this.x0,s.y=this.a*c+this.y0,s}function Ml(s){s.x-=this.x0,s.y-=this.y0;var l=s.x/this.a,c=s.y/this.a,y,g,v,S,b,A,O;if(this.sphere){var D=0,L,U=0;if(L=Math.sqrt(l*l+c*c),g=L*.5,g>1)return null;switch(g=2*Math.asin(g),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(U=Math.sin(g),D=Math.cos(g)),this.mode){case this.EQUIT:g=Math.abs(L)<=w?0:Math.asin(c*U/L),l*=U,c=D*L;break;case this.OBLIQ:g=Math.abs(L)<=w?this.lat0:Math.asin(D*this.sinph0+c*U*this.cosph0/L),l*=U*this.cosph0,c=(D-Math.sin(g)*this.sinph0)*L;break;case this.N_POLE:c=-c,g=p-g;break;case this.S_POLE:g-=p;break}y=c===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(l,c)}else{if(O=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(l/=this.dd,c*=this.dd,A=Math.sqrt(l*l+c*c),A<w)return s.x=this.long0,s.y=this.lat0,s;S=2*Math.asin(.5*A/this.rq),v=Math.cos(S),l*=S=Math.sin(S),this.mode===this.OBLIQ?(O=v*this.sinb1+c*S*this.cosb1/A,b=this.qp*O,c=A*this.cosb1*v-c*this.sinb1*S):(O=c*S/A,b=this.qp*O,c=A*v)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(c=-c),b=l*l+c*c,!b)return s.x=this.long0,s.y=this.lat0,s;O=1-b/this.qp,this.mode===this.S_POLE&&(O=-O)}y=Math.atan2(l,c),g=ro(Math.asin(O),this.apa)}return s.x=Z(this.long0+y),s.y=g,s}var Si=.3333333333333333,El=.17222222222222222,Rl=.10257936507936508,to=.06388888888888888,Cl=.0664021164021164,Al=.016415012942191543;function Tl(s){var l,c=[];return c[0]=s*Si,l=s*s,c[0]+=l*El,c[1]=l*to,l*=s,c[0]+=l*Rl,c[1]+=l*Cl,c[2]=l*Al,c}function ro(s,l){var c=s+s;return s+l[0]*Math.sin(c)+l[1]*Math.sin(c+c)+l[2]*Math.sin(c+c+c)}var Il=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],Pl={init:tr,forward:Hn,inverse:Ml,names:Il,S_POLE:Sl,N_POLE:ja,EQUIT:Kr,OBLIQ:Jr},Zr=function(s){return Math.abs(s)>1&&(s=s>1?1:-1),Math.asin(s)};function Oc(){Math.abs(this.lat1+this.lat2)<w||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=Tt(this.e3,this.sin_po,this.cos_po),this.qs1=dr(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=Tt(this.e3,this.sin_po,this.cos_po),this.qs2=dr(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=dr(this.e3,this.sin_po,this.cos_po),Math.abs(this.lat1-this.lat2)>w?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function kc(s){var l=s.x,c=s.y;this.sin_phi=Math.sin(c),this.cos_phi=Math.cos(c);var y=dr(this.e3,this.sin_phi,this.cos_phi),g=this.a*Math.sqrt(this.c-this.ns0*y)/this.ns0,v=this.ns0*Z(l-this.long0),S=g*Math.sin(v)+this.x0,b=this.rh-g*Math.cos(v)+this.y0;return s.x=S,s.y=b,s}function Lc(s){var l,c,y,g,v,S;return s.x-=this.x0,s.y=this.rh-s.y+this.y0,this.ns0>=0?(l=Math.sqrt(s.x*s.x+s.y*s.y),y=1):(l=-Math.sqrt(s.x*s.x+s.y*s.y),y=-1),g=0,l!==0&&(g=Math.atan2(y*s.x,y*s.y)),y=l*this.ns0/this.a,this.sphere?S=Math.asin((this.c-y*y)/(2*this.ns0)):(c=(this.c-y*y)/this.ns0,S=this.phi1z(this.e3,c)),v=Z(g/this.ns0+this.long0),s.x=v,s.y=S,s}function io(s,l){var c,y,g,v,S,b=Zr(.5*l);if(s<w)return b;for(var A=s*s,O=1;O<=25;O++)if(c=Math.sin(b),y=Math.cos(b),g=s*c,v=1-g*g,S=.5*v*v/y*(l/(1-A)-c/v+.5/s*Math.log((1-g)/(1+g))),b=b+S,Math.abs(S)<=1e-7)return b;return null}var Nc=["Albers_Conic_Equal_Area","Albers","aea"],Ol={init:Oc,forward:kc,inverse:Lc,names:Nc,phi1z:io};function no(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function so(s){var l,c,y,g,v,S,b,A,O=s.x,D=s.y;return y=Z(O-this.long0),l=Math.sin(D),c=Math.cos(D),g=Math.cos(y),S=this.sin_p14*l+this.cos_p14*c*g,v=1,S>0||Math.abs(S)<=w?(b=this.x0+this.a*v*c*Math.sin(y)/S,A=this.y0+this.a*v*(this.cos_p14*l-this.sin_p14*c*g)/S):(b=this.x0+this.infinity_dist*c*Math.sin(y),A=this.y0+this.infinity_dist*(this.cos_p14*l-this.sin_p14*c*g)),s.x=b,s.y=A,s}function oo(s){var l,c,y,g,v,S;return s.x=(s.x-this.x0)/this.a,s.y=(s.y-this.y0)/this.a,s.x/=this.k0,s.y/=this.k0,(l=Math.sqrt(s.x*s.x+s.y*s.y))?(g=Math.atan2(l,this.rc),c=Math.sin(g),y=Math.cos(g),S=Zr(y*this.sin_p14+s.y*c*this.cos_p14/l),v=Math.atan2(s.x*c,l*this.cos_p14*y-s.y*this.sin_p14*c),v=Z(this.long0+v)):(S=this.phic0,v=0),s.x=v,s.y=S,s}var Gn=["gnom"],ao={init:no,forward:so,inverse:oo,names:Gn},Bc=function(s,l){var c=1-(1-s*s)/(2*s)*Math.log((1-s)/(1+s));if(Math.abs(Math.abs(l)-c)<1e-6)return l<0?-1*p:p;for(var y=Math.asin(.5*l),g,v,S,b,A=0;A<30;A++)if(v=Math.sin(y),S=Math.cos(y),b=s*v,g=Math.pow(1-b*b,2)/(2*S)*(l/(1-s*s)-v/(1-b*b)+.5/s*Math.log((1-b)/(1+b))),y+=g,Math.abs(g)<=1e-10)return y;return NaN};function Dc(){this.sphere||(this.k0=Tt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function kl(s){var l=s.x,c=s.y,y,g,v=Z(l-this.long0);if(this.sphere)y=this.x0+this.a*v*Math.cos(this.lat_ts),g=this.y0+this.a*Math.sin(c)/Math.cos(this.lat_ts);else{var S=dr(this.e,Math.sin(c));y=this.x0+this.a*this.k0*v,g=this.y0+this.a*S*.5/this.k0}return s.x=y,s.y=g,s}function Ll(s){s.x-=this.x0,s.y-=this.y0;var l,c;return this.sphere?(l=Z(this.long0+s.x/this.a/Math.cos(this.lat_ts)),c=Math.asin(s.y/this.a*Math.cos(this.lat_ts))):(c=Bc(this.e,2*s.y*this.k0/this.a),l=Z(this.long0+s.x/(this.a*this.k0))),s.x=l,s.y=c,s}var zc=["cea"],Nl={init:Dc,forward:kl,inverse:Ll,names:zc};function Uc(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)}function jc(s){var l=s.x,c=s.y,y=Z(l-this.long0),g=en(c-this.lat0);return s.x=this.x0+this.a*y*this.rc,s.y=this.y0+this.a*g,s}function $c(s){var l=s.x,c=s.y;return s.x=Z(this.long0+(l-this.x0)/(this.a*this.rc)),s.y=en(this.lat0+(c-this.y0)/this.a),s}var qc=["Equirectangular","Equidistant_Cylindrical","eqc"],Fc={init:Uc,forward:jc,inverse:$c,names:qc},Vn=20;function Bl(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=$n(this.es),this.e1=qn(this.es),this.e2=Fn(this.es),this.e3=Wn(this.es),this.ml0=this.a*gt(this.e0,this.e1,this.e2,this.e3,this.lat0)}function u(s){var l=s.x,c=s.y,y,g,v,S=Z(l-this.long0);if(v=S*Math.sin(c),this.sphere)Math.abs(c)<=w?(y=this.a*S,g=-1*this.a*this.lat0):(y=this.a*Math.sin(v)/Math.tan(c),g=this.a*(en(c-this.lat0)+(1-Math.cos(v))/Math.tan(c)));else if(Math.abs(c)<=w)y=this.a*S,g=-1*this.ml0;else{var b=Qi(this.a,this.e,Math.sin(c))/Math.tan(c);y=b*Math.sin(v),g=this.a*gt(this.e0,this.e1,this.e2,this.e3,c)-this.ml0+b*(1-Math.cos(v))}return s.x=y+this.x0,s.y=g+this.y0,s}function f(s){var l,c,y,g,v,S,b,A,O;if(y=s.x-this.x0,g=s.y-this.y0,this.sphere)if(Math.abs(g+this.a*this.lat0)<=w)l=Z(y/this.a+this.long0),c=0;else{S=this.lat0+g/this.a,b=y*y/this.a/this.a+S*S,A=S;var D;for(v=Vn;v;--v)if(D=Math.tan(A),O=-1*(S*(A*D+1)-A-.5*(A*A+b)*D)/((A-S)/D-1),A+=O,Math.abs(O)<=w){c=A;break}l=Z(this.long0+Math.asin(y*Math.tan(A)/this.a)/Math.sin(c))}else if(Math.abs(g+this.ml0)<=w)c=0,l=Z(this.long0+y/this.a);else{S=(this.ml0+g)/this.a,b=y*y/this.a/this.a+S*S,A=S;var L,U,W,F,G;for(v=Vn;v;--v)if(G=this.e*Math.sin(A),L=Math.sqrt(1-G*G)*Math.tan(A),U=this.a*gt(this.e0,this.e1,this.e2,this.e3,A),W=this.e0-2*this.e1*Math.cos(2*A)+4*this.e2*Math.cos(4*A)-6*this.e3*Math.cos(6*A),F=U/this.a,O=(S*(L*F+1)-F-.5*L*(F*F+b))/(this.es*Math.sin(2*A)*(F*F+b-2*S*F)/(4*L)+(S-F)*(L*W-2/Math.sin(2*A))-W),A-=O,Math.abs(O)<=w){c=A;break}L=Math.sqrt(1-this.es*Math.pow(Math.sin(c),2))*Math.tan(c),l=Z(this.long0+Math.asin(y*L/this.a)/Math.sin(c))}return s.x=l,s.y=c,s}var _=["Polyconic","poly"],P={init:Bl,forward:u,inverse:f,names:_};function N(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function j(s){var l,c=s.x,y=s.y,g=y-this.lat0,v=c-this.long0,S=g/m*1e-5,b=v,A=1,O=0;for(l=1;l<=10;l++)A=A*S,O=O+this.A[l]*A;var D=O,L=b,U=1,W=0,F,G,K=0,ie=0;for(l=1;l<=6;l++)F=U*D-W*L,G=W*D+U*L,U=F,W=G,K=K+this.B_re[l]*U-this.B_im[l]*W,ie=ie+this.B_im[l]*U+this.B_re[l]*W;return s.x=ie*this.a+this.x0,s.y=K*this.a+this.y0,s}function q(s){var l,c=s.x,y=s.y,g=c-this.x0,v=y-this.y0,S=v/this.a,b=g/this.a,A=1,O=0,D,L,U=0,W=0;for(l=1;l<=6;l++)D=A*S-O*b,L=O*S+A*b,A=D,O=L,U=U+this.C_re[l]*A-this.C_im[l]*O,W=W+this.C_im[l]*A+this.C_re[l]*O;for(var F=0;F<this.iterations;F++){var G=U,K=W,ie,he,ge=S,Fe=b;for(l=2;l<=6;l++)ie=G*U-K*W,he=K*U+G*W,G=ie,K=he,ge=ge+(l-1)*(this.B_re[l]*G-this.B_im[l]*K),Fe=Fe+(l-1)*(this.B_im[l]*G+this.B_re[l]*K);G=1,K=0;var ke=this.B_re[1],De=this.B_im[1];for(l=2;l<=6;l++)ie=G*U-K*W,he=K*U+G*W,G=ie,K=he,ke=ke+l*(this.B_re[l]*G-this.B_im[l]*K),De=De+l*(this.B_im[l]*G+this.B_re[l]*K);var St=ke*ke+De*De;U=(ge*ke+Fe*De)/St,W=(Fe*ke-ge*De)/St}var tt=U,Xr=W,Kn=1,Jn=0;for(l=1;l<=9;l++)Kn=Kn*tt,Jn=Jn+this.D[l]*Kn;var jl=this.lat0+Jn*m*1e5,Fg=this.long0+Xr;return s.x=Fg,s.y=jl,s}var te=["New_Zealand_Map_Grid","nzmg"],ce={init:N,forward:j,inverse:q,names:te};function ve(){}function Ie(s){var l=s.x,c=s.y,y=Z(l-this.long0),g=this.x0+this.a*y,v=this.y0+this.a*Math.log(Math.tan(Math.PI/4+c/2.5))*1.25;return s.x=g,s.y=v,s}function Pe(s){s.x-=this.x0,s.y-=this.y0;var l=Z(this.long0+s.x/this.a),c=2.5*(Math.atan(Math.exp(.8*s.y/this.a))-Math.PI/4);return s.x=l,s.y=c,s}var et=["Miller_Cylindrical","mill"],rr={init:ve,forward:Ie,inverse:Pe,names:et},tn=20;function Yr(){this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=hl(this.es)}function kr(s){var l,c,y=s.x,g=s.y;if(y=Z(y-this.long0),this.sphere){if(!this.m)g=this.n!==1?Math.asin(this.n*Math.sin(g)):g;else for(var v=this.n*Math.sin(g),S=tn;S;--S){var b=(this.m*g+Math.sin(g)-v)/(this.m+Math.cos(g));if(g-=b,Math.abs(b)<w)break}l=this.a*this.C_x*y*(this.m+Math.cos(g)),c=this.a*this.C_y*g}else{var A=Math.sin(g),O=Math.cos(g);c=this.a*vi(g,A,O,this.en),l=this.a*y*O/Math.sqrt(1-this.es*A*A)}return s.x=l,s.y=c,s}function yt(s){var l,c,y,g;return s.x-=this.x0,y=s.x/this.a,s.y-=this.y0,l=s.y/this.a,this.sphere?(l/=this.C_y,y=y/(this.C_x*(this.m+Math.cos(l))),this.m?l=Zr((this.m*l+Math.sin(l))/this.n):this.n!==1&&(l=Zr(Math.sin(l)/this.n)),y=Z(y+this.long0),l=en(l)):(l=Ki(s.y/this.a,this.es,this.en),g=Math.abs(l),g<p?(g=Math.sin(l),c=this.long0+s.x*Math.sqrt(1-this.es*g*g)/(this.a*Math.cos(l)),y=Z(c)):g-w<p&&(y=this.long0)),s.x=y,s.y=l,s}var _t=["Sinusoidal","sinu"],$t={init:Yr,forward:kr,inverse:yt,names:_t};function Lr(){}function ne(s){for(var l=s.x,c=s.y,y=Z(l-this.long0),g=c,v=Math.PI*Math.sin(c);;){var S=-(g+Math.sin(g)-v)/(1+Math.cos(g));if(g+=S,Math.abs(S)<w)break}g/=2,Math.PI/2-Math.abs(c)<w&&(y=0);var b=.900316316158*this.a*y*Math.cos(g)+this.x0,A=1.4142135623731*this.a*Math.sin(g)+this.y0;return s.x=b,s.y=A,s}function pe(s){var l,c;s.x-=this.x0,s.y-=this.y0,c=s.y/(1.4142135623731*this.a),Math.abs(c)>.999999999999&&(c=.999999999999),l=Math.asin(c);var y=Z(this.long0+s.x/(.900316316158*this.a*Math.cos(l)));y<-Math.PI&&(y=-Math.PI),y>Math.PI&&(y=Math.PI),c=(2*l+Math.sin(2*l))/Math.PI,Math.abs(c)>1&&(c=1);var g=Math.asin(c);return s.x=y,s.y=g,s}var je=["Mollweide","moll"],Pt={init:Lr,forward:ne,inverse:pe,names:je};function rn(){Math.abs(this.lat1+this.lat2)<w||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=$n(this.es),this.e1=qn(this.es),this.e2=Fn(this.es),this.e3=Wn(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=Tt(this.e,this.sinphi,this.cosphi),this.ml1=gt(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<w?this.ns=this.sinphi:(this.sinphi=Math.sin(this.lat2),this.cosphi=Math.cos(this.lat2),this.ms2=Tt(this.e,this.sinphi,this.cosphi),this.ml2=gt(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=gt(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function nn(s){var l=s.x,c=s.y,y;if(this.sphere)y=this.a*(this.g-c);else{var g=gt(this.e0,this.e1,this.e2,this.e3,c);y=this.a*(this.g-g)}var v=this.ns*Z(l-this.long0),S=this.x0+y*Math.sin(v),b=this.y0+this.rh-y*Math.cos(v);return s.x=S,s.y=b,s}function sn(s){s.x-=this.x0,s.y=this.rh-s.y+this.y0;var l,c,y,g;this.ns>=0?(c=Math.sqrt(s.x*s.x+s.y*s.y),l=1):(c=-Math.sqrt(s.x*s.x+s.y*s.y),l=-1);var v=0;if(c!==0&&(v=Math.atan2(l*s.x,l*s.y)),this.sphere)return g=Z(this.long0+v/this.ns),y=en(this.g-c/this.a),s.x=g,s.y=y,s;var S=this.g-c/this.a;return y=eo(S,this.e0,this.e1,this.e2,this.e3),g=Z(this.long0+v/this.ns),s.x=g,s.y=y,s}var lo=["Equidistant_Conic","eqdc"],Dl={init:rn,forward:nn,inverse:sn,names:lo};function $a(){this.R=this.a}function eg(s){var l=s.x,c=s.y,y=Z(l-this.long0),g,v;Math.abs(c)<=w&&(g=this.x0+this.R*y,v=this.y0);var S=Zr(2*Math.abs(c/Math.PI));(Math.abs(y)<=w||Math.abs(Math.abs(c)-p)<=w)&&(g=this.x0,c>=0?v=this.y0+Math.PI*this.R*Math.tan(.5*S):v=this.y0+Math.PI*this.R*-Math.tan(.5*S));var b=.5*Math.abs(Math.PI/y-y/Math.PI),A=b*b,O=Math.sin(S),D=Math.cos(S),L=D/(O+D-1),U=L*L,W=L*(2/O-1),F=W*W,G=Math.PI*this.R*(b*(L-F)+Math.sqrt(A*(L-F)*(L-F)-(F+A)*(U-F)))/(F+A);y<0&&(G=-G),g=this.x0+G;var K=A+L;return G=Math.PI*this.R*(W*K-b*Math.sqrt((F+A)*(A+1)-K*K))/(F+A),c>=0?v=this.y0+G:v=this.y0-G,s.x=g,s.y=v,s}function tg(s){var l,c,y,g,v,S,b,A,O,D,L,U,W;return s.x-=this.x0,s.y-=this.y0,L=Math.PI*this.R,y=s.x/L,g=s.y/L,v=y*y+g*g,S=-Math.abs(g)*(1+v),b=S-2*g*g+y*y,A=-2*S+1+2*g*g+v*v,W=g*g/A+(2*b*b*b/A/A/A-9*S*b/A/A)/27,O=(S-b*b/3/A)/A,D=2*Math.sqrt(-O/3),L=3*W/O/D,Math.abs(L)>1&&(L>=0?L=1:L=-1),U=Math.acos(L)/3,s.y>=0?c=(-D*Math.cos(U+Math.PI/3)-b/3/A)*Math.PI:c=-(-D*Math.cos(U+Math.PI/3)-b/3/A)*Math.PI,Math.abs(y)<w?l=this.long0:l=Z(this.long0+Math.PI*(v-1+Math.sqrt(1+2*(y*y-g*g)+v*v))/2/y),s.x=l,s.y=c,s}var rg=["Van_der_Grinten_I","VanDerGrinten","vandg"],ig={init:$a,forward:eg,inverse:tg,names:rg};function ng(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)}function sg(s){var l=s.x,c=s.y,y=Math.sin(s.y),g=Math.cos(s.y),v=Z(l-this.long0),S,b,A,O,D,L,U,W,F,G,K,ie,he,ge,Fe,ke,De,St,tt,Xr,Kn,Jn,jl;return this.sphere?Math.abs(this.sin_p12-1)<=w?(s.x=this.x0+this.a*(p-c)*Math.sin(v),s.y=this.y0-this.a*(p-c)*Math.cos(v),s):Math.abs(this.sin_p12+1)<=w?(s.x=this.x0+this.a*(p+c)*Math.sin(v),s.y=this.y0+this.a*(p+c)*Math.cos(v),s):(St=this.sin_p12*y+this.cos_p12*g*Math.cos(v),ke=Math.acos(St),De=ke?ke/Math.sin(ke):1,s.x=this.x0+this.a*De*g*Math.sin(v),s.y=this.y0+this.a*De*(this.cos_p12*y-this.sin_p12*g*Math.cos(v)),s):(S=$n(this.es),b=qn(this.es),A=Fn(this.es),O=Wn(this.es),Math.abs(this.sin_p12-1)<=w?(D=this.a*gt(S,b,A,O,p),L=this.a*gt(S,b,A,O,c),s.x=this.x0+(D-L)*Math.sin(v),s.y=this.y0-(D-L)*Math.cos(v),s):Math.abs(this.sin_p12+1)<=w?(D=this.a*gt(S,b,A,O,p),L=this.a*gt(S,b,A,O,c),s.x=this.x0+(D+L)*Math.sin(v),s.y=this.y0+(D+L)*Math.cos(v),s):(U=y/g,W=Qi(this.a,this.e,this.sin_p12),F=Qi(this.a,this.e,y),G=Math.atan((1-this.es)*U+this.es*W*this.sin_p12/(F*g)),K=Math.atan2(Math.sin(v),this.cos_p12*Math.tan(G)-this.sin_p12*Math.cos(v)),K===0?tt=Math.asin(this.cos_p12*Math.sin(G)-this.sin_p12*Math.cos(G)):Math.abs(Math.abs(K)-Math.PI)<=w?tt=-Math.asin(this.cos_p12*Math.sin(G)-this.sin_p12*Math.cos(G)):tt=Math.asin(Math.sin(v)*Math.cos(G)/Math.sin(K)),ie=this.e*this.sin_p12/Math.sqrt(1-this.es),he=this.e*this.cos_p12*Math.cos(K)/Math.sqrt(1-this.es),ge=ie*he,Fe=he*he,Xr=tt*tt,Kn=Xr*tt,Jn=Kn*tt,jl=Jn*tt,ke=W*tt*(1-Xr*Fe*(1-Fe)/6+Kn/8*ge*(1-2*Fe)+Jn/120*(Fe*(4-7*Fe)-3*ie*ie*(1-7*Fe))-jl/48*ge),s.x=this.x0+ke*Math.sin(K),s.y=this.y0+ke*Math.cos(K),s))}function og(s){s.x-=this.x0,s.y-=this.y0;var l,c,y,g,v,S,b,A,O,D,L,U,W,F,G,K,ie,he,ge,Fe,ke,De,St,tt;return this.sphere?(l=Math.sqrt(s.x*s.x+s.y*s.y),l>2*p*this.a?void 0:(c=l/this.a,y=Math.sin(c),g=Math.cos(c),v=this.long0,Math.abs(l)<=w?S=this.lat0:(S=Zr(g*this.sin_p12+s.y*y*this.cos_p12/l),b=Math.abs(this.lat0)-p,Math.abs(b)<=w?this.lat0>=0?v=Z(this.long0+Math.atan2(s.x,-s.y)):v=Z(this.long0-Math.atan2(-s.x,s.y)):v=Z(this.long0+Math.atan2(s.x*y,l*this.cos_p12*g-s.y*this.sin_p12*y))),s.x=v,s.y=S,s)):(A=$n(this.es),O=qn(this.es),D=Fn(this.es),L=Wn(this.es),Math.abs(this.sin_p12-1)<=w?(U=this.a*gt(A,O,D,L,p),l=Math.sqrt(s.x*s.x+s.y*s.y),W=U-l,S=eo(W/this.a,A,O,D,L),v=Z(this.long0+Math.atan2(s.x,-1*s.y)),s.x=v,s.y=S,s):Math.abs(this.sin_p12+1)<=w?(U=this.a*gt(A,O,D,L,p),l=Math.sqrt(s.x*s.x+s.y*s.y),W=l-U,S=eo(W/this.a,A,O,D,L),v=Z(this.long0+Math.atan2(s.x,s.y)),s.x=v,s.y=S,s):(l=Math.sqrt(s.x*s.x+s.y*s.y),K=Math.atan2(s.x,s.y),F=Qi(this.a,this.e,this.sin_p12),ie=Math.cos(K),he=this.e*this.cos_p12*ie,ge=-he*he/(1-this.es),Fe=3*this.es*(1-ge)*this.sin_p12*this.cos_p12*ie/(1-this.es),ke=l/F,De=ke-ge*(1+ge)*Math.pow(ke,3)/6-Fe*(1+3*ge)*Math.pow(ke,4)/24,St=1-ge*De*De/2-ke*De*De*De/6,G=Math.asin(this.sin_p12*Math.cos(De)+this.cos_p12*Math.sin(De)*ie),v=Z(this.long0+Math.asin(Math.sin(K)*Math.sin(De)/Math.cos(G))),tt=Math.sin(G),S=Math.atan2((tt-this.es*St*this.sin_p12)*Math.tan(G),tt*(1-this.es)),s.x=v,s.y=S,s))}var ag=["Azimuthal_Equidistant","aeqd"],lg={init:ng,forward:sg,inverse:og,names:ag};function ug(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function hg(s){var l,c,y,g,v,S,b,A,O=s.x,D=s.y;return y=Z(O-this.long0),l=Math.sin(D),c=Math.cos(D),g=Math.cos(y),S=this.sin_p14*l+this.cos_p14*c*g,v=1,(S>0||Math.abs(S)<=w)&&(b=this.a*v*c*Math.sin(y),A=this.y0+this.a*v*(this.cos_p14*l-this.sin_p14*c*g)),s.x=b,s.y=A,s}function cg(s){var l,c,y,g,v,S,b;return s.x-=this.x0,s.y-=this.y0,l=Math.sqrt(s.x*s.x+s.y*s.y),c=Zr(l/this.a),y=Math.sin(c),g=Math.cos(c),S=this.long0,Math.abs(l)<=w?(b=this.lat0,s.x=S,s.y=b,s):(b=Zr(g*this.sin_p14+s.y*y*this.cos_p14/l),v=Math.abs(this.lat0)-p,Math.abs(v)<=w?(this.lat0>=0?S=Z(this.long0+Math.atan2(s.x,-s.y)):S=Z(this.long0-Math.atan2(-s.x,s.y)),s.x=S,s.y=b,s):(S=Z(this.long0+Math.atan2(s.x*y,l*this.cos_p14*g-s.y*this.sin_p14*y)),s.x=S,s.y=b,s))}var fg=["ortho"],dg={init:ug,forward:hg,inverse:cg,names:fg},Xe={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},Be={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function mg(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=p-C/2?this.face=Xe.TOP:this.lat0<=-(p-C/2)?this.face=Xe.BOTTOM:Math.abs(this.long0)<=C?this.face=Xe.FRONT:Math.abs(this.long0)<=p+C?this.face=this.long0>0?Xe.RIGHT:Xe.LEFT:this.face=Xe.BACK,this.es!==0&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function pg(s){var l={x:0,y:0},c,y,g,v,S,b,A={value:0};if(s.x-=this.long0,this.es!==0?c=Math.atan(this.one_minus_f_squared*Math.tan(s.y)):c=s.y,y=s.x,this.face===Xe.TOP)v=p-c,y>=C&&y<=p+C?(A.value=Be.AREA_0,g=y-p):y>p+C||y<=-(p+C)?(A.value=Be.AREA_1,g=y>0?y-k:y+k):y>-(p+C)&&y<=-C?(A.value=Be.AREA_2,g=y+p):(A.value=Be.AREA_3,g=y);else if(this.face===Xe.BOTTOM)v=p+c,y>=C&&y<=p+C?(A.value=Be.AREA_0,g=-y+p):y<C&&y>=-C?(A.value=Be.AREA_1,g=-y):y<-C&&y>=-(p+C)?(A.value=Be.AREA_2,g=-y-p):(A.value=Be.AREA_3,g=y>0?-y+k:-y-k);else{var O,D,L,U,W,F,G;this.face===Xe.RIGHT?y=uo(y,+p):this.face===Xe.BACK?y=uo(y,+k):this.face===Xe.LEFT&&(y=uo(y,-p)),U=Math.sin(c),W=Math.cos(c),F=Math.sin(y),G=Math.cos(y),O=W*G,D=W*F,L=U,this.face===Xe.FRONT?(v=Math.acos(O),g=zl(v,L,D,A)):this.face===Xe.RIGHT?(v=Math.acos(D),g=zl(v,L,-O,A)):this.face===Xe.BACK?(v=Math.acos(-O),g=zl(v,L,-D,A)):this.face===Xe.LEFT?(v=Math.acos(-D),g=zl(v,L,O,A)):(v=g=0,A.value=Be.AREA_0)}return b=Math.atan(12/k*(g+Math.acos(Math.sin(g)*Math.cos(C))-p)),S=Math.sqrt((1-Math.cos(v))/(Math.cos(b)*Math.cos(b))/(1-Math.cos(Math.atan(1/Math.cos(g))))),A.value===Be.AREA_1?b+=p:A.value===Be.AREA_2?b+=k:A.value===Be.AREA_3&&(b+=1.5*k),l.x=S*Math.cos(b),l.y=S*Math.sin(b),l.x=l.x*this.a+this.x0,l.y=l.y*this.a+this.y0,s.x=l.x,s.y=l.y,s}function gg(s){var l={lam:0,phi:0},c,y,g,v,S,b,A,O,D,L={value:0};if(s.x=(s.x-this.x0)/this.a,s.y=(s.y-this.y0)/this.a,y=Math.atan(Math.sqrt(s.x*s.x+s.y*s.y)),c=Math.atan2(s.y,s.x),s.x>=0&&s.x>=Math.abs(s.y)?L.value=Be.AREA_0:s.y>=0&&s.y>=Math.abs(s.x)?(L.value=Be.AREA_1,c-=p):s.x<0&&-s.x>=Math.abs(s.y)?(L.value=Be.AREA_2,c=c<0?c+k:c-k):(L.value=Be.AREA_3,c+=p),D=k/12*Math.tan(c),S=Math.sin(D)/(Math.cos(D)-1/Math.sqrt(2)),b=Math.atan(S),g=Math.cos(c),v=Math.tan(y),A=1-g*g*v*v*(1-Math.cos(Math.atan(1/Math.cos(b)))),A<-1?A=-1:A>1&&(A=1),this.face===Xe.TOP)O=Math.acos(A),l.phi=p-O,L.value===Be.AREA_0?l.lam=b+p:L.value===Be.AREA_1?l.lam=b<0?b+k:b-k:L.value===Be.AREA_2?l.lam=b-p:l.lam=b;else if(this.face===Xe.BOTTOM)O=Math.acos(A),l.phi=O-p,L.value===Be.AREA_0?l.lam=-b+p:L.value===Be.AREA_1?l.lam=-b:L.value===Be.AREA_2?l.lam=-b-p:l.lam=b<0?-b-k:-b+k;else{var U,W,F;U=A,D=U*U,D>=1?F=0:F=Math.sqrt(1-D)*Math.sin(b),D+=F*F,D>=1?W=0:W=Math.sqrt(1-D),L.value===Be.AREA_1?(D=W,W=-F,F=D):L.value===Be.AREA_2?(W=-W,F=-F):L.value===Be.AREA_3&&(D=W,W=F,F=-D),this.face===Xe.RIGHT?(D=U,U=-W,W=D):this.face===Xe.BACK?(U=-U,W=-W):this.face===Xe.LEFT&&(D=U,U=W,W=-D),l.phi=Math.acos(-F)-p,l.lam=Math.atan2(W,U),this.face===Xe.RIGHT?l.lam=uo(l.lam,-p):this.face===Xe.BACK?l.lam=uo(l.lam,-k):this.face===Xe.LEFT&&(l.lam=uo(l.lam,+p))}if(this.es!==0){var G,K,ie;G=l.phi<0?1:0,K=Math.tan(l.phi),ie=this.b/Math.sqrt(K*K+this.one_minus_f_squared),l.phi=Math.atan(Math.sqrt(this.a*this.a-ie*ie)/(this.one_minus_f*ie)),G&&(l.phi=-l.phi)}return l.lam+=this.long0,s.x=l.lam,s.y=l.phi,s}function zl(s,l,c,y){var g;return s<w?(y.value=Be.AREA_0,g=0):(g=Math.atan2(l,c),Math.abs(g)<=C?y.value=Be.AREA_0:g>C&&g<=p+C?(y.value=Be.AREA_1,g-=p):g>p+C||g<=-(p+C)?(y.value=Be.AREA_2,g=g>=0?g-k:g+k):(y.value=Be.AREA_3,g+=p)),g}function uo(s,l){var c=s+l;return c<-k?c+=I:c>+k&&(c-=I),c}var yg=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],bg={init:mg,forward:pg,inverse:gg,names:yg},Wc=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-986701e-12],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,18736e-12],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,934959e-12],[.7986,-.00755338,-500009e-10,935324e-12],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],qa=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-126793e-14,422642e-15],[.124,.0124,507171e-14,-160604e-14],[.186,.0123999,-190189e-13,600152e-14],[.248,.0124002,710039e-13,-224e-10],[.31,.0123992,-264997e-12,835986e-13],[.372,.0124029,988983e-12,-311994e-12],[.434,.0123893,-369093e-11,-435621e-12],[.4958,.0123198,-102252e-10,-345523e-12],[.5571,.0121916,-154081e-10,-582288e-12],[.6176,.0119938,-241424e-10,-525327e-12],[.6769,.011713,-320223e-10,-516405e-12],[.7346,.0113541,-397684e-10,-609052e-12],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-140374e-14],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],Kd=.8487,Jd=1.3523,Zd=T/5,vg=1/Zd,ho=18,Ul=function(s,l){return s[0]+l*(s[1]+l*(s[2]+l*s[3]))},wg=function(s,l){return s[1]+l*(2*s[2]+l*3*s[3])};function _g(s,l,c,y){for(var g=l;y;--y){var v=s(g);if(g-=v,Math.abs(v)<c)break}return g}function xg(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function Sg(s){var l=Z(s.x-this.long0),c=Math.abs(s.y),y=Math.floor(c*Zd);y<0?y=0:y>=ho&&(y=ho-1),c=T*(c-vg*y);var g={x:Ul(Wc[y],c)*l,y:Ul(qa[y],c)};return s.y<0&&(g.y=-g.y),g.x=g.x*this.a*Kd+this.x0,g.y=g.y*this.a*Jd+this.y0,g}function Mg(s){var l={x:(s.x-this.x0)/(this.a*Kd),y:Math.abs(s.y-this.y0)/(this.a*Jd)};if(l.y>=1)l.x/=Wc[ho][0],l.y=s.y<0?-p:p;else{var c=Math.floor(l.y*ho);for(c<0?c=0:c>=ho&&(c=ho-1);;)if(qa[c][0]>l.y)--c;else if(qa[c+1][0]<=l.y)++c;else break;var y=qa[c],g=5*(l.y-y[0])/(qa[c+1][0]-y[0]);g=_g(function(v){return(Ul(y,v)-l.y)/wg(y,v)},g,w,100),l.x/=Ul(Wc[c],g),l.y=(5*c+g)*E,s.y<0&&(l.y=-l.y)}return l.x=Z(l.x+this.long0),l}var Eg=["Robinson","robin"],Rg={init:xg,forward:Sg,inverse:Mg,names:Eg};function Cg(){this.name="geocent"}function Ag(s){var l=Ma(s,this.es,this.a);return l}function Tg(s){var l=kn(s,this.es,this.a,this.b);return l}var Ig=["Geocentric","geocentric","geocent","Geocent"],Pg={init:Cg,forward:Ag,inverse:Tg,names:Ig},xt={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},Fa={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};function Og(){if(Object.keys(Fa).forEach(function(c){if(typeof this[c]>"u")this[c]=Fa[c].def;else{if(Fa[c].num&&isNaN(this[c]))throw new Error("Invalid parameter value, must be numeric "+c+" = "+this[c]);Fa[c].num&&(this[c]=parseFloat(this[c]))}Fa[c].degrees&&(this[c]=this[c]*E)}.bind(this)),Math.abs(Math.abs(this.lat0)-p)<w?this.mode=this.lat0<0?xt.S_POLE:xt.N_POLE:Math.abs(this.lat0)<w?this.mode=xt.EQUIT:(this.mode=xt.OBLIQ,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw new Error("Invalid height");this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var s=this.tilt,l=this.azi;this.cg=Math.cos(l),this.sg=Math.sin(l),this.cw=Math.cos(s),this.sw=Math.sin(s)}function kg(s){s.x-=this.long0;var l=Math.sin(s.y),c=Math.cos(s.y),y=Math.cos(s.x),g,v;switch(this.mode){case xt.OBLIQ:v=this.sinph0*l+this.cosph0*c*y;break;case xt.EQUIT:v=c*y;break;case xt.S_POLE:v=-l;break;case xt.N_POLE:v=l;break}switch(v=this.pn1/(this.p-v),g=v*c*Math.sin(s.x),this.mode){case xt.OBLIQ:v*=this.cosph0*l-this.sinph0*c*y;break;case xt.EQUIT:v*=l;break;case xt.N_POLE:v*=-(c*y);break;case xt.S_POLE:v*=c*y;break}var S,b;return S=v*this.cg+g*this.sg,b=1/(S*this.sw*this.h1+this.cw),g=(g*this.cg-v*this.sg)*this.cw*b,v=S*b,s.x=g*this.a,s.y=v*this.a,s}function Lg(s){s.x/=this.a,s.y/=this.a;var l={x:s.x,y:s.y},c,y,g;g=1/(this.pn1-s.y*this.sw),c=this.pn1*s.x*g,y=this.pn1*s.y*this.cw*g,s.x=c*this.cg+y*this.sg,s.y=y*this.cg-c*this.sg;var v=er(s.x,s.y);if(Math.abs(v)<w)l.x=0,l.y=s.y;else{var S,b;switch(b=1-v*v*this.pfact,b=(this.p-Math.sqrt(b))/(this.pn1/v+v/this.pn1),S=Math.sqrt(1-b*b),this.mode){case xt.OBLIQ:l.y=Math.asin(S*this.sinph0+s.y*b*this.cosph0/v),s.y=(S-this.sinph0*Math.sin(l.y))*v,s.x*=b*this.cosph0;break;case xt.EQUIT:l.y=Math.asin(s.y*b/v),s.y=S*v,s.x*=b;break;case xt.N_POLE:l.y=Math.asin(S),s.y=-s.y;break;case xt.S_POLE:l.y=-Math.asin(S);break}l.x=Math.atan2(s.x,s.y)}return s.x=l.x+this.long0,s.y=l.y,s}var Ng=["Tilted_Perspective","tpers"],Bg={init:Og,forward:kg,inverse:Lg,names:Ng};function Dg(){if(this.flip_axis=this.sweep==="x"?1:0,this.h=Number(this.h),this.radius_g_1=this.h/this.a,this.radius_g_1<=0||this.radius_g_1>1e10)throw new Error;if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,this.es!==0){var s=1-this.es,l=1/s;this.radius_p=Math.sqrt(s),this.radius_p2=s,this.radius_p_inv2=l,this.shape="ellipse"}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape="sphere";this.title||(this.title="Geostationary Satellite View")}function zg(s){var l=s.x,c=s.y,y,g,v,S;if(l=l-this.long0,this.shape==="ellipse"){c=Math.atan(this.radius_p2*Math.tan(c));var b=this.radius_p/er(this.radius_p*Math.cos(c),Math.sin(c));if(g=b*Math.cos(l)*Math.cos(c),v=b*Math.sin(l)*Math.cos(c),S=b*Math.sin(c),(this.radius_g-g)*g-v*v-S*S*this.radius_p_inv2<0)return s.x=Number.NaN,s.y=Number.NaN,s;y=this.radius_g-g,this.flip_axis?(s.x=this.radius_g_1*Math.atan(v/er(S,y)),s.y=this.radius_g_1*Math.atan(S/y)):(s.x=this.radius_g_1*Math.atan(v/y),s.y=this.radius_g_1*Math.atan(S/er(v,y)))}else this.shape==="sphere"&&(y=Math.cos(c),g=Math.cos(l)*y,v=Math.sin(l)*y,S=Math.sin(c),y=this.radius_g-g,this.flip_axis?(s.x=this.radius_g_1*Math.atan(v/er(S,y)),s.y=this.radius_g_1*Math.atan(S/y)):(s.x=this.radius_g_1*Math.atan(v/y),s.y=this.radius_g_1*Math.atan(S/er(v,y))));return s.x=s.x*this.a,s.y=s.y*this.a,s}function Ug(s){var l=-1,c=0,y=0,g,v,S,b;if(s.x=s.x/this.a,s.y=s.y/this.a,this.shape==="ellipse"){this.flip_axis?(y=Math.tan(s.y/this.radius_g_1),c=Math.tan(s.x/this.radius_g_1)*er(1,y)):(c=Math.tan(s.x/this.radius_g_1),y=Math.tan(s.y/this.radius_g_1)*er(1,c));var A=y/this.radius_p;if(g=c*c+A*A+l*l,v=2*this.radius_g*l,S=v*v-4*g*this.C,S<0)return s.x=Number.NaN,s.y=Number.NaN,s;b=(-v-Math.sqrt(S))/(2*g),l=this.radius_g+b*l,c*=b,y*=b,s.x=Math.atan2(c,l),s.y=Math.atan(y*Math.cos(s.x)/l),s.y=Math.atan(this.radius_p_inv2*Math.tan(s.y))}else if(this.shape==="sphere"){if(this.flip_axis?(y=Math.tan(s.y/this.radius_g_1),c=Math.tan(s.x/this.radius_g_1)*Math.sqrt(1+y*y)):(c=Math.tan(s.x/this.radius_g_1),y=Math.tan(s.y/this.radius_g_1)*Math.sqrt(1+c*c)),g=c*c+y*y+l*l,v=2*this.radius_g*l,S=v*v-4*g*this.C,S<0)return s.x=Number.NaN,s.y=Number.NaN,s;b=(-v-Math.sqrt(S))/(2*g),l=this.radius_g+b*l,c*=b,y*=b,s.x=Math.atan2(c,l),s.y=Math.atan(y*Math.cos(s.x)/l)}return s.x=s.x+this.long0,s}var jg=["Geostationary Satellite View","Geostationary_Satellite","geos"],$g={init:Dg,forward:zg,inverse:Ug,names:jg},qg=function(s){s.Proj.projections.add(Ws),s.Proj.projections.add(Bn),s.Proj.projections.add(yc),s.Proj.projections.add(gl),s.Proj.projections.add(_c),s.Proj.projections.add(Mc),s.Proj.projections.add(jn),s.Proj.projections.add(Xi),s.Proj.projections.add(Ac),s.Proj.projections.add(Vr),s.Proj.projections.add(Pl),s.Proj.projections.add(Ol),s.Proj.projections.add(ao),s.Proj.projections.add(Nl),s.Proj.projections.add(Fc),s.Proj.projections.add(P),s.Proj.projections.add(ce),s.Proj.projections.add(rr),s.Proj.projections.add($t),s.Proj.projections.add(Pt),s.Proj.projections.add(Dl),s.Proj.projections.add(ig),s.Proj.projections.add(lg),s.Proj.projections.add(dg),s.Proj.projections.add(bg),s.Proj.projections.add(Rg),s.Proj.projections.add(Pg),s.Proj.projections.add(Bg),s.Proj.projections.add($g)};return It.defaultDatum="WGS84",It.Proj=cr,It.WGS84=new It.Proj("WGS84"),It.Point=Or,It.toPoint=Nn,It.defs=ft,It.nadgrid=yi,It.transform=qi,It.mgrs=Us,It.version="2.8.0",qg(It),It})});var R1=V((XI,y6)=>{y6.exports={ROOT:0,GROUP:1,POSITION:2,SET:3,RANGE:4,REPETITION:5,REFERENCE:6,CHAR:7}});var rd=V(En=>{var ze=R1(),td=()=>[{type:ze.RANGE,from:48,to:57}],b6=()=>[{type:ze.CHAR,value:95},{type:ze.RANGE,from:97,to:122},{type:ze.RANGE,from:65,to:90}].concat(td()),v6=()=>[{type:ze.CHAR,value:9},{type:ze.CHAR,value:10},{type:ze.CHAR,value:11},{type:ze.CHAR,value:12},{type:ze.CHAR,value:13},{type:ze.CHAR,value:32},{type:ze.CHAR,value:160},{type:ze.CHAR,value:5760},{type:ze.RANGE,from:8192,to:8202},{type:ze.CHAR,value:8232},{type:ze.CHAR,value:8233},{type:ze.CHAR,value:8239},{type:ze.CHAR,value:8287},{type:ze.CHAR,value:12288},{type:ze.CHAR,value:65279}],Dx=()=>[{type:ze.CHAR,value:10},{type:ze.CHAR,value:13},{type:ze.CHAR,value:8232},{type:ze.CHAR,value:8233}];En.words=()=>({type:ze.SET,set:b6(),not:!1});En.notWords=()=>({type:ze.SET,set:b6(),not:!0});En.ints=()=>({type:ze.SET,set:td(),not:!1});En.notInts=()=>({type:ze.SET,set:td(),not:!0});En.whitespace=()=>({type:ze.SET,set:v6(),not:!1});En.notWhitespace=()=>({type:ze.SET,set:v6(),not:!0});En.anyChar=()=>({type:ze.SET,set:Dx(),not:!0})});var _6=V(C1=>{var w6=R1(),ta=rd(),zx="@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?",Ux={"0":0,t:9,n:10,v:11,f:12,r:13};C1.strToChars=function(t){var e=/(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|(0?[0-7]{2})|c([@A-Z[\\\]^?])|([0tnvfr]))/g;return t=t.replace(e,function(r,i,n,o,a,h,d,m){if(n)return r;var p=i?8:o?parseInt(o,16):a?parseInt(a,16):h?parseInt(h,8):d?zx.indexOf(d):Ux[m],M=String.fromCharCode(p);return/[[\]{}^$.|?*+()]/.test(M)&&(M="\\"+M),M}),t};C1.tokenizeClass=(t,e)=>{for(var r=[],i=/\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(?:\\)?([^\]]))|(\])|(?:\\)?([^])/g,n,o;(n=i.exec(t))!=null;)if(n[1])r.push(ta.words());else if(n[2])r.push(ta.ints());else if(n[3])r.push(ta.whitespace());else if(n[4])r.push(ta.notWords());else if(n[5])r.push(ta.notInts());else if(n[6])r.push(ta.notWhitespace());else if(n[7])r.push({type:w6.RANGE,from:(n[8]||n[9]).charCodeAt(0),to:n[10].charCodeAt(0)});else if(o=n[12])r.push({type:w6.CHAR,value:o.charCodeAt(0)});else return[r,i.lastIndex];C1.error(e,"Unterminated character class")};C1.error=(t,e)=>{throw new SyntaxError("Invalid regular expression: /"+t+"/: "+e)}});var x6=V(A1=>{var Qu=R1();A1.wordBoundary=()=>({type:Qu.POSITION,value:"b"});A1.nonWordBoundary=()=>({type:Qu.POSITION,value:"B"});A1.begin=()=>({type:Qu.POSITION,value:"^"});A1.end=()=>({type:Qu.POSITION,value:"$"})});var S6=V((rP,id)=>{var ra=_6(),Rr=R1(),_s=rd(),eh=x6();id.exports=t=>{var e=0,r,i,n={type:Rr.ROOT,stack:[]},o=n,a=n.stack,h=[],d=C=>{ra.error(t,`Nothing to repeat at column ${C-1}`)},m=ra.strToChars(t);for(r=m.length;e<r;)switch(i=m[e++],i){case"\\":switch(i=m[e++],i){case"b":a.push(eh.wordBoundary());break;case"B":a.push(eh.nonWordBoundary());break;case"w":a.push(_s.words());break;case"W":a.push(_s.notWords());break;case"d":a.push(_s.ints());break;case"D":a.push(_s.notInts());break;case"s":a.push(_s.whitespace());break;case"S":a.push(_s.notWhitespace());break;default:/\d/.test(i)?a.push({type:Rr.REFERENCE,value:parseInt(i,10)}):a.push({type:Rr.CHAR,value:i.charCodeAt(0)})}break;case"^":a.push(eh.begin());break;case"$":a.push(eh.end());break;case"[":var p;m[e]==="^"?(p=!0,e++):p=!1;var M=ra.tokenizeClass(m.slice(e),t);e+=M[1],a.push({type:Rr.SET,set:M[0],not:p});break;case".":a.push(_s.anyChar());break;case"(":var R={type:Rr.GROUP,stack:[],remember:!0};i=m[e],i==="?"&&(i=m[e+1],e+=2,i==="="?R.followedBy=!0:i==="!"?R.notFollowedBy=!0:i!==":"&&ra.error(t,`Invalid group, character '${i}' after '?' at column ${e-1}`),R.remember=!1),a.push(R),h.push(o),o=R,a=R.stack;break;case")":h.length===0&&ra.error(t,`Unmatched ) at column ${e-1}`),o=h.pop(),a=o.options?o.options[o.options.length-1]:o.stack;break;case"|":o.options||(o.options=[o.stack],delete o.stack);var x=[];o.options.push(x),a=x;break;case"{":var w=/^(\d+)(,(\d+)?)?\}/.exec(m.slice(e)),E,T;w!==null?(a.length===0&&d(e),E=parseInt(w[1],10),T=w[2]?w[3]?parseInt(w[3],10):1/0:E,e+=w[0].length,a.push({type:Rr.REPETITION,min:E,max:T,value:a.pop()})):a.push({type:Rr.CHAR,value:123});break;case"?":a.length===0&&d(e),a.push({type:Rr.REPETITION,min:0,max:1,value:a.pop()});break;case"+":a.length===0&&d(e),a.push({type:Rr.REPETITION,min:1,max:1/0,value:a.pop()});break;case"*":a.length===0&&d(e),a.push({type:Rr.REPETITION,min:0,max:1/0,value:a.pop()});break;default:a.push({type:Rr.CHAR,value:i.charCodeAt(0)})}return h.length!==0&&ra.error(t,"Unterminated group"),n};id.exports.types=Rr});var R6=V((iP,E6)=>{"use strict";var M6=S6(),jx=M6.types;E6.exports=function(t,e){e||(e={});var r=e.limit===void 0?25:e.limit;$x(t)?t=t.source:typeof t!="string"&&(t=String(t));try{t=M6(t)}catch{return!1}var i=0;return function n(o,a){var h,d,m;if(o.type===jx.REPETITION&&(a++,i++,a>1||i>r))return!1;if(o.options){for(h=0,m=o.options.length;h<m;h++)if(d=n({stack:o.options[h]},a),!d)return!1}var p=o.stack||o.value&&o.value.stack;if(!p)return!0;for(h=0;h<p.length;h++)if(d=n(p[h],a),!d)return!1;return!0}(t,0)};function $x(t){return{}.toString.call(t)==="[object RegExp]"}});var A6=V((nP,C6)=>{"use strict";C6.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var i,n,o;if(Array.isArray(e)){if(i=e.length,i!=r.length)return!1;for(n=i;n--!==0;)if(!t(e[n],r[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(o=Object.keys(e),i=o.length,i!==Object.keys(r).length)return!1;for(n=i;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[n]))return!1;for(n=i;n--!==0;){var a=o[n];if(!t(e[a],r[a]))return!1}return!0}return e!==e&&r!==r}});var D6=V((sP,B6)=>{"use strict";var ia=" ",na="\u2502 ",T6="\u251C\u2500\u2500 ",I6="\u2514\u2500\u2500 ",P6="*",T1="/",O6=/(?=\/)/;function qx(t){let e=t.name||"";return e=e.replace("bound","").trim(),e=(e||"anonymous")+"()",e}function k6(t){return Array.isArray(t)?t.map(e=>k6(e)):typeof t=="symbol"?t.toString():typeof t=="function"?qx(t):t}function nd(t,e){let r={},i=this.buildPrettyMeta(t);return Array.isArray(e)||(e=i?Reflect.ownKeys(i):[]),e.forEach(n=>{let o=typeof n=="symbol"?n.toString():n;i&&i[n]&&(r[o]=k6(i[n]))}),r}function Fx(t,e={}){if(!this.buildPrettyMeta)throw new Error("buildPrettyMeta not defined");e.includeMeta=e.includeMeta||null;let r=[],i="";t.sort((o,a)=>!o.path||!a.path?0:o.path.localeCompare(a.path));for(let o=0;o<t.length;o++){let a=t[o],h=r.find(m=>a.path===m.path);if(h){h.handlers.push({method:a.method,opts:a.opts.constraints||void 0,meta:e.includeMeta?nd.call(this,a,e.includeMeta):null});continue}let d={method:a.method,opts:a.opts.constraints||void 0,meta:e.includeMeta?nd.call(this,a,e.includeMeta):null};r.push({path:a.path,methods:[a.method],opts:[a.opts],handlers:[d]})}if(!r.filter(o=>o.path===T1).length){let o={path:T1,truncatedPath:"",methods:[],opts:[],handlers:[{}]};r.filter(a=>a.path===P6).length?r.splice(1,0,o):r.unshift(o)}let n=Wx(r);return n.forEach((o,a)=>{i+=L6(o,null,a===n.length-1,!1,!0),i+=`
111
+ `}),i}function Wx(t,e){e=e||T1;let r=[],i={result:r};return t.forEach((n,o)=>{let a=n.path.split(O6);a[0]!==T1&&a[0]!==P6&&(a=[T1,a[0].slice(1),...a.slice(1)]),a.reduce((h,d,m)=>{if(!h[d]){h[d]={result:[]};let p={path:d,children:h[d].result};m===a.length-1&&(p.handlers=n.handlers),h.result.push(p)}return h[d]},i)}),r}function L6(t,e,r,i,n){let o="";if(!i&&!n&&(o+=`
112
+ `),i||(o+=`${e||""}${r?I6:T6}`),o+=`${t.path}`,t.handlers){let a=t.handlers.reduce((h,d)=>{let m=h.findIndex(p=>JSON.stringify(p.opts)===JSON.stringify(d.opts));return m!==-1?h[m].method=[h[m].method,d.method].join(", "):h.push(d),h},[]);a.forEach((h,d)=>{d>0&&(o+=`${i?"":e||""}${r?ia:na}${t.path}`),o+=` (${h.method||"-"})`,h.opts&&JSON.stringify(h.opts)!=="{}"&&(o+=` ${JSON.stringify(h.opts)}`),h.meta&&Reflect.ownKeys(h.meta).forEach((m,p)=>{o+=`
113
113
  ${i?"":e||""}${r?ia:na}`,o+=`\u2022 (${m}) ${JSON.stringify(h.meta[m])}`}),a.length>1&&d!==a.length-1&&(o+=`
114
- `)})}else t.children.length>1&&(o+=" (-)");return i||(e=`${e||""}${r?ia:na}`),t.children.forEach((a,h)=>{let d=h===t.children.length-1,m=!t.handlers&&t.children.length===1;o+=O6(a,e,d,m)}),o}function k6(t,e,r,i){if(!this.buildPrettyMeta)throw new Error("buildPrettyMeta not defined");i.includeMeta=i.includeMeta||null;let n="",o=[];for(let{node:d,method:m}of t.nodes)for(let p of d.handlerStorage.handlers)o.push({method:m,...p});o.length?o.forEach((d,m)=>{let p=`(${d.method||"-"})`;Object.keys(d.constraints).length>0&&(p+=" "+JSON.stringify(d.constraints));let M="",R=t.prefix.split("").map((x,w)=>x===":"?w:null).filter(x=>x!==null);if(R.length){let x=0;R.forEach((w,E)=>{M+=t.prefix.slice(x,w+1),M+=d.params[d.params.length-R.length+E],E===R.length-1&&(M+=t.prefix.slice(w+1)),x=w+1})}else M=t.prefix;if(m===0?n+=`${M} ${p}`:n+=`
115
- ${e}${r?ia:na}${M} ${p}`,i.includeMeta){let x=id.call(this,d,i.includeMeta);Object.keys(x).forEach((w,E)=>{n+=`
116
- ${e||""}${r?ia:na}`,n+=`\u2022 (${w}) ${JSON.stringify(x[w])}`})}}):n=t.prefix;let a=`${e}${r?A6:C6}${n}
117
- `;e=`${e}${r?ia:na}`;let h=Object.keys(t.children);for(let d=0;d<h.length;d++){let m=t.children[h[d]];a+=k6.call(this,m,e,d===h.length-1,i)}return a}function th(t,e,r){if(e.handlerStorage.handlers.length!==0&&t.nodes.push({method:r,node:e}),e.parametricChildren&&e.parametricChildren[0]&&(t.children[":"]||(t.children[":"]={prefix:":",nodes:[],children:{}}),th(t.children[":"],e.parametricChildren[0],r)),e.wildcardChild&&(t.children["*"]||(t.children["*"]={prefix:"*",nodes:[],children:{}}),th(t.children["*"],e.wildcardChild,r)),e.staticChildren)for(let i of Object.values(e.staticChildren)){let n=i.prefix.split(I6),o=t,a;for(let h of n)a=o,o=o.children[h],o||(o={prefix:h,nodes:[],children:{}},a.children[h]=o);th(o,i,r)}}function nd(t){let e=Object.keys(t.children);if(t.nodes.length===0&&e.length===1){let r=t.children[e[0]];if(r.nodes.length<=1)return nd(r),t.nodes=r.nodes,t.prefix+=r.prefix,t.children=r.children,t}for(let r of Object.keys(t.children))nd(t.children[r]);return t}L6.exports={flattenNode:th,compressFlattenedNode:nd,prettyPrintFlattenedNode:k6,prettyPrintRoutesArray:jx}});var D6=V((aP,B6)=>{"use strict";var sd=class{constructor(){this.unconstrainedHandler=null,this.constraints=[],this.handlers=[],this.constrainedHandlerStores=null}getMatchingHandler(e){return e===void 0?this.unconstrainedHandler:this._getHandlerMatchingConstraints(e)}addHandler(e,r,i,n,o){let a={handler:e,params:r,constraints:o,store:i||null,_createParamsObject:this._compileCreateParamsObject(r)};Object.keys(o).length===0&&(this.unconstrainedHandler=a);for(let h of Object.keys(o))this.constraints.includes(h)||(h==="version"?this.constraints.unshift(h):this.constraints.push(h));if(this.handlers.length>=32)throw new Error("find-my-way supports a maximum of 32 route handlers per node when there are constraints, limit reached");this.handlers.push(a),this.handlers.sort((h,d)=>Object.keys(h.constraints).length-Object.keys(d.constraints).length),this._compileGetHandlerMatchingConstraints(n,o)}_compileCreateParamsObject(e){let r=[];for(let i=0;i<e.length;i++)r.push(`'${e[i]}': paramsArray[${i}]`);return new Function("paramsArray",`return {${r.join(",")}}`)}_getHandlerMatchingConstraints(){return null}_buildConstraintStore(e,r){for(let i=0;i<this.handlers.length;i++){let o=this.handlers[i].constraints[r];if(o!==void 0){let a=e.get(o)||0;a|=1<<i,e.set(o,a)}}}_constrainedIndexBitmask(e){let r=0;for(let i=0;i<this.handlers.length;i++)this.handlers[i].constraints[e]!==void 0&&(r|=1<<i);return~r}_compileGetHandlerMatchingConstraints(e){this.constrainedHandlerStores={};for(let i of this.constraints){let n=e.newStoreForConstraint(i);this.constrainedHandlerStores[i]=n,this._buildConstraintStore(n,i)}let r=[];r.push(`
114
+ `)})}else t.children.length>1&&(o+=" (-)");return i||(e=`${e||""}${r?ia:na}`),t.children.forEach((a,h)=>{let d=h===t.children.length-1,m=!t.handlers&&t.children.length===1;o+=L6(a,e,d,m)}),o}function N6(t,e,r,i){if(!this.buildPrettyMeta)throw new Error("buildPrettyMeta not defined");i.includeMeta=i.includeMeta||null;let n="",o=[];for(let{node:d,method:m}of t.nodes)for(let p of d.handlerStorage.handlers)o.push({method:m,...p});o.length?o.forEach((d,m)=>{let p=`(${d.method||"-"})`;Object.keys(d.constraints).length>0&&(p+=" "+JSON.stringify(d.constraints));let M="",R=t.prefix.split("").map((x,w)=>x===":"?w:null).filter(x=>x!==null);if(R.length){let x=0;R.forEach((w,E)=>{M+=t.prefix.slice(x,w+1),M+=d.params[d.params.length-R.length+E],E===R.length-1&&(M+=t.prefix.slice(w+1)),x=w+1})}else M=t.prefix;if(m===0?n+=`${M} ${p}`:n+=`
115
+ ${e}${r?ia:na}${M} ${p}`,i.includeMeta){let x=nd.call(this,d,i.includeMeta);Object.keys(x).forEach((w,E)=>{n+=`
116
+ ${e||""}${r?ia:na}`,n+=`\u2022 (${w}) ${JSON.stringify(x[w])}`})}}):n=t.prefix;let a=`${e}${r?I6:T6}${n}
117
+ `;e=`${e}${r?ia:na}`;let h=Object.keys(t.children);for(let d=0;d<h.length;d++){let m=t.children[h[d]];a+=N6.call(this,m,e,d===h.length-1,i)}return a}function th(t,e,r){if(e.handlerStorage.handlers.length!==0&&t.nodes.push({method:r,node:e}),e.parametricChildren&&e.parametricChildren[0]&&(t.children[":"]||(t.children[":"]={prefix:":",nodes:[],children:{}}),th(t.children[":"],e.parametricChildren[0],r)),e.wildcardChild&&(t.children["*"]||(t.children["*"]={prefix:"*",nodes:[],children:{}}),th(t.children["*"],e.wildcardChild,r)),e.staticChildren)for(let i of Object.values(e.staticChildren)){let n=i.prefix.split(O6),o=t,a;for(let h of n)a=o,o=o.children[h],o||(o={prefix:h,nodes:[],children:{}},a.children[h]=o);th(o,i,r)}}function sd(t){let e=Object.keys(t.children);if(t.nodes.length===0&&e.length===1){let r=t.children[e[0]];if(r.nodes.length<=1)return sd(r),t.nodes=r.nodes,t.prefix+=r.prefix,t.children=r.children,t}for(let r of Object.keys(t.children))sd(t.children[r]);return t}B6.exports={flattenNode:th,compressFlattenedNode:sd,prettyPrintFlattenedNode:N6,prettyPrintRoutesArray:Fx}});var U6=V((oP,z6)=>{"use strict";var od=class{constructor(){this.unconstrainedHandler=null,this.constraints=[],this.handlers=[],this.constrainedHandlerStores=null}getMatchingHandler(e){return e===void 0?this.unconstrainedHandler:this._getHandlerMatchingConstraints(e)}addHandler(e,r,i,n,o){let a={handler:e,params:r,constraints:o,store:i||null,_createParamsObject:this._compileCreateParamsObject(r)};Object.keys(o).length===0&&(this.unconstrainedHandler=a);for(let h of Object.keys(o))this.constraints.includes(h)||(h==="version"?this.constraints.unshift(h):this.constraints.push(h));if(this.handlers.length>=32)throw new Error("find-my-way supports a maximum of 32 route handlers per node when there are constraints, limit reached");this.handlers.push(a),this.handlers.sort((h,d)=>Object.keys(h.constraints).length-Object.keys(d.constraints).length),this._compileGetHandlerMatchingConstraints(n,o)}_compileCreateParamsObject(e){let r=[];for(let i=0;i<e.length;i++)r.push(`'${e[i]}': paramsArray[${i}]`);return new Function("paramsArray",`return {${r.join(",")}}`)}_getHandlerMatchingConstraints(){return null}_buildConstraintStore(e,r){for(let i=0;i<this.handlers.length;i++){let o=this.handlers[i].constraints[r];if(o!==void 0){let a=e.get(o)||0;a|=1<<i,e.set(o,a)}}}_constrainedIndexBitmask(e){let r=0;for(let i=0;i<this.handlers.length;i++)this.handlers[i].constraints[e]!==void 0&&(r|=1<<i);return~r}_compileGetHandlerMatchingConstraints(e){this.constrainedHandlerStores={};for(let i of this.constraints){let n=e.newStoreForConstraint(i);this.constrainedHandlerStores[i]=n,this._buildConstraintStore(n,i)}let r=[];r.push(`
118
118
  let candidates = ${(1<<this.handlers.length)-1}
119
119
  let mask, matches
120
120
  `);for(let i of this.constraints){r.push(`
@@ -129,16 +129,16 @@ ${e||""}${r?ia:na}`,n+=`\u2022 (${w}) ${JSON.stringify(x[w])}`})}}):n=t.prefix;l
129
129
  }
130
130
  if (candidates === 0) return null;
131
131
  `)}for(let i in e.strategies)e.strategies[i].mustMatchWhenDerived&&!this.constraints.includes(i)&&r.push(`if (derivedConstraints.${i} !== undefined) return null`);r.push("return this.handlers[Math.floor(Math.log2(candidates))]"),this._getHandlerMatchingConstraints=new Function("derivedConstraints",r.join(`
132
- `))}};B6.exports=sd});var U6=V((lP,z6)=>{"use strict";var qx=D6(),oh={STATIC:0,PARAMETRIC:1,WILDCARD:2},rh=class{constructor(){this.handlerStorage=new qx}},ih=class extends rh{constructor(){super(),this.staticChildren={}}findStaticMatchingChild(e,r){let i=this.staticChildren[e.charAt(r)];return i===void 0||!i.matchPrefix(e,r)?null:i}createStaticChild(e){if(e.length===0)return this;let r=this.staticChildren[e.charAt(0)];if(r){let n=1;for(;n<r.prefix.length;n++)if(e.charCodeAt(n)!==r.prefix.charCodeAt(n)){r=r.split(this,n);break}return r.createStaticChild(e.slice(n))}let i=e.charAt(0);return this.staticChildren[i]=new sa(e),this.staticChildren[i]}},sa=class extends ih{constructor(e){super(),this.prefix=e,this.wildcardChild=null,this.parametricChildren=[],this.kind=oh.STATIC,this._compilePrefixMatch()}createParametricChild(e){let r=e&&e.source,i=this.parametricChildren.find(n=>(n.regex&&n.regex.source)===r);return i||(i=new nh(e),e?this.parametricChildren.unshift(i):this.parametricChildren.push(i),i)}createWildcardChild(){return this.wildcardChild?this.wildcardChild:(this.wildcardChild=new sh,this.wildcardChild)}split(e,r){let i=this.prefix.slice(0,r),n=this.prefix.slice(r);this.prefix=n,this._compilePrefixMatch();let o=new sa(i);return o.staticChildren[n.charAt(0)]=this,e.staticChildren[i.charAt(0)]=o,o}getNextNode(e,r,i,n){let o=this.findStaticMatchingChild(e,r),a=0;if(o===null){if(this.parametricChildren.length===0)return this.wildcardChild;o=this.parametricChildren[0],a=1}this.wildcardChild!==null&&i.push({paramsCount:n,brotherPathIndex:r,brotherNode:this.wildcardChild});for(let h=this.parametricChildren.length-1;h>=a;h--)i.push({paramsCount:n,brotherPathIndex:r,brotherNode:this.parametricChildren[h]});return o}_compilePrefixMatch(){if(this.prefix.length===1){this.matchPrefix=()=>!0;return}let e=[];for(let r=1;r<this.prefix.length;r++){let i=this.prefix.charCodeAt(r);e.push(`path.charCodeAt(i + ${r}) === ${i}`)}this.matchPrefix=new Function("path","i",`return ${e.join(" && ")}`)}},nh=class extends ih{constructor(e){super(),this.regex=e||null,this.isRegex=!!e,this.kind=oh.PARAMETRIC}getNextNode(e,r){return this.findStaticMatchingChild(e,r)}},sh=class extends rh{constructor(){super(),this.kind=oh.WILDCARD}getNextNode(){return null}};z6.exports={StaticNode:sa,ParametricNode:nh,WildcardNode:sh,NODE_TYPES:oh}});var $6=V((uP,j6)=>{"use strict";var Fx=require("assert");function I1(){if(!(this instanceof I1))return new I1;this.store={},this.maxMajor=0,this.maxMinors={},this.maxPatches={}}I1.prototype.set=function(t,e){if(typeof t!="string")throw new TypeError("Version should be a string");let[r,i,n]=t.split(".");return r=Number(r)||0,i=Number(i)||0,n=Number(n)||0,r>=this.maxMajor&&(this.maxMajor=r,this.store.x=e,this.store["*"]=e,this.store["x.x"]=e,this.store["x.x.x"]=e),i>=(this.maxMinors[r]||0)&&(this.maxMinors[r]=i,this.store[`${r}.x`]=e,this.store[`${r}.x.x`]=e),n>=(this.store[`${r}.${i}`]||0)&&(this.maxPatches[`${r}.${i}`]=n,this.store[`${r}.${i}.x`]=e),this.store[`${r}.${i}.${n}`]=e,this};I1.prototype.get=function(t){return this.store[t]};j6.exports={name:"version",mustMatchWhenDerived:!0,storage:I1,validate(t){Fx(typeof t=="string","Version should be a string")}}});var F6=V((hP,q6)=>{"use strict";var Wx=require("assert");function Hx(){let t={},e=[];return{get:r=>{let i=t[r];if(i)return i;for(let n of e)if(n.host.test(r))return n.value},set:(r,i)=>{r instanceof RegExp?e.push({host:r,value:i}):t[r]=i}}}q6.exports={name:"host",mustMatchWhenDerived:!1,storage:Hx,validate(t){Wx(typeof t=="string"||Object.prototype.toString.call(t)==="[object RegExp]","Host should be a string or a RegExp")}}});var H6=V((cP,W6)=>{"use strict";var Gx=$6(),Vx=F6(),od=require("assert"),ad=class{constructor(e){if(this.strategies={version:Gx,host:Vx},this.strategiesInUse=new Set,e)for(let r of Object.values(e))this.addConstraintStrategy(r)}hasConstraintStrategy(e){let r=this.strategies[e];return r!==void 0?r.isCustom||this.strategiesInUse.has(e):!1}addConstraintStrategy(e){if(od(typeof e.name=="string"&&e.name!=="","strategy.name is required."),od(e.storage&&typeof e.storage=="function","strategy.storage function is required."),od(e.deriveConstraint&&typeof e.deriveConstraint=="function","strategy.deriveConstraint function is required."),this.strategies[e.name]&&this.strategies[e.name].isCustom)throw new Error(`There already exists a custom constraint with the name ${e.name}.`);if(this.strategiesInUse.has(e.name))throw new Error(`There already exists a route with ${e.name} constraint.`);e.isCustom=!0,this.strategies[e.name]=e,e.mustMatchWhenDerived&&this.noteUsage({[e.name]:e})}deriveConstraints(e,r){}noteUsage(e){if(e){let r=this.strategiesInUse.size;for(let i in e)this.strategiesInUse.add(i);r!==this.strategiesInUse.size&&this._buildDeriveConstraints()}}newStoreForConstraint(e){if(!this.strategies[e])throw new Error(`No strategy registered for constraint key ${e}`);return this.strategies[e].storage()}validateConstraints(e){for(let r in e){let i=e[r];if(typeof i>"u")throw new Error("Can't pass an undefined constraint value, must pass null or no key at all");let n=this.strategies[r];if(!n)throw new Error(`No strategy registered for constraint key ${r}`);n.validate&&n.validate(i)}}_buildDeriveConstraints(){if(this.strategiesInUse.size===0)return;let e=["return {"];for(let r of this.strategiesInUse){let i=this.strategies[r];if(i.isCustom)e.push(` ${i.name}: this.strategies.${r}.deriveConstraint(req, ctx),`);else if(r==="version")e.push(" version: req.headers['accept-version'],");else if(r==="host")e.push(" host: req.headers.host || req.headers[':authority'],");else throw new Error("unknown non-custom strategy for compiling constraint derivation function")}e.push("}"),this.deriveConstraints=new Function("req","ctx",e.join(`
133
- `)).bind(this)}};W6.exports=ad});var K6=V((fP,V6)=>{"use strict";function G6(t,e){return t===50?e===53?"%":e===51?"#":e===52?"$":e===54?"&":e===66||e===98?"+":e===67||e===99?",":e===70||e===102?"/":null:t===51?e===65||e===97?":":e===66||e===98?";":e===68||e===100?"=":e===70||e===102?"?":null:t===52&&e===48?"@":null}function Kx(t){let e=!1,r=!1,i="";for(let o=1;o<t.length;o++){let a=t.charCodeAt(o);if(a===37){let h=t.charCodeAt(o+1),d=t.charCodeAt(o+2);G6(h,d)===null?e=!0:(r=!0,h===50&&d===53&&(e=!0,t=t.slice(0,o+1)+"25"+t.slice(o+1),o+=2),o+=2)}else if(a===63||a===59||a===35){i=t.slice(o+1),t=t.slice(0,o);break}}return{path:e?decodeURI(t):t,querystring:i,shouldDecodeParam:r}}function Jx(t){let e=t.indexOf("%");if(e===-1)return t;let r="",i=e;for(let n=e;n<t.length;n++)if(t.charCodeAt(n)===37){let o=t.charCodeAt(n+1),a=t.charCodeAt(n+2),h=G6(o,a);r+=t.slice(i,n)+h,i=n+3}return t.slice(0,e)+r+t.slice(i)}V6.exports={safeDecodeURI:Kx,safeDecodeURIComponent:Jx}});var e4=V((dP,Q6)=>{"use strict";var ut=require("assert"),ah=require("http"),Zx=require("querystring"),hd=M6(),Y6=R6(),{flattenNode:Yx,compressFlattenedNode:Xx,prettyPrintFlattenedNode:Qx,prettyPrintRoutesArray:eS}=N6(),{StaticNode:J6,NODE_TYPES:ld}=U6(),tS=H6(),{safeDecodeURI:rS,safeDecodeURIComponent:Z6}=K6(),cd=ah.METHODS,X6=/^https?:\/\/.*?\//,Ss=/(\/:[^/()]*?)\?(\/?)/;if(!hd(X6))throw new Error("the FULL_PATH_REGEXP is not safe, update this module");if(!hd(Ss))throw new Error("the OPTIONAL_PARAM_REGEXP is not safe, update this module");function ht(t){if(!(this instanceof ht))return new ht(t);t=t||{},t.defaultRoute?(ut(typeof t.defaultRoute=="function","The default route must be a function"),this.defaultRoute=t.defaultRoute):this.defaultRoute=null,t.onBadUrl?(ut(typeof t.onBadUrl=="function","The bad url handler must be a function"),this.onBadUrl=t.onBadUrl):this.onBadUrl=null,t.buildPrettyMeta?(ut(typeof t.buildPrettyMeta=="function","buildPrettyMeta must be a function"),this.buildPrettyMeta=t.buildPrettyMeta):this.buildPrettyMeta=oS,t.querystringParser?(ut(typeof t.querystringParser=="function","querystringParser must be a function"),this.querystringParser=t.querystringParser):this.querystringParser=e=>e===""?{}:Zx.parse(e),this.caseSensitive=t.caseSensitive===void 0?!0:t.caseSensitive,this.ignoreTrailingSlash=t.ignoreTrailingSlash||!1,this.ignoreDuplicateSlashes=t.ignoreDuplicateSlashes||!1,this.maxParamLength=t.maxParamLength||100,this.allowUnsafeRegex=t.allowUnsafeRegex||!1,this.routes=[],this.trees={},this.constrainer=new tS(t.constraints),this._routesPatterns=[]}ht.prototype.on=function(e,r,i,n,o){typeof i=="function"&&(n!==void 0&&(o=n),n=i,i={}),ut(typeof r=="string","Path should be a string"),ut(r.length>0,"The path could not be empty"),ut(r[0]==="/"||r[0]==="*","The first character of a path should be `/` or `*`"),ut(typeof n=="function","Handler should be a function");let a=r.match(Ss);if(a){ut(r.length===a.index+a[0].length,"Optional Parameter needs to be the last parameter of the path");let m=r.replace(Ss,"$1$2"),p=r.replace(Ss,"$2");this.on(e,m,i,n,o),this.on(e,p,i,n,o);return}let h=r;this.ignoreDuplicateSlashes&&(r=fd(r)),this.ignoreTrailingSlash&&(r=dd(r));let d=Array.isArray(e)?e:[e];for(let m of d)this._on(m,r,i,n,o,h),this.routes.push({method:m,path:r,opts:i,handler:n,store:o})};ht.prototype._on=function(e,r,i,n,o){ut(typeof e=="string","Method should be a string"),ut(cd.includes(e),`Method '${e}' is not an http method.`);let a={};if(i.constraints!==void 0&&(ut(typeof i.constraints=="object"&&i.constraints!==null,"Constraints should be an object"),Object.keys(i.constraints).length!==0&&(a=i.constraints)),this.constrainer.validateConstraints(a),this.constrainer.noteUsage(a),this.trees[e]===void 0&&(this.trees[e]=new J6("/")),r==="*"&&this.trees[e].prefix.length!==0){let p=this.trees[e];this.trees[e]=new J6(""),this.trees[e].staticChildren["/"]=p}let h=this.trees[e],d=h.prefix.length,m=[];for(let p=0;p<=r.length;p++){if(r.charCodeAt(p)===58&&r.charCodeAt(p+1)===58){p++;continue}let M=r.charCodeAt(p)===58&&r.charCodeAt(p+1)!==58,R=r.charCodeAt(p)===42;if(M||R||p===r.length&&p!==d){let x=r.slice(d,p);this.caseSensitive||(x=x.toLowerCase()),x=x.split("::").join(":"),x=x.split("%").join("%25"),h=h.createStaticChild(x)}if(M){let x=!1,w=[],E=0,T=p+1;for(let I=T;;I++){let k=r.charCodeAt(I);if(k===40||k===45||k===46){x=!0;let B=r.slice(T,I);if(m.push(B),k===40){let J=sS(r,I),se=r.slice(I,J+1);this.allowUnsafeRegex||ut(hd(new RegExp(se)),`The regex '${se}' is not safe!`),w.push(nS(se)),I=J+1}else w.push("(.*?)");let z=I;for(;z<r.length;z++){let J=r.charCodeAt(z);if(J===58||J===47)break}let H=r.slice(I,z);H&&w.push(iS(H)),T=z+1,I=z,(r.charCodeAt(I)===47||I===r.length)&&(E=H.length)}else if(k===47||I===r.length){let B=r.slice(T,I);m.push(B),w.length!==0&&w.push("(.*?)")}if(r.charCodeAt(I)===47||I===r.length){r=r.slice(0,p+1)+r.slice(I-E),p+=E;break}}let C=null;x&&(C=new RegExp("^"+w.join("")+"$")),h=h.createParametricChild(C),d=p+1}else R&&(m.push("*"),h=h.createWildcardChild(),d=p+1)}this.caseSensitive||(r=r.toLowerCase());for(let p of this._routesPatterns)if(p.path===r&&p.method===e&&Y6(p.constraints,a))throw new Error(`Method '${e}' already declared for route '${r}' with constraints '${JSON.stringify(a)}'`);this._routesPatterns.push({method:e,path:r,constraints:a}),h.handlerStorage.addHandler(n,m,o,this.constrainer,a)};ht.prototype.hasConstraintStrategy=function(t){return this.constrainer.hasConstraintStrategy(t)};ht.prototype.addConstraintStrategy=function(t){this.constrainer.addConstraintStrategy(t),this._rebuild(this.routes)};ht.prototype.reset=function(){this.trees={},this.routes=[],this._routesPatterns=[]};ht.prototype.off=function(e,r,i){ut(typeof r=="string","Path should be a string"),ut(r.length>0,"The path could not be empty"),ut(r[0]==="/"||r[0]==="*","The first character of a path should be `/` or `*`");let n=r.match(Ss);if(n){ut(r.length===n.index+n[0].length,"Optional Parameter needs to be the last parameter of the path");let a=r.replace(Ss,"$1$2"),h=r.replace(Ss,"$2");this.off(e,a,i),this.off(e,h,i);return}this.ignoreDuplicateSlashes&&(r=fd(r)),this.ignoreTrailingSlash&&(r=dd(r));let o=Array.isArray(e)?e:[e];for(let a of o)this._off(a,r,i)};ht.prototype._off=function(e,r,i){ut(typeof e=="string","Method should be a string"),ut(cd.includes(e),`Method '${e}' is not an http method.`);function n(a){return!i||!a?!0:Y6(i,a)}let o=this.routes.filter(a=>e!==a.method||r!==a.path||!n(a.opts.constraints));this._rebuild(o)};ht.prototype.lookup=function(e,r,i){var n=this.find(e.method,e.url,this.constrainer.deriveConstraints(e,i));return n===null?this._defaultRoute(e,r,i):i===void 0?n.handler(e,r,n.params,n.store,n.searchParams):n.handler.call(i,e,r,n.params,n.store,n.searchParams)};ht.prototype.find=function(e,r,i){let n=this.trees[e];if(n===void 0)return null;r.charCodeAt(0)!==47&&(r=r.replace(X6,"/")),this.ignoreDuplicateSlashes&&(r=fd(r));let o,a,h;try{o=rS(r),r=o.path,a=o.querystring,h=o.shouldDecodeParam}catch{return this._onBadUrl(r)}this.ignoreTrailingSlash&&(r=dd(r));let d=r;this.caseSensitive===!1&&(r=r.toLowerCase());let m=this.maxParamLength,p=n.prefix.length,M=[],R=r.length,x=[];for(;;){if(p===R){let E=n.handlerStorage.getMatchingHandler(i);if(E!==null)return{handler:E.handler,store:E.store,params:E._createParamsObject(M),searchParams:this.querystringParser(a)}}let w=n.getNextNode(r,p,x,M.length);if(w===null){if(x.length===0)return null;let E=x.pop();p=E.brotherPathIndex,M.splice(E.paramsCount),w=E.brotherNode}if(n=w,n.kind===ld.STATIC){p+=n.prefix.length;continue}if(n.kind===ld.WILDCARD){let E=d.slice(p);h&&(E=Z6(E)),M.push(E),p=R;continue}if(n.kind===ld.PARAMETRIC){let E=d.indexOf("/",p);E===-1&&(E=R);let T=d.slice(p,E);if(h&&(T=Z6(T)),n.isRegex){let C=n.regex.exec(T);if(C===null)continue;for(let I=1;I<C.length;I++){let k=C[I];if(k.length>m)return null;M.push(k)}}else{if(T.length>m)return null;M.push(T)}p=E}}};ht.prototype._rebuild=function(t){this.reset();for(let e of t){let{method:r,path:i,opts:n,handler:o,store:a}=e;this._on(r,i,n,o,a),this.routes.push({method:r,path:i,opts:n,handler:o,store:a})}};ht.prototype._defaultRoute=function(t,e,r){if(this.defaultRoute!==null)return r===void 0?this.defaultRoute(t,e):this.defaultRoute.call(r,t,e);e.statusCode=404,e.end()};ht.prototype._onBadUrl=function(t){if(this.onBadUrl===null)return null;let e=this.onBadUrl;return{handler:(r,i,n)=>e(t,r,i),params:{},store:null}};ht.prototype.prettyPrint=function(t={}){if(t.commonPrefix=t.commonPrefix===void 0?!0:t.commonPrefix,!t.commonPrefix)return eS.call(this,this.routes,t);let e={prefix:"/",nodes:[],children:{}};for(let r in this.trees){let i=this.trees[r];i&&Yx(e,i,r)}return Xx(e),Qx.call(this,e,"",!0,t)};for(ud in ah.METHODS){if(!ah.METHODS.hasOwnProperty(ud))continue;let t=ah.METHODS[ud],e=t.toLowerCase();if(ht.prototype[e])throw new Error("Method already exists: "+e);ht.prototype[e]=function(r,i,n){return this.on(t,r,i,n)}}var ud;ht.prototype.all=function(t,e,r){this.on(cd,t,e,r)};Q6.exports=ht;function iS(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function fd(t){return t.replace(/\/\/+/g,"/")}function dd(t){return t.length>1&&t.charCodeAt(t.length-1)===47?t.slice(0,-1):t}function nS(t){return t.charCodeAt(1)===94&&(t=t.slice(0,1)+t.slice(2)),t.charCodeAt(t.length-2)===36&&(t=t.slice(0,t.length-2)+t.slice(t.length-1)),t}function sS(t,e){for(var r=1;e<t.length;){if(e++,t[e]==="\\"){e++;continue}if(t[e]===")"?r--:t[e]==="("&&r++,!r)return e}throw new TypeError('Invalid regexp expression in "'+t+'"')}function oS(t){return t?t.store?Object.assign({},t.store):{}:{}}});var vd=V(bd=>{bd.read=function(t,e,r,i,n){var o,a,h=n*8-i-1,d=(1<<h)-1,m=d>>1,p=-7,M=r?n-1:0,R=r?-1:1,x=t[e+M];for(M+=R,o=x&(1<<-p)-1,x>>=-p,p+=h;p>0;o=o*256+t[e+M],M+=R,p-=8);for(a=o&(1<<-p)-1,o>>=-p,p+=i;p>0;a=a*256+t[e+M],M+=R,p-=8);if(o===0)o=1-m;else{if(o===d)return a?NaN:(x?-1:1)*(1/0);a=a+Math.pow(2,i),o=o-m}return(x?-1:1)*a*Math.pow(2,o-i)};bd.write=function(t,e,r,i,n,o){var a,h,d,m=o*8-n-1,p=(1<<m)-1,M=p>>1,R=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=i?0:o-1,w=i?1:-1,E=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(h=isNaN(e)?1:0,a=p):(a=Math.floor(Math.log(e)/Math.LN2),e*(d=Math.pow(2,-a))<1&&(a--,d*=2),a+M>=1?e+=R/d:e+=R*Math.pow(2,1-M),e*d>=2&&(a++,d/=2),a+M>=p?(h=0,a=p):a+M>=1?(h=(e*d-1)*Math.pow(2,n),a=a+M):(h=e*Math.pow(2,M-1)*Math.pow(2,n),a=0));n>=8;t[r+x]=h&255,x+=w,h/=256,n-=8);for(a=a<<n|h,m+=n;m>0;t[r+x]=a&255,x+=w,a/=256,m-=8);t[r+x-w]|=E*128}});var O4=V((MN,P4)=>{"use strict";P4.exports=PS;var IS={threshold:.1,includeAA:!1,alpha:.1,aaColor:[255,255,0],diffColor:[255,0,0],diffColorAlt:null,diffMask:!1};function PS(t,e,r,i,n,o){if(!Nd(t)||!Nd(e)||r&&!Nd(r))throw new Error("Image data: Uint8Array, Uint8ClampedArray or Buffer expected.");if(t.length!==e.length||r&&r.length!==t.length)throw new Error("Image sizes do not match.");if(t.length!==i*n*4)throw new Error("Image data size does not match width/height.");o=Object.assign({},IS,o);let a=i*n,h=new Uint32Array(t.buffer,t.byteOffset,a),d=new Uint32Array(e.buffer,e.byteOffset,a),m=!0;for(let R=0;R<a;R++)if(h[R]!==d[R]){m=!1;break}if(m){if(r&&!o.diffMask)for(let R=0;R<a;R++)T4(t,4*R,o.alpha,r);return 0}let p=35215*o.threshold*o.threshold,M=0;for(let R=0;R<n;R++)for(let x=0;x<i;x++){let w=(R*i+x)*4,E=I4(t,e,w,w);Math.abs(E)>p?!o.includeAA&&(R4(t,x,R,i,n,e)||R4(e,x,R,i,n,t))?r&&!o.diffMask&&Dd(r,w,...o.aaColor):(r&&Dd(r,w,...E<0&&o.diffColorAlt||o.diffColor),M++):r&&(o.diffMask||T4(t,w,o.alpha,r))}return M}function Nd(t){return ArrayBuffer.isView(t)&&t.constructor.BYTES_PER_ELEMENT===1}function R4(t,e,r,i,n,o){let a=Math.max(e-1,0),h=Math.max(r-1,0),d=Math.min(e+1,i-1),m=Math.min(r+1,n-1),p=(r*i+e)*4,M=e===a||e===d||r===h||r===m?1:0,R=0,x=0,w,E,T,C;for(let I=a;I<=d;I++)for(let k=h;k<=m;k++){if(I===e&&k===r)continue;let B=I4(t,t,p,(k*i+I)*4,!0);if(B===0){if(M++,M>2)return!1}else B<R?(R=B,w=I,E=k):B>x&&(x=B,T=I,C=k)}return R===0||x===0?!1:Oh(t,w,E,i,n)&&Oh(o,w,E,i,n)||Oh(t,T,C,i,n)&&Oh(o,T,C,i,n)}function Oh(t,e,r,i,n){let o=Math.max(e-1,0),a=Math.max(r-1,0),h=Math.min(e+1,i-1),d=Math.min(r+1,n-1),m=(r*i+e)*4,p=e===o||e===h||r===a||r===d?1:0;for(let M=o;M<=h;M++)for(let R=a;R<=d;R++){if(M===e&&R===r)continue;let x=(R*i+M)*4;if(t[m]===t[x]&&t[m+1]===t[x+1]&&t[m+2]===t[x+2]&&t[m+3]===t[x+3]&&p++,p>2)return!0}return!1}function I4(t,e,r,i,n){let o=t[r+0],a=t[r+1],h=t[r+2],d=t[r+3],m=e[i+0],p=e[i+1],M=e[i+2],R=e[i+3];if(d===R&&o===m&&a===p&&h===M)return 0;d<255&&(d/=255,o=Cs(o,d),a=Cs(a,d),h=Cs(h,d)),R<255&&(R/=255,m=Cs(m,R),p=Cs(p,R),M=Cs(M,R));let x=Bd(o,a,h),w=Bd(m,p,M),E=x-w;if(n)return E;let T=C4(o,a,h)-C4(m,p,M),C=A4(o,a,h)-A4(m,p,M),I=.5053*E*E+.299*T*T+.1957*C*C;return x>w?-I:I}function Bd(t,e,r){return t*.29889531+e*.58662247+r*.11448223}function C4(t,e,r){return t*.59597799-e*.2741761-r*.32180189}function A4(t,e,r){return t*.21147017-e*.52261711+r*.31114694}function Cs(t,e){return 255+(t-255)*e}function Dd(t,e,r,i,n){t[e+0]=r,t[e+1]=i,t[e+2]=n,t[e+3]=255}function T4(t,e,r,i){let n=t[e+0],o=t[e+1],a=t[e+2],h=Cs(Bd(n,o,a),r*t[e+3]/255);Dd(i,e,h,h,h)}});var GS={};Zd(GS,{handler:()=>Ye});module.exports=Vg(GS);var qt;(function(t){t.Imagery="im",t.TileSet="ts",t.Provider="pv",t.ImageryRule="ir",t.Style="st",t.ProcessingJob="pj",t.ConfigBundle="cb"})(qt||(qt={}));var Qd=new Set(Object.values(qt));var vt;(function(t){t.Raster="raster",t.Vector="vector"})(vt||(vt={}));var $l=class{get TileSet(){return this.cfg.TileSet}get Imagery(){return this.cfg.Imagery}get Style(){return this.cfg.Style}get Provider(){return this.cfg.Provider}get ProcessingJob(){return this.cfg.ProcessingJob}get ConfigBundle(){return this.cfg.ConfigBundle}setConfigProvider(e){this.cfg=e}isTileSetRaster(e){return e==null?!1:e.type==null||e.type===vt.Raster}isTileSetVector(e){return e==null?!1:e.type===vt.Vector}async getAllImagery(e,r){let i=new Set;for(let n of r)for(let o of e){let a=o[n.code];a&&i.add(this.Imagery.id(a))}return this.Imagery.getAll(i)}prefix(e,r){return r===""||r.startsWith(e)?r:`${e}_${r}`}getPrefix(e){let r=e.indexOf("_");if(r===-1)return null;let i=e.slice(0,r);return Qd.has(i)?i:null}unprefix(e,r){return r.startsWith(e)?r.slice(3):r}},fo=class{},Ga=class{constructor(e){this.prefix=e}isWriteable(){return!1}id(e){return e.startsWith(`${this.prefix}_`)?e:`${this.prefix}_${e}`}is(e){return e!=null&&e.id.startsWith(this.prefix)}},_e=new $l;var Vc;(function(t){t.Processing="processing",t.Complete="complete",t.Fail="failed"})(Vc||(Vc={}));var e2=de(require("aws-sdk/clients/dynamodb.js"),1);var mo=de(require("aws-sdk/clients/dynamodb.js"),1);function Kg(t){return{id:{S:t}}}var Mi=class extends Ga{constructor(e,r){super(r),this.cfg=e}ensureId(e){if(e.startsWith(this.prefix+"_"))return e;throw new Error(`Trying to query "${e}" expected prefix of ${this.prefix}`)}get db(){return this.cfg.dynamo}isWriteable(){return!0}clone(e){return mo.default.Converter.unmarshall(mo.default.Converter.marshall(e))}async get(e){let r=await this.db.getItem({Key:{id:{S:this.ensureId(e)}},TableName:this.cfg.tableName}).promise();if(r==null||r.Item==null)return null;let i=mo.default.Converter.unmarshall(r.Item);return this.is(i)?i:null}async getAll(e){var r;let i=[];for(let o of e)i.push(Kg(this.ensureId(o)));let n=new Map;for(;i.length>0;){let o=i.length>100?i.slice(0,100):i;i=i.length>100?i.slice(100):[];let a={[this.cfg.tableName]:{Keys:o}};for(;a!=null&&Object.keys(a).length>0;){let h=await this.db.batchGetItem({RequestItems:a}).promise(),d=(r=h.Responses)===null||r===void 0?void 0:r[this.cfg.tableName];if(d==null)throw new Error("Failed to fetch from "+this.cfg.tableName);for(let m of d){let p=mo.default.Converter.unmarshall(m);this.is(p)&&n.set(p.id,p)}a=h.UnprocessedKeys}}return n}async put(e){return e.updatedAt=Date.now(),await this.db.putItem({TableName:this.cfg.tableName,Item:mo.default.Converter.marshall(e)}).promise(),e.id}};var po=class extends Mi{constructor(){super(...arguments),this.cache=new Map}async get(e){let r=this.ensureId(e),i=this.cache.get(r);if(i==null){if(i=await super.get(r),i==null)return null;this.cache.set(r,i)}return i}async getAll(e){let r=new Map,i=new Set;for(let n of e){let o=this.ensureId(n),a=this.cache.get(o);a==null?i.add(o):r.set(o,a)}if(i.size>0){let n=await super.getAll(i);for(let o of n.values())r.set(o.id,o),this.cache.set(o.id,o)}return r}};var Va=class extends fo{constructor(e){super(),this.Prefix=qt,this.type="dynamo",this.Imagery=new po(this,qt.Imagery),this.Style=new po(this,qt.Style),this.TileSet=new Mi(this,qt.TileSet),this.Provider=new po(this,qt.Provider),this.ProcessingJob=new Mi(this,qt.ProcessingJob),this.ConfigBundle=new Mi(this,qt.ConfigBundle),this.dynamo=new e2.default({region:"ap-southeast-2"}),this.tableName=e}record(){let e=Date.now();return{id:"",name:"",updatedAt:e}}};var xe=class{constructor(e,r,i,n){this.x=e,this.y=r,this.width=i,this.height=n}get bottom(){return this.y+this.height}get right(){return this.x+this.width}intersects(e){return this.x<e.right&&e.x<this.right&&this.y<e.bottom&&e.y<this.bottom}containsBounds(e){return xe.contains(this,e)}intersection(e){let r=Math.max(this.x,e.x),i=Math.min(this.x+this.width,e.x+e.width),n=Math.max(this.y,e.y),o=Math.min(this.y+this.height,e.y+e.height);return i>r&&o>n?new xe(r,n,i-r,o-n):null}static union(e){if(e.length===0)throw new Error("Union on empty list is not allowed");let{x:r,y:i}=e[0],n=r+e[0].width,o=i+e[0].height;for(let a=1;a<e.length;++a){let h=e[a];r=Math.min(r,h.x),n=Math.max(n,h.x+h.width),i=Math.min(i,h.y),o=Math.max(o,h.y+h.height)}return new xe(r,i,n-r,o-i)}union(e){return xe.union([this,e])}toJson(){return{x:this.x,y:this.y,width:this.width,height:this.height}}toBbox(){return[this.x,this.y,this.right,this.bottom]}toPolygon(){return[[[this.x,this.y],[this.x,this.bottom],[this.right,this.bottom],[this.right,this.y],[this.x,this.y]]]}scale(e,r=e){return new xe(this.x*e,this.y*r,this.width*e,this.height*r)}scaleFromCenter(e,r=e){let i=this.width*e,n=this.height*r;return new xe(this.x-.5*(i-this.width),this.y-.5*(n-this.height),i,n)}pad(e,r=e){return new xe(this.x-e,this.y-r,this.width+e*2,this.height+r*2)}round(e=0){let r=Math.round(this.x-e),i=Math.round(this.y-e);return new xe(r,i,Math.round(this.right+e)-r,Math.round(this.bottom+e)-i)}add(e){return new xe(this.x+e.x,this.y+e.y,this.width,this.height)}subtract(e){return new xe(this.x-e.x,this.y-e.y,this.width,this.height)}static fromMultiPolygon(e){if(e.length===0)return new xe(0,0,0,0);let r=e[0][0][0][0],i=e[0][0][0][1],n=r,o=i;for(let[a]of e)for(let[h,d]of a)h<r?r=h:h>n&&(n=h),d<i?i=d:d>o&&(o=d);return new xe(r,i,n-r,o-i)}static fromBbox([e,r,i,n]){return new xe(Math.min(e,i),Math.min(r,n),Math.abs(i-e),Math.abs(n-r))}static fromUpperLeftLowerRight(e,r){return new xe(e.x,e.y,r.x-e.x,r.y-e.y)}static fromJson(e){return new xe(e.x,e.y,e.width,e.height)}static compareArea(e,r){let i=e.width*e.height-r.width*r.height;if(i!==0)return i;let n=e.x-r.x;return n===0?e.y-r.y:n}static contains(e,r){return e.x<=r.x&&e.x+e.width>=r.x+r.width&&e.y<=r.y&&e.y+e.height>=r.y+r.height}};var We;(function(t){t[t.Google=3857]="Google",t[t.Wgs84=4326]="Wgs84",t[t.Nztm2000=2193]="Nztm2000",t[t.Citm2000=3793]="Citm2000"})(We||(We={}));var Kc={google:We.Google,epsg3857:We.Google,[We.Google]:We.Google,globalmercator:We.Google,wgs84:We.Wgs84,epsg4326:We.Wgs84,[We.Wgs84]:We.Wgs84,nztm:We.Nztm2000,epsg2193:We.Nztm2000,[We.Nztm2000]:We.Nztm2000,nztm2000:We.Nztm2000,citm:We.Citm2000,epsg3793:We.Citm2000,[We.Citm2000]:We.Citm2000,citm2000:We.Citm2000},Re=class{constructor(e){if(this.code=e,Re.Codes.has(e))throw new Error(`Duplicate EPSG code created: ${e}`);Re.Codes.set(this.code,this)}toString(){return this.code.toString()}toJSON(){return this.code}toEpsgString(){return`EPSG:${this.code}`}toUrn(){return`urn:ogc:def:crs:EPSG::${this.code}`}static get(e){let r=Re.Codes.get(e);if(r==null)throw new Error(`Invalid EPSG:${e}`);return r}static tryGet(e){if(e!=null)return Re.Codes.get(e)}static parseCode(e){var r;return e.startsWith("urn:")?Kc[e.slice(e.lastIndexOf(":")+1)]:e.startsWith("https://")?Kc[e.slice(e.lastIndexOf("/")+1)]:(r=Kc[e.replace(/[\W_]/g,"").toLowerCase()])!==null&&r!==void 0?r:null}static parse(e){let r=Re.parseCode(e);return r==null?null:Re.get(r)}};Re.Codes=new Map;Re.Google=new Re(We.Google);Re.Wgs84=new Re(We.Wgs84);Re.Nztm2000=new Re(We.Nztm2000);Re.Citm2000=new Re(We.Citm2000);var cM="0".charCodeAt(0),fM="1".charCodeAt(0),dM="2".charCodeAt(0),mM="3".charCodeAt(0);var go;(function(t){t[t.Xy=0]="Xy",t[t.Yx=1]="Yx"})(go||(go={}));function t2(t){return t===Re.Nztm2000?go.Yx:go.Xy}function Jg(t,e){return e.scaleDenominator-t.scaleDenominator}var Mt=class{constructor(e){this.zooms=[],this.indexX=0,this.indexY=1,this.zoomConversionMap=new Map,this.def=e,this.tileSize=e.tileMatrix[0].tileHeight;let r=e.tileMatrix.slice().sort(Jg),i={};for(let m of r){if(i[m.identifier])throw new Error(`Duplicate tileMatrix identifier ${m.identifier}`);if(m.tileHeight!==m.tileWidth)throw new Error("Only square tiles supported");if(m.tileHeight!==this.tileSize)throw new Error("All tiles must have the same tile size");i[m.identifier]=!0}this.zooms=r;let n=Re.parse(e.supportedCRS);if(n==null)throw new Error(`Unable to find supported projection ${e.supportedCRS}`);this.projection=n,t2(this.projection)===go.Yx&&(this.indexX=1,this.indexY=0);let{lowerCorner:o,upperCorner:a}=e.boundingBox,h=o[this.indexX],d=o[this.indexY];this.extent=new xe(h,d,a[this.indexX]-h,a[this.indexY]-d)}get maxZoom(){return this.zooms.length-1}get identifier(){return this.def.identifier}pixelScale(e){let r=this.zooms[e];if(r==null)throw new Error(`Zoom not found :${e}`);return r.scaleDenominator*28e-5}tileToPixels(e,r){return{x:e*this.tileSize,y:r*this.tileSize}}pixelsToTile(e,r,i){let n=Math.floor(e/this.tileSize),o=Math.floor(r/this.tileSize);return{x:n,y:o,z:i}}sourceToPixels(e,r,i){let n=this.zooms[i],o=this.pixelScale(i),a=(e-n.topLeftCorner[this.indexX])/o,h=(n.topLeftCorner[this.indexY]-r)/o;return{x:a,y:h}}pixelsToSource(e,r,i){let n=this.zooms[i],o=this.pixelScale(i),a=n.topLeftCorner[this.indexX]+e*o,h=n.topLeftCorner[this.indexY]-r*o;return{x:a,y:h}}tileToSource(e){let r=this.tileToPixels(e.x,e.y);return this.pixelsToSource(r.x,r.y,e.z)}tileToSourceBounds(e){let r=this.tileToSource(e),i=this.pixelScale(e.z)*this.tileSize;return new xe(r.x,r.y-i,i,i)}*topLevelTiles(){let{matrixWidth:r,matrixHeight:i}=this.zooms[0];for(let n=0;n<i;++n)for(let o=0;o<r;++o)yield{x:o,y:n,z:0};return null}*coverTile(e){if(e==null)return yield*this.topLevelTiles(),null;let r=e.z+1,{matrixWidth:i,matrixHeight:n}=this.zooms[e.z],{matrixWidth:o,matrixHeight:a}=this.zooms[r],h=o/i,d=a/n,m=Math.floor(e.x*h),p=Math.floor(e.y*d),M=Math.ceil((e.x+1)*h),R=Math.ceil((e.y+1)*d);for(let x=p;x<R;++x)for(let w=m;w<M;++w)yield{x:w,y:x,z:r};return null}static tileToName(e){return`${e.z}-${e.x}-${e.y}`}static nameToTile(e){let r=e.split("-");if(r.length===3){let i=Number(r[0]),n=Number(r[1]),o=Number(r[2]);if(!(isNaN(i)||isNaN(o)||isNaN(n)))return{x:n,y:o,z:i}}throw new Error(`Invalid tile name '${e}'`)}findBestZoom(e){let r=this.zoomConversionMap.get(e);return r==null&&(r=this.convertZoomLevel(e),this.zoomConversionMap.set(e,r)),r}convertZoomLevel(e){for(let r=0;r<this.zooms.length;r++){let i=this.zooms[r].scaleDenominator-e;if(i>1e-5)continue;if(r===0)return r;let n=this.zooms[r-1].scaleDenominator-e;return Math.abs(i)<n?r:r-1}return this.maxZoom}static convertZoomLevel(e,r,i,n=!0){return r.identifier===i.identifier||(e>=r.maxZoom&&(e=r.maxZoom),n&&e===0)?e:n&&e===r.maxZoom?i.maxZoom:i.findBestZoom(r.zooms[e].scaleDenominator)}};var Ka={Version:"1.0.0-beta.2",License:"CC BY 4.0",BaseMapsExtension:"https://basemaps.linz.govt.nz/json-schema/stac-basemaps-extension/1.0/schema.json"};var Zg={type:"TileMatrixSetType",title:"Google Maps Compatible for the World",identifier:"WebMercatorQuad",boundingBox:{type:"BoundingBoxType",crs:"http://www.opengis.net/def/crs/EPSG/0/3857",lowerCorner:[-200375083427892e-7,-200375083427892e-7],upperCorner:[200375083427892e-7,200375083427892e-7]},supportedCRS:"https://www.opengis.net/def/crs/EPSG/0/3857",wellKnownScaleSet:"https://www.opengis.net/def/wkss/OGC/1.0/GoogleMapsCompatible",tileMatrix:[{type:"TileMatrixType",identifier:"0",scaleDenominator:559082264028717e-6,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:1,matrixHeight:1},{type:"TileMatrixType",identifier:"1",scaleDenominator:279541132014358e-6,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:2,matrixHeight:2},{type:"TileMatrixType",identifier:"2",scaleDenominator:139770566007179e-6,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:4,matrixHeight:4},{type:"TileMatrixType",identifier:"3",scaleDenominator:698852830035897e-7,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:8,matrixHeight:8},{type:"TileMatrixType",identifier:"4",scaleDenominator:349426415017948e-7,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:16,matrixHeight:16},{type:"TileMatrixType",identifier:"5",scaleDenominator:174713207508974e-7,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:32,matrixHeight:32},{type:"TileMatrixType",identifier:"6",scaleDenominator:873566037544871e-8,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:64,matrixHeight:64},{type:"TileMatrixType",identifier:"7",scaleDenominator:436783018772435e-8,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:128,matrixHeight:128},{type:"TileMatrixType",identifier:"8",scaleDenominator:218391509386217e-8,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:256,matrixHeight:256},{type:"TileMatrixType",identifier:"9",scaleDenominator:109195754693108e-8,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:512,matrixHeight:512},{type:"TileMatrixType",identifier:"10",scaleDenominator:545978.773465544,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:1024,matrixHeight:1024},{type:"TileMatrixType",identifier:"11",scaleDenominator:272989.386732772,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:2048,matrixHeight:2048},{type:"TileMatrixType",identifier:"12",scaleDenominator:136494.693366386,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:4096,matrixHeight:4096},{type:"TileMatrixType",identifier:"13",scaleDenominator:68247.346683193,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:8192,matrixHeight:8192},{type:"TileMatrixType",identifier:"14",scaleDenominator:34123.6733415964,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:16384,matrixHeight:16384},{type:"TileMatrixType",identifier:"15",scaleDenominator:17061.8366707982,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:32768,matrixHeight:32768},{type:"TileMatrixType",identifier:"16",scaleDenominator:8530.91833539913,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:65536,matrixHeight:65536},{type:"TileMatrixType",identifier:"17",scaleDenominator:4265.45916769956,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:131072,matrixHeight:131072},{type:"TileMatrixType",identifier:"18",scaleDenominator:2132.72958384978,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:262144,matrixHeight:262144},{type:"TileMatrixType",identifier:"19",scaleDenominator:1066.36479192489,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:524288,matrixHeight:524288},{type:"TileMatrixType",identifier:"20",scaleDenominator:533.182395962445,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:1048576,matrixHeight:1048576},{type:"TileMatrixType",identifier:"21",scaleDenominator:266.591197981222,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:2097152,matrixHeight:2097152},{type:"TileMatrixType",identifier:"22",scaleDenominator:133.295598990611,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:4194304,matrixHeight:4194304},{type:"TileMatrixType",identifier:"23",scaleDenominator:66.6477994953056,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:8388608,matrixHeight:8388608},{type:"TileMatrixType",identifier:"24",scaleDenominator:33.3238997476528,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:16777216,matrixHeight:16777216}]},lt=new Mt(Zg);var Wl=de(n2(),1),Hl=new Mt(Wl.Nztm2000),on=new Mt(Wl.Nztm2000Quad);var Zn={All:[lt,Hl,on],Defaults:new Map([[Re.Google.code,lt],[Re.Nztm2000.code,Hl]]),get(t){let e=this.tryGet(t);if(e==null)throw new Error("Failed to lookup TileMatrixSet: "+t);return e},tryGet(t){var e,r;return t==null?null:typeof t=="number"?(e=this.Defaults.get(t))!==null&&e!==void 0?e:null:(r=this.Defaults.get(t.code))!==null&&r!==void 0?r:null},find(t){if(t==null)return null;let e=Re.parse(t);if(e!=null)return Zn.tryGet(e);for(let r of Zn.All)if(r.identifier===t)return r;return null}};var He;(function(t){t.Png="png",t.Jpeg="jpeg",t.Webp="webp",t.Avif="avif"})(He||(He={}));var rr;(function(t){t.MapboxVectorTiles="pbf"})(rr||(rr={}));var c2=de(Yn(),1);function Qg(t){if(!t.endsWith("m")||!t.includes("-"))return null;let e=Number(t.replace("-",".").slice(0,t.length-1));return isNaN(e)?null:String(e)+"m"}function ey(t){let e=t.split("-");return e.length!==2||e[0].length!==4?null:e[1].length===4?t:e[1].length===2?`${e[0]}-${e[0].slice(0,2)}${e[1]}`:null}var ty=[Qg,ey];function bo(t){let e=new Set(t.split("_"));e.delete("RGB"),e.delete("RGBI"),e.delete("RGBA");let r=[];for(let i of e){let n=!1;for(let o of ty){let a=o(i);if(a!=null){n=!0,r.push(a);break}}n||r.push(i)}return r.join("-")}var l2=de(a2(),1),u2=require("crypto"),iy="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",h2=(0,l2.default)(iy);function Xn(t){return h2.encode((0,u2.createHash)("sha256").update(t).digest())}function Ja(t){if(t==="")return 0;let e=parseInt(t,16);if(isNaN(e))throw new Error("Invalid hex byte: "+t);return e}function Vl(t){if(t.startsWith("0x")?t=t.slice(2):t.startsWith("#")&&(t=t.slice(1)),t.length!==6&&t.length!==8)throw new Error("Invalid hex color: "+t);return{r:Ja(t.substr(0,2)),g:Ja(t.substr(2,2)),b:Ja(t.substr(4,2)),alpha:Ja(t.substr(6,2))}}var ln=de(require("fs"),1),Zl=de(require("path"),1);var Et;(function(t){t[t.UInt8=1]="UInt8",t[t.UInt16=2]="UInt16",t[t.UInt32=4]="UInt32",t[t.UInt64=8]="UInt64",t[t.Double=8]="Double",t[t.Float=4]="Float"})(Et||(Et={}));var f2=2**32,ny=typeof setImmediate>"u"?setTimeout:setImmediate,Ot=()=>{throw new Error("Method not implemented.")},Rt=class{constructor(){this.isLittleEndian=!0,this.delayMs=Rt.DefaultDelayMs,this.maxChunkCount=10,this.chunks=Rt.DefaultChunkCache(),this.blankFillCount=16,this.maxConcurrentRequests=50,this.toFetch=new Set,this.toFetchPromise=null,this.byteOffset=0,this.getFloat32=Ot,this.getFloat64=Ot,this.getInt8=Ot,this.getInt16=Ot,this.getInt32=Ot,this.setFloat32=Ot,this.setFloat64=Ot,this.setInt8=Ot,this.setInt16=Ot,this.setInt32=Ot,this.setUint8=Ot,this.setUint16=Ot,this.setUint32=Ot,this.setBigInt64=Ot,this.setBigUint64=Ot}static getByteRanges(e,r=32,i=16){if(e.size===0)return{chunks:[],blankFill:[]};let n=[...e.values()].sort((d,m)=>d-m),o=[],a=[];o.push(a);let h=[];for(let d=0;d<n.length;++d){let m=n[d],p=n[d-1];if(a.length>=r)a=[m],o.push(a);else if(d===0||m===p+1)a.push(m);else if(m<p+i){for(let M=p;M<m;M++)a.push(M+1),h.push(M+1);h.pop()}else a=[m],o.push(a)}return{chunks:o,blankFill:h}}async fetchData(){if(this.toFetch.size===0)return;let e=this.toFetch;this.toFetch=new Set,this.toFetchPromise=null;let r=Rt.getByteRanges(e,this.maxChunkCount,this.blankFillCount),i=[];for(let n of r.chunks){let o=n[0],a=n[n.length-1],h=o*this.chunkSize,d=a*this.chunkSize+this.chunkSize-h,m=await this.fetchBytes(h,d);if(n.length===1){i[o]=m,this.chunks.set(o,new DataView(m));continue}let p=o*this.chunkSize;for(let M of n){let R=M*this.chunkSize-p,x=m.slice(R,R+this.chunkSize);i[M]=x,this.chunks.set(M,new DataView(x))}}}async loadBytes(e,r){if(e<0)throw new Error("Offset must be positive");let i=Math.floor(e/this.chunkSize),n=Math.ceil((e+r)/this.chunkSize)-1;for(let o=i;o<=n;o++)this.chunks.has(o)||this.toFetch.add(o);if(this.toFetch.size!==0){if(this.toFetchPromise==null&&(this.toFetchPromise=new Promise(o=>ny(o,this.delayMs)).then(()=>this.fetchData())),this.toFetch.size>this.maxConcurrentRequests)throw new Error("Too many outstanding requests");await this.toFetchPromise}}getChunkId(e){return Math.floor(e/this.chunkSize)}getUint(e,r){switch(r){case Et.UInt8:return this.getUint8(e);case Et.UInt16:return this.getUint16(e);case Et.UInt32:return this.getUint32(e);case Et.UInt64:return this.getUint64(e)}}bytes(e,r){let i=this.isOneChunk(e,r);if(i){let m=this.getView(i),p=e-i*this.chunkSize;return new Uint8Array(m.buffer.slice(p,p+r))}let n=new Uint8Array(r),o=e+r,a=Math.floor(e/this.chunkSize),h=Math.ceil((e+r)/this.chunkSize)-1,d=0;for(let m=a;m<=h;m++){let p=e+d,M=m*this.chunkSize,R=this.getView(m),x=Math.min(o,M+this.chunkSize),w=R.buffer.slice(p-M,x-M);n.set(new Uint8Array(w),d),d+=w.byteLength}return n}getView(e){let r=this.chunks.get(e);if(r==null)throw new Error(`Chunk:${e} is not ready`);return r}isOneChunk(e,r){let i=e+r-1,n=Math.floor(e/this.chunkSize);return Math.floor(i/this.chunkSize)-n<1?n:null}hasBytes(e,r=1){let i=Math.floor(e/this.chunkSize),n=Math.ceil((e+r)/this.chunkSize)-1;for(let o=i;o<=n;o++)if(!this.chunks.has(o))return!1;return!0}toRange(e,r){if(r==null)return`bytes=${e}`;if(e<0)throw new Error("Cannot read from remote source with negative offset and length");return`bytes=${e}-${e+r}`}parseContentRange(e){let[r,i]=e.split(" ");if(r!=="bytes")throw new Error("Failed to parse content-range: "+e);if(i==null)throw new Error("Failed to parse content-range: "+e);let[,n]=i.split("/"),o=Number(n);if(isNaN(o))throw new Error("Failed to parse content-range: "+e);return o}get buffer(){throw new Error("Method not implemented.")}get byteLength(){if(this._byteLength)return this._byteLength;throw Error(".size() has not been fetched.")}getUint8(e){let r=Math.floor(e/this.chunkSize),i=this.chunks.get(r);if(i==null)throw new Error(`Chunk:${r} is not ready`);return i.getUint8(e-r*this.chunkSize)}getUint16(e){let r=this.isOneChunk(e,Et.UInt16);if(r!=null)return this.getView(r).getUint16(e-r*this.chunkSize,this.isLittleEndian);let i=this.getUint8(e),n=this.getUint8(e+Et.UInt8);return this.isLittleEndian?i+(n<<8):(i<<8)+n}getUint32(e){let r=this.isOneChunk(e,Et.UInt32);if(r!=null)return this.getView(r).getUint32(e-r*this.chunkSize,this.isLittleEndian);let i=this.getUint16(e),n=this.getUint16(e+Et.UInt16);return this.isLittleEndian?i+n*65536:i*65536+n}getUint64(e){let r=this.isOneChunk(e,Et.UInt64);if(r!=null){let o=this.getView(r);return Number(o.getBigUint64(e-r*this.chunkSize,this.isLittleEndian))}let i=this.getUint32(e),n=this.getUint32(e+Et.UInt32);return this.isLittleEndian?i+n*f2:i*f2+n}getBigUint64(e){let r=this.isOneChunk(e,Et.UInt64);if(r!=null)return this.getView(r).getBigUint64(e-r*this.chunkSize,this.isLittleEndian);let i=BigInt(this.getUint32(e)),n=BigInt(this.getUint32(e+Et.UInt32));return this.isLittleEndian?i+(n<<BigInt(32)):(i<<BigInt(32))+n}getBigInt64(){throw new Error("Not implemented.")}};Rt.DefaultChunkCache=()=>new Map;Rt.DefaultDelayMs=1;var it=class extends Error{constructor(e,r,i){super(e),this.name="CompositeError",this.code=r,this.reason=i}static isCompositeError(e){return typeof e!="object"||e==null?!1:e.name==="CompositeError"}};function Ei(t){return typeof t=="object"&&t!==null}function Qr(t){let e=t.split("/"),r=e[0];if(r==null||r==="")return null;r.endsWith(":")&&(r=r.slice(0,r.length-1));let i=e[2];if(i==null||i.trim()==="")return null;if(e.length===3)return{protocol:r,bucket:i};let n=e.slice(3).join("/");return n==null||n.trim()===""?{protocol:r,bucket:i}:{key:n,bucket:i,protocol:r}}var oy=/\/$/,ay=/^\//;function Jc(t,e){return t.replace(oy,"")+"/"+e.replace(ay,"")}function d2(t,...e){let r=t;for(let i=0;i<e.length;i++)r=Jc(r,e[i]);return r}async function m2(t){let e=[];for await(let r of t)e.push(r);return e}var Zc=require("fs"),Kl=require("path"),an=class extends Rt{constructor(e){super(),this.type="file",this.protocol="file",this.chunkSize=an.DefaultChunkSize,this.fd=null,this.closeAfterRead=!1,this.fileName=e}static isSource(e){return e.type==="file"}async close(){let e=await this.fd;e!=null&&(await e.close(),this.fd=null)}get uri(){return(0,Kl.resolve)(this.fileName)}get name(){return(0,Kl.basename)(this.fileName)}get size(){return this._size?this._size:(this._size=Promise.resolve().then(async()=>(await Zc.promises.stat(this.fileName)).size),this._size)}async fetchBytes(e,r){if(e<0&&r!=null)throw new Error("Cannot fetch negative offsets with length");if(e<0&&(r=Math.abs(e),e=await this.size+e),r==null)throw new Error("Length is required for reading from files");this.fd==null&&(this.fd=Zc.promises.open(this.fileName,"r"));let i=await this.fd,{buffer:n}=await i.read(Buffer.allocUnsafe(r),0,r,e);return this.closeAfterRead&&await this.close(),n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)}};an.DefaultChunkSize=16*1024;function Jl(t,e){return Ei(t)?t.code==="ENOENT"?new it(e,404,t):t.code==="EACCES"?new it(e,403,t):new it(e,500,t):new it(e,500,t)}var Ri=class{constructor(){this.protocol=Ri.protocol}static is(e){return e.protocol===Ri.protocol}source(e){return new an(e)}async*list(e,r){try{let i=await ln.default.promises.readdir(e,{withFileTypes:!0}),n=Zl.default.resolve(e);for(let o of i){let a=Zl.default.join(n,o.name);o.isDirectory()&&r?.recursive!==!1?yield*this.list(a):yield a}}catch(i){throw Jl(i,`Failed to list: ${e}`)}}async*details(e,r){for await(let i of this.list(e,r)){let n=await this.head(i);n!=null&&(yield n)}}async head(e){try{let r=await ln.default.promises.stat(e);return{path:e,size:r.size,isDirectory:r.isDirectory()}}catch(r){if(Ei(r)&&r.code==="ENOENT")return null;throw Jl(r,`Failed to stat: ${e}`)}}async read(e){try{return await ln.default.promises.readFile(e)}catch(r){throw Jl(r,`Failed to read: ${e}`)}}async write(e,r){let i=Zl.default.dirname(e);await ln.default.promises.mkdir(i,{recursive:!0});try{if(Buffer.isBuffer(r)||typeof r=="string")await ln.default.promises.writeFile(e,r);else{let n=ln.default.createWriteStream(e);await new Promise((o,a)=>{n.on("finish",o),n.on("error",a),r.pipe(n)})}}catch(n){throw Jl(n,`Failed to write: ${e}`)}}stream(e){return ln.default.createReadStream(e)}};Ri.protocol="file";var J2=de(require("http"),1),Z2=de(require("https"),1),ns=de(require("zlib"),1),nr=de(require("stream"),1),s1=require("buffer");function ly(t){if(!/^data:/i.test(t))throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');t=t.replace(/\r?\n/g,"");let e=t.indexOf(",");if(e===-1||e<=4)throw new TypeError("malformed data: URI");let r=t.substring(5,e).split(";"),i="",n=!1,o=r[0]||"text/plain",a=o;for(let p=1;p<r.length;p++)r[p]==="base64"?n=!0:(a+=`;${r[p]}`,r[p].indexOf("charset=")===0&&(i=r[p].substring(8)));!r[0]&&!i.length&&(a+=";charset=US-ASCII",i="US-ASCII");let h=n?"base64":"ascii",d=unescape(t.substring(e+1)),m=Buffer.from(d,h);return m.type=o,m.typeFull=a,m.charset=i,m}var p2=ly;var pr=de(require("stream"),1),Ii=require("util"),ir=require("buffer");Ya();Ql();var Ti=class extends Error{constructor(e,r){super(e),Error.captureStackTrace(this,this.constructor),this.type=r}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}};var Ft=class extends Ti{constructor(e,r,i){super(e,r),i&&(this.code=this.errno=i.code,this.erroredSysCall=i.syscall)}};var eu=Symbol.toStringTag,ef=t=>typeof t=="object"&&typeof t.append=="function"&&typeof t.delete=="function"&&typeof t.get=="function"&&typeof t.getAll=="function"&&typeof t.has=="function"&&typeof t.set=="function"&&typeof t.sort=="function"&&t[eu]==="URLSearchParams",t1=t=>t&&typeof t=="object"&&typeof t.arrayBuffer=="function"&&typeof t.type=="string"&&typeof t.stream=="function"&&typeof t.constructor=="function"&&/^(Blob|File)$/.test(t[eu]),R2=t=>typeof t=="object"&&(t[eu]==="AbortSignal"||t[eu]==="EventTarget"),C2=(t,e)=>{let r=new URL(e).hostname,i=new URL(t).hostname;return r===i||r.endsWith(`.${i}`)};var Sy=(0,Ii.promisify)(pr.default.pipeline),Wt=Symbol("Body internals"),ti=class{constructor(e,{size:r=0}={}){let i=null;e===null?e=null:ef(e)?e=ir.Buffer.from(e.toString()):t1(e)||ir.Buffer.isBuffer(e)||(Ii.types.isAnyArrayBuffer(e)?e=ir.Buffer.from(e):ArrayBuffer.isView(e)?e=ir.Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof pr.default||(e instanceof es?(e=E2(e),i=e.type.split("=")[1]):e=ir.Buffer.from(String(e))));let n=e;ir.Buffer.isBuffer(e)?n=pr.default.Readable.from(e):t1(e)&&(n=pr.default.Readable.from(e.stream())),this[Wt]={body:e,stream:n,boundary:i,disturbed:!1,error:null},this.size=r,e instanceof pr.default&&e.on("error",o=>{let a=o instanceof Ti?o:new Ft(`Invalid response body while trying to fetch ${this.url}: ${o.message}`,"system",o);this[Wt].error=a})}get body(){return this[Wt].stream}get bodyUsed(){return this[Wt].disturbed}async arrayBuffer(){let{buffer:e,byteOffset:r,byteLength:i}=await iu(this);return e.slice(r,r+i)}async formData(){let e=this.headers.get("content-type");if(e.startsWith("application/x-www-form-urlencoded")){let i=new es,n=new URLSearchParams(await this.text());for(let[o,a]of n)i.append(o,a);return i}let{toFormData:r}=await Promise.resolve().then(()=>(L2(),k2));return r(this.body,e)}async blob(){let e=this.headers&&this.headers.get("content-type")||this[Wt].body&&this[Wt].body.type||"",r=await this.arrayBuffer();return new Ai([r],{type:e})}async json(){let e=await iu(this);return JSON.parse(e.toString())}async text(){return(await iu(this)).toString()}buffer(){return iu(this)}};ti.prototype.buffer=(0,Ii.deprecate)(ti.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(ti.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:(0,Ii.deprecate)(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});async function iu(t){if(t[Wt].disturbed)throw new TypeError(`body used already for: ${t.url}`);if(t[Wt].disturbed=!0,t[Wt].error)throw t[Wt].error;let{body:e}=t;if(e===null)return ir.Buffer.alloc(0);if(!(e instanceof pr.default))return ir.Buffer.alloc(0);let r=[],i=0;try{for await(let n of e){if(t.size>0&&i+n.length>t.size){let o=new Ft(`content size at ${t.url} over limit: ${t.size}`,"max-size");throw e.destroy(o),o}i+=n.length,r.push(n)}}catch(n){throw n instanceof Ti?n:new Ft(`Invalid response body while trying to fetch ${t.url}: ${n.message}`,"system",n)}if(e.readableEnded===!0||e._readableState.ended===!0)try{return r.every(n=>typeof n=="string")?ir.Buffer.from(r.join("")):ir.Buffer.concat(r,i)}catch(n){throw new Ft(`Could not create Buffer from response body for ${t.url}: ${n.message}`,"system",n)}else throw new Ft(`Premature close of server response while trying to fetch ${t.url}`)}var xo=(t,e)=>{let r,i,{body:n}=t[Wt];if(t.bodyUsed)throw new Error("cannot clone body after it is used");return n instanceof pr.default&&typeof n.getBoundary!="function"&&(r=new pr.PassThrough({highWaterMark:e}),i=new pr.PassThrough({highWaterMark:e}),n.pipe(r),n.pipe(i),t[Wt].stream=r,n=i),n},My=(0,Ii.deprecate)(t=>t.getBoundary(),"form-data doesn't follow the spec and requires special treatment. Use alternative package","https://github.com/node-fetch/node-fetch/issues/1167"),nu=(t,e)=>t===null?null:typeof t=="string"?"text/plain;charset=UTF-8":ef(t)?"application/x-www-form-urlencoded;charset=UTF-8":t1(t)?t.type||null:ir.Buffer.isBuffer(t)||Ii.types.isAnyArrayBuffer(t)||ArrayBuffer.isView(t)?null:t instanceof es?`multipart/form-data; boundary=${e[Wt].boundary}`:t&&typeof t.getBoundary=="function"?`multipart/form-data;boundary=${My(t)}`:t instanceof pr.default?null:"text/plain;charset=UTF-8",N2=t=>{let{body:e}=t[Wt];return e===null?0:t1(e)?e.size:ir.Buffer.isBuffer(e)?e.length:e&&typeof e.getLengthSync=="function"&&e.hasKnownLength&&e.hasKnownLength()?e.getLengthSync():null},B2=async(t,{body:e})=>{e===null?t.end():await Sy(e,t)};var sf=require("util"),n1=de(require("http"),1),su=typeof n1.default.validateHeaderName=="function"?n1.default.validateHeaderName:t=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(t)){let e=new TypeError(`Header name must be a valid HTTP token [${t}]`);throw Object.defineProperty(e,"code",{value:"ERR_INVALID_HTTP_TOKEN"}),e}},of=typeof n1.default.validateHeaderValue=="function"?n1.default.validateHeaderValue:(t,e)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(e)){let r=new TypeError(`Invalid character in header content ["${t}"]`);throw Object.defineProperty(r,"code",{value:"ERR_INVALID_CHAR"}),r}},Ht=class extends URLSearchParams{constructor(e){let r=[];if(e instanceof Ht){let i=e.raw();for(let[n,o]of Object.entries(i))r.push(...o.map(a=>[n,a]))}else if(e!=null)if(typeof e=="object"&&!sf.types.isBoxedPrimitive(e)){let i=e[Symbol.iterator];if(i==null)r.push(...Object.entries(e));else{if(typeof i!="function")throw new TypeError("Header pairs must be iterable");r=[...e].map(n=>{if(typeof n!="object"||sf.types.isBoxedPrimitive(n))throw new TypeError("Each header pair must be an iterable object");return[...n]}).map(n=>{if(n.length!==2)throw new TypeError("Each header pair must be a name/value tuple");return[...n]})}}else throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)");return r=r.length>0?r.map(([i,n])=>(su(i),of(i,String(n)),[String(i).toLowerCase(),String(n)])):void 0,super(r),new Proxy(this,{get(i,n,o){switch(n){case"append":case"set":return(a,h)=>(su(a),of(a,String(h)),URLSearchParams.prototype[n].call(i,String(a).toLowerCase(),String(h)));case"delete":case"has":case"getAll":return a=>(su(a),URLSearchParams.prototype[n].call(i,String(a).toLowerCase()));case"keys":return()=>(i.sort(),new Set(URLSearchParams.prototype.keys.call(i)).keys());default:return Reflect.get(i,n,o)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(e){let r=this.getAll(e);if(r.length===0)return null;let i=r.join(", ");return/^content-encoding$/i.test(e)&&(i=i.toLowerCase()),i}forEach(e,r=void 0){for(let i of this.keys())Reflect.apply(e,r,[this.get(i),i,this])}*values(){for(let e of this.keys())yield this.get(e)}*entries(){for(let e of this.keys())yield[e,this.get(e)]}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce((e,r)=>(e[r]=this.getAll(r),e),{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce((e,r)=>{let i=this.getAll(r);return r==="host"?e[r]=i[0]:e[r]=i.length>1?i:i[0],e},{})}};Object.defineProperties(Ht.prototype,["get","entries","forEach","values"].reduce((t,e)=>(t[e]={enumerable:!0},t),{}));function D2(t=[]){return new Ht(t.reduce((e,r,i,n)=>(i%2===0&&e.push(n.slice(i,i+2)),e),[]).filter(([e,r])=>{try{return su(e),of(e,String(r)),!0}catch{return!1}}))}var Ey=new Set([301,302,303,307,308]),ou=t=>Ey.has(t);var Nr=Symbol("Response internals"),Ct=class extends ti{constructor(e=null,r={}){super(e,r);let i=r.status!=null?r.status:200,n=new Ht(r.headers);if(e!==null&&!n.has("Content-Type")){let o=nu(e,this);o&&n.append("Content-Type",o)}this[Nr]={type:"default",url:r.url,status:i,statusText:r.statusText||"",headers:n,counter:r.counter,highWaterMark:r.highWaterMark}}get type(){return this[Nr].type}get url(){return this[Nr].url||""}get status(){return this[Nr].status}get ok(){return this[Nr].status>=200&&this[Nr].status<300}get redirected(){return this[Nr].counter>0}get statusText(){return this[Nr].statusText}get headers(){return this[Nr].headers}get highWaterMark(){return this[Nr].highWaterMark}clone(){return new Ct(xo(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(e,r=302){if(!ou(r))throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');return new Ct(null,{headers:{location:new URL(e).toString()},status:r})}static error(){let e=new Ct(null,{status:0,statusText:""});return e[Nr].type="error",e}get[Symbol.toStringTag](){return"Response"}};Object.defineProperties(Ct.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}});var G2=require("url"),V2=require("util");var z2=t=>{if(t.search)return t.search;let e=t.href.length-1,r=t.hash||(t.href[e]==="#"?"#":"");return t.href[e-r.length]==="?"?"?":""};var j2=require("net");function U2(t,e=!1){return t==null||(t=new URL(t),/^(about|blob|data):$/.test(t.protocol))?"no-referrer":(t.username="",t.password="",t.hash="",e&&(t.pathname="",t.search=""),t)}var $2=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]),q2="strict-origin-when-cross-origin";function F2(t){if(!$2.has(t))throw new TypeError(`Invalid referrerPolicy: ${t}`);return t}function Ry(t){if(/^(http|ws)s:$/.test(t.protocol))return!0;let e=t.host.replace(/(^\[)|(]$)/g,""),r=(0,j2.isIP)(e);return r===4&&/^127\./.test(e)||r===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(e)?!0:/^(.+\.)*localhost$/.test(t.host)?!1:t.protocol==="file:"}function So(t){return/^about:(blank|srcdoc)$/.test(t)||t.protocol==="data:"||/^(blob|filesystem):$/.test(t.protocol)?!0:Ry(t)}function W2(t,{referrerURLCallback:e,referrerOriginCallback:r}={}){if(t.referrer==="no-referrer"||t.referrerPolicy==="")return null;let i=t.referrerPolicy;if(t.referrer==="about:client")return"no-referrer";let n=t.referrer,o=U2(n),a=U2(n,!0);o.toString().length>4096&&(o=a),e&&(o=e(o)),r&&(a=r(a));let h=new URL(t.url);switch(i){case"no-referrer":return"no-referrer";case"origin":return a;case"unsafe-url":return o;case"strict-origin":return So(o)&&!So(h)?"no-referrer":a.toString();case"strict-origin-when-cross-origin":return o.origin===h.origin?o:So(o)&&!So(h)?"no-referrer":a;case"same-origin":return o.origin===h.origin?o:"no-referrer";case"origin-when-cross-origin":return o.origin===h.origin?o:a;case"no-referrer-when-downgrade":return So(o)&&!So(h)?"no-referrer":o;default:throw new TypeError(`Invalid referrerPolicy: ${i}`)}}function H2(t){let e=(t.get("referrer-policy")||"").split(/[,\s]+/),r="";for(let i of e)i&&$2.has(i)&&(r=i);return r}var dt=Symbol("Request internals"),au=t=>typeof t=="object"&&typeof t[dt]=="object",Cy=(0,V2.deprecate)(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)"),Pi=class extends ti{constructor(e,r={}){let i;if(au(e)?i=new URL(e.url):(i=new URL(e),e={}),i.username!==""||i.password!=="")throw new TypeError(`${i} is an url with embedded credentails.`);let n=r.method||e.method||"GET";if(n=n.toUpperCase(),"data"in r&&Cy(),(r.body!=null||au(e)&&e.body!==null)&&(n==="GET"||n==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body");let o=r.body?r.body:au(e)&&e.body!==null?xo(e):null;super(o,{size:r.size||e.size||0});let a=new Ht(r.headers||e.headers||{});if(o!==null&&!a.has("Content-Type")){let m=nu(o,this);m&&a.set("Content-Type",m)}let h=au(e)?e.signal:null;if("signal"in r&&(h=r.signal),h!=null&&!R2(h))throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");let d=r.referrer==null?e.referrer:r.referrer;if(d==="")d="no-referrer";else if(d){let m=new URL(d);d=/^about:(\/\/)?client$/.test(m)?"client":m}else d=void 0;this[dt]={method:n,redirect:r.redirect||e.redirect||"follow",headers:a,parsedURL:i,signal:h,referrer:d},this.follow=r.follow===void 0?e.follow===void 0?20:e.follow:r.follow,this.compress=r.compress===void 0?e.compress===void 0?!0:e.compress:r.compress,this.counter=r.counter||e.counter||0,this.agent=r.agent||e.agent,this.highWaterMark=r.highWaterMark||e.highWaterMark||16384,this.insecureHTTPParser=r.insecureHTTPParser||e.insecureHTTPParser||!1,this.referrerPolicy=r.referrerPolicy||e.referrerPolicy||""}get method(){return this[dt].method}get url(){return(0,G2.format)(this[dt].parsedURL)}get headers(){return this[dt].headers}get redirect(){return this[dt].redirect}get signal(){return this[dt].signal}get referrer(){if(this[dt].referrer==="no-referrer")return"";if(this[dt].referrer==="client")return"about:client";if(this[dt].referrer)return this[dt].referrer.toString()}get referrerPolicy(){return this[dt].referrerPolicy}set referrerPolicy(e){this[dt].referrerPolicy=F2(e)}clone(){return new Pi(this)}get[Symbol.toStringTag](){return"Request"}};Object.defineProperties(Pi.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0},referrer:{enumerable:!0},referrerPolicy:{enumerable:!0}});var K2=t=>{let{parsedURL:e}=t[dt],r=new Ht(t[dt].headers);r.has("Accept")||r.set("Accept","*/*");let i=null;if(t.body===null&&/^(post|put)$/i.test(t.method)&&(i="0"),t.body!==null){let h=N2(t);typeof h=="number"&&!Number.isNaN(h)&&(i=String(h))}i&&r.set("Content-Length",i),t.referrerPolicy===""&&(t.referrerPolicy=q2),t.referrer&&t.referrer!=="no-referrer"?t[dt].referrer=W2(t):t[dt].referrer="no-referrer",t[dt].referrer instanceof URL&&r.set("Referer",t.referrer),r.has("User-Agent")||r.set("User-Agent","node-fetch"),t.compress&&!r.has("Accept-Encoding")&&r.set("Accept-Encoding","gzip,deflate,br");let{agent:n}=t;typeof n=="function"&&(n=n(e)),!r.has("Connection")&&!n&&r.set("Connection","close");let o=z2(e),a={path:e.pathname+o,method:t.method,headers:r[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:t.insecureHTTPParser,agent:n};return{parsedURL:e,options:a}};var lu=class extends Ti{constructor(e,r="aborted"){super(e,r)}};Ql();rf();var Ay=new Set(["data:","http:","https:"]);async function uu(t,e){return new Promise((r,i)=>{let n=new Pi(t,e),{parsedURL:o,options:a}=K2(n);if(!Ay.has(o.protocol))throw new TypeError(`node-fetch cannot load ${t}. URL scheme "${o.protocol.replace(/:$/,"")}" is not supported.`);if(o.protocol==="data:"){let w=p2(n.url),E=new Ct(w,{headers:{"Content-Type":w.typeFull}});r(E);return}let h=(o.protocol==="https:"?Z2.default:J2.default).request,{signal:d}=n,m=null,p=()=>{let w=new lu("The operation was aborted.");i(w),n.body&&n.body instanceof nr.default.Readable&&n.body.destroy(w),!(!m||!m.body)&&m.body.emit("error",w)};if(d&&d.aborted){p();return}let M=()=>{p(),x()},R=h(o.toString(),a);d&&d.addEventListener("abort",M);let x=()=>{R.abort(),d&&d.removeEventListener("abort",M)};R.on("error",w=>{i(new Ft(`request to ${n.url} failed, reason: ${w.message}`,"system",w)),x()}),Ty(R,w=>{m.body.destroy(w)}),process.version<"v14"&&R.on("socket",w=>{let E;w.prependListener("end",()=>{E=w._eventsCount}),w.prependListener("close",T=>{if(m&&E<w._eventsCount&&!T){let C=new Error("Premature close");C.code="ERR_STREAM_PREMATURE_CLOSE",m.body.emit("error",C)}})}),R.on("response",w=>{R.setTimeout(0);let E=D2(w.rawHeaders);if(ou(w.statusCode)){let B=E.get("Location"),z=null;try{z=B===null?null:new URL(B,n.url)}catch{if(n.redirect!=="manual"){i(new Ft(`uri requested responds with an invalid redirect URL: ${B}`,"invalid-redirect")),x();return}}switch(n.redirect){case"error":i(new Ft(`uri requested responds with a redirect, redirect mode is set to error: ${n.url}`,"no-redirect")),x();return;case"manual":break;case"follow":{if(z===null)break;if(n.counter>=n.follow){i(new Ft(`maximum redirect reached at: ${n.url}`,"max-redirect")),x();return}let H={headers:new Ht(n.headers),follow:n.follow,counter:n.counter+1,agent:n.agent,compress:n.compress,method:n.method,body:xo(n),signal:n.signal,size:n.size,referrer:n.referrer,referrerPolicy:n.referrerPolicy};if(!C2(n.url,z))for(let se of["authorization","www-authenticate","cookie","cookie2"])H.headers.delete(se);if(w.statusCode!==303&&n.body&&e.body instanceof nr.default.Readable){i(new Ft("Cannot follow redirect with body being a readable stream","unsupported-redirect")),x();return}(w.statusCode===303||(w.statusCode===301||w.statusCode===302)&&n.method==="POST")&&(H.method="GET",H.body=void 0,H.headers.delete("content-length"));let J=H2(E);J&&(H.referrerPolicy=J),r(uu(new Pi(z,H))),x();return}default:return i(new TypeError(`Redirect option '${n.redirect}' is not a valid value of RequestRedirect`))}}d&&w.once("end",()=>{d.removeEventListener("abort",M)});let T=(0,nr.pipeline)(w,new nr.PassThrough,B=>{B&&i(B)});process.version<"v12.10"&&w.on("aborted",M);let C={url:n.url,status:w.statusCode,statusText:w.statusMessage,headers:E,size:n.size,counter:n.counter,highWaterMark:n.highWaterMark},I=E.get("Content-Encoding");if(!n.compress||n.method==="HEAD"||I===null||w.statusCode===204||w.statusCode===304){m=new Ct(T,C),r(m);return}let k={flush:ns.default.Z_SYNC_FLUSH,finishFlush:ns.default.Z_SYNC_FLUSH};if(I==="gzip"||I==="x-gzip"){T=(0,nr.pipeline)(T,ns.default.createGunzip(k),B=>{B&&i(B)}),m=new Ct(T,C),r(m);return}if(I==="deflate"||I==="x-deflate"){let B=(0,nr.pipeline)(w,new nr.PassThrough,z=>{z&&i(z)});B.once("data",z=>{(z[0]&15)===8?T=(0,nr.pipeline)(T,ns.default.createInflate(),H=>{H&&i(H)}):T=(0,nr.pipeline)(T,ns.default.createInflateRaw(),H=>{H&&i(H)}),m=new Ct(T,C),r(m)}),B.once("end",()=>{m||(m=new Ct(T,C),r(m))});return}if(I==="br"){T=(0,nr.pipeline)(T,ns.default.createBrotliDecompress(),B=>{B&&i(B)}),m=new Ct(T,C),r(m);return}m=new Ct(T,C),r(m)}),B2(R,n).catch(i)})}function Ty(t,e){let r=s1.Buffer.from(`0\r
132
+ `))}};z6.exports=od});var $6=V((aP,j6)=>{"use strict";var Hx=U6(),oh={STATIC:0,PARAMETRIC:1,WILDCARD:2},rh=class{constructor(){this.handlerStorage=new Hx}},ih=class extends rh{constructor(){super(),this.staticChildren={}}findStaticMatchingChild(e,r){let i=this.staticChildren[e.charAt(r)];return i===void 0||!i.matchPrefix(e,r)?null:i}createStaticChild(e){if(e.length===0)return this;let r=this.staticChildren[e.charAt(0)];if(r){let n=1;for(;n<r.prefix.length;n++)if(e.charCodeAt(n)!==r.prefix.charCodeAt(n)){r=r.split(this,n);break}return r.createStaticChild(e.slice(n))}let i=e.charAt(0);return this.staticChildren[i]=new sa(e),this.staticChildren[i]}},sa=class extends ih{constructor(e){super(),this.prefix=e,this.wildcardChild=null,this.parametricChildren=[],this.kind=oh.STATIC,this._compilePrefixMatch()}createParametricChild(e){let r=e&&e.source,i=this.parametricChildren.find(n=>(n.regex&&n.regex.source)===r);return i||(i=new nh(e),e?this.parametricChildren.unshift(i):this.parametricChildren.push(i),i)}createWildcardChild(){return this.wildcardChild?this.wildcardChild:(this.wildcardChild=new sh,this.wildcardChild)}split(e,r){let i=this.prefix.slice(0,r),n=this.prefix.slice(r);this.prefix=n,this._compilePrefixMatch();let o=new sa(i);return o.staticChildren[n.charAt(0)]=this,e.staticChildren[i.charAt(0)]=o,o}getNextNode(e,r,i,n){let o=this.findStaticMatchingChild(e,r),a=0;if(o===null){if(this.parametricChildren.length===0)return this.wildcardChild;o=this.parametricChildren[0],a=1}this.wildcardChild!==null&&i.push({paramsCount:n,brotherPathIndex:r,brotherNode:this.wildcardChild});for(let h=this.parametricChildren.length-1;h>=a;h--)i.push({paramsCount:n,brotherPathIndex:r,brotherNode:this.parametricChildren[h]});return o}_compilePrefixMatch(){if(this.prefix.length===1){this.matchPrefix=()=>!0;return}let e=[];for(let r=1;r<this.prefix.length;r++){let i=this.prefix.charCodeAt(r);e.push(`path.charCodeAt(i + ${r}) === ${i}`)}this.matchPrefix=new Function("path","i",`return ${e.join(" && ")}`)}},nh=class extends ih{constructor(e){super(),this.regex=e||null,this.isRegex=!!e,this.kind=oh.PARAMETRIC}getNextNode(e,r){return this.findStaticMatchingChild(e,r)}},sh=class extends rh{constructor(){super(),this.kind=oh.WILDCARD}getNextNode(){return null}};j6.exports={StaticNode:sa,ParametricNode:nh,WildcardNode:sh,NODE_TYPES:oh}});var F6=V((lP,q6)=>{"use strict";var Gx=require("assert");function I1(){if(!(this instanceof I1))return new I1;this.store={},this.maxMajor=0,this.maxMinors={},this.maxPatches={}}I1.prototype.set=function(t,e){if(typeof t!="string")throw new TypeError("Version should be a string");let[r,i,n]=t.split(".");return r=Number(r)||0,i=Number(i)||0,n=Number(n)||0,r>=this.maxMajor&&(this.maxMajor=r,this.store.x=e,this.store["*"]=e,this.store["x.x"]=e,this.store["x.x.x"]=e),i>=(this.maxMinors[r]||0)&&(this.maxMinors[r]=i,this.store[`${r}.x`]=e,this.store[`${r}.x.x`]=e),n>=(this.store[`${r}.${i}`]||0)&&(this.maxPatches[`${r}.${i}`]=n,this.store[`${r}.${i}.x`]=e),this.store[`${r}.${i}.${n}`]=e,this};I1.prototype.get=function(t){return this.store[t]};q6.exports={name:"version",mustMatchWhenDerived:!0,storage:I1,validate(t){Gx(typeof t=="string","Version should be a string")}}});var H6=V((uP,W6)=>{"use strict";var Vx=require("assert");function Kx(){let t={},e=[];return{get:r=>{let i=t[r];if(i)return i;for(let n of e)if(n.host.test(r))return n.value},set:(r,i)=>{r instanceof RegExp?e.push({host:r,value:i}):t[r]=i}}}W6.exports={name:"host",mustMatchWhenDerived:!1,storage:Kx,validate(t){Vx(typeof t=="string"||Object.prototype.toString.call(t)==="[object RegExp]","Host should be a string or a RegExp")}}});var V6=V((hP,G6)=>{"use strict";var Jx=F6(),Zx=H6(),ad=require("assert"),ld=class{constructor(e){if(this.strategies={version:Jx,host:Zx},this.strategiesInUse=new Set,e)for(let r of Object.values(e))this.addConstraintStrategy(r)}hasConstraintStrategy(e){let r=this.strategies[e];return r!==void 0?r.isCustom||this.strategiesInUse.has(e):!1}addConstraintStrategy(e){if(ad(typeof e.name=="string"&&e.name!=="","strategy.name is required."),ad(e.storage&&typeof e.storage=="function","strategy.storage function is required."),ad(e.deriveConstraint&&typeof e.deriveConstraint=="function","strategy.deriveConstraint function is required."),this.strategies[e.name]&&this.strategies[e.name].isCustom)throw new Error(`There already exists a custom constraint with the name ${e.name}.`);if(this.strategiesInUse.has(e.name))throw new Error(`There already exists a route with ${e.name} constraint.`);e.isCustom=!0,this.strategies[e.name]=e,e.mustMatchWhenDerived&&this.noteUsage({[e.name]:e})}deriveConstraints(e,r){}noteUsage(e){if(e){let r=this.strategiesInUse.size;for(let i in e)this.strategiesInUse.add(i);r!==this.strategiesInUse.size&&this._buildDeriveConstraints()}}newStoreForConstraint(e){if(!this.strategies[e])throw new Error(`No strategy registered for constraint key ${e}`);return this.strategies[e].storage()}validateConstraints(e){for(let r in e){let i=e[r];if(typeof i>"u")throw new Error("Can't pass an undefined constraint value, must pass null or no key at all");let n=this.strategies[r];if(!n)throw new Error(`No strategy registered for constraint key ${r}`);n.validate&&n.validate(i)}}_buildDeriveConstraints(){if(this.strategiesInUse.size===0)return;let e=["return {"];for(let r of this.strategiesInUse){let i=this.strategies[r];if(i.isCustom)e.push(` ${i.name}: this.strategies.${r}.deriveConstraint(req, ctx),`);else if(r==="version")e.push(" version: req.headers['accept-version'],");else if(r==="host")e.push(" host: req.headers.host || req.headers[':authority'],");else throw new Error("unknown non-custom strategy for compiling constraint derivation function")}e.push("}"),this.deriveConstraints=new Function("req","ctx",e.join(`
133
+ `)).bind(this)}};G6.exports=ld});var Z6=V((cP,J6)=>{"use strict";function K6(t,e){return t===50?e===53?"%":e===51?"#":e===52?"$":e===54?"&":e===66||e===98?"+":e===67||e===99?",":e===70||e===102?"/":null:t===51?e===65||e===97?":":e===66||e===98?";":e===68||e===100?"=":e===70||e===102?"?":null:t===52&&e===48?"@":null}function Yx(t){let e=!1,r=!1,i="";for(let o=1;o<t.length;o++){let a=t.charCodeAt(o);if(a===37){let h=t.charCodeAt(o+1),d=t.charCodeAt(o+2);K6(h,d)===null?e=!0:(r=!0,h===50&&d===53&&(e=!0,t=t.slice(0,o+1)+"25"+t.slice(o+1),o+=2),o+=2)}else if(a===63||a===59||a===35){i=t.slice(o+1),t=t.slice(0,o);break}}return{path:e?decodeURI(t):t,querystring:i,shouldDecodeParam:r}}function Xx(t){let e=t.indexOf("%");if(e===-1)return t;let r="",i=e;for(let n=e;n<t.length;n++)if(t.charCodeAt(n)===37){let o=t.charCodeAt(n+1),a=t.charCodeAt(n+2),h=K6(o,a);r+=t.slice(i,n)+h,i=n+3}return t.slice(0,e)+r+t.slice(i)}J6.exports={safeDecodeURI:Yx,safeDecodeURIComponent:Xx}});var r4=V((fP,t4)=>{"use strict";var ut=require("assert"),ah=require("http"),Qx=require("querystring"),cd=R6(),Q6=A6(),{flattenNode:eS,compressFlattenedNode:tS,prettyPrintFlattenedNode:rS,prettyPrintRoutesArray:iS}=D6(),{StaticNode:Y6,NODE_TYPES:ud}=$6(),nS=V6(),{safeDecodeURI:sS,safeDecodeURIComponent:X6}=Z6(),fd=ah.METHODS,e4=/^https?:\/\/.*?\//,xs=/(\/:[^/()]*?)\?(\/?)/;if(!cd(e4))throw new Error("the FULL_PATH_REGEXP is not safe, update this module");if(!cd(xs))throw new Error("the OPTIONAL_PARAM_REGEXP is not safe, update this module");function ht(t){if(!(this instanceof ht))return new ht(t);t=t||{},t.defaultRoute?(ut(typeof t.defaultRoute=="function","The default route must be a function"),this.defaultRoute=t.defaultRoute):this.defaultRoute=null,t.onBadUrl?(ut(typeof t.onBadUrl=="function","The bad url handler must be a function"),this.onBadUrl=t.onBadUrl):this.onBadUrl=null,t.buildPrettyMeta?(ut(typeof t.buildPrettyMeta=="function","buildPrettyMeta must be a function"),this.buildPrettyMeta=t.buildPrettyMeta):this.buildPrettyMeta=uS,t.querystringParser?(ut(typeof t.querystringParser=="function","querystringParser must be a function"),this.querystringParser=t.querystringParser):this.querystringParser=e=>e===""?{}:Qx.parse(e),this.caseSensitive=t.caseSensitive===void 0?!0:t.caseSensitive,this.ignoreTrailingSlash=t.ignoreTrailingSlash||!1,this.ignoreDuplicateSlashes=t.ignoreDuplicateSlashes||!1,this.maxParamLength=t.maxParamLength||100,this.allowUnsafeRegex=t.allowUnsafeRegex||!1,this.routes=[],this.trees={},this.constrainer=new nS(t.constraints),this._routesPatterns=[]}ht.prototype.on=function(e,r,i,n,o){typeof i=="function"&&(n!==void 0&&(o=n),n=i,i={}),ut(typeof r=="string","Path should be a string"),ut(r.length>0,"The path could not be empty"),ut(r[0]==="/"||r[0]==="*","The first character of a path should be `/` or `*`"),ut(typeof n=="function","Handler should be a function");let a=r.match(xs);if(a){ut(r.length===a.index+a[0].length,"Optional Parameter needs to be the last parameter of the path");let m=r.replace(xs,"$1$2"),p=r.replace(xs,"$2");this.on(e,m,i,n,o),this.on(e,p,i,n,o);return}let h=r;this.ignoreDuplicateSlashes&&(r=dd(r)),this.ignoreTrailingSlash&&(r=md(r));let d=Array.isArray(e)?e:[e];for(let m of d)this._on(m,r,i,n,o,h),this.routes.push({method:m,path:r,opts:i,handler:n,store:o})};ht.prototype._on=function(e,r,i,n,o){ut(typeof e=="string","Method should be a string"),ut(fd.includes(e),`Method '${e}' is not an http method.`);let a={};if(i.constraints!==void 0&&(ut(typeof i.constraints=="object"&&i.constraints!==null,"Constraints should be an object"),Object.keys(i.constraints).length!==0&&(a=i.constraints)),this.constrainer.validateConstraints(a),this.constrainer.noteUsage(a),this.trees[e]===void 0&&(this.trees[e]=new Y6("/")),r==="*"&&this.trees[e].prefix.length!==0){let p=this.trees[e];this.trees[e]=new Y6(""),this.trees[e].staticChildren["/"]=p}let h=this.trees[e],d=h.prefix.length,m=[];for(let p=0;p<=r.length;p++){if(r.charCodeAt(p)===58&&r.charCodeAt(p+1)===58){p++;continue}let M=r.charCodeAt(p)===58&&r.charCodeAt(p+1)!==58,R=r.charCodeAt(p)===42;if(M||R||p===r.length&&p!==d){let x=r.slice(d,p);this.caseSensitive||(x=x.toLowerCase()),x=x.split("::").join(":"),x=x.split("%").join("%25"),h=h.createStaticChild(x)}if(M){let x=!1,w=[],E=0,T=p+1;for(let I=T;;I++){let k=r.charCodeAt(I);if(k===40||k===45||k===46){x=!0;let B=r.slice(T,I);if(m.push(B),k===40){let J=lS(r,I),se=r.slice(I,J+1);this.allowUnsafeRegex||ut(cd(new RegExp(se)),`The regex '${se}' is not safe!`),w.push(aS(se)),I=J+1}else w.push("(.*?)");let z=I;for(;z<r.length;z++){let J=r.charCodeAt(z);if(J===58||J===47)break}let H=r.slice(I,z);H&&w.push(oS(H)),T=z+1,I=z,(r.charCodeAt(I)===47||I===r.length)&&(E=H.length)}else if(k===47||I===r.length){let B=r.slice(T,I);m.push(B),w.length!==0&&w.push("(.*?)")}if(r.charCodeAt(I)===47||I===r.length){r=r.slice(0,p+1)+r.slice(I-E),p+=E;break}}let C=null;x&&(C=new RegExp("^"+w.join("")+"$")),h=h.createParametricChild(C),d=p+1}else R&&(m.push("*"),h=h.createWildcardChild(),d=p+1)}this.caseSensitive||(r=r.toLowerCase());for(let p of this._routesPatterns)if(p.path===r&&p.method===e&&Q6(p.constraints,a))throw new Error(`Method '${e}' already declared for route '${r}' with constraints '${JSON.stringify(a)}'`);this._routesPatterns.push({method:e,path:r,constraints:a}),h.handlerStorage.addHandler(n,m,o,this.constrainer,a)};ht.prototype.hasConstraintStrategy=function(t){return this.constrainer.hasConstraintStrategy(t)};ht.prototype.addConstraintStrategy=function(t){this.constrainer.addConstraintStrategy(t),this._rebuild(this.routes)};ht.prototype.reset=function(){this.trees={},this.routes=[],this._routesPatterns=[]};ht.prototype.off=function(e,r,i){ut(typeof r=="string","Path should be a string"),ut(r.length>0,"The path could not be empty"),ut(r[0]==="/"||r[0]==="*","The first character of a path should be `/` or `*`");let n=r.match(xs);if(n){ut(r.length===n.index+n[0].length,"Optional Parameter needs to be the last parameter of the path");let a=r.replace(xs,"$1$2"),h=r.replace(xs,"$2");this.off(e,a,i),this.off(e,h,i);return}this.ignoreDuplicateSlashes&&(r=dd(r)),this.ignoreTrailingSlash&&(r=md(r));let o=Array.isArray(e)?e:[e];for(let a of o)this._off(a,r,i)};ht.prototype._off=function(e,r,i){ut(typeof e=="string","Method should be a string"),ut(fd.includes(e),`Method '${e}' is not an http method.`);function n(a){return!i||!a?!0:Q6(i,a)}let o=this.routes.filter(a=>e!==a.method||r!==a.path||!n(a.opts.constraints));this._rebuild(o)};ht.prototype.lookup=function(e,r,i){var n=this.find(e.method,e.url,this.constrainer.deriveConstraints(e,i));return n===null?this._defaultRoute(e,r,i):i===void 0?n.handler(e,r,n.params,n.store,n.searchParams):n.handler.call(i,e,r,n.params,n.store,n.searchParams)};ht.prototype.find=function(e,r,i){let n=this.trees[e];if(n===void 0)return null;r.charCodeAt(0)!==47&&(r=r.replace(e4,"/")),this.ignoreDuplicateSlashes&&(r=dd(r));let o,a,h;try{o=sS(r),r=o.path,a=o.querystring,h=o.shouldDecodeParam}catch{return this._onBadUrl(r)}this.ignoreTrailingSlash&&(r=md(r));let d=r;this.caseSensitive===!1&&(r=r.toLowerCase());let m=this.maxParamLength,p=n.prefix.length,M=[],R=r.length,x=[];for(;;){if(p===R){let E=n.handlerStorage.getMatchingHandler(i);if(E!==null)return{handler:E.handler,store:E.store,params:E._createParamsObject(M),searchParams:this.querystringParser(a)}}let w=n.getNextNode(r,p,x,M.length);if(w===null){if(x.length===0)return null;let E=x.pop();p=E.brotherPathIndex,M.splice(E.paramsCount),w=E.brotherNode}if(n=w,n.kind===ud.STATIC){p+=n.prefix.length;continue}if(n.kind===ud.WILDCARD){let E=d.slice(p);h&&(E=X6(E)),M.push(E),p=R;continue}if(n.kind===ud.PARAMETRIC){let E=d.indexOf("/",p);E===-1&&(E=R);let T=d.slice(p,E);if(h&&(T=X6(T)),n.isRegex){let C=n.regex.exec(T);if(C===null)continue;for(let I=1;I<C.length;I++){let k=C[I];if(k.length>m)return null;M.push(k)}}else{if(T.length>m)return null;M.push(T)}p=E}}};ht.prototype._rebuild=function(t){this.reset();for(let e of t){let{method:r,path:i,opts:n,handler:o,store:a}=e;this._on(r,i,n,o,a),this.routes.push({method:r,path:i,opts:n,handler:o,store:a})}};ht.prototype._defaultRoute=function(t,e,r){if(this.defaultRoute!==null)return r===void 0?this.defaultRoute(t,e):this.defaultRoute.call(r,t,e);e.statusCode=404,e.end()};ht.prototype._onBadUrl=function(t){if(this.onBadUrl===null)return null;let e=this.onBadUrl;return{handler:(r,i,n)=>e(t,r,i),params:{},store:null}};ht.prototype.prettyPrint=function(t={}){if(t.commonPrefix=t.commonPrefix===void 0?!0:t.commonPrefix,!t.commonPrefix)return iS.call(this,this.routes,t);let e={prefix:"/",nodes:[],children:{}};for(let r in this.trees){let i=this.trees[r];i&&eS(e,i,r)}return tS(e),rS.call(this,e,"",!0,t)};for(hd in ah.METHODS){if(!ah.METHODS.hasOwnProperty(hd))continue;let t=ah.METHODS[hd],e=t.toLowerCase();if(ht.prototype[e])throw new Error("Method already exists: "+e);ht.prototype[e]=function(r,i,n){return this.on(t,r,i,n)}}var hd;ht.prototype.all=function(t,e,r){this.on(fd,t,e,r)};t4.exports=ht;function oS(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function dd(t){return t.replace(/\/\/+/g,"/")}function md(t){return t.length>1&&t.charCodeAt(t.length-1)===47?t.slice(0,-1):t}function aS(t){return t.charCodeAt(1)===94&&(t=t.slice(0,1)+t.slice(2)),t.charCodeAt(t.length-2)===36&&(t=t.slice(0,t.length-2)+t.slice(t.length-1)),t}function lS(t,e){for(var r=1;e<t.length;){if(e++,t[e]==="\\"){e++;continue}if(t[e]===")"?r--:t[e]==="("&&r++,!r)return e}throw new TypeError('Invalid regexp expression in "'+t+'"')}function uS(t){return t?t.store?Object.assign({},t.store):{}:{}}});var wd=V(vd=>{vd.read=function(t,e,r,i,n){var o,a,h=n*8-i-1,d=(1<<h)-1,m=d>>1,p=-7,M=r?n-1:0,R=r?-1:1,x=t[e+M];for(M+=R,o=x&(1<<-p)-1,x>>=-p,p+=h;p>0;o=o*256+t[e+M],M+=R,p-=8);for(a=o&(1<<-p)-1,o>>=-p,p+=i;p>0;a=a*256+t[e+M],M+=R,p-=8);if(o===0)o=1-m;else{if(o===d)return a?NaN:(x?-1:1)*(1/0);a=a+Math.pow(2,i),o=o-m}return(x?-1:1)*a*Math.pow(2,o-i)};vd.write=function(t,e,r,i,n,o){var a,h,d,m=o*8-n-1,p=(1<<m)-1,M=p>>1,R=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=i?0:o-1,w=i?1:-1,E=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(h=isNaN(e)?1:0,a=p):(a=Math.floor(Math.log(e)/Math.LN2),e*(d=Math.pow(2,-a))<1&&(a--,d*=2),a+M>=1?e+=R/d:e+=R*Math.pow(2,1-M),e*d>=2&&(a++,d/=2),a+M>=p?(h=0,a=p):a+M>=1?(h=(e*d-1)*Math.pow(2,n),a=a+M):(h=e*Math.pow(2,M-1)*Math.pow(2,n),a=0));n>=8;t[r+x]=h&255,x+=w,h/=256,n-=8);for(a=a<<n|h,m+=n;m>0;t[r+x]=a&255,x+=w,a/=256,m-=8);t[r+x-w]|=E*128}});var L4=V((SN,k4)=>{"use strict";k4.exports=IS;var TS={threshold:.1,includeAA:!1,alpha:.1,aaColor:[255,255,0],diffColor:[255,0,0],diffColorAlt:null,diffMask:!1};function IS(t,e,r,i,n,o){if(!Bd(t)||!Bd(e)||r&&!Bd(r))throw new Error("Image data: Uint8Array, Uint8ClampedArray or Buffer expected.");if(t.length!==e.length||r&&r.length!==t.length)throw new Error("Image sizes do not match.");if(t.length!==i*n*4)throw new Error("Image data size does not match width/height.");o=Object.assign({},TS,o);let a=i*n,h=new Uint32Array(t.buffer,t.byteOffset,a),d=new Uint32Array(e.buffer,e.byteOffset,a),m=!0;for(let R=0;R<a;R++)if(h[R]!==d[R]){m=!1;break}if(m){if(r&&!o.diffMask)for(let R=0;R<a;R++)P4(t,4*R,o.alpha,r);return 0}let p=35215*o.threshold*o.threshold,M=0;for(let R=0;R<n;R++)for(let x=0;x<i;x++){let w=(R*i+x)*4,E=O4(t,e,w,w);Math.abs(E)>p?!o.includeAA&&(A4(t,x,R,i,n,e)||A4(e,x,R,i,n,t))?r&&!o.diffMask&&zd(r,w,...o.aaColor):(r&&zd(r,w,...E<0&&o.diffColorAlt||o.diffColor),M++):r&&(o.diffMask||P4(t,w,o.alpha,r))}return M}function Bd(t){return ArrayBuffer.isView(t)&&t.constructor.BYTES_PER_ELEMENT===1}function A4(t,e,r,i,n,o){let a=Math.max(e-1,0),h=Math.max(r-1,0),d=Math.min(e+1,i-1),m=Math.min(r+1,n-1),p=(r*i+e)*4,M=e===a||e===d||r===h||r===m?1:0,R=0,x=0,w,E,T,C;for(let I=a;I<=d;I++)for(let k=h;k<=m;k++){if(I===e&&k===r)continue;let B=O4(t,t,p,(k*i+I)*4,!0);if(B===0){if(M++,M>2)return!1}else B<R?(R=B,w=I,E=k):B>x&&(x=B,T=I,C=k)}return R===0||x===0?!1:Oh(t,w,E,i,n)&&Oh(o,w,E,i,n)||Oh(t,T,C,i,n)&&Oh(o,T,C,i,n)}function Oh(t,e,r,i,n){let o=Math.max(e-1,0),a=Math.max(r-1,0),h=Math.min(e+1,i-1),d=Math.min(r+1,n-1),m=(r*i+e)*4,p=e===o||e===h||r===a||r===d?1:0;for(let M=o;M<=h;M++)for(let R=a;R<=d;R++){if(M===e&&R===r)continue;let x=(R*i+M)*4;if(t[m]===t[x]&&t[m+1]===t[x+1]&&t[m+2]===t[x+2]&&t[m+3]===t[x+3]&&p++,p>2)return!0}return!1}function O4(t,e,r,i,n){let o=t[r+0],a=t[r+1],h=t[r+2],d=t[r+3],m=e[i+0],p=e[i+1],M=e[i+2],R=e[i+3];if(d===R&&o===m&&a===p&&h===M)return 0;d<255&&(d/=255,o=Rs(o,d),a=Rs(a,d),h=Rs(h,d)),R<255&&(R/=255,m=Rs(m,R),p=Rs(p,R),M=Rs(M,R));let x=Dd(o,a,h),w=Dd(m,p,M),E=x-w;if(n)return E;let T=T4(o,a,h)-T4(m,p,M),C=I4(o,a,h)-I4(m,p,M),I=.5053*E*E+.299*T*T+.1957*C*C;return x>w?-I:I}function Dd(t,e,r){return t*.29889531+e*.58662247+r*.11448223}function T4(t,e,r){return t*.59597799-e*.2741761-r*.32180189}function I4(t,e,r){return t*.21147017-e*.52261711+r*.31114694}function Rs(t,e){return 255+(t-255)*e}function zd(t,e,r,i,n){t[e+0]=r,t[e+1]=i,t[e+2]=n,t[e+3]=255}function P4(t,e,r,i){let n=t[e+0],o=t[e+1],a=t[e+2],h=Rs(Dd(n,o,a),r*t[e+3]/255);zd(i,e,h,h,h)}});var HS={};Yd(HS,{handler:()=>Ye});module.exports=Zg(HS);var qt;(function(t){t.Imagery="im",t.TileSet="ts",t.Provider="pv",t.ImageryRule="ir",t.Style="st",t.ProcessingJob="pj",t.ConfigBundle="cb"})(qt||(qt={}));var e2=new Set(Object.values(qt));var vt;(function(t){t.Raster="raster",t.Vector="vector"})(vt||(vt={}));var $l=class{get TileSet(){return this.cfg.TileSet}get Imagery(){return this.cfg.Imagery}get Style(){return this.cfg.Style}get Provider(){return this.cfg.Provider}get ProcessingJob(){return this.cfg.ProcessingJob}get ConfigBundle(){return this.cfg.ConfigBundle}setConfigProvider(e){this.cfg=e}isTileSetRaster(e){return e==null?!1:e.type==null||e.type===vt.Raster}isTileSetVector(e){return e==null?!1:e.type===vt.Vector}async getAllImagery(e,r){let i=new Set;for(let n of r)for(let o of e){let a=o[n.code];a&&i.add(this.Imagery.id(a))}return this.Imagery.getAll(i)}prefix(e,r){return r===""||r.startsWith(e)?r:`${e}_${r}`}getPrefix(e){let r=e.indexOf("_");if(r===-1)return null;let i=e.slice(0,r);return e2.has(i)?i:null}unprefix(e,r){return r.startsWith(e)?r.slice(3):r}},co=class{},Ga=class{constructor(e){this.prefix=e}isWriteable(){return!1}id(e){return e.startsWith(`${this.prefix}_`)?e:`${this.prefix}_${e}`}is(e){return e!=null&&e.id.startsWith(this.prefix)}},we=new $l;var Vc;(function(t){t.Processing="processing",t.Complete="complete",t.Fail="failed"})(Vc||(Vc={}));var t2=de(require("aws-sdk/clients/dynamodb.js"),1);var fo=de(require("aws-sdk/clients/dynamodb.js"),1);function Yg(t){return{id:{S:t}}}var Mi=class extends Ga{constructor(e,r){super(r),this.cfg=e}ensureId(e){if(e.startsWith(this.prefix+"_"))return e;throw new Error(`Trying to query "${e}" expected prefix of ${this.prefix}`)}get db(){return this.cfg.dynamo}isWriteable(){return!0}clone(e){return fo.default.Converter.unmarshall(fo.default.Converter.marshall(e))}async get(e){let r=await this.db.getItem({Key:{id:{S:this.ensureId(e)}},TableName:this.cfg.tableName}).promise();if(r==null||r.Item==null)return null;let i=fo.default.Converter.unmarshall(r.Item);return this.is(i)?i:null}async getAll(e){var r;let i=[];for(let o of e)i.push(Yg(this.ensureId(o)));let n=new Map;for(;i.length>0;){let o=i.length>100?i.slice(0,100):i;i=i.length>100?i.slice(100):[];let a={[this.cfg.tableName]:{Keys:o}};for(;a!=null&&Object.keys(a).length>0;){let h=await this.db.batchGetItem({RequestItems:a}).promise(),d=(r=h.Responses)===null||r===void 0?void 0:r[this.cfg.tableName];if(d==null)throw new Error("Failed to fetch from "+this.cfg.tableName);for(let m of d){let p=fo.default.Converter.unmarshall(m);this.is(p)&&n.set(p.id,p)}a=h.UnprocessedKeys}}return n}async put(e){return e.updatedAt=Date.now(),await this.db.putItem({TableName:this.cfg.tableName,Item:fo.default.Converter.marshall(e)}).promise(),e.id}};var mo=class extends Mi{constructor(){super(...arguments),this.cache=new Map}async get(e){let r=this.ensureId(e),i=this.cache.get(r);if(i==null){if(i=await super.get(r),i==null)return null;this.cache.set(r,i)}return i}async getAll(e){let r=new Map,i=new Set;for(let n of e){let o=this.ensureId(n),a=this.cache.get(o);a==null?i.add(o):r.set(o,a)}if(i.size>0){let n=await super.getAll(i);for(let o of n.values())r.set(o.id,o),this.cache.set(o.id,o)}return r}};var Va=class extends co{constructor(e){super(),this.Prefix=qt,this.type="dynamo",this.Imagery=new mo(this,qt.Imagery),this.Style=new mo(this,qt.Style),this.TileSet=new Mi(this,qt.TileSet),this.Provider=new mo(this,qt.Provider),this.ProcessingJob=new Mi(this,qt.ProcessingJob),this.ConfigBundle=new Mi(this,qt.ConfigBundle),this.dynamo=new t2.default({region:"ap-southeast-2"}),this.tableName=e}record(){let e=Date.now();return{id:"",name:"",updatedAt:e}}};var _e=class{constructor(e,r,i,n){this.x=e,this.y=r,this.width=i,this.height=n}get bottom(){return this.y+this.height}get right(){return this.x+this.width}intersects(e){return this.x<e.right&&e.x<this.right&&this.y<e.bottom&&e.y<this.bottom}containsBounds(e){return _e.contains(this,e)}intersection(e){let r=Math.max(this.x,e.x),i=Math.min(this.x+this.width,e.x+e.width),n=Math.max(this.y,e.y),o=Math.min(this.y+this.height,e.y+e.height);return i>r&&o>n?new _e(r,n,i-r,o-n):null}static union(e){if(e.length===0)throw new Error("Union on empty list is not allowed");let{x:r,y:i}=e[0],n=r+e[0].width,o=i+e[0].height;for(let a=1;a<e.length;++a){let h=e[a];r=Math.min(r,h.x),n=Math.max(n,h.x+h.width),i=Math.min(i,h.y),o=Math.max(o,h.y+h.height)}return new _e(r,i,n-r,o-i)}union(e){return _e.union([this,e])}toJson(){return{x:this.x,y:this.y,width:this.width,height:this.height}}toBbox(){return[this.x,this.y,this.right,this.bottom]}toPolygon(){return[[[this.x,this.y],[this.x,this.bottom],[this.right,this.bottom],[this.right,this.y],[this.x,this.y]]]}scale(e,r=e){return new _e(this.x*e,this.y*r,this.width*e,this.height*r)}scaleFromCenter(e,r=e){let i=this.width*e,n=this.height*r;return new _e(this.x-.5*(i-this.width),this.y-.5*(n-this.height),i,n)}pad(e,r=e){return new _e(this.x-e,this.y-r,this.width+e*2,this.height+r*2)}round(e=0){let r=Math.round(this.x-e),i=Math.round(this.y-e);return new _e(r,i,Math.round(this.right+e)-r,Math.round(this.bottom+e)-i)}add(e){return new _e(this.x+e.x,this.y+e.y,this.width,this.height)}subtract(e){return new _e(this.x-e.x,this.y-e.y,this.width,this.height)}static fromMultiPolygon(e){if(e.length===0)return new _e(0,0,0,0);let r=e[0][0][0][0],i=e[0][0][0][1],n=r,o=i;for(let[a]of e)for(let[h,d]of a)h<r?r=h:h>n&&(n=h),d<i?i=d:d>o&&(o=d);return new _e(r,i,n-r,o-i)}static fromBbox([e,r,i,n]){return new _e(Math.min(e,i),Math.min(r,n),Math.abs(i-e),Math.abs(n-r))}static fromUpperLeftLowerRight(e,r){return new _e(e.x,e.y,r.x-e.x,r.y-e.y)}static fromJson(e){return new _e(e.x,e.y,e.width,e.height)}static compareArea(e,r){let i=e.width*e.height-r.width*r.height;if(i!==0)return i;let n=e.x-r.x;return n===0?e.y-r.y:n}static contains(e,r){return e.x<=r.x&&e.x+e.width>=r.x+r.width&&e.y<=r.y&&e.y+e.height>=r.y+r.height}};var We;(function(t){t[t.Google=3857]="Google",t[t.Wgs84=4326]="Wgs84",t[t.Nztm2000=2193]="Nztm2000",t[t.Citm2000=3793]="Citm2000"})(We||(We={}));var Kc={google:We.Google,epsg3857:We.Google,[We.Google]:We.Google,globalmercator:We.Google,wgs84:We.Wgs84,epsg4326:We.Wgs84,[We.Wgs84]:We.Wgs84,nztm:We.Nztm2000,epsg2193:We.Nztm2000,[We.Nztm2000]:We.Nztm2000,nztm2000:We.Nztm2000,citm:We.Citm2000,epsg3793:We.Citm2000,[We.Citm2000]:We.Citm2000,citm2000:We.Citm2000},Re=class{constructor(e){if(this.code=e,Re.Codes.has(e))throw new Error(`Duplicate EPSG code created: ${e}`);Re.Codes.set(this.code,this)}toString(){return this.code.toString()}toJSON(){return this.code}toEpsgString(){return`EPSG:${this.code}`}toUrn(){return`urn:ogc:def:crs:EPSG::${this.code}`}static get(e){let r=Re.Codes.get(e);if(r==null)throw new Error(`Invalid EPSG:${e}`);return r}static tryGet(e){if(e!=null)return Re.Codes.get(e)}static parseCode(e){var r;return e.startsWith("urn:")?Kc[e.slice(e.lastIndexOf(":")+1)]:e.startsWith("https://")?Kc[e.slice(e.lastIndexOf("/")+1)]:(r=Kc[e.replace(/[\W_]/g,"").toLowerCase()])!==null&&r!==void 0?r:null}static parse(e){let r=Re.parseCode(e);return r==null?null:Re.get(r)}};Re.Codes=new Map;Re.Google=new Re(We.Google);Re.Wgs84=new Re(We.Wgs84);Re.Nztm2000=new Re(We.Nztm2000);Re.Citm2000=new Re(We.Citm2000);var hM="0".charCodeAt(0),cM="1".charCodeAt(0),fM="2".charCodeAt(0),dM="3".charCodeAt(0);var po;(function(t){t[t.Xy=0]="Xy",t[t.Yx=1]="Yx"})(po||(po={}));function r2(t){return t===Re.Nztm2000?po.Yx:po.Xy}function Xg(t,e){return e.scaleDenominator-t.scaleDenominator}var Mt=class{constructor(e){this.zooms=[],this.indexX=0,this.indexY=1,this.zoomConversionMap=new Map,this.def=e,this.tileSize=e.tileMatrix[0].tileHeight;let r=e.tileMatrix.slice().sort(Xg),i={};for(let m of r){if(i[m.identifier])throw new Error(`Duplicate tileMatrix identifier ${m.identifier}`);if(m.tileHeight!==m.tileWidth)throw new Error("Only square tiles supported");if(m.tileHeight!==this.tileSize)throw new Error("All tiles must have the same tile size");i[m.identifier]=!0}this.zooms=r;let n=Re.parse(e.supportedCRS);if(n==null)throw new Error(`Unable to find supported projection ${e.supportedCRS}`);this.projection=n,r2(this.projection)===po.Yx&&(this.indexX=1,this.indexY=0);let{lowerCorner:o,upperCorner:a}=e.boundingBox,h=o[this.indexX],d=o[this.indexY];this.extent=new _e(h,d,a[this.indexX]-h,a[this.indexY]-d)}get maxZoom(){return this.zooms.length-1}get identifier(){return this.def.identifier}pixelScale(e){let r=this.zooms[e];if(r==null)throw new Error(`Zoom not found :${e}`);return r.scaleDenominator*28e-5}tileToPixels(e,r){return{x:e*this.tileSize,y:r*this.tileSize}}pixelsToTile(e,r,i){let n=Math.floor(e/this.tileSize),o=Math.floor(r/this.tileSize);return{x:n,y:o,z:i}}sourceToPixels(e,r,i){let n=this.zooms[i],o=this.pixelScale(i),a=(e-n.topLeftCorner[this.indexX])/o,h=(n.topLeftCorner[this.indexY]-r)/o;return{x:a,y:h}}pixelsToSource(e,r,i){let n=this.zooms[i],o=this.pixelScale(i),a=n.topLeftCorner[this.indexX]+e*o,h=n.topLeftCorner[this.indexY]-r*o;return{x:a,y:h}}tileToSource(e){let r=this.tileToPixels(e.x,e.y);return this.pixelsToSource(r.x,r.y,e.z)}tileToSourceBounds(e){let r=this.tileToSource(e),i=this.pixelScale(e.z)*this.tileSize;return new _e(r.x,r.y-i,i,i)}*topLevelTiles(){let{matrixWidth:r,matrixHeight:i}=this.zooms[0];for(let n=0;n<i;++n)for(let o=0;o<r;++o)yield{x:o,y:n,z:0};return null}*coverTile(e){if(e==null)return yield*this.topLevelTiles(),null;let r=e.z+1,{matrixWidth:i,matrixHeight:n}=this.zooms[e.z],{matrixWidth:o,matrixHeight:a}=this.zooms[r],h=o/i,d=a/n,m=Math.floor(e.x*h),p=Math.floor(e.y*d),M=Math.ceil((e.x+1)*h),R=Math.ceil((e.y+1)*d);for(let x=p;x<R;++x)for(let w=m;w<M;++w)yield{x:w,y:x,z:r};return null}static tileToName(e){return`${e.z}-${e.x}-${e.y}`}static nameToTile(e){let r=e.split("-");if(r.length===3){let i=Number(r[0]),n=Number(r[1]),o=Number(r[2]);if(!(isNaN(i)||isNaN(o)||isNaN(n)))return{x:n,y:o,z:i}}throw new Error(`Invalid tile name '${e}'`)}findBestZoom(e){let r=this.zoomConversionMap.get(e);return r==null&&(r=this.convertZoomLevel(e),this.zoomConversionMap.set(e,r)),r}convertZoomLevel(e){for(let r=0;r<this.zooms.length;r++){let i=this.zooms[r].scaleDenominator-e;if(i>1e-5)continue;if(r===0)return r;let n=this.zooms[r-1].scaleDenominator-e;return Math.abs(i)<n?r:r-1}return this.maxZoom}static convertZoomLevel(e,r,i,n=!0){return r.identifier===i.identifier||(e>=r.maxZoom&&(e=r.maxZoom),n&&e===0)?e:n&&e===r.maxZoom?i.maxZoom:i.findBestZoom(r.zooms[e].scaleDenominator)}};var Ka={Version:"1.0.0-beta.2",License:"CC BY 4.0",BaseMapsExtension:"https://basemaps.linz.govt.nz/json-schema/stac-basemaps-extension/1.0/schema.json"};var Qg={type:"TileMatrixSetType",title:"Google Maps Compatible for the World",identifier:"WebMercatorQuad",boundingBox:{type:"BoundingBoxType",crs:"http://www.opengis.net/def/crs/EPSG/0/3857",lowerCorner:[-200375083427892e-7,-200375083427892e-7],upperCorner:[200375083427892e-7,200375083427892e-7]},supportedCRS:"https://www.opengis.net/def/crs/EPSG/0/3857",wellKnownScaleSet:"https://www.opengis.net/def/wkss/OGC/1.0/GoogleMapsCompatible",tileMatrix:[{type:"TileMatrixType",identifier:"0",scaleDenominator:559082264028717e-6,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:1,matrixHeight:1},{type:"TileMatrixType",identifier:"1",scaleDenominator:279541132014358e-6,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:2,matrixHeight:2},{type:"TileMatrixType",identifier:"2",scaleDenominator:139770566007179e-6,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:4,matrixHeight:4},{type:"TileMatrixType",identifier:"3",scaleDenominator:698852830035897e-7,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:8,matrixHeight:8},{type:"TileMatrixType",identifier:"4",scaleDenominator:349426415017948e-7,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:16,matrixHeight:16},{type:"TileMatrixType",identifier:"5",scaleDenominator:174713207508974e-7,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:32,matrixHeight:32},{type:"TileMatrixType",identifier:"6",scaleDenominator:873566037544871e-8,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:64,matrixHeight:64},{type:"TileMatrixType",identifier:"7",scaleDenominator:436783018772435e-8,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:128,matrixHeight:128},{type:"TileMatrixType",identifier:"8",scaleDenominator:218391509386217e-8,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:256,matrixHeight:256},{type:"TileMatrixType",identifier:"9",scaleDenominator:109195754693108e-8,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:512,matrixHeight:512},{type:"TileMatrixType",identifier:"10",scaleDenominator:545978.773465544,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:1024,matrixHeight:1024},{type:"TileMatrixType",identifier:"11",scaleDenominator:272989.386732772,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:2048,matrixHeight:2048},{type:"TileMatrixType",identifier:"12",scaleDenominator:136494.693366386,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:4096,matrixHeight:4096},{type:"TileMatrixType",identifier:"13",scaleDenominator:68247.346683193,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:8192,matrixHeight:8192},{type:"TileMatrixType",identifier:"14",scaleDenominator:34123.6733415964,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:16384,matrixHeight:16384},{type:"TileMatrixType",identifier:"15",scaleDenominator:17061.8366707982,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:32768,matrixHeight:32768},{type:"TileMatrixType",identifier:"16",scaleDenominator:8530.91833539913,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:65536,matrixHeight:65536},{type:"TileMatrixType",identifier:"17",scaleDenominator:4265.45916769956,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:131072,matrixHeight:131072},{type:"TileMatrixType",identifier:"18",scaleDenominator:2132.72958384978,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:262144,matrixHeight:262144},{type:"TileMatrixType",identifier:"19",scaleDenominator:1066.36479192489,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:524288,matrixHeight:524288},{type:"TileMatrixType",identifier:"20",scaleDenominator:533.182395962445,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:1048576,matrixHeight:1048576},{type:"TileMatrixType",identifier:"21",scaleDenominator:266.591197981222,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:2097152,matrixHeight:2097152},{type:"TileMatrixType",identifier:"22",scaleDenominator:133.295598990611,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:4194304,matrixHeight:4194304},{type:"TileMatrixType",identifier:"23",scaleDenominator:66.6477994953056,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:8388608,matrixHeight:8388608},{type:"TileMatrixType",identifier:"24",scaleDenominator:33.3238997476528,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:16777216,matrixHeight:16777216}]},lt=new Mt(Qg);var Wl=de(s2(),1),Hl=new Mt(Wl.Nztm2000),on=new Mt(Wl.Nztm2000Quad);var Zn={All:[lt,Hl,on],Defaults:new Map([[Re.Google.code,lt],[Re.Nztm2000.code,Hl]]),get(t){let e=this.tryGet(t);if(e==null)throw new Error("Failed to lookup TileMatrixSet: "+t);return e},tryGet(t){var e,r;return t==null?null:typeof t=="number"?(e=this.Defaults.get(t))!==null&&e!==void 0?e:null:(r=this.Defaults.get(t.code))!==null&&r!==void 0?r:null},find(t){if(t==null)return null;let e=Re.parse(t);if(e!=null)return Zn.tryGet(e);for(let r of Zn.All)if(r.identifier===t)return r;return null}};var He;(function(t){t.Png="png",t.Jpeg="jpeg",t.Webp="webp",t.Avif="avif"})(He||(He={}));var ir;(function(t){t.MapboxVectorTiles="pbf"})(ir||(ir={}));var f2=de(yo(),1);function ry(t){if(!t.endsWith("m")||!t.includes("-"))return null;let e=Number(t.replace("-",".").slice(0,t.length-1));return isNaN(e)?null:String(e)+"m"}function iy(t){let e=t.split("-");return e.length!==2||e[0].length!==4?null:e[1].length===4?t:e[1].length===2?`${e[0]}-${e[0].slice(0,2)}${e[1]}`:null}var ny=[ry,iy];function bo(t){let e=new Set(t.split("_"));e.delete("RGB"),e.delete("RGBI"),e.delete("RGBA");let r=[];for(let i of e){let n=!1;for(let o of ny){let a=o(i);if(a!=null){n=!0,r.push(a);break}}n||r.push(i)}return r.join("-")}var u2=de(l2(),1),h2=require("crypto"),oy="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",c2=(0,u2.default)(oy);function Yn(t){return c2.encode((0,h2.createHash)("sha256").update(t).digest())}function Ja(t){if(t==="")return 0;let e=parseInt(t,16);if(isNaN(e))throw new Error("Invalid hex byte: "+t);return e}function Vl(t){if(t.startsWith("0x")?t=t.slice(2):t.startsWith("#")&&(t=t.slice(1)),t.length!==6&&t.length!==8)throw new Error("Invalid hex color: "+t);return{r:Ja(t.substr(0,2)),g:Ja(t.substr(2,2)),b:Ja(t.substr(4,2)),alpha:Ja(t.substr(6,2))}}var ln=de(require("fs"),1),Zl=de(require("path"),1);var Et;(function(t){t[t.UInt8=1]="UInt8",t[t.UInt16=2]="UInt16",t[t.UInt32=4]="UInt32",t[t.UInt64=8]="UInt64",t[t.Double=8]="Double",t[t.Float=4]="Float"})(Et||(Et={}));var d2=2**32,ay=typeof setImmediate>"u"?setTimeout:setImmediate,Ot=()=>{throw new Error("Method not implemented.")},Rt=class{constructor(){this.isLittleEndian=!0,this.delayMs=Rt.DefaultDelayMs,this.maxChunkCount=10,this.chunks=Rt.DefaultChunkCache(),this.blankFillCount=16,this.maxConcurrentRequests=50,this.toFetch=new Set,this.toFetchPromise=null,this.byteOffset=0,this.getFloat32=Ot,this.getFloat64=Ot,this.getInt8=Ot,this.getInt16=Ot,this.getInt32=Ot,this.setFloat32=Ot,this.setFloat64=Ot,this.setInt8=Ot,this.setInt16=Ot,this.setInt32=Ot,this.setUint8=Ot,this.setUint16=Ot,this.setUint32=Ot,this.setBigInt64=Ot,this.setBigUint64=Ot}static getByteRanges(e,r=32,i=16){if(e.size===0)return{chunks:[],blankFill:[]};let n=[...e.values()].sort((d,m)=>d-m),o=[],a=[];o.push(a);let h=[];for(let d=0;d<n.length;++d){let m=n[d],p=n[d-1];if(a.length>=r)a=[m],o.push(a);else if(d===0||m===p+1)a.push(m);else if(m<p+i){for(let M=p;M<m;M++)a.push(M+1),h.push(M+1);h.pop()}else a=[m],o.push(a)}return{chunks:o,blankFill:h}}async fetchData(){if(this.toFetch.size===0)return;let e=this.toFetch;this.toFetch=new Set,this.toFetchPromise=null;let r=Rt.getByteRanges(e,this.maxChunkCount,this.blankFillCount),i=[];for(let n of r.chunks){let o=n[0],a=n[n.length-1],h=o*this.chunkSize,d=a*this.chunkSize+this.chunkSize-h,m=await this.fetchBytes(h,d);if(n.length===1){i[o]=m,this.chunks.set(o,new DataView(m));continue}let p=o*this.chunkSize;for(let M of n){let R=M*this.chunkSize-p,x=m.slice(R,R+this.chunkSize);i[M]=x,this.chunks.set(M,new DataView(x))}}}async loadBytes(e,r){if(e<0)throw new Error("Offset must be positive");let i=Math.floor(e/this.chunkSize),n=Math.ceil((e+r)/this.chunkSize)-1;for(let o=i;o<=n;o++)this.chunks.has(o)||this.toFetch.add(o);if(this.toFetch.size!==0){if(this.toFetchPromise==null&&(this.toFetchPromise=new Promise(o=>ay(o,this.delayMs)).then(()=>this.fetchData())),this.toFetch.size>this.maxConcurrentRequests)throw new Error("Too many outstanding requests");await this.toFetchPromise}}getChunkId(e){return Math.floor(e/this.chunkSize)}getUint(e,r){switch(r){case Et.UInt8:return this.getUint8(e);case Et.UInt16:return this.getUint16(e);case Et.UInt32:return this.getUint32(e);case Et.UInt64:return this.getUint64(e)}}bytes(e,r){let i=this.isOneChunk(e,r);if(i){let m=this.getView(i),p=e-i*this.chunkSize;return new Uint8Array(m.buffer.slice(p,p+r))}let n=new Uint8Array(r),o=e+r,a=Math.floor(e/this.chunkSize),h=Math.ceil((e+r)/this.chunkSize)-1,d=0;for(let m=a;m<=h;m++){let p=e+d,M=m*this.chunkSize,R=this.getView(m),x=Math.min(o,M+this.chunkSize),w=R.buffer.slice(p-M,x-M);n.set(new Uint8Array(w),d),d+=w.byteLength}return n}getView(e){let r=this.chunks.get(e);if(r==null)throw new Error(`Chunk:${e} is not ready`);return r}isOneChunk(e,r){let i=e+r-1,n=Math.floor(e/this.chunkSize);return Math.floor(i/this.chunkSize)-n<1?n:null}hasBytes(e,r=1){let i=Math.floor(e/this.chunkSize),n=Math.ceil((e+r)/this.chunkSize)-1;for(let o=i;o<=n;o++)if(!this.chunks.has(o))return!1;return!0}toRange(e,r){if(r==null)return`bytes=${e}`;if(e<0)throw new Error("Cannot read from remote source with negative offset and length");return`bytes=${e}-${e+r}`}parseContentRange(e){let[r,i]=e.split(" ");if(r!=="bytes")throw new Error("Failed to parse content-range: "+e);if(i==null)throw new Error("Failed to parse content-range: "+e);let[,n]=i.split("/"),o=Number(n);if(isNaN(o))throw new Error("Failed to parse content-range: "+e);return o}get buffer(){throw new Error("Method not implemented.")}get byteLength(){if(this._byteLength)return this._byteLength;throw Error(".size() has not been fetched.")}getUint8(e){let r=Math.floor(e/this.chunkSize),i=this.chunks.get(r);if(i==null)throw new Error(`Chunk:${r} is not ready`);return i.getUint8(e-r*this.chunkSize)}getUint16(e){let r=this.isOneChunk(e,Et.UInt16);if(r!=null)return this.getView(r).getUint16(e-r*this.chunkSize,this.isLittleEndian);let i=this.getUint8(e),n=this.getUint8(e+Et.UInt8);return this.isLittleEndian?i+(n<<8):(i<<8)+n}getUint32(e){let r=this.isOneChunk(e,Et.UInt32);if(r!=null)return this.getView(r).getUint32(e-r*this.chunkSize,this.isLittleEndian);let i=this.getUint16(e),n=this.getUint16(e+Et.UInt16);return this.isLittleEndian?i+n*65536:i*65536+n}getUint64(e){let r=this.isOneChunk(e,Et.UInt64);if(r!=null){let o=this.getView(r);return Number(o.getBigUint64(e-r*this.chunkSize,this.isLittleEndian))}let i=this.getUint32(e),n=this.getUint32(e+Et.UInt32);return this.isLittleEndian?i+n*d2:i*d2+n}getBigUint64(e){let r=this.isOneChunk(e,Et.UInt64);if(r!=null)return this.getView(r).getBigUint64(e-r*this.chunkSize,this.isLittleEndian);let i=BigInt(this.getUint32(e)),n=BigInt(this.getUint32(e+Et.UInt32));return this.isLittleEndian?i+(n<<BigInt(32)):(i<<BigInt(32))+n}getBigInt64(){throw new Error("Not implemented.")}};Rt.DefaultChunkCache=()=>new Map;Rt.DefaultDelayMs=1;var it=class extends Error{constructor(e,r,i){super(e),this.name="CompositeError",this.code=r,this.reason=i}static isCompositeError(e){return typeof e!="object"||e==null?!1:e.name==="CompositeError"}};function Ei(t){return typeof t=="object"&&t!==null}function Qr(t){let e=t.split("/"),r=e[0];if(r==null||r==="")return null;r.endsWith(":")&&(r=r.slice(0,r.length-1));let i=e[2];if(i==null||i.trim()==="")return null;if(e.length===3)return{protocol:r,bucket:i};let n=e.slice(3).join("/");return n==null||n.trim()===""?{protocol:r,bucket:i}:{key:n,bucket:i,protocol:r}}var uy=/\/$/,hy=/^\//;function Jc(t,e){return t.replace(uy,"")+"/"+e.replace(hy,"")}function m2(t,...e){let r=t;for(let i=0;i<e.length;i++)r=Jc(r,e[i]);return r}async function p2(t){let e=[];for await(let r of t)e.push(r);return e}var Zc=require("fs"),Kl=require("path"),an=class extends Rt{constructor(e){super(),this.type="file",this.protocol="file",this.chunkSize=an.DefaultChunkSize,this.fd=null,this.closeAfterRead=!1,this.fileName=e}static isSource(e){return e.type==="file"}async close(){let e=await this.fd;e!=null&&(await e.close(),this.fd=null)}get uri(){return(0,Kl.resolve)(this.fileName)}get name(){return(0,Kl.basename)(this.fileName)}get size(){return this._size?this._size:(this._size=Promise.resolve().then(async()=>(await Zc.promises.stat(this.fileName)).size),this._size)}async fetchBytes(e,r){if(e<0&&r!=null)throw new Error("Cannot fetch negative offsets with length");if(e<0&&(r=Math.abs(e),e=await this.size+e),r==null)throw new Error("Length is required for reading from files");this.fd==null&&(this.fd=Zc.promises.open(this.fileName,"r"));let i=await this.fd,{buffer:n}=await i.read(Buffer.allocUnsafe(r),0,r,e);return this.closeAfterRead&&await this.close(),n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)}};an.DefaultChunkSize=16*1024;function Jl(t,e){return Ei(t)?t.code==="ENOENT"?new it(e,404,t):t.code==="EACCES"?new it(e,403,t):new it(e,500,t):new it(e,500,t)}var Ri=class{constructor(){this.protocol=Ri.protocol}static is(e){return e.protocol===Ri.protocol}source(e){return new an(e)}async*list(e,r){try{let i=await ln.default.promises.readdir(e,{withFileTypes:!0}),n=Zl.default.resolve(e);for(let o of i){let a=Zl.default.join(n,o.name);o.isDirectory()&&r?.recursive!==!1?yield*this.list(a):yield a}}catch(i){throw Jl(i,`Failed to list: ${e}`)}}async*details(e,r){for await(let i of this.list(e,r)){let n=await this.head(i);n!=null&&(yield n)}}async head(e){try{let r=await ln.default.promises.stat(e);return{path:e,size:r.size,isDirectory:r.isDirectory()}}catch(r){if(Ei(r)&&r.code==="ENOENT")return null;throw Jl(r,`Failed to stat: ${e}`)}}async read(e){try{return await ln.default.promises.readFile(e)}catch(r){throw Jl(r,`Failed to read: ${e}`)}}async write(e,r){let i=Zl.default.dirname(e);await ln.default.promises.mkdir(i,{recursive:!0});try{if(Buffer.isBuffer(r)||typeof r=="string")await ln.default.promises.writeFile(e,r);else{let n=ln.default.createWriteStream(e);await new Promise((o,a)=>{n.on("finish",o),n.on("error",a),r.pipe(n)})}}catch(n){throw Jl(n,`Failed to write: ${e}`)}}stream(e){return ln.default.createReadStream(e)}};Ri.protocol="file";var Z2=de(require("http"),1),Y2=de(require("https"),1),is=de(require("zlib"),1),sr=de(require("stream"),1),s1=require("buffer");function cy(t){if(!/^data:/i.test(t))throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');t=t.replace(/\r?\n/g,"");let e=t.indexOf(",");if(e===-1||e<=4)throw new TypeError("malformed data: URI");let r=t.substring(5,e).split(";"),i="",n=!1,o=r[0]||"text/plain",a=o;for(let p=1;p<r.length;p++)r[p]==="base64"?n=!0:(a+=`;${r[p]}`,r[p].indexOf("charset=")===0&&(i=r[p].substring(8)));!r[0]&&!i.length&&(a+=";charset=US-ASCII",i="US-ASCII");let h=n?"base64":"ascii",d=unescape(t.substring(e+1)),m=Buffer.from(d,h);return m.type=o,m.typeFull=a,m.charset=i,m}var g2=cy;var pr=de(require("stream"),1),Ii=require("util"),nr=require("buffer");Ya();Ql();var Ti=class extends Error{constructor(e,r){super(e),Error.captureStackTrace(this,this.constructor),this.type=r}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}};var Ft=class extends Ti{constructor(e,r,i){super(e,r),i&&(this.code=this.errno=i.code,this.erroredSysCall=i.syscall)}};var eu=Symbol.toStringTag,ef=t=>typeof t=="object"&&typeof t.append=="function"&&typeof t.delete=="function"&&typeof t.get=="function"&&typeof t.getAll=="function"&&typeof t.has=="function"&&typeof t.set=="function"&&typeof t.sort=="function"&&t[eu]==="URLSearchParams",t1=t=>t&&typeof t=="object"&&typeof t.arrayBuffer=="function"&&typeof t.type=="string"&&typeof t.stream=="function"&&typeof t.constructor=="function"&&/^(Blob|File)$/.test(t[eu]),C2=t=>typeof t=="object"&&(t[eu]==="AbortSignal"||t[eu]==="EventTarget"),A2=(t,e)=>{let r=new URL(e).hostname,i=new URL(t).hostname;return r===i||r.endsWith(`.${i}`)};var Ry=(0,Ii.promisify)(pr.default.pipeline),Wt=Symbol("Body internals"),ti=class{constructor(e,{size:r=0}={}){let i=null;e===null?e=null:ef(e)?e=nr.Buffer.from(e.toString()):t1(e)||nr.Buffer.isBuffer(e)||(Ii.types.isAnyArrayBuffer(e)?e=nr.Buffer.from(e):ArrayBuffer.isView(e)?e=nr.Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof pr.default||(e instanceof Qn?(e=R2(e),i=e.type.split("=")[1]):e=nr.Buffer.from(String(e))));let n=e;nr.Buffer.isBuffer(e)?n=pr.default.Readable.from(e):t1(e)&&(n=pr.default.Readable.from(e.stream())),this[Wt]={body:e,stream:n,boundary:i,disturbed:!1,error:null},this.size=r,e instanceof pr.default&&e.on("error",o=>{let a=o instanceof Ti?o:new Ft(`Invalid response body while trying to fetch ${this.url}: ${o.message}`,"system",o);this[Wt].error=a})}get body(){return this[Wt].stream}get bodyUsed(){return this[Wt].disturbed}async arrayBuffer(){let{buffer:e,byteOffset:r,byteLength:i}=await iu(this);return e.slice(r,r+i)}async formData(){let e=this.headers.get("content-type");if(e.startsWith("application/x-www-form-urlencoded")){let i=new Qn,n=new URLSearchParams(await this.text());for(let[o,a]of n)i.append(o,a);return i}let{toFormData:r}=await Promise.resolve().then(()=>(N2(),L2));return r(this.body,e)}async blob(){let e=this.headers&&this.headers.get("content-type")||this[Wt].body&&this[Wt].body.type||"",r=await this.arrayBuffer();return new Ai([r],{type:e})}async json(){let e=await iu(this);return JSON.parse(e.toString())}async text(){return(await iu(this)).toString()}buffer(){return iu(this)}};ti.prototype.buffer=(0,Ii.deprecate)(ti.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(ti.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:(0,Ii.deprecate)(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});async function iu(t){if(t[Wt].disturbed)throw new TypeError(`body used already for: ${t.url}`);if(t[Wt].disturbed=!0,t[Wt].error)throw t[Wt].error;let{body:e}=t;if(e===null)return nr.Buffer.alloc(0);if(!(e instanceof pr.default))return nr.Buffer.alloc(0);let r=[],i=0;try{for await(let n of e){if(t.size>0&&i+n.length>t.size){let o=new Ft(`content size at ${t.url} over limit: ${t.size}`,"max-size");throw e.destroy(o),o}i+=n.length,r.push(n)}}catch(n){throw n instanceof Ti?n:new Ft(`Invalid response body while trying to fetch ${t.url}: ${n.message}`,"system",n)}if(e.readableEnded===!0||e._readableState.ended===!0)try{return r.every(n=>typeof n=="string")?nr.Buffer.from(r.join("")):nr.Buffer.concat(r,i)}catch(n){throw new Ft(`Could not create Buffer from response body for ${t.url}: ${n.message}`,"system",n)}else throw new Ft(`Premature close of server response while trying to fetch ${t.url}`)}var xo=(t,e)=>{let r,i,{body:n}=t[Wt];if(t.bodyUsed)throw new Error("cannot clone body after it is used");return n instanceof pr.default&&typeof n.getBoundary!="function"&&(r=new pr.PassThrough({highWaterMark:e}),i=new pr.PassThrough({highWaterMark:e}),n.pipe(r),n.pipe(i),t[Wt].stream=r,n=i),n},Cy=(0,Ii.deprecate)(t=>t.getBoundary(),"form-data doesn't follow the spec and requires special treatment. Use alternative package","https://github.com/node-fetch/node-fetch/issues/1167"),nu=(t,e)=>t===null?null:typeof t=="string"?"text/plain;charset=UTF-8":ef(t)?"application/x-www-form-urlencoded;charset=UTF-8":t1(t)?t.type||null:nr.Buffer.isBuffer(t)||Ii.types.isAnyArrayBuffer(t)||ArrayBuffer.isView(t)?null:t instanceof Qn?`multipart/form-data; boundary=${e[Wt].boundary}`:t&&typeof t.getBoundary=="function"?`multipart/form-data;boundary=${Cy(t)}`:t instanceof pr.default?null:"text/plain;charset=UTF-8",B2=t=>{let{body:e}=t[Wt];return e===null?0:t1(e)?e.size:nr.Buffer.isBuffer(e)?e.length:e&&typeof e.getLengthSync=="function"&&e.hasKnownLength&&e.hasKnownLength()?e.getLengthSync():null},D2=async(t,{body:e})=>{e===null?t.end():await Ry(e,t)};var sf=require("util"),n1=de(require("http"),1),su=typeof n1.default.validateHeaderName=="function"?n1.default.validateHeaderName:t=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(t)){let e=new TypeError(`Header name must be a valid HTTP token [${t}]`);throw Object.defineProperty(e,"code",{value:"ERR_INVALID_HTTP_TOKEN"}),e}},of=typeof n1.default.validateHeaderValue=="function"?n1.default.validateHeaderValue:(t,e)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(e)){let r=new TypeError(`Invalid character in header content ["${t}"]`);throw Object.defineProperty(r,"code",{value:"ERR_INVALID_CHAR"}),r}},Ht=class extends URLSearchParams{constructor(e){let r=[];if(e instanceof Ht){let i=e.raw();for(let[n,o]of Object.entries(i))r.push(...o.map(a=>[n,a]))}else if(e!=null)if(typeof e=="object"&&!sf.types.isBoxedPrimitive(e)){let i=e[Symbol.iterator];if(i==null)r.push(...Object.entries(e));else{if(typeof i!="function")throw new TypeError("Header pairs must be iterable");r=[...e].map(n=>{if(typeof n!="object"||sf.types.isBoxedPrimitive(n))throw new TypeError("Each header pair must be an iterable object");return[...n]}).map(n=>{if(n.length!==2)throw new TypeError("Each header pair must be a name/value tuple");return[...n]})}}else throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)");return r=r.length>0?r.map(([i,n])=>(su(i),of(i,String(n)),[String(i).toLowerCase(),String(n)])):void 0,super(r),new Proxy(this,{get(i,n,o){switch(n){case"append":case"set":return(a,h)=>(su(a),of(a,String(h)),URLSearchParams.prototype[n].call(i,String(a).toLowerCase(),String(h)));case"delete":case"has":case"getAll":return a=>(su(a),URLSearchParams.prototype[n].call(i,String(a).toLowerCase()));case"keys":return()=>(i.sort(),new Set(URLSearchParams.prototype.keys.call(i)).keys());default:return Reflect.get(i,n,o)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(e){let r=this.getAll(e);if(r.length===0)return null;let i=r.join(", ");return/^content-encoding$/i.test(e)&&(i=i.toLowerCase()),i}forEach(e,r=void 0){for(let i of this.keys())Reflect.apply(e,r,[this.get(i),i,this])}*values(){for(let e of this.keys())yield this.get(e)}*entries(){for(let e of this.keys())yield[e,this.get(e)]}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce((e,r)=>(e[r]=this.getAll(r),e),{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce((e,r)=>{let i=this.getAll(r);return r==="host"?e[r]=i[0]:e[r]=i.length>1?i:i[0],e},{})}};Object.defineProperties(Ht.prototype,["get","entries","forEach","values"].reduce((t,e)=>(t[e]={enumerable:!0},t),{}));function z2(t=[]){return new Ht(t.reduce((e,r,i,n)=>(i%2===0&&e.push(n.slice(i,i+2)),e),[]).filter(([e,r])=>{try{return su(e),of(e,String(r)),!0}catch{return!1}}))}var Ay=new Set([301,302,303,307,308]),ou=t=>Ay.has(t);var Nr=Symbol("Response internals"),Ct=class extends ti{constructor(e=null,r={}){super(e,r);let i=r.status!=null?r.status:200,n=new Ht(r.headers);if(e!==null&&!n.has("Content-Type")){let o=nu(e,this);o&&n.append("Content-Type",o)}this[Nr]={type:"default",url:r.url,status:i,statusText:r.statusText||"",headers:n,counter:r.counter,highWaterMark:r.highWaterMark}}get type(){return this[Nr].type}get url(){return this[Nr].url||""}get status(){return this[Nr].status}get ok(){return this[Nr].status>=200&&this[Nr].status<300}get redirected(){return this[Nr].counter>0}get statusText(){return this[Nr].statusText}get headers(){return this[Nr].headers}get highWaterMark(){return this[Nr].highWaterMark}clone(){return new Ct(xo(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(e,r=302){if(!ou(r))throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');return new Ct(null,{headers:{location:new URL(e).toString()},status:r})}static error(){let e=new Ct(null,{status:0,statusText:""});return e[Nr].type="error",e}get[Symbol.toStringTag](){return"Response"}};Object.defineProperties(Ct.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}});var V2=require("url"),K2=require("util");var U2=t=>{if(t.search)return t.search;let e=t.href.length-1,r=t.hash||(t.href[e]==="#"?"#":"");return t.href[e-r.length]==="?"?"?":""};var $2=require("net");function j2(t,e=!1){return t==null||(t=new URL(t),/^(about|blob|data):$/.test(t.protocol))?"no-referrer":(t.username="",t.password="",t.hash="",e&&(t.pathname="",t.search=""),t)}var q2=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]),F2="strict-origin-when-cross-origin";function W2(t){if(!q2.has(t))throw new TypeError(`Invalid referrerPolicy: ${t}`);return t}function Ty(t){if(/^(http|ws)s:$/.test(t.protocol))return!0;let e=t.host.replace(/(^\[)|(]$)/g,""),r=(0,$2.isIP)(e);return r===4&&/^127\./.test(e)||r===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(e)?!0:/^(.+\.)*localhost$/.test(t.host)?!1:t.protocol==="file:"}function So(t){return/^about:(blank|srcdoc)$/.test(t)||t.protocol==="data:"||/^(blob|filesystem):$/.test(t.protocol)?!0:Ty(t)}function H2(t,{referrerURLCallback:e,referrerOriginCallback:r}={}){if(t.referrer==="no-referrer"||t.referrerPolicy==="")return null;let i=t.referrerPolicy;if(t.referrer==="about:client")return"no-referrer";let n=t.referrer,o=j2(n),a=j2(n,!0);o.toString().length>4096&&(o=a),e&&(o=e(o)),r&&(a=r(a));let h=new URL(t.url);switch(i){case"no-referrer":return"no-referrer";case"origin":return a;case"unsafe-url":return o;case"strict-origin":return So(o)&&!So(h)?"no-referrer":a.toString();case"strict-origin-when-cross-origin":return o.origin===h.origin?o:So(o)&&!So(h)?"no-referrer":a;case"same-origin":return o.origin===h.origin?o:"no-referrer";case"origin-when-cross-origin":return o.origin===h.origin?o:a;case"no-referrer-when-downgrade":return So(o)&&!So(h)?"no-referrer":o;default:throw new TypeError(`Invalid referrerPolicy: ${i}`)}}function G2(t){let e=(t.get("referrer-policy")||"").split(/[,\s]+/),r="";for(let i of e)i&&q2.has(i)&&(r=i);return r}var dt=Symbol("Request internals"),au=t=>typeof t=="object"&&typeof t[dt]=="object",Iy=(0,K2.deprecate)(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)"),Pi=class extends ti{constructor(e,r={}){let i;if(au(e)?i=new URL(e.url):(i=new URL(e),e={}),i.username!==""||i.password!=="")throw new TypeError(`${i} is an url with embedded credentails.`);let n=r.method||e.method||"GET";if(n=n.toUpperCase(),"data"in r&&Iy(),(r.body!=null||au(e)&&e.body!==null)&&(n==="GET"||n==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body");let o=r.body?r.body:au(e)&&e.body!==null?xo(e):null;super(o,{size:r.size||e.size||0});let a=new Ht(r.headers||e.headers||{});if(o!==null&&!a.has("Content-Type")){let m=nu(o,this);m&&a.set("Content-Type",m)}let h=au(e)?e.signal:null;if("signal"in r&&(h=r.signal),h!=null&&!C2(h))throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");let d=r.referrer==null?e.referrer:r.referrer;if(d==="")d="no-referrer";else if(d){let m=new URL(d);d=/^about:(\/\/)?client$/.test(m)?"client":m}else d=void 0;this[dt]={method:n,redirect:r.redirect||e.redirect||"follow",headers:a,parsedURL:i,signal:h,referrer:d},this.follow=r.follow===void 0?e.follow===void 0?20:e.follow:r.follow,this.compress=r.compress===void 0?e.compress===void 0?!0:e.compress:r.compress,this.counter=r.counter||e.counter||0,this.agent=r.agent||e.agent,this.highWaterMark=r.highWaterMark||e.highWaterMark||16384,this.insecureHTTPParser=r.insecureHTTPParser||e.insecureHTTPParser||!1,this.referrerPolicy=r.referrerPolicy||e.referrerPolicy||""}get method(){return this[dt].method}get url(){return(0,V2.format)(this[dt].parsedURL)}get headers(){return this[dt].headers}get redirect(){return this[dt].redirect}get signal(){return this[dt].signal}get referrer(){if(this[dt].referrer==="no-referrer")return"";if(this[dt].referrer==="client")return"about:client";if(this[dt].referrer)return this[dt].referrer.toString()}get referrerPolicy(){return this[dt].referrerPolicy}set referrerPolicy(e){this[dt].referrerPolicy=W2(e)}clone(){return new Pi(this)}get[Symbol.toStringTag](){return"Request"}};Object.defineProperties(Pi.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0},referrer:{enumerable:!0},referrerPolicy:{enumerable:!0}});var J2=t=>{let{parsedURL:e}=t[dt],r=new Ht(t[dt].headers);r.has("Accept")||r.set("Accept","*/*");let i=null;if(t.body===null&&/^(post|put)$/i.test(t.method)&&(i="0"),t.body!==null){let h=B2(t);typeof h=="number"&&!Number.isNaN(h)&&(i=String(h))}i&&r.set("Content-Length",i),t.referrerPolicy===""&&(t.referrerPolicy=F2),t.referrer&&t.referrer!=="no-referrer"?t[dt].referrer=H2(t):t[dt].referrer="no-referrer",t[dt].referrer instanceof URL&&r.set("Referer",t.referrer),r.has("User-Agent")||r.set("User-Agent","node-fetch"),t.compress&&!r.has("Accept-Encoding")&&r.set("Accept-Encoding","gzip,deflate,br");let{agent:n}=t;typeof n=="function"&&(n=n(e)),!r.has("Connection")&&!n&&r.set("Connection","close");let o=U2(e),a={path:e.pathname+o,method:t.method,headers:r[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:t.insecureHTTPParser,agent:n};return{parsedURL:e,options:a}};var lu=class extends Ti{constructor(e,r="aborted"){super(e,r)}};Ql();rf();var Py=new Set(["data:","http:","https:"]);async function uu(t,e){return new Promise((r,i)=>{let n=new Pi(t,e),{parsedURL:o,options:a}=J2(n);if(!Py.has(o.protocol))throw new TypeError(`node-fetch cannot load ${t}. URL scheme "${o.protocol.replace(/:$/,"")}" is not supported.`);if(o.protocol==="data:"){let w=g2(n.url),E=new Ct(w,{headers:{"Content-Type":w.typeFull}});r(E);return}let h=(o.protocol==="https:"?Y2.default:Z2.default).request,{signal:d}=n,m=null,p=()=>{let w=new lu("The operation was aborted.");i(w),n.body&&n.body instanceof sr.default.Readable&&n.body.destroy(w),!(!m||!m.body)&&m.body.emit("error",w)};if(d&&d.aborted){p();return}let M=()=>{p(),x()},R=h(o.toString(),a);d&&d.addEventListener("abort",M);let x=()=>{R.abort(),d&&d.removeEventListener("abort",M)};R.on("error",w=>{i(new Ft(`request to ${n.url} failed, reason: ${w.message}`,"system",w)),x()}),Oy(R,w=>{m.body.destroy(w)}),process.version<"v14"&&R.on("socket",w=>{let E;w.prependListener("end",()=>{E=w._eventsCount}),w.prependListener("close",T=>{if(m&&E<w._eventsCount&&!T){let C=new Error("Premature close");C.code="ERR_STREAM_PREMATURE_CLOSE",m.body.emit("error",C)}})}),R.on("response",w=>{R.setTimeout(0);let E=z2(w.rawHeaders);if(ou(w.statusCode)){let B=E.get("Location"),z=null;try{z=B===null?null:new URL(B,n.url)}catch{if(n.redirect!=="manual"){i(new Ft(`uri requested responds with an invalid redirect URL: ${B}`,"invalid-redirect")),x();return}}switch(n.redirect){case"error":i(new Ft(`uri requested responds with a redirect, redirect mode is set to error: ${n.url}`,"no-redirect")),x();return;case"manual":break;case"follow":{if(z===null)break;if(n.counter>=n.follow){i(new Ft(`maximum redirect reached at: ${n.url}`,"max-redirect")),x();return}let H={headers:new Ht(n.headers),follow:n.follow,counter:n.counter+1,agent:n.agent,compress:n.compress,method:n.method,body:xo(n),signal:n.signal,size:n.size,referrer:n.referrer,referrerPolicy:n.referrerPolicy};if(!A2(n.url,z))for(let se of["authorization","www-authenticate","cookie","cookie2"])H.headers.delete(se);if(w.statusCode!==303&&n.body&&e.body instanceof sr.default.Readable){i(new Ft("Cannot follow redirect with body being a readable stream","unsupported-redirect")),x();return}(w.statusCode===303||(w.statusCode===301||w.statusCode===302)&&n.method==="POST")&&(H.method="GET",H.body=void 0,H.headers.delete("content-length"));let J=G2(E);J&&(H.referrerPolicy=J),r(uu(new Pi(z,H))),x();return}default:return i(new TypeError(`Redirect option '${n.redirect}' is not a valid value of RequestRedirect`))}}d&&w.once("end",()=>{d.removeEventListener("abort",M)});let T=(0,sr.pipeline)(w,new sr.PassThrough,B=>{B&&i(B)});process.version<"v12.10"&&w.on("aborted",M);let C={url:n.url,status:w.statusCode,statusText:w.statusMessage,headers:E,size:n.size,counter:n.counter,highWaterMark:n.highWaterMark},I=E.get("Content-Encoding");if(!n.compress||n.method==="HEAD"||I===null||w.statusCode===204||w.statusCode===304){m=new Ct(T,C),r(m);return}let k={flush:is.default.Z_SYNC_FLUSH,finishFlush:is.default.Z_SYNC_FLUSH};if(I==="gzip"||I==="x-gzip"){T=(0,sr.pipeline)(T,is.default.createGunzip(k),B=>{B&&i(B)}),m=new Ct(T,C),r(m);return}if(I==="deflate"||I==="x-deflate"){let B=(0,sr.pipeline)(w,new sr.PassThrough,z=>{z&&i(z)});B.once("data",z=>{(z[0]&15)===8?T=(0,sr.pipeline)(T,is.default.createInflate(),H=>{H&&i(H)}):T=(0,sr.pipeline)(T,is.default.createInflateRaw(),H=>{H&&i(H)}),m=new Ct(T,C),r(m)}),B.once("end",()=>{m||(m=new Ct(T,C),r(m))});return}if(I==="br"){T=(0,sr.pipeline)(T,is.default.createBrotliDecompress(),B=>{B&&i(B)}),m=new Ct(T,C),r(m);return}m=new Ct(T,C),r(m)}),D2(R,n).catch(i)})}function Oy(t,e){let r=s1.Buffer.from(`0\r
134
134
  \r
135
- `),i=!1,n=!1,o;t.on("response",a=>{let{headers:h}=a;i=h["transfer-encoding"]==="chunked"&&!h["content-length"]}),t.on("socket",a=>{let h=()=>{if(i&&!n){let d=new Error("Premature close");d.code="ERR_STREAM_PREMATURE_CLOSE",e(d)}};a.prependListener("close",h),t.on("abort",()=>{a.removeListener("close",h)}),a.on("data",d=>{n=s1.Buffer.compare(d.slice(-5),r)===0,!n&&o&&(n=s1.Buffer.compare(o.slice(-3),r.slice(0,3))===0&&s1.Buffer.compare(d.slice(-2),r.slice(3))===0),o=d})})}var kt=class extends Rt{constructor(e){super(),this.type="url",this.protocol="http",this.chunkSize=kt.DefaultChunkSize,this.uri=e}static isSource(e){return e.type==="url"}get size(){return this._size?this._size:(this._size=Promise.resolve().then(async()=>{let e=await kt.fetch(this.uri,{method:"HEAD"});return Number(e.headers.get("content-length"))}),this._size)}async fetchBytes(e,r){let n={Range:this.toRange(e,r)},o=await kt.fetch(this.uri,{headers:n});if(o.ok){let a=o.headers.get("content-range");return this._size==null&&a!=null&&(this._size=Promise.resolve(this.parseContentRange(a))),o.arrayBuffer()}throw new Error("Failed to fetch")}};kt.DefaultChunkSize=32*1024;kt.fetch=(t,e)=>fetch(t,e);function Y2(t,e){return Ei(t)?t.code==="ENOENT"?new it(e,404,t):t.code==="EACCES"?new it(e,403,t):new it(e,500,t):new it(e,500,t)}var Oi=class{constructor(){this.protocol=Oi.protocol}static is(e){return e.protocol===Oi.protocol}source(e){return new kt(e)}async*list(e){throw new Error(`Unable to "list" on ${e}`)}async*details(e){throw new Error(`Unable to "details" on ${e}`)}async head(e){let r=await kt.fetch(e,{method:"HEAD"});if(!r.ok)throw Y2(new Error(r.statusText),`Failed to head: ${e}`);return{path:e,size:Number(r.headers.get("content-length")),isDirectory:!1}}async read(e){let r=await kt.fetch(e,{method:"GET"});if(!r.ok)throw Y2(new Error(r.statusText),`Failed to head: ${e}`);return Buffer.from(await r.arrayBuffer())}async write(e){throw new Error(`Unable to "write" on ${e}`)}stream(e){throw new Error(`Unable to "stream" on ${e}`)}};Oi.protocol="http";kt.fetch=uu;function Iy(t){return typeof t!="object"||t==null?!1:t.constructor===Object}var hu=class{constructor(){this.protocol="abstract",this.isOrdered=!0,this.systems=[],this.toArray=m2,this.join=Jc,this.joinAll=d2}register(e,r,i="rw"){for(let n=0;n<this.systems.length;n++){let o=this.systems[n];if(o.path===e&&o.flag===i){this.systems.splice(n,1,{path:e,system:r,flag:i});return}}this.systems.push({path:e,system:r,flag:i}),this.isOrdered=!1}read(e){return this.get(e,"r").read(e)}async readJson(e){let r=await this.read(e);return JSON.parse(r.toString())}stream(e){return this.get(e,"r").stream(e)}write(e,r,i){if(Array.isArray(r)||Iy(r)){let n=JSON.stringify(r,null,2);return this.get(e,"rw").write(e,n,{contentType:"application/json",...i})}return this.get(e,"rw").write(e,r,i)}list(e,r){return this.get(e,"r").list(e,r)}details(e,r){return this.get(e,"r").details(e,r)}exists(e){return this.get(e,"r").head(e).then(r=>r!=null)}head(e){return this.get(e,"r").head(e)}source(e){return this.get(e,"r").source(e)}sortSystems(){this.isOrdered||(this.systems.sort((e,r)=>r.path.length-e.path.length),this.isOrdered=!0)}get(e,r){this.sortSystems();for(let i of this.systems)if(e.startsWith(i.path)){if(r==="rw"&&i.flag==="r")continue;return i.system}throw new Error(`Unable to find file system for path:${e}`)}},nt=new hu;var X2=new Ri;nt.register("",X2);nt.register("file://",X2);var Q2=new Oi;nt.register("http://",Q2);nt.register("https://",Q2);var I8=de(Yn(),1);var Je;(function(t){function e(i){throw new Error}t.assertNever=e,t.arrayToEnum=i=>{let n={};for(let o of i)n[o]=o;return n},t.getValidEnumValues=i=>{let n=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(let a of n)o[a]=i[a];return t.objectValues(o)},t.objectValues=i=>t.objectKeys(i).map(function(n){return i[n]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let n=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&n.push(o);return n},t.find=(i,n)=>{for(let o of i)if(n(o))return o},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,n=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(n)}t.joinValues=r})(Je||(Je={}));var Q=Je.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),hn=t=>{switch(typeof t){case"undefined":return Q.undefined;case"string":return Q.string;case"number":return isNaN(t)?Q.nan:Q.number;case"boolean":return Q.boolean;case"function":return Q.function;case"bigint":return Q.bigint;case"object":return Array.isArray(t)?Q.array:t===null?Q.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Q.promise:typeof Map<"u"&&t instanceof Map?Q.map:typeof Set<"u"&&t instanceof Set?Q.set:typeof Date<"u"&&t instanceof Date?Q.date:Q.object;default:return Q.unknown}},Y=Je.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of"]),Py=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Br=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let r=e||function(o){return o.message},i={_errors:[]},n=o=>{for(let a of o.issues)if(a.code==="invalid_union")a.unionErrors.map(n);else if(a.code==="invalid_return_type")n(a.returnTypeError);else if(a.code==="invalid_arguments")n(a.argumentsError);else if(a.path.length===0)i._errors.push(r(a));else{let h=i,d=0;for(;d<a.path.length;){let m=a.path[d];d===a.path.length-1?(h[m]=h[m]||{_errors:[]},h[m]._errors.push(r(a))):h[m]=h[m]||{_errors:[]},h=h[m],d++}}};return n(this),i}toString(){return this.message}get message(){return JSON.stringify(this.issues,null,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},i=[];for(let n of this.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):i.push(e(n));return{formErrors:i,fieldErrors:r}}get formErrors(){return this.flatten()}};Br.create=t=>new Br(t);var o1=(t,e)=>{let r;switch(t.code){case Y.invalid_type:t.received===Q.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Y.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected)}`;break;case Y.unrecognized_keys:r=`Unrecognized key(s) in object: ${Je.joinValues(t.keys,", ")}`;break;case Y.invalid_union:r="Invalid input";break;case Y.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Je.joinValues(t.options)}`;break;case Y.invalid_enum_value:r=`Invalid enum value. Expected ${Je.joinValues(t.options)}, received '${t.received}'`;break;case Y.invalid_arguments:r="Invalid function arguments";break;case Y.invalid_return_type:r="Invalid function return type";break;case Y.invalid_date:r="Invalid date";break;case Y.invalid_string:t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Y.too_small:t.type==="array"?r=`Array must contain ${t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be greater than ${t.inclusive?"or equal to ":""}${t.minimum}`:r="Invalid input";break;case Y.too_big:t.type==="array"?r=`Array must contain ${t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be less than ${t.inclusive?"or equal to ":""}${t.maximum}`:r="Invalid input";break;case Y.custom:r="Invalid input";break;case Y.invalid_intersection_types:r="Intersection results could not be merged";break;case Y.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;default:r=e.defaultError,Je.assertNever(t)}return{message:r}},a1=o1,Oy=t=>{a1=t},cu=t=>{let{data:e,path:r,errorMaps:i,issueData:n}=t,o=[...r,...n.path||[]],a={...n,path:o},h="",d=i.filter(m=>!!m).slice().reverse();for(let m of d)h=m(a,{data:e,defaultError:h}).message;return{...n,path:o,message:n.message||h}},ky=[];function le(t,e){let r=cu({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,a1,o1].filter(i=>!!i)});t.common.issues.push(r)}var At=class{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let i=[];for(let n of r){if(n.status==="aborted")return me;n.status==="dirty"&&e.dirty(),i.push(n.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,r){let i=[];for(let n of r)i.push({key:await n.key,value:await n.value});return At.mergeObjectSync(e,i)}static mergeObjectSync(e,r){let i={};for(let n of r){let{key:o,value:a}=n;if(o.status==="aborted"||a.status==="aborted")return me;o.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),(typeof a.value<"u"||n.alwaysSet)&&(i[o.value]=a.value)}return{status:e.value,value:i}}},me=Object.freeze({status:"aborted"}),Ly=t=>({status:"dirty",value:t}),Lt=t=>({status:"valid",value:t}),af=t=>t.status==="aborted",lf=t=>t.status==="dirty",fu=t=>t.status==="valid",uf=t=>typeof Promise!==void 0&&t instanceof Promise,$e;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})($e||($e={}));var yr=class{constructor(e,r,i,n){this.parent=e,this.data=r,this._path=i,this._key=n}get path(){return this._path.concat(this._key)}},e5=(t,e)=>{if(fu(e))return{success:!0,data:e.value};{if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");let r=new Br(t.common.issues);return{success:!1,error:r}}};function Ce(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:i,description:n}=t;if(e&&(r||i))throw new Error(`Can't use "invalid" or "required" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(a,h)=>a.code!=="invalid_type"?{message:h.defaultError}:typeof h.data>"u"&&i?{message:i}:t.invalid_type_error?{message:t.invalid_type_error}:{message:h.defaultError},description:n}}var Se=class{constructor(e){this.spa=this.safeParseAsync,this.superRefine=this._refinement,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.default=this.default.bind(this),this.describe=this.describe.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return hn(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:hn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new At,ctx:{common:e.parent.common,data:e.data,parsedType:hn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(uf(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let i=this.safeParse(e,r);if(i.success)return i.data;throw i.error}safeParse(e,r){var i;let n={common:{issues:[],async:(i=r?.async)!==null&&i!==void 0?i:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:hn(e)},o=this._parseSync({data:e,path:n.path,parent:n});return e5(n,o)}async parseAsync(e,r){let i=await this.safeParseAsync(e,r);if(i.success)return i.data;throw i.error}async safeParseAsync(e,r){let i={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:hn(e)},n=this._parse({data:e,path:[],parent:i}),o=await(uf(n)?n:Promise.resolve(n));return e5(i,o)}refine(e,r){let i=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,o)=>{let a=e(n),h=()=>o.addIssue({code:Y.custom,...i(n)});return typeof Promise<"u"&&a instanceof Promise?a.then(d=>d?!0:(h(),!1)):a?!0:(h(),!1)})}refinement(e,r){return this._refinement((i,n)=>e(i)?!0:(n.addIssue(typeof r=="function"?r(i,n):r),!1))}_refinement(e){return new wr({schema:this,typeName:fe.ZodEffects,effect:{type:"refinement",refinement:e}})}optional(){return gr.create(this)}nullable(){return Bi.create(this)}nullish(){return this.optional().nullable()}array(){return br.create(this)}promise(){return fn.create(this)}or(e){return ss.create([this,e])}and(e){return os.create(this,e)}transform(e){return new wr({schema:this,typeName:fe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new l1({innerType:this,defaultValue:r,typeName:fe.ZodDefault})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Ny=/^c[^\s-]{8,}$/i,By=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,Dy=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,ii=class extends Se{constructor(){super(...arguments),this._regex=(e,r,i)=>this.refinement(n=>e.test(n),{validation:r,code:Y.invalid_string,...$e.errToObj(i)}),this.nonempty=e=>this.min(1,$e.errToObj(e)),this.trim=()=>new ii({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}_parse(e){if(this._getType(e)!==Q.string){let o=this._getOrReturnCtx(e);return le(o,{code:Y.invalid_type,expected:Q.string,received:o.parsedType}),me}let i=new At,n;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(n=this._getOrReturnCtx(e,n),le(n,{code:Y.too_small,minimum:o.value,type:"string",inclusive:!0,message:o.message}),i.dirty());else if(o.kind==="max")e.data.length>o.value&&(n=this._getOrReturnCtx(e,n),le(n,{code:Y.too_big,maximum:o.value,type:"string",inclusive:!0,message:o.message}),i.dirty());else if(o.kind==="email")Dy.test(e.data)||(n=this._getOrReturnCtx(e,n),le(n,{validation:"email",code:Y.invalid_string,message:o.message}),i.dirty());else if(o.kind==="uuid")By.test(e.data)||(n=this._getOrReturnCtx(e,n),le(n,{validation:"uuid",code:Y.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid")Ny.test(e.data)||(n=this._getOrReturnCtx(e,n),le(n,{validation:"cuid",code:Y.invalid_string,message:o.message}),i.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),le(n,{validation:"url",code:Y.invalid_string,message:o.message}),i.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),le(n,{validation:"regex",code:Y.invalid_string,message:o.message}),i.dirty())):o.kind==="trim"?e.data=e.data.trim():Je.assertNever(o);return{status:i.value,value:e.data}}_addCheck(e){return new ii({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...$e.errToObj(e)})}url(e){return this._addCheck({kind:"url",...$e.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...$e.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...$e.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...$e.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...$e.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...$e.errToObj(r)})}length(e,r){return this.min(e,r).max(e,r)}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get minLength(){let e=-1/0;return this._def.checks.map(r=>{r.kind==="min"&&(e===null||r.value>e)&&(e=r.value)}),e}get maxLength(){let e=null;return this._def.checks.map(r=>{r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}),e}};ii.create=t=>new ii({checks:[],typeName:fe.ZodString,...Ce(t)});function zy(t,e){let r=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,n=r>i?r:i,o=parseInt(t.toFixed(n).replace(".","")),a=parseInt(e.toFixed(n).replace(".",""));return o%a/Math.pow(10,n)}var ki=class extends Se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._getType(e)!==Q.number){let o=this._getOrReturnCtx(e);return le(o,{code:Y.invalid_type,expected:Q.number,received:o.parsedType}),me}let i,n=new At;for(let o of this._def.checks)o.kind==="int"?Je.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),le(i,{code:Y.invalid_type,expected:"integer",received:"float",message:o.message}),n.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(i=this._getOrReturnCtx(e,i),le(i,{code:Y.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,message:o.message}),n.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(i=this._getOrReturnCtx(e,i),le(i,{code:Y.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,message:o.message}),n.dirty()):o.kind==="multipleOf"?zy(e.data,o.value)!==0&&(i=this._getOrReturnCtx(e,i),le(i,{code:Y.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()):Je.assertNever(o);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,$e.toString(r))}gt(e,r){return this.setLimit("min",e,!1,$e.toString(r))}lte(e,r){return this.setLimit("max",e,!0,$e.toString(r))}lt(e,r){return this.setLimit("max",e,!1,$e.toString(r))}setLimit(e,r,i,n){return new ki({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:$e.toString(n)}]})}_addCheck(e){return new ki({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:$e.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:$e.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:$e.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:$e.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:$e.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:$e.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int")}};ki.create=t=>new ki({checks:[],typeName:fe.ZodNumber,...Ce(t)});var Eo=class extends Se{_parse(e){if(this._getType(e)!==Q.bigint){let i=this._getOrReturnCtx(e);return le(i,{code:Y.invalid_type,expected:Q.bigint,received:i.parsedType}),me}return Lt(e.data)}};Eo.create=t=>new Eo({typeName:fe.ZodBigInt,...Ce(t)});var Ro=class extends Se{_parse(e){if(this._getType(e)!==Q.boolean){let i=this._getOrReturnCtx(e);return le(i,{code:Y.invalid_type,expected:Q.boolean,received:i.parsedType}),me}return Lt(e.data)}};Ro.create=t=>new Ro({typeName:fe.ZodBoolean,...Ce(t)});var Co=class extends Se{_parse(e){if(this._getType(e)!==Q.date){let i=this._getOrReturnCtx(e);return le(i,{code:Y.invalid_type,expected:Q.date,received:i.parsedType}),me}if(isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return le(i,{code:Y.invalid_date}),me}return{status:"valid",value:new Date(e.data.getTime())}}};Co.create=t=>new Co({typeName:fe.ZodDate,...Ce(t)});var Ao=class extends Se{_parse(e){if(this._getType(e)!==Q.undefined){let i=this._getOrReturnCtx(e);return le(i,{code:Y.invalid_type,expected:Q.undefined,received:i.parsedType}),me}return Lt(e.data)}};Ao.create=t=>new Ao({typeName:fe.ZodUndefined,...Ce(t)});var To=class extends Se{_parse(e){if(this._getType(e)!==Q.null){let i=this._getOrReturnCtx(e);return le(i,{code:Y.invalid_type,expected:Q.null,received:i.parsedType}),me}return Lt(e.data)}};To.create=t=>new To({typeName:fe.ZodNull,...Ce(t)});var cn=class extends Se{constructor(){super(...arguments),this._any=!0}_parse(e){return Lt(e.data)}};cn.create=t=>new cn({typeName:fe.ZodAny,...Ce(t)});var ri=class extends Se{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Lt(e.data)}};ri.create=t=>new ri({typeName:fe.ZodUnknown,...Ce(t)});var ni=class extends Se{_parse(e){let r=this._getOrReturnCtx(e);return le(r,{code:Y.invalid_type,expected:Q.never,received:r.parsedType}),me}};ni.create=t=>new ni({typeName:fe.ZodNever,...Ce(t)});var Io=class extends Se{_parse(e){if(this._getType(e)!==Q.undefined){let i=this._getOrReturnCtx(e);return le(i,{code:Y.invalid_type,expected:Q.void,received:i.parsedType}),me}return Lt(e.data)}};Io.create=t=>new Io({typeName:fe.ZodVoid,...Ce(t)});var br=class extends Se{_parse(e){let{ctx:r,status:i}=this._processInputParams(e),n=this._def;if(r.parsedType!==Q.array)return le(r,{code:Y.invalid_type,expected:Q.array,received:r.parsedType}),me;if(n.minLength!==null&&r.data.length<n.minLength.value&&(le(r,{code:Y.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,message:n.minLength.message}),i.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(le(r,{code:Y.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,message:n.maxLength.message}),i.dirty()),r.common.async)return Promise.all(r.data.map((a,h)=>n.type._parseAsync(new yr(r,a,r.path,h)))).then(a=>At.mergeArray(i,a));let o=r.data.map((a,h)=>n.type._parseSync(new yr(r,a,r.path,h)));return At.mergeArray(i,o)}get element(){return this._def.type}min(e,r){return new br({...this._def,minLength:{value:e,message:$e.toString(r)}})}max(e,r){return new br({...this._def,maxLength:{value:e,message:$e.toString(r)}})}length(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};br.create=(t,e)=>new br({type:t,minLength:null,maxLength:null,typeName:fe.ZodArray,...Ce(e)});var du;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(du||(du={}));var t5=t=>e=>new Ve({...t,shape:()=>({...t.shape(),...e})});function Mo(t){if(t instanceof Ve){let e={};for(let r in t.shape){let i=t.shape[r];e[r]=gr.create(Mo(i))}return new Ve({...t._def,shape:()=>e})}else return t instanceof br?br.create(Mo(t.element)):t instanceof gr?gr.create(Mo(t.unwrap())):t instanceof Bi?Bi.create(Mo(t.unwrap())):t instanceof vr?vr.create(t.items.map(e=>Mo(e))):t}var Ve=class extends Se{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=t5(this._def),this.extend=t5(this._def)}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Je.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==Q.object){let m=this._getOrReturnCtx(e);return le(m,{code:Y.invalid_type,expected:Q.object,received:m.parsedType}),me}let{status:i,ctx:n}=this._processInputParams(e),{shape:o,keys:a}=this._getCached(),h=[];for(let m in n.data)a.includes(m)||h.push(m);let d=[];for(let m of a){let p=o[m],M=n.data[m];d.push({key:{status:"valid",value:m},value:p._parse(new yr(n,M,n.path,m)),alwaysSet:m in n.data})}if(this._def.catchall instanceof ni){let m=this._def.unknownKeys;if(m==="passthrough")for(let p of h)d.push({key:{status:"valid",value:p},value:{status:"valid",value:n.data[p]}});else if(m==="strict")h.length>0&&(le(n,{code:Y.unrecognized_keys,keys:h}),i.dirty());else if(m!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let m=this._def.catchall;for(let p of h){let M=n.data[p];d.push({key:{status:"valid",value:p},value:m._parse(new yr(n,M,n.path,p)),alwaysSet:p in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let m=[];for(let p of d){let M=await p.key;m.push({key:M,value:await p.value,alwaysSet:p.alwaysSet})}return m}).then(m=>At.mergeObjectSync(i,m)):At.mergeObjectSync(i,d)}get shape(){return this._def.shape()}strict(e){return $e.errToObj,new Ve({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,i)=>{var n,o,a,h;let d=(a=(o=(n=this._def).errorMap)===null||o===void 0?void 0:o.call(n,r,i).message)!==null&&a!==void 0?a:i.defaultError;return r.code==="unrecognized_keys"?{message:(h=$e.errToObj(e).message)!==null&&h!==void 0?h:d}:{message:d}}}:{}})}strip(){return new Ve({...this._def,unknownKeys:"strip"})}passthrough(){return new Ve({...this._def,unknownKeys:"passthrough"})}setKey(e,r){return this.augment({[e]:r})}merge(e){return new Ve({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>du.mergeShapes(this._def.shape(),e._def.shape()),typeName:fe.ZodObject})}catchall(e){return new Ve({...this._def,catchall:e})}pick(e){let r={};return Je.objectKeys(e).map(i=>{this.shape[i]&&(r[i]=this.shape[i])}),new Ve({...this._def,shape:()=>r})}omit(e){let r={};return Je.objectKeys(this.shape).map(i=>{Je.objectKeys(e).indexOf(i)===-1&&(r[i]=this.shape[i])}),new Ve({...this._def,shape:()=>r})}deepPartial(){return Mo(this)}partial(e){let r={};if(e)return Je.objectKeys(this.shape).map(i=>{Je.objectKeys(e).indexOf(i)===-1?r[i]=this.shape[i]:r[i]=this.shape[i].optional()}),new Ve({...this._def,shape:()=>r});for(let i in this.shape){let n=this.shape[i];r[i]=n.optional()}return new Ve({...this._def,shape:()=>r})}required(){let e={};for(let r in this.shape){let n=this.shape[r];for(;n instanceof gr;)n=n._def.innerType;e[r]=n}return new Ve({...this._def,shape:()=>e})}};Ve.create=(t,e)=>new Ve({shape:()=>t,unknownKeys:"strip",catchall:ni.create(),typeName:fe.ZodObject,...Ce(e)});Ve.strictCreate=(t,e)=>new Ve({shape:()=>t,unknownKeys:"strict",catchall:ni.create(),typeName:fe.ZodObject,...Ce(e)});Ve.lazycreate=(t,e)=>new Ve({shape:t,unknownKeys:"strip",catchall:ni.create(),typeName:fe.ZodObject,...Ce(e)});var ss=class extends Se{_parse(e){let{ctx:r}=this._processInputParams(e),i=this._def.options;function n(o){for(let h of o)if(h.result.status==="valid")return h.result;for(let h of o)if(h.result.status==="dirty")return r.common.issues.push(...h.ctx.common.issues),h.result;let a=o.map(h=>new Br(h.ctx.common.issues));return le(r,{code:Y.invalid_union,unionErrors:a}),me}if(r.common.async)return Promise.all(i.map(async o=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(n);{let o,a=[];for(let d of i){let m={...r,common:{...r.common,issues:[]},parent:null},p=d._parseSync({data:r.data,path:r.path,parent:m});if(p.status==="valid")return p;p.status==="dirty"&&!o&&(o={result:p,ctx:m}),m.common.issues.length&&a.push(m.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let h=a.map(d=>new Br(d));return le(r,{code:Y.invalid_union,unionErrors:h}),me}}get options(){return this._def.options}};ss.create=(t,e)=>new ss({options:t,typeName:fe.ZodUnion,...Ce(e)});var Po=class extends Se{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Q.object)return le(r,{code:Y.invalid_type,expected:Q.object,received:r.parsedType}),me;let i=this.discriminator,n=r.data[i],o=this.options.get(n);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(le(r,{code:Y.invalid_union_discriminator,options:this.validDiscriminatorValues,path:[i]}),me)}get discriminator(){return this._def.discriminator}get validDiscriminatorValues(){return Array.from(this.options.keys())}get options(){return this._def.options}static create(e,r,i){let n=new Map;try{r.forEach(o=>{let a=o.shape[e].value;n.set(a,o)})}catch{throw new Error("The discriminator value could not be extracted from all the provided schemas")}if(n.size!==r.length)throw new Error("Some of the discriminator values are not unique");return new Po({typeName:fe.ZodDiscriminatedUnion,discriminator:e,options:n,...Ce(i)})}};function hf(t,e){let r=hn(t),i=hn(e);if(t===e)return{valid:!0,data:t};if(r===Q.object&&i===Q.object){let n=Je.objectKeys(e),o=Je.objectKeys(t).filter(h=>n.indexOf(h)!==-1),a={...t,...e};for(let h of o){let d=hf(t[h],e[h]);if(!d.valid)return{valid:!1};a[h]=d.data}return{valid:!0,data:a}}else if(r===Q.array&&i===Q.array){if(t.length!==e.length)return{valid:!1};let n=[];for(let o=0;o<t.length;o++){let a=t[o],h=e[o],d=hf(a,h);if(!d.valid)return{valid:!1};n.push(d.data)}return{valid:!0,data:n}}else return r===Q.date&&i===Q.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var os=class extends Se{_parse(e){let{status:r,ctx:i}=this._processInputParams(e),n=(o,a)=>{if(af(o)||af(a))return me;let h=hf(o.value,a.value);return h.valid?((lf(o)||lf(a))&&r.dirty(),{status:r.value,value:h.data}):(le(i,{code:Y.invalid_intersection_types}),me)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([o,a])=>n(o,a)):n(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};os.create=(t,e,r)=>new os({left:t,right:e,typeName:fe.ZodIntersection,...Ce(r)});var vr=class extends Se{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==Q.array)return le(i,{code:Y.invalid_type,expected:Q.array,received:i.parsedType}),me;if(i.data.length<this._def.items.length)return le(i,{code:Y.too_small,minimum:this._def.items.length,inclusive:!0,type:"array"}),me;!this._def.rest&&i.data.length>this._def.items.length&&(le(i,{code:Y.too_big,maximum:this._def.items.length,inclusive:!0,type:"array"}),r.dirty());let o=i.data.map((a,h)=>{let d=this._def.items[h]||this._def.rest;return d?d._parse(new yr(i,a,i.path,h)):null}).filter(a=>!!a);return i.common.async?Promise.all(o).then(a=>At.mergeArray(r,a)):At.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new vr({...this._def,rest:e})}};vr.create=(t,e)=>new vr({items:t,typeName:fe.ZodTuple,rest:null,...Ce(e)});var as=class extends Se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==Q.object)return le(i,{code:Y.invalid_type,expected:Q.object,received:i.parsedType}),me;let n=[],o=this._def.keyType,a=this._def.valueType;for(let h in i.data)n.push({key:o._parse(new yr(i,h,i.path,h)),value:a._parse(new yr(i,i.data[h],i.path,h))});return i.common.async?At.mergeObjectAsync(r,n):At.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(e,r,i){return r instanceof Se?new as({keyType:e,valueType:r,typeName:fe.ZodRecord,...Ce(i)}):new as({keyType:ii.create(),valueType:e,typeName:fe.ZodRecord,...Ce(r)})}},Oo=class extends Se{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==Q.map)return le(i,{code:Y.invalid_type,expected:Q.map,received:i.parsedType}),me;let n=this._def.keyType,o=this._def.valueType,a=[...i.data.entries()].map(([h,d],m)=>({key:n._parse(new yr(i,h,i.path,[m,"key"])),value:o._parse(new yr(i,d,i.path,[m,"value"]))}));if(i.common.async){let h=new Map;return Promise.resolve().then(async()=>{for(let d of a){let m=await d.key,p=await d.value;if(m.status==="aborted"||p.status==="aborted")return me;(m.status==="dirty"||p.status==="dirty")&&r.dirty(),h.set(m.value,p.value)}return{status:r.value,value:h}})}else{let h=new Map;for(let d of a){let m=d.key,p=d.value;if(m.status==="aborted"||p.status==="aborted")return me;(m.status==="dirty"||p.status==="dirty")&&r.dirty(),h.set(m.value,p.value)}return{status:r.value,value:h}}}};Oo.create=(t,e,r)=>new Oo({valueType:e,keyType:t,typeName:fe.ZodMap,...Ce(r)});var Li=class extends Se{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==Q.set)return le(i,{code:Y.invalid_type,expected:Q.set,received:i.parsedType}),me;let n=this._def;n.minSize!==null&&i.data.size<n.minSize.value&&(le(i,{code:Y.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&i.data.size>n.maxSize.value&&(le(i,{code:Y.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,message:n.maxSize.message}),r.dirty());let o=this._def.valueType;function a(d){let m=new Set;for(let p of d){if(p.status==="aborted")return me;p.status==="dirty"&&r.dirty(),m.add(p.value)}return{status:r.value,value:m}}let h=[...i.data.values()].map((d,m)=>o._parse(new yr(i,d,i.path,m)));return i.common.async?Promise.all(h).then(d=>a(d)):a(h)}min(e,r){return new Li({...this._def,minSize:{value:e,message:$e.toString(r)}})}max(e,r){return new Li({...this._def,maxSize:{value:e,message:$e.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Li.create=(t,e)=>new Li({valueType:t,minSize:null,maxSize:null,typeName:fe.ZodSet,...Ce(e)});var Ni=class extends Se{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Q.function)return le(r,{code:Y.invalid_type,expected:Q.function,received:r.parsedType}),me;function i(h,d){return cu({data:h,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,a1,o1].filter(m=>!!m),issueData:{code:Y.invalid_arguments,argumentsError:d}})}function n(h,d){return cu({data:h,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,a1,o1].filter(m=>!!m),issueData:{code:Y.invalid_return_type,returnTypeError:d}})}let o={errorMap:r.common.contextualErrorMap},a=r.data;return this._def.returns instanceof fn?Lt(async(...h)=>{let d=new Br([]),m=await this._def.args.parseAsync(h,o).catch(R=>{throw d.addIssue(i(h,R)),d}),p=await a(...m);return await this._def.returns._def.type.parseAsync(p,o).catch(R=>{throw d.addIssue(n(p,R)),d})}):Lt((...h)=>{let d=this._def.args.safeParse(h,o);if(!d.success)throw new Br([i(h,d.error)]);let m=a(...d.data),p=this._def.returns.safeParse(m,o);if(!p.success)throw new Br([n(m,p.error)]);return p.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ni({...this._def,args:vr.create(e).rest(ri.create())})}returns(e){return new Ni({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}};Ni.create=(t,e,r)=>new Ni({args:t?t.rest(ri.create()):vr.create([]).rest(ri.create()),returns:e||ri.create(),typeName:fe.ZodFunction,...Ce(r)});var ko=class extends Se{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};ko.create=(t,e)=>new ko({getter:t,typeName:fe.ZodLazy,...Ce(e)});var Lo=class extends Se{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return le(r,{code:Y.invalid_literal,expected:this._def.value}),me}return{status:"valid",value:e.data}}get value(){return this._def.value}};Lo.create=(t,e)=>new Lo({value:t,typeName:fe.ZodLiteral,...Ce(e)});function Uy(t,e){return new No({values:t,typeName:fe.ZodEnum,...Ce(e)})}var No=class extends Se{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),i=this._def.values;return le(r,{expected:Je.joinValues(i),received:r.parsedType,code:Y.invalid_type}),me}if(this._def.values.indexOf(e.data)===-1){let r=this._getOrReturnCtx(e),i=this._def.values;return le(r,{received:r.data,code:Y.invalid_enum_value,options:i}),me}return Lt(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}};No.create=Uy;var Bo=class extends Se{_parse(e){let r=Je.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==Q.string&&i.parsedType!==Q.number){let n=Je.objectValues(r);return le(i,{expected:Je.joinValues(n),received:i.parsedType,code:Y.invalid_type}),me}if(r.indexOf(e.data)===-1){let n=Je.objectValues(r);return le(i,{received:i.data,code:Y.invalid_enum_value,options:n}),me}return Lt(e.data)}get enum(){return this._def.values}};Bo.create=(t,e)=>new Bo({values:t,typeName:fe.ZodNativeEnum,...Ce(e)});var fn=class extends Se{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Q.promise&&r.common.async===!1)return le(r,{code:Y.invalid_type,expected:Q.promise,received:r.parsedType}),me;let i=r.parsedType===Q.promise?r.data:Promise.resolve(r.data);return Lt(i.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};fn.create=(t,e)=>new fn({type:t,typeName:fe.ZodPromise,...Ce(e)});var wr=class extends Se{innerType(){return this._def.schema}_parse(e){let{status:r,ctx:i}=this._processInputParams(e),n=this._def.effect||null;if(n.type==="preprocess"){let a=n.transform(i.data);return i.common.async?Promise.resolve(a).then(h=>this._def.schema._parseAsync({data:h,path:i.path,parent:i})):this._def.schema._parseSync({data:a,path:i.path,parent:i})}let o={addIssue:a=>{le(i,a),a.fatal?r.abort():r.dirty()},get path(){return i.path}};if(o.addIssue=o.addIssue.bind(o),n.type==="refinement"){let a=h=>{let d=n.refinement(h,o);if(i.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return h};if(i.common.async===!1){let h=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return h.status==="aborted"?me:(h.status==="dirty"&&r.dirty(),a(h.value),{status:r.value,value:h.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(h=>h.status==="aborted"?me:(h.status==="dirty"&&r.dirty(),a(h.value).then(()=>({status:r.value,value:h.value}))))}if(n.type==="transform")if(i.common.async===!1){let a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!fu(a))return a;let h=n.transform(a.value,o);if(h instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:h}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>fu(a)?Promise.resolve(n.transform(a.value,o)).then(h=>({status:r.value,value:h})):a);Je.assertNever(n)}};wr.create=(t,e,r)=>new wr({schema:t,typeName:fe.ZodEffects,effect:e,...Ce(r)});wr.createWithPreprocess=(t,e,r)=>new wr({schema:e,effect:{type:"preprocess",transform:t},typeName:fe.ZodEffects,...Ce(r)});var gr=class extends Se{_parse(e){return this._getType(e)===Q.undefined?Lt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};gr.create=(t,e)=>new gr({innerType:t,typeName:fe.ZodOptional,...Ce(e)});var Bi=class extends Se{_parse(e){return this._getType(e)===Q.null?Lt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Bi.create=(t,e)=>new Bi({innerType:t,typeName:fe.ZodNullable,...Ce(e)});var l1=class extends Se{_parse(e){let{ctx:r}=this._processInputParams(e),i=r.data;return r.parsedType===Q.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};l1.create=(t,e)=>new gr({innerType:t,typeName:fe.ZodOptional,...Ce(e)});var Do=class extends Se{_parse(e){if(this._getType(e)!==Q.nan){let i=this._getOrReturnCtx(e);return le(i,{code:Y.invalid_type,expected:Q.nan,received:i.parsedType}),me}return{status:"valid",value:e.data}}};Do.create=t=>new Do({typeName:fe.ZodNaN,...Ce(t)});var i5=(t,e={},r)=>t?cn.create().superRefine((i,n)=>{if(!t(i)){let o=typeof e=="function"?e(i):e,a=typeof o=="string"?{message:o}:o;n.addIssue({code:"custom",...a,fatal:r})}}):cn.create(),jy={object:Ve.lazycreate},fe;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodPromise="ZodPromise"})(fe||(fe={}));var $y=(t,e={message:`Input not instance of ${t.name}`})=>i5(r=>r instanceof t,e,!0),n5=ii.create,s5=ki.create,qy=Do.create,Fy=Eo.create,o5=Ro.create,Wy=Co.create,Hy=Ao.create,Gy=To.create,Vy=cn.create,Ky=ri.create,Jy=ni.create,Zy=Io.create,Yy=br.create,Xy=Ve.create,Qy=Ve.strictCreate,e8=ss.create,t8=Po.create,r8=os.create,i8=vr.create,n8=as.create,s8=Oo.create,o8=Li.create,a8=Ni.create,l8=ko.create,u8=Lo.create,h8=No.create,c8=Bo.create,f8=fn.create,r5=wr.create,d8=gr.create,m8=Bi.create,p8=wr.createWithPreprocess,g8=()=>n5().optional(),y8=()=>s5().optional(),b8=()=>o5().optional(),oe=Object.freeze({__proto__:null,getParsedType:hn,ZodParsedType:Q,makeIssue:cu,EMPTY_PATH:ky,addIssueToContext:le,ParseStatus:At,INVALID:me,DIRTY:Ly,OK:Lt,isAborted:af,isDirty:lf,isValid:fu,isAsync:uf,ZodType:Se,ZodString:ii,ZodNumber:ki,ZodBigInt:Eo,ZodBoolean:Ro,ZodDate:Co,ZodUndefined:Ao,ZodNull:To,ZodAny:cn,ZodUnknown:ri,ZodNever:ni,ZodVoid:Io,ZodArray:br,get objectUtil(){return du},ZodObject:Ve,ZodUnion:ss,ZodDiscriminatedUnion:Po,ZodIntersection:os,ZodTuple:vr,ZodRecord:as,ZodMap:Oo,ZodSet:Li,ZodFunction:Ni,ZodLazy:ko,ZodLiteral:Lo,ZodEnum:No,ZodNativeEnum:Bo,ZodPromise:fn,ZodEffects:wr,ZodTransformer:wr,ZodOptional:gr,ZodNullable:Bi,ZodDefault:l1,ZodNaN:Do,custom:i5,Schema:Se,ZodSchema:Se,late:jy,get ZodFirstPartyTypeKind(){return fe},any:Vy,array:Yy,bigint:Fy,boolean:o5,date:Wy,discriminatedUnion:t8,effect:r5,enum:h8,function:a8,instanceof:$y,intersection:r8,lazy:l8,literal:u8,map:s8,nan:qy,nativeEnum:c8,never:Jy,null:Gy,nullable:m8,number:s5,object:Xy,oboolean:b8,onumber:y8,optional:d8,ostring:g8,preprocess:p8,promise:f8,record:n8,set:o8,strictObject:Qy,string:n5,transformer:r5,tuple:i8,undefined:Hy,union:e8,unknown:Ky,void:Zy,ZodIssueCode:Y,quotelessJson:Py,ZodError:Br,defaultErrorMap:o1,get overrideErrorMap(){return a1},setErrorMap:Oy});var v8=oe.object({title:oe.string(),description:oe.string(),fees:oe.string(),accessConstraints:oe.string()}),w8=oe.object({deliveryPoint:oe.string(),city:oe.string(),postalCode:oe.string(),country:oe.string(),email:oe.string()}),_8=oe.object({individualName:oe.string(),position:oe.string(),phone:oe.string(),address:w8}),x8=oe.object({name:oe.string(),site:oe.string(),contact:_8}),S8=oe.object({id:oe.string(),serviceIdentification:v8,serviceProvider:x8});var M8=oe.object({id:oe.string(),version:oe.number(),name:oe.string(),metadata:oe.unknown().optional(),sprite:oe.string().optional(),glyphs:oe.string().optional(),sources:oe.unknown(),layers:oe.array(oe.unknown())});function E8(t){try{return Vl(t),!0}catch{return!1}}var R8=oe.string().refine(E8,{message:"Invalid hex color"}),zo={minZoom:0,maxZoom:32},mu=oe.number().refine(t=>t>=zo.minZoom&&t<=zo.maxZoom,{message:`must be between ${zo.minZoom} and ${zo.maxZoom}`}),C8=oe.object({name:oe.string(),title:oe.string().optional(),category:oe.string().optional(),2193:oe.string().optional(),3857:oe.string().optional(),minZoom:mu.optional(),maxZoom:mu.optional()}).refine(({minZoom:t,maxZoom:e})=>(t||zo.minZoom)<=(e||zo.maxZoom),{message:"minZoom may no be greater than maxZoom",path:["minZoom"]}),A8=oe.object({type:oe.nativeEnum(vt),id:oe.string(),title:oe.string().optional(),category:oe.string().optional(),description:oe.string().optional(),background:R8.optional(),layers:oe.array(C8),minZoom:mu.optional(),maxZoom:mu.optional(),format:oe.union([oe.nativeEnum(He),oe.nativeEnum(rr)]).optional()});var u1={Aws:{Region:"ap-southeast-2"},ApiKey:{QueryString:"api",TableName:"ApiKey",RequestLimitMinute:1e3},TileMetadata:{TableName:"TileMetadata",RequestLimitMinute:1e3}},Qe={PublicUrlBase:"BASEMAPS_PUBLIC_URL",AssetLocation:"BASEMAPS_ASSEST_LOCATION",TiffConcurrency:"TIFF_CONCURRENCY",TempFolder:"TEMP_FOLDER",BatchIndex:"AWS_BATCH_JOB_ARRAY_INDEX",AwsRoleDurationHours:"AWS_ROLE_DURATION_HOURS",AwsRoleConfigPath:"ROLE_CONFIG_PATH",ImportImageryBucket:"IMPORT_IMAGERY_BUCKET",ImportFilesNumberLimit:"FILES_NUMBER_LIMIT",ImportFilesSizeLimitGb:"FILES_SIZE_LIMIT_GB",Gdal:{UseDocker:"GDAL_DOCKER",DockerContainer:"GDAL_DOCKER_CONTAINER",DockerContainerTag:"GDAL_DOCKER_CONTAINER_TAG"},Analytics:{CloudFrontId:"ANALYTICS_CLOUD_FRONT_ID",CloudFrontSourceBucket:"ANALYTICS_CLOUD_FRONT_SOURCE_BUCKET",CacheBucket:"ANALYTICS_CACHE_BUCKET"},get(t){return process.env[t]},getNumber(t,e){let r=Qe.get(t);if(r===""||r==null)return e;let i=parseFloat(r);return isNaN(i)?e:i},isProduction(){return!0}};var L0=de(t0(),1);var zr=de(fm(),1);function jv(t){return t<=10?zr.default.gray("TRACE"):t<=20?zr.default.magenta("DEBUG"):t<=30?zr.default.cyan("INFO"):t<=40?zr.default.yellow("WARN"):t<=50?zr.default.red("ERROR"):zr.default.bgRed("FATAL")}var Di=class{constructor(e){this.level=e}static formatObject(e){let r=[];for(let i of Object.keys(e)){if(Di.Ignore.has(i))continue;let n=e[i];if(n==null||n==="")continue;let o="",a=typeof n;if(a==="number")o=zr.default.yellow(String(n));else if(a==="string")o=zr.default.green(n);else if(a==="object"){let h=this.formatObject(n);h.length>0&&(o=`{ ${h.join(" ")} }`)}else o=String(n);o!==""&&r.push(`${zr.default.dim(i)}=${o}`)}return r}pretty(e){if(e.level<this.level)return null;let r=new Date(e.time);if(isNaN(r.getTime()))return null;let n=Di.formatObject(e).join(" ");return`[${r.toISOString()}] ${jv(e.level)} ${zr.default.blue(e.msg)} ${n}`}};Di.Ignore=new Set(["pid","time","hostname","level","v","name","msg"]);var wp=de(vp(),1),Go=require("stream"),_p=require("string_decoder");function V_(t){try{return JSON.parse(t)}catch{return null}}function K_(t){t!=null&&console.error("PrettyTransformFailed",t)}var _n=class extends Go.Transform{constructor(){super(),this.pretty=new Di(-1),this.decoder=new _p.StringDecoder}static stream(e=process.stdout){let r=new Go.PassThrough;return _n.pretty(r,e),r}static pretty(e,r=process.stdout){let i=new _n;return(0,Go.pipeline)(e,(0,wp.default)(),i,r,K_),i}_transform(e,r,i){if(r!=="buffer")return i(new Error(`Unknown encoding: ${r}`));let n=this.decoder.write(e),o=V_(n);if(o==null)return i(null,e+`
135
+ `),i=!1,n=!1,o;t.on("response",a=>{let{headers:h}=a;i=h["transfer-encoding"]==="chunked"&&!h["content-length"]}),t.on("socket",a=>{let h=()=>{if(i&&!n){let d=new Error("Premature close");d.code="ERR_STREAM_PREMATURE_CLOSE",e(d)}};a.prependListener("close",h),t.on("abort",()=>{a.removeListener("close",h)}),a.on("data",d=>{n=s1.Buffer.compare(d.slice(-5),r)===0,!n&&o&&(n=s1.Buffer.compare(o.slice(-3),r.slice(0,3))===0&&s1.Buffer.compare(d.slice(-2),r.slice(3))===0),o=d})})}var kt=class extends Rt{constructor(e){super(),this.type="url",this.protocol="http",this.chunkSize=kt.DefaultChunkSize,this.uri=e}static isSource(e){return e.type==="url"}get size(){return this._size?this._size:(this._size=Promise.resolve().then(async()=>{let e=await kt.fetch(this.uri,{method:"HEAD"});return Number(e.headers.get("content-length"))}),this._size)}async fetchBytes(e,r){let n={Range:this.toRange(e,r)},o=await kt.fetch(this.uri,{headers:n});if(o.ok){let a=o.headers.get("content-range");return this._size==null&&a!=null&&(this._size=Promise.resolve(this.parseContentRange(a))),o.arrayBuffer()}throw new Error("Failed to fetch")}};kt.DefaultChunkSize=32*1024;kt.fetch=(t,e)=>fetch(t,e);function X2(t,e){return Ei(t)?t.code==="ENOENT"?new it(e,404,t):t.code==="EACCES"?new it(e,403,t):new it(e,500,t):new it(e,500,t)}var Oi=class{constructor(){this.protocol=Oi.protocol}static is(e){return e.protocol===Oi.protocol}source(e){return new kt(e)}async*list(e){throw new Error(`Unable to "list" on ${e}`)}async*details(e){throw new Error(`Unable to "details" on ${e}`)}async head(e){let r=await kt.fetch(e,{method:"HEAD"});if(!r.ok)throw X2(new Error(r.statusText),`Failed to head: ${e}`);return{path:e,size:Number(r.headers.get("content-length")),isDirectory:!1}}async read(e){let r=await kt.fetch(e,{method:"GET"});if(!r.ok)throw X2(new Error(r.statusText),`Failed to head: ${e}`);return Buffer.from(await r.arrayBuffer())}async write(e){throw new Error(`Unable to "write" on ${e}`)}stream(e){throw new Error(`Unable to "stream" on ${e}`)}};Oi.protocol="http";kt.fetch=uu;function ky(t){return typeof t!="object"||t==null?!1:t.constructor===Object}var hu=class{constructor(){this.protocol="abstract",this.isOrdered=!0,this.systems=[],this.toArray=p2,this.join=Jc,this.joinAll=m2}register(e,r,i="rw"){for(let n=0;n<this.systems.length;n++){let o=this.systems[n];if(o.path===e&&o.flag===i){this.systems.splice(n,1,{path:e,system:r,flag:i});return}}this.systems.push({path:e,system:r,flag:i}),this.isOrdered=!1}read(e){return this.get(e,"r").read(e)}async readJson(e){let r=await this.read(e);return JSON.parse(r.toString())}stream(e){return this.get(e,"r").stream(e)}write(e,r,i){if(Array.isArray(r)||ky(r)){let n=JSON.stringify(r,null,2);return this.get(e,"rw").write(e,n,{contentType:"application/json",...i})}return this.get(e,"rw").write(e,r,i)}list(e,r){return this.get(e,"r").list(e,r)}details(e,r){return this.get(e,"r").details(e,r)}exists(e){return this.get(e,"r").head(e).then(r=>r!=null)}head(e){return this.get(e,"r").head(e)}source(e){return this.get(e,"r").source(e)}sortSystems(){this.isOrdered||(this.systems.sort((e,r)=>r.path.length-e.path.length),this.isOrdered=!0)}get(e,r){this.sortSystems();for(let i of this.systems)if(e.startsWith(i.path)){if(r==="rw"&&i.flag==="r")continue;return i.system}throw new Error(`Unable to find file system for path:${e}`)}},nt=new hu;var Q2=new Ri;nt.register("",Q2);nt.register("file://",Q2);var e5=new Oi;nt.register("http://",e5);nt.register("https://",e5);var k8=de(yo(),1);var Je;(function(t){function e(i){throw new Error}t.assertNever=e,t.arrayToEnum=i=>{let n={};for(let o of i)n[o]=o;return n},t.getValidEnumValues=i=>{let n=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(let a of n)o[a]=i[a];return t.objectValues(o)},t.objectValues=i=>t.objectKeys(i).map(function(n){return i[n]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let n=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&n.push(o);return n},t.find=(i,n)=>{for(let o of i)if(n(o))return o},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,n=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(n)}t.joinValues=r})(Je||(Je={}));var ee=Je.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),hn=t=>{switch(typeof t){case"undefined":return ee.undefined;case"string":return ee.string;case"number":return isNaN(t)?ee.nan:ee.number;case"boolean":return ee.boolean;case"function":return ee.function;case"bigint":return ee.bigint;case"object":return Array.isArray(t)?ee.array:t===null?ee.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ee.promise:typeof Map<"u"&&t instanceof Map?ee.map:typeof Set<"u"&&t instanceof Set?ee.set:typeof Date<"u"&&t instanceof Date?ee.date:ee.object;default:return ee.unknown}},Y=Je.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of"]),Ly=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Br=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let r=e||function(o){return o.message},i={_errors:[]},n=o=>{for(let a of o.issues)if(a.code==="invalid_union")a.unionErrors.map(n);else if(a.code==="invalid_return_type")n(a.returnTypeError);else if(a.code==="invalid_arguments")n(a.argumentsError);else if(a.path.length===0)i._errors.push(r(a));else{let h=i,d=0;for(;d<a.path.length;){let m=a.path[d];d===a.path.length-1?(h[m]=h[m]||{_errors:[]},h[m]._errors.push(r(a))):h[m]=h[m]||{_errors:[]},h=h[m],d++}}};return n(this),i}toString(){return this.message}get message(){return JSON.stringify(this.issues,null,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},i=[];for(let n of this.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):i.push(e(n));return{formErrors:i,fieldErrors:r}}get formErrors(){return this.flatten()}};Br.create=t=>new Br(t);var o1=(t,e)=>{let r;switch(t.code){case Y.invalid_type:t.received===ee.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Y.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected)}`;break;case Y.unrecognized_keys:r=`Unrecognized key(s) in object: ${Je.joinValues(t.keys,", ")}`;break;case Y.invalid_union:r="Invalid input";break;case Y.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Je.joinValues(t.options)}`;break;case Y.invalid_enum_value:r=`Invalid enum value. Expected ${Je.joinValues(t.options)}, received '${t.received}'`;break;case Y.invalid_arguments:r="Invalid function arguments";break;case Y.invalid_return_type:r="Invalid function return type";break;case Y.invalid_date:r="Invalid date";break;case Y.invalid_string:t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Y.too_small:t.type==="array"?r=`Array must contain ${t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be greater than ${t.inclusive?"or equal to ":""}${t.minimum}`:r="Invalid input";break;case Y.too_big:t.type==="array"?r=`Array must contain ${t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be less than ${t.inclusive?"or equal to ":""}${t.maximum}`:r="Invalid input";break;case Y.custom:r="Invalid input";break;case Y.invalid_intersection_types:r="Intersection results could not be merged";break;case Y.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;default:r=e.defaultError,Je.assertNever(t)}return{message:r}},a1=o1,Ny=t=>{a1=t},cu=t=>{let{data:e,path:r,errorMaps:i,issueData:n}=t,o=[...r,...n.path||[]],a={...n,path:o},h="",d=i.filter(m=>!!m).slice().reverse();for(let m of d)h=m(a,{data:e,defaultError:h}).message;return{...n,path:o,message:n.message||h}},By=[];function le(t,e){let r=cu({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,a1,o1].filter(i=>!!i)});t.common.issues.push(r)}var At=class{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let i=[];for(let n of r){if(n.status==="aborted")return me;n.status==="dirty"&&e.dirty(),i.push(n.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,r){let i=[];for(let n of r)i.push({key:await n.key,value:await n.value});return At.mergeObjectSync(e,i)}static mergeObjectSync(e,r){let i={};for(let n of r){let{key:o,value:a}=n;if(o.status==="aborted"||a.status==="aborted")return me;o.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),(typeof a.value<"u"||n.alwaysSet)&&(i[o.value]=a.value)}return{status:e.value,value:i}}},me=Object.freeze({status:"aborted"}),Dy=t=>({status:"dirty",value:t}),Lt=t=>({status:"valid",value:t}),af=t=>t.status==="aborted",lf=t=>t.status==="dirty",fu=t=>t.status==="valid",uf=t=>typeof Promise!==void 0&&t instanceof Promise,$e;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})($e||($e={}));var yr=class{constructor(e,r,i,n){this.parent=e,this.data=r,this._path=i,this._key=n}get path(){return this._path.concat(this._key)}},t5=(t,e)=>{if(fu(e))return{success:!0,data:e.value};{if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");let r=new Br(t.common.issues);return{success:!1,error:r}}};function Ce(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:i,description:n}=t;if(e&&(r||i))throw new Error(`Can't use "invalid" or "required" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(a,h)=>a.code!=="invalid_type"?{message:h.defaultError}:typeof h.data>"u"&&i?{message:i}:t.invalid_type_error?{message:t.invalid_type_error}:{message:h.defaultError},description:n}}var xe=class{constructor(e){this.spa=this.safeParseAsync,this.superRefine=this._refinement,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.default=this.default.bind(this),this.describe=this.describe.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return hn(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:hn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new At,ctx:{common:e.parent.common,data:e.data,parsedType:hn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(uf(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let i=this.safeParse(e,r);if(i.success)return i.data;throw i.error}safeParse(e,r){var i;let n={common:{issues:[],async:(i=r?.async)!==null&&i!==void 0?i:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:hn(e)},o=this._parseSync({data:e,path:n.path,parent:n});return t5(n,o)}async parseAsync(e,r){let i=await this.safeParseAsync(e,r);if(i.success)return i.data;throw i.error}async safeParseAsync(e,r){let i={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:hn(e)},n=this._parse({data:e,path:[],parent:i}),o=await(uf(n)?n:Promise.resolve(n));return t5(i,o)}refine(e,r){let i=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,o)=>{let a=e(n),h=()=>o.addIssue({code:Y.custom,...i(n)});return typeof Promise<"u"&&a instanceof Promise?a.then(d=>d?!0:(h(),!1)):a?!0:(h(),!1)})}refinement(e,r){return this._refinement((i,n)=>e(i)?!0:(n.addIssue(typeof r=="function"?r(i,n):r),!1))}_refinement(e){return new wr({schema:this,typeName:fe.ZodEffects,effect:{type:"refinement",refinement:e}})}optional(){return gr.create(this)}nullable(){return Bi.create(this)}nullish(){return this.optional().nullable()}array(){return br.create(this)}promise(){return fn.create(this)}or(e){return ns.create([this,e])}and(e){return ss.create(this,e)}transform(e){return new wr({schema:this,typeName:fe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new l1({innerType:this,defaultValue:r,typeName:fe.ZodDefault})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},zy=/^c[^\s-]{8,}$/i,Uy=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,jy=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,ii=class extends xe{constructor(){super(...arguments),this._regex=(e,r,i)=>this.refinement(n=>e.test(n),{validation:r,code:Y.invalid_string,...$e.errToObj(i)}),this.nonempty=e=>this.min(1,$e.errToObj(e)),this.trim=()=>new ii({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}_parse(e){if(this._getType(e)!==ee.string){let o=this._getOrReturnCtx(e);return le(o,{code:Y.invalid_type,expected:ee.string,received:o.parsedType}),me}let i=new At,n;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(n=this._getOrReturnCtx(e,n),le(n,{code:Y.too_small,minimum:o.value,type:"string",inclusive:!0,message:o.message}),i.dirty());else if(o.kind==="max")e.data.length>o.value&&(n=this._getOrReturnCtx(e,n),le(n,{code:Y.too_big,maximum:o.value,type:"string",inclusive:!0,message:o.message}),i.dirty());else if(o.kind==="email")jy.test(e.data)||(n=this._getOrReturnCtx(e,n),le(n,{validation:"email",code:Y.invalid_string,message:o.message}),i.dirty());else if(o.kind==="uuid")Uy.test(e.data)||(n=this._getOrReturnCtx(e,n),le(n,{validation:"uuid",code:Y.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid")zy.test(e.data)||(n=this._getOrReturnCtx(e,n),le(n,{validation:"cuid",code:Y.invalid_string,message:o.message}),i.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),le(n,{validation:"url",code:Y.invalid_string,message:o.message}),i.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),le(n,{validation:"regex",code:Y.invalid_string,message:o.message}),i.dirty())):o.kind==="trim"?e.data=e.data.trim():Je.assertNever(o);return{status:i.value,value:e.data}}_addCheck(e){return new ii({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...$e.errToObj(e)})}url(e){return this._addCheck({kind:"url",...$e.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...$e.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...$e.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...$e.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...$e.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...$e.errToObj(r)})}length(e,r){return this.min(e,r).max(e,r)}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get minLength(){let e=-1/0;return this._def.checks.map(r=>{r.kind==="min"&&(e===null||r.value>e)&&(e=r.value)}),e}get maxLength(){let e=null;return this._def.checks.map(r=>{r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}),e}};ii.create=t=>new ii({checks:[],typeName:fe.ZodString,...Ce(t)});function $y(t,e){let r=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,n=r>i?r:i,o=parseInt(t.toFixed(n).replace(".","")),a=parseInt(e.toFixed(n).replace(".",""));return o%a/Math.pow(10,n)}var ki=class extends xe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._getType(e)!==ee.number){let o=this._getOrReturnCtx(e);return le(o,{code:Y.invalid_type,expected:ee.number,received:o.parsedType}),me}let i,n=new At;for(let o of this._def.checks)o.kind==="int"?Je.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),le(i,{code:Y.invalid_type,expected:"integer",received:"float",message:o.message}),n.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(i=this._getOrReturnCtx(e,i),le(i,{code:Y.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,message:o.message}),n.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(i=this._getOrReturnCtx(e,i),le(i,{code:Y.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,message:o.message}),n.dirty()):o.kind==="multipleOf"?$y(e.data,o.value)!==0&&(i=this._getOrReturnCtx(e,i),le(i,{code:Y.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()):Je.assertNever(o);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,$e.toString(r))}gt(e,r){return this.setLimit("min",e,!1,$e.toString(r))}lte(e,r){return this.setLimit("max",e,!0,$e.toString(r))}lt(e,r){return this.setLimit("max",e,!1,$e.toString(r))}setLimit(e,r,i,n){return new ki({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:$e.toString(n)}]})}_addCheck(e){return new ki({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:$e.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:$e.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:$e.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:$e.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:$e.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:$e.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int")}};ki.create=t=>new ki({checks:[],typeName:fe.ZodNumber,...Ce(t)});var Eo=class extends xe{_parse(e){if(this._getType(e)!==ee.bigint){let i=this._getOrReturnCtx(e);return le(i,{code:Y.invalid_type,expected:ee.bigint,received:i.parsedType}),me}return Lt(e.data)}};Eo.create=t=>new Eo({typeName:fe.ZodBigInt,...Ce(t)});var Ro=class extends xe{_parse(e){if(this._getType(e)!==ee.boolean){let i=this._getOrReturnCtx(e);return le(i,{code:Y.invalid_type,expected:ee.boolean,received:i.parsedType}),me}return Lt(e.data)}};Ro.create=t=>new Ro({typeName:fe.ZodBoolean,...Ce(t)});var Co=class extends xe{_parse(e){if(this._getType(e)!==ee.date){let i=this._getOrReturnCtx(e);return le(i,{code:Y.invalid_type,expected:ee.date,received:i.parsedType}),me}if(isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return le(i,{code:Y.invalid_date}),me}return{status:"valid",value:new Date(e.data.getTime())}}};Co.create=t=>new Co({typeName:fe.ZodDate,...Ce(t)});var Ao=class extends xe{_parse(e){if(this._getType(e)!==ee.undefined){let i=this._getOrReturnCtx(e);return le(i,{code:Y.invalid_type,expected:ee.undefined,received:i.parsedType}),me}return Lt(e.data)}};Ao.create=t=>new Ao({typeName:fe.ZodUndefined,...Ce(t)});var To=class extends xe{_parse(e){if(this._getType(e)!==ee.null){let i=this._getOrReturnCtx(e);return le(i,{code:Y.invalid_type,expected:ee.null,received:i.parsedType}),me}return Lt(e.data)}};To.create=t=>new To({typeName:fe.ZodNull,...Ce(t)});var cn=class extends xe{constructor(){super(...arguments),this._any=!0}_parse(e){return Lt(e.data)}};cn.create=t=>new cn({typeName:fe.ZodAny,...Ce(t)});var ri=class extends xe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Lt(e.data)}};ri.create=t=>new ri({typeName:fe.ZodUnknown,...Ce(t)});var ni=class extends xe{_parse(e){let r=this._getOrReturnCtx(e);return le(r,{code:Y.invalid_type,expected:ee.never,received:r.parsedType}),me}};ni.create=t=>new ni({typeName:fe.ZodNever,...Ce(t)});var Io=class extends xe{_parse(e){if(this._getType(e)!==ee.undefined){let i=this._getOrReturnCtx(e);return le(i,{code:Y.invalid_type,expected:ee.void,received:i.parsedType}),me}return Lt(e.data)}};Io.create=t=>new Io({typeName:fe.ZodVoid,...Ce(t)});var br=class extends xe{_parse(e){let{ctx:r,status:i}=this._processInputParams(e),n=this._def;if(r.parsedType!==ee.array)return le(r,{code:Y.invalid_type,expected:ee.array,received:r.parsedType}),me;if(n.minLength!==null&&r.data.length<n.minLength.value&&(le(r,{code:Y.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,message:n.minLength.message}),i.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(le(r,{code:Y.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,message:n.maxLength.message}),i.dirty()),r.common.async)return Promise.all(r.data.map((a,h)=>n.type._parseAsync(new yr(r,a,r.path,h)))).then(a=>At.mergeArray(i,a));let o=r.data.map((a,h)=>n.type._parseSync(new yr(r,a,r.path,h)));return At.mergeArray(i,o)}get element(){return this._def.type}min(e,r){return new br({...this._def,minLength:{value:e,message:$e.toString(r)}})}max(e,r){return new br({...this._def,maxLength:{value:e,message:$e.toString(r)}})}length(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};br.create=(t,e)=>new br({type:t,minLength:null,maxLength:null,typeName:fe.ZodArray,...Ce(e)});var du;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(du||(du={}));var r5=t=>e=>new Ve({...t,shape:()=>({...t.shape(),...e})});function Mo(t){if(t instanceof Ve){let e={};for(let r in t.shape){let i=t.shape[r];e[r]=gr.create(Mo(i))}return new Ve({...t._def,shape:()=>e})}else return t instanceof br?br.create(Mo(t.element)):t instanceof gr?gr.create(Mo(t.unwrap())):t instanceof Bi?Bi.create(Mo(t.unwrap())):t instanceof vr?vr.create(t.items.map(e=>Mo(e))):t}var Ve=class extends xe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=r5(this._def),this.extend=r5(this._def)}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Je.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==ee.object){let m=this._getOrReturnCtx(e);return le(m,{code:Y.invalid_type,expected:ee.object,received:m.parsedType}),me}let{status:i,ctx:n}=this._processInputParams(e),{shape:o,keys:a}=this._getCached(),h=[];for(let m in n.data)a.includes(m)||h.push(m);let d=[];for(let m of a){let p=o[m],M=n.data[m];d.push({key:{status:"valid",value:m},value:p._parse(new yr(n,M,n.path,m)),alwaysSet:m in n.data})}if(this._def.catchall instanceof ni){let m=this._def.unknownKeys;if(m==="passthrough")for(let p of h)d.push({key:{status:"valid",value:p},value:{status:"valid",value:n.data[p]}});else if(m==="strict")h.length>0&&(le(n,{code:Y.unrecognized_keys,keys:h}),i.dirty());else if(m!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let m=this._def.catchall;for(let p of h){let M=n.data[p];d.push({key:{status:"valid",value:p},value:m._parse(new yr(n,M,n.path,p)),alwaysSet:p in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let m=[];for(let p of d){let M=await p.key;m.push({key:M,value:await p.value,alwaysSet:p.alwaysSet})}return m}).then(m=>At.mergeObjectSync(i,m)):At.mergeObjectSync(i,d)}get shape(){return this._def.shape()}strict(e){return $e.errToObj,new Ve({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,i)=>{var n,o,a,h;let d=(a=(o=(n=this._def).errorMap)===null||o===void 0?void 0:o.call(n,r,i).message)!==null&&a!==void 0?a:i.defaultError;return r.code==="unrecognized_keys"?{message:(h=$e.errToObj(e).message)!==null&&h!==void 0?h:d}:{message:d}}}:{}})}strip(){return new Ve({...this._def,unknownKeys:"strip"})}passthrough(){return new Ve({...this._def,unknownKeys:"passthrough"})}setKey(e,r){return this.augment({[e]:r})}merge(e){return new Ve({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>du.mergeShapes(this._def.shape(),e._def.shape()),typeName:fe.ZodObject})}catchall(e){return new Ve({...this._def,catchall:e})}pick(e){let r={};return Je.objectKeys(e).map(i=>{this.shape[i]&&(r[i]=this.shape[i])}),new Ve({...this._def,shape:()=>r})}omit(e){let r={};return Je.objectKeys(this.shape).map(i=>{Je.objectKeys(e).indexOf(i)===-1&&(r[i]=this.shape[i])}),new Ve({...this._def,shape:()=>r})}deepPartial(){return Mo(this)}partial(e){let r={};if(e)return Je.objectKeys(this.shape).map(i=>{Je.objectKeys(e).indexOf(i)===-1?r[i]=this.shape[i]:r[i]=this.shape[i].optional()}),new Ve({...this._def,shape:()=>r});for(let i in this.shape){let n=this.shape[i];r[i]=n.optional()}return new Ve({...this._def,shape:()=>r})}required(){let e={};for(let r in this.shape){let n=this.shape[r];for(;n instanceof gr;)n=n._def.innerType;e[r]=n}return new Ve({...this._def,shape:()=>e})}};Ve.create=(t,e)=>new Ve({shape:()=>t,unknownKeys:"strip",catchall:ni.create(),typeName:fe.ZodObject,...Ce(e)});Ve.strictCreate=(t,e)=>new Ve({shape:()=>t,unknownKeys:"strict",catchall:ni.create(),typeName:fe.ZodObject,...Ce(e)});Ve.lazycreate=(t,e)=>new Ve({shape:t,unknownKeys:"strip",catchall:ni.create(),typeName:fe.ZodObject,...Ce(e)});var ns=class extends xe{_parse(e){let{ctx:r}=this._processInputParams(e),i=this._def.options;function n(o){for(let h of o)if(h.result.status==="valid")return h.result;for(let h of o)if(h.result.status==="dirty")return r.common.issues.push(...h.ctx.common.issues),h.result;let a=o.map(h=>new Br(h.ctx.common.issues));return le(r,{code:Y.invalid_union,unionErrors:a}),me}if(r.common.async)return Promise.all(i.map(async o=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(n);{let o,a=[];for(let d of i){let m={...r,common:{...r.common,issues:[]},parent:null},p=d._parseSync({data:r.data,path:r.path,parent:m});if(p.status==="valid")return p;p.status==="dirty"&&!o&&(o={result:p,ctx:m}),m.common.issues.length&&a.push(m.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let h=a.map(d=>new Br(d));return le(r,{code:Y.invalid_union,unionErrors:h}),me}}get options(){return this._def.options}};ns.create=(t,e)=>new ns({options:t,typeName:fe.ZodUnion,...Ce(e)});var Po=class extends xe{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ee.object)return le(r,{code:Y.invalid_type,expected:ee.object,received:r.parsedType}),me;let i=this.discriminator,n=r.data[i],o=this.options.get(n);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(le(r,{code:Y.invalid_union_discriminator,options:this.validDiscriminatorValues,path:[i]}),me)}get discriminator(){return this._def.discriminator}get validDiscriminatorValues(){return Array.from(this.options.keys())}get options(){return this._def.options}static create(e,r,i){let n=new Map;try{r.forEach(o=>{let a=o.shape[e].value;n.set(a,o)})}catch{throw new Error("The discriminator value could not be extracted from all the provided schemas")}if(n.size!==r.length)throw new Error("Some of the discriminator values are not unique");return new Po({typeName:fe.ZodDiscriminatedUnion,discriminator:e,options:n,...Ce(i)})}};function hf(t,e){let r=hn(t),i=hn(e);if(t===e)return{valid:!0,data:t};if(r===ee.object&&i===ee.object){let n=Je.objectKeys(e),o=Je.objectKeys(t).filter(h=>n.indexOf(h)!==-1),a={...t,...e};for(let h of o){let d=hf(t[h],e[h]);if(!d.valid)return{valid:!1};a[h]=d.data}return{valid:!0,data:a}}else if(r===ee.array&&i===ee.array){if(t.length!==e.length)return{valid:!1};let n=[];for(let o=0;o<t.length;o++){let a=t[o],h=e[o],d=hf(a,h);if(!d.valid)return{valid:!1};n.push(d.data)}return{valid:!0,data:n}}else return r===ee.date&&i===ee.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var ss=class extends xe{_parse(e){let{status:r,ctx:i}=this._processInputParams(e),n=(o,a)=>{if(af(o)||af(a))return me;let h=hf(o.value,a.value);return h.valid?((lf(o)||lf(a))&&r.dirty(),{status:r.value,value:h.data}):(le(i,{code:Y.invalid_intersection_types}),me)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([o,a])=>n(o,a)):n(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};ss.create=(t,e,r)=>new ss({left:t,right:e,typeName:fe.ZodIntersection,...Ce(r)});var vr=class extends xe{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==ee.array)return le(i,{code:Y.invalid_type,expected:ee.array,received:i.parsedType}),me;if(i.data.length<this._def.items.length)return le(i,{code:Y.too_small,minimum:this._def.items.length,inclusive:!0,type:"array"}),me;!this._def.rest&&i.data.length>this._def.items.length&&(le(i,{code:Y.too_big,maximum:this._def.items.length,inclusive:!0,type:"array"}),r.dirty());let o=i.data.map((a,h)=>{let d=this._def.items[h]||this._def.rest;return d?d._parse(new yr(i,a,i.path,h)):null}).filter(a=>!!a);return i.common.async?Promise.all(o).then(a=>At.mergeArray(r,a)):At.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new vr({...this._def,rest:e})}};vr.create=(t,e)=>new vr({items:t,typeName:fe.ZodTuple,rest:null,...Ce(e)});var os=class extends xe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==ee.object)return le(i,{code:Y.invalid_type,expected:ee.object,received:i.parsedType}),me;let n=[],o=this._def.keyType,a=this._def.valueType;for(let h in i.data)n.push({key:o._parse(new yr(i,h,i.path,h)),value:a._parse(new yr(i,i.data[h],i.path,h))});return i.common.async?At.mergeObjectAsync(r,n):At.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(e,r,i){return r instanceof xe?new os({keyType:e,valueType:r,typeName:fe.ZodRecord,...Ce(i)}):new os({keyType:ii.create(),valueType:e,typeName:fe.ZodRecord,...Ce(r)})}},Oo=class extends xe{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==ee.map)return le(i,{code:Y.invalid_type,expected:ee.map,received:i.parsedType}),me;let n=this._def.keyType,o=this._def.valueType,a=[...i.data.entries()].map(([h,d],m)=>({key:n._parse(new yr(i,h,i.path,[m,"key"])),value:o._parse(new yr(i,d,i.path,[m,"value"]))}));if(i.common.async){let h=new Map;return Promise.resolve().then(async()=>{for(let d of a){let m=await d.key,p=await d.value;if(m.status==="aborted"||p.status==="aborted")return me;(m.status==="dirty"||p.status==="dirty")&&r.dirty(),h.set(m.value,p.value)}return{status:r.value,value:h}})}else{let h=new Map;for(let d of a){let m=d.key,p=d.value;if(m.status==="aborted"||p.status==="aborted")return me;(m.status==="dirty"||p.status==="dirty")&&r.dirty(),h.set(m.value,p.value)}return{status:r.value,value:h}}}};Oo.create=(t,e,r)=>new Oo({valueType:e,keyType:t,typeName:fe.ZodMap,...Ce(r)});var Li=class extends xe{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==ee.set)return le(i,{code:Y.invalid_type,expected:ee.set,received:i.parsedType}),me;let n=this._def;n.minSize!==null&&i.data.size<n.minSize.value&&(le(i,{code:Y.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&i.data.size>n.maxSize.value&&(le(i,{code:Y.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,message:n.maxSize.message}),r.dirty());let o=this._def.valueType;function a(d){let m=new Set;for(let p of d){if(p.status==="aborted")return me;p.status==="dirty"&&r.dirty(),m.add(p.value)}return{status:r.value,value:m}}let h=[...i.data.values()].map((d,m)=>o._parse(new yr(i,d,i.path,m)));return i.common.async?Promise.all(h).then(d=>a(d)):a(h)}min(e,r){return new Li({...this._def,minSize:{value:e,message:$e.toString(r)}})}max(e,r){return new Li({...this._def,maxSize:{value:e,message:$e.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Li.create=(t,e)=>new Li({valueType:t,minSize:null,maxSize:null,typeName:fe.ZodSet,...Ce(e)});var Ni=class extends xe{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ee.function)return le(r,{code:Y.invalid_type,expected:ee.function,received:r.parsedType}),me;function i(h,d){return cu({data:h,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,a1,o1].filter(m=>!!m),issueData:{code:Y.invalid_arguments,argumentsError:d}})}function n(h,d){return cu({data:h,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,a1,o1].filter(m=>!!m),issueData:{code:Y.invalid_return_type,returnTypeError:d}})}let o={errorMap:r.common.contextualErrorMap},a=r.data;return this._def.returns instanceof fn?Lt(async(...h)=>{let d=new Br([]),m=await this._def.args.parseAsync(h,o).catch(R=>{throw d.addIssue(i(h,R)),d}),p=await a(...m);return await this._def.returns._def.type.parseAsync(p,o).catch(R=>{throw d.addIssue(n(p,R)),d})}):Lt((...h)=>{let d=this._def.args.safeParse(h,o);if(!d.success)throw new Br([i(h,d.error)]);let m=a(...d.data),p=this._def.returns.safeParse(m,o);if(!p.success)throw new Br([n(m,p.error)]);return p.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ni({...this._def,args:vr.create(e).rest(ri.create())})}returns(e){return new Ni({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}};Ni.create=(t,e,r)=>new Ni({args:t?t.rest(ri.create()):vr.create([]).rest(ri.create()),returns:e||ri.create(),typeName:fe.ZodFunction,...Ce(r)});var ko=class extends xe{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};ko.create=(t,e)=>new ko({getter:t,typeName:fe.ZodLazy,...Ce(e)});var Lo=class extends xe{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return le(r,{code:Y.invalid_literal,expected:this._def.value}),me}return{status:"valid",value:e.data}}get value(){return this._def.value}};Lo.create=(t,e)=>new Lo({value:t,typeName:fe.ZodLiteral,...Ce(e)});function qy(t,e){return new No({values:t,typeName:fe.ZodEnum,...Ce(e)})}var No=class extends xe{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),i=this._def.values;return le(r,{expected:Je.joinValues(i),received:r.parsedType,code:Y.invalid_type}),me}if(this._def.values.indexOf(e.data)===-1){let r=this._getOrReturnCtx(e),i=this._def.values;return le(r,{received:r.data,code:Y.invalid_enum_value,options:i}),me}return Lt(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}};No.create=qy;var Bo=class extends xe{_parse(e){let r=Je.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==ee.string&&i.parsedType!==ee.number){let n=Je.objectValues(r);return le(i,{expected:Je.joinValues(n),received:i.parsedType,code:Y.invalid_type}),me}if(r.indexOf(e.data)===-1){let n=Je.objectValues(r);return le(i,{received:i.data,code:Y.invalid_enum_value,options:n}),me}return Lt(e.data)}get enum(){return this._def.values}};Bo.create=(t,e)=>new Bo({values:t,typeName:fe.ZodNativeEnum,...Ce(e)});var fn=class extends xe{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ee.promise&&r.common.async===!1)return le(r,{code:Y.invalid_type,expected:ee.promise,received:r.parsedType}),me;let i=r.parsedType===ee.promise?r.data:Promise.resolve(r.data);return Lt(i.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};fn.create=(t,e)=>new fn({type:t,typeName:fe.ZodPromise,...Ce(e)});var wr=class extends xe{innerType(){return this._def.schema}_parse(e){let{status:r,ctx:i}=this._processInputParams(e),n=this._def.effect||null;if(n.type==="preprocess"){let a=n.transform(i.data);return i.common.async?Promise.resolve(a).then(h=>this._def.schema._parseAsync({data:h,path:i.path,parent:i})):this._def.schema._parseSync({data:a,path:i.path,parent:i})}let o={addIssue:a=>{le(i,a),a.fatal?r.abort():r.dirty()},get path(){return i.path}};if(o.addIssue=o.addIssue.bind(o),n.type==="refinement"){let a=h=>{let d=n.refinement(h,o);if(i.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return h};if(i.common.async===!1){let h=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return h.status==="aborted"?me:(h.status==="dirty"&&r.dirty(),a(h.value),{status:r.value,value:h.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(h=>h.status==="aborted"?me:(h.status==="dirty"&&r.dirty(),a(h.value).then(()=>({status:r.value,value:h.value}))))}if(n.type==="transform")if(i.common.async===!1){let a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!fu(a))return a;let h=n.transform(a.value,o);if(h instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:h}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>fu(a)?Promise.resolve(n.transform(a.value,o)).then(h=>({status:r.value,value:h})):a);Je.assertNever(n)}};wr.create=(t,e,r)=>new wr({schema:t,typeName:fe.ZodEffects,effect:e,...Ce(r)});wr.createWithPreprocess=(t,e,r)=>new wr({schema:e,effect:{type:"preprocess",transform:t},typeName:fe.ZodEffects,...Ce(r)});var gr=class extends xe{_parse(e){return this._getType(e)===ee.undefined?Lt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};gr.create=(t,e)=>new gr({innerType:t,typeName:fe.ZodOptional,...Ce(e)});var Bi=class extends xe{_parse(e){return this._getType(e)===ee.null?Lt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Bi.create=(t,e)=>new Bi({innerType:t,typeName:fe.ZodNullable,...Ce(e)});var l1=class extends xe{_parse(e){let{ctx:r}=this._processInputParams(e),i=r.data;return r.parsedType===ee.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};l1.create=(t,e)=>new gr({innerType:t,typeName:fe.ZodOptional,...Ce(e)});var Do=class extends xe{_parse(e){if(this._getType(e)!==ee.nan){let i=this._getOrReturnCtx(e);return le(i,{code:Y.invalid_type,expected:ee.nan,received:i.parsedType}),me}return{status:"valid",value:e.data}}};Do.create=t=>new Do({typeName:fe.ZodNaN,...Ce(t)});var n5=(t,e={},r)=>t?cn.create().superRefine((i,n)=>{if(!t(i)){let o=typeof e=="function"?e(i):e,a=typeof o=="string"?{message:o}:o;n.addIssue({code:"custom",...a,fatal:r})}}):cn.create(),Fy={object:Ve.lazycreate},fe;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodPromise="ZodPromise"})(fe||(fe={}));var Wy=(t,e={message:`Input not instance of ${t.name}`})=>n5(r=>r instanceof t,e,!0),s5=ii.create,o5=ki.create,Hy=Do.create,Gy=Eo.create,a5=Ro.create,Vy=Co.create,Ky=Ao.create,Jy=To.create,Zy=cn.create,Yy=ri.create,Xy=ni.create,Qy=Io.create,e8=br.create,t8=Ve.create,r8=Ve.strictCreate,i8=ns.create,n8=Po.create,s8=ss.create,o8=vr.create,a8=os.create,l8=Oo.create,u8=Li.create,h8=Ni.create,c8=ko.create,f8=Lo.create,d8=No.create,m8=Bo.create,p8=fn.create,i5=wr.create,g8=gr.create,y8=Bi.create,b8=wr.createWithPreprocess,v8=()=>s5().optional(),w8=()=>o5().optional(),_8=()=>a5().optional(),oe=Object.freeze({__proto__:null,getParsedType:hn,ZodParsedType:ee,makeIssue:cu,EMPTY_PATH:By,addIssueToContext:le,ParseStatus:At,INVALID:me,DIRTY:Dy,OK:Lt,isAborted:af,isDirty:lf,isValid:fu,isAsync:uf,ZodType:xe,ZodString:ii,ZodNumber:ki,ZodBigInt:Eo,ZodBoolean:Ro,ZodDate:Co,ZodUndefined:Ao,ZodNull:To,ZodAny:cn,ZodUnknown:ri,ZodNever:ni,ZodVoid:Io,ZodArray:br,get objectUtil(){return du},ZodObject:Ve,ZodUnion:ns,ZodDiscriminatedUnion:Po,ZodIntersection:ss,ZodTuple:vr,ZodRecord:os,ZodMap:Oo,ZodSet:Li,ZodFunction:Ni,ZodLazy:ko,ZodLiteral:Lo,ZodEnum:No,ZodNativeEnum:Bo,ZodPromise:fn,ZodEffects:wr,ZodTransformer:wr,ZodOptional:gr,ZodNullable:Bi,ZodDefault:l1,ZodNaN:Do,custom:n5,Schema:xe,ZodSchema:xe,late:Fy,get ZodFirstPartyTypeKind(){return fe},any:Zy,array:e8,bigint:Gy,boolean:a5,date:Vy,discriminatedUnion:n8,effect:i5,enum:d8,function:h8,instanceof:Wy,intersection:s8,lazy:c8,literal:f8,map:l8,nan:Hy,nativeEnum:m8,never:Xy,null:Jy,nullable:y8,number:o5,object:t8,oboolean:_8,onumber:w8,optional:g8,ostring:v8,preprocess:b8,promise:p8,record:a8,set:u8,strictObject:r8,string:s5,transformer:i5,tuple:o8,undefined:Ky,union:i8,unknown:Yy,void:Qy,ZodIssueCode:Y,quotelessJson:Ly,ZodError:Br,defaultErrorMap:o1,get overrideErrorMap(){return a1},setErrorMap:Ny});var x8=oe.object({title:oe.string(),description:oe.string(),fees:oe.string(),accessConstraints:oe.string()}),S8=oe.object({deliveryPoint:oe.string(),city:oe.string(),postalCode:oe.string(),country:oe.string(),email:oe.string()}),M8=oe.object({individualName:oe.string(),position:oe.string(),phone:oe.string(),address:S8}),E8=oe.object({name:oe.string(),site:oe.string(),contact:M8}),R8=oe.object({id:oe.string(),serviceIdentification:x8,serviceProvider:E8});var C8=oe.object({id:oe.string(),version:oe.number(),name:oe.string(),metadata:oe.unknown().optional(),sprite:oe.string().optional(),glyphs:oe.string().optional(),sources:oe.unknown(),layers:oe.array(oe.unknown())});function A8(t){try{return Vl(t),!0}catch{return!1}}var T8=oe.string().refine(A8,{message:"Invalid hex color"}),zo={minZoom:0,maxZoom:32},mu=oe.number().refine(t=>t>=zo.minZoom&&t<=zo.maxZoom,{message:`must be between ${zo.minZoom} and ${zo.maxZoom}`}),I8=oe.object({name:oe.string(),title:oe.string().optional(),category:oe.string().optional(),2193:oe.string().optional(),3857:oe.string().optional(),minZoom:mu.optional(),maxZoom:mu.optional()}).refine(({minZoom:t,maxZoom:e})=>(t||zo.minZoom)<=(e||zo.maxZoom),{message:"minZoom may no be greater than maxZoom",path:["minZoom"]}),P8=oe.object({type:oe.nativeEnum(vt),id:oe.string(),title:oe.string().optional(),category:oe.string().optional(),description:oe.string().optional(),background:T8.optional(),layers:oe.array(I8),minZoom:mu.optional(),maxZoom:mu.optional(),format:oe.union([oe.nativeEnum(He),oe.nativeEnum(ir)]).optional()});var u1={Aws:{Region:"ap-southeast-2"},ApiKey:{QueryString:"api",TableName:"ApiKey",RequestLimitMinute:1e3},TileMetadata:{TableName:"TileMetadata",RequestLimitMinute:1e3}},Qe={PublicUrlBase:"BASEMAPS_PUBLIC_URL",AssetLocation:"BASEMAPS_ASSEST_LOCATION",TiffConcurrency:"TIFF_CONCURRENCY",TempFolder:"TEMP_FOLDER",BatchIndex:"AWS_BATCH_JOB_ARRAY_INDEX",AwsRoleDurationHours:"AWS_ROLE_DURATION_HOURS",AwsRoleConfigPath:"ROLE_CONFIG_PATH",ImportImageryBucket:"IMPORT_IMAGERY_BUCKET",ImportFilesNumberLimit:"FILES_NUMBER_LIMIT",ImportFilesSizeLimitGb:"FILES_SIZE_LIMIT_GB",Gdal:{UseDocker:"GDAL_DOCKER",DockerContainer:"GDAL_DOCKER_CONTAINER",DockerContainerTag:"GDAL_DOCKER_CONTAINER_TAG"},Analytics:{CloudFrontId:"ANALYTICS_CLOUD_FRONT_ID",CloudFrontSourceBucket:"ANALYTICS_CLOUD_FRONT_SOURCE_BUCKET",CacheBucket:"ANALYTICS_CACHE_BUCKET"},get(t){return process.env[t]},getNumber(t,e){let r=Qe.get(t);if(r===""||r==null)return e;let i=parseFloat(r);return isNaN(i)?e:i},isProduction(){return!0}};var L0=de(t0(),1);var zr=de(dm(),1);function Fv(t){return t<=10?zr.default.gray("TRACE"):t<=20?zr.default.magenta("DEBUG"):t<=30?zr.default.cyan("INFO"):t<=40?zr.default.yellow("WARN"):t<=50?zr.default.red("ERROR"):zr.default.bgRed("FATAL")}var Di=class{constructor(e){this.level=e}static formatObject(e){let r=[];for(let i of Object.keys(e)){if(Di.Ignore.has(i))continue;let n=e[i];if(n==null||n==="")continue;let o="",a=typeof n;if(a==="number")o=zr.default.yellow(String(n));else if(a==="string")o=zr.default.green(n);else if(a==="object"){let h=this.formatObject(n);h.length>0&&(o=`{ ${h.join(" ")} }`)}else o=String(n);o!==""&&r.push(`${zr.default.dim(i)}=${o}`)}return r}pretty(e){if(e.level<this.level)return null;let r=new Date(e.time);if(isNaN(r.getTime()))return null;let n=Di.formatObject(e).join(" ");return`[${r.toISOString()}] ${Fv(e.level)} ${zr.default.blue(e.msg)} ${n}`}};Di.Ignore=new Set(["pid","time","hostname","level","v","name","msg"]);var _p=de(wp(),1),Go=require("stream"),xp=require("string_decoder");function Z_(t){try{return JSON.parse(t)}catch{return null}}function Y_(t){t!=null&&console.error("PrettyTransformFailed",t)}var _n=class extends Go.Transform{constructor(){super(),this.pretty=new Di(-1),this.decoder=new xp.StringDecoder}static stream(e=process.stdout){let r=new Go.PassThrough;return _n.pretty(r,e),r}static pretty(e,r=process.stdout){let i=new _n;return(0,Go.pipeline)(e,(0,_p.default)(),i,r,Y_),i}_transform(e,r,i){if(r!=="buffer")return i(new Error(`Unknown encoding: ${r}`));let n=this.decoder.write(e),o=Z_(n);if(o==null)return i(null,e+`
136
136
  `);let a=this.pretty.pretty(o);if(a==null)return i(null,e+`
137
137
  `);i(null,a+`
138
- `)}};var Wu,xp={level:"debug"},Hu={get(){return Wu==null&&(Wu=process.stdout.isTTY?(0,L0.default)(xp,_n.stream()):(0,L0.default)(xp)),Wu},set(t){Wu=t},disable(){Hu.get().level="silent"}};var Sp=de(Yn(),1);var J_=24*60*60*1e3,UA=30*J_;var Mp=new Uint16Array([7489,60,213,305,650,1181,1403,1488,1653,1758,1954,2006,2063,2634,2705,3489,3693,3849,3878,4298,4648,4833,5141,5277,5315,5343,5413,0,0,0,0,0,0,5483,5837,6541,7186,7645,8062,8288,8624,8845,9152,9211,9282,10276,10514,11528,11848,12238,12310,12986,13881,14252,14590,14888,14961,15072,15150,2048,69,77,97,98,99,102,103,108,109,110,111,112,114,115,116,117,92,98,102,109,115,127,132,139,144,149,152,166,179,185,200,207,108,105,103,32827,198,16582,80,32827,38,16422,99,117,116,101,32827,193,16577,114,101,118,101,59,16642,256,105,121,120,125,114,99,32827,194,16578,59,17424,114,59,49152,55349,56580,114,97,118,101,32827,192,16576,112,104,97,59,17297,97,99,114,59,16640,100,59,27219,256,103,112,157,161,111,110,59,16644,102,59,49152,55349,56632,112,108,121,70,117,110,99,116,105,111,110,59,24673,105,110,103,32827,197,16581,256,99,115,190,195,114,59,49152,55349,56476,105,103,110,59,25172,105,108,100,101,32827,195,16579,109,108,32827,196,16580,1024,97,99,101,102,111,114,115,117,229,251,254,279,284,290,295,298,256,99,114,234,242,107,115,108,97,115,104,59,25110,374,246,248,59,27367,101,100,59,25350,121,59,17425,384,99,114,116,261,267,276,97,117,115,101,59,25141,110,111,117,108,108,105,115,59,24876,97,59,17298,114,59,49152,55349,56581,112,102,59,49152,55349,56633,101,118,101,59,17112,99,242,275,109,112,101,113,59,25166,1792,72,79,97,99,100,101,102,104,105,108,111,114,115,117,333,337,342,384,414,418,437,439,442,476,533,627,632,638,99,121,59,17447,80,89,32827,169,16553,384,99,112,121,349,354,378,117,116,101,59,16646,256,59,105,359,360,25298,116,97,108,68,105,102,102,101,114,101,110,116,105,97,108,68,59,24901,108,101,121,115,59,24877,512,97,101,105,111,393,398,404,408,114,111,110,59,16652,100,105,108,32827,199,16583,114,99,59,16648,110,105,110,116,59,25136,111,116,59,16650,256,100,110,423,429,105,108,108,97,59,16568,116,101,114,68,111,116,59,16567,242,383,105,59,17319,114,99,108,101,512,68,77,80,84,455,459,465,470,111,116,59,25241,105,110,117,115,59,25238,108,117,115,59,25237,105,109,101,115,59,25239,111,256,99,115,482,504,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,25138,101,67,117,114,108,121,256,68,81,515,527,111,117,98,108,101,81,117,111,116,101,59,24605,117,111,116,101,59,24601,512,108,110,112,117,542,552,583,597,111,110,256,59,101,549,550,25143,59,27252,384,103,105,116,559,566,570,114,117,101,110,116,59,25185,110,116,59,25135,111,117,114,73,110,116,101,103,114,97,108,59,25134,256,102,114,588,590,59,24834,111,100,117,99,116,59,25104,110,116,101,114,67,108,111,99,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,25139,111,115,115,59,27183,99,114,59,49152,55349,56478,112,256,59,67,644,645,25299,97,112,59,25165,1408,68,74,83,90,97,99,101,102,105,111,115,672,684,688,692,696,715,727,737,742,819,1165,256,59,111,377,677,116,114,97,104,100,59,26897,99,121,59,17410,99,121,59,17413,99,121,59,17423,384,103,114,115,703,708,711,103,101,114,59,24609,114,59,24993,104,118,59,27364,256,97,121,720,725,114,111,110,59,16654,59,17428,108,256,59,116,733,734,25095,97,59,17300,114,59,49152,55349,56583,256,97,102,747,807,256,99,109,752,802,114,105,116,105,99,97,108,512,65,68,71,84,768,774,790,796,99,117,116,101,59,16564,111,372,779,781,59,17113,98,108,101,65,99,117,116,101,59,17117,114,97,118,101,59,16480,105,108,100,101,59,17116,111,110,100,59,25284,102,101,114,101,110,116,105,97,108,68,59,24902,1136,829,0,0,0,834,852,0,1029,102,59,49152,55349,56635,384,59,68,69,840,841,845,16552,111,116,59,24796,113,117,97,108,59,25168,98,108,101,768,67,68,76,82,85,86,867,882,898,975,994,1016,111,110,116,111,117,114,73,110,116,101,103,114,97,236,569,111,628,889,0,0,891,187,841,110,65,114,114,111,119,59,25043,256,101,111,903,932,102,116,384,65,82,84,912,918,929,114,114,111,119,59,25040,105,103,104,116,65,114,114,111,119,59,25044,101,229,714,110,103,256,76,82,939,964,101,102,116,256,65,82,947,953,114,114,111,119,59,26616,105,103,104,116,65,114,114,111,119,59,26618,105,103,104,116,65,114,114,111,119,59,26617,105,103,104,116,256,65,84,984,990,114,114,111,119,59,25042,101,101,59,25256,112,577,1001,0,0,1007,114,114,111,119,59,25041,111,119,110,65,114,114,111,119,59,25045,101,114,116,105,99,97,108,66,97,114,59,25125,110,768,65,66,76,82,84,97,1042,1066,1072,1118,1151,892,114,114,111,119,384,59,66,85,1053,1054,1058,24979,97,114,59,26899,112,65,114,114,111,119,59,25077,114,101,118,101,59,17169,101,102,116,722,1082,0,1094,0,1104,105,103,104,116,86,101,99,116,111,114,59,26960,101,101,86,101,99,116,111,114,59,26974,101,99,116,111,114,256,59,66,1113,1114,25021,97,114,59,26966,105,103,104,116,468,1127,0,1137,101,101,86,101,99,116,111,114,59,26975,101,99,116,111,114,256,59,66,1146,1147,25025,97,114,59,26967,101,101,256,59,65,1158,1159,25252,114,114,111,119,59,24999,256,99,116,1170,1175,114,59,49152,55349,56479,114,111,107,59,16656,2048,78,84,97,99,100,102,103,108,109,111,112,113,115,116,117,120,1213,1216,1220,1227,1246,1250,1255,1262,1269,1313,1327,1334,1362,1373,1376,1381,71,59,16714,72,32827,208,16592,99,117,116,101,32827,201,16585,384,97,105,121,1234,1239,1244,114,111,110,59,16666,114,99,32827,202,16586,59,17453,111,116,59,16662,114,59,49152,55349,56584,114,97,118,101,32827,200,16584,101,109,101,110,116,59,25096,256,97,112,1274,1278,99,114,59,16658,116,121,595,1286,0,0,1298,109,97,108,108,83,113,117,97,114,101,59,26107,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,26027,256,103,112,1318,1322,111,110,59,16664,102,59,49152,55349,56636,115,105,108,111,110,59,17301,117,256,97,105,1340,1353,108,256,59,84,1346,1347,27253,105,108,100,101,59,25154,108,105,98,114,105,117,109,59,25036,256,99,105,1367,1370,114,59,24880,109,59,27251,97,59,17303,109,108,32827,203,16587,256,105,112,1386,1391,115,116,115,59,25091,111,110,101,110,116,105,97,108,69,59,24903,640,99,102,105,111,115,1413,1416,1421,1458,1484,121,59,17444,114,59,49152,55349,56585,108,108,101,100,595,1431,0,0,1443,109,97,108,108,83,113,117,97,114,101,59,26108,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,26026,880,1466,0,1471,0,0,1476,102,59,49152,55349,56637,65,108,108,59,25088,114,105,101,114,116,114,102,59,24881,99,242,1483,1536,74,84,97,98,99,100,102,103,111,114,115,116,1512,1516,1519,1530,1536,1554,1558,1563,1565,1571,1644,1650,99,121,59,17411,32827,62,16446,109,109,97,256,59,100,1527,1528,17299,59,17372,114,101,118,101,59,16670,384,101,105,121,1543,1548,1552,100,105,108,59,16674,114,99,59,16668,59,17427,111,116,59,16672,114,59,49152,55349,56586,59,25305,112,102,59,49152,55349,56638,101,97,116,101,114,768,69,70,71,76,83,84,1589,1604,1614,1622,1627,1638,113,117,97,108,256,59,76,1598,1599,25189,101,115,115,59,25307,117,108,108,69,113,117,97,108,59,25191,114,101,97,116,101,114,59,27298,101,115,115,59,25207,108,97,110,116,69,113,117,97,108,59,27262,105,108,100,101,59,25203,99,114,59,49152,55349,56482,59,25195,1024,65,97,99,102,105,111,115,117,1669,1675,1686,1691,1694,1706,1726,1738,82,68,99,121,59,17450,256,99,116,1680,1684,101,107,59,17095,59,16478,105,114,99,59,16676,114,59,24844,108,98,101,114,116,83,112,97,99,101,59,24843,496,1711,0,1714,102,59,24845,105,122,111,110,116,97,108,76,105,110,101,59,25856,256,99,116,1731,1733,242,1705,114,111,107,59,16678,109,112,324,1744,1752,111,119,110,72,117,109,240,303,113,117,97,108,59,25167,1792,69,74,79,97,99,100,102,103,109,110,111,115,116,117,1786,1790,1795,1799,1806,1818,1822,1825,1832,1860,1912,1931,1935,1941,99,121,59,17429,108,105,103,59,16690,99,121,59,17409,99,117,116,101,32827,205,16589,256,105,121,1811,1816,114,99,32827,206,16590,59,17432,111,116,59,16688,114,59,24849,114,97,118,101,32827,204,16588,384,59,97,112,1824,1839,1855,256,99,103,1844,1847,114,59,16682,105,110,97,114,121,73,59,24904,108,105,101,243,989,500,1865,0,1890,256,59,101,1869,1870,25132,256,103,114,1875,1880,114,97,108,59,25131,115,101,99,116,105,111,110,59,25282,105,115,105,98,108,101,256,67,84,1900,1906,111,109,109,97,59,24675,105,109,101,115,59,24674,384,103,112,116,1919,1923,1928,111,110,59,16686,102,59,49152,55349,56640,97,59,17305,99,114,59,24848,105,108,100,101,59,16680,491,1946,0,1950,99,121,59,17414,108,32827,207,16591,640,99,102,111,115,117,1964,1975,1980,1986,2e3,256,105,121,1969,1973,114,99,59,16692,59,17433,114,59,49152,55349,56589,112,102,59,49152,55349,56641,483,1991,0,1996,114,59,49152,55349,56485,114,99,121,59,17416,107,99,121,59,17412,896,72,74,97,99,102,111,115,2020,2024,2028,2033,2045,2050,2056,99,121,59,17445,99,121,59,17420,112,112,97,59,17306,256,101,121,2038,2043,100,105,108,59,16694,59,17434,114,59,49152,55349,56590,112,102,59,49152,55349,56642,99,114,59,49152,55349,56486,1408,74,84,97,99,101,102,108,109,111,115,116,2085,2089,2092,2128,2147,2483,2488,2503,2509,2615,2631,99,121,59,17417,32827,60,16444,640,99,109,110,112,114,2103,2108,2113,2116,2125,117,116,101,59,16697,98,100,97,59,17307,103,59,26602,108,97,99,101,116,114,102,59,24850,114,59,24990,384,97,101,121,2135,2140,2145,114,111,110,59,16701,100,105,108,59,16699,59,17435,256,102,115,2152,2416,116,1280,65,67,68,70,82,84,85,86,97,114,2174,2217,2225,2272,2278,2300,2351,2395,912,2410,256,110,114,2179,2191,103,108,101,66,114,97,99,107,101,116,59,26600,114,111,119,384,59,66,82,2201,2202,2206,24976,97,114,59,25060,105,103,104,116,65,114,114,111,119,59,25030,101,105,108,105,110,103,59,25352,111,501,2231,0,2243,98,108,101,66,114,97,99,107,101,116,59,26598,110,468,2248,0,2258,101,101,86,101,99,116,111,114,59,26977,101,99,116,111,114,256,59,66,2267,2268,25027,97,114,59,26969,108,111,111,114,59,25354,105,103,104,116,256,65,86,2287,2293,114,114,111,119,59,24980,101,99,116,111,114,59,26958,256,101,114,2305,2327,101,384,59,65,86,2313,2314,2320,25251,114,114,111,119,59,24996,101,99,116,111,114,59,26970,105,97,110,103,108,101,384,59,66,69,2340,2341,2345,25266,97,114,59,27087,113,117,97,108,59,25268,112,384,68,84,86,2359,2370,2380,111,119,110,86,101,99,116,111,114,59,26961,101,101,86,101,99,116,111,114,59,26976,101,99,116,111,114,256,59,66,2390,2391,25023,97,114,59,26968,101,99,116,111,114,256,59,66,2405,2406,25020,97,114,59,26962,105,103,104,116,225,924,115,768,69,70,71,76,83,84,2430,2443,2453,2461,2466,2477,113,117,97,108,71,114,101,97,116,101,114,59,25306,117,108,108,69,113,117,97,108,59,25190,114,101,97,116,101,114,59,25206,101,115,115,59,27297,108,97,110,116,69,113,117,97,108,59,27261,105,108,100,101,59,25202,114,59,49152,55349,56591,256,59,101,2493,2494,25304,102,116,97,114,114,111,119,59,25050,105,100,111,116,59,16703,384,110,112,119,2516,2582,2587,103,512,76,82,108,114,2526,2551,2562,2576,101,102,116,256,65,82,2534,2540,114,114,111,119,59,26613,105,103,104,116,65,114,114,111,119,59,26615,105,103,104,116,65,114,114,111,119,59,26614,101,102,116,256,97,114,947,2570,105,103,104,116,225,959,105,103,104,116,225,970,102,59,49152,55349,56643,101,114,256,76,82,2594,2604,101,102,116,65,114,114,111,119,59,24985,105,103,104,116,65,114,114,111,119,59,24984,384,99,104,116,2622,2624,2626,242,2124,59,25008,114,111,107,59,16705,59,25194,1024,97,99,101,102,105,111,115,117,2650,2653,2656,2679,2684,2693,2699,2702,112,59,26885,121,59,17436,256,100,108,2661,2671,105,117,109,83,112,97,99,101,59,24671,108,105,110,116,114,102,59,24883,114,59,49152,55349,56592,110,117,115,80,108,117,115,59,25107,112,102,59,49152,55349,56644,99,242,2678,59,17308,1152,74,97,99,101,102,111,115,116,117,2723,2727,2733,2752,2836,2841,3473,3479,3486,99,121,59,17418,99,117,116,101,59,16707,384,97,101,121,2740,2745,2750,114,111,110,59,16711,100,105,108,59,16709,59,17437,384,103,115,119,2759,2800,2830,97,116,105,118,101,384,77,84,86,2771,2783,2792,101,100,105,117,109,83,112,97,99,101,59,24587,104,105,256,99,110,2790,2776,235,2777,101,114,121,84,104,105,238,2777,116,101,100,256,71,76,2808,2822,114,101,97,116,101,114,71,114,101,97,116,101,242,1651,101,115,115,76,101,115,243,2632,76,105,110,101,59,16394,114,59,49152,55349,56593,512,66,110,112,116,2850,2856,2871,2874,114,101,97,107,59,24672,66,114,101,97,107,105,110,103,83,112,97,99,101,59,16544,102,59,24853,1664,59,67,68,69,71,72,76,78,80,82,83,84,86,2901,2902,2922,2940,2977,3051,3076,3166,3204,3238,3288,3425,3461,27372,256,111,117,2907,2916,110,103,114,117,101,110,116,59,25186,112,67,97,112,59,25197,111,117,98,108,101,86,101,114,116,105,99,97,108,66,97,114,59,25126,384,108,113,120,2947,2954,2971,101,109,101,110,116,59,25097,117,97,108,256,59,84,2962,2963,25184,105,108,100,101,59,49152,8770,824,105,115,116,115,59,25092,114,101,97,116,101,114,896,59,69,70,71,76,83,84,2998,2999,3005,3017,3027,3032,3045,25199,113,117,97,108,59,25201,117,108,108,69,113,117,97,108,59,49152,8807,824,114,101,97,116,101,114,59,49152,8811,824,101,115,115,59,25209,108,97,110,116,69,113,117,97,108,59,49152,10878,824,105,108,100,101,59,25205,117,109,112,324,3058,3069,111,119,110,72,117,109,112,59,49152,8782,824,113,117,97,108,59,49152,8783,824,101,256,102,115,3082,3111,116,84,114,105,97,110,103,108,101,384,59,66,69,3098,3099,3105,25322,97,114,59,49152,10703,824,113,117,97,108,59,25324,115,768,59,69,71,76,83,84,3125,3126,3132,3140,3147,3160,25198,113,117,97,108,59,25200,114,101,97,116,101,114,59,25208,101,115,115,59,49152,8810,824,108,97,110,116,69,113,117,97,108,59,49152,10877,824,105,108,100,101,59,25204,101,115,116,101,100,256,71,76,3176,3193,114,101,97,116,101,114,71,114,101,97,116,101,114,59,49152,10914,824,101,115,115,76,101,115,115,59,49152,10913,824,114,101,99,101,100,101,115,384,59,69,83,3218,3219,3227,25216,113,117,97,108,59,49152,10927,824,108,97,110,116,69,113,117,97,108,59,25312,256,101,105,3243,3257,118,101,114,115,101,69,108,101,109,101,110,116,59,25100,103,104,116,84,114,105,97,110,103,108,101,384,59,66,69,3275,3276,3282,25323,97,114,59,49152,10704,824,113,117,97,108,59,25325,256,113,117,3293,3340,117,97,114,101,83,117,256,98,112,3304,3321,115,101,116,256,59,69,3312,3315,49152,8847,824,113,117,97,108,59,25314,101,114,115,101,116,256,59,69,3331,3334,49152,8848,824,113,117,97,108,59,25315,384,98,99,112,3347,3364,3406,115,101,116,256,59,69,3355,3358,49152,8834,8402,113,117,97,108,59,25224,99,101,101,100,115,512,59,69,83,84,3378,3379,3387,3398,25217,113,117,97,108,59,49152,10928,824,108,97,110,116,69,113,117,97,108,59,25313,105,108,100,101,59,49152,8831,824,101,114,115,101,116,256,59,69,3416,3419,49152,8835,8402,113,117,97,108,59,25225,105,108,100,101,512,59,69,70,84,3438,3439,3445,3455,25153,113,117,97,108,59,25156,117,108,108,69,113,117,97,108,59,25159,105,108,100,101,59,25161,101,114,116,105,99,97,108,66,97,114,59,25124,99,114,59,49152,55349,56489,105,108,100,101,32827,209,16593,59,17309,1792,69,97,99,100,102,103,109,111,112,114,115,116,117,118,3517,3522,3529,3541,3547,3552,3559,3580,3586,3616,3618,3634,3647,3652,108,105,103,59,16722,99,117,116,101,32827,211,16595,256,105,121,3534,3539,114,99,32827,212,16596,59,17438,98,108,97,99,59,16720,114,59,49152,55349,56594,114,97,118,101,32827,210,16594,384,97,101,105,3566,3570,3574,99,114,59,16716,103,97,59,17321,99,114,111,110,59,17311,112,102,59,49152,55349,56646,101,110,67,117,114,108,121,256,68,81,3598,3610,111,117,98,108,101,81,117,111,116,101,59,24604,117,111,116,101,59,24600,59,27220,256,99,108,3623,3628,114,59,49152,55349,56490,97,115,104,32827,216,16600,105,364,3639,3644,100,101,32827,213,16597,101,115,59,27191,109,108,32827,214,16598,101,114,256,66,80,3659,3680,256,97,114,3664,3667,114,59,24638,97,99,256,101,107,3674,3676,59,25566,101,116,59,25524,97,114,101,110,116,104,101,115,105,115,59,25564,1152,97,99,102,104,105,108,111,114,115,3711,3719,3722,3727,3730,3732,3741,3760,3836,114,116,105,97,108,68,59,25090,121,59,17439,114,59,49152,55349,56595,105,59,17318,59,17312,117,115,77,105,110,117,115,59,16561,256,105,112,3746,3757,110,99,97,114,101,112,108,97,110,229,1693,102,59,24857,512,59,101,105,111,3769,3770,3808,3812,27323,99,101,100,101,115,512,59,69,83,84,3784,3785,3791,3802,25210,113,117,97,108,59,27311,108,97,110,116,69,113,117,97,108,59,25212,105,108,100,101,59,25214,109,101,59,24627,256,100,112,3817,3822,117,99,116,59,25103,111,114,116,105,111,110,256,59,97,549,3833,108,59,25117,256,99,105,3841,3846,114,59,49152,55349,56491,59,17320,512,85,102,111,115,3857,3862,3867,3871,79,84,32827,34,16418,114,59,49152,55349,56596,112,102,59,24858,99,114,59,49152,55349,56492,1536,66,69,97,99,101,102,104,105,111,114,115,117,3902,3907,3911,3936,3955,4007,4010,4013,4246,4265,4276,4286,97,114,114,59,26896,71,32827,174,16558,384,99,110,114,3918,3923,3926,117,116,101,59,16724,103,59,26603,114,256,59,116,3932,3933,24992,108,59,26902,384,97,101,121,3943,3948,3953,114,111,110,59,16728,100,105,108,59,16726,59,17440,256,59,118,3960,3961,24860,101,114,115,101,256,69,85,3970,3993,256,108,113,3975,3982,101,109,101,110,116,59,25099,117,105,108,105,98,114,105,117,109,59,25035,112,69,113,117,105,108,105,98,114,105,117,109,59,26991,114,187,3961,111,59,17313,103,104,116,1024,65,67,68,70,84,85,86,97,4033,4075,4083,4130,4136,4187,4231,984,256,110,114,4038,4050,103,108,101,66,114,97,99,107,101,116,59,26601,114,111,119,384,59,66,76,4060,4061,4065,24978,97,114,59,25061,101,102,116,65,114,114,111,119,59,25028,101,105,108,105,110,103,59,25353,111,501,4089,0,4101,98,108,101,66,114,97,99,107,101,116,59,26599,110,468,4106,0,4116,101,101,86,101,99,116,111,114,59,26973,101,99,116,111,114,256,59,66,4125,4126,25026,97,114,59,26965,108,111,111,114,59,25355,256,101,114,4141,4163,101,384,59,65,86,4149,4150,4156,25250,114,114,111,119,59,24998,101,99,116,111,114,59,26971,105,97,110,103,108,101,384,59,66,69,4176,4177,4181,25267,97,114,59,27088,113,117,97,108,59,25269,112,384,68,84,86,4195,4206,4216,111,119,110,86,101,99,116,111,114,59,26959,101,101,86,101,99,116,111,114,59,26972,101,99,116,111,114,256,59,66,4226,4227,25022,97,114,59,26964,101,99,116,111,114,256,59,66,4241,4242,25024,97,114,59,26963,256,112,117,4251,4254,102,59,24861,110,100,73,109,112,108,105,101,115,59,26992,105,103,104,116,97,114,114,111,119,59,25051,256,99,104,4281,4284,114,59,24859,59,25009,108,101,68,101,108,97,121,101,100,59,27124,1664,72,79,97,99,102,104,105,109,111,113,115,116,117,4324,4337,4343,4349,4377,4382,4433,4438,4449,4455,4533,4539,4543,256,67,99,4329,4334,72,99,121,59,17449,121,59,17448,70,84,99,121,59,17452,99,117,116,101,59,16730,640,59,97,101,105,121,4360,4361,4366,4371,4375,27324,114,111,110,59,16736,100,105,108,59,16734,114,99,59,16732,59,17441,114,59,49152,55349,56598,111,114,116,512,68,76,82,85,4394,4404,4414,4425,111,119,110,65,114,114,111,119,187,1054,101,102,116,65,114,114,111,119,187,2202,105,103,104,116,65,114,114,111,119,187,4061,112,65,114,114,111,119,59,24977,103,109,97,59,17315,97,108,108,67,105,114,99,108,101,59,25112,112,102,59,49152,55349,56650,626,4461,0,0,4464,116,59,25114,97,114,101,512,59,73,83,85,4475,4476,4489,4527,26017,110,116,101,114,115,101,99,116,105,111,110,59,25235,117,256,98,112,4495,4510,115,101,116,256,59,69,4503,4504,25231,113,117,97,108,59,25233,101,114,115,101,116,256,59,69,4520,4521,25232,113,117,97,108,59,25234,110,105,111,110,59,25236,99,114,59,49152,55349,56494,97,114,59,25286,512,98,99,109,112,4552,4571,4617,4619,256,59,115,4557,4558,25296,101,116,256,59,69,4557,4565,113,117,97,108,59,25222,256,99,104,4576,4613,101,101,100,115,512,59,69,83,84,4589,4590,4596,4607,25211,113,117,97,108,59,27312,108,97,110,116,69,113,117,97,108,59,25213,105,108,100,101,59,25215,84,104,225,3980,59,25105,384,59,101,115,4626,4627,4643,25297,114,115,101,116,256,59,69,4636,4637,25219,113,117,97,108,59,25223,101,116,187,4627,1408,72,82,83,97,99,102,104,105,111,114,115,4670,4676,4681,4693,4702,4721,4726,4767,4802,4808,4817,79,82,78,32827,222,16606,65,68,69,59,24866,256,72,99,4686,4690,99,121,59,17419,121,59,17446,256,98,117,4698,4700,59,16393,59,17316,384,97,101,121,4709,4714,4719,114,111,110,59,16740,100,105,108,59,16738,59,17442,114,59,49152,55349,56599,256,101,105,4731,4745,498,4736,0,4743,101,102,111,114,101,59,25140,97,59,17304,256,99,110,4750,4760,107,83,112,97,99,101,59,49152,8287,8202,83,112,97,99,101,59,24585,108,100,101,512,59,69,70,84,4779,4780,4786,4796,25148,113,117,97,108,59,25155,117,108,108,69,113,117,97,108,59,25157,105,108,100,101,59,25160,112,102,59,49152,55349,56651,105,112,108,101,68,111,116,59,24795,256,99,116,4822,4827,114,59,49152,55349,56495,114,111,107,59,16742,2785,4855,4878,4890,4902,0,4908,4913,0,0,0,0,0,4920,4925,4983,4997,0,5119,5124,5130,5136,256,99,114,4859,4865,117,116,101,32827,218,16602,114,256,59,111,4871,4872,24991,99,105,114,59,26953,114,483,4883,0,4886,121,59,17422,118,101,59,16748,256,105,121,4894,4899,114,99,32827,219,16603,59,17443,98,108,97,99,59,16752,114,59,49152,55349,56600,114,97,118,101,32827,217,16601,97,99,114,59,16746,256,100,105,4929,4969,101,114,256,66,80,4936,4957,256,97,114,4941,4944,114,59,16479,97,99,256,101,107,4951,4953,59,25567,101,116,59,25525,97,114,101,110,116,104,101,115,105,115,59,25565,111,110,256,59,80,4976,4977,25283,108,117,115,59,25230,256,103,112,4987,4991,111,110,59,16754,102,59,49152,55349,56652,1024,65,68,69,84,97,100,112,115,5013,5038,5048,5060,1e3,5074,5079,5107,114,114,111,119,384,59,66,68,4432,5024,5028,97,114,59,26898,111,119,110,65,114,114,111,119,59,25029,111,119,110,65,114,114,111,119,59,24981,113,117,105,108,105,98,114,105,117,109,59,26990,101,101,256,59,65,5067,5068,25253,114,114,111,119,59,24997,111,119,110,225,1011,101,114,256,76,82,5086,5096,101,102,116,65,114,114,111,119,59,24982,105,103,104,116,65,114,114,111,119,59,24983,105,256,59,108,5113,5114,17362,111,110,59,17317,105,110,103,59,16750,99,114,59,49152,55349,56496,105,108,100,101,59,16744,109,108,32827,220,16604,1152,68,98,99,100,101,102,111,115,118,5159,5164,5168,5171,5182,5253,5258,5264,5270,97,115,104,59,25259,97,114,59,27371,121,59,17426,97,115,104,256,59,108,5179,5180,25257,59,27366,256,101,114,5187,5189,59,25281,384,98,116,121,5196,5200,5242,97,114,59,24598,256,59,105,5199,5205,99,97,108,512,66,76,83,84,5217,5221,5226,5236,97,114,59,25123,105,110,101,59,16508,101,112,97,114,97,116,111,114,59,26456,105,108,100,101,59,25152,84,104,105,110,83,112,97,99,101,59,24586,114,59,49152,55349,56601,112,102,59,49152,55349,56653,99,114,59,49152,55349,56497,100,97,115,104,59,25258,640,99,101,102,111,115,5287,5292,5297,5302,5308,105,114,99,59,16756,100,103,101,59,25280,114,59,49152,55349,56602,112,102,59,49152,55349,56654,99,114,59,49152,55349,56498,512,102,105,111,115,5323,5328,5330,5336,114,59,49152,55349,56603,59,17310,112,102,59,49152,55349,56655,99,114,59,49152,55349,56499,1152,65,73,85,97,99,102,111,115,117,5361,5365,5369,5373,5380,5391,5396,5402,5408,99,121,59,17455,99,121,59,17415,99,121,59,17454,99,117,116,101,32827,221,16605,256,105,121,5385,5389,114,99,59,16758,59,17451,114,59,49152,55349,56604,112,102,59,49152,55349,56656,99,114,59,49152,55349,56500,109,108,59,16760,1024,72,97,99,100,101,102,111,115,5429,5433,5439,5451,5455,5469,5472,5476,99,121,59,17430,99,117,116,101,59,16761,256,97,121,5444,5449,114,111,110,59,16765,59,17431,111,116,59,16763,498,5460,0,5467,111,87,105,100,116,232,2777,97,59,17302,114,59,24872,112,102,59,24868,99,114,59,49152,55349,56501,3041,5507,5514,5520,0,5552,5558,5567,0,0,0,0,5574,5595,5611,5727,5741,0,5781,5787,5810,5817,0,5822,99,117,116,101,32827,225,16609,114,101,118,101,59,16643,768,59,69,100,105,117,121,5532,5533,5537,5539,5544,5549,25150,59,49152,8766,819,59,25151,114,99,32827,226,16610,116,101,32955,180,774,59,17456,108,105,103,32827,230,16614,256,59,114,178,5562,59,49152,55349,56606,114,97,118,101,32827,224,16608,256,101,112,5578,5590,256,102,112,5583,5588,115,121,109,59,24885,232,5587,104,97,59,17329,256,97,112,5599,99,256,99,108,5604,5607,114,59,16641,103,59,27199,612,5616,0,0,5642,640,59,97,100,115,118,5626,5627,5631,5633,5639,25127,110,100,59,27221,59,27228,108,111,112,101,59,27224,59,27226,896,59,101,108,109,114,115,122,5656,5657,5659,5662,5695,5711,5721,25120,59,27044,101,187,5657,115,100,256,59,97,5669,5670,25121,1121,5680,5682,5684,5686,5688,5690,5692,5694,59,27048,59,27049,59,27050,59,27051,59,27052,59,27053,59,27054,59,27055,116,256,59,118,5701,5702,25119,98,256,59,100,5708,5709,25278,59,27037,256,112,116,5716,5719,104,59,25122,187,185,97,114,114,59,25468,256,103,112,5731,5735,111,110,59,16645,102,59,49152,55349,56658,896,59,69,97,101,105,111,112,4801,5755,5757,5762,5764,5767,5770,59,27248,99,105,114,59,27247,59,25162,100,59,25163,115,59,16423,114,111,120,256,59,101,4801,5778,241,5763,105,110,103,32827,229,16613,384,99,116,121,5793,5798,5800,114,59,49152,55349,56502,59,16426,109,112,256,59,101,4801,5807,241,648,105,108,100,101,32827,227,16611,109,108,32827,228,16612,256,99,105,5826,5832,111,110,105,110,244,626,110,116,59,27153,2048,78,97,98,99,100,101,102,105,107,108,110,111,112,114,115,117,5869,5873,5936,5948,5955,5960,6008,6013,6112,6118,6201,6224,5901,6461,6472,6512,111,116,59,27373,256,99,114,5878,5918,107,512,99,101,112,115,5888,5893,5901,5907,111,110,103,59,25164,112,115,105,108,111,110,59,17398,114,105,109,101,59,24629,105,109,256,59,101,5914,5915,25149,113,59,25293,374,5922,5926,101,101,59,25277,101,100,256,59,103,5932,5933,25349,101,187,5933,114,107,256,59,116,4956,5943,98,114,107,59,25526,256,111,121,5889,5953,59,17457,113,117,111,59,24606,640,99,109,112,114,116,5971,5979,5985,5988,5992,97,117,115,256,59,101,266,265,112,116,121,118,59,27056,115,233,5900,110,111,245,275,384,97,104,119,5999,6001,6003,59,17330,59,24886,101,101,110,59,25196,114,59,49152,55349,56607,103,896,99,111,115,116,117,118,119,6029,6045,6067,6081,6101,6107,6110,384,97,105,117,6036,6038,6042,240,1888,114,99,59,26095,112,187,4977,384,100,112,116,6052,6056,6061,111,116,59,27136,108,117,115,59,27137,105,109,101,115,59,27138,625,6073,0,0,6078,99,117,112,59,27142,97,114,59,26117,114,105,97,110,103,108,101,256,100,117,6093,6098,111,119,110,59,26045,112,59,26035,112,108,117,115,59,27140,101,229,5188,229,5293,97,114,111,119,59,26893,384,97,107,111,6125,6182,6197,256,99,110,6130,6179,107,384,108,115,116,6138,1451,6146,111,122,101,110,103,101,59,27115,114,105,97,110,103,108,101,512,59,100,108,114,6162,6163,6168,6173,26036,111,119,110,59,26046,101,102,116,59,26050,105,103,104,116,59,26040,107,59,25635,433,6187,0,6195,434,6191,0,6193,59,26002,59,26001,52,59,26003,99,107,59,25992,256,101,111,6206,6221,256,59,113,6211,6214,49152,61,8421,117,105,118,59,49152,8801,8421,116,59,25360,512,112,116,119,120,6233,6238,6247,6252,102,59,49152,55349,56659,256,59,116,5067,6243,111,109,187,5068,116,105,101,59,25288,1536,68,72,85,86,98,100,104,109,112,116,117,118,6277,6294,6314,6331,6359,6363,6380,6399,6405,6410,6416,6433,512,76,82,108,114,6286,6288,6290,6292,59,25943,59,25940,59,25942,59,25939,640,59,68,85,100,117,6305,6306,6308,6310,6312,25936,59,25958,59,25961,59,25956,59,25959,512,76,82,108,114,6323,6325,6327,6329,59,25949,59,25946,59,25948,59,25945,896,59,72,76,82,104,108,114,6346,6347,6349,6351,6353,6355,6357,25937,59,25964,59,25955,59,25952,59,25963,59,25954,59,25951,111,120,59,27081,512,76,82,108,114,6372,6374,6376,6378,59,25941,59,25938,59,25872,59,25868,640,59,68,85,100,117,1725,6391,6393,6395,6397,59,25957,59,25960,59,25900,59,25908,105,110,117,115,59,25247,108,117,115,59,25246,105,109,101,115,59,25248,512,76,82,108,114,6425,6427,6429,6431,59,25947,59,25944,59,25880,59,25876,896,59,72,76,82,104,108,114,6448,6449,6451,6453,6455,6457,6459,25858,59,25962,59,25953,59,25950,59,25916,59,25892,59,25884,256,101,118,291,6466,98,97,114,32827,166,16550,512,99,101,105,111,6481,6486,6490,6496,114,59,49152,55349,56503,109,105,59,24655,109,256,59,101,5914,5916,108,384,59,98,104,6504,6505,6507,16476,59,27077,115,117,98,59,26568,364,6516,6526,108,256,59,101,6521,6522,24610,116,187,6522,112,384,59,69,101,303,6533,6535,59,27310,256,59,113,1756,1755,3297,6567,0,6632,6673,6677,6706,0,6711,6736,0,0,6836,0,0,6849,0,0,6945,6958,6989,6994,0,7165,0,7180,384,99,112,114,6573,6578,6621,117,116,101,59,16647,768,59,97,98,99,100,115,6591,6592,6596,6602,6613,6617,25129,110,100,59,27204,114,99,117,112,59,27209,256,97,117,6607,6610,112,59,27211,112,59,27207,111,116,59,27200,59,49152,8745,65024,256,101,111,6626,6629,116,59,24641,238,1683,512,97,101,105,117,6640,6651,6657,6661,496,6645,0,6648,115,59,27213,111,110,59,16653,100,105,108,32827,231,16615,114,99,59,16649,112,115,256,59,115,6668,6669,27212,109,59,27216,111,116,59,16651,384,100,109,110,6683,6688,6694,105,108,32955,184,429,112,116,121,118,59,27058,116,33024,162,59,101,6701,6702,16546,114,228,434,114,59,49152,55349,56608,384,99,101,105,6717,6720,6733,121,59,17479,99,107,256,59,109,6727,6728,26387,97,114,107,187,6728,59,17351,114,896,59,69,99,101,102,109,115,6751,6752,6754,6763,6820,6826,6830,26059,59,27075,384,59,101,108,6761,6762,6765,17094,113,59,25175,101,609,6772,0,0,6792,114,114,111,119,256,108,114,6780,6785,101,102,116,59,25018,105,103,104,116,59,25019,640,82,83,97,99,100,6802,6804,6806,6810,6815,187,3911,59,25800,115,116,59,25243,105,114,99,59,25242,97,115,104,59,25245,110,105,110,116,59,27152,105,100,59,27375,99,105,114,59,27074,117,98,115,256,59,117,6843,6844,26211,105,116,187,6844,748,6855,6868,6906,0,6922,111,110,256,59,101,6861,6862,16442,256,59,113,199,198,621,6873,0,0,6882,97,256,59,116,6878,6879,16428,59,16448,384,59,102,108,6888,6889,6891,25089,238,4448,101,256,109,120,6897,6902,101,110,116,187,6889,101,243,589,487,6910,0,6919,256,59,100,4795,6914,111,116,59,27245,110,244,582,384,102,114,121,6928,6932,6935,59,49152,55349,56660,111,228,596,33024,169,59,115,341,6941,114,59,24855,256,97,111,6949,6953,114,114,59,25013,115,115,59,26391,256,99,117,6962,6967,114,59,49152,55349,56504,256,98,112,6972,6980,256,59,101,6977,6978,27343,59,27345,256,59,101,6985,6986,27344,59,27346,100,111,116,59,25327,896,100,101,108,112,114,118,119,7008,7020,7031,7042,7084,7124,7161,97,114,114,256,108,114,7016,7018,59,26936,59,26933,624,7026,0,0,7029,114,59,25310,99,59,25311,97,114,114,256,59,112,7039,7040,25014,59,26941,768,59,98,99,100,111,115,7055,7056,7062,7073,7077,7080,25130,114,99,97,112,59,27208,256,97,117,7067,7070,112,59,27206,112,59,27210,111,116,59,25229,114,59,27205,59,49152,8746,65024,512,97,108,114,118,7093,7103,7134,7139,114,114,256,59,109,7100,7101,25015,59,26940,121,384,101,118,119,7111,7124,7128,113,624,7118,0,0,7122,114,101,227,7027,117,227,7029,101,101,59,25294,101,100,103,101,59,25295,101,110,32827,164,16548,101,97,114,114,111,119,256,108,114,7150,7155,101,102,116,187,7040,105,103,104,116,187,7101,101,228,7133,256,99,105,7169,7175,111,110,105,110,244,503,110,116,59,25137,108,99,116,121,59,25389,2432,65,72,97,98,99,100,101,102,104,105,106,108,111,114,115,116,117,119,122,7224,7227,7231,7261,7273,7285,7306,7326,7340,7351,7419,7423,7437,7547,7569,7595,7611,7622,7629,114,242,897,97,114,59,26981,512,103,108,114,115,7240,7245,7250,7252,103,101,114,59,24608,101,116,104,59,24888,242,4403,104,256,59,118,7258,7259,24592,187,2314,363,7265,7271,97,114,111,119,59,26895,97,227,789,256,97,121,7278,7283,114,111,110,59,16655,59,17460,384,59,97,111,818,7292,7300,256,103,114,703,7297,114,59,25034,116,115,101,113,59,27255,384,103,108,109,7313,7316,7320,32827,176,16560,116,97,59,17332,112,116,121,118,59,27057,256,105,114,7331,7336,115,104,116,59,27007,59,49152,55349,56609,97,114,256,108,114,7347,7349,187,2268,187,4126,640,97,101,103,115,118,7362,888,7382,7388,7392,109,384,59,111,115,806,7370,7380,110,100,256,59,115,806,7377,117,105,116,59,26214,97,109,109,97,59,17373,105,110,59,25330,384,59,105,111,7399,7400,7416,16631,100,101,33024,247,59,111,7399,7408,110,116,105,109,101,115,59,25287,110,248,7415,99,121,59,17490,99,623,7430,0,0,7434,114,110,59,25374,111,112,59,25357,640,108,112,116,117,119,7448,7453,7458,7497,7509,108,97,114,59,16420,102,59,49152,55349,56661,640,59,101,109,112,115,779,7469,7479,7485,7490,113,256,59,100,850,7475,111,116,59,25169,105,110,117,115,59,25144,108,117,115,59,25108,113,117,97,114,101,59,25249,98,108,101,98,97,114,119,101,100,103,229,250,110,384,97,100,104,4398,7517,7527,111,119,110,97,114,114,111,119,243,7299,97,114,112,111,111,110,256,108,114,7538,7542,101,102,244,7348,105,103,104,244,7350,354,7551,7557,107,97,114,111,247,3906,623,7562,0,0,7566,114,110,59,25375,111,112,59,25356,384,99,111,116,7576,7587,7590,256,114,121,7581,7585,59,49152,55349,56505,59,17493,108,59,27126,114,111,107,59,16657,256,100,114,7600,7604,111,116,59,25329,105,256,59,102,7610,6166,26047,256,97,104,7616,7619,114,242,1065,97,242,4006,97,110,103,108,101,59,27046,256,99,105,7634,7637,121,59,17503,103,114,97,114,114,59,26623,2304,68,97,99,100,101,102,103,108,109,110,111,112,113,114,115,116,117,120,7681,7689,7705,7736,1400,7740,7753,7777,7806,7845,7855,7869,7905,7978,7991,8004,8014,8026,256,68,111,7686,7476,111,244,7305,256,99,115,7694,7700,117,116,101,32827,233,16617,116,101,114,59,27246,512,97,105,111,121,7714,7719,7729,7734,114,111,110,59,16667,114,256,59,99,7725,7726,25174,32827,234,16618,108,111,110,59,25173,59,17485,111,116,59,16663,256,68,114,7745,7749,111,116,59,25170,59,49152,55349,56610,384,59,114,115,7760,7761,7767,27290,97,118,101,32827,232,16616,256,59,100,7772,7773,27286,111,116,59,27288,512,59,105,108,115,7786,7787,7794,7796,27289,110,116,101,114,115,59,25575,59,24851,256,59,100,7801,7802,27285,111,116,59,27287,384,97,112,115,7813,7817,7831,99,114,59,16659,116,121,384,59,115,118,7826,7827,7829,25093,101,116,187,7827,112,256,49,59,7837,7844,307,7841,7843,59,24580,59,24581,24579,256,103,115,7850,7852,59,16715,112,59,24578,256,103,112,7860,7864,111,110,59,16665,102,59,49152,55349,56662,384,97,108,115,7876,7886,7890,114,256,59,115,7882,7883,25301,108,59,27107,117,115,59,27249,105,384,59,108,118,7898,7899,7903,17333,111,110,187,7899,59,17397,512,99,115,117,118,7914,7923,7947,7971,256,105,111,7919,7729,114,99,187,7726,617,7929,0,0,7931,237,1352,97,110,116,256,103,108,7938,7942,116,114,187,7773,101,115,115,187,7802,384,97,101,105,7954,7958,7962,108,115,59,16445,115,116,59,25183,118,256,59,68,565,7968,68,59,27256,112,97,114,115,108,59,27109,256,68,97,7983,7987,111,116,59,25171,114,114,59,26993,384,99,100,105,7998,8001,7928,114,59,24879,111,244,850,256,97,104,8009,8011,59,17335,32827,240,16624,256,109,114,8019,8023,108,32827,235,16619,111,59,24748,384,99,105,112,8033,8036,8039,108,59,16417,115,244,1390,256,101,111,8044,8052,99,116,97,116,105,111,238,1369,110,101,110,116,105,97,108,229,1401,2529,8082,0,8094,0,8097,8103,0,0,8134,8140,0,8147,0,8166,8170,8192,0,8200,8282,108,108,105,110,103,100,111,116,115,101,241,7748,121,59,17476,109,97,108,101,59,26176,384,105,108,114,8109,8115,8129,108,105,103,59,32768,64259,617,8121,0,0,8125,103,59,32768,64256,105,103,59,32768,64260,59,49152,55349,56611,108,105,103,59,32768,64257,108,105,103,59,49152,102,106,384,97,108,116,8153,8156,8161,116,59,26221,105,103,59,32768,64258,110,115,59,26033,111,102,59,16786,496,8174,0,8179,102,59,49152,55349,56663,256,97,107,1471,8183,256,59,118,8188,8189,25300,59,27353,97,114,116,105,110,116,59,27149,256,97,111,8204,8277,256,99,115,8209,8274,945,8218,8240,8248,8261,8264,0,8272,946,8226,8229,8231,8234,8236,0,8238,32827,189,16573,59,24915,32827,188,16572,59,24917,59,24921,59,24923,435,8244,0,8246,59,24916,59,24918,692,8254,8257,0,0,8259,32827,190,16574,59,24919,59,24924,53,59,24920,438,8268,0,8270,59,24922,59,24925,56,59,24926,108,59,24644,119,110,59,25378,99,114,59,49152,55349,56507,2176,69,97,98,99,100,101,102,103,105,106,108,110,111,114,115,116,118,8322,8329,8351,8357,8368,8372,8432,8437,8442,8447,8451,8466,8504,791,8510,8530,8606,256,59,108,1613,8327,59,27276,384,99,109,112,8336,8341,8349,117,116,101,59,16885,109,97,256,59,100,8348,7386,17331,59,27270,114,101,118,101,59,16671,256,105,121,8362,8366,114,99,59,16669,59,17459,111,116,59,16673,512,59,108,113,115,1598,1602,8381,8393,384,59,113,115,1598,1612,8388,108,97,110,244,1637,512,59,99,100,108,1637,8402,8405,8421,99,59,27305,111,116,256,59,111,8412,8413,27264,256,59,108,8418,8419,27266,59,27268,256,59,101,8426,8429,49152,8923,65024,115,59,27284,114,59,49152,55349,56612,256,59,103,1651,1563,109,101,108,59,24887,99,121,59,17491,512,59,69,97,106,1626,8460,8462,8464,59,27282,59,27301,59,27300,512,69,97,101,115,8475,8477,8489,8500,59,25193,112,256,59,112,8483,8484,27274,114,111,120,187,8484,256,59,113,8494,8495,27272,256,59,113,8494,8475,105,109,59,25319,112,102,59,49152,55349,56664,256,99,105,8515,8518,114,59,24842,109,384,59,101,108,1643,8526,8528,59,27278,59,27280,33536,62,59,99,100,108,113,114,1518,8544,8554,8558,8563,8569,256,99,105,8549,8551,59,27303,114,59,27258,111,116,59,25303,80,97,114,59,27029,117,101,115,116,59,27260,640,97,100,101,108,115,8580,8554,8592,1622,8603,496,8585,0,8590,112,114,111,248,8350,114,59,27e3,113,256,108,113,1599,8598,108,101,115,243,8328,105,237,1643,256,101,110,8611,8621,114,116,110,101,113,113,59,49152,8809,65024,197,8618,1280,65,97,98,99,101,102,107,111,115,121,8644,8647,8689,8693,8698,8728,8733,8751,8808,8829,114,242,928,512,105,108,109,114,8656,8660,8663,8667,114,115,240,5252,102,187,8228,105,108,244,1705,256,100,114,8672,8676,99,121,59,17482,384,59,99,119,2292,8683,8687,105,114,59,26952,59,25005,97,114,59,24847,105,114,99,59,16677,384,97,108,114,8705,8718,8723,114,116,115,256,59,117,8713,8714,26213,105,116,187,8714,108,105,112,59,24614,99,111,110,59,25273,114,59,49152,55349,56613,115,256,101,119,8739,8745,97,114,111,119,59,26917,97,114,111,119,59,26918,640,97,109,111,112,114,8762,8766,8771,8798,8803,114,114,59,25087,116,104,116,59,25147,107,256,108,114,8777,8787,101,102,116,97,114,114,111,119,59,25001,105,103,104,116,97,114,114,111,119,59,25002,102,59,49152,55349,56665,98,97,114,59,24597,384,99,108,116,8815,8820,8824,114,59,49152,55349,56509,97,115,232,8692,114,111,107,59,16679,256,98,112,8834,8839,117,108,108,59,24643,104,101,110,187,7259,2785,8867,0,8874,0,8888,8901,8910,0,8917,8947,0,0,8952,8994,9063,9058,9087,0,9094,9130,9140,99,117,116,101,32827,237,16621,384,59,105,121,1905,8880,8885,114,99,32827,238,16622,59,17464,256,99,120,8892,8895,121,59,17461,99,108,32827,161,16545,256,102,114,927,8905,59,49152,55349,56614,114,97,118,101,32827,236,16620,512,59,105,110,111,1854,8925,8937,8942,256,105,110,8930,8934,110,116,59,27148,116,59,25133,102,105,110,59,27100,116,97,59,24873,108,105,103,59,16691,384,97,111,112,8958,8986,8989,384,99,103,116,8965,8968,8983,114,59,16683,384,101,108,112,1823,8975,8979,105,110,229,1934,97,114,244,1824,104,59,16689,102,59,25271,101,100,59,16821,640,59,99,102,111,116,1268,9004,9009,9021,9025,97,114,101,59,24837,105,110,256,59,116,9016,9017,25118,105,101,59,27101,100,111,244,8985,640,59,99,101,108,112,1879,9036,9040,9051,9057,97,108,59,25274,256,103,114,9045,9049,101,114,243,5475,227,9037,97,114,104,107,59,27159,114,111,100,59,27196,512,99,103,112,116,9071,9074,9078,9083,121,59,17489,111,110,59,16687,102,59,49152,55349,56666,97,59,17337,117,101,115,116,32827,191,16575,256,99,105,9098,9103,114,59,49152,55349,56510,110,640,59,69,100,115,118,1268,9115,9117,9121,1267,59,25337,111,116,59,25333,256,59,118,9126,9127,25332,59,25331,256,59,105,1911,9134,108,100,101,59,16681,491,9144,0,9148,99,121,59,17494,108,32827,239,16623,768,99,102,109,111,115,117,9164,9175,9180,9185,9191,9205,256,105,121,9169,9173,114,99,59,16693,59,17465,114,59,49152,55349,56615,97,116,104,59,16951,112,102,59,49152,55349,56667,483,9196,0,9201,114,59,49152,55349,56511,114,99,121,59,17496,107,99,121,59,17492,1024,97,99,102,103,104,106,111,115,9227,9238,9250,9255,9261,9265,9269,9275,112,112,97,256,59,118,9235,9236,17338,59,17392,256,101,121,9243,9248,100,105,108,59,16695,59,17466,114,59,49152,55349,56616,114,101,101,110,59,16696,99,121,59,17477,99,121,59,17500,112,102,59,49152,55349,56668,99,114,59,49152,55349,56512,2944,65,66,69,72,97,98,99,100,101,102,103,104,106,108,109,110,111,112,114,115,116,117,118,9328,9345,9350,9357,9361,9486,9533,9562,9600,9806,9822,9829,9849,9853,9882,9906,9944,10077,10088,10123,10176,10241,10258,384,97,114,116,9335,9338,9340,114,242,2502,242,917,97,105,108,59,26907,97,114,114,59,26894,256,59,103,2452,9355,59,27275,97,114,59,26978,2403,9381,0,9386,0,9393,0,0,0,0,0,9397,9402,0,9414,9416,9421,0,9465,117,116,101,59,16698,109,112,116,121,118,59,27060,114,97,238,2124,98,100,97,59,17339,103,384,59,100,108,2190,9409,9411,59,27025,229,2190,59,27269,117,111,32827,171,16555,114,1024,59,98,102,104,108,112,115,116,2201,9438,9446,9449,9451,9454,9457,9461,256,59,102,2205,9443,115,59,26911,115,59,26909,235,8786,112,59,25003,108,59,26937,105,109,59,26995,108,59,24994,384,59,97,101,9471,9472,9476,27307,105,108,59,26905,256,59,115,9481,9482,27309,59,49152,10925,65024,384,97,98,114,9493,9497,9501,114,114,59,26892,114,107,59,26482,256,97,107,9506,9516,99,256,101,107,9512,9514,59,16507,59,16475,256,101,115,9521,9523,59,27019,108,256,100,117,9529,9531,59,27023,59,27021,512,97,101,117,121,9542,9547,9558,9560,114,111,110,59,16702,256,100,105,9552,9556,105,108,59,16700,236,2224,226,9513,59,17467,512,99,113,114,115,9571,9574,9581,9597,97,59,26934,117,111,256,59,114,3609,5958,256,100,117,9586,9591,104,97,114,59,26983,115,104,97,114,59,26955,104,59,25010,640,59,102,103,113,115,9611,9612,2441,9715,9727,25188,116,640,97,104,108,114,116,9624,9636,9655,9666,9704,114,114,111,119,256,59,116,2201,9633,97,233,9462,97,114,112,111,111,110,256,100,117,9647,9652,111,119,110,187,1114,112,187,2406,101,102,116,97,114,114,111,119,115,59,25031,105,103,104,116,384,97,104,115,9677,9686,9694,114,114,111,119,256,59,115,2292,2215,97,114,112,111,111,110,243,3992,113,117,105,103,97,114,114,111,247,8688,104,114,101,101,116,105,109,101,115,59,25291,384,59,113,115,9611,2451,9722,108,97,110,244,2476,640,59,99,100,103,115,2476,9738,9741,9757,9768,99,59,27304,111,116,256,59,111,9748,9749,27263,256,59,114,9754,9755,27265,59,27267,256,59,101,9762,9765,49152,8922,65024,115,59,27283,640,97,100,101,103,115,9779,9785,9789,9801,9803,112,112,114,111,248,9414,111,116,59,25302,113,256,103,113,9795,9797,244,2441,103,116,242,9356,244,2459,105,237,2482,384,105,108,114,9813,2273,9818,115,104,116,59,27004,59,49152,55349,56617,256,59,69,2460,9827,59,27281,353,9833,9846,114,256,100,117,9650,9838,256,59,108,2405,9843,59,26986,108,107,59,25988,99,121,59,17497,640,59,97,99,104,116,2632,9864,9867,9873,9878,114,242,9665,111,114,110,101,242,7432,97,114,100,59,26987,114,105,59,26106,256,105,111,9887,9892,100,111,116,59,16704,117,115,116,256,59,97,9900,9901,25520,99,104,101,187,9901,512,69,97,101,115,9915,9917,9929,9940,59,25192,112,256,59,112,9923,9924,27273,114,111,120,187,9924,256,59,113,9934,9935,27271,256,59,113,9934,9915,105,109,59,25318,1024,97,98,110,111,112,116,119,122,9961,9972,9975,10010,10031,10049,10055,10064,256,110,114,9966,9969,103,59,26604,114,59,25085,114,235,2241,103,384,108,109,114,9983,9997,10004,101,102,116,256,97,114,2534,9991,105,103,104,116,225,2546,97,112,115,116,111,59,26620,105,103,104,116,225,2557,112,97,114,114,111,119,256,108,114,10021,10025,101,102,244,9453,105,103,104,116,59,25004,384,97,102,108,10038,10041,10045,114,59,27013,59,49152,55349,56669,117,115,59,27181,105,109,101,115,59,27188,353,10059,10063,115,116,59,25111,225,4942,384,59,101,102,10071,10072,6144,26058,110,103,101,187,10072,97,114,256,59,108,10084,10085,16424,116,59,27027,640,97,99,104,109,116,10099,10102,10108,10117,10119,114,242,2216,111,114,110,101,242,7564,97,114,256,59,100,3992,10115,59,26989,59,24590,114,105,59,25279,768,97,99,104,105,113,116,10136,10141,2624,10146,10158,10171,113,117,111,59,24633,114,59,49152,55349,56513,109,384,59,101,103,2482,10154,10156,59,27277,59,27279,256,98,117,9514,10163,111,256,59,114,3615,10169,59,24602,114,111,107,59,16706,33792,60,59,99,100,104,105,108,113,114,2091,10194,9785,10204,10208,10213,10218,10224,256,99,105,10199,10201,59,27302,114,59,27257,114,101,229,9714,109,101,115,59,25289,97,114,114,59,26998,117,101,115,116,59,27259,256,80,105,10229,10233,97,114,59,27030,384,59,101,102,10240,2349,6171,26051,114,256,100,117,10247,10253,115,104,97,114,59,26954,104,97,114,59,26982,256,101,110,10263,10273,114,116,110,101,113,113,59,49152,8808,65024,197,10270,1792,68,97,99,100,101,102,104,105,108,110,111,112,115,117,10304,10309,10370,10382,10387,10400,10405,10408,10458,10466,10468,2691,10483,10498,68,111,116,59,25146,512,99,108,112,114,10318,10322,10339,10365,114,32827,175,16559,256,101,116,10327,10329,59,26178,256,59,101,10334,10335,26400,115,101,187,10335,256,59,115,4155,10344,116,111,512,59,100,108,117,4155,10355,10359,10363,111,119,238,1164,101,102,244,2319,240,5073,107,101,114,59,26030,256,111,121,10375,10380,109,109,97,59,27177,59,17468,97,115,104,59,24596,97,115,117,114,101,100,97,110,103,108,101,187,5670,114,59,49152,55349,56618,111,59,24871,384,99,100,110,10415,10420,10441,114,111,32827,181,16565,512,59,97,99,100,5220,10429,10432,10436,115,244,5799,105,114,59,27376,111,116,32955,183,437,117,115,384,59,98,100,10450,6403,10451,25106,256,59,117,7484,10456,59,27178,355,10462,10465,112,59,27355,242,8722,240,2689,256,100,112,10473,10478,101,108,115,59,25255,102,59,49152,55349,56670,256,99,116,10488,10493,114,59,49152,55349,56514,112,111,115,187,5533,384,59,108,109,10505,10506,10509,17340,116,105,109,97,112,59,25272,3072,71,76,82,86,97,98,99,100,101,102,103,104,105,106,108,109,111,112,114,115,116,117,118,119,10562,10579,10622,10633,10648,10714,10729,10773,10778,10840,10845,10883,10901,10916,10920,11012,11015,11076,11135,11182,11316,11367,11388,11497,256,103,116,10567,10571,59,49152,8921,824,256,59,118,10576,3023,49152,8811,8402,384,101,108,116,10586,10610,10614,102,116,256,97,114,10593,10599,114,114,111,119,59,25037,105,103,104,116,97,114,114,111,119,59,25038,59,49152,8920,824,256,59,118,10619,3143,49152,8810,8402,105,103,104,116,97,114,114,111,119,59,25039,256,68,100,10638,10643,97,115,104,59,25263,97,115,104,59,25262,640,98,99,110,112,116,10659,10663,10668,10673,10700,108,97,187,734,117,116,101,59,16708,103,59,49152,8736,8402,640,59,69,105,111,112,3460,10684,10688,10693,10696,59,49152,10864,824,100,59,49152,8779,824,115,59,16713,114,111,248,3460,117,114,256,59,97,10707,10708,26222,108,256,59,115,10707,2872,499,10719,0,10723,112,32955,160,2871,109,112,256,59,101,3065,3072,640,97,101,111,117,121,10740,10750,10755,10768,10771,496,10745,0,10747,59,27203,111,110,59,16712,100,105,108,59,16710,110,103,256,59,100,3454,10762,111,116,59,49152,10861,824,112,59,27202,59,17469,97,115,104,59,24595,896,59,65,97,100,113,115,120,2962,10793,10797,10811,10817,10821,10832,114,114,59,25047,114,256,104,114,10803,10806,107,59,26916,256,59,111,5106,5104,111,116,59,49152,8784,824,117,105,246,2915,256,101,105,10826,10830,97,114,59,26920,237,2968,105,115,116,256,59,115,2976,2975,114,59,49152,55349,56619,512,69,101,115,116,3013,10854,10873,10876,384,59,113,115,3004,10861,3041,384,59,113,115,3004,3013,10868,108,97,110,244,3042,105,237,3050,256,59,114,2998,10881,187,2999,384,65,97,112,10890,10893,10897,114,242,10609,114,114,59,25006,97,114,59,27378,384,59,115,118,3981,10908,3980,256,59,100,10913,10914,25340,59,25338,99,121,59,17498,896,65,69,97,100,101,115,116,10935,10938,10942,10946,10949,10998,11001,114,242,10598,59,49152,8806,824,114,114,59,24986,114,59,24613,512,59,102,113,115,3131,10958,10979,10991,116,256,97,114,10964,10969,114,114,111,247,10945,105,103,104,116,97,114,114,111,247,10896,384,59,113,115,3131,10938,10986,108,97,110,244,3157,256,59,115,3157,10996,187,3126,105,237,3165,256,59,114,3125,11006,105,256,59,101,3098,3109,105,228,3472,256,112,116,11020,11025,102,59,49152,55349,56671,33152,172,59,105,110,11033,11034,11062,16556,110,512,59,69,100,118,2953,11044,11048,11054,59,49152,8953,824,111,116,59,49152,8949,824,481,2953,11059,11061,59,25335,59,25334,105,256,59,118,3256,11068,481,3256,11073,11075,59,25342,59,25341,384,97,111,114,11083,11107,11113,114,512,59,97,115,116,2939,11093,11098,11103,108,108,101,236,2939,108,59,49152,11005,8421,59,49152,8706,824,108,105,110,116,59,27156,384,59,99,101,3218,11120,11123,117,229,3237,256,59,99,3224,11128,256,59,101,3218,11133,241,3224,512,65,97,105,116,11144,11147,11165,11175,114,242,10632,114,114,384,59,99,119,11156,11157,11161,24987,59,49152,10547,824,59,49152,8605,824,103,104,116,97,114,114,111,119,187,11157,114,105,256,59,101,3275,3286,896,99,104,105,109,112,113,117,11197,11213,11225,11012,2936,11236,11247,512,59,99,101,114,3378,11206,3383,11209,117,229,3397,59,49152,55349,56515,111,114,116,621,11013,0,0,11222,97,114,225,11094,109,256,59,101,3438,11231,256,59,113,3444,3443,115,117,256,98,112,11243,11245,229,3320,229,3339,384,98,99,112,11254,11281,11289,512,59,69,101,115,11263,11264,3362,11268,25220,59,49152,10949,824,101,116,256,59,101,3355,11275,113,256,59,113,3363,11264,99,256,59,101,3378,11287,241,3384,512,59,69,101,115,11298,11299,3423,11303,25221,59,49152,10950,824,101,116,256,59,101,3416,11310,113,256,59,113,3424,11299,512,103,105,108,114,11325,11327,11333,11335,236,3031,108,100,101,32827,241,16625,231,3139,105,97,110,103,108,101,256,108,114,11346,11356,101,102,116,256,59,101,3098,11354,241,3110,105,103,104,116,256,59,101,3275,11365,241,3287,256,59,109,11372,11373,17341,384,59,101,115,11380,11381,11385,16419,114,111,59,24854,112,59,24583,1152,68,72,97,100,103,105,108,114,115,11407,11412,11417,11422,11427,11440,11446,11475,11491,97,115,104,59,25261,97,114,114,59,26884,112,59,49152,8781,8402,97,115,104,59,25260,256,101,116,11432,11436,59,49152,8805,8402,59,49152,62,8402,110,102,105,110,59,27102,384,65,101,116,11453,11457,11461,114,114,59,26882,59,49152,8804,8402,256,59,114,11466,11469,49152,60,8402,105,101,59,49152,8884,8402,256,65,116,11480,11484,114,114,59,26883,114,105,101,59,49152,8885,8402,105,109,59,49152,8764,8402,384,65,97,110,11504,11508,11522,114,114,59,25046,114,256,104,114,11514,11517,107,59,26915,256,59,111,5095,5093,101,97,114,59,26919,4691,6805,0,0,0,0,0,0,0,0,0,0,0,0,0,11565,0,11576,11592,11616,11621,11634,11652,6919,0,0,11661,11691,0,11720,11726,0,11740,11801,11819,11838,11843,256,99,115,11569,6807,117,116,101,32827,243,16627,256,105,121,11580,11589,114,256,59,99,6814,11586,32827,244,16628,59,17470,640,97,98,105,111,115,6816,11602,11607,456,11610,108,97,99,59,16721,118,59,27192,111,108,100,59,27068,108,105,103,59,16723,256,99,114,11625,11629,105,114,59,27071,59,49152,55349,56620,879,11641,0,0,11644,0,11650,110,59,17115,97,118,101,32827,242,16626,59,27073,256,98,109,11656,3572,97,114,59,27061,512,97,99,105,116,11669,11672,11685,11688,114,242,6784,256,105,114,11677,11680,114,59,27070,111,115,115,59,27067,110,229,3666,59,27072,384,97,101,105,11697,11701,11705,99,114,59,16717,103,97,59,17353,384,99,100,110,11712,11717,461,114,111,110,59,17343,59,27062,112,102,59,49152,55349,56672,384,97,101,108,11732,11735,466,114,59,27063,114,112,59,27065,896,59,97,100,105,111,115,118,11754,11755,11758,11784,11789,11792,11798,25128,114,242,6790,512,59,101,102,109,11767,11768,11778,11781,27229,114,256,59,111,11774,11775,24884,102,187,11775,32827,170,16554,32827,186,16570,103,111,102,59,25270,114,59,27222,108,111,112,101,59,27223,59,27227,384,99,108,111,11807,11809,11815,242,11777,97,115,104,32827,248,16632,108,59,25240,105,364,11823,11828,100,101,32827,245,16629,101,115,256,59,97,475,11834,115,59,27190,109,108,32827,246,16630,98,97,114,59,25405,2785,11870,0,11901,0,11904,11933,0,11938,11961,0,0,11979,3740,0,12051,0,0,12075,12220,0,12232,114,512,59,97,115,116,1027,11879,11890,3717,33024,182,59,108,11885,11886,16566,108,101,236,1027,617,11896,0,0,11899,109,59,27379,59,27389,121,59,17471,114,640,99,105,109,112,116,11915,11919,11923,6245,11927,110,116,59,16421,111,100,59,16430,105,108,59,24624,101,110,107,59,24625,114,59,49152,55349,56621,384,105,109,111,11944,11952,11956,256,59,118,11949,11950,17350,59,17365,109,97,244,2678,110,101,59,26126,384,59,116,118,11967,11968,11976,17344,99,104,102,111,114,107,187,8189,59,17366,256,97,117,11983,11999,110,256,99,107,11989,11997,107,256,59,104,8692,11995,59,24846,246,8692,115,1152,59,97,98,99,100,101,109,115,116,12019,12020,6408,12025,12029,12036,12038,12042,12046,16427,99,105,114,59,27171,105,114,59,27170,256,111,117,7488,12034,59,27173,59,27250,110,32955,177,3741,105,109,59,27174,119,111,59,27175,384,105,112,117,12057,12064,12069,110,116,105,110,116,59,27157,102,59,49152,55349,56673,110,100,32827,163,16547,1280,59,69,97,99,101,105,110,111,115,117,3784,12095,12097,12100,12103,12161,12169,12178,12158,12214,59,27315,112,59,27319,117,229,3801,256,59,99,3790,12108,768,59,97,99,101,110,115,3784,12121,12127,12134,12136,12158,112,112,114,111,248,12099,117,114,108,121,101,241,3801,241,3790,384,97,101,115,12143,12150,12154,112,112,114,111,120,59,27321,113,113,59,27317,105,109,59,25320,105,237,3807,109,101,256,59,115,12168,3758,24626,384,69,97,115,12152,12176,12154,240,12149,384,100,102,112,3820,12185,12207,384,97,108,115,12192,12197,12202,108,97,114,59,25390,105,110,101,59,25362,117,114,102,59,25363,256,59,116,3835,12212,239,3835,114,101,108,59,25264,256,99,105,12224,12229,114,59,49152,55349,56517,59,17352,110,99,115,112,59,24584,768,102,105,111,112,115,117,12250,8930,12255,12261,12267,12273,114,59,49152,55349,56622,112,102,59,49152,55349,56674,114,105,109,101,59,24663,99,114,59,49152,55349,56518,384,97,101,111,12280,12297,12307,116,256,101,105,12286,12293,114,110,105,111,110,243,1712,110,116,59,27158,115,116,256,59,101,12304,12305,16447,241,7961,244,3860,2688,65,66,72,97,98,99,100,101,102,104,105,108,109,110,111,112,114,115,116,117,120,12352,12369,12373,12377,12512,12558,12587,12615,12642,12658,12686,12806,12821,12836,12841,12888,12910,12914,12944,12976,12983,384,97,114,116,12359,12362,12364,114,242,4275,242,989,97,105,108,59,26908,97,114,242,7269,97,114,59,26980,896,99,100,101,110,113,114,116,12392,12405,12408,12415,12431,12436,12492,256,101,117,12397,12401,59,49152,8765,817,116,101,59,16725,105,227,4462,109,112,116,121,118,59,27059,103,512,59,100,101,108,4049,12425,12427,12429,59,27026,59,27045,229,4049,117,111,32827,187,16571,114,1408,59,97,98,99,102,104,108,112,115,116,119,4060,12460,12463,12471,12473,12476,12478,12480,12483,12487,12490,112,59,26997,256,59,102,4064,12468,115,59,26912,59,26931,115,59,26910,235,8797,240,10030,108,59,26949,105,109,59,26996,108,59,24995,59,24989,256,97,105,12497,12501,105,108,59,26906,111,256,59,110,12507,12508,25142,97,108,243,3870,384,97,98,114,12519,12522,12526,114,242,6117,114,107,59,26483,256,97,107,12531,12541,99,256,101,107,12537,12539,59,16509,59,16477,256,101,115,12546,12548,59,27020,108,256,100,117,12554,12556,59,27022,59,27024,512,97,101,117,121,12567,12572,12583,12585,114,111,110,59,16729,256,100,105,12577,12581,105,108,59,16727,236,4082,226,12538,59,17472,512,99,108,113,115,12596,12599,12605,12612,97,59,26935,100,104,97,114,59,26985,117,111,256,59,114,526,525,104,59,25011,384,97,99,103,12622,12639,3908,108,512,59,105,112,115,3960,12632,12635,4252,110,229,4283,97,114,244,4009,116,59,26029,384,105,108,114,12649,4131,12654,115,104,116,59,27005,59,49152,55349,56623,256,97,111,12663,12678,114,256,100,117,12669,12671,187,1147,256,59,108,4241,12676,59,26988,256,59,118,12683,12684,17345,59,17393,384,103,110,115,12693,12793,12796,104,116,768,97,104,108,114,115,116,12708,12720,12738,12760,12772,12782,114,114,111,119,256,59,116,4060,12717,97,233,12488,97,114,112,111,111,110,256,100,117,12731,12735,111,119,238,12670,112,187,4242,101,102,116,256,97,104,12746,12752,114,114,111,119,243,4074,97,114,112,111,111,110,243,1361,105,103,104,116,97,114,114,111,119,115,59,25033,113,117,105,103,97,114,114,111,247,12491,104,114,101,101,116,105,109,101,115,59,25292,103,59,17114,105,110,103,100,111,116,115,101,241,7986,384,97,104,109,12813,12816,12819,114,242,4074,97,242,1361,59,24591,111,117,115,116,256,59,97,12830,12831,25521,99,104,101,187,12831,109,105,100,59,27374,512,97,98,112,116,12850,12861,12864,12882,256,110,114,12855,12858,103,59,26605,114,59,25086,114,235,4099,384,97,102,108,12871,12874,12878,114,59,27014,59,49152,55349,56675,117,115,59,27182,105,109,101,115,59,27189,256,97,112,12893,12903,114,256,59,103,12899,12900,16425,116,59,27028,111,108,105,110,116,59,27154,97,114,242,12771,512,97,99,104,113,12923,12928,4284,12933,113,117,111,59,24634,114,59,49152,55349,56519,256,98,117,12539,12938,111,256,59,114,532,531,384,104,105,114,12951,12955,12960,114,101,229,12792,109,101,115,59,25290,105,512,59,101,102,108,12970,4185,6177,12971,26041,116,114,105,59,27086,108,117,104,97,114,59,26984,59,24862,3425,13013,13019,13023,13100,13112,13169,0,13178,13220,0,0,13292,13296,0,13352,13384,13402,13485,13489,13514,13553,0,13846,0,0,13875,99,117,116,101,59,16731,113,117,239,10170,1280,59,69,97,99,101,105,110,112,115,121,4589,13043,13045,13055,13058,13067,13071,13087,13094,13097,59,27316,496,13050,0,13052,59,27320,111,110,59,16737,117,229,4606,256,59,100,4595,13063,105,108,59,16735,114,99,59,16733,384,69,97,115,13078,13080,13083,59,27318,112,59,27322,105,109,59,25321,111,108,105,110,116,59,27155,105,237,4612,59,17473,111,116,384,59,98,101,13108,7495,13109,25285,59,27238,896,65,97,99,109,115,116,120,13126,13130,13143,13147,13150,13155,13165,114,114,59,25048,114,256,104,114,13136,13138,235,8744,256,59,111,2614,2612,116,32827,167,16551,105,59,16443,119,97,114,59,26921,109,256,105,110,13161,240,110,117,243,241,116,59,26422,114,256,59,111,13174,8277,49152,55349,56624,512,97,99,111,121,13186,13190,13201,13216,114,112,59,26223,256,104,121,13195,13199,99,121,59,17481,59,17480,114,116,621,13209,0,0,13212,105,228,5220,97,114,97,236,11887,32827,173,16557,256,103,109,13224,13236,109,97,384,59,102,118,13233,13234,13234,17347,59,17346,1024,59,100,101,103,108,110,112,114,4779,13253,13257,13262,13270,13278,13281,13286,111,116,59,27242,256,59,113,4785,4784,256,59,69,13267,13268,27294,59,27296,256,59,69,13275,13276,27293,59,27295,101,59,25158,108,117,115,59,27172,97,114,114,59,26994,97,114,242,4413,512,97,101,105,116,13304,13320,13327,13335,256,108,115,13309,13316,108,115,101,116,109,233,13162,104,112,59,27187,112,97,114,115,108,59,27108,256,100,108,5219,13332,101,59,25379,256,59,101,13340,13341,27306,256,59,115,13346,13347,27308,59,49152,10924,65024,384,102,108,112,13358,13363,13378,116,99,121,59,17484,256,59,98,13368,13369,16431,256,59,97,13374,13375,27076,114,59,25407,102,59,49152,55349,56676,97,256,100,114,13389,1026,101,115,256,59,117,13396,13397,26208,105,116,187,13397,384,99,115,117,13408,13433,13471,256,97,117,13413,13423,112,256,59,115,4488,13419,59,49152,8851,65024,112,256,59,115,4532,13429,59,49152,8852,65024,117,256,98,112,13439,13455,384,59,101,115,4503,4508,13446,101,116,256,59,101,4503,13453,241,4509,384,59,101,115,4520,4525,13462,101,116,256,59,101,4520,13469,241,4526,384,59,97,102,4475,13478,1456,114,357,13483,1457,187,4476,97,114,242,4424,512,99,101,109,116,13497,13502,13506,13509,114,59,49152,55349,56520,116,109,238,241,105,236,13333,97,114,230,4542,256,97,114,13518,13525,114,256,59,102,13524,6079,26118,256,97,110,13530,13549,105,103,104,116,256,101,112,13539,13546,112,115,105,108,111,238,7904,104,233,11951,115,187,10322,640,98,99,109,110,112,13563,13662,4617,13707,13710,1152,59,69,100,101,109,110,112,114,115,13582,13583,13585,13589,13598,13603,13612,13617,13622,25218,59,27333,111,116,59,27325,256,59,100,4570,13594,111,116,59,27331,117,108,116,59,27329,256,69,101,13608,13610,59,27339,59,25226,108,117,115,59,27327,97,114,114,59,27001,384,101,105,117,13629,13650,13653,116,384,59,101,110,13582,13637,13643,113,256,59,113,4570,13583,101,113,256,59,113,13611,13608,109,59,27335,256,98,112,13658,13660,59,27349,59,27347,99,768,59,97,99,101,110,115,4589,13676,13682,13689,13691,13094,112,112,114,111,248,13050,117,114,108,121,101,241,4606,241,4595,384,97,101,115,13698,13704,13083,112,112,114,111,248,13082,113,241,13079,103,59,26218,1664,49,50,51,59,69,100,101,104,108,109,110,112,115,13737,13740,13743,4636,13746,13748,13760,13769,13781,13786,13791,13800,13805,32827,185,16569,32827,178,16562,32827,179,16563,59,27334,256,111,115,13753,13756,116,59,27326,117,98,59,27352,256,59,100,4642,13765,111,116,59,27332,115,256,111,117,13775,13778,108,59,26569,98,59,27351,97,114,114,59,27003,117,108,116,59,27330,256,69,101,13796,13798,59,27340,59,25227,108,117,115,59,27328,384,101,105,117,13812,13833,13836,116,384,59,101,110,4636,13820,13826,113,256,59,113,4642,13746,101,113,256,59,113,13799,13796,109,59,27336,256,98,112,13841,13843,59,27348,59,27350,384,65,97,110,13852,13856,13869,114,114,59,25049,114,256,104,114,13862,13864,235,8750,256,59,111,2603,2601,119,97,114,59,26922,108,105,103,32827,223,16607,3041,13905,13917,13920,4814,13939,13945,0,13950,14018,0,0,0,0,0,14043,14083,0,14089,14188,0,0,0,14215,626,13910,0,0,13915,103,101,116,59,25366,59,17348,114,235,3679,384,97,101,121,13926,13931,13936,114,111,110,59,16741,100,105,108,59,16739,59,17474,108,114,101,99,59,25365,114,59,49152,55349,56625,512,101,105,107,111,13958,13981,14005,14012,498,13963,0,13969,101,256,52,102,4740,4737,97,384,59,115,118,13976,13977,13979,17336,121,109,59,17361,256,99,110,13986,14002,107,256,97,115,13992,13998,112,112,114,111,248,4801,105,109,187,4780,115,240,4766,256,97,115,14010,13998,240,4801,114,110,32827,254,16638,492,799,14022,8935,101,115,33152,215,59,98,100,14031,14032,14040,16599,256,59,97,6415,14037,114,59,27185,59,27184,384,101,112,115,14049,14051,14080,225,10829,512,59,98,99,102,1158,14060,14064,14068,111,116,59,25398,105,114,59,27377,256,59,111,14073,14076,49152,55349,56677,114,107,59,27354,225,13154,114,105,109,101,59,24628,384,97,105,112,14095,14098,14180,100,229,4680,896,97,100,101,109,112,115,116,14113,14157,14144,14161,14167,14172,14175,110,103,108,101,640,59,100,108,113,114,14128,14129,14134,14144,14146,26037,111,119,110,187,7611,101,102,116,256,59,101,10240,14142,241,2350,59,25180,105,103,104,116,256,59,101,12970,14155,241,4186,111,116,59,26092,105,110,117,115,59,27194,108,117,115,59,27193,98,59,27085,105,109,101,59,27195,101,122,105,117,109,59,25570,384,99,104,116,14194,14205,14209,256,114,121,14199,14203,59,49152,55349,56521,59,17478,99,121,59,17499,114,111,107,59,16743,256,105,111,14219,14222,120,244,6007,104,101,97,100,256,108,114,14231,14240,101,102,116,97,114,114,111,247,2127,105,103,104,116,97,114,114,111,119,187,3933,2304,65,72,97,98,99,100,102,103,104,108,109,111,112,114,115,116,117,119,14288,14291,14295,14308,14320,14332,14350,14364,14371,14388,14417,14429,14443,14505,14540,14546,14570,14582,114,242,1005,97,114,59,26979,256,99,114,14300,14306,117,116,101,32827,250,16634,242,4432,114,483,14314,0,14317,121,59,17502,118,101,59,16749,256,105,121,14325,14330,114,99,32827,251,16635,59,17475,384,97,98,104,14339,14342,14347,114,242,5037,108,97,99,59,16753,97,242,5059,256,105,114,14355,14360,115,104,116,59,27006,59,49152,55349,56626,114,97,118,101,32827,249,16633,353,14375,14385,114,256,108,114,14380,14382,187,2391,187,4227,108,107,59,25984,256,99,116,14393,14413,623,14399,0,0,14410,114,110,256,59,101,14405,14406,25372,114,187,14406,111,112,59,25359,114,105,59,26104,256,97,108,14422,14426,99,114,59,16747,32955,168,841,256,103,112,14434,14438,111,110,59,16755,102,59,49152,55349,56678,768,97,100,104,108,115,117,4427,14456,14461,4978,14481,14496,111,119,110,225,5043,97,114,112,111,111,110,256,108,114,14472,14476,101,102,244,14381,105,103,104,244,14383,105,384,59,104,108,14489,14490,14492,17349,187,5114,111,110,187,14490,112,97,114,114,111,119,115,59,25032,384,99,105,116,14512,14532,14536,623,14518,0,0,14529,114,110,256,59,101,14524,14525,25373,114,187,14525,111,112,59,25358,110,103,59,16751,114,105,59,26105,99,114,59,49152,55349,56522,384,100,105,114,14553,14557,14562,111,116,59,25328,108,100,101,59,16745,105,256,59,102,14128,14568,187,6163,256,97,109,14575,14578,114,242,14504,108,32827,252,16636,97,110,103,108,101,59,27047,1920,65,66,68,97,99,100,101,102,108,110,111,112,114,115,122,14620,14623,14633,14637,14773,14776,14781,14815,14820,14824,14835,14841,14845,14849,14880,114,242,1015,97,114,256,59,118,14630,14631,27368,59,27369,97,115,232,993,256,110,114,14642,14647,103,114,116,59,27036,896,101,107,110,112,114,115,116,13539,14662,14667,14674,14685,14692,14742,97,112,112,225,9237,111,116,104,105,110,231,7830,384,104,105,114,13547,11976,14681,111,112,244,12213,256,59,104,5047,14690,239,12685,256,105,117,14697,14701,103,109,225,13235,256,98,112,14706,14724,115,101,116,110,101,113,256,59,113,14717,14720,49152,8842,65024,59,49152,10955,65024,115,101,116,110,101,113,256,59,113,14735,14738,49152,8843,65024,59,49152,10956,65024,256,104,114,14747,14751,101,116,225,13980,105,97,110,103,108,101,256,108,114,14762,14767,101,102,116,187,2341,105,103,104,116,187,4177,121,59,17458,97,115,104,187,4150,384,101,108,114,14788,14802,14807,384,59,98,101,11754,14795,14799,97,114,59,25275,113,59,25178,108,105,112,59,25326,256,98,116,14812,5224,97,242,5225,114,59,49152,55349,56627,116,114,233,14766,115,117,256,98,112,14831,14833,187,3356,187,3417,112,102,59,49152,55349,56679,114,111,240,3835,116,114,233,14772,256,99,117,14854,14859,114,59,49152,55349,56523,256,98,112,14864,14872,110,256,69,101,14720,14870,187,14718,110,256,69,101,14738,14878,187,14736,105,103,122,97,103,59,27034,896,99,101,102,111,112,114,115,14902,14907,14934,14939,14932,14945,14954,105,114,99,59,16757,256,100,105,14912,14929,256,98,103,14917,14921,97,114,59,27231,101,256,59,113,5626,14927,59,25177,101,114,112,59,24856,114,59,49152,55349,56628,112,102,59,49152,55349,56680,256,59,101,5241,14950,97,116,232,5241,99,114,59,49152,55349,56524,2787,6030,14983,0,14987,0,14992,15003,0,0,15005,15016,15019,15023,0,0,15043,15054,0,15064,6108,6111,116,114,233,6097,114,59,49152,55349,56629,256,65,97,14996,14999,114,242,963,114,242,2550,59,17342,256,65,97,15009,15012,114,242,952,114,242,2539,97,240,10003,105,115,59,25339,384,100,112,116,6052,15029,15038,256,102,108,15034,6057,59,49152,55349,56681,105,109,229,6066,256,65,97,15047,15050,114,242,974,114,242,2561,256,99,113,15058,6072,114,59,49152,55349,56525,256,112,116,6102,15068,114,233,6100,1024,97,99,101,102,105,111,115,117,15088,15101,15112,15116,15121,15125,15131,15137,99,256,117,121,15094,15099,116,101,32827,253,16637,59,17487,256,105,121,15106,15110,114,99,59,16759,59,17483,110,32827,165,16549,114,59,49152,55349,56630,99,121,59,17495,112,102,59,49152,55349,56682,99,114,59,49152,55349,56526,256,99,109,15142,15145,121,59,17486,108,32827,255,16639,1280,97,99,100,101,102,104,105,111,115,119,15170,15176,15188,15192,15204,15209,15213,15220,15226,15232,99,117,116,101,59,16762,256,97,121,15181,15186,114,111,110,59,16766,59,17463,111,116,59,16764,256,101,116,15197,15201,116,114,230,5471,97,59,17334,114,59,49152,55349,56631,99,121,59,17462,103,114,97,114,114,59,25053,112,102,59,49152,55349,56683,99,114,59,49152,55349,56527,256,106,110,15237,15239,59,24589,106,59,24588]);var Ep=new Uint16Array([512,97,103,108,113,9,21,24,27,621,15,0,0,18,112,59,16422,111,115,59,16423,116,59,16446,116,59,16444,117,111,116,59,16418]);var N0,Z_=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),Rp=(N0=String.fromCodePoint)!==null&&N0!==void 0?N0:function(t){let e="";return t>65535&&(t-=65536,e+=String.fromCharCode(t>>>10&1023|55296),t=56320|t&1023),e+=String.fromCharCode(t),e};function Cp(t){var e;return t>=55296&&t<=57343||t>1114111?65533:(e=Z_.get(t))!==null&&e!==void 0?e:t}function B0(t){return Rp(Cp(t))}var sr;(function(t){t[t.NUM=35]="NUM",t[t.SEMI=59]="SEMI",t[t.ZERO=48]="ZERO",t[t.NINE=57]="NINE",t[t.LOWER_A=97]="LOWER_A",t[t.LOWER_F=102]="LOWER_F",t[t.LOWER_X=120]="LOWER_X",t[t.To_LOWER_BIT=32]="To_LOWER_BIT"})(sr||(sr={}));var ys;(function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"})(ys||(ys={}));function Ap(t){return function(r,i){let n="",o=0,a=0;for(;(a=r.indexOf("&",a))>=0;){if(n+=r.slice(o,a),o=a,a+=1,r.charCodeAt(a)===sr.NUM){let M=a+1,R=10,x=r.charCodeAt(M);(x|sr.To_LOWER_BIT)===sr.LOWER_X&&(R=16,a+=1,M+=1);do x=r.charCodeAt(++a);while(x>=sr.ZERO&&x<=sr.NINE||R===16&&(x|sr.To_LOWER_BIT)>=sr.LOWER_A&&(x|sr.To_LOWER_BIT)<=sr.LOWER_F);if(M!==a){let w=r.substring(M,a),E=parseInt(w,R);if(r.charCodeAt(a)===sr.SEMI)a+=1;else if(i)continue;n+=B0(E),o=a}continue}let h=0,d=1,m=0,p=t[m];for(;a<r.length&&(m=Y_(t,p,m+1,r.charCodeAt(a)),!(m<0));a++,d++){p=t[m];let M=p&ys.VALUE_LENGTH;if(M){(!i||r.charCodeAt(a)===sr.SEMI)&&(h=m,d=0);let R=(M>>14)-1;if(R===0)break;m+=R}}if(h!==0){let M=(t[h]&ys.VALUE_LENGTH)>>14;n+=M===1?String.fromCharCode(t[h]&~ys.VALUE_LENGTH):M===2?String.fromCharCode(t[h+1]):String.fromCharCode(t[h+1],t[h+2]),o=a-d+1}}return n+r.slice(o)}}function Y_(t,e,r,i){let n=(e&ys.BRANCH_LENGTH)>>7,o=e&ys.JUMP_TABLE;if(n===0)return o!==0&&i===o?r:-1;if(o){let d=i-o;return d<0||d>n?-1:t[r+d]-1}let a=r,h=a+n-1;for(;a<=h;){let d=a+h>>>1,m=t[d];if(m<i)a=d+1;else if(m>i)h=d-1;else return t[d+n]}return-1}var VA=Ap(Mp),KA=Ap(Ep);var X_=new Map([[34,"&quot;"],[38,"&amp;"],[39,"&apos;"],[60,"&lt;"],[62,"&gt;"]]),Q_=String.prototype.codePointAt!=null?(t,e)=>t.codePointAt(e):(t,e)=>(t.charCodeAt(e)&64512)===55296?(t.charCodeAt(e)-55296)*1024+t.charCodeAt(e+1)-56320+65536:t.charCodeAt(e);function D0(t,e){return function(i){let n,o=0,a="";for(;n=t.exec(i);)o!==n.index&&(a+=i.substring(o,n.index)),a+=e.get(n[0].charCodeAt(0)),o=n.index+1;return a+i.substring(o)}}var Gu=D0(/[&<>'"]/g,X_),Tp=D0(/["&\u00A0]/g,new Map([[34,"&quot;"],[38,"&amp;"],[160,"&nbsp;"]])),Ip=D0(/[&<>\u00A0]/g,new Map([[38,"&amp;"],[60,"&lt;"],[62,"&gt;"],[160,"&nbsp;"]]));var Pp;(function(t){t[t.XML=0]="XML",t[t.HTML=1]="HTML"})(Pp||(Pp={}));var Op;(function(t){t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict"})(Op||(Op={}));var kp;(function(t){t[t.UTF8=0]="UTF8",t[t.ASCII=1]="ASCII",t[t.Extensive=2]="Extensive",t[t.Attribute=3]="Attribute",t[t.Text=4]="Text"})(kp||(kp={}));var Vu=t=>" ".repeat(t),_1=class{toString(e=0){return Vu(e)+"[VNode]"}},bs=class extends _1{constructor(e){super(),this.text=e}toString(e=0){return Vu(e)+this.textContent}get textContent(){return Gu(this.text)}set textContent(e){this.text=e}},Vo=class extends _1{constructor(e,r,i){super(),this.tag=e,this.attrs=r,this.children=i}get textContent(){return this.children.length===0?"":this.children.length===1?this.children[0].textContent:this.children.map(e=>e.textContent).join("")}set textContent(e){this.children=[new bs(e)]}toString(e=0){let r=this.toStringAttrs(),i=Vu(e),n=this.toStringChildren(e),o=`${i}<${this.tag}${r}`;return n===""?`${o} />`:`${o}>${n}</${this.tag}>`}*tags(e){this.tag===e&&(yield this);for(let r of this.elementChildren())yield*r.tags(e);return null}find(e,...r){for(let i of this.tags(e)){if(i===this)continue;if(r.length===0)return i;let n=i.find(...r);if(n!=null)return n}return null}*elementChildren(){for(let e of this.children)e instanceof Vo&&(yield e);return null}toStringAttrs(){let e=Object.keys(this.attrs);if(e.length===0)return"";let r="";for(let i of e){let n=this.attrs[i];n!=null&&(r+=` ${i}="${n}"`)}return r}toStringChildren(e=0){if(this.children.length===0)return"";if(this.children.length===1){let r=this.children[0];if(r instanceof bs)return r.textContent}return`
138
+ `)}};var Wu,Sp={level:"debug"},Hu={get(){return Wu==null&&(Wu=process.stdout.isTTY?(0,L0.default)(Sp,_n.stream()):(0,L0.default)(Sp)),Wu},set(t){Wu=t},disable(){Hu.get().level="silent"}};var N0=de(yo(),1);var Mp=24*60*60*1e3,zA=30*Mp,X_=91*Mp;function Ep(t){if(t==null)return{valid:!1,message:"missing"};if(!t.startsWith("c")&&!t.startsWith("d"))return{valid:!1,message:"malformed"};let e=t.slice(1).toUpperCase();try{let r=(0,N0.decodeTime)(e);if(t.startsWith("d"))return{valid:!0,key:t};if(Date.now()-r>X_)return{valid:!1,message:"expired"}}catch{return{valid:!1,message:"malformed"}}return{valid:!0,key:t}}var Rp=new Uint16Array([7489,60,213,305,650,1181,1403,1488,1653,1758,1954,2006,2063,2634,2705,3489,3693,3849,3878,4298,4648,4833,5141,5277,5315,5343,5413,0,0,0,0,0,0,5483,5837,6541,7186,7645,8062,8288,8624,8845,9152,9211,9282,10276,10514,11528,11848,12238,12310,12986,13881,14252,14590,14888,14961,15072,15150,2048,69,77,97,98,99,102,103,108,109,110,111,112,114,115,116,117,92,98,102,109,115,127,132,139,144,149,152,166,179,185,200,207,108,105,103,32827,198,16582,80,32827,38,16422,99,117,116,101,32827,193,16577,114,101,118,101,59,16642,256,105,121,120,125,114,99,32827,194,16578,59,17424,114,59,49152,55349,56580,114,97,118,101,32827,192,16576,112,104,97,59,17297,97,99,114,59,16640,100,59,27219,256,103,112,157,161,111,110,59,16644,102,59,49152,55349,56632,112,108,121,70,117,110,99,116,105,111,110,59,24673,105,110,103,32827,197,16581,256,99,115,190,195,114,59,49152,55349,56476,105,103,110,59,25172,105,108,100,101,32827,195,16579,109,108,32827,196,16580,1024,97,99,101,102,111,114,115,117,229,251,254,279,284,290,295,298,256,99,114,234,242,107,115,108,97,115,104,59,25110,374,246,248,59,27367,101,100,59,25350,121,59,17425,384,99,114,116,261,267,276,97,117,115,101,59,25141,110,111,117,108,108,105,115,59,24876,97,59,17298,114,59,49152,55349,56581,112,102,59,49152,55349,56633,101,118,101,59,17112,99,242,275,109,112,101,113,59,25166,1792,72,79,97,99,100,101,102,104,105,108,111,114,115,117,333,337,342,384,414,418,437,439,442,476,533,627,632,638,99,121,59,17447,80,89,32827,169,16553,384,99,112,121,349,354,378,117,116,101,59,16646,256,59,105,359,360,25298,116,97,108,68,105,102,102,101,114,101,110,116,105,97,108,68,59,24901,108,101,121,115,59,24877,512,97,101,105,111,393,398,404,408,114,111,110,59,16652,100,105,108,32827,199,16583,114,99,59,16648,110,105,110,116,59,25136,111,116,59,16650,256,100,110,423,429,105,108,108,97,59,16568,116,101,114,68,111,116,59,16567,242,383,105,59,17319,114,99,108,101,512,68,77,80,84,455,459,465,470,111,116,59,25241,105,110,117,115,59,25238,108,117,115,59,25237,105,109,101,115,59,25239,111,256,99,115,482,504,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,25138,101,67,117,114,108,121,256,68,81,515,527,111,117,98,108,101,81,117,111,116,101,59,24605,117,111,116,101,59,24601,512,108,110,112,117,542,552,583,597,111,110,256,59,101,549,550,25143,59,27252,384,103,105,116,559,566,570,114,117,101,110,116,59,25185,110,116,59,25135,111,117,114,73,110,116,101,103,114,97,108,59,25134,256,102,114,588,590,59,24834,111,100,117,99,116,59,25104,110,116,101,114,67,108,111,99,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,25139,111,115,115,59,27183,99,114,59,49152,55349,56478,112,256,59,67,644,645,25299,97,112,59,25165,1408,68,74,83,90,97,99,101,102,105,111,115,672,684,688,692,696,715,727,737,742,819,1165,256,59,111,377,677,116,114,97,104,100,59,26897,99,121,59,17410,99,121,59,17413,99,121,59,17423,384,103,114,115,703,708,711,103,101,114,59,24609,114,59,24993,104,118,59,27364,256,97,121,720,725,114,111,110,59,16654,59,17428,108,256,59,116,733,734,25095,97,59,17300,114,59,49152,55349,56583,256,97,102,747,807,256,99,109,752,802,114,105,116,105,99,97,108,512,65,68,71,84,768,774,790,796,99,117,116,101,59,16564,111,372,779,781,59,17113,98,108,101,65,99,117,116,101,59,17117,114,97,118,101,59,16480,105,108,100,101,59,17116,111,110,100,59,25284,102,101,114,101,110,116,105,97,108,68,59,24902,1136,829,0,0,0,834,852,0,1029,102,59,49152,55349,56635,384,59,68,69,840,841,845,16552,111,116,59,24796,113,117,97,108,59,25168,98,108,101,768,67,68,76,82,85,86,867,882,898,975,994,1016,111,110,116,111,117,114,73,110,116,101,103,114,97,236,569,111,628,889,0,0,891,187,841,110,65,114,114,111,119,59,25043,256,101,111,903,932,102,116,384,65,82,84,912,918,929,114,114,111,119,59,25040,105,103,104,116,65,114,114,111,119,59,25044,101,229,714,110,103,256,76,82,939,964,101,102,116,256,65,82,947,953,114,114,111,119,59,26616,105,103,104,116,65,114,114,111,119,59,26618,105,103,104,116,65,114,114,111,119,59,26617,105,103,104,116,256,65,84,984,990,114,114,111,119,59,25042,101,101,59,25256,112,577,1001,0,0,1007,114,114,111,119,59,25041,111,119,110,65,114,114,111,119,59,25045,101,114,116,105,99,97,108,66,97,114,59,25125,110,768,65,66,76,82,84,97,1042,1066,1072,1118,1151,892,114,114,111,119,384,59,66,85,1053,1054,1058,24979,97,114,59,26899,112,65,114,114,111,119,59,25077,114,101,118,101,59,17169,101,102,116,722,1082,0,1094,0,1104,105,103,104,116,86,101,99,116,111,114,59,26960,101,101,86,101,99,116,111,114,59,26974,101,99,116,111,114,256,59,66,1113,1114,25021,97,114,59,26966,105,103,104,116,468,1127,0,1137,101,101,86,101,99,116,111,114,59,26975,101,99,116,111,114,256,59,66,1146,1147,25025,97,114,59,26967,101,101,256,59,65,1158,1159,25252,114,114,111,119,59,24999,256,99,116,1170,1175,114,59,49152,55349,56479,114,111,107,59,16656,2048,78,84,97,99,100,102,103,108,109,111,112,113,115,116,117,120,1213,1216,1220,1227,1246,1250,1255,1262,1269,1313,1327,1334,1362,1373,1376,1381,71,59,16714,72,32827,208,16592,99,117,116,101,32827,201,16585,384,97,105,121,1234,1239,1244,114,111,110,59,16666,114,99,32827,202,16586,59,17453,111,116,59,16662,114,59,49152,55349,56584,114,97,118,101,32827,200,16584,101,109,101,110,116,59,25096,256,97,112,1274,1278,99,114,59,16658,116,121,595,1286,0,0,1298,109,97,108,108,83,113,117,97,114,101,59,26107,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,26027,256,103,112,1318,1322,111,110,59,16664,102,59,49152,55349,56636,115,105,108,111,110,59,17301,117,256,97,105,1340,1353,108,256,59,84,1346,1347,27253,105,108,100,101,59,25154,108,105,98,114,105,117,109,59,25036,256,99,105,1367,1370,114,59,24880,109,59,27251,97,59,17303,109,108,32827,203,16587,256,105,112,1386,1391,115,116,115,59,25091,111,110,101,110,116,105,97,108,69,59,24903,640,99,102,105,111,115,1413,1416,1421,1458,1484,121,59,17444,114,59,49152,55349,56585,108,108,101,100,595,1431,0,0,1443,109,97,108,108,83,113,117,97,114,101,59,26108,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,26026,880,1466,0,1471,0,0,1476,102,59,49152,55349,56637,65,108,108,59,25088,114,105,101,114,116,114,102,59,24881,99,242,1483,1536,74,84,97,98,99,100,102,103,111,114,115,116,1512,1516,1519,1530,1536,1554,1558,1563,1565,1571,1644,1650,99,121,59,17411,32827,62,16446,109,109,97,256,59,100,1527,1528,17299,59,17372,114,101,118,101,59,16670,384,101,105,121,1543,1548,1552,100,105,108,59,16674,114,99,59,16668,59,17427,111,116,59,16672,114,59,49152,55349,56586,59,25305,112,102,59,49152,55349,56638,101,97,116,101,114,768,69,70,71,76,83,84,1589,1604,1614,1622,1627,1638,113,117,97,108,256,59,76,1598,1599,25189,101,115,115,59,25307,117,108,108,69,113,117,97,108,59,25191,114,101,97,116,101,114,59,27298,101,115,115,59,25207,108,97,110,116,69,113,117,97,108,59,27262,105,108,100,101,59,25203,99,114,59,49152,55349,56482,59,25195,1024,65,97,99,102,105,111,115,117,1669,1675,1686,1691,1694,1706,1726,1738,82,68,99,121,59,17450,256,99,116,1680,1684,101,107,59,17095,59,16478,105,114,99,59,16676,114,59,24844,108,98,101,114,116,83,112,97,99,101,59,24843,496,1711,0,1714,102,59,24845,105,122,111,110,116,97,108,76,105,110,101,59,25856,256,99,116,1731,1733,242,1705,114,111,107,59,16678,109,112,324,1744,1752,111,119,110,72,117,109,240,303,113,117,97,108,59,25167,1792,69,74,79,97,99,100,102,103,109,110,111,115,116,117,1786,1790,1795,1799,1806,1818,1822,1825,1832,1860,1912,1931,1935,1941,99,121,59,17429,108,105,103,59,16690,99,121,59,17409,99,117,116,101,32827,205,16589,256,105,121,1811,1816,114,99,32827,206,16590,59,17432,111,116,59,16688,114,59,24849,114,97,118,101,32827,204,16588,384,59,97,112,1824,1839,1855,256,99,103,1844,1847,114,59,16682,105,110,97,114,121,73,59,24904,108,105,101,243,989,500,1865,0,1890,256,59,101,1869,1870,25132,256,103,114,1875,1880,114,97,108,59,25131,115,101,99,116,105,111,110,59,25282,105,115,105,98,108,101,256,67,84,1900,1906,111,109,109,97,59,24675,105,109,101,115,59,24674,384,103,112,116,1919,1923,1928,111,110,59,16686,102,59,49152,55349,56640,97,59,17305,99,114,59,24848,105,108,100,101,59,16680,491,1946,0,1950,99,121,59,17414,108,32827,207,16591,640,99,102,111,115,117,1964,1975,1980,1986,2e3,256,105,121,1969,1973,114,99,59,16692,59,17433,114,59,49152,55349,56589,112,102,59,49152,55349,56641,483,1991,0,1996,114,59,49152,55349,56485,114,99,121,59,17416,107,99,121,59,17412,896,72,74,97,99,102,111,115,2020,2024,2028,2033,2045,2050,2056,99,121,59,17445,99,121,59,17420,112,112,97,59,17306,256,101,121,2038,2043,100,105,108,59,16694,59,17434,114,59,49152,55349,56590,112,102,59,49152,55349,56642,99,114,59,49152,55349,56486,1408,74,84,97,99,101,102,108,109,111,115,116,2085,2089,2092,2128,2147,2483,2488,2503,2509,2615,2631,99,121,59,17417,32827,60,16444,640,99,109,110,112,114,2103,2108,2113,2116,2125,117,116,101,59,16697,98,100,97,59,17307,103,59,26602,108,97,99,101,116,114,102,59,24850,114,59,24990,384,97,101,121,2135,2140,2145,114,111,110,59,16701,100,105,108,59,16699,59,17435,256,102,115,2152,2416,116,1280,65,67,68,70,82,84,85,86,97,114,2174,2217,2225,2272,2278,2300,2351,2395,912,2410,256,110,114,2179,2191,103,108,101,66,114,97,99,107,101,116,59,26600,114,111,119,384,59,66,82,2201,2202,2206,24976,97,114,59,25060,105,103,104,116,65,114,114,111,119,59,25030,101,105,108,105,110,103,59,25352,111,501,2231,0,2243,98,108,101,66,114,97,99,107,101,116,59,26598,110,468,2248,0,2258,101,101,86,101,99,116,111,114,59,26977,101,99,116,111,114,256,59,66,2267,2268,25027,97,114,59,26969,108,111,111,114,59,25354,105,103,104,116,256,65,86,2287,2293,114,114,111,119,59,24980,101,99,116,111,114,59,26958,256,101,114,2305,2327,101,384,59,65,86,2313,2314,2320,25251,114,114,111,119,59,24996,101,99,116,111,114,59,26970,105,97,110,103,108,101,384,59,66,69,2340,2341,2345,25266,97,114,59,27087,113,117,97,108,59,25268,112,384,68,84,86,2359,2370,2380,111,119,110,86,101,99,116,111,114,59,26961,101,101,86,101,99,116,111,114,59,26976,101,99,116,111,114,256,59,66,2390,2391,25023,97,114,59,26968,101,99,116,111,114,256,59,66,2405,2406,25020,97,114,59,26962,105,103,104,116,225,924,115,768,69,70,71,76,83,84,2430,2443,2453,2461,2466,2477,113,117,97,108,71,114,101,97,116,101,114,59,25306,117,108,108,69,113,117,97,108,59,25190,114,101,97,116,101,114,59,25206,101,115,115,59,27297,108,97,110,116,69,113,117,97,108,59,27261,105,108,100,101,59,25202,114,59,49152,55349,56591,256,59,101,2493,2494,25304,102,116,97,114,114,111,119,59,25050,105,100,111,116,59,16703,384,110,112,119,2516,2582,2587,103,512,76,82,108,114,2526,2551,2562,2576,101,102,116,256,65,82,2534,2540,114,114,111,119,59,26613,105,103,104,116,65,114,114,111,119,59,26615,105,103,104,116,65,114,114,111,119,59,26614,101,102,116,256,97,114,947,2570,105,103,104,116,225,959,105,103,104,116,225,970,102,59,49152,55349,56643,101,114,256,76,82,2594,2604,101,102,116,65,114,114,111,119,59,24985,105,103,104,116,65,114,114,111,119,59,24984,384,99,104,116,2622,2624,2626,242,2124,59,25008,114,111,107,59,16705,59,25194,1024,97,99,101,102,105,111,115,117,2650,2653,2656,2679,2684,2693,2699,2702,112,59,26885,121,59,17436,256,100,108,2661,2671,105,117,109,83,112,97,99,101,59,24671,108,105,110,116,114,102,59,24883,114,59,49152,55349,56592,110,117,115,80,108,117,115,59,25107,112,102,59,49152,55349,56644,99,242,2678,59,17308,1152,74,97,99,101,102,111,115,116,117,2723,2727,2733,2752,2836,2841,3473,3479,3486,99,121,59,17418,99,117,116,101,59,16707,384,97,101,121,2740,2745,2750,114,111,110,59,16711,100,105,108,59,16709,59,17437,384,103,115,119,2759,2800,2830,97,116,105,118,101,384,77,84,86,2771,2783,2792,101,100,105,117,109,83,112,97,99,101,59,24587,104,105,256,99,110,2790,2776,235,2777,101,114,121,84,104,105,238,2777,116,101,100,256,71,76,2808,2822,114,101,97,116,101,114,71,114,101,97,116,101,242,1651,101,115,115,76,101,115,243,2632,76,105,110,101,59,16394,114,59,49152,55349,56593,512,66,110,112,116,2850,2856,2871,2874,114,101,97,107,59,24672,66,114,101,97,107,105,110,103,83,112,97,99,101,59,16544,102,59,24853,1664,59,67,68,69,71,72,76,78,80,82,83,84,86,2901,2902,2922,2940,2977,3051,3076,3166,3204,3238,3288,3425,3461,27372,256,111,117,2907,2916,110,103,114,117,101,110,116,59,25186,112,67,97,112,59,25197,111,117,98,108,101,86,101,114,116,105,99,97,108,66,97,114,59,25126,384,108,113,120,2947,2954,2971,101,109,101,110,116,59,25097,117,97,108,256,59,84,2962,2963,25184,105,108,100,101,59,49152,8770,824,105,115,116,115,59,25092,114,101,97,116,101,114,896,59,69,70,71,76,83,84,2998,2999,3005,3017,3027,3032,3045,25199,113,117,97,108,59,25201,117,108,108,69,113,117,97,108,59,49152,8807,824,114,101,97,116,101,114,59,49152,8811,824,101,115,115,59,25209,108,97,110,116,69,113,117,97,108,59,49152,10878,824,105,108,100,101,59,25205,117,109,112,324,3058,3069,111,119,110,72,117,109,112,59,49152,8782,824,113,117,97,108,59,49152,8783,824,101,256,102,115,3082,3111,116,84,114,105,97,110,103,108,101,384,59,66,69,3098,3099,3105,25322,97,114,59,49152,10703,824,113,117,97,108,59,25324,115,768,59,69,71,76,83,84,3125,3126,3132,3140,3147,3160,25198,113,117,97,108,59,25200,114,101,97,116,101,114,59,25208,101,115,115,59,49152,8810,824,108,97,110,116,69,113,117,97,108,59,49152,10877,824,105,108,100,101,59,25204,101,115,116,101,100,256,71,76,3176,3193,114,101,97,116,101,114,71,114,101,97,116,101,114,59,49152,10914,824,101,115,115,76,101,115,115,59,49152,10913,824,114,101,99,101,100,101,115,384,59,69,83,3218,3219,3227,25216,113,117,97,108,59,49152,10927,824,108,97,110,116,69,113,117,97,108,59,25312,256,101,105,3243,3257,118,101,114,115,101,69,108,101,109,101,110,116,59,25100,103,104,116,84,114,105,97,110,103,108,101,384,59,66,69,3275,3276,3282,25323,97,114,59,49152,10704,824,113,117,97,108,59,25325,256,113,117,3293,3340,117,97,114,101,83,117,256,98,112,3304,3321,115,101,116,256,59,69,3312,3315,49152,8847,824,113,117,97,108,59,25314,101,114,115,101,116,256,59,69,3331,3334,49152,8848,824,113,117,97,108,59,25315,384,98,99,112,3347,3364,3406,115,101,116,256,59,69,3355,3358,49152,8834,8402,113,117,97,108,59,25224,99,101,101,100,115,512,59,69,83,84,3378,3379,3387,3398,25217,113,117,97,108,59,49152,10928,824,108,97,110,116,69,113,117,97,108,59,25313,105,108,100,101,59,49152,8831,824,101,114,115,101,116,256,59,69,3416,3419,49152,8835,8402,113,117,97,108,59,25225,105,108,100,101,512,59,69,70,84,3438,3439,3445,3455,25153,113,117,97,108,59,25156,117,108,108,69,113,117,97,108,59,25159,105,108,100,101,59,25161,101,114,116,105,99,97,108,66,97,114,59,25124,99,114,59,49152,55349,56489,105,108,100,101,32827,209,16593,59,17309,1792,69,97,99,100,102,103,109,111,112,114,115,116,117,118,3517,3522,3529,3541,3547,3552,3559,3580,3586,3616,3618,3634,3647,3652,108,105,103,59,16722,99,117,116,101,32827,211,16595,256,105,121,3534,3539,114,99,32827,212,16596,59,17438,98,108,97,99,59,16720,114,59,49152,55349,56594,114,97,118,101,32827,210,16594,384,97,101,105,3566,3570,3574,99,114,59,16716,103,97,59,17321,99,114,111,110,59,17311,112,102,59,49152,55349,56646,101,110,67,117,114,108,121,256,68,81,3598,3610,111,117,98,108,101,81,117,111,116,101,59,24604,117,111,116,101,59,24600,59,27220,256,99,108,3623,3628,114,59,49152,55349,56490,97,115,104,32827,216,16600,105,364,3639,3644,100,101,32827,213,16597,101,115,59,27191,109,108,32827,214,16598,101,114,256,66,80,3659,3680,256,97,114,3664,3667,114,59,24638,97,99,256,101,107,3674,3676,59,25566,101,116,59,25524,97,114,101,110,116,104,101,115,105,115,59,25564,1152,97,99,102,104,105,108,111,114,115,3711,3719,3722,3727,3730,3732,3741,3760,3836,114,116,105,97,108,68,59,25090,121,59,17439,114,59,49152,55349,56595,105,59,17318,59,17312,117,115,77,105,110,117,115,59,16561,256,105,112,3746,3757,110,99,97,114,101,112,108,97,110,229,1693,102,59,24857,512,59,101,105,111,3769,3770,3808,3812,27323,99,101,100,101,115,512,59,69,83,84,3784,3785,3791,3802,25210,113,117,97,108,59,27311,108,97,110,116,69,113,117,97,108,59,25212,105,108,100,101,59,25214,109,101,59,24627,256,100,112,3817,3822,117,99,116,59,25103,111,114,116,105,111,110,256,59,97,549,3833,108,59,25117,256,99,105,3841,3846,114,59,49152,55349,56491,59,17320,512,85,102,111,115,3857,3862,3867,3871,79,84,32827,34,16418,114,59,49152,55349,56596,112,102,59,24858,99,114,59,49152,55349,56492,1536,66,69,97,99,101,102,104,105,111,114,115,117,3902,3907,3911,3936,3955,4007,4010,4013,4246,4265,4276,4286,97,114,114,59,26896,71,32827,174,16558,384,99,110,114,3918,3923,3926,117,116,101,59,16724,103,59,26603,114,256,59,116,3932,3933,24992,108,59,26902,384,97,101,121,3943,3948,3953,114,111,110,59,16728,100,105,108,59,16726,59,17440,256,59,118,3960,3961,24860,101,114,115,101,256,69,85,3970,3993,256,108,113,3975,3982,101,109,101,110,116,59,25099,117,105,108,105,98,114,105,117,109,59,25035,112,69,113,117,105,108,105,98,114,105,117,109,59,26991,114,187,3961,111,59,17313,103,104,116,1024,65,67,68,70,84,85,86,97,4033,4075,4083,4130,4136,4187,4231,984,256,110,114,4038,4050,103,108,101,66,114,97,99,107,101,116,59,26601,114,111,119,384,59,66,76,4060,4061,4065,24978,97,114,59,25061,101,102,116,65,114,114,111,119,59,25028,101,105,108,105,110,103,59,25353,111,501,4089,0,4101,98,108,101,66,114,97,99,107,101,116,59,26599,110,468,4106,0,4116,101,101,86,101,99,116,111,114,59,26973,101,99,116,111,114,256,59,66,4125,4126,25026,97,114,59,26965,108,111,111,114,59,25355,256,101,114,4141,4163,101,384,59,65,86,4149,4150,4156,25250,114,114,111,119,59,24998,101,99,116,111,114,59,26971,105,97,110,103,108,101,384,59,66,69,4176,4177,4181,25267,97,114,59,27088,113,117,97,108,59,25269,112,384,68,84,86,4195,4206,4216,111,119,110,86,101,99,116,111,114,59,26959,101,101,86,101,99,116,111,114,59,26972,101,99,116,111,114,256,59,66,4226,4227,25022,97,114,59,26964,101,99,116,111,114,256,59,66,4241,4242,25024,97,114,59,26963,256,112,117,4251,4254,102,59,24861,110,100,73,109,112,108,105,101,115,59,26992,105,103,104,116,97,114,114,111,119,59,25051,256,99,104,4281,4284,114,59,24859,59,25009,108,101,68,101,108,97,121,101,100,59,27124,1664,72,79,97,99,102,104,105,109,111,113,115,116,117,4324,4337,4343,4349,4377,4382,4433,4438,4449,4455,4533,4539,4543,256,67,99,4329,4334,72,99,121,59,17449,121,59,17448,70,84,99,121,59,17452,99,117,116,101,59,16730,640,59,97,101,105,121,4360,4361,4366,4371,4375,27324,114,111,110,59,16736,100,105,108,59,16734,114,99,59,16732,59,17441,114,59,49152,55349,56598,111,114,116,512,68,76,82,85,4394,4404,4414,4425,111,119,110,65,114,114,111,119,187,1054,101,102,116,65,114,114,111,119,187,2202,105,103,104,116,65,114,114,111,119,187,4061,112,65,114,114,111,119,59,24977,103,109,97,59,17315,97,108,108,67,105,114,99,108,101,59,25112,112,102,59,49152,55349,56650,626,4461,0,0,4464,116,59,25114,97,114,101,512,59,73,83,85,4475,4476,4489,4527,26017,110,116,101,114,115,101,99,116,105,111,110,59,25235,117,256,98,112,4495,4510,115,101,116,256,59,69,4503,4504,25231,113,117,97,108,59,25233,101,114,115,101,116,256,59,69,4520,4521,25232,113,117,97,108,59,25234,110,105,111,110,59,25236,99,114,59,49152,55349,56494,97,114,59,25286,512,98,99,109,112,4552,4571,4617,4619,256,59,115,4557,4558,25296,101,116,256,59,69,4557,4565,113,117,97,108,59,25222,256,99,104,4576,4613,101,101,100,115,512,59,69,83,84,4589,4590,4596,4607,25211,113,117,97,108,59,27312,108,97,110,116,69,113,117,97,108,59,25213,105,108,100,101,59,25215,84,104,225,3980,59,25105,384,59,101,115,4626,4627,4643,25297,114,115,101,116,256,59,69,4636,4637,25219,113,117,97,108,59,25223,101,116,187,4627,1408,72,82,83,97,99,102,104,105,111,114,115,4670,4676,4681,4693,4702,4721,4726,4767,4802,4808,4817,79,82,78,32827,222,16606,65,68,69,59,24866,256,72,99,4686,4690,99,121,59,17419,121,59,17446,256,98,117,4698,4700,59,16393,59,17316,384,97,101,121,4709,4714,4719,114,111,110,59,16740,100,105,108,59,16738,59,17442,114,59,49152,55349,56599,256,101,105,4731,4745,498,4736,0,4743,101,102,111,114,101,59,25140,97,59,17304,256,99,110,4750,4760,107,83,112,97,99,101,59,49152,8287,8202,83,112,97,99,101,59,24585,108,100,101,512,59,69,70,84,4779,4780,4786,4796,25148,113,117,97,108,59,25155,117,108,108,69,113,117,97,108,59,25157,105,108,100,101,59,25160,112,102,59,49152,55349,56651,105,112,108,101,68,111,116,59,24795,256,99,116,4822,4827,114,59,49152,55349,56495,114,111,107,59,16742,2785,4855,4878,4890,4902,0,4908,4913,0,0,0,0,0,4920,4925,4983,4997,0,5119,5124,5130,5136,256,99,114,4859,4865,117,116,101,32827,218,16602,114,256,59,111,4871,4872,24991,99,105,114,59,26953,114,483,4883,0,4886,121,59,17422,118,101,59,16748,256,105,121,4894,4899,114,99,32827,219,16603,59,17443,98,108,97,99,59,16752,114,59,49152,55349,56600,114,97,118,101,32827,217,16601,97,99,114,59,16746,256,100,105,4929,4969,101,114,256,66,80,4936,4957,256,97,114,4941,4944,114,59,16479,97,99,256,101,107,4951,4953,59,25567,101,116,59,25525,97,114,101,110,116,104,101,115,105,115,59,25565,111,110,256,59,80,4976,4977,25283,108,117,115,59,25230,256,103,112,4987,4991,111,110,59,16754,102,59,49152,55349,56652,1024,65,68,69,84,97,100,112,115,5013,5038,5048,5060,1e3,5074,5079,5107,114,114,111,119,384,59,66,68,4432,5024,5028,97,114,59,26898,111,119,110,65,114,114,111,119,59,25029,111,119,110,65,114,114,111,119,59,24981,113,117,105,108,105,98,114,105,117,109,59,26990,101,101,256,59,65,5067,5068,25253,114,114,111,119,59,24997,111,119,110,225,1011,101,114,256,76,82,5086,5096,101,102,116,65,114,114,111,119,59,24982,105,103,104,116,65,114,114,111,119,59,24983,105,256,59,108,5113,5114,17362,111,110,59,17317,105,110,103,59,16750,99,114,59,49152,55349,56496,105,108,100,101,59,16744,109,108,32827,220,16604,1152,68,98,99,100,101,102,111,115,118,5159,5164,5168,5171,5182,5253,5258,5264,5270,97,115,104,59,25259,97,114,59,27371,121,59,17426,97,115,104,256,59,108,5179,5180,25257,59,27366,256,101,114,5187,5189,59,25281,384,98,116,121,5196,5200,5242,97,114,59,24598,256,59,105,5199,5205,99,97,108,512,66,76,83,84,5217,5221,5226,5236,97,114,59,25123,105,110,101,59,16508,101,112,97,114,97,116,111,114,59,26456,105,108,100,101,59,25152,84,104,105,110,83,112,97,99,101,59,24586,114,59,49152,55349,56601,112,102,59,49152,55349,56653,99,114,59,49152,55349,56497,100,97,115,104,59,25258,640,99,101,102,111,115,5287,5292,5297,5302,5308,105,114,99,59,16756,100,103,101,59,25280,114,59,49152,55349,56602,112,102,59,49152,55349,56654,99,114,59,49152,55349,56498,512,102,105,111,115,5323,5328,5330,5336,114,59,49152,55349,56603,59,17310,112,102,59,49152,55349,56655,99,114,59,49152,55349,56499,1152,65,73,85,97,99,102,111,115,117,5361,5365,5369,5373,5380,5391,5396,5402,5408,99,121,59,17455,99,121,59,17415,99,121,59,17454,99,117,116,101,32827,221,16605,256,105,121,5385,5389,114,99,59,16758,59,17451,114,59,49152,55349,56604,112,102,59,49152,55349,56656,99,114,59,49152,55349,56500,109,108,59,16760,1024,72,97,99,100,101,102,111,115,5429,5433,5439,5451,5455,5469,5472,5476,99,121,59,17430,99,117,116,101,59,16761,256,97,121,5444,5449,114,111,110,59,16765,59,17431,111,116,59,16763,498,5460,0,5467,111,87,105,100,116,232,2777,97,59,17302,114,59,24872,112,102,59,24868,99,114,59,49152,55349,56501,3041,5507,5514,5520,0,5552,5558,5567,0,0,0,0,5574,5595,5611,5727,5741,0,5781,5787,5810,5817,0,5822,99,117,116,101,32827,225,16609,114,101,118,101,59,16643,768,59,69,100,105,117,121,5532,5533,5537,5539,5544,5549,25150,59,49152,8766,819,59,25151,114,99,32827,226,16610,116,101,32955,180,774,59,17456,108,105,103,32827,230,16614,256,59,114,178,5562,59,49152,55349,56606,114,97,118,101,32827,224,16608,256,101,112,5578,5590,256,102,112,5583,5588,115,121,109,59,24885,232,5587,104,97,59,17329,256,97,112,5599,99,256,99,108,5604,5607,114,59,16641,103,59,27199,612,5616,0,0,5642,640,59,97,100,115,118,5626,5627,5631,5633,5639,25127,110,100,59,27221,59,27228,108,111,112,101,59,27224,59,27226,896,59,101,108,109,114,115,122,5656,5657,5659,5662,5695,5711,5721,25120,59,27044,101,187,5657,115,100,256,59,97,5669,5670,25121,1121,5680,5682,5684,5686,5688,5690,5692,5694,59,27048,59,27049,59,27050,59,27051,59,27052,59,27053,59,27054,59,27055,116,256,59,118,5701,5702,25119,98,256,59,100,5708,5709,25278,59,27037,256,112,116,5716,5719,104,59,25122,187,185,97,114,114,59,25468,256,103,112,5731,5735,111,110,59,16645,102,59,49152,55349,56658,896,59,69,97,101,105,111,112,4801,5755,5757,5762,5764,5767,5770,59,27248,99,105,114,59,27247,59,25162,100,59,25163,115,59,16423,114,111,120,256,59,101,4801,5778,241,5763,105,110,103,32827,229,16613,384,99,116,121,5793,5798,5800,114,59,49152,55349,56502,59,16426,109,112,256,59,101,4801,5807,241,648,105,108,100,101,32827,227,16611,109,108,32827,228,16612,256,99,105,5826,5832,111,110,105,110,244,626,110,116,59,27153,2048,78,97,98,99,100,101,102,105,107,108,110,111,112,114,115,117,5869,5873,5936,5948,5955,5960,6008,6013,6112,6118,6201,6224,5901,6461,6472,6512,111,116,59,27373,256,99,114,5878,5918,107,512,99,101,112,115,5888,5893,5901,5907,111,110,103,59,25164,112,115,105,108,111,110,59,17398,114,105,109,101,59,24629,105,109,256,59,101,5914,5915,25149,113,59,25293,374,5922,5926,101,101,59,25277,101,100,256,59,103,5932,5933,25349,101,187,5933,114,107,256,59,116,4956,5943,98,114,107,59,25526,256,111,121,5889,5953,59,17457,113,117,111,59,24606,640,99,109,112,114,116,5971,5979,5985,5988,5992,97,117,115,256,59,101,266,265,112,116,121,118,59,27056,115,233,5900,110,111,245,275,384,97,104,119,5999,6001,6003,59,17330,59,24886,101,101,110,59,25196,114,59,49152,55349,56607,103,896,99,111,115,116,117,118,119,6029,6045,6067,6081,6101,6107,6110,384,97,105,117,6036,6038,6042,240,1888,114,99,59,26095,112,187,4977,384,100,112,116,6052,6056,6061,111,116,59,27136,108,117,115,59,27137,105,109,101,115,59,27138,625,6073,0,0,6078,99,117,112,59,27142,97,114,59,26117,114,105,97,110,103,108,101,256,100,117,6093,6098,111,119,110,59,26045,112,59,26035,112,108,117,115,59,27140,101,229,5188,229,5293,97,114,111,119,59,26893,384,97,107,111,6125,6182,6197,256,99,110,6130,6179,107,384,108,115,116,6138,1451,6146,111,122,101,110,103,101,59,27115,114,105,97,110,103,108,101,512,59,100,108,114,6162,6163,6168,6173,26036,111,119,110,59,26046,101,102,116,59,26050,105,103,104,116,59,26040,107,59,25635,433,6187,0,6195,434,6191,0,6193,59,26002,59,26001,52,59,26003,99,107,59,25992,256,101,111,6206,6221,256,59,113,6211,6214,49152,61,8421,117,105,118,59,49152,8801,8421,116,59,25360,512,112,116,119,120,6233,6238,6247,6252,102,59,49152,55349,56659,256,59,116,5067,6243,111,109,187,5068,116,105,101,59,25288,1536,68,72,85,86,98,100,104,109,112,116,117,118,6277,6294,6314,6331,6359,6363,6380,6399,6405,6410,6416,6433,512,76,82,108,114,6286,6288,6290,6292,59,25943,59,25940,59,25942,59,25939,640,59,68,85,100,117,6305,6306,6308,6310,6312,25936,59,25958,59,25961,59,25956,59,25959,512,76,82,108,114,6323,6325,6327,6329,59,25949,59,25946,59,25948,59,25945,896,59,72,76,82,104,108,114,6346,6347,6349,6351,6353,6355,6357,25937,59,25964,59,25955,59,25952,59,25963,59,25954,59,25951,111,120,59,27081,512,76,82,108,114,6372,6374,6376,6378,59,25941,59,25938,59,25872,59,25868,640,59,68,85,100,117,1725,6391,6393,6395,6397,59,25957,59,25960,59,25900,59,25908,105,110,117,115,59,25247,108,117,115,59,25246,105,109,101,115,59,25248,512,76,82,108,114,6425,6427,6429,6431,59,25947,59,25944,59,25880,59,25876,896,59,72,76,82,104,108,114,6448,6449,6451,6453,6455,6457,6459,25858,59,25962,59,25953,59,25950,59,25916,59,25892,59,25884,256,101,118,291,6466,98,97,114,32827,166,16550,512,99,101,105,111,6481,6486,6490,6496,114,59,49152,55349,56503,109,105,59,24655,109,256,59,101,5914,5916,108,384,59,98,104,6504,6505,6507,16476,59,27077,115,117,98,59,26568,364,6516,6526,108,256,59,101,6521,6522,24610,116,187,6522,112,384,59,69,101,303,6533,6535,59,27310,256,59,113,1756,1755,3297,6567,0,6632,6673,6677,6706,0,6711,6736,0,0,6836,0,0,6849,0,0,6945,6958,6989,6994,0,7165,0,7180,384,99,112,114,6573,6578,6621,117,116,101,59,16647,768,59,97,98,99,100,115,6591,6592,6596,6602,6613,6617,25129,110,100,59,27204,114,99,117,112,59,27209,256,97,117,6607,6610,112,59,27211,112,59,27207,111,116,59,27200,59,49152,8745,65024,256,101,111,6626,6629,116,59,24641,238,1683,512,97,101,105,117,6640,6651,6657,6661,496,6645,0,6648,115,59,27213,111,110,59,16653,100,105,108,32827,231,16615,114,99,59,16649,112,115,256,59,115,6668,6669,27212,109,59,27216,111,116,59,16651,384,100,109,110,6683,6688,6694,105,108,32955,184,429,112,116,121,118,59,27058,116,33024,162,59,101,6701,6702,16546,114,228,434,114,59,49152,55349,56608,384,99,101,105,6717,6720,6733,121,59,17479,99,107,256,59,109,6727,6728,26387,97,114,107,187,6728,59,17351,114,896,59,69,99,101,102,109,115,6751,6752,6754,6763,6820,6826,6830,26059,59,27075,384,59,101,108,6761,6762,6765,17094,113,59,25175,101,609,6772,0,0,6792,114,114,111,119,256,108,114,6780,6785,101,102,116,59,25018,105,103,104,116,59,25019,640,82,83,97,99,100,6802,6804,6806,6810,6815,187,3911,59,25800,115,116,59,25243,105,114,99,59,25242,97,115,104,59,25245,110,105,110,116,59,27152,105,100,59,27375,99,105,114,59,27074,117,98,115,256,59,117,6843,6844,26211,105,116,187,6844,748,6855,6868,6906,0,6922,111,110,256,59,101,6861,6862,16442,256,59,113,199,198,621,6873,0,0,6882,97,256,59,116,6878,6879,16428,59,16448,384,59,102,108,6888,6889,6891,25089,238,4448,101,256,109,120,6897,6902,101,110,116,187,6889,101,243,589,487,6910,0,6919,256,59,100,4795,6914,111,116,59,27245,110,244,582,384,102,114,121,6928,6932,6935,59,49152,55349,56660,111,228,596,33024,169,59,115,341,6941,114,59,24855,256,97,111,6949,6953,114,114,59,25013,115,115,59,26391,256,99,117,6962,6967,114,59,49152,55349,56504,256,98,112,6972,6980,256,59,101,6977,6978,27343,59,27345,256,59,101,6985,6986,27344,59,27346,100,111,116,59,25327,896,100,101,108,112,114,118,119,7008,7020,7031,7042,7084,7124,7161,97,114,114,256,108,114,7016,7018,59,26936,59,26933,624,7026,0,0,7029,114,59,25310,99,59,25311,97,114,114,256,59,112,7039,7040,25014,59,26941,768,59,98,99,100,111,115,7055,7056,7062,7073,7077,7080,25130,114,99,97,112,59,27208,256,97,117,7067,7070,112,59,27206,112,59,27210,111,116,59,25229,114,59,27205,59,49152,8746,65024,512,97,108,114,118,7093,7103,7134,7139,114,114,256,59,109,7100,7101,25015,59,26940,121,384,101,118,119,7111,7124,7128,113,624,7118,0,0,7122,114,101,227,7027,117,227,7029,101,101,59,25294,101,100,103,101,59,25295,101,110,32827,164,16548,101,97,114,114,111,119,256,108,114,7150,7155,101,102,116,187,7040,105,103,104,116,187,7101,101,228,7133,256,99,105,7169,7175,111,110,105,110,244,503,110,116,59,25137,108,99,116,121,59,25389,2432,65,72,97,98,99,100,101,102,104,105,106,108,111,114,115,116,117,119,122,7224,7227,7231,7261,7273,7285,7306,7326,7340,7351,7419,7423,7437,7547,7569,7595,7611,7622,7629,114,242,897,97,114,59,26981,512,103,108,114,115,7240,7245,7250,7252,103,101,114,59,24608,101,116,104,59,24888,242,4403,104,256,59,118,7258,7259,24592,187,2314,363,7265,7271,97,114,111,119,59,26895,97,227,789,256,97,121,7278,7283,114,111,110,59,16655,59,17460,384,59,97,111,818,7292,7300,256,103,114,703,7297,114,59,25034,116,115,101,113,59,27255,384,103,108,109,7313,7316,7320,32827,176,16560,116,97,59,17332,112,116,121,118,59,27057,256,105,114,7331,7336,115,104,116,59,27007,59,49152,55349,56609,97,114,256,108,114,7347,7349,187,2268,187,4126,640,97,101,103,115,118,7362,888,7382,7388,7392,109,384,59,111,115,806,7370,7380,110,100,256,59,115,806,7377,117,105,116,59,26214,97,109,109,97,59,17373,105,110,59,25330,384,59,105,111,7399,7400,7416,16631,100,101,33024,247,59,111,7399,7408,110,116,105,109,101,115,59,25287,110,248,7415,99,121,59,17490,99,623,7430,0,0,7434,114,110,59,25374,111,112,59,25357,640,108,112,116,117,119,7448,7453,7458,7497,7509,108,97,114,59,16420,102,59,49152,55349,56661,640,59,101,109,112,115,779,7469,7479,7485,7490,113,256,59,100,850,7475,111,116,59,25169,105,110,117,115,59,25144,108,117,115,59,25108,113,117,97,114,101,59,25249,98,108,101,98,97,114,119,101,100,103,229,250,110,384,97,100,104,4398,7517,7527,111,119,110,97,114,114,111,119,243,7299,97,114,112,111,111,110,256,108,114,7538,7542,101,102,244,7348,105,103,104,244,7350,354,7551,7557,107,97,114,111,247,3906,623,7562,0,0,7566,114,110,59,25375,111,112,59,25356,384,99,111,116,7576,7587,7590,256,114,121,7581,7585,59,49152,55349,56505,59,17493,108,59,27126,114,111,107,59,16657,256,100,114,7600,7604,111,116,59,25329,105,256,59,102,7610,6166,26047,256,97,104,7616,7619,114,242,1065,97,242,4006,97,110,103,108,101,59,27046,256,99,105,7634,7637,121,59,17503,103,114,97,114,114,59,26623,2304,68,97,99,100,101,102,103,108,109,110,111,112,113,114,115,116,117,120,7681,7689,7705,7736,1400,7740,7753,7777,7806,7845,7855,7869,7905,7978,7991,8004,8014,8026,256,68,111,7686,7476,111,244,7305,256,99,115,7694,7700,117,116,101,32827,233,16617,116,101,114,59,27246,512,97,105,111,121,7714,7719,7729,7734,114,111,110,59,16667,114,256,59,99,7725,7726,25174,32827,234,16618,108,111,110,59,25173,59,17485,111,116,59,16663,256,68,114,7745,7749,111,116,59,25170,59,49152,55349,56610,384,59,114,115,7760,7761,7767,27290,97,118,101,32827,232,16616,256,59,100,7772,7773,27286,111,116,59,27288,512,59,105,108,115,7786,7787,7794,7796,27289,110,116,101,114,115,59,25575,59,24851,256,59,100,7801,7802,27285,111,116,59,27287,384,97,112,115,7813,7817,7831,99,114,59,16659,116,121,384,59,115,118,7826,7827,7829,25093,101,116,187,7827,112,256,49,59,7837,7844,307,7841,7843,59,24580,59,24581,24579,256,103,115,7850,7852,59,16715,112,59,24578,256,103,112,7860,7864,111,110,59,16665,102,59,49152,55349,56662,384,97,108,115,7876,7886,7890,114,256,59,115,7882,7883,25301,108,59,27107,117,115,59,27249,105,384,59,108,118,7898,7899,7903,17333,111,110,187,7899,59,17397,512,99,115,117,118,7914,7923,7947,7971,256,105,111,7919,7729,114,99,187,7726,617,7929,0,0,7931,237,1352,97,110,116,256,103,108,7938,7942,116,114,187,7773,101,115,115,187,7802,384,97,101,105,7954,7958,7962,108,115,59,16445,115,116,59,25183,118,256,59,68,565,7968,68,59,27256,112,97,114,115,108,59,27109,256,68,97,7983,7987,111,116,59,25171,114,114,59,26993,384,99,100,105,7998,8001,7928,114,59,24879,111,244,850,256,97,104,8009,8011,59,17335,32827,240,16624,256,109,114,8019,8023,108,32827,235,16619,111,59,24748,384,99,105,112,8033,8036,8039,108,59,16417,115,244,1390,256,101,111,8044,8052,99,116,97,116,105,111,238,1369,110,101,110,116,105,97,108,229,1401,2529,8082,0,8094,0,8097,8103,0,0,8134,8140,0,8147,0,8166,8170,8192,0,8200,8282,108,108,105,110,103,100,111,116,115,101,241,7748,121,59,17476,109,97,108,101,59,26176,384,105,108,114,8109,8115,8129,108,105,103,59,32768,64259,617,8121,0,0,8125,103,59,32768,64256,105,103,59,32768,64260,59,49152,55349,56611,108,105,103,59,32768,64257,108,105,103,59,49152,102,106,384,97,108,116,8153,8156,8161,116,59,26221,105,103,59,32768,64258,110,115,59,26033,111,102,59,16786,496,8174,0,8179,102,59,49152,55349,56663,256,97,107,1471,8183,256,59,118,8188,8189,25300,59,27353,97,114,116,105,110,116,59,27149,256,97,111,8204,8277,256,99,115,8209,8274,945,8218,8240,8248,8261,8264,0,8272,946,8226,8229,8231,8234,8236,0,8238,32827,189,16573,59,24915,32827,188,16572,59,24917,59,24921,59,24923,435,8244,0,8246,59,24916,59,24918,692,8254,8257,0,0,8259,32827,190,16574,59,24919,59,24924,53,59,24920,438,8268,0,8270,59,24922,59,24925,56,59,24926,108,59,24644,119,110,59,25378,99,114,59,49152,55349,56507,2176,69,97,98,99,100,101,102,103,105,106,108,110,111,114,115,116,118,8322,8329,8351,8357,8368,8372,8432,8437,8442,8447,8451,8466,8504,791,8510,8530,8606,256,59,108,1613,8327,59,27276,384,99,109,112,8336,8341,8349,117,116,101,59,16885,109,97,256,59,100,8348,7386,17331,59,27270,114,101,118,101,59,16671,256,105,121,8362,8366,114,99,59,16669,59,17459,111,116,59,16673,512,59,108,113,115,1598,1602,8381,8393,384,59,113,115,1598,1612,8388,108,97,110,244,1637,512,59,99,100,108,1637,8402,8405,8421,99,59,27305,111,116,256,59,111,8412,8413,27264,256,59,108,8418,8419,27266,59,27268,256,59,101,8426,8429,49152,8923,65024,115,59,27284,114,59,49152,55349,56612,256,59,103,1651,1563,109,101,108,59,24887,99,121,59,17491,512,59,69,97,106,1626,8460,8462,8464,59,27282,59,27301,59,27300,512,69,97,101,115,8475,8477,8489,8500,59,25193,112,256,59,112,8483,8484,27274,114,111,120,187,8484,256,59,113,8494,8495,27272,256,59,113,8494,8475,105,109,59,25319,112,102,59,49152,55349,56664,256,99,105,8515,8518,114,59,24842,109,384,59,101,108,1643,8526,8528,59,27278,59,27280,33536,62,59,99,100,108,113,114,1518,8544,8554,8558,8563,8569,256,99,105,8549,8551,59,27303,114,59,27258,111,116,59,25303,80,97,114,59,27029,117,101,115,116,59,27260,640,97,100,101,108,115,8580,8554,8592,1622,8603,496,8585,0,8590,112,114,111,248,8350,114,59,27e3,113,256,108,113,1599,8598,108,101,115,243,8328,105,237,1643,256,101,110,8611,8621,114,116,110,101,113,113,59,49152,8809,65024,197,8618,1280,65,97,98,99,101,102,107,111,115,121,8644,8647,8689,8693,8698,8728,8733,8751,8808,8829,114,242,928,512,105,108,109,114,8656,8660,8663,8667,114,115,240,5252,102,187,8228,105,108,244,1705,256,100,114,8672,8676,99,121,59,17482,384,59,99,119,2292,8683,8687,105,114,59,26952,59,25005,97,114,59,24847,105,114,99,59,16677,384,97,108,114,8705,8718,8723,114,116,115,256,59,117,8713,8714,26213,105,116,187,8714,108,105,112,59,24614,99,111,110,59,25273,114,59,49152,55349,56613,115,256,101,119,8739,8745,97,114,111,119,59,26917,97,114,111,119,59,26918,640,97,109,111,112,114,8762,8766,8771,8798,8803,114,114,59,25087,116,104,116,59,25147,107,256,108,114,8777,8787,101,102,116,97,114,114,111,119,59,25001,105,103,104,116,97,114,114,111,119,59,25002,102,59,49152,55349,56665,98,97,114,59,24597,384,99,108,116,8815,8820,8824,114,59,49152,55349,56509,97,115,232,8692,114,111,107,59,16679,256,98,112,8834,8839,117,108,108,59,24643,104,101,110,187,7259,2785,8867,0,8874,0,8888,8901,8910,0,8917,8947,0,0,8952,8994,9063,9058,9087,0,9094,9130,9140,99,117,116,101,32827,237,16621,384,59,105,121,1905,8880,8885,114,99,32827,238,16622,59,17464,256,99,120,8892,8895,121,59,17461,99,108,32827,161,16545,256,102,114,927,8905,59,49152,55349,56614,114,97,118,101,32827,236,16620,512,59,105,110,111,1854,8925,8937,8942,256,105,110,8930,8934,110,116,59,27148,116,59,25133,102,105,110,59,27100,116,97,59,24873,108,105,103,59,16691,384,97,111,112,8958,8986,8989,384,99,103,116,8965,8968,8983,114,59,16683,384,101,108,112,1823,8975,8979,105,110,229,1934,97,114,244,1824,104,59,16689,102,59,25271,101,100,59,16821,640,59,99,102,111,116,1268,9004,9009,9021,9025,97,114,101,59,24837,105,110,256,59,116,9016,9017,25118,105,101,59,27101,100,111,244,8985,640,59,99,101,108,112,1879,9036,9040,9051,9057,97,108,59,25274,256,103,114,9045,9049,101,114,243,5475,227,9037,97,114,104,107,59,27159,114,111,100,59,27196,512,99,103,112,116,9071,9074,9078,9083,121,59,17489,111,110,59,16687,102,59,49152,55349,56666,97,59,17337,117,101,115,116,32827,191,16575,256,99,105,9098,9103,114,59,49152,55349,56510,110,640,59,69,100,115,118,1268,9115,9117,9121,1267,59,25337,111,116,59,25333,256,59,118,9126,9127,25332,59,25331,256,59,105,1911,9134,108,100,101,59,16681,491,9144,0,9148,99,121,59,17494,108,32827,239,16623,768,99,102,109,111,115,117,9164,9175,9180,9185,9191,9205,256,105,121,9169,9173,114,99,59,16693,59,17465,114,59,49152,55349,56615,97,116,104,59,16951,112,102,59,49152,55349,56667,483,9196,0,9201,114,59,49152,55349,56511,114,99,121,59,17496,107,99,121,59,17492,1024,97,99,102,103,104,106,111,115,9227,9238,9250,9255,9261,9265,9269,9275,112,112,97,256,59,118,9235,9236,17338,59,17392,256,101,121,9243,9248,100,105,108,59,16695,59,17466,114,59,49152,55349,56616,114,101,101,110,59,16696,99,121,59,17477,99,121,59,17500,112,102,59,49152,55349,56668,99,114,59,49152,55349,56512,2944,65,66,69,72,97,98,99,100,101,102,103,104,106,108,109,110,111,112,114,115,116,117,118,9328,9345,9350,9357,9361,9486,9533,9562,9600,9806,9822,9829,9849,9853,9882,9906,9944,10077,10088,10123,10176,10241,10258,384,97,114,116,9335,9338,9340,114,242,2502,242,917,97,105,108,59,26907,97,114,114,59,26894,256,59,103,2452,9355,59,27275,97,114,59,26978,2403,9381,0,9386,0,9393,0,0,0,0,0,9397,9402,0,9414,9416,9421,0,9465,117,116,101,59,16698,109,112,116,121,118,59,27060,114,97,238,2124,98,100,97,59,17339,103,384,59,100,108,2190,9409,9411,59,27025,229,2190,59,27269,117,111,32827,171,16555,114,1024,59,98,102,104,108,112,115,116,2201,9438,9446,9449,9451,9454,9457,9461,256,59,102,2205,9443,115,59,26911,115,59,26909,235,8786,112,59,25003,108,59,26937,105,109,59,26995,108,59,24994,384,59,97,101,9471,9472,9476,27307,105,108,59,26905,256,59,115,9481,9482,27309,59,49152,10925,65024,384,97,98,114,9493,9497,9501,114,114,59,26892,114,107,59,26482,256,97,107,9506,9516,99,256,101,107,9512,9514,59,16507,59,16475,256,101,115,9521,9523,59,27019,108,256,100,117,9529,9531,59,27023,59,27021,512,97,101,117,121,9542,9547,9558,9560,114,111,110,59,16702,256,100,105,9552,9556,105,108,59,16700,236,2224,226,9513,59,17467,512,99,113,114,115,9571,9574,9581,9597,97,59,26934,117,111,256,59,114,3609,5958,256,100,117,9586,9591,104,97,114,59,26983,115,104,97,114,59,26955,104,59,25010,640,59,102,103,113,115,9611,9612,2441,9715,9727,25188,116,640,97,104,108,114,116,9624,9636,9655,9666,9704,114,114,111,119,256,59,116,2201,9633,97,233,9462,97,114,112,111,111,110,256,100,117,9647,9652,111,119,110,187,1114,112,187,2406,101,102,116,97,114,114,111,119,115,59,25031,105,103,104,116,384,97,104,115,9677,9686,9694,114,114,111,119,256,59,115,2292,2215,97,114,112,111,111,110,243,3992,113,117,105,103,97,114,114,111,247,8688,104,114,101,101,116,105,109,101,115,59,25291,384,59,113,115,9611,2451,9722,108,97,110,244,2476,640,59,99,100,103,115,2476,9738,9741,9757,9768,99,59,27304,111,116,256,59,111,9748,9749,27263,256,59,114,9754,9755,27265,59,27267,256,59,101,9762,9765,49152,8922,65024,115,59,27283,640,97,100,101,103,115,9779,9785,9789,9801,9803,112,112,114,111,248,9414,111,116,59,25302,113,256,103,113,9795,9797,244,2441,103,116,242,9356,244,2459,105,237,2482,384,105,108,114,9813,2273,9818,115,104,116,59,27004,59,49152,55349,56617,256,59,69,2460,9827,59,27281,353,9833,9846,114,256,100,117,9650,9838,256,59,108,2405,9843,59,26986,108,107,59,25988,99,121,59,17497,640,59,97,99,104,116,2632,9864,9867,9873,9878,114,242,9665,111,114,110,101,242,7432,97,114,100,59,26987,114,105,59,26106,256,105,111,9887,9892,100,111,116,59,16704,117,115,116,256,59,97,9900,9901,25520,99,104,101,187,9901,512,69,97,101,115,9915,9917,9929,9940,59,25192,112,256,59,112,9923,9924,27273,114,111,120,187,9924,256,59,113,9934,9935,27271,256,59,113,9934,9915,105,109,59,25318,1024,97,98,110,111,112,116,119,122,9961,9972,9975,10010,10031,10049,10055,10064,256,110,114,9966,9969,103,59,26604,114,59,25085,114,235,2241,103,384,108,109,114,9983,9997,10004,101,102,116,256,97,114,2534,9991,105,103,104,116,225,2546,97,112,115,116,111,59,26620,105,103,104,116,225,2557,112,97,114,114,111,119,256,108,114,10021,10025,101,102,244,9453,105,103,104,116,59,25004,384,97,102,108,10038,10041,10045,114,59,27013,59,49152,55349,56669,117,115,59,27181,105,109,101,115,59,27188,353,10059,10063,115,116,59,25111,225,4942,384,59,101,102,10071,10072,6144,26058,110,103,101,187,10072,97,114,256,59,108,10084,10085,16424,116,59,27027,640,97,99,104,109,116,10099,10102,10108,10117,10119,114,242,2216,111,114,110,101,242,7564,97,114,256,59,100,3992,10115,59,26989,59,24590,114,105,59,25279,768,97,99,104,105,113,116,10136,10141,2624,10146,10158,10171,113,117,111,59,24633,114,59,49152,55349,56513,109,384,59,101,103,2482,10154,10156,59,27277,59,27279,256,98,117,9514,10163,111,256,59,114,3615,10169,59,24602,114,111,107,59,16706,33792,60,59,99,100,104,105,108,113,114,2091,10194,9785,10204,10208,10213,10218,10224,256,99,105,10199,10201,59,27302,114,59,27257,114,101,229,9714,109,101,115,59,25289,97,114,114,59,26998,117,101,115,116,59,27259,256,80,105,10229,10233,97,114,59,27030,384,59,101,102,10240,2349,6171,26051,114,256,100,117,10247,10253,115,104,97,114,59,26954,104,97,114,59,26982,256,101,110,10263,10273,114,116,110,101,113,113,59,49152,8808,65024,197,10270,1792,68,97,99,100,101,102,104,105,108,110,111,112,115,117,10304,10309,10370,10382,10387,10400,10405,10408,10458,10466,10468,2691,10483,10498,68,111,116,59,25146,512,99,108,112,114,10318,10322,10339,10365,114,32827,175,16559,256,101,116,10327,10329,59,26178,256,59,101,10334,10335,26400,115,101,187,10335,256,59,115,4155,10344,116,111,512,59,100,108,117,4155,10355,10359,10363,111,119,238,1164,101,102,244,2319,240,5073,107,101,114,59,26030,256,111,121,10375,10380,109,109,97,59,27177,59,17468,97,115,104,59,24596,97,115,117,114,101,100,97,110,103,108,101,187,5670,114,59,49152,55349,56618,111,59,24871,384,99,100,110,10415,10420,10441,114,111,32827,181,16565,512,59,97,99,100,5220,10429,10432,10436,115,244,5799,105,114,59,27376,111,116,32955,183,437,117,115,384,59,98,100,10450,6403,10451,25106,256,59,117,7484,10456,59,27178,355,10462,10465,112,59,27355,242,8722,240,2689,256,100,112,10473,10478,101,108,115,59,25255,102,59,49152,55349,56670,256,99,116,10488,10493,114,59,49152,55349,56514,112,111,115,187,5533,384,59,108,109,10505,10506,10509,17340,116,105,109,97,112,59,25272,3072,71,76,82,86,97,98,99,100,101,102,103,104,105,106,108,109,111,112,114,115,116,117,118,119,10562,10579,10622,10633,10648,10714,10729,10773,10778,10840,10845,10883,10901,10916,10920,11012,11015,11076,11135,11182,11316,11367,11388,11497,256,103,116,10567,10571,59,49152,8921,824,256,59,118,10576,3023,49152,8811,8402,384,101,108,116,10586,10610,10614,102,116,256,97,114,10593,10599,114,114,111,119,59,25037,105,103,104,116,97,114,114,111,119,59,25038,59,49152,8920,824,256,59,118,10619,3143,49152,8810,8402,105,103,104,116,97,114,114,111,119,59,25039,256,68,100,10638,10643,97,115,104,59,25263,97,115,104,59,25262,640,98,99,110,112,116,10659,10663,10668,10673,10700,108,97,187,734,117,116,101,59,16708,103,59,49152,8736,8402,640,59,69,105,111,112,3460,10684,10688,10693,10696,59,49152,10864,824,100,59,49152,8779,824,115,59,16713,114,111,248,3460,117,114,256,59,97,10707,10708,26222,108,256,59,115,10707,2872,499,10719,0,10723,112,32955,160,2871,109,112,256,59,101,3065,3072,640,97,101,111,117,121,10740,10750,10755,10768,10771,496,10745,0,10747,59,27203,111,110,59,16712,100,105,108,59,16710,110,103,256,59,100,3454,10762,111,116,59,49152,10861,824,112,59,27202,59,17469,97,115,104,59,24595,896,59,65,97,100,113,115,120,2962,10793,10797,10811,10817,10821,10832,114,114,59,25047,114,256,104,114,10803,10806,107,59,26916,256,59,111,5106,5104,111,116,59,49152,8784,824,117,105,246,2915,256,101,105,10826,10830,97,114,59,26920,237,2968,105,115,116,256,59,115,2976,2975,114,59,49152,55349,56619,512,69,101,115,116,3013,10854,10873,10876,384,59,113,115,3004,10861,3041,384,59,113,115,3004,3013,10868,108,97,110,244,3042,105,237,3050,256,59,114,2998,10881,187,2999,384,65,97,112,10890,10893,10897,114,242,10609,114,114,59,25006,97,114,59,27378,384,59,115,118,3981,10908,3980,256,59,100,10913,10914,25340,59,25338,99,121,59,17498,896,65,69,97,100,101,115,116,10935,10938,10942,10946,10949,10998,11001,114,242,10598,59,49152,8806,824,114,114,59,24986,114,59,24613,512,59,102,113,115,3131,10958,10979,10991,116,256,97,114,10964,10969,114,114,111,247,10945,105,103,104,116,97,114,114,111,247,10896,384,59,113,115,3131,10938,10986,108,97,110,244,3157,256,59,115,3157,10996,187,3126,105,237,3165,256,59,114,3125,11006,105,256,59,101,3098,3109,105,228,3472,256,112,116,11020,11025,102,59,49152,55349,56671,33152,172,59,105,110,11033,11034,11062,16556,110,512,59,69,100,118,2953,11044,11048,11054,59,49152,8953,824,111,116,59,49152,8949,824,481,2953,11059,11061,59,25335,59,25334,105,256,59,118,3256,11068,481,3256,11073,11075,59,25342,59,25341,384,97,111,114,11083,11107,11113,114,512,59,97,115,116,2939,11093,11098,11103,108,108,101,236,2939,108,59,49152,11005,8421,59,49152,8706,824,108,105,110,116,59,27156,384,59,99,101,3218,11120,11123,117,229,3237,256,59,99,3224,11128,256,59,101,3218,11133,241,3224,512,65,97,105,116,11144,11147,11165,11175,114,242,10632,114,114,384,59,99,119,11156,11157,11161,24987,59,49152,10547,824,59,49152,8605,824,103,104,116,97,114,114,111,119,187,11157,114,105,256,59,101,3275,3286,896,99,104,105,109,112,113,117,11197,11213,11225,11012,2936,11236,11247,512,59,99,101,114,3378,11206,3383,11209,117,229,3397,59,49152,55349,56515,111,114,116,621,11013,0,0,11222,97,114,225,11094,109,256,59,101,3438,11231,256,59,113,3444,3443,115,117,256,98,112,11243,11245,229,3320,229,3339,384,98,99,112,11254,11281,11289,512,59,69,101,115,11263,11264,3362,11268,25220,59,49152,10949,824,101,116,256,59,101,3355,11275,113,256,59,113,3363,11264,99,256,59,101,3378,11287,241,3384,512,59,69,101,115,11298,11299,3423,11303,25221,59,49152,10950,824,101,116,256,59,101,3416,11310,113,256,59,113,3424,11299,512,103,105,108,114,11325,11327,11333,11335,236,3031,108,100,101,32827,241,16625,231,3139,105,97,110,103,108,101,256,108,114,11346,11356,101,102,116,256,59,101,3098,11354,241,3110,105,103,104,116,256,59,101,3275,11365,241,3287,256,59,109,11372,11373,17341,384,59,101,115,11380,11381,11385,16419,114,111,59,24854,112,59,24583,1152,68,72,97,100,103,105,108,114,115,11407,11412,11417,11422,11427,11440,11446,11475,11491,97,115,104,59,25261,97,114,114,59,26884,112,59,49152,8781,8402,97,115,104,59,25260,256,101,116,11432,11436,59,49152,8805,8402,59,49152,62,8402,110,102,105,110,59,27102,384,65,101,116,11453,11457,11461,114,114,59,26882,59,49152,8804,8402,256,59,114,11466,11469,49152,60,8402,105,101,59,49152,8884,8402,256,65,116,11480,11484,114,114,59,26883,114,105,101,59,49152,8885,8402,105,109,59,49152,8764,8402,384,65,97,110,11504,11508,11522,114,114,59,25046,114,256,104,114,11514,11517,107,59,26915,256,59,111,5095,5093,101,97,114,59,26919,4691,6805,0,0,0,0,0,0,0,0,0,0,0,0,0,11565,0,11576,11592,11616,11621,11634,11652,6919,0,0,11661,11691,0,11720,11726,0,11740,11801,11819,11838,11843,256,99,115,11569,6807,117,116,101,32827,243,16627,256,105,121,11580,11589,114,256,59,99,6814,11586,32827,244,16628,59,17470,640,97,98,105,111,115,6816,11602,11607,456,11610,108,97,99,59,16721,118,59,27192,111,108,100,59,27068,108,105,103,59,16723,256,99,114,11625,11629,105,114,59,27071,59,49152,55349,56620,879,11641,0,0,11644,0,11650,110,59,17115,97,118,101,32827,242,16626,59,27073,256,98,109,11656,3572,97,114,59,27061,512,97,99,105,116,11669,11672,11685,11688,114,242,6784,256,105,114,11677,11680,114,59,27070,111,115,115,59,27067,110,229,3666,59,27072,384,97,101,105,11697,11701,11705,99,114,59,16717,103,97,59,17353,384,99,100,110,11712,11717,461,114,111,110,59,17343,59,27062,112,102,59,49152,55349,56672,384,97,101,108,11732,11735,466,114,59,27063,114,112,59,27065,896,59,97,100,105,111,115,118,11754,11755,11758,11784,11789,11792,11798,25128,114,242,6790,512,59,101,102,109,11767,11768,11778,11781,27229,114,256,59,111,11774,11775,24884,102,187,11775,32827,170,16554,32827,186,16570,103,111,102,59,25270,114,59,27222,108,111,112,101,59,27223,59,27227,384,99,108,111,11807,11809,11815,242,11777,97,115,104,32827,248,16632,108,59,25240,105,364,11823,11828,100,101,32827,245,16629,101,115,256,59,97,475,11834,115,59,27190,109,108,32827,246,16630,98,97,114,59,25405,2785,11870,0,11901,0,11904,11933,0,11938,11961,0,0,11979,3740,0,12051,0,0,12075,12220,0,12232,114,512,59,97,115,116,1027,11879,11890,3717,33024,182,59,108,11885,11886,16566,108,101,236,1027,617,11896,0,0,11899,109,59,27379,59,27389,121,59,17471,114,640,99,105,109,112,116,11915,11919,11923,6245,11927,110,116,59,16421,111,100,59,16430,105,108,59,24624,101,110,107,59,24625,114,59,49152,55349,56621,384,105,109,111,11944,11952,11956,256,59,118,11949,11950,17350,59,17365,109,97,244,2678,110,101,59,26126,384,59,116,118,11967,11968,11976,17344,99,104,102,111,114,107,187,8189,59,17366,256,97,117,11983,11999,110,256,99,107,11989,11997,107,256,59,104,8692,11995,59,24846,246,8692,115,1152,59,97,98,99,100,101,109,115,116,12019,12020,6408,12025,12029,12036,12038,12042,12046,16427,99,105,114,59,27171,105,114,59,27170,256,111,117,7488,12034,59,27173,59,27250,110,32955,177,3741,105,109,59,27174,119,111,59,27175,384,105,112,117,12057,12064,12069,110,116,105,110,116,59,27157,102,59,49152,55349,56673,110,100,32827,163,16547,1280,59,69,97,99,101,105,110,111,115,117,3784,12095,12097,12100,12103,12161,12169,12178,12158,12214,59,27315,112,59,27319,117,229,3801,256,59,99,3790,12108,768,59,97,99,101,110,115,3784,12121,12127,12134,12136,12158,112,112,114,111,248,12099,117,114,108,121,101,241,3801,241,3790,384,97,101,115,12143,12150,12154,112,112,114,111,120,59,27321,113,113,59,27317,105,109,59,25320,105,237,3807,109,101,256,59,115,12168,3758,24626,384,69,97,115,12152,12176,12154,240,12149,384,100,102,112,3820,12185,12207,384,97,108,115,12192,12197,12202,108,97,114,59,25390,105,110,101,59,25362,117,114,102,59,25363,256,59,116,3835,12212,239,3835,114,101,108,59,25264,256,99,105,12224,12229,114,59,49152,55349,56517,59,17352,110,99,115,112,59,24584,768,102,105,111,112,115,117,12250,8930,12255,12261,12267,12273,114,59,49152,55349,56622,112,102,59,49152,55349,56674,114,105,109,101,59,24663,99,114,59,49152,55349,56518,384,97,101,111,12280,12297,12307,116,256,101,105,12286,12293,114,110,105,111,110,243,1712,110,116,59,27158,115,116,256,59,101,12304,12305,16447,241,7961,244,3860,2688,65,66,72,97,98,99,100,101,102,104,105,108,109,110,111,112,114,115,116,117,120,12352,12369,12373,12377,12512,12558,12587,12615,12642,12658,12686,12806,12821,12836,12841,12888,12910,12914,12944,12976,12983,384,97,114,116,12359,12362,12364,114,242,4275,242,989,97,105,108,59,26908,97,114,242,7269,97,114,59,26980,896,99,100,101,110,113,114,116,12392,12405,12408,12415,12431,12436,12492,256,101,117,12397,12401,59,49152,8765,817,116,101,59,16725,105,227,4462,109,112,116,121,118,59,27059,103,512,59,100,101,108,4049,12425,12427,12429,59,27026,59,27045,229,4049,117,111,32827,187,16571,114,1408,59,97,98,99,102,104,108,112,115,116,119,4060,12460,12463,12471,12473,12476,12478,12480,12483,12487,12490,112,59,26997,256,59,102,4064,12468,115,59,26912,59,26931,115,59,26910,235,8797,240,10030,108,59,26949,105,109,59,26996,108,59,24995,59,24989,256,97,105,12497,12501,105,108,59,26906,111,256,59,110,12507,12508,25142,97,108,243,3870,384,97,98,114,12519,12522,12526,114,242,6117,114,107,59,26483,256,97,107,12531,12541,99,256,101,107,12537,12539,59,16509,59,16477,256,101,115,12546,12548,59,27020,108,256,100,117,12554,12556,59,27022,59,27024,512,97,101,117,121,12567,12572,12583,12585,114,111,110,59,16729,256,100,105,12577,12581,105,108,59,16727,236,4082,226,12538,59,17472,512,99,108,113,115,12596,12599,12605,12612,97,59,26935,100,104,97,114,59,26985,117,111,256,59,114,526,525,104,59,25011,384,97,99,103,12622,12639,3908,108,512,59,105,112,115,3960,12632,12635,4252,110,229,4283,97,114,244,4009,116,59,26029,384,105,108,114,12649,4131,12654,115,104,116,59,27005,59,49152,55349,56623,256,97,111,12663,12678,114,256,100,117,12669,12671,187,1147,256,59,108,4241,12676,59,26988,256,59,118,12683,12684,17345,59,17393,384,103,110,115,12693,12793,12796,104,116,768,97,104,108,114,115,116,12708,12720,12738,12760,12772,12782,114,114,111,119,256,59,116,4060,12717,97,233,12488,97,114,112,111,111,110,256,100,117,12731,12735,111,119,238,12670,112,187,4242,101,102,116,256,97,104,12746,12752,114,114,111,119,243,4074,97,114,112,111,111,110,243,1361,105,103,104,116,97,114,114,111,119,115,59,25033,113,117,105,103,97,114,114,111,247,12491,104,114,101,101,116,105,109,101,115,59,25292,103,59,17114,105,110,103,100,111,116,115,101,241,7986,384,97,104,109,12813,12816,12819,114,242,4074,97,242,1361,59,24591,111,117,115,116,256,59,97,12830,12831,25521,99,104,101,187,12831,109,105,100,59,27374,512,97,98,112,116,12850,12861,12864,12882,256,110,114,12855,12858,103,59,26605,114,59,25086,114,235,4099,384,97,102,108,12871,12874,12878,114,59,27014,59,49152,55349,56675,117,115,59,27182,105,109,101,115,59,27189,256,97,112,12893,12903,114,256,59,103,12899,12900,16425,116,59,27028,111,108,105,110,116,59,27154,97,114,242,12771,512,97,99,104,113,12923,12928,4284,12933,113,117,111,59,24634,114,59,49152,55349,56519,256,98,117,12539,12938,111,256,59,114,532,531,384,104,105,114,12951,12955,12960,114,101,229,12792,109,101,115,59,25290,105,512,59,101,102,108,12970,4185,6177,12971,26041,116,114,105,59,27086,108,117,104,97,114,59,26984,59,24862,3425,13013,13019,13023,13100,13112,13169,0,13178,13220,0,0,13292,13296,0,13352,13384,13402,13485,13489,13514,13553,0,13846,0,0,13875,99,117,116,101,59,16731,113,117,239,10170,1280,59,69,97,99,101,105,110,112,115,121,4589,13043,13045,13055,13058,13067,13071,13087,13094,13097,59,27316,496,13050,0,13052,59,27320,111,110,59,16737,117,229,4606,256,59,100,4595,13063,105,108,59,16735,114,99,59,16733,384,69,97,115,13078,13080,13083,59,27318,112,59,27322,105,109,59,25321,111,108,105,110,116,59,27155,105,237,4612,59,17473,111,116,384,59,98,101,13108,7495,13109,25285,59,27238,896,65,97,99,109,115,116,120,13126,13130,13143,13147,13150,13155,13165,114,114,59,25048,114,256,104,114,13136,13138,235,8744,256,59,111,2614,2612,116,32827,167,16551,105,59,16443,119,97,114,59,26921,109,256,105,110,13161,240,110,117,243,241,116,59,26422,114,256,59,111,13174,8277,49152,55349,56624,512,97,99,111,121,13186,13190,13201,13216,114,112,59,26223,256,104,121,13195,13199,99,121,59,17481,59,17480,114,116,621,13209,0,0,13212,105,228,5220,97,114,97,236,11887,32827,173,16557,256,103,109,13224,13236,109,97,384,59,102,118,13233,13234,13234,17347,59,17346,1024,59,100,101,103,108,110,112,114,4779,13253,13257,13262,13270,13278,13281,13286,111,116,59,27242,256,59,113,4785,4784,256,59,69,13267,13268,27294,59,27296,256,59,69,13275,13276,27293,59,27295,101,59,25158,108,117,115,59,27172,97,114,114,59,26994,97,114,242,4413,512,97,101,105,116,13304,13320,13327,13335,256,108,115,13309,13316,108,115,101,116,109,233,13162,104,112,59,27187,112,97,114,115,108,59,27108,256,100,108,5219,13332,101,59,25379,256,59,101,13340,13341,27306,256,59,115,13346,13347,27308,59,49152,10924,65024,384,102,108,112,13358,13363,13378,116,99,121,59,17484,256,59,98,13368,13369,16431,256,59,97,13374,13375,27076,114,59,25407,102,59,49152,55349,56676,97,256,100,114,13389,1026,101,115,256,59,117,13396,13397,26208,105,116,187,13397,384,99,115,117,13408,13433,13471,256,97,117,13413,13423,112,256,59,115,4488,13419,59,49152,8851,65024,112,256,59,115,4532,13429,59,49152,8852,65024,117,256,98,112,13439,13455,384,59,101,115,4503,4508,13446,101,116,256,59,101,4503,13453,241,4509,384,59,101,115,4520,4525,13462,101,116,256,59,101,4520,13469,241,4526,384,59,97,102,4475,13478,1456,114,357,13483,1457,187,4476,97,114,242,4424,512,99,101,109,116,13497,13502,13506,13509,114,59,49152,55349,56520,116,109,238,241,105,236,13333,97,114,230,4542,256,97,114,13518,13525,114,256,59,102,13524,6079,26118,256,97,110,13530,13549,105,103,104,116,256,101,112,13539,13546,112,115,105,108,111,238,7904,104,233,11951,115,187,10322,640,98,99,109,110,112,13563,13662,4617,13707,13710,1152,59,69,100,101,109,110,112,114,115,13582,13583,13585,13589,13598,13603,13612,13617,13622,25218,59,27333,111,116,59,27325,256,59,100,4570,13594,111,116,59,27331,117,108,116,59,27329,256,69,101,13608,13610,59,27339,59,25226,108,117,115,59,27327,97,114,114,59,27001,384,101,105,117,13629,13650,13653,116,384,59,101,110,13582,13637,13643,113,256,59,113,4570,13583,101,113,256,59,113,13611,13608,109,59,27335,256,98,112,13658,13660,59,27349,59,27347,99,768,59,97,99,101,110,115,4589,13676,13682,13689,13691,13094,112,112,114,111,248,13050,117,114,108,121,101,241,4606,241,4595,384,97,101,115,13698,13704,13083,112,112,114,111,248,13082,113,241,13079,103,59,26218,1664,49,50,51,59,69,100,101,104,108,109,110,112,115,13737,13740,13743,4636,13746,13748,13760,13769,13781,13786,13791,13800,13805,32827,185,16569,32827,178,16562,32827,179,16563,59,27334,256,111,115,13753,13756,116,59,27326,117,98,59,27352,256,59,100,4642,13765,111,116,59,27332,115,256,111,117,13775,13778,108,59,26569,98,59,27351,97,114,114,59,27003,117,108,116,59,27330,256,69,101,13796,13798,59,27340,59,25227,108,117,115,59,27328,384,101,105,117,13812,13833,13836,116,384,59,101,110,4636,13820,13826,113,256,59,113,4642,13746,101,113,256,59,113,13799,13796,109,59,27336,256,98,112,13841,13843,59,27348,59,27350,384,65,97,110,13852,13856,13869,114,114,59,25049,114,256,104,114,13862,13864,235,8750,256,59,111,2603,2601,119,97,114,59,26922,108,105,103,32827,223,16607,3041,13905,13917,13920,4814,13939,13945,0,13950,14018,0,0,0,0,0,14043,14083,0,14089,14188,0,0,0,14215,626,13910,0,0,13915,103,101,116,59,25366,59,17348,114,235,3679,384,97,101,121,13926,13931,13936,114,111,110,59,16741,100,105,108,59,16739,59,17474,108,114,101,99,59,25365,114,59,49152,55349,56625,512,101,105,107,111,13958,13981,14005,14012,498,13963,0,13969,101,256,52,102,4740,4737,97,384,59,115,118,13976,13977,13979,17336,121,109,59,17361,256,99,110,13986,14002,107,256,97,115,13992,13998,112,112,114,111,248,4801,105,109,187,4780,115,240,4766,256,97,115,14010,13998,240,4801,114,110,32827,254,16638,492,799,14022,8935,101,115,33152,215,59,98,100,14031,14032,14040,16599,256,59,97,6415,14037,114,59,27185,59,27184,384,101,112,115,14049,14051,14080,225,10829,512,59,98,99,102,1158,14060,14064,14068,111,116,59,25398,105,114,59,27377,256,59,111,14073,14076,49152,55349,56677,114,107,59,27354,225,13154,114,105,109,101,59,24628,384,97,105,112,14095,14098,14180,100,229,4680,896,97,100,101,109,112,115,116,14113,14157,14144,14161,14167,14172,14175,110,103,108,101,640,59,100,108,113,114,14128,14129,14134,14144,14146,26037,111,119,110,187,7611,101,102,116,256,59,101,10240,14142,241,2350,59,25180,105,103,104,116,256,59,101,12970,14155,241,4186,111,116,59,26092,105,110,117,115,59,27194,108,117,115,59,27193,98,59,27085,105,109,101,59,27195,101,122,105,117,109,59,25570,384,99,104,116,14194,14205,14209,256,114,121,14199,14203,59,49152,55349,56521,59,17478,99,121,59,17499,114,111,107,59,16743,256,105,111,14219,14222,120,244,6007,104,101,97,100,256,108,114,14231,14240,101,102,116,97,114,114,111,247,2127,105,103,104,116,97,114,114,111,119,187,3933,2304,65,72,97,98,99,100,102,103,104,108,109,111,112,114,115,116,117,119,14288,14291,14295,14308,14320,14332,14350,14364,14371,14388,14417,14429,14443,14505,14540,14546,14570,14582,114,242,1005,97,114,59,26979,256,99,114,14300,14306,117,116,101,32827,250,16634,242,4432,114,483,14314,0,14317,121,59,17502,118,101,59,16749,256,105,121,14325,14330,114,99,32827,251,16635,59,17475,384,97,98,104,14339,14342,14347,114,242,5037,108,97,99,59,16753,97,242,5059,256,105,114,14355,14360,115,104,116,59,27006,59,49152,55349,56626,114,97,118,101,32827,249,16633,353,14375,14385,114,256,108,114,14380,14382,187,2391,187,4227,108,107,59,25984,256,99,116,14393,14413,623,14399,0,0,14410,114,110,256,59,101,14405,14406,25372,114,187,14406,111,112,59,25359,114,105,59,26104,256,97,108,14422,14426,99,114,59,16747,32955,168,841,256,103,112,14434,14438,111,110,59,16755,102,59,49152,55349,56678,768,97,100,104,108,115,117,4427,14456,14461,4978,14481,14496,111,119,110,225,5043,97,114,112,111,111,110,256,108,114,14472,14476,101,102,244,14381,105,103,104,244,14383,105,384,59,104,108,14489,14490,14492,17349,187,5114,111,110,187,14490,112,97,114,114,111,119,115,59,25032,384,99,105,116,14512,14532,14536,623,14518,0,0,14529,114,110,256,59,101,14524,14525,25373,114,187,14525,111,112,59,25358,110,103,59,16751,114,105,59,26105,99,114,59,49152,55349,56522,384,100,105,114,14553,14557,14562,111,116,59,25328,108,100,101,59,16745,105,256,59,102,14128,14568,187,6163,256,97,109,14575,14578,114,242,14504,108,32827,252,16636,97,110,103,108,101,59,27047,1920,65,66,68,97,99,100,101,102,108,110,111,112,114,115,122,14620,14623,14633,14637,14773,14776,14781,14815,14820,14824,14835,14841,14845,14849,14880,114,242,1015,97,114,256,59,118,14630,14631,27368,59,27369,97,115,232,993,256,110,114,14642,14647,103,114,116,59,27036,896,101,107,110,112,114,115,116,13539,14662,14667,14674,14685,14692,14742,97,112,112,225,9237,111,116,104,105,110,231,7830,384,104,105,114,13547,11976,14681,111,112,244,12213,256,59,104,5047,14690,239,12685,256,105,117,14697,14701,103,109,225,13235,256,98,112,14706,14724,115,101,116,110,101,113,256,59,113,14717,14720,49152,8842,65024,59,49152,10955,65024,115,101,116,110,101,113,256,59,113,14735,14738,49152,8843,65024,59,49152,10956,65024,256,104,114,14747,14751,101,116,225,13980,105,97,110,103,108,101,256,108,114,14762,14767,101,102,116,187,2341,105,103,104,116,187,4177,121,59,17458,97,115,104,187,4150,384,101,108,114,14788,14802,14807,384,59,98,101,11754,14795,14799,97,114,59,25275,113,59,25178,108,105,112,59,25326,256,98,116,14812,5224,97,242,5225,114,59,49152,55349,56627,116,114,233,14766,115,117,256,98,112,14831,14833,187,3356,187,3417,112,102,59,49152,55349,56679,114,111,240,3835,116,114,233,14772,256,99,117,14854,14859,114,59,49152,55349,56523,256,98,112,14864,14872,110,256,69,101,14720,14870,187,14718,110,256,69,101,14738,14878,187,14736,105,103,122,97,103,59,27034,896,99,101,102,111,112,114,115,14902,14907,14934,14939,14932,14945,14954,105,114,99,59,16757,256,100,105,14912,14929,256,98,103,14917,14921,97,114,59,27231,101,256,59,113,5626,14927,59,25177,101,114,112,59,24856,114,59,49152,55349,56628,112,102,59,49152,55349,56680,256,59,101,5241,14950,97,116,232,5241,99,114,59,49152,55349,56524,2787,6030,14983,0,14987,0,14992,15003,0,0,15005,15016,15019,15023,0,0,15043,15054,0,15064,6108,6111,116,114,233,6097,114,59,49152,55349,56629,256,65,97,14996,14999,114,242,963,114,242,2550,59,17342,256,65,97,15009,15012,114,242,952,114,242,2539,97,240,10003,105,115,59,25339,384,100,112,116,6052,15029,15038,256,102,108,15034,6057,59,49152,55349,56681,105,109,229,6066,256,65,97,15047,15050,114,242,974,114,242,2561,256,99,113,15058,6072,114,59,49152,55349,56525,256,112,116,6102,15068,114,233,6100,1024,97,99,101,102,105,111,115,117,15088,15101,15112,15116,15121,15125,15131,15137,99,256,117,121,15094,15099,116,101,32827,253,16637,59,17487,256,105,121,15106,15110,114,99,59,16759,59,17483,110,32827,165,16549,114,59,49152,55349,56630,99,121,59,17495,112,102,59,49152,55349,56682,99,114,59,49152,55349,56526,256,99,109,15142,15145,121,59,17486,108,32827,255,16639,1280,97,99,100,101,102,104,105,111,115,119,15170,15176,15188,15192,15204,15209,15213,15220,15226,15232,99,117,116,101,59,16762,256,97,121,15181,15186,114,111,110,59,16766,59,17463,111,116,59,16764,256,101,116,15197,15201,116,114,230,5471,97,59,17334,114,59,49152,55349,56631,99,121,59,17462,103,114,97,114,114,59,25053,112,102,59,49152,55349,56683,99,114,59,49152,55349,56527,256,106,110,15237,15239,59,24589,106,59,24588]);var Cp=new Uint16Array([512,97,103,108,113,9,21,24,27,621,15,0,0,18,112,59,16422,111,115,59,16423,116,59,16446,116,59,16444,117,111,116,59,16418]);var B0,Q_=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),Ap=(B0=String.fromCodePoint)!==null&&B0!==void 0?B0:function(t){let e="";return t>65535&&(t-=65536,e+=String.fromCharCode(t>>>10&1023|55296),t=56320|t&1023),e+=String.fromCharCode(t),e};function Tp(t){var e;return t>=55296&&t<=57343||t>1114111?65533:(e=Q_.get(t))!==null&&e!==void 0?e:t}function D0(t){return Ap(Tp(t))}var or;(function(t){t[t.NUM=35]="NUM",t[t.SEMI=59]="SEMI",t[t.ZERO=48]="ZERO",t[t.NINE=57]="NINE",t[t.LOWER_A=97]="LOWER_A",t[t.LOWER_F=102]="LOWER_F",t[t.LOWER_X=120]="LOWER_X",t[t.To_LOWER_BIT=32]="To_LOWER_BIT"})(or||(or={}));var gs;(function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"})(gs||(gs={}));function Ip(t){return function(r,i){let n="",o=0,a=0;for(;(a=r.indexOf("&",a))>=0;){if(n+=r.slice(o,a),o=a,a+=1,r.charCodeAt(a)===or.NUM){let M=a+1,R=10,x=r.charCodeAt(M);(x|or.To_LOWER_BIT)===or.LOWER_X&&(R=16,a+=1,M+=1);do x=r.charCodeAt(++a);while(x>=or.ZERO&&x<=or.NINE||R===16&&(x|or.To_LOWER_BIT)>=or.LOWER_A&&(x|or.To_LOWER_BIT)<=or.LOWER_F);if(M!==a){let w=r.substring(M,a),E=parseInt(w,R);if(r.charCodeAt(a)===or.SEMI)a+=1;else if(i)continue;n+=D0(E),o=a}continue}let h=0,d=1,m=0,p=t[m];for(;a<r.length&&(m=ex(t,p,m+1,r.charCodeAt(a)),!(m<0));a++,d++){p=t[m];let M=p&gs.VALUE_LENGTH;if(M){(!i||r.charCodeAt(a)===or.SEMI)&&(h=m,d=0);let R=(M>>14)-1;if(R===0)break;m+=R}}if(h!==0){let M=(t[h]&gs.VALUE_LENGTH)>>14;n+=M===1?String.fromCharCode(t[h]&~gs.VALUE_LENGTH):M===2?String.fromCharCode(t[h+1]):String.fromCharCode(t[h+1],t[h+2]),o=a-d+1}}return n+r.slice(o)}}function ex(t,e,r,i){let n=(e&gs.BRANCH_LENGTH)>>7,o=e&gs.JUMP_TABLE;if(n===0)return o!==0&&i===o?r:-1;if(o){let d=i-o;return d<0||d>n?-1:t[r+d]-1}let a=r,h=a+n-1;for(;a<=h;){let d=a+h>>>1,m=t[d];if(m<i)a=d+1;else if(m>i)h=d-1;else return t[d+n]}return-1}var GA=Ip(Rp),VA=Ip(Cp);var tx=new Map([[34,"&quot;"],[38,"&amp;"],[39,"&apos;"],[60,"&lt;"],[62,"&gt;"]]),rx=String.prototype.codePointAt!=null?(t,e)=>t.codePointAt(e):(t,e)=>(t.charCodeAt(e)&64512)===55296?(t.charCodeAt(e)-55296)*1024+t.charCodeAt(e+1)-56320+65536:t.charCodeAt(e);function z0(t,e){return function(i){let n,o=0,a="";for(;n=t.exec(i);)o!==n.index&&(a+=i.substring(o,n.index)),a+=e.get(n[0].charCodeAt(0)),o=n.index+1;return a+i.substring(o)}}var Gu=z0(/[&<>'"]/g,tx),Pp=z0(/["&\u00A0]/g,new Map([[34,"&quot;"],[38,"&amp;"],[160,"&nbsp;"]])),Op=z0(/[&<>\u00A0]/g,new Map([[38,"&amp;"],[60,"&lt;"],[62,"&gt;"],[160,"&nbsp;"]]));var kp;(function(t){t[t.XML=0]="XML",t[t.HTML=1]="HTML"})(kp||(kp={}));var Lp;(function(t){t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict"})(Lp||(Lp={}));var Np;(function(t){t[t.UTF8=0]="UTF8",t[t.ASCII=1]="ASCII",t[t.Extensive=2]="Extensive",t[t.Attribute=3]="Attribute",t[t.Text=4]="Text"})(Np||(Np={}));var Vu=t=>" ".repeat(t),_1=class{toString(e=0){return Vu(e)+"[VNode]"}},ys=class extends _1{constructor(e){super(),this.text=e}toString(e=0){return Vu(e)+this.textContent}get textContent(){return Gu(this.text)}set textContent(e){this.text=e}},Vo=class extends _1{constructor(e,r,i){super(),this.tag=e,this.attrs=r,this.children=i}get textContent(){return this.children.length===0?"":this.children.length===1?this.children[0].textContent:this.children.map(e=>e.textContent).join("")}set textContent(e){this.children=[new ys(e)]}toString(e=0){let r=this.toStringAttrs(),i=Vu(e),n=this.toStringChildren(e),o=`${i}<${this.tag}${r}`;return n===""?`${o} />`:`${o}>${n}</${this.tag}>`}*tags(e){this.tag===e&&(yield this);for(let r of this.elementChildren())yield*r.tags(e);return null}find(e,...r){for(let i of this.tags(e)){if(i===this)continue;if(r.length===0)return i;let n=i.find(...r);if(n!=null)return n}return null}*elementChildren(){for(let e of this.children)e instanceof Vo&&(yield e);return null}toStringAttrs(){let e=Object.keys(this.attrs);if(e.length===0)return"";let r="";for(let i of e){let n=this.attrs[i];n!=null&&(r+=` ${i}="${n}"`)}return r}toStringChildren(e=0){if(this.children.length===0)return"";if(this.children.length===1){let r=this.children[0];if(r instanceof ys)return r.textContent}return`
139
139
  ${this.children.map(r=>r.toString(e+1)).join(`
140
140
  `)}
141
- ${Vu(e)}`}};function rx(t){if(t==null)return[];if(Array.isArray(t)){let e=[];for(let r of t)if(r!=null){if(typeof r=="string"||typeof r=="number"){e.push(new bs(String(r)));continue}e.push(r)}return e}else if(typeof t=="string"||typeof t=="number")return[new bs(String(t))];return[t]}function X(t,e,r){let i=typeof e=="object"&&!Array.isArray(e);if(!i){if(r!=null)throw new Error("Invalid input");r=e}return new Vo(t,i?e:{},rx(r))}var $0;(function(t){t.aerial="aerial"})($0||($0={}));var Yp=de(Bp(),1),Xp=de(Jp(),1);function Zp(t){return[[[t[0],t[1]],[t[2],t[1]],[t[2],t[3]],[t[0],t[3]],[t[0],t[1]]]]}var{intersection:Sx,union:Qp}=Xp.default;function Mx(t,e){return t[0]===e[0]&&t[1]===e[1]}function Ex(t,e){return Sx(t,Zp(e))}function K0(t,e){let r=[];for(let i of t){let n=Yp.default.polygon(i[0],e);n.length!==0&&(Mx(n[0],n[n.length-1])||n.push(n[0]),r.push([n]))}return Ex(r,e)}var E1=t=>(t<-360?t=-(-t%360):t>360&&(t=t%360),t<-180?360+t:t>180?t-360:t),vs=(t,e)=>{let r=e-t;return r>180?r-360:r<-180?r+360:r},Rx=(t,e)=>E1(t+(e<t?e+360-t:e-t)),Sn={boxLonCenter(t){return E1(t[0]+.5*(t[2]<t[0]?360+t[2]-t[0]:t[2]-t[0]))},delta:vs,crossesAM(t,e){return Math.sign(vs(t,e))!==Math.sign(e-t)},normLon:E1,normExtent(t){return[E1(t[0]),t[1],E1(t[2]),t[3]]},union(t,e){if(e==null)return t.slice();let r=Sn.boxLonCenter(t),i=Sn.boxLonCenter(e);if(vs(r,i)<0)return this.union(e,t);let n=t.slice(),o=Rx(r,i);return vs(o,e[0])<vs(o,t[0])&&(n[0]=e[0]),vs(o,e[2])>vs(o,t[2])&&(n[2]=e[2]),e[1]<t[1]&&(n[1]=e[1]),e[3]>t[3]&&(n[3]=e[3]),n},intersects(t,e){if(t[1]>e[3]||e[1]>t[3])return!1;let r=t[0],i=e[0],n=r<t[2]?t[2]:t[2]+360,o=i<e[2]?e[2]:e[2]+360;return r<=o&&i<=n||r+360<=o&&i<=n+360||r<=o+360&&i+360<=n},ringToBbox(t){if(t.length<3)throw new Error("Invalid ring");let e=!1,r=t[0],i=r[0],n=r[1],o=i,a=n,h=i;for(let d=1;d<t.length;++d){let m=t[d],p=m[0];Sn.crossesAM(h,p)&&(e=!e),e&&(p<0?p+=360:(h+=360,d===1&&(i=o=h))),p<i?i=p:p>o&&(o=p);let R=m[1];R<n?n=R:R>a&&(a=R),h=m[0]}return[this.normLon(i),n,this.normLon(o),a]},multiPolygonToBbox(t){let e=null;for(let r of t){if(r.length===0)continue;let i=r[0];if(i.length<3)continue;let n=this.ringToBbox(i);e=e==null?n:this.union(e,n)}if(e==null)throw new Error("Invalid multipolygon");return e},bboxToMultiPolygon(t){let e=[t[0],t[1]],r=[t[2],t[1]],i=[t[0],t[3]],n=[t[2],t[3]];return t[0]<t[2]?[[[e,i,n,r,e]]]:[[[e,i,[180,n[1]],[180,r[1]],e]],[[n,r,[-180,e[1]],[-180,i[1]],n]]]}};var Cx=[-180,-90,180,90],Ax=[180,-90,360,90];function Tx(t,e,r){return[e[0]+(r[0]-e[0])*t,e[1]+(r[1]-e[1])*t]}function Ix(t){let e=[];for(let r of K0(t,Cx))e.push(r);for(let r of K0(t,Ax))e.push(r.map(i=>i.map(n=>[n[0]-360,n[1]])));return e}function Yu(t,e,r=!0){let i=!1,n=!1,o=t.map(a=>a.map(h=>{let d=[];if(h.length===0)return d;let m=h[0],p=null,M=0;for(let R of h){let x=e(R),w=x[0];if(p!=null){let E=Sn.crossesAM(M,w);if(E&&(i=!0,n=!n),n&&(w<0?x[0]=w+360:p[0]=M+360),E){let T=(180-x[0])/(p[0]-x[0]),C=e(Tx(T,R,m));d.push([180,C[1]])}}d.push(x),m=R,p=x,M=w}return d}));return i&&r?Ix(o):o}function Px(t){return{type:"Polygon",coordinates:t}}function e6(t,e={}){return{type:"Feature",geometry:Px(t),properties:e}}function t6(t,e={}){return{type:"Feature",geometry:{type:"MultiPolygon",coordinates:t},properties:e}}var Jo=de(r6(),1);var i6=`PROJCS["NZGD2000 / Chatham Islands TM 2000",
141
+ ${Vu(e)}`}};function sx(t){if(t==null)return[];if(Array.isArray(t)){let e=[];for(let r of t)if(r!=null){if(typeof r=="string"||typeof r=="number"){e.push(new ys(String(r)));continue}e.push(r)}return e}else if(typeof t=="string"||typeof t=="number")return[new ys(String(t))];return[t]}function X(t,e,r){let i=typeof e=="object"&&!Array.isArray(e);if(!i){if(r!=null)throw new Error("Invalid input");r=e}return new Vo(t,i?e:{},sx(r))}var q0;(function(t){t.aerial="aerial"})(q0||(q0={}));var Qp=de(zp(),1),e6=de(Yp(),1);function Xp(t){return[[[t[0],t[1]],[t[2],t[1]],[t[2],t[3]],[t[0],t[3]],[t[0],t[1]]]]}var{intersection:Rx,union:t6}=e6.default;function Cx(t,e){return t[0]===e[0]&&t[1]===e[1]}function Ax(t,e){return Rx(t,Xp(e))}function J0(t,e){let r=[];for(let i of t){let n=Qp.default.polygon(i[0],e);n.length!==0&&(Cx(n[0],n[n.length-1])||n.push(n[0]),r.push([n]))}return Ax(r,e)}var E1=t=>(t<-360?t=-(-t%360):t>360&&(t=t%360),t<-180?360+t:t>180?t-360:t),bs=(t,e)=>{let r=e-t;return r>180?r-360:r<-180?r+360:r},Tx=(t,e)=>E1(t+(e<t?e+360-t:e-t)),Sn={boxLonCenter(t){return E1(t[0]+.5*(t[2]<t[0]?360+t[2]-t[0]:t[2]-t[0]))},delta:bs,crossesAM(t,e){return Math.sign(bs(t,e))!==Math.sign(e-t)},normLon:E1,normExtent(t){return[E1(t[0]),t[1],E1(t[2]),t[3]]},union(t,e){if(e==null)return t.slice();let r=Sn.boxLonCenter(t),i=Sn.boxLonCenter(e);if(bs(r,i)<0)return this.union(e,t);let n=t.slice(),o=Tx(r,i);return bs(o,e[0])<bs(o,t[0])&&(n[0]=e[0]),bs(o,e[2])>bs(o,t[2])&&(n[2]=e[2]),e[1]<t[1]&&(n[1]=e[1]),e[3]>t[3]&&(n[3]=e[3]),n},intersects(t,e){if(t[1]>e[3]||e[1]>t[3])return!1;let r=t[0],i=e[0],n=r<t[2]?t[2]:t[2]+360,o=i<e[2]?e[2]:e[2]+360;return r<=o&&i<=n||r+360<=o&&i<=n+360||r<=o+360&&i+360<=n},ringToBbox(t){if(t.length<3)throw new Error("Invalid ring");let e=!1,r=t[0],i=r[0],n=r[1],o=i,a=n,h=i;for(let d=1;d<t.length;++d){let m=t[d],p=m[0];Sn.crossesAM(h,p)&&(e=!e),e&&(p<0?p+=360:(h+=360,d===1&&(i=o=h))),p<i?i=p:p>o&&(o=p);let R=m[1];R<n?n=R:R>a&&(a=R),h=m[0]}return[this.normLon(i),n,this.normLon(o),a]},multiPolygonToBbox(t){let e=null;for(let r of t){if(r.length===0)continue;let i=r[0];if(i.length<3)continue;let n=this.ringToBbox(i);e=e==null?n:this.union(e,n)}if(e==null)throw new Error("Invalid multipolygon");return e},bboxToMultiPolygon(t){let e=[t[0],t[1]],r=[t[2],t[1]],i=[t[0],t[3]],n=[t[2],t[3]];return t[0]<t[2]?[[[e,i,n,r,e]]]:[[[e,i,[180,n[1]],[180,r[1]],e]],[[n,r,[-180,e[1]],[-180,i[1]],n]]]}};var Ix=[-180,-90,180,90],Px=[180,-90,360,90];function Ox(t,e,r){return[e[0]+(r[0]-e[0])*t,e[1]+(r[1]-e[1])*t]}function kx(t){let e=[];for(let r of J0(t,Ix))e.push(r);for(let r of J0(t,Px))e.push(r.map(i=>i.map(n=>[n[0]-360,n[1]])));return e}function Yu(t,e,r=!0){let i=!1,n=!1,o=t.map(a=>a.map(h=>{let d=[];if(h.length===0)return d;let m=h[0],p=null,M=0;for(let R of h){let x=e(R),w=x[0];if(p!=null){let E=Sn.crossesAM(M,w);if(E&&(i=!0,n=!n),n&&(w<0?x[0]=w+360:p[0]=M+360),E){let T=(180-x[0])/(p[0]-x[0]),C=e(Ox(T,R,m));d.push([180,C[1]])}}d.push(x),m=R,p=x,M=w}return d}));return i&&r?kx(o):o}function Lx(t){return{type:"Polygon",coordinates:t}}function r6(t,e={}){return{type:"Feature",geometry:Lx(t),properties:e}}function i6(t,e={}){return{type:"Feature",geometry:{type:"MultiPolygon",coordinates:t},properties:e}}var Jo=de(n6(),1);var s6=`PROJCS["NZGD2000 / Chatham Islands TM 2000",
142
142
  GEOGCS["NZGD2000",
143
143
  DATUM["New_Zealand_Geodetic_Datum_2000",
144
144
  SPHEROID["GRS 1980",6378137,298.257222101,
@@ -160,7 +160,7 @@ PARAMETER["false_easting",3500000],
160
160
  PARAMETER["false_northing",10000000],
161
161
  AUTHORITY["EPSG","3793"],
162
162
  AXIS["Easting",EAST],
163
- AXIS["Northing",NORTH]]`;var n6=`PROJCS["NZGD2000 / New Zealand Transverse Mercator 2000",
163
+ AXIS["Northing",NORTH]]`;var o6=`PROJCS["NZGD2000 / New Zealand Transverse Mercator 2000",
164
164
  GEOGCS["NZGD2000",
165
165
  DATUM["New_Zealand_Geodetic_Datum_2000",
166
166
  SPHEROID["GRS 1980",6378137,298.257222101,
@@ -180,11 +180,11 @@ PARAMETER["false_easting",1600000],
180
180
  PARAMETER["false_northing",10000000],
181
181
  UNIT["metre",1,
182
182
  AUTHORITY["EPSG","9001"]],
183
- AUTHORITY["EPSG","2193"]]`;Jo.default.defs(Re.Nztm2000.toEpsgString(),n6);Jo.default.defs(Re.Citm2000.toEpsgString(),i6);var Y0=new Map;function Ox(t){return t==null?null:typeof t=="number"?t:"code"in t?t.code:"projection"in t?t.projection.code:null}var jr=class{constructor(e){this.epsg=e;try{this.projection=(0,Jo.default)(e.toEpsgString(),Re.Wgs84.toEpsgString())}catch(r){throw new it(`Failed to create projection: ${e.toEpsgString()}, ${Re.Wgs84.toEpsgString()}`,500,r)}}static define(e,r){if(Y0.get(e.code)!=null)throw new Error("Duplicate projection definition: "+e.toEpsgString());Jo.default.defs(e.toEpsgString(),r)}static get(e){let r=this.tryGet(e);if(r==null)throw new Error(`Invalid projection: ${e}`);return r}static tryGet(e){let r=Ox(e);if(r==null)return null;let i=Y0.get(r);if(i!=null)return i;let n=Re.tryGet(r);return n==null||Jo.default.defs(n.toEpsgString())==null?null:(i=new jr(n),Y0.set(r,i),i)}projectMultipolygon(e,r){if(r.epsg.code===this.epsg.code)return e;let{toWgs84:i}=this,{fromWgs84:n}=r;return e.map(o=>o.map(a=>a.map(h=>n(i(h)))))}get toWgs84(){return this.projection.forward}get fromWgs84(){return this.projection.inverse}boundsToWgs84BoundingBox(e){let r=this.toWgs84([e.x,e.y]),i=this.toWgs84([e.x+e.width,e.y+e.height]);return[r[0],r[1],i[0],i[1]]}boundsToGeoJsonFeature(e,r={}){let i=[e.x,e.y],n=[e.x+e.width,e.y],o=[e.x,e.y+e.height],a=[e.x+e.width,e.y+e.height],h=Yu([[[i,o,a,n,i]]],this.toWgs84),d=h.length===1?e6(h[0],r):t6(h,r);return d.bbox=this.boundsToWgs84BoundingBox(e),d}toGeoJson(e){return{type:"FeatureCollection",features:e.map(r=>this.boundsToGeoJsonFeature(r,{name:r.name}))}}static getTiffResZoom(e,r,i=1){let n=0;for(;n<e.zooms.length;++n)if(e.pixelScale(n)<=r*i)return n;if(n===e.zooms.length)return n-1;throw new Error("ResZoom not found")}static tileToWgs84Bbox(e,r){let i=e.tileToSource(r),n=e.tileToSource({x:r.x+1,y:r.y+1,z:r.z}),o=this.get(e),[a,h]=o.toWgs84([i.x,n.y]),[d,m]=o.toWgs84([n.x,i.y]);return[a,h,d,m]}static tileCenterToLatLon(e,r){let i=e.tileToSource({x:r.x+.5,y:r.y+.5,z:r.z}),[n,o]=this.get(e).toWgs84([i.x,i.y]);return jr.wrapLatLon(o,n)}static wrapLatLon(e,r){let i={lat:e,lon:r},n=Math.floor(Math.abs(e)/90)%4,o=e>0?90:-90,a=e%90;switch(n){case 0:i.lat=a;break;case 1:i.lat=o-a,i.lon+=180;break;case 2:i.lat=-a,i.lon+=180;break;case 3:i.lat=-o+a;break}return(i.lon>180||i.lon<-180)&&(i.lon-=Math.floor((i.lon+180)/360)*360),i}static findAlignmentLevels(e,r,i){return Math.max(0,this.getTiffResZoom(e,i,2)-r.z)}static getImagePixelWidth(e,r,i){let n=e.tileToSource(r),o=e.tileToSource({x:r.x+1,y:r.y+1,z:r.z});return Math.round((o.x-n.x)/e.pixelScale(i))*2}};function s6(t){return t==null||typeof t=="string"?!1:"roleArn"in t&&typeof t.roleArn=="string"}var o6=de(require("aws-sdk/lib/core.js"),1),a6=de(require("aws-sdk/clients/s3.js"),1);function Zo(t){return"promise"in t?t.promise():t}function Yo(t,e){return Ei(t)?typeof t.statusCode!="number"?new it(e,500,t):new it(e,t.statusCode,t):new it(e,500,t)}var Jt=class extends Rt{constructor(e,r,i){super(),this.type=Jt.type,this.protocol="s3",this.chunkSize=Jt.DefaultChunkSize,this.maxChunkCount=Jt.DefaultMaxChunkCount,this.bucket=e,this.key=r,this.remote=i}get uri(){return this.name}get name(){return`s3://${this.bucket}/${this.key}`}static isSource(e){return e.type===Jt.type}get size(){return this._size?this._size:(this._size=Promise.resolve().then(async()=>(await Zo(this.remote.headObject({Bucket:this.bucket,Key:this.key}))).ContentLength||-1),this._size)}static fromUri(e,r){let i=Qr(e);return i==null||i.key==null||i.protocol!=="s3"?null:new Jt(i.bucket,i.key,r)}async fetchBytes(e,r){let i=this.toRange(e,r);try{let n=await this.remote.getObject({Bucket:this.bucket,Key:this.key,Range:i}).promise();if(!Buffer.isBuffer(n.Body))throw new Error("Failed to fetch object, Body is not a buffer");n.ContentRange!=null&&this._size==null&&(this._size=Promise.resolve(this.parseContentRange(n.ContentRange)));let o=n.Body;return o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)}catch(n){throw Yo(n,`Failed to fetch ${this.name} ${i}`)}}};Jt.type="aws:s3";Jt.DefaultChunkSize=64*1024;Jt.DefaultMaxChunkCount=32;var Zt=class{constructor(e){this.protocol=Zt.protocol,this.s3=e}source(e){let r=Jt.fromUri(e,this.s3);if(r==null)throw new Error(`Failed to create aws s3 source from uri: ${e}`);return r}static is(e){return e.protocol===Zt.protocol}static isPath(e){return e==null?!1:e.startsWith("s3://")}async*list(e,r){for await(let i of this.details(e,r))yield i.path}async*details(e,r){let i=Qr(e);if(i==null)return;let n,o=r?.recursive===!1?"/":void 0,a=i.bucket,h=i.key,d=0;try{for(;;){d++;let m=await Zo(this.s3.listObjectsV2({Bucket:a,Prefix:h,ContinuationToken:n,Delimiter:o}));if(m.CommonPrefixes!=null)for(let p of m.CommonPrefixes)p.Prefix!=null&&(yield{path:`s3://${a}/${p.Prefix}`,isDirectory:!0});if(m.Contents!=null)for(let p of m.Contents)p.Key!=null&&(yield{path:`s3://${a}/${p.Key}`,size:p.Size});if(!m.IsTruncated)break;if(d>=Zt.MaxListCount)throw new Error(`Failed to finish listing within ${Zt.MaxListCount} list attempts`);n=m.NextContinuationToken}}catch(m){throw Yo(m,`Failed to list: "${e}"`)}}async read(e){let r=Qr(e);if(r==null||r.key==null)throw new Error(`Failed to read: "${e}"`);try{return(await this.s3.getObject({Bucket:r.bucket,Key:r.key}).promise()).Body}catch(i){throw Yo(i,`Failed to read: "${e}"`)}}async write(e,r,i){let n=Qr(e);if(n==null||n.key==null)throw new Error(`Failed to write: "${e}"`);try{await Zo(this.s3.upload({Bucket:n.bucket,Key:n.key,Body:r,ContentEncoding:i?.contentEncoding,ContentType:i?.contentType}))}catch(o){throw Yo(o,`Failed to write: "${e}"`)}}exists(e){return this.head(e).then(r=>r!=null)}stream(e){let r=Qr(e);if(r==null||r.key==null)throw new Error(`S3: Unable to read "${e}"`);return this.s3.getObject({Bucket:r.bucket,Key:r.key}).createReadStream()}async head(e){let r=Qr(e);if(r==null||r.key==null)throw new Error(`Failed to exists: "${e}"`);try{return{size:(await Zo(this.s3.headObject({Bucket:r.bucket,Key:r.key}))).ContentLength,path:e}}catch(i){if(Ei(i)&&i.code==="NotFound")return null;throw Yo(i,`Failed to exists: "${e}"`)}}};Zt.protocol="s3";Zt.MaxListCount=100;var Yt=class{static fsFromRole(e,r,i){if(typeof e=="object")return Yt.fsFromRole(e.roleArn,e.externalId,e.durationSeconds);let n=Yt.role(e,r,i);return new Zt(new a6.default({credentials:n}))}static role(e,r,i){i=i??Yt.DefaultRoleDurationSeconds;let n=`role::${e}::${r}::${i}`,o=Yt.cache.get(n);return o==null&&(o=new o6.default.ChainableTemporaryCredentials({params:{RoleArn:e,ExternalId:r,RoleSessionName:"fsa-"+Math.random().toString(32)+"-"+Date.now(),DurationSeconds:i}}),Yt.cache.set(n,o)),o}};Yt.DefaultRoleDurationSeconds=3600;Yt.cache=new Map;var l6=de(require("aws-sdk/clients/s3.js"),1),u6=require("util"),Xu=require("zlib");var kx=(0,u6.promisify)(Xu.gunzip),Er=nt;Er.readJson=async function(e){let r=await this.read(e);return e.endsWith(".gz")?JSON.parse((await kx(r)).toString()):JSON.parse(r.toString())};Er.writeJson=async function(e,r){let i=Buffer.from(JSON.stringify(r,void 0,2));if(e.endsWith(".gz")){let n=(0,Xu.createGzip)();return n.end(i),this.write(e,n)}else return this.write(e,i)};Er.configure=function(e){if(e.type!=="s3"||!s6(e))return;let r=Qr(e.path);if(r==null)throw new Error("Failed to parse URI: "+e.path);let i=`s3://${r.bucket}/`;this.register(i,Yt.fsFromRole(e.roleArn,e.externalId))};Er.register("s3://",new Zt(new l6.default));function X0(t){return t[0].toUpperCase()+t.slice(1).replace(/_(\d+)-(\d+)m/g," $1.$2m").replace(/_/g," ")}function h6(t){let e=/(?:^|\D)(\d{4})(?:-(\d{2}))?(?:$|\D)/g,r=[];for(let i=e.exec(t);i!=null;i=e.exec(t))r.push(parseInt(i[1])),i[2]!=null&&r.push(parseInt(i[1].slice(0,2)+i[2]));return r.length===0?[-1,-1]:(r.sort(),[r[0],r[r.length-1]+1])}process.env.AWS_NODEJS_CONNECTION_REUSE_ENABLED="1";_e.setConfigProvider(new Va(u1.TileMetadata.TableName));var s4=de(t0(),1);var Mn="application/json",re;(function(t){t.CacheControl="Cache-Control",t.ContentEncoding="Content-Encoding",t.ContentType="Content-Type",t.Cors="Access-Control-Allow-Origin",t.ETag="ETag",t.IfNoneMatch="If-None-Match",t.Server="Server",t.ServerTiming="Server-Timing"})(re||(re={}));var Xo;(function(t){t.CloudfrontId="X-Amz-Cf-Id",t.TraceId="X-Amzn-Trace-Id"})(Xo||(Xo={}));var $r;(function(t){t.CorrelationId="X-LINZ-Correlation-Id",t.RequestId="X-LINZ-Request-Id"})($r||($r={}));var ws=class{constructor(){if(this.timers=new Map,typeof process<"u"&&typeof process.hrtime.bigint=="function"){let e=BigInt(1e6);this.getTime=()=>Number(process.hrtime.bigint()/e)}else typeof typeof performance<"u"?this.getTime=()=>performance.now():this.getTime=()=>Date.now()}start(e){let r=this.timers.get(e);if(r!=null&&r.duration==null)throw new Error(`Duplicate startTime for "${e}"`);this.timers.set(e,{start:this.getTime()})}end(e){let r=this.timers.get(e);if(r==null)throw new Error(`Missing startTime information for "${e}"`);let i=this.getTime()-r.start;return r.duration=i,i}get metrics(){if(this.timers.size===0)return;let e={};for(let[r,i]of this.timers.entries())i.duration!=null&&(e[r]=i.duration);return e}get unfinished(){let e=[];for(let[r,i]of this.timers.entries())i.duration==null&&e.push(r);if(e.length!==0)return e}};var c6=de(Yn(),1);function Bt(t){return!(typeof t!="object"||t==null)}var _s=class{constructor(e,r,i){this.logContext={},this.timer=new ws,this.headers=new Map,this.context=r,this.event=e,this.id=(0,c6.ulid)(),this.log=i,this.timer=new ws,this.log=i.child({id:this.id,aws:{lambdaId:r.awsRequestId}})}set(e,r){r==null&&(r=void 0),this.logContext[e]=r}toResponse(e){return e?.body}};var d6=require("url");var f6=de(Yn(),1);var or=class extends _s{constructor(e,r,i){var n;super(e,r,i),this.headers=new Map,this.correlationId=(n=this.header($r.CorrelationId))!==null&&n!==void 0?n:f6.ulid(),this.set("correlationId",this.correlationId)}header(e){return this._isHeadersLoaded!==!0&&(this.loadHeaders(),this._isHeadersLoaded=!0),this.headers.get(e.toLowerCase())}json(){var e;if(this.header(re.ContentType)!==Mn)throw new Error(`Invalid Content-Type: "${this.header("content-type")}"`);if(this.body==null)throw new Error("Cannot parse empty body as JSON");try{return this.isBase64Encoded?JSON.parse(Buffer.from((e=this.body)!==null&&e!==void 0?e:"","base64").toString()):JSON.parse(this.body)}catch{throw new Error("Body is not a JSON object")}}get query(){return this._query==null&&(this._query=this.loadQueryString()),this._query}get url(){return this.path}};var Qo=class extends or{static is(e){return Bt(e)&&Bt(e.requestContext)&&Bt(e.requestContext.elb)}toResponse(e){return{statusCode:e.status,statusDescription:e.statusDescription,body:e.body,headers:this.toHeaders(e.headers),isBase64Encoded:e.isBase64Encoded}}toHeaders(e){if(e.size===0)return;let r={};for(let i of e)r[i[0]]=i[1];return r}loadHeaders(){if(this.event.headers!=null)for(let[e,r]of Object.entries(this.event.headers))r!=null&&this.headers.set(e.toLowerCase(),r)}loadQueryString(){let e=new d6.URLSearchParams;if(this.event.queryStringParameters==null)return e;for(let[r,i]of Object.entries(this.event.queryStringParameters))e.append(r.toLowerCase(),i??"true");return e}get method(){return this.event.httpMethod.toUpperCase()}get path(){return this.event.path}get body(){return this.event.body}get isBase64Encoded(){return this.event.isBase64Encoded}};var m6=require("url");var hi=class extends or{static is(e){return!(!Bt(e)||!Bt(e.requestContext)||typeof e.requestContext.apiId!="string"||typeof e.requestContext.resourceId!="string"||typeof e.requestContext.httpMethod!="string")}toResponse(e){return{statusCode:e.status,body:e.body,headers:hi.toHeaders(e),isBase64Encoded:e.isBase64Encoded}}static toHeaders(e){if(e.headers.size===0)return;let r={};for(let i of e.headers)r[i[0]]=i[1];return r}loadHeaders(){if(this.event.headers!=null)for(let[e,r]of Object.entries(this.event.headers))r!=null&&this.headers.set(e.toLowerCase(),r)}loadQueryString(){let e=new m6.URLSearchParams;if(this.event.multiValueQueryStringParameters==null)return e;for(let[r,i]of Object.entries(this.event.multiValueQueryStringParameters))if(i!=null)for(let n of i)e.append(r.toLowerCase(),n);return e}get path(){return this.event.path}get method(){return this.event.httpMethod.toUpperCase()}get body(){return this.event.body}get isBase64Encoded(){return this.event.isBase64Encoded}};var Q0=require("url");var ea=class extends or{static is(e){if(!Bt(e)||!Array.isArray(e.Records))return!1;let r=e.Records[0];return Bt(r)?Bt(r.cf):!1}toResponse(e){if(e.status===100&&this.event!=null){let r=this.event.Records[0].cf.request;for(let[i,n]of e.headers)r.headers[i.toLowerCase()]=[{key:i,value:String(n)}];return this.event.Records[0].cf.request}return{status:String(e.status),statusDescription:e.statusDescription,body:e.body,headers:this.toHeaders(e),bodyEncoding:"text"}}toHeaders(e){if(e.headers.size===0)return{};let r={};for(let i of e.headers)r[i[0]]=[{key:i[0],value:String(i[1])}];return r}loadHeaders(){var e;for(let[r,i]of Object.entries(this.event.Records[0].cf.request.headers))this.headers.set(r.toLowerCase(),(e=i[0])===null||e===void 0?void 0:e.value)}loadQueryString(){let e=this.event.Records[0].cf.request.querystring;return e==null?new Q0.URLSearchParams:new Q0.URLSearchParams(e.toLowerCase())}get path(){return this.event.Records[0].cf.request.uri}get method(){return this.event.Records[0].cf.request.method.toUpperCase()}get body(){let e=this.event.Records[0].cf.request.body;return e==null?null:e.data}get isBase64Encoded(){var e;return((e=this.event.Records[0].cf.request.body)===null||e===void 0?void 0:e.encoding)==="base64"}};var ee=class{constructor(e,r,i){if(this._body=null,this.headers=new Map,this.status=e,this.statusDescription=r,i!=null)for(let n of Object.keys(i))this.header(n,i[n])}static is(e){return e instanceof ee}static ok(e=200,r="Ok"){return new ee(e,r)}header(e,r){let i=e.toLowerCase();if(r==null)return this.headers.get(i);this.headers.set(i,r)}get isBase64Encoded(){return Buffer.isBuffer(this._body)}json(e){return this.buffer(JSON.stringify(e),Mn),this}buffer(e,r=Mn){return this.header(re.ContentType,r),this._body=e,this}get body(){return this._body==null?(this.header(re.ContentType,Mn),JSON.stringify({id:this.header($r.RequestId),status:this.status,message:this.statusDescription,correlationId:this.header($r.CorrelationId)})):Buffer.isBuffer(this._body)?this._body.toString("base64"):this._body}};var t4=de(e4(),1);var lh=class{constructor(){this.hooks={request:[],response:[]},this.router=(0,t4.default)({defaultRoute:()=>new ee(404,"Not found")})}register(e,r,i){this.router.on(e,r,async(n,o,a)=>n instanceof or?(n.params=a,uh(n,i)):new ee(500,"Internal server error"))}hook(e,r){this.hooks[e].push(r)}get(e,r){return this.register("GET",e,r)}post(e,r){return this.register("POST",e,r)}delete(e,r){return this.register("DELETE",e,r)}options(e,r){return this.register("OPTIONS",e,r)}patch(e,r){return this.register("PATCH",e,r)}head(e,r){return this.register("HEAD",e,r)}put(e,r){return this.register("PUT",e,r)}async after(e,r){try{for(let i of this.hooks.response)await i(e,r)}catch(i){return ee.is(i)?i:(e.set("err",i),new ee(500,"Internal Server Error"))}return r}async handle(e){for(let i of this.hooks.request){let n=await uh(e,i);if(n)return this.after(e,n)}let r=await this.router.lookup(e,null);return r?this.after(e,r):this.after(e,new ee(404,"Not found"))}};var r4=require("url");var oa=class extends or{toResponse(e){return{statusCode:e.status,body:e.body,headers:hi.toHeaders(e),isBase64Encoded:e.isBase64Encoded}}loadHeaders(){for(let[e,r]of Object.entries(this.event.headers))this.headers.set(e.toLowerCase(),r)}loadQueryString(){return new r4.URLSearchParams(this.event.rawQueryString)}get method(){return this.event.requestContext.http.method.toUpperCase()}get path(){return this.event.rawPath}get isBase64Encoded(){return this.event.isBase64Encoded}get body(){return this.event.body==null?null:this.event.body}static is(e){return!(!Bt(e)||!Bt(e.requestContext)||!Bt(e.requestContext.http))}};var o4="v6.32.2",aS="4d7c28b24243966157b93de0d07cbcb1f3dbd671",i4={version:o4,hash:aS};async function uh(t,e){t.timer.timers.has("lambda")||t.timer.start("lambda");try{return await e(t)}catch(r){return ee.is(r)?r:(t.set("err",r),new ee(500,"Internal Server Error"))}}function n4(t,e){let r=200;ee.is(e)&&(r=e.status,t.set("description",e.statusDescription)),t.set("status",r),t.timer.timers.size>0&&t.set("metrics",t.timer.metrics),i4.hash&&t.set("package",i4);let i=t.timer.timers.has("lambda")?t.timer.end("lambda"):0;return t.set("unfinished",t.timer.unfinished),t.set("duration",i),t.set("@type","report"),r>499?t.log.error(t.logContext,"Lambda:Done"):r>399?t.log.warn(t.logContext,"Lambda:Done"):t.log.info(t.logContext,"Lambda:Done"),e}function lS(t){let e={rejectOnError:!0,tracePercent:0,...t};if(isNaN(e.tracePercent)||e.tracePercent>1)throw new Error("tracePercent is not between 0-1 :"+e.tracePercent);return e}var ar=class{static request(e,r,i){if(Qo.is(e))return new Qo(e,r,i);if(oa.is(e))return new oa(e,r,i);if(hi.is(e))return new hi(e,r,i);if(ea.is(e))return new ea(e,r,i);throw new Error("Request is not a a ALB, ApiGateway or Cloudfront event")}static handler(e,r,i){let n=lS(r);function o(a,h,d){let m=new _s(a,h,i??ar.Logger);n.tracePercent>0&&Math.random()<n.tracePercent&&(m.log.level="trace"),process.env.TRACE_LAMBDA&&(m.log.level="trace"),m.log.trace({event:a},"Lambda:Start");let p=h.awsRequestId;m.set("aws",{lambdaId:p}),uh(m,e).then(M=>{if(n4(m,M),ee.is(M)&&n.rejectOnError){if(m.logContext.err)return d(m.logContext.err);if(M.status>399)return d(m.toResponse(M))}return d(null,m.toResponse(M))})}return o}static http(e){let r=new lh;function i(n,o,a){let h=ar.request(n,o,e??ar.Logger),d=h.header(Xo.CloudfrontId),m=h.header(Xo.TraceId),p=o.awsRequestId;(d||m||p)&&h.set("aws",{cloudFrontId:d,traceId:m,lambdaId:p}),h.set("method",h.method),h.set("path",h.path),r.handle(h).then(M=>{var R;M.status===500&&M.header(re.CacheControl,"no-store"),M.header($r.RequestId,h.id),M.header($r.CorrelationId,h.correlationId);let x=(R=h.timer.metrics)===null||R===void 0?void 0:R.lambda;x!=null&&M.header(re.ServerTiming,`total;dur=${x}`),!M.isBase64Encoded&&M.header(re.ContentType)==null&&M.header(re.ContentType,Mn),ar.ServerName&&M.header(re.Server,`${ar.ServerName}-${o4}`),n4(h,M),a(null,h.toResponse(M))})}return i.router=r,i}};ar.Logger=(0,s4.default)();ar.ServerName="linz";var qe={key(t){return Buffer.isBuffer(t)||typeof t=="string"?Xn(t):Xn(JSON.stringify(t))},isNotModified(t,e){let r=t.header(re.IfNoneMatch);return r!=null&&r.indexOf(e)>-1?(t.set("cache",{hit:!0,match:r}),!0):!1}};var be=()=>new ee(404,"Not Found"),ct=()=>new ee(304,"Not modified");var uS=.2,aa=class{constructor(e){this.tms=e}async tile(e,r,i,n){let o=[];for(let a of e){let h=this.getTiles(a,r,i,n);h!=null&&(o=o.concat(h))}return o}getRasterTiffIntersection(e,r,i,n){let o=this.tms.tileToPixels(r,i),a=new xe(o.x,o.y,this.tms.tileSize,this.tms.tileSize),h=e.images[0].bbox,d=this.tms.sourceToPixels(h[0],h[3],n),m=this.tms.sourceToPixels(h[2],h[1],n),p=xe.fromUpperLeftLowerRight(d,m),M=p.intersection(a);return M==null?null:{tiff:p,intersection:M,tile:a}}createComposition(e,r,i,n,o){let a=xe.fromJson(e.getTileBounds(r,i)),h=a.scale(n,n).add(o.tiff).round(uS),d=h.intersection(o.tile);if(d==null)return null;let m=d.subtract(h);if(m.height<.5||m.width<.5)return null;let p=h.subtract(o.tile),M={tiff:e.tif,source:{x:r,y:i,imageId:e.id,width:a.width,height:a.height},y:Math.max(0,Math.round(p.y)),x:Math.max(0,Math.round(p.x))};if((a.width<e.tileSize.width||a.height<e.tileSize.height)&&(M.extract={width:a.width,height:a.height}),a.width!==h.width||a.height!==h.height){let R=a.width!==h.width?h.width/a.width:h.height/a.height;M.resize={width:h.width,height:h.height,scale:R}}return(m.y!==0||m.x!==0||m.height!==h.height||m.width!==h.width)&&(M.crop=m),M}getTiles(e,r,i,n){let o=this.getRasterTiffIntersection(e,r,i,n);if(o==null)return null;let a=this.tms.pixelScale(n),h=e.getImageByResolution(a),d=a/h.resolution[0],m=o.intersection.subtract(o.tiff),{tileSize:p,tileCount:M}=h,R=[],x=1/d;for(let w of aa.getRequiredTiles(m,d,p,M)){let E=this.createComposition(h,w.x,w.y,x,o);E!=null&&R.push(E)}return R.length===0?null:R}static*getRequiredTiles(e,r,i,n){let o=Math.max(Math.floor(e.x/i.width*r),0),a=Math.min(Math.ceil(e.right/i.width*r),n.x),h=Math.max(Math.floor(e.y/i.height*r),0),d=Math.min(Math.ceil(e.bottom/i.height*r),n.y);for(let m=o;m<a;m++)for(let p=h;p<d;p++)yield{x:m,y:p}}};var a4=[He.Jpeg,He.Webp,He.Png];function md(t){if(t==null)return null;let e=t.toLowerCase();return e===He.Png?He.Png:e===He.Webp?He.Webp:e===He.Jpeg||e==="jpg"?He.Jpeg:e===He.Avif?He.Avif:null}var l4=de(Yn(),1),hS=60*60*1e3,cS=24*hS,fS=91*cS;function dS(t){if(t==null)return{valid:!1,message:"missing"};if(!t.startsWith("c")&&!t.startsWith("d"))return{valid:!1,message:"malformed"};let e=t.slice(1).toUpperCase();try{let r=l4.decodeTime(e);if(t.startsWith("d"))return{valid:!0,message:"ok"};if(Date.now()-r>fS)return{valid:!1,message:"expired"}}catch{return{valid:!1,message:"malformed"}}return{valid:!0,message:"ok"}}var wt={apiKey(t){let e=t.query.get(u1.ApiKey.QueryString)??t.header("X-LINZ-Api-Key"),r=dS(e);if(!r.valid)throw new ee(400,"API Key Invalid: "+r.message);return t.set("api",e),e},getTileMatrixSet(t){return Zn.find(t)},getRequestedFormats(t){let e=[...t.query.getAll("format"),...t.query.getAll("tileFormat")];if(e.length===0)return null;let r=new Set;for(let i of e){let n=md(i);n!=null&&r.add(n)}return r.size===0?null:[...r.values()]},getTileFormat(t){let e=md(t);return e||(t===rr.MapboxVectorTiles?rr.MapboxVectorTiles:null)},xyz(t){wt.apiKey(t),t.set("tileSet",t.params.tileSet);let e=parseInt(t.params.x,10),r=parseInt(t.params.y,10),i=parseInt(t.params.z,10),n=wt.getTileMatrixSet(t.params.tileMatrix);if(n==null)throw new ee(404,"Tile Matrix not found");t.set("tileMatrix",n.identifier),t.set("projection",n.projection.code);let o=wt.getTileFormat(t.params.tileType);if(o==null)throw new ee(404,"Tile extension not found");if(t.set("extension",o),isNaN(i)||i>n.maxZoom||i<0)throw new ee(404,`Zoom not found: ${i}`);let a=n.zooms[i];if(isNaN(e)||e<0||e>a.matrixWidth)throw new ee(404,`X not found: ${e}`);if(isNaN(r)||r<0||r>a.matrixHeight)throw new ee(404,`Y not found: ${r}`);let h={tile:{x:e,y:r,z:i},tileSet:t.params.tileSet,tileMatrix:n,tileType:o};t.set("xyz",h.tile);let d=jr.tileCenterToLatLon(n,h.tile);return t.set("location",d),h}};var mS=1+1e-10,u4=10**8;function pd(t){return Math.round(t*u4)/u4}function pS(t){return[pd(t[0]),pd(t[1])]}function gS(t,e,r){if(Sn.delta(t[0],t[2])<=0)return Sn.bboxToMultiPolygon(t);let i=[];for(let o of e){let a=[xe.fromJson(o).pad(mS).toPolygon()];i=Qp(i,a)}return Yu(i,o=>pS(r.toWgs84(o)))}async function yS(t,e,r){let i=jr.get(r),n=[],o=[],a=await _e.getAllImagery(e.layers,[r.projection]),h=await _e.Provider.get(_e.Provider.id("linz"));if(h==null)return null;for(let d of e.layers){let m=d[i.epsg.code];if(m==null)continue;let p=a.get(m);if(p==null)continue;let M=i.boundsToWgs84BoundingBox(p.bounds).map(pd),R=h6(p.name);if(R[0]===-1)throw new Error("Missing date in imagery name: "+p.name);let x=[R.map(C=>`${C}-01-01T00:00:00Z`)],w={spatial:{bbox:[M]},temporal:{interval:x}};o.push({type:"Feature",stac_version:Ka.Version,id:m+"_item",collection:m,assets:{},links:[],bbox:M,geometry:{type:"MultiPolygon",coordinates:gS(M,p.files,i)},properties:{title:p.title??X0(p.name),category:p.category,datetime:null,start_datetime:x[0][0],end_datetime:x[0][1]}});let E=Mt.convertZoomLevel(d.minZoom?d.minZoom:0,lt,r,!0),T=Mt.convertZoomLevel(d.maxZoom?d.maxZoom:32,lt,r,!0);n.push({stac_version:Ka.Version,license:Ka.License,id:p.id,providers:[{name:h.serviceProvider.name,url:h.serviceProvider.site,roles:["host"]}],title:p.title??X0(p.name),description:"No description",extent:w,links:[],summaries:{"linz:category":p.category,"linz:zoom":{min:E,max:T},"linz:priority":[1e3+e.layers.indexOf(d)]}})}return{id:e.id,type:"FeatureCollection",stac_version:Ka.Version,stac_extensions:["single-file-stac"],title:e.title??"No title",description:e.description??"No Description",features:o,collections:n,links:[]}}async function gd(t){let e=wt.getTileMatrixSet(t.params.tileMatrix);if(e==null)throw new ee(404,"Tile Matrix not found");t.timer.start("tileset:load");let r=await _e.TileSet.get(_e.TileSet.id(t.params.tileSet));if(t.timer.end("tileset:load"),r==null||r.type===vt.Vector)return be();let i=qe.key(r);if(qe.isNotModified(t,i))return ct();t.timer.start("stac:load");let n=await yS(t,r,e);if(t.timer.end("stac:load"),n==null)return be();let o=new ee(200,"ok");return o.header(re.ETag,i),o.header(re.CacheControl,"public, max-age=604800, stale-while-revalidate=86400"),o.json(n),o}var Ph=de(require("path"),1);var Cr;(function(t){t.NONE="application/octet-stream",t.JPEG="image/jpeg",t.JP2="image/jp2",t.WEBP="image/webp",t.LZW="application/lzw",t.DEFLATE="application/deflate"})(Cr||(Cr={}));var yd={1:Cr.NONE,5:Cr.LZW,6:Cr.JPEG,7:Cr.JPEG,8:Cr.DEFLATE,34712:Cr.JP2,50001:Cr.WEBP};var ae;(function(t){t[t.Artist=315]="Artist",t[t.BitsPerSample=258]="BitsPerSample",t[t.CellLength=265]="CellLength",t[t.CellWidth=264]="CellWidth",t[t.ColorMap=320]="ColorMap",t[t.Compression=259]="Compression",t[t.Copyright=33432]="Copyright",t[t.DateTime=306]="DateTime",t[t.ExtraSamples=338]="ExtraSamples",t[t.FillOrder=266]="FillOrder",t[t.FreeByteCounts=289]="FreeByteCounts",t[t.FreeOffsets=288]="FreeOffsets",t[t.GrayResponseCurve=291]="GrayResponseCurve",t[t.GrayResponseUnit=290]="GrayResponseUnit",t[t.HostComputer=316]="HostComputer",t[t.ImageDescription=270]="ImageDescription",t[t.ImageHeight=257]="ImageHeight",t[t.ImageWidth=256]="ImageWidth",t[t.Make=271]="Make",t[t.MaxSampleValue=281]="MaxSampleValue",t[t.MinSampleValue=280]="MinSampleValue",t[t.Model=272]="Model",t[t.NewSubFileType=254]="NewSubFileType",t[t.Orientation=274]="Orientation",t[t.PhotometricInterpretation=262]="PhotometricInterpretation",t[t.PlanarConfiguration=284]="PlanarConfiguration",t[t.ResolutionUnit=296]="ResolutionUnit",t[t.RowsPerStrip=278]="RowsPerStrip",t[t.SamplesPerPixel=277]="SamplesPerPixel",t[t.Software=305]="Software",t[t.StripByteCounts=279]="StripByteCounts",t[t.StripOffsets=273]="StripOffsets",t[t.SubFileType=255]="SubFileType",t[t.Threshholding=263]="Threshholding",t[t.XResolution=282]="XResolution",t[t.YResolution=283]="YResolution",t[t.BadFaxLines=326]="BadFaxLines",t[t.CleanFaxData=327]="CleanFaxData",t[t.ClipPath=343]="ClipPath",t[t.ConsecutiveBadFaxLines=328]="ConsecutiveBadFaxLines",t[t.Decode=433]="Decode",t[t.DefaultImageColor=434]="DefaultImageColor",t[t.DocumentName=269]="DocumentName",t[t.DotRange=336]="DotRange",t[t.HalftoneHints=321]="HalftoneHints",t[t.Indexed=346]="Indexed",t[t.JPEGTables=347]="JPEGTables",t[t.PageName=285]="PageName",t[t.PageNumber=297]="PageNumber",t[t.Predictor=317]="Predictor",t[t.PrimaryChromaticities=319]="PrimaryChromaticities",t[t.ReferenceBlackWhite=532]="ReferenceBlackWhite",t[t.SampleFormat=339]="SampleFormat",t[t.SMinSampleValue=340]="SMinSampleValue",t[t.SMaxSampleValue=341]="SMaxSampleValue",t[t.StripRowCounts=559]="StripRowCounts",t[t.SubIFDs=330]="SubIFDs",t[t.T4Options=292]="T4Options",t[t.T6Options=293]="T6Options",t[t.TileByteCounts=325]="TileByteCounts",t[t.TileHeight=323]="TileHeight",t[t.TileOffsets=324]="TileOffsets",t[t.TileWidth=322]="TileWidth",t[t.TransferFunction=301]="TransferFunction",t[t.WhitePoint=318]="WhitePoint",t[t.XClipPathUnits=344]="XClipPathUnits",t[t.XPosition=286]="XPosition",t[t.YCbCrCoefficients=529]="YCbCrCoefficients",t[t.YCbCrPositioning=531]="YCbCrPositioning",t[t.YCbCrSubSampling=530]="YCbCrSubSampling",t[t.YClipPathUnits=345]="YClipPathUnits",t[t.YPosition=287]="YPosition",t[t.ApertureValue=37378]="ApertureValue",t[t.ColorSpace=40961]="ColorSpace",t[t.DateTimeDigitized=36868]="DateTimeDigitized",t[t.DateTimeOriginal=36867]="DateTimeOriginal",t[t.ExifIFD=34665]="ExifIFD",t[t.ExifVersion=36864]="ExifVersion",t[t.ExposureTime=33434]="ExposureTime",t[t.FileSource=41728]="FileSource",t[t.Flash=37385]="Flash",t[t.FlashpixVersion=40960]="FlashpixVersion",t[t.FNumber=33437]="FNumber",t[t.ImageUniqueID=42016]="ImageUniqueID",t[t.LightSource=37384]="LightSource",t[t.MakerNote=37500]="MakerNote",t[t.ShutterSpeedValue=37377]="ShutterSpeedValue",t[t.UserComment=37510]="UserComment",t[t.IPTC=33723]="IPTC",t[t.ICCProfile=34675]="ICCProfile",t[t.XMP=700]="XMP",t[t.GDAL_METADATA=42112]="GDAL_METADATA",t[t.GDAL_NODATA=42113]="GDAL_NODATA",t[t.Photoshop=34377]="Photoshop",t[t.ModelPixelScale=33550]="ModelPixelScale",t[t.ModelTiePoint=33922]="ModelTiePoint",t[t.ModelTransformation=34264]="ModelTransformation",t[t.GeoKeyDirectory=34735]="GeoKeyDirectory",t[t.GeoDoubleParams=34736]="GeoDoubleParams",t[t.GeoAsciiParams=34737]="GeoAsciiParams"})(ae||(ae={}));var P1;(function(t){t[t.GTModelTypeGeoKey=1024]="GTModelTypeGeoKey",t[t.GTRasterTypeGeoKey=1025]="GTRasterTypeGeoKey",t[t.GTCitationGeoKey=1026]="GTCitationGeoKey",t[t.GeographicTypeGeoKey=2048]="GeographicTypeGeoKey",t[t.GeogCitationGeoKey=2049]="GeogCitationGeoKey",t[t.GeogGeodeticDatumGeoKey=2050]="GeogGeodeticDatumGeoKey",t[t.GeogPrimeMeridianGeoKey=2051]="GeogPrimeMeridianGeoKey",t[t.GeogLinearUnitsGeoKey=2052]="GeogLinearUnitsGeoKey",t[t.GeogLinearUnitSizeGeoKey=2053]="GeogLinearUnitSizeGeoKey",t[t.GeogAngularUnitsGeoKey=2054]="GeogAngularUnitsGeoKey",t[t.GeogAngularUnitSizeGeoKey=2055]="GeogAngularUnitSizeGeoKey",t[t.GeogEllipsoidGeoKey=2056]="GeogEllipsoidGeoKey",t[t.GeogSemiMajorAxisGeoKey=2057]="GeogSemiMajorAxisGeoKey",t[t.GeogSemiMinorAxisGeoKey=2058]="GeogSemiMinorAxisGeoKey",t[t.GeogInvFlatteningGeoKey=2059]="GeogInvFlatteningGeoKey",t[t.GeogAzimuthUnitsGeoKey=2060]="GeogAzimuthUnitsGeoKey",t[t.GeogPrimeMeridianLongGeoKey=2061]="GeogPrimeMeridianLongGeoKey",t[t.GeogTOWGS84GeoKey=2062]="GeogTOWGS84GeoKey",t[t.ProjectedCSTypeGeoKey=3072]="ProjectedCSTypeGeoKey",t[t.PCSCitationGeoKey=3073]="PCSCitationGeoKey",t[t.ProjectionGeoKey=3074]="ProjectionGeoKey",t[t.ProjCoordTransGeoKey=3075]="ProjCoordTransGeoKey",t[t.ProjLinearUnitsGeoKey=3076]="ProjLinearUnitsGeoKey",t[t.ProjLinearUnitSizeGeoKey=3077]="ProjLinearUnitSizeGeoKey",t[t.ProjStdParallel1GeoKey=3078]="ProjStdParallel1GeoKey",t[t.ProjStdParallel2GeoKey=3079]="ProjStdParallel2GeoKey",t[t.ProjNatOriginLongGeoKey=3080]="ProjNatOriginLongGeoKey",t[t.ProjNatOriginLatGeoKey=3081]="ProjNatOriginLatGeoKey",t[t.ProjFalseEastingGeoKey=3082]="ProjFalseEastingGeoKey",t[t.ProjFalseNorthingGeoKey=3083]="ProjFalseNorthingGeoKey",t[t.ProjFalseOriginLongGeoKey=3084]="ProjFalseOriginLongGeoKey",t[t.ProjFalseOriginLatGeoKey=3085]="ProjFalseOriginLatGeoKey",t[t.ProjFalseOriginEastingGeoKey=3086]="ProjFalseOriginEastingGeoKey",t[t.ProjFalseOriginNorthingGeoKey=3087]="ProjFalseOriginNorthingGeoKey",t[t.ProjCenterLongGeoKey=3088]="ProjCenterLongGeoKey",t[t.ProjCenterLatGeoKey=3089]="ProjCenterLatGeoKey",t[t.ProjCenterEastingGeoKey=3090]="ProjCenterEastingGeoKey",t[t.ProjCenterNorthingGeoKey=3091]="ProjCenterNorthingGeoKey",t[t.ProjScaleAtNatOriginGeoKey=3092]="ProjScaleAtNatOriginGeoKey",t[t.ProjScaleAtCenterGeoKey=3093]="ProjScaleAtCenterGeoKey",t[t.ProjAzimuthAngleGeoKey=3094]="ProjAzimuthAngleGeoKey",t[t.ProjStraightVertPoleLongGeoKey=3095]="ProjStraightVertPoleLongGeoKey",t[t.ProjRectifiedGridAngleGeoKey=3096]="ProjRectifiedGridAngleGeoKey",t[t.VerticalCSTypeGeoKey=4096]="VerticalCSTypeGeoKey",t[t.VerticalCitationGeoKey=4097]="VerticalCitationGeoKey",t[t.VerticalDatumGeoKey=4098]="VerticalDatumGeoKey",t[t.VerticalUnitsGeoKey=4099]="VerticalUnitsGeoKey"})(P1||(P1={}));var Ae;(function(t){t[t.BYTE=1]="BYTE",t[t.ASCII=2]="ASCII",t[t.SHORT=3]="SHORT",t[t.LONG=4]="LONG",t[t.RATIONAL=5]="RATIONAL",t[t.SBYTE=6]="SBYTE",t[t.UNDEFINED=7]="UNDEFINED",t[t.SSHORT=8]="SSHORT",t[t.SLONG=9]="SLONG",t[t.SRATIONAL=10]="SRATIONAL",t[t.FLOAT=11]="FLOAT",t[t.DOUBLE=12]="DOUBLE",t[t.LONG8=16]="LONG8",t[t.SLONG8=17]="SLONG8",t[t.IFD8=18]="IFD8"})(Ae||(Ae={}));var ve;(function(t){t[t.UInt8=1]="UInt8",t[t.UInt16=2]="UInt16",t[t.UInt32=4]="UInt32",t[t.UInt64=8]="UInt64",t[t.Double=8]="Double",t[t.Float=4]="Float"})(ve||(ve={}));var h4=2**32,bS=typeof setImmediate>"u"?setTimeout:setImmediate,Dt=()=>{throw new Error("Method not implemented.")},ci=class{constructor(){this.isLittleEndian=!0,this.delayMs=ci.DefaultDelayMs,this.maxChunkCount=10,this.chunks=ci.DefaultChunkCache(),this.blankFillCount=16,this.maxConcurrentRequests=50,this.toFetch=new Set,this.toFetchPromise=null,this.byteOffset=0,this.getFloat32=Dt,this.getFloat64=Dt,this.getInt8=Dt,this.getInt16=Dt,this.getInt32=Dt,this.setFloat32=Dt,this.setFloat64=Dt,this.setInt8=Dt,this.setInt16=Dt,this.setInt32=Dt,this.setUint8=Dt,this.setUint16=Dt,this.setUint32=Dt,this.setBigInt64=Dt,this.setBigUint64=Dt}static getByteRanges(e,r=32,i=16){if(e.size===0)return{chunks:[],blankFill:[]};let n=[...e.values()].sort((d,m)=>d-m),o=[],a=[];o.push(a);let h=[];for(let d=0;d<n.length;++d){let m=n[d],p=n[d-1];if(a.length>=r)a=[m],o.push(a);else if(d===0||m===p+1)a.push(m);else if(m<p+i){for(let M=p;M<m;M++)a.push(M+1),h.push(M+1);h.pop()}else a=[m],o.push(a)}return{chunks:o,blankFill:h}}async fetchData(){if(this.toFetch.size===0)return;let e=this.toFetch;this.toFetch=new Set,this.toFetchPromise=null;let r=ci.getByteRanges(e,this.maxChunkCount,this.blankFillCount),i=[];for(let n of r.chunks){let o=n[0],a=n[n.length-1],h=o*this.chunkSize,d=a*this.chunkSize+this.chunkSize-h,m=await this.fetchBytes(h,d);if(n.length===1){i[o]=m,this.chunks.set(o,new DataView(m));continue}let p=o*this.chunkSize;for(let M of n){let R=M*this.chunkSize-p,x=m.slice(R,R+this.chunkSize);i[M]=x,this.chunks.set(M,new DataView(x))}}}async loadBytes(e,r){if(e<0)throw new Error("Offset must be positive");let i=Math.floor(e/this.chunkSize),n=Math.ceil((e+r)/this.chunkSize)-1;for(let o=i;o<=n;o++)this.chunks.has(o)||this.toFetch.add(o);if(this.toFetch.size!==0){if(this.toFetchPromise==null&&(this.toFetchPromise=new Promise(o=>bS(o,this.delayMs)).then(()=>this.fetchData())),this.toFetch.size>this.maxConcurrentRequests)throw new Error("Too many outstanding requests");await this.toFetchPromise}}getChunkId(e){return Math.floor(e/this.chunkSize)}getUint(e,r){switch(r){case ve.UInt8:return this.getUint8(e);case ve.UInt16:return this.getUint16(e);case ve.UInt32:return this.getUint32(e);case ve.UInt64:return this.getUint64(e)}}bytes(e,r){let i=this.isOneChunk(e,r);if(i){let m=this.getView(i),p=e-i*this.chunkSize;return new Uint8Array(m.buffer.slice(p,p+r))}let n=new Uint8Array(r),o=e+r,a=Math.floor(e/this.chunkSize),h=Math.ceil((e+r)/this.chunkSize)-1,d=0;for(let m=a;m<=h;m++){let p=e+d,M=m*this.chunkSize,R=this.getView(m),x=Math.min(o,M+this.chunkSize),w=R.buffer.slice(p-M,x-M);n.set(new Uint8Array(w),d),d+=w.byteLength}return n}getView(e){let r=this.chunks.get(e);if(r==null)throw new Error(`Chunk:${e} is not ready`);return r}isOneChunk(e,r){let i=e+r-1,n=Math.floor(e/this.chunkSize);return Math.floor(i/this.chunkSize)-n<1?n:null}hasBytes(e,r=1){let i=Math.floor(e/this.chunkSize),n=Math.ceil((e+r)/this.chunkSize)-1;for(let o=i;o<=n;o++)if(!this.chunks.has(o))return!1;return!0}toRange(e,r){if(r==null)return`bytes=${e}`;if(e<0)throw new Error("Cannot read from remote source with negative offset and length");return`bytes=${e}-${e+r}`}parseContentRange(e){let[r,i]=e.split(" ");if(r!=="bytes")throw new Error("Failed to parse content-range: "+e);if(i==null)throw new Error("Failed to parse content-range: "+e);let[,n]=i.split("/"),o=Number(n);if(isNaN(o))throw new Error("Failed to parse content-range: "+e);return o}get buffer(){throw new Error("Method not implemented.")}get byteLength(){if(this._byteLength)return this._byteLength;throw Error(".size() has not been fetched.")}getUint8(e){let r=Math.floor(e/this.chunkSize),i=this.chunks.get(r);if(i==null)throw new Error(`Chunk:${r} is not ready`);return i.getUint8(e-r*this.chunkSize)}getUint16(e){let r=this.isOneChunk(e,ve.UInt16);if(r!=null)return this.getView(r).getUint16(e-r*this.chunkSize,this.isLittleEndian);let i=this.getUint8(e),n=this.getUint8(e+ve.UInt8);return this.isLittleEndian?i+(n<<8):(i<<8)+n}getUint32(e){let r=this.isOneChunk(e,ve.UInt32);if(r!=null)return this.getView(r).getUint32(e-r*this.chunkSize,this.isLittleEndian);let i=this.getUint16(e),n=this.getUint16(e+ve.UInt16);return this.isLittleEndian?i+n*65536:i*65536+n}getUint64(e){let r=this.isOneChunk(e,ve.UInt64);if(r!=null){let o=this.getView(r);return Number(o.getBigUint64(e-r*this.chunkSize,this.isLittleEndian))}let i=this.getUint32(e),n=this.getUint32(e+ve.UInt32);return this.isLittleEndian?i+n*h4:i*h4+n}getBigUint64(e){let r=this.isOneChunk(e,ve.UInt64);if(r!=null)return this.getView(r).getBigUint64(e-r*this.chunkSize,this.isLittleEndian);let i=BigInt(this.getUint32(e)),n=BigInt(this.getUint32(e+ve.UInt32));return this.isLittleEndian?i+(n<<BigInt(32)):(i<<BigInt(32))+n}getBigInt64(){throw new Error("Not implemented.")}};ci.DefaultChunkCache=()=>new Map;ci.DefaultDelayMs=1;var c4=de(vd(),1);function f4(t){switch(t){case Ae.BYTE:case Ae.ASCII:case Ae.SBYTE:case Ae.UNDEFINED:return 1;case Ae.SHORT:case Ae.SSHORT:return 2;case Ae.LONG:case Ae.SLONG:case Ae.FLOAT:return 4;case Ae.RATIONAL:case Ae.SRATIONAL:case Ae.DOUBLE:case Ae.LONG8:case Ae.SLONG8:case Ae.IFD8:return 8;default:throw new Error(`Invalid fieldType ${t}`)}}var Ms={char:(t,e)=>String.fromCharCode(t.getUint8(e)),uint8:(t,e)=>t.getUint8(e),uint16:(t,e)=>t.getUint16(e),uint32:(t,e)=>t.getUint32(e),uint64:(t,e)=>t.getUint64(e),double:(t,e)=>c4.read(t.bytes(e,ve.Double),0,t.isLittleEndian,52,8),rational:(t,e)=>[t.getUint32(e),t.getUint32(e+4)]};function hh(t){switch(t){case Ae.ASCII:return Ms.char;case Ae.BYTE:case Ae.UNDEFINED:case Ae.SBYTE:return Ms.uint8;case Ae.SHORT:case Ae.SSHORT:return Ms.uint16;case Ae.LONG:case Ae.SLONG:return Ms.uint32;case Ae.RATIONAL:case Ae.SRATIONAL:return Ms.rational;case Ae.DOUBLE:return Ms.double;case Ae.LONG8:return Ms.uint64;default:throw new Error(`Unknown read type "${t}" "${Ae[t]}"`)}}var Rn=class{constructor(e,r,i){this.tiff=r,this.byteOffset=i,this.id=e,this.name=ae[this.id],this.dataType=this.tiff.source.getUint16(i+2),this.dataCount=this.tiff.source.getUint(i+4,this.tiff.ifdConfig.pointer),this.dataTypeSize=f4(this.dataType),this.dataLength=this.dataTypeSize*this.dataCount}get hasBytes(){return this.tiff.source.hasBytes(this.valuePointer,this.dataLength)}get isReady(){return!0}get dataTypeName(){return Ae[this.dataType]}get valuePointer(){let e=this.size-this.tiff.ifdConfig.pointer;return this.isValueInline?this.byteOffset+e:this.tiff.source.getUint(this.byteOffset+e,this.tiff.ifdConfig.pointer)}get size(){return this.tiff.ifdConfig.ifd}get isValueInline(){return this.dataLength<=this.tiff.ifdConfig.pointer}readValue(){let e=this.valuePointer,r=this.dataTypeSize,i=hh(this.dataType),n=this.dataCount,o=n*r;if(n===1)return i(this.tiff.source,e);let a=[];for(let h=0;h<o;h+=r)a.push(i(this.tiff.source,e+h));return this.dataType===Ae.ASCII?a.join("").trim():a}toJSON(){return{id:this.id,name:this.name,offset:this.byteOffset,isReady:this.isReady,type:this.dataTypeName,value:this.value}}};var Es=class extends Rn{constructor(){super(...arguments),this.value=null}get isReady(){return this.value!=null}async fetch(){return this.tiff.source.hasBytes(this.valuePointer,this.dataLength)===!1&&await this.tiff.source.loadBytes(this.valuePointer,this.dataLength),this.value=this.readValue(),this.value}};var O1=class extends Rn{constructor(e,r,i){super(e,r,i),this.loadedValues=null}get value(){return this.loadedValues!=null?this.loadedValues:this.hasBytes?(this.readValue(),this.loadedValues):null}async load(){await this.tiff.source.loadBytes(this.valuePointer,this.dataLength),this.readValue()}readValue(){let e=super.readValue();return typeof e=="number"?this.loadedValues=[e]:this.loadedValues=e,this.loadedValues}async getValueAt(e){if(this.loadedValues)return this.loadedValues[e];let r=this.dataTypeSize,i=this.valuePointer+r*e,n=hh(this.dataType);return this.tiff.source.hasBytes(i,r)||await this.tiff.source.loadBytes(i,r),n(this.tiff.source,i)}};var k1=class extends Rn{constructor(){super(...arguments),this._isRead=!1,this._value=null}get value(){return this._isRead===!1&&(this._value=this.readValue(),this._isRead=!0),this._value}};var ch={create(t,e){let r=t.source.getUint16(e);if(r===ae.TileOffsets||r===ae.TileByteCounts||r===ae.StripByteCounts||r===ae.StripOffsets)return new O1(r,t,e);let i=new k1(r,t,e);return i.hasBytes?i:new Es(r,t,e)},isStatic(t){return t instanceof k1},isLazy(t){return t instanceof Es},isOffsetArray(t){return t instanceof O1}};var vS=32767,fh=class{constructor(e,r,i){this.tagsGeoLoaded=!1,this.tagsGeo=new Map,this.tif=e,this.id=r,this.tags=i}async init(e=!1){let r=[this.fetch(ae.Compression),this.fetch(ae.ImageHeight),this.fetch(ae.ImageWidth),this.fetch(ae.ModelPixelScale),this.fetch(ae.ModelTiePoint),this.fetch(ae.ModelTransformation),this.fetch(ae.TileHeight),this.fetch(ae.TileWidth)];e&&(r.push(this.fetch(ae.GeoKeyDirectory)),r.push(this.fetch(ae.GeoAsciiParams)),r.push(this.fetch(ae.GeoDoubleParams))),await Promise.all(r),e&&await this.loadGeoTiffTags()}value(e){let r=this.tags.get(e);return r==null?null:r.value}async loadGeoTiffTags(){if(this.tagsGeoLoaded)return;let e=this.tags.get(ae.GeoKeyDirectory);if(e==null){this.tagsGeoLoaded=!0;return}if(!e.isReady&&e instanceof Es&&await Promise.all([this.fetch(ae.GeoKeyDirectory),this.fetch(ae.GeoAsciiParams),this.fetch(ae.GeoDoubleParams)]),this.tagsGeoLoaded=!0,e.value==null)return;let r=e.value;if(!Array.isArray(r))throw new Error("Invalid geo tags found");for(let i=4;i<=r[3]*4;i+=4){let n=r[i],o=r[i+1],a=r[i+3];if(o===0){this.tagsGeo.set(n,a);continue}let h=this.tags.get(o);if(h==null||h.value==null)continue;let d=r[i+2];Array.isArray(h.value)?this.tagsGeo.set(n,h.value[a+d-1]):typeof h.value=="string"&&this.tagsGeo.set(n,h.value.substr(a,a+d-1).trim())}}valueGeo(e){if(this.tagsGeoLoaded===!1)throw new Error("loadGeoTiffTags() has not been called");return this.tagsGeo.get(e)}async fetch(e){let r=this.tags.get(e);return r==null?null:ch.isLazy(r)?r.fetch():r.value}get origin(){let e=this.value(ae.ModelTiePoint);if(e!=null&&e.length===6)return[e[3],e[4],e[5]];let r=this.value(ae.ModelTransformation);if(r!=null)return[r[3],r[7],r[11]];if(this.value(ae.NewSubFileType)===1&&this.id!==0)return this.tif.images[0].origin;throw new Error("Image does not have a geo transformation.")}get isGeoLocated(){return this.value(ae.ModelPixelScale)!=null||this.value(ae.ModelTransformation)!=null?!0:this.value(ae.NewSubFileType)===1&&this.id!==0?this.tif.images[0].isGeoLocated:!1}get resolution(){let e=this.value(ae.ModelPixelScale);if(e!=null)return[e[0],-e[1],e[2]];let r=this.value(ae.ModelTransformation);if(r!=null)return[r[0],r[5],r[10]];if(this.value(ae.NewSubFileType)===1&&this.id!==0){let i=this.tif.images[0],[n,o,a]=i.resolution,h=i.size,d=this.size;return[n*h.width/d.width,o*h.height/d.height,a]}throw new Error("Image does not have a geo transformation.")}get bbox(){let e=this.size,r=this.origin,i=this.resolution;if(r==null||e==null||i==null)throw new Error("Unable to calculate bounding box");let n=r[0],o=r[1],a=n+i[0]*e.width,h=o+i[1]*e.height;return[Math.min(n,a),Math.min(o,h),Math.max(n,a),Math.max(o,h)]}get compression(){let e=this.value(ae.Compression);return e==null||typeof e!="number"?null:yd[e]}get epsg(){let e=this.valueGeo(P1.ProjectedCSTypeGeoKey);return e===vS?null:e}get size(){return{width:this.value(ae.ImageWidth),height:this.value(ae.ImageHeight)}}get tagList(){return[...this.tags.keys()].map(e=>ae[e])}isTiled(){return this.value(ae.TileWidth)!==null}get tileSize(){return{width:this.value(ae.TileWidth),height:this.value(ae.TileHeight)}}get tileCount(){let e=this.size,r=this.tileSize,i=Math.ceil(e.width/r.width),n=Math.ceil(e.height/r.height);return{x:i,y:n}}get tileOffset(){let e=this.tags.get(ae.TileOffsets);if(e==null)throw new Error("No tile offsets found");return e}get stripCount(){let e=this.tags.get(ae.StripByteCounts);return e==null?0:e.dataCount}async getTileOffset(e){let r=this.tileOffset;if(e<0||e>r.dataCount)throw new Error(`Tile offset: ${e} out of range: 0 -> ${r.dataCount}`);return r.getValueAt(e)}getTileBounds(e,r){let{size:i,tileSize:n}=this,o=r*n.height,a=e*n.width,h=a+n.width>=i.width?i.width-a:n.width,d=o+n.height>=i.height?i.height-o:n.height;return{x:a,y:o,width:h,height:d}}async getStrip(e){if(this.isTiled())throw new Error("Cannot read stripes, tiff is tiled");let r=this.tags.get(ae.StripByteCounts),i=this.tags.get(ae.StripOffsets);if(e>=r.dataCount)throw new Error("Cannot read strip, index out of bounds");let[n,o]=await Promise.all([i.getValueAt(e),r.getValueAt(e)]);return this.getBytes(n,o)}getJpegHeader(e){let r=this.value(ae.JPEGTables);if(r==null)throw new Error("Unable to find Jpeg header");let i=r.slice(0,r.length-2),n=new Uint8Array(e.byteLength+i.length-2);return n.set(i,0),n.set(e.slice(2),i.length),n}async getBytes(e,r){let i=this.compression;if(i==null)throw new Error("Unsupported compression: "+this.value(ae.Compression));if(r===0)return null;await this.tif.source.loadBytes(e,r);let n=this.tif.source.bytes(e,r);return this.compression===Cr.JPEG?{mimeType:i,bytes:this.getJpegHeader(n)}:{mimeType:i,bytes:n}}async getTile(e,r){let i=this.compression,n=this.size,o=this.tileSize;if(o==null)throw new Error("Tiff is not tiled");if(i==null)throw new Error("Unsupported compression: "+this.value(ae.Compression));let a=Math.ceil(n.height/o.height),h=Math.ceil(n.width/o.width);if(e>=h||r>=a)throw new Error(`Tile index is outside of range x:${e} >= ${h} or y:${r} >= ${a}`);let d=r*h+e,m=h*a;if(d>=m)throw new Error(`Tile index is outside of tile range: ${d} >= ${m}`);let{offset:p,imageSize:M}=await this.getTileSize(d);return this.getBytes(p,M)}async getTileSize(e){if(this.tif.options.tileLeaderByteSize){let o=await this.getTileOffset(e);if(o===0)return{offset:0,imageSize:0};let a=this.tif.options.tileLeaderByteSize;return await this.tif.source.loadBytes(o-a,a),{offset:o,imageSize:this.tif.source.getUint(o-a,a)}}let r=this.tags.get(ae.TileByteCounts);if(r==null)throw new Error("No tile byte counts found");let[i,n]=await Promise.all([this.getTileOffset(e),r.getValueAt(e)]);return{offset:i,imageSize:n}}};var L1;(function(t){t[t.Big=19789]="Big",t[t.Little=18761]="Little"})(L1||(L1={}));var Ar;(function(t){t[t.BigTiff=43]="BigTiff",t[t.Tiff=42]="Tiff"})(Ar||(Ar={}));var wd="__reverse";function d4(t,e){if(t[wd]==null){let r={};for(let i of Object.keys(t)){let n=t[i];r[n]=i}Object.defineProperty(t,wd,{enumerable:!1,value:r,writable:!1})}return t[wd][e]}var Cn;(function(t){t.GDAL_STRUCTURAL_METADATA_SIZE="GDAL_STRUCTURAL_METADATA_SIZE",t.LAYOUT="LAYOUT",t.BLOCK_ORDER="BLOCK_ORDER",t.BLOCK_LEADER="BLOCK_LEADER",t.BLOCK_TRAILER="BLOCK_TRAILER",t.KNOWN_INCOMPATIBLE_EDITION="KNOWN_INCOMPATIBLE_EDITION",t.MASK_INTERLEAVED_WITH_IMAGERY="MASK_INTERLEAVED_WITH_IMAGERY"})(Cn||(Cn={}));var _d;(function(t){t.RowMajor="ROW_MAJOR"})(_d||(_d={}));var xd;(function(t){t.uint32="SIZE_AS_UINT4"})(xd||(xd={}));var wS={uint32:ve.UInt32},dh=class{constructor(){this.options=new Map}get isCogOptimized(){return this.isBroken?!1:this.options.get(Cn.LAYOUT)==="IFDS_BEFORE_DATA"}get isBroken(){return this.options.get(Cn.KNOWN_INCOMPATIBLE_EDITION)==="YES"}set(e,r){this.options.set(e,r)}process(e,r,i){let n=[];for(let a=r;a<r+i;a++){let h=e.getUint8(a);h!==0&&n.push(String.fromCharCode(h))}let o=n.join("").trim().split(`
184
- `).map(a=>a.split("="));for(let[a,h]of o)this.options.set(Cn[a],h)}_getReverse(e,r){let i=this.options.get(r);return i==null?null:d4(e,i)}get tileOrder(){return this._getReverse(_d,Cn.BLOCK_ORDER)}get tileLeader(){return this._getReverse(xd,Cn.BLOCK_LEADER)}get tileLeaderByteSize(){return this.tileLeader==null?null:wS[this.tileLeader]}get isMaskInterleaved(){return this.options.get(Cn.MASK_INTERLEAVED_WITH_IMAGERY)==="YES"}};var Sd={version:Ar.Tiff,pointer:ve.UInt32,offset:ve.UInt16,ifd:ve.UInt16+ve.UInt16+2*ve.UInt32},Md={version:Ar.BigTiff,pointer:ve.UInt64,offset:ve.UInt64,ifd:ve.UInt16+ve.UInt16+2*ve.UInt64},xk={[Ar.BigTiff]:Md,[Ar.Tiff]:Sd};var Ed=de(vd(),1),mh=class{constructor(e,r=0){this.tiff=e,this.byteOffset=r,this.relativeOffset=0}get currentOffset(){return this.byteOffset+this.relativeOffset}seekTo(e){return this.byteOffset=e,this.relativeOffset=0,this}seek(e){let r=this.currentOffset;return this.relativeOffset+=e,r}bytes(e){return this.tiff.source.bytes(this.seek(e),e)}uint(e){return this.tiff.source.getUint(this.seek(e),e)}uint8(){return this.tiff.source.getUint8(this.seek(ve.UInt8))}uint16(){return this.tiff.source.getUint16(this.seek(ve.UInt16))}uint32(){return this.tiff.source.getUint32(this.seek(ve.UInt32))}uint64(){return this.tiff.source.getUint64(this.seek(ve.UInt64))}pointer(){let e=this.tiff.ifdConfig.pointer;return this.tiff.source.getUint(this.seek(e),e)}offset(){let e=this.tiff.ifdConfig.offset;return this.tiff.source.getUint(this.seek(e),e)}float(){return Ed.read(this.bytes(ve.Float),0,this.tiff.source.isLittleEndian,23,4)}double(){return Ed.read(this.bytes(ve.Double),0,this.tiff.source.isLittleEndian,52,8)}};function m4(t,e=4,r=!0){let i=t.toString(16).padStart(e,"0");return r?"0x"+i:i}var la=class{constructor(e){this.version=Ar.Tiff,this.images=[],this.options=new dh,this.ifdConfig=Sd,this.isInitialized=!1,this.source=e,this.cursor=new mh(this)}static create(e){return new la(e).init()}init(e=!1){return this._initPromise?this._initPromise:(this._initPromise=this.doInit(e),this._initPromise)}async doInit(e=!1){return this.isInitialized?this:(await this.source.loadBytes(0,this.source.chunkSize),await this.fetchIfd(),await Promise.all(this.images.map(r=>r.init(e))),this.isInitialized=!0,this)}async fetchIfd(){let e=this.cursor.seekTo(0),r=e.uint16();if(this.source.isLittleEndian=r===L1.Little,!this.source.isLittleEndian)throw new Error("Only little endian is supported");this.version=e.uint16();let i;if(this.version===Ar.BigTiff){if(this.ifdConfig=Md,e.uint16()!==8)throw new Error("Only 8byte pointers are supported");if(e.uint16()!==0)throw new Error("Invalid big tiff header");i=e.pointer()}else if(this.version===Ar.Tiff)i=e.pointer();else throw new Error(`Only tiff supported version:${this.version}`);let n=i-this.cursor.currentOffset;return n>0&&n<16*1024,this.processIfd(i)}getImage(e){return this.images[e]}getImageByResolution(e){let r=this.images[0],i=r.size,[n]=r.resolution,o=n*i.width;for(let a=this.images.length-1;a>0;a--){let h=this.images[a],d=h.size;if(o/d.width-e<=.01)return h}return r}async getTile(e,r,i){let n=this.getImage(i);if(n==null)throw new Error(`Missing z: ${i}`);if(!n.isTiled())throw new Error("Tif is not tiled");return n.getTile(e,r)}async processIfd(e){this.source.hasBytes(e,4096)||await this.source.loadBytes(e,4096);let{image:r,nextOffset:i}=await this.readIfd(e);this.images.push(r),i&&await this.processIfd(i)}async readIfd(e){this.source.hasBytes(e,1024)||await this.source.loadBytes(e,this.source.chunkSize);let i=this.cursor.seekTo(e).offset(),n=e+this.ifdConfig.offset,o=new Map,a=n;for(let m=0;m<i;m++){let p=ch.create(this,a);if(a+=p.size,p.name==null)throw new Error("Unknown IFD Tag: "+m4(p.id));o.set(p.id,p)}let h=new fh(this,this.images.length,o);return{nextOffset:this.source.getUint(a,this.ifdConfig.pointer),image:h}}async close(){var e,r;await((r=(e=this.source)===null||e===void 0?void 0:e.close)===null||r===void 0?void 0:r.call(e))}};var Le=class{constructor(e){this.name=e}raw(e,r=0){return this.parse(e,{offset:r,startOffset:0})}read(e,r=0){let i={offset:r,startOffset:r};return{value:this.parse(e,i),offset:i.offset}}refine(e){return new Rd(this,e)}},Rd=class extends Le{constructor(e,r){super("Function:"+e.name),this.input=e,this.cb=r}get size(){return this.input.size}parse(e,r){let i=this.input.parse(e,r);return this.cb(i,e,r)}};var ph=class extends Le{constructor(e,r,i){super(`Array:${e}:${r.name}x${i}`),this.count=i,this.type=r}get size(){return this.count*this.type.size}parse(e,r){let i=[];for(let n=0;n<this.count;n++)i.push(this.type.parse(e,r));return i}},gh=class extends Le{constructor(e,r,i,n){super("Array:Offset:"+e),this.isLookupRequired=!0,this.isMaxLength=n,this.lengthName=i,this.type=r}get size(){throw new Error("Unable to calculate size of dynamic object: "+this.name)}parse(e,r,i){let n=[],o=i?.[this.lengthName];if(o==null||typeof o!="number")throw new Error(`${this.name}: Missing variable a "${this.lengthName}"`);this.isMaxLength&&(o-=r.offset-r.startOffset);for(let a=0;a<o;a++)n.push(this.type.parse(e,r));return n}};var p4=[];for(let t=0;t<64;t++)p4[t]=Math.pow(2,t);var N1=class{constructor(e,r=0,i=e.length,n=!0){if(this.buffer=e,this.offset=r*8,this.maxOffset=i*8,this.isLittleEndian=n,!this.isLittleEndian)throw new Error("BigEndian is not supported")}get remainingBits(){return this.maxOffset-this.offset}getBitValue(e,r,i){return(e&((1<<r+i)-1&~((1<<r)-1)))>>r}skip(e){this.offset+=e}bit(){if(this.remainingBits<0)throw new Error("BitStream: Overflow "+this.remainingBits);let e=Math.floor(this.offset/8),r=this.offset%8,i=this.buffer[e];return this.offset++,this.getBitValue(i,r,1)}bool(){return this.bit()===1}bits(e){let r=e,i=0;for(;e>0;)this.bit()===1&&(i+=p4[r-e]),e--;return i}string(e){let r=[];e==null&&(e=Math.floor(this.remainingBits/8));for(let i=0;i<e;i++){let n=this.bits(8);if(n===0)break;r.push(String.fromCharCode(n))}return r.join("")}};var yh=class extends Le{constructor(e,r){super("Bits:"+e);let i=0;this.fields=Object.keys(r).map(n=>{let o=r[n];return i+=o,{key:n,bits:o}}),this.size=Math.ceil(i/8)}parse(e,r){let i=r.offset,n={},o=new N1(e,i,i+this.size);for(let{key:a,bits:h}of this.fields)n[a]=o.bits(h);return r.offset+=this.size,n}},bh=class extends Le{constructor(e,r,i){super("BitsFlags:"+e),this.type=r,this.fields=Object.entries(i)}get size(){return this.type.size}parse(e,r){let i=this.type.parse(e,r),n={};for(let[o,a]of this.fields){let h=(i&a)===a;h&&(n[o]=h)}return n}};var vh=class extends Le{constructor(e){super("Bytes:"+e),this.size=e}parse(e,r){let i=e.slice(r.offset,r.offset+this.size);return r.offset+=this.size,i}};var Cd=class extends Le{constructor(){super(...arguments),this.size=1}parse(e,r){let i=r.offset;return r.offset+=this.size,e[i]}},Ad=class extends Le{constructor(){super(...arguments),this.size=2}parse(e,r){let i=r.offset,n=e[i++],o=e[i++]<<8;return r.offset+=2,n|o}},Td=class extends Le{constructor(){super(...arguments),this.size=4}parse(e,r){let i=r.offset,n=e[i++],o=e[i++]<<8,a=e[i++]<<16,h=e[i++]*16777216;return r.offset=i,(n|o|a)+h}},_S=2**32,Id=class extends Le{constructor(){super(...arguments),this.size=8}parse(e,r){let i=ua.parse(e,r),n=ua.parse(e,r);return i+n*_S}},Pd=class extends Le{constructor(){super(...arguments),this.size=8}parse(e,r){let i=BigInt(ua.parse(e,r)),n=BigInt(ua.parse(e,r));return i+(n<<BigInt(32))}},g4=new Cd("UInt8"),y4=new Ad("LUInt16"),ua=new Td("LUInt32"),b4=new Id("LUInt64"),v4=new Pd("BigLUInt64");var wh=class extends Le{constructor(e,r,i){super("Lookup:"+e),this.lookup=i,this.type=r}get size(){return this.type.size}parse(e,r){let i=this.type.parse(e,r),n=this.lookup(i);if(n==null)throw new Error(`${this.name}: Failed to lookup ${i}`);return{id:i,name:n}}},_h=class extends Le{constructor(e,r,i){super("Enum:"+e),this.enumeration=i,this.type=r}get size(){return this.type.size}parse(e,r){let i=this.type.parse(e,r),n=this.enumeration[i];if(n==null)throw new Error(`${this.name}: Failed to lookup ${i}`);return{id:i,name:n}}};var ha=class extends Le{constructor(e,r){super(e),this._size=-1,this.fields=[];for(let[i,n]of Object.entries(r))this.fields.push({key:i,parser:n})}get size(){if(this._size>-1)return this._size;let e=0;for(let r of this.fields)e+=r.parser.size;return this._size=e,this._size}parse(e,r){let i={};for(let n of this.fields)i[n.key]=n.parser.parse(e,r,i);return i}},xh=class extends Le{constructor(e,r){super(e),this.fields=[],this._size=-1;let i=Object.entries(r),n=!1;for(let[o,a]of i)a.isLookupRequired&&(n=!0),this.fields.push({key:o,parser:a});i.length!==0&&(n?this.generateObjectAssign():this.generateSingleObject())}generateSingleObject(){let e=[],r='"use strict"; return {';for(let n=0;n<this.fields.length;n++)e.push(this.fields[n].parser),r+=` ${JSON.stringify(this.fields[n].key)}: _bp[${n}].parse(buf, ctx),`;r+=" };";let i=new Function("_bp","buf","ctx",r);this.parse=i.bind(null,e)}generateObjectAssign(){let e=[],r=`"use strict"; const ret = {};
183
+ AUTHORITY["EPSG","2193"]]`;Jo.default.defs(Re.Nztm2000.toEpsgString(),o6);Jo.default.defs(Re.Citm2000.toEpsgString(),s6);var X0=new Map;function Nx(t){return t==null?null:typeof t=="number"?t:"code"in t?t.code:"projection"in t?t.projection.code:null}var jr=class{constructor(e){this.epsg=e;try{this.projection=(0,Jo.default)(e.toEpsgString(),Re.Wgs84.toEpsgString())}catch(r){throw new it(`Failed to create projection: ${e.toEpsgString()}, ${Re.Wgs84.toEpsgString()}`,500,r)}}static define(e,r){if(X0.get(e.code)!=null)throw new Error("Duplicate projection definition: "+e.toEpsgString());Jo.default.defs(e.toEpsgString(),r)}static get(e){let r=this.tryGet(e);if(r==null)throw new Error(`Invalid projection: ${e}`);return r}static tryGet(e){let r=Nx(e);if(r==null)return null;let i=X0.get(r);if(i!=null)return i;let n=Re.tryGet(r);return n==null||Jo.default.defs(n.toEpsgString())==null?null:(i=new jr(n),X0.set(r,i),i)}projectMultipolygon(e,r){if(r.epsg.code===this.epsg.code)return e;let{toWgs84:i}=this,{fromWgs84:n}=r;return e.map(o=>o.map(a=>a.map(h=>n(i(h)))))}get toWgs84(){return this.projection.forward}get fromWgs84(){return this.projection.inverse}boundsToWgs84BoundingBox(e){let r=this.toWgs84([e.x,e.y]),i=this.toWgs84([e.x+e.width,e.y+e.height]);return[r[0],r[1],i[0],i[1]]}boundsToGeoJsonFeature(e,r={}){let i=[e.x,e.y],n=[e.x+e.width,e.y],o=[e.x,e.y+e.height],a=[e.x+e.width,e.y+e.height],h=Yu([[[i,o,a,n,i]]],this.toWgs84),d=h.length===1?r6(h[0],r):i6(h,r);return d.bbox=this.boundsToWgs84BoundingBox(e),d}toGeoJson(e){return{type:"FeatureCollection",features:e.map(r=>this.boundsToGeoJsonFeature(r,{name:r.name}))}}static getTiffResZoom(e,r,i=1){let n=0;for(;n<e.zooms.length;++n)if(e.pixelScale(n)<=r*i)return n;if(n===e.zooms.length)return n-1;throw new Error("ResZoom not found")}static tileToWgs84Bbox(e,r){let i=e.tileToSource(r),n=e.tileToSource({x:r.x+1,y:r.y+1,z:r.z}),o=this.get(e),[a,h]=o.toWgs84([i.x,n.y]),[d,m]=o.toWgs84([n.x,i.y]);return[a,h,d,m]}static tileCenterToLatLon(e,r){let i=e.tileToSource({x:r.x+.5,y:r.y+.5,z:r.z}),[n,o]=this.get(e).toWgs84([i.x,i.y]);return jr.wrapLatLon(o,n)}static wrapLatLon(e,r){let i={lat:e,lon:r},n=Math.floor(Math.abs(e)/90)%4,o=e>0?90:-90,a=e%90;switch(n){case 0:i.lat=a;break;case 1:i.lat=o-a,i.lon+=180;break;case 2:i.lat=-a,i.lon+=180;break;case 3:i.lat=-o+a;break}return(i.lon>180||i.lon<-180)&&(i.lon-=Math.floor((i.lon+180)/360)*360),i}static findAlignmentLevels(e,r,i){return Math.max(0,this.getTiffResZoom(e,i,2)-r.z)}static getImagePixelWidth(e,r,i){let n=e.tileToSource(r),o=e.tileToSource({x:r.x+1,y:r.y+1,z:r.z});return Math.round((o.x-n.x)/e.pixelScale(i))*2}};function a6(t){return t==null||typeof t=="string"?!1:"roleArn"in t&&typeof t.roleArn=="string"}var l6=de(require("aws-sdk/lib/core.js"),1),u6=de(require("aws-sdk/clients/s3.js"),1);function Zo(t){return"promise"in t?t.promise():t}function Yo(t,e){return Ei(t)?typeof t.statusCode!="number"?new it(e,500,t):new it(e,t.statusCode,t):new it(e,500,t)}var Jt=class extends Rt{constructor(e,r,i){super(),this.type=Jt.type,this.protocol="s3",this.chunkSize=Jt.DefaultChunkSize,this.maxChunkCount=Jt.DefaultMaxChunkCount,this.bucket=e,this.key=r,this.remote=i}get uri(){return this.name}get name(){return`s3://${this.bucket}/${this.key}`}static isSource(e){return e.type===Jt.type}get size(){return this._size?this._size:(this._size=Promise.resolve().then(async()=>(await Zo(this.remote.headObject({Bucket:this.bucket,Key:this.key}))).ContentLength||-1),this._size)}static fromUri(e,r){let i=Qr(e);return i==null||i.key==null||i.protocol!=="s3"?null:new Jt(i.bucket,i.key,r)}async fetchBytes(e,r){let i=this.toRange(e,r);try{let n=await this.remote.getObject({Bucket:this.bucket,Key:this.key,Range:i}).promise();if(!Buffer.isBuffer(n.Body))throw new Error("Failed to fetch object, Body is not a buffer");n.ContentRange!=null&&this._size==null&&(this._size=Promise.resolve(this.parseContentRange(n.ContentRange)));let o=n.Body;return o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)}catch(n){throw Yo(n,`Failed to fetch ${this.name} ${i}`)}}};Jt.type="aws:s3";Jt.DefaultChunkSize=64*1024;Jt.DefaultMaxChunkCount=32;var Zt=class{constructor(e){this.protocol=Zt.protocol,this.s3=e}source(e){let r=Jt.fromUri(e,this.s3);if(r==null)throw new Error(`Failed to create aws s3 source from uri: ${e}`);return r}static is(e){return e.protocol===Zt.protocol}static isPath(e){return e==null?!1:e.startsWith("s3://")}async*list(e,r){for await(let i of this.details(e,r))yield i.path}async*details(e,r){let i=Qr(e);if(i==null)return;let n,o=r?.recursive===!1?"/":void 0,a=i.bucket,h=i.key,d=0;try{for(;;){d++;let m=await Zo(this.s3.listObjectsV2({Bucket:a,Prefix:h,ContinuationToken:n,Delimiter:o}));if(m.CommonPrefixes!=null)for(let p of m.CommonPrefixes)p.Prefix!=null&&(yield{path:`s3://${a}/${p.Prefix}`,isDirectory:!0});if(m.Contents!=null)for(let p of m.Contents)p.Key!=null&&(yield{path:`s3://${a}/${p.Key}`,size:p.Size});if(!m.IsTruncated)break;if(d>=Zt.MaxListCount)throw new Error(`Failed to finish listing within ${Zt.MaxListCount} list attempts`);n=m.NextContinuationToken}}catch(m){throw Yo(m,`Failed to list: "${e}"`)}}async read(e){let r=Qr(e);if(r==null||r.key==null)throw new Error(`Failed to read: "${e}"`);try{return(await this.s3.getObject({Bucket:r.bucket,Key:r.key}).promise()).Body}catch(i){throw Yo(i,`Failed to read: "${e}"`)}}async write(e,r,i){let n=Qr(e);if(n==null||n.key==null)throw new Error(`Failed to write: "${e}"`);try{await Zo(this.s3.upload({Bucket:n.bucket,Key:n.key,Body:r,ContentEncoding:i?.contentEncoding,ContentType:i?.contentType}))}catch(o){throw Yo(o,`Failed to write: "${e}"`)}}exists(e){return this.head(e).then(r=>r!=null)}stream(e){let r=Qr(e);if(r==null||r.key==null)throw new Error(`S3: Unable to read "${e}"`);return this.s3.getObject({Bucket:r.bucket,Key:r.key}).createReadStream()}async head(e){let r=Qr(e);if(r==null||r.key==null)throw new Error(`Failed to exists: "${e}"`);try{return{size:(await Zo(this.s3.headObject({Bucket:r.bucket,Key:r.key}))).ContentLength,path:e}}catch(i){if(Ei(i)&&i.code==="NotFound")return null;throw Yo(i,`Failed to exists: "${e}"`)}}};Zt.protocol="s3";Zt.MaxListCount=100;var Yt=class{static fsFromRole(e,r,i){if(typeof e=="object")return Yt.fsFromRole(e.roleArn,e.externalId,e.durationSeconds);let n=Yt.role(e,r,i);return new Zt(new u6.default({credentials:n}))}static role(e,r,i){i=i??Yt.DefaultRoleDurationSeconds;let n=`role::${e}::${r}::${i}`,o=Yt.cache.get(n);return o==null&&(o=new l6.default.ChainableTemporaryCredentials({params:{RoleArn:e,ExternalId:r,RoleSessionName:"fsa-"+Math.random().toString(32)+"-"+Date.now(),DurationSeconds:i}}),Yt.cache.set(n,o)),o}};Yt.DefaultRoleDurationSeconds=3600;Yt.cache=new Map;var h6=de(require("aws-sdk/clients/s3.js"),1),c6=require("util"),Xu=require("zlib");var Bx=(0,c6.promisify)(Xu.gunzip),Er=nt;Er.readJson=async function(e){let r=await this.read(e);return e.endsWith(".gz")?JSON.parse((await Bx(r)).toString()):JSON.parse(r.toString())};Er.writeJson=async function(e,r){let i=Buffer.from(JSON.stringify(r,void 0,2));if(e.endsWith(".gz")){let n=(0,Xu.createGzip)();return n.end(i),this.write(e,n)}else return this.write(e,i)};Er.configure=function(e){if(e.type!=="s3"||!a6(e))return;let r=Qr(e.path);if(r==null)throw new Error("Failed to parse URI: "+e.path);let i=`s3://${r.bucket}/`;this.register(i,Yt.fsFromRole(e.roleArn,e.externalId))};Er.register("s3://",new Zt(new h6.default));function Q0(t){return t[0].toUpperCase()+t.slice(1).replace(/_(\d+)-(\d+)m/g," $1.$2m").replace(/_/g," ")}function f6(t){let e=/(?:^|\D)(\d{4})(?:-(\d{2}))?(?:$|\D)/g,r=[];for(let i=e.exec(t);i!=null;i=e.exec(t))r.push(parseInt(i[1])),i[2]!=null&&r.push(parseInt(i[1].slice(0,2)+i[2]));return r.length===0?[-1,-1]:(r.sort(),[r[0],r[r.length-1]+1])}process.env.AWS_NODEJS_CONNECTION_REUSE_ENABLED="1";we.setConfigProvider(new Va(u1.TileMetadata.TableName));var a4=de(t0(),1);var Mn="application/json",re;(function(t){t.CacheControl="Cache-Control",t.ContentEncoding="Content-Encoding",t.ContentType="Content-Type",t.Cors="Access-Control-Allow-Origin",t.ETag="ETag",t.IfNoneMatch="If-None-Match",t.Server="Server",t.ServerTiming="Server-Timing"})(re||(re={}));var Xo;(function(t){t.CloudfrontId="X-Amz-Cf-Id",t.TraceId="X-Amzn-Trace-Id"})(Xo||(Xo={}));var $r;(function(t){t.CorrelationId="X-LINZ-Correlation-Id",t.RequestId="X-LINZ-Request-Id"})($r||($r={}));var vs=class{constructor(){if(this.timers=new Map,typeof process<"u"&&typeof process.hrtime.bigint=="function"){let e=BigInt(1e6);this.getTime=()=>Number(process.hrtime.bigint()/e)}else typeof typeof performance<"u"?this.getTime=()=>performance.now():this.getTime=()=>Date.now()}start(e){let r=this.timers.get(e);if(r!=null&&r.duration==null)throw new Error(`Duplicate startTime for "${e}"`);this.timers.set(e,{start:this.getTime()})}end(e){let r=this.timers.get(e);if(r==null)throw new Error(`Missing startTime information for "${e}"`);let i=this.getTime()-r.start;return r.duration=i,i}get metrics(){if(this.timers.size===0)return;let e={};for(let[r,i]of this.timers.entries())i.duration!=null&&(e[r]=i.duration);return e}get unfinished(){let e=[];for(let[r,i]of this.timers.entries())i.duration==null&&e.push(r);if(e.length!==0)return e}};var d6=de(yo(),1);function Bt(t){return!(typeof t!="object"||t==null)}var ws=class{constructor(e,r,i){this.logContext={},this.timer=new vs,this.headers=new Map,this.context=r,this.event=e,this.id=(0,d6.ulid)(),this.log=i,this.timer=new vs,this.log=i.child({id:this.id,aws:{lambdaId:r.awsRequestId}})}set(e,r){r==null&&(r=void 0),this.logContext[e]=r}toResponse(e){return e?.body}};var p6=require("url");var m6=de(yo(),1);var ar=class extends ws{constructor(e,r,i){var n;super(e,r,i),this.headers=new Map,this.correlationId=(n=this.header($r.CorrelationId))!==null&&n!==void 0?n:m6.ulid(),this.set("correlationId",this.correlationId)}header(e){return this._isHeadersLoaded!==!0&&(this.loadHeaders(),this._isHeadersLoaded=!0),this.headers.get(e.toLowerCase())}json(){var e;if(this.header(re.ContentType)!==Mn)throw new Error(`Invalid Content-Type: "${this.header("content-type")}"`);if(this.body==null)throw new Error("Cannot parse empty body as JSON");try{return this.isBase64Encoded?JSON.parse(Buffer.from((e=this.body)!==null&&e!==void 0?e:"","base64").toString()):JSON.parse(this.body)}catch{throw new Error("Body is not a JSON object")}}get query(){return this._query==null&&(this._query=this.loadQueryString()),this._query}get url(){return this.path}};var Qo=class extends ar{static is(e){return Bt(e)&&Bt(e.requestContext)&&Bt(e.requestContext.elb)}toResponse(e){return{statusCode:e.status,statusDescription:e.statusDescription,body:e.body,headers:this.toHeaders(e.headers),isBase64Encoded:e.isBase64Encoded}}toHeaders(e){if(e.size===0)return;let r={};for(let i of e)r[i[0]]=i[1];return r}loadHeaders(){if(this.event.headers!=null)for(let[e,r]of Object.entries(this.event.headers))r!=null&&this.headers.set(e.toLowerCase(),r)}loadQueryString(){let e=new p6.URLSearchParams;if(this.event.queryStringParameters==null)return e;for(let[r,i]of Object.entries(this.event.queryStringParameters))e.append(r.toLowerCase(),i??"true");return e}get method(){return this.event.httpMethod.toUpperCase()}get path(){return this.event.path}get body(){return this.event.body}get isBase64Encoded(){return this.event.isBase64Encoded}};var g6=require("url");var hi=class extends ar{static is(e){return!(!Bt(e)||!Bt(e.requestContext)||typeof e.requestContext.apiId!="string"||typeof e.requestContext.resourceId!="string"||typeof e.requestContext.httpMethod!="string")}toResponse(e){return{statusCode:e.status,body:e.body,headers:hi.toHeaders(e),isBase64Encoded:e.isBase64Encoded}}static toHeaders(e){if(e.headers.size===0)return;let r={};for(let i of e.headers)r[i[0]]=i[1];return r}loadHeaders(){if(this.event.headers!=null)for(let[e,r]of Object.entries(this.event.headers))r!=null&&this.headers.set(e.toLowerCase(),r)}loadQueryString(){let e=new g6.URLSearchParams;if(this.event.multiValueQueryStringParameters==null)return e;for(let[r,i]of Object.entries(this.event.multiValueQueryStringParameters))if(i!=null)for(let n of i)e.append(r.toLowerCase(),n);return e}get path(){return this.event.path}get method(){return this.event.httpMethod.toUpperCase()}get body(){return this.event.body}get isBase64Encoded(){return this.event.isBase64Encoded}};var ed=require("url");var ea=class extends ar{static is(e){if(!Bt(e)||!Array.isArray(e.Records))return!1;let r=e.Records[0];return Bt(r)?Bt(r.cf):!1}toResponse(e){if(e.status===100&&this.event!=null){let r=this.event.Records[0].cf.request;for(let[i,n]of e.headers)r.headers[i.toLowerCase()]=[{key:i,value:String(n)}];return this.event.Records[0].cf.request}return{status:String(e.status),statusDescription:e.statusDescription,body:e.body,headers:this.toHeaders(e),bodyEncoding:"text"}}toHeaders(e){if(e.headers.size===0)return{};let r={};for(let i of e.headers)r[i[0]]=[{key:i[0],value:String(i[1])}];return r}loadHeaders(){var e;for(let[r,i]of Object.entries(this.event.Records[0].cf.request.headers))this.headers.set(r.toLowerCase(),(e=i[0])===null||e===void 0?void 0:e.value)}loadQueryString(){let e=this.event.Records[0].cf.request.querystring;return e==null?new ed.URLSearchParams:new ed.URLSearchParams(e.toLowerCase())}get path(){return this.event.Records[0].cf.request.uri}get method(){return this.event.Records[0].cf.request.method.toUpperCase()}get body(){let e=this.event.Records[0].cf.request.body;return e==null?null:e.data}get isBase64Encoded(){var e;return((e=this.event.Records[0].cf.request.body)===null||e===void 0?void 0:e.encoding)==="base64"}};var Q=class{constructor(e,r,i){if(this._body=null,this.headers=new Map,this.status=e,this.statusDescription=r,i!=null)for(let n of Object.keys(i))this.header(n,i[n])}static is(e){return e instanceof Q}static ok(e=200,r="Ok"){return new Q(e,r)}header(e,r){let i=e.toLowerCase();if(r==null)return this.headers.get(i);this.headers.set(i,r)}get isBase64Encoded(){return Buffer.isBuffer(this._body)}json(e){return this.buffer(JSON.stringify(e),Mn),this}buffer(e,r=Mn){return this.header(re.ContentType,r),this._body=e,this}get body(){return this._body==null?(this.header(re.ContentType,Mn),JSON.stringify({id:this.header($r.RequestId),status:this.status,message:this.statusDescription,correlationId:this.header($r.CorrelationId)})):Buffer.isBuffer(this._body)?this._body.toString("base64"):this._body}};var i4=de(r4(),1);var lh=class{constructor(){this.hooks={request:[],response:[]},this.router=(0,i4.default)({defaultRoute:()=>new Q(404,"Not found")})}register(e,r,i){this.router.on(e,r,async(n,o,a)=>n instanceof ar?(n.params=a,uh(n,i)):new Q(500,"Internal server error"))}hook(e,r){this.hooks[e].push(r)}get(e,r){return this.register("GET",e,r)}post(e,r){return this.register("POST",e,r)}delete(e,r){return this.register("DELETE",e,r)}options(e,r){return this.register("OPTIONS",e,r)}patch(e,r){return this.register("PATCH",e,r)}head(e,r){return this.register("HEAD",e,r)}put(e,r){return this.register("PUT",e,r)}async after(e,r){try{for(let i of this.hooks.response)await i(e,r)}catch(i){return Q.is(i)?i:(e.set("err",i),new Q(500,"Internal Server Error"))}return r}async handle(e){for(let i of this.hooks.request){let n=await uh(e,i);if(n)return this.after(e,n)}let r=await this.router.lookup(e,null);return r?this.after(e,r):this.after(e,new Q(404,"Not found"))}};var n4=require("url");var oa=class extends ar{toResponse(e){return{statusCode:e.status,body:e.body,headers:hi.toHeaders(e),isBase64Encoded:e.isBase64Encoded}}loadHeaders(){for(let[e,r]of Object.entries(this.event.headers))this.headers.set(e.toLowerCase(),r)}loadQueryString(){return new n4.URLSearchParams(this.event.rawQueryString)}get method(){return this.event.requestContext.http.method.toUpperCase()}get path(){return this.event.rawPath}get isBase64Encoded(){return this.event.isBase64Encoded}get body(){return this.event.body==null?null:this.event.body}static is(e){return!(!Bt(e)||!Bt(e.requestContext)||!Bt(e.requestContext.http))}};var l4="v6.33.0",hS="a53973b7ac19250dea69402478d4843aa91c4907",s4={version:l4,hash:hS};async function uh(t,e){t.timer.timers.has("lambda")||t.timer.start("lambda");try{return await e(t)}catch(r){return Q.is(r)?r:(t.set("err",r),new Q(500,"Internal Server Error"))}}function o4(t,e){let r=200;Q.is(e)&&(r=e.status,t.set("description",e.statusDescription)),t.set("status",r),t.timer.timers.size>0&&t.set("metrics",t.timer.metrics),s4.hash&&t.set("package",s4);let i=t.timer.timers.has("lambda")?t.timer.end("lambda"):0;return t.set("unfinished",t.timer.unfinished),t.set("duration",i),t.set("@type","report"),r>499?t.log.error(t.logContext,"Lambda:Done"):r>399?t.log.warn(t.logContext,"Lambda:Done"):t.log.info(t.logContext,"Lambda:Done"),e}function cS(t){let e={rejectOnError:!0,tracePercent:0,...t};if(isNaN(e.tracePercent)||e.tracePercent>1)throw new Error("tracePercent is not between 0-1 :"+e.tracePercent);return e}var lr=class{static request(e,r,i){if(Qo.is(e))return new Qo(e,r,i);if(oa.is(e))return new oa(e,r,i);if(hi.is(e))return new hi(e,r,i);if(ea.is(e))return new ea(e,r,i);throw new Error("Request is not a a ALB, ApiGateway or Cloudfront event")}static handler(e,r,i){let n=cS(r);function o(a,h,d){let m=new ws(a,h,i??lr.Logger);n.tracePercent>0&&Math.random()<n.tracePercent&&(m.log.level="trace"),process.env.TRACE_LAMBDA&&(m.log.level="trace"),m.log.trace({event:a},"Lambda:Start");let p=h.awsRequestId;m.set("aws",{lambdaId:p}),uh(m,e).then(M=>{if(o4(m,M),Q.is(M)&&n.rejectOnError){if(m.logContext.err)return d(m.logContext.err);if(M.status>399)return d(m.toResponse(M))}return d(null,m.toResponse(M))})}return o}static http(e){let r=new lh;function i(n,o,a){let h=lr.request(n,o,e??lr.Logger),d=h.header(Xo.CloudfrontId),m=h.header(Xo.TraceId),p=o.awsRequestId;(d||m||p)&&h.set("aws",{cloudFrontId:d,traceId:m,lambdaId:p}),h.set("method",h.method),h.set("path",h.path),r.handle(h).then(M=>{var R;M.status===500&&M.header(re.CacheControl,"no-store"),M.header($r.RequestId,h.id),M.header($r.CorrelationId,h.correlationId);let x=(R=h.timer.metrics)===null||R===void 0?void 0:R.lambda;x!=null&&M.header(re.ServerTiming,`total;dur=${x}`),!M.isBase64Encoded&&M.header(re.ContentType)==null&&M.header(re.ContentType,Mn),lr.ServerName&&M.header(re.Server,`${lr.ServerName}-${l4}`),o4(h,M),a(null,h.toResponse(M))})}return i.router=r,i}};lr.Logger=(0,a4.default)();lr.ServerName="linz";var qe={key(t){return Buffer.isBuffer(t)||typeof t=="string"?Yn(t):Yn(JSON.stringify(t))},isNotModified(t,e){let r=t.header(re.IfNoneMatch);return r!=null&&r.indexOf(e)>-1?(t.set("cache",{hit:!0,match:r}),!0):!1}};var Se=()=>new Q(404,"Not Found"),ct=()=>new Q(304,"Not modified"),u4=()=>new Q(204,"No Content");var fS=.2,aa=class{constructor(e){this.tms=e}async tile(e,r,i,n){let o=[];for(let a of e){let h=this.getTiles(a,r,i,n);h!=null&&(o=o.concat(h))}return o}getRasterTiffIntersection(e,r,i,n){let o=this.tms.tileToPixels(r,i),a=new _e(o.x,o.y,this.tms.tileSize,this.tms.tileSize),h=e.images[0].bbox,d=this.tms.sourceToPixels(h[0],h[3],n),m=this.tms.sourceToPixels(h[2],h[1],n),p=_e.fromUpperLeftLowerRight(d,m),M=p.intersection(a);return M==null?null:{tiff:p,intersection:M,tile:a}}createComposition(e,r,i,n,o){let a=_e.fromJson(e.getTileBounds(r,i)),h=a.scale(n,n).add(o.tiff).round(fS),d=h.intersection(o.tile);if(d==null)return null;let m=d.subtract(h);if(m.height<.5||m.width<.5)return null;let p=h.subtract(o.tile),M={tiff:e.tif,source:{x:r,y:i,imageId:e.id,width:a.width,height:a.height},y:Math.max(0,Math.round(p.y)),x:Math.max(0,Math.round(p.x))};if((a.width<e.tileSize.width||a.height<e.tileSize.height)&&(M.extract={width:a.width,height:a.height}),a.width!==h.width||a.height!==h.height){let R=a.width!==h.width?h.width/a.width:h.height/a.height;M.resize={width:h.width,height:h.height,scale:R}}return(m.y!==0||m.x!==0||m.height!==h.height||m.width!==h.width)&&(M.crop=m),M}getTiles(e,r,i,n){let o=this.getRasterTiffIntersection(e,r,i,n);if(o==null)return null;let a=this.tms.pixelScale(n),h=e.getImageByResolution(a),d=a/h.resolution[0],m=o.intersection.subtract(o.tiff),{tileSize:p,tileCount:M}=h,R=[],x=1/d;for(let w of aa.getRequiredTiles(m,d,p,M)){let E=this.createComposition(h,w.x,w.y,x,o);E!=null&&R.push(E)}return R.length===0?null:R}static*getRequiredTiles(e,r,i,n){let o=Math.max(Math.floor(e.x/i.width*r),0),a=Math.min(Math.ceil(e.right/i.width*r),n.x),h=Math.max(Math.floor(e.y/i.height*r),0),d=Math.min(Math.ceil(e.bottom/i.height*r),n.y);for(let m=o;m<a;m++)for(let p=h;p<d;p++)yield{x:m,y:p}}};var h4=[He.Jpeg,He.Webp,He.Png];function pd(t){if(t==null)return null;let e=t.toLowerCase();return e===He.Png?He.Png:e===He.Webp?He.Webp:e===He.Jpeg||e==="jpg"?He.Jpeg:e===He.Avif?He.Avif:null}var wt={apiKey(t){let e=t.query.get(u1.ApiKey.QueryString)??t.header("X-LINZ-Api-Key"),r=Ep(e);if(!r.valid)throw new Q(400,"API Key Invalid: "+r.message);return t.set("api",e),e},getTileMatrixSet(t){return Zn.find(t)},getRequestedFormats(t){let e=[...t.query.getAll("format"),...t.query.getAll("tileFormat")];if(e.length===0)return null;let r=new Set;for(let i of e){let n=pd(i);n!=null&&r.add(n)}return r.size===0?null:[...r.values()]},getTileFormat(t){let e=pd(t);return e||(t===ir.MapboxVectorTiles?ir.MapboxVectorTiles:null)},xyz(t){wt.apiKey(t),t.set("tileSet",t.params.tileSet);let e=parseInt(t.params.x,10),r=parseInt(t.params.y,10),i=parseInt(t.params.z,10),n=wt.getTileMatrixSet(t.params.tileMatrix);if(n==null)throw new Q(404,"Tile Matrix not found");t.set("tileMatrix",n.identifier),t.set("projection",n.projection.code);let o=wt.getTileFormat(t.params.tileType);if(o==null)throw new Q(404,"Tile extension not found");if(t.set("extension",o),isNaN(i)||i>n.maxZoom||i<0)throw new Q(404,`Zoom not found: ${i}`);let a=n.zooms[i];if(isNaN(e)||e<0||e>a.matrixWidth)throw new Q(404,`X not found: ${e}`);if(isNaN(r)||r<0||r>a.matrixHeight)throw new Q(404,`Y not found: ${r}`);let h={tile:{x:e,y:r,z:i},tileSet:t.params.tileSet,tileMatrix:n,tileType:o};t.set("xyz",h.tile);let d=jr.tileCenterToLatLon(n,h.tile);return t.set("location",d),h}};var dS=1+1e-10,c4=10**8;function gd(t){return Math.round(t*c4)/c4}function mS(t){return[gd(t[0]),gd(t[1])]}function pS(t,e,r){if(Sn.delta(t[0],t[2])<=0)return Sn.bboxToMultiPolygon(t);let i=[];for(let o of e){let a=[_e.fromJson(o).pad(dS).toPolygon()];i=t6(i,a)}return Yu(i,o=>mS(r.toWgs84(o)))}async function gS(t,e,r){let i=jr.get(r),n=[],o=[],a=await we.getAllImagery(e.layers,[r.projection]),h=await we.Provider.get(we.Provider.id("linz"));if(h==null)return null;for(let d of e.layers){let m=d[i.epsg.code];if(m==null)continue;let p=a.get(m);if(p==null)continue;let M=i.boundsToWgs84BoundingBox(p.bounds).map(gd),R=f6(p.name);if(R[0]===-1)throw new Error("Missing date in imagery name: "+p.name);let x=[R.map(C=>`${C}-01-01T00:00:00Z`)],w={spatial:{bbox:[M]},temporal:{interval:x}};o.push({type:"Feature",stac_version:Ka.Version,id:m+"_item",collection:m,assets:{},links:[],bbox:M,geometry:{type:"MultiPolygon",coordinates:pS(M,p.files,i)},properties:{title:p.title??Q0(p.name),category:p.category,datetime:null,start_datetime:x[0][0],end_datetime:x[0][1]}});let E=Mt.convertZoomLevel(d.minZoom?d.minZoom:0,lt,r,!0),T=Mt.convertZoomLevel(d.maxZoom?d.maxZoom:32,lt,r,!0);n.push({stac_version:Ka.Version,license:Ka.License,id:p.id,providers:[{name:h.serviceProvider.name,url:h.serviceProvider.site,roles:["host"]}],title:p.title??Q0(p.name),description:"No description",extent:w,links:[],summaries:{"linz:category":p.category,"linz:zoom":{min:E,max:T},"linz:priority":[1e3+e.layers.indexOf(d)]}})}return{id:e.id,type:"FeatureCollection",stac_version:Ka.Version,stac_extensions:["single-file-stac"],title:e.title??"No title",description:e.description??"No Description",features:o,collections:n,links:[]}}async function yd(t){let e=wt.getTileMatrixSet(t.params.tileMatrix);if(e==null)throw new Q(404,"Tile Matrix not found");t.timer.start("tileset:load");let r=await we.TileSet.get(we.TileSet.id(t.params.tileSet));if(t.timer.end("tileset:load"),r==null||r.type===vt.Vector)return Se();let i=qe.key(r);if(qe.isNotModified(t,i))return ct();t.timer.start("stac:load");let n=await gS(t,r,e);if(t.timer.end("stac:load"),n==null)return Se();let o=new Q(200,"ok");return o.header(re.ETag,i),o.header(re.CacheControl,"public, max-age=604800, stale-while-revalidate=86400"),o.json(n),o}var Ph=de(require("path"),1);var Cr;(function(t){t.NONE="application/octet-stream",t.JPEG="image/jpeg",t.JP2="image/jp2",t.WEBP="image/webp",t.LZW="application/lzw",t.DEFLATE="application/deflate"})(Cr||(Cr={}));var bd={1:Cr.NONE,5:Cr.LZW,6:Cr.JPEG,7:Cr.JPEG,8:Cr.DEFLATE,34712:Cr.JP2,50001:Cr.WEBP};var ae;(function(t){t[t.Artist=315]="Artist",t[t.BitsPerSample=258]="BitsPerSample",t[t.CellLength=265]="CellLength",t[t.CellWidth=264]="CellWidth",t[t.ColorMap=320]="ColorMap",t[t.Compression=259]="Compression",t[t.Copyright=33432]="Copyright",t[t.DateTime=306]="DateTime",t[t.ExtraSamples=338]="ExtraSamples",t[t.FillOrder=266]="FillOrder",t[t.FreeByteCounts=289]="FreeByteCounts",t[t.FreeOffsets=288]="FreeOffsets",t[t.GrayResponseCurve=291]="GrayResponseCurve",t[t.GrayResponseUnit=290]="GrayResponseUnit",t[t.HostComputer=316]="HostComputer",t[t.ImageDescription=270]="ImageDescription",t[t.ImageHeight=257]="ImageHeight",t[t.ImageWidth=256]="ImageWidth",t[t.Make=271]="Make",t[t.MaxSampleValue=281]="MaxSampleValue",t[t.MinSampleValue=280]="MinSampleValue",t[t.Model=272]="Model",t[t.NewSubFileType=254]="NewSubFileType",t[t.Orientation=274]="Orientation",t[t.PhotometricInterpretation=262]="PhotometricInterpretation",t[t.PlanarConfiguration=284]="PlanarConfiguration",t[t.ResolutionUnit=296]="ResolutionUnit",t[t.RowsPerStrip=278]="RowsPerStrip",t[t.SamplesPerPixel=277]="SamplesPerPixel",t[t.Software=305]="Software",t[t.StripByteCounts=279]="StripByteCounts",t[t.StripOffsets=273]="StripOffsets",t[t.SubFileType=255]="SubFileType",t[t.Threshholding=263]="Threshholding",t[t.XResolution=282]="XResolution",t[t.YResolution=283]="YResolution",t[t.BadFaxLines=326]="BadFaxLines",t[t.CleanFaxData=327]="CleanFaxData",t[t.ClipPath=343]="ClipPath",t[t.ConsecutiveBadFaxLines=328]="ConsecutiveBadFaxLines",t[t.Decode=433]="Decode",t[t.DefaultImageColor=434]="DefaultImageColor",t[t.DocumentName=269]="DocumentName",t[t.DotRange=336]="DotRange",t[t.HalftoneHints=321]="HalftoneHints",t[t.Indexed=346]="Indexed",t[t.JPEGTables=347]="JPEGTables",t[t.PageName=285]="PageName",t[t.PageNumber=297]="PageNumber",t[t.Predictor=317]="Predictor",t[t.PrimaryChromaticities=319]="PrimaryChromaticities",t[t.ReferenceBlackWhite=532]="ReferenceBlackWhite",t[t.SampleFormat=339]="SampleFormat",t[t.SMinSampleValue=340]="SMinSampleValue",t[t.SMaxSampleValue=341]="SMaxSampleValue",t[t.StripRowCounts=559]="StripRowCounts",t[t.SubIFDs=330]="SubIFDs",t[t.T4Options=292]="T4Options",t[t.T6Options=293]="T6Options",t[t.TileByteCounts=325]="TileByteCounts",t[t.TileHeight=323]="TileHeight",t[t.TileOffsets=324]="TileOffsets",t[t.TileWidth=322]="TileWidth",t[t.TransferFunction=301]="TransferFunction",t[t.WhitePoint=318]="WhitePoint",t[t.XClipPathUnits=344]="XClipPathUnits",t[t.XPosition=286]="XPosition",t[t.YCbCrCoefficients=529]="YCbCrCoefficients",t[t.YCbCrPositioning=531]="YCbCrPositioning",t[t.YCbCrSubSampling=530]="YCbCrSubSampling",t[t.YClipPathUnits=345]="YClipPathUnits",t[t.YPosition=287]="YPosition",t[t.ApertureValue=37378]="ApertureValue",t[t.ColorSpace=40961]="ColorSpace",t[t.DateTimeDigitized=36868]="DateTimeDigitized",t[t.DateTimeOriginal=36867]="DateTimeOriginal",t[t.ExifIFD=34665]="ExifIFD",t[t.ExifVersion=36864]="ExifVersion",t[t.ExposureTime=33434]="ExposureTime",t[t.FileSource=41728]="FileSource",t[t.Flash=37385]="Flash",t[t.FlashpixVersion=40960]="FlashpixVersion",t[t.FNumber=33437]="FNumber",t[t.ImageUniqueID=42016]="ImageUniqueID",t[t.LightSource=37384]="LightSource",t[t.MakerNote=37500]="MakerNote",t[t.ShutterSpeedValue=37377]="ShutterSpeedValue",t[t.UserComment=37510]="UserComment",t[t.IPTC=33723]="IPTC",t[t.ICCProfile=34675]="ICCProfile",t[t.XMP=700]="XMP",t[t.GDAL_METADATA=42112]="GDAL_METADATA",t[t.GDAL_NODATA=42113]="GDAL_NODATA",t[t.Photoshop=34377]="Photoshop",t[t.ModelPixelScale=33550]="ModelPixelScale",t[t.ModelTiePoint=33922]="ModelTiePoint",t[t.ModelTransformation=34264]="ModelTransformation",t[t.GeoKeyDirectory=34735]="GeoKeyDirectory",t[t.GeoDoubleParams=34736]="GeoDoubleParams",t[t.GeoAsciiParams=34737]="GeoAsciiParams"})(ae||(ae={}));var P1;(function(t){t[t.GTModelTypeGeoKey=1024]="GTModelTypeGeoKey",t[t.GTRasterTypeGeoKey=1025]="GTRasterTypeGeoKey",t[t.GTCitationGeoKey=1026]="GTCitationGeoKey",t[t.GeographicTypeGeoKey=2048]="GeographicTypeGeoKey",t[t.GeogCitationGeoKey=2049]="GeogCitationGeoKey",t[t.GeogGeodeticDatumGeoKey=2050]="GeogGeodeticDatumGeoKey",t[t.GeogPrimeMeridianGeoKey=2051]="GeogPrimeMeridianGeoKey",t[t.GeogLinearUnitsGeoKey=2052]="GeogLinearUnitsGeoKey",t[t.GeogLinearUnitSizeGeoKey=2053]="GeogLinearUnitSizeGeoKey",t[t.GeogAngularUnitsGeoKey=2054]="GeogAngularUnitsGeoKey",t[t.GeogAngularUnitSizeGeoKey=2055]="GeogAngularUnitSizeGeoKey",t[t.GeogEllipsoidGeoKey=2056]="GeogEllipsoidGeoKey",t[t.GeogSemiMajorAxisGeoKey=2057]="GeogSemiMajorAxisGeoKey",t[t.GeogSemiMinorAxisGeoKey=2058]="GeogSemiMinorAxisGeoKey",t[t.GeogInvFlatteningGeoKey=2059]="GeogInvFlatteningGeoKey",t[t.GeogAzimuthUnitsGeoKey=2060]="GeogAzimuthUnitsGeoKey",t[t.GeogPrimeMeridianLongGeoKey=2061]="GeogPrimeMeridianLongGeoKey",t[t.GeogTOWGS84GeoKey=2062]="GeogTOWGS84GeoKey",t[t.ProjectedCSTypeGeoKey=3072]="ProjectedCSTypeGeoKey",t[t.PCSCitationGeoKey=3073]="PCSCitationGeoKey",t[t.ProjectionGeoKey=3074]="ProjectionGeoKey",t[t.ProjCoordTransGeoKey=3075]="ProjCoordTransGeoKey",t[t.ProjLinearUnitsGeoKey=3076]="ProjLinearUnitsGeoKey",t[t.ProjLinearUnitSizeGeoKey=3077]="ProjLinearUnitSizeGeoKey",t[t.ProjStdParallel1GeoKey=3078]="ProjStdParallel1GeoKey",t[t.ProjStdParallel2GeoKey=3079]="ProjStdParallel2GeoKey",t[t.ProjNatOriginLongGeoKey=3080]="ProjNatOriginLongGeoKey",t[t.ProjNatOriginLatGeoKey=3081]="ProjNatOriginLatGeoKey",t[t.ProjFalseEastingGeoKey=3082]="ProjFalseEastingGeoKey",t[t.ProjFalseNorthingGeoKey=3083]="ProjFalseNorthingGeoKey",t[t.ProjFalseOriginLongGeoKey=3084]="ProjFalseOriginLongGeoKey",t[t.ProjFalseOriginLatGeoKey=3085]="ProjFalseOriginLatGeoKey",t[t.ProjFalseOriginEastingGeoKey=3086]="ProjFalseOriginEastingGeoKey",t[t.ProjFalseOriginNorthingGeoKey=3087]="ProjFalseOriginNorthingGeoKey",t[t.ProjCenterLongGeoKey=3088]="ProjCenterLongGeoKey",t[t.ProjCenterLatGeoKey=3089]="ProjCenterLatGeoKey",t[t.ProjCenterEastingGeoKey=3090]="ProjCenterEastingGeoKey",t[t.ProjCenterNorthingGeoKey=3091]="ProjCenterNorthingGeoKey",t[t.ProjScaleAtNatOriginGeoKey=3092]="ProjScaleAtNatOriginGeoKey",t[t.ProjScaleAtCenterGeoKey=3093]="ProjScaleAtCenterGeoKey",t[t.ProjAzimuthAngleGeoKey=3094]="ProjAzimuthAngleGeoKey",t[t.ProjStraightVertPoleLongGeoKey=3095]="ProjStraightVertPoleLongGeoKey",t[t.ProjRectifiedGridAngleGeoKey=3096]="ProjRectifiedGridAngleGeoKey",t[t.VerticalCSTypeGeoKey=4096]="VerticalCSTypeGeoKey",t[t.VerticalCitationGeoKey=4097]="VerticalCitationGeoKey",t[t.VerticalDatumGeoKey=4098]="VerticalDatumGeoKey",t[t.VerticalUnitsGeoKey=4099]="VerticalUnitsGeoKey"})(P1||(P1={}));var Ae;(function(t){t[t.BYTE=1]="BYTE",t[t.ASCII=2]="ASCII",t[t.SHORT=3]="SHORT",t[t.LONG=4]="LONG",t[t.RATIONAL=5]="RATIONAL",t[t.SBYTE=6]="SBYTE",t[t.UNDEFINED=7]="UNDEFINED",t[t.SSHORT=8]="SSHORT",t[t.SLONG=9]="SLONG",t[t.SRATIONAL=10]="SRATIONAL",t[t.FLOAT=11]="FLOAT",t[t.DOUBLE=12]="DOUBLE",t[t.LONG8=16]="LONG8",t[t.SLONG8=17]="SLONG8",t[t.IFD8=18]="IFD8"})(Ae||(Ae={}));var be;(function(t){t[t.UInt8=1]="UInt8",t[t.UInt16=2]="UInt16",t[t.UInt32=4]="UInt32",t[t.UInt64=8]="UInt64",t[t.Double=8]="Double",t[t.Float=4]="Float"})(be||(be={}));var f4=2**32,yS=typeof setImmediate>"u"?setTimeout:setImmediate,Dt=()=>{throw new Error("Method not implemented.")},ci=class{constructor(){this.isLittleEndian=!0,this.delayMs=ci.DefaultDelayMs,this.maxChunkCount=10,this.chunks=ci.DefaultChunkCache(),this.blankFillCount=16,this.maxConcurrentRequests=50,this.toFetch=new Set,this.toFetchPromise=null,this.byteOffset=0,this.getFloat32=Dt,this.getFloat64=Dt,this.getInt8=Dt,this.getInt16=Dt,this.getInt32=Dt,this.setFloat32=Dt,this.setFloat64=Dt,this.setInt8=Dt,this.setInt16=Dt,this.setInt32=Dt,this.setUint8=Dt,this.setUint16=Dt,this.setUint32=Dt,this.setBigInt64=Dt,this.setBigUint64=Dt}static getByteRanges(e,r=32,i=16){if(e.size===0)return{chunks:[],blankFill:[]};let n=[...e.values()].sort((d,m)=>d-m),o=[],a=[];o.push(a);let h=[];for(let d=0;d<n.length;++d){let m=n[d],p=n[d-1];if(a.length>=r)a=[m],o.push(a);else if(d===0||m===p+1)a.push(m);else if(m<p+i){for(let M=p;M<m;M++)a.push(M+1),h.push(M+1);h.pop()}else a=[m],o.push(a)}return{chunks:o,blankFill:h}}async fetchData(){if(this.toFetch.size===0)return;let e=this.toFetch;this.toFetch=new Set,this.toFetchPromise=null;let r=ci.getByteRanges(e,this.maxChunkCount,this.blankFillCount),i=[];for(let n of r.chunks){let o=n[0],a=n[n.length-1],h=o*this.chunkSize,d=a*this.chunkSize+this.chunkSize-h,m=await this.fetchBytes(h,d);if(n.length===1){i[o]=m,this.chunks.set(o,new DataView(m));continue}let p=o*this.chunkSize;for(let M of n){let R=M*this.chunkSize-p,x=m.slice(R,R+this.chunkSize);i[M]=x,this.chunks.set(M,new DataView(x))}}}async loadBytes(e,r){if(e<0)throw new Error("Offset must be positive");let i=Math.floor(e/this.chunkSize),n=Math.ceil((e+r)/this.chunkSize)-1;for(let o=i;o<=n;o++)this.chunks.has(o)||this.toFetch.add(o);if(this.toFetch.size!==0){if(this.toFetchPromise==null&&(this.toFetchPromise=new Promise(o=>yS(o,this.delayMs)).then(()=>this.fetchData())),this.toFetch.size>this.maxConcurrentRequests)throw new Error("Too many outstanding requests");await this.toFetchPromise}}getChunkId(e){return Math.floor(e/this.chunkSize)}getUint(e,r){switch(r){case be.UInt8:return this.getUint8(e);case be.UInt16:return this.getUint16(e);case be.UInt32:return this.getUint32(e);case be.UInt64:return this.getUint64(e)}}bytes(e,r){let i=this.isOneChunk(e,r);if(i){let m=this.getView(i),p=e-i*this.chunkSize;return new Uint8Array(m.buffer.slice(p,p+r))}let n=new Uint8Array(r),o=e+r,a=Math.floor(e/this.chunkSize),h=Math.ceil((e+r)/this.chunkSize)-1,d=0;for(let m=a;m<=h;m++){let p=e+d,M=m*this.chunkSize,R=this.getView(m),x=Math.min(o,M+this.chunkSize),w=R.buffer.slice(p-M,x-M);n.set(new Uint8Array(w),d),d+=w.byteLength}return n}getView(e){let r=this.chunks.get(e);if(r==null)throw new Error(`Chunk:${e} is not ready`);return r}isOneChunk(e,r){let i=e+r-1,n=Math.floor(e/this.chunkSize);return Math.floor(i/this.chunkSize)-n<1?n:null}hasBytes(e,r=1){let i=Math.floor(e/this.chunkSize),n=Math.ceil((e+r)/this.chunkSize)-1;for(let o=i;o<=n;o++)if(!this.chunks.has(o))return!1;return!0}toRange(e,r){if(r==null)return`bytes=${e}`;if(e<0)throw new Error("Cannot read from remote source with negative offset and length");return`bytes=${e}-${e+r}`}parseContentRange(e){let[r,i]=e.split(" ");if(r!=="bytes")throw new Error("Failed to parse content-range: "+e);if(i==null)throw new Error("Failed to parse content-range: "+e);let[,n]=i.split("/"),o=Number(n);if(isNaN(o))throw new Error("Failed to parse content-range: "+e);return o}get buffer(){throw new Error("Method not implemented.")}get byteLength(){if(this._byteLength)return this._byteLength;throw Error(".size() has not been fetched.")}getUint8(e){let r=Math.floor(e/this.chunkSize),i=this.chunks.get(r);if(i==null)throw new Error(`Chunk:${r} is not ready`);return i.getUint8(e-r*this.chunkSize)}getUint16(e){let r=this.isOneChunk(e,be.UInt16);if(r!=null)return this.getView(r).getUint16(e-r*this.chunkSize,this.isLittleEndian);let i=this.getUint8(e),n=this.getUint8(e+be.UInt8);return this.isLittleEndian?i+(n<<8):(i<<8)+n}getUint32(e){let r=this.isOneChunk(e,be.UInt32);if(r!=null)return this.getView(r).getUint32(e-r*this.chunkSize,this.isLittleEndian);let i=this.getUint16(e),n=this.getUint16(e+be.UInt16);return this.isLittleEndian?i+n*65536:i*65536+n}getUint64(e){let r=this.isOneChunk(e,be.UInt64);if(r!=null){let o=this.getView(r);return Number(o.getBigUint64(e-r*this.chunkSize,this.isLittleEndian))}let i=this.getUint32(e),n=this.getUint32(e+be.UInt32);return this.isLittleEndian?i+n*f4:i*f4+n}getBigUint64(e){let r=this.isOneChunk(e,be.UInt64);if(r!=null)return this.getView(r).getBigUint64(e-r*this.chunkSize,this.isLittleEndian);let i=BigInt(this.getUint32(e)),n=BigInt(this.getUint32(e+be.UInt32));return this.isLittleEndian?i+(n<<BigInt(32)):(i<<BigInt(32))+n}getBigInt64(){throw new Error("Not implemented.")}};ci.DefaultChunkCache=()=>new Map;ci.DefaultDelayMs=1;var d4=de(wd(),1);function m4(t){switch(t){case Ae.BYTE:case Ae.ASCII:case Ae.SBYTE:case Ae.UNDEFINED:return 1;case Ae.SHORT:case Ae.SSHORT:return 2;case Ae.LONG:case Ae.SLONG:case Ae.FLOAT:return 4;case Ae.RATIONAL:case Ae.SRATIONAL:case Ae.DOUBLE:case Ae.LONG8:case Ae.SLONG8:case Ae.IFD8:return 8;default:throw new Error(`Invalid fieldType ${t}`)}}var Ss={char:(t,e)=>String.fromCharCode(t.getUint8(e)),uint8:(t,e)=>t.getUint8(e),uint16:(t,e)=>t.getUint16(e),uint32:(t,e)=>t.getUint32(e),uint64:(t,e)=>t.getUint64(e),double:(t,e)=>d4.read(t.bytes(e,be.Double),0,t.isLittleEndian,52,8),rational:(t,e)=>[t.getUint32(e),t.getUint32(e+4)]};function hh(t){switch(t){case Ae.ASCII:return Ss.char;case Ae.BYTE:case Ae.UNDEFINED:case Ae.SBYTE:return Ss.uint8;case Ae.SHORT:case Ae.SSHORT:return Ss.uint16;case Ae.LONG:case Ae.SLONG:return Ss.uint32;case Ae.RATIONAL:case Ae.SRATIONAL:return Ss.rational;case Ae.DOUBLE:return Ss.double;case Ae.LONG8:return Ss.uint64;default:throw new Error(`Unknown read type "${t}" "${Ae[t]}"`)}}var Rn=class{constructor(e,r,i){this.tiff=r,this.byteOffset=i,this.id=e,this.name=ae[this.id],this.dataType=this.tiff.source.getUint16(i+2),this.dataCount=this.tiff.source.getUint(i+4,this.tiff.ifdConfig.pointer),this.dataTypeSize=m4(this.dataType),this.dataLength=this.dataTypeSize*this.dataCount}get hasBytes(){return this.tiff.source.hasBytes(this.valuePointer,this.dataLength)}get isReady(){return!0}get dataTypeName(){return Ae[this.dataType]}get valuePointer(){let e=this.size-this.tiff.ifdConfig.pointer;return this.isValueInline?this.byteOffset+e:this.tiff.source.getUint(this.byteOffset+e,this.tiff.ifdConfig.pointer)}get size(){return this.tiff.ifdConfig.ifd}get isValueInline(){return this.dataLength<=this.tiff.ifdConfig.pointer}readValue(){let e=this.valuePointer,r=this.dataTypeSize,i=hh(this.dataType),n=this.dataCount,o=n*r;if(n===1)return i(this.tiff.source,e);let a=[];for(let h=0;h<o;h+=r)a.push(i(this.tiff.source,e+h));return this.dataType===Ae.ASCII?a.join("").trim():a}toJSON(){return{id:this.id,name:this.name,offset:this.byteOffset,isReady:this.isReady,type:this.dataTypeName,value:this.value}}};var Ms=class extends Rn{constructor(){super(...arguments),this.value=null}get isReady(){return this.value!=null}async fetch(){return this.tiff.source.hasBytes(this.valuePointer,this.dataLength)===!1&&await this.tiff.source.loadBytes(this.valuePointer,this.dataLength),this.value=this.readValue(),this.value}};var O1=class extends Rn{constructor(e,r,i){super(e,r,i),this.loadedValues=null}get value(){return this.loadedValues!=null?this.loadedValues:this.hasBytes?(this.readValue(),this.loadedValues):null}async load(){await this.tiff.source.loadBytes(this.valuePointer,this.dataLength),this.readValue()}readValue(){let e=super.readValue();return typeof e=="number"?this.loadedValues=[e]:this.loadedValues=e,this.loadedValues}async getValueAt(e){if(this.loadedValues)return this.loadedValues[e];let r=this.dataTypeSize,i=this.valuePointer+r*e,n=hh(this.dataType);return this.tiff.source.hasBytes(i,r)||await this.tiff.source.loadBytes(i,r),n(this.tiff.source,i)}};var k1=class extends Rn{constructor(){super(...arguments),this._isRead=!1,this._value=null}get value(){return this._isRead===!1&&(this._value=this.readValue(),this._isRead=!0),this._value}};var ch={create(t,e){let r=t.source.getUint16(e);if(r===ae.TileOffsets||r===ae.TileByteCounts||r===ae.StripByteCounts||r===ae.StripOffsets)return new O1(r,t,e);let i=new k1(r,t,e);return i.hasBytes?i:new Ms(r,t,e)},isStatic(t){return t instanceof k1},isLazy(t){return t instanceof Ms},isOffsetArray(t){return t instanceof O1}};var bS=32767,fh=class{constructor(e,r,i){this.tagsGeoLoaded=!1,this.tagsGeo=new Map,this.tif=e,this.id=r,this.tags=i}async init(e=!1){let r=[this.fetch(ae.Compression),this.fetch(ae.ImageHeight),this.fetch(ae.ImageWidth),this.fetch(ae.ModelPixelScale),this.fetch(ae.ModelTiePoint),this.fetch(ae.ModelTransformation),this.fetch(ae.TileHeight),this.fetch(ae.TileWidth)];e&&(r.push(this.fetch(ae.GeoKeyDirectory)),r.push(this.fetch(ae.GeoAsciiParams)),r.push(this.fetch(ae.GeoDoubleParams))),await Promise.all(r),e&&await this.loadGeoTiffTags()}value(e){let r=this.tags.get(e);return r==null?null:r.value}async loadGeoTiffTags(){if(this.tagsGeoLoaded)return;let e=this.tags.get(ae.GeoKeyDirectory);if(e==null){this.tagsGeoLoaded=!0;return}if(!e.isReady&&e instanceof Ms&&await Promise.all([this.fetch(ae.GeoKeyDirectory),this.fetch(ae.GeoAsciiParams),this.fetch(ae.GeoDoubleParams)]),this.tagsGeoLoaded=!0,e.value==null)return;let r=e.value;if(!Array.isArray(r))throw new Error("Invalid geo tags found");for(let i=4;i<=r[3]*4;i+=4){let n=r[i],o=r[i+1],a=r[i+3];if(o===0){this.tagsGeo.set(n,a);continue}let h=this.tags.get(o);if(h==null||h.value==null)continue;let d=r[i+2];Array.isArray(h.value)?this.tagsGeo.set(n,h.value[a+d-1]):typeof h.value=="string"&&this.tagsGeo.set(n,h.value.substr(a,a+d-1).trim())}}valueGeo(e){if(this.tagsGeoLoaded===!1)throw new Error("loadGeoTiffTags() has not been called");return this.tagsGeo.get(e)}async fetch(e){let r=this.tags.get(e);return r==null?null:ch.isLazy(r)?r.fetch():r.value}get origin(){let e=this.value(ae.ModelTiePoint);if(e!=null&&e.length===6)return[e[3],e[4],e[5]];let r=this.value(ae.ModelTransformation);if(r!=null)return[r[3],r[7],r[11]];if(this.value(ae.NewSubFileType)===1&&this.id!==0)return this.tif.images[0].origin;throw new Error("Image does not have a geo transformation.")}get isGeoLocated(){return this.value(ae.ModelPixelScale)!=null||this.value(ae.ModelTransformation)!=null?!0:this.value(ae.NewSubFileType)===1&&this.id!==0?this.tif.images[0].isGeoLocated:!1}get resolution(){let e=this.value(ae.ModelPixelScale);if(e!=null)return[e[0],-e[1],e[2]];let r=this.value(ae.ModelTransformation);if(r!=null)return[r[0],r[5],r[10]];if(this.value(ae.NewSubFileType)===1&&this.id!==0){let i=this.tif.images[0],[n,o,a]=i.resolution,h=i.size,d=this.size;return[n*h.width/d.width,o*h.height/d.height,a]}throw new Error("Image does not have a geo transformation.")}get bbox(){let e=this.size,r=this.origin,i=this.resolution;if(r==null||e==null||i==null)throw new Error("Unable to calculate bounding box");let n=r[0],o=r[1],a=n+i[0]*e.width,h=o+i[1]*e.height;return[Math.min(n,a),Math.min(o,h),Math.max(n,a),Math.max(o,h)]}get compression(){let e=this.value(ae.Compression);return e==null||typeof e!="number"?null:bd[e]}get epsg(){let e=this.valueGeo(P1.ProjectedCSTypeGeoKey);return e===bS?null:e}get size(){return{width:this.value(ae.ImageWidth),height:this.value(ae.ImageHeight)}}get tagList(){return[...this.tags.keys()].map(e=>ae[e])}isTiled(){return this.value(ae.TileWidth)!==null}get tileSize(){return{width:this.value(ae.TileWidth),height:this.value(ae.TileHeight)}}get tileCount(){let e=this.size,r=this.tileSize,i=Math.ceil(e.width/r.width),n=Math.ceil(e.height/r.height);return{x:i,y:n}}get tileOffset(){let e=this.tags.get(ae.TileOffsets);if(e==null)throw new Error("No tile offsets found");return e}get stripCount(){let e=this.tags.get(ae.StripByteCounts);return e==null?0:e.dataCount}async getTileOffset(e){let r=this.tileOffset;if(e<0||e>r.dataCount)throw new Error(`Tile offset: ${e} out of range: 0 -> ${r.dataCount}`);return r.getValueAt(e)}getTileBounds(e,r){let{size:i,tileSize:n}=this,o=r*n.height,a=e*n.width,h=a+n.width>=i.width?i.width-a:n.width,d=o+n.height>=i.height?i.height-o:n.height;return{x:a,y:o,width:h,height:d}}async getStrip(e){if(this.isTiled())throw new Error("Cannot read stripes, tiff is tiled");let r=this.tags.get(ae.StripByteCounts),i=this.tags.get(ae.StripOffsets);if(e>=r.dataCount)throw new Error("Cannot read strip, index out of bounds");let[n,o]=await Promise.all([i.getValueAt(e),r.getValueAt(e)]);return this.getBytes(n,o)}getJpegHeader(e){let r=this.value(ae.JPEGTables);if(r==null)throw new Error("Unable to find Jpeg header");let i=r.slice(0,r.length-2),n=new Uint8Array(e.byteLength+i.length-2);return n.set(i,0),n.set(e.slice(2),i.length),n}async getBytes(e,r){let i=this.compression;if(i==null)throw new Error("Unsupported compression: "+this.value(ae.Compression));if(r===0)return null;await this.tif.source.loadBytes(e,r);let n=this.tif.source.bytes(e,r);return this.compression===Cr.JPEG?{mimeType:i,bytes:this.getJpegHeader(n)}:{mimeType:i,bytes:n}}async getTile(e,r){let i=this.compression,n=this.size,o=this.tileSize;if(o==null)throw new Error("Tiff is not tiled");if(i==null)throw new Error("Unsupported compression: "+this.value(ae.Compression));let a=Math.ceil(n.height/o.height),h=Math.ceil(n.width/o.width);if(e>=h||r>=a)throw new Error(`Tile index is outside of range x:${e} >= ${h} or y:${r} >= ${a}`);let d=r*h+e,m=h*a;if(d>=m)throw new Error(`Tile index is outside of tile range: ${d} >= ${m}`);let{offset:p,imageSize:M}=await this.getTileSize(d);return this.getBytes(p,M)}async getTileSize(e){if(this.tif.options.tileLeaderByteSize){let o=await this.getTileOffset(e);if(o===0)return{offset:0,imageSize:0};let a=this.tif.options.tileLeaderByteSize;return await this.tif.source.loadBytes(o-a,a),{offset:o,imageSize:this.tif.source.getUint(o-a,a)}}let r=this.tags.get(ae.TileByteCounts);if(r==null)throw new Error("No tile byte counts found");let[i,n]=await Promise.all([this.getTileOffset(e),r.getValueAt(e)]);return{offset:i,imageSize:n}}};var L1;(function(t){t[t.Big=19789]="Big",t[t.Little=18761]="Little"})(L1||(L1={}));var Ar;(function(t){t[t.BigTiff=43]="BigTiff",t[t.Tiff=42]="Tiff"})(Ar||(Ar={}));var _d="__reverse";function p4(t,e){if(t[_d]==null){let r={};for(let i of Object.keys(t)){let n=t[i];r[n]=i}Object.defineProperty(t,_d,{enumerable:!1,value:r,writable:!1})}return t[_d][e]}var Cn;(function(t){t.GDAL_STRUCTURAL_METADATA_SIZE="GDAL_STRUCTURAL_METADATA_SIZE",t.LAYOUT="LAYOUT",t.BLOCK_ORDER="BLOCK_ORDER",t.BLOCK_LEADER="BLOCK_LEADER",t.BLOCK_TRAILER="BLOCK_TRAILER",t.KNOWN_INCOMPATIBLE_EDITION="KNOWN_INCOMPATIBLE_EDITION",t.MASK_INTERLEAVED_WITH_IMAGERY="MASK_INTERLEAVED_WITH_IMAGERY"})(Cn||(Cn={}));var xd;(function(t){t.RowMajor="ROW_MAJOR"})(xd||(xd={}));var Sd;(function(t){t.uint32="SIZE_AS_UINT4"})(Sd||(Sd={}));var vS={uint32:be.UInt32},dh=class{constructor(){this.options=new Map}get isCogOptimized(){return this.isBroken?!1:this.options.get(Cn.LAYOUT)==="IFDS_BEFORE_DATA"}get isBroken(){return this.options.get(Cn.KNOWN_INCOMPATIBLE_EDITION)==="YES"}set(e,r){this.options.set(e,r)}process(e,r,i){let n=[];for(let a=r;a<r+i;a++){let h=e.getUint8(a);h!==0&&n.push(String.fromCharCode(h))}let o=n.join("").trim().split(`
184
+ `).map(a=>a.split("="));for(let[a,h]of o)this.options.set(Cn[a],h)}_getReverse(e,r){let i=this.options.get(r);return i==null?null:p4(e,i)}get tileOrder(){return this._getReverse(xd,Cn.BLOCK_ORDER)}get tileLeader(){return this._getReverse(Sd,Cn.BLOCK_LEADER)}get tileLeaderByteSize(){return this.tileLeader==null?null:vS[this.tileLeader]}get isMaskInterleaved(){return this.options.get(Cn.MASK_INTERLEAVED_WITH_IMAGERY)==="YES"}};var Md={version:Ar.Tiff,pointer:be.UInt32,offset:be.UInt16,ifd:be.UInt16+be.UInt16+2*be.UInt32},Ed={version:Ar.BigTiff,pointer:be.UInt64,offset:be.UInt64,ifd:be.UInt16+be.UInt16+2*be.UInt64},_k={[Ar.BigTiff]:Ed,[Ar.Tiff]:Md};var Rd=de(wd(),1),mh=class{constructor(e,r=0){this.tiff=e,this.byteOffset=r,this.relativeOffset=0}get currentOffset(){return this.byteOffset+this.relativeOffset}seekTo(e){return this.byteOffset=e,this.relativeOffset=0,this}seek(e){let r=this.currentOffset;return this.relativeOffset+=e,r}bytes(e){return this.tiff.source.bytes(this.seek(e),e)}uint(e){return this.tiff.source.getUint(this.seek(e),e)}uint8(){return this.tiff.source.getUint8(this.seek(be.UInt8))}uint16(){return this.tiff.source.getUint16(this.seek(be.UInt16))}uint32(){return this.tiff.source.getUint32(this.seek(be.UInt32))}uint64(){return this.tiff.source.getUint64(this.seek(be.UInt64))}pointer(){let e=this.tiff.ifdConfig.pointer;return this.tiff.source.getUint(this.seek(e),e)}offset(){let e=this.tiff.ifdConfig.offset;return this.tiff.source.getUint(this.seek(e),e)}float(){return Rd.read(this.bytes(be.Float),0,this.tiff.source.isLittleEndian,23,4)}double(){return Rd.read(this.bytes(be.Double),0,this.tiff.source.isLittleEndian,52,8)}};function g4(t,e=4,r=!0){let i=t.toString(16).padStart(e,"0");return r?"0x"+i:i}var la=class{constructor(e){this.version=Ar.Tiff,this.images=[],this.options=new dh,this.ifdConfig=Md,this.isInitialized=!1,this.source=e,this.cursor=new mh(this)}static create(e){return new la(e).init()}init(e=!1){return this._initPromise?this._initPromise:(this._initPromise=this.doInit(e),this._initPromise)}async doInit(e=!1){return this.isInitialized?this:(await this.source.loadBytes(0,this.source.chunkSize),await this.fetchIfd(),await Promise.all(this.images.map(r=>r.init(e))),this.isInitialized=!0,this)}async fetchIfd(){let e=this.cursor.seekTo(0),r=e.uint16();if(this.source.isLittleEndian=r===L1.Little,!this.source.isLittleEndian)throw new Error("Only little endian is supported");this.version=e.uint16();let i;if(this.version===Ar.BigTiff){if(this.ifdConfig=Ed,e.uint16()!==8)throw new Error("Only 8byte pointers are supported");if(e.uint16()!==0)throw new Error("Invalid big tiff header");i=e.pointer()}else if(this.version===Ar.Tiff)i=e.pointer();else throw new Error(`Only tiff supported version:${this.version}`);let n=i-this.cursor.currentOffset;return n>0&&n<16*1024,this.processIfd(i)}getImage(e){return this.images[e]}getImageByResolution(e){let r=this.images[0],i=r.size,[n]=r.resolution,o=n*i.width;for(let a=this.images.length-1;a>0;a--){let h=this.images[a],d=h.size;if(o/d.width-e<=.01)return h}return r}async getTile(e,r,i){let n=this.getImage(i);if(n==null)throw new Error(`Missing z: ${i}`);if(!n.isTiled())throw new Error("Tif is not tiled");return n.getTile(e,r)}async processIfd(e){this.source.hasBytes(e,4096)||await this.source.loadBytes(e,4096);let{image:r,nextOffset:i}=await this.readIfd(e);this.images.push(r),i&&await this.processIfd(i)}async readIfd(e){this.source.hasBytes(e,1024)||await this.source.loadBytes(e,this.source.chunkSize);let i=this.cursor.seekTo(e).offset(),n=e+this.ifdConfig.offset,o=new Map,a=n;for(let m=0;m<i;m++){let p=ch.create(this,a);if(a+=p.size,p.name==null)throw new Error("Unknown IFD Tag: "+g4(p.id));o.set(p.id,p)}let h=new fh(this,this.images.length,o);return{nextOffset:this.source.getUint(a,this.ifdConfig.pointer),image:h}}async close(){var e,r;await((r=(e=this.source)===null||e===void 0?void 0:e.close)===null||r===void 0?void 0:r.call(e))}};var Le=class{constructor(e){this.name=e}raw(e,r=0){return this.parse(e,{offset:r,startOffset:0})}read(e,r=0){let i={offset:r,startOffset:r};return{value:this.parse(e,i),offset:i.offset}}refine(e){return new Cd(this,e)}},Cd=class extends Le{constructor(e,r){super("Function:"+e.name),this.input=e,this.cb=r}get size(){return this.input.size}parse(e,r){let i=this.input.parse(e,r);return this.cb(i,e,r)}};var ph=class extends Le{constructor(e,r,i){super(`Array:${e}:${r.name}x${i}`),this.count=i,this.type=r}get size(){return this.count*this.type.size}parse(e,r){let i=[];for(let n=0;n<this.count;n++)i.push(this.type.parse(e,r));return i}},gh=class extends Le{constructor(e,r,i,n){super("Array:Offset:"+e),this.isLookupRequired=!0,this.isMaxLength=n,this.lengthName=i,this.type=r}get size(){throw new Error("Unable to calculate size of dynamic object: "+this.name)}parse(e,r,i){let n=[],o=i?.[this.lengthName];if(o==null||typeof o!="number")throw new Error(`${this.name}: Missing variable a "${this.lengthName}"`);this.isMaxLength&&(o-=r.offset-r.startOffset);for(let a=0;a<o;a++)n.push(this.type.parse(e,r));return n}};var y4=[];for(let t=0;t<64;t++)y4[t]=Math.pow(2,t);var N1=class{constructor(e,r=0,i=e.length,n=!0){if(this.buffer=e,this.offset=r*8,this.maxOffset=i*8,this.isLittleEndian=n,!this.isLittleEndian)throw new Error("BigEndian is not supported")}get remainingBits(){return this.maxOffset-this.offset}getBitValue(e,r,i){return(e&((1<<r+i)-1&~((1<<r)-1)))>>r}skip(e){this.offset+=e}bit(){if(this.remainingBits<0)throw new Error("BitStream: Overflow "+this.remainingBits);let e=Math.floor(this.offset/8),r=this.offset%8,i=this.buffer[e];return this.offset++,this.getBitValue(i,r,1)}bool(){return this.bit()===1}bits(e){let r=e,i=0;for(;e>0;)this.bit()===1&&(i+=y4[r-e]),e--;return i}string(e){let r=[];e==null&&(e=Math.floor(this.remainingBits/8));for(let i=0;i<e;i++){let n=this.bits(8);if(n===0)break;r.push(String.fromCharCode(n))}return r.join("")}};var yh=class extends Le{constructor(e,r){super("Bits:"+e);let i=0;this.fields=Object.keys(r).map(n=>{let o=r[n];return i+=o,{key:n,bits:o}}),this.size=Math.ceil(i/8)}parse(e,r){let i=r.offset,n={},o=new N1(e,i,i+this.size);for(let{key:a,bits:h}of this.fields)n[a]=o.bits(h);return r.offset+=this.size,n}},bh=class extends Le{constructor(e,r,i){super("BitsFlags:"+e),this.type=r,this.fields=Object.entries(i)}get size(){return this.type.size}parse(e,r){let i=this.type.parse(e,r),n={};for(let[o,a]of this.fields){let h=(i&a)===a;h&&(n[o]=h)}return n}};var vh=class extends Le{constructor(e){super("Bytes:"+e),this.size=e}parse(e,r){let i=e.slice(r.offset,r.offset+this.size);return r.offset+=this.size,i}};var Ad=class extends Le{constructor(){super(...arguments),this.size=1}parse(e,r){let i=r.offset;return r.offset+=this.size,e[i]}},Td=class extends Le{constructor(){super(...arguments),this.size=2}parse(e,r){let i=r.offset,n=e[i++],o=e[i++]<<8;return r.offset+=2,n|o}},Id=class extends Le{constructor(){super(...arguments),this.size=4}parse(e,r){let i=r.offset,n=e[i++],o=e[i++]<<8,a=e[i++]<<16,h=e[i++]*16777216;return r.offset=i,(n|o|a)+h}},wS=2**32,Pd=class extends Le{constructor(){super(...arguments),this.size=8}parse(e,r){let i=ua.parse(e,r),n=ua.parse(e,r);return i+n*wS}},Od=class extends Le{constructor(){super(...arguments),this.size=8}parse(e,r){let i=BigInt(ua.parse(e,r)),n=BigInt(ua.parse(e,r));return i+(n<<BigInt(32))}},b4=new Ad("UInt8"),v4=new Td("LUInt16"),ua=new Id("LUInt32"),w4=new Pd("LUInt64"),_4=new Od("BigLUInt64");var wh=class extends Le{constructor(e,r,i){super("Lookup:"+e),this.lookup=i,this.type=r}get size(){return this.type.size}parse(e,r){let i=this.type.parse(e,r),n=this.lookup(i);if(n==null)throw new Error(`${this.name}: Failed to lookup ${i}`);return{id:i,name:n}}},_h=class extends Le{constructor(e,r,i){super("Enum:"+e),this.enumeration=i,this.type=r}get size(){return this.type.size}parse(e,r){let i=this.type.parse(e,r),n=this.enumeration[i];if(n==null)throw new Error(`${this.name}: Failed to lookup ${i}`);return{id:i,name:n}}};var ha=class extends Le{constructor(e,r){super(e),this._size=-1,this.fields=[];for(let[i,n]of Object.entries(r))this.fields.push({key:i,parser:n})}get size(){if(this._size>-1)return this._size;let e=0;for(let r of this.fields)e+=r.parser.size;return this._size=e,this._size}parse(e,r){let i={};for(let n of this.fields)i[n.key]=n.parser.parse(e,r,i);return i}},xh=class extends Le{constructor(e,r){super(e),this.fields=[],this._size=-1;let i=Object.entries(r),n=!1;for(let[o,a]of i)a.isLookupRequired&&(n=!0),this.fields.push({key:o,parser:a});i.length!==0&&(n?this.generateObjectAssign():this.generateSingleObject())}generateSingleObject(){let e=[],r='"use strict"; return {';for(let n=0;n<this.fields.length;n++)e.push(this.fields[n].parser),r+=` ${JSON.stringify(this.fields[n].key)}: _bp[${n}].parse(buf, ctx),`;r+=" };";let i=new Function("_bp","buf","ctx",r);this.parse=i.bind(null,e)}generateObjectAssign(){let e=[],r=`"use strict"; const ret = {};
185
185
  `;for(let n=0;n<this.fields.length;n++)e.push(this.fields[n].parser),r+=`ret[${JSON.stringify(this.fields[n].key)}] = _bp[${n}].parse(buf, ctx, ret)
186
- `;r+="return ret";let i=new Function("_bp","buf","ctx",r);this.parse=i.bind(null,e)}get size(){if(this._size>-1)return this._size;let e=0;for(let r of this.fields)e+=r.parser.size;return this._size=e,this._size}parse(e,r){return{}}};function ca(t,e=2){return"0x"+t.toString(16).padStart(e,"0")}var Sh=class extends Le{constructor(e,r){super("Offset:"+e.name+":"+r.name),this.type=r,this.offset=e}get size(){return this.type.size}parse(e,r){let i=this.offset.parse(e,r);if(i>e.length||i<0)throw new Error(`[${this.name}]: BufferOverflow attempted read at ${ca(i)}`);return this.type.parse(e,{offset:i,startOffset:i})}};var Mh=class extends Le{constructor(e){super("Skip:"+e),this.size=e}parse(e,r){r.offset+=this.size}};var Eh=class extends Le{constructor(){super("String")}get size(){throw new Error("Unable to calculate size from dynamic object")}parse(e,r){let i=r.offset,n=[],o=0;for(;o+i<e.length;){let a=e[i+o];if(a===0)break;n.push(String.fromCharCode(a)),o++}return r.offset+=o+1,n.join("")}},Rh=class extends Le{constructor(e){super("String:"+e),this.size=e}parse(e,r){let i=r.offset;if(this.size+i>e.length)throw new Error(`BufferOverflow: ${this.name} offset: ${ca(r.offset)}`);let n=[],o=0;for(;o<this.size;){let a=e[i+o];if(a===0)break;n.push(String.fromCharCode(a)),o++}return r.offset+=this.size,n.join("")}};function xS(t,e,r,i){return typeof r=="number"?new ph(t,e,r):new gh(t,e,r,i??!1)}var lr={u8:g4,lu16:y4,lu32:ua,lu64:b4,blu64:v4,empty:new ha("Empty",{}),offset(t,e){return new Sh(t,e)},string(t){return t==null?new Eh:new Rh(t)},bits(t,e){return new yh(t,e)},flags(t,e,r){return new bh(t,e,r)},object(t,e){return new xh(t,e)},static(t,e){return new ha(t,e)},lookup(t,e,r){return new wh(t,e,r)},enum(t,e,r){return new _h(t,e,r)},bytes(t){return new vh(t)},skip(t){return new Mh(t)},array:xS};var w4;(function(t){t[t.File="0".charCodeAt(0)]="File",t[t.HardLink="1".charCodeAt(0)]="HardLink",t[t.SymLink="2".charCodeAt(0)]="SymLink",t[t.CharDeviceNode="3".charCodeAt(0)]="CharDeviceNode",t[t.BlockDeviceNode="4".charCodeAt(0)]="BlockDeviceNode",t[t.Directory="5".charCodeAt(0)]="Directory",t[t.FifoNode="6".charCodeAt(0)]="FifoNode",t[t.Reserved="7".charCodeAt(0)]="Reserved",t[t.LongName="L".charCodeAt(0)]="LongName",t[t.LongLink="K".charCodeAt(0)]="LongLink"})(w4||(w4={}));var SS=lr.object("TarHeader",{path:lr.string(100),skip1:lr.skip(24),size:lr.bytes(12).refine(t=>parseInt(t.toString(),8)),skip2:lr.skip(20),type:lr.u8,linkName:lr.string(100)});var _4={32:16777619n,64:1099511628211n,128:309485009821345068724781371n,256:374144419156711147060143317175368453031918731002211n,512:35835915874844867368919076489095108449946327955754392558399825615420669938882575126094039892345713852759n,1024:5016456510113118655434598811035278955030765345404790744303017523831112055108147451509157692220295382716162651878526895249385292291816524375083746691371804094271873160484737966720260389217684476157468082573n},MS={32:2166136261n,64:14695981039346656037n,128:144066263297769815596495629667062367629n,256:100029257958052580907070968620625704837092796014241193945225284501741471925557n,512:9659303129496669498009435400716310466090418745672637896108374329434462657994582932197716438449813051892206539805784495328239340083876191928701583869517785n,1024:14197795064947621068722070641403218320880622795441933960878474914617582723252296732303717722150864096521202355549365628174669108571814760471015076148029755969804077320157692458563003215304957150157403644460363550505412711285966361610267868082893823963790439336411086884584107735010676915n};function Od(t,{size:e=32}={}){if(!_4[e])throw new Error("The `size` option must be one of 32, 64, 128, 256, 512, or 1024");let r=MS[e],i=_4[e],n=!1;for(let o=0;o<t.length;o++){let a=t.charCodeAt(o);a>127&&!n&&(t=unescape(encodeURIComponent(t)),a=t.charCodeAt(o),n=!0),r^=BigInt(a),r=BigInt.asUintN(e,r*i)}return r}var Ch="COT";var ES=BigInt(0),RS=BigInt(32),CS=BigInt(2**32-1),x4=lr.object("CotarMetadata",{magic:lr.string(Ch.length),version:lr.u8,count:lr.lu32}),qr=class{constructor(e,r,i=0){this.isHeader=!0,this.source=e,this.sourceOffset=i,this.metadata=r}static hash(e){return Od(e,{size:64})}static async loadMetadata(e,r,i){if(i){await e.loadBytes(r,e.chunkSize);let o=e.bytes(r,8);return x4.read(o).value}let n=await e.fetchBytes(-8);return x4.read(new Uint8Array(n)).value}static async getMetadata(e,r,i){let n=await this.loadMetadata(e,r,i);if(n.magic!==Ch)throw new Error(`Invalid source: ${e.uri} invalid magic found: ${n.magic}`);if(n.version===1||n.version===2)return n;throw new Error(`Invalid source: ${e.uri} invalid version found: ${n.version}`)}static async create(e,r=0,i=!0){let n=await this.getMetadata(e,r,i);return new qr(e,n,r)}async find(e){if(this.metadata.version===1)return this._findV1(e);if(this.metadata.version===2)return this._findV2(e);throw new Error("Invalid metadata version")}async _findV2(e){let r=qr.hash(e),i=this.metadata.count,n=Number(r%BigInt(i)),o=Number(r>>RS),a=Number(r&CS),h=null,d=null,m=n;for(;;){let p=this.sourceOffset+m*16+8;if(await this.source.loadBytes(p,16),d=this.source.getUint32(p),h=this.source.getUint32(p+4),h===o&&d===a){let M=this.source.getUint32(p+8)*512,R=this.source.getUint32(p+12);return{offset:M,size:R}}if(h===0&&d===0||(m++,m>=i&&(m=0),m===n))return null}}async _findV1(e){let r=qr.hash(e),i=this.metadata.count,n=Number(r%BigInt(i)),o=null,a=n;for(;;){let h=this.sourceOffset+a*24+8;if(await this.source.loadBytes(h,24),o=this.source.getBigUint64(h),o===r){let d=this.source.getUint64(h+8),m=this.source.getUint64(h+16);return{offset:d,size:m}}if(o===ES||(a++,a>=i&&(a=0),a===n))return null}}};var WL=BigInt(0);var Rs=class{constructor(e,r){this.source=e,this.index=r}static async fromTar(e){let r=await qr.getMetadata(e,0,!1),i=await e.size,n=r.version===1?24:16,o=i-(r.count*n+16),a=new qr(e,r,o);return new Rs(e,a)}async get(e){let r=await this.index.find(e);return r==null?null:(await this.source.loadBytes(r.offset,r.size),this.source.bytes(r.offset,r.size))}};var kd=class{constructor(){this.requests=[]}reset(){this.requests=[]}trace(e){let r=e.fetchBytes;e.fetchBytes=async(i,n)=>{let o={source:e.uri,offset:i,length:n},a=Xn(`${o.source}:${o.offset}:${o.length}`);o.id=a,this.requests.push(o);let h=Date.now(),d=await r.apply(e,[i,n]);return o.duration=Date.now()-h,d}}},An=new kd;var Th=class{constructor(e){this.cacheA=new Map;this.cacheB=new Map;this.hits=0;this.misses=0;this.resets=0;this._lastCheckedAt=-1;this.maxSize=e}get(e){let r=this.cacheA.get(e);if(r)return this.hits++,r;let i=this.cacheB.get(e);return i==null?(this.misses++,null):(this.hits++,this.cacheA.set(e,i),this.cacheB.delete(e),i)}clear(){this.cacheA.clear(),this.cacheB.clear()}set(e,r){this.cacheA.set(e,r),this.check()}check(){this._lastCheckedAt=Date.now(),!(this.maxSize<=0)&&(this.currentSize<=this.maxSize||(this.resets++,this.cacheB=this.cacheA,this.cacheA=new Map))}get currentSize(){let e=0;for(let r of this.cacheA.values())e+=r.size;return e}};var Ih=class{constructor(e){this.ob=e,this.ob._value==null&&this.ob.value.then(r=>this.ob._value=r)}get size(){let e=this.ob._value;return e==null?0:e.source.chunkSize*e.source.chunks.size}},Ld=class{constructor(e){this.cache=new Th(e)}getCog(e){let r=this.cache.get(e)?.ob;if(r!=null){if(r.type==="cog")return r.value;throw new Error(`Existing object of type: ${r.type} made for location: ${e}`)}let i=Er.source(e);An.trace(i);let n=la.create(i);return this.cache.set(e,new Ih({type:"cog",value:n})),n}getCotar(e){let r=this.cache.get(e)?.ob;if(r!=null){if(r.type==="cotar")return r.value;throw new Error(`Existing object of type: ${r.type} made for location: ${e}`)}let i=Er.source(e);An.trace(i);let n=Rs.fromTar(i);return this.cache.set(e,new Ih({type:"cotar",value:n})),n}},ur=new Ld(1e3*1e3*1e3);async function z1(t,e,r,i){let n=await ur.getCotar(e);if(n==null)return be();let o=await n.get(r);if(o==null)return be();let a=Buffer.from(o),h=qe.key(a);if(qe.isNotModified(t,h))return ct();let d=ee.ok().buffer(a,i);return d.header(re.ETag,h),d.header(re.CacheControl,"public, max-age=604800, stale-while-revalidate=86400"),Ui(a)&&d.header(re.ContentEncoding,"gzip"),d}function Ui(t){return t[0]===31&&t[1]===139}async function M4(t){let e=Qe.get(Qe.AssetLocation);if(e==null)return be();let r=Ph.default.join("fonts",t.params.fontStack,t.params.range)+".pbf";if(e.endsWith(".tar.co"))return z1(t,e,r,"application/x-protobuf");try{let i=nt.join(e,r),n=await nt.read(i),o=qe.key(n);if(qe.isNotModified(t,o))return ct();let a=ee.ok().buffer(n,"application/x-protobuf");return a.header(re.ETag,o),a.header(re.CacheControl,"public, max-age=604800, stale-while-revalidate=86400"),Ui(n)&&a.header(re.ContentEncoding,"gzip"),a}catch(i){if(i.code===404)return be();throw i}}async function TS(t){let e=new Set;for await(let r of nt.list(t)){if(!r.endsWith(".pbf"))continue;let i=Ph.default.basename(Ph.default.dirname(r));i.includes("/")||e.add(i)}return[...e].sort()}async function E4(t){let e=Qe.get(Qe.AssetLocation);if(e==null)return be();if(e.endsWith(".tar.co"))return z1(t,e,"fonts.json","application/json");try{let r=nt.join(e,"/fonts"),i=await TS(r),n=qe.key(i);if(qe.isNotModified(t,n))return ct();let o=ee.ok().buffer(JSON.stringify(i),"application/json");return o.header(re.ETag,n),o.header(re.CacheControl,"public, max-age=604800, stale-while-revalidate=86400"),o}catch(r){if(r.code===404)return be();throw r}}var jd=de(require("fs"),1),Bh=de(require("path"),1),L4=de(O4(),1),$d=de(require("sharp"),1),N4=de(require("url"),1);var Lh=de(require("sharp"),1);function OS(t){return t!=null}var kh=new Map,Tn=class{constructor(e){this.tileSize=e}isTooLarge(e){return!!(e.resize&&(e.resize.width>=Tn.MaxImageSize||e.resize.height>=Tn.MaxImageSize))}getEmptyImage(e,r){let i=[e,r.r,r.g,r.b,r.alpha].join("-"),n=kh.get(i);return n||(n=this.toImage(e,this.createImage(r)),kh.size>128&&kh.clear(),kh.set(i,n),n)}toImage(e,r){switch(e){case He.Jpeg:return r.jpeg().toBuffer();case He.Png:return r.png().toBuffer();case He.Webp:return r.webp().toBuffer();case He.Avif:return r.avif().toBuffer();default:throw new Error(`Invalid image format "${e}"`)}}async getImageBuffer(e,r,i){return e.length===0?this.getEmptyImage(r,i):this.toImage(r,this.createImage(i).composite(e))}isDirectImage(e){var r;if(e.layers.length!==1)return!1;let i=e.layers[0];if(i.x!==0||i.y!==0||i.crop!=null||i.extract!=null||i.resize!=null)return!1;let n=i.tiff.getImage(i.source.imageId),o=n.tileSize;return!(o.height!==this.tileSize||o.width!==this.tileSize||!(!((r=n.compression)===null||r===void 0)&&r.includes(e.format))||e.background.alpha!==0)}async compose(e){var r;let i=(r=e.metrics)!==null&&r!==void 0?r:new ws;if(i.start("compose:overlay"),this.isDirectImage(e)){let h=e.layers[0],d=await h.tiff.getTile(h.source.x,h.source.y,h.source.imageId);return i.end("compose:overlay"),d==null?{buffer:await this.getEmptyImage(e.format,e.background),metrics:i,layers:0}:(i.start("compose:direct"),i.end("compose:direct"),{buffer:Buffer.from(d.bytes),metrics:i,layers:1})}let n=[];for(let h of e.layers)this.isTooLarge(h)||n.push(this.composeTile(h,e.resizeKernel));let o=await Promise.all(n).then(h=>h.filter(OS));i.end("compose:overlay"),i.start("compose:compress");let a=await this.getImageBuffer(o,e.format,e.background);return i.end("compose:compress"),{buffer:a,metrics:i,layers:o.length}}async composeTile(e,r){let i=await e.tiff.getTile(e.source.x,e.source.y,e.source.imageId);if(i==null)return null;let n=(0,Lh.default)(Buffer.from(i.bytes)),{extract:o,resize:a,crop:h}=e;if(o&&n.extract({top:0,left:0,width:o.width,height:o.height}),a){let d={fit:Lh.default.fit.cover,kernel:a.scale>1?r.in:r.out};n.resize(a.width,a.height,d)}return h&&n.extract({top:h.y,left:h.x,width:h.width,height:h.height}),{input:await n.toBuffer(),top:e.y,left:e.x}}createImage(e){return(0,Lh.default)({create:{width:this.tileSize,height:this.tileSize,channels:4,background:e}})}};Tn.MaxImageSize=256*2**15;var zd=class{constructor(e){Hc(this,"value");Hc(this,"next");this.value=e}},fi,As,Ts,U1=class{constructor(){bt(this,fi,void 0);bt(this,As,void 0);bt(this,Ts,void 0);this.clear()}enqueue(e){let r=new zd(e);Ee(this,fi)?(Ee(this,As).next=r,Ze(this,As,r)):(Ze(this,fi,r),Ze(this,As,r)),Gc(this,Ts)._++}dequeue(){let e=Ee(this,fi);if(!!e)return Ze(this,fi,Ee(this,fi).next),Gc(this,Ts)._--,e.value}clear(){Ze(this,fi,void 0),Ze(this,As,void 0),Ze(this,Ts,0)}get size(){return Ee(this,Ts)}*[Symbol.iterator](){let e=Ee(this,fi);for(;e;)yield e.value,e=e.next}};fi=new WeakMap,As=new WeakMap,Ts=new WeakMap;function Ud(t){if(!((Number.isInteger(t)||t===Number.POSITIVE_INFINITY)&&t>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up");let e=new U1,r=0,i=()=>{r--,e.size>0&&e.dequeue()()},n=async(h,d,m)=>{r++;let p=(async()=>h(...m))();d(p);try{await p}catch{}i()},o=(h,d,m)=>{e.enqueue(n.bind(void 0,h,d,m)),(async()=>(await Promise.resolve(),r<t&&e.size>0&&e.dequeue()()))()},a=(h,...d)=>new Promise(m=>{o(h,m,d)});return Object.defineProperties(a,{activeCount:{get:()=>r},pendingCount:{get:()=>e.size},clearQueue:{value:()=>{e.clear()}}}),a}var kS=Ud(Qe.getNumber(Qe.TiffConcurrency,25));function LS(t){let e=t.toLowerCase();return e.endsWith(".tif")||e.endsWith(".tiff")?t:`${t}.tiff`}var NS=new Tn(256),BS={in:"lanczos3",out:"lanczos3"},DS={r:0,g:0,b:0,alpha:0},Nh={async getTiffsForTile(t,e,r){let i=await _e.getAllImagery(e.layers,[r.tileMatrix.projection]),n=[],o=r.tileMatrix.tileToSourceBounds(r.tile),a=Mt.convertZoomLevel(r.tile.z,r.tileMatrix,Zn.get(Re.Google));for(let h of e.layers){if(h.maxZoom!=null&&a>h.maxZoom||h.minZoom!=null&&a<h.minZoom)continue;let d=h[r.tileMatrix.projection.code];if(d==null){t.log.warn({layer:h.name,projection:r.tileMatrix.projection.code},"Failed to lookup imagery");continue}let m=i.get(d);if(m==null){t.log.warn({layer:h.name,projection:r.tileMatrix.projection.code,imgId:d},"Failed to lookup imagery");continue}if(!!o.intersects(xe.fromJson(m.bounds)))for(let p of m.files){if(!o.intersects(xe.fromJson(p)))continue;let M=Er.join(m.uri,LS(p.name));n.push(M)}}return n},async tile(t,e,r){if(r.tileType===rr.MapboxVectorTiles)return be();let i=await this.getTiffsForTile(t,e,r),n=qe.key(i);if(qe.isNotModified(t,n))return ct();let o=[];for(let M of i)o.push(kS(()=>ur.getCog(M).catch(R=>(t.log.warn({error:R,tiff:M},"TiffLoadFailed"),null))));let a=(await Promise.all(o)).filter(M=>M!=null),d=await new aa(r.tileMatrix).tile(a,r.tile.x,r.tile.y,r.tile.z),m=await NS.compose({layers:d,format:r.tileType,background:e.background??DS,resizeKernel:e.resizeKernel??BS,metrics:t.timer});t.set("layersUsed",m.layers),t.set("bytes",m.buffer.byteLength);let p=new ee(200,"ok");return p.header(re.ETag,n),p.header(re.CacheControl,"public, max-age=604800, stale-while-revalidate=86400"),p.buffer(m.buffer,"image/"+r.tileType),p}};var jS={},zS=[{tileSet:"health",tileMatrix:lt,tileType:He.Png,tile:{x:252,y:156,z:8}},{tileSet:"health",tileMatrix:on,tileType:He.Png,tile:{x:30,y:33,z:6}}],k4=256;async function US(t){if(Buffer.isBuffer(t.buf))return t.buf;let e=t.tile,r=`static/expected_tile_${t.tileMatrix.identifier}_${e.x}_${e.y}_z${e.z}.${t.tileType}`;try{return await jd.promises.readFile(r)}catch(i){if(i.code!=="ENOENT")throw i;let n=Bh.join(Bh.dirname(N4.default.fileURLToPath(jS.url)),"..","..",r);return await jd.promises.readFile(n)}}async function qd(t){let e=await _e.TileSet.get(_e.TileSet.id("health"));if(e==null)throw new ee(500,'TileSet: "health" not found');for(let i of zS){let n=await Nh.tile(t,e,i);if(n.status!==200)return new ee(500,n.statusDescription);if(!Buffer.isBuffer(n._body))throw new ee(500,"Not a Buffer response content.");let o=await(0,$d.default)(n._body).raw().toBuffer(),a=await US(i);i.buf=a;let h=await(0,$d.default)(a).raw().toBuffer(),d=Buffer.alloc(h.length),m=(0,L4.default)(h,o,d,k4,k4);if(m)return t.log.error({missMatchedPixels:m,projection:i.tileMatrix.identifier,xyz:i.tile},"Health:MissMatch"),new ee(500,"TileSet does not match.")}let r=new ee(200,"ok");return r.header(re.CacheControl,"no-store"),r}var B4=require("util"),D4=require("zlib");var $S=(0,B4.promisify)(D4.gzip);function qS(t){return t==null?!1:!!(t.endsWith(".geojson")||t.endsWith(".json"))}async function z4(t){let e=t.params.fileName;if(!qS(e))return be();let r=await _e.Imagery.get(_e.Imagery.id(t.params.imageryId));if(r==null)return be();let i=Er.join(r.uri,e);try{let n=await Er.read(i),o=qe.key(n);if(qe.isNotModified(t,o))return ct();let a=new ee(200,"ok");return a.header(re.ETag,o),a.header(re.ContentEncoding,"gzip"),a.header(re.CacheControl,"public, max-age=604800, stale-while-revalidate=86400"),a.buffer(Ui(n)?n:await $S(n),"application/json"),t.set("bytes",n.byteLength),a}catch{return t.log.warn({targetPath:i},"ImageryMetadata:Failed"),be()}}var U4=new ee(200,"ok");U4.header(re.CacheControl,"no-store");async function Fd(){return U4}var j4=de(require("path"),1);var Wd=new Map;Wd.set(".png","image/png");Wd.set(".json","application/json");async function $4(t){let e=Qe.get(Qe.AssetLocation);if(e==null)return be();let r=j4.default.extname(t.params.spriteName),i=Wd.get(r);if(i==null)return be();let n=nt.join("sprites",t.params.spriteName);if(e.endsWith(".tar.co"))return z1(t,e,n,i);try{let o=nt.join(e,n);t.set("target",o);let a=await nt.read(o),h=qe.key(a);if(qe.isNotModified(t,h))return ct();let d=ee.ok().buffer(a,i);return d.header(re.ETag,h),d.header(re.CacheControl,"public, max-age=604800, stale-while-revalidate=86400"),Ui(a)&&d.header(re.ContentEncoding,"gzip"),d}catch(o){if(o.code===404)return be();throw o}}async function q4(t){let e=wt.getTileMatrixSet(t.params.tileMatrix);if(e==null)return be();let r=wt.apiKey(t);t.timer.start("tileset:load");let i=await _e.TileSet.get(_e.TileSet.id(t.params.tileSet));if(t.timer.end("tileset:load"),i==null)return be();let n=wt.getRequestedFormats(t)??[i.format],h={tiles:[[Qe.get(Qe.PublicUrlBase)??"","v1","tiles",i.name,e.identifier,"{z}","{x}","{y}"].join("/")+`.${n[0]}?api=${r}`],tilejson:"3.0.0"},d=Mt.convertZoomLevel(i.maxZoom??30,lt,e,!0),m=Mt.convertZoomLevel(i.minZoom??0,lt,e,!0);i.maxZoom&&(h.maxzoom=d),i.minZoom&&(h.minzoom=m);let p=JSON.stringify(h),M=Buffer.from(p),R=new ee(200,"ok");return R.header(re.CacheControl,"no-store"),R.buffer(M,"application/json"),t.set("bytes",M.byteLength),R}var F4=require("url");function Dh(t,e){if(t==null)return"";let r=Qe.get(Qe.PublicUrlBase)??"";if(!t.startsWith("/"))return t;let i=new F4.URL(nt.join(r,t));return e&&i.searchParams.set("api",e),i.toString().replace(/%7B/g,"{").replace(/%7D/g,"}")}function FS(t,e){let r=JSON.parse(JSON.stringify(t.sources));for(let[i,n]of Object.entries(r)){if(n.type==="vector")n.url=Dh(n.url,e);else if(n.type==="raster"&&Array.isArray(n.tiles))for(let o=0;o<n.tiles.length;o++)n.tiles[o]=Dh(n.tiles[o],e);r[i]=n}return{version:8,id:t.id,name:t.name,sources:r,layers:t.layers,metadata:t.metadata??{},glyphs:Dh(t.glyphs),sprite:Dh(t.sprite)}}async function Hd(t){let e=wt.apiKey(t),r=t.params.styleName,i=_e.Style.id(r),n=await _e.Style.get(i);if(n==null)return be();let o=FS(n.style,e),a=Buffer.from(JSON.stringify(o)),h=qe.key(a);if(qe.isNotModified(t,h))return ct();let d=new ee(200,"ok");return d.header(re.ETag,h),d.header(re.CacheControl,"no-store"),d.buffer(a,"application/json"),t.set("bytes",a.byteLength),d}var K4=require("crypto");var WS={xmlns:"http://www.opengis.net/wmts/1.0","xmlns:ows":"http://www.opengis.net/ows/1.1","xmlns:xlink":"http://www.w3.org/1999/xlink","xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","xmlns:gml":"http://www.opengis.net/gml","xsi:schemaLocation":"http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd",version:"1.0.0"};function W4(t,e){return jr.get(t).boundsToWgs84BoundingBox(e)}var H4=6,G4=4;function V4(t,e){return Number(t.toFixed(e)).toString()}function zh(t,e,r){return`${V4(t,r)} ${V4(e,r)}`}var Uh=class{constructor(e){this.tileMatrixSets=new Map;this.isIndividualLayers=!1;this.httpBase=e.httpBase,this.provider=e.provider,this.tileSet=e.tileSet,this.isIndividualLayers=e.isIndividualLayers;for(let r of e.tileMatrix)this.tileMatrixSets.set(r.identifier,r);this.apiKey=e.apiKey,this.formats=e.formats??a4,this.imagery=e.imagery}async loadImagery(){let e=new Set;for(let r of this.tileMatrixSets.values())for(let i of this.tileSet.layers){let n=i[r.projection.code];n!=null&&e.add(n)}this.imagery=await _e.Imagery.getAll(e)}buildWgs84BoundingBox(e,r){let i;if(r.length>0){let n=r[0];for(let o=1;o<r.length;o++)n=n.union(r[o]);i=W4(e,n.toJson())}else i=W4(e,e.extent);return i[2]<i[0]&&(i[0]=-180,i[2]=180),X("ows:WGS84BoundingBox",{crs:"urn:ogc:def:crs:OGC:2:84"},[X("ows:LowerCorner",zh(i[0],i[1],H4)),X("ows:UpperCorner",zh(i[2],i[3],H4))])}buildBoundingBoxFromImagery(e,r){let i;for(let o of r){let a=o[e.projection.code];if(a==null)continue;let h=this.imagery.get(a);h!=null&&(i==null?i=xe.fromJson(h.bounds):i=i.union(xe.fromJson(h.bounds)))}if(i==null)return null;let n=i.toBbox();return X("ows:BoundingBox",{crs:e.projection.toUrn()},[X("ows:LowerCorner",zh(n[e.indexX],n[e.indexY],G4)),X("ows:UpperCorner",zh(n[e.indexX+2],n[e.indexY+2],G4))])}buildProvider(){if(this.provider==null)return[];let{serviceIdentification:e,serviceProvider:r}=this.provider,{contact:i}=r;return[X("ows:ServiceIdentification",[X("ows:Title",e.title),X("ows:Abstract",e.description),X("ows:ServiceType","OGC WMTS"),X("ows:ServiceTypeVersion","1.0.0"),X("ows:Fees",e.fees),X("ows:AccessConstraints",e.accessConstraints)]),X("ows:ServiceProvider",[X("ows:ProviderName",r.name),X("ows:ProviderSite",{"xlink:href":r.site}),X("ows:ServiceContact",[X("ows:IndividualName",i.individualName),X("ows:PositionName",i.position),X("ows:ContactInfo",[X("ows:Phone",[X("ows:Voice",i.phone)]),X("ows:Address",[X("ows:DeliveryPoint",i.address.deliveryPoint),X("ows:City",i.address.city),X("ows:PostalCode",i.address.postalCode),X("ows:Country",i.address.country),X("ows:ElectronicMailAddress",i.address.email)])])])])]}buildTileUrl(e,r){let i=this.apiKey?`?api=${this.apiKey}`:"";return[this.httpBase,"v1","tiles",e,"{TileMatrixSet}","{TileMatrix}","{TileCol}",`{TileRow}.${r}${i}`].join("/")}buildResourceUrl(e,r){return X("ResourceURL",{format:"image/"+r,resourceType:"tile",template:this.buildTileUrl(e,r)})}buildLayerFromImagery(e){let r=new Set,i=[];for(let d of this.tileMatrixSets.values()){let m=e[d.projection.code];m==null||this.imagery.get(m)==null||(i.push(X("TileMatrixSetLink",[X("TileMatrixSet",d.identifier)])),r.add(d))}let n=bo(e.name),o=[...r.values()],a=o[0];if(a==null)return null;let h=this.imagery.get(e[a.projection.code]??"");return h==null?null:X("Layer",[X("ows:Title",e.title??n),X("ows:Abstract",""),X("ows:Identifier",n),this.buildKeywords(h),...o.map(d=>this.buildBoundingBoxFromImagery(d,[e])),this.buildWgs84BoundingBox(a,[xe.fromJson(h.bounds)]),this.buildStyle(),...this.formats.map(d=>X("Format","image/"+d)),...i,...this.formats.map(d=>this.buildResourceUrl(n,d))])}buildLayer(e){let r=new Set,i=[];for(let m of this.tileMatrixSets.values())e.layers.find(p=>p[m.projection.code]!=null)&&(i.push(X("TileMatrixSetLink",[X("TileMatrixSet",m.identifier)])),r.add(m));let n=bo(e.name),o=[...r.values()],a=o[0];if(a==null)throw new Error("No matrix sets found for layer "+e.name);let h=o.find(m=>m.identifier===lt.identifier)??a,d=[];for(let m of e.layers){let p=this.imagery.get(m[h.projection.code]??"");p!=null&&d.push(xe.fromJson(p.bounds))}return X("Layer",[X("ows:Title",e.title??n),X("ows:Abstract",e.description??""),X("ows:Identifier",n),this.buildKeywords(e),...[...r.values()].map(m=>this.buildBoundingBoxFromImagery(m,e.layers)),this.buildWgs84BoundingBox(h,d),this.buildStyle(),...this.formats.map(m=>X("Format","image/"+m)),...i,...this.formats.map(m=>this.buildResourceUrl(n,m))])}buildKeywords(e){return e.category==null?X("ows:Keywords"):X("ows:Keywords",[X("ows:Keyword",e.category)])}buildStyle(){return X("Style",{isDefault:"true"},[X("ows:Title","Default Style"),X("ows:Identifier","default")])}buildTileMatrixSet(e){return X("TileMatrixSet",[X("ows:Title",e.def.title),e.def.abstract?X("ows:Abstract",e.def.abstract):null,X("ows:Identifier",e.identifier),X("ows:SupportedCRS",e.projection.toUrn()),e.def.wellKnownScaleSet?X("WellKnownScaleSet",e.def.wellKnownScaleSet):null,...e.def.tileMatrix.map(r=>X("TileMatrix",[X("ows:Identifier",r.identifier),X("ScaleDenominator",r.scaleDenominator),X("TopLeftCorner",r.topLeftCorner.join(" ")),X("TileWidth",r.tileWidth),X("TileHeight",r.tileHeight),X("MatrixWidth",r.matrixWidth),X("MatrixHeight",r.matrixHeight)]))])}toVNode(){let e=[];if(e.push(this.buildLayer(this.tileSet)),this.isIndividualLayers){let r=new Map;for(let n of this.tileSet.layers)r.set(bo(n.name),n);let i=Array.from(r.values()).sort((n,o)=>(n.title??n.name).localeCompare(o.title??o.name));for(let n of i)e.push(this.buildLayerFromImagery(n))}for(let r of this.tileMatrixSets.values())e.push(this.buildTileMatrixSet(r));return X("Capabilities",WS,[...this.buildProvider(),X("Contents",e)])}toXml(){return`<?xml version="1.0" encoding="utf-8"?>
187
- `+this.toVNode().toString()}};function HS(t){if(t==null)return[lt,on];let e=wt.getTileMatrixSet(t);return e==null?null:[e]}async function jh(t){let e=wt.apiKey(t),r=t.params.tileSet??"aerial",i=HS(t.params.tileMatrix);if(i==null)return be();let n=Qe.get(Qe.PublicUrlBase)??"";t.timer.start("tileset:load");let o=await _e.TileSet.get(_e.TileSet.id(r??"aerial"));if(t.timer.end("tileset:load"),o==null||o.type!==vt.Raster)return be();let a=await _e.Provider.get(_e.Provider.id("linz"));t.timer.start("imagery:load");let h=await _e.getAllImagery(o.layers,i.map(R=>R.projection));t.timer.end("imagery:load");let d=new Uh({httpBase:n,provider:a??void 0,tileSet:o,tileMatrix:i,isIndividualLayers:t.params.tileMatrix==null,imagery:h,apiKey:e,formats:wt.getRequestedFormats(t)}).toXml();if(d==null)return be();let m=Buffer.from(d),p=(0,K4.createHash)("sha256").update(m).digest("base64");if(qe.isNotModified(t,p))return ct();let M=new ee(200,"ok");return M.header(re.ETag,p),M.header(re.CacheControl,"no-store"),M.buffer(m,"text/xml"),t.set("bytes",m.byteLength),M}var J4={async tile(t,e,r){if(r.tileType!==rr.MapboxVectorTiles)return be();if(r.tileMatrix.identifier!==lt.identifier)return be();if(e.layers.length>1)return new ee(500,"Too many layers in tileset");let[i]=e.layers,n=i[3857];if(n==null)return new ee(500,"Layer url not found from tileset Config");let o=(1<<r.tile.z)-1-r.tile.y,a=`tiles/${r.tile.z}/${r.tile.x}/${o}.pbf.gz`,h=`${n}#${a}`,d=qe.key(h);if(qe.isNotModified(t,d))return ct();t.timer.start("cotar:load");let m=await ur.getCotar(n);if(m==null)return new ee(500,"Failed to load VectorTiles");t.timer.end("cotar:load"),t.timer.start("cotar:tile");let p=await m.get(a);if(p==null)return be();t.timer.end("cotar:tile");let M=Buffer.from(p),R=ee.ok().buffer(M,"application/x-protobuf");return R.header(re.ETag,d),R.header(re.CacheControl,"public, max-age=604800, stale-while-revalidate=86400"),Ui(M)&&R.header(re.ContentEncoding,"gzip"),R}};async function Z4(t){let e=wt.xyz(t);t.timer.start("tileset:load");let r=await _e.TileSet.get(_e.TileSet.id(e.tileSet));if(t.timer.end("tileset:load"),r==null)return be();switch(r.type){case vt.Vector:return J4.tile(t,r,e);case vt.Raster:return Nh.tile(t,r,e);default:return new ee(400,"Invalid tileset")}}async function Gd(){let t=new ee(200,"ok");return t.header(re.CacheControl,"no-store"),t.json({version:"v6.32.2",hash:"4d7c28b24243966157b93de0d07cbcb1f3dbd671"}),t}var Ye=ar.http(Hu.get());Ye.router.hook("request",t=>{t.set("name","LambdaTiler"),An.reset()});Ye.router.hook("response",(t,e)=>{An.requests.length>0&&(t.set("requests",An.requests.slice(0,100)),t.set("requestCount",An.requests.length)),t.set("sources",{hits:ur.cache.hits,misses:ur.cache.misses,size:ur.cache.currentSize,resets:ur.cache.resets,cacheA:ur.cache.cacheA.size,cacheB:ur.cache.cacheB.size}),e.header("access-control-allow-origin","*")});Ye.router.options("*",t=>Ye.router.router.find("GET",t.path)==null?be():ee.ok());Ye.router.get("/ping",Fd);Ye.router.get("/health",qd);Ye.router.get("/version",Gd);Ye.router.get("/v1/ping",Fd);Ye.router.get("/v1/health",qd);Ye.router.get("/v1/version",Gd);Ye.router.get("/v1/imagery/:imageryId/:fileName",z4);Ye.router.get("/v1/sprites/:spriteName",$4);Ye.router.get("/v1/fonts.json",E4);Ye.router.get("/v1/fonts/:fontStack/:range.pbf",M4);Ye.router.get("/v1/styles/:styleName.json",Hd);Ye.router.get("/v1/tiles/:tileSet/:tileMatrix/style/:styleName.json",Hd);Ye.router.get("/v1/tiles/:tileSet/:tileMatrix/tile.json",q4);Ye.router.get("/v1/tiles/:tileSet/:tileMatrix/:z/:x/:y.:tileType",Z4);Ye.router.get("/v1/tiles/:tileSet/:tileMatrix/attribution.json",gd);Ye.router.get("/v1/attribution/:tileSet/:tileMatrix/summary.json",gd);Ye.router.get("/v1/tiles/:tileSet/:tileMatrix/WMTSCapabilities.xml",jh);Ye.router.get("/v1/tiles/:tileSet/WMTSCapabilities.xml",jh);Ye.router.get("/v1/tiles/WMTSCapabilities.xml",jh);0&&(module.exports={handler});
186
+ `;r+="return ret";let i=new Function("_bp","buf","ctx",r);this.parse=i.bind(null,e)}get size(){if(this._size>-1)return this._size;let e=0;for(let r of this.fields)e+=r.parser.size;return this._size=e,this._size}parse(e,r){return{}}};function ca(t,e=2){return"0x"+t.toString(16).padStart(e,"0")}var Sh=class extends Le{constructor(e,r){super("Offset:"+e.name+":"+r.name),this.type=r,this.offset=e}get size(){return this.type.size}parse(e,r){let i=this.offset.parse(e,r);if(i>e.length||i<0)throw new Error(`[${this.name}]: BufferOverflow attempted read at ${ca(i)}`);return this.type.parse(e,{offset:i,startOffset:i})}};var Mh=class extends Le{constructor(e){super("Skip:"+e),this.size=e}parse(e,r){r.offset+=this.size}};var Eh=class extends Le{constructor(){super("String")}get size(){throw new Error("Unable to calculate size from dynamic object")}parse(e,r){let i=r.offset,n=[],o=0;for(;o+i<e.length;){let a=e[i+o];if(a===0)break;n.push(String.fromCharCode(a)),o++}return r.offset+=o+1,n.join("")}},Rh=class extends Le{constructor(e){super("String:"+e),this.size=e}parse(e,r){let i=r.offset;if(this.size+i>e.length)throw new Error(`BufferOverflow: ${this.name} offset: ${ca(r.offset)}`);let n=[],o=0;for(;o<this.size;){let a=e[i+o];if(a===0)break;n.push(String.fromCharCode(a)),o++}return r.offset+=this.size,n.join("")}};function _S(t,e,r,i){return typeof r=="number"?new ph(t,e,r):new gh(t,e,r,i??!1)}var ur={u8:b4,lu16:v4,lu32:ua,lu64:w4,blu64:_4,empty:new ha("Empty",{}),offset(t,e){return new Sh(t,e)},string(t){return t==null?new Eh:new Rh(t)},bits(t,e){return new yh(t,e)},flags(t,e,r){return new bh(t,e,r)},object(t,e){return new xh(t,e)},static(t,e){return new ha(t,e)},lookup(t,e,r){return new wh(t,e,r)},enum(t,e,r){return new _h(t,e,r)},bytes(t){return new vh(t)},skip(t){return new Mh(t)},array:_S};var x4;(function(t){t[t.File="0".charCodeAt(0)]="File",t[t.HardLink="1".charCodeAt(0)]="HardLink",t[t.SymLink="2".charCodeAt(0)]="SymLink",t[t.CharDeviceNode="3".charCodeAt(0)]="CharDeviceNode",t[t.BlockDeviceNode="4".charCodeAt(0)]="BlockDeviceNode",t[t.Directory="5".charCodeAt(0)]="Directory",t[t.FifoNode="6".charCodeAt(0)]="FifoNode",t[t.Reserved="7".charCodeAt(0)]="Reserved",t[t.LongName="L".charCodeAt(0)]="LongName",t[t.LongLink="K".charCodeAt(0)]="LongLink"})(x4||(x4={}));var xS=ur.object("TarHeader",{path:ur.string(100),skip1:ur.skip(24),size:ur.bytes(12).refine(t=>parseInt(t.toString(),8)),skip2:ur.skip(20),type:ur.u8,linkName:ur.string(100)});var S4={32:16777619n,64:1099511628211n,128:309485009821345068724781371n,256:374144419156711147060143317175368453031918731002211n,512:35835915874844867368919076489095108449946327955754392558399825615420669938882575126094039892345713852759n,1024:5016456510113118655434598811035278955030765345404790744303017523831112055108147451509157692220295382716162651878526895249385292291816524375083746691371804094271873160484737966720260389217684476157468082573n},SS={32:2166136261n,64:14695981039346656037n,128:144066263297769815596495629667062367629n,256:100029257958052580907070968620625704837092796014241193945225284501741471925557n,512:9659303129496669498009435400716310466090418745672637896108374329434462657994582932197716438449813051892206539805784495328239340083876191928701583869517785n,1024:14197795064947621068722070641403218320880622795441933960878474914617582723252296732303717722150864096521202355549365628174669108571814760471015076148029755969804077320157692458563003215304957150157403644460363550505412711285966361610267868082893823963790439336411086884584107735010676915n};function kd(t,{size:e=32}={}){if(!S4[e])throw new Error("The `size` option must be one of 32, 64, 128, 256, 512, or 1024");let r=SS[e],i=S4[e],n=!1;for(let o=0;o<t.length;o++){let a=t.charCodeAt(o);a>127&&!n&&(t=unescape(encodeURIComponent(t)),a=t.charCodeAt(o),n=!0),r^=BigInt(a),r=BigInt.asUintN(e,r*i)}return r}var Ch="COT";var MS=BigInt(0),ES=BigInt(32),RS=BigInt(2**32-1),M4=ur.object("CotarMetadata",{magic:ur.string(Ch.length),version:ur.u8,count:ur.lu32}),qr=class{constructor(e,r,i=0){this.isHeader=!0,this.source=e,this.sourceOffset=i,this.metadata=r}static hash(e){return kd(e,{size:64})}static async loadMetadata(e,r,i){if(i){await e.loadBytes(r,e.chunkSize);let o=e.bytes(r,8);return M4.read(o).value}let n=await e.fetchBytes(-8);return M4.read(new Uint8Array(n)).value}static async getMetadata(e,r,i){let n=await this.loadMetadata(e,r,i);if(n.magic!==Ch)throw new Error(`Invalid source: ${e.uri} invalid magic found: ${n.magic}`);if(n.version===1||n.version===2)return n;throw new Error(`Invalid source: ${e.uri} invalid version found: ${n.version}`)}static async create(e,r=0,i=!0){let n=await this.getMetadata(e,r,i);return new qr(e,n,r)}async find(e){if(this.metadata.version===1)return this._findV1(e);if(this.metadata.version===2)return this._findV2(e);throw new Error("Invalid metadata version")}async _findV2(e){let r=qr.hash(e),i=this.metadata.count,n=Number(r%BigInt(i)),o=Number(r>>ES),a=Number(r&RS),h=null,d=null,m=n;for(;;){let p=this.sourceOffset+m*16+8;if(await this.source.loadBytes(p,16),d=this.source.getUint32(p),h=this.source.getUint32(p+4),h===o&&d===a){let M=this.source.getUint32(p+8)*512,R=this.source.getUint32(p+12);return{offset:M,size:R}}if(h===0&&d===0||(m++,m>=i&&(m=0),m===n))return null}}async _findV1(e){let r=qr.hash(e),i=this.metadata.count,n=Number(r%BigInt(i)),o=null,a=n;for(;;){let h=this.sourceOffset+a*24+8;if(await this.source.loadBytes(h,24),o=this.source.getBigUint64(h),o===r){let d=this.source.getUint64(h+8),m=this.source.getUint64(h+16);return{offset:d,size:m}}if(o===MS||(a++,a>=i&&(a=0),a===n))return null}}};var FL=BigInt(0);var Es=class{constructor(e,r){this.source=e,this.index=r}static async fromTar(e){let r=await qr.getMetadata(e,0,!1),i=await e.size,n=r.version===1?24:16,o=i-(r.count*n+16),a=new qr(e,r,o);return new Es(e,a)}async get(e){let r=await this.index.find(e);return r==null?null:(await this.source.loadBytes(r.offset,r.size),this.source.bytes(r.offset,r.size))}};var Ld=class{constructor(){this.requests=[]}reset(){this.requests=[]}trace(e){let r=e.fetchBytes;e.fetchBytes=async(i,n)=>{let o={source:e.uri,offset:i,length:n},a=Yn(`${o.source}:${o.offset}:${o.length}`);o.id=a,this.requests.push(o);let h=Date.now(),d=await r.apply(e,[i,n]);return o.duration=Date.now()-h,d}}},An=new Ld;var Th=class{constructor(e){this.cacheA=new Map;this.cacheB=new Map;this.hits=0;this.misses=0;this.resets=0;this.clears=0;this._lastCheckedAt=-1;this.maxSize=e}get(e){let r=this.cacheA.get(e);if(r)return this.hits++,r;let i=this.cacheB.get(e);return i==null?(this.misses++,null):(this.hits++,this.cacheA.set(e,i),this.cacheB.delete(e),i)}clear(){this.cacheA.clear(),this.cacheB.clear(),this.clears++}set(e,r){this.cacheA.set(e,r),this.check()}check(){if(this._lastCheckedAt=Date.now(),!(this.maxSize<=0)&&!(this.currentSize<=this.maxSize)){if(this.resets++,this.resets>100)return this.resets=0,this.clear();this.cacheB=this.cacheA,this.cacheA=new Map}}get currentSize(){let e=0;for(let r of this.cacheA.values())e+=r.size;return e}};var Ih=class{constructor(e){this.ob=e,this.ob._value==null&&this.ob.value.then(r=>this.ob._value=r)}get size(){let e=this.ob._value;return e==null?0:e.source.chunkSize*e.source.chunks.size}},Nd=class{constructor(e){this.cache=new Th(e)}getCog(e){let r=this.cache.get(e)?.ob;if(r!=null){if(r.type==="cog")return r.value;throw new Error(`Existing object of type: ${r.type} made for location: ${e}`)}let i=Er.source(e);An.trace(i);let n=la.create(i);return this.cache.set(e,new Ih({type:"cog",value:n})),n}getCotar(e){let r=this.cache.get(e)?.ob;if(r!=null){if(r.type==="cotar")return r.value;throw new Error(`Existing object of type: ${r.type} made for location: ${e}`)}let i=Er.source(e);An.trace(i);let n=Es.fromTar(i);return this.cache.set(e,new Ih({type:"cotar",value:n})),n}},Xt=new Nd(700*1e3*1e3);async function z1(t,e,r,i){let n=await Xt.getCotar(e);if(n==null)return Se();let o=await n.get(r);if(o==null)return Se();let a=Buffer.from(o),h=qe.key(a);if(qe.isNotModified(t,h))return ct();let d=Q.ok().buffer(a,i);return d.header(re.ETag,h),d.header(re.CacheControl,"public, max-age=604800, stale-while-revalidate=86400"),Ui(a)&&d.header(re.ContentEncoding,"gzip"),d}function Ui(t){return t[0]===31&&t[1]===139}async function R4(t){let e=Qe.get(Qe.AssetLocation);if(e==null)return Se();let r=Ph.default.join("fonts",t.params.fontStack,t.params.range)+".pbf";if(e.endsWith(".tar.co"))return z1(t,e,r,"application/x-protobuf");try{let i=nt.join(e,r),n=await nt.read(i),o=qe.key(n);if(qe.isNotModified(t,o))return ct();let a=Q.ok().buffer(n,"application/x-protobuf");return a.header(re.ETag,o),a.header(re.CacheControl,"public, max-age=604800, stale-while-revalidate=86400"),Ui(n)&&a.header(re.ContentEncoding,"gzip"),a}catch(i){if(i.code===404)return Se();throw i}}async function AS(t){let e=new Set;for await(let r of nt.list(t)){if(!r.endsWith(".pbf"))continue;let i=Ph.default.basename(Ph.default.dirname(r));i.includes("/")||e.add(i)}return[...e].sort()}async function C4(t){let e=Qe.get(Qe.AssetLocation);if(e==null)return Se();if(e.endsWith(".tar.co"))return z1(t,e,"fonts.json","application/json");try{let r=nt.join(e,"/fonts"),i=await AS(r),n=qe.key(i);if(qe.isNotModified(t,n))return ct();let o=Q.ok().buffer(JSON.stringify(i),"application/json");return o.header(re.ETag,n),o.header(re.CacheControl,"public, max-age=604800, stale-while-revalidate=86400"),o}catch(r){if(r.code===404)return Se();throw r}}var $d=de(require("fs"),1),Bh=de(require("path"),1),B4=de(L4(),1),qd=de(require("sharp"),1),D4=de(require("url"),1);var Lh=de(require("sharp"),1);function PS(t){return t!=null}var kh=new Map,Tn=class{constructor(e){this.tileSize=e}isTooLarge(e){return!!(e.resize&&(e.resize.width>=Tn.MaxImageSize||e.resize.height>=Tn.MaxImageSize))}getEmptyImage(e,r){let i=[e,r.r,r.g,r.b,r.alpha].join("-"),n=kh.get(i);return n||(n=this.toImage(e,this.createImage(r)),kh.size>128&&kh.clear(),kh.set(i,n),n)}toImage(e,r){switch(e){case He.Jpeg:return r.jpeg().toBuffer();case He.Png:return r.png().toBuffer();case He.Webp:return r.webp().toBuffer();case He.Avif:return r.avif().toBuffer();default:throw new Error(`Invalid image format "${e}"`)}}async getImageBuffer(e,r,i){return e.length===0?this.getEmptyImage(r,i):this.toImage(r,this.createImage(i).composite(e))}isDirectImage(e){var r;if(e.layers.length!==1)return!1;let i=e.layers[0];if(i.x!==0||i.y!==0||i.crop!=null||i.extract!=null||i.resize!=null)return!1;let n=i.tiff.getImage(i.source.imageId),o=n.tileSize;return!(o.height!==this.tileSize||o.width!==this.tileSize||!(!((r=n.compression)===null||r===void 0)&&r.includes(e.format))||e.background.alpha!==0)}async compose(e){var r;let i=(r=e.metrics)!==null&&r!==void 0?r:new vs;if(i.start("compose:overlay"),this.isDirectImage(e)){let h=e.layers[0],d=await h.tiff.getTile(h.source.x,h.source.y,h.source.imageId);return i.end("compose:overlay"),d==null?{buffer:await this.getEmptyImage(e.format,e.background),metrics:i,layers:0}:(i.start("compose:direct"),i.end("compose:direct"),{buffer:Buffer.from(d.bytes),metrics:i,layers:1})}let n=[];for(let h of e.layers)this.isTooLarge(h)||n.push(this.composeTile(h,e.resizeKernel));let o=await Promise.all(n).then(h=>h.filter(PS));i.end("compose:overlay"),i.start("compose:compress");let a=await this.getImageBuffer(o,e.format,e.background);return i.end("compose:compress"),{buffer:a,metrics:i,layers:o.length}}async composeTile(e,r){let i=await e.tiff.getTile(e.source.x,e.source.y,e.source.imageId);if(i==null)return null;let n=(0,Lh.default)(Buffer.from(i.bytes)),{extract:o,resize:a,crop:h}=e;if(o&&n.extract({top:0,left:0,width:o.width,height:o.height}),a){let d={fit:Lh.default.fit.cover,kernel:a.scale>1?r.in:r.out};n.resize(a.width,a.height,d)}return h&&n.extract({top:h.y,left:h.x,width:h.width,height:h.height}),{input:await n.toBuffer(),top:e.y,left:e.x}}createImage(e){return(0,Lh.default)({create:{width:this.tileSize,height:this.tileSize,channels:4,background:e}})}};Tn.MaxImageSize=256*2**15;var Ud=class{constructor(e){Hc(this,"value");Hc(this,"next");this.value=e}},fi,Cs,As,U1=class{constructor(){bt(this,fi,void 0);bt(this,Cs,void 0);bt(this,As,void 0);this.clear()}enqueue(e){let r=new Ud(e);Ee(this,fi)?(Ee(this,Cs).next=r,Ze(this,Cs,r)):(Ze(this,fi,r),Ze(this,Cs,r)),Gc(this,As)._++}dequeue(){let e=Ee(this,fi);if(!!e)return Ze(this,fi,Ee(this,fi).next),Gc(this,As)._--,e.value}clear(){Ze(this,fi,void 0),Ze(this,Cs,void 0),Ze(this,As,0)}get size(){return Ee(this,As)}*[Symbol.iterator](){let e=Ee(this,fi);for(;e;)yield e.value,e=e.next}};fi=new WeakMap,Cs=new WeakMap,As=new WeakMap;function jd(t){if(!((Number.isInteger(t)||t===Number.POSITIVE_INFINITY)&&t>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up");let e=new U1,r=0,i=()=>{r--,e.size>0&&e.dequeue()()},n=async(h,d,m)=>{r++;let p=(async()=>h(...m))();d(p);try{await p}catch{}i()},o=(h,d,m)=>{e.enqueue(n.bind(void 0,h,d,m)),(async()=>(await Promise.resolve(),r<t&&e.size>0&&e.dequeue()()))()},a=(h,...d)=>new Promise(m=>{o(h,m,d)});return Object.defineProperties(a,{activeCount:{get:()=>r},pendingCount:{get:()=>e.size},clearQueue:{value:()=>{e.clear()}}}),a}var OS=jd(Qe.getNumber(Qe.TiffConcurrency,25));function kS(t){let e=t.toLowerCase();return e.endsWith(".tif")||e.endsWith(".tiff")?t:`${t}.tiff`}var LS=new Tn(256),NS={in:"lanczos3",out:"lanczos3"},BS={r:0,g:0,b:0,alpha:0},Nh={async getTiffsForTile(t,e,r){let i=await we.getAllImagery(e.layers,[r.tileMatrix.projection]),n=[],o=r.tileMatrix.tileToSourceBounds(r.tile),a=Mt.convertZoomLevel(r.tile.z,r.tileMatrix,Zn.get(Re.Google));for(let h of e.layers){if(h.maxZoom!=null&&a>h.maxZoom||h.minZoom!=null&&a<h.minZoom)continue;let d=h[r.tileMatrix.projection.code];if(d==null){t.log.warn({layer:h.name,projection:r.tileMatrix.projection.code},"Failed to lookup imagery");continue}let m=i.get(d);if(m==null){t.log.warn({layer:h.name,projection:r.tileMatrix.projection.code,imgId:d},"Failed to lookup imagery");continue}if(!!o.intersects(_e.fromJson(m.bounds)))for(let p of m.files){if(!o.intersects(_e.fromJson(p)))continue;let M=Er.join(m.uri,kS(p.name));n.push(M)}}return n},async tile(t,e,r){if(r.tileType===ir.MapboxVectorTiles)return Se();let i=await this.getTiffsForTile(t,e,r),n=qe.key(i);if(qe.isNotModified(t,n))return ct();let o=[];for(let M of i)o.push(OS(()=>Xt.getCog(M).catch(R=>(t.log.warn({error:R,tiff:M},"TiffLoadFailed"),null))));let a=(await Promise.all(o)).filter(M=>M!=null),d=await new aa(r.tileMatrix).tile(a,r.tile.x,r.tile.y,r.tile.z),m=await LS.compose({layers:d,format:r.tileType,background:e.background??BS,resizeKernel:e.resizeKernel??NS,metrics:t.timer});t.set("layersUsed",m.layers),t.set("bytes",m.buffer.byteLength);let p=new Q(200,"ok");return p.header(re.ETag,n),p.header(re.CacheControl,"public, max-age=604800, stale-while-revalidate=86400"),p.buffer(m.buffer,"image/"+r.tileType),p}};var US={},DS=[{tileSet:"health",tileMatrix:lt,tileType:He.Png,tile:{x:252,y:156,z:8}},{tileSet:"health",tileMatrix:on,tileType:He.Png,tile:{x:30,y:33,z:6}}],N4=256;async function zS(t){if(Buffer.isBuffer(t.buf))return t.buf;let e=t.tile,r=`static/expected_tile_${t.tileMatrix.identifier}_${e.x}_${e.y}_z${e.z}.${t.tileType}`;try{return await $d.promises.readFile(r)}catch(i){if(i.code!=="ENOENT")throw i;let n=Bh.join(Bh.dirname(D4.default.fileURLToPath(US.url)),"..","..",r);return await $d.promises.readFile(n)}}async function Fd(t){let e=await we.TileSet.get(we.TileSet.id("health"));if(e==null)throw new Q(500,'TileSet: "health" not found');for(let i of DS){let n=await Nh.tile(t,e,i);if(n.status!==200)return new Q(500,n.statusDescription);if(!Buffer.isBuffer(n._body))throw new Q(500,"Not a Buffer response content.");let o=await(0,qd.default)(n._body).raw().toBuffer(),a=await zS(i);i.buf=a;let h=await(0,qd.default)(a).raw().toBuffer(),d=Buffer.alloc(h.length),m=(0,B4.default)(h,o,d,N4,N4);if(m)return t.log.error({missMatchedPixels:m,projection:i.tileMatrix.identifier,xyz:i.tile},"Health:MissMatch"),new Q(500,"TileSet does not match.")}let r=new Q(200,"ok");return r.header(re.CacheControl,"no-store"),r}var z4=require("util"),U4=require("zlib");var jS=(0,z4.promisify)(U4.gzip);function $S(t){return t==null?!1:!!(t.endsWith(".geojson")||t.endsWith(".json"))}async function j4(t){let e=t.params.fileName;if(!$S(e))return Se();let r=await we.Imagery.get(we.Imagery.id(t.params.imageryId));if(r==null)return Se();let i=Er.join(r.uri,e);try{let n=await Er.read(i),o=qe.key(n);if(qe.isNotModified(t,o))return ct();let a=new Q(200,"ok");return a.header(re.ETag,o),a.header(re.ContentEncoding,"gzip"),a.header(re.CacheControl,"public, max-age=604800, stale-while-revalidate=86400"),a.buffer(Ui(n)?n:await jS(n),"application/json"),t.set("bytes",n.byteLength),a}catch{return t.log.warn({targetPath:i},"ImageryMetadata:Failed"),Se()}}var $4=new Q(200,"ok");$4.header(re.CacheControl,"no-store");async function Wd(){return $4}var q4=de(require("path"),1);var Hd=new Map;Hd.set(".png","image/png");Hd.set(".json","application/json");async function F4(t){let e=Qe.get(Qe.AssetLocation);if(e==null)return Se();let r=q4.default.extname(t.params.spriteName),i=Hd.get(r);if(i==null)return Se();let n=nt.join("sprites",t.params.spriteName);if(e.endsWith(".tar.co"))return z1(t,e,n,i);try{let o=nt.join(e,n);t.set("target",o);let a=await nt.read(o),h=qe.key(a);if(qe.isNotModified(t,h))return ct();let d=Q.ok().buffer(a,i);return d.header(re.ETag,h),d.header(re.CacheControl,"public, max-age=604800, stale-while-revalidate=86400"),Ui(a)&&d.header(re.ContentEncoding,"gzip"),d}catch(o){if(o.code===404)return Se();throw o}}async function W4(t){let e=wt.getTileMatrixSet(t.params.tileMatrix);if(e==null)return Se();let r=wt.apiKey(t);t.timer.start("tileset:load");let i=await we.TileSet.get(we.TileSet.id(t.params.tileSet));if(t.timer.end("tileset:load"),i==null)return Se();let n=wt.getRequestedFormats(t)??[i.format],h={tiles:[[Qe.get(Qe.PublicUrlBase)??"","v1","tiles",i.name,e.identifier,"{z}","{x}","{y}"].join("/")+`.${n[0]}?api=${r}`],tilejson:"3.0.0"},d=Mt.convertZoomLevel(i.maxZoom??30,lt,e,!0),m=Mt.convertZoomLevel(i.minZoom??0,lt,e,!0);i.maxZoom&&(h.maxzoom=d),i.minZoom&&(h.minzoom=m);let p=JSON.stringify(h),M=Buffer.from(p),R=new Q(200,"ok");return R.header(re.CacheControl,"no-store"),R.buffer(M,"application/json"),t.set("bytes",M.byteLength),R}var H4=require("url");function Dh(t,e){if(t==null)return"";let r=Qe.get(Qe.PublicUrlBase)??"";if(!t.startsWith("/"))return t;let i=new H4.URL(nt.join(r,t));return e&&i.searchParams.set("api",e),i.toString().replace(/%7B/g,"{").replace(/%7D/g,"}")}function qS(t,e){let r=JSON.parse(JSON.stringify(t.sources));for(let[i,n]of Object.entries(r)){if(n.type==="vector")n.url=Dh(n.url,e);else if(n.type==="raster"&&Array.isArray(n.tiles))for(let o=0;o<n.tiles.length;o++)n.tiles[o]=Dh(n.tiles[o],e);r[i]=n}return{version:8,id:t.id,name:t.name,sources:r,layers:t.layers,metadata:t.metadata??{},glyphs:Dh(t.glyphs),sprite:Dh(t.sprite)}}async function Gd(t){let e=wt.apiKey(t),r=t.params.styleName,i=we.Style.id(r),n=await we.Style.get(i);if(n==null)return Se();let o=qS(n.style,e),a=Buffer.from(JSON.stringify(o)),h=qe.key(a);if(qe.isNotModified(t,h))return ct();let d=new Q(200,"ok");return d.header(re.ETag,h),d.header(re.CacheControl,"no-store"),d.buffer(a,"application/json"),t.set("bytes",a.byteLength),d}var Z4=require("crypto");var FS={xmlns:"http://www.opengis.net/wmts/1.0","xmlns:ows":"http://www.opengis.net/ows/1.1","xmlns:xlink":"http://www.w3.org/1999/xlink","xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","xmlns:gml":"http://www.opengis.net/gml","xsi:schemaLocation":"http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd",version:"1.0.0"};function G4(t,e){return jr.get(t).boundsToWgs84BoundingBox(e)}var V4=6,K4=4;function J4(t,e){return Number(t.toFixed(e)).toString()}function zh(t,e,r){return`${J4(t,r)} ${J4(e,r)}`}var Uh=class{constructor(e){this.tileMatrixSets=new Map;this.isIndividualLayers=!1;this.httpBase=e.httpBase,this.provider=e.provider,this.tileSet=e.tileSet,this.isIndividualLayers=e.isIndividualLayers;for(let r of e.tileMatrix)this.tileMatrixSets.set(r.identifier,r);this.apiKey=e.apiKey,this.formats=e.formats??h4,this.imagery=e.imagery}async loadImagery(){let e=new Set;for(let r of this.tileMatrixSets.values())for(let i of this.tileSet.layers){let n=i[r.projection.code];n!=null&&e.add(n)}this.imagery=await we.Imagery.getAll(e)}buildWgs84BoundingBox(e,r){let i;if(r.length>0){let n=r[0];for(let o=1;o<r.length;o++)n=n.union(r[o]);i=G4(e,n.toJson())}else i=G4(e,e.extent);return i[2]<i[0]&&(i[0]=-180,i[2]=180),X("ows:WGS84BoundingBox",{crs:"urn:ogc:def:crs:OGC:2:84"},[X("ows:LowerCorner",zh(i[0],i[1],V4)),X("ows:UpperCorner",zh(i[2],i[3],V4))])}buildBoundingBoxFromImagery(e,r){let i;for(let o of r){let a=o[e.projection.code];if(a==null)continue;let h=this.imagery.get(a);h!=null&&(i==null?i=_e.fromJson(h.bounds):i=i.union(_e.fromJson(h.bounds)))}if(i==null)return null;let n=i.toBbox();return X("ows:BoundingBox",{crs:e.projection.toUrn()},[X("ows:LowerCorner",zh(n[e.indexX],n[e.indexY],K4)),X("ows:UpperCorner",zh(n[e.indexX+2],n[e.indexY+2],K4))])}buildProvider(){if(this.provider==null)return[];let{serviceIdentification:e,serviceProvider:r}=this.provider,{contact:i}=r;return[X("ows:ServiceIdentification",[X("ows:Title",e.title),X("ows:Abstract",e.description),X("ows:ServiceType","OGC WMTS"),X("ows:ServiceTypeVersion","1.0.0"),X("ows:Fees",e.fees),X("ows:AccessConstraints",e.accessConstraints)]),X("ows:ServiceProvider",[X("ows:ProviderName",r.name),X("ows:ProviderSite",{"xlink:href":r.site}),X("ows:ServiceContact",[X("ows:IndividualName",i.individualName),X("ows:PositionName",i.position),X("ows:ContactInfo",[X("ows:Phone",[X("ows:Voice",i.phone)]),X("ows:Address",[X("ows:DeliveryPoint",i.address.deliveryPoint),X("ows:City",i.address.city),X("ows:PostalCode",i.address.postalCode),X("ows:Country",i.address.country),X("ows:ElectronicMailAddress",i.address.email)])])])])]}buildTileUrl(e,r){let i=this.apiKey?`?api=${this.apiKey}`:"";return[this.httpBase,"v1","tiles",e,"{TileMatrixSet}","{TileMatrix}","{TileCol}",`{TileRow}.${r}${i}`].join("/")}buildResourceUrl(e,r){return X("ResourceURL",{format:"image/"+r,resourceType:"tile",template:this.buildTileUrl(e,r)})}buildLayerFromImagery(e){let r=new Set,i=[];for(let d of this.tileMatrixSets.values()){let m=e[d.projection.code];m==null||this.imagery.get(m)==null||(i.push(X("TileMatrixSetLink",[X("TileMatrixSet",d.identifier)])),r.add(d))}let n=bo(e.name),o=[...r.values()],a=o[0];if(a==null)return null;let h=this.imagery.get(e[a.projection.code]??"");return h==null?null:X("Layer",[X("ows:Title",e.title??n),X("ows:Abstract",""),X("ows:Identifier",n),this.buildKeywords(h),...o.map(d=>this.buildBoundingBoxFromImagery(d,[e])),this.buildWgs84BoundingBox(a,[_e.fromJson(h.bounds)]),this.buildStyle(),...this.formats.map(d=>X("Format","image/"+d)),...i,...this.formats.map(d=>this.buildResourceUrl(n,d))])}buildLayer(e){let r=new Set,i=[];for(let m of this.tileMatrixSets.values())e.layers.find(p=>p[m.projection.code]!=null)&&(i.push(X("TileMatrixSetLink",[X("TileMatrixSet",m.identifier)])),r.add(m));let n=bo(e.name),o=[...r.values()],a=o[0];if(a==null)throw new Error("No matrix sets found for layer "+e.name);let h=o.find(m=>m.identifier===lt.identifier)??a,d=[];for(let m of e.layers){let p=this.imagery.get(m[h.projection.code]??"");p!=null&&d.push(_e.fromJson(p.bounds))}return X("Layer",[X("ows:Title",e.title??n),X("ows:Abstract",e.description??""),X("ows:Identifier",n),this.buildKeywords(e),...[...r.values()].map(m=>this.buildBoundingBoxFromImagery(m,e.layers)),this.buildWgs84BoundingBox(h,d),this.buildStyle(),...this.formats.map(m=>X("Format","image/"+m)),...i,...this.formats.map(m=>this.buildResourceUrl(n,m))])}buildKeywords(e){return e.category==null?X("ows:Keywords"):X("ows:Keywords",[X("ows:Keyword",e.category)])}buildStyle(){return X("Style",{isDefault:"true"},[X("ows:Title","Default Style"),X("ows:Identifier","default")])}buildTileMatrixSet(e){return X("TileMatrixSet",[X("ows:Title",e.def.title),e.def.abstract?X("ows:Abstract",e.def.abstract):null,X("ows:Identifier",e.identifier),X("ows:SupportedCRS",e.projection.toUrn()),e.def.wellKnownScaleSet?X("WellKnownScaleSet",e.def.wellKnownScaleSet):null,...e.def.tileMatrix.map(r=>X("TileMatrix",[X("ows:Identifier",r.identifier),X("ScaleDenominator",r.scaleDenominator),X("TopLeftCorner",r.topLeftCorner.join(" ")),X("TileWidth",r.tileWidth),X("TileHeight",r.tileHeight),X("MatrixWidth",r.matrixWidth),X("MatrixHeight",r.matrixHeight)]))])}toVNode(){let e=[];if(e.push(this.buildLayer(this.tileSet)),this.isIndividualLayers){let r=new Map;for(let n of this.tileSet.layers)r.set(bo(n.name),n);let i=Array.from(r.values()).sort((n,o)=>(n.title??n.name).localeCompare(o.title??o.name));for(let n of i)e.push(this.buildLayerFromImagery(n))}for(let r of this.tileMatrixSets.values())e.push(this.buildTileMatrixSet(r));return X("Capabilities",FS,[...this.buildProvider(),X("Contents",e)])}toXml(){return`<?xml version="1.0" encoding="utf-8"?>
187
+ `+this.toVNode().toString()}};function WS(t){if(t==null)return[lt,on];let e=wt.getTileMatrixSet(t);return e==null?null:[e]}async function jh(t){let e=wt.apiKey(t),r=t.params.tileSet??"aerial",i=WS(t.params.tileMatrix);if(i==null)return Se();let n=Qe.get(Qe.PublicUrlBase)??"";t.timer.start("tileset:load");let o=await we.TileSet.get(we.TileSet.id(r??"aerial"));if(t.timer.end("tileset:load"),o==null||o.type!==vt.Raster)return Se();let a=await we.Provider.get(we.Provider.id("linz"));t.timer.start("imagery:load");let h=await we.getAllImagery(o.layers,i.map(R=>R.projection));t.timer.end("imagery:load");let d=new Uh({httpBase:n,provider:a??void 0,tileSet:o,tileMatrix:i,isIndividualLayers:t.params.tileMatrix==null,imagery:h,apiKey:e,formats:wt.getRequestedFormats(t)}).toXml();if(d==null)return Se();let m=Buffer.from(d),p=(0,Z4.createHash)("sha256").update(m).digest("base64");if(qe.isNotModified(t,p))return ct();let M=new Q(200,"ok");return M.header(re.ETag,p),M.header(re.CacheControl,"no-store"),M.buffer(m,"text/xml"),t.set("bytes",m.byteLength),M}var Y4={async tile(t,e,r){if(r.tileType!==ir.MapboxVectorTiles)return Se();if(r.tileMatrix.identifier!==lt.identifier)return Se();if(e.layers.length>1)return new Q(500,"Too many layers in tileset");let[i]=e.layers,n=i[3857];if(n==null)return new Q(500,"Layer url not found from tileset Config");let o=(1<<r.tile.z)-1-r.tile.y,a=`tiles/${r.tile.z}/${r.tile.x}/${o}.pbf.gz`,h=`${n}#${a}`,d=qe.key(h);if(qe.isNotModified(t,d))return ct();t.timer.start("cotar:load");let m=await Xt.getCotar(n);if(m==null)return new Q(500,"Failed to load VectorTiles");t.timer.end("cotar:load"),t.timer.start("cotar:tile");let p=await m.get(a);if(p==null)return u4();t.timer.end("cotar:tile");let M=Buffer.from(p),R=Q.ok().buffer(M,"application/x-protobuf");return R.header(re.ETag,d),R.header(re.CacheControl,"public, max-age=604800, stale-while-revalidate=86400"),Ui(M)&&R.header(re.ContentEncoding,"gzip"),R}};async function X4(t){let e=wt.xyz(t);t.timer.start("tileset:load");let r=await we.TileSet.get(we.TileSet.id(e.tileSet));if(t.timer.end("tileset:load"),r==null)return Se();switch(r.type){case vt.Vector:return Y4.tile(t,r,e);case vt.Raster:return Nh.tile(t,r,e);default:return new Q(400,"Invalid tileset")}}async function Vd(){let t=new Q(200,"ok");return t.header(re.CacheControl,"no-store"),t.json({version:"v6.33.0",hash:"a53973b7ac19250dea69402478d4843aa91c4907"}),t}var Ye=lr.http(Hu.get());Ye.router.hook("request",t=>{t.set("name","LambdaTiler"),An.reset()});var Q4=0;Ye.router.hook("response",(t,e)=>{Q4++,t.set("requestsTotal",Q4),An.requests.length>0&&(t.set("requests",An.requests.slice(0,100)),t.set("requestCount",An.requests.length)),t.set("sources",{hits:Xt.cache.hits,misses:Xt.cache.misses,size:Xt.cache.currentSize,resets:Xt.cache.resets,clears:Xt.cache.clears,cacheA:Xt.cache.cacheA.size,cacheB:Xt.cache.cacheB.size}),e.header("access-control-allow-origin","*")});Ye.router.options("*",t=>Ye.router.router.find("GET",t.path)==null?Se():Q.ok());Ye.router.get("/ping",Wd);Ye.router.get("/health",Fd);Ye.router.get("/version",Vd);Ye.router.get("/v1/ping",Wd);Ye.router.get("/v1/health",Fd);Ye.router.get("/v1/version",Vd);Ye.router.get("/v1/imagery/:imageryId/:fileName",j4);Ye.router.get("/v1/sprites/:spriteName",F4);Ye.router.get("/v1/fonts.json",C4);Ye.router.get("/v1/fonts/:fontStack/:range.pbf",R4);Ye.router.get("/v1/styles/:styleName.json",Gd);Ye.router.get("/v1/tiles/:tileSet/:tileMatrix/style/:styleName.json",Gd);Ye.router.get("/v1/tiles/:tileSet/:tileMatrix/tile.json",W4);Ye.router.get("/v1/tiles/:tileSet/:tileMatrix/:z/:x/:y.:tileType",X4);Ye.router.get("/v1/tiles/:tileSet/:tileMatrix/attribution.json",yd);Ye.router.get("/v1/attribution/:tileSet/:tileMatrix/summary.json",yd);Ye.router.get("/v1/tiles/:tileSet/:tileMatrix/WMTSCapabilities.xml",jh);Ye.router.get("/v1/tiles/:tileSet/WMTSCapabilities.xml",jh);Ye.router.get("/v1/tiles/WMTSCapabilities.xml",jh);0&&(module.exports={handler});
188
188
  /*! fetch-blob. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
189
189
  /*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
190
190
  /*! node-domexception. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */