@basemaps/lambda-tiler 6.35.0 → 6.37.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.
Files changed (66) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/build/__tests__/config.data.js +1 -1
  3. package/build/__tests__/config.data.js.map +1 -1
  4. package/build/index.d.ts +1 -1
  5. package/build/index.d.ts.map +1 -1
  6. package/build/routes/__tests__/fonts.test.js +16 -12
  7. package/build/routes/__tests__/fonts.test.js.map +1 -1
  8. package/build/routes/__tests__/memory.fs.d.ts +1 -13
  9. package/build/routes/__tests__/memory.fs.d.ts.map +1 -1
  10. package/build/routes/__tests__/memory.fs.js +0 -59
  11. package/build/routes/__tests__/memory.fs.js.map +1 -1
  12. package/build/routes/__tests__/sprites.test.js +6 -11
  13. package/build/routes/__tests__/sprites.test.js.map +1 -1
  14. package/build/routes/__tests__/tile.json.test.js +1 -1
  15. package/build/routes/__tests__/tile.json.test.js.map +1 -1
  16. package/build/routes/fonts.js +1 -1
  17. package/build/routes/fonts.js.map +1 -1
  18. package/build/routes/tile.xyz.raster.d.ts +4 -1
  19. package/build/routes/tile.xyz.raster.d.ts.map +1 -1
  20. package/build/routes/tile.xyz.raster.js +19 -8
  21. package/build/routes/tile.xyz.raster.js.map +1 -1
  22. package/build/util/__test__/config.loader.test.js +1 -1
  23. package/build/util/__test__/config.loader.test.js.map +1 -1
  24. package/build/util/assets.provider.d.ts.map +1 -1
  25. package/build/util/assets.provider.js +2 -6
  26. package/build/util/assets.provider.js.map +1 -1
  27. package/build/util/config.loader.d.ts.map +1 -1
  28. package/build/util/config.loader.js +9 -2
  29. package/build/util/config.loader.js.map +1 -1
  30. package/build/util/source.cache.d.ts +1 -1
  31. package/build/util/source.cache.d.ts.map +1 -1
  32. package/build/util/validate.d.ts +1 -1
  33. package/build/util/validate.d.ts.map +1 -1
  34. package/build/wmts.capability.d.ts +2 -0
  35. package/build/wmts.capability.d.ts.map +1 -1
  36. package/build/wmts.capability.js +3 -1
  37. package/build/wmts.capability.js.map +1 -1
  38. package/dist/index.js +64 -62
  39. package/dist/node_modules/.package-lock.json +13 -10
  40. package/dist/node_modules/minimist/.eslintrc +54 -0
  41. package/dist/node_modules/minimist/.github/FUNDING.yml +12 -0
  42. package/dist/node_modules/minimist/.nycrc +14 -0
  43. package/dist/node_modules/minimist/CHANGELOG.md +212 -0
  44. package/dist/node_modules/minimist/{readme.markdown → README.md} +20 -1
  45. package/dist/node_modules/minimist/package.json +39 -9
  46. package/dist/node_modules/node-abi/abi_registry.json +15 -1
  47. package/dist/node_modules/node-abi/package.json +1 -1
  48. package/dist/node_modules/semver/classes/range.js +3 -0
  49. package/dist/node_modules/semver/index.js +81 -41
  50. package/dist/node_modules/semver/package.json +21 -10
  51. package/dist/package-lock.json +23 -20
  52. package/dist/package.json +1 -1
  53. package/package.json +11 -11
  54. package/src/__tests__/config.data.ts +1 -1
  55. package/src/routes/__tests__/fonts.test.ts +17 -17
  56. package/src/routes/__tests__/memory.fs.ts +0 -62
  57. package/src/routes/__tests__/sprites.test.ts +7 -11
  58. package/src/routes/__tests__/tile.json.test.ts +1 -1
  59. package/src/routes/fonts.ts +1 -1
  60. package/src/routes/tile.xyz.raster.ts +25 -10
  61. package/src/util/__test__/config.loader.test.ts +1 -1
  62. package/src/util/assets.provider.ts +2 -5
  63. package/src/util/config.loader.ts +8 -2
  64. package/src/wmts.capability.ts +4 -1
  65. package/tsconfig.tsbuildinfo +1 -1
  66. package/dist/node_modules/minimist/.travis.yml +0 -8
package/dist/index.js CHANGED
@@ -1,42 +1,42 @@
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(`
1
+ "use strict";var I8=Object.create;var s1=Object.defineProperty;var L8=Object.getOwnPropertyDescriptor;var k8=Object.getOwnPropertyNames;var N8=Object.getPrototypeOf,B8=Object.prototype.hasOwnProperty;var D8=(t,e,r)=>e in t?s1(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var o1=(t,e)=>()=>(t&&(e=t(t=0)),e);var G=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),z2=(t,e)=>{for(var r in e)s1(t,r,{get:e[r],enumerable:!0})},j2=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of k8(e))!B8.call(t,n)&&n!==r&&s1(t,n,{get:()=>e[n],enumerable:!(i=L8(e,n))||i.enumerable});return t};var me=(t,e,r)=>(r=t!=null?I8(N8(t)):{},j2(e||!t||!t.__esModule?s1(r,"default",{value:t,enumerable:!0}):r,t)),z8=t=>j2(s1({},"__esModule",{value:!0}),t);var fh=(t,e,r)=>(D8(t,typeof e!="symbol"?e+"":e,r),r),$2=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)};var Ee=(t,e,r)=>($2(t,e,"read from private field"),r?r.call(t):e.get(t)),St=(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)=>($2(t,e,"write to private field"),i?i.call(t,r):e.set(t,r),r),hh=(t,e,r,i)=>({set _(n){et(t,e,n,r)},get _(){return Ee(t,e,i)}});var W2=G((HA,H2)=>{"use strict";var dh=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},F2=(t,e)=>{if(!(t instanceof Error))return"";let r=t.stack||"";if(e.has(t))return r+`
2
+ causes have become circular...`;let i=dh(t);return i?(e.add(t),r+`
3
+ caused by: `+F2(i,e)):r},j8=t=>F2(t,new Set),q2=(t,e,r)=>{if(!(t instanceof Error))return"";let i=r?"":t.message||"";if(e.has(t))return i+": ...";let n=dh(t);if(n){e.add(t);let o=typeof t.cause=="function";return i+(o?"":": ")+q2(n,e,o)}else return i},$8=t=>q2(t,new Set);H2.exports={getErrorCause:dh,stackWithCauses:j8,messageWithCauses:$8}});var V2=G((WA,G2)=>{"use strict";G2.exports=gh;var{messageWithCauses:F8,stackWithCauses:q8}=W2(),{toString:H8}=Object.prototype,mh=Symbol("circular-ref-tag"),ph=Symbol("pino-raw-err-ref"),U2=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[ph]},set:function(t){this[ph]=t}}});Object.defineProperty(U2,ph,{writable:!0,value:{}});function gh(t){if(!(t instanceof Error))return t;t[mh]=void 0;let e=Object.create(U2);e.type=H8.call(t.constructor)==="[object Function]"?t.constructor.name:t.name,e.message=F8(t),e.stack=q8(t),global.AggregateError!==void 0&&t instanceof global.AggregateError&&Array.isArray(t.errors)&&(e.aggregateErrors=t.errors.map(r=>gh(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,mh)&&(e[r]=gh(i)):e[r]=i}return delete t[mh],e.raw=t,e}});var Y2=G((UA,Z2)=>{"use strict";Z2.exports={mapHttpRequest:W8,reqSerializer:J2};var yh=Symbol("pino-raw-req-ref"),K2=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[yh]},set:function(t){this[yh]=t}}});Object.defineProperty(K2,yh,{writable:!0,value:{}});function J2(t){let e=t.info||t.socket,r=Object.create(K2);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:J2(t)}}});var t5=G((GA,e5)=>{"use strict";e5.exports={mapHttpResponse:U8,resSerializer:Q2};var bh=Symbol("pino-raw-res-ref"),X2=Object.create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[bh]},set:function(t){this[bh]=t}}});Object.defineProperty(X2,bh,{writable:!0,value:{}});function Q2(t){let e=Object.create(X2);return e.statusCode=t.headersSent?t.statusCode:null,e.headers=t.getHeaders?t.getHeaders():t._headers,e.raw=t,e}function U8(t){return{res:Q2(t)}}});var l1=G((VA,r5)=>{"use strict";var vh=V2(),nu=Y2(),su=t5();r5.exports={err:vh,mapHttpRequest:nu.mapHttpRequest,mapHttpResponse:su.mapHttpResponse,req:nu.reqSerializer,res:su.resSerializer,wrapErrorSerializer:function(e){return e===vh?e:function(i){return e(vh(i))}},wrapRequestSerializer:function(e){return e===nu.reqSerializer?e:function(i){return e(nu.reqSerializer(i))}},wrapResponseSerializer:function(e){return e===su.resSerializer?e:function(i){return e(su.resSerializer(i))}}}});var wh=G((KA,i5)=>{"use strict";function G8(t,e){return e}i5.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 s5=G((JA,n5)=>{"use strict";var{createContext:V8,runInContext:K8}=require("vm");n5.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()}}),c=(o[0]==="["?"":".")+o.replace(/^\*/,"\u3007").replace(/\.\*/g,".\u3007").replace(/\[\*\]/g,"[\u3007]");if(/\n|\r|;/.test(c)||/\/\*/.test(c))throw Error();K8(`
4
4
  (function () {
5
5
  'use strict'
6
6
  o${c}
7
7
  if ([o${c}].length !== 1) throw Error()
8
8
  })()
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",`
9
+ `,V8({o:a,"\u3007":null}),{codeGeneration:{strings:!1,wasm:!1}})}catch{throw Error(r(o))}})}}});var ou=G((ZA,o5)=>{"use strict";o5.exports=/[^.[\]]+|\[((?:.)*?)\]/g});var l5=G((YA,a5)=>{"use strict";var Z8=ou();a5.exports=Y8;function Y8({paths:t}){let e=[];var r=0;let i=t.reduce(function(n,o,a){var c=o.match(Z8).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),v=m.join("."),E=c.slice(p+1,c.length),w=E.length>0;r++,e.push({before:m,beforeStr:v,after:E,nested:w})}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 c5=G((XA,u5)=>{"use strict";var X8=ou();u5.exports=Q8;function Q8({secret:t,serialize:e,wcLen:r,strict:i,isCensorFct:n,censorFctTakesPath:o},a){let c=Function("o",`
10
10
  if (typeof o !== 'object' || o == null) {
11
- ${jy(i,e)}
11
+ ${i3(i,e)}
12
12
  }
13
13
  const { censor, secret } = this
14
- ${By(t,n,o)}
14
+ ${e3(t,n,o)}
15
15
  this.compileRestore()
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=`
16
+ ${t3(r>0,n,o)}
17
+ ${r3(e)}
18
+ `).bind(a);return e===!1&&(c.restore=d=>a.restore(d)),c}function e3(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=X8.exec(i))!==null;){let[,b]=m,{index:M,input:T}=m;M>c&&p.push(T.substring(0,M-(b?0:1)))}var v=p.map(b=>`o${d}${b}`).join(" && ");v.length===0?v+=`o${d}${i} != null`:v+=` && o${d}${i} != null`;let E=`
19
19
  switch (true) {
20
- ${p.reverse().map(w=>`
21
- case o${d}${w} === censor:
22
- secret[${n}].circle = ${JSON.stringify(w)}
20
+ ${p.reverse().map(b=>`
21
+ case o${d}${b} === censor:
22
+ secret[${n}].circle = ${JSON.stringify(b)}
23
23
  break
24
24
  `).join(`
25
25
  `)}
26
26
  }
27
- `,x=r?`val, ${JSON.stringify(a)}`:"val";return`
28
- if (${S}) {
27
+ `,w=r?`val, ${JSON.stringify(a)}`:"val";return`
28
+ if (${v}) {
29
29
  const val = o${d}${i}
30
30
  if (val === censor) {
31
31
  secret[${n}].precensored = true
32
32
  } else {
33
33
  secret[${n}].val = val
34
- o${d}${i} = ${e?`censor(${x})`:"censor"}
35
- ${R}
34
+ o${d}${i} = ${e?`censor(${w})`:"censor"}
35
+ ${E}
36
36
  }
37
37
  }
38
38
  `}).join(`
39
- `)}function Dy(t,e,r){return t===!0?`
39
+ `)}function t3(t,e,r){return t===!0?`
40
40
  {
41
41
  const { wildcards, wcLen, groupRedact, nestedRedact } = this
42
42
  for (var i = 0; i < wcLen; i++) {
@@ -47,16 +47,16 @@ caused by: `+m2(i,e)):r},_y=t=>m2(t,new Set),p2=(t,e,r)=>{if(!(t instanceof Erro
47
47
  } else secret[beforeStr] = groupRedact(o, before, censor, ${e}, ${r})
48
48
  }
49
49
  }
50
- `:""}function zy(t){return t===!1?"return o":`
50
+ `:""}function r3(t){return t===!1?"return o":`
51
51
  var s = this.serialize(o)
52
52
  this.restore(o)
53
53
  return s
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`
54
+ `}function i3(t,e){return t===!0?"throw Error('fast-redact: primitives cannot be redacted')":e===!1?"return o":"return this.serialize(o)"}});var _h=G((QA,h5)=>{"use strict";h5.exports={groupRedact:s3,groupRestore:n3,nestedRedact:a3,nestedRestore:o3};function n3({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 s3(t,e,r,i,n){let o=f5(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 v=0;v<c;v++){let E=a[v];m[v]=o[E],n?(p[d]=E,o[E]=r(o[E],p)):i?o[E]=r(o[E]):o[E]=r}return{keys:a,values:m,target:o,flat:!0}}function o3(t){let e=t.length;for(var r=0;r<e;r++){let{key:n,target:o,value:a}=t[r];if(au(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];au(p,n)&&(p[n]=a)}}}}function a3(t,e,r,i,n,o,a){let c=f5(e,r);if(c==null)return;let d=Object.keys(c),p=d.length;for(var m=0;m<p;m++){let v=d[m],{value:E,parent:w,exists:b}=l3(c,v,r,i,n,o,a);b===!0&&w!==null&&t.push({key:i[i.length-1],target:w,value:E})}return t}function au(t,e){return t!=null?"hasOwn"in Object?Object.hasOwn(t,e):Object.prototype.hasOwnProperty.call(t,e):!1}function l3(t,e,r,i,n,o,a){let c=i.length,d=c-1,p=e;var m=-1,v,E,w,b=null,M=!0,T=null;if(w=v=t[e],typeof v!="object")return{value:null,parent:null,exists:M};for(;v!=null&&++m<c;){if(e=i[m],b=w,e!=="*"&&!T&&!(typeof v=="object"&&e in v)){M=!1;break}if(!(e==="*"&&(T=e,m!==d))){if(T){let P=Object.keys(v);for(var C=0;C<P.length;C++){let L=P[C],N=v[L],z=e==="*";(z||typeof N=="object"&&N!==null&&e in N)&&(z?w=N:w=N[e],E=m!==d?w:o?a?n(w,[...r,p,...i]):n(w):n,z?v[L]=E:N[e]=E===void 0&&n!==void 0||au(N,e)&&E===w?N[e]:E)}T=null}else w=v[e],E=m!==d?w:o?a?n(w,[...r,p,...i]):n(w):n,v[e]=au(v,e)&&E===w||E===void 0&&n!==void 0?v[e]:E,v=v[e];if(typeof v!="object")break}}return{value:w,parent:b,exists:M}}function f5(t,e){for(var r=-1,i=e.length,n=t;n!=null&&++r<i;)n=n[e[r]];return n}});var m5=G((eT,d5)=>{"use strict";var{groupRestore:u3,nestedRestore:c3}=_h();d5.exports=f3;function f3({secret:t,wcLen:e}){return function(){if(this.restore)return;let i=Object.keys(t),n=h3(t,i),o=e>0,a=o?{secret:t,groupRestore:u3,nestedRestore:c3}:{secret:t};this.restore=Function("o",d3(n,i,o)).bind(a)}}function h3(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`
55
55
  if (secret[${n}].val !== undefined) {
56
56
  try { ${c} } catch (e) {}
57
57
  ${d}
58
58
  }
59
- `}).join("")}function Jy(t,e,r){return`
59
+ `}).join("")}function d3(t,e,r){return`
60
60
  const secret = this.secret
61
61
  ${r===!0?`
62
62
  const keys = Object.keys(secret)
@@ -71,50 +71,52 @@ caused by: `+m2(i,e)):r},_y=t=>m2(t,new Set),p2=(t,e,r)=>{if(!(t instanceof Erro
71
71
  `:""}
72
72
  ${t}
73
73
  return o
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+=`
74
+ `}});var g5=G((tT,p5)=>{"use strict";p5.exports=m3;function m3(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 Mh=G((rT,b5)=>{"use strict";var y5=s5(),p3=l5(),g3=c5(),y3=m5(),{groupRedact:b3,nestedRedact:v3}=_h(),w3=g5(),_3=ou(),S3=y5(),Sh=t=>t;Sh.restore=Sh;var x3="[REDACTED]";xh.rx=_3;xh.validator=y5;b5.exports=xh;function xh(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:x3,o=typeof n=="function",a=o&&n.length>1;if(e.length===0)return r||Sh;S3({paths:e,serialize:r,censor:n});let{wildcards:c,wcLen:d,secret:p}=p3({paths:e,censor:n}),m=y3({secret:p,wcLen:d}),v="strict"in t?t.strict:!0;return g3({secret:p,wcLen:d,serialize:r,strict:v,isCensorFct:o,censorFctTakesPath:a},w3({secret:p,censor:n,compileRestore:m,serialize:r,groupRedact:b3,nestedRedact:v3,wildcards:c,wcLen:d}))}});var So=G((iT,v5)=>{"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"),O3=Symbol("pino.chindings"),I3=Symbol("pino.asJson"),L3=Symbol("pino.write"),k3=Symbol("pino.redactFmt"),N3=Symbol("pino.time"),B3=Symbol("pino.timeSliceIndex"),D3=Symbol("pino.stream"),z3=Symbol("pino.stringify"),j3=Symbol("pino.stringifySafe"),$3=Symbol("pino.stringifiers"),F3=Symbol("pino.end"),q3=Symbol("pino.formatOpts"),H3=Symbol("pino.messageKey"),W3=Symbol("pino.errorKey"),U3=Symbol("pino.nestedKey"),G3=Symbol("pino.nestedKeyStr"),V3=Symbol("pino.mixinMergeStrategy"),K3=Symbol("pino.wildcardFirst"),J3=Symbol.for("pino.serializers"),Z3=Symbol.for("pino.formatters"),Y3=Symbol.for("pino.hooks"),X3=Symbol.for("pino.metadata");v5.exports={setLevelSym:M3,getLevelSym:E3,levelValSym:R3,useLevelLabelsSym:C3,mixinSym:T3,lsCacheSym:P3,chindingsSym:O3,asJsonSym:I3,writeSym:L3,serializersSym:J3,redactFmtSym:k3,timeSym:N3,timeSliceIndexSym:B3,streamSym:D3,stringifySym:z3,stringifySafeSym:j3,stringifiersSym:$3,endSym:F3,formatOptsSym:q3,messageKeySym:H3,errorKeySym:W3,nestedKeySym:U3,wildcardFirstSym:K3,needsMetadataGsym:X3,useOnlyCustomLevelsSym:A3,formattersSym:Z3,hooksSym:Y3,nestedKeyStrSym:G3,mixinMergeStrategySym:V3}});var Ch=G((nT,x5)=>{"use strict";var Rh=Mh(),{redactFmtSym:Q3,wildcardFirstSym:lu}=So(),{rx:Eh,validator:e7}=Rh,w5=e7({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})`}),_5="[Redacted]",S5=!1;function t7(t,e){let{paths:r,censor:i}=r7(t),n=r.reduce((c,d)=>{Eh.lastIndex=0;let p=Eh.exec(d),m=Eh.exec(d),v=p[1]!==void 0?p[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,"$1"):p[0];if(v==="*"&&(v=lu),m===null)return c[v]=null,c;if(c[v]===null)return c;let{index:E}=m,w=`${d.substr(E,d.length-1)}`;return c[v]=c[v]||[],v!==lu&&c[v].length===0&&c[v].push(...c[lu]||[]),v===lu&&Object.keys(c).forEach(function(b){c[b]&&c[b].push(w)}),c[v].push(w),c},{}),o={[Q3]:Rh({paths:r,censor:i,serialize:e,strict:S5})},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,v)=>i(m,[d,...v]):i;c[d]=Rh({paths:n[d],censor:p,serialize:e,strict:S5})}return c},o)}function r7(t){if(Array.isArray(t))return t={paths:t,censor:_5},w5(t),t;let{paths:e,censor:r=_5,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),w5({paths:e,censor:r}),{paths:e,censor:r}}x5.exports=t7});var E5=G((sT,M5)=>{"use strict";var i7=()=>"",n7=()=>`,"time":${Date.now()}`,s7=()=>`,"time":${Math.round(Date.now()/1e3)}`,o7=()=>`,"time":"${new Date(Date.now()).toISOString()}"`;M5.exports={nullTime:i7,epochTime:n7,unixTime:s7,isoTime:o7}});var Ah=G((oT,R5)=>{"use strict";function a7(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}R5.exports=l7;function l7(t,e,r){var i=r&&r.stringify||a7,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,v=-1,E=t&&t.length||0,w=0;w<E;){if(t.charCodeAt(w)===37&&w+1<E){switch(v=v>-1?v:0,t.charCodeAt(w+1)){case 100:case 102:if(m>=d||(v<w&&(p+=t.slice(v,w)),e[m]==null))break;p+=Number(e[m]),v=w=w+2;break;case 105:if(m>=d||(v<w&&(p+=t.slice(v,w)),e[m]==null))break;p+=Math.floor(Number(e[m])),v=w=w+2;break;case 79:case 111:case 106:if(m>=d||(v<w&&(p+=t.slice(v,w)),e[m]===void 0))break;var b=typeof e[m];if(b==="string"){p+="'"+e[m]+"'",v=w+2,w++;break}if(b==="function"){p+=e[m].name||"<anonymous>",v=w+2,w++;break}p+=i(e[m]),v=w+2,w++;break;case 115:if(m>=d)break;v<w&&(p+=t.slice(v,w)),p+=String(e[m]),v=w+2,w++;break;case 37:v<w&&(p+=t.slice(v,w)),p+="%",v=w+2,w++,m--;break}++m}++w}return v===-1?t:(v<E&&(p+=t.slice(v)),p)}});var uu=G((aT,Th)=>{"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));Th.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(););};Th.exports=t}});var Oh=G((lT,P5)=>{"use strict";var Kt=require("fs"),u7=require("events"),c7=require("util").inherits,C5=require("path"),A5=uu(),Ph=100,f7=16*1024;function T5(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&&xo(e)}let i=e.append?"a":"w",n=e.mode;if(e.sync)try{e.mkdir&&Kt.mkdirSync(C5.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(C5.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:v}=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||f7,this.sync=a||!1,this._fsync=v||!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")T5(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=(E,w)=>{if(E){if(E.code==="EAGAIN"&&this.retryEAGAIN(E,this._writingBuf.length,this._len-this._writingBuf.length))if(this.sync)try{A5(Ph),this.release(void 0,0)}catch(M){this.release(M)}else setTimeout(()=>{Kt.write(this.fd,this._writingBuf,"utf8",this.release)},Ph);else this._writing=!1,this.emit("error",E);return}if(this.emit("write",w),this._len-=w,this._writingBuf=this._writingBuf.slice(w),this._writingBuf.length){if(!this.sync){Kt.write(this.fd,this._writingBuf,"utf8",this.release);return}try{do{let M=Kt.writeSync(this.fd,this._writingBuf,"utf8");this._len-=M,this._writingBuf=this._writingBuf.slice(M)}while(this._writingBuf)}catch(M){this.release(M);return}}this._fsync&&Kt.fsyncSync(this.fd);let b=this._len;this._reopening?(this._writing=!1,this._reopening=!1,this.reopen()):b>this.minLength?xo(this):this._ending?b>0?xo(this):(this._writing=!1,cu(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick(h7,this)):this.emit("drain"))},this.on("newListener",function(E){E==="drain"&&(this._asyncDrainScheduled=!1)})}function h7(t){t.listenerCount("drain")>0&&(t._asyncDrainScheduled=!1,t.emit("drain"))}c7(Jt,u7);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&&xo(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(""),xo(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)})}),T5(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?xo(this):cu(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;A5(Ph)}}};Jt.prototype.destroy=function(){this.destroyed||cu(this)};function xo(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 cu(t){if(t.fd===-1){t.once("ready",cu.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;P5.exports=Jt});var u1=G((uT,B5)=>{"use strict";var un={exit:[],beforeExit:[]},O5={exit:m7,beforeExit:p7},I5=new FinalizationRegistry(g7);function d7(t){un[t].length>0||process.on(t,O5[t])}function L5(t){un[t].length>0||process.removeListener(t,O5[t])}function m7(){k5("exit")}function p7(){k5("beforeExit")}function k5(t){for(let e of un[t]){let r=e.deref(),i=e.fn;r!==void 0&&i(r,t)}}function g7(t){for(let e of["exit","beforeExit"]){let r=un[e].indexOf(t);un[e].splice(r,r+1),L5(e)}}function N5(t,e,r){if(e===void 0)throw new Error("the object can't be undefined");d7(t);let i=new WeakRef(e);i.fn=r,I5.register(e,i),un[t].push(i)}function y7(t,e){N5("exit",t,e)}function b7(t,e){N5("beforeExit",t,e)}function v7(t){I5.unregister(t);for(let e of["exit","beforeExit"])un[e]=un[e].filter(r=>{let i=r.deref();return i&&i!==t}),L5(e)}B5.exports={register:y7,registerBeforeExit:b7,unregister:v7}});var z5=G((cT,D5)=>{"use strict";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 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 _7(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:w7,waitDiff:_7}});var $5=G((fT,j5)=>{"use strict";j5.exports={WRITE_INDEX:4,READ_INDEX:8}});var Dh=G((dT,W5)=>{"use strict";var{EventEmitter:S7}=require("events"),{Worker:x7}=require("worker_threads"),{join:M7}=require("path"),{pathToFileURL:E7}=require("url"),{wait:R7}=z5(),{WRITE_INDEX:Zt,READ_INDEX:ii}=$5(),C7=require("buffer"),A7=require("assert"),F=Symbol("kImpl"),T7=C7.constants.MAX_STRING_LENGTH,hu=class{constructor(e){this._value=e}deref(){return this._value}},P7=global.FinalizationRegistry||class{register(){}unregister(){}},O7=global.WeakRef||hu,F5=new P7(t=>{t.exited||t.terminate()});function I7(t,e){let{filename:r,workerData:i}=e,o=("__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{})["thread-stream-worker"]||M7(__dirname,"lib","worker.js"),a=new x7(o,{...e.workerOpts,workerData:{filename:r.indexOf("file://")===0?r:E7(r).href,dataBuf:t[F].dataBuf,stateBuf:t[F].stateBuf,workerData:i}});return a.stream=new hu(t),a.on("message",L7),a.on("exit",H5),F5.register(t,a),a}function q5(t){A7(!t[F].sync),t[F].needDrain&&(t[F].needDrain=!1,t.emit("drain"))}function fu(t){let e=Atomics.load(t[F].state,Zt),r=t[F].data.length-e;if(r>0){if(t[F].buf.length===0){t[F].flushing=!1,t[F].ending?Bh(t):t[F].needDrain&&process.nextTick(q5,t);return}let i=t[F].buf.slice(0,r),n=Buffer.byteLength(i);n<=r?(t[F].buf=t[F].buf.slice(r),du(t,i,fu.bind(null,t))):t.flush(()=>{if(!t.destroyed){for(Atomics.store(t[F].state,ii,0),Atomics.store(t[F].state,Zt,0);n>t[F].data.length;)r=r/2,i=t[F].buf.slice(0,r),n=Buffer.byteLength(i);t[F].buf=t[F].buf.slice(r),du(t,i,fu.bind(null,t))}})}else if(r===0){if(e===0&&t[F].buf.length===0)return;t.flush(()=>{Atomics.store(t[F].state,ii,0),Atomics.store(t[F].state,Zt,0),fu(t)})}else ni(t,new Error("overwritten"))}function L7(t){let e=this.stream.deref();if(e===void 0){this.exited=!0,this.terminate();return}switch(t.code){case"READY":this.stream=new O7(e),e.flush(()=>{e[F].ready=!0,e.emit("ready")});break;case"ERROR":ni(e,t.err);break;default:ni(e,new Error("this should not happen: "+t.code))}}function H5(t){let e=this.stream.deref();e!==void 0&&(F5.unregister(e),e.worker.exited=!0,e.worker.off("exit",H5),ni(e,t!==0?new Error("the worker thread exited"):null))}var Lh=class extends S7{constructor(e={}){if(super(),e.bufferSize<4)throw new Error("bufferSize must at least fit a 4-byte utf-8 char");this[F]={},this[F].stateBuf=new SharedArrayBuffer(128),this[F].state=new Int32Array(this[F].stateBuf),this[F].dataBuf=new SharedArrayBuffer(e.bufferSize||4*1024*1024),this[F].data=Buffer.from(this[F].dataBuf),this[F].sync=e.sync||!1,this[F].ending=!1,this[F].ended=!1,this[F].needDrain=!1,this[F].destroyed=!1,this[F].flushing=!1,this[F].ready=!1,this[F].finished=!1,this[F].errored=null,this[F].closed=!1,this[F].buf="",this.worker=I7(this,e)}write(e){if(this[F].destroyed)return kh(this,new Error("the worker has exited")),!1;if(this[F].ending)return kh(this,new Error("the worker is ending")),!1;if(this[F].flushing&&this[F].buf.length+e.length>=T7)try{Ih(this),this[F].flushing=!0}catch(r){return ni(this,r),!1}if(this[F].buf+=e,this[F].sync)try{return Ih(this),!0}catch(r){return ni(this,r),!1}return this[F].flushing||(this[F].flushing=!0,setImmediate(fu,this)),this[F].needDrain=this[F].data.length-this[F].buf.length-Atomics.load(this[F].state,Zt)<=0,!this[F].needDrain}end(){this[F].destroyed||(this[F].ending=!0,Bh(this))}flush(e){if(this[F].destroyed){typeof e=="function"&&process.nextTick(e,new Error("the worker has exited"));return}let r=Atomics.load(this[F].state,Zt);R7(this[F].state,ii,r,1/0,(i,n)=>{if(i){ni(this,i),process.nextTick(e,i);return}if(n==="not-equal"){this.flush(e);return}process.nextTick(e)})}flushSync(){this[F].destroyed||(Ih(this),Nh(this))}unref(){this.worker.unref()}ref(){this.worker.ref()}get ready(){return this[F].ready}get destroyed(){return this[F].destroyed}get closed(){return this[F].closed}get writable(){return!this[F].destroyed&&!this[F].ending}get writableEnded(){return this[F].ending}get writableFinished(){return this[F].finished}get writableNeedDrain(){return this[F].needDrain}get writableObjectMode(){return!1}get writableErrored(){return this[F].errored}};function kh(t,e){setImmediate(()=>{t.emit("error",e)})}function ni(t,e){t[F].destroyed||(t[F].destroyed=!0,e&&(t[F].errored=e,kh(t,e)),t.worker.exited?setImmediate(()=>{t[F].closed=!0,t.emit("close")}):t.worker.terminate().catch(()=>{}).then(()=>{t[F].closed=!0,t.emit("close")}))}function du(t,e,r){let i=Atomics.load(t[F].state,Zt),n=Buffer.byteLength(e);return t[F].data.write(e,i),Atomics.store(t[F].state,Zt,i+n),Atomics.notify(t[F].state,Zt),r(),!0}function Bh(t){if(!(t[F].ended||!t[F].ending||t[F].flushing)){t[F].ended=!0;try{t.flushSync();let e=Atomics.load(t[F].state,ii);Atomics.store(t[F].state,Zt,-1),Atomics.notify(t[F].state,Zt);let r=0;for(;e!==-1;){if(Atomics.wait(t[F].state,ii,e,1e3),e=Atomics.load(t[F].state,ii),e===-2){ni(t,new Error("end() failed"));return}if(++r===10){ni(t,new Error("end() took too long (10s)"));return}}process.nextTick(()=>{t[F].finished=!0,t.emit("finish")})}catch(e){ni(t,e)}}}function Ih(t){let e=()=>{t[F].ending?Bh(t):t[F].needDrain&&process.nextTick(q5,t)};for(t[F].flushing=!1;t[F].buf.length!==0;){let r=Atomics.load(t[F].state,Zt),i=t[F].data.length-r;if(i===0){Nh(t),Atomics.store(t[F].state,ii,0),Atomics.store(t[F].state,Zt,0);continue}else if(i<0)throw new Error("overwritten");let n=t[F].buf.slice(0,i),o=Buffer.byteLength(n);if(o<=i)t[F].buf=t[F].buf.slice(i),du(t,n,e);else{for(Nh(t),Atomics.store(t[F].state,ii,0),Atomics.store(t[F].state,Zt,0);o>t[F].buf.length;)i=i/2,n=t[F].buf.slice(0,i),o=Buffer.byteLength(n);t[F].buf=t[F].buf.slice(i),du(t,n,e)}}}function Nh(t){if(t[F].flushing)throw new Error("unable to flush while flushing");let e=Atomics.load(t[F].state,Zt),r=0;for(;;){let i=Atomics.load(t[F].state,ii);if(i===-2)throw Error("_flushSync failed");if(i!==e)Atomics.wait(t[F].state,ii,i,1e3);else break;if(++r===10)throw new Error("_flushSync took too long (10s)")}}W5.exports=Lh});var $h=G((mT,U5)=>{"use strict";var{createRequire:k7}=require("module"),N7=wh(),{join:zh,isAbsolute:B7}=require("path"),D7=uu(),jh=u1(),z7=Dh();function j7(t){jh.register(t,F7),jh.registerBeforeExit(t,q7),t.on("close",function(){jh.unregister(t)})}function $7(t,e,r){let i=new z7({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&&j7(i)}function o(){i.closed||(i.flushSync(),D7(100),i.end())}return i}function F7(t){t.ref(),t.flushSync(),t.end(),t.once("close",function(){t.unref()})}function q7(t){t.flushSync()}function H7(t){let{pipeline:e,targets:r,levels:i,options:n={},worker:o={},caller:a=N7()}=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"]||zh(__dirname,"worker.js"),n.targets=r.map(v=>({...v,target:m(v.target)}))):e&&(p=d["pino-pipeline-worker"]||zh(__dirname,"worker-pipeline.js"),n.targets=e.map(v=>({...v,target:m(v.target)}))),i&&(n.levels=i),$7(m(p),n,o);function m(v){if(v=d[v]||v,B7(v)||v.indexOf("file://")===0)return v;if(v==="pino/file")return zh(__dirname,"..","file.js");let E;for(let w of c)try{E=k7(w).resolve(v);break}catch{continue}if(!E)throw new Error(`unable to determine transport target for "${v}"`);return E}}U5.exports=H7});var pu=G((pT,im)=>{"use strict";var G5=Ah(),{mapHttpRequest:W7,mapHttpResponse:U7}=l1(),Fh=Oh(),V5=u1(),{lsCacheSym:G7,chindingsSym:Y5,writeSym:K5,serializersSym:X5,formatOptsSym:J5,endSym:V7,stringifiersSym:Q5,stringifySym:em,stringifySafeSym:qh,wildcardFirstSym:tm,nestedKeySym:K7,formattersSym:rm,messageKeySym:J7,nestedKeyStrSym:Z7}=So(),{isMainThread:Y7}=require("worker_threads"),X7=$h();function Mo(){}function Q7(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=W7(i):typeof i.setHeader=="function"&&(i=U7(i)));let a;o===null&&n.length===0?a=[null]:(o=n.shift(),a=n),this[K5](i,G5(o,a,this[J5]),t)}else this[K5](null,G5(i===void 0?n.shift():i,n,this[J5]),t)}}function Z5(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 eb(t,e,r,i){let n=this[em],o=this[qh],a=this[Q5],c=this[V7],d=this[Y5],p=this[X5],m=this[rm],v=this[J7],E=this[G7][r]+i;E=E+d;let w;m.log&&(t=m.log(t));let b=a[tm],M="";for(let C in t)if(w=t[C],Object.prototype.hasOwnProperty.call(t,C)&&w!==void 0){w=p[C]?p[C](w):w;let P=a[C]||b;switch(typeof w){case"undefined":case"function":continue;case"number":Number.isFinite(w)===!1&&(w=null);case"boolean":P&&(w=P(w));break;case"string":w=(P||Z5)(w);break;default:w=(P||n)(w,o)}if(w===void 0)continue;M+=',"'+C+'":'+w}let T="";if(e!==void 0){w=p[v]?p[v](e):e;let C=a[v]||b;switch(typeof w){case"function":break;case"number":Number.isFinite(w)===!1&&(w=null);case"boolean":C&&(w=C(w)),T=',"'+v+'":'+w;break;case"string":w=(C||Z5)(w),T=',"'+v+'":'+w;break;default:w=(C||n)(w,o),T=',"'+v+'":'+w}}return this[K7]&&M?E+this[Z7]+M.slice(1)+"}"+T+c:E+M+T+c}function tb(t,e){let r,i=t[Y5],n=t[em],o=t[qh],a=t[Q5],c=a[tm],d=t[X5],p=t[rm].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 rb(t){return t.write!==t.constructor.prototype.write}function mu(t){let e=new Fh(t);return e.on("error",r),!t.sync&&Y7&&(V5.register(e,ib),e.on("close",function(){V5.unregister(e)})),e;function r(i){if(i.code==="EPIPE"){e.write=Mo,e.end=Mo,e.flushSync=Mo,e.destroy=Mo;return}e.removeListener("error",r),e.emit("error",i)}}function ib(t,e){t.destroyed||(e==="beforeExit"?(t.flush(),t.on("drain",function(){t.end()})):t.flushSync())}function nb(t){return function(r,i,n={},o){if(typeof n=="string")o=mu({dest:n}),n={};else if(typeof o=="string"){if(n&&n.transport)throw Error("only one of option.transport or stream can be specified");o=mu({dest:o})}else if(n instanceof Fh||n.writable||n._writableState)o=n,n={};else if(n.transport){if(n.transport instanceof Fh||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 d;n.customLevels&&(d=n.useOnlyCustomLevels?n.customLevels:Object.assign({},n.levels,n.customLevels)),o=X7({caller:i,...n.transport,levels:d})}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)");let{enabled:a,onChild:c}=n;return a===!1&&(n.level="silent"),c||(n.onChild=Mo),o||(rb(process.stdout)?o=process.stdout:o=mu({fd:process.stdout.fd||1})),{opts:n,stream:o}}}function sb(t,e){try{return JSON.stringify(t)}catch{try{return(e||this[qh])(t)}catch{return'"[unable to serialize, circular reference is too complex to analyze]"'}}}function ob(t,e,r){return{level:t,bindings:e,log:r}}function ab(t){let e=Number(t);return typeof t=="string"&&Number.isFinite(e)?e:t===void 0?1:t}im.exports={noop:Mo,buildSafeSonicBoom:mu,asChindings:tb,asJson:eb,genLog:Q7,createArgsNormalizer:nb,stringify:sb,buildFormatters:ob,normalizeDestFileDescriptor:ab}});var gu=G((gT,sm)=>{"use strict";var{lsCacheSym:lb,levelValSym:Hh,useOnlyCustomLevelsSym:ub,streamSym:cb,formattersSym:fb,hooksSym:hb}=So(),{noop:db,genLog:is}=pu(),jr={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},nm={fatal:t=>{let e=is(jr.fatal,t);return function(...r){let i=this[cb];if(e.call(this,...r),typeof i.flushSync=="function")try{i.flushSync()}catch{}}},error:t=>is(jr.error,t),warn:t=>is(jr.warn,t),info:t=>is(jr.info,t),debug:t=>is(jr.debug,t),trace:t=>is(jr.trace,t)},Wh=Object.keys(jr).reduce((t,e)=>(t[jr[e]]=e,t),{}),mb=Object.keys(Wh).reduce((t,e)=>(t[e]='{"level":'+Number(e),t),{});function pb(t){let e=t[fb].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[lb]=i,t}function gb(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 yb(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[Hh],n=this[Hh]=r[t],o=this[ub],a=this[hb].logMethod;for(let c in r){if(n>r[c]){this[c]=db;continue}this[c]=gb(c,o)?nm[c](a):is(r[c],a)}this.emit("level-change",t,n,e[i],i)}function bb(t){let{levels:e,levelVal:r}=this;return e&&e.labels?e.labels[r]:""}function vb(t){let{values:e}=this.levels,r=e[t];return r!==void 0&&r>=this[Hh]}function wb(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:Wh,r),n=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),e?null:jr,t);return{labels:i,values:n}}function _b(t,e,r){if(typeof t=="number"){if(![].concat(Object.keys(e||{}).map(o=>e[o]),r?[]:Object.keys(Wh).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:jr,e);if(!(t in i))throw Error(`default level:${t} must be included in custom levels`)}function Sb(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")}}sm.exports={initialLsCache:mb,genLsCache:pb,levelMethods:nm,getLevel:bb,setLevel:yb,isLevelEnabled:vb,mappings:wb,levels:jr,assertNoLevelCollisions:Sb,assertDefaultLevelFound:_b}});var Uh=G((yT,om)=>{"use strict";om.exports={version:"8.6.1"}});var gm=G((vT,pm)=>{"use strict";var{EventEmitter:xb}=require("events"),{lsCacheSym:Mb,levelValSym:Eb,setLevelSym:Vh,getLevelSym:am,chindingsSym:Kh,parsedChindingsSym:Rb,mixinSym:Cb,asJsonSym:fm,writeSym:Ab,mixinMergeStrategySym:Tb,timeSym:Pb,timeSliceIndexSym:Ob,streamSym:hm,serializersSym:ns,formattersSym:Gh,errorKeySym:Ib,useOnlyCustomLevelsSym:Lb,needsMetadataGsym:kb,redactFmtSym:Nb,stringifySym:Bb,formatOptsSym:Db,stringifiersSym:zb}=So(),{getLevel:jb,setLevel:$b,isLevelEnabled:Fb,mappings:qb,initialLsCache:Hb,genLsCache:Wb,assertNoLevelCollisions:Ub}=gu(),{asChindings:dm,asJson:Gb,buildFormatters:lm,stringify:um}=pu(),{version:Vb}=Uh(),Kb=Ch(),Jb=class{},mm={constructor:Jb,child:Zb,bindings:Yb,setBindings:Xb,flush:rv,isLevelEnabled:Fb,version:Vb,get level(){return this[am]()},set level(t){this[Vh](t)},get levelVal(){return this[Eb]},set levelVal(t){throw Error("levelVal is read-only")},[Mb]:Hb,[Ab]:ev,[fm]:Gb,[am]:jb,[Vh]:$b};Object.setPrototypeOf(mm,xb.prototype);pm.exports=function(){return Object.create(mm)};var cm=t=>t;function Zb(t,e){if(!t)throw Error("missing bindings for child Pino");e=e||{};let r=this[ns],i=this[Gh],n=Object.create(this);if(e.hasOwnProperty("serializers")===!0){n[ns]=Object.create(null);for(let m in r)n[ns][m]=r[m];let d=Object.getOwnPropertySymbols(r);for(var o=0;o<d.length;o++){let m=d[o];n[ns][m]=r[m]}for(let m in e.serializers)n[ns][m]=e.serializers[m];let p=Object.getOwnPropertySymbols(e.serializers);for(var a=0;a<p.length;a++){let m=p[a];n[ns][m]=e.serializers[m]}}else n[ns]=r;if(e.hasOwnProperty("formatters")){let{level:d,bindings:p,log:m}=e.formatters;n[Gh]=lm(d||i.level,p||cm,m||i.log)}else n[Gh]=lm(i.level,cm,i.log);if(e.hasOwnProperty("customLevels")===!0&&(Ub(this.levels,e.customLevels),n.levels=qb(e.customLevels,n[Lb]),Wb(n)),typeof e.redact=="object"&&e.redact!==null||Array.isArray(e.redact)){n.redact=e.redact;let d=Kb(n.redact,um),p={stringify:d[Nb]};n[Bb]=um,n[zb]=d,n[Db]=p}n[Kh]=dm(n,t);let c=e.level||this.level;return n[Vh](c),this.onChild(n),n}function Yb(){let e=`{${this[Kh].substr(1)}}`,r=JSON.parse(e);return delete r.pid,delete r.hostname,r}function Xb(t){let e=dm(this,t);this[Kh]=e,delete this[Rb]}function Qb(t,e){return Object.assign(e,t)}function ev(t,e,r){let i=this[Pb](),n=this[Cb],o=this[Ib],a=this[Tb]||Qb,c;t==null?c={}:t instanceof Error?(c={[o]:t},e===void 0&&(e=t.message)):(c=t,e===void 0&&t[o]&&(e=t[o].message)),n&&(c=a(c,n(c,r)));let d=this[fm](c,e,r,i),p=this[hm];p[kb]===!0&&(p.lastLevel=r,p.lastObj=c,p.lastMsg=e,p.lastTime=i.slice(this[Ob]),p.lastLogger=this),p.write(d)}function tv(){}function rv(){let t=this[hm];"flush"in t&&t.flush(tv)}});var t0=G((e0,vm)=>{"use strict";var os=Qh();os.configure=Qh;os.stringify=os;os.default=os;e0.stringify=os;e0.configure=Qh;vm.exports=os;var iv=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/,nv=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/g,Xh=["\\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 sv(t){if(t.length===2){let r=t.charCodeAt(1);return`${t[0]}\\u${r.toString(16)}`}let e=t.charCodeAt(0);return Xh.length>e?Xh[e]:`\\u${e.toString(16)}`}function cn(t){if(t.length<5e3&&!iv.test(t))return t;if(t.length>100)return t.replace(nv,sv);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)}${Xh[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 Jh(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 ov=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Uint8Array)),Symbol.toStringTag).get;function Zh(t){return ov.call(t)!==void 0&&t.length!==0}function Yh(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 av(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 ym(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 bm(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 ss(t){return t===1?"1 item":`${t} items`}function lv(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 Qh(t){let e=av(t),r=ym(t,"bigint"),i=ym(t,"deterministic"),n=bm(t,"maximumDepth"),o=bm(t,"maximumBreadth");function a(v,E,w,b,M,T){let C=E[v];switch(typeof C=="object"&&C!==null&&typeof C.toJSON=="function"&&(C=C.toJSON(v)),C=b.call(E,v,C),typeof C){case"string":return`"${cn(C)}"`;case"object":{if(C===null)return"null";if(w.indexOf(C)!==-1)return e;let P="",L=",",N=T;if(Array.isArray(C)){if(C.length===0)return"[]";if(n<w.length+1)return'"[Array]"';w.push(C),M!==""&&(T+=M,P+=`
75
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=`
76
+ ${T}`);let De=Math.min(C.length,o),Me=0;for(;Me<De-1;Me++){let tt=a(Me,C,w,b,M,T);P+=tt!==void 0?tt:"null",P+=L}let ke=a(Me,C,w,b,M,T);if(P+=ke!==void 0?ke:"null",C.length-1>o){let tt=C.length-o-1;P+=`${L}"... ${ss(tt)} not stringified"`}return M!==""&&(P+=`
77
+ ${N}`),w.pop(),`[${P}]`}let z=Object.keys(C),U=z.length;if(U===0)return"{}";if(n<w.length+1)return'"[Object]"';let Z="",ie="";M!==""&&(T+=M,L=`,
78
+ ${T}`,Z=" ");let ge=Math.min(U,o);Zh(C)&&(P+=Yh(C,L,o),z=z.slice(C.length),ge-=C.length,ie=L),i&&(z=Jh(z)),w.push(C);for(let De=0;De<ge;De++){let Me=z[De],ke=a(Me,C,w,b,M,T);ke!==void 0&&(P+=`${ie}"${cn(Me)}":${Z}${ke}`,ie=L)}if(U>o){let De=U-o;P+=`${ie}"...":${Z}"${ss(De)} not stringified"`,ie=L}return M!==""&&ie.length>1&&(P=`
79
79
  ${T}${P}
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+=`
80
+ ${N}`),w.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(v,E,w,b,M,T){switch(typeof E=="object"&&E!==null&&typeof E.toJSON=="function"&&(E=E.toJSON(v)),typeof E){case"string":return`"${cn(E)}"`;case"object":{if(E===null)return"null";if(w.indexOf(E)!==-1)return e;let C=T,P="",L=",";if(Array.isArray(E)){if(E.length===0)return"[]";if(n<w.length+1)return'"[Array]"';w.push(E),M!==""&&(T+=M,P+=`
81
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=`
82
+ ${T}`);let U=Math.min(E.length,o),Z=0;for(;Z<U-1;Z++){let ge=c(Z,E[Z],w,b,M,T);P+=ge!==void 0?ge:"null",P+=L}let ie=c(Z,E[Z],w,b,M,T);if(P+=ie!==void 0?ie:"null",E.length-1>o){let ge=E.length-o-1;P+=`${L}"... ${ss(ge)} not stringified"`}return M!==""&&(P+=`
83
+ ${C}`),w.pop(),`[${P}]`}if(b.size===0)return"{}";w.push(E);let N="";M!==""&&(T+=M,L=`,
84
+ ${T}`,N=" ");let z="";for(let U of b){let Z=c(U,E[U],w,b,M,T);Z!==void 0&&(P+=`${z}"${cn(U)}":${N}${Z}`,z=L)}return M!==""&&z.length>1&&(P=`
85
85
  ${T}${P}
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=`
87
- ${E}`,se=`,
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=`
91
- ${E}${B}
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
86
+ ${C}`),w.pop(),`{${P}}`}case"number":return isFinite(E)?String(E):"null";case"boolean":return E===!0?"true":"false";case"bigint":return r?String(E):void 0}}function d(v,E,w,b,M){switch(typeof E){case"string":return`"${cn(E)}"`;case"object":{if(E===null)return"null";if(typeof E.toJSON=="function"){if(E=E.toJSON(v),typeof E!="object")return d(v,E,w,b,M);if(E===null)return"null"}if(w.indexOf(E)!==-1)return e;let T=M;if(Array.isArray(E)){if(E.length===0)return"[]";if(n<w.length+1)return'"[Array]"';w.push(E),M+=b;let Z=`
87
+ ${M}`,ie=`,
88
+ ${M}`,ge=Math.min(E.length,o),De=0;for(;De<ge-1;De++){let ke=d(De,E[De],w,b,M);Z+=ke!==void 0?ke:"null",Z+=ie}let Me=d(De,E[De],w,b,M);if(Z+=Me!==void 0?Me:"null",E.length-1>o){let ke=E.length-o-1;Z+=`${ie}"... ${ss(ke)} not stringified"`}return Z+=`
89
+ ${T}`,w.pop(),`[${Z}]`}let C=Object.keys(E),P=C.length;if(P===0)return"{}";if(n<w.length+1)return'"[Object]"';M+=b;let L=`,
90
+ ${M}`,N="",z="",U=Math.min(P,o);Zh(E)&&(N+=Yh(E,L,o),C=C.slice(E.length),U-=E.length,z=L),i&&(C=Jh(C)),w.push(E);for(let Z=0;Z<U;Z++){let ie=C[Z],ge=d(ie,E[ie],w,b,M);ge!==void 0&&(N+=`${z}"${cn(ie)}": ${ge}`,z=L)}if(P>o){let Z=P-o;N+=`${z}"...": "${ss(Z)} not stringified"`,z=L}return z!==""&&(N=`
91
+ ${M}${N}
92
+ ${T}`),w.pop(),`{${N}}`}case"number":return isFinite(E)?String(E):"null";case"boolean":return E===!0?"true":"false";case"bigint":return r?String(E):void 0}}function p(v,E,w){switch(typeof E){case"string":return`"${cn(E)}"`;case"object":{if(E===null)return"null";if(typeof E.toJSON=="function"){if(E=E.toJSON(v),typeof E!="object")return p(v,E,w);if(E===null)return"null"}if(w.indexOf(E)!==-1)return e;let b="";if(Array.isArray(E)){if(E.length===0)return"[]";if(n<w.length+1)return'"[Array]"';w.push(E);let L=Math.min(E.length,o),N=0;for(;N<L-1;N++){let U=p(N,E[N],w);b+=U!==void 0?U:"null",b+=","}let z=p(N,E[N],w);if(b+=z!==void 0?z:"null",E.length-1>o){let U=E.length-o-1;b+=`,"... ${ss(U)} not stringified"`}return w.pop(),`[${b}]`}let M=Object.keys(E),T=M.length;if(T===0)return"{}";if(n<w.length+1)return'"[Object]"';let C="",P=Math.min(T,o);Zh(E)&&(b+=Yh(E,",",o),M=M.slice(E.length),P-=E.length,C=","),i&&(M=Jh(M)),w.push(E);for(let L=0;L<P;L++){let N=M[L],z=p(N,E[N],w);z!==void 0&&(b+=`${C}"${cn(N)}":${z}`,C=",")}if(T>o){let L=T-o;b+=`${C}"...":"${ss(L)} not stringified"`}return w.pop(),`{${b}}`}case"number":return isFinite(E)?String(E):"null";case"boolean":return E===!0?"true":"false";case"bigint":return r?String(E):void 0}}function m(v,E,w){if(arguments.length>1){let b="";if(typeof w=="number"?b=" ".repeat(Math.min(w,10)):typeof w=="string"&&(b=w.slice(0,10)),E!=null){if(typeof E=="function")return a("",{"":v},[],E,b,"");if(Array.isArray(E))return c("",v,[],lv(E),b,"")}if(b.length!==0)return d("",v,[],b,"")}return p("",v,[])}return m}});var xm=G((wT,Sm)=>{"use strict";var r0=Symbol.for("pino.metadata"),{levels:wm}=gu(),_m=Object.create(wm);_m.silent=1/0;var uv=wm.info;function cv(t,e){let r=0;t=t||[],e=e||{dedupe:!1};let i=_m;e.levels&&typeof e.levels=="object"&&(i=e.levels);let n={write:o,add:c,flushSync:a,end:d,minLevel:0,streams:[],clone:p,[r0]:!0};return Array.isArray(t)?t.forEach(c,n):c.call(n,t),t=null,n;function o(m){let v,E=this.lastLevel,{streams:w}=this,b=0,M;for(let T=hv(w.length,e.dedupe);mv(T,w.length,e.dedupe);T=dv(T,e.dedupe))if(v=w[T],v.level<=E){if(b!==0&&b!==v.level)break;if(M=v.stream,M[r0]){let{lastTime:C,lastMsg:P,lastObj:L,lastLogger:N}=this;M.lastLevel=E,M.lastTime=C,M.lastMsg=P,M.lastObj=L,M.lastLogger=N}M.write(m),e.dedupe&&(b=v.level)}else if(!e.dedupe)break}function a(){for(let{stream:m}of this.streams)typeof m.flushSync=="function"&&m.flushSync()}function c(m){if(!m)return n;let v=typeof m.write=="function"||m.stream,E=m.write?m:m.stream;if(!v)throw Error("stream object needs to implement either StreamEntry or DestinationStream interface");let{streams:w}=this,b;typeof m.levelVal=="number"?b=m.levelVal:typeof m.level=="string"?b=i[m.level]:typeof m.level=="number"?b=m.level:b=uv;let M={stream:E,level:b,levelVal:void 0,id:r++};return w.unshift(M),w.sort(fv),this.minLevel=w[0].level,n}function d(){for(let{stream:m}of this.streams)typeof m.flushSync=="function"&&m.flushSync(),m.end()}function p(m){let v=new Array(this.streams.length);for(let E=0;E<v.length;E++)v[E]={level:m,stream:this.streams[E].stream};return{write:o,add:c,minLevel:m,streams:v,clone:p,flushSync:a,[r0]:!0}}}function fv(t,e){return t.level-e.level}function hv(t,e){return e?t-1:0}function dv(t,e){return e?t-1:t+1}function mv(t,e,r){return r?t>=0:t<e}Sm.exports=cv});var Bm=G((_T,br)=>{"use strict";var pv=require("os"),Om=l1(),gv=wh(),yv=Ch(),Im=E5(),bv=gm(),Lm=So(),{configure:vv}=t0(),{assertDefaultLevelFound:wv,mappings:km,genLsCache:_v,levels:Sv}=gu(),{createArgsNormalizer:xv,asChindings:Mv,buildSafeSonicBoom:Mm,buildFormatters:Ev,stringify:yu,normalizeDestFileDescriptor:Em,noop:Rv}=pu(),{version:Cv}=Uh(),{chindingsSym:Rm,redactFmtSym:Av,serializersSym:Cm,timeSym:Tv,timeSliceIndexSym:Pv,streamSym:Ov,stringifySym:Am,stringifySafeSym:i0,stringifiersSym:Tm,setLevelSym:Iv,endSym:Lv,formatOptsSym:kv,messageKeySym:Nv,errorKeySym:Bv,nestedKeySym:Dv,mixinSym:zv,useOnlyCustomLevelsSym:jv,formattersSym:Pm,hooksSym:$v,nestedKeyStrSym:Fv,mixinMergeStrategySym:qv}=Lm,{epochTime:Nm,nullTime:Hv}=Im,{pid:Wv}=process,Uv=pv.hostname(),Gv=Om.err,Vv={level:"info",levels:Sv,messageKey:"msg",errorKey:"err",nestedKey:null,enabled:!0,base:{pid:Wv,hostname:Uv},serializers:Object.assign(Object.create(null),{err:Gv}),formatters:Object.assign(Object.create(null),{bindings(t){return t},level(t,e){return{level:e}}}),hooks:{logMethod:void 0},timestamp:Nm,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100},Kv=xv(Vv),Jv=Object.assign(Object.create(null),Om);function n0(...t){let e={},{opts:r,stream:i}=Kv(e,gv(),...t),{redact:n,crlf:o,serializers:a,timestamp:c,messageKey:d,errorKey:p,nestedKey:m,base:v,name:E,level:w,customLevels:b,mixin:M,mixinMergeStrategy:T,useOnlyCustomLevels:C,formatters:P,hooks:L,depthLimit:N,edgeLimit:z,onChild:U}=r,Z=vv({maximumDepth:N,maximumBreadth:z}),ie=Ev(P.level,P.bindings,P.log),ge=n?yv(n,yu):{},De=yu.bind({[i0]:Z}),Me=n?{stringify:ge[Av]}:{stringify:De},ke="}"+(o?`\r
93
93
  `:`
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
94
+ `),tt=Mv.bind(null,{[Rm]:"",[Cm]:a,[Tm]:ge,[Am]:yu,[i0]:Z,[Pm]:ie}),pt="";v!==null&&(E===void 0?pt=tt(v):pt=tt(Object.assign({},v,{name:E})));let dr=c instanceof Function?c:c?Nm:Hv,Bn=dr().indexOf(":")+1;if(C&&!b)throw Error("customLevels is required if useOnlyCustomLevels is set true");if(M&&typeof M!="function")throw Error(`Unknown mixin type "${typeof M}" - expected "function"`);wv(w,b,C);let Ca=km(b,C);return Object.assign(e,{levels:Ca,[jv]:C,[Ov]:i,[Tv]:dr,[Pv]:Bn,[Am]:yu,[i0]:Z,[Tm]:ge,[Lv]:ke,[kv]:Me,[Nv]:d,[Bv]:p,[Dv]:m,[Fv]:m?`,${JSON.stringify(m)}:{`:"",[Cm]:a,[zv]:M,[qv]:T,[Rm]:pt,[Pm]:ie,[$v]:L,silent:Rv,onChild:U}),Object.setPrototypeOf(e,bv()),_v(e),e[Iv](w),e}br.exports=n0;br.exports.destination=(t=process.stdout.fd)=>typeof t=="object"?(t.dest=Em(t.dest||process.stdout.fd),Mm(t)):Mm({dest:Em(t),minLength:0});br.exports.transport=$h();br.exports.multistream=xm();br.exports.levels=km();br.exports.stdSerializers=Jv;br.exports.stdTimeFunctions=Object.assign({},Im);br.exports.symbols=Lm;br.exports.version=Cv;br.exports.default=n0;br.exports.pino=n0});var $m=G((ST,c1)=>{"use strict";var Zv=process.env.TERM_PROGRAM==="Hyper",Yv=process.platform==="win32",Dm=process.platform==="linux",s0={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"},zm=Object.assign({},s0,{check:"\u221A",cross:"\xD7",ellipsisLarge:"...",ellipsis:"...",info:"i",question:"?",questionSmall:"?",pointer:">",pointerSmall:"\xBB",radioOff:"( )",radioOn:"(*)",warning:"\u203C"}),jm=Object.assign({},s0,{ballotCross:"\u2718",check:"\u2714",cross:"\u2716",ellipsisLarge:"\u22EF",ellipsis:"\u2026",info:"\u2139",question:"?",questionFull:"\uFF1F",questionSmall:"\uFE56",pointer:Dm?"\u25B8":"\u276F",pointerSmall:Dm?"\u2023":"\u203A",radioOff:"\u25EF",radioOn:"\u25C9",warning:"\u26A0"});c1.exports=Yv&&!Zv?zm:jm;Reflect.defineProperty(c1.exports,"common",{enumerable:!1,value:s0});Reflect.defineProperty(c1.exports,"windows",{enumerable:!1,value:zm});Reflect.defineProperty(c1.exports,"other",{enumerable:!1,value:jm})});var qm=G((xT,o0)=>{"use strict";var Xv=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),Qv=/[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g,Fm=()=>{let t={enabled:!0,visible:!0,styles:{},keys:{}};"FORCE_COLOR"in process.env&&(t.enabled=process.env.FORCE_COLOR!=="0");let e=o=>{let a=o.open=`\x1B[${o.codes[0]}m`,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 v=a+p+c;return m?v.replace(/\r*\n/g,`${c}$&${a}`):v},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=Qv,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(!Xv(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=$m(),t.define=n,t};o0.exports=Fm();o0.exports.create=Fm});var a0=G((ET,Hm)=>{Hm.exports=require("stream")});var Vm=G((RT,Gm)=>{"use strict";function Wm(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 tw(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Wm(Object(r),!0).forEach(function(i){rw(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Wm(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function rw(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function iw(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Um(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 nw(t,e,r){return e&&Um(t.prototype,e),r&&Um(t,r),t}var sw=require("buffer"),bu=sw.Buffer,ow=require("util"),l0=ow.inspect,aw=l0&&l0.custom||"inspect";function lw(t,e,r){bu.prototype.copy.call(t,e,r)}Gm.exports=function(){function t(){iw(this,t),this.head=null,this.tail=null,this.length=0}return nw(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 bu.alloc(0);for(var i=bu.allocUnsafe(r>>>0),n=this.head,o=0;n;)lw(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=bu.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:aw,value:function(r,i){return l0(this,tw({},i,{depth:0,customInspect:!1}))}}]),t}()});var c0=G((CT,Jm)=>{"use strict";function uw(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(u0,this,t)):process.nextTick(u0,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(vu,r):(r._writableState.errorEmitted=!0,process.nextTick(Km,r,o)):process.nextTick(Km,r,o):e?(process.nextTick(vu,r),e(o)):process.nextTick(vu,r)}),this)}function Km(t,e){u0(t,e),vu(t)}function vu(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function cw(){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 u0(t,e){t.emit("error",e)}function fw(t,e){var r=t._readableState,i=t._writableState;r&&r.autoDestroy||i&&i.autoDestroy?t.destroy(e):t.emit("error",e)}Jm.exports={destroy:uw,undestroy:cw,errorOrDestroy:fw}});var fn=G((AT,Xm)=>{"use strict";var Ym={};function vr(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,Ym[t]=n}function Zm(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 hw(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function dw(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function mw(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}vr("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);vr("ERR_INVALID_ARG_TYPE",function(t,e,r){let i;typeof e=="string"&&hw(e,"not ")?(i="must not be",e=e.replace(/^not /,"")):i="must be";let n;if(dw(t," argument"))n=`The ${t} ${i} ${Zm(e,"type")}`;else{let o=mw(t,".")?"property":"argument";n=`The "${t}" ${o} ${i} ${Zm(e,"type")}`}return n+=`. Received type ${typeof r}`,n},TypeError);vr("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");vr("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});vr("ERR_STREAM_PREMATURE_CLOSE","Premature close");vr("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});vr("ERR_MULTIPLE_CALLBACK","Callback called multiple times");vr("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");vr("ERR_STREAM_WRITE_AFTER_END","write after end");vr("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);vr("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);vr("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");Xm.exports.codes=Ym});var f0=G((TT,Qm)=>{"use strict";var pw=fn().codes.ERR_INVALID_OPT_VALUE;function gw(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function yw(t,e,r,i){var n=gw(e,i,r);if(n!=null){if(!(isFinite(n)&&Math.floor(n)===n)||n<0){var o=i?r:"highWaterMark";throw new pw(o,n)}return Math.floor(n)}return t.objectMode?16:16*1024}Qm.exports={getHighWaterMark:yw}});var ep=G((PT,h0)=>{typeof Object.create=="function"?h0.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:h0.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 Eo=G((OT,m0)=>{try{if(d0=require("util"),typeof d0.inherits!="function")throw"";m0.exports=d0.inherits}catch{m0.exports=ep()}var d0});var rp=G((IT,tp)=>{tp.exports=require("util").deprecate});var y0=G((LT,lp)=>{"use strict";lp.exports=ot;function np(t){var e=this;this.next=null,this.entry=null,this.finish=function(){Ww(e,t)}}var Ro;ot.WritableState=h1;var bw={deprecate:rp()},sp=a0(),_u=require("buffer").Buffer,vw=global.Uint8Array||function(){};function ww(t){return _u.from(t)}function _w(t){return _u.isBuffer(t)||t instanceof vw}var g0=c0(),Sw=f0(),xw=Sw.getHighWaterMark,hn=fn().codes,Mw=hn.ERR_INVALID_ARG_TYPE,Ew=hn.ERR_METHOD_NOT_IMPLEMENTED,Rw=hn.ERR_MULTIPLE_CALLBACK,Cw=hn.ERR_STREAM_CANNOT_PIPE,Aw=hn.ERR_STREAM_DESTROYED,Tw=hn.ERR_STREAM_NULL_VALUES,Pw=hn.ERR_STREAM_WRITE_AFTER_END,Ow=hn.ERR_UNKNOWN_ENCODING,Co=g0.errorOrDestroy;Eo()(ot,sp);function Iw(){}function h1(t,e,r){Ro=Ro||as(),t=t||{},typeof r!="boolean"&&(r=e instanceof Ro),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=xw(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){jw(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 np(this)}h1.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(h1.prototype,"buffer",{get:bw.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var wu;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(wu=Function.prototype[Symbol.hasInstance],Object.defineProperty(ot,Symbol.hasInstance,{value:function(e){return wu.call(this,e)?!0:this!==ot?!1:e&&e._writableState instanceof h1}})):wu=function(e){return e instanceof this};function ot(t){Ro=Ro||as();var e=this instanceof Ro;if(!e&&!wu.call(ot,this))return new ot(t);this._writableState=new h1(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)),sp.call(this)}ot.prototype.pipe=function(){Co(this,new Cw)};function Lw(t,e){var r=new Pw;Co(t,r),process.nextTick(e,r)}function kw(t,e,r,i){var n;return r===null?n=new Tw:typeof r!="string"&&!e.objectMode&&(n=new Mw("chunk",["string","Buffer"],r)),n?(Co(t,n),process.nextTick(i,n),!1):!0}ot.prototype.write=function(t,e,r){var i=this._writableState,n=!1,o=!i.objectMode&&_w(t);return o&&!_u.isBuffer(t)&&(t=ww(t)),typeof e=="function"&&(r=e,e=null),o?e="buffer":e||(e=i.defaultEncoding),typeof r!="function"&&(r=Iw),i.ending?Lw(this,r):(o||kw(this,i,t,r))&&(i.pendingcb++,n=Bw(this,i,o,t,e,r)),n};ot.prototype.cork=function(){this._writableState.corked++};ot.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&op(this,t))};ot.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 Ow(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(ot.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function Nw(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=_u.from(e,r)),e}Object.defineProperty(ot.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Bw(t,e,r,i,n,o){if(!r){var a=Nw(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 p0(t,e,!1,c,i,n,o);return d}function p0(t,e,r,i,n,o,a){e.writelen=i,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new Aw("write")):r?t._writev(n,e.onwrite):t._write(n,o,e.onwrite),e.sync=!1}function Dw(t,e,r,i,n){--e.pendingcb,r?(process.nextTick(n,i),process.nextTick(f1,t,e),t._writableState.errorEmitted=!0,Co(t,i)):(n(i),t._writableState.errorEmitted=!0,Co(t,i),f1(t,e))}function zw(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}function jw(t,e){var r=t._writableState,i=r.sync,n=r.writecb;if(typeof n!="function")throw new Rw;if(zw(r),e)Dw(t,r,i,e,n);else{var o=ap(r)||t.destroyed;!o&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&op(t,r),i?process.nextTick(ip,t,r,o,n):ip(t,r,o,n)}}function ip(t,e,r,i){r||$w(t,e),e.pendingcb--,i(),f1(t,e)}function $w(t,e){e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}function op(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,p0(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 np(e),e.bufferedRequestCount=0}else{for(;r;){var d=r.chunk,p=r.encoding,m=r.callback,v=e.objectMode?1:d.length;if(p0(t,e,!1,v,d,p,m),r=r.next,e.bufferedRequestCount--,e.writing)break}r===null&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}ot.prototype._write=function(t,e,r){r(new Ew("_write()"))};ot.prototype._writev=null;ot.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||Hw(this,i,r),this};Object.defineProperty(ot.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function ap(t){return t.ending&&t.length===0&&t.bufferedRequest===null&&!t.finished&&!t.writing}function Fw(t,e){t._final(function(r){e.pendingcb--,r&&Co(t,r),e.prefinished=!0,t.emit("prefinish"),f1(t,e)})}function qw(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.pendingcb++,e.finalCalled=!0,process.nextTick(Fw,t,e)):(e.prefinished=!0,t.emit("prefinish")))}function f1(t,e){var r=ap(e);if(r&&(qw(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 Hw(t,e,r){e.ending=!0,f1(t,e),r&&(e.finished?process.nextTick(r):t.once("finish",r)),e.ended=!0,t.writable=!1}function Ww(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(ot.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){!this._writableState||(this._writableState.destroyed=e)}});ot.prototype.destroy=g0.destroy;ot.prototype._undestroy=g0.undestroy;ot.prototype._destroy=function(t,e){e(t)}});var as=G((kT,cp)=>{"use strict";var Uw=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};cp.exports=si;var up=w0(),v0=y0();Eo()(si,up);for(b0=Uw(v0.prototype),Su=0;Su<b0.length;Su++)xu=b0[Su],si.prototype[xu]||(si.prototype[xu]=v0.prototype[xu]);var b0,xu,Su;function si(t){if(!(this instanceof si))return new si(t);up.call(this,t),v0.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",Gw)))}Object.defineProperty(si.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});Object.defineProperty(si.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});Object.defineProperty(si.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function Gw(){this._writableState.ended||process.nextTick(Vw,this)}function Vw(t){t.end()}Object.defineProperty(si.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 dp=G((_0,hp)=>{var Mu=require("buffer"),oi=Mu.Buffer;function fp(t,e){for(var r in t)e[r]=t[r]}oi.from&&oi.alloc&&oi.allocUnsafe&&oi.allocUnsafeSlow?hp.exports=Mu:(fp(Mu,_0),_0.Buffer=ls);function ls(t,e,r){return oi(t,e,r)}ls.prototype=Object.create(oi.prototype);fp(oi,ls);ls.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return oi(t,e,r)};ls.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=oi(t);return e!==void 0?typeof r=="string"?i.fill(e,r):i.fill(e):i.fill(0),i};ls.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return oi(t)};ls.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Mu.SlowBuffer(t)}});var M0=G(pp=>{"use strict";var x0=dp().Buffer,mp=x0.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 Kw(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 Jw(t){var e=Kw(t);if(typeof e!="string"&&(x0.isEncoding===mp||!mp(t)))throw new Error("Unknown encoding: "+t);return e||t}pp.StringDecoder=d1;function d1(t){this.encoding=Jw(t);var e;switch(this.encoding){case"utf16le":this.text=t_,this.end=r_,e=4;break;case"utf8":this.fillLast=Xw,e=4;break;case"base64":this.text=i_,this.end=n_,e=3;break;default:this.write=s_,this.end=o_;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=x0.allocUnsafe(e)}d1.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||""};d1.prototype.end=e_;d1.prototype.text=Qw;d1.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 S0(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function Zw(t,e,r){var i=e.length-1;if(i<r)return 0;var n=S0(e[i]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--i<r||n===-2?0:(n=S0(e[i]),n>=0?(n>0&&(t.lastNeed=n-2),n):--i<r||n===-2?0:(n=S0(e[i]),n>=0?(n>0&&(n===2?n=0:t.lastNeed=n-3),n):0))}function Yw(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 Xw(t){var e=this.lastTotal-this.lastNeed,r=Yw(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function Qw(t,e){var r=Zw(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 e_(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function t_(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 r_(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 i_(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 n_(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function s_(t){return t.toString(this.encoding)}function o_(t){return t&&t.length?this.write(t):""}});var Eu=G((BT,bp)=>{"use strict";var gp=fn().codes.ERR_STREAM_PREMATURE_CLOSE;function a_(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 l_(){}function u_(t){return t.setHeader&&typeof t.abort=="function"}function yp(t,e,r){if(typeof e=="function")return yp(t,null,e);e||(e={}),r=a_(r||l_);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(b){r.call(t,b)},v=function(){var b;if(i&&!d)return(!t._readableState||!t._readableState.ended)&&(b=new gp),r.call(t,b);if(n&&!a)return(!t._writableState||!t._writableState.ended)&&(b=new gp),r.call(t,b)},E=function(){t.req.on("finish",c)};return u_(t)?(t.on("complete",c),t.on("abort",v),t.req?E():t.on("request",E)):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",v),function(){t.removeListener("complete",c),t.removeListener("abort",v),t.removeListener("request",E),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",v)}}bp.exports=yp});var wp=G((DT,vp)=>{"use strict";var Ru;function dn(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var c_=Eu(),mn=Symbol("lastResolve"),us=Symbol("lastReject"),m1=Symbol("error"),Cu=Symbol("ended"),cs=Symbol("lastPromise"),E0=Symbol("handlePromise"),fs=Symbol("stream");function pn(t,e){return{value:t,done:e}}function f_(t){var e=t[mn];if(e!==null){var r=t[fs].read();r!==null&&(t[cs]=null,t[mn]=null,t[us]=null,e(pn(r,!1)))}}function h_(t){process.nextTick(f_,t)}function d_(t,e){return function(r,i){t.then(function(){if(e[Cu]){r(pn(void 0,!0));return}e[E0](r,i)},i)}}var m_=Object.getPrototypeOf(function(){}),p_=Object.setPrototypeOf((Ru={get stream(){return this[fs]},next:function(){var e=this,r=this[m1];if(r!==null)return Promise.reject(r);if(this[Cu])return Promise.resolve(pn(void 0,!0));if(this[fs].destroyed)return new Promise(function(a,c){process.nextTick(function(){e[m1]?c(e[m1]):a(pn(void 0,!0))})});var i=this[cs],n;if(i)n=new Promise(d_(i,this));else{var o=this[fs].read();if(o!==null)return Promise.resolve(pn(o,!1));n=new Promise(this[E0])}return this[cs]=n,n}},dn(Ru,Symbol.asyncIterator,function(){return this}),dn(Ru,"return",function(){var e=this;return new Promise(function(r,i){e[fs].destroy(null,function(n){if(n){i(n);return}r(pn(void 0,!0))})})}),Ru),m_),g_=function(e){var r,i=Object.create(p_,(r={},dn(r,fs,{value:e,writable:!0}),dn(r,mn,{value:null,writable:!0}),dn(r,us,{value:null,writable:!0}),dn(r,m1,{value:null,writable:!0}),dn(r,Cu,{value:e._readableState.endEmitted,writable:!0}),dn(r,E0,{value:function(o,a){var c=i[fs].read();c?(i[cs]=null,i[mn]=null,i[us]=null,o(pn(c,!1))):(i[mn]=o,i[us]=a)},writable:!0}),r));return i[cs]=null,c_(e,function(n){if(n&&n.code!=="ERR_STREAM_PREMATURE_CLOSE"){var o=i[us];o!==null&&(i[cs]=null,i[mn]=null,i[us]=null,o(n)),i[m1]=n;return}var a=i[mn];a!==null&&(i[cs]=null,i[mn]=null,i[us]=null,a(pn(void 0,!0))),i[Cu]=!0}),e.on("readable",h_.bind(null,i)),i};vp.exports=g_});var Mp=G((zT,xp)=>{"use strict";function _p(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 y_(t){return function(){var e=this,r=arguments;return new Promise(function(i,n){var o=t.apply(e,r);function a(d){_p(o,i,n,a,c,"next",d)}function c(d){_p(o,i,n,a,c,"throw",d)}a(void 0)})}}function Sp(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 b_(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Sp(Object(r),!0).forEach(function(i){v_(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Sp(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function v_(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var w_=fn().codes.ERR_INVALID_ARG_TYPE;function __(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 w_("iterable",["Iterable"],e);var n=new t(b_({objectMode:!0},r)),o=!1;n._read=function(){o||(o=!0,a())};function a(){return c.apply(this,arguments)}function c(){return c=y_(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(v){n.destroy(v)}}),c.apply(this,arguments)}return n}xp.exports=__});var w0=G(($T,kp)=>{"use strict";kp.exports=Oe;var Ao;Oe.ReadableState=Ap;var jT=require("events").EventEmitter,Cp=function(e,r){return e.listeners(r).length},g1=a0(),Au=require("buffer").Buffer,S_=global.Uint8Array||function(){};function x_(t){return Au.from(t)}function M_(t){return Au.isBuffer(t)||t instanceof S_}var R0=require("util"),ve;R0&&R0.debuglog?ve=R0.debuglog("stream"):ve=function(){};var E_=Vm(),L0=c0(),R_=f0(),C_=R_.getHighWaterMark,Tu=fn().codes,A_=Tu.ERR_INVALID_ARG_TYPE,T_=Tu.ERR_STREAM_PUSH_AFTER_EOF,P_=Tu.ERR_METHOD_NOT_IMPLEMENTED,O_=Tu.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,To,C0,A0;Eo()(Oe,g1);var p1=L0.errorOrDestroy,T0=["error","close","destroy","pause","resume"];function I_(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 Ap(t,e,r){Ao=Ao||as(),t=t||{},typeof r!="boolean"&&(r=e instanceof Ao),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=C_(this,t,"readableHighWaterMark",r),this.buffer=new E_,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&&(To||(To=M0().StringDecoder),this.decoder=new To(t.encoding),this.encoding=t.encoding)}function Oe(t){if(Ao=Ao||as(),!(this instanceof Oe))return new Oe(t);var e=this instanceof Ao;this._readableState=new Ap(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),g1.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=L0.destroy;Oe.prototype._undestroy=L0.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=Au.from(t,e),e=""),i=!0),Tp(this,t,e,!1,i)};Oe.prototype.unshift=function(t){return Tp(this,t,null,!0,!1)};function Tp(t,e,r,i,n){ve("readableAddChunk",e);var o=t._readableState;if(e===null)o.reading=!1,N_(t,o);else{var a;if(n||(a=L_(o,e)),a)p1(t,a);else if(o.objectMode||e&&e.length>0)if(typeof e!="string"&&!o.objectMode&&Object.getPrototypeOf(e)!==Au.prototype&&(e=x_(e)),i)o.endEmitted?p1(t,new O_):P0(t,o,e,!0);else if(o.ended)p1(t,new T_);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||e.length!==0?P0(t,o,e,!1):I0(t,o)):P0(t,o,e,!1)}else i||(o.reading=!1,I0(t,o))}return!o.ended&&(o.length<o.highWaterMark||o.length===0)}function P0(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&&Pu(t)),I0(t,e)}function L_(t,e){var r;return!M_(e)&&typeof e!="string"&&e!==void 0&&!t.objectMode&&(r=new A_("chunk",["string","Buffer","Uint8Array"],e)),r}Oe.prototype.isPaused=function(){return this._readableState.flowing===!1};Oe.prototype.setEncoding=function(t){To||(To=M0().StringDecoder);var e=new To(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 Ep=1073741824;function k_(t){return t>=Ep?t=Ep:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function Rp(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=k_(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}Oe.prototype.read=function(t){ve("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 ve("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?O0(this):Pu(this),null;if(t=Rp(t,e),t===0&&e.ended)return e.length===0&&O0(this),null;var i=e.needReadable;ve("need readable",i),(e.length===0||e.length-t<e.highWaterMark)&&(i=!0,ve("length less than watermark",i)),e.ended||e.reading?(i=!1,ve("reading or ended",i)):i&&(ve("do read"),e.reading=!0,e.sync=!0,e.length===0&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=Rp(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&&O0(this)),n!==null&&this.emit("data",n),n};function N_(t,e){if(ve("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?Pu(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,Pp(t)))}}function Pu(t){var e=t._readableState;ve("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(ve("emitReadable",e.flowing),e.emittedReadable=!0,process.nextTick(Pp,t))}function Pp(t){var e=t._readableState;ve("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,k0(t)}function I0(t,e){e.readingMore||(e.readingMore=!0,process.nextTick(B_,t,e))}function B_(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){var r=e.length;if(ve("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}Oe.prototype._read=function(t){p1(this,new P_("_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,ve("pipe count=%d opts=%j",i.pipesCount,e);var n=(!e||e.end!==!1)&&t!==process.stdout&&t!==process.stderr,o=n?c:M;i.endEmitted?process.nextTick(o):r.once("end",o),t.on("unpipe",a);function a(T,C){ve("onunpipe"),T===r&&C&&C.hasUnpiped===!1&&(C.hasUnpiped=!0,m())}function c(){ve("onend"),t.end()}var d=D_(r);t.on("drain",d);var p=!1;function m(){ve("cleanup"),t.removeListener("close",w),t.removeListener("finish",b),t.removeListener("drain",d),t.removeListener("error",E),t.removeListener("unpipe",a),r.removeListener("end",c),r.removeListener("end",M),r.removeListener("data",v),p=!0,i.awaitDrain&&(!t._writableState||t._writableState.needDrain)&&d()}r.on("data",v);function v(T){ve("ondata");var C=t.write(T);ve("dest.write",C),C===!1&&((i.pipesCount===1&&i.pipes===t||i.pipesCount>1&&Lp(i.pipes,t)!==-1)&&!p&&(ve("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function E(T){ve("onerror",T),M(),t.removeListener("error",E),Cp(t,"error")===0&&p1(t,T)}I_(t,"error",E);function w(){t.removeListener("finish",b),M()}t.once("close",w);function b(){ve("onfinish"),t.removeListener("close",w),M()}t.once("finish",b);function M(){ve("unpipe"),r.unpipe(t)}return t.emit("pipe",r),i.flowing||(ve("pipe resume"),r.resume()),t};function D_(t){return function(){var r=t._readableState;ve("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&Cp(t,"data")&&(r.flowing=!0,k0(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=Lp(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=g1.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,ve("on readable",i.length,i.reading),i.length?Pu(this):i.reading||process.nextTick(z_,this)),r};Oe.prototype.addListener=Oe.prototype.on;Oe.prototype.removeListener=function(t,e){var r=g1.prototype.removeListener.call(this,t,e);return t==="readable"&&process.nextTick(Op,this),r};Oe.prototype.removeAllListeners=function(t){var e=g1.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&process.nextTick(Op,this),e};function Op(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 z_(t){ve("readable nexttick read 0"),t.read(0)}Oe.prototype.resume=function(){var t=this._readableState;return t.flowing||(ve("resume"),t.flowing=!t.readableListening,j_(this,t)),t.paused=!1,this};function j_(t,e){e.resumeScheduled||(e.resumeScheduled=!0,process.nextTick($_,t,e))}function $_(t,e){ve("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),k0(t),e.flowing&&!e.reading&&t.read(0)}Oe.prototype.pause=function(){return ve("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(ve("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function k0(t){var e=t._readableState;for(ve("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(ve("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(ve("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<T0.length;o++)t.on(T0[o],this.emit.bind(this,T0[o]));return this._read=function(a){ve("wrapped _read",a),i&&(i=!1,t.resume())},this};typeof Symbol=="function"&&(Oe.prototype[Symbol.asyncIterator]=function(){return C0===void 0&&(C0=wp()),C0(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 O0(t){var e=t._readableState;ve("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,process.nextTick(F_,e,t))}function F_(t,e){if(ve("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 A0===void 0&&(A0=Mp()),A0(Oe,t,e)});function Lp(t,e){for(var r=0,i=t.length;r<i;r++)if(t[r]===e)return r;return-1}});var N0=G((FT,Bp)=>{"use strict";Bp.exports=Ci;var Ou=fn().codes,q_=Ou.ERR_METHOD_NOT_IMPLEMENTED,H_=Ou.ERR_MULTIPLE_CALLBACK,W_=Ou.ERR_TRANSFORM_ALREADY_TRANSFORMING,U_=Ou.ERR_TRANSFORM_WITH_LENGTH_0,Iu=as();Eo()(Ci,Iu);function G_(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(i===null)return this.emit("error",new H_);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 Ci(t){if(!(this instanceof Ci))return new Ci(t);Iu.call(this,t),this._transformState={afterTransform:G_.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",V_)}function V_(){var t=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(e,r){Np(t,e,r)}):Np(this,null,null)}Ci.prototype.push=function(t,e){return this._transformState.needTransform=!1,Iu.prototype.push.call(this,t,e)};Ci.prototype._transform=function(t,e,r){r(new q_("_transform()"))};Ci.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)}};Ci.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};Ci.prototype._destroy=function(t,e){Iu.prototype._destroy.call(this,t,function(r){e(r)})};function Np(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 W_;return t.push(null)}});var jp=G((qT,zp)=>{"use strict";zp.exports=y1;var Dp=N0();Eo()(y1,Dp);function y1(t){if(!(this instanceof y1))return new y1(t);Dp.call(this,t)}y1.prototype._transform=function(t,e,r){r(null,t)}});var Wp=G((HT,Hp)=>{"use strict";var B0;function K_(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var qp=fn().codes,J_=qp.ERR_MISSING_ARGS,Z_=qp.ERR_STREAM_DESTROYED;function $p(t){if(t)throw t}function Y_(t){return t.setHeader&&typeof t.abort=="function"}function X_(t,e,r,i){i=K_(i);var n=!1;t.on("close",function(){n=!0}),B0===void 0&&(B0=Eu()),B0(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,Y_(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();i(a||new Z_("pipe"))}}}function Fp(t){t()}function Q_(t,e){return t.pipe(e)}function eS(t){return!t.length||typeof t[t.length-1]!="function"?$p:t.pop()}function tS(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var i=eS(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new J_("streams");var n,o=e.map(function(a,c){var d=c<e.length-1,p=c>0;return X_(a,d,p,function(m){n||(n=m),m&&o.forEach(Fp),!d&&(o.forEach(Fp),i(n))})});return e.reduce(Q_)}Hp.exports=tS});var Up=G((wr,v1)=>{var b1=require("stream");process.env.READABLE_STREAM==="disable"&&b1?(v1.exports=b1.Readable,Object.assign(v1.exports,b1),v1.exports.Stream=b1):(wr=v1.exports=w0(),wr.Stream=b1||wr,wr.Readable=wr,wr.Writable=y0(),wr.Duplex=as(),wr.Transform=N0(),wr.PassThrough=jp(),wr.finished=Eu(),wr.pipeline=Wp())});var Jp=G((WT,Kp)=>{"use strict";var{Transform:rS}=Up(),{StringDecoder:iS}=require("string_decoder"),gn=Symbol("last"),Lu=Symbol("decoder");function nS(t,e,r){var i;if(this.overflow){var n=this[Lu].write(t);if(i=n.split(this.matcher),i.length===1)return r();i.shift(),this.overflow=!1}else this[gn]+=this[Lu].write(t),i=this[gn].split(this.matcher);this[gn]=i.pop();for(var o=0;o<i.length;o++)Vp(this,this.mapper(i[o]));if(this.overflow=this[gn].length>this.maxLength,this.overflow&&!this.skipOverflow)return r(new Error("maximum buffer reached"));r()}function sS(t){this[gn]+=this[Lu].end(),this[gn]&&Vp(this,this.mapper(this[gn])),t()}function Vp(t,e){e!==void 0&&t.push(e)}function Gp(t){return t}function oS(t,e,r){switch(t=t||/\r?\n/,e=e||Gp,r=r||{},arguments.length){case 1:typeof t=="function"?(e=t,t=/\r?\n/):typeof t=="object"&&!(t instanceof RegExp)&&(r=t,t=/\r?\n/);break;case 2:typeof t=="function"?(r=e,e=t,t=/\r?\n/):typeof e=="object"&&(r=e,e=Gp)}r=Object.assign({},r),r.transform=nS,r.flush=sS,r.readableObjectMode=!0;let i=new rS(r);return i[gn]="",i[Lu]=new iS("utf8"),i.matcher=t,i.mapper=e,i.maxLength=r.maxLength,i.skipOverflow=r.skipOverflow,i.overflow=!1,i}Kp.exports=oS});var Io=G((Nu,Qp)=>{(function(t,e){typeof Nu=="object"&&typeof Qp<"u"?e(Nu):typeof define=="function"&&define.amd?define(["exports"],e):e(t.ULID={})})(Nu,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,N=void 0,z=void 0,U=i-1;!P&&L-->=0;){if(N=C[L],z=r.indexOf(N),z===-1)throw e("incorrectly encoded string");if(z===U){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,N="";P>0;P--)L=C%i,N=r.charAt(L)+N,C=(C-L)/i;return N}function v(C,P){for(var L="";C>0;C--)L=p(P)+L;return L}function E(C){if(C.length!==o+a)throw e("malformed ulid");var P=C.substr(0,o).split("").reverse().reduce(function(L,N,z){var U=r.indexOf(N);if(U===-1)throw e("invalid character found: "+N);return L+=U*Math.pow(i,z)},0);if(P>n)throw e("malformed ulid, timestamp too large");return P}function w(){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 N=require("crypto");return function(){return N.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 b(C){return C||(C=w()),function(L){return isNaN(L)&&(L=Date.now()),m(L,o)+v(a,C)}}function M(C){C||(C=w());var P=0,L=void 0;return function(z){if(isNaN(z)&&(z=Date.now()),z<=P){var U=L=d(L);return m(P,o)+U}P=z;var Z=L=v(a,C);return m(z,o)+Z}}var T=b();t.replaceCharAt=c,t.incrementBase32=d,t.randomChar=p,t.encodeTime=m,t.encodeRandom=v,t.decodeTime=E,t.detectPrng=w,t.factory=b,t.monotonicFactory=M,t.ulid=T,Object.defineProperty(t,"__esModule",{value:!0})})});var v9=G(Du=>{"use strict";Object.defineProperty(Du,"__esModule",{value:!0});Du.Nztm2000Quad=void 0;Du.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 w9=G(zu=>{"use strict";Object.defineProperty(zu,"__esModule",{value:!0});zu.Nztm2000=void 0;zu.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 _9=G(Do=>{"use strict";Object.defineProperty(Do,"__esModule",{value:!0});Do.Nztm2000=Do.Nztm2000Quad=void 0;var MS=v9();Object.defineProperty(Do,"Nztm2000Quad",{enumerable:!0,get:function(){return MS.Nztm2000Quad}});var ES=w9();Object.defineProperty(Do,"Nztm2000",{enumerable:!0,get:function(){return ES.Nztm2000}})});var x9=G((zO,S9)=>{"use strict";function PS(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(w){if(w instanceof Uint8Array||(ArrayBuffer.isView(w)?w=new Uint8Array(w.buffer,w.byteOffset,w.byteLength):Array.isArray(w)&&(w=Uint8Array.from(w))),!(w instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(w.length===0)return"";for(var b=0,M=0,T=0,C=w.length;T!==C&&w[T]===0;)T++,b++;for(var P=(C-T)*p+1>>>0,L=new Uint8Array(P);T!==C;){for(var N=w[T],z=0,U=P-1;(N!==0||z<M)&&U!==-1;U--,z++)N+=256*L[U]>>>0,L[U]=N%a>>>0,N=N/a>>>0;if(N!==0)throw new Error("Non-zero carry");M=z,T++}for(var Z=P-M;Z!==P&&L[Z]===0;)Z++;for(var ie=c.repeat(b);Z<P;++Z)ie+=t.charAt(L[Z]);return ie}function v(w){if(typeof w!="string")throw new TypeError("Expected String");if(w.length===0)return new Uint8Array;for(var b=0,M=0,T=0;w[b]===c;)M++,b++;for(var C=(w.length-b)*d+1>>>0,P=new Uint8Array(C);w[b];){var L=e[w.charCodeAt(b)];if(L===255)return;for(var N=0,z=C-1;(L!==0||N<T)&&z!==-1;z--,N++)L+=a*P[z]>>>0,P[z]=L%256>>>0,L=L/256>>>0;if(L!==0)throw new Error("Non-zero carry");T=N,b++}for(var U=C-T;U!==C&&P[U]===0;)U++;for(var Z=new Uint8Array(M+(C-U)),ie=M;U!==C;)Z[ie++]=P[U++];return Z}function E(w){var b=v(w);if(b)return b;throw new Error("Non-base"+a+" character")}return{encode:m,decodeUnsafe:v,decode:E}}S9.exports=PS});var P9=G((Gu,T9)=>{(function(t,e){typeof Gu=="object"&&typeof T9<"u"?e(Gu):typeof define=="function"&&define.amd?define(["exports"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.WebStreamsPolyfill={}))})(Gu,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 v(u){return new c(u)}function E(u){return p(u)}function w(u){return m(u)}function b(u,h,x){return d.call(u,h,x)}function M(u,h,x){b(b(u,h,x),void 0,a)}function T(u,h){M(u,h)}function C(u,h){M(u,void 0,h)}function P(u,h,x){return b(u,h,x)}function L(u){b(u,void 0,a)}let N=(()=>{let u=n&&n.queueMicrotask;if(typeof u=="function")return u;let h=E(void 0);return x=>b(h,x)})();function z(u,h,x){if(typeof u!="function")throw new TypeError("Argument is not a function");return Function.prototype.apply.call(u,h,x)}function U(u,h,x){try{return E(z(u,h,x))}catch(O){return w(O)}}let Z=16384;class ie{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(h){let x=this._back,O=x;x._elements.length===Z-1&&(O={_elements:[],_next:void 0}),x._elements.push(h),O!==x&&(this._back=O,x._next=O),++this._size}shift(){let h=this._front,x=h,O=this._cursor,B=O+1,$=h._elements,q=$[O];return B===Z&&(x=h._next,B=0),--this._size,this._cursor=B,h!==x&&(this._front=x),$[O]=void 0,q}forEach(h){let x=this._cursor,O=this._front,B=O._elements;for(;(x!==B.length||O._next!==void 0)&&!(x===B.length&&(O=O._next,B=O._elements,x=0,B.length===0));)h(B[x]),++x}peek(){let h=this._front,x=this._cursor;return h._elements[x]}}function ge(u,h){u._ownerReadableStream=h,h._reader=u,h._state==="readable"?tt(u):h._state==="closed"?dr(u):pt(u,h._storedError)}function De(u,h){let x=u._ownerReadableStream;return nr(x,h)}function Me(u){u._ownerReadableStream._state==="readable"?Bn(u,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):Ca(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 ke(u){return new TypeError("Cannot "+u+" a stream using a released reader")}function tt(u){u._closedPromise=v((h,x)=>{u._closedPromise_resolve=h,u._closedPromise_reject=x})}function pt(u,h){tt(u),Bn(u,h)}function dr(u){tt(u),Dn(u)}function Bn(u,h){u._closedPromise_reject!==void 0&&(L(u._closedPromise),u._closedPromise_reject(h),u._closedPromise_resolve=void 0,u._closedPromise_reject=void 0)}function Ca(u,h){pt(u,h)}function Dn(u){u._closedPromise_resolve!==void 0&&(u._closedPromise_resolve(void 0),u._closedPromise_resolve=void 0,u._closedPromise_reject=void 0)}let Aa=e("[[AbortSteps]]"),mr=e("[[ErrorSteps]]"),Ta=e("[[CancelSteps]]"),js=e("[[PullSteps]]"),gi=Number.isFinite||function(u){return typeof u=="number"&&isFinite(u)},lf=Math.trunc||function(u){return u<0?Math.ceil(u):Math.floor(u)};function uf(u){return typeof u=="object"||typeof u=="function"}function ft(u,h){if(u!==void 0&&!uf(u))throw new TypeError(`${h} is not an object.`)}function rr(u,h){if(typeof u!="function")throw new TypeError(`${h} is not a function.`)}function il(u){return typeof u=="object"&&u!==null||typeof u=="function"}function gt(u,h){if(!il(u))throw new TypeError(`${h} is not an object.`)}function Lr(u,h,x){if(u===void 0)throw new TypeError(`Parameter ${h} is required in '${x}'.`)}function Pa(u,h,x){if(u===void 0)throw new TypeError(`${h} is required in '${x}'.`)}function Oa(u){return Number(u)}function nl(u){return u===0?0:u}function cf(u){return nl(lf(u))}function sl(u,h){let O=Number.MAX_SAFE_INTEGER,B=Number(u);if(B=nl(B),!gi(B))throw new TypeError(`${h} is not a finite number`);if(B=cf(B),B<0||B>O)throw new TypeError(`${h} is outside the accepted range of ${0} to ${O}, inclusive`);return!gi(B)||B===0?0:B}function Ia(u,h){if(!Xr(u))throw new TypeError(`${h} is not a ReadableStream.`)}function Hi(u){return new Y(u)}function ol(u,h){u._reader._readRequests.push(h)}function $s(u,h,x){let B=u._reader._readRequests.shift();x?B._closeSteps():B._chunkSteps(h)}function kt(u){return u._reader._readRequests.length}function Wi(u){let h=u._reader;return!(h===void 0||!ct(h))}class Y{constructor(h){if(Lr(h,1,"ReadableStreamDefaultReader"),Ia(h,"First parameter"),Qr(h))throw new TypeError("This stream has already been locked for exclusive reading by another reader");ge(this,h),this._readRequests=new ie}get closed(){return ct(this)?this._closedPromise:w(Fs("closed"))}cancel(h=void 0){return ct(this)?this._ownerReadableStream===void 0?w(ke("cancel")):De(this,h):w(Fs("cancel"))}read(){if(!ct(this))return w(Fs("read"));if(this._ownerReadableStream===void 0)return w(ke("read from"));let h,x,O=v(($,q)=>{h=$,x=q});return kr(this,{_chunkSteps:$=>h({value:$,done:!1}),_closeSteps:()=>h({value:void 0,done:!0}),_errorSteps:$=>x($)}),O}releaseLock(){if(!ct(this))throw Fs("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");Me(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 kr(u,h){let x=u._ownerReadableStream;x._disturbed=!0,x._state==="closed"?h._closeSteps():x._state==="errored"?h._errorSteps(x._storedError):x._readableStreamController[js](h)}function Fs(u){return new TypeError(`ReadableStreamDefaultReader.prototype.${u} can only be used on a ReadableStreamDefaultReader`)}let al=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class ll{constructor(h,x){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=h,this._preventCancel=x}next(){let h=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?P(this._ongoingPromise,h,h):h(),this._ongoingPromise}return(h){let x=()=>this._returnSteps(h);return this._ongoingPromise?P(this._ongoingPromise,x,x):x()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});let h=this._reader;if(h._ownerReadableStream===void 0)return w(ke("iterate"));let x,O,B=v((q,te)=>{x=q,O=te});return kr(h,{_chunkSteps:q=>{this._ongoingPromise=void 0,N(()=>x({value:q,done:!1}))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,Me(h),x({value:void 0,done:!0})},_errorSteps:q=>{this._ongoingPromise=void 0,this._isFinished=!0,Me(h),O(q)}}),B}_returnSteps(h){if(this._isFinished)return Promise.resolve({value:h,done:!0});this._isFinished=!0;let x=this._reader;if(x._ownerReadableStream===void 0)return w(ke("finish iterating"));if(!this._preventCancel){let O=De(x,h);return Me(x),P(O,()=>({value:h,done:!0}))}return Me(x),E({value:h,done:!0})}}let ul={next(){return cl(this)?this._asyncIteratorImpl.next():w(La("next"))},return(u){return cl(this)?this._asyncIteratorImpl.return(u):w(La("return"))}};al!==void 0&&Object.setPrototypeOf(ul,al);function ff(u,h){let x=Hi(u),O=new ll(x,h),B=Object.create(ul);return B._asyncIteratorImpl=O,B}function cl(u){if(!o(u)||!Object.prototype.hasOwnProperty.call(u,"_asyncIteratorImpl"))return!1;try{return u._asyncIteratorImpl instanceof ll}catch{return!1}}function La(u){return new TypeError(`ReadableStreamAsyncIterator.${u} can only be used on a ReadableSteamAsyncIterator`)}let fl=Number.isNaN||function(u){return u!==u};function zn(u){return u.slice()}function hl(u,h,x,O,B){new Uint8Array(u).set(new Uint8Array(x,O,B),h)}function ka(u){return u}function yi(u){return!1}function Na(u,h,x){if(u.slice)return u.slice(h,x);let O=x-h,B=new ArrayBuffer(O);return hl(B,0,u,h,O),B}function hf(u){return!(typeof u!="number"||fl(u)||u<0)}function dl(u){let h=Na(u.buffer,u.byteOffset,u.byteOffset+u.byteLength);return new Uint8Array(h)}function Ba(u){let h=u._queue.shift();return u._queueTotalSize-=h.size,u._queueTotalSize<0&&(u._queueTotalSize=0),h.value}function ue(u,h,x){if(!hf(x)||x===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");u._queue.push({value:h,size:x}),u._queueTotalSize+=x}function df(u){return u._queue.peek().value}function Vr(u){u._queue=new ie,u._queueTotalSize=0}class jn{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!qs(this))throw Ui("view");return this._view}respond(h){if(!qs(this))throw Ui("respond");if(Lr(h,1,"respond"),h=sl(h,"First parameter"),this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");yi(this._view.buffer),Fn(this._associatedReadableByteStreamController,h)}respondWithNewView(h){if(!qs(this))throw Ui("respondWithNewView");if(Lr(h,1,"respondWithNewView"),!ArrayBuffer.isView(h))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");yi(h.buffer),qn(this._associatedReadableByteStreamController,h)}}Object.defineProperties(jn.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(jn.prototype,e.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class Ye{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!bi(this))throw Gi("byobRequest");return $a(this)}get desiredSize(){if(!bi(this))throw Gi("desiredSize");return Fa(this)}close(){if(!bi(this))throw Gi("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");let h=this._controlledReadableByteStream._state;if(h!=="readable")throw new TypeError(`The stream (in ${h} state) is not in the readable state and cannot be closed`);Kr(this)}enqueue(h){if(!bi(this))throw Gi("enqueue");if(Lr(h,1,"enqueue"),!ArrayBuffer.isView(h))throw new TypeError("chunk must be an array buffer view");if(h.byteLength===0)throw new TypeError("chunk must have non-zero byteLength");if(h.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 x=this._controlledReadableByteStream._state;if(x!=="readable")throw new TypeError(`The stream (in ${x} state) is not in the readable state and cannot be enqueued to`);Gs(this,h)}error(h=void 0){if(!bi(this))throw Gi("error");Ut(this,h)}[Ta](h){ml(this),Vr(this);let x=this._cancelAlgorithm(h);return Us(this),x}[js](h){let x=this._controlledReadableByteStream;if(this._queueTotalSize>0){let B=this._queue.shift();this._queueTotalSize-=B.byteLength,gl(this);let $=new Uint8Array(B.buffer,B.byteOffset,B.byteLength);h._chunkSteps($);return}let O=this._autoAllocateChunkSize;if(O!==void 0){let B;try{B=new ArrayBuffer(O)}catch(q){h._errorSteps(q);return}let $={buffer:B,bufferByteLength:O,byteOffset:0,byteLength:O,bytesFilled:0,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push($)}ol(x,h),vi(this)}}Object.defineProperties(Ye.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Ye.prototype,e.toStringTag,{value:"ReadableByteStreamController",configurable:!0});function bi(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_controlledReadableByteStream")?!1:u instanceof Ye}function qs(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_associatedReadableByteStreamController")?!1:u instanceof jn}function vi(u){if(!gf(u))return;if(u._pulling){u._pullAgain=!0;return}u._pulling=!0;let x=u._pullAlgorithm();M(x,()=>{u._pulling=!1,u._pullAgain&&(u._pullAgain=!1,vi(u))},O=>{Ut(u,O)})}function ml(u){za(u),u._pendingPullIntos=new ie}function Da(u,h){let x=!1;u._state==="closed"&&(x=!0);let O=wi(h);h.readerType==="default"?$s(u,O,x):Nt(u,O,x)}function wi(u){let h=u.bytesFilled,x=u.elementSize;return new u.viewConstructor(u.buffer,u.byteOffset,h/x)}function Hs(u,h,x,O){u._queue.push({buffer:h,byteOffset:x,byteLength:O}),u._queueTotalSize+=O}function pl(u,h){let x=h.elementSize,O=h.bytesFilled-h.bytesFilled%x,B=Math.min(u._queueTotalSize,h.byteLength-h.bytesFilled),$=h.bytesFilled+B,q=$-$%x,te=B,he=!1;q>O&&(te=q-h.bytesFilled,he=!0);let _e=u._queue;for(;te>0;){let Te=_e.peek(),Pe=Math.min(te,Te.byteLength),nt=h.byteOffset+h.bytesFilled;hl(h.buffer,nt,Te.buffer,Te.byteOffset,Pe),Te.byteLength===Pe?_e.shift():(Te.byteOffset+=Pe,Te.byteLength-=Pe),u._queueTotalSize-=Pe,Ws(u,Pe,h),te-=Pe}return he}function Ws(u,h,x){x.bytesFilled+=h}function gl(u){u._queueTotalSize===0&&u._closeRequested?(Us(u),Xn(u._controlledReadableByteStream)):vi(u)}function za(u){u._byobRequest!==null&&(u._byobRequest._associatedReadableByteStreamController=void 0,u._byobRequest._view=null,u._byobRequest=null)}function yl(u){for(;u._pendingPullIntos.length>0;){if(u._queueTotalSize===0)return;let h=u._pendingPullIntos.peek();pl(u,h)&&($n(u),Da(u._controlledReadableByteStream,h))}}function mf(u,h,x){let O=u._controlledReadableByteStream,B=1;h.constructor!==DataView&&(B=h.constructor.BYTES_PER_ELEMENT);let $=h.constructor,q=h.buffer,te={buffer:q,bufferByteLength:q.byteLength,byteOffset:h.byteOffset,byteLength:h.byteLength,bytesFilled:0,elementSize:B,viewConstructor:$,readerType:"byob"};if(u._pendingPullIntos.length>0){u._pendingPullIntos.push(te),qa(O,x);return}if(O._state==="closed"){let he=new $(te.buffer,te.byteOffset,0);x._closeSteps(he);return}if(u._queueTotalSize>0){if(pl(u,te)){let he=wi(te);gl(u),x._chunkSteps(he);return}if(u._closeRequested){let he=new TypeError("Insufficient bytes to fill elements in the given buffer");Ut(u,he),x._errorSteps(he);return}}u._pendingPullIntos.push(te),qa(O,x),vi(u)}function pr(u,h){let x=u._controlledReadableByteStream;if(Ks(x))for(;Ha(x)>0;){let O=$n(u);Da(x,O)}}function pf(u,h,x){if(Ws(u,h,x),x.bytesFilled<x.elementSize)return;$n(u);let O=x.bytesFilled%x.elementSize;if(O>0){let B=x.byteOffset+x.bytesFilled,$=Na(x.buffer,B-O,B);Hs(u,$,0,$.byteLength)}x.bytesFilled-=O,Da(u._controlledReadableByteStream,x),yl(u)}function ja(u,h){let x=u._pendingPullIntos.peek();za(u),u._controlledReadableByteStream._state==="closed"?pr(u):pf(u,h,x),vi(u)}function $n(u){return u._pendingPullIntos.shift()}function gf(u){let h=u._controlledReadableByteStream;return h._state!=="readable"||u._closeRequested||!u._started?!1:!!(Wi(h)&&kt(h)>0||Ks(h)&&Ha(h)>0||Fa(u)>0)}function Us(u){u._pullAlgorithm=void 0,u._cancelAlgorithm=void 0}function Kr(u){let h=u._controlledReadableByteStream;if(!(u._closeRequested||h._state!=="readable")){if(u._queueTotalSize>0){u._closeRequested=!0;return}if(u._pendingPullIntos.length>0&&u._pendingPullIntos.peek().bytesFilled>0){let O=new TypeError("Insufficient bytes to fill elements in the given buffer");throw Ut(u,O),O}Us(u),Xn(h)}}function Gs(u,h){let x=u._controlledReadableByteStream;if(u._closeRequested||x._state!=="readable")return;let O=h.buffer,B=h.byteOffset,$=h.byteLength,q=O;if(u._pendingPullIntos.length>0){let te=u._pendingPullIntos.peek();yi(te.buffer),te.buffer=te.buffer}if(za(u),Wi(x))if(kt(x)===0)Hs(u,q,B,$);else{u._pendingPullIntos.length>0&&$n(u);let te=new Uint8Array(q,B,$);$s(x,te,!1)}else Ks(x)?(Hs(u,q,B,$),yl(u)):Hs(u,q,B,$);vi(u)}function Ut(u,h){let x=u._controlledReadableByteStream;x._state==="readable"&&(ml(u),Vr(u),Us(u),Fl(x,h))}function $a(u){if(u._byobRequest===null&&u._pendingPullIntos.length>0){let h=u._pendingPullIntos.peek(),x=new Uint8Array(h.buffer,h.byteOffset+h.bytesFilled,h.byteLength-h.bytesFilled),O=Object.create(jn.prototype);yf(O,u,x),u._byobRequest=O}return u._byobRequest}function Fa(u){let h=u._controlledReadableByteStream._state;return h==="errored"?null:h==="closed"?0:u._strategyHWM-u._queueTotalSize}function Fn(u,h){let x=u._pendingPullIntos.peek();if(u._controlledReadableByteStream._state==="closed"){if(h!==0)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(h===0)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(x.bytesFilled+h>x.byteLength)throw new RangeError("bytesWritten out of range")}x.buffer=x.buffer,ja(u,h)}function qn(u,h){let x=u._pendingPullIntos.peek();if(u._controlledReadableByteStream._state==="closed"){if(h.byteLength!==0)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(h.byteLength===0)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(x.byteOffset+x.bytesFilled!==h.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(x.bufferByteLength!==h.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(x.bytesFilled+h.byteLength>x.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");let B=h.byteLength;x.buffer=h.buffer,ja(u,B)}function bl(u,h,x,O,B,$,q){h._controlledReadableByteStream=u,h._pullAgain=!1,h._pulling=!1,h._byobRequest=null,h._queue=h._queueTotalSize=void 0,Vr(h),h._closeRequested=!1,h._started=!1,h._strategyHWM=$,h._pullAlgorithm=O,h._cancelAlgorithm=B,h._autoAllocateChunkSize=q,h._pendingPullIntos=new ie,u._readableStreamController=h;let te=x();M(E(te),()=>{h._started=!0,vi(h)},he=>{Ut(h,he)})}function vl(u,h,x){let O=Object.create(Ye.prototype),B=()=>{},$=()=>E(void 0),q=()=>E(void 0);h.start!==void 0&&(B=()=>h.start(O)),h.pull!==void 0&&($=()=>h.pull(O)),h.cancel!==void 0&&(q=he=>h.cancel(he));let te=h.autoAllocateChunkSize;if(te===0)throw new TypeError("autoAllocateChunkSize must be greater than 0");bl(u,O,B,$,q,x,te)}function yf(u,h,x){u._associatedReadableByteStreamController=h,u._view=x}function Ui(u){return new TypeError(`ReadableStreamBYOBRequest.prototype.${u} can only be used on a ReadableStreamBYOBRequest`)}function Gi(u){return new TypeError(`ReadableByteStreamController.prototype.${u} can only be used on a ReadableByteStreamController`)}function Vs(u){return new Vi(u)}function qa(u,h){u._reader._readIntoRequests.push(h)}function Nt(u,h,x){let B=u._reader._readIntoRequests.shift();x?B._closeSteps(h):B._chunkSteps(h)}function Ha(u){return u._reader._readIntoRequests.length}function Ks(u){let h=u._reader;return!(h===void 0||!Gt(h))}class Vi{constructor(h){if(Lr(h,1,"ReadableStreamBYOBReader"),Ia(h,"First parameter"),Qr(h))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!bi(h._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");ge(this,h),this._readIntoRequests=new ie}get closed(){return Gt(this)?this._closedPromise:w(vt("closed"))}cancel(h=void 0){return Gt(this)?this._ownerReadableStream===void 0?w(ke("cancel")):De(this,h):w(vt("cancel"))}read(h){if(!Gt(this))return w(vt("read"));if(!ArrayBuffer.isView(h))return w(new TypeError("view must be an array buffer view"));if(h.byteLength===0)return w(new TypeError("view must have non-zero byteLength"));if(h.buffer.byteLength===0)return w(new TypeError("view's buffer must have non-zero byteLength"));if(yi(h.buffer),this._ownerReadableStream===void 0)return w(ke("read from"));let x,O,B=v((q,te)=>{x=q,O=te});return bt(this,h,{_chunkSteps:q=>x({value:q,done:!1}),_closeSteps:q=>x({value:q,done:!0}),_errorSteps:q=>O(q)}),B}releaseLock(){if(!Gt(this))throw vt("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");Me(this)}}}Object.defineProperties(Vi.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Vi.prototype,e.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});function Gt(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_readIntoRequests")?!1:u instanceof Vi}function bt(u,h,x){let O=u._ownerReadableStream;O._disturbed=!0,O._state==="errored"?x._errorSteps(O._storedError):mf(O._readableStreamController,h,x)}function vt(u){return new TypeError(`ReadableStreamBYOBReader.prototype.${u} can only be used on a ReadableStreamBYOBReader`)}function Nr(u,h){let{highWaterMark:x}=u;if(x===void 0)return h;if(fl(x)||x<0)throw new RangeError("Invalid highWaterMark");return x}function Jr(u){let{size:h}=u;return h||(()=>1)}function Js(u,h){ft(u,h);let x=u?.highWaterMark,O=u?.size;return{highWaterMark:x===void 0?void 0:Oa(x),size:O===void 0?void 0:wl(O,`${h} has member 'size' that`)}}function wl(u,h){return rr(u,h),x=>Oa(u(x))}function bf(u,h){ft(u,h);let x=u?.abort,O=u?.close,B=u?.start,$=u?.type,q=u?.write;return{abort:x===void 0?void 0:_l(x,u,`${h} has member 'abort' that`),close:O===void 0?void 0:Wa(O,u,`${h} has member 'close' that`),start:B===void 0?void 0:Sl(B,u,`${h} has member 'start' that`),write:q===void 0?void 0:vf(q,u,`${h} has member 'write' that`),type:$}}function _l(u,h,x){return rr(u,x),O=>U(u,h,[O])}function Wa(u,h,x){return rr(u,x),()=>U(u,h,[])}function Sl(u,h,x){return rr(u,x),O=>z(u,h,[O])}function vf(u,h,x){return rr(u,x),(O,B)=>U(u,h,[O,B])}function Zs(u,h){if(!Ji(u))throw new TypeError(`${h} is not a WritableStream.`)}function wf(u){if(typeof u!="object"||u===null)return!1;try{return typeof u.aborted=="boolean"}catch{return!1}}let _f=typeof AbortController=="function";function Sf(){if(_f)return new AbortController}class Ki{constructor(h={},x={}){h===void 0?h=null:gt(h,"First parameter");let O=Js(x,"Second parameter"),B=bf(h,"First parameter");if(El(this),B.type!==void 0)throw new RangeError("Invalid type is specified");let q=Jr(O),te=Nr(O,1);If(this,B,te,q)}get locked(){if(!Ji(this))throw no("locked");return Zi(this)}abort(h=void 0){return Ji(this)?Zi(this)?w(new TypeError("Cannot abort a stream that already has a writer")):Br(this,h):w(no("abort"))}close(){return Ji(this)?Zi(this)?w(new TypeError("Cannot close a stream that already has a writer")):gr(this)?w(new TypeError("Cannot close an already-closing stream")):Rl(this):w(no("close"))}getWriter(){if(!Ji(this))throw no("getWriter");return xl(this)}}Object.defineProperties(Ki.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Ki.prototype,e.toStringTag,{value:"WritableStream",configurable:!0});function xl(u){return new Yi(u)}function Ml(u,h,x,O,B=1,$=()=>1){let q=Object.create(Ki.prototype);El(q);let te=Object.create(Xi.prototype);return Ka(q,te,u,h,x,O,B,$),q}function El(u){u._state="writable",u._storedError=void 0,u._writer=void 0,u._writableStreamController=void 0,u._writeRequests=new ie,u._inFlightWriteRequest=void 0,u._closeRequest=void 0,u._inFlightCloseRequest=void 0,u._pendingAbortRequest=void 0,u._backpressure=!1}function Ji(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_writableStreamController")?!1:u instanceof Ki}function Zi(u){return u._writer!==void 0}function Br(u,h){var x;if(u._state==="closed"||u._state==="errored")return E(void 0);u._writableStreamController._abortReason=h,(x=u._writableStreamController._abortController)===null||x===void 0||x.abort();let O=u._state;if(O==="closed"||O==="errored")return E(void 0);if(u._pendingAbortRequest!==void 0)return u._pendingAbortRequest._promise;let B=!1;O==="erroring"&&(B=!0,h=void 0);let $=v((q,te)=>{u._pendingAbortRequest={_promise:void 0,_resolve:q,_reject:te,_reason:h,_wasAlreadyErroring:B}});return u._pendingAbortRequest._promise=$,B||Xs(u,h),$}function Rl(u){let h=u._state;if(h==="closed"||h==="errored")return w(new TypeError(`The stream (in ${h} state) is not in the writable state and cannot be closed`));let x=v((B,$)=>{let q={_resolve:B,_reject:$};u._closeRequest=q}),O=u._writer;return O!==void 0&&u._backpressure&&h==="writable"&&Qa(O),Lf(u._writableStreamController),x}function xf(u){return v((x,O)=>{let B={_resolve:x,_reject:O};u._writeRequests.push(B)})}function Ys(u,h){if(u._state==="writable"){Xs(u,h);return}Qs(u)}function Xs(u,h){let x=u._writableStreamController;u._state="erroring",u._storedError=h;let O=u._writer;O!==void 0&&Ga(O,h),!Af(u)&&x._started&&Qs(u)}function Qs(u){u._state="errored",u._writableStreamController[mr]();let h=u._storedError;if(u._writeRequests.forEach(B=>{B._reject(h)}),u._writeRequests=new ie,u._pendingAbortRequest===void 0){_i(u);return}let x=u._pendingAbortRequest;if(u._pendingAbortRequest=void 0,x._wasAlreadyErroring){x._reject(h),_i(u);return}let O=u._writableStreamController[Aa](x._reason);M(O,()=>{x._resolve(),_i(u)},B=>{x._reject(B),_i(u)})}function Mf(u){u._inFlightWriteRequest._resolve(void 0),u._inFlightWriteRequest=void 0}function Ef(u,h){u._inFlightWriteRequest._reject(h),u._inFlightWriteRequest=void 0,Ys(u,h)}function Rf(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 x=u._writer;x!==void 0&&Ll(x)}function Cf(u,h){u._inFlightCloseRequest._reject(h),u._inFlightCloseRequest=void 0,u._pendingAbortRequest!==void 0&&(u._pendingAbortRequest._reject(h),u._pendingAbortRequest=void 0),Ys(u,h)}function gr(u){return!(u._closeRequest===void 0&&u._inFlightCloseRequest===void 0)}function Af(u){return!(u._inFlightWriteRequest===void 0&&u._inFlightCloseRequest===void 0)}function Tf(u){u._inFlightCloseRequest=u._closeRequest,u._closeRequest=void 0}function Cl(u){u._inFlightWriteRequest=u._writeRequests.shift()}function _i(u){u._closeRequest!==void 0&&(u._closeRequest._reject(u._storedError),u._closeRequest=void 0);let h=u._writer;h!==void 0&&Ya(h,u._storedError)}function Ua(u,h){let x=u._writer;x!==void 0&&h!==u._backpressure&&(h?$f(x):Qa(x)),u._backpressure=h}class Yi{constructor(h){if(Lr(h,1,"WritableStreamDefaultWriter"),Zs(h,"First parameter"),Zi(h))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=h,h._writer=this;let x=h._state;if(x==="writable")!gr(h)&&h._backpressure?so(this):kl(this),Qi(this);else if(x==="erroring")Xa(this,h._storedError),Qi(this);else if(x==="closed")kl(this),zf(this);else{let O=h._storedError;Xa(this,O),Il(this,O)}}get closed(){return Si(this)?this._closedPromise:w(xi("closed"))}get desiredSize(){if(!Si(this))throw xi("desiredSize");if(this._ownerWritableStream===void 0)throw Un("desiredSize");return ir(this)}get ready(){return Si(this)?this._readyPromise:w(xi("ready"))}abort(h=void 0){return Si(this)?this._ownerWritableStream===void 0?w(Un("abort")):Pf(this,h):w(xi("abort"))}close(){if(!Si(this))return w(xi("close"));let h=this._ownerWritableStream;return h===void 0?w(Un("close")):gr(h)?w(new TypeError("Cannot close an already-closing stream")):Al(this)}releaseLock(){if(!Si(this))throw xi("releaseLock");this._ownerWritableStream!==void 0&&Tl(this)}write(h=void 0){return Si(this)?this._ownerWritableStream===void 0?w(Un("write to")):Pl(this,h):w(xi("write"))}}Object.defineProperties(Yi.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(Yi.prototype,e.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});function Si(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_ownerWritableStream")?!1:u instanceof Yi}function Pf(u,h){let x=u._ownerWritableStream;return Br(x,h)}function Al(u){let h=u._ownerWritableStream;return Rl(h)}function Of(u){let h=u._ownerWritableStream,x=h._state;return gr(h)||x==="closed"?E(void 0):x==="errored"?w(h._storedError):Al(u)}function eo(u,h){u._closedPromiseState==="pending"?Ya(u,h):jf(u,h)}function Ga(u,h){u._readyPromiseState==="pending"?Nl(u,h):Ff(u,h)}function ir(u){let h=u._ownerWritableStream,x=h._state;return x==="errored"||x==="erroring"?null:x==="closed"?0:Hn(h._writableStreamController)}function Tl(u){let h=u._ownerWritableStream,x=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");Ga(u,x),eo(u,x),h._writer=void 0,u._ownerWritableStream=void 0}function Pl(u,h){let x=u._ownerWritableStream,O=x._writableStreamController,B=kf(O,h);if(x!==u._ownerWritableStream)return w(Un("write to"));let $=x._state;if($==="errored")return w(x._storedError);if(gr(x)||$==="closed")return w(new TypeError("The stream is closing or closed and cannot be written to"));if($==="erroring")return w(x._storedError);let q=xf(x);return Nf(O,h,B),q}let to={};class Xi{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!Va(this))throw Za("abortReason");return this._abortReason}get signal(){if(!Va(this))throw Za("signal");if(this._abortController===void 0)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(h=void 0){if(!Va(this))throw Za("error");this._controlledWritableStream._state==="writable"&&Ol(this,h)}[Aa](h){let x=this._abortAlgorithm(h);return ro(this),x}[mr](){Vr(this)}}Object.defineProperties(Xi.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Xi.prototype,e.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});function Va(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_controlledWritableStream")?!1:u instanceof Xi}function Ka(u,h,x,O,B,$,q,te){h._controlledWritableStream=u,u._writableStreamController=h,h._queue=void 0,h._queueTotalSize=void 0,Vr(h),h._abortReason=void 0,h._abortController=Sf(),h._started=!1,h._strategySizeAlgorithm=te,h._strategyHWM=q,h._writeAlgorithm=O,h._closeAlgorithm=B,h._abortAlgorithm=$;let he=Wn(h);Ua(u,he);let _e=x(),Te=E(_e);M(Te,()=>{h._started=!0,io(h)},Pe=>{h._started=!0,Ys(u,Pe)})}function If(u,h,x,O){let B=Object.create(Xi.prototype),$=()=>{},q=()=>E(void 0),te=()=>E(void 0),he=()=>E(void 0);h.start!==void 0&&($=()=>h.start(B)),h.write!==void 0&&(q=_e=>h.write(_e,B)),h.close!==void 0&&(te=()=>h.close()),h.abort!==void 0&&(he=_e=>h.abort(_e)),Ka(u,B,$,q,te,he,x,O)}function ro(u){u._writeAlgorithm=void 0,u._closeAlgorithm=void 0,u._abortAlgorithm=void 0,u._strategySizeAlgorithm=void 0}function Lf(u){ue(u,to,0),io(u)}function kf(u,h){try{return u._strategySizeAlgorithm(h)}catch(x){return Ja(u,x),1}}function Hn(u){return u._strategyHWM-u._queueTotalSize}function Nf(u,h,x){try{ue(u,h,x)}catch(B){Ja(u,B);return}let O=u._controlledWritableStream;if(!gr(O)&&O._state==="writable"){let B=Wn(u);Ua(O,B)}io(u)}function io(u){let h=u._controlledWritableStream;if(!u._started||h._inFlightWriteRequest!==void 0)return;if(h._state==="erroring"){Qs(h);return}if(u._queue.length===0)return;let O=df(u);O===to?Bf(u):Df(u,O)}function Ja(u,h){u._controlledWritableStream._state==="writable"&&Ol(u,h)}function Bf(u){let h=u._controlledWritableStream;Tf(h),Ba(u);let x=u._closeAlgorithm();ro(u),M(x,()=>{Rf(h)},O=>{Cf(h,O)})}function Df(u,h){let x=u._controlledWritableStream;Cl(x);let O=u._writeAlgorithm(h);M(O,()=>{Mf(x);let B=x._state;if(Ba(u),!gr(x)&&B==="writable"){let $=Wn(u);Ua(x,$)}io(u)},B=>{x._state==="writable"&&ro(u),Ef(x,B)})}function Wn(u){return Hn(u)<=0}function Ol(u,h){let x=u._controlledWritableStream;ro(u),Xs(x,h)}function no(u){return new TypeError(`WritableStream.prototype.${u} can only be used on a WritableStream`)}function Za(u){return new TypeError(`WritableStreamDefaultController.prototype.${u} can only be used on a WritableStreamDefaultController`)}function xi(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 Qi(u){u._closedPromise=v((h,x)=>{u._closedPromise_resolve=h,u._closedPromise_reject=x,u._closedPromiseState="pending"})}function Il(u,h){Qi(u),Ya(u,h)}function zf(u){Qi(u),Ll(u)}function Ya(u,h){u._closedPromise_reject!==void 0&&(L(u._closedPromise),u._closedPromise_reject(h),u._closedPromise_resolve=void 0,u._closedPromise_reject=void 0,u._closedPromiseState="rejected")}function jf(u,h){Il(u,h)}function Ll(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 so(u){u._readyPromise=v((h,x)=>{u._readyPromise_resolve=h,u._readyPromise_reject=x}),u._readyPromiseState="pending"}function Xa(u,h){so(u),Nl(u,h)}function kl(u){so(u),Qa(u)}function Nl(u,h){u._readyPromise_reject!==void 0&&(L(u._readyPromise),u._readyPromise_reject(h),u._readyPromise_resolve=void 0,u._readyPromise_reject=void 0,u._readyPromiseState="rejected")}function $f(u){so(u)}function Ff(u,h){Xa(u,h)}function Qa(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 Bl=typeof DOMException<"u"?DOMException:void 0;function qf(u){if(!(typeof u=="function"||typeof u=="object"))return!1;try{return new u,!0}catch{return!1}}function Hf(){let u=function(x,O){this.message=x||"",this.name=O||"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 Wf=qf(Bl)?Bl:Hf();function Mi(u,h,x,O,B,$){let q=Hi(u),te=xl(h);u._disturbed=!0;let he=!1,_e=E(void 0);return v((Te,Pe)=>{let nt;if($!==void 0){if(nt=()=>{let se=new Wf("Aborted","AbortError"),ye=[];O||ye.push(()=>h._state==="writable"?Br(h,se):E(void 0)),B||ye.push(()=>u._state==="readable"?nr(u,se):E(void 0)),Mt(()=>Promise.all(ye.map(Ge=>Ge())),!0,se)},$.aborted){nt();return}$.addEventListener("abort",nt)}function sr(){return v((se,ye)=>{function Ge(Bt){Bt?se():b(sn(),Ge,ye)}Ge(!1)})}function sn(){return he?E(!0):b(te._readyPromise,()=>v((se,ye)=>{kr(q,{_chunkSteps:Ge=>{_e=b(Pl(te,Ge),void 0,r),se(!1)},_closeSteps:()=>se(!0),_errorSteps:ye})}))}if(Dr(u,q._closedPromise,se=>{O?Vt(!0,se):Mt(()=>Br(h,se),!0,se)}),Dr(h,te._closedPromise,se=>{B?Vt(!0,se):Mt(()=>nr(u,se),!0,se)}),_t(u,q._closedPromise,()=>{x?Vt():Mt(()=>Of(te))}),gr(h)||h._state==="closed"){let se=new TypeError("the destination writable stream closed before all data could be piped to it");B?Vt(!0,se):Mt(()=>nr(u,se),!0,se)}L(sr());function ti(){let se=_e;return b(_e,()=>se!==_e?ti():void 0)}function Dr(se,ye,Ge){se._state==="errored"?Ge(se._storedError):C(ye,Ge)}function _t(se,ye,Ge){se._state==="closed"?Ge():T(ye,Ge)}function Mt(se,ye,Ge){if(he)return;he=!0,h._state==="writable"&&!gr(h)?T(ti(),Bt):Bt();function Bt(){M(se(),()=>zr(ye,Ge),on=>zr(!0,on))}}function Vt(se,ye){he||(he=!0,h._state==="writable"&&!gr(h)?T(ti(),()=>zr(se,ye)):zr(se,ye))}function zr(se,ye){Tl(te),Me(q),$!==void 0&&$.removeEventListener("abort",nt),se?Pe(ye):Te(void 0)}})}class en{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!oo(this))throw uo("desiredSize");return e1(this)}close(){if(!oo(this))throw uo("close");if(!tn(this))throw new TypeError("The stream is not in a state that permits close");Vn(this)}enqueue(h=void 0){if(!oo(this))throw uo("enqueue");if(!tn(this))throw new TypeError("The stream is not in a state that permits enqueue");return lo(this,h)}error(h=void 0){if(!oo(this))throw uo("error");Zr(this,h)}[Ta](h){Vr(this);let x=this._cancelAlgorithm(h);return ao(this),x}[js](h){let x=this._controlledReadableStream;if(this._queue.length>0){let O=Ba(this);this._closeRequested&&this._queue.length===0?(ao(this),Xn(x)):Gn(this),h._chunkSteps(O)}else ol(x,h),Gn(this)}}Object.defineProperties(en.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(en.prototype,e.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});function oo(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_controlledReadableStream")?!1:u instanceof en}function Gn(u){if(!Dl(u))return;if(u._pulling){u._pullAgain=!0;return}u._pulling=!0;let x=u._pullAlgorithm();M(x,()=>{u._pulling=!1,u._pullAgain&&(u._pullAgain=!1,Gn(u))},O=>{Zr(u,O)})}function Dl(u){let h=u._controlledReadableStream;return!tn(u)||!u._started?!1:!!(Qr(h)&&kt(h)>0||e1(u)>0)}function ao(u){u._pullAlgorithm=void 0,u._cancelAlgorithm=void 0,u._strategySizeAlgorithm=void 0}function Vn(u){if(!tn(u))return;let h=u._controlledReadableStream;u._closeRequested=!0,u._queue.length===0&&(ao(u),Xn(h))}function lo(u,h){if(!tn(u))return;let x=u._controlledReadableStream;if(Qr(x)&&kt(x)>0)$s(x,h,!1);else{let O;try{O=u._strategySizeAlgorithm(h)}catch(B){throw Zr(u,B),B}try{ue(u,h,O)}catch(B){throw Zr(u,B),B}}Gn(u)}function Zr(u,h){let x=u._controlledReadableStream;x._state==="readable"&&(Vr(u),ao(u),Fl(x,h))}function e1(u){let h=u._controlledReadableStream._state;return h==="errored"?null:h==="closed"?0:u._strategyHWM-u._queueTotalSize}function Uf(u){return!Dl(u)}function tn(u){let h=u._controlledReadableStream._state;return!u._closeRequested&&h==="readable"}function zl(u,h,x,O,B,$,q){h._controlledReadableStream=u,h._queue=void 0,h._queueTotalSize=void 0,Vr(h),h._started=!1,h._closeRequested=!1,h._pullAgain=!1,h._pulling=!1,h._strategySizeAlgorithm=q,h._strategyHWM=$,h._pullAlgorithm=O,h._cancelAlgorithm=B,u._readableStreamController=h;let te=x();M(E(te),()=>{h._started=!0,Gn(h)},he=>{Zr(h,he)})}function Gf(u,h,x,O){let B=Object.create(en.prototype),$=()=>{},q=()=>E(void 0),te=()=>E(void 0);h.start!==void 0&&($=()=>h.start(B)),h.pull!==void 0&&(q=()=>h.pull(B)),h.cancel!==void 0&&(te=he=>h.cancel(he)),zl(u,B,$,q,te,x,O)}function uo(u){return new TypeError(`ReadableStreamDefaultController.prototype.${u} can only be used on a ReadableStreamDefaultController`)}function Vf(u,h){return bi(u._readableStreamController)?wt(u):Kf(u)}function Kf(u,h){let x=Hi(u),O=!1,B=!1,$=!1,q=!1,te,he,_e,Te,Pe,nt=v(_t=>{Pe=_t});function sr(){return O?(B=!0,E(void 0)):(O=!0,kr(x,{_chunkSteps:Mt=>{N(()=>{B=!1;let Vt=Mt,zr=Mt;$||lo(_e._readableStreamController,Vt),q||lo(Te._readableStreamController,zr),O=!1,B&&sr()})},_closeSteps:()=>{O=!1,$||Vn(_e._readableStreamController),q||Vn(Te._readableStreamController),(!$||!q)&&Pe(void 0)},_errorSteps:()=>{O=!1}}),E(void 0))}function sn(_t){if($=!0,te=_t,q){let Mt=zn([te,he]),Vt=nr(u,Mt);Pe(Vt)}return nt}function ti(_t){if(q=!0,he=_t,$){let Mt=zn([te,he]),Vt=nr(u,Mt);Pe(Vt)}return nt}function Dr(){}return _e=yr(Dr,sr,sn),Te=yr(Dr,sr,ti),C(x._closedPromise,_t=>{Zr(_e._readableStreamController,_t),Zr(Te._readableStreamController,_t),(!$||!q)&&Pe(void 0)}),[_e,Te]}function wt(u){let h=Hi(u),x=!1,O=!1,B=!1,$=!1,q=!1,te,he,_e,Te,Pe,nt=v(se=>{Pe=se});function sr(se){C(se._closedPromise,ye=>{se===h&&(Ut(_e._readableStreamController,ye),Ut(Te._readableStreamController,ye),(!$||!q)&&Pe(void 0))})}function sn(){Gt(h)&&(Me(h),h=Hi(u),sr(h)),kr(h,{_chunkSteps:ye=>{N(()=>{O=!1,B=!1;let Ge=ye,Bt=ye;if(!$&&!q)try{Bt=dl(ye)}catch(on){Ut(_e._readableStreamController,on),Ut(Te._readableStreamController,on),Pe(nr(u,on));return}$||Gs(_e._readableStreamController,Ge),q||Gs(Te._readableStreamController,Bt),x=!1,O?Dr():B&&_t()})},_closeSteps:()=>{x=!1,$||Kr(_e._readableStreamController),q||Kr(Te._readableStreamController),_e._readableStreamController._pendingPullIntos.length>0&&Fn(_e._readableStreamController,0),Te._readableStreamController._pendingPullIntos.length>0&&Fn(Te._readableStreamController,0),(!$||!q)&&Pe(void 0)},_errorSteps:()=>{x=!1}})}function ti(se,ye){ct(h)&&(Me(h),h=Vs(u),sr(h));let Ge=ye?Te:_e,Bt=ye?_e:Te;bt(h,se,{_chunkSteps:an=>{N(()=>{O=!1,B=!1;let ln=ye?q:$;if(ye?$:q)ln||qn(Ge._readableStreamController,an);else{let eu;try{eu=dl(an)}catch(r1){Ut(Ge._readableStreamController,r1),Ut(Bt._readableStreamController,r1),Pe(nr(u,r1));return}ln||qn(Ge._readableStreamController,an),Gs(Bt._readableStreamController,eu)}x=!1,O?Dr():B&&_t()})},_closeSteps:an=>{x=!1;let ln=ye?q:$,vo=ye?$:q;ln||Kr(Ge._readableStreamController),vo||Kr(Bt._readableStreamController),an!==void 0&&(ln||qn(Ge._readableStreamController,an),!vo&&Bt._readableStreamController._pendingPullIntos.length>0&&Fn(Bt._readableStreamController,0)),(!ln||!vo)&&Pe(void 0)},_errorSteps:()=>{x=!1}})}function Dr(){if(x)return O=!0,E(void 0);x=!0;let se=$a(_e._readableStreamController);return se===null?sn():ti(se._view,!1),E(void 0)}function _t(){if(x)return B=!0,E(void 0);x=!0;let se=$a(Te._readableStreamController);return se===null?sn():ti(se._view,!0),E(void 0)}function Mt(se){if($=!0,te=se,q){let ye=zn([te,he]),Ge=nr(u,ye);Pe(Ge)}return nt}function Vt(se){if(q=!0,he=se,$){let ye=zn([te,he]),Ge=nr(u,ye);Pe(Ge)}return nt}function zr(){}return _e=$l(zr,Dr,Mt),Te=$l(zr,_t,Vt),sr(h),[_e,Te]}function Kn(u,h){ft(u,h);let x=u,O=x?.autoAllocateChunkSize,B=x?.cancel,$=x?.pull,q=x?.start,te=x?.type;return{autoAllocateChunkSize:O===void 0?void 0:sl(O,`${h} has member 'autoAllocateChunkSize' that`),cancel:B===void 0?void 0:Jn(B,x,`${h} has member 'cancel' that`),pull:$===void 0?void 0:Zn($,x,`${h} has member 'pull' that`),start:q===void 0?void 0:Yn(q,x,`${h} has member 'start' that`),type:te===void 0?void 0:rn(te,`${h} has member 'type' that`)}}function Jn(u,h,x){return rr(u,x),O=>U(u,h,[O])}function Zn(u,h,x){return rr(u,x),O=>U(u,h,[O])}function Yn(u,h,x){return rr(u,x),O=>z(u,h,[O])}function rn(u,h){if(u=`${u}`,u!=="bytes")throw new TypeError(`${h} '${u}' is not a valid enumeration value for ReadableStreamType`);return u}function nn(u,h){ft(u,h);let x=u?.mode;return{mode:x===void 0?void 0:co(x,`${h} has member 'mode' that`)}}function co(u,h){if(u=`${u}`,u!=="byob")throw new TypeError(`${h} '${u}' is not a valid enumeration value for ReadableStreamReaderMode`);return u}function Jf(u,h){ft(u,h);let x=u?.preventCancel;return{preventCancel:Boolean(x)}}function jl(u,h){ft(u,h);let x=u?.preventAbort,O=u?.preventCancel,B=u?.preventClose,$=u?.signal;return $!==void 0&&Zf($,`${h} has member 'signal' that`),{preventAbort:Boolean(x),preventCancel:Boolean(O),preventClose:Boolean(B),signal:$}}function Zf(u,h){if(!wf(u))throw new TypeError(`${h} is not an AbortSignal.`)}function Yf(u,h){ft(u,h);let x=u?.readable;Pa(x,"readable","ReadableWritablePair"),Ia(x,`${h} has member 'readable' that`);let O=u?.writable;return Pa(O,"writable","ReadableWritablePair"),Zs(O,`${h} has member 'writable' that`),{readable:x,writable:O}}class Yr{constructor(h={},x={}){h===void 0?h=null:gt(h,"First parameter");let O=Js(x,"Second parameter"),B=Kn(h,"First parameter");if(t1(this),B.type==="bytes"){if(O.size!==void 0)throw new RangeError("The strategy for a byte stream cannot have a size function");let $=Nr(O,0);vl(this,B,$)}else{let $=Jr(O),q=Nr(O,1);Gf(this,B,q,$)}}get locked(){if(!Xr(this))throw Ei("locked");return Qr(this)}cancel(h=void 0){return Xr(this)?Qr(this)?w(new TypeError("Cannot cancel a stream that already has a reader")):nr(this,h):w(Ei("cancel"))}getReader(h=void 0){if(!Xr(this))throw Ei("getReader");return nn(h,"First parameter").mode===void 0?Hi(this):Vs(this)}pipeThrough(h,x={}){if(!Xr(this))throw Ei("pipeThrough");Lr(h,1,"pipeThrough");let O=Yf(h,"First parameter"),B=jl(x,"Second parameter");if(Qr(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(Zi(O.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");let $=Mi(this,O.writable,B.preventClose,B.preventAbort,B.preventCancel,B.signal);return L($),O.readable}pipeTo(h,x={}){if(!Xr(this))return w(Ei("pipeTo"));if(h===void 0)return w("Parameter 1 is required in 'pipeTo'.");if(!Ji(h))return w(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let O;try{O=jl(x,"Second parameter")}catch(B){return w(B)}return Qr(this)?w(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):Zi(h)?w(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):Mi(this,h,O.preventClose,O.preventAbort,O.preventCancel,O.signal)}tee(){if(!Xr(this))throw Ei("tee");let h=Vf(this);return zn(h)}values(h=void 0){if(!Xr(this))throw Ei("values");let x=Jf(h,"First parameter");return ff(this,x.preventCancel)}}Object.defineProperties(Yr.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(Yr.prototype,e.toStringTag,{value:"ReadableStream",configurable:!0}),typeof e.asyncIterator=="symbol"&&Object.defineProperty(Yr.prototype,e.asyncIterator,{value:Yr.prototype.values,writable:!0,configurable:!0});function yr(u,h,x,O=1,B=()=>1){let $=Object.create(Yr.prototype);t1($);let q=Object.create(en.prototype);return zl($,q,u,h,x,O,B),$}function $l(u,h,x){let O=Object.create(Yr.prototype);t1(O);let B=Object.create(Ye.prototype);return bl(O,B,u,h,x,0,void 0),O}function t1(u){u._state="readable",u._reader=void 0,u._storedError=void 0,u._disturbed=!1}function Xr(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_readableStreamController")?!1:u instanceof Yr}function Qr(u){return u._reader!==void 0}function nr(u,h){if(u._disturbed=!0,u._state==="closed")return E(void 0);if(u._state==="errored")return w(u._storedError);Xn(u);let x=u._reader;x!==void 0&&Gt(x)&&(x._readIntoRequests.forEach(B=>{B._closeSteps(void 0)}),x._readIntoRequests=new ie);let O=u._readableStreamController[Ta](h);return P(O,r)}function Xn(u){u._state="closed";let h=u._reader;h!==void 0&&(Dn(h),ct(h)&&(h._readRequests.forEach(x=>{x._closeSteps()}),h._readRequests=new ie))}function Fl(u,h){u._state="errored",u._storedError=h;let x=u._reader;x!==void 0&&(Bn(x,h),ct(x)?(x._readRequests.forEach(O=>{O._errorSteps(h)}),x._readRequests=new ie):(x._readIntoRequests.forEach(O=>{O._errorSteps(h)}),x._readIntoRequests=new ie))}function Ei(u){return new TypeError(`ReadableStream.prototype.${u} can only be used on a ReadableStream`)}function ql(u,h){ft(u,h);let x=u?.highWaterMark;return Pa(x,"highWaterMark","QueuingStrategyInit"),{highWaterMark:Oa(x)}}let Hl=u=>u.byteLength;Object.defineProperty(Hl,"name",{value:"size",configurable:!0});class fo{constructor(h){Lr(h,1,"ByteLengthQueuingStrategy"),h=ql(h,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=h.highWaterMark}get highWaterMark(){if(!Ul(this))throw Wl("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!Ul(this))throw Wl("size");return Hl}}Object.defineProperties(fo.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(fo.prototype,e.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});function Wl(u){return new TypeError(`ByteLengthQueuingStrategy.prototype.${u} can only be used on a ByteLengthQueuingStrategy`)}function Ul(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_byteLengthQueuingStrategyHighWaterMark")?!1:u instanceof fo}let Gl=()=>1;Object.defineProperty(Gl,"name",{value:"size",configurable:!0});class ho{constructor(h){Lr(h,1,"CountQueuingStrategy"),h=ql(h,"First parameter"),this._countQueuingStrategyHighWaterMark=h.highWaterMark}get highWaterMark(){if(!Kl(this))throw Vl("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!Kl(this))throw Vl("size");return Gl}}Object.defineProperties(ho.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(ho.prototype,e.toStringTag,{value:"CountQueuingStrategy",configurable:!0});function Vl(u){return new TypeError(`CountQueuingStrategy.prototype.${u} can only be used on a CountQueuingStrategy`)}function Kl(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_countQueuingStrategyHighWaterMark")?!1:u instanceof ho}function ei(u,h){ft(u,h);let x=u?.flush,O=u?.readableType,B=u?.start,$=u?.transform,q=u?.writableType;return{flush:x===void 0?void 0:Xf(x,u,`${h} has member 'flush' that`),readableType:O,start:B===void 0?void 0:Qf(B,u,`${h} has member 'start' that`),transform:$===void 0?void 0:eh($,u,`${h} has member 'transform' that`),writableType:q}}function Xf(u,h,x){return rr(u,x),O=>U(u,h,[O])}function Qf(u,h,x){return rr(u,x),O=>z(u,h,[O])}function eh(u,h,x){return rr(u,x),(O,B)=>U(u,h,[O,B])}class mo{constructor(h={},x={},O={}){h===void 0&&(h=null);let B=Js(x,"Second parameter"),$=Js(O,"Third parameter"),q=ei(h,"First parameter");if(q.readableType!==void 0)throw new RangeError("Invalid readableType specified");if(q.writableType!==void 0)throw new RangeError("Invalid writableType specified");let te=Nr($,0),he=Jr($),_e=Nr(B,1),Te=Jr(B),Pe,nt=v(sr=>{Pe=sr});th(this,nt,_e,Te,te,he),ih(this,q),q.start!==void 0?Pe(q.start(this._transformStreamController)):Pe(void 0)}get readable(){if(!Jl(this))throw Ql("readable");return this._readable}get writable(){if(!Jl(this))throw Ql("writable");return this._writable}}Object.defineProperties(mo.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(mo.prototype,e.toStringTag,{value:"TransformStream",configurable:!0});function th(u,h,x,O,B,$){function q(){return h}function te(nt){return oh(u,nt)}function he(nt){return ah(u,nt)}function _e(){return lh(u)}u._writable=Ml(q,te,_e,he,x,O);function Te(){return uh(u)}function Pe(nt){return go(u,nt),E(void 0)}u._readable=yr(q,Te,Pe,B,$),u._backpressure=void 0,u._backpressureChangePromise=void 0,u._backpressureChangePromise_resolve=void 0,yo(u,!0),u._transformStreamController=void 0}function Jl(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_transformStreamController")?!1:u instanceof mo}function po(u,h){Zr(u._readable._readableStreamController,h),go(u,h)}function go(u,h){Zl(u._transformStreamController),Ja(u._writable._writableStreamController,h),u._backpressure&&yo(u,!1)}function yo(u,h){u._backpressureChangePromise!==void 0&&u._backpressureChangePromise_resolve(),u._backpressureChangePromise=v(x=>{u._backpressureChangePromise_resolve=x}),u._backpressure=h}class Qn{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!bo(this))throw es("desiredSize");let h=this._controlledTransformStream._readable._readableStreamController;return e1(h)}enqueue(h=void 0){if(!bo(this))throw es("enqueue");Yl(this,h)}error(h=void 0){if(!bo(this))throw es("error");nh(this,h)}terminate(){if(!bo(this))throw es("terminate");sh(this)}}Object.defineProperties(Qn.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Qn.prototype,e.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});function bo(u){return!o(u)||!Object.prototype.hasOwnProperty.call(u,"_controlledTransformStream")?!1:u instanceof Qn}function rh(u,h,x,O){h._controlledTransformStream=u,u._transformStreamController=h,h._transformAlgorithm=x,h._flushAlgorithm=O}function ih(u,h){let x=Object.create(Qn.prototype),O=$=>{try{return Yl(x,$),E(void 0)}catch(q){return w(q)}},B=()=>E(void 0);h.transform!==void 0&&(O=$=>h.transform($,x)),h.flush!==void 0&&(B=()=>h.flush(x)),rh(u,x,O,B)}function Zl(u){u._transformAlgorithm=void 0,u._flushAlgorithm=void 0}function Yl(u,h){let x=u._controlledTransformStream,O=x._readable._readableStreamController;if(!tn(O))throw new TypeError("Readable side is not in a state that permits enqueue");try{lo(O,h)}catch($){throw go(x,$),x._readable._storedError}Uf(O)!==x._backpressure&&yo(x,!0)}function nh(u,h){po(u._controlledTransformStream,h)}function Xl(u,h){let x=u._transformAlgorithm(h);return P(x,void 0,O=>{throw po(u._controlledTransformStream,O),O})}function sh(u){let h=u._controlledTransformStream,x=h._readable._readableStreamController;Vn(x);let O=new TypeError("TransformStream terminated");go(h,O)}function oh(u,h){let x=u._transformStreamController;if(u._backpressure){let O=u._backpressureChangePromise;return P(O,()=>{let B=u._writable;if(B._state==="erroring")throw B._storedError;return Xl(x,h)})}return Xl(x,h)}function ah(u,h){return po(u,h),E(void 0)}function lh(u){let h=u._readable,x=u._transformStreamController,O=x._flushAlgorithm();return Zl(x),P(O,()=>{if(h._state==="errored")throw h._storedError;Vn(h._readableStreamController)},B=>{throw po(u,B),h._storedError})}function uh(u){return yo(u,!1),u._backpressureChangePromise}function es(u){return new TypeError(`TransformStreamDefaultController.prototype.${u} can only be used on a TransformStreamDefaultController`)}function Ql(u){return new TypeError(`TransformStream.prototype.${u} can only be used on a TransformStream`)}t.ByteLengthQueuingStrategy=fo,t.CountQueuingStrategy=ho,t.ReadableByteStreamController=Ye,t.ReadableStream=Yr,t.ReadableStreamBYOBReader=Vi,t.ReadableStreamBYOBRequest=jn,t.ReadableStreamDefaultController=en,t.ReadableStreamDefaultReader=Y,t.TransformStream=mo,t.TransformStreamDefaultController=Qn,t.WritableStream=Ki,t.WritableStreamDefaultController=Xi,t.WritableStreamDefaultWriter=Yi,Object.defineProperty(t,"__esModule",{value:!0})})});var O9=G(()=>{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,P9())}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*J0(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,I9),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+I9)).arrayBuffer();i+=a.byteLength,yield new Uint8Array(a)}}}var lI,I9,Ii,R1,jo,Vu,$o,L9,BS,Li,C1=o1(()=>{lI=me(O9(),1);I9=65536;L9=($o=class{constructor(e=[],r={}){St(this,Ii,[]);St(this,R1,"");St(this,jo,0);St(this,Vu,"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}`),et(this,jo,Ee(this,jo)+(ArrayBuffer.isView(a)?a.byteLength:a.size)),Ee(this,Ii).push(a)}et(this,Vu,`${r.endings===void 0?"transparent":r.endings}`);let n=r.type===void 0?"":String(r.type);et(this,R1,/^[\x20-\x7E]*$/.test(n)?n:"")}get size(){return Ee(this,jo)}get type(){return Ee(this,R1)}async text(){let e=new TextDecoder,r="";for await(let i of J0(Ee(this,Ii),!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 J0(Ee(this,Ii),!1))e.set(i,r),r+=i.length;return e.buffer}stream(){let e=J0(Ee(this,Ii),!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=Ee(this,Ii),p=[],m=0;for(let E of d){if(m>=c)break;let w=ArrayBuffer.isView(E)?E.byteLength:E.size;if(o&&w<=o)o-=w,a-=w;else{let b;ArrayBuffer.isView(E)?(b=E.subarray(o,Math.min(w,a)),m+=b.byteLength):(b=E.slice(o,Math.min(w,a)),m+=b.size),a-=w,p.push(b),o=0}}let v=new $o([],{type:String(i).toLowerCase()});return et(v,jo,c),et(v,Ii,p),v}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])}},Ii=new WeakMap,R1=new WeakMap,jo=new WeakMap,Vu=new WeakMap,$o);Object.defineProperties(L9.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}});BS=L9,Li=BS});var A1,T1,k9,DS,zS,Fo,Z0=o1(()=>{C1();DS=(k9=class extends Li{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);St(this,A1,0);St(this,T1,"");n===null&&(n={});let o=n.lastModified===void 0?Date.now():Number(n.lastModified);Number.isNaN(o)||et(this,A1,o),et(this,T1,String(i))}get name(){return Ee(this,T1)}get lastModified(){return Ee(this,A1)}get[Symbol.toStringTag](){return"File"}static[Symbol.hasInstance](r){return!!r&&r instanceof Li&&/^(File)$/.test(r[Symbol.toStringTag])}},A1=new WeakMap,T1=new WeakMap,k9),zS=DS,Fo=zS});function z9(t,e=Li){var r=`${N9()}${N9()}`.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+Y0(a)+`"\r
97
97
  \r
98
98
  ${o.replace(/\r(?!\n)|(?<!\r)\n/g,`\r
99
99
  `)}\r
100
- `):i.push(n+U0(a)+`"; filename="${U0(o.name,1)}"\r
100
+ `):i.push(n+Y0(a)+`"; filename="${Y0(o.name,1)}"\r
101
101
  Content-Type: ${o.type||"application/octet-stream"}\r
102
102
  \r
103
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
104
+ `)),i.push(`--${r}--`),new e(i,{type:"multipart/form-data; boundary="+r})}var P1,jS,$S,N9,FS,B9,Y0,bs,Sr,D9,vs,Ku=o1(()=>{C1();Z0();({toStringTag:P1,iterator:jS,hasInstance:$S}=Symbol),N9=Math.random,FS="append,set,get,getAll,delete,keys,values,entries,forEach,constructor".split(","),B9=(t,e,r)=>(t+="",/^(Blob|File)$/.test(e&&e[P1])?[(r=r!==void 0?r+"":e[P1]=="File"?e.name:"blob",t),e.name!==r||e[P1]=="blob"?new Fo([e],r,e):e]:[t,e+""]),Y0=(t,e)=>(e?t:t.replace(/\r?\n|\r/g,`\r
105
+ `)).replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),bs=(t,e,r)=>{if(e.length<r)throw new TypeError(`Failed to execute '${t}' on 'FormData': ${r} arguments required, but only ${e.length} present.`)},vs=(D9=class{constructor(...e){St(this,Sr,[]);if(e.length)throw new TypeError("Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.")}get[P1](){return"FormData"}[jS](){return this.entries()}static[$S](e){return e&&typeof e=="object"&&e[P1]==="FormData"&&!FS.some(r=>typeof e[r]!="function")}append(...e){bs("append",arguments,2),Ee(this,Sr).push(B9(...e))}delete(e){bs("delete",arguments,1),e+="",et(this,Sr,Ee(this,Sr).filter(([r])=>r!==e))}get(e){bs("get",arguments,1),e+="";for(var r=Ee(this,Sr),i=r.length,n=0;n<i;n++)if(r[n][0]===e)return r[n][1];return null}getAll(e,r){return bs("getAll",arguments,1),r=[],e+="",Ee(this,Sr).forEach(i=>i[0]===e&&r.push(i[1])),r}has(e){return bs("has",arguments,1),e+="",Ee(this,Sr).some(r=>r[0]===e)}forEach(e,r){bs("forEach",arguments,1);for(var[i,n]of this)e.call(r,n,i,this)}set(...e){bs("set",arguments,2);var r=[],i=!0;e=B9(...e),Ee(this,Sr).forEach(n=>{n[0]===e[0]?i&&(i=!r.push(e)):r.push(n)}),i&&r.push(e),et(this,Sr,r)}*entries(){yield*Ee(this,Sr)}*keys(){for(var[e]of this)yield e}*values(){for(var[,e]of this)yield e}},Sr=new WeakMap,D9)});var q9=G((_I,F9)=>{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)}F9.exports=globalThis.DOMException});var I1,W9,qS,ws,_s,Q0,H9,ed=o1(()=>{I1=require("fs"),W9=me(q9(),1);Z0();C1();({stat:qS}=I1.promises),Q0=class{constructor(e){St(this,ws,void 0);St(this,_s,void 0);et(this,ws,e.path),et(this,_s,e.start),this.size=e.size,this.lastModified=e.lastModified}slice(e,r){return new Q0({path:Ee(this,ws),lastModified:this.lastModified,size:r-e,start:Ee(this,_s)+e})}async*stream(){let{mtimeMs:e}=await qS(Ee(this,ws));if(e>this.lastModified)throw new W9.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,I1.createReadStream)(Ee(this,ws),{start:Ee(this,_s),end:Ee(this,_s)+this.size-1})}get[Symbol.toStringTag](){return"Blob"}},H9=Q0;ws=new WeakMap,_s=new WeakMap});var G9={};z2(G9,{toFormData:()=>JS});function KS(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 JS(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 td(r[1]||r[2]),n,o,a,c,d,p,m=[],v=new vs,E=C=>{a+=T.decode(C,{stream:!0})},w=C=>{m.push(C)},b=()=>{let C=new Fo(m,p,{type:d});v.append(c,C)},M=()=>{v.append(c,a)},T=new TextDecoder("utf-8");T.decode(),i.onPartBegin=function(){i.onPartData=E,i.onPartEnd=M,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=KS(o),p&&(i.onPartData=w,i.onPartEnd=b)}else n==="content-type"&&(d=o);o="",n=""};for await(let C of t)i.write(C);return i.end(),v}var li,Je,U9,Sn,Zu,Yu,HS,L1,WS,US,GS,VS,Ss,td,V9=o1(()=>{ed();Ku();li=0,Je={START_BOUNDARY:li++,HEADER_FIELD_START:li++,HEADER_FIELD:li++,HEADER_VALUE_START:li++,HEADER_VALUE:li++,HEADER_VALUE_ALMOST_DONE:li++,HEADERS_ALMOST_DONE:li++,PART_DATA_START:li++,PART_DATA:li++,END:li++},U9=1,Sn={PART_BOUNDARY:U9,LAST_BOUNDARY:U9*=2},Zu=10,Yu=13,HS=32,L1=45,WS=58,US=97,GS=122,VS=t=>t|32,Ss=()=>{},td=class{constructor(e){this.index=0,this.flags=0,this.onHeaderEnd=Ss,this.onHeaderField=Ss,this.onHeadersEnd=Ss,this.onHeaderValue=Ss,this.onPartBegin=Ss,this.onPartData=Ss,this.onPartEnd=Ss,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=Je.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,v=this.boundary.length,E=v-1,w=e.length,b,M,T=N=>{this[N+"Mark"]=r},C=N=>{delete this[N+"Mark"]},P=(N,z,U,Z)=>{(z===void 0||z!==U)&&this[N](Z&&Z.subarray(z,U))},L=(N,z)=>{let U=N+"Mark";U in this&&(z?(P(N,this[U],r,e),delete this[U]):(P(N,this[U],e.length,e),this[U]=0))};for(r=0;r<i;r++)switch(b=e[r],p){case Je.START_BOUNDARY:if(d===a.length-2){if(b===L1)m|=Sn.LAST_BOUNDARY;else if(b!==Yu)return;d++;break}else if(d-1===a.length-2){if(m&Sn.LAST_BOUNDARY&&b===L1)p=Je.END,m=0;else if(!(m&Sn.LAST_BOUNDARY)&&b===Zu)d=0,P("onPartBegin"),p=Je.HEADER_FIELD_START;else return;break}b!==a[d+2]&&(d=-2),b===a[d+2]&&d++;break;case Je.HEADER_FIELD_START:p=Je.HEADER_FIELD,T("onHeaderField"),d=0;case Je.HEADER_FIELD:if(b===Yu){C("onHeaderField"),p=Je.HEADERS_ALMOST_DONE;break}if(d++,b===L1)break;if(b===WS){if(d===1)return;L("onHeaderField",!0),p=Je.HEADER_VALUE_START;break}if(M=VS(b),M<US||M>GS)return;break;case Je.HEADER_VALUE_START:if(b===HS)break;T("onHeaderValue"),p=Je.HEADER_VALUE;case Je.HEADER_VALUE:b===Yu&&(L("onHeaderValue",!0),P("onHeaderEnd"),p=Je.HEADER_VALUE_ALMOST_DONE);break;case Je.HEADER_VALUE_ALMOST_DONE:if(b!==Zu)return;p=Je.HEADER_FIELD_START;break;case Je.HEADERS_ALMOST_DONE:if(b!==Zu)return;P("onHeadersEnd"),p=Je.PART_DATA_START;break;case Je.PART_DATA_START:p=Je.PART_DATA,T("onPartData");case Je.PART_DATA:if(n=d,d===0){for(r+=E;r<w&&!(e[r]in c);)r+=v;r-=E,b=e[r]}if(d<a.length)a[d]===b?(d===0&&L("onPartData",!0),d++):d=0;else if(d===a.length)d++,b===Yu?m|=Sn.PART_BOUNDARY:b===L1?m|=Sn.LAST_BOUNDARY:d=0;else if(d-1===a.length)if(m&Sn.PART_BOUNDARY){if(d=0,b===Zu){m&=~Sn.PART_BOUNDARY,P("onPartEnd"),P("onPartBegin"),p=Je.HEADER_FIELD_START;break}}else m&Sn.LAST_BOUNDARY&&b===L1?(P("onPartEnd"),p=Je.END,m=0):d=0;if(d>0)o[d-1]=b;else if(n>0){let N=new Uint8Array(o.buffer,o.byteOffset,o.byteLength);P("onPartData",0,n,N),n=0,T("onPartData"),r--}break;case Je.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===Je.HEADER_FIELD_START&&this.index===0||this.state===Je.PART_DATA&&this.index===this.boundary.length)this.onPartEnd();else if(this.state!==Je.END)throw new Error("MultipartParser.end(): stream ended unexpectedly")}}});var P6=G((RN,T6)=>{"use strict";T6.exports=Mc;Mc.polyline=Mc;Mc.polygon=hM;function Mc(t,e,r){var i=t.length,n=la(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=la(d,e);;)if(n|p){if(n&p)break;n?(c=gd(c,d,n,e),n=la(c,e)):(d=gd(c,d,p,e),p=la(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 hM(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=!(la(n,e)&i),a=0;a<t.length;a++)c=t[a],d=!(la(c,e)&i),d!==o&&r.push(gd(n,c,i,e)),d&&r.push(c),n=c,o=d;if(t=r,!t.length)break}return r}function gd(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 la(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 O6=G((yd,bd)=>{(function(t,e){typeof yd=="object"&&typeof bd<"u"?bd.exports=e():typeof define=="function"&&define.amd?define(e):t.SplayTree=e()})(yd,function(){"use strict";var t=function(){function b(M,T){this.next=null,this.key=M,this.data=T,this.left=null,this.right=null}return b}();function e(b,M){return b>M?1:b<M?-1:0}function r(b,M,T){for(var C=new t(null,null),P=C,L=C;;){var N=T(b,M.key);if(N<0){if(M.left===null)break;if(T(b,M.left.key)<0){var z=M.left;if(M.left=z.right,z.right=M,M=z,M.left===null)break}L.left=M,L=M,M=M.left}else if(N>0){if(M.right===null)break;if(T(b,M.right.key)>0){var z=M.right;if(M.right=z.left,z.left=M,M=z,M.right===null)break}P.right=M,P=M,M=M.right}else break}return P.right=M.left,L.left=M.right,M.left=C.right,M.right=C.left,M}function i(b,M,T,C){var P=new t(b,M);if(T===null)return P.left=P.right=null,P;T=r(b,T,C);var L=C(b,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(b,M,T){var C=null,P=null;if(M){M=r(b,M,T);var L=T(M.key,b);L===0?(C=M.left,P=M.right):L<0?(P=M.right,M.right=null,C=M):(C=M.left,M.left=null,P=M)}return{left:C,right:P}}function o(b,M,T){return M===null?b:(b===null||(M=r(b.key,M,T),M.left=b),M)}function a(b,M,T,C,P){if(b){C(""+M+(T?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ")+P(b)+`
107
+ `);var L=M+(T?" ":"\u2502 ");b.left&&a(b.left,L,!1,C,P),b.right&&a(b.right,L,!0,C,P)}}var c=function(){function b(M){M===void 0&&(M=e),this._root=null,this._size=0,this._comparator=M}return b.prototype.insert=function(M,T){return this._size++,this._root=i(M,T,this._root,this._comparator)},b.prototype.add=function(M,T){var C=new t(M,T);this._root===null&&(C.left=C.right=null,this._size++,this._root=C);var P=this._comparator,L=r(M,this._root,P),N=P(M,L.key);return N===0?this._root=L:(N<0?(C.left=L.left,C.right=L,L.left=null):N>0&&(C.right=L.right,C.left=L,L.right=null),this._size++,this._root=C),this._root},b.prototype.remove=function(M){this._root=this._remove(M,this._root,this._comparator)},b.prototype._remove=function(M,T,C){var P;if(T===null)return null;T=r(M,T,C);var L=C(M,T.key);return L===0?(T.left===null?P=T.right:(P=r(M,T.left,C),P.right=T.right),this._size--,P):T},b.prototype.pop=function(){var M=this._root;if(M){for(;M.left;)M=M.left;return this._root=r(M.key,this._root,this._comparator),this._root=this._remove(M.key,this._root,this._comparator),{key:M.key,data:M.data}}return null},b.prototype.findStatic=function(M){for(var T=this._root,C=this._comparator;T;){var P=C(M,T.key);if(P===0)return T;P<0?T=T.left:T=T.right}return null},b.prototype.find=function(M){return this._root&&(this._root=r(M,this._root,this._comparator),this._comparator(M,this._root.key)!==0)?null:this._root},b.prototype.contains=function(M){for(var T=this._root,C=this._comparator;T;){var P=C(M,T.key);if(P===0)return!0;P<0?T=T.left:T=T.right}return!1},b.prototype.forEach=function(M,T){for(var C=this._root,P=[],L=!1;!L;)C!==null?(P.push(C),C=C.left):P.length!==0?(C=P.pop(),M.call(T,C),C=C.right):L=!0;return this},b.prototype.range=function(M,T,C,P){for(var L=[],N=this._comparator,z=this._root,U;L.length!==0||z;)if(z)L.push(z),z=z.left;else{if(z=L.pop(),U=N(z.key,T),U>0)break;if(N(z.key,M)>=0&&C.call(P,z))return this;z=z.right}return this},b.prototype.keys=function(){var M=[];return this.forEach(function(T){var C=T.key;return M.push(C)}),M},b.prototype.values=function(){var M=[];return this.forEach(function(T){var C=T.data;return M.push(C)}),M},b.prototype.min=function(){return this._root?this.minNode(this._root).key:null},b.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},b.prototype.minNode=function(M){if(M===void 0&&(M=this._root),M)for(;M.left;)M=M.left;return M},b.prototype.maxNode=function(M){if(M===void 0&&(M=this._root),M)for(;M.right;)M=M.right;return M},b.prototype.at=function(M){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===M)return T;P++,T=T.right}else C=!0;return null},b.prototype.next=function(M){var T=this._root,C=null;if(M.right){for(C=M.right;C.left;)C=C.left;return C}for(var P=this._comparator;T;){var L=P(M.key,T.key);if(L===0)break;L<0?(C=T,T=T.left):T=T.right}return C},b.prototype.prev=function(M){var T=this._root,C=null;if(M.left!==null){for(C=M.left;C.right;)C=C.right;return C}for(var P=this._comparator;T;){var L=P(M.key,T.key);if(L===0)break;L<0?T=T.left:(C=T,T=T.right)}return C},b.prototype.clear=function(){return this._root=null,this._size=0,this},b.prototype.toList=function(){return m(this._root)},b.prototype.load=function(M,T,C){T===void 0&&(T=[]),C===void 0&&(C=!1);var P=M.length,L=this._comparator;if(C&&w(M,T,0,P-1,L),this._root===null)this._root=d(M,T,0,P),this._size=P;else{var N=E(this.toList(),p(M,T),L);P=this._size+P,this._root=v({head:N},0,P)}return this},b.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(b.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),b.prototype.toString=function(M){M===void 0&&(M=function(C){return String(C.key)});var T=[];return a(this._root,"",!0,function(C){return T.push(C)},M),T.join("")},b.prototype.update=function(M,T,C){var P=this._comparator,L=n(M,this._root,P),N=L.left,z=L.right;P(M,T)<0?z=i(T,C,z,P):N=i(T,C,N,P),this._root=o(N,z,P)},b.prototype.split=function(M){return n(M,this._root,this._comparator)},b}();function d(b,M,T,C){var P=C-T;if(P>0){var L=T+Math.floor(P/2),N=b[L],z=M[L],U=new t(N,z);return U.left=d(b,M,T,L),U.right=d(b,M,L+1,C),U}return null}function p(b,M){for(var T=new t(null,null),C=T,P=0;P<b.length;P++)C=C.next=new t(b[P],M[P]);return C.next=null,T.next}function m(b){for(var M=b,T=[],C=!1,P=new t(null,null),L=P;!C;)M?(T.push(M),M=M.left):T.length>0?(M=L=L.next=T.pop(),M=M.right):C=!0;return L.next=null,P.next}function v(b,M,T){var C=T-M;if(C>0){var P=M+Math.floor(C/2),L=v(b,M,P),N=b.head;return N.left=L,b.head=b.head.next,N.right=v(b,P+1,T),N}return null}function E(b,M,T){for(var C=new t(null,null),P=C,L=b,N=M;L!==null&&N!==null;)T(L.key,N.key)<0?(P.next=L,L=L.next):(P.next=N,N=N.next),P=P.next;return L!==null?P.next=L:N!==null&&(P.next=N),C.next}function w(b,M,T,C,P){if(!(T>=C)){for(var L=b[T+C>>1],N=T-1,z=C+1;;){do N++;while(P(b[N],L)<0);do z--;while(P(b[z],L)>0);if(N>=z)break;var U=b[N];b[N]=b[z],b[z]=U,U=M[N],M[N]=M[z],M[z]=U}w(b,M,T,z,P),w(b,M,z+1,C,P)}}return c})});var H6=G((CN,q6)=>{"use strict";var dM=O6();function mM(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var _d=mM(dM);function Tr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function I6(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 $t(t,e,r){return e&&I6(t.prototype,e),r&&I6(t,r),t}var q1=function(e,r){return e.ll.x<=r.x&&r.x<=e.ur.x&&e.ll.y<=r.y&&r.y<=e.ur.y},vd=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}}},Cn=Number.EPSILON;Cn===void 0&&(Cn=Math.pow(2,-52));var pM=Cn*Cn,wd=function(e,r){if(-Cn<e&&e<Cn&&-Cn<r&&r<Cn)return 0;var i=e-r;return i*i<pM*e*r?0:e<r?-1:1},gM=function(){function t(){Tr(this,t),this.reset()}return $t(t,[{key:"reset",value:function(){this.xRounder=new L6,this.yRounder=new L6}},{key:"round",value:function(r,i){return{x:this.xRounder.round(r),y:this.yRounder.round(i)}}}]),t}(),L6=function(){function t(){Tr(this,t),this.tree=new _d.default,this.round(0)}return $t(t,[{key:"round",value:function(r){var i=this.tree.add(r),n=this.tree.prev(i);if(n!==null&&wd(i.key,n.key)===0)return this.tree.remove(r),n.key;var o=this.tree.next(i);return o!==null&&wd(i.key,o.key)===0?(this.tree.remove(r),o.key):r}}]),t}(),W1=new gM,H1=function(e,r){return e.x*r.y-e.y*r.x},F6=function(e,r){return e.x*r.x+e.y*r.y},k6=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=H1(n,o);return wd(a,0)},Ec=function(e){return Math.sqrt(F6(e,e))},yM=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 H1(o,n)/Ec(o)/Ec(n)},bM=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 F6(o,n)/Ec(o)/Ec(n)},N6=function(e,r,i){return r.y===0?null:{x:e.x+r.x/r.y*(i-e.y),y:i}},B6=function(e,r,i){return r.x===0?null:{x:i,y:e.y+r.y/r.x*(i-e.x)}},vM=function(e,r,i,n){if(r.x===0)return B6(i,n,e.x);if(n.x===0)return B6(e,r,i.x);if(r.y===0)return N6(i,n,e.y);if(n.y===0)return N6(e,r,i.y);var o=H1(r,n);if(o==0)return null;var a={x:i.x-e.x,y:i.y-e.y},c=H1(a,r)/o,d=H1(a,n)/o,p=e.x+d*r.x,m=i.x+c*n.x,v=e.y+d*r.y,E=i.y+c*n.y,w=(p+m)/2,b=(v+E)/2;return{x:w,y:b}},di=function(){$t(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:Rc.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){Tr(this,t),e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=r}return $t(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:yM(i.point,r.point,d.point),cosine:bM(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,v=n.get(c),E=v.sine,w=v.cosine;return p>=0&&E>=0?m<w?1:m>w?-1:0:p<0&&E<0?m<w?-1:m>w?1:0:E<p?-1:E>p?1:0}}}]),t}(),wM=0,Rc=function(){$t(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,v=i.rightSE.point.y;if(n<o){if(p<d&&p<m)return 1;if(p>d&&p>m)return-1;var E=r.comparePoint(i.leftSE.point);if(E<0)return 1;if(E>0)return-1;var w=i.comparePoint(r.rightSE.point);return w!==0?w:-1}if(n>o){if(d<p&&d<v)return-1;if(d>p&&d>v)return 1;var b=i.comparePoint(r.leftSE.point);if(b!==0)return b;var M=r.comparePoint(i.rightSE.point);return M<0?1:M>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,N=v-p,z=c-o;if(P>L&&N<z)return 1;if(P<L&&N>z)return-1}return a>c?1:a<c||m<v?-1:m>v?1:r.id<i.id?-1:r.id>i.id?1:0}}]);function t(e,r,i,n){Tr(this,t),this.id=++wM,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 $t(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=vd(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=q1(i,d)&&this.comparePoint(d)===0,v=q1(n,a)&&r.comparePoint(a)===0,E=q1(i,p)&&this.comparePoint(p)===0,w=q1(n,c)&&r.comparePoint(c)===0;if(v&&m)return w&&!E?c:!w&&E?p:null;if(v)return E&&a.x===p.x&&a.y===p.y?null:a;if(m)return w&&c.x===d.x&&c.y===d.y?null:d;if(w&&E)return null;if(w)return c;if(E)return p;var b=vM(a,this.vector(),d,r.vector());return b===null||!q1(o,b)?null:W1.round(b.x,b.y)}},{key:"split",value:function(r){var i=[],n=r.events!==void 0,o=new di(r,!0),a=new di(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 di.comparePoints(d.leftSE.point,d.rightSE.point)>0&&d.swapEvents(),di.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],v=n.windings[d],E=i.rings.indexOf(m);E===-1?(i.rings.push(m),i.windings.push(v)):i.windings[E]+=v}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 v=[],E=[],w=0,b=i.length;w<b;w++)if(n[w]!==0){var M=i[w],T=M.poly;if(E.indexOf(T)===-1)if(M.isExterior)v.push(T);else{E.indexOf(T)===-1&&E.push(T);var C=v.indexOf(M.poly);C!==-1&&v.splice(C,1)}}for(var P=0,L=v.length;P<L;P++){var N=v[P].multiPoly;o.indexOf(N)===-1&&o.push(N)}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(Wr.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===Wr.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(v){return v.length===1&&v[0].isSubject};this._isInResult=p(r)!==p(i);break}default:throw new Error("Unrecognized operation type found ".concat(Wr.type))}return this._isInResult}}],[{key:"fromRing",value:function(r,i,n){var o,a,c,d=di.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 di(o,!0),m=new di(a,!1);return new t(p,m,[n],[c])}}]),t}(),D6=function(){function t(e,r,i){if(Tr(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=W1.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=W1.round(e[a][0],e[a][1]);d.x===o.x&&d.y===o.y||(this.segments.push(Rc.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(Rc.fromRing(o,n,this))}return $t(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}(),_M=function(){function t(e,r){if(Tr(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new D6(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 D6(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 $t(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}(),z6=function(){function t(e,r){if(Tr(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 _M(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 $t(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}(),SM=function(){$t(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],v=d.point,E=[];c=d,d=p,m.push(d),d.point!==v;)for(;;){var w=d.getAvailableLinkedEvents();if(w.length===0){var b=m[0].point,M=m[m.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(b.x,",")+" ".concat(b.y,"]. Last matching segment found ends at")+" [".concat(M.x,", ").concat(M.y,"]."))}if(w.length===1){p=w[0].otherSE;break}for(var T=null,C=0,P=E.length;C<P;C++)if(E[C].point===d.point){T=C;break}if(T!==null){var L=E.splice(T)[0],N=m.splice(L.index);N.unshift(N[0].otherSE),i.push(new t(N.reverse()));continue}E.push({index:m.length,point:d.point});var z=d.getLeftmostComparator(c);p=w.sort(z)[0].otherSE;break}i.push(new t(m))}}return i}}]);function t(e){Tr(this,t),this.events=e;for(var r=0,i=e.length;r<i;r++)e[r].segment.ringOut=this;this.poly=null}return $t(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;k6(a,r,c)!==0&&(i.push(a),r=a)}if(i.length===1)return null;var d=i[0],p=i[1];k6(d,r,p)===0&&i.shift(),i.push(i[0]);for(var m=this.isExteriorRing()?1:-1,v=this.isExteriorRing()?0:i.length-1,E=this.isExteriorRing()?i.length:-1,w=[],b=v;b!=E;b+=m)w.push([i[b].x,i[b].y]);return w}},{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];di.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}(),j6=function(){function t(e){Tr(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return $t(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}(),xM=function(){function t(e){Tr(this,t),this.rings=e,this.polys=this._composePolys(e)}return $t(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 j6(a));else{var c=a.enclosingRing();c.poly||i.push(new j6(c)),c.poly.addInterior(a)}}return i}}]),t}(),MM=function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Rc.compare;Tr(this,t),this.queue=e,this.tree=new _d.default(r),this.segments=[]}return $t(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 v=d.getIntersection(i);if(v!==null&&(i.isAnEndpoint(v)||(m=v),!d.isAnEndpoint(v)))for(var E=this._splitSafely(d,v),w=0,b=E.length;w<b;w++)n.push(E[w])}var M=null;if(p){var T=p.getIntersection(i);if(T!==null&&(i.isAnEndpoint(T)||(M=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||M!==null){var N=null;if(m===null)N=M;else if(M===null)N=m;else{var z=di.comparePoints(m,M);N=z<=0?m:M}this.queue.remove(i.rightSE),n.push(i.rightSE);for(var U=i.split(N),Z=0,ie=U.length;Z<ie;Z++)n.push(U[Z])}n.length>0?(this.tree.remove(i),n.push(r)):(this.segments.push(i),i.prev=d)}else{if(d&&p){var ge=d.getIntersection(p);if(ge!==null){if(!d.isAnEndpoint(ge))for(var De=this._splitSafely(d,ge),Me=0,ke=De.length;Me<ke;Me++)n.push(De[Me]);if(!p.isAnEndpoint(ge))for(var tt=this._splitSafely(p,ge),pt=0,dr=tt.length;pt<dr;pt++)n.push(tt[pt])}}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}(),$6=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,EM=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,RM=function(){function t(){Tr(this,t)}return $t(t,[{key:"run",value:function(r,i,n){Wr.type=r,W1.reset();for(var o=[new z6(i,!0)],a=0,c=n.length;a<c;a++)o.push(new z6(n[a],!1));if(Wr.numMultiPolys=o.length,Wr.type==="difference")for(var d=o[0],p=1;p<o.length;)vd(o[p].bbox,d.bbox)!==null?p++:o.splice(p,1);if(Wr.type==="intersection"){for(var m=0,v=o.length;m<v;m++)for(var E=o[m],w=m+1,b=o.length;w<b;w++)if(vd(E.bbox,o[w].bbox)===null)return[]}for(var M=new _d.default(di.compare),T=0,C=o.length;T<C;T++)for(var P=o[T].getSweepEvents(),L=0,N=P.length;L<N;L++)if(M.insert(P[L]),M.size>$6)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 MM(M),U=M.size,Z=M.pop();Z;){var ie=Z.key;if(M.size===U){var ge=ie.segment;throw new Error("Unable to pop() ".concat(ie.isLeft?"left":"right"," SweepEvent ")+"[".concat(ie.point.x,", ").concat(ie.point.y,"] from segment #").concat(ge.id," ")+"[".concat(ge.leftSE.point.x,", ").concat(ge.leftSE.point.y,"] -> ")+"[".concat(ge.rightSE.point.x,", ").concat(ge.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(M.size>$6)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(z.segments.length>EM)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var De=z.process(ie),Me=0,ke=De.length;Me<ke;Me++){var tt=De[Me];tt.consumedBy===void 0&&M.insert(tt)}U=M.size,Z=M.pop()}W1.reset();var pt=SM.factory(z.segments),dr=new xM(pt);return dr.getGeom()}}]),t}(),Wr=new RM,CM=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 Wr.run("union",e,i)},AM=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 Wr.run("intersection",e,i)},TM=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 Wr.run("xor",e,i)},PM=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 Wr.run("difference",e,i)},OM={union:CM,intersection:AM,xor:TM,difference:PM};q6.exports=OM});var Z6=G((xd,Md)=>{(function(t,e){typeof xd=="object"&&typeof Md<"u"?Md.exports=e():typeof define=="function"&&define.amd?define(e):t.proj4=e()})(xd,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,v=.16666666666666666,E=.04722222222222222,w=.022156084656084655,b=1e-10,M=.017453292519943295,T=57.29577951308232,C=Math.PI/4,P=Math.PI*2,L=3.14159265359,N={};N.greenwich=0,N.lisbon=-9.131906111111,N.paris=2.337229166667,N.bogota=-74.080916666667,N.madrid=-3.687938888889,N.rome=12.452333333333,N.bern=7.439583333333,N.jakarta=106.807719444444,N.ferro=-17.666666666667,N.brussels=4.367975,N.stockholm=18.058277777778,N.athens=23.7163375,N.oslo=10.722916666667;var z={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}},U=/[\s_\-\/\(\)]/g;function Z(s,l){if(s[l])return s[l];for(var f=Object.keys(s),y=l.toLowerCase().replace(U,""),g=-1,S,R;++g<f.length;)if(S=f[g],R=S.toLowerCase().replace(U,""),R===y)return s[S]}var ie=function(s){var l={},f=s.split("+").map(function(_){return _.trim()}).filter(function(_){return _}).reduce(function(_,A){var I=A.split("=");return I.push(!0),_[I[0].toLowerCase()]=I[1],_},{}),y,g,S,R={proj:"projName",datum:"datumCode",rf:function(_){l.rf=parseFloat(_)},lat_0:function(_){l.lat0=_*M},lat_1:function(_){l.lat1=_*M},lat_2:function(_){l.lat2=_*M},lat_ts:function(_){l.lat_ts=_*M},lon_0:function(_){l.long0=_*M},lon_1:function(_){l.long1=_*M},lon_2:function(_){l.long2=_*M},alpha:function(_){l.alpha=parseFloat(_)*M},gamma:function(_){l.rectified_grid_angle=parseFloat(_)},lonc:function(_){l.longc=_*M},x_0:function(_){l.x0=parseFloat(_)},y_0:function(_){l.y0=parseFloat(_)},k_0:function(_){l.k0=parseFloat(_)},k:function(_){l.k0=parseFloat(_)},a:function(_){l.a=parseFloat(_)},b:function(_){l.b=parseFloat(_)},r_a:function(){l.R_A=!0},zone:function(_){l.zone=parseInt(_,10)},south:function(){l.utmSouth=!0},towgs84:function(_){l.datum_params=_.split(",").map(function(A){return parseFloat(A)})},to_meter:function(_){l.to_meter=parseFloat(_)},units:function(_){l.units=_;var A=Z(z,_);A&&(l.to_meter=A.to_meter)},from_greenwich:function(_){l.from_greenwich=_*M},pm:function(_){var A=Z(N,_);l.from_greenwich=(A||parseFloat(_))*M},nadgrids:function(_){_==="@null"?l.datumCode="none":l.nadgrids=_},axis:function(_){var A="ewnsud";_.length===3&&A.indexOf(_.substr(0,1))!==-1&&A.indexOf(_.substr(1,1))!==-1&&A.indexOf(_.substr(2,1))!==-1&&(l.axis=_)},approx:function(){l.approx=!0}};for(y in f)g=f[y],y in R?(S=R[y],typeof S=="function"?S(g):l[S]=g):l[y]=g;return typeof l.datumCode=="string"&&l.datumCode!=="WGS84"&&(l.datumCode=l.datumCode.toLowerCase()),l},ge=1,De=2,Me=3,ke=4,tt=5,pt=-1,dr=/\s/,Bn=/[A-Za-z]/,Ca=/[A-Za-z84]/,Dn=/[,\]]/,Aa=/[\d\.E\-\+]/;function mr(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=ge}mr.prototype.readCharicter=function(){var s=this.text[this.place++];if(this.state!==ke)for(;dr.test(s);){if(this.place>=this.text.length)return;s=this.text[this.place++]}switch(this.state){case ge:return this.neutral(s);case De:return this.keyword(s);case ke:return this.quoted(s);case tt:return this.afterquote(s);case Me:return this.number(s);case pt:return}},mr.prototype.afterquote=function(s){if(s==='"'){this.word+='"',this.state=ke;return}if(Dn.test(s)){this.word=this.word.trim(),this.afterItem(s);return}throw new Error(`havn't handled "`+s+'" in afterquote yet, index '+this.place)},mr.prototype.afterItem=function(s){if(s===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=ge;return}if(s==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=ge,this.currentObject=this.stack.pop(),this.currentObject||(this.state=pt);return}},mr.prototype.number=function(s){if(Aa.test(s)){this.word+=s;return}if(Dn.test(s)){this.word=parseFloat(this.word),this.afterItem(s);return}throw new Error(`havn't handled "`+s+'" in number yet, index '+this.place)},mr.prototype.quoted=function(s){if(s==='"'){this.state=tt;return}this.word+=s},mr.prototype.keyword=function(s){if(Ca.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=ge;return}if(Dn.test(s)){this.afterItem(s);return}throw new Error(`havn't handled "`+s+'" in keyword yet, index '+this.place)},mr.prototype.neutral=function(s){if(Bn.test(s)){this.word=s,this.state=De;return}if(s==='"'){this.word="",this.state=ke;return}if(Aa.test(s)){this.word=s,this.state=Me;return}if(Dn.test(s)){this.afterItem(s);return}throw new Error(`havn't handled "`+s+'" in neutral yet, index '+this.place)},mr.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===pt)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function Ta(s){var l=new mr(s);return l.output()}function js(s,l,f){Array.isArray(l)&&(f.unshift(l),l=null);var y=l?{}:s,g=f.reduce(function(S,R){return gi(R,S),S},y);l&&(s[l]=g)}function gi(s,l){if(!Array.isArray(s)){l[s]=!0;return}var f=s.shift();if(f==="PARAMETER"&&(f=s.shift()),s.length===1){if(Array.isArray(s[0])){l[f]={},gi(s[0],l[f]);return}l[f]=s[0];return}if(!s.length){l[f]=!0;return}if(f==="TOWGS84"){l[f]=s;return}if(f==="AXIS"){f in l||(l[f]=[]),l[f].push(s);return}Array.isArray(f)||(l[f]={});var y;switch(f){case"UNIT":case"PRIMEM":case"VERT_DATUM":l[f]={name:s[0].toLowerCase(),convert:s[1]},s.length===3&&gi(s[2],l[f]);return;case"SPHEROID":case"ELLIPSOID":l[f]={name:s[0],a:s[1],rf:s[2]},s.length===4&&gi(s[3],l[f]);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]],js(l,f,s);return;default:for(y=-1;++y<s.length;)if(!Array.isArray(s[y]))return gi(s,l[f]);return js(l,f,s)}}var lf=.017453292519943295;function uf(s,l){var f=l[0],y=l[1];!(f in s)&&y in s&&(s[f]=s[y],l.length===3&&(s[f]=l[2](s[f])))}function ft(s){return s*lf}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="",f=0,y=s.AXIS.length;f<y;++f){var g=[s.AXIS[f][0].toLowerCase(),s.AXIS[f][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 S=s.GEOGCS;s.type==="GEOGCS"&&(S=s),S&&(S.DATUM?s.datumCode=S.DATUM.name.toLowerCase():s.datumCode=S.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"),S.DATUM&&S.DATUM.SPHEROID&&(s.ellps=S.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),s.ellps.toLowerCase().slice(0,13)==="international"&&(s.ellps="intl"),s.a=S.DATUM.SPHEROID.a,s.rf=parseFloat(S.DATUM.SPHEROID.rf,10)),S.DATUM&&S.DATUM.TOWGS84&&(s.datum_params=S.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 R(I){var D=s.to_meter||1;return I*D}var _=function(I){return uf(s,I)},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",ft],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",ft],["x0","false_easting",R],["y0","false_northing",R],["long0","central_meridian",ft],["lat0","latitude_of_origin",ft],["lat0","standard_parallel_1",ft],["lat1","standard_parallel_1",ft],["lat2","standard_parallel_2",ft],["azimuth","Azimuth"],["alpha","azimuth",ft],["srsCode","name"]];A.forEach(_),!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=ft(s.lat1>0?90:-90),s.lat_ts=s.lat1)}var il=function(s){var l=Ta(s),f=l.shift(),y=l.shift();l.unshift(["name",y]),l.unshift(["type",f]);var g={};return gi(l,g),rr(g),g};function gt(s){var l=this;if(arguments.length===2){var f=arguments[1];typeof f=="string"?f.charAt(0)==="+"?gt[s]=ie(arguments[1]):gt[s]=il(arguments[1]):gt[s]=f}else if(arguments.length===1){if(Array.isArray(s))return s.map(function(y){Array.isArray(y)?gt.apply(l,y):gt(y)});if(typeof s=="string"){if(s in gt)return gt[s]}else"EPSG"in s?gt["EPSG:"+s.EPSG]=s:"ESRI"in s?gt["ESRI:"+s.ESRI]=s:"IAU2000"in s?gt["IAU2000:"+s.IAU2000]=s:console.log(s);return}}t(gt);function Lr(s){return typeof s=="string"}function Pa(s){return s in gt}var Oa=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function nl(s){return Oa.some(function(l){return s.indexOf(l)>-1})}var cf=["3857","900913","3785","102113"];function sl(s){var l=Z(s,"authority");if(!!l){var f=Z(l,"epsg");return f&&cf.indexOf(f)>-1}}function Ia(s){var l=Z(s,"extension");if(!!l)return Z(l,"proj4")}function Hi(s){return s[0]==="+"}function ol(s){if(Lr(s)){if(Pa(s))return gt[s];if(nl(s)){var l=il(s);if(sl(l))return gt["EPSG:3857"];var f=Ia(l);return f?ie(f):l}if(Hi(s))return ie(s)}else return s}var $s=function(s,l){s=s||{};var f,y;if(!l)return s;for(y in l)f=l[y],f!==void 0&&(s[y]=f);return s},kt=function(s,l,f){var y=s*l;return f/Math.sqrt(1-y*y)},Wi=function(s){return s<0?-1:1},Y=function(s){return Math.abs(s)<=L?s:s-Wi(s)*P},ct=function(s,l,f){var y=s*f,g=.5*s;return y=Math.pow((1-y)/(1+y),g),Math.tan(.5*(m-l))/y},kr=function(s,l){for(var f=.5*s,y,g,S=m-2*Math.atan(l),R=0;R<=15;R++)if(y=s*Math.sin(S),g=m-2*Math.atan(l*Math.pow((1-y)/(1+y),f))-S,S+=g,Math.abs(g)<=1e-10)return S;return-9999};function Fs(){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=kt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function al(s){var l=s.x,f=s.y;if(f*T>90&&f*T<-90&&l*T>180&&l*T<-180)return null;var y,g;if(Math.abs(Math.abs(f)-m)<=b)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*f));else{var S=Math.sin(f),R=ct(this.e,f,S);y=this.x0+this.a*this.k0*Y(l-this.long0),g=this.y0-this.a*this.k0*Math.log(R)}return s.x=y,s.y=g,s}function ll(s){var l=s.x-this.x0,f=s.y-this.y0,y,g;if(this.sphere)g=m-2*Math.atan(Math.exp(-f/(this.a*this.k0)));else{var S=Math.exp(-f/(this.a*this.k0));if(g=kr(this.e,S),g===-9999)return null}return y=Y(this.long0+l/(this.a*this.k0)),s.x=y,s.y=g,s}var ul=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"],ff={init:Fs,forward:al,inverse:ll,names:ul};function cl(){}function La(s){return s}var fl=["longlat","identity"],zn={init:cl,forward:La,inverse:La,names:fl},hl=[ff,zn],ka={},yi=[];function Na(s,l){var f=yi.length;return s.names?(yi[f]=s,s.names.forEach(function(y){ka[y.toLowerCase()]=f}),this):(console.log(l),!0)}function hf(s){if(!s)return!1;var l=s.toLowerCase();if(typeof ka[l]<"u"&&yi[ka[l]])return yi[ka[l]]}function dl(){hl.forEach(Na)}var Ba={start:dl,add:Na,get:hf},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 df=ue.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};ue.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};function Vr(s,l,f,y){var g=s*s,S=l*l,R=(g-S)/g,_=0;y?(s*=1-R*(v+R*(E+R*w)),g=s*s,R=0):_=Math.sqrt(R);var A=(g-S)/S;return{es:R,e:_,ep2:A}}function jn(s,l,f,y,g){if(!s){var S=Z(ue,y);S||(S=df),s=S.a,l=S.b,f=S.rf}return f&&!l&&(l=(1-1/f)*s),(f===0||Math.abs(s-l)<b)&&(g=!0,l=s),{a:s,b:l,rf:f,sphere:g}}var Ye={};Ye.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},Ye.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},Ye.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},Ye.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},Ye.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},Ye.potsdam={towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},Ye.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},Ye.hermannskogel={towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},Ye.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},Ye.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},Ye.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},Ye.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},Ye.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"},Ye.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},Ye.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},Ye.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},Ye.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};function bi(s,l,f,y,g,S,R){var _={};return s===void 0||s==="none"?_.datum_type=o:_.datum_type=n,l&&(_.datum_params=l.map(parseFloat),(_.datum_params[0]!==0||_.datum_params[1]!==0||_.datum_params[2]!==0)&&(_.datum_type=e),_.datum_params.length>3&&(_.datum_params[3]!==0||_.datum_params[4]!==0||_.datum_params[5]!==0||_.datum_params[6]!==0)&&(_.datum_type=r,_.datum_params[3]*=p,_.datum_params[4]*=p,_.datum_params[5]*=p,_.datum_params[6]=_.datum_params[6]/1e6+1)),R&&(_.datum_type=i,_.grids=R),_.a=f,_.b=y,_.es=g,_.ep2=S,_}var qs={};function vi(s,l){var f=new DataView(l),y=Hs(f),g=pl(f,y);g.nSubgrids>1&&console.log("Only single NTv2 subgrids are currently supported, subsequent sub grids are ignored");var S=gl(f,g,y),R={header:g,subgrids:S};return qs[s]=R,R}function ml(s){if(s===void 0)return null;var l=s.split(",");return l.map(Da)}function Da(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:qs[s]||null,isNull:!1}}function wi(s){return s/3600*Math.PI/180}function Hs(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 pl(s,l){return{nFields:s.getInt32(8,l),nSubgridFields:s.getInt32(24,l),nSubgrids:s.getInt32(40,l),shiftType:Ws(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 Ws(s,l,f){return String.fromCharCode.apply(null,new Uint8Array(s.buffer.slice(l,f)))}function gl(s,l,f){for(var y=176,g=[],S=0;S<l.nSubgrids;S++){var R=yl(s,y,f),_=mf(s,y,R,f),A=Math.round(1+(R.upperLongitude-R.lowerLongitude)/R.longitudeInterval),I=Math.round(1+(R.upperLatitude-R.lowerLatitude)/R.latitudeInterval);g.push({ll:[wi(R.lowerLongitude),wi(R.lowerLatitude)],del:[wi(R.longitudeInterval),wi(R.latitudeInterval)],lim:[A,I],count:R.gridNodeCount,cvs:za(_)})}return g}function za(s){return s.map(function(l){return[wi(l.longitudeShift),wi(l.latitudeShift)]})}function yl(s,l,f){return{name:Ws(s,l+8,l+16).trim(),parent:Ws(s,l+24,l+24+8).trim(),lowerLatitude:s.getFloat64(l+72,f),upperLatitude:s.getFloat64(l+88,f),lowerLongitude:s.getFloat64(l+104,f),upperLongitude:s.getFloat64(l+120,f),latitudeInterval:s.getFloat64(l+136,f),longitudeInterval:s.getFloat64(l+152,f),gridNodeCount:s.getInt32(l+168,f)}}function mf(s,l,f,y){for(var g=l+176,S=16,R=[],_=0;_<f.gridNodeCount;_++){var A={latitudeShift:s.getFloat32(g+_*S,y),longitudeShift:s.getFloat32(g+_*S+4,y),latitudeAccuracy:s.getFloat32(g+_*S+8,y),longitudeAccuracy:s.getFloat32(g+_*S+12,y)};R.push(A)}return R}function pr(s,l){if(!(this instanceof pr))return new pr(s);l=l||function(I){if(I)throw I};var f=ol(s);if(typeof f!="object"){l(s);return}var y=pr.projections.get(f.projName);if(!y){l(s);return}if(f.datumCode&&f.datumCode!=="none"){var g=Z(Ye,f.datumCode);g&&(f.datum_params=f.datum_params||(g.towgs84?g.towgs84.split(","):null),f.ellps=g.ellipse,f.datumName=g.datumName?g.datumName:f.datumCode)}f.k0=f.k0||1,f.axis=f.axis||"enu",f.ellps=f.ellps||"wgs84",f.lat1=f.lat1||f.lat0;var S=jn(f.a,f.b,f.rf,f.ellps,f.sphere),R=Vr(S.a,S.b,S.rf,f.R_A),_=ml(f.nadgrids),A=f.datum||bi(f.datumCode,f.datum_params,S.a,S.b,R.es,R.ep2,_);$s(this,f),$s(this,y),this.a=S.a,this.b=S.b,this.rf=S.rf,this.sphere=S.sphere,this.es=R.es,this.e=R.e,this.ep2=R.ep2,this.datum=A,this.init(),l(null,this)}pr.projections=Ba,pr.projections.start();function pf(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 ja(s,l,f){var y=s.x,g=s.y,S=s.z?s.z:0,R,_,A,I;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),_=Math.sin(g),I=Math.cos(g),A=_*_,R=f/Math.sqrt(1-l*A),{x:(R+S)*I*Math.cos(y),y:(R+S)*I*Math.sin(y),z:(R*(1-l)+S)*_}}function $n(s,l,f,y){var g=1e-12,S=g*g,R=30,_,A,I,D,k,j,W,H,V,J,ne,fe,be,Ke=s.x,ze=s.y,He=s.z?s.z:0,Rt,st,ri;if(_=Math.sqrt(Ke*Ke+ze*ze),A=Math.sqrt(Ke*Ke+ze*ze+He*He),_/f<g){if(Rt=0,A/f<g)return st=m,ri=-y,{x:s.x,y:s.y,z:s.z}}else Rt=Math.atan2(ze,Ke);I=He/A,D=_/A,k=1/Math.sqrt(1-l*(2-l)*D*D),H=D*(1-l)*k,V=I*k,be=0;do be++,W=f/Math.sqrt(1-l*V*V),ri=_*H+He*V-W*(1-l*V*V),j=l*W/(W+ri),k=1/Math.sqrt(1-j*(2-j)*D*D),J=D*(1-j)*k,ne=I*k,fe=ne*H-J*V,H=J,V=ne;while(fe*fe>S&&be<R);return st=Math.atan(ne/Math.abs(J)),{x:Rt,y:st,z:ri}}function gf(s,l,f){if(l===e)return{x:s.x+f[0],y:s.y+f[1],z:s.z+f[2]};if(l===r){var y=f[0],g=f[1],S=f[2],R=f[3],_=f[4],A=f[5],I=f[6];return{x:I*(s.x-A*s.y+_*s.z)+y,y:I*(A*s.x+s.y-R*s.z)+g,z:I*(-_*s.x+R*s.y+s.z)+S}}}function Us(s,l,f){if(l===e)return{x:s.x-f[0],y:s.y-f[1],z:s.z-f[2]};if(l===r){var y=f[0],g=f[1],S=f[2],R=f[3],_=f[4],A=f[5],I=f[6],D=(s.x-y)/I,k=(s.y-g)/I,j=(s.z-S)/I;return{x:D+A*k-_*j,y:-A*D+k+R*j,z:_*D-R*k+j}}}function Kr(s){return s===e||s===r}var Gs=function(s,l,f){if(pf(s,l)||s.datum_type===o||l.datum_type===o)return f;var y=s.a,g=s.es;if(s.datum_type===i){var S=Ut(s,!1,f);if(S!==0)return;y=a,g=d}var R=l.a,_=l.b,A=l.es;if(l.datum_type===i&&(R=a,_=c,A=d),g===A&&y===R&&!Kr(s.datum_type)&&!Kr(l.datum_type))return f;if(f=ja(f,g,y),Kr(s.datum_type)&&(f=gf(f,s.datum_type,s.datum_params)),Kr(l.datum_type)&&(f=Us(f,l.datum_type,l.datum_params)),f=$n(f,A,R,_),l.datum_type===i){var I=Ut(l,!0,f);if(I!==0)return}return f};function Ut(s,l,f){if(s.grids===null||s.grids.length===0)return console.log("Grid shift grids not found"),-1;for(var y={x:-f.x,y:f.y},g={x:Number.NaN,y:Number.NaN},S=[],R=0;R<s.grids.length;R++){var _=s.grids[R];if(S.push(_.name),_.isNull){g=y;break}if(_.grid===null){if(_.mandatory)return console.log("Unable to find mandatory grid '"+_.name+"'"),-1;continue}var A=_.grid.subgrids[0],I=(Math.abs(A.del[1])+Math.abs(A.del[0]))/1e4,D=A.ll[0]-I,k=A.ll[1]-I,j=A.ll[0]+(A.lim[0]-1)*A.del[0]+I,W=A.ll[1]+(A.lim[1]-1)*A.del[1]+I;if(!(k>y.y||D>y.x||W<y.y||j<y.x)&&(g=$a(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: '"+S+"'"),-1):(f.x=-g.x,f.y=g.y,0)}function $a(s,l,f){var y={x:Number.NaN,y:Number.NaN};if(isNaN(s.x))return y;var g={x:s.x,y:s.y};g.x-=f.ll[0],g.y-=f.ll[1],g.x=Y(g.x-Math.PI)+Math.PI;var S=Fa(g,f);if(l){if(isNaN(S.x))return y;S.x=g.x-S.x,S.y=g.y-S.y;var R=9,_=1e-12,A,I;do{if(I=Fa(S,f),isNaN(I.x)){console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.");break}A={x:g.x-(I.x+S.x),y:g.y-(I.y+S.y)},S.x+=A.x,S.y+=A.y}while(R--&&Math.abs(A.x)>_&&Math.abs(A.y)>_);if(R<0)return console.log("Inverse grid shift iterator failed to converge."),y;y.x=Y(S.x+f.ll[0]),y.y=S.y+f.ll[1]}else isNaN(S.x)||(y.x=s.x+S.x,y.y=s.y+S.y);return y}function Fa(s,l){var f={x:s.x/l.del[0],y:s.y/l.del[1]},y={x:Math.floor(f.x),y:Math.floor(f.y)},g={x:f.x-1*y.x,y:f.y-1*y.y},S={x:Number.NaN,y:Number.NaN},R;if(y.x<0||y.x>=l.lim[0]||y.y<0||y.y>=l.lim[1])return S;R=y.y*l.lim[0]+y.x;var _={x:l.cvs[R][0],y:l.cvs[R][1]};R++;var A={x:l.cvs[R][0],y:l.cvs[R][1]};R+=l.lim[0];var I={x:l.cvs[R][0],y:l.cvs[R][1]};R--;var D={x:l.cvs[R][0],y:l.cvs[R][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 S.x=W*_.x+j*A.x+H*D.x+k*I.x,S.y=W*_.y+j*A.y+H*D.y+k*I.y,S}var Fn=function(s,l,f){var y=f.x,g=f.y,S=f.z||0,R,_,A,I={};for(A=0;A<3;A++)if(!(l&&A===2&&f.z===void 0))switch(A===0?(R=y,"ew".indexOf(s.axis[A])!==-1?_="x":_="y"):A===1?(R=g,"ns".indexOf(s.axis[A])!==-1?_="y":_="x"):(R=S,_="z"),s.axis[A]){case"e":I[_]=R;break;case"w":I[_]=-R;break;case"n":I[_]=R;break;case"s":I[_]=-R;break;case"u":f[_]!==void 0&&(I.z=R);break;case"d":f[_]!==void 0&&(I.z=-R);break;default:return null}return I},qn=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},bl=function(s){vl(s.x),vl(s.y)};function vl(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 yf(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 Ui(s,l,f,y){var g;if(Array.isArray(f)&&(f=qn(f)),bl(f),s.datum&&l.datum&&yf(s,l)&&(g=new pr("WGS84"),f=Ui(s,g,f,y),s=g),y&&s.axis!=="enu"&&(f=Fn(s,!1,f)),s.projName==="longlat")f={x:f.x*M,y:f.y*M,z:f.z||0};else if(s.to_meter&&(f={x:f.x*s.to_meter,y:f.y*s.to_meter,z:f.z||0}),f=s.inverse(f),!f)return;if(s.from_greenwich&&(f.x+=s.from_greenwich),f=Gs(s.datum,l.datum,f),!!f)return l.from_greenwich&&(f={x:f.x-l.from_greenwich,y:f.y,z:f.z||0}),l.projName==="longlat"?f={x:f.x*T,y:f.y*T,z:f.z||0}:(f=l.forward(f),l.to_meter&&(f={x:f.x/l.to_meter,y:f.y/l.to_meter,z:f.z||0})),y&&l.axis!=="enu"?Fn(l,!0,f):f}var Gi=pr("WGS84");function Vs(s,l,f,y){var g,S,R;return Array.isArray(f)?(g=Ui(s,l,f,y)||{x:NaN,y:NaN},f.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(f.splice(3)):[g.x,g.y,f[2]].concat(f.splice(3)):[g.x,g.y].concat(f.splice(2)):[g.x,g.y]):(S=Ui(s,l,f,y),R=Object.keys(f),R.length===2||R.forEach(function(_){if(typeof s.name<"u"&&s.name==="geocent"||typeof l.name<"u"&&l.name==="geocent"){if(_==="x"||_==="y"||_==="z")return}else if(_==="x"||_==="y")return;S[_]=f[_]}),S)}function qa(s){return s instanceof pr?s:s.oProj?s.oProj:pr(s)}function Nt(s,l,f){s=qa(s);var y=!1,g;return typeof l>"u"?(l=s,s=Gi,y=!0):(typeof l.x<"u"||Array.isArray(l))&&(f=l,l=s,s=Gi,y=!0),l=qa(l),f?Vs(s,l,f):(g={forward:function(S,R){return Vs(s,l,S,R)},inverse:function(S,R){return Vs(l,s,S,R)}},y&&(g.oProj=l),g)}var Ha=6,Ks="AJSAJS",Vi="AFAFAF",Gt=65,bt=73,vt=79,Nr=86,Jr=90,Js={forward:wl,inverse:bf,toPoint:_l};function wl(s,l){return l=l||5,_f(vf({lat:s[1],lon:s[0]}),l)}function bf(s){var l=Zs(Ml(s.toUpperCase()));return l.lat&&l.lon?[l.lon,l.lat,l.lon,l.lat]:[l.left,l.bottom,l.right,l.top]}function _l(s){var l=Zs(Ml(s.toUpperCase()));return l.lat&&l.lon?[l.lon,l.lat]:[(l.left+l.right)/2,(l.top+l.bottom)/2]}function Wa(s){return s*(Math.PI/180)}function Sl(s){return 180*(s/Math.PI)}function vf(s){var l=s.lat,f=s.lon,y=6378137,g=.00669438,S=.9996,R,_,A,I,D,k,j,W=Wa(l),H=Wa(f),V,J;J=Math.floor((f+180)/6)+1,f===180&&(J=60),l>=56&&l<64&&f>=3&&f<12&&(J=32),l>=72&&l<84&&(f>=0&&f<9?J=31:f>=9&&f<21?J=33:f>=21&&f<33?J=35:f>=33&&f<42&&(J=37)),R=(J-1)*6-180+3,V=Wa(R),_=g/(1-g),A=y/Math.sqrt(1-g*Math.sin(W)*Math.sin(W)),I=Math.tan(W)*Math.tan(W),D=_*Math.cos(W)*Math.cos(W),k=Math.cos(W)*(H-V),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 ne=S*A*(k+(1-I+D)*k*k*k/6+(5-18*I+I*I+72*D-58*_)*k*k*k*k*k/120)+5e5,fe=S*(j+A*Math.tan(W)*(k*k/2+(5-I+9*D+4*D*D)*k*k*k*k/24+(61-58*I+I*I+600*D-330*_)*k*k*k*k*k*k/720));return l<0&&(fe+=1e7),{northing:Math.round(fe),easting:Math.round(ne),zoneNumber:J,zoneLetter:wf(l)}}function Zs(s){var l=s.northing,f=s.easting,y=s.zoneLetter,g=s.zoneNumber;if(g<0||g>60)return null;var S=.9996,R=6378137,_=.00669438,A,I=(1-Math.sqrt(1-_))/(1+Math.sqrt(1-_)),D,k,j,W,H,V,J,ne,fe,be=f-5e5,Ke=l;y<"N"&&(Ke-=1e7),J=(g-1)*6-180+3,A=_/(1-_),V=Ke/S,ne=V/(R*(1-_/4-3*_*_/64-5*_*_*_/256)),fe=ne+(3*I/2-27*I*I*I/32)*Math.sin(2*ne)+(21*I*I/16-55*I*I*I*I/32)*Math.sin(4*ne)+151*I*I*I/96*Math.sin(6*ne),D=R/Math.sqrt(1-_*Math.sin(fe)*Math.sin(fe)),k=Math.tan(fe)*Math.tan(fe),j=A*Math.cos(fe)*Math.cos(fe),W=R*(1-_)/Math.pow(1-_*Math.sin(fe)*Math.sin(fe),1.5),H=be/(D*S);var ze=fe-D*Math.tan(fe)/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);ze=Sl(ze);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(fe);He=J+Sl(He);var Rt;if(s.accuracy){var st=Zs({northing:s.northing+s.accuracy,easting:s.easting+s.accuracy,zoneLetter:s.zoneLetter,zoneNumber:s.zoneNumber});Rt={top:st.lat,right:st.lon,bottom:ze,left:He}}else Rt={lat:ze,lon:He};return Rt}function wf(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 _f(s,l){var f="00000"+s.easting,y="00000"+s.northing;return s.zoneNumber+s.zoneLetter+Sf(s.easting,s.northing,s.zoneNumber)+f.substr(f.length-5,l)+y.substr(y.length-5,l)}function Sf(s,l,f){var y=Ki(f),g=Math.floor(s/1e5),S=Math.floor(l/1e5)%20;return xl(g,S,y)}function Ki(s){var l=s%Ha;return l===0&&(l=Ha),l}function xl(s,l,f){var y=f-1,g=Ks.charCodeAt(y),S=Vi.charCodeAt(y),R=g+s-1,_=S+l,A=!1;R>Jr&&(R=R-Jr+Gt-1,A=!0),(R===bt||g<bt&&R>bt||(R>bt||g<bt)&&A)&&R++,(R===vt||g<vt&&R>vt||(R>vt||g<vt)&&A)&&(R++,R===bt&&R++),R>Jr&&(R=R-Jr+Gt-1),_>Nr?(_=_-Nr+Gt-1,A=!0):A=!1,(_===bt||S<bt&&_>bt||(_>bt||S<bt)&&A)&&_++,(_===vt||S<vt&&_>vt||(_>vt||S<vt)&&A)&&(_++,_===bt&&_++),_>Nr&&(_=_-Nr+Gt-1);var I=String.fromCharCode(R)+String.fromCharCode(_);return I}function Ml(s){if(s&&s.length===0)throw"MGRSPoint coverting from nothing";for(var l=s.length,f=null,y="",g,S=0;!/[A-Z]/.test(g=s.charAt(S));){if(S>=2)throw"MGRSPoint bad conversion from: "+s;y+=g,S++}var R=parseInt(y,10);if(S===0||S+3>l)throw"MGRSPoint bad conversion from: "+s;var _=s.charAt(S++);if(_<="A"||_==="B"||_==="Y"||_>="Z"||_==="I"||_==="O")throw"MGRSPoint zone letter "+_+" not handled: "+s;f=s.substring(S,S+=2);for(var A=Ki(R),I=El(f.charAt(0),A),D=Ji(f.charAt(1),A);D<Zi(_);)D+=2e6;var k=l-S;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 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(`
110
+ northing meters`+s;var j=k/2,W=0,H=0,V,J,ne,fe,be;return j>0&&(V=1e5/Math.pow(10,j),J=s.substring(S,S+j),W=parseFloat(J)*V,ne=s.substring(S+j),H=parseFloat(ne)*V),fe=W+I,be=H+D,{easting:fe,northing:be,zoneLetter:_,zoneNumber:R,accuracy:V}}function El(s,l){for(var f=Ks.charCodeAt(l-1),y=1e5,g=!1;f!==s.charCodeAt(0);){if(f++,f===bt&&f++,f===vt&&f++,f>Jr){if(g)throw"Bad character: "+s;f=Gt,g=!0}y+=1e5}return y}function Ji(s,l){if(s>"V")throw"MGRSPoint given invalid Northing "+s;for(var f=Vi.charCodeAt(l-1),y=0,g=!1;f!==s.charCodeAt(0);){if(f++,f===bt&&f++,f===vt&&f++,f>Nr){if(g)throw"Bad character: "+s;f=Gt,g=!0}y+=1e5}return y}function Zi(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 Br(s,l,f){if(!(this instanceof Br))return new Br(s,l,f);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=f||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}Br.fromMGRS=function(s){return new Br(_l(s))},Br.prototype.toMGRS=function(s){return wl([this.x,this.y],s)};var Rl=1,xf=.25,Ys=.046875,Xs=.01953125,Qs=.01068115234375,Mf=.75,Ef=.46875,Rf=.013020833333333334,Cf=.007120768229166667,gr=.3645833333333333,Af=.005696614583333333,Tf=.3076171875,Cl=function(s){var l=[];l[0]=Rl-s*(xf+s*(Ys+s*(Xs+s*Qs))),l[1]=s*(Mf-s*(Ys+s*(Xs+s*Qs)));var f=s*s;return l[2]=f*(Ef-s*(Rf+s*Cf)),f*=s,l[3]=f*(gr-s*Af),l[4]=f*s*Tf,l},_i=function(s,l,f,y){return f*=l,l*=l,y[0]*s-f*(y[1]+l*(y[2]+l*(y[3]+l*y[4])))},Ua=20,Yi=function(s,l,f){for(var y=1/(1-l),g=s,S=Ua;S;--S){var R=Math.sin(g),_=1-l*R*R;if(_=(_i(g,R,Math.cos(g),f)-s)*(_*Math.sqrt(_))*y,g-=_,Math.abs(_)<b)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=Cl(this.es),this.ml0=_i(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function Pf(s){var l=s.x,f=s.y,y=Y(l-this.long0),g,S,R,_=Math.sin(f),A=Math.cos(f);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)>b?Math.tan(f):0,V=Math.pow(H,2),J=Math.pow(V,2);g=1-this.es*Math.pow(_,2),D=D/Math.sqrt(g);var ne=_i(f,_,A,this.en);S=this.a*(this.k0*D*(1+k/6*(1-V+j+k/20*(5-18*V+J+14*j-58*V*j+k/42*(61+179*J-J*V-479*V)))))+this.x0,R=this.a*(this.k0*(ne-this.ml0+_*y*D/2*(1+k/12*(5-V+9*j+4*W+k/30*(61+J-58*V+270*j-330*V*j+k/56*(1385+543*J-J*V-3111*V))))))+this.y0}else{var I=A*Math.sin(y);if(Math.abs(Math.abs(I)-1)<b)return 93;if(S=.5*this.a*this.k0*Math.log((1+I)/(1-I))+this.x0,R=A*Math.cos(y)/Math.sqrt(1-Math.pow(I,2)),I=Math.abs(R),I>=1){if(I-1>b)return 93;R=0}else R=Math.acos(R);f<0&&(R=-R),R=this.a*this.k0*(R-this.lat0)+this.y0}return s.x=S,s.y=R,s}function Al(s){var l,f,y,g,S=(s.x-this.x0)*(1/this.a),R=(s.y-this.y0)*(1/this.a);if(this.es)if(l=this.ml0+R/this.k0,f=Yi(l,this.es,this.en),Math.abs(f)<m){var k=Math.sin(f),j=Math.cos(f),W=Math.abs(j)>b?Math.tan(f):0,H=this.ep2*Math.pow(j,2),V=Math.pow(H,2),J=Math.pow(W,2),ne=Math.pow(J,2);l=1-this.es*Math.pow(k,2);var fe=S*Math.sqrt(l)/this.k0,be=Math.pow(fe,2);l=l*W,y=f-l*be/(1-this.es)*.5*(1-be/12*(5+3*J-9*H*J+H-4*V-be/30*(61+90*J-252*H*J+45*ne+46*H-be/56*(1385+3633*J+4095*ne+1574*ne*J)))),g=Y(this.long0+fe*(1-be/6*(1+2*J+H-be/20*(5+28*J+24*ne+8*H*J+6*H-be/42*(61+662*J+1320*ne+720*ne*J))))/j)}else y=m*Wi(R),g=0;else{var _=Math.exp(S/this.k0),A=.5*(_-1/_),I=this.lat0+R/this.k0,D=Math.cos(I);l=Math.sqrt((1-Math.pow(D,2))/(1+Math.pow(A,2))),y=Math.asin(l),R<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 Of=["Fast_Transverse_Mercator","Fast Transverse Mercator"],eo={init:Si,forward:Pf,inverse:Al,names:Of},Ga=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 f=Math.max(s,l),y=Math.min(s,l)/(f||1);return f*Math.sqrt(1+Math.pow(y,2))},Tl=function(s){var l=1+s,f=l-1;return f===0?s:s*Math.log(l)/f},Pl=function(s){var l=Math.abs(s);return l=Tl(l*(1+l/(ir(1,l)+1))),s<0?-l:l},to=function(s,l){for(var f=2*Math.cos(2*l),y=s.length-1,g=s[y],S=0,R;--y>=0;)R=-S+f*g+s[y],S=g,g=R;return l+R*Math.sin(2*l)},Xi=function(s,l){for(var f=2*Math.cos(l),y=s.length-1,g=s[y],S=0,R;--y>=0;)R=-S+f*g+s[y],S=g,g=R;return Math.sin(l)*R},Va=function(s){var l=Math.exp(s);return l=(l+1/l)/2,l},Ka=function(s,l,f){for(var y=Math.sin(l),g=Math.cos(l),S=Ga(f),R=Va(f),_=2*g*R,A=-2*y*S,I=s.length-1,D=s[I],k=0,j=0,W=0,H,V;--I>=0;)H=j,V=k,j=D,k=W,D=-H+_*j-A*k+s[I],W=-V+A*j+_*k;return _=y*R,A=g*S,[_*D-A*W,_*W+A*D]};function If(){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&&(eo.init.apply(this),this.forward=eo.forward,this.inverse=eo.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),f=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)))))),f=f*l,this.cgb[1]=f*(7/3+l*(-8/5+l*(-227/45+l*(2704/315+l*(2323/945))))),this.cbg[1]=f*(5/3+l*(-16/15+l*(-13/9+l*(904/315+l*(-1522/945))))),f=f*l,this.cgb[2]=f*(56/15+l*(-136/35+l*(-1262/105+l*(73814/2835)))),this.cbg[2]=f*(-26/15+l*(34/21+l*(8/5+l*(-12686/2835)))),f=f*l,this.cgb[3]=f*(4279/630+l*(-332/35+l*(-399572/14175))),this.cbg[3]=f*(1237/630+l*(-12/5+l*(-24832/14175))),f=f*l,this.cgb[4]=f*(4174/315+l*(-144838/6237)),this.cbg[4]=f*(-734/315+l*(109598/31185)),f=f*l,this.cgb[5]=f*(601676/22275),this.cbg[5]=f*(444337/155925),f=Math.pow(l,2),this.Qn=this.k0/(1+l)*(1+f*(1/4+f*(1/64+f/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]=f*(-1/48+l*(-1/15+l*(437/1440+l*(-46/105+l*(1118711/3870720))))),this.gtu[1]=f*(13/48+l*(-3/5+l*(557/1440+l*(281/630+l*(-1983433/1935360))))),f=f*l,this.utg[2]=f*(-17/480+l*(37/840+l*(209/4480+l*(-5569/90720)))),this.gtu[2]=f*(61/240+l*(-103/140+l*(15061/26880+l*(167603/181440)))),f=f*l,this.utg[3]=f*(-4397/161280+l*(11/504+l*(830251/7257600))),this.gtu[3]=f*(49561/161280+l*(-179/168+l*(6601661/7257600))),f=f*l,this.utg[4]=f*(-4583/161280+l*(108847/3991680)),this.gtu[4]=f*(34729/80640+l*(-3418889/1995840)),f=f*l,this.utg[5]=f*(-20648693/638668800),this.gtu[5]=f*(212378941/319334400);var y=to(this.cbg,this.lat0);this.Zb=-this.Qn*(y+Xi(this.gtu,2*y))}function ro(s){var l=Y(s.x-this.long0),f=s.y;f=to(this.cbg,f);var y=Math.sin(f),g=Math.cos(f),S=Math.sin(l),R=Math.cos(l);f=Math.atan2(y,R*g),l=Math.atan2(S*g,ir(y,g*R)),l=Pl(Math.tan(l));var _=Ka(this.gtu,2*f,2*l);f=f+_[0],l=l+_[1];var A,I;return Math.abs(l)<=2.623395162778?(A=this.a*(this.Qn*l)+this.x0,I=this.a*(this.Qn*f+this.Zb)+this.y0):(A=1/0,I=1/0),s.x=A,s.y=I,s}function Lf(s){var l=(s.x-this.x0)*(1/this.a),f=(s.y-this.y0)*(1/this.a);f=(f-this.Zb)/this.Qn,l=l/this.Qn;var y,g;if(Math.abs(l)<=2.623395162778){var S=Ka(this.utg,2*f,2*l);f=f+S[0],l=l+S[1],l=Math.atan(Ga(l));var R=Math.sin(f),_=Math.cos(f),A=Math.sin(l),I=Math.cos(l);f=Math.atan2(R*I,ir(A,I*_)),l=Math.atan2(A,I*_),y=Y(l+this.long0),g=to(this.cgb,f)}else y=1/0,g=1/0;return s.x=y,s.y=g,s}var kf=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","tmerc"],Hn={init:If,forward:ro,inverse:Lf,names:kf},Nf=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},io="etmerc";function Ja(){var s=Nf(this.zone,this.long0);if(s===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(s)-183)*M,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,Hn.init.apply(this),this.forward=Hn.forward,this.inverse=Hn.inverse}var Bf=["Universal Transverse Mercator System","utm"],Df={init:Ja,names:Bf,dependsOn:io},Wn=function(s,l){return Math.pow((1-s)/(1+s),l)},Ol=20;function no(){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)*Wn(this.e*s,this.ratexp))}function Za(s){var l=s.x,f=s.y;return s.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*f+C),this.C)*Wn(this.e*Math.sin(f),this.ratexp))-m,s.x=this.C*l,s}function xi(s){for(var l=1e-14,f=s.x/this.C,y=s.y,g=Math.pow(Math.tan(.5*y+C)/this.K,1/this.C),S=Ol;S>0&&(y=2*Math.atan(g*Wn(this.e*Math.sin(s.y),-.5*this.e))-m,!(Math.abs(y-s.y)<l));--S)s.y=y;return S?(s.x=f,s.y=y,s):null}var Un=["gauss"],Qi={init:no,forward:Za,inverse:xi,names:Un};function Il(){Qi.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 zf(s){var l,f,y,g;return s.x=Y(s.x-this.long0),Qi.forward.apply(this,[s]),l=Math.sin(s.y),f=Math.cos(s.y),y=Math.cos(s.x),g=this.k0*this.R2/(1+this.sinc0*l+this.cosc0*f*y),s.x=g*f*Math.sin(s.x),s.y=g*(this.cosc0*l-this.sinc0*f*y),s.x=this.a*s.x+this.x0,s.y=this.a*s.y+this.y0,s}function Ya(s){var l,f,y,g,S;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,S=Math.sqrt(s.x*s.x+s.y*s.y)){var R=2*Math.atan2(S,this.R2);l=Math.sin(R),f=Math.cos(R),g=Math.asin(f*this.sinc0+s.y*l*this.cosc0/S),y=Math.atan2(s.x*l,S*this.cosc0*f-s.y*this.sinc0*l)}else g=this.phic0,y=0;return s.x=y,s.y=g,Qi.inverse.apply(this,[s]),s.x=Y(s.x+this.long0),s}var jf=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"],Ll={init:Il,forward:zf,inverse:Ya,names:jf};function so(s,l,f){return l*=f,Math.tan(.5*(m+s))*Math.pow((1-l)/(1+l),.5*f)}function Xa(){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)<=b&&(this.k0=.5*(1+Wi(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=b&&(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)<=b&&(this.k0=.5*this.cons*kt(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=kt(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 kl(s){var l=s.x,f=s.y,y=Math.sin(f),g=Math.cos(f),S,R,_,A,I,D,k=Y(l-this.long0);return Math.abs(Math.abs(l-this.long0)-Math.PI)<=b&&Math.abs(f+this.lat0)<=b?(s.x=NaN,s.y=NaN,s):this.sphere?(S=2*this.k0/(1+this.sinlat0*y+this.coslat0*g*Math.cos(k)),s.x=this.a*S*g*Math.sin(k)+this.x0,s.y=this.a*S*(this.coslat0*y-this.sinlat0*g*Math.cos(k))+this.y0,s):(R=2*Math.atan(this.ssfn_(f,y,this.e))-m,A=Math.cos(R),_=Math.sin(R),Math.abs(this.coslat0)<=b?(I=ct(this.e,f*this.con,this.con*y),D=2*this.a*this.k0*I/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)<b?(S=2*this.a*this.k0/(1+A*Math.cos(k)),s.y=S*_):(S=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*_+this.cosX0*A*Math.cos(k))),s.y=S*(this.cosX0*_-this.sinX0*A*Math.cos(k))+this.y0),s.x=S*A*Math.sin(k)+this.x0,s))}function Nl(s){s.x-=this.x0,s.y-=this.y0;var l,f,y,g,S,R=Math.sqrt(s.x*s.x+s.y*s.y);if(this.sphere){var _=2*Math.atan(R/(2*this.a*this.k0));return l=this.long0,f=this.lat0,R<=b?(s.x=l,s.y=f,s):(f=Math.asin(Math.cos(_)*this.sinlat0+s.y*Math.sin(_)*this.coslat0/R),Math.abs(this.coslat0)<b?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(_),R*this.coslat0*Math.cos(_)-s.y*this.sinlat0*Math.sin(_))),s.x=l,s.y=f,s)}else if(Math.abs(this.coslat0)<=b){if(R<=b)return f=this.lat0,l=this.long0,s.x=l,s.y=f,s;s.x*=this.con,s.y*=this.con,y=R*this.cons/(2*this.a*this.k0),f=this.con*kr(this.e,y),l=this.con*Y(this.con*this.long0+Math.atan2(s.x,-1*s.y))}else g=2*Math.atan(R*this.cosX0/(2*this.a*this.k0*this.ms1)),l=this.long0,R<=b?S=this.X0:(S=Math.asin(Math.cos(g)*this.sinX0+s.y*Math.sin(g)*this.cosX0/R),l=Y(this.long0+Math.atan2(s.x*Math.sin(g),R*this.cosX0*Math.cos(g)-s.y*this.sinX0*Math.sin(g)))),f=-1*kr(this.e,Math.tan(.5*(m+S)));return s.x=l,s.y=f,s}var $f=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],Ff={init:Xa,forward:kl,inverse:Nl,names:$f,ssfn_:so};function Qa(){var s=this.lat0;this.lambda0=this.long0;var l=Math.sin(s),f=this.a,y=this.rf,g=1/y,S=2*g-Math.pow(g,2),R=this.e=Math.sqrt(S);this.R=this.k0*f*Math.sqrt(1-S)/(1-S*Math.pow(l,2)),this.alpha=Math.sqrt(1+S/(1-S)*Math.pow(Math.cos(s),4)),this.b0=Math.asin(l/this.alpha);var _=Math.log(Math.tan(Math.PI/4+this.b0/2)),A=Math.log(Math.tan(Math.PI/4+s/2)),I=Math.log((1+R*l)/(1-R*l));this.K=_-this.alpha*A+this.alpha*R/2*I}function Bl(s){var l=Math.log(Math.tan(Math.PI/4-s.y/2)),f=this.e/2*Math.log((1+this.e*Math.sin(s.y))/(1-this.e*Math.sin(s.y))),y=-this.alpha*(l+f)+this.K,g=2*(Math.atan(Math.exp(y))-Math.PI/4),S=this.alpha*(s.x-this.lambda0),R=Math.atan(Math.sin(S)/(Math.sin(this.b0)*Math.tan(g)+Math.cos(this.b0)*Math.cos(S))),_=Math.asin(Math.cos(this.b0)*Math.sin(g)-Math.sin(this.b0)*Math.cos(g)*Math.cos(S));return s.y=this.R/2*Math.log((1+Math.sin(_))/(1-Math.sin(_)))+this.y0,s.x=this.R*R+this.x0,s}function qf(s){for(var l=s.x-this.x0,f=s.y-this.y0,y=l/this.R,g=2*(Math.atan(Math.exp(f/this.R))-Math.PI/4),S=Math.asin(Math.cos(this.b0)*Math.sin(g)+Math.sin(this.b0)*Math.cos(g)*Math.cos(y)),R=Math.atan(Math.sin(y)/(Math.cos(this.b0)*Math.cos(y)-Math.sin(this.b0)*Math.tan(g))),_=this.lambda0+R/this.alpha,A=0,I=S,D=-1e3,k=0;Math.abs(I-D)>1e-7;){if(++k>20)return;A=1/this.alpha*(Math.log(Math.tan(Math.PI/4+S/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(I))/2)),D=I,I=2*Math.atan(Math.exp(A))-Math.PI/2}return s.x=_,s.y=I,s}var Hf=["somerc"],Wf={init:Qa,forward:Bl,inverse:qf,names:Hf},Mi=1e-7;function en(s){var l=["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],f=typeof s.PROJECTION=="object"?Object.keys(s.PROJECTION)[0]:s.PROJECTION;return"no_uoff"in s||"no_off"in s||l.indexOf(f)!==-1}function oo(){var s,l,f,y,g,S,R,_,A,I,D=0,k,j=0,W=0,H=0,V=0,J=0,ne=0;this.no_off=en(this),this.no_rot="no_rot"in this;var fe=!1;"alpha"in this&&(fe=!0);var be=!1;if("rectified_grid_angle"in this&&(be=!0),fe&&(ne=this.alpha),be&&(D=this.rectified_grid_angle*M),fe||be)j=this.longc;else if(W=this.long1,V=this.lat1,H=this.long2,J=this.lat2,Math.abs(V-J)<=Mi||(s=Math.abs(V))<=Mi||Math.abs(s-m)<=Mi||Math.abs(Math.abs(this.lat0)-m)<=Mi||Math.abs(Math.abs(J)-m)<=Mi)throw new Error;var Ke=1-this.es;l=Math.sqrt(Ke),Math.abs(this.lat0)>b?(_=Math.sin(this.lat0),f=Math.cos(this.lat0),s=1-this.es*_*_,this.B=f*f,this.B=Math.sqrt(1+this.es*this.B*this.B/Ke),this.A=this.B*this.k0*l/s,y=this.B*l/(f*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,_),this.B)):(this.B=1/l,this.A=this.k0,this.E=y=g=1),fe||be?(fe?(k=Math.asin(Math.sin(ne)/y),be||(D=ne)):(k=D,ne=Math.asin(y*Math.sin(k))),this.lam0=j-Math.asin(.5*(g-1/g)*Math.tan(k))/this.B):(S=Math.pow(ct(this.e,V,Math.sin(V)),this.B),R=Math.pow(ct(this.e,J,Math.sin(J)),this.B),g=this.E/S,A=(R-S)/(R+S),I=this.E*this.E,I=(I-R*S)/(I+R*S),s=W-H,s<-Math.pi?H-=P:s>Math.pi&&(H+=P),this.lam0=Y(.5*(W+H)-Math.atan(I*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=ne=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(ne))),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 Gn(s){var l={},f,y,g,S,R,_,A,I;if(s.x=s.x-this.lam0,Math.abs(Math.abs(s.y)-m)>b){if(R=this.E/Math.pow(ct(this.e,s.y,Math.sin(s.y)),this.B),_=1/R,f=.5*(R-_),y=.5*(R+_),S=Math.sin(this.B*s.x),g=(f*this.singam-S*this.cosgam)/y,Math.abs(Math.abs(g)-1)<b)throw new Error;I=.5*this.ArB*Math.log((1-g)/(1+g)),_=Math.cos(this.B*s.x),Math.abs(_)<Mi?A=this.A*s.x:A=this.ArB*Math.atan2(f*this.cosgam+S*this.singam,_)}else I=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=I):(A-=this.u_0,l.x=I*this.cosrot+A*this.sinrot,l.y=A*this.cosrot-I*this.sinrot),l.x=this.a*l.x+this.x0,l.y=this.a*l.y+this.y0,l}function Dl(s){var l,f,y,g,S,R,_,A={};if(s.x=(s.x-this.x0)*(1/this.a),s.y=(s.y-this.y0)*(1/this.a),this.no_rot?(f=s.y,l=s.x):(f=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*f),g=.5*(y-1/y),S=.5*(y+1/y),R=Math.sin(this.BrA*l),_=(R*this.cosgam+g*this.singam)/S,Math.abs(Math.abs(_)-1)<b)A.x=0,A.y=_<0?-m:m;else{if(A.y=this.E/Math.sqrt((1+_)/(1-_)),A.y=kr(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-R*this.singam,Math.cos(this.BrA*l))}return A.x+=this.lam0,A}var ao=["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"],Vn={init:oo,forward:Gn,inverse:Dl,names:ao};function lo(){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)<b)){var s=this.b/this.a;this.e=Math.sqrt(1-s*s);var l=Math.sin(this.lat1),f=Math.cos(this.lat1),y=kt(this.e,l,f),g=ct(this.e,this.lat1,l),S=Math.sin(this.lat2),R=Math.cos(this.lat2),_=kt(this.e,S,R),A=ct(this.e,this.lat2,S),I=ct(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>b?this.ns=Math.log(y/_)/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(I,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function Zr(s){var l=s.x,f=s.y;Math.abs(2*Math.abs(f)-Math.PI)<=b&&(f=Wi(f)*(m-2*b));var y=Math.abs(Math.abs(f)-m),g,S;if(y>b)g=ct(this.e,f,Math.sin(f)),S=this.a*this.f0*Math.pow(g,this.ns);else{if(y=f*this.ns,y<=0)return null;S=0}var R=this.ns*Y(l-this.long0);return s.x=this.k0*(S*Math.sin(R))+this.x0,s.y=this.k0*(this.rh-S*Math.cos(R))+this.y0,s}function e1(s){var l,f,y,g,S,R=(s.x-this.x0)/this.k0,_=this.rh-(s.y-this.y0)/this.k0;this.ns>0?(l=Math.sqrt(R*R+_*_),f=1):(l=-Math.sqrt(R*R+_*_),f=-1);var A=0;if(l!==0&&(A=Math.atan2(f*R,f*_)),l!==0||this.ns>0){if(f=1/this.ns,y=Math.pow(l/(this.a*this.f0),f),g=kr(this.e,y),g===-9999)return null}else g=-m;return S=Y(A/this.ns+this.long0),s.x=S,s.y=g,s}var Uf=["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)"],tn={init:lo,forward:Zr,inverse:e1,names:Uf};function zl(){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 Gf(s){var l,f,y,g,S,R,_,A=s.x,I=s.y,D=Y(A-this.long0);return l=Math.pow((1+this.e*Math.sin(I))/(1-this.e*Math.sin(I)),this.alfa*this.e/2),f=2*(Math.atan(this.k*Math.pow(Math.tan(I/2+this.s45),this.alfa)/l)-this.s45),y=-D*this.alfa,g=Math.asin(Math.cos(this.ad)*Math.sin(f)+Math.sin(this.ad)*Math.cos(f)*Math.cos(y)),S=Math.asin(Math.cos(f)*Math.sin(y)/Math.cos(g)),R=this.n*S,_=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=_*Math.cos(R)/1,s.x=_*Math.sin(R)/1,this.czech||(s.y*=-1,s.x*=-1),s}function uo(s){var l,f,y,g,S,R,_,A,I=s.x;s.x=s.y,s.y=I,this.czech||(s.y*=-1,s.x*=-1),R=Math.sqrt(s.x*s.x+s.y*s.y),S=Math.atan2(s.y,s.x),g=S/Math.sin(this.s0),y=2*(Math.atan(Math.pow(this.ro0/R,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)),f=Math.asin(Math.cos(y)*Math.sin(g)/Math.cos(l)),s.x=this.long0-f/this.alfa,_=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(_))/(1-this.e*Math.sin(_)),this.e/2))-this.s45),Math.abs(_-s.y)<1e-10&&(A=1),_=s.y,D+=1;while(A===0&&D<15);return D>=15?null:s}var Vf=["Krovak","krovak"],Kf={init:zl,forward:Gf,inverse:uo,names:Vf},wt=function(s,l,f,y,g){return s*g-l*Math.sin(2*g)+f*Math.sin(4*g)-y*Math.sin(6*g)},Kn=function(s){return 1-.25*s*(1+s/16*(3+1.25*s))},Jn=function(s){return .375*s*(1+.25*s*(1+.46875*s))},Zn=function(s){return .05859375*s*s*(1+.75*s)},Yn=function(s){return s*s*s*(35/3072)},rn=function(s,l,f){var y=l*f;return s/Math.sqrt(1-y*y)},nn=function(s){return Math.abs(s)<m?s:s-Wi(s)*Math.PI},co=function(s,l,f,y,g){var S,R;S=s/l;for(var _=0;_<15;_++)if(R=(s-(l*S-f*Math.sin(2*S)+y*Math.sin(4*S)-g*Math.sin(6*S)))/(l-2*f*Math.cos(2*S)+4*y*Math.cos(4*S)-6*g*Math.cos(6*S)),S+=R,Math.abs(R)<=1e-10)return S;return NaN};function Jf(){this.sphere||(this.e0=Kn(this.es),this.e1=Jn(this.es),this.e2=Zn(this.es),this.e3=Yn(this.es),this.ml0=this.a*wt(this.e0,this.e1,this.e2,this.e3,this.lat0))}function jl(s){var l,f,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)),f=this.a*(Math.atan2(Math.tan(g),Math.cos(y))-this.lat0);else{var S=Math.sin(g),R=Math.cos(g),_=rn(this.a,this.e,S),A=Math.tan(g)*Math.tan(g),I=y*Math.cos(g),D=I*I,k=this.es*R*R/(1-this.es),j=this.a*wt(this.e0,this.e1,this.e2,this.e3,g);l=_*I*(1-D*A*(1/6-(8-A+8*k)*D/120)),f=j-this.ml0+_*S/R*D*(.5+(5-A+6*k)*D/24)}return s.x=l+this.x0,s.y=f+this.y0,s}function Zf(s){s.x-=this.x0,s.y-=this.y0;var l=s.x/this.a,f=s.y/this.a,y,g;if(this.sphere){var S=f+this.lat0;y=Math.asin(Math.sin(S)*Math.cos(l)),g=Math.atan2(Math.tan(l),Math.cos(S))}else{var R=this.ml0/this.a+f,_=co(R,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(_)-m)<=b)return s.x=this.long0,s.y=m,f<0&&(s.y*=-1),s;var A=rn(this.a,this.e,Math.sin(_)),I=A*A*A/this.a/this.a*(1-this.es),D=Math.pow(Math.tan(_),2),k=l*this.a/A,j=k*k;y=_-A*Math.tan(_)/I*k*k*(.5-(1+3*D)*k*k/24),g=k*(1-j*(D/3+(1+3*D)*D*j/15))/Math.cos(_)}return s.x=Y(g+this.long0),s.y=nn(y),s}var Yf=["Cassini","Cassini_Soldner","cass"],Yr={init:Jf,forward:jl,inverse:Zf,names:Yf},yr=function(s,l){var f;return s>1e-7?(f=s*l,(1-s*s)*(l/(1-f*f)-.5/s*Math.log((1-f)/(1+f)))):2*l},$l=1,t1=2,Xr=3,Qr=4;function nr(){var s=Math.abs(this.lat0);if(Math.abs(s-m)<b?this.mode=this.lat0<0?this.S_POLE:this.N_POLE:Math.abs(s)<b?this.mode=this.EQUIT:this.mode=this.OBLIQ,this.es>0){var l;switch(this.qp=yr(this.e,1),this.mmf=.5/(1-this.es),this.apa=Gl(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=yr(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 Xn(s){var l,f,y,g,S,R,_,A,I,D,k=s.x,j=s.y;if(k=Y(k-this.long0),this.sphere){if(S=Math.sin(j),D=Math.cos(j),y=Math.cos(k),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(f=this.mode===this.EQUIT?1+D*y:1+this.sinph0*S+this.cosph0*D*y,f<=b)return null;f=Math.sqrt(2/f),l=f*D*Math.sin(k),f*=this.mode===this.EQUIT?S:this.cosph0*S-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)<b)return null;f=C-j*.5,f=2*(this.mode===this.S_POLE?Math.cos(f):Math.sin(f)),l=f*Math.sin(k),f*=y}}else{switch(_=0,A=0,I=0,y=Math.cos(k),g=Math.sin(k),S=Math.sin(j),R=yr(this.e,S),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(_=R/this.qp,A=Math.sqrt(1-_*_)),this.mode){case this.OBLIQ:I=1+this.sinb1*_+this.cosb1*A*y;break;case this.EQUIT:I=1+A*y;break;case this.N_POLE:I=m+j,R=this.qp-R;break;case this.S_POLE:I=j-m,R=this.qp+R;break}if(Math.abs(I)<b)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:I=Math.sqrt(2/I),this.mode===this.OBLIQ?f=this.ymf*I*(this.cosb1*_-this.sinb1*A*y):f=(I=Math.sqrt(2/(1+A*y)))*_*this.ymf,l=this.xmf*I*A*g;break;case this.N_POLE:case this.S_POLE:R>=0?(l=(I=Math.sqrt(R))*g,f=y*(this.mode===this.S_POLE?I:-I)):l=f=0;break}}return s.x=this.a*l+this.x0,s.y=this.a*f+this.y0,s}function Fl(s){s.x-=this.x0,s.y-=this.y0;var l=s.x/this.a,f=s.y/this.a,y,g,S,R,_,A,I;if(this.sphere){var D=0,k,j=0;if(k=Math.sqrt(l*l+f*f),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)<=b?0:Math.asin(f*j/k),l*=j,f=D*k;break;case this.OBLIQ:g=Math.abs(k)<=b?this.lat0:Math.asin(D*this.sinph0+f*j*this.cosph0/k),l*=j*this.cosph0,f=(D-Math.sin(g)*this.sinph0)*k;break;case this.N_POLE:f=-f,g=m-g;break;case this.S_POLE:g-=m;break}y=f===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(l,f)}else{if(I=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(l/=this.dd,f*=this.dd,A=Math.sqrt(l*l+f*f),A<b)return s.x=this.long0,s.y=this.lat0,s;R=2*Math.asin(.5*A/this.rq),S=Math.cos(R),l*=R=Math.sin(R),this.mode===this.OBLIQ?(I=S*this.sinb1+f*R*this.cosb1/A,_=this.qp*I,f=A*this.cosb1*S-f*this.sinb1*R):(I=f*R/A,_=this.qp*I,f=A*S)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(f=-f),_=l*l+f*f,!_)return s.x=this.long0,s.y=this.lat0,s;I=1-_/this.qp,this.mode===this.S_POLE&&(I=-I)}y=Math.atan2(l,f),g=ho(Math.asin(I),this.apa)}return s.x=Y(this.long0+y),s.y=g,s}var Ei=.3333333333333333,ql=.17222222222222222,Hl=.10257936507936508,fo=.06388888888888888,Wl=.0664021164021164,Ul=.016415012942191543;function Gl(s){var l,f=[];return f[0]=s*Ei,l=s*s,f[0]+=l*ql,f[1]=l*fo,l*=s,f[0]+=l*Hl,f[1]+=l*Wl,f[2]=l*Ul,f}function ho(s,l){var f=s+s;return s+l[0]*Math.sin(f)+l[1]*Math.sin(f+f)+l[2]*Math.sin(f+f+f)}var Vl=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],Kl={init:nr,forward:Xn,inverse:Fl,names:Vl,S_POLE:$l,N_POLE:t1,EQUIT:Xr,OBLIQ:Qr},ei=function(s){return Math.abs(s)>1&&(s=s>1?1:-1),Math.asin(s)};function Xf(){Math.abs(this.lat1+this.lat2)<b||(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=kt(this.e3,this.sin_po,this.cos_po),this.qs1=yr(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=kt(this.e3,this.sin_po,this.cos_po),this.qs2=yr(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=yr(this.e3,this.sin_po,this.cos_po),Math.abs(this.lat1-this.lat2)>b?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 Qf(s){var l=s.x,f=s.y;this.sin_phi=Math.sin(f),this.cos_phi=Math.cos(f);var y=yr(this.e3,this.sin_phi,this.cos_phi),g=this.a*Math.sqrt(this.c-this.ns0*y)/this.ns0,S=this.ns0*Y(l-this.long0),R=g*Math.sin(S)+this.x0,_=this.rh-g*Math.cos(S)+this.y0;return s.x=R,s.y=_,s}function eh(s){var l,f,y,g,S,R;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?R=Math.asin((this.c-y*y)/(2*this.ns0)):(f=(this.c-y*y)/this.ns0,R=this.phi1z(this.e3,f)),S=Y(g/this.ns0+this.long0),s.x=S,s.y=R,s}function mo(s,l){var f,y,g,S,R,_=ei(.5*l);if(s<b)return _;for(var A=s*s,I=1;I<=25;I++)if(f=Math.sin(_),y=Math.cos(_),g=s*f,S=1-g*g,R=.5*S*S/y*(l/(1-A)-f/S+.5/s*Math.log((1-g)/(1+g))),_=_+R,Math.abs(R)<=1e-7)return _;return null}var th=["Albers_Conic_Equal_Area","Albers","aea"],Jl={init:Xf,forward:Qf,inverse:eh,names:th,phi1z:mo};function po(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function go(s){var l,f,y,g,S,R,_,A,I=s.x,D=s.y;return y=Y(I-this.long0),l=Math.sin(D),f=Math.cos(D),g=Math.cos(y),R=this.sin_p14*l+this.cos_p14*f*g,S=1,R>0||Math.abs(R)<=b?(_=this.x0+this.a*S*f*Math.sin(y)/R,A=this.y0+this.a*S*(this.cos_p14*l-this.sin_p14*f*g)/R):(_=this.x0+this.infinity_dist*f*Math.sin(y),A=this.y0+this.infinity_dist*(this.cos_p14*l-this.sin_p14*f*g)),s.x=_,s.y=A,s}function yo(s){var l,f,y,g,S,R;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),f=Math.sin(g),y=Math.cos(g),R=ei(y*this.sin_p14+s.y*f*this.cos_p14/l),S=Math.atan2(s.x*f,l*this.cos_p14*y-s.y*this.sin_p14*f),S=Y(this.long0+S)):(R=this.phic0,S=0),s.x=S,s.y=R,s}var Qn=["gnom"],bo={init:po,forward:go,inverse:yo,names:Qn},rh=function(s,l){var f=1-(1-s*s)/(2*s)*Math.log((1-s)/(1+s));if(Math.abs(Math.abs(l)-f)<1e-6)return l<0?-1*m:m;for(var y=Math.asin(.5*l),g,S,R,_,A=0;A<30;A++)if(S=Math.sin(y),R=Math.cos(y),_=s*S,g=Math.pow(1-_*_,2)/(2*R)*(l/(1-s*s)-S/(1-_*_)+.5/s*Math.log((1-_)/(1+_))),y+=g,Math.abs(g)<=1e-10)return y;return NaN};function ih(){this.sphere||(this.k0=kt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function Zl(s){var l=s.x,f=s.y,y,g,S=Y(l-this.long0);if(this.sphere)y=this.x0+this.a*S*Math.cos(this.lat_ts),g=this.y0+this.a*Math.sin(f)/Math.cos(this.lat_ts);else{var R=yr(this.e,Math.sin(f));y=this.x0+this.a*this.k0*S,g=this.y0+this.a*R*.5/this.k0}return s.x=y,s.y=g,s}function Yl(s){s.x-=this.x0,s.y-=this.y0;var l,f;return this.sphere?(l=Y(this.long0+s.x/this.a/Math.cos(this.lat_ts)),f=Math.asin(s.y/this.a*Math.cos(this.lat_ts))):(f=rh(this.e,2*s.y*this.k0/this.a),l=Y(this.long0+s.x/(this.a*this.k0))),s.x=l,s.y=f,s}var nh=["cea"],Xl={init:ih,forward:Zl,inverse:Yl,names:nh};function sh(){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 oh(s){var l=s.x,f=s.y,y=Y(l-this.long0),g=nn(f-this.lat0);return s.x=this.x0+this.a*y*this.rc,s.y=this.y0+this.a*g,s}function ah(s){var l=s.x,f=s.y;return s.x=Y(this.long0+(l-this.x0)/(this.a*this.rc)),s.y=nn(this.lat0+(f-this.y0)/this.a),s}var lh=["Equirectangular","Equidistant_Cylindrical","eqc"],uh={init:sh,forward:oh,inverse:ah,names:lh},es=20;function Ql(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=Kn(this.es),this.e1=Jn(this.es),this.e2=Zn(this.es),this.e3=Yn(this.es),this.ml0=this.a*wt(this.e0,this.e1,this.e2,this.e3,this.lat0)}function u(s){var l=s.x,f=s.y,y,g,S,R=Y(l-this.long0);if(S=R*Math.sin(f),this.sphere)Math.abs(f)<=b?(y=this.a*R,g=-1*this.a*this.lat0):(y=this.a*Math.sin(S)/Math.tan(f),g=this.a*(nn(f-this.lat0)+(1-Math.cos(S))/Math.tan(f)));else if(Math.abs(f)<=b)y=this.a*R,g=-1*this.ml0;else{var _=rn(this.a,this.e,Math.sin(f))/Math.tan(f);y=_*Math.sin(S),g=this.a*wt(this.e0,this.e1,this.e2,this.e3,f)-this.ml0+_*(1-Math.cos(S))}return s.x=y+this.x0,s.y=g+this.y0,s}function h(s){var l,f,y,g,S,R,_,A,I;if(y=s.x-this.x0,g=s.y-this.y0,this.sphere)if(Math.abs(g+this.a*this.lat0)<=b)l=Y(y/this.a+this.long0),f=0;else{R=this.lat0+g/this.a,_=y*y/this.a/this.a+R*R,A=R;var D;for(S=es;S;--S)if(D=Math.tan(A),I=-1*(R*(A*D+1)-A-.5*(A*A+_)*D)/((A-R)/D-1),A+=I,Math.abs(I)<=b){f=A;break}l=Y(this.long0+Math.asin(y*Math.tan(A)/this.a)/Math.sin(f))}else if(Math.abs(g+this.ml0)<=b)f=0,l=Y(this.long0+y/this.a);else{R=(this.ml0+g)/this.a,_=y*y/this.a/this.a+R*R,A=R;var k,j,W,H,V;for(S=es;S;--S)if(V=this.e*Math.sin(A),k=Math.sqrt(1-V*V)*Math.tan(A),j=this.a*wt(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,I=(R*(k*H+1)-H-.5*k*(H*H+_))/(this.es*Math.sin(2*A)*(H*H+_-2*R*H)/(4*k)+(R-H)*(k*W-2/Math.sin(2*A))-W),A-=I,Math.abs(I)<=b){f=A;break}k=Math.sqrt(1-this.es*Math.pow(Math.sin(f),2))*Math.tan(f),l=Y(this.long0+Math.asin(y*k/this.a)/Math.sin(f))}return s.x=l,s.y=f,s}var x=["Polyconic","poly"],O={init:Ql,forward:u,inverse:h,names:x};function B(){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 $(s){var l,f=s.x,y=s.y,g=y-this.lat0,S=f-this.long0,R=g/p*1e-5,_=S,A=1,I=0;for(l=1;l<=10;l++)A=A*R,I=I+this.A[l]*A;var D=I,k=_,j=1,W=0,H,V,J=0,ne=0;for(l=1;l<=6;l++)H=j*D-W*k,V=W*D+j*k,j=H,W=V,J=J+this.B_re[l]*j-this.B_im[l]*W,ne=ne+this.B_im[l]*j+this.B_re[l]*W;return s.x=ne*this.a+this.x0,s.y=J*this.a+this.y0,s}function q(s){var l,f=s.x,y=s.y,g=f-this.x0,S=y-this.y0,R=S/this.a,_=g/this.a,A=1,I=0,D,k,j=0,W=0;for(l=1;l<=6;l++)D=A*R-I*_,k=I*R+A*_,A=D,I=k,j=j+this.C_re[l]*A-this.C_im[l]*I,W=W+this.C_im[l]*A+this.C_re[l]*I;for(var H=0;H<this.iterations;H++){var V=j,J=W,ne,fe,be=R,Ke=_;for(l=2;l<=6;l++)ne=V*j-J*W,fe=J*j+V*W,V=ne,J=fe,be=be+(l-1)*(this.B_re[l]*V-this.B_im[l]*J),Ke=Ke+(l-1)*(this.B_im[l]*V+this.B_re[l]*J);V=1,J=0;var ze=this.B_re[1],He=this.B_im[1];for(l=2;l<=6;l++)ne=V*j-J*W,fe=J*j+V*W,V=ne,J=fe,ze=ze+l*(this.B_re[l]*V-this.B_im[l]*J),He=He+l*(this.B_im[l]*V+this.B_re[l]*J);var Rt=ze*ze+He*He;j=(be*ze+Ke*He)/Rt,W=(Ke*ze-be*He)/Rt}var st=j,ri=W,ts=1,rs=0;for(l=1;l<=9;l++)ts=ts*st,rs=rs+this.D[l]*ts;var iu=this.lat0+rs*p*1e5,O8=this.long0+ri;return s.x=O8,s.y=iu,s}var te=["New_Zealand_Map_Grid","nzmg"],he={init:B,forward:$,inverse:q,names:te};function _e(){}function Te(s){var l=s.x,f=s.y,y=Y(l-this.long0),g=this.x0+this.a*y,S=this.y0+this.a*Math.log(Math.tan(Math.PI/4+f/2.5))*1.25;return s.x=g,s.y=S,s}function Pe(s){s.x-=this.x0,s.y-=this.y0;var l=Y(this.long0+s.x/this.a),f=2.5*(Math.atan(Math.exp(.8*s.y/this.a))-Math.PI/4);return s.x=l,s.y=f,s}var nt=["Miller_Cylindrical","mill"],sr={init:_e,forward:Te,inverse:Pe,names:nt},sn=20;function ti(){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 Dr(s){var l,f,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 S=this.n*Math.sin(g),R=sn;R;--R){var _=(this.m*g+Math.sin(g)-S)/(this.m+Math.cos(g));if(g-=_,Math.abs(_)<b)break}l=this.a*this.C_x*y*(this.m+Math.cos(g)),f=this.a*this.C_y*g}else{var A=Math.sin(g),I=Math.cos(g);f=this.a*_i(g,A,I,this.en),l=this.a*y*I/Math.sqrt(1-this.es*A*A)}return s.x=l,s.y=f,s}function _t(s){var l,f,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=ei((this.m*l+Math.sin(l))/this.n):this.n!==1&&(l=ei(Math.sin(l)/this.n)),y=Y(y+this.long0),l=nn(l)):(l=Yi(s.y/this.a,this.es,this.en),g=Math.abs(l),g<m?(g=Math.sin(l),f=this.long0+s.x*Math.sqrt(1-this.es*g*g)/(this.a*Math.cos(l)),y=Y(f)):g-b<m&&(y=this.long0)),s.x=y,s.y=l,s}var Mt=["Sinusoidal","sinu"],Vt={init:ti,forward:Dr,inverse:_t,names:Mt};function zr(){}function se(s){for(var l=s.x,f=s.y,y=Y(l-this.long0),g=f,S=Math.PI*Math.sin(f);;){var R=-(g+Math.sin(g)-S)/(1+Math.cos(g));if(g+=R,Math.abs(R)<b)break}g/=2,Math.PI/2-Math.abs(f)<b&&(y=0);var _=.900316316158*this.a*y*Math.cos(g)+this.x0,A=1.4142135623731*this.a*Math.sin(g)+this.y0;return s.x=_,s.y=A,s}function ye(s){var l,f;s.x-=this.x0,s.y-=this.y0,f=s.y/(1.4142135623731*this.a),Math.abs(f)>.999999999999&&(f=.999999999999),l=Math.asin(f);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),f=(2*l+Math.sin(2*l))/Math.PI,Math.abs(f)>1&&(f=1);var g=Math.asin(f);return s.x=y,s.y=g,s}var Ge=["Mollweide","moll"],Bt={init:zr,forward:se,inverse:ye,names:Ge};function on(){Math.abs(this.lat1+this.lat2)<b||(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=Kn(this.es),this.e1=Jn(this.es),this.e2=Zn(this.es),this.e3=Yn(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=kt(this.e,this.sinphi,this.cosphi),this.ml1=wt(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<b?this.ns=this.sinphi:(this.sinphi=Math.sin(this.lat2),this.cosphi=Math.cos(this.lat2),this.ms2=kt(this.e,this.sinphi,this.cosphi),this.ml2=wt(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=wt(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function an(s){var l=s.x,f=s.y,y;if(this.sphere)y=this.a*(this.g-f);else{var g=wt(this.e0,this.e1,this.e2,this.e3,f);y=this.a*(this.g-g)}var S=this.ns*Y(l-this.long0),R=this.x0+y*Math.sin(S),_=this.y0+this.rh-y*Math.cos(S);return s.x=R,s.y=_,s}function ln(s){s.x-=this.x0,s.y=this.rh-s.y+this.y0;var l,f,y,g;this.ns>=0?(f=Math.sqrt(s.x*s.x+s.y*s.y),l=1):(f=-Math.sqrt(s.x*s.x+s.y*s.y),l=-1);var S=0;if(f!==0&&(S=Math.atan2(l*s.x,l*s.y)),this.sphere)return g=Y(this.long0+S/this.ns),y=nn(this.g-f/this.a),s.x=g,s.y=y,s;var R=this.g-f/this.a;return y=co(R,this.e0,this.e1,this.e2,this.e3),g=Y(this.long0+S/this.ns),s.x=g,s.y=y,s}var vo=["Equidistant_Conic","eqdc"],eu={init:on,forward:an,inverse:ln,names:vo};function r1(){this.R=this.a}function q4(s){var l=s.x,f=s.y,y=Y(l-this.long0),g,S;Math.abs(f)<=b&&(g=this.x0+this.R*y,S=this.y0);var R=ei(2*Math.abs(f/Math.PI));(Math.abs(y)<=b||Math.abs(Math.abs(f)-m)<=b)&&(g=this.x0,f>=0?S=this.y0+Math.PI*this.R*Math.tan(.5*R):S=this.y0+Math.PI*this.R*-Math.tan(.5*R));var _=.5*Math.abs(Math.PI/y-y/Math.PI),A=_*_,I=Math.sin(R),D=Math.cos(R),k=D/(I+D-1),j=k*k,W=k*(2/I-1),H=W*W,V=Math.PI*this.R*(_*(k-H)+Math.sqrt(A*(k-H)*(k-H)-(H+A)*(j-H)))/(H+A);y<0&&(V=-V),g=this.x0+V;var J=A+k;return V=Math.PI*this.R*(W*J-_*Math.sqrt((H+A)*(A+1)-J*J))/(H+A),f>=0?S=this.y0+V:S=this.y0-V,s.x=g,s.y=S,s}function H4(s){var l,f,y,g,S,R,_,A,I,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,S=y*y+g*g,R=-Math.abs(g)*(1+S),_=R-2*g*g+y*y,A=-2*R+1+2*g*g+S*S,W=g*g/A+(2*_*_*_/A/A/A-9*R*_/A/A)/27,I=(R-_*_/3/A)/A,D=2*Math.sqrt(-I/3),k=3*W/I/D,Math.abs(k)>1&&(k>=0?k=1:k=-1),j=Math.acos(k)/3,s.y>=0?f=(-D*Math.cos(j+Math.PI/3)-_/3/A)*Math.PI:f=-(-D*Math.cos(j+Math.PI/3)-_/3/A)*Math.PI,Math.abs(y)<b?l=this.long0:l=Y(this.long0+Math.PI*(S-1+Math.sqrt(1+2*(y*y-g*g)+S*S))/2/y),s.x=l,s.y=f,s}var W4=["Van_der_Grinten_I","VanDerGrinten","vandg"],U4={init:r1,forward:q4,inverse:H4,names:W4};function G4(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)}function V4(s){var l=s.x,f=s.y,y=Math.sin(s.y),g=Math.cos(s.y),S=Y(l-this.long0),R,_,A,I,D,k,j,W,H,V,J,ne,fe,be,Ke,ze,He,Rt,st,ri,ts,rs,iu;return this.sphere?Math.abs(this.sin_p12-1)<=b?(s.x=this.x0+this.a*(m-f)*Math.sin(S),s.y=this.y0-this.a*(m-f)*Math.cos(S),s):Math.abs(this.sin_p12+1)<=b?(s.x=this.x0+this.a*(m+f)*Math.sin(S),s.y=this.y0+this.a*(m+f)*Math.cos(S),s):(Rt=this.sin_p12*y+this.cos_p12*g*Math.cos(S),ze=Math.acos(Rt),He=ze?ze/Math.sin(ze):1,s.x=this.x0+this.a*He*g*Math.sin(S),s.y=this.y0+this.a*He*(this.cos_p12*y-this.sin_p12*g*Math.cos(S)),s):(R=Kn(this.es),_=Jn(this.es),A=Zn(this.es),I=Yn(this.es),Math.abs(this.sin_p12-1)<=b?(D=this.a*wt(R,_,A,I,m),k=this.a*wt(R,_,A,I,f),s.x=this.x0+(D-k)*Math.sin(S),s.y=this.y0-(D-k)*Math.cos(S),s):Math.abs(this.sin_p12+1)<=b?(D=this.a*wt(R,_,A,I,m),k=this.a*wt(R,_,A,I,f),s.x=this.x0+(D+k)*Math.sin(S),s.y=this.y0+(D+k)*Math.cos(S),s):(j=y/g,W=rn(this.a,this.e,this.sin_p12),H=rn(this.a,this.e,y),V=Math.atan((1-this.es)*j+this.es*W*this.sin_p12/(H*g)),J=Math.atan2(Math.sin(S),this.cos_p12*Math.tan(V)-this.sin_p12*Math.cos(S)),J===0?st=Math.asin(this.cos_p12*Math.sin(V)-this.sin_p12*Math.cos(V)):Math.abs(Math.abs(J)-Math.PI)<=b?st=-Math.asin(this.cos_p12*Math.sin(V)-this.sin_p12*Math.cos(V)):st=Math.asin(Math.sin(S)*Math.cos(V)/Math.sin(J)),ne=this.e*this.sin_p12/Math.sqrt(1-this.es),fe=this.e*this.cos_p12*Math.cos(J)/Math.sqrt(1-this.es),be=ne*fe,Ke=fe*fe,ri=st*st,ts=ri*st,rs=ts*st,iu=rs*st,ze=W*st*(1-ri*Ke*(1-Ke)/6+ts/8*be*(1-2*Ke)+rs/120*(Ke*(4-7*Ke)-3*ne*ne*(1-7*Ke))-iu/48*be),s.x=this.x0+ze*Math.sin(J),s.y=this.y0+ze*Math.cos(J),s))}function K4(s){s.x-=this.x0,s.y-=this.y0;var l,f,y,g,S,R,_,A,I,D,k,j,W,H,V,J,ne,fe,be,Ke,ze,He,Rt,st;return this.sphere?(l=Math.sqrt(s.x*s.x+s.y*s.y),l>2*m*this.a?void 0:(f=l/this.a,y=Math.sin(f),g=Math.cos(f),S=this.long0,Math.abs(l)<=b?R=this.lat0:(R=ei(g*this.sin_p12+s.y*y*this.cos_p12/l),_=Math.abs(this.lat0)-m,Math.abs(_)<=b?this.lat0>=0?S=Y(this.long0+Math.atan2(s.x,-s.y)):S=Y(this.long0-Math.atan2(-s.x,s.y)):S=Y(this.long0+Math.atan2(s.x*y,l*this.cos_p12*g-s.y*this.sin_p12*y))),s.x=S,s.y=R,s)):(A=Kn(this.es),I=Jn(this.es),D=Zn(this.es),k=Yn(this.es),Math.abs(this.sin_p12-1)<=b?(j=this.a*wt(A,I,D,k,m),l=Math.sqrt(s.x*s.x+s.y*s.y),W=j-l,R=co(W/this.a,A,I,D,k),S=Y(this.long0+Math.atan2(s.x,-1*s.y)),s.x=S,s.y=R,s):Math.abs(this.sin_p12+1)<=b?(j=this.a*wt(A,I,D,k,m),l=Math.sqrt(s.x*s.x+s.y*s.y),W=l-j,R=co(W/this.a,A,I,D,k),S=Y(this.long0+Math.atan2(s.x,s.y)),s.x=S,s.y=R,s):(l=Math.sqrt(s.x*s.x+s.y*s.y),J=Math.atan2(s.x,s.y),H=rn(this.a,this.e,this.sin_p12),ne=Math.cos(J),fe=this.e*this.cos_p12*ne,be=-fe*fe/(1-this.es),Ke=3*this.es*(1-be)*this.sin_p12*this.cos_p12*ne/(1-this.es),ze=l/H,He=ze-be*(1+be)*Math.pow(ze,3)/6-Ke*(1+3*be)*Math.pow(ze,4)/24,Rt=1-be*He*He/2-ze*He*He*He/6,V=Math.asin(this.sin_p12*Math.cos(He)+this.cos_p12*Math.sin(He)*ne),S=Y(this.long0+Math.asin(Math.sin(J)*Math.sin(He)/Math.cos(V))),st=Math.sin(V),R=Math.atan2((st-this.es*Rt*this.sin_p12)*Math.tan(V),st*(1-this.es)),s.x=S,s.y=R,s))}var J4=["Azimuthal_Equidistant","aeqd"],Z4={init:G4,forward:V4,inverse:K4,names:J4};function Y4(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function X4(s){var l,f,y,g,S,R,_,A,I=s.x,D=s.y;return y=Y(I-this.long0),l=Math.sin(D),f=Math.cos(D),g=Math.cos(y),R=this.sin_p14*l+this.cos_p14*f*g,S=1,(R>0||Math.abs(R)<=b)&&(_=this.a*S*f*Math.sin(y),A=this.y0+this.a*S*(this.cos_p14*l-this.sin_p14*f*g)),s.x=_,s.y=A,s}function Q4(s){var l,f,y,g,S,R,_;return s.x-=this.x0,s.y-=this.y0,l=Math.sqrt(s.x*s.x+s.y*s.y),f=ei(l/this.a),y=Math.sin(f),g=Math.cos(f),R=this.long0,Math.abs(l)<=b?(_=this.lat0,s.x=R,s.y=_,s):(_=ei(g*this.sin_p14+s.y*y*this.cos_p14/l),S=Math.abs(this.lat0)-m,Math.abs(S)<=b?(this.lat0>=0?R=Y(this.long0+Math.atan2(s.x,-s.y)):R=Y(this.long0-Math.atan2(-s.x,s.y)),s.x=R,s.y=_,s):(R=Y(this.long0+Math.atan2(s.x*y,l*this.cos_p14*g-s.y*this.sin_p14*y)),s.x=R,s.y=_,s))}var e8=["ortho"],t8={init:Y4,forward:X4,inverse:Q4,names:e8},rt={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},qe={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function r8(){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=rt.TOP:this.lat0<=-(m-C/2)?this.face=rt.BOTTOM:Math.abs(this.long0)<=C?this.face=rt.FRONT:Math.abs(this.long0)<=m+C?this.face=this.long0>0?rt.RIGHT:rt.LEFT:this.face=rt.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 i8(s){var l={x:0,y:0},f,y,g,S,R,_,A={value:0};if(s.x-=this.long0,this.es!==0?f=Math.atan(this.one_minus_f_squared*Math.tan(s.y)):f=s.y,y=s.x,this.face===rt.TOP)S=m-f,y>=C&&y<=m+C?(A.value=qe.AREA_0,g=y-m):y>m+C||y<=-(m+C)?(A.value=qe.AREA_1,g=y>0?y-L:y+L):y>-(m+C)&&y<=-C?(A.value=qe.AREA_2,g=y+m):(A.value=qe.AREA_3,g=y);else if(this.face===rt.BOTTOM)S=m+f,y>=C&&y<=m+C?(A.value=qe.AREA_0,g=-y+m):y<C&&y>=-C?(A.value=qe.AREA_1,g=-y):y<-C&&y>=-(m+C)?(A.value=qe.AREA_2,g=-y-m):(A.value=qe.AREA_3,g=y>0?-y+L:-y-L);else{var I,D,k,j,W,H,V;this.face===rt.RIGHT?y=wo(y,+m):this.face===rt.BACK?y=wo(y,+L):this.face===rt.LEFT&&(y=wo(y,-m)),j=Math.sin(f),W=Math.cos(f),H=Math.sin(y),V=Math.cos(y),I=W*V,D=W*H,k=j,this.face===rt.FRONT?(S=Math.acos(I),g=tu(S,k,D,A)):this.face===rt.RIGHT?(S=Math.acos(D),g=tu(S,k,-I,A)):this.face===rt.BACK?(S=Math.acos(-I),g=tu(S,k,-D,A)):this.face===rt.LEFT?(S=Math.acos(-D),g=tu(S,k,I,A)):(S=g=0,A.value=qe.AREA_0)}return _=Math.atan(12/L*(g+Math.acos(Math.sin(g)*Math.cos(C))-m)),R=Math.sqrt((1-Math.cos(S))/(Math.cos(_)*Math.cos(_))/(1-Math.cos(Math.atan(1/Math.cos(g))))),A.value===qe.AREA_1?_+=m:A.value===qe.AREA_2?_+=L:A.value===qe.AREA_3&&(_+=1.5*L),l.x=R*Math.cos(_),l.y=R*Math.sin(_),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 n8(s){var l={lam:0,phi:0},f,y,g,S,R,_,A,I,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)),f=Math.atan2(s.y,s.x),s.x>=0&&s.x>=Math.abs(s.y)?k.value=qe.AREA_0:s.y>=0&&s.y>=Math.abs(s.x)?(k.value=qe.AREA_1,f-=m):s.x<0&&-s.x>=Math.abs(s.y)?(k.value=qe.AREA_2,f=f<0?f+L:f-L):(k.value=qe.AREA_3,f+=m),D=L/12*Math.tan(f),R=Math.sin(D)/(Math.cos(D)-1/Math.sqrt(2)),_=Math.atan(R),g=Math.cos(f),S=Math.tan(y),A=1-g*g*S*S*(1-Math.cos(Math.atan(1/Math.cos(_)))),A<-1?A=-1:A>1&&(A=1),this.face===rt.TOP)I=Math.acos(A),l.phi=m-I,k.value===qe.AREA_0?l.lam=_+m:k.value===qe.AREA_1?l.lam=_<0?_+L:_-L:k.value===qe.AREA_2?l.lam=_-m:l.lam=_;else if(this.face===rt.BOTTOM)I=Math.acos(A),l.phi=I-m,k.value===qe.AREA_0?l.lam=-_+m:k.value===qe.AREA_1?l.lam=-_:k.value===qe.AREA_2?l.lam=-_-m:l.lam=_<0?-_-L:-_+L;else{var j,W,H;j=A,D=j*j,D>=1?H=0:H=Math.sqrt(1-D)*Math.sin(_),D+=H*H,D>=1?W=0:W=Math.sqrt(1-D),k.value===qe.AREA_1?(D=W,W=-H,H=D):k.value===qe.AREA_2?(W=-W,H=-H):k.value===qe.AREA_3&&(D=W,W=H,H=-D),this.face===rt.RIGHT?(D=j,j=-W,W=D):this.face===rt.BACK?(j=-j,W=-W):this.face===rt.LEFT&&(D=j,j=W,W=-D),l.phi=Math.acos(-H)-m,l.lam=Math.atan2(W,j),this.face===rt.RIGHT?l.lam=wo(l.lam,-m):this.face===rt.BACK?l.lam=wo(l.lam,-L):this.face===rt.LEFT&&(l.lam=wo(l.lam,+m))}if(this.es!==0){var V,J,ne;V=l.phi<0?1:0,J=Math.tan(l.phi),ne=this.b/Math.sqrt(J*J+this.one_minus_f_squared),l.phi=Math.atan(Math.sqrt(this.a*this.a-ne*ne)/(this.one_minus_f*ne)),V&&(l.phi=-l.phi)}return l.lam+=this.long0,s.x=l.lam,s.y=l.phi,s}function tu(s,l,f,y){var g;return s<b?(y.value=qe.AREA_0,g=0):(g=Math.atan2(l,f),Math.abs(g)<=C?y.value=qe.AREA_0:g>C&&g<=m+C?(y.value=qe.AREA_1,g-=m):g>m+C||g<=-(m+C)?(y.value=qe.AREA_2,g=g>=0?g-L:g+L):(y.value=qe.AREA_3,g+=m)),g}function wo(s,l){var f=s+l;return f<-L?f+=P:f>+L&&(f-=P),f}var s8=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],o8={init:r8,forward:i8,inverse:n8,names:s8},ch=[[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]],i1=[[-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]],N2=.8487,B2=1.3523,D2=T/5,a8=1/D2,_o=18,ru=function(s,l){return s[0]+l*(s[1]+l*(s[2]+l*s[3]))},l8=function(s,l){return s[1]+l*(2*s[2]+l*3*s[3])};function u8(s,l,f,y){for(var g=l;y;--y){var S=s(g);if(g-=S,Math.abs(S)<f)break}return g}function c8(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function f8(s){var l=Y(s.x-this.long0),f=Math.abs(s.y),y=Math.floor(f*D2);y<0?y=0:y>=_o&&(y=_o-1),f=T*(f-a8*y);var g={x:ru(ch[y],f)*l,y:ru(i1[y],f)};return s.y<0&&(g.y=-g.y),g.x=g.x*this.a*N2+this.x0,g.y=g.y*this.a*B2+this.y0,g}function h8(s){var l={x:(s.x-this.x0)/(this.a*N2),y:Math.abs(s.y-this.y0)/(this.a*B2)};if(l.y>=1)l.x/=ch[_o][0],l.y=s.y<0?-m:m;else{var f=Math.floor(l.y*_o);for(f<0?f=0:f>=_o&&(f=_o-1);;)if(i1[f][0]>l.y)--f;else if(i1[f+1][0]<=l.y)++f;else break;var y=i1[f],g=5*(l.y-y[0])/(i1[f+1][0]-y[0]);g=u8(function(S){return(ru(y,S)-l.y)/l8(y,S)},g,b,100),l.x/=ru(ch[f],g),l.y=(5*f+g)*M,s.y<0&&(l.y=-l.y)}return l.x=Y(l.x+this.long0),l}var d8=["Robinson","robin"],m8={init:c8,forward:f8,inverse:h8,names:d8};function p8(){this.name="geocent"}function g8(s){var l=ja(s,this.es,this.a);return l}function y8(s){var l=$n(s,this.es,this.a,this.b);return l}var b8=["Geocentric","geocentric","geocent","Geocent"],v8={init:p8,forward:g8,inverse:y8,names:b8},Et={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},n1={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 w8(){if(Object.keys(n1).forEach(function(f){if(typeof this[f]>"u")this[f]=n1[f].def;else{if(n1[f].num&&isNaN(this[f]))throw new Error("Invalid parameter value, must be numeric "+f+" = "+this[f]);n1[f].num&&(this[f]=parseFloat(this[f]))}n1[f].degrees&&(this[f]=this[f]*M)}.bind(this)),Math.abs(Math.abs(this.lat0)-m)<b?this.mode=this.lat0<0?Et.S_POLE:Et.N_POLE:Math.abs(this.lat0)<b?this.mode=Et.EQUIT:(this.mode=Et.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 _8(s){s.x-=this.long0;var l=Math.sin(s.y),f=Math.cos(s.y),y=Math.cos(s.x),g,S;switch(this.mode){case Et.OBLIQ:S=this.sinph0*l+this.cosph0*f*y;break;case Et.EQUIT:S=f*y;break;case Et.S_POLE:S=-l;break;case Et.N_POLE:S=l;break}switch(S=this.pn1/(this.p-S),g=S*f*Math.sin(s.x),this.mode){case Et.OBLIQ:S*=this.cosph0*l-this.sinph0*f*y;break;case Et.EQUIT:S*=l;break;case Et.N_POLE:S*=-(f*y);break;case Et.S_POLE:S*=f*y;break}var R,_;return R=S*this.cg+g*this.sg,_=1/(R*this.sw*this.h1+this.cw),g=(g*this.cg-S*this.sg)*this.cw*_,S=R*_,s.x=g*this.a,s.y=S*this.a,s}function S8(s){s.x/=this.a,s.y/=this.a;var l={x:s.x,y:s.y},f,y,g;g=1/(this.pn1-s.y*this.sw),f=this.pn1*s.x*g,y=this.pn1*s.y*this.cw*g,s.x=f*this.cg+y*this.sg,s.y=y*this.cg-f*this.sg;var S=ir(s.x,s.y);if(Math.abs(S)<b)l.x=0,l.y=s.y;else{var R,_;switch(_=1-S*S*this.pfact,_=(this.p-Math.sqrt(_))/(this.pn1/S+S/this.pn1),R=Math.sqrt(1-_*_),this.mode){case Et.OBLIQ:l.y=Math.asin(R*this.sinph0+s.y*_*this.cosph0/S),s.y=(R-this.sinph0*Math.sin(l.y))*S,s.x*=_*this.cosph0;break;case Et.EQUIT:l.y=Math.asin(s.y*_/S),s.y=R*S,s.x*=_;break;case Et.N_POLE:l.y=Math.asin(R),s.y=-s.y;break;case Et.S_POLE:l.y=-Math.asin(R);break}l.x=Math.atan2(s.x,s.y)}return s.x=l.x+this.long0,s.y=l.y,s}var x8=["Tilted_Perspective","tpers"],M8={init:w8,forward:_8,inverse:S8,names:x8};function E8(){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 R8(s){var l=s.x,f=s.y,y,g,S,R;if(l=l-this.long0,this.shape==="ellipse"){f=Math.atan(this.radius_p2*Math.tan(f));var _=this.radius_p/ir(this.radius_p*Math.cos(f),Math.sin(f));if(g=_*Math.cos(l)*Math.cos(f),S=_*Math.sin(l)*Math.cos(f),R=_*Math.sin(f),(this.radius_g-g)*g-S*S-R*R*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(S/ir(R,y)),s.y=this.radius_g_1*Math.atan(R/y)):(s.x=this.radius_g_1*Math.atan(S/y),s.y=this.radius_g_1*Math.atan(R/ir(S,y)))}else this.shape==="sphere"&&(y=Math.cos(f),g=Math.cos(l)*y,S=Math.sin(l)*y,R=Math.sin(f),y=this.radius_g-g,this.flip_axis?(s.x=this.radius_g_1*Math.atan(S/ir(R,y)),s.y=this.radius_g_1*Math.atan(R/y)):(s.x=this.radius_g_1*Math.atan(S/y),s.y=this.radius_g_1*Math.atan(R/ir(S,y))));return s.x=s.x*this.a,s.y=s.y*this.a,s}function C8(s){var l=-1,f=0,y=0,g,S,R,_;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),f=Math.tan(s.x/this.radius_g_1)*ir(1,y)):(f=Math.tan(s.x/this.radius_g_1),y=Math.tan(s.y/this.radius_g_1)*ir(1,f));var A=y/this.radius_p;if(g=f*f+A*A+l*l,S=2*this.radius_g*l,R=S*S-4*g*this.C,R<0)return s.x=Number.NaN,s.y=Number.NaN,s;_=(-S-Math.sqrt(R))/(2*g),l=this.radius_g+_*l,f*=_,y*=_,s.x=Math.atan2(f,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),f=Math.tan(s.x/this.radius_g_1)*Math.sqrt(1+y*y)):(f=Math.tan(s.x/this.radius_g_1),y=Math.tan(s.y/this.radius_g_1)*Math.sqrt(1+f*f)),g=f*f+y*y+l*l,S=2*this.radius_g*l,R=S*S-4*g*this.C,R<0)return s.x=Number.NaN,s.y=Number.NaN,s;_=(-S-Math.sqrt(R))/(2*g),l=this.radius_g+_*l,f*=_,y*=_,s.x=Math.atan2(f,l),s.y=Math.atan(y*Math.cos(s.x)/l)}return s.x=s.x+this.long0,s}var A8=["Geostationary Satellite View","Geostationary_Satellite","geos"],T8={init:E8,forward:R8,inverse:C8,names:A8},P8=function(s){s.Proj.projections.add(eo),s.Proj.projections.add(Hn),s.Proj.projections.add(Df),s.Proj.projections.add(Ll),s.Proj.projections.add(Ff),s.Proj.projections.add(Wf),s.Proj.projections.add(Vn),s.Proj.projections.add(tn),s.Proj.projections.add(Kf),s.Proj.projections.add(Yr),s.Proj.projections.add(Kl),s.Proj.projections.add(Jl),s.Proj.projections.add(bo),s.Proj.projections.add(Xl),s.Proj.projections.add(uh),s.Proj.projections.add(O),s.Proj.projections.add(he),s.Proj.projections.add(sr),s.Proj.projections.add(Vt),s.Proj.projections.add(Bt),s.Proj.projections.add(eu),s.Proj.projections.add(U4),s.Proj.projections.add(Z4),s.Proj.projections.add(t8),s.Proj.projections.add(o8),s.Proj.projections.add(m8),s.Proj.projections.add(v8),s.Proj.projections.add(M8),s.Proj.projections.add(T8)};return Nt.defaultDatum="WGS84",Nt.Proj=pr,Nt.WGS84=new Nt.Proj("WGS84"),Nt.Point=Br,Nt.toPoint=qn,Nt.defs=gt,Nt.nadgrid=vi,Nt.transform=Ui,Nt.mgrs=Js,Nt.version="2.8.0",P8(Nt),Nt})});var Cd=G((GB,ag)=>{"use strict";function WM(t,e){return e}ag.exports=function(){let e=Error.prepareStackTrace;Error.prepareStackTrace=WM;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 fa=G((VB,lg)=>{"use strict";var UM=Symbol("pino.setLevel"),GM=Symbol("pino.getLevel"),VM=Symbol("pino.levelVal"),KM=Symbol("pino.useLevelLabels"),JM=Symbol("pino.useOnlyCustomLevels"),ZM=Symbol("pino.mixin"),YM=Symbol("pino.lsCache"),XM=Symbol("pino.chindings"),QM=Symbol("pino.asJson"),eE=Symbol("pino.write"),tE=Symbol("pino.redactFmt"),rE=Symbol("pino.time"),iE=Symbol("pino.timeSliceIndex"),nE=Symbol("pino.stream"),sE=Symbol("pino.stringify"),oE=Symbol("pino.stringifySafe"),aE=Symbol("pino.stringifiers"),lE=Symbol("pino.end"),uE=Symbol("pino.formatOpts"),cE=Symbol("pino.messageKey"),fE=Symbol("pino.nestedKey"),hE=Symbol("pino.nestedKeyStr"),dE=Symbol("pino.mixinMergeStrategy"),mE=Symbol("pino.wildcardFirst"),pE=Symbol.for("pino.serializers"),gE=Symbol.for("pino.formatters"),yE=Symbol.for("pino.hooks"),bE=Symbol.for("pino.metadata");lg.exports={setLevelSym:UM,getLevelSym:GM,levelValSym:VM,useLevelLabelsSym:KM,mixinSym:ZM,lsCacheSym:YM,chindingsSym:XM,asJsonSym:QM,writeSym:eE,serializersSym:pE,redactFmtSym:tE,timeSym:rE,timeSliceIndexSym:iE,streamSym:nE,stringifySym:sE,stringifySafeSym:oE,stringifiersSym:aE,endSym:lE,formatOptsSym:uE,messageKeySym:cE,nestedKeySym:fE,wildcardFirstSym:mE,needsMetadataGsym:bE,useOnlyCustomLevelsSym:JM,formattersSym:gE,hooksSym:yE,nestedKeyStrSym:hE,mixinMergeStrategySym:dE}});var Pd=G((KB,hg)=>{"use strict";var Td=Mh(),{redactFmtSym:vE,wildcardFirstSym:Tc}=fa(),{rx:Ad,validator:wE}=Td,ug=wE({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})`}),cg="[Redacted]",fg=!1;function _E(t,e){let{paths:r,censor:i}=SE(t),n=r.reduce((c,d)=>{Ad.lastIndex=0;let p=Ad.exec(d),m=Ad.exec(d),v=p[1]!==void 0?p[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,"$1"):p[0];if(v==="*"&&(v=Tc),m===null)return c[v]=null,c;if(c[v]===null)return c;let{index:E}=m,w=`${d.substr(E,d.length-1)}`;return c[v]=c[v]||[],v!==Tc&&c[v].length===0&&c[v].push(...c[Tc]||[]),v===Tc&&Object.keys(c).forEach(function(b){c[b]&&c[b].push(w)}),c[v].push(w),c},{}),o={[vE]:Td({paths:r,censor:i,serialize:e,strict:fg})},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,v)=>i(m,[d,...v]):i;c[d]=Td({paths:n[d],censor:p,serialize:e,strict:fg})}return c},o)}function SE(t){if(Array.isArray(t))return t={paths:t,censor:cg},ug(t),t;let{paths:e,censor:r=cg,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),ug({paths:e,censor:r}),{paths:e,censor:r}}hg.exports=_E});var mg=G((JB,dg)=>{"use strict";var xE=()=>"",ME=()=>`,"time":${Date.now()}`,EE=()=>`,"time":${Math.round(Date.now()/1e3)}`,RE=()=>`,"time":"${new Date(Date.now()).toISOString()}"`;dg.exports={nullTime:xE,epochTime:ME,unixTime:EE,isoTime:RE}});var Ld=G((ZB,pg)=>{"use strict";var{createRequire:CE}=require("module"),AE=Cd(),{join:Od,isAbsolute:TE}=require("path"),PE=uu(),Id=u1(),OE=Dh();function IE(t){Id.register(t,kE),Id.registerBeforeExit(t,NE),t.on("close",function(){Id.unregister(t)})}function LE(t,e,r){let i=new OE({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&&IE(i)}function o(){i.closed||(i.flushSync(),PE(100),i.end())}return i}function kE(t){t.ref(),t.flushSync(),t.end(),t.once("close",function(){t.unref()})}function NE(t){t.flushSync()}function BE(t){let{pipeline:e,targets:r,levels:i,options:n={},worker:o={},caller:a=AE()}=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"]||Od(__dirname,"worker.js"),n.targets=r.map(v=>({...v,target:m(v.target)}))):e&&(p=d["pino-pipeline-worker"]||Od(__dirname,"worker-pipeline.js"),n.targets=e.map(v=>({...v,target:m(v.target)}))),i&&(n.levels=i),LE(m(p),n,o);function m(v){if(v=d[v]||v,TE(v)||v.indexOf("file://")===0)return v;if(v==="pino/file")return Od(__dirname,"..","file.js");let E;for(let w of c)try{E=CE(w).resolve(v);break}catch{continue}if(!E)throw new Error(`unable to determine transport target for "${v}"`);return E}}pg.exports=BE});var Oc=G((YB,Cg)=>{"use strict";var gg=Ah(),{mapHttpRequest:DE,mapHttpResponse:zE}=l1(),kd=Oh(),yg=u1(),{lsCacheSym:jE,chindingsSym:_g,writeSym:bg,serializersSym:Sg,formatOptsSym:vg,endSym:$E,stringifiersSym:xg,stringifySym:Mg,stringifySafeSym:Nd,wildcardFirstSym:Eg,nestedKeySym:FE,formattersSym:Rg,messageKeySym:qE,nestedKeyStrSym:HE}=fa(),{isMainThread:WE}=require("worker_threads"),UE=Ld();function G1(){}function GE(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=DE(i):typeof i.setHeader=="function"&&(i=zE(i)));let a;o===null&&n.length===0?a=[null]:(o=n.shift(),a=n),this[bg](i,gg(o,a,this[vg]),t)}else this[bg](null,gg(i,n,this[vg]),t)}}function wg(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 VE(t,e,r,i){let n=this[Mg],o=this[Nd],a=this[xg],c=this[$E],d=this[_g],p=this[Sg],m=this[Rg],v=this[qE],E=this[jE][r]+i;E=E+d;let w;m.log&&(t=m.log(t));let b=a[Eg],M="";for(let C in t)if(w=t[C],Object.prototype.hasOwnProperty.call(t,C)&&w!==void 0){w=p[C]?p[C](w):w;let P=a[C]||b;switch(typeof w){case"undefined":case"function":continue;case"number":Number.isFinite(w)===!1&&(w=null);case"boolean":P&&(w=P(w));break;case"string":w=(P||wg)(w);break;default:w=(P||n)(w,o)}if(w===void 0)continue;M+=',"'+C+'":'+w}let T="";if(e!==void 0){w=p[v]?p[v](e):e;let C=a[v]||b;switch(typeof w){case"function":break;case"number":Number.isFinite(w)===!1&&(w=null);case"boolean":C&&(w=C(w)),T=',"'+v+'":'+w;break;case"string":w=(C||wg)(w),T=',"'+v+'":'+w;break;default:w=(C||n)(w,o),T=',"'+v+'":'+w}}return this[FE]&&M?E+this[HE]+M.slice(1)+"}"+T+c:E+M+T+c}function KE(t,e){let r,i=t[_g],n=t[Mg],o=t[Nd],a=t[xg],c=a[Eg],d=t[Sg],p=t[Rg].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 JE(t){return t.write!==t.constructor.prototype.write}function Pc(t){let e=new kd(t);return e.on("error",r),!t.sync&&WE&&(yg.register(e,ZE),e.on("close",function(){yg.unregister(e)})),e;function r(i){if(i.code==="EPIPE"){e.write=G1,e.end=G1,e.flushSync=G1,e.destroy=G1;return}e.removeListener("error",r),e.emit("error",i)}}function ZE(t,e){t.destroyed||(e==="beforeExit"?(t.flush(),t.on("drain",function(){t.end()})):t.flushSync())}function YE(t){return function(r,i,n={},o){if(typeof n=="string")o=Pc({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=Pc({dest:o})}else if(n instanceof kd||n.writable||n._writableState)o=n,n={};else if(n.transport){if(n.transport instanceof kd||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=UE({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||(JE(process.stdout)?o=process.stdout:o=Pc({fd:process.stdout.fd})),{opts:n,stream:o}}}function XE(t,e){try{return JSON.stringify(t)}catch{try{return(e||this[Nd])(t)}catch{return'"[unable to serialize, circular reference is too complex to analyze]"'}}}function QE(t,e,r){return{level:t,bindings:e,log:r}}function eR(t){let e=Number(t);return typeof t=="string"&&Number.isFinite(e)?e:t}Cg.exports={noop:G1,buildSafeSonicBoom:Pc,asChindings:KE,asJson:VE,genLog:GE,createArgsNormalizer:YE,stringify:XE,buildFormatters:QE,normalizeDestFileDescriptor:eR}});var Ic=G((XB,Tg)=>{"use strict";var{lsCacheSym:tR,levelValSym:Bd,useOnlyCustomLevelsSym:rR,streamSym:iR,formattersSym:nR,hooksSym:sR}=fa(),{noop:oR,genLog:Ts}=Oc(),Gr={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},Ag={fatal:t=>{let e=Ts(Gr.fatal,t);return function(...r){let i=this[iR];if(e.call(this,...r),typeof i.flushSync=="function")try{i.flushSync()}catch{}}},error:t=>Ts(Gr.error,t),warn:t=>Ts(Gr.warn,t),info:t=>Ts(Gr.info,t),debug:t=>Ts(Gr.debug,t),trace:t=>Ts(Gr.trace,t)},Dd=Object.keys(Gr).reduce((t,e)=>(t[Gr[e]]=e,t),{}),aR=Object.keys(Dd).reduce((t,e)=>(t[e]='{"level":'+Number(e),t),{});function lR(t){let e=t[nR].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[tR]=i,t}function uR(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 cR(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[Bd],n=this[Bd]=r[t],o=this[rR],a=this[sR].logMethod;for(let c in r){if(n>r[c]){this[c]=oR;continue}this[c]=uR(c,o)?Ag[c](a):Ts(r[c],a)}this.emit("level-change",t,n,e[i],i)}function fR(t){let{levels:e,levelVal:r}=this;return e&&e.labels?e.labels[r]:""}function hR(t){let{values:e}=this.levels,r=e[t];return r!==void 0&&r>=this[Bd]}function dR(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:Dd,r),n=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),e?null:Gr,t);return{labels:i,values:n}}function mR(t,e,r){if(typeof t=="number"){if(![].concat(Object.keys(e||{}).map(o=>e[o]),r?[]:Object.keys(Dd).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:Gr,e);if(!(t in i))throw Error(`default level:${t} must be included in custom levels`)}function pR(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")}}Tg.exports={initialLsCache:aR,genLsCache:lR,levelMethods:Ag,getLevel:fR,setLevel:cR,isLevelEnabled:hR,mappings:dR,levels:Gr,assertNoLevelCollisions:pR,assertDefaultLevelFound:mR}});var zd=G((QB,Pg)=>{"use strict";Pg.exports={version:"8.3.0"}});var $g=G((tD,jg)=>{"use strict";var{EventEmitter:gR}=require("events"),{lsCacheSym:yR,levelValSym:bR,setLevelSym:$d,getLevelSym:Og,chindingsSym:Fd,parsedChindingsSym:vR,mixinSym:wR,asJsonSym:Ng,writeSym:_R,mixinMergeStrategySym:SR,timeSym:xR,timeSliceIndexSym:MR,streamSym:Bg,serializersSym:Ps,formattersSym:jd,useOnlyCustomLevelsSym:ER,needsMetadataGsym:RR,redactFmtSym:CR,stringifySym:AR,formatOptsSym:TR,stringifiersSym:PR}=fa(),{getLevel:OR,setLevel:IR,isLevelEnabled:LR,mappings:kR,initialLsCache:NR,genLsCache:BR,assertNoLevelCollisions:DR}=Ic(),{asChindings:Dg,asJson:zR,buildFormatters:Ig,stringify:Lg}=Oc(),{version:jR}=zd(),$R=Pd(),FR=class{},zg={constructor:FR,child:qR,bindings:HR,setBindings:WR,flush:KR,isLevelEnabled:LR,version:jR,get level(){return this[Og]()},set level(t){this[$d](t)},get levelVal(){return this[bR]},set levelVal(t){throw Error("levelVal is read-only")},[yR]:NR,[_R]:GR,[Ng]:zR,[Og]:OR,[$d]:IR};Object.setPrototypeOf(zg,gR.prototype);jg.exports=function(){return Object.create(zg)};var kg=t=>t;function qR(t,e){if(!t)throw Error("missing bindings for child Pino");e=e||{};let r=this[Ps],i=this[jd],n=Object.create(this);if(e.hasOwnProperty("serializers")===!0){n[Ps]=Object.create(null);for(let m in r)n[Ps][m]=r[m];let d=Object.getOwnPropertySymbols(r);for(var o=0;o<d.length;o++){let m=d[o];n[Ps][m]=r[m]}for(let m in e.serializers)n[Ps][m]=e.serializers[m];let p=Object.getOwnPropertySymbols(e.serializers);for(var a=0;a<p.length;a++){let m=p[a];n[Ps][m]=e.serializers[m]}}else n[Ps]=r;if(e.hasOwnProperty("formatters")){let{level:d,bindings:p,log:m}=e.formatters;n[jd]=Ig(d||i.level,p||kg,m||i.log)}else n[jd]=Ig(i.level,kg,i.log);if(e.hasOwnProperty("customLevels")===!0&&(DR(this.levels,e.customLevels),n.levels=kR(e.customLevels,n[ER]),BR(n)),typeof e.redact=="object"&&e.redact!==null||Array.isArray(e.redact)){n.redact=e.redact;let d=$R(n.redact,Lg),p={stringify:d[CR]};n[AR]=Lg,n[PR]=d,n[TR]=p}n[Fd]=Dg(n,t);let c=e.level||this.level;return n[$d](c),n}function HR(){let e=`{${this[Fd].substr(1)}}`,r=JSON.parse(e);return delete r.pid,delete r.hostname,r}function WR(t){let e=Dg(this,t);this[Fd]=e,delete this[vR]}function UR(t,e){return Object.assign(e,t)}function GR(t,e,r){let i=this[xR](),n=this[wR],o=this[SR]||UR,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[Ng](a,e,r,i),d=this[Bg];d[RR]===!0&&(d.lastLevel=r,d.lastObj=a,d.lastMsg=e,d.lastTime=i.slice(this[MR]),d.lastLogger=this),d.write(c)}function VR(){}function KR(){let t=this[Bg];"flush"in t&&t.flush(VR)}});var Wg=G((rD,Hg)=>{"use strict";var qd=Symbol.for("pino.metadata"),{levels:Fg}=Ic(),qg=Object.create(Fg);qg.silent=1/0;var JR=Fg.info;function ZR(t,e){let r=0;t=t||[],e=e||{dedupe:!1};let i=qg;e.levels&&typeof e.levels=="object"&&(i=e.levels);let n={write:o,add:c,flushSync:a,end:d,minLevel:0,streams:[],clone:p,[qd]:!0};return Array.isArray(t)?t.forEach(c,n):c.call(n,t),t=null,n;function o(m){let v,E=this.lastLevel,{streams:w}=this,b;for(let M=0;M<w.length&&(v=w[M],v.level<=E);M++){if(b=v.stream,b[qd]){let{lastTime:T,lastMsg:C,lastObj:P,lastLogger:L}=this;b.lastLevel=E,b.lastTime=T,b.lastMsg=C,b.lastObj=P,b.lastLogger=L}(!e.dedupe||v.level===E)&&b.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 v=typeof m.write=="function"||m.stream,E=m.write?m:m.stream;if(!v)throw Error("stream object needs to implement either StreamEntry or DestinationStream interface");let{streams:w}=this,b;typeof m.levelVal=="number"?b=m.levelVal:typeof m.level=="string"?b=i[m.level]:typeof m.level=="number"?b=m.level:b=JR;let M={stream:E,level:b,levelVal:void 0,id:r++};return w.unshift(M),w.sort(YR),this.minLevel=w[0].level,n}function d(){for(let{stream:m}of this.streams)typeof m.flushSync=="function"&&m.flushSync(),m.end()}function p(m){let v=new Array(this.streams.length);for(let E=0;E<v.length;E++)v[E]={level:m,stream:this.streams[E].stream};return{write:o,add:c,minLevel:m,streams:v,clone:p,flushSync:a,[qd]:!0}}}function YR(t,e){return t.level-e.level}Hg.exports=ZR});var iy=G((iD,Pr)=>{"use strict";var XR=require("os"),Xg=l1(),QR=Cd(),eC=Pd(),Qg=mg(),tC=$g(),ey=fa(),{configure:rC}=t0(),{assertDefaultLevelFound:iC,mappings:ty,genLsCache:nC,levels:sC}=Ic(),{createArgsNormalizer:oC,asChindings:aC,buildSafeSonicBoom:Ug,buildFormatters:lC,stringify:Lc,normalizeDestFileDescriptor:Gg,noop:uC}=Oc(),{version:cC}=zd(),{chindingsSym:Vg,redactFmtSym:fC,serializersSym:Kg,timeSym:hC,timeSliceIndexSym:dC,streamSym:mC,stringifySym:Jg,stringifySafeSym:Hd,stringifiersSym:Zg,setLevelSym:pC,endSym:gC,formatOptsSym:yC,messageKeySym:bC,nestedKeySym:vC,mixinSym:wC,useOnlyCustomLevelsSym:_C,formattersSym:Yg,hooksSym:SC,nestedKeyStrSym:xC,mixinMergeStrategySym:MC}=ey,{epochTime:ry,nullTime:EC}=Qg,{pid:RC}=process,CC=XR.hostname(),AC=Xg.err,TC={level:"info",levels:sC,messageKey:"msg",nestedKey:null,enabled:!0,base:{pid:RC,hostname:CC},serializers:Object.assign(Object.create(null),{err:AC}),formatters:Object.assign(Object.create(null),{bindings(t){return t},level(t,e){return{level:e}}}),hooks:{logMethod:void 0},timestamp:ry,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100},PC=oC(TC),OC=Object.assign(Object.create(null),Xg);function Wd(...t){let e={},{opts:r,stream:i}=PC(e,QR(),...t),{redact:n,crlf:o,serializers:a,timestamp:c,messageKey:d,nestedKey:p,base:m,name:v,level:E,customLevels:w,mixin:b,mixinMergeStrategy:M,useOnlyCustomLevels:T,formatters:C,hooks:P,depthLimit:L,edgeLimit:N}=r,z=rC({maximumDepth:L,maximumBreadth:N}),U=lC(C.level,C.bindings,C.log),Z=n?eC(n,Lc):{},ie=Lc.bind({[Hd]:z}),ge=n?{stringify:Z[fC]}:{stringify:ie},De="}"+(o?`\r
111
+ `:`
112
+ `),Me=aC.bind(null,{[Vg]:"",[Kg]:a,[Zg]:Z,[Jg]:Lc,[Hd]:z,[Yg]:U}),ke="";m!==null&&(v===void 0?ke=Me(m):ke=Me(Object.assign({},m,{name:v})));let tt=c instanceof Function?c:c?ry:EC,pt=tt().indexOf(":")+1;if(T&&!w)throw Error("customLevels is required if useOnlyCustomLevels is set true");if(b&&typeof b!="function")throw Error(`Unknown mixin type "${typeof b}" - expected "function"`);iC(E,w,T);let dr=ty(w,T);return Object.assign(e,{levels:dr,[_C]:T,[mC]:i,[hC]:tt,[dC]:pt,[Jg]:Lc,[Hd]:z,[Zg]:Z,[gC]:De,[yC]:ge,[bC]:d,[vC]:p,[xC]:p?`,${JSON.stringify(p)}:{`:"",[Kg]:a,[wC]:b,[MC]:M,[Vg]:ke,[Yg]:U,[SC]:P,silent:uC}),Object.setPrototypeOf(e,tC()),nC(e),e[pC](E),e}Pr.exports=Wd;Pr.exports.destination=(t=process.stdout.fd)=>typeof t=="object"?(t.dest=Gg(t.dest||process.stdout.fd),Ug(t)):Ug({dest:Gg(t),minLength:0});Pr.exports.transport=Ld();Pr.exports.multistream=Wg();Pr.exports.levels=ty();Pr.exports.stdSerializers=OC;Pr.exports.stdTimeFunctions=Object.assign({},Qg);Pr.exports.symbols=ey;Pr.exports.version=cC;Pr.exports.default=Wd;Pr.exports.pino=Wd});var V1=G((RD,cy)=>{cy.exports={ROOT:0,GROUP:1,POSITION:2,SET:3,RANGE:4,REPETITION:5,REFERENCE:6,CHAR:7}});var Vd=G(In=>{var We=V1(),Gd=()=>[{type:We.RANGE,from:48,to:57}],fy=()=>[{type:We.CHAR,value:95},{type:We.RANGE,from:97,to:122},{type:We.RANGE,from:65,to:90}].concat(Gd()),hy=()=>[{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}],LC=()=>[{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:fy(),not:!1});In.notWords=()=>({type:We.SET,set:fy(),not:!0});In.ints=()=>({type:We.SET,set:Gd(),not:!1});In.notInts=()=>({type:We.SET,set:Gd(),not:!0});In.whitespace=()=>({type:We.SET,set:hy(),not:!1});In.notWhitespace=()=>({type:We.SET,set:hy(),not:!0});In.anyChar=()=>({type:We.SET,set:LC(),not:!0})});var my=G(K1=>{var dy=V1(),ga=Vd(),kC="@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?",NC={0:0,t:9,n:10,v:11,f:12,r:13};K1.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?kC.indexOf(d):NC[p],v=String.fromCharCode(m);return/[[\]{}^$.|?*+()]/.test(v)&&(v="\\"+v),v}),t};K1.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(ga.words());else if(n[2])r.push(ga.ints());else if(n[3])r.push(ga.whitespace());else if(n[4])r.push(ga.notWords());else if(n[5])r.push(ga.notInts());else if(n[6])r.push(ga.notWhitespace());else if(n[7])r.push({type:dy.RANGE,from:(n[8]||n[9]).charCodeAt(0),to:n[10].charCodeAt(0)});else if(o=n[12])r.push({type:dy.CHAR,value:o.charCodeAt(0)});else return[r,i.lastIndex];K1.error(e,"Unterminated character class")};K1.error=(t,e)=>{throw new SyntaxError("Invalid regular expression: /"+t+"/: "+e)}});var py=G(J1=>{var Nc=V1();J1.wordBoundary=()=>({type:Nc.POSITION,value:"b"});J1.nonWordBoundary=()=>({type:Nc.POSITION,value:"B"});J1.begin=()=>({type:Nc.POSITION,value:"^"});J1.end=()=>({type:Nc.POSITION,value:"$"})});var gy=G((PD,Kd)=>{var ya=my(),Or=V1(),Is=Vd(),Bc=py();Kd.exports=t=>{var e=0,r,i,n={type:Or.ROOT,stack:[]},o=n,a=n.stack,c=[],d=C=>{ya.error(t,`Nothing to repeat at column ${C-1}`)},p=ya.strToChars(t);for(r=p.length;e<r;)switch(i=p[e++],i){case"\\":switch(i=p[e++],i){case"b":a.push(Bc.wordBoundary());break;case"B":a.push(Bc.nonWordBoundary());break;case"w":a.push(Is.words());break;case"W":a.push(Is.notWords());break;case"d":a.push(Is.ints());break;case"D":a.push(Is.notInts());break;case"s":a.push(Is.whitespace());break;case"S":a.push(Is.notWhitespace());break;default:/\d/.test(i)?a.push({type:Or.REFERENCE,value:parseInt(i,10)}):a.push({type:Or.CHAR,value:i.charCodeAt(0)})}break;case"^":a.push(Bc.begin());break;case"$":a.push(Bc.end());break;case"[":var m;p[e]==="^"?(m=!0,e++):m=!1;var v=ya.tokenizeClass(p.slice(e),t);e+=v[1],a.push({type:Or.SET,set:v[0],not:m});break;case".":a.push(Is.anyChar());break;case"(":var E={type:Or.GROUP,stack:[],remember:!0};i=p[e],i==="?"&&(i=p[e+1],e+=2,i==="="?E.followedBy=!0:i==="!"?E.notFollowedBy=!0:i!==":"&&ya.error(t,`Invalid group, character '${i}' after '?' at column ${e-1}`),E.remember=!1),a.push(E),c.push(o),o=E,a=E.stack;break;case")":c.length===0&&ya.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 w=[];o.options.push(w),a=w;break;case"{":var b=/^(\d+)(,(\d+)?)?\}/.exec(p.slice(e)),M,T;b!==null?(a.length===0&&d(e),M=parseInt(b[1],10),T=b[2]?b[3]?parseInt(b[3],10):1/0:M,e+=b[0].length,a.push({type:Or.REPETITION,min:M,max:T,value:a.pop()})):a.push({type:Or.CHAR,value:123});break;case"?":a.length===0&&d(e),a.push({type:Or.REPETITION,min:0,max:1,value:a.pop()});break;case"+":a.length===0&&d(e),a.push({type:Or.REPETITION,min:1,max:1/0,value:a.pop()});break;case"*":a.length===0&&d(e),a.push({type:Or.REPETITION,min:0,max:1/0,value:a.pop()});break;default:a.push({type:Or.CHAR,value:i.charCodeAt(0)})}return c.length!==0&&ya.error(t,"Unterminated group"),n};Kd.exports.types=Or});var vy=G((OD,by)=>{"use strict";var yy=gy(),BC=yy.types;by.exports=function(t,e){e||(e={});var r=e.limit===void 0?25:e.limit;DC(t)?t=t.source:typeof t!="string"&&(t=String(t));try{t=yy(t)}catch{return!1}var i=0;return function n(o,a){var c,d,p;if(o.type===BC.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 DC(t){return{}.toString.call(t)==="[object RegExp]"}});var _y=G((ID,wy)=>{"use strict";wy.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 Py=G((LD,Ty)=>{"use strict";var ba=" ",va="\u2502 ",Sy="\u251C\u2500\u2500 ",xy="\u2514\u2500\u2500 ",My="*",Z1="/",Ey=/(?=\/)/;function zC(t){let e=t.name||"";return e=e.replace("bound","").trim(),e=(e||"anonymous")+"()",e}function Ry(t){return Array.isArray(t)?t.map(e=>Ry(e)):typeof t=="symbol"?t.toString():typeof t=="function"?zC(t):t}function Jd(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]=Ry(i[n]))}),r}function jC(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?Jd.call(this,a,e.includeMeta):null});continue}let d={method:a.method,opts:a.opts.constraints||void 0,meta:e.includeMeta?Jd.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===Z1).length){let o={path:Z1,truncatedPath:"",methods:[],opts:[],handlers:[{}]};r.filter(a=>a.path===My).length?r.splice(1,0,o):r.unshift(o)}let n=$C(r);return n.forEach((o,a)=>{i+=Cy(o,null,a===n.length-1,!1,!0),i+=`
113
+ `}),i}function $C(t,e){e=e||Z1;let r=[],i={result:r};return t.forEach((n,o)=>{let a=n.path.split(Ey);a[0]!==Z1&&a[0]!==My&&(a=[Z1,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 Cy(t,e,r,i,n){let o="";if(!i&&!n&&(o+=`
114
+ `),i||(o+=`${e||""}${r?xy:Sy}`),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?ba:va}${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+=`
115
+ ${i?"":e||""}${r?ba:va}`,o+=`\u2022 (${p}) ${JSON.stringify(c.meta[p])}`}),a.length>1&&d!==a.length-1&&(o+=`
116
+ `)})}else t.children.length>1&&(o+=" (-)");return i||(e=`${e||""}${r?ba:va}`),t.children.forEach((a,c)=>{let d=c===t.children.length-1,p=!t.handlers&&t.children.length===1;o+=Cy(a,e,d,p)}),o}function Ay(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 v="",E=t.prefix.split("").map((w,b)=>w===":"?b:null).filter(w=>w!==null);if(E.length){let w=0;E.forEach((b,M)=>{v+=t.prefix.slice(w,b+1),v+=d.params[d.params.length-E.length+M],M===E.length-1&&(v+=t.prefix.slice(b+1)),w=b+1})}else v=t.prefix;if(p===0?n+=`${v} ${m}`:n+=`
117
+ ${e}${r?ba:va}${v} ${m}`,i.includeMeta){let w=Jd.call(this,d,i.includeMeta);Object.keys(w).forEach((b,M)=>{n+=`
118
+ ${e||""}${r?ba:va}`,n+=`\u2022 (${b}) ${JSON.stringify(w[b])}`})}}):n=t.prefix;let a=`${e}${r?xy:Sy}${n}
119
+ `;e=`${e}${r?ba:va}`;let c=Object.keys(t.children);for(let d=0;d<c.length;d++){let p=t.children[c[d]];a+=Ay.call(this,p,e,d===c.length-1,i)}return a}function Dc(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:{}}),Dc(t.children[":"],e.parametricChildren[0],r)),e.wildcardChild&&(t.children["*"]||(t.children["*"]={prefix:"*",nodes:[],children:{}}),Dc(t.children["*"],e.wildcardChild,r)),e.staticChildren)for(let i of Object.values(e.staticChildren)){let n=i.prefix.split(Ey),o=t,a;for(let c of n)a=o,o=o.children[c],o||(o={prefix:c,nodes:[],children:{}},a.children[c]=o);Dc(o,i,r)}}function Zd(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 Zd(r),t.nodes=r.nodes,t.prefix+=r.prefix,t.children=r.children,t}for(let r of Object.keys(t.children))Zd(t.children[r]);return t}Ty.exports={flattenNode:Dc,compressFlattenedNode:Zd,prettyPrintFlattenedNode:Ay,prettyPrintRoutesArray:jC}});var Iy=G((kD,Oy)=>{"use strict";var Yd=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
120
  let candidates = ${(1<<this.handlers.length)-1}
119
121
  let mask, matches
120
122
  `);for(let i of this.constraints){r.push(`
@@ -129,16 +131,18 @@ ${e||""}${r?ha:fa}`,n+=`\u2022 (${w}) ${JSON.stringify(x[w])}`})}}):n=t.prefix;l
129
131
  }
130
132
  if (candidates === 0) return null;
131
133
  `)}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
- `))}};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+`
134
+ `))}};Oy.exports=Yd});var ky=G((ND,Ly)=>{"use strict";var FC=Iy(),qc={STATIC:0,PARAMETRIC:1,WILDCARD:2},zc=class{constructor(){this.handlerStorage=new FC}},jc=class extends zc{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 wa(e),this.staticChildren[i]}},wa=class extends jc{constructor(e){super(),this.prefix=e,this.wildcardChild=null,this.parametricChildren=[],this.kind=qc.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 $c(e),e?this.parametricChildren.unshift(i):this.parametricChildren.push(i),i)}createWildcardChild(){return this.wildcardChild?this.wildcardChild:(this.wildcardChild=new Fc,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 wa(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(" && ")}`)}},$c=class extends jc{constructor(e){super(),this.regex=e||null,this.isRegex=!!e,this.kind=qc.PARAMETRIC}getNextNode(e,r){return this.findStaticMatchingChild(e,r)}},Fc=class extends zc{constructor(){super(),this.kind=qc.WILDCARD}getNextNode(){return null}};Ly.exports={StaticNode:wa,ParametricNode:$c,WildcardNode:Fc,NODE_TYPES:qc}});var By=G((BD,Ny)=>{"use strict";var qC=require("assert");function Y1(){if(!(this instanceof Y1))return new Y1;this.store={},this.maxMajor=0,this.maxMinors={},this.maxPatches={}}Y1.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};Y1.prototype.get=function(t){return this.store[t]};Ny.exports={name:"version",mustMatchWhenDerived:!0,storage:Y1,validate(t){qC(typeof t=="string","Version should be a string")}}});var zy=G((DD,Dy)=>{"use strict";var HC=require("assert");function WC(){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}}}Dy.exports={name:"host",mustMatchWhenDerived:!1,storage:WC,validate(t){HC(typeof t=="string"||Object.prototype.toString.call(t)==="[object RegExp]","Host should be a string or a RegExp")}}});var $y=G((zD,jy)=>{"use strict";var UC=By(),GC=zy(),Xd=require("assert"),Qd=class{constructor(e){if(this.strategies={version:UC,host:GC},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(Xd(typeof e.name=="string"&&e.name!=="","strategy.name is required."),Xd(e.storage&&typeof e.storage=="function","strategy.storage function is required."),Xd(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(`
135
+ `)).bind(this)}};jy.exports=Qd});var Hy=G((jD,qy)=>{"use strict";function Fy(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 VC(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);Fy(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 KC(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=Fy(o,a);r+=t.slice(i,n)+c,i=n+3}return t.slice(0,e)+r+t.slice(i)}qy.exports={safeDecodeURI:VC,safeDecodeURIComponent:KC}});var Jy=G(($D,Ky)=>{"use strict";var dt=require("assert"),Hc=require("http"),JC=require("querystring"),r2=vy(),Gy=_y(),{flattenNode:ZC,compressFlattenedNode:YC,prettyPrintFlattenedNode:XC,prettyPrintRoutesArray:QC}=Py(),{StaticNode:Wy,NODE_TYPES:e2}=ky(),eA=$y(),{safeDecodeURI:tA,safeDecodeURIComponent:Uy}=Hy(),i2=Hc.METHODS,Vy=/^https?:\/\/.*?\//,Ls=/(\/:[^/()]*?)\?(\/?)/;if(!r2(Vy))throw new Error("the FULL_PATH_REGEXP is not safe, update this module");if(!r2(Ls))throw new Error("the OPTIONAL_PARAM_REGEXP is not safe, update this module");function mt(t){if(!(this instanceof mt))return new mt(t);t=t||{},t.defaultRoute?(dt(typeof t.defaultRoute=="function","The default route must be a function"),this.defaultRoute=t.defaultRoute):this.defaultRoute=null,t.onBadUrl?(dt(typeof t.onBadUrl=="function","The bad url handler must be a function"),this.onBadUrl=t.onBadUrl):this.onBadUrl=null,t.buildPrettyMeta?(dt(typeof t.buildPrettyMeta=="function","buildPrettyMeta must be a function"),this.buildPrettyMeta=t.buildPrettyMeta):this.buildPrettyMeta=sA,t.querystringParser?(dt(typeof t.querystringParser=="function","querystringParser must be a function"),this.querystringParser=t.querystringParser):this.querystringParser=e=>e===""?{}:JC.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 eA(t.constraints),this._routesPatterns=[]}mt.prototype.on=function(e,r,i,n,o){typeof i=="function"&&(n!==void 0&&(o=n),n=i,i={}),dt(typeof r=="string","Path should be a string"),dt(r.length>0,"The path could not be empty"),dt(r[0]==="/"||r[0]==="*","The first character of a path should be `/` or `*`"),dt(typeof n=="function","Handler should be a function");let a=r.match(Ls);if(a){dt(r.length===a.index+a[0].length,"Optional Parameter needs to be the last parameter of the path");let p=r.replace(Ls,"$1$2"),m=r.replace(Ls,"$2");this.on(e,p,i,n,o),this.on(e,m,i,n,o);return}let c=r;this.ignoreDuplicateSlashes&&(r=n2(r)),this.ignoreTrailingSlash&&(r=s2(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})};mt.prototype._on=function(e,r,i,n,o){dt(typeof e=="string","Method should be a string"),dt(i2.includes(e),`Method '${e}' is not an http method.`);let a={};if(i.constraints!==void 0&&(dt(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 Wy("/")),r==="*"&&this.trees[e].prefix.length!==0){let m=this.trees[e];this.trees[e]=new Wy(""),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 v=r.charCodeAt(m)===58&&r.charCodeAt(m+1)!==58,E=r.charCodeAt(m)===42;if(v||E||m===r.length&&m!==d){let w=r.slice(d,m);this.caseSensitive||(w=w.toLowerCase()),w=w.split("::").join(":"),w=w.split("%").join("%25"),c=c.createStaticChild(w)}if(v){let w=!1,b=[],M=0,T=m+1;for(let P=T;;P++){let L=r.charCodeAt(P);if(L===40||L===45||L===46){w=!0;let N=r.slice(T,P);if(p.push(N),L===40){let Z=nA(r,P),ie=r.slice(P,Z+1);this.allowUnsafeRegex||dt(r2(new RegExp(ie)),`The regex '${ie}' is not safe!`),b.push(iA(ie)),P=Z+1}else b.push("(.*?)");let z=P;for(;z<r.length;z++){let Z=r.charCodeAt(z);if(Z===58||Z===47)break}let U=r.slice(P,z);U&&b.push(rA(U)),T=z+1,P=z,(r.charCodeAt(P)===47||P===r.length)&&(M=U.length)}else if(L===47||P===r.length){let N=r.slice(T,P);p.push(N),b.length!==0&&b.push("(.*?)")}if(r.charCodeAt(P)===47||P===r.length){r=r.slice(0,m+1)+r.slice(P-M),m+=M;break}}let C=null;w&&(C=new RegExp("^"+b.join("")+"$")),c=c.createParametricChild(C),d=m+1}else E&&(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&&Gy(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)};mt.prototype.hasConstraintStrategy=function(t){return this.constrainer.hasConstraintStrategy(t)};mt.prototype.addConstraintStrategy=function(t){this.constrainer.addConstraintStrategy(t),this._rebuild(this.routes)};mt.prototype.reset=function(){this.trees={},this.routes=[],this._routesPatterns=[]};mt.prototype.off=function(e,r,i){dt(typeof r=="string","Path should be a string"),dt(r.length>0,"The path could not be empty"),dt(r[0]==="/"||r[0]==="*","The first character of a path should be `/` or `*`");let n=r.match(Ls);if(n){dt(r.length===n.index+n[0].length,"Optional Parameter needs to be the last parameter of the path");let a=r.replace(Ls,"$1$2"),c=r.replace(Ls,"$2");this.off(e,a,i),this.off(e,c,i);return}this.ignoreDuplicateSlashes&&(r=n2(r)),this.ignoreTrailingSlash&&(r=s2(r));let o=Array.isArray(e)?e:[e];for(let a of o)this._off(a,r,i)};mt.prototype._off=function(e,r,i){dt(typeof e=="string","Method should be a string"),dt(i2.includes(e),`Method '${e}' is not an http method.`);function n(a){return!i||!a?!0:Gy(i,a)}let o=this.routes.filter(a=>e!==a.method||r!==a.path||!n(a.opts.constraints));this._rebuild(o)};mt.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)};mt.prototype.find=function(e,r,i){let n=this.trees[e];if(n===void 0)return null;r.charCodeAt(0)!==47&&(r=r.replace(Vy,"/")),this.ignoreDuplicateSlashes&&(r=n2(r));let o,a,c;try{o=tA(r),r=o.path,a=o.querystring,c=o.shouldDecodeParam}catch{return this._onBadUrl(r)}this.ignoreTrailingSlash&&(r=s2(r));let d=r;this.caseSensitive===!1&&(r=r.toLowerCase());let p=this.maxParamLength,m=n.prefix.length,v=[],E=r.length,w=[];for(;;){if(m===E){let M=n.handlerStorage.getMatchingHandler(i);if(M!==null)return{handler:M.handler,store:M.store,params:M._createParamsObject(v),searchParams:this.querystringParser(a)}}let b=n.getNextNode(r,m,w,v.length);if(b===null){if(w.length===0)return null;let M=w.pop();m=M.brotherPathIndex,v.splice(M.paramsCount),b=M.brotherNode}if(n=b,n.kind===e2.STATIC){m+=n.prefix.length;continue}if(n.kind===e2.WILDCARD){let M=d.slice(m);c&&(M=Uy(M)),v.push(M),m=E;continue}if(n.kind===e2.PARAMETRIC){let M=d.indexOf("/",m);M===-1&&(M=E);let T=d.slice(m,M);if(c&&(T=Uy(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;v.push(L)}}else{if(T.length>p)return null;v.push(T)}m=M}}};mt.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})}};mt.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()};mt.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}};mt.prototype.prettyPrint=function(t={}){if(t.commonPrefix=t.commonPrefix===void 0?!0:t.commonPrefix,!t.commonPrefix)return QC.call(this,this.routes,t);let e={prefix:"/",nodes:[],children:{}};for(let r in this.trees){let i=this.trees[r];i&&ZC(e,i,r)}return YC(e),XC.call(this,e,"",!0,t)};for(t2 in Hc.METHODS){if(!Hc.METHODS.hasOwnProperty(t2))continue;let t=Hc.METHODS[t2],e=t.toLowerCase();if(mt.prototype[e])throw new Error("Method already exists: "+e);mt.prototype[e]=function(r,i,n){return this.on(t,r,i,n)}}var t2;mt.prototype.all=function(t,e,r){this.on(i2,t,e,r)};Ky.exports=mt;function rA(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function n2(t){return t.replace(/\/\/+/g,"/")}function s2(t){return t.length>1&&t.charCodeAt(t.length-1)===47?t.slice(0,-1):t}function iA(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 nA(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 sA(t){return t?t.store?Object.assign({},t.store):{}:{}}});var p2=G(m2=>{m2.read=function(t,e,r,i,n){var o,a,c=n*8-i-1,d=(1<<c)-1,p=d>>1,m=-7,v=r?n-1:0,E=r?-1:1,w=t[e+v];for(v+=E,o=w&(1<<-m)-1,w>>=-m,m+=c;m>0;o=o*256+t[e+v],v+=E,m-=8);for(a=o&(1<<-m)-1,o>>=-m,m+=i;m>0;a=a*256+t[e+v],v+=E,m-=8);if(o===0)o=1-p;else{if(o===d)return a?NaN:(w?-1:1)*(1/0);a=a+Math.pow(2,i),o=o-p}return(w?-1:1)*a*Math.pow(2,o-i)};m2.write=function(t,e,r,i,n,o){var a,c,d,p=o*8-n-1,m=(1<<p)-1,v=m>>1,E=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=i?0:o-1,b=i?1:-1,M=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+v>=1?e+=E/d:e+=E*Math.pow(2,1-v),e*d>=2&&(a++,d/=2),a+v>=m?(c=0,a=m):a+v>=1?(c=(e*d-1)*Math.pow(2,n),a=a+v):(c=e*Math.pow(2,v-1)*Math.pow(2,n),a=0));n>=8;t[r+w]=c&255,w+=b,c/=256,n-=8);for(a=a<<n|c,p+=n;p>0;t[r+w]=a&255,w+=b,a/=256,p-=8);t[r+w-b]|=M*128}});var M4=G(($F,x4)=>{"use strict";x4.exports=RA;var EA={threshold:.1,includeAA:!1,alpha:.1,aaColor:[255,255,0],diffColor:[255,0,0],diffColorAlt:null,diffMask:!1};function RA(t,e,r,i,n,o){if(!M2(t)||!M2(e)||r&&!M2(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({},EA,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 E=0;E<a;E++)if(c[E]!==d[E]){p=!1;break}if(p){if(r&&!o.diffMask)for(let E=0;E<a;E++)_4(t,4*E,o.alpha,r);return 0}let m=35215*o.threshold*o.threshold,v=0;for(let E=0;E<n;E++)for(let w=0;w<i;w++){let b=(E*i+w)*4,M=S4(t,e,b,b);Math.abs(M)>m?!o.includeAA&&(b4(t,w,E,i,n,e)||b4(e,w,E,i,n,t))?r&&!o.diffMask&&R2(r,b,...o.aaColor):(r&&R2(r,b,...M<0&&o.diffColorAlt||o.diffColor),v++):r&&(o.diffMask||_4(t,b,o.alpha,r))}return v}function M2(t){return ArrayBuffer.isView(t)&&t.constructor.BYTES_PER_ELEMENT===1}function b4(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,v=e===a||e===d||r===c||r===p?1:0,E=0,w=0,b,M,T,C;for(let P=a;P<=d;P++)for(let L=c;L<=p;L++){if(P===e&&L===r)continue;let N=S4(t,t,m,(L*i+P)*4,!0);if(N===0){if(v++,v>2)return!1}else N<E?(E=N,b=P,M=L):N>w&&(w=N,T=P,C=L)}return E===0||w===0?!1:Xc(t,b,M,i,n)&&Xc(o,b,M,i,n)||Xc(t,T,C,i,n)&&Xc(o,T,C,i,n)}function Xc(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 v=o;v<=c;v++)for(let E=a;E<=d;E++){if(v===e&&E===r)continue;let w=(E*i+v)*4;if(t[p]===t[w]&&t[p+1]===t[w+1]&&t[p+2]===t[w+2]&&t[p+3]===t[w+3]&&m++,m>2)return!0}return!1}function S4(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],v=e[i+2],E=e[i+3];if(d===E&&o===p&&a===m&&c===v)return 0;d<255&&(d/=255,o=Bs(o,d),a=Bs(a,d),c=Bs(c,d)),E<255&&(E/=255,p=Bs(p,E),m=Bs(m,E),v=Bs(v,E));let w=E2(o,a,c),b=E2(p,m,v),M=w-b;if(n)return M;let T=v4(o,a,c)-v4(p,m,v),C=w4(o,a,c)-w4(p,m,v),P=.5053*M*M+.299*T*T+.1957*C*C;return w>b?-P:P}function E2(t,e,r){return t*.29889531+e*.58662247+r*.11448223}function v4(t,e,r){return t*.59597799-e*.2741761-r*.32180189}function w4(t,e,r){return t*.21147017-e*.52261711+r*.31114694}function Bs(t,e){return 255+(t-255)*e}function R2(t,e,r,i,n){t[e+0]=r,t[e+1]=i,t[e+2]=n,t[e+3]=255}function _4(t,e,r,i){let n=t[e+0],o=t[e+1],a=t[e+2],c=Bs(E2(n,o,a),r*t[e+3]/255);R2(i,e,c,c,c)}});var $A={};z2($A,{handler:()=>Fe});module.exports=z8($A);var a1={Aws:{Region:"ap-southeast-2"},ApiKey:{QueryString:"api",TableName:"ApiKey",RequestLimitMinute:1e3},TileMetadata:{TableName:"TileMetadata",RequestLimitMinute:1e3}},Xe={PublicUrlBase:"BASEMAPS_PUBLIC_URL",TiffConcurrency:"TIFF_CONCURRENCY",TempFolder:"TEMP_FOLDER",BatchIndex:"AWS_BATCH_JOB_ARRAY_INDEX",AwsRoleDurationHours:"AWS_ROLE_DURATION_HOURS",AwsRoleConfigPath:"AWS_ROLE_CONFIG_PATH",GitHubToken:"GITHUB_API_TOKEN",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=Xe.get(t);if(r===""||r==null)return e;let i=parseFloat(r);return isNaN(i)?e:i},isProduction(){return!0}};var D0=me(Bm(),1);var $r=me(qm(),1);function ew(t){return t<=10?$r.default.gray("TRACE"):t<=20?$r.default.magenta("DEBUG"):t<=30?$r.default.cyan("INFO"):t<=40?$r.default.yellow("WARN"):t<=50?$r.default.red("ERROR"):$r.default.bgRed("FATAL")}var Ri=class{constructor(e){this.level=e}static formatObject(e){let r=[];for(let i of Object.keys(e)){if(Ri.Ignore.has(i))continue;let n=e[i];if(n==null||n==="")continue;let o="",a=typeof n;if(a==="number")o=$r.default.yellow(String(n));else if(a==="string")o=$r.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(`${$r.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=Ri.formatObject(e).join(" ");return`[${r.toISOString()}] ${ew(e.level)} ${$r.default.blue(e.msg)} ${n}`}};Ri.Ignore=new Set(["pid","time","hostname","level","v","name","msg"]);var Zp=me(Jp(),1),Po=require("stream"),Yp=require("string_decoder");function aS(t){try{return JSON.parse(t)}catch{return null}}function lS(t){t!=null&&console.error("PrettyTransformFailed",t)}var yn=class extends Po.Transform{constructor(){super(),this.pretty=new Ri(-1),this.decoder=new Yp.StringDecoder}static stream(e=process.stdout){let r=new Po.PassThrough;return yn.pretty(r,e),r}static pretty(e,r=process.stdout){let i=new yn;return(0,Po.pipeline)(e,(0,Zp.default)(),i,r,lS),i}_transform(e,r,i){if(r!=="buffer")return i(new Error(`Unknown encoding: ${r}`));let n=this.decoder.write(e),o=aS(n);if(o==null)return i(null,e+`
134
136
  `);let a=this.pretty.pretty(o);if(a==null)return i(null,e+`
135
137
  `);i(null,a+`
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,"&quot;"],[38,"&amp;"],[39,"&apos;"],[60,"&lt;"],[62,"&gt;"]]),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,"&quot;"],[38,"&amp;"],[160,"&nbsp;"]])),jm=T0(/[&<>\u00A0]/g,new Map([[38,"&amp;"],[60,"&lt;"],[62,"&gt;"],[160,"&nbsp;"]]));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`
138
+ `)}};var ku,Xp={level:"debug"},Oo={get(){return ku==null&&(ku=process.stdout.isTTY?(0,D0.default)(Xp,yn.stream()):(0,D0.default)(Xp)),ku},set(t){ku=t},disable(){Oo.get().level="silent"}};var z0=me(Io(),1);var e9=24*60*60*1e3,XT=30*e9,uS=91*e9;function t9(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,z0.decodeTime)(e);if(t.startsWith("d"))return{valid:!0,key:t};if(Date.now()-r>uS)return{valid:!1,message:"expired"}}catch{return{valid:!1,message:"malformed"}}return{valid:!0,key:t}}var r9=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 i9=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 j0,cS=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]]),n9=(j0=String.fromCodePoint)!==null&&j0!==void 0?j0: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 s9(t){var e;return t>=55296&&t<=57343||t>1114111?65533:(e=cS.get(t))!==null&&e!==void 0?e:t}function $0(t){return n9(s9(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 o9(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 v=a+1,E=10,w=r.charCodeAt(v);(w|or.To_LOWER_BIT)===or.LOWER_X&&(E=16,a+=1,v+=1);do w=r.charCodeAt(++a);while(w>=or.ZERO&&w<=or.NINE||E===16&&(w|or.To_LOWER_BIT)>=or.LOWER_A&&(w|or.To_LOWER_BIT)<=or.LOWER_F);if(v!==a){let b=r.substring(v,a),M=parseInt(b,E);if(r.charCodeAt(a)===or.SEMI)a+=1;else if(i)continue;n+=$0(M),o=a}continue}let c=0,d=1,p=0,m=t[p];for(;a<r.length&&(p=fS(t,m,p+1,r.charCodeAt(a)),!(p<0));a++,d++){m=t[p];let v=m&hs.VALUE_LENGTH;if(v){(!i||r.charCodeAt(a)===or.SEMI)&&(c=p,d=0);let E=(v>>14)-1;if(E===0)break;p+=E}}if(c!==0){let v=(t[c]&hs.VALUE_LENGTH)>>14;n+=v===1?String.fromCharCode(t[c]&~hs.VALUE_LENGTH):v===2?String.fromCharCode(t[c+1]):String.fromCharCode(t[c+1],t[c+2]),o=a-d+1}}return n+r.slice(o)}}function fS(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 oP=o9(r9),aP=o9(i9);var hS=new Map([[34,"&quot;"],[38,"&amp;"],[39,"&apos;"],[60,"&lt;"],[62,"&gt;"]]),dS=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 F0(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 w1=F0(/[&<>'"]/g,hS),a9=F0(/["&\u00A0]/g,new Map([[34,"&quot;"],[38,"&amp;"],[160,"&nbsp;"]])),l9=F0(/[&<>\u00A0]/g,new Map([[38,"&amp;"],[60,"&lt;"],[62,"&gt;"],[160,"&nbsp;"]]));var u9;(function(t){t[t.XML=0]="XML",t[t.HTML=1]="HTML"})(u9||(u9={}));var c9;(function(t){t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict"})(c9||(c9={}));var f9;(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"})(f9||(f9={}));var Bu=t=>" ".repeat(t),_1=class{toString(e=0){return Bu(e)+"[VNode]"}},ds=class extends _1{constructor(e){super(),this.text=e}toString(e=0){return Bu(e)+this.textContent}get textContent(){return w1(this.text)}set textContent(e){this.text=e}},Lo=class extends _1{constructor(e,r,i){super(),this.tag=e,this.attrs=r,this.children=i}get textContent(){return this.children.length===0?"":this.children.length===1?this.children[0].textContent:this.children.map(e=>e.textContent).join("")}set textContent(e){this.children=[new ds(e)]}toString(e=0){let r=this.toStringAttrs(),i=Bu(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 Lo&&(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}="${w1(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 ds)return r.textContent}return`
137
139
  ${this.children.map(r=>r.toString(e+1)).join(`
138
140
  `)}
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
141
+ ${Bu(e)}`}};function gS(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 ds(String(r)));continue}e.push(r)}return e}else if(typeof t=="string"||typeof t=="number")return[new ds(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 Lo(t,i?e:{},gS(r))}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 d9=2**32,yS=typeof setImmediate>"u"?setTimeout:setImmediate,Dt=()=>{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=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,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 v=m;v<p;v++)a.push(v+1),c.push(v+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 v of n){let E=v*this.chunkSize-m,w=p.slice(E,E+this.chunkSize);i[v]=w,this.chunks.set(v,new DataView(w))}}}async loadBytes(e,r){if(e<0)throw new Error("Offset must be positive");let i=Math.floor(e/this.chunkSize),n=Math.ceil((e+r)/this.chunkSize)-1;for(let o=i;o<=n;o++)this.chunks.has(o)||this.toFetch.add(o);if(this.toFetch.size!==0){if(this.toFetchPromise==null&&(this.toFetchPromise=new Promise(o=>yS(o,this.delayMs)).then(()=>this.fetchData())),this.toFetch.size>this.maxConcurrentRequests)throw new Error("Too many outstanding requests");await this.toFetchPromise}}getChunkId(e){return Math.floor(e/this.chunkSize)}getUint(e,r){switch(r){case 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 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,v=p*this.chunkSize,E=this.getView(p),w=Math.min(o,v+this.chunkSize),b=E.buffer.slice(m-v,w-v);n.set(new Uint8Array(b),d),d+=b.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*d9:i*d9+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.")}};Ct.DefaultChunkCache=()=>new Map;Ct.DefaultDelayMs=1;var ut=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 Ai(t){return typeof t=="object"&&t!==null}function Yt(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 vS=/\/$/,wS=/^\//;function U0(t,e){return t.replace(vS,"")+"/"+e.replace(wS,"")}function m9(t,...e){let r=t;for(let i=0;i<e.length;i++)r=U0(r,e[i]);return r}async function p9(t){let e=[];for await(let r of t)e.push(r);return e}var G0;(function(t){t.aerial="aerial"})(G0||(G0={}));var je;(function(t){t.Imagery="im",t.TileSet="ts",t.Provider="pv",t.ImageryRule="ir",t.Style="st",t.ConfigBundle="cb"})(je||(je={}));var g9=new Set(Object.values(je));var ms=class{},ps=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)}},_r={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 g9.has(r)?r:null},unprefix(t,e){return e.startsWith(t)?e.slice(3):e}};async function gs(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 it;(function(t){t.Raster="raster",t.Vector="vector"})(it||(it={}));var y9=me(require("aws-sdk/clients/dynamodb.js"),1);var ko=me(require("aws-sdk/clients/dynamodb.js"),1);function _S(t){return{id:{S:t}}}var bn=class extends ps{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 ko.default.Converter.unmarshall(ko.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=ko.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(_S(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=ko.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:ko.default.Converter.marshall(e)}).promise(),e.id}};var No=class extends bn{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 S1=class extends ms{constructor(e){super(),this.Prefix=je,this.type="dynamo",this.Imagery=new No(this,je.Imagery),this.Style=new No(this,je.Style),this.TileSet=new bn(this,je.TileSet),this.Provider=new No(this,je.Provider),this.ConfigBundle=new bn(this,je.ConfigBundle),this.dynamo=new y9.default({region:"ap-southeast-2"}),this.tableName=e}record(){let e=Date.now();return{id:"",name:"",updatedAt:e}}};var Se=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 Se.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 Se(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 Se(r,i,n-r,o-i)}union(e){return Se.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 Se(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 Se(this.x-.5*(i-this.width),this.y-.5*(n-this.height),i,n)}pad(e,r=e){return new Se(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 Se(r,i,Math.round(this.right+e)-r,Math.round(this.bottom+e)-i)}add(e){return new Se(this.x+e.x,this.y+e.y,this.width,this.height)}subtract(e){return new Se(this.x-e.x,this.y-e.y,this.width,this.height)}static fromMultiPolygon(e){if(e.length===0)return new Se(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 Se(r,i,n-r,o-i)}static fromBbox([e,r,i,n]){return new Se(Math.min(e,i),Math.min(r,n),Math.abs(i-e),Math.abs(n-r))}static fromUpperLeftLowerRight(e,r){return new Se(e.x,e.y,r.x-e.x,r.y-e.y)}static fromJson(e){return new Se(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 Ue;(function(t){t[t.Google=3857]="Google",t[t.Wgs84=4326]="Wgs84",t[t.Nztm2000=2193]="Nztm2000",t[t.Citm2000=3793]="Citm2000"})(Ue||(Ue={}));var V0={google:Ue.Google,epsg3857:Ue.Google,[Ue.Google]:Ue.Google,globalmercator:Ue.Google,wgs84:Ue.Wgs84,epsg4326:Ue.Wgs84,[Ue.Wgs84]:Ue.Wgs84,nztm:Ue.Nztm2000,epsg2193:Ue.Nztm2000,[Ue.Nztm2000]:Ue.Nztm2000,nztm2000:Ue.Nztm2000,citm:Ue.Citm2000,epsg3793:Ue.Citm2000,[Ue.Citm2000]:Ue.Citm2000,citm2000:Ue.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:")?V0[e.slice(e.lastIndexOf(":")+1)]:e.startsWith("https://")?V0[e.slice(e.lastIndexOf("/")+1)]:(r=V0[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(Ue.Google);Re.Wgs84=new Re(Ue.Wgs84);Re.Nztm2000=new Re(Ue.Nztm2000);Re.Citm2000=new Re(Ue.Citm2000);var iO="0".charCodeAt(0),nO="1".charCodeAt(0),sO="2".charCodeAt(0),oO="3".charCodeAt(0);var Bo;(function(t){t[t.Xy=0]="Xy",t[t.Yx=1]="Yx"})(Bo||(Bo={}));function b9(t){return t===Re.Nztm2000?Bo.Yx:Bo.Xy}function SS(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(SS),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=Re.parse(e.supportedCRS);if(n==null)throw new Error(`Unable to find supported projection ${e.supportedCRS}`);this.projection=n,b9(this.projection)===Bo.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 Se(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 Se(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),v=Math.ceil((e.x+1)*c),E=Math.ceil((e.y+1)*d);for(let w=m;w<E;++w)for(let b=p;b<v;++b)yield{x:b,y:w,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 x1={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 xS={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}]},Ie=new At(xS);var ju=me(_9(),1),$u=new At(ju.Nztm2000),vn=new At(ju.Nztm2000Quad);var ar={All:[Ie,$u,vn],Defaults:new Map([[Re.Google.code,Ie],[Re.Nztm2000.code,$u]]),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,e=!0){if(t==null)return null;let r=Re.parse(t);if(r!=null)return ar.tryGet(r);if(e){for(let i of ar.All)if(i.identifier===t)return i;return null}for(let i of ar.All)if(i.identifier.toLowerCase()===t.toLowerCase())return i;return null}};var Le;(function(t){t.Png="png",t.Jpeg="jpeg",t.Webp="webp",t.Avif="avif"})(Le||(Le={}));var lr;(function(t){t.MapboxVectorTiles="pbf"})(lr||(lr={}));var qu=me(Io(),1);function CS(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 AS(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 TS=[CS,AS];function ai(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 TS){let a=o(i);if(a!=null){n=!0,r.push(a);break}}n||r.push(i)}return r.join("-")}var R9=require("crypto");var M9=me(x9(),1),E9="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",zo=(0,M9.default)(E9),OS=new Set(E9);function Fu(t){for(let e=0;e<t.length;e++)if(!OS.has(t.charAt(e)))return!1;return!0}function wn(t){return zo.encode((0,R9.createHash)("sha256").update(t).digest())}function IS(t){return _r.getPrefix(t.id)===je.Imagery}function LS(t){return _r.getPrefix(t.id)===je.TileSet}function kS(t){return!(typeof t!="object"||t==null||Array.isArray(t))}function C9(t){if(!!kS(t))for(let e of Object.keys(t))t[e]===void 0&&delete t[e]}var Ti=class extends ms{constructor(){super(...arguments),this.type="memory",this.Imagery=new ys(this,je.Imagery),this.Style=new ys(this,je.Style),this.TileSet=new ys(this,je.TileSet),this.Provider=new ys(this,je.Provider),this.ConfigBundle=new ys(this,je.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 je.Imagery:e.imagery.push(r);break;case je.Style:e.style.push(r);break;case je.Provider:e.provider.push(r);break;case je.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=_r.prefix(je.ConfigBundle,(0,qu.ulid)()),e}createVirtualTileSets(){for(let e of this.objects.values())if(LS(e)&&e.name==="aerial")for(let r of e.layers)this.imageryToChildTileSet(e,r,Ue.Nztm2000),this.imageryToChildTileSet(e,r,Ue.Google);else IS(e)&&(this.put(Ti.imageryToTileSet(e)),this.imageryToTileSetName(e))}imageryToTileSetName(e){let r=ai(e.name),i=_r.prefix(je.TileSet,r),n=this.objects.get(i);n==null&&(n={type:it.Raster,id:i,title:e.title,category:e.category,name:r,format:Le.Webp,layers:[{name:r,minZoom:0,maxZoom:32}],background:{r:0,g:0,b:0,alpha:0},updatedAt:Date.now()},C9(n),this.put(n)),n.layers[0][e.projection]=e.id}static imageryToTileSet(e){return{type:it.Raster,id:_r.prefix(je.TileSet,_r.unprefix(je.Imagery,e.id)),name:e.name,format:Le.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=_r.prefix(je.TileSet,d),m=this.objects.get(p);m==null&&(m={type:it.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:ai(c.name),format:Le.Webp,layers:[{name:d,minZoom:0,maxZoom:32}],background:{r:0,g:0,b:0,alpha:0},updatedAt:Date.now()},C9(m),this.put(m)),m.layers[0][c.projection]=c.id}static fromJson(e){if(e.id==null||_r.getPrefix(e.id)!==je.ConfigBundle)throw new Error("Provided configuration file is not a basemaps config bundle.");let r=(0,qu.decodeTime)(_r.unprefix(je.ConfigBundle,e.id)),i=new Ti;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}},ys=class extends ps{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 M1(t){if(t==="")return 0;let e=parseInt(t,16);if(isNaN(e))throw new Error("Invalid hex byte: "+t);return e}function Hu(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:M1(t.substr(0,2)),g:M1(t.substr(2,2)),b:M1(t.substr(4,2)),alpha:M1(t.substr(6,2))}}var Pi=me(require("fs"),1),Uu=me(require("path"),1);var K0=require("fs"),Wu=require("path"),_n=class extends Ct{constructor(e){super(),this.type="file",this.protocol="file",this.chunkSize=_n.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,Wu.resolve)(this.fileName)}get name(){return(0,Wu.basename)(this.fileName)}get size(){return this._size?this._size:(this._size=Promise.resolve().then(async()=>(await K0.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=K0.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)}};_n.DefaultChunkSize=16*1024;function E1(t,e){return Ai(t)?t.code==="ENOENT"?new ut(e,404,t):t.code==="EACCES"?new ut(e,403,t):new ut(e,500,t):new ut(e,500,t)}var Oi=class{constructor(){this.protocol=Oi.protocol}static is(e){return e.protocol===Oi.protocol}source(e){return new _n(e)}async*list(e,r){try{let i=await Pi.default.promises.readdir(e,{withFileTypes:!0}),n=Uu.default.resolve(e);for(let o of i){let a=Uu.default.join(n,o.name);o.isDirectory()&&r?.recursive!==!1?yield*this.list(a):yield a}}catch(i){throw E1(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 Pi.default.promises.stat(e);return{path:e,size:r.size,isDirectory:r.isDirectory()}}catch(r){if(Ai(r)&&r.code==="ENOENT")return null;throw E1(r,`Failed to stat: ${e}`)}}async read(e){try{return await Pi.default.promises.readFile(e)}catch(r){throw E1(r,`Failed to read: ${e}`)}}async write(e,r){let i=Uu.default.dirname(e);await Pi.default.promises.mkdir(i,{recursive:!0});try{if(Buffer.isBuffer(r)||typeof r=="string")await Pi.default.promises.writeFile(e,r);else{let n=Pi.default.createWriteStream(e);await new Promise((o,a)=>{n.on("finish",o),n.on("error",a),r.pipe(n)})}}catch(n){throw E1(n,`Failed to write: ${e}`)}}async delete(e){try{return await Pi.default.promises.unlink(e)}catch(r){throw E1(r,`Failed to read: ${e}`)}}stream(e){return Pi.default.createReadStream(e)}};Oi.protocol="file";var l6=me(require("http"),1),u6=me(require("https"),1),xs=me(require("zlib"),1),cr=me(require("stream"),1),N1=require("buffer");function NS(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 A9=NS;var xr=me(require("stream"),1),Ni=require("util"),ur=require("buffer");C1();Ku();var ki=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 Xt=class extends ki{constructor(e,r,i){super(e,r),i&&(this.code=this.errno=i.code,this.erroredSysCall=i.syscall)}};var Ju=Symbol.toStringTag,X0=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[Ju]==="URLSearchParams",O1=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[Ju]),j9=t=>typeof t=="object"&&(t[Ju]==="AbortSignal"||t[Ju]==="EventTarget"),$9=(t,e)=>{let r=new URL(e).hostname,i=new URL(t).hostname;return r===i||r.endsWith(`.${i}`)};var ZS=(0,Ni.promisify)(xr.default.pipeline),Qt=Symbol("Body internals"),ui=class{constructor(e,{size:r=0}={}){let i=null;e===null?e=null:X0(e)?e=ur.Buffer.from(e.toString()):O1(e)||ur.Buffer.isBuffer(e)||(Ni.types.isAnyArrayBuffer(e)?e=ur.Buffer.from(e):ArrayBuffer.isView(e)?e=ur.Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof xr.default||(e instanceof vs?(e=z9(e),i=e.type.split("=")[1]):e=ur.Buffer.from(String(e))));let n=e;ur.Buffer.isBuffer(e)?n=xr.default.Readable.from(e):O1(e)&&(n=xr.default.Readable.from(e.stream())),this[Qt]={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 ki?o:new Xt(`Invalid response body while trying to fetch ${this.url}: ${o.message}`,"system",o);this[Qt].error=a})}get body(){return this[Qt].stream}get bodyUsed(){return this[Qt].disturbed}async arrayBuffer(){let{buffer:e,byteOffset:r,byteLength:i}=await Xu(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 vs,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(()=>(V9(),G9));return r(this.body,e)}async blob(){let e=this.headers&&this.headers.get("content-type")||this[Qt].body&&this[Qt].body.type||"",r=await this.arrayBuffer();return new Li([r],{type:e})}async json(){let e=await Xu(this);return JSON.parse(e.toString())}async text(){return(await Xu(this)).toString()}buffer(){return Xu(this)}};ui.prototype.buffer=(0,Ni.deprecate)(ui.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(ui.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:(0,Ni.deprecate)(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});async function Xu(t){if(t[Qt].disturbed)throw new TypeError(`body used already for: ${t.url}`);if(t[Qt].disturbed=!0,t[Qt].error)throw t[Qt].error;let{body:e}=t;if(e===null)return ur.Buffer.alloc(0);if(!(e instanceof xr.default))return ur.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 Xt(`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 ki?n:new Xt(`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")?ur.Buffer.from(r.join("")):ur.Buffer.concat(r,i)}catch(n){throw new Xt(`Could not create Buffer from response body for ${t.url}: ${n.message}`,"system",n)}else throw new Xt(`Premature close of server response while trying to fetch ${t.url}`)}var qo=(t,e)=>{let r,i,{body:n}=t[Qt];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[Qt].stream=r,n=i),n},YS=(0,Ni.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"),Qu=(t,e)=>t===null?null:typeof t=="string"?"text/plain;charset=UTF-8":X0(t)?"application/x-www-form-urlencoded;charset=UTF-8":O1(t)?t.type||null:ur.Buffer.isBuffer(t)||Ni.types.isAnyArrayBuffer(t)||ArrayBuffer.isView(t)?null:t instanceof vs?`multipart/form-data; boundary=${e[Qt].boundary}`:t&&typeof t.getBoundary=="function"?`multipart/form-data;boundary=${YS(t)}`:t instanceof xr.default?null:"text/plain;charset=UTF-8",K9=t=>{let{body:e}=t[Qt];return e===null?0:O1(e)?e.size:ur.Buffer.isBuffer(e)?e.length:e&&typeof e.getLengthSync=="function"&&e.hasKnownLength&&e.hasKnownLength()?e.getLengthSync():null},J9=async(t,{body:e})=>{e===null?t.end():await ZS(e,t)};var rd=require("util"),k1=me(require("http"),1),ec=typeof k1.default.validateHeaderName=="function"?k1.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}},id=typeof k1.default.validateHeaderValue=="function"?k1.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}},er=class extends URLSearchParams{constructor(e){let r=[];if(e instanceof er){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"&&!rd.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"||rd.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])=>(ec(i),id(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)=>(ec(a),id(a,String(c)),URLSearchParams.prototype[n].call(i,String(a).toLowerCase(),String(c)));case"delete":case"has":case"getAll":return a=>(ec(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(er.prototype,["get","entries","forEach","values"].reduce((t,e)=>(t[e]={enumerable:!0},t),{}));function Z9(t=[]){return new er(t.reduce((e,r,i,n)=>(i%2===0&&e.push(n.slice(i,i+2)),e),[]).filter(([e,r])=>{try{return ec(e),id(e,String(r)),!0}catch{return!1}}))}var XS=new Set([301,302,303,307,308]),tc=t=>XS.has(t);var Fr=Symbol("Response internals"),Tt=class extends ui{constructor(e=null,r={}){super(e,r);let i=r.status!=null?r.status:200,n=new er(r.headers);if(e!==null&&!n.has("Content-Type")){let o=Qu(e,this);o&&n.append("Content-Type",o)}this[Fr]={type:"default",url:r.url,status:i,statusText:r.statusText||"",headers:n,counter:r.counter,highWaterMark:r.highWaterMark}}get type(){return this[Fr].type}get url(){return this[Fr].url||""}get status(){return this[Fr].status}get ok(){return this[Fr].status>=200&&this[Fr].status<300}get redirected(){return this[Fr].counter>0}get statusText(){return this[Fr].statusText}get headers(){return this[Fr].headers}get highWaterMark(){return this[Fr].highWaterMark}clone(){return new Tt(qo(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(!tc(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[Fr].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 s6=require("url"),o6=require("util");var Y9=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 Q9=require("net");function X9(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 e6=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]),t6="strict-origin-when-cross-origin";function r6(t){if(!e6.has(t))throw new TypeError(`Invalid referrerPolicy: ${t}`);return t}function QS(t){if(/^(http|ws)s:$/.test(t.protocol))return!0;let e=t.host.replace(/(^\[)|(]$)/g,""),r=(0,Q9.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 Ho(t){return/^about:(blank|srcdoc)$/.test(t)||t.protocol==="data:"||/^(blob|filesystem):$/.test(t.protocol)?!0:QS(t)}function i6(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=X9(n),a=X9(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 Ho(o)&&!Ho(c)?"no-referrer":a.toString();case"strict-origin-when-cross-origin":return o.origin===c.origin?o:Ho(o)&&!Ho(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 Ho(o)&&!Ho(c)?"no-referrer":o;default:throw new TypeError(`Invalid referrerPolicy: ${i}`)}}function n6(t){let e=(t.get("referrer-policy")||"").split(/[,\s]+/),r="";for(let i of e)i&&e6.has(i)&&(r=i);return r}var yt=Symbol("Request internals"),rc=t=>typeof t=="object"&&typeof t[yt]=="object",ex=(0,o6.deprecate)(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)"),Bi=class extends ui{constructor(e,r={}){let i;if(rc(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&&ex(),(r.body!=null||rc(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:rc(e)&&e.body!==null?qo(e):null;super(o,{size:r.size||e.size||0});let a=new er(r.headers||e.headers||{});if(o!==null&&!a.has("Content-Type")){let p=Qu(o,this);p&&a.set("Content-Type",p)}let c=rc(e)?e.signal:null;if("signal"in r&&(c=r.signal),c!=null&&!j9(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[yt]={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[yt].method}get url(){return(0,s6.format)(this[yt].parsedURL)}get headers(){return this[yt].headers}get redirect(){return this[yt].redirect}get signal(){return this[yt].signal}get referrer(){if(this[yt].referrer==="no-referrer")return"";if(this[yt].referrer==="client")return"about:client";if(this[yt].referrer)return this[yt].referrer.toString()}get referrerPolicy(){return this[yt].referrerPolicy}set referrerPolicy(e){this[yt].referrerPolicy=r6(e)}clone(){return new Bi(this)}get[Symbol.toStringTag](){return"Request"}};Object.defineProperties(Bi.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 a6=t=>{let{parsedURL:e}=t[yt],r=new er(t[yt].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=K9(t);typeof c=="number"&&!Number.isNaN(c)&&(i=String(c))}i&&r.set("Content-Length",i),t.referrerPolicy===""&&(t.referrerPolicy=t6),t.referrer&&t.referrer!=="no-referrer"?t[yt].referrer=i6(t):t[yt].referrer="no-referrer",t[yt].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=Y9(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 ic=class extends ki{constructor(e,r="aborted"){super(e,r)}};Ku();ed();var tx=new Set(["data:","http:","https:"]);async function nc(t,e){return new Promise((r,i)=>{let n=new Bi(t,e),{parsedURL:o,options:a}=a6(n);if(!tx.has(o.protocol))throw new TypeError(`node-fetch cannot load ${t}. URL scheme "${o.protocol.replace(/:$/,"")}" is not supported.`);if(o.protocol==="data:"){let b=A9(n.url),M=new Tt(b,{headers:{"Content-Type":b.typeFull}});r(M);return}let c=(o.protocol==="https:"?u6.default:l6.default).request,{signal:d}=n,p=null,m=()=>{let b=new ic("The operation was aborted.");i(b),n.body&&n.body instanceof cr.default.Readable&&n.body.destroy(b),!(!p||!p.body)&&p.body.emit("error",b)};if(d&&d.aborted){m();return}let v=()=>{m(),w()},E=c(o.toString(),a);d&&d.addEventListener("abort",v);let w=()=>{E.abort(),d&&d.removeEventListener("abort",v)};E.on("error",b=>{i(new Xt(`request to ${n.url} failed, reason: ${b.message}`,"system",b)),w()}),rx(E,b=>{p.body.destroy(b)}),process.version<"v14"&&E.on("socket",b=>{let M;b.prependListener("end",()=>{M=b._eventsCount}),b.prependListener("close",T=>{if(p&&M<b._eventsCount&&!T){let C=new Error("Premature close");C.code="ERR_STREAM_PREMATURE_CLOSE",p.body.emit("error",C)}})}),E.on("response",b=>{E.setTimeout(0);let M=Z9(b.rawHeaders);if(tc(b.statusCode)){let N=M.get("Location"),z=null;try{z=N===null?null:new URL(N,n.url)}catch{if(n.redirect!=="manual"){i(new Xt(`uri requested responds with an invalid redirect URL: ${N}`,"invalid-redirect")),w();return}}switch(n.redirect){case"error":i(new Xt(`uri requested responds with a redirect, redirect mode is set to error: ${n.url}`,"no-redirect")),w();return;case"manual":break;case"follow":{if(z===null)break;if(n.counter>=n.follow){i(new Xt(`maximum redirect reached at: ${n.url}`,"max-redirect")),w();return}let U={headers:new er(n.headers),follow:n.follow,counter:n.counter+1,agent:n.agent,compress:n.compress,method:n.method,body:qo(n),signal:n.signal,size:n.size,referrer:n.referrer,referrerPolicy:n.referrerPolicy};if(!$9(n.url,z))for(let ie of["authorization","www-authenticate","cookie","cookie2"])U.headers.delete(ie);if(b.statusCode!==303&&n.body&&e.body instanceof cr.default.Readable){i(new Xt("Cannot follow redirect with body being a readable stream","unsupported-redirect")),w();return}(b.statusCode===303||(b.statusCode===301||b.statusCode===302)&&n.method==="POST")&&(U.method="GET",U.body=void 0,U.headers.delete("content-length"));let Z=n6(M);Z&&(U.referrerPolicy=Z),r(nc(new Bi(z,U))),w();return}default:return i(new TypeError(`Redirect option '${n.redirect}' is not a valid value of RequestRedirect`))}}d&&b.once("end",()=>{d.removeEventListener("abort",v)});let T=(0,cr.pipeline)(b,new cr.PassThrough,N=>{N&&i(N)});process.version<"v12.10"&&b.on("aborted",v);let C={url:n.url,status:b.statusCode,statusText:b.statusMessage,headers:M,size:n.size,counter:n.counter,highWaterMark:n.highWaterMark},P=M.get("Content-Encoding");if(!n.compress||n.method==="HEAD"||P===null||b.statusCode===204||b.statusCode===304){p=new Tt(T,C),r(p);return}let L={flush:xs.default.Z_SYNC_FLUSH,finishFlush:xs.default.Z_SYNC_FLUSH};if(P==="gzip"||P==="x-gzip"){T=(0,cr.pipeline)(T,xs.default.createGunzip(L),N=>{N&&i(N)}),p=new Tt(T,C),r(p);return}if(P==="deflate"||P==="x-deflate"){let N=(0,cr.pipeline)(b,new cr.PassThrough,z=>{z&&i(z)});N.once("data",z=>{(z[0]&15)===8?T=(0,cr.pipeline)(T,xs.default.createInflate(),U=>{U&&i(U)}):T=(0,cr.pipeline)(T,xs.default.createInflateRaw(),U=>{U&&i(U)}),p=new Tt(T,C),r(p)}),N.once("end",()=>{p||(p=new Tt(T,C),r(p))});return}if(P==="br"){T=(0,cr.pipeline)(T,xs.default.createBrotliDecompress(),N=>{N&&i(N)}),p=new Tt(T,C),r(p);return}p=new Tt(T,C),r(p)}),J9(E,n).catch(i)})}function rx(t,e){let r=N1.Buffer.from(`0\r
140
142
  \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",
143
+ `),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=N1.Buffer.compare(d.slice(-5),r)===0,!n&&o&&(n=N1.Buffer.compare(o.slice(-3),r.slice(0,3))===0&&N1.Buffer.compare(d.slice(-2),r.slice(3))===0),o=d})})}var zt=class extends Ct{constructor(e){super(),this.type="url",this.protocol="http",this.chunkSize=zt.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 zt.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 zt.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")}};zt.DefaultChunkSize=32*1024;zt.fetch=(t,e)=>fetch(t,e);function c6(t,e){return Ai(t)?t.code==="ENOENT"?new ut(e,404,t):t.code==="EACCES"?new ut(e,403,t):new ut(e,500,t):new ut(e,500,t)}var Di=class{constructor(){this.protocol=Di.protocol}static is(e){return e.protocol===Di.protocol}source(e){return new zt(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 zt.fetch(e,{method:"HEAD"});if(!r.ok)throw c6(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 zt.fetch(e,{method:"GET"});if(!r.ok)throw c6(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}`)}async delete(e){throw new Error(`Unable to "delete" on ${e}`)}stream(e){throw new Error(`Unable to "stream" on ${e}`)}};Di.protocol="http";zt.fetch=nc;function ix(t){return typeof t!="object"||t==null?!1:t.constructor===Object}var sc=class{constructor(){this.protocol="abstract",this.isOrdered=!0,this.systems=[],this.toArray=p9,this.join=U0,this.joinAll=m9}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)||ix(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)}delete(e){return this.get(e,"rw").delete(e)}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 sc;var f6=new Oi;xt.register("",f6);xt.register("file://",f6);var h6=new Di;xt.register("http://",h6);xt.register("https://",h6);var $e=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 nd(this,e)}},nd=class extends $e{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 oc=class extends $e{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}},ac=class extends $e{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 d6=[];for(let t=0;t<64;t++)d6[t]=Math.pow(2,t);var B1=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+=d6[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 lc=class extends $e{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 B1(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}},uc=class extends $e{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 cc=class extends $e{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 sd=class extends $e{constructor(){super(...arguments),this.size=1}parse(e,r){let i=r.offset;return r.offset+=this.size,e[i]}},od=class extends $e{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}},ad=class extends $e{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}},nx=2**32,ld=class extends $e{constructor(){super(...arguments),this.size=8}parse(e,r){let i=Wo.parse(e,r),n=Wo.parse(e,r);return i+n*nx}},ud=class extends $e{constructor(){super(...arguments),this.size=8}parse(e,r){let i=BigInt(Wo.parse(e,r)),n=BigInt(Wo.parse(e,r));return i+(n<<BigInt(32))}},m6=new sd("UInt8"),p6=new od("LUInt16"),Wo=new ad("LUInt32"),g6=new ld("LUInt64"),y6=new ud("BigLUInt64");var fc=class extends $e{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}}},hc=class extends $e{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 Uo=class extends $e{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}},dc=class extends $e{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 = {};
144
+ `;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)
145
+ `;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 Go(t,e=2){return"0x"+t.toString(16).padStart(e,"0")}var mc=class extends $e{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 ${Go(i)}`);return this.type.parse(e,{offset:i,startOffset:i})}};var pc=class extends $e{constructor(e){super("Skip:"+e),this.size=e}parse(e,r){r.offset+=this.size}};var gc=class extends $e{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("")}},yc=class extends $e{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: ${Go(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 sx(t,e,r,i){return typeof r=="number"?new oc(t,e,r):new ac(t,e,r,i??!1)}var fr={u8:m6,lu16:p6,lu32:Wo,lu64:g6,blu64:y6,empty:new Uo("Empty",{}),offset(t,e){return new mc(t,e)},string(t){return t==null?new gc:new yc(t)},bits(t,e){return new lc(t,e)},flags(t,e,r){return new uc(t,e,r)},object(t,e){return new dc(t,e)},static(t,e){return new Uo(t,e)},lookup(t,e,r){return new fc(t,e,r)},enum(t,e,r){return new hc(t,e,r)},bytes(t){return new cc(t)},skip(t){return new pc(t)},array:sx};var b6;(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"})(b6||(b6={}));var ox=fr.object("TarHeader",{path:fr.string(100),skip1:fr.skip(24),size:fr.bytes(12).refine(t=>parseInt(t.toString(),8)),skip2:fr.skip(20),type:fr.u8,linkName:fr.string(100)});var v6={32:16777619n,64:1099511628211n,128:309485009821345068724781371n,256:374144419156711147060143317175368453031918731002211n,512:35835915874844867368919076489095108449946327955754392558399825615420669938882575126094039892345713852759n,1024:5016456510113118655434598811035278955030765345404790744303017523831112055108147451509157692220295382716162651878526895249385292291816524375083746691371804094271873160484737966720260389217684476157468082573n},ax={32:2166136261n,64:14695981039346656037n,128:144066263297769815596495629667062367629n,256:100029257958052580907070968620625704837092796014241193945225284501741471925557n,512:9659303129496669498009435400716310466090418745672637896108374329434462657994582932197716438449813051892206539805784495328239340083876191928701583869517785n,1024:14197795064947621068722070641403218320880622795441933960878474914617582723252296732303717722150864096521202355549365628174669108571814760471015076148029755969804077320157692458563003215304957150157403644460363550505412711285966361610267868082893823963790439336411086884584107735010676915n};function cd(t,{size:e=32}={}){if(!v6[e])throw new Error("The `size` option must be one of 32, 64, 128, 256, 512, or 1024");let r=ax[e],i=v6[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 bc="COT";var lx=BigInt(0),ux=BigInt(32),cx=BigInt(2**32-1),w6=fr.object("CotarMetadata",{magic:fr.string(bc.length),version:fr.u8,count:fr.lu32}),qr=class{constructor(e,r,i=0){this.isHeader=!0,this.source=e,this.sourceOffset=i,this.metadata=r}static hash(e){return cd(e,{size:64})}static async loadMetadata(e,r,i){if(i){await e.loadBytes(r,e.chunkSize);let o=e.bytes(r,8);return w6.read(o).value}let n=await e.fetchBytes(-8);return w6.read(new Uint8Array(n)).value}static async getMetadata(e,r,i){let n=await this.loadMetadata(e,r,i);if(n.magic!==bc)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>>ux),a=Number(r&cx),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 v=this.source.getUint32(m+8)*512,E=this.source.getUint32(m+12);return{offset:v,size:E}}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===lx||(a++,a>=i&&(a=0),a===n))return null}}};var Rk=BigInt(0);var xn=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 xn(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 cM=me(Io(),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"]),Mn=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"]),hx=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Hr=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()}};Hr.create=t=>new Hr(t);var j1=(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}},$1=j1,dx=t=>{$1=t},wc=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}},mx=[];function le(t,e){let r=wc({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,$1,j1].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"}),px=t=>({status:"dirty",value:t}),jt=t=>({status:"valid",value:t}),fd=t=>t.status==="aborted",hd=t=>t.status==="dirty",_c=t=>t.status==="valid",dd=t=>typeof Promise!==void 0&&t instanceof Promise,Ve;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Ve||(Ve={}));var Er=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)}},S6=(t,e)=>{if(_c(e))return{success:!0,data:e.value};{if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");let r=new Hr(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,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 Mn(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Mn(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:Mn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(dd(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:Mn(e)},o=this._parseSync({data:e,path:n.path,parent:n});return S6(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:Mn(e)},n=this._parse({data:e,path:[],parent:i}),o=await(dd(n)?n:Promise.resolve(n));return S6(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 Ar({schema:this,typeName:de.ZodEffects,effect:{type:"refinement",refinement:e}})}optional(){return Mr.create(this)}nullable(){return Fi.create(this)}nullish(){return this.optional().nullable()}array(){return Rr.create(this)}promise(){return Rn.create(this)}or(e){return Ms.create([this,e])}and(e){return Es.create(this,e)}transform(e){return new Ar({schema:this,typeName:de.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new F1({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}},gx=/^c[^\s-]{8,}$/i,yx=/^([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,bx=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,fi=class extends xe{constructor(){super(...arguments),this._regex=(e,r,i)=>this.refinement(n=>e.test(n),{validation:r,code:Q.invalid_string,...Ve.errToObj(i)}),this.nonempty=e=>this.min(1,Ve.errToObj(e)),this.trim=()=>new fi({...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")bx.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")yx.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")gx.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 fi({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ve.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ve.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ve.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ve.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Ve.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Ve.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Ve.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}};fi.create=t=>new fi({checks:[],typeName:de.ZodString,...Ce(t)});function vx(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 zi=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"?vx(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,Ve.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Ve.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Ve.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Ve.toString(r))}setLimit(e,r,i,n){return new zi({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:Ve.toString(n)}]})}_addCheck(e){return new zi({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ve.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ve.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ve.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ve.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ve.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Ve.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")}};zi.create=t=>new zi({checks:[],typeName:de.ZodNumber,...Ce(t)});var Ko=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 jt(e.data)}};Ko.create=t=>new Ko({typeName:de.ZodBigInt,...Ce(t)});var Jo=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 jt(e.data)}};Jo.create=t=>new Jo({typeName:de.ZodBoolean,...Ce(t)});var Zo=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())}}};Zo.create=t=>new Zo({typeName:de.ZodDate,...Ce(t)});var Yo=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 jt(e.data)}};Yo.create=t=>new Yo({typeName:de.ZodUndefined,...Ce(t)});var Xo=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 jt(e.data)}};Xo.create=t=>new Xo({typeName:de.ZodNull,...Ce(t)});var En=class extends xe{constructor(){super(...arguments),this._any=!0}_parse(e){return jt(e.data)}};En.create=t=>new En({typeName:de.ZodAny,...Ce(t)});var ci=class extends xe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return jt(e.data)}};ci.create=t=>new ci({typeName:de.ZodUnknown,...Ce(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,...Ce(t)});var Qo=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 jt(e.data)}};Qo.create=t=>new Qo({typeName:de.ZodVoid,...Ce(t)});var Rr=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 Er(r,a,r.path,c)))).then(a=>Pt.mergeArray(i,a));let o=r.data.map((a,c)=>n.type._parseSync(new Er(r,a,r.path,c)));return Pt.mergeArray(i,o)}get element(){return this._def.type}min(e,r){return new Rr({...this._def,minLength:{value:e,message:Ve.toString(r)}})}max(e,r){return new Rr({...this._def,maxLength:{value:e,message:Ve.toString(r)}})}length(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Rr.create=(t,e)=>new Rr({type:t,minLength:null,maxLength:null,typeName:de.ZodArray,...Ce(e)});var Sc;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Sc||(Sc={}));var x6=t=>e=>new Ze({...t,shape:()=>({...t.shape(),...e})});function Vo(t){if(t instanceof Ze){let e={};for(let r in t.shape){let i=t.shape[r];e[r]=Mr.create(Vo(i))}return new Ze({...t._def,shape:()=>e})}else return t instanceof Rr?Rr.create(Vo(t.element)):t instanceof Mr?Mr.create(Vo(t.unwrap())):t instanceof Fi?Fi.create(Vo(t.unwrap())):t instanceof Cr?Cr.create(t.items.map(e=>Vo(e))):t}var Ze=class extends xe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=x6(this._def),this.extend=x6(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],v=n.data[p];d.push({key:{status:"valid",value:p},value:m._parse(new Er(n,v,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 v=n.data[m];d.push({key:{status:"valid",value:m},value:p._parse(new Er(n,v,n.path,m)),alwaysSet:m in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let p=[];for(let m of d){let v=await m.key;p.push({key:v,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 Ve.errToObj,new Ze({...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=Ve.errToObj(e).message)!==null&&c!==void 0?c:d}:{message:d}}}:{}})}strip(){return new Ze({...this._def,unknownKeys:"strip"})}passthrough(){return new Ze({...this._def,unknownKeys:"passthrough"})}setKey(e,r){return this.augment({[e]:r})}merge(e){return new Ze({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>Sc.mergeShapes(this._def.shape(),e._def.shape()),typeName:de.ZodObject})}catchall(e){return new Ze({...this._def,catchall:e})}pick(e){let r={};return Qe.objectKeys(e).map(i=>{this.shape[i]&&(r[i]=this.shape[i])}),new Ze({...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 Ze({...this._def,shape:()=>r})}deepPartial(){return Vo(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 Ze({...this._def,shape:()=>r});for(let i in this.shape){let n=this.shape[i];r[i]=n.optional()}return new Ze({...this._def,shape:()=>r})}required(){let e={};for(let r in this.shape){let n=this.shape[r];for(;n instanceof Mr;)n=n._def.innerType;e[r]=n}return new Ze({...this._def,shape:()=>e})}};Ze.create=(t,e)=>new Ze({shape:()=>t,unknownKeys:"strip",catchall:hi.create(),typeName:de.ZodObject,...Ce(e)});Ze.strictCreate=(t,e)=>new Ze({shape:()=>t,unknownKeys:"strict",catchall:hi.create(),typeName:de.ZodObject,...Ce(e)});Ze.lazycreate=(t,e)=>new Ze({shape:t,unknownKeys:"strip",catchall:hi.create(),typeName:de.ZodObject,...Ce(e)});var Ms=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 Hr(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 Hr(d));return le(r,{code:Q.invalid_union,unionErrors:c}),pe}}get options(){return this._def.options}};Ms.create=(t,e)=>new Ms({options:t,typeName:de.ZodUnion,...Ce(e)});var ea=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 ea({typeName:de.ZodDiscriminatedUnion,discriminator:e,options:n,...Ce(i)})}};function md(t,e){let r=Mn(t),i=Mn(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=md(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=md(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 Es=class extends xe{_parse(e){let{status:r,ctx:i}=this._processInputParams(e),n=(o,a)=>{if(fd(o)||fd(a))return pe;let c=md(o.value,a.value);return c.valid?((hd(o)||hd(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}))}};Es.create=(t,e,r)=>new Es({left:t,right:e,typeName:de.ZodIntersection,...Ce(r)});var Cr=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 Er(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 Cr({...this._def,rest:e})}};Cr.create=(t,e)=>new Cr({items:t,typeName:de.ZodTuple,rest:null,...Ce(e)});var Rs=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 Er(i,c,i.path,c)),value:a._parse(new Er(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 Rs({keyType:e,valueType:r,typeName:de.ZodRecord,...Ce(i)}):new Rs({keyType:fi.create(),valueType:e,typeName:de.ZodRecord,...Ce(r)})}},ta=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 Er(i,c,i.path,[p,"key"])),value:o._parse(new Er(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}}}};ta.create=(t,e,r)=>new ta({valueType:e,keyType:t,typeName:de.ZodMap,...Ce(r)});var ji=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 Er(i,d,i.path,p)));return i.common.async?Promise.all(c).then(d=>a(d)):a(c)}min(e,r){return new ji({...this._def,minSize:{value:e,message:Ve.toString(r)}})}max(e,r){return new ji({...this._def,maxSize:{value:e,message:Ve.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};ji.create=(t,e)=>new ji({valueType:t,minSize:null,maxSize:null,typeName:de.ZodSet,...Ce(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 wc({data:c,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,$1,j1].filter(p=>!!p),issueData:{code:Q.invalid_arguments,argumentsError:d}})}function n(c,d){return wc({data:c,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,$1,j1].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 Rn?jt(async(...c)=>{let d=new Hr([]),p=await this._def.args.parseAsync(c,o).catch(E=>{throw d.addIssue(i(c,E)),d}),m=await a(...p);return await this._def.returns._def.type.parseAsync(m,o).catch(E=>{throw d.addIssue(n(m,E)),d})}):jt((...c)=>{let d=this._def.args.safeParse(c,o);if(!d.success)throw new Hr([i(c,d.error)]);let p=a(...d.data),m=this._def.returns.safeParse(p,o);if(!m.success)throw new Hr([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:Cr.create(e).rest(ci.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(ci.create()):Cr.create([]).rest(ci.create()),returns:e||ci.create(),typeName:de.ZodFunction,...Ce(r)});var ra=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})}};ra.create=(t,e)=>new ra({getter:t,typeName:de.ZodLazy,...Ce(e)});var ia=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}};ia.create=(t,e)=>new ia({value:t,typeName:de.ZodLiteral,...Ce(e)});function wx(t,e){return new na({values:t,typeName:de.ZodEnum,...Ce(e)})}var na=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 jt(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}};na.create=wx;var sa=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 jt(e.data)}get enum(){return this._def.values}};sa.create=(t,e)=>new sa({values:t,typeName:de.ZodNativeEnum,...Ce(e)});var Rn=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 jt(i.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Rn.create=(t,e)=>new Rn({type:t,typeName:de.ZodPromise,...Ce(e)});var Ar=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(!_c(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=>_c(a)?Promise.resolve(n.transform(a.value,o)).then(c=>({status:r.value,value:c})):a);Qe.assertNever(n)}};Ar.create=(t,e,r)=>new Ar({schema:t,typeName:de.ZodEffects,effect:e,...Ce(r)});Ar.createWithPreprocess=(t,e,r)=>new Ar({schema:e,effect:{type:"preprocess",transform:t},typeName:de.ZodEffects,...Ce(r)});var Mr=class extends xe{_parse(e){return this._getType(e)===ee.undefined?jt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Mr.create=(t,e)=>new Mr({innerType:t,typeName:de.ZodOptional,...Ce(e)});var Fi=class extends xe{_parse(e){return this._getType(e)===ee.null?jt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Fi.create=(t,e)=>new Fi({innerType:t,typeName:de.ZodNullable,...Ce(e)});var F1=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}};F1.create=(t,e)=>new Mr({innerType:t,typeName:de.ZodOptional,...Ce(e)});var oa=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}}};oa.create=t=>new oa({typeName:de.ZodNaN,...Ce(t)});var E6=(t,e={},r)=>t?En.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})}}):En.create(),_x={object:Ze.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 Sx=(t,e={message:`Input not instance of ${t.name}`})=>E6(r=>r instanceof t,e,!0),R6=fi.create,C6=zi.create,xx=oa.create,Mx=Ko.create,A6=Jo.create,Ex=Zo.create,Rx=Yo.create,Cx=Xo.create,Ax=En.create,Tx=ci.create,Px=hi.create,Ox=Qo.create,Ix=Rr.create,Lx=Ze.create,kx=Ze.strictCreate,Nx=Ms.create,Bx=ea.create,Dx=Es.create,zx=Cr.create,jx=Rs.create,$x=ta.create,Fx=ji.create,qx=$i.create,Hx=ra.create,Wx=ia.create,Ux=na.create,Gx=sa.create,Vx=Rn.create,M6=Ar.create,Kx=Mr.create,Jx=Fi.create,Zx=Ar.createWithPreprocess,Yx=()=>R6().optional(),Xx=()=>C6().optional(),Qx=()=>A6().optional(),oe=Object.freeze({__proto__:null,getParsedType:Mn,ZodParsedType:ee,makeIssue:wc,EMPTY_PATH:mx,addIssueToContext:le,ParseStatus:Pt,INVALID:pe,DIRTY:px,OK:jt,isAborted:fd,isDirty:hd,isValid:_c,isAsync:dd,ZodType:xe,ZodString:fi,ZodNumber:zi,ZodBigInt:Ko,ZodBoolean:Jo,ZodDate:Zo,ZodUndefined:Yo,ZodNull:Xo,ZodAny:En,ZodUnknown:ci,ZodNever:hi,ZodVoid:Qo,ZodArray:Rr,get objectUtil(){return Sc},ZodObject:Ze,ZodUnion:Ms,ZodDiscriminatedUnion:ea,ZodIntersection:Es,ZodTuple:Cr,ZodRecord:Rs,ZodMap:ta,ZodSet:ji,ZodFunction:$i,ZodLazy:ra,ZodLiteral:ia,ZodEnum:na,ZodNativeEnum:sa,ZodPromise:Rn,ZodEffects:Ar,ZodTransformer:Ar,ZodOptional:Mr,ZodNullable:Fi,ZodDefault:F1,ZodNaN:oa,custom:E6,Schema:xe,ZodSchema:xe,late:_x,get ZodFirstPartyTypeKind(){return de},any:Ax,array:Ix,bigint:Mx,boolean:A6,date:Ex,discriminatedUnion:Bx,effect:M6,enum:Ux,function:qx,instanceof:Sx,intersection:Dx,lazy:Hx,literal:Wx,map:$x,nan:xx,nativeEnum:Gx,never:Px,null:Cx,nullable:Jx,number:C6,object:Lx,oboolean:Qx,onumber:Xx,optional:Kx,ostring:Yx,preprocess:Zx,promise:Vx,record:jx,set:Fx,strictObject:kx,string:R6,transformer:M6,tuple:zx,undefined:Rx,union:Nx,unknown:Tx,void:Ox,ZodIssueCode:Q,quotelessJson:hx,ZodError:Hr,defaultErrorMap:j1,get overrideErrorMap(){return $1},setErrorMap:dx});var eM=oe.object({title:oe.string(),description:oe.string(),fees:oe.string(),accessConstraints:oe.string()}),tM=oe.object({deliveryPoint:oe.string(),city:oe.string(),postalCode:oe.string(),country:oe.string(),email:oe.string()}),rM=oe.object({individualName:oe.string(),position:oe.string(),phone:oe.string(),address:tM}),iM=oe.object({name:oe.string(),site:oe.string(),contact:rM}),nM=oe.object({id:oe.string(),serviceIdentification:eM,serviceProvider:iM});var sM=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 oM(t){try{return Hu(t),!0}catch{return!1}}var aM=oe.string().refine(oM,{message:"Invalid hex color"}),aa={minZoom:0,maxZoom:32},xc=oe.number().refine(t=>t>=aa.minZoom&&t<=aa.maxZoom,{message:`must be between ${aa.minZoom} and ${aa.maxZoom}`}),lM=oe.object({name:oe.string(),title:oe.string().optional(),category:oe.string().optional(),2193:oe.string().optional(),3857:oe.string().optional(),minZoom:xc.optional(),maxZoom:xc.optional()}).refine(({minZoom:t,maxZoom:e})=>(t||aa.minZoom)<=(e||aa.maxZoom),{message:"minZoom may no be greater than maxZoom",path:["minZoom"]}),uM=oe.object({type:oe.nativeEnum(it),id:oe.string(),title:oe.string().optional(),category:oe.string().optional(),description:oe.string().optional(),background:aM.optional(),layers:oe.array(lM),minZoom:xc.optional(),maxZoom:xc.optional(),format:oe.union([oe.nativeEnum(Le),oe.nativeEnum(lr)]).optional()});var fM=new S1(a1.TileMetadata.TableName);function pd(){return fM}function Cs(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 U6=me(P6(),1),G6=me(H6(),1);function W6(t){return[[[t[0],t[1]],[t[2],t[1]],[t[2],t[3]],[t[0],t[3]],[t[0],t[1]]]]}var{intersection:IM,union:V6}=G6.default;function LM(t,e){return t[0]===e[0]&&t[1]===e[1]}function kM(t,e){return IM(t,W6(e))}function Sd(t,e){let r=[];for(let i of t){let n=U6.default.polygon(i[0],e);n.length!==0&&(LM(n[0],n[n.length-1])||n.push(n[0]),r.push([n]))}return kM(r,e)}var U1=t=>(t<-360?t=-(-t%360):t>360&&(t=t%360),t<-180?360+t:t>180?t-360:t),As=(t,e)=>{let r=e-t;return r>180?r-360:r<-180?r+360:r},NM=(t,e)=>U1(t+(e<t?e+360-t:e-t)),An={boxLonCenter(t){return U1(t[0]+.5*(t[2]<t[0]?360+t[2]-t[0]:t[2]-t[0]))},delta:As,crossesAM(t,e){return Math.sign(As(t,e))!==Math.sign(e-t)},normLon:U1,normExtent(t){return[U1(t[0]),t[1],U1(t[2]),t[3]]},union(t,e){if(e==null)return t.slice();let r=An.boxLonCenter(t),i=An.boxLonCenter(e);if(As(r,i)<0)return this.union(e,t);let n=t.slice(),o=NM(r,i);return As(o,e[0])<As(o,t[0])&&(n[0]=e[0]),As(o,e[2])>As(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];An.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 E=p[1];E<n?n=E:E>a&&(a=E),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 BM=[-180,-90,180,90],DM=[180,-90,360,90];function zM(t,e,r){return[e[0]+(r[0]-e[0])*t,e[1]+(r[1]-e[1])*t]}function jM(t){let e=[];for(let r of Sd(t,BM))e.push(r);for(let r of Sd(t,DM))e.push(r.map(i=>i.map(n=>[n[0]-360,n[1]])));return e}function Cc(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,v=0;for(let E of c){let w=e(E),b=w[0];if(m!=null){let M=An.crossesAM(v,b);if(M&&(i=!0,n=!n),n&&(b<0?w[0]=b+360:m[0]=v+360),M){let T=(180-w[0])/(m[0]-w[0]),C=e(zM(T,E,p));d.push([180,C[1]])}}d.push(w),p=E,m=w,v=b}return d}));return i&&r?jM(o):o}function $M(t){return{type:"Polygon",coordinates:t}}function K6(t,e={}){return{type:"Feature",geometry:$M(t),properties:e}}function J6(t,e={}){return{type:"Feature",geometry:{type:"MultiPolygon",coordinates:t},properties:e}}var ua=me(Z6(),1);var Y6=`PROJCS["NZGD2000 / Chatham Islands TM 2000",
142
146
  GEOGCS["NZGD2000",
143
147
  DATUM["New_Zealand_Geodetic_Datum_2000",
144
148
  SPHEROID["GRS 1980",6378137,298.257222101,
@@ -160,7 +164,7 @@ PARAMETER["false_easting",3500000],
160
164
  PARAMETER["false_northing",10000000],
161
165
  AUTHORITY["EPSG","3793"],
162
166
  AXIS["Easting",EAST],
163
- AXIS["Northing",NORTH]]`;var w6=`PROJCS["NZGD2000 / New Zealand Transverse Mercator 2000",
167
+ AXIS["Northing",NORTH]]`;var X6=`PROJCS["NZGD2000 / New Zealand Transverse Mercator 2000",
164
168
  GEOGCS["NZGD2000",
165
169
  DATUM["New_Zealand_Geodetic_Datum_2000",
166
170
  SPHEROID["GRS 1980",6378137,298.257222101,
@@ -180,11 +184,9 @@ PARAMETER["false_easting",1600000],
180
184
  PARAMETER["false_northing",10000000],
181
185
  UNIT["metre",1,
182
186
  AUTHORITY["EPSG","9001"]],
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
- `;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 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});
187
+ AUTHORITY["EPSG","2193"]]`;ua.default.defs(Re.Nztm2000.toEpsgString(),X6);ua.default.defs(Re.Citm2000.toEpsgString(),Y6);var Ed=new Map;function FM(t){return t==null?null:typeof t=="number"?t:"code"in t?t.code:"projection"in t?t.projection.code:null}var Ur=class{constructor(e){this.epsg=e;try{this.projection=(0,ua.default)(e.toEpsgString(),Re.Wgs84.toEpsgString())}catch(r){throw new ut(`Failed to create projection: ${e.toEpsgString()}, ${Re.Wgs84.toEpsgString()}`,500,r)}}static define(e,r){if(Ed.get(e.code)!=null)throw new Error("Duplicate projection definition: "+e.toEpsgString());ua.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=FM(e);if(r==null)return null;let i=Ed.get(r);if(i!=null)return i;let n=Re.tryGet(r);return n==null||ua.default.defs(n.toEpsgString())==null?null:(i=new Ur(n),Ed.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=Cc([[[i,o,a,n,i]]],this.toWgs84),d=c.length===1?K6(c[0],r):J6(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 Ur.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 Q6(t){return t==null||typeof t=="string"?!1:"roleArn"in t&&typeof t.roleArn=="string"}function Tn(t){return"promise"in t?t.promise():t}function Pn(t,e){return Ai(t)?typeof t.statusCode!="number"?new ut(e,500,t):new ut(e,t.statusCode,t):new ut(e,500,t)}var tr=class extends Ct{constructor(e,r,i){super(),this.type=tr.type,this.protocol="s3",this.chunkSize=tr.DefaultChunkSize,this.maxChunkCount=tr.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===tr.type}get size(){return this._size?this._size:(this._size=Promise.resolve().then(async()=>(await Tn(this.remote.headObject({Bucket:this.bucket,Key:this.key}))).ContentLength||-1),this._size)}static fromUri(e,r){let i=Yt(e);return i==null||i.key==null||i.protocol!=="s3"?null:new tr(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 Pn(n,`Failed to fetch ${this.name} ${i}`)}}};tr.type="aws:s3";tr.DefaultChunkSize=64*1024;tr.DefaultMaxChunkCount=32;function qM(t){return typeof t.read=="function"}var Ot=class{constructor(e,r){this.protocol=Ot.protocol,this.writeTests=new Set,this.writeTestSuffix=Ot.WriteTestSuffix,this.s3=e,this.credentials=r}source(e){let r=tr.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===Ot.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=Yt(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 Tn(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>=Ot.MaxListCount)throw new Error(`Failed to finish listing within ${Ot.MaxListCount} list attempts`);n=p.NextContinuationToken}}catch(p){let m=Pn(p,`Failed to list: "${e}"`);if(this.credentials!=null&&m.code===403){let v=await this.credentials.find(e);if(v){yield*v.details(e,r);return}}throw m}}async read(e){let r=Yt(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=Pn(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 _writeTest(e){let r=Yt(e);if(r==null||r.key==null)throw new Error(`Failed to write: "${e}"`);if(this.credentials==null||this.writeTests.has(r.bucket))return;let i=`${e}${this.writeTestSuffix}`;try{await Tn(this.s3.upload({Bucket:r.bucket,Key:r.key+this.writeTestSuffix,Body:Buffer.from("test")})),this.writeTests.add(r.bucket),this.writeTestSuffix!==""&&await this.delete(i)}catch(n){let o=Pn(n,`Failed to write to "s3://${i}"`);if(o.code===403){let a=await this.credentials.find(e);if(a)return a}throw o}}async write(e,r,i){let n=Yt(e);if(n==null||n.key==null)throw new Error(`Failed to write: "${e}"`);if(this.credentials!=null&&qM(r)){let o=await this._writeTest(e);if(o)return o.write(e,r,i)}try{await Tn(this.s3.upload({Bucket:n.bucket,Key:n.key,Body:r,ContentEncoding:i?.contentEncoding,ContentType:i?.contentType}))}catch(o){let a=Pn(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}}async delete(e){let r=Yt(e);if(r==null||r.key==null)throw new Error(`Failed to write: "${e}"`);try{await Tn(this.s3.deleteObject({Bucket:r.bucket,Key:r.key}));return}catch(i){let n=Pn(i,`Failed to delete: "${e}"`);if(this.credentials!=null&&n.code===403){let o=await this.credentials.find(e);if(o)return o.delete(e)}throw n}}exists(e){return this.head(e).then(r=>r!=null)}stream(e){let r=Yt(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=Yt(e);if(r==null||r.key==null)throw new Error(`Failed to head: "${e}"`);try{return{size:(await Tn(this.s3.headObject({Bucket:r.bucket,Key:r.key}))).ContentLength,path:e}}catch(i){if(Ai(i)&&i.code==="NotFound")return null;let n=Pn(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}}};Ot.protocol="s3";Ot.MaxListCount=100;Ot.WriteTestSuffix="";var eg=me(require("aws-sdk/clients/s3.js"),1),tg=me(require("aws-sdk/lib/core.js"),1),Ft=class{static fsFromRole(e,r,i){if(typeof e=="object")return Ft.fsFromRole(e.roleArn,e.externalId,e.durationSeconds);let n=Ft.role(e,r,i);return new Ot(new eg.default({credentials:n}))}static role(e,r,i){i=i??Ft.DefaultRoleDurationSeconds;let n=`role::${e}::${r}::${i}`,o=Ft.cache.get(n);return o==null&&(o=new tg.default.ChainableTemporaryCredentials({params:{RoleArn:e,ExternalId:r,RoleSessionName:"fsa-"+Math.random().toString(32)+"-"+Date.now(),DurationSeconds:i}}),Ft.cache.set(n,o)),o}};Ft.DefaultRoleDurationSeconds=3600;Ft.cache=new Map;var ca=class{constructor(e,r){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 findCredentials(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);for(let i of r.prefixes)if(e.startsWith(i.prefix))return i;return null}async find(e){let r=await this.findCredentials(e);if(r==null)return null;let i=Ft.fsFromRole(r.roleArn,r.externalId,r.roleSessionDuration);return this.onFileSystemCreated&&this.onFileSystemCreated(r,i),i}};var ig=me(require("aws-sdk/clients/s3.js"),1),ng=require("util"),Ac=require("zlib");var HM=(0,ng.promisify)(Ac.gunzip),ht=xt;ht.readJson=async function(e){let r=await this.read(e);return e.endsWith(".gz")?JSON.parse((await HM(r)).toString()):JSON.parse(r.toString())};ht.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)};ht.configure=function(e){if(e.type!=="s3"||!Q6(e))return;let r=Yt(e.path);if(r==null)throw new Error("Failed to parse URI: "+e.path);let i=`s3://${r.bucket}/`;this.register(i,Ft.fsFromRole(e.roleArn,e.externalId))};var sg=new Ot(new ig.default);ht.register("s3://",sg);var rg=Xe.get(Xe.AwsRoleConfigPath);if(rg!=null){let t=new ca(rg,ht);t.onFileSystemCreated=(e,r)=>{Oo.get().debug({roleArn:e.roleArn,prefix:e.prefix},"FileSystem:Registered"),ht.register(e.prefix,r)},sg.credentials=t}function Rd(t){return t[0].toUpperCase()+t.slice(1).replace(/_(\d+)-(\d+)m/g," $1.$2m").replace(/_/g," ")}function og(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 Qy=me(iy(),1);var On="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 ha;(function(t){t.CloudfrontId="X-Amz-Cf-Id",t.TraceId="X-Amzn-Trace-Id"})(ha||(ha={}));var hr;(function(t){t.CorrelationId="X-LINZ-Correlation-Id",t.RequestId="X-LINZ-Request-Id"})(hr||(hr={}));var ay=require("url");var ny=require("perf_hooks"),IC=4,kc=class{constructor(){this.timers=new Map}getTime(){return ny.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(IC)),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 sy=me(Io(),1);function qt(t){return!(typeof t!="object"||t==null)}var Os=class{constructor(e,r,i){this.context=r,this.event=e,this.id=(0,sy.ulid)(),this.headers=new Map,this.logContext={},this.log=i,this.timer=new kc,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 oy=me(Io(),1);var Ht=class extends Os{constructor(e,r,i){var n;super(e,r,i),this.headers=new Map,this.abort=new AbortController,this.correlationId=(n=this.header(hr.CorrelationId))!==null&&n!==void 0?n:oy.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)!==On)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 da=class extends Ht{static is(e){return qt(e)&&qt(e.requestContext)&&qt(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 ay.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 ly=require("url");var mi=class extends Ht{static is(e){return!(!qt(e)||!qt(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:mi.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 ly.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 Ud=require("url");var ma=class extends Ht{static is(e){if(!qt(e)||!Array.isArray(e.Records))return!1;let r=e.Records[0];return qt(r)?qt(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 Ud.URLSearchParams:new Ud.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 uy=require("url");var pa=class extends Ht{toResponse(e){return{statusCode:e.status,body:e.body,headers:mi.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 uy.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!(!qt(e)||!qt(e.requestContext)||!qt(e.requestContext.http))}};var K=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 K}static ok(e=200,r="Ok"){return new K(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),On),this}buffer(e,r=On){return this.header(re.ContentType,r),this._body=e,this}get body(){return this._body==null?(this.header(re.ContentType,On),JSON.stringify({id:this.header(hr.RequestId),status:this.status,message:this.statusDescription,correlationId:this.header(hr.CorrelationId)})):Buffer.isBuffer(this._body)?this._body.toString("base64"):this._body}};var Zy=me(Jy(),1),Yy=me(require("timers/promises"),1);var Wc=class{constructor(){this.hooks={request:[],response:[]},this.timeoutEarlyMs=0,this.router=(0,Zy.default)({defaultRoute:()=>new K(404,"Not found")})}register(e,r,i){this.router.on(e,r,(n,o,a)=>n instanceof Ht?(n.params=a,Uc(n,i)):new K(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 K.is(i)?i:(e.set("err",i),new K(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(Yy.default.setTimeout(i,new K(408,"Request Timed Out"),{signal:e.abort.signal}))}return Promise.race(r).then(i=>(e.abort.abort(),o2(e,i)))}async _handle(e){e.requestCount===-1&&(e.requestCount=Wt.requestCount++);let r=e.header(ha.CloudfrontId),i=e.header(ha.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 Uc(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 K(404,"Not found"))}};var oA="v6.37.0",aA="98c97100161b159272c1826c4e668b3e805ec214",Xy={version:oA,hash:aA};async function Uc(t,e){t.timer.timers.has("lambda")||t.timer.start("lambda");try{return await e(t)}catch(r){return K.is(r)?r:(t.set("err",r),new K(500,"Internal Server Error"))}}function o2(t,e){let r=t.timer.timers.has("lambda")?t.timer.end("lambda"):0,i=200;return e instanceof K&&(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,On),i=e.status,t.set("description",e.statusDescription),e.header(hr.RequestId,t.id),t instanceof Ht&&e.header(hr.CorrelationId,t.correlationId)),t.set("status",i),t.timer.timers.size>0&&t.set("metrics",t.timer.metrics),Xy.hash&&t.set("package",Xy),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 lA(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 Wt=class{static request(e,r,i){if(da.is(e))return new da(e,r,i);if(pa.is(e))return new pa(e,r,i);if(mi.is(e))return new mi(e,r,i);if(ma.is(e))return new ma(e,r,i);throw new Error("Request is not a a ALB, ApiGateway or Cloudfront event")}static handler(e,r,i){let n=lA(r);function o(a,c,d){let p=new Os(a,c,i??Wt.Logger);p.requestCount=Wt.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}),Uc(p,e).then(v=>{if(o2(p,v),K.is(v)&&n.rejectOnError){if(p.logContext.err)return d(p.logContext.err);if(v.status>399)return d(p.toResponse(v))}return d(null,p.toResponse(v))})}return o}static http(e){let r=new Wc;async function i(n,o){let a=Wt.request(n,o,e??Wt.Logger);try{let c=await r.handle(a);return a.toResponse(c)}catch(c){a.log.fatal({err:c},"Lambda:Failed");let d=new K(500,"Internal Server Error");return a.set("err",c),d.header(hr.RequestId,a.id),d.header(hr.CorrelationId,a.correlationId),a.toResponse(d)}}return i.router=r,i}};Wt.Logger=(0,Qy.default)();Wt.ServerName="linz";Wt.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 K(404,"Not Found"),at=()=>new K(304,"Not modified"),e4=()=>new K(204,"No Content"),t4=t=>new K(200,"ok").json({id:t.id,correlationId:t.correlationId,message:"ok"});async function r4(t){let e=Xe.get(Xe.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 at();let a=new K(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 s4=require("url");var uA=.2;function cA(t){return t.source.uri.endsWith(".tar.co")}var _a=class{constructor(e){this.tms=e}async tile(e,r,i,n){let o=[];for(let a of e)if(cA(a))o.push({type:"cotar",asset:a,path:`tiles/${n}/${r}/${i}.webp`});else{let c=this.getTiles(a,r,i,n);if(c==null)continue;o=o.concat(c)}return o}getRasterTiffIntersection(e,r,i,n){let o=this.tms.tileToPixels(r,i),a=new Se(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=Se.fromUpperLeftLowerRight(d,p),v=m.intersection(a);return v==null?null:{tiff:m,intersection:v,tile:a}}createComposition(e,r,i,n,o){let a=Se.fromJson(e.getTileBounds(r,i)),c=a.scale(n,n).add(o.tiff).round(uA),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),v={type:"tiff",asset: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)&&(v.extract={width:a.width,height:a.height}),a.width!==c.width||a.height!==c.height){let E=a.width!==c.width?c.width/a.width:c.height/a.height;v.resize={width:c.width,height:c.height,scale:E}}return(p.y!==0||p.x!==0||p.height!==c.height||p.width!==c.width)&&(v.crop=p),v}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:v}=c,E=[],w=1/d;for(let b of _a.getRequiredTiles(p,d,m,v)){let M=this.createComposition(c,b.x,b.y,w,o);M!=null&&E.push(M)}return E.length===0?null:E}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 i4=[Le.Jpeg,Le.Webp,Le.Png];function a2(t){if(t==null)return null;let e=t.toLowerCase();return e===Le.Png?Le.Png:e===Le.Webp?Le.Webp:e===Le.Jpeg||e==="jpg"?Le.Jpeg:e===Le.Avif?Le.Avif:null}var lt={apiKey(t){let e=t.query.get(a1.ApiKey.QueryString)??t.header("X-LINZ-Api-Key"),r=t9(e);if(!r.valid)throw new K(400,"API Key Invalid: "+r.message);return t.set("api",e),e},getTileMatrixSet(t){return ar.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=a2(i);n!=null&&r.add(n)}return r.size===0?null:[...r.values()]},getTileFormat(t){let e=a2(t);return e||(t===lr.MapboxVectorTiles?lr.MapboxVectorTiles:null)},xyz(t){lt.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=lt.getTileMatrixSet(t.params.tileMatrix);if(n==null)throw new K(404,"Tile Matrix not found");t.set("tileMatrix",n.identifier),t.set("projection",n.projection.code);let o=lt.getTileFormat(t.params.tileType);if(o==null)throw new K(404,"Tile extension not found");if(t.set("extension",o),isNaN(i)||i>n.maxZoom||i<0)throw new K(404,`Zoom not found: ${i}`);let a=n.zooms[i];if(isNaN(e)||e<0||e>a.matrixWidth)throw new K(404,`X not found: ${e}`);if(isNaN(r)||r<0||r>a.matrixHeight)throw new K(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=Ur.tileCenterToLatLon(n,c.tile);return t.set("location",d),c}};var Sa=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 l2=class{constructor(e){this.configProvider=e.then(r=>{let i=Ti.fromJson(r);return i.createVirtualTileSets(),i}).catch(r=>{if(r.code===404)return null;throw r})}get size(){return 1}},u2=class{constructor(e){this.cache=new Sa(e)}get(e){let r=this.cache.get(e)?.configProvider;if(r!=null)return r;let i=ht.readJson(e),n=new l2(i);return this.cache.set(e,n),n.configProvider}},n4=new u2(20);var fA=new Set(["linz-workflow-artifacts","linz-basemaps","linz-basemaps-staging"]),hA=new Set(["s3","memory"]),Be=class{static async getDefaultConfig(){let e=pd();if(e.assets==null){let r=await e.ConfigBundle.get(e.ConfigBundle.id("latest"));if(r==null)throw new K(400,"Unable to get lastest config bundle for asset.");e.assets=r.assets}return e}static extract(e){let r=e.query.get("config");return r==null?null:r.includes("/")?zo.encode(Buffer.from(r)):r}static async load(e){let r=e.query.get("config");if(r==null)return this.getDefaultConfig();let i=Fu(r)?Buffer.from(zo.decode(r)).toString():r,n=Yt(i);if(n==null)throw new K(400,"Invalid config location");if(!hA.has(n.protocol))throw new K(400,`Invalid configuration location protocol:${n.protocol}`);if(!fA.has(n.bucket))throw new K(400,`Bucket: "${n.bucket}" is not a allowed bucket location`);return e.set("config",i),e.timer.start("config:load"),n4.get(i).then(o=>{if(e.timer.end("config:load"),o==null)throw new K(404,`Config not found at ${i}`);return o})}};function qi(t,e,r){if(t==null)return"";let i=Xe.get(Xe.PublicUrlBase)??"";if(!t.startsWith("/"))return t;let n=new s4.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 dA(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=qi(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]=qi(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:qi(t.glyphs,void 0,r),sprite:qi(t.sprite,void 0,r)}}async function mA(t,e,r){let i=ar.find(t.query.get("tileMatrix")??Ie.identifier);if(i==null)return new K(400,"Invalid tile matrix");let[n]=lt.getRequestedFormats(t)??[Le.Webp];if(n==null)return new K(400,"Invalid image format");let o=Be.extract(t),a=Cs({config:o,api:r}),c=xt.join(Xe.get(Xe.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)),v=Ne.key(m);if(Ne.isNotModified(t,v))return at();let E=new K(200,"ok");return E.header(re.ETag,v),E.header(re.CacheControl,"no-store"),E.buffer(m,"application/json"),t.set("bytes",m.byteLength),E}async function c2(t){let e=lt.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!==it.Raster?ce():mA(t,m,e)}let a=dA(o.style,e,Be.extract(t)),c=Buffer.from(JSON.stringify(a)),d=Ne.key(c);if(Ne.isNotModified(t,d))return at();let p=new K(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 pA(t,e){let r=Xe.get(Xe.PublicUrlBase)??"",i=`/v1/arcgis/rest/services/${t}/VectorTileServer`,n=new URL(ht.join(r,i));return n.searchParams.set("api",e),n.searchParams.set("f","json"),n.toString().replace(/%7B/g,"{").replace(/%7D/g,"}")}function gA(t,e,r){let i=JSON.parse(JSON.stringify(e.sources));for(let[o,a]of Object.entries(i))a.type==="vector"?(a.url=pA(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:qi(e.glyphs),sprite:qi(e.sprite)}}async function o4(t){let e=lt.apiKey(t),r=await Be.load(t),i=await r.TileSet.get(r.TileSet.id(t.params.tileSet));if(i?.type!==it.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=gA(i.name,c.style,e),p=Buffer.from(JSON.stringify(d)),m=Ne.key(p);if(Ne.isNotModified(t,m))return at();let v=new K(200,"ok");return v.header(re.ETag,m),v.header(re.CacheControl,"no-store"),v.buffer(p,"application/json"),t.set("bytes",p.byteLength),v}var yA=18,bA=1;async function a4(t){let e=await Be.load(t),r=await e.TileSet.get(e.TileSet.id(t.params.tileSet));if(r?.type!==it.Vector)return ce();let i=lt.apiKey(t);if(t.query.get("f")!=="json")return ce();let o={xmin:Ie.extent.x,ymin:Ie.extent.y,xmax:Ie.extent.right,ymax:Ie.extent.bottom,spatialReference:{wkid:102100,latestWkid:Ie.projection.code}},a={currentVersion:10.81,name:r.name,capabilities:"TilesOnly",type:"indexedVector",defaultStyles:"",tiles:[qi(`/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:Ie.extent.x,y:Ie.extent.bottom},spatialReference:{wkid:102100,latestWkid:Ie.projection.code},lods:Ie.zooms.slice(bA,yA).map((m,v)=>({level:v,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 K(200,"ok");return p.header(re.CacheControl,"no-store"),p.buffer(d,"application/json"),t.set("bytes",d.byteLength),p}var vA=1+1e-10,l4=10**8;function f2(t){return Math.round(t*l4)/l4}function wA(t){return[f2(t[0]),f2(t[1])]}function _A(t,e,r){if(An.delta(t[0],t[2])<=0)return An.bboxToMultiPolygon(t);let i=[];for(let o of e){let a=[Se.fromJson(o).pad(vA).toPolygon()];i=V6(i,a)}return Cc(i,o=>wA(r.toWgs84(o)))}function SA(t){if(t!=null)return[{name:t.serviceProvider.name,url:t.serviceProvider.site,roles:["host"]}]}async function xA(t,e,r){let i=Ur.get(r),n=[],o=[],a=await Be.load(t),c=await gs(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 v=c.get(m);if(v==null)continue;let E=i.boundsToWgs84BoundingBox(v.bounds).map(f2),w=og(v.name);w[0]===-1&&(t.log.debug({imagery:v.name},"Attribution:DefaultYear"),w[0]=new Date().getUTCFullYear()+1,w[1]=w[0]+1);let b=[w.map(P=>`${P}-01-01T00:00:00Z`)],M={spatial:{bbox:[E]},temporal:{interval:b}};o.push({type:"Feature",stac_version:x1.Version,id:m+"_item",collection:m,assets:{},links:[],bbox:E,geometry:{type:"MultiPolygon",coordinates:_A(E,v.files,i)},properties:{title:v.title??Rd(v.name),category:v.category,datetime:null,start_datetime:b[0][0],end_datetime:b[0][1]}});let T=At.convertZoomLevel(p.minZoom?p.minZoom:0,Ie,r,!0),C=At.convertZoomLevel(p.maxZoom?p.maxZoom:32,Ie,r,!0);n.push({stac_version:x1.Version,license:x1.License,id:v.id,providers:SA(d),title:v.title??Rd(v.name),description:"No description",extent:M,links:[],summaries:{"linz:category":v.category,"linz:zoom":{min:T,max:C},"linz:priority":[1e3+e.layers.indexOf(p)]}})}return{id:e.id,type:"FeatureCollection",stac_version:x1.Version,stac_extensions:["single-file-stac"],title:e.title??"No title",description:e.description??"No Description",features:o,collections:n,links:[]}}async function h2(t){let e=lt.getTileMatrixSet(t.params.tileMatrix);if(e==null)throw new K(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===it.Vector)return ce();let n=Ne.key(i);if(Ne.isNotModified(t,n))return at();t.timer.start("stac:load");let o=await xA(t,i,e);if(t.timer.end("stac:load"),o==null)return ce();let a=new K(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 u4(t,e){let r=Buffer.from(JSON.stringify(e)),i=Ne.key(r);if(Ne.isNotModified(t,i))return at();let n=new K(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 c4(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():u4(t,r)}async function f4(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||ai(c.name)===t.params.imageryId);if(n==null)return ce();let o=ar.find(t.query.get("tileMatrix")??Ie.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():u4(t,i)}var x2=me(require("path"),1);var It;(function(t){t.NONE="application/octet-stream",t.JPEG="image/jpeg",t.JP2="image/jp2",t.JPEGXL="image/jpegxl",t.WEBP="image/webp",t.ZSTD="application/zstd",t.LZW="application/lzw",t.DEFLATE="application/deflate",t.LZERC="application/lerc",t.LZMA="application/x-lzma"})(It||(It={}));var d2={1:It.NONE,5:It.LZW,6:It.JPEG,7:It.JPEG,8:It.DEFLATE,34887:It.LZERC,34925:It.LZMA,34712:It.JP2,5e4:It.ZSTD,50001:It.WEBP,50002:It.JPEGXL};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 X1;(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"})(X1||(X1={}));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 h4=me(p2(),1);function d4(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 ks={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)=>h4.read(t.bytes(e,we.Double),0,t.isLittleEndian,52,8),rational:(t,e)=>[t.getUint32(e),t.getUint32(e+4)]};function Gc(t){switch(t){case Ae.ASCII:return ks.char;case Ae.BYTE:case Ae.UNDEFINED:case Ae.SBYTE:return ks.uint8;case Ae.SHORT:case Ae.SSHORT:return ks.uint16;case Ae.LONG:case Ae.SLONG:return ks.uint32;case Ae.RATIONAL:case Ae.SRATIONAL:return ks.rational;case Ae.DOUBLE:return ks.double;case Ae.LONG8:return ks.uint64;default:throw new Error(`Unknown read type "${t}" "${Ae[t]}"`)}}var Ln=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=d4(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=Gc(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===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 Ns=class extends Ln{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 Q1=class extends Ln{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=Gc(this.dataType);return this.tiff.source.hasBytes(i,r)||await this.tiff.source.loadBytes(i,r),n(this.tiff.source,i)}};var el=class extends Ln{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 Vc={create(t,e){let r=t.source.getUint16(e);if(r===ae.TileOffsets||r===ae.TileByteCounts||r===ae.StripByteCounts||r===ae.StripOffsets)return new Q1(r,t,e);let i=new el(r,t,e);return i.hasBytes?i:new Ns(r,t,e)},isStatic(t){return t instanceof el},isLazy(t){return t instanceof Ns},isOffsetArray(t){return t instanceof Q1}};var MA=32767,Kc=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 Ns&&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:Vc.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:d2[e]}get epsg(){let e=this.valueGeo(X1.ProjectedCSTypeGeoKey);return e===MA?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===It.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:v}=await this.getTileSize(d);return this.getBytes(m,v)}async hasTile(e,r){let i=this.tileSize,n=this.size;if(i==null)throw new Error("Tiff is not tiled");let o=Math.ceil(n.height/i.height),a=Math.ceil(n.width/i.width);if(e>=a||r>=o)return!1;let c=r*a+e;return(await this.getTileSize(c)).offset>0}async getTileSize(e){let r=this.tif.options.tileLeaderByteSize;if(r){let a=await this.getTileOffset(e);return a===0?{offset:0,imageSize:0}:(await this.tif.source.loadBytes(a-r,r),{offset:a,imageSize:this.tif.source.getUint(a-r,r)})}let i=this.tags.get(ae.TileByteCounts);if(i==null)throw new Error("No tile byte counts found");let[n,o]=await Promise.all([this.getTileOffset(e),i.getValueAt(e)]);return{offset:n,imageSize:o}}};var tl;(function(t){t[t.Big=19789]="Big",t[t.Little=18761]="Little"})(tl||(tl={}));var Ir;(function(t){t[t.BigTiff=43]="BigTiff",t[t.Tiff=42]="Tiff"})(Ir||(Ir={}));var xa;(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"})(xa||(xa={}));var m4;(function(t){t.RowMajor="ROW_MAJOR"})(m4||(m4={}));var g2;(function(t){t.uint32="SIZE_AS_UINT4"})(g2||(g2={}));var Jc=class{constructor(){this.options=new Map}get isCogOptimized(){return this.isBroken?!1:this.options.get(xa.LAYOUT)==="IFDS_BEFORE_DATA"}get isBroken(){return this.options.get(xa.KNOWN_INCOMPATIBLE_EDITION)==="YES"}process(e){let r="",i="",n=!1;for(let o=0;o<e.length;o++){let a=e[o];if(a===0)break;let c=String.fromCharCode(a);c===`
188
+ `?(this.options.set(r.trim(),i.trim()),r="",i="",n=!1):c==="="?n=!0:n?i+=c:r+=c}}get tileLeaderByteSize(){switch(this.options.get(xa.BLOCK_LEADER)){case g2.uint32:return we.UInt32;default:return null}}get isMaskInterleaved(){return this.options.get(xa.MASK_INTERLEAVED_WITH_IMAGERY)==="YES"}};var y2={version:Ir.Tiff,pointer:we.UInt32,offset:we.UInt16,ifd:we.UInt16+we.UInt16+2*we.UInt32},b2={version:Ir.BigTiff,pointer:we.UInt64,offset:we.UInt64,ifd:we.UInt16+we.UInt16+2*we.UInt64},W$={[Ir.BigTiff]:b2,[Ir.Tiff]:y2};var v2=me(p2(),1),Zc=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(we.UInt8))}uint16(){return this.tiff.source.getUint16(this.seek(we.UInt16))}uint32(){return this.tiff.source.getUint32(this.seek(we.UInt32))}uint64(){return this.tiff.source.getUint64(this.seek(we.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 v2.read(this.bytes(we.Float),0,this.tiff.source.isLittleEndian,23,4)}double(){return v2.read(this.bytes(we.Double),0,this.tiff.source.isLittleEndian,52,8)}};function p4(t,e=4,r=!0){let i=t.toString(16).padStart(e,"0");return r?"0x"+i:i}var Ma=class{constructor(e){this.version=Ir.Tiff,this.images=[],this.options=new Jc,this.ifdConfig=y2,this.isInitialized=!1,this.source=e,this.cursor=new Zc(this)}static create(e){return new Ma(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===tl.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=b2,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.options.process(e.bytes(n)),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){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,4096)||await this.source.loadBytes(e,4096);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=Vc.create(this,a);if(a+=m.size,m.name==null)throw new Error("Unknown IFD Tag: "+p4(m.id));o.set(m.id,m)}let c=new Kc(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 w2=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 w2;var Yc=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}},_2=class{constructor(e){this.cache=new Sa(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=ht.source(e);kn.trace(i);let n=Ma.create(i);return this.cache.set(e,new Yc({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=ht.source(e);kn.trace(i);let n=xn.fromTar(i);return this.cache.set(e,new Yc({type:"cotar",value:n})),n}},Lt=new _2(700*1e3*1e3);function Ea(t){return t[0]===31&&t[1]===139}var S2=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 Lt.getCotar(e)).get(r);return n&&Buffer.from(n)}async serve(e,r,i){let n=await Be.load(e);if(n==null)return ce();if(n.assets==null)return ce();let o=await Ra.get(n.assets,r);if(o==null)return ce();let a=Ne.key(o);if(Ne.isNotModified(e,a))return at();let c=K.ok().buffer(o,i);return c.header(re.ETag,a),c.header(re.CacheControl,"public, max-age=604800, stale-while-revalidate=86400"),Ea(o)&&c.header(re.ContentEncoding,"gzip"),c}},Ra=new S2;async function g4(t){let e=x2.default.join("fonts",t.params.fontStack,t.params.range)+".pbf";return Ra.serve(t,e,"application/x-protobuf")}async function y4(t){return Ra.serve(t,x2.default.join("fonts","fonts.json"),"application/json")}var T2=me(require("fs"),1),nf=me(require("path"),1),R4=me(M4(),1),P2=me(require("sharp"),1),C4=me(require("url"),1);var tf=me(require("sharp"),1);var Qc=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 CA(t){return t!=null}var ef=new Map,Nn=class{constructor(e){this.tileSize=e}isTooLarge(e){return e.type==="cotar"?!1:!!(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=ef.get(i);return n||(n=this.toImage(e,this.createImage(r)),ef.size>128&&ef.clear(),ef.set(i,n),n)}toImage(e,r){switch(e){case Le.Jpeg:return r.jpeg().toBuffer();case Le.Png:return r.png().toBuffer();case Le.Webp:return r.webp().toBuffer();case Le.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))}isDirectCotar(e){return!(e.layers.length!==1||e.layers[0].type!=="cotar"||this.tileSize!==256||e.format!==Le.Webp||e.background.alpha!==0)}isDirectImage(e){var r;if(e.layers.length!==1)return!1;let i=e.layers[0];if(i.type!=="tiff"||i.x!==0||i.y!==0||i.crop!=null||i.extract!=null||i.resize!=null)return!1;let n=i.asset.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 Qc;if(i.start("compose:overlay"),this.isDirectCotar(e)){let c=e.layers[0],d=await c.asset.get(c.path);return 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),metrics:i,layers:1})}if(this.isDirectImage(e)){let c=e.layers[0],d=await c.asset.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(CA));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){if(e.type==="tiff")return this.composeTileTiff(e,r);if(e.type==="cotar")return this.composeTileTar(e);throw new Error("Failed to compose tile from source")}async composeTileTar(e){let r=await e.asset.get(e.path);return r==null?null:{input:Buffer.from(r),top:0,left:0}}async composeTileTiff(e,r){let i=await e.asset.getTile(e.source.x,e.source.y,e.source.imageId);if(i==null)return null;let n=(0,tf.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:tf.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,tf.default)({create:{width:this.tileSize,height:this.tileSize,channels:4,background:e}})}};Nn.MaxImageSize=256*2**15;var C2=class{constructor(e){fh(this,"value");fh(this,"next");this.value=e}},pi,Ds,zs,rl=class{constructor(){St(this,pi,void 0);St(this,Ds,void 0);St(this,zs,void 0);this.clear()}enqueue(e){let r=new C2(e);Ee(this,pi)?(Ee(this,Ds).next=r,et(this,Ds,r)):(et(this,pi,r),et(this,Ds,r)),hh(this,zs)._++}dequeue(){let e=Ee(this,pi);if(!!e)return et(this,pi,Ee(this,pi).next),hh(this,zs)._--,e.value}clear(){et(this,pi,void 0),et(this,Ds,void 0),et(this,zs,0)}get size(){return Ee(this,zs)}*[Symbol.iterator](){let e=Ee(this,pi);for(;e;)yield e.value,e=e.next}};pi=new WeakMap,Ds=new WeakMap,zs=new WeakMap;function A2(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 rl,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 AA=A2(Xe.getNumber(Xe.TiffConcurrency,25));function TA(t){let e=t.toLowerCase();return e.endsWith(".tif")||e.endsWith(".tiff")?t:`${t}.tiff`}var PA=new Nn(256),OA={in:"lanczos3",out:"lanczos3"},IA={r:0,g:0,b:0,alpha:0},rf={async getAssetsForTile(t,e,r){let i=await Be.load(t),n=await gs(i,e.layers,[r.tileMatrix.projection]),o=[],a=r.tileMatrix.tileToSourceBounds(r.tile),c=At.convertZoomLevel(r.tile.z,r.tileMatrix,ar.get(Re.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(Se.fromJson(m.bounds))){if(m.overviews&&m.overviews.maxZoom>=c&&m.overviews.minZoom<=c){o.push(ht.join(m.uri,m.overviews.path));continue}for(let v of m.files){if(!a.intersects(Se.fromJson(v)))continue;let E=ht.join(m.uri,TA(v.name));o.push(E)}}}return o},async tile(t,e,r){if(r.tileType===lr.MapboxVectorTiles)return ce();let i=await this.getAssetsForTile(t,e,r),n=Ne.key(i);if(Ne.isNotModified(t,n))return at();let o=[];for(let v of i)o.push(AA(()=>v.endsWith(".tar.co")?Lt.getCotar(v).catch(E=>(t.log.warn({error:E,tiff:v},"Load:Cotar:Failed"),null)):Lt.getCog(v).catch(E=>(t.log.warn({error:E,tiff:v},"Load:Tiff:Failed"),null))));let a=(await Promise.all(o)).filter(v=>v!=null),d=await new _a(r.tileMatrix).tile(a,r.tile.x,r.tile.y,r.tile.z),p=await PA.compose({layers:d,format:r.tileType,background:e.background??IA,resizeKernel:e.resizeKernel??OA,metrics:t.timer});t.set("layersUsed",p.layers),t.set("bytes",p.buffer.byteLength);let m=new K(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 NA={},LA=[{tileSet:"health",tileMatrix:Ie,tileType:Le.Png,tile:{x:252,y:156,z:8}},{tileSet:"health",tileMatrix:vn,tileType:Le.Png,tile:{x:30,y:33,z:6}}],E4=256;async function kA(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 T2.promises.readFile(r)}catch(i){if(i.code!=="ENOENT")throw i;let n=nf.join(nf.dirname(C4.default.fileURLToPath(NA.url)),"..","..",r);return await T2.promises.readFile(n)}}async function O2(t){let e=await Be.load(t),r=await e.TileSet.get(e.TileSet.id("health"));if(r==null)throw new K(500,'TileSet: "health" not found');for(let n of LA){let o=await rf.tile(t,r,n);if(o.status!==200)return new K(500,o.statusDescription);if(!Buffer.isBuffer(o._body))throw new K(500,"Not a Buffer response content.");let a=await(0,P2.default)(o._body).raw().toBuffer(),c=await kA(n);n.buf=c;let d=await(0,P2.default)(c).raw().toBuffer(),p=Buffer.alloc(d.length),m=(0,R4.default)(d,a,p,E4,E4);if(m)return t.log.error({missMatchedPixels:m,projection:n.tileMatrix.identifier,xyz:n.tile},"Health:MissMatch"),new K(500,"TileSet does not match.")}let i=new K(200,"ok");return i.header(re.CacheControl,"no-store"),i}var A4=require("util"),T4=require("zlib");var BA=(0,A4.promisify)(T4.gzip);function DA(t){return t==null?!1:!!(t.endsWith(".geojson")||t.endsWith(".json"))}async function P4(t){let e=t.params.fileName;if(!DA(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=ht.join(i.uri,e);try{let o=await ht.read(n),a=Ne.key(o);if(Ne.isNotModified(t,a))return at();let c=new K(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(Ea(o)?o:await BA(o),"application/json"),t.set("bytes",o.byteLength),c}catch{return t.log.warn({targetPath:n},"ImageryMetadata:Failed"),ce()}}var O4=new K(200,"ok");O4.header(re.CacheControl,"no-store");async function I2(){return O4}var I4=me(require("path"),1);var L2=new Map;L2.set(".png","image/png");L2.set(".json","application/json");async function L4(t){let e=I4.default.extname(t.params.spriteName),r=L2.get(e);if(r==null)return ce();let i=xt.join("sprites",t.params.spriteName);return Ra.serve(t,i,r)}async function k4(t){let e=lt.getTileMatrixSet(t.params.tileMatrix);if(e==null)return ce();let r=lt.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=lt.getRequestedFormats(t)??[n.format],a=Xe.get(Xe.PublicUrlBase)??"",c=Be.extract(t),d=Cs({api:r,config:c}),m={tiles:[[a,"v1","tiles",n.name,e.identifier,"{z}","{x}","{y}"].join("/")+`.${o[0]}${d}`],tilejson:"3.0.0"},v=At.convertZoomLevel(n.maxZoom??30,Ie,e,!0),E=At.convertZoomLevel(n.minZoom??0,Ie,e,!0);n.maxZoom&&(m.maxzoom=v),n.minZoom&&(m.minzoom=E);let w=JSON.stringify(m),b=Buffer.from(w),M=new K(200,"ok");return M.header(re.CacheControl,"no-store"),M.buffer(b,"application/json"),t.set("bytes",b.byteLength),M}var j4=require("crypto");var zA={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 N4(t,e){return Ur.get(t).boundsToWgs84BoundingBox(e)}var B4=6,D4=4;function z4(t,e){return Number(t.toFixed(e)).toString()}function sf(t,e,r){return`${z4(t,r)} ${z4(e,r)}`}var of=class{constructor(e){this.tileMatrixSets=new Map;this.isIndividualLayers=!1;this.minZoom=0;this.maxZoom=32;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??i4,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=N4(e,n.toJson())}else i=N4(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",sf(i[0],i[1],B4)),X("ows:UpperCorner",sf(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=Se.fromJson(c.bounds):i=i.union(Se.fromJson(c.bounds)))}if(i==null)return null;let n=i.toBbox();return X("ows:BoundingBox",{crs:e.projection.toUrn()},[X("ows:LowerCorner",sf(n[e.indexX],n[e.indexY],D4)),X("ows:UpperCorner",sf(n[e.indexX+2],n[e.indexY+2],D4))])}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=Cs({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=ai(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,[Se.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=ai(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===Ie.identifier)??a,d=[];for(let p of e.layers){let m=this.imagery.get(p[c.projection.code]??"");m!=null&&d.push(Se.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.slice(this.minZoom,this.maxZoom).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(ai(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",zA,[...this.buildProvider(),X("Contents",e)])}toXml(){return`<?xml version="1.0" encoding="utf-8"?>
189
+ `+this.toVNode().toString()}};function jA(t){if(t==null)return[Ie,vn];let e=lt.getTileMatrixSet(t);return e==null?null:[e]}async function af(t){let e=lt.apiKey(t),r=t.params.tileSet??"aerial",i=jA(t.params.tileMatrix);if(i==null)return ce();let n=Xe.get(Xe.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!==it.Raster)return ce();let c=await o.Provider.get(o.Provider.id("linz"));t.timer.start("imagery:load");let d=await gs(o,a.layers,i.map(w=>w.projection));t.timer.end("imagery:load");let p=new of({httpBase:n,provider:c??void 0,tileSet:a,tileMatrix:i,isIndividualLayers:t.params.tileMatrix==null,imagery:d,apiKey:e,config:Be.extract(t),formats:lt.getRequestedFormats(t)}).toXml();if(p==null)return ce();let m=Buffer.from(p),v=(0,j4.createHash)("sha256").update(m).digest("base64");if(Ne.isNotModified(t,v))return at();let E=new K(200,"ok");return E.header(re.ETag,v),E.header(re.CacheControl,"no-store"),E.buffer(m,"text/xml"),t.set("bytes",m.byteLength),E}var $4={async tile(t,e,r){if(r.tileType!==lr.MapboxVectorTiles)return ce();if(r.tileMatrix.identifier!==Ie.identifier)return ce();if(e.layers.length>1)return new K(500,"Too many layers in tileset");let[i]=e.layers,n=i[3857];if(n==null)return new K(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 at();t.timer.start("cotar:load");let p=await Lt.getCotar(n);if(p==null)return new K(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 e4();t.timer.end("cotar:tile");let v=Buffer.from(m),E=K.ok().buffer(v,"application/x-protobuf");return E.header(re.ETag,d),E.header(re.CacheControl,"public, max-age=604800, stale-while-revalidate=86400"),Ea(v)&&E.header(re.ContentEncoding,"gzip"),E}};async function F4(t){let e=lt.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 it.Vector:return $4.tile(t,i,e);case it.Raster:return rf.tile(t,i,e);default:return new K(400,"Invalid tileset")}}async function k2(){let t=new K(200,"ok");return t.header(re.CacheControl,"no-store"),t.json({version:"v6.37.0",hash:"98c97100161b159272c1826c4e668b3e805ec214"}),t}var Fe=Wt.http(Oo.get());Fe.router.timeoutEarlyMs=1e3;Fe.router.hook("request",t=>{t.set("name","LambdaTiler"),kn.reset()});Fe.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:Lt.cache.hits,misses:Lt.cache.misses,size:Lt.cache.currentSize,resets:Lt.cache.resets,clears:Lt.cache.clears,cacheA:Lt.cache.cacheA.size,cacheB:Lt.cache.cacheB.size}),e.header("access-control-allow-origin","*")});Fe.router.options("*",t=>Fe.router.router.find("GET",t.path)==null?ce():K.ok());Fe.router.get("/ping",I2);Fe.router.get("/health",O2);Fe.router.get("/version",k2);Fe.router.get("/v1/ping",I2);Fe.router.get("/v1/health",O2);Fe.router.get("/v1/version",k2);Fe.router.get("/v1/imagery/:imageryId/:fileName",P4);Fe.router.get("/v1/config/:tileSet.json",c4);Fe.router.get("/v1/config/:tileSet/:imageryId.json",f4);Fe.router.get("/v1/sprites/:spriteName",L4);Fe.router.get("/v1/fonts.json",y4);Fe.router.get("/v1/fonts/:fontStack/:range.pbf",g4);Fe.router.get("/v1/styles/:styleName.json",c2);Fe.router.get("/v1/tiles/:tileSet/:tileMatrix/style/:styleName.json",c2);Fe.router.get("/v1/tiles/:tileSet/:tileMatrix/tile.json",k4);Fe.router.get("/v1/tiles/:tileSet/:tileMatrix/:z/:x/:y.:tileType",F4);Fe.router.get("/v1/tiles/:tileSet/:tileMatrix/attribution.json",h2);Fe.router.get("/v1/attribution/:tileSet/:tileMatrix/summary.json",h2);Fe.router.get("/v1/tiles/:tileSet/:tileMatrix/WMTSCapabilities.xml",af);Fe.router.get("/v1/tiles/:tileSet/WMTSCapabilities.xml",af);Fe.router.get("/v1/tiles/WMTSCapabilities.xml",af);Fe.router.get("/v1/arcgis/rest/services/:tileSet/VectorTileServer",a4);Fe.router.post("/v1/arcgis/rest/services/:tileSet/VectorTileServer",t4);Fe.router.get("/v1/arcgis/rest/services/:tileSet/VectorTileServer/root.json",o4);Fe.router.get("/v1/arcgis/rest/info",r4);0&&(module.exports={handler});
188
190
  /*! fetch-blob. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
189
191
  /*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
190
192
  /*! node-domexception. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */