@basemaps/lambda-tiler 6.34.0 → 6.35.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/CHANGELOG.md +28 -0
- package/build/__tests__/config.data.d.ts +2 -1
- package/build/__tests__/config.data.d.ts.map +1 -1
- package/build/__tests__/config.data.js +14 -1
- package/build/__tests__/config.data.js.map +1 -1
- package/build/__tests__/tile.style.json.test.js +17 -3
- package/build/__tests__/tile.style.json.test.js.map +1 -1
- package/build/__tests__/wmts.capability.test.js +17 -0
- package/build/__tests__/wmts.capability.test.js.map +1 -1
- package/build/arcgis/__tests__/arcgis.style.json.test.js +18 -15
- package/build/arcgis/__tests__/arcgis.style.json.test.js.map +1 -1
- package/build/arcgis/__tests__/vector.tiler.server.test.js +14 -7
- package/build/arcgis/__tests__/vector.tiler.server.test.js.map +1 -1
- package/build/arcgis/arcgis.style.json.d.ts.map +1 -1
- package/build/arcgis/arcgis.style.json.js +6 -4
- package/build/arcgis/arcgis.style.json.js.map +1 -1
- package/build/arcgis/vector.tile.server.d.ts.map +1 -1
- package/build/arcgis/vector.tile.server.js +4 -2
- package/build/arcgis/vector.tile.server.js.map +1 -1
- package/build/index.d.ts +1 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +7 -8
- package/build/index.js.map +1 -1
- package/build/routes/__tests__/attribution.test.js +3 -2
- package/build/routes/__tests__/attribution.test.js.map +1 -1
- package/build/routes/__tests__/fonts.test.js +36 -7
- package/build/routes/__tests__/fonts.test.js.map +1 -1
- package/build/routes/__tests__/health.test.js +4 -2
- package/build/routes/__tests__/health.test.js.map +1 -1
- package/build/routes/__tests__/sprites.test.js +3 -4
- package/build/routes/__tests__/sprites.test.js.map +1 -1
- package/build/routes/__tests__/tile.json.test.js +24 -2
- package/build/routes/__tests__/tile.json.test.js.map +1 -1
- package/build/routes/__tests__/tile.style.json.test.js +58 -7
- package/build/routes/__tests__/tile.style.json.test.js.map +1 -1
- package/build/routes/__tests__/wmts.test.js +17 -14
- package/build/routes/__tests__/wmts.test.js.map +1 -1
- package/build/routes/__tests__/xyz.test.js +4 -2
- package/build/routes/__tests__/xyz.test.js.map +1 -1
- package/build/routes/attribution.d.ts.map +1 -1
- package/build/routes/attribution.js +20 -10
- package/build/routes/attribution.js.map +1 -1
- package/build/routes/config.d.ts +22 -0
- package/build/routes/config.d.ts.map +1 -0
- package/build/routes/config.js +63 -0
- package/build/routes/config.js.map +1 -0
- package/build/routes/health.d.ts.map +1 -1
- package/build/routes/health.js +3 -2
- package/build/routes/health.js.map +1 -1
- package/build/routes/imagery.d.ts.map +1 -1
- package/build/routes/imagery.js +3 -2
- package/build/routes/imagery.js.map +1 -1
- package/build/routes/tile.json.d.ts.map +1 -1
- package/build/routes/tile.json.js +7 -4
- package/build/routes/tile.json.js.map +1 -1
- package/build/routes/tile.style.json.d.ts +4 -3
- package/build/routes/tile.style.json.d.ts.map +1 -1
- package/build/routes/tile.style.json.js +53 -12
- package/build/routes/tile.style.json.js.map +1 -1
- package/build/routes/tile.wmts.d.ts.map +1 -1
- package/build/routes/tile.wmts.js +7 -4
- package/build/routes/tile.wmts.js.map +1 -1
- package/build/routes/tile.xyz.d.ts.map +1 -1
- package/build/routes/tile.xyz.js +4 -2
- package/build/routes/tile.xyz.js.map +1 -1
- package/build/routes/tile.xyz.raster.d.ts.map +1 -1
- package/build/routes/tile.xyz.raster.js +4 -2
- package/build/routes/tile.xyz.raster.js.map +1 -1
- package/build/util/__test__/config.loader.test.d.ts +2 -0
- package/build/util/__test__/config.loader.test.d.ts.map +1 -0
- package/build/util/__test__/config.loader.test.js +79 -0
- package/build/util/__test__/config.loader.test.js.map +1 -0
- package/build/util/assets.provider.d.ts +1 -4
- package/build/util/assets.provider.d.ts.map +1 -1
- package/build/util/assets.provider.js +23 -10
- package/build/util/assets.provider.js.map +1 -1
- package/build/util/config.cache.d.ts +3 -3
- package/build/util/config.cache.d.ts.map +1 -1
- package/build/util/config.cache.js +14 -15
- package/build/util/config.cache.js.map +1 -1
- package/build/util/config.loader.d.ts +10 -0
- package/build/util/config.loader.d.ts.map +1 -0
- package/build/util/config.loader.js +47 -0
- package/build/util/config.loader.js.map +1 -0
- package/build/wmts.capability.d.ts +3 -1
- package/build/wmts.capability.d.ts.map +1 -1
- package/build/wmts.capability.js +5 -15
- package/build/wmts.capability.js.map +1 -1
- package/dist/index.js +66 -66
- package/dist/node_modules/.package-lock.json +1 -1
- package/dist/package-lock.json +2 -2
- package/dist/package.json +1 -1
- package/package.json +8 -9
- package/src/__tests__/config.data.ts +25 -1
- package/src/__tests__/tile.style.json.test.ts +19 -3
- package/src/__tests__/wmts.capability.test.ts +21 -0
- package/src/arcgis/__tests__/arcgis.style.json.test.ts +21 -17
- package/src/arcgis/__tests__/vector.tiler.server.test.ts +17 -8
- package/src/arcgis/arcgis.style.json.ts +6 -4
- package/src/arcgis/vector.tile.server.ts +5 -2
- package/src/index.ts +9 -10
- package/src/routes/__tests__/attribution.test.ts +4 -2
- package/src/routes/__tests__/fonts.test.ts +44 -7
- package/src/routes/__tests__/health.test.ts +4 -2
- package/src/routes/__tests__/sprites.test.ts +3 -4
- package/src/routes/__tests__/tile.json.test.ts +30 -2
- package/src/routes/__tests__/tile.style.json.test.ts +68 -9
- package/src/routes/__tests__/wmts.test.ts +23 -17
- package/src/routes/__tests__/xyz.test.ts +4 -2
- package/src/routes/attribution.ts +23 -8
- package/src/routes/config.ts +83 -0
- package/src/routes/health.ts +4 -2
- package/src/routes/imagery.ts +3 -2
- package/src/routes/tile.json.ts +10 -4
- package/src/routes/tile.style.json.ts +58 -12
- package/src/routes/tile.wmts.ts +9 -4
- package/src/routes/tile.xyz.raster.ts +4 -2
- package/src/routes/tile.xyz.ts +5 -2
- package/src/util/__test__/config.loader.test.ts +116 -0
- package/src/util/assets.provider.ts +11 -12
- package/src/util/config.cache.ts +18 -18
- package/src/util/config.loader.ts +50 -0
- package/src/wmts.capability.ts +9 -15
- package/tsconfig.tsbuildinfo +1 -1
package/dist/index.js
CHANGED
|
@@ -1,34 +1,23 @@
|
|
|
1
|
-
var Jg=Object.create;var Ga=Object.defineProperty;var Zg=Object.getOwnPropertyDescriptor;var Yg=Object.getOwnPropertyNames;var Xg=Object.getPrototypeOf,Qg=Object.prototype.hasOwnProperty;var ey=(t,e,r)=>e in t?Ga(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Va=(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)Ga(t,r,{get:e[r],enumerable:!0})},Xd=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Yg(e))!Qg.call(t,n)&&n!==r&&Ga(t,n,{get:()=>e[n],enumerable:!(i=Zg(e,n))||i.enumerable});return t};var me=(t,e,r)=>(r=t!=null?Jg(Xg(t)):{},Xd(e||!t||!t.__esModule?Ga(r,"default",{value:t,enumerable:!0}):r,t)),ty=t=>Xd(Ga({},"__esModule",{value:!0}),t);var Wc=(t,e,r)=>(ey(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)),vt=(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)},Xe=(t,e,r,i)=>(Qd(t,e,"write to private field"),i?i.call(t,r):e.set(t,r),r),Hc=(t,e,r,i)=>({set _(n){Xe(t,e,n,r)},get _(){return Ee(t,e,i)}});var i2=V(Fl=>{"use strict";Object.defineProperty(Fl,"__esModule",{value:!0});Fl.Nztm2000Quad=void 0;Fl.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(Wl=>{"use strict";Object.defineProperty(Wl,"__esModule",{value:!0});Wl.Nztm2000=void 0;Wl.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(yo=>{"use strict";Object.defineProperty(yo,"__esModule",{value:!0});yo.Nztm2000=yo.Nztm2000Quad=void 0;var sy=i2();Object.defineProperty(yo,"Nztm2000Quad",{enumerable:!0,get:function(){return sy.Nztm2000Quad}});var oy=n2();Object.defineProperty(yo,"Nztm2000",{enumerable:!0,get:function(){return oy.Nztm2000}})});var bo=V((Vl,o2)=>{(function(t,e){typeof Vl=="object"&&typeof o2<"u"?e(Vl):typeof define=="function"&&define.amd?define(["exports"],e):e(t.ULID={})})(Vl,function(t){"use strict";function e(C){var P=new Error(C);return P.source="ulid",P}var r="0123456789ABCDEFGHJKMNPQRSTVWXYZ",i=r.length,n=Math.pow(2,48)-1,o=10,a=16;function h(C,P,k){return P>C.length-1?C:C.substr(0,P)+k+C.substr(P+1)}function d(C){for(var P=void 0,k=C.length,B=void 0,z=void 0,H=i-1;!P&&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}P=h(C,k,r[z+1])}if(typeof P=="string")return P;throw e("cannot increment this string")}function m(C){var P=Math.floor(C()*i);return P===i&&(P=i-1),r.charAt(P)}function p(C,P){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="";P>0;P--)k=C%i,B=r.charAt(k)+B,C=(C-k)/i;return B}function M(C,P){for(var k="";C>0;C--)k=m(P)+k;return k}function R(C){if(C.length!==o+a)throw e("malformed ulid");var P=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(P>n)throw e("malformed ulid, timestamp too large");return P}function x(){var C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,P=arguments[1];P||(P=typeof window<"u"?window:null);var k=P&&(P.crypto||P.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 P=0,k=void 0;return function(z){if(isNaN(z)&&(z=Date.now()),z<=P){var H=k=d(k);return p(P,o)+H}P=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((eE,a2)=>{"use strict";function hy(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 P=(C-T)*m+1>>>0,k=new Uint8Array(P);T!==C;){for(var B=x[T],z=0,H=P-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=P-E;J!==P&&k[J]===0;)J++;for(var se=h.repeat(w);J<P;++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,P=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*P[z]>>>0,P[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&&P[H]===0;)H++;for(var J=new Uint8Array(E+(C-H)),se=E;H!==C;)J[se++]=P[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=hy});var b2=V((Xl,y2)=>{(function(t,e){typeof Xl=="object"&&typeof y2<"u"?e(Xl):typeof define=="function"&&define.amd?define(["exports"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.WebStreamsPolyfill={}))})(Xl,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 P(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(I){return x(I)}}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,I=_;_._elements.length===J-1&&(I={_elements:[],_next:void 0}),_._elements.push(f),I!==_&&(this._back=I,_._next=I),++this._size}shift(){let f=this._front,_=f,I=this._cursor,N=I+1,j=f._elements,$=j[I];return N===J&&(_=f._next,N=0),--this._size,this._cursor=N,f!==_&&(this._front=_),j[I]=void 0,$}forEach(f){let _=this._cursor,I=this._front,N=I._elements;for(;(_!==N.length||I._next!==void 0)&&!(_===N.length&&(I=I._next,N=I._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"?at(u):f._state==="closed"?di(u):Ut(u,f._storedError)}function Ue(u,f){let _=u._ownerReadableStream;return rr(_,f)}function Te(u){u._ownerReadableStream._state==="readable"?ma(u,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):jh(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 at(u){u._closedPromise=M((f,_)=>{u._closedPromise_resolve=f,u._closedPromise_reject=_})}function Ut(u,f){at(u),ma(u,f)}function di(u){at(u),In(u)}function ma(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 jh(u,f){Ut(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 pa=e("[[AbortSteps]]"),cr=e("[[ErrorSteps]]"),ga=e("[[CancelSteps]]"),Ps=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 $h(u){return typeof u=="object"||typeof u=="function"}function ut(u,f){if(u!==void 0&&!$h(u))throw new TypeError(`${f} is not an object.`)}function er(u,f){if(typeof u!="function")throw new TypeError(`${f} is not a function.`)}function q1(u){return typeof u=="object"&&u!==null||typeof u=="function"}function dt(u,f){if(!q1(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 ya(u,f,_){if(u===void 0)throw new TypeError(`${f} is required in '${_}'.`)}function ba(u){return Number(u)}function $1(u){return u===0?0:u}function Fh(u){return $1(qh(u))}function F1(u,f){let I=Number.MAX_SAFE_INTEGER,N=Number(u);if(N=$1(N),!mi(N))throw new TypeError(`${f} is not a finite number`);if(N=Fh(N),N<0||N>I)throw new TypeError(`${f} is outside the accepted range of ${0} to ${I}, inclusive`);return!mi(N)||N===0?0:N}function va(u,f){if(!Kr(u))throw new TypeError(`${f} is not a ReadableStream.`)}function ji(u){return new Z(u)}function W1(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 qi(u){let f=u._reader;return!(f===void 0||!lt(f))}class Z{constructor(f){if(Tr(f,1,"ReadableStreamDefaultReader"),va(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 lt(this)?this._closedPromise:x(Os("closed"))}cancel(f=void 0){return lt(this)?this._ownerReadableStream===void 0?x(Ne("cancel")):Ue(this,f):x(Os("cancel"))}read(){if(!lt(this))return x(Os("read"));if(this._ownerReadableStream===void 0)return x(Ne("read from"));let f,_,I=M((j,$)=>{f=j,_=$});return Pr(this,{_chunkSteps:j=>f({value:j,done:!1}),_closeSteps:()=>f({value:void 0,done:!0}),_errorSteps:j=>_(j)}),I}releaseLock(){if(!lt(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 lt(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_readRequests")?!1:u instanceof Z}function Pr(u,f){let _=u._ownerReadableStream;_._disturbed=!0,_._state==="closed"?f._closeSteps():_._state==="errored"?f._errorSteps(_._storedError):_._readableStreamController[Ps](f)}function Os(u){return new TypeError(`ReadableStreamDefaultReader.prototype.${u} can only be used on a ReadableStreamDefaultReader`)}let H1=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class G1{constructor(f,_){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=f,this._preventCancel=_}next(){let f=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?P(this._ongoingPromise,f,f):f(),this._ongoingPromise}return(f){let _=()=>this._returnSteps(f);return this._ongoingPromise?P(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 _,I,N=M(($,te)=>{_=$,I=te});return Pr(f,{_chunkSteps:$=>{this._ongoingPromise=void 0,B(()=>_({value:$,done:!1}))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,Te(f),_({value:void 0,done:!0})},_errorSteps:$=>{this._ongoingPromise=void 0,this._isFinished=!0,Te(f),I($)}}),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 I=Ue(_,f);return Te(_),P(I,()=>({value:f,done:!0}))}return Te(_),R({value:f,done:!0})}}let V1={next(){return K1(this)?this._asyncIteratorImpl.next():x(wa("next"))},return(u){return K1(this)?this._asyncIteratorImpl.return(u):x(wa("return"))}};H1!==void 0&&Object.setPrototypeOf(V1,H1);function Wh(u,f){let _=ji(u),I=new G1(_,f),N=Object.create(V1);return N._asyncIteratorImpl=I,N}function K1(u){if(!o(u)||!Object.prototype.hasOwnProperty.call(u,"_asyncIteratorImpl"))return!1;try{return u._asyncIteratorImpl instanceof G1}catch{return!1}}function wa(u){return new TypeError(`ReadableStreamAsyncIterator.${u} can only be used on a ReadableSteamAsyncIterator`)}let J1=Number.isNaN||function(u){return u!==u};function On(u){return u.slice()}function Z1(u,f,_,I,N){new Uint8Array(u).set(new Uint8Array(_,I,N),f)}function _a(u){return u}function pi(u){return!1}function xa(u,f,_){if(u.slice)return u.slice(f,_);let I=_-f,N=new ArrayBuffer(I);return Z1(N,0,u,f,I),N}function Hh(u){return!(typeof u!="number"||J1(u)||u<0)}function Y1(u){let f=xa(u.buffer,u.byteOffset,u.byteOffset+u.byteLength);return new Uint8Array(f)}function Sa(u){let f=u._queue.shift();return u._queueTotalSize-=f.size,u._queueTotalSize<0&&(u._queueTotalSize=0),f.value}function ue(u,f,_){if(!Hh(_)||_===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");u._queue.push({value:f,size:_}),u._queueTotalSize+=_}function Gh(u){return u._queue.peek().value}function Fr(u){u._queue=new se,u._queueTotalSize=0}class kn{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!ks(this))throw $i("view");return this._view}respond(f){if(!ks(this))throw $i("respond");if(Tr(f,1,"respond"),f=F1(f,"First parameter"),this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");pi(this._view.buffer),Nn(this._associatedReadableByteStreamController,f)}respondWithNewView(f){if(!ks(this))throw $i("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),Bn(this._associatedReadableByteStreamController,f)}}Object.defineProperties(kn.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(kn.prototype,e.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class Ze{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!gi(this))throw Fi("byobRequest");return Ca(this)}get desiredSize(){if(!gi(this))throw Fi("desiredSize");return Aa(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");jt(this,f)}[ga](f){X1(this),Fr(this);let _=this._cancelAlgorithm(f);return Bs(this),_}[Ps](f){let _=this._controlledReadableByteStream;if(this._queueTotalSize>0){let N=this._queue.shift();this._queueTotalSize-=N.byteLength,el(this);let j=new Uint8Array(N.buffer,N.byteOffset,N.byteLength);f._chunkSteps(j);return}let I=this._autoAllocateChunkSize;if(I!==void 0){let N;try{N=new ArrayBuffer(I)}catch($){f._errorSteps($);return}let j={buffer:N,bufferByteLength:I,byteOffset:0,byteLength:I,bytesFilled:0,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(j)}W1(_,f),yi(this)}}Object.defineProperties(Ze.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Ze.prototype,e.toStringTag,{value:"ReadableByteStreamController",configurable:!0});function gi(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_controlledReadableByteStream")?!1:u instanceof Ze}function ks(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_associatedReadableByteStreamController")?!1:u instanceof kn}function yi(u){if(!Jh(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))},I=>{jt(u,I)})}function X1(u){Ea(u),u._pendingPullIntos=new se}function Ma(u,f){let _=!1;u._state==="closed"&&(_=!0);let I=bi(f);f.readerType==="default"?Is(u,I,_):Pt(u,I,_)}function bi(u){let f=u.bytesFilled,_=u.elementSize;return new u.viewConstructor(u.buffer,u.byteOffset,f/_)}function Ls(u,f,_,I){u._queue.push({buffer:f,byteOffset:_,byteLength:I}),u._queueTotalSize+=I}function Q1(u,f){let _=f.elementSize,I=f.bytesFilled-f.bytesFilled%_,N=Math.min(u._queueTotalSize,f.byteLength-f.bytesFilled),j=f.bytesFilled+N,$=j-j%_,te=N,fe=!1;$>I&&(te=$-f.bytesFilled,fe=!0);let _e=u._queue;for(;te>0;){let Pe=_e.peek(),Ie=Math.min(te,Pe.byteLength),tt=f.byteOffset+f.bytesFilled;Z1(f.buffer,tt,Pe.buffer,Pe.byteOffset,Ie),Pe.byteLength===Ie?_e.shift():(Pe.byteOffset+=Ie,Pe.byteLength-=Ie),u._queueTotalSize-=Ie,Ns(u,Ie,f),te-=Ie}return fe}function Ns(u,f,_){_.bytesFilled+=f}function el(u){u._queueTotalSize===0&&u._closeRequested?(Bs(u),Gn(u._controlledReadableByteStream)):yi(u)}function Ea(u){u._byobRequest!==null&&(u._byobRequest._associatedReadableByteStreamController=void 0,u._byobRequest._view=null,u._byobRequest=null)}function tl(u){for(;u._pendingPullIntos.length>0;){if(u._queueTotalSize===0)return;let f=u._pendingPullIntos.peek();Q1(u,f)&&(Ln(u),Ma(u._controlledReadableByteStream,f))}}function Vh(u,f,_){let I=u._controlledReadableByteStream,N=1;f.constructor!==DataView&&(N=f.constructor.BYTES_PER_ELEMENT);let j=f.constructor,$=f.buffer,te={buffer:$,bufferByteLength:$.byteLength,byteOffset:f.byteOffset,byteLength:f.byteLength,bytesFilled:0,elementSize:N,viewConstructor:j,readerType:"byob"};if(u._pendingPullIntos.length>0){u._pendingPullIntos.push(te),Ta(I,_);return}if(I._state==="closed"){let fe=new j(te.buffer,te.byteOffset,0);_._closeSteps(fe);return}if(u._queueTotalSize>0){if(Q1(u,te)){let fe=bi(te);el(u),_._chunkSteps(fe);return}if(u._closeRequested){let fe=new TypeError("Insufficient bytes to fill elements in the given buffer");jt(u,fe),_._errorSteps(fe);return}}u._pendingPullIntos.push(te),Ta(I,_),yi(u)}function fr(u,f){let _=u._controlledReadableByteStream;if(Us(_))for(;Pa(_)>0;){let I=Ln(u);Ma(_,I)}}function Kh(u,f,_){if(Ns(u,f,_),_.bytesFilled<_.elementSize)return;Ln(u);let I=_.bytesFilled%_.elementSize;if(I>0){let N=_.byteOffset+_.bytesFilled,j=xa(_.buffer,N-I,N);Ls(u,j,0,j.byteLength)}_.bytesFilled-=I,Ma(u._controlledReadableByteStream,_),tl(u)}function Ra(u,f){let _=u._pendingPullIntos.peek();Ea(u),u._controlledReadableByteStream._state==="closed"?fr(u):Kh(u,f,_),yi(u)}function Ln(u){return u._pendingPullIntos.shift()}function Jh(u){let f=u._controlledReadableByteStream;return f._state!=="readable"||u._closeRequested||!u._started?!1:!!(qi(f)&&Tt(f)>0||Us(f)&&Pa(f)>0||Aa(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 I=new TypeError("Insufficient bytes to fill elements in the given buffer");throw jt(u,I),I}Bs(u),Gn(f)}}function Ds(u,f){let _=u._controlledReadableByteStream;if(u._closeRequested||_._state!=="readable")return;let I=f.buffer,N=f.byteOffset,j=f.byteLength,$=I;if(u._pendingPullIntos.length>0){let te=u._pendingPullIntos.peek();pi(te.buffer),te.buffer=te.buffer}if(Ea(u),qi(_))if(Tt(_)===0)Ls(u,$,N,j);else{u._pendingPullIntos.length>0&&Ln(u);let te=new Uint8Array($,N,j);Is(_,te,!1)}else Us(_)?(Ls(u,$,N,j),tl(u)):Ls(u,$,N,j);yi(u)}function jt(u,f){let _=u._controlledReadableByteStream;_._state==="readable"&&(X1(u),Fr(u),Bs(u),El(_,f))}function Ca(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),I=Object.create(kn.prototype);Zh(I,u,_),u._byobRequest=I}return u._byobRequest}function Aa(u){let f=u._controlledReadableByteStream._state;return f==="errored"?null:f==="closed"?0:u._strategyHWM-u._queueTotalSize}function Nn(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,Ra(u,f)}function Bn(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,Ra(u,N)}function rl(u,f,_,I,N,j,$){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=I,f._cancelAlgorithm=N,f._autoAllocateChunkSize=$,f._pendingPullIntos=new se,u._readableStreamController=f;let te=_();E(R(te),()=>{f._started=!0,yi(f)},fe=>{jt(f,fe)})}function il(u,f,_){let I=Object.create(Ze.prototype),N=()=>{},j=()=>R(void 0),$=()=>R(void 0);f.start!==void 0&&(N=()=>f.start(I)),f.pull!==void 0&&(j=()=>f.pull(I)),f.cancel!==void 0&&($=fe=>f.cancel(fe));let te=f.autoAllocateChunkSize;if(te===0)throw new TypeError("autoAllocateChunkSize must be greater than 0");rl(u,I,N,j,$,_,te)}function Zh(u,f,_){u._associatedReadableByteStreamController=f,u._view=_}function $i(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 Ta(u,f){u._reader._readIntoRequests.push(f)}function Pt(u,f,_){let N=u._reader._readIntoRequests.shift();_?N._closeSteps(f):N._chunkSteps(f)}function Pa(u){return u._reader._readIntoRequests.length}function Us(u){let f=u._reader;return!(f===void 0||!qt(f))}class Wi{constructor(f){if(Tr(f,1,"ReadableStreamBYOBReader"),va(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 qt(this)?this._closedPromise:x(gt("closed"))}cancel(f=void 0){return qt(this)?this._ownerReadableStream===void 0?x(Ne("cancel")):Ue(this,f):x(gt("cancel"))}read(f){if(!qt(this))return x(gt("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 _,I,N=M(($,te)=>{_=$,I=te});return pt(this,f,{_chunkSteps:$=>_({value:$,done:!1}),_closeSteps:$=>_({value:$,done:!0}),_errorSteps:$=>I($)}),N}releaseLock(){if(!qt(this))throw gt("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 qt(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_readIntoRequests")?!1:u instanceof Wi}function pt(u,f,_){let I=u._ownerReadableStream;I._disturbed=!0,I._state==="errored"?_._errorSteps(I._storedError):Vh(I._readableStreamController,f,_)}function gt(u){return new TypeError(`ReadableStreamBYOBReader.prototype.${u} can only be used on a ReadableStreamBYOBReader`)}function Ir(u,f){let{highWaterMark:_}=u;if(_===void 0)return f;if(J1(_)||_<0)throw new RangeError("Invalid highWaterMark");return _}function Hr(u){let{size:f}=u;return f||(()=>1)}function js(u,f){ut(u,f);let _=u?.highWaterMark,I=u?.size;return{highWaterMark:_===void 0?void 0:ba(_),size:I===void 0?void 0:nl(I,`${f} has member 'size' that`)}}function nl(u,f){return er(u,f),_=>ba(u(_))}function Yh(u,f){ut(u,f);let _=u?.abort,I=u?.close,N=u?.start,j=u?.type,$=u?.write;return{abort:_===void 0?void 0:sl(_,u,`${f} has member 'abort' that`),close:I===void 0?void 0:Ia(I,u,`${f} has member 'close' that`),start:N===void 0?void 0:ol(N,u,`${f} has member 'start' that`),write:$===void 0?void 0:Xh($,u,`${f} has member 'write' that`),type:j}}function sl(u,f,_){return er(u,_),I=>H(u,f,[I])}function Ia(u,f,_){return er(u,_),()=>H(u,f,[])}function ol(u,f,_){return er(u,_),I=>z(u,f,[I])}function Xh(u,f,_){return er(u,_),(I,N)=>H(u,f,[I,N])}function qs(u,f){if(!Gi(u))throw new TypeError(`${f} is not a WritableStream.`)}function Qh(u){if(typeof u!="object"||u===null)return!1;try{return typeof u.aborted=="boolean"}catch{return!1}}let ec=typeof AbortController=="function";function tc(){if(ec)return new AbortController}class Hi{constructor(f={},_={}){f===void 0?f=null:dt(f,"First parameter");let I=js(_,"Second parameter"),N=Yh(f,"First parameter");if(ul(this),N.type!==void 0)throw new RangeError("Invalid type is specified");let $=Hr(I),te=Ir(I,1);cc(this,N,te,$)}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")):dr(this)?x(new TypeError("Cannot close an already-closing stream")):hl(this):x(Js("close"))}getWriter(){if(!Gi(this))throw Js("getWriter");return al(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 al(u){return new Ki(u)}function ll(u,f,_,I,N=1,j=()=>1){let $=Object.create(Hi.prototype);ul($);let te=Object.create(Ji.prototype);return Na($,te,u,f,_,I,N,j),$}function ul(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 I=u._state;if(I==="closed"||I==="errored")return R(void 0);if(u._pendingAbortRequest!==void 0)return u._pendingAbortRequest._promise;let N=!1;I==="erroring"&&(N=!0,f=void 0);let j=M(($,te)=>{u._pendingAbortRequest={_promise:void 0,_resolve:$,_reject:te,_reason:f,_wasAlreadyErroring:N}});return u._pendingAbortRequest._promise=j,N||Fs(u,f),j}function hl(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 $={_resolve:N,_reject:j};u._closeRequest=$}),I=u._writer;return I!==void 0&&u._backpressure&&f==="writable"&&ja(I),fc(u._writableStreamController),_}function rc(u){return M((_,I)=>{let N={_resolve:_,_reject:I};u._writeRequests.push(N)})}function $s(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 I=u._writer;I!==void 0&&ka(I,f),!ac(u)&&_._started&&Ws(u)}function Ws(u){u._state="errored",u._writableStreamController[cr]();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 I=u._writableStreamController[pa](_._reason);E(I,()=>{_._resolve(),vi(u)},N=>{_._reject(N),vi(u)})}function ic(u){u._inFlightWriteRequest._resolve(void 0),u._inFlightWriteRequest=void 0}function nc(u,f){u._inFlightWriteRequest._reject(f),u._inFlightWriteRequest=void 0,$s(u,f)}function sc(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&&yl(_)}function oc(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 dr(u){return!(u._closeRequest===void 0&&u._inFlightCloseRequest===void 0)}function ac(u){return!(u._inFlightWriteRequest===void 0&&u._inFlightCloseRequest===void 0)}function lc(u){u._inFlightCloseRequest=u._closeRequest,u._closeRequest=void 0}function cl(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&&za(f,u._storedError)}function Oa(u,f){let _=u._writer;_!==void 0&&f!==u._backpressure&&(f?vc(_):ja(_)),u._backpressure=f}class Ki{constructor(f){if(Tr(f,1,"WritableStreamDefaultWriter"),qs(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")!dr(f)&&f._backpressure?Zs(this):bl(this),Zi(this);else if(_==="erroring")Ua(this,f._storedError),Zi(this);else if(_==="closed")bl(this),yc(this);else{let I=f._storedError;Ua(this,I),gl(this,I)}}get closed(){return wi(this)?this._closedPromise:x(_i("closed"))}get desiredSize(){if(!wi(this))throw _i("desiredSize");if(this._ownerWritableStream===void 0)throw Un("desiredSize");return tr(this)}get ready(){return wi(this)?this._readyPromise:x(_i("ready"))}abort(f=void 0){return wi(this)?this._ownerWritableStream===void 0?x(Un("abort")):uc(this,f):x(_i("abort"))}close(){if(!wi(this))return x(_i("close"));let f=this._ownerWritableStream;return f===void 0?x(Un("close")):dr(f)?x(new TypeError("Cannot close an already-closing stream")):fl(this)}releaseLock(){if(!wi(this))throw _i("releaseLock");this._ownerWritableStream!==void 0&&dl(this)}write(f=void 0){return wi(this)?this._ownerWritableStream===void 0?x(Un("write to")):ml(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 uc(u,f){let _=u._ownerWritableStream;return Or(_,f)}function fl(u){let f=u._ownerWritableStream;return hl(f)}function hc(u){let f=u._ownerWritableStream,_=f._state;return dr(f)||_==="closed"?R(void 0):_==="errored"?x(f._storedError):fl(u)}function Hs(u,f){u._closedPromiseState==="pending"?za(u,f):bc(u,f)}function ka(u,f){u._readyPromiseState==="pending"?vl(u,f):wc(u,f)}function tr(u){let f=u._ownerWritableStream,_=f._state;return _==="errored"||_==="erroring"?null:_==="closed"?0:Dn(f._writableStreamController)}function dl(u){let f=u._ownerWritableStream,_=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");ka(u,_),Hs(u,_),f._writer=void 0,u._ownerWritableStream=void 0}function ml(u,f){let _=u._ownerWritableStream,I=_._writableStreamController,N=dc(I,f);if(_!==u._ownerWritableStream)return x(Un("write to"));let j=_._state;if(j==="errored")return x(_._storedError);if(dr(_)||j==="closed")return x(new TypeError("The stream is closing or closed and cannot be written to"));if(j==="erroring")return x(_._storedError);let $=rc(_);return mc(I,f,N),$}let Gs={};class Ji{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!La(this))throw Da("abortReason");return this._abortReason}get signal(){if(!La(this))throw Da("signal");if(this._abortController===void 0)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(f=void 0){if(!La(this))throw Da("error");this._controlledWritableStream._state==="writable"&&pl(this,f)}[pa](f){let _=this._abortAlgorithm(f);return Vs(this),_}[cr](){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 La(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_controlledWritableStream")?!1:u instanceof Ji}function Na(u,f,_,I,N,j,$,te){f._controlledWritableStream=u,u._writableStreamController=f,f._queue=void 0,f._queueTotalSize=void 0,Fr(f),f._abortReason=void 0,f._abortController=tc(),f._started=!1,f._strategySizeAlgorithm=te,f._strategyHWM=$,f._writeAlgorithm=I,f._closeAlgorithm=N,f._abortAlgorithm=j;let fe=zn(f);Oa(u,fe);let _e=_(),Pe=R(_e);E(Pe,()=>{f._started=!0,Ks(f)},Ie=>{f._started=!0,$s(u,Ie)})}function cc(u,f,_,I){let N=Object.create(Ji.prototype),j=()=>{},$=()=>R(void 0),te=()=>R(void 0),fe=()=>R(void 0);f.start!==void 0&&(j=()=>f.start(N)),f.write!==void 0&&($=_e=>f.write(_e,N)),f.close!==void 0&&(te=()=>f.close()),f.abort!==void 0&&(fe=_e=>f.abort(_e)),Na(u,N,j,$,te,fe,_,I)}function Vs(u){u._writeAlgorithm=void 0,u._closeAlgorithm=void 0,u._abortAlgorithm=void 0,u._strategySizeAlgorithm=void 0}function fc(u){ue(u,Gs,0),Ks(u)}function dc(u,f){try{return u._strategySizeAlgorithm(f)}catch(_){return Ba(u,_),1}}function Dn(u){return u._strategyHWM-u._queueTotalSize}function mc(u,f,_){try{ue(u,f,_)}catch(N){Ba(u,N);return}let I=u._controlledWritableStream;if(!dr(I)&&I._state==="writable"){let N=zn(u);Oa(I,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 I=Gh(u);I===Gs?pc(u):gc(u,I)}function Ba(u,f){u._controlledWritableStream._state==="writable"&&pl(u,f)}function pc(u){let f=u._controlledWritableStream;lc(f),Sa(u);let _=u._closeAlgorithm();Vs(u),E(_,()=>{sc(f)},I=>{oc(f,I)})}function gc(u,f){let _=u._controlledWritableStream;cl(_);let I=u._writeAlgorithm(f);E(I,()=>{ic(_);let N=_._state;if(Sa(u),!dr(_)&&N==="writable"){let j=zn(u);Oa(_,j)}Ks(u)},N=>{_._state==="writable"&&Vs(u),nc(_,N)})}function zn(u){return Dn(u)<=0}function pl(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 Da(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 Un(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 gl(u,f){Zi(u),za(u,f)}function yc(u){Zi(u),yl(u)}function za(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 bc(u,f){gl(u,f)}function yl(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 Ua(u,f){Zs(u),vl(u,f)}function bl(u){Zs(u),ja(u)}function vl(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 vc(u){Zs(u)}function wc(u,f){Ua(u,f)}function ja(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 wl=typeof DOMException<"u"?DOMException:void 0;function _c(u){if(!(typeof u=="function"||typeof u=="object"))return!1;try{return new u,!0}catch{return!1}}function xc(){let u=function(_,I){this.message=_||"",this.name=I||"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 Sc=_c(wl)?wl:xc();function xi(u,f,_,I,N,j){let $=ji(u),te=al(f);u._disturbed=!0;let fe=!1,_e=R(void 0);return M((Pe,Ie)=>{let tt;if(j!==void 0){if(tt=()=>{let ne=new Sc("Aborted","AbortError"),ge=[];I||ge.push(()=>f._state==="writable"?Or(f,ne):R(void 0)),N||ge.push(()=>u._state==="readable"?rr(u,ne):R(void 0)),_t(()=>Promise.all(ge.map(qe=>qe())),!0,ne)},j.aborted){tt();return}j.addEventListener("abort",tt)}function ir(){return M((ne,ge)=>{function qe(It){It?ne():w(tn(),qe,ge)}qe(!1)})}function tn(){return fe?R(!0):w(te._readyPromise,()=>M((ne,ge)=>{Pr($,{_chunkSteps:qe=>{_e=w(ml(te,qe),void 0,r),ne(!1)},_closeSteps:()=>ne(!0),_errorSteps:ge})}))}if(kr(u,$._closedPromise,ne=>{I?$t(!0,ne):_t(()=>Or(f,ne),!0,ne)}),kr(f,te._closedPromise,ne=>{N?$t(!0,ne):_t(()=>rr(u,ne),!0,ne)}),bt(u,$._closedPromise,()=>{_?$t():_t(()=>hc(te))}),dr(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(()=>rr(u,ne),!0,ne)}k(ir());function Yr(){let ne=_e;return w(_e,()=>ne!==_e?Yr():void 0)}function kr(ne,ge,qe){ne._state==="errored"?qe(ne._storedError):C(ge,qe)}function bt(ne,ge,qe){ne._state==="closed"?qe():T(ge,qe)}function _t(ne,ge,qe){if(fe)return;fe=!0,f._state==="writable"&&!dr(f)?T(Yr(),It):It();function It(){E(ne(),()=>Lr(ge,qe),rn=>Lr(!0,rn))}}function $t(ne,ge){fe||(fe=!0,f._state==="writable"&&!dr(f)?T(Yr(),()=>Lr(ne,ge)):Lr(ne,ge))}function Lr(ne,ge){dl(te),Te($),j!==void 0&&j.removeEventListener("abort",tt),ne?Ie(ge):Pe(void 0)}})}class Yi{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Ys(this))throw eo("desiredSize");return qa(this)}close(){if(!Ys(this))throw eo("close");if(!Xi(this))throw new TypeError("The stream is not in a state that permits close");qn(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)}[ga](f){Fr(this);let _=this._cancelAlgorithm(f);return Xs(this),_}[Ps](f){let _=this._controlledReadableStream;if(this._queue.length>0){let I=Sa(this);this._closeRequested&&this._queue.length===0?(Xs(this),Gn(_)):jn(this),f._chunkSteps(I)}else W1(_,f),jn(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 jn(u){if(!_l(u))return;if(u._pulling){u._pullAgain=!0;return}u._pulling=!0;let _=u._pullAlgorithm();E(_,()=>{u._pulling=!1,u._pullAgain&&(u._pullAgain=!1,jn(u))},I=>{Gr(u,I)})}function _l(u){let f=u._controlledReadableStream;return!Xi(u)||!u._started?!1:!!(Jr(f)&&Tt(f)>0||qa(u)>0)}function Xs(u){u._pullAlgorithm=void 0,u._cancelAlgorithm=void 0,u._strategySizeAlgorithm=void 0}function qn(u){if(!Xi(u))return;let f=u._controlledReadableStream;u._closeRequested=!0,u._queue.length===0&&(Xs(u),Gn(f))}function Qs(u,f){if(!Xi(u))return;let _=u._controlledReadableStream;if(Jr(_)&&Tt(_)>0)Is(_,f,!1);else{let I;try{I=u._strategySizeAlgorithm(f)}catch(N){throw Gr(u,N),N}try{ue(u,f,I)}catch(N){throw Gr(u,N),N}}jn(u)}function Gr(u,f){let _=u._controlledReadableStream;_._state==="readable"&&(Fr(u),Xs(u),El(_,f))}function qa(u){let f=u._controlledReadableStream._state;return f==="errored"?null:f==="closed"?0:u._strategyHWM-u._queueTotalSize}function Mc(u){return!_l(u)}function Xi(u){let f=u._controlledReadableStream._state;return!u._closeRequested&&f==="readable"}function xl(u,f,_,I,N,j,$){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=$,f._strategyHWM=j,f._pullAlgorithm=I,f._cancelAlgorithm=N,u._readableStreamController=f;let te=_();E(R(te),()=>{f._started=!0,jn(f)},fe=>{Gr(f,fe)})}function Ec(u,f,_,I){let N=Object.create(Yi.prototype),j=()=>{},$=()=>R(void 0),te=()=>R(void 0);f.start!==void 0&&(j=()=>f.start(N)),f.pull!==void 0&&($=()=>f.pull(N)),f.cancel!==void 0&&(te=fe=>f.cancel(fe)),xl(u,N,j,$,te,_,I)}function eo(u){return new TypeError(`ReadableStreamDefaultController.prototype.${u} can only be used on a ReadableStreamDefaultController`)}function Rc(u,f){return gi(u._readableStreamController)?yt(u):Cc(u)}function Cc(u,f){let _=ji(u),I=!1,N=!1,j=!1,$=!1,te,fe,_e,Pe,Ie,tt=M(bt=>{Ie=bt});function ir(){return I?(N=!0,R(void 0)):(I=!0,Pr(_,{_chunkSteps:_t=>{B(()=>{N=!1;let $t=_t,Lr=_t;j||Qs(_e._readableStreamController,$t),$||Qs(Pe._readableStreamController,Lr),I=!1,N&&ir()})},_closeSteps:()=>{I=!1,j||qn(_e._readableStreamController),$||qn(Pe._readableStreamController),(!j||!$)&&Ie(void 0)},_errorSteps:()=>{I=!1}}),R(void 0))}function tn(bt){if(j=!0,te=bt,$){let _t=On([te,fe]),$t=rr(u,_t);Ie($t)}return tt}function Yr(bt){if($=!0,fe=bt,j){let _t=On([te,fe]),$t=rr(u,_t);Ie($t)}return tt}function kr(){}return _e=mr(kr,ir,tn),Pe=mr(kr,ir,Yr),C(_._closedPromise,bt=>{Gr(_e._readableStreamController,bt),Gr(Pe._readableStreamController,bt),(!j||!$)&&Ie(void 0)}),[_e,Pe]}function yt(u){let f=ji(u),_=!1,I=!1,N=!1,j=!1,$=!1,te,fe,_e,Pe,Ie,tt=M(ne=>{Ie=ne});function ir(ne){C(ne._closedPromise,ge=>{ne===f&&(jt(_e._readableStreamController,ge),jt(Pe._readableStreamController,ge),(!j||!$)&&Ie(void 0))})}function tn(){qt(f)&&(Te(f),f=ji(u),ir(f)),Pr(f,{_chunkSteps:ge=>{B(()=>{I=!1,N=!1;let qe=ge,It=ge;if(!j&&!$)try{It=Y1(ge)}catch(rn){jt(_e._readableStreamController,rn),jt(Pe._readableStreamController,rn),Ie(rr(u,rn));return}j||Ds(_e._readableStreamController,qe),$||Ds(Pe._readableStreamController,It),_=!1,I?kr():N&&bt()})},_closeSteps:()=>{_=!1,j||Wr(_e._readableStreamController),$||Wr(Pe._readableStreamController),_e._readableStreamController._pendingPullIntos.length>0&&Nn(_e._readableStreamController,0),Pe._readableStreamController._pendingPullIntos.length>0&&Nn(Pe._readableStreamController,0),(!j||!$)&&Ie(void 0)},_errorSteps:()=>{_=!1}})}function Yr(ne,ge){lt(f)&&(Te(f),f=zs(u),ir(f));let qe=ge?Pe:_e,It=ge?_e:Pe;pt(f,ne,{_chunkSteps:nn=>{B(()=>{I=!1,N=!1;let sn=ge?$:j;if(ge?j:$)sn||Bn(qe._readableStreamController,nn);else{let zl;try{zl=Y1(nn)}catch(Fa){jt(qe._readableStreamController,Fa),jt(It._readableStreamController,Fa),Ie(rr(u,Fa));return}sn||Bn(qe._readableStreamController,nn),Ds(It._readableStreamController,zl)}_=!1,I?kr():N&&bt()})},_closeSteps:nn=>{_=!1;let sn=ge?$:j,uo=ge?j:$;sn||Wr(qe._readableStreamController),uo||Wr(It._readableStreamController),nn!==void 0&&(sn||Bn(qe._readableStreamController,nn),!uo&&It._readableStreamController._pendingPullIntos.length>0&&Nn(It._readableStreamController,0)),(!sn||!uo)&&Ie(void 0)},_errorSteps:()=>{_=!1}})}function kr(){if(_)return I=!0,R(void 0);_=!0;let ne=Ca(_e._readableStreamController);return ne===null?tn():Yr(ne._view,!1),R(void 0)}function bt(){if(_)return N=!0,R(void 0);_=!0;let ne=Ca(Pe._readableStreamController);return ne===null?tn():Yr(ne._view,!0),R(void 0)}function _t(ne){if(j=!0,te=ne,$){let ge=On([te,fe]),qe=rr(u,ge);Ie(qe)}return tt}function $t(ne){if($=!0,fe=ne,j){let ge=On([te,fe]),qe=rr(u,ge);Ie(qe)}return tt}function Lr(){}return _e=Ml(Lr,kr,_t),Pe=Ml(Lr,bt,$t),ir(f),[_e,Pe]}function $n(u,f){ut(u,f);let _=u,I=_?.autoAllocateChunkSize,N=_?.cancel,j=_?.pull,$=_?.start,te=_?.type;return{autoAllocateChunkSize:I===void 0?void 0:F1(I,`${f} has member 'autoAllocateChunkSize' that`),cancel:N===void 0?void 0:Fn(N,_,`${f} has member 'cancel' that`),pull:j===void 0?void 0:Wn(j,_,`${f} has member 'pull' that`),start:$===void 0?void 0:Hn($,_,`${f} has member 'start' that`),type:te===void 0?void 0:Qi(te,`${f} has member 'type' that`)}}function Fn(u,f,_){return er(u,_),I=>H(u,f,[I])}function Wn(u,f,_){return er(u,_),I=>H(u,f,[I])}function Hn(u,f,_){return er(u,_),I=>z(u,f,[I])}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){ut(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 Ac(u,f){ut(u,f);let _=u?.preventCancel;return{preventCancel:Boolean(_)}}function Sl(u,f){ut(u,f);let _=u?.preventAbort,I=u?.preventCancel,N=u?.preventClose,j=u?.signal;return j!==void 0&&Tc(j,`${f} has member 'signal' that`),{preventAbort:Boolean(_),preventCancel:Boolean(I),preventClose:Boolean(N),signal:j}}function Tc(u,f){if(!Qh(u))throw new TypeError(`${f} is not an AbortSignal.`)}function Pc(u,f){ut(u,f);let _=u?.readable;ya(_,"readable","ReadableWritablePair"),va(_,`${f} has member 'readable' that`);let I=u?.writable;return ya(I,"writable","ReadableWritablePair"),qs(I,`${f} has member 'writable' that`),{readable:_,writable:I}}class Vr{constructor(f={},_={}){f===void 0?f=null:dt(f,"First parameter");let I=js(_,"Second parameter"),N=$n(f,"First parameter");if($a(this),N.type==="bytes"){if(I.size!==void 0)throw new RangeError("The strategy for a byte stream cannot have a size function");let j=Ir(I,0);il(this,N,j)}else{let j=Hr(I),$=Ir(I,1);Ec(this,N,$,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")):rr(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 I=Pc(f,"First parameter"),N=Sl(_,"Second parameter");if(Jr(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(Vi(I.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");let j=xi(this,I.writable,N.preventClose,N.preventAbort,N.preventCancel,N.signal);return k(j),I.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 I;try{I=Sl(_,"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,I.preventClose,I.preventAbort,I.preventCancel,I.signal)}tee(){if(!Kr(this))throw Si("tee");let f=Rc(this);return On(f)}values(f=void 0){if(!Kr(this))throw Si("values");let _=Ac(f,"First parameter");return Wh(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 mr(u,f,_,I=1,N=()=>1){let j=Object.create(Vr.prototype);$a(j);let $=Object.create(Yi.prototype);return xl(j,$,u,f,_,I,N),j}function Ml(u,f,_){let I=Object.create(Vr.prototype);$a(I);let N=Object.create(Ze.prototype);return rl(I,N,u,f,_,0,void 0),I}function $a(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 rr(u,f){if(u._disturbed=!0,u._state==="closed")return R(void 0);if(u._state==="errored")return x(u._storedError);Gn(u);let _=u._reader;_!==void 0&&qt(_)&&(_._readIntoRequests.forEach(N=>{N._closeSteps(void 0)}),_._readIntoRequests=new se);let I=u._readableStreamController[ga](f);return P(I,r)}function Gn(u){u._state="closed";let f=u._reader;f!==void 0&&(In(f),lt(f)&&(f._readRequests.forEach(_=>{_._closeSteps()}),f._readRequests=new se))}function El(u,f){u._state="errored",u._storedError=f;let _=u._reader;_!==void 0&&(ma(_,f),lt(_)?(_._readRequests.forEach(I=>{I._errorSteps(f)}),_._readRequests=new se):(_._readIntoRequests.forEach(I=>{I._errorSteps(f)}),_._readIntoRequests=new se))}function Si(u){return new TypeError(`ReadableStream.prototype.${u} can only be used on a ReadableStream`)}function Rl(u,f){ut(u,f);let _=u?.highWaterMark;return ya(_,"highWaterMark","QueuingStrategyInit"),{highWaterMark:ba(_)}}let Cl=u=>u.byteLength;Object.defineProperty(Cl,"name",{value:"size",configurable:!0});class ro{constructor(f){Tr(f,1,"ByteLengthQueuingStrategy"),f=Rl(f,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=f.highWaterMark}get highWaterMark(){if(!Tl(this))throw Al("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!Tl(this))throw Al("size");return Cl}}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 Al(u){return new TypeError(`ByteLengthQueuingStrategy.prototype.${u} can only be used on a ByteLengthQueuingStrategy`)}function Tl(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_byteLengthQueuingStrategyHighWaterMark")?!1:u instanceof ro}let Pl=()=>1;Object.defineProperty(Pl,"name",{value:"size",configurable:!0});class io{constructor(f){Tr(f,1,"CountQueuingStrategy"),f=Rl(f,"First parameter"),this._countQueuingStrategyHighWaterMark=f.highWaterMark}get highWaterMark(){if(!Ol(this))throw Il("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!Ol(this))throw Il("size");return Pl}}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 Ol(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_countQueuingStrategyHighWaterMark")?!1:u instanceof io}function Zr(u,f){ut(u,f);let _=u?.flush,I=u?.readableType,N=u?.start,j=u?.transform,$=u?.writableType;return{flush:_===void 0?void 0:Ic(_,u,`${f} has member 'flush' that`),readableType:I,start:N===void 0?void 0:Oc(N,u,`${f} has member 'start' that`),transform:j===void 0?void 0:kc(j,u,`${f} has member 'transform' that`),writableType:$}}function Ic(u,f,_){return er(u,_),I=>H(u,f,[I])}function Oc(u,f,_){return er(u,_),I=>z(u,f,[I])}function kc(u,f,_){return er(u,_),(I,N)=>H(u,f,[I,N])}class no{constructor(f={},_={},I={}){f===void 0&&(f=null);let N=js(_,"Second parameter"),j=js(I,"Third parameter"),$=Zr(f,"First parameter");if($.readableType!==void 0)throw new RangeError("Invalid readableType specified");if($.writableType!==void 0)throw new RangeError("Invalid writableType specified");let te=Ir(j,0),fe=Hr(j),_e=Ir(N,1),Pe=Hr(N),Ie,tt=M(ir=>{Ie=ir});Lc(this,tt,_e,Pe,te,fe),Bc(this,$),$.start!==void 0?Ie($.start(this._transformStreamController)):Ie(void 0)}get readable(){if(!kl(this))throw Dl("readable");return this._readable}get writable(){if(!kl(this))throw Dl("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 Lc(u,f,_,I,N,j){function $(){return f}function te(tt){return Uc(u,tt)}function fe(tt){return jc(u,tt)}function _e(){return qc(u)}u._writable=ll($,te,_e,fe,_,I);function Pe(){return $c(u)}function Ie(tt){return oo(u,tt),R(void 0)}u._readable=mr($,Pe,Ie,N,j),u._backpressure=void 0,u._backpressureChangePromise=void 0,u._backpressureChangePromise_resolve=void 0,ao(u,!0),u._transformStreamController=void 0}function kl(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){Ll(u._transformStreamController),Ba(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 Vn{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!lo(this))throw Kn("desiredSize");let f=this._controlledTransformStream._readable._readableStreamController;return qa(f)}enqueue(f=void 0){if(!lo(this))throw Kn("enqueue");Nl(this,f)}error(f=void 0){if(!lo(this))throw Kn("error");Dc(this,f)}terminate(){if(!lo(this))throw Kn("terminate");zc(this)}}Object.defineProperties(Vn.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Vn.prototype,e.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});function lo(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_controlledTransformStream")?!1:u instanceof Vn}function Nc(u,f,_,I){f._controlledTransformStream=u,u._transformStreamController=f,f._transformAlgorithm=_,f._flushAlgorithm=I}function Bc(u,f){let _=Object.create(Vn.prototype),I=j=>{try{return Nl(_,j),R(void 0)}catch($){return x($)}},N=()=>R(void 0);f.transform!==void 0&&(I=j=>f.transform(j,_)),f.flush!==void 0&&(N=()=>f.flush(_)),Nc(u,_,I,N)}function Ll(u){u._transformAlgorithm=void 0,u._flushAlgorithm=void 0}function Nl(u,f){let _=u._controlledTransformStream,I=_._readable._readableStreamController;if(!Xi(I))throw new TypeError("Readable side is not in a state that permits enqueue");try{Qs(I,f)}catch(j){throw oo(_,j),_._readable._storedError}Mc(I)!==_._backpressure&&ao(_,!0)}function Dc(u,f){so(u._controlledTransformStream,f)}function Bl(u,f){let _=u._transformAlgorithm(f);return P(_,void 0,I=>{throw so(u._controlledTransformStream,I),I})}function zc(u){let f=u._controlledTransformStream,_=f._readable._readableStreamController;qn(_);let I=new TypeError("TransformStream terminated");oo(f,I)}function Uc(u,f){let _=u._transformStreamController;if(u._backpressure){let I=u._backpressureChangePromise;return P(I,()=>{let N=u._writable;if(N._state==="erroring")throw N._storedError;return Bl(_,f)})}return Bl(_,f)}function jc(u,f){return so(u,f),R(void 0)}function qc(u){let f=u._readable,_=u._transformStreamController,I=_._flushAlgorithm();return Ll(_),P(I,()=>{if(f._state==="errored")throw f._storedError;qn(f._readableStreamController)},N=>{throw so(u,N),f._storedError})}function $c(u){return ao(u,!1),u._backpressureChangePromise}function Kn(u){return new TypeError(`TransformStreamDefaultController.prototype.${u} can only be used on a TransformStreamDefaultController`)}function Dl(u){return new TypeError(`TransformStream.prototype.${u} can only be used on a TransformStream`)}t.ByteLengthQueuingStrategy=ro,t.CountQueuingStrategy=io,t.ReadableByteStreamController=Ze,t.ReadableStream=Vr,t.ReadableStreamBYOBReader=Wi,t.ReadableStreamBYOBRequest=kn,t.ReadableStreamDefaultController=Yi,t.ReadableStreamDefaultReader=Z,t.TransformStream=no,t.TransformStreamDefaultController=Vn,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*Zc(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 kE,w2,Ci,Xa,wo,Ql,_o,_2,yy,Ai,Qa=Va(()=>{kE=me(v2(),1);w2=65536;_2=(_o=class{constructor(e=[],r={}){vt(this,Ci,[]);vt(this,Xa,"");vt(this,wo,0);vt(this,Ql,"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 _o?a=o:a=i.encode(`${o}`),Xe(this,wo,Ee(this,wo)+(ArrayBuffer.isView(a)?a.byteLength:a.size)),Ee(this,Ci).push(a)}Xe(this,Ql,`${r.endings===void 0?"transparent":r.endings}`);let n=r.type===void 0?"":String(r.type);Xe(this,Xa,/^[\x20-\x7E]*$/.test(n)?n:"")}get size(){return Ee(this,wo)}get type(){return Ee(this,Xa)}async text(){let e=new TextDecoder,r="";for await(let i of Zc(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 Zc(Ee(this,Ci),!1))e.set(i,r),r+=i.length;return e.buffer}stream(){let e=Zc(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 _o([],{type:String(i).toLowerCase()});return Xe(M,wo,h),Xe(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,Xa=new WeakMap,wo=new WeakMap,Ql=new WeakMap,_o);Object.defineProperties(_2.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}});yy=_2,Ai=yy});var e1,t1,x2,by,vy,xo,Yc=Va(()=>{Qa();by=(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);vt(this,e1,0);vt(this,t1,"");n===null&&(n={});let o=n.lastModified===void 0?Date.now():Number(n.lastModified);Number.isNaN(o)||Xe(this,e1,o),Xe(this,t1,String(i))}get name(){return Ee(this,t1)}get lastModified(){return Ee(this,e1)}get[Symbol.toStringTag](){return"File"}static[Symbol.hasInstance](r){return!!r&&r instanceof Ai&&/^(File)$/.test(r[Symbol.toStringTag])}},e1=new WeakMap,t1=new WeakMap,x2),vy=by,xo=vy});function R2(t,e=Ai){var r=`${S2()}${S2()}`.replace(/\./g,"").slice(-28).padStart(32,"-"),i=[],n=`--${r}\r
|
|
2
|
-
|
|
3
|
-
\r
|
|
4
|
-
${o.replace(/\r(?!\n)|(?<!\r)\n/g,`\r
|
|
5
|
-
`)}\r
|
|
6
|
-
`):i.push(n+Xc(a)+`"; filename="${Xc(o.name,1)}"\r
|
|
7
|
-
Content-Type: ${o.type||"application/octet-stream"}\r
|
|
8
|
-
\r
|
|
9
|
-
`,o,`\r
|
|
10
|
-
`)),i.push(`--${r}--`),new e(i,{type:"multipart/form-data; boundary="+r})}var r1,wy,_y,S2,xy,M2,Xc,Qn,pr,E2,es,eu=Va(()=>{Qa();Yc();({toStringTag:r1,iterator:wy,hasInstance:_y}=Symbol),S2=Math.random,xy="append,set,get,getAll,delete,keys,values,entries,forEach,constructor".split(","),M2=(t,e,r)=>(t+="",/^(Blob|File)$/.test(e&&e[r1])?[(r=r!==void 0?r+"":e[r1]=="File"?e.name:"blob",t),e.name!==r||e[r1]=="blob"?new xo([e],r,e):e]:[t,e+""]),Xc=(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=(E2=class{constructor(...e){vt(this,pr,[]);if(e.length)throw new TypeError("Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.")}get[r1](){return"FormData"}[wy](){return this.entries()}static[_y](e){return e&&typeof e=="object"&&e[r1]==="FormData"&&!xy.some(r=>typeof e[r]!="function")}append(...e){Qn("append",arguments,2),Ee(this,pr).push(M2(...e))}delete(e){Qn("delete",arguments,1),e+="",Xe(this,pr,Ee(this,pr).filter(([r])=>r!==e))}get(e){Qn("get",arguments,1),e+="";for(var r=Ee(this,pr),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,pr).forEach(i=>i[0]===e&&r.push(i[1])),r}has(e){return Qn("has",arguments,1),e+="",Ee(this,pr).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=M2(...e),Ee(this,pr).forEach(n=>{n[0]===e[0]?i&&(i=!r.push(e)):r.push(n)}),i&&r.push(e),Xe(this,pr,r)}*entries(){yield*Ee(this,pr)}*keys(){for(var[e]of this)yield e}*values(){for(var[,e]of this)yield e}},pr=new WeakMap,E2)});var P2=V((GE,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 n1,O2,Sy,ts,rs,ef,I2,tf=Va(()=>{n1=require("fs"),O2=me(P2(),1);Yc();Qa();({stat:Sy}=n1.promises),ef=class{constructor(e){vt(this,ts,void 0);vt(this,rs,void 0);Xe(this,ts,e.path),Xe(this,rs,e.start),this.size=e.size,this.lastModified=e.lastModified}slice(e,r){return new ef({path:Ee(this,ts),lastModified:this.lastModified,size:r-e,start:Ee(this,rs)+e})}async*stream(){let{mtimeMs:e}=await Sy(Ee(this,ts));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,n1.createReadStream)(Ee(this,ts),{start:Ee(this,rs),end:Ee(this,rs)+this.size-1})}get[Symbol.toStringTag](){return"Blob"}},I2=ef;ts=new WeakMap,rs=new WeakMap});var L2={};Yd(L2,{toFormData:()=>Py});function Ty(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 Py(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 rf(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 xo(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=Ty(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,Ke,k2,un,ru,iu,My,s1,Ey,Ry,Cy,Ay,is,rf,N2=Va(()=>{tf();eu();ei=0,Ke={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},ru=10,iu=13,My=32,s1=45,Ey=58,Ry=97,Cy=122,Ay=t=>t|32,is=()=>{},rf=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=Ke.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"]},P=(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?(P(B,this[H],r,e),delete this[H]):(P(B,this[H],e.length,e),this[H]=0))};for(r=0;r<i;r++)switch(w=e[r],m){case Ke.START_BOUNDARY:if(d===a.length-2){if(w===s1)p|=un.LAST_BOUNDARY;else if(w!==iu)return;d++;break}else if(d-1===a.length-2){if(p&un.LAST_BOUNDARY&&w===s1)m=Ke.END,p=0;else if(!(p&un.LAST_BOUNDARY)&&w===ru)d=0,P("onPartBegin"),m=Ke.HEADER_FIELD_START;else return;break}w!==a[d+2]&&(d=-2),w===a[d+2]&&d++;break;case Ke.HEADER_FIELD_START:m=Ke.HEADER_FIELD,T("onHeaderField"),d=0;case Ke.HEADER_FIELD:if(w===iu){C("onHeaderField"),m=Ke.HEADERS_ALMOST_DONE;break}if(d++,w===s1)break;if(w===Ey){if(d===1)return;k("onHeaderField",!0),m=Ke.HEADER_VALUE_START;break}if(E=Ay(w),E<Ry||E>Cy)return;break;case Ke.HEADER_VALUE_START:if(w===My)break;T("onHeaderValue"),m=Ke.HEADER_VALUE;case Ke.HEADER_VALUE:w===iu&&(k("onHeaderValue",!0),P("onHeaderEnd"),m=Ke.HEADER_VALUE_ALMOST_DONE);break;case Ke.HEADER_VALUE_ALMOST_DONE:if(w!==ru)return;m=Ke.HEADER_FIELD_START;break;case Ke.HEADERS_ALMOST_DONE:if(w!==ru)return;P("onHeadersEnd"),m=Ke.PART_DATA_START;break;case Ke.PART_DATA_START:m=Ke.PART_DATA,T("onPartData");case Ke.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===iu?p|=un.PART_BOUNDARY:w===s1?p|=un.LAST_BOUNDARY:d=0;else if(d-1===a.length)if(p&un.PART_BOUNDARY){if(d=0,w===ru){p&=~un.PART_BOUNDARY,P("onPartEnd"),P("onPartBegin"),m=Ke.HEADER_FIELD_START;break}}else p&un.LAST_BOUNDARY&&w===s1?(P("onPartEnd"),m=Ke.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);P("onPartData",0,n,B),n=0,T("onPartData"),r--}break;case Ke.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===Ke.HEADER_FIELD_START&&this.index===0||this.state===Ke.PART_DATA&&this.index===this.boundary.length)this.onPartEnd();else if(this.state!==Ke.END)throw new Error("MultipartParser.end(): stream ended unexpectedly")}}});var c5=V((DC,h5)=>{"use strict";var hf=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
|
-
causes have become circular...`;let i=hf(t);return i?(e.add(t),r+`
|
|
14
|
-
caused by: `+l5(i,e)):r},U8=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=hf(t);if(n){e.add(t);let o=typeof t.cause=="function";return i+(o?"":": ")+u5(n,e,o)}else return i},j8=t=>u5(t,new Set);h5.exports={getErrorCause:hf,stackWithCauses:U8,messageWithCauses:j8}});var m5=V((zC,d5)=>{"use strict";d5.exports=df;var{messageWithCauses:q8,stackWithCauses:$8}=c5(),{toString:F8}=Object.prototype,cf=Symbol("circular-ref-tag"),ff=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[ff]},set:function(t){this[ff]=t}}});Object.defineProperty(f5,ff,{writable:!0,value:{}});function df(t){if(!(t instanceof Error))return t;t[cf]=void 0;let e=Object.create(f5);e.type=F8.call(t.constructor)==="[object Function]"?t.constructor.name:t.name,e.message=q8(t),e.stack=$8(t),global.AggregateError!==void 0&&t instanceof global.AggregateError&&Array.isArray(t.errors)&&(e.aggregateErrors=t.errors.map(r=>df(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,cf)&&(e[r]=df(i)):e[r]=i}return delete t[cf],e.raw=t,e}});var b5=V((UC,y5)=>{"use strict";y5.exports={mapHttpRequest:W8,reqSerializer:g5};var mf=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[mf]},set:function(t){this[mf]=t}}});Object.defineProperty(p5,mf,{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 W8(t){return{req:g5(t)}}});var x5=V((jC,_5)=>{"use strict";_5.exports={mapHttpResponse:H8,resSerializer:w5};var pf=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[pf]},set:function(t){this[pf]=t}}});Object.defineProperty(v5,pf,{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 H8(t){return{res:w5(t)}}});var yf=V((qC,S5)=>{"use strict";var gf=m5(),gu=b5(),yu=x5();S5.exports={err:gf,mapHttpRequest:gu.mapHttpRequest,mapHttpResponse:yu.mapHttpResponse,req:gu.reqSerializer,res:yu.resSerializer,wrapErrorSerializer:function(e){return e===gf?e:function(i){return e(gf(i))}},wrapRequestSerializer:function(e){return e===gu.reqSerializer?e:function(i){return e(gu.reqSerializer(i))}},wrapResponseSerializer:function(e){return e===yu.resSerializer?e:function(i){return e(yu.resSerializer(i))}}}});var bf=V(($C,M5)=>{"use strict";function G8(t,e){return e}M5.exports=function(){let e=Error.prepareStackTrace;Error.prepareStackTrace=G8;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((FC,E5)=>{"use strict";var{createContext:V8,runInContext:K8}=require("vm");E5.exports=J8;function J8(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();K8(`
|
|
1
|
+
"use strict";var my=Object.create;var e1=Object.defineProperty;var py=Object.getOwnPropertyDescriptor;var gy=Object.getOwnPropertyNames;var yy=Object.getPrototypeOf,by=Object.prototype.hasOwnProperty;var vy=(t,e,r)=>e in t?e1(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var t1=(t,e)=>()=>(t&&(e=t(t=0)),e);var V=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),h2=(t,e)=>{for(var r in e)e1(t,r,{get:e[r],enumerable:!0})},f2=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of gy(e))!by.call(t,n)&&n!==r&&e1(t,n,{get:()=>e[n],enumerable:!(i=py(e,n))||i.enumerable});return t};var me=(t,e,r)=>(r=t!=null?my(yy(t)):{},f2(e||!t||!t.__esModule?e1(r,"default",{value:t,enumerable:!0}):r,t)),wy=t=>f2(e1({},"__esModule",{value:!0}),t);var Qh=(t,e,r)=>(vy(t,typeof e!="symbol"?e+"":e,r),r),d2=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)};var Me=(t,e,r)=>(d2(t,e,"read from private field"),r?r.call(t):e.get(t)),_t=(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)},et=(t,e,r,i)=>(d2(t,e,"write to private field"),i?i.call(t,r):e.set(t,r),r),ef=(t,e,r,i)=>({set _(n){et(t,e,n,r)},get _(){return Me(t,e,i)}});var y2=V((TM,g2)=>{"use strict";var tf=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},m2=(t,e)=>{if(!(t instanceof Error))return"";let r=t.stack||"";if(e.has(t))return r+`
|
|
2
|
+
causes have become circular...`;let i=tf(t);return i?(e.add(t),r+`
|
|
3
|
+
caused by: `+m2(i,e)):r},_y=t=>m2(t,new Set),p2=(t,e,r)=>{if(!(t instanceof Error))return"";let i=r?"":t.message||"";if(e.has(t))return i+": ...";let n=tf(t);if(n){e.add(t);let o=typeof t.cause=="function";return i+(o?"":": ")+p2(n,e,o)}else return i},xy=t=>p2(t,new Set);g2.exports={getErrorCause:tf,stackWithCauses:_y,messageWithCauses:xy}});var w2=V((PM,v2)=>{"use strict";v2.exports=sf;var{messageWithCauses:Sy,stackWithCauses:My}=y2(),{toString:Ey}=Object.prototype,rf=Symbol("circular-ref-tag"),nf=Symbol("pino-raw-err-ref"),b2=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[nf]},set:function(t){this[nf]=t}}});Object.defineProperty(b2,nf,{writable:!0,value:{}});function sf(t){if(!(t instanceof Error))return t;t[rf]=void 0;let e=Object.create(b2);e.type=Ey.call(t.constructor)==="[object Function]"?t.constructor.name:t.name,e.message=Sy(t),e.stack=My(t),global.AggregateError!==void 0&&t instanceof global.AggregateError&&Array.isArray(t.errors)&&(e.aggregateErrors=t.errors.map(r=>sf(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,rf)&&(e[r]=sf(i)):e[r]=i}return delete t[rf],e.raw=t,e}});var M2=V((IM,S2)=>{"use strict";S2.exports={mapHttpRequest:Ry,reqSerializer:x2};var of=Symbol("pino-raw-req-ref"),_2=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[of]},set:function(t){this[of]=t}}});Object.defineProperty(_2,of,{writable:!0,value:{}});function x2(t){let e=t.info||t.socket,r=Object.create(_2);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 Ry(t){return{req:x2(t)}}});var A2=V((OM,C2)=>{"use strict";C2.exports={mapHttpResponse:Cy,resSerializer:R2};var af=Symbol("pino-raw-res-ref"),E2=Object.create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[af]},set:function(t){this[af]=t}}});Object.defineProperty(E2,af,{writable:!0,value:{}});function R2(t){let e=Object.create(E2);return e.statusCode=t.headersSent?t.statusCode:null,e.headers=t.getHeaders?t.getHeaders():t._headers,e.raw=t,e}function Cy(t){return{res:R2(t)}}});var uf=V((LM,T2)=>{"use strict";var lf=w2(),Yl=M2(),Xl=A2();T2.exports={err:lf,mapHttpRequest:Yl.mapHttpRequest,mapHttpResponse:Xl.mapHttpResponse,req:Yl.reqSerializer,res:Xl.resSerializer,wrapErrorSerializer:function(e){return e===lf?e:function(i){return e(lf(i))}},wrapRequestSerializer:function(e){return e===Yl.reqSerializer?e:function(i){return e(Yl.reqSerializer(i))}},wrapResponseSerializer:function(e){return e===Xl.resSerializer?e:function(i){return e(Xl.resSerializer(i))}}}});var cf=V((kM,P2)=>{"use strict";function Ay(t,e){return e}P2.exports=function(){let e=Error.prepareStackTrace;Error.prepareStackTrace=Ay;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 O2=V((NM,I2)=>{"use strict";var{createContext:Ty,runInContext:Py}=require("vm");I2.exports=Iy;function Iy(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()}}),c=(o[0]==="["?"":".")+o.replace(/^\*/,"\u3007").replace(/\.\*/g,".\u3007").replace(/\[\*\]/g,"[\u3007]");if(/\n|\r|;/.test(c)||/\/\*/.test(c))throw Error();Py(`
|
|
15
4
|
(function () {
|
|
16
5
|
'use strict'
|
|
17
|
-
o${
|
|
18
|
-
if ([o${
|
|
6
|
+
o${c}
|
|
7
|
+
if ([o${c}].length !== 1) throw Error()
|
|
19
8
|
})()
|
|
20
|
-
`,
|
|
9
|
+
`,Ty({o:a,"\u3007":null}),{codeGeneration:{strings:!1,wasm:!1}})}catch{throw Error(r(o))}})}}});var Ql=V((BM,L2)=>{"use strict";L2.exports=/[^.[\]]+|\[((?:.)*?)\]/g});var N2=V((DM,k2)=>{"use strict";var Oy=Ql();k2.exports=Ly;function Ly({paths:t}){let e=[];var r=0;let i=t.reduce(function(n,o,a){var c=o.match(Oy).map(m=>m.replace(/'|"|`/g,""));let d=o[0]==="[";c=c.map(m=>m[0]==="["?m.substr(1,m.length-2):m);let p=c.indexOf("*");if(p>-1){let m=c.slice(0,p),S=m.join("."),R=c.slice(p+1,c.length),x=R.length>0;r++,e.push({before:m,beforeStr:S,after:R,nested:x})}else n[o]={path:c,val:void 0,precensored:!1,circle:"",escPath:JSON.stringify(o),leadingBracket:d};return n},{});return{wildcards:e,wcLen:r,secret:i}}});var D2=V((zM,B2)=>{"use strict";var ky=Ql();B2.exports=Ny;function Ny({secret:t,serialize:e,wcLen:r,strict:i,isCensorFct:n,censorFctTakesPath:o},a){let c=Function("o",`
|
|
21
10
|
if (typeof o !== 'object' || o == null) {
|
|
22
|
-
${
|
|
11
|
+
${jy(i,e)}
|
|
23
12
|
}
|
|
24
13
|
const { censor, secret } = this
|
|
25
|
-
${
|
|
14
|
+
${By(t,n,o)}
|
|
26
15
|
this.compileRestore()
|
|
27
|
-
${
|
|
28
|
-
${
|
|
29
|
-
`).bind(a);return e===!1&&(
|
|
16
|
+
${Dy(r>0,n,o)}
|
|
17
|
+
${zy(e)}
|
|
18
|
+
`).bind(a);return e===!1&&(c.restore=d=>a.restore(d)),c}function By(t,e,r){return Object.keys(t).map(i=>{let{escPath:n,leadingBracket:o,path:a}=t[i],c=o?1:0,d=o?"":".",p=[];for(var m;(m=ky.exec(i))!==null;){let[,w]=m,{index:E,input:T}=m;E>c&&p.push(T.substring(0,E-(w?0:1)))}var S=p.map(w=>`o${d}${w}`).join(" && ");S.length===0?S+=`o${d}${i} != null`:S+=` && o${d}${i} != null`;let R=`
|
|
30
19
|
switch (true) {
|
|
31
|
-
${
|
|
20
|
+
${p.reverse().map(w=>`
|
|
32
21
|
case o${d}${w} === censor:
|
|
33
22
|
secret[${n}].circle = ${JSON.stringify(w)}
|
|
34
23
|
break
|
|
@@ -36,7 +25,7 @@ caused by: `+l5(i,e)):r},U8=t=>l5(t,new Set),u5=(t,e,r)=>{if(!(t instanceof Erro
|
|
|
36
25
|
`)}
|
|
37
26
|
}
|
|
38
27
|
`,x=r?`val, ${JSON.stringify(a)}`:"val";return`
|
|
39
|
-
if (${
|
|
28
|
+
if (${S}) {
|
|
40
29
|
const val = o${d}${i}
|
|
41
30
|
if (val === censor) {
|
|
42
31
|
secret[${n}].precensored = true
|
|
@@ -47,7 +36,7 @@ caused by: `+l5(i,e)):r},U8=t=>l5(t,new Set),u5=(t,e,r)=>{if(!(t instanceof Erro
|
|
|
47
36
|
}
|
|
48
37
|
}
|
|
49
38
|
`}).join(`
|
|
50
|
-
`)}function
|
|
39
|
+
`)}function Dy(t,e,r){return t===!0?`
|
|
51
40
|
{
|
|
52
41
|
const { wildcards, wcLen, groupRedact, nestedRedact } = this
|
|
53
42
|
for (var i = 0; i < wcLen; i++) {
|
|
@@ -58,16 +47,16 @@ caused by: `+l5(i,e)):r},U8=t=>l5(t,new Set),u5=(t,e,r)=>{if(!(t instanceof Erro
|
|
|
58
47
|
} else secret[beforeStr] = groupRedact(o, before, censor, ${e}, ${r})
|
|
59
48
|
}
|
|
60
49
|
}
|
|
61
|
-
`:""}function
|
|
50
|
+
`:""}function zy(t){return t===!1?"return o":`
|
|
62
51
|
var s = this.serialize(o)
|
|
63
52
|
this.restore(o)
|
|
64
53
|
return s
|
|
65
|
-
`}function
|
|
54
|
+
`}function jy(t,e){return t===!0?"throw Error('fast-redact: primitives cannot be redacted')":e===!1?"return o":"return this.serialize(o)"}});var hf=V((jM,j2)=>{"use strict";j2.exports={groupRedact:$y,groupRestore:Uy,nestedRedact:Hy,nestedRestore:Fy};function Uy({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 $y(t,e,r,i,n){let o=z2(t,e);if(o==null)return{keys:null,values:null,target:null,flat:!0};let a=Object.keys(o),c=a.length,d=e.length,p=n?[...e]:void 0,m=new Array(c);for(var S=0;S<c;S++){let R=a[S];m[S]=o[R],n?(p[d]=R,o[R]=r(o[R],p)):i?o[R]=r(o[R]):o[R]=r}return{keys:a,values:m,target:o,flat:!0}}function Fy(t){let e=t.length;for(var r=0;r<e;r++){let{key:n,target:o,value:a}=t[r];if(eu(o,n)&&(o[n]=a),typeof o=="object"){let c=Object.keys(o);for(var i=0;i<c.length;i++){let d=c[i],p=o[d];eu(p,n)&&(p[n]=a)}}}}function Hy(t,e,r,i,n,o,a){let c=z2(e,r);if(c==null)return;let d=Object.keys(c),p=d.length;for(var m=0;m<p;m++){let S=d[m],{value:R,parent:x,exists:w}=Wy(c,S,r,i,n,o,a);w===!0&&x!==null&&t.push({key:i[i.length-1],target:x,value:R})}return t}function eu(t,e){return t!=null?"hasOwn"in Object?Object.hasOwn(t,e):Object.prototype.hasOwnProperty.call(t,e):!1}function Wy(t,e,r,i,n,o,a){let c=i.length,d=c-1,p=e;var m=-1,S,R,x,w=null,E=!0,T=null;if(x=S=t[e],typeof S!="object")return{value:null,parent:null,exists:E};for(;S!=null&&++m<c;){if(e=i[m],w=x,e!=="*"&&!T&&!(typeof S=="object"&&e in S)){E=!1;break}if(!(e==="*"&&(T=e,m!==d))){if(T){let P=Object.keys(S);for(var C=0;C<P.length;C++){let L=P[C],B=S[L],z=e==="*";(z||typeof B=="object"&&B!==null&&e in B)&&(z?x=B:x=B[e],R=m!==d?x:o?a?n(x,[...r,p,...i]):n(x):n,z?S[L]=R:B[e]=R===void 0&&n!==void 0||eu(B,e)&&R===x?B[e]:R)}T=null}else x=S[e],R=m!==d?x:o?a?n(x,[...r,p,...i]):n(x):n,S[e]=eu(S,e)&&R===x||R===void 0&&n!==void 0?S[e]:R,S=S[e];if(typeof S!="object")break}}return{value:x,parent:w,exists:E}}function z2(t,e){for(var r=-1,i=e.length,n=t;n!=null&&++r<i;)n=n[e[r]];return n}});var $2=V((UM,U2)=>{"use strict";var{groupRestore:qy,nestedRestore:Gy}=hf();U2.exports=Vy;function Vy({secret:t,wcLen:e}){return function(){if(this.restore)return;let i=Object.keys(t),n=Ky(t,i),o=e>0,a=o?{secret:t,groupRestore:qy,nestedRestore:Gy}:{secret:t};this.restore=Function("o",Jy(n,i,o)).bind(a)}}function Ky(t,e){return e.map(r=>{let{circle:i,escPath:n,leadingBracket:o}=t[r],c=i?`o.${i} = secret[${n}].val`:`o${o?"":"."}${r} = secret[${n}].val`,d=`secret[${n}].val = undefined`;return`
|
|
66
55
|
if (secret[${n}].val !== undefined) {
|
|
67
|
-
try { ${
|
|
56
|
+
try { ${c} } catch (e) {}
|
|
68
57
|
${d}
|
|
69
58
|
}
|
|
70
|
-
`}).join("")}function
|
|
59
|
+
`}).join("")}function Jy(t,e,r){return`
|
|
71
60
|
const secret = this.secret
|
|
72
61
|
${r===!0?`
|
|
73
62
|
const keys = Object.keys(secret)
|
|
@@ -82,39 +71,50 @@ caused by: `+l5(i,e)):r},U8=t=>l5(t,new Set),u5=(t,e,r)=>{if(!(t instanceof Erro
|
|
|
82
71
|
`:""}
|
|
83
72
|
${t}
|
|
84
73
|
return o
|
|
85
|
-
`}});var D5=V((JC,B5)=>{"use strict";B5.exports=m3;function m3(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((ZC,U5)=>{"use strict";var z5=R5(),p3=T5(),g3=I5(),y3=N5(),{groupRedact:b3,nestedRedact:v3}=vf(),w3=D5(),_3=bu(),x3=z5(),wf=t=>t;wf.restore=wf;var S3="[REDACTED]";_f.rx=_3;_f.validator=z5;U5.exports=_f;function _f(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:S3,o=typeof n=="function",a=o&&n.length>1;if(e.length===0)return r||wf;x3({paths:e,serialize:r,censor:n});let{wildcards:h,wcLen:d,secret:m}=p3({paths:e,censor:n}),p=y3({secret:m,wcLen:d}),M="strict"in t?t.strict:!0;return g3({secret:m,wcLen:d,serialize:r,strict:M,isCensorFct:o,censorFctTakesPath:a},w3({secret:m,censor:n,compileRestore:p,serialize:r,groupRedact:b3,nestedRedact:v3,wildcards:h,wcLen:d}))}});var jo=V((YC,q5)=>{"use strict";var M3=Symbol("pino.setLevel"),E3=Symbol("pino.getLevel"),R3=Symbol("pino.levelVal"),C3=Symbol("pino.useLevelLabels"),A3=Symbol("pino.useOnlyCustomLevels"),T3=Symbol("pino.mixin"),P3=Symbol("pino.lsCache"),I3=Symbol("pino.chindings"),O3=Symbol("pino.asJson"),k3=Symbol("pino.write"),L3=Symbol("pino.redactFmt"),N3=Symbol("pino.time"),B3=Symbol("pino.timeSliceIndex"),D3=Symbol("pino.stream"),z3=Symbol("pino.stringify"),U3=Symbol("pino.stringifySafe"),j3=Symbol("pino.stringifiers"),q3=Symbol("pino.end"),$3=Symbol("pino.formatOpts"),F3=Symbol("pino.messageKey"),W3=Symbol("pino.nestedKey"),H3=Symbol("pino.nestedKeyStr"),G3=Symbol("pino.mixinMergeStrategy"),V3=Symbol("pino.wildcardFirst"),K3=Symbol.for("pino.serializers"),J3=Symbol.for("pino.formatters"),Z3=Symbol.for("pino.hooks"),Y3=Symbol.for("pino.metadata");q5.exports={setLevelSym:M3,getLevelSym:E3,levelValSym:R3,useLevelLabelsSym:C3,mixinSym:T3,lsCacheSym:P3,chindingsSym:I3,asJsonSym:O3,writeSym:k3,serializersSym:K3,redactFmtSym:L3,timeSym:N3,timeSliceIndexSym:B3,streamSym:D3,stringifySym:z3,stringifySafeSym:U3,stringifiersSym:j3,endSym:q3,formatOptsSym:$3,messageKeySym:F3,nestedKeySym:W3,wildcardFirstSym:V3,needsMetadataGsym:Y3,useOnlyCustomLevelsSym:A3,formattersSym:J3,hooksSym:Z3,nestedKeyStrSym:H3,mixinMergeStrategySym:G3}});var Mf=V((XC,H5)=>{"use strict";var Sf=j5(),{redactFmtSym:X3,wildcardFirstSym:wu}=jo(),{rx:xf,validator:Q3}=Sf,$5=Q3({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 e7(t,e){let{paths:r,censor:i}=t7(t),n=r.reduce((h,d)=>{xf.lastIndex=0;let m=xf.exec(d),p=xf.exec(d),M=m[1]!==void 0?m[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,"$1"):m[0];if(M==="*"&&(M=wu),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!==wu&&h[M].length===0&&h[M].push(...h[wu]||[]),M===wu&&Object.keys(h).forEach(function(w){h[w]&&h[w].push(x)}),h[M].push(x),h},{}),o={[X3]:Sf({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]=Sf({paths:n[d],censor:m,serialize:e,strict:W5})}return h},o)}function t7(t){if(Array.isArray(t))return t={paths:t,censor:F5},$5(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),$5({paths:e,censor:r}),{paths:e,censor:r}}H5.exports=e7});var V5=V((QC,G5)=>{"use strict";var r7=()=>"",i7=()=>`,"time":${Date.now()}`,n7=()=>`,"time":${Math.round(Date.now()/1e3)}`,s7=()=>`,"time":"${new Date(Date.now()).toISOString()}"`;G5.exports={nullTime:r7,epochTime:i7,unixTime:n7,isoTime:s7}});var J5=V((eA,K5)=>{"use strict";function o7(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}K5.exports=a7;function a7(t,e,r){var i=r&&r.stringify||o7,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 Rf=V((tA,Ef)=>{"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));Ef.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(););};Ef.exports=t}});var e9=V((rA,Q5)=>{"use strict";var Vt=require("fs"),l7=require("events"),u7=require("util").inherits,Z5=require("path"),Y5=Rf(),Cf=100,h7=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&&qo(e)}let i=e.append?"a":"w",n=e.mode;if(e.sync)try{e.mkdir&&Vt.mkdirSync(Z5.dirname(t),{recursive:!0});let o=Vt.openSync(t,i,n);r(null,o)}catch(o){throw r(o),o}else e.mkdir?Vt.mkdir(Z5.dirname(t),{recursive:!0},o=>{if(o)return r(o);Vt.open(t,i,n,r)}):Vt.open(t,i,n,r)}function Kt(t){if(!(this instanceof Kt))return new Kt(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||h7,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(Cf),this.release(void 0,0)}catch(E){this.release(E)}else setTimeout(()=>{Vt.write(this.fd,this._writingBuf,"utf8",this.release)},Cf);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){Vt.write(this.fd,this._writingBuf,"utf8",this.release);return}try{do{let E=Vt.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&&Vt.fsyncSync(this.fd);let w=this._len;this._reopening?(this._writing=!1,this._reopening=!1,this.reopen()):w>this.minLength?qo(this):this._ending?w>0?qo(this):(this._writing=!1,_u(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick(c7,this)):this.emit("drain"))},this.on("newListener",function(R){R==="drain"&&(this._asyncDrainScheduled=!1)})}function c7(t){t.listenerCount("drain")>0&&(t._asyncDrainScheduled=!1,t.emit("drain"))}u7(Kt,l7);Kt.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&&qo(this),this._len<this._hwm)};Kt.prototype.flush=function(){if(this.destroyed)throw new Error("SonicBoom destroyed");this._writing||this.minLength<=0||(this._bufs.length===0&&this._bufs.push(""),qo(this))};Kt.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&&Vt.close(e,r=>{if(r)return this.emit("error",r)})}),X5(t||this.file,this)};Kt.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?qo(this):_u(this)))};Kt.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-=Vt.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(Cf)}}};Kt.prototype.destroy=function(){this.destroyed||_u(this)};function qo(t){let e=t.release;if(t._writing=!0,t._writingBuf=t._writingBuf||t._bufs.shift()||"",t.sync)try{let r=Vt.writeSync(t.fd,t._writingBuf,"utf8");e(null,r)}catch(r){e(r)}else Vt.write(t.fd,t._writingBuf,"utf8",e)}function _u(t){if(t.fd===-1){t.once("ready",_u.bind(null,t));return}t.destroyed=!0,t._bufs=[],t.fd!==1&&t.fd!==2?Vt.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")}}Kt.SonicBoom=Kt;Kt.default=Kt;Q5.exports=Kt});var Af=V((iA,o9)=>{"use strict";var dn={exit:[],beforeExit:[]},t9={exit:d7,beforeExit:m7},r9=new FinalizationRegistry(p7);function f7(t){dn[t].length>0||process.on(t,t9[t])}function i9(t){dn[t].length>0||process.removeListener(t,t9[t])}function d7(){n9("exit")}function m7(){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 p7(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");f7(t);let i=new WeakRef(e);i.fn=r,r9.register(e,i),dn[t].push(i)}function g7(t,e){s9("exit",t,e)}function y7(t,e){s9("beforeExit",t,e)}function b7(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:g7,registerBeforeExit:y7,unregister:b7}});var l9=V((nA,a9)=>{"use strict";function v7(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 w7(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:v7,waitDiff:w7}});var h9=V((sA,u9)=>{"use strict";u9.exports={WRITE_INDEX:4,READ_INDEX:8}});var p9=V((aA,m9)=>{"use strict";var{EventEmitter:_7}=require("events"),{Worker:x7}=require("worker_threads"),{join:S7}=require("path"),{pathToFileURL:M7}=require("url"),{wait:E7}=l9(),{WRITE_INDEX:Jt,READ_INDEX:si}=h9(),R7=require("buffer"),C7=require("assert"),q=Symbol("kImpl"),A7=R7.constants.MAX_STRING_LENGTH,Su=class{constructor(e){this._value=e}deref(){return this._value}},T7=global.FinalizationRegistry||class{register(){}unregister(){}},P7=global.WeakRef||Su,c9=new T7(t=>{t.exited||t.terminate()});function I7(t,e){let{filename:r,workerData:i}=e,o=("__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{})["thread-stream-worker"]||S7(__dirname,"lib","worker.js"),a=new x7(o,{...e.workerOpts,workerData:{filename:r.indexOf("file://")===0?r:M7(r).href,dataBuf:t[q].dataBuf,stateBuf:t[q].stateBuf,workerData:i}});return a.stream=new Su(t),a.on("message",O7),a.on("exit",d9),c9.register(t,a),a}function f9(t){C7(!t[q].sync),t[q].needDrain&&(t[q].needDrain=!1,t.emit("drain"))}function xu(t){let e=Atomics.load(t[q].state,Jt),r=t[q].data.length-e;if(r>0){if(t[q].buf.length===0){t[q].flushing=!1,t[q].ending?kf(t):t[q].needDrain&&process.nextTick(f9,t);return}let i=t[q].buf.slice(0,r),n=Buffer.byteLength(i);n<=r?(t[q].buf=t[q].buf.slice(r),Mu(t,i,xu.bind(null,t))):t.flush(()=>{if(!t.destroyed){for(Atomics.store(t[q].state,si,0),Atomics.store(t[q].state,Jt,0);n>t[q].data.length;)r=r/2,i=t[q].buf.slice(0,r),n=Buffer.byteLength(i);t[q].buf=t[q].buf.slice(r),Mu(t,i,xu.bind(null,t))}})}else if(r===0){if(e===0&&t[q].buf.length===0)return;t.flush(()=>{Atomics.store(t[q].state,si,0),Atomics.store(t[q].state,Jt,0),xu(t)})}else oi(t,new Error("overwritten"))}function O7(t){let e=this.stream.deref();if(e===void 0){this.exited=!0,this.terminate();return}switch(t.code){case"READY":this.stream=new P7(e),e.flush(()=>{e[q].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 _7{constructor(e={}){if(super(),e.bufferSize<4)throw new Error("bufferSize must at least fit a 4-byte utf-8 char");this[q]={},this[q].stateBuf=new SharedArrayBuffer(128),this[q].state=new Int32Array(this[q].stateBuf),this[q].dataBuf=new SharedArrayBuffer(e.bufferSize||4*1024*1024),this[q].data=Buffer.from(this[q].dataBuf),this[q].sync=e.sync||!1,this[q].ending=!1,this[q].ended=!1,this[q].needDrain=!1,this[q].destroyed=!1,this[q].flushing=!1,this[q].ready=!1,this[q].finished=!1,this[q].errored=null,this[q].closed=!1,this[q].buf="",this.worker=I7(this,e)}write(e){if(this[q].destroyed)return If(this,new Error("the worker has exited")),!1;if(this[q].ending)return If(this,new Error("the worker is ending")),!1;if(this[q].flushing&&this[q].buf.length+e.length>=A7)try{Tf(this),this[q].flushing=!0}catch(r){return oi(this,r),!1}if(this[q].buf+=e,this[q].sync)try{return Tf(this),!0}catch(r){return oi(this,r),!1}return this[q].flushing||(this[q].flushing=!0,setImmediate(xu,this)),this[q].needDrain=this[q].data.length-this[q].buf.length-Atomics.load(this[q].state,Jt)<=0,!this[q].needDrain}end(){this[q].destroyed||(this[q].ending=!0,kf(this))}flush(e){if(this[q].destroyed){typeof e=="function"&&process.nextTick(e,new Error("the worker has exited"));return}let r=Atomics.load(this[q].state,Jt);E7(this[q].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[q].destroyed||(Tf(this),Of(this))}unref(){this.worker.unref()}ref(){this.worker.ref()}get ready(){return this[q].ready}get destroyed(){return this[q].destroyed}get closed(){return this[q].closed}get writable(){return!this[q].destroyed&&!this[q].ending}get writableEnded(){return this[q].ending}get writableFinished(){return this[q].finished}get writableNeedDrain(){return this[q].needDrain}get writableObjectMode(){return!1}get writableErrored(){return this[q].errored}};function If(t,e){setImmediate(()=>{t.emit("error",e)})}function oi(t,e){t[q].destroyed||(t[q].destroyed=!0,e&&(t[q].errored=e,If(t,e)),t.worker.exited?setImmediate(()=>{t[q].closed=!0,t.emit("close")}):t.worker.terminate().catch(()=>{}).then(()=>{t[q].closed=!0,t.emit("close")}))}function Mu(t,e,r){let i=Atomics.load(t[q].state,Jt),n=Buffer.byteLength(e);return t[q].data.write(e,i),Atomics.store(t[q].state,Jt,i+n),Atomics.notify(t[q].state,Jt),r(),!0}function kf(t){if(!(t[q].ended||!t[q].ending||t[q].flushing)){t[q].ended=!0;try{t.flushSync();let e=Atomics.load(t[q].state,si);Atomics.store(t[q].state,Jt,-1),Atomics.notify(t[q].state,Jt);let r=0;for(;e!==-1;){if(Atomics.wait(t[q].state,si,e,1e3),e=Atomics.load(t[q].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[q].finished=!0,t.emit("finish")})}catch(e){oi(t,e)}}}function Tf(t){let e=()=>{t[q].ending?kf(t):t[q].needDrain&&process.nextTick(f9,t)};for(t[q].flushing=!1;t[q].buf.length!==0;){let r=Atomics.load(t[q].state,Jt),i=t[q].data.length-r;if(i===0){Of(t),Atomics.store(t[q].state,si,0),Atomics.store(t[q].state,Jt,0);continue}else if(i<0)throw new Error("overwritten");let n=t[q].buf.slice(0,i),o=Buffer.byteLength(n);if(o<=i)t[q].buf=t[q].buf.slice(i),Mu(t,n,e);else{for(Of(t),Atomics.store(t[q].state,si,0),Atomics.store(t[q].state,Jt,0);o>t[q].buf.length;)i=i/2,n=t[q].buf.slice(0,i),o=Buffer.byteLength(n);t[q].buf=t[q].buf.slice(i),Mu(t,n,e)}}}function Of(t){if(t[q].flushing)throw new Error("unable to flush while flushing");let e=Atomics.load(t[q].state,Jt),r=0;for(;;){let i=Atomics.load(t[q].state,si);if(i===-2)throw Error("_flushSync failed");if(i!==e)Atomics.wait(t[q].state,si,i,1e3);else break;if(++r===10)throw new Error("_flushSync took too long (10s)")}}m9.exports=Pf});var Bf=V((lA,g9)=>{"use strict";var{createRequire:k7}=require("module"),L7=bf(),{join:Lf,isAbsolute:N7}=require("path"),B7=Rf(),Nf=Af(),D7=p9();function z7(t){Nf.register(t,j7),Nf.registerBeforeExit(t,q7),t.on("close",function(){Nf.unregister(t)})}function U7(t,e,r){let i=new D7({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&&z7(i)}function o(){i.closed||(i.flushSync(),B7(100),i.end())}return i}function j7(t){t.ref(),t.flushSync(),t.end(),t.once("close",function(){t.unref()})}function q7(t){t.flushSync()}function $7(t){let{pipeline:e,targets:r,levels:i,options:n={},worker:o={},caller:a=L7()}=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"]||Lf(__dirname,"worker.js"),n.targets=r.map(M=>({...M,target:p(M.target)}))):e&&(m=d["pino-pipeline-worker"]||Lf(__dirname,"worker-pipeline.js"),n.targets=e.map(M=>({...M,target:p(M.target)}))),i&&(n.levels=i),U7(p(m),n,o);function p(M){if(M=d[M]||M,N7(M)||M.indexOf("file://")===0)return M;if(M==="pino/file")return Lf(__dirname,"..","file.js");let R;for(let x of h)try{R=k7(x).resolve(M);break}catch{continue}if(!R)throw new Error(`unable to determine transport target for "${M}"`);return R}}g9.exports=$7});var Ru=V((uA,A9)=>{"use strict";var y9=J5(),{mapHttpRequest:F7,mapHttpResponse:W7}=yf(),Df=e9(),b9=Af(),{lsCacheSym:H7,chindingsSym:x9,writeSym:v9,serializersSym:S9,formatOptsSym:w9,endSym:G7,stringifiersSym:M9,stringifySym:E9,stringifySafeSym:zf,wildcardFirstSym:R9,nestedKeySym:V7,formattersSym:C9,messageKeySym:K7,nestedKeyStrSym:J7}=jo(),{isMainThread:Z7}=require("worker_threads"),Y7=Bf();function f1(){}function X7(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=F7(i):typeof i.setHeader=="function"&&(i=W7(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 Q7(t,e,r,i){let n=this[E9],o=this[zf],a=this[M9],h=this[G7],d=this[x9],m=this[S9],p=this[C9],M=this[K7],R=this[H7][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 P=a[C]||w;switch(typeof x){case"undefined":case"function":continue;case"number":Number.isFinite(x)===!1&&(x=null);case"boolean":P&&(x=P(x));break;case"string":x=(P||_9)(x);break;default:x=(P||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[V7]&&E?R+this[J7]+E.slice(1)+"}"+T+h:R+E+T+h}function eb(t,e){let r,i=t[x9],n=t[E9],o=t[zf],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 tb(t){return t.write!==t.constructor.prototype.write}function Eu(t){let e=new Df(t);return e.on("error",r),!t.sync&&Z7&&(b9.register(e,rb),e.on("close",function(){b9.unregister(e)})),e;function r(i){if(i.code==="EPIPE"){e.write=f1,e.end=f1,e.flushSync=f1,e.destroy=f1;return}e.removeListener("error",r),e.emit("error",i)}}function rb(t,e){t.destroyed||(e==="beforeExit"?(t.flush(),t.on("drain",function(){t.end()})):t.flushSync())}function ib(t){return function(r,i,n={},o){if(typeof n=="string")o=Eu({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=Eu({dest:o})}else if(n instanceof Df||n.writable||n._writableState)o=n,n={};else if(n.transport){if(n.transport instanceof Df||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=Y7({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||(tb(process.stdout)?o=process.stdout:o=Eu({fd:process.stdout.fd})),{opts:n,stream:o}}}function nb(t,e){try{return JSON.stringify(t)}catch{try{return(e||this[zf])(t)}catch{return'"[unable to serialize, circular reference is too complex to analyze]"'}}}function sb(t,e,r){return{level:t,bindings:e,log:r}}function ob(t){let e=Number(t);return typeof t=="string"&&Number.isFinite(e)?e:t}A9.exports={noop:f1,buildSafeSonicBoom:Eu,asChindings:eb,asJson:Q7,genLog:X7,createArgsNormalizer:ib,stringify:nb,buildFormatters:sb,normalizeDestFileDescriptor:ob}});var Cu=V((hA,P9)=>{"use strict";var{lsCacheSym:ab,levelValSym:Uf,useOnlyCustomLevelsSym:lb,streamSym:ub,formattersSym:hb,hooksSym:cb}=jo(),{noop:fb,genLog:ls}=Ru(),Dr={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},T9={fatal:t=>{let e=ls(Dr.fatal,t);return function(...r){let i=this[ub];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)},jf=Object.keys(Dr).reduce((t,e)=>(t[Dr[e]]=e,t),{}),db=Object.keys(jf).reduce((t,e)=>(t[e]='{"level":'+Number(e),t),{});function mb(t){let e=t[hb].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[ab]=i,t}function pb(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 gb(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[Uf],n=this[Uf]=r[t],o=this[lb],a=this[cb].logMethod;for(let h in r){if(n>r[h]){this[h]=fb;continue}this[h]=pb(h,o)?T9[h](a):ls(r[h],a)}this.emit("level-change",t,n,e[i],i)}function yb(t){let{levels:e,levelVal:r}=this;return e&&e.labels?e.labels[r]:""}function bb(t){let{values:e}=this.levels,r=e[t];return r!==void 0&&r>=this[Uf]}function vb(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:jf,r),n=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),e?null:Dr,t);return{labels:i,values:n}}function wb(t,e,r){if(typeof t=="number"){if(![].concat(Object.keys(e||{}).map(o=>e[o]),r?[]:Object.keys(jf).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 _b(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")}}P9.exports={initialLsCache:db,genLsCache:mb,levelMethods:T9,getLevel:yb,setLevel:gb,isLevelEnabled:bb,mappings:vb,levels:Dr,assertNoLevelCollisions:_b,assertDefaultLevelFound:wb}});var qf=V((cA,I9)=>{"use strict";I9.exports={version:"8.3.0"}});var q9=V((dA,j9)=>{"use strict";var{EventEmitter:xb}=require("events"),{lsCacheSym:Sb,levelValSym:Mb,setLevelSym:Ff,getLevelSym:O9,chindingsSym:Wf,parsedChindingsSym:Eb,mixinSym:Rb,asJsonSym:B9,writeSym:Cb,mixinMergeStrategySym:Ab,timeSym:Tb,timeSliceIndexSym:Pb,streamSym:D9,serializersSym:us,formattersSym:$f,useOnlyCustomLevelsSym:Ib,needsMetadataGsym:Ob,redactFmtSym:kb,stringifySym:Lb,formatOptsSym:Nb,stringifiersSym:Bb}=jo(),{getLevel:Db,setLevel:zb,isLevelEnabled:Ub,mappings:jb,initialLsCache:qb,genLsCache:$b,assertNoLevelCollisions:Fb}=Cu(),{asChindings:z9,asJson:Wb,buildFormatters:k9,stringify:L9}=Ru(),{version:Hb}=qf(),Gb=Mf(),Vb=class{},U9={constructor:Vb,child:Kb,bindings:Jb,setBindings:Zb,flush:ev,isLevelEnabled:Ub,version:Hb,get level(){return this[O9]()},set level(t){this[Ff](t)},get levelVal(){return this[Mb]},set levelVal(t){throw Error("levelVal is read-only")},[Sb]:qb,[Cb]:Xb,[B9]:Wb,[O9]:Db,[Ff]:zb};Object.setPrototypeOf(U9,xb.prototype);j9.exports=function(){return Object.create(U9)};var N9=t=>t;function Kb(t,e){if(!t)throw Error("missing bindings for child Pino");e=e||{};let r=this[us],i=this[$f],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[$f]=k9(d||i.level,m||N9,p||i.log)}else n[$f]=k9(i.level,N9,i.log);if(e.hasOwnProperty("customLevels")===!0&&(Fb(this.levels,e.customLevels),n.levels=jb(e.customLevels,n[Ib]),$b(n)),typeof e.redact=="object"&&e.redact!==null||Array.isArray(e.redact)){n.redact=e.redact;let d=Gb(n.redact,L9),m={stringify:d[kb]};n[Lb]=L9,n[Bb]=d,n[Nb]=m}n[Wf]=z9(n,t);let h=e.level||this.level;return n[Ff](h),n}function Jb(){let e=`{${this[Wf].substr(1)}}`,r=JSON.parse(e);return delete r.pid,delete r.hostname,r}function Zb(t){let e=z9(this,t);this[Wf]=e,delete this[Eb]}function Yb(t,e){return Object.assign(e,t)}function Xb(t,e,r){let i=this[Tb](),n=this[Rb],o=this[Ab]||Yb,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[Ob]===!0&&(d.lastLevel=r,d.lastObj=a,d.lastMsg=e,d.lastTime=i.slice(this[Pb]),d.lastLogger=this),d.write(h)}function Qb(){}function ev(){let t=this[D9];"flush"in t&&t.flush(Qb)}});var H9=V((Zf,W9)=>{"use strict";var cs=Jf();cs.configure=Jf;cs.stringify=cs;cs.default=cs;Zf.stringify=cs;Zf.configure=Jf;W9.exports=cs;var tv=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/,rv=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/g,Kf=["\\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 iv(t){if(t.length===2){let r=t.charCodeAt(1);return`${t[0]}\\u${r.toString(16)}`}let e=t.charCodeAt(0);return Kf.length>e?Kf[e]:`\\u${e.toString(16)}`}function mn(t){if(t.length<5e3&&!tv.test(t))return t;if(t.length>100)return t.replace(rv,iv);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)}${Kf[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 Hf(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 nv=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Uint8Array)),Symbol.toStringTag).get;function Gf(t){return nv.call(t)!==void 0&&t.length!==0}function Vf(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 sv(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 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 hs(t){return t===1?"1 item":`${t} items`}function ov(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 Jf(t){let e=sv(t),r=$9(t,"bigint"),i=$9(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 P="",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,P+=`
|
|
86
|
-
${T}`,
|
|
87
|
-
${T}`);let
|
|
88
|
-
${B}`),x.pop(),`[${P}]`}let z=Object.keys(C),
|
|
89
|
-
${T}`,
|
|
74
|
+
`}});var H2=V(($M,F2)=>{"use strict";F2.exports=Zy;function Zy(t){let{secret:e,censor:r,compileRestore:i,serialize:n,groupRedact:o,nestedRedact:a,wildcards:c,wcLen:d}=t,p=[{secret:e,censor:r,compileRestore:i}];return n!==!1&&p.push({serialize:n}),d>0&&p.push({groupRedact:o,nestedRedact:a,wildcards:c,wcLen:d}),Object.assign(...p)}});var G2=V((FM,q2)=>{"use strict";var W2=O2(),Yy=N2(),Xy=D2(),Qy=$2(),{groupRedact:e8,nestedRedact:t8}=hf(),r8=H2(),i8=Ql(),n8=W2(),ff=t=>t;ff.restore=ff;var s8="[REDACTED]";df.rx=i8;df.validator=W2;q2.exports=df;function df(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:s8,o=typeof n=="function",a=o&&n.length>1;if(e.length===0)return r||ff;n8({paths:e,serialize:r,censor:n});let{wildcards:c,wcLen:d,secret:p}=Yy({paths:e,censor:n}),m=Qy({secret:p,wcLen:d}),S="strict"in t?t.strict:!0;return Xy({secret:p,wcLen:d,serialize:r,strict:S,isCensorFct:o,censorFctTakesPath:a},r8({secret:p,censor:n,compileRestore:m,serialize:r,groupRedact:e8,nestedRedact:t8,wildcards:c,wcLen:d}))}});var vo=V((HM,V2)=>{"use strict";var o8=Symbol("pino.setLevel"),a8=Symbol("pino.getLevel"),l8=Symbol("pino.levelVal"),u8=Symbol("pino.useLevelLabels"),c8=Symbol("pino.useOnlyCustomLevels"),h8=Symbol("pino.mixin"),f8=Symbol("pino.lsCache"),d8=Symbol("pino.chindings"),m8=Symbol("pino.asJson"),p8=Symbol("pino.write"),g8=Symbol("pino.redactFmt"),y8=Symbol("pino.time"),b8=Symbol("pino.timeSliceIndex"),v8=Symbol("pino.stream"),w8=Symbol("pino.stringify"),_8=Symbol("pino.stringifySafe"),x8=Symbol("pino.stringifiers"),S8=Symbol("pino.end"),M8=Symbol("pino.formatOpts"),E8=Symbol("pino.messageKey"),R8=Symbol("pino.nestedKey"),C8=Symbol("pino.nestedKeyStr"),A8=Symbol("pino.mixinMergeStrategy"),T8=Symbol("pino.wildcardFirst"),P8=Symbol.for("pino.serializers"),I8=Symbol.for("pino.formatters"),O8=Symbol.for("pino.hooks"),L8=Symbol.for("pino.metadata");V2.exports={setLevelSym:o8,getLevelSym:a8,levelValSym:l8,useLevelLabelsSym:u8,mixinSym:h8,lsCacheSym:f8,chindingsSym:d8,asJsonSym:m8,writeSym:p8,serializersSym:P8,redactFmtSym:g8,timeSym:y8,timeSliceIndexSym:b8,streamSym:v8,stringifySym:w8,stringifySafeSym:_8,stringifiersSym:x8,endSym:S8,formatOptsSym:M8,messageKeySym:E8,nestedKeySym:R8,wildcardFirstSym:T8,needsMetadataGsym:L8,useOnlyCustomLevelsSym:c8,formattersSym:I8,hooksSym:O8,nestedKeyStrSym:C8,mixinMergeStrategySym:A8}});var gf=V((WM,Y2)=>{"use strict";var pf=G2(),{redactFmtSym:k8,wildcardFirstSym:tu}=vo(),{rx:mf,validator:N8}=pf,K2=N8({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})`}),J2="[Redacted]",Z2=!1;function B8(t,e){let{paths:r,censor:i}=D8(t),n=r.reduce((c,d)=>{mf.lastIndex=0;let p=mf.exec(d),m=mf.exec(d),S=p[1]!==void 0?p[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,"$1"):p[0];if(S==="*"&&(S=tu),m===null)return c[S]=null,c;if(c[S]===null)return c;let{index:R}=m,x=`${d.substr(R,d.length-1)}`;return c[S]=c[S]||[],S!==tu&&c[S].length===0&&c[S].push(...c[tu]||[]),S===tu&&Object.keys(c).forEach(function(w){c[w]&&c[w].push(x)}),c[S].push(x),c},{}),o={[k8]:pf({paths:r,censor:i,serialize:e,strict:Z2})},a=(...c)=>e(typeof i=="function"?i(...c):i);return[...Object.keys(n),...Object.getOwnPropertySymbols(n)].reduce((c,d)=>{if(n[d]===null)c[d]=p=>a(p,[d]);else{let p=typeof i=="function"?(m,S)=>i(m,[d,...S]):i;c[d]=pf({paths:n[d],censor:p,serialize:e,strict:Z2})}return c},o)}function D8(t){if(Array.isArray(t))return t={paths:t,censor:J2},K2(t),t;let{paths:e,censor:r=J2,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),K2({paths:e,censor:r}),{paths:e,censor:r}}Y2.exports=B8});var Q2=V((qM,X2)=>{"use strict";var z8=()=>"",j8=()=>`,"time":${Date.now()}`,U8=()=>`,"time":${Math.round(Date.now()/1e3)}`,$8=()=>`,"time":"${new Date(Date.now()).toISOString()}"`;X2.exports={nullTime:z8,epochTime:j8,unixTime:U8,isoTime:$8}});var t5=V((GM,e5)=>{"use strict";function F8(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}e5.exports=H8;function H8(t,e,r){var i=r&&r.stringify||F8,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 c=1;c<o;c++)a[c]=i(e[c]);return a.join(" ")}if(typeof t!="string")return t;var d=e.length;if(d===0)return t;for(var p="",m=1-n,S=-1,R=t&&t.length||0,x=0;x<R;){if(t.charCodeAt(x)===37&&x+1<R){switch(S=S>-1?S:0,t.charCodeAt(x+1)){case 100:case 102:if(m>=d||(S<x&&(p+=t.slice(S,x)),e[m]==null))break;p+=Number(e[m]),S=x=x+2;break;case 105:if(m>=d||(S<x&&(p+=t.slice(S,x)),e[m]==null))break;p+=Math.floor(Number(e[m])),S=x=x+2;break;case 79:case 111:case 106:if(m>=d||(S<x&&(p+=t.slice(S,x)),e[m]===void 0))break;var w=typeof e[m];if(w==="string"){p+="'"+e[m]+"'",S=x+2,x++;break}if(w==="function"){p+=e[m].name||"<anonymous>",S=x+2,x++;break}p+=i(e[m]),S=x+2,x++;break;case 115:if(m>=d)break;S<x&&(p+=t.slice(S,x)),p+=String(e[m]),S=x+2,x++;break;case 37:S<x&&(p+=t.slice(S,x)),p+="%",S=x+2,x++,m--;break}++m}++x}return S===-1?t:(S<R&&(p+=t.slice(S)),p)}});var bf=V((VM,yf)=>{"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));yf.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(););};yf.exports=t}});var o5=V((KM,s5)=>{"use strict";var Kt=require("fs"),W8=require("events"),q8=require("util").inherits,r5=require("path"),i5=bf(),vf=100,G8=16*1024;function n5(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&&wo(e)}let i=e.append?"a":"w",n=e.mode;if(e.sync)try{e.mkdir&&Kt.mkdirSync(r5.dirname(t),{recursive:!0});let o=Kt.openSync(t,i,n);r(null,o)}catch(o){throw r(o),o}else e.mkdir?Kt.mkdir(r5.dirname(t),{recursive:!0},o=>{if(o)return r(o);Kt.open(t,i,n,r)}):Kt.open(t,i,n,r)}function Jt(t){if(!(this instanceof Jt))return new Jt(t);let{fd:e,dest:r,minLength:i,maxLength:n,maxWrite:o,sync:a,append:c=!0,mode:d,mkdir:p,retryEAGAIN:m,fsync:S}=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||G8,this.sync=a||!1,this._fsync=S||!1,this.append=c||!1,this.mode=d,this.retryEAGAIN=m||(()=>!0),this.mkdir=p||!1,typeof e=="number")this.fd=e,process.nextTick(()=>this.emit("ready"));else if(typeof e=="string")n5(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{i5(vf),this.release(void 0,0)}catch(E){this.release(E)}else setTimeout(()=>{Kt.write(this.fd,this._writingBuf,"utf8",this.release)},vf);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){Kt.write(this.fd,this._writingBuf,"utf8",this.release);return}try{do{let E=Kt.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&&Kt.fsyncSync(this.fd);let w=this._len;this._reopening?(this._writing=!1,this._reopening=!1,this.reopen()):w>this.minLength?wo(this):this._ending?w>0?wo(this):(this._writing=!1,ru(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick(V8,this)):this.emit("drain"))},this.on("newListener",function(R){R==="drain"&&(this._asyncDrainScheduled=!1)})}function V8(t){t.listenerCount("drain")>0&&(t._asyncDrainScheduled=!1,t.emit("drain"))}q8(Jt,W8);Jt.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&&wo(this),this._len<this._hwm)};Jt.prototype.flush=function(){if(this.destroyed)throw new Error("SonicBoom destroyed");this._writing||this.minLength<=0||(this._bufs.length===0&&this._bufs.push(""),wo(this))};Jt.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&&Kt.close(e,r=>{if(r)return this.emit("error",r)})}),n5(t||this.file,this)};Jt.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?wo(this):ru(this)))};Jt.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-=Kt.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;i5(vf)}}};Jt.prototype.destroy=function(){this.destroyed||ru(this)};function wo(t){let e=t.release;if(t._writing=!0,t._writingBuf=t._writingBuf||t._bufs.shift()||"",t.sync)try{let r=Kt.writeSync(t.fd,t._writingBuf,"utf8");e(null,r)}catch(r){e(r)}else Kt.write(t.fd,t._writingBuf,"utf8",e)}function ru(t){if(t.fd===-1){t.once("ready",ru.bind(null,t));return}t.destroyed=!0,t._bufs=[],t.fd!==1&&t.fd!==2?Kt.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")}}Jt.SonicBoom=Jt;Jt.default=Jt;s5.exports=Jt});var wf=V((JM,f5)=>{"use strict";var cn={exit:[],beforeExit:[]},a5={exit:J8,beforeExit:Z8},l5=new FinalizationRegistry(Y8);function K8(t){cn[t].length>0||process.on(t,a5[t])}function u5(t){cn[t].length>0||process.removeListener(t,a5[t])}function J8(){c5("exit")}function Z8(){c5("beforeExit")}function c5(t){for(let e of cn[t]){let r=e.deref(),i=e.fn;r!==void 0&&i(r,t)}}function Y8(t){for(let e of["exit","beforeExit"]){let r=cn[e].indexOf(t);cn[e].splice(r,r+1),u5(e)}}function h5(t,e,r){if(e===void 0)throw new Error("the object can't be undefined");K8(t);let i=new WeakRef(e);i.fn=r,l5.register(e,i),cn[t].push(i)}function X8(t,e){h5("exit",t,e)}function Q8(t,e){h5("beforeExit",t,e)}function e3(t){l5.unregister(t);for(let e of["exit","beforeExit"])cn[e]=cn[e].filter(r=>{let i=r.deref();return i&&i!==t}),u5(e)}f5.exports={register:X8,registerBeforeExit:Q8,unregister:e3}});var m5=V((ZM,d5)=>{"use strict";function t3(t,e,r,i,n){let o=Date.now()+i,a=Atomics.load(t,e);if(a===r){n(null,"ok");return}let c=a,d=p=>{Date.now()>o?n(null,"timed-out"):setTimeout(()=>{c=a,a=Atomics.load(t,e),a===c?d(p>=1e3?1e3:p*2):a===r?n(null,"ok"):n(null,"not-equal")},p)};d(1)}function r3(t,e,r,i,n){let o=Date.now()+i,a=Atomics.load(t,e);if(a!==r){n(null,"ok");return}let c=d=>{Date.now()>o?n(null,"timed-out"):setTimeout(()=>{a=Atomics.load(t,e),a!==r?n(null,"ok"):c(d>=1e3?1e3:d*2)},d)};c(1)}d5.exports={wait:t3,waitDiff:r3}});var g5=V((YM,p5)=>{"use strict";p5.exports={WRITE_INDEX:4,READ_INDEX:8}});var _5=V((QM,w5)=>{"use strict";var{EventEmitter:i3}=require("events"),{Worker:n3}=require("worker_threads"),{join:s3}=require("path"),{pathToFileURL:o3}=require("url"),{wait:a3}=m5(),{WRITE_INDEX:Zt,READ_INDEX:ri}=g5(),l3=require("buffer"),u3=require("assert"),$=Symbol("kImpl"),c3=l3.constants.MAX_STRING_LENGTH,nu=class{constructor(e){this._value=e}deref(){return this._value}},h3=global.FinalizationRegistry||class{register(){}unregister(){}},f3=global.WeakRef||nu,y5=new h3(t=>{t.exited||t.terminate()});function d3(t,e){let{filename:r,workerData:i}=e,o=("__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{})["thread-stream-worker"]||s3(__dirname,"lib","worker.js"),a=new n3(o,{...e.workerOpts,workerData:{filename:r.indexOf("file://")===0?r:o3(r).href,dataBuf:t[$].dataBuf,stateBuf:t[$].stateBuf,workerData:i}});return a.stream=new nu(t),a.on("message",m3),a.on("exit",v5),y5.register(t,a),a}function b5(t){u3(!t[$].sync),t[$].needDrain&&(t[$].needDrain=!1,t.emit("drain"))}function iu(t){let e=Atomics.load(t[$].state,Zt),r=t[$].data.length-e;if(r>0){if(t[$].buf.length===0){t[$].flushing=!1,t[$].ending?Ef(t):t[$].needDrain&&process.nextTick(b5,t);return}let i=t[$].buf.slice(0,r),n=Buffer.byteLength(i);n<=r?(t[$].buf=t[$].buf.slice(r),su(t,i,iu.bind(null,t))):t.flush(()=>{if(!t.destroyed){for(Atomics.store(t[$].state,ri,0),Atomics.store(t[$].state,Zt,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,iu.bind(null,t))}})}else if(r===0){if(e===0&&t[$].buf.length===0)return;t.flush(()=>{Atomics.store(t[$].state,ri,0),Atomics.store(t[$].state,Zt,0),iu(t)})}else ii(t,new Error("overwritten"))}function m3(t){let e=this.stream.deref();if(e===void 0){this.exited=!0,this.terminate();return}switch(t.code){case"READY":this.stream=new f3(e),e.flush(()=>{e[$].ready=!0,e.emit("ready")});break;case"ERROR":ii(e,t.err);break;default:ii(e,new Error("this should not happen: "+t.code))}}function v5(t){let e=this.stream.deref();e!==void 0&&(y5.unregister(e),e.worker.exited=!0,e.worker.off("exit",v5),ii(e,t!==0?new Error("the worker thread exited"):null))}var xf=class extends i3{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=d3(this,e)}write(e){if(this[$].destroyed)return Sf(this,new Error("the worker has exited")),!1;if(this[$].ending)return Sf(this,new Error("the worker is ending")),!1;if(this[$].flushing&&this[$].buf.length+e.length>=c3)try{_f(this),this[$].flushing=!0}catch(r){return ii(this,r),!1}if(this[$].buf+=e,this[$].sync)try{return _f(this),!0}catch(r){return ii(this,r),!1}return this[$].flushing||(this[$].flushing=!0,setImmediate(iu,this)),this[$].needDrain=this[$].data.length-this[$].buf.length-Atomics.load(this[$].state,Zt)<=0,!this[$].needDrain}end(){this[$].destroyed||(this[$].ending=!0,Ef(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,Zt);a3(this[$].state,ri,r,1/0,(i,n)=>{if(i){ii(this,i),process.nextTick(e,i);return}if(n==="not-equal"){this.flush(e);return}process.nextTick(e)})}flushSync(){this[$].destroyed||(_f(this),Mf(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 Sf(t,e){setImmediate(()=>{t.emit("error",e)})}function ii(t,e){t[$].destroyed||(t[$].destroyed=!0,e&&(t[$].errored=e,Sf(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,Zt),n=Buffer.byteLength(e);return t[$].data.write(e,i),Atomics.store(t[$].state,Zt,i+n),Atomics.notify(t[$].state,Zt),r(),!0}function Ef(t){if(!(t[$].ended||!t[$].ending||t[$].flushing)){t[$].ended=!0;try{t.flushSync();let e=Atomics.load(t[$].state,ri);Atomics.store(t[$].state,Zt,-1),Atomics.notify(t[$].state,Zt);let r=0;for(;e!==-1;){if(Atomics.wait(t[$].state,ri,e,1e3),e=Atomics.load(t[$].state,ri),e===-2){ii(t,new Error("end() failed"));return}if(++r===10){ii(t,new Error("end() took too long (10s)"));return}}process.nextTick(()=>{t[$].finished=!0,t.emit("finish")})}catch(e){ii(t,e)}}}function _f(t){let e=()=>{t[$].ending?Ef(t):t[$].needDrain&&process.nextTick(b5,t)};for(t[$].flushing=!1;t[$].buf.length!==0;){let r=Atomics.load(t[$].state,Zt),i=t[$].data.length-r;if(i===0){Mf(t),Atomics.store(t[$].state,ri,0),Atomics.store(t[$].state,Zt,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(Mf(t),Atomics.store(t[$].state,ri,0),Atomics.store(t[$].state,Zt,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 Mf(t){if(t[$].flushing)throw new Error("unable to flush while flushing");let e=Atomics.load(t[$].state,Zt),r=0;for(;;){let i=Atomics.load(t[$].state,ri);if(i===-2)throw Error("_flushSync failed");if(i!==e)Atomics.wait(t[$].state,ri,i,1e3);else break;if(++r===10)throw new Error("_flushSync took too long (10s)")}}w5.exports=xf});var Af=V((eE,x5)=>{"use strict";var{createRequire:p3}=require("module"),g3=cf(),{join:Rf,isAbsolute:y3}=require("path"),b3=bf(),Cf=wf(),v3=_5();function w3(t){Cf.register(t,x3),Cf.registerBeforeExit(t,S3),t.on("close",function(){Cf.unregister(t)})}function _3(t,e,r){let i=new v3({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&&w3(i)}function o(){i.closed||(i.flushSync(),b3(100),i.end())}return i}function x3(t){t.ref(),t.flushSync(),t.end(),t.once("close",function(){t.unref()})}function S3(t){t.flushSync()}function M3(t){let{pipeline:e,targets:r,levels:i,options:n={},worker:o={},caller:a=g3()}=t,c=typeof a=="string"?[a]:a,d="__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{},p=t.target;if(p&&r)throw new Error("only one of target or targets can be specified");return r?(p=d["pino-worker"]||Rf(__dirname,"worker.js"),n.targets=r.map(S=>({...S,target:m(S.target)}))):e&&(p=d["pino-pipeline-worker"]||Rf(__dirname,"worker-pipeline.js"),n.targets=e.map(S=>({...S,target:m(S.target)}))),i&&(n.levels=i),_3(m(p),n,o);function m(S){if(S=d[S]||S,y3(S)||S.indexOf("file://")===0)return S;if(S==="pino/file")return Rf(__dirname,"..","file.js");let R;for(let x of c)try{R=p3(x).resolve(S);break}catch{continue}if(!R)throw new Error(`unable to determine transport target for "${S}"`);return R}}x5.exports=M3});var au=V((tE,k5)=>{"use strict";var S5=t5(),{mapHttpRequest:E3,mapHttpResponse:R3}=uf(),Tf=o5(),M5=wf(),{lsCacheSym:C3,chindingsSym:A5,writeSym:E5,serializersSym:T5,formatOptsSym:R5,endSym:A3,stringifiersSym:P5,stringifySym:I5,stringifySafeSym:Pf,wildcardFirstSym:O5,nestedKeySym:T3,formattersSym:L5,messageKeySym:P3,nestedKeyStrSym:I3}=vo(),{isMainThread:O3}=require("worker_threads"),L3=Af();function i1(){}function k3(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=E3(i):typeof i.setHeader=="function"&&(i=R3(i)));let a;o===null&&n.length===0?a=[null]:(o=n.shift(),a=n),this[E5](i,S5(o,a,this[R5]),t)}else this[E5](null,S5(i,n,this[R5]),t)}}function C5(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 N3(t,e,r,i){let n=this[I5],o=this[Pf],a=this[P5],c=this[A3],d=this[A5],p=this[T5],m=this[L5],S=this[P3],R=this[C3][r]+i;R=R+d;let x;m.log&&(t=m.log(t));let w=a[O5],E="";for(let C in t)if(x=t[C],Object.prototype.hasOwnProperty.call(t,C)&&x!==void 0){x=p[C]?p[C](x):x;let P=a[C]||w;switch(typeof x){case"undefined":case"function":continue;case"number":Number.isFinite(x)===!1&&(x=null);case"boolean":P&&(x=P(x));break;case"string":x=(P||C5)(x);break;default:x=(P||n)(x,o)}if(x===void 0)continue;E+=',"'+C+'":'+x}let T="";if(e!==void 0){x=p[S]?p[S](e):e;let C=a[S]||w;switch(typeof x){case"function":break;case"number":Number.isFinite(x)===!1&&(x=null);case"boolean":C&&(x=C(x)),T=',"'+S+'":'+x;break;case"string":x=(C||C5)(x),T=',"'+S+'":'+x;break;default:x=(C||n)(x,o),T=',"'+S+'":'+x}}return this[T3]&&E?R+this[I3]+E.slice(1)+"}"+T+c:R+E+T+c}function B3(t,e){let r,i=t[A5],n=t[I5],o=t[Pf],a=t[P5],c=a[O5],d=t[T5],p=t[L5].bindings;e=p(e);for(let m in e)if(r=e[m],(m!=="level"&&m!=="serializers"&&m!=="formatters"&&m!=="customLevels"&&e.hasOwnProperty(m)&&r!==void 0)===!0){if(r=d[m]?d[m](r):r,r=(a[m]||c||n)(r,o),r===void 0)continue;i+=',"'+m+'":'+r}return i}function D3(t){return t.write!==t.constructor.prototype.write}function ou(t){let e=new Tf(t);return e.on("error",r),!t.sync&&O3&&(M5.register(e,z3),e.on("close",function(){M5.unregister(e)})),e;function r(i){if(i.code==="EPIPE"){e.write=i1,e.end=i1,e.flushSync=i1,e.destroy=i1;return}e.removeListener("error",r),e.emit("error",i)}}function z3(t,e){t.destroyed||(e==="beforeExit"?(t.flush(),t.on("drain",function(){t.end()})):t.flushSync())}function j3(t){return function(r,i,n={},o){if(typeof n=="string")o=ou({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=ou({dest:o})}else if(n instanceof Tf||n.writable||n._writableState)o=n,n={};else if(n.transport){if(n.transport instanceof Tf||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 c;n.customLevels&&(c=n.useOnlyCustomLevels?n.customLevels:Object.assign({},n.levels,n.customLevels)),o=L3({caller:i,...n.transport,levels:c})}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||(D3(process.stdout)?o=process.stdout:o=ou({fd:process.stdout.fd})),{opts:n,stream:o}}}function U3(t,e){try{return JSON.stringify(t)}catch{try{return(e||this[Pf])(t)}catch{return'"[unable to serialize, circular reference is too complex to analyze]"'}}}function $3(t,e,r){return{level:t,bindings:e,log:r}}function F3(t){let e=Number(t);return typeof t=="string"&&Number.isFinite(e)?e:t}k5.exports={noop:i1,buildSafeSonicBoom:ou,asChindings:B3,asJson:N3,genLog:k3,createArgsNormalizer:j3,stringify:U3,buildFormatters:$3,normalizeDestFileDescriptor:F3}});var lu=V((rE,B5)=>{"use strict";var{lsCacheSym:H3,levelValSym:If,useOnlyCustomLevelsSym:W3,streamSym:q3,formattersSym:G3,hooksSym:V3}=vo(),{noop:K3,genLog:rs}=au(),zr={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},N5={fatal:t=>{let e=rs(zr.fatal,t);return function(...r){let i=this[q3];if(e.call(this,...r),typeof i.flushSync=="function")try{i.flushSync()}catch{}}},error:t=>rs(zr.error,t),warn:t=>rs(zr.warn,t),info:t=>rs(zr.info,t),debug:t=>rs(zr.debug,t),trace:t=>rs(zr.trace,t)},Of=Object.keys(zr).reduce((t,e)=>(t[zr[e]]=e,t),{}),J3=Object.keys(Of).reduce((t,e)=>(t[e]='{"level":'+Number(e),t),{});function Z3(t){let e=t[G3].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[H3]=i,t}function Y3(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 X3(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[If],n=this[If]=r[t],o=this[W3],a=this[V3].logMethod;for(let c in r){if(n>r[c]){this[c]=K3;continue}this[c]=Y3(c,o)?N5[c](a):rs(r[c],a)}this.emit("level-change",t,n,e[i],i)}function Q3(t){let{levels:e,levelVal:r}=this;return e&&e.labels?e.labels[r]:""}function e7(t){let{values:e}=this.levels,r=e[t];return r!==void 0&&r>=this[If]}function t7(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:Of,r),n=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),e?null:zr,t);return{labels:i,values:n}}function r7(t,e,r){if(typeof t=="number"){if(![].concat(Object.keys(e||{}).map(o=>e[o]),r?[]:Object.keys(Of).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:zr,e);if(!(t in i))throw Error(`default level:${t} must be included in custom levels`)}function i7(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")}}B5.exports={initialLsCache:J3,genLsCache:Z3,levelMethods:N5,getLevel:Q3,setLevel:X3,isLevelEnabled:e7,mappings:t7,levels:zr,assertNoLevelCollisions:i7,assertDefaultLevelFound:r7}});var Lf=V((iE,D5)=>{"use strict";D5.exports={version:"8.3.0"}});var V5=V((sE,G5)=>{"use strict";var{EventEmitter:n7}=require("events"),{lsCacheSym:s7,levelValSym:o7,setLevelSym:Nf,getLevelSym:z5,chindingsSym:Bf,parsedChindingsSym:a7,mixinSym:l7,asJsonSym:F5,writeSym:u7,mixinMergeStrategySym:c7,timeSym:h7,timeSliceIndexSym:f7,streamSym:H5,serializersSym:is,formattersSym:kf,useOnlyCustomLevelsSym:d7,needsMetadataGsym:m7,redactFmtSym:p7,stringifySym:g7,formatOptsSym:y7,stringifiersSym:b7}=vo(),{getLevel:v7,setLevel:w7,isLevelEnabled:_7,mappings:x7,initialLsCache:S7,genLsCache:M7,assertNoLevelCollisions:E7}=lu(),{asChindings:W5,asJson:R7,buildFormatters:j5,stringify:U5}=au(),{version:C7}=Lf(),A7=gf(),T7=class{},q5={constructor:T7,child:P7,bindings:I7,setBindings:O7,flush:B7,isLevelEnabled:_7,version:C7,get level(){return this[z5]()},set level(t){this[Nf](t)},get levelVal(){return this[o7]},set levelVal(t){throw Error("levelVal is read-only")},[s7]:S7,[u7]:k7,[F5]:R7,[z5]:v7,[Nf]:w7};Object.setPrototypeOf(q5,n7.prototype);G5.exports=function(){return Object.create(q5)};var $5=t=>t;function P7(t,e){if(!t)throw Error("missing bindings for child Pino");e=e||{};let r=this[is],i=this[kf],n=Object.create(this);if(e.hasOwnProperty("serializers")===!0){n[is]=Object.create(null);for(let m in r)n[is][m]=r[m];let d=Object.getOwnPropertySymbols(r);for(var o=0;o<d.length;o++){let m=d[o];n[is][m]=r[m]}for(let m in e.serializers)n[is][m]=e.serializers[m];let p=Object.getOwnPropertySymbols(e.serializers);for(var a=0;a<p.length;a++){let m=p[a];n[is][m]=e.serializers[m]}}else n[is]=r;if(e.hasOwnProperty("formatters")){let{level:d,bindings:p,log:m}=e.formatters;n[kf]=j5(d||i.level,p||$5,m||i.log)}else n[kf]=j5(i.level,$5,i.log);if(e.hasOwnProperty("customLevels")===!0&&(E7(this.levels,e.customLevels),n.levels=x7(e.customLevels,n[d7]),M7(n)),typeof e.redact=="object"&&e.redact!==null||Array.isArray(e.redact)){n.redact=e.redact;let d=A7(n.redact,U5),p={stringify:d[p7]};n[g7]=U5,n[b7]=d,n[y7]=p}n[Bf]=W5(n,t);let c=e.level||this.level;return n[Nf](c),n}function I7(){let e=`{${this[Bf].substr(1)}}`,r=JSON.parse(e);return delete r.pid,delete r.hostname,r}function O7(t){let e=W5(this,t);this[Bf]=e,delete this[a7]}function L7(t,e){return Object.assign(e,t)}function k7(t,e,r){let i=this[h7](),n=this[l7],o=this[c7]||L7,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 c=this[F5](a,e,r,i),d=this[H5];d[m7]===!0&&(d.lastLevel=r,d.lastObj=a,d.lastMsg=e,d.lastTime=i.slice(this[f7]),d.lastLogger=this),d.write(c)}function N7(){}function B7(){let t=this[H5];"flush"in t&&t.flush(N7)}});var Y5=V((Ff,Z5)=>{"use strict";var ss=$f();ss.configure=$f;ss.stringify=ss;ss.default=ss;Ff.stringify=ss;Ff.configure=$f;Z5.exports=ss;var D7=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/,z7=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/g,Uf=["\\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 j7(t){if(t.length===2){let r=t.charCodeAt(1);return`${t[0]}\\u${r.toString(16)}`}let e=t.charCodeAt(0);return Uf.length>e?Uf[e]:`\\u${e.toString(16)}`}function hn(t){if(t.length<5e3&&!D7.test(t))return t;if(t.length>100)return t.replace(z7,j7);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)}${Uf[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 Df(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 U7=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Uint8Array)),Symbol.toStringTag).get;function zf(t){return U7.call(t)!==void 0&&t.length!==0}function jf(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 $7(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 K5(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 J5(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 ns(t){return t===1?"1 item":`${t} items`}function F7(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 $f(t){let e=$7(t),r=K5(t,"bigint"),i=K5(t,"deterministic"),n=J5(t,"maximumDepth"),o=J5(t,"maximumBreadth");function a(S,R,x,w,E,T){let C=R[S];switch(typeof C=="object"&&C!==null&&typeof C.toJSON=="function"&&(C=C.toJSON(S)),C=w.call(R,S,C),typeof C){case"string":return`"${hn(C)}"`;case"object":{if(C===null)return"null";if(x.indexOf(C)!==-1)return e;let P="",L=",",B=T;if(Array.isArray(C)){if(C.length===0)return"[]";if(n<x.length+1)return'"[Array]"';x.push(C),E!==""&&(T+=E,P+=`
|
|
75
|
+
${T}`,L=`,
|
|
76
|
+
${T}`);let qe=Math.min(C.length,o),Ae=0;for(;Ae<qe-1;Ae++){let ut=a(Ae,C,x,w,E,T);P+=ut!==void 0?ut:"null",P+=L}let $e=a(Ae,C,x,w,E,T);if(P+=$e!==void 0?$e:"null",C.length-1>o){let ut=C.length-o-1;P+=`${L}"... ${ns(ut)} not stringified"`}return E!==""&&(P+=`
|
|
77
|
+
${B}`),x.pop(),`[${P}]`}let z=Object.keys(C),q=z.length;if(q===0)return"{}";if(n<x.length+1)return'"[Object]"';let Z="",se="";E!==""&&(T+=E,L=`,
|
|
78
|
+
${T}`,Z=" ");let Se=Math.min(q,o);zf(C)&&(P+=jf(C,L,o),z=z.slice(C.length),Se-=C.length,se=L),i&&(z=Df(z)),x.push(C);for(let qe=0;qe<Se;qe++){let Ae=z[qe],$e=a(Ae,C,x,w,E,T);$e!==void 0&&(P+=`${se}"${hn(Ae)}":${Z}${$e}`,se=L)}if(q>o){let qe=q-o;P+=`${se}"...":${Z}"${ns(qe)} not stringified"`,se=L}return E!==""&&se.length>1&&(P=`
|
|
90
79
|
${T}${P}
|
|
91
|
-
${B}`),x.pop(),`{${P}}`}case"number":return isFinite(C)?String(C):"null";case"boolean":return C===!0?"true":"false";case"bigint":return r?String(C):void 0}}function
|
|
92
|
-
${T}`,
|
|
93
|
-
${T}`);let
|
|
94
|
-
${C}`),x.pop(),`[${P}]`}if(w.size===0)return"{}";x.push(R);let B="";E!==""&&(T+=E,
|
|
95
|
-
${T}`,B=" ");let z="";for(let
|
|
80
|
+
${B}`),x.pop(),`{${P}}`}case"number":return isFinite(C)?String(C):"null";case"boolean":return C===!0?"true":"false";case"bigint":return r?String(C):void 0}}function c(S,R,x,w,E,T){switch(typeof R=="object"&&R!==null&&typeof R.toJSON=="function"&&(R=R.toJSON(S)),typeof R){case"string":return`"${hn(R)}"`;case"object":{if(R===null)return"null";if(x.indexOf(R)!==-1)return e;let C=T,P="",L=",";if(Array.isArray(R)){if(R.length===0)return"[]";if(n<x.length+1)return'"[Array]"';x.push(R),E!==""&&(T+=E,P+=`
|
|
81
|
+
${T}`,L=`,
|
|
82
|
+
${T}`);let q=Math.min(R.length,o),Z=0;for(;Z<q-1;Z++){let Se=c(Z,R[Z],x,w,E,T);P+=Se!==void 0?Se:"null",P+=L}let se=c(Z,R[Z],x,w,E,T);if(P+=se!==void 0?se:"null",R.length-1>o){let Se=R.length-o-1;P+=`${L}"... ${ns(Se)} not stringified"`}return E!==""&&(P+=`
|
|
83
|
+
${C}`),x.pop(),`[${P}]`}if(w.size===0)return"{}";x.push(R);let B="";E!==""&&(T+=E,L=`,
|
|
84
|
+
${T}`,B=" ");let z="";for(let q of w){let Z=c(q,R[q],x,w,E,T);Z!==void 0&&(P+=`${z}"${hn(q)}":${B}${Z}`,z=L)}return E!==""&&z.length>1&&(P=`
|
|
96
85
|
${T}${P}
|
|
97
|
-
${C}`),x.pop(),`{${P}}`}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(
|
|
86
|
+
${C}`),x.pop(),`{${P}}`}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(S,R,x,w,E){switch(typeof R){case"string":return`"${hn(R)}"`;case"object":{if(R===null)return"null";if(typeof R.toJSON=="function"){if(R=R.toJSON(S),typeof R!="object")return d(S,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 Z=`
|
|
98
87
|
${E}`,se=`,
|
|
99
|
-
${E}`,
|
|
100
|
-
${T}`,x.pop(),`[${
|
|
101
|
-
${E}`,B="",z="",
|
|
88
|
+
${E}`,Se=Math.min(R.length,o),qe=0;for(;qe<Se-1;qe++){let $e=d(qe,R[qe],x,w,E);Z+=$e!==void 0?$e:"null",Z+=se}let Ae=d(qe,R[qe],x,w,E);if(Z+=Ae!==void 0?Ae:"null",R.length-1>o){let $e=R.length-o-1;Z+=`${se}"... ${ns($e)} not stringified"`}return Z+=`
|
|
89
|
+
${T}`,x.pop(),`[${Z}]`}let C=Object.keys(R),P=C.length;if(P===0)return"{}";if(n<x.length+1)return'"[Object]"';E+=w;let L=`,
|
|
90
|
+
${E}`,B="",z="",q=Math.min(P,o);zf(R)&&(B+=jf(R,L,o),C=C.slice(R.length),q-=R.length,z=L),i&&(C=Df(C)),x.push(R);for(let Z=0;Z<q;Z++){let se=C[Z],Se=d(se,R[se],x,w,E);Se!==void 0&&(B+=`${z}"${hn(se)}": ${Se}`,z=L)}if(P>o){let Z=P-o;B+=`${z}"...": "${ns(Z)} not stringified"`,z=L}return z!==""&&(B=`
|
|
102
91
|
${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
|
|
92
|
+
${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 p(S,R,x){switch(typeof R){case"string":return`"${hn(R)}"`;case"object":{if(R===null)return"null";if(typeof R.toJSON=="function"){if(R=R.toJSON(S),typeof R!="object")return p(S,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 L=Math.min(R.length,o),B=0;for(;B<L-1;B++){let q=p(B,R[B],x);w+=q!==void 0?q:"null",w+=","}let z=p(B,R[B],x);if(w+=z!==void 0?z:"null",R.length-1>o){let q=R.length-o-1;w+=`,"... ${ns(q)} 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="",P=Math.min(T,o);zf(R)&&(w+=jf(R,",",o),E=E.slice(R.length),P-=R.length,C=","),i&&(E=Df(E)),x.push(R);for(let L=0;L<P;L++){let B=E[L],z=p(B,R[B],x);z!==void 0&&(w+=`${C}"${hn(B)}":${z}`,C=",")}if(T>o){let L=T-o;w+=`${C}"...":"${ns(L)} 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 m(S,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("",{"":S},[],R,w,"");if(Array.isArray(R))return c("",S,[],F7(R),w,"")}if(w.length!==0)return d("",S,[],w,"")}return p("",S,[])}return m}});var t9=V((oE,e9)=>{"use strict";var Hf=Symbol.for("pino.metadata"),{levels:X5}=lu(),Q5=Object.create(X5);Q5.silent=1/0;var H7=X5.info;function W7(t,e){let r=0;t=t||[],e=e||{dedupe:!1};let i=Q5;e.levels&&typeof e.levels=="object"&&(i=e.levels);let n={write:o,add:c,flushSync:a,end:d,minLevel:0,streams:[],clone:p,[Hf]:!0};return Array.isArray(t)?t.forEach(c,n):c.call(n,t),t=null,n;function o(m){let S,R=this.lastLevel,{streams:x}=this,w;for(let E=0;E<x.length&&(S=x[E],S.level<=R);E++){if(w=S.stream,w[Hf]){let{lastTime:T,lastMsg:C,lastObj:P,lastLogger:L}=this;w.lastLevel=R,w.lastTime=T,w.lastMsg=C,w.lastObj=P,w.lastLogger=L}(!e.dedupe||S.level===R)&&w.write(m)}}function a(){for(let{stream:m}of this.streams)typeof m.flushSync=="function"&&m.flushSync()}function c(m){if(!m)return n;let S=typeof m.write=="function"||m.stream,R=m.write?m:m.stream;if(!S)throw Error("stream object needs to implement either StreamEntry or DestinationStream interface");let{streams:x}=this,w;typeof m.levelVal=="number"?w=m.levelVal:typeof m.level=="string"?w=i[m.level]:typeof m.level=="number"?w=m.level:w=H7;let E={stream:R,level:w,levelVal:void 0,id:r++};return x.unshift(E),x.sort(q7),this.minLevel=x[0].level,n}function d(){for(let{stream:m}of this.streams)typeof m.flushSync=="function"&&m.flushSync(),m.end()}function p(m){let S=new Array(this.streams.length);for(let R=0;R<S.length;R++)S[R]={level:m,stream:this.streams[R].stream};return{write:o,add:c,minLevel:m,streams:S,clone:p,flushSync:a,[Hf]:!0}}}function q7(t,e){return t.level-e.level}e9.exports=W7});var Gf=V((aE,gr)=>{"use strict";var G7=require("os"),u9=uf(),V7=cf(),K7=gf(),c9=Q2(),J7=V5(),h9=vo(),{configure:Z7}=Y5(),{assertDefaultLevelFound:Y7,mappings:f9,genLsCache:X7,levels:Q7}=lu(),{createArgsNormalizer:eb,asChindings:tb,buildSafeSonicBoom:r9,buildFormatters:rb,stringify:uu,normalizeDestFileDescriptor:i9,noop:ib}=au(),{version:nb}=Lf(),{chindingsSym:n9,redactFmtSym:sb,serializersSym:s9,timeSym:ob,timeSliceIndexSym:ab,streamSym:lb,stringifySym:o9,stringifySafeSym:Wf,stringifiersSym:a9,setLevelSym:ub,endSym:cb,formatOptsSym:hb,messageKeySym:fb,nestedKeySym:db,mixinSym:mb,useOnlyCustomLevelsSym:pb,formattersSym:l9,hooksSym:gb,nestedKeyStrSym:yb,mixinMergeStrategySym:bb}=h9,{epochTime:d9,nullTime:vb}=c9,{pid:wb}=process,_b=G7.hostname(),xb=u9.err,Sb={level:"info",levels:Q7,messageKey:"msg",nestedKey:null,enabled:!0,base:{pid:wb,hostname:_b},serializers:Object.assign(Object.create(null),{err:xb}),formatters:Object.assign(Object.create(null),{bindings(t){return t},level(t,e){return{level:e}}}),hooks:{logMethod:void 0},timestamp:d9,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100},Mb=eb(Sb),Eb=Object.assign(Object.create(null),u9);function qf(...t){let e={},{opts:r,stream:i}=Mb(e,V7(),...t),{redact:n,crlf:o,serializers:a,timestamp:c,messageKey:d,nestedKey:p,base:m,name:S,level:R,customLevels:x,mixin:w,mixinMergeStrategy:E,useOnlyCustomLevels:T,formatters:C,hooks:P,depthLimit:L,edgeLimit:B}=r,z=Z7({maximumDepth:L,maximumBreadth:B}),q=rb(C.level,C.bindings,C.log),Z=n?K7(n,uu):{},se=uu.bind({[Wf]:z}),Se=n?{stringify:Z[sb]}:{stringify:se},qe="}"+(o?`\r
|
|
104
93
|
`:`
|
|
105
|
-
`),
|
|
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=Vv,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(!Gv(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};r0.exports=fm();r0.exports.create=fm});var i0=V((vA,mm)=>{mm.exports=require("stream")});var bm=V((wA,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 Jv(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){Zv(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 Zv(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Yv(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 Xv(t,e,r){return e&&gm(t.prototype,e),r&&gm(t,r),t}var Qv=require("buffer"),Tu=Qv.Buffer,ew=require("util"),n0=ew.inspect,tw=n0&&n0.custom||"inspect";function rw(t,e,r){Tu.prototype.copy.call(t,e,r)}ym.exports=function(){function t(){Yv(this,t),this.head=null,this.tail=null,this.length=0}return Xv(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 Tu.alloc(0);for(var i=Tu.allocUnsafe(r>>>0),n=this.head,o=0;n;)rw(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=Tu.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:tw,value:function(r,i){return n0(this,Jv({},i,{depth:0,customInspect:!1}))}}]),t}()});var o0=V((_A,wm)=>{"use strict";function iw(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(s0,this,t)):process.nextTick(s0,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(Pu,r):(r._writableState.errorEmitted=!0,process.nextTick(vm,r,o)):process.nextTick(vm,r,o):e?(process.nextTick(Pu,r),e(o)):process.nextTick(Pu,r)}),this)}function vm(t,e){s0(t,e),Pu(t)}function Pu(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function nw(){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 s0(t,e){t.emit("error",e)}function sw(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:iw,undestroy:nw,errorOrDestroy:sw}});var pn=V((xA,Sm)=>{"use strict";var xm={};function Sr(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 ow(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function aw(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function lw(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}Sr("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);Sr("ERR_INVALID_ARG_TYPE",function(t,e,r){let i;typeof e=="string"&&ow(e,"not ")?(i="must not be",e=e.replace(/^not /,"")):i="must be";let n;if(aw(t," argument"))n=`The ${t} ${i} ${_m(e,"type")}`;else{let o=lw(t,".")?"property":"argument";n=`The "${t}" ${o} ${i} ${_m(e,"type")}`}return n+=`. Received type ${typeof r}`,n},TypeError);Sr("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Sr("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});Sr("ERR_STREAM_PREMATURE_CLOSE","Premature close");Sr("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});Sr("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Sr("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Sr("ERR_STREAM_WRITE_AFTER_END","write after end");Sr("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Sr("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);Sr("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");Sm.exports.codes=xm});var a0=V((SA,Mm)=>{"use strict";var uw=pn().codes.ERR_INVALID_OPT_VALUE;function hw(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function cw(t,e,r,i){var n=hw(e,i,r);if(n!=null){if(!(isFinite(n)&&Math.floor(n)===n)||n<0){var o=i?r:"highWaterMark";throw new uw(o,n)}return Math.floor(n)}return t.objectMode?16:16*1024}Mm.exports={getHighWaterMark:cw}});var Em=V((MA,l0)=>{typeof Object.create=="function"?l0.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:l0.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((EA,h0)=>{try{if(u0=require("util"),typeof u0.inherits!="function")throw"";h0.exports=u0.inherits}catch{h0.exports=Em()}var u0});var Cm=V((RA,Rm)=>{Rm.exports=require("util").deprecate});var d0=V((CA,km)=>{"use strict";km.exports=it;function Tm(t){var e=this;this.next=null,this.entry=null,this.finish=function(){zw(e,t)}}var Fo;it.WritableState=p1;var fw={deprecate:Cm()},Pm=i0(),Ou=require("buffer").Buffer,dw=global.Uint8Array||function(){};function mw(t){return Ou.from(t)}function pw(t){return Ou.isBuffer(t)||t instanceof dw}var f0=o0(),gw=a0(),yw=gw.getHighWaterMark,gn=pn().codes,bw=gn.ERR_INVALID_ARG_TYPE,vw=gn.ERR_METHOD_NOT_IMPLEMENTED,ww=gn.ERR_MULTIPLE_CALLBACK,_w=gn.ERR_STREAM_CANNOT_PIPE,xw=gn.ERR_STREAM_DESTROYED,Sw=gn.ERR_STREAM_NULL_VALUES,Mw=gn.ERR_STREAM_WRITE_AFTER_END,Ew=gn.ERR_UNKNOWN_ENCODING,Wo=f0.errorOrDestroy;$o()(it,Pm);function Rw(){}function p1(t,e,r){Fo=Fo||fs(),t=t||{},typeof r!="boolean"&&(r=e instanceof Fo),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=yw(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){kw(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)}p1.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(p1.prototype,"buffer",{get:fw.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(it,Symbol.hasInstance,{value:function(e){return Iu.call(this,e)?!0:this!==it?!1:e&&e._writableState instanceof p1}})):Iu=function(e){return e instanceof this};function it(t){Fo=Fo||fs();var e=this instanceof Fo;if(!e&&!Iu.call(it,this))return new it(t);this._writableState=new p1(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)),Pm.call(this)}it.prototype.pipe=function(){Wo(this,new _w)};function Cw(t,e){var r=new Mw;Wo(t,r),process.nextTick(e,r)}function Aw(t,e,r,i){var n;return r===null?n=new Sw:typeof r!="string"&&!e.objectMode&&(n=new bw("chunk",["string","Buffer"],r)),n?(Wo(t,n),process.nextTick(i,n),!1):!0}it.prototype.write=function(t,e,r){var i=this._writableState,n=!1,o=!i.objectMode&&pw(t);return o&&!Ou.isBuffer(t)&&(t=mw(t)),typeof e=="function"&&(r=e,e=null),o?e="buffer":e||(e=i.defaultEncoding),typeof r!="function"&&(r=Rw),i.ending?Cw(this,r):(o||Aw(this,i,t,r))&&(i.pendingcb++,n=Pw(this,i,o,t,e,r)),n};it.prototype.cork=function(){this._writableState.corked++};it.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&Im(this,t))};it.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 Ew(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(it.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function Tw(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=Ou.from(e,r)),e}Object.defineProperty(it.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Pw(t,e,r,i,n,o){if(!r){var a=Tw(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 c0(t,e,!1,h,i,n,o);return d}function c0(t,e,r,i,n,o,a){e.writelen=i,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new xw("write")):r?t._writev(n,e.onwrite):t._write(n,o,e.onwrite),e.sync=!1}function Iw(t,e,r,i,n){--e.pendingcb,r?(process.nextTick(n,i),process.nextTick(m1,t,e),t._writableState.errorEmitted=!0,Wo(t,i)):(n(i),t._writableState.errorEmitted=!0,Wo(t,i),m1(t,e))}function Ow(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}function kw(t,e){var r=t._writableState,i=r.sync,n=r.writecb;if(typeof n!="function")throw new ww;if(Ow(r),e)Iw(t,r,i,e,n);else{var o=Om(r)||t.destroyed;!o&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&Im(t,r),i?process.nextTick(Am,t,r,o,n):Am(t,r,o,n)}}function Am(t,e,r,i){r||Lw(t,e),e.pendingcb--,i(),m1(t,e)}function Lw(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,c0(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(c0(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}it.prototype._write=function(t,e,r){r(new vw("_write()"))};it.prototype._writev=null;it.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||Dw(this,i,r),this};Object.defineProperty(it.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 Nw(t,e){t._final(function(r){e.pendingcb--,r&&Wo(t,r),e.prefinished=!0,t.emit("prefinish"),m1(t,e)})}function Bw(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.pendingcb++,e.finalCalled=!0,process.nextTick(Nw,t,e)):(e.prefinished=!0,t.emit("prefinish")))}function m1(t,e){var r=Om(e);if(r&&(Bw(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 Dw(t,e,r){e.ending=!0,m1(t,e),r&&(e.finished?process.nextTick(r):t.once("finish",r)),e.ended=!0,t.writable=!1}function zw(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(it.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){!this._writableState||(this._writableState.destroyed=e)}});it.prototype.destroy=f0.destroy;it.prototype._undestroy=f0.undestroy;it.prototype._destroy=function(t,e){e(t)}});var fs=V((AA,Nm)=>{"use strict";var Uw=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};Nm.exports=ai;var Lm=g0(),p0=d0();$o()(ai,Lm);for(m0=Uw(p0.prototype),ku=0;ku<m0.length;ku++)Lu=m0[ku],ai.prototype[Lu]||(ai.prototype[Lu]=p0.prototype[Lu]);var m0,Lu,ku;function ai(t){if(!(this instanceof ai))return new ai(t);Lm.call(this,t),p0.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",jw)))}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 jw(){this._writableState.ended||process.nextTick(qw,this)}function qw(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((y0,Dm)=>{var Nu=require("buffer"),li=Nu.Buffer;function Bm(t,e){for(var r in t)e[r]=t[r]}li.from&&li.alloc&&li.allocUnsafe&&li.allocUnsafeSlow?Dm.exports=Nu:(Bm(Nu,y0),y0.Buffer=ds);function ds(t,e,r){return li(t,e,r)}ds.prototype=Object.create(li.prototype);Bm(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 Nu.SlowBuffer(t)}});var w0=V(jm=>{"use strict";var v0=zm().Buffer,Um=v0.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 $w(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 Fw(t){var e=$w(t);if(typeof e!="string"&&(v0.isEncoding===Um||!Um(t)))throw new Error("Unknown encoding: "+t);return e||t}jm.StringDecoder=g1;function g1(t){this.encoding=Fw(t);var e;switch(this.encoding){case"utf16le":this.text=Jw,this.end=Zw,e=4;break;case"utf8":this.fillLast=Gw,e=4;break;case"base64":this.text=Yw,this.end=Xw,e=3;break;default:this.write=Qw,this.end=e_;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=v0.allocUnsafe(e)}g1.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||""};g1.prototype.end=Kw;g1.prototype.text=Vw;g1.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 b0(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function Ww(t,e,r){var i=e.length-1;if(i<r)return 0;var n=b0(e[i]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--i<r||n===-2?0:(n=b0(e[i]),n>=0?(n>0&&(t.lastNeed=n-2),n):--i<r||n===-2?0:(n=b0(e[i]),n>=0?(n>0&&(n===2?n=0:t.lastNeed=n-3),n):0))}function Hw(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 Gw(t){var e=this.lastTotal-this.lastNeed,r=Hw(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 Vw(t,e){var r=Ww(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 Kw(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Jw(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 Zw(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 Yw(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 Xw(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Qw(t){return t.toString(this.encoding)}function e_(t){return t&&t.length?this.write(t):""}});var Bu=V((PA,Fm)=>{"use strict";var qm=pn().codes.ERR_STREAM_PREMATURE_CLOSE;function t_(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 r_(){}function i_(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=t_(r||r_);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 qm),r.call(t,w);if(n&&!a)return(!t._writableState||!t._writableState.ended)&&(w=new qm),r.call(t,w)},R=function(){t.req.on("finish",h)};return i_(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=$m});var Hm=V((IA,Wm)=>{"use strict";var Du;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 n_=Bu(),bn=Symbol("lastResolve"),ms=Symbol("lastReject"),y1=Symbol("error"),zu=Symbol("ended"),ps=Symbol("lastPromise"),_0=Symbol("handlePromise"),gs=Symbol("stream");function vn(t,e){return{value:t,done:e}}function s_(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 o_(t){process.nextTick(s_,t)}function a_(t,e){return function(r,i){t.then(function(){if(e[zu]){r(vn(void 0,!0));return}e[_0](r,i)},i)}}var l_=Object.getPrototypeOf(function(){}),u_=Object.setPrototypeOf((Du={get stream(){return this[gs]},next:function(){var e=this,r=this[y1];if(r!==null)return Promise.reject(r);if(this[zu])return Promise.resolve(vn(void 0,!0));if(this[gs].destroyed)return new Promise(function(a,h){process.nextTick(function(){e[y1]?h(e[y1]):a(vn(void 0,!0))})});var i=this[ps],n;if(i)n=new Promise(a_(i,this));else{var o=this[gs].read();if(o!==null)return Promise.resolve(vn(o,!1));n=new Promise(this[_0])}return this[ps]=n,n}},yn(Du,Symbol.asyncIterator,function(){return this}),yn(Du,"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))})})}),Du),l_),h_=function(e){var r,i=Object.create(u_,(r={},yn(r,gs,{value:e,writable:!0}),yn(r,bn,{value:null,writable:!0}),yn(r,ms,{value:null,writable:!0}),yn(r,y1,{value:null,writable:!0}),yn(r,zu,{value:e._readableState.endEmitted,writable:!0}),yn(r,_0,{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,n_(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[y1]=n;return}var a=i[bn];a!==null&&(i[ps]=null,i[bn]=null,i[ms]=null,a(vn(void 0,!0))),i[zu]=!0}),e.on("readable",o_.bind(null,i)),i};Wm.exports=h_});var Jm=V((OA,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 c_(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 f_(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){d_(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 d_(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var m_=pn().codes.ERR_INVALID_ARG_TYPE;function p_(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 m_("iterable",["Iterable"],e);var n=new t(f_({objectMode:!0},r)),o=!1;n._read=function(){o||(o=!0,a())};function a(){return h.apply(this,arguments)}function h(){return h=c_(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=p_});var g0=V((LA,sp)=>{"use strict";sp.exports=Oe;var Ho;Oe.ReadableState=Qm;var kA=require("events").EventEmitter,Xm=function(e,r){return e.listeners(r).length},v1=i0(),Uu=require("buffer").Buffer,g_=global.Uint8Array||function(){};function y_(t){return Uu.from(t)}function b_(t){return Uu.isBuffer(t)||t instanceof g_}var x0=require("util"),be;x0&&x0.debuglog?be=x0.debuglog("stream"):be=function(){};var v_=bm(),T0=o0(),w_=a0(),__=w_.getHighWaterMark,ju=pn().codes,x_=ju.ERR_INVALID_ARG_TYPE,S_=ju.ERR_STREAM_PUSH_AFTER_EOF,M_=ju.ERR_METHOD_NOT_IMPLEMENTED,E_=ju.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Go,S0,M0;$o()(Oe,v1);var b1=T0.errorOrDestroy,E0=["error","close","destroy","pause","resume"];function R_(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){Ho=Ho||fs(),t=t||{},typeof r!="boolean"&&(r=e instanceof Ho),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=__(this,t,"readableHighWaterMark",r),this.buffer=new v_,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&&(Go||(Go=w0().StringDecoder),this.decoder=new Go(t.encoding),this.encoding=t.encoding)}function Oe(t){if(Ho=Ho||fs(),!(this instanceof Oe))return new Oe(t);var e=this instanceof Ho;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)),v1.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=T0.destroy;Oe.prototype._undestroy=T0.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=Uu.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){be("readableAddChunk",e);var o=t._readableState;if(e===null)o.reading=!1,T_(t,o);else{var a;if(n||(a=C_(o,e)),a)b1(t,a);else if(o.objectMode||e&&e.length>0)if(typeof e!="string"&&!o.objectMode&&Object.getPrototypeOf(e)!==Uu.prototype&&(e=y_(e)),i)o.endEmitted?b1(t,new E_):R0(t,o,e,!0);else if(o.ended)b1(t,new S_);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||e.length!==0?R0(t,o,e,!1):A0(t,o)):R0(t,o,e,!1)}else i||(o.reading=!1,A0(t,o))}return!o.ended&&(o.length<o.highWaterMark||o.length===0)}function R0(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&&qu(t)),A0(t,e)}function C_(t,e){var r;return!b_(e)&&typeof e!="string"&&e!==void 0&&!t.objectMode&&(r=new x_("chunk",["string","Buffer","Uint8Array"],e)),r}Oe.prototype.isPaused=function(){return this._readableState.flowing===!1};Oe.prototype.setEncoding=function(t){Go||(Go=w0().StringDecoder);var e=new Go(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 A_(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=A_(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}Oe.prototype.read=function(t){be("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 be("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?C0(this):qu(this),null;if(t=Ym(t,e),t===0&&e.ended)return e.length===0&&C0(this),null;var i=e.needReadable;be("need readable",i),(e.length===0||e.length-t<e.highWaterMark)&&(i=!0,be("length less than watermark",i)),e.ended||e.reading?(i=!1,be("reading or ended",i)):i&&(be("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&&C0(this)),n!==null&&this.emit("data",n),n};function T_(t,e){if(be("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?qu(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,tp(t)))}}function qu(t){var e=t._readableState;be("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(be("emitReadable",e.flowing),e.emittedReadable=!0,process.nextTick(tp,t))}function tp(t){var e=t._readableState;be("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 A0(t,e){e.readingMore||(e.readingMore=!0,process.nextTick(P_,t,e))}function P_(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){var r=e.length;if(be("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}Oe.prototype._read=function(t){b1(this,new M_("_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,be("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){be("onunpipe"),T===r&&C&&C.hasUnpiped===!1&&(C.hasUnpiped=!0,p())}function h(){be("onend"),t.end()}var d=I_(r);t.on("drain",d);var m=!1;function p(){be("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){be("ondata");var C=t.write(T);be("dest.write",C),C===!1&&((i.pipesCount===1&&i.pipes===t||i.pipesCount>1&&np(i.pipes,t)!==-1)&&!m&&(be("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function R(T){be("onerror",T),E(),t.removeListener("error",R),Xm(t,"error")===0&&b1(t,T)}R_(t,"error",R);function x(){t.removeListener("finish",w),E()}t.once("close",x);function w(){be("onfinish"),t.removeListener("close",x),E()}t.once("finish",w);function E(){be("unpipe"),r.unpipe(t)}return t.emit("pipe",r),i.flowing||(be("pipe resume"),r.resume()),t};function I_(t){return function(){var r=t._readableState;be("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=v1.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,be("on readable",i.length,i.reading),i.length?qu(this):i.reading||process.nextTick(O_,this)),r};Oe.prototype.addListener=Oe.prototype.on;Oe.prototype.removeListener=function(t,e){var r=v1.prototype.removeListener.call(this,t,e);return t==="readable"&&process.nextTick(rp,this),r};Oe.prototype.removeAllListeners=function(t){var e=v1.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 O_(t){be("readable nexttick read 0"),t.read(0)}Oe.prototype.resume=function(){var t=this._readableState;return t.flowing||(be("resume"),t.flowing=!t.readableListening,k_(this,t)),t.paused=!1,this};function k_(t,e){e.resumeScheduled||(e.resumeScheduled=!0,process.nextTick(L_,t,e))}function L_(t,e){be("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 be("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(be("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function P0(t){var e=t._readableState;for(be("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(be("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(be("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<E0.length;o++)t.on(E0[o],this.emit.bind(this,E0[o]));return this._read=function(a){be("wrapped _read",a),i&&(i=!1,t.resume())},this};typeof Symbol=="function"&&(Oe.prototype[Symbol.asyncIterator]=function(){return S0===void 0&&(S0=Hm()),S0(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 C0(t){var e=t._readableState;be("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,process.nextTick(N_,e,t))}function N_(t,e){if(be("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 M0===void 0&&(M0=Jm()),M0(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 I0=V((NA,ap)=>{"use strict";ap.exports=zi;var $u=pn().codes,B_=$u.ERR_METHOD_NOT_IMPLEMENTED,D_=$u.ERR_MULTIPLE_CALLBACK,z_=$u.ERR_TRANSFORM_ALREADY_TRANSFORMING,U_=$u.ERR_TRANSFORM_WITH_LENGTH_0,Fu=fs();$o()(zi,Fu);function j_(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(i===null)return this.emit("error",new D_);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);Fu.call(this,t),this._transformState={afterTransform:j_.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",q_)}function q_(){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,Fu.prototype.push.call(this,t,e)};zi.prototype._transform=function(t,e,r){r(new B_("_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){Fu.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 U_;if(t._transformState.transforming)throw new z_;return t.push(null)}});var hp=V((BA,up)=>{"use strict";up.exports=w1;var lp=I0();$o()(w1,lp);function w1(t){if(!(this instanceof w1))return new w1(t);lp.call(this,t)}w1.prototype._transform=function(t,e,r){r(null,t)}});var pp=V((DA,mp)=>{"use strict";var O0;function $_(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var dp=pn().codes,F_=dp.ERR_MISSING_ARGS,W_=dp.ERR_STREAM_DESTROYED;function cp(t){if(t)throw t}function H_(t){return t.setHeader&&typeof t.abort=="function"}function G_(t,e,r,i){i=$_(i);var n=!1;t.on("close",function(){n=!0}),O0===void 0&&(O0=Bu()),O0(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,H_(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();i(a||new W_("pipe"))}}}function fp(t){t()}function V_(t,e){return t.pipe(e)}function K_(t){return!t.length||typeof t[t.length-1]!="function"?cp:t.pop()}function J_(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var i=K_(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new F_("streams");var n,o=e.map(function(a,h){var d=h<e.length-1,m=h>0;return G_(a,d,m,function(p){n||(n=p),p&&o.forEach(fp),!d&&(o.forEach(fp),i(n))})});return e.reduce(V_)}mp.exports=J_});var gp=V((Mr,x1)=>{var _1=require("stream");process.env.READABLE_STREAM==="disable"&&_1?(x1.exports=_1.Readable,Object.assign(x1.exports,_1),x1.exports.Stream=_1):(Mr=x1.exports=g0(),Mr.Stream=_1||Mr,Mr.Readable=Mr,Mr.Writable=d0(),Mr.Duplex=fs(),Mr.Transform=I0(),Mr.PassThrough=hp(),Mr.finished=Bu(),Mr.pipeline=pp())});var wp=V((zA,vp)=>{"use strict";var{Transform:Z_}=gp(),{StringDecoder:Y_}=require("string_decoder"),wn=Symbol("last"),Wu=Symbol("decoder");function X_(t,e,r){var i;if(this.overflow){var n=this[Wu].write(t);if(i=n.split(this.matcher),i.length===1)return r();i.shift(),this.overflow=!1}else this[wn]+=this[Wu].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 Q_(t){this[wn]+=this[Wu].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 ex(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=X_,r.flush=Q_,r.readableObjectMode=!0;let i=new Z_(r);return i[wn]="",i[Wu]=new Y_("utf8"),i.matcher=t,i.mapper=e,i.maxLength=r.maxLength,i.skipOverflow=r.skipOverflow,i.overflow=!1,i}vp.exports=ex});var zp=V((ET,Dp)=>{"use strict";Dp.exports=Ju;Ju.polyline=Ju;Ju.polygon=cx;function Ju(t,e,r){var i=t.length,n=Jo(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=Jo(d,e);;)if(n|m){if(n&m)break;n?(h=$0(h,d,n,e),n=Jo(h,e)):(d=$0(h,d,m,e),m=Jo(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 cx(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=!(Jo(n,e)&i),a=0;a<t.length;a++)h=t[a],d=!(Jo(h,e)&i),d!==o&&r.push($0(n,h,i,e)),d&&r.push(h),n=h,o=d;if(t=r,!t.length)break}return r}function $0(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 Jo(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((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),P=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}P.right=E,P=E,E=E.right}else break}return P.right=E.left,k.left=E.right,E.left=C.right,E.right=C.left,E}function i(w,E,T,C){var P=new t(w,E);if(T===null)return P.left=P.right=null,P;T=r(w,T,C);var k=C(w,T.key);return k<0?(P.left=T.left,P.right=T,T.left=null):k>=0&&(P.right=T.right,P.left=T,T.right=null),P}function n(w,E,T){var C=null,P=null;if(E){E=r(w,E,T);var k=T(E.key,w);k===0?(C=E.left,P=E.right):k<0?(P=E.right,E.right=null,C=E):(C=E.left,E.left=null,P=E)}return{left:C,right:P}}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,P){if(w){C(""+E+(T?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ")+P(w)+`
|
|
107
|
-
`);var k=E+(T?" ":"\u2502 ");w.left&&a(w.left,k,!1,C,P),w.right&&a(w.right,k,!0,C,P)}}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 P=this._comparator,k=r(E,this._root,P),B=P(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 P;if(T===null)return null;T=r(E,T,C);var k=C(E,T.key);return k===0?(T.left===null?P=T.right:(P=r(E,T.left,C),P.right=T.right),this._size--,P):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 P=C(E,T.key);if(P===0)return T;P<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 P=C(E,T.key);if(P===0)return!0;P<0?T=T.left:T=T.right}return!1},w.prototype.forEach=function(E,T){for(var C=this._root,P=[],k=!1;!k;)C!==null?(P.push(C),C=C.left):P.length!==0?(C=P.pop(),E.call(T,C),C=C.right):k=!0;return this},w.prototype.range=function(E,T,C,P){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(P,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,P=0,k=[];!C;)if(T)k.push(T),T=T.left;else if(k.length>0){if(T=k.pop(),P===E)return T;P++,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 P=this._comparator;T;){var k=P(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 P=this._comparator;T;){var k=P(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 P=E.length,k=this._comparator;if(C&&x(E,T,0,P-1,k),this._root===null)this._root=d(E,T,0,P),this._size=P;else{var B=R(this.toList(),m(E,T),k);P=this._size+P,this._root=M({head:B},0,P)}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 P=this._comparator,k=n(E,this._root,P),B=k.left,z=k.right;P(E,T)<0?z=i(T,C,z,P):B=i(T,C,B,P),this._root=o(B,z,P)},w.prototype.split=function(E){return n(E,this._root,this._comparator)},w}();function d(w,E,T,C){var P=C-T;if(P>0){var k=T+Math.floor(P/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,P=0;P<w.length;P++)C=C.next=new t(w[P],E[P]);return C.next=null,T.next}function p(w){for(var E=w,T=[],C=!1,P=new t(null,null),k=P;!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,P.next}function M(w,E,T){var C=T-E;if(C>0){var P=E+Math.floor(C/2),k=M(w,E,P),B=w.head;return B.left=k,w.head=w.head.next,B.right=M(w,P+1,T),B}return null}function R(w,E,T){for(var C=new t(null,null),P=C,k=w,B=E;k!==null&&B!==null;)T(k.key,B.key)<0?(P.next=k,k=k.next):(P.next=B,B=B.next),P=P.next;return k!==null?P.next=k:B!==null&&(P.next=B),C.next}function x(w,E,T,C,P){if(!(T>=C)){for(var k=w[T+C>>1],B=T-1,z=C+1;;){do B++;while(P(w[B],k)<0);do z--;while(P(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,P),x(w,E,z+1,C,P)}}return h})});var Yp=V((RT,Zp)=>{"use strict";var fx=Up();function dx(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var V0=dx(fx);function Er(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 M1=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 mx=xn*xn,G0=function(e,r){if(-xn<e&&e<xn&&-xn<r&&r<xn)return 0;var i=e-r;return i*i<mx*e*r?0:e<r?-1:1},px=function(){function t(){Er(this,t),this.reset()}return Nt(t,[{key:"reset",value:function(){this.xRounder=new qp,this.yRounder=new qp}},{key:"round",value:function(r,i){return{x:this.xRounder.round(r),y:this.yRounder.round(i)}}}]),t}(),qp=function(){function t(){Er(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}(),R1=new px,E1=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},$p=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=E1(n,o);return G0(a,0)},Zu=function(e){return Math.sqrt(Jp(e,e))},gx=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 E1(o,n)/Zu(o)/Zu(n)},yx=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)/Zu(o)/Zu(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)}},bx=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=E1(r,n);if(o==0)return null;var a={x:i.x-e.x,y:i.y-e.y},h=E1(a,r)/o,d=E1(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:Yu.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){Er(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:gx(i.point,r.point,d.point),cosine:yx(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}(),vx=0,Yu=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 P=p-d,k=a-n,B=M-m,z=h-o;if(P>k&&B<z)return 1;if(P<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){Er(this,t),this.id=++vx,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=M1(i,d)&&this.comparePoint(d)===0,M=M1(n,a)&&r.comparePoint(a)===0,R=M1(i,m)&&this.comparePoint(m)===0,x=M1(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=bx(a,this.vector(),d,r.vector());return w===null||!M1(o,w)?null:R1.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 P=0,k=M.length;P<k;P++){var B=M[P].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(Er(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=R1.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=R1.round(e[a][0],e[a][1]);d.x===o.x&&d.y===o.y||(this.segments.push(Yu.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(Yu.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}(),wx=function(){function t(e,r){if(Er(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(Er(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 wx(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}(),_x=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,P=R.length;C<P;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){Er(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;$p(a,r,h)!==0&&(i.push(a),r=a)}if(i.length===1)return null;var d=i[0],m=i[1];$p(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){Er(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}(),xx=function(){function t(e){Er(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}(),Sx=function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Yu.compare;Er(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),P=0,k=C.length;P<k;P++)n.push(C[P])}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 at=this._splitSafely(m,Me),Ut=0,di=at.length;Ut<di;Ut++)n.push(at[Ut])}}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,Mx=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,Ex=function(){function t(){Er(this,t)}return Nt(t,[{key:"run",value:function(r,i,n){Ur.type=r,R1.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;)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 P=o[T].getSweepEvents(),k=0,B=P.length;k<B;k++)if(E.insert(P[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 Sx(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>Mx)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 at=Ue[Te];at.consumedBy===void 0&&E.insert(at)}H=E.size,J=E.pop()}R1.reset();var Ut=_x.factory(z.segments),di=new xx(Ut);return di.getGeom()}}]),t}(),Ur=new Ex,Rx=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)},Cx=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)},Ax=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)},Tx=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)},Px={union:Rx,intersection:Cx,xor:Ax,difference:Tx};Zp.exports=Px});var n6=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,P=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,at=5,Ut=-1,di=/\s/,ma=/[A-Za-z]/,jh=/[A-Za-z84]/,In=/[,\]]/,pa=/[\d\.E\-\+]/;function cr(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}cr.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 at:return this.afterquote(s);case Te:return this.number(s);case Ut:return}},cr.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)},cr.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=Ut);return}},cr.prototype.number=function(s){if(pa.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)},cr.prototype.quoted=function(s){if(s==='"'){this.state=at;return}this.word+=s},cr.prototype.keyword=function(s){if(jh.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)},cr.prototype.neutral=function(s){if(ma.test(s)){this.word=s,this.state=Ue;return}if(s==='"'){this.word="",this.state=Ne;return}if(pa.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)},cr.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===Ut)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function ga(s){var l=new cr(s);return l.output()}function Ps(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]],Ps(l,c,s);return;default:for(y=-1;++y<s.length;)if(!Array.isArray(s[y]))return mi(s,l[c]);return Ps(l,c,s)}}var qh=.017453292519943295;function $h(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 ut(s){return s*qh}function er(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 $h(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",ut],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",ut],["x0","false_easting",S],["y0","false_northing",S],["long0","central_meridian",ut],["lat0","latitude_of_origin",ut],["lat0","standard_parallel_1",ut],["lat1","standard_parallel_1",ut],["lat2","standard_parallel_2",ut],["azimuth","Azimuth"],["alpha","azimuth",ut],["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=ut(s.lat1>0?90:-90),s.lat_ts=s.lat1)}var q1=function(s){var l=ga(s),c=l.shift(),y=l.shift();l.unshift(["name",y]),l.unshift(["type",c]);var g={};return mi(l,g),er(g),g};function dt(s){var l=this;if(arguments.length===2){var c=arguments[1];typeof c=="string"?c.charAt(0)==="+"?dt[s]=se(arguments[1]):dt[s]=q1(arguments[1]):dt[s]=c}else if(arguments.length===1){if(Array.isArray(s))return s.map(function(y){Array.isArray(y)?dt.apply(l,y):dt(y)});if(typeof s=="string"){if(s in dt)return dt[s]}else"EPSG"in s?dt["EPSG:"+s.EPSG]=s:"ESRI"in s?dt["ESRI:"+s.ESRI]=s:"IAU2000"in s?dt["IAU2000:"+s.IAU2000]=s:console.log(s);return}}t(dt);function Tr(s){return typeof s=="string"}function ya(s){return s in dt}var ba=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function $1(s){return ba.some(function(l){return s.indexOf(l)>-1})}var Fh=["3857","900913","3785","102113"];function F1(s){var l=J(s,"authority");if(!!l){var c=J(l,"epsg");return c&&Fh.indexOf(c)>-1}}function va(s){var l=J(s,"extension");if(!!l)return J(l,"proj4")}function ji(s){return s[0]==="+"}function W1(s){if(Tr(s)){if(ya(s))return dt[s];if($1(s)){var l=q1(s);if(F1(l))return dt["EPSG:3857"];var c=va(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)},qi=function(s){return s<0?-1:1},Z=function(s){return Math.abs(s)<=k?s:s-qi(s)*P},lt=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},Pr=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 H1(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=lt(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 G1(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=Pr(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 V1=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"],Wh={init:Os,forward:H1,inverse:G1,names:V1};function K1(){}function wa(s){return s}var J1=["longlat","identity"],On={init:K1,forward:wa,inverse:wa,names:J1},Z1=[Wh,On],_a={},pi=[];function xa(s,l){var c=pi.length;return s.names?(pi[c]=s,s.names.forEach(function(y){_a[y.toLowerCase()]=c}),this):(console.log(l),!0)}function Hh(s){if(!s)return!1;var l=s.toLowerCase();if(typeof _a[l]<"u"&&pi[_a[l]])return pi[_a[l]]}function Y1(){Z1.forEach(xa)}var Sa={start:Y1,add:xa,get:Hh},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 Gh=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 kn(s,l,c,y,g){if(!s){var v=J(ue,y);v||(v=Gh),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 Ze={};Ze.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},Ze.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},Ze.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},Ze.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},Ze.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},Ze.potsdam={towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},Ze.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},Ze.hermannskogel={towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},Ze.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},Ze.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},Ze.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},Ze.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},Ze.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"},Ze.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},Ze.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},Ze.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},Ze.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=Q1(c,y);g.nSubgrids>1&&console.log("Only single NTv2 subgrids are currently supported, subsequent sub grids are ignored");var v=el(c,g,y),S={header:g,subgrids:v};return ks[s]=S,S}function X1(s){if(s===void 0)return null;var l=s.split(",");return l.map(Ma)}function Ma(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 Q1(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 el(s,l,c){for(var y=176,g=[],v=0;v<l.nSubgrids;v++){var S=tl(s,y,c),b=Vh(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:Ea(b)})}return g}function Ea(s){return s.map(function(l){return[bi(l.longitudeShift),bi(l.latitudeShift)]})}function tl(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 Vh(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 fr(s,l){if(!(this instanceof fr))return new fr(s);l=l||function(O){if(O)throw O};var c=W1(s);if(typeof c!="object"){l(s);return}var y=fr.projections.get(c.projName);if(!y){l(s);return}if(c.datumCode&&c.datumCode!=="none"){var g=J(Ze,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=kn(c.a,c.b,c.rf,c.ellps,c.sphere),S=Fr(v.a,v.b,v.rf,c.R_A),b=X1(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)}fr.projections=Sa,fr.projections.start();function Kh(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 Ra(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 Ln(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,ye,We=s.x,ke=s.y,De=s.z?s.z:0,St,rt,Xr;if(b=Math.sqrt(We*We+ke*ke),A=Math.sqrt(We*We+ke*ke+De*De),b/c<g){if(St=0,A/c<g)return rt=p,Xr=-y,{x:s.x,y:s.y,z:s.z}}else St=Math.atan2(ke,We);O=De/A,D=b/A,L=1/Math.sqrt(1-l*(2-l)*D*D),F=D*(1-l)*L,G=O*L,ye=0;do ye++,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&&ye<S);return rt=Math.atan(ie/Math.abs(K)),{x:St,y:rt,z:Xr}}function Jh(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(Kh(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=jt(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=Ra(c,g,y),Wr(s.datum_type)&&(c=Jh(c,s.datum_type,s.datum_params)),Wr(l.datum_type)&&(c=Bs(c,l.datum_type,l.datum_params)),c=Ln(c,A,S,b),l.datum_type===i){var O=jt(l,!0,c);if(O!==0)return}return c};function jt(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=Ca(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 Ca(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=Aa(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=Aa(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 Aa(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 Nn=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},Bn=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},rl=function(s){il(s.x),il(s.y)};function il(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 Zh(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 $i(s,l,c,y){var g;if(Array.isArray(c)&&(c=Bn(c)),rl(c),s.datum&&l.datum&&Zh(s,l)&&(g=new fr("WGS84"),c=$i(s,g,c,y),s=g),y&&s.axis!=="enu"&&(c=Nn(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"?Nn(l,!0,c):c}var Fi=fr("WGS84");function zs(s,l,c,y){var g,v,S;return Array.isArray(c)?(g=$i(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=$i(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 Ta(s){return s instanceof fr?s:s.oProj?s.oProj:fr(s)}function Pt(s,l,c){s=Ta(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=Ta(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 Pa=6,Us="AJSAJS",Wi="AFAFAF",qt=65,pt=73,gt=79,Ir=86,Hr=90,js={forward:nl,inverse:Yh,toPoint:sl};function nl(s,l){return l=l||5,ec(Xh({lat:s[1],lon:s[0]}),l)}function Yh(s){var l=qs(ll(s.toUpperCase()));return l.lat&&l.lon?[l.lon,l.lat,l.lon,l.lat]:[l.left,l.bottom,l.right,l.top]}function sl(s){var l=qs(ll(s.toUpperCase()));return l.lat&&l.lon?[l.lon,l.lat]:[(l.left+l.right)/2,(l.top+l.bottom)/2]}function Ia(s){return s*(Math.PI/180)}function ol(s){return 180*(s/Math.PI)}function Xh(s){var l=s.lat,c=s.lon,y=6378137,g=.00669438,v=.9996,S,b,A,O,D,L,U,W=Ia(l),F=Ia(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=Ia(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:Qh(l)}}function qs(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,ye=c-5e5,We=l;y<"N"&&(We-=1e7),K=(g-1)*6-180+3,A=b/(1-b),G=We/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=ye/(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=ol(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+ol(De);var St;if(s.accuracy){var rt=qs({northing:s.northing+s.accuracy,easting:s.easting+s.accuracy,zoneLetter:s.zoneLetter,zoneNumber:s.zoneNumber});St={top:rt.lat,right:rt.lon,bottom:ke,left:De}}else St={lat:ke,lon:De};return St}function Qh(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 ec(s,l){var c="00000"+s.easting,y="00000"+s.northing;return s.zoneNumber+s.zoneLetter+tc(s.easting,s.northing,s.zoneNumber)+c.substr(c.length-5,l)+y.substr(y.length-5,l)}function tc(s,l,c){var y=Hi(c),g=Math.floor(s/1e5),v=Math.floor(l/1e5)%20;return al(g,v,y)}function Hi(s){var l=s%Pa;return l===0&&(l=Pa),l}function al(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+qt-1,A=!0),(S===pt||g<pt&&S>pt||(S>pt||g<pt)&&A)&&S++,(S===gt||g<gt&&S>gt||(S>gt||g<gt)&&A)&&(S++,S===pt&&S++),S>Hr&&(S=S-Hr+qt-1),b>Ir?(b=b-Ir+qt-1,A=!0):A=!1,(b===pt||v<pt&&b>pt||(b>pt||v<pt)&&A)&&b++,(b===gt||v<gt&&b>gt||(b>gt||v<gt)&&A)&&(b++,b===pt&&b++),b>Ir&&(b=b-Ir+qt-1);var O=String.fromCharCode(S)+String.fromCharCode(b);return O}function ll(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=ul(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
|
|
94
|
+
`),Ae=tb.bind(null,{[n9]:"",[s9]:a,[a9]:Z,[o9]:uu,[Wf]:z,[l9]:q}),$e="";m!==null&&(S===void 0?$e=Ae(m):$e=Ae(Object.assign({},m,{name:S})));let ut=c instanceof Function?c:c?d9:vb,Wt=ut().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"`);Y7(R,x,T);let gi=f9(x,T);return Object.assign(e,{levels:gi,[pb]:T,[lb]:i,[ob]:ut,[ab]:Wt,[o9]:uu,[Wf]:z,[a9]:Z,[cb]:qe,[hb]:Se,[fb]:d,[db]:p,[yb]:p?`,${JSON.stringify(p)}:{`:"",[s9]:a,[mb]:w,[bb]:E,[n9]:$e,[l9]:q,[gb]:P,silent:ib}),Object.setPrototypeOf(e,J7()),X7(e),e[ub](R),e}gr.exports=qf;gr.exports.destination=(t=process.stdout.fd)=>typeof t=="object"?(t.dest=i9(t.dest||process.stdout.fd),r9(t)):r9({dest:i9(t),minLength:0});gr.exports.transport=Af();gr.exports.multistream=t9();gr.exports.levels=f9();gr.exports.stdSerializers=Eb;gr.exports.stdTimeFunctions=Object.assign({},c9);gr.exports.symbols=h9;gr.exports.version=nb;gr.exports.default=qf;gr.exports.pino=qf});var y9=V((lE,n1)=>{"use strict";var Rb=process.env.TERM_PROGRAM==="Hyper",Cb=process.platform==="win32",m9=process.platform==="linux",Vf={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"},p9=Object.assign({},Vf,{check:"\u221A",cross:"\xD7",ellipsisLarge:"...",ellipsis:"...",info:"i",question:"?",questionSmall:"?",pointer:">",pointerSmall:"\xBB",radioOff:"( )",radioOn:"(*)",warning:"\u203C"}),g9=Object.assign({},Vf,{ballotCross:"\u2718",check:"\u2714",cross:"\u2716",ellipsisLarge:"\u22EF",ellipsis:"\u2026",info:"\u2139",question:"?",questionFull:"\uFF1F",questionSmall:"\uFE56",pointer:m9?"\u25B8":"\u276F",pointerSmall:m9?"\u2023":"\u203A",radioOff:"\u25EF",radioOn:"\u25C9",warning:"\u26A0"});n1.exports=Cb&&!Rb?p9:g9;Reflect.defineProperty(n1.exports,"common",{enumerable:!1,value:Vf});Reflect.defineProperty(n1.exports,"windows",{enumerable:!1,value:p9});Reflect.defineProperty(n1.exports,"other",{enumerable:!1,value:g9})});var v9=V((uE,Kf)=>{"use strict";var Ab=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),Tb=/[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g,b9=()=>{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`,c=o.close=`\x1B[${o.codes[1]}m`,d=o.regex=new RegExp(`\\u001b\\[${o.codes[1]}m`,"g");return o.wrap=(p,m)=>{p.includes(c)&&(p=p.replace(d,c+a));let S=a+p+c;return m?S.replace(/\r*\n/g,`${c}$&${a}`):S},o},r=(o,a,c)=>typeof o=="function"?o(a):o.wrap(a,c),i=(o,a)=>{if(o===""||o==null)return"";if(t.enabled===!1)return o;if(t.visible===!1)return"";let c=""+o,d=c.includes(`
|
|
95
|
+
`),p=a.length;for(p>0&&a.includes("unstyle")&&(a=[...new Set(["unstyle",...a])].reverse());p-- >0;)c=r(t.styles[a[p]],c,d);return c},n=(o,a,c)=>{t.styles[o]=e({name:o,codes:a}),(t.keys[c]||(t.keys[c]=[])).push(o),Reflect.defineProperty(t,o,{configurable:!0,enumerable:!0,set(p){t.alias(o,p)},get(){let p=m=>i(m,p.stack);return Reflect.setPrototypeOf(p,t),p.stack=this.stack?this.stack.concat(o):[o],p}})};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=Tb,t.hasColor=t.hasAnsi=o=>(t.ansiRegex.lastIndex=0,typeof o=="string"&&o!==""&&t.ansiRegex.test(o)),t.alias=(o,a)=>{let c=typeof a=="string"?t[a]:a;if(typeof c!="function")throw new TypeError("Expected alias to be the name of an existing color (string) or a function");c.stack||(Reflect.defineProperty(c,"name",{value:o}),t.styles[o]=c,c.stack=[o]),Reflect.defineProperty(t,o,{configurable:!0,enumerable:!0,set(d){t.alias(o,d)},get(){let d=p=>i(p,d.stack);return Reflect.setPrototypeOf(d,t),d.stack=this.stack?this.stack.concat(c.stack):c.stack,d}})},t.theme=o=>{if(!Ab(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=y9(),t.define=n,t};Kf.exports=b9();Kf.exports.create=b9});var Jf=V((hE,w9)=>{w9.exports=require("stream")});var M9=V((fE,S9)=>{"use strict";function _9(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 Ib(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?_9(Object(r),!0).forEach(function(i){Ob(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):_9(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function Ob(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Lb(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function x9(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 kb(t,e,r){return e&&x9(t.prototype,e),r&&x9(t,r),t}var Nb=require("buffer"),cu=Nb.Buffer,Bb=require("util"),Zf=Bb.inspect,Db=Zf&&Zf.custom||"inspect";function zb(t,e,r){cu.prototype.copy.call(t,e,r)}S9.exports=function(){function t(){Lb(this,t),this.head=null,this.tail=null,this.length=0}return kb(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 cu.alloc(0);for(var i=cu.allocUnsafe(r>>>0),n=this.head,o=0;n;)zb(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,c=r>a.length?a.length:r;if(c===a.length?o+=a:o+=a.slice(0,r),r-=c,r===0){c===a.length?(++n,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=a.slice(c));break}++n}return this.length-=n,o}},{key:"_getBuffer",value:function(r){var i=cu.allocUnsafe(r),n=this.head,o=1;for(n.data.copy(i),r-=n.data.length;n=n.next;){var a=n.data,c=r>a.length?a.length:r;if(a.copy(i,i.length-r,0,c),r-=c,r===0){c===a.length?(++o,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=a.slice(c));break}++o}return this.length-=o,i}},{key:Db,value:function(r,i){return Zf(this,Ib({},i,{depth:0,customInspect:!1}))}}]),t}()});var Xf=V((dE,R9)=>{"use strict";function jb(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(Yf,this,t)):process.nextTick(Yf,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(hu,r):(r._writableState.errorEmitted=!0,process.nextTick(E9,r,o)):process.nextTick(E9,r,o):e?(process.nextTick(hu,r),e(o)):process.nextTick(hu,r)}),this)}function E9(t,e){Yf(t,e),hu(t)}function hu(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function Ub(){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 Yf(t,e){t.emit("error",e)}function $b(t,e){var r=t._readableState,i=t._writableState;r&&r.autoDestroy||i&&i.autoDestroy?t.destroy(e):t.emit("error",e)}R9.exports={destroy:jb,undestroy:Ub,errorOrDestroy:$b}});var fn=V((mE,T9)=>{"use strict";var A9={};function yr(t,e,r){r||(r=Error);function i(o,a,c){return typeof e=="string"?e:e(o,a,c)}class n extends r{constructor(a,c,d){super(i(a,c,d))}}n.prototype.name=r.name,n.prototype.code=t,A9[t]=n}function C9(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 Fb(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function Hb(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function Wb(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}yr("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);yr("ERR_INVALID_ARG_TYPE",function(t,e,r){let i;typeof e=="string"&&Fb(e,"not ")?(i="must not be",e=e.replace(/^not /,"")):i="must be";let n;if(Hb(t," argument"))n=`The ${t} ${i} ${C9(e,"type")}`;else{let o=Wb(t,".")?"property":"argument";n=`The "${t}" ${o} ${i} ${C9(e,"type")}`}return n+=`. Received type ${typeof r}`,n},TypeError);yr("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");yr("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});yr("ERR_STREAM_PREMATURE_CLOSE","Premature close");yr("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});yr("ERR_MULTIPLE_CALLBACK","Callback called multiple times");yr("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");yr("ERR_STREAM_WRITE_AFTER_END","write after end");yr("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);yr("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);yr("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");T9.exports.codes=A9});var Qf=V((pE,P9)=>{"use strict";var qb=fn().codes.ERR_INVALID_OPT_VALUE;function Gb(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function Vb(t,e,r,i){var n=Gb(e,i,r);if(n!=null){if(!(isFinite(n)&&Math.floor(n)===n)||n<0){var o=i?r:"highWaterMark";throw new qb(o,n)}return Math.floor(n)}return t.objectMode?16:16*1024}P9.exports={getHighWaterMark:Vb}});var I9=V((gE,e0)=>{typeof Object.create=="function"?e0.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e0.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((yE,r0)=>{try{if(t0=require("util"),typeof t0.inherits!="function")throw"";r0.exports=t0.inherits}catch{r0.exports=I9()}var t0});var L9=V((bE,O9)=>{O9.exports=require("util").deprecate});var s0=V((vE,j9)=>{"use strict";j9.exports=st;function N9(t){var e=this;this.next=null,this.entry=null,this.finish=function(){wv(e,t)}}var xo;st.WritableState=o1;var Kb={deprecate:L9()},B9=Jf(),du=require("buffer").Buffer,Jb=global.Uint8Array||function(){};function Zb(t){return du.from(t)}function Yb(t){return du.isBuffer(t)||t instanceof Jb}var n0=Xf(),Xb=Qf(),Qb=Xb.getHighWaterMark,dn=fn().codes,ev=dn.ERR_INVALID_ARG_TYPE,tv=dn.ERR_METHOD_NOT_IMPLEMENTED,rv=dn.ERR_MULTIPLE_CALLBACK,iv=dn.ERR_STREAM_CANNOT_PIPE,nv=dn.ERR_STREAM_DESTROYED,sv=dn.ERR_STREAM_NULL_VALUES,ov=dn.ERR_STREAM_WRITE_AFTER_END,av=dn.ERR_UNKNOWN_ENCODING,So=n0.errorOrDestroy;_o()(st,B9);function lv(){}function o1(t,e,r){xo=xo||os(),t=t||{},typeof r!="boolean"&&(r=e instanceof xo),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=Qb(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){pv(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 N9(this)}o1.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(o1.prototype,"buffer",{get:Kb.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var fu;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(fu=Function.prototype[Symbol.hasInstance],Object.defineProperty(st,Symbol.hasInstance,{value:function(e){return fu.call(this,e)?!0:this!==st?!1:e&&e._writableState instanceof o1}})):fu=function(e){return e instanceof this};function st(t){xo=xo||os();var e=this instanceof xo;if(!e&&!fu.call(st,this))return new st(t);this._writableState=new o1(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)),B9.call(this)}st.prototype.pipe=function(){So(this,new iv)};function uv(t,e){var r=new ov;So(t,r),process.nextTick(e,r)}function cv(t,e,r,i){var n;return r===null?n=new sv:typeof r!="string"&&!e.objectMode&&(n=new ev("chunk",["string","Buffer"],r)),n?(So(t,n),process.nextTick(i,n),!1):!0}st.prototype.write=function(t,e,r){var i=this._writableState,n=!1,o=!i.objectMode&&Yb(t);return o&&!du.isBuffer(t)&&(t=Zb(t)),typeof e=="function"&&(r=e,e=null),o?e="buffer":e||(e=i.defaultEncoding),typeof r!="function"&&(r=lv),i.ending?uv(this,r):(o||cv(this,i,t,r))&&(i.pendingcb++,n=fv(this,i,o,t,e,r)),n};st.prototype.cork=function(){this._writableState.corked++};st.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&D9(this,t))};st.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 av(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(st.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function hv(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=du.from(e,r)),e}Object.defineProperty(st.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function fv(t,e,r,i,n,o){if(!r){var a=hv(e,i,n);i!==a&&(r=!0,n="buffer",i=a)}var c=e.objectMode?1:i.length;e.length+=c;var d=e.length<e.highWaterMark;if(d||(e.needDrain=!0),e.writing||e.corked){var p=e.lastBufferedRequest;e.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:o,next:null},p?p.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else i0(t,e,!1,c,i,n,o);return d}function i0(t,e,r,i,n,o,a){e.writelen=i,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new nv("write")):r?t._writev(n,e.onwrite):t._write(n,o,e.onwrite),e.sync=!1}function dv(t,e,r,i,n){--e.pendingcb,r?(process.nextTick(n,i),process.nextTick(s1,t,e),t._writableState.errorEmitted=!0,So(t,i)):(n(i),t._writableState.errorEmitted=!0,So(t,i),s1(t,e))}function mv(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}function pv(t,e){var r=t._writableState,i=r.sync,n=r.writecb;if(typeof n!="function")throw new rv;if(mv(r),e)dv(t,r,i,e,n);else{var o=z9(r)||t.destroyed;!o&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&D9(t,r),i?process.nextTick(k9,t,r,o,n):k9(t,r,o,n)}}function k9(t,e,r,i){r||gv(t,e),e.pendingcb--,i(),s1(t,e)}function gv(t,e){e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}function D9(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,c=!0;r;)n[a]=r,r.isBuf||(c=!1),r=r.next,a+=1;n.allBuffers=c,i0(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 N9(e),e.bufferedRequestCount=0}else{for(;r;){var d=r.chunk,p=r.encoding,m=r.callback,S=e.objectMode?1:d.length;if(i0(t,e,!1,S,d,p,m),r=r.next,e.bufferedRequestCount--,e.writing)break}r===null&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}st.prototype._write=function(t,e,r){r(new tv("_write()"))};st.prototype._writev=null;st.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||vv(this,i,r),this};Object.defineProperty(st.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function z9(t){return t.ending&&t.length===0&&t.bufferedRequest===null&&!t.finished&&!t.writing}function yv(t,e){t._final(function(r){e.pendingcb--,r&&So(t,r),e.prefinished=!0,t.emit("prefinish"),s1(t,e)})}function bv(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.pendingcb++,e.finalCalled=!0,process.nextTick(yv,t,e)):(e.prefinished=!0,t.emit("prefinish")))}function s1(t,e){var r=z9(e);if(r&&(bv(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 vv(t,e,r){e.ending=!0,s1(t,e),r&&(e.finished?process.nextTick(r):t.once("finish",r)),e.ended=!0,t.writable=!1}function wv(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(st.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){!this._writableState||(this._writableState.destroyed=e)}});st.prototype.destroy=n0.destroy;st.prototype._undestroy=n0.undestroy;st.prototype._destroy=function(t,e){e(t)}});var os=V((wE,$9)=>{"use strict";var _v=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};$9.exports=ni;var U9=l0(),a0=s0();_o()(ni,U9);for(o0=_v(a0.prototype),mu=0;mu<o0.length;mu++)pu=o0[mu],ni.prototype[pu]||(ni.prototype[pu]=a0.prototype[pu]);var o0,pu,mu;function ni(t){if(!(this instanceof ni))return new ni(t);U9.call(this,t),a0.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",xv)))}Object.defineProperty(ni.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});Object.defineProperty(ni.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});Object.defineProperty(ni.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function xv(){this._writableState.ended||process.nextTick(Sv,this)}function Sv(t){t.end()}Object.defineProperty(ni.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 W9=V((u0,H9)=>{var gu=require("buffer"),si=gu.Buffer;function F9(t,e){for(var r in t)e[r]=t[r]}si.from&&si.alloc&&si.allocUnsafe&&si.allocUnsafeSlow?H9.exports=gu:(F9(gu,u0),u0.Buffer=as);function as(t,e,r){return si(t,e,r)}as.prototype=Object.create(si.prototype);F9(si,as);as.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return si(t,e,r)};as.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=si(t);return e!==void 0?typeof r=="string"?i.fill(e,r):i.fill(e):i.fill(0),i};as.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return si(t)};as.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return gu.SlowBuffer(t)}});var f0=V(G9=>{"use strict";var h0=W9().Buffer,q9=h0.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 Mv(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 Ev(t){var e=Mv(t);if(typeof e!="string"&&(h0.isEncoding===q9||!q9(t)))throw new Error("Unknown encoding: "+t);return e||t}G9.StringDecoder=a1;function a1(t){this.encoding=Ev(t);var e;switch(this.encoding){case"utf16le":this.text=Iv,this.end=Ov,e=4;break;case"utf8":this.fillLast=Av,e=4;break;case"base64":this.text=Lv,this.end=kv,e=3;break;default:this.write=Nv,this.end=Bv;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=h0.allocUnsafe(e)}a1.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||""};a1.prototype.end=Pv;a1.prototype.text=Tv;a1.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 c0(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function Rv(t,e,r){var i=e.length-1;if(i<r)return 0;var n=c0(e[i]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--i<r||n===-2?0:(n=c0(e[i]),n>=0?(n>0&&(t.lastNeed=n-2),n):--i<r||n===-2?0:(n=c0(e[i]),n>=0?(n>0&&(n===2?n=0:t.lastNeed=n-3),n):0))}function Cv(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 Av(t){var e=this.lastTotal-this.lastNeed,r=Cv(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 Tv(t,e){var r=Rv(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 Pv(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Iv(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 Ov(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 Lv(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 kv(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Nv(t){return t.toString(this.encoding)}function Bv(t){return t&&t.length?this.write(t):""}});var yu=V((xE,J9)=>{"use strict";var V9=fn().codes.ERR_STREAM_PREMATURE_CLOSE;function Dv(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 zv(){}function jv(t){return t.setHeader&&typeof t.abort=="function"}function K9(t,e,r){if(typeof e=="function")return K9(t,null,e);e||(e={}),r=Dv(r||zv);var i=e.readable||e.readable!==!1&&t.readable,n=e.writable||e.writable!==!1&&t.writable,o=function(){t.writable||c()},a=t._writableState&&t._writableState.finished,c=function(){n=!1,a=!0,i||r.call(t)},d=t._readableState&&t._readableState.endEmitted,p=function(){i=!1,d=!0,n||r.call(t)},m=function(w){r.call(t,w)},S=function(){var w;if(i&&!d)return(!t._readableState||!t._readableState.ended)&&(w=new V9),r.call(t,w);if(n&&!a)return(!t._writableState||!t._writableState.ended)&&(w=new V9),r.call(t,w)},R=function(){t.req.on("finish",c)};return jv(t)?(t.on("complete",c),t.on("abort",S),t.req?R():t.on("request",R)):n&&!t._writableState&&(t.on("end",o),t.on("close",o)),t.on("end",p),t.on("finish",c),e.error!==!1&&t.on("error",m),t.on("close",S),function(){t.removeListener("complete",c),t.removeListener("abort",S),t.removeListener("request",R),t.req&&t.req.removeListener("finish",c),t.removeListener("end",o),t.removeListener("close",o),t.removeListener("finish",c),t.removeListener("end",p),t.removeListener("error",m),t.removeListener("close",S)}}J9.exports=K9});var Y9=V((SE,Z9)=>{"use strict";var bu;function mn(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Uv=yu(),pn=Symbol("lastResolve"),ls=Symbol("lastReject"),l1=Symbol("error"),vu=Symbol("ended"),us=Symbol("lastPromise"),d0=Symbol("handlePromise"),cs=Symbol("stream");function gn(t,e){return{value:t,done:e}}function $v(t){var e=t[pn];if(e!==null){var r=t[cs].read();r!==null&&(t[us]=null,t[pn]=null,t[ls]=null,e(gn(r,!1)))}}function Fv(t){process.nextTick($v,t)}function Hv(t,e){return function(r,i){t.then(function(){if(e[vu]){r(gn(void 0,!0));return}e[d0](r,i)},i)}}var Wv=Object.getPrototypeOf(function(){}),qv=Object.setPrototypeOf((bu={get stream(){return this[cs]},next:function(){var e=this,r=this[l1];if(r!==null)return Promise.reject(r);if(this[vu])return Promise.resolve(gn(void 0,!0));if(this[cs].destroyed)return new Promise(function(a,c){process.nextTick(function(){e[l1]?c(e[l1]):a(gn(void 0,!0))})});var i=this[us],n;if(i)n=new Promise(Hv(i,this));else{var o=this[cs].read();if(o!==null)return Promise.resolve(gn(o,!1));n=new Promise(this[d0])}return this[us]=n,n}},mn(bu,Symbol.asyncIterator,function(){return this}),mn(bu,"return",function(){var e=this;return new Promise(function(r,i){e[cs].destroy(null,function(n){if(n){i(n);return}r(gn(void 0,!0))})})}),bu),Wv),Gv=function(e){var r,i=Object.create(qv,(r={},mn(r,cs,{value:e,writable:!0}),mn(r,pn,{value:null,writable:!0}),mn(r,ls,{value:null,writable:!0}),mn(r,l1,{value:null,writable:!0}),mn(r,vu,{value:e._readableState.endEmitted,writable:!0}),mn(r,d0,{value:function(o,a){var c=i[cs].read();c?(i[us]=null,i[pn]=null,i[ls]=null,o(gn(c,!1))):(i[pn]=o,i[ls]=a)},writable:!0}),r));return i[us]=null,Uv(e,function(n){if(n&&n.code!=="ERR_STREAM_PREMATURE_CLOSE"){var o=i[ls];o!==null&&(i[us]=null,i[pn]=null,i[ls]=null,o(n)),i[l1]=n;return}var a=i[pn];a!==null&&(i[us]=null,i[pn]=null,i[ls]=null,a(gn(void 0,!0))),i[vu]=!0}),e.on("readable",Fv.bind(null,i)),i};Z9.exports=Gv});var tm=V((ME,em)=>{"use strict";function X9(t,e,r,i,n,o,a){try{var c=t[o](a),d=c.value}catch(p){r(p);return}c.done?e(d):Promise.resolve(d).then(i,n)}function Vv(t){return function(){var e=this,r=arguments;return new Promise(function(i,n){var o=t.apply(e,r);function a(d){X9(o,i,n,a,c,"next",d)}function c(d){X9(o,i,n,a,c,"throw",d)}a(void 0)})}}function Q9(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 Kv(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Q9(Object(r),!0).forEach(function(i){Jv(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Q9(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function Jv(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Zv=fn().codes.ERR_INVALID_ARG_TYPE;function Yv(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 Zv("iterable",["Iterable"],e);var n=new t(Kv({objectMode:!0},r)),o=!1;n._read=function(){o||(o=!0,a())};function a(){return c.apply(this,arguments)}function c(){return c=Vv(function*(){try{var d=yield i.next(),p=d.value,m=d.done;m?n.push(null):n.push(yield p)?a():o=!1}catch(S){n.destroy(S)}}),c.apply(this,arguments)}return n}em.exports=Yv});var l0=V((RE,hm)=>{"use strict";hm.exports=Ie;var Mo;Ie.ReadableState=sm;var EE=require("events").EventEmitter,nm=function(e,r){return e.listeners(r).length},c1=Jf(),wu=require("buffer").Buffer,Xv=global.Uint8Array||function(){};function Qv(t){return wu.from(t)}function ew(t){return wu.isBuffer(t)||t instanceof Xv}var m0=require("util"),be;m0&&m0.debuglog?be=m0.debuglog("stream"):be=function(){};var tw=M9(),_0=Xf(),rw=Qf(),iw=rw.getHighWaterMark,_u=fn().codes,nw=_u.ERR_INVALID_ARG_TYPE,sw=_u.ERR_STREAM_PUSH_AFTER_EOF,ow=_u.ERR_METHOD_NOT_IMPLEMENTED,aw=_u.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Eo,p0,g0;_o()(Ie,c1);var u1=_0.errorOrDestroy,y0=["error","close","destroy","pause","resume"];function lw(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 sm(t,e,r){Mo=Mo||os(),t=t||{},typeof r!="boolean"&&(r=e instanceof Mo),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=iw(this,t,"readableHighWaterMark",r),this.buffer=new tw,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&&(Eo||(Eo=f0().StringDecoder),this.decoder=new Eo(t.encoding),this.encoding=t.encoding)}function Ie(t){if(Mo=Mo||os(),!(this instanceof Ie))return new Ie(t);var e=this instanceof Mo;this._readableState=new sm(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),c1.call(this)}Object.defineProperty(Ie.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){!this._readableState||(this._readableState.destroyed=e)}});Ie.prototype.destroy=_0.destroy;Ie.prototype._undestroy=_0.undestroy;Ie.prototype._destroy=function(t,e){e(t)};Ie.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=wu.from(t,e),e=""),i=!0),om(this,t,e,!1,i)};Ie.prototype.unshift=function(t){return om(this,t,null,!0,!1)};function om(t,e,r,i,n){be("readableAddChunk",e);var o=t._readableState;if(e===null)o.reading=!1,hw(t,o);else{var a;if(n||(a=uw(o,e)),a)u1(t,a);else if(o.objectMode||e&&e.length>0)if(typeof e!="string"&&!o.objectMode&&Object.getPrototypeOf(e)!==wu.prototype&&(e=Qv(e)),i)o.endEmitted?u1(t,new aw):b0(t,o,e,!0);else if(o.ended)u1(t,new sw);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||e.length!==0?b0(t,o,e,!1):w0(t,o)):b0(t,o,e,!1)}else i||(o.reading=!1,w0(t,o))}return!o.ended&&(o.length<o.highWaterMark||o.length===0)}function b0(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&&xu(t)),w0(t,e)}function uw(t,e){var r;return!ew(e)&&typeof e!="string"&&e!==void 0&&!t.objectMode&&(r=new nw("chunk",["string","Buffer","Uint8Array"],e)),r}Ie.prototype.isPaused=function(){return this._readableState.flowing===!1};Ie.prototype.setEncoding=function(t){Eo||(Eo=f0().StringDecoder);var e=new Eo(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 rm=1073741824;function cw(t){return t>=rm?t=rm:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function im(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=cw(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}Ie.prototype.read=function(t){be("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 be("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?v0(this):xu(this),null;if(t=im(t,e),t===0&&e.ended)return e.length===0&&v0(this),null;var i=e.needReadable;be("need readable",i),(e.length===0||e.length-t<e.highWaterMark)&&(i=!0,be("length less than watermark",i)),e.ended||e.reading?(i=!1,be("reading or ended",i)):i&&(be("do read"),e.reading=!0,e.sync=!0,e.length===0&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=im(r,e)));var n;return t>0?n=um(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&&v0(this)),n!==null&&this.emit("data",n),n};function hw(t,e){if(be("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?xu(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,am(t)))}}function xu(t){var e=t._readableState;be("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(be("emitReadable",e.flowing),e.emittedReadable=!0,process.nextTick(am,t))}function am(t){var e=t._readableState;be("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,x0(t)}function w0(t,e){e.readingMore||(e.readingMore=!0,process.nextTick(fw,t,e))}function fw(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){var r=e.length;if(be("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}Ie.prototype._read=function(t){u1(this,new ow("_read()"))};Ie.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,be("pipe count=%d opts=%j",i.pipesCount,e);var n=(!e||e.end!==!1)&&t!==process.stdout&&t!==process.stderr,o=n?c:E;i.endEmitted?process.nextTick(o):r.once("end",o),t.on("unpipe",a);function a(T,C){be("onunpipe"),T===r&&C&&C.hasUnpiped===!1&&(C.hasUnpiped=!0,m())}function c(){be("onend"),t.end()}var d=dw(r);t.on("drain",d);var p=!1;function m(){be("cleanup"),t.removeListener("close",x),t.removeListener("finish",w),t.removeListener("drain",d),t.removeListener("error",R),t.removeListener("unpipe",a),r.removeListener("end",c),r.removeListener("end",E),r.removeListener("data",S),p=!0,i.awaitDrain&&(!t._writableState||t._writableState.needDrain)&&d()}r.on("data",S);function S(T){be("ondata");var C=t.write(T);be("dest.write",C),C===!1&&((i.pipesCount===1&&i.pipes===t||i.pipesCount>1&&cm(i.pipes,t)!==-1)&&!p&&(be("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function R(T){be("onerror",T),E(),t.removeListener("error",R),nm(t,"error")===0&&u1(t,T)}lw(t,"error",R);function x(){t.removeListener("finish",w),E()}t.once("close",x);function w(){be("onfinish"),t.removeListener("close",x),E()}t.once("finish",w);function E(){be("unpipe"),r.unpipe(t)}return t.emit("pipe",r),i.flowing||(be("pipe resume"),r.resume()),t};function dw(t){return function(){var r=t._readableState;be("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&nm(t,"data")&&(r.flowing=!0,x0(t))}}Ie.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=cm(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)};Ie.prototype.on=function(t,e){var r=c1.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,be("on readable",i.length,i.reading),i.length?xu(this):i.reading||process.nextTick(mw,this)),r};Ie.prototype.addListener=Ie.prototype.on;Ie.prototype.removeListener=function(t,e){var r=c1.prototype.removeListener.call(this,t,e);return t==="readable"&&process.nextTick(lm,this),r};Ie.prototype.removeAllListeners=function(t){var e=c1.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&process.nextTick(lm,this),e};function lm(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 mw(t){be("readable nexttick read 0"),t.read(0)}Ie.prototype.resume=function(){var t=this._readableState;return t.flowing||(be("resume"),t.flowing=!t.readableListening,pw(this,t)),t.paused=!1,this};function pw(t,e){e.resumeScheduled||(e.resumeScheduled=!0,process.nextTick(gw,t,e))}function gw(t,e){be("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),x0(t),e.flowing&&!e.reading&&t.read(0)}Ie.prototype.pause=function(){return be("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(be("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function x0(t){var e=t._readableState;for(be("flow",e.flowing);e.flowing&&t.read()!==null;);}Ie.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;t.on("end",function(){if(be("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(be("wrapped data"),r.decoder&&(a=r.decoder.write(a)),!(r.objectMode&&a==null)&&!(!r.objectMode&&(!a||!a.length))){var c=e.push(a);c||(i=!0,t.pause())}});for(var n in t)this[n]===void 0&&typeof t[n]=="function"&&(this[n]=function(c){return function(){return t[c].apply(t,arguments)}}(n));for(var o=0;o<y0.length;o++)t.on(y0[o],this.emit.bind(this,y0[o]));return this._read=function(a){be("wrapped _read",a),i&&(i=!1,t.resume())},this};typeof Symbol=="function"&&(Ie.prototype[Symbol.asyncIterator]=function(){return p0===void 0&&(p0=Y9()),p0(this)});Object.defineProperty(Ie.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});Object.defineProperty(Ie.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}});Object.defineProperty(Ie.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}});Ie._fromList=um;Object.defineProperty(Ie.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function um(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 v0(t){var e=t._readableState;be("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,process.nextTick(yw,e,t))}function yw(t,e){if(be("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"&&(Ie.from=function(t,e){return g0===void 0&&(g0=tm()),g0(Ie,t,e)});function cm(t,e){for(var r=0,i=t.length;r<i;r++)if(t[r]===e)return r;return-1}});var S0=V((CE,dm)=>{"use strict";dm.exports=Ai;var Su=fn().codes,bw=Su.ERR_METHOD_NOT_IMPLEMENTED,vw=Su.ERR_MULTIPLE_CALLBACK,ww=Su.ERR_TRANSFORM_ALREADY_TRANSFORMING,_w=Su.ERR_TRANSFORM_WITH_LENGTH_0,Mu=os();_o()(Ai,Mu);function xw(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(i===null)return this.emit("error",new vw);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 Ai(t){if(!(this instanceof Ai))return new Ai(t);Mu.call(this,t),this._transformState={afterTransform:xw.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",Sw)}function Sw(){var t=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(e,r){fm(t,e,r)}):fm(this,null,null)}Ai.prototype.push=function(t,e){return this._transformState.needTransform=!1,Mu.prototype.push.call(this,t,e)};Ai.prototype._transform=function(t,e,r){r(new bw("_transform()"))};Ai.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)}};Ai.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};Ai.prototype._destroy=function(t,e){Mu.prototype._destroy.call(this,t,function(r){e(r)})};function fm(t,e,r){if(e)return t.emit("error",e);if(r!=null&&t.push(r),t._writableState.length)throw new _w;if(t._transformState.transforming)throw new ww;return t.push(null)}});var gm=V((AE,pm)=>{"use strict";pm.exports=h1;var mm=S0();_o()(h1,mm);function h1(t){if(!(this instanceof h1))return new h1(t);mm.call(this,t)}h1.prototype._transform=function(t,e,r){r(null,t)}});var _m=V((TE,wm)=>{"use strict";var M0;function Mw(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var vm=fn().codes,Ew=vm.ERR_MISSING_ARGS,Rw=vm.ERR_STREAM_DESTROYED;function ym(t){if(t)throw t}function Cw(t){return t.setHeader&&typeof t.abort=="function"}function Aw(t,e,r,i){i=Mw(i);var n=!1;t.on("close",function(){n=!0}),M0===void 0&&(M0=yu()),M0(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,Cw(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();i(a||new Rw("pipe"))}}}function bm(t){t()}function Tw(t,e){return t.pipe(e)}function Pw(t){return!t.length||typeof t[t.length-1]!="function"?ym:t.pop()}function Iw(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var i=Pw(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new Ew("streams");var n,o=e.map(function(a,c){var d=c<e.length-1,p=c>0;return Aw(a,d,p,function(m){n||(n=m),m&&o.forEach(bm),!d&&(o.forEach(bm),i(n))})});return e.reduce(Tw)}wm.exports=Iw});var xm=V((br,d1)=>{var f1=require("stream");process.env.READABLE_STREAM==="disable"&&f1?(d1.exports=f1.Readable,Object.assign(d1.exports,f1),d1.exports.Stream=f1):(br=d1.exports=l0(),br.Stream=f1||br,br.Readable=br,br.Writable=s0(),br.Duplex=os(),br.Transform=S0(),br.PassThrough=gm(),br.finished=yu(),br.pipeline=_m())});var Rm=V((PE,Em)=>{"use strict";var{Transform:Ow}=xm(),{StringDecoder:Lw}=require("string_decoder"),yn=Symbol("last"),Eu=Symbol("decoder");function kw(t,e,r){var i;if(this.overflow){var n=this[Eu].write(t);if(i=n.split(this.matcher),i.length===1)return r();i.shift(),this.overflow=!1}else this[yn]+=this[Eu].write(t),i=this[yn].split(this.matcher);this[yn]=i.pop();for(var o=0;o<i.length;o++)Mm(this,this.mapper(i[o]));if(this.overflow=this[yn].length>this.maxLength,this.overflow&&!this.skipOverflow)return r(new Error("maximum buffer reached"));r()}function Nw(t){this[yn]+=this[Eu].end(),this[yn]&&Mm(this,this.mapper(this[yn])),t()}function Mm(t,e){e!==void 0&&t.push(e)}function Sm(t){return t}function Bw(t,e,r){switch(t=t||/\r?\n/,e=e||Sm,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=Sm)}r=Object.assign({},r),r.transform=kw,r.flush=Nw,r.readableObjectMode=!0;let i=new Ow(r);return i[yn]="",i[Eu]=new Lw("utf8"),i.matcher=t,i.mapper=e,i.maxLength=r.maxLength,i.skipOverflow=r.skipOverflow,i.overflow=!1,i}Em.exports=Bw});var Ao=V((Cu,Pm)=>{(function(t,e){typeof Cu=="object"&&typeof Pm<"u"?e(Cu):typeof define=="function"&&define.amd?define(["exports"],e):e(t.ULID={})})(Cu,function(t){"use strict";function e(C){var P=new Error(C);return P.source="ulid",P}var r="0123456789ABCDEFGHJKMNPQRSTVWXYZ",i=r.length,n=Math.pow(2,48)-1,o=10,a=16;function c(C,P,L){return P>C.length-1?C:C.substr(0,P)+L+C.substr(P+1)}function d(C){for(var P=void 0,L=C.length,B=void 0,z=void 0,q=i-1;!P&&L-->=0;){if(B=C[L],z=r.indexOf(B),z===-1)throw e("incorrectly encoded string");if(z===q){C=c(C,L,r[0]);continue}P=c(C,L,r[z+1])}if(typeof P=="string")return P;throw e("cannot increment this string")}function p(C){var P=Math.floor(C()*i);return P===i&&(P=i-1),r.charAt(P)}function m(C,P){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 L=void 0,B="";P>0;P--)L=C%i,B=r.charAt(L)+B,C=(C-L)/i;return B}function S(C,P){for(var L="";C>0;C--)L=p(P)+L;return L}function R(C){if(C.length!==o+a)throw e("malformed ulid");var P=C.substr(0,o).split("").reverse().reduce(function(L,B,z){var q=r.indexOf(B);if(q===-1)throw e("invalid character found: "+B);return L+=q*Math.pow(i,z)},0);if(P>n)throw e("malformed ulid, timestamp too large");return P}function x(){var C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,P=arguments[1];P||(P=typeof window<"u"?window:null);var L=P&&(P.crypto||P.msCrypto);if(L)return function(){var z=new Uint8Array(1);return L.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(L){return isNaN(L)&&(L=Date.now()),m(L,o)+S(a,C)}}function E(C){C||(C=x());var P=0,L=void 0;return function(z){if(isNaN(z)&&(z=Date.now()),z<=P){var q=L=d(L);return m(P,o)+q}P=z;var Z=L=S(a,C);return m(z,o)+Z}}var T=w();t.replaceCharAt=c,t.incrementBase32=d,t.randomChar=p,t.encodeTime=m,t.encodeRandom=S,t.decodeTime=R,t.detectPrng=x,t.factory=w,t.monotonicFactory=E,t.ulid=T,Object.defineProperty(t,"__esModule",{value:!0})})});var Zm=V(Tu=>{"use strict";Object.defineProperty(Tu,"__esModule",{value:!0});Tu.Nztm2000Quad=void 0;Tu.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 Ym=V(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:!0});Pu.Nztm2000=void 0;Pu.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 Xm=V(Lo=>{"use strict";Object.defineProperty(Lo,"__esModule",{value:!0});Lo.Nztm2000=Lo.Nztm2000Quad=void 0;var e_=Zm();Object.defineProperty(Lo,"Nztm2000Quad",{enumerable:!0,get:function(){return e_.Nztm2000Quad}});var t_=Ym();Object.defineProperty(Lo,"Nztm2000",{enumerable:!0,get:function(){return t_.Nztm2000}})});var ep=V((RC,Qm)=>{"use strict";function s_(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,c=t.charAt(0),d=Math.log(a)/Math.log(256),p=Math.log(256)/Math.log(a);function m(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 P=(C-T)*p+1>>>0,L=new Uint8Array(P);T!==C;){for(var B=x[T],z=0,q=P-1;(B!==0||z<E)&&q!==-1;q--,z++)B+=256*L[q]>>>0,L[q]=B%a>>>0,B=B/a>>>0;if(B!==0)throw new Error("Non-zero carry");E=z,T++}for(var Z=P-E;Z!==P&&L[Z]===0;)Z++;for(var se=c.repeat(w);Z<P;++Z)se+=t.charAt(L[Z]);return se}function S(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]===c;)E++,w++;for(var C=(x.length-w)*d+1>>>0,P=new Uint8Array(C);x[w];){var L=e[x.charCodeAt(w)];if(L===255)return;for(var B=0,z=C-1;(L!==0||B<T)&&z!==-1;z--,B++)L+=a*P[z]>>>0,P[z]=L%256>>>0,L=L/256>>>0;if(L!==0)throw new Error("Non-zero carry");T=B,w++}for(var q=C-T;q!==C&&P[q]===0;)q++;for(var Z=new Uint8Array(E+(C-q)),se=E;q!==C;)Z[se++]=P[q++];return Z}function R(x){var w=S(x);if(w)return w;throw new Error("Non-base"+a+" character")}return{encode:m,decodeUnsafe:S,decode:R}}Qm.exports=s_});var ap=V((ju,op)=>{(function(t,e){typeof ju=="object"&&typeof op<"u"?e(ju):typeof define=="function"&&define.amd?define(["exports"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.WebStreamsPolyfill={}))})(ju,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,c=Promise,d=Promise.prototype.then,p=Promise.resolve.bind(c),m=Promise.reject.bind(c);function S(u){return new c(u)}function R(u){return p(u)}function x(u){return m(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 P(u,f,_){return w(u,f,_)}function L(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 q(u,f,_){try{return R(z(u,f,_))}catch(I){return x(I)}}let Z=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,I=_;_._elements.length===Z-1&&(I={_elements:[],_next:void 0}),_._elements.push(f),I!==_&&(this._back=I,_._next=I),++this._size}shift(){let f=this._front,_=f,I=this._cursor,N=I+1,U=f._elements,F=U[I];return N===Z&&(_=f._next,N=0),--this._size,this._cursor=N,f!==_&&(this._front=_),U[I]=void 0,F}forEach(f){let _=this._cursor,I=this._front,N=I._elements;for(;(_!==N.length||I._next!==void 0)&&!(_===N.length&&(I=I._next,N=I._elements,_=0,N.length===0));)f(N[_]),++_}peek(){let f=this._front,_=this._cursor;return f._elements[_]}}function Se(u,f){u._ownerReadableStream=f,f._reader=u,f._state==="readable"?ut(u):f._state==="closed"?gi(u):Wt(u,f._storedError)}function qe(u,f){let _=u._ownerReadableStream;return nr(_,f)}function Ae(u){u._ownerReadableStream._state==="readable"?xa(u,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):Jc(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 $e(u){return new TypeError("Cannot "+u+" a stream using a released reader")}function ut(u){u._closedPromise=S((f,_)=>{u._closedPromise_resolve=f,u._closedPromise_reject=_})}function Wt(u,f){ut(u),xa(u,f)}function gi(u){ut(u),Bn(u)}function xa(u,f){u._closedPromise_reject!==void 0&&(L(u._closedPromise),u._closedPromise_reject(f),u._closedPromise_resolve=void 0,u._closedPromise_reject=void 0)}function Jc(u,f){Wt(u,f)}function Bn(u){u._closedPromise_resolve!==void 0&&(u._closedPromise_resolve(void 0),u._closedPromise_resolve=void 0,u._closedPromise_reject=void 0)}let Sa=e("[[AbortSteps]]"),fr=e("[[ErrorSteps]]"),Ma=e("[[CancelSteps]]"),Bs=e("[[PullSteps]]"),yi=Number.isFinite||function(u){return typeof u=="number"&&isFinite(u)},Zc=Math.trunc||function(u){return u<0?Math.ceil(u):Math.floor(u)};function Yc(u){return typeof u=="object"||typeof u=="function"}function ht(u,f){if(u!==void 0&&!Yc(u))throw new TypeError(`${f} is not an object.`)}function rr(u,f){if(typeof u!="function")throw new TypeError(`${f} is not a function.`)}function Z1(u){return typeof u=="object"&&u!==null||typeof u=="function"}function mt(u,f){if(!Z1(u))throw new TypeError(`${f} is not an object.`)}function Or(u,f,_){if(u===void 0)throw new TypeError(`Parameter ${f} is required in '${_}'.`)}function Ea(u,f,_){if(u===void 0)throw new TypeError(`${f} is required in '${_}'.`)}function Ra(u){return Number(u)}function Y1(u){return u===0?0:u}function Xc(u){return Y1(Zc(u))}function X1(u,f){let I=Number.MAX_SAFE_INTEGER,N=Number(u);if(N=Y1(N),!yi(N))throw new TypeError(`${f} is not a finite number`);if(N=Xc(N),N<0||N>I)throw new TypeError(`${f} is outside the accepted range of ${0} to ${I}, inclusive`);return!yi(N)||N===0?0:N}function Ca(u,f){if(!Yr(u))throw new TypeError(`${f} is not a ReadableStream.`)}function Wi(u){return new Y(u)}function Q1(u,f){u._reader._readRequests.push(f)}function Ds(u,f,_){let N=u._reader._readRequests.shift();_?N._closeSteps():N._chunkSteps(f)}function It(u){return u._reader._readRequests.length}function qi(u){let f=u._reader;return!(f===void 0||!ct(f))}class Y{constructor(f){if(Or(f,1,"ReadableStreamDefaultReader"),Ca(f,"First parameter"),Xr(f))throw new TypeError("This stream has already been locked for exclusive reading by another reader");Se(this,f),this._readRequests=new se}get closed(){return ct(this)?this._closedPromise:x(zs("closed"))}cancel(f=void 0){return ct(this)?this._ownerReadableStream===void 0?x($e("cancel")):qe(this,f):x(zs("cancel"))}read(){if(!ct(this))return x(zs("read"));if(this._ownerReadableStream===void 0)return x($e("read from"));let f,_,I=S((U,F)=>{f=U,_=F});return Lr(this,{_chunkSteps:U=>f({value:U,done:!1}),_closeSteps:()=>f({value:void 0,done:!0}),_errorSteps:U=>_(U)}),I}releaseLock(){if(!ct(this))throw zs("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");Ae(this)}}}Object.defineProperties(Y.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Y.prototype,e.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});function ct(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_readRequests")?!1:u instanceof Y}function Lr(u,f){let _=u._ownerReadableStream;_._disturbed=!0,_._state==="closed"?f._closeSteps():_._state==="errored"?f._errorSteps(_._storedError):_._readableStreamController[Bs](f)}function zs(u){return new TypeError(`ReadableStreamDefaultReader.prototype.${u} can only be used on a ReadableStreamDefaultReader`)}let el=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class tl{constructor(f,_){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=f,this._preventCancel=_}next(){let f=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?P(this._ongoingPromise,f,f):f(),this._ongoingPromise}return(f){let _=()=>this._returnSteps(f);return this._ongoingPromise?P(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($e("iterate"));let _,I,N=S((F,te)=>{_=F,I=te});return Lr(f,{_chunkSteps:F=>{this._ongoingPromise=void 0,B(()=>_({value:F,done:!1}))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,Ae(f),_({value:void 0,done:!0})},_errorSteps:F=>{this._ongoingPromise=void 0,this._isFinished=!0,Ae(f),I(F)}}),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($e("finish iterating"));if(!this._preventCancel){let I=qe(_,f);return Ae(_),P(I,()=>({value:f,done:!0}))}return Ae(_),R({value:f,done:!0})}}let rl={next(){return il(this)?this._asyncIteratorImpl.next():x(Aa("next"))},return(u){return il(this)?this._asyncIteratorImpl.return(u):x(Aa("return"))}};el!==void 0&&Object.setPrototypeOf(rl,el);function Qc(u,f){let _=Wi(u),I=new tl(_,f),N=Object.create(rl);return N._asyncIteratorImpl=I,N}function il(u){if(!o(u)||!Object.prototype.hasOwnProperty.call(u,"_asyncIteratorImpl"))return!1;try{return u._asyncIteratorImpl instanceof tl}catch{return!1}}function Aa(u){return new TypeError(`ReadableStreamAsyncIterator.${u} can only be used on a ReadableSteamAsyncIterator`)}let nl=Number.isNaN||function(u){return u!==u};function Dn(u){return u.slice()}function sl(u,f,_,I,N){new Uint8Array(u).set(new Uint8Array(_,I,N),f)}function Ta(u){return u}function bi(u){return!1}function Pa(u,f,_){if(u.slice)return u.slice(f,_);let I=_-f,N=new ArrayBuffer(I);return sl(N,0,u,f,I),N}function eh(u){return!(typeof u!="number"||nl(u)||u<0)}function ol(u){let f=Pa(u.buffer,u.byteOffset,u.byteOffset+u.byteLength);return new Uint8Array(f)}function Ia(u){let f=u._queue.shift();return u._queueTotalSize-=f.size,u._queueTotalSize<0&&(u._queueTotalSize=0),f.value}function ue(u,f,_){if(!eh(_)||_===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");u._queue.push({value:f,size:_}),u._queueTotalSize+=_}function th(u){return u._queue.peek().value}function Gr(u){u._queue=new se,u._queueTotalSize=0}class zn{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!js(this))throw Gi("view");return this._view}respond(f){if(!js(this))throw Gi("respond");if(Or(f,1,"respond"),f=X1(f,"First parameter"),this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");bi(this._view.buffer),Un(this._associatedReadableByteStreamController,f)}respondWithNewView(f){if(!js(this))throw Gi("respondWithNewView");if(Or(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");bi(f.buffer),$n(this._associatedReadableByteStreamController,f)}}Object.defineProperties(zn.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(zn.prototype,e.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class Xe{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!vi(this))throw Vi("byobRequest");return Na(this)}get desiredSize(){if(!vi(this))throw Vi("desiredSize");return Ba(this)}close(){if(!vi(this))throw Vi("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`);Vr(this)}enqueue(f){if(!vi(this))throw Vi("enqueue");if(Or(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`);Hs(this,f)}error(f=void 0){if(!vi(this))throw Vi("error");qt(this,f)}[Ma](f){al(this),Gr(this);let _=this._cancelAlgorithm(f);return Fs(this),_}[Bs](f){let _=this._controlledReadableByteStream;if(this._queueTotalSize>0){let N=this._queue.shift();this._queueTotalSize-=N.byteLength,ul(this);let U=new Uint8Array(N.buffer,N.byteOffset,N.byteLength);f._chunkSteps(U);return}let I=this._autoAllocateChunkSize;if(I!==void 0){let N;try{N=new ArrayBuffer(I)}catch(F){f._errorSteps(F);return}let U={buffer:N,bufferByteLength:I,byteOffset:0,byteLength:I,bytesFilled:0,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(U)}Q1(_,f),wi(this)}}Object.defineProperties(Xe.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Xe.prototype,e.toStringTag,{value:"ReadableByteStreamController",configurable:!0});function vi(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_controlledReadableByteStream")?!1:u instanceof Xe}function js(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_associatedReadableByteStreamController")?!1:u instanceof zn}function wi(u){if(!nh(u))return;if(u._pulling){u._pullAgain=!0;return}u._pulling=!0;let _=u._pullAlgorithm();E(_,()=>{u._pulling=!1,u._pullAgain&&(u._pullAgain=!1,wi(u))},I=>{qt(u,I)})}function al(u){La(u),u._pendingPullIntos=new se}function Oa(u,f){let _=!1;u._state==="closed"&&(_=!0);let I=_i(f);f.readerType==="default"?Ds(u,I,_):Ot(u,I,_)}function _i(u){let f=u.bytesFilled,_=u.elementSize;return new u.viewConstructor(u.buffer,u.byteOffset,f/_)}function Us(u,f,_,I){u._queue.push({buffer:f,byteOffset:_,byteLength:I}),u._queueTotalSize+=I}function ll(u,f){let _=f.elementSize,I=f.bytesFilled-f.bytesFilled%_,N=Math.min(u._queueTotalSize,f.byteLength-f.bytesFilled),U=f.bytesFilled+N,F=U-U%_,te=N,fe=!1;F>I&&(te=F-f.bytesFilled,fe=!0);let we=u._queue;for(;te>0;){let Te=we.peek(),Pe=Math.min(te,Te.byteLength),it=f.byteOffset+f.bytesFilled;sl(f.buffer,it,Te.buffer,Te.byteOffset,Pe),Te.byteLength===Pe?we.shift():(Te.byteOffset+=Pe,Te.byteLength-=Pe),u._queueTotalSize-=Pe,$s(u,Pe,f),te-=Pe}return fe}function $s(u,f,_){_.bytesFilled+=f}function ul(u){u._queueTotalSize===0&&u._closeRequested?(Fs(u),Yn(u._controlledReadableByteStream)):wi(u)}function La(u){u._byobRequest!==null&&(u._byobRequest._associatedReadableByteStreamController=void 0,u._byobRequest._view=null,u._byobRequest=null)}function cl(u){for(;u._pendingPullIntos.length>0;){if(u._queueTotalSize===0)return;let f=u._pendingPullIntos.peek();ll(u,f)&&(jn(u),Oa(u._controlledReadableByteStream,f))}}function rh(u,f,_){let I=u._controlledReadableByteStream,N=1;f.constructor!==DataView&&(N=f.constructor.BYTES_PER_ELEMENT);let U=f.constructor,F=f.buffer,te={buffer:F,bufferByteLength:F.byteLength,byteOffset:f.byteOffset,byteLength:f.byteLength,bytesFilled:0,elementSize:N,viewConstructor:U,readerType:"byob"};if(u._pendingPullIntos.length>0){u._pendingPullIntos.push(te),Da(I,_);return}if(I._state==="closed"){let fe=new U(te.buffer,te.byteOffset,0);_._closeSteps(fe);return}if(u._queueTotalSize>0){if(ll(u,te)){let fe=_i(te);ul(u),_._chunkSteps(fe);return}if(u._closeRequested){let fe=new TypeError("Insufficient bytes to fill elements in the given buffer");qt(u,fe),_._errorSteps(fe);return}}u._pendingPullIntos.push(te),Da(I,_),wi(u)}function dr(u,f){let _=u._controlledReadableByteStream;if(qs(_))for(;za(_)>0;){let I=jn(u);Oa(_,I)}}function ih(u,f,_){if($s(u,f,_),_.bytesFilled<_.elementSize)return;jn(u);let I=_.bytesFilled%_.elementSize;if(I>0){let N=_.byteOffset+_.bytesFilled,U=Pa(_.buffer,N-I,N);Us(u,U,0,U.byteLength)}_.bytesFilled-=I,Oa(u._controlledReadableByteStream,_),cl(u)}function ka(u,f){let _=u._pendingPullIntos.peek();La(u),u._controlledReadableByteStream._state==="closed"?dr(u):ih(u,f,_),wi(u)}function jn(u){return u._pendingPullIntos.shift()}function nh(u){let f=u._controlledReadableByteStream;return f._state!=="readable"||u._closeRequested||!u._started?!1:!!(qi(f)&&It(f)>0||qs(f)&&za(f)>0||Ba(u)>0)}function Fs(u){u._pullAlgorithm=void 0,u._cancelAlgorithm=void 0}function Vr(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 I=new TypeError("Insufficient bytes to fill elements in the given buffer");throw qt(u,I),I}Fs(u),Yn(f)}}function Hs(u,f){let _=u._controlledReadableByteStream;if(u._closeRequested||_._state!=="readable")return;let I=f.buffer,N=f.byteOffset,U=f.byteLength,F=I;if(u._pendingPullIntos.length>0){let te=u._pendingPullIntos.peek();bi(te.buffer),te.buffer=te.buffer}if(La(u),qi(_))if(It(_)===0)Us(u,F,N,U);else{u._pendingPullIntos.length>0&&jn(u);let te=new Uint8Array(F,N,U);Ds(_,te,!1)}else qs(_)?(Us(u,F,N,U),cl(u)):Us(u,F,N,U);wi(u)}function qt(u,f){let _=u._controlledReadableByteStream;_._state==="readable"&&(al(u),Gr(u),Fs(u),kl(_,f))}function Na(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),I=Object.create(zn.prototype);sh(I,u,_),u._byobRequest=I}return u._byobRequest}function Ba(u){let f=u._controlledReadableByteStream._state;return f==="errored"?null:f==="closed"?0:u._strategyHWM-u._queueTotalSize}function Un(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,ka(u,f)}function $n(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,ka(u,N)}function hl(u,f,_,I,N,U,F){f._controlledReadableByteStream=u,f._pullAgain=!1,f._pulling=!1,f._byobRequest=null,f._queue=f._queueTotalSize=void 0,Gr(f),f._closeRequested=!1,f._started=!1,f._strategyHWM=U,f._pullAlgorithm=I,f._cancelAlgorithm=N,f._autoAllocateChunkSize=F,f._pendingPullIntos=new se,u._readableStreamController=f;let te=_();E(R(te),()=>{f._started=!0,wi(f)},fe=>{qt(f,fe)})}function fl(u,f,_){let I=Object.create(Xe.prototype),N=()=>{},U=()=>R(void 0),F=()=>R(void 0);f.start!==void 0&&(N=()=>f.start(I)),f.pull!==void 0&&(U=()=>f.pull(I)),f.cancel!==void 0&&(F=fe=>f.cancel(fe));let te=f.autoAllocateChunkSize;if(te===0)throw new TypeError("autoAllocateChunkSize must be greater than 0");hl(u,I,N,U,F,_,te)}function sh(u,f,_){u._associatedReadableByteStreamController=f,u._view=_}function Gi(u){return new TypeError(`ReadableStreamBYOBRequest.prototype.${u} can only be used on a ReadableStreamBYOBRequest`)}function Vi(u){return new TypeError(`ReadableByteStreamController.prototype.${u} can only be used on a ReadableByteStreamController`)}function Ws(u){return new Ki(u)}function Da(u,f){u._reader._readIntoRequests.push(f)}function Ot(u,f,_){let N=u._reader._readIntoRequests.shift();_?N._closeSteps(f):N._chunkSteps(f)}function za(u){return u._reader._readIntoRequests.length}function qs(u){let f=u._reader;return!(f===void 0||!Gt(f))}class Ki{constructor(f){if(Or(f,1,"ReadableStreamBYOBReader"),Ca(f,"First parameter"),Xr(f))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!vi(f._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");Se(this,f),this._readIntoRequests=new se}get closed(){return Gt(this)?this._closedPromise:x(bt("closed"))}cancel(f=void 0){return Gt(this)?this._ownerReadableStream===void 0?x($e("cancel")):qe(this,f):x(bt("cancel"))}read(f){if(!Gt(this))return x(bt("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(bi(f.buffer),this._ownerReadableStream===void 0)return x($e("read from"));let _,I,N=S((F,te)=>{_=F,I=te});return yt(this,f,{_chunkSteps:F=>_({value:F,done:!1}),_closeSteps:F=>_({value:F,done:!0}),_errorSteps:F=>I(F)}),N}releaseLock(){if(!Gt(this))throw bt("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");Ae(this)}}}Object.defineProperties(Ki.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Ki.prototype,e.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});function Gt(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_readIntoRequests")?!1:u instanceof Ki}function yt(u,f,_){let I=u._ownerReadableStream;I._disturbed=!0,I._state==="errored"?_._errorSteps(I._storedError):rh(I._readableStreamController,f,_)}function bt(u){return new TypeError(`ReadableStreamBYOBReader.prototype.${u} can only be used on a ReadableStreamBYOBReader`)}function kr(u,f){let{highWaterMark:_}=u;if(_===void 0)return f;if(nl(_)||_<0)throw new RangeError("Invalid highWaterMark");return _}function Kr(u){let{size:f}=u;return f||(()=>1)}function Gs(u,f){ht(u,f);let _=u?.highWaterMark,I=u?.size;return{highWaterMark:_===void 0?void 0:Ra(_),size:I===void 0?void 0:dl(I,`${f} has member 'size' that`)}}function dl(u,f){return rr(u,f),_=>Ra(u(_))}function oh(u,f){ht(u,f);let _=u?.abort,I=u?.close,N=u?.start,U=u?.type,F=u?.write;return{abort:_===void 0?void 0:ml(_,u,`${f} has member 'abort' that`),close:I===void 0?void 0:ja(I,u,`${f} has member 'close' that`),start:N===void 0?void 0:pl(N,u,`${f} has member 'start' that`),write:F===void 0?void 0:ah(F,u,`${f} has member 'write' that`),type:U}}function ml(u,f,_){return rr(u,_),I=>q(u,f,[I])}function ja(u,f,_){return rr(u,_),()=>q(u,f,[])}function pl(u,f,_){return rr(u,_),I=>z(u,f,[I])}function ah(u,f,_){return rr(u,_),(I,N)=>q(u,f,[I,N])}function Vs(u,f){if(!Zi(u))throw new TypeError(`${f} is not a WritableStream.`)}function lh(u){if(typeof u!="object"||u===null)return!1;try{return typeof u.aborted=="boolean"}catch{return!1}}let uh=typeof AbortController=="function";function ch(){if(uh)return new AbortController}class Ji{constructor(f={},_={}){f===void 0?f=null:mt(f,"First parameter");let I=Gs(_,"Second parameter"),N=oh(f,"First parameter");if(bl(this),N.type!==void 0)throw new RangeError("Invalid type is specified");let F=Kr(I),te=kr(I,1);wh(this,N,te,F)}get locked(){if(!Zi(this))throw to("locked");return Yi(this)}abort(f=void 0){return Zi(this)?Yi(this)?x(new TypeError("Cannot abort a stream that already has a writer")):Nr(this,f):x(to("abort"))}close(){return Zi(this)?Yi(this)?x(new TypeError("Cannot close a stream that already has a writer")):mr(this)?x(new TypeError("Cannot close an already-closing stream")):vl(this):x(to("close"))}getWriter(){if(!Zi(this))throw to("getWriter");return gl(this)}}Object.defineProperties(Ji.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Ji.prototype,e.toStringTag,{value:"WritableStream",configurable:!0});function gl(u){return new Xi(u)}function yl(u,f,_,I,N=1,U=()=>1){let F=Object.create(Ji.prototype);bl(F);let te=Object.create(Qi.prototype);return Ha(F,te,u,f,_,I,N,U),F}function bl(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 Zi(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_writableStreamController")?!1:u instanceof Ji}function Yi(u){return u._writer!==void 0}function Nr(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 I=u._state;if(I==="closed"||I==="errored")return R(void 0);if(u._pendingAbortRequest!==void 0)return u._pendingAbortRequest._promise;let N=!1;I==="erroring"&&(N=!0,f=void 0);let U=S((F,te)=>{u._pendingAbortRequest={_promise:void 0,_resolve:F,_reject:te,_reason:f,_wasAlreadyErroring:N}});return u._pendingAbortRequest._promise=U,N||Js(u,f),U}function vl(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 _=S((N,U)=>{let F={_resolve:N,_reject:U};u._closeRequest=F}),I=u._writer;return I!==void 0&&u._backpressure&&f==="writable"&&Ka(I),_h(u._writableStreamController),_}function hh(u){return S((_,I)=>{let N={_resolve:_,_reject:I};u._writeRequests.push(N)})}function Ks(u,f){if(u._state==="writable"){Js(u,f);return}Zs(u)}function Js(u,f){let _=u._writableStreamController;u._state="erroring",u._storedError=f;let I=u._writer;I!==void 0&&$a(I,f),!gh(u)&&_._started&&Zs(u)}function Zs(u){u._state="errored",u._writableStreamController[fr]();let f=u._storedError;if(u._writeRequests.forEach(N=>{N._reject(f)}),u._writeRequests=new se,u._pendingAbortRequest===void 0){xi(u);return}let _=u._pendingAbortRequest;if(u._pendingAbortRequest=void 0,_._wasAlreadyErroring){_._reject(f),xi(u);return}let I=u._writableStreamController[Sa](_._reason);E(I,()=>{_._resolve(),xi(u)},N=>{_._reject(N),xi(u)})}function fh(u){u._inFlightWriteRequest._resolve(void 0),u._inFlightWriteRequest=void 0}function dh(u,f){u._inFlightWriteRequest._reject(f),u._inFlightWriteRequest=void 0,Ks(u,f)}function mh(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&&Rl(_)}function ph(u,f){u._inFlightCloseRequest._reject(f),u._inFlightCloseRequest=void 0,u._pendingAbortRequest!==void 0&&(u._pendingAbortRequest._reject(f),u._pendingAbortRequest=void 0),Ks(u,f)}function mr(u){return!(u._closeRequest===void 0&&u._inFlightCloseRequest===void 0)}function gh(u){return!(u._inFlightWriteRequest===void 0&&u._inFlightCloseRequest===void 0)}function yh(u){u._inFlightCloseRequest=u._closeRequest,u._closeRequest=void 0}function wl(u){u._inFlightWriteRequest=u._writeRequests.shift()}function xi(u){u._closeRequest!==void 0&&(u._closeRequest._reject(u._storedError),u._closeRequest=void 0);let f=u._writer;f!==void 0&&Ga(f,u._storedError)}function Ua(u,f){let _=u._writer;_!==void 0&&f!==u._backpressure&&(f?Ah(_):Ka(_)),u._backpressure=f}class Xi{constructor(f){if(Or(f,1,"WritableStreamDefaultWriter"),Vs(f,"First parameter"),Yi(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")!mr(f)&&f._backpressure?ro(this):Cl(this),en(this);else if(_==="erroring")Va(this,f._storedError),en(this);else if(_==="closed")Cl(this),Rh(this);else{let I=f._storedError;Va(this,I),El(this,I)}}get closed(){return Si(this)?this._closedPromise:x(Mi("closed"))}get desiredSize(){if(!Si(this))throw Mi("desiredSize");if(this._ownerWritableStream===void 0)throw Wn("desiredSize");return ir(this)}get ready(){return Si(this)?this._readyPromise:x(Mi("ready"))}abort(f=void 0){return Si(this)?this._ownerWritableStream===void 0?x(Wn("abort")):bh(this,f):x(Mi("abort"))}close(){if(!Si(this))return x(Mi("close"));let f=this._ownerWritableStream;return f===void 0?x(Wn("close")):mr(f)?x(new TypeError("Cannot close an already-closing stream")):_l(this)}releaseLock(){if(!Si(this))throw Mi("releaseLock");this._ownerWritableStream!==void 0&&xl(this)}write(f=void 0){return Si(this)?this._ownerWritableStream===void 0?x(Wn("write to")):Sl(this,f):x(Mi("write"))}}Object.defineProperties(Xi.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(Xi.prototype,e.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});function Si(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_ownerWritableStream")?!1:u instanceof Xi}function bh(u,f){let _=u._ownerWritableStream;return Nr(_,f)}function _l(u){let f=u._ownerWritableStream;return vl(f)}function vh(u){let f=u._ownerWritableStream,_=f._state;return mr(f)||_==="closed"?R(void 0):_==="errored"?x(f._storedError):_l(u)}function Ys(u,f){u._closedPromiseState==="pending"?Ga(u,f):Ch(u,f)}function $a(u,f){u._readyPromiseState==="pending"?Al(u,f):Th(u,f)}function ir(u){let f=u._ownerWritableStream,_=f._state;return _==="errored"||_==="erroring"?null:_==="closed"?0:Fn(f._writableStreamController)}function xl(u){let f=u._ownerWritableStream,_=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");$a(u,_),Ys(u,_),f._writer=void 0,u._ownerWritableStream=void 0}function Sl(u,f){let _=u._ownerWritableStream,I=_._writableStreamController,N=xh(I,f);if(_!==u._ownerWritableStream)return x(Wn("write to"));let U=_._state;if(U==="errored")return x(_._storedError);if(mr(_)||U==="closed")return x(new TypeError("The stream is closing or closed and cannot be written to"));if(U==="erroring")return x(_._storedError);let F=hh(_);return Sh(I,f,N),F}let Xs={};class Qi{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!Fa(this))throw qa("abortReason");return this._abortReason}get signal(){if(!Fa(this))throw qa("signal");if(this._abortController===void 0)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(f=void 0){if(!Fa(this))throw qa("error");this._controlledWritableStream._state==="writable"&&Ml(this,f)}[Sa](f){let _=this._abortAlgorithm(f);return Qs(this),_}[fr](){Gr(this)}}Object.defineProperties(Qi.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Qi.prototype,e.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});function Fa(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_controlledWritableStream")?!1:u instanceof Qi}function Ha(u,f,_,I,N,U,F,te){f._controlledWritableStream=u,u._writableStreamController=f,f._queue=void 0,f._queueTotalSize=void 0,Gr(f),f._abortReason=void 0,f._abortController=ch(),f._started=!1,f._strategySizeAlgorithm=te,f._strategyHWM=F,f._writeAlgorithm=I,f._closeAlgorithm=N,f._abortAlgorithm=U;let fe=Hn(f);Ua(u,fe);let we=_(),Te=R(we);E(Te,()=>{f._started=!0,eo(f)},Pe=>{f._started=!0,Ks(u,Pe)})}function wh(u,f,_,I){let N=Object.create(Qi.prototype),U=()=>{},F=()=>R(void 0),te=()=>R(void 0),fe=()=>R(void 0);f.start!==void 0&&(U=()=>f.start(N)),f.write!==void 0&&(F=we=>f.write(we,N)),f.close!==void 0&&(te=()=>f.close()),f.abort!==void 0&&(fe=we=>f.abort(we)),Ha(u,N,U,F,te,fe,_,I)}function Qs(u){u._writeAlgorithm=void 0,u._closeAlgorithm=void 0,u._abortAlgorithm=void 0,u._strategySizeAlgorithm=void 0}function _h(u){ue(u,Xs,0),eo(u)}function xh(u,f){try{return u._strategySizeAlgorithm(f)}catch(_){return Wa(u,_),1}}function Fn(u){return u._strategyHWM-u._queueTotalSize}function Sh(u,f,_){try{ue(u,f,_)}catch(N){Wa(u,N);return}let I=u._controlledWritableStream;if(!mr(I)&&I._state==="writable"){let N=Hn(u);Ua(I,N)}eo(u)}function eo(u){let f=u._controlledWritableStream;if(!u._started||f._inFlightWriteRequest!==void 0)return;if(f._state==="erroring"){Zs(f);return}if(u._queue.length===0)return;let I=th(u);I===Xs?Mh(u):Eh(u,I)}function Wa(u,f){u._controlledWritableStream._state==="writable"&&Ml(u,f)}function Mh(u){let f=u._controlledWritableStream;yh(f),Ia(u);let _=u._closeAlgorithm();Qs(u),E(_,()=>{mh(f)},I=>{ph(f,I)})}function Eh(u,f){let _=u._controlledWritableStream;wl(_);let I=u._writeAlgorithm(f);E(I,()=>{fh(_);let N=_._state;if(Ia(u),!mr(_)&&N==="writable"){let U=Hn(u);Ua(_,U)}eo(u)},N=>{_._state==="writable"&&Qs(u),dh(_,N)})}function Hn(u){return Fn(u)<=0}function Ml(u,f){let _=u._controlledWritableStream;Qs(u),Js(_,f)}function to(u){return new TypeError(`WritableStream.prototype.${u} can only be used on a WritableStream`)}function qa(u){return new TypeError(`WritableStreamDefaultController.prototype.${u} can only be used on a WritableStreamDefaultController`)}function Mi(u){return new TypeError(`WritableStreamDefaultWriter.prototype.${u} can only be used on a WritableStreamDefaultWriter`)}function Wn(u){return new TypeError("Cannot "+u+" a stream using a released writer")}function en(u){u._closedPromise=S((f,_)=>{u._closedPromise_resolve=f,u._closedPromise_reject=_,u._closedPromiseState="pending"})}function El(u,f){en(u),Ga(u,f)}function Rh(u){en(u),Rl(u)}function Ga(u,f){u._closedPromise_reject!==void 0&&(L(u._closedPromise),u._closedPromise_reject(f),u._closedPromise_resolve=void 0,u._closedPromise_reject=void 0,u._closedPromiseState="rejected")}function Ch(u,f){El(u,f)}function Rl(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 ro(u){u._readyPromise=S((f,_)=>{u._readyPromise_resolve=f,u._readyPromise_reject=_}),u._readyPromiseState="pending"}function Va(u,f){ro(u),Al(u,f)}function Cl(u){ro(u),Ka(u)}function Al(u,f){u._readyPromise_reject!==void 0&&(L(u._readyPromise),u._readyPromise_reject(f),u._readyPromise_resolve=void 0,u._readyPromise_reject=void 0,u._readyPromiseState="rejected")}function Ah(u){ro(u)}function Th(u,f){Va(u,f)}function Ka(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 Tl=typeof DOMException<"u"?DOMException:void 0;function Ph(u){if(!(typeof u=="function"||typeof u=="object"))return!1;try{return new u,!0}catch{return!1}}function Ih(){let u=function(_,I){this.message=_||"",this.name=I||"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 Oh=Ph(Tl)?Tl:Ih();function Ei(u,f,_,I,N,U){let F=Wi(u),te=gl(f);u._disturbed=!0;let fe=!1,we=R(void 0);return S((Te,Pe)=>{let it;if(U!==void 0){if(it=()=>{let ne=new Oh("Aborted","AbortError"),ge=[];I||ge.push(()=>f._state==="writable"?Nr(f,ne):R(void 0)),N||ge.push(()=>u._state==="readable"?nr(u,ne):R(void 0)),St(()=>Promise.all(ge.map(Ve=>Ve())),!0,ne)},U.aborted){it();return}U.addEventListener("abort",it)}function sr(){return S((ne,ge)=>{function Ve(Lt){Lt?ne():w(on(),Ve,ge)}Ve(!1)})}function on(){return fe?R(!0):w(te._readyPromise,()=>S((ne,ge)=>{Lr(F,{_chunkSteps:Ve=>{we=w(Sl(te,Ve),void 0,r),ne(!1)},_closeSteps:()=>ne(!0),_errorSteps:ge})}))}if(Br(u,F._closedPromise,ne=>{I?Vt(!0,ne):St(()=>Nr(f,ne),!0,ne)}),Br(f,te._closedPromise,ne=>{N?Vt(!0,ne):St(()=>nr(u,ne),!0,ne)}),wt(u,F._closedPromise,()=>{_?Vt():St(()=>vh(te))}),mr(f)||f._state==="closed"){let ne=new TypeError("the destination writable stream closed before all data could be piped to it");N?Vt(!0,ne):St(()=>nr(u,ne),!0,ne)}L(sr());function ei(){let ne=we;return w(we,()=>ne!==we?ei():void 0)}function Br(ne,ge,Ve){ne._state==="errored"?Ve(ne._storedError):C(ge,Ve)}function wt(ne,ge,Ve){ne._state==="closed"?Ve():T(ge,Ve)}function St(ne,ge,Ve){if(fe)return;fe=!0,f._state==="writable"&&!mr(f)?T(ei(),Lt):Lt();function Lt(){E(ne(),()=>Dr(ge,Ve),an=>Dr(!0,an))}}function Vt(ne,ge){fe||(fe=!0,f._state==="writable"&&!mr(f)?T(ei(),()=>Dr(ne,ge)):Dr(ne,ge))}function Dr(ne,ge){xl(te),Ae(F),U!==void 0&&U.removeEventListener("abort",it),ne?Pe(ge):Te(void 0)}})}class tn{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!io(this))throw oo("desiredSize");return Ja(this)}close(){if(!io(this))throw oo("close");if(!rn(this))throw new TypeError("The stream is not in a state that permits close");Gn(this)}enqueue(f=void 0){if(!io(this))throw oo("enqueue");if(!rn(this))throw new TypeError("The stream is not in a state that permits enqueue");return so(this,f)}error(f=void 0){if(!io(this))throw oo("error");Jr(this,f)}[Ma](f){Gr(this);let _=this._cancelAlgorithm(f);return no(this),_}[Bs](f){let _=this._controlledReadableStream;if(this._queue.length>0){let I=Ia(this);this._closeRequested&&this._queue.length===0?(no(this),Yn(_)):qn(this),f._chunkSteps(I)}else Q1(_,f),qn(this)}}Object.defineProperties(tn.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(tn.prototype,e.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});function io(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_controlledReadableStream")?!1:u instanceof tn}function qn(u){if(!Pl(u))return;if(u._pulling){u._pullAgain=!0;return}u._pulling=!0;let _=u._pullAlgorithm();E(_,()=>{u._pulling=!1,u._pullAgain&&(u._pullAgain=!1,qn(u))},I=>{Jr(u,I)})}function Pl(u){let f=u._controlledReadableStream;return!rn(u)||!u._started?!1:!!(Xr(f)&&It(f)>0||Ja(u)>0)}function no(u){u._pullAlgorithm=void 0,u._cancelAlgorithm=void 0,u._strategySizeAlgorithm=void 0}function Gn(u){if(!rn(u))return;let f=u._controlledReadableStream;u._closeRequested=!0,u._queue.length===0&&(no(u),Yn(f))}function so(u,f){if(!rn(u))return;let _=u._controlledReadableStream;if(Xr(_)&&It(_)>0)Ds(_,f,!1);else{let I;try{I=u._strategySizeAlgorithm(f)}catch(N){throw Jr(u,N),N}try{ue(u,f,I)}catch(N){throw Jr(u,N),N}}qn(u)}function Jr(u,f){let _=u._controlledReadableStream;_._state==="readable"&&(Gr(u),no(u),kl(_,f))}function Ja(u){let f=u._controlledReadableStream._state;return f==="errored"?null:f==="closed"?0:u._strategyHWM-u._queueTotalSize}function Lh(u){return!Pl(u)}function rn(u){let f=u._controlledReadableStream._state;return!u._closeRequested&&f==="readable"}function Il(u,f,_,I,N,U,F){f._controlledReadableStream=u,f._queue=void 0,f._queueTotalSize=void 0,Gr(f),f._started=!1,f._closeRequested=!1,f._pullAgain=!1,f._pulling=!1,f._strategySizeAlgorithm=F,f._strategyHWM=U,f._pullAlgorithm=I,f._cancelAlgorithm=N,u._readableStreamController=f;let te=_();E(R(te),()=>{f._started=!0,qn(f)},fe=>{Jr(f,fe)})}function kh(u,f,_,I){let N=Object.create(tn.prototype),U=()=>{},F=()=>R(void 0),te=()=>R(void 0);f.start!==void 0&&(U=()=>f.start(N)),f.pull!==void 0&&(F=()=>f.pull(N)),f.cancel!==void 0&&(te=fe=>f.cancel(fe)),Il(u,N,U,F,te,_,I)}function oo(u){return new TypeError(`ReadableStreamDefaultController.prototype.${u} can only be used on a ReadableStreamDefaultController`)}function Nh(u,f){return vi(u._readableStreamController)?vt(u):Bh(u)}function Bh(u,f){let _=Wi(u),I=!1,N=!1,U=!1,F=!1,te,fe,we,Te,Pe,it=S(wt=>{Pe=wt});function sr(){return I?(N=!0,R(void 0)):(I=!0,Lr(_,{_chunkSteps:St=>{B(()=>{N=!1;let Vt=St,Dr=St;U||so(we._readableStreamController,Vt),F||so(Te._readableStreamController,Dr),I=!1,N&&sr()})},_closeSteps:()=>{I=!1,U||Gn(we._readableStreamController),F||Gn(Te._readableStreamController),(!U||!F)&&Pe(void 0)},_errorSteps:()=>{I=!1}}),R(void 0))}function on(wt){if(U=!0,te=wt,F){let St=Dn([te,fe]),Vt=nr(u,St);Pe(Vt)}return it}function ei(wt){if(F=!0,fe=wt,U){let St=Dn([te,fe]),Vt=nr(u,St);Pe(Vt)}return it}function Br(){}return we=pr(Br,sr,on),Te=pr(Br,sr,ei),C(_._closedPromise,wt=>{Jr(we._readableStreamController,wt),Jr(Te._readableStreamController,wt),(!U||!F)&&Pe(void 0)}),[we,Te]}function vt(u){let f=Wi(u),_=!1,I=!1,N=!1,U=!1,F=!1,te,fe,we,Te,Pe,it=S(ne=>{Pe=ne});function sr(ne){C(ne._closedPromise,ge=>{ne===f&&(qt(we._readableStreamController,ge),qt(Te._readableStreamController,ge),(!U||!F)&&Pe(void 0))})}function on(){Gt(f)&&(Ae(f),f=Wi(u),sr(f)),Lr(f,{_chunkSteps:ge=>{B(()=>{I=!1,N=!1;let Ve=ge,Lt=ge;if(!U&&!F)try{Lt=ol(ge)}catch(an){qt(we._readableStreamController,an),qt(Te._readableStreamController,an),Pe(nr(u,an));return}U||Hs(we._readableStreamController,Ve),F||Hs(Te._readableStreamController,Lt),_=!1,I?Br():N&&wt()})},_closeSteps:()=>{_=!1,U||Vr(we._readableStreamController),F||Vr(Te._readableStreamController),we._readableStreamController._pendingPullIntos.length>0&&Un(we._readableStreamController,0),Te._readableStreamController._pendingPullIntos.length>0&&Un(Te._readableStreamController,0),(!U||!F)&&Pe(void 0)},_errorSteps:()=>{_=!1}})}function ei(ne,ge){ct(f)&&(Ae(f),f=Ws(u),sr(f));let Ve=ge?Te:we,Lt=ge?we:Te;yt(f,ne,{_chunkSteps:ln=>{B(()=>{I=!1,N=!1;let un=ge?F:U;if(ge?U:F)un||$n(Ve._readableStreamController,ln);else{let Vl;try{Vl=ol(ln)}catch(Ya){qt(Ve._readableStreamController,Ya),qt(Lt._readableStreamController,Ya),Pe(nr(u,Ya));return}un||$n(Ve._readableStreamController,ln),Hs(Lt._readableStreamController,Vl)}_=!1,I?Br():N&&wt()})},_closeSteps:ln=>{_=!1;let un=ge?F:U,go=ge?U:F;un||Vr(Ve._readableStreamController),go||Vr(Lt._readableStreamController),ln!==void 0&&(un||$n(Ve._readableStreamController,ln),!go&&Lt._readableStreamController._pendingPullIntos.length>0&&Un(Lt._readableStreamController,0)),(!un||!go)&&Pe(void 0)},_errorSteps:()=>{_=!1}})}function Br(){if(_)return I=!0,R(void 0);_=!0;let ne=Na(we._readableStreamController);return ne===null?on():ei(ne._view,!1),R(void 0)}function wt(){if(_)return N=!0,R(void 0);_=!0;let ne=Na(Te._readableStreamController);return ne===null?on():ei(ne._view,!0),R(void 0)}function St(ne){if(U=!0,te=ne,F){let ge=Dn([te,fe]),Ve=nr(u,ge);Pe(Ve)}return it}function Vt(ne){if(F=!0,fe=ne,U){let ge=Dn([te,fe]),Ve=nr(u,ge);Pe(Ve)}return it}function Dr(){}return we=Ll(Dr,Br,St),Te=Ll(Dr,wt,Vt),sr(f),[we,Te]}function Vn(u,f){ht(u,f);let _=u,I=_?.autoAllocateChunkSize,N=_?.cancel,U=_?.pull,F=_?.start,te=_?.type;return{autoAllocateChunkSize:I===void 0?void 0:X1(I,`${f} has member 'autoAllocateChunkSize' that`),cancel:N===void 0?void 0:Kn(N,_,`${f} has member 'cancel' that`),pull:U===void 0?void 0:Jn(U,_,`${f} has member 'pull' that`),start:F===void 0?void 0:Zn(F,_,`${f} has member 'start' that`),type:te===void 0?void 0:nn(te,`${f} has member 'type' that`)}}function Kn(u,f,_){return rr(u,_),I=>q(u,f,[I])}function Jn(u,f,_){return rr(u,_),I=>q(u,f,[I])}function Zn(u,f,_){return rr(u,_),I=>z(u,f,[I])}function nn(u,f){if(u=`${u}`,u!=="bytes")throw new TypeError(`${f} '${u}' is not a valid enumeration value for ReadableStreamType`);return u}function sn(u,f){ht(u,f);let _=u?.mode;return{mode:_===void 0?void 0:ao(_,`${f} has member 'mode' that`)}}function ao(u,f){if(u=`${u}`,u!=="byob")throw new TypeError(`${f} '${u}' is not a valid enumeration value for ReadableStreamReaderMode`);return u}function Dh(u,f){ht(u,f);let _=u?.preventCancel;return{preventCancel:Boolean(_)}}function Ol(u,f){ht(u,f);let _=u?.preventAbort,I=u?.preventCancel,N=u?.preventClose,U=u?.signal;return U!==void 0&&zh(U,`${f} has member 'signal' that`),{preventAbort:Boolean(_),preventCancel:Boolean(I),preventClose:Boolean(N),signal:U}}function zh(u,f){if(!lh(u))throw new TypeError(`${f} is not an AbortSignal.`)}function jh(u,f){ht(u,f);let _=u?.readable;Ea(_,"readable","ReadableWritablePair"),Ca(_,`${f} has member 'readable' that`);let I=u?.writable;return Ea(I,"writable","ReadableWritablePair"),Vs(I,`${f} has member 'writable' that`),{readable:_,writable:I}}class Zr{constructor(f={},_={}){f===void 0?f=null:mt(f,"First parameter");let I=Gs(_,"Second parameter"),N=Vn(f,"First parameter");if(Za(this),N.type==="bytes"){if(I.size!==void 0)throw new RangeError("The strategy for a byte stream cannot have a size function");let U=kr(I,0);fl(this,N,U)}else{let U=Kr(I),F=kr(I,1);kh(this,N,F,U)}}get locked(){if(!Yr(this))throw Ri("locked");return Xr(this)}cancel(f=void 0){return Yr(this)?Xr(this)?x(new TypeError("Cannot cancel a stream that already has a reader")):nr(this,f):x(Ri("cancel"))}getReader(f=void 0){if(!Yr(this))throw Ri("getReader");return sn(f,"First parameter").mode===void 0?Wi(this):Ws(this)}pipeThrough(f,_={}){if(!Yr(this))throw Ri("pipeThrough");Or(f,1,"pipeThrough");let I=jh(f,"First parameter"),N=Ol(_,"Second parameter");if(Xr(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(Yi(I.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");let U=Ei(this,I.writable,N.preventClose,N.preventAbort,N.preventCancel,N.signal);return L(U),I.readable}pipeTo(f,_={}){if(!Yr(this))return x(Ri("pipeTo"));if(f===void 0)return x("Parameter 1 is required in 'pipeTo'.");if(!Zi(f))return x(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let I;try{I=Ol(_,"Second parameter")}catch(N){return x(N)}return Xr(this)?x(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):Yi(f)?x(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):Ei(this,f,I.preventClose,I.preventAbort,I.preventCancel,I.signal)}tee(){if(!Yr(this))throw Ri("tee");let f=Nh(this);return Dn(f)}values(f=void 0){if(!Yr(this))throw Ri("values");let _=Dh(f,"First parameter");return Qc(this,_.preventCancel)}}Object.defineProperties(Zr.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(Zr.prototype,e.toStringTag,{value:"ReadableStream",configurable:!0}),typeof e.asyncIterator=="symbol"&&Object.defineProperty(Zr.prototype,e.asyncIterator,{value:Zr.prototype.values,writable:!0,configurable:!0});function pr(u,f,_,I=1,N=()=>1){let U=Object.create(Zr.prototype);Za(U);let F=Object.create(tn.prototype);return Il(U,F,u,f,_,I,N),U}function Ll(u,f,_){let I=Object.create(Zr.prototype);Za(I);let N=Object.create(Xe.prototype);return hl(I,N,u,f,_,0,void 0),I}function Za(u){u._state="readable",u._reader=void 0,u._storedError=void 0,u._disturbed=!1}function Yr(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_readableStreamController")?!1:u instanceof Zr}function Xr(u){return u._reader!==void 0}function nr(u,f){if(u._disturbed=!0,u._state==="closed")return R(void 0);if(u._state==="errored")return x(u._storedError);Yn(u);let _=u._reader;_!==void 0&&Gt(_)&&(_._readIntoRequests.forEach(N=>{N._closeSteps(void 0)}),_._readIntoRequests=new se);let I=u._readableStreamController[Ma](f);return P(I,r)}function Yn(u){u._state="closed";let f=u._reader;f!==void 0&&(Bn(f),ct(f)&&(f._readRequests.forEach(_=>{_._closeSteps()}),f._readRequests=new se))}function kl(u,f){u._state="errored",u._storedError=f;let _=u._reader;_!==void 0&&(xa(_,f),ct(_)?(_._readRequests.forEach(I=>{I._errorSteps(f)}),_._readRequests=new se):(_._readIntoRequests.forEach(I=>{I._errorSteps(f)}),_._readIntoRequests=new se))}function Ri(u){return new TypeError(`ReadableStream.prototype.${u} can only be used on a ReadableStream`)}function Nl(u,f){ht(u,f);let _=u?.highWaterMark;return Ea(_,"highWaterMark","QueuingStrategyInit"),{highWaterMark:Ra(_)}}let Bl=u=>u.byteLength;Object.defineProperty(Bl,"name",{value:"size",configurable:!0});class lo{constructor(f){Or(f,1,"ByteLengthQueuingStrategy"),f=Nl(f,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=f.highWaterMark}get highWaterMark(){if(!zl(this))throw Dl("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!zl(this))throw Dl("size");return Bl}}Object.defineProperties(lo.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(lo.prototype,e.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});function Dl(u){return new TypeError(`ByteLengthQueuingStrategy.prototype.${u} can only be used on a ByteLengthQueuingStrategy`)}function zl(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_byteLengthQueuingStrategyHighWaterMark")?!1:u instanceof lo}let jl=()=>1;Object.defineProperty(jl,"name",{value:"size",configurable:!0});class uo{constructor(f){Or(f,1,"CountQueuingStrategy"),f=Nl(f,"First parameter"),this._countQueuingStrategyHighWaterMark=f.highWaterMark}get highWaterMark(){if(!$l(this))throw Ul("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!$l(this))throw Ul("size");return jl}}Object.defineProperties(uo.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(uo.prototype,e.toStringTag,{value:"CountQueuingStrategy",configurable:!0});function Ul(u){return new TypeError(`CountQueuingStrategy.prototype.${u} can only be used on a CountQueuingStrategy`)}function $l(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_countQueuingStrategyHighWaterMark")?!1:u instanceof uo}function Qr(u,f){ht(u,f);let _=u?.flush,I=u?.readableType,N=u?.start,U=u?.transform,F=u?.writableType;return{flush:_===void 0?void 0:Uh(_,u,`${f} has member 'flush' that`),readableType:I,start:N===void 0?void 0:$h(N,u,`${f} has member 'start' that`),transform:U===void 0?void 0:Fh(U,u,`${f} has member 'transform' that`),writableType:F}}function Uh(u,f,_){return rr(u,_),I=>q(u,f,[I])}function $h(u,f,_){return rr(u,_),I=>z(u,f,[I])}function Fh(u,f,_){return rr(u,_),(I,N)=>q(u,f,[I,N])}class co{constructor(f={},_={},I={}){f===void 0&&(f=null);let N=Gs(_,"Second parameter"),U=Gs(I,"Third parameter"),F=Qr(f,"First parameter");if(F.readableType!==void 0)throw new RangeError("Invalid readableType specified");if(F.writableType!==void 0)throw new RangeError("Invalid writableType specified");let te=kr(U,0),fe=Kr(U),we=kr(N,1),Te=Kr(N),Pe,it=S(sr=>{Pe=sr});Hh(this,it,we,Te,te,fe),qh(this,F),F.start!==void 0?Pe(F.start(this._transformStreamController)):Pe(void 0)}get readable(){if(!Fl(this))throw Gl("readable");return this._readable}get writable(){if(!Fl(this))throw Gl("writable");return this._writable}}Object.defineProperties(co.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(co.prototype,e.toStringTag,{value:"TransformStream",configurable:!0});function Hh(u,f,_,I,N,U){function F(){return f}function te(it){return Kh(u,it)}function fe(it){return Jh(u,it)}function we(){return Zh(u)}u._writable=yl(F,te,we,fe,_,I);function Te(){return Yh(u)}function Pe(it){return fo(u,it),R(void 0)}u._readable=pr(F,Te,Pe,N,U),u._backpressure=void 0,u._backpressureChangePromise=void 0,u._backpressureChangePromise_resolve=void 0,mo(u,!0),u._transformStreamController=void 0}function Fl(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_transformStreamController")?!1:u instanceof co}function ho(u,f){Jr(u._readable._readableStreamController,f),fo(u,f)}function fo(u,f){Hl(u._transformStreamController),Wa(u._writable._writableStreamController,f),u._backpressure&&mo(u,!1)}function mo(u,f){u._backpressureChangePromise!==void 0&&u._backpressureChangePromise_resolve(),u._backpressureChangePromise=S(_=>{u._backpressureChangePromise_resolve=_}),u._backpressure=f}class Xn{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!po(this))throw Qn("desiredSize");let f=this._controlledTransformStream._readable._readableStreamController;return Ja(f)}enqueue(f=void 0){if(!po(this))throw Qn("enqueue");Wl(this,f)}error(f=void 0){if(!po(this))throw Qn("error");Gh(this,f)}terminate(){if(!po(this))throw Qn("terminate");Vh(this)}}Object.defineProperties(Xn.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Xn.prototype,e.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});function po(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_controlledTransformStream")?!1:u instanceof Xn}function Wh(u,f,_,I){f._controlledTransformStream=u,u._transformStreamController=f,f._transformAlgorithm=_,f._flushAlgorithm=I}function qh(u,f){let _=Object.create(Xn.prototype),I=U=>{try{return Wl(_,U),R(void 0)}catch(F){return x(F)}},N=()=>R(void 0);f.transform!==void 0&&(I=U=>f.transform(U,_)),f.flush!==void 0&&(N=()=>f.flush(_)),Wh(u,_,I,N)}function Hl(u){u._transformAlgorithm=void 0,u._flushAlgorithm=void 0}function Wl(u,f){let _=u._controlledTransformStream,I=_._readable._readableStreamController;if(!rn(I))throw new TypeError("Readable side is not in a state that permits enqueue");try{so(I,f)}catch(U){throw fo(_,U),_._readable._storedError}Lh(I)!==_._backpressure&&mo(_,!0)}function Gh(u,f){ho(u._controlledTransformStream,f)}function ql(u,f){let _=u._transformAlgorithm(f);return P(_,void 0,I=>{throw ho(u._controlledTransformStream,I),I})}function Vh(u){let f=u._controlledTransformStream,_=f._readable._readableStreamController;Gn(_);let I=new TypeError("TransformStream terminated");fo(f,I)}function Kh(u,f){let _=u._transformStreamController;if(u._backpressure){let I=u._backpressureChangePromise;return P(I,()=>{let N=u._writable;if(N._state==="erroring")throw N._storedError;return ql(_,f)})}return ql(_,f)}function Jh(u,f){return ho(u,f),R(void 0)}function Zh(u){let f=u._readable,_=u._transformStreamController,I=_._flushAlgorithm();return Hl(_),P(I,()=>{if(f._state==="errored")throw f._storedError;Gn(f._readableStreamController)},N=>{throw ho(u,N),f._storedError})}function Yh(u){return mo(u,!1),u._backpressureChangePromise}function Qn(u){return new TypeError(`TransformStreamDefaultController.prototype.${u} can only be used on a TransformStreamDefaultController`)}function Gl(u){return new TypeError(`TransformStream.prototype.${u} can only be used on a TransformStream`)}t.ByteLengthQueuingStrategy=lo,t.CountQueuingStrategy=uo,t.ReadableByteStreamController=Xe,t.ReadableStream=Zr,t.ReadableStreamBYOBReader=Ki,t.ReadableStreamBYOBRequest=zn,t.ReadableStreamDefaultController=tn,t.ReadableStreamDefaultReader=Y,t.TransformStream=co,t.TransformStreamDefaultController=Xn,t.WritableStream=Ji,t.WritableStreamDefaultController=Qi,t.WritableStreamDefaultWriter=Xi,Object.defineProperty(t,"__esModule",{value:!0})})});var lp=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,ap())}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 c=await n.slice(i,Math.min(n.size,i+65536)).arrayBuffer();i+=c.byteLength,o.enqueue(new Uint8Array(c)),i===n.size&&o.close()}})})}catch{}});async function*z0(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,up),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+up)).arrayBuffer();i+=a.byteLength,yield new Uint8Array(a)}}}var ZC,up,Li,v1,No,Uu,Bo,cp,h_,ki,w1=t1(()=>{ZC=me(lp(),1);up=65536;cp=(Bo=class{constructor(e=[],r={}){_t(this,Li,[]);_t(this,v1,"");_t(this,No,0);_t(this,Uu,"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 Bo?a=o:a=i.encode(`${o}`),et(this,No,Me(this,No)+(ArrayBuffer.isView(a)?a.byteLength:a.size)),Me(this,Li).push(a)}et(this,Uu,`${r.endings===void 0?"transparent":r.endings}`);let n=r.type===void 0?"":String(r.type);et(this,v1,/^[\x20-\x7E]*$/.test(n)?n:"")}get size(){return Me(this,No)}get type(){return Me(this,v1)}async text(){let e=new TextDecoder,r="";for await(let i of z0(Me(this,Li),!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 z0(Me(this,Li),!1))e.set(i,r),r+=i.length;return e.buffer}stream(){let e=z0(Me(this,Li),!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),c=Math.max(a-o,0),d=Me(this,Li),p=[],m=0;for(let R of d){if(m>=c)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)),m+=w.byteLength):(w=R.slice(o,Math.min(x,a)),m+=w.size),a-=x,p.push(w),o=0}}let S=new Bo([],{type:String(i).toLowerCase()});return et(S,No,c),et(S,Li,p),S}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])}},Li=new WeakMap,v1=new WeakMap,No=new WeakMap,Uu=new WeakMap,Bo);Object.defineProperties(cp.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}});h_=cp,ki=h_});var _1,x1,hp,f_,d_,Do,j0=t1(()=>{w1();f_=(hp=class extends ki{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);_t(this,_1,0);_t(this,x1,"");n===null&&(n={});let o=n.lastModified===void 0?Date.now():Number(n.lastModified);Number.isNaN(o)||et(this,_1,o),et(this,x1,String(i))}get name(){return Me(this,x1)}get lastModified(){return Me(this,_1)}get[Symbol.toStringTag](){return"File"}static[Symbol.hasInstance](r){return!!r&&r instanceof ki&&/^(File)$/.test(r[Symbol.toStringTag])}},_1=new WeakMap,x1=new WeakMap,hp),d_=f_,Do=d_});function pp(t,e=ki){var r=`${fp()}${fp()}`.replace(/\./g,"").slice(-28).padStart(32,"-"),i=[],n=`--${r}\r
|
|
96
|
+
Content-Disposition: form-data; name="`;return t.forEach((o,a)=>typeof o=="string"?i.push(n+U0(a)+`"\r
|
|
97
|
+
\r
|
|
98
|
+
${o.replace(/\r(?!\n)|(?<!\r)\n/g,`\r
|
|
99
|
+
`)}\r
|
|
100
|
+
`):i.push(n+U0(a)+`"; filename="${U0(o.name,1)}"\r
|
|
101
|
+
Content-Type: ${o.type||"application/octet-stream"}\r
|
|
102
|
+
\r
|
|
103
|
+
`,o,`\r
|
|
104
|
+
`)),i.push(`--${r}--`),new e(i,{type:"multipart/form-data; boundary="+r})}var S1,m_,p_,fp,g_,dp,U0,gs,_r,mp,ys,$u=t1(()=>{w1();j0();({toStringTag:S1,iterator:m_,hasInstance:p_}=Symbol),fp=Math.random,g_="append,set,get,getAll,delete,keys,values,entries,forEach,constructor".split(","),dp=(t,e,r)=>(t+="",/^(Blob|File)$/.test(e&&e[S1])?[(r=r!==void 0?r+"":e[S1]=="File"?e.name:"blob",t),e.name!==r||e[S1]=="blob"?new Do([e],r,e):e]:[t,e+""]),U0=(t,e)=>(e?t:t.replace(/\r?\n|\r/g,`\r
|
|
105
|
+
`)).replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),gs=(t,e,r)=>{if(e.length<r)throw new TypeError(`Failed to execute '${t}' on 'FormData': ${r} arguments required, but only ${e.length} present.`)},ys=(mp=class{constructor(...e){_t(this,_r,[]);if(e.length)throw new TypeError("Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.")}get[S1](){return"FormData"}[m_](){return this.entries()}static[p_](e){return e&&typeof e=="object"&&e[S1]==="FormData"&&!g_.some(r=>typeof e[r]!="function")}append(...e){gs("append",arguments,2),Me(this,_r).push(dp(...e))}delete(e){gs("delete",arguments,1),e+="",et(this,_r,Me(this,_r).filter(([r])=>r!==e))}get(e){gs("get",arguments,1),e+="";for(var r=Me(this,_r),i=r.length,n=0;n<i;n++)if(r[n][0]===e)return r[n][1];return null}getAll(e,r){return gs("getAll",arguments,1),r=[],e+="",Me(this,_r).forEach(i=>i[0]===e&&r.push(i[1])),r}has(e){return gs("has",arguments,1),e+="",Me(this,_r).some(r=>r[0]===e)}forEach(e,r){gs("forEach",arguments,1);for(var[i,n]of this)e.call(r,n,i,this)}set(...e){gs("set",arguments,2);var r=[],i=!0;e=dp(...e),Me(this,_r).forEach(n=>{n[0]===e[0]?i&&(i=!r.push(e)):r.push(n)}),i&&r.push(e),et(this,_r,r)}*entries(){yield*Me(this,_r)}*keys(){for(var[e]of this)yield e}*values(){for(var[,e]of this)yield e}},_r=new WeakMap,mp)});var vp=V((uA,bp)=>{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)}bp.exports=globalThis.DOMException});var E1,_p,y_,bs,vs,F0,wp,H0=t1(()=>{E1=require("fs"),_p=me(vp(),1);j0();w1();({stat:y_}=E1.promises),F0=class{constructor(e){_t(this,bs,void 0);_t(this,vs,void 0);et(this,bs,e.path),et(this,vs,e.start),this.size=e.size,this.lastModified=e.lastModified}slice(e,r){return new F0({path:Me(this,bs),lastModified:this.lastModified,size:r-e,start:Me(this,vs)+e})}async*stream(){let{mtimeMs:e}=await y_(Me(this,bs));if(e>this.lastModified)throw new _p.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,E1.createReadStream)(Me(this,bs),{start:Me(this,vs),end:Me(this,vs)+this.size-1})}get[Symbol.toStringTag](){return"Blob"}},wp=F0;bs=new WeakMap,vs=new WeakMap});var Sp={};h2(Sp,{toFormData:()=>M_});function S_(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 M_(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 W0(r[1]||r[2]),n,o,a,c,d,p,m=[],S=new ys,R=C=>{a+=T.decode(C,{stream:!0})},x=C=>{m.push(C)},w=()=>{let C=new Do(m,p,{type:d});S.append(c,C)},E=()=>{S.append(c,a)},T=new TextDecoder("utf-8");T.decode(),i.onPartBegin=function(){i.onPartData=R,i.onPartEnd=E,n="",o="",a="",c="",d="",p=null,m.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&&(c=C[2]||C[3]||""),p=S_(o),p&&(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(),S}var ai,Ze,xp,Mn,Hu,Wu,b_,R1,v_,w_,__,x_,ws,W0,Mp=t1(()=>{H0();$u();ai=0,Ze={START_BOUNDARY:ai++,HEADER_FIELD_START:ai++,HEADER_FIELD:ai++,HEADER_VALUE_START:ai++,HEADER_VALUE:ai++,HEADER_VALUE_ALMOST_DONE:ai++,HEADERS_ALMOST_DONE:ai++,PART_DATA_START:ai++,PART_DATA:ai++,END:ai++},xp=1,Mn={PART_BOUNDARY:xp,LAST_BOUNDARY:xp*=2},Hu=10,Wu=13,b_=32,R1=45,v_=58,w_=97,__=122,x_=t=>t|32,ws=()=>{},W0=class{constructor(e){this.index=0,this.flags=0,this.onHeaderEnd=ws,this.onHeaderField=ws,this.onHeadersEnd=ws,this.onHeaderValue=ws,this.onPartBegin=ws,this.onPartData=ws,this.onPartEnd=ws,this.boundaryChars={},e=`\r
|
|
106
|
+
--`+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=Ze.START_BOUNDARY}write(e){let r=0,i=e.length,n=this.index,{lookbehind:o,boundary:a,boundaryChars:c,index:d,state:p,flags:m}=this,S=this.boundary.length,R=S-1,x=e.length,w,E,T=B=>{this[B+"Mark"]=r},C=B=>{delete this[B+"Mark"]},P=(B,z,q,Z)=>{(z===void 0||z!==q)&&this[B](Z&&Z.subarray(z,q))},L=(B,z)=>{let q=B+"Mark";q in this&&(z?(P(B,this[q],r,e),delete this[q]):(P(B,this[q],e.length,e),this[q]=0))};for(r=0;r<i;r++)switch(w=e[r],p){case Ze.START_BOUNDARY:if(d===a.length-2){if(w===R1)m|=Mn.LAST_BOUNDARY;else if(w!==Wu)return;d++;break}else if(d-1===a.length-2){if(m&Mn.LAST_BOUNDARY&&w===R1)p=Ze.END,m=0;else if(!(m&Mn.LAST_BOUNDARY)&&w===Hu)d=0,P("onPartBegin"),p=Ze.HEADER_FIELD_START;else return;break}w!==a[d+2]&&(d=-2),w===a[d+2]&&d++;break;case Ze.HEADER_FIELD_START:p=Ze.HEADER_FIELD,T("onHeaderField"),d=0;case Ze.HEADER_FIELD:if(w===Wu){C("onHeaderField"),p=Ze.HEADERS_ALMOST_DONE;break}if(d++,w===R1)break;if(w===v_){if(d===1)return;L("onHeaderField",!0),p=Ze.HEADER_VALUE_START;break}if(E=x_(w),E<w_||E>__)return;break;case Ze.HEADER_VALUE_START:if(w===b_)break;T("onHeaderValue"),p=Ze.HEADER_VALUE;case Ze.HEADER_VALUE:w===Wu&&(L("onHeaderValue",!0),P("onHeaderEnd"),p=Ze.HEADER_VALUE_ALMOST_DONE);break;case Ze.HEADER_VALUE_ALMOST_DONE:if(w!==Hu)return;p=Ze.HEADER_FIELD_START;break;case Ze.HEADERS_ALMOST_DONE:if(w!==Hu)return;P("onHeadersEnd"),p=Ze.PART_DATA_START;break;case Ze.PART_DATA_START:p=Ze.PART_DATA,T("onPartData");case Ze.PART_DATA:if(n=d,d===0){for(r+=R;r<x&&!(e[r]in c);)r+=S;r-=R,w=e[r]}if(d<a.length)a[d]===w?(d===0&&L("onPartData",!0),d++):d=0;else if(d===a.length)d++,w===Wu?m|=Mn.PART_BOUNDARY:w===R1?m|=Mn.LAST_BOUNDARY:d=0;else if(d-1===a.length)if(m&Mn.PART_BOUNDARY){if(d=0,w===Hu){m&=~Mn.PART_BOUNDARY,P("onPartEnd"),P("onPartBegin"),p=Ze.HEADER_FIELD_START;break}}else m&Mn.LAST_BOUNDARY&&w===R1?(P("onPartEnd"),p=Ze.END,m=0):d=0;if(d>0)o[d-1]=w;else if(n>0){let B=new Uint8Array(o.buffer,o.byteOffset,o.byteLength);P("onPartData",0,n,B),n=0,T("onPartData"),r--}break;case Ze.END:break;default:throw new Error(`Unexpected state entered: ${p}`)}L("onHeaderField"),L("onHeaderValue"),L("onPartData"),this.index=d,this.state=p,this.flags=m}end(){if(this.state===Ze.HEADER_FIELD_START&&this.index===0||this.state===Ze.PART_DATA&&this.index===this.boundary.length)this.onPartEnd();else if(this.state!==Ze.END)throw new Error("MultipartParser.end(): stream ended unexpectedly")}}});var Xp=V((oP,Yp)=>{"use strict";Yp.exports=ic;ic.polyline=ic;ic.polygon=Ox;function ic(t,e,r){var i=t.length,n=ta(t[0],e),o=[],a,c,d,p,m;for(r||(r=[]),a=1;a<i;a++){for(c=t[a-1],d=t[a],p=m=ta(d,e);;)if(n|p){if(n&p)break;n?(c=Q0(c,d,n,e),n=ta(c,e)):(d=Q0(c,d,p,e),p=ta(d,e))}else{o.push(c),p!==m?(o.push(d),a<i-1&&(r.push(o),o=[])):a===i-1&&o.push(d);break}n=m}return o.length&&r.push(o),r}function Ox(t,e){var r,i,n,o,a,c,d;for(i=1;i<=8;i*=2){for(r=[],n=t[t.length-1],o=!(ta(n,e)&i),a=0;a<t.length;a++)c=t[a],d=!(ta(c,e)&i),d!==o&&r.push(Q0(n,c,i,e)),d&&r.push(c),n=c,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 ta(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 Qp=V((ed,td)=>{(function(t,e){typeof ed=="object"&&typeof td<"u"?td.exports=e():typeof define=="function"&&define.amd?define(e):t.SplayTree=e()})(ed,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),P=C,L=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}L.left=E,L=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}P.right=E,P=E,E=E.right}else break}return P.right=E.left,L.left=E.right,E.left=C.right,E.right=C.left,E}function i(w,E,T,C){var P=new t(w,E);if(T===null)return P.left=P.right=null,P;T=r(w,T,C);var L=C(w,T.key);return L<0?(P.left=T.left,P.right=T,T.left=null):L>=0&&(P.right=T.right,P.left=T,T.right=null),P}function n(w,E,T){var C=null,P=null;if(E){E=r(w,E,T);var L=T(E.key,w);L===0?(C=E.left,P=E.right):L<0?(P=E.right,E.right=null,C=E):(C=E.left,E.left=null,P=E)}return{left:C,right:P}}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,P){if(w){C(""+E+(T?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ")+P(w)+`
|
|
107
|
+
`);var L=E+(T?" ":"\u2502 ");w.left&&a(w.left,L,!1,C,P),w.right&&a(w.right,L,!0,C,P)}}var c=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 P=this._comparator,L=r(E,this._root,P),B=P(E,L.key);return B===0?this._root=L:(B<0?(C.left=L.left,C.right=L,L.left=null):B>0&&(C.right=L.right,C.left=L,L.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 P;if(T===null)return null;T=r(E,T,C);var L=C(E,T.key);return L===0?(T.left===null?P=T.right:(P=r(E,T.left,C),P.right=T.right),this._size--,P):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 P=C(E,T.key);if(P===0)return T;P<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 P=C(E,T.key);if(P===0)return!0;P<0?T=T.left:T=T.right}return!1},w.prototype.forEach=function(E,T){for(var C=this._root,P=[],L=!1;!L;)C!==null?(P.push(C),C=C.left):P.length!==0?(C=P.pop(),E.call(T,C),C=C.right):L=!0;return this},w.prototype.range=function(E,T,C,P){for(var L=[],B=this._comparator,z=this._root,q;L.length!==0||z;)if(z)L.push(z),z=z.left;else{if(z=L.pop(),q=B(z.key,T),q>0)break;if(B(z.key,E)>=0&&C.call(P,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,P=0,L=[];!C;)if(T)L.push(T),T=T.left;else if(L.length>0){if(T=L.pop(),P===E)return T;P++,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 P=this._comparator;T;){var L=P(E.key,T.key);if(L===0)break;L<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 P=this._comparator;T;){var L=P(E.key,T.key);if(L===0)break;L<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 m(this._root)},w.prototype.load=function(E,T,C){T===void 0&&(T=[]),C===void 0&&(C=!1);var P=E.length,L=this._comparator;if(C&&x(E,T,0,P-1,L),this._root===null)this._root=d(E,T,0,P),this._size=P;else{var B=R(this.toList(),p(E,T),L);P=this._size+P,this._root=S({head:B},0,P)}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 P=this._comparator,L=n(E,this._root,P),B=L.left,z=L.right;P(E,T)<0?z=i(T,C,z,P):B=i(T,C,B,P),this._root=o(B,z,P)},w.prototype.split=function(E){return n(E,this._root,this._comparator)},w}();function d(w,E,T,C){var P=C-T;if(P>0){var L=T+Math.floor(P/2),B=w[L],z=E[L],q=new t(B,z);return q.left=d(w,E,T,L),q.right=d(w,E,L+1,C),q}return null}function p(w,E){for(var T=new t(null,null),C=T,P=0;P<w.length;P++)C=C.next=new t(w[P],E[P]);return C.next=null,T.next}function m(w){for(var E=w,T=[],C=!1,P=new t(null,null),L=P;!C;)E?(T.push(E),E=E.left):T.length>0?(E=L=L.next=T.pop(),E=E.right):C=!0;return L.next=null,P.next}function S(w,E,T){var C=T-E;if(C>0){var P=E+Math.floor(C/2),L=S(w,E,P),B=w.head;return B.left=L,w.head=w.head.next,B.right=S(w,P+1,T),B}return null}function R(w,E,T){for(var C=new t(null,null),P=C,L=w,B=E;L!==null&&B!==null;)T(L.key,B.key)<0?(P.next=L,L=L.next):(P.next=B,B=B.next),P=P.next;return L!==null?P.next=L:B!==null&&(P.next=B),C.next}function x(w,E,T,C,P){if(!(T>=C)){for(var L=w[T+C>>1],B=T-1,z=C+1;;){do B++;while(P(w[B],L)<0);do z--;while(P(w[z],L)>0);if(B>=z)break;var q=w[B];w[B]=w[z],w[z]=q,q=E[B],E[B]=E[z],E[z]=q}x(w,E,T,z,P),x(w,E,z+1,C,P)}}return c})});var h6=V((aP,c6)=>{"use strict";var Lx=Qp();function kx(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var nd=kx(Lx);function Ar(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e6(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 Dt(t,e,r){return e&&e6(t.prototype,e),r&&e6(t,r),t}var O1=function(e,r){return e.ll.x<=r.x&&r.x<=e.ur.x&&e.ll.y<=r.y&&r.y<=e.ur.y},rd=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}}},An=Number.EPSILON;An===void 0&&(An=Math.pow(2,-52));var Nx=An*An,id=function(e,r){if(-An<e&&e<An&&-An<r&&r<An)return 0;var i=e-r;return i*i<Nx*e*r?0:e<r?-1:1},Bx=function(){function t(){Ar(this,t),this.reset()}return Dt(t,[{key:"reset",value:function(){this.xRounder=new t6,this.yRounder=new t6}},{key:"round",value:function(r,i){return{x:this.xRounder.round(r),y:this.yRounder.round(i)}}}]),t}(),t6=function(){function t(){Ar(this,t),this.tree=new nd.default,this.round(0)}return Dt(t,[{key:"round",value:function(r){var i=this.tree.add(r),n=this.tree.prev(i);if(n!==null&&id(i.key,n.key)===0)return this.tree.remove(r),n.key;var o=this.tree.next(i);return o!==null&&id(i.key,o.key)===0?(this.tree.remove(r),o.key):r}}]),t}(),k1=new Bx,L1=function(e,r){return e.x*r.y-e.y*r.x},u6=function(e,r){return e.x*r.x+e.y*r.y},r6=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=L1(n,o);return id(a,0)},nc=function(e){return Math.sqrt(u6(e,e))},Dx=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 L1(o,n)/nc(o)/nc(n)},zx=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 u6(o,n)/nc(o)/nc(n)},i6=function(e,r,i){return r.y===0?null:{x:e.x+r.x/r.y*(i-e.y),y:i}},n6=function(e,r,i){return r.x===0?null:{x:i,y:e.y+r.y/r.x*(i-e.x)}},jx=function(e,r,i,n){if(r.x===0)return n6(i,n,e.x);if(n.x===0)return n6(e,r,i.x);if(r.y===0)return i6(i,n,e.y);if(n.y===0)return i6(e,r,i.y);var o=L1(r,n);if(o==0)return null;var a={x:i.x-e.x,y:i.y-e.y},c=L1(a,r)/o,d=L1(a,n)/o,p=e.x+d*r.x,m=i.x+c*n.x,S=e.y+d*r.y,R=i.y+c*n.y,x=(p+m)/2,w=(S+R)/2;return{x,y:w}},fi=function(){Dt(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:sc.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){Ar(this,t),e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=r}return Dt(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(c){var d=c.otherSE;n.set(c,{sine:Dx(i.point,r.point,d.point),cosine:zx(i.point,r.point,d.point)})};return function(a,c){n.has(a)||o(a),n.has(c)||o(c);var d=n.get(a),p=d.sine,m=d.cosine,S=n.get(c),R=S.sine,x=S.cosine;return p>=0&&R>=0?m<x?1:m>x?-1:0:p<0&&R<0?m<x?-1:m>x?1:0:R<p?-1:R>p?1:0}}}]),t}(),Ux=0,sc=function(){Dt(t,null,[{key:"compare",value:function(r,i){var n=r.leftSE.point.x,o=i.leftSE.point.x,a=r.rightSE.point.x,c=i.rightSE.point.x;if(c<n)return 1;if(a<o)return-1;var d=r.leftSE.point.y,p=i.leftSE.point.y,m=r.rightSE.point.y,S=i.rightSE.point.y;if(n<o){if(p<d&&p<m)return 1;if(p>d&&p>m)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<p&&d<S)return-1;if(d>p&&d>S)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<p)return-1;if(d>p)return 1;if(a<c){var T=i.comparePoint(r.rightSE.point);if(T!==0)return T}if(a>c){var C=r.comparePoint(i.rightSE.point);if(C<0)return 1;if(C>0)return-1}if(a!==c){var P=m-d,L=a-n,B=S-p,z=c-o;if(P>L&&B<z)return 1;if(P<L&&B>z)return-1}return a>c?1:a<c||m<S?-1:m>S?1:r.id<i.id?-1:r.id>i.id?1:0}}]);function t(e,r,i,n){Ar(this,t),this.id=++Ux,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 Dt(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,c=i.x+a*o.x;if(r.x===c)return 0;var d=(r.x-i.x)/o.x,p=i.y+d*o.y;return r.y===p?0:r.y<p?-1:1}},{key:"getIntersection",value:function(r){var i=this.bbox(),n=r.bbox(),o=rd(i,n);if(o===null)return null;var a=this.leftSE.point,c=this.rightSE.point,d=r.leftSE.point,p=r.rightSE.point,m=O1(i,d)&&this.comparePoint(d)===0,S=O1(n,a)&&r.comparePoint(a)===0,R=O1(i,p)&&this.comparePoint(p)===0,x=O1(n,c)&&r.comparePoint(c)===0;if(S&&m)return x&&!R?c:!x&&R?p:null;if(S)return R&&a.x===p.x&&a.y===p.y?null:a;if(m)return x&&c.x===d.x&&c.y===d.y?null:d;if(x&&R)return null;if(x)return c;if(R)return p;var w=jx(a,this.vector(),d,r.vector());return w===null||!O1(o,w)?null:k1.round(w.x,w.y)}},{key:"split",value:function(r){var i=[],n=r.events!==void 0,o=new fi(r,!0),a=new fi(r,!1),c=this.rightSE;this.replaceRightSE(a),i.push(a),i.push(o);var d=new t(o,c,this.rings.slice(),this.windings.slice());return fi.comparePoints(d.leftSE.point,d.rightSE.point)>0&&d.swapEvents(),fi.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 c=i;i=n,n=c}for(var d=0,p=n.rings.length;d<p;d++){var m=n.rings[d],S=n.windings[d],R=i.rings.indexOf(m);R===-1?(i.rings.push(m),i.windings.push(S)):i.windings[R]+=S}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,c=this.rings.length;a<c;a++){var d=this.rings[a],p=this.windings[a],m=i.indexOf(d);m===-1?(i.push(d),n.push(p)):n[m]+=p}for(var S=[],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)S.push(T);else{R.indexOf(T)===-1&&R.push(T);var C=S.indexOf(E.poly);C!==-1&&S.splice(C,1)}}for(var P=0,L=S.length;P<L;P++){var B=S[P].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(Hr.type){case"union":{var n=r.length===0,o=i.length===0;this._isInResult=n!==o;break}case"intersection":{var a,c;r.length<i.length?(a=r.length,c=i.length):(a=i.length,c=r.length),this._isInResult=c===Hr.numMultiPolys&&a<c;break}case"xor":{var d=Math.abs(r.length-i.length);this._isInResult=d%2===1;break}case"difference":{var p=function(S){return S.length===1&&S[0].isSubject};this._isInResult=p(r)!==p(i);break}default:throw new Error("Unrecognized operation type found ".concat(Hr.type))}return this._isInResult}}],[{key:"fromRing",value:function(r,i,n){var o,a,c,d=fi.comparePoints(r,i);if(d<0)o=r,a=i,c=1;else if(d>0)o=i,a=r,c=-1;else throw new Error("Tried to create degenerate segment at [".concat(r.x,", ").concat(r.y,"]"));var p=new fi(o,!0),m=new fi(a,!1);return new t(p,m,[n],[c])}}]),t}(),s6=function(){function t(e,r,i){if(Ar(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=k1.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,c=e.length;a<c;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=k1.round(e[a][0],e[a][1]);d.x===o.x&&d.y===o.y||(this.segments.push(sc.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(sc.fromRing(o,n,this))}return Dt(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}(),$x=function(){function t(e,r){if(Ar(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new s6(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 s6(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 Dt(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,c=o.length;a<c;a++)r.push(o[a]);return r}}]),t}(),o6=function(){function t(e,r){if(Ar(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 $x(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 Dt(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,c=o.length;a<c;a++)r.push(o[a]);return r}}]),t}(),Fx=function(){Dt(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 c=null,d=a.leftSE,p=a.rightSE,m=[d],S=d.point,R=[];c=d,d=p,m.push(d),d.point!==S;)for(;;){var x=d.getAvailableLinkedEvents();if(x.length===0){var w=m[0].point,E=m[m.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){p=x[0].otherSE;break}for(var T=null,C=0,P=R.length;C<P;C++)if(R[C].point===d.point){T=C;break}if(T!==null){var L=R.splice(T)[0],B=m.splice(L.index);B.unshift(B[0].otherSE),i.push(new t(B.reverse()));continue}R.push({index:m.length,point:d.point});var z=d.getLeftmostComparator(c);p=x.sort(z)[0].otherSE;break}i.push(new t(m))}}return i}}]);function t(e){Ar(this,t),this.events=e;for(var r=0,i=e.length;r<i;r++)e[r].segment.ringOut=this;this.poly=null}return Dt(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,c=this.events[n+1].point;r6(a,r,c)!==0&&(i.push(a),r=a)}if(i.length===1)return null;var d=i[0],p=i[1];r6(d,r,p)===0&&i.shift(),i.push(i[0]);for(var m=this.isExteriorRing()?1:-1,S=this.isExteriorRing()?0:i.length-1,R=this.isExteriorRing()?i.length:-1,x=[],w=S;w!=R;w+=m)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];fi.compare(r,o)>0&&(r=o)}for(var a=r.segment.prevInResult(),c=a?a.prevInResult():null;;){if(!a)return null;if(!c)return a.ringOut;if(c.ringOut!==a.ringOut)return c.ringOut.enclosingRing()!==a.ringOut?a.ringOut:a.ringOut.enclosingRing();a=c.prevInResult(),c=a?a.prevInResult():null}}}]),t}(),a6=function(){function t(e){Ar(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return Dt(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}(),Hx=function(){function t(e){Ar(this,t),this.rings=e,this.polys=this._composePolys(e)}return Dt(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 a6(a));else{var c=a.enclosingRing();c.poly||i.push(new a6(c)),c.poly.addInterior(a)}}return i}}]),t}(),Wx=function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:sc.compare;Ar(this,t),this.queue=e,this.tree=new nd.default(r),this.segments=[]}return Dt(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,c=o,d=void 0,p=void 0;d===void 0;)a=this.tree.prev(a),a===null?d=null:a.key.consumedBy===void 0&&(d=a.key);for(;p===void 0;)c=this.tree.next(c),c===null?p=null:c.key.consumedBy===void 0&&(p=c.key);if(r.isLeft){var m=null;if(d){var S=d.getIntersection(i);if(S!==null&&(i.isAnEndpoint(S)||(m=S),!d.isAnEndpoint(S)))for(var R=this._splitSafely(d,S),x=0,w=R.length;x<w;x++)n.push(R[x])}var E=null;if(p){var T=p.getIntersection(i);if(T!==null&&(i.isAnEndpoint(T)||(E=T),!p.isAnEndpoint(T)))for(var C=this._splitSafely(p,T),P=0,L=C.length;P<L;P++)n.push(C[P])}if(m!==null||E!==null){var B=null;if(m===null)B=E;else if(E===null)B=m;else{var z=fi.comparePoints(m,E);B=z<=0?m:E}this.queue.remove(i.rightSE),n.push(i.rightSE);for(var q=i.split(B),Z=0,se=q.length;Z<se;Z++)n.push(q[Z])}n.length>0?(this.tree.remove(i),n.push(r)):(this.segments.push(i),i.prev=d)}else{if(d&&p){var Se=d.getIntersection(p);if(Se!==null){if(!d.isAnEndpoint(Se))for(var qe=this._splitSafely(d,Se),Ae=0,$e=qe.length;Ae<$e;Ae++)n.push(qe[Ae]);if(!p.isAnEndpoint(Se))for(var ut=this._splitSafely(p,Se),Wt=0,gi=ut.length;Wt<gi;Wt++)n.push(ut[Wt])}}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}(),l6=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,qx=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,Gx=function(){function t(){Ar(this,t)}return Dt(t,[{key:"run",value:function(r,i,n){Hr.type=r,k1.reset();for(var o=[new o6(i,!0)],a=0,c=n.length;a<c;a++)o.push(new o6(n[a],!1));if(Hr.numMultiPolys=o.length,Hr.type==="difference")for(var d=o[0],p=1;p<o.length;)rd(o[p].bbox,d.bbox)!==null?p++:o.splice(p,1);if(Hr.type==="intersection"){for(var m=0,S=o.length;m<S;m++)for(var R=o[m],x=m+1,w=o.length;x<w;x++)if(rd(R.bbox,o[x].bbox)===null)return[]}for(var E=new nd.default(fi.compare),T=0,C=o.length;T<C;T++)for(var P=o[T].getSweepEvents(),L=0,B=P.length;L<B;L++)if(E.insert(P[L]),E.size>l6)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 Wx(E),q=E.size,Z=E.pop();Z;){var se=Z.key;if(E.size===q){var Se=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(Se.id," ")+"[".concat(Se.leftSE.point.x,", ").concat(Se.leftSE.point.y,"] -> ")+"[".concat(Se.rightSE.point.x,", ").concat(Se.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(E.size>l6)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(z.segments.length>qx)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var qe=z.process(se),Ae=0,$e=qe.length;Ae<$e;Ae++){var ut=qe[Ae];ut.consumedBy===void 0&&E.insert(ut)}q=E.size,Z=E.pop()}k1.reset();var Wt=Fx.factory(z.segments),gi=new Hx(Wt);return gi.getGeom()}}]),t}(),Hr=new Gx,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 Hr.run("union",e,i)},Kx=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 Hr.run("intersection",e,i)},Jx=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 Hr.run("xor",e,i)},Zx=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 Hr.run("difference",e,i)},Yx={union:Vx,intersection:Kx,xor:Jx,difference:Zx};c6.exports=Yx});var b6=V((od,ad)=>{(function(t,e){typeof od=="object"&&typeof ad<"u"?ad.exports=e():typeof define=="function"&&define.amd?define(e):t.proj4=e()})(od,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,c=6356752314e-3,d=.0066943799901413165,p=484813681109536e-20,m=Math.PI/2,S=.16666666666666666,R=.04722222222222222,x=.022156084656084655,w=1e-10,E=.017453292519943295,T=57.29577951308232,C=Math.PI/4,P=Math.PI*2,L=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}},q=/[\s_\-\/\(\)]/g;function Z(s,l){if(s[l])return s[l];for(var h=Object.keys(s),y=l.toLowerCase().replace(q,""),g=-1,v,M;++g<h.length;)if(v=h[g],M=v.toLowerCase().replace(q,""),M===y)return s[v]}var se=function(s){var l={},h=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,M={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=Z(z,b);A&&(l.to_meter=A.to_meter)},from_greenwich:function(b){l.from_greenwich=b*E},pm:function(b){var A=Z(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 h)g=h[y],y in M?(v=M[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},Se=1,qe=2,Ae=3,$e=4,ut=5,Wt=-1,gi=/\s/,xa=/[A-Za-z]/,Jc=/[A-Za-z84]/,Bn=/[,\]]/,Sa=/[\d\.E\-\+]/;function fr(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=Se}fr.prototype.readCharicter=function(){var s=this.text[this.place++];if(this.state!==$e)for(;gi.test(s);){if(this.place>=this.text.length)return;s=this.text[this.place++]}switch(this.state){case Se:return this.neutral(s);case qe:return this.keyword(s);case $e:return this.quoted(s);case ut:return this.afterquote(s);case Ae:return this.number(s);case Wt:return}},fr.prototype.afterquote=function(s){if(s==='"'){this.word+='"',this.state=$e;return}if(Bn.test(s)){this.word=this.word.trim(),this.afterItem(s);return}throw new Error(`havn't handled "`+s+'" in afterquote yet, index '+this.place)},fr.prototype.afterItem=function(s){if(s===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=Se;return}if(s==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=Se,this.currentObject=this.stack.pop(),this.currentObject||(this.state=Wt);return}},fr.prototype.number=function(s){if(Sa.test(s)){this.word+=s;return}if(Bn.test(s)){this.word=parseFloat(this.word),this.afterItem(s);return}throw new Error(`havn't handled "`+s+'" in number yet, index '+this.place)},fr.prototype.quoted=function(s){if(s==='"'){this.state=ut;return}this.word+=s},fr.prototype.keyword=function(s){if(Jc.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=Se;return}if(Bn.test(s)){this.afterItem(s);return}throw new Error(`havn't handled "`+s+'" in keyword yet, index '+this.place)},fr.prototype.neutral=function(s){if(xa.test(s)){this.word=s,this.state=qe;return}if(s==='"'){this.word="",this.state=$e;return}if(Sa.test(s)){this.word=s,this.state=Ae;return}if(Bn.test(s)){this.afterItem(s);return}throw new Error(`havn't handled "`+s+'" in neutral yet, index '+this.place)},fr.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===Wt)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function Ma(s){var l=new fr(s);return l.output()}function Bs(s,l,h){Array.isArray(l)&&(h.unshift(l),l=null);var y=l?{}:s,g=h.reduce(function(v,M){return yi(M,v),v},y);l&&(s[l]=g)}function yi(s,l){if(!Array.isArray(s)){l[s]=!0;return}var h=s.shift();if(h==="PARAMETER"&&(h=s.shift()),s.length===1){if(Array.isArray(s[0])){l[h]={},yi(s[0],l[h]);return}l[h]=s[0];return}if(!s.length){l[h]=!0;return}if(h==="TOWGS84"){l[h]=s;return}if(h==="AXIS"){h in l||(l[h]=[]),l[h].push(s);return}Array.isArray(h)||(l[h]={});var y;switch(h){case"UNIT":case"PRIMEM":case"VERT_DATUM":l[h]={name:s[0].toLowerCase(),convert:s[1]},s.length===3&&yi(s[2],l[h]);return;case"SPHEROID":case"ELLIPSOID":l[h]={name:s[0],a:s[1],rf:s[2]},s.length===4&&yi(s[3],l[h]);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]],Bs(l,h,s);return;default:for(y=-1;++y<s.length;)if(!Array.isArray(s[y]))return yi(s,l[h]);return Bs(l,h,s)}}var Zc=.017453292519943295;function Yc(s,l){var h=l[0],y=l[1];!(h in s)&&y in s&&(s[h]=s[y],l.length===3&&(s[h]=l[2](s[h])))}function ht(s){return s*Zc}function rr(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="",h=0,y=s.AXIS.length;h<y;++h){var g=[s.AXIS[h][0].toLowerCase(),s.AXIS[h][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 M(O){var D=s.to_meter||1;return O*D}var b=function(O){return Yc(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",ht],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",ht],["x0","false_easting",M],["y0","false_northing",M],["long0","central_meridian",ht],["lat0","latitude_of_origin",ht],["lat0","standard_parallel_1",ht],["lat1","standard_parallel_1",ht],["lat2","standard_parallel_2",ht],["azimuth","Azimuth"],["alpha","azimuth",ht],["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=ht(s.lat1>0?90:-90),s.lat_ts=s.lat1)}var Z1=function(s){var l=Ma(s),h=l.shift(),y=l.shift();l.unshift(["name",y]),l.unshift(["type",h]);var g={};return yi(l,g),rr(g),g};function mt(s){var l=this;if(arguments.length===2){var h=arguments[1];typeof h=="string"?h.charAt(0)==="+"?mt[s]=se(arguments[1]):mt[s]=Z1(arguments[1]):mt[s]=h}else if(arguments.length===1){if(Array.isArray(s))return s.map(function(y){Array.isArray(y)?mt.apply(l,y):mt(y)});if(typeof s=="string"){if(s in mt)return mt[s]}else"EPSG"in s?mt["EPSG:"+s.EPSG]=s:"ESRI"in s?mt["ESRI:"+s.ESRI]=s:"IAU2000"in s?mt["IAU2000:"+s.IAU2000]=s:console.log(s);return}}t(mt);function Or(s){return typeof s=="string"}function Ea(s){return s in mt}var Ra=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function Y1(s){return Ra.some(function(l){return s.indexOf(l)>-1})}var Xc=["3857","900913","3785","102113"];function X1(s){var l=Z(s,"authority");if(!!l){var h=Z(l,"epsg");return h&&Xc.indexOf(h)>-1}}function Ca(s){var l=Z(s,"extension");if(!!l)return Z(l,"proj4")}function Wi(s){return s[0]==="+"}function Q1(s){if(Or(s)){if(Ea(s))return mt[s];if(Y1(s)){var l=Z1(s);if(X1(l))return mt["EPSG:3857"];var h=Ca(l);return h?se(h):l}if(Wi(s))return se(s)}else return s}var Ds=function(s,l){s=s||{};var h,y;if(!l)return s;for(y in l)h=l[y],h!==void 0&&(s[y]=h);return s},It=function(s,l,h){var y=s*l;return h/Math.sqrt(1-y*y)},qi=function(s){return s<0?-1:1},Y=function(s){return Math.abs(s)<=L?s:s-qi(s)*P},ct=function(s,l,h){var y=s*h,g=.5*s;return y=Math.pow((1-y)/(1+y),g),Math.tan(.5*(m-l))/y},Lr=function(s,l){for(var h=.5*s,y,g,v=m-2*Math.atan(l),M=0;M<=15;M++)if(y=s*Math.sin(v),g=m-2*Math.atan(l*Math.pow((1-y)/(1+y),h))-v,v+=g,Math.abs(g)<=1e-10)return v;return-9999};function zs(){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=It(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function el(s){var l=s.x,h=s.y;if(h*T>90&&h*T<-90&&l*T>180&&l*T<-180)return null;var y,g;if(Math.abs(Math.abs(h)-m)<=w)return null;if(this.sphere)y=this.x0+this.a*this.k0*Y(l-this.long0),g=this.y0+this.a*this.k0*Math.log(Math.tan(C+.5*h));else{var v=Math.sin(h),M=ct(this.e,h,v);y=this.x0+this.a*this.k0*Y(l-this.long0),g=this.y0-this.a*this.k0*Math.log(M)}return s.x=y,s.y=g,s}function tl(s){var l=s.x-this.x0,h=s.y-this.y0,y,g;if(this.sphere)g=m-2*Math.atan(Math.exp(-h/(this.a*this.k0)));else{var v=Math.exp(-h/(this.a*this.k0));if(g=Lr(this.e,v),g===-9999)return null}return y=Y(this.long0+l/(this.a*this.k0)),s.x=y,s.y=g,s}var rl=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"],Qc={init:zs,forward:el,inverse:tl,names:rl};function il(){}function Aa(s){return s}var nl=["longlat","identity"],Dn={init:il,forward:Aa,inverse:Aa,names:nl},sl=[Qc,Dn],Ta={},bi=[];function Pa(s,l){var h=bi.length;return s.names?(bi[h]=s,s.names.forEach(function(y){Ta[y.toLowerCase()]=h}),this):(console.log(l),!0)}function eh(s){if(!s)return!1;var l=s.toLowerCase();if(typeof Ta[l]<"u"&&bi[Ta[l]])return bi[Ta[l]]}function ol(){sl.forEach(Pa)}var Ia={start:ol,add:Pa,get:eh},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 th=ue.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};ue.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};function Gr(s,l,h,y){var g=s*s,v=l*l,M=(g-v)/g,b=0;y?(s*=1-M*(S+M*(R+M*x)),g=s*s,M=0):b=Math.sqrt(M);var A=(g-v)/v;return{es:M,e:b,ep2:A}}function zn(s,l,h,y,g){if(!s){var v=Z(ue,y);v||(v=th),s=v.a,l=v.b,h=v.rf}return h&&!l&&(l=(1-1/h)*s),(h===0||Math.abs(s-l)<w)&&(g=!0,l=s),{a:s,b:l,rf:h,sphere:g}}var Xe={};Xe.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},Xe.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},Xe.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},Xe.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},Xe.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},Xe.potsdam={towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},Xe.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},Xe.hermannskogel={towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},Xe.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},Xe.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},Xe.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},Xe.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},Xe.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"},Xe.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},Xe.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},Xe.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},Xe.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};function vi(s,l,h,y,g,v,M){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]*=p,b.datum_params[4]*=p,b.datum_params[5]*=p,b.datum_params[6]=b.datum_params[6]/1e6+1)),M&&(b.datum_type=i,b.grids=M),b.a=h,b.b=y,b.es=g,b.ep2=v,b}var js={};function wi(s,l){var h=new DataView(l),y=Us(h),g=ll(h,y);g.nSubgrids>1&&console.log("Only single NTv2 subgrids are currently supported, subsequent sub grids are ignored");var v=ul(h,g,y),M={header:g,subgrids:v};return js[s]=M,M}function al(s){if(s===void 0)return null;var l=s.split(",");return l.map(Oa)}function Oa(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:js[s]||null,isNull:!1}}function _i(s){return s/3600*Math.PI/180}function Us(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 ll(s,l){return{nFields:s.getInt32(8,l),nSubgridFields:s.getInt32(24,l),nSubgrids:s.getInt32(40,l),shiftType:$s(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 $s(s,l,h){return String.fromCharCode.apply(null,new Uint8Array(s.buffer.slice(l,h)))}function ul(s,l,h){for(var y=176,g=[],v=0;v<l.nSubgrids;v++){var M=cl(s,y,h),b=rh(s,y,M,h),A=Math.round(1+(M.upperLongitude-M.lowerLongitude)/M.longitudeInterval),O=Math.round(1+(M.upperLatitude-M.lowerLatitude)/M.latitudeInterval);g.push({ll:[_i(M.lowerLongitude),_i(M.lowerLatitude)],del:[_i(M.longitudeInterval),_i(M.latitudeInterval)],lim:[A,O],count:M.gridNodeCount,cvs:La(b)})}return g}function La(s){return s.map(function(l){return[_i(l.longitudeShift),_i(l.latitudeShift)]})}function cl(s,l,h){return{name:$s(s,l+8,l+16).trim(),parent:$s(s,l+24,l+24+8).trim(),lowerLatitude:s.getFloat64(l+72,h),upperLatitude:s.getFloat64(l+88,h),lowerLongitude:s.getFloat64(l+104,h),upperLongitude:s.getFloat64(l+120,h),latitudeInterval:s.getFloat64(l+136,h),longitudeInterval:s.getFloat64(l+152,h),gridNodeCount:s.getInt32(l+168,h)}}function rh(s,l,h,y){for(var g=l+176,v=16,M=[],b=0;b<h.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)};M.push(A)}return M}function dr(s,l){if(!(this instanceof dr))return new dr(s);l=l||function(O){if(O)throw O};var h=Q1(s);if(typeof h!="object"){l(s);return}var y=dr.projections.get(h.projName);if(!y){l(s);return}if(h.datumCode&&h.datumCode!=="none"){var g=Z(Xe,h.datumCode);g&&(h.datum_params=h.datum_params||(g.towgs84?g.towgs84.split(","):null),h.ellps=g.ellipse,h.datumName=g.datumName?g.datumName:h.datumCode)}h.k0=h.k0||1,h.axis=h.axis||"enu",h.ellps=h.ellps||"wgs84",h.lat1=h.lat1||h.lat0;var v=zn(h.a,h.b,h.rf,h.ellps,h.sphere),M=Gr(v.a,v.b,v.rf,h.R_A),b=al(h.nadgrids),A=h.datum||vi(h.datumCode,h.datum_params,v.a,v.b,M.es,M.ep2,b);Ds(this,h),Ds(this,y),this.a=v.a,this.b=v.b,this.rf=v.rf,this.sphere=v.sphere,this.es=M.es,this.e=M.e,this.ep2=M.ep2,this.datum=A,this.init(),l(null,this)}dr.projections=Ia,dr.projections.start();function ih(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 ka(s,l,h){var y=s.x,g=s.y,v=s.z?s.z:0,M,b,A,O;if(g<-m&&g>-1.001*m)g=-m;else if(g>m&&g<1.001*m)g=m;else{if(g<-m)return{x:-1/0,y:-1/0,z:s.z};if(g>m)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,M=h/Math.sqrt(1-l*A),{x:(M+v)*O*Math.cos(y),y:(M+v)*O*Math.sin(y),z:(M*(1-l)+v)*b}}function jn(s,l,h,y){var g=1e-12,v=g*g,M=30,b,A,O,D,k,j,W,H,G,K,ie,he,ye,Je=s.x,De=s.y,He=s.z?s.z:0,Et,nt,ti;if(b=Math.sqrt(Je*Je+De*De),A=Math.sqrt(Je*Je+De*De+He*He),b/h<g){if(Et=0,A/h<g)return nt=m,ti=-y,{x:s.x,y:s.y,z:s.z}}else Et=Math.atan2(De,Je);O=He/A,D=b/A,k=1/Math.sqrt(1-l*(2-l)*D*D),H=D*(1-l)*k,G=O*k,ye=0;do ye++,W=h/Math.sqrt(1-l*G*G),ti=b*H+He*G-W*(1-l*G*G),j=l*W/(W+ti),k=1/Math.sqrt(1-j*(2-j)*D*D),K=D*(1-j)*k,ie=O*k,he=ie*H-K*G,H=K,G=ie;while(he*he>v&&ye<M);return nt=Math.atan(ie/Math.abs(K)),{x:Et,y:nt,z:ti}}function nh(s,l,h){if(l===e)return{x:s.x+h[0],y:s.y+h[1],z:s.z+h[2]};if(l===r){var y=h[0],g=h[1],v=h[2],M=h[3],b=h[4],A=h[5],O=h[6];return{x:O*(s.x-A*s.y+b*s.z)+y,y:O*(A*s.x+s.y-M*s.z)+g,z:O*(-b*s.x+M*s.y+s.z)+v}}}function Fs(s,l,h){if(l===e)return{x:s.x-h[0],y:s.y-h[1],z:s.z-h[2]};if(l===r){var y=h[0],g=h[1],v=h[2],M=h[3],b=h[4],A=h[5],O=h[6],D=(s.x-y)/O,k=(s.y-g)/O,j=(s.z-v)/O;return{x:D+A*k-b*j,y:-A*D+k+M*j,z:b*D-M*k+j}}}function Vr(s){return s===e||s===r}var Hs=function(s,l,h){if(ih(s,l)||s.datum_type===o||l.datum_type===o)return h;var y=s.a,g=s.es;if(s.datum_type===i){var v=qt(s,!1,h);if(v!==0)return;y=a,g=d}var M=l.a,b=l.b,A=l.es;if(l.datum_type===i&&(M=a,b=c,A=d),g===A&&y===M&&!Vr(s.datum_type)&&!Vr(l.datum_type))return h;if(h=ka(h,g,y),Vr(s.datum_type)&&(h=nh(h,s.datum_type,s.datum_params)),Vr(l.datum_type)&&(h=Fs(h,l.datum_type,l.datum_params)),h=jn(h,A,M,b),l.datum_type===i){var O=qt(l,!0,h);if(O!==0)return}return h};function qt(s,l,h){if(s.grids===null||s.grids.length===0)return console.log("Grid shift grids not found"),-1;for(var y={x:-h.x,y:h.y},g={x:Number.NaN,y:Number.NaN},v=[],M=0;M<s.grids.length;M++){var b=s.grids[M];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,k=A.ll[1]-O,j=A.ll[0]+(A.lim[0]-1)*A.del[0]+O,W=A.ll[1]+(A.lim[1]-1)*A.del[1]+O;if(!(k>y.y||D>y.x||W<y.y||j<y.x)&&(g=Na(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):(h.x=-g.x,h.y=g.y,0)}function Na(s,l,h){var y={x:Number.NaN,y:Number.NaN};if(isNaN(s.x))return y;var g={x:s.x,y:s.y};g.x-=h.ll[0],g.y-=h.ll[1],g.x=Y(g.x-Math.PI)+Math.PI;var v=Ba(g,h);if(l){if(isNaN(v.x))return y;v.x=g.x-v.x,v.y=g.y-v.y;var M=9,b=1e-12,A,O;do{if(O=Ba(v,h),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(M--&&Math.abs(A.x)>b&&Math.abs(A.y)>b);if(M<0)return console.log("Inverse grid shift iterator failed to converge."),y;y.x=Y(v.x+h.ll[0]),y.y=v.y+h.ll[1]}else isNaN(v.x)||(y.x=s.x+v.x,y.y=s.y+v.y);return y}function Ba(s,l){var h={x:s.x/l.del[0],y:s.y/l.del[1]},y={x:Math.floor(h.x),y:Math.floor(h.y)},g={x:h.x-1*y.x,y:h.y-1*y.y},v={x:Number.NaN,y:Number.NaN},M;if(y.x<0||y.x>=l.lim[0]||y.y<0||y.y>=l.lim[1])return v;M=y.y*l.lim[0]+y.x;var b={x:l.cvs[M][0],y:l.cvs[M][1]};M++;var A={x:l.cvs[M][0],y:l.cvs[M][1]};M+=l.lim[0];var O={x:l.cvs[M][0],y:l.cvs[M][1]};M--;var D={x:l.cvs[M][0],y:l.cvs[M][1]},k=g.x*g.y,j=g.x*(1-g.y),W=(1-g.x)*(1-g.y),H=(1-g.x)*g.y;return v.x=W*b.x+j*A.x+H*D.x+k*O.x,v.y=W*b.y+j*A.y+H*D.y+k*O.y,v}var Un=function(s,l,h){var y=h.x,g=h.y,v=h.z||0,M,b,A,O={};for(A=0;A<3;A++)if(!(l&&A===2&&h.z===void 0))switch(A===0?(M=y,"ew".indexOf(s.axis[A])!==-1?b="x":b="y"):A===1?(M=g,"ns".indexOf(s.axis[A])!==-1?b="y":b="x"):(M=v,b="z"),s.axis[A]){case"e":O[b]=M;break;case"w":O[b]=-M;break;case"n":O[b]=M;break;case"s":O[b]=-M;break;case"u":h[b]!==void 0&&(O.z=M);break;case"d":h[b]!==void 0&&(O.z=-M);break;default:return null}return O},$n=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},hl=function(s){fl(s.x),fl(s.y)};function fl(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 sh(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 Gi(s,l,h,y){var g;if(Array.isArray(h)&&(h=$n(h)),hl(h),s.datum&&l.datum&&sh(s,l)&&(g=new dr("WGS84"),h=Gi(s,g,h,y),s=g),y&&s.axis!=="enu"&&(h=Un(s,!1,h)),s.projName==="longlat")h={x:h.x*E,y:h.y*E,z:h.z||0};else if(s.to_meter&&(h={x:h.x*s.to_meter,y:h.y*s.to_meter,z:h.z||0}),h=s.inverse(h),!h)return;if(s.from_greenwich&&(h.x+=s.from_greenwich),h=Hs(s.datum,l.datum,h),!!h)return l.from_greenwich&&(h={x:h.x-l.from_greenwich,y:h.y,z:h.z||0}),l.projName==="longlat"?h={x:h.x*T,y:h.y*T,z:h.z||0}:(h=l.forward(h),l.to_meter&&(h={x:h.x/l.to_meter,y:h.y/l.to_meter,z:h.z||0})),y&&l.axis!=="enu"?Un(l,!0,h):h}var Vi=dr("WGS84");function Ws(s,l,h,y){var g,v,M;return Array.isArray(h)?(g=Gi(s,l,h,y)||{x:NaN,y:NaN},h.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(h.splice(3)):[g.x,g.y,h[2]].concat(h.splice(3)):[g.x,g.y].concat(h.splice(2)):[g.x,g.y]):(v=Gi(s,l,h,y),M=Object.keys(h),M.length===2||M.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]=h[b]}),v)}function Da(s){return s instanceof dr?s:s.oProj?s.oProj:dr(s)}function Ot(s,l,h){s=Da(s);var y=!1,g;return typeof l>"u"?(l=s,s=Vi,y=!0):(typeof l.x<"u"||Array.isArray(l))&&(h=l,l=s,s=Vi,y=!0),l=Da(l),h?Ws(s,l,h):(g={forward:function(v,M){return Ws(s,l,v,M)},inverse:function(v,M){return Ws(l,s,v,M)}},y&&(g.oProj=l),g)}var za=6,qs="AJSAJS",Ki="AFAFAF",Gt=65,yt=73,bt=79,kr=86,Kr=90,Gs={forward:dl,inverse:oh,toPoint:ml};function dl(s,l){return l=l||5,uh(ah({lat:s[1],lon:s[0]}),l)}function oh(s){var l=Vs(yl(s.toUpperCase()));return l.lat&&l.lon?[l.lon,l.lat,l.lon,l.lat]:[l.left,l.bottom,l.right,l.top]}function ml(s){var l=Vs(yl(s.toUpperCase()));return l.lat&&l.lon?[l.lon,l.lat]:[(l.left+l.right)/2,(l.top+l.bottom)/2]}function ja(s){return s*(Math.PI/180)}function pl(s){return 180*(s/Math.PI)}function ah(s){var l=s.lat,h=s.lon,y=6378137,g=.00669438,v=.9996,M,b,A,O,D,k,j,W=ja(l),H=ja(h),G,K;K=Math.floor((h+180)/6)+1,h===180&&(K=60),l>=56&&l<64&&h>=3&&h<12&&(K=32),l>=72&&l<84&&(h>=0&&h<9?K=31:h>=9&&h<21?K=33:h>=21&&h<33?K=35:h>=33&&h<42&&(K=37)),M=(K-1)*6-180+3,G=ja(M),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),k=Math.cos(W)*(H-G),j=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*(k+(1-O+D)*k*k*k/6+(5-18*O+O*O+72*D-58*b)*k*k*k*k*k/120)+5e5,he=v*(j+A*Math.tan(W)*(k*k/2+(5-O+9*D+4*D*D)*k*k*k*k/24+(61-58*O+O*O+600*D-330*b)*k*k*k*k*k*k/720));return l<0&&(he+=1e7),{northing:Math.round(he),easting:Math.round(ie),zoneNumber:K,zoneLetter:lh(l)}}function Vs(s){var l=s.northing,h=s.easting,y=s.zoneLetter,g=s.zoneNumber;if(g<0||g>60)return null;var v=.9996,M=6378137,b=.00669438,A,O=(1-Math.sqrt(1-b))/(1+Math.sqrt(1-b)),D,k,j,W,H,G,K,ie,he,ye=h-5e5,Je=l;y<"N"&&(Je-=1e7),K=(g-1)*6-180+3,A=b/(1-b),G=Je/v,ie=G/(M*(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=M/Math.sqrt(1-b*Math.sin(he)*Math.sin(he)),k=Math.tan(he)*Math.tan(he),j=A*Math.cos(he)*Math.cos(he),W=M*(1-b)/Math.pow(1-b*Math.sin(he)*Math.sin(he),1.5),H=ye/(D*v);var De=he-D*Math.tan(he)/W*(H*H/2-(5+3*k+10*j-4*j*j-9*A)*H*H*H*H/24+(61+90*k+298*j+45*k*k-252*A-3*j*j)*H*H*H*H*H*H/720);De=pl(De);var He=(H-(1+2*k+j)*H*H*H/6+(5-2*j+28*k-3*j*j+8*A+24*k*k)*H*H*H*H*H/120)/Math.cos(he);He=K+pl(He);var Et;if(s.accuracy){var nt=Vs({northing:s.northing+s.accuracy,easting:s.easting+s.accuracy,zoneLetter:s.zoneLetter,zoneNumber:s.zoneNumber});Et={top:nt.lat,right:nt.lon,bottom:De,left:He}}else Et={lat:De,lon:He};return Et}function lh(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 uh(s,l){var h="00000"+s.easting,y="00000"+s.northing;return s.zoneNumber+s.zoneLetter+ch(s.easting,s.northing,s.zoneNumber)+h.substr(h.length-5,l)+y.substr(y.length-5,l)}function ch(s,l,h){var y=Ji(h),g=Math.floor(s/1e5),v=Math.floor(l/1e5)%20;return gl(g,v,y)}function Ji(s){var l=s%za;return l===0&&(l=za),l}function gl(s,l,h){var y=h-1,g=qs.charCodeAt(y),v=Ki.charCodeAt(y),M=g+s-1,b=v+l,A=!1;M>Kr&&(M=M-Kr+Gt-1,A=!0),(M===yt||g<yt&&M>yt||(M>yt||g<yt)&&A)&&M++,(M===bt||g<bt&&M>bt||(M>bt||g<bt)&&A)&&(M++,M===yt&&M++),M>Kr&&(M=M-Kr+Gt-1),b>kr?(b=b-kr+Gt-1,A=!0):A=!1,(b===yt||v<yt&&b>yt||(b>yt||v<yt)&&A)&&b++,(b===bt||v<bt&&b>bt||(b>bt||v<bt)&&A)&&(b++,b===yt&&b++),b>kr&&(b=b-kr+Gt-1);var O=String.fromCharCode(M)+String.fromCharCode(b);return O}function yl(s){if(s&&s.length===0)throw"MGRSPoint coverting from nothing";for(var l=s.length,h=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 M=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;h=s.substring(v,v+=2);for(var A=Ji(M),O=bl(h.charAt(0),A),D=Zi(h.charAt(1),A);D<Yi(b);)D+=2e6;var k=l-v;if(k%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,ye;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,ye=F+D,{easting:he,northing:ye,zoneLetter:b,zoneNumber:S,accuracy:G}}function ul(s,l){for(var c=Us.charCodeAt(l-1),y=1e5,g=!1;c!==s.charCodeAt(0);){if(c++,c===pt&&c++,c===gt&&c++,c>Hr){if(g)throw"Bad character: "+s;c=qt,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===pt&&c++,c===gt&&c++,c>Ir){if(g)throw"Bad character: "+s;c=qt,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(sl(s))},Or.prototype.toMGRS=function(s){return nl([this.x,this.y],s)};var hl=1,rc=.25,$s=.046875,Fs=.01953125,Ws=.01068115234375,ic=.75,nc=.46875,sc=.013020833333333334,oc=.007120768229166667,dr=.3645833333333333,ac=.005696614583333333,lc=.3076171875,cl=function(s){var l=[];l[0]=hl-s*(rc+s*($s+s*(Fs+s*Ws))),l[1]=s*(ic-s*($s+s*(Fs+s*Ws)));var c=s*s;return l[2]=c*(nc-s*(sc+s*oc)),c*=s,l[3]=c*(dr-s*ac),l[4]=c*s*lc,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])))},Oa=20,Ki=function(s,l,c){for(var y=1/(1-l),g=s,v=Oa;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=cl(this.es),this.ml0=vi(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function uc(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 fl(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,ye=Math.pow(he,2);l=l*W,y=c-l*ye/(1-this.es)*.5*(1-ye/12*(5+3*K-9*F*K+F-4*G-ye/30*(61+90*K-252*F*K+45*ie+46*F-ye/56*(1385+3633*K+4095*ie+1574*ie*K)))),g=Z(this.long0+he*(1-ye/6*(1+2*K+F-ye/20*(5+28*K+24*ie+8*F*K+6*F-ye/42*(61+662*K+1320*ie+720*ie*K))))/U)}else y=p*qi(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 hc=["Fast_Transverse_Mercator","Fast Transverse Mercator"],Hs={init:wi,forward:uc,inverse:fl,names:hc},ka=function(s){var l=Math.exp(s);return l=(l-1/l)/2,l},tr=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))},dl=function(s){var l=1+s,c=l-1;return c===0?s:s*Math.log(l)/c},ml=function(s){var l=Math.abs(s);return l=dl(l*(1+l/(tr(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},La=function(s){var l=Math.exp(s);return l=(l+1/l)/2,l},Na=function(s,l,c){for(var y=Math.sin(l),g=Math.cos(l),v=ka(c),S=La(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 cc(){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,tr(y,g*S)),l=ml(Math.tan(l));var b=Na(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 fc(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=Na(this.utg,2*c,2*l);c=c+v[0],l=l+v[1],l=Math.atan(ka(l));var S=Math.sin(c),b=Math.cos(c),A=Math.sin(l),O=Math.cos(l);c=Math.atan2(S*O,tr(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 dc=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","tmerc"],Dn={init:cc,forward:Vs,inverse:fc,names:dc},mc=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 Ba(){var s=mc(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,Dn.init.apply(this),this.forward=Dn.forward,this.inverse=Dn.inverse}var pc=["Universal Transverse Mercator System","utm"],gc={init:Ba,names:pc,dependsOn:Ks},zn=function(s,l){return Math.pow((1-s)/(1+s),l)},pl=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)*zn(this.e*s,this.ratexp))}function Da(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)*zn(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=pl;v>0&&(y=2*Math.atan(g*zn(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 Un=["gauss"],Zi={init:Js,forward:Da,inverse:_i,names:Un};function gl(){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 yc(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 za(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 bc=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"],yl={init:gl,forward:yc,inverse:za,names:bc};function Zs(s,l,c){return l*=c,Math.tan(.5*(p+s))*Math.pow((1-l)/(1+l),.5*c)}function Ua(){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+qi(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))/lt(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 bl(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=lt(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 vl(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*Pr(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*Pr(this.e,Math.tan(.5*(p+v)));return s.x=l,s.y=c,s}var vc=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],wc={init:Ua,forward:bl,inverse:vl,names:vc,ssfn_:Zs};function ja(){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 wl(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 _c(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 xc=["somerc"],Sc={init:ja,forward:wl,inverse:_c,names:xc},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 ye=!1;if("rectified_grid_angle"in this&&(ye=!0),he&&(ie=this.alpha),ye&&(D=this.rectified_grid_angle*E),he||ye)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 We=1-this.es;l=Math.sqrt(We),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/We),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(lt(this.e,this.lat0,b),this.B)):(this.B=1/l,this.A=this.k0,this.E=y=g=1),he||ye?(he?(L=Math.asin(Math.sin(ie)/y),ye||(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(lt(this.e,G,Math.sin(G)),this.B),S=Math.pow(lt(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-=P:s>Math.pi&&(F+=P),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 jn(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(lt(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 _l(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=Pr(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"],qn={init:Ys,forward:jn,inverse:_l,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=lt(this.e,this.lat1,l),v=Math.sin(this.lat2),S=Math.cos(this.lat2),b=Tt(this.e,v,S),A=lt(this.e,this.lat2,v),O=lt(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=qi(c)*(p-2*w));var y=Math.abs(Math.abs(c)-p),g,v;if(y>w)g=lt(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 qa(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=Pr(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 Mc=["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:qa,names:Mc};function xl(){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 Ec(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 Rc=["Krovak","krovak"],Cc={init:xl,forward:Ec,inverse:eo,names:Rc},yt=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))},Fn=function(s){return .375*s*(1+.25*s*(1+.46875*s))},Wn=function(s){return .05859375*s*s*(1+.75*s)},Hn=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-qi(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 Ac(){this.sphere||(this.e0=$n(this.es),this.e1=Fn(this.es),this.e2=Wn(this.es),this.e3=Hn(this.es),this.ml0=this.a*yt(this.e0,this.e1,this.e2,this.e3,this.lat0))}function Sl(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*yt(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 Tc(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:Ac,forward:Sl,inverse:Tc,names:Pc},mr=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},Ml=1,$a=2,Kr=3,Jr=4;function rr(){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=mr(this.e,1),this.mmf=.5/(1-this.es),this.apa=Pl(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=mr(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 Gn(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=mr(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 El(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,Rl=.17222222222222222,Cl=.10257936507936508,ro=.06388888888888888,Al=.0664021164021164,Tl=.016415012942191543;function Pl(s){var l,c=[];return c[0]=s*Si,l=s*s,c[0]+=l*Rl,c[1]=l*ro,l*=s,c[0]+=l*Cl,c[1]+=l*Al,c[2]=l*Tl,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"],Ol={init:rr,forward:Gn,inverse:El,names:Il,S_POLE:Ml,N_POLE:$a,EQUIT:Kr,OBLIQ:Jr},Zr=function(s){return Math.abs(s)>1&&(s=s>1?1:-1),Math.asin(s)};function Ic(){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=mr(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=mr(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=mr(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 Oc(s){var l=s.x,c=s.y;this.sin_phi=Math.sin(c),this.cos_phi=Math.cos(c);var y=mr(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 kc(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 Lc=["Albers_Conic_Equal_Area","Albers","aea"],kl={init:Ic,forward:Oc,inverse:kc,names:Lc,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 Vn=["gnom"],lo={init:so,forward:oo,inverse:ao,names:Vn},Nc=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 Bc(){this.sphere||(this.k0=Tt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function Ll(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=mr(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 Nl(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=Nc(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 Dc=["cea"],Bl={init:Bc,forward:Ll,inverse:Nl,names:Dc};function zc(){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 Uc(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 jc(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"],$c={init:zc,forward:Uc,inverse:jc,names:qc},Kn=20;function Dl(){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=Fn(this.es),this.e2=Wn(this.es),this.e3=Hn(this.es),this.ml0=this.a*yt(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*yt(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=Kn;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=Kn;v;--v)if(G=this.e*Math.sin(A),L=Math.sqrt(1-G*G)*Math.tan(A),U=this.a*yt(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"],I={init:Dl,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 $(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,ye=S,We=b;for(l=2;l<=6;l++)ie=G*U-K*W,he=K*U+G*W,G=ie,K=he,ye=ye+(l-1)*(this.B_re[l]*G-this.B_im[l]*K),We=We+(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=(ye*ke+We*De)/St,W=(We*ke-ye*De)/St}var rt=U,Xr=W,Jn=1,Zn=0;for(l=1;l<=9;l++)Jn=Jn*rt,Zn=Zn+this.D[l]*Jn;var ql=this.lat0+Zn*m*1e5,Kg=this.long0+Xr;return s.x=Kg,s.y=ql,s}var te=["New_Zealand_Map_Grid","nzmg"],fe={init:N,forward:j,inverse:$,names:te};function _e(){}function Pe(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 Ie(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 tt=["Miller_Cylindrical","mill"],ir={init:_e,forward:Pe,inverse:Ie,names:tt},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=cl(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 bt(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:bt,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 ge(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 qe=["Mollweide","moll"],It={init:Lr,forward:ne,inverse:ge,names:qe};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=Fn(this.es),this.e2=Wn(this.es),this.e3=Hn(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=yt(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=yt(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=yt(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=yt(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"],zl={init:rn,forward:nn,inverse:sn,names:uo};function Fa(){this.R=this.a}function sg(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 og(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 ag=["Van_der_Grinten_I","VanDerGrinten","vandg"],lg={init:Fa,forward:sg,inverse:og,names:ag};function ug(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)}function hg(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,ye,We,ke,De,St,rt,Xr,Jn,Zn,ql;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=Fn(this.es),A=Wn(this.es),O=Hn(this.es),Math.abs(this.sin_p12-1)<=w?(D=this.a*yt(S,b,A,O,p),L=this.a*yt(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*yt(S,b,A,O,p),L=this.a*yt(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?rt=Math.asin(this.cos_p12*Math.sin(G)-this.sin_p12*Math.cos(G)):Math.abs(Math.abs(K)-Math.PI)<=w?rt=-Math.asin(this.cos_p12*Math.sin(G)-this.sin_p12*Math.cos(G)):rt=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),ye=ie*he,We=he*he,Xr=rt*rt,Jn=Xr*rt,Zn=Jn*rt,ql=Zn*rt,ke=W*rt*(1-Xr*We*(1-We)/6+Jn/8*ye*(1-2*We)+Zn/120*(We*(4-7*We)-3*ie*ie*(1-7*We))-ql/48*ye),s.x=this.x0+ke*Math.sin(K),s.y=this.y0+ke*Math.cos(K),s))}function cg(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,ye,We,ke,De,St,rt;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=Fn(this.es),D=Wn(this.es),L=Hn(this.es),Math.abs(this.sin_p12-1)<=w?(U=this.a*yt(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*yt(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,ye=-he*he/(1-this.es),We=3*this.es*(1-ye)*this.sin_p12*this.cos_p12*ie/(1-this.es),ke=l/F,De=ke-ye*(1+ye)*Math.pow(ke,3)/6-We*(1+3*ye)*Math.pow(ke,4)/24,St=1-ye*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))),rt=Math.sin(G),S=Math.atan2((rt-this.es*St*this.sin_p12)*Math.tan(G),rt*(1-this.es)),s.x=v,s.y=S,s))}var fg=["Azimuthal_Equidistant","aeqd"],dg={init:ug,forward:hg,inverse:cg,names:fg};function mg(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function pg(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 gg(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 yg=["ortho"],bg={init:mg,forward:pg,inverse:gg,names:yg},et={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 vg(){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=et.TOP:this.lat0<=-(p-C/2)?this.face=et.BOTTOM:Math.abs(this.long0)<=C?this.face=et.FRONT:Math.abs(this.long0)<=p+C?this.face=this.long0>0?et.RIGHT:et.LEFT:this.face=et.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 wg(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===et.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===et.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===et.RIGHT?y=ho(y,+p):this.face===et.BACK?y=ho(y,+k):this.face===et.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===et.FRONT?(v=Math.acos(O),g=Ul(v,L,D,A)):this.face===et.RIGHT?(v=Math.acos(D),g=Ul(v,L,-O,A)):this.face===et.BACK?(v=Math.acos(-O),g=Ul(v,L,-D,A)):this.face===et.LEFT?(v=Math.acos(-D),g=Ul(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 _g(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===et.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===et.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===et.RIGHT?(D=U,U=-W,W=D):this.face===et.BACK?(U=-U,W=-W):this.face===et.LEFT&&(D=U,U=W,W=-D),l.phi=Math.acos(-F)-p,l.lam=Math.atan2(W,U),this.face===et.RIGHT?l.lam=ho(l.lam,-p):this.face===et.BACK?l.lam=ho(l.lam,-k):this.face===et.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 Ul(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+=P:c>+k&&(c-=P),c}var xg=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],Sg={init:vg,forward:wg,inverse:_g,names:xg},Fc=[[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]],Wa=[[-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,Mg=1/Zd,co=18,jl=function(s,l){return s[0]+l*(s[1]+l*(s[2]+l*s[3]))},Eg=function(s,l){return s[1]+l*(2*s[2]+l*3*s[3])};function Rg(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 Cg(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function Ag(s){var l=Z(s.x-this.long0),c=Math.abs(s.y),y=Math.floor(c*Zd);y<0?y=0:y>=co&&(y=co-1),c=T*(c-Mg*y);var g={x:jl(Fc[y],c)*l,y:jl(Wa[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 Tg(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/=Fc[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(Wa[c][0]>l.y)--c;else if(Wa[c+1][0]<=l.y)++c;else break;var y=Wa[c],g=5*(l.y-y[0])/(Wa[c+1][0]-y[0]);g=Rg(function(v){return(jl(y,v)-l.y)/Eg(y,v)},g,w,100),l.x/=jl(Fc[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 Pg=["Robinson","robin"],Ig={init:Cg,forward:Ag,inverse:Tg,names:Pg};function Og(){this.name="geocent"}function kg(s){var l=Ra(s,this.es,this.a);return l}function Lg(s){var l=Ln(s,this.es,this.a,this.b);return l}var Ng=["Geocentric","geocentric","geocent","Geocent"],Bg={init:Og,forward:kg,inverse:Lg,names:Ng},xt={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},Ha={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 Dg(){if(Object.keys(Ha).forEach(function(c){if(typeof this[c]>"u")this[c]=Ha[c].def;else{if(Ha[c].num&&isNaN(this[c]))throw new Error("Invalid parameter value, must be numeric "+c+" = "+this[c]);Ha[c].num&&(this[c]=parseFloat(this[c]))}Ha[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 zg(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 Ug(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=tr(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 jg=["Tilted_Perspective","tpers"],qg={init:Dg,forward:zg,inverse:Ug,names:jg};function $g(){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 Fg(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/tr(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/tr(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/tr(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/tr(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/tr(v,y))));return s.x=s.x*this.a,s.y=s.y*this.a,s}function Wg(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)*tr(1,y)):(c=Math.tan(s.x/this.radius_g_1),y=Math.tan(s.y/this.radius_g_1)*tr(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 Hg=["Geostationary Satellite View","Geostationary_Satellite","geos"],Gg={init:$g,forward:Fg,inverse:Wg,names:Hg},Vg=function(s){s.Proj.projections.add(Hs),s.Proj.projections.add(Dn),s.Proj.projections.add(gc),s.Proj.projections.add(yl),s.Proj.projections.add(wc),s.Proj.projections.add(Sc),s.Proj.projections.add(qn),s.Proj.projections.add(Xi),s.Proj.projections.add(Cc),s.Proj.projections.add(Vr),s.Proj.projections.add(Ol),s.Proj.projections.add(kl),s.Proj.projections.add(lo),s.Proj.projections.add(Bl),s.Proj.projections.add($c),s.Proj.projections.add(I),s.Proj.projections.add(fe),s.Proj.projections.add(ir),s.Proj.projections.add($t),s.Proj.projections.add(It),s.Proj.projections.add(zl),s.Proj.projections.add(lg),s.Proj.projections.add(dg),s.Proj.projections.add(bg),s.Proj.projections.add(Sg),s.Proj.projections.add(Ig),s.Proj.projections.add(Bg),s.Proj.projections.add(qg),s.Proj.projections.add(Gg)};return Pt.defaultDatum="WGS84",Pt.Proj=fr,Pt.WGS84=new Pt.Proj("WGS84"),Pt.Point=Or,Pt.toPoint=Bn,Pt.defs=dt,Pt.nadgrid=yi,Pt.transform=$i,Pt.mgrs=js,Pt.version="2.8.0",Vg(Pt),Pt})});var A1=V((oI,y6)=>{y6.exports={ROOT:0,GROUP:1,POSITION:2,SET:3,RANGE:4,REPETITION:5,REFERENCE:6,CHAR:7}});var td=V(En=>{var ze=A1(),ed=()=>[{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(ed()),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}],$x=()=>[{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:ed(),not:!1});En.notInts=()=>({type:ze.SET,set:ed(),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:$x(),not:!0})});var _6=V(T1=>{var w6=A1(),ra=td(),Fx="@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?",Wx={"0":0,t:9,n:10,v:11,f:12,r:13};T1.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?Fx.indexOf(d):Wx[m],M=String.fromCharCode(p);return/[[\]{}^$.|?*+()]/.test(M)&&(M="\\"+M),M}),t};T1.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(ra.words());else if(n[2])r.push(ra.ints());else if(n[3])r.push(ra.whitespace());else if(n[4])r.push(ra.notWords());else if(n[5])r.push(ra.notInts());else if(n[6])r.push(ra.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];T1.error(e,"Unterminated character class")};T1.error=(t,e)=>{throw new SyntaxError("Invalid regular expression: /"+t+"/: "+e)}});var x6=V(P1=>{var eh=A1();P1.wordBoundary=()=>({type:eh.POSITION,value:"b"});P1.nonWordBoundary=()=>({type:eh.POSITION,value:"B"});P1.begin=()=>({type:eh.POSITION,value:"^"});P1.end=()=>({type:eh.POSITION,value:"$"})});var S6=V((hI,rd)=>{var ia=_6(),Rr=A1(),xs=td(),th=x6();rd.exports=t=>{var e=0,r,i,n={type:Rr.ROOT,stack:[]},o=n,a=n.stack,h=[],d=C=>{ia.error(t,`Nothing to repeat at column ${C-1}`)},m=ia.strToChars(t);for(r=m.length;e<r;)switch(i=m[e++],i){case"\\":switch(i=m[e++],i){case"b":a.push(th.wordBoundary());break;case"B":a.push(th.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(th.begin());break;case"$":a.push(th.end());break;case"[":var p;m[e]==="^"?(p=!0,e++):p=!1;var M=ia.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!==":"&&ia.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&&ia.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&&ia.error(t,"Unterminated group"),n};rd.exports.types=Rr});var R6=V((cI,E6)=>{"use strict";var M6=S6(),Hx=M6.types;E6.exports=function(t,e){e||(e={});var r=e.limit===void 0?25:e.limit;Gx(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===Hx.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 Gx(t){return{}.toString.call(t)==="[object RegExp]"}});var A6=V((fI,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((dI,B6)=>{"use strict";var na=" ",sa="\u2502 ",T6="\u251C\u2500\u2500 ",P6="\u2514\u2500\u2500 ",I6="*",I1="/",O6=/(?=\/)/;function Vx(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"?Vx(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]=k6(i[n]))}),r}function Kx(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===I1).length){let o={path:I1,truncatedPath:"",methods:[],opts:[],handlers:[{}]};r.filter(a=>a.path===I6).length?r.splice(1,0,o):r.unshift(o)}let n=Jx(r);return n.forEach((o,a)=>{i+=L6(o,null,a===n.length-1,!1,!0),i+=`
|
|
111
|
-
`}),i}function
|
|
112
|
-
`),i||(o+=`${e||""}${r?
|
|
113
|
-
${i?"":e||""}${r?
|
|
114
|
-
`)})}else t.children.length>1&&(o+=" (-)");return i||(e=`${e||""}${r?
|
|
115
|
-
${e}${r?
|
|
116
|
-
${e||""}${r?
|
|
117
|
-
`;e=`${e}${r?
|
|
110
|
+
northing meters`+s;var j=k/2,W=0,H=0,G,K,ie,he,ye;return j>0&&(G=1e5/Math.pow(10,j),K=s.substring(v,v+j),W=parseFloat(K)*G,ie=s.substring(v+j),H=parseFloat(ie)*G),he=W+O,ye=H+D,{easting:he,northing:ye,zoneLetter:b,zoneNumber:M,accuracy:G}}function bl(s,l){for(var h=qs.charCodeAt(l-1),y=1e5,g=!1;h!==s.charCodeAt(0);){if(h++,h===yt&&h++,h===bt&&h++,h>Kr){if(g)throw"Bad character: "+s;h=Gt,g=!0}y+=1e5}return y}function Zi(s,l){if(s>"V")throw"MGRSPoint given invalid Northing "+s;for(var h=Ki.charCodeAt(l-1),y=0,g=!1;h!==s.charCodeAt(0);){if(h++,h===yt&&h++,h===bt&&h++,h>kr){if(g)throw"Bad character: "+s;h=Gt,g=!0}y+=1e5}return y}function Yi(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 Nr(s,l,h){if(!(this instanceof Nr))return new Nr(s,l,h);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=h||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}Nr.fromMGRS=function(s){return new Nr(ml(s))},Nr.prototype.toMGRS=function(s){return dl([this.x,this.y],s)};var vl=1,hh=.25,Ks=.046875,Js=.01953125,Zs=.01068115234375,fh=.75,dh=.46875,mh=.013020833333333334,ph=.007120768229166667,mr=.3645833333333333,gh=.005696614583333333,yh=.3076171875,wl=function(s){var l=[];l[0]=vl-s*(hh+s*(Ks+s*(Js+s*Zs))),l[1]=s*(fh-s*(Ks+s*(Js+s*Zs)));var h=s*s;return l[2]=h*(dh-s*(mh+s*ph)),h*=s,l[3]=h*(mr-s*gh),l[4]=h*s*yh,l},xi=function(s,l,h,y){return h*=l,l*=l,y[0]*s-h*(y[1]+l*(y[2]+l*(y[3]+l*y[4])))},Ua=20,Xi=function(s,l,h){for(var y=1/(1-l),g=s,v=Ua;v;--v){var M=Math.sin(g),b=1-l*M*M;if(b=(xi(g,M,Math.cos(g),h)-s)*(b*Math.sqrt(b))*y,g-=b,Math.abs(b)<w)return g}return g};function Si(){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=wl(this.es),this.ml0=xi(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function bh(s){var l=s.x,h=s.y,y=Y(l-this.long0),g,v,M,b=Math.sin(h),A=Math.cos(h);if(this.es){var D=A*y,k=Math.pow(D,2),j=this.ep2*Math.pow(A,2),W=Math.pow(j,2),H=Math.abs(A)>w?Math.tan(h):0,G=Math.pow(H,2),K=Math.pow(G,2);g=1-this.es*Math.pow(b,2),D=D/Math.sqrt(g);var ie=xi(h,b,A,this.en);v=this.a*(this.k0*D*(1+k/6*(1-G+j+k/20*(5-18*G+K+14*j-58*G*j+k/42*(61+179*K-K*G-479*G)))))+this.x0,M=this.a*(this.k0*(ie-this.ml0+b*y*D/2*(1+k/12*(5-G+9*j+4*W+k/30*(61+K-58*G+270*j-330*G*j+k/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,M=A*Math.cos(y)/Math.sqrt(1-Math.pow(O,2)),O=Math.abs(M),O>=1){if(O-1>w)return 93;M=0}else M=Math.acos(M);h<0&&(M=-M),M=this.a*this.k0*(M-this.lat0)+this.y0}return s.x=v,s.y=M,s}function _l(s){var l,h,y,g,v=(s.x-this.x0)*(1/this.a),M=(s.y-this.y0)*(1/this.a);if(this.es)if(l=this.ml0+M/this.k0,h=Xi(l,this.es,this.en),Math.abs(h)<m){var k=Math.sin(h),j=Math.cos(h),W=Math.abs(j)>w?Math.tan(h):0,H=this.ep2*Math.pow(j,2),G=Math.pow(H,2),K=Math.pow(W,2),ie=Math.pow(K,2);l=1-this.es*Math.pow(k,2);var he=v*Math.sqrt(l)/this.k0,ye=Math.pow(he,2);l=l*W,y=h-l*ye/(1-this.es)*.5*(1-ye/12*(5+3*K-9*H*K+H-4*G-ye/30*(61+90*K-252*H*K+45*ie+46*H-ye/56*(1385+3633*K+4095*ie+1574*ie*K)))),g=Y(this.long0+he*(1-ye/6*(1+2*K+H-ye/20*(5+28*K+24*ie+8*H*K+6*H-ye/42*(61+662*K+1320*ie+720*ie*K))))/j)}else y=m*qi(M),g=0;else{var b=Math.exp(v/this.k0),A=.5*(b-1/b),O=this.lat0+M/this.k0,D=Math.cos(O);l=Math.sqrt((1-Math.pow(D,2))/(1+Math.pow(A,2))),y=Math.asin(l),M<0&&(y=-y),A===0&&D===0?g=0:g=Y(Math.atan2(A,D)+this.long0)}return s.x=g,s.y=y,s}var vh=["Fast_Transverse_Mercator","Fast Transverse Mercator"],Ys={init:Si,forward:bh,inverse:_l,names:vh},$a=function(s){var l=Math.exp(s);return l=(l-1/l)/2,l},ir=function(s,l){s=Math.abs(s),l=Math.abs(l);var h=Math.max(s,l),y=Math.min(s,l)/(h||1);return h*Math.sqrt(1+Math.pow(y,2))},xl=function(s){var l=1+s,h=l-1;return h===0?s:s*Math.log(l)/h},Sl=function(s){var l=Math.abs(s);return l=xl(l*(1+l/(ir(1,l)+1))),s<0?-l:l},Xs=function(s,l){for(var h=2*Math.cos(2*l),y=s.length-1,g=s[y],v=0,M;--y>=0;)M=-v+h*g+s[y],v=g,g=M;return l+M*Math.sin(2*l)},Qi=function(s,l){for(var h=2*Math.cos(l),y=s.length-1,g=s[y],v=0,M;--y>=0;)M=-v+h*g+s[y],v=g,g=M;return Math.sin(l)*M},Fa=function(s){var l=Math.exp(s);return l=(l+1/l)/2,l},Ha=function(s,l,h){for(var y=Math.sin(l),g=Math.cos(l),v=$a(h),M=Fa(h),b=2*g*M,A=-2*y*v,O=s.length-1,D=s[O],k=0,j=0,W=0,H,G;--O>=0;)H=j,G=k,j=D,k=W,D=-H+b*j-A*k+s[O],W=-G+A*j+b*k;return b=y*M,A=g*v,[b*D-A*W,b*W+A*D]};function wh(){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&&(Ys.init.apply(this),this.forward=Ys.forward,this.inverse=Ys.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),h=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)))))),h=h*l,this.cgb[1]=h*(7/3+l*(-8/5+l*(-227/45+l*(2704/315+l*(2323/945))))),this.cbg[1]=h*(5/3+l*(-16/15+l*(-13/9+l*(904/315+l*(-1522/945))))),h=h*l,this.cgb[2]=h*(56/15+l*(-136/35+l*(-1262/105+l*(73814/2835)))),this.cbg[2]=h*(-26/15+l*(34/21+l*(8/5+l*(-12686/2835)))),h=h*l,this.cgb[3]=h*(4279/630+l*(-332/35+l*(-399572/14175))),this.cbg[3]=h*(1237/630+l*(-12/5+l*(-24832/14175))),h=h*l,this.cgb[4]=h*(4174/315+l*(-144838/6237)),this.cbg[4]=h*(-734/315+l*(109598/31185)),h=h*l,this.cgb[5]=h*(601676/22275),this.cbg[5]=h*(444337/155925),h=Math.pow(l,2),this.Qn=this.k0/(1+l)*(1+h*(1/4+h*(1/64+h/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]=h*(-1/48+l*(-1/15+l*(437/1440+l*(-46/105+l*(1118711/3870720))))),this.gtu[1]=h*(13/48+l*(-3/5+l*(557/1440+l*(281/630+l*(-1983433/1935360))))),h=h*l,this.utg[2]=h*(-17/480+l*(37/840+l*(209/4480+l*(-5569/90720)))),this.gtu[2]=h*(61/240+l*(-103/140+l*(15061/26880+l*(167603/181440)))),h=h*l,this.utg[3]=h*(-4397/161280+l*(11/504+l*(830251/7257600))),this.gtu[3]=h*(49561/161280+l*(-179/168+l*(6601661/7257600))),h=h*l,this.utg[4]=h*(-4583/161280+l*(108847/3991680)),this.gtu[4]=h*(34729/80640+l*(-3418889/1995840)),h=h*l,this.utg[5]=h*(-20648693/638668800),this.gtu[5]=h*(212378941/319334400);var y=Xs(this.cbg,this.lat0);this.Zb=-this.Qn*(y+Qi(this.gtu,2*y))}function Qs(s){var l=Y(s.x-this.long0),h=s.y;h=Xs(this.cbg,h);var y=Math.sin(h),g=Math.cos(h),v=Math.sin(l),M=Math.cos(l);h=Math.atan2(y,M*g),l=Math.atan2(v*g,ir(y,g*M)),l=Sl(Math.tan(l));var b=Ha(this.gtu,2*h,2*l);h=h+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*h+this.Zb)+this.y0):(A=1/0,O=1/0),s.x=A,s.y=O,s}function _h(s){var l=(s.x-this.x0)*(1/this.a),h=(s.y-this.y0)*(1/this.a);h=(h-this.Zb)/this.Qn,l=l/this.Qn;var y,g;if(Math.abs(l)<=2.623395162778){var v=Ha(this.utg,2*h,2*l);h=h+v[0],l=l+v[1],l=Math.atan($a(l));var M=Math.sin(h),b=Math.cos(h),A=Math.sin(l),O=Math.cos(l);h=Math.atan2(M*O,ir(A,O*b)),l=Math.atan2(A,O*b),y=Y(l+this.long0),g=Xs(this.cgb,h)}else y=1/0,g=1/0;return s.x=y,s.y=g,s}var xh=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","tmerc"],Fn={init:wh,forward:Qs,inverse:_h,names:xh},Sh=function(s,l){if(s===void 0){if(s=Math.floor((Y(l)+Math.PI)*30/Math.PI)+1,s<0)return 0;if(s>60)return 60}return s},eo="etmerc";function Wa(){var s=Sh(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,Fn.init.apply(this),this.forward=Fn.forward,this.inverse=Fn.inverse}var Mh=["Universal Transverse Mercator System","utm"],Eh={init:Wa,names:Mh,dependsOn:eo},Hn=function(s,l){return Math.pow((1-s)/(1+s),l)},Ml=20;function to(){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)*Hn(this.e*s,this.ratexp))}function qa(s){var l=s.x,h=s.y;return s.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*h+C),this.C)*Hn(this.e*Math.sin(h),this.ratexp))-m,s.x=this.C*l,s}function Mi(s){for(var l=1e-14,h=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*Hn(this.e*Math.sin(s.y),-.5*this.e))-m,!(Math.abs(y-s.y)<l));--v)s.y=y;return v?(s.x=h,s.y=y,s):null}var Wn=["gauss"],en={init:to,forward:qa,inverse:Mi,names:Wn};function El(){en.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 Rh(s){var l,h,y,g;return s.x=Y(s.x-this.long0),en.forward.apply(this,[s]),l=Math.sin(s.y),h=Math.cos(s.y),y=Math.cos(s.x),g=this.k0*this.R2/(1+this.sinc0*l+this.cosc0*h*y),s.x=g*h*Math.sin(s.x),s.y=g*(this.cosc0*l-this.sinc0*h*y),s.x=this.a*s.x+this.x0,s.y=this.a*s.y+this.y0,s}function Ga(s){var l,h,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 M=2*Math.atan2(v,this.R2);l=Math.sin(M),h=Math.cos(M),g=Math.asin(h*this.sinc0+s.y*l*this.cosc0/v),y=Math.atan2(s.x*l,v*this.cosc0*h-s.y*this.sinc0*l)}else g=this.phic0,y=0;return s.x=y,s.y=g,en.inverse.apply(this,[s]),s.x=Y(s.x+this.long0),s}var Ch=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"],Rl={init:El,forward:Rh,inverse:Ga,names:Ch};function ro(s,l,h){return l*=h,Math.tan(.5*(m+s))*Math.pow((1-l)/(1+l),.5*h)}function Va(){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+qi(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*It(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/ct(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=It(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-m,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function Cl(s){var l=s.x,h=s.y,y=Math.sin(h),g=Math.cos(h),v,M,b,A,O,D,k=Y(l-this.long0);return Math.abs(Math.abs(l-this.long0)-Math.PI)<=w&&Math.abs(h+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(k)),s.x=this.a*v*g*Math.sin(k)+this.x0,s.y=this.a*v*(this.coslat0*y-this.sinlat0*g*Math.cos(k))+this.y0,s):(M=2*Math.atan(this.ssfn_(h,y,this.e))-m,A=Math.cos(M),b=Math.sin(M),Math.abs(this.coslat0)<=w?(O=ct(this.e,h*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(k)),s.y=v*b):(v=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*b+this.cosX0*A*Math.cos(k))),s.y=v*(this.cosX0*b-this.sinX0*A*Math.cos(k))+this.y0),s.x=v*A*Math.sin(k)+this.x0,s))}function Al(s){s.x-=this.x0,s.y-=this.y0;var l,h,y,g,v,M=Math.sqrt(s.x*s.x+s.y*s.y);if(this.sphere){var b=2*Math.atan(M/(2*this.a*this.k0));return l=this.long0,h=this.lat0,M<=w?(s.x=l,s.y=h,s):(h=Math.asin(Math.cos(b)*this.sinlat0+s.y*Math.sin(b)*this.coslat0/M),Math.abs(this.coslat0)<w?this.lat0>0?l=Y(this.long0+Math.atan2(s.x,-1*s.y)):l=Y(this.long0+Math.atan2(s.x,s.y)):l=Y(this.long0+Math.atan2(s.x*Math.sin(b),M*this.coslat0*Math.cos(b)-s.y*this.sinlat0*Math.sin(b))),s.x=l,s.y=h,s)}else if(Math.abs(this.coslat0)<=w){if(M<=w)return h=this.lat0,l=this.long0,s.x=l,s.y=h,s;s.x*=this.con,s.y*=this.con,y=M*this.cons/(2*this.a*this.k0),h=this.con*Lr(this.e,y),l=this.con*Y(this.con*this.long0+Math.atan2(s.x,-1*s.y))}else g=2*Math.atan(M*this.cosX0/(2*this.a*this.k0*this.ms1)),l=this.long0,M<=w?v=this.X0:(v=Math.asin(Math.cos(g)*this.sinX0+s.y*Math.sin(g)*this.cosX0/M),l=Y(this.long0+Math.atan2(s.x*Math.sin(g),M*this.cosX0*Math.cos(g)-s.y*this.sinX0*Math.sin(g)))),h=-1*Lr(this.e,Math.tan(.5*(m+v)));return s.x=l,s.y=h,s}var Ah=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],Th={init:Va,forward:Cl,inverse:Al,names:Ah,ssfn_:ro};function Ka(){var s=this.lat0;this.lambda0=this.long0;var l=Math.sin(s),h=this.a,y=this.rf,g=1/y,v=2*g-Math.pow(g,2),M=this.e=Math.sqrt(v);this.R=this.k0*h*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+M*l)/(1-M*l));this.K=b-this.alpha*A+this.alpha*M/2*O}function Tl(s){var l=Math.log(Math.tan(Math.PI/4-s.y/2)),h=this.e/2*Math.log((1+this.e*Math.sin(s.y))/(1-this.e*Math.sin(s.y))),y=-this.alpha*(l+h)+this.K,g=2*(Math.atan(Math.exp(y))-Math.PI/4),v=this.alpha*(s.x-this.lambda0),M=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*M+this.x0,s}function Ph(s){for(var l=s.x-this.x0,h=s.y-this.y0,y=l/this.R,g=2*(Math.atan(Math.exp(h/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)),M=Math.atan(Math.sin(y)/(Math.cos(this.b0)*Math.cos(y)-Math.sin(this.b0)*Math.tan(g))),b=this.lambda0+M/this.alpha,A=0,O=v,D=-1e3,k=0;Math.abs(O-D)>1e-7;){if(++k>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 Ih=["somerc"],Oh={init:Ka,forward:Tl,inverse:Ph,names:Ih},Ei=1e-7;function tn(s){var l=["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],h=typeof s.PROJECTION=="object"?Object.keys(s.PROJECTION)[0]:s.PROJECTION;return"no_uoff"in s||"no_off"in s||l.indexOf(h)!==-1}function io(){var s,l,h,y,g,v,M,b,A,O,D=0,k,j=0,W=0,H=0,G=0,K=0,ie=0;this.no_off=tn(this),this.no_rot="no_rot"in this;var he=!1;"alpha"in this&&(he=!0);var ye=!1;if("rectified_grid_angle"in this&&(ye=!0),he&&(ie=this.alpha),ye&&(D=this.rectified_grid_angle*E),he||ye)j=this.longc;else if(W=this.long1,G=this.lat1,H=this.long2,K=this.lat2,Math.abs(G-K)<=Ei||(s=Math.abs(G))<=Ei||Math.abs(s-m)<=Ei||Math.abs(Math.abs(this.lat0)-m)<=Ei||Math.abs(Math.abs(K)-m)<=Ei)throw new Error;var Je=1-this.es;l=Math.sqrt(Je),Math.abs(this.lat0)>w?(b=Math.sin(this.lat0),h=Math.cos(this.lat0),s=1-this.es*b*b,this.B=h*h,this.B=Math.sqrt(1+this.es*this.B*this.B/Je),this.A=this.B*this.k0*l/s,y=this.B*l/(h*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(ct(this.e,this.lat0,b),this.B)):(this.B=1/l,this.A=this.k0,this.E=y=g=1),he||ye?(he?(k=Math.asin(Math.sin(ie)/y),ye||(D=ie)):(k=D,ie=Math.asin(y*Math.sin(k))),this.lam0=j-Math.asin(.5*(g-1/g)*Math.tan(k))/this.B):(v=Math.pow(ct(this.e,G,Math.sin(G)),this.B),M=Math.pow(ct(this.e,K,Math.sin(K)),this.B),g=this.E/v,A=(M-v)/(M+v),O=this.E*this.E,O=(O-M*v)/(O+M*v),s=W-H,s<-Math.pi?H-=P:s>Math.pi&&(H+=P),this.lam0=Y(.5*(W+H)-Math.atan(O*Math.tan(.5*this.B*(W-H))/A)/this.B),k=Math.atan(2*Math.sin(this.B*Y(W-this.lam0))/(g-1/g)),D=ie=Math.asin(y*Math.sin(k))),this.singam=Math.sin(k),this.cosgam=Math.cos(k),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*k,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 qn(s){var l={},h,y,g,v,M,b,A,O;if(s.x=s.x-this.lam0,Math.abs(Math.abs(s.y)-m)>w){if(M=this.E/Math.pow(ct(this.e,s.y,Math.sin(s.y)),this.B),b=1/M,h=.5*(M-b),y=.5*(M+b),v=Math.sin(this.B*s.x),g=(h*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)<Ei?A=this.A*s.x:A=this.ArB*Math.atan2(h*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 Pl(s){var l,h,y,g,v,M,b,A={};if(s.x=(s.x-this.x0)*(1/this.a),s.y=(s.y-this.y0)*(1/this.a),this.no_rot?(h=s.y,l=s.x):(h=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*h),g=.5*(y-1/y),v=.5*(y+1/y),M=Math.sin(this.BrA*l),b=(M*this.cosgam+g*this.singam)/v,Math.abs(Math.abs(b)-1)<w)A.x=0,A.y=b<0?-m:m;else{if(A.y=this.E/Math.sqrt((1+b)/(1-b)),A.y=Lr(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-M*this.singam,Math.cos(this.BrA*l))}return A.x+=this.lam0,A}var no=["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"],Gn={init:io,forward:qn,inverse:Pl,names:no};function so(){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),h=Math.cos(this.lat1),y=It(this.e,l,h),g=ct(this.e,this.lat1,l),v=Math.sin(this.lat2),M=Math.cos(this.lat2),b=It(this.e,v,M),A=ct(this.e,this.lat2,v),O=ct(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 Jr(s){var l=s.x,h=s.y;Math.abs(2*Math.abs(h)-Math.PI)<=w&&(h=qi(h)*(m-2*w));var y=Math.abs(Math.abs(h)-m),g,v;if(y>w)g=ct(this.e,h,Math.sin(h)),v=this.a*this.f0*Math.pow(g,this.ns);else{if(y=h*this.ns,y<=0)return null;v=0}var M=this.ns*Y(l-this.long0);return s.x=this.k0*(v*Math.sin(M))+this.x0,s.y=this.k0*(this.rh-v*Math.cos(M))+this.y0,s}function Ja(s){var l,h,y,g,v,M=(s.x-this.x0)/this.k0,b=this.rh-(s.y-this.y0)/this.k0;this.ns>0?(l=Math.sqrt(M*M+b*b),h=1):(l=-Math.sqrt(M*M+b*b),h=-1);var A=0;if(l!==0&&(A=Math.atan2(h*M,h*b)),l!==0||this.ns>0){if(h=1/this.ns,y=Math.pow(l/(this.a*this.f0),h),g=Lr(this.e,y),g===-9999)return null}else g=-m;return v=Y(A/this.ns+this.long0),s.x=v,s.y=g,s}var Lh=["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)"],rn={init:so,forward:Jr,inverse:Ja,names:Lh};function Il(){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 kh(s){var l,h,y,g,v,M,b,A=s.x,O=s.y,D=Y(A-this.long0);return l=Math.pow((1+this.e*Math.sin(O))/(1-this.e*Math.sin(O)),this.alfa*this.e/2),h=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(h)+Math.sin(this.ad)*Math.cos(h)*Math.cos(y)),v=Math.asin(Math.cos(h)*Math.sin(y)/Math.cos(g)),M=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(M)/1,s.x=b*Math.sin(M)/1,this.czech||(s.y*=-1,s.x*=-1),s}function oo(s){var l,h,y,g,v,M,b,A,O=s.x;s.x=s.y,s.y=O,this.czech||(s.y*=-1,s.x*=-1),M=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/M,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)),h=Math.asin(Math.cos(y)*Math.sin(g)/Math.cos(l)),s.x=this.long0-h/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 Nh=["Krovak","krovak"],Bh={init:Il,forward:kh,inverse:oo,names:Nh},vt=function(s,l,h,y,g){return s*g-l*Math.sin(2*g)+h*Math.sin(4*g)-y*Math.sin(6*g)},Vn=function(s){return 1-.25*s*(1+s/16*(3+1.25*s))},Kn=function(s){return .375*s*(1+.25*s*(1+.46875*s))},Jn=function(s){return .05859375*s*s*(1+.75*s)},Zn=function(s){return s*s*s*(35/3072)},nn=function(s,l,h){var y=l*h;return s/Math.sqrt(1-y*y)},sn=function(s){return Math.abs(s)<m?s:s-qi(s)*Math.PI},ao=function(s,l,h,y,g){var v,M;v=s/l;for(var b=0;b<15;b++)if(M=(s-(l*v-h*Math.sin(2*v)+y*Math.sin(4*v)-g*Math.sin(6*v)))/(l-2*h*Math.cos(2*v)+4*y*Math.cos(4*v)-6*g*Math.cos(6*v)),v+=M,Math.abs(M)<=1e-10)return v;return NaN};function Dh(){this.sphere||(this.e0=Vn(this.es),this.e1=Kn(this.es),this.e2=Jn(this.es),this.e3=Zn(this.es),this.ml0=this.a*vt(this.e0,this.e1,this.e2,this.e3,this.lat0))}function Ol(s){var l,h,y=s.x,g=s.y;if(y=Y(y-this.long0),this.sphere)l=this.a*Math.asin(Math.cos(g)*Math.sin(y)),h=this.a*(Math.atan2(Math.tan(g),Math.cos(y))-this.lat0);else{var v=Math.sin(g),M=Math.cos(g),b=nn(this.a,this.e,v),A=Math.tan(g)*Math.tan(g),O=y*Math.cos(g),D=O*O,k=this.es*M*M/(1-this.es),j=this.a*vt(this.e0,this.e1,this.e2,this.e3,g);l=b*O*(1-D*A*(1/6-(8-A+8*k)*D/120)),h=j-this.ml0+b*v/M*D*(.5+(5-A+6*k)*D/24)}return s.x=l+this.x0,s.y=h+this.y0,s}function zh(s){s.x-=this.x0,s.y-=this.y0;var l=s.x/this.a,h=s.y/this.a,y,g;if(this.sphere){var v=h+this.lat0;y=Math.asin(Math.sin(v)*Math.cos(l)),g=Math.atan2(Math.tan(l),Math.cos(v))}else{var M=this.ml0/this.a+h,b=ao(M,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(b)-m)<=w)return s.x=this.long0,s.y=m,h<0&&(s.y*=-1),s;var A=nn(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),k=l*this.a/A,j=k*k;y=b-A*Math.tan(b)/O*k*k*(.5-(1+3*D)*k*k/24),g=k*(1-j*(D/3+(1+3*D)*D*j/15))/Math.cos(b)}return s.x=Y(g+this.long0),s.y=sn(y),s}var jh=["Cassini","Cassini_Soldner","cass"],Zr={init:Dh,forward:Ol,inverse:zh,names:jh},pr=function(s,l){var h;return s>1e-7?(h=s*l,(1-s*s)*(l/(1-h*h)-.5/s*Math.log((1-h)/(1+h)))):2*l},Ll=1,Za=2,Yr=3,Xr=4;function nr(){var s=Math.abs(this.lat0);if(Math.abs(s-m)<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=pr(this.e,1),this.mmf=.5/(1-this.es),this.apa=jl(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=pr(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 Yn(s){var l,h,y,g,v,M,b,A,O,D,k=s.x,j=s.y;if(k=Y(k-this.long0),this.sphere){if(v=Math.sin(j),D=Math.cos(j),y=Math.cos(k),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(h=this.mode===this.EQUIT?1+D*y:1+this.sinph0*v+this.cosph0*D*y,h<=w)return null;h=Math.sqrt(2/h),l=h*D*Math.sin(k),h*=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(j+this.lat0)<w)return null;h=C-j*.5,h=2*(this.mode===this.S_POLE?Math.cos(h):Math.sin(h)),l=h*Math.sin(k),h*=y}}else{switch(b=0,A=0,O=0,y=Math.cos(k),g=Math.sin(k),v=Math.sin(j),M=pr(this.e,v),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(b=M/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=m+j,M=this.qp-M;break;case this.S_POLE:O=j-m,M=this.qp+M;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?h=this.ymf*O*(this.cosb1*b-this.sinb1*A*y):h=(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:M>=0?(l=(O=Math.sqrt(M))*g,h=y*(this.mode===this.S_POLE?O:-O)):l=h=0;break}}return s.x=this.a*l+this.x0,s.y=this.a*h+this.y0,s}function kl(s){s.x-=this.x0,s.y-=this.y0;var l=s.x/this.a,h=s.y/this.a,y,g,v,M,b,A,O;if(this.sphere){var D=0,k,j=0;if(k=Math.sqrt(l*l+h*h),g=k*.5,g>1)return null;switch(g=2*Math.asin(g),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(j=Math.sin(g),D=Math.cos(g)),this.mode){case this.EQUIT:g=Math.abs(k)<=w?0:Math.asin(h*j/k),l*=j,h=D*k;break;case this.OBLIQ:g=Math.abs(k)<=w?this.lat0:Math.asin(D*this.sinph0+h*j*this.cosph0/k),l*=j*this.cosph0,h=(D-Math.sin(g)*this.sinph0)*k;break;case this.N_POLE:h=-h,g=m-g;break;case this.S_POLE:g-=m;break}y=h===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(l,h)}else{if(O=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(l/=this.dd,h*=this.dd,A=Math.sqrt(l*l+h*h),A<w)return s.x=this.long0,s.y=this.lat0,s;M=2*Math.asin(.5*A/this.rq),v=Math.cos(M),l*=M=Math.sin(M),this.mode===this.OBLIQ?(O=v*this.sinb1+h*M*this.cosb1/A,b=this.qp*O,h=A*this.cosb1*v-h*this.sinb1*M):(O=h*M/A,b=this.qp*O,h=A*v)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(h=-h),b=l*l+h*h,!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,h),g=uo(Math.asin(O),this.apa)}return s.x=Y(this.long0+y),s.y=g,s}var Ri=.3333333333333333,Nl=.17222222222222222,Bl=.10257936507936508,lo=.06388888888888888,Dl=.0664021164021164,zl=.016415012942191543;function jl(s){var l,h=[];return h[0]=s*Ri,l=s*s,h[0]+=l*Nl,h[1]=l*lo,l*=s,h[0]+=l*Bl,h[1]+=l*Dl,h[2]=l*zl,h}function uo(s,l){var h=s+s;return s+l[0]*Math.sin(h)+l[1]*Math.sin(h+h)+l[2]*Math.sin(h+h+h)}var Ul=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],$l={init:nr,forward:Yn,inverse:kl,names:Ul,S_POLE:Ll,N_POLE:Za,EQUIT:Yr,OBLIQ:Xr},Qr=function(s){return Math.abs(s)>1&&(s=s>1?1:-1),Math.asin(s)};function Uh(){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=It(this.e3,this.sin_po,this.cos_po),this.qs1=pr(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=It(this.e3,this.sin_po,this.cos_po),this.qs2=pr(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=pr(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 $h(s){var l=s.x,h=s.y;this.sin_phi=Math.sin(h),this.cos_phi=Math.cos(h);var y=pr(this.e3,this.sin_phi,this.cos_phi),g=this.a*Math.sqrt(this.c-this.ns0*y)/this.ns0,v=this.ns0*Y(l-this.long0),M=g*Math.sin(v)+this.x0,b=this.rh-g*Math.cos(v)+this.y0;return s.x=M,s.y=b,s}function Fh(s){var l,h,y,g,v,M;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?M=Math.asin((this.c-y*y)/(2*this.ns0)):(h=(this.c-y*y)/this.ns0,M=this.phi1z(this.e3,h)),v=Y(g/this.ns0+this.long0),s.x=v,s.y=M,s}function co(s,l){var h,y,g,v,M,b=Qr(.5*l);if(s<w)return b;for(var A=s*s,O=1;O<=25;O++)if(h=Math.sin(b),y=Math.cos(b),g=s*h,v=1-g*g,M=.5*v*v/y*(l/(1-A)-h/v+.5/s*Math.log((1-g)/(1+g))),b=b+M,Math.abs(M)<=1e-7)return b;return null}var Hh=["Albers_Conic_Equal_Area","Albers","aea"],Fl={init:Uh,forward:$h,inverse:Fh,names:Hh,phi1z:co};function ho(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function fo(s){var l,h,y,g,v,M,b,A,O=s.x,D=s.y;return y=Y(O-this.long0),l=Math.sin(D),h=Math.cos(D),g=Math.cos(y),M=this.sin_p14*l+this.cos_p14*h*g,v=1,M>0||Math.abs(M)<=w?(b=this.x0+this.a*v*h*Math.sin(y)/M,A=this.y0+this.a*v*(this.cos_p14*l-this.sin_p14*h*g)/M):(b=this.x0+this.infinity_dist*h*Math.sin(y),A=this.y0+this.infinity_dist*(this.cos_p14*l-this.sin_p14*h*g)),s.x=b,s.y=A,s}function mo(s){var l,h,y,g,v,M;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),h=Math.sin(g),y=Math.cos(g),M=Qr(y*this.sin_p14+s.y*h*this.cos_p14/l),v=Math.atan2(s.x*h,l*this.cos_p14*y-s.y*this.sin_p14*h),v=Y(this.long0+v)):(M=this.phic0,v=0),s.x=v,s.y=M,s}var Xn=["gnom"],po={init:ho,forward:fo,inverse:mo,names:Xn},Wh=function(s,l){var h=1-(1-s*s)/(2*s)*Math.log((1-s)/(1+s));if(Math.abs(Math.abs(l)-h)<1e-6)return l<0?-1*m:m;for(var y=Math.asin(.5*l),g,v,M,b,A=0;A<30;A++)if(v=Math.sin(y),M=Math.cos(y),b=s*v,g=Math.pow(1-b*b,2)/(2*M)*(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 qh(){this.sphere||(this.k0=It(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function Hl(s){var l=s.x,h=s.y,y,g,v=Y(l-this.long0);if(this.sphere)y=this.x0+this.a*v*Math.cos(this.lat_ts),g=this.y0+this.a*Math.sin(h)/Math.cos(this.lat_ts);else{var M=pr(this.e,Math.sin(h));y=this.x0+this.a*this.k0*v,g=this.y0+this.a*M*.5/this.k0}return s.x=y,s.y=g,s}function Wl(s){s.x-=this.x0,s.y-=this.y0;var l,h;return this.sphere?(l=Y(this.long0+s.x/this.a/Math.cos(this.lat_ts)),h=Math.asin(s.y/this.a*Math.cos(this.lat_ts))):(h=Wh(this.e,2*s.y*this.k0/this.a),l=Y(this.long0+s.x/(this.a*this.k0))),s.x=l,s.y=h,s}var Gh=["cea"],ql={init:qh,forward:Hl,inverse:Wl,names:Gh};function Vh(){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 Kh(s){var l=s.x,h=s.y,y=Y(l-this.long0),g=sn(h-this.lat0);return s.x=this.x0+this.a*y*this.rc,s.y=this.y0+this.a*g,s}function Jh(s){var l=s.x,h=s.y;return s.x=Y(this.long0+(l-this.x0)/(this.a*this.rc)),s.y=sn(this.lat0+(h-this.y0)/this.a),s}var Zh=["Equirectangular","Equidistant_Cylindrical","eqc"],Yh={init:Vh,forward:Kh,inverse:Jh,names:Zh},Qn=20;function Gl(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=Vn(this.es),this.e1=Kn(this.es),this.e2=Jn(this.es),this.e3=Zn(this.es),this.ml0=this.a*vt(this.e0,this.e1,this.e2,this.e3,this.lat0)}function u(s){var l=s.x,h=s.y,y,g,v,M=Y(l-this.long0);if(v=M*Math.sin(h),this.sphere)Math.abs(h)<=w?(y=this.a*M,g=-1*this.a*this.lat0):(y=this.a*Math.sin(v)/Math.tan(h),g=this.a*(sn(h-this.lat0)+(1-Math.cos(v))/Math.tan(h)));else if(Math.abs(h)<=w)y=this.a*M,g=-1*this.ml0;else{var b=nn(this.a,this.e,Math.sin(h))/Math.tan(h);y=b*Math.sin(v),g=this.a*vt(this.e0,this.e1,this.e2,this.e3,h)-this.ml0+b*(1-Math.cos(v))}return s.x=y+this.x0,s.y=g+this.y0,s}function f(s){var l,h,y,g,v,M,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=Y(y/this.a+this.long0),h=0;else{M=this.lat0+g/this.a,b=y*y/this.a/this.a+M*M,A=M;var D;for(v=Qn;v;--v)if(D=Math.tan(A),O=-1*(M*(A*D+1)-A-.5*(A*A+b)*D)/((A-M)/D-1),A+=O,Math.abs(O)<=w){h=A;break}l=Y(this.long0+Math.asin(y*Math.tan(A)/this.a)/Math.sin(h))}else if(Math.abs(g+this.ml0)<=w)h=0,l=Y(this.long0+y/this.a);else{M=(this.ml0+g)/this.a,b=y*y/this.a/this.a+M*M,A=M;var k,j,W,H,G;for(v=Qn;v;--v)if(G=this.e*Math.sin(A),k=Math.sqrt(1-G*G)*Math.tan(A),j=this.a*vt(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),H=j/this.a,O=(M*(k*H+1)-H-.5*k*(H*H+b))/(this.es*Math.sin(2*A)*(H*H+b-2*M*H)/(4*k)+(M-H)*(k*W-2/Math.sin(2*A))-W),A-=O,Math.abs(O)<=w){h=A;break}k=Math.sqrt(1-this.es*Math.pow(Math.sin(h),2))*Math.tan(h),l=Y(this.long0+Math.asin(y*k/this.a)/Math.sin(h))}return s.x=l,s.y=h,s}var _=["Polyconic","poly"],I={init:Gl,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 U(s){var l,h=s.x,y=s.y,g=y-this.lat0,v=h-this.long0,M=g/p*1e-5,b=v,A=1,O=0;for(l=1;l<=10;l++)A=A*M,O=O+this.A[l]*A;var D=O,k=b,j=1,W=0,H,G,K=0,ie=0;for(l=1;l<=6;l++)H=j*D-W*k,G=W*D+j*k,j=H,W=G,K=K+this.B_re[l]*j-this.B_im[l]*W,ie=ie+this.B_im[l]*j+this.B_re[l]*W;return s.x=ie*this.a+this.x0,s.y=K*this.a+this.y0,s}function F(s){var l,h=s.x,y=s.y,g=h-this.x0,v=y-this.y0,M=v/this.a,b=g/this.a,A=1,O=0,D,k,j=0,W=0;for(l=1;l<=6;l++)D=A*M-O*b,k=O*M+A*b,A=D,O=k,j=j+this.C_re[l]*A-this.C_im[l]*O,W=W+this.C_im[l]*A+this.C_re[l]*O;for(var H=0;H<this.iterations;H++){var G=j,K=W,ie,he,ye=M,Je=b;for(l=2;l<=6;l++)ie=G*j-K*W,he=K*j+G*W,G=ie,K=he,ye=ye+(l-1)*(this.B_re[l]*G-this.B_im[l]*K),Je=Je+(l-1)*(this.B_im[l]*G+this.B_re[l]*K);G=1,K=0;var De=this.B_re[1],He=this.B_im[1];for(l=2;l<=6;l++)ie=G*j-K*W,he=K*j+G*W,G=ie,K=he,De=De+l*(this.B_re[l]*G-this.B_im[l]*K),He=He+l*(this.B_im[l]*G+this.B_re[l]*K);var Et=De*De+He*He;j=(ye*De+Je*He)/Et,W=(Je*De-ye*He)/Et}var nt=j,ti=W,es=1,ts=0;for(l=1;l<=9;l++)es=es*nt,ts=ts+this.D[l]*es;var Zl=this.lat0+ts*p*1e5,dy=this.long0+ti;return s.x=dy,s.y=Zl,s}var te=["New_Zealand_Map_Grid","nzmg"],fe={init:N,forward:U,inverse:F,names:te};function we(){}function Te(s){var l=s.x,h=s.y,y=Y(l-this.long0),g=this.x0+this.a*y,v=this.y0+this.a*Math.log(Math.tan(Math.PI/4+h/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=Y(this.long0+s.x/this.a),h=2.5*(Math.atan(Math.exp(.8*s.y/this.a))-Math.PI/4);return s.x=l,s.y=h,s}var it=["Miller_Cylindrical","mill"],sr={init:we,forward:Te,inverse:Pe,names:it},on=20;function ei(){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=wl(this.es)}function Br(s){var l,h,y=s.x,g=s.y;if(y=Y(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),M=on;M;--M){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)),h=this.a*this.C_y*g}else{var A=Math.sin(g),O=Math.cos(g);h=this.a*xi(g,A,O,this.en),l=this.a*y*O/Math.sqrt(1-this.es*A*A)}return s.x=l,s.y=h,s}function wt(s){var l,h,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=Qr((this.m*l+Math.sin(l))/this.n):this.n!==1&&(l=Qr(Math.sin(l)/this.n)),y=Y(y+this.long0),l=sn(l)):(l=Xi(s.y/this.a,this.es,this.en),g=Math.abs(l),g<m?(g=Math.sin(l),h=this.long0+s.x*Math.sqrt(1-this.es*g*g)/(this.a*Math.cos(l)),y=Y(h)):g-w<m&&(y=this.long0)),s.x=y,s.y=l,s}var St=["Sinusoidal","sinu"],Vt={init:ei,forward:Br,inverse:wt,names:St};function Dr(){}function ne(s){for(var l=s.x,h=s.y,y=Y(l-this.long0),g=h,v=Math.PI*Math.sin(h);;){var M=-(g+Math.sin(g)-v)/(1+Math.cos(g));if(g+=M,Math.abs(M)<w)break}g/=2,Math.PI/2-Math.abs(h)<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 ge(s){var l,h;s.x-=this.x0,s.y-=this.y0,h=s.y/(1.4142135623731*this.a),Math.abs(h)>.999999999999&&(h=.999999999999),l=Math.asin(h);var y=Y(this.long0+s.x/(.900316316158*this.a*Math.cos(l)));y<-Math.PI&&(y=-Math.PI),y>Math.PI&&(y=Math.PI),h=(2*l+Math.sin(2*l))/Math.PI,Math.abs(h)>1&&(h=1);var g=Math.asin(h);return s.x=y,s.y=g,s}var Ve=["Mollweide","moll"],Lt={init:Dr,forward:ne,inverse:ge,names:Ve};function an(){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=Vn(this.es),this.e1=Kn(this.es),this.e2=Jn(this.es),this.e3=Zn(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=It(this.e,this.sinphi,this.cosphi),this.ml1=vt(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=It(this.e,this.sinphi,this.cosphi),this.ml2=vt(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=vt(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function ln(s){var l=s.x,h=s.y,y;if(this.sphere)y=this.a*(this.g-h);else{var g=vt(this.e0,this.e1,this.e2,this.e3,h);y=this.a*(this.g-g)}var v=this.ns*Y(l-this.long0),M=this.x0+y*Math.sin(v),b=this.y0+this.rh-y*Math.cos(v);return s.x=M,s.y=b,s}function un(s){s.x-=this.x0,s.y=this.rh-s.y+this.y0;var l,h,y,g;this.ns>=0?(h=Math.sqrt(s.x*s.x+s.y*s.y),l=1):(h=-Math.sqrt(s.x*s.x+s.y*s.y),l=-1);var v=0;if(h!==0&&(v=Math.atan2(l*s.x,l*s.y)),this.sphere)return g=Y(this.long0+v/this.ns),y=sn(this.g-h/this.a),s.x=g,s.y=y,s;var M=this.g-h/this.a;return y=ao(M,this.e0,this.e1,this.e2,this.e3),g=Y(this.long0+v/this.ns),s.x=g,s.y=y,s}var go=["Equidistant_Conic","eqdc"],Vl={init:an,forward:ln,inverse:un,names:go};function Ya(){this.R=this.a}function M4(s){var l=s.x,h=s.y,y=Y(l-this.long0),g,v;Math.abs(h)<=w&&(g=this.x0+this.R*y,v=this.y0);var M=Qr(2*Math.abs(h/Math.PI));(Math.abs(y)<=w||Math.abs(Math.abs(h)-m)<=w)&&(g=this.x0,h>=0?v=this.y0+Math.PI*this.R*Math.tan(.5*M):v=this.y0+Math.PI*this.R*-Math.tan(.5*M));var b=.5*Math.abs(Math.PI/y-y/Math.PI),A=b*b,O=Math.sin(M),D=Math.cos(M),k=D/(O+D-1),j=k*k,W=k*(2/O-1),H=W*W,G=Math.PI*this.R*(b*(k-H)+Math.sqrt(A*(k-H)*(k-H)-(H+A)*(j-H)))/(H+A);y<0&&(G=-G),g=this.x0+G;var K=A+k;return G=Math.PI*this.R*(W*K-b*Math.sqrt((H+A)*(A+1)-K*K))/(H+A),h>=0?v=this.y0+G:v=this.y0-G,s.x=g,s.y=v,s}function E4(s){var l,h,y,g,v,M,b,A,O,D,k,j,W;return s.x-=this.x0,s.y-=this.y0,k=Math.PI*this.R,y=s.x/k,g=s.y/k,v=y*y+g*g,M=-Math.abs(g)*(1+v),b=M-2*g*g+y*y,A=-2*M+1+2*g*g+v*v,W=g*g/A+(2*b*b*b/A/A/A-9*M*b/A/A)/27,O=(M-b*b/3/A)/A,D=2*Math.sqrt(-O/3),k=3*W/O/D,Math.abs(k)>1&&(k>=0?k=1:k=-1),j=Math.acos(k)/3,s.y>=0?h=(-D*Math.cos(j+Math.PI/3)-b/3/A)*Math.PI:h=-(-D*Math.cos(j+Math.PI/3)-b/3/A)*Math.PI,Math.abs(y)<w?l=this.long0:l=Y(this.long0+Math.PI*(v-1+Math.sqrt(1+2*(y*y-g*g)+v*v))/2/y),s.x=l,s.y=h,s}var R4=["Van_der_Grinten_I","VanDerGrinten","vandg"],C4={init:Ya,forward:M4,inverse:E4,names:R4};function A4(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)}function T4(s){var l=s.x,h=s.y,y=Math.sin(s.y),g=Math.cos(s.y),v=Y(l-this.long0),M,b,A,O,D,k,j,W,H,G,K,ie,he,ye,Je,De,He,Et,nt,ti,es,ts,Zl;return this.sphere?Math.abs(this.sin_p12-1)<=w?(s.x=this.x0+this.a*(m-h)*Math.sin(v),s.y=this.y0-this.a*(m-h)*Math.cos(v),s):Math.abs(this.sin_p12+1)<=w?(s.x=this.x0+this.a*(m+h)*Math.sin(v),s.y=this.y0+this.a*(m+h)*Math.cos(v),s):(Et=this.sin_p12*y+this.cos_p12*g*Math.cos(v),De=Math.acos(Et),He=De?De/Math.sin(De):1,s.x=this.x0+this.a*He*g*Math.sin(v),s.y=this.y0+this.a*He*(this.cos_p12*y-this.sin_p12*g*Math.cos(v)),s):(M=Vn(this.es),b=Kn(this.es),A=Jn(this.es),O=Zn(this.es),Math.abs(this.sin_p12-1)<=w?(D=this.a*vt(M,b,A,O,m),k=this.a*vt(M,b,A,O,h),s.x=this.x0+(D-k)*Math.sin(v),s.y=this.y0-(D-k)*Math.cos(v),s):Math.abs(this.sin_p12+1)<=w?(D=this.a*vt(M,b,A,O,m),k=this.a*vt(M,b,A,O,h),s.x=this.x0+(D+k)*Math.sin(v),s.y=this.y0+(D+k)*Math.cos(v),s):(j=y/g,W=nn(this.a,this.e,this.sin_p12),H=nn(this.a,this.e,y),G=Math.atan((1-this.es)*j+this.es*W*this.sin_p12/(H*g)),K=Math.atan2(Math.sin(v),this.cos_p12*Math.tan(G)-this.sin_p12*Math.cos(v)),K===0?nt=Math.asin(this.cos_p12*Math.sin(G)-this.sin_p12*Math.cos(G)):Math.abs(Math.abs(K)-Math.PI)<=w?nt=-Math.asin(this.cos_p12*Math.sin(G)-this.sin_p12*Math.cos(G)):nt=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),ye=ie*he,Je=he*he,ti=nt*nt,es=ti*nt,ts=es*nt,Zl=ts*nt,De=W*nt*(1-ti*Je*(1-Je)/6+es/8*ye*(1-2*Je)+ts/120*(Je*(4-7*Je)-3*ie*ie*(1-7*Je))-Zl/48*ye),s.x=this.x0+De*Math.sin(K),s.y=this.y0+De*Math.cos(K),s))}function P4(s){s.x-=this.x0,s.y-=this.y0;var l,h,y,g,v,M,b,A,O,D,k,j,W,H,G,K,ie,he,ye,Je,De,He,Et,nt;return this.sphere?(l=Math.sqrt(s.x*s.x+s.y*s.y),l>2*m*this.a?void 0:(h=l/this.a,y=Math.sin(h),g=Math.cos(h),v=this.long0,Math.abs(l)<=w?M=this.lat0:(M=Qr(g*this.sin_p12+s.y*y*this.cos_p12/l),b=Math.abs(this.lat0)-m,Math.abs(b)<=w?this.lat0>=0?v=Y(this.long0+Math.atan2(s.x,-s.y)):v=Y(this.long0-Math.atan2(-s.x,s.y)):v=Y(this.long0+Math.atan2(s.x*y,l*this.cos_p12*g-s.y*this.sin_p12*y))),s.x=v,s.y=M,s)):(A=Vn(this.es),O=Kn(this.es),D=Jn(this.es),k=Zn(this.es),Math.abs(this.sin_p12-1)<=w?(j=this.a*vt(A,O,D,k,m),l=Math.sqrt(s.x*s.x+s.y*s.y),W=j-l,M=ao(W/this.a,A,O,D,k),v=Y(this.long0+Math.atan2(s.x,-1*s.y)),s.x=v,s.y=M,s):Math.abs(this.sin_p12+1)<=w?(j=this.a*vt(A,O,D,k,m),l=Math.sqrt(s.x*s.x+s.y*s.y),W=l-j,M=ao(W/this.a,A,O,D,k),v=Y(this.long0+Math.atan2(s.x,s.y)),s.x=v,s.y=M,s):(l=Math.sqrt(s.x*s.x+s.y*s.y),K=Math.atan2(s.x,s.y),H=nn(this.a,this.e,this.sin_p12),ie=Math.cos(K),he=this.e*this.cos_p12*ie,ye=-he*he/(1-this.es),Je=3*this.es*(1-ye)*this.sin_p12*this.cos_p12*ie/(1-this.es),De=l/H,He=De-ye*(1+ye)*Math.pow(De,3)/6-Je*(1+3*ye)*Math.pow(De,4)/24,Et=1-ye*He*He/2-De*He*He*He/6,G=Math.asin(this.sin_p12*Math.cos(He)+this.cos_p12*Math.sin(He)*ie),v=Y(this.long0+Math.asin(Math.sin(K)*Math.sin(He)/Math.cos(G))),nt=Math.sin(G),M=Math.atan2((nt-this.es*Et*this.sin_p12)*Math.tan(G),nt*(1-this.es)),s.x=v,s.y=M,s))}var I4=["Azimuthal_Equidistant","aeqd"],O4={init:A4,forward:T4,inverse:P4,names:I4};function L4(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function k4(s){var l,h,y,g,v,M,b,A,O=s.x,D=s.y;return y=Y(O-this.long0),l=Math.sin(D),h=Math.cos(D),g=Math.cos(y),M=this.sin_p14*l+this.cos_p14*h*g,v=1,(M>0||Math.abs(M)<=w)&&(b=this.a*v*h*Math.sin(y),A=this.y0+this.a*v*(this.cos_p14*l-this.sin_p14*h*g)),s.x=b,s.y=A,s}function N4(s){var l,h,y,g,v,M,b;return s.x-=this.x0,s.y-=this.y0,l=Math.sqrt(s.x*s.x+s.y*s.y),h=Qr(l/this.a),y=Math.sin(h),g=Math.cos(h),M=this.long0,Math.abs(l)<=w?(b=this.lat0,s.x=M,s.y=b,s):(b=Qr(g*this.sin_p14+s.y*y*this.cos_p14/l),v=Math.abs(this.lat0)-m,Math.abs(v)<=w?(this.lat0>=0?M=Y(this.long0+Math.atan2(s.x,-s.y)):M=Y(this.long0-Math.atan2(-s.x,s.y)),s.x=M,s.y=b,s):(M=Y(this.long0+Math.atan2(s.x*y,l*this.cos_p14*g-s.y*this.sin_p14*y)),s.x=M,s.y=b,s))}var B4=["ortho"],D4={init:L4,forward:k4,inverse:N4,names:B4},tt={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},Fe={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function z4(){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>=m-C/2?this.face=tt.TOP:this.lat0<=-(m-C/2)?this.face=tt.BOTTOM:Math.abs(this.long0)<=C?this.face=tt.FRONT:Math.abs(this.long0)<=m+C?this.face=this.long0>0?tt.RIGHT:tt.LEFT:this.face=tt.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 j4(s){var l={x:0,y:0},h,y,g,v,M,b,A={value:0};if(s.x-=this.long0,this.es!==0?h=Math.atan(this.one_minus_f_squared*Math.tan(s.y)):h=s.y,y=s.x,this.face===tt.TOP)v=m-h,y>=C&&y<=m+C?(A.value=Fe.AREA_0,g=y-m):y>m+C||y<=-(m+C)?(A.value=Fe.AREA_1,g=y>0?y-L:y+L):y>-(m+C)&&y<=-C?(A.value=Fe.AREA_2,g=y+m):(A.value=Fe.AREA_3,g=y);else if(this.face===tt.BOTTOM)v=m+h,y>=C&&y<=m+C?(A.value=Fe.AREA_0,g=-y+m):y<C&&y>=-C?(A.value=Fe.AREA_1,g=-y):y<-C&&y>=-(m+C)?(A.value=Fe.AREA_2,g=-y-m):(A.value=Fe.AREA_3,g=y>0?-y+L:-y-L);else{var O,D,k,j,W,H,G;this.face===tt.RIGHT?y=yo(y,+m):this.face===tt.BACK?y=yo(y,+L):this.face===tt.LEFT&&(y=yo(y,-m)),j=Math.sin(h),W=Math.cos(h),H=Math.sin(y),G=Math.cos(y),O=W*G,D=W*H,k=j,this.face===tt.FRONT?(v=Math.acos(O),g=Kl(v,k,D,A)):this.face===tt.RIGHT?(v=Math.acos(D),g=Kl(v,k,-O,A)):this.face===tt.BACK?(v=Math.acos(-O),g=Kl(v,k,-D,A)):this.face===tt.LEFT?(v=Math.acos(-D),g=Kl(v,k,O,A)):(v=g=0,A.value=Fe.AREA_0)}return b=Math.atan(12/L*(g+Math.acos(Math.sin(g)*Math.cos(C))-m)),M=Math.sqrt((1-Math.cos(v))/(Math.cos(b)*Math.cos(b))/(1-Math.cos(Math.atan(1/Math.cos(g))))),A.value===Fe.AREA_1?b+=m:A.value===Fe.AREA_2?b+=L:A.value===Fe.AREA_3&&(b+=1.5*L),l.x=M*Math.cos(b),l.y=M*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 U4(s){var l={lam:0,phi:0},h,y,g,v,M,b,A,O,D,k={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)),h=Math.atan2(s.y,s.x),s.x>=0&&s.x>=Math.abs(s.y)?k.value=Fe.AREA_0:s.y>=0&&s.y>=Math.abs(s.x)?(k.value=Fe.AREA_1,h-=m):s.x<0&&-s.x>=Math.abs(s.y)?(k.value=Fe.AREA_2,h=h<0?h+L:h-L):(k.value=Fe.AREA_3,h+=m),D=L/12*Math.tan(h),M=Math.sin(D)/(Math.cos(D)-1/Math.sqrt(2)),b=Math.atan(M),g=Math.cos(h),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===tt.TOP)O=Math.acos(A),l.phi=m-O,k.value===Fe.AREA_0?l.lam=b+m:k.value===Fe.AREA_1?l.lam=b<0?b+L:b-L:k.value===Fe.AREA_2?l.lam=b-m:l.lam=b;else if(this.face===tt.BOTTOM)O=Math.acos(A),l.phi=O-m,k.value===Fe.AREA_0?l.lam=-b+m:k.value===Fe.AREA_1?l.lam=-b:k.value===Fe.AREA_2?l.lam=-b-m:l.lam=b<0?-b-L:-b+L;else{var j,W,H;j=A,D=j*j,D>=1?H=0:H=Math.sqrt(1-D)*Math.sin(b),D+=H*H,D>=1?W=0:W=Math.sqrt(1-D),k.value===Fe.AREA_1?(D=W,W=-H,H=D):k.value===Fe.AREA_2?(W=-W,H=-H):k.value===Fe.AREA_3&&(D=W,W=H,H=-D),this.face===tt.RIGHT?(D=j,j=-W,W=D):this.face===tt.BACK?(j=-j,W=-W):this.face===tt.LEFT&&(D=j,j=W,W=-D),l.phi=Math.acos(-H)-m,l.lam=Math.atan2(W,j),this.face===tt.RIGHT?l.lam=yo(l.lam,-m):this.face===tt.BACK?l.lam=yo(l.lam,-L):this.face===tt.LEFT&&(l.lam=yo(l.lam,+m))}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 Kl(s,l,h,y){var g;return s<w?(y.value=Fe.AREA_0,g=0):(g=Math.atan2(l,h),Math.abs(g)<=C?y.value=Fe.AREA_0:g>C&&g<=m+C?(y.value=Fe.AREA_1,g-=m):g>m+C||g<=-(m+C)?(y.value=Fe.AREA_2,g=g>=0?g-L:g+L):(y.value=Fe.AREA_3,g+=m)),g}function yo(s,l){var h=s+l;return h<-L?h+=P:h>+L&&(h-=P),h}var $4=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],F4={init:z4,forward:j4,inverse:U4,names:$4},Xh=[[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]],Xa=[[-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]],l2=.8487,u2=1.3523,c2=T/5,H4=1/c2,bo=18,Jl=function(s,l){return s[0]+l*(s[1]+l*(s[2]+l*s[3]))},W4=function(s,l){return s[1]+l*(2*s[2]+l*3*s[3])};function q4(s,l,h,y){for(var g=l;y;--y){var v=s(g);if(g-=v,Math.abs(v)<h)break}return g}function G4(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function V4(s){var l=Y(s.x-this.long0),h=Math.abs(s.y),y=Math.floor(h*c2);y<0?y=0:y>=bo&&(y=bo-1),h=T*(h-H4*y);var g={x:Jl(Xh[y],h)*l,y:Jl(Xa[y],h)};return s.y<0&&(g.y=-g.y),g.x=g.x*this.a*l2+this.x0,g.y=g.y*this.a*u2+this.y0,g}function K4(s){var l={x:(s.x-this.x0)/(this.a*l2),y:Math.abs(s.y-this.y0)/(this.a*u2)};if(l.y>=1)l.x/=Xh[bo][0],l.y=s.y<0?-m:m;else{var h=Math.floor(l.y*bo);for(h<0?h=0:h>=bo&&(h=bo-1);;)if(Xa[h][0]>l.y)--h;else if(Xa[h+1][0]<=l.y)++h;else break;var y=Xa[h],g=5*(l.y-y[0])/(Xa[h+1][0]-y[0]);g=q4(function(v){return(Jl(y,v)-l.y)/W4(y,v)},g,w,100),l.x/=Jl(Xh[h],g),l.y=(5*h+g)*E,s.y<0&&(l.y=-l.y)}return l.x=Y(l.x+this.long0),l}var J4=["Robinson","robin"],Z4={init:G4,forward:V4,inverse:K4,names:J4};function Y4(){this.name="geocent"}function X4(s){var l=ka(s,this.es,this.a);return l}function Q4(s){var l=jn(s,this.es,this.a,this.b);return l}var ey=["Geocentric","geocentric","geocent","Geocent"],ty={init:Y4,forward:X4,inverse:Q4,names:ey},Mt={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},Qa={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 ry(){if(Object.keys(Qa).forEach(function(h){if(typeof this[h]>"u")this[h]=Qa[h].def;else{if(Qa[h].num&&isNaN(this[h]))throw new Error("Invalid parameter value, must be numeric "+h+" = "+this[h]);Qa[h].num&&(this[h]=parseFloat(this[h]))}Qa[h].degrees&&(this[h]=this[h]*E)}.bind(this)),Math.abs(Math.abs(this.lat0)-m)<w?this.mode=this.lat0<0?Mt.S_POLE:Mt.N_POLE:Math.abs(this.lat0)<w?this.mode=Mt.EQUIT:(this.mode=Mt.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 iy(s){s.x-=this.long0;var l=Math.sin(s.y),h=Math.cos(s.y),y=Math.cos(s.x),g,v;switch(this.mode){case Mt.OBLIQ:v=this.sinph0*l+this.cosph0*h*y;break;case Mt.EQUIT:v=h*y;break;case Mt.S_POLE:v=-l;break;case Mt.N_POLE:v=l;break}switch(v=this.pn1/(this.p-v),g=v*h*Math.sin(s.x),this.mode){case Mt.OBLIQ:v*=this.cosph0*l-this.sinph0*h*y;break;case Mt.EQUIT:v*=l;break;case Mt.N_POLE:v*=-(h*y);break;case Mt.S_POLE:v*=h*y;break}var M,b;return M=v*this.cg+g*this.sg,b=1/(M*this.sw*this.h1+this.cw),g=(g*this.cg-v*this.sg)*this.cw*b,v=M*b,s.x=g*this.a,s.y=v*this.a,s}function ny(s){s.x/=this.a,s.y/=this.a;var l={x:s.x,y:s.y},h,y,g;g=1/(this.pn1-s.y*this.sw),h=this.pn1*s.x*g,y=this.pn1*s.y*this.cw*g,s.x=h*this.cg+y*this.sg,s.y=y*this.cg-h*this.sg;var v=ir(s.x,s.y);if(Math.abs(v)<w)l.x=0,l.y=s.y;else{var M,b;switch(b=1-v*v*this.pfact,b=(this.p-Math.sqrt(b))/(this.pn1/v+v/this.pn1),M=Math.sqrt(1-b*b),this.mode){case Mt.OBLIQ:l.y=Math.asin(M*this.sinph0+s.y*b*this.cosph0/v),s.y=(M-this.sinph0*Math.sin(l.y))*v,s.x*=b*this.cosph0;break;case Mt.EQUIT:l.y=Math.asin(s.y*b/v),s.y=M*v,s.x*=b;break;case Mt.N_POLE:l.y=Math.asin(M),s.y=-s.y;break;case Mt.S_POLE:l.y=-Math.asin(M);break}l.x=Math.atan2(s.x,s.y)}return s.x=l.x+this.long0,s.y=l.y,s}var sy=["Tilted_Perspective","tpers"],oy={init:ry,forward:iy,inverse:ny,names:sy};function ay(){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 ly(s){var l=s.x,h=s.y,y,g,v,M;if(l=l-this.long0,this.shape==="ellipse"){h=Math.atan(this.radius_p2*Math.tan(h));var b=this.radius_p/ir(this.radius_p*Math.cos(h),Math.sin(h));if(g=b*Math.cos(l)*Math.cos(h),v=b*Math.sin(l)*Math.cos(h),M=b*Math.sin(h),(this.radius_g-g)*g-v*v-M*M*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/ir(M,y)),s.y=this.radius_g_1*Math.atan(M/y)):(s.x=this.radius_g_1*Math.atan(v/y),s.y=this.radius_g_1*Math.atan(M/ir(v,y)))}else this.shape==="sphere"&&(y=Math.cos(h),g=Math.cos(l)*y,v=Math.sin(l)*y,M=Math.sin(h),y=this.radius_g-g,this.flip_axis?(s.x=this.radius_g_1*Math.atan(v/ir(M,y)),s.y=this.radius_g_1*Math.atan(M/y)):(s.x=this.radius_g_1*Math.atan(v/y),s.y=this.radius_g_1*Math.atan(M/ir(v,y))));return s.x=s.x*this.a,s.y=s.y*this.a,s}function uy(s){var l=-1,h=0,y=0,g,v,M,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),h=Math.tan(s.x/this.radius_g_1)*ir(1,y)):(h=Math.tan(s.x/this.radius_g_1),y=Math.tan(s.y/this.radius_g_1)*ir(1,h));var A=y/this.radius_p;if(g=h*h+A*A+l*l,v=2*this.radius_g*l,M=v*v-4*g*this.C,M<0)return s.x=Number.NaN,s.y=Number.NaN,s;b=(-v-Math.sqrt(M))/(2*g),l=this.radius_g+b*l,h*=b,y*=b,s.x=Math.atan2(h,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),h=Math.tan(s.x/this.radius_g_1)*Math.sqrt(1+y*y)):(h=Math.tan(s.x/this.radius_g_1),y=Math.tan(s.y/this.radius_g_1)*Math.sqrt(1+h*h)),g=h*h+y*y+l*l,v=2*this.radius_g*l,M=v*v-4*g*this.C,M<0)return s.x=Number.NaN,s.y=Number.NaN,s;b=(-v-Math.sqrt(M))/(2*g),l=this.radius_g+b*l,h*=b,y*=b,s.x=Math.atan2(h,l),s.y=Math.atan(y*Math.cos(s.x)/l)}return s.x=s.x+this.long0,s}var cy=["Geostationary Satellite View","Geostationary_Satellite","geos"],hy={init:ay,forward:ly,inverse:uy,names:cy},fy=function(s){s.Proj.projections.add(Ys),s.Proj.projections.add(Fn),s.Proj.projections.add(Eh),s.Proj.projections.add(Rl),s.Proj.projections.add(Th),s.Proj.projections.add(Oh),s.Proj.projections.add(Gn),s.Proj.projections.add(rn),s.Proj.projections.add(Bh),s.Proj.projections.add(Zr),s.Proj.projections.add($l),s.Proj.projections.add(Fl),s.Proj.projections.add(po),s.Proj.projections.add(ql),s.Proj.projections.add(Yh),s.Proj.projections.add(I),s.Proj.projections.add(fe),s.Proj.projections.add(sr),s.Proj.projections.add(Vt),s.Proj.projections.add(Lt),s.Proj.projections.add(Vl),s.Proj.projections.add(C4),s.Proj.projections.add(O4),s.Proj.projections.add(D4),s.Proj.projections.add(F4),s.Proj.projections.add(Z4),s.Proj.projections.add(ty),s.Proj.projections.add(oy),s.Proj.projections.add(hy)};return Ot.defaultDatum="WGS84",Ot.Proj=dr,Ot.WGS84=new Ot.Proj("WGS84"),Ot.Point=Nr,Ot.toPoint=$n,Ot.defs=mt,Ot.nadgrid=wi,Ot.transform=Gi,Ot.mgrs=Gs,Ot.version="2.8.0",fy(Ot),Ot})});var D1=V((WI,N6)=>{N6.exports={ROOT:0,GROUP:1,POSITION:2,SET:3,RANGE:4,REPETITION:5,REFERENCE:6,CHAR:7}});var fd=V(In=>{var We=D1(),hd=()=>[{type:We.RANGE,from:48,to:57}],B6=()=>[{type:We.CHAR,value:95},{type:We.RANGE,from:97,to:122},{type:We.RANGE,from:65,to:90}].concat(hd()),D6=()=>[{type:We.CHAR,value:9},{type:We.CHAR,value:10},{type:We.CHAR,value:11},{type:We.CHAR,value:12},{type:We.CHAR,value:13},{type:We.CHAR,value:32},{type:We.CHAR,value:160},{type:We.CHAR,value:5760},{type:We.RANGE,from:8192,to:8202},{type:We.CHAR,value:8232},{type:We.CHAR,value:8233},{type:We.CHAR,value:8239},{type:We.CHAR,value:8287},{type:We.CHAR,value:12288},{type:We.CHAR,value:65279}],cS=()=>[{type:We.CHAR,value:10},{type:We.CHAR,value:13},{type:We.CHAR,value:8232},{type:We.CHAR,value:8233}];In.words=()=>({type:We.SET,set:B6(),not:!1});In.notWords=()=>({type:We.SET,set:B6(),not:!0});In.ints=()=>({type:We.SET,set:hd(),not:!1});In.notInts=()=>({type:We.SET,set:hd(),not:!0});In.whitespace=()=>({type:We.SET,set:D6(),not:!1});In.notWhitespace=()=>({type:We.SET,set:D6(),not:!0});In.anyChar=()=>({type:We.SET,set:cS(),not:!0})});var j6=V(z1=>{var z6=D1(),ua=fd(),hS="@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?",fS={0:0,t:9,n:10,v:11,f:12,r:13};z1.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,c,d,p){if(n)return r;var m=i?8:o?parseInt(o,16):a?parseInt(a,16):c?parseInt(c,8):d?hS.indexOf(d):fS[p],S=String.fromCharCode(m);return/[[\]{}^$.|?*+()]/.test(S)&&(S="\\"+S),S}),t};z1.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(ua.words());else if(n[2])r.push(ua.ints());else if(n[3])r.push(ua.whitespace());else if(n[4])r.push(ua.notWords());else if(n[5])r.push(ua.notInts());else if(n[6])r.push(ua.notWhitespace());else if(n[7])r.push({type:z6.RANGE,from:(n[8]||n[9]).charCodeAt(0),to:n[10].charCodeAt(0)});else if(o=n[12])r.push({type:z6.CHAR,value:o.charCodeAt(0)});else return[r,i.lastIndex];z1.error(e,"Unterminated character class")};z1.error=(t,e)=>{throw new SyntaxError("Invalid regular expression: /"+t+"/: "+e)}});var U6=V(j1=>{var uc=D1();j1.wordBoundary=()=>({type:uc.POSITION,value:"b"});j1.nonWordBoundary=()=>({type:uc.POSITION,value:"B"});j1.begin=()=>({type:uc.POSITION,value:"^"});j1.end=()=>({type:uc.POSITION,value:"$"})});var $6=V((KI,dd)=>{var ca=j6(),Tr=D1(),As=fd(),cc=U6();dd.exports=t=>{var e=0,r,i,n={type:Tr.ROOT,stack:[]},o=n,a=n.stack,c=[],d=C=>{ca.error(t,`Nothing to repeat at column ${C-1}`)},p=ca.strToChars(t);for(r=p.length;e<r;)switch(i=p[e++],i){case"\\":switch(i=p[e++],i){case"b":a.push(cc.wordBoundary());break;case"B":a.push(cc.nonWordBoundary());break;case"w":a.push(As.words());break;case"W":a.push(As.notWords());break;case"d":a.push(As.ints());break;case"D":a.push(As.notInts());break;case"s":a.push(As.whitespace());break;case"S":a.push(As.notWhitespace());break;default:/\d/.test(i)?a.push({type:Tr.REFERENCE,value:parseInt(i,10)}):a.push({type:Tr.CHAR,value:i.charCodeAt(0)})}break;case"^":a.push(cc.begin());break;case"$":a.push(cc.end());break;case"[":var m;p[e]==="^"?(m=!0,e++):m=!1;var S=ca.tokenizeClass(p.slice(e),t);e+=S[1],a.push({type:Tr.SET,set:S[0],not:m});break;case".":a.push(As.anyChar());break;case"(":var R={type:Tr.GROUP,stack:[],remember:!0};i=p[e],i==="?"&&(i=p[e+1],e+=2,i==="="?R.followedBy=!0:i==="!"?R.notFollowedBy=!0:i!==":"&&ca.error(t,`Invalid group, character '${i}' after '?' at column ${e-1}`),R.remember=!1),a.push(R),c.push(o),o=R,a=R.stack;break;case")":c.length===0&&ca.error(t,`Unmatched ) at column ${e-1}`),o=c.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(p.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:Tr.REPETITION,min:E,max:T,value:a.pop()})):a.push({type:Tr.CHAR,value:123});break;case"?":a.length===0&&d(e),a.push({type:Tr.REPETITION,min:0,max:1,value:a.pop()});break;case"+":a.length===0&&d(e),a.push({type:Tr.REPETITION,min:1,max:1/0,value:a.pop()});break;case"*":a.length===0&&d(e),a.push({type:Tr.REPETITION,min:0,max:1/0,value:a.pop()});break;default:a.push({type:Tr.CHAR,value:i.charCodeAt(0)})}return c.length!==0&&ca.error(t,"Unterminated group"),n};dd.exports.types=Tr});var W6=V((JI,H6)=>{"use strict";var F6=$6(),dS=F6.types;H6.exports=function(t,e){e||(e={});var r=e.limit===void 0?25:e.limit;mS(t)?t=t.source:typeof t!="string"&&(t=String(t));try{t=F6(t)}catch{return!1}var i=0;return function n(o,a){var c,d,p;if(o.type===dS.REPETITION&&(a++,i++,a>1||i>r))return!1;if(o.options){for(c=0,p=o.options.length;c<p;c++)if(d=n({stack:o.options[c]},a),!d)return!1}var m=o.stack||o.value&&o.value.stack;if(!m)return!0;for(c=0;c<m.length;c++)if(d=n(m[c],a),!d)return!1;return!0}(t,0)};function mS(t){return{}.toString.call(t)==="[object RegExp]"}});var G6=V((ZI,q6)=>{"use strict";q6.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 tg=V((YI,eg)=>{"use strict";var ha=" ",fa="\u2502 ",V6="\u251C\u2500\u2500 ",K6="\u2514\u2500\u2500 ",J6="*",U1="/",Z6=/(?=\/)/;function pS(t){let e=t.name||"";return e=e.replace("bound","").trim(),e=(e||"anonymous")+"()",e}function Y6(t){return Array.isArray(t)?t.map(e=>Y6(e)):typeof t=="symbol"?t.toString():typeof t=="function"?pS(t):t}function md(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]=Y6(i[n]))}),r}function gS(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],c=r.find(p=>a.path===p.path);if(c){c.handlers.push({method:a.method,opts:a.opts.constraints||void 0,meta:e.includeMeta?md.call(this,a,e.includeMeta):null});continue}let d={method:a.method,opts:a.opts.constraints||void 0,meta:e.includeMeta?md.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===U1).length){let o={path:U1,truncatedPath:"",methods:[],opts:[],handlers:[{}]};r.filter(a=>a.path===J6).length?r.splice(1,0,o):r.unshift(o)}let n=yS(r);return n.forEach((o,a)=>{i+=X6(o,null,a===n.length-1,!1,!0),i+=`
|
|
111
|
+
`}),i}function yS(t,e){e=e||U1;let r=[],i={result:r};return t.forEach((n,o)=>{let a=n.path.split(Z6);a[0]!==U1&&a[0]!==J6&&(a=[U1,a[0].slice(1),...a.slice(1)]),a.reduce((c,d,p)=>{if(!c[d]){c[d]={result:[]};let m={path:d,children:c[d].result};p===a.length-1&&(m.handlers=n.handlers),c.result.push(m)}return c[d]},i)}),r}function X6(t,e,r,i,n){let o="";if(!i&&!n&&(o+=`
|
|
112
|
+
`),i||(o+=`${e||""}${r?K6:V6}`),o+=`${t.path}`,t.handlers){let a=t.handlers.reduce((c,d)=>{let p=c.findIndex(m=>JSON.stringify(m.opts)===JSON.stringify(d.opts));return p!==-1?c[p].method=[c[p].method,d.method].join(", "):c.push(d),c},[]);a.forEach((c,d)=>{d>0&&(o+=`${i?"":e||""}${r?ha:fa}${t.path}`),o+=` (${c.method||"-"})`,c.opts&&JSON.stringify(c.opts)!=="{}"&&(o+=` ${JSON.stringify(c.opts)}`),c.meta&&Reflect.ownKeys(c.meta).forEach((p,m)=>{o+=`
|
|
113
|
+
${i?"":e||""}${r?ha:fa}`,o+=`\u2022 (${p}) ${JSON.stringify(c.meta[p])}`}),a.length>1&&d!==a.length-1&&(o+=`
|
|
114
|
+
`)})}else t.children.length>1&&(o+=" (-)");return i||(e=`${e||""}${r?ha:fa}`),t.children.forEach((a,c)=>{let d=c===t.children.length-1,p=!t.handlers&&t.children.length===1;o+=X6(a,e,d,p)}),o}function Q6(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:p}of t.nodes)for(let m of d.handlerStorage.handlers)o.push({method:p,...m});o.length?o.forEach((d,p)=>{let m=`(${d.method||"-"})`;Object.keys(d.constraints).length>0&&(m+=" "+JSON.stringify(d.constraints));let S="",R=t.prefix.split("").map((x,w)=>x===":"?w:null).filter(x=>x!==null);if(R.length){let x=0;R.forEach((w,E)=>{S+=t.prefix.slice(x,w+1),S+=d.params[d.params.length-R.length+E],E===R.length-1&&(S+=t.prefix.slice(w+1)),x=w+1})}else S=t.prefix;if(p===0?n+=`${S} ${m}`:n+=`
|
|
115
|
+
${e}${r?ha:fa}${S} ${m}`,i.includeMeta){let x=md.call(this,d,i.includeMeta);Object.keys(x).forEach((w,E)=>{n+=`
|
|
116
|
+
${e||""}${r?ha:fa}`,n+=`\u2022 (${w}) ${JSON.stringify(x[w])}`})}}):n=t.prefix;let a=`${e}${r?K6:V6}${n}
|
|
117
|
+
`;e=`${e}${r?ha:fa}`;let c=Object.keys(t.children);for(let d=0;d<c.length;d++){let p=t.children[c[d]];a+=Q6.call(this,p,e,d===c.length-1,i)}return a}function hc(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:{}}),hc(t.children[":"],e.parametricChildren[0],r)),e.wildcardChild&&(t.children["*"]||(t.children["*"]={prefix:"*",nodes:[],children:{}}),hc(t.children["*"],e.wildcardChild,r)),e.staticChildren)for(let i of Object.values(e.staticChildren)){let n=i.prefix.split(Z6),o=t,a;for(let c of n)a=o,o=o.children[c],o||(o={prefix:c,nodes:[],children:{}},a.children[c]=o);hc(o,i,r)}}function pd(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 pd(r),t.nodes=r.nodes,t.prefix+=r.prefix,t.children=r.children,t}for(let r of Object.keys(t.children))pd(t.children[r]);return t}eg.exports={flattenNode:hc,compressFlattenedNode:pd,prettyPrintFlattenedNode:Q6,prettyPrintRoutesArray:gS}});var ig=V((XI,rg)=>{"use strict";var gd=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 c of Object.keys(o))this.constraints.includes(c)||(c==="version"?this.constraints.unshift(c):this.constraints.push(c));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((c,d)=>Object.keys(c.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?na:sa}`,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
|
-
`))}};
|
|
133
|
-
`)).bind(this)}};G6.exports=ad});var Z6=V((vI,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 rS(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 iS(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:rS,safeDecodeURIComponent:iS}});var r4=V((wI,t4)=>{"use strict";var ht=require("assert"),lh=require("http"),nS=require("querystring"),hd=R6(),Q6=A6(),{flattenNode:sS,compressFlattenedNode:oS,prettyPrintFlattenedNode:aS,prettyPrintRoutesArray:lS}=D6(),{StaticNode:Y6,NODE_TYPES:ld}=q6(),uS=V6(),{safeDecodeURI:hS,safeDecodeURIComponent:X6}=Z6(),cd=lh.METHODS,e4=/^https?:\/\/.*?\//,Ss=/(\/:[^/()]*?)\?(\/?)/;if(!hd(e4))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 ct(t){if(!(this instanceof ct))return new ct(t);t=t||{},t.defaultRoute?(ht(typeof t.defaultRoute=="function","The default route must be a function"),this.defaultRoute=t.defaultRoute):this.defaultRoute=null,t.onBadUrl?(ht(typeof t.onBadUrl=="function","The bad url handler must be a function"),this.onBadUrl=t.onBadUrl):this.onBadUrl=null,t.buildPrettyMeta?(ht(typeof t.buildPrettyMeta=="function","buildPrettyMeta must be a function"),this.buildPrettyMeta=t.buildPrettyMeta):this.buildPrettyMeta=mS,t.querystringParser?(ht(typeof t.querystringParser=="function","querystringParser must be a function"),this.querystringParser=t.querystringParser):this.querystringParser=e=>e===""?{}:nS.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 uS(t.constraints),this._routesPatterns=[]}ct.prototype.on=function(e,r,i,n,o){typeof i=="function"&&(n!==void 0&&(o=n),n=i,i={}),ht(typeof r=="string","Path should be a string"),ht(r.length>0,"The path could not be empty"),ht(r[0]==="/"||r[0]==="*","The first character of a path should be `/` or `*`"),ht(typeof n=="function","Handler should be a function");let a=r.match(Ss);if(a){ht(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})};ct.prototype._on=function(e,r,i,n,o){ht(typeof e=="string","Method should be a string"),ht(cd.includes(e),`Method '${e}' is not an http method.`);let a={};if(i.constraints!==void 0&&(ht(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 P=T;;P++){let k=r.charCodeAt(P);if(k===40||k===45||k===46){x=!0;let B=r.slice(T,P);if(m.push(B),k===40){let J=dS(r,P),se=r.slice(P,J+1);this.allowUnsafeRegex||ht(hd(new RegExp(se)),`The regex '${se}' is not safe!`),w.push(fS(se)),P=J+1}else w.push("(.*?)");let z=P;for(;z<r.length;z++){let J=r.charCodeAt(z);if(J===58||J===47)break}let H=r.slice(P,z);H&&w.push(cS(H)),T=z+1,P=z,(r.charCodeAt(P)===47||P===r.length)&&(E=H.length)}else if(k===47||P===r.length){let B=r.slice(T,P);m.push(B),w.length!==0&&w.push("(.*?)")}if(r.charCodeAt(P)===47||P===r.length){r=r.slice(0,p+1)+r.slice(P-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)};ct.prototype.hasConstraintStrategy=function(t){return this.constrainer.hasConstraintStrategy(t)};ct.prototype.addConstraintStrategy=function(t){this.constrainer.addConstraintStrategy(t),this._rebuild(this.routes)};ct.prototype.reset=function(){this.trees={},this.routes=[],this._routesPatterns=[]};ct.prototype.off=function(e,r,i){ht(typeof r=="string","Path should be a string"),ht(r.length>0,"The path could not be empty"),ht(r[0]==="/"||r[0]==="*","The first character of a path should be `/` or `*`");let n=r.match(Ss);if(n){ht(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)};ct.prototype._off=function(e,r,i){ht(typeof e=="string","Method should be a string"),ht(cd.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)};ct.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)};ct.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=fd(r));let o,a,h;try{o=hS(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=X6(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=X6(T)),n.isRegex){let C=n.regex.exec(T);if(C===null)continue;for(let P=1;P<C.length;P++){let k=C[P];if(k.length>m)return null;M.push(k)}}else{if(T.length>m)return null;M.push(T)}p=E}}};ct.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})}};ct.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()};ct.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}};ct.prototype.prettyPrint=function(t={}){if(t.commonPrefix=t.commonPrefix===void 0?!0:t.commonPrefix,!t.commonPrefix)return lS.call(this,this.routes,t);let e={prefix:"/",nodes:[],children:{}};for(let r in this.trees){let i=this.trees[r];i&&sS(e,i,r)}return oS(e),aS.call(this,e,"",!0,t)};for(ud in lh.METHODS){if(!lh.METHODS.hasOwnProperty(ud))continue;let t=lh.METHODS[ud],e=t.toLowerCase();if(ct.prototype[e])throw new Error("Method already exists: "+e);ct.prototype[e]=function(r,i,n){return this.on(t,r,i,n)}}var ud;ct.prototype.all=function(t,e,r){this.on(cd,t,e,r)};t4.exports=ct;function cS(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 fS(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 dS(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 mS(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 j4=V((dB,U4)=>{"use strict";U4.exports=US;var zS={threshold:.1,includeAA:!1,alpha:.1,aaColor:[255,255,0],diffColor:[255,0,0],diffColorAlt:null,diffMask:!1};function US(t,e,r,i,n,o){if(!Dd(t)||!Dd(e)||r&&!Dd(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({},zS,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++)D4(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=z4(t,e,w,w);Math.abs(E)>p?!o.includeAA&&(L4(t,x,R,i,n,e)||L4(e,x,R,i,n,t))?r&&!o.diffMask&&Ud(r,w,...o.aaColor):(r&&Ud(r,w,...E<0&&o.diffColorAlt||o.diffColor),M++):r&&(o.diffMask||D4(t,w,o.alpha,r))}return M}function Dd(t){return ArrayBuffer.isView(t)&&t.constructor.BYTES_PER_ELEMENT===1}function L4(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 P=a;P<=d;P++)for(let k=h;k<=m;k++){if(P===e&&k===r)continue;let B=z4(t,t,p,(k*i+P)*4,!0);if(B===0){if(M++,M>2)return!1}else B<R?(R=B,w=P,E=k):B>x&&(x=B,T=P,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 z4(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=zd(o,a,h),w=zd(m,p,M),E=x-w;if(n)return E;let T=N4(o,a,h)-N4(m,p,M),C=B4(o,a,h)-B4(m,p,M),P=.5053*E*E+.299*T*T+.1957*C*C;return x>w?-P:P}function zd(t,e,r){return t*.29889531+e*.58662247+r*.11448223}function N4(t,e,r){return t*.59597799-e*.2741761-r*.32180189}function B4(t,e,r){return t*.21147017-e*.52261711+r*.31114694}function Cs(t,e){return 255+(t-255)*e}function Ud(t,e,r,i,n){t[e+0]=r,t[e+1]=i,t[e+2]=n,t[e+3]=255}function D4(t,e,r,i){let n=t[e+0],o=t[e+1],a=t[e+2],h=Cs(zd(n,o,a),r*t[e+3]/255);Ud(i,e,h,h,h)}});var QS={};Yd(QS,{handler:()=>Fe});module.exports=ty(QS);var Ft;(function(t){t.Imagery="im",t.TileSet="ts",t.Provider="pv",t.ImageryRule="ir",t.Style="st",t.ProcessingJob="pj",t.ConfigBundle="cb"})(Ft||(Ft={}));var e2=new Set(Object.values(Ft));var nt;(function(t){t.Raster="raster",t.Vector="vector"})(nt||(nt={}));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===nt.Raster}isTileSetVector(e){return e==null?!1:e.type===nt.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}},fo=class{},Ka=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)}},ce=new $l;var Gc;(function(t){t.Processing="processing",t.Complete="complete",t.Fail="failed"})(Gc||(Gc={}));var t2=me(require("aws-sdk/clients/dynamodb.js"),1);var mo=me(require("aws-sdk/clients/dynamodb.js"),1);function ry(t){return{id:{S:t}}}var Mi=class extends Ka{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(ry(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 Ja=class extends fo{constructor(e){super(),this.Prefix=Ft,this.type="dynamo",this.Imagery=new po(this,Ft.Imagery),this.Style=new po(this,Ft.Style),this.TileSet=new Mi(this,Ft.TileSet),this.Provider=new po(this,Ft.Provider),this.ProcessingJob=new Mi(this,Ft.ProcessingJob),this.ConfigBundle=new Mi(this,Ft.ConfigBundle),this.dynamo=new t2.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 He;(function(t){t[t.Google=3857]="Google",t[t.Wgs84=4326]="Wgs84",t[t.Nztm2000=2193]="Nztm2000",t[t.Citm2000=3793]="Citm2000"})(He||(He={}));var Vc={google:He.Google,epsg3857:He.Google,[He.Google]:He.Google,globalmercator:He.Google,wgs84:He.Wgs84,epsg4326:He.Wgs84,[He.Wgs84]:He.Wgs84,nztm:He.Nztm2000,epsg2193:He.Nztm2000,[He.Nztm2000]:He.Nztm2000,nztm2000:He.Nztm2000,citm:He.Citm2000,epsg3793:He.Citm2000,[He.Citm2000]:He.Citm2000,citm2000:He.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:")?Vc[e.slice(e.lastIndexOf(":")+1)]:e.startsWith("https://")?Vc[e.slice(e.lastIndexOf("/")+1)]:(r=Vc[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(He.Google);Re.Wgs84=new Re(He.Wgs84);Re.Nztm2000=new Re(He.Nztm2000);Re.Citm2000=new Re(He.Citm2000);var bM="0".charCodeAt(0),vM="1".charCodeAt(0),wM="2".charCodeAt(0),_M="3".charCodeAt(0);var go;(function(t){t[t.Xy=0]="Xy",t[t.Yx=1]="Yx"})(go||(go={}));function r2(t){return t===Re.Nztm2000?go.Yx:go.Xy}function iy(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(iy),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)===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 Za={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 ny={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}]},je=new Mt(ny);var Hl=me(s2(),1),Gl=new Mt(Hl.Nztm2000),on=new Mt(Hl.Nztm2000Quad);var Yn={All:[je,Gl,on],Defaults:new Map([[Re.Google.code,je],[Re.Nztm2000.code,Gl]]),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 Yn.tryGet(e);for(let r of Yn.All)if(r.identifier===t)return r;return null}};var Ge;(function(t){t.Png="png",t.Jpeg="jpeg",t.Webp="webp",t.Avif="avif"})(Ge||(Ge={}));var nr;(function(t){t.MapboxVectorTiles="pbf"})(nr||(nr={}));var f2=me(bo(),1);function ay(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 ly(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 uy=[ay,ly];function vo(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 uy){let a=o(i);if(a!=null){n=!0,r.push(a);break}}n||r.push(i)}return r.join("-")}var u2=me(l2(),1),h2=require("crypto"),cy="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",c2=(0,u2.default)(cy);function Xn(t){return c2.encode((0,h2.createHash)("sha256").update(t).digest())}function Ya(t){if(t==="")return 0;let e=parseInt(t,16);if(isNaN(e))throw new Error("Invalid hex byte: "+t);return e}function Kl(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:Ya(t.substr(0,2)),g:Ya(t.substr(2,2)),b:Ya(t.substr(4,2)),alpha:Ya(t.substr(6,2))}}var ln=me(require("fs"),1),Yl=me(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,fy=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=>fy(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 st=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 my=/\/$/,py=/^\//;function Kc(t,e){return t.replace(my,"")+"/"+e.replace(py,"")}function m2(t,...e){let r=t;for(let i=0;i<e.length;i++)r=Kc(r,e[i]);return r}async function p2(t){let e=[];for await(let r of t)e.push(r);return e}var Jc=require("fs"),Jl=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,Jl.resolve)(this.fileName)}get name(){return(0,Jl.basename)(this.fileName)}get size(){return this._size?this._size:(this._size=Promise.resolve().then(async()=>(await Jc.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=Jc.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 Zl(t,e){return Ei(t)?t.code==="ENOENT"?new st(e,404,t):t.code==="EACCES"?new st(e,403,t):new st(e,500,t):new st(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=Yl.default.resolve(e);for(let o of i){let a=Yl.default.join(n,o.name);o.isDirectory()&&r?.recursive!==!1?yield*this.list(a):yield a}}catch(i){throw Zl(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 Zl(r,`Failed to stat: ${e}`)}}async read(e){try{return await ln.default.promises.readFile(e)}catch(r){throw Zl(r,`Failed to read: ${e}`)}}async write(e,r){let i=Yl.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 Zl(n,`Failed to write: ${e}`)}}stream(e){return ln.default.createReadStream(e)}};Ri.protocol="file";var Z2=me(require("http"),1),Y2=me(require("https"),1),ns=me(require("zlib"),1),or=me(require("stream"),1),a1=require("buffer");function gy(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=gy;var gr=me(require("stream"),1),Pi=require("util"),sr=require("buffer");Qa();eu();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 Wt=class extends Ti{constructor(e,r,i){super(e,r),i&&(this.code=this.errno=i.code,this.erroredSysCall=i.syscall)}};var tu=Symbol.toStringTag,Qc=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[tu]==="URLSearchParams",i1=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[tu]),C2=t=>typeof t=="object"&&(t[tu]==="AbortSignal"||t[tu]==="EventTarget"),A2=(t,e)=>{let r=new URL(e).hostname,i=new URL(t).hostname;return r===i||r.endsWith(`.${i}`)};var Iy=(0,Pi.promisify)(gr.default.pipeline),Ht=Symbol("Body internals"),ti=class{constructor(e,{size:r=0}={}){let i=null;e===null?e=null:Qc(e)?e=sr.Buffer.from(e.toString()):i1(e)||sr.Buffer.isBuffer(e)||(Pi.types.isAnyArrayBuffer(e)?e=sr.Buffer.from(e):ArrayBuffer.isView(e)?e=sr.Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof gr.default||(e instanceof es?(e=R2(e),i=e.type.split("=")[1]):e=sr.Buffer.from(String(e))));let n=e;sr.Buffer.isBuffer(e)?n=gr.default.Readable.from(e):i1(e)&&(n=gr.default.Readable.from(e.stream())),this[Ht]={body:e,stream:n,boundary:i,disturbed:!1,error:null},this.size=r,e instanceof gr.default&&e.on("error",o=>{let a=o instanceof Ti?o:new Wt(`Invalid response body while trying to fetch ${this.url}: ${o.message}`,"system",o);this[Ht].error=a})}get body(){return this[Ht].stream}get bodyUsed(){return this[Ht].disturbed}async arrayBuffer(){let{buffer:e,byteOffset:r,byteLength:i}=await nu(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(()=>(N2(),L2));return r(this.body,e)}async blob(){let e=this.headers&&this.headers.get("content-type")||this[Ht].body&&this[Ht].body.type||"",r=await this.arrayBuffer();return new Ai([r],{type:e})}async json(){let e=await nu(this);return JSON.parse(e.toString())}async text(){return(await nu(this)).toString()}buffer(){return nu(this)}};ti.prototype.buffer=(0,Pi.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,Pi.deprecate)(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});async function nu(t){if(t[Ht].disturbed)throw new TypeError(`body used already for: ${t.url}`);if(t[Ht].disturbed=!0,t[Ht].error)throw t[Ht].error;let{body:e}=t;if(e===null)return sr.Buffer.alloc(0);if(!(e instanceof gr.default))return sr.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 Wt(`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 Wt(`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")?sr.Buffer.from(r.join("")):sr.Buffer.concat(r,i)}catch(n){throw new Wt(`Could not create Buffer from response body for ${t.url}: ${n.message}`,"system",n)}else throw new Wt(`Premature close of server response while trying to fetch ${t.url}`)}var So=(t,e)=>{let r,i,{body:n}=t[Ht];if(t.bodyUsed)throw new Error("cannot clone body after it is used");return n instanceof gr.default&&typeof n.getBoundary!="function"&&(r=new gr.PassThrough({highWaterMark:e}),i=new gr.PassThrough({highWaterMark:e}),n.pipe(r),n.pipe(i),t[Ht].stream=r,n=i),n},Oy=(0,Pi.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"),su=(t,e)=>t===null?null:typeof t=="string"?"text/plain;charset=UTF-8":Qc(t)?"application/x-www-form-urlencoded;charset=UTF-8":i1(t)?t.type||null:sr.Buffer.isBuffer(t)||Pi.types.isAnyArrayBuffer(t)||ArrayBuffer.isView(t)?null:t instanceof es?`multipart/form-data; boundary=${e[Ht].boundary}`:t&&typeof t.getBoundary=="function"?`multipart/form-data;boundary=${Oy(t)}`:t instanceof gr.default?null:"text/plain;charset=UTF-8",B2=t=>{let{body:e}=t[Ht];return e===null?0:i1(e)?e.size:sr.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 Iy(e,t)};var nf=require("util"),o1=me(require("http"),1),ou=typeof o1.default.validateHeaderName=="function"?o1.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}},sf=typeof o1.default.validateHeaderValue=="function"?o1.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}},Gt=class extends URLSearchParams{constructor(e){let r=[];if(e instanceof Gt){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"&&!nf.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"||nf.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])=>(ou(i),sf(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)=>(ou(a),sf(a,String(h)),URLSearchParams.prototype[n].call(i,String(a).toLowerCase(),String(h)));case"delete":case"has":case"getAll":return a=>(ou(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(Gt.prototype,["get","entries","forEach","values"].reduce((t,e)=>(t[e]={enumerable:!0},t),{}));function z2(t=[]){return new Gt(t.reduce((e,r,i,n)=>(i%2===0&&e.push(n.slice(i,i+2)),e),[]).filter(([e,r])=>{try{return ou(e),sf(e,String(r)),!0}catch{return!1}}))}var ky=new Set([301,302,303,307,308]),au=t=>ky.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 Gt(r.headers);if(e!==null&&!n.has("Content-Type")){let o=su(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(So(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(!au(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 q2=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 $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"]),F2="strict-origin-when-cross-origin";function W2(t){if(!$2.has(t))throw new TypeError(`Invalid referrerPolicy: ${t}`);return t}function Ly(t){if(/^(http|ws)s:$/.test(t.protocol))return!0;let e=t.host.replace(/(^\[)|(]$)/g,""),r=(0,q2.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 Mo(t){return/^about:(blank|srcdoc)$/.test(t)||t.protocol==="data:"||/^(blob|filesystem):$/.test(t.protocol)?!0:Ly(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 Mo(o)&&!Mo(h)?"no-referrer":a.toString();case"strict-origin-when-cross-origin":return o.origin===h.origin?o:Mo(o)&&!Mo(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 Mo(o)&&!Mo(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&&$2.has(i)&&(r=i);return r}var mt=Symbol("Request internals"),lu=t=>typeof t=="object"&&typeof t[mt]=="object",Ny=(0,K2.deprecate)(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)"),Ii=class extends ti{constructor(e,r={}){let i;if(lu(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&&Ny(),(r.body!=null||lu(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:lu(e)&&e.body!==null?So(e):null;super(o,{size:r.size||e.size||0});let a=new Gt(r.headers||e.headers||{});if(o!==null&&!a.has("Content-Type")){let m=su(o,this);m&&a.set("Content-Type",m)}let h=lu(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[mt]={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[mt].method}get url(){return(0,V2.format)(this[mt].parsedURL)}get headers(){return this[mt].headers}get redirect(){return this[mt].redirect}get signal(){return this[mt].signal}get referrer(){if(this[mt].referrer==="no-referrer")return"";if(this[mt].referrer==="client")return"about:client";if(this[mt].referrer)return this[mt].referrer.toString()}get referrerPolicy(){return this[mt].referrerPolicy}set referrerPolicy(e){this[mt].referrerPolicy=W2(e)}clone(){return new Ii(this)}get[Symbol.toStringTag](){return"Request"}};Object.defineProperties(Ii.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[mt],r=new Gt(t[mt].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[mt].referrer=H2(t):t[mt].referrer="no-referrer",t[mt].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 uu=class extends Ti{constructor(e,r="aborted"){super(e,r)}};eu();tf();var By=new Set(["data:","http:","https:"]);async function hu(t,e){return new Promise((r,i)=>{let n=new Ii(t,e),{parsedURL:o,options:a}=J2(n);if(!By.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 uu("The operation was aborted.");i(w),n.body&&n.body instanceof or.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 Wt(`request to ${n.url} failed, reason: ${w.message}`,"system",w)),x()}),Dy(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(au(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 Wt(`uri requested responds with an invalid redirect URL: ${B}`,"invalid-redirect")),x();return}}switch(n.redirect){case"error":i(new Wt(`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 Wt(`maximum redirect reached at: ${n.url}`,"max-redirect")),x();return}let H={headers:new Gt(n.headers),follow:n.follow,counter:n.counter+1,agent:n.agent,compress:n.compress,method:n.method,body:So(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 or.default.Readable){i(new Wt("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(hu(new Ii(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,or.pipeline)(w,new or.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},P=E.get("Content-Encoding");if(!n.compress||n.method==="HEAD"||P===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(P==="gzip"||P==="x-gzip"){T=(0,or.pipeline)(T,ns.default.createGunzip(k),B=>{B&&i(B)}),m=new Ct(T,C),r(m);return}if(P==="deflate"||P==="x-deflate"){let B=(0,or.pipeline)(w,new or.PassThrough,z=>{z&&i(z)});B.once("data",z=>{(z[0]&15)===8?T=(0,or.pipeline)(T,ns.default.createInflate(),H=>{H&&i(H)}):T=(0,or.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(P==="br"){T=(0,or.pipeline)(T,ns.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 Dy(t,e){let r=a1.Buffer.from(`0\r
|
|
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=a1.Buffer.compare(d.slice(-5),r)===0,!n&&o&&(n=a1.Buffer.compare(o.slice(-3),r.slice(0,3))===0&&a1.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 st(e,404,t):t.code==="EACCES"?new st(e,403,t):new st(e,500,t):new st(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=hu;function zy(t){return typeof t!="object"||t==null?!1:t.constructor===Object}var cu=class{constructor(){this.protocol="abstract",this.isOrdered=!0,this.systems=[],this.toArray=p2,this.join=Kc,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)||zy(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}`)}},wt=new cu;var Q2=new Ri;wt.register("",Q2);wt.register("file://",Q2);var e5=new Oi;wt.register("http://",e5);wt.register("https://",e5);var z8=me(bo(),1);var Ye;(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})(Ye||(Ye={}));var ee=Ye.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}},X=Ye.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"]),Uy=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 l1=(t,e)=>{let r;switch(t.code){case X.invalid_type:t.received===ee.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case X.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected)}`;break;case X.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ye.joinValues(t.keys,", ")}`;break;case X.invalid_union:r="Invalid input";break;case X.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ye.joinValues(t.options)}`;break;case X.invalid_enum_value:r=`Invalid enum value. Expected ${Ye.joinValues(t.options)}, received '${t.received}'`;break;case X.invalid_arguments:r="Invalid function arguments";break;case X.invalid_return_type:r="Invalid function return type";break;case X.invalid_date:r="Invalid date";break;case X.invalid_string:t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case X.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 X.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 X.custom:r="Invalid input";break;case X.invalid_intersection_types:r="Intersection results could not be merged";break;case X.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;default:r=e.defaultError,Ye.assertNever(t)}return{message:r}},u1=l1,jy=t=>{u1=t},fu=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}},qy=[];function le(t,e){let r=fu({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,u1,l1].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 pe;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 pe;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}}},pe=Object.freeze({status:"aborted"}),$y=t=>({status:"dirty",value:t}),Lt=t=>({status:"valid",value:t}),of=t=>t.status==="aborted",af=t=>t.status==="dirty",du=t=>t.status==="valid",lf=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 br=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(du(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(lf(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(lf(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:X.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 _r({schema:this,typeName:de.ZodEffects,effect:{type:"refinement",refinement:e}})}optional(){return yr.create(this)}nullable(){return Bi.create(this)}nullish(){return this.optional().nullable()}array(){return vr.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 _r({schema:this,typeName:de.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new h1({innerType:this,defaultValue:r,typeName:de.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}},Fy=/^c[^\s-]{8,}$/i,Wy=/^([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,Hy=/^(([^<>()[\]\.,;:\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:X.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:X.invalid_type,expected:ee.string,received:o.parsedType}),pe}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:X.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:X.too_big,maximum:o.value,type:"string",inclusive:!0,message:o.message}),i.dirty());else if(o.kind==="email")Hy.test(e.data)||(n=this._getOrReturnCtx(e,n),le(n,{validation:"email",code:X.invalid_string,message:o.message}),i.dirty());else if(o.kind==="uuid")Wy.test(e.data)||(n=this._getOrReturnCtx(e,n),le(n,{validation:"uuid",code:X.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid")Fy.test(e.data)||(n=this._getOrReturnCtx(e,n),le(n,{validation:"cuid",code:X.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:X.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:X.invalid_string,message:o.message}),i.dirty())):o.kind==="trim"?e.data=e.data.trim():Ye.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:de.ZodString,...Ce(t)});function Gy(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)!==ee.number){let o=this._getOrReturnCtx(e);return le(o,{code:X.invalid_type,expected:ee.number,received:o.parsedType}),pe}let i,n=new At;for(let o of this._def.checks)o.kind==="int"?Ye.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),le(i,{code:X.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:X.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:X.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,message:o.message}),n.dirty()):o.kind==="multipleOf"?Gy(e.data,o.value)!==0&&(i=this._getOrReturnCtx(e,i),le(i,{code:X.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()):Ye.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:de.ZodNumber,...Ce(t)});var Ro=class extends Se{_parse(e){if(this._getType(e)!==ee.bigint){let i=this._getOrReturnCtx(e);return le(i,{code:X.invalid_type,expected:ee.bigint,received:i.parsedType}),pe}return Lt(e.data)}};Ro.create=t=>new Ro({typeName:de.ZodBigInt,...Ce(t)});var Co=class extends Se{_parse(e){if(this._getType(e)!==ee.boolean){let i=this._getOrReturnCtx(e);return le(i,{code:X.invalid_type,expected:ee.boolean,received:i.parsedType}),pe}return Lt(e.data)}};Co.create=t=>new Co({typeName:de.ZodBoolean,...Ce(t)});var Ao=class extends Se{_parse(e){if(this._getType(e)!==ee.date){let i=this._getOrReturnCtx(e);return le(i,{code:X.invalid_type,expected:ee.date,received:i.parsedType}),pe}if(isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return le(i,{code:X.invalid_date}),pe}return{status:"valid",value:new Date(e.data.getTime())}}};Ao.create=t=>new Ao({typeName:de.ZodDate,...Ce(t)});var To=class extends Se{_parse(e){if(this._getType(e)!==ee.undefined){let i=this._getOrReturnCtx(e);return le(i,{code:X.invalid_type,expected:ee.undefined,received:i.parsedType}),pe}return Lt(e.data)}};To.create=t=>new To({typeName:de.ZodUndefined,...Ce(t)});var Po=class extends Se{_parse(e){if(this._getType(e)!==ee.null){let i=this._getOrReturnCtx(e);return le(i,{code:X.invalid_type,expected:ee.null,received:i.parsedType}),pe}return Lt(e.data)}};Po.create=t=>new Po({typeName:de.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:de.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:de.ZodUnknown,...Ce(t)});var ni=class extends Se{_parse(e){let r=this._getOrReturnCtx(e);return le(r,{code:X.invalid_type,expected:ee.never,received:r.parsedType}),pe}};ni.create=t=>new ni({typeName:de.ZodNever,...Ce(t)});var Io=class extends Se{_parse(e){if(this._getType(e)!==ee.undefined){let i=this._getOrReturnCtx(e);return le(i,{code:X.invalid_type,expected:ee.void,received:i.parsedType}),pe}return Lt(e.data)}};Io.create=t=>new Io({typeName:de.ZodVoid,...Ce(t)});var vr=class extends Se{_parse(e){let{ctx:r,status:i}=this._processInputParams(e),n=this._def;if(r.parsedType!==ee.array)return le(r,{code:X.invalid_type,expected:ee.array,received:r.parsedType}),pe;if(n.minLength!==null&&r.data.length<n.minLength.value&&(le(r,{code:X.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:X.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 br(r,a,r.path,h)))).then(a=>At.mergeArray(i,a));let o=r.data.map((a,h)=>n.type._parseSync(new br(r,a,r.path,h)));return At.mergeArray(i,o)}get element(){return this._def.type}min(e,r){return new vr({...this._def,minLength:{value:e,message:$e.toString(r)}})}max(e,r){return new vr({...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)}};vr.create=(t,e)=>new vr({type:t,minLength:null,maxLength:null,typeName:de.ZodArray,...Ce(e)});var mu;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(mu||(mu={}));var r5=t=>e=>new Je({...t,shape:()=>({...t.shape(),...e})});function Eo(t){if(t instanceof Je){let e={};for(let r in t.shape){let i=t.shape[r];e[r]=yr.create(Eo(i))}return new Je({...t._def,shape:()=>e})}else return t instanceof vr?vr.create(Eo(t.element)):t instanceof yr?yr.create(Eo(t.unwrap())):t instanceof Bi?Bi.create(Eo(t.unwrap())):t instanceof wr?wr.create(t.items.map(e=>Eo(e))):t}var Je=class extends Se{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=Ye.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:X.invalid_type,expected:ee.object,received:m.parsedType}),pe}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 br(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:X.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 br(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 Je({...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 Je({...this._def,unknownKeys:"strip"})}passthrough(){return new Je({...this._def,unknownKeys:"passthrough"})}setKey(e,r){return this.augment({[e]:r})}merge(e){return new Je({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>mu.mergeShapes(this._def.shape(),e._def.shape()),typeName:de.ZodObject})}catchall(e){return new Je({...this._def,catchall:e})}pick(e){let r={};return Ye.objectKeys(e).map(i=>{this.shape[i]&&(r[i]=this.shape[i])}),new Je({...this._def,shape:()=>r})}omit(e){let r={};return Ye.objectKeys(this.shape).map(i=>{Ye.objectKeys(e).indexOf(i)===-1&&(r[i]=this.shape[i])}),new Je({...this._def,shape:()=>r})}deepPartial(){return Eo(this)}partial(e){let r={};if(e)return Ye.objectKeys(this.shape).map(i=>{Ye.objectKeys(e).indexOf(i)===-1?r[i]=this.shape[i]:r[i]=this.shape[i].optional()}),new Je({...this._def,shape:()=>r});for(let i in this.shape){let n=this.shape[i];r[i]=n.optional()}return new Je({...this._def,shape:()=>r})}required(){let e={};for(let r in this.shape){let n=this.shape[r];for(;n instanceof yr;)n=n._def.innerType;e[r]=n}return new Je({...this._def,shape:()=>e})}};Je.create=(t,e)=>new Je({shape:()=>t,unknownKeys:"strip",catchall:ni.create(),typeName:de.ZodObject,...Ce(e)});Je.strictCreate=(t,e)=>new Je({shape:()=>t,unknownKeys:"strict",catchall:ni.create(),typeName:de.ZodObject,...Ce(e)});Je.lazycreate=(t,e)=>new Je({shape:t,unknownKeys:"strip",catchall:ni.create(),typeName:de.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:X.invalid_union,unionErrors:a}),pe}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:X.invalid_union,unionErrors:h}),pe}}get options(){return this._def.options}};ss.create=(t,e)=>new ss({options:t,typeName:de.ZodUnion,...Ce(e)});var Oo=class extends Se{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ee.object)return le(r,{code:X.invalid_type,expected:ee.object,received:r.parsedType}),pe;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:X.invalid_union_discriminator,options:this.validDiscriminatorValues,path:[i]}),pe)}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 Oo({typeName:de.ZodDiscriminatedUnion,discriminator:e,options:n,...Ce(i)})}};function uf(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=Ye.objectKeys(e),o=Ye.objectKeys(t).filter(h=>n.indexOf(h)!==-1),a={...t,...e};for(let h of o){let d=uf(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=uf(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 os=class extends Se{_parse(e){let{status:r,ctx:i}=this._processInputParams(e),n=(o,a)=>{if(of(o)||of(a))return pe;let h=uf(o.value,a.value);return h.valid?((af(o)||af(a))&&r.dirty(),{status:r.value,value:h.data}):(le(i,{code:X.invalid_intersection_types}),pe)};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:de.ZodIntersection,...Ce(r)});var wr=class extends Se{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==ee.array)return le(i,{code:X.invalid_type,expected:ee.array,received:i.parsedType}),pe;if(i.data.length<this._def.items.length)return le(i,{code:X.too_small,minimum:this._def.items.length,inclusive:!0,type:"array"}),pe;!this._def.rest&&i.data.length>this._def.items.length&&(le(i,{code:X.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 br(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 wr({...this._def,rest:e})}};wr.create=(t,e)=>new wr({items:t,typeName:de.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!==ee.object)return le(i,{code:X.invalid_type,expected:ee.object,received:i.parsedType}),pe;let n=[],o=this._def.keyType,a=this._def.valueType;for(let h in i.data)n.push({key:o._parse(new br(i,h,i.path,h)),value:a._parse(new br(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:de.ZodRecord,...Ce(i)}):new as({keyType:ii.create(),valueType:e,typeName:de.ZodRecord,...Ce(r)})}},ko=class extends Se{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==ee.map)return le(i,{code:X.invalid_type,expected:ee.map,received:i.parsedType}),pe;let n=this._def.keyType,o=this._def.valueType,a=[...i.data.entries()].map(([h,d],m)=>({key:n._parse(new br(i,h,i.path,[m,"key"])),value:o._parse(new br(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 pe;(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 pe;(m.status==="dirty"||p.status==="dirty")&&r.dirty(),h.set(m.value,p.value)}return{status:r.value,value:h}}}};ko.create=(t,e,r)=>new ko({valueType:e,keyType:t,typeName:de.ZodMap,...Ce(r)});var Li=class extends Se{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==ee.set)return le(i,{code:X.invalid_type,expected:ee.set,received:i.parsedType}),pe;let n=this._def;n.minSize!==null&&i.data.size<n.minSize.value&&(le(i,{code:X.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:X.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 pe;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 br(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:de.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!==ee.function)return le(r,{code:X.invalid_type,expected:ee.function,received:r.parsedType}),pe;function i(h,d){return fu({data:h,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,u1,l1].filter(m=>!!m),issueData:{code:X.invalid_arguments,argumentsError:d}})}function n(h,d){return fu({data:h,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,u1,l1].filter(m=>!!m),issueData:{code:X.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:wr.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()):wr.create([]).rest(ri.create()),returns:e||ri.create(),typeName:de.ZodFunction,...Ce(r)});var Lo=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})}};Lo.create=(t,e)=>new Lo({getter:t,typeName:de.ZodLazy,...Ce(e)});var No=class extends Se{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return le(r,{code:X.invalid_literal,expected:this._def.value}),pe}return{status:"valid",value:e.data}}get value(){return this._def.value}};No.create=(t,e)=>new No({value:t,typeName:de.ZodLiteral,...Ce(e)});function Vy(t,e){return new Bo({values:t,typeName:de.ZodEnum,...Ce(e)})}var Bo=class extends Se{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),i=this._def.values;return le(r,{expected:Ye.joinValues(i),received:r.parsedType,code:X.invalid_type}),pe}if(this._def.values.indexOf(e.data)===-1){let r=this._getOrReturnCtx(e),i=this._def.values;return le(r,{received:r.data,code:X.invalid_enum_value,options:i}),pe}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}};Bo.create=Vy;var Do=class extends Se{_parse(e){let r=Ye.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==ee.string&&i.parsedType!==ee.number){let n=Ye.objectValues(r);return le(i,{expected:Ye.joinValues(n),received:i.parsedType,code:X.invalid_type}),pe}if(r.indexOf(e.data)===-1){let n=Ye.objectValues(r);return le(i,{received:i.data,code:X.invalid_enum_value,options:n}),pe}return Lt(e.data)}get enum(){return this._def.values}};Do.create=(t,e)=>new Do({values:t,typeName:de.ZodNativeEnum,...Ce(e)});var fn=class extends Se{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ee.promise&&r.common.async===!1)return le(r,{code:X.invalid_type,expected:ee.promise,received:r.parsedType}),pe;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:de.ZodPromise,...Ce(e)});var _r=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"?pe:(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"?pe:(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(!du(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=>du(a)?Promise.resolve(n.transform(a.value,o)).then(h=>({status:r.value,value:h})):a);Ye.assertNever(n)}};_r.create=(t,e,r)=>new _r({schema:t,typeName:de.ZodEffects,effect:e,...Ce(r)});_r.createWithPreprocess=(t,e,r)=>new _r({schema:e,effect:{type:"preprocess",transform:t},typeName:de.ZodEffects,...Ce(r)});var yr=class extends Se{_parse(e){return this._getType(e)===ee.undefined?Lt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};yr.create=(t,e)=>new yr({innerType:t,typeName:de.ZodOptional,...Ce(e)});var Bi=class extends Se{_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:de.ZodNullable,...Ce(e)});var h1=class extends Se{_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}};h1.create=(t,e)=>new yr({innerType:t,typeName:de.ZodOptional,...Ce(e)});var zo=class extends Se{_parse(e){if(this._getType(e)!==ee.nan){let i=this._getOrReturnCtx(e);return le(i,{code:X.invalid_type,expected:ee.nan,received:i.parsedType}),pe}return{status:"valid",value:e.data}}};zo.create=t=>new zo({typeName:de.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(),Ky={object:Je.lazycreate},de;(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"})(de||(de={}));var Jy=(t,e={message:`Input not instance of ${t.name}`})=>n5(r=>r instanceof t,e,!0),s5=ii.create,o5=ki.create,Zy=zo.create,Yy=Ro.create,a5=Co.create,Xy=Ao.create,Qy=To.create,e8=Po.create,t8=cn.create,r8=ri.create,i8=ni.create,n8=Io.create,s8=vr.create,o8=Je.create,a8=Je.strictCreate,l8=ss.create,u8=Oo.create,h8=os.create,c8=wr.create,f8=as.create,d8=ko.create,m8=Li.create,p8=Ni.create,g8=Lo.create,y8=No.create,b8=Bo.create,v8=Do.create,w8=fn.create,i5=_r.create,_8=yr.create,x8=Bi.create,S8=_r.createWithPreprocess,M8=()=>s5().optional(),E8=()=>o5().optional(),R8=()=>a5().optional(),oe=Object.freeze({__proto__:null,getParsedType:hn,ZodParsedType:ee,makeIssue:fu,EMPTY_PATH:qy,addIssueToContext:le,ParseStatus:At,INVALID:pe,DIRTY:$y,OK:Lt,isAborted:of,isDirty:af,isValid:du,isAsync:lf,ZodType:Se,ZodString:ii,ZodNumber:ki,ZodBigInt:Ro,ZodBoolean:Co,ZodDate:Ao,ZodUndefined:To,ZodNull:Po,ZodAny:cn,ZodUnknown:ri,ZodNever:ni,ZodVoid:Io,ZodArray:vr,get objectUtil(){return mu},ZodObject:Je,ZodUnion:ss,ZodDiscriminatedUnion:Oo,ZodIntersection:os,ZodTuple:wr,ZodRecord:as,ZodMap:ko,ZodSet:Li,ZodFunction:Ni,ZodLazy:Lo,ZodLiteral:No,ZodEnum:Bo,ZodNativeEnum:Do,ZodPromise:fn,ZodEffects:_r,ZodTransformer:_r,ZodOptional:yr,ZodNullable:Bi,ZodDefault:h1,ZodNaN:zo,custom:n5,Schema:Se,ZodSchema:Se,late:Ky,get ZodFirstPartyTypeKind(){return de},any:t8,array:s8,bigint:Yy,boolean:a5,date:Xy,discriminatedUnion:u8,effect:i5,enum:b8,function:p8,instanceof:Jy,intersection:h8,lazy:g8,literal:y8,map:d8,nan:Zy,nativeEnum:v8,never:i8,null:e8,nullable:x8,number:o5,object:o8,oboolean:R8,onumber:E8,optional:_8,ostring:M8,preprocess:S8,promise:w8,record:f8,set:m8,strictObject:a8,string:s5,transformer:i5,tuple:c8,undefined:Qy,union:l8,unknown:r8,void:n8,ZodIssueCode:X,quotelessJson:Uy,ZodError:Br,defaultErrorMap:l1,get overrideErrorMap(){return u1},setErrorMap:jy});var C8=oe.object({title:oe.string(),description:oe.string(),fees:oe.string(),accessConstraints:oe.string()}),A8=oe.object({deliveryPoint:oe.string(),city:oe.string(),postalCode:oe.string(),country:oe.string(),email:oe.string()}),T8=oe.object({individualName:oe.string(),position:oe.string(),phone:oe.string(),address:A8}),P8=oe.object({name:oe.string(),site:oe.string(),contact:T8}),I8=oe.object({id:oe.string(),serviceIdentification:C8,serviceProvider:P8});var O8=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 k8(t){try{return Kl(t),!0}catch{return!1}}var L8=oe.string().refine(k8,{message:"Invalid hex color"}),Uo={minZoom:0,maxZoom:32},pu=oe.number().refine(t=>t>=Uo.minZoom&&t<=Uo.maxZoom,{message:`must be between ${Uo.minZoom} and ${Uo.maxZoom}`}),N8=oe.object({name:oe.string(),title:oe.string().optional(),category:oe.string().optional(),2193:oe.string().optional(),3857:oe.string().optional(),minZoom:pu.optional(),maxZoom:pu.optional()}).refine(({minZoom:t,maxZoom:e})=>(t||Uo.minZoom)<=(e||Uo.maxZoom),{message:"minZoom may no be greater than maxZoom",path:["minZoom"]}),B8=oe.object({type:oe.nativeEnum(nt),id:oe.string(),title:oe.string().optional(),category:oe.string().optional(),description:oe.string().optional(),background:L8.optional(),layers:oe.array(N8),minZoom:pu.optional(),maxZoom:pu.optional(),format:oe.union([oe.nativeEnum(Ge),oe.nativeEnum(nr)]).optional()});var c1={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 k0=me(e0(),1);var zr=me(dm(),1);function Kv(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()}] ${Kv(e.level)} ${zr.default.blue(e.msg)} ${n}`}};Di.Ignore=new Set(["pid","time","hostname","level","v","name","msg"]);var _p=me(wp(),1),Vo=require("stream"),xp=require("string_decoder");function tx(t){try{return JSON.parse(t)}catch{return null}}function rx(t){t!=null&&console.error("PrettyTransformFailed",t)}var _n=class extends Vo.Transform{constructor(){super(),this.pretty=new Di(-1),this.decoder=new xp.StringDecoder}static stream(e=process.stdout){let r=new Vo.PassThrough;return _n.pretty(r,e),r}static pretty(e,r=process.stdout){let i=new _n;return(0,Vo.pipeline)(e,(0,_p.default)(),i,r,rx),i}_transform(e,r,i){if(r!=="buffer")return i(new Error(`Unknown encoding: ${r}`));let n=this.decoder.write(e),o=tx(n);if(o==null)return i(null,e+`
|
|
132
|
+
`))}};rg.exports=gd});var sg=V((QI,ng)=>{"use strict";var bS=ig(),gc={STATIC:0,PARAMETRIC:1,WILDCARD:2},fc=class{constructor(){this.handlerStorage=new bS}},dc=class extends fc{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 da(e),this.staticChildren[i]}},da=class extends dc{constructor(e){super(),this.prefix=e,this.wildcardChild=null,this.parametricChildren=[],this.kind=gc.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 mc(e),e?this.parametricChildren.unshift(i):this.parametricChildren.push(i),i)}createWildcardChild(){return this.wildcardChild?this.wildcardChild:(this.wildcardChild=new pc,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 da(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 c=this.parametricChildren.length-1;c>=a;c--)i.push({paramsCount:n,brotherPathIndex:r,brotherNode:this.parametricChildren[c]});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(" && ")}`)}},mc=class extends dc{constructor(e){super(),this.regex=e||null,this.isRegex=!!e,this.kind=gc.PARAMETRIC}getNextNode(e,r){return this.findStaticMatchingChild(e,r)}},pc=class extends fc{constructor(){super(),this.kind=gc.WILDCARD}getNextNode(){return null}};ng.exports={StaticNode:da,ParametricNode:mc,WildcardNode:pc,NODE_TYPES:gc}});var ag=V((eO,og)=>{"use strict";var vS=require("assert");function $1(){if(!(this instanceof $1))return new $1;this.store={},this.maxMajor=0,this.maxMinors={},this.maxPatches={}}$1.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};$1.prototype.get=function(t){return this.store[t]};og.exports={name:"version",mustMatchWhenDerived:!0,storage:$1,validate(t){vS(typeof t=="string","Version should be a string")}}});var ug=V((tO,lg)=>{"use strict";var wS=require("assert");function _S(){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}}}lg.exports={name:"host",mustMatchWhenDerived:!1,storage:_S,validate(t){wS(typeof t=="string"||Object.prototype.toString.call(t)==="[object RegExp]","Host should be a string or a RegExp")}}});var hg=V((rO,cg)=>{"use strict";var xS=ag(),SS=ug(),yd=require("assert"),bd=class{constructor(e){if(this.strategies={version:xS,host:SS},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(yd(typeof e.name=="string"&&e.name!=="","strategy.name is required."),yd(e.storage&&typeof e.storage=="function","strategy.storage function is required."),yd(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)}};cg.exports=bd});var mg=V((iO,dg)=>{"use strict";function fg(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 MS(t){let e=!1,r=!1,i="";for(let o=1;o<t.length;o++){let a=t.charCodeAt(o);if(a===37){let c=t.charCodeAt(o+1),d=t.charCodeAt(o+2);fg(c,d)===null?e=!0:(r=!0,c===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 ES(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),c=fg(o,a);r+=t.slice(i,n)+c,i=n+3}return t.slice(0,e)+r+t.slice(i)}dg.exports={safeDecodeURI:MS,safeDecodeURIComponent:ES}});var wg=V((nO,vg)=>{"use strict";var ft=require("assert"),yc=require("http"),RS=require("querystring"),_d=W6(),yg=G6(),{flattenNode:CS,compressFlattenedNode:AS,prettyPrintFlattenedNode:TS,prettyPrintRoutesArray:PS}=tg(),{StaticNode:pg,NODE_TYPES:vd}=sg(),IS=hg(),{safeDecodeURI:OS,safeDecodeURIComponent:gg}=mg(),xd=yc.METHODS,bg=/^https?:\/\/.*?\//,Ts=/(\/:[^/()]*?)\?(\/?)/;if(!_d(bg))throw new Error("the FULL_PATH_REGEXP is not safe, update this module");if(!_d(Ts))throw new Error("the OPTIONAL_PARAM_REGEXP is not safe, update this module");function dt(t){if(!(this instanceof dt))return new dt(t);t=t||{},t.defaultRoute?(ft(typeof t.defaultRoute=="function","The default route must be a function"),this.defaultRoute=t.defaultRoute):this.defaultRoute=null,t.onBadUrl?(ft(typeof t.onBadUrl=="function","The bad url handler must be a function"),this.onBadUrl=t.onBadUrl):this.onBadUrl=null,t.buildPrettyMeta?(ft(typeof t.buildPrettyMeta=="function","buildPrettyMeta must be a function"),this.buildPrettyMeta=t.buildPrettyMeta):this.buildPrettyMeta=BS,t.querystringParser?(ft(typeof t.querystringParser=="function","querystringParser must be a function"),this.querystringParser=t.querystringParser):this.querystringParser=e=>e===""?{}:RS.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 IS(t.constraints),this._routesPatterns=[]}dt.prototype.on=function(e,r,i,n,o){typeof i=="function"&&(n!==void 0&&(o=n),n=i,i={}),ft(typeof r=="string","Path should be a string"),ft(r.length>0,"The path could not be empty"),ft(r[0]==="/"||r[0]==="*","The first character of a path should be `/` or `*`"),ft(typeof n=="function","Handler should be a function");let a=r.match(Ts);if(a){ft(r.length===a.index+a[0].length,"Optional Parameter needs to be the last parameter of the path");let p=r.replace(Ts,"$1$2"),m=r.replace(Ts,"$2");this.on(e,p,i,n,o),this.on(e,m,i,n,o);return}let c=r;this.ignoreDuplicateSlashes&&(r=Sd(r)),this.ignoreTrailingSlash&&(r=Md(r));let d=Array.isArray(e)?e:[e];for(let p of d)this._on(p,r,i,n,o,c),this.routes.push({method:p,path:r,opts:i,handler:n,store:o})};dt.prototype._on=function(e,r,i,n,o){ft(typeof e=="string","Method should be a string"),ft(xd.includes(e),`Method '${e}' is not an http method.`);let a={};if(i.constraints!==void 0&&(ft(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 pg("/")),r==="*"&&this.trees[e].prefix.length!==0){let m=this.trees[e];this.trees[e]=new pg(""),this.trees[e].staticChildren["/"]=m}let c=this.trees[e],d=c.prefix.length,p=[];for(let m=0;m<=r.length;m++){if(r.charCodeAt(m)===58&&r.charCodeAt(m+1)===58){m++;continue}let S=r.charCodeAt(m)===58&&r.charCodeAt(m+1)!==58,R=r.charCodeAt(m)===42;if(S||R||m===r.length&&m!==d){let x=r.slice(d,m);this.caseSensitive||(x=x.toLowerCase()),x=x.split("::").join(":"),x=x.split("%").join("%25"),c=c.createStaticChild(x)}if(S){let x=!1,w=[],E=0,T=m+1;for(let P=T;;P++){let L=r.charCodeAt(P);if(L===40||L===45||L===46){x=!0;let B=r.slice(T,P);if(p.push(B),L===40){let Z=NS(r,P),se=r.slice(P,Z+1);this.allowUnsafeRegex||ft(_d(new RegExp(se)),`The regex '${se}' is not safe!`),w.push(kS(se)),P=Z+1}else w.push("(.*?)");let z=P;for(;z<r.length;z++){let Z=r.charCodeAt(z);if(Z===58||Z===47)break}let q=r.slice(P,z);q&&w.push(LS(q)),T=z+1,P=z,(r.charCodeAt(P)===47||P===r.length)&&(E=q.length)}else if(L===47||P===r.length){let B=r.slice(T,P);p.push(B),w.length!==0&&w.push("(.*?)")}if(r.charCodeAt(P)===47||P===r.length){r=r.slice(0,m+1)+r.slice(P-E),m+=E;break}}let C=null;x&&(C=new RegExp("^"+w.join("")+"$")),c=c.createParametricChild(C),d=m+1}else R&&(p.push("*"),c=c.createWildcardChild(),d=m+1)}this.caseSensitive||(r=r.toLowerCase());for(let m of this._routesPatterns)if(m.path===r&&m.method===e&&yg(m.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}),c.handlerStorage.addHandler(n,p,o,this.constrainer,a)};dt.prototype.hasConstraintStrategy=function(t){return this.constrainer.hasConstraintStrategy(t)};dt.prototype.addConstraintStrategy=function(t){this.constrainer.addConstraintStrategy(t),this._rebuild(this.routes)};dt.prototype.reset=function(){this.trees={},this.routes=[],this._routesPatterns=[]};dt.prototype.off=function(e,r,i){ft(typeof r=="string","Path should be a string"),ft(r.length>0,"The path could not be empty"),ft(r[0]==="/"||r[0]==="*","The first character of a path should be `/` or `*`");let n=r.match(Ts);if(n){ft(r.length===n.index+n[0].length,"Optional Parameter needs to be the last parameter of the path");let a=r.replace(Ts,"$1$2"),c=r.replace(Ts,"$2");this.off(e,a,i),this.off(e,c,i);return}this.ignoreDuplicateSlashes&&(r=Sd(r)),this.ignoreTrailingSlash&&(r=Md(r));let o=Array.isArray(e)?e:[e];for(let a of o)this._off(a,r,i)};dt.prototype._off=function(e,r,i){ft(typeof e=="string","Method should be a string"),ft(xd.includes(e),`Method '${e}' is not an http method.`);function n(a){return!i||!a?!0:yg(i,a)}let o=this.routes.filter(a=>e!==a.method||r!==a.path||!n(a.opts.constraints));this._rebuild(o)};dt.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)};dt.prototype.find=function(e,r,i){let n=this.trees[e];if(n===void 0)return null;r.charCodeAt(0)!==47&&(r=r.replace(bg,"/")),this.ignoreDuplicateSlashes&&(r=Sd(r));let o,a,c;try{o=OS(r),r=o.path,a=o.querystring,c=o.shouldDecodeParam}catch{return this._onBadUrl(r)}this.ignoreTrailingSlash&&(r=Md(r));let d=r;this.caseSensitive===!1&&(r=r.toLowerCase());let p=this.maxParamLength,m=n.prefix.length,S=[],R=r.length,x=[];for(;;){if(m===R){let E=n.handlerStorage.getMatchingHandler(i);if(E!==null)return{handler:E.handler,store:E.store,params:E._createParamsObject(S),searchParams:this.querystringParser(a)}}let w=n.getNextNode(r,m,x,S.length);if(w===null){if(x.length===0)return null;let E=x.pop();m=E.brotherPathIndex,S.splice(E.paramsCount),w=E.brotherNode}if(n=w,n.kind===vd.STATIC){m+=n.prefix.length;continue}if(n.kind===vd.WILDCARD){let E=d.slice(m);c&&(E=gg(E)),S.push(E),m=R;continue}if(n.kind===vd.PARAMETRIC){let E=d.indexOf("/",m);E===-1&&(E=R);let T=d.slice(m,E);if(c&&(T=gg(T)),n.isRegex){let C=n.regex.exec(T);if(C===null)continue;for(let P=1;P<C.length;P++){let L=C[P];if(L.length>p)return null;S.push(L)}}else{if(T.length>p)return null;S.push(T)}m=E}}};dt.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})}};dt.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()};dt.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}};dt.prototype.prettyPrint=function(t={}){if(t.commonPrefix=t.commonPrefix===void 0?!0:t.commonPrefix,!t.commonPrefix)return PS.call(this,this.routes,t);let e={prefix:"/",nodes:[],children:{}};for(let r in this.trees){let i=this.trees[r];i&&CS(e,i,r)}return AS(e),TS.call(this,e,"",!0,t)};for(wd in yc.METHODS){if(!yc.METHODS.hasOwnProperty(wd))continue;let t=yc.METHODS[wd],e=t.toLowerCase();if(dt.prototype[e])throw new Error("Method already exists: "+e);dt.prototype[e]=function(r,i,n){return this.on(t,r,i,n)}}var wd;dt.prototype.all=function(t,e,r){this.on(xd,t,e,r)};vg.exports=dt;function LS(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Sd(t){return t.replace(/\/\/+/g,"/")}function Md(t){return t.length>1&&t.charCodeAt(t.length-1)===47?t.slice(0,-1):t}function kS(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 NS(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 BS(t){return t?t.store?Object.assign({},t.store):{}:{}}});var kd=V(Ld=>{Ld.read=function(t,e,r,i,n){var o,a,c=n*8-i-1,d=(1<<c)-1,p=d>>1,m=-7,S=r?n-1:0,R=r?-1:1,x=t[e+S];for(S+=R,o=x&(1<<-m)-1,x>>=-m,m+=c;m>0;o=o*256+t[e+S],S+=R,m-=8);for(a=o&(1<<-m)-1,o>>=-m,m+=i;m>0;a=a*256+t[e+S],S+=R,m-=8);if(o===0)o=1-p;else{if(o===d)return a?NaN:(x?-1:1)*(1/0);a=a+Math.pow(2,i),o=o-p}return(x?-1:1)*a*Math.pow(2,o-i)};Ld.write=function(t,e,r,i,n,o){var a,c,d,p=o*8-n-1,m=(1<<p)-1,S=m>>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?(c=isNaN(e)?1:0,a=m):(a=Math.floor(Math.log(e)/Math.LN2),e*(d=Math.pow(2,-a))<1&&(a--,d*=2),a+S>=1?e+=R/d:e+=R*Math.pow(2,1-S),e*d>=2&&(a++,d/=2),a+S>=m?(c=0,a=m):a+S>=1?(c=(e*d-1)*Math.pow(2,n),a=a+S):(c=e*Math.pow(2,S-1)*Math.pow(2,n),a=0));n>=8;t[r+x]=c&255,x+=w,c/=256,n-=8);for(a=a<<n|c,p+=n;p>0;t[r+x]=a&255,x+=w,a/=256,p-=8);t[r+x-w]|=E*128}});var o4=V((AD,s4)=>{"use strict";s4.exports=fM;var hM={threshold:.1,includeAA:!1,alpha:.1,aaColor:[255,255,0],diffColor:[255,0,0],diffColorAlt:null,diffMask:!1};function fM(t,e,r,i,n,o){if(!Yd(t)||!Yd(e)||r&&!Yd(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({},hM,o);let a=i*n,c=new Uint32Array(t.buffer,t.byteOffset,a),d=new Uint32Array(e.buffer,e.byteOffset,a),p=!0;for(let R=0;R<a;R++)if(c[R]!==d[R]){p=!1;break}if(p){if(r&&!o.diffMask)for(let R=0;R<a;R++)i4(t,4*R,o.alpha,r);return 0}let m=35215*o.threshold*o.threshold,S=0;for(let R=0;R<n;R++)for(let x=0;x<i;x++){let w=(R*i+x)*4,E=n4(t,e,w,w);Math.abs(E)>m?!o.includeAA&&(e4(t,x,R,i,n,e)||e4(e,x,R,i,n,t))?r&&!o.diffMask&&Qd(r,w,...o.aaColor):(r&&Qd(r,w,...E<0&&o.diffColorAlt||o.diffColor),S++):r&&(o.diffMask||i4(t,w,o.alpha,r))}return S}function Yd(t){return ArrayBuffer.isView(t)&&t.constructor.BYTES_PER_ELEMENT===1}function e4(t,e,r,i,n,o){let a=Math.max(e-1,0),c=Math.max(r-1,0),d=Math.min(e+1,i-1),p=Math.min(r+1,n-1),m=(r*i+e)*4,S=e===a||e===d||r===c||r===p?1:0,R=0,x=0,w,E,T,C;for(let P=a;P<=d;P++)for(let L=c;L<=p;L++){if(P===e&&L===r)continue;let B=n4(t,t,m,(L*i+P)*4,!0);if(B===0){if(S++,S>2)return!1}else B<R?(R=B,w=P,E=L):B>x&&(x=B,T=P,C=L)}return R===0||x===0?!1:Uc(t,w,E,i,n)&&Uc(o,w,E,i,n)||Uc(t,T,C,i,n)&&Uc(o,T,C,i,n)}function Uc(t,e,r,i,n){let o=Math.max(e-1,0),a=Math.max(r-1,0),c=Math.min(e+1,i-1),d=Math.min(r+1,n-1),p=(r*i+e)*4,m=e===o||e===c||r===a||r===d?1:0;for(let S=o;S<=c;S++)for(let R=a;R<=d;R++){if(S===e&&R===r)continue;let x=(R*i+S)*4;if(t[p]===t[x]&&t[p+1]===t[x+1]&&t[p+2]===t[x+2]&&t[p+3]===t[x+3]&&m++,m>2)return!0}return!1}function n4(t,e,r,i,n){let o=t[r+0],a=t[r+1],c=t[r+2],d=t[r+3],p=e[i+0],m=e[i+1],S=e[i+2],R=e[i+3];if(d===R&&o===p&&a===m&&c===S)return 0;d<255&&(d/=255,o=Ls(o,d),a=Ls(a,d),c=Ls(c,d)),R<255&&(R/=255,p=Ls(p,R),m=Ls(m,R),S=Ls(S,R));let x=Xd(o,a,c),w=Xd(p,m,S),E=x-w;if(n)return E;let T=t4(o,a,c)-t4(p,m,S),C=r4(o,a,c)-r4(p,m,S),P=.5053*E*E+.299*T*T+.1957*C*C;return x>w?-P:P}function Xd(t,e,r){return t*.29889531+e*.58662247+r*.11448223}function t4(t,e,r){return t*.59597799-e*.2741761-r*.32180189}function r4(t,e,r){return t*.21147017-e*.52261711+r*.31114694}function Ls(t,e){return 255+(t-255)*e}function Qd(t,e,r,i,n){t[e+0]=r,t[e+1]=i,t[e+2]=n,t[e+3]=255}function i4(t,e,r,i){let n=t[e+0],o=t[e+1],a=t[e+2],c=Ls(Xd(n,o,a),r*t[e+3]/255);Qd(i,e,c,c,c)}});var RM={};h2(RM,{handler:()=>Ue});module.exports=wy(RM);var r1={Aws:{Region:"ap-southeast-2"},ApiKey:{QueryString:"api",TableName:"ApiKey",RequestLimitMinute:1e3},TileMetadata:{TableName:"TileMetadata",RequestLimitMinute:1e3}},ze={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:"AWS_ROLE_CONFIG_PATH",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=ze.get(t);if(r===""||r==null)return e;let i=parseFloat(r);return isNaN(i)?e:i},isProduction(){return!0}};var E0=me(Gf(),1);var jr=me(v9(),1);function Pb(t){return t<=10?jr.default.gray("TRACE"):t<=20?jr.default.magenta("DEBUG"):t<=30?jr.default.cyan("INFO"):t<=40?jr.default.yellow("WARN"):t<=50?jr.default.red("ERROR"):jr.default.bgRed("FATAL")}var Ci=class{constructor(e){this.level=e}static formatObject(e){let r=[];for(let i of Object.keys(e)){if(Ci.Ignore.has(i))continue;let n=e[i];if(n==null||n==="")continue;let o="",a=typeof n;if(a==="number")o=jr.default.yellow(String(n));else if(a==="string")o=jr.default.green(n);else if(a==="object"){let c=this.formatObject(n);c.length>0&&(o=`{ ${c.join(" ")} }`)}else o=String(n);o!==""&&r.push(`${jr.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=Ci.formatObject(e).join(" ");return`[${r.toISOString()}] ${Pb(e.level)} ${jr.default.blue(e.msg)} ${n}`}};Ci.Ignore=new Set(["pid","time","hostname","level","v","name","msg"]);var Cm=me(Rm(),1),Ro=require("stream"),Am=require("string_decoder");function Dw(t){try{return JSON.parse(t)}catch{return null}}function zw(t){t!=null&&console.error("PrettyTransformFailed",t)}var bn=class extends Ro.Transform{constructor(){super(),this.pretty=new Ci(-1),this.decoder=new Am.StringDecoder}static stream(e=process.stdout){let r=new Ro.PassThrough;return bn.pretty(r,e),r}static pretty(e,r=process.stdout){let i=new bn;return(0,Ro.pipeline)(e,(0,Cm.default)(),i,r,zw),i}_transform(e,r,i){if(r!=="buffer")return i(new Error(`Unknown encoding: ${r}`));let n=this.decoder.write(e),o=Dw(n);if(o==null)return i(null,e+`
|
|
136
134
|
`);let a=this.pretty.pretty(o);if(a==null)return i(null,e+`
|
|
137
135
|
`);i(null,a+`
|
|
138
|
-
`)}};var Hu,Sp={level:"debug"},Gu={get(){return Hu==null&&(Hu=process.stdout.isTTY?(0,k0.default)(Sp,_n.stream()):(0,k0.default)(Sp)),Hu},set(t){Hu=t},disable(){Gu.get().level="silent"}};var L0=me(bo(),1);var Mp=24*60*60*1e3,GA=30*Mp,ix=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,L0.decodeTime)(e);if(t.startsWith("d"))return{valid:!0,key:t};if(Date.now()-r>ix)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 N0,nx=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=(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 Tp(t){var e;return t>=55296&&t<=57343||t>1114111?65533:(e=nx.get(t))!==null&&e!==void 0?e:t}function B0(t){return Ap(Tp(t))}var ar;(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"})(ar||(ar={}));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 Pp(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)===ar.NUM){let M=a+1,R=10,x=r.charCodeAt(M);(x|ar.To_LOWER_BIT)===ar.LOWER_X&&(R=16,a+=1,M+=1);do x=r.charCodeAt(++a);while(x>=ar.ZERO&&x<=ar.NINE||R===16&&(x|ar.To_LOWER_BIT)>=ar.LOWER_A&&(x|ar.To_LOWER_BIT)<=ar.LOWER_F);if(M!==a){let w=r.substring(M,a),E=parseInt(w,R);if(r.charCodeAt(a)===ar.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=sx(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)===ar.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 sx(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 eT=Pp(Rp),tT=Pp(Cp);var ox=new Map([[34,"""],[38,"&"],[39,"'"],[60,"<"],[62,">"]]),ax=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 Vu=D0(/[&<>'"]/g,ox),Ip=D0(/["&\u00A0]/g,new Map([[34,"""],[38,"&"],[160," "]])),Op=D0(/[&<>\u00A0]/g,new Map([[38,"&"],[60,"<"],[62,">"],[160," "]]));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 Ku=t=>" ".repeat(t),S1=class{toString(e=0){return Ku(e)+"[VNode]"}},bs=class extends S1{constructor(e){super(),this.text=e}toString(e=0){return Ku(e)+this.textContent}get textContent(){return Vu(this.text)}set textContent(e){this.text=e}},Ko=class extends S1{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=Ku(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 Ko&&(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`
|
|
136
|
+
`)}};var Ru,Tm={level:"debug"},Co={get(){return Ru==null&&(Ru=process.stdout.isTTY?(0,E0.default)(Tm,bn.stream()):(0,E0.default)(Tm)),Ru},set(t){Ru=t},disable(){Co.get().level="silent"}};var R0=me(Ao(),1);var Im=24*60*60*1e3,zE=30*Im,jw=91*Im;function Om(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,R0.decodeTime)(e);if(t.startsWith("d"))return{valid:!0,key:t};if(Date.now()-r>jw)return{valid:!1,message:"expired"}}catch{return{valid:!1,message:"malformed"}}return{valid:!0,key:t}}var Lm=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 km=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 C0,Uw=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]]),Nm=(C0=String.fromCodePoint)!==null&&C0!==void 0?C0: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 Bm(t){var e;return t>=55296&&t<=57343||t>1114111?65533:(e=Uw.get(t))!==null&&e!==void 0?e:t}function A0(t){return Nm(Bm(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 hs;(function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"})(hs||(hs={}));function Dm(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 S=a+1,R=10,x=r.charCodeAt(S);(x|or.To_LOWER_BIT)===or.LOWER_X&&(R=16,a+=1,S+=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(S!==a){let w=r.substring(S,a),E=parseInt(w,R);if(r.charCodeAt(a)===or.SEMI)a+=1;else if(i)continue;n+=A0(E),o=a}continue}let c=0,d=1,p=0,m=t[p];for(;a<r.length&&(p=$w(t,m,p+1,r.charCodeAt(a)),!(p<0));a++,d++){m=t[p];let S=m&hs.VALUE_LENGTH;if(S){(!i||r.charCodeAt(a)===or.SEMI)&&(c=p,d=0);let R=(S>>14)-1;if(R===0)break;p+=R}}if(c!==0){let S=(t[c]&hs.VALUE_LENGTH)>>14;n+=S===1?String.fromCharCode(t[c]&~hs.VALUE_LENGTH):S===2?String.fromCharCode(t[c+1]):String.fromCharCode(t[c+1],t[c+2]),o=a-d+1}}return n+r.slice(o)}}function $w(t,e,r,i){let n=(e&hs.BRANCH_LENGTH)>>7,o=e&hs.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,c=a+n-1;for(;a<=c;){let d=a+c>>>1,p=t[d];if(p<i)a=d+1;else if(p>i)c=d-1;else return t[d+n]}return-1}var GE=Dm(Lm),VE=Dm(km);var Fw=new Map([[34,"""],[38,"&"],[39,"'"],[60,"<"],[62,">"]]),Hw=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 T0(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 m1=T0(/[&<>'"]/g,Fw),zm=T0(/["&\u00A0]/g,new Map([[34,"""],[38,"&"],[160," "]])),jm=T0(/[&<>\u00A0]/g,new Map([[38,"&"],[60,"<"],[62,">"],[160," "]]));var Um;(function(t){t[t.XML=0]="XML",t[t.HTML=1]="HTML"})(Um||(Um={}));var $m;(function(t){t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict"})($m||($m={}));var Fm;(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"})(Fm||(Fm={}));var Au=t=>" ".repeat(t),p1=class{toString(e=0){return Au(e)+"[VNode]"}},fs=class extends p1{constructor(e){super(),this.text=e}toString(e=0){return Au(e)+this.textContent}get textContent(){return m1(this.text)}set textContent(e){this.text=e}},To=class extends p1{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 fs(e)]}toString(e=0){let r=this.toStringAttrs(),i=Au(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 To&&(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}="${m1(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 fs)return r.textContent}return`
|
|
139
137
|
${this.children.map(r=>r.toString(e+1)).join(`
|
|
140
138
|
`)}
|
|
141
|
-
${Ku(e)}`}};function hx(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 Q(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 Ko(t,i?e:{},hx(r))}var q0;(function(t){t.aerial="aerial"})(q0||(q0={}));var Qp=me(zp(),1),e6=me(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:Ix,union:t6}=e6.default;function Ox(t,e){return t[0]===e[0]&&t[1]===e[1]}function kx(t,e){return Ix(t,Xp(e))}function K0(t,e){let r=[];for(let i of t){let n=Qp.default.polygon(i[0],e);n.length!==0&&(Ox(n[0],n[n.length-1])||n.push(n[0]),r.push([n]))}return kx(r,e)}var C1=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},Lx=(t,e)=>C1(t+(e<t?e+360-t:e-t)),Sn={boxLonCenter(t){return C1(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:C1,normExtent(t){return[C1(t[0]),t[1],C1(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=Lx(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 Nx=[-180,-90,180,90],Bx=[180,-90,360,90];function Dx(t,e,r){return[e[0]+(r[0]-e[0])*t,e[1]+(r[1]-e[1])*t]}function zx(t){let e=[];for(let r of K0(t,Nx))e.push(r);for(let r of K0(t,Bx))e.push(r.map(i=>i.map(n=>[n[0]-360,n[1]])));return e}function Xu(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(Dx(T,R,m));d.push([180,C[1]])}}d.push(x),m=R,p=x,M=w}return d}));return i&&r?zx(o):o}function Ux(t){return{type:"Polygon",coordinates:t}}function r6(t,e={}){return{type:"Feature",geometry:Ux(t),properties:e}}function i6(t,e={}){return{type:"Feature",geometry:{type:"MultiPolygon",coordinates:t},properties:e}}var Zo=me(n6(),1);var s6=`PROJCS["NZGD2000 / Chatham Islands TM 2000",
|
|
139
|
+
${Au(e)}`}};function Gw(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 fs(String(r)));continue}e.push(r)}return e}else if(typeof t=="string"||typeof t=="number")return[new fs(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 To(t,i?e:{},Gw(r))}var Rt;(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"})(Rt||(Rt={}));var Wm=2**32,Vw=typeof setImmediate>"u"?setTimeout:setImmediate,kt=()=>{throw new Error("Method not implemented.")},Ct=class{constructor(){this.isLittleEndian=!0,this.delayMs=Ct.DefaultDelayMs,this.maxChunkCount=10,this.chunks=Ct.DefaultChunkCache(),this.blankFillCount=16,this.maxConcurrentRequests=50,this.toFetch=new Set,this.toFetchPromise=null,this.byteOffset=0,this.getFloat32=kt,this.getFloat64=kt,this.getInt8=kt,this.getInt16=kt,this.getInt32=kt,this.setFloat32=kt,this.setFloat64=kt,this.setInt8=kt,this.setInt16=kt,this.setInt32=kt,this.setUint8=kt,this.setUint16=kt,this.setUint32=kt,this.setBigInt64=kt,this.setBigUint64=kt}static getByteRanges(e,r=32,i=16){if(e.size===0)return{chunks:[],blankFill:[]};let n=[...e.values()].sort((d,p)=>d-p),o=[],a=[];o.push(a);let c=[];for(let d=0;d<n.length;++d){let p=n[d],m=n[d-1];if(a.length>=r)a=[p],o.push(a);else if(d===0||p===m+1)a.push(p);else if(p<m+i){for(let S=m;S<p;S++)a.push(S+1),c.push(S+1);c.pop()}else a=[p],o.push(a)}return{chunks:o,blankFill:c}}async fetchData(){if(this.toFetch.size===0)return;let e=this.toFetch;this.toFetch=new Set,this.toFetchPromise=null;let r=Ct.getByteRanges(e,this.maxChunkCount,this.blankFillCount),i=[];for(let n of r.chunks){let o=n[0],a=n[n.length-1],c=o*this.chunkSize,d=a*this.chunkSize+this.chunkSize-c,p=await this.fetchBytes(c,d);if(n.length===1){i[o]=p,this.chunks.set(o,new DataView(p));continue}let m=o*this.chunkSize;for(let S of n){let R=S*this.chunkSize-m,x=p.slice(R,R+this.chunkSize);i[S]=x,this.chunks.set(S,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=>Vw(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 Rt.UInt8:return this.getUint8(e);case Rt.UInt16:return this.getUint16(e);case Rt.UInt32:return this.getUint32(e);case Rt.UInt64:return this.getUint64(e)}}bytes(e,r){let i=this.isOneChunk(e,r);if(i){let p=this.getView(i),m=e-i*this.chunkSize;return new Uint8Array(p.buffer.slice(m,m+r))}let n=new Uint8Array(r),o=e+r,a=Math.floor(e/this.chunkSize),c=Math.ceil((e+r)/this.chunkSize)-1,d=0;for(let p=a;p<=c;p++){let m=e+d,S=p*this.chunkSize,R=this.getView(p),x=Math.min(o,S+this.chunkSize),w=R.buffer.slice(m-S,x-S);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,Rt.UInt16);if(r!=null)return this.getView(r).getUint16(e-r*this.chunkSize,this.isLittleEndian);let i=this.getUint8(e),n=this.getUint8(e+Rt.UInt8);return this.isLittleEndian?i+(n<<8):(i<<8)+n}getUint32(e){let r=this.isOneChunk(e,Rt.UInt32);if(r!=null)return this.getView(r).getUint32(e-r*this.chunkSize,this.isLittleEndian);let i=this.getUint16(e),n=this.getUint16(e+Rt.UInt16);return this.isLittleEndian?i+n*65536:i*65536+n}getUint64(e){let r=this.isOneChunk(e,Rt.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+Rt.UInt32);return this.isLittleEndian?i+n*Wm:i*Wm+n}getBigUint64(e){let r=this.isOneChunk(e,Rt.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+Rt.UInt32));return this.isLittleEndian?i+(n<<BigInt(32)):(i<<BigInt(32))+n}getBigInt64(){throw new Error("Not implemented.")}};Ct.DefaultChunkCache=()=>new Map;Ct.DefaultDelayMs=1;var lt=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 Ti(t){return typeof t=="object"&&t!==null}function vr(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 Jw=/\/$/,Zw=/^\//;function L0(t,e){return t.replace(Jw,"")+"/"+e.replace(Zw,"")}function qm(t,...e){let r=t;for(let i=0;i<e.length;i++)r=L0(r,e[i]);return r}async function Gm(t){let e=[];for await(let r of t)e.push(r);return e}var k0;(function(t){t.aerial="aerial"})(k0||(k0={}));var Oe;(function(t){t.Imagery="im",t.TileSet="ts",t.Provider="pv",t.ImageryRule="ir",t.Style="st",t.ProcessingJob="pj",t.ConfigBundle="cb"})(Oe||(Oe={}));var Vm=new Set(Object.values(Oe));var ds=class{},ms=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)}},wr={prefix(t,e){return e===""||e.startsWith(t)?e:`${t}_${e}`},getPrefix(t){let e=t.indexOf("_");if(e===-1)return null;let r=t.slice(0,e);return Vm.has(r)?r:null},unprefix(t,e){return e.startsWith(t)?e.slice(3):e}};async function ps(t,e,r){let i=new Set;for(let n of r)for(let o of e){let a=o[n.code];a&&i.add(t.Imagery.id(a))}return t.Imagery.getAll(i)}var N0;(function(t){t.Processing="processing",t.Complete="complete",t.Fail="failed"})(N0||(N0={}));var rt;(function(t){t.Raster="raster",t.Vector="vector"})(rt||(rt={}));var Km=me(require("aws-sdk/clients/dynamodb.js"),1);var Po=me(require("aws-sdk/clients/dynamodb.js"),1);function Yw(t){return{id:{S:t}}}var Pi=class extends ms{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 Po.default.Converter.unmarshall(Po.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=Po.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(Yw(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 c=await this.db.batchGetItem({RequestItems:a}).promise(),d=(r=c.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 p of d){let m=Po.default.Converter.unmarshall(p);this.is(m)&&n.set(m.id,m)}a=c.UnprocessedKeys}}return n}async put(e){return e.updatedAt=Date.now(),await this.db.putItem({TableName:this.cfg.tableName,Item:Po.default.Converter.marshall(e)}).promise(),e.id}};var Io=class extends Pi{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 g1=class extends ds{constructor(e){super(),this.Prefix=Oe,this.type="dynamo",this.Imagery=new Io(this,Oe.Imagery),this.Style=new Io(this,Oe.Style),this.TileSet=new Pi(this,Oe.TileSet),this.Provider=new Io(this,Oe.Provider),this.ProcessingJob=new Pi(this,Oe.ProcessingJob),this.ConfigBundle=new Pi(this,Oe.ConfigBundle),this.dynamo=new Km.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 c=e[a];r=Math.min(r,c.x),n=Math.max(n,c.x+c.width),i=Math.min(i,c.y),o=Math.max(o,c.y+c.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[c,d]of a)c<r?r=c:c>n&&(n=c),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 Ge;(function(t){t[t.Google=3857]="Google",t[t.Wgs84=4326]="Wgs84",t[t.Nztm2000=2193]="Nztm2000",t[t.Citm2000=3793]="Citm2000"})(Ge||(Ge={}));var B0={google:Ge.Google,epsg3857:Ge.Google,[Ge.Google]:Ge.Google,globalmercator:Ge.Google,wgs84:Ge.Wgs84,epsg4326:Ge.Wgs84,[Ge.Wgs84]:Ge.Wgs84,nztm:Ge.Nztm2000,epsg2193:Ge.Nztm2000,[Ge.Nztm2000]:Ge.Nztm2000,nztm2000:Ge.Nztm2000,citm:Ge.Citm2000,epsg3793:Ge.Citm2000,[Ge.Citm2000]:Ge.Citm2000,citm2000:Ge.Citm2000},Ee=class{constructor(e){if(this.code=e,Ee.Codes.has(e))throw new Error(`Duplicate EPSG code created: ${e}`);Ee.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=Ee.Codes.get(e);if(r==null)throw new Error(`Invalid EPSG:${e}`);return r}static tryGet(e){if(e!=null)return Ee.Codes.get(e)}static parseCode(e){var r;return e.startsWith("urn:")?B0[e.slice(e.lastIndexOf(":")+1)]:e.startsWith("https://")?B0[e.slice(e.lastIndexOf("/")+1)]:(r=B0[e.replace(/[\W_]/g,"").toLowerCase()])!==null&&r!==void 0?r:null}static parse(e){let r=Ee.parseCode(e);return r==null?null:Ee.get(r)}};Ee.Codes=new Map;Ee.Google=new Ee(Ge.Google);Ee.Wgs84=new Ee(Ge.Wgs84);Ee.Nztm2000=new Ee(Ge.Nztm2000);Ee.Citm2000=new Ee(Ge.Citm2000);var WR="0".charCodeAt(0),qR="1".charCodeAt(0),GR="2".charCodeAt(0),VR="3".charCodeAt(0);var Oo;(function(t){t[t.Xy=0]="Xy",t[t.Yx=1]="Yx"})(Oo||(Oo={}));function Jm(t){return t===Ee.Nztm2000?Oo.Yx:Oo.Xy}function Xw(t,e){return e.scaleDenominator-t.scaleDenominator}var At=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(Xw),i={};for(let p of r){if(i[p.identifier])throw new Error(`Duplicate tileMatrix identifier ${p.identifier}`);if(p.tileHeight!==p.tileWidth)throw new Error("Only square tiles supported");if(p.tileHeight!==this.tileSize)throw new Error("All tiles must have the same tile size");i[p.identifier]=!0}this.zooms=r;let n=Ee.parse(e.supportedCRS);if(n==null)throw new Error(`Unable to find supported projection ${e.supportedCRS}`);this.projection=n,Jm(this.projection)===Oo.Yx&&(this.indexX=1,this.indexY=0);let{lowerCorner:o,upperCorner:a}=e.boundingBox,c=o[this.indexX],d=o[this.indexY];this.extent=new _e(c,d,a[this.indexX]-c,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,c=(n.topLeftCorner[this.indexY]-r)/o;return{x:a,y:c}}pixelsToSource(e,r,i){let n=this.zooms[i],o=this.pixelScale(i),a=n.topLeftCorner[this.indexX]+e*o,c=n.topLeftCorner[this.indexY]-r*o;return{x:a,y:c}}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],c=o/i,d=a/n,p=Math.floor(e.x*c),m=Math.floor(e.y*d),S=Math.ceil((e.x+1)*c),R=Math.ceil((e.y+1)*d);for(let x=m;x<R;++x)for(let w=p;w<S;++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 y1={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 Qw={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}]},Le=new At(Qw);var Iu=me(Xm(),1),Ou=new At(Iu.Nztm2000),vn=new At(Iu.Nztm2000Quad);var Ur={All:[Le,Ou,vn],Defaults:new Map([[Ee.Google.code,Le],[Ee.Nztm2000.code,Ou]]),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=Ee.parse(t);if(e!=null)return Ur.tryGet(e);for(let r of Ur.All)if(r.identifier===t)return r;return null}};var ke;(function(t){t.Png="png",t.Jpeg="jpeg",t.Webp="webp",t.Avif="avif"})(ke||(ke={}));var ar;(function(t){t.MapboxVectorTiles="pbf"})(ar||(ar={}));var ku=me(Ao(),1);function r_(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 i_(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 n_=[r_,i_];function oi(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 n_){let a=o(i);if(a!=null){n=!0,r.push(a);break}}n||r.push(i)}return r.join("-")}var ip=require("crypto");var tp=me(ep(),1),rp="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",ko=(0,tp.default)(rp),o_=new Set(rp);function Lu(t){for(let e=0;e<t.length;e++)if(!o_.has(t.charAt(e)))return!1;return!0}function wn(t){return ko.encode((0,ip.createHash)("sha256").update(t).digest())}function a_(t){return wr.getPrefix(t.id)===Oe.Imagery}function l_(t){return wr.getPrefix(t.id)===Oe.TileSet}function u_(t){return!(typeof t!="object"||t==null||Array.isArray(t))}function np(t){if(!!u_(t))for(let e of Object.keys(t))t[e]===void 0&&delete t[e]}var Ii=class extends ds{constructor(){super(...arguments),this.type="memory",this.Imagery=new _n(this,Oe.Imagery),this.Style=new _n(this,Oe.Style),this.TileSet=new _n(this,Oe.TileSet),this.Provider=new _n(this,Oe.Provider),this.ProcessingJob=new _n(this,Oe.ProcessingJob),this.ConfigBundle=new _n(this,Oe.ConfigBundle),this.objects=new Map}put(e){this.objects.set(e.id,e)}toJson(){let e={id:"",hash:"",assets:this.assets,imagery:[],style:[],provider:[],tileSet:[]};for(let r of this.objects.values()){let i=r.id.slice(0,r.id.indexOf("_"));switch(delete r.updatedAt,i){case Oe.Imagery:e.imagery.push(r);break;case Oe.Style:e.style.push(r);break;case Oe.Provider:e.provider.push(r);break;case Oe.TileSet:e.tileSet.push(r);break;default:throw new Error("Unable to parse configuration id: "+r.id)}}return e.hash=wn(JSON.stringify(e)),e.id=wr.prefix(Oe.ConfigBundle,(0,ku.ulid)()),e}createVirtualTileSets(){for(let e of this.objects.values())if(l_(e)&&e.name==="aerial")for(let r of e.layers)this.imageryToChildTileSet(e,r,Ge.Nztm2000),this.imageryToChildTileSet(e,r,Ge.Google);else a_(e)&&(this.put(Ii.imageryToTileSet(e)),this.imageryToTileSetName(e))}imageryToTileSetName(e){let r=oi(e.name),i=wr.prefix(Oe.TileSet,r),n=this.objects.get(i);n==null&&(n={type:rt.Raster,id:i,title:e.title,category:e.category,name:r,format:ke.Webp,layers:[{name:r,minZoom:0,maxZoom:32}],background:{r:0,g:0,b:0,alpha:0},updatedAt:Date.now()},np(n),this.put(n)),n.layers[0][e.projection]=e.id}static imageryToTileSet(e){return{type:rt.Raster,id:wr.prefix(Oe.TileSet,wr.unprefix(Oe.Imagery,e.id)),name:e.name,format:ke.Webp,layers:[{[e.projection]:e.id,name:e.name,minZoom:0,maxZoom:32}],background:{r:0,g:0,b:0,alpha:0},updatedAt:Date.now()}}imageryToChildTileSet(e,r,i){var n,o;let a=r[i];if(a==null)return;let c=this.objects.get(a);if(c==null)return;let d=e.name+":"+c.name,p=wr.prefix(Oe.TileSet,d),m=this.objects.get(p);m==null&&(m={type:rt.Raster,id:p,title:(n=r.title)!==null&&n!==void 0?n:c.title,category:(o=r.category)!==null&&o!==void 0?o:c.category,name:oi(c.name),format:ke.Webp,layers:[{name:d,minZoom:0,maxZoom:32}],background:{r:0,g:0,b:0,alpha:0},updatedAt:Date.now()},np(m),this.put(m)),m.layers[0][c.projection]=c.id}static fromJson(e){if(e.id==null||wr.getPrefix(e.id)!==Oe.ConfigBundle)throw new Error("Provided configuration file is not a basemaps config bundle.");let r=(0,ku.decodeTime)(wr.unprefix(Oe.ConfigBundle,e.id)),i=new Ii;for(let n of e.tileSet)i.put(n);for(let n of e.style)i.put(n);for(let n of e.provider)i.put(n);for(let n of e.imagery)i.put(n);for(let n of i.objects.values())n.updatedAt=r;return i.assets=e.assets,i}},_n=class extends ms{constructor(e,r){super(r),this.cfg=e}async get(e){let r=this.cfg.objects.get(this.id(e));return this.is(r)?r:null}async getAll(e){let r=new Map;for(let i of e){let n=await this.get(i);n!=null&&r.set(i,n)}return r}};function b1(t){if(t==="")return 0;let e=parseInt(t,16);if(isNaN(e))throw new Error("Invalid hex byte: "+t);return e}function Nu(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:b1(t.substr(0,2)),g:b1(t.substr(2,2)),b:b1(t.substr(4,2)),alpha:b1(t.substr(6,2))}}var Sn=me(require("fs"),1),zu=me(require("path"),1);var D0=require("fs"),Bu=require("path"),xn=class extends Ct{constructor(e){super(),this.type="file",this.protocol="file",this.chunkSize=xn.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,Bu.resolve)(this.fileName)}get name(){return(0,Bu.basename)(this.fileName)}get size(){return this._size?this._size:(this._size=Promise.resolve().then(async()=>(await D0.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=D0.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)}};xn.DefaultChunkSize=16*1024;function Du(t,e){return Ti(t)?t.code==="ENOENT"?new lt(e,404,t):t.code==="EACCES"?new lt(e,403,t):new lt(e,500,t):new lt(e,500,t)}var Oi=class{constructor(){this.protocol=Oi.protocol}static is(e){return e.protocol===Oi.protocol}source(e){return new xn(e)}async*list(e,r){try{let i=await Sn.default.promises.readdir(e,{withFileTypes:!0}),n=zu.default.resolve(e);for(let o of i){let a=zu.default.join(n,o.name);o.isDirectory()&&r?.recursive!==!1?yield*this.list(a):yield a}}catch(i){throw Du(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 Sn.default.promises.stat(e);return{path:e,size:r.size,isDirectory:r.isDirectory()}}catch(r){if(Ti(r)&&r.code==="ENOENT")return null;throw Du(r,`Failed to stat: ${e}`)}}async read(e){try{return await Sn.default.promises.readFile(e)}catch(r){throw Du(r,`Failed to read: ${e}`)}}async write(e,r){let i=zu.default.dirname(e);await Sn.default.promises.mkdir(i,{recursive:!0});try{if(Buffer.isBuffer(r)||typeof r=="string")await Sn.default.promises.writeFile(e,r);else{let n=Sn.default.createWriteStream(e);await new Promise((o,a)=>{n.on("finish",o),n.on("error",a),r.pipe(n)})}}catch(n){throw Du(n,`Failed to write: ${e}`)}}stream(e){return Sn.default.createReadStream(e)}};Oi.protocol="file";var jp=me(require("http"),1),Up=me(require("https"),1),_s=me(require("zlib"),1),ur=me(require("stream"),1),A1=require("buffer");function c_(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 m=1;m<r.length;m++)r[m]==="base64"?n=!0:(a+=`;${r[m]}`,r[m].indexOf("charset=")===0&&(i=r[m].substring(8)));!r[0]&&!i.length&&(a+=";charset=US-ASCII",i="US-ASCII");let c=n?"base64":"ascii",d=unescape(t.substring(e+1)),p=Buffer.from(d,c);return p.type=o,p.typeFull=a,p.charset=i,p}var sp=c_;var xr=me(require("stream"),1),Bi=require("util"),lr=require("buffer");w1();$u();var Ni=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 Yt=class extends Ni{constructor(e,r,i){super(e,r),i&&(this.code=this.errno=i.code,this.erroredSysCall=i.syscall)}};var Fu=Symbol.toStringTag,$0=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[Fu]==="URLSearchParams",M1=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[Fu]),gp=t=>typeof t=="object"&&(t[Fu]==="AbortSignal"||t[Fu]==="EventTarget"),yp=(t,e)=>{let r=new URL(e).hostname,i=new URL(t).hostname;return r===i||r.endsWith(`.${i}`)};var E_=(0,Bi.promisify)(xr.default.pipeline),Xt=Symbol("Body internals"),li=class{constructor(e,{size:r=0}={}){let i=null;e===null?e=null:$0(e)?e=lr.Buffer.from(e.toString()):M1(e)||lr.Buffer.isBuffer(e)||(Bi.types.isAnyArrayBuffer(e)?e=lr.Buffer.from(e):ArrayBuffer.isView(e)?e=lr.Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof xr.default||(e instanceof ys?(e=pp(e),i=e.type.split("=")[1]):e=lr.Buffer.from(String(e))));let n=e;lr.Buffer.isBuffer(e)?n=xr.default.Readable.from(e):M1(e)&&(n=xr.default.Readable.from(e.stream())),this[Xt]={body:e,stream:n,boundary:i,disturbed:!1,error:null},this.size=r,e instanceof xr.default&&e.on("error",o=>{let a=o instanceof Ni?o:new Yt(`Invalid response body while trying to fetch ${this.url}: ${o.message}`,"system",o);this[Xt].error=a})}get body(){return this[Xt].stream}get bodyUsed(){return this[Xt].disturbed}async arrayBuffer(){let{buffer:e,byteOffset:r,byteLength:i}=await qu(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 ys,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(()=>(Mp(),Sp));return r(this.body,e)}async blob(){let e=this.headers&&this.headers.get("content-type")||this[Xt].body&&this[Xt].body.type||"",r=await this.arrayBuffer();return new ki([r],{type:e})}async json(){let e=await qu(this);return JSON.parse(e.toString())}async text(){return(await qu(this)).toString()}buffer(){return qu(this)}};li.prototype.buffer=(0,Bi.deprecate)(li.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(li.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:(0,Bi.deprecate)(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});async function qu(t){if(t[Xt].disturbed)throw new TypeError(`body used already for: ${t.url}`);if(t[Xt].disturbed=!0,t[Xt].error)throw t[Xt].error;let{body:e}=t;if(e===null)return lr.Buffer.alloc(0);if(!(e instanceof xr.default))return lr.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 Yt(`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 Ni?n:new Yt(`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")?lr.Buffer.from(r.join("")):lr.Buffer.concat(r,i)}catch(n){throw new Yt(`Could not create Buffer from response body for ${t.url}: ${n.message}`,"system",n)}else throw new Yt(`Premature close of server response while trying to fetch ${t.url}`)}var zo=(t,e)=>{let r,i,{body:n}=t[Xt];if(t.bodyUsed)throw new Error("cannot clone body after it is used");return n instanceof xr.default&&typeof n.getBoundary!="function"&&(r=new xr.PassThrough({highWaterMark:e}),i=new xr.PassThrough({highWaterMark:e}),n.pipe(r),n.pipe(i),t[Xt].stream=r,n=i),n},R_=(0,Bi.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"),Gu=(t,e)=>t===null?null:typeof t=="string"?"text/plain;charset=UTF-8":$0(t)?"application/x-www-form-urlencoded;charset=UTF-8":M1(t)?t.type||null:lr.Buffer.isBuffer(t)||Bi.types.isAnyArrayBuffer(t)||ArrayBuffer.isView(t)?null:t instanceof ys?`multipart/form-data; boundary=${e[Xt].boundary}`:t&&typeof t.getBoundary=="function"?`multipart/form-data;boundary=${R_(t)}`:t instanceof xr.default?null:"text/plain;charset=UTF-8",Ep=t=>{let{body:e}=t[Xt];return e===null?0:M1(e)?e.size:lr.Buffer.isBuffer(e)?e.length:e&&typeof e.getLengthSync=="function"&&e.hasKnownLength&&e.hasKnownLength()?e.getLengthSync():null},Rp=async(t,{body:e})=>{e===null?t.end():await E_(e,t)};var q0=require("util"),C1=me(require("http"),1),Vu=typeof C1.default.validateHeaderName=="function"?C1.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}},G0=typeof C1.default.validateHeaderValue=="function"?C1.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}},Qt=class extends URLSearchParams{constructor(e){let r=[];if(e instanceof Qt){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"&&!q0.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"||q0.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])=>(Vu(i),G0(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,c)=>(Vu(a),G0(a,String(c)),URLSearchParams.prototype[n].call(i,String(a).toLowerCase(),String(c)));case"delete":case"has":case"getAll":return a=>(Vu(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(Qt.prototype,["get","entries","forEach","values"].reduce((t,e)=>(t[e]={enumerable:!0},t),{}));function Cp(t=[]){return new Qt(t.reduce((e,r,i,n)=>(i%2===0&&e.push(n.slice(i,i+2)),e),[]).filter(([e,r])=>{try{return Vu(e),G0(e,String(r)),!0}catch{return!1}}))}var C_=new Set([301,302,303,307,308]),Ku=t=>C_.has(t);var $r=Symbol("Response internals"),Tt=class extends li{constructor(e=null,r={}){super(e,r);let i=r.status!=null?r.status:200,n=new Qt(r.headers);if(e!==null&&!n.has("Content-Type")){let o=Gu(e,this);o&&n.append("Content-Type",o)}this[$r]={type:"default",url:r.url,status:i,statusText:r.statusText||"",headers:n,counter:r.counter,highWaterMark:r.highWaterMark}}get type(){return this[$r].type}get url(){return this[$r].url||""}get status(){return this[$r].status}get ok(){return this[$r].status>=200&&this[$r].status<300}get redirected(){return this[$r].counter>0}get statusText(){return this[$r].statusText}get headers(){return this[$r].headers}get highWaterMark(){return this[$r].highWaterMark}clone(){return new Tt(zo(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(!Ku(r))throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');return new Tt(null,{headers:{location:new URL(e).toString()},status:r})}static error(){let e=new Tt(null,{status:0,statusText:""});return e[$r].type="error",e}get[Symbol.toStringTag](){return"Response"}};Object.defineProperties(Tt.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 Bp=require("url"),Dp=require("util");var Ap=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 Pp=require("net");function Tp(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 Ip=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]),Op="strict-origin-when-cross-origin";function Lp(t){if(!Ip.has(t))throw new TypeError(`Invalid referrerPolicy: ${t}`);return t}function A_(t){if(/^(http|ws)s:$/.test(t.protocol))return!0;let e=t.host.replace(/(^\[)|(]$)/g,""),r=(0,Pp.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 jo(t){return/^about:(blank|srcdoc)$/.test(t)||t.protocol==="data:"||/^(blob|filesystem):$/.test(t.protocol)?!0:A_(t)}function kp(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=Tp(n),a=Tp(n,!0);o.toString().length>4096&&(o=a),e&&(o=e(o)),r&&(a=r(a));let c=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 jo(o)&&!jo(c)?"no-referrer":a.toString();case"strict-origin-when-cross-origin":return o.origin===c.origin?o:jo(o)&&!jo(c)?"no-referrer":a;case"same-origin":return o.origin===c.origin?o:"no-referrer";case"origin-when-cross-origin":return o.origin===c.origin?o:a;case"no-referrer-when-downgrade":return jo(o)&&!jo(c)?"no-referrer":o;default:throw new TypeError(`Invalid referrerPolicy: ${i}`)}}function Np(t){let e=(t.get("referrer-policy")||"").split(/[,\s]+/),r="";for(let i of e)i&&Ip.has(i)&&(r=i);return r}var pt=Symbol("Request internals"),Ju=t=>typeof t=="object"&&typeof t[pt]=="object",T_=(0,Dp.deprecate)(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)"),Di=class extends li{constructor(e,r={}){let i;if(Ju(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&&T_(),(r.body!=null||Ju(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:Ju(e)&&e.body!==null?zo(e):null;super(o,{size:r.size||e.size||0});let a=new Qt(r.headers||e.headers||{});if(o!==null&&!a.has("Content-Type")){let p=Gu(o,this);p&&a.set("Content-Type",p)}let c=Ju(e)?e.signal:null;if("signal"in r&&(c=r.signal),c!=null&&!gp(c))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 p=new URL(d);d=/^about:(\/\/)?client$/.test(p)?"client":p}else d=void 0;this[pt]={method:n,redirect:r.redirect||e.redirect||"follow",headers:a,parsedURL:i,signal:c,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[pt].method}get url(){return(0,Bp.format)(this[pt].parsedURL)}get headers(){return this[pt].headers}get redirect(){return this[pt].redirect}get signal(){return this[pt].signal}get referrer(){if(this[pt].referrer==="no-referrer")return"";if(this[pt].referrer==="client")return"about:client";if(this[pt].referrer)return this[pt].referrer.toString()}get referrerPolicy(){return this[pt].referrerPolicy}set referrerPolicy(e){this[pt].referrerPolicy=Lp(e)}clone(){return new Di(this)}get[Symbol.toStringTag](){return"Request"}};Object.defineProperties(Di.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 zp=t=>{let{parsedURL:e}=t[pt],r=new Qt(t[pt].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 c=Ep(t);typeof c=="number"&&!Number.isNaN(c)&&(i=String(c))}i&&r.set("Content-Length",i),t.referrerPolicy===""&&(t.referrerPolicy=Op),t.referrer&&t.referrer!=="no-referrer"?t[pt].referrer=kp(t):t[pt].referrer="no-referrer",t[pt].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=Ap(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 Zu=class extends Ni{constructor(e,r="aborted"){super(e,r)}};$u();H0();var P_=new Set(["data:","http:","https:"]);async function Yu(t,e){return new Promise((r,i)=>{let n=new Di(t,e),{parsedURL:o,options:a}=zp(n);if(!P_.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=sp(n.url),E=new Tt(w,{headers:{"Content-Type":w.typeFull}});r(E);return}let c=(o.protocol==="https:"?Up.default:jp.default).request,{signal:d}=n,p=null,m=()=>{let w=new Zu("The operation was aborted.");i(w),n.body&&n.body instanceof ur.default.Readable&&n.body.destroy(w),!(!p||!p.body)&&p.body.emit("error",w)};if(d&&d.aborted){m();return}let S=()=>{m(),x()},R=c(o.toString(),a);d&&d.addEventListener("abort",S);let x=()=>{R.abort(),d&&d.removeEventListener("abort",S)};R.on("error",w=>{i(new Yt(`request to ${n.url} failed, reason: ${w.message}`,"system",w)),x()}),I_(R,w=>{p.body.destroy(w)}),process.version<"v14"&&R.on("socket",w=>{let E;w.prependListener("end",()=>{E=w._eventsCount}),w.prependListener("close",T=>{if(p&&E<w._eventsCount&&!T){let C=new Error("Premature close");C.code="ERR_STREAM_PREMATURE_CLOSE",p.body.emit("error",C)}})}),R.on("response",w=>{R.setTimeout(0);let E=Cp(w.rawHeaders);if(Ku(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 Yt(`uri requested responds with an invalid redirect URL: ${B}`,"invalid-redirect")),x();return}}switch(n.redirect){case"error":i(new Yt(`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 Yt(`maximum redirect reached at: ${n.url}`,"max-redirect")),x();return}let q={headers:new Qt(n.headers),follow:n.follow,counter:n.counter+1,agent:n.agent,compress:n.compress,method:n.method,body:zo(n),signal:n.signal,size:n.size,referrer:n.referrer,referrerPolicy:n.referrerPolicy};if(!yp(n.url,z))for(let se of["authorization","www-authenticate","cookie","cookie2"])q.headers.delete(se);if(w.statusCode!==303&&n.body&&e.body instanceof ur.default.Readable){i(new Yt("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")&&(q.method="GET",q.body=void 0,q.headers.delete("content-length"));let Z=Np(E);Z&&(q.referrerPolicy=Z),r(Yu(new Di(z,q))),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",S)});let T=(0,ur.pipeline)(w,new ur.PassThrough,B=>{B&&i(B)});process.version<"v12.10"&&w.on("aborted",S);let C={url:n.url,status:w.statusCode,statusText:w.statusMessage,headers:E,size:n.size,counter:n.counter,highWaterMark:n.highWaterMark},P=E.get("Content-Encoding");if(!n.compress||n.method==="HEAD"||P===null||w.statusCode===204||w.statusCode===304){p=new Tt(T,C),r(p);return}let L={flush:_s.default.Z_SYNC_FLUSH,finishFlush:_s.default.Z_SYNC_FLUSH};if(P==="gzip"||P==="x-gzip"){T=(0,ur.pipeline)(T,_s.default.createGunzip(L),B=>{B&&i(B)}),p=new Tt(T,C),r(p);return}if(P==="deflate"||P==="x-deflate"){let B=(0,ur.pipeline)(w,new ur.PassThrough,z=>{z&&i(z)});B.once("data",z=>{(z[0]&15)===8?T=(0,ur.pipeline)(T,_s.default.createInflate(),q=>{q&&i(q)}):T=(0,ur.pipeline)(T,_s.default.createInflateRaw(),q=>{q&&i(q)}),p=new Tt(T,C),r(p)}),B.once("end",()=>{p||(p=new Tt(T,C),r(p))});return}if(P==="br"){T=(0,ur.pipeline)(T,_s.default.createBrotliDecompress(),B=>{B&&i(B)}),p=new Tt(T,C),r(p);return}p=new Tt(T,C),r(p)}),Rp(R,n).catch(i)})}function I_(t,e){let r=A1.Buffer.from(`0\r
|
|
140
|
+
\r
|
|
141
|
+
`),i=!1,n=!1,o;t.on("response",a=>{let{headers:c}=a;i=c["transfer-encoding"]==="chunked"&&!c["content-length"]}),t.on("socket",a=>{let c=()=>{if(i&&!n){let d=new Error("Premature close");d.code="ERR_STREAM_PREMATURE_CLOSE",e(d)}};a.prependListener("close",c),t.on("abort",()=>{a.removeListener("close",c)}),a.on("data",d=>{n=A1.Buffer.compare(d.slice(-5),r)===0,!n&&o&&(n=A1.Buffer.compare(o.slice(-3),r.slice(0,3))===0&&A1.Buffer.compare(d.slice(-2),r.slice(3))===0),o=d})})}var Nt=class extends Ct{constructor(e){super(),this.type="url",this.protocol="http",this.chunkSize=Nt.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 Nt.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 Nt.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")}};Nt.DefaultChunkSize=32*1024;Nt.fetch=(t,e)=>fetch(t,e);function $p(t,e){return Ti(t)?t.code==="ENOENT"?new lt(e,404,t):t.code==="EACCES"?new lt(e,403,t):new lt(e,500,t):new lt(e,500,t)}var zi=class{constructor(){this.protocol=zi.protocol}static is(e){return e.protocol===zi.protocol}source(e){return new Nt(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 Nt.fetch(e,{method:"HEAD"});if(!r.ok)throw $p(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 Nt.fetch(e,{method:"GET"});if(!r.ok)throw $p(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}`)}};zi.protocol="http";Nt.fetch=Yu;function O_(t){return typeof t!="object"||t==null?!1:t.constructor===Object}var Xu=class{constructor(){this.protocol="abstract",this.isOrdered=!0,this.systems=[],this.toArray=Gm,this.join=L0,this.joinAll=qm}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)||O_(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}`)}},xt=new Xu;var Fp=new Oi;xt.register("",Fp);xt.register("file://",Fp);var Hp=new zi;xt.register("http://",Hp);xt.register("https://",Hp);var Ix=me(Ao(),1);var Qe;(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})(Qe||(Qe={}));var ee=Qe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),En=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}},Q=Qe.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"]),L_=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Fr=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 c=i,d=0;for(;d<a.path.length;){let p=a.path[d];d===a.path.length-1?(c[p]=c[p]||{_errors:[]},c[p]._errors.push(r(a))):c[p]=c[p]||{_errors:[]},c=c[p],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()}};Fr.create=t=>new Fr(t);var T1=(t,e)=>{let r;switch(t.code){case Q.invalid_type:t.received===ee.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Q.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected)}`;break;case Q.unrecognized_keys:r=`Unrecognized key(s) in object: ${Qe.joinValues(t.keys,", ")}`;break;case Q.invalid_union:r="Invalid input";break;case Q.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Qe.joinValues(t.options)}`;break;case Q.invalid_enum_value:r=`Invalid enum value. Expected ${Qe.joinValues(t.options)}, received '${t.received}'`;break;case Q.invalid_arguments:r="Invalid function arguments";break;case Q.invalid_return_type:r="Invalid function return type";break;case Q.invalid_date:r="Invalid date";break;case Q.invalid_string:t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Q.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 Q.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 Q.custom:r="Invalid input";break;case Q.invalid_intersection_types:r="Intersection results could not be merged";break;case Q.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;default:r=e.defaultError,Qe.assertNever(t)}return{message:r}},P1=T1,k_=t=>{P1=t},Qu=t=>{let{data:e,path:r,errorMaps:i,issueData:n}=t,o=[...r,...n.path||[]],a={...n,path:o},c="",d=i.filter(p=>!!p).slice().reverse();for(let p of d)c=p(a,{data:e,defaultError:c}).message;return{...n,path:o,message:n.message||c}},N_=[];function le(t,e){let r=Qu({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,P1,T1].filter(i=>!!i)});t.common.issues.push(r)}var Pt=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 pe;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 Pt.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 pe;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}}},pe=Object.freeze({status:"aborted"}),B_=t=>({status:"dirty",value:t}),Bt=t=>({status:"valid",value:t}),V0=t=>t.status==="aborted",K0=t=>t.status==="dirty",ec=t=>t.status==="valid",J0=t=>typeof Promise!==void 0&&t instanceof Promise,Ke;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Ke||(Ke={}));var Mr=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)}},Wp=(t,e)=>{if(ec(e))return{success:!0,data:e.value};{if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");let r=new Fr(t.common.issues);return{success:!1,error:r}}};function Re(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,c)=>a.code!=="invalid_type"?{message:c.defaultError}:typeof c.data>"u"&&i?{message:i}:t.invalid_type_error?{message:t.invalid_type_error}:{message:c.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 En(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:En(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Pt,ctx:{common:e.parent.common,data:e.data,parsedType:En(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(J0(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:En(e)},o=this._parseSync({data:e,path:n.path,parent:n});return Wp(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:En(e)},n=this._parse({data:e,path:[],parent:i}),o=await(J0(n)?n:Promise.resolve(n));return Wp(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),c=()=>o.addIssue({code:Q.custom,...i(n)});return typeof Promise<"u"&&a instanceof Promise?a.then(d=>d?!0:(c(),!1)):a?!0:(c(),!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 Cr({schema:this,typeName:de.ZodEffects,effect:{type:"refinement",refinement:e}})}optional(){return Sr.create(this)}nullable(){return Fi.create(this)}nullish(){return this.optional().nullable()}array(){return Er.create(this)}promise(){return Cn.create(this)}or(e){return xs.create([this,e])}and(e){return Ss.create(this,e)}transform(e){return new Cr({schema:this,typeName:de.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new I1({innerType:this,defaultValue:r,typeName:de.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}},D_=/^c[^\s-]{8,}$/i,z_=/^([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,j_=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,ci=class extends xe{constructor(){super(...arguments),this._regex=(e,r,i)=>this.refinement(n=>e.test(n),{validation:r,code:Q.invalid_string,...Ke.errToObj(i)}),this.nonempty=e=>this.min(1,Ke.errToObj(e)),this.trim=()=>new ci({...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:Q.invalid_type,expected:ee.string,received:o.parsedType}),pe}let i=new Pt,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:Q.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:Q.too_big,maximum:o.value,type:"string",inclusive:!0,message:o.message}),i.dirty());else if(o.kind==="email")j_.test(e.data)||(n=this._getOrReturnCtx(e,n),le(n,{validation:"email",code:Q.invalid_string,message:o.message}),i.dirty());else if(o.kind==="uuid")z_.test(e.data)||(n=this._getOrReturnCtx(e,n),le(n,{validation:"uuid",code:Q.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid")D_.test(e.data)||(n=this._getOrReturnCtx(e,n),le(n,{validation:"cuid",code:Q.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:Q.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:Q.invalid_string,message:o.message}),i.dirty())):o.kind==="trim"?e.data=e.data.trim():Qe.assertNever(o);return{status:i.value,value:e.data}}_addCheck(e){return new ci({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ke.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ke.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ke.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ke.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Ke.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Ke.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Ke.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}};ci.create=t=>new ci({checks:[],typeName:de.ZodString,...Re(t)});function U_(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 ji=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:Q.invalid_type,expected:ee.number,received:o.parsedType}),pe}let i,n=new Pt;for(let o of this._def.checks)o.kind==="int"?Qe.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),le(i,{code:Q.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:Q.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:Q.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,message:o.message}),n.dirty()):o.kind==="multipleOf"?U_(e.data,o.value)!==0&&(i=this._getOrReturnCtx(e,i),le(i,{code:Q.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()):Qe.assertNever(o);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Ke.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Ke.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Ke.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Ke.toString(r))}setLimit(e,r,i,n){return new ji({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:Ke.toString(n)}]})}_addCheck(e){return new ji({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ke.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ke.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ke.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ke.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ke.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Ke.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")}};ji.create=t=>new ji({checks:[],typeName:de.ZodNumber,...Re(t)});var $o=class extends xe{_parse(e){if(this._getType(e)!==ee.bigint){let i=this._getOrReturnCtx(e);return le(i,{code:Q.invalid_type,expected:ee.bigint,received:i.parsedType}),pe}return Bt(e.data)}};$o.create=t=>new $o({typeName:de.ZodBigInt,...Re(t)});var Fo=class extends xe{_parse(e){if(this._getType(e)!==ee.boolean){let i=this._getOrReturnCtx(e);return le(i,{code:Q.invalid_type,expected:ee.boolean,received:i.parsedType}),pe}return Bt(e.data)}};Fo.create=t=>new Fo({typeName:de.ZodBoolean,...Re(t)});var Ho=class extends xe{_parse(e){if(this._getType(e)!==ee.date){let i=this._getOrReturnCtx(e);return le(i,{code:Q.invalid_type,expected:ee.date,received:i.parsedType}),pe}if(isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return le(i,{code:Q.invalid_date}),pe}return{status:"valid",value:new Date(e.data.getTime())}}};Ho.create=t=>new Ho({typeName:de.ZodDate,...Re(t)});var Wo=class extends xe{_parse(e){if(this._getType(e)!==ee.undefined){let i=this._getOrReturnCtx(e);return le(i,{code:Q.invalid_type,expected:ee.undefined,received:i.parsedType}),pe}return Bt(e.data)}};Wo.create=t=>new Wo({typeName:de.ZodUndefined,...Re(t)});var qo=class extends xe{_parse(e){if(this._getType(e)!==ee.null){let i=this._getOrReturnCtx(e);return le(i,{code:Q.invalid_type,expected:ee.null,received:i.parsedType}),pe}return Bt(e.data)}};qo.create=t=>new qo({typeName:de.ZodNull,...Re(t)});var Rn=class extends xe{constructor(){super(...arguments),this._any=!0}_parse(e){return Bt(e.data)}};Rn.create=t=>new Rn({typeName:de.ZodAny,...Re(t)});var ui=class extends xe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Bt(e.data)}};ui.create=t=>new ui({typeName:de.ZodUnknown,...Re(t)});var hi=class extends xe{_parse(e){let r=this._getOrReturnCtx(e);return le(r,{code:Q.invalid_type,expected:ee.never,received:r.parsedType}),pe}};hi.create=t=>new hi({typeName:de.ZodNever,...Re(t)});var Go=class extends xe{_parse(e){if(this._getType(e)!==ee.undefined){let i=this._getOrReturnCtx(e);return le(i,{code:Q.invalid_type,expected:ee.void,received:i.parsedType}),pe}return Bt(e.data)}};Go.create=t=>new Go({typeName:de.ZodVoid,...Re(t)});var Er=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:Q.invalid_type,expected:ee.array,received:r.parsedType}),pe;if(n.minLength!==null&&r.data.length<n.minLength.value&&(le(r,{code:Q.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:Q.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,c)=>n.type._parseAsync(new Mr(r,a,r.path,c)))).then(a=>Pt.mergeArray(i,a));let o=r.data.map((a,c)=>n.type._parseSync(new Mr(r,a,r.path,c)));return Pt.mergeArray(i,o)}get element(){return this._def.type}min(e,r){return new Er({...this._def,minLength:{value:e,message:Ke.toString(r)}})}max(e,r){return new Er({...this._def,maxLength:{value:e,message:Ke.toString(r)}})}length(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Er.create=(t,e)=>new Er({type:t,minLength:null,maxLength:null,typeName:de.ZodArray,...Re(e)});var tc;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(tc||(tc={}));var qp=t=>e=>new Ye({...t,shape:()=>({...t.shape(),...e})});function Uo(t){if(t instanceof Ye){let e={};for(let r in t.shape){let i=t.shape[r];e[r]=Sr.create(Uo(i))}return new Ye({...t._def,shape:()=>e})}else return t instanceof Er?Er.create(Uo(t.element)):t instanceof Sr?Sr.create(Uo(t.unwrap())):t instanceof Fi?Fi.create(Uo(t.unwrap())):t instanceof Rr?Rr.create(t.items.map(e=>Uo(e))):t}var Ye=class extends xe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=qp(this._def),this.extend=qp(this._def)}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Qe.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==ee.object){let p=this._getOrReturnCtx(e);return le(p,{code:Q.invalid_type,expected:ee.object,received:p.parsedType}),pe}let{status:i,ctx:n}=this._processInputParams(e),{shape:o,keys:a}=this._getCached(),c=[];for(let p in n.data)a.includes(p)||c.push(p);let d=[];for(let p of a){let m=o[p],S=n.data[p];d.push({key:{status:"valid",value:p},value:m._parse(new Mr(n,S,n.path,p)),alwaysSet:p in n.data})}if(this._def.catchall instanceof hi){let p=this._def.unknownKeys;if(p==="passthrough")for(let m of c)d.push({key:{status:"valid",value:m},value:{status:"valid",value:n.data[m]}});else if(p==="strict")c.length>0&&(le(n,{code:Q.unrecognized_keys,keys:c}),i.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let p=this._def.catchall;for(let m of c){let S=n.data[m];d.push({key:{status:"valid",value:m},value:p._parse(new Mr(n,S,n.path,m)),alwaysSet:m in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let p=[];for(let m of d){let S=await m.key;p.push({key:S,value:await m.value,alwaysSet:m.alwaysSet})}return p}).then(p=>Pt.mergeObjectSync(i,p)):Pt.mergeObjectSync(i,d)}get shape(){return this._def.shape()}strict(e){return Ke.errToObj,new Ye({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,i)=>{var n,o,a,c;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:(c=Ke.errToObj(e).message)!==null&&c!==void 0?c:d}:{message:d}}}:{}})}strip(){return new Ye({...this._def,unknownKeys:"strip"})}passthrough(){return new Ye({...this._def,unknownKeys:"passthrough"})}setKey(e,r){return this.augment({[e]:r})}merge(e){return new Ye({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>tc.mergeShapes(this._def.shape(),e._def.shape()),typeName:de.ZodObject})}catchall(e){return new Ye({...this._def,catchall:e})}pick(e){let r={};return Qe.objectKeys(e).map(i=>{this.shape[i]&&(r[i]=this.shape[i])}),new Ye({...this._def,shape:()=>r})}omit(e){let r={};return Qe.objectKeys(this.shape).map(i=>{Qe.objectKeys(e).indexOf(i)===-1&&(r[i]=this.shape[i])}),new Ye({...this._def,shape:()=>r})}deepPartial(){return Uo(this)}partial(e){let r={};if(e)return Qe.objectKeys(this.shape).map(i=>{Qe.objectKeys(e).indexOf(i)===-1?r[i]=this.shape[i]:r[i]=this.shape[i].optional()}),new Ye({...this._def,shape:()=>r});for(let i in this.shape){let n=this.shape[i];r[i]=n.optional()}return new Ye({...this._def,shape:()=>r})}required(){let e={};for(let r in this.shape){let n=this.shape[r];for(;n instanceof Sr;)n=n._def.innerType;e[r]=n}return new Ye({...this._def,shape:()=>e})}};Ye.create=(t,e)=>new Ye({shape:()=>t,unknownKeys:"strip",catchall:hi.create(),typeName:de.ZodObject,...Re(e)});Ye.strictCreate=(t,e)=>new Ye({shape:()=>t,unknownKeys:"strict",catchall:hi.create(),typeName:de.ZodObject,...Re(e)});Ye.lazycreate=(t,e)=>new Ye({shape:t,unknownKeys:"strip",catchall:hi.create(),typeName:de.ZodObject,...Re(e)});var xs=class extends xe{_parse(e){let{ctx:r}=this._processInputParams(e),i=this._def.options;function n(o){for(let c of o)if(c.result.status==="valid")return c.result;for(let c of o)if(c.result.status==="dirty")return r.common.issues.push(...c.ctx.common.issues),c.result;let a=o.map(c=>new Fr(c.ctx.common.issues));return le(r,{code:Q.invalid_union,unionErrors:a}),pe}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 p={...r,common:{...r.common,issues:[]},parent:null},m=d._parseSync({data:r.data,path:r.path,parent:p});if(m.status==="valid")return m;m.status==="dirty"&&!o&&(o={result:m,ctx:p}),p.common.issues.length&&a.push(p.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let c=a.map(d=>new Fr(d));return le(r,{code:Q.invalid_union,unionErrors:c}),pe}}get options(){return this._def.options}};xs.create=(t,e)=>new xs({options:t,typeName:de.ZodUnion,...Re(e)});var Vo=class extends xe{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ee.object)return le(r,{code:Q.invalid_type,expected:ee.object,received:r.parsedType}),pe;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:Q.invalid_union_discriminator,options:this.validDiscriminatorValues,path:[i]}),pe)}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 Vo({typeName:de.ZodDiscriminatedUnion,discriminator:e,options:n,...Re(i)})}};function Z0(t,e){let r=En(t),i=En(e);if(t===e)return{valid:!0,data:t};if(r===ee.object&&i===ee.object){let n=Qe.objectKeys(e),o=Qe.objectKeys(t).filter(c=>n.indexOf(c)!==-1),a={...t,...e};for(let c of o){let d=Z0(t[c],e[c]);if(!d.valid)return{valid:!1};a[c]=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],c=e[o],d=Z0(a,c);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(V0(o)||V0(a))return pe;let c=Z0(o.value,a.value);return c.valid?((K0(o)||K0(a))&&r.dirty(),{status:r.value,value:c.data}):(le(i,{code:Q.invalid_intersection_types}),pe)};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:de.ZodIntersection,...Re(r)});var Rr=class extends xe{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==ee.array)return le(i,{code:Q.invalid_type,expected:ee.array,received:i.parsedType}),pe;if(i.data.length<this._def.items.length)return le(i,{code:Q.too_small,minimum:this._def.items.length,inclusive:!0,type:"array"}),pe;!this._def.rest&&i.data.length>this._def.items.length&&(le(i,{code:Q.too_big,maximum:this._def.items.length,inclusive:!0,type:"array"}),r.dirty());let o=i.data.map((a,c)=>{let d=this._def.items[c]||this._def.rest;return d?d._parse(new Mr(i,a,i.path,c)):null}).filter(a=>!!a);return i.common.async?Promise.all(o).then(a=>Pt.mergeArray(r,a)):Pt.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new Rr({...this._def,rest:e})}};Rr.create=(t,e)=>new Rr({items:t,typeName:de.ZodTuple,rest:null,...Re(e)});var Ms=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:Q.invalid_type,expected:ee.object,received:i.parsedType}),pe;let n=[],o=this._def.keyType,a=this._def.valueType;for(let c in i.data)n.push({key:o._parse(new Mr(i,c,i.path,c)),value:a._parse(new Mr(i,i.data[c],i.path,c))});return i.common.async?Pt.mergeObjectAsync(r,n):Pt.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(e,r,i){return r instanceof xe?new Ms({keyType:e,valueType:r,typeName:de.ZodRecord,...Re(i)}):new Ms({keyType:ci.create(),valueType:e,typeName:de.ZodRecord,...Re(r)})}},Ko=class extends xe{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==ee.map)return le(i,{code:Q.invalid_type,expected:ee.map,received:i.parsedType}),pe;let n=this._def.keyType,o=this._def.valueType,a=[...i.data.entries()].map(([c,d],p)=>({key:n._parse(new Mr(i,c,i.path,[p,"key"])),value:o._parse(new Mr(i,d,i.path,[p,"value"]))}));if(i.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let d of a){let p=await d.key,m=await d.value;if(p.status==="aborted"||m.status==="aborted")return pe;(p.status==="dirty"||m.status==="dirty")&&r.dirty(),c.set(p.value,m.value)}return{status:r.value,value:c}})}else{let c=new Map;for(let d of a){let p=d.key,m=d.value;if(p.status==="aborted"||m.status==="aborted")return pe;(p.status==="dirty"||m.status==="dirty")&&r.dirty(),c.set(p.value,m.value)}return{status:r.value,value:c}}}};Ko.create=(t,e,r)=>new Ko({valueType:e,keyType:t,typeName:de.ZodMap,...Re(r)});var Ui=class extends xe{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==ee.set)return le(i,{code:Q.invalid_type,expected:ee.set,received:i.parsedType}),pe;let n=this._def;n.minSize!==null&&i.data.size<n.minSize.value&&(le(i,{code:Q.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:Q.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 p=new Set;for(let m of d){if(m.status==="aborted")return pe;m.status==="dirty"&&r.dirty(),p.add(m.value)}return{status:r.value,value:p}}let c=[...i.data.values()].map((d,p)=>o._parse(new Mr(i,d,i.path,p)));return i.common.async?Promise.all(c).then(d=>a(d)):a(c)}min(e,r){return new Ui({...this._def,minSize:{value:e,message:Ke.toString(r)}})}max(e,r){return new Ui({...this._def,maxSize:{value:e,message:Ke.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Ui.create=(t,e)=>new Ui({valueType:t,minSize:null,maxSize:null,typeName:de.ZodSet,...Re(e)});var $i=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:Q.invalid_type,expected:ee.function,received:r.parsedType}),pe;function i(c,d){return Qu({data:c,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,P1,T1].filter(p=>!!p),issueData:{code:Q.invalid_arguments,argumentsError:d}})}function n(c,d){return Qu({data:c,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,P1,T1].filter(p=>!!p),issueData:{code:Q.invalid_return_type,returnTypeError:d}})}let o={errorMap:r.common.contextualErrorMap},a=r.data;return this._def.returns instanceof Cn?Bt(async(...c)=>{let d=new Fr([]),p=await this._def.args.parseAsync(c,o).catch(R=>{throw d.addIssue(i(c,R)),d}),m=await a(...p);return await this._def.returns._def.type.parseAsync(m,o).catch(R=>{throw d.addIssue(n(m,R)),d})}):Bt((...c)=>{let d=this._def.args.safeParse(c,o);if(!d.success)throw new Fr([i(c,d.error)]);let p=a(...d.data),m=this._def.returns.safeParse(p,o);if(!m.success)throw new Fr([n(p,m.error)]);return m.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new $i({...this._def,args:Rr.create(e).rest(ui.create())})}returns(e){return new $i({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}};$i.create=(t,e,r)=>new $i({args:t?t.rest(ui.create()):Rr.create([]).rest(ui.create()),returns:e||ui.create(),typeName:de.ZodFunction,...Re(r)});var Jo=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})}};Jo.create=(t,e)=>new Jo({getter:t,typeName:de.ZodLazy,...Re(e)});var Zo=class extends xe{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return le(r,{code:Q.invalid_literal,expected:this._def.value}),pe}return{status:"valid",value:e.data}}get value(){return this._def.value}};Zo.create=(t,e)=>new Zo({value:t,typeName:de.ZodLiteral,...Re(e)});function $_(t,e){return new Yo({values:t,typeName:de.ZodEnum,...Re(e)})}var Yo=class extends xe{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),i=this._def.values;return le(r,{expected:Qe.joinValues(i),received:r.parsedType,code:Q.invalid_type}),pe}if(this._def.values.indexOf(e.data)===-1){let r=this._getOrReturnCtx(e),i=this._def.values;return le(r,{received:r.data,code:Q.invalid_enum_value,options:i}),pe}return Bt(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}};Yo.create=$_;var Xo=class extends xe{_parse(e){let r=Qe.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==ee.string&&i.parsedType!==ee.number){let n=Qe.objectValues(r);return le(i,{expected:Qe.joinValues(n),received:i.parsedType,code:Q.invalid_type}),pe}if(r.indexOf(e.data)===-1){let n=Qe.objectValues(r);return le(i,{received:i.data,code:Q.invalid_enum_value,options:n}),pe}return Bt(e.data)}get enum(){return this._def.values}};Xo.create=(t,e)=>new Xo({values:t,typeName:de.ZodNativeEnum,...Re(e)});var Cn=class extends xe{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ee.promise&&r.common.async===!1)return le(r,{code:Q.invalid_type,expected:ee.promise,received:r.parsedType}),pe;let i=r.parsedType===ee.promise?r.data:Promise.resolve(r.data);return Bt(i.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Cn.create=(t,e)=>new Cn({type:t,typeName:de.ZodPromise,...Re(e)});var Cr=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(c=>this._def.schema._parseAsync({data:c,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=c=>{let d=n.refinement(c,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 c};if(i.common.async===!1){let c=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return c.status==="aborted"?pe:(c.status==="dirty"&&r.dirty(),a(c.value),{status:r.value,value:c.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(c=>c.status==="aborted"?pe:(c.status==="dirty"&&r.dirty(),a(c.value).then(()=>({status:r.value,value:c.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(!ec(a))return a;let c=n.transform(a.value,o);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:c}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>ec(a)?Promise.resolve(n.transform(a.value,o)).then(c=>({status:r.value,value:c})):a);Qe.assertNever(n)}};Cr.create=(t,e,r)=>new Cr({schema:t,typeName:de.ZodEffects,effect:e,...Re(r)});Cr.createWithPreprocess=(t,e,r)=>new Cr({schema:e,effect:{type:"preprocess",transform:t},typeName:de.ZodEffects,...Re(r)});var Sr=class extends xe{_parse(e){return this._getType(e)===ee.undefined?Bt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Sr.create=(t,e)=>new Sr({innerType:t,typeName:de.ZodOptional,...Re(e)});var Fi=class extends xe{_parse(e){return this._getType(e)===ee.null?Bt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Fi.create=(t,e)=>new Fi({innerType:t,typeName:de.ZodNullable,...Re(e)});var I1=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}};I1.create=(t,e)=>new Sr({innerType:t,typeName:de.ZodOptional,...Re(e)});var Qo=class extends xe{_parse(e){if(this._getType(e)!==ee.nan){let i=this._getOrReturnCtx(e);return le(i,{code:Q.invalid_type,expected:ee.nan,received:i.parsedType}),pe}return{status:"valid",value:e.data}}};Qo.create=t=>new Qo({typeName:de.ZodNaN,...Re(t)});var Vp=(t,e={},r)=>t?Rn.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})}}):Rn.create(),F_={object:Ye.lazycreate},de;(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"})(de||(de={}));var H_=(t,e={message:`Input not instance of ${t.name}`})=>Vp(r=>r instanceof t,e,!0),Kp=ci.create,Jp=ji.create,W_=Qo.create,q_=$o.create,Zp=Fo.create,G_=Ho.create,V_=Wo.create,K_=qo.create,J_=Rn.create,Z_=ui.create,Y_=hi.create,X_=Go.create,Q_=Er.create,ex=Ye.create,tx=Ye.strictCreate,rx=xs.create,ix=Vo.create,nx=Ss.create,sx=Rr.create,ox=Ms.create,ax=Ko.create,lx=Ui.create,ux=$i.create,cx=Jo.create,hx=Zo.create,fx=Yo.create,dx=Xo.create,mx=Cn.create,Gp=Cr.create,px=Sr.create,gx=Fi.create,yx=Cr.createWithPreprocess,bx=()=>Kp().optional(),vx=()=>Jp().optional(),wx=()=>Zp().optional(),oe=Object.freeze({__proto__:null,getParsedType:En,ZodParsedType:ee,makeIssue:Qu,EMPTY_PATH:N_,addIssueToContext:le,ParseStatus:Pt,INVALID:pe,DIRTY:B_,OK:Bt,isAborted:V0,isDirty:K0,isValid:ec,isAsync:J0,ZodType:xe,ZodString:ci,ZodNumber:ji,ZodBigInt:$o,ZodBoolean:Fo,ZodDate:Ho,ZodUndefined:Wo,ZodNull:qo,ZodAny:Rn,ZodUnknown:ui,ZodNever:hi,ZodVoid:Go,ZodArray:Er,get objectUtil(){return tc},ZodObject:Ye,ZodUnion:xs,ZodDiscriminatedUnion:Vo,ZodIntersection:Ss,ZodTuple:Rr,ZodRecord:Ms,ZodMap:Ko,ZodSet:Ui,ZodFunction:$i,ZodLazy:Jo,ZodLiteral:Zo,ZodEnum:Yo,ZodNativeEnum:Xo,ZodPromise:Cn,ZodEffects:Cr,ZodTransformer:Cr,ZodOptional:Sr,ZodNullable:Fi,ZodDefault:I1,ZodNaN:Qo,custom:Vp,Schema:xe,ZodSchema:xe,late:F_,get ZodFirstPartyTypeKind(){return de},any:J_,array:Q_,bigint:q_,boolean:Zp,date:G_,discriminatedUnion:ix,effect:Gp,enum:fx,function:ux,instanceof:H_,intersection:nx,lazy:cx,literal:hx,map:ax,nan:W_,nativeEnum:dx,never:Y_,null:K_,nullable:gx,number:Jp,object:ex,oboolean:wx,onumber:vx,optional:px,ostring:bx,preprocess:yx,promise:mx,record:ox,set:lx,strictObject:tx,string:Kp,transformer:Gp,tuple:sx,undefined:V_,union:rx,unknown:Z_,void:X_,ZodIssueCode:Q,quotelessJson:L_,ZodError:Fr,defaultErrorMap:T1,get overrideErrorMap(){return P1},setErrorMap:k_});var _x=oe.object({title:oe.string(),description:oe.string(),fees:oe.string(),accessConstraints:oe.string()}),xx=oe.object({deliveryPoint:oe.string(),city:oe.string(),postalCode:oe.string(),country:oe.string(),email:oe.string()}),Sx=oe.object({individualName:oe.string(),position:oe.string(),phone:oe.string(),address:xx}),Mx=oe.object({name:oe.string(),site:oe.string(),contact:Sx}),Ex=oe.object({id:oe.string(),serviceIdentification:_x,serviceProvider:Mx});var Rx=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 Cx(t){try{return Nu(t),!0}catch{return!1}}var Ax=oe.string().refine(Cx,{message:"Invalid hex color"}),ea={minZoom:0,maxZoom:32},rc=oe.number().refine(t=>t>=ea.minZoom&&t<=ea.maxZoom,{message:`must be between ${ea.minZoom} and ${ea.maxZoom}`}),Tx=oe.object({name:oe.string(),title:oe.string().optional(),category:oe.string().optional(),2193:oe.string().optional(),3857:oe.string().optional(),minZoom:rc.optional(),maxZoom:rc.optional()}).refine(({minZoom:t,maxZoom:e})=>(t||ea.minZoom)<=(e||ea.maxZoom),{message:"minZoom may no be greater than maxZoom",path:["minZoom"]}),Px=oe.object({type:oe.nativeEnum(rt),id:oe.string(),title:oe.string().optional(),category:oe.string().optional(),description:oe.string().optional(),background:Ax.optional(),layers:oe.array(Tx),minZoom:rc.optional(),maxZoom:rc.optional(),format:oe.union([oe.nativeEnum(ke),oe.nativeEnum(ar)]).optional()});var Y0=new g1(r1.TileMetadata.TableName);function X0(){return Y0.assets==null&&(Y0.assets=ze.get(ze.AssetLocation)),Y0}function Es(t){let e=Object.entries(t);if(e.length===0)return"";let r=new URLSearchParams;for(let n of e)n[1]!=null&&r.set(n[0],n[1]);r.sort();let i=r.toString();return i===""?"":`?${i}`}var d6=me(Xp(),1),m6=me(h6(),1);function f6(t){return[[[t[0],t[1]],[t[2],t[1]],[t[2],t[3]],[t[0],t[3]],[t[0],t[1]]]]}var{intersection:Xx,union:p6}=m6.default;function Qx(t,e){return t[0]===e[0]&&t[1]===e[1]}function eS(t,e){return Xx(t,f6(e))}function sd(t,e){let r=[];for(let i of t){let n=d6.default.polygon(i[0],e);n.length!==0&&(Qx(n[0],n[n.length-1])||n.push(n[0]),r.push([n]))}return eS(r,e)}var N1=t=>(t<-360?t=-(-t%360):t>360&&(t=t%360),t<-180?360+t:t>180?t-360:t),Rs=(t,e)=>{let r=e-t;return r>180?r-360:r<-180?r+360:r},tS=(t,e)=>N1(t+(e<t?e+360-t:e-t)),Tn={boxLonCenter(t){return N1(t[0]+.5*(t[2]<t[0]?360+t[2]-t[0]:t[2]-t[0]))},delta:Rs,crossesAM(t,e){return Math.sign(Rs(t,e))!==Math.sign(e-t)},normLon:N1,normExtent(t){return[N1(t[0]),t[1],N1(t[2]),t[3]]},union(t,e){if(e==null)return t.slice();let r=Tn.boxLonCenter(t),i=Tn.boxLonCenter(e);if(Rs(r,i)<0)return this.union(e,t);let n=t.slice(),o=tS(r,i);return Rs(o,e[0])<Rs(o,t[0])&&(n[0]=e[0]),Rs(o,e[2])>Rs(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,c=i;for(let d=1;d<t.length;++d){let p=t[d],m=p[0];Tn.crossesAM(c,m)&&(e=!e),e&&(m<0?m+=360:(c+=360,d===1&&(i=o=c))),m<i?i=m:m>o&&(o=m);let R=p[1];R<n?n=R:R>a&&(a=R),c=p[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 rS=[-180,-90,180,90],iS=[180,-90,360,90];function nS(t,e,r){return[e[0]+(r[0]-e[0])*t,e[1]+(r[1]-e[1])*t]}function sS(t){let e=[];for(let r of sd(t,rS))e.push(r);for(let r of sd(t,iS))e.push(r.map(i=>i.map(n=>[n[0]-360,n[1]])));return e}function oc(t,e,r=!0){let i=!1,n=!1,o=t.map(a=>a.map(c=>{let d=[];if(c.length===0)return d;let p=c[0],m=null,S=0;for(let R of c){let x=e(R),w=x[0];if(m!=null){let E=Tn.crossesAM(S,w);if(E&&(i=!0,n=!n),n&&(w<0?x[0]=w+360:m[0]=S+360),E){let T=(180-x[0])/(m[0]-x[0]),C=e(nS(T,R,p));d.push([180,C[1]])}}d.push(x),p=R,m=x,S=w}return d}));return i&&r?sS(o):o}function oS(t){return{type:"Polygon",coordinates:t}}function g6(t,e={}){return{type:"Feature",geometry:oS(t),properties:e}}function y6(t,e={}){return{type:"Feature",geometry:{type:"MultiPolygon",coordinates:t},properties:e}}var ra=me(b6(),1);var v6=`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
|
|
163
|
+
AXIS["Northing",NORTH]]`;var w6=`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"]]`;Zo.default.defs(Re.Nztm2000.toEpsgString(),o6);Zo.default.defs(Re.Citm2000.toEpsgString(),s6);var Y0=new Map;function jx(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,Zo.default)(e.toEpsgString(),Re.Wgs84.toEpsgString())}catch(r){throw new st(`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());Zo.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=jx(e);if(r==null)return null;let i=Y0.get(r);if(i!=null)return i;let n=Re.tryGet(r);return n==null||Zo.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=Xu([[[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=me(require("aws-sdk/lib/core.js"),1),u6=me(require("aws-sdk/clients/s3.js"),1);function Yo(t){return"promise"in t?t.promise():t}function Xo(t,e){return Ei(t)?typeof t.statusCode!="number"?new st(e,500,t):new st(e,t.statusCode,t):new st(e,500,t)}var Zt=class extends Rt{constructor(e,r,i){super(),this.type=Zt.type,this.protocol="s3",this.chunkSize=Zt.DefaultChunkSize,this.maxChunkCount=Zt.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===Zt.type}get size(){return this._size?this._size:(this._size=Promise.resolve().then(async()=>(await Yo(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 Zt(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 Xo(n,`Failed to fetch ${this.name} ${i}`)}}};Zt.type="aws:s3";Zt.DefaultChunkSize=64*1024;Zt.DefaultMaxChunkCount=32;var Yt=class{constructor(e){this.protocol=Yt.protocol,this.s3=e}source(e){let r=Zt.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===Yt.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 Yo(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>=Yt.MaxListCount)throw new Error(`Failed to finish listing within ${Yt.MaxListCount} list attempts`);n=m.NextContinuationToken}}catch(m){throw Xo(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 Xo(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 Yo(this.s3.upload({Bucket:n.bucket,Key:n.key,Body:r,ContentEncoding:i?.contentEncoding,ContentType:i?.contentType}))}catch(o){throw Xo(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 Yo(this.s3.headObject({Bucket:r.bucket,Key:r.key}))).ContentLength,path:e}}catch(i){if(Ei(i)&&i.code==="NotFound")return null;throw Xo(i,`Failed to exists: "${e}"`)}}};Yt.protocol="s3";Yt.MaxListCount=100;var Xt=class{static fsFromRole(e,r,i){if(typeof e=="object")return Xt.fsFromRole(e.roleArn,e.externalId,e.durationSeconds);let n=Xt.role(e,r,i);return new Yt(new u6.default({credentials:n}))}static role(e,r,i){i=i??Xt.DefaultRoleDurationSeconds;let n=`role::${e}::${r}::${i}`,o=Xt.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}}),Xt.cache.set(n,o)),o}};Xt.DefaultRoleDurationSeconds=3600;Xt.cache=new Map;var h6=me(require("aws-sdk/clients/s3.js"),1),c6=require("util"),Qu=require("zlib");var qx=(0,c6.promisify)(Qu.gunzip),Qt=wt;Qt.readJson=async function(e){let r=await this.read(e);return e.endsWith(".gz")?JSON.parse((await qx(r)).toString()):JSON.parse(r.toString())};Qt.writeJson=async function(e,r){let i=Buffer.from(JSON.stringify(r,void 0,2));if(e.endsWith(".gz")){let n=(0,Qu.createGzip)();return n.end(i),this.write(e,n)}else return this.write(e,i)};Qt.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,Xt.fsFromRole(e.roleArn,e.externalId))};Qt.register("s3://",new Yt(new h6.default));function X0(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";ce.setConfigProvider(new Ja(c1.TileMetadata.TableName));var a4=me(e0(),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 Qo;(function(t){t.CloudfrontId="X-Amz-Cf-Id",t.TraceId="X-Amzn-Trace-Id"})(Qo||(Qo={}));var qr;(function(t){t.CorrelationId="X-LINZ-Correlation-Id",t.RequestId="X-LINZ-Request-Id"})(qr||(qr={}));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 d6=me(bo(),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,d6.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 p6=require("url");var m6=me(bo(),1);var lr=class extends _s{constructor(e,r,i){var n;super(e,r,i),this.headers=new Map,this.correlationId=(n=this.header(qr.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 ea=class extends lr{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 lr{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 Q0=require("url");var ta=class extends lr{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 Y=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 Y}static ok(e=200,r="Ok"){return new Y(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(qr.RequestId),status:this.status,message:this.statusDescription,correlationId:this.header(qr.CorrelationId)})):Buffer.isBuffer(this._body)?this._body.toString("base64"):this._body}};var i4=me(r4(),1);var uh=class{constructor(){this.hooks={request:[],response:[]},this.router=(0,i4.default)({defaultRoute:()=>new Y(404,"Not found")})}register(e,r,i){this.router.on(e,r,async(n,o,a)=>n instanceof lr?(n.params=a,hh(n,i)):new Y(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 Y.is(i)?i:(e.set("err",i),new Y(500,"Internal Server Error"))}return r}async handle(e){for(let i of this.hooks.request){let n=await hh(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 Y(404,"Not found"))}};var n4=require("url");var aa=class extends lr{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.34.0",pS="1685fa12be66df74bc64d7f76b7355390980a43f",s4={version:l4,hash:pS};async function hh(t,e){t.timer.timers.has("lambda")||t.timer.start("lambda");try{return await e(t)}catch(r){return Y.is(r)?r:(t.set("err",r),new Y(500,"Internal Server Error"))}}function o4(t,e){let r=200;Y.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 gS(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 ur=class{static request(e,r,i){if(ea.is(e))return new ea(e,r,i);if(aa.is(e))return new aa(e,r,i);if(hi.is(e))return new hi(e,r,i);if(ta.is(e))return new ta(e,r,i);throw new Error("Request is not a a ALB, ApiGateway or Cloudfront event")}static handler(e,r,i){let n=gS(r);function o(a,h,d){let m=new _s(a,h,i??ur.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}),hh(m,e).then(M=>{if(o4(m,M),Y.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 uh;function i(n,o,a){let h=ur.request(n,o,e??ur.Logger),d=h.header(Qo.CloudfrontId),m=h.header(Qo.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(qr.RequestId,h.id),M.header(qr.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),ur.ServerName&&M.header(re.Server,`${ur.ServerName}-${l4}`),o4(h,M),a(null,h.toResponse(M))})}return i.router=r,i}};ur.Logger=(0,a4.default)();ur.ServerName="linz";var Ve={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 ve=()=>new Y(404,"Not Found"),ft=()=>new Y(304,"Not modified"),u4=()=>new Y(204,"No Content"),h4=t=>new Y(200,"ok").json({id:t.id,correlationId:t.correlationId,message:"ok"});async function c4(t){let e=Qe.get(Qe.PublicUrlBase);if(e==null)return ve();let r={currentVersion:10.1,fullVersion:"10.1",owningSystemUrl:e},i=JSON.stringify(r),n=Buffer.from(i),o=Ve.key(n);if(Ve.isNotModified(t,o))return ft();let a=new Y(200,"ok");return a.header(re.CacheControl,"public, max-age=604800, stale-while-revalidate=86400"),a.buffer(n,"application/json"),t.set("bytes",n.byteLength),a}var d4=require("url");var yS=.2,la=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(yS),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 la.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 f4=[Ge.Jpeg,Ge.Webp,Ge.Png];function md(t){if(t==null)return null;let e=t.toLowerCase();return e===Ge.Png?Ge.Png:e===Ge.Webp?Ge.Webp:e===Ge.Jpeg||e==="jpg"?Ge.Jpeg:e===Ge.Avif?Ge.Avif:null}var ot={apiKey(t){let e=t.query.get(c1.ApiKey.QueryString)??t.header("X-LINZ-Api-Key"),r=Ep(e);if(!r.valid)throw new Y(400,"API Key Invalid: "+r.message);return t.set("api",e),e},getTileMatrixSet(t){return Yn.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===nr.MapboxVectorTiles?nr.MapboxVectorTiles:null)},xyz(t){ot.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=ot.getTileMatrixSet(t.params.tileMatrix);if(n==null)throw new Y(404,"Tile Matrix not found");t.set("tileMatrix",n.identifier),t.set("projection",n.projection.code);let o=ot.getTileFormat(t.params.tileType);if(o==null)throw new Y(404,"Tile extension not found");if(t.set("extension",o),isNaN(i)||i>n.maxZoom||i<0)throw new Y(404,`Zoom not found: ${i}`);let a=n.zooms[i];if(isNaN(e)||e<0||e>a.matrixWidth)throw new Y(404,`X not found: ${e}`);if(isNaN(r)||r<0||r>a.matrixHeight)throw new Y(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}};function Ui(t,e){if(t==null)return"";let r=Qe.get(Qe.PublicUrlBase)??"";if(!t.startsWith("/"))return t;let i=new d4.URL(wt.join(r,t));return e&&i.searchParams.set("api",e),i.toString().replace(/%7B/g,"{").replace(/%7D/g,"}")}function bS(t,e){let r=JSON.parse(JSON.stringify(t.sources));for(let[i,n]of Object.entries(r)){if(n.type==="vector")n.url=Ui(n.url,e);else if(n.type==="raster"&&Array.isArray(n.tiles))for(let o=0;o<n.tiles.length;o++)n.tiles[o]=Ui(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:Ui(t.glyphs),sprite:Ui(t.sprite)}}async function pd(t){let e=ot.apiKey(t),r=t.params.styleName,i=ce.Style.id(r),n=await ce.Style.get(i);if(n==null)return ve();let o=bS(n.style,e),a=Buffer.from(JSON.stringify(o)),h=Ve.key(a);if(Ve.isNotModified(t,h))return ft();let d=new Y(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}function vS(t,e){let r=Qe.get(Qe.PublicUrlBase)??"",i=`/v1/arcgis/rest/services/${t}/VectorTileServer`,n=new URL(Qt.join(r,i));return n.searchParams.set("api",e),n.searchParams.set("f","json"),n.toString().replace(/%7B/g,"{").replace(/%7D/g,"}")}function wS(t,e,r){let i=JSON.parse(JSON.stringify(e.sources));for(let[o,a]of Object.entries(i))a.type==="vector"?(a.url=vS(t,r),i[o]=a):delete i[o];let n=[];for(let o of e.layers)o.source!=null&&!i.hasOwnProperty(o.source)||n.push(o);return{version:8,id:e.id,name:e.name,sources:i,layers:n,metadata:e.metadata??{},glyphs:Ui(e.glyphs),sprite:Ui(e.sprite)}}async function m4(t){let e=ot.apiKey(t),r=await ce.TileSet.get(ce.TileSet.id(t.params.tileSet));if(r?.type!==nt.Vector)return ve();let i=t.query.get("style"),n=i||"topographic",o=ce.Style.id(n),a=await ce.Style.get(o);if(a==null)return ve();let h=wS(r.name,a.style,e),d=Buffer.from(JSON.stringify(h)),m=Ve.key(d);if(Ve.isNotModified(t,m))return ft();let p=new Y(200,"ok");return p.header(re.ETag,m),p.header(re.CacheControl,"no-store"),p.buffer(d,"application/json"),t.set("bytes",d.byteLength),p}var _S=18,xS=1;async function p4(t){let e=await ce.TileSet.get(ce.TileSet.id(t.params.tileSet));if(e?.type!==nt.Vector)return ve();let r=ot.apiKey(t);if(t.query.get("f")!=="json")return ve();let n={xmin:je.extent.x,ymin:je.extent.y,xmax:je.extent.right,ymax:je.extent.bottom,spatialReference:{wkid:102100,latestWkid:je.projection.code}},o={currentVersion:10.81,name:e.name,capabilities:"TilesOnly",type:"indexedVector",defaultStyles:"",tiles:[Ui(`/v1/tiles/${e.name}/WebMercatorQuad/{z}/{x}/{y}.pbf`,r)],exportTilesAllowed:!1,maxExportTilesCount:0,initialExtent:n,fullExtent:n,minScale:0,maxScale:0,tileInfo:{rows:512,cols:512,dpi:96,format:"pbf",origin:{x:je.extent.x,y:je.extent.bottom},spatialReference:{wkid:102100,latestWkid:je.projection.code},lods:je.zooms.slice(xS,_S).map((m,p)=>({level:p,resolution:m.scaleDenominator*28e-5,scale:m.scaleDenominator}))},maxzoom:22,minLOD:0,maxLOD:15,resourceInfo:{styleVersion:8,tileCompression:"gzip",cacheInfo:{storageInfo:{packetSize:128,storageFormat:"compactV2"}}}},a=JSON.stringify(o,null,2),h=Buffer.from(a),d=new Y(200,"ok");return d.header(re.CacheControl,"no-store"),d.buffer(h,"application/json"),t.set("bytes",h.byteLength),d}var SS=1+1e-10,g4=10**8;function gd(t){return Math.round(t*g4)/g4}function MS(t){return[gd(t[0]),gd(t[1])]}function ES(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(SS).toPolygon()];i=t6(i,a)}return Xu(i,o=>MS(r.toWgs84(o)))}async function RS(t,e,r){let i=jr.get(r),n=[],o=[],a=await ce.getAllImagery(e.layers,[r.projection]),h=await ce.Provider.get(ce.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:Za.Version,id:m+"_item",collection:m,assets:{},links:[],bbox:M,geometry:{type:"MultiPolygon",coordinates:ES(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,je,r,!0),T=Mt.convertZoomLevel(d.maxZoom?d.maxZoom:32,je,r,!0);n.push({stac_version:Za.Version,license:Za.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:Za.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=ot.getTileMatrixSet(t.params.tileMatrix);if(e==null)throw new Y(404,"Tile Matrix not found");t.timer.start("tileset:load");let r=await ce.TileSet.get(ce.TileSet.id(t.params.tileSet));if(t.timer.end("tileset:load"),r==null||r.type===nt.Vector)return ve();let i=Ve.key(r);if(Ve.isNotModified(t,i))return ft();t.timer.start("stac:load");let n=await RS(t,r,e);if(t.timer.end("stac:load"),n==null)return ve();let o=new Y(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 I4=me(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 k1;(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"})(k1||(k1={}));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 we;(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"})(we||(we={}));var y4=2**32,CS=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=>CS(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 we.UInt8:return this.getUint8(e);case we.UInt16:return this.getUint16(e);case we.UInt32:return this.getUint32(e);case we.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,we.UInt16);if(r!=null)return this.getView(r).getUint16(e-r*this.chunkSize,this.isLittleEndian);let i=this.getUint8(e),n=this.getUint8(e+we.UInt8);return this.isLittleEndian?i+(n<<8):(i<<8)+n}getUint32(e){let r=this.isOneChunk(e,we.UInt32);if(r!=null)return this.getView(r).getUint32(e-r*this.chunkSize,this.isLittleEndian);let i=this.getUint16(e),n=this.getUint16(e+we.UInt16);return this.isLittleEndian?i+n*65536:i*65536+n}getUint64(e){let r=this.isOneChunk(e,we.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+we.UInt32);return this.isLittleEndian?i+n*y4:i*y4+n}getBigUint64(e){let r=this.isOneChunk(e,we.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+we.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 b4=me(wd(),1);function v4(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)=>b4.read(t.bytes(e,we.Double),0,t.isLittleEndian,52,8),rational:(t,e)=>[t.getUint32(e),t.getUint32(e+4)]};function ch(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=v4(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=ch(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 L1=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=ch(this.dataType);return this.tiff.source.hasBytes(i,r)||await this.tiff.source.loadBytes(i,r),n(this.tiff.source,i)}};var N1=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 fh={create(t,e){let r=t.source.getUint16(e);if(r===ae.TileOffsets||r===ae.TileByteCounts||r===ae.StripByteCounts||r===ae.StripOffsets)return new L1(r,t,e);let i=new N1(r,t,e);return i.hasBytes?i:new Es(r,t,e)},isStatic(t){return t instanceof N1},isLazy(t){return t instanceof Es},isOffsetArray(t){return t instanceof L1}};var AS=32767,dh=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:fh.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(k1.ProjectedCSTypeGeoKey);return e===AS?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 B1;(function(t){t[t.Big=19789]="Big",t[t.Little=18761]="Little"})(B1||(B1={}));var Ar;(function(t){t[t.BigTiff=43]="BigTiff",t[t.Tiff=42]="Tiff"})(Ar||(Ar={}));var _d="__reverse";function w4(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 TS={uint32:we.UInt32},mh=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,
|
|
183
|
+
AUTHORITY["EPSG","2193"]]`;ra.default.defs(Ee.Nztm2000.toEpsgString(),w6);ra.default.defs(Ee.Citm2000.toEpsgString(),v6);var ld=new Map;function aS(t){return t==null?null:typeof t=="number"?t:"code"in t?t.code:"projection"in t?t.projection.code:null}var Wr=class{constructor(e){this.epsg=e;try{this.projection=(0,ra.default)(e.toEpsgString(),Ee.Wgs84.toEpsgString())}catch(r){throw new lt(`Failed to create projection: ${e.toEpsgString()}, ${Ee.Wgs84.toEpsgString()}`,500,r)}}static define(e,r){if(ld.get(e.code)!=null)throw new Error("Duplicate projection definition: "+e.toEpsgString());ra.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=aS(e);if(r==null)return null;let i=ld.get(r);if(i!=null)return i;let n=Ee.tryGet(r);return n==null||ra.default.defs(n.toEpsgString())==null?null:(i=new Wr(n),ld.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(c=>n(i(c)))))}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],c=oc([[[i,o,a,n,i]]],this.toWgs84),d=c.length===1?g6(c[0],r):y6(c,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,c]=o.toWgs84([i.x,n.y]),[d,p]=o.toWgs84([n.x,i.y]);return[a,c,d,p]}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 Wr.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 _6(t){return t==null||typeof t=="string"?!1:"roleArn"in t&&typeof t.roleArn=="string"}function ia(t){return"promise"in t?t.promise():t}function na(t,e){return Ti(t)?typeof t.statusCode!="number"?new lt(e,500,t):new lt(e,t.statusCode,t):new lt(e,500,t)}var er=class extends Ct{constructor(e,r,i){super(),this.type=er.type,this.protocol="s3",this.chunkSize=er.DefaultChunkSize,this.maxChunkCount=er.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===er.type}get size(){return this._size?this._size:(this._size=Promise.resolve().then(async()=>(await ia(this.remote.headObject({Bucket:this.bucket,Key:this.key}))).ContentLength||-1),this._size)}static fromUri(e,r){let i=vr(e);return i==null||i.key==null||i.protocol!=="s3"?null:new er(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 na(n,`Failed to fetch ${this.name} ${i}`)}}};er.type="aws:s3";er.DefaultChunkSize=64*1024;er.DefaultMaxChunkCount=32;var tr=class{constructor(e,r){this.protocol=tr.protocol,this.s3=e,this.credentials=r}source(e){let r=er.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===tr.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=vr(e);if(i==null)return;let n,o=r?.recursive===!1?"/":void 0,a=i.bucket,c=i.key,d=0;try{for(;;){d++;let p=await ia(this.s3.listObjectsV2({Bucket:a,Prefix:c,ContinuationToken:n,Delimiter:o}));if(p.CommonPrefixes!=null)for(let m of p.CommonPrefixes)m.Prefix!=null&&(yield{path:`s3://${a}/${m.Prefix}`,isDirectory:!0});if(p.Contents!=null)for(let m of p.Contents)m.Key!=null&&(yield{path:`s3://${a}/${m.Key}`,size:m.Size});if(!p.IsTruncated)break;if(d>=tr.MaxListCount)throw new Error(`Failed to finish listing within ${tr.MaxListCount} list attempts`);n=p.NextContinuationToken}}catch(p){let m=na(p,`Failed to list: "${e}"`);if(this.credentials!=null&&m.code===403){let S=await this.credentials.find(e);if(S){yield*S.details(e,r);return}}throw m}}async read(e){let r=vr(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){let n=na(i,`Failed to read: "${e}"`);if(this.credentials!=null&&n.code===403){let o=await this.credentials.find(e);if(o)return o.read(e)}throw n}}async write(e,r,i){let n=vr(e);if(n==null||n.key==null)throw new Error(`Failed to write: "${e}"`);try{await ia(this.s3.upload({Bucket:n.bucket,Key:n.key,Body:r,ContentEncoding:i?.contentEncoding,ContentType:i?.contentType}))}catch(o){let a=na(o,`Failed to write: "${e}"`);if(this.credentials!=null&&a.code===403){let c=await this.credentials.find(e);if(c)return c.write(e,r,i)}throw a}}exists(e){return this.head(e).then(r=>r!=null)}stream(e){let r=vr(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=vr(e);if(r==null||r.key==null)throw new Error(`Failed to head: "${e}"`);try{return{size:(await ia(this.s3.headObject({Bucket:r.bucket,Key:r.key}))).ContentLength,path:e}}catch(i){if(Ti(i)&&i.code==="NotFound")return null;let n=na(i,`Failed to head: "${e}"`);if(this.credentials!=null&&n.code===403){let o=await this.credentials.find(e);if(o)return o.head(e)}throw n}}};tr.protocol="s3";tr.MaxListCount=100;var x6=me(require("aws-sdk/clients/s3.js"),1),S6=me(require("aws-sdk/lib/core.js"),1),zt=class{static fsFromRole(e,r,i){if(typeof e=="object")return zt.fsFromRole(e.roleArn,e.externalId,e.durationSeconds);let n=zt.role(e,r,i);return new tr(new x6.default({credentials:n}))}static role(e,r,i){i=i??zt.DefaultRoleDurationSeconds;let n=`role::${e}::${r}::${i}`,o=zt.cache.get(n);return o==null&&(o=new S6.default.ChainableTemporaryCredentials({params:{RoleArn:e,ExternalId:r,RoleSessionName:"fsa-"+Math.random().toString(32)+"-"+Date.now(),DurationSeconds:i}}),zt.cache.set(n,o)),o}};zt.DefaultRoleDurationSeconds=3600;zt.cache=new Map;var B1=class{constructor(e,r){this.isRegisterable=!0,this._config=null,this.path=e,this.fs=r}get config(){return this._config==null&&(this._config=this.fs.read(this.path).then(e=>JSON.parse(e.toString()))),this._config}async find(e){if(this.path===e)return null;let r=await this.config;if(r==null)return null;if(r.v!==2)throw new Error("Invalid bucket config version: "+r.v+" from "+this.path);if(r.prefixes==null||!Array.isArray(r.prefixes))throw new Error('Invalid bucket config missing "prefixes" from '+this.path);let i=r.prefixes.find(o=>e.startsWith(o.prefix));if(i==null)return null;let n=zt.fsFromRole(i.roleArn,i.externalId,i.roleSessionDuration);return this.onFileSystemCreated&&this.onFileSystemCreated(i,n),n}};var E6=me(require("aws-sdk/clients/s3.js"),1),R6=require("util"),ac=require("zlib");var lS=(0,R6.promisify)(ac.gunzip),gt=xt;gt.readJson=async function(e){let r=await this.read(e);return e.endsWith(".gz")?JSON.parse((await lS(r)).toString()):JSON.parse(r.toString())};gt.writeJson=async function(e,r){let i=Buffer.from(JSON.stringify(r,void 0,2));if(e.endsWith(".gz")){let n=(0,ac.createGzip)();return n.end(i),this.write(e,n)}else return this.write(e,i)};gt.configure=function(e){if(e.type!=="s3"||!_6(e))return;let r=vr(e.path);if(r==null)throw new Error("Failed to parse URI: "+e.path);let i=`s3://${r.bucket}/`;this.register(i,zt.fsFromRole(e.roleArn,e.externalId))};var C6=new tr(new E6.default);gt.register("s3://",C6);var M6=ze.get(ze.AwsRoleConfigPath);if(M6!=null){let t=new B1(M6,gt);t.onFileSystemCreated=(e,r)=>{Co.get().debug({roleArn:e.roleArn,prefix:e.prefix},"FileSystem:Registered"),gt.register(e.prefix,r)},C6.credentials=t}function ud(t){return t[0].toUpperCase()+t.slice(1).replace(/_(\d+)-(\d+)m/g," $1.$2m").replace(/_/g," ")}function A6(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";var Mg=me(Gf(),1);var Pn="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 sa;(function(t){t.CloudfrontId="X-Amz-Cf-Id",t.TraceId="X-Amzn-Trace-Id"})(sa||(sa={}));var cr;(function(t){t.CorrelationId="X-LINZ-Correlation-Id",t.RequestId="X-LINZ-Request-Id"})(cr||(cr={}));var O6=require("url");var T6=require("perf_hooks"),uS=4,lc=class{constructor(){this.timers=new Map}getTime(){return T6.performance.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=Number(i.toFixed(uS)),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 P6=me(Ao(),1);function jt(t){return!(typeof t!="object"||t==null)}var Cs=class{constructor(e,r,i){this.context=r,this.event=e,this.id=(0,P6.ulid)(),this.headers=new Map,this.logContext={},this.log=i,this.timer=new lc,this.log=i.child({id:this.id})}get isColdStart(){return this.requestCount===0}set(e,r){r==null&&(r=void 0),this.logContext[e]=r}toResponse(e){return e?.body}};var I6=me(Ao(),1);var Ut=class extends Cs{constructor(e,r,i){var n;super(e,r,i),this.headers=new Map,this.abort=new AbortController,this.correlationId=(n=this.header(cr.CorrelationId))!==null&&n!==void 0?n:I6.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)!==Pn)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 oa=class extends Ut{static is(e){return jt(e)&&jt(e.requestContext)&&jt(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 O6.URLSearchParams;if(this.event.queryStringParameters==null)return e;for(let[r,i]of Object.entries(this.event.queryStringParameters))e.append(r,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 L6=require("url");var di=class extends Ut{static is(e){return!(!jt(e)||!jt(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:di.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 L6.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,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 cd=require("url");var aa=class extends Ut{static is(e){if(!jt(e)||!Array.isArray(e.Records))return!1;let r=e.Records[0];return jt(r)?jt(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 cd.URLSearchParams:new cd.URLSearchParams(e)}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 k6=require("url");var la=class extends Ut{toResponse(e){return{statusCode:e.status,body:e.body,headers:di.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 k6.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!(!jt(e)||!jt(e.requestContext)||!jt(e.requestContext.http))}};var J=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 J}static ok(e=200,r="Ok"){return new J(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),Pn),this}buffer(e,r=Pn){return this.header(re.ContentType,r),this._body=e,this}get body(){return this._body==null?(this.header(re.ContentType,Pn),JSON.stringify({id:this.header(cr.RequestId),status:this.status,message:this.statusDescription,correlationId:this.header(cr.CorrelationId)})):Buffer.isBuffer(this._body)?this._body.toString("base64"):this._body}};var _g=me(wg(),1),xg=me(require("timers/promises"),1);var bc=class{constructor(){this.hooks={request:[],response:[]},this.timeoutEarlyMs=0,this.router=(0,_g.default)({defaultRoute:()=>new J(404,"Not found")})}register(e,r,i){this.router.on(e,r,(n,o,a)=>n instanceof Ut?(n.params=a,vc(n,i)):new J(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 J.is(i)?i:(e.set("err",i),new J(500,"Internal Server Error"))}return r}async handle(e){let r=[this._handle(e)];if(this.timeoutEarlyMs&&typeof e.context.getRemainingTimeInMillis=="function"){let i=e.context.getRemainingTimeInMillis()-this.timeoutEarlyMs;r.push(xg.default.setTimeout(i,new J(408,"Request Timed Out"),{signal:e.abort.signal}))}return Promise.race(r).then(i=>(e.abort.abort(),Ed(e,i)))}async _handle(e){e.requestCount===-1&&(e.requestCount=$t.requestCount++);let r=e.header(sa.CloudfrontId),i=e.header(sa.TraceId),n=e.context.awsRequestId;(r||i||n)&&e.set("aws",{cloudFrontId:r,traceId:i,lambdaId:n}),e.set("method",e.method),e.set("path",e.path);for(let a of this.hooks.request){let c=await vc(e,a);if(c)return this.after(e,c)}let o=await this.router.lookup(e,null);return o?this.after(e,o):this.after(e,new J(404,"Not found"))}};var DS="v6.35.0",zS="dcebd7149ab318ea979b5d1ba34a9f82fc41b935",Sg={version:DS,hash:zS};async function vc(t,e){t.timer.timers.has("lambda")||t.timer.start("lambda");try{return await e(t)}catch(r){return J.is(r)?r:(t.set("err",r),new J(500,"Internal Server Error"))}}function Ed(t,e){let r=t.timer.timers.has("lambda")?t.timer.end("lambda"):0,i=200;return e instanceof J&&(e.status>=500&&e.header(re.CacheControl,"no-store"),e.header(re.ServerTiming,`total;dur=${r}`),!e.isBase64Encoded&&e.header(re.ContentType)==null&&e.header(re.ContentType,Pn),i=e.status,t.set("description",e.statusDescription),e.header(cr.RequestId,t.id),t instanceof Ut&&e.header(cr.CorrelationId,t.correlationId)),t.set("status",i),t.timer.timers.size>0&&t.set("metrics",t.timer.metrics),Sg.hash&&t.set("package",Sg),t.set("requestCount",t.requestCount),t.set("unfinished",t.timer.unfinished),t.set("duration",r),t.set("@type","report"),i>499?t.log.error(t.logContext,"Lambda:Done"):i>399?t.log.warn(t.logContext,"Lambda:Done"):t.log.info(t.logContext,"Lambda:Done"),e}function jS(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 $t=class{static request(e,r,i){if(oa.is(e))return new oa(e,r,i);if(la.is(e))return new la(e,r,i);if(di.is(e))return new di(e,r,i);if(aa.is(e))return new aa(e,r,i);throw new Error("Request is not a a ALB, ApiGateway or Cloudfront event")}static handler(e,r,i){let n=jS(r);function o(a,c,d){let p=new Cs(a,c,i??$t.Logger);p.requestCount=$t.requestCount++,n.tracePercent>0&&Math.random()<n.tracePercent&&(p.log.level="trace"),process.env.TRACE_LAMBDA&&(p.log.level="trace"),p.log.trace({event:a},"Lambda:Start");let m=c.awsRequestId;p.set("aws",{lambdaId:m}),vc(p,e).then(S=>{if(Ed(p,S),J.is(S)&&n.rejectOnError){if(p.logContext.err)return d(p.logContext.err);if(S.status>399)return d(p.toResponse(S))}return d(null,p.toResponse(S))})}return o}static http(e){let r=new bc;async function i(n,o){let a=$t.request(n,o,e??$t.Logger);try{let c=await r.handle(a);return a.toResponse(c)}catch(c){a.log.fatal({err:c},"Lambda:Failed");let d=new J(500,"Internal Server Error");return a.set("err",c),d.header(cr.RequestId,a.id),d.header(cr.CorrelationId,a.correlationId),a.toResponse(d)}}return i.router=r,i}};$t.Logger=(0,Mg.default)();$t.ServerName="linz";$t.requestCount=0;var Ne={key(t){return Buffer.isBuffer(t)||typeof t=="string"?wn(t):wn(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 ce=()=>new J(404,"Not Found"),ot=()=>new J(304,"Not modified"),Eg=()=>new J(204,"No Content"),Rg=t=>new J(200,"ok").json({id:t.id,correlationId:t.correlationId,message:"ok"});async function Cg(t){let e=ze.get(ze.PublicUrlBase);if(e==null)return ce();let r={currentVersion:10.1,fullVersion:"10.1",owningSystemUrl:e},i=JSON.stringify(r),n=Buffer.from(i),o=Ne.key(n);if(Ne.isNotModified(t,o))return ot();let a=new J(200,"ok");return a.header(re.CacheControl,"public, max-age=604800, stale-while-revalidate=86400"),a.buffer(n,"application/json"),t.set("bytes",n.byteLength),a}var Pg=require("url");var US=.2,ma=class{constructor(e){this.tms=e}async tile(e,r,i,n){let o=[];for(let a of e){let c=this.getTiles(a,r,i,n);c!=null&&(o=o.concat(c))}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),c=e.images[0].bbox,d=this.tms.sourceToPixels(c[0],c[3],n),p=this.tms.sourceToPixels(c[2],c[1],n),m=_e.fromUpperLeftLowerRight(d,p),S=m.intersection(a);return S==null?null:{tiff:m,intersection:S,tile:a}}createComposition(e,r,i,n,o){let a=_e.fromJson(e.getTileBounds(r,i)),c=a.scale(n,n).add(o.tiff).round(US),d=c.intersection(o.tile);if(d==null)return null;let p=d.subtract(c);if(p.height<.5||p.width<.5)return null;let m=c.subtract(o.tile),S={tiff:e.tif,source:{x:r,y:i,imageId:e.id,width:a.width,height:a.height},y:Math.max(0,Math.round(m.y)),x:Math.max(0,Math.round(m.x))};if((a.width<e.tileSize.width||a.height<e.tileSize.height)&&(S.extract={width:a.width,height:a.height}),a.width!==c.width||a.height!==c.height){let R=a.width!==c.width?c.width/a.width:c.height/a.height;S.resize={width:c.width,height:c.height,scale:R}}return(p.y!==0||p.x!==0||p.height!==c.height||p.width!==c.width)&&(S.crop=p),S}getTiles(e,r,i,n){let o=this.getRasterTiffIntersection(e,r,i,n);if(o==null)return null;let a=this.tms.pixelScale(n),c=e.getImageByResolution(a),d=a/c.resolution[0],p=o.intersection.subtract(o.tiff),{tileSize:m,tileCount:S}=c,R=[],x=1/d;for(let w of ma.getRequiredTiles(p,d,m,S)){let E=this.createComposition(c,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),c=Math.max(Math.floor(e.y/i.height*r),0),d=Math.min(Math.ceil(e.bottom/i.height*r),n.y);for(let p=o;p<a;p++)for(let m=c;m<d;m++)yield{x:p,y:m}}};var Ag=[ke.Jpeg,ke.Webp,ke.Png];function Rd(t){if(t==null)return null;let e=t.toLowerCase();return e===ke.Png?ke.Png:e===ke.Webp?ke.Webp:e===ke.Jpeg||e==="jpg"?ke.Jpeg:e===ke.Avif?ke.Avif:null}var at={apiKey(t){let e=t.query.get(r1.ApiKey.QueryString)??t.header("X-LINZ-Api-Key"),r=Om(e);if(!r.valid)throw new J(400,"API Key Invalid: "+r.message);return t.set("api",e),e},getTileMatrixSet(t){return Ur.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=Rd(i);n!=null&&r.add(n)}return r.size===0?null:[...r.values()]},getTileFormat(t){let e=Rd(t);return e||(t===ar.MapboxVectorTiles?ar.MapboxVectorTiles:null)},xyz(t){at.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=at.getTileMatrixSet(t.params.tileMatrix);if(n==null)throw new J(404,"Tile Matrix not found");t.set("tileMatrix",n.identifier),t.set("projection",n.projection.code);let o=at.getTileFormat(t.params.tileType);if(o==null)throw new J(404,"Tile extension not found");if(t.set("extension",o),isNaN(i)||i>n.maxZoom||i<0)throw new J(404,`Zoom not found: ${i}`);let a=n.zooms[i];if(isNaN(e)||e<0||e>a.matrixWidth)throw new J(404,`X not found: ${e}`);if(isNaN(r)||r<0||r>a.matrixHeight)throw new J(404,`Y not found: ${r}`);let c={tile:{x:e,y:r,z:i},tileSet:t.params.tileSet,tileMatrix:n,tileType:o};t.set("xyz",c.tile);let d=Wr.tileCenterToLatLon(n,c.tile);return t.set("location",d),c}};var pa=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 Cd=class{constructor(e){this.configProvider=e.then(r=>{let i=Ii.fromJson(r);return i.createVirtualTileSets(),i}).catch(r=>{if(r.code===404)return null;throw r})}get size(){return 1}},Ad=class{constructor(e){this.cache=new pa(e)}get(e){let r=this.cache.get(e)?.configProvider;if(r!=null)return r;let i=gt.readJson(e),n=new Cd(i);return this.cache.set(e,n),n.configProvider}},Tg=new Ad(20);var $S=new Set(["linz-workflow-artifacts","linz-basemaps"]),FS=new Set(["s3","memory"]),Be=class{static async getDefaultConfig(){return X0()}static extract(e){let r=e.query.get("config");return r==null?null:r.includes("/")?ko.encode(Buffer.from(r)):r}static async load(e){let r=e.query.get("config");if(r==null)return this.getDefaultConfig();let i=Lu(r)?Buffer.from(ko.decode(r)).toString():r,n=vr(i);if(n==null)throw new J(400,"Invalid config location");if(!FS.has(n.protocol))throw new J(400,`Invalid configuration location protocol:${n.protocol}`);if(!$S.has(n.bucket))throw new J(400,`Bucket: "${n.bucket}" is not a allowed bucket location`);return e.set("config",i),e.timer.start("config:load"),Tg.get(i).then(o=>{if(e.timer.end("config:load"),o==null)throw new J(404,`Config not found at ${i}`);return o})}};function Hi(t,e,r){if(t==null)return"";let i=ze.get(ze.PublicUrlBase)??"";if(!t.startsWith("/"))return t;let n=new Pg.URL(xt.join(i,t));return e&&n.searchParams.set("api",e),r&&n.searchParams.set("config",r),n.toString().replace(/%7B/g,"{").replace(/%7D/g,"}")}function HS(t,e,r){let i=JSON.parse(JSON.stringify(t.sources));for(let[n,o]of Object.entries(i)){if(o.type==="vector")o.url=Hi(o.url,e,r);else if(o.type==="raster"&&Array.isArray(o.tiles))for(let a=0;a<o.tiles.length;a++)o.tiles[a]=Hi(o.tiles[a],e,r);i[n]=o}return{version:8,id:t.id,name:t.name,sources:i,layers:t.layers,metadata:t.metadata??{},glyphs:Hi(t.glyphs,void 0,r),sprite:Hi(t.sprite,void 0,r)}}async function WS(t,e,r){let i=Ur.find(t.query.get("tileMatrix")??Le.identifier);if(i==null)return new J(400,"Invalid tile matrix");let[n]=at.getRequestedFormats(t)??[ke.Webp];if(n==null)return new J(400,"Invalid image format");let o=Be.extract(t),a=Es({config:o,api:r}),c=xt.join(ze.get(ze.PublicUrlBase)??"",`/v1/tiles/${e.name}/${i.identifier}/{z}/{x}/{y}.${n}${a}`),d=`basemaps-${e.name}`,p={version:8,sources:{[d]:{type:"raster",tiles:[c],tileSize:256}},layers:[{id:d,type:"raster",source:d}]},m=Buffer.from(JSON.stringify(p)),S=Ne.key(m);if(Ne.isNotModified(t,S))return ot();let R=new J(200,"ok");return R.header(re.ETag,S),R.header(re.CacheControl,"no-store"),R.buffer(m,"application/json"),t.set("bytes",m.byteLength),R}async function Td(t){let e=at.apiKey(t),r=t.params.styleName,i=await Be.load(t),n=i.Style.id(r),o=await i.Style.get(n);if(o==null){let m=await i.TileSet.get(i.TileSet.id(r));return m==null?ce():m.type!==rt.Raster?ce():WS(t,m,e)}let a=HS(o.style,e,Be.extract(t)),c=Buffer.from(JSON.stringify(a)),d=Ne.key(c);if(Ne.isNotModified(t,d))return ot();let p=new J(200,"ok");return p.header(re.ETag,d),p.header(re.CacheControl,"no-store"),p.buffer(c,"application/json"),t.set("bytes",c.byteLength),p}function qS(t,e){let r=ze.get(ze.PublicUrlBase)??"",i=`/v1/arcgis/rest/services/${t}/VectorTileServer`,n=new URL(gt.join(r,i));return n.searchParams.set("api",e),n.searchParams.set("f","json"),n.toString().replace(/%7B/g,"{").replace(/%7D/g,"}")}function GS(t,e,r){let i=JSON.parse(JSON.stringify(e.sources));for(let[o,a]of Object.entries(i))a.type==="vector"?(a.url=qS(t,r),i[o]=a):delete i[o];let n=[];for(let o of e.layers)o.source!=null&&!i.hasOwnProperty(o.source)||n.push(o);return{version:8,id:e.id,name:e.name,sources:i,layers:n,metadata:e.metadata??{},glyphs:Hi(e.glyphs),sprite:Hi(e.sprite)}}async function Ig(t){let e=at.apiKey(t),r=await Be.load(t),i=await r.TileSet.get(r.TileSet.id(t.params.tileSet));if(i?.type!==rt.Vector)return ce();let n=t.query.get("style"),o=n||"topographic",a=r.Style.id(o),c=await r.Style.get(a);if(c==null)return ce();let d=GS(i.name,c.style,e),p=Buffer.from(JSON.stringify(d)),m=Ne.key(p);if(Ne.isNotModified(t,m))return ot();let S=new J(200,"ok");return S.header(re.ETag,m),S.header(re.CacheControl,"no-store"),S.buffer(p,"application/json"),t.set("bytes",p.byteLength),S}var VS=18,KS=1;async function Og(t){let e=await Be.load(t),r=await e.TileSet.get(e.TileSet.id(t.params.tileSet));if(r?.type!==rt.Vector)return ce();let i=at.apiKey(t);if(t.query.get("f")!=="json")return ce();let o={xmin:Le.extent.x,ymin:Le.extent.y,xmax:Le.extent.right,ymax:Le.extent.bottom,spatialReference:{wkid:102100,latestWkid:Le.projection.code}},a={currentVersion:10.81,name:r.name,capabilities:"TilesOnly",type:"indexedVector",defaultStyles:"",tiles:[Hi(`/v1/tiles/${r.name}/WebMercatorQuad/{z}/{x}/{y}.pbf`,i)],exportTilesAllowed:!1,maxExportTilesCount:0,initialExtent:o,fullExtent:o,minScale:0,maxScale:0,tileInfo:{rows:512,cols:512,dpi:96,format:"pbf",origin:{x:Le.extent.x,y:Le.extent.bottom},spatialReference:{wkid:102100,latestWkid:Le.projection.code},lods:Le.zooms.slice(KS,VS).map((m,S)=>({level:S,resolution:m.scaleDenominator*28e-5,scale:m.scaleDenominator}))},maxzoom:22,minLOD:0,maxLOD:15,resourceInfo:{styleVersion:8,tileCompression:"gzip",cacheInfo:{storageInfo:{packetSize:128,storageFormat:"compactV2"}}}},c=JSON.stringify(a,null,2),d=Buffer.from(c),p=new J(200,"ok");return p.header(re.CacheControl,"no-store"),p.buffer(d,"application/json"),t.set("bytes",d.byteLength),p}var JS=1+1e-10,Lg=10**8;function Pd(t){return Math.round(t*Lg)/Lg}function ZS(t){return[Pd(t[0]),Pd(t[1])]}function YS(t,e,r){if(Tn.delta(t[0],t[2])<=0)return Tn.bboxToMultiPolygon(t);let i=[];for(let o of e){let a=[_e.fromJson(o).pad(JS).toPolygon()];i=p6(i,a)}return oc(i,o=>ZS(r.toWgs84(o)))}function XS(t){if(t!=null)return[{name:t.serviceProvider.name,url:t.serviceProvider.site,roles:["host"]}]}async function QS(t,e,r){let i=Wr.get(r),n=[],o=[],a=await Be.load(t),c=await ps(a,e.layers,[r.projection]),d=await a.Provider.get(a.Provider.id("linz"));for(let p of e.layers){let m=p[i.epsg.code];if(m==null)continue;let S=c.get(m);if(S==null)continue;let R=i.boundsToWgs84BoundingBox(S.bounds).map(Pd),x=A6(S.name);x[0]===-1&&(t.log.debug({imagery:S.name},"Attribution:DefaultYear"),x[0]=new Date().getUTCFullYear()+1,x[1]=x[0]+1);let w=[x.map(P=>`${P}-01-01T00:00:00Z`)],E={spatial:{bbox:[R]},temporal:{interval:w}};o.push({type:"Feature",stac_version:y1.Version,id:m+"_item",collection:m,assets:{},links:[],bbox:R,geometry:{type:"MultiPolygon",coordinates:YS(R,S.files,i)},properties:{title:S.title??ud(S.name),category:S.category,datetime:null,start_datetime:w[0][0],end_datetime:w[0][1]}});let T=At.convertZoomLevel(p.minZoom?p.minZoom:0,Le,r,!0),C=At.convertZoomLevel(p.maxZoom?p.maxZoom:32,Le,r,!0);n.push({stac_version:y1.Version,license:y1.License,id:S.id,providers:XS(d),title:S.title??ud(S.name),description:"No description",extent:E,links:[],summaries:{"linz:category":S.category,"linz:zoom":{min:T,max:C},"linz:priority":[1e3+e.layers.indexOf(p)]}})}return{id:e.id,type:"FeatureCollection",stac_version:y1.Version,stac_extensions:["single-file-stac"],title:e.title??"No title",description:e.description??"No Description",features:o,collections:n,links:[]}}async function Id(t){let e=at.getTileMatrixSet(t.params.tileMatrix);if(e==null)throw new J(404,"Tile Matrix not found");let r=await Be.load(t);t.timer.start("tileset:load");let i=await r.TileSet.get(r.TileSet.id(t.params.tileSet));if(t.timer.end("tileset:load"),i==null||i.type===rt.Vector)return ce();let n=Ne.key(i);if(Ne.isNotModified(t,n))return ot();t.timer.start("stac:load");let o=await QS(t,i,e);if(t.timer.end("stac:load"),o==null)return ce();let a=new J(200,"ok");return a.header(re.ETag,n),a.header(re.CacheControl,"public, max-age=604800, stale-while-revalidate=86400"),a.json(o),a}async function kg(t,e){let r=Buffer.from(JSON.stringify(e)),i=Ne.key(r);if(Ne.isNotModified(t,i))return ot();let n=new J(200,"ok");return n.header(re.ETag,i),n.header(re.CacheControl,"no-store"),n.buffer(r,"application/json"),t.set("bytes",r.byteLength),n}async function Ng(t){let e=await Be.load(t);t.timer.start("tileset:load");let r=await e.TileSet.get(e.TileSet.id(t.params.tileSet));return t.timer.end("tileset:load"),r==null?ce():kg(t,r)}async function Bg(t){let e=await Be.load(t);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)return ce();t.timer.start("imagery:load");let i=await e.Imagery.get(e.Imagery.id(t.params.imageryId));if(t.timer.end("imagery:load"),i==null){let n=r.layers.find(c=>c.name===t.params.imageryId||oi(c.name)===t.params.imageryId);if(n==null)return ce();let o=Ur.find(t.query.get("tileMatrix")??Le.identifier);if(o==null)return ce();let a=n[o.projection.code];if(a==null)return ce();t.timer.start("imagery:load:sub"),i=await e.Imagery.get(e.Imagery.id(a)),t.timer.end("imagery:load:sub")}return i==null?ce():kg(t,i)}var Yg=me(require("path"),1);var Pr;(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"})(Pr||(Pr={}));var Od={1:Pr.NONE,5:Pr.LZW,6:Pr.JPEG,7:Pr.JPEG,8:Pr.DEFLATE,34712:Pr.JP2,50001:Pr.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 F1;(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"})(F1||(F1={}));var Ce;(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"})(Ce||(Ce={}));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 Dg=2**32,eM=typeof setImmediate>"u"?setTimeout:setImmediate,Ft=()=>{throw new Error("Method not implemented.")},mi=class{constructor(){this.isLittleEndian=!0,this.delayMs=mi.DefaultDelayMs,this.maxChunkCount=10,this.chunks=mi.DefaultChunkCache(),this.blankFillCount=16,this.maxConcurrentRequests=50,this.toFetch=new Set,this.toFetchPromise=null,this.byteOffset=0,this.getFloat32=Ft,this.getFloat64=Ft,this.getInt8=Ft,this.getInt16=Ft,this.getInt32=Ft,this.setFloat32=Ft,this.setFloat64=Ft,this.setInt8=Ft,this.setInt16=Ft,this.setInt32=Ft,this.setUint8=Ft,this.setUint16=Ft,this.setUint32=Ft,this.setBigInt64=Ft,this.setBigUint64=Ft}static getByteRanges(e,r=32,i=16){if(e.size===0)return{chunks:[],blankFill:[]};let n=[...e.values()].sort((d,p)=>d-p),o=[],a=[];o.push(a);let c=[];for(let d=0;d<n.length;++d){let p=n[d],m=n[d-1];if(a.length>=r)a=[p],o.push(a);else if(d===0||p===m+1)a.push(p);else if(p<m+i){for(let S=m;S<p;S++)a.push(S+1),c.push(S+1);c.pop()}else a=[p],o.push(a)}return{chunks:o,blankFill:c}}async fetchData(){if(this.toFetch.size===0)return;let e=this.toFetch;this.toFetch=new Set,this.toFetchPromise=null;let r=mi.getByteRanges(e,this.maxChunkCount,this.blankFillCount),i=[];for(let n of r.chunks){let o=n[0],a=n[n.length-1],c=o*this.chunkSize,d=a*this.chunkSize+this.chunkSize-c,p=await this.fetchBytes(c,d);if(n.length===1){i[o]=p,this.chunks.set(o,new DataView(p));continue}let m=o*this.chunkSize;for(let S of n){let R=S*this.chunkSize-m,x=p.slice(R,R+this.chunkSize);i[S]=x,this.chunks.set(S,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=>eM(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 p=this.getView(i),m=e-i*this.chunkSize;return new Uint8Array(p.buffer.slice(m,m+r))}let n=new Uint8Array(r),o=e+r,a=Math.floor(e/this.chunkSize),c=Math.ceil((e+r)/this.chunkSize)-1,d=0;for(let p=a;p<=c;p++){let m=e+d,S=p*this.chunkSize,R=this.getView(p),x=Math.min(o,S+this.chunkSize),w=R.buffer.slice(m-S,x-S);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*Dg:i*Dg+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.")}};mi.DefaultChunkCache=()=>new Map;mi.DefaultDelayMs=1;var zg=me(kd(),1);function jg(t){switch(t){case Ce.BYTE:case Ce.ASCII:case Ce.SBYTE:case Ce.UNDEFINED:return 1;case Ce.SHORT:case Ce.SSHORT:return 2;case Ce.LONG:case Ce.SLONG:case Ce.FLOAT:return 4;case Ce.RATIONAL:case Ce.SRATIONAL:case Ce.DOUBLE:case Ce.LONG8:case Ce.SLONG8:case Ce.IFD8:return 8;default:throw new Error(`Invalid fieldType ${t}`)}}var Ps={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)=>zg.read(t.bytes(e,ve.Double),0,t.isLittleEndian,52,8),rational:(t,e)=>[t.getUint32(e),t.getUint32(e+4)]};function wc(t){switch(t){case Ce.ASCII:return Ps.char;case Ce.BYTE:case Ce.UNDEFINED:case Ce.SBYTE:return Ps.uint8;case Ce.SHORT:case Ce.SSHORT:return Ps.uint16;case Ce.LONG:case Ce.SLONG:return Ps.uint32;case Ce.RATIONAL:case Ce.SRATIONAL:return Ps.rational;case Ce.DOUBLE:return Ps.double;case Ce.LONG8:return Ps.uint64;default:throw new Error(`Unknown read type "${t}" "${Ce[t]}"`)}}var On=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=jg(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 Ce[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=wc(this.dataType),n=this.dataCount,o=n*r;if(n===1)return i(this.tiff.source,e);let a=[];for(let c=0;c<o;c+=r)a.push(i(this.tiff.source,e+c));return this.dataType===Ce.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 Is=class extends On{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 H1=class extends On{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=wc(this.dataType);return this.tiff.source.hasBytes(i,r)||await this.tiff.source.loadBytes(i,r),n(this.tiff.source,i)}};var W1=class extends On{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 _c={create(t,e){let r=t.source.getUint16(e);if(r===ae.TileOffsets||r===ae.TileByteCounts||r===ae.StripByteCounts||r===ae.StripOffsets)return new H1(r,t,e);let i=new W1(r,t,e);return i.hasBytes?i:new Is(r,t,e)},isStatic(t){return t instanceof W1},isLazy(t){return t instanceof Is},isOffsetArray(t){return t instanceof H1}};var tM=32767,xc=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 Is&&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 c=this.tags.get(o);if(c==null||c.value==null)continue;let d=r[i+2];Array.isArray(c.value)?this.tagsGeo.set(n,c.value[a+d-1]):typeof c.value=="string"&&this.tagsGeo.set(n,c.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:_c.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,c=i.size,d=this.size;return[n*c.width/d.width,o*c.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,c=o+i[1]*e.height;return[Math.min(n,a),Math.min(o,c),Math.max(n,a),Math.max(o,c)]}get compression(){let e=this.value(ae.Compression);return e==null||typeof e!="number"?null:Od[e]}get epsg(){let e=this.valueGeo(F1.ProjectedCSTypeGeoKey);return e===tM?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,c=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:c,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===Pr.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),c=Math.ceil(n.width/o.width);if(e>=c||r>=a)throw new Error(`Tile index is outside of range x:${e} >= ${c} or y:${r} >= ${a}`);let d=r*c+e,p=c*a;if(d>=p)throw new Error(`Tile index is outside of tile range: ${d} >= ${p}`);let{offset:m,imageSize:S}=await this.getTileSize(d);return this.getBytes(m,S)}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 q1;(function(t){t[t.Big=19789]="Big",t[t.Little=18761]="Little"})(q1||(q1={}));var Ir;(function(t){t[t.BigTiff=43]="BigTiff",t[t.Tiff=42]="Tiff"})(Ir||(Ir={}));var Nd="__reverse";function Ug(t,e){if(t[Nd]==null){let r={};for(let i of Object.keys(t)){let n=t[i];r[n]=i}Object.defineProperty(t,Nd,{enumerable:!1,value:r,writable:!1})}return t[Nd][e]}var Ln;(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"})(Ln||(Ln={}));var Bd;(function(t){t.RowMajor="ROW_MAJOR"})(Bd||(Bd={}));var Dd;(function(t){t.uint32="SIZE_AS_UINT4"})(Dd||(Dd={}));var rM={uint32:ve.UInt32},Sc=class{constructor(){this.options=new Map}get isCogOptimized(){return this.isBroken?!1:this.options.get(Ln.LAYOUT)==="IFDS_BEFORE_DATA"}get isBroken(){return this.options.get(Ln.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 c=e.getUint8(a);c!==0&&n.push(String.fromCharCode(c))}let o=n.join("").trim().split(`
|
|
184
|
+
`).map(a=>a.split("="));for(let[a,c]of o)this.options.set(Ln[a],c)}_getReverse(e,r){let i=this.options.get(r);return i==null?null:Ug(e,i)}get tileOrder(){return this._getReverse(Bd,Ln.BLOCK_ORDER)}get tileLeader(){return this._getReverse(Dd,Ln.BLOCK_LEADER)}get tileLeaderByteSize(){return this.tileLeader==null?null:rM[this.tileLeader]}get isMaskInterleaved(){return this.options.get(Ln.MASK_INTERLEAVED_WITH_IMAGERY)==="YES"}};var zd={version:Ir.Tiff,pointer:ve.UInt32,offset:ve.UInt16,ifd:ve.UInt16+ve.UInt16+2*ve.UInt32},jd={version:Ir.BigTiff,pointer:ve.UInt64,offset:ve.UInt64,ifd:ve.UInt16+ve.UInt16+2*ve.UInt64},SN={[Ir.BigTiff]:jd,[Ir.Tiff]:zd};var Ud=me(kd(),1),Mc=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 Ud.read(this.bytes(ve.Float),0,this.tiff.source.isLittleEndian,23,4)}double(){return Ud.read(this.bytes(ve.Double),0,this.tiff.source.isLittleEndian,52,8)}};function $g(t,e=4,r=!0){let i=t.toString(16).padStart(e,"0");return r?"0x"+i:i}var ga=class{constructor(e){this.version=Ir.Tiff,this.images=[],this.options=new Sc,this.ifdConfig=zd,this.isInitialized=!1,this.source=e,this.cursor=new Mc(this)}static create(e){return new ga(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===q1.Little,!this.source.isLittleEndian)throw new Error("Only little endian is supported");this.version=e.uint16();let i;if(this.version===Ir.BigTiff){if(this.ifdConfig=jd,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===Ir.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 c=this.images[a],d=c.size;if(o/d.width-e<=.01)return c}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 p=0;p<i;p++){let m=_c.create(this,a);if(a+=m.size,m.name==null)throw new Error("Unknown IFD Tag: "+$g(m.id));o.set(m.id,m)}let c=new xc(this,this.images.length,o);return{nextOffset:this.source.getUint(a,this.ifdConfig.pointer),image:c}}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 je=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 $d(this,e)}},$d=class extends je{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 Ec=class extends je{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}},Rc=class extends je{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 Fg=[];for(let t=0;t<64;t++)Fg[t]=Math.pow(2,t);var G1=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+=Fg[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 Cc=class extends je{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 G1(e,i,i+this.size);for(let{key:a,bits:c}of this.fields)n[a]=o.bits(c);return r.offset+=this.size,n}},Ac=class extends je{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 c=(i&a)===a;c&&(n[o]=c)}return n}};var Tc=class extends je{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 Fd=class extends je{constructor(){super(...arguments),this.size=1}parse(e,r){let i=r.offset;return r.offset+=this.size,e[i]}},Hd=class extends je{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}},Wd=class extends je{constructor(){super(...arguments),this.size=4}parse(e,r){let i=r.offset,n=e[i++],o=e[i++]<<8,a=e[i++]<<16,c=e[i++]*16777216;return r.offset=i,(n|o|a)+c}},iM=2**32,qd=class extends je{constructor(){super(...arguments),this.size=8}parse(e,r){let i=ya.parse(e,r),n=ya.parse(e,r);return i+n*iM}},Gd=class extends je{constructor(){super(...arguments),this.size=8}parse(e,r){let i=BigInt(ya.parse(e,r)),n=BigInt(ya.parse(e,r));return i+(n<<BigInt(32))}},Hg=new Fd("UInt8"),Wg=new Hd("LUInt16"),ya=new Wd("LUInt32"),qg=new qd("LUInt64"),Gg=new Gd("BigLUInt64");var Pc=class extends je{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}}},Ic=class extends je{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 ba=class extends je{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}},Oc=class extends je{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 fa(t,e=2){return"0x"+t.toString(16).padStart(e,"0")}var Mh=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 ${fa(i)}`);return this.type.parse(e,{offset:i,startOffset:i})}};var Eh=class extends Le{constructor(e){super("Skip:"+e),this.size=e}parse(e,r){r.offset+=this.size}};var Rh=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("")}},Ch=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: ${fa(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 IS(t,e,r,i){return typeof r=="number"?new gh(t,e,r):new yh(t,e,r,i??!1)}var hr={u8:S4,lu16:M4,lu32:ha,lu64:E4,blu64:R4,empty:new ca("Empty",{}),offset(t,e){return new Mh(t,e)},string(t){return t==null?new Rh:new Ch(t)},bits(t,e){return new bh(t,e)},flags(t,e,r){return new vh(t,e,r)},object(t,e){return new Sh(t,e)},static(t,e){return new ca(t,e)},lookup(t,e,r){return new _h(t,e,r)},enum(t,e,r){return new xh(t,e,r)},bytes(t){return new wh(t)},skip(t){return new Eh(t)},array:IS};var C4;(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"})(C4||(C4={}));var OS=hr.object("TarHeader",{path:hr.string(100),skip1:hr.skip(24),size:hr.bytes(12).refine(t=>parseInt(t.toString(),8)),skip2:hr.skip(20),type:hr.u8,linkName:hr.string(100)});var A4={32:16777619n,64:1099511628211n,128:309485009821345068724781371n,256:374144419156711147060143317175368453031918731002211n,512:35835915874844867368919076489095108449946327955754392558399825615420669938882575126094039892345713852759n,1024:5016456510113118655434598811035278955030765345404790744303017523831112055108147451509157692220295382716162651878526895249385292291816524375083746691371804094271873160484737966720260389217684476157468082573n},kS={32:2166136261n,64:14695981039346656037n,128:144066263297769815596495629667062367629n,256:100029257958052580907070968620625704837092796014241193945225284501741471925557n,512:9659303129496669498009435400716310466090418745672637896108374329434462657994582932197716438449813051892206539805784495328239340083876191928701583869517785n,1024:14197795064947621068722070641403218320880622795441933960878474914617582723252296732303717722150864096521202355549365628174669108571814760471015076148029755969804077320157692458563003215304957150157403644460363550505412711285966361610267868082893823963790439336411086884584107735010676915n};function kd(t,{size:e=32}={}){if(!A4[e])throw new Error("The `size` option must be one of 32, 64, 128, 256, 512, or 1024");let r=kS[e],i=A4[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 Ah="COT";var LS=BigInt(0),NS=BigInt(32),BS=BigInt(2**32-1),T4=hr.object("CotarMetadata",{magic:hr.string(Ah.length),version:hr.u8,count:hr.lu32}),$r=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 T4.read(o).value}let n=await e.fetchBytes(-8);return T4.read(new Uint8Array(n)).value}static async getMetadata(e,r,i){let n=await this.loadMetadata(e,r,i);if(n.magic!==Ah)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 $r(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=$r.hash(e),i=this.metadata.count,n=Number(r%BigInt(i)),o=Number(r>>NS),a=Number(r&BS),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=$r.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===LS||(a++,a>=i&&(a=0),a===n))return null}}};var IN=BigInt(0);var Rs=class{constructor(e,r){this.source=e,this.index=r}static async fromTar(e){let r=await $r.getMetadata(e,0,!1),i=await e.size,n=r.version===1?24:16,o=i-(r.count*n+16),a=new $r(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 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=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 Ld;var Ph=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 Ph(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=Qt.source(e);An.trace(i);let n=ua.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=Qt.source(e);An.trace(i);let n=Rs.fromTar(i);return this.cache.set(e,new Ih({type:"cotar",value:n})),n}},zt=new Nd(700*1e3*1e3);function da(t){return t[0]===31&&t[1]===139}var Bd=class{set(e){this.path=e}async get(e){if(this.path==null)return null;if(this.path.endsWith(".tar.co"))return await this.getFromCotar(this.path,e);try{let r=wt.join(this.path,e);return await wt.read(r)}catch(r){if(r.code===404)return null;throw r}}async getFromCotar(e,r){let n=await(await zt.getCotar(e)).get(r);return n&&Buffer.from(n)}async serve(e,r,i){let n=await Tn.get(r);if(n==null)return ve();let o=Ve.key(n);if(Ve.isNotModified(e,o))return ft();let a=Y.ok().buffer(n,i);return a.header(re.ETag,o),a.header(re.CacheControl,"public, max-age=604800, stale-while-revalidate=86400"),da(n)&&a.header(re.ContentEncoding,"gzip"),a}},Tn=new Bd;async function O4(t){let e=I4.default.join("fonts",t.params.fontStack,t.params.range)+".pbf";return Tn.serve(t,e,"application/x-protobuf")}async function k4(t){return Tn.serve(t,"fonts.json","application/json")}var $d=me(require("fs"),1),Bh=me(require("path"),1),$4=me(j4(),1),Fd=me(require("sharp"),1),F4=me(require("url"),1);var Lh=me(require("sharp"),1);function jS(t){return t!=null}var kh=new Map,Pn=class{constructor(e){this.tileSize=e}isTooLarge(e){return!!(e.resize&&(e.resize.width>=Pn.MaxImageSize||e.resize.height>=Pn.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 Ge.Jpeg:return r.jpeg().toBuffer();case Ge.Png:return r.png().toBuffer();case Ge.Webp:return r.webp().toBuffer();case Ge.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(jS));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}})}};Pn.MaxImageSize=256*2**15;var jd=class{constructor(e){Wc(this,"value");Wc(this,"next");this.value=e}},fi,As,Ts,j1=class{constructor(){vt(this,fi,void 0);vt(this,As,void 0);vt(this,Ts,void 0);this.clear()}enqueue(e){let r=new jd(e);Ee(this,fi)?(Ee(this,As).next=r,Xe(this,As,r)):(Xe(this,fi,r),Xe(this,As,r)),Hc(this,Ts)._++}dequeue(){let e=Ee(this,fi);if(!!e)return Xe(this,fi,Ee(this,fi).next),Hc(this,Ts)._--,e.value}clear(){Xe(this,fi,void 0),Xe(this,As,void 0),Xe(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 qd(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 j1,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 qS=qd(Qe.getNumber(Qe.TiffConcurrency,25));function $S(t){let e=t.toLowerCase();return e.endsWith(".tif")||e.endsWith(".tiff")?t:`${t}.tiff`}var FS=new Pn(256),WS={in:"lanczos3",out:"lanczos3"},HS={r:0,g:0,b:0,alpha:0},Nh={async getTiffsForTile(t,e,r){let i=await ce.getAllImagery(e.layers,[r.tileMatrix.projection]),n=[],o=r.tileMatrix.tileToSourceBounds(r.tile),a=Mt.convertZoomLevel(r.tile.z,r.tileMatrix,Yn.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=Qt.join(m.uri,$S(p.name));n.push(M)}}return n},async tile(t,e,r){if(r.tileType===nr.MapboxVectorTiles)return ve();let i=await this.getTiffsForTile(t,e,r),n=Ve.key(i);if(Ve.isNotModified(t,n))return ft();let o=[];for(let M of i)o.push(qS(()=>zt.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 la(r.tileMatrix).tile(a,r.tile.x,r.tile.y,r.tile.z),m=await FS.compose({layers:d,format:r.tileType,background:e.background??HS,resizeKernel:e.resizeKernel??WS,metrics:t.timer});t.set("layersUsed",m.layers),t.set("bytes",m.buffer.byteLength);let p=new Y(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 KS={},GS=[{tileSet:"health",tileMatrix:je,tileType:Ge.Png,tile:{x:252,y:156,z:8}},{tileSet:"health",tileMatrix:on,tileType:Ge.Png,tile:{x:30,y:33,z:6}}],q4=256;async function VS(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(F4.default.fileURLToPath(KS.url)),"..","..",r);return await $d.promises.readFile(n)}}async function Wd(t){let e=await ce.TileSet.get(ce.TileSet.id("health"));if(e==null)throw new Y(500,'TileSet: "health" not found');for(let i of GS){let n=await Nh.tile(t,e,i);if(n.status!==200)return new Y(500,n.statusDescription);if(!Buffer.isBuffer(n._body))throw new Y(500,"Not a Buffer response content.");let o=await(0,Fd.default)(n._body).raw().toBuffer(),a=await VS(i);i.buf=a;let h=await(0,Fd.default)(a).raw().toBuffer(),d=Buffer.alloc(h.length),m=(0,$4.default)(h,o,d,q4,q4);if(m)return t.log.error({missMatchedPixels:m,projection:i.tileMatrix.identifier,xyz:i.tile},"Health:MissMatch"),new Y(500,"TileSet does not match.")}let r=new Y(200,"ok");return r.header(re.CacheControl,"no-store"),r}var W4=require("util"),H4=require("zlib");var JS=(0,W4.promisify)(H4.gzip);function ZS(t){return t==null?!1:!!(t.endsWith(".geojson")||t.endsWith(".json"))}async function G4(t){let e=t.params.fileName;if(!ZS(e))return ve();let r=await ce.Imagery.get(ce.Imagery.id(t.params.imageryId));if(r==null)return ve();let i=Qt.join(r.uri,e);try{let n=await Qt.read(i),o=Ve.key(n);if(Ve.isNotModified(t,o))return ft();let a=new Y(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(da(n)?n:await JS(n),"application/json"),t.set("bytes",n.byteLength),a}catch{return t.log.warn({targetPath:i},"ImageryMetadata:Failed"),ve()}}var V4=new Y(200,"ok");V4.header(re.CacheControl,"no-store");async function Hd(){return V4}var K4=me(require("path"),1);var Gd=new Map;Gd.set(".png","image/png");Gd.set(".json","application/json");async function J4(t){let e=K4.default.extname(t.params.spriteName),r=Gd.get(e);if(r==null)return ve();let i=wt.join("sprites",t.params.spriteName);return Tn.serve(t,i,r)}async function Z4(t){let e=ot.getTileMatrixSet(t.params.tileMatrix);if(e==null)return ve();let r=ot.apiKey(t);t.timer.start("tileset:load");let i=await ce.TileSet.get(ce.TileSet.id(t.params.tileSet));if(t.timer.end("tileset:load"),i==null)return ve();let n=ot.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,je,e,!0),m=Mt.convertZoomLevel(i.minZoom??0,je,e,!0);i.maxZoom&&(h.maxzoom=d),i.minZoom&&(h.minzoom=m);let p=JSON.stringify(h),M=Buffer.from(p),R=new Y(200,"ok");return R.header(re.CacheControl,"no-store"),R.buffer(M,"application/json"),t.set("bytes",M.byteLength),R}var tg=require("crypto");var YS={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 Y4(t,e){return jr.get(t).boundsToWgs84BoundingBox(e)}var X4=6,Q4=4;function eg(t,e){return Number(t.toFixed(e)).toString()}function Dh(t,e,r){return`${eg(t,r)} ${eg(e,r)}`}var zh=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??f4,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 ce.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=Y4(e,n.toJson())}else i=Y4(e,e.extent);return i[2]<i[0]&&(i[0]=-180,i[2]=180),Q("ows:WGS84BoundingBox",{crs:"urn:ogc:def:crs:OGC:2:84"},[Q("ows:LowerCorner",Dh(i[0],i[1],X4)),Q("ows:UpperCorner",Dh(i[2],i[3],X4))])}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 Q("ows:BoundingBox",{crs:e.projection.toUrn()},[Q("ows:LowerCorner",Dh(n[e.indexX],n[e.indexY],Q4)),Q("ows:UpperCorner",Dh(n[e.indexX+2],n[e.indexY+2],Q4))])}buildProvider(){if(this.provider==null)return[];let{serviceIdentification:e,serviceProvider:r}=this.provider,{contact:i}=r;return[Q("ows:ServiceIdentification",[Q("ows:Title",e.title),Q("ows:Abstract",e.description),Q("ows:ServiceType","OGC WMTS"),Q("ows:ServiceTypeVersion","1.0.0"),Q("ows:Fees",e.fees),Q("ows:AccessConstraints",e.accessConstraints)]),Q("ows:ServiceProvider",[Q("ows:ProviderName",r.name),Q("ows:ProviderSite",{"xlink:href":r.site}),Q("ows:ServiceContact",[Q("ows:IndividualName",i.individualName),Q("ows:PositionName",i.position),Q("ows:ContactInfo",[Q("ows:Phone",[Q("ows:Voice",i.phone)]),Q("ows:Address",[Q("ows:DeliveryPoint",i.address.deliveryPoint),Q("ows:City",i.address.city),Q("ows:PostalCode",i.address.postalCode),Q("ows:Country",i.address.country),Q("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 Q("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(Q("TileMatrixSetLink",[Q("TileMatrixSet",d.identifier)])),r.add(d))}let n=vo(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:Q("Layer",[Q("ows:Title",e.title??n),Q("ows:Abstract",""),Q("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=>Q("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(Q("TileMatrixSetLink",[Q("TileMatrixSet",m.identifier)])),r.add(m));let n=vo(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===je.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 Q("Layer",[Q("ows:Title",e.title??n),Q("ows:Abstract",e.description??""),Q("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=>Q("Format","image/"+m)),...i,...this.formats.map(m=>this.buildResourceUrl(n,m))])}buildKeywords(e){return e.category==null?Q("ows:Keywords"):Q("ows:Keywords",[Q("ows:Keyword",e.category)])}buildStyle(){return Q("Style",{isDefault:"true"},[Q("ows:Title","Default Style"),Q("ows:Identifier","default")])}buildTileMatrixSet(e){return Q("TileMatrixSet",[Q("ows:Title",e.def.title),e.def.abstract?Q("ows:Abstract",e.def.abstract):null,Q("ows:Identifier",e.identifier),Q("ows:SupportedCRS",e.projection.toUrn()),e.def.wellKnownScaleSet?Q("WellKnownScaleSet",e.def.wellKnownScaleSet):null,...e.def.tileMatrix.map(r=>Q("TileMatrix",[Q("ows:Identifier",r.identifier),Q("ScaleDenominator",r.scaleDenominator),Q("TopLeftCorner",r.topLeftCorner.join(" ")),Q("TileWidth",r.tileWidth),Q("TileHeight",r.tileHeight),Q("MatrixWidth",r.matrixWidth),Q("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(vo(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 Q("Capabilities",YS,[...this.buildProvider(),Q("Contents",e)])}toXml(){return`<?xml version="1.0" encoding="utf-8"?>
|
|
187
|
-
`+this.toVNode().toString()}};function
|
|
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 va(t,e=2){return"0x"+t.toString(16).padStart(e,"0")}var Lc=class extends je{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 ${va(i)}`);return this.type.parse(e,{offset:i,startOffset:i})}};var kc=class extends je{constructor(e){super("Skip:"+e),this.size=e}parse(e,r){r.offset+=this.size}};var Nc=class extends je{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("")}},Bc=class extends je{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: ${va(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 nM(t,e,r,i){return typeof r=="number"?new Ec(t,e,r):new Rc(t,e,r,i??!1)}var hr={u8:Hg,lu16:Wg,lu32:ya,lu64:qg,blu64:Gg,empty:new ba("Empty",{}),offset(t,e){return new Lc(t,e)},string(t){return t==null?new Nc:new Bc(t)},bits(t,e){return new Cc(t,e)},flags(t,e,r){return new Ac(t,e,r)},object(t,e){return new Oc(t,e)},static(t,e){return new ba(t,e)},lookup(t,e,r){return new Pc(t,e,r)},enum(t,e,r){return new Ic(t,e,r)},bytes(t){return new Tc(t)},skip(t){return new kc(t)},array:nM};var Vg;(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"})(Vg||(Vg={}));var sM=hr.object("TarHeader",{path:hr.string(100),skip1:hr.skip(24),size:hr.bytes(12).refine(t=>parseInt(t.toString(),8)),skip2:hr.skip(20),type:hr.u8,linkName:hr.string(100)});var Kg={32:16777619n,64:1099511628211n,128:309485009821345068724781371n,256:374144419156711147060143317175368453031918731002211n,512:35835915874844867368919076489095108449946327955754392558399825615420669938882575126094039892345713852759n,1024:5016456510113118655434598811035278955030765345404790744303017523831112055108147451509157692220295382716162651878526895249385292291816524375083746691371804094271873160484737966720260389217684476157468082573n},oM={32:2166136261n,64:14695981039346656037n,128:144066263297769815596495629667062367629n,256:100029257958052580907070968620625704837092796014241193945225284501741471925557n,512:9659303129496669498009435400716310466090418745672637896108374329434462657994582932197716438449813051892206539805784495328239340083876191928701583869517785n,1024:14197795064947621068722070641403218320880622795441933960878474914617582723252296732303717722150864096521202355549365628174669108571814760471015076148029755969804077320157692458563003215304957150157403644460363550505412711285966361610267868082893823963790439336411086884584107735010676915n};function Vd(t,{size:e=32}={}){if(!Kg[e])throw new Error("The `size` option must be one of 32, 64, 128, 256, 512, or 1024");let r=oM[e],i=Kg[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 Dc="COT";var aM=BigInt(0),lM=BigInt(32),uM=BigInt(2**32-1),Jg=hr.object("CotarMetadata",{magic:hr.string(Dc.length),version:hr.u8,count:hr.lu32}),qr=class{constructor(e,r,i=0){this.isHeader=!0,this.source=e,this.sourceOffset=i,this.metadata=r}static hash(e){return Vd(e,{size:64})}static async loadMetadata(e,r,i){if(i){await e.loadBytes(r,e.chunkSize);let o=e.bytes(r,8);return Jg.read(o).value}let n=await e.fetchBytes(-8);return Jg.read(new Uint8Array(n)).value}static async getMetadata(e,r,i){let n=await this.loadMetadata(e,r,i);if(n.magic!==Dc)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>>lM),a=Number(r&uM),c=null,d=null,p=n;for(;;){let m=this.sourceOffset+p*16+8;if(await this.source.loadBytes(m,16),d=this.source.getUint32(m),c=this.source.getUint32(m+4),c===o&&d===a){let S=this.source.getUint32(m+8)*512,R=this.source.getUint32(m+12);return{offset:S,size:R}}if(c===0&&d===0||(p++,p>=i&&(p=0),p===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 c=this.sourceOffset+a*24+8;if(await this.source.loadBytes(c,24),o=this.source.getBigUint64(c),o===r){let d=this.source.getUint64(c+8),p=this.source.getUint64(c+16);return{offset:d,size:p}}if(o===aM||(a++,a>=i&&(a=0),a===n))return null}}};var qB=BigInt(0);var Os=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 Os(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=wn(`${o.source}:${o.offset}:${o.length}`);o.id=a,this.requests.push(o);let c=Date.now(),d=await r.apply(e,[i,n]);return o.duration=Date.now()-c,d}}},kn=new Kd;var jc=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}},Jd=class{constructor(e){this.cache=new pa(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=gt.source(e);kn.trace(i);let n=ga.create(i);return this.cache.set(e,new jc({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=gt.source(e);kn.trace(i);let n=Os.fromTar(i);return this.cache.set(e,new jc({type:"cotar",value:n})),n}},Ht=new Jd(700*1e3*1e3);function wa(t){return t[0]===31&&t[1]===139}var Zd=class{async get(e,r){if(e.endsWith(".tar.co"))return await this.getFromCotar(e,r);try{let i=xt.join(e,r);return await xt.read(i)}catch(i){if(i.code===404)return null;throw i}}async getFromCotar(e,r){let n=await(await Ht.getCotar(e)).get(r);return n&&Buffer.from(n)}async serve(e,r,i){let n=await Be.load(e),o=ze.get(ze.AssetLocation);if(n==null)return ce();if(n.assets!=null&&(o=n.assets),o==null)return ce();let a=await _a.get(o,r);if(a==null)return ce();let c=Ne.key(a);if(Ne.isNotModified(e,c))return ot();let d=J.ok().buffer(a,i);return d.header(re.ETag,c),d.header(re.CacheControl,"public, max-age=604800, stale-while-revalidate=86400"),wa(a)&&d.header(re.ContentEncoding,"gzip"),d}},_a=new Zd;async function Xg(t){let e=Yg.default.join("fonts",t.params.fontStack,t.params.range)+".pbf";return _a.serve(t,e,"application/x-protobuf")}async function Qg(t){return _a.serve(t,"fonts.json","application/json")}var r2=me(require("fs"),1),qc=me(require("path"),1),l4=me(o4(),1),i2=me(require("sharp"),1),u4=me(require("url"),1);var Hc=me(require("sharp"),1);var $c=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}};function dM(t){return t!=null}var Fc=new Map,Nn=class{constructor(e){this.tileSize=e}isTooLarge(e){return!!(e.resize&&(e.resize.width>=Nn.MaxImageSize||e.resize.height>=Nn.MaxImageSize))}getEmptyImage(e,r){let i=[e,r.r,r.g,r.b,r.alpha].join("-"),n=Fc.get(i);return n||(n=this.toImage(e,this.createImage(r)),Fc.size>128&&Fc.clear(),Fc.set(i,n),n)}toImage(e,r){switch(e){case ke.Jpeg:return r.jpeg().toBuffer();case ke.Png:return r.png().toBuffer();case ke.Webp:return r.webp().toBuffer();case ke.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 $c;if(i.start("compose:overlay"),this.isDirectImage(e)){let c=e.layers[0],d=await c.tiff.getTile(c.source.x,c.source.y,c.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 c of e.layers)this.isTooLarge(c)||n.push(this.composeTile(c,e.resizeKernel));let o=await Promise.all(n).then(c=>c.filter(dM));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,Hc.default)(Buffer.from(i.bytes)),{extract:o,resize:a,crop:c}=e;if(o&&n.extract({top:0,left:0,width:o.width,height:o.height}),a){let d={fit:Hc.default.fit.cover,kernel:a.scale>1?r.in:r.out};n.resize(a.width,a.height,d)}return c&&n.extract({top:c.y,left:c.x,width:c.width,height:c.height}),{input:await n.toBuffer(),top:e.y,left:e.x}}createImage(e){return(0,Hc.default)({create:{width:this.tileSize,height:this.tileSize,channels:4,background:e}})}};Nn.MaxImageSize=256*2**15;var e2=class{constructor(e){Qh(this,"value");Qh(this,"next");this.value=e}},pi,ks,Ns,J1=class{constructor(){_t(this,pi,void 0);_t(this,ks,void 0);_t(this,Ns,void 0);this.clear()}enqueue(e){let r=new e2(e);Me(this,pi)?(Me(this,ks).next=r,et(this,ks,r)):(et(this,pi,r),et(this,ks,r)),ef(this,Ns)._++}dequeue(){let e=Me(this,pi);if(!!e)return et(this,pi,Me(this,pi).next),ef(this,Ns)._--,e.value}clear(){et(this,pi,void 0),et(this,ks,void 0),et(this,Ns,0)}get size(){return Me(this,Ns)}*[Symbol.iterator](){let e=Me(this,pi);for(;e;)yield e.value,e=e.next}};pi=new WeakMap,ks=new WeakMap,Ns=new WeakMap;function t2(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 J1,r=0,i=()=>{r--,e.size>0&&e.dequeue()()},n=async(c,d,p)=>{r++;let m=(async()=>c(...p))();d(m);try{await m}catch{}i()},o=(c,d,p)=>{e.enqueue(n.bind(void 0,c,d,p)),(async()=>(await Promise.resolve(),r<t&&e.size>0&&e.dequeue()()))()},a=(c,...d)=>new Promise(p=>{o(c,p,d)});return Object.defineProperties(a,{activeCount:{get:()=>r},pendingCount:{get:()=>e.size},clearQueue:{value:()=>{e.clear()}}}),a}var mM=t2(ze.getNumber(ze.TiffConcurrency,25));function pM(t){let e=t.toLowerCase();return e.endsWith(".tif")||e.endsWith(".tiff")?t:`${t}.tiff`}var gM=new Nn(256),yM={in:"lanczos3",out:"lanczos3"},bM={r:0,g:0,b:0,alpha:0},Wc={async getTiffsForTile(t,e,r){let i=await Be.load(t),n=await ps(i,e.layers,[r.tileMatrix.projection]),o=[],a=r.tileMatrix.tileToSourceBounds(r.tile),c=At.convertZoomLevel(r.tile.z,r.tileMatrix,Ur.get(Ee.Google));for(let d of e.layers){if(d.maxZoom!=null&&c>d.maxZoom||d.minZoom!=null&&c<d.minZoom)continue;let p=d[r.tileMatrix.projection.code];if(p==null){t.log.warn({layer:d.name,projection:r.tileMatrix.projection.code},"Failed to lookup imagery");continue}let m=n.get(p);if(m==null){t.log.warn({layer:d.name,projection:r.tileMatrix.projection.code,imgId:p},"Failed to lookup imagery");continue}if(!!a.intersects(_e.fromJson(m.bounds)))for(let S of m.files){if(!a.intersects(_e.fromJson(S)))continue;let R=gt.join(m.uri,pM(S.name));o.push(R)}}return o},async tile(t,e,r){if(r.tileType===ar.MapboxVectorTiles)return ce();let i=await this.getTiffsForTile(t,e,r),n=Ne.key(i);if(Ne.isNotModified(t,n))return ot();let o=[];for(let S of i)o.push(mM(()=>Ht.getCog(S).catch(R=>(t.log.warn({error:R,tiff:S},"TiffLoadFailed"),null))));let a=(await Promise.all(o)).filter(S=>S!=null),d=await new ma(r.tileMatrix).tile(a,r.tile.x,r.tile.y,r.tile.z),p=await gM.compose({layers:d,format:r.tileType,background:e.background??bM,resizeKernel:e.resizeKernel??yM,metrics:t.timer});t.set("layersUsed",p.layers),t.set("bytes",p.buffer.byteLength);let m=new J(200,"ok");return m.header(re.ETag,n),m.header(re.CacheControl,"public, max-age=604800, stale-while-revalidate=86400"),m.buffer(p.buffer,"image/"+r.tileType),m}};var _M={},vM=[{tileSet:"health",tileMatrix:Le,tileType:ke.Png,tile:{x:252,y:156,z:8}},{tileSet:"health",tileMatrix:vn,tileType:ke.Png,tile:{x:30,y:33,z:6}}],a4=256;async function wM(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 r2.promises.readFile(r)}catch(i){if(i.code!=="ENOENT")throw i;let n=qc.join(qc.dirname(u4.default.fileURLToPath(_M.url)),"..","..",r);return await r2.promises.readFile(n)}}async function n2(t){let e=await Be.load(t),r=await e.TileSet.get(e.TileSet.id("health"));if(r==null)throw new J(500,'TileSet: "health" not found');for(let n of vM){let o=await Wc.tile(t,r,n);if(o.status!==200)return new J(500,o.statusDescription);if(!Buffer.isBuffer(o._body))throw new J(500,"Not a Buffer response content.");let a=await(0,i2.default)(o._body).raw().toBuffer(),c=await wM(n);n.buf=c;let d=await(0,i2.default)(c).raw().toBuffer(),p=Buffer.alloc(d.length),m=(0,l4.default)(d,a,p,a4,a4);if(m)return t.log.error({missMatchedPixels:m,projection:n.tileMatrix.identifier,xyz:n.tile},"Health:MissMatch"),new J(500,"TileSet does not match.")}let i=new J(200,"ok");return i.header(re.CacheControl,"no-store"),i}var c4=require("util"),h4=require("zlib");var xM=(0,c4.promisify)(h4.gzip);function SM(t){return t==null?!1:!!(t.endsWith(".geojson")||t.endsWith(".json"))}async function f4(t){let e=t.params.fileName;if(!SM(e))return ce();let r=await Be.load(t),i=await r.Imagery.get(r.Imagery.id(t.params.imageryId));if(i==null)return ce();let n=gt.join(i.uri,e);try{let o=await gt.read(n),a=Ne.key(o);if(Ne.isNotModified(t,a))return ot();let c=new J(200,"ok");return c.header(re.ETag,a),c.header(re.ContentEncoding,"gzip"),c.header(re.CacheControl,"public, max-age=604800, stale-while-revalidate=86400"),c.buffer(wa(o)?o:await xM(o),"application/json"),t.set("bytes",o.byteLength),c}catch{return t.log.warn({targetPath:n},"ImageryMetadata:Failed"),ce()}}var d4=new J(200,"ok");d4.header(re.CacheControl,"no-store");async function s2(){return d4}var m4=me(require("path"),1);var o2=new Map;o2.set(".png","image/png");o2.set(".json","application/json");async function p4(t){let e=m4.default.extname(t.params.spriteName),r=o2.get(e);if(r==null)return ce();let i=xt.join("sprites",t.params.spriteName);return _a.serve(t,i,r)}async function g4(t){let e=at.getTileMatrixSet(t.params.tileMatrix);if(e==null)return ce();let r=at.apiKey(t),i=await Be.load(t);t.timer.start("tileset:load");let n=await i.TileSet.get(i.TileSet.id(t.params.tileSet));if(t.timer.end("tileset:load"),n==null)return ce();let o=at.getRequestedFormats(t)??[n.format],a=ze.get(ze.PublicUrlBase)??"",c=Be.extract(t),d=Es({api:r,config:c}),m={tiles:[[a,"v1","tiles",n.name,e.identifier,"{z}","{x}","{y}"].join("/")+`.${o[0]}${d}`],tilejson:"3.0.0"},S=At.convertZoomLevel(n.maxZoom??30,Le,e,!0),R=At.convertZoomLevel(n.minZoom??0,Le,e,!0);n.maxZoom&&(m.maxzoom=S),n.minZoom&&(m.minzoom=R);let x=JSON.stringify(m),w=Buffer.from(x),E=new J(200,"ok");return E.header(re.CacheControl,"no-store"),E.buffer(w,"application/json"),t.set("bytes",w.byteLength),E}var _4=require("crypto");var MM={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 y4(t,e){return Wr.get(t).boundsToWgs84BoundingBox(e)}var b4=6,v4=4;function w4(t,e){return Number(t.toFixed(e)).toString()}function Gc(t,e,r){return`${w4(t,r)} ${w4(e,r)}`}var Vc=class{constructor(e){this.tileMatrixSets=new Map;this.isIndividualLayers=!1;this.httpBase=e.httpBase,this.provider=e.provider,this.tileSet=e.tileSet,this.config=e.config,this.isIndividualLayers=e.isIndividualLayers;for(let r of e.tileMatrix)this.tileMatrixSets.set(r.identifier,r);this.apiKey=e.apiKey,this.formats=e.formats??Ag,this.imagery=e.imagery}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=y4(e,n.toJson())}else i=y4(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",Gc(i[0],i[1],b4)),X("ows:UpperCorner",Gc(i[2],i[3],b4))])}buildBoundingBoxFromImagery(e,r){let i;for(let o of r){let a=o[e.projection.code];if(a==null)continue;let c=this.imagery.get(a);c!=null&&(i==null?i=_e.fromJson(c.bounds):i=i.union(_e.fromJson(c.bounds)))}if(i==null)return null;let n=i.toBbox();return X("ows:BoundingBox",{crs:e.projection.toUrn()},[X("ows:LowerCorner",Gc(n[e.indexX],n[e.indexY],v4)),X("ows:UpperCorner",Gc(n[e.indexX+2],n[e.indexY+2],v4))])}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=Es({api:this.apiKey,config:this.config});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 p=e[d.projection.code];p==null||this.imagery.get(p)==null||(i.push(X("TileMatrixSetLink",[X("TileMatrixSet",d.identifier)])),r.add(d))}let n=oi(e.name),o=[...r.values()],a=o[0];if(a==null)return null;let c=this.imagery.get(e[a.projection.code]??"");return c==null?null:X("Layer",[X("ows:Title",e.title??n),X("ows:Abstract",""),X("ows:Identifier",n),this.buildKeywords(c),...o.map(d=>this.buildBoundingBoxFromImagery(d,[e])),this.buildWgs84BoundingBox(a,[_e.fromJson(c.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 p of this.tileMatrixSets.values())e.layers.find(m=>m[p.projection.code]!=null)&&(i.push(X("TileMatrixSetLink",[X("TileMatrixSet",p.identifier)])),r.add(p));let n=oi(e.name),o=[...r.values()],a=o[0];if(a==null)throw new Error("No matrix sets found for layer "+e.name);let c=o.find(p=>p.identifier===Le.identifier)??a,d=[];for(let p of e.layers){let m=this.imagery.get(p[c.projection.code]??"");m!=null&&d.push(_e.fromJson(m.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(p=>this.buildBoundingBoxFromImagery(p,e.layers)),this.buildWgs84BoundingBox(c,d),this.buildStyle(),...this.formats.map(p=>X("Format","image/"+p)),...i,...this.formats.map(p=>this.buildResourceUrl(n,p))])}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(oi(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",MM,[...this.buildProvider(),X("Contents",e)])}toXml(){return`<?xml version="1.0" encoding="utf-8"?>
|
|
187
|
+
`+this.toVNode().toString()}};function EM(t){if(t==null)return[Le,vn];let e=at.getTileMatrixSet(t);return e==null?null:[e]}async function Kc(t){let e=at.apiKey(t),r=t.params.tileSet??"aerial",i=EM(t.params.tileMatrix);if(i==null)return ce();let n=ze.get(ze.PublicUrlBase)??"",o=await Be.load(t);t.timer.start("tileset:load");let a=await o.TileSet.get(o.TileSet.id(r??"aerial"));if(t.timer.end("tileset:load"),a==null||a.type!==rt.Raster)return ce();let c=await o.Provider.get(o.Provider.id("linz"));t.timer.start("imagery:load");let d=await ps(o,a.layers,i.map(x=>x.projection));t.timer.end("imagery:load");let p=new Vc({httpBase:n,provider:c??void 0,tileSet:a,tileMatrix:i,isIndividualLayers:t.params.tileMatrix==null,imagery:d,apiKey:e,config:Be.extract(t),formats:at.getRequestedFormats(t)}).toXml();if(p==null)return ce();let m=Buffer.from(p),S=(0,_4.createHash)("sha256").update(m).digest("base64");if(Ne.isNotModified(t,S))return ot();let R=new J(200,"ok");return R.header(re.ETag,S),R.header(re.CacheControl,"no-store"),R.buffer(m,"text/xml"),t.set("bytes",m.byteLength),R}var x4={async tile(t,e,r){if(r.tileType!==ar.MapboxVectorTiles)return ce();if(r.tileMatrix.identifier!==Le.identifier)return ce();if(e.layers.length>1)return new J(500,"Too many layers in tileset");let[i]=e.layers,n=i[3857];if(n==null)return new J(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`,c=`${n}#${a}`,d=Ne.key(c);if(Ne.isNotModified(t,d))return ot();t.timer.start("cotar:load");let p=await Ht.getCotar(n);if(p==null)return new J(500,"Failed to load VectorTiles");t.timer.end("cotar:load"),t.timer.start("cotar:tile");let m=await p.get(a);if(m==null)return Eg();t.timer.end("cotar:tile");let S=Buffer.from(m),R=J.ok().buffer(S,"application/x-protobuf");return R.header(re.ETag,d),R.header(re.CacheControl,"public, max-age=604800, stale-while-revalidate=86400"),wa(S)&&R.header(re.ContentEncoding,"gzip"),R}};async function S4(t){let e=at.xyz(t),r=await Be.load(t);t.timer.start("tileset:load");let i=await r.TileSet.get(r.TileSet.id(e.tileSet));if(t.timer.end("tileset:load"),i==null)return ce();switch(i.type){case rt.Vector:return x4.tile(t,i,e);case rt.Raster:return Wc.tile(t,i,e);default:return new J(400,"Invalid tileset")}}async function a2(){let t=new J(200,"ok");return t.header(re.CacheControl,"no-store"),t.json({version:"v6.35.0",hash:"dcebd7149ab318ea979b5d1ba34a9f82fc41b935"}),t}var Ue=$t.http(Co.get());Ue.router.timeoutEarlyMs=1e3;Ue.router.hook("request",t=>{t.set("name","LambdaTiler"),kn.reset()});Ue.router.hook("response",(t,e)=>{kn.requests.length>0&&(t.set("requests",kn.requests.slice(0,100)),t.set("requestCount",kn.requests.length)),t.set("sources",{hits:Ht.cache.hits,misses:Ht.cache.misses,size:Ht.cache.currentSize,resets:Ht.cache.resets,clears:Ht.cache.clears,cacheA:Ht.cache.cacheA.size,cacheB:Ht.cache.cacheB.size}),e.header("access-control-allow-origin","*")});Ue.router.options("*",t=>Ue.router.router.find("GET",t.path)==null?ce():J.ok());Ue.router.get("/ping",s2);Ue.router.get("/health",n2);Ue.router.get("/version",a2);Ue.router.get("/v1/ping",s2);Ue.router.get("/v1/health",n2);Ue.router.get("/v1/version",a2);Ue.router.get("/v1/imagery/:imageryId/:fileName",f4);Ue.router.get("/v1/config/:tileSet.json",Ng);Ue.router.get("/v1/config/:tileSet/:imageryId.json",Bg);Ue.router.get("/v1/sprites/:spriteName",p4);Ue.router.get("/v1/fonts.json",Qg);Ue.router.get("/v1/fonts/:fontStack/:range.pbf",Xg);Ue.router.get("/v1/styles/:styleName.json",Td);Ue.router.get("/v1/tiles/:tileSet/:tileMatrix/style/:styleName.json",Td);Ue.router.get("/v1/tiles/:tileSet/:tileMatrix/tile.json",g4);Ue.router.get("/v1/tiles/:tileSet/:tileMatrix/:z/:x/:y.:tileType",S4);Ue.router.get("/v1/tiles/:tileSet/:tileMatrix/attribution.json",Id);Ue.router.get("/v1/attribution/:tileSet/:tileMatrix/summary.json",Id);Ue.router.get("/v1/tiles/:tileSet/:tileMatrix/WMTSCapabilities.xml",Kc);Ue.router.get("/v1/tiles/:tileSet/WMTSCapabilities.xml",Kc);Ue.router.get("/v1/tiles/WMTSCapabilities.xml",Kc);Ue.router.get("/v1/arcgis/rest/services/:tileSet/VectorTileServer",Og);Ue.router.post("/v1/arcgis/rest/services/:tileSet/VectorTileServer",Rg);Ue.router.get("/v1/arcgis/rest/services/:tileSet/VectorTileServer/root.json",Ig);Ue.router.get("/v1/arcgis/rest/info",Cg);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> */
|