@loaders.gl/tiles-3d 5.0.0-beta.10 → 5.0.0-beta.11

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 (154) hide show
  1. package/dist/3d-tiles/3d-tiles-archive-loader.js +1 -1
  2. package/dist/3d-tiles/dist.dev.js +169 -581
  3. package/dist/3d-tiles/dist.min.js +16 -16
  4. package/dist/3d-tiles/index.cjs +115 -390
  5. package/dist/3d-tiles/index.cjs.map +3 -3
  6. package/dist/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.d.ts +1 -2
  7. package/dist/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.d.ts.map +1 -1
  8. package/dist/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.js +3 -4
  9. package/dist/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.js.map +1 -1
  10. package/dist/3d-tiles/lib/classes/helpers/tile-component-types.d.ts +4 -0
  11. package/dist/3d-tiles/lib/classes/helpers/tile-component-types.d.ts.map +1 -0
  12. package/dist/3d-tiles/lib/classes/helpers/tile-component-types.js +36 -0
  13. package/dist/3d-tiles/lib/classes/helpers/tile-component-types.js.map +1 -0
  14. package/dist/3d-tiles/lib/classes/tile-3d-batch-table-hierarchy.d.ts.map +1 -1
  15. package/dist/3d-tiles/lib/classes/tile-3d-batch-table-hierarchy.js +3 -4
  16. package/dist/3d-tiles/lib/classes/tile-3d-batch-table-hierarchy.js.map +1 -1
  17. package/dist/3d-tiles/lib/classes/tile-3d-batch-table.d.ts +1 -1
  18. package/dist/3d-tiles/lib/classes/tile-3d-feature-table.d.ts +9 -5
  19. package/dist/3d-tiles/lib/classes/tile-3d-feature-table.d.ts.map +1 -1
  20. package/dist/3d-tiles/lib/classes/tile-3d-feature-table.js +15 -12
  21. package/dist/3d-tiles/lib/classes/tile-3d-feature-table.js.map +1 -1
  22. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.d.ts +0 -1
  23. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.d.ts.map +1 -1
  24. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.js +2 -4
  25. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.js.map +1 -1
  26. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.d.ts +1 -2
  27. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.d.ts.map +1 -1
  28. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.js +7 -7
  29. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.js.map +1 -1
  30. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-positions.d.ts.map +1 -1
  31. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-positions.js +0 -2
  32. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-positions.js.map +1 -1
  33. package/dist/3d-tiles/lib/parsers/parse-3d-tile-batched-model.d.ts.map +1 -1
  34. package/dist/3d-tiles/lib/parsers/parse-3d-tile-batched-model.js +1 -2
  35. package/dist/3d-tiles/lib/parsers/parse-3d-tile-batched-model.js.map +1 -1
  36. package/dist/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.js +13 -13
  37. package/dist/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.js.map +1 -1
  38. package/dist/3d-tiles/lib/parsers/parse-3d-tile-point-cloud.d.ts.map +1 -1
  39. package/dist/3d-tiles/lib/parsers/parse-3d-tile-point-cloud.js +22 -23
  40. package/dist/3d-tiles/lib/parsers/parse-3d-tile-point-cloud.js.map +1 -1
  41. package/dist/3d-tiles/lib/utils/version.js +1 -1
  42. package/dist/3d-tiles/types.d.ts +7 -3
  43. package/dist/3d-tiles/types.d.ts.map +1 -1
  44. package/dist/3d-tiles-archive-writer.cjs +1 -1
  45. package/dist/copc/copc-loader.d.ts.map +1 -1
  46. package/dist/copc/copc-loader.js +10 -7
  47. package/dist/copc/copc-loader.js.map +1 -1
  48. package/dist/copc/copc-writer.d.ts +5 -4
  49. package/dist/copc/copc-writer.d.ts.map +1 -1
  50. package/dist/copc/copc-writer.js +1 -1
  51. package/dist/copc/copc-writer.js.map +1 -1
  52. package/dist/copc/index.cjs +809 -124
  53. package/dist/copc/index.cjs.map +3 -3
  54. package/dist/dist.dev.js +45 -77
  55. package/dist/dist.min.js +10 -10
  56. package/dist/i3s/arcgis-webscene-loader.js +1 -1
  57. package/dist/i3s/dist.dev.js +11915 -12119
  58. package/dist/i3s/dist.min.js +25 -25
  59. package/dist/i3s/i3s-attribute-loader.js +1 -1
  60. package/dist/i3s/i3s-building-scene-layer-loader.js +1 -1
  61. package/dist/i3s/i3s-content-loader.js +1 -1
  62. package/dist/i3s/i3s-lepcc-loader-types.js +1 -1
  63. package/dist/i3s/i3s-loader.js +1 -1
  64. package/dist/i3s/i3s-mesh-attributes.d.ts +2 -2
  65. package/dist/i3s/i3s-mesh-attributes.d.ts.map +1 -1
  66. package/dist/i3s/i3s-mesh-attributes.js +6 -11
  67. package/dist/i3s/i3s-mesh-attributes.js.map +1 -1
  68. package/dist/i3s/i3s-mesh-writer.js +2 -3
  69. package/dist/i3s/i3s-mesh-writer.js.map +1 -1
  70. package/dist/i3s/i3s-node-page-loader.js +1 -1
  71. package/dist/i3s/i3s-slpk-loader.js +1 -1
  72. package/dist/i3s/i3s-slpk-writer.js +1 -1
  73. package/dist/i3s/index.cjs +314 -442
  74. package/dist/i3s/index.cjs.map +3 -3
  75. package/dist/i3s/lib/parsers/constants.d.ts +0 -3
  76. package/dist/i3s/lib/parsers/constants.d.ts.map +1 -1
  77. package/dist/i3s/lib/parsers/constants.js +0 -8
  78. package/dist/i3s/lib/parsers/constants.js.map +1 -1
  79. package/dist/i3s/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -1
  80. package/dist/i3s/lib/parsers/parse-i3s-tile-content.js +1 -2
  81. package/dist/i3s/lib/parsers/parse-i3s-tile-content.js.map +1 -1
  82. package/dist/i3s/types.d.ts +0 -1
  83. package/dist/i3s/types.d.ts.map +1 -1
  84. package/dist/i3s-content-worker-node.js +11 -11
  85. package/dist/i3s-content-worker-node.js.map +4 -4
  86. package/dist/i3s-content-worker.js +485 -879
  87. package/dist/i3s-lepcc-worker-node.js +2 -2
  88. package/dist/i3s-lepcc-worker.js +2 -2
  89. package/dist/i3s-mesh-writer.cjs +87 -206
  90. package/dist/i3s-mesh-writer.cjs.map +3 -3
  91. package/dist/i3s-slpk-writer.cjs +1 -1
  92. package/dist/index.cjs +44 -41
  93. package/dist/index.cjs.map +1 -1
  94. package/dist/point-cloud-tile-loader-types.js +1 -1
  95. package/dist/point-cloud-tile-loader.cjs +17 -28
  96. package/dist/point-cloud-tile-loader.cjs.map +1 -1
  97. package/dist/point-cloud-tile-source.cjs +16 -27
  98. package/dist/point-cloud-tile-source.cjs.map +1 -1
  99. package/dist/point-cloud-tile-source.js +2 -2
  100. package/dist/point-cloud-tile-source.js.map +1 -1
  101. package/dist/potree/dist.dev.js +985 -139
  102. package/dist/potree/dist.min.js +28 -28
  103. package/dist/potree/index.cjs +813 -140
  104. package/dist/potree/index.cjs.map +3 -3
  105. package/dist/potree/lib/potree-node-source.d.ts.map +1 -1
  106. package/dist/potree/lib/potree-node-source.js +2 -14
  107. package/dist/potree/lib/potree-node-source.js.map +1 -1
  108. package/dist/potree/parsers/parse-potree-bin.js +3 -3
  109. package/dist/potree/parsers/parse-potree-bin.js.map +1 -1
  110. package/dist/potree/potree-bin-loader.js +1 -1
  111. package/dist/potree/potree-hierarchy-chunk-loader.js +1 -1
  112. package/dist/potree/potree-loader-types.js +1 -1
  113. package/dist/potree/potree-writer.d.ts +3 -3
  114. package/dist/potree/potree-writer.d.ts.map +1 -1
  115. package/dist/potree/potree-writer.js +2 -2
  116. package/dist/potree/potree-writer.js.map +1 -1
  117. package/dist/potree/potree2-source.d.ts +1 -1
  118. package/dist/potree/potree2-source.d.ts.map +1 -1
  119. package/dist/potree/potree2-source.js +6 -3
  120. package/dist/potree/potree2-source.js.map +1 -1
  121. package/dist/potree-loader.cjs +817 -153
  122. package/dist/potree-loader.cjs.map +3 -3
  123. package/dist/tileset-3d/helpers/frame-state.d.ts +2 -1
  124. package/dist/tileset-3d/helpers/frame-state.d.ts.map +1 -1
  125. package/dist/tileset-3d/helpers/frame-state.js +41 -15
  126. package/dist/tileset-3d/helpers/frame-state.js.map +1 -1
  127. package/dist/types.d.ts +15 -0
  128. package/dist/types.d.ts.map +1 -1
  129. package/package.json +13 -13
  130. package/src/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.ts +3 -4
  131. package/src/3d-tiles/lib/classes/helpers/tile-component-types.ts +39 -0
  132. package/src/3d-tiles/lib/classes/tile-3d-batch-table-hierarchy.ts +3 -4
  133. package/src/3d-tiles/lib/classes/tile-3d-feature-table.ts +38 -14
  134. package/src/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.ts +2 -5
  135. package/src/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.ts +10 -10
  136. package/src/3d-tiles/lib/parsers/helpers/normalize-3d-tile-positions.ts +0 -2
  137. package/src/3d-tiles/lib/parsers/parse-3d-tile-batched-model.ts +1 -2
  138. package/src/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.ts +19 -19
  139. package/src/3d-tiles/lib/parsers/parse-3d-tile-point-cloud.ts +22 -23
  140. package/src/3d-tiles/types.ts +4 -3
  141. package/src/copc/copc-loader.ts +8 -8
  142. package/src/copc/copc-writer.ts +6 -5
  143. package/src/i3s/i3s-mesh-attributes.ts +9 -17
  144. package/src/i3s/i3s-mesh-writer.ts +4 -3
  145. package/src/i3s/lib/parsers/constants.ts +0 -9
  146. package/src/i3s/lib/parsers/parse-i3s-tile-content.ts +1 -2
  147. package/src/i3s/types.ts +0 -1
  148. package/src/point-cloud-tile-source.ts +2 -2
  149. package/src/potree/lib/potree-node-source.ts +2 -15
  150. package/src/potree/parsers/parse-potree-bin.ts +3 -3
  151. package/src/potree/potree-writer.ts +6 -11
  152. package/src/potree/potree2-source.ts +6 -3
  153. package/src/tileset-3d/helpers/frame-state.ts +43 -15
  154. package/src/types.ts +15 -0
package/dist/dist.min.js CHANGED
@@ -4,27 +4,27 @@
4
4
  else if (typeof define === 'function' && define.amd) define([], factory);
5
5
  else if (typeof exports === 'object') exports['loaders'] = factory();
6
6
  else root['loaders'] = factory();})(globalThis, function () {
7
- "use strict";var __exports__=(()=>{var AP=Object.create;var df=Object.defineProperty;var PP=Object.getOwnPropertyDescriptor;var RP=Object.getOwnPropertyNames;var CP=Object.getPrototypeOf,NP=Object.prototype.hasOwnProperty;var w=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var OP=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Zr=(e,t)=>{for(var r in t)df(e,r,{get:t[r],enumerable:!0})},ff=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of RP(t))!NP.call(e,i)&&i!==r&&df(e,i,{get:()=>t[i],enumerable:!(n=PP(t,i))||n.enumerable});return e},mf=(e,t,r)=>(ff(e,t,"default"),r&&ff(r,t,"default")),BP=(e,t,r)=>(r=e!=null?AP(CP(e)):{},ff(t||!e||!e.__esModule?df(r,"default",{value:e,enumerable:!0}):r,e)),LP=e=>ff(df({},"__esModule",{value:!0}),e);var zM=OP((rF,GM)=>{GM.exports=globalThis.loaders});function ii(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var VM=w(()=>{"use strict"});var nh,DP,pf,FP,UP,R0=w(()=>{nh=globalThis,DP=globalThis.document||{},pf=globalThis.process||{},FP=globalThis.console,UP=globalThis.navigator||{}});function gf(e){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&process.versions?.electron)return!0;let t=typeof navigator<"u"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}var yf=w(()=>{});function zo(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||gf()}var C0=w(()=>{yf()});var kM=w(()=>{C0();yf();R0()});var qM=w(()=>{});var N0,wf=w(()=>{R0();C0();kM();yf();qM();N0="5.0.0"});function vc(e,t){if(!e)throw new Error(t||"Assertion failed")}var O0=w(()=>{});function _f(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return vc(Number.isFinite(t)&&t>=0),t}function B0(e){let{logLevel:t,message:r}=e;e.logLevel=_f(t);let n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let i=typeof e.message;return vc(i==="string"||i==="object"),Object.assign(e,{args:n},e.opts)}var Mf=w(()=>{O0()});var Vo,ua,ih=w(()=>{Mf();Vo=()=>{},ua=class{constructor({level:t=0}={}){this.userData={},this._onceCache=new Set,this._level=t}set level(t){this.setLevel(t)}get level(){return this.getLevel()}setLevel(t){return this._level=t,this}getLevel(){return this._level}warn(t,...r){return this._log("warn",0,t,r,{once:!0})}error(t,...r){return this._log("error",0,t,r)}log(t,r,...n){return this._log("log",t,r,n)}info(t,r,...n){return this._log("info",t,r,n)}once(t,r,...n){return this._log("once",t,r,n,{once:!0})}_log(t,r,n,i,o={}){let s=B0({logLevel:r,message:n,args:this._buildArgs(r,n,i),opts:o});return this._createLogFunction(t,s,o)}_buildArgs(t,r,n){return[t,r,...n]}_createLogFunction(t,r,n){if(!this._shouldLog(r.logLevel))return Vo;let i=this._getOnceTag(n.tag??r.tag??r.message);if((n.once||r.once)&&i!==void 0){if(this._onceCache.has(i))return Vo;this._onceCache.add(i)}return this._emit(t,r)}_shouldLog(t){return this.getLevel()>=_f(t)}_getOnceTag(t){if(t!==void 0)try{return typeof t=="string"?t:String(t)}catch{return}}}});function zP(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var oh,L0=w(()=>{oh=class{constructor(t,r,n="sessionStorage"){this.storage=zP(n),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}}});function jM(e){let t;return e<10?t=`${e.toFixed(2)}ms`:e<100?t=`${e.toFixed(1)}ms`:e<1e3?t=`${e.toFixed(0)}ms`:t=`${(e/1e3).toFixed(2)}s`,t}function D0(e,t=8){let r=Math.max(t-e.length,0);return`${" ".repeat(r)}${e}`}var F0=w(()=>{});function WM(e){return typeof e!="string"?e:(e=e.toUpperCase(),sh[e]||sh.WHITE)}function U0(e,t,r){return!zo&&typeof e=="string"&&(t&&(e=`\x1B[${WM(t)}m${e}\x1B[39m`),r&&(e=`\x1B[${WM(r)+VP}m${e}\x1B[49m`)),e}var sh,VP,bf=w(()=>{wf();(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(sh||(sh={}));VP=10});function G0(e,t=["constructor"]){let r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),i=e;for(let o of n){let s=i[o];typeof s=="function"&&(t.find(a=>o===a)||(i[o]=s.bind(e)))}}var z0=w(()=>{});var xf,zn,ah=w(()=>{wf();xf=class{getHighResolutionTimer(){let t;if(zo()&&nh.performance)t=nh?.performance?.now?.();else if("hrtime"in pf){let r=pf?.hrtime?.();t=r[0]*1e3+r[1]/1e6}else t=Date.now();return t}getMemoryUsageMB(){let r=nh?.performance?.memory?.usedJSHeapSize;return r==null?null:Math.trunc(r/1024/1024)}},zn=new xf;globalThis.Probe=xf;globalThis.probe=zn});function kP(e,t,r){if(typeof t=="string"){let n=r.time?D0(jM(r.total)):"";t=r.time?`${e}: ${n} ${t}`:`${e}: ${t}`,t=U0(t,r.color,r.background)}return t}function qP(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}var Ec,V0,Zi,k0=w(()=>{wf();ih();L0();F0();bf();z0();O0();ah();Mf();Mf();Ec={debug:zo()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},V0={enabled:!0,level:0},Zi=class extends ua{constructor({id:t}={id:""}){super({level:0}),this.VERSION=N0,this._startTs=zn.getHighResolutionTimer(),this._deltaTs=zn.getHighResolutionTimer(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new oh(`__probe-${this.id}__`,{[this.id]:V0}),this.timeStamp(`${this.id} started`),G0(this),Object.seal(this)}isEnabled(){return this._getConfiguration().enabled}getLevel(){return this._getConfiguration().level}getTotal(){return Number((zn.getHighResolutionTimer()-this._startTs).toPrecision(10))}getDelta(){return Number((zn.getHighResolutionTimer()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._updateConfiguration({enabled:t}),this}setLevel(t){return this._updateConfiguration({level:t}),this}get(t){return this._getConfiguration()[t]}set(t,r){this._updateConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){if(!t)throw new Error(r||"Assertion failed")}warn(t,...r){return this._log("warn",0,t,r,{method:Ec.warn,once:!0})}error(t,...r){return this._log("error",0,t,r,{method:Ec.error})}deprecated(t,r){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(t,r){return this.error(`\`${t}\` has been removed. Use \`${r}\` instead`)}probe(t,r,...n){let i=zn.getMemoryUsageMB();if(i!==null){let o=`${i}MB `;typeof r=="function"?r=()=>`${o}${r()}`:typeof r=="string"&&(r=`${o}${r}`)}return this._log("log",t,r,n,{method:Ec.log,time:!0,once:!0})}log(t,r,...n){return this._log("log",t,r,n,{method:Ec.debug})}info(t,r,...n){return this._log("info",t,r,n,{method:console.info})}once(t,r,...n){return this._log("once",t,r,n,{method:Ec.debug||Ec.info,once:!0})}table(t,r,n){return r?this._log("table",t,r,n&&[n]||[],{method:console.table||Vo,tag:qP(r)}):Vo}time(t,r){return this._log("time",t,r,[],{method:console.time?console.time:console.info})}timeEnd(t,r){return this._log("time",t,r,[],{method:console.timeEnd?console.timeEnd:console.info})}timeStamp(t,r){return this._log("time",t,r,[],{method:console.timeStamp||Vo})}group(t,r,n={collapsed:!1}){let i=(n.collapsed?console.groupCollapsed:console.group)||console.info;return this._log("group",t,r,[],{method:i})}groupCollapsed(t,r,n={}){return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._log("groupEnd",t,"",[],{method:console.groupEnd||Vo})}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&super._shouldLog(t)}_emit(t,r){let n=r.method;vc(n),r.total=this.getTotal(),r.delta=this.getDelta(),this._deltaTs=zn.getHighResolutionTimer();let i=kP(this.id,r.message,r);return n.bind(console,i,...r.args)}_getConfiguration(){return this._storage.config[this.id]||this._updateConfiguration(V0),this._storage.config[this.id]}_updateConfiguration(t){let r=this._storage.config[this.id]||{...V0};this._storage.setConfiguration({[this.id]:{...r,...t}})}};Zi.VERSION=N0});var HM=w(()=>{ih()});var $M=w(()=>{ih()});var YM=w(()=>{ah()});var KM=w(()=>{ah();globalThis.probe||(globalThis.probe=zn)});var n5,XM=w(()=>{k0();ah();k0();HM();ih();$M();bf();bf();F0();z0();L0();YM();KM();n5=new Zi({id:"@probe.gl/log"})});function WP(){let e=new Zi({id:"loaders.gl"});return globalThis.loaders||={},globalThis.loaders.log=e,globalThis.loaders.version=jP,globalThis.probe||={},globalThis.probe.loaders=e,e}function ch(){}function W0(e){let t=e?.core?.log;return t===null?HP:t||Ji}var q0,jP,Ji,j0,HP,H0=w(()=>{"use strict";XM();q0="5.0.0-beta.10",jP=q0[0]>="0"&&q0[0]<="9"?`v${q0}`:"";Ji=WP(),j0=class{log(){return ch}info(){return ch}once(){return ch}warn(){return ch}error(){return ch}};HP=new j0});var $P,ZM,JM=w(()=>{"use strict";$P=e=>e!==null&&typeof e=="object",ZM=e=>$P(e)&&e.constructor==={}.constructor});function Sf(e,t){return QM(e||{},t)}function QM(e,t,r=0){if(r>3)return t;let n={...e};for(let[i,o]of Object.entries(t))ZM(o)?n[i]=QM(n[i]||{},t[i],r+1):n[i]=t[i];return n}var t2=w(()=>{"use strict";JM()});function vf(e,t,r){let n=r!==void 0?new Uint8Array(e).subarray(t,t+r):new Uint8Array(e).subarray(t);return new Uint8Array(n).buffer}var e2=w(()=>{"use strict"});function lh(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var $0=w(()=>{});var fa,Y0=w(()=>{$0();fa=class{constructor(t,r){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=lh(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(lh()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}}});var Pi,r2=w(()=>{Y0();Pi=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,r="count"){return this._getOrCreate({name:t,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let r of Object.values(this.stats))t(r)}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(r=>this._getOrCreate(r))}_getOrCreate(t){let{name:r,type:n}=t,i=this.stats[r];return i||(t instanceof fa?i=t:i=new fa(r,n),this.stats[r]=i),i}}});var Ef=w(()=>{r2();Y0();$0()});var YP,KP,XP,ZP,JP,QP,Tc,n2=w(()=>{"use strict";Ef();YP="Queued Requests",KP="Active Requests",XP="Cancelled Requests",ZP="Queued Requests Ever",JP="Active Requests Ever",QP={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},Tc=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(t={}){this.props={...QP,...t},this.stats=new Pi({id:this.props.id}),this.stats.get(YP),this.stats.get(KP),this.stats.get(XP),this.stats.get(ZP),this.stats.get(JP)}setProps(t){t.throttleRequests!==void 0&&(this.props.throttleRequests=t.throttleRequests),t.maxRequests!==void 0&&(this.props.maxRequests=t.maxRequests),t.debounceTime!==void 0&&(this.props.debounceTime=t.debounceTime)}scheduleRequest(t,r=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);let n={handle:t,priority:0,getPriority:r},i=new Promise(o=>(n.resolve=o,n));return this.requestQueue.push(n),this.requestMap.set(t,i),this._issueNewRequests(),i}_issueRequest(t){let{handle:r,resolve:n}=t,i=!1,o=()=>{i||(i=!0,this.requestMap.delete(r),this.activeRequestCount--,this.scheduleRefill())};return this.activeRequestCount++,n?n({done:o}):Promise.resolve({done:o})}scheduleRefill(){this.updateTimer===null&&(this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),0))}_issueNewRequests(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=null;let t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(t!==0){this._updateAllRequests();for(let r=0;r<t;++r){let n=this.requestQueue.shift();n&&this._issueRequest(n)}}}_updateAllRequests(){let t=this.requestQueue;for(let r=0;r<t.length;++r){let n=t[r];this._updateRequest(n)||(t.splice(r,1),this.requestMap.delete(n.handle),r--)}t.sort((r,n)=>r.priority-n.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),t.priority<0?(t.resolve(null),!1):!0}}});function X0(e,t=[]){return e.every(K0)?e:e.map((r,n)=>{if(K0(r))return r;let i=t.find(s=>s.type===r?.type);if(!i)throw new Error(`No authentication class registered for credential at index ${n}.`);let o;try{o=new i(r)}catch{throw new Error(`Invalid authentication configuration at index ${n}.`)}if(!K0(o))throw new Error(`Authentication class returned an invalid credential at index ${n}.`);return o})}function Z0(e){if(!e.core?.credentials?.length)return e;let t=X0(e.core.credentials,e.core.authentications);return t===e.core.credentials?e:{...e,core:{...e.core,credentials:t}}}function K0(e){return!e||typeof e!="object"||typeof e.id!="string"||!Array.isArray(e.origins)?!1:e.type==="request"?typeof e.authenticate=="function":(e.type==="header"||e.type==="query-parameter")&&typeof e.name=="string"&&(typeof e.token=="string"||typeof e.token=="function")&&Array.isArray(e.refreshStatusCodes)}var J0=w(()=>{"use strict"});function Q0(){let e=new Error("Request aborted");return e.name="AbortError",e}function i2(e,t,r){let n=e??t;if(n<0||Number.isNaN(n))throw new Error(`${r} must be a non-negative number`);return n}function o2(e){if(!Number.isFinite(e)||e<0)throw new Error("Request cache entry byte length must be a non-negative finite number");return e}var tR,eR,hh,s2=w(()=>{"use strict";tR=Number.POSITIVE_INFINITY,eR=Number.POSITIVE_INFINITY,hh=class{maxEntries;maxBytes;getByteLength;onRemove;entries=new Map;retainedByteLength=0;constructor(t={}){this.maxEntries=i2(t.maxEntries,tR,"maxEntries"),this.maxBytes=i2(t.maxBytes,eR,"maxBytes"),this.getByteLength=t.getByteLength||(()=>0),this.onRemove=t.onRemove}get size(){return this.entries.size}get pendingSize(){let t=0;for(let r of this.entries.values())t+=r.pending?1:0;return t}get byteLength(){return this.retainedByteLength}get(t,r){let n=this.entries.get(t);if(n)return this.touch(t,n),this.waitForEntry(t,n,r)}has(t){return this.entries.has(t)}set(t,r){this.removeEntry(t,"replace");let n=o2(this.getByteLength(r)),i={promise:Promise.resolve(r),pending:!1,waiterCount:0,byteLength:n};return this.entries.set(t,i),this.retainedByteLength+=n,this.trim(),r}getOrLoad(t,r,n){let i=this.get(t,n);if(i)return i;if(n?.aborted)return Promise.reject(Q0());let o=new AbortController,s,a,l={promise:new Promise((h,u)=>{s=h,a=u}),controller:o,pending:!0,waiterCount:0,byteLength:0};this.entries.set(t,l),l.promise.then(h=>this.handleLoadedValue(t,l,h),()=>this.handleLoadError(t,l));try{Promise.resolve(r(o.signal)).then(s,a)}catch(h){a(h)}return this.waitForEntry(t,l,n)}delete(t){return this.removeEntry(t,"delete")}clear(){for(let t of Array.from(this.entries.keys()))this.removeEntry(t,"clear")}handleLoadedValue(t,r,n){if(this.entries.get(t)===r){r.pending=!1,r.controller=void 0;try{r.byteLength=o2(this.getByteLength(n))}catch{this.removeEntry(t,"error");return}this.retainedByteLength+=r.byteLength,this.trim()}}handleLoadError(t,r){this.entries.get(t)===r&&this.removeEntry(t,r.controller?.signal.aborted?"abort":"error")}waitForEntry(t,r,n){return n?.aborted?Promise.reject(Q0()):r.pending?(r.waiterCount++,new Promise((i,o)=>{let s=!0,a=()=>{s&&(s=!1,n?.removeEventListener("abort",c),r.waiterCount--)},c=()=>{s&&(a(),o(Q0()),r.pending&&r.waiterCount===0&&this.entries.get(t)===r&&this.removeEntry(t,"abort"))};n?.addEventListener("abort",c,{once:!0}),r.promise.then(l=>{s&&(a(),i(l))},l=>{s&&(a(),o(l))})})):r.promise}touch(t,r){this.entries.delete(t),this.entries.set(t,r)}trim(){let t=this.entries.size-this.pendingSize;if(!(t<=this.maxEntries&&this.retainedByteLength<=this.maxBytes)){for(let[r,n]of this.entries)if(n.pending||(this.removeEntry(r,"evict"),t--),t<=this.maxEntries&&this.retainedByteLength<=this.maxBytes)break}}removeEntry(t,r){let n=this.entries.get(t);return n?(this.entries.delete(t),this.retainedByteLength-=n.byteLength,n.pending&&n.controller?.abort(),this.onRemove?.(t,r),!0):!1}}});function rR(e){let t=e.fetch||((u,f)=>fetch(u,f)),r=t[a2],n=new Map(r?.credentialResolutions),i=X0(e.credentials.map(u=>n.get(u)||u),e.authentications);if(e.credentials.forEach((u,f)=>{n.set(u,i[f])}),!e.fetchOptions&&(!i.length||r?.credentials.length===i.length&&i.every((u,f)=>u===r.credentials[f])))return t;let o=r?.fetch||t,s=r?[...new Set([...i,...r.credentials])]:i,a=c2(r?.fetchOptions||{},e.fetchOptions),c=s.filter(u=>u.type!=="request"),l=s.filter(u=>u.type==="request");for(let u of l)d2(u.origins);let h=async(u,f={})=>{if(f=c2(a,f),f.signal?.throwIfAborted(),!s.length)return o(u,f);let d=oR(u),m=d?await h2(d,f,c):{url:u,options:f,credentials:[]},p=await l2(m,l,"request"),g=await o(p.url,p.options),y=[];for(let T of m.credentials){let{credential:S}=T;typeof S.token=="function"&&(Tf(f)||S.canReplayRequest?.(u,f))&&(Tf(p.options)||S.canReplayRequest?.(p.url,p.options))&&(S.refreshStatusCodes.includes(g.status)||await S.shouldRefresh?.(g))&&y.push(T)}let _=Tf(f)&&Tf(p.options)&&p.credentials.some(T=>T.refreshStatusCodes?.includes(g.status));if(!y.length&&!_)return g;f.signal?.throwIfAborted();let M=new Map;if(await Promise.all(y.map(async({credential:T})=>{let S=await nR(T,u,g);S&&M.set(T,S)})),!M.size&&!_)return g;await g.body?.cancel().catch(()=>{}),f.signal?.throwIfAborted();let b=d?await h2(d,f,c,M,m.credentials):{url:u,options:f},v=await l2(b,l,"retry",g);return o(v.url,v.options)};return Object.defineProperty(h,a2,{value:{fetch:o,credentials:s,credentialResolutions:n,fetchOptions:a}}),h}function u2(e={}){let t=e.core?.fetch,r;typeof t=="function"?r=t:r=(i,o)=>fetch(i,o);let n=typeof t=="object"&&t?t:void 0;return rR({fetch:r,fetchOptions:e.signal?{...n,signal:e.signal}:n,credentials:e.core?.credentials||[],authentications:e.core?.authentications})}function c2(e,t){let r={...e,...t};if(e.headers||t?.headers){let n=new Headers(e.headers);new Headers(t?.headers).forEach((i,o)=>n.set(o,i)),r.headers=n}return r}async function l2(e,t,r,n){let i=[],o=e.options.signal;for(let s of t){let a=f2(e.url);if(!a||!d2(s.origins).includes(a))continue;o?.throwIfAborted();let c=await s.authenticate({url:e.url,options:{...e.options,headers:new Headers(e.options.headers)},reason:r,response:n?{status:n.status,headers:new Headers(n.headers)}:void 0});if(!c||typeof c.url!="string"||!c.options||typeof c.options!="object")throw new Error("Authentication callback returned an invalid request.");e={url:c.url,options:{...c.options,...o?{signal:o}:{}}},i.push(s)}return o?.throwIfAborted(),{...e,credentials:i}}function f2(e){try{let t=new URL(e);return!t.host||t.username||t.password?null:t.origin!=="null"?t.origin:`${t.protocol}//${t.host}`}catch{return null}}function d2(e){if(!e.length)throw new Error("Request authentication requires at least one exact origin.");return e.map(t=>{let r=f2(t),n;try{n=new URL(t)}catch{throw new Error("Invalid request authentication origin.")}if(!r||n.pathname&&n.pathname!=="/"||n.search||n.hash)throw new Error("Invalid request authentication origin.");return r})}async function h2(e,t,r,n=new Map,i=[]){let o=new URL(e),s=new Headers(t.headers),a=[],c=new Map(i.map(({credential:l,token:h})=>[l,h]));for(let l of r){if(!l.origins.includes(o.origin))continue;let h=n.get(l),u=c.get(l),f=l.type==="query-parameter"&&u!==void 0,d=l.type==="header"&&u!==void 0;if(l.type==="query-parameter"&&o.searchParams.has(l.name)&&!f||l.type==="header"&&s.has(l.name)&&!d)continue;let m=h??u??await iR(l.token,{url:e.toString(),reason:"request"});m&&(l.type==="query-parameter"?o.searchParams.set(l.name,m):s.set(l.name,`${l.prefix||""}${m}`),a.push({credential:l,token:m}))}return{url:o.toString(),options:{...t,headers:s},credentials:a}}async function nR(e,t,r){let n=tg.get(e);if(n)return n;let i=e.token,o=Promise.resolve(i({url:t,reason:"refresh",response:{status:r.status,headers:r.headers}})).finally(()=>tg.delete(e));return tg.set(e,o),o}async function iR(e,t){return typeof e=="function"?e(t):e}function oR(e){try{let t=new URL(e);return["http:","https:"].includes(t.protocol)?t:null}catch{return null}}function Tf(e){let t=(e.method||"GET").toUpperCase();return["GET","HEAD","OPTIONS","PUT","DELETE"].includes(t)?!(e.body&&typeof ReadableStream<"u"&&e.body instanceof ReadableStream):!1}var a2,tg,m2=w(()=>{"use strict";J0();a2=Symbol("loaders.gl.authenticated-fetch"),tg=new WeakMap});function sR(e,t){switch((t.type==="response"||t.type==="error")&&t.networkTimeMs!==void 0&&e.get(he.networkTimeMs,"time").addTime(t.networkTimeMs),t.type){case"queued":e.get(he.logicalRanges,"count").incrementCount(),e.get(he.requestedBytes,"count").addCount(t.logicalBytes||0);break;case"batch":e.get(he.rangeBatches,"count").incrementCount(),e.get("Logical Ranges Batched","count").addCount(t.logicalRequestCount||0),e.get(he.transportRanges,"count").addCount(t.transportRequestCount||0),e.get(he.coalescedRanges,"count").addCount(Math.max((t.logicalRequestCount||0)-(t.transportRequestCount||0),0)),e.get(he.transportBytes,"count").addCount(t.transportBytes||0),e.get(he.overfetchBytes,"count").addCount(t.overfetchBytes||0);break;case"response":e.get(he.completedTransportRanges,"count").incrementCount(),e.get(he.responseBytes,"count").addCount(t.responseBytes||0),t.fullResponse&&e.get(he.fullResponseFallbacks,"count").incrementCount();break;case"error":e.get(he.failedTransportRanges,"count").incrementCount();break;case"abort":e.get(he.abortedLogicalRanges,"count").incrementCount();break;default:}}function y2(e="range-request-scheduler"){let t=new Pi({id:e});return w2(t),t}async function aR(e){let t=dR(e.signal),r=uh();try{let n=!1,i=await e.fetch(e.url,p2(e.fetchOptions,e.offset,e.length,t.signal));if(i.status===416&&e.offset===0){let c=uR(i.headers.get("Content-Range"));if(!c)throw new Error("Missing content-length on 416 response");i=await e.fetch(e.url,p2(e.fetchOptions,0,c,t.signal)),n=!0}if(i.status===200)throw t.abort(),await mR(i),new Error("Byte-range request failed: server returned 200 instead of 206");if(i.status!==206&&!i.ok)throw new Error(`Bad response code: ${i.status}`);let o=await i.arrayBuffer(),s=i.headers.get("Content-Range"),a=fR(s);if(s&&!a)throw new Error(`Invalid Content-Range header: ${s}`);if(a){let c=a.endOffset-a.offset+1,l=e.offset+e.length-1;if(a.offset!==e.offset||a.endOffset>l||c!==o.byteLength||a.sourceByteLength!==void 0&&a.endOffset>=a.sourceByteLength)throw new Error(`Content-Range does not match requested range: ${s}`)}return{arrayBuffer:o,status:i.status,sourceByteLength:a?.sourceByteLength,transportBytes:o.byteLength,networkTimeMs:uh()-r,fullResponse:n}}finally{t.removeAbortListener()}}function cR(e,t,r){if(e.sourceId!==t.sourceId||e.isolationKey!==(t.isolationKey??t.sourceId))return!1;let n=t.offset+t.length,i=t.offset-e.endOffset,o=Math.max(e.endOffset,n)-e.offset;return i<=r.rangeExpansionBytes&&o<=r.maxMergedBytes}function w2(e){e.get(he.logicalRanges,"count"),e.get(he.requestedBytes,"count"),e.get(he.rangeBatches,"count"),e.get("Logical Ranges Batched","count"),e.get(he.transportRanges,"count"),e.get(he.coalescedRanges,"count"),e.get(he.transportBytes,"count"),e.get(he.completedTransportRanges,"count"),e.get(he.responseBytes,"count"),e.get(he.networkTimeMs,"time"),e.get(he.overfetchBytes,"count"),e.get(he.fullResponseFallbacks,"count"),e.get(he.failedTransportRanges,"count"),e.get(he.abortedLogicalRanges,"count")}function eg(e){return e.reduce((t,r)=>t+r.length,0)}function lR(e){return e instanceof ArrayBuffer?{arrayBuffer:e}:e}function p2(e,t,r,n){return{...e,signal:n,headers:{...hR(e?.headers),Range:`bytes=${t}-${t+r-1}`}}}function hR(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):e:{}}function uR(e){let t=e?.match(/^bytes \*\/(\d+)$/);return t?Number(t[1]):null}function fR(e){let t=e?.match(/^bytes (\d+)-(\d+)\/(\d+|\*)$/);if(!t)return null;let r=Number(t[1]),n=Number(t[2]),i=t[3]==="*"?void 0:Number(t[3]);return!Number.isSafeInteger(r)||!Number.isSafeInteger(n)||r>n||i!==void 0&&!Number.isSafeInteger(i)?null:{offset:r,endOffset:n,sourceByteLength:i}}function dR(e){let t=new AbortController,r=()=>t.abort(e?.reason);return e?.aborted?t.abort(e?.reason):e?.addEventListener("abort",r,{once:!0}),{signal:t.signal,abort:()=>t.abort(),removeAbortListener:()=>e?.removeEventListener("abort",r)}}async function mR(e){await e.body?.cancel().catch(()=>{})}function uh(){return globalThis.performance?.now()??Date.now()}function g2(){if(typeof DOMException<"u")return new DOMException("Request aborted","AbortError");let e=new Error("Request aborted");return e.name="AbortError",e}var he,If,Af,_2=w(()=>{"use strict";Ef();he={logicalRanges:"Logical Range Requests",rangeBatches:"Range Request Batches",transportRanges:"Transport Ranges Created",completedTransportRanges:"Range Transport Requests Completed",coalescedRanges:"Coalesced Logical Ranges",requestedBytes:"Logical Range Request Bytes",transportBytes:"Range Transport Bytes Requested",responseBytes:"Range Response Bytes",networkTimeMs:"Range Network Time",overfetchBytes:"Range Overfetch Bytes",failedTransportRanges:"Range Transport Requests Failed",abortedLogicalRanges:"Aborted Logical Range Requests",fullResponseFallbacks:"Full Response Fallbacks"},If={batchDelayMs:50,maxGapBytes:65536,rangeExpansionBytes:65536,maxMergedBytes:8388608,maxConcurrency:6,maxQueueSize:4096,maxRangeBytes:64*1024*1024,maxTotalBytes:Number.MAX_SAFE_INTEGER,stats:y2("range-request-scheduler-default"),onEvent:()=>{}},Af=class{props;stats;onEvent;pendingRequests=[];transportQueue=[];activeTransports=0;reservedTransportBytes=0;queuedRequests=0;logicalRequests=new Set;transportControllers=new Set;finalized=!1;flushTimer=null;constructor(t={}){let r=t.rangeExpansionBytes??t.maxGapBytes??If.rangeExpansionBytes;this.props={batchDelayMs:t.batchDelayMs??If.batchDelayMs,maxGapBytes:t.maxGapBytes??r,rangeExpansionBytes:r,maxMergedBytes:t.maxMergedBytes??If.maxMergedBytes,maxConcurrency:t.maxConcurrency??6,maxQueueSize:t.maxQueueSize??4096,maxRangeBytes:t.maxRangeBytes??64*1024*1024,maxTotalBytes:t.maxTotalBytes??If.maxTotalBytes};for(let n of[this.props.maxConcurrency,this.props.maxQueueSize,this.props.maxRangeBytes,this.props.maxTotalBytes])if(!Number.isSafeInteger(n)||n<=0)throw new Error("Range scheduler limits must be positive integers");this.stats=t.stats||y2("range-request-scheduler"),this.onEvent=t.onEvent,w2(this.stats)}scheduleRequest(t){if(this.finalized)return Promise.reject(new Error("Range scheduler is finalized"));if(!Number.isSafeInteger(t.offset)||t.offset<0||!Number.isSafeInteger(t.length)||t.length>this.props.maxRangeBytes||!Number.isSafeInteger(t.offset+t.length))return Promise.reject(new Error("Invalid or oversized byte range"));if(this.queuedRequests>=this.props.maxQueueSize)return Promise.reject(new Error("Range scheduler queue limit exceeded"));if(t.length<0)return Promise.reject(new Error("Byte range length cannot be negative"));if(t.signal?.aborted)return Promise.reject(t.signal.reason??g2());if(t.length===0)return Promise.resolve(new ArrayBuffer(0));this.queuedRequests++;let r,n=new Promise((i,o)=>{r={...t,resolve:i,reject:o,settled:!1},this.logicalRequests.add(r),t.signal&&(r.abortListener=()=>{this.abortRequest(r),r.onAbort?.()},t.signal.addEventListener("abort",r.abortListener,{once:!0})),this.pendingRequests.push(r)});return this.trackEvent({type:"queued",sourceId:t.sourceId,offset:t.offset,length:t.length,logicalRequestCount:1,logicalBytes:t.length}),this.scheduleFlush(),n.finally(()=>{r.abortListener&&t.signal?.removeEventListener("abort",r.abortListener),this.queuedRequests--,this.logicalRequests.delete(r)})}fetch(t){let r=t.fetch||globalThis.fetch;return this.scheduleRequest({sourceId:t.sourceId||t.url,offset:t.offset,length:t.length,signal:t.signal,isolationKey:t.isolationKey??{},fetchRange:(n,i,o)=>aR({url:t.url,offset:n,length:i,signal:o,fetch:r,fetchOptions:t.fetchOptions})})}flush(){this.flushTimer!==null&&(clearTimeout(this.flushTimer),this.flushTimer=null);let t=this.pendingRequests;this.pendingRequests=[];let r=t.filter(i=>i.settled||i.signal?.aborted?(this.abortRequest(i),!1):!0),n=this.mergeRequests(r);r.length>0&&this.trackBatch(r,n),this.transportQueue.push(...n),this.startQueuedTransports()}finalize(){this.finalized=!0,this.flushTimer!==null&&clearTimeout(this.flushTimer),this.flushTimer=null;for(let t of this.logicalRequests)this.abortRequest(t),t.abortListener&&t.signal?.removeEventListener("abort",t.abortListener);for(let t of this.transportControllers)t.abort();this.transportQueue=[],this.pendingRequests=[],this.logicalRequests.clear()}startQueuedTransports(){for(;this.activeTransports<this.props.maxConcurrency&&this.transportQueue.length;){let t=this.transportQueue.shift();this.activeTransports++,this.fetchMergedRequest(t).finally(()=>{this.activeTransports--,this.startQueuedTransports()})}}scheduleFlush(){this.flushTimer===null&&(this.flushTimer=setTimeout(()=>this.flush(),this.props.batchDelayMs))}mergeRequests(t){t.sort((n,i)=>n.sourceId!==i.sourceId?n.sourceId<i.sourceId?-1:1:n.offset-i.offset);let r=[];for(let n of t){let i=n.offset+n.length,o=r[r.length-1];o&&cR(o,n,this.props)?(o.endOffset=Math.max(o.endOffset,i),o.requests.push(n)):r.push({sourceId:n.sourceId,isolationKey:n.isolationKey??n.sourceId,offset:n.offset,endOffset:i,fetchRange:n.fetchRange,requests:[n]})}return r}async fetchMergedRequest(t){let{offset:r,endOffset:n,fetchRange:i,requests:o}=t,s=new AbortController;this.transportControllers.add(s);let a=uh(),c=()=>{o.every(l=>l.settled||l.signal?.aborted)&&s.abort()};try{for(let g of o)g.onAbort=c;if(c(),o.every(g=>g.settled))return;let l=eg(o),h=n-r;if(h>this.props.maxTotalBytes-this.reservedTransportBytes)throw new RangeError("Range request total byte limit exceeded");this.reservedTransportBytes+=h,this.trackEvent({type:"request",sourceId:t.sourceId,offset:r,length:h,logicalRequestCount:o.length,logicalBytes:l,transportBytes:h,overfetchBytes:Math.max(h-l,0)});let u=lR(await i(r,h,s.signal)),{arrayBuffer:f}=u,d=u.fullResponse&&r===0&&f.byteLength<h,m=f.byteLength<h&&Number.isSafeInteger(u.sourceByteLength)&&r+f.byteLength===u.sourceByteLength;if(f.byteLength!==h&&!d&&!m)throw new Error(`Byte-range transport returned ${f.byteLength} bytes; expected ${h}`);let p=u.networkTimeMs??uh()-a;this.trackEvent({type:"response",sourceId:t.sourceId,offset:r,length:h,logicalRequestCount:o.length,logicalBytes:l,transportBytes:h,responseBytes:u.transportBytes??f.byteLength,networkTimeMs:p,overfetchBytes:Math.max(h-l,0),status:u.status,fullResponse:u.fullResponse});for(let g of o){if(g.settled)continue;let y=g.offset-r;g.settled=!0,g.resolve(f.slice(y,y+g.length))}}catch(l){s.signal.aborted||this.trackEvent({type:"error",sourceId:t.sourceId,offset:r,length:n-r,logicalRequestCount:o.length,logicalBytes:eg(o),networkTimeMs:uh()-a,error:l});for(let h of o)h.settled||(h.signal?.aborted?this.abortRequest(h):(h.settled=!0,h.reject(l)))}finally{this.transportControllers.delete(s);for(let l of o)l.abortListener&&l.signal?.removeEventListener("abort",l.abortListener),l.onAbort=void 0}}abortRequest(t){if(!t.settled){t.settled=!0,this.pendingRequests=this.pendingRequests.filter(r=>r!==t);for(let r of this.transportQueue)r.requests=r.requests.filter(n=>!n.settled),r.requests.length&&(r.offset=Math.min(...r.requests.map(n=>n.offset)),r.endOffset=Math.max(...r.requests.map(n=>n.offset+n.length)));this.transportQueue=this.transportQueue.filter(r=>r.requests.length>0),t.reject(t.signal?.reason??g2()),this.trackEvent({type:"abort",sourceId:t.sourceId,offset:t.offset,length:t.length,logicalRequestCount:1,logicalBytes:t.length})}}trackEvent(t){sR(this.stats,t);try{this.onEvent?.(t)}catch{}}trackBatch(t,r){let n=eg(t),i=r.reduce((o,s)=>o+s.endOffset-s.offset,0);this.trackEvent({type:"batch",logicalRequestCount:t.length,transportRequestCount:r.length,logicalBytes:n,transportBytes:i,overfetchBytes:Math.max(i-n,0)})}}});function b2(e){for(let t in M2)if(e.startsWith(t)){let r=M2[t];e=e.replace(t,r)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${pR}${e}`),e}var pR,M2,x2=w(()=>{"use strict";pR="",M2={}});function S2(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=globalThis.location?.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}var v2=w(()=>{"use strict"});var gn={};Zr(gn,{dirname:()=>yR,filename:()=>gR,join:()=>wR,resolve:()=>_R});function gR(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):e}function yR(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function wR(...e){return e=e.map((r,n)=>(n&&(r=r.replace(new RegExp("^/"),"")),n!==e.length-1&&(r=r.replace(new RegExp("/$"),"")),r)),e.join("/")}function _R(...e){let t=[];for(let o=0;o<e.length;o++)t[o]=e[o];let r="",n=!1,i;for(let o=t.length-1;o>=-1&&!n;o--){let s;o>=0?s=t[o]:(i===void 0&&(i=S2()),s=i),s.length!==0&&(r=`${s}/${r}`,n=s.charCodeAt(0)===fh)}return r=MR(r,!n),n?`/${r}`:r.length>0?r:"."}function MR(e,t){let r="",n=-1,i=0,o,s=!1;for(let a=0;a<=e.length;++a){if(a<e.length)o=e.charCodeAt(a);else{if(o===fh)break;o=fh}if(o===fh){if(!(n===a-1||i===1))if(n!==a-1&&i===2){if(r.length<2||!s||r.charCodeAt(r.length-1)!==rg||r.charCodeAt(r.length-2)!==rg){if(r.length>2){let c=r.length-1,l=c;for(;l>=0&&r.charCodeAt(l)!==fh;--l);if(l!==c){r=l===-1?"":r.slice(0,l),n=a,i=0,s=!1;continue}}else if(r.length===2||r.length===1){r="",n=a,i=0,s=!1;continue}}t&&(r.length>0?r+="/..":r="..",s=!0)}else{let c=e.slice(n+1,a);r.length>0?r+=`/${c}`:r=c,s=!1}n=a,i=0}else o===rg&&i!==-1?++i:i=-1}return r}var fh,rg,E2=w(()=>{"use strict";v2();fh=47,rg=46});var Ic,T2=w(()=>{"use strict";Ic=class{handle;size;bigsize;url;constructor(t){this.handle=t instanceof ArrayBuffer?new Blob([t]):t,this.size=t instanceof ArrayBuffer?t.byteLength:t.size,this.bigsize=BigInt(this.size),this.url=t instanceof File?t.name:""}async close(){}async stat(){return{size:this.handle.size,bigsize:BigInt(this.handle.size),isDirectory:!1}}async read(t,r,n){if(n?.aborted)throw new Error("Request aborted");let i=await this.handle.slice(Number(t),Number(t)+Number(r)).arrayBuffer();if(n?.aborted)throw new Error("Request aborted");return i}}});function I2(e,t){return t?t.aborted?(e.catch(()=>{}),Promise.reject(t.reason)):new Promise((r,n)=>{let i=()=>{t.removeEventListener("abort",i),n(t.reason)};t.addEventListener("abort",i,{once:!0}),e.then(o=>{t.removeEventListener("abort",i),r(o)},o=>{t.removeEventListener("abort",i),n(o)})}):e}var A2=w(()=>{"use strict"});function bR(e,t,r,n){let i=new Headers(e?.headers);return i.set("Range",`bytes=${t}-${t+r-1}`),{...e,method:"GET",body:void 0,headers:i,signal:n}}function xR(e,t,r,n){return e.status===416&&n===null&&t===0&&r===1&&/^bytes \*\/0$/i.test(e.headers.get("Content-Range")||"")}async function SR(e){try{return vR(e.headers.get("Content-Range"))}catch(t){throw await Ac(e),t}}function vR(e){let t=e?.match(/^bytes (\d+)-(\d+)\/(\d+)$/);if(!t)throw new Error("HTTP byte-range response has an invalid Content-Range header");return{offset:Number(t[1]),endOffset:Number(t[2]),byteLength:Number(t[3])}}function Pf(e,t){return Nf(t,Of(e.headers.get("ETag")),Of(e.headers.get("Last-Modified")))}function P2(e,t,r){return e||Nf(t.byteLength,t.etag??r.etag,t.lastModified??r.lastModified)}function ER(e,t,r){return!Number.isSafeInteger(e.offset)||!Number.isSafeInteger(e.endOffset)||!Number.isSafeInteger(e.byteLength)||e.offset<0||e.endOffset<e.offset||e.endOffset>=e.byteLength?"HTTP byte-range response has invalid range bounds":e.offset!==t||e.endOffset!==t+r-1?"HTTP byte-range response does not match the requested range":null}function ng(e,t,r,n){let i=e?.byteLength??r.byteLength;if(i!==void 0&&t.byteLength!==i)return"HTTP file length changed while the file was open";let o=e?.etag??r.etag,s=e?.lastModified??r.lastModified;return o?t.etag?o===t.etag?null:"HTTP file ETag changed while the file was open":n==="strict"?"HTTP byte-range response is missing the pinned ETag":s&&t.lastModified&&s!==t.lastModified?"HTTP file Last-Modified value changed while the file was open":null:s?t.lastModified&&s!==t.lastModified?"HTTP file Last-Modified value changed while the file was open":n==="strict"&&!t.lastModified?"HTTP byte-range response is missing the pinned Last-Modified value":null:n==="strict"&&!t.etag&&!t.lastModified?"HTTP byte-range response does not provide an ETag or Last-Modified validator":null}function Nf(e,t,r){return Object.freeze({byteLength:e,etag:t,lastModified:r})}function TR(e){if(e!==void 0&&(!Number.isSafeInteger(e)||e<0))throw new Error("HttpFile byteLength must be a non-negative safe integer")}async function Ac(e){await e.body?.cancel().catch(()=>{})}function Of(e){return e||void 0}function Rf(){return globalThis.performance?.now()??Date.now()}function R2(e){return e instanceof Error&&e.name==="AbortError"||e instanceof Error&&/aborted/i.test(e.message)}function IR(...e){let t=new AbortController,r=[...new Set(e.filter(i=>!!i))],n=()=>t.abort();for(let i of r)i.aborted?t.abort():i.addEventListener("abort",n,{once:!0});return{signal:t.signal,removeAbortListeners:()=>{for(let i of r)i.removeEventListener("abort",n)}}}var Cf,C2=w(()=>{"use strict";Cf=class{url;fetchFunction;fetchOptions;consistency;identityHints;countedFailures=new WeakSet;onTelemetry;telemetry={requestedBytes:0,downloadedBytes:0,requestCount:0,networkTimeMs:0,abortCount:0,errorCount:0};constructor(t,r){TR(r.byteLength),this.url=t,this.onTelemetry=r.onTelemetry,this.fetchFunction=r.fetch||((n,i)=>globalThis.fetch(n,i)),this.fetchOptions=r.fetchOptions?{...r.fetchOptions,headers:new Headers(r.fetchOptions.headers)}:void 0,this.consistency=r.consistency||"best-effort",this.identityHints={byteLength:r.byteLength,etag:Of(r.etag),lastModified:Of(r.lastModified)}}getInitialIdentity(){let{byteLength:t,etag:r,lastModified:n}=this.identityHints;return t!==void 0&&(r!==void 0||n!==void 0)?Nf(t,r,n):t===0&&this.consistency==="best-effort"?Nf(0):null}getTelemetry(){return Object.freeze({...this.telemetry})}trackFailure(t){if(typeof t=="object"&&t!==null){if(this.countedFailures.has(t))return;this.countedFailures.add(t)}R2(t)?this.telemetry.abortCount++:this.telemetry.errorCount++,this.onTelemetry?.(this.getTelemetry(),t)}async requestRange(t,r,n,i){let o=Rf(),s=IR(n,this.fetchOptions?.signal);this.telemetry.requestCount++,this.telemetry.requestedBytes+=r;try{let a=await this.fetchFunction(this.url,bR(this.fetchOptions,t,r,s.signal));if(xR(a,t,r,i))return await this.readEmptyIdentityProbe(a,o);if(a.status!==206)throw await Ac(a),new Error(`HTTP byte-range request expected 206, received ${a.status}`);let c=a.headers.has("Content-Range")?await SR(a):await this.inferContentRange(a,t,r,i,s.signal),l=Pf(a,c.byteLength),h=ng(i,l,this.identityHints,this.consistency)||ER(c,t,r);if(h)throw await Ac(a),new Error(h);let u=await a.arrayBuffer();if(this.telemetry.downloadedBytes+=u.byteLength,u.byteLength!==r)throw new Error(`HTTP byte-range response contained ${u.byteLength} bytes; expected ${r}`);return{arrayBuffer:u,identity:P2(i,l,this.identityHints),status:a.status,transportBytes:u.byteLength,networkTimeMs:Rf()-o}}catch(a){throw(i===null||!R2(a))&&this.trackFailure(a),a}finally{s.removeAbortListeners(),this.telemetry.networkTimeMs+=Rf()-o,this.onTelemetry?.(this.getTelemetry())}}async inferContentRange(t,r,n,i,o){try{let s=i?.byteLength??this.identityHints.byteLength;if(s===void 0){let a=new Headers(this.fetchOptions?.headers);a.delete("Range"),this.telemetry.requestCount++;let c=await this.fetchFunction(this.url,{...this.fetchOptions,method:"HEAD",body:void 0,headers:a,signal:o});await Ac(c);let l=c.headers.get("Content-Length");if(s=l&&/^\d+$/.test(l)?Number(l):NaN,c.status!==200||!Number.isSafeInteger(s)||s<r+n)throw new Error("HTTP byte-range response is missing Content-Range and HEAD did not provide a valid file length");let h=ng(Pf(c,s),Pf(t,s),this.identityHints,this.consistency);if(h)throw new Error(h)}return{offset:r,endOffset:r+n-1,byteLength:s}}catch(s){throw await Ac(t),s}}async readEmptyIdentityProbe(t,r){let n=Pf(t,0),i=ng(null,n,this.identityHints,this.consistency);if(await Ac(t),i)throw new Error(i);return{arrayBuffer:new ArrayBuffer(0),identity:P2(null,n,this.identityHints),status:t.status,transportBytes:0,networkTimeMs:Rf()-r}}}});function AR(e,t,r){let n=new Headers;return r>0&&e&&n.set("Content-Range",`bytes ${t}-${t+r-1}/${e.byteLength}`),e?.etag&&n.set("ETag",e.etag),e?.lastModified&&n.set("Last-Modified",e.lastModified),n}function N2(e){let t=Number(e);if(!Number.isSafeInteger(t)||t<0)throw new Error("HTTP byte-range offset must be a non-negative safe integer");return t}function PR(e,t,r){if(!Number.isSafeInteger(t)||t<0)throw new Error("HTTP byte-range length must be a non-negative safe integer");if(e+t>r)throw new Error("HTTP byte range extends beyond the end of the file")}function O2(){if(typeof DOMException<"u")return new DOMException("Request aborted","AbortError");let e=new Error("Request aborted");return e.name="AbortError",e}var dh,B2=w(()=>{"use strict";A2();_2();C2();dh=class e{handle;url;transport;rangeScheduler;schedulerIsolationKey={};suppliedByteLength;identity;openPromise=null;closed=!1;constructor(t,r={}){this.handle=t,this.url=t,this.transport=new Cf(t,r),this.rangeScheduler=r.rangeScheduler||new Af({batchDelayMs:0,...r.rangeSchedulerProps}),this.suppliedByteLength=r.byteLength,this.identity=this.transport.getInitialIdentity()}static async open(t,r={},n){let i=new e(t,r);return await i.open(n),i}async open(t){if(this.assertOpen(),t?.aborted){let r=O2();throw this.transport.trackFailure(r),r}return await this.getIdentity(t),this}get size(){return this.identity?.byteLength??this.suppliedByteLength??0}get bigsize(){return BigInt(this.size)}getIdentitySnapshot(){return this.identity}getTelemetry(){return this.transport.getTelemetry()}async close(){this.closed=!0}async stat(){this.assertOpen();let t=await this.getIdentity();return{size:t.byteLength,bigsize:BigInt(t.byteLength),isDirectory:!1}}async read(t=0,r=0,n){if(this.assertOpen(),n?.aborted){let s=O2();throw this.transport.trackFailure(s),s}let i=await this.getIdentity(n),o=N2(t);if(PR(o,r,i.byteLength),r===0)return new ArrayBuffer(0);try{return await this.rangeScheduler.scheduleRequest({sourceId:this.url,isolationKey:this.schedulerIsolationKey,offset:o,length:r,signal:n,fetchRange:this.fetchScheduledRange})}catch(s){throw this.transport.trackFailure(s),s}}async fetchRange(t,r,n){let i=N2(t),o=await this.read(i,r,n),s=AR(this.identity,i,r);return new Response(o,{status:206,headers:s})}fetchScheduledRange=async(t,r,n)=>{let i=await this.getIdentity(n),o=await this.transport.requestRange(t,r,n,i);return{arrayBuffer:o.arrayBuffer,status:o.status,transportBytes:o.transportBytes,networkTimeMs:o.networkTimeMs}};getIdentity(t){if(this.identity)return Promise.resolve(this.identity);if(!this.openPromise){let n=this.probeIdentity().catch(i=>{throw this.openPromise===n&&(this.openPromise=null),i});this.openPromise=n}return I2(this.openPromise,t).catch(r=>{throw this.transport.trackFailure(r),r})}async probeIdentity(){try{let t=await this.transport.requestRange(0,1,void 0,null);return this.identity=t.identity,t.identity}catch(t){throw this.transport.trackFailure(t),t}}assertOpen(){if(this.closed)throw new Error("HttpFile is closed")}}});function L2(e){return u2(e)}function D2(e){if(e.loadOptions!==void 0||e.core?.loadOptions!==void 0)throw new Error("Source loadOptions and core.loadOptions were removed. Use core and root loader namespaces directly.");let t={...e};if(e?.core){t.core={...e.core};let r=t.core;for(let n of["type","name","attributions","loaders","onError","loadOptions"])delete r[n];Object.keys(r).length===0&&delete t.core}return t}function CR(e,t){return e instanceof Error?e:typeof e=="string"?new Error(e):new Error(t)}function da(e){return()=>{throw new Error(`CoreAPI.${e} is unavailable. Use @loaders.gl/core.createDataSourceSync().`)}}function NR(e,t){let r=t.core?.name;if(r!==void 0){if(typeof r!="string"||!r.trim())throw new Error("Data source name must be a non-empty string.");return r}if(e&&typeof e=="object"){let n=e;if(typeof n.name=="string"&&n.name.trim())return e instanceof Blob?F2(n.name):n.name;let i=n.schema?.metadata,o=i instanceof Map?i.get("name"):i?.name;if(typeof o=="string"&&o.trim())return o}if(typeof e=="string")try{let n=new URL(e.replace(/\\/g,"/"),"https://source.invalid/");if(!["data:","blob:"].includes(n.protocol)){let i=n.pathname.split("/").filter(Boolean).pop();if(i){try{i=decodeURIComponent(i)}catch{}return F2(i)}}}catch{}return t.core?.type&&t.core.type!=="auto"?t.core.type:"source"}function F2(e){let t=e.lastIndexOf(".");return t>0?e.slice(0,t):e}var RR,mh,U2=w(()=>{"use strict";t2();x2();H0();m2();J0();RR={fetchFile:da("fetchFile"),parse:da("parse"),parseFile:da("parseFile"),parseSync:da("parseSync"),parseInBatches:da("parseInBatches"),load:da("load"),loadInBatches:da("loadInBatches")},mh=class e{static defaultOptions={core:{type:"auto",attributions:[],loaders:[],onError:void 0}};optionsType;options;data;url;name;loadOptions;fetch;coreApi;hasCoreApi;_needsRefresh=!0;constructor(t,r,n,i){this.options=Sf(Sf(e.defaultOptions,n||{}),r),this.data=t,this.url=typeof t=="string"?b2(t):"",this.name=NR(t,this.options);let o=Z0(D2(this.options));this.loadOptions=o;let s=L2(o);this.coreApi=i||RR,this.hasCoreApi=!!i,this.fetch=s}setProps(t){if(t.core?.name!==void 0&&t.core.name!==this.name)throw new Error("Data source names are fixed at creation.");let r=Sf(this.options,t),n=Z0(D2(r));this.options=r,this.loadOptions=n,this.fetch=L2(n),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let r=this._needsRefresh;return t&&(this._needsRefresh=!1),r}reportError(t,r){let n=CR(t,r),i=this.options.core?.onError;return i?i(n,this):W0(this.options).warn(`${this.constructor.name}: ${n.message}`)(),n}}});function Bf(e={}){if(e.coordinateEpoch!==void 0&&!Number.isFinite(e.coordinateEpoch))throw new Error("Spatial reference coordinate epoch must be a finite decimal year");return Object.freeze({crs:G2(e.crs||{state:"absent",provenance:"unknown"}),vertical:e.vertical?G2(e.vertical):void 0,coordinateEpoch:e.coordinateEpoch,coordinateFrame:e.coordinateFrame||"unknown",coordinateOrder:Object.freeze([...e.coordinateOrder||[]]),units:e.units?Object.freeze([...e.units]):void 0})}function tr(e){if(typeof e=="object")return"projjson";let t=e.trim();return/^[A-Z][A-Z0-9_]*\s*[\[(]/i.test(t)?"wkt":/(?:^|\s)\+?proj=/i.test(t)?"proj-string":/^[A-Z][A-Z0-9._-]*(?::[A-Z0-9._-]+)+$/i.test(t)||/^urn:ogc:def:crs:/i.test(t)||/^https?:\/\//i.test(t)||/^[A-Z][A-Z0-9._-]*$/i.test(t)?"identifier":"opaque"}function G2(e){return e.state==="explicit"||e.state==="default"?Object.freeze({...e,definition:z2(e.definition),alternatives:e.alternatives?Object.freeze(e.alternatives.map(t=>Object.freeze({...t,definition:z2(t.definition)}))):void 0}):Object.freeze({...e})}function z2(e){return typeof e=="string"?e:ig(e)}function ig(e){return Array.isArray(e)?Object.freeze(e.map(t=>ig(t))):e&&typeof e=="object"?Object.freeze(Object.fromEntries(Object.entries(e).map(([t,r])=>[t,ig(r)]))):e}var Pc=w(()=>{});function gh(e,t){let n={type:"wkt-crs",root:new og(e).parse()};if(t?.strict){let i=j2(n,{profile:t.profile,allowExtensions:!1});if(i.length>0)throw new Df(i)}return n}function j2(e,t){if(!e||e.type!=="wkt-crs"||e.root?.type!=="node")throw new TypeError("validateWKTCRS expects a WKTCRSAst");let r=qR(e.root.keyword,t?.profile||"auto"),n=VR[r],i=kR[r],o=[],s=e.root.keyword.toUpperCase();return n.has(s)||o.push({code:"invalid-root",message:`${e.root.keyword} is not a ${r} root keyword`,path:[],keyword:e.root.keyword}),W2(e.root,[],a=>{let c=a.node.keyword.toUpperCase();!t?.allowExtensions&&!i.has(c)&&o.push({code:"unknown-keyword",message:`${a.node.keyword} is not defined by the ${r} profile`,path:a.path,keyword:a.node.keyword}),a.node.values.length===0&&o.push({code:"empty-node",message:`${a.node.keyword} must contain at least one value`,path:a.path,keyword:a.node.keyword});let l=jR(a.node);l&&o.push({code:"invalid-value",message:l,path:a.path,keyword:a.node.keyword})}),o}function qR(e,t){return t!=="auto"?t:ph.has(e.toUpperCase())?"wkt1":"wkt2:2019"}function jR(e){let t=e.keyword.toUpperCase(),r=e.values,n=(o,...s)=>!!(r[o]&&s.includes(r[o].type)),i=(o,...s)=>r.length===o&&s.every((a,c)=>n(c,a));if(["ANGLEUNIT","LENGTHUNIT","PARAMETRICUNIT","SCALEUNIT","TIMEUNIT","TEMPORALQUANTITY","UNIT"].includes(t)&&!(r.length>=2&&n(0,"string")&&n(1,"number")))return`${e.keyword} must start with a quoted name and numeric conversion factor`;if(t==="CS"&&!i(2,"enumeration","number"))return`${e.keyword} must contain a coordinate-system type and dimension`;if(t==="BBOX"&&!i(4,"number","number","number","number"))return`${e.keyword} must contain four numeric bounds`;if(["ENSEMBLEACCURACY","EPOCH","COORDEPOCH","FRAMEEPOCH","OPERATIONACCURACY","ORDER"].includes(t)&&!i(1,"number"))return`${e.keyword} must contain one number`;if(["ANCHOR","AREA","CALENDAR","CITATION","REMARK","SCOPE","URI","VERSION"].includes(t)&&!i(1,"string"))return`${e.keyword} must contain one quoted string`;if(["ELLIPSOID","SPHEROID","TRIAXIAL"].includes(t)&&!(r.length>=3&&n(0,"string")&&n(1,"number")&&n(2,"number")))return`${e.keyword} must start with a quoted name and numeric ellipsoid axes`;if(["PARAMETER"].includes(t)&&!(r.length>=2&&n(0,"string")&&n(1,"number")))return`${e.keyword} must start with a quoted name and numeric value`;if(t==="PARAMETERFILE"&&!i(2,"string","string"))return`${e.keyword} must contain a quoted name and file name`;if(["AUTHORITY","ID"].includes(t)&&!(r.length>=2&&n(0,"string")&&n(1,"string","number")))return`${e.keyword} must start with a quoted authority and identifier`;if(["AXIS"].includes(t)&&!(r.length>=2&&n(0,"string")&&n(1,"enumeration")))return`${e.keyword} must start with a quoted name and axis direction`;if(["METHOD","PROJECTION"].includes(t)&&!(r.length>=1&&n(0,"string")))return`${e.keyword} must start with a quoted name`;if(t==="TIMEEXTENT"){let o=s=>n(s,"enumeration","string");if(r.length!==2||!o(0)||!o(1))return`${e.keyword} must contain two date-time or quoted values`}if(t==="VERTICALEXTENT"&&(r.length<2||r.length>3||!n(0,"number")||!n(1,"number")||r.length===3&&!n(2,"node")))return`${e.keyword} must contain two numeric bounds and an optional unit`;if(t==="COORDINATEMETADATA"&&(r.length<1||r.length>2||!n(0,"node")||r.length===2&&(!n(1,"node")||!["EPOCH","COORDEPOCH"].includes(r[1].keyword.toUpperCase()))))return`${e.keyword} must contain a CRS and an optional coordinate epoch`;if(t==="BOUNDCRS"){let o=r.slice(0,3).map(s=>s.type==="node"?s.keyword.toUpperCase():"");if(o[0]!=="SOURCECRS"||o[1]!=="TARGETCRS"||o[2]!=="ABRIDGEDTRANSFORMATION")return`${e.keyword} must start with SOURCECRS, TARGETCRS, and ABRIDGEDTRANSFORMATION`}return["COMPOUNDCRS","CONCATENATEDOPERATION","COORDINATEOPERATION","DERIVEDPROJCRS","ENGCRS","ENGINEERINGCRS","GEODCRS","GEODETICCRS","GEOGCRS","GEOGRAPHICCRS","PARAMETRICCRS","POINTMOTIONOPERATION","PROJCRS","PROJECTEDCRS","TIMECRS","VERTCRS","VERTICALCRS"].includes(t)&&!n(0,"string")?`${e.keyword} must start with a quoted name`:null}function W2(e,t,r){r({node:e,path:t});for(let n=0;n<e.values.length;n++){let i=e.values[n];i.type==="node"&&W2(i,[...t,n],r)}}function WR(e,t){let r=1,n=1;for(let i=0;i<t&&i<e.length;i++)e[i]===`
8
- `?(r++,n=1):n++;return{line:r,column:n}}var Lf,Df,OR,BR,ph,sg,LR,DR,FR,UR,V2,k2,q2,GR,zR,VR,kR,og,ag=w(()=>{Lf=class extends SyntaxError{constructor(t,r,n){let i=WR(r,n);super(`${t} at ${i.line}:${i.column}`),this.name="WKTCRSSyntaxError",this.offset=n,this.line=i.line,this.column=i.column}},Df=class extends Error{constructor(t){super(t[0]?.message||"WKT validation failed"),this.name="WKTCRSValidationError",this.issues=t}},OR=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[Ee][+-]?\d+)?$/,BR=/^[A-Za-z][A-Za-z0-9_]*/,ph=new Set(["COMPD_CS","CONCAT_MT","FITTED_CS","GEOCCS","GEOGCS","INVERSE_MT","LOCAL_CS","PARAM_MT","PASSTHROUGH_MT","PROJCS","VERT_CS"]),sg=new Set([...ph,"AUTHORITY","AXIS","CONCAT_MT","DATUM","INVERSE_MT","LOCAL_DATUM","PARAMETER","PARAM_MT","PASSTHROUGH_MT","PRIMEM","PROJECTION","SPHEROID","TOWGS84","UNIT","VERT_DATUM"]),LR=new Set(ph),DR=new Set([...sg,"EXTENSION"]),FR=new Set([...ph,"COMPDCS","LOCALCS","VERTCS"]),UR=new Set([...sg,"COMPDCS","LOCALCS","VDATUM","VERTCS"]),V2=new Set(["BOUNDCRS","COMPOUNDCRS","COORDINATEOPERATION","ENGCRS","ENGINEERINGCRS","GEODCRS","GEODETICCRS","PARAMETRICCRS","PROJCRS","PROJECTEDCRS","TIMECRS","VERTCRS","VERTICALCRS"]),k2=new Set([...V2,"CONCATENATEDOPERATION","COORDINATEMETADATA","DERIVEDPROJCRS","GEOGCRS","GEOGRAPHICCRS","POINTMOTIONOPERATION"]),q2=new Set([...k2,"ABRIDGEDTRANSFORMATION","ANCHOR","ANGLEUNIT","AREA","AXIS","BASEENGCRS","BASEGEODCRS","BASEGEOGCRS","BASEPARAMCRS","BASEPROJCRS","BASETIMECRS","BASEVERTCRS","BBOX","BEARING","CALENDAR","CITATION","CONVERSION","COORDEPOCH","CS","DATUM","DERIVINGCONVERSION","DYNAMIC","EDATUM","ELLIPSOID","ENGINEERINGDATUM","ENSEMBLE","ENSEMBLEACCURACY","EPOCH","FRAMEEPOCH","GEODETICDATUM","GEOIDMODEL","ID","INTERPOLATIONCRS","LENGTHUNIT","MEMBER","MERIDIAN","METHOD","MODEL","OPERATIONACCURACY","ORDER","PARAMETER","PARAMETERFILE","PARAMETRICDATUM","PARAMETRICUNIT","PDATUM","PRIMEM","PRIMEMERIDIAN","REMARK","SCALEUNIT","SCOPE","SOURCECRS","STEP","TARGETCRS","TDATUM","TEMPORALQUANTITY","TIMEEXTENT","TIMEORIGIN","TIMEUNIT","TIMEDATUM","TRIAXIAL","TRF","URI","USAGE","VDATUM","VERSION","VERTICALDATUM","VERTICALEXTENT","VELOCITYGRID","VRF"]),GR=new Set(["BASEGEOGCRS","CALENDAR","CONCATENATEDOPERATION","COORDEPOCH","COORDINATEMETADATA","DERIVEDPROJCRS","DYNAMIC","ENSEMBLE","ENSEMBLEACCURACY","EPOCH","FRAMEEPOCH","GEOGCRS","GEOGRAPHICCRS","GEOIDMODEL","MEMBER","MODEL","POINTMOTIONOPERATION","STEP","TEMPORALQUANTITY","TRF","TRIAXIAL","VELOCITYGRID","VRF"]),zR=new Set([...q2].filter(e=>!GR.has(e))),VR={wkt1:ph,gdal:LR,esri:FR,"wkt2:2015":V2,"wkt2:2019":k2},kR={wkt1:sg,gdal:DR,esri:UR,"wkt2:2015":zR,"wkt2:2019":q2};og=class{constructor(t){this.offset=0,this.source=t}parse(){this.skipWhitespace();let t=this.parseNode();return this.skipWhitespace(),this.offset!==this.source.length&&this.fail("Unexpected content after WKT root"),t}parseNode(){let t=this.parseKeyword();return this.parseNodeAfterKeyword(t)}parseNodeAfterKeyword(t){this.skipWhitespace();let r=this.source[this.offset];r!=="["&&r!=="("&&this.fail(`Expected '[' or '(' after ${t}`),this.offset++;let n=r==="["?"bracket":"parenthesis",i=r==="["?"]":")",o=[];if(this.skipWhitespace(),this.source[this.offset]===i)return this.offset++,{type:"node",keyword:t,delimiter:n,values:o};for(;this.offset<this.source.length;){o.push(this.parseValue()),this.skipWhitespace();let s=this.source[this.offset];if(s===","){this.offset++,this.skipWhitespace(),this.source[this.offset]===i&&this.fail("Expected a WKT value after comma");continue}if(s===i)return this.offset++,{type:"node",keyword:t,delimiter:n,values:o};(s==="]"||s===")")&&this.fail(`Expected '${i}' to close ${t}`),this.fail(`Expected ',' or '${i}' in ${t}`)}this.fail(`Unterminated ${t} node`)}parseValue(){if(this.skipWhitespace(),this.source[this.offset]==='"')return this.parseString();let r=this.offset;for(;this.offset<this.source.length&&!/[\s,\[\]()"]/.test(this.source[this.offset]);)this.offset++;r===this.offset&&this.fail("Expected a WKT value");let n=this.source.slice(r,this.offset);return this.source[this.offset]==='"'&&this.fail("Unexpected quote in unquoted WKT value"),this.skipWhitespace(),this.source[this.offset]==="["||this.source[this.offset]==="("?(/^[A-Za-z][A-Za-z0-9_]*$/.test(n)||this.fail(`Invalid WKT keyword '${n}'`),this.parseNodeAfterKeyword(n)):OR.test(n)?{type:"number",value:Number(n),raw:n}:{type:"enumeration",value:n}}parseKeyword(){let t=this.source.slice(this.offset).match(BR);return t||this.fail("Expected a WKT keyword"),this.offset+=t[0].length,t[0]}parseString(){this.offset++;let t="";for(;this.offset<this.source.length;){let r=this.source[this.offset++];if(r==='"'){if(this.source[this.offset]==='"'){t+='"',this.offset++;continue}return{type:"string",value:t}}t+=r}this.fail("Unterminated WKT string")}skipWhitespace(){for(;this.offset<this.source.length&&/\s/.test(this.source[this.offset]);)this.offset++}fail(t){throw new Lf(t,this.source,this.offset)}}});function yh(e){let t=YR(e);if(t.length===0)throw new Qi("PROJ string is empty",e,0);return{type:"proj-string",parameters:t.map(n=>$R(n.raw,n.offset,e))}}function $R(e,t,r){let n=e.startsWith("+")?e.slice(1):e;if(!n)throw new Qi("Expected a parameter after '+'",r,t);let i=n.indexOf("="),o=i<0?n:n.slice(0,i);if(!o||/[\s+=]/.test(o))throw new Qi(`Invalid PROJ parameter name '${o}'`,r,t);if(i<0)return{type:"parameter",name:o};let s=n.slice(i+1),a=KR(s,r,t+i+1);return{type:"parameter",name:o,value:a,rawValue:s}}function YR(e){let t=[],r=0;for(;r<e.length;){for(;r<e.length&&/\s/.test(e[r]);)r++;if(r>=e.length)break;let n=r,i=null,o=!1;for(;r<e.length;){let s=e[r];if(o){o=!1,r++;continue}if(s==="\\"&&i){o=!0,r++;continue}if(i){s===i&&(i=null),r++;continue}if((s==='"'||s==="'")&&e[r-1]==="="){i=s,r++;continue}if(/\s/.test(s))break;r++}if(i)throw new Qi("Unterminated quoted PROJ value",e,n);t.push({raw:e.slice(n,r),offset:n})}return t}function KR(e,t,r){if(!e)return"";let n=e[0];if(n!=='"'&&n!=="'"){if((e.includes('"')||e.includes("'"))&&!HR.test(e))throw new Qi("Quote must begin a PROJ parameter value",t,r);return e}if(e[e.length-1]!==n)throw new Qi("Unterminated quoted PROJ value",t,r);let i="";for(let o=1;o<e.length-1;o++){let s=e[o];s==="\\"&&o+1<e.length-1?i+=e[++o]:i+=s}return i}function XR(e,t){let r=1,n=1;for(let i=0;i<t&&i<e.length;i++)e[i]===`
9
- `?(r++,n=1):n++;return{line:r,column:n}}var Qi,HR,cg=w(()=>{Qi=class extends SyntaxError{constructor(t,r,n){let i=XR(r,n);super(`${t} at ${i.line}:${i.column}`),this.name="PROJStringSyntaxError",this.offset=n,this.line=i.line,this.column=i.column}};HR=/^[+-]?\d+(?:\.\d*)?d(?:\d+(?:\.\d*)?'(?:\d+(?:\.\d*)?")?)?[NSEW]?$/i});var wh,H2=w(()=>{wh={m:{name:"meters",metersPerUnit:1},mm:{name:"millimeters",metersPerUnit:.001},cm:{name:"centimeters",metersPerUnit:.01},ft:{name:"feet",metersPerUnit:.3048},"us-ft":{name:"us-survey-feet",metersPerUnit:.3048006096012192},fath:{name:"fathoms",metersPerUnit:1.8288},kmi:{name:"nautical-miles",metersPerUnit:1852},"us-ch":{name:"us-survey-chains",metersPerUnit:20.1168402336805},"us-mi":{name:"us-survey-miles",metersPerUnit:1609.34721869444},km:{name:"kilometers",metersPerUnit:1e3},"ind-ft":{name:"indian-feet",metersPerUnit:.30479841},"ind-yd":{name:"indian-yards",metersPerUnit:.91439523},mi:{name:"miles",metersPerUnit:1609.344},yd:{name:"yards",metersPerUnit:.9144},ch:{name:"chains",metersPerUnit:20.1168},link:{name:"links",metersPerUnit:.201168},dm:{name:"decimeters",metersPerUnit:.1},in:{name:"inches",metersPerUnit:.0254},"ind-ch":{name:"indian-chains",metersPerUnit:20.11669506},"us-in":{name:"us-survey-inches",metersPerUnit:.025400050800101},"us-yd":{name:"us-survey-yards",metersPerUnit:.914401828803658}}});function $2(e){return JSON.stringify([e.coordinateFrame,e.projection,Object.keys(e.parameters).sort().map(t=>[t,e.parameters[t]]),[e.ellipsoid.semiMajorAxis,e.ellipsoid.semiMinorAxis],e.axis,[e.xUnit.name,e.xUnit.metersPerUnit,e.xUnit.degreesPerUnit],[e.yUnit.name,e.yUnit.metersPerUnit,e.yUnit.degreesPerUnit],[e.zUnit.name,e.zUnit.metersPerUnit,e.zUnit.degreesPerUnit],e.lossy,e.areaOfUse])}var lg=w(()=>{H2()});var hg=w(()=>{Pc();ag();cg()});var we={};Zr(we,{EPSILON1:()=>ZR,EPSILON10:()=>sC,EPSILON11:()=>aC,EPSILON12:()=>cC,EPSILON13:()=>lC,EPSILON14:()=>Ff,EPSILON15:()=>hC,EPSILON16:()=>uC,EPSILON17:()=>fC,EPSILON18:()=>dC,EPSILON19:()=>mC,EPSILON2:()=>JR,EPSILON20:()=>pC,EPSILON3:()=>QR,EPSILON4:()=>tC,EPSILON5:()=>eC,EPSILON6:()=>rC,EPSILON7:()=>nC,EPSILON8:()=>iC,EPSILON9:()=>oC,PI:()=>Rc,PI_OVER_FOUR:()=>yC,PI_OVER_SIX:()=>wC,PI_OVER_TWO:()=>gC,TWO_PI:()=>_h});var ZR,JR,QR,tC,eC,rC,nC,iC,oC,sC,aC,cC,lC,Ff,hC,uC,fC,dC,mC,pC,gC,yC,wC,Rc,_h,ug=w(()=>{ZR=.1,JR=.01,QR=.001,tC=1e-4,eC=1e-5,rC=1e-6,nC=1e-7,iC=1e-8,oC=1e-9,sC=1e-10,aC=1e-11,cC=1e-12,lC=1e-13,Ff=1e-14,hC=1e-15,uC=1e-16,fC=1e-17,dC=1e-18,mC=1e-19,pC=1e-20,gC=Math.PI/2,yC=Math.PI/4,wC=Math.PI/6,Rc=Math.PI,_h=Math.PI*2});function fg(e,{precision:t=ie.precision}={}){return e=SC(e),`${parseFloat(e.toPrecision(t))}`}function Vn(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function dg(e){return Uf(e)}function mg(e){return Br(e)}function Uf(e,t){return gg(e,r=>r*MC,t)}function Br(e,t){return gg(e,r=>r*_C,t)}function Y2(e,t){return Math.sign(e)===Math.sign(t)&&Math.abs(e)<Math.abs(t)?e:(e%t+t)%t}function pg(e,t){switch(t){case"negative-pi-to-pi":return xC(e);case"zero-to-two-pi":return K2(e);default:return e}}function K2(e){if(e>=0&&e<=_h)return e;let t=Y2(e,_h);return Math.abs(t)<1e-14&&Math.abs(e)>1e-14?_h:t}function xC(e){return e>=-Rc&&e<=Rc?e:K2(e+Rc)-Rc}function Mh(e,t,r){return gg(e,n=>Math.max(t,Math.min(r,n)))}function ko(e,t,r){let n=ie.EPSILON;r&&(ie.EPSILON=r);try{if(e===t)return!0;if(Vn(e)&&Vn(t)){if(e.length!==t.length)return!1;for(let i=0;i<e.length;++i)if(!ko(e[i],t[i]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<=ie.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{ie.EPSILON=n}}function SC(e){return Math.round(e/ie.EPSILON)*ie.EPSILON}function vC(e){return e.clone?e.clone():new Array(e.length)}function gg(e,t,r){if(Vn(e)){let n=e;r=r||vC(n);for(let i=0;i<r.length&&i<n.length;++i){let o=typeof e=="number"?e:e[i];r[i]=t(o,i,r)}return r}return t(e)}var _C,MC,bC,ie,ma=w(()=>{ug();_C=1/Math.PI*180,MC=1/180*Math.PI,bC={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...bC}};ie=globalThis.mathgl.config});var qo,Gf=w(()=>{ma();qo=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,r=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=t[n+r];return this.check()}toArray(t=[],r=0){for(let n=0;n<this.ELEMENTS;++n)t[r+n]=this[n];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:Vn(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toString(){return this.formatString(ie)}formatString(t){let r="";for(let n=0;n<this.ELEMENTS;++n)r+=(n>0?", ":"")+fg(this[n],t);return`${t.printTypes?this.constructor.name:""}[${r}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(!ko(this[r],t[r]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(this[r]!==t[r])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,r,n){if(n===void 0)return this.lerp(this,t,r);for(let i=0;i<this.ELEMENTS;++i){let o=t[i],s=typeof r=="number"?r:r[i];this[i]=o+n*(s-o)}return this.check()}min(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(t[r],this[r]);return this.check()}max(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.max(t[r],this[r]);return this.check()}clamp(t,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],t[n]),r[n]);return this.check()}add(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]+=r[n];return this.check()}subtract(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]-=r[n];return this.check()}scale(t){if(typeof t=="number")for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;else for(let r=0;r<this.ELEMENTS&&r<t.length;++r)this[r]*=t[r];return this.check()}multiplyByScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;return this.check()}check(){if(ie.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let r=0;r<this.ELEMENTS;++r)t=t&&Number.isFinite(this[r]);return t}}});function EC(e,t){if(e.length!==t)return!1;for(let r=0;r<e.length;++r)if(!Number.isFinite(e[r]))return!1;return!0}function ue(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function Cc(e,t,r=""){if(ie.debug&&!EC(e,t))throw new Error(`math.gl: ${r} some fields set to invalid numbers'`);return e}var jo=w(()=>{ma()});var Nc,yg=w(()=>{Gf();jo();ma();Nc=class extends qo{toString(){let t="[";if(ie.printRowMajor){t+="row-major:";for(let r=0;r<this.RANK;++r)for(let n=0;n<this.RANK;++n)t+=` ${this[n*this.RANK+r]}`}else{t+="column-major:";for(let r=0;r<this.ELEMENTS;++r)t+=` ${this[r]}`}return t+="]",t}getElementIndex(t,r){return r*this.RANK+t}getElement(t,r){return this[r*this.RANK+t]}setElement(t,r,n){return this[r*this.RANK+t]=ue(n),this}getColumn(t,r=new Array(this.RANK).fill(-0)){let n=t*this.RANK;for(let i=0;i<this.RANK;++i)r[i]=this[n+i];return r}setColumn(t,r){let n=t*this.RANK;for(let i=0;i<this.RANK;++i)this[n+i]=r[i];return this}}});function pr(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var wg=w(()=>{});var Oc,_g=w(()=>{Gf();jo();wg();Oc=class extends qo{get x(){return this[0]}set x(t){this[0]=ue(t)}get y(){return this[1]}set y(t){this[1]=ue(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let r=0;r<this.ELEMENTS;++r)t+=this[r]*this[r];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let r=0;for(let n=0;n<this.ELEMENTS;++n){let i=this[n]-t[n];r+=i*i}return ue(r)}dot(t){let r=0;for(let n=0;n<this.ELEMENTS;++n)r+=this[n]*t[n];return ue(r)}normalize(){let t=this.magnitude();if(t!==0)for(let r=0;r<this.ELEMENTS;++r)this[r]/=t;return this.check()}multiply(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]*=r[n];return this.check()}divide(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]/=r[n];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return pr(t>=0&&t<this.ELEMENTS,"index is out of range"),ue(this[t])}setComponent(t,r){return pr(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=r,this.check()}addVectors(t,r){return this.copy(t).add(r)}subVectors(t,r){return this.copy(t).subtract(r)}multiplyVectors(t,r){return this.copy(t).multiply(r)}addScaledVector(t,r){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t[n]*r;return this.check()}}});var zf,PU,X2=w(()=>{zf=typeof Float32Array<"u"?Float32Array:Array,PU=Math.PI/180});function Z2(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e}function J2(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i+r[4],e[1]=r[1]*n+r[3]*i+r[5],e}function Vf(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[3]*i+r[6],e[1]=r[1]*n+r[4]*i+r[7],e}function kf(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[4]*i+r[12],e[1]=r[1]*n+r[5]*i+r[13],e}var bh=w(()=>{});function qf(e,t,r){let n=t[0],i=t[1],o=r[3]*n+r[7]*i||1;return e[0]=(r[0]*n+r[4]*i)/o,e[1]=(r[1]*n+r[5]*i)/o,e}function jf(e,t,r){let n=t[0],i=t[1],o=t[2],s=r[3]*n+r[7]*i+r[11]*o||1;return e[0]=(r[0]*n+r[4]*i+r[8]*o)/s,e[1]=(r[1]*n+r[5]*i+r[9]*o)/s,e[2]=(r[2]*n+r[6]*i+r[10]*o)/s,e}function Q2(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e[2]=t[2],e}function tb(e,t,r){let n=t[0],i=t[1],o=t[2];return e[0]=r[0]*n+r[3]*i+r[6]*o,e[1]=r[1]*n+r[4]*i+r[7]*o,e[2]=r[2]*n+r[5]*i+r[8]*o,e[3]=t[3],e}var xh=w(()=>{});var Jr,eb=w(()=>{_g();ma();jo();bh();xh();Jr=class extends Oc{constructor(t=0,r=0){super(2),Vn(t)&&arguments.length===1?this.copy(t):(ie.debug&&(ue(t),ue(r)),this[0]=t,this[1]=r)}set(t,r){return this[0]=t,this[1]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this.check()}fromObject(t){return ie.debug&&(ue(t.x),ue(t.y)),this[0]=t.x,this[1]=t.y,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t}get ELEMENTS(){return 2}horizontalAngle(){return Math.atan2(this.y,this.x)}verticalAngle(){return Math.atan2(this.x,this.y)}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return kf(this,this,t),this.check()}transformAsVector(t){return qf(this,this,t),this.check()}transformByMatrix3(t){return Vf(this,this,t),this.check()}transformByMatrix2x3(t){return J2(this,this,t),this.check()}transformByMatrix2(t){return Z2(this,this,t),this.check()}}});function rb(){let e=new zf(3);return zf!==Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function IC(e){let t=e[0],r=e[1],n=e[2];return Math.sqrt(t*t+r*r+n*n)}function Mg(e,t,r){let n=new zf(3);return n[0]=e,n[1]=t,n[2]=r,n}function nb(e,t){let r=t[0],n=t[1],i=t[2],o=r*r+n*n+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e}function bg(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Bc(e,t,r){let n=t[0],i=t[1],o=t[2],s=r[0],a=r[1],c=r[2];return e[0]=i*c-o*a,e[1]=o*s-n*c,e[2]=n*a-i*s,e}function Wf(e,t,r){let n=t[0],i=t[1],o=t[2],s=r[3]*n+r[7]*i+r[11]*o+r[15];return s=s||1,e[0]=(r[0]*n+r[4]*i+r[8]*o+r[12])/s,e[1]=(r[1]*n+r[5]*i+r[9]*o+r[13])/s,e[2]=(r[2]*n+r[6]*i+r[10]*o+r[14])/s,e}function Hf(e,t,r){let n=t[0],i=t[1],o=t[2];return e[0]=n*r[0]+i*r[3]+o*r[6],e[1]=n*r[1]+i*r[4]+o*r[7],e[2]=n*r[2]+i*r[5]+o*r[8],e}function ib(e,t,r){let n=r[0],i=r[1],o=r[2],s=r[3],a=t[0],c=t[1],l=t[2],h=i*l-o*c,u=o*a-n*l,f=n*c-i*a,d=i*f-o*u,m=o*h-n*f,p=n*u-i*h,g=s*2;return h*=g,u*=g,f*=g,d*=2,m*=2,p*=2,e[0]=a+h+d,e[1]=c+u+m,e[2]=l+f+p,e}function ob(e,t,r,n){let i=[],o=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],o[0]=i[0],o[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),o[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function sb(e,t,r,n){let i=[],o=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],o[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),o[1]=i[1],o[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function ab(e,t,r,n){let i=[],o=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],o[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),o[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),o[2]=i[2],e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function cb(e,t){let r=e[0],n=e[1],i=e[2],o=t[0],s=t[1],a=t[2],c=Math.sqrt((r*r+n*n+i*i)*(o*o+s*s+a*a)),l=c&&bg(e,t)/c;return Math.acos(Math.min(Math.max(l,-1),1))}var lb,Lc=w(()=>{X2();lb=IC});var xg,$f,I,hb=w(()=>{_g();ma();jo();Lc();xh();xg=[0,0,0],I=class e extends Oc{static get ZERO(){return $f||($f=new e(0,0,0),Object.freeze($f)),$f}constructor(t=0,r=0,n=0){super(-0,-0,-0),arguments.length===1&&Vn(t)?this.copy(t):(ie.debug&&(ue(t),ue(r),ue(n)),this[0]=t,this[1]=r,this[2]=n)}set(t,r,n){return this[0]=t,this[1]=r,this[2]=n,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return ie.debug&&(ue(t.x),ue(t.y),ue(t.z)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t}get ELEMENTS(){return 3}get z(){return this[2]}set z(t){this[2]=ue(t)}angle(t){return cb(this,t)}cross(t){return Bc(this,this,t),this.check()}rotateX({radians:t,origin:r=xg}){return ob(this,this,r,t),this.check()}rotateY({radians:t,origin:r=xg}){return sb(this,this,r,t),this.check()}rotateZ({radians:t,origin:r=xg}){return ab(this,this,r,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Wf(this,this,t),this.check()}transformAsVector(t){return jf(this,this,t),this.check()}transformByMatrix3(t){return Hf(this,this,t),this.check()}transformByMatrix2(t){return Q2(this,this,t),this.check()}transformByQuaternion(t){return ib(this,this,t),this.check()}}});function ub(e,t){if(e===t){let r=t[1],n=t[2],i=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=n,e[7]=i}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function fb(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=t[4],a=t[5],c=t[6],l=t[7],h=t[8],u=h*s-a*l,f=-h*o+a*c,d=l*o-s*c,m=r*u+n*f+i*d;return m?(m=1/m,e[0]=u*m,e[1]=(-h*n+i*l)*m,e[2]=(a*n-i*s)*m,e[3]=f*m,e[4]=(h*r-i*c)*m,e[5]=(-a*r+i*o)*m,e[6]=d*m,e[7]=(-l*r+n*c)*m,e[8]=(s*r-n*o)*m,e):null}function db(e){let t=e[0],r=e[1],n=e[2],i=e[3],o=e[4],s=e[5],a=e[6],c=e[7],l=e[8];return t*(l*o-s*c)+r*(-l*i+s*a)+n*(c*i-o*a)}function Sg(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],c=t[5],l=t[6],h=t[7],u=t[8],f=r[0],d=r[1],m=r[2],p=r[3],g=r[4],y=r[5],_=r[6],M=r[7],b=r[8];return e[0]=f*n+d*s+m*l,e[1]=f*i+d*a+m*h,e[2]=f*o+d*c+m*u,e[3]=p*n+g*s+y*l,e[4]=p*i+g*a+y*h,e[5]=p*o+g*c+y*u,e[6]=_*n+M*s+b*l,e[7]=_*i+M*a+b*h,e[8]=_*o+M*c+b*u,e}function mb(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],c=t[5],l=t[6],h=t[7],u=t[8],f=r[0],d=r[1];return e[0]=n,e[1]=i,e[2]=o,e[3]=s,e[4]=a,e[5]=c,e[6]=f*n+d*s+l,e[7]=f*i+d*a+h,e[8]=f*o+d*c+u,e}function pb(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],c=t[5],l=t[6],h=t[7],u=t[8],f=Math.sin(r),d=Math.cos(r);return e[0]=d*n+f*s,e[1]=d*i+f*a,e[2]=d*o+f*c,e[3]=d*s-f*n,e[4]=d*a-f*i,e[5]=d*c-f*o,e[6]=l,e[7]=h,e[8]=u,e}function vg(e,t,r){let n=r[0],i=r[1];return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function gb(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=r+r,a=n+n,c=i+i,l=r*s,h=n*s,u=n*a,f=i*s,d=i*a,m=i*c,p=o*s,g=o*a,y=o*c;return e[0]=1-u-m,e[3]=h-y,e[6]=f+g,e[1]=h+y,e[4]=1-l-m,e[7]=d-p,e[2]=f-g,e[5]=d+p,e[8]=1-l-u,e}var Eg=w(()=>{});function RC(){return Yf||(Yf=new Qr([0,0,0,0,0,0,0,0,0]),Object.freeze(Yf)),Yf}function CC(){return Kf||(Kf=new Qr,Object.freeze(Kf)),Kf}var Tg,PC,Qr,Yf,Kf,yb=w(()=>{yg();jo();xh();Eg();bh();Lc();(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL1ROW0=3]="COL1ROW0",e[e.COL1ROW1=4]="COL1ROW1",e[e.COL1ROW2=5]="COL1ROW2",e[e.COL2ROW0=6]="COL2ROW0",e[e.COL2ROW1=7]="COL2ROW1",e[e.COL2ROW2=8]="COL2ROW2"})(Tg||(Tg={}));PC=Object.freeze([1,0,0,0,1,0,0,0,1]),Qr=class extends Nc{static get IDENTITY(){return CC()}static get ZERO(){return RC()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Tg}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}identity(){return this.copy(PC)}fromObject(t){return this.check()}fromQuaternion(t){return gb(this,t),this.check()}fromMatrix4(t){return this.set(t[0],t[1],t[2],t[4],t[5],t[6],t[8],t[9],t[10])}set(t,r,n,i,o,s,a,c,l){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,this[4]=o,this[5]=s,this[6]=a,this[7]=c,this[8]=l,this.check()}setRowMajor(t,r,n,i,o,s,a,c,l){return this[0]=t,this[1]=i,this[2]=a,this[3]=r,this[4]=o,this[5]=c,this[6]=n,this[7]=s,this[8]=l,this.check()}determinant(){return db(this)}transpose(){return ub(this,this),this.check()}invert(){return fb(this,this),this.check()}multiplyLeft(t){return Sg(this,t,this),this.check()}multiplyRight(t){return Sg(this,this,t),this.check()}rotate(t){return pb(this,this,t),this.check()}scale(t){return Array.isArray(t)?vg(this,this,t):vg(this,this,[t,t]),this.check()}translate(t){return mb(this,this,t),this.check()}transform(t,r){let n;switch(t.length){case 2:n=Vf(r||[-0,-0],t,this);break;case 3:n=Hf(r||[-0,-0,-0],t,this);break;case 4:n=tb(r||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Cc(n,t.length),n}},Kf=null});function wb(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Ig(e,t){if(e===t){let r=t[1],n=t[2],i=t[3],o=t[6],s=t[7],a=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=n,e[9]=o,e[11]=t[14],e[12]=i,e[13]=s,e[14]=a}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function Ag(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=t[4],a=t[5],c=t[6],l=t[7],h=t[8],u=t[9],f=t[10],d=t[11],m=t[12],p=t[13],g=t[14],y=t[15],_=r*a-n*s,M=r*c-i*s,b=r*l-o*s,v=n*c-i*a,T=n*l-o*a,S=i*l-o*c,E=h*p-u*m,N=h*g-f*m,B=h*y-d*m,C=u*g-f*p,R=u*y-d*p,W=f*y-d*g,j=_*W-M*R+b*C+v*B-T*N+S*E;return j?(j=1/j,e[0]=(a*W-c*R+l*C)*j,e[1]=(i*R-n*W-o*C)*j,e[2]=(p*S-g*T+y*v)*j,e[3]=(f*T-u*S-d*v)*j,e[4]=(c*B-s*W-l*N)*j,e[5]=(r*W-i*B+o*N)*j,e[6]=(g*b-m*S-y*M)*j,e[7]=(h*S-f*b+d*M)*j,e[8]=(s*R-a*B+l*E)*j,e[9]=(n*B-r*R-o*E)*j,e[10]=(m*T-p*b+y*_)*j,e[11]=(u*b-h*T-d*_)*j,e[12]=(a*N-s*C-c*E)*j,e[13]=(r*C-n*N+i*E)*j,e[14]=(p*M-m*v-g*_)*j,e[15]=(h*v-u*M+f*_)*j,e):null}function Pg(e){let t=e[0],r=e[1],n=e[2],i=e[3],o=e[4],s=e[5],a=e[6],c=e[7],l=e[8],h=e[9],u=e[10],f=e[11],d=e[12],m=e[13],p=e[14],g=e[15],y=t*s-r*o,_=t*a-n*o,M=r*a-n*s,b=l*m-h*d,v=l*p-u*d,T=h*p-u*m,S=t*T-r*v+n*b,E=o*T-s*v+a*b,N=l*M-h*_+u*y,B=d*M-m*_+p*y;return c*S-i*E+g*N-f*B}function Xf(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],c=t[5],l=t[6],h=t[7],u=t[8],f=t[9],d=t[10],m=t[11],p=t[12],g=t[13],y=t[14],_=t[15],M=r[0],b=r[1],v=r[2],T=r[3];return e[0]=M*n+b*a+v*u+T*p,e[1]=M*i+b*c+v*f+T*g,e[2]=M*o+b*l+v*d+T*y,e[3]=M*s+b*h+v*m+T*_,M=r[4],b=r[5],v=r[6],T=r[7],e[4]=M*n+b*a+v*u+T*p,e[5]=M*i+b*c+v*f+T*g,e[6]=M*o+b*l+v*d+T*y,e[7]=M*s+b*h+v*m+T*_,M=r[8],b=r[9],v=r[10],T=r[11],e[8]=M*n+b*a+v*u+T*p,e[9]=M*i+b*c+v*f+T*g,e[10]=M*o+b*l+v*d+T*y,e[11]=M*s+b*h+v*m+T*_,M=r[12],b=r[13],v=r[14],T=r[15],e[12]=M*n+b*a+v*u+T*p,e[13]=M*i+b*c+v*f+T*g,e[14]=M*o+b*l+v*d+T*y,e[15]=M*s+b*h+v*m+T*_,e}function Rg(e,t,r){let n=r[0],i=r[1],o=r[2],s,a,c,l,h,u,f,d,m,p,g,y;return t===e?(e[12]=t[0]*n+t[4]*i+t[8]*o+t[12],e[13]=t[1]*n+t[5]*i+t[9]*o+t[13],e[14]=t[2]*n+t[6]*i+t[10]*o+t[14],e[15]=t[3]*n+t[7]*i+t[11]*o+t[15]):(s=t[0],a=t[1],c=t[2],l=t[3],h=t[4],u=t[5],f=t[6],d=t[7],m=t[8],p=t[9],g=t[10],y=t[11],e[0]=s,e[1]=a,e[2]=c,e[3]=l,e[4]=h,e[5]=u,e[6]=f,e[7]=d,e[8]=m,e[9]=p,e[10]=g,e[11]=y,e[12]=s*n+h*i+m*o+t[12],e[13]=a*n+u*i+p*o+t[13],e[14]=c*n+f*i+g*o+t[14],e[15]=l*n+d*i+y*o+t[15]),e}function Cg(e,t,r){let n=r[0],i=r[1],o=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Ng(e,t,r,n){let i=n[0],o=n[1],s=n[2],a=Math.sqrt(i*i+o*o+s*s),c,l,h,u,f,d,m,p,g,y,_,M,b,v,T,S,E,N,B,C,R,W,j,A;return a<1e-6?null:(a=1/a,i*=a,o*=a,s*=a,l=Math.sin(r),c=Math.cos(r),h=1-c,u=t[0],f=t[1],d=t[2],m=t[3],p=t[4],g=t[5],y=t[6],_=t[7],M=t[8],b=t[9],v=t[10],T=t[11],S=i*i*h+c,E=o*i*h+s*l,N=s*i*h-o*l,B=i*o*h-s*l,C=o*o*h+c,R=s*o*h+i*l,W=i*s*h+o*l,j=o*s*h-i*l,A=s*s*h+c,e[0]=u*S+p*E+M*N,e[1]=f*S+g*E+b*N,e[2]=d*S+y*E+v*N,e[3]=m*S+_*E+T*N,e[4]=u*B+p*C+M*R,e[5]=f*B+g*C+b*R,e[6]=d*B+y*C+v*R,e[7]=m*B+_*C+T*R,e[8]=u*W+p*j+M*A,e[9]=f*W+g*j+b*A,e[10]=d*W+y*j+v*A,e[11]=m*W+_*j+T*A,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function Og(e,t,r){let n=Math.sin(r),i=Math.cos(r),o=t[4],s=t[5],a=t[6],c=t[7],l=t[8],h=t[9],u=t[10],f=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*i+l*n,e[5]=s*i+h*n,e[6]=a*i+u*n,e[7]=c*i+f*n,e[8]=l*i-o*n,e[9]=h*i-s*n,e[10]=u*i-a*n,e[11]=f*i-c*n,e}function Bg(e,t,r){let n=Math.sin(r),i=Math.cos(r),o=t[0],s=t[1],a=t[2],c=t[3],l=t[8],h=t[9],u=t[10],f=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*i-l*n,e[1]=s*i-h*n,e[2]=a*i-u*n,e[3]=c*i-f*n,e[8]=o*n+l*i,e[9]=s*n+h*i,e[10]=a*n+u*i,e[11]=c*n+f*i,e}function Lg(e,t,r){let n=Math.sin(r),i=Math.cos(r),o=t[0],s=t[1],a=t[2],c=t[3],l=t[4],h=t[5],u=t[6],f=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*i+l*n,e[1]=s*i+h*n,e[2]=a*i+u*n,e[3]=c*i+f*n,e[4]=l*i-o*n,e[5]=h*i-s*n,e[6]=u*i-a*n,e[7]=f*i-c*n,e}function Dg(e,t){let r=t[0],n=t[1],i=t[2],o=t[4],s=t[5],a=t[6],c=t[8],l=t[9],h=t[10];return e[0]=Math.sqrt(r*r+n*n+i*i),e[1]=Math.sqrt(o*o+s*s+a*a),e[2]=Math.sqrt(c*c+l*l+h*h),e}function Fg(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=r+r,a=n+n,c=i+i,l=r*s,h=n*s,u=n*a,f=i*s,d=i*a,m=i*c,p=o*s,g=o*a,y=o*c;return e[0]=1-u-m,e[1]=h+y,e[2]=f-g,e[3]=0,e[4]=h-y,e[5]=1-l-m,e[6]=d+p,e[7]=0,e[8]=f+g,e[9]=d-p,e[10]=1-l-u,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Ug(e,t,r,n,i,o,s){let a=1/(r-t),c=1/(i-n),l=1/(o-s);return e[0]=o*2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o*2*c,e[6]=0,e[7]=0,e[8]=(r+t)*a,e[9]=(i+n)*c,e[10]=(s+o)*l,e[11]=-1,e[12]=0,e[13]=0,e[14]=s*o*2*l,e[15]=0,e}function _b(e,t,r,n,i){let o=1/Math.tan(t/2);if(e[0]=o/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let s=1/(n-i);e[10]=(i+n)*s,e[14]=2*i*n*s}else e[10]=-1,e[14]=-2*n;return e}function Mb(e,t,r,n,i,o,s){let a=1/(t-r),c=1/(n-i),l=1/(o-s);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+r)*a,e[13]=(i+n)*c,e[14]=(s+o)*l,e[15]=1,e}function Vg(e,t,r,n){let i,o,s,a,c,l,h,u,f,d,m=t[0],p=t[1],g=t[2],y=n[0],_=n[1],M=n[2],b=r[0],v=r[1],T=r[2];return Math.abs(m-b)<1e-6&&Math.abs(p-v)<1e-6&&Math.abs(g-T)<1e-6?wb(e):(u=m-b,f=p-v,d=g-T,i=1/Math.sqrt(u*u+f*f+d*d),u*=i,f*=i,d*=i,o=_*d-M*f,s=M*u-y*d,a=y*f-_*u,i=Math.sqrt(o*o+s*s+a*a),i?(i=1/i,o*=i,s*=i,a*=i):(o=0,s=0,a=0),c=f*a-d*s,l=d*o-u*a,h=u*s-f*o,i=Math.sqrt(c*c+l*l+h*h),i?(i=1/i,c*=i,l*=i,h*=i):(c=0,l=0,h=0),e[0]=o,e[1]=c,e[2]=u,e[3]=0,e[4]=s,e[5]=l,e[6]=f,e[7]=0,e[8]=a,e[9]=h,e[10]=d,e[11]=0,e[12]=-(o*m+s*p+a*g),e[13]=-(c*m+l*p+h*g),e[14]=-(u*m+f*p+d*g),e[15]=1,e)}function kg(e){if(e.length!==16||Array.from(e).some(i=>!Number.isFinite(i))||e[3]!==0||e[7]!==0||e[11]!==0||e[15]!==1)throw new RangeError("Expected a finite affine matrix");let t=[Math.hypot(e[0],e[1],e[2]),Math.hypot(e[4],e[5],e[6]),Math.hypot(e[8],e[9],e[10])];if(t.some(i=>i===0||!Number.isFinite(i)))throw new RangeError("Singular transform");let r=Array.from({length:9},(i,o)=>e[Math.floor(o/3)*4+o%3]/t[Math.floor(o/3)]);for(let[i,o]of[[0,3],[0,6],[3,6]])if(Math.abs(r[i]*r[o]+r[i+1]*r[o+1]+r[i+2]*r[o+2])>1e-7)throw new RangeError("Sheared transforms do not have a TRS decomposition");if(r[0]*(r[4]*r[8]-r[5]*r[7])-r[3]*(r[1]*r[8]-r[2]*r[7])+r[6]*(r[1]*r[5]-r[2]*r[4])<0){t[0]=-t[0];for(let i=0;i<3;i++)r[i]=-r[i]}return{rotation:r,scale:t,translation:[e[12],e[13],e[14]]}}var Gg,zg,Zf=w(()=>{Gg=_b;zg=Mb});function bb(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e}function xb(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e}function Sb(e){let t=e[0],r=e[1],n=e[2],i=e[3];return Math.sqrt(t*t+r*r+n*n+i*i)}function vb(e){let t=e[0],r=e[1],n=e[2],i=e[3];return t*t+r*r+n*n+i*i}function Eb(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=r*r+n*n+i*i+o*o;return s>0&&(s=1/Math.sqrt(s)),e[0]=r*s,e[1]=n*s,e[2]=i*s,e[3]=o*s,e}function Tb(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Ib(e,t,r,n){let i=t[0],o=t[1],s=t[2],a=t[3];return e[0]=i+n*(r[0]-i),e[1]=o+n*(r[1]-o),e[2]=s+n*(r[2]-s),e[3]=a+n*(r[3]-a),e}function Ab(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3];return e[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*s,e[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*s,e[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*s,e[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*s,e}var Jf=w(()=>{});function DC(){return Qf||(Qf=new bt([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Qf)),Qf}function FC(){return td||(td=new bt,Object.freeze(td)),td}function Pb(e){if(e>Math.PI*2)throw Error("expected radians")}function UC(e,t,r,n,i,o){let s=2*o/(r-t),a=2*o/(i-n),c=(r+t)/(r-t),l=(i+n)/(i-n),h=-1,u=-1,f=-2*o;return e[0]=s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=c,e[9]=l,e[10]=h,e[11]=u,e[12]=0,e[13]=0,e[14]=f,e[15]=0,e}var Wg,OC,BC,qg,jg,LC,bt,Qf,td,Rb=w(()=>{yg();Zf();jo();xh();Zf();bh();Lc();Jf();(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL0ROW3=3]="COL0ROW3",e[e.COL1ROW0=4]="COL1ROW0",e[e.COL1ROW1=5]="COL1ROW1",e[e.COL1ROW2=6]="COL1ROW2",e[e.COL1ROW3=7]="COL1ROW3",e[e.COL2ROW0=8]="COL2ROW0",e[e.COL2ROW1=9]="COL2ROW1",e[e.COL2ROW2=10]="COL2ROW2",e[e.COL2ROW3=11]="COL2ROW3",e[e.COL3ROW0=12]="COL3ROW0",e[e.COL3ROW1=13]="COL3ROW1",e[e.COL3ROW2=14]="COL3ROW2",e[e.COL3ROW3=15]="COL3ROW3"})(Wg||(Wg={}));OC=45*Math.PI/180,BC=1,qg=.1,jg=500,LC=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),bt=class extends Nc{static get IDENTITY(){return FC()}static get ZERO(){return DC()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Wg}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,r,n,i,o,s,a,c,l,h,u,f,d,m,p,g){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,this[4]=o,this[5]=s,this[6]=a,this[7]=c,this[8]=l,this[9]=h,this[10]=u,this[11]=f,this[12]=d,this[13]=m,this[14]=p,this[15]=g,this.check()}setRowMajor(t,r,n,i,o,s,a,c,l,h,u,f,d,m,p,g){return this[0]=t,this[1]=o,this[2]=l,this[3]=d,this[4]=r,this[5]=s,this[6]=h,this[7]=m,this[8]=n,this[9]=a,this[10]=u,this[11]=p,this[12]=i,this[13]=c,this[14]=f,this[15]=g,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(LC)}fromObject(t){return this.check()}fromQuaternion(t){return Fg(this,t),this.check()}fromMatrix3(t){return this.set(t[0],t[1],t[2],0,t[3],t[4],t[5],0,t[6],t[7],t[8],0,0,0,0,1)}frustum(t){let{left:r,right:n,bottom:i,top:o,near:s=qg,far:a=jg}=t;return a===1/0?UC(this,r,n,i,o,s):Ug(this,r,n,i,o,s,a),this.check()}lookAt(t){let{eye:r,center:n=[0,0,0],up:i=[0,1,0]}=t;return Vg(this,r,n,i),this.check()}ortho(t){let{left:r,right:n,bottom:i,top:o,near:s=qg,far:a=jg}=t;return zg(this,r,n,i,o,s,a),this.check()}orthographic(t){let{fovy:r=OC,aspect:n=BC,focalDistance:i=1,near:o=qg,far:s=jg}=t;Pb(r);let a=r/2,c=i*Math.tan(a),l=c*n;return this.ortho({left:-l,right:l,bottom:-c,top:c,near:o,far:s})}perspective(t){let{fovy:r=45*Math.PI/180,aspect:n=1,near:i=.1,far:o=500}=t;return Pb(r),Gg(this,r,n,i,o),this.check()}determinant(){return Pg(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,r){let{rotation:n,scale:i}=kg(this);if(t=t||new Array(16),r)for(let o=0;o<3;o++)r[o]=i[o];for(let o=0;o<16;o++)t[o]=0;for(let o=0;o<9;o++)t[Math.floor(o/3)*4+o%3]=n[o];return t[15]=1,t}getRotationMatrix3(t,r){let{rotation:n,scale:i}=kg(this);if(t=t||new Array(9),r)for(let o=0;o<3;o++)r[o]=i[o];for(let o=0;o<9;o++)t[o]=n[o];return t}transpose(){return Ig(this,this),this.check()}invert(){return Ag(this,this),this.check()}multiplyLeft(t){return Xf(this,t,this),this.check()}multiplyRight(t){return Xf(this,this,t),this.check()}rotateX(t){return Og(this,this,t),this.check()}rotateY(t){return Bg(this,this,t),this.check()}rotateZ(t){return Lg(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,r){return Ng(this,this,t,r),this.check()}scale(t){return Cg(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return Rg(this,this,t),this.check()}transform(t,r){return t.length===4?(r=Ab(r||[-0,-0,-0,-0],t,this),Cc(r,4),r):this.transformAsPoint(t,r)}transformAsPoint(t,r){let{length:n}=t,i;switch(n){case 2:i=kf(r||[-0,-0],t,this);break;case 3:i=Wf(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Cc(i,t.length),i}transformAsVector(t,r){let n;switch(t.length){case 2:n=qf(r||[-0,-0],t,this);break;case 3:n=jf(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Cc(n,t.length),n}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,r,n){return this.identity().translate([t,r,n])}}});function Cb(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function Hg(e,t,r){r=r*.5;let n=Math.sin(r);return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(r),e}function $g(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3],a=r[0],c=r[1],l=r[2],h=r[3];return e[0]=n*h+s*a+i*l-o*c,e[1]=i*h+s*c+o*a-n*l,e[2]=o*h+s*l+n*c-i*a,e[3]=s*h-n*a-i*c-o*l,e}function Nb(e,t,r){r*=.5;let n=t[0],i=t[1],o=t[2],s=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c+s*a,e[1]=i*c+o*a,e[2]=o*c-i*a,e[3]=s*c-n*a,e}function Ob(e,t,r){r*=.5;let n=t[0],i=t[1],o=t[2],s=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c-o*a,e[1]=i*c+s*a,e[2]=o*c+n*a,e[3]=s*c-i*a,e}function Bb(e,t,r){r*=.5;let n=t[0],i=t[1],o=t[2],s=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c+i*a,e[1]=i*c-n*a,e[2]=o*c+s*a,e[3]=s*c-o*a,e}function Lb(e,t){let r=t[0],n=t[1],i=t[2];return e[0]=r,e[1]=n,e[2]=i,e[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i)),e}function Yg(e,t,r,n){let i=t[0],o=t[1],s=t[2],a=t[3],c=r[0],l=r[1],h=r[2],u=r[3],f,d,m,p,g;return f=i*c+o*l+s*h+a*u,f<0&&(f=-f,c=-c,l=-l,h=-h,u=-u),1-f>1e-6?(d=Math.acos(f),g=Math.sin(d),m=Math.sin((1-n)*d)/g,p=Math.sin(n*d)/g):(m=1-n,p=n),e[0]=m*i+p*c,e[1]=m*o+p*l,e[2]=m*s+p*h,e[3]=m*a+p*u,e}function Db(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=r*r+n*n+i*i+o*o,a=s?1/s:0;return e[0]=-r*a,e[1]=-n*a,e[2]=-i*a,e[3]=o*a,e}function Fb(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function Ub(e,t){let r=t[0]+t[4]+t[8],n;if(r>0)n=Math.sqrt(r+1),e[3]=.5*n,n=.5/n,e[0]=(t[5]-t[7])*n,e[1]=(t[6]-t[2])*n,e[2]=(t[1]-t[3])*n;else{let i=0;t[4]>t[0]&&(i=1),t[8]>t[i*3+i]&&(i=2);let o=(i+1)%3,s=(i+2)%3;n=Math.sqrt(t[i*3+i]-t[o*3+o]-t[s*3+s]+1),e[i]=.5*n,n=.5/n,e[3]=(t[o*3+s]-t[s*3+o])*n,e[o]=(t[o*3+i]+t[i*3+o])*n,e[s]=(t[s*3+i]+t[i*3+s])*n}return e}function Hb(e,t,r,n){if(t.length!==4||r.length!==4||[...Array.from(t),...Array.from(r),n].some(f=>!Number.isFinite(f)))throw new RangeError("Expected finite quaternions and step");if(t.length!==4||n<0)throw new RangeError("Expected quaternions and a nonnegative step");let i=Math.max(...Array.from(t,Math.abs)),o=Math.max(...Array.from(r,Math.abs));if(!i||!o)throw new RangeError("Zero quaternion");let s=Array.from(t,f=>f/i),a=Array.from(r,f=>f/o),c=Math.hypot(...s),l=Math.hypot(...a);for(let f=0;f<4;f++)s[f]/=c,a[f]/=l;let h=s.reduce((f,d,m)=>f+d*a[m],0),u=2*Math.acos(Math.min(1,Math.abs(h)));if(e.length<4)throw new RangeError("Result buffer is too short");return Yg(e,s,a,u===0?0:Math.min(1,n/u)),e}var Gb,zb,Vb,kb,qb,jb,GC,Wb,ed=w(()=>{Lc();Jf();Gb=bb,zb=xb,Vb=Tb,kb=Ib,qb=Sb,jb=vb,GC=Eb,Wb=(function(){let e=rb(),t=Mg(1,0,0),r=Mg(0,1,0);return function(n,i,o){let s=bg(i,o);return s<-.999999?(Bc(e,t,i),lb(e)<1e-6&&Bc(e,r,i),nb(e,e),Hg(n,e,Math.PI),n):s>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Bc(e,i,o),n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=1+s,GC(n,n))}})()});var to,$b=w(()=>{ed();Gf();jo();ed();to=class extends qo{constructor(t=0,r=0,n=0,i=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,r,n,i)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,r,n,i){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return Ub(this,t),this.check()}fromEuler(t){switch(this.identity(),t.order){case"xyz":return this.rotateX(t.x).rotateY(t.y).rotateZ(t.z);case"yxz":return this.rotateY(t.y).rotateX(t.x).rotateZ(t.z);case"zxy":return this.rotateZ(t.z).rotateX(t.x).rotateY(t.y);case"zyx":return this.rotateZ(t.z).rotateY(t.y).rotateX(t.x);case"yzx":return this.rotateY(t.y).rotateZ(t.z).rotateX(t.x);case"xzy":return this.rotateX(t.x).rotateZ(t.z).rotateY(t.y);default:throw new Error("Unknown Euler angle order")}}fromAxisRotation(t,r){return Hg(this,t,r),this.check()}rotateTowards(t,r){return Hb(this,this,t,r)}identity(){return Cb(this),this.check()}setAxisAngle(t,r){return this.fromAxisRotation(t,r)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=ue(t)}get y(){return this[1]}set y(t){this[1]=ue(t)}get z(){return this[2]}set z(t){this[2]=ue(t)}get w(){return this[3]}set w(t){this[3]=ue(t)}len(){return qb(this)}lengthSquared(){return jb(this)}dot(t){return Vb(this,t)}rotationTo(t,r){return Wb(this,t,r),this.check()}add(t){return Gb(this,this,t),this.check()}calculateW(){return Lb(this,this),this.check()}conjugate(){return Fb(this,this),this.check()}invert(){return Db(this,this),this.check()}lerp(t,r,n){return n===void 0?this.lerp(this,t,r):(kb(this,t,r,n),this.check())}multiplyRight(t){return $g(this,this,t),this.check()}multiplyLeft(t){return $g(this,t,this),this.check()}normalize(){let t=this.len(),r=t>0?1/t:0;return this[0]=this[0]*r,this[1]=this[1]*r,this[2]=this[2]*r,this[3]=this[3]*r,t===0&&(this[3]=1),this.check()}rotateX(t){return Nb(this,this,t),this.check()}rotateY(t){return Ob(this,this,t),this.check()}rotateZ(t){return Bb(this,this,t),this.check()}scale(t){return zb(this,this,t),this.check()}slerp(t,r,n){let i,o,s;return arguments.length===2?(i=this,o=t,s=r):(i=t,o=r,s=n),Yg(this,i,o,s),this.check()}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,r){return this.setAxisAngle(t,r)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}}});function Xg(){return{eastX:0,eastY:1,northZ:1,upX:1,upY:0,upZ:0}}function Zg(e,t,r){let n=e.x,i=e.y,o=e.z,s=t.x,a=t.y,c=t.z;return o!==0?!1:zC(r,n,i,s*i-a*n,s,a,c)}function Jg(e,t,r,n,i,o){let s=Kg(r),a=Kg(n),c=Kg(i),l=Math.abs(s),h=Math.abs(a),u=Math.abs(c);if(!l||!h||!u||l===h||l===u||h===u||(l%3+1===h?1:-1)*Math.sign(s*a*c)!==1||!Array.isArray(o)&&o.length<16)return!1;let d=e.eastX,m=e.eastY,p=e.northZ,g=e.upX,y=e.upY,_=e.upZ,M=-_*m,b=_*d,v=t.x,T=t.y,S=t.z,E=(l===1?d:l===2?M:g)*Math.sign(s),N=(l===1?m:l===2?b:y)*Math.sign(s),B=(l===1?0:l===2?p:_)*Math.sign(s),C=(h===1?d:h===2?M:g)*Math.sign(a),R=(h===1?m:h===2?b:y)*Math.sign(a),W=(h===1?0:h===2?p:_)*Math.sign(a),j=(u===1?d:u===2?M:g)*Math.sign(c),A=(u===1?m:u===2?b:y)*Math.sign(c),P=(u===1?0:u===2?p:_)*Math.sign(c);return!Number.isFinite(E)||!Number.isFinite(N)||!Number.isFinite(B)||!Number.isFinite(C)||!Number.isFinite(R)||!Number.isFinite(W)||!Number.isFinite(j)||!Number.isFinite(A)||!Number.isFinite(P)||!Number.isFinite(v)||!Number.isFinite(T)||!Number.isFinite(S)||o instanceof Float32Array&&(!Number.isFinite(Math.fround(E))||!Number.isFinite(Math.fround(N))||!Number.isFinite(Math.fround(B))||!Number.isFinite(Math.fround(C))||!Number.isFinite(Math.fround(R))||!Number.isFinite(Math.fround(W))||!Number.isFinite(Math.fround(j))||!Number.isFinite(Math.fround(A))||!Number.isFinite(Math.fround(P))||!Number.isFinite(Math.fround(v))||!Number.isFinite(Math.fround(T))||!Number.isFinite(Math.fround(S)))?!1:(o[0]=E,o[1]=N,o[2]=B,o[3]=0,o[4]=C,o[5]=R,o[6]=W,o[7]=0,o[8]=j,o[9]=A,o[10]=P,o[11]=0,o[12]=v,o[13]=T,o[14]=S,o[15]=1,!0)}function Kg(e){switch(e){case"east":return 1;case"west":return-1;case"north":return 2;case"south":return-2;case"up":return 3;case"down":return-3;default:return 0}}function zC(e,t,r,n,i,o,s){return!Number.isFinite(t)||!Number.isFinite(r)||!Number.isFinite(n)||!Number.isFinite(i)||!Number.isFinite(o)||!Number.isFinite(s)?!1:(e.eastX=t,e.eastY=r,e.northZ=n,e.upX=i,e.upY=o,e.upZ=s,!0)}var Yb=w(()=>{});function vh(e,t,r=e){let n=e.x,i=e.y,o=e.z,{semiMajorAxis:s,semiMinorAxis:a,eccentricitySquared:c}=t,l=Math.sin(i),h=Math.abs(i)===Math.PI/2?0:Math.cos(i),u=a/s,f=c<.9?s/Math.sqrt(1-c*l*l):s/Math.hypot(h,u*l),d=(f+o)*h*Math.cos(n),m=(f+o)*h*Math.sin(n),p=(f*(c<.9?1-c:u*u)+o)*l;return Dc(r,d,m,p)}function Eh(e,t,r=e){let n=e.x,i=e.y,o=e.z,{semiMajorAxis:s,semiMinorAxis:a,eccentricitySquared:c}=t,l=Math.atan2(i,n),h=Math.hypot(n,i),u=Math.hypot(n,i,o);if(!(u>0)||!Number.isFinite(u))return!1;if(c===0)return Dc(r,h===0?0:l,Math.atan2(o,h),u-s);if(h===0)return Dc(r,0,Math.sign(o)*Math.PI/2,Math.abs(o)-a);let f=h/s,d=o/a;if(f*f+d*d<1-16*nd||c>=.9)return Qg(n,i,o,h,s,a,r);let m=o/u,p=h/u,g=1/Math.sqrt(1-c*(2-c)*p*p),y=p*(1-c)*g,_=m*g;for(let M=0;M<30;M++){let b=s/Math.sqrt(1-c*_*_),v=h*y+o*_-b*(1-c*_*_),T=c*b/(b+v);g=1/Math.sqrt(1-T*(2-T)*p*p);let S=p*(1-T)*g,E=m*g;if(Math.abs(E*y-S*_)<=1e-12){if(!Number.isFinite(v))break;return Dc(r,l,Math.atan2(E,Math.abs(S)),v)}y=S,_=E}return Qg(n,i,o,h,s,a,r)}function Qg(e,t,r,n,i,o,s){let a=Math.atan2(t,e),c=o/i,l=c*c,h=n/i,u=r/i,f=1-l;if(!(l>0)||c>1)return!1;let d=i*i,m=o*o,p=Number.isFinite(d)&&d>0?(m-l*d+Wo(o,o,m)-l*Wo(i,i,d)-Wo(l,d,l*d))/d:0,g=n*n,y=e*e,_=t*t,M=y+_,b=Number.isFinite(g)&&g>0?(M-g+rd(y,_,M)+Wo(e,e,y)+Wo(t,t,_)-Wo(n,n,g))/(2*n):0,v=i*l,T=n-i,S=T+v,E=b+rd(n,-i,T)+rd(T,v,S)+Wo(i,l,v)+i*p;if(r===0)return S+E<0?!1:Dc(s,a,0,T);let N=Math.abs(u)*c,B=0,C=l+Math.hypot(h,u*c);if(!Number.isFinite(C))return!1;let R=Math.max(N,h-f);R>B&&R<C||(R=C/2);let W=-(S+E)/i,j=Math.sqrt(W*(h+f))/f,A=W>0&&Math.abs(r)/j/i*c<=nd*W?Math.atan2(Math.sign(r)*j/c,h/f):void 0;for(let P=0;P<1024&&A===void 0;P++){let D=f+R,F=h/D,L=r/R/i,O=L*c,V=i*R,yt=S-V,X=(yt+(rd(S,-V,yt)+E-Wo(i,R,V)))/(i*D)*(F+1),xt=X+O*O;if(!Number.isFinite(xt))return!1;xt>0?B=R:C=R;let et=-2*(F*F/D+O*O/R),dt=R-xt/et,St=dt>B&&dt<C?dt:B+(C-B)/2;if(Math.abs(xt)<=4*nd*(Math.abs(X)+O*O)||C-B<=4*nd*R){A=Math.atan2(L,F);break}R=St}return A!==void 0&&VC(s,a,A,n,r,i,c)}function rd(e,t,r){let n=r-e;return e-(r-n)+(t-n)}function Wo(e,t,r){let n=134217729*e,i=134217729*t;if(!Number.isFinite(n)||!Number.isFinite(i))return 0;let o=n-(n-e),s=i-(i-t),a=e-o,c=t-s;return o*s-r+o*c+a*s+a*c}function VC(e,t,r,n,i,o,s){let a=Math.sin(r),c=Math.cos(r);return Dc(e,t,r,n*c+i*a-o*Math.hypot(c,s*a))}function Dc(e,t,r,n){return!Number.isFinite(t)||!Number.isFinite(r)||!Number.isFinite(n)?!1:(e.x=t,e.y=r,e.z=n,!0)}var nd,Kb=w(()=>{nd=Number.EPSILON});function Xb(e){return ArrayBuffer.isView(e)?kC.call(e):void 0}var kC,Zb=w(()=>{kC=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag).get});function id(e){return Xb(e)==="Uint16Array"}var Jb=w(()=>{Zb()});function od(){return Fc??Uint16Array}var Fc,Qb=w(()=>{Fc=globalThis.Float16Array});var tx=w(()=>{Jb();Qb()});var ex=w(()=>{tx()});var rx=w(()=>{Eg()});var t1=w(()=>{Zf()});var nx=w(()=>{ed()});var ix=w(()=>{bh()});var ox=w(()=>{Lc()});var sx=w(()=>{Jf()});function e1(e={}){let t=e.depthRange??"negative-one-to-one";if(t!=="negative-one-to-one"&&t!=="zero-to-one")throw new RangeError("Unknown depth range");let r=t==="zero-to-one"?0:-1;return e.reversedDepth?[1,r]:[r,1]}var ax=w(()=>{});var qt=w(()=>{eb();hb();yb();Rb();$b();ug();wg();ma();Yb();Kb();ex();rx();t1();nx();ix();ox();sx();t1();ax()});var eo,W7,cx=w(()=>{eo=6356752314245179e-9,W7={radii:[6378137,6378137,eo],radiiSquared:[6378137*6378137,6378137*6378137,eo*eo],oneOverRadii:[1/6378137,1/6378137,1/eo],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(eo*eo)],maximumRadius:Math.max(6378137,6378137,eo),centerToleranceSquared:.1}});function r1(e){return e}function ro(e,t=[],r=r1){return"longitude"in e?(t[0]=r(e.longitude),t[1]=r(e.latitude),t[2]=e.height):"x"in e?(t[0]=r(e.x),t[1]=r(e.y),t[2]=e.z):(t[0]=r(e[0]),t[1]=r(e[1]),t[2]=e[2]),t}function lx(e,t=[]){return ro(e,t,ie._cartographicRadians?r1:dg)}function n1(e,t,r,n){let i=ie._cartographicRadians?r1:mg,o=i(e),s=i(t);return"longitude"in n?(n.longitude=o,n.latitude=s,n.height=r):"x"in n?(n.x=o,n.y=s,n.z=r):(n[0]=o,n[1]=s,n[2]=r),n}var Y7,hx=w(()=>{qt();Y7=new I});function Ri(e,t,r,n,i,o,s){let c=[n,i,o,Math.abs(e),Math.abs(t),Math.abs(r)].map(S=>{let E=S.toString(2),N=E.indexOf(".");return{integer:BigInt("0b"+E.replace(".","")),exponent:N<0?0:N+1-E.length}}),l=Math.min(...c.filter(S=>S.integer!==0n).map(S=>S.exponent)),h=c.map(S=>S.integer<<BigInt(S.exponent-l)),u=h.slice(0,3).map(S=>S*S),f=u.reduce((S,E)=>S<E?S:E),d=u.map(S=>S-f),m=u.map((S,E)=>h[E]*h[E+3]),p=64;if(!m.some((S,E)=>d[E]===0n&&S!==0n)){let S=-1n,E=1n;for(let C=0;C<3;C++){if(d[C]===0n)continue;let R=d[C]*d[C];S=S*R+m[C]*m[C]*E,E*=R}if(S<0n)return!1;if(S===0n)return T(0n,1n);let B=d.filter(C=>C>0n).reduce((C,R)=>C<R?C:R);p=Math.max(64,(2n*(E+S)).toString(2).length-(S*B).toString(2).length+128)}let g=1n<<BigInt(p),y=d.map(S=>S*g),_=m.map(S=>S*g),M=_.map(S=>S*S),b=0n,v=_.reduce((S,E)=>S+E,0n);if(v===0n)return!1;for(let S=0;S<4096;S++){let E=b+v>>1n;if(E===b)return!1;let N=y[0]+E,B=y[1]+E,C=y[2]+E,R=N*N,W=B*B,j=C*C,A=M[0]*W*j+M[1]*R*j+M[2]*R*W-R*W*j;if(A===0n)return T(E,g);if(A>0n?b=E:v=E,b>0n&&v-b<=b>>60n)return T(b+v>>1n,g)}return!1;function T(S,E){let N=u.map((W,j)=>{let A=d[j]*E+S;return A===0n?0:i1(W*h[j+3]*E,A,l)});if(!N.every(Number.isFinite))return!1;let B=Math.sign(e)*N[0],C=Math.sign(t)*N[1],R=Math.sign(r)*N[2];return s.x=B,s.y=C,s.z=R,!0}}function i1(e,t,r){if(e===0n)return 0;let n=52-(e.toString(2).length-t.toString(2).length),i=n>=0?e<<BigInt(n):e,o=n>=0?t:t<<BigInt(-n),s=i/o,a=i%o;(2n*a>o||2n*a===o&&s&1n)&&s++;let c=r-n,l=Math.max(-1022,Math.min(1023,c));return Number(s)*2**l*2**(c-l)}var o1=w(()=>{});function ux(e,t,r,n,i,o,s){let a=Math.min(n,i,o),c=a*a,l=n*n,h=i*i,u=o*o;if(!(a>0)||!(c>0)||!Number.isFinite(Math.max(l,h,u)))return!1;let f=pa(a,a,c),d=l-c,m=h-c,p=u-c,g=no(l,-c,d)+pa(n,n,l)-f,y=no(h,-c,m)+pa(i,i,h)-f,_=no(u,-c,p)+pa(o,o,u)-f,M=n*Math.abs(e),b=i*Math.abs(t),v=o*Math.abs(r);if(c<2**-1022||e!==0&&M<2**-1022||t!==0&&b<2**-1022||r!==0&&v<2**-1022)return Ri(e,t,r,n,i,o,s);let T=pa(n,Math.abs(e),M),S=pa(i,Math.abs(t),b),E=pa(o,Math.abs(r),v);if(Math.hypot(d===0?M===0?0:1/0:M/(d+g),m===0?b===0?0:1/0:b/(m+y),p===0?v===0?0:1/0:v/(p+_))<=1+64*Number.EPSILON)return Ri(e,t,r,n,i,o,s);if((e!==0?1:0)+(t!==0?1:0)+(r!==0?1:0)==1)return s.x=e===0?e:Math.sign(e)*n,s.y=t===0?t:Math.sign(t)*i,s.z=r===0?r:Math.sign(r)*o,!0;let B=Math.hypot(d===0?M:0,m===0?b:0,p===0?v:0),C=Math.hypot(M,b,v);if(!(C>0)||!Number.isFinite(C))return Ri(e,t,r,n,i,o,s);let R=B>0?B:C;for(let W=0;W<512;W++){let j=d+R,A=m+R,P=p+R,D=no(d,R,j)+g,F=no(m,R,A)+y,L=no(p,R,P)+_,O=M/j,V=b/A,yt=v/P,Dt,X;O>=V&&O>=yt?(Dt=s1(M,T,d,g,R,j)*(O+1),X=(V*(1-F/A))**2+(yt*(1-L/P))**2):V>=yt?(Dt=s1(b,S,m,y,R,A)*(V+1),X=(O*(1-D/j))**2+(yt*(1-L/P))**2):(Dt=s1(v,E,p,_,R,P)*(yt+1),X=(O*(1-D/j))**2+(V*(1-F/A))**2);let xt=-2*(O*O/j+V*V/A+yt*yt/P),et=4*Number.EPSILON*(Math.abs(Dt)+X),dt=Dt+X;if(!Number.isFinite(dt))return Ri(e,t,r,n,i,o,s);if(Math.abs(dt)<=4*Number.EPSILON*(Math.abs(Dt)+X)||C-B<=4*Number.EPSILON*R){let Rt=et/Math.abs(xt);if(!Number.isFinite(xt)||!(Math.abs(xt)>0)||Rt>2e-13*R)return Ri(e,t,r,n,i,o,s);let zt=Math.sign(e)*n*(O*(1-D/j)),Wt=Math.sign(t)*i*(V*(1-F/A)),ee=Math.sign(r)*o*(yt*(1-L/P)),Jt=2*Rt*Math.max(Math.abs(zt/j),Math.abs(Wt/A),Math.abs(ee/P));return!Number.isFinite(Jt)||Jt>2e-13*Math.max(n,i,o)?Ri(e,t,r,n,i,o,s):!Number.isFinite(zt)||!Number.isFinite(Wt)||!Number.isFinite(ee)?Ri(e,t,r,n,i,o,s):(s.x=zt,s.y=Wt,s.z=ee,!0)}dt>0?B=R:C=R;let St=R-dt/xt,k=St>B&&St<C?St:B+(C-B)/2;if(k===R)return Ri(e,t,r,n,i,o,s);R=k}return Ri(e,t,r,n,i,o,s)}function s1(e,t,r,n,i,o){let s=e-r,a=no(e,-r,s)+t-n,c=s+a,l=no(s,a,c),h=c-i;return(h+(no(c,-i,h)+l))/o}function no(e,t,r){let n=r-e;return e-(r-n)+(t-n)}function pa(e,t,r){let n=134217729*e,i=134217729*t;if(!Number.isFinite(n)||!Number.isFinite(i))return 0;let o=n-(n-e),s=i-(i-t),a=e-o,c=t-s;return o*s-r+o*c+a*s+a*c}var fx=w(()=>{o1()});function dx(e,t,r=[]){let n=e,i="x"in e?n.x:e[0],o="x"in e?n.y:e[1],s="x"in e?n.z:e[2];if(!Number.isFinite(i)||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(i*i+o*o+s*s))return;let{radii:a}=t;if(ux(i,o,s,a.x,a.y,a.z,sd))return Ci(r,sd.x,sd.y,sd.z)}function Ci(e,t,r,n){if(Vn(e))e[0]=t,e[1]=r,e[2]=n;else{let i=e;i.x=t,i.y=r,i.z=n}return e}var sd,mx=w(()=>{qt();fx();sd={x:0,y:0,z:0}});function px(e,t){if(!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0||t>e)throw new Error("Spheroid requires finite positive axes with semiMinorAxis <= semiMajorAxis")}function ld(e,t,r,n){let i=Math.max(Math.abs(e),Math.abs(t),Math.abs(r));if(!(i>0)||!Number.isFinite(i))return;let o=e/i,s=t/i,a=r/i,c=Math.hypot(o,s,a);return Ci(n,o/c,s/c,a/c)}var tn,ad,QC,kn,cd,pt,hd=w(()=>{qt();qt();cx();hx();mx();tn={x:0,y:0,z:0},ad=new I,QC=new I,kn=new I,cd=new I,pt=class e{static fromSpheroid(t){let{semiMajorAxis:r,semiMinorAxis:n}=t;return px(r,n),new e(r,r,n)}constructor(t=0,r=0,n=0){this.centerToleranceSquared=we.EPSILON1,pr(Number.isFinite(t)&&t>=0),pr(Number.isFinite(r)&&r>=0),pr(Number.isFinite(n)&&n>=0),this.radii=new I(t,r,n),this.radiiSquared=new I(t*t,r*r,n*n),this.radiiToTheFourth=new I(t*t*t*t,r*r*r*r,n*n*n*n),this.oneOverRadii=new I(t===0?0:1/t,r===0?0:1/r,n===0?0:1/n),this.oneOverRadiiSquared=new I(t===0?0:1/(t*t),r===0?0:1/(r*r),n===0?0:1/(n*n)),this.minimumRadius=Math.min(t,r,n),this.maximumRadius=Math.max(t,r,n),n!==0&&(this.squaredXOverSquaredZ=(t/n)**2),t===r&&n>0&&n<=t&&Number.isFinite(this.radiiSquared.x)&&this.radiiSquared.z>0&&(this.spheroidGeometry=Object.freeze({semiMajorAxis:t,semiMinorAxis:n,eccentricitySquared:1-(n/t)**2})),Object.freeze(this.radii),Object.freeze(this.radiiSquared),Object.freeze(this.radiiToTheFourth),Object.freeze(this.oneOverRadii),Object.freeze(this.oneOverRadiiSquared),Object.freeze(this)}toSpheroid(){let{x:t,y:r,z:n}=this.radii;if(t!==r)throw new Error("Spheroid requires equal X/Y radii");return px(t,n),Object.freeze({semiMajorAxis:t,semiMinorAxis:n})}equals(t){return this===t||!!(t&&this.radii.equals(t.radii))}toString(){return this.radii.toString()}cartographicToCartesian(t,r=[0,0,0]){let n=lx(t,cd),i=n[0],o=n[1],s=n[2];if(!Number.isFinite(i)||!Number.isFinite(o)||!Number.isFinite(s)||!(this.minimumRadius>0)||!Number.isFinite(this.maximumRadius*this.maximumRadius))return;if(this.spheroidGeometry&&(ie._cartographicRadians||Math.abs(o)<=Math.PI/4))return tn.x=i,tn.y=o,tn.z=s,vh(tn,this.spheroidGeometry)?Ci(r,tn.x,tn.y,tn.z):void 0;let a=QC;this.geodeticSurfaceNormalCartographic(t,a);let c=a.x,l=a.y,h=a.z,u=this.radii.x,f=this.radii.y,d=this.radii.z,m=Math.hypot(u*c,f*l,d*h),p=u*(u*c/m)+s*c,g=f*(f*l/m)+s*l,y=d*(d*h/m)+s*h;if(!(!Number.isFinite(p)||!Number.isFinite(g)||!Number.isFinite(y)))return Ci(r,p,g,y)}cartesianToCartographic(t,r=[0,0,0]){let n=t,i="x"in t?n.x:t[0],o="x"in t?n.y:t[1],s="x"in t?n.z:t[2];if(!Number.isFinite(i)||!Number.isFinite(o)||!Number.isFinite(s))return;if(this.spheroidGeometry&&Number.isFinite(i*i+o*o+s*s)&&Number.isFinite(this.oneOverRadiiSquared.x)&&Number.isFinite(this.oneOverRadiiSquared.z)){tn.x=i,tn.y=o,tn.z=s;let _=this.spheroidGeometry;if(!(s===0&&_.semiMinorAxis<_.semiMajorAxis&&Math.abs(Math.hypot(i,o)-_.semiMajorAxis*_.eccentricitySquared)<=64*Number.EPSILON*_.semiMajorAxis)&&Eh(tn,_)){let b=i===0&&o===0?Math.atan2(o,i):tn.x;return n1(b,tn.y,tn.z,r)}}if(!(this.minimumRadius>0)||!Number.isFinite(this.maximumRadius*this.maximumRadius)||!Number.isFinite(1/(this.minimumRadius*this.minimumRadius)))return;cd.set(i,o,s);let a=this.scaleToGeodeticSurface(cd,kn);if(!a)return;let c=a[0]*this.oneOverRadiiSquared.x,l=a[1]*this.oneOverRadiiSquared.y,h=a[2]*this.oneOverRadiiSquared.z,u=Math.hypot(c,l,h);if(!(u>0)||!Number.isFinite(u))return;let f=c/u,d=l/u,m=h/u,p=Math.atan2(d,f),g=Math.atan2(m,Math.hypot(f,d)),y=(i-a[0])*f+(o-a[1])*d+(s-a[2])*m;return n1(p,g,y,r)}geocentricSurfaceNormal(t,r=[0,0,0]){ro(t,ad);let n=ad;return ld(n.x,n.y,n.z,r)}geodeticSurfaceNormalCartographic(t,r=[0,0,0]){let n=ro(t,cd),i=ie._cartographicRadians?n[0]:n[0]*Math.PI/180,o=ie._cartographicRadians?n[1]:n[1]*Math.PI/180,s=!ie._cartographicRadians&&Math.abs(n[1])>45,a=(90-Math.abs(n[1]))*Math.PI/180,c=s?Math.sin(a):Math.abs(o)===Math.PI/2?0:Math.cos(o),l=s?Math.sign(n[1])*Math.cos(a):Math.sin(o);return ld(c*Math.cos(i),c*Math.sin(i),l,r)}geodeticSurfaceNormal(t,r=[0,0,0]){if(!(this.minimumRadius>0))return;ro(t,ad);let n=ad,i=Math.max(Math.abs(n.x),Math.abs(n.y),Math.abs(n.z));if(!(i>0)||!Number.isFinite(i))return;let o=n.x/i*(this.minimumRadius/this.radii.x)**2,s=n.y/i*(this.minimumRadius/this.radii.y)**2,a=n.z/i*(this.minimumRadius/this.radii.z)**2;if((n.x===0||Math.abs(o)>=2**-1022)&&(n.y===0||Math.abs(s)>=2**-1022)&&(n.z===0||Math.abs(a)>=2**-1022))return ld(o,s,a,r);let c=n.x===0?0:Math.min(1023,Math.floor(Math.log2(Math.abs(n.x)))),l=n.y===0?0:Math.min(1023,Math.floor(Math.log2(Math.abs(n.y)))),h=n.z===0?0:Math.min(1023,Math.floor(Math.log2(Math.abs(n.z)))),u=Math.min(1023,Math.floor(Math.log2(this.radii.x))),f=Math.min(1023,Math.floor(Math.log2(this.radii.y))),d=Math.min(1023,Math.floor(Math.log2(this.radii.z))),m=Math.max(n.x===0?-1/0:c-2*u,n.y===0?-1/0:l-2*f,n.z===0?-1/0:h-2*d);return ld(n.x===0?n.x:n.x/2**c/(this.radii.x/2**u)**2*2**(c-2*u-m),n.y===0?n.y:n.y/2**l/(this.radii.y/2**f)**2*2**(l-2*f-m),n.z===0?n.z:n.z/2**h/(this.radii.z/2**d)**2*2**(h-2*d-m),r)}scaleToGeodeticSurface(t,r){return dx(t,this,r)}scaleToGeocentricSurface(t,r=[0,0,0]){ro(t,kn);let n=kn,i=Math.max(Math.abs(n.x),Math.abs(n.y),Math.abs(n.z));if(!(this.minimumRadius>0)||!(i>0)||!Number.isFinite(i))return;let o=n.x*n.x*this.oneOverRadiiSquared.x+n.y*n.y*this.oneOverRadiiSquared.y+n.z*n.z*this.oneOverRadiiSquared.z;if(o>=2**-1022&&Number.isFinite(o)&&i*i>=2**-1022&&Number.isFinite(i*i)){let h=1/Math.sqrt(o);return Ci(r,n.x*h,n.y*h,n.z*h)}let s=n.x/i,a=n.y/i,c=n.z/i,l=Math.hypot(s/this.radii.x,a/this.radii.y,c/this.radii.z);if(!(!(l>0)||!Number.isFinite(l)))return Ci(r,s/l,a/l,c/l)}transformPositionToScaledSpace(t,r=[0,0,0]){ro(t,kn);let n=kn.scale(this.oneOverRadii);return Ci(r,n.x,n.y,n.z)}transformPositionFromScaledSpace(t,r=[0,0,0]){ro(t,kn);let n=kn.scale(this.radii);return Ci(r,n.x,n.y,n.z)}getSurfaceNormalIntersectionWithZAxis(t,r=0,n=[0,0,0]){if(pr(this.radii.x===this.radii.y&&this.minimumRadius>0),ro(t,kn),!Number.isFinite(kn.x)||!Number.isFinite(kn.y)||!Number.isFinite(kn.z)||!Number.isFinite(r))return;let i=kn.z*(1-this.squaredXOverSquaredZ);if(Number.isFinite(i)&&!(Math.abs(i)>=this.radii.z-r))return Ci(n,0,0,i)}};pt.WGS84=new pt(6378137,6378137,eo)});var Th,gx,en,a1=w(()=>{qt();qt();Th=new I,gx=new I,en=class e{constructor(t=[0,0,0],r=0){this.radius=-0,this.center=new I,this.fromCenterRadius(t,r)}fromCenterRadius(t,r){return this.center.from(t),this.radius=r,this}fromCornerPoints(t,r){return r=Th.from(r),this.center=new I().from(t).add(r).scale(.5),this.radius=this.center.distance(r),this}equals(t){return this===t||!!t&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new e(this.center,this.radius)}union(t){let r=this.center,n=this.radius,i=t.center,o=t.radius,s=Th.copy(i).subtract(r),a=s.magnitude();if(n>=a+o)return this.clone();if(o>=a+n)return t.clone();let c=(n+a+o)*.5;return gx.copy(s).scale((-n+c)/a).add(r),this.center.copy(gx),this.radius=c,this}expand(t){let n=Th.from(t).subtract(this.center).magnitude();return n>this.radius&&(this.radius=n),this}transform(t){this.center.transform(t);let r=Dg(Th,t);return this.radius=Math.max(r[0],Math.max(r[1],r[2]))*this.radius,this}distanceSquaredTo(t){let r=this.distanceTo(t);return r*r}distanceTo(t){let n=Th.from(t).subtract(this.center);return Math.max(0,n.len()-this.radius)}intersectPlane(t){let r=this.center,n=this.radius,o=t.normal.dot(r)+t.distance;return o<-n?"outside":o<n?"intersecting":"inside"}}});var t8,e8,ud,fd,dd,r8,n8,io,oo,yx=w(()=>{qt();a1();t8=new I,e8=new I,ud=new I,fd=new I,dd=new I,r8=new I,n8=new I,io={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},oo=class e{constructor(t=[0,0,0],r=[0,0,0,0,0,0,0,0,0]){this.center=new I().from(t),this.halfAxes=new Qr(r)}get halfSize(){let t=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2);return[new I(t).len(),new I(r).len(),new I(n).len()]}clone(){return new e(this.center,this.halfAxes)}equals(t){return this===t||!!t&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new en){let r=this.halfAxes,n=r.getColumn(0,ud),i=r.getColumn(1,fd),o=r.getColumn(2,dd),s=t8.copy(n).add(i).add(o);return t.center.copy(this.center),t.radius=s.magnitude(),t}intersectPlane(t){let r=this.center,n=t.normal,i=this.halfAxes,o=n.x,s=n.y,a=n.z,c=Math.abs(o*i[io.COLUMN0ROW0]+s*i[io.COLUMN0ROW1]+a*i[io.COLUMN0ROW2])+Math.abs(o*i[io.COLUMN1ROW0]+s*i[io.COLUMN1ROW1]+a*i[io.COLUMN1ROW2])+Math.abs(o*i[io.COLUMN2ROW0]+s*i[io.COLUMN2ROW1]+a*i[io.COLUMN2ROW2]),l=n.dot(r)+t.distance;return l<=-c?"outside":l>=c?"inside":"intersecting"}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r=e8.from(t).subtract(this.center),n=this.halfAxes,i=n.getColumn(0,ud),o=n.getColumn(1,fd),s=n.getColumn(2,dd),a=i.magnitude(),c=o.magnitude(),l=s.magnitude();i.normalize(),o.normalize(),s.normalize();let h=0,u;return u=Math.abs(r.dot(i))-a,u>0&&(h+=u*u),u=Math.abs(r.dot(o))-c,u>0&&(h+=u*u),u=Math.abs(r.dot(s))-l,u>0&&(h+=u*u),h}computePlaneDistances(t,r,n=[-0,-0]){let i=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,s=this.center,a=this.halfAxes,c=a.getColumn(0,ud),l=a.getColumn(1,fd),h=a.getColumn(2,dd),u=r8.copy(c).add(l).add(h).add(s),f=n8.copy(u).subtract(t),d=r.dot(f);return i=Math.min(d,i),o=Math.max(d,o),u.copy(s).add(c).add(l).subtract(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),u.copy(s).add(c).subtract(l).add(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),u.copy(s).add(c).subtract(l).subtract(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),s.copy(u).subtract(c).add(l).add(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),s.copy(u).subtract(c).add(l).subtract(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),s.copy(u).subtract(c).subtract(l).add(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),s.copy(u).subtract(c).subtract(l).subtract(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),n[0]=i,n[1]=o,n}transform(t){this.center.transformAsPoint(t);let r=this.halfAxes.getColumn(0,ud);r.transformAsPoint(t);let n=this.halfAxes.getColumn(1,fd);n.transformAsPoint(t);let i=this.halfAxes.getColumn(2,dd);return i.transformAsPoint(t),this.halfAxes=new Qr([...r,...n,...i]),this}getTransform(){throw new Error("not implemented")}}});var wx,_x,Ge,md=w(()=>{qt();wx=new I,_x=new I,Ge=class e{constructor(t=[0,0,1],r=0){this.normal=new I,this.distance=-0,this.fromNormalDistance(t,r)}fromNormalDistance(t,r){return pr(Number.isFinite(r)),this.normal.from(t).normalize(),this.distance=r,this}fromPointNormal(t,r){t=wx.from(t),this.normal.from(r).normalize();let n=-this.normal.dot(t);return this.distance=n,this}fromCoefficients(t,r,n,i){return this.normal.set(t,r,n),pr(ko(this.normal.len(),1)),this.distance=i,this}clone(){return new e(this.normal,this.distance)}equals(t){return ko(this.distance,t.distance)&&ko(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let r=_x.copy(this.normal).transformAsVector(t).normalize(),n=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(n,r)}projectPointOntoPlane(t,r=[0,0,0]){let n=wx.from(t),i=this.getPointDistance(n),o=_x.copy(this.normal).scale(i);return n.subtract(o).to(r)}intersectWithRay(t,r=new I){let n=t.origin,i=t.direction,o=this.normal,s=o.dot(i);if(Math.abs(s)<we.EPSILON15)return;let a=(-this.distance-o.dot(n))/s;if(!(a<0))return r.copy(i).multiplyByScalar(a).add(n)}}});function Mx(e,t={}){if(e.length!==16||Array.from(e).some(g=>!Number.isFinite(g)))throw new RangeError("Expected a finite view-projection matrix");let[r,n]=e1(t),i=Math.min(r,n),o=Math.max(r,n),s=g=>[e[g],e[g+4],e[g+8],e[g+12]],a=s(0),c=s(1),l=s(2),h=s(3),u=(g,y,_)=>g.map((M,b)=>M+_*y[b]),f=u(l,h,-i),d=h.map((g,y)=>o*g-l[y]),m=[u(h,a,1),u(h,a,-1),u(h,c,1),u(h,c,-1),...t.reversedDepth?[d,f]:[f,d]],p=[];for(let[g,y,_,M]of m){let b=Math.hypot(g,y,_);if(b===0){if(M<0)throw new RangeError("Empty clipping volume")}else p.push(new Ge([g/b,y/b,_/b],M/b))}if(p.length<4)throw new RangeError("Degenerate clipping volume");return p}var bx=w(()=>{qt();md()});var xx,Sx,i8,sr,vx=w(()=>{qt();bx();md();xx=[new I([1,0,0]),new I([0,1,0]),new I([0,0,1])],Sx=new I,i8=new I,sr=class e{constructor(t=[]){this.planes=t}fromBoundingSphere(t){this.planes.length=2*xx.length;let r=t.center,n=t.radius,i=0;for(let o of xx){let s=this.planes[i],a=this.planes[i+1];s||(s=this.planes[i]=new Ge),a||(a=this.planes[i+1]=new Ge);let c=Sx.copy(o).scale(-n).add(r);s.fromPointNormal(c,o);let l=Sx.copy(o).scale(n).add(r),h=i8.copy(o).negate();a.fromPointNormal(l,h),i+=2}return this}fromViewProjection(t,r={}){let n=Mx(t,r);return this.planes.splice(0,this.planes.length,...n),this}computeVisibility(t){let r="inside";for(let n of this.planes)switch(t.intersectPlane(n)){case"outside":return"outside";case"intersecting":r="intersecting";break;default:}return r}computeVisibilityWithPlaneMask(t,r){if(pr(Number.isFinite(r),"parentPlaneMask is required."),r===e.MASK_OUTSIDE||r===e.MASK_INSIDE)return r;let n=e.MASK_INSIDE,i=this.planes;for(let o=0;o<this.planes.length;++o){let s=o<31?1<<o:0;if(o<31&&(r&s)===0)continue;let a=i[o],c=t.intersectPlane(a);if(c==="outside")return e.MASK_OUTSIDE;c==="intersecting"&&(n|=s)}return n}};sr.MASK_OUTSIDE=4294967295;sr.MASK_INSIDE=0;sr.MASK_INDETERMINATE=2147483647});var so=w(()=>{a1();yx();vx();md()});function c1(e,t,r){let n=Ex*e,i=Ex*t,o=n-(n-e),s=e-o,a=i-(i-t),c=t-a;return o*a-r+o*c+s*a+s*c}function Tx(e,t,r){let n=r-e;return e-(r-n)+(t-n)}function o8(e){return 2**Math.min(1023,Math.floor(Math.log2(e)))}function l1(e,t,r,n,i,o){let s=Math.max(Math.abs(e),Math.abs(t),Math.abs(r));if(s===0)return 0;let a=o8(s),c=e/a,l=t/a,h=r/a,u=c*n,f=l*i,d=h*o,m=u+f,p=m+d;return(p+(Tx(u,f,m)+Tx(m,d,p)+c1(c,n,u)+c1(l,i,f)+c1(h,o,d)))*a}function Ix(e,t,r,n,i,o,s){let c=(s?[s,s,s,s,0,0,0,1,0,0,0,1,1,0,0,o[0],o[1]]:[...e,...t,...r,...n,...i,...o]).map(T=>{let[S,E=""]=Math.abs(T).toString(2).split(".");return(T<0?-1n:1n)*BigInt("0b"+S+E)<<BigInt(1074-E.length)}),l=1n<<1074n,h=1n<<64n,u=[c[1]*c[2],c[0]*c[2],c[0]*c[1]],f=[0,1,2].map(T=>(c[3+T]*l+c[6+T]*c[15]+c[9+T]*c[16])*u[T]),d=c.slice(12,15).map((T,S)=>T*u[S]),m=(T,S)=>T.reduce((E,N,B)=>E+N*S[B],0n),p=m(d,d),g=m(d,f),y=m(f,f)-(c[0]*c[1]*c[2]*l)**2n,_=g*g-p*y;if(p===0n||_<0n)return;let M=_<<128n,b=M===0n?0n:1n<<BigInt(Math.ceil(M.toString(2).length/2));if(b)for(;;){let T=b+M/b>>1n;if(T>=b)break;b=T}let v=f.map((T,S)=>s8(T*p*h+d[S]*(b-g*h),p*h*u[S]));return s?v.map((T,S)=>r[S]*v[1]+n[S]*v[2]+i[S]*v[0]):v}function s8(e,t){return Math.sign(Number(e))*i1(e<0n?-e:e,t,-2148)}var Ex,Ax=w(()=>{o1();Ex=134217729});function pd(e,t){if(e.length!==t)throw new RangeError(`Expected ${t} finite coordinates`);for(let r=0;r<t;r++)if(!Number.isFinite(e[r]))throw new RangeError(`Expected ${t} finite coordinates`)}function Px(e){if(e!=="normal"&&e!=="radial")throw new RangeError("Invalid tangent-plane mode")}function Rx(e,t,r,n,i,o){let s=t*e.xAxis[0]+r*e.xAxis[1]+n*e.xAxis[2],a=t*e.yAxis[0]+r*e.yAxis[1]+n*e.yAxis[2];if(o!==void 0&&Math.abs((s/o)**2+(a/o)**2-1)<=32*Number.EPSILON&&(s=l1(t,r,n,e.xAxis[0],e.xAxis[1],e.xAxis[2]),a=l1(t,r,n,e.yAxis[0],e.yAxis[1],e.yAxis[2])),!(!Number.isFinite(s)||!Number.isFinite(a)))return i.set(s,a)}function h1(e,t,r,n){if([e,t,r].every(Number.isFinite))return n.set(e,t,r)}var gd,Cx=w(()=>{qt();so();hd();Ax();gd=class{constructor(t,r=pt.WGS84){if(pd(t,3),this.radii=Object.freeze(Array.from(r.radii)),this.radii[0]===this.radii[1]&&this.radii[1]===this.radii[2]&&(this.radius=this.radii[0]),!this.radii.every(s=>s>0&&Number.isFinite(s)))throw new RangeError("Tangent plane requires positive finite ellipsoid radii");let n=r.scaleToGeodeticSurface(Array.from(t),new I);if(!n)throw new RangeError("Origin has no unique ellipsoid surface point");this.anchor=new I(n);let i=new I(r.geodeticSurfaceNormal(n));if(!i.every(Number.isFinite)||!(i.len()>0))throw new RangeError("Cannot resolve tangent-plane normal");i.normalize();let o=Math.hypot(i[0],i[1]);this.east=o>0?new I(-i[1]/o,i[0]/o,0):new I(0,1,0),this.north=new I(i).cross(this.east).normalize(),this._plane=new Ge().fromPointNormal(this.anchor,i)}projectPointToNearestOnPlane(t,r=new Jr){pd(t,3);let n=t[0]-this.anchor[0],i=t[1]-this.anchor[1],o=t[2]-this.anchor[2],s=Rx(this,n,i,o,r,this.radius);if(!s)throw new RangeError("Tangent-plane projection overflow");return s}projectPointRadiallyOntoPlane(t,r=new Jr){pd(t,3);let n=Math.max(Math.abs(t[0]),Math.abs(t[1]),Math.abs(t[2]));if(n===0)return;let i=t[0]/n,o=t[1]/n,s=t[2]/n,a=Math.hypot(i,o,s),c=i/a,l=o/a,h=s/a,u=this.zAxis,f=c*u[0]+l*u[1]+h*u[2];if(f<=1e-14)return;let d=this.anchor.dot(u)/f;return Rx(this,c*d-this.anchor[0],l*d-this.anchor[1],h*d-this.anchor[2],r,this.radius)}projectPointOntoEllipsoid(t,r="radial",n=new I){pd(t,2),Px(r);let[i,o,s]=this.radii;if(r==="radial"){let E=Math.max(Math.abs(this.anchor[0]),Math.abs(this.anchor[1]),Math.abs(this.anchor[2]),Math.abs(t[0]),Math.abs(t[1])),N=t[0]/E,B=t[1]/E,C=this.anchor[0]/E+this.east[0]*N+this.north[0]*B,R=this.anchor[1]/E+this.east[1]*N+this.north[1]*B,W=this.anchor[2]/E+this.east[2]*N+this.north[2]*B,j=Math.min(i,o,s),A=C*(j/i),P=R*(j/o),D=W*(j/s),F=Math.hypot(A,P,D);return F>0&&Number.isFinite(F)?h1(i*(A/F),o*(P/F),s*(D/F),n):void 0}let a=this.zAxis,c=[this.anchor[0]+this.east[0]*t[0]+this.north[0]*t[1],this.anchor[1]+this.east[1]*t[0]+this.north[1]*t[1],this.anchor[2]+this.east[2]*t[0]+this.north[2]*t[1]];if(!c.every(Number.isFinite))return;let l=a[0]/i,h=a[1]/o,u=a[2]/s,f=c[0]/i,d=c[1]/o,m=c[2]/s,p=l*l+h*h+u*u,g=l*f+h*d+u*m,y=f*f+d*d+m*m-1,_=g*g,M=p*y,b=1e-6*(Math.abs(_)+Math.abs(M)),v=_-M;if(!(p>0)||!Number.isFinite(v)||Math.abs(v)<=b){let E=Ix(this.radii,this.anchor,this.east,this.north,a,t,this.radius);return E&&h1(E[0],E[1],E[2],n)}if(v<0)return;let T=Math.sqrt(Math.max(0,v)),S=g>0?-y/(g+T):(-g+T)/p;return h1(c[0]+S*a[0],c[1]+S*a[1],c[2]+S*a[2],n)}projectPointsFlat(t,r="normal",n){if(Px(r),t.length%3)throw new RangeError("Expected packed XYZ coordinates");let i=t.length/3,o=n||new Float64Array(i*2);if(o.length!==i*2)throw new RangeError("Invalid tangent-plane output length");if(ArrayBuffer.isView(t)&&t.buffer===o.buffer&&t.byteOffset<o.byteOffset+o.byteLength&&o.byteOffset<t.byteOffset+t.byteLength)throw new RangeError("Input and output buffers must not overlap");for(let l=0;l<t.length;l++)if(!Number.isFinite(t[l]))throw new RangeError("Expected finite coordinates");let s=new Uint8Array(i),a=new I,c=new Jr;for(let l=0;l<i;l++){a.set(t[l*3],t[l*3+1],t[l*3+2]);let h=r==="normal"?this.projectPointToNearestOnPlane(a,c):this.projectPointRadiallyOntoPlane(a,c);s[l]=h?1:0,o[l*2]=h?h[0]:NaN,o[l*2+1]=h?h[1]:NaN}return{positions:o,valid:s}}get plane(){return this._plane}get origin(){return this.anchor}get xAxis(){return this.east}get yAxis(){return this.north}get zAxis(){return this._plane.normal}}});var ke,Nx=w(()=>{ke={};ke.Constants={};ke.Math={};ke.Accumulator={};(function(e){"use strict";e.WGS84={a:6378137,f:1/298.257223563},e.version={major:2,minor:2,patch:0},e.version_string="2.2.0"})(ke.Constants);(function(e){"use strict";e.digits=53,e.epsilon=Math.pow(.5,e.digits-1),e.degree=Math.PI/180,e.sq=function(t){return t*t},e.hypot=function(t,r){return Math.sqrt(t*t+r*r)},e.cbrt=Math.cbrt||function(t){var r=Math.pow(Math.abs(t),.3333333333333333);return t>0?r:t<0?-r:t},e.log1p=Math.log1p||function(t){var r=1+t,n=r-1;return n===0?t:t*Math.log(r)/n},e.atanh=Math.atanh||function(t){var r=Math.abs(t);return r=e.log1p(2*r/(1-r))/2,t>0?r:t<0?-r:t},e.copysign=function(t,r){return Math.abs(t)*(r<0||r===0&&1/r<0?-1:1)},e.sum=function(t,r){var n=t+r,i=n-r,o=n-i,s;return i-=t,o-=r,s=n&&0-(i+o),{s:n,t:s}},e.polyval=function(t,r,n,i){for(var o=t<0?0:r[n++];--t>=0;)o=o*i+r[n++];return o},e.AngRound=function(t){var r=.0625,n=Math.abs(t);return n=n<r?r-(r-n):n,e.copysign(n,t)},e.remainder=function(t,r){return t%=r,t<-r/2?t+r:t<r/2?t:t-r},e.AngNormalize=function(t){var r=e.remainder(t,360);return Math.abs(r)===180?e.copysign(180,t):r},e.LatFix=function(t){return Math.abs(t)>90?NaN:t},e.AngDiff=function(t,r){var n=e.sum(e.remainder(-t,360),e.remainder(r,360)),i,o;return n=e.sum(e.remainder(n.s,360),n.t),i=n.s,o=n.t,(i===0||Math.abs(i)===180)&&(i=e.copysign(i,o===0?r-t:-o)),{d:i,e:o}},e.sincosd=function(t){var r,n,i,o,s,a,c;switch(r=t%360,i=Math.round(r/90),r-=90*i,n=r*this.degree,o=Math.sin(n),s=Math.cos(n),Math.abs(r)===45?(s=Math.sqrt(.5),o=e.copysign(s,n)):Math.abs(r)===30&&(s=Math.sqrt(.75),o=e.copysign(.5,n)),i&3){case 0:a=o,c=s;break;case 1:a=s,c=-o;break;case 2:a=-o,c=-s;break;default:a=-s,c=o;break}return c+=0,a===0&&(a=e.copysign(a,t)),{s:a,c}},e.sincosde=function(t,r){var n,i,o,s,a,c,l;switch(n=t%360,o=Math.round(n/90),n=e.AngRound(n-90*o+r),i=n*this.degree,s=Math.sin(i),a=Math.cos(i),Math.abs(n)===45?(a=Math.sqrt(.5),s=e.copysign(a,i)):Math.abs(n)===30&&(a=Math.sqrt(.75),s=e.copysign(.5,i)),o&3){case 0:c=s,l=a;break;case 1:c=a,l=-s;break;case 2:c=-s,l=-a;break;default:c=-a,l=s;break}return l+=0,c===0&&(c=e.copysign(c,t+r)),{s:c,c:l}},e.atan2d=function(t,r){var n=0,i;switch(Math.abs(t)>Math.abs(r)&&([t,r]=[r,t],n=2),e.copysign(1,r)<0&&(r=-r,++n),i=Math.atan2(t,r)/this.degree,n){case 1:i=e.copysign(180,t)-i;break;case 2:i=90-i;break;case 3:i=-90+i;break;default:break}return i}})(ke.Math);(function(e,t){"use strict";e.Accumulator=function(r){this.Set(r)},e.Accumulator.prototype.Set=function(r){r||(r=0),r.constructor===e.Accumulator?(this._s=r._s,this._t=r._t):(this._s=r,this._t=0)},e.Accumulator.prototype.Add=function(r){var n=t.sum(r,this._t),i=t.sum(n.s,this._s);n=n.t,this._s=i.s,this._t=i.t,this._s===0?this._s=n:this._t+=n},e.Accumulator.prototype.Sum=function(r){var n;return r?(n=new e.Accumulator(this),n.Add(r),n._s):this._s},e.Accumulator.prototype.Negate=function(){this._s*=-1,this._t*=-1},e.Accumulator.prototype.Remainder=function(r){this._s=t.remainder(this._s,r),this.Add(0)}})(ke.Accumulator,ke.Math);ke.Geodesic={};ke.GeodesicLine={};ke.PolygonArea={};(function(e,t,r,n,i){"use strict";var o=6,s=o,a=o,c=o,l=c,h,u,f=20,d=f+n.digits+10,m=n.epsilon,p=200*m,g=Math.sqrt(m),y=m,_=1e3*g,M=0,b=31,v=32640,T,S,E,N,B,C,R,W,j;e.tiny_=Math.sqrt(Number.MIN_VALUE/Number.EPSILON),e.nC1_=o,e.nC1p_=o,e.nC2_=o,e.nC3_=o,e.nC4_=o,h=e.nC3_*(e.nC3_-1)/2,u=e.nC4_*(e.nC4_+1)/2,e.CAP_C1=1,e.CAP_C1p=2,e.CAP_C2=4,e.CAP_C3=8,e.CAP_C4=16,e.NONE=0,e.ARC=64,e.LATITUDE=128|M,e.LONGITUDE=256|e.CAP_C3,e.AZIMUTH=512|M,e.DISTANCE=1024|e.CAP_C1,e.STANDARD=e.LATITUDE|e.LONGITUDE|e.AZIMUTH|e.DISTANCE,e.DISTANCE_IN=2048|e.CAP_C1|e.CAP_C1p,e.REDUCEDLENGTH=4096|e.CAP_C1|e.CAP_C2,e.GEODESICSCALE=8192|e.CAP_C1|e.CAP_C2,e.AREA=16384|e.CAP_C4,e.ALL=v|b,e.LONG_UNROLL=32768,e.OUT_MASK=v|e.LONG_UNROLL,e.SinCosSeries=function(A,P,D,F,L){if(L!==void 0){var O=L/2,V=Math.sin(O),yt=Math.cos(O);return-2*e.SinCosSeries(!1,D*yt-P*V,P*yt+D*V,F.map(function(St,k){return(k%2?-St:St)*Math.sin((2*k+1)*O)}))}var Dt=F.length,X=Dt-(A?1:0),xt=2*(D-P)*(D+P),et=X&1?F[--Dt]:0,dt=0;for(X=Math.floor(X/2);X--;)dt=xt*et-dt+F[--Dt],et=xt*dt-et+F[--Dt];return A?2*P*D*et:D*(et-dt)},T=function(A,P){var D,F=n.sq(A),L=n.sq(P),O=(F+L-1)/6,V,yt,Dt,X,xt,et,dt,St,k,Rt,zt;return L===0&&O<=0?D=0:(V=F*L/4,yt=n.sq(O),Dt=O*yt,X=V*(V+2*Dt),xt=O,X>=0?(et=V+Dt,et+=et<0?-Math.sqrt(X):Math.sqrt(X),dt=n.cbrt(et),xt+=dt+(dt!==0?yt/dt:0)):(St=Math.atan2(Math.sqrt(-X),-(V+Dt)),xt+=2*O*Math.cos(St/3)),k=Math.sqrt(n.sq(xt)+L),Rt=xt<0?L/(k-xt):xt+k,zt=(Rt-L)/(2*k),D=Rt/(Math.sqrt(Rt+n.sq(zt))+zt)),D},S=[1,4,64,0,256],e.A1m1f=function(A){var P=Math.floor(s/2),D=n.polyval(P,S,0,n.sq(A))/S[P+1];return(D+A)/(1-A)},E=[-1,6,-16,32,-9,64,-128,2048,9,-16,768,3,-5,512,-7,1280,-7,2048],e.C1f=function(A,P){var D=n.sq(A),F=A,L=0,O,V;for(O=1;O<=e.nC1_;++O)V=Math.floor((e.nC1_-O)/2),P[O]=F*n.polyval(V,E,L,D)/E[L+V+1],L+=V+2,F*=A},N=[205,-432,768,1536,4005,-4736,3840,12288,-225,116,384,-7173,2695,7680,3467,7680,38081,61440],e.C1pf=function(A,P){var D=n.sq(A),F=A,L=0,O,V;for(O=1;O<=e.nC1p_;++O)V=Math.floor((e.nC1p_-O)/2),P[O]=F*n.polyval(V,N,L,D)/N[L+V+1],L+=V+2,F*=A},B=[-11,-28,-192,0,256],e.A2m1f=function(A){var P=Math.floor(a/2),D=n.polyval(P,B,0,n.sq(A))/B[P+1];return(D-A)/(1+A)},C=[1,2,16,32,35,64,384,2048,15,80,768,7,35,512,63,1280,77,2048],e.C2f=function(A,P){var D=n.sq(A),F=A,L=0,O,V;for(O=1;O<=e.nC2_;++O)V=Math.floor((e.nC2_-O)/2),P[O]=F*n.polyval(V,C,L,D)/C[L+V+1],L+=V+2,F*=A},e.Geodesic=function(A,P){if(this.a=A,this.f=P,this._f1=1-this.f,this._e2=this.f*(2-this.f),this._ep2=this._e2/n.sq(this._f1),this._n=this.f/(2-this.f),this._b=this.a*this._f1,this._c2=(n.sq(this.a)+n.sq(this._b)*(this._e2===0?1:(this._e2>0?n.atanh(Math.sqrt(this._e2)):Math.atan(Math.sqrt(-this._e2)))/Math.sqrt(Math.abs(this._e2))))/2,this._etol2=.1*g/Math.sqrt(Math.max(.001,Math.abs(this.f))*Math.min(1,1-this.f/2)/2),!(isFinite(this.a)&&this.a>0))throw new Error("Equatorial radius is not positive");if(!(isFinite(this._b)&&this._b>0))throw new Error("Polar semi-axis is not positive");this._A3x=new Array(l),this._C3x=new Array(h),this._C4x=new Array(u),this.A3coeff(),this.C3coeff(),this.C4coeff()},R=[-3,128,-2,-3,64,-1,-3,-1,16,3,-1,-2,8,1,-1,2,1,1],e.Geodesic.prototype.A3coeff=function(){var A=0,P=0,D,F;for(D=c-1;D>=0;--D)F=Math.min(c-D-1,D),this._A3x[P++]=n.polyval(F,R,A,this._n)/R[A+F+1],A+=F+2},W=[3,128,2,5,128,-1,3,3,64,-1,0,1,8,-1,1,4,5,256,1,3,128,-3,-2,3,64,1,-3,2,32,7,512,-10,9,384,5,-9,5,192,7,512,-14,7,512,21,2560],e.Geodesic.prototype.C3coeff=function(){var A=0,P=0,D,F,L;for(D=1;D<e.nC3_;++D)for(F=e.nC3_-1;F>=D;--F)L=Math.min(e.nC3_-F-1,F),this._C3x[P++]=n.polyval(L,W,A,this._n)/W[A+L+1],A+=L+2},j=[97,15015,1088,156,45045,-224,-4784,1573,45045,-10656,14144,-4576,-858,45045,64,624,-4576,6864,-3003,15015,100,208,572,3432,-12012,30030,45045,1,9009,-2944,468,135135,5792,1040,-1287,135135,5952,-11648,9152,-2574,135135,-64,-624,4576,-6864,3003,135135,8,10725,1856,-936,225225,-8448,4992,-1144,225225,-1440,4160,-4576,1716,225225,-136,63063,1024,-208,105105,3584,-3328,1144,315315,-128,135135,-2560,832,405405,128,99099],e.Geodesic.prototype.C4coeff=function(){var A=0,P=0,D,F,L;for(D=0;D<e.nC4_;++D)for(F=e.nC4_-1;F>=D;--F)L=e.nC4_-F-1,this._C4x[P++]=n.polyval(L,j,A,this._n)/j[A+L+1],A+=L+2},e.Geodesic.prototype.A3f=function(A){return n.polyval(l-1,this._A3x,0,A)},e.Geodesic.prototype.C3f=function(A,P){var D=1,F=0,L,O;for(L=1;L<e.nC3_;++L)O=e.nC3_-L-1,D*=A,P[L]=D*n.polyval(O,this._C3x,F,A),F+=O+1},e.Geodesic.prototype.C4f=function(A,P){var D=1,F=0,L,O;for(L=0;L<e.nC4_;++L)O=e.nC4_-L-1,P[L]=D*n.polyval(O,this._C4x,F,A),F+=O+1,D*=A},e.Geodesic.prototype.Lengths=function(A,P,D,F,L,O,V,yt,Dt,X,xt,et,dt){xt&=e.OUT_MASK;var St={},k=0,Rt=0,zt=0,Wt=0,ee,Jt,ye,Be,Ue;if(xt&(e.DISTANCE|e.REDUCEDLENGTH|e.GEODESICSCALE)&&(zt=e.A1m1f(A),e.C1f(A,et),xt&(e.REDUCEDLENGTH|e.GEODESICSCALE)&&(Wt=e.A2m1f(A),e.C2f(A,dt),k=zt-Wt,Wt=1+Wt),zt=1+zt),xt&e.DISTANCE)ee=e.SinCosSeries(!0,O,V,et)-e.SinCosSeries(!0,D,F,et),St.s12b=zt*(P+ee),xt&(e.REDUCEDLENGTH|e.GEODESICSCALE)&&(Jt=e.SinCosSeries(!0,O,V,dt)-e.SinCosSeries(!0,D,F,dt),Rt=k*P+(zt*ee-Wt*Jt));else if(xt&(e.REDUCEDLENGTH|e.GEODESICSCALE)){for(ye=1;ye<=e.nC2_;++ye)dt[ye]=zt*et[ye]-Wt*dt[ye];Rt=k*P+(e.SinCosSeries(!0,O,V,dt)-e.SinCosSeries(!0,D,F,dt))}return xt&e.REDUCEDLENGTH?(St.m0=k,St.m12b=yt*(F*O)-L*(D*V)-F*V*Rt):St.m12b=NaN,xt&e.GEODESICSCALE&&(Be=F*V+D*O,Ue=this._ep2*(Dt-X)*(Dt+X)/(L+yt),St.M12=Be+(Ue*O-V*Rt)*D/L,St.M21=Be-(Ue*D-F*Rt)*O/yt),St},e.Geodesic.prototype.InverseStart=function(A,P,D,F,L,O,V,yt,Dt,X,xt){var et={},dt=F*P-L*A,St=L*P+F*A,k,Rt,zt,Wt,ee,Jt,ye,Be,Ue,Ft,Ot,Ut,Le,Qe,Uo,Go,Kl,Ai,Kt,Or,or,Xr,pn;return et.sig12=-1,k=F*P,k+=L*A,Rt=St>=0&&dt<.5&&L*V<.5,Rt?(Wt=n.sq(A+F),Wt/=Wt+n.sq(P+L),et.dnm=Math.sqrt(1+this._ep2*Wt),zt=V/(this._f1*et.dnm),ee=Math.sin(zt),Jt=Math.cos(zt)):(ee=yt,Jt=Dt),et.salp1=L*ee,et.calp1=Jt>=0?dt+L*A*n.sq(ee)/(1+Jt):k-L*A*n.sq(ee)/(1-Jt),Be=n.hypot(et.salp1,et.calp1),Ue=A*F+P*L*Jt,Rt&&Be<this._etol2?(et.salp2=P*ee,et.calp2=dt-P*F*(Jt>=0?n.sq(ee)/(1+Jt):1-Jt),ye=n.hypot(et.salp2,et.calp2),et.salp2/=ye,et.calp2/=ye,et.sig12=Math.atan2(Be,Ue)):Math.abs(this._n)>.1||Ue>=0||Be>=6*Math.abs(this._n)*Math.PI*n.sq(P)||(pn=Math.atan2(-yt,-Dt),this.f>=0?(Qe=n.sq(A)*this._ep2,Uo=Qe/(2*(1+Math.sqrt(1+Qe))+Qe),Ut=this.f*P*this.A3f(Uo)*Math.PI,Le=Ut*P,Ft=pn/Ut,Ot=k/Le):(Go=L*P-F*A,Kl=Math.atan2(k,Go),Or=this.Lengths(this._n,Math.PI+Kl,A,-P,D,F,L,O,P,L,e.REDUCEDLENGTH,X,xt),Ai=Or.m12b,Kt=Or.m0,Ft=-1+Ai/(P*L*Kt*Math.PI),Le=Ft<-.01?k/Ft:-this.f*n.sq(P)*Math.PI,Ut=Le/P,Ot=V/Ut),Ot>-p&&Ft>-1-_?this.f>=0?(et.salp1=Math.min(1,-Ft),et.calp1=-Math.sqrt(1-n.sq(et.salp1))):(et.calp1=Math.max(Ft>-p?0:-1,Ft),et.salp1=Math.sqrt(1-n.sq(et.calp1))):(or=T(Ft,Ot),Xr=Ut*(this.f>=0?-Ft*or/(1+or):-Ot*(1+or)/or),ee=Math.sin(Xr),Jt=-Math.cos(Xr),et.salp1=L*ee,et.calp1=k-L*A*n.sq(ee)/(1-Jt))),et.salp1<=0?(et.salp1=1,et.calp1=0):(ye=n.hypot(et.salp1,et.calp1),et.salp1/=ye,et.calp1/=ye),et},e.Geodesic.prototype.Lambda12=function(A,P,D,F,L,O,V,yt,Dt,X,xt,et,dt,St){var k={},Rt,zt,Wt,ee,Jt,ye,Be,Ue,Ft,Ot,Ut,Le,Qe;return A===0&&yt===0&&(yt=-e.tiny_),zt=V*P,Wt=n.hypot(yt,V*A),k.ssig1=A,ee=zt*A,k.csig1=Jt=yt*P,Rt=n.hypot(k.ssig1,k.csig1),k.ssig1/=Rt,k.csig1/=Rt,k.salp2=L!==P?zt/L:V,k.calp2=L!==P||Math.abs(F)!==-A?Math.sqrt(n.sq(yt*P)+(P<-A?(L-P)*(P+L):(A-F)*(A+F)))/L:Math.abs(yt),k.ssig2=F,ye=zt*F,k.csig2=Be=k.calp2*L,Rt=n.hypot(k.ssig2,k.csig2),k.ssig2/=Rt,k.csig2/=Rt,k.sig12=Math.atan2(Math.max(0,k.csig1*k.ssig2-k.ssig1*k.csig2),k.csig1*k.csig2+k.ssig1*k.ssig2),Ue=Math.max(0,Jt*ye-ee*Be),Ft=Jt*Be+ee*ye,Ut=Math.atan2(Ue*X-Ft*Dt,Ft*X+Ue*Dt),Le=n.sq(Wt)*this._ep2,k.eps=Le/(2*(1+Math.sqrt(1+Le))+Le),this.C3f(k.eps,St),Ot=e.SinCosSeries(!0,k.ssig2,k.csig2,St)-e.SinCosSeries(!0,k.ssig1,k.csig1,St),k.domg12=-this.f*this.A3f(k.eps)*zt*(k.sig12+Ot),k.lam12=Ut+k.domg12,xt&&(k.calp2===0?k.dlam12=-2*this._f1*D/A:(Qe=this.Lengths(k.eps,k.sig12,k.ssig1,k.csig1,D,k.ssig2,k.csig2,O,P,L,e.REDUCEDLENGTH,et,dt),k.dlam12=Qe.m12b,k.dlam12*=this._f1/(k.calp2*L))),k},e.Geodesic.prototype.Inverse=function(A,P,D,F,L){var O,V;return L||(L=e.STANDARD),L===e.LONG_UNROLL&&(L|=e.STANDARD),L&=e.OUT_MASK,O=this.InverseInt(A,P,D,F,L),V=O.vals,L&e.AZIMUTH&&(V.azi1=n.atan2d(O.salp1,O.calp1),V.azi2=n.atan2d(O.salp2,O.calp2)),V},e.Geodesic.prototype.InverseInt=function(A,P,D,F,L){var O={},V,yt,Dt,X,xt,et,dt,St,k,Rt,zt,Wt,ee,Jt,ye,Be,Ue,Ft,Ot,Ut,Le,Qe,Uo,Go,Kl,Ai,Kt,Or,or,Xr,pn,rf,nf,xc,ha,Xl,Zl,Jl,Ql,of,_0,Sc,M0,sf,b0,x0,S0,LM,v0,af,E0,cf,DM,th,FM,UM,eh,lf,rh,T0,I0,hf,uf,A0,P0;if(O.lat1=A=n.LatFix(A),O.lat2=D=n.LatFix(D),A=n.AngRound(A),D=n.AngRound(D),V=n.AngDiff(P,F),yt=V.e,V=V.d,L&e.LONG_UNROLL?(O.lon1=P,O.lon2=P+V+yt):(O.lon1=n.AngNormalize(P),O.lon2=n.AngNormalize(F)),Dt=n.copysign(1,V),V*=Dt,yt*=Dt,ye=V*n.degree,X=n.sincosde(V,yt),Be=X.s,Ue=X.c,yt=180-V-yt,xt=Math.abs(A)<Math.abs(D)||isNaN(D)?-1:1,xt<0&&(Dt*=-1,[D,A]=[A,D]),et=n.copysign(1,-A),A*=et,D*=et,X=n.sincosd(A),dt=this._f1*X.s,St=X.c,X=n.hypot(dt,St),dt/=X,St/=X,St=Math.max(e.tiny_,St),X=n.sincosd(D),k=this._f1*X.s,Rt=X.c,X=n.hypot(k,Rt),k/=X,Rt/=X,Rt=Math.max(e.tiny_,Rt),St<-dt?Rt===St&&(k=n.copysign(dt,k)):Math.abs(k)===-dt&&(Rt=St),ee=Math.sqrt(1+this._ep2*n.sq(dt)),Jt=Math.sqrt(1+this._ep2*n.sq(k)),Uo=new Array(e.nC1_+1),Go=new Array(e.nC2_+1),Kl=new Array(e.nC3_),Ai=A===-90||Be===0,Ai&&(Ot=Ue,Ut=Be,Le=1,Qe=0,Or=dt,or=Ot*St,Xr=k,pn=Le*Rt,Ft=Math.atan2(Math.max(0,or*Xr-Or*pn),or*pn+Or*Xr),Kt=this.Lengths(this._n,Ft,Or,or,ee,Xr,pn,Jt,St,Rt,L|e.DISTANCE|e.REDUCEDLENGTH,Uo,Go),zt=Kt.s12b,Wt=Kt.m12b,L&e.GEODESICSCALE&&(O.M12=Kt.M12,O.M21=Kt.M21),Ft<g||Wt>=0?((Ft<3*e.tiny_||Ft<m&&(zt<0||Wt<0))&&(Ft=Wt=zt=0),Wt*=this._b,zt*=this._b,O.a12=Ft/n.degree):Ai=!1),eh=2,!Ai&&dt===0&&(this.f<=0||yt>=this.f*180))Ot=Le=0,Ut=Qe=1,zt=this.a*ye,Ft=nf=ye/this._f1,Wt=this._b*Math.sin(Ft),L&e.GEODESICSCALE&&(O.M12=O.M21=Math.cos(Ft)),O.a12=V/this._f1;else if(!Ai)if(Kt=this.InverseStart(dt,St,ee,k,Rt,Jt,ye,Be,Ue,Uo,Go),Ft=Kt.sig12,Ut=Kt.salp1,Ot=Kt.calp1,Ft>=0)Qe=Kt.salp2,Le=Kt.calp2,xc=Kt.dnm,zt=Ft*this._b*xc,Wt=n.sq(xc)*this._b*Math.sin(Ft/xc),L&e.GEODESICSCALE&&(O.M12=O.M21=Math.cos(Ft/xc)),O.a12=Ft/n.degree,nf=ye/(this._f1*xc);else{for(ha=0,Xl=e.tiny_,Zl=1,Jl=e.tiny_,Ql=-1,of=!1,_0=!1;Kt=this.Lambda12(dt,St,ee,k,Rt,Jt,Ut,Ot,Be,Ue,ha<f,Uo,Go,Kl),Sc=Kt.lam12,Qe=Kt.salp2,Le=Kt.calp2,Ft=Kt.sig12,Or=Kt.ssig1,or=Kt.csig1,Xr=Kt.ssig2,pn=Kt.csig2,rf=Kt.eps,rh=Kt.domg12,M0=Kt.dlam12,!(_0||!(Math.abs(Sc)>=(of?8:1)*m)||ha==d);++ha){if(Sc>0&&(ha<f||Ot/Ut>Ql/Jl)?(Jl=Ut,Ql=Ot):Sc<0&&(ha<f||Ot/Ut<Zl/Xl)&&(Xl=Ut,Zl=Ot),ha<f&&M0>0&&(sf=-Sc/M0,Math.abs(sf)<Math.PI&&(b0=Math.sin(sf),x0=Math.cos(sf),S0=Ut*x0+Ot*b0,S0>0))){Ot=Ot*x0-Ut*b0,Ut=S0,X=n.hypot(Ut,Ot),Ut/=X,Ot/=X,of=Math.abs(Sc)<=16*m;continue}Ut=(Xl+Jl)/2,Ot=(Zl+Ql)/2,X=n.hypot(Ut,Ot),Ut/=X,Ot/=X,of=!1,_0=Math.abs(Xl-Ut)+(Zl-Ot)<y||Math.abs(Ut-Jl)+(Ot-Ql)<y}LM=L|(L&(e.REDUCEDLENGTH|e.GEODESICSCALE)?e.DISTANCE:e.NONE),Kt=this.Lengths(rf,Ft,Or,or,ee,Xr,pn,Jt,St,Rt,LM,Uo,Go),zt=Kt.s12b,Wt=Kt.m12b,L&e.GEODESICSCALE&&(O.M12=Kt.M12,O.M21=Kt.M21),Wt*=this._b,zt*=this._b,O.a12=Ft/n.degree,L&e.AREA&&(A0=Math.sin(rh),P0=Math.cos(rh),eh=Be*P0-Ue*A0,lf=Ue*P0+Be*A0)}return L&e.DISTANCE&&(O.s12=0+zt),L&e.REDUCEDLENGTH&&(O.m12=0+Wt),L&e.AREA&&(v0=Ut*St,af=n.hypot(Ot,Ut*dt),af!==0&&v0!==0?(Or=dt,or=Ot*St,Xr=k,pn=Le*Rt,cf=n.sq(af)*this._ep2,rf=cf/(2*(1+Math.sqrt(1+cf))+cf),DM=n.sq(this.a)*af*v0*this._e2,X=n.hypot(Or,or),Or/=X,or/=X,X=n.hypot(Xr,pn),Xr/=X,pn/=X,th=new Array(e.nC4_),this.C4f(rf,th),FM=e.SinCosSeries(!1,Or,or,th),UM=e.SinCosSeries(!1,Xr,pn,th),O.S12=DM*(Ft<.01?e.SinCosSeries(!1,Or,or,th,Ft):UM-FM)):O.S12=0,!Ai&&eh==2&&(eh=Math.sin(nf),lf=Math.cos(nf)),!Ai&&lf>-.7071&&k-dt<1.75?(rh=1+lf,T0=1+St,I0=1+Rt,E0=2*Math.atan2(eh*(dt*I0+k*T0),rh*(dt*k+T0*I0))):(hf=Qe*Ot-Le*Ut,uf=Le*Ot+Qe*Ut,hf===0&&uf<0&&(hf=e.tiny_*Ot,uf=-1),E0=Math.atan2(hf,uf)),O.S12+=this._c2*E0,O.S12*=xt*Dt*et,O.S12+=0),xt<0&&([Qe,Ut]=[Ut,Qe],[Le,Ot]=[Ot,Le],L&e.GEODESICSCALE&&([O.M21,O.M12]=[O.M12,O.M21])),Ut*=xt*Dt,Ot*=xt*et,Qe*=xt*Dt,Le*=xt*et,{vals:O,salp1:Ut,calp1:Ot,salp2:Qe,calp2:Le}},e.Geodesic.prototype.GenDirect=function(A,P,D,F,L,O){var V;return O?O===e.LONG_UNROLL&&(O|=e.STANDARD):O=e.STANDARD,F||(O|=e.DISTANCE_IN),V=new t.GeodesicLine(this,A,P,D,O),V.GenPosition(F,L,O)},e.Geodesic.prototype.Direct=function(A,P,D,F,L){return this.GenDirect(A,P,D,!1,F,L)},e.Geodesic.prototype.ArcDirect=function(A,P,D,F,L){return this.GenDirect(A,P,D,!0,F,L)},e.Geodesic.prototype.Line=function(A,P,D,F){return new t.GeodesicLine(this,A,P,D,F)},e.Geodesic.prototype.DirectLine=function(A,P,D,F,L){return this.GenDirectLine(A,P,D,!1,F,L)},e.Geodesic.prototype.ArcDirectLine=function(A,P,D,F,L){return this.GenDirectLine(A,P,D,!0,F,L)},e.Geodesic.prototype.GenDirectLine=function(A,P,D,F,L,O){var V;return O||(O=e.STANDARD|e.DISTANCE_IN),F||(O|=e.DISTANCE_IN),V=new t.GeodesicLine(this,A,P,D,O),V.GenSetDistance(F,L),V},e.Geodesic.prototype.InverseLine=function(A,P,D,F,L){var O,V,yt;return L||(L=e.STANDARD|e.DISTANCE_IN),O=this.InverseInt(A,P,D,F,e.ARC),yt=n.atan2d(O.salp1,O.calp1),L&(e.OUT_MASK&e.DISTANCE_IN)&&(L|=e.DISTANCE),V=new t.GeodesicLine(this,A,P,yt,L,O.salp1,O.calp1),V.SetArc(O.vals.a12),V},e.Geodesic.prototype.Polygon=function(A){return new r.PolygonArea(this,A)},e.WGS84=new e.Geodesic(i.WGS84.a,i.WGS84.f)})(ke.Geodesic,ke.GeodesicLine,ke.PolygonArea,ke.Math,ke.Constants);(function(e,t,r){"use strict";t.GeodesicLine=function(n,i,o,s,a,c,l){var h,u,f,d,m,p;a||(a=e.STANDARD|e.DISTANCE_IN),this.a=n.a,this.f=n.f,this._b=n._b,this._c2=n._c2,this._f1=n._f1,this.caps=a|e.LATITUDE|e.AZIMUTH|e.LONG_UNROLL,this.lat1=r.LatFix(i),this.lon1=o,typeof c>"u"||typeof l>"u"?(this.azi1=r.AngNormalize(s),h=r.sincosd(r.AngRound(this.azi1)),this.salp1=h.s,this.calp1=h.c):(this.azi1=s,this.salp1=c,this.calp1=l),h=r.sincosd(r.AngRound(this.lat1)),f=this._f1*h.s,u=h.c,h=r.hypot(f,u),f/=h,u/=h,u=Math.max(e.tiny_,u),this._dn1=Math.sqrt(1+n._ep2*r.sq(f)),this._salp0=this.salp1*u,this._calp0=r.hypot(this.calp1,this.salp1*f),this._ssig1=f,this._somg1=this._salp0*f,this._csig1=this._comg1=f!==0||this.calp1!==0?u*this.calp1:1,h=r.hypot(this._ssig1,this._csig1),this._ssig1/=h,this._csig1/=h,this._k2=r.sq(this._calp0)*n._ep2,d=this._k2/(2*(1+Math.sqrt(1+this._k2))+this._k2),this.caps&e.CAP_C1&&(this._A1m1=e.A1m1f(d),this._C1a=new Array(e.nC1_+1),e.C1f(d,this._C1a),this._B11=e.SinCosSeries(!0,this._ssig1,this._csig1,this._C1a),m=Math.sin(this._B11),p=Math.cos(this._B11),this._stau1=this._ssig1*p+this._csig1*m,this._ctau1=this._csig1*p-this._ssig1*m),this.caps&e.CAP_C1p&&(this._C1pa=new Array(e.nC1p_+1),e.C1pf(d,this._C1pa)),this.caps&e.CAP_C2&&(this._A2m1=e.A2m1f(d),this._C2a=new Array(e.nC2_+1),e.C2f(d,this._C2a),this._B21=e.SinCosSeries(!0,this._ssig1,this._csig1,this._C2a)),this.caps&e.CAP_C3&&(this._C3a=new Array(e.nC3_),n.C3f(d,this._C3a),this._A3c=-this.f*this._salp0*n.A3f(d),this._B31=e.SinCosSeries(!0,this._ssig1,this._csig1,this._C3a)),this.caps&e.CAP_C4&&(this._C4a=new Array(e.nC4_),n.C4f(d,this._C4a),this._A4=r.sq(this.a)*this._calp0*this._salp0*n._e2,this._B41=e.SinCosSeries(!1,this._ssig1,this._csig1,this._C4a)),this.a13=this.s13=NaN},t.GeodesicLine.prototype.GenPosition=function(n,i,o,s={}){var a,c,l,h,u,f,d,m,p,g,y,_,M,b,v,T,S,E,N,B,C,R,W,j,A,P,D,F,L;return o?o===e.LONG_UNROLL&&(o|=e.STANDARD):o=e.STANDARD,o&=this.caps&e.OUT_MASK,s.lat1=this.lat1,s.azi1=this.azi1,s.lon1=o&e.LONG_UNROLL?this.lon1:r.AngNormalize(this.lon1),n?s.a12=i:s.s12=i,n||this.caps&e.DISTANCE_IN&e.OUT_MASK?(h=0,u=0,n?(a=i*r.degree,P=r.sincosd(i),c=P.s,l=P.c):(m=i/(this._b*(1+this._A1m1)),p=Math.sin(m),g=Math.cos(m),h=-e.SinCosSeries(!0,this._stau1*g+this._ctau1*p,this._ctau1*g-this._stau1*p,this._C1pa),a=m-(h-this._B11),c=Math.sin(a),l=Math.cos(a),Math.abs(this.f)>.01&&(f=this._ssig1*l+this._csig1*c,d=this._csig1*l-this._ssig1*c,h=e.SinCosSeries(!0,f,d,this._C1a),y=(1+this._A1m1)*(a+(h-this._B11))-i/this._b,a=a-y/Math.sqrt(1+this._k2*r.sq(f)),c=Math.sin(a),l=Math.cos(a))),f=this._ssig1*l+this._csig1*c,d=this._csig1*l-this._ssig1*c,R=Math.sqrt(1+this._k2*r.sq(f)),o&(e.DISTANCE|e.REDUCEDLENGTH|e.GEODESICSCALE)&&((n||Math.abs(this.f)>.01)&&(h=e.SinCosSeries(!0,f,d,this._C1a)),u=(1+this._A1m1)*(h-this._B11)),T=this._calp0*f,S=r.hypot(this._salp0,this._calp0*d),S===0&&(S=d=e.tiny_),B=this._salp0,C=this._calp0*d,n&&o&e.DISTANCE&&(s.s12=this._b*((1+this._A1m1)*a+u)),o&e.LONGITUDE&&(E=this._salp0*f,N=d,v=r.copysign(1,this._salp0),_=o&e.LONG_UNROLL?v*(a-(Math.atan2(f,d)-Math.atan2(this._ssig1,this._csig1))+(Math.atan2(v*E,N)-Math.atan2(v*this._somg1,this._comg1))):Math.atan2(E*this._comg1-N*this._somg1,N*this._comg1+E*this._somg1),M=_+this._A3c*(a+(e.SinCosSeries(!0,f,d,this._C3a)-this._B31)),b=M/r.degree,s.lon2=o&e.LONG_UNROLL?this.lon1+b:r.AngNormalize(r.AngNormalize(this.lon1)+r.AngNormalize(b))),o&e.LATITUDE&&(s.lat2=r.atan2d(T,this._f1*S)),o&e.AZIMUTH&&(s.azi2=r.atan2d(B,C)),o&(e.REDUCEDLENGTH|e.GEODESICSCALE)&&(W=e.SinCosSeries(!0,f,d,this._C2a),j=(1+this._A2m1)*(W-this._B21),A=(this._A1m1-this._A2m1)*a+(u-j),o&e.REDUCEDLENGTH&&(s.m12=this._b*(R*(this._csig1*f)-this._dn1*(this._ssig1*d)-this._csig1*d*A)),o&e.GEODESICSCALE&&(P=this._k2*(f-this._ssig1)*(f+this._ssig1)/(this._dn1+R),s.M12=l+(P*f-d*A)*this._ssig1/this._dn1,s.M21=l-(P*this._ssig1-this._csig1*A)*f/R)),o&e.AREA&&(D=e.SinCosSeries(!1,f,d,this._C4a),this._calp0===0||this._salp0===0?(F=B*this.calp1-C*this.salp1,L=C*this.calp1+B*this.salp1):(F=this._calp0*this._salp0*(l<=0?this._csig1*(1-l)+c*this._ssig1:c*(this._csig1*c/(1+l)+this._ssig1)),L=r.sq(this._salp0)+r.sq(this._calp0)*this._csig1*d),s.S12=this._c2*Math.atan2(F,L)+this._A4*(Math.abs(a)<.01?e.SinCosSeries(!1,this._ssig1,this._csig1,this._C4a,a):D-this._B41)),n||(s.a12=a/r.degree),s):(s.a12=NaN,s)},t.GeodesicLine.prototype.Position=function(n,i){return this.GenPosition(!1,n,i)},t.GeodesicLine.prototype.ArcPosition=function(n,i){return this.GenPosition(!0,n,i)},t.GeodesicLine.prototype.GenSetDistance=function(n,i){n?this.SetArc(i):this.SetDistance(i)},t.GeodesicLine.prototype.SetDistance=function(n){var i;this.s13=n,i=this.GenPosition(!1,this.s13,e.ARC),this.a13=0+i.a12},t.GeodesicLine.prototype.SetArc=function(n){var i;this.a13=n,i=this.GenPosition(!0,this.a13,e.DISTANCE),this.s13=0+i.s12}})(ke.Geodesic,ke.GeodesicLine,ke.Math)});function Ox(e){if(!Number.isFinite(e))throw new Error("Nonfinite axis, azimuth, distance or arc")}function Bx({semiMajorAxis:e,semiMinorAxis:t}){return Ox(e),Ox(t),new u1.Geodesic(e,(e-t)/e)}var u1,Ih,Lx=w(()=>{Nx();u1=ke.Geodesic;Ih=u1.ALL&~u1.AREA});function Ux(e,t,r,n,i,o){let s=Fx[t]&&Fx[t][r];pr(s&&(!n||n===s));let a,c,l,h=c8.copy(i);if(!Number.isFinite(h.x)||!Number.isFinite(h.y)||!Number.isFinite(h.z)||!Array.isArray(o)&&o.length<16)throw new Error("Unsupported local frame");let u=a8*Math.min(1,e.maximumRadius),f=Math.abs(h.x)<=u&&Math.abs(h.y)<=u,d=e.radii;if(d.x===d.y&&d.x>0&&d.z>0&&d.z<=d.x&&(!f||h.z!==0)){let{east:B,up:C}=Uc;if(f)B.set(0,1,0),C.set(0,0,Math.sign(h.z));else{let R=Math.max(Math.abs(h.x),Math.abs(h.y));B.set(-h.y/R,h.x/R,0).normalize(),e.geodeticSurfaceNormal(h,C)}if(!Zg(B,C,Dx)||!Jg(Dx,h,t,r,n,o))throw new Error("Unsupported local frame");return o}if(f){let B=Math.sign(h.z);a=l8.fromArray(f1[t]),t!=="east"&&t!=="west"&&a.scale(B),c=h8.fromArray(f1[r]),r!=="east"&&r!=="west"&&c.scale(B),l=u8.fromArray(f1[n]),n!=="east"&&n!=="west"&&l.scale(B)}else{let{up:B,east:C,north:R}=Uc,W=Math.max(Math.abs(h.x),Math.abs(h.y));C.set(-h.y/W,h.x/W,0).normalize(),e.geodeticSurfaceNormal(h,B),R.copy(B).cross(C);let{down:j,west:A,south:P}=Uc;j.copy(B).scale(-1),A.copy(C).scale(-1),P.copy(R).scale(-1),a=Uc[t],c=Uc[r],l=Uc[n]}let m=a.x,p=a.y,g=a.z,y=c.x,_=c.y,M=c.z,b=l.x,v=l.y,T=l.z,S=h.x,E=h.y,N=h.z;return o[0]=m,o[1]=p,o[2]=g,o[3]=0,o[4]=y,o[5]=_,o[6]=M,o[7]=0,o[8]=b,o[9]=v,o[10]=T,o[11]=0,o[12]=S,o[13]=E,o[14]=N,o[15]=1,o}var a8,c8,Dx,Fx,f1,Uc,l8,h8,u8,Gx=w(()=>{qt();qt();a8=1e-14,c8=new I,Dx=Xg(),Fx={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},f1={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},Uc={east:new I,north:new I,up:new I,west:new I,south:new I,down:new I},l8=new I,h8=new I,u8=new I});function ga(e,t,r=new bt){return Ux(e,"east","north","up",t,r)}var zx=w(()=>{qt();Gx()});var Vx=w(()=>{hd();zx()});var Ah,kx=w(()=>{qt();Ah=class{constructor(t,r,n,i){this.west=t,this.south=r,this.east=n,this.north=i}static center(t,r){r||(r=new I);let n=t.east,i=t.west;n<i&&(n+=we.TWO_PI);let o=pg((i+n)*.5,"negative-pi-to-pi"),s=(t.south+t.north)*.5;return r.x=o,r.y=s,r.z=0,r}get width(){let t=this.east,r=this.west;return t<r&&(t+=we.TWO_PI),t-r}}});function Ph(e,t=pt.WGS84,r={}){if(!e||e.length!==6||e.some(_=>!Number.isFinite(_)))throw new Error("makeOBBFromRegion: region must contain exactly six finite numbers");let n=r.units==="degrees"?Uf(1):1,[i,o,s,a,c,l]=e;if(c>l)throw new Error("makeOBBFromRegion: minimumHeight must not exceed maximumHeight");let h=o*n,u=a*n,f=Wx(i*n),d=Wx(s*n);s*n-i*n>=we.TWO_PI-1e-12&&(d=f+we.TWO_PI);let p=1e-12;if(h>u||h<-we.PI_OVER_TWO-p||u>we.PI_OVER_TWO+p)throw new Error("makeOBBFromRegion: latitude must be within [-\u03C0/2, \u03C0/2] and south \u2264 north");let g=Math.max(-we.PI_OVER_TWO,Math.min(we.PI_OVER_TWO,h)),y=Math.max(-we.PI_OVER_TWO,Math.min(we.PI_OVER_TWO,u));return F8([f,g,d,y,c,l],t,r.transform)}function Wx(e){let t=((e+Math.PI)%we.TWO_PI+we.TWO_PI)%we.TWO_PI-Math.PI;return t===-Math.PI&&e>0?Math.PI:t}function F8(e,t,r){let n=new oo,[i,o,s,a,c,l]=e,h=Br(a),u=Br(o),f,d,m,p,g,y,_,M=new Ah(i,o,s,a),b=Ah.center(M,d8),v=new I([Br(b.x),Br(b.y),0]),T=b.x,S=v.x;if(M.width<=we.PI){let yt=Br(i),Dt=t.cartographicToCartesian(v),X=new gd(Dt,t),xt=u<0&&h>0?0:v.y,et=m8.copy([S,h,l]),dt=p8.copy([yt,h,l]),St=g8.copy([yt,xt,l]),k=y8.copy([yt,u,l]),Rt=w8.copy([S,u,l]),zt=t.cartographicToCartesian(et,_8),Wt=t.cartographicToCartesian(dt,qx),ee=t.cartographicToCartesian(St,M8),Jt=t.cartographicToCartesian(k,jx),ye=t.cartographicToCartesian(Rt,b8),Be=X.projectPointToNearestOnPlane(zt,x8),Ue=X.projectPointToNearestOnPlane(Wt,S8),Ft=X.projectPointToNearestOnPlane(ee,v8),Ot=X.projectPointToNearestOnPlane(Jt,E8),Ut=X.projectPointToNearestOnPlane(ye,T8);return p=Math.min(Ue.x,Ft.x,Ot.x),f=-p,d=Math.max(Ue.y,Be.y),g=Math.min(Ot.y,Ut.y),dt.z=k.z=c,Wt=t.cartographicToCartesian(dt,qx),Jt=t.cartographicToCartesian(k,jx),_=X.plane,y=Math.min(_.getPointDistance(Wt),_.getPointDistance(Jt)),m=l,Hx(Yx(X.origin,X.xAxis,X.yAxis,X.zAxis,p,f,g,d,y,m,n),r)}let E=Br(s),N=o>0,B=a<0,C=N?u:B?h:0,R=t.cartographicToCartesian([S,C,l],A8);R.z=0;let j=Math.abs(R.x)<we.EPSILON10&&Math.abs(R.y)<we.EPSILON10?L8:P8.copy(R).normalize(),A=D8,P=R8.copy(j).cross(A);_=I8.fromPointNormal(R,j);let D=t.cartographicToCartesian([Br(T+we.PI_OVER_TWO),C,l],C8);f=_.projectPointOntoPlane(D,N8).dot(P),p=-f;let L=B?c:l,O=N?c:l;d=$x(t,h,L,!0),g=$x(t,u,O,!1);let V=t.cartographicToCartesian([E,C,l],B8);return y=_.getPointDistance(V),m=0,Hx(Yx(R,P,A,j,p,f,g,d,y,m,n),r)}function Hx(e,t){if(!t)return e;let r=[0,1,2].map(a=>e.halfAxes.getColumn(a,new I)),n=t.transformAsPoint(e.center),i=[1/0,1/0,1/0],o=[-1/0,-1/0,-1/0];for(let a=0;a<8;a++){let c=new I(n);for(let l=0;l<3;l++){let h=t.transformAsVector(r[l]);c.add(new I(h).scale((a&1<<l)===0?-1:1))}for(let l=0;l<3;l++)i[l]=Math.min(i[l],c[l]),o[l]=Math.max(o[l],c[l])}e.center.copy(i).add(o).scale(.5);let s=new I(o).subtract(i).scale(.5);return e.halfAxes=new Qr().set(s.x,0,0,0,s.y,0,0,0,s.z),e}function $x(e,t,r,n){let i=n?-1/0:1/0;for(let o of[0,90,180,270]){let s=e.cartographicToCartesian([o,t,r],O8).z;i=n?Math.max(i,s):Math.min(i,s)}return i}function Yx(e,t,r,n,i,o,s,a,c,l,h){let u=h.center,f=h.halfAxes;f.setColumn(0,t),f.setColumn(1,r),f.setColumn(2,n);let d=f8.set((i+o)/2,(s+a)/2,(c+l)/2).transformByMatrix3(f),m=(o-i)/2,p=(a-s)/2,g=(l-c)/2;return f[0]*=m,f[1]*=m,f[2]*=m,f[3]*=p,f[4]*=p,f[5]*=p,f[6]*=g,f[7]*=g,f[8]*=g,u.copy(e).add(d),h}var f8,d8,m8,p8,g8,y8,w8,_8,qx,M8,jx,b8,x8,S8,v8,E8,T8,I8,A8,P8,R8,C8,N8,O8,B8,L8,D8,Kx=w(()=>{qt();so();kx();hd();Cx();f8=new I,d8=new I,m8=new I,p8=new I,g8=new I,y8=new I,w8=new I,_8=new I,qx=new I,M8=new I,jx=new I,b8=new I,x8=new Jr,S8=new Jr,v8=new Jr,E8=new Jr,T8=new Jr,I8=new Ge,A8=new I,P8=new I,R8=new I,C8=new I,N8=new Jr,O8=new I,B8=new I,L8=new I(1,0,0),D8=new I(0,0,1)});var Xx=w(()=>{Kx()});var Zx=w(()=>{});function tt(e,t,r){if(!Object.prototype.hasOwnProperty.call(e,t))return r;let n=e[t];if(typeof n!="string"||!/^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i.test(n))throw new Error(`Invalid numeric PROJ parameter: +${t}`);let i=Number(n);if(!Number.isFinite(i))throw new Error(`Invalid numeric PROJ parameter: +${t}`);return i}function Rh(e,t){let r=tt(e,t,0);if(Math.abs(r)>=90)throw new Error(`+${t} must be between -90 and 90 degrees`);return r*Me}function ve(e,t=!1){if(t||Math.abs(e)<=Math.PI)return e;let r=2*Math.PI;return((e+Math.PI)%r+r)%r-Math.PI}var Me,Ee=w(()=>{Me=Math.PI/180});function Te(e,t){let r=[e[0]*t[0],e[0]*t[1],e[1]*t[0],e[1]*t[1]];return[Math.min(...r),Math.max(...r)]}function Ch([e,t]){let r=[Math.sin(e),Math.sin(t)];for(let[n,i]of[[Math.PI/2,1],[-Math.PI/2,-1]])Math.ceil((e-n)/(2*Math.PI))<=Math.floor((t-n)/(2*Math.PI))&&r.push(i);return[Math.min(...r),Math.max(...r)]}function re(e,t){let r=n=>Math.max(1,Ho(n))*1e-12;if(![...e,...t].every(Number.isFinite))throw new Error("Projection rendering bounds are not finite");return[[e[0]-r(e),t[0]-r(t),0],[e[1]+r(e),t[1]+r(t),0]]}function gr(e,t,r=!1){let n=e[0][0]-t,i=e[1][0]-t;if(r)return[n,i];let o=i-n;if(o>=2*Math.PI-1e-12)return[-Math.PI,Math.PI];let s=ve(n);o>0&&Math.abs(s-Math.PI)<1e-12&&(s=-Math.PI);let a=s+o;return a>Math.PI+1e-12?[-Math.PI,Math.PI]:[s,Math.min(a,Math.PI)]}function yr(e,t,r,n=!1){let i=gr(t,r,n),o=[t[0][1],t[1][1],Math.max(t[0][1],Math.min(t[1][1],0))],s=i.flatMap(a=>o.map(c=>e(r+a,c)));return re([Math.min(...s.map(a=>a[0])),Math.max(...s.map(a=>a[0]))],[Math.min(...s.map(a=>a[1])),Math.max(...s.map(a=>a[1]))])}function Gc(e,t,r,n=!1,i=0){let o=gr(t,r,n);if(Ho(o)>Math.PI/6+1e-12)throw new Error("Unsupported transverse rendering coverage");let s=[o[0],o[1],Math.max(o[0],Math.min(o[1],0))],a=[t[0][1],t[1][1],Math.max(t[0][1],Math.min(t[1][1],i))],c=s.flatMap(l=>a.map(h=>e(r+l,h)));return re([Math.min(...c.map(l=>l[0])),Math.max(...c.map(l=>l[0]))],[Math.min(...c.map(l=>l[1])),Math.max(...c.map(l=>l[1]))])}function Jx(e,t,r,n=!1){let i=gr(t,r,n),o=[i[0],i[1],Math.max(i[0],Math.min(i[1],0))],s=[t[0][1],t[1][1],Math.max(t[0][1],Math.min(t[1][1],0))],a=o.flatMap(c=>s.map(l=>e(r+c,l)));return re([Math.min(...a.map(c=>c[0])),Math.max(...a.map(c=>c[0]))],[Math.min(...a.map(c=>c[1])),Math.max(...a.map(c=>c[1]))])}function zc(e,t,r,n,i,o,s=!1){let a=Ct(gr(t,r,s),n),c=qn(o-e(r,t[0][1])[1],o-e(r,t[1][1])[1]);return re(At([i,i],Te(c,Ch(a))),At([o,o],Ct(Te(c,yd(a)),-1)))}var qn,At,Ct,yd,Ho,Ie=w(()=>{Ee();qn=(e,t)=>[Math.min(e,t),Math.max(e,t)],At=(e,t)=>[e[0]+t[0],e[1]+t[1]],Ct=(e,t)=>qn(e[0]*t,e[1]*t);yd=e=>Ch([e[0]+Math.PI/2,e[1]+Math.PI/2]),Ho=e=>Math.max(Math.abs(e[0]),Math.abs(e[1]))});function K(e,t,r,n){return[[e,t],[r,n]]}function oi(e){return e>=-180&&e<180?e:((e+180)%360+360)%360-180}function U8(e,t,r,n){if(![e,t,r,n].every(Number.isFinite)||t<-90||n>90||t>n||r-e<-360||r-e>360+1e-10)throw new Error("Invalid geographic coverage");if(r-e>=360-1e-10)return[-180,t,180,n];let i=oi(r);return[oi(e),t,i===-180&&r>e?180:i,n]}function d1(e){let t=e[2]-e[0];return t<0?t+360:t}function Qx(e){let[t,r,n,i]=e;return t<=n?[e]:[[t,r,180,i],[-180,r,n,i]]}function G8(e,t){let[r,n,i,o]=e,s=oi(t[0]);return t[1]>=n&&t[1]<=o&&(r<=i?s>=r&&s<=i||s===-180&&i===180:s>=r||s<=i)}function wd(e,t){let r=Math.max(e[1],t[1]),n=Math.min(e[3],t[3]);if(r>n)return[];let i=[];for(let s of Qx(e))for(let a of Qx(t)){let c=Math.max(s[0],a[0]),l=Math.min(s[2],a[2]);c<=l?i.push([c,l]):(s[2]===180&&a[0]===-180||a[2]===180&&s[0]===-180)&&i.push([-180,-180])}i.sort((s,a)=>s[0]-a[0]);let o=[];for(let s of i){let a=o[o.length-1];a&&s[0]<=a[1]?a[1]=Math.max(a[1],s[1]):o.push([...s])}if(o.length>1&&o[0][0]===-180&&o[o.length-1][1]===180){let s=o.shift();return[[o.pop()[0],r,s[1],n],...o.map(([c,l])=>[c,r,l,n])]}return o.map(([s,a])=>[s,r,a,n])}function tS(e,t){let r=oi(t[0]),n=Math.max(e[1],Math.min(e[3],t[1]));if(!G8(e,[r,n])){let i=Math.abs(oi(r-e[0])),o=Math.abs(oi(r-e[2]));r=i<=o?e[0]:e[2]}return[r,n]}function $o(e,t=0,r=0){let n=d1(e),i=e[0]*ao-t,o=i+n*ao/2,s=Math.round((r-o)/(2*Math.PI))*2*Math.PI;return K(n===360?r-Math.PI:i+s,e[1]*ao,n===360?r+Math.PI:i+s+n*ao,e[3]*ao)}function yn(e,t=0){return U8((e[0][0]+t)/ao,e[0][1]/ao,(e[1][0]+t)/ao,e[1][1]/ao)}function eS(e){if(!e.length)throw new Error("CRS coverage does not intersect the rendering target");return[[0,1,2].map(t=>Math.min(...e.map(r=>r[0][t]))),[0,1,2].map(t=>Math.max(...e.map(r=>r[1][t])))]}var ao,Ht=w(()=>{ao=Math.PI/180});function rS(e,t){if(t)try{let n=e(t);return m1(n)}catch{}let r=e();return m1(r)}function m1(e){let t=e.bounds;if(t.some(r=>r.some(n=>!Number.isFinite(n))))throw new Error("Projection rendering bounds must be finite");return{bounds:t,normalize:e.normalize?.bind(e)}}function Yo(e,t=0){return r=>{let n=r.x*Math.PI/180-t,i=r.y*Math.PI/180,o={x:n,y:i,z:r.z};e(o),o.x!==n&&(r.x=(o.x+t)*180/Math.PI),o.y!==i&&(r.y=o.y*180/Math.PI)}}function _d(e,t){let r=[];for(let n of e){let i=t(n);i!==null&&r.push(m1(i))}return r.length?r.length===1?r[0]:{bounds:eS(r.map(n=>n.bounds)),normalize(n){let i=n.x,o=n.y,s=1/0;for(let a of r){let c={x:n.x,y:n.y,z:n.z};a.normalize?.(c);let l=Math.sin((c.y-n.y)*Math.PI/360)**2+Math.cos(n.y*Math.PI/180)*Math.cos(c.y*Math.PI/180)*Math.sin((c.x-n.x)*Math.PI/360)**2;l<s&&(s=l,i=c.x,o=c.y)}n.x=i,n.y=o}}:null}var ya=w(()=>{Ht()});function Md(e,t,r=0,n=!1){let i=d1(t),o=i===360?r-180:t[0]+Math.round((r-t[0]-i/2)/360)*360,s=o+i;if(n){e.x=Math.max(o,Math.min(s,e.x)),e.y=Math.max(t[1],Math.min(t[3],e.y));return}let a=tS(t,[e.x,e.y]),c=a[0];a[0]===oi(e.x)&&e.x>=o&&e.x<=s?c=e.x:(c<o||c>s)&&(c+=Math.round(((o+s)/2-c)/360)*360);let l=c-r;e.x=Math.abs(l)<=180?c:r+oi(l),e.y=a[1]}function Ke(e,t,r=0,n=0,i=!1){let o=(r+n)*180/Math.PI;return{get bounds(){return e($o(t,n,r))},normalize(s){Md(s,t,o,i)}}}function z8(e,t,r,n,i){let o=_d(t,s=>Ke(e,s,r,n,i));if(!o)throw new Error("CRS coverage does not intersect the rendering target");return o}function Pt(e,t,r,n=0,i=!1){let o=(t[0][0]+t[1][0])/2,s=yn(t,n),a=(o+n)*180/Math.PI;return{...e,longitudeOrigin:o,getRenderingProfile(c){if(!c)return{bounds:r(t),normalize(l){Md(l,s,a,i)}};try{let l=Ke(r,c,o,n,i);return{bounds:l.bounds,normalize:l.normalize}}catch{return z8(r,wd(c,s),o,n,i)}}}}var ne=w(()=>{Ht();ya()});function nS(){return{x:0,y:0,z:0}}var Ko,bd=w(()=>{Ko=class{constructor(){this.point=nS(),this.points=[this.point],this.active=0}get depth(){return this.active}acquire(){var t;let r=this.active++;return(t=this.points)[r]||(t[r]=nS()),this.points[r]}release(t){this.active>0&&this.points[this.active-1]===t&&this.active--}}});function jn(e,t){let r=new Ko,n=(i,o,s)=>{let a=r.acquire();try{return a.x=i,a.y=o,a.z=0,s(a),[a.x,a.y]}finally{r.release(a)}};return{forward(i,o){return n(i,o,e)},inverse(i,o){return n(i,o,t)},forwardInPlace:e,inverseInPlace:t}}function co(e,t,r=!1){let n=t?e.inverseInPlace:e.forwardInPlace;if(n)return n.bind(e);if(r){let o=t?e.inverse3D:e.forward3D;return s=>{let a=o.call(e,[s.x,s.y,s.z]);s.x=a[0],s.y=a[1],s.z=a[2]}}let i=t?e.inverse:e.forward;return o=>{let s=i.call(e,o.x,o.y);o.x=s[0],o.y=s[1]}}var wa=w(()=>{bd()});function Xo(e,t,r=0){let n=tt(e,t,r);if(t!=="lon_0"&&Math.abs(n)>90)throw new Error("Latitude parameter must be between -90 and 90 degrees: +"+t);return n*Me}function si(e,t){let r=Object.prototype.hasOwnProperty.call(e,t);if(r&&e[t]!==void 0)throw new Error("Expected a flag without a value: +"+t);return r}function er({semiMajorAxis:e,eccentricitySquared:t,parameters:r,primeMeridian:n=0}){let i=tt(r,"k_0",tt(r,"k",1));if(i<=0)throw new Error("Projection scale must be positive");return{primeMeridian:n,a:e,b:e*Math.sqrt(1-t),es:t,e:Math.sqrt(t),ep2:t/(1-t),sphere:t===0,over:si(r,"over"),long0:Xo(r,"lon_0"),lat0:Xo(r,"lat_0"),lat1:Xo(r,"lat_1"),lat2:Xo(r,"lat_2",tt(r,"lat_1",0)),lat_ts:Xo(r,"lat_ts",NaN),x0:tt(r,"x_0",0),y0:tt(r,"y_0",0),k0:i}}function Vc(e,t){if(!Object.prototype.hasOwnProperty.call(t,"lat_1"))throw new Error("Conic projections require +lat_1");if(Math.abs(e.lat1+e.lat2)<1e-10||Math.abs(e.lat1)>=Math.PI/2||Math.abs(e.lat2)>=Math.PI/2)throw new Error("Conic standard parallels must not be opposite or at a pole")}function Xe(e,t,r,n,i=jn){let o=(s,a)=>{let c=s(t,a);if(!c||typeof c!="object"||!Number.isFinite(c.x)||!Number.isFinite(c.y))throw new Error(e+": coordinate outside projection domain or inverse did not converge");a.x=c.x,a.y=c.y};return i(s=>o(r,s),s=>o(n,s))}function Zo(e,t){let r=co(t,!1);return jn(n=>{let i=n.x,o=n.y,s=Math.atan2(Math.sin(i-e.long0),Math.cos(i-e.long0)),a=Math.abs(Math.abs(e.lat0)-Math.PI/2)<1e-10;if(Math.abs(o+e.lat0)<1e-10&&(a||Math.abs(Math.abs(s)-Math.PI)<1e-10))throw new Error("Azimuthal projection is undefined at the antipode");r(n)},co(t,!0))}var ar,lo,wn=w(()=>{wa();Ee();ar=["lon_0","lat_0","x_0","y_0"],lo=["k","k_0"]});function ai(e,t){return{...jn(e,t),createForwardFlat(r){return this.forwardInPlace===e?iS(e,!1,r):void 0},createInverseFlat(r){return this.inverseInPlace===t?iS(t,!0,r):void 0}}}function iS(e,t,{inputScale:r,outputScale:n}){let i=new Ko;return(o,s)=>{let a=i.acquire();try{let c=o instanceof Float32Array;for(let l=0;l<o.length;l+=s){if(a.x=o[l],a.y=o[l+1],a.z=s>=3?o[l+2]:0,!Number.isFinite(a.x)||!Number.isFinite(a.y)||!Number.isFinite(a.z))throw new Error("Coordinates must contain finite x, y and optional z values");if(r!==1&&(a.x*=r,a.y*=r),t&&e(a),Math.abs(a.y)>Math.PI/2||!Number.isFinite(a.x)||!Number.isFinite(a.y))throw new Error("Coordinate is outside the geographic domain");if(a.x+=0,a.x-=0,t||e(a),n!==1&&(a.x/=n,a.y/=n),!Number.isFinite(a.x)||!Number.isFinite(a.y))throw new Error("Projection produced non-finite coordinates");if(c&&(Math.abs(a.x)>34028234663852886e22||Math.abs(a.y)>34028234663852886e22))throw new Error("Projected coordinate exceeds Float32 range");o[l]=a.x,o[l+1]=a.y}}finally{i.release(a)}}}var kc=w(()=>{wa();bd()});function _a(e){var t=Math.exp(e);return t=(t-1/t)/2,t}var xd=w(()=>{});function qe(e,t){e=Math.abs(e),t=Math.abs(t);var r=Math.max(e,t),n=Math.min(e,t)/(r||1);return r*Math.sqrt(1+Math.pow(n,2))}var Ma=w(()=>{});function oS(e){var t=1+e,r=t-1;return r===0?e:e*Math.log(t)/r}var sS=w(()=>{});function aS(e){var t=Math.abs(e);return t=oS(t*(1+t/(qe(1,t)+1))),e<0?-t:t}var cS=w(()=>{Ma();sS()});function Sd(e,t){for(var r=2*Math.cos(2*t),n=e.length-1,i=e[n],o=0,s;--n>=0;)s=-o+r*i+e[n],o=i,i=s;return t+s*Math.sin(2*t)}var lS=w(()=>{});function hS(e,t){for(var r=2*Math.cos(t),n=e.length-1,i=e[n],o=0,s;--n>=0;)s=-o+r*i+e[n],o=i,i=s;return Math.sin(t)*s}var uS=w(()=>{});function Nh(e){var t=Math.exp(e);return t=(t+1/t)/2,t}var p1=w(()=>{});function g1(e,t,r,n){for(var i=Math.sin(t),o=Math.cos(t),s=_a(r),a=Nh(r),c=2*o*a,l=-2*i*s,h=e.length-1,u=e[h],f=0,d=0,m=0,p,g;--h>=0;)p=d,g=f,d=u,f=m,u=-p+c*d-l*f+e[h],m=-g+l*d+c*f;c=i*a,l=o*s,n.x=c*u-l*m,n.y=c*m+l*u}var fS=w(()=>{xd();p1()});var U,$t,Jo,dS,y1,w1,Oh,Ae=w(()=>{U=Math.PI/2,$t=Math.PI/4,Jo=Math.PI*2,dS=3.14159265359,y1=Math.PI/180,w1=180/Math.PI,Oh=Math.PI/(180*3600)});function Qo(e){return e<0?-1:1}var Bh=w(()=>{});function G(e,t){return t||Math.abs(e)<=dS?e:e-Qo(e)*Jo}var fe=w(()=>{Ae();Bh()});function V8(e){e.x0=e.x0!==void 0?e.x0:0,e.y0=e.y0!==void 0?e.y0:0,e.long0=e.long0!==void 0?e.long0:0,e.lat0=e.lat0!==void 0?e.lat0:0,e.k0=e.k0!==void 0?e.k0:1,e.cgb=[],e.cbg=[],e.utg=[],e.gtu=[];var t=e.es/(1+Math.sqrt(1-e.es)),r=t/(2-t),n=r;e.cgb[0]=r*(2+r*(-2/3+r*(-2+r*(116/45+r*(26/45+r*(-2854/675)))))),e.cbg[0]=r*(-2+r*(2/3+r*(4/3+r*(-82/45+r*(32/45+r*(4642/4725)))))),n=n*r,e.cgb[1]=n*(7/3+r*(-8/5+r*(-227/45+r*(2704/315+r*(2323/945))))),e.cbg[1]=n*(5/3+r*(-16/15+r*(-13/9+r*(904/315+r*(-1522/945))))),n=n*r,e.cgb[2]=n*(56/15+r*(-136/35+r*(-1262/105+r*(73814/2835)))),e.cbg[2]=n*(-26/15+r*(34/21+r*(8/5+r*(-12686/2835)))),n=n*r,e.cgb[3]=n*(4279/630+r*(-332/35+r*(-399572/14175))),e.cbg[3]=n*(1237/630+r*(-12/5+r*(-24832/14175))),n=n*r,e.cgb[4]=n*(4174/315+r*(-144838/6237)),e.cbg[4]=n*(-734/315+r*(109598/31185)),n=n*r,e.cgb[5]=n*(601676/22275),e.cbg[5]=n*(444337/155925),n=Math.pow(r,2),e.Qn=e.k0/(1+r)*(1+n*(1/4+n*(1/64+n/256))),e.utg[0]=r*(-.5+r*(2/3+r*(-37/96+r*(1/360+r*(81/512+r*(-96199/604800)))))),e.gtu[0]=r*(.5+r*(-2/3+r*(5/16+r*(41/180+r*(-127/288+r*(7891/37800)))))),e.utg[1]=n*(-1/48+r*(-1/15+r*(437/1440+r*(-46/105+r*(1118711/3870720))))),e.gtu[1]=n*(13/48+r*(-3/5+r*(557/1440+r*(281/630+r*(-1983433/1935360))))),n=n*r,e.utg[2]=n*(-17/480+r*(37/840+r*(209/4480+r*(-5569/90720)))),e.gtu[2]=n*(61/240+r*(-103/140+r*(15061/26880+r*(167603/181440)))),n=n*r,e.utg[3]=n*(-4397/161280+r*(11/504+r*(830251/7257600))),e.gtu[3]=n*(49561/161280+r*(-179/168+r*(6601661/7257600))),n=n*r,e.utg[4]=n*(-4583/161280+r*(108847/3991680)),e.gtu[4]=n*(34729/80640+r*(-3418889/1995840)),n=n*r,e.utg[5]=n*(-20648693/638668800),e.gtu[5]=n*(212378941/319334400);var i=Sd(e.cbg,e.lat0);e.Zb=-e.Qn*(i+hS(e.gtu,2*i))}function mS(e,t){var r=G(t.x-e.long0,e.over),n=t.y;n=Sd(e.cbg,n);var i=Math.sin(n),o=Math.cos(n),s=Math.sin(r),a=Math.cos(r);n=Math.atan2(i,a*o),r=Math.atan2(s*o,qe(i,o*a)),r=aS(Math.tan(r)),g1(e.gtu,2*n,2*r,t),n=n+t.x,r=r+t.y;var c,l;return Math.abs(r)<=2.623395162778?(c=e.a*(e.Qn*r)+e.x0,l=e.a*(e.Qn*n+e.Zb)+e.y0):(c=1/0,l=1/0),t.x=c,t.y=l,t}function pS(e,t){var r=(t.x-e.x0)*(1/e.a),n=(t.y-e.y0)*(1/e.a);n=(n-e.Zb)/e.Qn,r=r/e.Qn;var i,o;if(Math.abs(r)<=2.623395162778){g1(e.utg,2*n,2*r,t),n=n+t.x,r=r+t.y,r=Math.atan(_a(r));var s=Math.sin(n),a=Math.cos(n),c=Math.sin(r),l=Math.cos(r);n=Math.atan2(s*l,qe(c,l*a)),r=Math.atan2(c,l*a),i=G(r+e.long0,e.over),o=Sd(e.cgb,n)}else i=1/0,o=1/0;return t.x=i,t.y=o,t}function gS(e){let t={...e,cgb:[],cbg:[],utg:[],gtu:[],Qn:0,Zb:0};return V8(t),t}var yS=w(()=>{xd();Ma();cS();lS();uS();fS();fe()});function Ni(e){var t=[];t[0]=k8-e*(q8+e*(wS+e*(_S+e*MS))),t[1]=e*(j8-e*(wS+e*(_S+e*MS)));var r=e*e;return t[2]=r*(W8-e*(H8+e*$8)),r*=e,t[3]=r*(Y8-e*K8),t[4]=r*e*X8,t}var k8,q8,wS,_S,MS,j8,W8,H8,$8,Y8,K8,X8,qc=w(()=>{k8=1,q8=.25,wS=.046875,_S=.01953125,MS=.01068115234375,j8=.75,W8=.46875,H8=.013020833333333334,$8=.007120768229166667,Y8=.3645833333333333,K8=.005696614583333333,X8=.3076171875});function rr(e,t,r,n){return r*=t,t*=t,n[0]*e-r*(n[1]+t*(n[2]+t*(n[3]+t*n[4])))}var ba=w(()=>{});function Oi(e,t,r){for(var n=1/(1-t),i=e,o=Z8;o;--o){var s=Math.sin(i),a=1-t*s*s;if(a=(rr(i,s,Math.cos(i),r)-e)*(a*Math.sqrt(a))*n,i-=a,Math.abs(a)<1e-10)return i}return i}var Z8,jc=w(()=>{ba();Z8=20});function J8(e){e.x0=e.x0!==void 0?e.x0:0,e.y0=e.y0!==void 0?e.y0:0,e.long0=e.long0!==void 0?e.long0:0,e.lat0=e.lat0!==void 0?e.lat0:0,e.es&&(e.en=Ni(e.es),e.ml0=rr(e.lat0,Math.sin(e.lat0),Math.cos(e.lat0),e.en))}function bS(e,t){var r=t.x,n=t.y,i=G(r-e.long0,e.over),o,s,a,c=Math.sin(n),l=Math.cos(n);if(e.es){var u=l*i,f=Math.pow(u,2),d=e.ep2*Math.pow(l,2),m=Math.pow(d,2),p=Math.abs(l)>1e-10?Math.tan(n):0,g=Math.pow(p,2),y=Math.pow(g,2);o=1-e.es*Math.pow(c,2),u=u/Math.sqrt(o);var _=rr(n,c,l,e.en);s=e.a*(e.k0*u*(1+f/6*(1-g+d+f/20*(5-18*g+y+14*d-58*g*d+f/42*(61+179*y-y*g-479*g)))))+e.x0,a=e.a*(e.k0*(_-e.ml0+c*i*u/2*(1+f/12*(5-g+9*d+4*m+f/30*(61+y-58*g+270*d-330*g*d+f/56*(1385+543*y-y*g-3111*g))))))+e.y0}else{var h=l*Math.sin(i);if(Math.abs(Math.abs(h)-1)<1e-10)return 93;if(s=.5*e.a*e.k0*Math.log((1+h)/(1-h))+e.x0,a=l*Math.cos(i)/Math.sqrt(1-Math.pow(h,2)),h=Math.abs(a),h>=1){if(h-1>1e-10)return 93;a=0}else a=Math.acos(a);n<0&&(a=-a),a=e.a*e.k0*(a-e.lat0)+e.y0}return t.x=s,t.y=a,t}function xS(e,t){var r,n,i,o,s=(t.x-e.x0)*(1/e.a),a=(t.y-e.y0)*(1/e.a);if(e.es)if(r=e.ml0+a/e.k0,n=Oi(r,e.es,e.en),Math.abs(n)<U){var f=Math.sin(n),d=Math.cos(n),m=Math.abs(d)>1e-10?Math.tan(n):0,p=e.ep2*Math.pow(d,2),g=Math.pow(p,2),y=Math.pow(m,2),_=Math.pow(y,2);r=1-e.es*Math.pow(f,2);var M=s*Math.sqrt(r)/e.k0,b=Math.pow(M,2);r=r*m,i=n-r*b/(1-e.es)*.5*(1-b/12*(5+3*y-9*p*y+p-4*g-b/30*(61+90*y-252*p*y+45*_+46*p-b/56*(1385+3633*y+4095*_+1574*_*y)))),o=G(e.long0+M*(1-b/6*(1+2*y+p-b/20*(5+28*y+24*_+8*p*y+6*p-b/42*(61+662*y+1320*_+720*_*y))))/d,e.over)}else i=U*Qo(a),o=0;else{var c=Math.exp(s/e.k0),l=.5*(c-1/c),h=e.lat0+a/e.k0,u=Math.cos(h);r=Math.sqrt((1-Math.pow(u,2))/(1+Math.pow(l,2))),i=Math.asin(r),Math.sin(h)<0&&(i=-i),l===0&&u===0?o=0:o=G(Math.atan2(l,u)+e.long0,e.over)}return t.x=o,t.y=i,t}function SS(e){let t={...e,en:[],ml0:0};return J8(t),t}var vS=w(()=>{qc();ba();jc();fe();Ae();Bh()});function vd(e){let t=er(e),r=n=>Pt(n,K(t.long0-Math.PI/6,-Math.PI/2,t.long0+Math.PI/6,Math.PI/2),i=>Gc(n.forward,i,t.long0,t.over),t.primeMeridian,t.over);if(si(e.parameters,"approx"))return r({...Xe("tmerc +approx",SS(t),bS,xS,ai)});if(t.sphere)throw new Error("Spherical transverse Mercator requires +approx");return r({...Xe("etmerc",gS(t),mS,pS,ai)})}var _1,M1,b1=w(()=>{kc();Ie();Ht();ne();wn();yS();vS();_1={name:"tmerc",aliases:["Fast_Transverse_Mercator","Fast Transverse Mercator","Transverse_Mercator","Transverse Mercator","Gauss Kruger","Gauss_Kruger"],parameters:[...ar,...lo,"approx"],flags:["approx"],create:vd},M1={name:"etmerc",aliases:["Extended_Transverse_Mercator","Extended Transverse Mercator"],parameters:[...ar,...lo,"approx"],flags:["approx"],create:vd}});var x1,ES=w(()=>{Ie();Ht();ne();Ee();wn();b1();x1={name:"utm",aliases:["Universal Transverse Mercator System"],parameters:["zone","south","approx"],flags:["south","approx"],create(e){let t=tt(e.parameters,"zone",NaN);if(!Number.isInteger(t)||t<1||t>60)throw new Error("UTM requires an integer +zone from 1 to 60");let r=si(e.parameters,"south"),n=vd({...e,parameters:{...e.parameters,lat_0:"0",lon_0:String(6*t-183),x_0:"500000",y_0:r?"10000000":"0",k_0:"0.9996"}}),i=(6*t-183)*Math.PI/180;return Pt(n,K(i-Math.PI/60,r?-80*Math.PI/180:0,i+Math.PI/60,r?0:84*Math.PI/180),o=>Gc(n.forward,o,i),e.primeMeridian??0,Object.prototype.hasOwnProperty.call(e.parameters,"over"))}}});function v1(e,t){return[Math.cos(t)*Math.cos(e),Math.cos(t)*Math.sin(e),Math.sin(t)]}function Ed(e,t,r,n,i){let o=Math.hypot(e,t);if(!o||Math.abs(r)>o+1e-14)return[];let s=Math.atan2(t,e),a=Math.acos(Math.max(-1,Math.min(1,r/o))),c=[];for(let l of[s-a,s+a])for(let h=Math.ceil((n-l)/(2*Math.PI));h<=Math.floor((i-l)/(2*Math.PI));h++)c.push(l+h*2*Math.PI);return c}function ts(e,t,r,n=!0){let[[i,o],[s,a]]=t,c=(i+s)/2,l=r?[Math.cos(r.latitude),0,Math.sin(r.latitude)]:[1,0,0],h=r?Math.cos(r.distance):-1,u=n?-1/0:1/0,f=[NaN,NaN],d=(p,g)=>{if(p=c+ve(p-c),p<i-1e-12||p>s+1e-12||g<o-1e-12||g>a+1e-12)return;let y=v1(p,g);if(r&&S1(l,y)<h-1e-13)return;let _=S1(e,y);(n?_>u:_<u)&&(u=_,f=[p,g])},m=[i,s,...Ed(-e[1],e[0],0,i,s)];for(let p of m){let g=e[0]*Math.cos(p)+e[1]*Math.sin(p);for(let y of[o,a,...Ed(e[2],-g,0,o,a)])d(p,y)}if(r){let[p,,g]=l;for(let b of[o,a])for(let v of Ed(p*Math.cos(b),0,h-g*Math.sin(b),i,s))d(v,b);for(let b of[i,s])for(let v of Ed(p*Math.cos(b),g,h,o,a))d(b,v);let y=S1(e,l),_=e.map((b,v)=>b-y*l[v]),M=Math.hypot(..._);if(M<=1e-14&&(_=[-l[2],0,l[0]],M=1),M>1e-14)for(let b of[-1,1]){let v=l.map((T,S)=>T*h+b*_[S]*Math.sin(r.distance)/M);d(Math.atan2(v[1],v[0]),Math.atan2(v[2],Math.hypot(v[0],v[1])))}}if(!Number.isFinite(u))throw new Error("CRS coverage does not intersect the rendering domain");return{value:u,point:f}}function se(e,t,r){return[ts(e,t,r,!1).value,ts(e,t,r).value]}function es(e,t,r,n,i){let o=se(e,n,i),s=se(t,n,i).map(c=>c+r);if(s[0]<=0)throw new Error("Projection rendering denominator is not positive");let a=o.flatMap(c=>s.map(l=>c/l));return[!1,!0].map(c=>{let l=Math.min(...a),h=Math.max(...a);for(let u=0;u<60;u++){let f=(l+h)/2,d=e.map((p,g)=>p-f*t[g]);ts(d,n,i,c).value-f*r>0?l=f:h=f}return c?h:l})}var S1,xa=w(()=>{Ee();S1=(e,t)=>e[0]*t[0]+e[1]*t[1]+e[2]*t[2]});function Q8(e,t,r,n=Math.PI){let i=[-180,-90,180,90],o=(s,a)=>{let c=$o(s,e.primeMeridian,e.long0),l=K(c[0][0]-e.long0,c[0][1],c[1][0]-e.long0,c[1][1]),h=[Math.cos(e.lat0),0,Math.sin(e.lat0)],u=a?ts(h,l,void 0,!1).value:-1,d=!a||u<=Math.cos(n)+1e-13?{latitude:e.lat0,distance:t}:void 0,m=Ke(()=>r(l,d),s,e.long0,e.primeMeridian),p=Math.abs(Math.cos(e.lat0))<1e-12,g=(Math.PI/2-t)*180/Math.PI,y=d&&!p&&Yo(_=>{let M=v1(_.x-e.long0,_.y);if(M[0]*Math.cos(e.lat0)+M[2]*Math.sin(e.lat0)>=Math.cos(d.distance)-1e-14)return;if(Math.hypot(M[0]+h[0],M[1],M[2]+h[2])<1e-12){let v=e.lat0+d.distance,T=(l[0][0]+l[1][0])/2,S=T+ve((Math.cos(v)<0?Math.PI:0)-T),E=Math.atan2(Math.sin(v),Math.abs(Math.cos(v)));if(S>=l[0][0]&&S<=l[1][0]&&E>=l[0][1]&&E<=l[1][1]){_.x=S+e.long0,_.y=E;return}}let b=ts(M,l,d);[_.x,_.y]=[b.point[0]+e.long0,b.point[1]]},e.primeMeridian);return{get bounds(){return r(l,d)},normalize(_){m.normalize(_),d&&p?_.y=e.lat0>0?Math.max(g,_.y):Math.min(-g,_.y):y?.(_);let M=(e.long0+e.primeMeridian)*180/Math.PI,b=_.x-M;Math.abs(b)>180&&(_.x=M+oi(b))}}};return s=>o(s??i,!!s)}function rn(e,t,r,n,i=Math.PI){return{...e,longitudeOrigin:t.long0,getRenderingProfile:Q8(t,r,n,i)}}var rs=w(()=>{Ht();ne();xa();Ee();ya()});function Td(e,t,r,n){let i=[-Math.sin(e.lat0),0,Math.cos(e.lat0)],o=[Math.cos(e.lat0),0,Math.sin(e.lat0)],s=[0,1,0],a=n==="stere"?1:0,c=h=>n==="ortho"?se(h,t,r):es(h,o,a,t,r),l=e.a*(n==="stere"?2*e.k0:1);return re(At([e.x0,e.x0],Ct(c(s),l)),At([e.y0,e.y0],Ct(c(i),l)))}function TS(e,t,r){let n=Math.sin(e.lat0),i=Math.cos(e.lat0),o=se([0,0,1],t,r);if(Math.abs(n)<1e-15&&(!r||Math.abs(r.distance-Math.PI/2)<1e-15)){let u=d=>{let m=ts([0,1,0],t,r,d);return m.value/Math.sqrt(1-e.es*Math.sin(m.point[1])**2)},f=d=>(1-e.es)*d/Math.sqrt(1-e.es*d*d);return re(At([e.x0,e.x0],Ct([u(!1),u(!0)],e.a*e.k0)),At([e.y0,e.y0],Ct([f(o[0]),f(o[1])],e.a*e.k0)))}let s=o[0]<=0&&o[1]>=0?0:Math.min(o[0]**2,o[1]**2),a=Math.max(o[0]**2,o[1]**2),c=qn(1/Math.sqrt(1-e.es*s),1/Math.sqrt(1-e.es*a)),l=e.a*e.k0,h=e.es*n*i/Math.sqrt(1-e.es*n*n);return re(At([e.x0,e.x0],Ct(Te(se([0,1,0],t,r),c),l)),At([e.y0+l*h,e.y0+l*h],Ct(Te(se([-n,0,(1-e.es)*i],t,r),c),l)))}function IS(e,t,r){let n=se([Math.cos(e.lat0),0,Math.sin(e.lat0)],t,r)[0],i=e.a/Math.sqrt(1-e.es)*Math.acos(Math.max(-1,Math.min(1,n)));return re([e.x0-i,e.x0+i],[e.y0-i,e.y0+i])}function AS(e,t,r,n,i,o,s){let a=i&&se([0,0,1],n,i),c=K(n[0][0],s(a?Math.asin(Math.max(-1,a[0])):n[0][1]),n[1][0],s(a?Math.asin(Math.min(1,a[1])):n[1][1])),l=i&&{latitude:o,distance:Math.PI-(1-e.es)**2*(Math.PI-i.distance)},h=[Math.cos(o),0,Math.sin(o)],u=[-Math.sin(o),0,Math.cos(o)],f=se(h,c,l),d=[Math.sqrt(2/(1+Math.min(1,f[1]))),f[0]>-1+1e-14?Math.sqrt(2/(1+f[0])):1/0],m=(p,g)=>{let y=se(p,c,l),_=y[0]===0?0:y[0]*(y[0]<0?d[1]:d[0]),M=y[1]===0?0:y[1]*(y[1]>0?d[1]:d[0]);return Ct([Math.max(-2,_),Math.min(2,M)],e.a*g)};return re(At([e.x0,e.x0],m([0,1,0],t)),At([e.y0,e.y0],m(u,r)))}function Id(e,t,r,n,i,o,s=1,a=e.e*Math.atanh(e.e)){let c=K(i[0][0]*s,t(i[0][1]),i[1][0]*s,t(i[1][1])),l=2*a+Math.PI*Math.abs(s-1),h=o&&s===1?Math.min(o.distance+l,Math.PI-(1-e.es)*(Math.PI-o.distance)):o&&o.distance+l,u=h&&h<Math.PI?{latitude:r,distance:h}:void 0,f=[Math.cos(r),0,Math.sin(r)],d=[-Math.sin(r),0,Math.cos(r)],p=c[1][0]-c[0][0]>=2*Math.PI?K(-Math.PI,c[0][1],Math.PI,c[1][1]):c,g=es([0,1,0],f,1,p,u),y=es(d,f,1,p,u);return re(At([e.x0,e.x0],Ct(g,n)),At([e.y0,e.y0],Ct(y,n)))}function PS(e,t,r,n,i,o){let s=[Math.cos(e.lat0),0,Math.sin(e.lat0)],a=[-Math.sin(e.lat0),0,Math.cos(e.lat0)],c=[0,1,0],l=Math.cos(n),h=Math.sin(n),u=Math.cos(r),f=Math.sin(r),d=a.map((_,M)=>l*_+h*c[M]),m=c.map((_,M)=>l*_-h*a[M]),p=s.map((_,M)=>-u*_+f*d[M]),g=es(m,p,u*t,i,o),y=es(d,p,u*t,i,o);return re(At([e.x0,e.x0],Ct(g,e.a*(t-1)*u)),At([e.y0,e.y0],Ct(y,e.a*(t-1))))}function RS(e,t,r){let n=se([Math.cos(e.lat0),0,Math.sin(e.lat0)],t,r)[0],i=Math.acos(Math.max(-1,Math.min(1,n))),o=1-e.es,s=e.a*i/Math.sqrt(o),a=Math.cos(i/o);if(!(a>0))throw new Error("Gnomonic rendering coverage approaches its ellipsoidal horizon");let c=s/a;return re([e.x0-c,e.x0+c],[e.y0-c,e.y0+c])}var ns=w(()=>{Ht();xa();Ie()});function ci(e,t,r,n,i,o,s){let a=i*r/s,c=n*t-o*r*e/s,l=n*e+o*r*t/s;return Math.atan2(l,Math.hypot(a,c))}var Lh=w(()=>{});function nn(e,t,r){var n=e*t;return r/Math.sqrt(1-n*n)}var Wc=w(()=>{});function Lr(e,t,r){let n=Math.cos(t);return Math.exp(e*Math.atanh(e*r))*(r>0?n/(1+r):(1-r)/n)}var Dh=w(()=>{});function Sa(e,t){for(var r=.5*e,n,i,o=U-2*Math.atan(t),s=0;s<=15;s++)if(n=e*Math.sin(o),i=U-2*Math.atan(t*Math.pow((1-n)/(1+n),r))-o,o+=i,Math.abs(i)<=1e-10)return o;return-9999}var Ad=w(()=>{Ae()});function CS(e,t,r){return t*=r,Math.tan(.5*(U+e))*Math.pow((1-t)/(1+t),.5*r)}function tN(e){e.x0=e.x0||0,e.y0=e.y0||0,e.lat0=e.lat0||0,e.long0=e.long0||0,e.coslat0=Math.cos(e.lat0),e.sinlat0=Math.sin(e.lat0),e.sphere?!Number.isNaN(e.lat_ts)&&Math.abs(e.coslat0)<=1e-10&&(e.k0=.5*(1+Qo(e.lat0)*Math.sin(e.lat_ts))):(Math.abs(e.coslat0)<=1e-10&&(e.lat0>0?e.con=1:e.con=-1),e.cons=Math.sqrt(Math.pow(1+e.e,1+e.e)*Math.pow(1-e.e,1-e.e)),!Number.isNaN(e.lat_ts)&&Math.abs(e.coslat0)<=1e-10&&Math.abs(Math.cos(e.lat_ts))>1e-10&&(e.k0=.5*e.cons*nn(e.e,Math.sin(e.lat_ts),Math.cos(e.lat_ts))/Lr(e.e,e.con*e.lat_ts,e.con*Math.sin(e.lat_ts))),e.ms1=nn(e.e,e.sinlat0,e.coslat0),e.X0=2*Math.atan(CS(e.lat0,e.sinlat0,e.e))-U,e.cosX0=Math.cos(e.X0),e.sinX0=Math.sin(e.X0))}function NS(e,t){var r=t.x,n=t.y,i=Math.sin(n),o=Math.cos(n),s,a,c,l,h,u,f=G(r-e.long0,e.over);if(Math.abs(Math.abs(r-e.long0)-Math.PI)<=1e-10&&Math.abs(n+e.lat0)<=1e-10)return t.x=NaN,t.y=NaN,t;if(e.sphere&&Math.abs(e.coslat0)<=1e-10){let d=e.lat0>0?1:-1,m=2*e.a*e.k0*Math.tan(Math.PI/4-d*n/2);return t.x=e.x0+m*Math.sin(f),t.y=e.y0-d*m*Math.cos(f),t}return e.sphere?(s=2*e.k0/(1+e.sinlat0*i+e.coslat0*o*Math.cos(f)),t.x=e.a*s*o*Math.sin(f)+e.x0,t.y=e.a*s*(e.coslat0*i-e.sinlat0*o*Math.cos(f))+e.y0,t):(a=2*Math.atan(CS(n,i,e.e))-U,l=Math.cos(a),c=Math.sin(a),Math.abs(e.coslat0)<=1e-10?(h=Lr(e.e,n*e.con,e.con*i),u=2*e.a*e.k0*h/e.cons,t.x=e.x0+u*Math.sin(r-e.long0),t.y=e.y0-e.con*u*Math.cos(r-e.long0),t):(Math.abs(e.sinlat0)<1e-10?(s=2*e.a*e.k0/(1+l*Math.cos(f)),t.y=s*c+e.y0):(s=2*e.a*e.k0*e.ms1/(e.cosX0*(1+e.sinX0*c+e.cosX0*l*Math.cos(f))),t.y=s*(e.cosX0*c-e.sinX0*l*Math.cos(f))+e.y0),t.x=s*l*Math.sin(f)+e.x0,t))}function OS(e,t){t.x-=e.x0,t.y-=e.y0;var r,n,i,o,s,a=Math.sqrt(t.x*t.x+t.y*t.y);if(e.sphere){var c=2*Math.atan(a/(2*e.a*e.k0));return r=e.long0,n=e.lat0,a<=1e-10?(t.x=r,t.y=n,t):(n=ci(e.sinlat0,e.coslat0,Math.sin(c),Math.cos(c),t.x,t.y,a),Math.abs(e.coslat0)<1e-10?e.lat0>0?r=G(e.long0+Math.atan2(t.x,-1*t.y),e.over):r=G(e.long0+Math.atan2(t.x,t.y),e.over):r=G(e.long0+Math.atan2(t.x*Math.sin(c),a*e.coslat0*Math.cos(c)-t.y*e.sinlat0*Math.sin(c)),e.over),t.x=r,t.y=n,t)}else if(Math.abs(e.coslat0)<=1e-10){if(a<=1e-10)return n=e.lat0,r=e.long0,t.x=r,t.y=n,t;t.x*=e.con,t.y*=e.con,i=a*e.cons/(2*e.a*e.k0),n=e.con*Sa(e.e,i),r=e.con*G(e.con*e.long0+Math.atan2(t.x,-1*t.y),e.over)}else o=2*Math.atan(a*e.cosX0/(2*e.a*e.k0*e.ms1)),r=e.long0,a<=1e-10?s=e.X0:(s=ci(e.sinX0,e.cosX0,Math.sin(o),Math.cos(o),t.x,t.y,a),r=G(e.long0+Math.atan2(t.x*Math.sin(o),a*e.cosX0*Math.cos(o)-t.y*e.sinX0*Math.sin(o)),e.over)),n=-1*Sa(e.e,Math.tan(.5*(U+s)));return t.x=r,t.y=n,t}function BS(e){let t={...e,coslat0:0,sinlat0:0,con:0,cons:0,ms1:0,X0:0,cosX0:0,sinX0:0};return tN(t),t}var LS=w(()=>{Lh();Ae();Bh();Wc();Dh();Ad();fe()});var E1,DS=w(()=>{rs();ns();wn();LS();E1={name:"stere",aliases:["Stereographic_South_Pole","Polar_Stereographic_variant_A","Polar_Stereographic_variant_B","Polar_Stereographic"],parameters:[...ar,...lo,"lat_ts"],create(e){let t=er(e),r=BS(t),n=Zo(t,Xe("stere",r,NS,OS));return rn(n,t,150*Math.PI/180,(i,o)=>r.sphere?Td(r,i,o,"stere"):Id(r,s=>2*Math.atan(Math.tan(Math.PI/4+s/2)*Math.pow((1-r.e*Math.sin(s))/(1+r.e*Math.sin(s)),r.e/2))-Math.PI/2,r.X0,2*r.a*r.k0*(Math.abs(r.coslat0)<1e-10?1/r.cons:r.ms1/r.cosX0),i,o))}}});var Dr=w(()=>{Vx();Xx();Zx()});var Wn=w(()=>{"use strict";VM();H0();e2();n2();s2();E2();T2();B2();U2()});function n6(e,t="float32"){return e instanceof Date?"date-millisecond":typeof e=="number"?t:typeof e=="boolean"?"bool":typeof e=="string"?"utf8":"null"}function i3(e){let t=i6(e);return t!=="null"?{type:t,nullable:!1}:e.length>0?(t=n6(e[0]),{type:t,nullable:!0}):{type:"null",nullable:!0}}function i6(e){if(typeof Float16Array<"u"&&e instanceof Float16Array)return"float16";switch(e.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case BigInt64Array:return"int64";case BigUint64Array:return"uint64";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}var o3=w(()=>{"use strict"});function a3(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function Y(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(h){try{l(n.next(h))}catch(u){s(u)}}function c(h){try{l(n.throw(h))}catch(u){s(u)}}function l(h){h.done?o(h.value):i(h.value).then(a,c)}l((n=n.apply(e,t||[])).next())})}function s3(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function wt(e){return this instanceof wt?(this.v=e,this):new wt(e)}function Gr(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(d){return function(m){return Promise.resolve(m).then(d,u)}}function a(d,m){n[d]&&(i[d]=function(p){return new Promise(function(g,y){o.push([d,p,g,y])>1||c(d,p)})},m&&(i[d]=m(i[d])))}function c(d,m){try{l(n[d](m))}catch(p){f(o[0][3],p)}}function l(d){d.value instanceof wt?Promise.resolve(d.value.v).then(h,u):f(o[0][2],d)}function h(d){c("next",d)}function u(d){c("throw",d)}function f(d,m){d(m),o.shift(),o.length&&c(o[0][0],o[0][1])}}function wl(e){var t,r;return t={},n("next"),n("throw",function(i){throw i}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(i,o){t[i]=e[i]?function(s){return(r=!r)?{value:wt(e[i](s)),done:!1}:o?o(s):s}:o}}function vn(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof s3=="function"?s3(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=e[o]&&function(s){return new Promise(function(a,c){s=e[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},s)}}var an=w(()=>{});var c3,_l,o6,En,fo=w(()=>{c3=new TextDecoder("utf-8"),_l=c3.decode.bind(c3),o6=new TextEncoder,En=e=>o6.encode(e)});var s6,l3,Ze,zr,Tn,ui,Yn,Lm,Dm,Fm,Um,Gm,h3,su,u3,zm,f3,fs=w(()=>{s6=e=>typeof e=="number",l3=e=>typeof e=="boolean",Ze=e=>typeof e=="function",zr=e=>e!=null&&Object(e)===e,Tn=e=>zr(e)&&Ze(e.then),ui=e=>zr(e)&&Ze(e[Symbol.iterator]),Yn=e=>zr(e)&&Ze(e[Symbol.asyncIterator]),Lm=e=>zr(e)&&zr(e.schema),Dm=e=>zr(e)&&"done"in e&&"value"in e,Fm=e=>zr(e)&&Ze(e.stat)&&s6(e.fd),Um=e=>zr(e)&&su(e.body),Gm=e=>"_getDOMStream"in e&&"_getNodeStream"in e,h3=e=>zr(e)&&Ze(e.abort)&&Ze(e.getWriter)&&!Gm(e),su=e=>zr(e)&&Ze(e.cancel)&&Ze(e.getReader)&&!Gm(e),u3=e=>zr(e)&&Ze(e.end)&&Ze(e.write)&&l3(e.writable)&&!Gm(e),zm=e=>zr(e)&&Ze(e.read)&&Ze(e.pipe)&&l3(e.readable)&&!Gm(e),f3=e=>zr(e)&&Ze(e.clear)&&Ze(e.bytes)&&Ze(e.position)&&Ze(e.setPosition)&&Ze(e.capacity)&&Ze(e.getBufferIdentifier)&&Ze(e.createLong)});var gw={};Zr(gw,{compareArrayLike:()=>pw,joinUint8Arrays:()=>In,memcpy:()=>au,rebaseValueOffsets:()=>Vm,toArrayBufferView:()=>Tt,toArrayBufferViewAsyncIterator:()=>fi,toArrayBufferViewIterator:()=>Ui,toBigInt64Array:()=>cu,toBigUint64Array:()=>f6,toFloat32Array:()=>d6,toFloat32ArrayAsyncIterator:()=>P6,toFloat32ArrayIterator:()=>b6,toFloat64Array:()=>m6,toFloat64ArrayAsyncIterator:()=>R6,toFloat64ArrayIterator:()=>x6,toInt16Array:()=>l6,toInt16ArrayAsyncIterator:()=>E6,toInt16ArrayIterator:()=>y6,toInt32Array:()=>Ba,toInt32ArrayAsyncIterator:()=>T6,toInt32ArrayIterator:()=>w6,toInt8Array:()=>c6,toInt8ArrayAsyncIterator:()=>v6,toInt8ArrayIterator:()=>g6,toUint16Array:()=>h6,toUint16ArrayAsyncIterator:()=>I6,toUint16ArrayIterator:()=>_6,toUint32Array:()=>u6,toUint32ArrayAsyncIterator:()=>A6,toUint32ArrayIterator:()=>M6,toUint8Array:()=>nt,toUint8ArrayAsyncIterator:()=>mw,toUint8ArrayIterator:()=>dw,toUint8ClampedArray:()=>p6,toUint8ClampedArrayAsyncIterator:()=>C6,toUint8ClampedArrayIterator:()=>S6});function a6(e){let t=e[0]?[e[0]]:[],r,n,i,o;for(let s,a,c=0,l=0,h=e.length;++c<h;){if(s=t[l],a=e[c],!s||!a||s.buffer!==a.buffer||a.byteOffset<s.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:r,byteLength:i}=s,{byteOffset:n,byteLength:o}=a,r+i<n||n+o<r){a&&(t[++l]=a);continue}t[l]=new Uint8Array(s.buffer,r,n-r+o)}return t}function au(e,t,r=0,n=t.byteLength){let i=e.byteLength,o=new Uint8Array(e.buffer,e.byteOffset,i),s=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,i));return o.set(s,r),e}function In(e,t){let r=a6(e),n=r.reduce((h,u)=>h+u.byteLength,0),i,o,s,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,n);for(let h=r.length;++c<h;){if(i=r[c],o=i.subarray(0,Math.min(i.length,l-a)),l<=a+o.length){o.length<i.length?r[c]=i.subarray(o.length):o.length===i.length&&c++,s?au(s,o,a):s=o;break}au(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),r.slice(c),n-(s?s.byteLength:0)]}function Tt(e,t){let r=Dm(t)?t.value:t;return r instanceof e?e===Uint8Array?new e(r.buffer,r.byteOffset,r.byteLength):r:r?(typeof r=="string"&&(r=En(r)),r instanceof ArrayBuffer?new e(r):r instanceof fw?new e(r):f3(r)?Tt(e,r.bytes()):ArrayBuffer.isView(r)?r.byteLength<=0?new e(0):new e(r.buffer,r.byteOffset,r.byteLength/e.BYTES_PER_ELEMENT):e.from(r)):new e(0)}function*Ui(e,t){let r=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof fw?r(t):ui(t)?t:r(t);return yield*uw((function*(i){let o=null;do o=i.next(yield Tt(e,o));while(!o.done)})(n[Symbol.iterator]())),new e}function fi(e,t){return Gr(this,arguments,function*(){if(Tn(t))return yield wt(yield wt(yield*wl(vn(fi(e,yield wt(t))))));let n=function(s){return Gr(this,arguments,function*(){yield yield wt(yield wt(s))})},i=function(s){return Gr(this,arguments,function*(){yield wt(yield*wl(vn(uw((function*(a){let c=null;do c=a.next(yield c?.value);while(!c.done)})(s[Symbol.iterator]())))))})},o=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof fw?n(t):ui(t)?i(t):Yn(t)?t:n(t);return yield wt(yield*wl(vn(uw((function(s){return Gr(this,arguments,function*(){let a=null;do a=yield wt(s.next(yield yield wt(Tt(e,a))));while(!a.done)})})(o[Symbol.asyncIterator]()))))),yield wt(new e)})}function Vm(e,t,r){if(e!==0){r=r.slice(0,t);let n=typeof r[0]=="bigint"?BigInt(e):e;for(let i=-1,o=r.length;++i<o;)r[i]+=n}return r.subarray(0,t)}function pw(e,t){let r=0,n=e.length;if(n!==t.length)return!1;if(n>0)do if(e[r]!==t[r])return!1;while(++r<n);return!0}var fw,c6,l6,Ba,cu,nt,h6,u6,f6,d6,m6,p6,uw,g6,y6,w6,dw,_6,M6,b6,x6,S6,v6,E6,T6,mw,I6,A6,P6,R6,C6,Je=w(()=>{an();fo();fs();fw=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;c6=e=>Tt(Int8Array,e),l6=e=>Tt(Int16Array,e),Ba=e=>Tt(Int32Array,e),cu=e=>Tt(BigInt64Array,e),nt=e=>Tt(Uint8Array,e),h6=e=>Tt(Uint16Array,e),u6=e=>Tt(Uint32Array,e),f6=e=>Tt(BigUint64Array,e),d6=e=>Tt(Float32Array,e),m6=e=>Tt(Float64Array,e),p6=e=>Tt(Uint8ClampedArray,e),uw=e=>(e.next(),e);g6=e=>Ui(Int8Array,e),y6=e=>Ui(Int16Array,e),w6=e=>Ui(Int32Array,e),dw=e=>Ui(Uint8Array,e),_6=e=>Ui(Uint16Array,e),M6=e=>Ui(Uint32Array,e),b6=e=>Ui(Float32Array,e),x6=e=>Ui(Float64Array,e),S6=e=>Ui(Uint8ClampedArray,e);v6=e=>fi(Int8Array,e),E6=e=>fi(Int16Array,e),T6=e=>fi(Int32Array,e),mw=e=>fi(Uint8Array,e),I6=e=>fi(Uint16Array,e),A6=e=>fi(Uint32Array,e),P6=e=>fi(Float32Array,e),R6=e=>fi(Float64Array,e),C6=e=>fi(Uint8ClampedArray,e)});function*N6(e){let t,r=!1,n=[],i,o,s,a=0;function c(){return o==="peek"?In(n,s)[0]:([i,n,a]=In(n,s),i)}({cmd:o,size:s}=(yield null)||{cmd:"read",size:0});let l=dw(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(s-a)?l.next():l.next(s-a),!t&&i.byteLength>0&&(n.push(i),a+=i.byteLength),t||s<=a)do({cmd:o,size:s}=yield c());while(s<a);while(!t)}catch(h){r=!0,typeof l.throw=="function"&&l.throw(h)}finally{r===!1&&typeof l.return=="function"&&l.return(null)}return null}function O6(e){return Gr(this,arguments,function*(){let r,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?In(i,a)[0]:([o,i,c]=In(i,a),o)}({cmd:s,size:a}=(yield yield wt(null))||{cmd:"read",size:0});let h=mw(e)[Symbol.asyncIterator]();try{do if({done:r,value:o}=Number.isNaN(a-c)?yield wt(h.next()):yield wt(h.next(a-c)),!r&&o.byteLength>0&&(i.push(o),c+=o.byteLength),r||a<=c)do({cmd:s,size:a}=yield yield wt(l()));while(a<c);while(!r)}catch(u){n=!0,typeof h.throw=="function"&&(yield wt(h.throw(u)))}finally{n===!1&&typeof h.return=="function"&&(yield wt(h.return(new Uint8Array(0))))}return yield wt(null)})}function B6(e){return Gr(this,arguments,function*(){let r=!1,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?In(i,a)[0]:([o,i,c]=In(i,a),o)}({cmd:s,size:a}=(yield yield wt(null))||{cmd:"read",size:0});let h=new ww(e);try{do if({done:r,value:o}=Number.isNaN(a-c)?yield wt(h.read()):yield wt(h.read(a-c)),!r&&o.byteLength>0&&(i.push(nt(o)),c+=o.byteLength),r||a<=c)do({cmd:s,size:a}=yield yield wt(l()));while(a<c);while(!r)}catch(u){n=!0,yield wt(h.cancel(u))}finally{n===!1?yield wt(h.cancel()):e.locked&&h.releaseLock()}return yield wt(null)})}function L6(e){return Gr(this,arguments,function*(){let r=[],n="error",i=!1,o=null,s,a,c=0,l=[],h;function u(){return s==="peek"?In(l,a)[0]:([h,l,c]=In(l,a),h)}if({cmd:s,size:a}=(yield yield wt(null))||{cmd:"read",size:0},e.isTTY)return yield yield wt(new Uint8Array(0)),yield wt(null);try{r[0]=yw(e,"end"),r[1]=yw(e,"error");do{if(r[2]=yw(e,"readable"),[n,o]=yield wt(Promise.race(r.map(d=>d[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-c)?(h=nt(e.read(a-c)),h.byteLength<a-c&&(h=nt(e.read()))):h=nt(e.read()),h.byteLength>0&&(l.push(h),c+=h.byteLength)),i||a<=c)do({cmd:s,size:a}=yield yield wt(u()));while(a<c)}while(!i)}finally{yield wt(f(r,n==="error"?o:null))}return yield wt(null);function f(d,m){return h=l=null,new Promise((p,g)=>{for(let[y,_]of d)e.off(y,_);try{let y=e.destroy;y&&y.call(e,m),m=void 0}catch(y){m=y||m}finally{m!=null?g(m):p()}})}})}var lr,km,ww,yw,lu=w(()=>{an();Je();lr={fromIterable(e){return km(N6(e))},fromAsyncIterable(e){return km(O6(e))},fromDOMStream(e){return km(B6(e))},fromNodeStream(e){return km(L6(e))},toDOMStream(e,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(e,t){throw new Error('"toNodeStream" not available in this environment')}},km=e=>(e.next(),e);ww=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return Y(this,void 0,void 0,function*(){let{reader:r,source:n}=this;r&&(yield r.cancel(t).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(t){return Y(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let r=yield this.reader.read();return!r.done&&(r.value=nt(r)),r})}},yw=(e,t)=>{let r=i=>n([t,i]),n;return[t,r,new Promise(i=>(n=i)&&e.once(t,r))]}});var Xt,qm=w(()=>{(function(e){e[e.V1=0]="V1",e[e.V2=1]="V2",e[e.V3=2]="V3",e[e.V4=3]="V4",e[e.V5=4]="V5"})(Xt||(Xt={}))});var jt,_w=w(()=>{(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(jt||(jt={}))});var Vt,Mw=w(()=>{(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(Vt||(Vt={}))});var Qt,bw=w(()=>{(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(Qt||(Qt={}))});var q,hu=w(()=>{(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(q||(q={}))});var Lt,xw=w(()=>{(function(e){e[e.YEAR_MONTH=0]="YEAR_MONTH",e[e.DAY_TIME=1]="DAY_TIME",e[e.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(Lt||(Lt={}))});var jm=w(()=>{});var Gi,Wm,Hm,Ml,Sw=w(()=>{Gi=new Int32Array(2),Wm=new Float32Array(Gi.buffer),Hm=new Float64Array(Gi.buffer),Ml=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1});var uu,vw=w(()=>{(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(uu||(uu={}))});var hr,Ew=w(()=>{jm();vw();Sw();hr=class e{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new e(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return Gi[0]=this.readInt32(t),Wm[0]}readFloat64(t){return Gi[Ml?0:1]=this.readInt32(t),Gi[Ml?1:0]=this.readInt32(t+4),Hm[0]}writeInt8(t,r){this.bytes_[t]=r}writeUint8(t,r){this.bytes_[t]=r}writeInt16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeUint16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeInt32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeUint32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeInt64(t,r){this.writeInt32(t,Number(BigInt.asIntN(32,r))),this.writeInt32(t+4,Number(BigInt.asIntN(32,r>>BigInt(32))))}writeUint64(t,r){this.writeUint32(t,Number(BigInt.asUintN(32,r))),this.writeUint32(t+4,Number(BigInt.asUintN(32,r>>BigInt(32))))}writeFloat32(t,r){Wm[0]=r,this.writeInt32(t,Gi[0])}writeFloat64(t,r){Hm[0]=r,this.writeInt32(t,Gi[Ml?0:1]),this.writeInt32(t+4,Gi[Ml?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let r=0;r<4;r++)t+=String.fromCharCode(this.readInt8(this.position_+4+r));return t}__offset(t,r){let n=t-this.readInt32(t);return r<this.readInt16(n)?this.readInt16(n+r):0}__union(t,r){return t.bb_pos=r+this.readInt32(r),t.bb=this,t}__string(t,r){t+=this.readInt32(t);let n=this.readInt32(t);t+=4;let i=this.bytes_.subarray(t,t+n);return r===uu.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,r){return typeof t=="string"?this.__string(r):this.__union(t,r)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let r=0;r<4;r++)if(t.charCodeAt(r)!=this.readInt8(this.position()+4+r))return!1;return!0}createScalarList(t,r){let n=[];for(let i=0;i<r;++i){let o=t(i);o!==null&&n.push(o)}return n}createObjList(t,r){let n=[];for(let i=0;i<r;++i){let o=t(i);o!==null&&n.push(o.unpack())}return n}}});var La,d3=w(()=>{Ew();jm();La=class e{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let r;t?r=t:r=1024,this.bb=hr.allocate(r),this.space=r}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,r){t>this.minalign&&(this.minalign=t);let n=~(this.bb.capacity()-this.space+r)+1&t-1;for(;this.space<n+t+r;){let i=this.bb.capacity();this.bb=e.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(n)}pad(t){for(let r=0;r<t;r++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,r,n){(this.force_defaults||r!=n)&&(this.addInt8(r),this.slot(t))}addFieldInt16(t,r,n){(this.force_defaults||r!=n)&&(this.addInt16(r),this.slot(t))}addFieldInt32(t,r,n){(this.force_defaults||r!=n)&&(this.addInt32(r),this.slot(t))}addFieldInt64(t,r,n){(this.force_defaults||r!==n)&&(this.addInt64(r),this.slot(t))}addFieldFloat32(t,r,n){(this.force_defaults||r!=n)&&(this.addFloat32(r),this.slot(t))}addFieldFloat64(t,r,n){(this.force_defaults||r!=n)&&(this.addFloat64(r),this.slot(t))}addFieldOffset(t,r,n){(this.force_defaults||r!=n)&&(this.addOffset(r),this.slot(t))}addFieldStruct(t,r,n){r!=n&&(this.nested(r),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let r=t.capacity();if(r&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let n=r<<1,i=hr.allocate(n);return i.setPosition(n-r),i.bytes().set(t.bytes(),n-r),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let r=0;r<t;r++)this.vtable[r]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),r=this.vtable_in_use-1;for(;r>=0&&this.vtable[r]==0;r--);let n=r+1;for(;r>=0;r--)this.addInt16(this.vtable[r]!=0?t-this.vtable[r]:0);let i=2;this.addInt16(t-this.object_start);let o=(n+i)*2;this.addInt16(o);let s=0,a=this.space;t:for(r=0;r<this.vtables.length;r++){let c=this.bb.capacity()-this.vtables[r];if(o==this.bb.readInt16(c)){for(let l=2;l<o;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))continue t;s=this.vtables[r];break}}return s?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,s-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,r,n){let i=n?4:0;if(r){let o=r;if(this.prep(this.minalign,8+i),o.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let s=3;s>=0;s--)this.writeInt8(o.charCodeAt(s))}this.prep(this.minalign,4+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,r){this.finish(t,r,!0)}requiredField(t,r){let n=this.bb.capacity()-t,i=n-this.bb.readInt32(n);if(!(r<this.bb.readInt16(i)&&this.bb.readInt16(i+r)!=0))throw new TypeError("FlatBuffers: field "+r+" must be set")}startVector(t,r,n){this.notNested(),this.vector_num_elems=r,this.prep(4,t*r),this.prep(n,t*r)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let r=this.createString(t);return this.string_maps.set(t,r),r}createString(t){if(t==null)return 0;let r;return t instanceof Uint8Array?r=t:r=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,r.length,1),this.bb.setPosition(this.space-=r.length),this.bb.bytes().set(r,this.space),this.endVector()}createByteVector(t){return t==null?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let r=[];for(let n=0;n<t.length;++n){let i=t[n];if(i!==null)r.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return r}createStructOffsetList(t,r){return r(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}}});var Gt=w(()=>{jm();Sw();d3();Ew();vw()});var Da,Tw=w(()=>{(function(e){e[e.BUFFER=0]="BUFFER"})(Da||(Da={}))});var ur,bl=w(()=>{(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(ur||(ur={}))});var mo,Iw=w(()=>{Gt();Tw();bl();mo=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBodyCompression(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):ur.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Da.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,r){t.addFieldInt8(0,r,ur.LZ4_FRAME)}static addMethod(t,r){t.addFieldInt8(1,r,Da.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,r,n){return e.startBodyCompression(t),e.addCodec(t,r),e.addMethod(t,n),e.endBodyCompression(t)}}});var xl,Aw=w(()=>{xl=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,r,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(r??0)),t.offset()}}});var Sl,Pw=w(()=>{Sl=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,r,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(r??0)),t.offset()}}});var br,Rw=w(()=>{Gt();Iw();Aw();Pw();br=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsRecordBatch(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new Sl).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new xl).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let r=this.bb.__offset(this.bb_pos,10);return r?(t||new mo).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}variadicBufferCounts(t){let r=this.bb.__offset(this.bb_pos,12);return r?this.bb.readInt64(this.bb.__vector(this.bb_pos+r)+t*8):BigInt(0)}variadicBufferCountsLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startRecordBatch(t){t.startObject(5)}static addLength(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addNodes(t,r){t.addFieldOffset(1,r,0)}static startNodesVector(t,r){t.startVector(16,r,8)}static addBuffers(t,r){t.addFieldOffset(2,r,0)}static startBuffersVector(t,r){t.startVector(16,r,8)}static addCompression(t,r){t.addFieldOffset(3,r,0)}static addVariadicBufferCounts(t,r){t.addFieldOffset(4,r,0)}static createVariadicBufferCountsVector(t,r){t.startVector(8,r.length,8);for(let n=r.length-1;n>=0;n--)t.addInt64(r[n]);return t.endVector()}static startVariadicBufferCountsVector(t,r){t.startVector(8,r,8)}static endRecordBatch(t){return t.endObject()}}});var po,m3=w(()=>{Gt();Rw();po=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryBatch(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new br).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addData(t,r){t.addFieldOffset(1,r,0)}static addIsDelta(t,r){t.addFieldInt8(2,+r,0)}static endDictionaryBatch(t){return t.endObject()}}});var ds,Cw=w(()=>{(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(ds||(ds={}))});var fu,p3=w(()=>{(function(e){e[e.DenseArray=0]="DenseArray"})(fu||(fu={}))});var mi,Ym=w(()=>{Gt();mi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInt(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,r){t.addFieldInt32(0,r,0)}static addIsSigned(t,r){t.addFieldInt8(1,+r,0)}static endInt(t){return t.endObject()}static createInt(t,r,n){return e.startInt(t),e.addBitWidth(t,r),e.addIsSigned(t,n),e.endInt(t)}}});var zi,Nw=w(()=>{Gt();p3();Ym();zi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryEncoding(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new mi).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):fu.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addIndexType(t,r){t.addFieldOffset(1,r,0)}static addIsOrdered(t,r){t.addFieldInt8(2,+r,0)}static addDictionaryKind(t,r){t.addFieldInt16(3,r,fu.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}}});var Ce,vl=w(()=>{Gt();Ce=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsKeyValue(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}key(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}value(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,r){t.addFieldOffset(0,r,0)}static addValue(t,r){t.addFieldOffset(1,r,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,r,n){return e.startKeyValue(t),e.addKey(t,r),e.addValue(t,n),e.endKeyValue(t)}}});var du,g3=w(()=>{Gt();du=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return e.startBinary(t),e.endBinary(t)}}});var mu,y3=w(()=>{Gt();mu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBinaryView(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinaryView(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinaryView(t){t.startObject(0)}static endBinaryView(t){return t.endObject()}static createBinaryView(t){return e.startBinaryView(t),e.endBinaryView(t)}}});var pu,w3=w(()=>{Gt();pu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBool(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return e.startBool(t),e.endBool(t)}}});var ms,Ow=w(()=>{Gt();bw();ms=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDate(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Qt.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,Qt.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,r){return e.startDate(t),e.addUnit(t,r),e.endDate(t)}}});var Vi,Bw=w(()=>{Gt();Vi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDecimal(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,r){t.addFieldInt32(0,r,0)}static addScale(t,r){t.addFieldInt32(1,r,0)}static addBitWidth(t,r){t.addFieldInt32(2,r,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,r,n,i){return e.startDecimal(t),e.addPrecision(t,r),e.addScale(t,n),e.addBitWidth(t,i),e.endDecimal(t)}}});var ps,Lw=w(()=>{Gt();hu();ps=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDuration(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):q.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,q.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,r){return e.startDuration(t),e.addUnit(t,r),e.endDuration(t)}}});var gs,Dw=w(()=>{Gt();gs=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,r){t.addFieldInt32(0,r,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,r){return e.startFixedSizeBinary(t),e.addByteWidth(t,r),e.endFixedSizeBinary(t)}}});var ys,Fw=w(()=>{Gt();ys=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,r){t.addFieldInt32(0,r,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,r){return e.startFixedSizeList(t),e.addListSize(t,r),e.endFixedSizeList(t)}}});var ws,Uw=w(()=>{Gt();Mw();ws=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFloatingPoint(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Vt.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,r){t.addFieldInt16(0,r,Vt.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,r){return e.startFloatingPoint(t),e.addPrecision(t,r),e.endFloatingPoint(t)}}});var _s,Gw=w(()=>{Gt();xw();_s=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInterval(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Lt.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,Lt.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,r){return e.startInterval(t),e.addUnit(t,r),e.endInterval(t)}}});var gu,_3=w(()=>{Gt();gu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return e.startLargeBinary(t),e.endLargeBinary(t)}}});var yu,M3=w(()=>{Gt();yu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeList(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeList(t){t.startObject(0)}static endLargeList(t){return t.endObject()}static createLargeList(t){return e.startLargeList(t),e.endLargeList(t)}}});var wu,b3=w(()=>{Gt();wu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeUtf8(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return e.startLargeUtf8(t),e.endLargeUtf8(t)}}});var _u,x3=w(()=>{Gt();_u=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return e.startList(t),e.endList(t)}}});var Ms,zw=w(()=>{Gt();Ms=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMap(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,r){t.addFieldInt8(0,+r,0)}static endMap(t){return t.endObject()}static createMap(t,r){return e.startMap(t),e.addKeysSorted(t,r),e.endMap(t)}}});var Mu,S3=w(()=>{Gt();Mu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsNull(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return e.startNull(t),e.endNull(t)}}});var bu,v3=w(()=>{Gt();bu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsStruct_(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return e.startStruct_(t),e.endStruct_(t)}}});var go,Vw=w(()=>{Gt();hu();go=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTime(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):q.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,q.MILLISECOND)}static addBitWidth(t,r){t.addFieldInt32(1,r,32)}static endTime(t){return t.endObject()}static createTime(t,r,n){return e.startTime(t),e.addUnit(t,r),e.addBitWidth(t,n),e.endTime(t)}}});var yo,kw=w(()=>{Gt();hu();yo=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTimestamp(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):q.SECOND}timezone(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,q.SECOND)}static addTimezone(t,r){t.addFieldOffset(1,r,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,r,n){return e.startTimestamp(t),e.addUnit(t,r),e.addTimezone(t,n),e.endTimestamp(t)}}});var pi,qw=w(()=>{Gt();_w();pi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUnion(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):jt.Sparse}typeIds(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.readInt32(this.bb.__vector(this.bb_pos+r)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,r){t.addFieldInt16(0,r,jt.Sparse)}static addTypeIds(t,r){t.addFieldOffset(1,r,0)}static createTypeIdsVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addInt32(r[n]);return t.endVector()}static startTypeIdsVector(t,r){t.startVector(4,r,4)}static endUnion(t){return t.endObject()}static createUnion(t,r,n){return e.startUnion(t),e.addMode(t,r),e.addTypeIds(t,n),e.endUnion(t)}}});var xu,E3=w(()=>{Gt();xu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUtf8(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return e.startUtf8(t),e.endUtf8(t)}}});var Su,T3=w(()=>{Gt();Su=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUtf8View(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8View(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8View(t){t.startObject(0)}static endUtf8View(t){return t.endObject()}static createUtf8View(t){return e.startUtf8View(t),e.endUtf8View(t)}}});var lt,Km=w(()=>{(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.FloatingPoint=3]="FloatingPoint",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct_=13]="Struct_",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.LargeList=21]="LargeList",e[e.RunEndEncoded=22]="RunEndEncoded",e[e.BinaryView=23]="BinaryView",e[e.Utf8View=24]="Utf8View",e[e.ListView=25]="ListView",e[e.LargeListView=26]="LargeListView"})(lt||(lt={}))});var xr,jw=w(()=>{Gt();Nw();vl();Km();xr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsField(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}name(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):lt.NONE}type(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.__union(t,this.bb_pos+r):null}dictionary(t){let r=this.bb.__offset(this.bb_pos,12);return r?(t||new zi).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}children(t,r){let n=this.bb.__offset(this.bb_pos,14);return n?(r||new e).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,16);return n?(r||new Ce).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,r){t.addFieldOffset(0,r,0)}static addNullable(t,r){t.addFieldInt8(1,+r,0)}static addTypeType(t,r){t.addFieldInt8(2,r,lt.NONE)}static addType(t,r){t.addFieldOffset(3,r,0)}static addDictionary(t,r){t.addFieldOffset(4,r,0)}static addChildren(t,r){t.addFieldOffset(5,r,0)}static createChildrenVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startChildrenVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(6,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endField(t){return t.endObject()}}});var cn,Ww=w(()=>{Gt();Cw();jw();vl();cn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsSchema(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ds.Little}fields(t,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new xr).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new Ce).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.readInt64(this.bb.__vector(this.bb_pos+r)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,r){t.addFieldInt16(0,r,ds.Little)}static addFields(t,r){t.addFieldOffset(1,r,0)}static createFieldsVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startFieldsVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(2,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static addFeatures(t,r){t.addFieldOffset(3,r,0)}static createFeaturesVector(t,r){t.startVector(8,r.length,8);for(let n=r.length-1;n>=0;n--)t.addInt64(r[n]);return t.endVector()}static startFeaturesVector(t,r){t.startVector(8,r,8)}static endSchema(t){return t.endObject()}static createSchema(t,r,n,i,o){return e.startSchema(t),e.addEndianness(t,r),e.addFields(t,n),e.addCustomMetadata(t,i),e.addFeatures(t,o),e.endSchema(t)}}});var Nt,Xm=w(()=>{(function(e){e[e.NONE=0]="NONE",e[e.Schema=1]="Schema",e[e.DictionaryBatch=2]="DictionaryBatch",e[e.RecordBatch=3]="RecordBatch",e[e.Tensor=4]="Tensor",e[e.SparseTensor=5]="SparseTensor"})(Nt||(Nt={}))});var x,xe,Ne=w(()=>{qm();_w();Mw();bw();hu();xw();Xm();(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.LargeList=21]="LargeList",e[e.BinaryView=23]="BinaryView",e[e.Utf8View=24]="Utf8View",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth",e[e.DurationSecond=-27]="DurationSecond",e[e.DurationMillisecond=-28]="DurationMillisecond",e[e.DurationMicrosecond=-29]="DurationMicrosecond",e[e.DurationNanosecond=-30]="DurationNanosecond",e[e.IntervalMonthDayNano=-31]="IntervalMonthDayNano"})(x||(x={}));(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(xe||(xe={}))});var Hw={};Zr(Hw,{valueToString:()=>gi});function gi(e){if(e===null)return"null";if(e===void 0)return"undefined";switch(typeof e){case"number":return`${e}`;case"bigint":return`${e}`;case"string":return`"${e}"`}return typeof e[Symbol.toPrimitive]=="function"?e[Symbol.toPrimitive]("string"):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(t=>gi(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,r)=>typeof r=="bigint"?`${r}`:r)}var vu=w(()=>{});function It(e){if(typeof e=="bigint"&&(e<Number.MIN_SAFE_INTEGER||e>Number.MAX_SAFE_INTEGER))throw new TypeError(`${e} is not safe to convert to a number.`);return Number(e)}function $w(e,t){return It(e/t)+It(e%t)/It(t)}var ki=w(()=>{});var Xw={};Zr(Xw,{BN:()=>Fa,bigNumToBigInt:()=>A3,bigNumToNumber:()=>Kw,bigNumToString:()=>Il,isArrowBigNumSymbol:()=>I3});function yi(e,...t){return t.length===0?Object.setPrototypeOf(Tt(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}function El(...e){return yi.apply(this,e)}function Tl(...e){return yi.apply(this,e)}function Eu(...e){return yi.apply(this,e)}function Kw(e,t){let{buffer:r,byteOffset:n,byteLength:i,signed:o}=e,s=new BigUint64Array(r,n,i/8),a=o&&s.at(-1)&BigInt(1)<<BigInt(63),c=BigInt(0),l=0;if(a){for(let h of s)c|=(h^F6)*(BigInt(1)<<BigInt(64*l++));c*=BigInt(-1),c-=BigInt(1)}else for(let h of s)c|=h*(BigInt(1)<<BigInt(64*l++));if(typeof t=="number"&&t>0){let h=BigInt("1".padEnd(t+1,"0")),u=c/h,f=a?-(c%h):c%h,d=It(u),m=`${f}`.padStart(t,"0");return+`${a&&d===0?"-":""}${d}.${m}`}return It(c)}function Il(e){if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return Yw(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Yw(e);t=t.slice();let n=1;for(let o=0;o<t.length;o++){let s=t[o],a=~s+n;t[o]=a,n&=s===0?1:0}return`-${Yw(t)}`}function A3(e){return e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:Il(e)}function Yw(e){let t="",r=new Uint32Array(2),n=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),o=-1,s=n.length-1;do{for(r[0]=n[o=0];o<s;)n[o++]=r[1]=r[0]/10,r[0]=(r[0]-r[1]*10<<16)+n[o];n[o]=r[1]=r[0]/10,r[0]=r[0]-r[1]*10,t=`${r[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}var I3,D6,F6,Fa,Zm=w(()=>{Je();ki();I3=Symbol.for("isArrowBigNum");yi.prototype[I3]=!0;yi.prototype.toJSON=function(){return`"${Il(this)}"`};yi.prototype.valueOf=function(e){return Kw(this,e)};yi.prototype.toString=function(){return Il(this)};yi.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return Kw(this);case"string":return Il(this);case"default":return A3(this)}return Il(this)};Object.setPrototypeOf(El.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Tl.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Eu.prototype,Object.create(Uint32Array.prototype));Object.assign(El.prototype,yi.prototype,{constructor:El,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(Tl.prototype,yi.prototype,{constructor:Tl,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Eu.prototype,yi.prototype,{constructor:Eu,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});D6=BigInt(4294967296)*BigInt(4294967296),F6=D6-BigInt(1);Fa=class e{static new(t,r){switch(r){case!0:return new El(t);case!1:return new Tl(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new El(t)}return t.byteLength===16?new Eu(t):new Tl(t)}static signed(t){return new El(t)}static unsigned(t){return new Tl(t)}static decimal(t){return new Eu(t)}constructor(t,r){return e.new(t,r)}}});function Ln(e){let t=e;switch(e.typeId){case x.Decimal:return e.bitWidth/32;case x.Interval:return t.unit===Lt.MONTH_DAY_NANO?4:1+t.unit;case x.BinaryView:case x.Utf8View:return 16;case x.FixedSizeList:return t.listSize;case x.FixedSizeBinary:return t.byteWidth;default:return 1}}var P3,R3,C3,N3,O3,B3,L3,D3,F3,U3,G3,z3,V3,k3,q3,j3,W3,H3,$3,Y3,K3,X3,Z3,J3,Q3,t4,z,De,Se,An,Pn,Ve,Rn,Cn,Nn,Vr,wi,Sr,_i,kr,On,ln,Mt,Mi,vr,qr,bi,Er,hn,jr,bs,xs,fr,Ss,vs,Es,Ts,dr,Is,qi,As,Ps,Tr,Rs,Cs,Tu,Wr,Iu,Au,Pu,Ru,je,Bn,Yt,Hr,wo,Ns,un,_e,Ir,U6,We,te=w(()=>{ki();Ne();t4=Symbol.for("apache-arrow/DataType"),z=class e{static isDataType(t){return t?.[t4]===!0}static isNull(t){return t?.typeId===x.Null}static isInt(t){return t?.typeId===x.Int}static isFloat(t){return t?.typeId===x.Float}static isBinary(t){return t?.typeId===x.Binary}static isBinaryView(t){return t?.typeId===x.BinaryView}static isLargeBinary(t){return t?.typeId===x.LargeBinary}static isUtf8(t){return t?.typeId===x.Utf8}static isUtf8View(t){return t?.typeId===x.Utf8View}static isLargeUtf8(t){return t?.typeId===x.LargeUtf8}static isBool(t){return t?.typeId===x.Bool}static isDecimal(t){return t?.typeId===x.Decimal}static isDate(t){return t?.typeId===x.Date}static isTime(t){return t?.typeId===x.Time}static isTimestamp(t){return t?.typeId===x.Timestamp}static isInterval(t){return t?.typeId===x.Interval}static isDuration(t){return t?.typeId===x.Duration}static isList(t){return t?.typeId===x.List}static isLargeList(t){return t?.typeId===x.LargeList}static isStruct(t){return t?.typeId===x.Struct}static isUnion(t){return t?.typeId===x.Union}static isFixedSizeBinary(t){return t?.typeId===x.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===x.FixedSizeList}static isMap(t){return t?.typeId===x.Map}static isDictionary(t){return t?.typeId===x.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===jt.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===jt.Sparse}constructor(t){this.typeId=t}};P3=Symbol.toStringTag;z[P3]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[t4]=!0,e[Symbol.toStringTag]="DataType"))(z.prototype);De=class extends z{constructor(){super(x.Null)}toString(){return"Null"}};R3=Symbol.toStringTag;De[R3]=(e=>e[Symbol.toStringTag]="Null")(De.prototype);Se=class extends z{constructor(t,r){super(x.Int),this.isSigned=t,this.bitWidth=r}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};C3=Symbol.toStringTag;Se[C3]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(Se.prototype);An=class extends Se{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},Pn=class extends Se{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},Ve=class extends Se{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},Rn=class extends Se{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},Cn=class extends Se{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},Nn=class extends Se{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Vr=class extends Se{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},wi=class extends Se{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(An.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(Pn.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Ve.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(Rn.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(Cn.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Nn.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Vr.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(wi.prototype,"ArrayType",{value:BigUint64Array});Sr=class extends z{constructor(t){super(x.Float),this.precision=t}get ArrayType(){switch(this.precision){case Vt.HALF:return Uint16Array;case Vt.SINGLE:return Float32Array;case Vt.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};N3=Symbol.toStringTag;Sr[N3]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(Sr.prototype);_i=class extends Sr{constructor(){super(Vt.HALF)}},kr=class extends Sr{constructor(){super(Vt.SINGLE)}},On=class extends Sr{constructor(){super(Vt.DOUBLE)}};Object.defineProperty(_i.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(kr.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(On.prototype,"ArrayType",{value:Float64Array});ln=class extends z{constructor(){super(x.Binary)}toString(){return"Binary"}};O3=Symbol.toStringTag;ln[O3]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(ln.prototype);Mt=class extends z{constructor(){super(x.BinaryView)}toString(){return"BinaryView"}};B3=Symbol.toStringTag;Mt.ELEMENT_WIDTH=16;Mt.INLINE_CAPACITY=12;Mt.LENGTH_OFFSET=0;Mt.INLINE_OFFSET=4;Mt.BUFFER_INDEX_OFFSET=8;Mt.BUFFER_OFFSET_OFFSET=12;Mt[B3]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="BinaryView"))(Mt.prototype);Mi=class extends z{constructor(){super(x.LargeBinary)}toString(){return"LargeBinary"}};L3=Symbol.toStringTag;Mi[L3]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeBinary"))(Mi.prototype);vr=class extends z{constructor(){super(x.Utf8)}toString(){return"Utf8"}};D3=Symbol.toStringTag;vr[D3]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(vr.prototype);qr=class extends z{constructor(){super(x.Utf8View)}toString(){return"Utf8View"}};F3=Symbol.toStringTag;qr.ELEMENT_WIDTH=Mt.ELEMENT_WIDTH;qr.INLINE_CAPACITY=Mt.INLINE_CAPACITY;qr[F3]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8View"))(qr.prototype);bi=class extends z{constructor(){super(x.LargeUtf8)}toString(){return"LargeUtf8"}};U3=Symbol.toStringTag;bi[U3]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeUtf8"))(bi.prototype);Er=class extends z{constructor(){super(x.Bool)}toString(){return"Bool"}};G3=Symbol.toStringTag;Er[G3]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(Er.prototype);hn=class extends z{constructor(t,r,n=128){super(x.Decimal),this.scale=t,this.precision=r,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};z3=Symbol.toStringTag;hn[z3]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(hn.prototype);jr=class extends z{constructor(t){super(x.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${Qt[this.unit]}>`}get ArrayType(){return this.unit===Qt.DAY?Int32Array:BigInt64Array}};V3=Symbol.toStringTag;jr[V3]=(e=>(e.unit=null,e[Symbol.toStringTag]="Date"))(jr.prototype);bs=class extends jr{constructor(){super(Qt.DAY)}},xs=class extends jr{constructor(){super(Qt.MILLISECOND)}},fr=class extends z{constructor(t,r){super(x.Time),this.unit=t,this.bitWidth=r}toString(){return`Time${this.bitWidth}<${q[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};k3=Symbol.toStringTag;fr[k3]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(fr.prototype);Ss=class extends fr{constructor(){super(q.SECOND,32)}},vs=class extends fr{constructor(){super(q.MILLISECOND,32)}},Es=class extends fr{constructor(){super(q.MICROSECOND,64)}},Ts=class extends fr{constructor(){super(q.NANOSECOND,64)}},dr=class extends z{constructor(t,r){super(x.Timestamp),this.unit=t,this.timezone=r}toString(){return`Timestamp<${q[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};q3=Symbol.toStringTag;dr[q3]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Timestamp"))(dr.prototype);Is=class extends dr{constructor(t){super(q.SECOND,t)}},qi=class extends dr{constructor(t){super(q.MILLISECOND,t)}},As=class extends dr{constructor(t){super(q.MICROSECOND,t)}},Ps=class extends dr{constructor(t){super(q.NANOSECOND,t)}},Tr=class extends z{constructor(t){super(x.Interval),this.unit=t}toString(){return`Interval<${Lt[this.unit]}>`}};j3=Symbol.toStringTag;Tr[j3]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(Tr.prototype);Rs=class extends Tr{constructor(){super(Lt.DAY_TIME)}},Cs=class extends Tr{constructor(){super(Lt.YEAR_MONTH)}},Tu=class extends Tr{constructor(){super(Lt.MONTH_DAY_NANO)}},Wr=class extends z{constructor(t){super(x.Duration),this.unit=t}toString(){return`Duration<${q[this.unit]}>`}};W3=Symbol.toStringTag;Wr[W3]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(Wr.prototype);Iu=class extends Wr{constructor(){super(q.SECOND)}},Au=class extends Wr{constructor(){super(q.MILLISECOND)}},Pu=class extends Wr{constructor(){super(q.MICROSECOND)}},Ru=class extends Wr{constructor(){super(q.NANOSECOND)}},je=class extends z{constructor(t){super(x.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};H3=Symbol.toStringTag;je[H3]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(je.prototype);Bn=class extends z{constructor(t){super(x.LargeList),this.children=[t]}toString(){return`LargeList<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};$3=Symbol.toStringTag;Bn[$3]=(e=>(e.children=null,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeList"))(Bn.prototype);Yt=class extends z{constructor(t){super(x.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};Y3=Symbol.toStringTag;Yt[Y3]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(Yt.prototype);Hr=class extends z{constructor(t,r,n){super(x.Union),this.mode=t,this.children=n,this.typeIds=r=Int32Array.from(r),this.typeIdToChildIndex=r.reduce((i,o,s)=>(i[o]=s)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};K3=Symbol.toStringTag;Hr[K3]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Hr.prototype);wo=class extends Hr{constructor(t,r){super(jt.Dense,t,r)}},Ns=class extends Hr{constructor(t,r){super(jt.Sparse,t,r)}},un=class extends z{constructor(t){super(x.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};X3=Symbol.toStringTag;un[X3]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(un.prototype);_e=class extends z{constructor(t,r){super(x.FixedSizeList),this.listSize=t,this.children=[r]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};Z3=Symbol.toStringTag;_e[Z3]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(_e.prototype);Ir=class extends z{constructor(t,r=!1){var n,i,o;if(super(x.Map),this.children=[t],this.keysSorted=r,t&&(t.name="entries",!((n=t?.type)===null||n===void 0)&&n.children)){let s=(i=t?.type)===null||i===void 0?void 0:i.children[0];s&&(s.name="key");let a=(o=t?.type)===null||o===void 0?void 0:o.children[1];a&&(a.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};J3=Symbol.toStringTag;Ir[J3]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(Ir.prototype);U6=(e=>()=>++e)(-1),We=class extends z{constructor(t,r,n,i){super(x.Dictionary),this.indices=r,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?U6():It(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};Q3=Symbol.toStringTag;We[Q3]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(We.prototype)});function G6(e,t,r=!0){return typeof t=="number"?Al(e,t,r):typeof t=="string"&&t in x?Al(e,x[t],r):t&&t instanceof z?Al(e,r4(t),r):t?.type&&t.type instanceof z?Al(e,r4(t.type),r):Al(e,x.NONE,r)}function Al(e,t,r=!0){let n=null;switch(t){case x.Null:n=e.visitNull;break;case x.Bool:n=e.visitBool;break;case x.Int:n=e.visitInt;break;case x.Int8:n=e.visitInt8||e.visitInt;break;case x.Int16:n=e.visitInt16||e.visitInt;break;case x.Int32:n=e.visitInt32||e.visitInt;break;case x.Int64:n=e.visitInt64||e.visitInt;break;case x.Uint8:n=e.visitUint8||e.visitInt;break;case x.Uint16:n=e.visitUint16||e.visitInt;break;case x.Uint32:n=e.visitUint32||e.visitInt;break;case x.Uint64:n=e.visitUint64||e.visitInt;break;case x.Float:n=e.visitFloat;break;case x.Float16:n=e.visitFloat16||e.visitFloat;break;case x.Float32:n=e.visitFloat32||e.visitFloat;break;case x.Float64:n=e.visitFloat64||e.visitFloat;break;case x.Utf8:n=e.visitUtf8;break;case x.LargeUtf8:n=e.visitLargeUtf8;break;case x.Utf8View:n=e.visitUtf8View||e.visitUtf8;break;case x.Binary:n=e.visitBinary;break;case x.LargeBinary:n=e.visitLargeBinary;break;case x.BinaryView:n=e.visitBinaryView||e.visitBinary;break;case x.FixedSizeBinary:n=e.visitFixedSizeBinary;break;case x.Date:n=e.visitDate;break;case x.DateDay:n=e.visitDateDay||e.visitDate;break;case x.DateMillisecond:n=e.visitDateMillisecond||e.visitDate;break;case x.Timestamp:n=e.visitTimestamp;break;case x.TimestampSecond:n=e.visitTimestampSecond||e.visitTimestamp;break;case x.TimestampMillisecond:n=e.visitTimestampMillisecond||e.visitTimestamp;break;case x.TimestampMicrosecond:n=e.visitTimestampMicrosecond||e.visitTimestamp;break;case x.TimestampNanosecond:n=e.visitTimestampNanosecond||e.visitTimestamp;break;case x.Time:n=e.visitTime;break;case x.TimeSecond:n=e.visitTimeSecond||e.visitTime;break;case x.TimeMillisecond:n=e.visitTimeMillisecond||e.visitTime;break;case x.TimeMicrosecond:n=e.visitTimeMicrosecond||e.visitTime;break;case x.TimeNanosecond:n=e.visitTimeNanosecond||e.visitTime;break;case x.Decimal:n=e.visitDecimal;break;case x.List:n=e.visitList;break;case x.LargeList:n=e.visitLargeList;break;case x.Struct:n=e.visitStruct;break;case x.Union:n=e.visitUnion;break;case x.DenseUnion:n=e.visitDenseUnion||e.visitUnion;break;case x.SparseUnion:n=e.visitSparseUnion||e.visitUnion;break;case x.Dictionary:n=e.visitDictionary;break;case x.Interval:n=e.visitInterval;break;case x.IntervalDayTime:n=e.visitIntervalDayTime||e.visitInterval;break;case x.IntervalYearMonth:n=e.visitIntervalYearMonth||e.visitInterval;break;case x.IntervalMonthDayNano:n=e.visitIntervalMonthDayNano||e.visitInterval;break;case x.Duration:n=e.visitDuration;break;case x.DurationSecond:n=e.visitDurationSecond||e.visitDuration;break;case x.DurationMillisecond:n=e.visitDurationMillisecond||e.visitDuration;break;case x.DurationMicrosecond:n=e.visitDurationMicrosecond||e.visitDuration;break;case x.DurationNanosecond:n=e.visitDurationNanosecond||e.visitDuration;break;case x.FixedSizeList:n=e.visitFixedSizeList;break;case x.Map:n=e.visitMap;break}if(typeof n=="function")return n;if(!r)return()=>null;throw new Error(`Unrecognized type '${x[t]}'`)}function r4(e){switch(e.typeId){case x.Null:return x.Null;case x.Int:{let{bitWidth:t,isSigned:r}=e;switch(t){case 8:return r?x.Int8:x.Uint8;case 16:return r?x.Int16:x.Uint16;case 32:return r?x.Int32:x.Uint32;case 64:return r?x.Int64:x.Uint64}return x.Int}case x.Float:switch(e.precision){case Vt.HALF:return x.Float16;case Vt.SINGLE:return x.Float32;case Vt.DOUBLE:return x.Float64}return x.Float;case x.Binary:return x.Binary;case x.LargeBinary:return x.LargeBinary;case x.BinaryView:return x.BinaryView;case x.Utf8:return x.Utf8;case x.LargeUtf8:return x.LargeUtf8;case x.Utf8View:return x.Utf8View;case x.Bool:return x.Bool;case x.Decimal:return x.Decimal;case x.Time:switch(e.unit){case q.SECOND:return x.TimeSecond;case q.MILLISECOND:return x.TimeMillisecond;case q.MICROSECOND:return x.TimeMicrosecond;case q.NANOSECOND:return x.TimeNanosecond}return x.Time;case x.Timestamp:switch(e.unit){case q.SECOND:return x.TimestampSecond;case q.MILLISECOND:return x.TimestampMillisecond;case q.MICROSECOND:return x.TimestampMicrosecond;case q.NANOSECOND:return x.TimestampNanosecond}return x.Timestamp;case x.Date:switch(e.unit){case Qt.DAY:return x.DateDay;case Qt.MILLISECOND:return x.DateMillisecond}return x.Date;case x.Interval:switch(e.unit){case Lt.DAY_TIME:return x.IntervalDayTime;case Lt.YEAR_MONTH:return x.IntervalYearMonth;case Lt.MONTH_DAY_NANO:return x.IntervalMonthDayNano}return x.Interval;case x.Duration:switch(e.unit){case q.SECOND:return x.DurationSecond;case q.MILLISECOND:return x.DurationMillisecond;case q.MICROSECOND:return x.DurationMicrosecond;case q.NANOSECOND:return x.DurationNanosecond}return x.Duration;case x.Map:return x.Map;case x.List:return x.List;case x.LargeList:return x.LargeList;case x.Struct:return x.Struct;case x.Union:switch(e.mode){case jt.Dense:return x.DenseUnion;case jt.Sparse:return x.SparseUnion}return x.Union;case x.FixedSizeBinary:return x.FixedSizeBinary;case x.FixedSizeList:return x.FixedSizeList;case x.Dictionary:return x.Dictionary}throw new Error(`Unrecognized type '${x[e.typeId]}'`)}var rt,fn=w(()=>{Ne();te();rt=class{visitMany(t,...r){return t.map((n,i)=>this.visit(n,...r.map(o=>o[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,r=!0){return G6(this,t,r)}getVisitFnByTypeId(t,r=!0){return Al(this,t,r)}visitNull(t,...r){return null}visitBool(t,...r){return null}visitInt(t,...r){return null}visitFloat(t,...r){return null}visitUtf8(t,...r){return null}visitLargeUtf8(t,...r){return null}visitUtf8View(t,...r){return null}visitBinary(t,...r){return null}visitLargeBinary(t,...r){return null}visitBinaryView(t,...r){return null}visitFixedSizeBinary(t,...r){return null}visitDate(t,...r){return null}visitTimestamp(t,...r){return null}visitTime(t,...r){return null}visitDecimal(t,...r){return null}visitList(t,...r){return null}visitLargeList(t,...r){return null}visitStruct(t,...r){return null}visitUnion(t,...r){return null}visitDictionary(t,...r){return null}visitInterval(t,...r){return null}visitDuration(t,...r){return null}visitFixedSizeList(t,...r){return null}visitMap(t,...r){return null}};rt.prototype.visitInt8=null;rt.prototype.visitInt16=null;rt.prototype.visitInt32=null;rt.prototype.visitInt64=null;rt.prototype.visitUint8=null;rt.prototype.visitUint16=null;rt.prototype.visitUint32=null;rt.prototype.visitUint64=null;rt.prototype.visitFloat16=null;rt.prototype.visitFloat32=null;rt.prototype.visitFloat64=null;rt.prototype.visitDateDay=null;rt.prototype.visitDateMillisecond=null;rt.prototype.visitTimestampSecond=null;rt.prototype.visitTimestampMillisecond=null;rt.prototype.visitTimestampMicrosecond=null;rt.prototype.visitTimestampNanosecond=null;rt.prototype.visitTimeSecond=null;rt.prototype.visitTimeMillisecond=null;rt.prototype.visitTimeMicrosecond=null;rt.prototype.visitTimeNanosecond=null;rt.prototype.visitDenseUnion=null;rt.prototype.visitSparseUnion=null;rt.prototype.visitIntervalDayTime=null;rt.prototype.visitIntervalYearMonth=null;rt.prototype.visitIntervalMonthDayNano=null;rt.prototype.visitDuration=null;rt.prototype.visitDurationSecond=null;rt.prototype.visitDurationMillisecond=null;rt.prototype.visitDurationMicrosecond=null;rt.prototype.visitDurationNanosecond=null});var Zw={};Zr(Zw,{float64ToUint16:()=>Cu,uint16ToFloat64:()=>Jm});function Jm(e){let t=(e&31744)>>10,r=(e&1023)/1024,n=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return n*(r?Number.NaN:1/0);case 0:return n*(r?6103515625e-14*r:0)}return n*Math.pow(2,t-15)*(1+r)}function Cu(e){if(e!==e)return 32256;n4[0]=e;let t=(Pl[1]&2147483648)>>16&65535,r=Pl[1]&2146435072,n=0;return r>=1089470464?Pl[0]>0?r=31744:(r=(r&2080374784)>>16,n=(Pl[1]&1048575)>>10):r<=1056964608?(n=1048576+(Pl[1]&1048575),n=1048576+(n<<(r>>20)-998)>>21,r=0):(r=r-1056964608>>10,n=(Pl[1]&1048575)+512>>10),t|r|n&65535}var n4,Pl,Nu=w(()=>{n4=new Float64Array(1),Pl=new Uint32Array(n4.buffer)});function mt(e){return(t,r,n)=>{if(t.setValid(r,n!=null))return e(t,r,n)}}var ct,z6,i4,V6,_o,Jw,o4,k6,Qm,tp,Qw,s4,q6,a4,j6,c4,W6,t_,ep,rp,np,ip,e_,op,sp,ap,cp,r_,n_,l4,H6,$6,Y6,K6,X6,Z6,J6,h4,u4,Q6,i_,lp,hp,up,fp,dp,mp,pp,o_,tL,mr,Dn=w(()=>{Ar();fn();ki();fo();Nu();Ne();te();ct=class extends rt{};z6=(e,t,r)=>{e[t]=Math.floor(r/864e5)},i4=(e,t,r,n)=>{if(r+1<t.length){let i=It(t[r]),o=It(t[r+1]);e.set(n.subarray(0,o-i),i)}},V6=({offset:e,values:t},r,n)=>{let i=e+r;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},_o=({values:e},t,r)=>{e[t]=r},Jw=({values:e},t,r)=>{e[t]=r},o4=({values:e},t,r)=>{e[t]=Cu(r)},k6=(e,t,r)=>{switch(e.type.precision){case Vt.HALF:return o4(e,t,r);case Vt.SINGLE:case Vt.DOUBLE:return Jw(e,t,r)}},Qm=({values:e},t,r)=>{z6(e,t,r.valueOf())},tp=({values:e},t,r)=>{e[t]=BigInt(r)},Qw=({stride:e,values:t},r,n)=>{t.set(n.subarray(0,e),e*r)},s4=({values:e,valueOffsets:t},r,n)=>i4(e,t,r,n),q6=e=>{let t=e.variadicBuffers;return(!Array.isArray(t)||Object.isFrozen(t))&&(t=Array.from(t),e.variadicBuffers=t),t},a4=(e,t,r)=>{var n,i,o,s;let a=e.values;if(!a)throw new Error("BinaryView data is missing view buffer");let c=Mt.ELEMENT_WIDTH,l=t*c,h=l+c;if(l<0||h>a.length)throw new RangeError(`BinaryView index ${t} out of bounds`);a.fill(0,l,h);let u=new DataView(a.buffer,a.byteOffset+l,c),f=r.length;if(u.setInt32(Mt.LENGTH_OFFSET,f,!0),f<=Mt.INLINE_CAPACITY){a.set(r,l+Mt.INLINE_OFFSET);return}let d=((n=r[0])!==null&&n!==void 0?n:0)|((i=r[1])!==null&&i!==void 0?i:0)<<8|((o=r[2])!==null&&o!==void 0?o:0)<<16|((s=r[3])!==null&&s!==void 0?s:0)<<24;u.setUint32(Mt.INLINE_OFFSET,d>>>0,!0);let m=q6(e),p=r.slice(),g=m.push(p)-1;u.setInt32(Mt.BUFFER_INDEX_OFFSET,g,!0),u.setInt32(Mt.BUFFER_OFFSET_OFFSET,0,!0)},j6=(e,t,r)=>{let n=r instanceof Uint8Array?r:new Uint8Array(r);a4(e,t,n)},c4=({values:e,valueOffsets:t},r,n)=>i4(e,t,r,En(n)),W6=(e,t,r)=>{let n=En(r);a4(e,t,n)},t_=(e,t,r)=>{e.type.unit===Qt.DAY?Qm(e,t,r):tp(e,t,r)},ep=({values:e},t,r)=>{e[t]=BigInt(r/1e3)},rp=({values:e},t,r)=>{e[t]=BigInt(r)},np=({values:e},t,r)=>{e[t]=BigInt(r*1e3)},ip=({values:e},t,r)=>{e[t]=BigInt(r*1e6)},e_=(e,t,r)=>{switch(e.type.unit){case q.SECOND:return ep(e,t,r);case q.MILLISECOND:return rp(e,t,r);case q.MICROSECOND:return np(e,t,r);case q.NANOSECOND:return ip(e,t,r)}},op=({values:e},t,r)=>{e[t]=r},sp=({values:e},t,r)=>{e[t]=r},ap=({values:e},t,r)=>{e[t]=r},cp=({values:e},t,r)=>{e[t]=r},r_=(e,t,r)=>{switch(e.type.unit){case q.SECOND:return op(e,t,r);case q.MILLISECOND:return sp(e,t,r);case q.MICROSECOND:return ap(e,t,r);case q.NANOSECOND:return cp(e,t,r)}},n_=({values:e,stride:t},r,n)=>{e.set(n.subarray(0,t),t*r)},l4=(e,t,r)=>{let n=e.children[0],i=e.valueOffsets,o=mr.getVisitFn(n),s=It(i[t]),a=It(i[t+1]);if(Array.isArray(r))for(let c=-1,l=s;l<a;)o(n,l++,r[++c]);else for(let c=-1,l=s;l<a;)o(n,l++,r.get(++c))},H6=(e,t,r)=>{let n=e.children[0],{valueOffsets:i}=e,o=mr.getVisitFn(n),{[t]:s,[t+1]:a}=i,c=r instanceof Map?r.entries():Object.entries(r);for(let l of c)if(o(n,s,l),++s>=a)break},$6=(e,t)=>(r,n,i,o)=>n&&r(n,e,t[o]),Y6=(e,t)=>(r,n,i,o)=>n&&r(n,e,t.get(o)),K6=(e,t)=>(r,n,i,o)=>n&&r(n,e,t.get(i.name)),X6=(e,t)=>(r,n,i,o)=>n&&r(n,e,t[i.name]),Z6=(e,t,r)=>{let n=e.type.children.map(o=>mr.getVisitFn(o.type)),i=r instanceof Map?K6(t,r):r instanceof $?Y6(t,r):Array.isArray(r)?$6(t,r):X6(t,r);e.type.children.forEach((o,s)=>i(n[s],e.children[s],o,s))},J6=(e,t,r)=>{e.type.mode===jt.Dense?h4(e,t,r):u4(e,t,r)},h4=(e,t,r)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[n];mr.visit(i,e.valueOffsets[t],r)},u4=(e,t,r)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[n];mr.visit(i,t,r)},Q6=(e,t,r)=>{var n;(n=e.dictionary)===null||n===void 0||n.set(e.values[t],r)},i_=(e,t,r)=>{switch(e.type.unit){case Lt.YEAR_MONTH:return hp(e,t,r);case Lt.DAY_TIME:return lp(e,t,r);case Lt.MONTH_DAY_NANO:return up(e,t,r)}},lp=({values:e},t,r)=>{e.set(r.subarray(0,2),2*t)},hp=({values:e},t,r)=>{e[t]=r[0]*12+r[1]%12},up=({values:e,stride:t},r,n)=>{e.set(n.subarray(0,t),t*r)},fp=({values:e},t,r)=>{e[t]=r},dp=({values:e},t,r)=>{e[t]=r},mp=({values:e},t,r)=>{e[t]=r},pp=({values:e},t,r)=>{e[t]=r},o_=(e,t,r)=>{switch(e.type.unit){case q.SECOND:return fp(e,t,r);case q.MILLISECOND:return dp(e,t,r);case q.MICROSECOND:return mp(e,t,r);case q.NANOSECOND:return pp(e,t,r)}},tL=(e,t,r)=>{let{stride:n}=e,i=e.children[0],o=mr.getVisitFn(i);if(Array.isArray(r))for(let s=-1,a=t*n;++s<n;)o(i,a+s,r[s]);else for(let s=-1,a=t*n;++s<n;)o(i,a+s,r.get(s))};ct.prototype.visitBool=mt(V6);ct.prototype.visitInt=mt(_o);ct.prototype.visitInt8=mt(_o);ct.prototype.visitInt16=mt(_o);ct.prototype.visitInt32=mt(_o);ct.prototype.visitInt64=mt(_o);ct.prototype.visitUint8=mt(_o);ct.prototype.visitUint16=mt(_o);ct.prototype.visitUint32=mt(_o);ct.prototype.visitUint64=mt(_o);ct.prototype.visitFloat=mt(k6);ct.prototype.visitFloat16=mt(o4);ct.prototype.visitFloat32=mt(Jw);ct.prototype.visitFloat64=mt(Jw);ct.prototype.visitUtf8=mt(c4);ct.prototype.visitLargeUtf8=mt(c4);ct.prototype.visitUtf8View=mt(W6);ct.prototype.visitBinary=mt(s4);ct.prototype.visitLargeBinary=mt(s4);ct.prototype.visitBinaryView=mt(j6);ct.prototype.visitFixedSizeBinary=mt(Qw);ct.prototype.visitDate=mt(t_);ct.prototype.visitDateDay=mt(Qm);ct.prototype.visitDateMillisecond=mt(tp);ct.prototype.visitTimestamp=mt(e_);ct.prototype.visitTimestampSecond=mt(ep);ct.prototype.visitTimestampMillisecond=mt(rp);ct.prototype.visitTimestampMicrosecond=mt(np);ct.prototype.visitTimestampNanosecond=mt(ip);ct.prototype.visitTime=mt(r_);ct.prototype.visitTimeSecond=mt(op);ct.prototype.visitTimeMillisecond=mt(sp);ct.prototype.visitTimeMicrosecond=mt(ap);ct.prototype.visitTimeNanosecond=mt(cp);ct.prototype.visitDecimal=mt(n_);ct.prototype.visitList=mt(l4);ct.prototype.visitLargeList=mt(l4);ct.prototype.visitStruct=mt(Z6);ct.prototype.visitUnion=mt(J6);ct.prototype.visitDenseUnion=mt(h4);ct.prototype.visitSparseUnion=mt(u4);ct.prototype.visitDictionary=mt(Q6);ct.prototype.visitInterval=mt(i_);ct.prototype.visitIntervalDayTime=mt(lp);ct.prototype.visitIntervalYearMonth=mt(hp);ct.prototype.visitIntervalMonthDayNano=mt(up);ct.prototype.visitDuration=mt(o_);ct.prototype.visitDurationSecond=mt(fp);ct.prototype.visitDurationMillisecond=mt(dp);ct.prototype.visitDurationMicrosecond=mt(mp);ct.prototype.visitDurationNanosecond=mt(pp);ct.prototype.visitFixedSizeList=mt(tL);ct.prototype.visitMap=mt(H6);mr=new ct});var xi,Rl,ji,s_,a_,eL,gp=w(()=>{vu();Ua();Dn();xi=Symbol.for("parent"),Rl=Symbol.for("rowIndex"),ji=class{constructor(t,r){return this[xi]=t,this[Rl]=r,new Proxy(this,eL)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Rl],r=this[xi],n=r.type.children,i={};for(let o=-1,s=n.length;++o<s;)i[n[o].name]=He.visit(r.children[o],t);return i}toString(){return`{${[...this].map(([t,r])=>`${gi(t)}: ${gi(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new s_(this[xi],this[Rl])}},s_=class{constructor(t,r){this.childIndex=0,this.children=t.children,this.rowIndex=r,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,He.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(ji.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[xi]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Rl]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});a_=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[xi].type.children.map(r=>r.name)}has(t,r){return t[xi].type.children.some(n=>n.name===r)}getOwnPropertyDescriptor(t,r){if(t[xi].type.children.some(n=>n.name===r))return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let n=t[xi].type.children.findIndex(i=>i.name===r);if(n!==-1){let i=He.visit(t[xi].children[n],t[Rl]);return Reflect.set(t,r,i),i}}set(t,r,n){let i=t[xi].type.children.findIndex(o=>o.name===r);return i!==-1?(mr.visit(t[xi].children[i],t[Rl],n),Reflect.set(t,r,n)):Reflect.has(t,r)||typeof r=="symbol"?Reflect.set(t,r,n):!1}},eL=new a_});function ht(e){return(t,r)=>t.getValid(r)?e(t,r):null}var it,rL,Cl,nL,iL,f4,oL,d4,m4,Os,sL,p4,aL,g4,y4,cL,w4,lL,hL,uL,fL,_4,M4,b4,x4,dL,S4,v4,E4,T4,mL,pL,I4,gL,yL,wL,A4,P4,_L,ML,R4,C4,N4,O4,B4,L4,D4,bL,xL,He,Ua=w(()=>{Zm();Ar();fn();Ou();gp();ki();fo();Nu();Ne();it=class extends rt{};rL=(e,t)=>864e5*e[t],Cl=16,nL=12,iL=(e,t)=>null,f4=(e,t,r)=>{if(r+1>=t.length)return null;let n=It(t[r]),i=It(t[r+1]);return e.subarray(n,i)},oL=({offset:e,values:t},r)=>{let n=e+r;return(t[n>>3]&1<<n%8)!==0},d4=({values:e},t)=>rL(e,t),m4=({values:e},t)=>It(e[t]),Os=({stride:e,values:t},r)=>t[e*r],sL=({stride:e,values:t},r)=>Jm(t[e*r]),p4=({values:e},t)=>e[t],aL=({stride:e,values:t},r)=>t.subarray(e*r,e*(r+1)),g4=({values:e,valueOffsets:t},r)=>f4(e,t,r),y4=(e,t)=>{var r;let n=e.values;if(!n)throw new Error("BinaryView data is missing view buffer");let i=t*Cl,o=i+Cl;if(i<0||o>n.length)throw new Error(`BinaryView data buffer is too short: expected ${Cl} bytes, got ${Math.max(0,n.length-i)}`);let s=n.subarray(i,o);if(s.length<Cl)throw new Error(`BinaryView data buffer is too short: expected ${Cl} bytes, got ${s.length}`);let a=new DataView(n.buffer,s.byteOffset,Cl),c=a.getInt32(0,!0);if(c<=0)return new Uint8Array(0);if(c<=nL)return s.subarray(4,4+c);let l=a.getInt32(8,!0),h=a.getInt32(12,!0),u=(r=e.variadicBuffers)===null||r===void 0?void 0:r[l];if(!u)throw new Error(`BinaryView variadic buffer ${l} is missing`);return u.subarray(h,h+c)},cL=(e,t)=>y4(e,t),w4=({values:e,valueOffsets:t},r)=>{let n=f4(e,t,r);return n!==null?_l(n):null},lL=(e,t)=>{let r=y4(e,t);return _l(r)},hL=({values:e},t)=>e[t],uL=({type:e,values:t},r)=>e.precision!==Vt.HALF?t[r]:Jm(t[r]),fL=(e,t)=>e.type.unit===Qt.DAY?d4(e,t):m4(e,t),_4=({values:e},t)=>1e3*It(e[t]),M4=({values:e},t)=>It(e[t]),b4=({values:e},t)=>$w(e[t],BigInt(1e3)),x4=({values:e},t)=>$w(e[t],BigInt(1e6)),dL=(e,t)=>{switch(e.type.unit){case q.SECOND:return _4(e,t);case q.MILLISECOND:return M4(e,t);case q.MICROSECOND:return b4(e,t);case q.NANOSECOND:return x4(e,t)}},S4=({values:e},t)=>e[t],v4=({values:e},t)=>e[t],E4=({values:e},t)=>e[t],T4=({values:e},t)=>e[t],mL=(e,t)=>{switch(e.type.unit){case q.SECOND:return S4(e,t);case q.MILLISECOND:return v4(e,t);case q.MICROSECOND:return E4(e,t);case q.NANOSECOND:return T4(e,t)}},pL=({values:e,stride:t},r)=>Fa.decimal(e.subarray(t*r,t*(r+1))),I4=(e,t)=>{let{valueOffsets:r,stride:n,children:i}=e,o=It(r[t*n]),s=It(r[t*n+1]),c=i[0].slice(o,s-o);return new $([c])},gL=(e,t)=>{let{valueOffsets:r,children:n}=e,{[t]:i,[t+1]:o}=r,s=n[0];return new Xn(s.slice(i,o-i))},yL=(e,t)=>new ji(e,t),wL=(e,t)=>e.type.mode===jt.Dense?A4(e,t):P4(e,t),A4=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[r];return He.visit(n,e.valueOffsets[t])},P4=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[r];return He.visit(n,t)},_L=(e,t)=>{var r;return(r=e.dictionary)===null||r===void 0?void 0:r.get(e.values[t])},ML=(e,t)=>e.type.unit===Lt.MONTH_DAY_NANO?N4(e,t):e.type.unit===Lt.DAY_TIME?R4(e,t):C4(e,t),R4=({values:e},t)=>e.subarray(2*t,2*(t+1)),C4=({values:e},t)=>{let r=e[t],n=new Int32Array(2);return n[0]=Math.trunc(r/12),n[1]=Math.trunc(r%12),n},N4=({values:e},t)=>e.subarray(4*t,4*(t+1)),O4=({values:e},t)=>e[t],B4=({values:e},t)=>e[t],L4=({values:e},t)=>e[t],D4=({values:e},t)=>e[t],bL=(e,t)=>{switch(e.type.unit){case q.SECOND:return O4(e,t);case q.MILLISECOND:return B4(e,t);case q.MICROSECOND:return L4(e,t);case q.NANOSECOND:return D4(e,t)}},xL=(e,t)=>{let{stride:r,children:n}=e,o=n[0].slice(t*r,r);return new $([o])};it.prototype.visitNull=ht(iL);it.prototype.visitBool=ht(oL);it.prototype.visitInt=ht(hL);it.prototype.visitInt8=ht(Os);it.prototype.visitInt16=ht(Os);it.prototype.visitInt32=ht(Os);it.prototype.visitInt64=ht(p4);it.prototype.visitUint8=ht(Os);it.prototype.visitUint16=ht(Os);it.prototype.visitUint32=ht(Os);it.prototype.visitUint64=ht(p4);it.prototype.visitFloat=ht(uL);it.prototype.visitFloat16=ht(sL);it.prototype.visitFloat32=ht(Os);it.prototype.visitFloat64=ht(Os);it.prototype.visitUtf8=ht(w4);it.prototype.visitLargeUtf8=ht(w4);it.prototype.visitUtf8View=ht(lL);it.prototype.visitBinary=ht(g4);it.prototype.visitLargeBinary=ht(g4);it.prototype.visitBinaryView=ht(cL);it.prototype.visitFixedSizeBinary=ht(aL);it.prototype.visitDate=ht(fL);it.prototype.visitDateDay=ht(d4);it.prototype.visitDateMillisecond=ht(m4);it.prototype.visitTimestamp=ht(dL);it.prototype.visitTimestampSecond=ht(_4);it.prototype.visitTimestampMillisecond=ht(M4);it.prototype.visitTimestampMicrosecond=ht(b4);it.prototype.visitTimestampNanosecond=ht(x4);it.prototype.visitTime=ht(mL);it.prototype.visitTimeSecond=ht(S4);it.prototype.visitTimeMillisecond=ht(v4);it.prototype.visitTimeMicrosecond=ht(E4);it.prototype.visitTimeNanosecond=ht(T4);it.prototype.visitDecimal=ht(pL);it.prototype.visitList=ht(I4);it.prototype.visitLargeList=ht(I4);it.prototype.visitStruct=ht(yL);it.prototype.visitUnion=ht(wL);it.prototype.visitDenseUnion=ht(A4);it.prototype.visitSparseUnion=ht(P4);it.prototype.visitDictionary=ht(_L);it.prototype.visitInterval=ht(ML);it.prototype.visitIntervalDayTime=ht(R4);it.prototype.visitIntervalYearMonth=ht(C4);it.prototype.visitIntervalMonthDayNano=ht(N4);it.prototype.visitDuration=ht(bL);it.prototype.visitDurationSecond=ht(O4);it.prototype.visitDurationMillisecond=ht(B4);it.prototype.visitDurationMicrosecond=ht(L4);it.prototype.visitDurationNanosecond=ht(D4);it.prototype.visitFixedSizeList=ht(xL);it.prototype.visitMap=ht(gL);He=new it});var Bs,Ol,Nl,c_,Xn,l_,h_,Ou=w(()=>{Ar();vu();Ua();Dn();Bs=Symbol.for("keys"),Ol=Symbol.for("vals"),Nl=Symbol.for("kKeysAsStrings"),c_=Symbol.for("_kKeysAsStrings"),Xn=class{constructor(t){return this[Bs]=new $([t.children[0]]).memoize(),this[Ol]=t.children[1],new Proxy(this,new h_)}get[Nl](){return this[c_]||(this[c_]=Array.from(this[Bs].toArray(),String))}[Symbol.iterator](){return new l_(this[Bs],this[Ol])}get size(){return this[Bs].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Bs],r=this[Ol],n={};for(let i=-1,o=t.length;++i<o;)n[t.get(i)]=He.visit(r,i);return n}toString(){return`{${[...this].map(([t,r])=>`${gi(t)}: ${gi(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},l_=class{constructor(t,r){this.keys=t,this.vals=r,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),He.visit(this.vals,t)]})}},h_=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Nl]}has(t,r){return t[Nl].includes(r)}getOwnPropertyDescriptor(t,r){if(t[Nl].indexOf(r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let n=t[Nl].indexOf(r);if(n!==-1){let i=He.visit(Reflect.get(t,Ol),n);return Reflect.set(t,r,i),i}}set(t,r,n){let i=t[Nl].indexOf(r);return i!==-1?(mr.visit(Reflect.get(t,Ol),i,n),Reflect.set(t,r,n)):Reflect.has(t,r)?Reflect.set(t,r,n):!1}};Object.defineProperties(Xn.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Bs]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Ol]:{writable:!0,enumerable:!1,configurable:!1,value:null},[c_]:{writable:!0,enumerable:!1,configurable:!1,value:null}})});var u_={};Zr(u_,{clampRange:()=>Bu,createElementComparator:()=>Ls,wrapIndex:()=>Ga});function Bu(e,t,r,n){let{length:i=0}=e,o=typeof t!="number"?0:t,s=typeof r!="number"?i:r;return o<0&&(o=(o%i+i)%i),s<0&&(s=(s%i+i)%i),s<o&&(F4=o,o=s,s=F4),s>i&&(s=i),n?n(e,o,s):[o,s]}function Ls(e){if(typeof e!=="object"||e===null)return U4(e)?U4:r=>r===e;if(e instanceof Date){let r=e.valueOf();return n=>n instanceof Date?n.valueOf()===r:!1}return ArrayBuffer.isView(e)?r=>r?pw(e,r):!1:e instanceof Map?vL(e):Array.isArray(e)?SL(e):e instanceof $?EL(e):TL(e,!0)}function SL(e){let t=[];for(let r=-1,n=e.length;++r<n;)t[r]=Ls(e[r]);return yp(t)}function vL(e){let t=-1,r=[];for(let n of e.values())r[++t]=Ls(n);return yp(r)}function EL(e){let t=[];for(let r=-1,n=e.length;++r<n;)t[r]=Ls(e.get(r));return yp(t)}function TL(e,t=!1){let r=Object.keys(e);if(!t&&r.length===0)return()=>!1;let n=[];for(let i=-1,o=r.length;++i<o;)n[i]=Ls(e[r[i]]);return yp(n,r)}function yp(e,t){return r=>{if(!r||typeof r!="object")return!1;switch(r.constructor){case Array:return IL(e,r);case Map:return G4(e,r,r.keys());case Xn:case ji:case Object:case void 0:return G4(e,r,t||Object.keys(r))}return r instanceof $?AL(e,r):!1}}function IL(e,t){let r=e.length;if(t.length!==r)return!1;for(let n=-1;++n<r;)if(!e[n](t[n]))return!1;return!0}function AL(e,t){let r=e.length;if(t.length!==r)return!1;for(let n=-1;++n<r;)if(!e[n](t.get(n)))return!1;return!0}function G4(e,t,r){let n=r[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),o=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),s=0,a=e.length,c=o.next(),l=n.next(),h=i.next();for(;s<a&&!l.done&&!h.done&&!c.done&&!(l.value!==h.value||!e[s](c.value));++s,l=n.next(),h=i.next(),c=o.next());return s===a&&l.done&&h.done&&c.done?!0:(n.return&&n.return(),i.return&&i.return(),o.return&&o.return(),!1)}var F4,Ga,U4,Bl=w(()=>{Ar();Ou();gp();Je();Ga=(e,t)=>e<0?t+e:e,U4=e=>e!==e});var f_={};Zr(f_,{BitIterator:()=>Wi,getBit:()=>_p,getBool:()=>Ll,packBools:()=>Va,popcnt_array:()=>z4,popcnt_bit_range:()=>Lu,popcnt_uint32:()=>wp,setBool:()=>PL,truncateBitmap:()=>za});function Ll(e,t,r,n){return(r&1<<n)!==0}function _p(e,t,r,n){return(r&1<<n)>>n}function PL(e,t,r){return r?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function za(e,t,r){let n=r.byteLength+7&-8;if(e>0||r.byteLength<n){let i=new Uint8Array(n);return i.set(e%8===0?r.subarray(e>>3):Va(new Wi(r,e,t,null,Ll)).subarray(0,n)),i}return r}function Va(e){let t=[],r=0,n=0,i=0;for(let s of e)s&&(i|=1<<n),++n===8&&(t[r++]=i,i=n=0);(r===0||n>0)&&(t[r++]=i);let o=new Uint8Array(t.length+7&-8);return o.set(t),o}function Lu(e,t,r){if(r-t<=0)return 0;if(r-t<8){let o=0;for(let s of new Wi(e,t,r-t,e,_p))o+=s;return o}let n=r>>3<<3,i=t+(t%8===0?0:8-t%8);return Lu(e,t,i)+Lu(e,n,r)+z4(e,i>>3,n-i>>3)}function z4(e,t,r){let n=0,i=Math.trunc(t),o=new DataView(e.buffer,e.byteOffset,e.byteLength),s=r===void 0?e.byteLength:i+r;for(;s-i>=4;)n+=wp(o.getUint32(i)),i+=4;for(;s-i>=2;)n+=wp(o.getUint16(i)),i+=2;for(;s-i>=1;)n+=wp(o.getUint8(i)),i+=1;return n}function wp(e){let t=Math.trunc(e);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var Wi,ka=w(()=>{Wi=class{constructor(t,r,n,i,o){this.bytes=t,this.length=n,this.context=i,this.get=o,this.bit=r%8,this.byteIndex=r>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}}});function Q(e){return CL.visit(e)}var RL,V4,ut,d_,CL,Zn=w(()=>{Ar();Ne();te();ka();te();fn();Je();RL=-1,V4=Symbol.for("apache-arrow/Data"),ut=class e{static isData(t){return t?.[V4]===!0}get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:t}=this;return z.isSparseUnion(t)?this.children.some(r=>r.nullable):z.isDenseUnion(t)?this.children.some(r=>r.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:r,values:n,nullBitmap:i,typeIds:o}=this;return r&&(t+=r.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),t+=this.variadicBuffers.reduce((s,a)=>{var c;return s+((c=a?.byteLength)!==null&&c!==void 0?c:0)},0),this.children.reduce((s,a)=>s+a.byteLength,t)}get nullCount(){if(z.isUnion(this.type))return this.children.reduce((n,i)=>n+i.nullCount,0);let t=this._nullCount,r;return t<=RL&&(r=this.nullBitmap)&&(this._nullCount=t=r.length===0?0:this.length-Lu(r,this.offset,this.offset+this.length)),t}constructor(t,r,n,i,o,s=[],a,c=[]){var l;this.type=t,this.children=s,this.dictionary=a,this.offset=Math.floor(Math.max(r||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let h;o instanceof e?(this.stride=o.stride,this.values=o.values,this.typeIds=o.typeIds,this.nullBitmap=o.nullBitmap,this.valueOffsets=o.valueOffsets,this.variadicBuffers=o.variadicBuffers):(this.stride=Ln(t),o&&((h=o[0])&&(this.valueOffsets=h),(h=o[1])&&(this.values=h),(h=o[2])&&(this.nullBitmap=h),(h=o[3])&&(this.typeIds=h)),this.variadicBuffers=c),(l=this.variadicBuffers)!==null&&l!==void 0||(this.variadicBuffers=[])}getValid(t){let{type:r}=this;if(z.isUnion(r)){let n=r,i=this.typeIds[t],o=n.typeIdToChildIndex[i],s=this.children[o],a=this.valueOffsets,c=n.mode===jt.Dense&&a?Number(a[t]):t;return s.getValid(c)}if(this.nullable&&this.nullCount>0){let n=this.offset+t;return(this.nullBitmap[n>>3]&1<<n%8)!==0}return!0}setValid(t,r){let n,{type:i}=this;if(z.isUnion(i)){let o=i,s=this.typeIds[t],a=o.typeIdToChildIndex[s],c=this.children[a],l=this.valueOffsets,h=o.mode===jt.Dense&&l?Number(l[t]):t;n=c.getValid(h),c.setValid(h,r)}else{let{nullBitmap:o}=this,{offset:s,length:a}=this,c=s+t,l=1<<c%8,h=c>>3;(!o||o.byteLength<=h)&&(o=new Uint8Array((s+a+63&-64)>>3).fill(255),this.nullCount>0?(o.set(za(s,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:o})):Object.assign(this,{nullBitmap:o,_nullCount:0}));let u=o[h];n=(u&l)!==0,o[h]=r?u|l:u&~l}return n!==!!r&&(this._nullCount=this.nullCount+(r?-1:1)),r}clone(t=this.type,r=this.offset,n=this.length,i=this._nullCount,o=this,s=this.children,a=this.variadicBuffers){return new e(t,r,n,i,o,s,this.dictionary,a)}slice(t,r){let{stride:n,typeId:i,children:o}=this,s=+(this._nullCount===0)-1,a=i===16?n:1,c=this._sliceBuffers(t,r,n,i);return this.clone(this.type,this.offset+t,r,s,c,o.length===0||this.valueOffsets?o:this._sliceChildren(o,a*t,a*r),this.variadicBuffers)}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===x.Null)return this.clone(this.type,0,t,0,this.buffers,this.children,this.variadicBuffers);let{length:r,nullCount:n}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,r>>3);i[r>>3]=(1<<r-(r&-8))-1,n>0&&i.set(za(this.offset,r,this.nullBitmap),0);let o=this.buffers;return o[xe.VALIDITY]=i,this.clone(this.type,0,t,n+(t-r),o,this.children,this.variadicBuffers)}_sliceBuffers(t,r,n,i){let o,{buffers:s}=this;if((o=s[xe.TYPE])&&(s[xe.TYPE]=o.subarray(t,t+r)),z.isBinaryView(this.type)||z.isUtf8View(this.type)){let a=Mt.ELEMENT_WIDTH;(o=s[xe.DATA])&&(s[xe.DATA]=o.subarray(t*a,(t+r)*a))}else(o=s[xe.OFFSET])&&(s[xe.OFFSET]=o.subarray(t,t+r+1))||(o=s[xe.DATA])&&(s[xe.DATA]=i===6?o:o.subarray(n*t,n*(t+r)));return s}_sliceChildren(t,r,n){return t.map(i=>i.slice(r,n))}};ut.prototype.children=Object.freeze([]);ut.prototype[V4]=!0;Object.defineProperty(ut,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===ut&&ut.isData(t)}});d_=class e extends rt{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:r,["offset"]:n=0,["length"]:i=0}=t;return new ut(r,n,i,i)}visitBool(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitInt(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitUtf8(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.data),o=nt(t.nullBitmap),s=Ba(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[s,i,o])}visitUtf8View(t){var r;let{["type"]:n,["offset"]:i=0}=t,o=Tt(n.ArrayType,t.views),s=nt(t.nullBitmap),a=(t.variadicBuffers||[]).map(h=>nt(h)),c=(r=t.length)!==null&&r!==void 0?r:Math.trunc(o.length/qr.ELEMENT_WIDTH),l=t.nullBitmap?-1:0;return new ut(n,i,c,l,[void 0,o,s],[],void 0,a)}visitLargeUtf8(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.data),o=nt(t.nullBitmap),s=cu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[s,i,o])}visitBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.data),o=nt(t.nullBitmap),s=Ba(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[s,i,o])}visitBinaryView(t){var r;let{["type"]:n,["offset"]:i=0}=t,o=Tt(n.ArrayType,t.views),s=nt(t.nullBitmap),a=(t.variadicBuffers||[]).map(h=>nt(h)),c=(r=t.length)!==null&&r!==void 0?r:Math.trunc(o.length/Mt.ELEMENT_WIDTH),l=t.nullBitmap?-1:0;return new ut(n,i,c,l,[void 0,o,s],[],void 0,a)}visitLargeBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.data),o=nt(t.nullBitmap),s=cu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length/Ln(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitDate(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length/Ln(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length/Ln(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitTime(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length/Ln(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length/Ln(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitList(t){let{["type"]:r,["offset"]:n=0,["child"]:i}=t,o=nt(t.nullBitmap),s=Ba(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[s,void 0,o],[i])}visitLargeList(t){let{["type"]:r,["offset"]:n=0,["child"]:i}=t,o=nt(t.nullBitmap),s=cu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[s,void 0,o],[i])}visitStruct(t){let{["type"]:r,["offset"]:n=0,["children"]:i=[]}=t,o=nt(t.nullBitmap),{length:s=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:r,["offset"]:n=0,["children"]:i=[]}=t,o=Tt(r.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(z.isSparseUnion(r))return new ut(r,n,s,a,[void 0,void 0,void 0,o],i);let c=Ba(t.valueOffsets);return new ut(r,n,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.indices.ArrayType,t.data),{["dictionary"]:s=new $([new e().visit({type:r.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length/Ln(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitDuration(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitFixedSizeList(t){let{["type"]:r,["offset"]:n=0,["child"]:i=new e().visit({type:r.valueType})}=t,o=nt(t.nullBitmap),{["length"]:s=i.length/Ln(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,void 0,o],[i])}visitMap(t){let{["type"]:r,["offset"]:n=0,["child"]:i=new e().visit({type:r.childType})}=t,o=nt(t.nullBitmap),s=Ba(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[s,void 0,o],[i])}},CL=new d_});function k4(e){return e.some(t=>t.nullable)}function Mp(e){return e.reduce((t,r)=>t+r.nullCount,0)}function bp(e){return e.reduce((t,r,n)=>(t[n+1]=t[n]+r.length,t),new Uint32Array(e.length+1))}function xp(e,t,r,n){let i=[];for(let o=-1,s=e.length;++o<s;){let a=e[o],c=t[o],{length:l}=a;if(c>=n)break;if(r>=c+l)continue;if(c>=r&&c+l<=n){i.push(a);continue}let h=Math.max(0,r-c),u=Math.min(n-c,l);i.push(a.slice(h,u-h))}return i.length===0&&i.push(e[0].slice(0,0)),i}function m_(e,t,r,n){let i=0,o=0,s=t.length-1;do{if(i>=s-1)return r<t[s]?n(e,i,r-t[i]):null;o=i+Math.trunc((s-i)*.5),r<t[o]?s=o:i=o}while(i<s)}function Fu(e,t){return e.getValid(t)}function Dl(e){function t(r,n,i){return e(r[n],i)}return function(r){let n=this.data;return m_(n,this._offsets,r,t)}}function Sp(e){let t;function r(n,i,o){return e(n[i],o,t)}return function(n,i){let o=this.data;t=i;let s=m_(o,this._offsets,n,r);return t=void 0,s}}function vp(e){let t;function r(n,i,o){let s=o,a=0,c=0;for(let l=i-1,h=n.length;++l<h;){let u=n[l];if(~(a=e(u,t,s)))return c+a;s=0,c+=u.length}return-1}return function(n,i){t=n;let o=this.data,s=typeof i!="number"?r(o,0,0):m_(o,this._offsets,i,r);return t=void 0,s}}var Du,Ep=w(()=>{Du=class{constructor(t=0,r){this.numChunks=t,this.getChunkIterator=r,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}}});function NL(e,t){return t===null&&e.length>0?0:-1}function OL(e,t){let{nullBitmap:r}=e;if(!r||e.nullCount<=0)return-1;let n=0;for(let i of new Wi(r,e.offset+(t||0),e.length,r,Ll)){if(!i)return n;++n}return-1}function gt(e,t,r){if(t===void 0)return-1;if(t===null)switch(e.typeId){case x.Union:break;case x.Dictionary:break;default:return OL(e,r)}let n=He.getVisitFn(e),i=Ls(t);for(let o=(r||0)-1,s=e.length;++o<s;)if(i(n(e,o)))return o;return-1}function q4(e,t,r){let n=He.getVisitFn(e),i=Ls(t);for(let o=(r||0)-1,s=e.length;++o<s;)if(i(n(e,o)))return o;return-1}var ot,qa,Tp=w(()=>{Ne();fn();Ua();ka();Bl();ot=class extends rt{};ot.prototype.visitNull=NL;ot.prototype.visitBool=gt;ot.prototype.visitInt=gt;ot.prototype.visitInt8=gt;ot.prototype.visitInt16=gt;ot.prototype.visitInt32=gt;ot.prototype.visitInt64=gt;ot.prototype.visitUint8=gt;ot.prototype.visitUint16=gt;ot.prototype.visitUint32=gt;ot.prototype.visitUint64=gt;ot.prototype.visitFloat=gt;ot.prototype.visitFloat16=gt;ot.prototype.visitFloat32=gt;ot.prototype.visitFloat64=gt;ot.prototype.visitUtf8=gt;ot.prototype.visitLargeUtf8=gt;ot.prototype.visitUtf8View=gt;ot.prototype.visitBinary=gt;ot.prototype.visitLargeBinary=gt;ot.prototype.visitBinaryView=gt;ot.prototype.visitFixedSizeBinary=gt;ot.prototype.visitDate=gt;ot.prototype.visitDateDay=gt;ot.prototype.visitDateMillisecond=gt;ot.prototype.visitTimestamp=gt;ot.prototype.visitTimestampSecond=gt;ot.prototype.visitTimestampMillisecond=gt;ot.prototype.visitTimestampMicrosecond=gt;ot.prototype.visitTimestampNanosecond=gt;ot.prototype.visitTime=gt;ot.prototype.visitTimeSecond=gt;ot.prototype.visitTimeMillisecond=gt;ot.prototype.visitTimeMicrosecond=gt;ot.prototype.visitTimeNanosecond=gt;ot.prototype.visitDecimal=gt;ot.prototype.visitList=gt;ot.prototype.visitLargeList=gt;ot.prototype.visitStruct=gt;ot.prototype.visitUnion=gt;ot.prototype.visitDenseUnion=q4;ot.prototype.visitSparseUnion=q4;ot.prototype.visitDictionary=gt;ot.prototype.visitInterval=gt;ot.prototype.visitIntervalDayTime=gt;ot.prototype.visitIntervalYearMonth=gt;ot.prototype.visitIntervalMonthDayNano=gt;ot.prototype.visitDuration=gt;ot.prototype.visitDurationSecond=gt;ot.prototype.visitDurationMillisecond=gt;ot.prototype.visitDurationMicrosecond=gt;ot.prototype.visitDurationNanosecond=gt;ot.prototype.visitFixedSizeList=gt;ot.prototype.visitMap=gt;qa=new ot});function ft(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(z.isInt(t)&&t.bitWidth!==64||z.isTime(t)&&t.bitWidth!==64||z.isFloat(t)&&t.precision!==Vt.HALF))return new Du(e.data.length,n=>{let i=e.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let r=0;return new Du(e.data.length,n=>{let o=e.data[n].length,s=e.slice(r,r+o);return r+=o,new p_(s)})}var st,p_,Fl,Ip=w(()=>{fn();Ne();te();Ep();st=class extends rt{};p_=class{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};st.prototype.visitNull=ft;st.prototype.visitBool=ft;st.prototype.visitInt=ft;st.prototype.visitInt8=ft;st.prototype.visitInt16=ft;st.prototype.visitInt32=ft;st.prototype.visitInt64=ft;st.prototype.visitUint8=ft;st.prototype.visitUint16=ft;st.prototype.visitUint32=ft;st.prototype.visitUint64=ft;st.prototype.visitFloat=ft;st.prototype.visitFloat16=ft;st.prototype.visitFloat32=ft;st.prototype.visitFloat64=ft;st.prototype.visitUtf8=ft;st.prototype.visitLargeUtf8=ft;st.prototype.visitUtf8View=ft;st.prototype.visitBinary=ft;st.prototype.visitLargeBinary=ft;st.prototype.visitBinaryView=ft;st.prototype.visitFixedSizeBinary=ft;st.prototype.visitDate=ft;st.prototype.visitDateDay=ft;st.prototype.visitDateMillisecond=ft;st.prototype.visitTimestamp=ft;st.prototype.visitTimestampSecond=ft;st.prototype.visitTimestampMillisecond=ft;st.prototype.visitTimestampMicrosecond=ft;st.prototype.visitTimestampNanosecond=ft;st.prototype.visitTime=ft;st.prototype.visitTimeSecond=ft;st.prototype.visitTimeMillisecond=ft;st.prototype.visitTimeMicrosecond=ft;st.prototype.visitTimeNanosecond=ft;st.prototype.visitDecimal=ft;st.prototype.visitList=ft;st.prototype.visitLargeList=ft;st.prototype.visitStruct=ft;st.prototype.visitUnion=ft;st.prototype.visitDenseUnion=ft;st.prototype.visitSparseUnion=ft;st.prototype.visitDictionary=ft;st.prototype.visitInterval=ft;st.prototype.visitIntervalDayTime=ft;st.prototype.visitIntervalYearMonth=ft;st.prototype.visitIntervalMonthDayNano=ft;st.prototype.visitDuration=ft;st.prototype.visitDurationSecond=ft;st.prototype.visitDurationMillisecond=ft;st.prototype.visitDurationMicrosecond=ft;st.prototype.visitDurationNanosecond=ft;st.prototype.visitFixedSizeList=ft;st.prototype.visitMap=ft;Fl=new st});function Hi(e){if(e){if(e instanceof ut)return new $([e]);if(e instanceof $)return new $(e.data);if(e.type instanceof z)return new $([Q(e)]);if(Array.isArray(e))return new $(e.flatMap(t=>BL(t)));if(ArrayBuffer.isView(e)){e instanceof DataView&&(e=new Uint8Array(e.buffer));let t={offset:0,length:e.length,nullCount:-1,data:e};if(e instanceof Int8Array)return new $([Q(Object.assign(Object.assign({},t),{type:new An}))]);if(e instanceof Int16Array)return new $([Q(Object.assign(Object.assign({},t),{type:new Pn}))]);if(e instanceof Int32Array)return new $([Q(Object.assign(Object.assign({},t),{type:new Ve}))]);if(e instanceof BigInt64Array)return new $([Q(Object.assign(Object.assign({},t),{type:new Rn}))]);if(e instanceof Uint8Array||e instanceof Uint8ClampedArray)return new $([Q(Object.assign(Object.assign({},t),{type:new Cn}))]);if(e instanceof Uint16Array)return new $([Q(Object.assign(Object.assign({},t),{type:new Nn}))]);if(e instanceof Uint32Array)return new $([Q(Object.assign(Object.assign({},t),{type:new Vr}))]);if(e instanceof BigUint64Array)return new $([Q(Object.assign(Object.assign({},t),{type:new wi}))]);if(e instanceof Float32Array)return new $([Q(Object.assign(Object.assign({},t),{type:new kr}))]);if(e instanceof Float64Array)return new $([Q(Object.assign(Object.assign({},t),{type:new On}))]);throw new Error("Unrecognized input")}}throw new Error("Unrecognized input")}function BL(e){return e instanceof ut?[e]:e instanceof $?e.data:Hi(e).data}var j4,W4,H4,$4,$,Ap,Ar=w(()=>{Ne();Bl();te();Zn();Ep();Ua();Dn();Tp();Ip();te();W4=Symbol.for("apache-arrow/Vector"),H4={},$4={},$=class e{static isVector(t){return t?.[W4]===!0}constructor(t){var r,n,i;let o=t[0]instanceof e?t.flatMap(a=>a.data):t;if(o.length===0||o.some(a=>!(a instanceof ut)))throw new TypeError("Vector constructor expects an Array of Data instances.");let s=(r=o[0])===null||r===void 0?void 0:r.type;switch(o.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l}=H4[s.typeId],h=o[0];this.isValid=u=>Fu(h,u),this.get=u=>a(h,u),this.set=(u,f)=>c(h,u,f),this.indexOf=u=>l(h,u),this._offsets=[0,h.length];break}default:Object.setPrototypeOf(this,$4[s.typeId]),this._offsets=bp(o);break}this.data=o,this.type=s,this.stride=Ln(s),this.numChildren=(i=(n=s.children)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,r)=>t+r.byteLength,0)}get nullable(){return k4(this.data)}get nullCount(){return Mp(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${x[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(Ga(t,this.length))}set(t,r){}indexOf(t,r){return-1}includes(t,r){return this.indexOf(t,r)>-1}[Symbol.iterator](){return Fl.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(r=>r.data).flat(Number.POSITIVE_INFINITY)))}slice(t,r){return new e(Bu(this,t,r,({data:n,_offsets:i},o,s)=>xp(n,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:r,length:n,stride:i,ArrayType:o}=this;switch(t.typeId){case x.Int:case x.Float:case x.Decimal:case x.Time:case x.Timestamp:switch(r.length){case 0:return new o;case 1:return r[0].values.subarray(0,n*i);default:return r.reduce((s,{values:a,length:c})=>(s.array.set(a.subarray(0,c*i),s.offset),s.offset+=c*i,s),{array:new o(n*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var r;return this.getChildAt((r=this.type.children)===null||r===void 0?void 0:r.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new e(this.data.map(({children:r})=>r[t])):null}get isMemoized(){return z.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(z.isDictionary(this.type)){let t=new Ap(this.data[0].dictionary),r=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new e(r)}return new Ap(this)}unmemoize(){if(z.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),r=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new e(r)}return this}};j4=Symbol.toStringTag;$[j4]=(e=>{e.type=z.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0,e[W4]=!0;let t=Object.keys(x).map(r=>x[r]).filter(r=>typeof r=="number"&&r!==x.NONE);for(let r of t){let n=He.getVisitFnByTypeId(r),i=mr.getVisitFnByTypeId(r),o=qa.getVisitFnByTypeId(r);H4[r]={get:n,set:i,indexOf:o},$4[r]=Object.create(e,{isValid:{value:Dl(Fu)},get:{value:Dl(He.getVisitFnByTypeId(r))},set:{value:Sp(mr.getVisitFnByTypeId(r))},indexOf:{value:vp(qa.getVisitFnByTypeId(r))}})}return"Vector"})($.prototype);Object.defineProperty($,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===$&&$.isVector(t)}});Ap=class e extends ${constructor(t){super(t.data);let r=this.get,n=this.set,i=this.slice,o=new Array(this.length);Object.defineProperty(this,"get",{value(s){let a=o[s];if(a!==void 0)return a;let c=r.call(this,s);return o[s]=c,c}}),Object.defineProperty(this,"set",{value(s,a){n.call(this,s,a),o[s]=a}}),Object.defineProperty(this,"slice",{value:(s,a)=>new e(i.call(this,s,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new $(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}});function Y4(e){if(!e||e.length<=0)return function(i){return!0};let t="",r=e.filter(n=>n===n);return r.length>0&&(t=`
7
+ "use strict";var __exports__=(()=>{var EP=Object.create;var df=Object.defineProperty;var TP=Object.getOwnPropertyDescriptor;var IP=Object.getOwnPropertyNames;var AP=Object.getPrototypeOf,PP=Object.prototype.hasOwnProperty;var w=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var RP=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Zr=(e,t)=>{for(var r in t)df(e,r,{get:t[r],enumerable:!0})},ff=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of IP(t))!PP.call(e,i)&&i!==r&&df(e,i,{get:()=>t[i],enumerable:!(n=TP(t,i))||n.enumerable});return e},mf=(e,t,r)=>(ff(e,t,"default"),r&&ff(r,t,"default")),CP=(e,t,r)=>(r=e!=null?EP(AP(e)):{},ff(t||!e||!e.__esModule?df(r,"default",{value:e,enumerable:!0}):r,e)),NP=e=>ff(df({},"__esModule",{value:!0}),e);var DM=RP((rF,LM)=>{LM.exports=globalThis.loaders});function ii(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var FM=w(()=>{"use strict"});var nh,BP,pf,OP,LP,P0=w(()=>{nh=globalThis,BP=globalThis.document||{},pf=globalThis.process||{},OP=globalThis.console,LP=globalThis.navigator||{}});function gf(e){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&process.versions?.electron)return!0;let t=typeof navigator<"u"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}var yf=w(()=>{});function zo(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||gf()}var R0=w(()=>{yf()});var UM=w(()=>{R0();yf();P0()});var GM=w(()=>{});var C0,wf=w(()=>{P0();R0();UM();yf();GM();C0="5.0.0"});function vc(e,t){if(!e)throw new Error(t||"Assertion failed")}var N0=w(()=>{});function _f(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return vc(Number.isFinite(t)&&t>=0),t}function B0(e){let{logLevel:t,message:r}=e;e.logLevel=_f(t);let n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let i=typeof e.message;return vc(i==="string"||i==="object"),Object.assign(e,{args:n},e.opts)}var Mf=w(()=>{N0()});var Vo,ua,ih=w(()=>{Mf();Vo=()=>{},ua=class{constructor({level:t=0}={}){this.userData={},this._onceCache=new Set,this._level=t}set level(t){this.setLevel(t)}get level(){return this.getLevel()}setLevel(t){return this._level=t,this}getLevel(){return this._level}warn(t,...r){return this._log("warn",0,t,r,{once:!0})}error(t,...r){return this._log("error",0,t,r)}log(t,r,...n){return this._log("log",t,r,n)}info(t,r,...n){return this._log("info",t,r,n)}once(t,r,...n){return this._log("once",t,r,n,{once:!0})}_log(t,r,n,i,o={}){let s=B0({logLevel:r,message:n,args:this._buildArgs(r,n,i),opts:o});return this._createLogFunction(t,s,o)}_buildArgs(t,r,n){return[t,r,...n]}_createLogFunction(t,r,n){if(!this._shouldLog(r.logLevel))return Vo;let i=this._getOnceTag(n.tag??r.tag??r.message);if((n.once||r.once)&&i!==void 0){if(this._onceCache.has(i))return Vo;this._onceCache.add(i)}return this._emit(t,r)}_shouldLog(t){return this.getLevel()>=_f(t)}_getOnceTag(t){if(t!==void 0)try{return typeof t=="string"?t:String(t)}catch{return}}}});function FP(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var oh,O0=w(()=>{oh=class{constructor(t,r,n="sessionStorage"){this.storage=FP(n),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}}});function zM(e){let t;return e<10?t=`${e.toFixed(2)}ms`:e<100?t=`${e.toFixed(1)}ms`:e<1e3?t=`${e.toFixed(0)}ms`:t=`${(e/1e3).toFixed(2)}s`,t}function L0(e,t=8){let r=Math.max(t-e.length,0);return`${" ".repeat(r)}${e}`}var D0=w(()=>{});function VM(e){return typeof e!="string"?e:(e=e.toUpperCase(),sh[e]||sh.WHITE)}function F0(e,t,r){return!zo&&typeof e=="string"&&(t&&(e=`\x1B[${VM(t)}m${e}\x1B[39m`),r&&(e=`\x1B[${VM(r)+UP}m${e}\x1B[49m`)),e}var sh,UP,bf=w(()=>{wf();(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(sh||(sh={}));UP=10});function U0(e,t=["constructor"]){let r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),i=e;for(let o of n){let s=i[o];typeof s=="function"&&(t.find(a=>o===a)||(i[o]=s.bind(e)))}}var G0=w(()=>{});var xf,zn,ah=w(()=>{wf();xf=class{getHighResolutionTimer(){let t;if(zo()&&nh.performance)t=nh?.performance?.now?.();else if("hrtime"in pf){let r=pf?.hrtime?.();t=r[0]*1e3+r[1]/1e6}else t=Date.now();return t}getMemoryUsageMB(){let r=nh?.performance?.memory?.usedJSHeapSize;return r==null?null:Math.trunc(r/1024/1024)}},zn=new xf;globalThis.Probe=xf;globalThis.probe=zn});function GP(e,t,r){if(typeof t=="string"){let n=r.time?L0(zM(r.total)):"";t=r.time?`${e}: ${n} ${t}`:`${e}: ${t}`,t=F0(t,r.color,r.background)}return t}function zP(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}var Ec,z0,Zi,V0=w(()=>{wf();ih();O0();D0();bf();G0();N0();ah();Mf();Mf();Ec={debug:zo()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},z0={enabled:!0,level:0},Zi=class extends ua{constructor({id:t}={id:""}){super({level:0}),this.VERSION=C0,this._startTs=zn.getHighResolutionTimer(),this._deltaTs=zn.getHighResolutionTimer(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new oh(`__probe-${this.id}__`,{[this.id]:z0}),this.timeStamp(`${this.id} started`),U0(this),Object.seal(this)}isEnabled(){return this._getConfiguration().enabled}getLevel(){return this._getConfiguration().level}getTotal(){return Number((zn.getHighResolutionTimer()-this._startTs).toPrecision(10))}getDelta(){return Number((zn.getHighResolutionTimer()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._updateConfiguration({enabled:t}),this}setLevel(t){return this._updateConfiguration({level:t}),this}get(t){return this._getConfiguration()[t]}set(t,r){this._updateConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){if(!t)throw new Error(r||"Assertion failed")}warn(t,...r){return this._log("warn",0,t,r,{method:Ec.warn,once:!0})}error(t,...r){return this._log("error",0,t,r,{method:Ec.error})}deprecated(t,r){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(t,r){return this.error(`\`${t}\` has been removed. Use \`${r}\` instead`)}probe(t,r,...n){let i=zn.getMemoryUsageMB();if(i!==null){let o=`${i}MB `;typeof r=="function"?r=()=>`${o}${r()}`:typeof r=="string"&&(r=`${o}${r}`)}return this._log("log",t,r,n,{method:Ec.log,time:!0,once:!0})}log(t,r,...n){return this._log("log",t,r,n,{method:Ec.debug})}info(t,r,...n){return this._log("info",t,r,n,{method:console.info})}once(t,r,...n){return this._log("once",t,r,n,{method:Ec.debug||Ec.info,once:!0})}table(t,r,n){return r?this._log("table",t,r,n&&[n]||[],{method:console.table||Vo,tag:zP(r)}):Vo}time(t,r){return this._log("time",t,r,[],{method:console.time?console.time:console.info})}timeEnd(t,r){return this._log("time",t,r,[],{method:console.timeEnd?console.timeEnd:console.info})}timeStamp(t,r){return this._log("time",t,r,[],{method:console.timeStamp||Vo})}group(t,r,n={collapsed:!1}){let i=(n.collapsed?console.groupCollapsed:console.group)||console.info;return this._log("group",t,r,[],{method:i})}groupCollapsed(t,r,n={}){return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._log("groupEnd",t,"",[],{method:console.groupEnd||Vo})}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&super._shouldLog(t)}_emit(t,r){let n=r.method;vc(n),r.total=this.getTotal(),r.delta=this.getDelta(),this._deltaTs=zn.getHighResolutionTimer();let i=GP(this.id,r.message,r);return n.bind(console,i,...r.args)}_getConfiguration(){return this._storage.config[this.id]||this._updateConfiguration(z0),this._storage.config[this.id]}_updateConfiguration(t){let r=this._storage.config[this.id]||{...z0};this._storage.setConfiguration({[this.id]:{...r,...t}})}};Zi.VERSION=C0});var kM=w(()=>{ih()});var qM=w(()=>{ih()});var jM=w(()=>{ah()});var WM=w(()=>{ah();globalThis.probe||(globalThis.probe=zn)});var n5,HM=w(()=>{V0();ah();V0();kM();ih();qM();bf();bf();D0();G0();O0();jM();WM();n5=new Zi({id:"@probe.gl/log"})});function kP(){let e=new Zi({id:"loaders.gl"});return globalThis.loaders||={},globalThis.loaders.log=e,globalThis.loaders.version=VP,globalThis.probe||={},globalThis.probe.loaders=e,e}function ch(){}function j0(e){let t=e?.core?.log;return t===null?qP:t||Ji}var k0,VP,Ji,q0,qP,W0=w(()=>{"use strict";HM();k0="5.0.0-beta.11",VP=k0[0]>="0"&&k0[0]<="9"?`v${k0}`:"";Ji=kP(),q0=class{log(){return ch}info(){return ch}once(){return ch}warn(){return ch}error(){return ch}};qP=new q0});var jP,$M,YM=w(()=>{"use strict";jP=e=>e!==null&&typeof e=="object",$M=e=>jP(e)&&e.constructor==={}.constructor});function Sf(e,t){return KM(e||{},t)}function KM(e,t,r=0){if(r>3)return t;let n={...e};for(let[i,o]of Object.entries(t))$M(o)?n[i]=KM(n[i]||{},t[i],r+1):n[i]=t[i];return n}var XM=w(()=>{"use strict";YM()});function vf(e,t,r){let n=r!==void 0?new Uint8Array(e).subarray(t,t+r):new Uint8Array(e).subarray(t);return new Uint8Array(n).buffer}var ZM=w(()=>{"use strict"});function lh(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var H0=w(()=>{});var fa,$0=w(()=>{H0();fa=class{constructor(t,r){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=lh(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(lh()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}}});var Pi,JM=w(()=>{$0();Pi=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,r="count"){return this._getOrCreate({name:t,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let r of Object.values(this.stats))t(r)}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(r=>this._getOrCreate(r))}_getOrCreate(t){let{name:r,type:n}=t,i=this.stats[r];return i||(t instanceof fa?i=t:i=new fa(r,n),this.stats[r]=i),i}}});var Ef=w(()=>{JM();$0();H0()});var WP,HP,$P,YP,KP,XP,Tc,QM=w(()=>{"use strict";Ef();WP="Queued Requests",HP="Active Requests",$P="Cancelled Requests",YP="Queued Requests Ever",KP="Active Requests Ever",XP={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},Tc=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(t={}){this.props={...XP,...t},this.stats=new Pi({id:this.props.id}),this.stats.get(WP),this.stats.get(HP),this.stats.get($P),this.stats.get(YP),this.stats.get(KP)}setProps(t){t.throttleRequests!==void 0&&(this.props.throttleRequests=t.throttleRequests),t.maxRequests!==void 0&&(this.props.maxRequests=t.maxRequests),t.debounceTime!==void 0&&(this.props.debounceTime=t.debounceTime)}scheduleRequest(t,r=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);let n={handle:t,priority:0,getPriority:r},i=new Promise(o=>(n.resolve=o,n));return this.requestQueue.push(n),this.requestMap.set(t,i),this._issueNewRequests(),i}_issueRequest(t){let{handle:r,resolve:n}=t,i=!1,o=()=>{i||(i=!0,this.requestMap.delete(r),this.activeRequestCount--,this.scheduleRefill())};return this.activeRequestCount++,n?n({done:o}):Promise.resolve({done:o})}scheduleRefill(){this.updateTimer===null&&(this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),0))}_issueNewRequests(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=null;let t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(t!==0){this._updateAllRequests();for(let r=0;r<t;++r){let n=this.requestQueue.shift();n&&this._issueRequest(n)}}}_updateAllRequests(){let t=this.requestQueue;for(let r=0;r<t.length;++r){let n=t[r];this._updateRequest(n)||(t.splice(r,1),this.requestMap.delete(n.handle),r--)}t.sort((r,n)=>r.priority-n.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),t.priority<0?(t.resolve(null),!1):!0}}});function K0(e,t=[]){return e.every(Y0)?e:e.map((r,n)=>{if(Y0(r))return r;let i=t.find(s=>s.type===r?.type);if(!i)throw new Error(`No authentication class registered for credential at index ${n}.`);let o;try{o=new i(r)}catch{throw new Error(`Invalid authentication configuration at index ${n}.`)}if(!Y0(o))throw new Error(`Authentication class returned an invalid credential at index ${n}.`);return o})}function X0(e){if(!e.core?.credentials?.length)return e;let t=K0(e.core.credentials,e.core.authentications);return t===e.core.credentials?e:{...e,core:{...e.core,credentials:t}}}function Y0(e){return!e||typeof e!="object"||typeof e.id!="string"||!Array.isArray(e.origins)?!1:e.type==="request"?typeof e.authenticate=="function":(e.type==="header"||e.type==="query-parameter")&&typeof e.name=="string"&&(typeof e.token=="string"||typeof e.token=="function")&&Array.isArray(e.refreshStatusCodes)}var Z0=w(()=>{"use strict"});function J0(){let e=new Error("Request aborted");return e.name="AbortError",e}function t2(e,t,r){let n=e??t;if(n<0||Number.isNaN(n))throw new Error(`${r} must be a non-negative number`);return n}function e2(e){if(!Number.isFinite(e)||e<0)throw new Error("Request cache entry byte length must be a non-negative finite number");return e}var ZP,JP,hh,r2=w(()=>{"use strict";ZP=Number.POSITIVE_INFINITY,JP=Number.POSITIVE_INFINITY,hh=class{maxEntries;maxBytes;getByteLength;onRemove;entries=new Map;retainedByteLength=0;constructor(t={}){this.maxEntries=t2(t.maxEntries,ZP,"maxEntries"),this.maxBytes=t2(t.maxBytes,JP,"maxBytes"),this.getByteLength=t.getByteLength||(()=>0),this.onRemove=t.onRemove}get size(){return this.entries.size}get pendingSize(){let t=0;for(let r of this.entries.values())t+=r.pending?1:0;return t}get byteLength(){return this.retainedByteLength}get(t,r){let n=this.entries.get(t);if(n)return this.touch(t,n),this.waitForEntry(t,n,r)}has(t){return this.entries.has(t)}set(t,r){this.removeEntry(t,"replace");let n=e2(this.getByteLength(r)),i={promise:Promise.resolve(r),pending:!1,waiterCount:0,byteLength:n};return this.entries.set(t,i),this.retainedByteLength+=n,this.trim(),r}getOrLoad(t,r,n){let i=this.get(t,n);if(i)return i;if(n?.aborted)return Promise.reject(J0());let o=new AbortController,s,a,l={promise:new Promise((h,u)=>{s=h,a=u}),controller:o,pending:!0,waiterCount:0,byteLength:0};this.entries.set(t,l),l.promise.then(h=>this.handleLoadedValue(t,l,h),()=>this.handleLoadError(t,l));try{Promise.resolve(r(o.signal)).then(s,a)}catch(h){a(h)}return this.waitForEntry(t,l,n)}delete(t){return this.removeEntry(t,"delete")}clear(){for(let t of Array.from(this.entries.keys()))this.removeEntry(t,"clear")}handleLoadedValue(t,r,n){if(this.entries.get(t)===r){r.pending=!1,r.controller=void 0;try{r.byteLength=e2(this.getByteLength(n))}catch{this.removeEntry(t,"error");return}this.retainedByteLength+=r.byteLength,this.trim()}}handleLoadError(t,r){this.entries.get(t)===r&&this.removeEntry(t,r.controller?.signal.aborted?"abort":"error")}waitForEntry(t,r,n){return n?.aborted?Promise.reject(J0()):r.pending?(r.waiterCount++,new Promise((i,o)=>{let s=!0,a=()=>{s&&(s=!1,n?.removeEventListener("abort",c),r.waiterCount--)},c=()=>{s&&(a(),o(J0()),r.pending&&r.waiterCount===0&&this.entries.get(t)===r&&this.removeEntry(t,"abort"))};n?.addEventListener("abort",c,{once:!0}),r.promise.then(l=>{s&&(a(),i(l))},l=>{s&&(a(),o(l))})})):r.promise}touch(t,r){this.entries.delete(t),this.entries.set(t,r)}trim(){let t=this.entries.size-this.pendingSize;if(!(t<=this.maxEntries&&this.retainedByteLength<=this.maxBytes)){for(let[r,n]of this.entries)if(n.pending||(this.removeEntry(r,"evict"),t--),t<=this.maxEntries&&this.retainedByteLength<=this.maxBytes)break}}removeEntry(t,r){let n=this.entries.get(t);return n?(this.entries.delete(t),this.retainedByteLength-=n.byteLength,n.pending&&n.controller?.abort(),this.onRemove?.(t,r),!0):!1}}});function QP(e){let t=e.fetch||((u,f)=>fetch(u,f)),r=t[n2],n=new Map(r?.credentialResolutions),i=K0(e.credentials.map(u=>n.get(u)||u),e.authentications);if(e.credentials.forEach((u,f)=>{n.set(u,i[f])}),!e.fetchOptions&&(!i.length||r?.credentials.length===i.length&&i.every((u,f)=>u===r.credentials[f])))return t;let o=r?.fetch||t,s=r?[...new Set([...i,...r.credentials])]:i,a=i2(r?.fetchOptions||{},e.fetchOptions),c=s.filter(u=>u.type!=="request"),l=s.filter(u=>u.type==="request");for(let u of l)l2(u.origins);let h=async(u,f={})=>{if(f=i2(a,f),f.signal?.throwIfAborted(),!s.length)return o(u,f);let d=rR(u),m=d?await s2(d,f,c):{url:u,options:f,credentials:[]},p=await o2(m,l,"request"),g=await o(p.url,p.options),y=[];for(let T of m.credentials){let{credential:S}=T;typeof S.token=="function"&&(Tf(f)||S.canReplayRequest?.(u,f))&&(Tf(p.options)||S.canReplayRequest?.(p.url,p.options))&&(S.refreshStatusCodes.includes(g.status)||await S.shouldRefresh?.(g))&&y.push(T)}let _=Tf(f)&&Tf(p.options)&&p.credentials.some(T=>T.refreshStatusCodes?.includes(g.status));if(!y.length&&!_)return g;f.signal?.throwIfAborted();let M=new Map;if(await Promise.all(y.map(async({credential:T})=>{let S=await tR(T,u,g);S&&M.set(T,S)})),!M.size&&!_)return g;await g.body?.cancel().catch(()=>{}),f.signal?.throwIfAborted();let x=d?await s2(d,f,c,M,m.credentials):{url:u,options:f},v=await o2(x,l,"retry",g);return o(v.url,v.options)};return Object.defineProperty(h,n2,{value:{fetch:o,credentials:s,credentialResolutions:n,fetchOptions:a}}),h}function a2(e={}){let t=e.core?.fetch,r;typeof t=="function"?r=t:r=(i,o)=>fetch(i,o);let n=typeof t=="object"&&t?t:void 0;return QP({fetch:r,fetchOptions:e.signal?{...n,signal:e.signal}:n,credentials:e.core?.credentials||[],authentications:e.core?.authentications})}function i2(e,t){let r={...e,...t};if(e.headers||t?.headers){let n=new Headers(e.headers);new Headers(t?.headers).forEach((i,o)=>n.set(o,i)),r.headers=n}return r}async function o2(e,t,r,n){let i=[],o=e.options.signal;for(let s of t){let a=c2(e.url);if(!a||!l2(s.origins).includes(a))continue;o?.throwIfAborted();let c=await s.authenticate({url:e.url,options:{...e.options,headers:new Headers(e.options.headers)},reason:r,response:n?{status:n.status,headers:new Headers(n.headers)}:void 0});if(!c||typeof c.url!="string"||!c.options||typeof c.options!="object")throw new Error("Authentication callback returned an invalid request.");e={url:c.url,options:{...c.options,...o?{signal:o}:{}}},i.push(s)}return o?.throwIfAborted(),{...e,credentials:i}}function c2(e){try{let t=new URL(e);return!t.host||t.username||t.password?null:t.origin!=="null"?t.origin:`${t.protocol}//${t.host}`}catch{return null}}function l2(e){if(!e.length)throw new Error("Request authentication requires at least one exact origin.");return e.map(t=>{let r=c2(t),n;try{n=new URL(t)}catch{throw new Error("Invalid request authentication origin.")}if(!r||n.pathname&&n.pathname!=="/"||n.search||n.hash)throw new Error("Invalid request authentication origin.");return r})}async function s2(e,t,r,n=new Map,i=[]){let o=new URL(e),s=new Headers(t.headers),a=[],c=new Map(i.map(({credential:l,token:h})=>[l,h]));for(let l of r){if(!l.origins.includes(o.origin))continue;let h=n.get(l),u=c.get(l),f=l.type==="query-parameter"&&u!==void 0,d=l.type==="header"&&u!==void 0;if(l.type==="query-parameter"&&o.searchParams.has(l.name)&&!f||l.type==="header"&&s.has(l.name)&&!d)continue;let m=h??u??await eR(l.token,{url:e.toString(),reason:"request"});m&&(l.type==="query-parameter"?o.searchParams.set(l.name,m):s.set(l.name,`${l.prefix||""}${m}`),a.push({credential:l,token:m}))}return{url:o.toString(),options:{...t,headers:s},credentials:a}}async function tR(e,t,r){let n=Q0.get(e);if(n)return n;let i=e.token,o=Promise.resolve(i({url:t,reason:"refresh",response:{status:r.status,headers:r.headers}})).finally(()=>Q0.delete(e));return Q0.set(e,o),o}async function eR(e,t){return typeof e=="function"?e(t):e}function rR(e){try{let t=new URL(e);return["http:","https:"].includes(t.protocol)?t:null}catch{return null}}function Tf(e){let t=(e.method||"GET").toUpperCase();return["GET","HEAD","OPTIONS","PUT","DELETE"].includes(t)?!(e.body&&typeof ReadableStream<"u"&&e.body instanceof ReadableStream):!1}var n2,Q0,h2=w(()=>{"use strict";Z0();n2=Symbol("loaders.gl.authenticated-fetch"),Q0=new WeakMap});function nR(e,t){switch((t.type==="response"||t.type==="error")&&t.networkTimeMs!==void 0&&e.get(he.networkTimeMs,"time").addTime(t.networkTimeMs),t.type){case"queued":e.get(he.logicalRanges,"count").incrementCount(),e.get(he.requestedBytes,"count").addCount(t.logicalBytes||0);break;case"batch":e.get(he.rangeBatches,"count").incrementCount(),e.get("Logical Ranges Batched","count").addCount(t.logicalRequestCount||0),e.get(he.transportRanges,"count").addCount(t.transportRequestCount||0),e.get(he.coalescedRanges,"count").addCount(Math.max((t.logicalRequestCount||0)-(t.transportRequestCount||0),0)),e.get(he.transportBytes,"count").addCount(t.transportBytes||0),e.get(he.overfetchBytes,"count").addCount(t.overfetchBytes||0);break;case"response":e.get(he.completedTransportRanges,"count").incrementCount(),e.get(he.responseBytes,"count").addCount(t.responseBytes||0),t.fullResponse&&e.get(he.fullResponseFallbacks,"count").incrementCount();break;case"error":e.get(he.failedTransportRanges,"count").incrementCount();break;case"abort":e.get(he.abortedLogicalRanges,"count").incrementCount();break;default:}}function d2(e="range-request-scheduler"){let t=new Pi({id:e});return m2(t),t}async function iR(e){let t=hR(e.signal),r=uh();try{let n=!1,i=await e.fetch(e.url,u2(e.fetchOptions,e.offset,e.length,t.signal));if(i.status===416&&e.offset===0){let c=cR(i.headers.get("Content-Range"));if(!c)throw new Error("Missing content-length on 416 response");i=await e.fetch(e.url,u2(e.fetchOptions,0,c,t.signal)),n=!0}if(i.status===200)throw t.abort(),await uR(i),new Error("Byte-range request failed: server returned 200 instead of 206");if(i.status!==206&&!i.ok)throw new Error(`Bad response code: ${i.status}`);let o=await i.arrayBuffer(),s=i.headers.get("Content-Range"),a=lR(s);if(s&&!a)throw new Error(`Invalid Content-Range header: ${s}`);if(a){let c=a.endOffset-a.offset+1,l=e.offset+e.length-1;if(a.offset!==e.offset||a.endOffset>l||c!==o.byteLength||a.sourceByteLength!==void 0&&a.endOffset>=a.sourceByteLength)throw new Error(`Content-Range does not match requested range: ${s}`)}return{arrayBuffer:o,status:i.status,sourceByteLength:a?.sourceByteLength,transportBytes:o.byteLength,networkTimeMs:uh()-r,fullResponse:n}}finally{t.removeAbortListener()}}function oR(e,t,r){if(e.sourceId!==t.sourceId||e.isolationKey!==(t.isolationKey??t.sourceId))return!1;let n=t.offset+t.length,i=t.offset-e.endOffset,o=Math.max(e.endOffset,n)-e.offset;return i<=r.rangeExpansionBytes&&o<=r.maxMergedBytes}function m2(e){e.get(he.logicalRanges,"count"),e.get(he.requestedBytes,"count"),e.get(he.rangeBatches,"count"),e.get("Logical Ranges Batched","count"),e.get(he.transportRanges,"count"),e.get(he.coalescedRanges,"count"),e.get(he.transportBytes,"count"),e.get(he.completedTransportRanges,"count"),e.get(he.responseBytes,"count"),e.get(he.networkTimeMs,"time"),e.get(he.overfetchBytes,"count"),e.get(he.fullResponseFallbacks,"count"),e.get(he.failedTransportRanges,"count"),e.get(he.abortedLogicalRanges,"count")}function tg(e){return e.reduce((t,r)=>t+r.length,0)}function sR(e){return e instanceof ArrayBuffer?{arrayBuffer:e}:e}function u2(e,t,r,n){return{...e,signal:n,headers:{...aR(e?.headers),Range:`bytes=${t}-${t+r-1}`}}}function aR(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):e:{}}function cR(e){let t=e?.match(/^bytes \*\/(\d+)$/);return t?Number(t[1]):null}function lR(e){let t=e?.match(/^bytes (\d+)-(\d+)\/(\d+|\*)$/);if(!t)return null;let r=Number(t[1]),n=Number(t[2]),i=t[3]==="*"?void 0:Number(t[3]);return!Number.isSafeInteger(r)||!Number.isSafeInteger(n)||r>n||i!==void 0&&!Number.isSafeInteger(i)?null:{offset:r,endOffset:n,sourceByteLength:i}}function hR(e){let t=new AbortController,r=()=>t.abort(e?.reason);return e?.aborted?t.abort(e?.reason):e?.addEventListener("abort",r,{once:!0}),{signal:t.signal,abort:()=>t.abort(),removeAbortListener:()=>e?.removeEventListener("abort",r)}}async function uR(e){await e.body?.cancel().catch(()=>{})}function uh(){return globalThis.performance?.now()??Date.now()}function f2(){if(typeof DOMException<"u")return new DOMException("Request aborted","AbortError");let e=new Error("Request aborted");return e.name="AbortError",e}var he,If,Af,p2=w(()=>{"use strict";Ef();he={logicalRanges:"Logical Range Requests",rangeBatches:"Range Request Batches",transportRanges:"Transport Ranges Created",completedTransportRanges:"Range Transport Requests Completed",coalescedRanges:"Coalesced Logical Ranges",requestedBytes:"Logical Range Request Bytes",transportBytes:"Range Transport Bytes Requested",responseBytes:"Range Response Bytes",networkTimeMs:"Range Network Time",overfetchBytes:"Range Overfetch Bytes",failedTransportRanges:"Range Transport Requests Failed",abortedLogicalRanges:"Aborted Logical Range Requests",fullResponseFallbacks:"Full Response Fallbacks"},If={batchDelayMs:50,maxGapBytes:65536,rangeExpansionBytes:65536,maxMergedBytes:8388608,maxConcurrency:6,maxQueueSize:4096,maxRangeBytes:64*1024*1024,maxTotalBytes:Number.MAX_SAFE_INTEGER,stats:d2("range-request-scheduler-default"),onEvent:()=>{}},Af=class{props;stats;onEvent;pendingRequests=[];transportQueue=[];activeTransports=0;reservedTransportBytes=0;queuedRequests=0;logicalRequests=new Set;transportControllers=new Set;finalized=!1;flushTimer=null;constructor(t={}){let r=t.rangeExpansionBytes??t.maxGapBytes??If.rangeExpansionBytes;this.props={batchDelayMs:t.batchDelayMs??If.batchDelayMs,maxGapBytes:t.maxGapBytes??r,rangeExpansionBytes:r,maxMergedBytes:t.maxMergedBytes??If.maxMergedBytes,maxConcurrency:t.maxConcurrency??6,maxQueueSize:t.maxQueueSize??4096,maxRangeBytes:t.maxRangeBytes??64*1024*1024,maxTotalBytes:t.maxTotalBytes??If.maxTotalBytes};for(let n of[this.props.maxConcurrency,this.props.maxQueueSize,this.props.maxRangeBytes,this.props.maxTotalBytes])if(!Number.isSafeInteger(n)||n<=0)throw new Error("Range scheduler limits must be positive integers");this.stats=t.stats||d2("range-request-scheduler"),this.onEvent=t.onEvent,m2(this.stats)}scheduleRequest(t){if(this.finalized)return Promise.reject(new Error("Range scheduler is finalized"));if(!Number.isSafeInteger(t.offset)||t.offset<0||!Number.isSafeInteger(t.length)||t.length>this.props.maxRangeBytes||!Number.isSafeInteger(t.offset+t.length))return Promise.reject(new Error("Invalid or oversized byte range"));if(this.queuedRequests>=this.props.maxQueueSize)return Promise.reject(new Error("Range scheduler queue limit exceeded"));if(t.length<0)return Promise.reject(new Error("Byte range length cannot be negative"));if(t.signal?.aborted)return Promise.reject(t.signal.reason??f2());if(t.length===0)return Promise.resolve(new ArrayBuffer(0));this.queuedRequests++;let r,n=new Promise((i,o)=>{r={...t,resolve:i,reject:o,settled:!1},this.logicalRequests.add(r),t.signal&&(r.abortListener=()=>{this.abortRequest(r),r.onAbort?.()},t.signal.addEventListener("abort",r.abortListener,{once:!0})),this.pendingRequests.push(r)});return this.trackEvent({type:"queued",sourceId:t.sourceId,offset:t.offset,length:t.length,logicalRequestCount:1,logicalBytes:t.length}),this.scheduleFlush(),n.finally(()=>{r.abortListener&&t.signal?.removeEventListener("abort",r.abortListener),this.queuedRequests--,this.logicalRequests.delete(r)})}fetch(t){let r=t.fetch||globalThis.fetch;return this.scheduleRequest({sourceId:t.sourceId||t.url,offset:t.offset,length:t.length,signal:t.signal,isolationKey:t.isolationKey??{},fetchRange:(n,i,o)=>iR({url:t.url,offset:n,length:i,signal:o,fetch:r,fetchOptions:t.fetchOptions})})}flush(){this.flushTimer!==null&&(clearTimeout(this.flushTimer),this.flushTimer=null);let t=this.pendingRequests;this.pendingRequests=[];let r=t.filter(i=>i.settled||i.signal?.aborted?(this.abortRequest(i),!1):!0),n=this.mergeRequests(r);r.length>0&&this.trackBatch(r,n),this.transportQueue.push(...n),this.startQueuedTransports()}finalize(){this.finalized=!0,this.flushTimer!==null&&clearTimeout(this.flushTimer),this.flushTimer=null;for(let t of this.logicalRequests)this.abortRequest(t),t.abortListener&&t.signal?.removeEventListener("abort",t.abortListener);for(let t of this.transportControllers)t.abort();this.transportQueue=[],this.pendingRequests=[],this.logicalRequests.clear()}startQueuedTransports(){for(;this.activeTransports<this.props.maxConcurrency&&this.transportQueue.length;){let t=this.transportQueue.shift();this.activeTransports++,this.fetchMergedRequest(t).finally(()=>{this.activeTransports--,this.startQueuedTransports()})}}scheduleFlush(){this.flushTimer===null&&(this.flushTimer=setTimeout(()=>this.flush(),this.props.batchDelayMs))}mergeRequests(t){t.sort((n,i)=>n.sourceId!==i.sourceId?n.sourceId<i.sourceId?-1:1:n.offset-i.offset);let r=[];for(let n of t){let i=n.offset+n.length,o=r[r.length-1];o&&oR(o,n,this.props)?(o.endOffset=Math.max(o.endOffset,i),o.requests.push(n)):r.push({sourceId:n.sourceId,isolationKey:n.isolationKey??n.sourceId,offset:n.offset,endOffset:i,fetchRange:n.fetchRange,requests:[n]})}return r}async fetchMergedRequest(t){let{offset:r,endOffset:n,fetchRange:i,requests:o}=t,s=new AbortController;this.transportControllers.add(s);let a=uh(),c=()=>{o.every(l=>l.settled||l.signal?.aborted)&&s.abort()};try{for(let g of o)g.onAbort=c;if(c(),o.every(g=>g.settled))return;let l=tg(o),h=n-r;if(h>this.props.maxTotalBytes-this.reservedTransportBytes)throw new RangeError("Range request total byte limit exceeded");this.reservedTransportBytes+=h,this.trackEvent({type:"request",sourceId:t.sourceId,offset:r,length:h,logicalRequestCount:o.length,logicalBytes:l,transportBytes:h,overfetchBytes:Math.max(h-l,0)});let u=sR(await i(r,h,s.signal)),{arrayBuffer:f}=u,d=u.fullResponse&&r===0&&f.byteLength<h,m=f.byteLength<h&&Number.isSafeInteger(u.sourceByteLength)&&r+f.byteLength===u.sourceByteLength;if(f.byteLength!==h&&!d&&!m)throw new Error(`Byte-range transport returned ${f.byteLength} bytes; expected ${h}`);let p=u.networkTimeMs??uh()-a;this.trackEvent({type:"response",sourceId:t.sourceId,offset:r,length:h,logicalRequestCount:o.length,logicalBytes:l,transportBytes:h,responseBytes:u.transportBytes??f.byteLength,networkTimeMs:p,overfetchBytes:Math.max(h-l,0),status:u.status,fullResponse:u.fullResponse});for(let g of o){if(g.settled)continue;let y=g.offset-r;g.settled=!0,g.resolve(f.slice(y,y+g.length))}}catch(l){s.signal.aborted||this.trackEvent({type:"error",sourceId:t.sourceId,offset:r,length:n-r,logicalRequestCount:o.length,logicalBytes:tg(o),networkTimeMs:uh()-a,error:l});for(let h of o)h.settled||(h.signal?.aborted?this.abortRequest(h):(h.settled=!0,h.reject(l)))}finally{this.transportControllers.delete(s);for(let l of o)l.abortListener&&l.signal?.removeEventListener("abort",l.abortListener),l.onAbort=void 0}}abortRequest(t){if(!t.settled){t.settled=!0,this.pendingRequests=this.pendingRequests.filter(r=>r!==t);for(let r of this.transportQueue)r.requests=r.requests.filter(n=>!n.settled),r.requests.length&&(r.offset=Math.min(...r.requests.map(n=>n.offset)),r.endOffset=Math.max(...r.requests.map(n=>n.offset+n.length)));this.transportQueue=this.transportQueue.filter(r=>r.requests.length>0),t.reject(t.signal?.reason??f2()),this.trackEvent({type:"abort",sourceId:t.sourceId,offset:t.offset,length:t.length,logicalRequestCount:1,logicalBytes:t.length})}}trackEvent(t){nR(this.stats,t);try{this.onEvent?.(t)}catch{}}trackBatch(t,r){let n=tg(t),i=r.reduce((o,s)=>o+s.endOffset-s.offset,0);this.trackEvent({type:"batch",logicalRequestCount:t.length,transportRequestCount:r.length,logicalBytes:n,transportBytes:i,overfetchBytes:Math.max(i-n,0)})}}});function y2(e){for(let t in g2)if(e.startsWith(t)){let r=g2[t];e=e.replace(t,r)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${fR}${e}`),e}var fR,g2,w2=w(()=>{"use strict";fR="",g2={}});function _2(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=globalThis.location?.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}var M2=w(()=>{"use strict"});var gn={};Zr(gn,{dirname:()=>mR,filename:()=>dR,join:()=>pR,resolve:()=>gR});function dR(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):e}function mR(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function pR(...e){return e=e.map((r,n)=>(n&&(r=r.replace(new RegExp("^/"),"")),n!==e.length-1&&(r=r.replace(new RegExp("/$"),"")),r)),e.join("/")}function gR(...e){let t=[];for(let o=0;o<e.length;o++)t[o]=e[o];let r="",n=!1,i;for(let o=t.length-1;o>=-1&&!n;o--){let s;o>=0?s=t[o]:(i===void 0&&(i=_2()),s=i),s.length!==0&&(r=`${s}/${r}`,n=s.charCodeAt(0)===fh)}return r=yR(r,!n),n?`/${r}`:r.length>0?r:"."}function yR(e,t){let r="",n=-1,i=0,o,s=!1;for(let a=0;a<=e.length;++a){if(a<e.length)o=e.charCodeAt(a);else{if(o===fh)break;o=fh}if(o===fh){if(!(n===a-1||i===1))if(n!==a-1&&i===2){if(r.length<2||!s||r.charCodeAt(r.length-1)!==eg||r.charCodeAt(r.length-2)!==eg){if(r.length>2){let c=r.length-1,l=c;for(;l>=0&&r.charCodeAt(l)!==fh;--l);if(l!==c){r=l===-1?"":r.slice(0,l),n=a,i=0,s=!1;continue}}else if(r.length===2||r.length===1){r="",n=a,i=0,s=!1;continue}}t&&(r.length>0?r+="/..":r="..",s=!0)}else{let c=e.slice(n+1,a);r.length>0?r+=`/${c}`:r=c,s=!1}n=a,i=0}else o===eg&&i!==-1?++i:i=-1}return r}var fh,eg,b2=w(()=>{"use strict";M2();fh=47,eg=46});var Ic,x2=w(()=>{"use strict";Ic=class{handle;size;bigsize;url;constructor(t){this.handle=t instanceof ArrayBuffer?new Blob([t]):t,this.size=t instanceof ArrayBuffer?t.byteLength:t.size,this.bigsize=BigInt(this.size),this.url=t instanceof File?t.name:""}async close(){}async stat(){return{size:this.handle.size,bigsize:BigInt(this.handle.size),isDirectory:!1}}async read(t,r,n){if(n?.aborted)throw new Error("Request aborted");let i=await this.handle.slice(Number(t),Number(t)+Number(r)).arrayBuffer();if(n?.aborted)throw new Error("Request aborted");return i}}});function S2(e,t){return t?t.aborted?(e.catch(()=>{}),Promise.reject(t.reason)):new Promise((r,n)=>{let i=()=>{t.removeEventListener("abort",i),n(t.reason)};t.addEventListener("abort",i,{once:!0}),e.then(o=>{t.removeEventListener("abort",i),r(o)},o=>{t.removeEventListener("abort",i),n(o)})}):e}var v2=w(()=>{"use strict"});function wR(e,t,r,n){let i=new Headers(e?.headers);return i.set("Range",`bytes=${t}-${t+r-1}`),{...e,method:"GET",body:void 0,headers:i,signal:n}}function _R(e,t,r,n){return e.status===416&&n===null&&t===0&&r===1&&/^bytes \*\/0$/i.test(e.headers.get("Content-Range")||"")}async function MR(e){try{return bR(e.headers.get("Content-Range"))}catch(t){throw await Ac(e),t}}function bR(e){let t=e?.match(/^bytes (\d+)-(\d+)\/(\d+)$/);if(!t)throw new Error("HTTP byte-range response has an invalid Content-Range header");return{offset:Number(t[1]),endOffset:Number(t[2]),byteLength:Number(t[3])}}function Pf(e,t){return Nf(t,Bf(e.headers.get("ETag")),Bf(e.headers.get("Last-Modified")))}function E2(e,t,r){return e||Nf(t.byteLength,t.etag??r.etag,t.lastModified??r.lastModified)}function xR(e,t,r){return!Number.isSafeInteger(e.offset)||!Number.isSafeInteger(e.endOffset)||!Number.isSafeInteger(e.byteLength)||e.offset<0||e.endOffset<e.offset||e.endOffset>=e.byteLength?"HTTP byte-range response has invalid range bounds":e.offset!==t||e.endOffset!==t+r-1?"HTTP byte-range response does not match the requested range":null}function rg(e,t,r,n){let i=e?.byteLength??r.byteLength;if(i!==void 0&&t.byteLength!==i)return"HTTP file length changed while the file was open";let o=e?.etag??r.etag,s=e?.lastModified??r.lastModified;return o?t.etag?o===t.etag?null:"HTTP file ETag changed while the file was open":n==="strict"?"HTTP byte-range response is missing the pinned ETag":s&&t.lastModified&&s!==t.lastModified?"HTTP file Last-Modified value changed while the file was open":null:s?t.lastModified&&s!==t.lastModified?"HTTP file Last-Modified value changed while the file was open":n==="strict"&&!t.lastModified?"HTTP byte-range response is missing the pinned Last-Modified value":null:n==="strict"&&!t.etag&&!t.lastModified?"HTTP byte-range response does not provide an ETag or Last-Modified validator":null}function Nf(e,t,r){return Object.freeze({byteLength:e,etag:t,lastModified:r})}function SR(e){if(e!==void 0&&(!Number.isSafeInteger(e)||e<0))throw new Error("HttpFile byteLength must be a non-negative safe integer")}async function Ac(e){await e.body?.cancel().catch(()=>{})}function Bf(e){return e||void 0}function Rf(){return globalThis.performance?.now()??Date.now()}function T2(e){return e instanceof Error&&e.name==="AbortError"||e instanceof Error&&/aborted/i.test(e.message)}function vR(...e){let t=new AbortController,r=[...new Set(e.filter(i=>!!i))],n=()=>t.abort();for(let i of r)i.aborted?t.abort():i.addEventListener("abort",n,{once:!0});return{signal:t.signal,removeAbortListeners:()=>{for(let i of r)i.removeEventListener("abort",n)}}}var Cf,I2=w(()=>{"use strict";Cf=class{url;fetchFunction;fetchOptions;consistency;identityHints;countedFailures=new WeakSet;onTelemetry;telemetry={requestedBytes:0,downloadedBytes:0,requestCount:0,networkTimeMs:0,abortCount:0,errorCount:0};constructor(t,r){SR(r.byteLength),this.url=t,this.onTelemetry=r.onTelemetry,this.fetchFunction=r.fetch||((n,i)=>globalThis.fetch(n,i)),this.fetchOptions=r.fetchOptions?{...r.fetchOptions,headers:new Headers(r.fetchOptions.headers)}:void 0,this.consistency=r.consistency||"best-effort",this.identityHints={byteLength:r.byteLength,etag:Bf(r.etag),lastModified:Bf(r.lastModified)}}getInitialIdentity(){let{byteLength:t,etag:r,lastModified:n}=this.identityHints;return t!==void 0&&(r!==void 0||n!==void 0)?Nf(t,r,n):t===0&&this.consistency==="best-effort"?Nf(0):null}getTelemetry(){return Object.freeze({...this.telemetry})}trackFailure(t){if(typeof t=="object"&&t!==null){if(this.countedFailures.has(t))return;this.countedFailures.add(t)}T2(t)?this.telemetry.abortCount++:this.telemetry.errorCount++,this.onTelemetry?.(this.getTelemetry(),t)}async requestRange(t,r,n,i){let o=Rf(),s=vR(n,this.fetchOptions?.signal);this.telemetry.requestCount++,this.telemetry.requestedBytes+=r;try{let a=await this.fetchFunction(this.url,wR(this.fetchOptions,t,r,s.signal));if(_R(a,t,r,i))return await this.readEmptyIdentityProbe(a,o);if(a.status!==206)throw await Ac(a),new Error(`HTTP byte-range request expected 206, received ${a.status}`);let c=a.headers.has("Content-Range")?await MR(a):await this.inferContentRange(a,t,r,i,s.signal),l=Pf(a,c.byteLength),h=rg(i,l,this.identityHints,this.consistency)||xR(c,t,r);if(h)throw await Ac(a),new Error(h);let u=await a.arrayBuffer();if(this.telemetry.downloadedBytes+=u.byteLength,u.byteLength!==r)throw new Error(`HTTP byte-range response contained ${u.byteLength} bytes; expected ${r}`);return{arrayBuffer:u,identity:E2(i,l,this.identityHints),status:a.status,transportBytes:u.byteLength,networkTimeMs:Rf()-o}}catch(a){throw(i===null||!T2(a))&&this.trackFailure(a),a}finally{s.removeAbortListeners(),this.telemetry.networkTimeMs+=Rf()-o,this.onTelemetry?.(this.getTelemetry())}}async inferContentRange(t,r,n,i,o){try{let s=i?.byteLength??this.identityHints.byteLength;if(s===void 0){let a=new Headers(this.fetchOptions?.headers);a.delete("Range"),this.telemetry.requestCount++;let c=await this.fetchFunction(this.url,{...this.fetchOptions,method:"HEAD",body:void 0,headers:a,signal:o});await Ac(c);let l=c.headers.get("Content-Length");if(s=l&&/^\d+$/.test(l)?Number(l):NaN,c.status!==200||!Number.isSafeInteger(s)||s<r+n)throw new Error("HTTP byte-range response is missing Content-Range and HEAD did not provide a valid file length");let h=rg(Pf(c,s),Pf(t,s),this.identityHints,this.consistency);if(h)throw new Error(h)}return{offset:r,endOffset:r+n-1,byteLength:s}}catch(s){throw await Ac(t),s}}async readEmptyIdentityProbe(t,r){let n=Pf(t,0),i=rg(null,n,this.identityHints,this.consistency);if(await Ac(t),i)throw new Error(i);return{arrayBuffer:new ArrayBuffer(0),identity:E2(null,n,this.identityHints),status:t.status,transportBytes:0,networkTimeMs:Rf()-r}}}});function ER(e,t,r){let n=new Headers;return r>0&&e&&n.set("Content-Range",`bytes ${t}-${t+r-1}/${e.byteLength}`),e?.etag&&n.set("ETag",e.etag),e?.lastModified&&n.set("Last-Modified",e.lastModified),n}function A2(e){let t=Number(e);if(!Number.isSafeInteger(t)||t<0)throw new Error("HTTP byte-range offset must be a non-negative safe integer");return t}function TR(e,t,r){if(!Number.isSafeInteger(t)||t<0)throw new Error("HTTP byte-range length must be a non-negative safe integer");if(e+t>r)throw new Error("HTTP byte range extends beyond the end of the file")}function P2(){if(typeof DOMException<"u")return new DOMException("Request aborted","AbortError");let e=new Error("Request aborted");return e.name="AbortError",e}var dh,R2=w(()=>{"use strict";v2();p2();I2();dh=class e{handle;url;transport;rangeScheduler;schedulerIsolationKey={};suppliedByteLength;identity;openPromise=null;closed=!1;constructor(t,r={}){this.handle=t,this.url=t,this.transport=new Cf(t,r),this.rangeScheduler=r.rangeScheduler||new Af({batchDelayMs:0,...r.rangeSchedulerProps}),this.suppliedByteLength=r.byteLength,this.identity=this.transport.getInitialIdentity()}static async open(t,r={},n){let i=new e(t,r);return await i.open(n),i}async open(t){if(this.assertOpen(),t?.aborted){let r=P2();throw this.transport.trackFailure(r),r}return await this.getIdentity(t),this}get size(){return this.identity?.byteLength??this.suppliedByteLength??0}get bigsize(){return BigInt(this.size)}getIdentitySnapshot(){return this.identity}getTelemetry(){return this.transport.getTelemetry()}async close(){this.closed=!0}async stat(){this.assertOpen();let t=await this.getIdentity();return{size:t.byteLength,bigsize:BigInt(t.byteLength),isDirectory:!1}}async read(t=0,r=0,n){if(this.assertOpen(),n?.aborted){let s=P2();throw this.transport.trackFailure(s),s}let i=await this.getIdentity(n),o=A2(t);if(TR(o,r,i.byteLength),r===0)return new ArrayBuffer(0);try{return await this.rangeScheduler.scheduleRequest({sourceId:this.url,isolationKey:this.schedulerIsolationKey,offset:o,length:r,signal:n,fetchRange:this.fetchScheduledRange})}catch(s){throw this.transport.trackFailure(s),s}}async fetchRange(t,r,n){let i=A2(t),o=await this.read(i,r,n),s=ER(this.identity,i,r);return new Response(o,{status:206,headers:s})}fetchScheduledRange=async(t,r,n)=>{let i=await this.getIdentity(n),o=await this.transport.requestRange(t,r,n,i);return{arrayBuffer:o.arrayBuffer,status:o.status,transportBytes:o.transportBytes,networkTimeMs:o.networkTimeMs}};getIdentity(t){if(this.identity)return Promise.resolve(this.identity);if(!this.openPromise){let n=this.probeIdentity().catch(i=>{throw this.openPromise===n&&(this.openPromise=null),i});this.openPromise=n}return S2(this.openPromise,t).catch(r=>{throw this.transport.trackFailure(r),r})}async probeIdentity(){try{let t=await this.transport.requestRange(0,1,void 0,null);return this.identity=t.identity,t.identity}catch(t){throw this.transport.trackFailure(t),t}}assertOpen(){if(this.closed)throw new Error("HttpFile is closed")}}});function C2(e){return a2(e)}function N2(e){if(e.loadOptions!==void 0||e.core?.loadOptions!==void 0)throw new Error("Source loadOptions and core.loadOptions were removed. Use core and root loader namespaces directly.");let t={...e};if(e?.core){t.core={...e.core};let r=t.core;for(let n of["type","name","attributions","loaders","onError","loadOptions"])delete r[n];Object.keys(r).length===0&&delete t.core}return t}function AR(e,t){return e instanceof Error?e:typeof e=="string"?new Error(e):new Error(t)}function da(e){return()=>{throw new Error(`CoreAPI.${e} is unavailable. Use @loaders.gl/core.createDataSourceSync().`)}}function PR(e,t){let r=t.core?.name;if(r!==void 0){if(typeof r!="string"||!r.trim())throw new Error("Data source name must be a non-empty string.");return r}if(e&&typeof e=="object"){let n=e;if(typeof n.name=="string"&&n.name.trim())return e instanceof Blob?B2(n.name):n.name;let i=n.schema?.metadata,o=i instanceof Map?i.get("name"):i?.name;if(typeof o=="string"&&o.trim())return o}if(typeof e=="string")try{let n=new URL(e.replace(/\\/g,"/"),"https://source.invalid/");if(!["data:","blob:"].includes(n.protocol)){let i=n.pathname.split("/").filter(Boolean).pop();if(i){try{i=decodeURIComponent(i)}catch{}return B2(i)}}}catch{}return t.core?.type&&t.core.type!=="auto"?t.core.type:"source"}function B2(e){let t=e.lastIndexOf(".");return t>0?e.slice(0,t):e}var IR,mh,O2=w(()=>{"use strict";XM();w2();W0();h2();Z0();IR={fetchFile:da("fetchFile"),parse:da("parse"),parseFile:da("parseFile"),parseSync:da("parseSync"),parseInBatches:da("parseInBatches"),load:da("load"),loadInBatches:da("loadInBatches")},mh=class e{static defaultOptions={core:{type:"auto",attributions:[],loaders:[],onError:void 0}};optionsType;options;data;url;name;loadOptions;fetch;coreApi;hasCoreApi;_needsRefresh=!0;constructor(t,r,n,i){this.options=Sf(Sf(e.defaultOptions,n||{}),r),this.data=t,this.url=typeof t=="string"?y2(t):"",this.name=PR(t,this.options);let o=X0(N2(this.options));this.loadOptions=o;let s=C2(o);this.coreApi=i||IR,this.hasCoreApi=!!i,this.fetch=s}setProps(t){if(t.core?.name!==void 0&&t.core.name!==this.name)throw new Error("Data source names are fixed at creation.");let r=Sf(this.options,t),n=X0(N2(r));this.options=r,this.loadOptions=n,this.fetch=C2(n),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let r=this._needsRefresh;return t&&(this._needsRefresh=!1),r}reportError(t,r){let n=AR(t,r),i=this.options.core?.onError;return i?i(n,this):j0(this.options).warn(`${this.constructor.name}: ${n.message}`)(),n}}});function Of(e={}){if(e.coordinateEpoch!==void 0&&!Number.isFinite(e.coordinateEpoch))throw new Error("Spatial reference coordinate epoch must be a finite decimal year");return Object.freeze({crs:L2(e.crs||{state:"absent",provenance:"unknown"}),vertical:e.vertical?L2(e.vertical):void 0,coordinateEpoch:e.coordinateEpoch,coordinateFrame:e.coordinateFrame||"unknown",coordinateOrder:Object.freeze([...e.coordinateOrder||[]]),units:e.units?Object.freeze([...e.units]):void 0})}function tr(e){if(typeof e=="object")return"projjson";let t=e.trim();return/^[A-Z][A-Z0-9_]*\s*[\[(]/i.test(t)?"wkt":/(?:^|\s)\+?proj=/i.test(t)?"proj-string":/^[A-Z][A-Z0-9._-]*(?::[A-Z0-9._-]+)+$/i.test(t)||/^urn:ogc:def:crs:/i.test(t)||/^https?:\/\//i.test(t)||/^[A-Z][A-Z0-9._-]*$/i.test(t)?"identifier":"opaque"}function L2(e){return e.state==="explicit"||e.state==="default"?Object.freeze({...e,definition:D2(e.definition),alternatives:e.alternatives?Object.freeze(e.alternatives.map(t=>Object.freeze({...t,definition:D2(t.definition)}))):void 0}):Object.freeze({...e})}function D2(e){return typeof e=="string"?e:ng(e)}function ng(e){return Array.isArray(e)?Object.freeze(e.map(t=>ng(t))):e&&typeof e=="object"?Object.freeze(Object.fromEntries(Object.entries(e).map(([t,r])=>[t,ng(r)]))):e}var Pc=w(()=>{});function gh(e,t){let n={type:"wkt-crs",root:new ig(e).parse()};if(t?.strict){let i=z2(n,{profile:t.profile,allowExtensions:!1});if(i.length>0)throw new Df(i)}return n}function z2(e,t){if(!e||e.type!=="wkt-crs"||e.root?.type!=="node")throw new TypeError("validateWKTCRS expects a WKTCRSAst");let r=zR(e.root.keyword,t?.profile||"auto"),n=UR[r],i=GR[r],o=[],s=e.root.keyword.toUpperCase();return n.has(s)||o.push({code:"invalid-root",message:`${e.root.keyword} is not a ${r} root keyword`,path:[],keyword:e.root.keyword}),V2(e.root,[],a=>{let c=a.node.keyword.toUpperCase();!t?.allowExtensions&&!i.has(c)&&o.push({code:"unknown-keyword",message:`${a.node.keyword} is not defined by the ${r} profile`,path:a.path,keyword:a.node.keyword}),a.node.values.length===0&&o.push({code:"empty-node",message:`${a.node.keyword} must contain at least one value`,path:a.path,keyword:a.node.keyword});let l=VR(a.node);l&&o.push({code:"invalid-value",message:l,path:a.path,keyword:a.node.keyword})}),o}function zR(e,t){return t!=="auto"?t:ph.has(e.toUpperCase())?"wkt1":"wkt2:2019"}function VR(e){let t=e.keyword.toUpperCase(),r=e.values,n=(o,...s)=>!!(r[o]&&s.includes(r[o].type)),i=(o,...s)=>r.length===o&&s.every((a,c)=>n(c,a));if(["ANGLEUNIT","LENGTHUNIT","PARAMETRICUNIT","SCALEUNIT","TIMEUNIT","TEMPORALQUANTITY","UNIT"].includes(t)&&!(r.length>=2&&n(0,"string")&&n(1,"number")))return`${e.keyword} must start with a quoted name and numeric conversion factor`;if(t==="CS"&&!i(2,"enumeration","number"))return`${e.keyword} must contain a coordinate-system type and dimension`;if(t==="BBOX"&&!i(4,"number","number","number","number"))return`${e.keyword} must contain four numeric bounds`;if(["ENSEMBLEACCURACY","EPOCH","COORDEPOCH","FRAMEEPOCH","OPERATIONACCURACY","ORDER"].includes(t)&&!i(1,"number"))return`${e.keyword} must contain one number`;if(["ANCHOR","AREA","CALENDAR","CITATION","REMARK","SCOPE","URI","VERSION"].includes(t)&&!i(1,"string"))return`${e.keyword} must contain one quoted string`;if(["ELLIPSOID","SPHEROID","TRIAXIAL"].includes(t)&&!(r.length>=3&&n(0,"string")&&n(1,"number")&&n(2,"number")))return`${e.keyword} must start with a quoted name and numeric ellipsoid axes`;if(["PARAMETER"].includes(t)&&!(r.length>=2&&n(0,"string")&&n(1,"number")))return`${e.keyword} must start with a quoted name and numeric value`;if(t==="PARAMETERFILE"&&!i(2,"string","string"))return`${e.keyword} must contain a quoted name and file name`;if(["AUTHORITY","ID"].includes(t)&&!(r.length>=2&&n(0,"string")&&n(1,"string","number")))return`${e.keyword} must start with a quoted authority and identifier`;if(["AXIS"].includes(t)&&!(r.length>=2&&n(0,"string")&&n(1,"enumeration")))return`${e.keyword} must start with a quoted name and axis direction`;if(["METHOD","PROJECTION"].includes(t)&&!(r.length>=1&&n(0,"string")))return`${e.keyword} must start with a quoted name`;if(t==="TIMEEXTENT"){let o=s=>n(s,"enumeration","string");if(r.length!==2||!o(0)||!o(1))return`${e.keyword} must contain two date-time or quoted values`}if(t==="VERTICALEXTENT"&&(r.length<2||r.length>3||!n(0,"number")||!n(1,"number")||r.length===3&&!n(2,"node")))return`${e.keyword} must contain two numeric bounds and an optional unit`;if(t==="COORDINATEMETADATA"&&(r.length<1||r.length>2||!n(0,"node")||r.length===2&&(!n(1,"node")||!["EPOCH","COORDEPOCH"].includes(r[1].keyword.toUpperCase()))))return`${e.keyword} must contain a CRS and an optional coordinate epoch`;if(t==="BOUNDCRS"){let o=r.slice(0,3).map(s=>s.type==="node"?s.keyword.toUpperCase():"");if(o[0]!=="SOURCECRS"||o[1]!=="TARGETCRS"||o[2]!=="ABRIDGEDTRANSFORMATION")return`${e.keyword} must start with SOURCECRS, TARGETCRS, and ABRIDGEDTRANSFORMATION`}return["COMPOUNDCRS","CONCATENATEDOPERATION","COORDINATEOPERATION","DERIVEDPROJCRS","ENGCRS","ENGINEERINGCRS","GEODCRS","GEODETICCRS","GEOGCRS","GEOGRAPHICCRS","PARAMETRICCRS","POINTMOTIONOPERATION","PROJCRS","PROJECTEDCRS","TIMECRS","VERTCRS","VERTICALCRS"].includes(t)&&!n(0,"string")?`${e.keyword} must start with a quoted name`:null}function V2(e,t,r){r({node:e,path:t});for(let n=0;n<e.values.length;n++){let i=e.values[n];i.type==="node"&&V2(i,[...t,n],r)}}function kR(e,t){let r=1,n=1;for(let i=0;i<t&&i<e.length;i++)e[i]===`
8
+ `?(r++,n=1):n++;return{line:r,column:n}}var Lf,Df,RR,CR,ph,og,NR,BR,OR,LR,F2,U2,G2,DR,FR,UR,GR,ig,sg=w(()=>{Lf=class extends SyntaxError{constructor(t,r,n){let i=kR(r,n);super(`${t} at ${i.line}:${i.column}`),this.name="WKTCRSSyntaxError",this.offset=n,this.line=i.line,this.column=i.column}},Df=class extends Error{constructor(t){super(t[0]?.message||"WKT validation failed"),this.name="WKTCRSValidationError",this.issues=t}},RR=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[Ee][+-]?\d+)?$/,CR=/^[A-Za-z][A-Za-z0-9_]*/,ph=new Set(["COMPD_CS","CONCAT_MT","FITTED_CS","GEOCCS","GEOGCS","INVERSE_MT","LOCAL_CS","PARAM_MT","PASSTHROUGH_MT","PROJCS","VERT_CS"]),og=new Set([...ph,"AUTHORITY","AXIS","CONCAT_MT","DATUM","INVERSE_MT","LOCAL_DATUM","PARAMETER","PARAM_MT","PASSTHROUGH_MT","PRIMEM","PROJECTION","SPHEROID","TOWGS84","UNIT","VERT_DATUM"]),NR=new Set(ph),BR=new Set([...og,"EXTENSION"]),OR=new Set([...ph,"COMPDCS","LOCALCS","VERTCS"]),LR=new Set([...og,"COMPDCS","LOCALCS","VDATUM","VERTCS"]),F2=new Set(["BOUNDCRS","COMPOUNDCRS","COORDINATEOPERATION","ENGCRS","ENGINEERINGCRS","GEODCRS","GEODETICCRS","PARAMETRICCRS","PROJCRS","PROJECTEDCRS","TIMECRS","VERTCRS","VERTICALCRS"]),U2=new Set([...F2,"CONCATENATEDOPERATION","COORDINATEMETADATA","DERIVEDPROJCRS","GEOGCRS","GEOGRAPHICCRS","POINTMOTIONOPERATION"]),G2=new Set([...U2,"ABRIDGEDTRANSFORMATION","ANCHOR","ANGLEUNIT","AREA","AXIS","BASEENGCRS","BASEGEODCRS","BASEGEOGCRS","BASEPARAMCRS","BASEPROJCRS","BASETIMECRS","BASEVERTCRS","BBOX","BEARING","CALENDAR","CITATION","CONVERSION","COORDEPOCH","CS","DATUM","DERIVINGCONVERSION","DYNAMIC","EDATUM","ELLIPSOID","ENGINEERINGDATUM","ENSEMBLE","ENSEMBLEACCURACY","EPOCH","FRAMEEPOCH","GEODETICDATUM","GEOIDMODEL","ID","INTERPOLATIONCRS","LENGTHUNIT","MEMBER","MERIDIAN","METHOD","MODEL","OPERATIONACCURACY","ORDER","PARAMETER","PARAMETERFILE","PARAMETRICDATUM","PARAMETRICUNIT","PDATUM","PRIMEM","PRIMEMERIDIAN","REMARK","SCALEUNIT","SCOPE","SOURCECRS","STEP","TARGETCRS","TDATUM","TEMPORALQUANTITY","TIMEEXTENT","TIMEORIGIN","TIMEUNIT","TIMEDATUM","TRIAXIAL","TRF","URI","USAGE","VDATUM","VERSION","VERTICALDATUM","VERTICALEXTENT","VELOCITYGRID","VRF"]),DR=new Set(["BASEGEOGCRS","CALENDAR","CONCATENATEDOPERATION","COORDEPOCH","COORDINATEMETADATA","DERIVEDPROJCRS","DYNAMIC","ENSEMBLE","ENSEMBLEACCURACY","EPOCH","FRAMEEPOCH","GEOGCRS","GEOGRAPHICCRS","GEOIDMODEL","MEMBER","MODEL","POINTMOTIONOPERATION","STEP","TEMPORALQUANTITY","TRF","TRIAXIAL","VELOCITYGRID","VRF"]),FR=new Set([...G2].filter(e=>!DR.has(e))),UR={wkt1:ph,gdal:NR,esri:OR,"wkt2:2015":F2,"wkt2:2019":U2},GR={wkt1:og,gdal:BR,esri:LR,"wkt2:2015":FR,"wkt2:2019":G2};ig=class{constructor(t){this.offset=0,this.source=t}parse(){this.skipWhitespace();let t=this.parseNode();return this.skipWhitespace(),this.offset!==this.source.length&&this.fail("Unexpected content after WKT root"),t}parseNode(){let t=this.parseKeyword();return this.parseNodeAfterKeyword(t)}parseNodeAfterKeyword(t){this.skipWhitespace();let r=this.source[this.offset];r!=="["&&r!=="("&&this.fail(`Expected '[' or '(' after ${t}`),this.offset++;let n=r==="["?"bracket":"parenthesis",i=r==="["?"]":")",o=[];if(this.skipWhitespace(),this.source[this.offset]===i)return this.offset++,{type:"node",keyword:t,delimiter:n,values:o};for(;this.offset<this.source.length;){o.push(this.parseValue()),this.skipWhitespace();let s=this.source[this.offset];if(s===","){this.offset++,this.skipWhitespace(),this.source[this.offset]===i&&this.fail("Expected a WKT value after comma");continue}if(s===i)return this.offset++,{type:"node",keyword:t,delimiter:n,values:o};(s==="]"||s===")")&&this.fail(`Expected '${i}' to close ${t}`),this.fail(`Expected ',' or '${i}' in ${t}`)}this.fail(`Unterminated ${t} node`)}parseValue(){if(this.skipWhitespace(),this.source[this.offset]==='"')return this.parseString();let r=this.offset;for(;this.offset<this.source.length&&!/[\s,\[\]()"]/.test(this.source[this.offset]);)this.offset++;r===this.offset&&this.fail("Expected a WKT value");let n=this.source.slice(r,this.offset);return this.source[this.offset]==='"'&&this.fail("Unexpected quote in unquoted WKT value"),this.skipWhitespace(),this.source[this.offset]==="["||this.source[this.offset]==="("?(/^[A-Za-z][A-Za-z0-9_]*$/.test(n)||this.fail(`Invalid WKT keyword '${n}'`),this.parseNodeAfterKeyword(n)):RR.test(n)?{type:"number",value:Number(n),raw:n}:{type:"enumeration",value:n}}parseKeyword(){let t=this.source.slice(this.offset).match(CR);return t||this.fail("Expected a WKT keyword"),this.offset+=t[0].length,t[0]}parseString(){this.offset++;let t="";for(;this.offset<this.source.length;){let r=this.source[this.offset++];if(r==='"'){if(this.source[this.offset]==='"'){t+='"',this.offset++;continue}return{type:"string",value:t}}t+=r}this.fail("Unterminated WKT string")}skipWhitespace(){for(;this.offset<this.source.length&&/\s/.test(this.source[this.offset]);)this.offset++}fail(t){throw new Lf(t,this.source,this.offset)}}});function yh(e){let t=WR(e);if(t.length===0)throw new Qi("PROJ string is empty",e,0);return{type:"proj-string",parameters:t.map(n=>jR(n.raw,n.offset,e))}}function jR(e,t,r){let n=e.startsWith("+")?e.slice(1):e;if(!n)throw new Qi("Expected a parameter after '+'",r,t);let i=n.indexOf("="),o=i<0?n:n.slice(0,i);if(!o||/[\s+=]/.test(o))throw new Qi(`Invalid PROJ parameter name '${o}'`,r,t);if(i<0)return{type:"parameter",name:o};let s=n.slice(i+1),a=HR(s,r,t+i+1);return{type:"parameter",name:o,value:a,rawValue:s}}function WR(e){let t=[],r=0;for(;r<e.length;){for(;r<e.length&&/\s/.test(e[r]);)r++;if(r>=e.length)break;let n=r,i=null,o=!1;for(;r<e.length;){let s=e[r];if(o){o=!1,r++;continue}if(s==="\\"&&i){o=!0,r++;continue}if(i){s===i&&(i=null),r++;continue}if((s==='"'||s==="'")&&e[r-1]==="="){i=s,r++;continue}if(/\s/.test(s))break;r++}if(i)throw new Qi("Unterminated quoted PROJ value",e,n);t.push({raw:e.slice(n,r),offset:n})}return t}function HR(e,t,r){if(!e)return"";let n=e[0];if(n!=='"'&&n!=="'"){if((e.includes('"')||e.includes("'"))&&!qR.test(e))throw new Qi("Quote must begin a PROJ parameter value",t,r);return e}if(e[e.length-1]!==n)throw new Qi("Unterminated quoted PROJ value",t,r);let i="";for(let o=1;o<e.length-1;o++){let s=e[o];s==="\\"&&o+1<e.length-1?i+=e[++o]:i+=s}return i}function $R(e,t){let r=1,n=1;for(let i=0;i<t&&i<e.length;i++)e[i]===`
9
+ `?(r++,n=1):n++;return{line:r,column:n}}var Qi,qR,ag=w(()=>{Qi=class extends SyntaxError{constructor(t,r,n){let i=$R(r,n);super(`${t} at ${i.line}:${i.column}`),this.name="PROJStringSyntaxError",this.offset=n,this.line=i.line,this.column=i.column}};qR=/^[+-]?\d+(?:\.\d*)?d(?:\d+(?:\.\d*)?'(?:\d+(?:\.\d*)?")?)?[NSEW]?$/i});var wh,k2=w(()=>{wh={m:{name:"meters",metersPerUnit:1},mm:{name:"millimeters",metersPerUnit:.001},cm:{name:"centimeters",metersPerUnit:.01},ft:{name:"feet",metersPerUnit:.3048},"us-ft":{name:"us-survey-feet",metersPerUnit:.3048006096012192},fath:{name:"fathoms",metersPerUnit:1.8288},kmi:{name:"nautical-miles",metersPerUnit:1852},"us-ch":{name:"us-survey-chains",metersPerUnit:20.1168402336805},"us-mi":{name:"us-survey-miles",metersPerUnit:1609.34721869444},km:{name:"kilometers",metersPerUnit:1e3},"ind-ft":{name:"indian-feet",metersPerUnit:.30479841},"ind-yd":{name:"indian-yards",metersPerUnit:.91439523},mi:{name:"miles",metersPerUnit:1609.344},yd:{name:"yards",metersPerUnit:.9144},ch:{name:"chains",metersPerUnit:20.1168},link:{name:"links",metersPerUnit:.201168},dm:{name:"decimeters",metersPerUnit:.1},in:{name:"inches",metersPerUnit:.0254},"ind-ch":{name:"indian-chains",metersPerUnit:20.11669506},"us-in":{name:"us-survey-inches",metersPerUnit:.025400050800101},"us-yd":{name:"us-survey-yards",metersPerUnit:.914401828803658}}});function q2(e){return JSON.stringify([e.coordinateFrame,e.projection,Object.keys(e.parameters).sort().map(t=>[t,e.parameters[t]]),[e.ellipsoid.semiMajorAxis,e.ellipsoid.semiMinorAxis],e.axis,[e.xUnit.name,e.xUnit.metersPerUnit,e.xUnit.degreesPerUnit],[e.yUnit.name,e.yUnit.metersPerUnit,e.yUnit.degreesPerUnit],[e.zUnit.name,e.zUnit.metersPerUnit,e.zUnit.degreesPerUnit],e.lossy,e.areaOfUse])}var cg=w(()=>{k2()});var lg=w(()=>{Pc();sg();ag()});var we={};Zr(we,{EPSILON1:()=>YR,EPSILON10:()=>nC,EPSILON11:()=>iC,EPSILON12:()=>oC,EPSILON13:()=>sC,EPSILON14:()=>Ff,EPSILON15:()=>aC,EPSILON16:()=>cC,EPSILON17:()=>lC,EPSILON18:()=>hC,EPSILON19:()=>uC,EPSILON2:()=>KR,EPSILON20:()=>fC,EPSILON3:()=>XR,EPSILON4:()=>ZR,EPSILON5:()=>JR,EPSILON6:()=>QR,EPSILON7:()=>tC,EPSILON8:()=>eC,EPSILON9:()=>rC,PI:()=>Rc,PI_OVER_FOUR:()=>mC,PI_OVER_SIX:()=>pC,PI_OVER_TWO:()=>dC,TWO_PI:()=>_h});var YR,KR,XR,ZR,JR,QR,tC,eC,rC,nC,iC,oC,sC,Ff,aC,cC,lC,hC,uC,fC,dC,mC,pC,Rc,_h,hg=w(()=>{YR=.1,KR=.01,XR=.001,ZR=1e-4,JR=1e-5,QR=1e-6,tC=1e-7,eC=1e-8,rC=1e-9,nC=1e-10,iC=1e-11,oC=1e-12,sC=1e-13,Ff=1e-14,aC=1e-15,cC=1e-16,lC=1e-17,hC=1e-18,uC=1e-19,fC=1e-20,dC=Math.PI/2,mC=Math.PI/4,pC=Math.PI/6,Rc=Math.PI,_h=Math.PI*2});function ug(e,{precision:t=ie.precision}={}){return e=MC(e),`${parseFloat(e.toPrecision(t))}`}function Vn(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function fg(e){return Uf(e)}function dg(e){return Or(e)}function Uf(e,t){return pg(e,r=>r*yC,t)}function Or(e,t){return pg(e,r=>r*gC,t)}function j2(e,t){return Math.sign(e)===Math.sign(t)&&Math.abs(e)<Math.abs(t)?e:(e%t+t)%t}function mg(e,t){switch(t){case"negative-pi-to-pi":return _C(e);case"zero-to-two-pi":return W2(e);default:return e}}function W2(e){if(e>=0&&e<=_h)return e;let t=j2(e,_h);return Math.abs(t)<1e-14&&Math.abs(e)>1e-14?_h:t}function _C(e){return e>=-Rc&&e<=Rc?e:W2(e+Rc)-Rc}function Mh(e,t,r){return pg(e,n=>Math.max(t,Math.min(r,n)))}function ko(e,t,r){let n=ie.EPSILON;r&&(ie.EPSILON=r);try{if(e===t)return!0;if(Vn(e)&&Vn(t)){if(e.length!==t.length)return!1;for(let i=0;i<e.length;++i)if(!ko(e[i],t[i]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<=ie.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{ie.EPSILON=n}}function MC(e){return Math.round(e/ie.EPSILON)*ie.EPSILON}function bC(e){return e.clone?e.clone():new Array(e.length)}function pg(e,t,r){if(Vn(e)){let n=e;r=r||bC(n);for(let i=0;i<r.length&&i<n.length;++i){let o=typeof e=="number"?e:e[i];r[i]=t(o,i,r)}return r}return t(e)}var gC,yC,wC,ie,ma=w(()=>{hg();gC=1/Math.PI*180,yC=1/180*Math.PI,wC={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...wC}};ie=globalThis.mathgl.config});var qo,Gf=w(()=>{ma();qo=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,r=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=t[n+r];return this.check()}toArray(t=[],r=0){for(let n=0;n<this.ELEMENTS;++n)t[r+n]=this[n];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:Vn(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toString(){return this.formatString(ie)}formatString(t){let r="";for(let n=0;n<this.ELEMENTS;++n)r+=(n>0?", ":"")+ug(this[n],t);return`${t.printTypes?this.constructor.name:""}[${r}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(!ko(this[r],t[r]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(this[r]!==t[r])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,r,n){if(n===void 0)return this.lerp(this,t,r);for(let i=0;i<this.ELEMENTS;++i){let o=t[i],s=typeof r=="number"?r:r[i];this[i]=o+n*(s-o)}return this.check()}min(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(t[r],this[r]);return this.check()}max(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.max(t[r],this[r]);return this.check()}clamp(t,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],t[n]),r[n]);return this.check()}add(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]+=r[n];return this.check()}subtract(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]-=r[n];return this.check()}scale(t){if(typeof t=="number")for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;else for(let r=0;r<this.ELEMENTS&&r<t.length;++r)this[r]*=t[r];return this.check()}multiplyByScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;return this.check()}check(){if(ie.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let r=0;r<this.ELEMENTS;++r)t=t&&Number.isFinite(this[r]);return t}}});function xC(e,t){if(e.length!==t)return!1;for(let r=0;r<e.length;++r)if(!Number.isFinite(e[r]))return!1;return!0}function ue(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function Cc(e,t,r=""){if(ie.debug&&!xC(e,t))throw new Error(`math.gl: ${r} some fields set to invalid numbers'`);return e}var jo=w(()=>{ma()});var Nc,gg=w(()=>{Gf();jo();ma();Nc=class extends qo{toString(){let t="[";if(ie.printRowMajor){t+="row-major:";for(let r=0;r<this.RANK;++r)for(let n=0;n<this.RANK;++n)t+=` ${this[n*this.RANK+r]}`}else{t+="column-major:";for(let r=0;r<this.ELEMENTS;++r)t+=` ${this[r]}`}return t+="]",t}getElementIndex(t,r){return r*this.RANK+t}getElement(t,r){return this[r*this.RANK+t]}setElement(t,r,n){return this[r*this.RANK+t]=ue(n),this}getColumn(t,r=new Array(this.RANK).fill(-0)){let n=t*this.RANK;for(let i=0;i<this.RANK;++i)r[i]=this[n+i];return r}setColumn(t,r){let n=t*this.RANK;for(let i=0;i<this.RANK;++i)this[n+i]=r[i];return this}}});function pr(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var yg=w(()=>{});var Bc,wg=w(()=>{Gf();jo();yg();Bc=class extends qo{get x(){return this[0]}set x(t){this[0]=ue(t)}get y(){return this[1]}set y(t){this[1]=ue(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let r=0;r<this.ELEMENTS;++r)t+=this[r]*this[r];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let r=0;for(let n=0;n<this.ELEMENTS;++n){let i=this[n]-t[n];r+=i*i}return ue(r)}dot(t){let r=0;for(let n=0;n<this.ELEMENTS;++n)r+=this[n]*t[n];return ue(r)}normalize(){let t=this.magnitude();if(t!==0)for(let r=0;r<this.ELEMENTS;++r)this[r]/=t;return this.check()}multiply(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]*=r[n];return this.check()}divide(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]/=r[n];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return pr(t>=0&&t<this.ELEMENTS,"index is out of range"),ue(this[t])}setComponent(t,r){return pr(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=r,this.check()}addVectors(t,r){return this.copy(t).add(r)}subVectors(t,r){return this.copy(t).subtract(r)}multiplyVectors(t,r){return this.copy(t).multiply(r)}addScaledVector(t,r){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t[n]*r;return this.check()}}});var zf,PU,H2=w(()=>{zf=typeof Float32Array<"u"?Float32Array:Array,PU=Math.PI/180});function $2(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e}function Y2(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i+r[4],e[1]=r[1]*n+r[3]*i+r[5],e}function Vf(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[3]*i+r[6],e[1]=r[1]*n+r[4]*i+r[7],e}function kf(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[4]*i+r[12],e[1]=r[1]*n+r[5]*i+r[13],e}var bh=w(()=>{});function qf(e,t,r){let n=t[0],i=t[1],o=r[3]*n+r[7]*i||1;return e[0]=(r[0]*n+r[4]*i)/o,e[1]=(r[1]*n+r[5]*i)/o,e}function jf(e,t,r){let n=t[0],i=t[1],o=t[2],s=r[3]*n+r[7]*i+r[11]*o||1;return e[0]=(r[0]*n+r[4]*i+r[8]*o)/s,e[1]=(r[1]*n+r[5]*i+r[9]*o)/s,e[2]=(r[2]*n+r[6]*i+r[10]*o)/s,e}function K2(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e[2]=t[2],e}function X2(e,t,r){let n=t[0],i=t[1],o=t[2];return e[0]=r[0]*n+r[3]*i+r[6]*o,e[1]=r[1]*n+r[4]*i+r[7]*o,e[2]=r[2]*n+r[5]*i+r[8]*o,e[3]=t[3],e}var xh=w(()=>{});var Jr,Z2=w(()=>{wg();ma();jo();bh();xh();Jr=class extends Bc{constructor(t=0,r=0){super(2),Vn(t)&&arguments.length===1?this.copy(t):(ie.debug&&(ue(t),ue(r)),this[0]=t,this[1]=r)}set(t,r){return this[0]=t,this[1]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this.check()}fromObject(t){return ie.debug&&(ue(t.x),ue(t.y)),this[0]=t.x,this[1]=t.y,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t}get ELEMENTS(){return 2}horizontalAngle(){return Math.atan2(this.y,this.x)}verticalAngle(){return Math.atan2(this.x,this.y)}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return kf(this,this,t),this.check()}transformAsVector(t){return qf(this,this,t),this.check()}transformByMatrix3(t){return Vf(this,this,t),this.check()}transformByMatrix2x3(t){return Y2(this,this,t),this.check()}transformByMatrix2(t){return $2(this,this,t),this.check()}}});function J2(){let e=new zf(3);return zf!==Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function vC(e){let t=e[0],r=e[1],n=e[2];return Math.sqrt(t*t+r*r+n*n)}function _g(e,t,r){let n=new zf(3);return n[0]=e,n[1]=t,n[2]=r,n}function Q2(e,t){let r=t[0],n=t[1],i=t[2],o=r*r+n*n+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e}function Mg(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Oc(e,t,r){let n=t[0],i=t[1],o=t[2],s=r[0],a=r[1],c=r[2];return e[0]=i*c-o*a,e[1]=o*s-n*c,e[2]=n*a-i*s,e}function Wf(e,t,r){let n=t[0],i=t[1],o=t[2],s=r[3]*n+r[7]*i+r[11]*o+r[15];return s=s||1,e[0]=(r[0]*n+r[4]*i+r[8]*o+r[12])/s,e[1]=(r[1]*n+r[5]*i+r[9]*o+r[13])/s,e[2]=(r[2]*n+r[6]*i+r[10]*o+r[14])/s,e}function Hf(e,t,r){let n=t[0],i=t[1],o=t[2];return e[0]=n*r[0]+i*r[3]+o*r[6],e[1]=n*r[1]+i*r[4]+o*r[7],e[2]=n*r[2]+i*r[5]+o*r[8],e}function tb(e,t,r){let n=r[0],i=r[1],o=r[2],s=r[3],a=t[0],c=t[1],l=t[2],h=i*l-o*c,u=o*a-n*l,f=n*c-i*a,d=i*f-o*u,m=o*h-n*f,p=n*u-i*h,g=s*2;return h*=g,u*=g,f*=g,d*=2,m*=2,p*=2,e[0]=a+h+d,e[1]=c+u+m,e[2]=l+f+p,e}function eb(e,t,r,n){let i=[],o=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],o[0]=i[0],o[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),o[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function rb(e,t,r,n){let i=[],o=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],o[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),o[1]=i[1],o[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function nb(e,t,r,n){let i=[],o=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],o[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),o[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),o[2]=i[2],e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function ib(e,t){let r=e[0],n=e[1],i=e[2],o=t[0],s=t[1],a=t[2],c=Math.sqrt((r*r+n*n+i*i)*(o*o+s*s+a*a)),l=c&&Mg(e,t)/c;return Math.acos(Math.min(Math.max(l,-1),1))}var ob,Lc=w(()=>{H2();ob=vC});var bg,$f,I,sb=w(()=>{wg();ma();jo();Lc();xh();bg=[0,0,0],I=class e extends Bc{static get ZERO(){return $f||($f=new e(0,0,0),Object.freeze($f)),$f}constructor(t=0,r=0,n=0){super(-0,-0,-0),arguments.length===1&&Vn(t)?this.copy(t):(ie.debug&&(ue(t),ue(r),ue(n)),this[0]=t,this[1]=r,this[2]=n)}set(t,r,n){return this[0]=t,this[1]=r,this[2]=n,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return ie.debug&&(ue(t.x),ue(t.y),ue(t.z)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t}get ELEMENTS(){return 3}get z(){return this[2]}set z(t){this[2]=ue(t)}angle(t){return ib(this,t)}cross(t){return Oc(this,this,t),this.check()}rotateX({radians:t,origin:r=bg}){return eb(this,this,r,t),this.check()}rotateY({radians:t,origin:r=bg}){return rb(this,this,r,t),this.check()}rotateZ({radians:t,origin:r=bg}){return nb(this,this,r,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Wf(this,this,t),this.check()}transformAsVector(t){return jf(this,this,t),this.check()}transformByMatrix3(t){return Hf(this,this,t),this.check()}transformByMatrix2(t){return K2(this,this,t),this.check()}transformByQuaternion(t){return tb(this,this,t),this.check()}}});function ab(e,t){if(e===t){let r=t[1],n=t[2],i=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=n,e[7]=i}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function cb(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=t[4],a=t[5],c=t[6],l=t[7],h=t[8],u=h*s-a*l,f=-h*o+a*c,d=l*o-s*c,m=r*u+n*f+i*d;return m?(m=1/m,e[0]=u*m,e[1]=(-h*n+i*l)*m,e[2]=(a*n-i*s)*m,e[3]=f*m,e[4]=(h*r-i*c)*m,e[5]=(-a*r+i*o)*m,e[6]=d*m,e[7]=(-l*r+n*c)*m,e[8]=(s*r-n*o)*m,e):null}function lb(e){let t=e[0],r=e[1],n=e[2],i=e[3],o=e[4],s=e[5],a=e[6],c=e[7],l=e[8];return t*(l*o-s*c)+r*(-l*i+s*a)+n*(c*i-o*a)}function xg(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],c=t[5],l=t[6],h=t[7],u=t[8],f=r[0],d=r[1],m=r[2],p=r[3],g=r[4],y=r[5],_=r[6],M=r[7],x=r[8];return e[0]=f*n+d*s+m*l,e[1]=f*i+d*a+m*h,e[2]=f*o+d*c+m*u,e[3]=p*n+g*s+y*l,e[4]=p*i+g*a+y*h,e[5]=p*o+g*c+y*u,e[6]=_*n+M*s+x*l,e[7]=_*i+M*a+x*h,e[8]=_*o+M*c+x*u,e}function hb(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],c=t[5],l=t[6],h=t[7],u=t[8],f=r[0],d=r[1];return e[0]=n,e[1]=i,e[2]=o,e[3]=s,e[4]=a,e[5]=c,e[6]=f*n+d*s+l,e[7]=f*i+d*a+h,e[8]=f*o+d*c+u,e}function ub(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],c=t[5],l=t[6],h=t[7],u=t[8],f=Math.sin(r),d=Math.cos(r);return e[0]=d*n+f*s,e[1]=d*i+f*a,e[2]=d*o+f*c,e[3]=d*s-f*n,e[4]=d*a-f*i,e[5]=d*c-f*o,e[6]=l,e[7]=h,e[8]=u,e}function Sg(e,t,r){let n=r[0],i=r[1];return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function fb(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=r+r,a=n+n,c=i+i,l=r*s,h=n*s,u=n*a,f=i*s,d=i*a,m=i*c,p=o*s,g=o*a,y=o*c;return e[0]=1-u-m,e[3]=h-y,e[6]=f+g,e[1]=h+y,e[4]=1-l-m,e[7]=d-p,e[2]=f-g,e[5]=d+p,e[8]=1-l-u,e}var vg=w(()=>{});function IC(){return Yf||(Yf=new Qr([0,0,0,0,0,0,0,0,0]),Object.freeze(Yf)),Yf}function AC(){return Kf||(Kf=new Qr,Object.freeze(Kf)),Kf}var TC,Qr,Yf,Kf,db=w(()=>{gg();jo();xh();vg();bh();Lc();TC=Object.freeze([1,0,0,0,1,0,0,0,1]),Qr=class extends Nc{static get IDENTITY(){return AC()}static get ZERO(){return IC()}get ELEMENTS(){return 9}get RANK(){return 3}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}identity(){return this.copy(TC)}fromObject(t){return this.check()}fromQuaternion(t){return fb(this,t),this.check()}fromMatrix4(t){return this.set(t[0],t[1],t[2],t[4],t[5],t[6],t[8],t[9],t[10])}set(t,r,n,i,o,s,a,c,l){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,this[4]=o,this[5]=s,this[6]=a,this[7]=c,this[8]=l,this.check()}setRowMajor(t,r,n,i,o,s,a,c,l){return this[0]=t,this[1]=i,this[2]=a,this[3]=r,this[4]=o,this[5]=c,this[6]=n,this[7]=s,this[8]=l,this.check()}determinant(){return lb(this)}transpose(){return ab(this,this),this.check()}invert(){return cb(this,this),this.check()}multiplyLeft(t){return xg(this,t,this),this.check()}multiplyRight(t){return xg(this,this,t),this.check()}rotate(t){return ub(this,this,t),this.check()}scale(t){return Array.isArray(t)?Sg(this,this,t):Sg(this,this,[t,t]),this.check()}translate(t){return hb(this,this,t),this.check()}transform(t,r){let n;switch(t.length){case 2:n=Vf(r||[-0,-0],t,this);break;case 3:n=Hf(r||[-0,-0,-0],t,this);break;case 4:n=X2(r||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Cc(n,t.length),n}},Kf=null});function mb(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Eg(e,t){if(e===t){let r=t[1],n=t[2],i=t[3],o=t[6],s=t[7],a=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=n,e[9]=o,e[11]=t[14],e[12]=i,e[13]=s,e[14]=a}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function Tg(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=t[4],a=t[5],c=t[6],l=t[7],h=t[8],u=t[9],f=t[10],d=t[11],m=t[12],p=t[13],g=t[14],y=t[15],_=r*a-n*s,M=r*c-i*s,x=r*l-o*s,v=n*c-i*a,T=n*l-o*a,S=i*l-o*c,E=h*p-u*m,N=h*g-f*m,O=h*y-d*m,C=u*g-f*p,R=u*y-d*p,W=f*y-d*g,j=_*W-M*R+x*C+v*O-T*N+S*E;return j?(j=1/j,e[0]=(a*W-c*R+l*C)*j,e[1]=(i*R-n*W-o*C)*j,e[2]=(p*S-g*T+y*v)*j,e[3]=(f*T-u*S-d*v)*j,e[4]=(c*O-s*W-l*N)*j,e[5]=(r*W-i*O+o*N)*j,e[6]=(g*x-m*S-y*M)*j,e[7]=(h*S-f*x+d*M)*j,e[8]=(s*R-a*O+l*E)*j,e[9]=(n*O-r*R-o*E)*j,e[10]=(m*T-p*x+y*_)*j,e[11]=(u*x-h*T-d*_)*j,e[12]=(a*N-s*C-c*E)*j,e[13]=(r*C-n*N+i*E)*j,e[14]=(p*M-m*v-g*_)*j,e[15]=(h*v-u*M+f*_)*j,e):null}function Ig(e){let t=e[0],r=e[1],n=e[2],i=e[3],o=e[4],s=e[5],a=e[6],c=e[7],l=e[8],h=e[9],u=e[10],f=e[11],d=e[12],m=e[13],p=e[14],g=e[15],y=t*s-r*o,_=t*a-n*o,M=r*a-n*s,x=l*m-h*d,v=l*p-u*d,T=h*p-u*m,S=t*T-r*v+n*x,E=o*T-s*v+a*x,N=l*M-h*_+u*y,O=d*M-m*_+p*y;return c*S-i*E+g*N-f*O}function Xf(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],c=t[5],l=t[6],h=t[7],u=t[8],f=t[9],d=t[10],m=t[11],p=t[12],g=t[13],y=t[14],_=t[15],M=r[0],x=r[1],v=r[2],T=r[3];return e[0]=M*n+x*a+v*u+T*p,e[1]=M*i+x*c+v*f+T*g,e[2]=M*o+x*l+v*d+T*y,e[3]=M*s+x*h+v*m+T*_,M=r[4],x=r[5],v=r[6],T=r[7],e[4]=M*n+x*a+v*u+T*p,e[5]=M*i+x*c+v*f+T*g,e[6]=M*o+x*l+v*d+T*y,e[7]=M*s+x*h+v*m+T*_,M=r[8],x=r[9],v=r[10],T=r[11],e[8]=M*n+x*a+v*u+T*p,e[9]=M*i+x*c+v*f+T*g,e[10]=M*o+x*l+v*d+T*y,e[11]=M*s+x*h+v*m+T*_,M=r[12],x=r[13],v=r[14],T=r[15],e[12]=M*n+x*a+v*u+T*p,e[13]=M*i+x*c+v*f+T*g,e[14]=M*o+x*l+v*d+T*y,e[15]=M*s+x*h+v*m+T*_,e}function Ag(e,t,r){let n=r[0],i=r[1],o=r[2],s,a,c,l,h,u,f,d,m,p,g,y;return t===e?(e[12]=t[0]*n+t[4]*i+t[8]*o+t[12],e[13]=t[1]*n+t[5]*i+t[9]*o+t[13],e[14]=t[2]*n+t[6]*i+t[10]*o+t[14],e[15]=t[3]*n+t[7]*i+t[11]*o+t[15]):(s=t[0],a=t[1],c=t[2],l=t[3],h=t[4],u=t[5],f=t[6],d=t[7],m=t[8],p=t[9],g=t[10],y=t[11],e[0]=s,e[1]=a,e[2]=c,e[3]=l,e[4]=h,e[5]=u,e[6]=f,e[7]=d,e[8]=m,e[9]=p,e[10]=g,e[11]=y,e[12]=s*n+h*i+m*o+t[12],e[13]=a*n+u*i+p*o+t[13],e[14]=c*n+f*i+g*o+t[14],e[15]=l*n+d*i+y*o+t[15]),e}function Pg(e,t,r){let n=r[0],i=r[1],o=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Rg(e,t,r,n){let i=n[0],o=n[1],s=n[2],a=Math.sqrt(i*i+o*o+s*s),c,l,h,u,f,d,m,p,g,y,_,M,x,v,T,S,E,N,O,C,R,W,j,A;return a<1e-6?null:(a=1/a,i*=a,o*=a,s*=a,l=Math.sin(r),c=Math.cos(r),h=1-c,u=t[0],f=t[1],d=t[2],m=t[3],p=t[4],g=t[5],y=t[6],_=t[7],M=t[8],x=t[9],v=t[10],T=t[11],S=i*i*h+c,E=o*i*h+s*l,N=s*i*h-o*l,O=i*o*h-s*l,C=o*o*h+c,R=s*o*h+i*l,W=i*s*h+o*l,j=o*s*h-i*l,A=s*s*h+c,e[0]=u*S+p*E+M*N,e[1]=f*S+g*E+x*N,e[2]=d*S+y*E+v*N,e[3]=m*S+_*E+T*N,e[4]=u*O+p*C+M*R,e[5]=f*O+g*C+x*R,e[6]=d*O+y*C+v*R,e[7]=m*O+_*C+T*R,e[8]=u*W+p*j+M*A,e[9]=f*W+g*j+x*A,e[10]=d*W+y*j+v*A,e[11]=m*W+_*j+T*A,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function Cg(e,t,r){let n=Math.sin(r),i=Math.cos(r),o=t[4],s=t[5],a=t[6],c=t[7],l=t[8],h=t[9],u=t[10],f=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*i+l*n,e[5]=s*i+h*n,e[6]=a*i+u*n,e[7]=c*i+f*n,e[8]=l*i-o*n,e[9]=h*i-s*n,e[10]=u*i-a*n,e[11]=f*i-c*n,e}function Ng(e,t,r){let n=Math.sin(r),i=Math.cos(r),o=t[0],s=t[1],a=t[2],c=t[3],l=t[8],h=t[9],u=t[10],f=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*i-l*n,e[1]=s*i-h*n,e[2]=a*i-u*n,e[3]=c*i-f*n,e[8]=o*n+l*i,e[9]=s*n+h*i,e[10]=a*n+u*i,e[11]=c*n+f*i,e}function Bg(e,t,r){let n=Math.sin(r),i=Math.cos(r),o=t[0],s=t[1],a=t[2],c=t[3],l=t[4],h=t[5],u=t[6],f=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*i+l*n,e[1]=s*i+h*n,e[2]=a*i+u*n,e[3]=c*i+f*n,e[4]=l*i-o*n,e[5]=h*i-s*n,e[6]=u*i-a*n,e[7]=f*i-c*n,e}function Og(e,t){let r=t[0],n=t[1],i=t[2],o=t[4],s=t[5],a=t[6],c=t[8],l=t[9],h=t[10];return e[0]=Math.sqrt(r*r+n*n+i*i),e[1]=Math.sqrt(o*o+s*s+a*a),e[2]=Math.sqrt(c*c+l*l+h*h),e}function Lg(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=r+r,a=n+n,c=i+i,l=r*s,h=n*s,u=n*a,f=i*s,d=i*a,m=i*c,p=o*s,g=o*a,y=o*c;return e[0]=1-u-m,e[1]=h+y,e[2]=f-g,e[3]=0,e[4]=h-y,e[5]=1-l-m,e[6]=d+p,e[7]=0,e[8]=f+g,e[9]=d-p,e[10]=1-l-u,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Dg(e,t,r,n,i,o,s){let a=1/(r-t),c=1/(i-n),l=1/(o-s);return e[0]=o*2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o*2*c,e[6]=0,e[7]=0,e[8]=(r+t)*a,e[9]=(i+n)*c,e[10]=(s+o)*l,e[11]=-1,e[12]=0,e[13]=0,e[14]=s*o*2*l,e[15]=0,e}function pb(e,t,r,n,i){let o=1/Math.tan(t/2);if(e[0]=o/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let s=1/(n-i);e[10]=(i+n)*s,e[14]=2*i*n*s}else e[10]=-1,e[14]=-2*n;return e}function gb(e,t,r,n,i,o,s){let a=1/(t-r),c=1/(n-i),l=1/(o-s);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+r)*a,e[13]=(i+n)*c,e[14]=(s+o)*l,e[15]=1,e}function Gg(e,t,r,n){let i,o,s,a,c,l,h,u,f,d,m=t[0],p=t[1],g=t[2],y=n[0],_=n[1],M=n[2],x=r[0],v=r[1],T=r[2];return Math.abs(m-x)<1e-6&&Math.abs(p-v)<1e-6&&Math.abs(g-T)<1e-6?mb(e):(u=m-x,f=p-v,d=g-T,i=1/Math.sqrt(u*u+f*f+d*d),u*=i,f*=i,d*=i,o=_*d-M*f,s=M*u-y*d,a=y*f-_*u,i=Math.sqrt(o*o+s*s+a*a),i?(i=1/i,o*=i,s*=i,a*=i):(o=0,s=0,a=0),c=f*a-d*s,l=d*o-u*a,h=u*s-f*o,i=Math.sqrt(c*c+l*l+h*h),i?(i=1/i,c*=i,l*=i,h*=i):(c=0,l=0,h=0),e[0]=o,e[1]=c,e[2]=u,e[3]=0,e[4]=s,e[5]=l,e[6]=f,e[7]=0,e[8]=a,e[9]=h,e[10]=d,e[11]=0,e[12]=-(o*m+s*p+a*g),e[13]=-(c*m+l*p+h*g),e[14]=-(u*m+f*p+d*g),e[15]=1,e)}function zg(e){if(e.length!==16||Array.from(e).some(i=>!Number.isFinite(i))||e[3]!==0||e[7]!==0||e[11]!==0||e[15]!==1)throw new RangeError("Expected a finite affine matrix");let t=[Math.hypot(e[0],e[1],e[2]),Math.hypot(e[4],e[5],e[6]),Math.hypot(e[8],e[9],e[10])];if(t.some(i=>i===0||!Number.isFinite(i)))throw new RangeError("Singular transform");let r=Array.from({length:9},(i,o)=>e[Math.floor(o/3)*4+o%3]/t[Math.floor(o/3)]);for(let[i,o]of[[0,3],[0,6],[3,6]])if(Math.abs(r[i]*r[o]+r[i+1]*r[o+1]+r[i+2]*r[o+2])>1e-7)throw new RangeError("Sheared transforms do not have a TRS decomposition");if(r[0]*(r[4]*r[8]-r[5]*r[7])-r[3]*(r[1]*r[8]-r[2]*r[7])+r[6]*(r[1]*r[5]-r[2]*r[4])<0){t[0]=-t[0];for(let i=0;i<3;i++)r[i]=-r[i]}return{rotation:r,scale:t,translation:[e[12],e[13],e[14]]}}var Fg,Ug,Zf=w(()=>{Fg=pb;Ug=gb});function yb(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e}function wb(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e}function _b(e){let t=e[0],r=e[1],n=e[2],i=e[3];return Math.sqrt(t*t+r*r+n*n+i*i)}function Mb(e){let t=e[0],r=e[1],n=e[2],i=e[3];return t*t+r*r+n*n+i*i}function bb(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=r*r+n*n+i*i+o*o;return s>0&&(s=1/Math.sqrt(s)),e[0]=r*s,e[1]=n*s,e[2]=i*s,e[3]=o*s,e}function xb(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Sb(e,t,r,n){let i=t[0],o=t[1],s=t[2],a=t[3];return e[0]=i+n*(r[0]-i),e[1]=o+n*(r[1]-o),e[2]=s+n*(r[2]-s),e[3]=a+n*(r[3]-a),e}function vb(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3];return e[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*s,e[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*s,e[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*s,e[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*s,e}var Jf=w(()=>{});function BC(){return Qf||(Qf=new bt([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Qf)),Qf}function OC(){return td||(td=new bt,Object.freeze(td)),td}function Eb(e){if(e>Math.PI*2)throw Error("expected radians")}function LC(e,t,r,n,i,o){let s=2*o/(r-t),a=2*o/(i-n),c=(r+t)/(r-t),l=(i+n)/(i-n),h=-1,u=-1,f=-2*o;return e[0]=s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=c,e[9]=l,e[10]=h,e[11]=u,e[12]=0,e[13]=0,e[14]=f,e[15]=0,e}var RC,CC,Vg,kg,NC,bt,Qf,td,Tb=w(()=>{gg();Zf();jo();xh();Zf();bh();Lc();Jf();RC=45*Math.PI/180,CC=1,Vg=.1,kg=500,NC=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),bt=class extends Nc{static get IDENTITY(){return OC()}static get ZERO(){return BC()}get ELEMENTS(){return 16}get RANK(){return 4}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,r,n,i,o,s,a,c,l,h,u,f,d,m,p,g){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,this[4]=o,this[5]=s,this[6]=a,this[7]=c,this[8]=l,this[9]=h,this[10]=u,this[11]=f,this[12]=d,this[13]=m,this[14]=p,this[15]=g,this.check()}setRowMajor(t,r,n,i,o,s,a,c,l,h,u,f,d,m,p,g){return this[0]=t,this[1]=o,this[2]=l,this[3]=d,this[4]=r,this[5]=s,this[6]=h,this[7]=m,this[8]=n,this[9]=a,this[10]=u,this[11]=p,this[12]=i,this[13]=c,this[14]=f,this[15]=g,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(NC)}fromObject(t){return this.check()}fromQuaternion(t){return Lg(this,t),this.check()}fromMatrix3(t){return this.set(t[0],t[1],t[2],0,t[3],t[4],t[5],0,t[6],t[7],t[8],0,0,0,0,1)}frustum(t){let{left:r,right:n,bottom:i,top:o,near:s=Vg,far:a=kg}=t;return a===1/0?LC(this,r,n,i,o,s):Dg(this,r,n,i,o,s,a),this.check()}lookAt(t){let{eye:r,center:n=[0,0,0],up:i=[0,1,0]}=t;return Gg(this,r,n,i),this.check()}ortho(t){let{left:r,right:n,bottom:i,top:o,near:s=Vg,far:a=kg}=t;return Ug(this,r,n,i,o,s,a),this.check()}orthographic(t){let{fovy:r=RC,aspect:n=CC,focalDistance:i=1,near:o=Vg,far:s=kg}=t;Eb(r);let a=r/2,c=i*Math.tan(a),l=c*n;return this.ortho({left:-l,right:l,bottom:-c,top:c,near:o,far:s})}perspective(t){let{fovy:r=45*Math.PI/180,aspect:n=1,near:i=.1,far:o=500}=t;return Eb(r),Fg(this,r,n,i,o),this.check()}determinant(){return Ig(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,r){let{rotation:n,scale:i}=zg(this);if(t=t||new Array(16),r)for(let o=0;o<3;o++)r[o]=i[o];for(let o=0;o<16;o++)t[o]=0;for(let o=0;o<9;o++)t[Math.floor(o/3)*4+o%3]=n[o];return t[15]=1,t}getRotationMatrix3(t,r){let{rotation:n,scale:i}=zg(this);if(t=t||new Array(9),r)for(let o=0;o<3;o++)r[o]=i[o];for(let o=0;o<9;o++)t[o]=n[o];return t}transpose(){return Eg(this,this),this.check()}invert(){return Tg(this,this),this.check()}multiplyLeft(t){return Xf(this,t,this),this.check()}multiplyRight(t){return Xf(this,this,t),this.check()}rotateX(t){return Cg(this,this,t),this.check()}rotateY(t){return Ng(this,this,t),this.check()}rotateZ(t){return Bg(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,r){return Rg(this,this,t,r),this.check()}scale(t){return Pg(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return Ag(this,this,t),this.check()}transform(t,r){return t.length===4?(r=vb(r||[-0,-0,-0,-0],t,this),Cc(r,4),r):this.transformAsPoint(t,r)}transformAsPoint(t,r){let{length:n}=t,i;switch(n){case 2:i=kf(r||[-0,-0],t,this);break;case 3:i=Wf(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Cc(i,t.length),i}transformAsVector(t,r){let n;switch(t.length){case 2:n=qf(r||[-0,-0],t,this);break;case 3:n=jf(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Cc(n,t.length),n}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,r,n){return this.identity().translate([t,r,n])}}});function Ib(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function qg(e,t,r){r=r*.5;let n=Math.sin(r);return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(r),e}function jg(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3],a=r[0],c=r[1],l=r[2],h=r[3];return e[0]=n*h+s*a+i*l-o*c,e[1]=i*h+s*c+o*a-n*l,e[2]=o*h+s*l+n*c-i*a,e[3]=s*h-n*a-i*c-o*l,e}function Ab(e,t,r){r*=.5;let n=t[0],i=t[1],o=t[2],s=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c+s*a,e[1]=i*c+o*a,e[2]=o*c-i*a,e[3]=s*c-n*a,e}function Pb(e,t,r){r*=.5;let n=t[0],i=t[1],o=t[2],s=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c-o*a,e[1]=i*c+s*a,e[2]=o*c+n*a,e[3]=s*c-i*a,e}function Rb(e,t,r){r*=.5;let n=t[0],i=t[1],o=t[2],s=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c+i*a,e[1]=i*c-n*a,e[2]=o*c+s*a,e[3]=s*c-o*a,e}function Cb(e,t){let r=t[0],n=t[1],i=t[2];return e[0]=r,e[1]=n,e[2]=i,e[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i)),e}function Wg(e,t,r,n){let i=t[0],o=t[1],s=t[2],a=t[3],c=r[0],l=r[1],h=r[2],u=r[3],f,d,m,p,g;return f=i*c+o*l+s*h+a*u,f<0&&(f=-f,c=-c,l=-l,h=-h,u=-u),1-f>1e-6?(d=Math.acos(f),g=Math.sin(d),m=Math.sin((1-n)*d)/g,p=Math.sin(n*d)/g):(m=1-n,p=n),e[0]=m*i+p*c,e[1]=m*o+p*l,e[2]=m*s+p*h,e[3]=m*a+p*u,e}function Nb(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=r*r+n*n+i*i+o*o,a=s?1/s:0;return e[0]=-r*a,e[1]=-n*a,e[2]=-i*a,e[3]=o*a,e}function Bb(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function Ob(e,t){let r=t[0]+t[4]+t[8],n;if(r>0)n=Math.sqrt(r+1),e[3]=.5*n,n=.5/n,e[0]=(t[5]-t[7])*n,e[1]=(t[6]-t[2])*n,e[2]=(t[1]-t[3])*n;else{let i=0;t[4]>t[0]&&(i=1),t[8]>t[i*3+i]&&(i=2);let o=(i+1)%3,s=(i+2)%3;n=Math.sqrt(t[i*3+i]-t[o*3+o]-t[s*3+s]+1),e[i]=.5*n,n=.5/n,e[3]=(t[o*3+s]-t[s*3+o])*n,e[o]=(t[o*3+i]+t[i*3+o])*n,e[s]=(t[s*3+i]+t[i*3+s])*n}return e}function kb(e,t,r,n){if(t.length!==4||r.length!==4||[...Array.from(t),...Array.from(r),n].some(f=>!Number.isFinite(f)))throw new RangeError("Expected finite quaternions and step");if(t.length!==4||n<0)throw new RangeError("Expected quaternions and a nonnegative step");let i=Math.max(...Array.from(t,Math.abs)),o=Math.max(...Array.from(r,Math.abs));if(!i||!o)throw new RangeError("Zero quaternion");let s=Array.from(t,f=>f/i),a=Array.from(r,f=>f/o),c=Math.hypot(...s),l=Math.hypot(...a);for(let f=0;f<4;f++)s[f]/=c,a[f]/=l;let h=s.reduce((f,d,m)=>f+d*a[m],0),u=2*Math.acos(Math.min(1,Math.abs(h)));if(e.length<4)throw new RangeError("Result buffer is too short");return Wg(e,s,a,u===0?0:Math.min(1,n/u)),e}var Lb,Db,Fb,Ub,Gb,zb,DC,Vb,ed=w(()=>{Lc();Jf();Lb=yb,Db=wb,Fb=xb,Ub=Sb,Gb=_b,zb=Mb,DC=bb,Vb=(function(){let e=J2(),t=_g(1,0,0),r=_g(0,1,0);return function(n,i,o){let s=Mg(i,o);return s<-.999999?(Oc(e,t,i),ob(e)<1e-6&&Oc(e,r,i),Q2(e,e),qg(n,e,Math.PI),n):s>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Oc(e,i,o),n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=1+s,DC(n,n))}})()});var to,qb=w(()=>{ed();Gf();jo();ed();to=class extends qo{constructor(t=0,r=0,n=0,i=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,r,n,i)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,r,n,i){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return Ob(this,t),this.check()}fromEuler(t){switch(this.identity(),t.order){case"xyz":return this.rotateX(t.x).rotateY(t.y).rotateZ(t.z);case"yxz":return this.rotateY(t.y).rotateX(t.x).rotateZ(t.z);case"zxy":return this.rotateZ(t.z).rotateX(t.x).rotateY(t.y);case"zyx":return this.rotateZ(t.z).rotateY(t.y).rotateX(t.x);case"yzx":return this.rotateY(t.y).rotateZ(t.z).rotateX(t.x);case"xzy":return this.rotateX(t.x).rotateZ(t.z).rotateY(t.y);default:throw new Error("Unknown Euler angle order")}}fromAxisRotation(t,r){return qg(this,t,r),this.check()}rotateTowards(t,r){return kb(this,this,t,r)}identity(){return Ib(this),this.check()}setAxisAngle(t,r){return this.fromAxisRotation(t,r)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=ue(t)}get y(){return this[1]}set y(t){this[1]=ue(t)}get z(){return this[2]}set z(t){this[2]=ue(t)}get w(){return this[3]}set w(t){this[3]=ue(t)}len(){return Gb(this)}lengthSquared(){return zb(this)}dot(t){return Fb(this,t)}rotationTo(t,r){return Vb(this,t,r),this.check()}add(t){return Lb(this,this,t),this.check()}calculateW(){return Cb(this,this),this.check()}conjugate(){return Bb(this,this),this.check()}invert(){return Nb(this,this),this.check()}lerp(t,r,n){return n===void 0?this.lerp(this,t,r):(Ub(this,t,r,n),this.check())}multiplyRight(t){return jg(this,this,t),this.check()}multiplyLeft(t){return jg(this,t,this),this.check()}normalize(){let t=this.len(),r=t>0?1/t:0;return this[0]=this[0]*r,this[1]=this[1]*r,this[2]=this[2]*r,this[3]=this[3]*r,t===0&&(this[3]=1),this.check()}rotateX(t){return Ab(this,this,t),this.check()}rotateY(t){return Pb(this,this,t),this.check()}rotateZ(t){return Rb(this,this,t),this.check()}scale(t){return Db(this,this,t),this.check()}slerp(t,r,n){let i,o,s;return arguments.length===2?(i=this,o=t,s=r):(i=t,o=r,s=n),Wg(this,i,o,s),this.check()}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,r){return this.setAxisAngle(t,r)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}}});function $g(){return{eastX:0,eastY:1,northZ:1,upX:1,upY:0,upZ:0}}function Yg(e,t,r){let n=e.x,i=e.y,o=e.z,s=t.x,a=t.y,c=t.z;return o!==0?!1:FC(r,n,i,s*i-a*n,s,a,c)}function Kg(e,t,r,n,i,o){let s=Hg(r),a=Hg(n),c=Hg(i),l=Math.abs(s),h=Math.abs(a),u=Math.abs(c);if(!l||!h||!u||l===h||l===u||h===u||(l%3+1===h?1:-1)*Math.sign(s*a*c)!==1||!Array.isArray(o)&&o.length<16)return!1;let d=e.eastX,m=e.eastY,p=e.northZ,g=e.upX,y=e.upY,_=e.upZ,M=-_*m,x=_*d,v=t.x,T=t.y,S=t.z,E=(l===1?d:l===2?M:g)*Math.sign(s),N=(l===1?m:l===2?x:y)*Math.sign(s),O=(l===1?0:l===2?p:_)*Math.sign(s),C=(h===1?d:h===2?M:g)*Math.sign(a),R=(h===1?m:h===2?x:y)*Math.sign(a),W=(h===1?0:h===2?p:_)*Math.sign(a),j=(u===1?d:u===2?M:g)*Math.sign(c),A=(u===1?m:u===2?x:y)*Math.sign(c),P=(u===1?0:u===2?p:_)*Math.sign(c);return!Number.isFinite(E)||!Number.isFinite(N)||!Number.isFinite(O)||!Number.isFinite(C)||!Number.isFinite(R)||!Number.isFinite(W)||!Number.isFinite(j)||!Number.isFinite(A)||!Number.isFinite(P)||!Number.isFinite(v)||!Number.isFinite(T)||!Number.isFinite(S)||o instanceof Float32Array&&(!Number.isFinite(Math.fround(E))||!Number.isFinite(Math.fround(N))||!Number.isFinite(Math.fround(O))||!Number.isFinite(Math.fround(C))||!Number.isFinite(Math.fround(R))||!Number.isFinite(Math.fround(W))||!Number.isFinite(Math.fround(j))||!Number.isFinite(Math.fround(A))||!Number.isFinite(Math.fround(P))||!Number.isFinite(Math.fround(v))||!Number.isFinite(Math.fround(T))||!Number.isFinite(Math.fround(S)))?!1:(o[0]=E,o[1]=N,o[2]=O,o[3]=0,o[4]=C,o[5]=R,o[6]=W,o[7]=0,o[8]=j,o[9]=A,o[10]=P,o[11]=0,o[12]=v,o[13]=T,o[14]=S,o[15]=1,!0)}function Hg(e){switch(e){case"east":return 1;case"west":return-1;case"north":return 2;case"south":return-2;case"up":return 3;case"down":return-3;default:return 0}}function FC(e,t,r,n,i,o,s){return!Number.isFinite(t)||!Number.isFinite(r)||!Number.isFinite(n)||!Number.isFinite(i)||!Number.isFinite(o)||!Number.isFinite(s)?!1:(e.eastX=t,e.eastY=r,e.northZ=n,e.upX=i,e.upY=o,e.upZ=s,!0)}var jb=w(()=>{});function vh(e,t,r=e){let n=e.x,i=e.y,o=e.z,{semiMajorAxis:s,semiMinorAxis:a,eccentricitySquared:c}=t,l=Math.sin(i),h=Math.abs(i)===Math.PI/2?0:Math.cos(i),u=a/s,f=c<.9?s/Math.sqrt(1-c*l*l):s/Math.hypot(h,u*l),d=(f+o)*h*Math.cos(n),m=(f+o)*h*Math.sin(n),p=(f*(c<.9?1-c:u*u)+o)*l;return Dc(r,d,m,p)}function Eh(e,t,r=e){let n=e.x,i=e.y,o=e.z,{semiMajorAxis:s,semiMinorAxis:a,eccentricitySquared:c}=t,l=Math.atan2(i,n),h=Math.hypot(n,i),u=Math.hypot(n,i,o);if(!(u>0)||!Number.isFinite(u))return!1;if(c===0)return Dc(r,h===0?0:l,Math.atan2(o,h),u-s);if(h===0)return Dc(r,0,Math.sign(o)*Math.PI/2,Math.abs(o)-a);let f=h/s,d=o/a;if(f*f+d*d<1-16*nd||c>=.9)return Xg(n,i,o,h,s,a,r);let m=o/u,p=h/u,g=1/Math.sqrt(1-c*(2-c)*p*p),y=p*(1-c)*g,_=m*g;for(let M=0;M<30;M++){let x=s/Math.sqrt(1-c*_*_),v=h*y+o*_-x*(1-c*_*_),T=c*x/(x+v);g=1/Math.sqrt(1-T*(2-T)*p*p);let S=p*(1-T)*g,E=m*g;if(Math.abs(E*y-S*_)<=1e-12){if(!Number.isFinite(v))break;return Dc(r,l,Math.atan2(E,Math.abs(S)),v)}y=S,_=E}return Xg(n,i,o,h,s,a,r)}function Xg(e,t,r,n,i,o,s){let a=Math.atan2(t,e),c=o/i,l=c*c,h=n/i,u=r/i,f=1-l;if(!(l>0)||c>1)return!1;let d=i*i,m=o*o,p=Number.isFinite(d)&&d>0?(m-l*d+Wo(o,o,m)-l*Wo(i,i,d)-Wo(l,d,l*d))/d:0,g=n*n,y=e*e,_=t*t,M=y+_,x=Number.isFinite(g)&&g>0?(M-g+rd(y,_,M)+Wo(e,e,y)+Wo(t,t,_)-Wo(n,n,g))/(2*n):0,v=i*l,T=n-i,S=T+v,E=x+rd(n,-i,T)+rd(T,v,S)+Wo(i,l,v)+i*p;if(r===0)return S+E<0?!1:Dc(s,a,0,T);let N=Math.abs(u)*c,O=0,C=l+Math.hypot(h,u*c);if(!Number.isFinite(C))return!1;let R=Math.max(N,h-f);R>O&&R<C||(R=C/2);let W=-(S+E)/i,j=Math.sqrt(W*(h+f))/f,A=W>0&&Math.abs(r)/j/i*c<=nd*W?Math.atan2(Math.sign(r)*j/c,h/f):void 0;for(let P=0;P<1024&&A===void 0;P++){let D=f+R,F=h/D,L=r/R/i,B=L*c,V=i*R,yt=S-V,X=(yt+(rd(S,-V,yt)+E-Wo(i,R,V)))/(i*D)*(F+1),xt=X+B*B;if(!Number.isFinite(xt))return!1;xt>0?O=R:C=R;let et=-2*(F*F/D+B*B/R),dt=R-xt/et,St=dt>O&&dt<C?dt:O+(C-O)/2;if(Math.abs(xt)<=4*nd*(Math.abs(X)+B*B)||C-O<=4*nd*R){A=Math.atan2(L,F);break}R=St}return A!==void 0&&UC(s,a,A,n,r,i,c)}function rd(e,t,r){let n=r-e;return e-(r-n)+(t-n)}function Wo(e,t,r){let n=134217729*e,i=134217729*t;if(!Number.isFinite(n)||!Number.isFinite(i))return 0;let o=n-(n-e),s=i-(i-t),a=e-o,c=t-s;return o*s-r+o*c+a*s+a*c}function UC(e,t,r,n,i,o,s){let a=Math.sin(r),c=Math.cos(r);return Dc(e,t,r,n*c+i*a-o*Math.hypot(c,s*a))}function Dc(e,t,r,n){return!Number.isFinite(t)||!Number.isFinite(r)||!Number.isFinite(n)?!1:(e.x=t,e.y=r,e.z=n,!0)}var nd,Wb=w(()=>{nd=Number.EPSILON});function Hb(e){return ArrayBuffer.isView(e)?GC.call(e):void 0}var GC,$b=w(()=>{GC=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag).get});function id(e){return Hb(e)==="Uint16Array"}var Yb=w(()=>{$b()});function od(){return Fc??Uint16Array}var Fc,Kb=w(()=>{Fc=globalThis.Float16Array});var Xb=w(()=>{Yb();Kb()});var Zb=w(()=>{Xb()});var Jb=w(()=>{vg()});var Zg=w(()=>{Zf()});var Qb=w(()=>{ed()});var tx=w(()=>{bh()});var ex=w(()=>{Lc()});var rx=w(()=>{Jf()});function Jg(e={}){let t=e.depthRange??"negative-one-to-one";if(t!=="negative-one-to-one"&&t!=="zero-to-one")throw new RangeError("Unknown depth range");let r=t==="zero-to-one"?0:-1;return e.reversedDepth?[1,r]:[r,1]}var nx=w(()=>{});var qt=w(()=>{Z2();sb();db();Tb();qb();hg();yg();ma();jb();Wb();Zb();Jb();Zg();Qb();tx();ex();rx();Zg();nx()});var eo,W7,ix=w(()=>{eo=6356752314245179e-9,W7={radii:[6378137,6378137,eo],radiiSquared:[6378137*6378137,6378137*6378137,eo*eo],oneOverRadii:[1/6378137,1/6378137,1/eo],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(eo*eo)],maximumRadius:Math.max(6378137,6378137,eo),centerToleranceSquared:.1}});function Qg(e){return e}function ro(e,t=[],r=Qg){return"longitude"in e?(t[0]=r(e.longitude),t[1]=r(e.latitude),t[2]=e.height):"x"in e?(t[0]=r(e.x),t[1]=r(e.y),t[2]=e.z):(t[0]=r(e[0]),t[1]=r(e[1]),t[2]=e[2]),t}function ox(e,t=[]){return ro(e,t,ie._cartographicRadians?Qg:fg)}function t1(e,t,r,n){let i=ie._cartographicRadians?Qg:dg,o=i(e),s=i(t);return"longitude"in n?(n.longitude=o,n.latitude=s,n.height=r):"x"in n?(n.x=o,n.y=s,n.z=r):(n[0]=o,n[1]=s,n[2]=r),n}var Y7,sx=w(()=>{qt();Y7=new I});function Ri(e,t,r,n,i,o,s){let c=[n,i,o,Math.abs(e),Math.abs(t),Math.abs(r)].map(S=>{let E=S.toString(2),N=E.indexOf(".");return{integer:BigInt("0b"+E.replace(".","")),exponent:N<0?0:N+1-E.length}}),l=Math.min(...c.filter(S=>S.integer!==0n).map(S=>S.exponent)),h=c.map(S=>S.integer<<BigInt(S.exponent-l)),u=h.slice(0,3).map(S=>S*S),f=u.reduce((S,E)=>S<E?S:E),d=u.map(S=>S-f),m=u.map((S,E)=>h[E]*h[E+3]),p=64;if(!m.some((S,E)=>d[E]===0n&&S!==0n)){let S=-1n,E=1n;for(let C=0;C<3;C++){if(d[C]===0n)continue;let R=d[C]*d[C];S=S*R+m[C]*m[C]*E,E*=R}if(S<0n)return!1;if(S===0n)return T(0n,1n);let O=d.filter(C=>C>0n).reduce((C,R)=>C<R?C:R);p=Math.max(64,(2n*(E+S)).toString(2).length-(S*O).toString(2).length+128)}let g=1n<<BigInt(p),y=d.map(S=>S*g),_=m.map(S=>S*g),M=_.map(S=>S*S),x=0n,v=_.reduce((S,E)=>S+E,0n);if(v===0n)return!1;for(let S=0;S<4096;S++){let E=x+v>>1n;if(E===x)return!1;let N=y[0]+E,O=y[1]+E,C=y[2]+E,R=N*N,W=O*O,j=C*C,A=M[0]*W*j+M[1]*R*j+M[2]*R*W-R*W*j;if(A===0n)return T(E,g);if(A>0n?x=E:v=E,x>0n&&v-x<=x>>60n)return T(x+v>>1n,g)}return!1;function T(S,E){let N=u.map((W,j)=>{let A=d[j]*E+S;return A===0n?0:e1(W*h[j+3]*E,A,l)});if(!N.every(Number.isFinite))return!1;let O=Math.sign(e)*N[0],C=Math.sign(t)*N[1],R=Math.sign(r)*N[2];return s.x=O,s.y=C,s.z=R,!0}}function e1(e,t,r){if(e===0n)return 0;let n=52-(e.toString(2).length-t.toString(2).length),i=n>=0?e<<BigInt(n):e,o=n>=0?t:t<<BigInt(-n),s=i/o,a=i%o;(2n*a>o||2n*a===o&&s&1n)&&s++;let c=r-n,l=Math.max(-1022,Math.min(1023,c));return Number(s)*2**l*2**(c-l)}var r1=w(()=>{});function ax(e,t,r,n,i,o,s){let a=Math.min(n,i,o),c=a*a,l=n*n,h=i*i,u=o*o;if(!(a>0)||!(c>0)||!Number.isFinite(Math.max(l,h,u)))return!1;let f=pa(a,a,c),d=l-c,m=h-c,p=u-c,g=no(l,-c,d)+pa(n,n,l)-f,y=no(h,-c,m)+pa(i,i,h)-f,_=no(u,-c,p)+pa(o,o,u)-f,M=n*Math.abs(e),x=i*Math.abs(t),v=o*Math.abs(r);if(c<2**-1022||e!==0&&M<2**-1022||t!==0&&x<2**-1022||r!==0&&v<2**-1022)return Ri(e,t,r,n,i,o,s);let T=pa(n,Math.abs(e),M),S=pa(i,Math.abs(t),x),E=pa(o,Math.abs(r),v);if(Math.hypot(d===0?M===0?0:1/0:M/(d+g),m===0?x===0?0:1/0:x/(m+y),p===0?v===0?0:1/0:v/(p+_))<=1+64*Number.EPSILON)return Ri(e,t,r,n,i,o,s);if((e!==0?1:0)+(t!==0?1:0)+(r!==0?1:0)==1)return s.x=e===0?e:Math.sign(e)*n,s.y=t===0?t:Math.sign(t)*i,s.z=r===0?r:Math.sign(r)*o,!0;let O=Math.hypot(d===0?M:0,m===0?x:0,p===0?v:0),C=Math.hypot(M,x,v);if(!(C>0)||!Number.isFinite(C))return Ri(e,t,r,n,i,o,s);let R=O>0?O:C;for(let W=0;W<512;W++){let j=d+R,A=m+R,P=p+R,D=no(d,R,j)+g,F=no(m,R,A)+y,L=no(p,R,P)+_,B=M/j,V=x/A,yt=v/P,Dt,X;B>=V&&B>=yt?(Dt=n1(M,T,d,g,R,j)*(B+1),X=(V*(1-F/A))**2+(yt*(1-L/P))**2):V>=yt?(Dt=n1(x,S,m,y,R,A)*(V+1),X=(B*(1-D/j))**2+(yt*(1-L/P))**2):(Dt=n1(v,E,p,_,R,P)*(yt+1),X=(B*(1-D/j))**2+(V*(1-F/A))**2);let xt=-2*(B*B/j+V*V/A+yt*yt/P),et=4*Number.EPSILON*(Math.abs(Dt)+X),dt=Dt+X;if(!Number.isFinite(dt))return Ri(e,t,r,n,i,o,s);if(Math.abs(dt)<=4*Number.EPSILON*(Math.abs(Dt)+X)||C-O<=4*Number.EPSILON*R){let Rt=et/Math.abs(xt);if(!Number.isFinite(xt)||!(Math.abs(xt)>0)||Rt>2e-13*R)return Ri(e,t,r,n,i,o,s);let zt=Math.sign(e)*n*(B*(1-D/j)),Wt=Math.sign(t)*i*(V*(1-F/A)),ee=Math.sign(r)*o*(yt*(1-L/P)),Jt=2*Rt*Math.max(Math.abs(zt/j),Math.abs(Wt/A),Math.abs(ee/P));return!Number.isFinite(Jt)||Jt>2e-13*Math.max(n,i,o)?Ri(e,t,r,n,i,o,s):!Number.isFinite(zt)||!Number.isFinite(Wt)||!Number.isFinite(ee)?Ri(e,t,r,n,i,o,s):(s.x=zt,s.y=Wt,s.z=ee,!0)}dt>0?O=R:C=R;let St=R-dt/xt,k=St>O&&St<C?St:O+(C-O)/2;if(k===R)return Ri(e,t,r,n,i,o,s);R=k}return Ri(e,t,r,n,i,o,s)}function n1(e,t,r,n,i,o){let s=e-r,a=no(e,-r,s)+t-n,c=s+a,l=no(s,a,c),h=c-i;return(h+(no(c,-i,h)+l))/o}function no(e,t,r){let n=r-e;return e-(r-n)+(t-n)}function pa(e,t,r){let n=134217729*e,i=134217729*t;if(!Number.isFinite(n)||!Number.isFinite(i))return 0;let o=n-(n-e),s=i-(i-t),a=e-o,c=t-s;return o*s-r+o*c+a*s+a*c}var cx=w(()=>{r1()});function lx(e,t,r=[]){let n=e,i="x"in e?n.x:e[0],o="x"in e?n.y:e[1],s="x"in e?n.z:e[2];if(!Number.isFinite(i)||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(i*i+o*o+s*s))return;let{radii:a}=t;if(ax(i,o,s,a.x,a.y,a.z,sd))return Ci(r,sd.x,sd.y,sd.z)}function Ci(e,t,r,n){if(Vn(e))e[0]=t,e[1]=r,e[2]=n;else{let i=e;i.x=t,i.y=r,i.z=n}return e}var sd,hx=w(()=>{qt();cx();sd={x:0,y:0,z:0}});function ux(e,t){if(!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0||t>e)throw new Error("Spheroid requires finite positive axes with semiMinorAxis <= semiMajorAxis")}function ld(e,t,r,n){let i=Math.max(Math.abs(e),Math.abs(t),Math.abs(r));if(!(i>0)||!Number.isFinite(i))return;let o=e/i,s=t/i,a=r/i,c=Math.hypot(o,s,a);return Ci(n,o/c,s/c,a/c)}var tn,ad,XC,kn,cd,pt,hd=w(()=>{qt();qt();ix();sx();hx();tn={x:0,y:0,z:0},ad=new I,XC=new I,kn=new I,cd=new I,pt=class e{static fromSpheroid(t){let{semiMajorAxis:r,semiMinorAxis:n}=t;return ux(r,n),new e(r,r,n)}constructor(t=0,r=0,n=0){this.centerToleranceSquared=we.EPSILON1,pr(Number.isFinite(t)&&t>=0),pr(Number.isFinite(r)&&r>=0),pr(Number.isFinite(n)&&n>=0),this.radii=new I(t,r,n),this.radiiSquared=new I(t*t,r*r,n*n),this.radiiToTheFourth=new I(t*t*t*t,r*r*r*r,n*n*n*n),this.oneOverRadii=new I(t===0?0:1/t,r===0?0:1/r,n===0?0:1/n),this.oneOverRadiiSquared=new I(t===0?0:1/(t*t),r===0?0:1/(r*r),n===0?0:1/(n*n)),this.minimumRadius=Math.min(t,r,n),this.maximumRadius=Math.max(t,r,n),n!==0&&(this.squaredXOverSquaredZ=(t/n)**2),t===r&&n>0&&n<=t&&Number.isFinite(this.radiiSquared.x)&&this.radiiSquared.z>0&&(this.spheroidGeometry=Object.freeze({semiMajorAxis:t,semiMinorAxis:n,eccentricitySquared:1-(n/t)**2})),Object.freeze(this.radii),Object.freeze(this.radiiSquared),Object.freeze(this.radiiToTheFourth),Object.freeze(this.oneOverRadii),Object.freeze(this.oneOverRadiiSquared),Object.freeze(this)}toSpheroid(){let{x:t,y:r,z:n}=this.radii;if(t!==r)throw new Error("Spheroid requires equal X/Y radii");return ux(t,n),Object.freeze({semiMajorAxis:t,semiMinorAxis:n})}equals(t){return this===t||!!(t&&this.radii.equals(t.radii))}toString(){return this.radii.toString()}cartographicToCartesian(t,r=[0,0,0]){let n=ox(t,cd),i=n[0],o=n[1],s=n[2];if(!Number.isFinite(i)||!Number.isFinite(o)||!Number.isFinite(s)||!(this.minimumRadius>0)||!Number.isFinite(this.maximumRadius*this.maximumRadius))return;if(this.spheroidGeometry&&(ie._cartographicRadians||Math.abs(o)<=Math.PI/4))return tn.x=i,tn.y=o,tn.z=s,vh(tn,this.spheroidGeometry)?Ci(r,tn.x,tn.y,tn.z):void 0;let a=XC;this.geodeticSurfaceNormalCartographic(t,a);let c=a.x,l=a.y,h=a.z,u=this.radii.x,f=this.radii.y,d=this.radii.z,m=Math.hypot(u*c,f*l,d*h),p=u*(u*c/m)+s*c,g=f*(f*l/m)+s*l,y=d*(d*h/m)+s*h;if(!(!Number.isFinite(p)||!Number.isFinite(g)||!Number.isFinite(y)))return Ci(r,p,g,y)}cartesianToCartographic(t,r=[0,0,0]){let n=t,i="x"in t?n.x:t[0],o="x"in t?n.y:t[1],s="x"in t?n.z:t[2];if(!Number.isFinite(i)||!Number.isFinite(o)||!Number.isFinite(s))return;if(this.spheroidGeometry&&Number.isFinite(i*i+o*o+s*s)&&Number.isFinite(this.oneOverRadiiSquared.x)&&Number.isFinite(this.oneOverRadiiSquared.z)){tn.x=i,tn.y=o,tn.z=s;let _=this.spheroidGeometry;if(!(s===0&&_.semiMinorAxis<_.semiMajorAxis&&Math.abs(Math.hypot(i,o)-_.semiMajorAxis*_.eccentricitySquared)<=64*Number.EPSILON*_.semiMajorAxis)&&Eh(tn,_)){let x=i===0&&o===0?Math.atan2(o,i):tn.x;return t1(x,tn.y,tn.z,r)}}if(!(this.minimumRadius>0)||!Number.isFinite(this.maximumRadius*this.maximumRadius)||!Number.isFinite(1/(this.minimumRadius*this.minimumRadius)))return;cd.set(i,o,s);let a=this.scaleToGeodeticSurface(cd,kn);if(!a)return;let c=a[0]*this.oneOverRadiiSquared.x,l=a[1]*this.oneOverRadiiSquared.y,h=a[2]*this.oneOverRadiiSquared.z,u=Math.hypot(c,l,h);if(!(u>0)||!Number.isFinite(u))return;let f=c/u,d=l/u,m=h/u,p=Math.atan2(d,f),g=Math.atan2(m,Math.hypot(f,d)),y=(i-a[0])*f+(o-a[1])*d+(s-a[2])*m;return t1(p,g,y,r)}geocentricSurfaceNormal(t,r=[0,0,0]){ro(t,ad);let n=ad;return ld(n.x,n.y,n.z,r)}geodeticSurfaceNormalCartographic(t,r=[0,0,0]){let n=ro(t,cd),i=ie._cartographicRadians?n[0]:n[0]*Math.PI/180,o=ie._cartographicRadians?n[1]:n[1]*Math.PI/180,s=!ie._cartographicRadians&&Math.abs(n[1])>45,a=(90-Math.abs(n[1]))*Math.PI/180,c=s?Math.sin(a):Math.abs(o)===Math.PI/2?0:Math.cos(o),l=s?Math.sign(n[1])*Math.cos(a):Math.sin(o);return ld(c*Math.cos(i),c*Math.sin(i),l,r)}geodeticSurfaceNormal(t,r=[0,0,0]){if(!(this.minimumRadius>0))return;ro(t,ad);let n=ad,i=Math.max(Math.abs(n.x),Math.abs(n.y),Math.abs(n.z));if(!(i>0)||!Number.isFinite(i))return;let o=n.x/i*(this.minimumRadius/this.radii.x)**2,s=n.y/i*(this.minimumRadius/this.radii.y)**2,a=n.z/i*(this.minimumRadius/this.radii.z)**2;if((n.x===0||Math.abs(o)>=2**-1022)&&(n.y===0||Math.abs(s)>=2**-1022)&&(n.z===0||Math.abs(a)>=2**-1022))return ld(o,s,a,r);let c=n.x===0?0:Math.min(1023,Math.floor(Math.log2(Math.abs(n.x)))),l=n.y===0?0:Math.min(1023,Math.floor(Math.log2(Math.abs(n.y)))),h=n.z===0?0:Math.min(1023,Math.floor(Math.log2(Math.abs(n.z)))),u=Math.min(1023,Math.floor(Math.log2(this.radii.x))),f=Math.min(1023,Math.floor(Math.log2(this.radii.y))),d=Math.min(1023,Math.floor(Math.log2(this.radii.z))),m=Math.max(n.x===0?-1/0:c-2*u,n.y===0?-1/0:l-2*f,n.z===0?-1/0:h-2*d);return ld(n.x===0?n.x:n.x/2**c/(this.radii.x/2**u)**2*2**(c-2*u-m),n.y===0?n.y:n.y/2**l/(this.radii.y/2**f)**2*2**(l-2*f-m),n.z===0?n.z:n.z/2**h/(this.radii.z/2**d)**2*2**(h-2*d-m),r)}scaleToGeodeticSurface(t,r){return lx(t,this,r)}scaleToGeocentricSurface(t,r=[0,0,0]){ro(t,kn);let n=kn,i=Math.max(Math.abs(n.x),Math.abs(n.y),Math.abs(n.z));if(!(this.minimumRadius>0)||!(i>0)||!Number.isFinite(i))return;let o=n.x*n.x*this.oneOverRadiiSquared.x+n.y*n.y*this.oneOverRadiiSquared.y+n.z*n.z*this.oneOverRadiiSquared.z;if(o>=2**-1022&&Number.isFinite(o)&&i*i>=2**-1022&&Number.isFinite(i*i)){let h=1/Math.sqrt(o);return Ci(r,n.x*h,n.y*h,n.z*h)}let s=n.x/i,a=n.y/i,c=n.z/i,l=Math.hypot(s/this.radii.x,a/this.radii.y,c/this.radii.z);if(!(!(l>0)||!Number.isFinite(l)))return Ci(r,s/l,a/l,c/l)}transformPositionToScaledSpace(t,r=[0,0,0]){ro(t,kn);let n=kn.scale(this.oneOverRadii);return Ci(r,n.x,n.y,n.z)}transformPositionFromScaledSpace(t,r=[0,0,0]){ro(t,kn);let n=kn.scale(this.radii);return Ci(r,n.x,n.y,n.z)}getSurfaceNormalIntersectionWithZAxis(t,r=0,n=[0,0,0]){if(pr(this.radii.x===this.radii.y&&this.minimumRadius>0),ro(t,kn),!Number.isFinite(kn.x)||!Number.isFinite(kn.y)||!Number.isFinite(kn.z)||!Number.isFinite(r))return;let i=kn.z*(1-this.squaredXOverSquaredZ);if(Number.isFinite(i)&&!(Math.abs(i)>=this.radii.z-r))return Ci(n,0,0,i)}};pt.WGS84=new pt(6378137,6378137,eo)});var Th,fx,en,i1=w(()=>{qt();qt();Th=new I,fx=new I,en=class e{constructor(t=[0,0,0],r=0){this.radius=-0,this.center=new I,this.fromCenterRadius(t,r)}fromCenterRadius(t,r){return this.center.from(t),this.radius=r,this}fromCornerPoints(t,r){return r=Th.from(r),this.center=new I().from(t).add(r).scale(.5),this.radius=this.center.distance(r),this}equals(t){return this===t||!!t&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new e(this.center,this.radius)}union(t){let r=this.center,n=this.radius,i=t.center,o=t.radius,s=Th.copy(i).subtract(r),a=s.magnitude();if(n>=a+o)return this.clone();if(o>=a+n)return t.clone();let c=(n+a+o)*.5;return fx.copy(s).scale((-n+c)/a).add(r),this.center.copy(fx),this.radius=c,this}expand(t){let n=Th.from(t).subtract(this.center).magnitude();return n>this.radius&&(this.radius=n),this}transform(t){this.center.transform(t);let r=Og(Th,t);return this.radius=Math.max(r[0],Math.max(r[1],r[2]))*this.radius,this}distanceSquaredTo(t){let r=this.distanceTo(t);return r*r}distanceTo(t){let n=Th.from(t).subtract(this.center);return Math.max(0,n.len()-this.radius)}intersectPlane(t){let r=this.center,n=this.radius,o=t.normal.dot(r)+t.distance;return o<-n?"outside":o<n?"intersecting":"inside"}}});var ZC,JC,ud,fd,dd,QC,t8,io,oo,dx=w(()=>{qt();i1();ZC=new I,JC=new I,ud=new I,fd=new I,dd=new I,QC=new I,t8=new I,io={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},oo=class e{constructor(t=[0,0,0],r=[0,0,0,0,0,0,0,0,0]){this.center=new I().from(t),this.halfAxes=new Qr(r)}get halfSize(){let t=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2);return[new I(t).len(),new I(r).len(),new I(n).len()]}clone(){return new e(this.center,this.halfAxes)}equals(t){return this===t||!!t&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new en){let r=this.halfAxes,n=r.getColumn(0,ud),i=r.getColumn(1,fd),o=r.getColumn(2,dd),s=ZC.copy(n).add(i).add(o);return t.center.copy(this.center),t.radius=s.magnitude(),t}intersectPlane(t){let r=this.center,n=t.normal,i=this.halfAxes,o=n.x,s=n.y,a=n.z,c=Math.abs(o*i[io.COLUMN0ROW0]+s*i[io.COLUMN0ROW1]+a*i[io.COLUMN0ROW2])+Math.abs(o*i[io.COLUMN1ROW0]+s*i[io.COLUMN1ROW1]+a*i[io.COLUMN1ROW2])+Math.abs(o*i[io.COLUMN2ROW0]+s*i[io.COLUMN2ROW1]+a*i[io.COLUMN2ROW2]),l=n.dot(r)+t.distance;return l<=-c?"outside":l>=c?"inside":"intersecting"}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r=JC.from(t).subtract(this.center),n=this.halfAxes,i=n.getColumn(0,ud),o=n.getColumn(1,fd),s=n.getColumn(2,dd),a=i.magnitude(),c=o.magnitude(),l=s.magnitude();i.normalize(),o.normalize(),s.normalize();let h=0,u;return u=Math.abs(r.dot(i))-a,u>0&&(h+=u*u),u=Math.abs(r.dot(o))-c,u>0&&(h+=u*u),u=Math.abs(r.dot(s))-l,u>0&&(h+=u*u),h}computePlaneDistances(t,r,n=[-0,-0]){let i=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,s=this.center,a=this.halfAxes,c=a.getColumn(0,ud),l=a.getColumn(1,fd),h=a.getColumn(2,dd),u=QC.copy(c).add(l).add(h).add(s),f=t8.copy(u).subtract(t),d=r.dot(f);return i=Math.min(d,i),o=Math.max(d,o),u.copy(s).add(c).add(l).subtract(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),u.copy(s).add(c).subtract(l).add(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),u.copy(s).add(c).subtract(l).subtract(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),s.copy(u).subtract(c).add(l).add(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),s.copy(u).subtract(c).add(l).subtract(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),s.copy(u).subtract(c).subtract(l).add(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),s.copy(u).subtract(c).subtract(l).subtract(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),n[0]=i,n[1]=o,n}transform(t){this.center.transformAsPoint(t);let r=this.halfAxes.getColumn(0,ud);r.transformAsPoint(t);let n=this.halfAxes.getColumn(1,fd);n.transformAsPoint(t);let i=this.halfAxes.getColumn(2,dd);return i.transformAsPoint(t),this.halfAxes=new Qr([...r,...n,...i]),this}getTransform(){throw new Error("not implemented")}}});var mx,px,Ge,md=w(()=>{qt();mx=new I,px=new I,Ge=class e{constructor(t=[0,0,1],r=0){this.normal=new I,this.distance=-0,this.fromNormalDistance(t,r)}fromNormalDistance(t,r){return pr(Number.isFinite(r)),this.normal.from(t).normalize(),this.distance=r,this}fromPointNormal(t,r){t=mx.from(t),this.normal.from(r).normalize();let n=-this.normal.dot(t);return this.distance=n,this}fromCoefficients(t,r,n,i){return this.normal.set(t,r,n),pr(ko(this.normal.len(),1)),this.distance=i,this}clone(){return new e(this.normal,this.distance)}equals(t){return ko(this.distance,t.distance)&&ko(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let r=px.copy(this.normal).transformAsVector(t).normalize(),n=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(n,r)}projectPointOntoPlane(t,r=[0,0,0]){let n=mx.from(t),i=this.getPointDistance(n),o=px.copy(this.normal).scale(i);return n.subtract(o).to(r)}intersectWithRay(t,r=new I){let n=t.origin,i=t.direction,o=this.normal,s=o.dot(i);if(Math.abs(s)<we.EPSILON15)return;let a=(-this.distance-o.dot(n))/s;if(!(a<0))return r.copy(i).multiplyByScalar(a).add(n)}}});function gx(e,t={}){if(e.length!==16||Array.from(e).some(g=>!Number.isFinite(g)))throw new RangeError("Expected a finite view-projection matrix");let[r,n]=Jg(t),i=Math.min(r,n),o=Math.max(r,n),s=g=>[e[g],e[g+4],e[g+8],e[g+12]],a=s(0),c=s(1),l=s(2),h=s(3),u=(g,y,_)=>g.map((M,x)=>M+_*y[x]),f=u(l,h,-i),d=h.map((g,y)=>o*g-l[y]),m=[u(h,a,1),u(h,a,-1),u(h,c,1),u(h,c,-1),...t.reversedDepth?[d,f]:[f,d]],p=[];for(let[g,y,_,M]of m){let x=Math.hypot(g,y,_);if(x===0){if(M<0)throw new RangeError("Empty clipping volume")}else p.push(new Ge([g/x,y/x,_/x],M/x))}if(p.length<4)throw new RangeError("Degenerate clipping volume");return p}var yx=w(()=>{qt();md()});var wx,_x,e8,sr,Mx=w(()=>{qt();yx();md();wx=[new I([1,0,0]),new I([0,1,0]),new I([0,0,1])],_x=new I,e8=new I,sr=class e{constructor(t=[]){this.planes=t}fromBoundingSphere(t){this.planes.length=2*wx.length;let r=t.center,n=t.radius,i=0;for(let o of wx){let s=this.planes[i],a=this.planes[i+1];s||(s=this.planes[i]=new Ge),a||(a=this.planes[i+1]=new Ge);let c=_x.copy(o).scale(-n).add(r);s.fromPointNormal(c,o);let l=_x.copy(o).scale(n).add(r),h=e8.copy(o).negate();a.fromPointNormal(l,h),i+=2}return this}fromViewProjection(t,r={}){let n=gx(t,r);return this.planes.splice(0,this.planes.length,...n),this}computeVisibility(t){let r="inside";for(let n of this.planes)switch(t.intersectPlane(n)){case"outside":return"outside";case"intersecting":r="intersecting";break;default:}return r}computeVisibilityWithPlaneMask(t,r){if(pr(Number.isFinite(r),"parentPlaneMask is required."),r===e.MASK_OUTSIDE||r===e.MASK_INSIDE)return r;let n=e.MASK_INSIDE,i=this.planes;for(let o=0;o<this.planes.length;++o){let s=o<31?1<<o:0;if(o<31&&(r&s)===0)continue;let a=i[o],c=t.intersectPlane(a);if(c==="outside")return e.MASK_OUTSIDE;c==="intersecting"&&(n|=s)}return n}};sr.MASK_OUTSIDE=4294967295;sr.MASK_INSIDE=0;sr.MASK_INDETERMINATE=2147483647});var so=w(()=>{i1();dx();Mx();md()});function o1(e,t,r){let n=bx*e,i=bx*t,o=n-(n-e),s=e-o,a=i-(i-t),c=t-a;return o*a-r+o*c+s*a+s*c}function xx(e,t,r){let n=r-e;return e-(r-n)+(t-n)}function r8(e){return 2**Math.min(1023,Math.floor(Math.log2(e)))}function s1(e,t,r,n,i,o){let s=Math.max(Math.abs(e),Math.abs(t),Math.abs(r));if(s===0)return 0;let a=r8(s),c=e/a,l=t/a,h=r/a,u=c*n,f=l*i,d=h*o,m=u+f,p=m+d;return(p+(xx(u,f,m)+xx(m,d,p)+o1(c,n,u)+o1(l,i,f)+o1(h,o,d)))*a}function Sx(e,t,r,n,i,o,s){let c=(s?[s,s,s,s,0,0,0,1,0,0,0,1,1,0,0,o[0],o[1]]:[...e,...t,...r,...n,...i,...o]).map(T=>{let[S,E=""]=Math.abs(T).toString(2).split(".");return(T<0?-1n:1n)*BigInt("0b"+S+E)<<BigInt(1074-E.length)}),l=1n<<1074n,h=1n<<64n,u=[c[1]*c[2],c[0]*c[2],c[0]*c[1]],f=[0,1,2].map(T=>(c[3+T]*l+c[6+T]*c[15]+c[9+T]*c[16])*u[T]),d=c.slice(12,15).map((T,S)=>T*u[S]),m=(T,S)=>T.reduce((E,N,O)=>E+N*S[O],0n),p=m(d,d),g=m(d,f),y=m(f,f)-(c[0]*c[1]*c[2]*l)**2n,_=g*g-p*y;if(p===0n||_<0n)return;let M=_<<128n,x=M===0n?0n:1n<<BigInt(Math.ceil(M.toString(2).length/2));if(x)for(;;){let T=x+M/x>>1n;if(T>=x)break;x=T}let v=f.map((T,S)=>n8(T*p*h+d[S]*(x-g*h),p*h*u[S]));return s?v.map((T,S)=>r[S]*v[1]+n[S]*v[2]+i[S]*v[0]):v}function n8(e,t){return Math.sign(Number(e))*e1(e<0n?-e:e,t,-2148)}var bx,vx=w(()=>{r1();bx=134217729});function pd(e,t){if(e.length!==t)throw new RangeError(`Expected ${t} finite coordinates`);for(let r=0;r<t;r++)if(!Number.isFinite(e[r]))throw new RangeError(`Expected ${t} finite coordinates`)}function Ex(e){if(e!=="normal"&&e!=="radial")throw new RangeError("Invalid tangent-plane mode")}function Tx(e,t,r,n,i,o){let s=t*e.xAxis[0]+r*e.xAxis[1]+n*e.xAxis[2],a=t*e.yAxis[0]+r*e.yAxis[1]+n*e.yAxis[2];if(o!==void 0&&Math.abs((s/o)**2+(a/o)**2-1)<=32*Number.EPSILON&&(s=s1(t,r,n,e.xAxis[0],e.xAxis[1],e.xAxis[2]),a=s1(t,r,n,e.yAxis[0],e.yAxis[1],e.yAxis[2])),!(!Number.isFinite(s)||!Number.isFinite(a)))return i.set(s,a)}function a1(e,t,r,n){if([e,t,r].every(Number.isFinite))return n.set(e,t,r)}var gd,Ix=w(()=>{qt();so();hd();vx();gd=class{constructor(t,r=pt.WGS84){if(pd(t,3),this.radii=Object.freeze(Array.from(r.radii)),this.radii[0]===this.radii[1]&&this.radii[1]===this.radii[2]&&(this.radius=this.radii[0]),!this.radii.every(s=>s>0&&Number.isFinite(s)))throw new RangeError("Tangent plane requires positive finite ellipsoid radii");let n=r.scaleToGeodeticSurface(Array.from(t),new I);if(!n)throw new RangeError("Origin has no unique ellipsoid surface point");this.anchor=new I(n);let i=new I(r.geodeticSurfaceNormal(n));if(!i.every(Number.isFinite)||!(i.len()>0))throw new RangeError("Cannot resolve tangent-plane normal");i.normalize();let o=Math.hypot(i[0],i[1]);this.east=o>0?new I(-i[1]/o,i[0]/o,0):new I(0,1,0),this.north=new I(i).cross(this.east).normalize(),this._plane=new Ge().fromPointNormal(this.anchor,i)}projectPointToNearestOnPlane(t,r=new Jr){pd(t,3);let n=t[0]-this.anchor[0],i=t[1]-this.anchor[1],o=t[2]-this.anchor[2],s=Tx(this,n,i,o,r,this.radius);if(!s)throw new RangeError("Tangent-plane projection overflow");return s}projectPointRadiallyOntoPlane(t,r=new Jr){pd(t,3);let n=Math.max(Math.abs(t[0]),Math.abs(t[1]),Math.abs(t[2]));if(n===0)return;let i=t[0]/n,o=t[1]/n,s=t[2]/n,a=Math.hypot(i,o,s),c=i/a,l=o/a,h=s/a,u=this.zAxis,f=c*u[0]+l*u[1]+h*u[2];if(f<=1e-14)return;let d=this.anchor.dot(u)/f;return Tx(this,c*d-this.anchor[0],l*d-this.anchor[1],h*d-this.anchor[2],r,this.radius)}projectPointOntoEllipsoid(t,r="radial",n=new I){pd(t,2),Ex(r);let[i,o,s]=this.radii;if(r==="radial"){let E=Math.max(Math.abs(this.anchor[0]),Math.abs(this.anchor[1]),Math.abs(this.anchor[2]),Math.abs(t[0]),Math.abs(t[1])),N=t[0]/E,O=t[1]/E,C=this.anchor[0]/E+this.east[0]*N+this.north[0]*O,R=this.anchor[1]/E+this.east[1]*N+this.north[1]*O,W=this.anchor[2]/E+this.east[2]*N+this.north[2]*O,j=Math.min(i,o,s),A=C*(j/i),P=R*(j/o),D=W*(j/s),F=Math.hypot(A,P,D);return F>0&&Number.isFinite(F)?a1(i*(A/F),o*(P/F),s*(D/F),n):void 0}let a=this.zAxis,c=[this.anchor[0]+this.east[0]*t[0]+this.north[0]*t[1],this.anchor[1]+this.east[1]*t[0]+this.north[1]*t[1],this.anchor[2]+this.east[2]*t[0]+this.north[2]*t[1]];if(!c.every(Number.isFinite))return;let l=a[0]/i,h=a[1]/o,u=a[2]/s,f=c[0]/i,d=c[1]/o,m=c[2]/s,p=l*l+h*h+u*u,g=l*f+h*d+u*m,y=f*f+d*d+m*m-1,_=g*g,M=p*y,x=1e-6*(Math.abs(_)+Math.abs(M)),v=_-M;if(!(p>0)||!Number.isFinite(v)||Math.abs(v)<=x){let E=Sx(this.radii,this.anchor,this.east,this.north,a,t,this.radius);return E&&a1(E[0],E[1],E[2],n)}if(v<0)return;let T=Math.sqrt(Math.max(0,v)),S=g>0?-y/(g+T):(-g+T)/p;return a1(c[0]+S*a[0],c[1]+S*a[1],c[2]+S*a[2],n)}projectPointsFlat(t,r="normal",n){if(Ex(r),t.length%3)throw new RangeError("Expected packed XYZ coordinates");let i=t.length/3,o=n||new Float64Array(i*2);if(o.length!==i*2)throw new RangeError("Invalid tangent-plane output length");if(ArrayBuffer.isView(t)&&t.buffer===o.buffer&&t.byteOffset<o.byteOffset+o.byteLength&&o.byteOffset<t.byteOffset+t.byteLength)throw new RangeError("Input and output buffers must not overlap");for(let l=0;l<t.length;l++)if(!Number.isFinite(t[l]))throw new RangeError("Expected finite coordinates");let s=new Uint8Array(i),a=new I,c=new Jr;for(let l=0;l<i;l++){a.set(t[l*3],t[l*3+1],t[l*3+2]);let h=r==="normal"?this.projectPointToNearestOnPlane(a,c):this.projectPointRadiallyOntoPlane(a,c);s[l]=h?1:0,o[l*2]=h?h[0]:NaN,o[l*2+1]=h?h[1]:NaN}return{positions:o,valid:s}}get plane(){return this._plane}get origin(){return this.anchor}get xAxis(){return this.east}get yAxis(){return this.north}get zAxis(){return this._plane.normal}}});var ke,Ax=w(()=>{ke={};ke.Constants={};ke.Math={};ke.Accumulator={};(function(e){"use strict";e.WGS84={a:6378137,f:1/298.257223563},e.version={major:2,minor:2,patch:0},e.version_string="2.2.0"})(ke.Constants);(function(e){"use strict";e.digits=53,e.epsilon=Math.pow(.5,e.digits-1),e.degree=Math.PI/180,e.sq=function(t){return t*t},e.hypot=function(t,r){return Math.sqrt(t*t+r*r)},e.cbrt=Math.cbrt||function(t){var r=Math.pow(Math.abs(t),.3333333333333333);return t>0?r:t<0?-r:t},e.log1p=Math.log1p||function(t){var r=1+t,n=r-1;return n===0?t:t*Math.log(r)/n},e.atanh=Math.atanh||function(t){var r=Math.abs(t);return r=e.log1p(2*r/(1-r))/2,t>0?r:t<0?-r:t},e.copysign=function(t,r){return Math.abs(t)*(r<0||r===0&&1/r<0?-1:1)},e.sum=function(t,r){var n=t+r,i=n-r,o=n-i,s;return i-=t,o-=r,s=n&&0-(i+o),{s:n,t:s}},e.polyval=function(t,r,n,i){for(var o=t<0?0:r[n++];--t>=0;)o=o*i+r[n++];return o},e.AngRound=function(t){var r=.0625,n=Math.abs(t);return n=n<r?r-(r-n):n,e.copysign(n,t)},e.remainder=function(t,r){return t%=r,t<-r/2?t+r:t<r/2?t:t-r},e.AngNormalize=function(t){var r=e.remainder(t,360);return Math.abs(r)===180?e.copysign(180,t):r},e.LatFix=function(t){return Math.abs(t)>90?NaN:t},e.AngDiff=function(t,r){var n=e.sum(e.remainder(-t,360),e.remainder(r,360)),i,o;return n=e.sum(e.remainder(n.s,360),n.t),i=n.s,o=n.t,(i===0||Math.abs(i)===180)&&(i=e.copysign(i,o===0?r-t:-o)),{d:i,e:o}},e.sincosd=function(t){var r,n,i,o,s,a,c;switch(r=t%360,i=Math.round(r/90),r-=90*i,n=r*this.degree,o=Math.sin(n),s=Math.cos(n),Math.abs(r)===45?(s=Math.sqrt(.5),o=e.copysign(s,n)):Math.abs(r)===30&&(s=Math.sqrt(.75),o=e.copysign(.5,n)),i&3){case 0:a=o,c=s;break;case 1:a=s,c=-o;break;case 2:a=-o,c=-s;break;default:a=-s,c=o;break}return c+=0,a===0&&(a=e.copysign(a,t)),{s:a,c}},e.sincosde=function(t,r){var n,i,o,s,a,c,l;switch(n=t%360,o=Math.round(n/90),n=e.AngRound(n-90*o+r),i=n*this.degree,s=Math.sin(i),a=Math.cos(i),Math.abs(n)===45?(a=Math.sqrt(.5),s=e.copysign(a,i)):Math.abs(n)===30&&(a=Math.sqrt(.75),s=e.copysign(.5,i)),o&3){case 0:c=s,l=a;break;case 1:c=a,l=-s;break;case 2:c=-s,l=-a;break;default:c=-a,l=s;break}return l+=0,c===0&&(c=e.copysign(c,t+r)),{s:c,c:l}},e.atan2d=function(t,r){var n=0,i;switch(Math.abs(t)>Math.abs(r)&&([t,r]=[r,t],n=2),e.copysign(1,r)<0&&(r=-r,++n),i=Math.atan2(t,r)/this.degree,n){case 1:i=e.copysign(180,t)-i;break;case 2:i=90-i;break;case 3:i=-90+i;break;default:break}return i}})(ke.Math);(function(e,t){"use strict";e.Accumulator=function(r){this.Set(r)},e.Accumulator.prototype.Set=function(r){r||(r=0),r.constructor===e.Accumulator?(this._s=r._s,this._t=r._t):(this._s=r,this._t=0)},e.Accumulator.prototype.Add=function(r){var n=t.sum(r,this._t),i=t.sum(n.s,this._s);n=n.t,this._s=i.s,this._t=i.t,this._s===0?this._s=n:this._t+=n},e.Accumulator.prototype.Sum=function(r){var n;return r?(n=new e.Accumulator(this),n.Add(r),n._s):this._s},e.Accumulator.prototype.Negate=function(){this._s*=-1,this._t*=-1},e.Accumulator.prototype.Remainder=function(r){this._s=t.remainder(this._s,r),this.Add(0)}})(ke.Accumulator,ke.Math);ke.Geodesic={};ke.GeodesicLine={};ke.PolygonArea={};(function(e,t,r,n,i){"use strict";var o=6,s=o,a=o,c=o,l=c,h,u,f=20,d=f+n.digits+10,m=n.epsilon,p=200*m,g=Math.sqrt(m),y=m,_=1e3*g,M=0,x=31,v=32640,T,S,E,N,O,C,R,W,j;e.tiny_=Math.sqrt(Number.MIN_VALUE/Number.EPSILON),e.nC1_=o,e.nC1p_=o,e.nC2_=o,e.nC3_=o,e.nC4_=o,h=e.nC3_*(e.nC3_-1)/2,u=e.nC4_*(e.nC4_+1)/2,e.CAP_C1=1,e.CAP_C1p=2,e.CAP_C2=4,e.CAP_C3=8,e.CAP_C4=16,e.NONE=0,e.ARC=64,e.LATITUDE=128|M,e.LONGITUDE=256|e.CAP_C3,e.AZIMUTH=512|M,e.DISTANCE=1024|e.CAP_C1,e.STANDARD=e.LATITUDE|e.LONGITUDE|e.AZIMUTH|e.DISTANCE,e.DISTANCE_IN=2048|e.CAP_C1|e.CAP_C1p,e.REDUCEDLENGTH=4096|e.CAP_C1|e.CAP_C2,e.GEODESICSCALE=8192|e.CAP_C1|e.CAP_C2,e.AREA=16384|e.CAP_C4,e.ALL=v|x,e.LONG_UNROLL=32768,e.OUT_MASK=v|e.LONG_UNROLL,e.SinCosSeries=function(A,P,D,F,L){if(L!==void 0){var B=L/2,V=Math.sin(B),yt=Math.cos(B);return-2*e.SinCosSeries(!1,D*yt-P*V,P*yt+D*V,F.map(function(St,k){return(k%2?-St:St)*Math.sin((2*k+1)*B)}))}var Dt=F.length,X=Dt-(A?1:0),xt=2*(D-P)*(D+P),et=X&1?F[--Dt]:0,dt=0;for(X=Math.floor(X/2);X--;)dt=xt*et-dt+F[--Dt],et=xt*dt-et+F[--Dt];return A?2*P*D*et:D*(et-dt)},T=function(A,P){var D,F=n.sq(A),L=n.sq(P),B=(F+L-1)/6,V,yt,Dt,X,xt,et,dt,St,k,Rt,zt;return L===0&&B<=0?D=0:(V=F*L/4,yt=n.sq(B),Dt=B*yt,X=V*(V+2*Dt),xt=B,X>=0?(et=V+Dt,et+=et<0?-Math.sqrt(X):Math.sqrt(X),dt=n.cbrt(et),xt+=dt+(dt!==0?yt/dt:0)):(St=Math.atan2(Math.sqrt(-X),-(V+Dt)),xt+=2*B*Math.cos(St/3)),k=Math.sqrt(n.sq(xt)+L),Rt=xt<0?L/(k-xt):xt+k,zt=(Rt-L)/(2*k),D=Rt/(Math.sqrt(Rt+n.sq(zt))+zt)),D},S=[1,4,64,0,256],e.A1m1f=function(A){var P=Math.floor(s/2),D=n.polyval(P,S,0,n.sq(A))/S[P+1];return(D+A)/(1-A)},E=[-1,6,-16,32,-9,64,-128,2048,9,-16,768,3,-5,512,-7,1280,-7,2048],e.C1f=function(A,P){var D=n.sq(A),F=A,L=0,B,V;for(B=1;B<=e.nC1_;++B)V=Math.floor((e.nC1_-B)/2),P[B]=F*n.polyval(V,E,L,D)/E[L+V+1],L+=V+2,F*=A},N=[205,-432,768,1536,4005,-4736,3840,12288,-225,116,384,-7173,2695,7680,3467,7680,38081,61440],e.C1pf=function(A,P){var D=n.sq(A),F=A,L=0,B,V;for(B=1;B<=e.nC1p_;++B)V=Math.floor((e.nC1p_-B)/2),P[B]=F*n.polyval(V,N,L,D)/N[L+V+1],L+=V+2,F*=A},O=[-11,-28,-192,0,256],e.A2m1f=function(A){var P=Math.floor(a/2),D=n.polyval(P,O,0,n.sq(A))/O[P+1];return(D-A)/(1+A)},C=[1,2,16,32,35,64,384,2048,15,80,768,7,35,512,63,1280,77,2048],e.C2f=function(A,P){var D=n.sq(A),F=A,L=0,B,V;for(B=1;B<=e.nC2_;++B)V=Math.floor((e.nC2_-B)/2),P[B]=F*n.polyval(V,C,L,D)/C[L+V+1],L+=V+2,F*=A},e.Geodesic=function(A,P){if(this.a=A,this.f=P,this._f1=1-this.f,this._e2=this.f*(2-this.f),this._ep2=this._e2/n.sq(this._f1),this._n=this.f/(2-this.f),this._b=this.a*this._f1,this._c2=(n.sq(this.a)+n.sq(this._b)*(this._e2===0?1:(this._e2>0?n.atanh(Math.sqrt(this._e2)):Math.atan(Math.sqrt(-this._e2)))/Math.sqrt(Math.abs(this._e2))))/2,this._etol2=.1*g/Math.sqrt(Math.max(.001,Math.abs(this.f))*Math.min(1,1-this.f/2)/2),!(isFinite(this.a)&&this.a>0))throw new Error("Equatorial radius is not positive");if(!(isFinite(this._b)&&this._b>0))throw new Error("Polar semi-axis is not positive");this._A3x=new Array(l),this._C3x=new Array(h),this._C4x=new Array(u),this.A3coeff(),this.C3coeff(),this.C4coeff()},R=[-3,128,-2,-3,64,-1,-3,-1,16,3,-1,-2,8,1,-1,2,1,1],e.Geodesic.prototype.A3coeff=function(){var A=0,P=0,D,F;for(D=c-1;D>=0;--D)F=Math.min(c-D-1,D),this._A3x[P++]=n.polyval(F,R,A,this._n)/R[A+F+1],A+=F+2},W=[3,128,2,5,128,-1,3,3,64,-1,0,1,8,-1,1,4,5,256,1,3,128,-3,-2,3,64,1,-3,2,32,7,512,-10,9,384,5,-9,5,192,7,512,-14,7,512,21,2560],e.Geodesic.prototype.C3coeff=function(){var A=0,P=0,D,F,L;for(D=1;D<e.nC3_;++D)for(F=e.nC3_-1;F>=D;--F)L=Math.min(e.nC3_-F-1,F),this._C3x[P++]=n.polyval(L,W,A,this._n)/W[A+L+1],A+=L+2},j=[97,15015,1088,156,45045,-224,-4784,1573,45045,-10656,14144,-4576,-858,45045,64,624,-4576,6864,-3003,15015,100,208,572,3432,-12012,30030,45045,1,9009,-2944,468,135135,5792,1040,-1287,135135,5952,-11648,9152,-2574,135135,-64,-624,4576,-6864,3003,135135,8,10725,1856,-936,225225,-8448,4992,-1144,225225,-1440,4160,-4576,1716,225225,-136,63063,1024,-208,105105,3584,-3328,1144,315315,-128,135135,-2560,832,405405,128,99099],e.Geodesic.prototype.C4coeff=function(){var A=0,P=0,D,F,L;for(D=0;D<e.nC4_;++D)for(F=e.nC4_-1;F>=D;--F)L=e.nC4_-F-1,this._C4x[P++]=n.polyval(L,j,A,this._n)/j[A+L+1],A+=L+2},e.Geodesic.prototype.A3f=function(A){return n.polyval(l-1,this._A3x,0,A)},e.Geodesic.prototype.C3f=function(A,P){var D=1,F=0,L,B;for(L=1;L<e.nC3_;++L)B=e.nC3_-L-1,D*=A,P[L]=D*n.polyval(B,this._C3x,F,A),F+=B+1},e.Geodesic.prototype.C4f=function(A,P){var D=1,F=0,L,B;for(L=0;L<e.nC4_;++L)B=e.nC4_-L-1,P[L]=D*n.polyval(B,this._C4x,F,A),F+=B+1,D*=A},e.Geodesic.prototype.Lengths=function(A,P,D,F,L,B,V,yt,Dt,X,xt,et,dt){xt&=e.OUT_MASK;var St={},k=0,Rt=0,zt=0,Wt=0,ee,Jt,ye,Oe,Ue;if(xt&(e.DISTANCE|e.REDUCEDLENGTH|e.GEODESICSCALE)&&(zt=e.A1m1f(A),e.C1f(A,et),xt&(e.REDUCEDLENGTH|e.GEODESICSCALE)&&(Wt=e.A2m1f(A),e.C2f(A,dt),k=zt-Wt,Wt=1+Wt),zt=1+zt),xt&e.DISTANCE)ee=e.SinCosSeries(!0,B,V,et)-e.SinCosSeries(!0,D,F,et),St.s12b=zt*(P+ee),xt&(e.REDUCEDLENGTH|e.GEODESICSCALE)&&(Jt=e.SinCosSeries(!0,B,V,dt)-e.SinCosSeries(!0,D,F,dt),Rt=k*P+(zt*ee-Wt*Jt));else if(xt&(e.REDUCEDLENGTH|e.GEODESICSCALE)){for(ye=1;ye<=e.nC2_;++ye)dt[ye]=zt*et[ye]-Wt*dt[ye];Rt=k*P+(e.SinCosSeries(!0,B,V,dt)-e.SinCosSeries(!0,D,F,dt))}return xt&e.REDUCEDLENGTH?(St.m0=k,St.m12b=yt*(F*B)-L*(D*V)-F*V*Rt):St.m12b=NaN,xt&e.GEODESICSCALE&&(Oe=F*V+D*B,Ue=this._ep2*(Dt-X)*(Dt+X)/(L+yt),St.M12=Oe+(Ue*B-V*Rt)*D/L,St.M21=Oe-(Ue*D-F*Rt)*B/yt),St},e.Geodesic.prototype.InverseStart=function(A,P,D,F,L,B,V,yt,Dt,X,xt){var et={},dt=F*P-L*A,St=L*P+F*A,k,Rt,zt,Wt,ee,Jt,ye,Oe,Ue,Ft,Bt,Ut,Le,Qe,Uo,Go,Kl,Ai,Kt,Br,or,Xr,pn;return et.sig12=-1,k=F*P,k+=L*A,Rt=St>=0&&dt<.5&&L*V<.5,Rt?(Wt=n.sq(A+F),Wt/=Wt+n.sq(P+L),et.dnm=Math.sqrt(1+this._ep2*Wt),zt=V/(this._f1*et.dnm),ee=Math.sin(zt),Jt=Math.cos(zt)):(ee=yt,Jt=Dt),et.salp1=L*ee,et.calp1=Jt>=0?dt+L*A*n.sq(ee)/(1+Jt):k-L*A*n.sq(ee)/(1-Jt),Oe=n.hypot(et.salp1,et.calp1),Ue=A*F+P*L*Jt,Rt&&Oe<this._etol2?(et.salp2=P*ee,et.calp2=dt-P*F*(Jt>=0?n.sq(ee)/(1+Jt):1-Jt),ye=n.hypot(et.salp2,et.calp2),et.salp2/=ye,et.calp2/=ye,et.sig12=Math.atan2(Oe,Ue)):Math.abs(this._n)>.1||Ue>=0||Oe>=6*Math.abs(this._n)*Math.PI*n.sq(P)||(pn=Math.atan2(-yt,-Dt),this.f>=0?(Qe=n.sq(A)*this._ep2,Uo=Qe/(2*(1+Math.sqrt(1+Qe))+Qe),Ut=this.f*P*this.A3f(Uo)*Math.PI,Le=Ut*P,Ft=pn/Ut,Bt=k/Le):(Go=L*P-F*A,Kl=Math.atan2(k,Go),Br=this.Lengths(this._n,Math.PI+Kl,A,-P,D,F,L,B,P,L,e.REDUCEDLENGTH,X,xt),Ai=Br.m12b,Kt=Br.m0,Ft=-1+Ai/(P*L*Kt*Math.PI),Le=Ft<-.01?k/Ft:-this.f*n.sq(P)*Math.PI,Ut=Le/P,Bt=V/Ut),Bt>-p&&Ft>-1-_?this.f>=0?(et.salp1=Math.min(1,-Ft),et.calp1=-Math.sqrt(1-n.sq(et.salp1))):(et.calp1=Math.max(Ft>-p?0:-1,Ft),et.salp1=Math.sqrt(1-n.sq(et.calp1))):(or=T(Ft,Bt),Xr=Ut*(this.f>=0?-Ft*or/(1+or):-Bt*(1+or)/or),ee=Math.sin(Xr),Jt=-Math.cos(Xr),et.salp1=L*ee,et.calp1=k-L*A*n.sq(ee)/(1-Jt))),et.salp1<=0?(et.salp1=1,et.calp1=0):(ye=n.hypot(et.salp1,et.calp1),et.salp1/=ye,et.calp1/=ye),et},e.Geodesic.prototype.Lambda12=function(A,P,D,F,L,B,V,yt,Dt,X,xt,et,dt,St){var k={},Rt,zt,Wt,ee,Jt,ye,Oe,Ue,Ft,Bt,Ut,Le,Qe;return A===0&&yt===0&&(yt=-e.tiny_),zt=V*P,Wt=n.hypot(yt,V*A),k.ssig1=A,ee=zt*A,k.csig1=Jt=yt*P,Rt=n.hypot(k.ssig1,k.csig1),k.ssig1/=Rt,k.csig1/=Rt,k.salp2=L!==P?zt/L:V,k.calp2=L!==P||Math.abs(F)!==-A?Math.sqrt(n.sq(yt*P)+(P<-A?(L-P)*(P+L):(A-F)*(A+F)))/L:Math.abs(yt),k.ssig2=F,ye=zt*F,k.csig2=Oe=k.calp2*L,Rt=n.hypot(k.ssig2,k.csig2),k.ssig2/=Rt,k.csig2/=Rt,k.sig12=Math.atan2(Math.max(0,k.csig1*k.ssig2-k.ssig1*k.csig2),k.csig1*k.csig2+k.ssig1*k.ssig2),Ue=Math.max(0,Jt*ye-ee*Oe),Ft=Jt*Oe+ee*ye,Ut=Math.atan2(Ue*X-Ft*Dt,Ft*X+Ue*Dt),Le=n.sq(Wt)*this._ep2,k.eps=Le/(2*(1+Math.sqrt(1+Le))+Le),this.C3f(k.eps,St),Bt=e.SinCosSeries(!0,k.ssig2,k.csig2,St)-e.SinCosSeries(!0,k.ssig1,k.csig1,St),k.domg12=-this.f*this.A3f(k.eps)*zt*(k.sig12+Bt),k.lam12=Ut+k.domg12,xt&&(k.calp2===0?k.dlam12=-2*this._f1*D/A:(Qe=this.Lengths(k.eps,k.sig12,k.ssig1,k.csig1,D,k.ssig2,k.csig2,B,P,L,e.REDUCEDLENGTH,et,dt),k.dlam12=Qe.m12b,k.dlam12*=this._f1/(k.calp2*L))),k},e.Geodesic.prototype.Inverse=function(A,P,D,F,L){var B,V;return L||(L=e.STANDARD),L===e.LONG_UNROLL&&(L|=e.STANDARD),L&=e.OUT_MASK,B=this.InverseInt(A,P,D,F,L),V=B.vals,L&e.AZIMUTH&&(V.azi1=n.atan2d(B.salp1,B.calp1),V.azi2=n.atan2d(B.salp2,B.calp2)),V},e.Geodesic.prototype.InverseInt=function(A,P,D,F,L){var B={},V,yt,Dt,X,xt,et,dt,St,k,Rt,zt,Wt,ee,Jt,ye,Oe,Ue,Ft,Bt,Ut,Le,Qe,Uo,Go,Kl,Ai,Kt,Br,or,Xr,pn,rf,nf,xc,ha,Xl,Zl,Jl,Ql,of,w0,Sc,_0,sf,M0,b0,x0,CM,S0,af,v0,cf,NM,th,BM,OM,eh,lf,rh,E0,T0,hf,uf,I0,A0;if(B.lat1=A=n.LatFix(A),B.lat2=D=n.LatFix(D),A=n.AngRound(A),D=n.AngRound(D),V=n.AngDiff(P,F),yt=V.e,V=V.d,L&e.LONG_UNROLL?(B.lon1=P,B.lon2=P+V+yt):(B.lon1=n.AngNormalize(P),B.lon2=n.AngNormalize(F)),Dt=n.copysign(1,V),V*=Dt,yt*=Dt,ye=V*n.degree,X=n.sincosde(V,yt),Oe=X.s,Ue=X.c,yt=180-V-yt,xt=Math.abs(A)<Math.abs(D)||isNaN(D)?-1:1,xt<0&&(Dt*=-1,[D,A]=[A,D]),et=n.copysign(1,-A),A*=et,D*=et,X=n.sincosd(A),dt=this._f1*X.s,St=X.c,X=n.hypot(dt,St),dt/=X,St/=X,St=Math.max(e.tiny_,St),X=n.sincosd(D),k=this._f1*X.s,Rt=X.c,X=n.hypot(k,Rt),k/=X,Rt/=X,Rt=Math.max(e.tiny_,Rt),St<-dt?Rt===St&&(k=n.copysign(dt,k)):Math.abs(k)===-dt&&(Rt=St),ee=Math.sqrt(1+this._ep2*n.sq(dt)),Jt=Math.sqrt(1+this._ep2*n.sq(k)),Uo=new Array(e.nC1_+1),Go=new Array(e.nC2_+1),Kl=new Array(e.nC3_),Ai=A===-90||Oe===0,Ai&&(Bt=Ue,Ut=Oe,Le=1,Qe=0,Br=dt,or=Bt*St,Xr=k,pn=Le*Rt,Ft=Math.atan2(Math.max(0,or*Xr-Br*pn),or*pn+Br*Xr),Kt=this.Lengths(this._n,Ft,Br,or,ee,Xr,pn,Jt,St,Rt,L|e.DISTANCE|e.REDUCEDLENGTH,Uo,Go),zt=Kt.s12b,Wt=Kt.m12b,L&e.GEODESICSCALE&&(B.M12=Kt.M12,B.M21=Kt.M21),Ft<g||Wt>=0?((Ft<3*e.tiny_||Ft<m&&(zt<0||Wt<0))&&(Ft=Wt=zt=0),Wt*=this._b,zt*=this._b,B.a12=Ft/n.degree):Ai=!1),eh=2,!Ai&&dt===0&&(this.f<=0||yt>=this.f*180))Bt=Le=0,Ut=Qe=1,zt=this.a*ye,Ft=nf=ye/this._f1,Wt=this._b*Math.sin(Ft),L&e.GEODESICSCALE&&(B.M12=B.M21=Math.cos(Ft)),B.a12=V/this._f1;else if(!Ai)if(Kt=this.InverseStart(dt,St,ee,k,Rt,Jt,ye,Oe,Ue,Uo,Go),Ft=Kt.sig12,Ut=Kt.salp1,Bt=Kt.calp1,Ft>=0)Qe=Kt.salp2,Le=Kt.calp2,xc=Kt.dnm,zt=Ft*this._b*xc,Wt=n.sq(xc)*this._b*Math.sin(Ft/xc),L&e.GEODESICSCALE&&(B.M12=B.M21=Math.cos(Ft/xc)),B.a12=Ft/n.degree,nf=ye/(this._f1*xc);else{for(ha=0,Xl=e.tiny_,Zl=1,Jl=e.tiny_,Ql=-1,of=!1,w0=!1;Kt=this.Lambda12(dt,St,ee,k,Rt,Jt,Ut,Bt,Oe,Ue,ha<f,Uo,Go,Kl),Sc=Kt.lam12,Qe=Kt.salp2,Le=Kt.calp2,Ft=Kt.sig12,Br=Kt.ssig1,or=Kt.csig1,Xr=Kt.ssig2,pn=Kt.csig2,rf=Kt.eps,rh=Kt.domg12,_0=Kt.dlam12,!(w0||!(Math.abs(Sc)>=(of?8:1)*m)||ha==d);++ha){if(Sc>0&&(ha<f||Bt/Ut>Ql/Jl)?(Jl=Ut,Ql=Bt):Sc<0&&(ha<f||Bt/Ut<Zl/Xl)&&(Xl=Ut,Zl=Bt),ha<f&&_0>0&&(sf=-Sc/_0,Math.abs(sf)<Math.PI&&(M0=Math.sin(sf),b0=Math.cos(sf),x0=Ut*b0+Bt*M0,x0>0))){Bt=Bt*b0-Ut*M0,Ut=x0,X=n.hypot(Ut,Bt),Ut/=X,Bt/=X,of=Math.abs(Sc)<=16*m;continue}Ut=(Xl+Jl)/2,Bt=(Zl+Ql)/2,X=n.hypot(Ut,Bt),Ut/=X,Bt/=X,of=!1,w0=Math.abs(Xl-Ut)+(Zl-Bt)<y||Math.abs(Ut-Jl)+(Bt-Ql)<y}CM=L|(L&(e.REDUCEDLENGTH|e.GEODESICSCALE)?e.DISTANCE:e.NONE),Kt=this.Lengths(rf,Ft,Br,or,ee,Xr,pn,Jt,St,Rt,CM,Uo,Go),zt=Kt.s12b,Wt=Kt.m12b,L&e.GEODESICSCALE&&(B.M12=Kt.M12,B.M21=Kt.M21),Wt*=this._b,zt*=this._b,B.a12=Ft/n.degree,L&e.AREA&&(I0=Math.sin(rh),A0=Math.cos(rh),eh=Oe*A0-Ue*I0,lf=Ue*A0+Oe*I0)}return L&e.DISTANCE&&(B.s12=0+zt),L&e.REDUCEDLENGTH&&(B.m12=0+Wt),L&e.AREA&&(S0=Ut*St,af=n.hypot(Bt,Ut*dt),af!==0&&S0!==0?(Br=dt,or=Bt*St,Xr=k,pn=Le*Rt,cf=n.sq(af)*this._ep2,rf=cf/(2*(1+Math.sqrt(1+cf))+cf),NM=n.sq(this.a)*af*S0*this._e2,X=n.hypot(Br,or),Br/=X,or/=X,X=n.hypot(Xr,pn),Xr/=X,pn/=X,th=new Array(e.nC4_),this.C4f(rf,th),BM=e.SinCosSeries(!1,Br,or,th),OM=e.SinCosSeries(!1,Xr,pn,th),B.S12=NM*(Ft<.01?e.SinCosSeries(!1,Br,or,th,Ft):OM-BM)):B.S12=0,!Ai&&eh==2&&(eh=Math.sin(nf),lf=Math.cos(nf)),!Ai&&lf>-.7071&&k-dt<1.75?(rh=1+lf,E0=1+St,T0=1+Rt,v0=2*Math.atan2(eh*(dt*T0+k*E0),rh*(dt*k+E0*T0))):(hf=Qe*Bt-Le*Ut,uf=Le*Bt+Qe*Ut,hf===0&&uf<0&&(hf=e.tiny_*Bt,uf=-1),v0=Math.atan2(hf,uf)),B.S12+=this._c2*v0,B.S12*=xt*Dt*et,B.S12+=0),xt<0&&([Qe,Ut]=[Ut,Qe],[Le,Bt]=[Bt,Le],L&e.GEODESICSCALE&&([B.M21,B.M12]=[B.M12,B.M21])),Ut*=xt*Dt,Bt*=xt*et,Qe*=xt*Dt,Le*=xt*et,{vals:B,salp1:Ut,calp1:Bt,salp2:Qe,calp2:Le}},e.Geodesic.prototype.GenDirect=function(A,P,D,F,L,B){var V;return B?B===e.LONG_UNROLL&&(B|=e.STANDARD):B=e.STANDARD,F||(B|=e.DISTANCE_IN),V=new t.GeodesicLine(this,A,P,D,B),V.GenPosition(F,L,B)},e.Geodesic.prototype.Direct=function(A,P,D,F,L){return this.GenDirect(A,P,D,!1,F,L)},e.Geodesic.prototype.ArcDirect=function(A,P,D,F,L){return this.GenDirect(A,P,D,!0,F,L)},e.Geodesic.prototype.Line=function(A,P,D,F){return new t.GeodesicLine(this,A,P,D,F)},e.Geodesic.prototype.DirectLine=function(A,P,D,F,L){return this.GenDirectLine(A,P,D,!1,F,L)},e.Geodesic.prototype.ArcDirectLine=function(A,P,D,F,L){return this.GenDirectLine(A,P,D,!0,F,L)},e.Geodesic.prototype.GenDirectLine=function(A,P,D,F,L,B){var V;return B||(B=e.STANDARD|e.DISTANCE_IN),F||(B|=e.DISTANCE_IN),V=new t.GeodesicLine(this,A,P,D,B),V.GenSetDistance(F,L),V},e.Geodesic.prototype.InverseLine=function(A,P,D,F,L){var B,V,yt;return L||(L=e.STANDARD|e.DISTANCE_IN),B=this.InverseInt(A,P,D,F,e.ARC),yt=n.atan2d(B.salp1,B.calp1),L&(e.OUT_MASK&e.DISTANCE_IN)&&(L|=e.DISTANCE),V=new t.GeodesicLine(this,A,P,yt,L,B.salp1,B.calp1),V.SetArc(B.vals.a12),V},e.Geodesic.prototype.Polygon=function(A){return new r.PolygonArea(this,A)},e.WGS84=new e.Geodesic(i.WGS84.a,i.WGS84.f)})(ke.Geodesic,ke.GeodesicLine,ke.PolygonArea,ke.Math,ke.Constants);(function(e,t,r){"use strict";t.GeodesicLine=function(n,i,o,s,a,c,l){var h,u,f,d,m,p;a||(a=e.STANDARD|e.DISTANCE_IN),this.a=n.a,this.f=n.f,this._b=n._b,this._c2=n._c2,this._f1=n._f1,this.caps=a|e.LATITUDE|e.AZIMUTH|e.LONG_UNROLL,this.lat1=r.LatFix(i),this.lon1=o,typeof c>"u"||typeof l>"u"?(this.azi1=r.AngNormalize(s),h=r.sincosd(r.AngRound(this.azi1)),this.salp1=h.s,this.calp1=h.c):(this.azi1=s,this.salp1=c,this.calp1=l),h=r.sincosd(r.AngRound(this.lat1)),f=this._f1*h.s,u=h.c,h=r.hypot(f,u),f/=h,u/=h,u=Math.max(e.tiny_,u),this._dn1=Math.sqrt(1+n._ep2*r.sq(f)),this._salp0=this.salp1*u,this._calp0=r.hypot(this.calp1,this.salp1*f),this._ssig1=f,this._somg1=this._salp0*f,this._csig1=this._comg1=f!==0||this.calp1!==0?u*this.calp1:1,h=r.hypot(this._ssig1,this._csig1),this._ssig1/=h,this._csig1/=h,this._k2=r.sq(this._calp0)*n._ep2,d=this._k2/(2*(1+Math.sqrt(1+this._k2))+this._k2),this.caps&e.CAP_C1&&(this._A1m1=e.A1m1f(d),this._C1a=new Array(e.nC1_+1),e.C1f(d,this._C1a),this._B11=e.SinCosSeries(!0,this._ssig1,this._csig1,this._C1a),m=Math.sin(this._B11),p=Math.cos(this._B11),this._stau1=this._ssig1*p+this._csig1*m,this._ctau1=this._csig1*p-this._ssig1*m),this.caps&e.CAP_C1p&&(this._C1pa=new Array(e.nC1p_+1),e.C1pf(d,this._C1pa)),this.caps&e.CAP_C2&&(this._A2m1=e.A2m1f(d),this._C2a=new Array(e.nC2_+1),e.C2f(d,this._C2a),this._B21=e.SinCosSeries(!0,this._ssig1,this._csig1,this._C2a)),this.caps&e.CAP_C3&&(this._C3a=new Array(e.nC3_),n.C3f(d,this._C3a),this._A3c=-this.f*this._salp0*n.A3f(d),this._B31=e.SinCosSeries(!0,this._ssig1,this._csig1,this._C3a)),this.caps&e.CAP_C4&&(this._C4a=new Array(e.nC4_),n.C4f(d,this._C4a),this._A4=r.sq(this.a)*this._calp0*this._salp0*n._e2,this._B41=e.SinCosSeries(!1,this._ssig1,this._csig1,this._C4a)),this.a13=this.s13=NaN},t.GeodesicLine.prototype.GenPosition=function(n,i,o,s={}){var a,c,l,h,u,f,d,m,p,g,y,_,M,x,v,T,S,E,N,O,C,R,W,j,A,P,D,F,L;return o?o===e.LONG_UNROLL&&(o|=e.STANDARD):o=e.STANDARD,o&=this.caps&e.OUT_MASK,s.lat1=this.lat1,s.azi1=this.azi1,s.lon1=o&e.LONG_UNROLL?this.lon1:r.AngNormalize(this.lon1),n?s.a12=i:s.s12=i,n||this.caps&e.DISTANCE_IN&e.OUT_MASK?(h=0,u=0,n?(a=i*r.degree,P=r.sincosd(i),c=P.s,l=P.c):(m=i/(this._b*(1+this._A1m1)),p=Math.sin(m),g=Math.cos(m),h=-e.SinCosSeries(!0,this._stau1*g+this._ctau1*p,this._ctau1*g-this._stau1*p,this._C1pa),a=m-(h-this._B11),c=Math.sin(a),l=Math.cos(a),Math.abs(this.f)>.01&&(f=this._ssig1*l+this._csig1*c,d=this._csig1*l-this._ssig1*c,h=e.SinCosSeries(!0,f,d,this._C1a),y=(1+this._A1m1)*(a+(h-this._B11))-i/this._b,a=a-y/Math.sqrt(1+this._k2*r.sq(f)),c=Math.sin(a),l=Math.cos(a))),f=this._ssig1*l+this._csig1*c,d=this._csig1*l-this._ssig1*c,R=Math.sqrt(1+this._k2*r.sq(f)),o&(e.DISTANCE|e.REDUCEDLENGTH|e.GEODESICSCALE)&&((n||Math.abs(this.f)>.01)&&(h=e.SinCosSeries(!0,f,d,this._C1a)),u=(1+this._A1m1)*(h-this._B11)),T=this._calp0*f,S=r.hypot(this._salp0,this._calp0*d),S===0&&(S=d=e.tiny_),O=this._salp0,C=this._calp0*d,n&&o&e.DISTANCE&&(s.s12=this._b*((1+this._A1m1)*a+u)),o&e.LONGITUDE&&(E=this._salp0*f,N=d,v=r.copysign(1,this._salp0),_=o&e.LONG_UNROLL?v*(a-(Math.atan2(f,d)-Math.atan2(this._ssig1,this._csig1))+(Math.atan2(v*E,N)-Math.atan2(v*this._somg1,this._comg1))):Math.atan2(E*this._comg1-N*this._somg1,N*this._comg1+E*this._somg1),M=_+this._A3c*(a+(e.SinCosSeries(!0,f,d,this._C3a)-this._B31)),x=M/r.degree,s.lon2=o&e.LONG_UNROLL?this.lon1+x:r.AngNormalize(r.AngNormalize(this.lon1)+r.AngNormalize(x))),o&e.LATITUDE&&(s.lat2=r.atan2d(T,this._f1*S)),o&e.AZIMUTH&&(s.azi2=r.atan2d(O,C)),o&(e.REDUCEDLENGTH|e.GEODESICSCALE)&&(W=e.SinCosSeries(!0,f,d,this._C2a),j=(1+this._A2m1)*(W-this._B21),A=(this._A1m1-this._A2m1)*a+(u-j),o&e.REDUCEDLENGTH&&(s.m12=this._b*(R*(this._csig1*f)-this._dn1*(this._ssig1*d)-this._csig1*d*A)),o&e.GEODESICSCALE&&(P=this._k2*(f-this._ssig1)*(f+this._ssig1)/(this._dn1+R),s.M12=l+(P*f-d*A)*this._ssig1/this._dn1,s.M21=l-(P*this._ssig1-this._csig1*A)*f/R)),o&e.AREA&&(D=e.SinCosSeries(!1,f,d,this._C4a),this._calp0===0||this._salp0===0?(F=O*this.calp1-C*this.salp1,L=C*this.calp1+O*this.salp1):(F=this._calp0*this._salp0*(l<=0?this._csig1*(1-l)+c*this._ssig1:c*(this._csig1*c/(1+l)+this._ssig1)),L=r.sq(this._salp0)+r.sq(this._calp0)*this._csig1*d),s.S12=this._c2*Math.atan2(F,L)+this._A4*(Math.abs(a)<.01?e.SinCosSeries(!1,this._ssig1,this._csig1,this._C4a,a):D-this._B41)),n||(s.a12=a/r.degree),s):(s.a12=NaN,s)},t.GeodesicLine.prototype.Position=function(n,i){return this.GenPosition(!1,n,i)},t.GeodesicLine.prototype.ArcPosition=function(n,i){return this.GenPosition(!0,n,i)},t.GeodesicLine.prototype.GenSetDistance=function(n,i){n?this.SetArc(i):this.SetDistance(i)},t.GeodesicLine.prototype.SetDistance=function(n){var i;this.s13=n,i=this.GenPosition(!1,this.s13,e.ARC),this.a13=0+i.a12},t.GeodesicLine.prototype.SetArc=function(n){var i;this.a13=n,i=this.GenPosition(!0,this.a13,e.DISTANCE),this.s13=0+i.s12}})(ke.Geodesic,ke.GeodesicLine,ke.Math)});function Px(e){if(!Number.isFinite(e))throw new Error("Nonfinite axis, azimuth, distance or arc")}function Rx({semiMajorAxis:e,semiMinorAxis:t}){return Px(e),Px(t),new c1.Geodesic(e,(e-t)/e)}var c1,Ih,Cx=w(()=>{Ax();c1=ke.Geodesic;Ih=c1.ALL&~c1.AREA});function Ox(e,t,r,n,i,o){let s=Bx[t]&&Bx[t][r];pr(s&&(!n||n===s));let a,c,l,h=o8.copy(i);if(!Number.isFinite(h.x)||!Number.isFinite(h.y)||!Number.isFinite(h.z)||!Array.isArray(o)&&o.length<16)throw new Error("Unsupported local frame");let u=i8*Math.min(1,e.maximumRadius),f=Math.abs(h.x)<=u&&Math.abs(h.y)<=u,d=e.radii;if(d.x===d.y&&d.x>0&&d.z>0&&d.z<=d.x&&(!f||h.z!==0)){let{east:O,up:C}=Uc;if(f)O.set(0,1,0),C.set(0,0,Math.sign(h.z));else{let R=Math.max(Math.abs(h.x),Math.abs(h.y));O.set(-h.y/R,h.x/R,0).normalize(),e.geodeticSurfaceNormal(h,C)}if(!Yg(O,C,Nx)||!Kg(Nx,h,t,r,n,o))throw new Error("Unsupported local frame");return o}if(f){let O=Math.sign(h.z);a=s8.fromArray(l1[t]),t!=="east"&&t!=="west"&&a.scale(O),c=a8.fromArray(l1[r]),r!=="east"&&r!=="west"&&c.scale(O),l=c8.fromArray(l1[n]),n!=="east"&&n!=="west"&&l.scale(O)}else{let{up:O,east:C,north:R}=Uc,W=Math.max(Math.abs(h.x),Math.abs(h.y));C.set(-h.y/W,h.x/W,0).normalize(),e.geodeticSurfaceNormal(h,O),R.copy(O).cross(C);let{down:j,west:A,south:P}=Uc;j.copy(O).scale(-1),A.copy(C).scale(-1),P.copy(R).scale(-1),a=Uc[t],c=Uc[r],l=Uc[n]}let m=a.x,p=a.y,g=a.z,y=c.x,_=c.y,M=c.z,x=l.x,v=l.y,T=l.z,S=h.x,E=h.y,N=h.z;return o[0]=m,o[1]=p,o[2]=g,o[3]=0,o[4]=y,o[5]=_,o[6]=M,o[7]=0,o[8]=x,o[9]=v,o[10]=T,o[11]=0,o[12]=S,o[13]=E,o[14]=N,o[15]=1,o}var i8,o8,Nx,Bx,l1,Uc,s8,a8,c8,Lx=w(()=>{qt();qt();i8=1e-14,o8=new I,Nx=$g(),Bx={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},l1={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},Uc={east:new I,north:new I,up:new I,west:new I,south:new I,down:new I},s8=new I,a8=new I,c8=new I});function ga(e,t,r=new bt){return Ox(e,"east","north","up",t,r)}var Dx=w(()=>{qt();Lx()});var Fx=w(()=>{hd();Dx()});var Ah,Ux=w(()=>{qt();Ah=class{constructor(t,r,n,i){this.west=t,this.south=r,this.east=n,this.north=i}static center(t,r){r||(r=new I);let n=t.east,i=t.west;n<i&&(n+=we.TWO_PI);let o=mg((i+n)*.5,"negative-pi-to-pi"),s=(t.south+t.north)*.5;return r.x=o,r.y=s,r.z=0,r}get width(){let t=this.east,r=this.west;return t<r&&(t+=we.TWO_PI),t-r}}});function Ph(e,t=pt.WGS84,r={}){if(!e||e.length!==6||e.some(_=>!Number.isFinite(_)))throw new Error("makeOBBFromRegion: region must contain exactly six finite numbers");let n=r.units==="degrees"?Uf(1):1,[i,o,s,a,c,l]=e;if(c>l)throw new Error("makeOBBFromRegion: minimumHeight must not exceed maximumHeight");let h=o*n,u=a*n,f=Vx(i*n),d=Vx(s*n);s*n-i*n>=we.TWO_PI-1e-12&&(d=f+we.TWO_PI);let p=1e-12;if(h>u||h<-we.PI_OVER_TWO-p||u>we.PI_OVER_TWO+p)throw new Error("makeOBBFromRegion: latitude must be within [-\u03C0/2, \u03C0/2] and south \u2264 north");let g=Math.max(-we.PI_OVER_TWO,Math.min(we.PI_OVER_TWO,h)),y=Math.max(-we.PI_OVER_TWO,Math.min(we.PI_OVER_TWO,u));return O8([f,g,d,y,c,l],t,r.transform)}function Vx(e){let t=((e+Math.PI)%we.TWO_PI+we.TWO_PI)%we.TWO_PI-Math.PI;return t===-Math.PI&&e>0?Math.PI:t}function O8(e,t,r){let n=new oo,[i,o,s,a,c,l]=e,h=Or(a),u=Or(o),f,d,m,p,g,y,_,M=new Ah(i,o,s,a),x=Ah.center(M,h8),v=new I([Or(x.x),Or(x.y),0]),T=x.x,S=v.x;if(M.width<=we.PI){let yt=Or(i),Dt=t.cartographicToCartesian(v),X=new gd(Dt,t),xt=u<0&&h>0?0:v.y,et=u8.copy([S,h,l]),dt=f8.copy([yt,h,l]),St=d8.copy([yt,xt,l]),k=m8.copy([yt,u,l]),Rt=p8.copy([S,u,l]),zt=t.cartographicToCartesian(et,g8),Wt=t.cartographicToCartesian(dt,Gx),ee=t.cartographicToCartesian(St,y8),Jt=t.cartographicToCartesian(k,zx),ye=t.cartographicToCartesian(Rt,w8),Oe=X.projectPointToNearestOnPlane(zt,_8),Ue=X.projectPointToNearestOnPlane(Wt,M8),Ft=X.projectPointToNearestOnPlane(ee,b8),Bt=X.projectPointToNearestOnPlane(Jt,x8),Ut=X.projectPointToNearestOnPlane(ye,S8);return p=Math.min(Ue.x,Ft.x,Bt.x),f=-p,d=Math.max(Ue.y,Oe.y),g=Math.min(Bt.y,Ut.y),dt.z=k.z=c,Wt=t.cartographicToCartesian(dt,Gx),Jt=t.cartographicToCartesian(k,zx),_=X.plane,y=Math.min(_.getPointDistance(Wt),_.getPointDistance(Jt)),m=l,kx(jx(X.origin,X.xAxis,X.yAxis,X.zAxis,p,f,g,d,y,m,n),r)}let E=Or(s),N=o>0,O=a<0,C=N?u:O?h:0,R=t.cartographicToCartesian([S,C,l],E8);R.z=0;let j=Math.abs(R.x)<we.EPSILON10&&Math.abs(R.y)<we.EPSILON10?N8:T8.copy(R).normalize(),A=B8,P=I8.copy(j).cross(A);_=v8.fromPointNormal(R,j);let D=t.cartographicToCartesian([Or(T+we.PI_OVER_TWO),C,l],A8);f=_.projectPointOntoPlane(D,P8).dot(P),p=-f;let L=O?c:l,B=N?c:l;d=qx(t,h,L,!0),g=qx(t,u,B,!1);let V=t.cartographicToCartesian([E,C,l],C8);return y=_.getPointDistance(V),m=0,kx(jx(R,P,A,j,p,f,g,d,y,m,n),r)}function kx(e,t){if(!t)return e;let r=[0,1,2].map(a=>e.halfAxes.getColumn(a,new I)),n=t.transformAsPoint(e.center),i=[1/0,1/0,1/0],o=[-1/0,-1/0,-1/0];for(let a=0;a<8;a++){let c=new I(n);for(let l=0;l<3;l++){let h=t.transformAsVector(r[l]);c.add(new I(h).scale((a&1<<l)===0?-1:1))}for(let l=0;l<3;l++)i[l]=Math.min(i[l],c[l]),o[l]=Math.max(o[l],c[l])}e.center.copy(i).add(o).scale(.5);let s=new I(o).subtract(i).scale(.5);return e.halfAxes=new Qr().set(s.x,0,0,0,s.y,0,0,0,s.z),e}function qx(e,t,r,n){let i=n?-1/0:1/0;for(let o of[0,90,180,270]){let s=e.cartographicToCartesian([o,t,r],R8).z;i=n?Math.max(i,s):Math.min(i,s)}return i}function jx(e,t,r,n,i,o,s,a,c,l,h){let u=h.center,f=h.halfAxes;f.setColumn(0,t),f.setColumn(1,r),f.setColumn(2,n);let d=l8.set((i+o)/2,(s+a)/2,(c+l)/2).transformByMatrix3(f),m=(o-i)/2,p=(a-s)/2,g=(l-c)/2;return f[0]*=m,f[1]*=m,f[2]*=m,f[3]*=p,f[4]*=p,f[5]*=p,f[6]*=g,f[7]*=g,f[8]*=g,u.copy(e).add(d),h}var l8,h8,u8,f8,d8,m8,p8,g8,Gx,y8,zx,w8,_8,M8,b8,x8,S8,v8,E8,T8,I8,A8,P8,R8,C8,N8,B8,Wx=w(()=>{qt();so();Ux();hd();Ix();l8=new I,h8=new I,u8=new I,f8=new I,d8=new I,m8=new I,p8=new I,g8=new I,Gx=new I,y8=new I,zx=new I,w8=new I,_8=new Jr,M8=new Jr,b8=new Jr,x8=new Jr,S8=new Jr,v8=new Ge,E8=new I,T8=new I,I8=new I,A8=new I,P8=new Jr,R8=new I,C8=new I,N8=new I(1,0,0),B8=new I(0,0,1)});var Hx=w(()=>{Wx()});var $x=w(()=>{});function tt(e,t,r){if(!Object.prototype.hasOwnProperty.call(e,t))return r;let n=e[t];if(typeof n!="string"||!/^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i.test(n))throw new Error(`Invalid numeric PROJ parameter: +${t}`);let i=Number(n);if(!Number.isFinite(i))throw new Error(`Invalid numeric PROJ parameter: +${t}`);return i}function Rh(e,t){let r=tt(e,t,0);if(Math.abs(r)>=90)throw new Error(`+${t} must be between -90 and 90 degrees`);return r*Me}function ve(e,t=!1){if(t||Math.abs(e)<=Math.PI)return e;let r=2*Math.PI;return((e+Math.PI)%r+r)%r-Math.PI}var Me,Ee=w(()=>{Me=Math.PI/180});function Te(e,t){let r=[e[0]*t[0],e[0]*t[1],e[1]*t[0],e[1]*t[1]];return[Math.min(...r),Math.max(...r)]}function Ch([e,t]){let r=[Math.sin(e),Math.sin(t)];for(let[n,i]of[[Math.PI/2,1],[-Math.PI/2,-1]])Math.ceil((e-n)/(2*Math.PI))<=Math.floor((t-n)/(2*Math.PI))&&r.push(i);return[Math.min(...r),Math.max(...r)]}function re(e,t){let r=n=>Math.max(1,Ho(n))*1e-12;if(![...e,...t].every(Number.isFinite))throw new Error("Projection rendering bounds are not finite");return[[e[0]-r(e),t[0]-r(t),0],[e[1]+r(e),t[1]+r(t),0]]}function gr(e,t,r=!1){let n=e[0][0]-t,i=e[1][0]-t;if(r)return[n,i];let o=i-n;if(o>=2*Math.PI-1e-12)return[-Math.PI,Math.PI];let s=ve(n);o>0&&Math.abs(s-Math.PI)<1e-12&&(s=-Math.PI);let a=s+o;return a>Math.PI+1e-12?[-Math.PI,Math.PI]:[s,Math.min(a,Math.PI)]}function yr(e,t,r,n=!1){let i=gr(t,r,n),o=[t[0][1],t[1][1],Math.max(t[0][1],Math.min(t[1][1],0))],s=i.flatMap(a=>o.map(c=>e(r+a,c)));return re([Math.min(...s.map(a=>a[0])),Math.max(...s.map(a=>a[0]))],[Math.min(...s.map(a=>a[1])),Math.max(...s.map(a=>a[1]))])}function Gc(e,t,r,n=!1,i=0){let o=gr(t,r,n);if(Ho(o)>Math.PI/6+1e-12)throw new Error("Unsupported transverse rendering coverage");let s=[o[0],o[1],Math.max(o[0],Math.min(o[1],0))],a=[t[0][1],t[1][1],Math.max(t[0][1],Math.min(t[1][1],i))],c=s.flatMap(l=>a.map(h=>e(r+l,h)));return re([Math.min(...c.map(l=>l[0])),Math.max(...c.map(l=>l[0]))],[Math.min(...c.map(l=>l[1])),Math.max(...c.map(l=>l[1]))])}function Yx(e,t,r,n=!1){let i=gr(t,r,n),o=[i[0],i[1],Math.max(i[0],Math.min(i[1],0))],s=[t[0][1],t[1][1],Math.max(t[0][1],Math.min(t[1][1],0))],a=o.flatMap(c=>s.map(l=>e(r+c,l)));return re([Math.min(...a.map(c=>c[0])),Math.max(...a.map(c=>c[0]))],[Math.min(...a.map(c=>c[1])),Math.max(...a.map(c=>c[1]))])}function zc(e,t,r,n,i,o,s=!1){let a=Ct(gr(t,r,s),n),c=qn(o-e(r,t[0][1])[1],o-e(r,t[1][1])[1]);return re(At([i,i],Te(c,Ch(a))),At([o,o],Ct(Te(c,yd(a)),-1)))}var qn,At,Ct,yd,Ho,Ie=w(()=>{Ee();qn=(e,t)=>[Math.min(e,t),Math.max(e,t)],At=(e,t)=>[e[0]+t[0],e[1]+t[1]],Ct=(e,t)=>qn(e[0]*t,e[1]*t);yd=e=>Ch([e[0]+Math.PI/2,e[1]+Math.PI/2]),Ho=e=>Math.max(Math.abs(e[0]),Math.abs(e[1]))});function K(e,t,r,n){return[[e,t],[r,n]]}function oi(e){return e>=-180&&e<180?e:((e+180)%360+360)%360-180}function L8(e,t,r,n){if(![e,t,r,n].every(Number.isFinite)||t<-90||n>90||t>n||r-e<-360||r-e>360+1e-10)throw new Error("Invalid geographic coverage");if(r-e>=360-1e-10)return[-180,t,180,n];let i=oi(r);return[oi(e),t,i===-180&&r>e?180:i,n]}function h1(e){let t=e[2]-e[0];return t<0?t+360:t}function Kx(e){let[t,r,n,i]=e;return t<=n?[e]:[[t,r,180,i],[-180,r,n,i]]}function D8(e,t){let[r,n,i,o]=e,s=oi(t[0]);return t[1]>=n&&t[1]<=o&&(r<=i?s>=r&&s<=i||s===-180&&i===180:s>=r||s<=i)}function wd(e,t){let r=Math.max(e[1],t[1]),n=Math.min(e[3],t[3]);if(r>n)return[];let i=[];for(let s of Kx(e))for(let a of Kx(t)){let c=Math.max(s[0],a[0]),l=Math.min(s[2],a[2]);c<=l?i.push([c,l]):(s[2]===180&&a[0]===-180||a[2]===180&&s[0]===-180)&&i.push([-180,-180])}i.sort((s,a)=>s[0]-a[0]);let o=[];for(let s of i){let a=o[o.length-1];a&&s[0]<=a[1]?a[1]=Math.max(a[1],s[1]):o.push([...s])}if(o.length>1&&o[0][0]===-180&&o[o.length-1][1]===180){let s=o.shift();return[[o.pop()[0],r,s[1],n],...o.map(([c,l])=>[c,r,l,n])]}return o.map(([s,a])=>[s,r,a,n])}function Xx(e,t){let r=oi(t[0]),n=Math.max(e[1],Math.min(e[3],t[1]));if(!D8(e,[r,n])){let i=Math.abs(oi(r-e[0])),o=Math.abs(oi(r-e[2]));r=i<=o?e[0]:e[2]}return[r,n]}function $o(e,t=0,r=0){let n=h1(e),i=e[0]*ao-t,o=i+n*ao/2,s=Math.round((r-o)/(2*Math.PI))*2*Math.PI;return K(n===360?r-Math.PI:i+s,e[1]*ao,n===360?r+Math.PI:i+s+n*ao,e[3]*ao)}function yn(e,t=0){return L8((e[0][0]+t)/ao,e[0][1]/ao,(e[1][0]+t)/ao,e[1][1]/ao)}function Zx(e){if(!e.length)throw new Error("CRS coverage does not intersect the rendering target");return[[0,1,2].map(t=>Math.min(...e.map(r=>r[0][t]))),[0,1,2].map(t=>Math.max(...e.map(r=>r[1][t])))]}var ao,Ht=w(()=>{ao=Math.PI/180});function Jx(e,t){if(t)try{let n=e(t);return u1(n)}catch{}let r=e();return u1(r)}function u1(e){let t=e.bounds;if(t.some(r=>r.some(n=>!Number.isFinite(n))))throw new Error("Projection rendering bounds must be finite");return{bounds:t,normalize:e.normalize?.bind(e)}}function Yo(e,t=0){return r=>{let n=r.x*Math.PI/180-t,i=r.y*Math.PI/180,o={x:n,y:i,z:r.z};e(o),o.x!==n&&(r.x=(o.x+t)*180/Math.PI),o.y!==i&&(r.y=o.y*180/Math.PI)}}function _d(e,t){let r=[];for(let n of e){let i=t(n);i!==null&&r.push(u1(i))}return r.length?r.length===1?r[0]:{bounds:Zx(r.map(n=>n.bounds)),normalize(n){let i=n.x,o=n.y,s=1/0;for(let a of r){let c={x:n.x,y:n.y,z:n.z};a.normalize?.(c);let l=Math.sin((c.y-n.y)*Math.PI/360)**2+Math.cos(n.y*Math.PI/180)*Math.cos(c.y*Math.PI/180)*Math.sin((c.x-n.x)*Math.PI/360)**2;l<s&&(s=l,i=c.x,o=c.y)}n.x=i,n.y=o}}:null}var ya=w(()=>{Ht()});function Md(e,t,r=0,n=!1){let i=h1(t),o=i===360?r-180:t[0]+Math.round((r-t[0]-i/2)/360)*360,s=o+i;if(n){e.x=Math.max(o,Math.min(s,e.x)),e.y=Math.max(t[1],Math.min(t[3],e.y));return}let a=Xx(t,[e.x,e.y]),c=a[0];a[0]===oi(e.x)&&e.x>=o&&e.x<=s?c=e.x:(c<o||c>s)&&(c+=Math.round(((o+s)/2-c)/360)*360);let l=c-r;e.x=Math.abs(l)<=180?c:r+oi(l),e.y=a[1]}function Ke(e,t,r=0,n=0,i=!1){let o=(r+n)*180/Math.PI;return{get bounds(){return e($o(t,n,r))},normalize(s){Md(s,t,o,i)}}}function F8(e,t,r,n,i){let o=_d(t,s=>Ke(e,s,r,n,i));if(!o)throw new Error("CRS coverage does not intersect the rendering target");return o}function Pt(e,t,r,n=0,i=!1){let o=(t[0][0]+t[1][0])/2,s=yn(t,n),a=(o+n)*180/Math.PI;return{...e,longitudeOrigin:o,getRenderingProfile(c){if(!c)return{bounds:r(t),normalize(l){Md(l,s,a,i)}};try{let l=Ke(r,c,o,n,i);return{bounds:l.bounds,normalize:l.normalize}}catch{return F8(r,wd(c,s),o,n,i)}}}}var ne=w(()=>{Ht();ya()});function Qx(){return{x:0,y:0,z:0}}var Ko,bd=w(()=>{Ko=class{constructor(){this.point=Qx(),this.points=[this.point],this.active=0}get depth(){return this.active}acquire(){var t;let r=this.active++;return(t=this.points)[r]||(t[r]=Qx()),this.points[r]}release(t){this.active>0&&this.points[this.active-1]===t&&this.active--}}});function jn(e,t){let r=new Ko,n=(i,o,s)=>{let a=r.acquire();try{return a.x=i,a.y=o,a.z=0,s(a),[a.x,a.y]}finally{r.release(a)}};return{forward(i,o){return n(i,o,e)},inverse(i,o){return n(i,o,t)},forwardInPlace:e,inverseInPlace:t}}function co(e,t,r=!1){let n=t?e.inverseInPlace:e.forwardInPlace;if(n)return n.bind(e);if(r){let o=t?e.inverse3D:e.forward3D;return s=>{let a=o.call(e,[s.x,s.y,s.z]);s.x=a[0],s.y=a[1],s.z=a[2]}}let i=t?e.inverse:e.forward;return o=>{let s=i.call(e,o.x,o.y);o.x=s[0],o.y=s[1]}}var wa=w(()=>{bd()});function Xo(e,t,r=0){let n=tt(e,t,r);if(t!=="lon_0"&&Math.abs(n)>90)throw new Error("Latitude parameter must be between -90 and 90 degrees: +"+t);return n*Me}function si(e,t){let r=Object.prototype.hasOwnProperty.call(e,t);if(r&&e[t]!==void 0)throw new Error("Expected a flag without a value: +"+t);return r}function er({semiMajorAxis:e,eccentricitySquared:t,parameters:r,primeMeridian:n=0}){let i=tt(r,"k_0",tt(r,"k",1));if(i<=0)throw new Error("Projection scale must be positive");return{primeMeridian:n,a:e,b:e*Math.sqrt(1-t),es:t,e:Math.sqrt(t),ep2:t/(1-t),sphere:t===0,over:si(r,"over"),long0:Xo(r,"lon_0"),lat0:Xo(r,"lat_0"),lat1:Xo(r,"lat_1"),lat2:Xo(r,"lat_2",tt(r,"lat_1",0)),lat_ts:Xo(r,"lat_ts",NaN),x0:tt(r,"x_0",0),y0:tt(r,"y_0",0),k0:i}}function Vc(e,t){if(!Object.prototype.hasOwnProperty.call(t,"lat_1"))throw new Error("Conic projections require +lat_1");if(Math.abs(e.lat1+e.lat2)<1e-10||Math.abs(e.lat1)>=Math.PI/2||Math.abs(e.lat2)>=Math.PI/2)throw new Error("Conic standard parallels must not be opposite or at a pole")}function Xe(e,t,r,n,i=jn){let o=(s,a)=>{let c=s(t,a);if(!c||typeof c!="object"||!Number.isFinite(c.x)||!Number.isFinite(c.y))throw new Error(e+": coordinate outside projection domain or inverse did not converge");a.x=c.x,a.y=c.y};return i(s=>o(r,s),s=>o(n,s))}function Zo(e,t){let r=co(t,!1);return jn(n=>{let i=n.x,o=n.y,s=Math.atan2(Math.sin(i-e.long0),Math.cos(i-e.long0)),a=Math.abs(Math.abs(e.lat0)-Math.PI/2)<1e-10;if(Math.abs(o+e.lat0)<1e-10&&(a||Math.abs(Math.abs(s)-Math.PI)<1e-10))throw new Error("Azimuthal projection is undefined at the antipode");r(n)},co(t,!0))}var ar,lo,wn=w(()=>{wa();Ee();ar=["lon_0","lat_0","x_0","y_0"],lo=["k","k_0"]});function ai(e,t){return{...jn(e,t),createForwardFlat(r){return this.forwardInPlace===e?tS(e,!1,r):void 0},createInverseFlat(r){return this.inverseInPlace===t?tS(t,!0,r):void 0}}}function tS(e,t,{inputScale:r,outputScale:n}){let i=new Ko;return(o,s)=>{let a=i.acquire();try{let c=o instanceof Float32Array;for(let l=0;l<o.length;l+=s){if(a.x=o[l],a.y=o[l+1],a.z=s>=3?o[l+2]:0,!Number.isFinite(a.x)||!Number.isFinite(a.y)||!Number.isFinite(a.z))throw new Error("Coordinates must contain finite x, y and optional z values");if(r!==1&&(a.x*=r,a.y*=r),t&&e(a),Math.abs(a.y)>Math.PI/2||!Number.isFinite(a.x)||!Number.isFinite(a.y))throw new Error("Coordinate is outside the geographic domain");if(a.x+=0,a.x-=0,t||e(a),n!==1&&(a.x/=n,a.y/=n),!Number.isFinite(a.x)||!Number.isFinite(a.y))throw new Error("Projection produced non-finite coordinates");if(c&&(Math.abs(a.x)>34028234663852886e22||Math.abs(a.y)>34028234663852886e22))throw new Error("Projected coordinate exceeds Float32 range");o[l]=a.x,o[l+1]=a.y}}finally{i.release(a)}}}var kc=w(()=>{wa();bd()});function _a(e){var t=Math.exp(e);return t=(t-1/t)/2,t}var xd=w(()=>{});function qe(e,t){e=Math.abs(e),t=Math.abs(t);var r=Math.max(e,t),n=Math.min(e,t)/(r||1);return r*Math.sqrt(1+Math.pow(n,2))}var Ma=w(()=>{});function eS(e){var t=1+e,r=t-1;return r===0?e:e*Math.log(t)/r}var rS=w(()=>{});function nS(e){var t=Math.abs(e);return t=eS(t*(1+t/(qe(1,t)+1))),e<0?-t:t}var iS=w(()=>{Ma();rS()});function Sd(e,t){for(var r=2*Math.cos(2*t),n=e.length-1,i=e[n],o=0,s;--n>=0;)s=-o+r*i+e[n],o=i,i=s;return t+s*Math.sin(2*t)}var oS=w(()=>{});function sS(e,t){for(var r=2*Math.cos(t),n=e.length-1,i=e[n],o=0,s;--n>=0;)s=-o+r*i+e[n],o=i,i=s;return Math.sin(t)*s}var aS=w(()=>{});function Nh(e){var t=Math.exp(e);return t=(t+1/t)/2,t}var f1=w(()=>{});function d1(e,t,r,n){for(var i=Math.sin(t),o=Math.cos(t),s=_a(r),a=Nh(r),c=2*o*a,l=-2*i*s,h=e.length-1,u=e[h],f=0,d=0,m=0,p,g;--h>=0;)p=d,g=f,d=u,f=m,u=-p+c*d-l*f+e[h],m=-g+l*d+c*f;c=i*a,l=o*s,n.x=c*u-l*m,n.y=c*m+l*u}var cS=w(()=>{xd();f1()});var U,$t,Jo,lS,m1,p1,Bh,Ae=w(()=>{U=Math.PI/2,$t=Math.PI/4,Jo=Math.PI*2,lS=3.14159265359,m1=Math.PI/180,p1=180/Math.PI,Bh=Math.PI/(180*3600)});function Qo(e){return e<0?-1:1}var Oh=w(()=>{});function G(e,t){return t||Math.abs(e)<=lS?e:e-Qo(e)*Jo}var fe=w(()=>{Ae();Oh()});function U8(e){e.x0=e.x0!==void 0?e.x0:0,e.y0=e.y0!==void 0?e.y0:0,e.long0=e.long0!==void 0?e.long0:0,e.lat0=e.lat0!==void 0?e.lat0:0,e.k0=e.k0!==void 0?e.k0:1,e.cgb=[],e.cbg=[],e.utg=[],e.gtu=[];var t=e.es/(1+Math.sqrt(1-e.es)),r=t/(2-t),n=r;e.cgb[0]=r*(2+r*(-2/3+r*(-2+r*(116/45+r*(26/45+r*(-2854/675)))))),e.cbg[0]=r*(-2+r*(2/3+r*(4/3+r*(-82/45+r*(32/45+r*(4642/4725)))))),n=n*r,e.cgb[1]=n*(7/3+r*(-8/5+r*(-227/45+r*(2704/315+r*(2323/945))))),e.cbg[1]=n*(5/3+r*(-16/15+r*(-13/9+r*(904/315+r*(-1522/945))))),n=n*r,e.cgb[2]=n*(56/15+r*(-136/35+r*(-1262/105+r*(73814/2835)))),e.cbg[2]=n*(-26/15+r*(34/21+r*(8/5+r*(-12686/2835)))),n=n*r,e.cgb[3]=n*(4279/630+r*(-332/35+r*(-399572/14175))),e.cbg[3]=n*(1237/630+r*(-12/5+r*(-24832/14175))),n=n*r,e.cgb[4]=n*(4174/315+r*(-144838/6237)),e.cbg[4]=n*(-734/315+r*(109598/31185)),n=n*r,e.cgb[5]=n*(601676/22275),e.cbg[5]=n*(444337/155925),n=Math.pow(r,2),e.Qn=e.k0/(1+r)*(1+n*(1/4+n*(1/64+n/256))),e.utg[0]=r*(-.5+r*(2/3+r*(-37/96+r*(1/360+r*(81/512+r*(-96199/604800)))))),e.gtu[0]=r*(.5+r*(-2/3+r*(5/16+r*(41/180+r*(-127/288+r*(7891/37800)))))),e.utg[1]=n*(-1/48+r*(-1/15+r*(437/1440+r*(-46/105+r*(1118711/3870720))))),e.gtu[1]=n*(13/48+r*(-3/5+r*(557/1440+r*(281/630+r*(-1983433/1935360))))),n=n*r,e.utg[2]=n*(-17/480+r*(37/840+r*(209/4480+r*(-5569/90720)))),e.gtu[2]=n*(61/240+r*(-103/140+r*(15061/26880+r*(167603/181440)))),n=n*r,e.utg[3]=n*(-4397/161280+r*(11/504+r*(830251/7257600))),e.gtu[3]=n*(49561/161280+r*(-179/168+r*(6601661/7257600))),n=n*r,e.utg[4]=n*(-4583/161280+r*(108847/3991680)),e.gtu[4]=n*(34729/80640+r*(-3418889/1995840)),n=n*r,e.utg[5]=n*(-20648693/638668800),e.gtu[5]=n*(212378941/319334400);var i=Sd(e.cbg,e.lat0);e.Zb=-e.Qn*(i+sS(e.gtu,2*i))}function hS(e,t){var r=G(t.x-e.long0,e.over),n=t.y;n=Sd(e.cbg,n);var i=Math.sin(n),o=Math.cos(n),s=Math.sin(r),a=Math.cos(r);n=Math.atan2(i,a*o),r=Math.atan2(s*o,qe(i,o*a)),r=nS(Math.tan(r)),d1(e.gtu,2*n,2*r,t),n=n+t.x,r=r+t.y;var c,l;return Math.abs(r)<=2.623395162778?(c=e.a*(e.Qn*r)+e.x0,l=e.a*(e.Qn*n+e.Zb)+e.y0):(c=1/0,l=1/0),t.x=c,t.y=l,t}function uS(e,t){var r=(t.x-e.x0)*(1/e.a),n=(t.y-e.y0)*(1/e.a);n=(n-e.Zb)/e.Qn,r=r/e.Qn;var i,o;if(Math.abs(r)<=2.623395162778){d1(e.utg,2*n,2*r,t),n=n+t.x,r=r+t.y,r=Math.atan(_a(r));var s=Math.sin(n),a=Math.cos(n),c=Math.sin(r),l=Math.cos(r);n=Math.atan2(s*l,qe(c,l*a)),r=Math.atan2(c,l*a),i=G(r+e.long0,e.over),o=Sd(e.cgb,n)}else i=1/0,o=1/0;return t.x=i,t.y=o,t}function fS(e){let t={...e,cgb:[],cbg:[],utg:[],gtu:[],Qn:0,Zb:0};return U8(t),t}var dS=w(()=>{xd();Ma();iS();oS();aS();cS();fe()});function Ni(e){var t=[];t[0]=G8-e*(z8+e*(mS+e*(pS+e*gS))),t[1]=e*(V8-e*(mS+e*(pS+e*gS)));var r=e*e;return t[2]=r*(k8-e*(q8+e*j8)),r*=e,t[3]=r*(W8-e*H8),t[4]=r*e*$8,t}var G8,z8,mS,pS,gS,V8,k8,q8,j8,W8,H8,$8,qc=w(()=>{G8=1,z8=.25,mS=.046875,pS=.01953125,gS=.01068115234375,V8=.75,k8=.46875,q8=.013020833333333334,j8=.007120768229166667,W8=.3645833333333333,H8=.005696614583333333,$8=.3076171875});function rr(e,t,r,n){return r*=t,t*=t,n[0]*e-r*(n[1]+t*(n[2]+t*(n[3]+t*n[4])))}var ba=w(()=>{});function Bi(e,t,r){for(var n=1/(1-t),i=e,o=Y8;o;--o){var s=Math.sin(i),a=1-t*s*s;if(a=(rr(i,s,Math.cos(i),r)-e)*(a*Math.sqrt(a))*n,i-=a,Math.abs(a)<1e-10)return i}return i}var Y8,jc=w(()=>{ba();Y8=20});function K8(e){e.x0=e.x0!==void 0?e.x0:0,e.y0=e.y0!==void 0?e.y0:0,e.long0=e.long0!==void 0?e.long0:0,e.lat0=e.lat0!==void 0?e.lat0:0,e.es&&(e.en=Ni(e.es),e.ml0=rr(e.lat0,Math.sin(e.lat0),Math.cos(e.lat0),e.en))}function yS(e,t){var r=t.x,n=t.y,i=G(r-e.long0,e.over),o,s,a,c=Math.sin(n),l=Math.cos(n);if(e.es){var u=l*i,f=Math.pow(u,2),d=e.ep2*Math.pow(l,2),m=Math.pow(d,2),p=Math.abs(l)>1e-10?Math.tan(n):0,g=Math.pow(p,2),y=Math.pow(g,2);o=1-e.es*Math.pow(c,2),u=u/Math.sqrt(o);var _=rr(n,c,l,e.en);s=e.a*(e.k0*u*(1+f/6*(1-g+d+f/20*(5-18*g+y+14*d-58*g*d+f/42*(61+179*y-y*g-479*g)))))+e.x0,a=e.a*(e.k0*(_-e.ml0+c*i*u/2*(1+f/12*(5-g+9*d+4*m+f/30*(61+y-58*g+270*d-330*g*d+f/56*(1385+543*y-y*g-3111*g))))))+e.y0}else{var h=l*Math.sin(i);if(Math.abs(Math.abs(h)-1)<1e-10)return 93;if(s=.5*e.a*e.k0*Math.log((1+h)/(1-h))+e.x0,a=l*Math.cos(i)/Math.sqrt(1-Math.pow(h,2)),h=Math.abs(a),h>=1){if(h-1>1e-10)return 93;a=0}else a=Math.acos(a);n<0&&(a=-a),a=e.a*e.k0*(a-e.lat0)+e.y0}return t.x=s,t.y=a,t}function wS(e,t){var r,n,i,o,s=(t.x-e.x0)*(1/e.a),a=(t.y-e.y0)*(1/e.a);if(e.es)if(r=e.ml0+a/e.k0,n=Bi(r,e.es,e.en),Math.abs(n)<U){var f=Math.sin(n),d=Math.cos(n),m=Math.abs(d)>1e-10?Math.tan(n):0,p=e.ep2*Math.pow(d,2),g=Math.pow(p,2),y=Math.pow(m,2),_=Math.pow(y,2);r=1-e.es*Math.pow(f,2);var M=s*Math.sqrt(r)/e.k0,x=Math.pow(M,2);r=r*m,i=n-r*x/(1-e.es)*.5*(1-x/12*(5+3*y-9*p*y+p-4*g-x/30*(61+90*y-252*p*y+45*_+46*p-x/56*(1385+3633*y+4095*_+1574*_*y)))),o=G(e.long0+M*(1-x/6*(1+2*y+p-x/20*(5+28*y+24*_+8*p*y+6*p-x/42*(61+662*y+1320*_+720*_*y))))/d,e.over)}else i=U*Qo(a),o=0;else{var c=Math.exp(s/e.k0),l=.5*(c-1/c),h=e.lat0+a/e.k0,u=Math.cos(h);r=Math.sqrt((1-Math.pow(u,2))/(1+Math.pow(l,2))),i=Math.asin(r),Math.sin(h)<0&&(i=-i),l===0&&u===0?o=0:o=G(Math.atan2(l,u)+e.long0,e.over)}return t.x=o,t.y=i,t}function _S(e){let t={...e,en:[],ml0:0};return K8(t),t}var MS=w(()=>{qc();ba();jc();fe();Ae();Oh()});function vd(e){let t=er(e),r=n=>Pt(n,K(t.long0-Math.PI/6,-Math.PI/2,t.long0+Math.PI/6,Math.PI/2),i=>Gc(n.forward,i,t.long0,t.over),t.primeMeridian,t.over);if(si(e.parameters,"approx"))return r({...Xe("tmerc +approx",_S(t),yS,wS,ai)});if(t.sphere)throw new Error("Spherical transverse Mercator requires +approx");return r({...Xe("etmerc",fS(t),hS,uS,ai)})}var g1,y1,w1=w(()=>{kc();Ie();Ht();ne();wn();dS();MS();g1={name:"tmerc",aliases:["Fast_Transverse_Mercator","Fast Transverse Mercator","Transverse_Mercator","Transverse Mercator","Gauss Kruger","Gauss_Kruger"],parameters:[...ar,...lo,"approx"],flags:["approx"],create:vd},y1={name:"etmerc",aliases:["Extended_Transverse_Mercator","Extended Transverse Mercator"],parameters:[...ar,...lo,"approx"],flags:["approx"],create:vd}});var _1,bS=w(()=>{Ie();Ht();ne();Ee();wn();w1();_1={name:"utm",aliases:["Universal Transverse Mercator System"],parameters:["zone","south","approx"],flags:["south","approx"],create(e){let t=tt(e.parameters,"zone",NaN);if(!Number.isInteger(t)||t<1||t>60)throw new Error("UTM requires an integer +zone from 1 to 60");let r=si(e.parameters,"south"),n=vd({...e,parameters:{...e.parameters,lat_0:"0",lon_0:String(6*t-183),x_0:"500000",y_0:r?"10000000":"0",k_0:"0.9996"}}),i=(6*t-183)*Math.PI/180;return Pt(n,K(i-Math.PI/60,r?-80*Math.PI/180:0,i+Math.PI/60,r?0:84*Math.PI/180),o=>Gc(n.forward,o,i),e.primeMeridian??0,Object.prototype.hasOwnProperty.call(e.parameters,"over"))}}});function b1(e,t){return[Math.cos(t)*Math.cos(e),Math.cos(t)*Math.sin(e),Math.sin(t)]}function Ed(e,t,r,n,i){let o=Math.hypot(e,t);if(!o||Math.abs(r)>o+1e-14)return[];let s=Math.atan2(t,e),a=Math.acos(Math.max(-1,Math.min(1,r/o))),c=[];for(let l of[s-a,s+a])for(let h=Math.ceil((n-l)/(2*Math.PI));h<=Math.floor((i-l)/(2*Math.PI));h++)c.push(l+h*2*Math.PI);return c}function ts(e,t,r,n=!0){let[[i,o],[s,a]]=t,c=(i+s)/2,l=r?[Math.cos(r.latitude),0,Math.sin(r.latitude)]:[1,0,0],h=r?Math.cos(r.distance):-1,u=n?-1/0:1/0,f=[NaN,NaN],d=(p,g)=>{if(p=c+ve(p-c),p<i-1e-12||p>s+1e-12||g<o-1e-12||g>a+1e-12)return;let y=b1(p,g);if(r&&M1(l,y)<h-1e-13)return;let _=M1(e,y);(n?_>u:_<u)&&(u=_,f=[p,g])},m=[i,s,...Ed(-e[1],e[0],0,i,s)];for(let p of m){let g=e[0]*Math.cos(p)+e[1]*Math.sin(p);for(let y of[o,a,...Ed(e[2],-g,0,o,a)])d(p,y)}if(r){let[p,,g]=l;for(let x of[o,a])for(let v of Ed(p*Math.cos(x),0,h-g*Math.sin(x),i,s))d(v,x);for(let x of[i,s])for(let v of Ed(p*Math.cos(x),g,h,o,a))d(x,v);let y=M1(e,l),_=e.map((x,v)=>x-y*l[v]),M=Math.hypot(..._);if(M<=1e-14&&(_=[-l[2],0,l[0]],M=1),M>1e-14)for(let x of[-1,1]){let v=l.map((T,S)=>T*h+x*_[S]*Math.sin(r.distance)/M);d(Math.atan2(v[1],v[0]),Math.atan2(v[2],Math.hypot(v[0],v[1])))}}if(!Number.isFinite(u))throw new Error("CRS coverage does not intersect the rendering domain");return{value:u,point:f}}function se(e,t,r){return[ts(e,t,r,!1).value,ts(e,t,r).value]}function es(e,t,r,n,i){let o=se(e,n,i),s=se(t,n,i).map(c=>c+r);if(s[0]<=0)throw new Error("Projection rendering denominator is not positive");let a=o.flatMap(c=>s.map(l=>c/l));return[!1,!0].map(c=>{let l=Math.min(...a),h=Math.max(...a);for(let u=0;u<60;u++){let f=(l+h)/2,d=e.map((p,g)=>p-f*t[g]);ts(d,n,i,c).value-f*r>0?l=f:h=f}return c?h:l})}var M1,xa=w(()=>{Ee();M1=(e,t)=>e[0]*t[0]+e[1]*t[1]+e[2]*t[2]});function X8(e,t,r,n=Math.PI){let i=[-180,-90,180,90],o=(s,a)=>{let c=$o(s,e.primeMeridian,e.long0),l=K(c[0][0]-e.long0,c[0][1],c[1][0]-e.long0,c[1][1]),h=[Math.cos(e.lat0),0,Math.sin(e.lat0)],u=a?ts(h,l,void 0,!1).value:-1,d=!a||u<=Math.cos(n)+1e-13?{latitude:e.lat0,distance:t}:void 0,m=Ke(()=>r(l,d),s,e.long0,e.primeMeridian),p=Math.abs(Math.cos(e.lat0))<1e-12,g=(Math.PI/2-t)*180/Math.PI,y=d&&!p&&Yo(_=>{let M=b1(_.x-e.long0,_.y);if(M[0]*Math.cos(e.lat0)+M[2]*Math.sin(e.lat0)>=Math.cos(d.distance)-1e-14)return;if(Math.hypot(M[0]+h[0],M[1],M[2]+h[2])<1e-12){let v=e.lat0+d.distance,T=(l[0][0]+l[1][0])/2,S=T+ve((Math.cos(v)<0?Math.PI:0)-T),E=Math.atan2(Math.sin(v),Math.abs(Math.cos(v)));if(S>=l[0][0]&&S<=l[1][0]&&E>=l[0][1]&&E<=l[1][1]){_.x=S+e.long0,_.y=E;return}}let x=ts(M,l,d);[_.x,_.y]=[x.point[0]+e.long0,x.point[1]]},e.primeMeridian);return{get bounds(){return r(l,d)},normalize(_){m.normalize(_),d&&p?_.y=e.lat0>0?Math.max(g,_.y):Math.min(-g,_.y):y?.(_);let M=(e.long0+e.primeMeridian)*180/Math.PI,x=_.x-M;Math.abs(x)>180&&(_.x=M+oi(x))}}};return s=>o(s??i,!!s)}function rn(e,t,r,n,i=Math.PI){return{...e,longitudeOrigin:t.long0,getRenderingProfile:X8(t,r,n,i)}}var rs=w(()=>{Ht();ne();xa();Ee();ya()});function Td(e,t,r,n){let i=[-Math.sin(e.lat0),0,Math.cos(e.lat0)],o=[Math.cos(e.lat0),0,Math.sin(e.lat0)],s=[0,1,0],a=n==="stere"?1:0,c=h=>n==="ortho"?se(h,t,r):es(h,o,a,t,r),l=e.a*(n==="stere"?2*e.k0:1);return re(At([e.x0,e.x0],Ct(c(s),l)),At([e.y0,e.y0],Ct(c(i),l)))}function xS(e,t,r){let n=Math.sin(e.lat0),i=Math.cos(e.lat0),o=se([0,0,1],t,r);if(Math.abs(n)<1e-15&&(!r||Math.abs(r.distance-Math.PI/2)<1e-15)){let u=d=>{let m=ts([0,1,0],t,r,d);return m.value/Math.sqrt(1-e.es*Math.sin(m.point[1])**2)},f=d=>(1-e.es)*d/Math.sqrt(1-e.es*d*d);return re(At([e.x0,e.x0],Ct([u(!1),u(!0)],e.a*e.k0)),At([e.y0,e.y0],Ct([f(o[0]),f(o[1])],e.a*e.k0)))}let s=o[0]<=0&&o[1]>=0?0:Math.min(o[0]**2,o[1]**2),a=Math.max(o[0]**2,o[1]**2),c=qn(1/Math.sqrt(1-e.es*s),1/Math.sqrt(1-e.es*a)),l=e.a*e.k0,h=e.es*n*i/Math.sqrt(1-e.es*n*n);return re(At([e.x0,e.x0],Ct(Te(se([0,1,0],t,r),c),l)),At([e.y0+l*h,e.y0+l*h],Ct(Te(se([-n,0,(1-e.es)*i],t,r),c),l)))}function SS(e,t,r){let n=se([Math.cos(e.lat0),0,Math.sin(e.lat0)],t,r)[0],i=e.a/Math.sqrt(1-e.es)*Math.acos(Math.max(-1,Math.min(1,n)));return re([e.x0-i,e.x0+i],[e.y0-i,e.y0+i])}function vS(e,t,r,n,i,o,s){let a=i&&se([0,0,1],n,i),c=K(n[0][0],s(a?Math.asin(Math.max(-1,a[0])):n[0][1]),n[1][0],s(a?Math.asin(Math.min(1,a[1])):n[1][1])),l=i&&{latitude:o,distance:Math.PI-(1-e.es)**2*(Math.PI-i.distance)},h=[Math.cos(o),0,Math.sin(o)],u=[-Math.sin(o),0,Math.cos(o)],f=se(h,c,l),d=[Math.sqrt(2/(1+Math.min(1,f[1]))),f[0]>-1+1e-14?Math.sqrt(2/(1+f[0])):1/0],m=(p,g)=>{let y=se(p,c,l),_=y[0]===0?0:y[0]*(y[0]<0?d[1]:d[0]),M=y[1]===0?0:y[1]*(y[1]>0?d[1]:d[0]);return Ct([Math.max(-2,_),Math.min(2,M)],e.a*g)};return re(At([e.x0,e.x0],m([0,1,0],t)),At([e.y0,e.y0],m(u,r)))}function Id(e,t,r,n,i,o,s=1,a=e.e*Math.atanh(e.e)){let c=K(i[0][0]*s,t(i[0][1]),i[1][0]*s,t(i[1][1])),l=2*a+Math.PI*Math.abs(s-1),h=o&&s===1?Math.min(o.distance+l,Math.PI-(1-e.es)*(Math.PI-o.distance)):o&&o.distance+l,u=h&&h<Math.PI?{latitude:r,distance:h}:void 0,f=[Math.cos(r),0,Math.sin(r)],d=[-Math.sin(r),0,Math.cos(r)],p=c[1][0]-c[0][0]>=2*Math.PI?K(-Math.PI,c[0][1],Math.PI,c[1][1]):c,g=es([0,1,0],f,1,p,u),y=es(d,f,1,p,u);return re(At([e.x0,e.x0],Ct(g,n)),At([e.y0,e.y0],Ct(y,n)))}function ES(e,t,r,n,i,o){let s=[Math.cos(e.lat0),0,Math.sin(e.lat0)],a=[-Math.sin(e.lat0),0,Math.cos(e.lat0)],c=[0,1,0],l=Math.cos(n),h=Math.sin(n),u=Math.cos(r),f=Math.sin(r),d=a.map((_,M)=>l*_+h*c[M]),m=c.map((_,M)=>l*_-h*a[M]),p=s.map((_,M)=>-u*_+f*d[M]),g=es(m,p,u*t,i,o),y=es(d,p,u*t,i,o);return re(At([e.x0,e.x0],Ct(g,e.a*(t-1)*u)),At([e.y0,e.y0],Ct(y,e.a*(t-1))))}function TS(e,t,r){let n=se([Math.cos(e.lat0),0,Math.sin(e.lat0)],t,r)[0],i=Math.acos(Math.max(-1,Math.min(1,n))),o=1-e.es,s=e.a*i/Math.sqrt(o),a=Math.cos(i/o);if(!(a>0))throw new Error("Gnomonic rendering coverage approaches its ellipsoidal horizon");let c=s/a;return re([e.x0-c,e.x0+c],[e.y0-c,e.y0+c])}var ns=w(()=>{Ht();xa();Ie()});function ci(e,t,r,n,i,o,s){let a=i*r/s,c=n*t-o*r*e/s,l=n*e+o*r*t/s;return Math.atan2(l,Math.hypot(a,c))}var Lh=w(()=>{});function nn(e,t,r){var n=e*t;return r/Math.sqrt(1-n*n)}var Wc=w(()=>{});function Lr(e,t,r){let n=Math.cos(t);return Math.exp(e*Math.atanh(e*r))*(r>0?n/(1+r):(1-r)/n)}var Dh=w(()=>{});function Sa(e,t){for(var r=.5*e,n,i,o=U-2*Math.atan(t),s=0;s<=15;s++)if(n=e*Math.sin(o),i=U-2*Math.atan(t*Math.pow((1-n)/(1+n),r))-o,o+=i,Math.abs(i)<=1e-10)return o;return-9999}var Ad=w(()=>{Ae()});function IS(e,t,r){return t*=r,Math.tan(.5*(U+e))*Math.pow((1-t)/(1+t),.5*r)}function Z8(e){e.x0=e.x0||0,e.y0=e.y0||0,e.lat0=e.lat0||0,e.long0=e.long0||0,e.coslat0=Math.cos(e.lat0),e.sinlat0=Math.sin(e.lat0),e.sphere?!Number.isNaN(e.lat_ts)&&Math.abs(e.coslat0)<=1e-10&&(e.k0=.5*(1+Qo(e.lat0)*Math.sin(e.lat_ts))):(Math.abs(e.coslat0)<=1e-10&&(e.lat0>0?e.con=1:e.con=-1),e.cons=Math.sqrt(Math.pow(1+e.e,1+e.e)*Math.pow(1-e.e,1-e.e)),!Number.isNaN(e.lat_ts)&&Math.abs(e.coslat0)<=1e-10&&Math.abs(Math.cos(e.lat_ts))>1e-10&&(e.k0=.5*e.cons*nn(e.e,Math.sin(e.lat_ts),Math.cos(e.lat_ts))/Lr(e.e,e.con*e.lat_ts,e.con*Math.sin(e.lat_ts))),e.ms1=nn(e.e,e.sinlat0,e.coslat0),e.X0=2*Math.atan(IS(e.lat0,e.sinlat0,e.e))-U,e.cosX0=Math.cos(e.X0),e.sinX0=Math.sin(e.X0))}function AS(e,t){var r=t.x,n=t.y,i=Math.sin(n),o=Math.cos(n),s,a,c,l,h,u,f=G(r-e.long0,e.over);if(Math.abs(Math.abs(r-e.long0)-Math.PI)<=1e-10&&Math.abs(n+e.lat0)<=1e-10)return t.x=NaN,t.y=NaN,t;if(e.sphere&&Math.abs(e.coslat0)<=1e-10){let d=e.lat0>0?1:-1,m=2*e.a*e.k0*Math.tan(Math.PI/4-d*n/2);return t.x=e.x0+m*Math.sin(f),t.y=e.y0-d*m*Math.cos(f),t}return e.sphere?(s=2*e.k0/(1+e.sinlat0*i+e.coslat0*o*Math.cos(f)),t.x=e.a*s*o*Math.sin(f)+e.x0,t.y=e.a*s*(e.coslat0*i-e.sinlat0*o*Math.cos(f))+e.y0,t):(a=2*Math.atan(IS(n,i,e.e))-U,l=Math.cos(a),c=Math.sin(a),Math.abs(e.coslat0)<=1e-10?(h=Lr(e.e,n*e.con,e.con*i),u=2*e.a*e.k0*h/e.cons,t.x=e.x0+u*Math.sin(r-e.long0),t.y=e.y0-e.con*u*Math.cos(r-e.long0),t):(Math.abs(e.sinlat0)<1e-10?(s=2*e.a*e.k0/(1+l*Math.cos(f)),t.y=s*c+e.y0):(s=2*e.a*e.k0*e.ms1/(e.cosX0*(1+e.sinX0*c+e.cosX0*l*Math.cos(f))),t.y=s*(e.cosX0*c-e.sinX0*l*Math.cos(f))+e.y0),t.x=s*l*Math.sin(f)+e.x0,t))}function PS(e,t){t.x-=e.x0,t.y-=e.y0;var r,n,i,o,s,a=Math.sqrt(t.x*t.x+t.y*t.y);if(e.sphere){var c=2*Math.atan(a/(2*e.a*e.k0));return r=e.long0,n=e.lat0,a<=1e-10?(t.x=r,t.y=n,t):(n=ci(e.sinlat0,e.coslat0,Math.sin(c),Math.cos(c),t.x,t.y,a),Math.abs(e.coslat0)<1e-10?e.lat0>0?r=G(e.long0+Math.atan2(t.x,-1*t.y),e.over):r=G(e.long0+Math.atan2(t.x,t.y),e.over):r=G(e.long0+Math.atan2(t.x*Math.sin(c),a*e.coslat0*Math.cos(c)-t.y*e.sinlat0*Math.sin(c)),e.over),t.x=r,t.y=n,t)}else if(Math.abs(e.coslat0)<=1e-10){if(a<=1e-10)return n=e.lat0,r=e.long0,t.x=r,t.y=n,t;t.x*=e.con,t.y*=e.con,i=a*e.cons/(2*e.a*e.k0),n=e.con*Sa(e.e,i),r=e.con*G(e.con*e.long0+Math.atan2(t.x,-1*t.y),e.over)}else o=2*Math.atan(a*e.cosX0/(2*e.a*e.k0*e.ms1)),r=e.long0,a<=1e-10?s=e.X0:(s=ci(e.sinX0,e.cosX0,Math.sin(o),Math.cos(o),t.x,t.y,a),r=G(e.long0+Math.atan2(t.x*Math.sin(o),a*e.cosX0*Math.cos(o)-t.y*e.sinX0*Math.sin(o)),e.over)),n=-1*Sa(e.e,Math.tan(.5*(U+s)));return t.x=r,t.y=n,t}function RS(e){let t={...e,coslat0:0,sinlat0:0,con:0,cons:0,ms1:0,X0:0,cosX0:0,sinX0:0};return Z8(t),t}var CS=w(()=>{Lh();Ae();Oh();Wc();Dh();Ad();fe()});var x1,NS=w(()=>{rs();ns();wn();CS();x1={name:"stere",aliases:["Stereographic_South_Pole","Polar_Stereographic_variant_A","Polar_Stereographic_variant_B","Polar_Stereographic"],parameters:[...ar,...lo,"lat_ts"],create(e){let t=er(e),r=RS(t),n=Zo(t,Xe("stere",r,AS,PS));return rn(n,t,150*Math.PI/180,(i,o)=>r.sphere?Td(r,i,o,"stere"):Id(r,s=>2*Math.atan(Math.tan(Math.PI/4+s/2)*Math.pow((1-r.e*Math.sin(s))/(1+r.e*Math.sin(s)),r.e/2))-Math.PI/2,r.X0,2*r.a*r.k0*(Math.abs(r.coslat0)<1e-10?1/r.cons:r.ms1/r.cosX0),i,o))}}});var Dr=w(()=>{Fx();Hx();$x()});var Wn=w(()=>{"use strict";FM();W0();ZM();QM();r2();b2();x2();R2();O2()});function r6(e,t="float32"){return e instanceof Date?"date-millisecond":typeof e=="number"?t:typeof e=="boolean"?"bool":typeof e=="string"?"utf8":"null"}function t3(e){let t=n6(e);return t!=="null"?{type:t,nullable:!1}:e.length>0?(t=r6(e[0]),{type:t,nullable:!0}):{type:"null",nullable:!0}}function n6(e){if(typeof Float16Array<"u"&&e instanceof Float16Array)return"float16";switch(e.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case BigInt64Array:return"int64";case BigUint64Array:return"uint64";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}var e3=w(()=>{"use strict"});function n3(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function Y(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(h){try{l(n.next(h))}catch(u){s(u)}}function c(h){try{l(n.throw(h))}catch(u){s(u)}}function l(h){h.done?o(h.value):i(h.value).then(a,c)}l((n=n.apply(e,t||[])).next())})}function r3(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function wt(e){return this instanceof wt?(this.v=e,this):new wt(e)}function Gr(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(d){return function(m){return Promise.resolve(m).then(d,u)}}function a(d,m){n[d]&&(i[d]=function(p){return new Promise(function(g,y){o.push([d,p,g,y])>1||c(d,p)})},m&&(i[d]=m(i[d])))}function c(d,m){try{l(n[d](m))}catch(p){f(o[0][3],p)}}function l(d){d.value instanceof wt?Promise.resolve(d.value.v).then(h,u):f(o[0][2],d)}function h(d){c("next",d)}function u(d){c("throw",d)}function f(d,m){d(m),o.shift(),o.length&&c(o[0][0],o[0][1])}}function wl(e){var t,r;return t={},n("next"),n("throw",function(i){throw i}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(i,o){t[i]=e[i]?function(s){return(r=!r)?{value:wt(e[i](s)),done:!1}:o?o(s):s}:o}}function vn(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof r3=="function"?r3(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=e[o]&&function(s){return new Promise(function(a,c){s=e[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},s)}}var an=w(()=>{});var i3,_l,i6,En,fo=w(()=>{i3=new TextDecoder("utf-8"),_l=i3.decode.bind(i3),i6=new TextEncoder,En=e=>i6.encode(e)});var o6,o3,Ze,zr,Tn,ui,Yn,Lm,Dm,Fm,Um,Gm,s3,su,a3,zm,c3,fs=w(()=>{o6=e=>typeof e=="number",o3=e=>typeof e=="boolean",Ze=e=>typeof e=="function",zr=e=>e!=null&&Object(e)===e,Tn=e=>zr(e)&&Ze(e.then),ui=e=>zr(e)&&Ze(e[Symbol.iterator]),Yn=e=>zr(e)&&Ze(e[Symbol.asyncIterator]),Lm=e=>zr(e)&&zr(e.schema),Dm=e=>zr(e)&&"done"in e&&"value"in e,Fm=e=>zr(e)&&Ze(e.stat)&&o6(e.fd),Um=e=>zr(e)&&su(e.body),Gm=e=>"_getDOMStream"in e&&"_getNodeStream"in e,s3=e=>zr(e)&&Ze(e.abort)&&Ze(e.getWriter)&&!Gm(e),su=e=>zr(e)&&Ze(e.cancel)&&Ze(e.getReader)&&!Gm(e),a3=e=>zr(e)&&Ze(e.end)&&Ze(e.write)&&o3(e.writable)&&!Gm(e),zm=e=>zr(e)&&Ze(e.read)&&Ze(e.pipe)&&o3(e.readable)&&!Gm(e),c3=e=>zr(e)&&Ze(e.clear)&&Ze(e.bytes)&&Ze(e.position)&&Ze(e.setPosition)&&Ze(e.capacity)&&Ze(e.getBufferIdentifier)&&Ze(e.createLong)});var dw={};Zr(dw,{compareArrayLike:()=>fw,joinUint8Arrays:()=>In,memcpy:()=>au,rebaseValueOffsets:()=>Vm,toArrayBufferView:()=>Tt,toArrayBufferViewAsyncIterator:()=>fi,toArrayBufferViewIterator:()=>Ui,toBigInt64Array:()=>cu,toBigUint64Array:()=>u6,toFloat32Array:()=>f6,toFloat32ArrayAsyncIterator:()=>A6,toFloat32ArrayIterator:()=>M6,toFloat64Array:()=>d6,toFloat64ArrayAsyncIterator:()=>P6,toFloat64ArrayIterator:()=>b6,toInt16Array:()=>c6,toInt16ArrayAsyncIterator:()=>v6,toInt16ArrayIterator:()=>g6,toInt32Array:()=>Oa,toInt32ArrayAsyncIterator:()=>E6,toInt32ArrayIterator:()=>y6,toInt8Array:()=>a6,toInt8ArrayAsyncIterator:()=>S6,toInt8ArrayIterator:()=>p6,toUint16Array:()=>l6,toUint16ArrayAsyncIterator:()=>T6,toUint16ArrayIterator:()=>w6,toUint32Array:()=>h6,toUint32ArrayAsyncIterator:()=>I6,toUint32ArrayIterator:()=>_6,toUint8Array:()=>nt,toUint8ArrayAsyncIterator:()=>uw,toUint8ArrayIterator:()=>hw,toUint8ClampedArray:()=>m6,toUint8ClampedArrayAsyncIterator:()=>R6,toUint8ClampedArrayIterator:()=>x6});function s6(e){let t=e[0]?[e[0]]:[],r,n,i,o;for(let s,a,c=0,l=0,h=e.length;++c<h;){if(s=t[l],a=e[c],!s||!a||s.buffer!==a.buffer||a.byteOffset<s.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:r,byteLength:i}=s,{byteOffset:n,byteLength:o}=a,r+i<n||n+o<r){a&&(t[++l]=a);continue}t[l]=new Uint8Array(s.buffer,r,n-r+o)}return t}function au(e,t,r=0,n=t.byteLength){let i=e.byteLength,o=new Uint8Array(e.buffer,e.byteOffset,i),s=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,i));return o.set(s,r),e}function In(e,t){let r=s6(e),n=r.reduce((h,u)=>h+u.byteLength,0),i,o,s,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,n);for(let h=r.length;++c<h;){if(i=r[c],o=i.subarray(0,Math.min(i.length,l-a)),l<=a+o.length){o.length<i.length?r[c]=i.subarray(o.length):o.length===i.length&&c++,s?au(s,o,a):s=o;break}au(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),r.slice(c),n-(s?s.byteLength:0)]}function Tt(e,t){let r=Dm(t)?t.value:t;return r instanceof e?e===Uint8Array?new e(r.buffer,r.byteOffset,r.byteLength):r:r?(typeof r=="string"&&(r=En(r)),r instanceof ArrayBuffer?new e(r):r instanceof lw?new e(r):c3(r)?Tt(e,r.bytes()):ArrayBuffer.isView(r)?r.byteLength<=0?new e(0):new e(r.buffer,r.byteOffset,r.byteLength/e.BYTES_PER_ELEMENT):e.from(r)):new e(0)}function*Ui(e,t){let r=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof lw?r(t):ui(t)?t:r(t);return yield*cw((function*(i){let o=null;do o=i.next(yield Tt(e,o));while(!o.done)})(n[Symbol.iterator]())),new e}function fi(e,t){return Gr(this,arguments,function*(){if(Tn(t))return yield wt(yield wt(yield*wl(vn(fi(e,yield wt(t))))));let n=function(s){return Gr(this,arguments,function*(){yield yield wt(yield wt(s))})},i=function(s){return Gr(this,arguments,function*(){yield wt(yield*wl(vn(cw((function*(a){let c=null;do c=a.next(yield c?.value);while(!c.done)})(s[Symbol.iterator]())))))})},o=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof lw?n(t):ui(t)?i(t):Yn(t)?t:n(t);return yield wt(yield*wl(vn(cw((function(s){return Gr(this,arguments,function*(){let a=null;do a=yield wt(s.next(yield yield wt(Tt(e,a))));while(!a.done)})})(o[Symbol.asyncIterator]()))))),yield wt(new e)})}function Vm(e,t,r){if(e!==0){r=r.slice(0,t);let n=typeof r[0]=="bigint"?BigInt(e):e;for(let i=-1,o=r.length;++i<o;)r[i]+=n}return r.subarray(0,t)}function fw(e,t){let r=0,n=e.length;if(n!==t.length)return!1;if(n>0)do if(e[r]!==t[r])return!1;while(++r<n);return!0}var lw,a6,c6,Oa,cu,nt,l6,h6,u6,f6,d6,m6,cw,p6,g6,y6,hw,w6,_6,M6,b6,x6,S6,v6,E6,uw,T6,I6,A6,P6,R6,Je=w(()=>{an();fo();fs();lw=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;a6=e=>Tt(Int8Array,e),c6=e=>Tt(Int16Array,e),Oa=e=>Tt(Int32Array,e),cu=e=>Tt(BigInt64Array,e),nt=e=>Tt(Uint8Array,e),l6=e=>Tt(Uint16Array,e),h6=e=>Tt(Uint32Array,e),u6=e=>Tt(BigUint64Array,e),f6=e=>Tt(Float32Array,e),d6=e=>Tt(Float64Array,e),m6=e=>Tt(Uint8ClampedArray,e),cw=e=>(e.next(),e);p6=e=>Ui(Int8Array,e),g6=e=>Ui(Int16Array,e),y6=e=>Ui(Int32Array,e),hw=e=>Ui(Uint8Array,e),w6=e=>Ui(Uint16Array,e),_6=e=>Ui(Uint32Array,e),M6=e=>Ui(Float32Array,e),b6=e=>Ui(Float64Array,e),x6=e=>Ui(Uint8ClampedArray,e);S6=e=>fi(Int8Array,e),v6=e=>fi(Int16Array,e),E6=e=>fi(Int32Array,e),uw=e=>fi(Uint8Array,e),T6=e=>fi(Uint16Array,e),I6=e=>fi(Uint32Array,e),A6=e=>fi(Float32Array,e),P6=e=>fi(Float64Array,e),R6=e=>fi(Uint8ClampedArray,e)});function*C6(e){let t,r=!1,n=[],i,o,s,a=0;function c(){return o==="peek"?In(n,s)[0]:([i,n,a]=In(n,s),i)}({cmd:o,size:s}=(yield null)||{cmd:"read",size:0});let l=hw(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(s-a)?l.next():l.next(s-a),!t&&i.byteLength>0&&(n.push(i),a+=i.byteLength),t||s<=a)do({cmd:o,size:s}=yield c());while(s<a);while(!t)}catch(h){r=!0,typeof l.throw=="function"&&l.throw(h)}finally{r===!1&&typeof l.return=="function"&&l.return(null)}return null}function N6(e){return Gr(this,arguments,function*(){let r,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?In(i,a)[0]:([o,i,c]=In(i,a),o)}({cmd:s,size:a}=(yield yield wt(null))||{cmd:"read",size:0});let h=uw(e)[Symbol.asyncIterator]();try{do if({done:r,value:o}=Number.isNaN(a-c)?yield wt(h.next()):yield wt(h.next(a-c)),!r&&o.byteLength>0&&(i.push(o),c+=o.byteLength),r||a<=c)do({cmd:s,size:a}=yield yield wt(l()));while(a<c);while(!r)}catch(u){n=!0,typeof h.throw=="function"&&(yield wt(h.throw(u)))}finally{n===!1&&typeof h.return=="function"&&(yield wt(h.return(new Uint8Array(0))))}return yield wt(null)})}function B6(e){return Gr(this,arguments,function*(){let r=!1,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?In(i,a)[0]:([o,i,c]=In(i,a),o)}({cmd:s,size:a}=(yield yield wt(null))||{cmd:"read",size:0});let h=new pw(e);try{do if({done:r,value:o}=Number.isNaN(a-c)?yield wt(h.read()):yield wt(h.read(a-c)),!r&&o.byteLength>0&&(i.push(nt(o)),c+=o.byteLength),r||a<=c)do({cmd:s,size:a}=yield yield wt(l()));while(a<c);while(!r)}catch(u){n=!0,yield wt(h.cancel(u))}finally{n===!1?yield wt(h.cancel()):e.locked&&h.releaseLock()}return yield wt(null)})}function O6(e){return Gr(this,arguments,function*(){let r=[],n="error",i=!1,o=null,s,a,c=0,l=[],h;function u(){return s==="peek"?In(l,a)[0]:([h,l,c]=In(l,a),h)}if({cmd:s,size:a}=(yield yield wt(null))||{cmd:"read",size:0},e.isTTY)return yield yield wt(new Uint8Array(0)),yield wt(null);try{r[0]=mw(e,"end"),r[1]=mw(e,"error");do{if(r[2]=mw(e,"readable"),[n,o]=yield wt(Promise.race(r.map(d=>d[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-c)?(h=nt(e.read(a-c)),h.byteLength<a-c&&(h=nt(e.read()))):h=nt(e.read()),h.byteLength>0&&(l.push(h),c+=h.byteLength)),i||a<=c)do({cmd:s,size:a}=yield yield wt(u()));while(a<c)}while(!i)}finally{yield wt(f(r,n==="error"?o:null))}return yield wt(null);function f(d,m){return h=l=null,new Promise((p,g)=>{for(let[y,_]of d)e.off(y,_);try{let y=e.destroy;y&&y.call(e,m),m=void 0}catch(y){m=y||m}finally{m!=null?g(m):p()}})}})}var lr,km,pw,mw,lu=w(()=>{an();Je();lr={fromIterable(e){return km(C6(e))},fromAsyncIterable(e){return km(N6(e))},fromDOMStream(e){return km(B6(e))},fromNodeStream(e){return km(O6(e))},toDOMStream(e,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(e,t){throw new Error('"toNodeStream" not available in this environment')}},km=e=>(e.next(),e);pw=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return Y(this,void 0,void 0,function*(){let{reader:r,source:n}=this;r&&(yield r.cancel(t).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(t){return Y(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let r=yield this.reader.read();return!r.done&&(r.value=nt(r)),r})}},mw=(e,t)=>{let r=i=>n([t,i]),n;return[t,r,new Promise(i=>(n=i)&&e.once(t,r))]}});var Xt,qm=w(()=>{(function(e){e[e.V1=0]="V1",e[e.V2=1]="V2",e[e.V3=2]="V3",e[e.V4=3]="V4",e[e.V5=4]="V5"})(Xt||(Xt={}))});var jt,gw=w(()=>{(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(jt||(jt={}))});var Vt,yw=w(()=>{(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(Vt||(Vt={}))});var Qt,ww=w(()=>{(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(Qt||(Qt={}))});var q,hu=w(()=>{(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(q||(q={}))});var Lt,_w=w(()=>{(function(e){e[e.YEAR_MONTH=0]="YEAR_MONTH",e[e.DAY_TIME=1]="DAY_TIME",e[e.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(Lt||(Lt={}))});var jm=w(()=>{});var Gi,Wm,Hm,Ml,Mw=w(()=>{Gi=new Int32Array(2),Wm=new Float32Array(Gi.buffer),Hm=new Float64Array(Gi.buffer),Ml=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1});var uu,bw=w(()=>{(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(uu||(uu={}))});var hr,xw=w(()=>{jm();bw();Mw();hr=class e{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new e(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return Gi[0]=this.readInt32(t),Wm[0]}readFloat64(t){return Gi[Ml?0:1]=this.readInt32(t),Gi[Ml?1:0]=this.readInt32(t+4),Hm[0]}writeInt8(t,r){this.bytes_[t]=r}writeUint8(t,r){this.bytes_[t]=r}writeInt16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeUint16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeInt32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeUint32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeInt64(t,r){this.writeInt32(t,Number(BigInt.asIntN(32,r))),this.writeInt32(t+4,Number(BigInt.asIntN(32,r>>BigInt(32))))}writeUint64(t,r){this.writeUint32(t,Number(BigInt.asUintN(32,r))),this.writeUint32(t+4,Number(BigInt.asUintN(32,r>>BigInt(32))))}writeFloat32(t,r){Wm[0]=r,this.writeInt32(t,Gi[0])}writeFloat64(t,r){Hm[0]=r,this.writeInt32(t,Gi[Ml?0:1]),this.writeInt32(t+4,Gi[Ml?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let r=0;r<4;r++)t+=String.fromCharCode(this.readInt8(this.position_+4+r));return t}__offset(t,r){let n=t-this.readInt32(t);return r<this.readInt16(n)?this.readInt16(n+r):0}__union(t,r){return t.bb_pos=r+this.readInt32(r),t.bb=this,t}__string(t,r){t+=this.readInt32(t);let n=this.readInt32(t);t+=4;let i=this.bytes_.subarray(t,t+n);return r===uu.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,r){return typeof t=="string"?this.__string(r):this.__union(t,r)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let r=0;r<4;r++)if(t.charCodeAt(r)!=this.readInt8(this.position()+4+r))return!1;return!0}createScalarList(t,r){let n=[];for(let i=0;i<r;++i){let o=t(i);o!==null&&n.push(o)}return n}createObjList(t,r){let n=[];for(let i=0;i<r;++i){let o=t(i);o!==null&&n.push(o.unpack())}return n}}});var La,l3=w(()=>{xw();jm();La=class e{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let r;t?r=t:r=1024,this.bb=hr.allocate(r),this.space=r}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,r){t>this.minalign&&(this.minalign=t);let n=~(this.bb.capacity()-this.space+r)+1&t-1;for(;this.space<n+t+r;){let i=this.bb.capacity();this.bb=e.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(n)}pad(t){for(let r=0;r<t;r++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,r,n){(this.force_defaults||r!=n)&&(this.addInt8(r),this.slot(t))}addFieldInt16(t,r,n){(this.force_defaults||r!=n)&&(this.addInt16(r),this.slot(t))}addFieldInt32(t,r,n){(this.force_defaults||r!=n)&&(this.addInt32(r),this.slot(t))}addFieldInt64(t,r,n){(this.force_defaults||r!==n)&&(this.addInt64(r),this.slot(t))}addFieldFloat32(t,r,n){(this.force_defaults||r!=n)&&(this.addFloat32(r),this.slot(t))}addFieldFloat64(t,r,n){(this.force_defaults||r!=n)&&(this.addFloat64(r),this.slot(t))}addFieldOffset(t,r,n){(this.force_defaults||r!=n)&&(this.addOffset(r),this.slot(t))}addFieldStruct(t,r,n){r!=n&&(this.nested(r),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let r=t.capacity();if(r&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let n=r<<1,i=hr.allocate(n);return i.setPosition(n-r),i.bytes().set(t.bytes(),n-r),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let r=0;r<t;r++)this.vtable[r]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),r=this.vtable_in_use-1;for(;r>=0&&this.vtable[r]==0;r--);let n=r+1;for(;r>=0;r--)this.addInt16(this.vtable[r]!=0?t-this.vtable[r]:0);let i=2;this.addInt16(t-this.object_start);let o=(n+i)*2;this.addInt16(o);let s=0,a=this.space;t:for(r=0;r<this.vtables.length;r++){let c=this.bb.capacity()-this.vtables[r];if(o==this.bb.readInt16(c)){for(let l=2;l<o;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))continue t;s=this.vtables[r];break}}return s?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,s-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,r,n){let i=n?4:0;if(r){let o=r;if(this.prep(this.minalign,8+i),o.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let s=3;s>=0;s--)this.writeInt8(o.charCodeAt(s))}this.prep(this.minalign,4+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,r){this.finish(t,r,!0)}requiredField(t,r){let n=this.bb.capacity()-t,i=n-this.bb.readInt32(n);if(!(r<this.bb.readInt16(i)&&this.bb.readInt16(i+r)!=0))throw new TypeError("FlatBuffers: field "+r+" must be set")}startVector(t,r,n){this.notNested(),this.vector_num_elems=r,this.prep(4,t*r),this.prep(n,t*r)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let r=this.createString(t);return this.string_maps.set(t,r),r}createString(t){if(t==null)return 0;let r;return t instanceof Uint8Array?r=t:r=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,r.length,1),this.bb.setPosition(this.space-=r.length),this.bb.bytes().set(r,this.space),this.endVector()}createByteVector(t){return t==null?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let r=[];for(let n=0;n<t.length;++n){let i=t[n];if(i!==null)r.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return r}createStructOffsetList(t,r){return r(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}}});var Gt=w(()=>{jm();Mw();l3();xw();bw()});var Da,Sw=w(()=>{(function(e){e[e.BUFFER=0]="BUFFER"})(Da||(Da={}))});var ur,bl=w(()=>{(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(ur||(ur={}))});var mo,vw=w(()=>{Gt();Sw();bl();mo=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBodyCompression(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):ur.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Da.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,r){t.addFieldInt8(0,r,ur.LZ4_FRAME)}static addMethod(t,r){t.addFieldInt8(1,r,Da.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,r,n){return e.startBodyCompression(t),e.addCodec(t,r),e.addMethod(t,n),e.endBodyCompression(t)}}});var xl,Ew=w(()=>{xl=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,r,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(r??0)),t.offset()}}});var Sl,Tw=w(()=>{Sl=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,r,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(r??0)),t.offset()}}});var br,Iw=w(()=>{Gt();vw();Ew();Tw();br=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsRecordBatch(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new Sl).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new xl).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let r=this.bb.__offset(this.bb_pos,10);return r?(t||new mo).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}variadicBufferCounts(t){let r=this.bb.__offset(this.bb_pos,12);return r?this.bb.readInt64(this.bb.__vector(this.bb_pos+r)+t*8):BigInt(0)}variadicBufferCountsLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startRecordBatch(t){t.startObject(5)}static addLength(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addNodes(t,r){t.addFieldOffset(1,r,0)}static startNodesVector(t,r){t.startVector(16,r,8)}static addBuffers(t,r){t.addFieldOffset(2,r,0)}static startBuffersVector(t,r){t.startVector(16,r,8)}static addCompression(t,r){t.addFieldOffset(3,r,0)}static addVariadicBufferCounts(t,r){t.addFieldOffset(4,r,0)}static createVariadicBufferCountsVector(t,r){t.startVector(8,r.length,8);for(let n=r.length-1;n>=0;n--)t.addInt64(r[n]);return t.endVector()}static startVariadicBufferCountsVector(t,r){t.startVector(8,r,8)}static endRecordBatch(t){return t.endObject()}}});var po,h3=w(()=>{Gt();Iw();po=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryBatch(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new br).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addData(t,r){t.addFieldOffset(1,r,0)}static addIsDelta(t,r){t.addFieldInt8(2,+r,0)}static endDictionaryBatch(t){return t.endObject()}}});var ds,Aw=w(()=>{(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(ds||(ds={}))});var fu,u3=w(()=>{(function(e){e[e.DenseArray=0]="DenseArray"})(fu||(fu={}))});var mi,Ym=w(()=>{Gt();mi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInt(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,r){t.addFieldInt32(0,r,0)}static addIsSigned(t,r){t.addFieldInt8(1,+r,0)}static endInt(t){return t.endObject()}static createInt(t,r,n){return e.startInt(t),e.addBitWidth(t,r),e.addIsSigned(t,n),e.endInt(t)}}});var zi,Pw=w(()=>{Gt();u3();Ym();zi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryEncoding(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new mi).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):fu.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addIndexType(t,r){t.addFieldOffset(1,r,0)}static addIsOrdered(t,r){t.addFieldInt8(2,+r,0)}static addDictionaryKind(t,r){t.addFieldInt16(3,r,fu.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}}});var Ce,vl=w(()=>{Gt();Ce=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsKeyValue(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}key(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}value(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,r){t.addFieldOffset(0,r,0)}static addValue(t,r){t.addFieldOffset(1,r,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,r,n){return e.startKeyValue(t),e.addKey(t,r),e.addValue(t,n),e.endKeyValue(t)}}});var du,f3=w(()=>{Gt();du=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return e.startBinary(t),e.endBinary(t)}}});var mu,d3=w(()=>{Gt();mu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBinaryView(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinaryView(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinaryView(t){t.startObject(0)}static endBinaryView(t){return t.endObject()}static createBinaryView(t){return e.startBinaryView(t),e.endBinaryView(t)}}});var pu,m3=w(()=>{Gt();pu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBool(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return e.startBool(t),e.endBool(t)}}});var ms,Rw=w(()=>{Gt();ww();ms=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDate(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Qt.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,Qt.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,r){return e.startDate(t),e.addUnit(t,r),e.endDate(t)}}});var Vi,Cw=w(()=>{Gt();Vi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDecimal(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,r){t.addFieldInt32(0,r,0)}static addScale(t,r){t.addFieldInt32(1,r,0)}static addBitWidth(t,r){t.addFieldInt32(2,r,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,r,n,i){return e.startDecimal(t),e.addPrecision(t,r),e.addScale(t,n),e.addBitWidth(t,i),e.endDecimal(t)}}});var ps,Nw=w(()=>{Gt();hu();ps=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDuration(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):q.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,q.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,r){return e.startDuration(t),e.addUnit(t,r),e.endDuration(t)}}});var gs,Bw=w(()=>{Gt();gs=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,r){t.addFieldInt32(0,r,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,r){return e.startFixedSizeBinary(t),e.addByteWidth(t,r),e.endFixedSizeBinary(t)}}});var ys,Ow=w(()=>{Gt();ys=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,r){t.addFieldInt32(0,r,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,r){return e.startFixedSizeList(t),e.addListSize(t,r),e.endFixedSizeList(t)}}});var ws,Lw=w(()=>{Gt();yw();ws=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFloatingPoint(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Vt.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,r){t.addFieldInt16(0,r,Vt.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,r){return e.startFloatingPoint(t),e.addPrecision(t,r),e.endFloatingPoint(t)}}});var _s,Dw=w(()=>{Gt();_w();_s=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInterval(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Lt.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,Lt.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,r){return e.startInterval(t),e.addUnit(t,r),e.endInterval(t)}}});var gu,p3=w(()=>{Gt();gu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return e.startLargeBinary(t),e.endLargeBinary(t)}}});var yu,g3=w(()=>{Gt();yu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeList(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeList(t){t.startObject(0)}static endLargeList(t){return t.endObject()}static createLargeList(t){return e.startLargeList(t),e.endLargeList(t)}}});var wu,y3=w(()=>{Gt();wu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeUtf8(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return e.startLargeUtf8(t),e.endLargeUtf8(t)}}});var _u,w3=w(()=>{Gt();_u=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return e.startList(t),e.endList(t)}}});var Ms,Fw=w(()=>{Gt();Ms=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMap(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,r){t.addFieldInt8(0,+r,0)}static endMap(t){return t.endObject()}static createMap(t,r){return e.startMap(t),e.addKeysSorted(t,r),e.endMap(t)}}});var Mu,_3=w(()=>{Gt();Mu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsNull(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return e.startNull(t),e.endNull(t)}}});var bu,M3=w(()=>{Gt();bu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsStruct_(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return e.startStruct_(t),e.endStruct_(t)}}});var go,Uw=w(()=>{Gt();hu();go=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTime(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):q.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,q.MILLISECOND)}static addBitWidth(t,r){t.addFieldInt32(1,r,32)}static endTime(t){return t.endObject()}static createTime(t,r,n){return e.startTime(t),e.addUnit(t,r),e.addBitWidth(t,n),e.endTime(t)}}});var yo,Gw=w(()=>{Gt();hu();yo=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTimestamp(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):q.SECOND}timezone(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,q.SECOND)}static addTimezone(t,r){t.addFieldOffset(1,r,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,r,n){return e.startTimestamp(t),e.addUnit(t,r),e.addTimezone(t,n),e.endTimestamp(t)}}});var pi,zw=w(()=>{Gt();gw();pi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUnion(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):jt.Sparse}typeIds(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.readInt32(this.bb.__vector(this.bb_pos+r)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,r){t.addFieldInt16(0,r,jt.Sparse)}static addTypeIds(t,r){t.addFieldOffset(1,r,0)}static createTypeIdsVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addInt32(r[n]);return t.endVector()}static startTypeIdsVector(t,r){t.startVector(4,r,4)}static endUnion(t){return t.endObject()}static createUnion(t,r,n){return e.startUnion(t),e.addMode(t,r),e.addTypeIds(t,n),e.endUnion(t)}}});var xu,b3=w(()=>{Gt();xu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUtf8(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return e.startUtf8(t),e.endUtf8(t)}}});var Su,x3=w(()=>{Gt();Su=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUtf8View(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8View(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8View(t){t.startObject(0)}static endUtf8View(t){return t.endObject()}static createUtf8View(t){return e.startUtf8View(t),e.endUtf8View(t)}}});var lt,Km=w(()=>{(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.FloatingPoint=3]="FloatingPoint",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct_=13]="Struct_",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.LargeList=21]="LargeList",e[e.RunEndEncoded=22]="RunEndEncoded",e[e.BinaryView=23]="BinaryView",e[e.Utf8View=24]="Utf8View",e[e.ListView=25]="ListView",e[e.LargeListView=26]="LargeListView"})(lt||(lt={}))});var xr,Vw=w(()=>{Gt();Pw();vl();Km();xr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsField(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}name(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):lt.NONE}type(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.__union(t,this.bb_pos+r):null}dictionary(t){let r=this.bb.__offset(this.bb_pos,12);return r?(t||new zi).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}children(t,r){let n=this.bb.__offset(this.bb_pos,14);return n?(r||new e).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,16);return n?(r||new Ce).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,r){t.addFieldOffset(0,r,0)}static addNullable(t,r){t.addFieldInt8(1,+r,0)}static addTypeType(t,r){t.addFieldInt8(2,r,lt.NONE)}static addType(t,r){t.addFieldOffset(3,r,0)}static addDictionary(t,r){t.addFieldOffset(4,r,0)}static addChildren(t,r){t.addFieldOffset(5,r,0)}static createChildrenVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startChildrenVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(6,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endField(t){return t.endObject()}}});var cn,kw=w(()=>{Gt();Aw();Vw();vl();cn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsSchema(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ds.Little}fields(t,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new xr).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new Ce).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.readInt64(this.bb.__vector(this.bb_pos+r)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,r){t.addFieldInt16(0,r,ds.Little)}static addFields(t,r){t.addFieldOffset(1,r,0)}static createFieldsVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startFieldsVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(2,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static addFeatures(t,r){t.addFieldOffset(3,r,0)}static createFeaturesVector(t,r){t.startVector(8,r.length,8);for(let n=r.length-1;n>=0;n--)t.addInt64(r[n]);return t.endVector()}static startFeaturesVector(t,r){t.startVector(8,r,8)}static endSchema(t){return t.endObject()}static createSchema(t,r,n,i,o){return e.startSchema(t),e.addEndianness(t,r),e.addFields(t,n),e.addCustomMetadata(t,i),e.addFeatures(t,o),e.endSchema(t)}}});var Nt,Xm=w(()=>{(function(e){e[e.NONE=0]="NONE",e[e.Schema=1]="Schema",e[e.DictionaryBatch=2]="DictionaryBatch",e[e.RecordBatch=3]="RecordBatch",e[e.Tensor=4]="Tensor",e[e.SparseTensor=5]="SparseTensor"})(Nt||(Nt={}))});var b,xe,Ne=w(()=>{qm();gw();yw();ww();hu();_w();Xm();(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.LargeList=21]="LargeList",e[e.BinaryView=23]="BinaryView",e[e.Utf8View=24]="Utf8View",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth",e[e.DurationSecond=-27]="DurationSecond",e[e.DurationMillisecond=-28]="DurationMillisecond",e[e.DurationMicrosecond=-29]="DurationMicrosecond",e[e.DurationNanosecond=-30]="DurationNanosecond",e[e.IntervalMonthDayNano=-31]="IntervalMonthDayNano"})(b||(b={}));(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(xe||(xe={}))});var qw={};Zr(qw,{valueToString:()=>gi});function gi(e){if(e===null)return"null";if(e===void 0)return"undefined";switch(typeof e){case"number":return`${e}`;case"bigint":return`${e}`;case"string":return`"${e}"`}return typeof e[Symbol.toPrimitive]=="function"?e[Symbol.toPrimitive]("string"):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(t=>gi(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,r)=>typeof r=="bigint"?`${r}`:r)}var vu=w(()=>{});function It(e){if(typeof e=="bigint"&&(e<Number.MIN_SAFE_INTEGER||e>Number.MAX_SAFE_INTEGER))throw new TypeError(`${e} is not safe to convert to a number.`);return Number(e)}function jw(e,t){return It(e/t)+It(e%t)/It(t)}var ki=w(()=>{});var $w={};Zr($w,{BN:()=>Fa,bigNumToBigInt:()=>v3,bigNumToNumber:()=>Hw,bigNumToString:()=>Il,isArrowBigNumSymbol:()=>S3});function yi(e,...t){return t.length===0?Object.setPrototypeOf(Tt(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}function El(...e){return yi.apply(this,e)}function Tl(...e){return yi.apply(this,e)}function Eu(...e){return yi.apply(this,e)}function Hw(e,t){let{buffer:r,byteOffset:n,byteLength:i,signed:o}=e,s=new BigUint64Array(r,n,i/8),a=o&&s.at(-1)&BigInt(1)<<BigInt(63),c=BigInt(0),l=0;if(a){for(let h of s)c|=(h^D6)*(BigInt(1)<<BigInt(64*l++));c*=BigInt(-1),c-=BigInt(1)}else for(let h of s)c|=h*(BigInt(1)<<BigInt(64*l++));if(typeof t=="number"&&t>0){let h=BigInt("1".padEnd(t+1,"0")),u=c/h,f=a?-(c%h):c%h,d=It(u),m=`${f}`.padStart(t,"0");return+`${a&&d===0?"-":""}${d}.${m}`}return It(c)}function Il(e){if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return Ww(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Ww(e);t=t.slice();let n=1;for(let o=0;o<t.length;o++){let s=t[o],a=~s+n;t[o]=a,n&=s===0?1:0}return`-${Ww(t)}`}function v3(e){return e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:Il(e)}function Ww(e){let t="",r=new Uint32Array(2),n=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),o=-1,s=n.length-1;do{for(r[0]=n[o=0];o<s;)n[o++]=r[1]=r[0]/10,r[0]=(r[0]-r[1]*10<<16)+n[o];n[o]=r[1]=r[0]/10,r[0]=r[0]-r[1]*10,t=`${r[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}var S3,L6,D6,Fa,Zm=w(()=>{Je();ki();S3=Symbol.for("isArrowBigNum");yi.prototype[S3]=!0;yi.prototype.toJSON=function(){return`"${Il(this)}"`};yi.prototype.valueOf=function(e){return Hw(this,e)};yi.prototype.toString=function(){return Il(this)};yi.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return Hw(this);case"string":return Il(this);case"default":return v3(this)}return Il(this)};Object.setPrototypeOf(El.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Tl.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Eu.prototype,Object.create(Uint32Array.prototype));Object.assign(El.prototype,yi.prototype,{constructor:El,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(Tl.prototype,yi.prototype,{constructor:Tl,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Eu.prototype,yi.prototype,{constructor:Eu,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});L6=BigInt(4294967296)*BigInt(4294967296),D6=L6-BigInt(1);Fa=class e{static new(t,r){switch(r){case!0:return new El(t);case!1:return new Tl(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new El(t)}return t.byteLength===16?new Eu(t):new Tl(t)}static signed(t){return new El(t)}static unsigned(t){return new Tl(t)}static decimal(t){return new Eu(t)}constructor(t,r){return e.new(t,r)}}});function Ln(e){let t=e;switch(e.typeId){case b.Decimal:return e.bitWidth/32;case b.Interval:return t.unit===Lt.MONTH_DAY_NANO?4:1+t.unit;case b.BinaryView:case b.Utf8View:return 16;case b.FixedSizeList:return t.listSize;case b.FixedSizeBinary:return t.byteWidth;default:return 1}}var E3,T3,I3,A3,P3,R3,C3,N3,B3,O3,L3,D3,F3,U3,G3,z3,V3,k3,q3,j3,W3,H3,$3,Y3,K3,X3,z,De,Se,An,Pn,Ve,Rn,Cn,Nn,Vr,wi,Sr,_i,kr,Bn,ln,Mt,Mi,vr,qr,bi,Er,hn,jr,bs,xs,fr,Ss,vs,Es,Ts,dr,Is,qi,As,Ps,Tr,Rs,Cs,Tu,Wr,Iu,Au,Pu,Ru,je,On,Yt,Hr,wo,Ns,un,_e,Ir,F6,We,te=w(()=>{ki();Ne();X3=Symbol.for("apache-arrow/DataType"),z=class e{static isDataType(t){return t?.[X3]===!0}static isNull(t){return t?.typeId===b.Null}static isInt(t){return t?.typeId===b.Int}static isFloat(t){return t?.typeId===b.Float}static isBinary(t){return t?.typeId===b.Binary}static isBinaryView(t){return t?.typeId===b.BinaryView}static isLargeBinary(t){return t?.typeId===b.LargeBinary}static isUtf8(t){return t?.typeId===b.Utf8}static isUtf8View(t){return t?.typeId===b.Utf8View}static isLargeUtf8(t){return t?.typeId===b.LargeUtf8}static isBool(t){return t?.typeId===b.Bool}static isDecimal(t){return t?.typeId===b.Decimal}static isDate(t){return t?.typeId===b.Date}static isTime(t){return t?.typeId===b.Time}static isTimestamp(t){return t?.typeId===b.Timestamp}static isInterval(t){return t?.typeId===b.Interval}static isDuration(t){return t?.typeId===b.Duration}static isList(t){return t?.typeId===b.List}static isLargeList(t){return t?.typeId===b.LargeList}static isStruct(t){return t?.typeId===b.Struct}static isUnion(t){return t?.typeId===b.Union}static isFixedSizeBinary(t){return t?.typeId===b.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===b.FixedSizeList}static isMap(t){return t?.typeId===b.Map}static isDictionary(t){return t?.typeId===b.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===jt.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===jt.Sparse}constructor(t){this.typeId=t}};E3=Symbol.toStringTag;z[E3]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[X3]=!0,e[Symbol.toStringTag]="DataType"))(z.prototype);De=class extends z{constructor(){super(b.Null)}toString(){return"Null"}};T3=Symbol.toStringTag;De[T3]=(e=>e[Symbol.toStringTag]="Null")(De.prototype);Se=class extends z{constructor(t,r){super(b.Int),this.isSigned=t,this.bitWidth=r}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};I3=Symbol.toStringTag;Se[I3]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(Se.prototype);An=class extends Se{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},Pn=class extends Se{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},Ve=class extends Se{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},Rn=class extends Se{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},Cn=class extends Se{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},Nn=class extends Se{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Vr=class extends Se{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},wi=class extends Se{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(An.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(Pn.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Ve.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(Rn.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(Cn.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Nn.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Vr.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(wi.prototype,"ArrayType",{value:BigUint64Array});Sr=class extends z{constructor(t){super(b.Float),this.precision=t}get ArrayType(){switch(this.precision){case Vt.HALF:return Uint16Array;case Vt.SINGLE:return Float32Array;case Vt.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};A3=Symbol.toStringTag;Sr[A3]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(Sr.prototype);_i=class extends Sr{constructor(){super(Vt.HALF)}},kr=class extends Sr{constructor(){super(Vt.SINGLE)}},Bn=class extends Sr{constructor(){super(Vt.DOUBLE)}};Object.defineProperty(_i.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(kr.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(Bn.prototype,"ArrayType",{value:Float64Array});ln=class extends z{constructor(){super(b.Binary)}toString(){return"Binary"}};P3=Symbol.toStringTag;ln[P3]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(ln.prototype);Mt=class extends z{constructor(){super(b.BinaryView)}toString(){return"BinaryView"}};R3=Symbol.toStringTag;Mt.ELEMENT_WIDTH=16;Mt.INLINE_CAPACITY=12;Mt.LENGTH_OFFSET=0;Mt.INLINE_OFFSET=4;Mt.BUFFER_INDEX_OFFSET=8;Mt.BUFFER_OFFSET_OFFSET=12;Mt[R3]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="BinaryView"))(Mt.prototype);Mi=class extends z{constructor(){super(b.LargeBinary)}toString(){return"LargeBinary"}};C3=Symbol.toStringTag;Mi[C3]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeBinary"))(Mi.prototype);vr=class extends z{constructor(){super(b.Utf8)}toString(){return"Utf8"}};N3=Symbol.toStringTag;vr[N3]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(vr.prototype);qr=class extends z{constructor(){super(b.Utf8View)}toString(){return"Utf8View"}};B3=Symbol.toStringTag;qr.ELEMENT_WIDTH=Mt.ELEMENT_WIDTH;qr.INLINE_CAPACITY=Mt.INLINE_CAPACITY;qr[B3]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8View"))(qr.prototype);bi=class extends z{constructor(){super(b.LargeUtf8)}toString(){return"LargeUtf8"}};O3=Symbol.toStringTag;bi[O3]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeUtf8"))(bi.prototype);Er=class extends z{constructor(){super(b.Bool)}toString(){return"Bool"}};L3=Symbol.toStringTag;Er[L3]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(Er.prototype);hn=class extends z{constructor(t,r,n=128){super(b.Decimal),this.scale=t,this.precision=r,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};D3=Symbol.toStringTag;hn[D3]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(hn.prototype);jr=class extends z{constructor(t){super(b.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${Qt[this.unit]}>`}get ArrayType(){return this.unit===Qt.DAY?Int32Array:BigInt64Array}};F3=Symbol.toStringTag;jr[F3]=(e=>(e.unit=null,e[Symbol.toStringTag]="Date"))(jr.prototype);bs=class extends jr{constructor(){super(Qt.DAY)}},xs=class extends jr{constructor(){super(Qt.MILLISECOND)}},fr=class extends z{constructor(t,r){super(b.Time),this.unit=t,this.bitWidth=r}toString(){return`Time${this.bitWidth}<${q[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};U3=Symbol.toStringTag;fr[U3]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(fr.prototype);Ss=class extends fr{constructor(){super(q.SECOND,32)}},vs=class extends fr{constructor(){super(q.MILLISECOND,32)}},Es=class extends fr{constructor(){super(q.MICROSECOND,64)}},Ts=class extends fr{constructor(){super(q.NANOSECOND,64)}},dr=class extends z{constructor(t,r){super(b.Timestamp),this.unit=t,this.timezone=r}toString(){return`Timestamp<${q[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};G3=Symbol.toStringTag;dr[G3]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Timestamp"))(dr.prototype);Is=class extends dr{constructor(t){super(q.SECOND,t)}},qi=class extends dr{constructor(t){super(q.MILLISECOND,t)}},As=class extends dr{constructor(t){super(q.MICROSECOND,t)}},Ps=class extends dr{constructor(t){super(q.NANOSECOND,t)}},Tr=class extends z{constructor(t){super(b.Interval),this.unit=t}toString(){return`Interval<${Lt[this.unit]}>`}};z3=Symbol.toStringTag;Tr[z3]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(Tr.prototype);Rs=class extends Tr{constructor(){super(Lt.DAY_TIME)}},Cs=class extends Tr{constructor(){super(Lt.YEAR_MONTH)}},Tu=class extends Tr{constructor(){super(Lt.MONTH_DAY_NANO)}},Wr=class extends z{constructor(t){super(b.Duration),this.unit=t}toString(){return`Duration<${q[this.unit]}>`}};V3=Symbol.toStringTag;Wr[V3]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(Wr.prototype);Iu=class extends Wr{constructor(){super(q.SECOND)}},Au=class extends Wr{constructor(){super(q.MILLISECOND)}},Pu=class extends Wr{constructor(){super(q.MICROSECOND)}},Ru=class extends Wr{constructor(){super(q.NANOSECOND)}},je=class extends z{constructor(t){super(b.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};k3=Symbol.toStringTag;je[k3]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(je.prototype);On=class extends z{constructor(t){super(b.LargeList),this.children=[t]}toString(){return`LargeList<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};q3=Symbol.toStringTag;On[q3]=(e=>(e.children=null,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeList"))(On.prototype);Yt=class extends z{constructor(t){super(b.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};j3=Symbol.toStringTag;Yt[j3]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(Yt.prototype);Hr=class extends z{constructor(t,r,n){super(b.Union),this.mode=t,this.children=n,this.typeIds=r=Int32Array.from(r),this.typeIdToChildIndex=r.reduce((i,o,s)=>(i[o]=s)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};W3=Symbol.toStringTag;Hr[W3]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Hr.prototype);wo=class extends Hr{constructor(t,r){super(jt.Dense,t,r)}},Ns=class extends Hr{constructor(t,r){super(jt.Sparse,t,r)}},un=class extends z{constructor(t){super(b.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};H3=Symbol.toStringTag;un[H3]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(un.prototype);_e=class extends z{constructor(t,r){super(b.FixedSizeList),this.listSize=t,this.children=[r]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};$3=Symbol.toStringTag;_e[$3]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(_e.prototype);Ir=class extends z{constructor(t,r=!1){var n,i,o;if(super(b.Map),this.children=[t],this.keysSorted=r,t&&(t.name="entries",!((n=t?.type)===null||n===void 0)&&n.children)){let s=(i=t?.type)===null||i===void 0?void 0:i.children[0];s&&(s.name="key");let a=(o=t?.type)===null||o===void 0?void 0:o.children[1];a&&(a.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};Y3=Symbol.toStringTag;Ir[Y3]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(Ir.prototype);F6=(e=>()=>++e)(-1),We=class extends z{constructor(t,r,n,i){super(b.Dictionary),this.indices=r,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?F6():It(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};K3=Symbol.toStringTag;We[K3]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(We.prototype)});function U6(e,t,r=!0){return typeof t=="number"?Al(e,t,r):typeof t=="string"&&t in b?Al(e,b[t],r):t&&t instanceof z?Al(e,J3(t),r):t?.type&&t.type instanceof z?Al(e,J3(t.type),r):Al(e,b.NONE,r)}function Al(e,t,r=!0){let n=null;switch(t){case b.Null:n=e.visitNull;break;case b.Bool:n=e.visitBool;break;case b.Int:n=e.visitInt;break;case b.Int8:n=e.visitInt8||e.visitInt;break;case b.Int16:n=e.visitInt16||e.visitInt;break;case b.Int32:n=e.visitInt32||e.visitInt;break;case b.Int64:n=e.visitInt64||e.visitInt;break;case b.Uint8:n=e.visitUint8||e.visitInt;break;case b.Uint16:n=e.visitUint16||e.visitInt;break;case b.Uint32:n=e.visitUint32||e.visitInt;break;case b.Uint64:n=e.visitUint64||e.visitInt;break;case b.Float:n=e.visitFloat;break;case b.Float16:n=e.visitFloat16||e.visitFloat;break;case b.Float32:n=e.visitFloat32||e.visitFloat;break;case b.Float64:n=e.visitFloat64||e.visitFloat;break;case b.Utf8:n=e.visitUtf8;break;case b.LargeUtf8:n=e.visitLargeUtf8;break;case b.Utf8View:n=e.visitUtf8View||e.visitUtf8;break;case b.Binary:n=e.visitBinary;break;case b.LargeBinary:n=e.visitLargeBinary;break;case b.BinaryView:n=e.visitBinaryView||e.visitBinary;break;case b.FixedSizeBinary:n=e.visitFixedSizeBinary;break;case b.Date:n=e.visitDate;break;case b.DateDay:n=e.visitDateDay||e.visitDate;break;case b.DateMillisecond:n=e.visitDateMillisecond||e.visitDate;break;case b.Timestamp:n=e.visitTimestamp;break;case b.TimestampSecond:n=e.visitTimestampSecond||e.visitTimestamp;break;case b.TimestampMillisecond:n=e.visitTimestampMillisecond||e.visitTimestamp;break;case b.TimestampMicrosecond:n=e.visitTimestampMicrosecond||e.visitTimestamp;break;case b.TimestampNanosecond:n=e.visitTimestampNanosecond||e.visitTimestamp;break;case b.Time:n=e.visitTime;break;case b.TimeSecond:n=e.visitTimeSecond||e.visitTime;break;case b.TimeMillisecond:n=e.visitTimeMillisecond||e.visitTime;break;case b.TimeMicrosecond:n=e.visitTimeMicrosecond||e.visitTime;break;case b.TimeNanosecond:n=e.visitTimeNanosecond||e.visitTime;break;case b.Decimal:n=e.visitDecimal;break;case b.List:n=e.visitList;break;case b.LargeList:n=e.visitLargeList;break;case b.Struct:n=e.visitStruct;break;case b.Union:n=e.visitUnion;break;case b.DenseUnion:n=e.visitDenseUnion||e.visitUnion;break;case b.SparseUnion:n=e.visitSparseUnion||e.visitUnion;break;case b.Dictionary:n=e.visitDictionary;break;case b.Interval:n=e.visitInterval;break;case b.IntervalDayTime:n=e.visitIntervalDayTime||e.visitInterval;break;case b.IntervalYearMonth:n=e.visitIntervalYearMonth||e.visitInterval;break;case b.IntervalMonthDayNano:n=e.visitIntervalMonthDayNano||e.visitInterval;break;case b.Duration:n=e.visitDuration;break;case b.DurationSecond:n=e.visitDurationSecond||e.visitDuration;break;case b.DurationMillisecond:n=e.visitDurationMillisecond||e.visitDuration;break;case b.DurationMicrosecond:n=e.visitDurationMicrosecond||e.visitDuration;break;case b.DurationNanosecond:n=e.visitDurationNanosecond||e.visitDuration;break;case b.FixedSizeList:n=e.visitFixedSizeList;break;case b.Map:n=e.visitMap;break}if(typeof n=="function")return n;if(!r)return()=>null;throw new Error(`Unrecognized type '${b[t]}'`)}function J3(e){switch(e.typeId){case b.Null:return b.Null;case b.Int:{let{bitWidth:t,isSigned:r}=e;switch(t){case 8:return r?b.Int8:b.Uint8;case 16:return r?b.Int16:b.Uint16;case 32:return r?b.Int32:b.Uint32;case 64:return r?b.Int64:b.Uint64}return b.Int}case b.Float:switch(e.precision){case Vt.HALF:return b.Float16;case Vt.SINGLE:return b.Float32;case Vt.DOUBLE:return b.Float64}return b.Float;case b.Binary:return b.Binary;case b.LargeBinary:return b.LargeBinary;case b.BinaryView:return b.BinaryView;case b.Utf8:return b.Utf8;case b.LargeUtf8:return b.LargeUtf8;case b.Utf8View:return b.Utf8View;case b.Bool:return b.Bool;case b.Decimal:return b.Decimal;case b.Time:switch(e.unit){case q.SECOND:return b.TimeSecond;case q.MILLISECOND:return b.TimeMillisecond;case q.MICROSECOND:return b.TimeMicrosecond;case q.NANOSECOND:return b.TimeNanosecond}return b.Time;case b.Timestamp:switch(e.unit){case q.SECOND:return b.TimestampSecond;case q.MILLISECOND:return b.TimestampMillisecond;case q.MICROSECOND:return b.TimestampMicrosecond;case q.NANOSECOND:return b.TimestampNanosecond}return b.Timestamp;case b.Date:switch(e.unit){case Qt.DAY:return b.DateDay;case Qt.MILLISECOND:return b.DateMillisecond}return b.Date;case b.Interval:switch(e.unit){case Lt.DAY_TIME:return b.IntervalDayTime;case Lt.YEAR_MONTH:return b.IntervalYearMonth;case Lt.MONTH_DAY_NANO:return b.IntervalMonthDayNano}return b.Interval;case b.Duration:switch(e.unit){case q.SECOND:return b.DurationSecond;case q.MILLISECOND:return b.DurationMillisecond;case q.MICROSECOND:return b.DurationMicrosecond;case q.NANOSECOND:return b.DurationNanosecond}return b.Duration;case b.Map:return b.Map;case b.List:return b.List;case b.LargeList:return b.LargeList;case b.Struct:return b.Struct;case b.Union:switch(e.mode){case jt.Dense:return b.DenseUnion;case jt.Sparse:return b.SparseUnion}return b.Union;case b.FixedSizeBinary:return b.FixedSizeBinary;case b.FixedSizeList:return b.FixedSizeList;case b.Dictionary:return b.Dictionary}throw new Error(`Unrecognized type '${b[e.typeId]}'`)}var rt,fn=w(()=>{Ne();te();rt=class{visitMany(t,...r){return t.map((n,i)=>this.visit(n,...r.map(o=>o[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,r=!0){return U6(this,t,r)}getVisitFnByTypeId(t,r=!0){return Al(this,t,r)}visitNull(t,...r){return null}visitBool(t,...r){return null}visitInt(t,...r){return null}visitFloat(t,...r){return null}visitUtf8(t,...r){return null}visitLargeUtf8(t,...r){return null}visitUtf8View(t,...r){return null}visitBinary(t,...r){return null}visitLargeBinary(t,...r){return null}visitBinaryView(t,...r){return null}visitFixedSizeBinary(t,...r){return null}visitDate(t,...r){return null}visitTimestamp(t,...r){return null}visitTime(t,...r){return null}visitDecimal(t,...r){return null}visitList(t,...r){return null}visitLargeList(t,...r){return null}visitStruct(t,...r){return null}visitUnion(t,...r){return null}visitDictionary(t,...r){return null}visitInterval(t,...r){return null}visitDuration(t,...r){return null}visitFixedSizeList(t,...r){return null}visitMap(t,...r){return null}};rt.prototype.visitInt8=null;rt.prototype.visitInt16=null;rt.prototype.visitInt32=null;rt.prototype.visitInt64=null;rt.prototype.visitUint8=null;rt.prototype.visitUint16=null;rt.prototype.visitUint32=null;rt.prototype.visitUint64=null;rt.prototype.visitFloat16=null;rt.prototype.visitFloat32=null;rt.prototype.visitFloat64=null;rt.prototype.visitDateDay=null;rt.prototype.visitDateMillisecond=null;rt.prototype.visitTimestampSecond=null;rt.prototype.visitTimestampMillisecond=null;rt.prototype.visitTimestampMicrosecond=null;rt.prototype.visitTimestampNanosecond=null;rt.prototype.visitTimeSecond=null;rt.prototype.visitTimeMillisecond=null;rt.prototype.visitTimeMicrosecond=null;rt.prototype.visitTimeNanosecond=null;rt.prototype.visitDenseUnion=null;rt.prototype.visitSparseUnion=null;rt.prototype.visitIntervalDayTime=null;rt.prototype.visitIntervalYearMonth=null;rt.prototype.visitIntervalMonthDayNano=null;rt.prototype.visitDuration=null;rt.prototype.visitDurationSecond=null;rt.prototype.visitDurationMillisecond=null;rt.prototype.visitDurationMicrosecond=null;rt.prototype.visitDurationNanosecond=null});var Yw={};Zr(Yw,{float64ToUint16:()=>Cu,uint16ToFloat64:()=>Jm});function Jm(e){let t=(e&31744)>>10,r=(e&1023)/1024,n=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return n*(r?Number.NaN:1/0);case 0:return n*(r?6103515625e-14*r:0)}return n*Math.pow(2,t-15)*(1+r)}function Cu(e){if(e!==e)return 32256;Q3[0]=e;let t=(Pl[1]&2147483648)>>16&65535,r=Pl[1]&2146435072,n=0;return r>=1089470464?Pl[0]>0?r=31744:(r=(r&2080374784)>>16,n=(Pl[1]&1048575)>>10):r<=1056964608?(n=1048576+(Pl[1]&1048575),n=1048576+(n<<(r>>20)-998)>>21,r=0):(r=r-1056964608>>10,n=(Pl[1]&1048575)+512>>10),t|r|n&65535}var Q3,Pl,Nu=w(()=>{Q3=new Float64Array(1),Pl=new Uint32Array(Q3.buffer)});function mt(e){return(t,r,n)=>{if(t.setValid(r,n!=null))return e(t,r,n)}}var ct,G6,t4,z6,_o,Kw,e4,V6,Qm,tp,Xw,r4,k6,n4,q6,i4,j6,Zw,ep,rp,np,ip,Jw,op,sp,ap,cp,Qw,t_,o4,W6,H6,$6,Y6,K6,X6,Z6,s4,a4,J6,e_,lp,hp,up,fp,dp,mp,pp,r_,Q6,mr,Dn=w(()=>{Ar();fn();ki();fo();Nu();Ne();te();ct=class extends rt{};G6=(e,t,r)=>{e[t]=Math.floor(r/864e5)},t4=(e,t,r,n)=>{if(r+1<t.length){let i=It(t[r]),o=It(t[r+1]);e.set(n.subarray(0,o-i),i)}},z6=({offset:e,values:t},r,n)=>{let i=e+r;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},_o=({values:e},t,r)=>{e[t]=r},Kw=({values:e},t,r)=>{e[t]=r},e4=({values:e},t,r)=>{e[t]=Cu(r)},V6=(e,t,r)=>{switch(e.type.precision){case Vt.HALF:return e4(e,t,r);case Vt.SINGLE:case Vt.DOUBLE:return Kw(e,t,r)}},Qm=({values:e},t,r)=>{G6(e,t,r.valueOf())},tp=({values:e},t,r)=>{e[t]=BigInt(r)},Xw=({stride:e,values:t},r,n)=>{t.set(n.subarray(0,e),e*r)},r4=({values:e,valueOffsets:t},r,n)=>t4(e,t,r,n),k6=e=>{let t=e.variadicBuffers;return(!Array.isArray(t)||Object.isFrozen(t))&&(t=Array.from(t),e.variadicBuffers=t),t},n4=(e,t,r)=>{var n,i,o,s;let a=e.values;if(!a)throw new Error("BinaryView data is missing view buffer");let c=Mt.ELEMENT_WIDTH,l=t*c,h=l+c;if(l<0||h>a.length)throw new RangeError(`BinaryView index ${t} out of bounds`);a.fill(0,l,h);let u=new DataView(a.buffer,a.byteOffset+l,c),f=r.length;if(u.setInt32(Mt.LENGTH_OFFSET,f,!0),f<=Mt.INLINE_CAPACITY){a.set(r,l+Mt.INLINE_OFFSET);return}let d=((n=r[0])!==null&&n!==void 0?n:0)|((i=r[1])!==null&&i!==void 0?i:0)<<8|((o=r[2])!==null&&o!==void 0?o:0)<<16|((s=r[3])!==null&&s!==void 0?s:0)<<24;u.setUint32(Mt.INLINE_OFFSET,d>>>0,!0);let m=k6(e),p=r.slice(),g=m.push(p)-1;u.setInt32(Mt.BUFFER_INDEX_OFFSET,g,!0),u.setInt32(Mt.BUFFER_OFFSET_OFFSET,0,!0)},q6=(e,t,r)=>{let n=r instanceof Uint8Array?r:new Uint8Array(r);n4(e,t,n)},i4=({values:e,valueOffsets:t},r,n)=>t4(e,t,r,En(n)),j6=(e,t,r)=>{let n=En(r);n4(e,t,n)},Zw=(e,t,r)=>{e.type.unit===Qt.DAY?Qm(e,t,r):tp(e,t,r)},ep=({values:e},t,r)=>{e[t]=BigInt(r/1e3)},rp=({values:e},t,r)=>{e[t]=BigInt(r)},np=({values:e},t,r)=>{e[t]=BigInt(r*1e3)},ip=({values:e},t,r)=>{e[t]=BigInt(r*1e6)},Jw=(e,t,r)=>{switch(e.type.unit){case q.SECOND:return ep(e,t,r);case q.MILLISECOND:return rp(e,t,r);case q.MICROSECOND:return np(e,t,r);case q.NANOSECOND:return ip(e,t,r)}},op=({values:e},t,r)=>{e[t]=r},sp=({values:e},t,r)=>{e[t]=r},ap=({values:e},t,r)=>{e[t]=r},cp=({values:e},t,r)=>{e[t]=r},Qw=(e,t,r)=>{switch(e.type.unit){case q.SECOND:return op(e,t,r);case q.MILLISECOND:return sp(e,t,r);case q.MICROSECOND:return ap(e,t,r);case q.NANOSECOND:return cp(e,t,r)}},t_=({values:e,stride:t},r,n)=>{e.set(n.subarray(0,t),t*r)},o4=(e,t,r)=>{let n=e.children[0],i=e.valueOffsets,o=mr.getVisitFn(n),s=It(i[t]),a=It(i[t+1]);if(Array.isArray(r))for(let c=-1,l=s;l<a;)o(n,l++,r[++c]);else for(let c=-1,l=s;l<a;)o(n,l++,r.get(++c))},W6=(e,t,r)=>{let n=e.children[0],{valueOffsets:i}=e,o=mr.getVisitFn(n),{[t]:s,[t+1]:a}=i,c=r instanceof Map?r.entries():Object.entries(r);for(let l of c)if(o(n,s,l),++s>=a)break},H6=(e,t)=>(r,n,i,o)=>n&&r(n,e,t[o]),$6=(e,t)=>(r,n,i,o)=>n&&r(n,e,t.get(o)),Y6=(e,t)=>(r,n,i,o)=>n&&r(n,e,t.get(i.name)),K6=(e,t)=>(r,n,i,o)=>n&&r(n,e,t[i.name]),X6=(e,t,r)=>{let n=e.type.children.map(o=>mr.getVisitFn(o.type)),i=r instanceof Map?Y6(t,r):r instanceof $?$6(t,r):Array.isArray(r)?H6(t,r):K6(t,r);e.type.children.forEach((o,s)=>i(n[s],e.children[s],o,s))},Z6=(e,t,r)=>{e.type.mode===jt.Dense?s4(e,t,r):a4(e,t,r)},s4=(e,t,r)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[n];mr.visit(i,e.valueOffsets[t],r)},a4=(e,t,r)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[n];mr.visit(i,t,r)},J6=(e,t,r)=>{var n;(n=e.dictionary)===null||n===void 0||n.set(e.values[t],r)},e_=(e,t,r)=>{switch(e.type.unit){case Lt.YEAR_MONTH:return hp(e,t,r);case Lt.DAY_TIME:return lp(e,t,r);case Lt.MONTH_DAY_NANO:return up(e,t,r)}},lp=({values:e},t,r)=>{e.set(r.subarray(0,2),2*t)},hp=({values:e},t,r)=>{e[t]=r[0]*12+r[1]%12},up=({values:e,stride:t},r,n)=>{e.set(n.subarray(0,t),t*r)},fp=({values:e},t,r)=>{e[t]=r},dp=({values:e},t,r)=>{e[t]=r},mp=({values:e},t,r)=>{e[t]=r},pp=({values:e},t,r)=>{e[t]=r},r_=(e,t,r)=>{switch(e.type.unit){case q.SECOND:return fp(e,t,r);case q.MILLISECOND:return dp(e,t,r);case q.MICROSECOND:return mp(e,t,r);case q.NANOSECOND:return pp(e,t,r)}},Q6=(e,t,r)=>{let{stride:n}=e,i=e.children[0],o=mr.getVisitFn(i);if(Array.isArray(r))for(let s=-1,a=t*n;++s<n;)o(i,a+s,r[s]);else for(let s=-1,a=t*n;++s<n;)o(i,a+s,r.get(s))};ct.prototype.visitBool=mt(z6);ct.prototype.visitInt=mt(_o);ct.prototype.visitInt8=mt(_o);ct.prototype.visitInt16=mt(_o);ct.prototype.visitInt32=mt(_o);ct.prototype.visitInt64=mt(_o);ct.prototype.visitUint8=mt(_o);ct.prototype.visitUint16=mt(_o);ct.prototype.visitUint32=mt(_o);ct.prototype.visitUint64=mt(_o);ct.prototype.visitFloat=mt(V6);ct.prototype.visitFloat16=mt(e4);ct.prototype.visitFloat32=mt(Kw);ct.prototype.visitFloat64=mt(Kw);ct.prototype.visitUtf8=mt(i4);ct.prototype.visitLargeUtf8=mt(i4);ct.prototype.visitUtf8View=mt(j6);ct.prototype.visitBinary=mt(r4);ct.prototype.visitLargeBinary=mt(r4);ct.prototype.visitBinaryView=mt(q6);ct.prototype.visitFixedSizeBinary=mt(Xw);ct.prototype.visitDate=mt(Zw);ct.prototype.visitDateDay=mt(Qm);ct.prototype.visitDateMillisecond=mt(tp);ct.prototype.visitTimestamp=mt(Jw);ct.prototype.visitTimestampSecond=mt(ep);ct.prototype.visitTimestampMillisecond=mt(rp);ct.prototype.visitTimestampMicrosecond=mt(np);ct.prototype.visitTimestampNanosecond=mt(ip);ct.prototype.visitTime=mt(Qw);ct.prototype.visitTimeSecond=mt(op);ct.prototype.visitTimeMillisecond=mt(sp);ct.prototype.visitTimeMicrosecond=mt(ap);ct.prototype.visitTimeNanosecond=mt(cp);ct.prototype.visitDecimal=mt(t_);ct.prototype.visitList=mt(o4);ct.prototype.visitLargeList=mt(o4);ct.prototype.visitStruct=mt(X6);ct.prototype.visitUnion=mt(Z6);ct.prototype.visitDenseUnion=mt(s4);ct.prototype.visitSparseUnion=mt(a4);ct.prototype.visitDictionary=mt(J6);ct.prototype.visitInterval=mt(e_);ct.prototype.visitIntervalDayTime=mt(lp);ct.prototype.visitIntervalYearMonth=mt(hp);ct.prototype.visitIntervalMonthDayNano=mt(up);ct.prototype.visitDuration=mt(r_);ct.prototype.visitDurationSecond=mt(fp);ct.prototype.visitDurationMillisecond=mt(dp);ct.prototype.visitDurationMicrosecond=mt(mp);ct.prototype.visitDurationNanosecond=mt(pp);ct.prototype.visitFixedSizeList=mt(Q6);ct.prototype.visitMap=mt(W6);mr=new ct});var xi,Rl,ji,n_,i_,tL,gp=w(()=>{vu();Ua();Dn();xi=Symbol.for("parent"),Rl=Symbol.for("rowIndex"),ji=class{constructor(t,r){return this[xi]=t,this[Rl]=r,new Proxy(this,tL)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Rl],r=this[xi],n=r.type.children,i={};for(let o=-1,s=n.length;++o<s;)i[n[o].name]=He.visit(r.children[o],t);return i}toString(){return`{${[...this].map(([t,r])=>`${gi(t)}: ${gi(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new n_(this[xi],this[Rl])}},n_=class{constructor(t,r){this.childIndex=0,this.children=t.children,this.rowIndex=r,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,He.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(ji.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[xi]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Rl]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});i_=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[xi].type.children.map(r=>r.name)}has(t,r){return t[xi].type.children.some(n=>n.name===r)}getOwnPropertyDescriptor(t,r){if(t[xi].type.children.some(n=>n.name===r))return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let n=t[xi].type.children.findIndex(i=>i.name===r);if(n!==-1){let i=He.visit(t[xi].children[n],t[Rl]);return Reflect.set(t,r,i),i}}set(t,r,n){let i=t[xi].type.children.findIndex(o=>o.name===r);return i!==-1?(mr.visit(t[xi].children[i],t[Rl],n),Reflect.set(t,r,n)):Reflect.has(t,r)||typeof r=="symbol"?Reflect.set(t,r,n):!1}},tL=new i_});function ht(e){return(t,r)=>t.getValid(r)?e(t,r):null}var it,eL,Cl,rL,nL,c4,iL,l4,h4,Bs,oL,u4,sL,f4,d4,aL,m4,cL,lL,hL,uL,p4,g4,y4,w4,fL,_4,M4,b4,x4,dL,mL,S4,pL,gL,yL,v4,E4,wL,_L,T4,I4,A4,P4,R4,C4,N4,ML,bL,He,Ua=w(()=>{Zm();Ar();fn();Bu();gp();ki();fo();Nu();Ne();it=class extends rt{};eL=(e,t)=>864e5*e[t],Cl=16,rL=12,nL=(e,t)=>null,c4=(e,t,r)=>{if(r+1>=t.length)return null;let n=It(t[r]),i=It(t[r+1]);return e.subarray(n,i)},iL=({offset:e,values:t},r)=>{let n=e+r;return(t[n>>3]&1<<n%8)!==0},l4=({values:e},t)=>eL(e,t),h4=({values:e},t)=>It(e[t]),Bs=({stride:e,values:t},r)=>t[e*r],oL=({stride:e,values:t},r)=>Jm(t[e*r]),u4=({values:e},t)=>e[t],sL=({stride:e,values:t},r)=>t.subarray(e*r,e*(r+1)),f4=({values:e,valueOffsets:t},r)=>c4(e,t,r),d4=(e,t)=>{var r;let n=e.values;if(!n)throw new Error("BinaryView data is missing view buffer");let i=t*Cl,o=i+Cl;if(i<0||o>n.length)throw new Error(`BinaryView data buffer is too short: expected ${Cl} bytes, got ${Math.max(0,n.length-i)}`);let s=n.subarray(i,o);if(s.length<Cl)throw new Error(`BinaryView data buffer is too short: expected ${Cl} bytes, got ${s.length}`);let a=new DataView(n.buffer,s.byteOffset,Cl),c=a.getInt32(0,!0);if(c<=0)return new Uint8Array(0);if(c<=rL)return s.subarray(4,4+c);let l=a.getInt32(8,!0),h=a.getInt32(12,!0),u=(r=e.variadicBuffers)===null||r===void 0?void 0:r[l];if(!u)throw new Error(`BinaryView variadic buffer ${l} is missing`);return u.subarray(h,h+c)},aL=(e,t)=>d4(e,t),m4=({values:e,valueOffsets:t},r)=>{let n=c4(e,t,r);return n!==null?_l(n):null},cL=(e,t)=>{let r=d4(e,t);return _l(r)},lL=({values:e},t)=>e[t],hL=({type:e,values:t},r)=>e.precision!==Vt.HALF?t[r]:Jm(t[r]),uL=(e,t)=>e.type.unit===Qt.DAY?l4(e,t):h4(e,t),p4=({values:e},t)=>1e3*It(e[t]),g4=({values:e},t)=>It(e[t]),y4=({values:e},t)=>jw(e[t],BigInt(1e3)),w4=({values:e},t)=>jw(e[t],BigInt(1e6)),fL=(e,t)=>{switch(e.type.unit){case q.SECOND:return p4(e,t);case q.MILLISECOND:return g4(e,t);case q.MICROSECOND:return y4(e,t);case q.NANOSECOND:return w4(e,t)}},_4=({values:e},t)=>e[t],M4=({values:e},t)=>e[t],b4=({values:e},t)=>e[t],x4=({values:e},t)=>e[t],dL=(e,t)=>{switch(e.type.unit){case q.SECOND:return _4(e,t);case q.MILLISECOND:return M4(e,t);case q.MICROSECOND:return b4(e,t);case q.NANOSECOND:return x4(e,t)}},mL=({values:e,stride:t},r)=>Fa.decimal(e.subarray(t*r,t*(r+1))),S4=(e,t)=>{let{valueOffsets:r,stride:n,children:i}=e,o=It(r[t*n]),s=It(r[t*n+1]),c=i[0].slice(o,s-o);return new $([c])},pL=(e,t)=>{let{valueOffsets:r,children:n}=e,{[t]:i,[t+1]:o}=r,s=n[0];return new Xn(s.slice(i,o-i))},gL=(e,t)=>new ji(e,t),yL=(e,t)=>e.type.mode===jt.Dense?v4(e,t):E4(e,t),v4=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[r];return He.visit(n,e.valueOffsets[t])},E4=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[r];return He.visit(n,t)},wL=(e,t)=>{var r;return(r=e.dictionary)===null||r===void 0?void 0:r.get(e.values[t])},_L=(e,t)=>e.type.unit===Lt.MONTH_DAY_NANO?A4(e,t):e.type.unit===Lt.DAY_TIME?T4(e,t):I4(e,t),T4=({values:e},t)=>e.subarray(2*t,2*(t+1)),I4=({values:e},t)=>{let r=e[t],n=new Int32Array(2);return n[0]=Math.trunc(r/12),n[1]=Math.trunc(r%12),n},A4=({values:e},t)=>e.subarray(4*t,4*(t+1)),P4=({values:e},t)=>e[t],R4=({values:e},t)=>e[t],C4=({values:e},t)=>e[t],N4=({values:e},t)=>e[t],ML=(e,t)=>{switch(e.type.unit){case q.SECOND:return P4(e,t);case q.MILLISECOND:return R4(e,t);case q.MICROSECOND:return C4(e,t);case q.NANOSECOND:return N4(e,t)}},bL=(e,t)=>{let{stride:r,children:n}=e,o=n[0].slice(t*r,r);return new $([o])};it.prototype.visitNull=ht(nL);it.prototype.visitBool=ht(iL);it.prototype.visitInt=ht(lL);it.prototype.visitInt8=ht(Bs);it.prototype.visitInt16=ht(Bs);it.prototype.visitInt32=ht(Bs);it.prototype.visitInt64=ht(u4);it.prototype.visitUint8=ht(Bs);it.prototype.visitUint16=ht(Bs);it.prototype.visitUint32=ht(Bs);it.prototype.visitUint64=ht(u4);it.prototype.visitFloat=ht(hL);it.prototype.visitFloat16=ht(oL);it.prototype.visitFloat32=ht(Bs);it.prototype.visitFloat64=ht(Bs);it.prototype.visitUtf8=ht(m4);it.prototype.visitLargeUtf8=ht(m4);it.prototype.visitUtf8View=ht(cL);it.prototype.visitBinary=ht(f4);it.prototype.visitLargeBinary=ht(f4);it.prototype.visitBinaryView=ht(aL);it.prototype.visitFixedSizeBinary=ht(sL);it.prototype.visitDate=ht(uL);it.prototype.visitDateDay=ht(l4);it.prototype.visitDateMillisecond=ht(h4);it.prototype.visitTimestamp=ht(fL);it.prototype.visitTimestampSecond=ht(p4);it.prototype.visitTimestampMillisecond=ht(g4);it.prototype.visitTimestampMicrosecond=ht(y4);it.prototype.visitTimestampNanosecond=ht(w4);it.prototype.visitTime=ht(dL);it.prototype.visitTimeSecond=ht(_4);it.prototype.visitTimeMillisecond=ht(M4);it.prototype.visitTimeMicrosecond=ht(b4);it.prototype.visitTimeNanosecond=ht(x4);it.prototype.visitDecimal=ht(mL);it.prototype.visitList=ht(S4);it.prototype.visitLargeList=ht(S4);it.prototype.visitStruct=ht(gL);it.prototype.visitUnion=ht(yL);it.prototype.visitDenseUnion=ht(v4);it.prototype.visitSparseUnion=ht(E4);it.prototype.visitDictionary=ht(wL);it.prototype.visitInterval=ht(_L);it.prototype.visitIntervalDayTime=ht(T4);it.prototype.visitIntervalYearMonth=ht(I4);it.prototype.visitIntervalMonthDayNano=ht(A4);it.prototype.visitDuration=ht(ML);it.prototype.visitDurationSecond=ht(P4);it.prototype.visitDurationMillisecond=ht(R4);it.prototype.visitDurationMicrosecond=ht(C4);it.prototype.visitDurationNanosecond=ht(N4);it.prototype.visitFixedSizeList=ht(bL);it.prototype.visitMap=ht(pL);He=new it});var Os,Bl,Nl,o_,Xn,s_,a_,Bu=w(()=>{Ar();vu();Ua();Dn();Os=Symbol.for("keys"),Bl=Symbol.for("vals"),Nl=Symbol.for("kKeysAsStrings"),o_=Symbol.for("_kKeysAsStrings"),Xn=class{constructor(t){return this[Os]=new $([t.children[0]]).memoize(),this[Bl]=t.children[1],new Proxy(this,new a_)}get[Nl](){return this[o_]||(this[o_]=Array.from(this[Os].toArray(),String))}[Symbol.iterator](){return new s_(this[Os],this[Bl])}get size(){return this[Os].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Os],r=this[Bl],n={};for(let i=-1,o=t.length;++i<o;)n[t.get(i)]=He.visit(r,i);return n}toString(){return`{${[...this].map(([t,r])=>`${gi(t)}: ${gi(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},s_=class{constructor(t,r){this.keys=t,this.vals=r,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),He.visit(this.vals,t)]})}},a_=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Nl]}has(t,r){return t[Nl].includes(r)}getOwnPropertyDescriptor(t,r){if(t[Nl].indexOf(r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let n=t[Nl].indexOf(r);if(n!==-1){let i=He.visit(Reflect.get(t,Bl),n);return Reflect.set(t,r,i),i}}set(t,r,n){let i=t[Nl].indexOf(r);return i!==-1?(mr.visit(Reflect.get(t,Bl),i,n),Reflect.set(t,r,n)):Reflect.has(t,r)?Reflect.set(t,r,n):!1}};Object.defineProperties(Xn.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Os]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Bl]:{writable:!0,enumerable:!1,configurable:!1,value:null},[o_]:{writable:!0,enumerable:!1,configurable:!1,value:null}})});var c_={};Zr(c_,{clampRange:()=>Ou,createElementComparator:()=>Ls,wrapIndex:()=>Ga});function Ou(e,t,r,n){let{length:i=0}=e,o=typeof t!="number"?0:t,s=typeof r!="number"?i:r;return o<0&&(o=(o%i+i)%i),s<0&&(s=(s%i+i)%i),s<o&&(B4=o,o=s,s=B4),s>i&&(s=i),n?n(e,o,s):[o,s]}function Ls(e){if(typeof e!=="object"||e===null)return O4(e)?O4:r=>r===e;if(e instanceof Date){let r=e.valueOf();return n=>n instanceof Date?n.valueOf()===r:!1}return ArrayBuffer.isView(e)?r=>r?fw(e,r):!1:e instanceof Map?SL(e):Array.isArray(e)?xL(e):e instanceof $?vL(e):EL(e,!0)}function xL(e){let t=[];for(let r=-1,n=e.length;++r<n;)t[r]=Ls(e[r]);return yp(t)}function SL(e){let t=-1,r=[];for(let n of e.values())r[++t]=Ls(n);return yp(r)}function vL(e){let t=[];for(let r=-1,n=e.length;++r<n;)t[r]=Ls(e.get(r));return yp(t)}function EL(e,t=!1){let r=Object.keys(e);if(!t&&r.length===0)return()=>!1;let n=[];for(let i=-1,o=r.length;++i<o;)n[i]=Ls(e[r[i]]);return yp(n,r)}function yp(e,t){return r=>{if(!r||typeof r!="object")return!1;switch(r.constructor){case Array:return TL(e,r);case Map:return L4(e,r,r.keys());case Xn:case ji:case Object:case void 0:return L4(e,r,t||Object.keys(r))}return r instanceof $?IL(e,r):!1}}function TL(e,t){let r=e.length;if(t.length!==r)return!1;for(let n=-1;++n<r;)if(!e[n](t[n]))return!1;return!0}function IL(e,t){let r=e.length;if(t.length!==r)return!1;for(let n=-1;++n<r;)if(!e[n](t.get(n)))return!1;return!0}function L4(e,t,r){let n=r[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),o=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),s=0,a=e.length,c=o.next(),l=n.next(),h=i.next();for(;s<a&&!l.done&&!h.done&&!c.done&&!(l.value!==h.value||!e[s](c.value));++s,l=n.next(),h=i.next(),c=o.next());return s===a&&l.done&&h.done&&c.done?!0:(n.return&&n.return(),i.return&&i.return(),o.return&&o.return(),!1)}var B4,Ga,O4,Ol=w(()=>{Ar();Bu();gp();Je();Ga=(e,t)=>e<0?t+e:e,O4=e=>e!==e});var l_={};Zr(l_,{BitIterator:()=>Wi,getBit:()=>_p,getBool:()=>Ll,packBools:()=>Va,popcnt_array:()=>D4,popcnt_bit_range:()=>Lu,popcnt_uint32:()=>wp,setBool:()=>AL,truncateBitmap:()=>za});function Ll(e,t,r,n){return(r&1<<n)!==0}function _p(e,t,r,n){return(r&1<<n)>>n}function AL(e,t,r){return r?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function za(e,t,r){let n=r.byteLength+7&-8;if(e>0||r.byteLength<n){let i=new Uint8Array(n);return i.set(e%8===0?r.subarray(e>>3):Va(new Wi(r,e,t,null,Ll)).subarray(0,n)),i}return r}function Va(e){let t=[],r=0,n=0,i=0;for(let s of e)s&&(i|=1<<n),++n===8&&(t[r++]=i,i=n=0);(r===0||n>0)&&(t[r++]=i);let o=new Uint8Array(t.length+7&-8);return o.set(t),o}function Lu(e,t,r){if(r-t<=0)return 0;if(r-t<8){let o=0;for(let s of new Wi(e,t,r-t,e,_p))o+=s;return o}let n=r>>3<<3,i=t+(t%8===0?0:8-t%8);return Lu(e,t,i)+Lu(e,n,r)+D4(e,i>>3,n-i>>3)}function D4(e,t,r){let n=0,i=Math.trunc(t),o=new DataView(e.buffer,e.byteOffset,e.byteLength),s=r===void 0?e.byteLength:i+r;for(;s-i>=4;)n+=wp(o.getUint32(i)),i+=4;for(;s-i>=2;)n+=wp(o.getUint16(i)),i+=2;for(;s-i>=1;)n+=wp(o.getUint8(i)),i+=1;return n}function wp(e){let t=Math.trunc(e);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var Wi,ka=w(()=>{Wi=class{constructor(t,r,n,i,o){this.bytes=t,this.length=n,this.context=i,this.get=o,this.bit=r%8,this.byteIndex=r>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}}});function Q(e){return RL.visit(e)}var PL,F4,ut,h_,RL,Zn=w(()=>{Ar();Ne();te();ka();te();fn();Je();PL=-1,F4=Symbol.for("apache-arrow/Data"),ut=class e{static isData(t){return t?.[F4]===!0}get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:t}=this;return z.isSparseUnion(t)?this.children.some(r=>r.nullable):z.isDenseUnion(t)?this.children.some(r=>r.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:r,values:n,nullBitmap:i,typeIds:o}=this;return r&&(t+=r.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),t+=this.variadicBuffers.reduce((s,a)=>{var c;return s+((c=a?.byteLength)!==null&&c!==void 0?c:0)},0),this.children.reduce((s,a)=>s+a.byteLength,t)}get nullCount(){if(z.isUnion(this.type))return this.children.reduce((n,i)=>n+i.nullCount,0);let t=this._nullCount,r;return t<=PL&&(r=this.nullBitmap)&&(this._nullCount=t=r.length===0?0:this.length-Lu(r,this.offset,this.offset+this.length)),t}constructor(t,r,n,i,o,s=[],a,c=[]){var l;this.type=t,this.children=s,this.dictionary=a,this.offset=Math.floor(Math.max(r||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let h;o instanceof e?(this.stride=o.stride,this.values=o.values,this.typeIds=o.typeIds,this.nullBitmap=o.nullBitmap,this.valueOffsets=o.valueOffsets,this.variadicBuffers=o.variadicBuffers):(this.stride=Ln(t),o&&((h=o[0])&&(this.valueOffsets=h),(h=o[1])&&(this.values=h),(h=o[2])&&(this.nullBitmap=h),(h=o[3])&&(this.typeIds=h)),this.variadicBuffers=c),(l=this.variadicBuffers)!==null&&l!==void 0||(this.variadicBuffers=[])}getValid(t){let{type:r}=this;if(z.isUnion(r)){let n=r,i=this.typeIds[t],o=n.typeIdToChildIndex[i],s=this.children[o],a=this.valueOffsets,c=n.mode===jt.Dense&&a?Number(a[t]):t;return s.getValid(c)}if(this.nullable&&this.nullCount>0){let n=this.offset+t;return(this.nullBitmap[n>>3]&1<<n%8)!==0}return!0}setValid(t,r){let n,{type:i}=this;if(z.isUnion(i)){let o=i,s=this.typeIds[t],a=o.typeIdToChildIndex[s],c=this.children[a],l=this.valueOffsets,h=o.mode===jt.Dense&&l?Number(l[t]):t;n=c.getValid(h),c.setValid(h,r)}else{let{nullBitmap:o}=this,{offset:s,length:a}=this,c=s+t,l=1<<c%8,h=c>>3;(!o||o.byteLength<=h)&&(o=new Uint8Array((s+a+63&-64)>>3).fill(255),this.nullCount>0?(o.set(za(s,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:o})):Object.assign(this,{nullBitmap:o,_nullCount:0}));let u=o[h];n=(u&l)!==0,o[h]=r?u|l:u&~l}return n!==!!r&&(this._nullCount=this.nullCount+(r?-1:1)),r}clone(t=this.type,r=this.offset,n=this.length,i=this._nullCount,o=this,s=this.children,a=this.variadicBuffers){return new e(t,r,n,i,o,s,this.dictionary,a)}slice(t,r){let{stride:n,typeId:i,children:o}=this,s=+(this._nullCount===0)-1,a=i===16?n:1,c=this._sliceBuffers(t,r,n,i);return this.clone(this.type,this.offset+t,r,s,c,o.length===0||this.valueOffsets?o:this._sliceChildren(o,a*t,a*r),this.variadicBuffers)}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===b.Null)return this.clone(this.type,0,t,0,this.buffers,this.children,this.variadicBuffers);let{length:r,nullCount:n}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,r>>3);i[r>>3]=(1<<r-(r&-8))-1,n>0&&i.set(za(this.offset,r,this.nullBitmap),0);let o=this.buffers;return o[xe.VALIDITY]=i,this.clone(this.type,0,t,n+(t-r),o,this.children,this.variadicBuffers)}_sliceBuffers(t,r,n,i){let o,{buffers:s}=this;if((o=s[xe.TYPE])&&(s[xe.TYPE]=o.subarray(t,t+r)),z.isBinaryView(this.type)||z.isUtf8View(this.type)){let a=Mt.ELEMENT_WIDTH;(o=s[xe.DATA])&&(s[xe.DATA]=o.subarray(t*a,(t+r)*a))}else(o=s[xe.OFFSET])&&(s[xe.OFFSET]=o.subarray(t,t+r+1))||(o=s[xe.DATA])&&(s[xe.DATA]=i===6?o:o.subarray(n*t,n*(t+r)));return s}_sliceChildren(t,r,n){return t.map(i=>i.slice(r,n))}};ut.prototype.children=Object.freeze([]);ut.prototype[F4]=!0;Object.defineProperty(ut,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===ut&&ut.isData(t)}});h_=class e extends rt{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:r,["offset"]:n=0,["length"]:i=0}=t;return new ut(r,n,i,i)}visitBool(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitInt(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitUtf8(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.data),o=nt(t.nullBitmap),s=Oa(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[s,i,o])}visitUtf8View(t){var r;let{["type"]:n,["offset"]:i=0}=t,o=Tt(n.ArrayType,t.views),s=nt(t.nullBitmap),a=(t.variadicBuffers||[]).map(h=>nt(h)),c=(r=t.length)!==null&&r!==void 0?r:Math.trunc(o.length/qr.ELEMENT_WIDTH),l=t.nullBitmap?-1:0;return new ut(n,i,c,l,[void 0,o,s],[],void 0,a)}visitLargeUtf8(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.data),o=nt(t.nullBitmap),s=cu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[s,i,o])}visitBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.data),o=nt(t.nullBitmap),s=Oa(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[s,i,o])}visitBinaryView(t){var r;let{["type"]:n,["offset"]:i=0}=t,o=Tt(n.ArrayType,t.views),s=nt(t.nullBitmap),a=(t.variadicBuffers||[]).map(h=>nt(h)),c=(r=t.length)!==null&&r!==void 0?r:Math.trunc(o.length/Mt.ELEMENT_WIDTH),l=t.nullBitmap?-1:0;return new ut(n,i,c,l,[void 0,o,s],[],void 0,a)}visitLargeBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.data),o=nt(t.nullBitmap),s=cu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length/Ln(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitDate(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length/Ln(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length/Ln(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitTime(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length/Ln(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length/Ln(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitList(t){let{["type"]:r,["offset"]:n=0,["child"]:i}=t,o=nt(t.nullBitmap),s=Oa(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[s,void 0,o],[i])}visitLargeList(t){let{["type"]:r,["offset"]:n=0,["child"]:i}=t,o=nt(t.nullBitmap),s=cu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[s,void 0,o],[i])}visitStruct(t){let{["type"]:r,["offset"]:n=0,["children"]:i=[]}=t,o=nt(t.nullBitmap),{length:s=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:r,["offset"]:n=0,["children"]:i=[]}=t,o=Tt(r.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(z.isSparseUnion(r))return new ut(r,n,s,a,[void 0,void 0,void 0,o],i);let c=Oa(t.valueOffsets);return new ut(r,n,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.indices.ArrayType,t.data),{["dictionary"]:s=new $([new e().visit({type:r.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length/Ln(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitDuration(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitFixedSizeList(t){let{["type"]:r,["offset"]:n=0,["child"]:i=new e().visit({type:r.valueType})}=t,o=nt(t.nullBitmap),{["length"]:s=i.length/Ln(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,void 0,o],[i])}visitMap(t){let{["type"]:r,["offset"]:n=0,["child"]:i=new e().visit({type:r.childType})}=t,o=nt(t.nullBitmap),s=Oa(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[s,void 0,o],[i])}},RL=new h_});function U4(e){return e.some(t=>t.nullable)}function Mp(e){return e.reduce((t,r)=>t+r.nullCount,0)}function bp(e){return e.reduce((t,r,n)=>(t[n+1]=t[n]+r.length,t),new Uint32Array(e.length+1))}function xp(e,t,r,n){let i=[];for(let o=-1,s=e.length;++o<s;){let a=e[o],c=t[o],{length:l}=a;if(c>=n)break;if(r>=c+l)continue;if(c>=r&&c+l<=n){i.push(a);continue}let h=Math.max(0,r-c),u=Math.min(n-c,l);i.push(a.slice(h,u-h))}return i.length===0&&i.push(e[0].slice(0,0)),i}function u_(e,t,r,n){let i=0,o=0,s=t.length-1;do{if(i>=s-1)return r<t[s]?n(e,i,r-t[i]):null;o=i+Math.trunc((s-i)*.5),r<t[o]?s=o:i=o}while(i<s)}function Fu(e,t){return e.getValid(t)}function Dl(e){function t(r,n,i){return e(r[n],i)}return function(r){let n=this.data;return u_(n,this._offsets,r,t)}}function Sp(e){let t;function r(n,i,o){return e(n[i],o,t)}return function(n,i){let o=this.data;t=i;let s=u_(o,this._offsets,n,r);return t=void 0,s}}function vp(e){let t;function r(n,i,o){let s=o,a=0,c=0;for(let l=i-1,h=n.length;++l<h;){let u=n[l];if(~(a=e(u,t,s)))return c+a;s=0,c+=u.length}return-1}return function(n,i){t=n;let o=this.data,s=typeof i!="number"?r(o,0,0):u_(o,this._offsets,i,r);return t=void 0,s}}var Du,Ep=w(()=>{Du=class{constructor(t=0,r){this.numChunks=t,this.getChunkIterator=r,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}}});function CL(e,t){return t===null&&e.length>0?0:-1}function NL(e,t){let{nullBitmap:r}=e;if(!r||e.nullCount<=0)return-1;let n=0;for(let i of new Wi(r,e.offset+(t||0),e.length,r,Ll)){if(!i)return n;++n}return-1}function gt(e,t,r){if(t===void 0)return-1;if(t===null)switch(e.typeId){case b.Union:break;case b.Dictionary:break;default:return NL(e,r)}let n=He.getVisitFn(e),i=Ls(t);for(let o=(r||0)-1,s=e.length;++o<s;)if(i(n(e,o)))return o;return-1}function G4(e,t,r){let n=He.getVisitFn(e),i=Ls(t);for(let o=(r||0)-1,s=e.length;++o<s;)if(i(n(e,o)))return o;return-1}var ot,qa,Tp=w(()=>{Ne();fn();Ua();ka();Ol();ot=class extends rt{};ot.prototype.visitNull=CL;ot.prototype.visitBool=gt;ot.prototype.visitInt=gt;ot.prototype.visitInt8=gt;ot.prototype.visitInt16=gt;ot.prototype.visitInt32=gt;ot.prototype.visitInt64=gt;ot.prototype.visitUint8=gt;ot.prototype.visitUint16=gt;ot.prototype.visitUint32=gt;ot.prototype.visitUint64=gt;ot.prototype.visitFloat=gt;ot.prototype.visitFloat16=gt;ot.prototype.visitFloat32=gt;ot.prototype.visitFloat64=gt;ot.prototype.visitUtf8=gt;ot.prototype.visitLargeUtf8=gt;ot.prototype.visitUtf8View=gt;ot.prototype.visitBinary=gt;ot.prototype.visitLargeBinary=gt;ot.prototype.visitBinaryView=gt;ot.prototype.visitFixedSizeBinary=gt;ot.prototype.visitDate=gt;ot.prototype.visitDateDay=gt;ot.prototype.visitDateMillisecond=gt;ot.prototype.visitTimestamp=gt;ot.prototype.visitTimestampSecond=gt;ot.prototype.visitTimestampMillisecond=gt;ot.prototype.visitTimestampMicrosecond=gt;ot.prototype.visitTimestampNanosecond=gt;ot.prototype.visitTime=gt;ot.prototype.visitTimeSecond=gt;ot.prototype.visitTimeMillisecond=gt;ot.prototype.visitTimeMicrosecond=gt;ot.prototype.visitTimeNanosecond=gt;ot.prototype.visitDecimal=gt;ot.prototype.visitList=gt;ot.prototype.visitLargeList=gt;ot.prototype.visitStruct=gt;ot.prototype.visitUnion=gt;ot.prototype.visitDenseUnion=G4;ot.prototype.visitSparseUnion=G4;ot.prototype.visitDictionary=gt;ot.prototype.visitInterval=gt;ot.prototype.visitIntervalDayTime=gt;ot.prototype.visitIntervalYearMonth=gt;ot.prototype.visitIntervalMonthDayNano=gt;ot.prototype.visitDuration=gt;ot.prototype.visitDurationSecond=gt;ot.prototype.visitDurationMillisecond=gt;ot.prototype.visitDurationMicrosecond=gt;ot.prototype.visitDurationNanosecond=gt;ot.prototype.visitFixedSizeList=gt;ot.prototype.visitMap=gt;qa=new ot});function ft(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(z.isInt(t)&&t.bitWidth!==64||z.isTime(t)&&t.bitWidth!==64||z.isFloat(t)&&t.precision!==Vt.HALF))return new Du(e.data.length,n=>{let i=e.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let r=0;return new Du(e.data.length,n=>{let o=e.data[n].length,s=e.slice(r,r+o);return r+=o,new f_(s)})}var st,f_,Fl,Ip=w(()=>{fn();Ne();te();Ep();st=class extends rt{};f_=class{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};st.prototype.visitNull=ft;st.prototype.visitBool=ft;st.prototype.visitInt=ft;st.prototype.visitInt8=ft;st.prototype.visitInt16=ft;st.prototype.visitInt32=ft;st.prototype.visitInt64=ft;st.prototype.visitUint8=ft;st.prototype.visitUint16=ft;st.prototype.visitUint32=ft;st.prototype.visitUint64=ft;st.prototype.visitFloat=ft;st.prototype.visitFloat16=ft;st.prototype.visitFloat32=ft;st.prototype.visitFloat64=ft;st.prototype.visitUtf8=ft;st.prototype.visitLargeUtf8=ft;st.prototype.visitUtf8View=ft;st.prototype.visitBinary=ft;st.prototype.visitLargeBinary=ft;st.prototype.visitBinaryView=ft;st.prototype.visitFixedSizeBinary=ft;st.prototype.visitDate=ft;st.prototype.visitDateDay=ft;st.prototype.visitDateMillisecond=ft;st.prototype.visitTimestamp=ft;st.prototype.visitTimestampSecond=ft;st.prototype.visitTimestampMillisecond=ft;st.prototype.visitTimestampMicrosecond=ft;st.prototype.visitTimestampNanosecond=ft;st.prototype.visitTime=ft;st.prototype.visitTimeSecond=ft;st.prototype.visitTimeMillisecond=ft;st.prototype.visitTimeMicrosecond=ft;st.prototype.visitTimeNanosecond=ft;st.prototype.visitDecimal=ft;st.prototype.visitList=ft;st.prototype.visitLargeList=ft;st.prototype.visitStruct=ft;st.prototype.visitUnion=ft;st.prototype.visitDenseUnion=ft;st.prototype.visitSparseUnion=ft;st.prototype.visitDictionary=ft;st.prototype.visitInterval=ft;st.prototype.visitIntervalDayTime=ft;st.prototype.visitIntervalYearMonth=ft;st.prototype.visitIntervalMonthDayNano=ft;st.prototype.visitDuration=ft;st.prototype.visitDurationSecond=ft;st.prototype.visitDurationMillisecond=ft;st.prototype.visitDurationMicrosecond=ft;st.prototype.visitDurationNanosecond=ft;st.prototype.visitFixedSizeList=ft;st.prototype.visitMap=ft;Fl=new st});function Hi(e){if(e){if(e instanceof ut)return new $([e]);if(e instanceof $)return new $(e.data);if(e.type instanceof z)return new $([Q(e)]);if(Array.isArray(e))return new $(e.flatMap(t=>BL(t)));if(ArrayBuffer.isView(e)){e instanceof DataView&&(e=new Uint8Array(e.buffer));let t={offset:0,length:e.length,nullCount:-1,data:e};if(e instanceof Int8Array)return new $([Q(Object.assign(Object.assign({},t),{type:new An}))]);if(e instanceof Int16Array)return new $([Q(Object.assign(Object.assign({},t),{type:new Pn}))]);if(e instanceof Int32Array)return new $([Q(Object.assign(Object.assign({},t),{type:new Ve}))]);if(e instanceof BigInt64Array)return new $([Q(Object.assign(Object.assign({},t),{type:new Rn}))]);if(e instanceof Uint8Array||e instanceof Uint8ClampedArray)return new $([Q(Object.assign(Object.assign({},t),{type:new Cn}))]);if(e instanceof Uint16Array)return new $([Q(Object.assign(Object.assign({},t),{type:new Nn}))]);if(e instanceof Uint32Array)return new $([Q(Object.assign(Object.assign({},t),{type:new Vr}))]);if(e instanceof BigUint64Array)return new $([Q(Object.assign(Object.assign({},t),{type:new wi}))]);if(e instanceof Float32Array)return new $([Q(Object.assign(Object.assign({},t),{type:new kr}))]);if(e instanceof Float64Array)return new $([Q(Object.assign(Object.assign({},t),{type:new Bn}))]);throw new Error("Unrecognized input")}}throw new Error("Unrecognized input")}function BL(e){return e instanceof ut?[e]:e instanceof $?e.data:Hi(e).data}var z4,V4,k4,q4,$,Ap,Ar=w(()=>{Ne();Ol();te();Zn();Ep();Ua();Dn();Tp();Ip();te();V4=Symbol.for("apache-arrow/Vector"),k4={},q4={},$=class e{static isVector(t){return t?.[V4]===!0}constructor(t){var r,n,i;let o=t[0]instanceof e?t.flatMap(a=>a.data):t;if(o.length===0||o.some(a=>!(a instanceof ut)))throw new TypeError("Vector constructor expects an Array of Data instances.");let s=(r=o[0])===null||r===void 0?void 0:r.type;switch(o.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l}=k4[s.typeId],h=o[0];this.isValid=u=>Fu(h,u),this.get=u=>a(h,u),this.set=(u,f)=>c(h,u,f),this.indexOf=u=>l(h,u),this._offsets=[0,h.length];break}default:Object.setPrototypeOf(this,q4[s.typeId]),this._offsets=bp(o);break}this.data=o,this.type=s,this.stride=Ln(s),this.numChildren=(i=(n=s.children)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,r)=>t+r.byteLength,0)}get nullable(){return U4(this.data)}get nullCount(){return Mp(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${b[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(Ga(t,this.length))}set(t,r){}indexOf(t,r){return-1}includes(t,r){return this.indexOf(t,r)>-1}[Symbol.iterator](){return Fl.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(r=>r.data).flat(Number.POSITIVE_INFINITY)))}slice(t,r){return new e(Ou(this,t,r,({data:n,_offsets:i},o,s)=>xp(n,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:r,length:n,stride:i,ArrayType:o}=this;switch(t.typeId){case b.Int:case b.Float:case b.Decimal:case b.Time:case b.Timestamp:switch(r.length){case 0:return new o;case 1:return r[0].values.subarray(0,n*i);default:return r.reduce((s,{values:a,length:c})=>(s.array.set(a.subarray(0,c*i),s.offset),s.offset+=c*i,s),{array:new o(n*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var r;return this.getChildAt((r=this.type.children)===null||r===void 0?void 0:r.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new e(this.data.map(({children:r})=>r[t])):null}get isMemoized(){return z.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(z.isDictionary(this.type)){let t=new Ap(this.data[0].dictionary),r=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new e(r)}return new Ap(this)}unmemoize(){if(z.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),r=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new e(r)}return this}};z4=Symbol.toStringTag;$[z4]=(e=>{e.type=z.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0,e[V4]=!0;let t=Object.keys(b).map(r=>b[r]).filter(r=>typeof r=="number"&&r!==b.NONE);for(let r of t){let n=He.getVisitFnByTypeId(r),i=mr.getVisitFnByTypeId(r),o=qa.getVisitFnByTypeId(r);k4[r]={get:n,set:i,indexOf:o},q4[r]=Object.create(e,{isValid:{value:Dl(Fu)},get:{value:Dl(He.getVisitFnByTypeId(r))},set:{value:Sp(mr.getVisitFnByTypeId(r))},indexOf:{value:vp(qa.getVisitFnByTypeId(r))}})}return"Vector"})($.prototype);Object.defineProperty($,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===$&&$.isVector(t)}});Ap=class e extends ${constructor(t){super(t.data);let r=this.get,n=this.set,i=this.slice,o=new Array(this.length);Object.defineProperty(this,"get",{value(s){let a=o[s];if(a!==void 0)return a;let c=r.call(this,s);return o[s]=c,c}}),Object.defineProperty(this,"set",{value(s,a){n.call(this,s,a),o[s]=a}}),Object.defineProperty(this,"slice",{value:(s,a)=>new e(i.call(this,s,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new $(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}});function j4(e){if(!e||e.length<=0)return function(i){return!0};let t="",r=e.filter(n=>n===n);return r.length>0&&(t=`
10
10
  switch (x) {${r.map(n=>`
11
- case ${LL(n)}:`).join("")}
11
+ case ${OL(n)}:`).join("")}
12
12
  return false;
13
13
  }`),e.length!==r.length&&(t=`if (x !== x) return false;
14
14
  ${t}`),new Function("x",`${t}
15
- return true;`)}function LL(e){return typeof e!="bigint"?gi(e):`${gi(e)}n`}var K4=w(()=>{vu()});function g_(e,t){let r=Math.ceil(e)*t-1;return(r-r%64+64||64)/t}function X4(e,t=0){return e.length>=t?e.subarray(0,t):au(new e.constructor(t),e,0)}var dn,Mo,Ul,Ds,Si=w(()=>{Je();dn=class{constructor(t,r=0,n=1){this.length=Math.ceil(r/n),this.buffer=new t(this.length),this.stride=n,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,r){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let r=this.stride,n=this.length*r,i=this.buffer.length;n>=i&&this._resize(i===0?g_(n*1,this.BYTES_PER_ELEMENT):g_(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=g_(t*this.stride,this.BYTES_PER_ELEMENT);let r=X4(this.buffer,t);return this.clear(),r}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=X4(this.buffer,t)}},Mo=class extends dn{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,r){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=r,this}},Ul=class extends Mo{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,r){let{buffer:n}=this.reserve(t-this.length+1),i=t>>3,o=t%8,s=n[i]>>o&1;return r?s===0&&(n[i]|=1<<o,++this.numValid):s===1&&(n[i]&=~(1<<o),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},Ds=class extends Mo{constructor(t){super(t.OffsetArrayType,1,1)}append(t){return this.set(this.length-1,t)}set(t,r){let n=this.length-1,i=this.reserve(t-n+1).buffer;return n<t++&&n>=0&&i.fill(i[n],n,t),i[t]=i[t-1]+r,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}}});var oe,$e,Pr,me=w(()=>{Ar();Zn();Ou();te();K4();Si();oe=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:r}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=r,this.stride=Ln(t),this._nulls=new Ul,r&&r.length>0&&(this._isValid=Y4(r))}toVector(){return new $([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:r,_values:n,_nulls:i,_typeIds:o,children:s}=this;return r&&(t+=r.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),s.reduce((a,c)=>a+c.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((r,n)=>r+n.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,r){return this.setValid(t,this.isValid(r))&&this.setValue(t,r),this}setValue(t,r){this._setValue(this,t,r)}setValid(t,r){return this.length=this._nulls.set(t,+r).length,r}addChild(t,r=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,r,n,i,{type:o,length:s,nullCount:a,_typeIds:c,_offsets:l,_values:h,_nulls:u}=this;(r=c?.flush(s))?i=l?.flush(s):(i=l?.flush(s))?t=h?.flush(l.last()):t=h?.flush(s),a>0&&(n=u?.flush(s));let f=this.children.map(d=>d.flush());return this.clear(),Q({type:o,length:s,nullCount:a,children:f,child:f[0],data:t,typeIds:r,nullBitmap:n,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,r,n,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(r=this._values)===null||r===void 0||r.clear(),(n=this._offsets)===null||n===void 0||n.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let o of this.children)o.clear();return this}};oe.prototype.length=1;oe.prototype.stride=1;oe.prototype.children=null;oe.prototype.finished=!1;oe.prototype.nullValues=null;oe.prototype._isValid=()=>!0;$e=class extends oe{constructor(t){super(t),this._values=new Mo(this.ArrayType,0,this.stride)}setValue(t,r){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,r)}},Pr=class extends oe{constructor(t){super(t),this._pendingLength=0,this._offsets=new Ds(t.type)}setValue(t,r){let n=this._pending||(this._pending=new Map),i=n.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=r instanceof Xn?r[Bs].length:r.length,n.set(t,r)}setValid(t,r){return super.setValid(t,r)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,r=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,r),this}}});var ja,y_=w(()=>{ja=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,r,n,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(n),t.writeInt64(BigInt(r??0)),t.offset()}}});var Fn,Z4=w(()=>{Gt();y_();vl();qm();Ww();Fn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFooter(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Xt.V1}schema(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new cn).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}dictionaries(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new ja).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,r){let n=this.bb.__offset(this.bb_pos,10);return n?(r||new ja).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,12);return n?(r||new Ce).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,Xt.V1)}static addSchema(t,r){t.addFieldOffset(1,r,0)}static addDictionaries(t,r){t.addFieldOffset(2,r,0)}static startDictionariesVector(t,r){t.startVector(24,r,8)}static addRecordBatches(t,r){t.addFieldOffset(3,r,0)}static startRecordBatchesVector(t,r){t.startVector(24,r,8)}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,r){t.finish(r)}static finishSizePrefixedFooterBuffer(t,r){t.finish(r,void 0,!0)}}});function Pp(e,t){return new Map([...e||new Map,...t||new Map])}function w_(e,t=new Map){for(let r=-1,n=e.length;++r<n;){let o=e[r].type;if(z.isDictionary(o)){if(!t.has(o.id))t.set(o.id,o.dictionary);else if(t.get(o.id)!==o.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}o.children&&o.children.length>0&&w_(o.children,t)}return t}var J4,Q4,_t,Z,Rr=w(()=>{Ne();te();J4=Symbol.for("apache-arrow/Schema"),Q4=Symbol.for("apache-arrow/Field"),_t=class e{static isSchema(t){return t?.[J4]===!0}constructor(t=[],r,n,i=Xt.V5){this.fields=t||[],this.metadata=r||new Map,n||(n=w_(this.fields)),this.dictionaries=n,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,r)=>`${r}: ${t}`).join(", ")} }>`}select(t){let r=new Set(t),n=this.fields.filter(i=>r.has(i.name));return new e(n,this.metadata)}selectAt(t){let r=t.map(n=>this.fields[n]).filter(Boolean);return new e(r,this.metadata)}assign(...t){let r=t[0]instanceof e?t[0]:Array.isArray(t[0])?new e(t[0]):new e(t),n=[...this.fields],i=Pp(Pp(new Map,this.metadata),r.metadata),o=r.fields.filter(a=>{let c=n.findIndex(l=>l.name===a.name);return~c?(n[c]=a.clone({metadata:Pp(Pp(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),s=w_(o,new Map);return new e([...n,...o],i,new Map([...this.dictionaries,...s]))}};_t.prototype.fields=null;_t.prototype.metadata=null;_t.prototype.dictionaries=null;_t.prototype[J4]=!0;Object.defineProperty(_t,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===_t&&_t.isSchema(t)}});Z=class e{static isField(t){return t?.[Q4]===!0}static new(...t){let[r,n,i,o]=t;return t[0]&&typeof t[0]=="object"&&({name:r}=t[0],n===void 0&&(n=t[0].type),i===void 0&&(i=t[0].nullable),o===void 0&&(o=t[0].metadata)),new e(`${r}`,n,i,o)}constructor(t,r,n=!1,i){this.name=t,this.type=r,this.nullable=n,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[r,n,i,o]=t;return!t[0]||typeof t[0]!="object"?[r=this.name,n=this.type,i=this.nullable,o=this.metadata]=t:{name:r=this.name,type:n=this.type,nullable:i=this.nullable,metadata:o=this.metadata}=t[0],e.new(r,n,i,o)}};Z.prototype.type=null;Z.prototype.name=null;Z.prototype.nullable=null;Z.prototype.metadata=null;Z.prototype[Q4]=!0;Object.defineProperty(Z,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===Z&&Z.isField(t)}})});var DL,FL,bo,__,vi,M_=w(()=>{y_();Z4();Gt();Rr();Ne();Je();ki();DL=La,FL=hr,bo=class{static decode(t){t=new FL(nt(t));let r=Fn.getRootAsFooter(t),n=_t.decode(r.schema(),new Map,r.version());return new __(n,r)}static encode(t){let r=new DL,n=_t.encode(r,t.schema);Fn.startRecordBatchesVector(r,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())vi.encode(r,s);let i=r.endVector();Fn.startDictionariesVector(r,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())vi.encode(r,s);let o=r.endVector();return Fn.startFooter(r),Fn.addSchema(r,n),Fn.addVersion(r,Xt.V5),Fn.addRecordBatches(r,i),Fn.addDictionaries(r,o),Fn.finishFooterBuffer(r,Fn.endFooter(r)),r.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,r=Xt.V5,n,i){this.schema=t,this.version=r,n&&(this._recordBatches=n),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,r=-1,n=this.numRecordBatches;++r<n;)(t=this.getRecordBatch(r))&&(yield t)}*dictionaryBatches(){for(let t,r=-1,n=this.numDictionaries;++r<n;)(t=this.getDictionaryBatch(r))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}},__=class extends bo{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,r){super(t,r.version()),this._footer=r}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let r=this._footer.recordBatches(t);if(r)return vi.decode(r)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let r=this._footer.dictionaries(t);if(r)return vi.decode(r)}return null}},vi=class e{static decode(t){return new e(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,r){let{metaDataLength:n}=r,i=BigInt(r.offset),o=BigInt(r.bodyLength);return ja.createBlock(t,i,n,o)}constructor(t,r,n){this.metaDataLength=t,this.offset=It(n),this.bodyLength=It(r)}}});var Un,tA=w(()=>{Gt();vl();Xm();qm();Un=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMessage(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Xt.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):Nt.NONE}header(t){let r=this.bb.__offset(this.bb_pos,8);return r?this.bb.__union(t,this.bb_pos+r):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,12);return n?(r||new Ce).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,Xt.V1)}static addHeaderType(t,r){t.addFieldInt8(1,r,Nt.NONE)}static addHeader(t,r){t.addFieldOffset(2,r,0)}static addBodyLength(t,r){t.addFieldInt64(3,r,BigInt("0"))}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,r){t.finish(r)}static finishSizePrefixedMessageBuffer(t,r){t.finish(r,void 0,!0)}static createMessage(t,r,n,i,o,s){return e.startMessage(t),e.addVersion(t,r),e.addHeaderType(t,n),e.addHeader(t,i),e.addBodyLength(t,o),e.addCustomMetadata(t,s),e.endMessage(t)}}});var b_,Rp,eA=w(()=>{fn();S3();Ym();Uw();g3();y3();_3();w3();E3();T3();b3();Bw();Ow();Vw();kw();Gw();Lw();x3();M3();v3();qw();Nw();Dw();Fw();zw();b_=class extends rt{visit(t,r){return t==null||r==null?void 0:super.visit(t,r)}visitNull(t,r){return Mu.startNull(r),Mu.endNull(r)}visitInt(t,r){return mi.startInt(r),mi.addBitWidth(r,t.bitWidth),mi.addIsSigned(r,t.isSigned),mi.endInt(r)}visitFloat(t,r){return ws.startFloatingPoint(r),ws.addPrecision(r,t.precision),ws.endFloatingPoint(r)}visitBinary(t,r){return du.startBinary(r),du.endBinary(r)}visitBinaryView(t,r){return mu.startBinaryView(r),mu.endBinaryView(r)}visitLargeBinary(t,r){return gu.startLargeBinary(r),gu.endLargeBinary(r)}visitBool(t,r){return pu.startBool(r),pu.endBool(r)}visitUtf8(t,r){return xu.startUtf8(r),xu.endUtf8(r)}visitUtf8View(t,r){return Su.startUtf8View(r),Su.endUtf8View(r)}visitLargeUtf8(t,r){return wu.startLargeUtf8(r),wu.endLargeUtf8(r)}visitDecimal(t,r){return Vi.startDecimal(r),Vi.addScale(r,t.scale),Vi.addPrecision(r,t.precision),Vi.addBitWidth(r,t.bitWidth),Vi.endDecimal(r)}visitDate(t,r){return ms.startDate(r),ms.addUnit(r,t.unit),ms.endDate(r)}visitTime(t,r){return go.startTime(r),go.addUnit(r,t.unit),go.addBitWidth(r,t.bitWidth),go.endTime(r)}visitTimestamp(t,r){let n=t.timezone&&r.createString(t.timezone)||void 0;return yo.startTimestamp(r),yo.addUnit(r,t.unit),n!==void 0&&yo.addTimezone(r,n),yo.endTimestamp(r)}visitInterval(t,r){return _s.startInterval(r),_s.addUnit(r,t.unit),_s.endInterval(r)}visitDuration(t,r){return ps.startDuration(r),ps.addUnit(r,t.unit),ps.endDuration(r)}visitList(t,r){return _u.startList(r),_u.endList(r)}visitLargeList(t,r){return yu.startLargeList(r),yu.endLargeList(r)}visitStruct(t,r){return bu.startStruct_(r),bu.endStruct_(r)}visitUnion(t,r){pi.startTypeIdsVector(r,t.typeIds.length);let n=pi.createTypeIdsVector(r,t.typeIds);return pi.startUnion(r),pi.addMode(r,t.mode),pi.addTypeIds(r,n),pi.endUnion(r)}visitDictionary(t,r){let n=this.visit(t.indices,r);return zi.startDictionaryEncoding(r),zi.addId(r,BigInt(t.id)),zi.addIsOrdered(r,t.isOrdered),n!==void 0&&zi.addIndexType(r,n),zi.endDictionaryEncoding(r)}visitFixedSizeBinary(t,r){return gs.startFixedSizeBinary(r),gs.addByteWidth(r,t.byteWidth),gs.endFixedSizeBinary(r)}visitFixedSizeList(t,r){return ys.startFixedSizeList(r),ys.addListSize(r,t.listSize),ys.endFixedSizeList(r)}visitMap(t,r){return Ms.startMap(r),Ms.addKeysSorted(r,t.keysSorted),Ms.endMap(r)}},Rp=new b_});function oA(e,t=new Map){return new _t(UL(e,t),Cp(e.metadata),t)}function x_(e){return new Ye(e.count,aA(e.columns),cA(e.columns),null,lA(e.columns))}function sA(e){return new Cr(x_(e.data),e.id,e.isDelta)}function UL(e,t){return(e.fields||[]).filter(Boolean).map(r=>Z.fromJSON(r,t))}function rA(e,t){return(e.children||[]).filter(Boolean).map(r=>Z.fromJSON(r,t))}function aA(e){return(e||[]).reduce((t,r)=>[...t,new Jn(r.count,GL(r.VALIDITY)),...aA(r.children)],[])}function cA(e,t=[]){for(let r=-1,n=(e||[]).length;++r<n;){let i=e[r];if(i.VALIDITY&&t.push(new Fe(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new Fe(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new Fe(t.length,i.OFFSET.length)),i.DATA&&t.push(new Fe(t.length,i.DATA.length)),i.VIEWS&&t.push(new Fe(t.length,i.VIEWS.length)),i.VARIADIC_DATA_BUFFERS)for(let o of i.VARIADIC_DATA_BUFFERS)t.push(new Fe(t.length,o.length));t=cA(i.children,t)}return t}function GL(e){return(e||[]).reduce((t,r)=>t+ +(r===0),0)}function lA(e){return(e||[]).reduce((t,r)=>[...t,...r.VARIADIC_DATA_BUFFERS?[r.VARIADIC_DATA_BUFFERS.length]:[],...lA(r.children)],[])}function hA(e,t){let r,n,i,o,s,a;return!t||!(o=e.dictionary)?(s=iA(e,rA(e,t)),i=new Z(e.name,s,e.nullable,Cp(e.metadata))):t.has(r=o.id)?(n=(n=o.indexType)?nA(n):new Ve,a=new We(t.get(r),n,r,o.isOrdered),i=new Z(e.name,a,e.nullable,Cp(e.metadata))):(n=(n=o.indexType)?nA(n):new Ve,t.set(r,s=iA(e,rA(e,t))),a=new We(s,n,r,o.isOrdered),i=new Z(e.name,a,e.nullable,Cp(e.metadata))),i||null}function Cp(e=[]){return new Map(e.map(({key:t,value:r})=>[t,r]))}function nA(e){return new Se(e.isSigned,e.bitWidth)}function iA(e,t){let r=e.type.name;switch(r){case"NONE":return new De;case"null":return new De;case"binary":return new ln;case"largebinary":return new Mi;case"binaryview":return new Mt;case"utf8":return new vr;case"largeutf8":return new bi;case"utf8view":return new qr;case"bool":return new Er;case"list":return new je((t||[])[0]);case"largelist":return new Bn((t||[])[0]);case"struct":return new Yt(t||[]);case"struct_":return new Yt(t||[])}switch(r){case"int":{let n=e.type;return new Se(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=e.type;return new Sr(Vt[n.precision])}case"decimal":{let n=e.type;return new hn(n.scale,n.precision,n.bitWidth)}case"date":{let n=e.type;return new jr(Qt[n.unit])}case"time":{let n=e.type;return new fr(q[n.unit],n.bitWidth)}case"timestamp":{let n=e.type;return new dr(q[n.unit],n.timezone)}case"interval":{let n=e.type;return new Tr(Lt[n.unit])}case"duration":{let n=e.type;return new Wr(q[n.unit])}case"union":{let n=e.type,[i,...o]=(n.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new Hr(jt[s],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=e.type;return new un(n.byteWidth)}case"fixedsizelist":{let n=e.type;return new _e(n.listSize,(t||[])[0])}case"map":{let n=e.type;return new Ir((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${r}"`)}var uA=w(()=>{Rr();te();Fs();Ne()});function kL(e,t){return(()=>{switch(t){case Nt.Schema:return _t.fromJSON(e);case Nt.RecordBatch:return Ye.fromJSON(e);case Nt.DictionaryBatch:return Cr.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${Nt[t]}, type: ${t} }`)})}function qL(e,t){return(()=>{switch(t){case Nt.Schema:return _t.decode(e.header(new cn),new Map,e.version());case Nt.RecordBatch:return Ye.decode(e.header(new br),e.version());case Nt.DictionaryBatch:return Cr.decode(e.header(new po),e.version())}throw new Error(`Unrecognized Message type: { name: ${Nt[t]}, type: ${t} }`)})}function jL(e,t=new Map,r=Xt.V5){let n=JL(e,t);return new _t(n,Np(e),t,r)}function WL(e,t=Xt.V5){return new Ye(e.length(),KL(e),XL(e,t),pA(e.compression()),ZL(e))}function HL(e,t=Xt.V5){return new Cr(Ye.decode(e.data(),t),e.id(),e.isDelta())}function $L(e){return new Fe(e.offset(),e.length())}function YL(e){return new Jn(e.length(),e.nullCount())}function KL(e){let t=[];for(let r,n=-1,i=-1,o=e.nodesLength();++n<o;)(r=e.nodes(n))&&(t[++i]=Jn.decode(r));return t}function XL(e,t){let r=[];for(let n,i=-1,o=-1,s=e.buffersLength();++i<s;)(n=e.buffers(i))&&(t<Xt.V4&&(n.bb_pos+=8*(i+1)),r[++o]=Fe.decode(n));return r}function ZL(e){let t=[],r=Math.trunc(e.variadicBufferCountsLength());for(let n=0;n<r;++n)t.push(It(e.variadicBufferCounts(n)));return t}function JL(e,t){let r=[];for(let n,i=-1,o=-1,s=e.fieldsLength();++i<s;)(n=e.fields(i))&&(r[++o]=Z.decode(n,t));return r}function fA(e,t){let r=[];for(let n,i=-1,o=-1,s=e.childrenLength();++i<s;)(n=e.children(i))&&(r[++o]=Z.decode(n,t));return r}function QL(e,t){let r,n,i,o,s,a;return!t||!(a=e.dictionary())?(i=mA(e,fA(e,t)),n=new Z(e.name(),i,e.nullable(),Np(e))):t.has(r=It(a.id()))?(o=(o=a.indexType())?dA(o):new Ve,s=new We(t.get(r),o,r,a.isOrdered()),n=new Z(e.name(),s,e.nullable(),Np(e))):(o=(o=a.indexType())?dA(o):new Ve,t.set(r,i=mA(e,fA(e,t))),s=new We(i,o,r,a.isOrdered()),n=new Z(e.name(),s,e.nullable(),Np(e))),n||null}function Np(e){let t=new Map;if(e)for(let r,n,i=-1,o=Math.trunc(e.customMetadataLength());++i<o;)(r=e.customMetadata(i))&&(n=r.key())!=null&&t.set(n,r.value());return t}function tD(e){let t=new Map;for(let r,n,i=-1,o=Math.trunc(e.customMetadataLength());++i<o;)(r=e.customMetadata(i))&&(n=r.key())!=null&&t.set(n,r.value());return t}function dA(e){return new Se(e.isSigned(),e.bitWidth())}function mA(e,t){let r=e.typeType();switch(r){case lt.NONE:return new De;case lt.Null:return new De;case lt.Binary:return new ln;case lt.LargeBinary:return new Mi;case lt.BinaryView:return new Mt;case lt.Utf8:return new vr;case lt.LargeUtf8:return new bi;case lt.Utf8View:return new qr;case lt.Bool:return new Er;case lt.List:return new je((t||[])[0]);case lt.LargeList:return new Bn((t||[])[0]);case lt.Struct_:return new Yt(t||[])}switch(r){case lt.Int:{let n=e.type(new mi);return new Se(n.isSigned(),n.bitWidth())}case lt.FloatingPoint:{let n=e.type(new ws);return new Sr(n.precision())}case lt.Decimal:{let n=e.type(new Vi);return new hn(n.scale(),n.precision(),n.bitWidth())}case lt.Date:{let n=e.type(new ms);return new jr(n.unit())}case lt.Time:{let n=e.type(new go);return new fr(n.unit(),n.bitWidth())}case lt.Timestamp:{let n=e.type(new yo);return new dr(n.unit(),n.timezone())}case lt.Interval:{let n=e.type(new _s);return new Tr(n.unit())}case lt.Duration:{let n=e.type(new ps);return new Wr(n.unit())}case lt.Union:{let n=e.type(new pi);return new Hr(n.mode(),n.typeIdsArray()||[],t||[])}case lt.FixedSizeBinary:{let n=e.type(new gs);return new un(n.byteWidth())}case lt.FixedSizeList:{let n=e.type(new ys);return new _e(n.listSize(),(t||[])[0])}case lt.Map:{let n=e.type(new Ms);return new Ir((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${lt[r]}" (${r})`)}function pA(e){return e?new Wa(e.codec(),e.method()):null}function eD(e,t){let r=t.fields.map(o=>Z.encode(e,o));cn.startFieldsVector(e,r.length);let n=cn.createFieldsVector(e,r),i=t.metadata&&t.metadata.size>0?cn.createCustomMetadataVector(e,[...t.metadata].map(([o,s])=>{let a=e.createString(`${o}`),c=e.createString(`${s}`);return Ce.startKeyValue(e),Ce.addKey(e,a),Ce.addValue(e,c),Ce.endKeyValue(e)})):-1;return cn.startSchema(e),cn.addFields(e,n),cn.addEndianness(e,aD?ds.Little:ds.Big),i!==-1&&cn.addCustomMetadata(e,i),cn.endSchema(e)}function rD(e,t){let r=-1,n=-1,i=-1,o=t.type,s=t.typeId;z.isDictionary(o)?(s=o.dictionary.typeId,i=Rp.visit(o,e),n=Rp.visit(o.dictionary,e)):n=Rp.visit(o,e);let a=(o.children||[]).map(h=>Z.encode(e,h)),c=xr.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?xr.createCustomMetadataVector(e,[...t.metadata].map(([h,u])=>{let f=e.createString(`${h}`),d=e.createString(`${u}`);return Ce.startKeyValue(e),Ce.addKey(e,f),Ce.addValue(e,d),Ce.endKeyValue(e)})):-1;return t.name&&(r=e.createString(t.name)),xr.startField(e),xr.addType(e,n),xr.addTypeType(e,s),xr.addChildren(e,c),xr.addNullable(e,!!t.nullable),r!==-1&&xr.addName(e,r),i!==-1&&xr.addDictionary(e,i),l!==-1&&xr.addCustomMetadata(e,l),xr.endField(e)}function nD(e,t){let r=t.nodes||[],n=t.buffers||[],i=t.variadicBufferCounts||[];br.startNodesVector(e,r.length);for(let l of r.slice().reverse())Jn.encode(e,l);let o=e.endVector();br.startBuffersVector(e,n.length);for(let l of n.slice().reverse())Fe.encode(e,l);let s=e.endVector(),a=null;t.compression!==null&&(a=gA(e,t.compression));let c=-1;return i.length>0&&(c=br.createVariadicBufferCountsVector(e,i.map(BigInt))),br.startRecordBatch(e),br.addLength(e,BigInt(t.length)),br.addNodes(e,o),br.addBuffers(e,s),t.compression!==null&&a&&br.addCompression(e,a),c!==-1&&br.addVariadicBufferCounts(e,c),br.endRecordBatch(e)}function gA(e,t){return mo.startBodyCompression(e),mo.addCodec(e,t.type),mo.addMethod(e,t.method),mo.endBodyCompression(e)}function iD(e,t){let r=Ye.encode(e,t.data);return po.startDictionaryBatch(e),po.addId(e,BigInt(t.id)),po.addIsDelta(e,t.isDelta),po.addData(e,r),po.endDictionaryBatch(e)}function oD(e,t){return Sl.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function sD(e,t){return xl.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var zL,VL,Nr,Ye,Cr,Fe,Jn,Wa,aD,Fs=w(()=>{Gt();Ww();Ym();Rw();m3();Aw();jw();Pw();Km();vl();Cw();Uw();Bw();Ow();Vw();kw();Gw();Lw();qw();Dw();Fw();zw();tA();Iw();Tw();Rr();Je();ki();Ne();eA();uA();te();zL=La,VL=hr,Nr=class e{static fromJSON(t,r){let n=new e(0,Xt.V5,r);return n._createHeader=kL(t,r),n}static decode(t){t=new VL(nt(t));let r=Un.getRootAsMessage(t),n=r.bodyLength(),i=r.version(),o=r.headerType(),s=tD(r),a=new e(n,i,o,void 0,s);return a._createHeader=qL(r,o),a}static encode(t){let r=new zL,n=-1;t.isSchema()?n=_t.encode(r,t.header()):t.isRecordBatch()?n=Ye.encode(r,t.header()):t.isDictionaryBatch()&&(n=Cr.encode(r,t.header()));let i=t.metadata&&t.metadata.size>0?Un.createCustomMetadataVector(r,[...t.metadata].map(([o,s])=>{let a=r.createString(`${o}`),c=r.createString(`${s}`);return Ce.startKeyValue(r),Ce.addKey(r,a),Ce.addValue(r,c),Ce.endKeyValue(r)})):-1;return Un.startMessage(r),Un.addVersion(r,Xt.V5),Un.addHeader(r,n),Un.addHeaderType(r,t.headerType),Un.addBodyLength(r,BigInt(t.bodyLength)),i!==-1&&Un.addCustomMetadata(r,i),Un.finishMessageBuffer(r,Un.endMessage(r)),r.asUint8Array()}static from(t,r=0){if(t instanceof _t)return new e(0,Xt.V5,Nt.Schema,t);if(t instanceof Ye)return new e(r,Xt.V5,Nt.RecordBatch,t,t.metadata);if(t instanceof Cr)return new e(r,Xt.V5,Nt.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get compression(){return this._compression}get bodyLength(){return this._bodyLength}get metadata(){return this._metadata}header(){return this._createHeader()}isSchema(){return this.headerType===Nt.Schema}isRecordBatch(){return this.headerType===Nt.RecordBatch}isDictionaryBatch(){return this.headerType===Nt.DictionaryBatch}constructor(t,r,n,i,o){this._version=r,this._headerType=n,this.body=new Uint8Array(0),this._compression=i?.compression,i&&(this._createHeader=()=>i),this._bodyLength=It(t),this._metadata=o||new Map}},Ye=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}get compression(){return this._compression}get variadicBufferCounts(){return this._variadicBufferCounts}get metadata(){return this._metadata}constructor(t,r,n,i,o=[],s){this._nodes=r,this._buffers=n,this._length=It(t),this._compression=i,this._variadicBufferCounts=o,this._metadata=s||new Map}},Cr=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,r,n=!1){this._data=t,this._isDelta=n,this._id=It(r)}},Fe=class{constructor(t,r){this.offset=It(t),this.length=It(r)}},Jn=class{constructor(t,r){this.length=It(t),this.nullCount=It(r)}},Wa=class{constructor(t,r=Da.BUFFER){this.type=t,this.method=r}};Z.encode=rD;Z.decode=QL;Z.fromJSON=hA;_t.encode=eD;_t.decode=jL;_t.fromJSON=oA;Ye.encode=nD;Ye.decode=WL;Ye.fromJSON=x_;Cr.encode=iD;Cr.decode=HL;Cr.fromJSON=sA;Jn.encode=oD;Jn.decode=YL;Fe.encode=sD;Fe.decode=$L;Wa.encode=gA;Wa.decode=pA;aD=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})()});var pe,Uu,Ha,Op,Gu=w(()=>{an();lu();pe=Object.freeze({done:!0,value:void 0}),Uu=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Ha=class{tee(){return this._getDOMStream().tee()}pipe(t,r){return this._getNodeStream().pipe(t,r)}pipeTo(t,r){return this._getDOMStream().pipeTo(t,r)}pipeThrough(t,r){return this._getDOMStream().pipeThrough(t,r)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},Op=class extends Ha{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return Y(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(pe);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return lr.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return lr.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return Y(this,void 0,void 0,function*(){return yield this.abort(t),pe})}return(t){return Y(this,void 0,void 0,function*(){return yield this.close(),pe})}read(t){return Y(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Y(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((r,n)=>{this.resolvers.push({resolve:r,reject:n})}):Promise.resolve(pe)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}});var Qn,ti,mn,S_,xo,Us=w(()=>{an();lu();fo();Gu();Je();fs();Qn=class extends Op{write(t){if((t=nt(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?_l(this.toUint8Array(!0)):this.toUint8Array(!1).then(_l)}toUint8Array(t=!1){return t?In(this._values)[0]:Y(this,void 0,void 0,function*(){var r,n,i,o;let s=[],a=0;try{for(var c=!0,l=vn(this),h;h=yield l.next(),r=h.done,!r;c=!0){o=h.value,c=!1;let u=o;s.push(u),a+=u.byteLength}}catch(u){n={error:u}}finally{try{!c&&!r&&(i=l.return)&&(yield i.call(l))}finally{if(n)throw n.error}}return In(s,a)[0]})}},ti=class{constructor(t){t&&(this.source=new S_(lr.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},mn=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof Qn?this.source=new xo(lr.fromAsyncIterable(t)):zm(t)?this.source=new xo(lr.fromNodeStream(t)):su(t)?this.source=new xo(lr.fromDOMStream(t)):Um(t)?this.source=new xo(lr.fromDOMStream(t.body)):ui(t)?this.source=new xo(lr.fromIterable(t)):Tn(t)?this.source=new xo(lr.fromAsyncIterable(t)):Yn(t)&&(this.source=new xo(lr.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},S_=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,r="read"){return this.source.next({cmd:r,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||pe)}return(t){return Object.create(this.source.return&&this.source.return(t)||pe)}},xo=class{constructor(t){this.source=t,this._closedPromise=new Promise(r=>this._closedPromiseResolve=r)}cancel(t){return Y(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return Y(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Y(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return Y(this,arguments,void 0,function*(r,n="read"){return yield this.source.next({cmd:n,size:r})})}throw(t){return Y(this,void 0,void 0,function*(){let r=this.source.throw&&(yield this.source.throw(t))||pe;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}return(t){return Y(this,void 0,void 0,function*(){let r=this.source.return&&(yield this.source.return(t))||pe;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}}});var zu,Gs,v_=w(()=>{an();Us();Je();zu=class extends ti{constructor(t,r){super(),this.position=0,this.buffer=nt(t),this.size=r===void 0?this.buffer.byteLength:r}readInt32(t){let{buffer:r,byteOffset:n}=this.readAt(t,4);return new DataView(r,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:r,size:n,position:i}=this;return r&&i<n?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(n,i+Math.min(n-i,t)),r.subarray(i,this.position)):null}readAt(t,r){let n=this.buffer,i=Math.min(this.size,t+r);return n?n.subarray(t,i):new Uint8Array(r)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},Gs=class extends mn{constructor(t,r){super(),this.position=0,this._handle=t,typeof r=="number"?this.size=r:this._pending=Y(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return Y(this,void 0,void 0,function*(){let{buffer:r,byteOffset:n}=yield this.readAt(t,4);return new DataView(r,n).getInt32(0,!0)})}seek(t){return Y(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return Y(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:r,size:n,position:i}=this;if(r&&i<n){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let o=i,s=0,a=0,c=Math.min(n,o+Math.min(n-o,t)),l=new Uint8Array(Math.max(0,(this.position=c)-o));for(;(o+=a)<c&&(s+=a)<l.byteLength;)({bytesRead:a}=yield r.read(l,s,l.byteLength-s,o));return l}return null})}readAt(t,r){return Y(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:i}=this;if(n&&t+r<i){let o=Math.min(i,t+r),s=new Uint8Array(o-t);return(yield n.read(s,0,r,t)).buffer}return new Uint8Array(r)})}close(){return Y(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return Y(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return Y(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}}});var T_={};Zr(T_,{BaseInt64:()=>Vu,Int128:()=>ku,Int64:()=>So,Uint64:()=>Oe});function Gl(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var zl,E_,Vu,Oe,So,ku,I_=w(()=>{zl=8,E_=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],Vu=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let r=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),i=r[3]*n[3];this.buffer[0]=i&65535;let o=i>>>16;return i=r[2]*n[3],o+=i,i=r[3]*n[2]>>>0,o+=i,this.buffer[0]+=o<<16,this.buffer[1]=o>>>0<i?65536:0,this.buffer[1]+=o>>>16,this.buffer[1]+=r[1]*n[3]+r[2]*n[2]+r[3]*n[1],this.buffer[1]+=r[0]*n[3]+r[1]*n[2]+r[2]*n[1]+r[3]*n[0]<<16,this}_plus(t){let r=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],r<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=r}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${Gl(this.buffer[1])} ${Gl(this.buffer[0])}`}},Oe=class e extends Vu{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,r=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let n=t.length,i=new e(r);for(let o=0;o<n;){let s=zl<n-o?zl:n-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([E_[s],0]));i.times(c),i.plus(a),o+=s}return i}static convertArray(t){let r=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+2*n*4,2));return r}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}},So=class e extends Vu{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let r=this.buffer[1]<<0,n=t.buffer[1]<<0;return r<n||r===n&&this.buffer[0]<t.buffer[0]}static from(t,r=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let n=t.startsWith("-"),i=t.length,o=new e(r);for(let s=n?1:0;s<i;){let a=zl<i-s?zl:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([E_[a],0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let r=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+2*n*4,2));return r}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}},ku=class e{constructor(t){this.buffer=t}high(){return new So(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new So(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let r=new Oe(new Uint32Array([this.buffer[3],0])),n=new Oe(new Uint32Array([this.buffer[2],0])),i=new Oe(new Uint32Array([this.buffer[1],0])),o=new Oe(new Uint32Array([this.buffer[0],0])),s=new Oe(new Uint32Array([t.buffer[3],0])),a=new Oe(new Uint32Array([t.buffer[2],0])),c=new Oe(new Uint32Array([t.buffer[1],0])),l=new Oe(new Uint32Array([t.buffer[0],0])),h=Oe.multiply(o,l);this.buffer[0]=h.low();let u=new Oe(new Uint32Array([h.high(),0]));return h=Oe.multiply(i,l),u.plus(h),h=Oe.multiply(o,c),u.plus(h),this.buffer[1]=u.low(),this.buffer[3]=u.lessThan(h)?1:0,this.buffer[2]=u.high(),new Oe(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Oe.multiply(n,l)).plus(Oe.multiply(i,c)).plus(Oe.multiply(o,a)),this.buffer[3]+=Oe.multiply(r,l).plus(Oe.multiply(n,c)).plus(Oe.multiply(i,a)).plus(Oe.multiply(o,s)).low(),this}plus(t){let r=new Uint32Array(4);return r[3]=this.buffer[3]+t.buffer[3]>>>0,r[2]=this.buffer[2]+t.buffer[2]>>>0,r[1]=this.buffer[1]+t.buffer[1]>>>0,r[0]=this.buffer[0]+t.buffer[0]>>>0,r[0]<this.buffer[0]>>>0&&++r[1],r[1]<this.buffer[1]>>>0&&++r[2],r[2]<this.buffer[2]>>>0&&++r[3],this.buffer[3]=r[3],this.buffer[2]=r[2],this.buffer[1]=r[1],this.buffer[0]=r[0],this}hex(){return`${Gl(this.buffer[3])} ${Gl(this.buffer[2])} ${Gl(this.buffer[1])} ${Gl(this.buffer[0])}`}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}static from(t,r=new Uint32Array(4)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(4)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(4)){let n=t.startsWith("-"),i=t.length,o=new e(r);for(let s=n?1:0;s<i;){let a=zl<i-s?zl:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([E_[a],0,0,0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let r=new Uint32Array(t.length*4);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+16*n,4));return r}}});var N_={};Zr(N_,{toIntervalDayTimeInt32Array:()=>A_,toIntervalDayTimeObjects:()=>R_,toIntervalMonthDayNanoInt32Array:()=>P_,toIntervalMonthDayNanoObjects:()=>C_});function A_(e){var t,r;let n=e.length,i=new Int32Array(n*2);for(let o=0,s=0;o<n;o++){let a=e[o];i[s++]=(t=a.days)!==null&&t!==void 0?t:0,i[s++]=(r=a.milliseconds)!==null&&r!==void 0?r:0}return i}function P_(e){var t,r;let n=e.length,i=new Int32Array(n*4);for(let o=0,s=0;o<n;o++){let a=e[o];i[s++]=(t=a.months)!==null&&t!==void 0?t:0,i[s++]=(r=a.days)!==null&&r!==void 0?r:0;let c=a.nanoseconds;if(c){let l=BigInt(c);i[s++]=Number(l&BigInt(4294967295))>>>0,i[s++]=Number(l>>BigInt(32))>>>0}else s+=2}return i}function R_(e){let t=e.length,r=new Array(t/2);for(let n=0,i=0;n<t;n+=2)r[i++]={days:e[n],milliseconds:e[n+1]};return r}function C_(e,t){let r=e.length,n=new Array(r/4);for(let i=0,o=0;i<r;i+=4){let s=BigInt(e[i+3])<<BigInt(32)|BigInt(e[i+2]>>>0);n[o++]={months:e[i],days:e[i+1],nanoseconds:t?`${s}`:s}}return n}var Bp=w(()=>{});function wA(e){let t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2)t[r>>1]=Number.parseInt(e.slice(r,r+2),16);return t}function cD(e){return wA(e.join(""))}function _A(e,t){let r=new Uint8Array(e.length*16),n=new DataView(r.buffer);for(let[i,o]of e.entries()){let s=i*16,a=o.SIZE;if(n.setInt32(s,a,!0),o.INLINED!==void 0){let c=t(o.INLINED);for(let l=0;l<c.length&&l<12;l++)r[s+4+l]=c[l]}else{let c=o.PREFIX_HEX;for(let l=0;l<8&&l<c.length;l+=2)r[s+4+(l>>1)]=Number.parseInt(c.slice(l,l+2),16);n.setInt32(s+8,o.BUFFER_INDEX,!0),n.setInt32(s+12,o.OFFSET,!0)}}return r}function lD(e){return _A(e,t=>{let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n>>1]=Number.parseInt(t.slice(n,n+2),16);return r})}function hD(e){return _A(e,t=>new TextEncoder().encode(t))}var Vl,Lp,Dp,MA=w(()=>{Zn();Rr();te();fn();ka();fo();I_();Ne();Je();Bp();Vl=class extends rt{constructor(t,r,n,i,o=Xt.V5,s=[]){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.variadicBufferIndex=-1,this.bytes=t,this.nodes=r,this.buffers=n,this.dictionaries=i,this.metadataVersion=o,this.variadicBufferCounts=s}visit(t){return super.visit(t instanceof Z?t.type:t)}visitNull(t,{length:r}=this.nextFieldNode()){return Q({type:t,length:r})}visitBool(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitUtf8View(t,{length:r,nullCount:n}=this.nextFieldNode()){let i=this.readNullBitmap(t,n),o=this.readData(t),s=this.readVariadicBuffers(this.nextVariadicBufferCount());return Q({type:t,length:r,nullCount:n,nullBitmap:i,views:o,variadicBuffers:s})}visitBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinaryView(t,{length:r,nullCount:n}=this.nextFieldNode()){let i=this.readNullBitmap(t,n),o=this.readData(t),s=this.readVariadicBuffers(this.nextVariadicBufferCount());return Q({type:t,length:r,nullCount:n,nullBitmap:i,views:o,variadicBuffers:s})}visitFixedSizeBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitLargeList(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return this.metadataVersion<Xt.V5&&this.readNullBitmap(t,n),t.mode===jt.Sparse?this.visitSparseUnion(t,{length:r,nullCount:n}):this.visitDenseUnion(t,{length:r,nullCount:n})}visitDenseUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDuration(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),child:this.visit(t.children[0])})}visitMap(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,r,n=this.nextBufferRange()){return r>0&&this.readData(t,n)||new Uint8Array(0)}readOffsets(t,r){return this.readData(t,r)}readTypeIds(t,r){return this.readData(t,r)}readData(t,{length:r,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+r)}readVariadicBuffers(t){return Array.from({length:t},()=>this.readData(null))}nextVariadicBufferCount(){var t;return(t=this.variadicBufferCounts[++this.variadicBufferIndex])!==null&&t!==void 0?t:0}readDictionary(t){return this.dictionaries.get(t.id)}},Lp=class extends Vl{constructor(t,r,n,i,o,s=[]){super(new Uint8Array(0),r,n,i,o,s),this.sources=t}readNullBitmap(t,r,{offset:n}=this.nextBufferRange()){return r<=0?new Uint8Array(0):Va(this.sources[n])}readOffsets(t,{offset:r}=this.nextBufferRange()){return Tt(Uint8Array,Tt(t.OffsetArrayType,this.sources[r]))}readTypeIds(t,{offset:r}=this.nextBufferRange()){return Tt(Uint8Array,Tt(t.ArrayType,this.sources[r]))}readData(t,{offset:r}=this.nextBufferRange()){let{sources:n}=this;if(z.isTimestamp(t))return Tt(Uint8Array,So.convertArray(n[r]));if((z.isInt(t)||z.isTime(t))&&t.bitWidth===64||z.isDuration(t))return Tt(Uint8Array,So.convertArray(n[r]));if(z.isDate(t)&&t.unit===Qt.MILLISECOND)return Tt(Uint8Array,So.convertArray(n[r]));if(z.isDecimal(t))return Tt(Uint8Array,ku.convertArray(n[r]));if(z.isBinary(t)||z.isLargeBinary(t)||z.isFixedSizeBinary(t))return cD(n[r]);if(z.isBinaryView(t))return lD(n[r]);if(z.isUtf8View(t))return hD(n[r]);if(z.isBool(t))return Va(n[r]);if(z.isUtf8(t)||z.isLargeUtf8(t))return En(n[r].join(""));if(z.isInterval(t))switch(t.unit){case Lt.DAY_TIME:return A_(n[r]);case Lt.MONTH_DAY_NANO:return P_(n[r]);default:break}return Tt(Uint8Array,Tt(t.ArrayType,n[r].map(i=>+i)))}readVariadicBuffers(t){let r=[];for(let n=0;n<t;n++){let{offset:i}=this.nextBufferRange(),o=this.sources[i];r.push(wA(o))}return r}};Dp=class extends Vl{constructor(t,r,n,i,o,s=[]){super(new Uint8Array(0),r,n,i,o,s),this.bodyChunks=t}readData(t,r=this.nextBufferRange()){return this.bodyChunks[this.buffersIndex]}}});var vo,Fp=w(()=>{Si();me();Je();vo=class extends Pr{constructor(t){super(t),this._values=new dn(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,nt(r))}_flushPending(t,r){let n=this._offsets,i=this._values.reserve(r).buffer,o=0;for(let[s,a]of t)if(a===void 0)n.set(s,0);else{let c=a.length;i.set(a,o),n.set(s,c),o+=c}}}});var Eo,Up=w(()=>{Je();Si();me();Eo=class extends Pr{constructor(t){super(t),this._values=new dn(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,nt(r))}_flushPending(t,r){let n=this._offsets,i=this._values.reserve(r).buffer,o=0;for(let[s,a]of t)if(a===void 0)n.set(s,BigInt(0));else{let c=a.length;i.set(a,o),n.set(s,BigInt(c)),o+=c}}}});var $a,O_=w(()=>{Si();me();$a=class extends oe{constructor(t){super(t),this._values=new Ul}setValue(t,r){this._values.set(t,+r)}}});var $i,zs,Vs,B_=w(()=>{me();Dn();$i=class extends $e{};$i.prototype._setValue=t_;zs=class extends $i{};zs.prototype._setValue=Qm;Vs=class extends $i{};Vs.prototype._setValue=tp});var ks,L_=w(()=>{me();Dn();ks=class extends $e{};ks.prototype._setValue=n_});var Ya,D_=w(()=>{te();me();qu();Ya=class extends oe{constructor({type:t,nullValues:r,dictionaryHashFunction:n}){super({type:new We(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Ei({type:this.type.indices,nullValues:r}),this.dictionary=Ei({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,r){let n=this.indices;return r=n.setValid(t,r),this.length=n.length,r}setValue(t,r){let n=this._keysToIndices,i=this.valueToKey(r),o=n[i];return o===void 0&&(n[i]=o=this._dictionaryOffset+this.dictionary.append(r).length-1),this.indices.setValue(t,o)}flush(){let t=this.type,r=this._dictionary,n=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=r?r.concat(n):n,this.finished||(this._dictionaryOffset+=n.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}}});var qs,F_=w(()=>{me();Dn();qs=class extends $e{};qs.prototype._setValue=Qw});var Ka,U_=w(()=>{Rr();me();te();Ka=class extends oe{setValue(t,r){let[n]=this.children,i=t*this.stride;for(let o=-1,s=this.stride;++o<s;)n.set(i+o,r[o])}setValid(t,r){return super.setValid(t,r)||this.children[0].setValid((t+1)*this.stride-1,!1),r}addChild(t,r="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let n=this.children.push(t);return this.type=new _e(this.type.listSize,new Z(r,t.type,!0)),n}}});var Yi,Xa,Za,Ja,G_=w(()=>{Nu();me();Yi=class extends $e{setValue(t,r){this._values.set(t,r)}},Xa=class extends Yi{setValue(t,r){super.setValue(t,Cu(r))}},Za=class extends Yi{},Ja=class extends Yi{}});var Ti,js,Ws,Hs,z_=w(()=>{me();Dn();Ti=class extends $e{};Ti.prototype._setValue=i_;js=class extends Ti{};js.prototype._setValue=lp;Ws=class extends Ti{};Ws.prototype._setValue=hp;Hs=class extends Ti{};Hs.prototype._setValue=up});var ei,$s,Ys,Ks,Xs,V_=w(()=>{me();Dn();ei=class extends $e{};ei.prototype._setValue=o_;$s=class extends ei{};$s.prototype._setValue=fp;Ys=class extends ei{};Ys.prototype._setValue=dp;Ks=class extends ei{};Ks.prototype._setValue=mp;Xs=class extends ei{};Xs.prototype._setValue=pp});var $r,Qa,tc,ec,rc,nc,ic,oc,sc,k_=w(()=>{me();$r=class extends $e{setValue(t,r){this._values.set(t,r)}},Qa=class extends $r{},tc=class extends $r{},ec=class extends $r{},rc=class extends $r{},nc=class extends $r{},ic=class extends $r{},oc=class extends $r{},sc=class extends $r{}});var ac,q_=w(()=>{Rr();te();Si();me();ac=class extends Pr{constructor(t){super(t),this._offsets=new Ds(t.type)}addChild(t,r="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new je(new Z(r,t.type,!0)),this.numChildren-1}_flushPending(t){let r=this._offsets,[n]=this.children;for(let[i,o]of t)if(typeof o>"u")r.set(i,0);else{let s=o,a=s.length,c=r.set(i,a).buffer[i];for(let l=-1;++l<a;)n.set(c+l,s[l])}}}});var cc,j_=w(()=>{Rr();te();Si();ki();me();cc=class extends Pr{constructor(t){super(t),this._offsets=new Ds(t.type)}addChild(t,r="0"){if(this.numChildren>0)throw new Error("LargeListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Bn(new Z(r,t.type,!0)),this.numChildren-1}_flushPending(t){let r=this._offsets,[n]=this.children;for(let[i,o]of t)if(typeof o>"u")r.set(i,BigInt(0));else{let s=o,a=s.length,c=It(r.set(i,BigInt(a)).buffer[i]);for(let l=-1;++l<a;)n.set(c+l,s[l])}}}});var lc,W_=w(()=>{Rr();te();me();lc=class extends Pr{set(t,r){return super.set(t,r)}setValue(t,r){let n=r instanceof Map?r:new Map(Object.entries(r)),i=this._pending||(this._pending=new Map),o=i.get(t);o&&(this._pendingLength-=o.size),this._pendingLength+=n.size,i.set(t,n)}addChild(t,r=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Ir(new Z(r,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let r=this._offsets,[n]=this.children;for(let[i,o]of t)if(o===void 0)r.set(i,0);else{let{[i]:s,[i+1]:a}=r.set(i,o.size).buffer;for(let c of o.entries())if(n.set(s,c),++s>=a)break}}}});var hc,H_=w(()=>{me();hc=class extends oe{setValue(t,r){}setValid(t,r){return this.length=Math.max(t+1,this.length),r}}});var uc,$_=w(()=>{Rr();me();te();uc=class extends oe{setValue(t,r){let{children:n,type:i}=this;switch(Array.isArray(r)||r.constructor){case!0:return i.children.forEach((o,s)=>n[s].set(t,r[s]));case Map:return i.children.forEach((o,s)=>n[s].set(t,r.get(o.name)));default:return i.children.forEach((o,s)=>n[s].set(t,r[o.name]))}}setValid(t,r){return super.setValid(t,r)||this.children.forEach(n=>n.setValid(t,r)),r}addChild(t,r=`${this.numChildren}`){let n=this.children.push(t);return this.type=new Yt([...this.type.children,new Z(r,t.type,!0)]),n}}});var ri,Zs,Js,Qs,ta,Y_=w(()=>{me();Dn();ri=class extends $e{};ri.prototype._setValue=e_;Zs=class extends ri{};Zs.prototype._setValue=ep;Js=class extends ri{};Js.prototype._setValue=rp;Qs=class extends ri{};Qs.prototype._setValue=np;ta=class extends ri{};ta.prototype._setValue=ip});var ni,ea,ra,na,ia,K_=w(()=>{me();Dn();ni=class extends $e{};ni.prototype._setValue=r_;ea=class extends ni{};ea.prototype._setValue=op;ra=class extends ni{};ra.prototype._setValue=sp;na=class extends ni{};na.prototype._setValue=ap;ia=class extends ni{};ia.prototype._setValue=cp});var To,fc,dc,X_=w(()=>{Rr();Si();me();te();To=class extends oe{constructor(t){super(t),this._typeIds=new Mo(Int8Array,0,1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,r){return this.set(this.length,t,r)}set(t,r,n){return n===void 0&&(n=this._valueToChildTypeId(this,r,t)),this.setValue(t,r,n),this}setValue(t,r,n){this._typeIds.set(t,n);let i=this.type.typeIdToChildIndex[n],o=this.children[i];o?.set(t,r),this.length=Math.max(t+1,this.length)}addChild(t,r=`${this.children.length}`){let n=this.children.push(t),{type:{children:i,mode:o,typeIds:s}}=this,a=[...i,new Z(r,t.type)];return this.type=new Hr(o,[...s,n],a),n}_valueToChildTypeId(t,r,n){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},fc=class extends To{},dc=class extends To{constructor(t){super(t),this._offsets=new Mo(Int32Array)}setValue(t,r,n){let i=this._typeIds.set(t,n).buffer[t],o=this.getChildAt(this.type.typeIdToChildIndex[i]),s=this._offsets.set(t,o.length).buffer[t];o?.set(s,r),this.length=Math.max(t+1,this.length)}}});var oa,Z_=w(()=>{fo();Fp();Si();me();oa=class extends Pr{constructor(t){super(t),this._values=new dn(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,En(r))}_flushPending(t,r){}};oa.prototype._flushPending=vo.prototype._flushPending});var sa,J_=w(()=>{fo();Si();me();Up();sa=class extends Pr{constructor(t){super(t),this._values=new dn(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,En(r))}_flushPending(t,r){}};sa.prototype._flushPending=Eo.prototype._flushPending});var Io,Gp=w(()=>{te();me();Si();Je();Zn();Io=class extends oe{constructor(t){super(t),this._variadicBuffers=[],this._currentBuffer=null,this._currentBufferIndex=0,this._currentBufferOffset=0,this._bufferSize=32*1024*1024,this._views=new dn(Uint8Array)}get byteLength(){let t=0;this._views&&(t+=this._views.byteLength),this._nulls&&(t+=this._nulls.byteLength);for(let r of this._variadicBuffers)t+=r.byteLength;return this._currentBuffer&&(t+=this._currentBuffer.byteLength),t}setValue(t,r){return this.writeBinaryValue(t,this.encodeValue(r))}writeBinaryValue(t,r){let n=r.length,i=(t+1)*Mt.ELEMENT_WIDTH,o=this._views.length;i>o&&this._views.reserve(i-o);let s=this._views.buffer,a=t*Mt.ELEMENT_WIDTH,c=new DataView(s.buffer,s.byteOffset+a,Mt.ELEMENT_WIDTH);if(c.setInt32(Mt.LENGTH_OFFSET,n,!0),n<=Mt.INLINE_CAPACITY){s.set(r,a+Mt.INLINE_OFFSET);for(let l=n;l<Mt.INLINE_CAPACITY;l++)s[a+Mt.INLINE_OFFSET+l]=0}else{let l=new DataView(r.buffer,r.byteOffset,Math.min(4,n));c.setUint32(Mt.INLINE_OFFSET,l.getUint32(0,!0),!0),(!this._currentBuffer||this._currentBufferOffset+n>this._bufferSize)&&(this._currentBuffer&&this._variadicBuffers.push(this._currentBuffer.buffer.slice(0,this._currentBufferOffset)),this._currentBuffer=new dn(Uint8Array),this._currentBufferIndex=this._variadicBuffers.length,this._currentBufferOffset=0),this._currentBuffer.reserve(n).buffer.set(r,this._currentBufferOffset),c.setInt32(Mt.BUFFER_INDEX_OFFSET,this._currentBufferIndex,!0),c.setInt32(Mt.BUFFER_OFFSET_OFFSET,this._currentBufferOffset,!0),this._currentBufferOffset+=n}return this}encodeValue(t){return nt(t)}setValid(t,r){let n=(t+1)*Mt.ELEMENT_WIDTH,i=this._views.length;n>i&&this._views.reserve(n-i);let o=super.setValid(t,r);if(!o){let s=this._views.buffer,a=t*Mt.ELEMENT_WIDTH;for(let c=0;c<Mt.ELEMENT_WIDTH;c++)s[a+c]=0}return o}clear(){return this._variadicBuffers=[],this._currentBuffer=null,this._currentBufferIndex=0,this._currentBufferOffset=0,this._views.clear(),super.clear()}flush(){let{type:t,length:r,nullCount:n,_views:i,_nulls:o}=this;this._currentBuffer&&this._currentBufferOffset>0&&(this._variadicBuffers.push(this._currentBuffer.buffer.slice(0,this._currentBufferOffset)),this._currentBuffer=null,this._currentBufferOffset=0);let s=i.flush(r*Mt.ELEMENT_WIDTH),a=n>0?o.flush(r):void 0,c=this._variadicBuffers.slice();return this._variadicBuffers=[],this._currentBufferIndex=0,this.clear(),Q({type:t,length:r,nullCount:n,nullBitmap:a,views:s,variadicBuffers:c})}finish(){return this.finished=!0,this}}});var mc,Q_=w(()=>{Gp();fo();mc=class extends Io{constructor(t){super(t)}setValue(t,r){return this.writeBinaryValue(t,En(r))}}});var tM,bA,xA=w(()=>{fn();Fp();Up();O_();B_();L_();D_();F_();U_();G_();z_();V_();k_();q_();j_();W_();H_();$_();Y_();K_();X_();Z_();J_();Gp();Q_();tM=class extends rt{visitNull(){return hc}visitBool(){return $a}visitInt(){return $r}visitInt8(){return Qa}visitInt16(){return tc}visitInt32(){return ec}visitInt64(){return rc}visitUint8(){return nc}visitUint16(){return ic}visitUint32(){return oc}visitUint64(){return sc}visitFloat(){return Yi}visitFloat16(){return Xa}visitFloat32(){return Za}visitFloat64(){return Ja}visitUtf8(){return oa}visitLargeUtf8(){return sa}visitBinary(){return vo}visitLargeBinary(){return Eo}visitFixedSizeBinary(){return qs}visitDate(){return $i}visitDateDay(){return zs}visitDateMillisecond(){return Vs}visitTimestamp(){return ri}visitTimestampSecond(){return Zs}visitTimestampMillisecond(){return Js}visitTimestampMicrosecond(){return Qs}visitTimestampNanosecond(){return ta}visitTime(){return ni}visitTimeSecond(){return ea}visitTimeMillisecond(){return ra}visitTimeMicrosecond(){return na}visitTimeNanosecond(){return ia}visitDecimal(){return ks}visitList(){return ac}visitLargeList(){return cc}visitStruct(){return uc}visitUnion(){return To}visitDenseUnion(){return dc}visitSparseUnion(){return fc}visitDictionary(){return Ya}visitInterval(){return Ti}visitIntervalDayTime(){return js}visitIntervalYearMonth(){return Ws}visitIntervalMonthDayNano(){return Hs}visitDuration(){return ei}visitDurationSecond(){return $s}visitDurationMillisecond(){return Ys}visitDurationMicrosecond(){return Ks}visitDurationNanosecond(){return Xs}visitFixedSizeList(){return Ka}visitMap(){return lc}visitBinaryView(){return Io}visitUtf8View(){return mc}},bA=new tM});function Yr(e,t){return t instanceof e.constructor}function Ao(e,t){return e===t||Yr(e,t)}function Po(e,t){return e===t||Yr(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function zp(e,t){return e===t||Yr(e,t)&&e.precision===t.precision}function uD(e,t){return e===t||Yr(e,t)&&e.byteWidth===t.byteWidth}function eM(e,t){return e===t||Yr(e,t)&&e.unit===t.unit}function ju(e,t){return e===t||Yr(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function Wu(e,t){return e===t||Yr(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function SA(e,t){return e===t||Yr(e,t)&&e.children.length===t.children.length&&Ki.compareManyFields(e.children,t.children)}function fD(e,t){return e===t||Yr(e,t)&&e.children.length===t.children.length&&Ki.compareManyFields(e.children,t.children)}function rM(e,t){return e===t||Yr(e,t)&&e.mode===t.mode&&e.typeIds.every((r,n)=>r===t.typeIds[n])&&Ki.compareManyFields(e.children,t.children)}function dD(e,t){return e===t||Yr(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&Ki.visit(e.indices,t.indices)&&Ki.visit(e.dictionary,t.dictionary)}function Vp(e,t){return e===t||Yr(e,t)&&e.unit===t.unit}function Hu(e,t){return e===t||Yr(e,t)&&e.unit===t.unit}function mD(e,t){return e===t||Yr(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&Ki.compareManyFields(e.children,t.children)}function pD(e,t){return e===t||Yr(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&Ki.compareManyFields(e.children,t.children)}function pc(e,t){return Ki.compareSchemas(e,t)}function vA(e,t){return Ki.compareFields(e,t)}function kp(e,t){return Ki.visit(e,t)}var at,Ki,$u=w(()=>{fn();at=class extends rt{compareSchemas(t,r){return t===r||r instanceof t.constructor&&this.compareManyFields(t.fields,r.fields)}compareManyFields(t,r){return t===r||Array.isArray(t)&&Array.isArray(r)&&t.length===r.length&&t.every((n,i)=>this.compareFields(n,r[i]))}compareFields(t,r){return t===r||r instanceof t.constructor&&t.name===r.name&&t.nullable===r.nullable&&this.visit(t.type,r.type)}};at.prototype.visitNull=Ao;at.prototype.visitBool=Ao;at.prototype.visitInt=Po;at.prototype.visitInt8=Po;at.prototype.visitInt16=Po;at.prototype.visitInt32=Po;at.prototype.visitInt64=Po;at.prototype.visitUint8=Po;at.prototype.visitUint16=Po;at.prototype.visitUint32=Po;at.prototype.visitUint64=Po;at.prototype.visitFloat=zp;at.prototype.visitFloat16=zp;at.prototype.visitFloat32=zp;at.prototype.visitFloat64=zp;at.prototype.visitUtf8=Ao;at.prototype.visitLargeUtf8=Ao;at.prototype.visitUtf8View=Ao;at.prototype.visitBinary=Ao;at.prototype.visitLargeBinary=Ao;at.prototype.visitBinaryView=Ao;at.prototype.visitFixedSizeBinary=uD;at.prototype.visitDate=eM;at.prototype.visitDateDay=eM;at.prototype.visitDateMillisecond=eM;at.prototype.visitTimestamp=ju;at.prototype.visitTimestampSecond=ju;at.prototype.visitTimestampMillisecond=ju;at.prototype.visitTimestampMicrosecond=ju;at.prototype.visitTimestampNanosecond=ju;at.prototype.visitTime=Wu;at.prototype.visitTimeSecond=Wu;at.prototype.visitTimeMillisecond=Wu;at.prototype.visitTimeMicrosecond=Wu;at.prototype.visitTimeNanosecond=Wu;at.prototype.visitDecimal=Ao;at.prototype.visitList=SA;at.prototype.visitLargeList=SA;at.prototype.visitStruct=fD;at.prototype.visitUnion=rM;at.prototype.visitDenseUnion=rM;at.prototype.visitSparseUnion=rM;at.prototype.visitDictionary=dD;at.prototype.visitInterval=Vp;at.prototype.visitIntervalDayTime=Vp;at.prototype.visitIntervalYearMonth=Vp;at.prototype.visitIntervalMonthDayNano=Vp;at.prototype.visitDuration=Hu;at.prototype.visitDurationSecond=Hu;at.prototype.visitDurationMillisecond=Hu;at.prototype.visitDurationMicrosecond=Hu;at.prototype.visitDurationNanosecond=Hu;at.prototype.visitFixedSizeList=mD;at.prototype.visitMap=pD;Ki=new at});function Ei(e){let t=e.type,r=new(bA.getVisitFn(t)())(e);if(t.children&&t.children.length>0){let n=e.children||[],i={nullValues:e.nullValues},o=Array.isArray(n)?((s,a)=>n[a]||i):(({name:s})=>n[s]||i);for(let[s,a]of t.children.entries()){let{type:c}=a,l=o(a,s);r.children.push(Ei(Object.assign(Object.assign({},l),{type:c})))}}return r}function kl(e,t){if(e instanceof ut||e instanceof $||e.type instanceof z||ArrayBuffer.isView(e))return Hi(e);let r={type:t??qp(e),nullValues:[null]},n=[...jp(r)(e)],i=n.length===1?n[0]:n.reduce((o,s)=>o.concat(s));return z.isDictionary(i.type)?i.memoize():i}function nM(e){let t=kl(e),r=new Zt(new _t(t.type.children),t.data[0]);return new ce(r)}function qp(e){if(e.length===0)return new De;let t=0,r=0,n=0,i=0,o=0,s=0,a=0,c=0;for(let l of e){if(l==null){++t;continue}switch(typeof l){case"bigint":++s;continue;case"boolean":++a;continue;case"number":++i;continue;case"string":++o;continue;case"object":Array.isArray(l)?++r:Object.prototype.toString.call(l)==="[object Date]"?++c:++n;continue}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}if(i+t===e.length)return new On;if(o+t===e.length)return new We(new vr,new Ve);if(s+t===e.length)return new Rn;if(a+t===e.length)return new Er;if(c+t===e.length)return new qi;if(r+t===e.length){let l=e,h=qp(l[l.findIndex(u=>u!=null)]);if(l.every(u=>u==null||kp(h,qp(u))))return new je(new Z("",h,!0))}else if(n+t===e.length){let l=new Map;for(let h of e)for(let u of Object.keys(h))!l.has(u)&&h[u]!=null&&l.set(u,new Z(u,qp([h[u]]),!0));return new Yt([...l.values()])}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}function jp(e){let{["queueingStrategy"]:t="count"}=e,{["highWaterMark"]:r=t!=="bytes"?Number.POSITIVE_INFINITY:Math.pow(2,14)}=e,n=t!=="bytes"?"length":"byteLength";return function*(i){let o=0,s=Ei(e);for(let a of i)s.append(a)[n]>=r&&++o&&(yield s.toVector());(s.finish().length>0||o===0)&&(yield s.toVector())}}function iM(e){let{["queueingStrategy"]:t="count"}=e,{["highWaterMark"]:r=t!=="bytes"?Number.POSITIVE_INFINITY:Math.pow(2,14)}=e,n=t!=="bytes"?"length":"byteLength";return function(i){return Gr(this,arguments,function*(){var o,s,a,c;let l=0,h=Ei(e);try{for(var u=!0,f=vn(i),d;d=yield wt(f.next()),o=d.done,!o;u=!0){c=d.value,u=!1;let m=c;h.append(m)[n]>=r&&++l&&(yield yield wt(h.toVector()))}}catch(m){s={error:m}}finally{try{!u&&!o&&(a=f.return)&&(yield wt(a.call(f)))}finally{if(s)throw s.error}}(h.finish().length>0||l===0)&&(yield yield wt(h.toVector()))})}}var qu=w(()=>{an();Rr();te();Zn();Ar();xA();gc();Ro();$u()});function Wp(e,t){return gD(e,t.map(r=>r.data.concat()))}function gD(e,t){let r=[...e.fields],n=[],i={numBatches:t.reduce((u,f)=>Math.max(u,f.length),0)},o=0,s=0,a=-1,c=t.length,l,h=[];for(;i.numBatches-- >0;){for(s=Number.POSITIVE_INFINITY,a=-1;++a<c;)h[a]=l=t[a].shift(),s=Math.min(s,l?l.length:s);Number.isFinite(s)&&(h=yD(r,s,h,t,i),s>0&&(n[o++]=Q({type:new Yt(r),length:s,nullCount:0,children:h.slice()})))}return[e=e.assign(r),n.map(u=>new Zt(e,u))]}function yD(e,t,r,n,i){var o;let s=(t+63&-64)>>3;for(let a=-1,c=n.length;++a<c;){let l=r[a],h=l?.length;if(h>=t)h===t?r[a]=l:(r[a]=l.slice(0,t),i.numBatches=Math.max(i.numBatches,n[a].unshift(l.slice(t,h-t))));else{let u=e[a];e[a]=u.clone({nullable:!0}),r[a]=(o=l?._changeLengthAndBackfillNullBitmap(t))!==null&&o!==void 0?o:Q({type:u.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return r}var EA=w(()=>{Zn();te();Ro()});function oM(e){let t={},r=Object.entries(e);for(let[n,i]of r)t[n]=Hi(i);return new ce(t)}function sM(e){let t={},r=Object.entries(e);for(let[n,i]of r)t[n]=kl(i);return new ce(t)}var TA,IA,ce,gc=w(()=>{Ne();Zn();qu();Ar();Rr();te();$u();EA();Ep();Ua();Dn();Tp();Ip();Bl();Ro();IA=Symbol.for("apache-arrow/Table"),ce=class e{static isTable(t){return t?.[IA]===!0}constructor(...t){var r,n;if(t.length===0)return this.batches=[],this.schema=new _t([]),this._offsets=[0],this;let i,o;t[0]instanceof _t&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(o=t.pop());let s=c=>{if(c){if(c instanceof Zt)return[c];if(c instanceof e)return c.batches;if(c instanceof ut){if(c.type instanceof Yt)return[new Zt(new _t(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(l=>s(l));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(l=>s(l));if(typeof c=="object"){let l=Object.keys(c),h=l.map(d=>new $([c[d]])),u=i??new _t(l.map((d,m)=>new Z(String(d),h[m].type,h[m].nullable))),[,f]=Wp(u,h);return f.length===0?[new Zt(c)]:f}}}return[]},a=t.flatMap(c=>s(c));if(i=(n=i??((r=a[0])===null||r===void 0?void 0:r.schema))!==null&&n!==void 0?n:new _t([]),!(i instanceof _t))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof Zt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!pc(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??bp(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,r)=>t+r.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=Mp(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(Ga(t,this.numRows))}set(t,r){}indexOf(t,r){return-1}[Symbol.iterator](){return this.batches.length>0?Fl.visit(new $(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
15
+ return true;`)}function OL(e){return typeof e!="bigint"?gi(e):`${gi(e)}n`}var W4=w(()=>{vu()});function d_(e,t){let r=Math.ceil(e)*t-1;return(r-r%64+64||64)/t}function H4(e,t=0){return e.length>=t?e.subarray(0,t):au(new e.constructor(t),e,0)}var dn,Mo,Ul,Ds,Si=w(()=>{Je();dn=class{constructor(t,r=0,n=1){this.length=Math.ceil(r/n),this.buffer=new t(this.length),this.stride=n,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,r){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let r=this.stride,n=this.length*r,i=this.buffer.length;n>=i&&this._resize(i===0?d_(n*1,this.BYTES_PER_ELEMENT):d_(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=d_(t*this.stride,this.BYTES_PER_ELEMENT);let r=H4(this.buffer,t);return this.clear(),r}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=H4(this.buffer,t)}},Mo=class extends dn{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,r){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=r,this}},Ul=class extends Mo{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,r){let{buffer:n}=this.reserve(t-this.length+1),i=t>>3,o=t%8,s=n[i]>>o&1;return r?s===0&&(n[i]|=1<<o,++this.numValid):s===1&&(n[i]&=~(1<<o),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},Ds=class extends Mo{constructor(t){super(t.OffsetArrayType,1,1)}append(t){return this.set(this.length-1,t)}set(t,r){let n=this.length-1,i=this.reserve(t-n+1).buffer;return n<t++&&n>=0&&i.fill(i[n],n,t),i[t]=i[t-1]+r,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}}});var oe,$e,Pr,me=w(()=>{Ar();Zn();Bu();te();W4();Si();oe=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:r}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=r,this.stride=Ln(t),this._nulls=new Ul,r&&r.length>0&&(this._isValid=j4(r))}toVector(){return new $([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:r,_values:n,_nulls:i,_typeIds:o,children:s}=this;return r&&(t+=r.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),s.reduce((a,c)=>a+c.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((r,n)=>r+n.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,r){return this.setValid(t,this.isValid(r))&&this.setValue(t,r),this}setValue(t,r){this._setValue(this,t,r)}setValid(t,r){return this.length=this._nulls.set(t,+r).length,r}addChild(t,r=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,r,n,i,{type:o,length:s,nullCount:a,_typeIds:c,_offsets:l,_values:h,_nulls:u}=this;(r=c?.flush(s))?i=l?.flush(s):(i=l?.flush(s))?t=h?.flush(l.last()):t=h?.flush(s),a>0&&(n=u?.flush(s));let f=this.children.map(d=>d.flush());return this.clear(),Q({type:o,length:s,nullCount:a,children:f,child:f[0],data:t,typeIds:r,nullBitmap:n,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,r,n,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(r=this._values)===null||r===void 0||r.clear(),(n=this._offsets)===null||n===void 0||n.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let o of this.children)o.clear();return this}};oe.prototype.length=1;oe.prototype.stride=1;oe.prototype.children=null;oe.prototype.finished=!1;oe.prototype.nullValues=null;oe.prototype._isValid=()=>!0;$e=class extends oe{constructor(t){super(t),this._values=new Mo(this.ArrayType,0,this.stride)}setValue(t,r){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,r)}},Pr=class extends oe{constructor(t){super(t),this._pendingLength=0,this._offsets=new Ds(t.type)}setValue(t,r){let n=this._pending||(this._pending=new Map),i=n.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=r instanceof Xn?r[Os].length:r.length,n.set(t,r)}setValid(t,r){return super.setValid(t,r)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,r=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,r),this}}});var ja,m_=w(()=>{ja=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,r,n,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(n),t.writeInt64(BigInt(r??0)),t.offset()}}});var Fn,$4=w(()=>{Gt();m_();vl();qm();kw();Fn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFooter(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Xt.V1}schema(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new cn).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}dictionaries(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new ja).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,r){let n=this.bb.__offset(this.bb_pos,10);return n?(r||new ja).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,12);return n?(r||new Ce).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,Xt.V1)}static addSchema(t,r){t.addFieldOffset(1,r,0)}static addDictionaries(t,r){t.addFieldOffset(2,r,0)}static startDictionariesVector(t,r){t.startVector(24,r,8)}static addRecordBatches(t,r){t.addFieldOffset(3,r,0)}static startRecordBatchesVector(t,r){t.startVector(24,r,8)}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,r){t.finish(r)}static finishSizePrefixedFooterBuffer(t,r){t.finish(r,void 0,!0)}}});function Pp(e,t){return new Map([...e||new Map,...t||new Map])}function p_(e,t=new Map){for(let r=-1,n=e.length;++r<n;){let o=e[r].type;if(z.isDictionary(o)){if(!t.has(o.id))t.set(o.id,o.dictionary);else if(t.get(o.id)!==o.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}o.children&&o.children.length>0&&p_(o.children,t)}return t}var Y4,K4,_t,Z,Rr=w(()=>{Ne();te();Y4=Symbol.for("apache-arrow/Schema"),K4=Symbol.for("apache-arrow/Field"),_t=class e{static isSchema(t){return t?.[Y4]===!0}constructor(t=[],r,n,i=Xt.V5){this.fields=t||[],this.metadata=r||new Map,n||(n=p_(this.fields)),this.dictionaries=n,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,r)=>`${r}: ${t}`).join(", ")} }>`}select(t){let r=new Set(t),n=this.fields.filter(i=>r.has(i.name));return new e(n,this.metadata)}selectAt(t){let r=t.map(n=>this.fields[n]).filter(Boolean);return new e(r,this.metadata)}assign(...t){let r=t[0]instanceof e?t[0]:Array.isArray(t[0])?new e(t[0]):new e(t),n=[...this.fields],i=Pp(Pp(new Map,this.metadata),r.metadata),o=r.fields.filter(a=>{let c=n.findIndex(l=>l.name===a.name);return~c?(n[c]=a.clone({metadata:Pp(Pp(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),s=p_(o,new Map);return new e([...n,...o],i,new Map([...this.dictionaries,...s]))}};_t.prototype.fields=null;_t.prototype.metadata=null;_t.prototype.dictionaries=null;_t.prototype[Y4]=!0;Object.defineProperty(_t,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===_t&&_t.isSchema(t)}});Z=class e{static isField(t){return t?.[K4]===!0}static new(...t){let[r,n,i,o]=t;return t[0]&&typeof t[0]=="object"&&({name:r}=t[0],n===void 0&&(n=t[0].type),i===void 0&&(i=t[0].nullable),o===void 0&&(o=t[0].metadata)),new e(`${r}`,n,i,o)}constructor(t,r,n=!1,i){this.name=t,this.type=r,this.nullable=n,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[r,n,i,o]=t;return!t[0]||typeof t[0]!="object"?[r=this.name,n=this.type,i=this.nullable,o=this.metadata]=t:{name:r=this.name,type:n=this.type,nullable:i=this.nullable,metadata:o=this.metadata}=t[0],e.new(r,n,i,o)}};Z.prototype.type=null;Z.prototype.name=null;Z.prototype.nullable=null;Z.prototype.metadata=null;Z.prototype[K4]=!0;Object.defineProperty(Z,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===Z&&Z.isField(t)}})});var LL,DL,bo,g_,vi,y_=w(()=>{m_();$4();Gt();Rr();Ne();Je();ki();LL=La,DL=hr,bo=class{static decode(t){t=new DL(nt(t));let r=Fn.getRootAsFooter(t),n=_t.decode(r.schema(),new Map,r.version());return new g_(n,r)}static encode(t){let r=new LL,n=_t.encode(r,t.schema);Fn.startRecordBatchesVector(r,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())vi.encode(r,s);let i=r.endVector();Fn.startDictionariesVector(r,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())vi.encode(r,s);let o=r.endVector();return Fn.startFooter(r),Fn.addSchema(r,n),Fn.addVersion(r,Xt.V5),Fn.addRecordBatches(r,i),Fn.addDictionaries(r,o),Fn.finishFooterBuffer(r,Fn.endFooter(r)),r.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,r=Xt.V5,n,i){this.schema=t,this.version=r,n&&(this._recordBatches=n),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,r=-1,n=this.numRecordBatches;++r<n;)(t=this.getRecordBatch(r))&&(yield t)}*dictionaryBatches(){for(let t,r=-1,n=this.numDictionaries;++r<n;)(t=this.getDictionaryBatch(r))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}},g_=class extends bo{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,r){super(t,r.version()),this._footer=r}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let r=this._footer.recordBatches(t);if(r)return vi.decode(r)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let r=this._footer.dictionaries(t);if(r)return vi.decode(r)}return null}},vi=class e{static decode(t){return new e(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,r){let{metaDataLength:n}=r,i=BigInt(r.offset),o=BigInt(r.bodyLength);return ja.createBlock(t,i,n,o)}constructor(t,r,n){this.metaDataLength=t,this.offset=It(n),this.bodyLength=It(r)}}});var Un,X4=w(()=>{Gt();vl();Xm();qm();Un=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMessage(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Xt.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):Nt.NONE}header(t){let r=this.bb.__offset(this.bb_pos,8);return r?this.bb.__union(t,this.bb_pos+r):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,12);return n?(r||new Ce).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,Xt.V1)}static addHeaderType(t,r){t.addFieldInt8(1,r,Nt.NONE)}static addHeader(t,r){t.addFieldOffset(2,r,0)}static addBodyLength(t,r){t.addFieldInt64(3,r,BigInt("0"))}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,r){t.finish(r)}static finishSizePrefixedMessageBuffer(t,r){t.finish(r,void 0,!0)}static createMessage(t,r,n,i,o,s){return e.startMessage(t),e.addVersion(t,r),e.addHeaderType(t,n),e.addHeader(t,i),e.addBodyLength(t,o),e.addCustomMetadata(t,s),e.endMessage(t)}}});var w_,Rp,Z4=w(()=>{fn();_3();Ym();Lw();f3();d3();p3();m3();b3();x3();y3();Cw();Rw();Uw();Gw();Dw();Nw();w3();g3();M3();zw();Pw();Bw();Ow();Fw();w_=class extends rt{visit(t,r){return t==null||r==null?void 0:super.visit(t,r)}visitNull(t,r){return Mu.startNull(r),Mu.endNull(r)}visitInt(t,r){return mi.startInt(r),mi.addBitWidth(r,t.bitWidth),mi.addIsSigned(r,t.isSigned),mi.endInt(r)}visitFloat(t,r){return ws.startFloatingPoint(r),ws.addPrecision(r,t.precision),ws.endFloatingPoint(r)}visitBinary(t,r){return du.startBinary(r),du.endBinary(r)}visitBinaryView(t,r){return mu.startBinaryView(r),mu.endBinaryView(r)}visitLargeBinary(t,r){return gu.startLargeBinary(r),gu.endLargeBinary(r)}visitBool(t,r){return pu.startBool(r),pu.endBool(r)}visitUtf8(t,r){return xu.startUtf8(r),xu.endUtf8(r)}visitUtf8View(t,r){return Su.startUtf8View(r),Su.endUtf8View(r)}visitLargeUtf8(t,r){return wu.startLargeUtf8(r),wu.endLargeUtf8(r)}visitDecimal(t,r){return Vi.startDecimal(r),Vi.addScale(r,t.scale),Vi.addPrecision(r,t.precision),Vi.addBitWidth(r,t.bitWidth),Vi.endDecimal(r)}visitDate(t,r){return ms.startDate(r),ms.addUnit(r,t.unit),ms.endDate(r)}visitTime(t,r){return go.startTime(r),go.addUnit(r,t.unit),go.addBitWidth(r,t.bitWidth),go.endTime(r)}visitTimestamp(t,r){let n=t.timezone&&r.createString(t.timezone)||void 0;return yo.startTimestamp(r),yo.addUnit(r,t.unit),n!==void 0&&yo.addTimezone(r,n),yo.endTimestamp(r)}visitInterval(t,r){return _s.startInterval(r),_s.addUnit(r,t.unit),_s.endInterval(r)}visitDuration(t,r){return ps.startDuration(r),ps.addUnit(r,t.unit),ps.endDuration(r)}visitList(t,r){return _u.startList(r),_u.endList(r)}visitLargeList(t,r){return yu.startLargeList(r),yu.endLargeList(r)}visitStruct(t,r){return bu.startStruct_(r),bu.endStruct_(r)}visitUnion(t,r){pi.startTypeIdsVector(r,t.typeIds.length);let n=pi.createTypeIdsVector(r,t.typeIds);return pi.startUnion(r),pi.addMode(r,t.mode),pi.addTypeIds(r,n),pi.endUnion(r)}visitDictionary(t,r){let n=this.visit(t.indices,r);return zi.startDictionaryEncoding(r),zi.addId(r,BigInt(t.id)),zi.addIsOrdered(r,t.isOrdered),n!==void 0&&zi.addIndexType(r,n),zi.endDictionaryEncoding(r)}visitFixedSizeBinary(t,r){return gs.startFixedSizeBinary(r),gs.addByteWidth(r,t.byteWidth),gs.endFixedSizeBinary(r)}visitFixedSizeList(t,r){return ys.startFixedSizeList(r),ys.addListSize(r,t.listSize),ys.endFixedSizeList(r)}visitMap(t,r){return Ms.startMap(r),Ms.addKeysSorted(r,t.keysSorted),Ms.endMap(r)}},Rp=new w_});function eA(e,t=new Map){return new _t(FL(e,t),Cp(e.metadata),t)}function __(e){return new Ye(e.count,nA(e.columns),iA(e.columns),null,oA(e.columns))}function rA(e){return new Cr(__(e.data),e.id,e.isDelta)}function FL(e,t){return(e.fields||[]).filter(Boolean).map(r=>Z.fromJSON(r,t))}function J4(e,t){return(e.children||[]).filter(Boolean).map(r=>Z.fromJSON(r,t))}function nA(e){return(e||[]).reduce((t,r)=>[...t,new Jn(r.count,UL(r.VALIDITY)),...nA(r.children)],[])}function iA(e,t=[]){for(let r=-1,n=(e||[]).length;++r<n;){let i=e[r];if(i.VALIDITY&&t.push(new Fe(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new Fe(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new Fe(t.length,i.OFFSET.length)),i.DATA&&t.push(new Fe(t.length,i.DATA.length)),i.VIEWS&&t.push(new Fe(t.length,i.VIEWS.length)),i.VARIADIC_DATA_BUFFERS)for(let o of i.VARIADIC_DATA_BUFFERS)t.push(new Fe(t.length,o.length));t=iA(i.children,t)}return t}function UL(e){return(e||[]).reduce((t,r)=>t+ +(r===0),0)}function oA(e){return(e||[]).reduce((t,r)=>[...t,...r.VARIADIC_DATA_BUFFERS?[r.VARIADIC_DATA_BUFFERS.length]:[],...oA(r.children)],[])}function sA(e,t){let r,n,i,o,s,a;return!t||!(o=e.dictionary)?(s=tA(e,J4(e,t)),i=new Z(e.name,s,e.nullable,Cp(e.metadata))):t.has(r=o.id)?(n=(n=o.indexType)?Q4(n):new Ve,a=new We(t.get(r),n,r,o.isOrdered),i=new Z(e.name,a,e.nullable,Cp(e.metadata))):(n=(n=o.indexType)?Q4(n):new Ve,t.set(r,s=tA(e,J4(e,t))),a=new We(s,n,r,o.isOrdered),i=new Z(e.name,a,e.nullable,Cp(e.metadata))),i||null}function Cp(e=[]){return new Map(e.map(({key:t,value:r})=>[t,r]))}function Q4(e){return new Se(e.isSigned,e.bitWidth)}function tA(e,t){let r=e.type.name;switch(r){case"NONE":return new De;case"null":return new De;case"binary":return new ln;case"largebinary":return new Mi;case"binaryview":return new Mt;case"utf8":return new vr;case"largeutf8":return new bi;case"utf8view":return new qr;case"bool":return new Er;case"list":return new je((t||[])[0]);case"largelist":return new On((t||[])[0]);case"struct":return new Yt(t||[]);case"struct_":return new Yt(t||[])}switch(r){case"int":{let n=e.type;return new Se(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=e.type;return new Sr(Vt[n.precision])}case"decimal":{let n=e.type;return new hn(n.scale,n.precision,n.bitWidth)}case"date":{let n=e.type;return new jr(Qt[n.unit])}case"time":{let n=e.type;return new fr(q[n.unit],n.bitWidth)}case"timestamp":{let n=e.type;return new dr(q[n.unit],n.timezone)}case"interval":{let n=e.type;return new Tr(Lt[n.unit])}case"duration":{let n=e.type;return new Wr(q[n.unit])}case"union":{let n=e.type,[i,...o]=(n.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new Hr(jt[s],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=e.type;return new un(n.byteWidth)}case"fixedsizelist":{let n=e.type;return new _e(n.listSize,(t||[])[0])}case"map":{let n=e.type;return new Ir((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${r}"`)}var aA=w(()=>{Rr();te();Fs();Ne()});function VL(e,t){return(()=>{switch(t){case Nt.Schema:return _t.fromJSON(e);case Nt.RecordBatch:return Ye.fromJSON(e);case Nt.DictionaryBatch:return Cr.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${Nt[t]}, type: ${t} }`)})}function kL(e,t){return(()=>{switch(t){case Nt.Schema:return _t.decode(e.header(new cn),new Map,e.version());case Nt.RecordBatch:return Ye.decode(e.header(new br),e.version());case Nt.DictionaryBatch:return Cr.decode(e.header(new po),e.version())}throw new Error(`Unrecognized Message type: { name: ${Nt[t]}, type: ${t} }`)})}function qL(e,t=new Map,r=Xt.V5){let n=ZL(e,t);return new _t(n,Np(e),t,r)}function jL(e,t=Xt.V5){return new Ye(e.length(),YL(e),KL(e,t),uA(e.compression()),XL(e))}function WL(e,t=Xt.V5){return new Cr(Ye.decode(e.data(),t),e.id(),e.isDelta())}function HL(e){return new Fe(e.offset(),e.length())}function $L(e){return new Jn(e.length(),e.nullCount())}function YL(e){let t=[];for(let r,n=-1,i=-1,o=e.nodesLength();++n<o;)(r=e.nodes(n))&&(t[++i]=Jn.decode(r));return t}function KL(e,t){let r=[];for(let n,i=-1,o=-1,s=e.buffersLength();++i<s;)(n=e.buffers(i))&&(t<Xt.V4&&(n.bb_pos+=8*(i+1)),r[++o]=Fe.decode(n));return r}function XL(e){let t=[],r=Math.trunc(e.variadicBufferCountsLength());for(let n=0;n<r;++n)t.push(It(e.variadicBufferCounts(n)));return t}function ZL(e,t){let r=[];for(let n,i=-1,o=-1,s=e.fieldsLength();++i<s;)(n=e.fields(i))&&(r[++o]=Z.decode(n,t));return r}function cA(e,t){let r=[];for(let n,i=-1,o=-1,s=e.childrenLength();++i<s;)(n=e.children(i))&&(r[++o]=Z.decode(n,t));return r}function JL(e,t){let r,n,i,o,s,a;return!t||!(a=e.dictionary())?(i=hA(e,cA(e,t)),n=new Z(e.name(),i,e.nullable(),Np(e))):t.has(r=It(a.id()))?(o=(o=a.indexType())?lA(o):new Ve,s=new We(t.get(r),o,r,a.isOrdered()),n=new Z(e.name(),s,e.nullable(),Np(e))):(o=(o=a.indexType())?lA(o):new Ve,t.set(r,i=hA(e,cA(e,t))),s=new We(i,o,r,a.isOrdered()),n=new Z(e.name(),s,e.nullable(),Np(e))),n||null}function Np(e){let t=new Map;if(e)for(let r,n,i=-1,o=Math.trunc(e.customMetadataLength());++i<o;)(r=e.customMetadata(i))&&(n=r.key())!=null&&t.set(n,r.value());return t}function QL(e){let t=new Map;for(let r,n,i=-1,o=Math.trunc(e.customMetadataLength());++i<o;)(r=e.customMetadata(i))&&(n=r.key())!=null&&t.set(n,r.value());return t}function lA(e){return new Se(e.isSigned(),e.bitWidth())}function hA(e,t){let r=e.typeType();switch(r){case lt.NONE:return new De;case lt.Null:return new De;case lt.Binary:return new ln;case lt.LargeBinary:return new Mi;case lt.BinaryView:return new Mt;case lt.Utf8:return new vr;case lt.LargeUtf8:return new bi;case lt.Utf8View:return new qr;case lt.Bool:return new Er;case lt.List:return new je((t||[])[0]);case lt.LargeList:return new On((t||[])[0]);case lt.Struct_:return new Yt(t||[])}switch(r){case lt.Int:{let n=e.type(new mi);return new Se(n.isSigned(),n.bitWidth())}case lt.FloatingPoint:{let n=e.type(new ws);return new Sr(n.precision())}case lt.Decimal:{let n=e.type(new Vi);return new hn(n.scale(),n.precision(),n.bitWidth())}case lt.Date:{let n=e.type(new ms);return new jr(n.unit())}case lt.Time:{let n=e.type(new go);return new fr(n.unit(),n.bitWidth())}case lt.Timestamp:{let n=e.type(new yo);return new dr(n.unit(),n.timezone())}case lt.Interval:{let n=e.type(new _s);return new Tr(n.unit())}case lt.Duration:{let n=e.type(new ps);return new Wr(n.unit())}case lt.Union:{let n=e.type(new pi);return new Hr(n.mode(),n.typeIdsArray()||[],t||[])}case lt.FixedSizeBinary:{let n=e.type(new gs);return new un(n.byteWidth())}case lt.FixedSizeList:{let n=e.type(new ys);return new _e(n.listSize(),(t||[])[0])}case lt.Map:{let n=e.type(new Ms);return new Ir((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${lt[r]}" (${r})`)}function uA(e){return e?new Wa(e.codec(),e.method()):null}function tD(e,t){let r=t.fields.map(o=>Z.encode(e,o));cn.startFieldsVector(e,r.length);let n=cn.createFieldsVector(e,r),i=t.metadata&&t.metadata.size>0?cn.createCustomMetadataVector(e,[...t.metadata].map(([o,s])=>{let a=e.createString(`${o}`),c=e.createString(`${s}`);return Ce.startKeyValue(e),Ce.addKey(e,a),Ce.addValue(e,c),Ce.endKeyValue(e)})):-1;return cn.startSchema(e),cn.addFields(e,n),cn.addEndianness(e,sD?ds.Little:ds.Big),i!==-1&&cn.addCustomMetadata(e,i),cn.endSchema(e)}function eD(e,t){let r=-1,n=-1,i=-1,o=t.type,s=t.typeId;z.isDictionary(o)?(s=o.dictionary.typeId,i=Rp.visit(o,e),n=Rp.visit(o.dictionary,e)):n=Rp.visit(o,e);let a=(o.children||[]).map(h=>Z.encode(e,h)),c=xr.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?xr.createCustomMetadataVector(e,[...t.metadata].map(([h,u])=>{let f=e.createString(`${h}`),d=e.createString(`${u}`);return Ce.startKeyValue(e),Ce.addKey(e,f),Ce.addValue(e,d),Ce.endKeyValue(e)})):-1;return t.name&&(r=e.createString(t.name)),xr.startField(e),xr.addType(e,n),xr.addTypeType(e,s),xr.addChildren(e,c),xr.addNullable(e,!!t.nullable),r!==-1&&xr.addName(e,r),i!==-1&&xr.addDictionary(e,i),l!==-1&&xr.addCustomMetadata(e,l),xr.endField(e)}function rD(e,t){let r=t.nodes||[],n=t.buffers||[],i=t.variadicBufferCounts||[];br.startNodesVector(e,r.length);for(let l of r.slice().reverse())Jn.encode(e,l);let o=e.endVector();br.startBuffersVector(e,n.length);for(let l of n.slice().reverse())Fe.encode(e,l);let s=e.endVector(),a=null;t.compression!==null&&(a=fA(e,t.compression));let c=-1;return i.length>0&&(c=br.createVariadicBufferCountsVector(e,i.map(BigInt))),br.startRecordBatch(e),br.addLength(e,BigInt(t.length)),br.addNodes(e,o),br.addBuffers(e,s),t.compression!==null&&a&&br.addCompression(e,a),c!==-1&&br.addVariadicBufferCounts(e,c),br.endRecordBatch(e)}function fA(e,t){return mo.startBodyCompression(e),mo.addCodec(e,t.type),mo.addMethod(e,t.method),mo.endBodyCompression(e)}function nD(e,t){let r=Ye.encode(e,t.data);return po.startDictionaryBatch(e),po.addId(e,BigInt(t.id)),po.addIsDelta(e,t.isDelta),po.addData(e,r),po.endDictionaryBatch(e)}function iD(e,t){return Sl.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function oD(e,t){return xl.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var GL,zL,Nr,Ye,Cr,Fe,Jn,Wa,sD,Fs=w(()=>{Gt();kw();Ym();Iw();h3();Ew();Vw();Tw();Km();vl();Aw();Lw();Cw();Rw();Uw();Gw();Dw();Nw();zw();Bw();Ow();Fw();X4();vw();Sw();Rr();Je();ki();Ne();Z4();aA();te();GL=La,zL=hr,Nr=class e{static fromJSON(t,r){let n=new e(0,Xt.V5,r);return n._createHeader=VL(t,r),n}static decode(t){t=new zL(nt(t));let r=Un.getRootAsMessage(t),n=r.bodyLength(),i=r.version(),o=r.headerType(),s=QL(r),a=new e(n,i,o,void 0,s);return a._createHeader=kL(r,o),a}static encode(t){let r=new GL,n=-1;t.isSchema()?n=_t.encode(r,t.header()):t.isRecordBatch()?n=Ye.encode(r,t.header()):t.isDictionaryBatch()&&(n=Cr.encode(r,t.header()));let i=t.metadata&&t.metadata.size>0?Un.createCustomMetadataVector(r,[...t.metadata].map(([o,s])=>{let a=r.createString(`${o}`),c=r.createString(`${s}`);return Ce.startKeyValue(r),Ce.addKey(r,a),Ce.addValue(r,c),Ce.endKeyValue(r)})):-1;return Un.startMessage(r),Un.addVersion(r,Xt.V5),Un.addHeader(r,n),Un.addHeaderType(r,t.headerType),Un.addBodyLength(r,BigInt(t.bodyLength)),i!==-1&&Un.addCustomMetadata(r,i),Un.finishMessageBuffer(r,Un.endMessage(r)),r.asUint8Array()}static from(t,r=0){if(t instanceof _t)return new e(0,Xt.V5,Nt.Schema,t);if(t instanceof Ye)return new e(r,Xt.V5,Nt.RecordBatch,t,t.metadata);if(t instanceof Cr)return new e(r,Xt.V5,Nt.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get compression(){return this._compression}get bodyLength(){return this._bodyLength}get metadata(){return this._metadata}header(){return this._createHeader()}isSchema(){return this.headerType===Nt.Schema}isRecordBatch(){return this.headerType===Nt.RecordBatch}isDictionaryBatch(){return this.headerType===Nt.DictionaryBatch}constructor(t,r,n,i,o){this._version=r,this._headerType=n,this.body=new Uint8Array(0),this._compression=i?.compression,i&&(this._createHeader=()=>i),this._bodyLength=It(t),this._metadata=o||new Map}},Ye=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}get compression(){return this._compression}get variadicBufferCounts(){return this._variadicBufferCounts}get metadata(){return this._metadata}constructor(t,r,n,i,o=[],s){this._nodes=r,this._buffers=n,this._length=It(t),this._compression=i,this._variadicBufferCounts=o,this._metadata=s||new Map}},Cr=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,r,n=!1){this._data=t,this._isDelta=n,this._id=It(r)}},Fe=class{constructor(t,r){this.offset=It(t),this.length=It(r)}},Jn=class{constructor(t,r){this.length=It(t),this.nullCount=It(r)}},Wa=class{constructor(t,r=Da.BUFFER){this.type=t,this.method=r}};Z.encode=eD;Z.decode=JL;Z.fromJSON=sA;_t.encode=tD;_t.decode=qL;_t.fromJSON=eA;Ye.encode=rD;Ye.decode=jL;Ye.fromJSON=__;Cr.encode=nD;Cr.decode=WL;Cr.fromJSON=rA;Jn.encode=iD;Jn.decode=$L;Fe.encode=oD;Fe.decode=HL;Wa.encode=fA;Wa.decode=uA;sD=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})()});var pe,Uu,Ha,Bp,Gu=w(()=>{an();lu();pe=Object.freeze({done:!0,value:void 0}),Uu=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Ha=class{tee(){return this._getDOMStream().tee()}pipe(t,r){return this._getNodeStream().pipe(t,r)}pipeTo(t,r){return this._getDOMStream().pipeTo(t,r)}pipeThrough(t,r){return this._getDOMStream().pipeThrough(t,r)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},Bp=class extends Ha{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return Y(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(pe);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return lr.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return lr.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return Y(this,void 0,void 0,function*(){return yield this.abort(t),pe})}return(t){return Y(this,void 0,void 0,function*(){return yield this.close(),pe})}read(t){return Y(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Y(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((r,n)=>{this.resolvers.push({resolve:r,reject:n})}):Promise.resolve(pe)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}});var Qn,ti,mn,M_,xo,Us=w(()=>{an();lu();fo();Gu();Je();fs();Qn=class extends Bp{write(t){if((t=nt(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?_l(this.toUint8Array(!0)):this.toUint8Array(!1).then(_l)}toUint8Array(t=!1){return t?In(this._values)[0]:Y(this,void 0,void 0,function*(){var r,n,i,o;let s=[],a=0;try{for(var c=!0,l=vn(this),h;h=yield l.next(),r=h.done,!r;c=!0){o=h.value,c=!1;let u=o;s.push(u),a+=u.byteLength}}catch(u){n={error:u}}finally{try{!c&&!r&&(i=l.return)&&(yield i.call(l))}finally{if(n)throw n.error}}return In(s,a)[0]})}},ti=class{constructor(t){t&&(this.source=new M_(lr.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},mn=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof Qn?this.source=new xo(lr.fromAsyncIterable(t)):zm(t)?this.source=new xo(lr.fromNodeStream(t)):su(t)?this.source=new xo(lr.fromDOMStream(t)):Um(t)?this.source=new xo(lr.fromDOMStream(t.body)):ui(t)?this.source=new xo(lr.fromIterable(t)):Tn(t)?this.source=new xo(lr.fromAsyncIterable(t)):Yn(t)&&(this.source=new xo(lr.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},M_=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,r="read"){return this.source.next({cmd:r,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||pe)}return(t){return Object.create(this.source.return&&this.source.return(t)||pe)}},xo=class{constructor(t){this.source=t,this._closedPromise=new Promise(r=>this._closedPromiseResolve=r)}cancel(t){return Y(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return Y(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Y(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return Y(this,arguments,void 0,function*(r,n="read"){return yield this.source.next({cmd:n,size:r})})}throw(t){return Y(this,void 0,void 0,function*(){let r=this.source.throw&&(yield this.source.throw(t))||pe;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}return(t){return Y(this,void 0,void 0,function*(){let r=this.source.return&&(yield this.source.return(t))||pe;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}}});var zu,Gs,b_=w(()=>{an();Us();Je();zu=class extends ti{constructor(t,r){super(),this.position=0,this.buffer=nt(t),this.size=r===void 0?this.buffer.byteLength:r}readInt32(t){let{buffer:r,byteOffset:n}=this.readAt(t,4);return new DataView(r,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:r,size:n,position:i}=this;return r&&i<n?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(n,i+Math.min(n-i,t)),r.subarray(i,this.position)):null}readAt(t,r){let n=this.buffer,i=Math.min(this.size,t+r);return n?n.subarray(t,i):new Uint8Array(r)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},Gs=class extends mn{constructor(t,r){super(),this.position=0,this._handle=t,typeof r=="number"?this.size=r:this._pending=Y(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return Y(this,void 0,void 0,function*(){let{buffer:r,byteOffset:n}=yield this.readAt(t,4);return new DataView(r,n).getInt32(0,!0)})}seek(t){return Y(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return Y(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:r,size:n,position:i}=this;if(r&&i<n){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let o=i,s=0,a=0,c=Math.min(n,o+Math.min(n-o,t)),l=new Uint8Array(Math.max(0,(this.position=c)-o));for(;(o+=a)<c&&(s+=a)<l.byteLength;)({bytesRead:a}=yield r.read(l,s,l.byteLength-s,o));return l}return null})}readAt(t,r){return Y(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:i}=this;if(n&&t+r<i){let o=Math.min(i,t+r),s=new Uint8Array(o-t);return(yield n.read(s,0,r,t)).buffer}return new Uint8Array(r)})}close(){return Y(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return Y(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return Y(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}}});var S_={};Zr(S_,{BaseInt64:()=>Vu,Int128:()=>ku,Int64:()=>So,Uint64:()=>Be});function Gl(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var zl,x_,Vu,Be,So,ku,v_=w(()=>{zl=8,x_=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],Vu=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let r=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),i=r[3]*n[3];this.buffer[0]=i&65535;let o=i>>>16;return i=r[2]*n[3],o+=i,i=r[3]*n[2]>>>0,o+=i,this.buffer[0]+=o<<16,this.buffer[1]=o>>>0<i?65536:0,this.buffer[1]+=o>>>16,this.buffer[1]+=r[1]*n[3]+r[2]*n[2]+r[3]*n[1],this.buffer[1]+=r[0]*n[3]+r[1]*n[2]+r[2]*n[1]+r[3]*n[0]<<16,this}_plus(t){let r=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],r<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=r}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${Gl(this.buffer[1])} ${Gl(this.buffer[0])}`}},Be=class e extends Vu{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,r=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let n=t.length,i=new e(r);for(let o=0;o<n;){let s=zl<n-o?zl:n-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([x_[s],0]));i.times(c),i.plus(a),o+=s}return i}static convertArray(t){let r=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+2*n*4,2));return r}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}},So=class e extends Vu{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let r=this.buffer[1]<<0,n=t.buffer[1]<<0;return r<n||r===n&&this.buffer[0]<t.buffer[0]}static from(t,r=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let n=t.startsWith("-"),i=t.length,o=new e(r);for(let s=n?1:0;s<i;){let a=zl<i-s?zl:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([x_[a],0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let r=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+2*n*4,2));return r}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}},ku=class e{constructor(t){this.buffer=t}high(){return new So(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new So(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let r=new Be(new Uint32Array([this.buffer[3],0])),n=new Be(new Uint32Array([this.buffer[2],0])),i=new Be(new Uint32Array([this.buffer[1],0])),o=new Be(new Uint32Array([this.buffer[0],0])),s=new Be(new Uint32Array([t.buffer[3],0])),a=new Be(new Uint32Array([t.buffer[2],0])),c=new Be(new Uint32Array([t.buffer[1],0])),l=new Be(new Uint32Array([t.buffer[0],0])),h=Be.multiply(o,l);this.buffer[0]=h.low();let u=new Be(new Uint32Array([h.high(),0]));return h=Be.multiply(i,l),u.plus(h),h=Be.multiply(o,c),u.plus(h),this.buffer[1]=u.low(),this.buffer[3]=u.lessThan(h)?1:0,this.buffer[2]=u.high(),new Be(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Be.multiply(n,l)).plus(Be.multiply(i,c)).plus(Be.multiply(o,a)),this.buffer[3]+=Be.multiply(r,l).plus(Be.multiply(n,c)).plus(Be.multiply(i,a)).plus(Be.multiply(o,s)).low(),this}plus(t){let r=new Uint32Array(4);return r[3]=this.buffer[3]+t.buffer[3]>>>0,r[2]=this.buffer[2]+t.buffer[2]>>>0,r[1]=this.buffer[1]+t.buffer[1]>>>0,r[0]=this.buffer[0]+t.buffer[0]>>>0,r[0]<this.buffer[0]>>>0&&++r[1],r[1]<this.buffer[1]>>>0&&++r[2],r[2]<this.buffer[2]>>>0&&++r[3],this.buffer[3]=r[3],this.buffer[2]=r[2],this.buffer[1]=r[1],this.buffer[0]=r[0],this}hex(){return`${Gl(this.buffer[3])} ${Gl(this.buffer[2])} ${Gl(this.buffer[1])} ${Gl(this.buffer[0])}`}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}static from(t,r=new Uint32Array(4)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(4)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(4)){let n=t.startsWith("-"),i=t.length,o=new e(r);for(let s=n?1:0;s<i;){let a=zl<i-s?zl:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([x_[a],0,0,0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let r=new Uint32Array(t.length*4);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+16*n,4));return r}}});var P_={};Zr(P_,{toIntervalDayTimeInt32Array:()=>E_,toIntervalDayTimeObjects:()=>I_,toIntervalMonthDayNanoInt32Array:()=>T_,toIntervalMonthDayNanoObjects:()=>A_});function E_(e){var t,r;let n=e.length,i=new Int32Array(n*2);for(let o=0,s=0;o<n;o++){let a=e[o];i[s++]=(t=a.days)!==null&&t!==void 0?t:0,i[s++]=(r=a.milliseconds)!==null&&r!==void 0?r:0}return i}function T_(e){var t,r;let n=e.length,i=new Int32Array(n*4);for(let o=0,s=0;o<n;o++){let a=e[o];i[s++]=(t=a.months)!==null&&t!==void 0?t:0,i[s++]=(r=a.days)!==null&&r!==void 0?r:0;let c=a.nanoseconds;if(c){let l=BigInt(c);i[s++]=Number(l&BigInt(4294967295))>>>0,i[s++]=Number(l>>BigInt(32))>>>0}else s+=2}return i}function I_(e){let t=e.length,r=new Array(t/2);for(let n=0,i=0;n<t;n+=2)r[i++]={days:e[n],milliseconds:e[n+1]};return r}function A_(e,t){let r=e.length,n=new Array(r/4);for(let i=0,o=0;i<r;i+=4){let s=BigInt(e[i+3])<<BigInt(32)|BigInt(e[i+2]>>>0);n[o++]={months:e[i],days:e[i+1],nanoseconds:t?`${s}`:s}}return n}var Op=w(()=>{});function mA(e){let t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2)t[r>>1]=Number.parseInt(e.slice(r,r+2),16);return t}function aD(e){return mA(e.join(""))}function pA(e,t){let r=new Uint8Array(e.length*16),n=new DataView(r.buffer);for(let[i,o]of e.entries()){let s=i*16,a=o.SIZE;if(n.setInt32(s,a,!0),o.INLINED!==void 0){let c=t(o.INLINED);for(let l=0;l<c.length&&l<12;l++)r[s+4+l]=c[l]}else{let c=o.PREFIX_HEX;for(let l=0;l<8&&l<c.length;l+=2)r[s+4+(l>>1)]=Number.parseInt(c.slice(l,l+2),16);n.setInt32(s+8,o.BUFFER_INDEX,!0),n.setInt32(s+12,o.OFFSET,!0)}}return r}function cD(e){return pA(e,t=>{let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n>>1]=Number.parseInt(t.slice(n,n+2),16);return r})}function lD(e){return pA(e,t=>new TextEncoder().encode(t))}var Vl,Lp,Dp,gA=w(()=>{Zn();Rr();te();fn();ka();fo();v_();Ne();Je();Op();Vl=class extends rt{constructor(t,r,n,i,o=Xt.V5,s=[]){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.variadicBufferIndex=-1,this.bytes=t,this.nodes=r,this.buffers=n,this.dictionaries=i,this.metadataVersion=o,this.variadicBufferCounts=s}visit(t){return super.visit(t instanceof Z?t.type:t)}visitNull(t,{length:r}=this.nextFieldNode()){return Q({type:t,length:r})}visitBool(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitUtf8View(t,{length:r,nullCount:n}=this.nextFieldNode()){let i=this.readNullBitmap(t,n),o=this.readData(t),s=this.readVariadicBuffers(this.nextVariadicBufferCount());return Q({type:t,length:r,nullCount:n,nullBitmap:i,views:o,variadicBuffers:s})}visitBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinaryView(t,{length:r,nullCount:n}=this.nextFieldNode()){let i=this.readNullBitmap(t,n),o=this.readData(t),s=this.readVariadicBuffers(this.nextVariadicBufferCount());return Q({type:t,length:r,nullCount:n,nullBitmap:i,views:o,variadicBuffers:s})}visitFixedSizeBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitLargeList(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return this.metadataVersion<Xt.V5&&this.readNullBitmap(t,n),t.mode===jt.Sparse?this.visitSparseUnion(t,{length:r,nullCount:n}):this.visitDenseUnion(t,{length:r,nullCount:n})}visitDenseUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDuration(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),child:this.visit(t.children[0])})}visitMap(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,r,n=this.nextBufferRange()){return r>0&&this.readData(t,n)||new Uint8Array(0)}readOffsets(t,r){return this.readData(t,r)}readTypeIds(t,r){return this.readData(t,r)}readData(t,{length:r,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+r)}readVariadicBuffers(t){return Array.from({length:t},()=>this.readData(null))}nextVariadicBufferCount(){var t;return(t=this.variadicBufferCounts[++this.variadicBufferIndex])!==null&&t!==void 0?t:0}readDictionary(t){return this.dictionaries.get(t.id)}},Lp=class extends Vl{constructor(t,r,n,i,o,s=[]){super(new Uint8Array(0),r,n,i,o,s),this.sources=t}readNullBitmap(t,r,{offset:n}=this.nextBufferRange()){return r<=0?new Uint8Array(0):Va(this.sources[n])}readOffsets(t,{offset:r}=this.nextBufferRange()){return Tt(Uint8Array,Tt(t.OffsetArrayType,this.sources[r]))}readTypeIds(t,{offset:r}=this.nextBufferRange()){return Tt(Uint8Array,Tt(t.ArrayType,this.sources[r]))}readData(t,{offset:r}=this.nextBufferRange()){let{sources:n}=this;if(z.isTimestamp(t))return Tt(Uint8Array,So.convertArray(n[r]));if((z.isInt(t)||z.isTime(t))&&t.bitWidth===64||z.isDuration(t))return Tt(Uint8Array,So.convertArray(n[r]));if(z.isDate(t)&&t.unit===Qt.MILLISECOND)return Tt(Uint8Array,So.convertArray(n[r]));if(z.isDecimal(t))return Tt(Uint8Array,ku.convertArray(n[r]));if(z.isBinary(t)||z.isLargeBinary(t)||z.isFixedSizeBinary(t))return aD(n[r]);if(z.isBinaryView(t))return cD(n[r]);if(z.isUtf8View(t))return lD(n[r]);if(z.isBool(t))return Va(n[r]);if(z.isUtf8(t)||z.isLargeUtf8(t))return En(n[r].join(""));if(z.isInterval(t))switch(t.unit){case Lt.DAY_TIME:return E_(n[r]);case Lt.MONTH_DAY_NANO:return T_(n[r]);default:break}return Tt(Uint8Array,Tt(t.ArrayType,n[r].map(i=>+i)))}readVariadicBuffers(t){let r=[];for(let n=0;n<t;n++){let{offset:i}=this.nextBufferRange(),o=this.sources[i];r.push(mA(o))}return r}};Dp=class extends Vl{constructor(t,r,n,i,o,s=[]){super(new Uint8Array(0),r,n,i,o,s),this.bodyChunks=t}readData(t,r=this.nextBufferRange()){return this.bodyChunks[this.buffersIndex]}}});var vo,Fp=w(()=>{Si();me();Je();vo=class extends Pr{constructor(t){super(t),this._values=new dn(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,nt(r))}_flushPending(t,r){let n=this._offsets,i=this._values.reserve(r).buffer,o=0;for(let[s,a]of t)if(a===void 0)n.set(s,0);else{let c=a.length;i.set(a,o),n.set(s,c),o+=c}}}});var Eo,Up=w(()=>{Je();Si();me();Eo=class extends Pr{constructor(t){super(t),this._values=new dn(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,nt(r))}_flushPending(t,r){let n=this._offsets,i=this._values.reserve(r).buffer,o=0;for(let[s,a]of t)if(a===void 0)n.set(s,BigInt(0));else{let c=a.length;i.set(a,o),n.set(s,BigInt(c)),o+=c}}}});var $a,R_=w(()=>{Si();me();$a=class extends oe{constructor(t){super(t),this._values=new Ul}setValue(t,r){this._values.set(t,+r)}}});var $i,zs,Vs,C_=w(()=>{me();Dn();$i=class extends $e{};$i.prototype._setValue=Zw;zs=class extends $i{};zs.prototype._setValue=Qm;Vs=class extends $i{};Vs.prototype._setValue=tp});var ks,N_=w(()=>{me();Dn();ks=class extends $e{};ks.prototype._setValue=t_});var Ya,B_=w(()=>{te();me();qu();Ya=class extends oe{constructor({type:t,nullValues:r,dictionaryHashFunction:n}){super({type:new We(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Ei({type:this.type.indices,nullValues:r}),this.dictionary=Ei({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,r){let n=this.indices;return r=n.setValid(t,r),this.length=n.length,r}setValue(t,r){let n=this._keysToIndices,i=this.valueToKey(r),o=n[i];return o===void 0&&(n[i]=o=this._dictionaryOffset+this.dictionary.append(r).length-1),this.indices.setValue(t,o)}flush(){let t=this.type,r=this._dictionary,n=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=r?r.concat(n):n,this.finished||(this._dictionaryOffset+=n.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}}});var qs,O_=w(()=>{me();Dn();qs=class extends $e{};qs.prototype._setValue=Xw});var Ka,L_=w(()=>{Rr();me();te();Ka=class extends oe{setValue(t,r){let[n]=this.children,i=t*this.stride;for(let o=-1,s=this.stride;++o<s;)n.set(i+o,r[o])}setValid(t,r){return super.setValid(t,r)||this.children[0].setValid((t+1)*this.stride-1,!1),r}addChild(t,r="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let n=this.children.push(t);return this.type=new _e(this.type.listSize,new Z(r,t.type,!0)),n}}});var Yi,Xa,Za,Ja,D_=w(()=>{Nu();me();Yi=class extends $e{setValue(t,r){this._values.set(t,r)}},Xa=class extends Yi{setValue(t,r){super.setValue(t,Cu(r))}},Za=class extends Yi{},Ja=class extends Yi{}});var Ti,js,Ws,Hs,F_=w(()=>{me();Dn();Ti=class extends $e{};Ti.prototype._setValue=e_;js=class extends Ti{};js.prototype._setValue=lp;Ws=class extends Ti{};Ws.prototype._setValue=hp;Hs=class extends Ti{};Hs.prototype._setValue=up});var ei,$s,Ys,Ks,Xs,U_=w(()=>{me();Dn();ei=class extends $e{};ei.prototype._setValue=r_;$s=class extends ei{};$s.prototype._setValue=fp;Ys=class extends ei{};Ys.prototype._setValue=dp;Ks=class extends ei{};Ks.prototype._setValue=mp;Xs=class extends ei{};Xs.prototype._setValue=pp});var $r,Qa,tc,ec,rc,nc,ic,oc,sc,G_=w(()=>{me();$r=class extends $e{setValue(t,r){this._values.set(t,r)}},Qa=class extends $r{},tc=class extends $r{},ec=class extends $r{},rc=class extends $r{},nc=class extends $r{},ic=class extends $r{},oc=class extends $r{},sc=class extends $r{}});var ac,z_=w(()=>{Rr();te();Si();me();ac=class extends Pr{constructor(t){super(t),this._offsets=new Ds(t.type)}addChild(t,r="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new je(new Z(r,t.type,!0)),this.numChildren-1}_flushPending(t){let r=this._offsets,[n]=this.children;for(let[i,o]of t)if(typeof o>"u")r.set(i,0);else{let s=o,a=s.length,c=r.set(i,a).buffer[i];for(let l=-1;++l<a;)n.set(c+l,s[l])}}}});var cc,V_=w(()=>{Rr();te();Si();ki();me();cc=class extends Pr{constructor(t){super(t),this._offsets=new Ds(t.type)}addChild(t,r="0"){if(this.numChildren>0)throw new Error("LargeListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new On(new Z(r,t.type,!0)),this.numChildren-1}_flushPending(t){let r=this._offsets,[n]=this.children;for(let[i,o]of t)if(typeof o>"u")r.set(i,BigInt(0));else{let s=o,a=s.length,c=It(r.set(i,BigInt(a)).buffer[i]);for(let l=-1;++l<a;)n.set(c+l,s[l])}}}});var lc,k_=w(()=>{Rr();te();me();lc=class extends Pr{set(t,r){return super.set(t,r)}setValue(t,r){let n=r instanceof Map?r:new Map(Object.entries(r)),i=this._pending||(this._pending=new Map),o=i.get(t);o&&(this._pendingLength-=o.size),this._pendingLength+=n.size,i.set(t,n)}addChild(t,r=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Ir(new Z(r,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let r=this._offsets,[n]=this.children;for(let[i,o]of t)if(o===void 0)r.set(i,0);else{let{[i]:s,[i+1]:a}=r.set(i,o.size).buffer;for(let c of o.entries())if(n.set(s,c),++s>=a)break}}}});var hc,q_=w(()=>{me();hc=class extends oe{setValue(t,r){}setValid(t,r){return this.length=Math.max(t+1,this.length),r}}});var uc,j_=w(()=>{Rr();me();te();uc=class extends oe{setValue(t,r){let{children:n,type:i}=this;switch(Array.isArray(r)||r.constructor){case!0:return i.children.forEach((o,s)=>n[s].set(t,r[s]));case Map:return i.children.forEach((o,s)=>n[s].set(t,r.get(o.name)));default:return i.children.forEach((o,s)=>n[s].set(t,r[o.name]))}}setValid(t,r){return super.setValid(t,r)||this.children.forEach(n=>n.setValid(t,r)),r}addChild(t,r=`${this.numChildren}`){let n=this.children.push(t);return this.type=new Yt([...this.type.children,new Z(r,t.type,!0)]),n}}});var ri,Zs,Js,Qs,ta,W_=w(()=>{me();Dn();ri=class extends $e{};ri.prototype._setValue=Jw;Zs=class extends ri{};Zs.prototype._setValue=ep;Js=class extends ri{};Js.prototype._setValue=rp;Qs=class extends ri{};Qs.prototype._setValue=np;ta=class extends ri{};ta.prototype._setValue=ip});var ni,ea,ra,na,ia,H_=w(()=>{me();Dn();ni=class extends $e{};ni.prototype._setValue=Qw;ea=class extends ni{};ea.prototype._setValue=op;ra=class extends ni{};ra.prototype._setValue=sp;na=class extends ni{};na.prototype._setValue=ap;ia=class extends ni{};ia.prototype._setValue=cp});var To,fc,dc,$_=w(()=>{Rr();Si();me();te();To=class extends oe{constructor(t){super(t),this._typeIds=new Mo(Int8Array,0,1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,r){return this.set(this.length,t,r)}set(t,r,n){return n===void 0&&(n=this._valueToChildTypeId(this,r,t)),this.setValue(t,r,n),this}setValue(t,r,n){this._typeIds.set(t,n);let i=this.type.typeIdToChildIndex[n],o=this.children[i];o?.set(t,r),this.length=Math.max(t+1,this.length)}addChild(t,r=`${this.children.length}`){let n=this.children.push(t),{type:{children:i,mode:o,typeIds:s}}=this,a=[...i,new Z(r,t.type)];return this.type=new Hr(o,[...s,n],a),n}_valueToChildTypeId(t,r,n){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},fc=class extends To{},dc=class extends To{constructor(t){super(t),this._offsets=new Mo(Int32Array)}setValue(t,r,n){let i=this._typeIds.set(t,n).buffer[t],o=this.getChildAt(this.type.typeIdToChildIndex[i]),s=this._offsets.set(t,o.length).buffer[t];o?.set(s,r),this.length=Math.max(t+1,this.length)}}});var oa,Y_=w(()=>{fo();Fp();Si();me();oa=class extends Pr{constructor(t){super(t),this._values=new dn(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,En(r))}_flushPending(t,r){}};oa.prototype._flushPending=vo.prototype._flushPending});var sa,K_=w(()=>{fo();Si();me();Up();sa=class extends Pr{constructor(t){super(t),this._values=new dn(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,En(r))}_flushPending(t,r){}};sa.prototype._flushPending=Eo.prototype._flushPending});var Io,Gp=w(()=>{te();me();Si();Je();Zn();Io=class extends oe{constructor(t){super(t),this._variadicBuffers=[],this._currentBuffer=null,this._currentBufferIndex=0,this._currentBufferOffset=0,this._bufferSize=32*1024*1024,this._views=new dn(Uint8Array)}get byteLength(){let t=0;this._views&&(t+=this._views.byteLength),this._nulls&&(t+=this._nulls.byteLength);for(let r of this._variadicBuffers)t+=r.byteLength;return this._currentBuffer&&(t+=this._currentBuffer.byteLength),t}setValue(t,r){return this.writeBinaryValue(t,this.encodeValue(r))}writeBinaryValue(t,r){let n=r.length,i=(t+1)*Mt.ELEMENT_WIDTH,o=this._views.length;i>o&&this._views.reserve(i-o);let s=this._views.buffer,a=t*Mt.ELEMENT_WIDTH,c=new DataView(s.buffer,s.byteOffset+a,Mt.ELEMENT_WIDTH);if(c.setInt32(Mt.LENGTH_OFFSET,n,!0),n<=Mt.INLINE_CAPACITY){s.set(r,a+Mt.INLINE_OFFSET);for(let l=n;l<Mt.INLINE_CAPACITY;l++)s[a+Mt.INLINE_OFFSET+l]=0}else{let l=new DataView(r.buffer,r.byteOffset,Math.min(4,n));c.setUint32(Mt.INLINE_OFFSET,l.getUint32(0,!0),!0),(!this._currentBuffer||this._currentBufferOffset+n>this._bufferSize)&&(this._currentBuffer&&this._variadicBuffers.push(this._currentBuffer.buffer.slice(0,this._currentBufferOffset)),this._currentBuffer=new dn(Uint8Array),this._currentBufferIndex=this._variadicBuffers.length,this._currentBufferOffset=0),this._currentBuffer.reserve(n).buffer.set(r,this._currentBufferOffset),c.setInt32(Mt.BUFFER_INDEX_OFFSET,this._currentBufferIndex,!0),c.setInt32(Mt.BUFFER_OFFSET_OFFSET,this._currentBufferOffset,!0),this._currentBufferOffset+=n}return this}encodeValue(t){return nt(t)}setValid(t,r){let n=(t+1)*Mt.ELEMENT_WIDTH,i=this._views.length;n>i&&this._views.reserve(n-i);let o=super.setValid(t,r);if(!o){let s=this._views.buffer,a=t*Mt.ELEMENT_WIDTH;for(let c=0;c<Mt.ELEMENT_WIDTH;c++)s[a+c]=0}return o}clear(){return this._variadicBuffers=[],this._currentBuffer=null,this._currentBufferIndex=0,this._currentBufferOffset=0,this._views.clear(),super.clear()}flush(){let{type:t,length:r,nullCount:n,_views:i,_nulls:o}=this;this._currentBuffer&&this._currentBufferOffset>0&&(this._variadicBuffers.push(this._currentBuffer.buffer.slice(0,this._currentBufferOffset)),this._currentBuffer=null,this._currentBufferOffset=0);let s=i.flush(r*Mt.ELEMENT_WIDTH),a=n>0?o.flush(r):void 0,c=this._variadicBuffers.slice();return this._variadicBuffers=[],this._currentBufferIndex=0,this.clear(),Q({type:t,length:r,nullCount:n,nullBitmap:a,views:s,variadicBuffers:c})}finish(){return this.finished=!0,this}}});var mc,X_=w(()=>{Gp();fo();mc=class extends Io{constructor(t){super(t)}setValue(t,r){return this.writeBinaryValue(t,En(r))}}});var Z_,yA,wA=w(()=>{fn();Fp();Up();R_();C_();N_();B_();O_();L_();D_();F_();U_();G_();z_();V_();k_();q_();j_();W_();H_();$_();Y_();K_();Gp();X_();Z_=class extends rt{visitNull(){return hc}visitBool(){return $a}visitInt(){return $r}visitInt8(){return Qa}visitInt16(){return tc}visitInt32(){return ec}visitInt64(){return rc}visitUint8(){return nc}visitUint16(){return ic}visitUint32(){return oc}visitUint64(){return sc}visitFloat(){return Yi}visitFloat16(){return Xa}visitFloat32(){return Za}visitFloat64(){return Ja}visitUtf8(){return oa}visitLargeUtf8(){return sa}visitBinary(){return vo}visitLargeBinary(){return Eo}visitFixedSizeBinary(){return qs}visitDate(){return $i}visitDateDay(){return zs}visitDateMillisecond(){return Vs}visitTimestamp(){return ri}visitTimestampSecond(){return Zs}visitTimestampMillisecond(){return Js}visitTimestampMicrosecond(){return Qs}visitTimestampNanosecond(){return ta}visitTime(){return ni}visitTimeSecond(){return ea}visitTimeMillisecond(){return ra}visitTimeMicrosecond(){return na}visitTimeNanosecond(){return ia}visitDecimal(){return ks}visitList(){return ac}visitLargeList(){return cc}visitStruct(){return uc}visitUnion(){return To}visitDenseUnion(){return dc}visitSparseUnion(){return fc}visitDictionary(){return Ya}visitInterval(){return Ti}visitIntervalDayTime(){return js}visitIntervalYearMonth(){return Ws}visitIntervalMonthDayNano(){return Hs}visitDuration(){return ei}visitDurationSecond(){return $s}visitDurationMillisecond(){return Ys}visitDurationMicrosecond(){return Ks}visitDurationNanosecond(){return Xs}visitFixedSizeList(){return Ka}visitMap(){return lc}visitBinaryView(){return Io}visitUtf8View(){return mc}},yA=new Z_});function Yr(e,t){return t instanceof e.constructor}function Ao(e,t){return e===t||Yr(e,t)}function Po(e,t){return e===t||Yr(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function zp(e,t){return e===t||Yr(e,t)&&e.precision===t.precision}function hD(e,t){return e===t||Yr(e,t)&&e.byteWidth===t.byteWidth}function J_(e,t){return e===t||Yr(e,t)&&e.unit===t.unit}function ju(e,t){return e===t||Yr(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function Wu(e,t){return e===t||Yr(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function _A(e,t){return e===t||Yr(e,t)&&e.children.length===t.children.length&&Ki.compareManyFields(e.children,t.children)}function uD(e,t){return e===t||Yr(e,t)&&e.children.length===t.children.length&&Ki.compareManyFields(e.children,t.children)}function Q_(e,t){return e===t||Yr(e,t)&&e.mode===t.mode&&e.typeIds.every((r,n)=>r===t.typeIds[n])&&Ki.compareManyFields(e.children,t.children)}function fD(e,t){return e===t||Yr(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&Ki.visit(e.indices,t.indices)&&Ki.visit(e.dictionary,t.dictionary)}function Vp(e,t){return e===t||Yr(e,t)&&e.unit===t.unit}function Hu(e,t){return e===t||Yr(e,t)&&e.unit===t.unit}function dD(e,t){return e===t||Yr(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&Ki.compareManyFields(e.children,t.children)}function mD(e,t){return e===t||Yr(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&Ki.compareManyFields(e.children,t.children)}function pc(e,t){return Ki.compareSchemas(e,t)}function MA(e,t){return Ki.compareFields(e,t)}function kp(e,t){return Ki.visit(e,t)}var at,Ki,$u=w(()=>{fn();at=class extends rt{compareSchemas(t,r){return t===r||r instanceof t.constructor&&this.compareManyFields(t.fields,r.fields)}compareManyFields(t,r){return t===r||Array.isArray(t)&&Array.isArray(r)&&t.length===r.length&&t.every((n,i)=>this.compareFields(n,r[i]))}compareFields(t,r){return t===r||r instanceof t.constructor&&t.name===r.name&&t.nullable===r.nullable&&this.visit(t.type,r.type)}};at.prototype.visitNull=Ao;at.prototype.visitBool=Ao;at.prototype.visitInt=Po;at.prototype.visitInt8=Po;at.prototype.visitInt16=Po;at.prototype.visitInt32=Po;at.prototype.visitInt64=Po;at.prototype.visitUint8=Po;at.prototype.visitUint16=Po;at.prototype.visitUint32=Po;at.prototype.visitUint64=Po;at.prototype.visitFloat=zp;at.prototype.visitFloat16=zp;at.prototype.visitFloat32=zp;at.prototype.visitFloat64=zp;at.prototype.visitUtf8=Ao;at.prototype.visitLargeUtf8=Ao;at.prototype.visitUtf8View=Ao;at.prototype.visitBinary=Ao;at.prototype.visitLargeBinary=Ao;at.prototype.visitBinaryView=Ao;at.prototype.visitFixedSizeBinary=hD;at.prototype.visitDate=J_;at.prototype.visitDateDay=J_;at.prototype.visitDateMillisecond=J_;at.prototype.visitTimestamp=ju;at.prototype.visitTimestampSecond=ju;at.prototype.visitTimestampMillisecond=ju;at.prototype.visitTimestampMicrosecond=ju;at.prototype.visitTimestampNanosecond=ju;at.prototype.visitTime=Wu;at.prototype.visitTimeSecond=Wu;at.prototype.visitTimeMillisecond=Wu;at.prototype.visitTimeMicrosecond=Wu;at.prototype.visitTimeNanosecond=Wu;at.prototype.visitDecimal=Ao;at.prototype.visitList=_A;at.prototype.visitLargeList=_A;at.prototype.visitStruct=uD;at.prototype.visitUnion=Q_;at.prototype.visitDenseUnion=Q_;at.prototype.visitSparseUnion=Q_;at.prototype.visitDictionary=fD;at.prototype.visitInterval=Vp;at.prototype.visitIntervalDayTime=Vp;at.prototype.visitIntervalYearMonth=Vp;at.prototype.visitIntervalMonthDayNano=Vp;at.prototype.visitDuration=Hu;at.prototype.visitDurationSecond=Hu;at.prototype.visitDurationMillisecond=Hu;at.prototype.visitDurationMicrosecond=Hu;at.prototype.visitDurationNanosecond=Hu;at.prototype.visitFixedSizeList=dD;at.prototype.visitMap=mD;Ki=new at});function Ei(e){let t=e.type,r=new(yA.getVisitFn(t)())(e);if(t.children&&t.children.length>0){let n=e.children||[],i={nullValues:e.nullValues},o=Array.isArray(n)?((s,a)=>n[a]||i):(({name:s})=>n[s]||i);for(let[s,a]of t.children.entries()){let{type:c}=a,l=o(a,s);r.children.push(Ei(Object.assign(Object.assign({},l),{type:c})))}}return r}function kl(e,t){if(e instanceof ut||e instanceof $||e.type instanceof z||ArrayBuffer.isView(e))return Hi(e);let r={type:t??qp(e),nullValues:[null]},n=[...jp(r)(e)],i=n.length===1?n[0]:n.reduce((o,s)=>o.concat(s));return z.isDictionary(i.type)?i.memoize():i}function tM(e){let t=kl(e),r=new Zt(new _t(t.type.children),t.data[0]);return new ce(r)}function qp(e){if(e.length===0)return new De;let t=0,r=0,n=0,i=0,o=0,s=0,a=0,c=0;for(let l of e){if(l==null){++t;continue}switch(typeof l){case"bigint":++s;continue;case"boolean":++a;continue;case"number":++i;continue;case"string":++o;continue;case"object":Array.isArray(l)?++r:Object.prototype.toString.call(l)==="[object Date]"?++c:++n;continue}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}if(i+t===e.length)return new Bn;if(o+t===e.length)return new We(new vr,new Ve);if(s+t===e.length)return new Rn;if(a+t===e.length)return new Er;if(c+t===e.length)return new qi;if(r+t===e.length){let l=e,h=qp(l[l.findIndex(u=>u!=null)]);if(l.every(u=>u==null||kp(h,qp(u))))return new je(new Z("",h,!0))}else if(n+t===e.length){let l=new Map;for(let h of e)for(let u of Object.keys(h))!l.has(u)&&h[u]!=null&&l.set(u,new Z(u,qp([h[u]]),!0));return new Yt([...l.values()])}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}function jp(e){let{["queueingStrategy"]:t="count"}=e,{["highWaterMark"]:r=t!=="bytes"?Number.POSITIVE_INFINITY:Math.pow(2,14)}=e,n=t!=="bytes"?"length":"byteLength";return function*(i){let o=0,s=Ei(e);for(let a of i)s.append(a)[n]>=r&&++o&&(yield s.toVector());(s.finish().length>0||o===0)&&(yield s.toVector())}}function eM(e){let{["queueingStrategy"]:t="count"}=e,{["highWaterMark"]:r=t!=="bytes"?Number.POSITIVE_INFINITY:Math.pow(2,14)}=e,n=t!=="bytes"?"length":"byteLength";return function(i){return Gr(this,arguments,function*(){var o,s,a,c;let l=0,h=Ei(e);try{for(var u=!0,f=vn(i),d;d=yield wt(f.next()),o=d.done,!o;u=!0){c=d.value,u=!1;let m=c;h.append(m)[n]>=r&&++l&&(yield yield wt(h.toVector()))}}catch(m){s={error:m}}finally{try{!u&&!o&&(a=f.return)&&(yield wt(a.call(f)))}finally{if(s)throw s.error}}(h.finish().length>0||l===0)&&(yield yield wt(h.toVector()))})}}var qu=w(()=>{an();Rr();te();Zn();Ar();wA();gc();Ro();$u()});function Wp(e,t){return pD(e,t.map(r=>r.data.concat()))}function pD(e,t){let r=[...e.fields],n=[],i={numBatches:t.reduce((u,f)=>Math.max(u,f.length),0)},o=0,s=0,a=-1,c=t.length,l,h=[];for(;i.numBatches-- >0;){for(s=Number.POSITIVE_INFINITY,a=-1;++a<c;)h[a]=l=t[a].shift(),s=Math.min(s,l?l.length:s);Number.isFinite(s)&&(h=gD(r,s,h,t,i),s>0&&(n[o++]=Q({type:new Yt(r),length:s,nullCount:0,children:h.slice()})))}return[e=e.assign(r),n.map(u=>new Zt(e,u))]}function gD(e,t,r,n,i){var o;let s=(t+63&-64)>>3;for(let a=-1,c=n.length;++a<c;){let l=r[a],h=l?.length;if(h>=t)h===t?r[a]=l:(r[a]=l.slice(0,t),i.numBatches=Math.max(i.numBatches,n[a].unshift(l.slice(t,h-t))));else{let u=e[a];e[a]=u.clone({nullable:!0}),r[a]=(o=l?._changeLengthAndBackfillNullBitmap(t))!==null&&o!==void 0?o:Q({type:u.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return r}var bA=w(()=>{Zn();te();Ro()});function rM(e){let t={},r=Object.entries(e);for(let[n,i]of r)t[n]=Hi(i);return new ce(t)}function nM(e){let t={},r=Object.entries(e);for(let[n,i]of r)t[n]=kl(i);return new ce(t)}var xA,SA,ce,gc=w(()=>{Ne();Zn();qu();Ar();Rr();te();$u();bA();Ep();Ua();Dn();Tp();Ip();Ol();Ro();SA=Symbol.for("apache-arrow/Table"),ce=class e{static isTable(t){return t?.[SA]===!0}constructor(...t){var r,n;if(t.length===0)return this.batches=[],this.schema=new _t([]),this._offsets=[0],this;let i,o;t[0]instanceof _t&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(o=t.pop());let s=c=>{if(c){if(c instanceof Zt)return[c];if(c instanceof e)return c.batches;if(c instanceof ut){if(c.type instanceof Yt)return[new Zt(new _t(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(l=>s(l));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(l=>s(l));if(typeof c=="object"){let l=Object.keys(c),h=l.map(d=>new $([c[d]])),u=i??new _t(l.map((d,m)=>new Z(String(d),h[m].type,h[m].nullable))),[,f]=Wp(u,h);return f.length===0?[new Zt(c)]:f}}}return[]},a=t.flatMap(c=>s(c));if(i=(n=i??((r=a[0])===null||r===void 0?void 0:r.schema))!==null&&n!==void 0?n:new _t([]),!(i instanceof _t))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof Zt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!pc(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??bp(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,r)=>t+r.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=Mp(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(Ga(t,this.numRows))}set(t,r){}indexOf(t,r){return-1}[Symbol.iterator](){return this.batches.length>0?Fl.visit(new $(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
16
16
  ${this.toArray().join(`,
17
17
  `)}
18
- ]`}concat(...t){let r=this.schema,n=this.data.concat(t.flatMap(({data:i})=>i));return new e(r,n.map(i=>new Zt(r,i)))}slice(t,r){let n=this.schema;[t,r]=Bu({length:this.numRows},t,r);let i=xp(this.data,this._offsets,t,r);return new e(n,i.map(o=>new Zt(n,o)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(r=>r.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let r=this.data.map(n=>n.children[t]);if(r.length===0){let{type:n}=this.schema.fields[t],i=Q({type:n,length:0,nullCount:0});r.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new $(r)}return null}setChild(t,r){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),r)}setChildAt(t,r){let n=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){r||(r=new $([Q({type:new De,length:this.numRows})]));let o=n.fields.slice(),s=o[t].clone({type:r.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[o[t],a[t]]=[s,r],[n,i]=Wp(n,a)}return new e(n,i)}select(t){let r=this.schema.fields.reduce((n,i,o)=>n.set(i.name,o),new Map);return this.selectAt(t.map(n=>r.get(n)).filter(n=>n>-1))}selectAt(t){let r=this.schema.selectAt(t),n=this.batches.map(i=>i.selectAt(t));return new e(r,n)}assign(t){let r=this.schema.fields,[n,i]=t.schema.fields.reduce((a,c,l)=>{let[h,u]=a,f=r.findIndex(d=>d.name===c.name);return~f?u[f]=l:h.push(l),a},[[],[]]),o=this.schema.assign(t.schema),s=[...r.map((a,c)=>[c,i[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...n.map(a=>t.getChildAt(a))].filter(Boolean);return new e(...Wp(o,s))}};TA=Symbol.toStringTag;ce[TA]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e[IA]=!0,e.isValid=Dl(Fu),e.get=Dl(He.getVisitFn(x.Struct)),e.set=Sp(mr.getVisitFn(x.Struct)),e.indexOf=vp(qa.getVisitFn(x.Struct)),"Table"))(ce.prototype);Object.defineProperty(ce,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===ce&&ce.isTable(t)}})});function AA(e,t,r=t.reduce((n,i)=>Math.max(n,i.length),0)){var n;let i=[...e.fields],o=[...t],s=(r+63&-64)>>3;for(let[a,c]of e.fields.entries()){let l=t[a];(!l||l.length!==r)&&(i[a]=c.clone({nullable:!0}),o[a]=(n=l?._changeLengthAndBackfillNullBitmap(r))!==null&&n!==void 0?n:Q({type:c.type,length:r,nullCount:r,nullBitmap:new Uint8Array(s)}))}return[e.assign(i),Q({type:new Yt(i),length:r,children:o})]}function CA(e,t,r=new Map){var n,i;if(((n=e?.length)!==null&&n!==void 0?n:0)>0&&e?.length===t?.length)for(let o=-1,s=e.length;++o<s;){let{type:a}=e[o],c=t[o];for(let l of[c,...((i=c?.dictionary)===null||i===void 0?void 0:i.data)||[]])CA(a.children,l?.children,r);if(z.isDictionary(a)){let{id:l}=a;if(!r.has(l))c?.dictionary&&r.set(l,c.dictionary);else if(r.get(l)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return r}var PA,RA,Zt,yc,Ro=w(()=>{Zn();gc();Ar();Rr();te();Bl();Ua();Dn();Tp();Ip();RA=Symbol.for("apache-arrow/RecordBatch"),Zt=class e{static isRecordBatch(t){return t?.[RA]===!0}constructor(...t){switch(t.length){case 3:case 2:{if([this.schema]=t,!(this.schema instanceof _t))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=Q({nullCount:0,type:new Yt(this.schema.fields),children:this.schema.fields.map(r=>Q({type:r.type,nullCount:0}))}),this._metadata=new Map]=t,!(this.data instanceof ut))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=AA(this.schema,this.data.children,this.data.length);break}case 1:{let[r]=t,{fields:n,children:i,length:o}=Object.keys(r).reduce((c,l,h)=>(c.children[h]=r[l],c.length=Math.max(c.length,r[l].length),c.fields[h]=Z.new({name:l,type:r[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new _t(n),a=Q({type:new Yt(n),length:o,children:i,nullCount:0});[this.schema,this.data]=AA(s,a.children,o),this._metadata=new Map;break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get metadata(){return this._metadata}get dictionaries(){return this._dictionaries||(this._dictionaries=CA(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return He.visit(this.data,t)}at(t){return this.get(Ga(t,this.numRows))}set(t,r){return mr.visit(this.data,t,r)}indexOf(t,r){return qa.visit(this.data,t,r)}[Symbol.iterator](){return Fl.visit(new $([this.data]))}toArray(){return[...this]}concat(...t){return new ce(this.schema,[this,...t])}slice(t,r){let[n]=new $([this.data]).slice(t,r).data;return new e(this.schema,n,this._metadata)}getChild(t){var r;return this.getChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new $([this.data.children[t]]):null}setChild(t,r){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),r)}setChildAt(t,r){let n=this.schema,i=this.data;if(t>-1&&t<this.numCols){r||(r=new $([Q({type:new De,length:this.numRows})]));let o=n.fields.slice(),s=i.children.slice(),a=o[t].clone({type:r.type});[o[t],s[t]]=[a,r.data[0]],n=new _t(o,new Map(this.schema.metadata)),i=Q({type:new Yt(o),length:i.length,children:s})}return new e(n,i,this._metadata)}select(t){let r=this.schema.select(t),n=new Yt(r.fields),i=[];for(let o of t){let s=this.schema.fields.findIndex(a=>a.name===o);~s&&(i[s]=this.data.children[s])}return new e(r,Q({type:n,length:this.numRows,children:i}),this._metadata)}selectAt(t){let r=this.schema.selectAt(t),n=t.map(o=>this.data.children[o]).filter(Boolean),i=Q({type:new Yt(r.fields),length:this.numRows,children:n});return new e(r,i,this._metadata)}};PA=Symbol.toStringTag;Zt[PA]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e[RA]=!0,"RecordBatch"))(Zt.prototype);Object.defineProperty(Zt,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===Zt&&Zt.isRecordBatch(t)}});yc=class extends Zt{constructor(t,r){let n=t.fields.map(o=>Q({type:o.type})),i=Q({type:new Yt(t.fields),length:0,nullCount:0,children:n});super(t,i,r||new Map)}}});function $p(e,t=0){for(let r=-1,n=ql.length;++r<n;)if(ql[r]!==e[t+r])return!1;return!0}var cM,lM,NA,OA,aa,wc,_c,Hp,aM,ql,jl,hM,BA,Yp=w(()=>{an();Ne();Gt();Fs();fs();v_();Je();Us();Gu();cM=e=>`Expected ${Nt[e]} Message in stream, but was null or length 0.`,lM=e=>`Header pointer of flatbuffer-encoded ${Nt[e]} Message is null or length 0.`,NA=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,OA=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,aa=class{constructor(t){this.source=t instanceof ti?t:new ti(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?pe:t.value===-1&&(t=this.readMetadataLength()).done?pe:(t=this.readMetadata(t.value)).done?pe:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(cM(t));return r.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let r=nt(this.source.read(t));if(r.byteLength<t)throw new Error(OA(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()}readSchema(t=!1){let r=Nt.Schema,n=this.readMessage(r),i=n?.header();if(t&&!i)throw new Error(lM(r));return i}readMetadataLength(){let t=this.source.read(Hp),r=t&&new hr(t),n=r?.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(t){let r=this.source.read(t);if(!r)return pe;if(r.byteLength<t)throw new Error(NA(t,r.byteLength));return{done:!1,value:Nr.decode(r)}}},wc=class{constructor(t,r){this.source=t instanceof mn?t:Fm(t)?new Gs(t,r):new mn(t)}[Symbol.asyncIterator](){return this}next(){return Y(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?pe:t.value===-1&&(t=yield this.readMetadataLength()).done?pe:(t=yield this.readMetadata(t.value)).done?pe:t})}throw(t){return Y(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return Y(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return Y(this,void 0,void 0,function*(){let r;if((r=yield this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(cM(t));return r.value})}readMessageBody(t){return Y(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let r=nt(yield this.source.read(t));if(r.byteLength<t)throw new Error(OA(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()})}readSchema(){return Y(this,arguments,void 0,function*(t=!1){let r=Nt.Schema,n=yield this.readMessage(r),i=n?.header();if(t&&!i)throw new Error(lM(r));return i})}readMetadataLength(){return Y(this,void 0,void 0,function*(){let t=yield this.source.read(Hp),r=t&&new hr(t),n=r?.readInt32(0)||0;return{done:n===0,value:n}})}readMetadata(t){return Y(this,void 0,void 0,function*(){let r=yield this.source.read(t);if(!r)return pe;if(r.byteLength<t)throw new Error(NA(t,r.byteLength));return{done:!1,value:Nr.decode(r)}})}},_c=class extends aa{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Uu?t:new Uu(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:Nr.fromJSON(t.schema,Nt.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let r=t.dictionaries[this._dictionaryIndex++];return this._body=r.data.columns,{done:!1,value:Nr.fromJSON(r,Nt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let r=t.batches[this._batchIndex++];return this._body=r.columns,{done:!1,value:Nr.fromJSON(r,Nt.RecordBatch)}}return this._body=[],pe}readMessageBody(t){return r(this._body);function r(n){return(n||[]).reduce((i,o)=>[...i,...o.VALIDITY&&[o.VALIDITY]||[],...o.TYPE_ID&&[o.TYPE_ID]||[],...o.OFFSET&&[o.OFFSET]||[],...o.DATA&&[o.DATA]||[],...o.VIEWS&&[o.VIEWS]||[],...o.VARIADIC_DATA_BUFFERS||[],...r(o.children)],[])}}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(cM(t));return r.value}readSchema(){let t=Nt.Schema,r=this.readMessage(t),n=r?.header();if(!r||!n)throw new Error(lM(t));return n}},Hp=4,aM="ARROW1",ql=new Uint8Array(aM.length);for(let e=0;e<aM.length;e+=1)ql[e]=aM.codePointAt(e);jl=ql.length,hM=jl+Hp,BA=jl*2+Hp});var uM,fM,LA,DA=w(()=>{bl();uM=class{constructor(){this.LZ4_FRAME_MAGIC=new Uint8Array([4,34,77,24]),this.MIN_HEADER_LENGTH=7}isValidCodecEncode(t){let r=new Uint8Array([1,2,3,4,5,6,7,8]),n=t.encode(r);return this._isValidCompressed(n)}_isValidCompressed(t){return this._hasMinimumLength(t)&&this._hasValidMagicNumber(t)&&this._hasValidVersion(t)}_hasMinimumLength(t){return t.length>=this.MIN_HEADER_LENGTH}_hasValidMagicNumber(t){return this.LZ4_FRAME_MAGIC.every((r,n)=>t[n]===r)}_hasValidVersion(t){return(t[4]&192)>>6===1}},fM=class{constructor(){this.ZSTD_MAGIC=new Uint8Array([40,181,47,253]),this.MIN_HEADER_LENGTH=6}isValidCodecEncode(t){let r=new Uint8Array([1,2,3,4,5,6,7,8]),n=t.encode(r);return this._isValidCompressed(n)}_isValidCompressed(t){return this._hasMinimumLength(t)&&this._hasValidMagicNumber(t)}_hasMinimumLength(t){return t.length>=this.MIN_HEADER_LENGTH}_hasValidMagicNumber(t){return this.ZSTD_MAGIC.every((r,n)=>t[n]===r)}},LA={[ur.LZ4_FRAME]:new uM,[ur.ZSTD]:new fM}});var dM,ca,Kp=w(()=>{bl();DA();dM=class{constructor(){this.registry={}}set(t,r){if(r?.encode&&typeof r.encode=="function"&&!LA[t].isValidCodecEncode(r))throw new Error(`Encoder for ${ur[t]} is not valid.`);this.registry[t]=r}get(t){var r;return((r=this.registry)===null||r===void 0?void 0:r[t])||null}},ca=new dM});function zA(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*FA(e){let t=Kr.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function UA(e){return Gr(this,arguments,function*(){let r=yield wt(Kr.from(e));try{if(!(yield wt(r.open({autoDestroy:!1}))).closed)do yield yield wt(r);while(!(yield wt(r.reset().open())).closed)}finally{yield wt(r.cancel())}})}function _D(e){return new Ii(new pM(e))}function MD(e){let t=e.peek(jl+7&-8);return t&&t.byteLength>=4?$p(t)?new No(new Zp(e.read())):new Ii(new Hl(e)):new Ii(new Hl((function*(){})()))}function bD(e){return Y(this,void 0,void 0,function*(){let t=yield e.peek(jl+7&-8);return t&&t.byteLength>=4?$p(t)?new No(new Zp(yield e.read())):new Co(new $l(e)):new Co(new $l((function(){return Gr(this,arguments,function*(){})})()))})}function xD(e){return Y(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),r=new Gs(e,t);return t>=BA&&$p(yield r.readAt(0,jl+7&-8))?new Wl(new mM(r)):new Co(new $l(r))})}var Kr,Ii,Co,No,Wl,Xp,Hl,$l,Zp,mM,pM,Yu=w(()=>{an();Zn();Ar();te();Ne();M_();lu();Fs();Us();v_();MA();Ro();Gu();Yp();fs();Kp();ki();Gt();Kr=class e extends Ha{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let r=this._impl.open(t);return Tn(r)?r.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return lr.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return lr.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,r){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof e?t:Lm(t)?_D(t):Fm(t)?xD(t):Tn(t)?Y(this,void 0,void 0,function*(){return yield e.from(yield t)}):Um(t)||su(t)||zm(t)||Yn(t)?bD(new mn(t)):MD(new ti(t))}static readAll(t){return t instanceof e?t.isSync()?FA(t):UA(t):Lm(t)||ArrayBuffer.isView(t)||ui(t)||Dm(t)?FA(t):UA(t)}},Ii=class extends Kr{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Gr(this,arguments,function*(){yield wt(yield*wl(vn(this[Symbol.iterator]())))})}},Co=class extends Kr{constructor(t){super(t),this._impl=t}readAll(){return Y(this,void 0,void 0,function*(){var t,r,n,i;let o=new Array;try{for(var s=!0,a=vn(this),c;c=yield a.next(),t=c.done,!t;s=!0){i=c.value,s=!1;let l=i;o.push(l)}}catch(l){r={error:l}}finally{try{!s&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(r)throw r.error}}return o})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},No=class extends Ii{constructor(t){super(t),this._impl=t}},Wl=class extends Co{constructor(t){super(t),this._impl=t}},Xp=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,r,n){let i;if(t.compression!=null){let s=ca.get(t.compression.type);if(s?.decode&&typeof s.decode=="function"){let{decommpressedBody:a,buffers:c}=this._decompressBuffers(t,r,s);i=this._loadCompressedVectors(t,a,this.schema.fields),t=new Ye(t.length,t.nodes,c,null)}else throw new Error("Record batch is compressed but codec not found")}else i=this._loadVectors(t,r,this.schema.fields);let o=Q({type:new Yt(this.schema.fields),length:t.length,children:i});return new Zt(this.schema,o,n)}_loadDictionaryBatch(t,r){let{id:n,isDelta:i}=t,{dictionaries:o,schema:s}=this,a=o.get(n),c=s.dictionaries.get(n),l;if(t.data.compression!=null){let h=ca.get(t.data.compression.type);if(h?.decode&&typeof h.decode=="function"){let{decommpressedBody:u,buffers:f}=this._decompressBuffers(t.data,r,h);l=this._loadCompressedVectors(t.data,u,[c]),t=new Cr(new Ye(t.data.length,t.data.nodes,f,null,t.data.variadicBufferCounts),n,i)}else throw new Error("Dictionary batch is compressed but codec not found")}else l=this._loadVectors(t.data,r,[c]);return(a&&i?a.concat(new $(l)):new $(l)).memoize()}_loadVectors(t,r,n){return new Vl(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion,t.variadicBufferCounts).visitMany(n)}_loadCompressedVectors(t,r,n){return new Dp(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion,t.variadicBufferCounts).visitMany(n)}_decompressBuffers(t,r,n){let i=[],o=[],s=0;for(let{offset:a,length:c}of t.buffers){if(c===0){i.push(new Uint8Array(0)),o.push(new Fe(s,0));continue}let l=new hr(r.subarray(a,a+c)),h=It(l.readInt64(0)),u=l.bytes().subarray(8),f=h===-1?u:n.decode(u);i.push(f);let d=(s+7&-8)-s;s+=d,o.push(new Fe(s,f.length)),s+=f.length}return{decommpressedBody:i,buffers:o}}},Hl=class extends Xp{constructor(t,r){super(r),this._reader=Lm(t)?new _c(this._handle=t):new aa(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=zA(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):pe}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):pe}next(){if(this.closed)return pe;let t,{_reader:r}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i,t.metadata)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=r.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new yc(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},$l=class extends Xp{constructor(t,r){super(r),this._reader=new wc(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return Y(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return Y(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=zA(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return Y(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):pe})}return(t){return Y(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):pe})}next(){return Y(this,void 0,void 0,function*(){if(this.closed)return pe;let t,{_reader:r}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=yield r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i,t.metadata)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=yield r.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new yc(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return Y(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},Zp=class extends Hl{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,r){super(t instanceof zu?t:new zu(t),r)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let r of this._footer.dictionaryBatches())r&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var r;if(this.closed)return null;this._footer||this.open();let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(Nt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s,i.metadata)}}return null}_readDictionaryBatch(t){var r;let n=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(Nt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}}_readFooter(){let{_handle:t}=this,r=t.size-hM,n=t.readInt32(r),i=t.readAt(r-n,n);return bo.decode(i)}_readNextMessageAndValidate(t){var r;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(this._recordBatchIndex);if(n&&this._handle.seek(n.offset))return this._reader.readMessage(t)}return null}},mM=class extends $l{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...r){let n=typeof r[0]!="number"?r.shift():void 0,i=r[0]instanceof Map?r.shift():void 0;super(t instanceof Gs?t:new Gs(t,n),i)}isFile(){return!0}isAsync(){return!0}open(t){let r=Object.create(null,{open:{get:()=>super.open}});return Y(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield r.open.call(this,t)})}readRecordBatch(t){return Y(this,void 0,void 0,function*(){var r;if(this.closed)return null;this._footer||(yield this.open());let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(Nt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s,i.metadata)}}return null})}_readDictionaryBatch(t){return Y(this,void 0,void 0,function*(){var r;let n=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(Nt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}})}_readFooter(){return Y(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let r=t.size-hM,n=yield t.readInt32(r),i=yield t.readAt(r-n,n);return bo.decode(i)})}_readNextMessageAndValidate(t){return Y(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let r=this._footer.getRecordBatch(this._recordBatchIndex);if(r&&(yield this._handle.seek(r.offset)))return yield this._reader.readMessage(t)}return null})}},pM=class extends Hl{constructor(t,r){super(t,r)}_loadVectors(t,r,n){return new Lp(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion,t.variadicBufferCounts).visitMany(n)}}});function Gn(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new Fe(this._byteLength,t)),this._byteLength+=t,this}function SD(e){var t;let{type:r,length:n,typeIds:i,valueOffsets:o}=e;if(Gn.call(this,i),r.mode===jt.Sparse)return gM.call(this,e);if(r.mode===jt.Dense){if(e.offset<=0)return Gn.call(this,o),gM.call(this,e);{let s=new Int32Array(n),a=Object.create(null),c=Object.create(null);for(let l,h,u=-1;++u<n;)(l=i[u])!==void 0&&((h=a[l])===void 0&&(h=a[l]=o[u]),s[u]=o[u]-h,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);Gn.call(this,s),this.visitMany(e.children.map((l,h)=>{let u=r.typeIds[h],f=a[u],d=c[u];return l.slice(f,Math.min(n,d))}))}}return this}function vD(e){let t;return e.nullCount>=e.length?Gn.call(this,new Uint8Array(e.length+7>>3)):(t=e.values)instanceof Uint8Array?Gn.call(this,za(e.offset,e.length,t)):Gn.call(this,Va(e.values))}function Oo(e){return Gn.call(this,e.values.subarray(0,e.length*e.stride))}function Jp(e){let{length:t,values:r,valueOffsets:n}=e,i=It(n[0]),o=It(n[t]),s=Math.min(o-i,r.byteLength-i);return Gn.call(this,Vm(-i,t+1,n)),Gn.call(this,r.subarray(i,i+s)),this}function VA(e){let{offset:t,length:r,stride:n,values:i,variadicBuffers:o=[]}=e;if(!i)throw new Error("BinaryView data is missing view buffer");let s=t*n,a=s+r*n;Gn.call(this,i.subarray(s,a));for(let c of o)Gn.call(this,c);return this._variadicBufferCounts.push(o.length),this}function Qp(e){let{length:t,valueOffsets:r}=e;if(r){let n=It(r[0]),i=It(r[t]);return Gn.call(this,Vm(-n,t+1,r)),this.visit(e.children[0].slice(n,i-n))}return this.visit(e.children[0])}function gM(e){return this.visitMany(e.type.children.map((t,r)=>e.children[r]).filter(Boolean))[0]}var ge,kA=w(()=>{Ar();fn();Ne();Ro();Je();ka();Fs();te();ki();ge=class e extends rt{static assemble(...t){let r=i=>i.flatMap(o=>Array.isArray(o)?r(o):o instanceof Zt?o.data.children:o.data),n=new e;return n.visitMany(r(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[],this._variadicBufferCounts=[]}visit(t){if(t instanceof $)return this.visitMany(t.data),this;let{type:r}=t;if(!z.isDictionary(r)){let{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(z.isUnion(r))this.nodes.push(new Jn(n,0));else{let{nullCount:i}=t;z.isNull(r)||Gn.call(this,i<=0?new Uint8Array(0):za(t.offset,n,t.nullBitmap)),this.nodes.push(new Jn(n,i))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}get variadicBufferCounts(){return this._variadicBufferCounts}};ge.prototype.visitBool=vD;ge.prototype.visitInt=Oo;ge.prototype.visitFloat=Oo;ge.prototype.visitUtf8=Jp;ge.prototype.visitLargeUtf8=Jp;ge.prototype.visitUtf8View=VA;ge.prototype.visitBinary=Jp;ge.prototype.visitLargeBinary=Jp;ge.prototype.visitBinaryView=VA;ge.prototype.visitFixedSizeBinary=Oo;ge.prototype.visitDate=Oo;ge.prototype.visitTimestamp=Oo;ge.prototype.visitTime=Oo;ge.prototype.visitDecimal=Oo;ge.prototype.visitList=Qp;ge.prototype.visitLargeList=Qp;ge.prototype.visitStruct=gM;ge.prototype.visitUnion=SD;ge.prototype.visitInterval=Oo;ge.prototype.visitDuration=Oo;ge.prototype.visitFixedSizeList=Qp;ge.prototype.visitMap=Qp});var t0,qA=w(()=>{fn();Km();Ne();t0=class extends rt{visit(t){return t==null?void 0:super.visit(t)}visitNull({typeId:t}){return{name:lt[t].toLowerCase()}}visitInt({typeId:t,bitWidth:r,isSigned:n}){return{name:lt[t].toLowerCase(),bitWidth:r,isSigned:n}}visitFloat({typeId:t,precision:r}){return{name:lt[t].toLowerCase(),precision:Vt[r]}}visitBinary({typeId:t}){return{name:lt[t].toLowerCase()}}visitLargeBinary({typeId:t}){return{name:lt[t].toLowerCase()}}visitBinaryView({typeId:t}){return{name:lt[t].toLowerCase()}}visitBool({typeId:t}){return{name:lt[t].toLowerCase()}}visitUtf8({typeId:t}){return{name:lt[t].toLowerCase()}}visitLargeUtf8({typeId:t}){return{name:lt[t].toLowerCase()}}visitUtf8View({typeId:t}){return{name:lt[t].toLowerCase()}}visitDecimal({typeId:t,scale:r,precision:n,bitWidth:i}){return{name:lt[t].toLowerCase(),scale:r,precision:n,bitWidth:i}}visitDate({typeId:t,unit:r}){return{name:lt[t].toLowerCase(),unit:Qt[r]}}visitTime({typeId:t,unit:r,bitWidth:n}){return{name:lt[t].toLowerCase(),unit:q[r],bitWidth:n}}visitTimestamp({typeId:t,timezone:r,unit:n}){return{name:lt[t].toLowerCase(),unit:q[n],timezone:r}}visitInterval({typeId:t,unit:r}){return{name:lt[t].toLowerCase(),unit:Lt[r]}}visitDuration({typeId:t,unit:r}){return{name:lt[t].toLocaleLowerCase(),unit:q[r]}}visitList({typeId:t}){return{name:lt[t].toLowerCase()}}visitLargeList({typeId:t}){return{name:lt[t].toLowerCase()}}visitStruct({typeId:t}){return{name:lt[t].toLowerCase()}}visitUnion({typeId:t,mode:r,typeIds:n}){return{name:lt[t].toLowerCase(),mode:jt[r].toUpperCase(),typeIds:[...n]}}visitDictionary(t){return this.visit(t.dictionary)}visitFixedSizeBinary({typeId:t,byteWidth:r}){return{name:lt[t].toLowerCase(),byteWidth:r}}visitFixedSizeList({typeId:t,listSize:r}){return{name:lt[t].toLowerCase(),listSize:r}}visitMap({typeId:t,keysSorted:r}){return{name:lt[t].toLowerCase(),keysSorted:r}}}});function*yM(e){for(let t of e)yield t.reduce((r,n)=>`${r}${("0"+(n&255).toString(16)).slice(-2)}`,"").toUpperCase()}function*Bo(e,t){let r=new Uint32Array(e.buffer,e.byteOffset,e.byteLength/Uint32Array.BYTES_PER_ELEMENT);for(let n=-1,i=r.length/t;++n<i;)yield`${Fa.new(r.subarray((n+0)*t,(n+1)*t),!1)}`}function jA(e,t){let n=e.values,i=new DataView(n.buffer,n.byteOffset,n.byteLength),o=n.byteLength/16,s=f=>Array.from(f).map(d=>("0"+(d&255).toString(16)).slice(-2)).join("").toUpperCase(),a=Array.from({length:o},(f,d)=>{let m=d*16,p=i.getInt32(m,!0);return[m,p]}).map(([f,d])=>d>12?{SIZE:d,PREFIX_HEX:s(n.subarray(f+4,f+8)),BUFFER_INDEX:i.getInt32(f+8,!0),OFFSET:i.getInt32(f+12,!0)}:{SIZE:d,INLINED:t(n.subarray(f+4,f+4+d))}),c=[...new Set(a.map(f=>f.BUFFER_INDEX).filter(f=>f!==void 0))],l=c.map(f=>s(e.variadicBuffers[f])),h=new Map(c.map((f,d)=>[f,d]));return{VIEWS:a.map(f=>f.BUFFER_INDEX!==void 0?Object.assign(Object.assign({},f),{BUFFER_INDEX:h.get(f.BUFFER_INDEX)}):f),VARIADIC_DATA_BUFFERS:l}}var Ku,WA=w(()=>{Zm();Ar();fn();Ne();Ne();ka();Bp();te();Ku=class e extends rt{static assemble(...t){let r=new e;return t.map(({schema:n,data:i})=>r.visitMany(n.fields,i.children))}visit({name:t},r){let{length:n}=r,{offset:i,nullCount:o,nullBitmap:s}=r,a=z.isDictionary(r.type)?r.type.indices:r.type,c=Object.assign([],r.buffers,{[xe.VALIDITY]:void 0});return Object.assign({name:t,count:n,VALIDITY:z.isNull(a)||z.isUnion(a)?void 0:o<=0?Array.from({length:n},()=>1):[...new Wi(s,i,n,null,_p)]},super.visit(r.clone(a,i,n,0,c)))}visitNull(){return{}}visitBool({values:t,offset:r,length:n}){return{DATA:[...new Wi(t,r,n,null,Ll)]}}visitInt(t){return{DATA:t.type.bitWidth<64?[...t.values]:[...Bo(t.values,2)]}}visitFloat(t){return{DATA:[...t.values]}}visitUtf8(t){return{DATA:[...new $([t])],OFFSET:[...t.valueOffsets]}}visitLargeUtf8(t){return{DATA:[...new $([t])],OFFSET:[...Bo(t.valueOffsets,2)]}}visitBinary(t){return{DATA:[...yM(new $([t]))],OFFSET:[...t.valueOffsets]}}visitLargeBinary(t){return{DATA:[...yM(new $([t]))],OFFSET:[...Bo(t.valueOffsets,2)]}}visitBinaryView(t){return jA(t,r=>Array.from(r).map(n=>("0"+(n&255).toString(16)).slice(-2)).join("").toUpperCase())}visitUtf8View(t){return jA(t,r=>Array.from(r).map(n=>String.fromCodePoint(n)).join(""))}visitFixedSizeBinary(t){return{DATA:[...yM(new $([t]))]}}visitDate(t){return{DATA:t.type.unit===Qt.DAY?[...t.values]:[...Bo(t.values,2)]}}visitTimestamp(t){return{DATA:[...Bo(t.values,2)]}}visitTime(t){return{DATA:t.type.unit<q.MICROSECOND?[...t.values]:[...Bo(t.values,2)]}}visitDecimal(t){return{DATA:[...Bo(t.values,4)]}}visitList(t){return{OFFSET:[...t.valueOffsets],children:this.visitMany(t.type.children,t.children)}}visitLargeList(t){return{OFFSET:[...Bo(t.valueOffsets,2)],children:this.visitMany(t.type.children,t.children)}}visitStruct(t){return{children:this.visitMany(t.type.children,t.children)}}visitUnion(t){return{TYPE_ID:[...t.typeIds],OFFSET:t.type.mode===jt.Dense?[...t.valueOffsets]:void 0,children:this.visitMany(t.type.children,t.children)}}visitInterval(t){switch(t.type.unit){case Lt.YEAR_MONTH:return{DATA:[...t.values]};case Lt.DAY_TIME:return{DATA:R_(t.values)};case Lt.MONTH_DAY_NANO:return{DATA:C_(t.values,!0)}}}visitDuration(t){return{DATA:[...Bo(t.values,2)]}}visitFixedSizeList(t){return{children:this.visitMany(t.type.children,t.children)}}visitMap(t){return{OFFSET:[...t.valueOffsets],children:this.visitMany(t.type.children,t.children)}}}});function wM(e,t){let r=t;t instanceof ce&&(r=t.batches,e.reset(void 0,t.schema));for(let n of r)e.write(n);return e.finish()}function _M(e,t){return Y(this,void 0,void 0,function*(){var r,n,i,o,s,a,c;try{for(r=!0,n=vn(t);i=yield n.next(),o=i.done,!o;r=!0){c=i.value,r=!1;let l=c;e.write(l)}}catch(l){s={error:l}}finally{try{!r&&!o&&(a=n.return)&&(yield a.call(n))}finally{if(s)throw s.error}}return e.finish()})}function HA({name:e,type:t,nullable:r}){let n=new t0;return{name:e,nullable:r,type:n.visit(t),children:(t.children||[]).map(i=>HA(i)),dictionary:z.isDictionary(t)?{id:t.id,isOrdered:t.isOrdered,indexType:n.visit(t.indices)}:void 0}}function ED(e,t,r=!1){let[n]=Ku.assemble(new Zt({[t]:e}));return JSON.stringify({id:t,isDelta:r,data:{count:e.length,columns:n}},null,2)}function TD(e){let[t]=Ku.assemble(e);return JSON.stringify({count:e.numRows,columns:t},null,2)}var Xi,Lo,Do,Xu,e0=w(()=>{an();gc();Yp();Ar();te();Fs();Fs();M_();Ne();$u();Us();kA();qA();WA();Je();Ro();Gu();fs();bl();Kp();Gt();Xi=class extends Ha{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,r){throw new Error('"throughDOM" not available in this environment')}constructor(t){if(super(),this._position=0,this._started=!1,this._compression=null,this._sink=new Qn,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,zr(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1,compressionType:null}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1,t.compressionType!=null){if(this._writeLegacyIpcFormat)throw new Error("Legacy IPC format does not support columnar compression. Use modern IPC format (writeLegacyIpcFormat=false).");if(Object.values(ur).includes(t.compressionType))this._compression=new Wa(t.compressionType);else{let r=Object.values(ur).filter(n=>typeof n=="string");throw new Error(`Unsupported compressionType: ${t.compressionType} Available types: ${r.join(", ")}`)}}else this._compression=null}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return Tn(t)?t.then(r=>this.writeAll(r)):Yn(t)?_M(this,t):wM(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,r=null){return t===this._sink||t instanceof Qn?this._sink=t:(this._sink=new Qn,t&&h3(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&u3(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!r||!pc(r,this._schema))&&(r==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=r,this._writeSchema(r))),this}write(t){let r=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof ce&&!(r=t.schema))return this.finish()&&void 0;if(t instanceof Zt&&!(r=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(r&&!pc(r,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,r)}t instanceof Zt?t instanceof yc||this._writeRecordBatch(t):t instanceof ce?this.writeAll(t.batches):ui(t)&&this.writeAll(t)}_writeMessage(t,r=8){let n=r-1,i=Nr.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+n&~n,c=a-o-s;return t.headerType===Nt.RecordBatch?this._recordBatchBlocks.push(new vi(a,t.bodyLength,this._position)):t.headerType===Nt.DictionaryBatch&&this._dictionaryBlocks.push(new vi(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-s)),o>0&&this._write(i),this._writePadding(c)}_write(t){if(this._started){let r=nt(t);r&&r.byteLength>0&&(this._sink.write(r),this._position+=r.byteLength)}return this}_writeSchema(t){return this._writeMessage(Nr.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(ql)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:r,nodes:n,bufferRegions:i,buffers:o,variadicBufferCounts:s}=this._assembleRecordBatch(t),a=new Ye(t.numRows,n,i,this._compression,s,t.metadata),c=Nr.from(a,r);return this._writeDictionaries(t)._writeMessage(c)._writeBodyBuffers(o)}_assembleRecordBatch(t){let{byteLength:r,nodes:n,bufferRegions:i,buffers:o,variadicBufferCounts:s}=ge.assemble(t);return this._compression!=null&&({byteLength:r,bufferRegions:i,buffers:o}=this._compressBodyBuffers(o)),{byteLength:r,nodes:n,bufferRegions:i,buffers:o,variadicBufferCounts:s}}_compressBodyBuffers(t){let r=ca.get(this._compression.type);if(!r?.encode||typeof r.encode!="function")throw new Error(`Codec for compression type "${ur[this._compression.type]}" has invalid encode method`);let n=0,i=[],o=[];for(let a of t){let c=nt(a);if(c.length===0){i.push(new Uint8Array(0),new Uint8Array(0)),o.push(new Fe(n,0));continue}let l=r.encode(c),h=l.length<c.length,u=h?l:c,f=h?u.length:-1,d=new hr(new Uint8Array(8));d.writeInt64(0,BigInt(f)),i.push(d.bytes(),new Uint8Array(u));let m=(n+7&-8)-n;n+=m;let p=8+u.length;o.push(new Fe(n,p)),n+=p}let s=(n+7&-8)-n;return n+=s,{byteLength:n,bufferRegions:o,buffers:i}}_writeDictionaryBatch(t,r,n=!1){let{byteLength:i,nodes:o,bufferRegions:s,buffers:a,variadicBufferCounts:c}=this._assembleRecordBatch(new $([t])),l=new Ye(t.length,o,s,this._compression,c),h=new Cr(l,r,n),u=Nr.from(h,i);return this._writeMessage(u)._writeBodyBuffers(a)}_writeBodyBuffers(t){let r=this._compression!=null?2:1,n=new Array(r);for(let i=0;i<t.length;i+=r){let o=0;for(let a=-1;++a<r;)n[a]=t[i+a],o+=n[a].byteLength;if(o===0)continue;for(let a of n)this._write(a);let s=(o+7&-8)-o;s>0&&this._writePadding(s)}return this}_writeDictionaries(t){var r,n;for(let[i,o]of t.dictionaries){let s=(r=o?.data)!==null&&r!==void 0?r:[],a=this._seenDictionaries.get(i),c=(n=this._dictionaryDeltaOffsets.get(i))!==null&&n!==void 0?n:0;if(!a||a.data[0]!==s[0])for(let[l,h]of s.entries())this._writeDictionaryBatch(h,i,l>0);else if(c<s.length)for(let l of s.slice(c))this._writeDictionaryBatch(l,i,!0);this._seenDictionaries.set(i,o),this._dictionaryDeltaOffsets.set(i,s.length)}return this}},Lo=class e extends Xi{static writeAll(t,r){let n=new e(r);return Tn(t)?t.then(i=>n.writeAll(i)):Yn(t)?_M(n,t):wM(n,t)}},Do=class e extends Xi{static writeAll(t,r){let n=new e(r);return Tn(t)?t.then(i=>n.writeAll(i)):Yn(t)?_M(n,t):wM(n,t)}constructor(t){super(t),this._autoDestroy=!0,this._writeLegacyIpcFormat=!1}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,r,n=!1){if(!n&&this._seenDictionaries.has(r))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,r,n)}_writeFooter(t){let r=bo.encode(new bo(t,Xt.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(r)._write(Int32Array.of(r.byteLength))._writeMagic()}},Xu=class e extends Xi{static writeAll(t){return new e().writeAll(t)}constructor(){super(),this._autoDestroy=!0,this._recordBatches=[],this._recordBatchesWithDictionaries=[]}_writeMessage(){return this}_writeFooter(t){return this}_writeSchema(t){return this._write(`{
19
- "schema": ${JSON.stringify({fields:t.fields.map(r=>HA(r))},null,2)}`)}_writeDictionaries(t){return t.dictionaries.size>0&&this._recordBatchesWithDictionaries.push(t),this}_writeDictionaryBatch(t,r,n=!1){return this._write(this._dictionaryBlocks.length===0?" ":`,
20
- `),this._write(ED(t,r,n)),this._dictionaryBlocks.push(new vi(0,0,0)),this}_writeRecordBatch(t){return this._writeDictionaries(t),this._recordBatches.push(t),this}close(){if(this._recordBatchesWithDictionaries.length>0){this._write(`,
18
+ ]`}concat(...t){let r=this.schema,n=this.data.concat(t.flatMap(({data:i})=>i));return new e(r,n.map(i=>new Zt(r,i)))}slice(t,r){let n=this.schema;[t,r]=Ou({length:this.numRows},t,r);let i=xp(this.data,this._offsets,t,r);return new e(n,i.map(o=>new Zt(n,o)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(r=>r.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let r=this.data.map(n=>n.children[t]);if(r.length===0){let{type:n}=this.schema.fields[t],i=Q({type:n,length:0,nullCount:0});r.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new $(r)}return null}setChild(t,r){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),r)}setChildAt(t,r){let n=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){r||(r=new $([Q({type:new De,length:this.numRows})]));let o=n.fields.slice(),s=o[t].clone({type:r.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[o[t],a[t]]=[s,r],[n,i]=Wp(n,a)}return new e(n,i)}select(t){let r=this.schema.fields.reduce((n,i,o)=>n.set(i.name,o),new Map);return this.selectAt(t.map(n=>r.get(n)).filter(n=>n>-1))}selectAt(t){let r=this.schema.selectAt(t),n=this.batches.map(i=>i.selectAt(t));return new e(r,n)}assign(t){let r=this.schema.fields,[n,i]=t.schema.fields.reduce((a,c,l)=>{let[h,u]=a,f=r.findIndex(d=>d.name===c.name);return~f?u[f]=l:h.push(l),a},[[],[]]),o=this.schema.assign(t.schema),s=[...r.map((a,c)=>[c,i[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...n.map(a=>t.getChildAt(a))].filter(Boolean);return new e(...Wp(o,s))}};xA=Symbol.toStringTag;ce[xA]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e[SA]=!0,e.isValid=Dl(Fu),e.get=Dl(He.getVisitFn(b.Struct)),e.set=Sp(mr.getVisitFn(b.Struct)),e.indexOf=vp(qa.getVisitFn(b.Struct)),"Table"))(ce.prototype);Object.defineProperty(ce,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===ce&&ce.isTable(t)}})});function vA(e,t,r=t.reduce((n,i)=>Math.max(n,i.length),0)){var n;let i=[...e.fields],o=[...t],s=(r+63&-64)>>3;for(let[a,c]of e.fields.entries()){let l=t[a];(!l||l.length!==r)&&(i[a]=c.clone({nullable:!0}),o[a]=(n=l?._changeLengthAndBackfillNullBitmap(r))!==null&&n!==void 0?n:Q({type:c.type,length:r,nullCount:r,nullBitmap:new Uint8Array(s)}))}return[e.assign(i),Q({type:new Yt(i),length:r,children:o})]}function IA(e,t,r=new Map){var n,i;if(((n=e?.length)!==null&&n!==void 0?n:0)>0&&e?.length===t?.length)for(let o=-1,s=e.length;++o<s;){let{type:a}=e[o],c=t[o];for(let l of[c,...((i=c?.dictionary)===null||i===void 0?void 0:i.data)||[]])IA(a.children,l?.children,r);if(z.isDictionary(a)){let{id:l}=a;if(!r.has(l))c?.dictionary&&r.set(l,c.dictionary);else if(r.get(l)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return r}var EA,TA,Zt,yc,Ro=w(()=>{Zn();gc();Ar();Rr();te();Ol();Ua();Dn();Tp();Ip();TA=Symbol.for("apache-arrow/RecordBatch"),Zt=class e{static isRecordBatch(t){return t?.[TA]===!0}constructor(...t){switch(t.length){case 3:case 2:{if([this.schema]=t,!(this.schema instanceof _t))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=Q({nullCount:0,type:new Yt(this.schema.fields),children:this.schema.fields.map(r=>Q({type:r.type,nullCount:0}))}),this._metadata=new Map]=t,!(this.data instanceof ut))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=vA(this.schema,this.data.children,this.data.length);break}case 1:{let[r]=t,{fields:n,children:i,length:o}=Object.keys(r).reduce((c,l,h)=>(c.children[h]=r[l],c.length=Math.max(c.length,r[l].length),c.fields[h]=Z.new({name:l,type:r[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new _t(n),a=Q({type:new Yt(n),length:o,children:i,nullCount:0});[this.schema,this.data]=vA(s,a.children,o),this._metadata=new Map;break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get metadata(){return this._metadata}get dictionaries(){return this._dictionaries||(this._dictionaries=IA(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return He.visit(this.data,t)}at(t){return this.get(Ga(t,this.numRows))}set(t,r){return mr.visit(this.data,t,r)}indexOf(t,r){return qa.visit(this.data,t,r)}[Symbol.iterator](){return Fl.visit(new $([this.data]))}toArray(){return[...this]}concat(...t){return new ce(this.schema,[this,...t])}slice(t,r){let[n]=new $([this.data]).slice(t,r).data;return new e(this.schema,n,this._metadata)}getChild(t){var r;return this.getChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new $([this.data.children[t]]):null}setChild(t,r){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),r)}setChildAt(t,r){let n=this.schema,i=this.data;if(t>-1&&t<this.numCols){r||(r=new $([Q({type:new De,length:this.numRows})]));let o=n.fields.slice(),s=i.children.slice(),a=o[t].clone({type:r.type});[o[t],s[t]]=[a,r.data[0]],n=new _t(o,new Map(this.schema.metadata)),i=Q({type:new Yt(o),length:i.length,children:s})}return new e(n,i,this._metadata)}select(t){let r=this.schema.select(t),n=new Yt(r.fields),i=[];for(let o of t){let s=this.schema.fields.findIndex(a=>a.name===o);~s&&(i[s]=this.data.children[s])}return new e(r,Q({type:n,length:this.numRows,children:i}),this._metadata)}selectAt(t){let r=this.schema.selectAt(t),n=t.map(o=>this.data.children[o]).filter(Boolean),i=Q({type:new Yt(r.fields),length:this.numRows,children:n});return new e(r,i,this._metadata)}};EA=Symbol.toStringTag;Zt[EA]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e[TA]=!0,"RecordBatch"))(Zt.prototype);Object.defineProperty(Zt,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===Zt&&Zt.isRecordBatch(t)}});yc=class extends Zt{constructor(t,r){let n=t.fields.map(o=>Q({type:o.type})),i=Q({type:new Yt(t.fields),length:0,nullCount:0,children:n});super(t,i,r||new Map)}}});function $p(e,t=0){for(let r=-1,n=ql.length;++r<n;)if(ql[r]!==e[t+r])return!1;return!0}var oM,sM,AA,PA,aa,wc,_c,Hp,iM,ql,jl,aM,RA,Yp=w(()=>{an();Ne();Gt();Fs();fs();b_();Je();Us();Gu();oM=e=>`Expected ${Nt[e]} Message in stream, but was null or length 0.`,sM=e=>`Header pointer of flatbuffer-encoded ${Nt[e]} Message is null or length 0.`,AA=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,PA=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,aa=class{constructor(t){this.source=t instanceof ti?t:new ti(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?pe:t.value===-1&&(t=this.readMetadataLength()).done?pe:(t=this.readMetadata(t.value)).done?pe:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(oM(t));return r.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let r=nt(this.source.read(t));if(r.byteLength<t)throw new Error(PA(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()}readSchema(t=!1){let r=Nt.Schema,n=this.readMessage(r),i=n?.header();if(t&&!i)throw new Error(sM(r));return i}readMetadataLength(){let t=this.source.read(Hp),r=t&&new hr(t),n=r?.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(t){let r=this.source.read(t);if(!r)return pe;if(r.byteLength<t)throw new Error(AA(t,r.byteLength));return{done:!1,value:Nr.decode(r)}}},wc=class{constructor(t,r){this.source=t instanceof mn?t:Fm(t)?new Gs(t,r):new mn(t)}[Symbol.asyncIterator](){return this}next(){return Y(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?pe:t.value===-1&&(t=yield this.readMetadataLength()).done?pe:(t=yield this.readMetadata(t.value)).done?pe:t})}throw(t){return Y(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return Y(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return Y(this,void 0,void 0,function*(){let r;if((r=yield this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(oM(t));return r.value})}readMessageBody(t){return Y(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let r=nt(yield this.source.read(t));if(r.byteLength<t)throw new Error(PA(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()})}readSchema(){return Y(this,arguments,void 0,function*(t=!1){let r=Nt.Schema,n=yield this.readMessage(r),i=n?.header();if(t&&!i)throw new Error(sM(r));return i})}readMetadataLength(){return Y(this,void 0,void 0,function*(){let t=yield this.source.read(Hp),r=t&&new hr(t),n=r?.readInt32(0)||0;return{done:n===0,value:n}})}readMetadata(t){return Y(this,void 0,void 0,function*(){let r=yield this.source.read(t);if(!r)return pe;if(r.byteLength<t)throw new Error(AA(t,r.byteLength));return{done:!1,value:Nr.decode(r)}})}},_c=class extends aa{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Uu?t:new Uu(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:Nr.fromJSON(t.schema,Nt.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let r=t.dictionaries[this._dictionaryIndex++];return this._body=r.data.columns,{done:!1,value:Nr.fromJSON(r,Nt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let r=t.batches[this._batchIndex++];return this._body=r.columns,{done:!1,value:Nr.fromJSON(r,Nt.RecordBatch)}}return this._body=[],pe}readMessageBody(t){return r(this._body);function r(n){return(n||[]).reduce((i,o)=>[...i,...o.VALIDITY&&[o.VALIDITY]||[],...o.TYPE_ID&&[o.TYPE_ID]||[],...o.OFFSET&&[o.OFFSET]||[],...o.DATA&&[o.DATA]||[],...o.VIEWS&&[o.VIEWS]||[],...o.VARIADIC_DATA_BUFFERS||[],...r(o.children)],[])}}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(oM(t));return r.value}readSchema(){let t=Nt.Schema,r=this.readMessage(t),n=r?.header();if(!r||!n)throw new Error(sM(t));return n}},Hp=4,iM="ARROW1",ql=new Uint8Array(iM.length);for(let e=0;e<iM.length;e+=1)ql[e]=iM.codePointAt(e);jl=ql.length,aM=jl+Hp,RA=jl*2+Hp});var cM,lM,CA,NA=w(()=>{bl();cM=class{constructor(){this.LZ4_FRAME_MAGIC=new Uint8Array([4,34,77,24]),this.MIN_HEADER_LENGTH=7}isValidCodecEncode(t){let r=new Uint8Array([1,2,3,4,5,6,7,8]),n=t.encode(r);return this._isValidCompressed(n)}_isValidCompressed(t){return this._hasMinimumLength(t)&&this._hasValidMagicNumber(t)&&this._hasValidVersion(t)}_hasMinimumLength(t){return t.length>=this.MIN_HEADER_LENGTH}_hasValidMagicNumber(t){return this.LZ4_FRAME_MAGIC.every((r,n)=>t[n]===r)}_hasValidVersion(t){return(t[4]&192)>>6===1}},lM=class{constructor(){this.ZSTD_MAGIC=new Uint8Array([40,181,47,253]),this.MIN_HEADER_LENGTH=6}isValidCodecEncode(t){let r=new Uint8Array([1,2,3,4,5,6,7,8]),n=t.encode(r);return this._isValidCompressed(n)}_isValidCompressed(t){return this._hasMinimumLength(t)&&this._hasValidMagicNumber(t)}_hasMinimumLength(t){return t.length>=this.MIN_HEADER_LENGTH}_hasValidMagicNumber(t){return this.ZSTD_MAGIC.every((r,n)=>t[n]===r)}},CA={[ur.LZ4_FRAME]:new cM,[ur.ZSTD]:new lM}});var hM,ca,Kp=w(()=>{bl();NA();hM=class{constructor(){this.registry={}}set(t,r){if(r?.encode&&typeof r.encode=="function"&&!CA[t].isValidCodecEncode(r))throw new Error(`Encoder for ${ur[t]} is not valid.`);this.registry[t]=r}get(t){var r;return((r=this.registry)===null||r===void 0?void 0:r[t])||null}},ca=new hM});function DA(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*BA(e){let t=Kr.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function OA(e){return Gr(this,arguments,function*(){let r=yield wt(Kr.from(e));try{if(!(yield wt(r.open({autoDestroy:!1}))).closed)do yield yield wt(r);while(!(yield wt(r.reset().open())).closed)}finally{yield wt(r.cancel())}})}function wD(e){return new Ii(new fM(e))}function _D(e){let t=e.peek(jl+7&-8);return t&&t.byteLength>=4?$p(t)?new No(new Zp(e.read())):new Ii(new Hl(e)):new Ii(new Hl((function*(){})()))}function MD(e){return Y(this,void 0,void 0,function*(){let t=yield e.peek(jl+7&-8);return t&&t.byteLength>=4?$p(t)?new No(new Zp(yield e.read())):new Co(new $l(e)):new Co(new $l((function(){return Gr(this,arguments,function*(){})})()))})}function bD(e){return Y(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),r=new Gs(e,t);return t>=RA&&$p(yield r.readAt(0,jl+7&-8))?new Wl(new uM(r)):new Co(new $l(r))})}var Kr,Ii,Co,No,Wl,Xp,Hl,$l,Zp,uM,fM,Yu=w(()=>{an();Zn();Ar();te();Ne();y_();lu();Fs();Us();b_();gA();Ro();Gu();Yp();fs();Kp();ki();Gt();Kr=class e extends Ha{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let r=this._impl.open(t);return Tn(r)?r.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return lr.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return lr.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,r){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof e?t:Lm(t)?wD(t):Fm(t)?bD(t):Tn(t)?Y(this,void 0,void 0,function*(){return yield e.from(yield t)}):Um(t)||su(t)||zm(t)||Yn(t)?MD(new mn(t)):_D(new ti(t))}static readAll(t){return t instanceof e?t.isSync()?BA(t):OA(t):Lm(t)||ArrayBuffer.isView(t)||ui(t)||Dm(t)?BA(t):OA(t)}},Ii=class extends Kr{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Gr(this,arguments,function*(){yield wt(yield*wl(vn(this[Symbol.iterator]())))})}},Co=class extends Kr{constructor(t){super(t),this._impl=t}readAll(){return Y(this,void 0,void 0,function*(){var t,r,n,i;let o=new Array;try{for(var s=!0,a=vn(this),c;c=yield a.next(),t=c.done,!t;s=!0){i=c.value,s=!1;let l=i;o.push(l)}}catch(l){r={error:l}}finally{try{!s&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(r)throw r.error}}return o})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},No=class extends Ii{constructor(t){super(t),this._impl=t}},Wl=class extends Co{constructor(t){super(t),this._impl=t}},Xp=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,r,n){let i;if(t.compression!=null){let s=ca.get(t.compression.type);if(s?.decode&&typeof s.decode=="function"){let{decommpressedBody:a,buffers:c}=this._decompressBuffers(t,r,s);i=this._loadCompressedVectors(t,a,this.schema.fields),t=new Ye(t.length,t.nodes,c,null)}else throw new Error("Record batch is compressed but codec not found")}else i=this._loadVectors(t,r,this.schema.fields);let o=Q({type:new Yt(this.schema.fields),length:t.length,children:i});return new Zt(this.schema,o,n)}_loadDictionaryBatch(t,r){let{id:n,isDelta:i}=t,{dictionaries:o,schema:s}=this,a=o.get(n),c=s.dictionaries.get(n),l;if(t.data.compression!=null){let h=ca.get(t.data.compression.type);if(h?.decode&&typeof h.decode=="function"){let{decommpressedBody:u,buffers:f}=this._decompressBuffers(t.data,r,h);l=this._loadCompressedVectors(t.data,u,[c]),t=new Cr(new Ye(t.data.length,t.data.nodes,f,null,t.data.variadicBufferCounts),n,i)}else throw new Error("Dictionary batch is compressed but codec not found")}else l=this._loadVectors(t.data,r,[c]);return(a&&i?a.concat(new $(l)):new $(l)).memoize()}_loadVectors(t,r,n){return new Vl(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion,t.variadicBufferCounts).visitMany(n)}_loadCompressedVectors(t,r,n){return new Dp(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion,t.variadicBufferCounts).visitMany(n)}_decompressBuffers(t,r,n){let i=[],o=[],s=0;for(let{offset:a,length:c}of t.buffers){if(c===0){i.push(new Uint8Array(0)),o.push(new Fe(s,0));continue}let l=new hr(r.subarray(a,a+c)),h=It(l.readInt64(0)),u=l.bytes().subarray(8),f=h===-1?u:n.decode(u);i.push(f);let d=(s+7&-8)-s;s+=d,o.push(new Fe(s,f.length)),s+=f.length}return{decommpressedBody:i,buffers:o}}},Hl=class extends Xp{constructor(t,r){super(r),this._reader=Lm(t)?new _c(this._handle=t):new aa(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=DA(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):pe}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):pe}next(){if(this.closed)return pe;let t,{_reader:r}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i,t.metadata)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=r.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new yc(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},$l=class extends Xp{constructor(t,r){super(r),this._reader=new wc(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return Y(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return Y(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=DA(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return Y(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):pe})}return(t){return Y(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):pe})}next(){return Y(this,void 0,void 0,function*(){if(this.closed)return pe;let t,{_reader:r}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=yield r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i,t.metadata)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=yield r.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new yc(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return Y(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},Zp=class extends Hl{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,r){super(t instanceof zu?t:new zu(t),r)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let r of this._footer.dictionaryBatches())r&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var r;if(this.closed)return null;this._footer||this.open();let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(Nt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s,i.metadata)}}return null}_readDictionaryBatch(t){var r;let n=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(Nt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}}_readFooter(){let{_handle:t}=this,r=t.size-aM,n=t.readInt32(r),i=t.readAt(r-n,n);return bo.decode(i)}_readNextMessageAndValidate(t){var r;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(this._recordBatchIndex);if(n&&this._handle.seek(n.offset))return this._reader.readMessage(t)}return null}},uM=class extends $l{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...r){let n=typeof r[0]!="number"?r.shift():void 0,i=r[0]instanceof Map?r.shift():void 0;super(t instanceof Gs?t:new Gs(t,n),i)}isFile(){return!0}isAsync(){return!0}open(t){let r=Object.create(null,{open:{get:()=>super.open}});return Y(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield r.open.call(this,t)})}readRecordBatch(t){return Y(this,void 0,void 0,function*(){var r;if(this.closed)return null;this._footer||(yield this.open());let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(Nt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s,i.metadata)}}return null})}_readDictionaryBatch(t){return Y(this,void 0,void 0,function*(){var r;let n=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(Nt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}})}_readFooter(){return Y(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let r=t.size-aM,n=yield t.readInt32(r),i=yield t.readAt(r-n,n);return bo.decode(i)})}_readNextMessageAndValidate(t){return Y(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let r=this._footer.getRecordBatch(this._recordBatchIndex);if(r&&(yield this._handle.seek(r.offset)))return yield this._reader.readMessage(t)}return null})}},fM=class extends Hl{constructor(t,r){super(t,r)}_loadVectors(t,r,n){return new Lp(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion,t.variadicBufferCounts).visitMany(n)}}});function Gn(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new Fe(this._byteLength,t)),this._byteLength+=t,this}function xD(e){var t;let{type:r,length:n,typeIds:i,valueOffsets:o}=e;if(Gn.call(this,i),r.mode===jt.Sparse)return dM.call(this,e);if(r.mode===jt.Dense){if(e.offset<=0)return Gn.call(this,o),dM.call(this,e);{let s=new Int32Array(n),a=Object.create(null),c=Object.create(null);for(let l,h,u=-1;++u<n;)(l=i[u])!==void 0&&((h=a[l])===void 0&&(h=a[l]=o[u]),s[u]=o[u]-h,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);Gn.call(this,s),this.visitMany(e.children.map((l,h)=>{let u=r.typeIds[h],f=a[u],d=c[u];return l.slice(f,Math.min(n,d))}))}}return this}function SD(e){let t;return e.nullCount>=e.length?Gn.call(this,new Uint8Array(e.length+7>>3)):(t=e.values)instanceof Uint8Array?Gn.call(this,za(e.offset,e.length,t)):Gn.call(this,Va(e.values))}function Bo(e){return Gn.call(this,e.values.subarray(0,e.length*e.stride))}function Jp(e){let{length:t,values:r,valueOffsets:n}=e,i=It(n[0]),o=It(n[t]),s=Math.min(o-i,r.byteLength-i);return Gn.call(this,Vm(-i,t+1,n)),Gn.call(this,r.subarray(i,i+s)),this}function FA(e){let{offset:t,length:r,stride:n,values:i,variadicBuffers:o=[]}=e;if(!i)throw new Error("BinaryView data is missing view buffer");let s=t*n,a=s+r*n;Gn.call(this,i.subarray(s,a));for(let c of o)Gn.call(this,c);return this._variadicBufferCounts.push(o.length),this}function Qp(e){let{length:t,valueOffsets:r}=e;if(r){let n=It(r[0]),i=It(r[t]);return Gn.call(this,Vm(-n,t+1,r)),this.visit(e.children[0].slice(n,i-n))}return this.visit(e.children[0])}function dM(e){return this.visitMany(e.type.children.map((t,r)=>e.children[r]).filter(Boolean))[0]}var ge,UA=w(()=>{Ar();fn();Ne();Ro();Je();ka();Fs();te();ki();ge=class e extends rt{static assemble(...t){let r=i=>i.flatMap(o=>Array.isArray(o)?r(o):o instanceof Zt?o.data.children:o.data),n=new e;return n.visitMany(r(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[],this._variadicBufferCounts=[]}visit(t){if(t instanceof $)return this.visitMany(t.data),this;let{type:r}=t;if(!z.isDictionary(r)){let{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(z.isUnion(r))this.nodes.push(new Jn(n,0));else{let{nullCount:i}=t;z.isNull(r)||Gn.call(this,i<=0?new Uint8Array(0):za(t.offset,n,t.nullBitmap)),this.nodes.push(new Jn(n,i))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}get variadicBufferCounts(){return this._variadicBufferCounts}};ge.prototype.visitBool=SD;ge.prototype.visitInt=Bo;ge.prototype.visitFloat=Bo;ge.prototype.visitUtf8=Jp;ge.prototype.visitLargeUtf8=Jp;ge.prototype.visitUtf8View=FA;ge.prototype.visitBinary=Jp;ge.prototype.visitLargeBinary=Jp;ge.prototype.visitBinaryView=FA;ge.prototype.visitFixedSizeBinary=Bo;ge.prototype.visitDate=Bo;ge.prototype.visitTimestamp=Bo;ge.prototype.visitTime=Bo;ge.prototype.visitDecimal=Bo;ge.prototype.visitList=Qp;ge.prototype.visitLargeList=Qp;ge.prototype.visitStruct=dM;ge.prototype.visitUnion=xD;ge.prototype.visitInterval=Bo;ge.prototype.visitDuration=Bo;ge.prototype.visitFixedSizeList=Qp;ge.prototype.visitMap=Qp});var t0,GA=w(()=>{fn();Km();Ne();t0=class extends rt{visit(t){return t==null?void 0:super.visit(t)}visitNull({typeId:t}){return{name:lt[t].toLowerCase()}}visitInt({typeId:t,bitWidth:r,isSigned:n}){return{name:lt[t].toLowerCase(),bitWidth:r,isSigned:n}}visitFloat({typeId:t,precision:r}){return{name:lt[t].toLowerCase(),precision:Vt[r]}}visitBinary({typeId:t}){return{name:lt[t].toLowerCase()}}visitLargeBinary({typeId:t}){return{name:lt[t].toLowerCase()}}visitBinaryView({typeId:t}){return{name:lt[t].toLowerCase()}}visitBool({typeId:t}){return{name:lt[t].toLowerCase()}}visitUtf8({typeId:t}){return{name:lt[t].toLowerCase()}}visitLargeUtf8({typeId:t}){return{name:lt[t].toLowerCase()}}visitUtf8View({typeId:t}){return{name:lt[t].toLowerCase()}}visitDecimal({typeId:t,scale:r,precision:n,bitWidth:i}){return{name:lt[t].toLowerCase(),scale:r,precision:n,bitWidth:i}}visitDate({typeId:t,unit:r}){return{name:lt[t].toLowerCase(),unit:Qt[r]}}visitTime({typeId:t,unit:r,bitWidth:n}){return{name:lt[t].toLowerCase(),unit:q[r],bitWidth:n}}visitTimestamp({typeId:t,timezone:r,unit:n}){return{name:lt[t].toLowerCase(),unit:q[n],timezone:r}}visitInterval({typeId:t,unit:r}){return{name:lt[t].toLowerCase(),unit:Lt[r]}}visitDuration({typeId:t,unit:r}){return{name:lt[t].toLocaleLowerCase(),unit:q[r]}}visitList({typeId:t}){return{name:lt[t].toLowerCase()}}visitLargeList({typeId:t}){return{name:lt[t].toLowerCase()}}visitStruct({typeId:t}){return{name:lt[t].toLowerCase()}}visitUnion({typeId:t,mode:r,typeIds:n}){return{name:lt[t].toLowerCase(),mode:jt[r].toUpperCase(),typeIds:[...n]}}visitDictionary(t){return this.visit(t.dictionary)}visitFixedSizeBinary({typeId:t,byteWidth:r}){return{name:lt[t].toLowerCase(),byteWidth:r}}visitFixedSizeList({typeId:t,listSize:r}){return{name:lt[t].toLowerCase(),listSize:r}}visitMap({typeId:t,keysSorted:r}){return{name:lt[t].toLowerCase(),keysSorted:r}}}});function*mM(e){for(let t of e)yield t.reduce((r,n)=>`${r}${("0"+(n&255).toString(16)).slice(-2)}`,"").toUpperCase()}function*Oo(e,t){let r=new Uint32Array(e.buffer,e.byteOffset,e.byteLength/Uint32Array.BYTES_PER_ELEMENT);for(let n=-1,i=r.length/t;++n<i;)yield`${Fa.new(r.subarray((n+0)*t,(n+1)*t),!1)}`}function zA(e,t){let n=e.values,i=new DataView(n.buffer,n.byteOffset,n.byteLength),o=n.byteLength/16,s=f=>Array.from(f).map(d=>("0"+(d&255).toString(16)).slice(-2)).join("").toUpperCase(),a=Array.from({length:o},(f,d)=>{let m=d*16,p=i.getInt32(m,!0);return[m,p]}).map(([f,d])=>d>12?{SIZE:d,PREFIX_HEX:s(n.subarray(f+4,f+8)),BUFFER_INDEX:i.getInt32(f+8,!0),OFFSET:i.getInt32(f+12,!0)}:{SIZE:d,INLINED:t(n.subarray(f+4,f+4+d))}),c=[...new Set(a.map(f=>f.BUFFER_INDEX).filter(f=>f!==void 0))],l=c.map(f=>s(e.variadicBuffers[f])),h=new Map(c.map((f,d)=>[f,d]));return{VIEWS:a.map(f=>f.BUFFER_INDEX!==void 0?Object.assign(Object.assign({},f),{BUFFER_INDEX:h.get(f.BUFFER_INDEX)}):f),VARIADIC_DATA_BUFFERS:l}}var Ku,VA=w(()=>{Zm();Ar();fn();Ne();Ne();ka();Op();te();Ku=class e extends rt{static assemble(...t){let r=new e;return t.map(({schema:n,data:i})=>r.visitMany(n.fields,i.children))}visit({name:t},r){let{length:n}=r,{offset:i,nullCount:o,nullBitmap:s}=r,a=z.isDictionary(r.type)?r.type.indices:r.type,c=Object.assign([],r.buffers,{[xe.VALIDITY]:void 0});return Object.assign({name:t,count:n,VALIDITY:z.isNull(a)||z.isUnion(a)?void 0:o<=0?Array.from({length:n},()=>1):[...new Wi(s,i,n,null,_p)]},super.visit(r.clone(a,i,n,0,c)))}visitNull(){return{}}visitBool({values:t,offset:r,length:n}){return{DATA:[...new Wi(t,r,n,null,Ll)]}}visitInt(t){return{DATA:t.type.bitWidth<64?[...t.values]:[...Oo(t.values,2)]}}visitFloat(t){return{DATA:[...t.values]}}visitUtf8(t){return{DATA:[...new $([t])],OFFSET:[...t.valueOffsets]}}visitLargeUtf8(t){return{DATA:[...new $([t])],OFFSET:[...Oo(t.valueOffsets,2)]}}visitBinary(t){return{DATA:[...mM(new $([t]))],OFFSET:[...t.valueOffsets]}}visitLargeBinary(t){return{DATA:[...mM(new $([t]))],OFFSET:[...Oo(t.valueOffsets,2)]}}visitBinaryView(t){return zA(t,r=>Array.from(r).map(n=>("0"+(n&255).toString(16)).slice(-2)).join("").toUpperCase())}visitUtf8View(t){return zA(t,r=>Array.from(r).map(n=>String.fromCodePoint(n)).join(""))}visitFixedSizeBinary(t){return{DATA:[...mM(new $([t]))]}}visitDate(t){return{DATA:t.type.unit===Qt.DAY?[...t.values]:[...Oo(t.values,2)]}}visitTimestamp(t){return{DATA:[...Oo(t.values,2)]}}visitTime(t){return{DATA:t.type.unit<q.MICROSECOND?[...t.values]:[...Oo(t.values,2)]}}visitDecimal(t){return{DATA:[...Oo(t.values,4)]}}visitList(t){return{OFFSET:[...t.valueOffsets],children:this.visitMany(t.type.children,t.children)}}visitLargeList(t){return{OFFSET:[...Oo(t.valueOffsets,2)],children:this.visitMany(t.type.children,t.children)}}visitStruct(t){return{children:this.visitMany(t.type.children,t.children)}}visitUnion(t){return{TYPE_ID:[...t.typeIds],OFFSET:t.type.mode===jt.Dense?[...t.valueOffsets]:void 0,children:this.visitMany(t.type.children,t.children)}}visitInterval(t){switch(t.type.unit){case Lt.YEAR_MONTH:return{DATA:[...t.values]};case Lt.DAY_TIME:return{DATA:I_(t.values)};case Lt.MONTH_DAY_NANO:return{DATA:A_(t.values,!0)}}}visitDuration(t){return{DATA:[...Oo(t.values,2)]}}visitFixedSizeList(t){return{children:this.visitMany(t.type.children,t.children)}}visitMap(t){return{OFFSET:[...t.valueOffsets],children:this.visitMany(t.type.children,t.children)}}}});function pM(e,t){let r=t;t instanceof ce&&(r=t.batches,e.reset(void 0,t.schema));for(let n of r)e.write(n);return e.finish()}function gM(e,t){return Y(this,void 0,void 0,function*(){var r,n,i,o,s,a,c;try{for(r=!0,n=vn(t);i=yield n.next(),o=i.done,!o;r=!0){c=i.value,r=!1;let l=c;e.write(l)}}catch(l){s={error:l}}finally{try{!r&&!o&&(a=n.return)&&(yield a.call(n))}finally{if(s)throw s.error}}return e.finish()})}function kA({name:e,type:t,nullable:r}){let n=new t0;return{name:e,nullable:r,type:n.visit(t),children:(t.children||[]).map(i=>kA(i)),dictionary:z.isDictionary(t)?{id:t.id,isOrdered:t.isOrdered,indexType:n.visit(t.indices)}:void 0}}function vD(e,t,r=!1){let[n]=Ku.assemble(new Zt({[t]:e}));return JSON.stringify({id:t,isDelta:r,data:{count:e.length,columns:n}},null,2)}function ED(e){let[t]=Ku.assemble(e);return JSON.stringify({count:e.numRows,columns:t},null,2)}var Xi,Lo,Do,Xu,e0=w(()=>{an();gc();Yp();Ar();te();Fs();Fs();y_();Ne();$u();Us();UA();GA();VA();Je();Ro();Gu();fs();bl();Kp();Gt();Xi=class extends Ha{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,r){throw new Error('"throughDOM" not available in this environment')}constructor(t){if(super(),this._position=0,this._started=!1,this._compression=null,this._sink=new Qn,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,zr(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1,compressionType:null}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1,t.compressionType!=null){if(this._writeLegacyIpcFormat)throw new Error("Legacy IPC format does not support columnar compression. Use modern IPC format (writeLegacyIpcFormat=false).");if(Object.values(ur).includes(t.compressionType))this._compression=new Wa(t.compressionType);else{let r=Object.values(ur).filter(n=>typeof n=="string");throw new Error(`Unsupported compressionType: ${t.compressionType} Available types: ${r.join(", ")}`)}}else this._compression=null}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return Tn(t)?t.then(r=>this.writeAll(r)):Yn(t)?gM(this,t):pM(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,r=null){return t===this._sink||t instanceof Qn?this._sink=t:(this._sink=new Qn,t&&s3(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&a3(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!r||!pc(r,this._schema))&&(r==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=r,this._writeSchema(r))),this}write(t){let r=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof ce&&!(r=t.schema))return this.finish()&&void 0;if(t instanceof Zt&&!(r=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(r&&!pc(r,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,r)}t instanceof Zt?t instanceof yc||this._writeRecordBatch(t):t instanceof ce?this.writeAll(t.batches):ui(t)&&this.writeAll(t)}_writeMessage(t,r=8){let n=r-1,i=Nr.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+n&~n,c=a-o-s;return t.headerType===Nt.RecordBatch?this._recordBatchBlocks.push(new vi(a,t.bodyLength,this._position)):t.headerType===Nt.DictionaryBatch&&this._dictionaryBlocks.push(new vi(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-s)),o>0&&this._write(i),this._writePadding(c)}_write(t){if(this._started){let r=nt(t);r&&r.byteLength>0&&(this._sink.write(r),this._position+=r.byteLength)}return this}_writeSchema(t){return this._writeMessage(Nr.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(ql)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:r,nodes:n,bufferRegions:i,buffers:o,variadicBufferCounts:s}=this._assembleRecordBatch(t),a=new Ye(t.numRows,n,i,this._compression,s,t.metadata),c=Nr.from(a,r);return this._writeDictionaries(t)._writeMessage(c)._writeBodyBuffers(o)}_assembleRecordBatch(t){let{byteLength:r,nodes:n,bufferRegions:i,buffers:o,variadicBufferCounts:s}=ge.assemble(t);return this._compression!=null&&({byteLength:r,bufferRegions:i,buffers:o}=this._compressBodyBuffers(o)),{byteLength:r,nodes:n,bufferRegions:i,buffers:o,variadicBufferCounts:s}}_compressBodyBuffers(t){let r=ca.get(this._compression.type);if(!r?.encode||typeof r.encode!="function")throw new Error(`Codec for compression type "${ur[this._compression.type]}" has invalid encode method`);let n=0,i=[],o=[];for(let a of t){let c=nt(a);if(c.length===0){i.push(new Uint8Array(0),new Uint8Array(0)),o.push(new Fe(n,0));continue}let l=r.encode(c),h=l.length<c.length,u=h?l:c,f=h?u.length:-1,d=new hr(new Uint8Array(8));d.writeInt64(0,BigInt(f)),i.push(d.bytes(),new Uint8Array(u));let m=(n+7&-8)-n;n+=m;let p=8+u.length;o.push(new Fe(n,p)),n+=p}let s=(n+7&-8)-n;return n+=s,{byteLength:n,bufferRegions:o,buffers:i}}_writeDictionaryBatch(t,r,n=!1){let{byteLength:i,nodes:o,bufferRegions:s,buffers:a,variadicBufferCounts:c}=this._assembleRecordBatch(new $([t])),l=new Ye(t.length,o,s,this._compression,c),h=new Cr(l,r,n),u=Nr.from(h,i);return this._writeMessage(u)._writeBodyBuffers(a)}_writeBodyBuffers(t){let r=this._compression!=null?2:1,n=new Array(r);for(let i=0;i<t.length;i+=r){let o=0;for(let a=-1;++a<r;)n[a]=t[i+a],o+=n[a].byteLength;if(o===0)continue;for(let a of n)this._write(a);let s=(o+7&-8)-o;s>0&&this._writePadding(s)}return this}_writeDictionaries(t){var r,n;for(let[i,o]of t.dictionaries){let s=(r=o?.data)!==null&&r!==void 0?r:[],a=this._seenDictionaries.get(i),c=(n=this._dictionaryDeltaOffsets.get(i))!==null&&n!==void 0?n:0;if(!a||a.data[0]!==s[0])for(let[l,h]of s.entries())this._writeDictionaryBatch(h,i,l>0);else if(c<s.length)for(let l of s.slice(c))this._writeDictionaryBatch(l,i,!0);this._seenDictionaries.set(i,o),this._dictionaryDeltaOffsets.set(i,s.length)}return this}},Lo=class e extends Xi{static writeAll(t,r){let n=new e(r);return Tn(t)?t.then(i=>n.writeAll(i)):Yn(t)?gM(n,t):pM(n,t)}},Do=class e extends Xi{static writeAll(t,r){let n=new e(r);return Tn(t)?t.then(i=>n.writeAll(i)):Yn(t)?gM(n,t):pM(n,t)}constructor(t){super(t),this._autoDestroy=!0,this._writeLegacyIpcFormat=!1}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,r,n=!1){if(!n&&this._seenDictionaries.has(r))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,r,n)}_writeFooter(t){let r=bo.encode(new bo(t,Xt.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(r)._write(Int32Array.of(r.byteLength))._writeMagic()}},Xu=class e extends Xi{static writeAll(t){return new e().writeAll(t)}constructor(){super(),this._autoDestroy=!0,this._recordBatches=[],this._recordBatchesWithDictionaries=[]}_writeMessage(){return this}_writeFooter(t){return this}_writeSchema(t){return this._write(`{
19
+ "schema": ${JSON.stringify({fields:t.fields.map(r=>kA(r))},null,2)}`)}_writeDictionaries(t){return t.dictionaries.size>0&&this._recordBatchesWithDictionaries.push(t),this}_writeDictionaryBatch(t,r,n=!1){return this._write(this._dictionaryBlocks.length===0?" ":`,
20
+ `),this._write(vD(t,r,n)),this._dictionaryBlocks.push(new vi(0,0,0)),this}_writeRecordBatch(t){return this._writeDictionaries(t),this._recordBatches.push(t),this}close(){if(this._recordBatchesWithDictionaries.length>0){this._write(`,
21
21
  "dictionaries": [
22
22
  `);for(let t of this._recordBatchesWithDictionaries)super._writeDictionaries(t);this._write(`
23
23
  ]`)}if(this._recordBatches.length>0){for(let t=-1,r=this._recordBatches.length;++t<r;)this._write(t===0?`,
24
24
  "batches": [
25
25
  `:`,
26
- `),this._write(TD(this._recordBatches[t])),this._recordBatchBlocks.push(new vi(0,0,0));this._write(`
26
+ `),this._write(ED(this._recordBatches[t])),this._recordBatchBlocks.push(new vi(0,0,0));this._write(`
27
27
  ]`)}return this._schema&&this._write(`
28
- }`),this._recordBatchesWithDictionaries=[],this._recordBatches=[],super.close()}}});function $A(e,t){if(Yn(e))return AD(e,t);if(ui(e))return ID(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function ID(e,t){let r=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){o(s,r||(r=e[Symbol.iterator]()))},pull(s){r?o(s,r):s.close()},cancel(){r?.return&&r.return(),r=null}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){let c,l=null,h=s.desiredSize||null;for(;!(l=a.next(n?h:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=nt(l.value))&&(h!=null&&n&&(h=h-c.byteLength+1),l.value=c),s.enqueue(l.value),h!=null&&--h<=0)return;s.close()}}function AD(e,t){let r=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){return Y(this,void 0,void 0,function*(){yield o(s,r||(r=e[Symbol.asyncIterator]()))})},pull(s){return Y(this,void 0,void 0,function*(){r?yield o(s,r):s.close()})},cancel(){return Y(this,void 0,void 0,function*(){r?.return&&(yield r.return()),r=null})}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){return Y(this,void 0,void 0,function*(){let c,l=null,h=s.desiredSize||null;for(;!(l=yield a.next(n?h:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=nt(l.value))&&(h!=null&&n&&(h=h-c.byteLength+1),l.value=c),s.enqueue(l.value),h!=null&&--h<=0)return;s.close()})}}var YA=w(()=>{an();Je();fs()});function ZA(e){return new MM(e)}var MM,KA,XA,JA=w(()=>{an();qu();MM=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:r,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,o=a3(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Ei(o),this._getSize=i!=="bytes"?KA:XA;let{["highWaterMark"]:s=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},r),{["highWaterMark"]:a=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:s,size:i!=="bytes"?KA:XA}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:c=>this._writeValueAndReturnChunkSize(c)})}_writeValueAndReturnChunkSize(t){let r=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-r}_maybeFlush(t,r){r!=null&&(this._bufferedSize>=r.desiredSize&&++this._numChunks&&this._enqueue(r,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(r,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(r,null)))}_enqueue(t,r){this._bufferedSize=0,this._controller=null,r==null?t.close():t.enqueue(r)}},KA=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},XA=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0}});function r0(e,t){let r=new Qn,n=null,i=new ReadableStream({cancel(){return Y(this,void 0,void 0,function*(){yield r.close()})},start(a){return Y(this,void 0,void 0,function*(){yield s(a,n||(n=yield o()))})},pull(a){return Y(this,void 0,void 0,function*(){n?yield s(a,n):a.close()})}});return{writable:new WritableStream(r,Object.assign({highWaterMark:Math.pow(2,14)},e)),readable:i};function o(){return Y(this,void 0,void 0,function*(){return yield(yield Kr.from(r)).open(t)})}function s(a,c){return Y(this,void 0,void 0,function*(){let l=a.desiredSize,h=null;for(;!(h=yield c.next()).done;)if(a.enqueue(h.value),l!=null&&--l<=0)return;a.close()})}}var QA=w(()=>{an();Us();Yu()});function n0(e,t){let r=new this(e),n=new mn(r),i=new ReadableStream({cancel(){return Y(this,void 0,void 0,function*(){yield n.cancel()})},pull(s){return Y(this,void 0,void 0,function*(){yield o(s)})},start(s){return Y(this,void 0,void 0,function*(){yield o(s)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(r,e),readable:i};function o(s){return Y(this,void 0,void 0,function*(){let a=null,c=s.desiredSize;for(;a=yield n.read(c||null);)if(s.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;s.close()})}}var tP=w(()=>{an();Us()});function i0(e){let t=Kr.from(e);return Tn(t)?t.then(r=>i0(r)):t.isAsync()?t.readAll().then(r=>new ce(r)):new ce(t.readAll())}function bM(e,t="stream",r=null){let n={compressionType:r};return(t==="stream"?Lo:Do).writeAll(e,n).toUint8Array(!0)}var eP=w(()=>{gc();fs();Yu();e0()});var xM={};Zr(xM,{isArrowData:()=>c0,isArrowDataType:()=>a0,isArrowField:()=>s0,isArrowRecordBatch:()=>h0,isArrowSchema:()=>o0,isArrowTable:()=>u0,isArrowVector:()=>l0});function o0(e){return _t.isSchema(e)}function s0(e){return Z.isField(e)}function a0(e){return z.isDataType(e)}function c0(e){return ut.isData(e)}function l0(e){return $.isVector(e)}function h0(e){return Zt.isRecordBatch(e)}function u0(e){return ce.isTable(e)}var SM=w(()=>{Rr();te();Zn();Ar();Ro();gc()});var rP,vM=w(()=>{Xm();bl();Ne();Zn();te();gc();Ar();fn();Rr();Ou();gp();me();qu();O_();H_();B_();L_();D_();F_();G_();k_();K_();Y_();z_();V_();Z_();Q_();J_();Fp();Gp();Up();q_();j_();U_();W_();$_();X_();Us();Yu();e0();eP();Kp();Yp();Fs();Ro();SM();Zm();I_();ka();Nu();Je();Bl();vu();Bp();SM();$u();rP=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Xw),T_),f_),Zw),gw),u_),Hw),N_),xM),{compareSchemas:pc,compareFields:vA,compareTypes:kp})});var Mc={};Zr(Mc,{AsyncByteQueue:()=>Qn,AsyncByteStream:()=>mn,AsyncMessageReader:()=>wc,AsyncRecordBatchFileReader:()=>Wl,AsyncRecordBatchStreamReader:()=>Co,Binary:()=>ln,BinaryBuilder:()=>vo,BinaryView:()=>Mt,BinaryViewBuilder:()=>Io,Bool:()=>Er,BoolBuilder:()=>$a,BufferType:()=>xe,Builder:()=>oe,ByteStream:()=>ti,CompressionType:()=>ur,Data:()=>ut,DataType:()=>z,DateBuilder:()=>$i,DateDay:()=>bs,DateDayBuilder:()=>zs,DateMillisecond:()=>xs,DateMillisecondBuilder:()=>Vs,DateUnit:()=>Qt,Date_:()=>jr,Decimal:()=>hn,DecimalBuilder:()=>ks,DenseUnion:()=>wo,DenseUnionBuilder:()=>dc,Dictionary:()=>We,DictionaryBuilder:()=>Ya,Duration:()=>Wr,DurationBuilder:()=>ei,DurationMicrosecond:()=>Pu,DurationMicrosecondBuilder:()=>Ks,DurationMillisecond:()=>Au,DurationMillisecondBuilder:()=>Ys,DurationNanosecond:()=>Ru,DurationNanosecondBuilder:()=>Xs,DurationSecond:()=>Iu,DurationSecondBuilder:()=>$s,Field:()=>Z,FixedSizeBinary:()=>un,FixedSizeBinaryBuilder:()=>qs,FixedSizeList:()=>_e,FixedSizeListBuilder:()=>Ka,Float:()=>Sr,Float16:()=>_i,Float16Builder:()=>Xa,Float32:()=>kr,Float32Builder:()=>Za,Float64:()=>On,Float64Builder:()=>Ja,FloatBuilder:()=>Yi,Int:()=>Se,Int16:()=>Pn,Int16Builder:()=>tc,Int32:()=>Ve,Int32Builder:()=>ec,Int64:()=>Rn,Int64Builder:()=>rc,Int8:()=>An,Int8Builder:()=>Qa,IntBuilder:()=>$r,Interval:()=>Tr,IntervalBuilder:()=>Ti,IntervalDayTime:()=>Rs,IntervalDayTimeBuilder:()=>js,IntervalMonthDayNano:()=>Tu,IntervalMonthDayNanoBuilder:()=>Hs,IntervalUnit:()=>Lt,IntervalYearMonth:()=>Cs,IntervalYearMonthBuilder:()=>Ws,JSONMessageReader:()=>_c,LargeBinary:()=>Mi,LargeBinaryBuilder:()=>Eo,LargeList:()=>Bn,LargeListBuilder:()=>cc,LargeUtf8:()=>bi,LargeUtf8Builder:()=>sa,List:()=>je,ListBuilder:()=>ac,MapBuilder:()=>lc,MapRow:()=>Xn,Map_:()=>Ir,Message:()=>Nr,MessageHeader:()=>Nt,MessageReader:()=>aa,MetadataVersion:()=>Xt,Null:()=>De,NullBuilder:()=>hc,Precision:()=>Vt,RecordBatch:()=>Zt,RecordBatchFileReader:()=>No,RecordBatchFileWriter:()=>Do,RecordBatchJSONWriter:()=>Xu,RecordBatchReader:()=>Kr,RecordBatchStreamReader:()=>Ii,RecordBatchStreamWriter:()=>Lo,RecordBatchWriter:()=>Xi,Schema:()=>_t,SparseUnion:()=>Ns,SparseUnionBuilder:()=>fc,Struct:()=>Yt,StructBuilder:()=>uc,StructRow:()=>ji,Table:()=>ce,Time:()=>fr,TimeBuilder:()=>ni,TimeMicrosecond:()=>Es,TimeMicrosecondBuilder:()=>na,TimeMillisecond:()=>vs,TimeMillisecondBuilder:()=>ra,TimeNanosecond:()=>Ts,TimeNanosecondBuilder:()=>ia,TimeSecond:()=>Ss,TimeSecondBuilder:()=>ea,TimeUnit:()=>q,Timestamp:()=>dr,TimestampBuilder:()=>ri,TimestampMicrosecond:()=>As,TimestampMicrosecondBuilder:()=>Qs,TimestampMillisecond:()=>qi,TimestampMillisecondBuilder:()=>Js,TimestampNanosecond:()=>Ps,TimestampNanosecondBuilder:()=>ta,TimestampSecond:()=>Is,TimestampSecondBuilder:()=>Zs,Type:()=>x,Uint16:()=>Nn,Uint16Builder:()=>ic,Uint32:()=>Vr,Uint32Builder:()=>oc,Uint64:()=>wi,Uint64Builder:()=>sc,Uint8:()=>Cn,Uint8Builder:()=>nc,Union:()=>Hr,UnionBuilder:()=>To,UnionMode:()=>jt,Utf8:()=>vr,Utf8Builder:()=>oa,Utf8View:()=>qr,Utf8ViewBuilder:()=>mc,Vector:()=>$,Visitor:()=>rt,builderThroughAsyncIterable:()=>iM,builderThroughIterable:()=>jp,compressionRegistry:()=>ca,isArrowData:()=>c0,isArrowDataType:()=>a0,isArrowField:()=>s0,isArrowRecordBatch:()=>h0,isArrowSchema:()=>o0,isArrowTable:()=>u0,isArrowVector:()=>l0,makeBuilder:()=>Ei,makeData:()=>Q,makeTable:()=>oM,makeVector:()=>Hi,tableFromArrays:()=>sM,tableFromIPC:()=>i0,tableFromJSON:()=>nM,tableToIPC:()=>bM,util:()=>rP,vectorFromArray:()=>kl});var Yl=w(()=>{lu();me();Yu();e0();YA();JA();QA();tP();vM();vM();lr.toDOMStream=$A;oe.throughDOM=ZA;Kr.throughDOM=r0;No.throughDOM=r0;Ii.throughDOM=r0;Xi.throughDOM=n0;Do.throughDOM=n0;Lo.throughDOM=n0});function f0(e){return{fields:e.fields.map(t=>bc(t)),metadata:sP(e.metadata)}}function sP(e){return Object.fromEntries(e)}function EM(e){return e?new Map(Object.entries(e)):new Map}function bc(e){return{name:e.name,type:aP(e.type),nullable:e.nullable,metadata:sP(e.metadata)}}function Fo(e,t){return new Z(e.name,d0(e.type,t),e.nullable,EM(e.metadata))}function aP(e){if(nP(e,"BinaryView"))return"binary-view";if(nP(e,"Utf8View"))return"utf8-view";if(PD(e,"LargeList"))return{type:"large-list",children:[bc(e.valueField)]};switch(e.constructor){case De:return"null";case ln:return"binary";case un:return{type:"fixed-size-binary",byteWidth:e.byteWidth};case Er:return"bool";case Se:let t=e;return`${t.isSigned?"":"u"}int${t.bitWidth}`;case An:return"int8";case Pn:return"int16";case Ve:return"int32";case Rn:return"int64";case Cn:return"uint8";case Nn:return"uint16";case Vr:return"uint32";case wi:return"uint64";case Sr:switch(e.precision){case Vt.HALF:return"float16";case Vt.SINGLE:return"float32";case Vt.DOUBLE:return"float64";default:return"float16"}case _i:return"float16";case kr:return"float32";case On:return"float64";case vr:return"utf8";case hn:let n=e;return{type:"decimal",bitWidth:n.bitWidth,precision:n.precision,scale:n.scale};case jr:return e.unit===Qt.DAY?"date-day":"date-millisecond";case bs:return"date-day";case xs:return"date-millisecond";case fr:switch(e.unit){case q.SECOND:return"time-second";case q.MILLISECOND:return"time-millisecond";case q.MICROSECOND:return"time-microsecond";case q.NANOSECOND:return"time-nanosecond";default:return"time-second"}case vs:return"time-millisecond";case Ss:return"time-second";case Es:return"time-microsecond";case Ts:return"time-nanosecond";case dr:switch(e.unit){case q.SECOND:return"timestamp-second";case q.MILLISECOND:return"timestamp-millisecond";case q.MICROSECOND:return"timestamp-microsecond";case q.NANOSECOND:return"timestamp-nanosecond";default:return"timestamp-second"}case Is:return"timestamp-second";case qi:return"timestamp-millisecond";case As:return"timestamp-microsecond";case Ps:return"timestamp-nanosecond";case Tr:switch(e.unit){case Lt.DAY_TIME:return"interval-daytime";case Lt.YEAR_MONTH:return"interval-yearmonth";default:return"interval-daytime"}case Rs:return"interval-daytime";case Cs:return"interval-yearmonth";case Ir:let c=e;return{type:"map",keysSorted:c.keysSorted,children:c.children.map(p=>bc(p))};case je:let h=e.valueField;return{type:"list",children:[bc(h)]};case _e:let u=e;return{type:"fixed-size-list",listSize:u.listSize,children:[bc(u.children[0])]};case Yt:return{type:"struct",children:e.children.map(p=>bc(p))};case Ns:case wo:let d=e;return{type:d instanceof wo?"dense-union":"sparse-union",typeIds:d.typeIds,children:d.children.map(p=>bc(p)),typeIdToChildIndex:{...d.typeIdToChildIndex}};case We:let m=e;return{type:"dictionary",id:m.id,indices:RD(m.indices),dictionary:aP(m.dictionary),isOrdered:m.isOrdered};default:throw new Error(`arrow type not supported: ${e.constructor.name}`)}}function d0(e,t){if(typeof e=="object")switch(e.type){case"decimal":return new hn(e.scale,e.precision,e.bitWidth);case"map":{let r=e.children.map(n=>Fo(n,t));return new Ir(r[0],e.keysSorted)}case"list":{let r=Fo(e.children[0],t);return new je(r)}case"large-list":{let r=Fo(e.children[0],t),n=Zu("LargeList");if(!n)throw new Error("LargeList requires an Apache Arrow runtime that exports the LargeList constructor");return new n(r)}case"fixed-size-list":{let r=Fo(e.children[0],t);return new _e(e.listSize,r)}case"fixed-size-binary":return new un(e.byteWidth);case"struct":{let r=e.children.map(n=>Fo(n,t));return new Yt(r)}case"sparse-union":case"dense-union":{let r=e.children.map(n=>Fo(n,t));return e.type==="dense-union"?new wo(e.typeIds,r):new Ns(e.typeIds,r)}case"dictionary":return new We(d0(e.dictionary,t),ND(e.indices),e.id,e.isOrdered);default:throw new Error("array type not supported")}switch(e){case"null":return new De;case"binary":return iP("BinaryView",new ln,t);case"binary-view":return oP("BinaryView");case"bool":return new Er;case"int8":return new An;case"int16":return new Pn;case"int32":return new Ve;case"int64":return new Rn;case"uint8":return new Cn;case"uint16":return new Nn;case"uint32":return new Vr;case"uint64":return new wi;case"float16":return new _i;case"float32":return new kr;case"float64":return new On;case"utf8":return iP("Utf8View",new vr,t);case"utf8-view":return oP("Utf8View");case"date-day":return new bs;case"date-millisecond":return new xs;case"time-second":return new Ss;case"time-millisecond":return new vs;case"time-microsecond":return new Es;case"time-nanosecond":return new Ts;case"timestamp-second":return new Is;case"timestamp-millisecond":return new qi;case"timestamp-microsecond":return new As;case"timestamp-nanosecond":return new Ps;case"interval-daytime":return new Rs;case"interval-yearmonth":return new Cs;default:throw new Error("array type not supported")}}function Zu(e){return Mc[e]}function nP(e,t){let r=Zu(t);if(r&&e instanceof r)return!0;let n=z;return!!(t==="BinaryView"?n.isBinaryView:n.isUtf8View)?.(e)}function PD(e,t){let r=Zu(t);return!!(r&&e instanceof r)}function iP(e,t,r){let n=r?.viewTypes||"never";if(n==="never")return t;let i=Zu(e);if(i)return new i;if(n==="require")throw new Error(`${e} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`);return t}function oP(e){let t=Zu(e);if(!t)throw new Error(`${e} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`);return new t}function RD(e){if(e instanceof Se){let r=`${e.isSigned?"int":"uint"}${e.bitWidth}`;if(CD(r))return r}switch(e.constructor){case An:return"int8";case Pn:return"int16";case Ve:return"int32";case Cn:return"uint8";case Nn:return"uint16";case Vr:return"uint32";default:throw new Error(`arrow dictionary index type not supported: ${e.constructor.name}`)}}function CD(e){return["int8","int16","int32","uint8","uint16","uint32"].includes(e)}function ND(e){switch(e){case"int8":return new An;case"int16":return new Pn;case"int32":return new Ve;case"uint8":return new Cn;case"uint16":return new Nn;case"uint32":return new Vr;default:throw new Error(`schema dictionary index type not supported: ${e}`)}}var m0=w(()=>{"use strict";Yl()});function TM(e){return!!(e&&typeof e=="object"&&"schema"in e&&"batches"in e&&Array.isArray(e.batches)&&"numRows"in e&&typeof e.numRows=="number"&&"getChildAt"in e&&typeof e.getChildAt=="function")}var cP=w(()=>{"use strict"});function p0(e){let t=e?.POSITION;if(!t||!("value"in t)||!t.value.length)return null;let r=1/0,n=1/0,i=1/0,o=-1/0,s=-1/0,a=-1/0,c=t.value,l=c.length;for(let h=0;h<l;h+=3){let u=c[h],f=c[h+1],d=c[h+2];r=u<r?u:r,n=f<n?f:n,i=d<i?d:i,o=u>o?u:o,s=f>s?f:s,a=d>a?d:a}return[[r,n,i],[o,s,a]]}var lP=w(()=>{"use strict"});var hP=w(()=>{"use strict";lP()});function IM(e){let t=od();return new t(e)}function la(e){return!!(Fc&&e instanceof Fc)}function AM(e,t,r){la(e)?e[t]=r:e[t]=uP(r)}function PM(e,t){return la(e)?e[t]:OD(e[t])}function Ju(e){return la(e)?new Uint16Array(e.buffer,e.byteOffset,e.length):e}function uP(e){if(!Number.isFinite(e))return e===1/0?31744:e===-1/0?64512:32256;let t=e<0||Object.is(e,-0)?32768:0,r=Math.abs(e);if(r===0)return t;if(r>=65520)return t|31744;if(r>=65504)return t|31743;let n=Math.floor(Math.log2(r));if(n<-14)return t|Math.round(r/2**-24);let i=n+15,o=Math.round((r/2**n-1)*1024);return o===1024?t|i+1<<10:t|i<<10|o}function OD(e){let t=e&32768?-1:1,r=e>>10&31,n=e&1023;return r===0?t*n*2**-24:r===31?n?NaN:t*(1/0):t*(1+n/1024)*2**(r-15)}var fP=w(()=>{"use strict";qt()});var g0,RM,dP=w(()=>{"use strict";Yl();g0=new _t([new Z("POSITION",new _e(3,new Z("value",new kr,!1)),!1)]),RM=new _t([...g0.fields,new Z("indices",new je(new Z("item",new Vr,!1)),!0)])});var Qu=w(()=>{"use strict";fP();dP()});function mP(e){return e.type instanceof _e?e.type.listSize:1}function CM(e,t,r){let n=BD(e,t,r);return new $([n])}function BD(e,t,r){let n=LD(e,t,r),i=n.children[0].type,o=r==="float16"&&la(e)?Ju(e):e,s={[xe.DATA]:o},a=new ut(i,0,o.length,0,s);return new ut(n,0,o.length/t,0,void 0,[a])}function LD(e,t,r){let n=r||i3(e).type,i=d0(n);return new _e(t,new Z("value",i,!1))}var NM=w(()=>{"use strict";Qu();Yl();o3();m0()});function OM(e,t){return gP(e.attributes,{schema:e.schema,topology:e.topology,mode:e.mode,boundingBox:e.header?.boundingBox,indices:UD(e)?e.indices:void 0})}function gP(e,t={}){let r=[],n={},i=FD(e);for(let c of i){let l=e[c],{value:h,size:u=1}=l,f=DD(h,u,l.componentType);if(n[c]=f,r.push(GD(t.schema,c,f,l.componentType)),c==="POSITION"&&t.indices?.value?.length){let d=RM.fields.find(m=>m.name==="indices");n.indices=VD(t.indices.value,f.length,d.type),r.push(d)}}let o=new _t(r,kD(t)),s=n[i[0]]?.length===0?new ce(o):new ce(o,n);return{shape:"arrow-table",schema:f0(s.schema),data:s,topology:t.topology||"point-list",indices:t.indices}}function DD(e,t,r){if(r==="float16"){let n=la(e)?Ju(e):e;if(t===1){let i=new ut(new _i,0,n.length,0,{[xe.DATA]:n});return new $([i])}return CM(e,t,r)}return t===1?Hi(e):CM(e,t)}function FD(e){let t=Object.keys(e),r=pP.filter(i=>i in e),n=t.filter(i=>!pP.includes(i));return[...r,...n]}function UD(e){return!!e.indices?.value?.length}function GD(e,t,r,n){if(t==="POSITION"&&zD(r)){let o=g0.fields[0],s=e?.fields.find(c=>c.name===t);if(!s?.metadata)return o;let a=new Map(o.metadata);for(let[c,l]of Object.entries(s.metadata))a.set(c,l);return new Z(o.name,o.type,o.nullable,a)}let i=e?.fields.find(o=>o.name===t);if(n==="float16"){let o=new Map(Object.entries(i?.metadata||{}));return o.set("componentType","float16"),new Z(t,r.type,!1,o)}if(i&&i.type.toString()!==r.type.toString()){let o=Fo(i);return new Z(t,r.type,o.nullable,o.metadata)}return i?Fo(i):new Z(t,r.type,!1)}function zD(e){return e.type instanceof _e&&e.type.listSize===3&&e.type.children[0].type instanceof kr}function VD(e,t,r){let n=r,i=e instanceof Uint32Array?e:Uint32Array.from(e),o=new Int32Array(t+1);t>0&&o.fill(i.length,1);let s=new Uint8Array(Math.ceil(t/8));t>0&&(s[0]=1);let a=new ut(n.children[0].type,0,i.length,0,{[xe.DATA]:i}),c=new ut(n,0,t,Math.max(0,t-1),{[xe.OFFSET]:o,[xe.VALIDITY]:s},[a]);return new $([c])}function kD(e){let t={...e.schema?.metadata};return e.topology&&(t.topology||=e.topology),Number.isFinite(e.mode)&&(t.mode||=String(e.mode)),e.boundingBox&&(t.boundingBox||=JSON.stringify(e.boundingBox)),EM(t)}var pP,yP=w(()=>{"use strict";Qu();Qu();Yl();NM();m0();pP=["POSITION"]});function _P(e){if(TM(e)||e.shape==="arrow-table")return wP(e);throw new Error(e.shape)}function wP(e){let t=TM(e)?e:e.data,r=f0(t.schema),n=t.batches.length===1?t.batches[0].metadata.get("boundingBox"):void 0;n&&(r.metadata={...r.metadata,boundingBox:n});let i=r.fields,o={},s=[];for(let u of i){let{name:f}=u;if(f==="indices")continue;let d=t.getChild(f),m=mP(d),p=$D(d,m),g=jD(u.metadata),y=g.componentType==="float16"?YD(p):p,_=s.find(M=>M.data.length===d.data.length&&o[M.name].value.constructor===y.constructor&&M.data.every((b,v)=>MP(b,d.data[v])));o[f]={value:_?o[_.name].value:y,size:m,...g},_||s.push({name:f,data:d.data})}HD(r);let a=r.metadata.topology,c=KD(r),l=XD(t),h=o.POSITION?.transform?.type==="quantization"?qD(r)||p0(o):p0(o);return{schema:r,attributes:o,topology:a,mode:c,indices:l,header:{vertexCount:t.numRows,boundingBox:h??void 0}}}function qD(e){let t=e.metadata?.boundingBox;if(!t)return null;try{let r=JSON.parse(t);if(Array.isArray(r)&&r.length===2&&r.every(n=>Array.isArray(n)&&n.length===3&&n.every(i=>typeof i=="number")))return r}catch{}return null}function jD(e={}){let t={};if(e.byteOffset!==void 0&&(t.byteOffset=Number(e.byteOffset)),e.byteStride!==void 0&&(t.byteStride=Number(e.byteStride)),e.normalized!==void 0&&(t.normalized=e.normalized==="true"),e.componentType==="float16"&&(t.componentType="float16"),e["loaders.gl.transform"])try{let r=JSON.parse(e["loaders.gl.transform"]);WD(r)&&(t.transform=r)}catch{}return t}function WD(e){if(!e||typeof e!="object"||!("type"in e))return!1;let t=e;return t.type==="octahedron"?Number.isInteger(t.bits)&&t.bits>=1&&t.bits<=30:t.type==="quantization"&&Number.isInteger(t.bits)&&t.bits>=1&&t.bits<=30&&Array.isArray(t.origin)&&t.origin.every(r=>typeof r=="number")&&typeof t.range=="number"}function HD(e){e.metadata||={},e.metadata.topology||="point-list",e.metadata.mode||="0"}function $D(e,t){if(!(e.type instanceof _e))return e.toArray();let n=e.data[0].children[0].values.constructor,i=new n(e.length*t),o=0;for(let s of e.data){let a=s.children[0],c=s.length*t,l=a.offset||s.offset*t,h=l+c<=a.values.length?l:0,u=a.values.subarray(h,h+c);i.set(u,o),o+=c}return i}function YD(e){let t=IM(e.length);for(let r=0;r<e.length;r++)AM(t,r,PM(e,r));return t}function KD(e){let t=Number(e.metadata?.mode);return Number.isFinite(t)?t:0}function XD(e){let t=e.getChild("indices");if(!t?.isValid(0))return;let r=t.data[0],n=r.valueOffsets,i=n[r.offset],o=n[r.offset+1];return{value:r.children[0].values.subarray(i,o),size:1}}function MP(e,t){let r=Object.values(t.buffers);return e.type.toString()===t.type.toString()&&e.offset===t.offset&&e.length===t.length&&e.nullCount===t.nullCount&&e.dictionary===t.dictionary&&Object.values(e.buffers).every((n,i)=>{let o=r[i];return n===o||!!(n&&o&&n.buffer===o.buffer&&n.byteOffset===o.byteOffset&&n.byteLength===o.byteLength)})&&e.children.length===t.children.length&&e.children.every((n,i)=>MP(n,t.children[i]))}var bP=w(()=>{"use strict";Qu();Yl();NM();m0();cP();hP()});function xP(e){return[e.value.constructor.name,e.value.byteOffset,e.value.byteLength,e.size,e.byteOffset??0,e.byteStride||e.size*e.value.BYTES_PER_ELEMENT].join(":")}var tf,SP=w(()=>{"use strict";bP();tf=class{ready;sourcePointCount=0;get pointCount(){return this.sourcePointCount}controller=new AbortController;options;signal;mesh=null;nodes=new Map;indexBytes=0;pointByteLength=0;constructor(t,r={}){this.options={nodePointLimit:r.nodePointLimit??5e4,maximumDepth:r.maximumDepth??16,maxInputBytes:r.maxInputBytes??512*1024*1024,maxIndexBytes:r.maxIndexBytes??128*1024*1024,maxTileBytes:r.maxTileBytes??64*1024*1024,maxNodes:r.maxNodes??1e5};for(let[n,i]of Object.entries(this.options))if(!Number.isSafeInteger(i)||i<(n==="maximumDepth"?0:1))throw new Error(`PointCloudTiler: invalid ${n}`);if(this.options.maximumDepth>24||this.options.nodePointLimit>1e6)throw new Error("PointCloudTiler: maximumDepth must be <= 24 and nodePointLimit <= 1000000");this.signal=r.signal?AbortSignal.any([r.signal,this.controller.signal]):this.controller.signal,this.ready=this.initialize(t).catch(n=>{throw this.close(),n})}async getRootNode(){return await this.ready,this.getNode("r").node}async getNodeMetadata(t){return await this.ready,this.getNode(t).node}async getChildNodes(t){await this.ready;let r=this.getNode(t);return r.childrenPromise||(r.childrenPromise=this.splitNode(r)),r.childrenPromise}async splitNode(t){let r=t.node.id;if(t.children)return t.children;let n=Array.from({length:8},()=>0),i=t.node.bounds[0].map((a,c)=>a+(t.node.bounds[1][c]-a)/2);for(let a=0;a<t.remaining.length;a++)a%65536===0&&await this.checkpoint(),n[this.getOctant(t.remaining[a],i)]++;if(this.nodes.size+n.filter(a=>a>0).length>this.options.maxNodes)throw new Error("PointCloudTiler: node budget exceeded");let o=[],s=[];try{for(let c of n)s.push(this.allocateRows(c));let a=new Uint32Array(8);for(let c=0;c<t.remaining.length;c++){c%65536===0&&await this.checkpoint();let l=t.remaining[c],h=this.getOctant(l,i);s[h][a[h]++]=l}for(let c=0;c<8;c++){if(!s[c].length)continue;let l=t.node.bounds.map(u=>[...u]);for(let u=0;u<3;u++)l[c&4>>u?0:1][u]=i[u];let h=await this.createNode(`${r}${c}`,l,s[c]);s[c]=new Uint32Array(0),o.push(h.node)}return this.releaseRows(t.remaining),t.remaining=new Uint32Array(0),t.children=Object.freeze(o),t.children}catch(a){throw this.close(),a}}async getTileMesh(t){await this.ready;let r=this.getNode(t);if(r.rows.length*this.pointByteLength>this.options.maxTileBytes)throw new Error("PointCloudTiler: tile byte budget exceeded");let i={},o=new Map;for(let[s,a]of Object.entries(this.mesh.attributes)){let c=xP(a),l=o.get(a.value.buffer)?.get(c);if(l){i[s]={...a,value:l,byteOffset:0,byteStride:0};continue}let h=a.value.constructor,u=new h(r.rows.length*a.size),f=new Uint8Array(a.value.buffer,a.value.byteOffset,a.value.byteLength),d=new Uint8Array(u.buffer,u.byteOffset,u.byteLength),m=a.value.BYTES_PER_ELEMENT,p=a.size*m,g=a.byteStride||p;for(let _=0;_<r.rows.length;_++){_%65536===0&&await this.checkpoint();let M=(a.byteOffset||0)+r.rows[_]*g;d.set(f.subarray(M,M+p),_*p)}let y=o.get(a.value.buffer)??new Map;y.set(c,u),o.set(a.value.buffer,y),i[s]={...a,value:u,byteOffset:0,byteStride:0}}return{...this.mesh,attributes:i,topology:"point-list",mode:0,indices:void 0,header:{vertexCount:r.rows.length,boundingBox:r.node.bounds.map(s=>[...s])},loaderData:{...this.mesh.loaderData,pointCloudTileId:t}}}close(){this.controller.abort(new Error("PointCloudTiler: closed")),this.mesh=null,this.nodes.clear(),this.indexBytes=0}async initialize(t){if(this.signal.throwIfAborted(),!("attributes"in t)){let f="shape"in t?t.data:t,d=new Set,m=0,p=g=>{if(g.nullCount)throw new Error("PointCloudTiler: null point attributes require an explicit mapping");for(let y of Object.values(g.buffers))y&&!d.has(y.buffer)&&(d.add(y.buffer),m+=y.buffer.byteLength);for(let y of g.children)p(y);if(g.dictionary)for(let y of g.dictionary.data)p(y)};for(let g of f.batches)p(g.data);if(m>this.options.maxInputBytes)throw new Error("PointCloudTiler: input byte budget exceeded");for(let g of f.schema.fields)if(f.getChild(g.name)?.nullCount)throw new Error("PointCloudTiler: null point attributes require an explicit mapping")}let r="attributes"in t?t:_P(t);if(r.topology!=="point-list"||r.indices)throw new Error("PointCloudTiler: unindexed point-list input required");let n=r.attributes.POSITION;if(!n||n.size!==3||!(n.value instanceof Float32Array||n.value instanceof Float64Array)||n.transform||n.normalized||n.componentType==="float16")throw new Error("PointCloudTiler: POSITION requires decoded floating-point XYZ");if(!r.header&&(n.byteOffset||n.byteStride))throw new Error("PointCloudTiler: strided POSITION requires vertexCount");let i=r.header?.vertexCount??n.value.length/3;if(!Number.isSafeInteger(i)||i<0||i>4294967295)throw new Error("PointCloudTiler: invalid point count");let o=0,s=new Map,a=new Set;for(let f of Object.values(r.attributes)){this.validateAttribute(f,i),a.has(f.value.buffer)||(a.add(f.value.buffer),o+=f.value.buffer.byteLength);let d=s.get(f.value.buffer)??new Set,m=xP(f);d.has(m)||(this.pointByteLength+=f.size*f.value.BYTES_PER_ELEMENT,d.add(m),s.set(f.value.buffer,d))}if(o>this.options.maxInputBytes)throw new Error("PointCloudTiler: input byte budget exceeded");this.mesh=r,this.sourcePointCount=i;let c=this.allocateRows(i),l=[1/0,1/0,1/0],h=[-1/0,-1/0,-1/0];for(let f=0;f<i;f++){f%65536===0&&await this.checkpoint(),c[f]=f;for(let d=0;d<3;d++){let m=this.getCoordinate(f,d);if(!Number.isFinite(m))throw new Error("PointCloudTiler: nonfinite position");l[d]=Math.min(l[d],m),h[d]=Math.max(h[d],m)}}i||(l.fill(0),h.fill(0));let u=Math.max(...l.map((f,d)=>h[d]-f));if(!Number.isFinite(u))throw new Error("PointCloudTiler: coordinate extent overflow");for(let f=0;f<3;f++)h[f]=l[f]+u;if(!h.every(Number.isFinite)||!Number.isFinite(Math.hypot(u,u,u)))throw new Error("PointCloudTiler: coordinate extent overflow");await this.createNode("r",[l,h],c),this.signal.throwIfAborted()}async createNode(t,r,n){let i=t.length-1>=this.options.maximumDepth||r[0].every((c,l)=>c===r[1][l])||n.length<=this.options.nodePointLimit,o=n,s=new Uint32Array(0);if(!i){let c=Math.ceil(Math.cbrt(this.options.nodePointLimit)),l=new Set,h=this.allocateRows(Math.min(n.length,this.options.nodePointLimit)),u=this.allocateRows(n.length),f=0,d=0;for(let m=0;m<n.length;m++){m%65536===0&&await this.checkpoint();let p=n[m],g=0;for(let y=0;y<3;y++){let _=Math.min(c-1,Math.floor((this.getCoordinate(p,y)-r[0][y])/(r[1][y]-r[0][y])*c));g=g*c+_}f<h.length&&!l.has(g)?(l.add(g),h[f++]=p):u[d++]=p}o=h.subarray(0,f),s=u.subarray(0,d),this.releaseRows(n)}let a={node:{id:t,level:t.length-1,pointCount:o.length,bounds:r,geometricError:s.length?Math.hypot(...r[0].map((c,l)=>r[1][l]-c)):0},rows:o,remaining:s};if(Object.freeze(r[0]),Object.freeze(r[1]),Object.freeze(r),Object.freeze(a.node),this.signal.throwIfAborted(),this.nodes.size>=this.options.maxNodes)throw new Error("PointCloudTiler: node budget exceeded");return this.nodes.set(t,a),a}getCoordinate(t,r){let n=this.mesh.attributes.POSITION;return Number(n.value[(n.byteOffset||0)/n.value.BYTES_PER_ELEMENT+t*(n.byteStride||3*n.value.BYTES_PER_ELEMENT)/n.value.BYTES_PER_ELEMENT+r])}validateAttribute(t,r){let n=t.value?.BYTES_PER_ELEMENT,i=t.byteOffset??0,o=t.byteStride||t.size*n;if(!n||!Number.isSafeInteger(t.size)||t.size<1||!Number.isSafeInteger(i)||i<0||i%n||!Number.isSafeInteger(o)||o<t.size*n||o%n||r&&i+(r-1)*o+t.size*n>t.value.byteLength)throw new Error("PointCloudTiler: invalid attribute layout")}allocateRows(t){if(t*4>this.options.maxIndexBytes-this.indexBytes)throw new Error("PointCloudTiler: index byte budget exceeded");let r=new Uint32Array(t);return this.indexBytes+=r.byteLength,r}releaseRows(t){this.indexBytes-=t.buffer.byteLength}getNode(t){this.signal.throwIfAborted();let r=this.nodes.get(t);if(!r)throw new Error(`PointCloudTiler: unknown tile ${t}`);return r}getOctant(t,r){let n=0;for(let i=0;i<3;i++)this.getCoordinate(t,i)>=r[i]&&(n|=4>>i);return n}async checkpoint(){this.signal.throwIfAborted(),await new Promise(t=>setTimeout(t,0)),this.signal.throwIfAborted()}}});var vP=w(()=>{"use strict";yP();SP()});var y0,EP=w(()=>{"use strict";Wn();vP();y0=class extends mh{ready;isReady=!1;tiler;constructor(t,r={},n){super(null,r,{pointCloudTiler:{}},n),this.tiler=new tf(t,r.pointCloudTiler),this.ready=this.tiler.getRootNode().then(()=>{this.isReady=!0}),this.ready.catch(()=>{})}async initialize(){await this.ready,await this.tiler.getRootNode()}async getMetadata(){return await this.initialize(),{pointCount:this.tiler.pointCount,refinement:"ADD"}}async getRootTile(){return this.createHeader(await this.tiler.getRootNode())}async getChildren(t){return(await this.tiler.getChildNodes(t.id)).map(r=>this.createHeader(r))}async loadTileContent(t){let r=await this.tiler.getTileMesh(t.id);return r.header.vertexCount?{data:OM(r),pointCount:r.header.vertexCount,cartographicOrigin:[0,0,0],coordinateSystem:"cartesian",spatialReference:this.options.pointCloudTiler.spatialReference,spatialBoundingVolume:this.createHeader(await this.tiler.getNodeMetadata(t.id)).boundingVolume}:null}close(){this.tiler.close(),this.isReady=!1}createHeader(t){let r=t.bounds[0].map((i,o)=>i+(t.bounds[1][o]-i)/2),n={cartographicBounds:t.bounds.map(i=>[...i]),center:r,radius:Math.hypot(...r.map((i,o)=>t.bounds[1][o]-i)),coordinateFrame:"cartesian"};return{id:t.id,level:t.level,pointCount:t.pointCount,geometricError:t.geometricError,boundingVolume:n,spatialBoundingVolume:n}}}});var TP={};Zr(TP,{PointCloudTileLoaderWithParser:()=>JD});var Pft,Rft,ZD,JD,IP=w(()=>{"use strict";EP();BM();({preload:Pft,createDataSourceSync:Rft,...ZD}=w0),JD={...ZD,createDataSourceSync(e,t={},r){if(typeof e=="string"||e instanceof Blob)throw new Error("PointCloudTileLoader requires decoded Mesh/Arrow input");return new y0(e,t,r)}}});async function tF(){let{PointCloudTileLoaderWithParser:e}=await Promise.resolve().then(()=>(IP(),TP));return e}var QD,w0,BM=w(()=>{"use strict";QD="5.0.0-beta.10";w0={dataType:null,batchType:null,name:"PointCloudTiler",id:"point-cloud-tiler",module:"tiles",version:QD,extensions:[],mimeTypes:[],type:"point-cloud",fromUrl:!1,fromBlob:!1,testURL:()=>!1,options:{pointCloudTiler:{}},defaultOptions:{pointCloudTiler:{}},preload:tF,createDataSourceSync(e,t={},r){throw new Error("PointCloudTileLoader requires preload() or @loaders.gl/tiles-3d/point-cloud-tile-loader")}}});var ef={};Zr(ef,{I3SSource:()=>Nm,I3SSpatialTransformer:()=>gl,IndexedArchiveTilesetSource:()=>kd,LOD_METRIC_TYPE:()=>$c,PointCloudTile:()=>yl,PointCloudTileLoader:()=>w0,PointCloudTileset:()=>Bm,SpatialCoordinateTransformer:()=>$n,TILESET_TYPE:()=>nr,TILE_CONTENT_STATE:()=>ir,TILE_REFINEMENT:()=>ze,TILE_TYPE:()=>Bi,Tile3D:()=>bn,Tiles3DSource:()=>Am,Tiles3DSpatialTransformer:()=>hs,Tileset3D:()=>Ud,TilesetCache:()=>Hc,TilesetTraverser:()=>Li,applyTilesetSpatialOptions:()=>Ea,calculateTransformProps:()=>Cd,convertS2BoundingVolumeToOBB:()=>Tm,createBoundingVolume:()=>Xc,createImplicitSubtreeReference:()=>sw,createTilesetSpatialReference:()=>Mn,get3DTilesSpatialReference:()=>Yd,getFrameState:()=>Nd,getGeoidModel:()=>Sm,getI3SSpatialReference:()=>$d,getLodStatus:()=>Wd,getSpatialCoordinateFrame:()=>_n,getTileset3DTraversalSnapshot:()=>mv,isTileset3DSource:()=>Dd,markTilesetSpatialReferenceTransformed:()=>Kc,materializeImplicitSubtree:()=>Im,registerGeoidModel:()=>Qy,registerGeoidModelFromPgm:()=>vI,registerSpatialCrs:()=>xI,registerSpatialDatumGrid:()=>SI,replaceImplicitUrlTemplate:()=>ou,traverseTilesetContents:()=>pv});mf(ef,BP(zM(),1));Wn();qt();Dr();Ef();Wn();var Pd=class{item;previous;next;constructor(t,r,n){this.item=t,this.previous=r,this.next=n}};var Rd=class{head=null;tail=null;_length=0;get length(){return this._length}add(t){let r=new Pd(t,this.tail,null);return this.tail?(this.tail.next=r,this.tail=r):(this.head=r,this.tail=r),++this._length,r}remove(t){t&&(t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,--this._length)}splice(t,r){t!==r&&(this.remove(r),this._insert(t,r))}_insert(t,r){let n=t.next;t.next=r,this.tail===t?this.tail=r:n.previous=r,r.next=n,r.previous=t,++this._length}};var Hc=class{_list;_sentinel;_trimTiles;constructor(){this._list=new Rd,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(t){let r=t._cacheNode;r&&this._list.splice(this._sentinel,r)}add(t,r,n){r._cacheNode||(r._cacheNode=this._list.add(r),n&&n(t,r))}unloadTile(t,r,n){let i=r._cacheNode;i&&(this._list.remove(i),r._cacheNode=null,n&&n(t,r))}unloadTiles(t,r){let n=this._trimTiles;this._trimTiles=!1;let i=this._list,o=this._sentinel,s=i.head;for(;s!==o&&(t.gpuMemoryUsageInBytes>t.cacheBytes||n);){let a=s.item;s=s.next,this.unloadTile(t,a,r)}}trim(){this._trimTiles=!0}};Dr();Dr();qt();Wn();function Cd(e,t){ii(e),ii(t);let{rtcCenter:r,gltfUpAxis:n}=t,{computedTransform:i,boundingVolume:{center:o}}=e,s=new bt(i);switch(r&&s.translate(r),n){case"Z":break;case"Y":let f=new bt().rotateX(Math.PI/2);s=s.multiplyRight(f);break;case"X":let d=new bt().rotateY(-Math.PI/2);s=s.multiplyRight(d);break;default:break}t.isQuantized&&s.translate(t.quantizedVolumeOffset).scale(t.quantizedVolumeScale);let a=new I(o);t.cartesianModelMatrix=s,t.cartesianOrigin=a;let c=pt.WGS84.cartesianToCartographic(a,new I),h=ga(pt.WGS84,a).invert();t.cartographicModelMatrix=h.multiplyRight(s),t.cartographicOrigin=c;let u=rN(t);u&&(t.cartesianModelMatrix=new bt(s).multiplyRight(u.matrix),t.cartographicModelMatrix.multiplyRight(u.matrix),u.matrix=bt.IDENTITY),t.coordinateSystem||(t.modelMatrix=t.cartographicModelMatrix)}var eN=1e6**2;function rN(e){let t=e.gltf?.json;if(!t)return null;let r=typeof t.scene=="number"?t.scene:0,i=t.scenes?.[r]?.nodes?.[0],o=i===void 0?void 0:t.nodes?.[i];if(!o?.matrix)return null;let s=o.matrix;return s[12]*s[12]+s[13]*s[13]+s[14]*s[14]<=eN?null:o}qt();so();Dr();Dr();var FS=new I,T1=new I,nN=1e-5,iN=1e-7,I1=new sr([new Ge,new Ge,new Ge,new Ge,new Ge,new Ge]);function Nd(e,t,r={}){let{cameraUp:n,height:i}=e,o=e.cameraDirection,{metersPerUnit:s}=e.distanceScales,a=Fh(e,e.center),c=ga(pt.WGS84,a),l=e.unprojectPosition(e.cameraPosition),h=pt.WGS84.cartographicToCartesian(l,new I),u;if(o)u=new I(c.transformAsVector(new I(o).scale(s))).normalize();else{let T=e.getFrustumPlanes().near,S=A1(T,e.cameraPosition),E=Fh(e,S);u=new I(E).subtract(h).normalize()}let f=new I(c.transformAsVector(new I(n).scale(s))).normalize();oN(e);let d=e.constructor,{longitude:m,latitude:p,width:g,bearing:y,zoom:_,position:M}=e,b=new d({longitude:m,latitude:p,height:i,width:g,bearing:y,zoom:_,position:M,pitch:0}),v=Number.isFinite(e.fovy)&&Number(e.fovy)>0&&Number(e.fovy)<180?Number(e.fovy)*Math.PI/180:Math.PI/3;return{camera:{position:h,direction:u,up:f,cartographicPosition:l,verticalFieldOfView:v,timeSinceMovement:r.timeSinceCameraMovement??Number.POSITIVE_INFINITY},viewport:e,topDownViewport:b,height:i,cullingVolume:I1,clippingPlanes:e.clippingPlanes,frameNumber:t,sseDenominator:2*Math.tan(v/2),dynamicScreenSpaceErrorDensity:0}}function US(e,t,r,n){let i=Array.from(t),o=Array.from(r),s=e?i.length!==e.position.length||i.some((l,h)=>Math.abs(l-e.position[h])>nN):!1,a=e?o.length!==e.direction.length||o.some((l,h)=>Math.abs(l-e.direction[h])>iN):!1,c=s||a?n:e?.lastMovementTime??Number.NEGATIVE_INFINITY;return{state:{position:i,direction:o,lastMovementTime:c},timeSinceMovement:Math.max((n-c)/1e3,0)}}function GS(e,t,r){if(r===0||e.length<=r)return[e,[]];let n=[],{longitude:i,latitude:o}=t.viewport;for(let[l,h]of e.entries()){let[u,f]=h.header.mbs,d=Math.abs(i-u),m=Math.abs(o-f),p=Math.sqrt(m*m+d*d);n.push([l,p])}let s=n.sort((l,h)=>l[1]-h[1]),a=[];for(let l=0;l<r;l++)a.push(e[s[l][0]]);let c=[];for(let l=r;l<s.length;l++)c.push(e[s[l][0]]);return[a,c]}function oN(e){let t=e.getFrustumPlanes(),r=A1(t.near,e.cameraPosition),n=Fh(e,r),i=Fh(e,e.cameraPosition,T1),o=0;I1.planes[o++].fromPointNormal(n,FS.copy(n).subtract(i));for(let s in t){if(s==="near")continue;let a=t[s],c=A1(a,r,T1),l=Fh(e,c,T1);I1.planes[o++].fromPointNormal(l,FS.copy(n).subtract(l))}}function A1(e,t,r=new I){let n=e.normal.dot(t);return r.copy(e.normal).scale(e.distance-n).add(t),r}function Fh(e,t,r=new I){let n=e.unprojectPosition(t);return pt.WGS84.cartographicToCartesian(n,r)}qt();var jS=new I,sN=new I,va=new I,zS=new I,Uh=new I,VS=new I,kS=new I,qS=new I,Od=new to,aN=new I(0,0,1);function WS(e,t){e._updateTransform(t)}function HS(e,t,r){if(!Number.isFinite(r.dynamicScreenSpaceErrorDensity)||r.dynamicScreenSpaceErrorDensity<=0)return 0;let n=uN(e),i=n.region?fN(n.region,t):dN(e,n,t);if(!i)return 0;let o=Mh(r.dynamicScreenSpaceErrorHeightFalloff,0,1),s=i.minimumHeight+(i.maximumHeight-i.minimumHeight)*o,a=i.maximumHeight-s,c=a>0?Mh((i.cameraHeight-s)/a,0,1):i.cameraHeight>=i.maximumHeight?1:0,h=(1-Mh(Math.abs(i.cameraDirection.dot(i.upDirection)),0,1))*(1-c);return r.dynamicScreenSpaceErrorDensity*h}function cN(e,t){let r=e*t;return 1-Math.exp(-(r*r))}function lN(e,t,r){return t<=0||r<=0||!Number.isFinite(t)||!Number.isFinite(r)?0:cN(e,t)*r}function $S(e,t,r,n=1){let i=e.tileset,o=e.parent&&e.parent.lodMetricValue||e.lodMetricValue,s=r?o:e.lodMetricValue;if(s===0)return 0;let{viewDistanceScale:a}=i.options,c=a||1,l=Number.isFinite(n)?Math.max(n,0):1,h=hN(s,t,c,l);if(h!==null)return h;let u=Math.max(e._distanceToCamera,1e-7),{height:f,sseDenominator:d}=t,m=s*f*l*c/(u*d);return i.options.dynamicScreenSpaceError&&!t.viewport.orthographic&&(m-=lN(u,t.dynamicScreenSpaceErrorDensity,i.options.dynamicScreenSpaceErrorFactor)),m}function hN(e,t,r,n){let i=t.viewport;if(!i?.orthographic)return null;let o=i.metersPerPixel;return!Number.isFinite(o)||!o||o<=0?null:e*r*n/o}function uN(e){return e.header.content?.boundingVolume||e.header.boundingVolume}function fN(e,t){let r=jS.copy(t.camera.position).normalize(),n=Uh.copy(t.camera.direction).normalize();return{cameraHeight:t.camera.cartographicPosition[2],minimumHeight:e[4],maximumHeight:e[5],cameraDirection:n,upDirection:r}}function dN(e,t,r){let n=mN(t,va);if(n===null)return null;let i=new bt(e.computedTransform).invert(),o=e.tileset.ellipsoid;if(Math.hypot(va[0],va[1],va[2])>o.minimumRadius){let a=o.cartesianToCartographic(va,sN),c=jS.copy(r.camera.position).normalize(),l=Uh.copy(r.camera.direction).normalize();return{cameraHeight:r.camera.cartographicPosition[2],minimumHeight:0,maximumHeight:a[2]*2,cameraDirection:l,upDirection:c}}return i.transformAsPoint(r.camera.position,zS),i.transformAsVector(r.camera.direction,Uh),Uh.normalize(),{cameraHeight:zS[2],minimumHeight:va[2]-n,maximumHeight:va[2]+n,cameraDirection:Uh,upDirection:aN}}function mN(e,t){if(e.box){let r=e.box;return t.set(r[0],r[1],r[2]),pN(r)}if(e.sphere){let r=e.sphere;return t.set(r[0],r[1],r[2]),r[3]}return null}function pN(e){return e.length===10?(Od.fromArray(e,6),VS.set(e[3],0,0).transformByQuaternion(Od),kS.set(0,e[4],0).transformByQuaternion(Od),qS.set(0,0,e[5]).transformByQuaternion(Od),Math.abs(VS[2])+Math.abs(kS[2])+Math.abs(qS[2])):Math.abs(e[5])+Math.abs(e[8])+Math.abs(e[11])}qt();so();var ir={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},ze;(function(e){e[e.ADD=1]="ADD",e[e.REPLACE=2]="REPLACE"})(ze||(ze={}));var Bi;(function(e){e.EMPTY="empty",e.SCENEGRAPH="scenegraph",e.POINTCLOUD="pointcloud",e.MESH="mesh"})(Bi||(Bi={}));var nr;(function(e){e.I3S="I3S",e.TILES3D="TILES3D"})(nr||(nr={}));var $c;(function(e){e.GEOMETRIC_ERROR="geometricError",e.MAX_SCREEN_THRESHOLD="maxScreenThreshold"})($c||($c={}));var YS={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0};var KS=1e4,gN=1e4,yN=1e8,wN=new en,XS=new I,ZS=new I,P1=new I,Bd=new I;function R1(e,t,r){return e+(t-e)*r}function JS(e,t){let r=e instanceof en?e:e.getBoundingSphere(wN),{center:n,radius:i}=r;XS.copy(n).subtract(t.position);let o=Math.max(XS.dot(t.direction),0);return ZS.copy(t.direction).scale(o).add(t.position),P1.copy(ZS).subtract(n),P1.magnitude()<=i||(Bd.copy(P1).normalize().scale(i).add(n).subtract(t.position),Bd.magnitude()===0)?0:(Bd.normalize(),Math.min(Math.max(1-Bd.dot(t.direction),0),1))}function QS(e,t,r,n){return!Number.isFinite(n)||n<=0||n>.5?!1:e>r?!0:t!==void 0&&t>r}function tv(e){let t=Number.isFinite(e.foveatedConeSize)?Math.min(Math.max(e.foveatedConeSize,0),1):1,r=e.refinement===ze.REPLACE;if(r&&!e.skipLevelOfDetail||!e.foveatedScreenSpaceError||t>=1||r&&e.skipLevelOfDetail&&e.priorityProgressiveResolution)return!1;let n=Number.isFinite(e.verticalFieldOfView)&&e.verticalFieldOfView>0?e.verticalFieldOfView:Math.PI/3,i=1-Math.cos(n*.5),o=t*i;if(e.foveatedFactor<=o||i<=o)return!1;let s=Math.min(Math.max((e.foveatedFactor-o)/(i-o),0),1),c=(typeof e.interpolationCallback=="function"?e.interpolationCallback:R1)(e.minimumScreenSpaceErrorRelaxation,e.maximumScreenSpaceError,s),l=Number.isFinite(c)?Math.min(Math.max(c,0),e.maximumScreenSpaceError):0,h=e.screenSpaceError===0&&e.parentScreenSpaceError!==void 0?e.parentScreenSpaceError*.5:e.screenSpaceError;return e.maximumScreenSpaceError-l<=h}function ev(e,t,r){return e&&Number.isFinite(t)&&Number.isFinite(r)&&r>0&&t<r}function rv(e){let t=e.rootScreenSpaceError>0?Math.min(Math.max(e.reverseScreenSpaceError/e.rootScreenSpaceError,0),1):0,r=Math.floor(t*(KS-1)),n=Number.isFinite(e.foveatedFactor)?Math.min(Math.max(e.foveatedFactor,0),1):0,i=Math.floor(n*(KS-1))*gN;return(e.priorityProgressiveResolution?0:yN)+i+r}hg();hg();var Yc="EPSG:4326",Ld="EPSG:4978";function Gh(e){let t=e.trim().toUpperCase(),r=t.match(/(?:\/DEF\/CRS\/|URN:OGC:DEF:CRS:)([A-Z0-9_-]+)(?:\/|::)(?:[^/:]*[/:])?([A-Z0-9_.-]+)$/);return r?`${r[1]}:${r[2]}`:t}function _n(e){if(typeof e=="string"){let r=tr(e);return r==="wkt"?_N(e):r==="proj-string"?MN(e):C1(e)||"projected"}let t=e;return t.type==="BoundCRS"&&t.source_crs?_n(t.source_crs):t.type==="CompoundCRS"&&t.components?.[0]?_n(t.components[0]):String(t.type).includes("Projected")?"projected":String(t.type).includes("Geographic")?"geographic":String(t.type).includes("Geodetic")?t.coordinate_system?.subtype==="Cartesian"?"geocentric":"geographic":"unknown"}function C1(e){if(typeof e!="string")return;let t=Gh(e);if(t===Ld)return"geocentric";if(t===Yc||t==="OGC:CRS84")return"geographic";let r=/^EPSG:(\d+)$/.exec(t);if(!r)return;let n=Number(r[1]);if(n===7789)return"geocentric";if(n===4490||n===4979)return"geographic";if(n===3857||n>=32601&&n<=32660||n>=32701&&n<=32760)return"projected"}function _N(e){let t;try{t=gh(e).root}catch{return"unknown"}switch(t.keyword.toUpperCase()){case"GEOCCS":return"geocentric";case"GEOGCS":case"GEOGCRS":case"GEOGRAPHICCRS":case"GEOGRAPHIC2DCRS":case"GEOGRAPHIC3DCRS":return"geographic";case"PROJCS":case"PROJCRS":case"PROJECTEDCRS":return"projected";case"GEODCRS":case"GEODETICCRS":{let n=t.values.find(i=>i.type==="node"&&i.keyword.toUpperCase()==="CS")?.values[0];return n?.type!=="enumeration"&&n?.type!=="string"?"unknown":n.value.toUpperCase()==="CARTESIAN"?"geocentric":n.value.toUpperCase()==="ELLIPSOIDAL"?"geographic":"unknown"}default:return"unknown"}}function MN(e){try{let t=yh(e).parameters.find(r=>r.name.toLowerCase()==="proj")?.value;switch(t?.toLowerCase()){case"longlat":case"latlong":return"geographic";case"geocent":return"geocentric";default:return t?"projected":"unknown"}}catch{return"unknown"}}function Mn(e,t={}){let r=t.sourceCrs!==void 0,n=t.sourceCrs||e.sourceCrs,i=t.outputCoordinates||"auto",o=t.targetCrs||(i==="ecef"?"EPSG:4978":void 0),s=t.targetHeightReference||"native",a=e.verticalUnitScale??1,c=e.elevationUnitScale??1,l=e.elevationOffset||0,h=e.elevationMode==="onTheGround"||e.elevationMode==="relativeToGround"||e.elevationMode==="relativeToScene",u=e.elevationMode==="relativeToScene"?!!t.sceneElevationProvider:!h||!!t.terrainElevationProvider,f=a!==1||c!==1||e.elevationMode!==void 0&&(h||e.elevationMode==="absoluteHeight"&&l!==0),d=s!=="native"&&s!==e.heightReference,m=!!o||s!=="native"||i!=="auto"||f,p=i!=="target-crs"||!!o,g=!d||(e.heightReference||"unknown")!=="unknown",y=Number.isFinite(a)&&a>0&&Number.isFinite(c)&&c>0,_=!!n&&m&&p&&g&&y&&u&&i!=="local-enu",M=r?"caller-override":e.provenance||"unknown",b=r&&n?_n(n):e.coordinateFrame,v=r?"explicit":e.sourceCrsState||(n?M==="format-default"?"default":"explicit":"absent"),T=Bf({crs:n?{state:v==="default"?"default":"explicit",definition:n,representation:!r&&e.sourceCrsRepresentation||tr(n),provenance:M,alternatives:r?void 0:e.sourceCrsAlternatives}:{state:v==="unknown"?"unknown":"absent",provenance:M},vertical:e.verticalCrs?{state:"explicit",definition:e.verticalCrs,representation:tr(e.verticalCrs),provenance:e.provenance||"metadata"}:void 0,coordinateEpoch:t.coordinateEpoch??e.coordinateEpoch,coordinateFrame:b,coordinateOrder:xN(e.axisOrder),units:r?void 0:e.units}),S=N1(T.crs),E=T.vertical?N1(T.vertical):void 0,N=o?bN(o):void 0;return Object.freeze({...T,sourceCrs:S,verticalCrs:E,verticalUnitScale:a,coordinateEpoch:t.coordinateEpoch??e.coordinateEpoch,heightReference:e.heightReference||"unknown",elevationMode:e.elevationMode,elevationOffset:e.elevationOffset,elevationUnit:e.elevationUnit,elevationUnitScale:c,coordinateFrame:b||"unknown",axisOrder:e.axisOrder||"unknown",provenance:M,targetCrs:N,targetHeightReference:s,outputCoordinates:i,status:m?_?"transformable":"unresolved":"native",warnings:Object.freeze([...e.warnings||[]])})}function Ea(e,t={}){return Mn({sourceCrs:e?.sourceCrs,sourceCrsState:e?.crs.state,sourceCrsRepresentation:e?.crs.state==="explicit"||e?.crs.state==="default"?e.crs.representation:void 0,sourceCrsAlternatives:e?.crs.state==="explicit"||e?.crs.state==="default"?e.crs.alternatives:void 0,verticalCrs:e?.verticalCrs,units:e?.units,verticalUnitScale:e?.verticalUnitScale,coordinateEpoch:e?.coordinateEpoch,heightReference:e?.heightReference,elevationMode:e?.elevationMode,elevationOffset:e?.elevationOffset,elevationUnit:e?.elevationUnit,elevationUnitScale:e?.elevationUnitScale,coordinateFrame:e?.coordinateFrame,axisOrder:e?.axisOrder,provenance:e?.provenance,warnings:e?.warnings},t)}function N1(e){return e.state==="explicit"||e.state==="default"?e.definition:void 0}function bN(e){let t=Bf({crs:{state:"explicit",definition:e,representation:tr(e),provenance:"caller-override"}}),r=N1(t.crs);if(!r)throw new Error("Failed to normalize a known target CRS definition");return r}function xN(e){switch(e){case"xy":return["x","y"];case"yx":return["y","x"];case"xyz":return["x","y","z"];default:return[]}}function Kc(e){if(e.status!=="transformable"&&e.status!=="transformed")throw new Error("Only a transformable spatial reference can be marked as transformed");return Object.freeze({...e,status:"transformed"})}function Dd(e){return!!(e&&typeof e=="object"&&"initialize"in e&&"getRootTileset"in e&&"initializeTileHeaders"in e&&"loadTileContent"in e)}var Gd=1024*1024,fv=512*Gd,dv=512*Gd,SN=32*Gd,vN=Gd;function Fd(e,t){if(!Number.isFinite(e)||e<0)throw new Error(`${t} must be a finite number greater than or equal to 0`);return e}function nv(e,t){let r=e.cacheBytes??t;return Fd(r,"cacheBytes")}function iv(e,t){let r=e.maximumCacheOverflowBytes??t;return Fd(r,"maximumCacheOverflowBytes")}var O1={description:"",ellipsoid:pt.WGS84,modelMatrix:new bt,throttleRequests:!0,maxRequests:64,cacheBytes:fv,maximumCacheOverflowBytes:dv,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onSourceError:()=>{},onTilesetError:()=>{},onTraversalComplete:e=>e,onUpdate:()=>{},contentLoader:void 0,viewDistanceScale:1,progressiveResolutionHeightFraction:.3,foveatedScreenSpaceError:!0,foveatedConeSize:.1,foveatedMinimumScreenSpaceErrorRelaxation:0,foveatedInterpolationCallback:R1,foveatedTimeDelay:.2,maximumScreenSpaceError:8,skipLevelOfDetail:!1,baseScreenSpaceError:1024,skipScreenSpaceErrorFactor:16,skipLevels:1,immediatelyLoadDesiredLevelOfDetail:!1,dynamicScreenSpaceError:!0,dynamicScreenSpaceErrorDensity:2e-4,dynamicScreenSpaceErrorFactor:24,dynamicScreenSpaceErrorHeightFalloff:.25,memoryAdjustedScreenSpaceError:!0,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{core:{fetch:{}}},attributions:[],basePath:"",i3s:{},spatial:{}},B1="Tiles In Tileset(s)",L1="Tiles In Memory",ov="Tiles In View",sv="Tiles To Render",av="Tiles Loaded",D1="Tiles Loading",cv="Tiles Unloaded",lv="Failed Tile Loads",hv="Points/Vertices",F1="Tile Memory Use",uv="Maximum Screen Space Error",Ud=class{options;loadOptions;source;type;tileset;loader;url;basePath;modelMatrix;ellipsoid;lodMetricType;lodMetricValue;refine;root=null;roots={};asset={};schema=null;schemaUri=null;groups=[];metadata=null;statistics=null;spatialReference=Mn({});description="";properties;extras=null;attributions={};credits={};stats;contentFormats;cartographicCenter=null;cartesianCenter=null;zoom=1;boundingVolume=null;dynamicScreenSpaceErrorComputedDensity=0;gpuMemoryUsageInBytes=0;memoryAdjustedScreenSpaceError=0;_cacheBytes=fv;_maximumCacheOverflowBytes=dv;_frameNumber=0;_tiles={};_pendingCount=0;selectedTiles=[];traverseCounter=0;geometricError=0;lastUpdatedVieports=null;_requestedTiles=[];_emptyTiles=[];frameStateData={};_cameraMotionStates={};_deferredTraversalTimeout=null;_traverser;_cache=new Hc;_requestScheduler;_heldTiles=new Set;updatePromise=null;tilesetInitializationPromise;constructor(t,r){if(!Dd(t))throw new Error("Tileset3D requires a Tileset3DSource instance");let n=r||{},i=t.type===nr.TILES3D,o=i?O1.cacheBytes:SN,s=i?O1.maximumCacheOverflowBytes:vN,a=nv(n,o),c=iv(n,s);this.options={...O1,...n,cacheBytes:a,maximumCacheOverflowBytes:c,skipLevelOfDetail:n.skipLevelOfDetail??t.type===nr.TILES3D,memoryAdjustedScreenSpaceError:n.memoryAdjustedScreenSpaceError??i},this.loadOptions=this.options.loadOptions||{},this.source=t,this.tileset=null,this.loader=this.source.loader,this.type=this.source.type,this.url=this.source.url,this.basePath=this.source.basePath,this.modelMatrix=this.options.modelMatrix,this.ellipsoid=this.options.ellipsoid,this.lodMetricType="",this.lodMetricValue=0,this.refine="",this.contentFormats=this.source.contentFormats,this._traverser=this._initializeTraverser(),this._requestScheduler=new Tc({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this.memoryAdjustedScreenSpaceError=this.options.maximumScreenSpaceError,this._cacheBytes=a,this._maximumCacheOverflowBytes=c;let l=this._getSourceMetadata();l&&(this.spatialReference=Ea(l.spatialReference,this.options.spatial)),this.stats=new Pi({id:this.url}),this._initializeStats(),this.tilesetInitializationPromise=this._initializeTileSet()}destroy(){this._clearDeferredTraversal(),this.source.destroy?.(),this._destroy()}isLoaded(){return this._pendingCount===0&&this._frameNumber!==0&&this._requestedTiles.length===0}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get requestedTiles(){return this._requestedTiles.slice()}get emptyTiles(){return this._emptyTiles.slice()}get cacheBytes(){return this._cacheBytes}set cacheBytes(t){this._cacheBytes=Fd(t,"cacheBytes"),this.options.cacheBytes=this._cacheBytes}get maximumCacheOverflowBytes(){return this._maximumCacheOverflowBytes}set maximumCacheOverflowBytes(t){this._maximumCacheOverflowBytes=Fd(t,"maximumCacheOverflowBytes"),this.options.maximumCacheOverflowBytes=this._maximumCacheOverflowBytes}get queryParams(){let t=this.source.getTileUrl(this.url),r=t.indexOf("?");return r>=0?t.slice(r+1):""}setProps(t){let r=nv(t,this.cacheBytes),n=iv(t,this.maximumCacheOverflowBytes);this.options={...this.options,...t,cacheBytes:r,maximumCacheOverflowBytes:n},this._cacheBytes=r,this._maximumCacheOverflowBytes=n}getTileUrl(t){return this.source.getTileUrl(t)}hasExtension(t){return!!this.source.hasExtension?.(t)}update(t=null){this.tilesetInitializationPromise.then(()=>{!t&&this.lastUpdatedVieports?t=this.lastUpdatedVieports:this.lastUpdatedVieports=t,t&&this.doUpdate(t)})}async selectTiles(t=null){return await this.tilesetInitializationPromise,t&&(this.lastUpdatedVieports=t),this.updatePromise||(this.updatePromise=new Promise(r=>{setTimeout(()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),r(this._frameNumber),this.updatePromise=null},this.options.debounceTime)})),this.updatePromise}adjustScreenSpaceError(){this.gpuMemoryUsageInBytes<this.cacheBytes?this.memoryAdjustedScreenSpaceError=Math.max(this.memoryAdjustedScreenSpaceError/1.02,this.options.maximumScreenSpaceError):this.gpuMemoryUsageInBytes>this.cacheBytes+this.maximumCacheOverflowBytes&&(this.memoryAdjustedScreenSpaceError*=1.02)}doUpdate(t){if("loadTiles"in this.options&&!this.options.loadTiles||this.traverseCounter>0)return;let r=t instanceof Array?t:[t],n=new Set(r.map(a=>a.id));for(let a of Object.keys(this.frameStateData))n.has(a)||delete this.frameStateData[a];this._cache.reset(),this._frameNumber++,this.traverseCounter=r.length;let i=Date.now(),o=Number.POSITIVE_INFINITY,s=[];for(let a of r){let c=a.id;this._needTraverse(c)?s.push(c):this.traverseCounter--}for(let a of r){let c=a.id;if(this.roots[c]||(this.roots[c]=this._initializeTileHeaders(this.tileset,null)),!s.includes(c))continue;let l=Nd(a,this._frameNumber),h=this.roots[c],u=US(this._cameraMotionStates[c],l.camera.position,l.camera.direction,i);this._cameraMotionStates[c]=u.state,l.camera.timeSinceMovement=u.timeSinceMovement,WS(h,this.modelMatrix),l.dynamicScreenSpaceErrorDensity=this.type===nr.TILES3D&&this.options.dynamicScreenSpaceError&&!l.viewport.orthographic?HS(h,l,this.options):0,this.dynamicScreenSpaceErrorComputedDensity=l.dynamicScreenSpaceErrorDensity,this._traverser.traverse(h,l,this.options),Object.keys(this._traverser.deferredTiles).length>0&&(o=Math.min(o,Math.max(this.options.foveatedTimeDelay-u.timeSinceMovement,0)))}Number.isFinite(o)?this._scheduleDeferredTraversal(o):this._clearDeferredTraversal()}_scheduleDeferredTraversal(t){this._clearDeferredTraversal(),this._deferredTraversalTimeout=setTimeout(()=>{this._deferredTraversalTimeout=null,this.selectTiles().catch(r=>{let n=r instanceof Error?r:new Error(String(r));this._onTilesetError(n)})},Math.max(t*1e3,0))}_clearDeferredTraversal(){this._deferredTraversalTimeout!==null&&(clearTimeout(this._deferredTraversalTimeout),this._deferredTraversalTimeout=null)}_needTraverse(t){let r=t;return this.options.viewportTraversersMap&&(r=this.options.viewportTraversersMap[t]),r===t}_onTraversalEnd(t){let r=t.viewport.id;this.frameStateData[r]||(this.frameStateData[r]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});let n=this.frameStateData[r],i=Object.values(this._traverser.selectedTiles),[o,s]=GS(i,t,this.options.maximumTilesSelected);n.selectedTiles=o;for(let a of s)a.unselect();n._requestedTiles=Object.values(this._traverser.requestedTiles),n._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,!(this.traverseCounter>0)&&this._updateTiles()}_updateTiles(){let t=this.selectedTiles;this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(let o in this.frameStateData){let s=this.frameStateData[o];this.selectedTiles=this.selectedTiles.concat(s.selectedTiles),this._requestedTiles=this._requestedTiles.concat(s._requestedTiles),this._emptyTiles=this._emptyTiles.concat(s._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);let r=new Set(this.selectedTiles),n=this.selectedTiles.some(o=>!o.tileDrawn),i=0;if(n){let o=new Set(Object.keys(this.frameStateData).map(a=>this.roots[a])),s=new Map;for(let a of this.selectedTiles)for(let c=a.parent;c;c=c.parent)s.set(c,(s.get(c)??!0)&&a.tileDrawn);for(let a of t)a.tileDrawn&&this._heldTiles.add(a);for(let a of this._heldTiles){let c=a;for(;c.parent;)c=c.parent;if(!o.has(c)){this._heldTiles.delete(a);continue}r.has(a)||(a.contentAvailable&&!this._hasDrawnReplacement(a,r,s)?(a._selectedFrame=this._frameNumber,this.selectedTiles.push(a),i++):this._heldTiles.delete(a))}}else this._heldTiles=r;i>0&&setTimeout(()=>{this.selectTiles()},0);for(let o of this.selectedTiles)this._tiles[o.id]=o;this._loadTiles(),this._unloadTiles(),this._updateStats(),this._tilesChanged(t,this.selectedTiles)&&this.options.onUpdate()}_hasDrawnReplacement(t,r,n){for(let i=t.parent;i;i=i.parent)if(r.has(i))return i.tileDrawn;return n.get(t)===!0}_tilesChanged(t,r){if(t.length!==r.length)return!0;let n=new Set(t.map(s=>s.id)),i=new Set(r.map(s=>s.id)),o=t.some(s=>!i.has(s.id));return o=o||r.some(s=>!n.has(s.id)),o}_loadTiles(){this._requestedTiles.sort((t,r)=>t._priority-r._priority);for(let t of this._requestedTiles)t.contentUnloaded&&this._loadTile(t)}_unloadTiles(){this._cache.unloadTiles(this,(t,r)=>t._unloadTile(r)),this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_updateStats(){let t=0,r=0;for(let n of this.selectedTiles)if(n.contentAvailable&&n.content){t++;let i=n.contents.length?n.contents:[n.content];for(let o of i)o.pointCount?r+=o.pointCount:r+=o.vertexCount||0}this.stats.get(ov).count=this.selectedTiles.length,this.stats.get(sv).count=t,this.stats.get(hv).count=r,this.stats.get(uv).count=this.memoryAdjustedScreenSpaceError}async _initializeTileSet(){try{let t=this.source.initialize(),r=this._getSourceMetadata();r&&this._syncSourceState(r),r?.tileset?.root&&typeof r.tileset.root.then!="function"&&(!this.source.prepareTileset||this.spatialReference?.status==="native")&&(this.root=this._initializeTileHeaders(r.tileset,null),this._applyViewState()),await t;let n=this.source.getMetadata();this._syncSourceState(n),await this.source.prepareTileset?.(this),this.root||(this.root=this._initializeTileHeaders(n.tileset,null)),this._applyViewState()}catch(t){let r=t instanceof Error?t:new Error(String(t));throw this._onSourceError(r,this.root),this._onTilesetError(r),r}}_initializeStats(){this.stats.get(B1),this.stats.get(D1),this.stats.get(L1),this.stats.get(ov),this.stats.get(sv),this.stats.get(av),this.stats.get(cv),this.stats.get(lv),this.stats.get(hv),this.stats.get(F1,"memory"),this.stats.get(uv)}_initializeTileHeaders(t,r){return this.source.initializeTileHeaders(this,t,r)}_initializeTraverser(){return this.source.createTraverser({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(t){this._destroySubtree(t)}async _loadTile(t){let r=null;try{this._onStartTileLoading(),r=await t.loadContent()}catch(n){let i=n instanceof Error?n:new Error("load failed");this._onSourceError(i,t),this._onTileLoadError(t,i)}finally{this._onEndTileLoading(),this._onTileLoad(t,r)}}async _loadTileChildren(t,r){try{this._onStartTileLoading(),await t.loadChildren(r)}catch(n){let i=n instanceof Error?n:new Error("subtree load failed");this._onSourceError(i,t),this._onTileLoadError(t,i)}finally{this._onEndTileLoading()}}_onTileLoadError(t,r){this.stats.get(lv).incrementCount();let n=r.message||r.toString(),i=t.url;Ji.error(`A 3D tile failed to load: ${t.url} ${n}`)(),this.options.onTileError(t,n,i)}_onSourceError(t,r=null){this.options.onSourceError(t,this.source,r)}_onTilesetError(t){this.options.onTilesetError(t,this)}_onTileLoad(t,r){if(!r?.loaded)return;t.content&&Cd(t,t.content),this.source.onTileLoaded?.(this,t,r),this._syncSourceState(this.source.getMetadata());let n=this.source.getTilesTotalCount?.();n&&(this.stats.get(B1).reset(),this.stats.get(B1).addCount(n)),this._addTileToCache(t),this.options.onTileLoad(t)}_onStartTileLoading(){this._pendingCount++,this.stats.get(D1).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(D1).decrementCount()}_addTileToCache(t){this._cache.add(this,t,r=>r._updateCacheStats(t))}_updateCacheStats(t){this.stats.get(av).incrementCount(),this.stats.get(L1).incrementCount(),this.gpuMemoryUsageInBytes+=t.gpuMemoryUsageInBytes||0,this.stats.get(F1).count=this.gpuMemoryUsageInBytes,this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.gpuMemoryUsageInBytes||0,this.stats.get(L1).decrementCount(),this.stats.get(cv).incrementCount(),this.stats.get(F1).count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(t),t.unloadContent()}_destroy(){let t=[];for(this.root&&t.push(this.root);t.length>0;){let r=t.pop();for(let n of r.children)t.push(n);this._destroyTile(r)}this.root=null}_destroySubtree(t){let r=t,n=[r];for(;n.length>0;){t=n.pop();for(let i of t.children)n.push(i);t!==r&&this._destroyTile(t)}r.children=[]}_destroyTile(t){this._cache.unloadTile(this,t),this._unloadTile(t),t.destroy()}_syncSourceState(t){this.tileset=t.tileset,this.loader=t.loader,this.type=t.type,this.url=t.url,this.basePath=t.basePath,this.lodMetricType=t.lodMetricType,this.lodMetricValue=t.lodMetricValue,this.refine=t.refine,this.contentFormats=this.source.contentFormats,this.asset=this.source.asset||this.asset;let r=t.tileset;this.schema=r.schema||null,this.schemaUri=r.schemaUri||null,this.groups=r.groups||[],this.metadata=r.metadata||null,this.statistics=r.statistics??null;let n=Ea(t.spatialReference,this.options.spatial);this.spatialReference=EN(this.spatialReference,n),this.properties=this.source.properties??this.properties,this.extras=this.source.extras??this.extras,this.options.attributions?.length?this.credits={attributions:this.options.attributions}:this.credits=this.source.credits||this.credits}_applyViewState(){let t=this.source.getViewState(this.root);this.asset=t.asset||this.source.asset||{},this.properties=t.properties??this.source.properties,this.extras=t.extras??this.source.extras??null,this.credits=t.credits||this.source.credits||this.credits||{attributions:this.options.attributions||[]},this.description=t.description||this.options.description||"",this.boundingVolume=t.boundingVolume||this.root?.boundingVolume||null,this.cartographicCenter=t.cartographicCenter||new I,this.cartesianCenter=t.cartesianCenter||null,this.zoom=t.zoom||1,this.geometricError=this.tileset?.geometricError||0}_getSourceMetadata(){try{return this.source.getMetadata()}catch{return null}}};function EN(e,t){return e?.status==="transformed"&&e.sourceCrs===t.sourceCrs&&e.targetCrs===t.targetCrs&&e.targetHeightReference===t.targetHeightReference&&e.outputCoordinates===t.outputCoordinates?e:t}function mv(e){let t=e.selectedTiles.slice(),r=e.requestedTiles.slice(),n=e.emptyTiles.slice(),i=c=>c.map(l=>String(l.id)).sort(),o=c=>{let l=e.stats.get(c).count;return typeof l=="number"&&Number.isFinite(l)?l:0},a=e.source.getImplicitTilingStats?.();return{frameNumber:e.frameNumber,selectedTileIds:i(t),requestedTileIds:i(r),emptyTileIds:i(n),visibleTileCount:t.length,renderableTileCount:t.filter(c=>c.contentAvailable&&!!c.content).length,loadingTileCount:o("Tiles Loading"),loadedTileCount:o("Tiles Loaded"),failedTileCount:o("Failed Tile Loads"),cachedTileCount:o("Tiles In Memory"),cacheBytes:e.gpuMemoryUsageInBytes,maximumScreenSpaceError:e.memoryAdjustedScreenSpaceError,...a?{implicitTiling:a}:{}}}async function*pv(e,t={}){if(await e.tilesetInitializationPromise,zd(t.signal),!e.root)throw new Error("Tileset initialization completed without a root tile");let r=[e.root],n=new Set;for(;r.length>0;){zd(t.signal);let i=r.pop();if(n.has(i))continue;if(n.add(i),i.header.implicitSubtree&&i.childrenState!=="ready"){let s=e.source.loadTileChildrenForTraversal;if(!s)throw new Error("Tileset source does not support camera-independent subtree loading");if(!(await s.call(e.source,i,t.signal)).loaded)throw new Error(`Unable to load implicit subtree for tile ${i.id}`);i.childrenState="ready"}if(e.type===nr.I3S&&e.source.loadTileChildrenForTraversal&&!(await e.source.loadTileChildrenForTraversal(i,t.signal)).loaded)throw new Error(`Unable to load I3S child nodes for tile ${i.id}`);zd(t.signal);let o=i.contentUrls.length>0&&!i.content;try{if(o){let s=await i.loadContentForTraversal();if(zd(t.signal),!s.loaded)throw new Error(`Unable to load tile content for tile ${i.id}`);e.source.onTileLoaded?.(e,i,s)}yield{tile:i,contents:i.contentEntries}}finally{t.unloadContent&&o&&i.unloadContent()}for(let s=i.children.length-1;s>=0;s--)r.push(i.children[s])}}function zd(e){if(e?.aborted)throw e.reason??new DOMException("The operation was aborted","AbortError")}Wn();var kd=class{sourceUrl;options;archivePromise;constructor(t){this.options=t,this.sourceUrl=TN(t.data,t.fallbackFilename)}async loadRoot(t,r,n){let i=this.options.rootPath?`${Vd(this.sourceUrl)}/${this.options.rootPath}`:t;return await this.parseArchiveResource(i,this.options.rootPath,r,n,this.options.rootMode)}async loadResource(t,r,n){let i=this.resolveArchivePath(t,t);return await this.parseArchiveResource(t,i,r,n)}async parseArchiveResource(t,r,n,i,o){let s=this.options.getCoreApi();if(!s)throw new Error(this.options.missingCoreApiMessage);let a=await this.loadFile(r,o),c=this.createArchiveFetch(t);return await s.parse(a,n,{...i,fetch:c},{url:t,fetch:c,_parse:s.parse,loaders:[n],coreApi:s})}createArchiveFetch(t){return async r=>{let n=typeof r=="string"?r:r instanceof URL?r.toString():r.url,i=this.resolveArchivePath(n,t),o=await this.loadFile(i);return new Response(o,{status:200})}}async loadFile(t,r){this.archivePromise||=this.openArchiveReadableFile().then(i=>this.options.parseArchive(i));let n=await this.archivePromise;return await this.options.getFile(n,t,r)}async openArchiveReadableFile(){let{data:t}=this.options;if(typeof t!="string")return new Ic(t);if(/^https?:\/\//i.test(t))return new dh(t);let r=this.options.getCoreApi();if(!r)throw new Error(this.options.missingCoreApiMessage);let n=await r.fetchFile(t);return new Ic(await n.arrayBuffer())}resolveArchivePath(t,r){let n=Vd(t),i=Vd(this.sourceUrl),o=Vd(r),s=o===i?i:gn.dirname(o),a=new RegExp(`\\.${this.options.archiveExtension}/(.*)$`,"i"),c=n.match(a);if(c?.[1])return c[1];let l=/^[a-z][a-z0-9+.-]*:/i.test(n)||n.startsWith("/"),h=n.startsWith(i)?n:o===i&&!l?`${i}/${n}`:/^[a-z][a-z0-9+.-]*:\/\//i.test(o)?new URL(n,o).href:gn.resolve(s,n);return h===i?"":h.startsWith(`${i}/`)?h.slice(i.length+1):h.replace(/^\/+/,"")}};function TN(e,t){return typeof e=="string"?e:`memory://${"name"in e&&typeof e.name=="string"&&e.name?e.name:t}`}function Vd(e){return e.split(/[?#]/,1)[0]}Wn();qt();so();function qd(e){let t=[],r=new Set,n=i=>{if(!i||typeof i!="object"||r.has(i))return;r.add(i);let o=i,s=o.extensions?.EXT_mesh_features?.featureIds;if(Array.isArray(s))for(let a of s){if(!a||typeof a!="object")continue;let c=a.texture?"texture":a.implicit?"implicit":a.attribute!==void 0?"attribute":a.propertyTable!==void 0?"property-table":"constant";t.push({source:c,attribute:a.attribute,propertyTable:a.propertyTable,constant:a.constant,texture:a.texture,implicit:a.implicit,values:a.values,details:a})}for(let a of Object.values(o))n(a)};return n(e),t}qt();so();Dr();Wn();function wv(e){return e!=null}var wr=new I,jd=new I,gv=new bt;function Xc(e,t,r,n=t){if(ii(e,"3D Tile: boundingVolume must be defined"),e.box){let i=e.s2VolumeInfo?gv:t;return yv(e.box,i,r)}if(e.region){let i=Ph(e.region),o=t.equals(n)?gv:t.clone().multiplyRight(n.clone().invert());return yv([...i.center,...i.halfAxes],o,r)}if(e.sphere)return IN(e.sphere,t,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function _v(e,t,r=!1){if(e.box||e.region&&r)return AN(t);if(e.region){let[n,i,o,s,a,c]=e.region;return[[Br(n),Br(i),a],[Br(o),Br(s),c]]}if(e.sphere)return PN(t);throw new Error("Unkown boundingVolume type")}function yv(e,t,r){let n=new I(e[0],e[1],e[2]);t.transform(n,n);let i=[];if(e.length===10){let l=e.slice(3,6),h=new to;h.fromArray(e,6);let u=new I([1,0,0]),f=new I([0,1,0]),d=new I([0,0,1]);u.transformByQuaternion(h),u.scale(l[0]),f.transformByQuaternion(h),f.scale(l[1]),d.transformByQuaternion(h),d.scale(l[2]),i=[...u.toArray(),...f.toArray(),...d.toArray()]}else i=[...e.slice(3,6),...e.slice(6,9),...e.slice(9,12)];let o=t.transformAsVector(i.slice(0,3)),s=t.transformAsVector(i.slice(3,6)),a=t.transformAsVector(i.slice(6,9)),c=new Qr([o[0],o[1],o[2],s[0],s[1],s[2],a[0],a[1],a[2]]);return wv(r)?(r.center=n,r.halfAxes=c,r):new oo(n,c)}function IN(e,t,r){let n=new I(e[0],e[1],e[2]);t.transform(n,n);let i=t.getScale(jd),o=Math.max(Math.max(i[0],i[1]),i[2]),s=e[3]*o;return wv(r)?(r.center=n,r.radius=s,r):new en(n,s)}function AN(e){let t=Mv(),{halfAxes:r}=e,n=new I(r.getColumn(0)),i=new I(r.getColumn(1)),o=new I(r.getColumn(2));for(let s=0;s<2;s++){for(let a=0;a<2;a++){for(let c=0;c<2;c++)wr.copy(e.center),wr.add(n),wr.add(i),wr.add(o),bv(t,wr),o.negate();i.negate()}n.negate()}return t}function PN(e){let t=Mv(),{center:r,radius:n}=e,i=pt.WGS84.scaleToGeodeticSurface(r,wr),o;i?o=pt.WGS84.geodeticSurfaceNormal(i):o=new I(0,0,1);let s=new I(o[2],-o[1],0);s.len()>0?s.normalize():s=new I(0,1,0);let a=s.clone().cross(o);for(let c of[s,a,o]){jd.copy(c).scale(n);for(let l=0;l<2;l++)wr.copy(r),wr.add(jd),bv(t,wr),jd.negate()}return t}function Mv(){return[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]]}function bv(e,t){pt.WGS84.cartesianToCartographic(t,wr),e[0][0]=Math.min(e[0][0],wr[0]),e[0][1]=Math.min(e[0][1],wr[1]),e[0][2]=Math.min(e[0][2],wr[2]),e[1][0]=Math.max(e[1][0],wr[0]),e[1][1]=Math.max(e[1][1],wr[1]),e[1][2]=Math.max(e[1][2],wr[2])}qt();Dr();Dr();var U1=new I,xv=new I,is=new I,Sv=new I,RN=new I,G1=new bt,vv=new bt;function Wd(e,t){if(e.lodMetricValue===0||Number.isNaN(e.lodMetricValue))return"DIG";let r=2*z1(e,t);if(r<2)return"OUT";if(!e.header.children)return"DRAW";switch(e.lodMetricType){case"screenSpaceRelative":{let n=t.topDownViewport.height||1;return r/n<=e.lodMetricValue?"DRAW":"DIG"}case"distanceRangeFromDefaultCamera":return e.distanceToTile(t)>=e.lodMetricValue?"DRAW":"DIG";case"maxScreenThresholdSQ":{let n=Math.sqrt(e.lodMetricValue/(Math.PI*.25));return r<=n?"DRAW":"DIG"}default:return r<=e.lodMetricValue?"DRAW":"DIG"}}function z1(e,t){let{topDownViewport:r}=t,n=e.header.i3sLodMbs||e.header.mbs,i=n[1],o=n[0],s=n[2],a=n[3],c=[...e.boundingVolume.center],l=r.unprojectPosition(r.cameraPosition);pt.WGS84.cartographicToCartesian(l,U1),xv.copy(U1).subtract(c).normalize(),ga(pt.WGS84,c,G1),vv.copy(G1).invert(),is.copy(U1).transform(vv);let h=Math.sqrt(is[0]*is[0]+is[1]*is[1]),u=h*h/is[2];Sv.copy([is[0],is[1],u]);let d=Sv.transform(G1).subtract(c).normalize(),p=xv.cross(d).normalize().scale(a).add(c),g=pt.WGS84.cartesianToCartographic(p),y=r.project([o,i,s]),_=r.project(g);return RN.copy(y).subtract(_).magnitude()}Wn();var zh=class{_map=new Map;_array;_length;constructor(t=0){this._array=new Array(t),this._length=t}get length(){return this._length}set length(t){this._length=t,t>this._array.length&&(this._array.length=t)}get values(){return this._array}get(t){return ii(t<this._array.length),this._array[t]}set(t,r){ii(t>=0),t>=this.length&&(this.length=t+1),this._map.has(this._array[t])&&this._map.delete(this._array[t]),this._array[t]=r,this._map.set(r,t)}delete(t){let r=this._map.get(t);r>=0&&(this._array.splice(r,1),this._map.delete(t),this.length--)}peek(){return this._array[this._length-1]}push(t){if(!this._map.has(t)){let r=this.length++;this._array[r]=t,this._map.set(t,r)}}pop(){let t=this._array[--this.length];return this._map.delete(t),t}reserve(t){ii(t>=0),t>this._array.length&&(this._array.length=t)}resize(t){ii(t>=0),this.length=t}trim(t){t==null&&(t=this.length),this._array.length=t}reset(){this._array=[],this._map=new Map,this._length=0}find(t){return this._map.has(t)}};var CN={loadSiblings:!1,skipLevelOfDetail:!1,baseScreenSpaceError:1024,skipScreenSpaceErrorFactor:16,skipLevels:1,immediatelyLoadDesiredLevelOfDetail:!1,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""},Li=class{options;disableSkipLevelOfDetail=!1;root=null;selectedTiles={};requestedTiles={};deferredTiles={};emptyTiles={};lastUpdate=new Date().getTime();updateDebounceTime=1e3;_traversalStack=new zh;_emptyTraversalStack=new zh;_frameNumber=null;traversalFinished(t){return!0}constructor(t){this.options={...CN,...t}}isSkipLevelOfDetailEnabled(){return this.options.skipLevelOfDetail&&!this.disableSkipLevelOfDetail}traverse(t,r,n){this.root=t,this.options={...this.options,...n},this.reset(),this.updateTile(t,r),this._frameNumber=r.frameNumber,this.executeTraversal(t,r)}reset(){this.requestedTiles={},this.deferredTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(t,r){let n=this._traversalStack;for(t._selectionDepth=1,n.push(t);n.length>0;){let i=n.pop(),o=!1;this.canTraverse(i,r)&&(this.updateChildTiles(i,r),o=this.updateAndPushChildren(i,r,n,i.hasRenderContent?i._selectionDepth+1:i._selectionDepth));let s=i.parent,a=!!(!s||s._shouldRefine),c=!o;i.hasRenderContent?i.refine===ze.ADD?(this.loadTile(i,r),this.selectTile(i,r)):i.refine===ze.REPLACE&&(this.loadTile(i,r),(c||this.isSkipLevelOfDetailEnabled())&&this.selectTile(i,r)):(this.emptyTiles[i.id]=i,this.loadTile(i,r),c&&this.selectTile(i,r)),this.touchTile(i,r),i._shouldRefine=o&&a}this.completeTraversal(r)}completeTraversal(t){let r=new Date().getTime();(this.traversalFinished(t)||r-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=r,this.options.onTraversalEnd(t))}updateChildTiles(t,r){let n=t.children;for(let i of n)this.updateTile(i,r)}updateAndPushChildren(t,r,n,i){let{loadSiblings:o}=this.options,s=this.isSkipLevelOfDetailEnabled(),a=t.children;a.sort(this.compareDistanceToCamera.bind(this));let c=t.refine===ze.REPLACE&&t.hasRenderContent&&!s,l=!1,h=!0;for(let u of a)if(u._selectionDepth=i,u.isVisibleAndInRequestVolume?(n.find(u)&&n.delete(u),n.push(u),l=!0):(c||o)&&u._inRequestVolume&&(this.loadTile(u,r),this.touchTile(u,r)),c){let f;u._inRequestVolume?u.hasRenderContent?f=u.contentAvailable:f=this.executeEmptyTraversal(u,r):f=!1,h=h&&f}return l||(h=!1),h}updateTile(t,r){this.updateTileVisibility(t,r)}selectTile(t,r){this.shouldSelectTile(t,r)&&(t._selectedFrame=r.frameNumber,this.selectedTiles[t.id]=t)}loadTile(t,r){if(this.shouldLoadTile(t)){if(this.shouldDeferTileRequest(t)){this.deferredTiles[t.id]=t;return}t._requestedFrame=r.frameNumber,t._priority=t._getPriority(),this.requestedTiles[t.id]=t}}shouldDeferTileRequest(t){return t.priorityDeferred}touchTile(t,r){t.tileset._cache.touch(t),t._touchedFrame=r.frameNumber}canTraverse(t,r){return t.hasChildren?t.hasTilesetContent?!t.contentExpired:this.shouldRefine(t,r):!1}shouldLoadTile(t){return t.hasUnloadedContent||t.contentExpired}shouldSelectTile(t,r){return t.contentAvailable&&t.contentVisibility(r)!=="outside"}shouldRefine(t,r,n=!1){let i=t._screenSpaceError;return n&&(i=t.getScreenSpaceError(r,!0)),i>t.tileset.memoryAdjustedScreenSpaceError}updateTileVisibility(t,r){let n=[];if(this.options.viewportTraversersMap)for(let i in this.options.viewportTraversersMap)this.options.viewportTraversersMap[i]===r.viewport.id&&n.push(i);else n.push(r.viewport.id);t.updateVisibility(r,n)}compareDistanceToCamera(t,r){return t._distanceToCamera-r._distanceToCamera}anyChildrenVisible(t,r){let n=!1;for(let i of t.children)i.updateVisibility(r),n=n||i.isVisibleAndInRequestVolume;return n}executeEmptyTraversal(t,r){let n=!0,i=!1,o=this._emptyTraversalStack;for(o.push(t);o.length>0;){let s=o.pop(),a=!s.hasRenderContent&&this.canTraverse(s,r),c=!s.hasRenderContent&&s.children.length===0;if(s.header.implicitSubtree&&(i=!0,n=!1),!a&&!s.contentAvailable&&!c&&(n=!1),this.updateTile(s,r),s.isVisibleAndInRequestVolume||(this.loadTile(s,r),this.touchTile(s,r)),a){let l=s.children;for(let h of l)o.push(h)}}return t.hasEmptyContent&&!i||n}};var V1=new I;function NN(e,t,r,n,i=[]){let o=e.length?e:[t],s=!1,a=!1;for(let c of o){let l="inside";if(n!==sr.MASK_INSIDE&&(l=r.computeVisibility(c),l==="outside"))continue;let h=!1;for(let u of i)if(c.intersectPlane(u)==="outside"){h=!0;break}h||(s=!0,a=a||l==="intersecting")}return s?a?"intersecting":"inside":"outside"}function Ev(e){if(!e||typeof e!="object")return!1;let t=e;return t.shape==="tileset3d"||t.type==="tileset3d"||!!t.tileset}function ON(e){return e!=null}var bn=class{tileset;header;id;url;parent;refine;type;contentUrl;contentUrls=[];lodMetricType="geometricError";lodMetricValue=0;_unscaledLodMetricValue=0;_scaleGeometricError=!0;boundingVolume=null;content=null;contents=[];contentEntries=[];metadataContext={};featureIdSets=[];vectorContent=null;metadata=null;contentMetadata=[];contentState=ir.UNLOADED;gpuMemoryUsageInBytes=0;children=[];childrenState="ready";depth=0;viewportIds=[];transform=new bt;extensions=null;implicitTiling=null;userData={};computedTransform;hasEmptyContent=!1;hasTilesetContent=!1;traverser=new Li({});_cacheNode=null;_frameNumber=null;_expireDate=null;_expiredContent=null;_childrenPromise=null;_boundingBox=void 0;_distanceToCamera=0;_screenSpaceError=0;_screenSpaceErrorProgressiveResolution=0;_priorityProgressiveResolution=!1;_foveatedFactor=0;priorityDeferred=!1;_visibilityPlaneMask;_visible=void 0;_contentBoundingVolume;_contentBoundingVolumes=[];_contentBoundingVolumeHeaders=[];_viewerRequestVolume;get contentBoundingVolume(){return this._contentBoundingVolume}get contentBoundingVolumes(){return this._contentBoundingVolumes}get viewerRequestVolume(){return this._viewerRequestVolume}_initialTransform=new bt;_priority=0;_selectedFrame=0;_requestedFrame=0;_selectionDepth=0;_touchedFrame=0;_centerZDepth=0;_shouldRefine=!1;_stackLength=0;_visitedFrame=0;_inRequestVolume=!1;_lodJudge=null;tileDrawn=!0;constructor(t,r,n,i=""){this.header=r,this.tileset=t,this.id=i||r.id,this.url=r.url,this.parent=n,this.refine=this._getRefine(r.refine),this.type=r.type,this.contentUrl=r.contentUrl,this.contentUrls=r.contentUrls||(r.contentUrl?[r.contentUrl]:[]),this._initializeMetadata(r),this.childrenState=r.implicitSubtree?"unloaded":"ready",this._initializeLodMetric(r),this._initializeTransforms(r),this._updateLodMetricScale(),this._initializeBoundingVolumes(r),this._initializeContent(r),this._initializeContentEntries(r),this._initializeRenderingState(r),Object.seal(this)}destroy(){this.header=null}isDestroyed(){return this.header===null}get selected(){return this._selectedFrame===this.tileset._frameNumber}get isVisible(){return this._visible}get isVisibleAndInRequestVolume(){return this._visible&&this._inRequestVolume}get hasRenderContent(){return!this.hasEmptyContent&&!this.hasTilesetContent}get hasChildren(){return this.children.length>0||this.header.children&&this.header.children.length>0||!!(this.header.implicitSubtree&&this.childrenState!=="ready")}get hasUnloadedChildren(){return!!(this.header.implicitSubtree&&(this.childrenState==="unloaded"||this.childrenState==="failed"))}get childrenLoading(){return this.childrenState==="loading"}get contentReady(){return this.contentState===ir.READY||this.hasEmptyContent}get contentAvailable(){return!!(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}get hasUnloadedContent(){return this.hasRenderContent&&this.contentUnloaded}get contentUnloaded(){return this.contentState===ir.UNLOADED}get contentExpired(){return this.contentState===ir.EXPIRED}get contentFailed(){return this.contentState===ir.FAILED}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}get boundingBox(){return this._boundingBox||(this._boundingBox=_v(this.header.boundingVolume,this.boundingVolume,!this.computedTransform.equals(this._initialTransform))),this._boundingBox}getScreenSpaceError(t,r,n=1){switch(this.tileset.type){case nr.I3S:return z1(this,t);case nr.TILES3D:return $S(this,t,r,n);default:throw new Error("Unsupported tileset type")}}unselect(){this._selectedFrame=0}_getGpuMemoryUsageInBytes(){return(this.contents.length?this.contents:[this.content]).reduce((r,n)=>r+(n?.gpuMemoryUsageInBytes||n?.byteLength||0),0)}_getPriority(){return this._calculateRequestPriority(!1)}_getChildrenPriority(){return this._calculateRequestPriority(!0)}_calculateRequestPriority(t){let r=this.tileset._traverser,n=r.options.skipLevelOfDetail&&!r.disableSkipLevelOfDetail,i=this.refine===ze.ADD||n;if(i&&!this.isVisible&&this._visible!==void 0||this.tileset._frameNumber-this._touchedFrame>=1||this.priorityDeferred||!t&&this.contentState===ir.UNLOADED)return-1;let o=this.parent,a=o&&(!i||this._screenSpaceError===0||o.hasTilesetContent)?o._screenSpaceError:this._screenSpaceError,c=r.root?r.root._screenSpaceError:0,l=Math.max(c-a,0);return rv({priorityProgressiveResolution:this._priorityProgressiveResolution,foveatedFactor:this._foveatedFactor,reverseScreenSpaceError:l,rootScreenSpaceError:c})}async loadContent(){if(this.hasEmptyContent)return{loaded:!1};if(this.content)return{loaded:!0};this.contentExpired&&(this._expireDate=null),this.contentState=ir.LOADING;let r=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!r)return this.contentState=ir.UNLOADED,{loaded:!1};try{return await this._loadContentFromSource()}catch(n){throw this.contentState=ir.FAILED,n}finally{r.done()}}async loadContentForTraversal(){if(this.hasEmptyContent)return{loaded:!1};if(this.content)return{loaded:!0,contents:this.contents};this.contentState=ir.LOADING;try{return await this._loadContentFromSource()}catch(t){throw this.contentState=ir.FAILED,t}}async _loadContentFromSource(){let t=await this.tileset.source.loadTileContent(this);return t.contents&&(this.contents=t.contents,this.content=this.contents[0]||null),this.vectorContent=this.contents.find(r=>!!r?.vectorContent)?.vectorContent||null,this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this.contentState=ir.READY,this._onContentLoaded(),this._updateContentEntriesAfterLoad(t),t}async loadChildren(t){if(!this.header.implicitSubtree||this.childrenState==="ready")return{loaded:!1,tileCount:0,childSubtreeCount:0};if(this._childrenPromise)return await this._childrenPromise;if(!this.tileset.source.loadTileChildren)throw new Error("Tileset source does not support lazy tile children");this.childrenState="loading",this._childrenPromise=this._loadChildrenWithScheduler(t);try{return await this._childrenPromise}finally{this._childrenPromise=null}}async _loadChildrenWithScheduler(t){let r=await this.tileset._requestScheduler.scheduleRequest(`${this.id}:implicit-subtree`,this._getChildrenPriority.bind(this));if(!r)return this.childrenState="unloaded",{loaded:!1,tileCount:0,childSubtreeCount:0};try{let n=await this.tileset.source.loadTileChildren(this,t);return this.childrenState=n.loaded?"ready":"unloaded",n}catch(n){throw this.childrenState="failed",n}finally{r.done()}}applyImplicitSubtreeHeader(t){let r=this.header.transform,n=this.header.transformMatrix,i=t.transform!==void 0;this.header={...this.header,...t,transform:i?t.transform:r,transformMatrix:i?t.transformMatrix:n,implicitSubtree:void 0},i&&this._initializeTransforms(this.header),this.refine=this._getRefine(t.refine),this.type=t.type,this.contentUrl=t.contentUrl,this.contentUrls=t.contentUrls||(t.contentUrl?[t.contentUrl]:[]),this._initializeMetadata(this.header),this._initializeLodMetric(t),this._updateLodMetricScale(),this._initializeBoundingVolumes(this.header),this._boundingBox=void 0,this._initializeContent(this.header),this._initializeContentEntries(this.header)}_initializeMetadata(t){this.metadata=t.metadata||null;let r=Array.isArray(t.content)?t.content:[t.content];this.contentMetadata=r.filter(Boolean).map(a=>a.metadata||null);let i=(r.find(Boolean)||{}).group,o=typeof i=="number"?this.tileset.groups?.[i]||null:i||null,s={tileset:this.tileset.metadata||null,group:o,tile:this.metadata,content:this.contentMetadata[0]||null,subtree:t.implicitMetadata||null};this.tileset.groups&&(s.groups=this.tileset.groups),this.metadataContext=s}_updateContentEntriesAfterLoad(t){if(t.contentEntries){this.contentEntries=t.contentEntries.map((r,n)=>({...r,index:n,boundingVolume:r.boundingVolume||this._contentBoundingVolumes[n]||this.boundingVolume,payload:r.payload??this.contents[n]??null,featureIds:r.featureIds?.length?r.featureIds:qd(r.payload??this.contents[n]),renderable:!!(r.renderable!==!1&&(r.payload??this.contents[n])&&!Ev(r.payload??this.contents[n]))})),this.featureIdSets=this.contentEntries.flatMap(r=>r.featureIds);return}this.contentEntries=this.contentEntries.map((r,n)=>({...r,payload:this.contents[n]??null,featureIds:qd(this.contents[n]),renderable:!!this.contents[n]&&!Ev(this.contents[n])})),this.featureIdSets=this.contentEntries.flatMap(r=>r.featureIds)}getContentEntry(t){return this.contentEntries[t]||null}isContentRenderable(t){return!!this.contentEntries[t]?.renderable}_initializeContentEntries(t){let r=Array.isArray(t.content)?t.content:t.content?[t.content]:[];this.contentEntries=r.map((n,i)=>{let o=n||{};return{index:i,uri:this.contentUrls[i]||o.uri||o.url,group:o.group,type:o.type,payload:null,metadata:o.metadata||null,boundingVolume:this._contentBoundingVolumes[i]||this.boundingVolume,featureIds:this._getFeatureIdSets(o),renderable:!1}})}_getFeatureIdSets(t){return qd(t)}unloadContent(){for(let t of this.contents.length?this.contents:[this.content])t&&t.destroy&&t.destroy();return this.contents=[],this.content=null,this.vectorContent=null,this.contentEntries=this.contentEntries.map(t=>({...t,payload:null,renderable:!1})),this.featureIdSets=this.contentEntries.flatMap(t=>t.featureIds),this.header.content&&this.header.content.destroy&&this.header.content.destroy(),this.header.content=null,this.contentState=ir.UNLOADED,this.tileDrawn=!0,!0}updateVisibility(t,r){if(this._frameNumber===t.frameNumber)return;let n=this.parent,i=n?n._visibilityPlaneMask:sr.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){let o=n?n.computedTransform:this.tileset.modelMatrix;this._updateTransform(o)}this._distanceToCamera=this.distanceToTile(t),this._screenSpaceError=this.getScreenSpaceError(t,!1),this._updateRequestPriorityMetrics(t),this._visibilityPlaneMask=this.visibility(t,i),this._visible=this._visibilityPlaneMask!==sr.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(t),this._frameNumber=t.frameNumber,this.viewportIds=r}_updateRequestPriorityMetrics(t){if(this.tileset.type!==nr.TILES3D){this._screenSpaceErrorProgressiveResolution=this._screenSpaceError,this._priorityProgressiveResolution=!1,this._foveatedFactor=0,this.priorityDeferred=!1;return}let r=this.tileset.options,n=r.progressiveResolutionHeightFraction;if(this._screenSpaceErrorProgressiveResolution=this.getScreenSpaceError(t,!1,n),this._priorityProgressiveResolution=QS(this._screenSpaceErrorProgressiveResolution,this.parent?._screenSpaceErrorProgressiveResolution,this.tileset.memoryAdjustedScreenSpaceError,n),!r.foveatedScreenSpaceError||t.viewport?.orthographic||!t.camera?.position||!t.camera?.direction){this._foveatedFactor=0,this.priorityDeferred=!1;return}this._foveatedFactor=JS(this.boundingVolume,t.camera);let i=this.tileset._traverser,o=i.options.skipLevelOfDetail&&!i.disableSkipLevelOfDetail,s=tv({refinement:this.refine,skipLevelOfDetail:o,foveatedScreenSpaceError:r.foveatedScreenSpaceError,foveatedConeSize:r.foveatedConeSize,minimumScreenSpaceErrorRelaxation:r.foveatedMinimumScreenSpaceErrorRelaxation,interpolationCallback:r.foveatedInterpolationCallback,foveatedFactor:this._foveatedFactor,verticalFieldOfView:t.camera.verticalFieldOfView,screenSpaceError:this._screenSpaceError,parentScreenSpaceError:this.parent?._screenSpaceError,maximumScreenSpaceError:this.tileset.memoryAdjustedScreenSpaceError,priorityProgressiveResolution:this._priorityProgressiveResolution});this.priorityDeferred=ev(s,t.camera.timeSinceMovement,r.foveatedTimeDelay)}visibility(t,r){let{cullingVolume:n}=t,{boundingVolume:i}=this;return n.computeVisibilityWithPlaneMask(i,r)}contentVisibility(t,r){let n=r===void 0?this._contentBoundingVolumes:this._contentBoundingVolumes[r]?[this._contentBoundingVolumes[r]]:[];return NN(n,this.boundingVolume,t.cullingVolume,this._visibilityPlaneMask,t.clippingPlanes)}distanceToTile(t){let r=this.boundingVolume;return Math.sqrt(Math.max(r.distanceSquaredTo(t.camera.position),0))}cameraSpaceZDepth({camera:t}){let r=this.boundingVolume;return V1.subVectors(r.center,t.position),t.direction.dot(V1)}insideViewerRequestVolume(t){let r=this._viewerRequestVolume;return!r||r.distanceSquaredTo(t.camera.position)<=0}updateExpiration(){if(ON(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){let t=Date.now();Date.lessThan(this._expireDate,t)&&(this.contentState=ir.EXPIRED,this._expiredContent=this.content)}}get extras(){return this.header.extras}_initializeLodMetric(t){this._scaleGeometricError=typeof t._scaleGeometricError=="boolean"?t._scaleGeometricError:this.parent?._scaleGeometricError??!0,"lodMetricType"in t?this.lodMetricType=t.lodMetricType:(this.lodMetricType=this.parent&&this.parent.lodMetricType||this.tileset.lodMetricType,Ji.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType")()),"lodMetricValue"in t?this._unscaledLodMetricValue=t.lodMetricValue:(this._unscaledLodMetricValue=this.parent?this.parent._unscaledLodMetricValue:this.tileset.lodMetricValue,Ji.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue")()),this.lodMetricValue=this._unscaledLodMetricValue}_initializeTransforms(t){this.transform=t.transform?new bt(t.transform):new bt;let r=this.parent,n=this.tileset,i=r&&r.computedTransform?r.computedTransform.clone():n.modelMatrix.clone();this.computedTransform=new bt(i).multiplyRight(this.transform);let o=r&&r._initialTransform?r._initialTransform.clone():new bt;this._initialTransform=new bt(o).multiplyRight(this.transform)}_updateLodMetricScale(){if(this.lodMetricType!==$c.GEOMETRIC_ERROR||!this._scaleGeometricError){this.lodMetricValue=this._unscaledLodMetricValue;return}let t=this.computedTransform.getScale(V1),r=Math.max(t[0],t[1],t[2]);this.lodMetricValue=this._unscaledLodMetricValue*r}_initializeBoundingVolumes(t){this._contentBoundingVolume=null,this._contentBoundingVolumeHeaders=[],this._viewerRequestVolume=null,this._updateBoundingVolume(t)}_initializeContent(t){this.content={_tileset:this.tileset,_tile:this},this.contents=[],this.hasEmptyContent=!0,this.contentState=ir.UNLOADED,this.hasTilesetContent=!1,(t.contentUrl||t.contentUrls?.length)&&(this.content=null,this.hasEmptyContent=!1)}_initializeRenderingState(t){this.depth=t.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._screenSpaceErrorProgressiveResolution=0,this._priorityProgressiveResolution=!1,this._foveatedFactor=0,this.priorityDeferred=!1,this._visibilityPlaneMask=sr.MASK_INDETERMINATE,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._frameNumber=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._priority=0}_getRefine(t){return t||this.parent&&this.parent.refine||ze.REPLACE}_isTileset(){return(this.contents.length?this.contents:[this.content]).some(t=>t?.shape==="tileset3d")}_onContentLoaded(){let t=this.contents.length?this.contents:[this.content];for(let r of t)switch(r&&r.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0;break;default:}this._isTileset()?this.hasTilesetContent=!0:this.gpuMemoryUsageInBytes=this._getGpuMemoryUsageInBytes()}_updateBoundingVolume(t){this._boundingBox=void 0,this.boundingVolume=Xc(t.boundingVolume,this.computedTransform,this.boundingVolume,this._initialTransform),t.viewerRequestVolume&&(this._viewerRequestVolume=Xc(t.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume,this._initialTransform));let r=t.content;r&&(this._contentBoundingVolumeHeaders=Array.isArray(r)?r:[r]);let n=r?Array.isArray(r)?r:[r]:this._contentBoundingVolumeHeaders;this._contentBoundingVolumes=n.length?n.map(i=>i?.boundingVolume?Xc(i.boundingVolume,this.computedTransform,void 0,this._initialTransform):this.boundingVolume):[this.boundingVolume],this._contentBoundingVolume=this._contentBoundingVolumes[0]||null}_updateTransform(t=new bt){let r=t.clone().multiplyRight(this.transform);r.equals(this.computedTransform)||(this.computedTransform=r,this._updateLodMetricScale(),this._updateBoundingVolume(this.header))}};Wn();Dr();qt();var Hd=class extends Li{pendingImplicitSubtrees=new Map;traversalFinished(t){let r=`${t.viewport.id}:`;for(let[n,i]of this.pendingImplicitSubtrees)if(n.startsWith(r)&&i===t.frameNumber)return!1;return!0}executeTraversal(t,r){if(!this.isSkipLevelOfDetailEnabled()){super.executeTraversal(t,r);return}this.executeSkipTraversal(t,r)}executeSkipTraversal(t,r){let n=[t];for(t._selectionDepth=t.parent?t.parent._selectionDepth:1;n.length>0;){let i=n.pop(),o=!i.parent||i.parent._shouldRefine,s=this.canTraverse(i,r)&&this.updateAndPushSkipChildren(i,r,n)&&o,a=!s&&o;i.hasRenderContent?i.refine===ze.ADD?(this.loadTile(i,r),this.selectDesiredTile(i,r)):i.refine===ze.REPLACE&&(this.isInBaseTraversal(i,r)?(this.loadTile(i,r),a&&this.selectDesiredTile(i,r)):a?(this.loadTile(i,r),this.selectDesiredTile(i,r)):this.hasReachedSkippingThreshold(i,r)&&this.loadTile(i,r)):(this.emptyTiles[i.id]=i,this.loadTile(i,r),a&&(!i.hasEmptyContent||i.hasChildren)&&this.selectDesiredTile(i,r)),this.touchTile(i,r),i._shouldRefine=s}this.completeTraversal(r)}updateAndPushSkipChildren(t,r,n){this.updateChildTiles(t,r),t.children.sort(this.compareDistanceToCamera.bind(this));let i=!1;for(let o of t.children)o._selectionDepth=t.hasRenderContent?t._selectionDepth+1:t._selectionDepth,o.isVisibleAndInRequestVolume?(n.push(o),i=!0):this.options.loadSiblings&&o._inRequestVolume&&(this.loadTile(o,r),this.touchTile(o,r));return i}isInBaseTraversal(t,r){if(this.options.immediatelyLoadDesiredLevelOfDetail)return!1;if(!this.findNearestRequestedOrLoadedAncestor(t,r))return!0;let n=Number.isFinite(this.options.baseScreenSpaceError)?Math.max(this.options.baseScreenSpaceError,0):1024,i=Math.max(n,t.tileset.memoryAdjustedScreenSpaceError);return t._screenSpaceError===0&&t.parent?t.parent._screenSpaceError>i:t._screenSpaceError>i}hasReachedSkippingThreshold(t,r){if(this.options.immediatelyLoadDesiredLevelOfDetail)return!1;if(t._priorityProgressiveResolution&&t._screenSpaceErrorProgressiveResolution<=t.tileset.memoryAdjustedScreenSpaceError&&!!(t.parent&&t.parent._screenSpaceErrorProgressiveResolution>t.tileset.memoryAdjustedScreenSpaceError))return!0;let i=this.findNearestRequestedOrLoadedAncestor(t,r);if(!i)return!1;let o=Number.isFinite(this.options.skipScreenSpaceErrorFactor)&&this.options.skipScreenSpaceErrorFactor>0?this.options.skipScreenSpaceErrorFactor:16,s=Number.isFinite(this.options.skipLevels)?Math.max(Math.floor(this.options.skipLevels),0):1;return t._screenSpaceError<i._screenSpaceError/o&&t.depth>i.depth+s}findNearestRequestedOrLoadedAncestor(t,r){let n=t.parent;for(;n;){if(n.hasRenderContent&&!n.contentFailed&&(!n.hasUnloadedContent||n._requestedFrame===r.frameNumber))return n;n=n.parent}return null}selectDesiredTile(t,r){let n=t;for(;n;){if(this.shouldSelectTile(n,r)){this.selectTile(n,r),n!==t&&this.selectLoadedDescendants(t,r,!0);return}n=n.parent}this.selectLoadedDescendants(t,r)}selectLoadedDescendants(t,r,n=!1){let i=[{tile:t,depth:0}];for(;i.length>0;){let{tile:o,depth:s}=i.pop();for(let a of o.children)this.updateTile(a,r),a.isVisibleAndInRequestVolume&&(this.shouldSelectTile(a,r)&&(!n||a.tileDrawn)?(this.selectTile(a,r),this.touchTile(a,r)):s<1&&i.push({tile:a,depth:s+1}))}}compareDistanceToCamera(t,r){return r._distanceToCamera===0&&t._distanceToCamera===0?r._centerZDepth-t._centerZDepth:r._distanceToCamera-t._distanceToCamera}updateChildTiles(t,r){let n=t.header.implicitSubtree?.coordinates.level===0;if(t.hasUnloadedChildren&&t.isVisibleAndInRequestVolume&&(n||this.shouldRefine(t,r))){let i=`${r.viewport.id}:${t.id}`;this.pendingImplicitSubtrees.has(i)||(this.pendingImplicitSubtrees.set(i,r.frameNumber),t.tileset._loadTileChildren(t,r).finally(()=>{this.handleImplicitSubtreeLoad(t,r,i)}))}super.updateChildTiles(t,r)}handleImplicitSubtreeLoad(t,r,n){this.pendingImplicitSubtrees.delete(n),this._frameNumber===r.frameNumber&&(t.childrenState==="ready"?this.executeTraversal(t,r):this.traversalFinished(r)&&this.options.onTraversalEnd(r))}updateTileVisibility(t,r){if(super.updateTileVisibility(t,r),!t.isVisibleAndInRequestVolume)return;let n=t.children.length>0;if(t.hasTilesetContent&&n){let s=t.children[0];this.updateTileVisibility(s,r),t._visible=s._visible;return}if(this.meetsScreenSpaceErrorEarly(t,r)){t._visible=!1;return}let i=t.refine===ze.REPLACE,o=t._optimChildrenWithinParent===YS.USE_OPTIMIZATION;if(i&&o&&n&&!this.anyChildrenVisible(t,r)){t._visible=!1;return}}meetsScreenSpaceErrorEarly(t,r){let{parent:n}=t;return!n||n.hasTilesetContent||n.refine!==ze.ADD?!1:!this.shouldRefine(t,r,!0)}};qt();so();Dr();var BN=6378137,LN=6378137,k1=6356752314245179e-9,Zc=new I;function Tv(e,t){if(e instanceof oo){let{halfAxes:r}=e,n=DN(r);return Math.log2(k1/(n+t[2]))}else if(e instanceof en){let{radius:r}=e;return Math.log2(k1/(r+t[2]))}else if(e.width&&e.height){let{width:r,height:n}=e,i=Math.log2(BN/r),o=Math.log2(LN/n);return(i+o)/2}return 1}function q1(e,t,r){pt.WGS84.cartographicToCartesian([e.xmax,e.ymax,e.zmax],Zc);let n=Math.sqrt(Math.pow(Zc[0]-r[0],2)+Math.pow(Zc[1]-r[1],2)+Math.pow(Zc[2]-r[2],2));return Math.log2(k1/(n+t[2]))}function Iv(e,t,r){let[n,i,o,s]=e;return q1({xmin:n,xmax:o,ymin:i,ymax:s,zmin:0,zmax:0},t,r)}function DN(e){e.getColumn(0,Zc);let t=e.getColumn(1),r=e.getColumn(2);return Zc.add(t).add(r).len()}var FN=Object.freeze({meter:1,millimeter:.001,centimeter:.01,decimeter:.1,kilometer:1e3,foot:.3048,yard:.9144,mile:1609.344,"us-foot":.3048006096012192,"us-inch":.0254000508001016,"us-yard":.9144018288036576,"us-mile":1609.3472186944373,"clarke-foot":.3047972654,"clarke-yard":.9143917962,"clarke-link":.201166195164,"sears-yard":.914398414616,"sears-foot":.304799471539,"sears-chain":20.1167651216,"sears-1922-truncated-chain":20.116756,"benoit-1895-b-chain":20.1167824944,"indian-yard":.914398530744,"indian-1937-yard":.91439523,"gold-coast-foot":.304799710181}),UN=Object.freeze({m:"meter",metre:"meter",meters:"meter",metres:"meter",mm:"millimeter",millimetre:"millimeter",millimeters:"millimeter",millimetres:"millimeter",cm:"centimeter",centimetre:"centimeter",centimeters:"centimeter",centimetres:"centimeter",dm:"decimeter",decimetre:"decimeter",decimeters:"decimeter",decimetres:"decimeter",km:"kilometer",kilometre:"kilometer",kilometers:"kilometer",kilometres:"kilometer",ft:"foot",feet:"foot","us-survey-foot":"us-foot","us-survey-feet":"us-foot",yd:"yard",yards:"yard",mi:"mile",miles:"mile"});function Vh(e){if(!e)return;let t=e.trim().toLowerCase().replaceAll("_","-"),r=UN[t]||t;return FN[r]}function Av(e,t){return t!==void 0?Number.isFinite(t)&&t>0?t:void 0:e?Vh(e):1}function $d(e){let t=e.spatialReference||e.fullExtent?.spatialReference,r=qN(t),n=e.heightModelInfo?.vertCRS||jN(t),i=e.heightModelInfo?.heightModel,o=e.heightModelInfo?.heightUnit,s=Av(o,e.ZFactor),a=i==="ellipsoidal"?"ellipsoidal":i==="gravity_related_height"?"orthometric":"unknown",c=Cv(t),l=c===void 0?r?_n(r):"unknown":_n(`EPSG:${c}`),h=GN(l,o,e.ZFactor),u=[],f=zN(e.elevationInfo?.mode),d=e.elevationInfo?e.elevationInfo.unit||"meter":void 0,m=Vh(d);return s===void 0&&u.push(e.ZFactor!==void 0?`I3S ZFactor ${e.ZFactor} is not a positive finite conversion factor`:`Unsupported I3S vertical unit ${o}`),e.elevationInfo&&m===void 0&&u.push(`Unsupported I3S elevation unit ${d}`),e.elevationInfo?.mode&&!f&&u.push(`Unsupported I3S elevation mode ${e.elevationInfo.mode}`),f&&f!=="absoluteHeight"&&u.push(`I3S elevation mode ${f} requires a terrain or scene elevation provider`),Mn({sourceCrs:r,sourceCrsRepresentation:c!==void 0?"identifier":r?"wkt":void 0,sourceCrsAlternatives:c!==void 0&&t?.wkt?[{definition:t.wkt,representation:"wkt"}]:void 0,verticalCrs:n,units:h,verticalUnitScale:s??Number.NaN,heightReference:a,elevationMode:f,elevationOffset:e.elevationInfo?.offset,elevationUnit:d,elevationUnitScale:e.elevationInfo?.mode&&!f?Number.NaN:m??(e.elevationInfo?Number.NaN:1),coordinateFrame:l,axisOrder:r?"xyz":"unknown",provenance:r?"metadata":"unknown",warnings:u})}function GN(e,t,r){if(e==="geocentric")return["meter","meter","meter"];if(e==="geographic"&&(t||r===void 0))return["degree","degree",t||"meter"]}function zN(e){switch(e){case"absoluteHeight":case"onTheGround":case"relativeToGround":case"relativeToScene":return e;default:return}}function Yd(e){let t=VN(e);if(t)return t;let r=Pv(e,"TILESET_CRS_GEOCENTRIC"),n=Pv(e,"TILESET_CRS_COORDINATE_EPOCH"),i=[],o,s="unknown",a;typeof r=="string"&&r.toUpperCase()!=="UNKNOWN"?(o=r,s="metadata",a="explicit"):r!==void 0?(i.push("3D Tiles geocentric CRS is explicitly unknown"),s="metadata",a="unknown"):e.root?.boundingVolume?.region?(o="EPSG:4978",s="format-default",a="default"):e.schemaUri&&!e.schema&&i.push("External 3D Tiles metadata schema must be loaded before CRS semantics can resolve");let c=Rv(n);return n!==void 0&&c===void 0&&i.push("3D Tiles coordinate epoch is not a finite decimal year"),Mn({sourceCrs:o,sourceCrsState:a,sourceCrsRepresentation:o?"identifier":void 0,coordinateEpoch:c,heightReference:o?"ellipsoidal":"unknown",coordinateFrame:o?"geocentric":"unknown",axisOrder:o?"xyz":"unknown",provenance:s,warnings:i})}function VN(e){let t=e.extensions?.EXT_geospatial_crs;if(!t)return;let r=[],n,i,o,s;if(t.format==="wkid"){let h=t.extensions?.EXT_geospatial_crs_wkid;typeof h?.authority=="string"&&Number.isInteger(h.wkid)?(n=`${h.authority}:${h.wkid}`,s="identifier",Number.isInteger(h.vcsWkid)&&(i=`${h.authority}:${h.vcsWkid}`),o=Rv(h.epoch),h.epoch!==void 0&&o===void 0&&r.push("EXT_geospatial_crs_wkid epoch is not a finite decimal year")):r.push("EXT_geospatial_crs_wkid requires string authority and integer wkid")}else if(t.format==="wkt2"){let h=t.extensions?.EXT_geospatial_crs_wkt2;typeof h?.wkt2=="string"&&h.wkt2.trim()?(n=h.wkt2,s="wkt"):r.push("EXT_geospatial_crs_wkt2 requires a nonempty wkt2 string")}else r.push(`Unsupported EXT_geospatial_crs format ${String(t.format)}`);let a=s==="wkt"?_n(n):C1(n)||"unknown",c=kN(i);i&&!c&&r.push(`Unsupported vertical CRS ${String(i)}; vertical unit and height reference are unknown`);let l=i?c?.unit:"meter";return Mn({sourceCrs:n,sourceCrsState:n?"explicit":"unknown",sourceCrsRepresentation:s,verticalCrs:i,coordinateEpoch:o,units:a==="geocentric"?["meter","meter","meter"]:a==="geographic"&&l?["degree","degree",l]:void 0,verticalUnitScale:i?c?.verticalUnitScale??Number.NaN:1,heightReference:i?c?.heightReference??"unknown":n?"ellipsoidal":"unknown",coordinateFrame:a,axisOrder:n?"xyz":"unknown",provenance:"metadata",warnings:r})}function kN(e){if(typeof e!="string")return;let t=/^EPSG:(\d+)$/i.exec(e);if(t)switch(Number(t[1])){case 5702:case 6360:return{unit:"us-foot",verticalUnitScale:1200/3937,heightReference:"orthometric"};case 5703:return{unit:"meter",verticalUnitScale:1,heightReference:"orthometric"};default:return}}function Rv(e){if(typeof e!="string"&&typeof e!="number"||typeof e=="string"&&!e.trim())return;let t=Number(e);return Number.isFinite(t)?t:void 0}function qN(e){let t=Cv(e);return t!==void 0?`EPSG:${t}`:e?.wkt}function jN(e){let t=e?.latestVcsWkid??e?.vcsWkid;return t===void 0?void 0:`EPSG:${t}`}function Cv(e){return e?.latestWkid??e?.wkid}function Pv(e,t){let r=e.metadata?.class;if(!r)return;let i=e.schema?.classes?.[r]?.properties,o=e.metadata?.properties;for(let[s,a]of Object.entries(i||{}))if(a.semantic===t)return o?.[s]}qt();Dr();function Nv(e){return{input:new Float64Array(e),output:new Float64Array(e)}}function kh(e){return e instanceof Float32Array||e instanceof Float64Array}function Ov(e){return typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer}function j1(e,t,r,n,i,o){return(e.buffer===n.buffer||Ov(e.buffer)&&Ov(n.buffer))&&t<o&&i<r}function Kd(e,t,r,n){return e<t+n?0:Math.floor((e-t-n)/r)+1}var Xd=class{constructor(t){this.depth=0;let r=t.dimension??2,n=t.inputOffset??0,i=t.outputOffset??0;if(!Number.isSafeInteger(r)||r<2||!Number.isSafeInteger(n)||n<0||!Number.isSafeInteger(i)||i<0||t.inputStride!==void 0&&(!Number.isSafeInteger(t.inputStride)||t.inputStride<1)||t.outputStride!==void 0&&(!Number.isSafeInteger(t.outputStride)||t.outputStride<1)||typeof t.projection?.projectToSync!="function"||typeof t.projection?.unprojectToSync!="function")throw new Error("Invalid projection buffer transform or layout");this.dimension=r,this.projection=t.projection,this.inputOffset=n,this.outputOffset=i,this.inputStride=t.inputStride,this.outputStride=t.outputStride,this.scratch=[Nv(r)]}projectFlatTo(t,r,n,i=0,o){return this.flat(t,r,n,i,!1,o)}unprojectFlatTo(t,r,n,i=0,o){return this.flat(t,r,n,i,!0,o)}projectColumnsTo(t,r,n,i=0,o){return this.columns(t,r,n,i,!1,o)}unprojectColumnsTo(t,r,n,i=0,o){return this.columns(t,r,n,i,!0,o)}range(t,r,n){let i=r??Math.max(0,t-n);if(!Number.isSafeInteger(n)||n<0||!Number.isSafeInteger(i)||i<0||!Number.isSafeInteger(n+i)||n+i>t)throw new Error("Invalid projection buffer record range");return i}epochStorage(t,r,n){if(t!==void 0){if(typeof t=="number"){if(!Number.isFinite(t))throw new Error("Coordinate epoch must be finite")}else if(!kh(t)||t.length<r+n)throw new Error("Epoch buffer requires one value per addressed record")}}aliases(t,r,n,i,o,s,a){if(!i)return;let c=t.byteOffset+(this.inputOffset+n*o)*t.BYTES_PER_ELEMENT,l=c+((i-1)*o+a)*t.BYTES_PER_ELEMENT,h=r.byteOffset+(this.outputOffset+n*s)*r.BYTES_PER_ELEMENT,u=h+((i-1)*s+a)*r.BYTES_PER_ELEMENT,f=t.buffer===r.buffer&&t.constructor===r.constructor&&c===h&&o===s;if(j1(t,c,l,r,h,u)&&!f)throw new Error("Projection input/output ranges overlap without an exact in-place mapping")}epochAlias(t,r,n,i,o,s){if(typeof t!="object"||!t||!i)return;let a=t.byteOffset+n*t.BYTES_PER_ELEMENT,c=a+i*t.BYTES_PER_ELEMENT,l=r.byteOffset+(this.outputOffset+n*o)*r.BYTES_PER_ELEMENT,h=l+((i-1)*o+s)*r.BYTES_PER_ELEMENT;if(j1(t,a,c,r,l,h))throw new Error("Epoch and output buffers must not overlap")}acquire(){var t;let r=this.depth++;return(t=this.scratch)[r]||(t[r]=Nv(this.dimension)),this.scratch[r]}transform(t,r,n){if(n!==void 0&&!Number.isFinite(n))throw new Error("Coordinate epoch must be finite");r?this.projection.unprojectToSync(t.input,t.output,n):this.projection.projectToSync(t.input,t.output,n)}floatRange(t,r){for(let n=0;n<this.dimension;n++){let i=t[n];if(n<3&&!Number.isFinite(i)||r&&Number.isFinite(i)&&Math.abs(i)>34028234663852886e22)throw new Error("Projection output is nonfinite or exceeds Float32 range")}}flat(t,r,n,i,o,s){if(!kh(t)||!kh(r))throw new Error("Projection buffers require Float32Array or Float64Array");let a=this.inputStride??this.dimension,c=this.outputStride??this.dimension;if(a<this.dimension||c<this.dimension)throw new Error("Interleaved stride must contain every ordinate");let l=this.range(Kd(t.length,this.inputOffset,a,this.dimension),n,i);if(i+l>Kd(r.length,this.outputOffset,c,this.dimension))throw new Error("Projection output buffer is too short");this.epochStorage(s,i,l),this.aliases(t,r,i,l,a,c,this.dimension),this.epochAlias(s,r,i,l,c,this.dimension);let h=this.acquire();try{let u=typeof s=="number"?void 0:s,f=r instanceof Float32Array;for(let d=i;d<i+l;d++){let m=this.inputOffset+d*a,p=this.outputOffset+d*c;for(let g=0;g<this.dimension;g++)h.input[g]=t[m+g];this.transform(h,o,u?u[d]:s),this.floatRange(h.output,f);for(let g=0;g<this.dimension;g++)r[p+g]=h.output[g]}return r}finally{this.depth--}}columns(t,r,n,i,o,s){if(t.length!==this.dimension||r.length!==this.dimension)throw new Error("Projection columns must match dimension");let a=this.inputStride??1,c=this.outputStride??1,l=Number.MAX_SAFE_INTEGER;for(let f=0;f<this.dimension;f++){if(!kh(t[f])||!kh(r[f]))throw new Error("Projection columns require floating typed arrays");l=Math.min(l,Kd(t[f].length,this.inputOffset,a,1))}let h=this.range(l,n,i);this.epochStorage(s,i,h);for(let f=0;f<this.dimension;f++){if(i+h>Kd(r[f].length,this.outputOffset,c,1))throw new Error("Projection output column is too short");this.epochAlias(s,r[f],i,h,c,1);for(let d=0;d<this.dimension;d++)this.aliases(t[f],r[d],i,h,a,c,1);for(let d=0;d<f&&h;d++){let m=r[f].byteOffset+(this.outputOffset+i*c)*r[f].BYTES_PER_ELEMENT,p=r[d].byteOffset+(this.outputOffset+i*c)*r[d].BYTES_PER_ELEMENT;if(j1(r[f],m,m+((h-1)*c+1)*r[f].BYTES_PER_ELEMENT,r[d],p,p+((h-1)*c+1)*r[d].BYTES_PER_ELEMENT))throw new Error("Projection output columns overlap")}}let u=this.acquire();try{let f=typeof s=="number"?void 0:s;for(let d=i;d<i+h;d++){let m=this.inputOffset+d*a,p=this.outputOffset+d*c;for(let g=0;g<this.dimension;g++)u.input[g]=t[g][m];this.transform(u,o,f?f[d]:s);for(let g=0;g<this.dimension;g++){let y=u.output[g];if(g<3&&!Number.isFinite(y)||r[g]instanceof Float32Array&&Number.isFinite(y)&&Math.abs(y)>34028234663852886e22)throw new Error("Projection output is nonfinite or exceeds Float32 range")}for(let g=0;g<this.dimension;g++)r[g][p]=u.output[g]}return r}finally{this.depth--}}};qt();var WN=240,HN=[9,-18,-88,0,96,90,0,0,-60,-20,-9,18,8,0,-96,30,0,0,60,-20,9,-88,-18,90,96,0,-20,-60,0,0,186,-42,-42,-150,-96,-150,60,60,60,60,54,162,-78,30,-24,-90,-60,60,-60,60,-9,-32,18,30,24,0,20,-60,0,0,-9,8,18,30,-96,0,-20,60,0,0,54,-78,162,-90,-24,30,60,-60,60,-60,-54,78,78,90,144,90,-60,-60,-60,-60,9,-8,-18,-30,-24,0,20,60,0,0,-9,18,-32,0,24,30,0,0,-60,20,9,-18,-8,0,-24,-30,0,0,60,20],$N=372,YN=[0,0,-131,0,138,144,0,0,-102,-31,0,0,7,0,-138,42,0,0,102,-31,62,0,-31,0,0,-62,0,0,0,31,124,0,-62,0,0,-124,0,0,0,62,124,0,-62,0,0,-124,0,0,0,62,62,0,-31,0,0,-62,0,0,0,31,0,0,45,0,-183,-9,0,93,18,0,0,0,216,0,33,87,0,-93,12,-93,0,0,156,0,153,99,0,-93,-12,-93,0,0,-45,0,-3,9,0,93,-18,0,0,0,-55,0,48,42,0,0,-84,31,0,0,-7,0,-48,-42,0,0,84,31],KN=372,XN=[18,-36,-122,0,120,135,0,0,-84,-31,-18,36,-2,0,-120,51,0,0,84,-31,36,-165,-27,93,147,-9,0,-93,18,0,210,45,-111,-93,-57,-192,0,93,12,93,162,141,-75,-93,-129,-180,0,93,-12,93,-36,-21,27,93,39,9,0,-93,-18,0,0,0,62,0,0,31,0,0,0,-31,0,0,124,0,0,62,0,0,0,-62,0,0,124,0,0,62,0,0,0,-62,0,0,62,0,0,31,0,0,0,-31,-18,36,-64,0,66,51,0,0,-102,31,18,-36,2,0,-66,-51,0,0,102,31],ZN=12,W1=20/2,JN=2,qh=class{constructor(t){this._v00=0,this._v01=0,this._v10=0,this._v11=0,this._t=[],this.options=t,this._ix=this.options._width,this._iy=this.options._height,this._hasUint16Data=id(t.data)}getHeight(t,r){if(t=Math.abs(t)>90?NaN:t,Number.isNaN(t)||Number.isNaN(r))return NaN;let n=QN(r,360);r=n!==-180?n:180;let i=r*this.options._rlonres,o=-t*this.options._rlatres,s=Math.floor(i),a=Math.min(Math.round((this.options._height-1)/2-1),Math.floor(o));i-=s,o-=a,a+=(this.options._height-1)/2,s+=s<0?this.options._width:s>=this.options._width?-this.options._width:0;let c=0,l=0,h=0,u=0,f=new Array(W1);if(s===this._ix&&a===this._iy)this.options.cubic?f=this._t:(c=this._v00,l=this._v01,h=this._v10,u=this._v11);else if(!this.options.cubic)c=this._rawval(s,a),l=this._rawval(s+1,a),h=this._rawval(s,a+1),u=this._rawval(s+1,a+1);else{let m=[this._rawval(s,a-1),this._rawval(s+1,a-1),this._rawval(s-1,a),this._rawval(s,a),this._rawval(s+1,a),this._rawval(s+2,a),this._rawval(s-1,a+1),this._rawval(s,a+1),this._rawval(s+1,a+1),this._rawval(s+2,a+1),this._rawval(s,a+2),this._rawval(s+1,a+2)],p=YN;a!==0&&(p=a===this.options._height-2?XN:HN);let g=$N;a!==0&&(g=a===this.options._height-2?KN:WN);for(let y=0;y<W1;++y){f[y]=0;for(let _=0;_<ZN;++_)f[y]+=m[_]*p[W1*_+y];f[y]/=g}}if(!this.options.cubic){let m=(1-i)*c+i*l,p=(1-i)*h+i*u,g=(1-o)*m+o*p,y=this.options._offset+this.options._scale*g;return this._ix=s,this._iy=a,this._v00=c,this._v01=l,this._v10=h,this._v11=u,y}let d=f[0]+i*(f[1]+i*(f[3]+i*f[6]))+o*(f[2]+i*(f[4]+i*f[7])+o*(f[5]+i*f[8]+o*f[9]));return d=this.options._offset+this.options._scale*d,this._ix=s,this._iy=a,this._t=f,d}_rawval(t,r){t<0?t+=this.options._width:t>=this.options._width&&(t-=this.options._width),(r<0||r>=this.options._height)&&(r=r<0?-r:2*(this.options._height-1)-r,t+=(t<this.options._width/2?1:-1)*this.options._width/2);let n=r*this.options._swidth+t;if(this._hasUint16Data)return this.options.data[this.options._datastart+n];let i=this.options._datastart+JN*n,o=this.options.data[i],s=this.options.data[i+1];return o<<8|s}};function QN(e,t){t=Math.abs(t);let r=Bv(e,t);return 2*Math.abs(r)===t?r-=Bv(e,2*t)-r:2*Math.abs(r)>t&&(r+=r<0?t:-t),r}function Bv(e,t){return e-Math.floor(e/t)*t}var tO=10,eO=65535;function Zd(e,t){let r=rO(e),n=r.next();if(n.done||n.value.line!=="P5")throw new Error("Geoid model file: File not in PGM format");let i=Number.MAX_VALUE,o=0,s=-1,a=-1,c="NONE",l="UNKNOWN",h=0,u=0,f=null,d=null;do{n=r.next();let y=n.value.line;if(y.length)if(y[0]==="#"){let _=y.split(" "),M=_[0],b=_[1];if(M!=="#"||!b)continue;let v=_.length>2?_.slice(2):[];if(b==="Description")c=v.join(" ");else if(b==="DateTime")l=v.join(" ");else if(b==="Offset"){if(!_[2])throw new Error("Geoid model file: Error reading offset");i=parseInt(_[2],10)}else if(b==="Scale"){if(!_[2])throw new Error("Geoid model file: Error reading scale");o=parseFloat(_[2])}else b===(t.cubic?"MaxCubicError":"MaxBilinearError")?isFinite(parseFloat(_[2]))&&(s=parseFloat(_[2])):b===(t.cubic?"RMSCubicError":"RMSBilinearError")&&isFinite(parseFloat(_[2]))&&(a=parseFloat(_[2]))}else{let _=y.split(" ");if(_=_.filter(M=>M!==""),h=parseInt(_[0],10),u=parseInt(_[1],10),!(h&&u))throw new Error("Geoid model file: Error reading raster size");break}}while(!n.done);n=r.next();let m=parseInt(n.value.line,10);if(n.done)throw new Error("Geoid model file: Error reading maxval");if(m!==eO)throw new Error("Geoid model file: Incorrect value of maxval");if(f=n.value.offset,d=h,i===Number.MAX_VALUE)throw new Error("Geoid model file: Offset not set");if(o===0)throw new Error("Geoid model file: Scale not set");if(o<0)throw new Error("Geoid model file: Scale must be positive");if(u<2||h<2)throw new Error("Geoid model file: Raster size too small");if(h&1)throw new Error("Geoid model file: Raster width is odd");if(!(u&1))throw new Error("Geoid model file: Raster height is even");let p=h/360,g=(u-1)/180;return new qh({cubic:t.cubic,_width:h,_height:u,_rlonres:p,_rlatres:g,_offset:i,_scale:o,_swidth:d,_datastart:f,_maxerror:s,_rmserror:a,_description:c,_datetime:l,data:e})}function*rO(e){let t=0;do{let r=e.indexOf(tO,t);if(r!==-1){let n=e.subarray(t,r);t=r+1,yield{offset:t,line:Lv(n)}}else{let n=e.subarray(t,e.length);t=e.length,yield{offset:t,line:Lv(n)}}}while(t<e.length);return{offset:t,line:""}}function Lv(e){let t="";for(let r of e)t+=String.fromCharCode(r);return t}ya();function Dv(){return{bounds:[[-1,-1,0],[1,1,0]]}}var H1=Symbol.for("@math.gl/projection/projection-implementations");function $1(){let e=globalThis;return e[H1]||(e[H1]=new WeakMap),e[H1]}function Fv(e){return"create"in e?e:$1().get(e)?.implementation}function Uv(e){if("create"in e)return Promise.resolve(e);let t=$1().get(e);if(t||(t={load:()=>e.preload()},$1().set(e,t)),t.implementation)return Promise.resolve(t.implementation);let r=t;return r.pending||(r.pending=Promise.resolve().then(r.load).then(n=>{let i=s=>s.toLowerCase().replace(/[\s_-]/g,""),o=new Set([n.name,...n.aliases||[]].map(i));if(typeof n.create!="function"||![e.name,...e.aliases||[]].every(s=>o.has(i(s))))throw new Error("Loaded projection does not match descriptor: "+e.name);return r.implementation=n,n}).catch(n=>{throw r.pending=void 0,n})),r.pending}wa();bd();var Jd=34028234663852886e22;function Ta(e,t,r){if(!(Array.isArray(e)||e instanceof Float32Array||e instanceof Float64Array))throw new Error("Scalar input requires a number array, Float32Array or Float64Array");if(!(Array.isArray(t)||t instanceof Float32Array||t instanceof Float64Array)||t.length<r)throw new Error("Scalar output requires a preallocated number array, Float32Array or Float64Array with sufficient capacity");if(e===t||Array.isArray(e)||Array.isArray(t))return;let n=e,i=t,o=typeof SharedArrayBuffer<"u"&&n.buffer instanceof SharedArrayBuffer&&i.buffer instanceof SharedArrayBuffer;if((n.buffer===i.buffer||o)&&n.byteOffset<i.byteOffset+r*i.BYTES_PER_ELEMENT&&i.byteOffset<n.byteOffset+n.byteLength)throw new Error("Scalar input/output views overlap; use the same view for in-place projection")}function jh(e,t,r,n){if(t instanceof Float32Array){if(Math.abs(r.x)>Jd||Math.abs(r.y)>Jd||n>=3&&Math.abs(r.z)>Jd)throw new Error("Projected coordinate exceeds Float32 range");for(let i=3;i<e.length;i++){let o=e[i];if(Number.isFinite(o)&&Math.abs(o)>Jd)throw new Error("Trailing ordinate exceeds Float32 range")}}for(let i=3;i<e.length;i++)t[i]=e[i];return t[0]=r.x,t[1]=r.y,n>=3&&(t[2]=r.z),t}Pc();cg();var Gv,zv=Symbol.for("@math.gl/projection/TypeScriptCRSError"),xn=class e extends Error{static[(Gv=zv,Symbol.hasInstance)](t){return this!==e?Function.prototype[Symbol.hasInstance].call(this,t):t instanceof Error&&t[zv]===!0}constructor(t,r){super(r),this.reason=t,this[Gv]=!0,this.name="TypeScriptCRSError"}};function Bt(e){throw new xn("missing-transform-stage",e)}function Wh(e,t){if(typeof e=="string"||"type"in e)return{definition:e,lossy:!1};let r=e,n="crs"in r?r:void 0,i="crs"in r?r.crs:r;if(i.state!=="explicit"&&i.state!=="default")throw new xn("unknown-syntax","Cannot transform an "+i.state+" CRS reference");let o=!1;return n?.coordinateEpoch!==void 0&&Bt("Coordinate epochs require a time-dependent transformation"),n?.vertical&&n.vertical.state!=="absent"&&(t.mode!=="horizontal"&&Bt("A separately declared vertical CRS requires explicit horizontal extraction"),o=!0),{definition:i.definition,spatialReference:n,lossy:o}}function Vv(e,t){if(!t)return e;if(t.coordinateFrame!=="unknown"&&t.coordinateFrame!==e.kind)throw new Error("SpatialReference coordinate frame disagrees with its CRS");let r=t.coordinateOrder,n=e.kind==="geocentric"?{x:"e",y:"n",z:"u"}:{longitude:"e",lon:"e",latitude:"n",lat:"n",easting:"e",northing:"n",height:"u",altitude:"u",x:"e",y:"n",z:"u"},i;if(r.length&&(i=r.slice(0,3).map(o=>n[o.toLowerCase()]||"?").join(""),i.length===2&&(i+="u"),(i.length!==3||!i.includes("e")||!i.includes("n")||!i.includes("u"))&&Bt("Unsupported SpatialReference coordinate order"),(r.length>4||r.length>3&&!["m","measure"].includes(r[3]))&&Bt("Unsupported fourth coordinate component")),t.units?.length){let o={m:1,meter:1,metre:1,meters:1,metres:1,km:1e3,ft:.3048,"us-ft":.3048006096012192,degree:Math.PI/180,degrees:Math.PI/180,radian:1,radians:1,grad:Math.PI/200};for(let s=0;s<Math.min(t.units.length,3);s++){let a=(i||"enu")[s]==="u",c=e.kind==="geocentric"?e.toMeter:a?e.verticalUnit:e.kind==="geographic"?e.angularUnit:e.toMeter;(Math.abs((o[t.units[s]]??NaN)-c)>1e-12||o[t.units[s]]===void 0)&&Bt("SpatialReference units disagree with its CRS")}}return Object.freeze({...e,storedAxis:i})}Ee();var kv={towgs84:"0,0,0",ellipse:"WGS84"},qv={towgs84:"0,0,0",ellipse:"GRS80"},Y1={wgs84:kv,WGS84:kv,nad83:qv,North_American_Datum_1983:qv},jv=new WeakMap,Ia=e=>e.toLowerCase().replace(/[\s_-]/g,"");function Jc(e){if(!e.datumCatalogs?.length)return Y1;let t=jv.get(e);if(t?.catalogs===e.datumCatalogs)return t.definitions;let r=Object.assign(Object.create(null),Y1),n=new Map(Object.entries(Y1).map(([i,o])=>[Ia(i),{definition:o,owner:-1}]));return e.datumCatalogs.forEach((i,o)=>{if(!i.name||!i.datums)throw new Error("Invalid datum catalogue plugin");for(let[s,a]of Object.entries(i.datums)){let c=Ia(s);if(!c||c==="none"||!a||["ellipse","towgs84","nadgrids"].some(h=>a[h]!==void 0&&typeof a[h]!="string"))throw new Error("Invalid datum definition: "+s);let l=n.get(c);if(l&&(l.owner!==o||l.definition.ellipse!==a.ellipse||l.definition.towgs84!==a.towgs84||l.definition.nadgrids!==a.nadgrids))throw new Error("Conflicting datum registration: "+s);n.set(c,{definition:a,owner:o}),r[s]=a}}),jv.set(e,{catalogs:e.datumCatalogs,definitions:r}),r}var iO={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"},APL4:{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"},andrae:{a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"},clrk80:{a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk80ign:{a:63782492e-1,b:6356515,rf:293.4660213,ellipseName:"Clarke 1880 (IGN)"},clrk58:{a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"},plessis:{a:6376523,b:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:63558348467e-4,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS72:{a:6378135,rf:298.26,ellipseName:"WGS 72"},WGS84:{a:6378137,rf:298.257223563,ellipseName:"WGS 84"},sphere:{a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"}},Wv=iO;var on={};on.greenwich=0;on.lisbon=-9.131906111111;on.paris=2.337229166667;on.bogota=-74.080916666667;on.madrid=-3.687938888889;on.rome=12.452333333333;on.bern=7.439583333333;on.jakarta=106.807719444444;on.ferro=-17.666666666667;on.brussels=4.367975;on.stockholm=18.058277777778;on.athens=23.7163375;on.oslo=10.722916666667;var Hv=on;lg();var $v={WGS84:"+proj=longlat +datum=WGS84","EPSG:4326":"+proj=longlat +datum=WGS84","EPSG:4269":"+proj=longlat +datum=NAD83","EPSG:4978":"+proj=geocent +datum=WGS84","EPSG:4979":"+proj=longlat +datum=WGS84","EPSG:3857":"+proj=merc +a=6378137 +b=6378137 +nadgrids=@null +units=m","EPSG:3785":"EPSG:3857",GOOGLE:"EPSG:3857","EPSG:900913":"EPSG:3857","EPSG:102113":"EPSG:3857"},Qd=["proj","datum","ellps","a","b","rf","f","R","units","to_meter","vunits","vto_meter","no_defs","type","title","towgs84","nadgrids","geoidgrids","axis","pm","over","lon_wrap"],Jv=["no_defs","over"],Di=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Yv=e=>e.toLowerCase().replace(/[\s_-]/g,"");function K1(e,t){let r=Object.keys(e).find(n=>Yv(n)===Yv(t));return r===void 0?void 0:e[r]}function Kv(e){if(/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i.test(e)){let r=Number(e);if(Number.isFinite(r))return r}if(/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?r$/i.test(e)){let r=Number(e.slice(0,-1))/Me;if(Number.isFinite(r))return r}let t=/^([+-]?)(\d+(?:\.\d*)?)(?:d(?:(\d+(?:\.\d*)?)'(?:(\d+(?:\.\d*)?)")?)?)?([NSEW])?$/i.exec(e);if(t&&(/d/i.test(e)||t[5])){let r=Number(t[3]||0),n=Number(t[4]||0);if(r<60&&n<60){let i=t[1]==="-"?-1:1,o=/[SW]/i.test(t[5]||"")?-1:1,s=i*o*(Number(t[2])+r/60+n/3600);if(Number.isFinite(s))return s}}throw new Error("Invalid angular parameter: "+e)}function X1(e,t={}){let r=e,n=t.aliases||{},i=new Set;for(;typeof r=="string"&&(Di(n,r)||Di($v,r));){if(i.has(r))throw new Error("Circular CRS alias: "+r);i.add(r),r=Di(n,r)?n[r]:$v[r]}if(typeof r=="string"){let o=/^EPSG:(326|327)(\d{2})$/.exec(r);o&&Number(o[2])>=1&&Number(o[2])<=60&&(r="+proj=utm +datum=WGS84 +zone="+Number(o[2])+(o[1]==="327"?" +south":"")),(r==="EPSG:5041"||r==="EPSG:5042")&&(r="+proj=stere +datum=WGS84 +lat_0="+(r==="EPSG:5041"?90:-90)+" +k_0=0.994 +x_0=2000000 +y_0=2000000")}return r}function ho(e,t={}){let r=Jc(t),n=Wh(e,t),i=X1(n.definition,t),o;if(tr(i)==="proj-string"&&typeof i=="string"){let N=Object.create(null);for(let B of yh(i).parameters){if(Di(N,B.name))throw new Error("Duplicate PROJ parameter: +"+B.name);N[B.name]=B.value}o={parameters:N}}else{let N=t.parsers?.find(B=>B.canParse(i));if(!N){let B=["wkt","projjson"].includes(tr(i));throw new xn(B?"missing-parser":"unknown-syntax",tr(i)==="identifier"?"Unsupported CRS definition: "+i+"; resolve it first":"Unsupported CRS definition; register a WKT or PROJJSON parser for structured definitions")}o=N.parse(i,t)}let s={...o.parameters};for(let N of["lon_0","lat_0","lat_1","lat_2","lat_ts","lon_wrap","lon_1","lon_2","lonc","alpha","gamma","tilt","azi","o_alpha","o_lon_c","o_lat_c","o_lon_p","o_lat_p","o_lon_1","o_lat_1","o_lon_2","o_lat_2"])s[N]!==void 0&&(s[N]=String(Kv(s[N])));let a=s.proj,c=a?.toLowerCase(),l=c==="geocentric"?"geocent":["longlat","latlong","latlon","lonlat","identity","geocent"].includes(c)?c:a;if(!l)throw new Error("CRS requires +proj");let h=["longlat","latlong","latlon","lonlat"].includes(l)?"geographic":l==="geocent"?"geocentric":l==="identity"?"identity":"projected",u=s.datum,f=u&&u!=="none"?K1(r,u):void 0;u&&u!=="none"&&!f&&Bt("Unknown datum: "+u+"; register a datumCatalogs plugin");let d=Zv(s,f?.ellipse),m=s.nadgrids??f?.nadgrids,p=m===void 0?void 0:m.split(",").map(N=>{let B=N.startsWith("@"),C=B?N.slice(1):N;if(!C||/\s/.test(C))throw new Error("Invalid datum grid name");return Object.freeze({name:C,optional:B})}),g=s.towgs84??f?.towgs84,y;if(g!==void 0&&(y=g.split(",").map(N=>tt({value:N},"value",NaN)),![3,7].includes(y.length)||y.some(N=>!Number.isFinite(N))||y.length===7&&y[6]<=-1e6))throw new Error("+towgs84 requires three or seven finite values and positive scale");u==="none"&&(y=void 0),p&&u!=="none"&&(y=[0,0,0]);let _=m==="@null"||m==="null"?Zv({ellps:"WGS84"}):d,M=s.axis||"enu";if(M.length!==3||!/[ew]/.test(M)||!/[ns]/.test(M)||!/[ud]/.test(M))throw new Error("Invalid axis: "+M);let b=o.angularUnit??Me;if(h==="geographic"&&(s.units&&s.units!=="degrees"||Di(s,"to_meter")))throw new Error("Geographic coordinates must use angular units");if(h!=="geographic"&&s.units==="degrees")throw new Error("Linear coordinates require linear units");let v=Xv(s,"units","to_meter"),T=o.verticalUnit??Xv(s,"vunits","vto_meter");if(!(T>0)||!Number.isFinite(T))throw new Error("Invalid vertical unit");if(!(b>0)||!Number.isFinite(b))throw new Error("Invalid angular unit");let S=s.pm,E=S===void 0?0:(K1(Hv,S)??Kv(S))*Me;return Vv(Object.freeze({kind:h,projection:l,parameters:Object.freeze(s),ellipsoid:d,datum:Object.freeze({ellipsoid:_,towgs84:y&&Object.freeze(y),grids:u==="none"||m==="@null"||m==="null"?void 0:p&&Object.freeze(p)}),areaOfUse:o.areaOfUse,angularUnit:b,toMeter:v,verticalUnit:T,primeMeridian:E,axis:M,longitudeWrap:s.lon_wrap===void 0?void 0:Number(s.lon_wrap)*Me,lossy:!!(o.lossy||n.lossy)}),n.spatialReference)}function Xv(e,t,r){let n=e[t],i=wh;if(t==="vunits"&&n==="degrees")throw new Error("Height requires linear units");if(n&&!["m","degrees"].includes(n)&&!Di(i,n))throw new Error("Unsupported units: "+n);let o=tt(e,r,n&&i[n]?i[n].metersPerUnit:1);if(!(o>0))throw new Error("+"+r+" must be positive");return o}function Zv(e,t){let r=t||e.ellps||"WGS84",n=K1(Wv,r);if(!n)throw new Error("Unsupported ellipsoid: "+r);let i=tt(e,"a",n.a),o=tt(e,"f",NaN),s=tt(e,"rf",Number.isNaN(o)?n.rf||0:o===0?0:1/o),a=tt(e,"b",s?i*(1-1/s):Di(e,"f")||Di(e,"rf")||Di(e,"a")?i:n.b||i),c=tt(e,"R",0);if(i<=0||a<=0||a>i||s<0||s>0&&s<=1||Di(e,"R")&&c<=0||!Number.isNaN(o)&&(o<0||o>=1))throw new Error("Invalid ellipsoid dimensions");return Object.freeze({semiMajorAxis:c||i,semiMinorAxis:c||a,eccentricitySquared:c?0:1-(a/i)**2})}qt();var Z1=Math.PI/(180*3600),tm={ellipsoid:{semiMajorAxis:6378137,semiMinorAxis:6356752314245179e-9,eccentricitySquared:.0066943799901413165},towgs84:[0,0,0]};function rm(e,t){if(Math.abs(e.y)>Math.PI/2)throw new Error("Latitude outside geocentric domain");if(!vh(e,t))throw new Error("Geocentric coordinate must be finite")}function nm(e,t){let r=e.x,n=e.y,i=e.z,{semiMajorAxis:o,semiMinorAxis:s,eccentricitySquared:a}=t;if(r===0&&n===0&&i===0)throw new Error("Geodetic coordinates are undefined at the Earth center");if(a!==0&&Math.abs(r)<1e-12*o&&Math.abs(n)<1e-12*o&&Math.hypot(r,n)<1e-12*o){if(!Number.isFinite(Math.hypot(r,n,i)))throw new Error("Geocentric radius must be finite");e.x=0,e.y=Math.sign(i)*Math.PI/2,e.z=Math.abs(i)-s;return}if(!Eh(e,t))throw Number.isFinite(Math.hypot(r,n,i))?new Error("Geocentric inverse did not converge"):new Error("Geocentric radius must be finite")}function Qv(e,t){let r=e[0],n=e[1],i=e[2],o=(e[3]||0)*Z1,s=(e[4]||0)*Z1,a=(e[5]||0)*Z1,c=1+(e[6]||0)/1e6;return t?l=>{let h=(l.x-r)/c,u=(l.y-n)/c,f=(l.z-i)/c;l.x=h+a*u-s*f,l.y=-a*h+u+o*f,l.z=s*h-o*u+f}:l=>{let h=l.x,u=l.y,f=l.z;l.x=c*(h-a*u+s*f)+r,l.y=c*(a*h+u-o*f)+n,l.z=c*(-s*h+o*u+f)+i}}function em(e){return!!e.towgs84?.some(t=>t!==0)}function Q1(e,t){if(!(!e.towgs84||!t.towgs84)){if(e.grids||t.grids){if(e.grids&&t.grids&&e.ellipsoid.semiMajorAxis===t.ellipsoid.semiMajorAxis&&e.ellipsoid.eccentricitySquared===t.ellipsoid.eccentricitySquared&&e.grids.length===t.grids.length&&e.grids.every((n,i)=>n.name===t.grids[i].name&&n.optional===t.grids[i].optional&&n.grid===t.grids[i].grid))return;let r=Q1(e.grids?tm:e,t.grids?tm:t);return n=>{e.grids&&tE(n,e,!1),r?.(n),t.grids&&tE(n,t,!0)}}if(em(e)||em(t)){let r=J1(e,tm),n=J1(tm,t);return i=>{r?.(i),n?.(i)}}return J1(e,t)}}function J1(e,t){if(!e.towgs84||!t.towgs84)return;let r=e.ellipsoid,n=t.ellipsoid,i=!0;for(let a=0;a<7;a++)(e.towgs84[a]||0)!==(t.towgs84[a]||0)&&(i=!1);if(r.semiMajorAxis===n.semiMajorAxis&&Math.abs(r.eccentricitySquared-n.eccentricitySquared)<=5e-11&&i)return;let o=em(e)?Qv(e.towgs84,!1):void 0,s=em(t)?Qv(t.towgs84,!0):void 0;return a=>{rm(a,r),o?.(a),s?.(a),nm(a,n)}}function tE(e,t,r){for(let n of t.grids){if(n.name==="null")return;if(!n.grid){if(n.optional)continue;throw new Error("Required datum grid is not registered: "+n.name)}let i=!1;if(n.grid.shiftInPlace)i=n.grid.shiftInPlace(e,r);else{let o=n.grid.shift(e.x,e.y,r);o&&(e.x=o[0],e.y=o[1],i=!0)}if(i){if(!Number.isFinite(e.x)||!Number.isFinite(e.y)||Math.abs(e.y)>Math.PI/2)throw new Error("Datum grid produced a coordinate outside the geographic domain");return}}throw new Error("No datum grid covers coordinate: "+t.grids.map(n=>n.name).join(","))}function eE(e,t){let r={x:e[0],y:e[1],z:e[2]};return rm(r,t),[r.x,r.y,r.z]}function rE(e,t){let r={x:e[0],y:e[1],z:e[2]};return nm(r,t),[r.x,r.y,r.z]}Ee();Ee();ne();Ie();function os(e,t=0){let r=tt(e,"lon_wrap",0)*Me;return n=>Ke(i=>{let o=gr(i,r);return[[r+o[0],i[0][1],0],[r+o[1],i[1][1],0]]},n??[-180,-90,180,90],r,t)}function nE(e,t={}){if(e===void 0)return;let r=[];for(let n of e.split(",")){let i=n.startsWith("@"),o=i?n.slice(1):n;if(!o||/\s/.test(o))throw new Error("Invalid vertical grid name");if(o==="null"){r.push(null);break}let s=Object.prototype.hasOwnProperty.call(t,o)?t[o]:void 0;if(s){if(typeof s.getOffset!="function")throw new Error("Invalid vertical grid: "+o);r.push(s.getOffset.bind(s))}else i||Bt("Required vertical grid is not registered: "+o)}return(n,i)=>{for(let o of r){if(!o)return 0;let s=o(n,i);if(s!==void 0){if(!Number.isFinite(s))throw new Error("Vertical grid returned a non-finite offset");return s}}throw new Error("No vertical grid covers this coordinate")}}function ty(e){let t=Object.freeze({...e.ellipsoid});return Object.freeze({kind:e.kind,projection:e.projection,parameters:Object.freeze(Object.fromEntries(Object.entries(e.parameters).map(([r,n])=>[r,n??null]))),ellipsoid:t,datum:Object.freeze({ellipsoid:Object.freeze({...e.datum.ellipsoid}),towgs84:e.datum.towgs84&&Object.freeze([...e.datum.towgs84]),grids:e.datum.grids&&Object.freeze(e.datum.grids.map(r=>Object.freeze({name:r.name,optional:r.optional,loaded:!!r.grid})))}),angularUnit:e.angularUnit,toMeter:e.toMeter,verticalUnit:e.verticalUnit,primeMeridian:e.primeMeridian,axis:e.axis,storedAxis:e.storedAxis,longitudeWrap:e.longitudeWrap,areaOfUse:e.areaOfUse&&Object.freeze([...e.areaOfUse]),lossy:e.lossy,algorithm:e.algorithm&&Object.freeze({...e.algorithm})})}function iE(e,t,r,n){let i=[];return e.algorithm||i.push("source-algorithm"),t.algorithm||i.push("target-algorithm"),(e.datum.grids||t.datum.grids||e.parameters.geoidgrids||t.parameters.geoidgrids)&&i.push("grid-resource"),Object.freeze({version:1,source:e,target:t,forward:r,inverse:n,lossy:e.lossy||t.lossy,complete:i.length===0,opaqueReasons:Object.freeze(i)})}var Hh=class e{static async create(t={}){let r=await Promise.all(oE(t).map(Uv));return new e({...t,projections:r})}get targetProfile(){return this.getTargetRenderingProfile(this.targetCoverage)}getTargetRenderingProfile(t){return this.targetRenderingProfile&&rS(this.targetRenderingProfile,t)}get description(){return this.deferred?.implementation?.description??this.resolvedDescription}constructor(t={}){this.coordinateScratch=new Ko,this.targetLongitudeOrigin=0;let r=t.projections||[],n=lE(r);if(r.some(i=>!("create"in i))){let i=ho(t.from??"WGS84",t),o=ho(t.to??"WGS84",t);this.lossy=i.lossy||o.lossy,this.deferred={options:{...t,projections:[...r]}}}else{let i=t,o=n,s=sE(i.from??"WGS84",o,i),a=sE(i.to??"WGS84",o,i);this.targetRenderingProfile=a.implementation?.getRenderingProfile?.bind(a.implementation)??(a.kind==="geographic"?os(a.parameters,a.primeMeridian):a.kind==="identity"?Dv:void 0),this.targetCoverage=a.areaOfUse,this.targetLongitudeOrigin=a.implementation?.longitudeOrigin??(a.kind==="geographic"?a.longitudeWrap??0:0),this.lossy=s.lossy||a.lossy,this.lossy&&(s.kind==="geocentric"||a.kind==="geocentric")&&Bt("Horizontal extraction cannot supply ellipsoidal height for geocentric coordinates"),this.lossy&&(s.verticalGrid||a.verticalGrid)&&Bt("Horizontal extraction cannot be combined with vertical grids"),this.forwardTransform=cE(s,a,!!t.enforceAxis),this.inverseTransform=cE(a,s,!!t.enforceAxis),this.resolvedDescription=iE(ty(s),ty(a),this.forwardTransform.description,this.inverseTransform.description)}this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.projectTo=this.projectTo.bind(this),this.unprojectTo=this.unprojectTo.bind(this),this.projectToSync=this.projectToSync.bind(this),this.unprojectToSync=this.unprojectToSync.bind(this),this.projectFlat=this.projectFlat.bind(this),this.unprojectFlat=this.unprojectFlat.bind(this),this.projectSync=this.projectSync.bind(this),this.unprojectSync=this.unprojectSync.bind(this),this.projectFlatSync=this.projectFlatSync.bind(this),this.unprojectFlatSync=this.unprojectFlatSync.bind(this)}load(){let t=this.deferred;return t?t.implementation?Promise.resolve(t.implementation):(t.pending||(t.pending=e.create(t.options).then(r=>(t.implementation=r,r)).catch(r=>{throw t.pending=void 0,r})),t.pending):Promise.resolve(this)}loadSync(){let t=this.deferred;if(!t)return this;if(!t.implementation){let r=oE(t.options).map(n=>{let i=Fv(n);if(!i)throw new Error("Projection is not preloaded: "+n.name+". Call preload() first.");return i});t.implementation=new e({...t.options,projections:r})}return t.implementation}projectSync(t){return this.deferred?this.loadSync().project(t):Qc(t,this.forwardTransform,this.coordinateScratch)}unprojectSync(t){return this.deferred?this.loadSync().unproject(t):Qc(t,this.inverseTransform,this.coordinateScratch)}projectFlatSync(t,r=2){return this.deferred?this.loadSync().projectFlat(t,r):im(t,r,this.forwardTransform,this.coordinateScratch)}unprojectFlatSync(t,r=2){return this.deferred?this.loadSync().unprojectFlat(t,r):im(t,r,this.inverseTransform,this.coordinateScratch)}async preload(){await this.load()}project(t){return this.deferred?this.projectLoaded(t,!1):Qc(t,this.forwardTransform,this.coordinateScratch)}unproject(t){return this.deferred?this.projectLoaded(t,!0):Qc(t,this.inverseTransform,this.coordinateScratch)}projectTo(t,r){return this.deferred?this.projectToLoaded(t,r,!1):this.projectToSync(t,r)}unprojectTo(t,r){return this.deferred?this.projectToLoaded(t,r,!0):this.unprojectToSync(t,r)}projectToSync(t,r){return this.deferred?this.loadSync().projectTo(t,r):(Ta(t,r,Math.max(t.length,this.forwardTransform.geocentricOutput?3:2)),Qc(t,this.forwardTransform,this.coordinateScratch,r))}unprojectToSync(t,r){return this.deferred?this.loadSync().unprojectTo(t,r):(Ta(t,r,Math.max(t.length,this.inverseTransform.geocentricOutput?3:2)),Qc(t,this.inverseTransform,this.coordinateScratch,r))}projectToLoaded(t,r,n){Ta(t,r,t.length);let i=t.slice();return this.load().then(o=>n?o.unprojectTo(i,r):o.projectTo(i,r))}projectLoaded(t,r){let n=t.slice();return this.load().then(i=>r?i.unproject(n):i.project(n))}projectFlat(t,r=2){return this.deferred?this.load().then(i=>i.projectFlat(t,r)):im(t,r,this.forwardTransform,this.coordinateScratch)}unprojectFlat(t,r=2){return this.deferred?this.load().then(i=>i.unprojectFlat(t,r)):im(t,r,this.inverseTransform,this.coordinateScratch)}};function oE(e){let t=lE(e.projections||[]),r=new Set;for(let n of[e.from??"WGS84",e.to??"WGS84"]){let i=ho(n,e);if(["geographic","identity"].includes(i.kind))continue;let o=t.get(om(i.projection));if(!o)throw new xn("missing-plugin","Projection plugin is not registered: "+i.projection);r.add(o)}return[...r]}var om=e=>e.toLowerCase().replace(/[\s_-]/g,"");function lE(e){let t=new Map;for(let r of e)for(let n of new Set([r.name,...r.aliases||[]].map(om))){if(!n||["longlat","latlong","latlon","lonlat","identity"].includes(n)||t.has(n))throw new Error("Duplicate or reserved projection plugin: "+n);t.set(n,r)}return t}function sE(e,t,r){let n=ho(e,r),i=t.get(om(n.projection));if(!["geographic","identity"].includes(n.kind)&&!i)throw new xn("missing-plugin","Projection plugin is not registered: "+n.projection);let o=new Set([...Qd,...i?.parameters||[]]);for(let m of Object.keys(n.parameters)){if(!o.has(m))throw new xn("missing-transform-stage","Unsupported PROJ parameter: +"+m);let p=Jv.includes(m)||i?.flags?.includes(m);if(p&&n.parameters[m]!==void 0)throw new Error("Expected a flag without a value: +"+m);if(!p&&!n.parameters[m])throw new Error("PROJ parameter requires a value: +"+m)}if(n.parameters.type&&n.parameters.type!=="crs")throw new Error("Only +type=crs is supported");let s=om(n.projection)==="fasttransversemercator"?Object.freeze({...n.parameters,approx:void 0}):n.parameters,a=i?.create({...n.ellipsoid,parameters:s,primeMeridian:n.primeMeridian});if(n.kind==="geocentric"&&(!a?.forward3D||!a?.inverse3D))throw new Error("Geocentric plugin must implement 3D operations");let c=n.datum.grids,l=c?.findIndex(m=>m.name==="null")??-1,h=c?.slice(0,l<0?void 0:l+1).map(m=>{let p=Object.prototype.hasOwnProperty.call(r.datumGrids||{},m.name)?r.datumGrids[m.name]:void 0;if(p&&typeof p.shift!="function")throw new Error("Invalid prepared datum grid: "+m.name);return Object.freeze({...m,grid:p})});for(let m of h||[]){if(m.name==="null")break;!m.optional&&!m.grid&&Bt("Required datum grid is not registered: "+m.name)}let u=h?Object.freeze({...n.datum,grids:Object.freeze(h)}):n.datum,f=nE(n.parameters.geoidgrids,r.verticalGrids);f&&(n.kind==="geocentric"||n.kind==="identity"||n.lossy)&&Bt("Vertical grids require a non-lossy geographic or projected CRS");let d=i?i.semantics:{id:"@math.gl/geospatial/"+n.kind,version:1};return{...n,datum:u,implementation:a,verticalGrid:f,algorithm:d}}function ey(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.z)}function aE(e,t){if(e==="enu")return;let r=[0,0,0],n=[0,0,0];for(let i=0;i<3;i++){let o=e[i],s="ew".includes(o)?0:"ns".includes(o)?1:2;r[t?i:s]=t?s:i,n[t?i:s]="wsd".includes(o)?-1:1}return i=>{let o=i.x,s=i.y,a=i.z;i.x=n[0]*(r[0]===0?o:r[0]===1?s:a),i.y=n[1]*(r[1]===0?o:r[1]===1?s:a),i.z=n[2]*(r[2]===0?o:r[2]===1?s:a)}}function cE(e,t,r){let n=e.storedAxis||(r?e.axis:"enu"),i=t.storedAxis||(r?t.axis:"enu"),o=aE(n,!1),s=aE(i,!0),a=e.implementation&&co(e.implementation,!0,e.kind==="geocentric"),c=t.implementation&&co(t.implementation,!1,t.kind==="geocentric"),l=Q1(e.datum,t.datum),h=e.lossy||t.lossy,u=e.kind==="geocentric",f=e.kind==="geographic"?e.angularUnit:e.toMeter,d=t.kind==="geographic"?t.angularUnit:t.toMeter,m=u?1:e.verticalUnit,p=t.kind==="geocentric"?d:t.verticalUnit,g=e.primeMeridian,y=t.primeMeridian,_=t.kind==="geographic"?t.longitudeWrap:void 0,M;if(!l&&!e.verticalGrid&&!t.verticalGrid&&!h&&!o&&!s&&!g&&!y&&e.verticalUnit===1&&t.verticalUnit===1&&_===void 0){let T=Object.freeze({inputScale:f,outputScale:d});e.kind==="geographic"&&t.kind==="projected"&&(M=t.implementation?.createForwardFlat?.(T)),e.kind==="projected"&&t.kind==="geographic"&&(M=e.implementation?.createInverseFlat?.(T))}let b=!!(e.verticalGrid||t.verticalGrid)||e.kind==="geocentric"||/[ud]/.test(n.slice(0,2))||/[ud]/.test(i.slice(0,2)),v=[];return o&&v.push("input-axis"),h&&v.push("discard-height"),f!==1&&v.push("input-scale"),a&&v.push("source-inverse"),m!==1&&v.push("input-height-scale"),v.push("geographic-domain-check"),g&&v.push("source-prime-meridian"),e.verticalGrid&&v.push("source-vertical-grid"),l&&v.push("datum"),t.verticalGrid&&v.push("target-vertical-grid"),y&&v.push("target-prime-meridian"),_!==void 0&&v.push("longitude-wrap"),c&&v.push("target-forward"),d!==1&&v.push("output-scale"),p!==1&&v.push("output-height-scale"),h&&v.push("restore-height"),s&&v.push("output-axis"),{description:Object.freeze({inputAxis:n,outputAxis:i,requiresInputZ:b,geocentricOutput:t.kind==="geocentric",stages:Object.freeze(v)}),flat:M,requiresInputZ:b,geocentricOutput:t.kind==="geocentric",run(T){if(!ey(T))throw new Error("Coordinates must contain finite x, y and optional z values");o?.(T);let S=T.z;if(h&&(T.z=0),f!==1&&(T.x*=f,T.y*=f,u&&(T.z*=f)),a?.(T),m!==1&&(T.z*=m),Math.abs(T.y)>Math.PI/2||!ey(T))throw new Error("Coordinate is outside the geographic domain");if(T.x+=g,e.verticalGrid&&(T.z+=e.verticalGrid(T.x,T.y)),l?.(T),t.verticalGrid&&(T.z-=t.verticalGrid(T.x,T.y)),T.x-=y,_!==void 0&&(T.x=_+ve(T.x-_)),c?.(T),d!==1&&(T.x/=d,T.y/=d),p!==1&&(T.z/=p),h&&(T.z=S),s?.(T),!ey(T))throw new Error("Projection produced non-finite coordinates")}}}function Qc(e,t,r,n){if(e.length<2)throw new Error("Coordinates must contain finite x, y and optional z values");if(e.length<3&&t.requiresInputZ)throw new Error("This transform requires three ordinates");let i=Math.max(e.length,t.geocentricOutput?3:2),o=r.acquire();try{if(o.x=e[0],o.y=e[1],o.z=e.length>=3?e[2]:0,t.run(o),n)return jh(e,n,o,i);let s=e.slice();return s[0]=o.x,s[1]=o.y,(e.length>=3||t.geocentricOutput)&&(s[2]=o.z),s}finally{r.release(o)}}function im(e,t,r,n){if(!(e instanceof Float32Array||e instanceof Float64Array))throw new Error("In-place projection requires a Float32Array or Float64Array");if(!Number.isSafeInteger(t)||t<2||e.length%t!==0)throw new Error("Dimension must be an integer >= 2 and divide the typed array length");if(t<3&&(r.requiresInputZ||r.geocentricOutput))throw new Error("This transform requires a dimension of at least 3");if(r.flat)return r.flat(e,t),e;let i=n.acquire();try{let o=e instanceof Float32Array;for(let s=0;s<e.length;s+=t){if(i.x=e[s],i.y=e[s+1],i.z=t>=3?e[s+2]:0,r.run(i),o&&(Math.abs(i.x)>34028234663852886e22||Math.abs(i.y)>34028234663852886e22||t>=3&&Math.abs(i.z)>34028234663852886e22))throw new Error("Projected coordinate exceeds Float32 range");e[s]=i.x,e[s+1]=i.y,t>=3&&(e[s+2]=i.z)}return e}finally{n.release(i)}}var sm=class{constructor(t){this.sample=t,this.result=[0,0,0],this.samples=Array.from({length:4},()=>[0,0,0]),this.coarse=[0,0,0],this.fine=[0,0,0]}evaluate(t,r,n=1e-6){if(!this.difference(t,this.coarse)||!this.difference(t/2,this.fine))return!1;let i=n*Math.max(r,Math.abs(this.fine[0]),Math.abs(this.fine[1]),Math.abs(this.fine[2]));for(let o=0;o<3;o++)if(Math.abs(this.coarse[o]-this.fine[o])>i||(this.fine[o]+=(this.fine[o]-this.coarse[o])/15,!Number.isFinite(this.fine[o])))return!1;for(let o=0;o<3;o++)this.result[o]=this.fine[o];return!0}difference(t,r){let[n,i,o,s]=this.samples;if(!this.sample(-2*t,n)||!this.sample(-t,i)||!this.sample(t,o)||!this.sample(2*t,s))return!1;for(let a=0;a<3;a++)if(r[a]=(n[a]-s[a]+8*(o[a]-i[a]))/(12*t),!Number.isFinite(r[a]))return!1;return!0}};var $h=Math.PI/180,hE=ho("WGS84").ellipsoid;function ry(e){if(e.length!==3||e.some(t=>!Number.isFinite(t)||t<=0))throw new Error("Invalid CRS rendering scale");return e}function uE(e,t,r,n){if(e.kind==="geocentric")return ry([e.toMeter,e.toMeter,e.toMeter]);if(e.kind==="identity")return ry([...r].map(m=>/[ud]/.test(m)?e.verticalUnit:e.toMeter));let i=[0,0,0],o=[0,0,0],s=[0,0,0],a=[0,0,0],c=Array.from({length:3},()=>[0,0,0]),l=0,h=0,u=0,f=!1,d=new sm((m,p)=>{for(let _=0;_<3;_++)o[_]=i[_];o[l]+=m,t.unprojectTo(o,a);let g=a[0]-s[0],y=Math.abs(g)<=180?g:((g+180)%360+360)%360-180;return Math.abs(a[1])>=90?!1:(p[0]=y*h,p[1]=(a[1]-s[1])*u,p[2]=a[2]-s[2],p.every(Number.isFinite))});return m=>{if(f||m.length<2)return null;f=!0;let p;try{if(i[0]=m[0],i[1]=m[1],i[2]=m[2]??0,!i.every(Number.isFinite))return null;t.unprojectTo(i,s);let g=s[1]*$h,y=hE.semiMajorAxis,_=hE.eccentricitySquared,M=1-_*Math.sin(g)**2;if(h=y*Math.cos(g)/Math.sqrt(M)*$h,u=y*(1-_)/M**1.5*$h,!(h>y*$h*1e-8)||!(u>0))return null;let b=((s[0]-n+180)%360+360)%360-180;if((e.kind==="geographic"?e.longitudeWrap!==void 0:!Object.prototype.hasOwnProperty.call(e.parameters,"over"))&&Math.abs(b)+2/h>=180||Math.abs(s[1])+2/u>=90)return null;for(l=0;l<3;l++){let T=r[l],S=/[ud]/.test(T)?e.verticalUnit:e.kind==="geographic"?(/[ew]/.test(T)?h:u)*e.angularUnit/$h:e.toMeter;if(!d.evaluate(1/S,S))return null;for(let E=0;E<3;E++)c[l][E]=d.result[E]}if(p=c.map(T=>Math.hypot(...T)),e.kind==="projected"){let T=c[r.search(/[ew]/)],S=c[r.search(/[ns]/)],E=Math.abs(T[0]*S[1]-T[1]*S[0])/e.toMeter**2;p[r.search(/[ud]/)]=e.verticalUnit*Math.sqrt(E)}}catch{return null}finally{f=!1}return ry(p)}}lg();var fE={degrees:Math.PI/180,radians:1,gradians:Math.PI/200},oO={...Object.fromEntries(Object.values(wh).map(e=>[e.name,e.metersPerUnit]))};async function gE(e,t,r,n={},i=!1,o){let s=typeof t=="string"?t:JSON.parse(JSON.stringify(t)),a={enforceAxis:r.enforceAxis,mode:r.mode,...n,converters:n.converters&&[...n.converters]},c=o?await o(s,{...r,...a}):s,l=ho(c,{...r,...a}),h=await e.createProjectionAsync({...a,from:"WGS84",to:c}),u=l.storedAxis||(a.enforceAxis?l.axis:"enu"),f=pE(l.kind==="geographic"?l.angularUnit:l.toMeter,l.kind==="geographic"),d=pE(l.verticalUnit,!1),m=[...u].map(E=>l.kind!=="geocentric"&&/[ud]/.test(E)?d:f),p=h.targetProfile;if(!p)throw new Error("Projection must define a rendering profile for CRS retrieval");let g=(h.targetLongitudeOrigin+l.primeMeridian)*180/Math.PI,y=cO(p,l,u),_=aO(p.normalize),M=uE(l,h,u,g),b=[...new Set(["WGS84",...a.converters||[]])];if(b.some(E=>typeof E!="string"||!E.trim()))throw new Error("Converter source CRS must be a nonempty string");let v=await Promise.all(b.map(async E=>{if(E==="WGS84")return[E,dE(h,_)];let[N,B]=await Promise.all([e.createProjectionAsync({...a,from:E,to:c}),e.createProjectionAsync({...a,from:"WGS84",to:E})]);return[E,dE(N,sO(B,_))]})),T=Object.assign(Object.create(null),Object.fromEntries(v)),S={coordinateFrame:l.kind,projection:l.projection,parameters:l.parameters,ellipsoid:{semiMajorAxis:l.ellipsoid.semiMajorAxis,semiMinorAxis:l.ellipsoid.semiMinorAxis},axis:u,xUnit:m[0],yUnit:m[1],zUnit:m[2],areaOfUse:l.areaOfUse,lossy:l.lossy};return{...S,signature:i&&typeof c=="string"&&!a.enforceAxis&&!l.lossy?c:$2(S),renderingBounds:y,renderingScale:M,getRenderingScale:E=>typeof M=="function"?M(E):M,converter:T}}function dE(e,t){return{from:mE(e.project.bind(e),e.projectTo.bind(e)),to:mE(e.unproject.bind(e),e.unprojectTo.bind(e)),normalize:t}}function sO(e,t){function r(n,i){i!==void 0&&Ta(n,i,n.length);let o=e.unproject(Array.from(n)),[s,a,c]=o;return t(o,o),o[0]===s&&o[1]===a&&o[2]===c?i===void 0?Array.from(n):jh(n,i,{x:n[0],y:n[1],z:n[2]??0},n.length):i===void 0?e.project(o):e.projectTo(o,i)}return r}function mE(e,t){function r(n,i){return i===void 0?e(Array.isArray(n)?n:Array.from(n)):t(n,i)}return r}function aO(e){function t(r,n){let i=n??new Array(r.length);Ta(r,i,r.length);let o=r[0],s=r[1],a=r[2]??0;if(r.length<2||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(a))throw new Error("Normalization requires finite longitude, latitude and altitude");let c={x:o,y:s,z:a};return e?.(c),jh(r,i,c,r.length)}return t}function cO(e,t,r){let n=t.kind==="geographic"?t.angularUnit:t.toMeter,i=[n,n,t.kind==="geocentric"?t.toMeter:t.verticalUnit],o=e.bounds,s=[...r].map(a=>{let c=/[ew]/.test(a)?0:/[ns]/.test(a)?1:2,l=o[0][c]/i[c],h=o[1][c]/i[c];return/[wsd]/.test(a)?[-h,-l]:[l,h]});return[[s[0][0],s[1][0],s[2][0]],[s[0][1],s[1][1],s[2][1]]]}function pE(e,t){let r=t?fE:oO,n=Object.keys(r).find(i=>r[i]===e)||"custom";return t?{name:n,degreesPerUnit:e/fE.degrees}:{name:n,metersPerUnit:e}}function yE(e){return{...e,projections:e.projections&&[...e.projections],parsers:e.parsers&&[...e.parsers],datumCatalogs:e.datumCatalogs&&[...e.datumCatalogs],aliases:e.aliases&&JSON.parse(JSON.stringify(e.aliases)),datumGrids:e.datumGrids&&{...e.datumGrids},verticalGrids:e.verticalGrids&&{...e.verticalGrids}}}function Yh(e){return!!(e.projections||e.parsers||e.datumCatalogs||e.aliases||e.datumGrids||e.verticalGrids||e.resolver)}Pc();async function _E(e){let t={...e,from:wE(e.from??"WGS84"),to:wE(e.to??"WGS84")},[r,n]=await Promise.all([am(t.from,t),am(t.to,t)]);return{...t,from:r,to:n}}async function am(e,t){let r=Wh(e,t),n=X1(r.definition,t),i=typeof e=="string"||"type"in e?void 0:"crs"in e?e.crs:e,o=n===r.definition&&i?i.representation:tr(n);if(o!=="identifier"||t.parsers?.some(h=>h.canParse(n)))return e;let s=await t.resolver.resolve({state:"explicit",provenance:i?.provenance??"unknown",definition:n,representation:o}),a=Wh(s.input,t).definition;if(!i)return a;let c=e,l={...i,definition:a,representation:tr(a),alternatives:[{definition:i.definition,representation:i.representation},...i.alternatives??[]]};return"crs"in c?{...c,crs:l}:l}function wE(e){return typeof e=="string"?e:JSON.parse(JSON.stringify(e))}var cm=class{constructor(t={}){this.options=yE(t),this.useDefinitionSignature=!Yh(t)}getCRS(t,r={}){return gE(this,t,this.options,r,this.useDefinitionSignature,this.options.resolver?am:void 0)}createProjection(t={}){return new Hh({...this.options,...t})}async createProjectionAsync(t={}){let r={...this.options,...t};return Hh.create(r.resolver?await _E(r):r)}};kc();Ee();Ht();ne();Ie();var ny={name:"merc",semantics:{id:"@math.gl/geospatial/merc",version:1},aliases:["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","Mercator_Variant_A"],parameters:["lon_0","lat_ts","k","k_0","x_0","y_0"],create({semiMajorAxis:e,eccentricitySquared:t,parameters:r,primeMeridian:n=0}){let i=Math.sqrt(t),o=Object.prototype.hasOwnProperty.call(r,"over"),s=tt(r,"lon_0",0)*Me,a=tt(r,"x_0",0),c=tt(r,"y_0",0),l=tt(r,"k_0",tt(r,"k",1));if(Object.prototype.hasOwnProperty.call(r,"lat_ts")){let m=Rh(r,"lat_ts");l=Math.cos(m)/Math.sqrt(1-t*Math.sin(m)**2)}if(l<=0)throw new Error("Mercator scale must be positive");let h=e*l,u=Math.atan(Math.sinh(Math.PI)),f=h*Math.PI,d=h*(Math.PI-i*Math.atanh(i*Math.sin(u)));return{longitudeOrigin:s,getRenderingProfile(m){if(m){let g=m[1]<=-90||m[3]>=90,y=[m[0],g?Math.max(-u*180/Math.PI,Math.min(u*180/Math.PI,m[1])):m[1],m[2],g?Math.max(-u*180/Math.PI,Math.min(u*180/Math.PI,m[3])):m[3]],_=M=>c+h*(Math.asinh(Math.tan(M))-i*Math.atanh(i*Math.sin(M)));return Ke(M=>re(At([a,a],Ct(gr(M,s,o),h)),[_(M[0][1]),_(M[1][1])]),y,s,n,o)}let p=[[a-f,c-d,0],[a+f,c+d,0]];return{bounds:p,normalize:Ke(()=>p,yn(K(s-Math.PI,-u,s+Math.PI,u),n),s,n,o).normalize}},...ai(m=>{let p=m.x,g=m.y;if(Math.abs(g)>=Math.PI/2)throw new Error("Mercator is undefined at the poles");let y=Math.asinh(Math.tan(g));m.x=a+h*ve(p-s,o),m.y=c+h*(i===0?y+0:y-i*Math.atanh(i*Math.sin(g)))},m=>{let p=m.x,y=(m.y-c)/h,_=Math.atan(Math.sinh(y));if(i===0){m.x=ve(s+(p-a)/h,o),m.y=_+0;return}for(let M=0;M<30;M++){let b=Math.atan(Math.sinh(y+i*Math.atanh(i*Math.sin(_))));if(Math.abs(b-_)<1e-13){m.x=ve(s+(p-a)/h,o),m.y=b;return}_=b}throw new Error("Mercator inverse did not converge")})}}};wa();Ee();Ht();ne();Ie();var iy={name:"eqc",semantics:{id:"@math.gl/geospatial/eqc",version:1},aliases:["Equirectangular","Equidistant_Cylindrical","Equidistant_Cylindrical_Spherical"],parameters:["lon_0","lat_0","lat_ts","x_0","y_0"],create({semiMajorAxis:e,parameters:t,primeMeridian:r=0}){let n=Object.prototype.hasOwnProperty.call(t,"over"),i=tt(t,"lon_0",0)*Me,o=Rh(t,"lat_0"),s=Math.cos(Rh(t,"lat_ts")),a=tt(t,"x_0",0),c=tt(t,"y_0",0),l=e*Math.abs(s)*Math.PI;return{longitudeOrigin:i,getRenderingProfile(h){if(h)return Ke(f=>re(At([a,a],Ct(gr(f,i,n),e*s)),[c+e*(f[0][1]-o),c+e*(f[1][1]-o)]),h,i,r,n);let u=[[a-l,c+e*(-Math.PI/2-o),0],[a+l,c+e*(Math.PI/2-o),0]];return{bounds:u,normalize:Ke(()=>u,yn(K(i-Math.PI,-(Math.PI/2),i+Math.PI,Math.PI/2),r),i,r,n).normalize}},...jn(h=>{h.x=a+e*s*ve(h.x-i,n),h.y=c+e*(h.y-o)},h=>{h.x=ve(i+(h.x-a)/(e*s),n),h.y=o+(h.y-c)/e})}}};Ie();Ht();ne();kc();wn();Wc();Dh();fe();Ad();Ae();function lO(e){if(e.k0||(e.k0=1),e.x0=e.x0||0,e.y0=e.y0||0,e.long0=e.long0||0,!(Math.abs(e.lat1+e.lat2)<1e-10)){var t=e.b/e.a;e.e=Math.sqrt(1-t*t);var r=Math.sin(e.lat1),n=Math.cos(e.lat1),i=nn(e.e,r,n),o=Lr(e.e,e.lat1,r),s=Math.sin(e.lat2),a=Math.cos(e.lat2),c=nn(e.e,s,a),l=Lr(e.e,e.lat2,s),h=Lr(e.e,e.lat0,Math.sin(e.lat0));Math.abs(e.lat1-e.lat2)>1e-10?e.ns=Math.log(i/c)/Math.log(o/l):e.ns=r,Number.isNaN(e.ns)&&(e.ns=r),e.f0=i/(e.ns*Math.pow(o,e.ns)),e.rh=Math.abs(Math.abs(e.lat0)-U)<1e-10?0:e.a*e.f0*Math.pow(h,e.ns)}}function ME(e,t){var r=t.x,n=t.y,i=Math.abs(Math.abs(n)-U),o,s;if(i>1e-10)o=e.sphere?1/Math.tan(Math.PI/4+n/2):Lr(e.e,n,Math.sin(n)),s=e.a*e.f0*Math.pow(o,e.ns);else{if(i=n*e.ns,i<=0)return null;s=0}var a=e.ns*G(r-e.long0,e.over);return t.x=e.k0*(s*Math.sin(a))+e.x0,t.y=e.k0*(e.rh-s*Math.cos(a))+e.y0,t}function bE(e,t){var r,n,i,o,s,a=(t.x-e.x0)/e.k0,c=e.rh-(t.y-e.y0)/e.k0;e.ns>0?(r=Math.sqrt(a*a+c*c),n=1):(r=-Math.sqrt(a*a+c*c),n=-1);var l=0;if(r!==0&&(l=Math.atan2(n*a,n*c)),r!==0||e.ns>0){if(n=1/e.ns,i=Math.pow(r/(e.a*e.f0),n),o=Sa(e.e,i),o===-9999)return null}else o=-U;return s=G(l/e.ns+e.long0,e.over),t.x=s,t.y=o,t}function xE(e){let t={...e,ns:0,f0:0,rh:0};return lO(t),t}var oy={name:"lcc",aliases:["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"],parameters:[...ar,...lo,"lat_1","lat_2"],create(e){let t=er(e);Vc(t,e.parameters);let r=xE(t),n=Xe("lcc",r,ME,bE),i={...ai(o=>{let s=o.y;if(Math.abs(s)===Math.PI/2&&s*r.ns<0)throw new Error("Lambert conformal conic is undefined at the opposite pole");n.forwardInPlace(o)},n.inverseInPlace)};return Pt(i,K(t.long0-Math.PI,r.ns>0?-Math.PI/3:-Math.PI/2,t.long0+Math.PI,r.ns>0?Math.PI/2:Math.PI/3),o=>zc(i.forward,o,t.long0,r.ns,r.x0,r.y0+r.k0*r.rh,t.over),t.primeMeridian,t.over)}};kc();Ie();Ht();ne();wn();Wc();function Fr(e,t){var r;return e>1e-7?(r=e*t,(1-e*e)*(t/(1-r*r)-.5/e*Math.log((1-r)/(1+r)))):2*t}fe();Ae();function lm(e,t){var r=1-(1-e*e)/(2*e)*Math.log((1-e)/(1+e));let n=4*Number.EPSILON*r;if(Math.abs(t)>r+n)return NaN;if(Math.abs(Math.abs(t)-r)<=n)return t<0?-1*U:U;for(var i=Math.asin(.5*t),o,s,a,c,l=0;l<30;l++)if(s=Math.sin(i),a=Math.cos(i),c=e*s,o=Math.pow(1-c*c,2)/(2*a)*(t/(1-e*e)-s/(1-c*c)+.5/e*Math.log((1-c)/(1+c))),i+=o,Math.abs(o)<=1e-10)return i;return NaN}function hO(e){Math.abs(e.lat1+e.lat2)<1e-10||(e.temp=e.b/e.a,e.es=1-Math.pow(e.temp,2),e.e3=Math.sqrt(e.es),e.sin_po=Math.sin(e.lat1),e.cos_po=Math.cos(e.lat1),e.t1=e.sin_po,e.con=e.sin_po,e.ms1=nn(e.e3,e.sin_po,e.cos_po),e.qs1=Fr(e.e3,e.sin_po),e.sin_po=Math.sin(e.lat2),e.cos_po=Math.cos(e.lat2),e.t2=e.sin_po,e.ms2=nn(e.e3,e.sin_po,e.cos_po),e.qs2=Fr(e.e3,e.sin_po),e.sin_po=Math.sin(e.lat0),e.cos_po=Math.cos(e.lat0),e.t3=e.sin_po,e.qs0=Fr(e.e3,e.sin_po),Math.abs(e.lat1-e.lat2)>1e-10?e.ns0=(e.ms1*e.ms1-e.ms2*e.ms2)/(e.qs2-e.qs1):e.ns0=e.con,e.c=e.ms1*e.ms1+e.ns0*e.qs1,e.rh=e.a*Math.sqrt(e.c-e.ns0*e.qs0)/e.ns0)}function SE(e,t){var r=t.x,n=t.y;e.sin_phi=Math.sin(n),e.cos_phi=Math.cos(n);var i=Fr(e.e3,e.sin_phi),o=e.a*Math.sqrt(e.c-e.ns0*i)/e.ns0,s=e.ns0*G(r-e.long0,e.over),a=o*Math.sin(s)+e.x0,c=e.rh-o*Math.cos(s)+e.y0;return t.x=a,t.y=c,t}function vE(e,t){var r,n,i,o,s,a;if(t.x-=e.x0,t.y=e.rh-t.y+e.y0,e.ns0>=0?(r=Math.sqrt(t.x*t.x+t.y*t.y),i=1):(r=-Math.sqrt(t.x*t.x+t.y*t.y),i=-1),o=0,r!==0&&(o=Math.atan2(i*t.x,i*t.y)),i=r*e.ns0/e.a,e.sphere){let c=(e.c-i*i)/(2*e.ns0);if(Math.abs(c)>1+8*Number.EPSILON)return null;a=Math.asin(Math.max(-1,Math.min(1,c)))}else{n=(e.c-i*i)/e.ns0;let c=Fr(e.e3,1);a=Math.abs(Math.abs(n)-c)<=16*Number.EPSILON*c?Math.sign(n)*Math.PI/2:lm(e.e3,n)}return s=G(o/e.ns0+e.long0,e.over),t.x=s,t.y=a,t}function EE(e){let t={...e,temp:0,e3:0,sin_po:0,cos_po:0,t1:0,con:0,ms1:0,qs1:0,t2:0,ms2:0,qs2:0,t3:0,qs0:0,ns0:0,c:0,rh:0,sin_phi:0,cos_phi:0};return hO(t),t}var sy={name:"aea",aliases:["Albers_Conic_Equal_Area","Albers_Equal_Area","Albers"],parameters:[...ar,"lat_1","lat_2"],create(e){let t=er(e);Vc(t,e.parameters);let r=EE(t),n={...Xe("aea",r,SE,vE,ai)};return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>zc(n.forward,i,t.long0,r.ns0,r.x0,r.y0+r.rh,t.over),t.primeMeridian,t.over)}};kc();Ie();Ht();ne();wn();qc();ba();jc();Wc();fe();Ae();Bh();function uo(e){return Math.abs(e)<=U?e:e-Qo(e)*Math.PI}function uO(e){Math.abs(e.lat1+e.lat2)<1e-10||(e.temp=e.b/e.a,e.es=1-Math.pow(e.temp,2),e.e=Math.sqrt(e.es),e.en=Ni(e.es),e.sin_phi=Math.sin(e.lat1),e.cos_phi=Math.cos(e.lat1),e.ms1=nn(e.e,e.sin_phi,e.cos_phi),e.ml1=rr(e.lat1,Math.sin(e.lat1),Math.cos(e.lat1),e.en),Math.abs(e.lat1-e.lat2)<1e-10?e.ns=e.sin_phi:(e.sin_phi=Math.sin(e.lat2),e.cos_phi=Math.cos(e.lat2),e.ms2=nn(e.e,e.sin_phi,e.cos_phi),e.ml2=rr(e.lat2,Math.sin(e.lat2),Math.cos(e.lat2),e.en),e.ns=(e.ms1-e.ms2)/(e.ml2-e.ml1)),e.g=e.ml1+e.ms1/e.ns,e.ml0=rr(e.lat0,Math.sin(e.lat0),Math.cos(e.lat0),e.en),e.rh=e.a*(e.g-e.ml0))}function TE(e,t){var r=t.x,n=t.y,i;if(e.sphere)i=e.a*(e.g-n);else{var o=rr(n,Math.sin(n),Math.cos(n),e.en);i=e.a*(e.g-o)}var s=e.ns*G(r-e.long0,e.over),a=e.x0+i*Math.sin(s),c=e.y0+e.rh-i*Math.cos(s);return t.x=a,t.y=c,t}function IE(e,t){t.x-=e.x0,t.y=e.rh-t.y+e.y0;var r,n,i,o;e.ns>=0?(n=Math.sqrt(t.x*t.x+t.y*t.y),r=1):(n=-Math.sqrt(t.x*t.x+t.y*t.y),r=-1);var s=0;if(n!==0&&(s=Math.atan2(r*t.x,r*t.y)),e.sphere)return o=G(e.long0+s/e.ns,e.over),i=uo(e.g-n/e.a),t.x=o,t.y=i,t;var a=e.g-n/e.a;return i=Oi(a,e.es,e.en),o=G(e.long0+s/e.ns,e.over),t.x=o,t.y=i,t}function AE(e){let t={...e,temp:0,en:[],sin_phi:0,cos_phi:0,ms1:0,ml1:0,ns:0,ms2:0,ml2:0,g:0,ml0:0,rh:0};return uO(t),t}var ay={name:"eqdc",aliases:["Equidistant_Conic"],parameters:[...ar,"lat_1","lat_2"],create(e){let t=er(e);Vc(t,e.parameters);let r=AE(t),n=Xe("eqdc",r,TE,IE,ai);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>zc(n.forward,i,t.long0,r.ns,r.x0,r.y0+r.rh,t.over),t.primeMeridian,t.over)}};function ss(e,t){let r=Math.abs(Math.sin(t)),n=Math.cos(t),i=n*n/(1+r);if(e===0)return 2*i;let o=e*e;return i*(1+o*r)/(1-o*r*r)+(1-o)/e*Math.atanh(e*i/(1-o*r))}function cy(e,t,r){if(r===0||e===0)return r;let n=ss(e,r)/t;return Math.atan2(Math.sign(r)*(1-n),Math.sqrt(n*(2-n)))}function ly(e,t,r){if(e===0||r===0||Math.abs(r)===Math.PI/2)return r;let n=Math.abs(Math.sin(r)),i=Math.cos(r),o=t*i*i/(1+n),s=Math.abs(r),a=e*e,c=0,l=Math.PI/2;for(let h=0;h<48;h++){let u=Math.sin(s),f=1-a*u*u,d=2*(1-a)*Math.cos(s)/(f*f),m=ss(e,s)-o,p=m/d;if(Math.abs(p)<2e-15)return Math.sign(r)*s;m>0?c=s:l=s;let g=s+p;s=g>c&&g<l?g:(c+l)/2}throw new Error("Authalic latitude inverse did not converge")}rs();ns();wn();Ae();fe();Lh();var li=1,Fi=2,Hn=3,Ur=4;function fO(e){var t=Math.abs(e.lat0);if(Math.abs(t-U)<1e-10?e.mode=e.lat0<0?li:Fi:Math.abs(t)<1e-10?e.mode=Hn:e.mode=Ur,e.es>0){var r;switch(e.qp=Fr(e.e,1),e.mmf=.5/(1-e.es),e.mode){case Fi:e.dd=1;break;case li:e.dd=1;break;case Hn:e.rq=Math.sqrt(.5*e.qp),e.dd=1/e.rq,e.xmf=1,e.ymf=.5*e.qp;break;case Ur:e.rq=Math.sqrt(.5*e.qp),r=Math.sin(e.lat0),e.sinb1=Fr(e.e,r)/e.qp,e.cosb1=Math.sqrt(1-e.sinb1*e.sinb1),e.dd=Math.cos(e.lat0)/(Math.sqrt(1-e.es*r*r)*e.rq*e.cosb1),e.xmf=e.rq,e.ymf=e.xmf/e.dd,e.xmf*=e.dd;break}}else e.mode===Ur&&(e.sinph0=Math.sin(e.lat0),e.cosph0=Math.cos(e.lat0))}function PE(e,t){var r,n,i,o,s,a,c,l,h,u,f=t.x,d=t.y;if(f=G(f-e.long0,e.over),e.sphere){if(s=Math.sin(d),u=Math.cos(d),i=Math.cos(f),e.mode===Ur||e.mode===Hn){if(n=e.mode===Hn?1+u*i:1+e.sinph0*s+e.cosph0*u*i,n<=1e-10)return null;n=Math.sqrt(2/n),r=n*u*Math.sin(f),n*=e.mode===Hn?s:e.cosph0*s-e.sinph0*u*i}else if(e.mode===Fi||e.mode===li){if(e.mode===Fi&&(i=-i),Math.abs(d+e.lat0)<1e-10)return null;n=$t-d*.5,n=2*(e.mode===li?Math.cos(n):Math.sin(n)),r=n*Math.sin(f),n*=i}}else{if(c=0,l=0,h=0,i=Math.cos(f),o=Math.sin(f),s=Math.sin(d),a=Fr(e.e,s),e.mode===Ur||e.mode===Hn){c=a/e.qp;let m=ss(e.e,d)/e.qp;l=Math.sqrt(m*(2-m))}switch(e.mode){case Ur:h=1+e.sinb1*c+e.cosb1*l*i;break;case Hn:h=1+l*i;break;case Fi:h=U+d,a=d>=0?ss(e.e,d):2*e.qp-ss(e.e,d);break;case li:h=d-U,a=d<=0?ss(e.e,d):2*e.qp-ss(e.e,d);break}if(Math.abs(h)<1e-10)return null;switch(e.mode){case Ur:case Hn:h=Math.sqrt(2/h),e.mode===Ur?n=e.ymf*h*(e.cosb1*c-e.sinb1*l*i):(h=Math.sqrt(2/(1+l*i)),n=h*c*e.ymf),r=e.xmf*h*l*o;break;case Fi:case li:a>=0?(h=Math.sqrt(a),r=h*o,n=i*(e.mode===li?h:-h)):r=n=0;break}}return t.x=e.a*r+e.x0,t.y=e.a*n+e.y0,t}function RE(e,t){t.x-=e.x0,t.y-=e.y0;var r=t.x/e.a,n=t.y/e.a,i,o,s,a,c,l,h;if(e.sphere){var u=0,f,d=0;if(f=Math.sqrt(r*r+n*n),o=f*.5,o>1+8*Number.EPSILON)return null;switch(o=2*Math.asin(Math.min(1,o)),(e.mode===Ur||e.mode===Hn)&&(d=Math.sin(o),u=Math.cos(o)),e.mode){case Hn:o=Math.abs(f)<=1e-10?0:ci(0,1,d,u,r,n,f),r*=d,n=u*f;break;case Ur:o=Math.abs(f)<=1e-10?e.lat0:ci(e.sinph0,e.cosph0,d,u,r,n,f),r*=d*e.cosph0,n=(u-Math.sin(o)*e.sinph0)*f;break;case Fi:n=-n,o=U-o;break;case li:o-=U;break}i=n===0&&(e.mode===Hn||e.mode===Ur)?0:Math.atan2(r,n)}else{if(h=0,e.mode===Ur||e.mode===Hn){if(r/=e.dd,n*=e.dd,l=Math.sqrt(r*r+n*n),l<1e-10)return t.x=e.long0,t.y=e.lat0,t;let m=.5*l/e.rq;if(m>1+8*Number.EPSILON)return null;a=2*Math.asin(Math.min(1,m)),s=Math.cos(a),a=Math.sin(a);let p=ci(e.mode===Ur?e.sinb1:0,e.mode===Ur?e.cosb1:1,a,s,r,n,l);o=ly(e.e,e.qp,p),r*=a,e.mode===Ur?(h=s*e.sinb1+n*a*e.cosb1/l,c=e.qp*h,n=l*e.cosb1*s-n*e.sinb1*a):(h=n*a/l,c=e.qp*h,n=l*s)}else if(e.mode===Fi||e.mode===li){if(e.mode===Fi&&(n=-n),c=r*r+n*n,!c)return t.x=e.long0,t.y=e.lat0,t;h=1-c/e.qp,e.mode===li&&(h=-h)}if(i=Math.atan2(r,n),Math.abs(h)>1+8*Number.EPSILON)return null;if(e.mode===Fi||e.mode===li){let m=Math.max(0,Math.min(2,c/e.qp)),p=Math.atan2(h,Math.sqrt(m*(2-m)));o=ly(e.e,e.qp,p)}}return t.x=G(e.long0+i,e.over),t.y=o,t}function CE(e){let t={...e,mode:0,qp:0,mmf:0,dd:0,rq:0,xmf:0,ymf:0,sinb1:0,cosb1:0,sinph0:0,cosph0:0};return fO(t),t}var hy={name:"laea",aliases:["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area"],parameters:ar,create(e){let t=er(e),r=CE(t);return rn(Zo(t,Xe("laea",r,PE,RE)),t,Math.PI*179/180,(n,i)=>AS(t,t.sphere?1:r.xmf||Math.sqrt(r.qp/2),t.sphere?1:r.ymf||Math.sqrt(r.qp/2),n,i,t.sphere?t.lat0:cy(t.e,r.qp,t.lat0),t.sphere?o=>o:o=>cy(t.e,r.qp,o)))}};DS();rs();ns();wn();Lh();function hm(e,t){return Math.pow((1-e)/(1+e),t)}Ae();var dO=20;function mO(e){var t=Math.sin(e.lat0),r=Math.cos(e.lat0);r*=r,e.rc=Math.sqrt(1-e.es)/(1-e.es*t*t),e.C=Math.sqrt(1+e.es*r*r/(1-e.es)),e.phic0=Math.asin(t/e.C),e.ratexp=.5*e.C*e.e,e.K=Math.tan(.5*e.phic0+$t)/(Math.pow(Math.tan(.5*e.lat0+$t),e.C)*hm(e.e*t,e.ratexp))}function NE(e,t){var r=t.x,n=t.y;return t.y=2*Math.atan(e.K*Math.pow(Math.tan(.5*n+$t),e.C)*hm(e.e*Math.sin(n),e.ratexp))-U,t.x=e.C*r,t}function OE(e,t){for(var r=1e-14,n=t.x/e.C,i=t.y,o=Math.pow(Math.tan(.5*i+$t)/e.K,1/e.C),s=dO;s>0&&(i=2*Math.atan(o*hm(e.e*Math.sin(t.y),-.5*e.e))-U,!(Math.abs(i-t.y)<r));--s)t.y=i;return s?(t.x=n,t.y=i,t):null}function BE(e){let t={...e,rc:0,C:0,phic0:0,ratexp:0,K:0};return mO(t),t}fe();Ma();function pO(e){e.rc&&(e.sinc0=Math.sin(e.phic0),e.cosc0=Math.cos(e.phic0),e.R2=2*e.rc)}function LE(e,t){var r,n,i,o;return t.x=G(t.x-e.long0,e.over),NE(e,t),r=Math.sin(t.y),n=Math.cos(t.y),i=Math.cos(t.x),o=e.k0*e.R2/(1+e.sinc0*r+e.cosc0*n*i),t.x=o*n*Math.sin(t.x),t.y=o*(e.cosc0*r-e.sinc0*n*i),t.x=e.a*t.x+e.x0,t.y=e.a*t.y+e.y0,t}function DE(e,t){var r,n,i,o,s;if(t.x=(t.x-e.x0)/e.a,t.y=(t.y-e.y0)/e.a,t.x/=e.k0,t.y/=e.k0,s=qe(t.x,t.y),s){var a=2*Math.atan2(s,e.R2);r=Math.sin(a),n=Math.cos(a),o=ci(e.sinc0,e.cosc0,r,n,t.x,t.y,s),i=Math.atan2(t.x*r,s*e.cosc0*n-t.y*e.sinc0*r)}else o=e.phic0,i=0;if(t.x=i,t.y=o,!OE(e,t))throw new Error("Oblique stereographic inverse did not converge");return t.x=G(t.x+e.long0,e.over),t}function FE(e){let t={...BE(e),sinc0:0,cosc0:0,R2:0};return pO(t),t}var uy={name:"sterea",aliases:["Stereographic_North_Pole","Oblique_Stereographic","Oblique Stereographic Alternative","Double_Stereographic"],parameters:[...ar,...lo],create(e){let t=er(e);if(Math.abs(t.lat0)===Math.PI/2)throw new Error("sterea requires a non-polar origin; use stere at the poles");let r=FE(t);return rn(Zo(t,Xe("sterea",r,LE,DE)),t,Math.PI*150/180,(n,i)=>Id(t,o=>2*Math.atan(r.K*Math.pow(Math.tan(Math.PI/4+o/2),r.C)*Math.pow((1-t.e*Math.sin(o))/(1+t.e*Math.sin(o)),r.ratexp))-Math.PI/2,r.phic0,t.a*t.k0*r.R2,n,i,r.C,Math.abs(Math.log(r.C))+Math.abs(Math.log(r.K))+r.C*t.e*Math.atanh(t.e)))}};rs();ns();wn();Lh();fe();Ae();function fy(e,t){let r=1-e*Math.sin(t)**2;return(1-e)/(r*Math.sqrt(r))}function um(e,t,r,n){return fy(e,t-r*n)+fy(e,t+r*n)}function Sn(e,t,r,n){let i=(n-r)/8,o=0;for(let s=0;s<4;s++){let a=r+(2*s+1)*i;o+=i*(.362683783378362*um(t,a,i,.1834346424956498)+.3137066458778873*um(t,a,i,.525532409916329)+.2223810344533745*um(t,a,i,.7966664774136267)+.1012285362903763*um(t,a,i,.9602898564975363))}return e*o}function dy(e,t,r){let n=Math.PI/2,i=Sn(e,t,0,n);if(!Number.isFinite(r)||Math.abs(r)>i)return NaN;let o=-n,s=n,a=r/i*n;for(let c=0;c<48;c++){let l=Sn(e,t,0,a)-r;if(Math.abs(l)<=8*Number.EPSILON*e)return a;l>0?s=a:o=a;let h=a-l/(e*fy(t,a));a=h>o&&h<s?h:(o+s)/2}return NaN}function UE(e,t,r,n,i,o,s){let a=n-t,c=Math.atan((1-o)*Math.tan(e)),l=Math.atan((1-o)*Math.tan(r)),h=Math.sin(c),u=Math.cos(c),f=Math.sin(l),d=Math.cos(l),m=a,p,g=100,y,_,M,b,v,T,S,E,N,B,C,R,W,j;do{if(y=Math.sin(m),_=Math.cos(m),M=Math.sqrt(d*y*(d*y)+(u*f-h*d*_)*(u*f-h*d*_)),M===0){s.x=0,s.y=0;return}b=h*f+u*d*_,v=Math.atan2(M,b),T=u*d*y/M,S=1-T*T,E=S!==0?b-2*h*f/S:0,N=o/16*S*(4+o*(4-3*S)),p=m,m=a+(1-N)*o*T*(v+N*M*(E+N*b*(-1+2*E*E)))}while(Math.abs(m-p)>1e-12&&--g>0);if(g===0){s.x=NaN,s.y=NaN;return}B=S*(i*i-i*(1-o)*(i*(1-o)))/(i*(1-o)*(i*(1-o))),C=1+B/16384*(4096+B*(-768+B*(320-175*B))),R=B/1024*(256+B*(-128+B*(74-47*B))),W=R*M*(E+R/4*(b*(-1+2*E*E)-R/6*E*(-3+4*M*M)*(-3+4*E*E))),j=i*(1-o)*C*(v-W);let A=Math.atan2(d*y,u*f-h*d*_);s.x=A,s.y=j}function GE(e,t,r,n,i,o,s){let a=Math.atan((1-o)*Math.tan(e)),c=Math.sin(a),l=Math.cos(a),h=Math.sin(r),u=Math.cos(r),f=Math.atan2(c,l*u),d=l*h,m=1-d*d,p=m*(i*i-i*(1-o)*(i*(1-o)))/(i*(1-o)*(i*(1-o))),g=1+p/16384*(4096+p*(-768+p*(320-175*p))),y=p/1024*(256+p*(-128+p*(74-47*p))),_=n/(i*(1-o)*g),M,b=100,v,T,S,E;do v=Math.cos(2*f+_),T=Math.sin(_),S=Math.cos(_),E=y*T*(v+y/4*(S*(-1+2*v*v)-y/6*v*(-3+4*T*T)*(-3+4*v*v))),M=_,_=n/(i*(1-o)*g)+E;while(Math.abs(_-M)>1e-12&&--b>0);if(b===0){s.x=NaN,s.y=NaN;return}let N=c*T-l*S*u,B=Math.atan2(c*S+l*T*u,(1-o)*Math.sqrt(d*d+N*N)),C=Math.atan2(T*h,l*S-c*T*u),R=o/16*m*(4+o*(4-3*m)),W=C-(1-R)*o*d*(_+R*T*(v+R*S*(-1+2*v*v))),j=t+W;s.x=j,s.y=B}function gO(e){e.sin_p12=Math.sin(e.lat0),e.cos_p12=Math.cos(e.lat0),e.x0=e.x0||0,e.y0=e.y0||0,e.long0=e.long0||0,e.f=e.es/(1+Math.sqrt(1-e.es))}function zE(e,t){var r=t.x,n=t.y,i=Math.sin(t.y),o=Math.cos(t.y),s=G(r-e.long0,e.over),a,c,l,h,u;if(e.sphere)return Math.abs(e.sin_p12-1)<=1e-10?(t.x=e.x0+e.a*(U-n)*Math.sin(s),t.y=e.y0-e.a*(U-n)*Math.cos(s),t):Math.abs(e.sin_p12+1)<=1e-10?(t.x=e.x0+e.a*(U+n)*Math.sin(s),t.y=e.y0+e.a*(U+n)*Math.cos(s),t):(h=e.sin_p12*i+e.cos_p12*o*Math.cos(s),c=Math.acos(h),l=c?c/Math.sin(c):1,t.x=e.x0+e.a*l*o*Math.sin(s),t.y=e.y0+e.a*l*(e.cos_p12*i-e.sin_p12*o*Math.cos(s)),t);if(Math.abs(e.sin_p12-1)<=1e-10)return a=Sn(e.a,e.es,n,U),t.x=e.x0+a*Math.sin(s),t.y=e.y0-a*Math.cos(s),t;if(Math.abs(e.sin_p12+1)<=1e-10)return a=Sn(e.a,e.es,-U,n),t.x=e.x0+a*Math.sin(s),t.y=e.y0+a*Math.cos(s),t;{if(Math.abs(s)<1e-10&&Math.abs(n-e.lat0)<1e-10)return t.x=e.x0,t.y=e.y0,t;UE(e.lat0,e.long0,n,r,e.a,e.f,t),u=t.x;let f=t.y;return t.x=e.x0+f*Math.sin(u),t.y=e.y0+f*Math.cos(u),t}}function VE(e,t){t.x-=e.x0,t.y-=e.y0;var r,n,i,o,s,a,c,l,h,u,f;if(e.sphere){if(r=Math.sqrt(t.x*t.x+t.y*t.y),r>2*U*e.a)return null;if(n=r/e.a,i=Math.sin(n),o=Math.cos(n),s=e.long0,Math.abs(r)<=1e-10)a=e.lat0;else if(a=ci(e.sin_p12,e.cos_p12,i,o,t.x,t.y,r),c=Math.abs(e.lat0)-U,Math.abs(c)<=1e-10)if(e.lat0>=0){if(!Number.isFinite(a))return null;s=G(e.long0+Math.atan2(t.x,-t.y),e.over)}else s=G(e.long0-Math.atan2(-t.x,t.y),e.over);else s=G(e.long0+Math.atan2(t.x*i,r*e.cos_p12*o-t.y*e.sin_p12*i),e.over);return t.x=s,t.y=a,t}else return Math.abs(e.sin_p12-1)<=1e-10?(l=Sn(e.a,e.es,0,U),r=Math.sqrt(t.x*t.x+t.y*t.y),h=l-r,a=dy(e.a,e.es,h),Number.isFinite(a)?(s=G(e.long0+Math.atan2(t.x,-1*t.y),e.over),t.x=s,t.y=a,t):null):Math.abs(e.sin_p12+1)<=1e-10?(l=Sn(e.a,e.es,0,U),r=Math.sqrt(t.x*t.x+t.y*t.y),h=r-l,a=dy(e.a,e.es,h),Number.isFinite(a)?(s=G(e.long0+Math.atan2(t.x,t.y),e.over),t.x=s,t.y=a,t):null):(u=Math.atan2(t.x,t.y),f=Math.sqrt(t.x*t.x+t.y*t.y),GE(e.lat0,e.long0,u,f,e.a,e.f,t),t)}function kE(e){let t={...e,sin_p12:0,cos_p12:0,f:0};return gO(t),t}var my={name:"aeqd",aliases:["Azimuthal_Equidistant"],parameters:ar,create(e){let t=er(e),r=kE(t);return rn(Zo(t,Xe("aeqd",r,zE,VE)),t,Math.PI*179/180,(n,i)=>IS(t,n,i))}};b1();ES();var py={name:"geocent",aliases:["Geocentric","geocentric","Geocent"],parameters:[],create({semiMajorAxis:e,semiMinorAxis:t,eccentricitySquared:r,primeMeridian:n=0}){let i={semiMajorAxis:e,eccentricitySquared:r,semiMinorAxis:t??e*Math.sqrt(1-r)};return{getRenderingProfile:()=>({bounds:[[-e,-e,-i.semiMinorAxis],[e,e,i.semiMinorAxis]],normalize:os({},n)().normalize}),forward(){throw new Error("Geocentric projection requires the 3D pipeline")},inverse(){throw new Error("Geocentric projection requires the 3D pipeline")},forwardInPlace:o=>rm(o,i),inverseInPlace:o=>nm(o,i),forward3D:o=>eE(o,i),inverse3D:o=>rE(o,i)}}};Ht();xa();Ie();Dh();Ae();function qE(e,t,r){let n=Ho(gr(r,e.long0,e.over)),i=e.a/Math.sqrt(1-e.es),o=qn(t(e.long0,r[0][1])[1],t(e.long0,r[1][1])[1]),s=Math.max(Math.abs(e.a*(e.es?e.am1:e.cphi1)+e.y0-o[0]),Math.abs(e.a*(e.es?e.am1:e.cphi1)+e.y0-o[1])),a=Math.min(s,i*n),c=Math.min(2*s,i*n);return re([e.x0-a,e.x0+a],[o[0]-c,o[1]+c])}function jE(e,t,r){let n=Ho(gr(r,e.long0,e.over)),i=e.a/Math.sqrt(1-e.es),o=i*n*n/4,s=qn(t(e.long0,r[0][1])[1],t(e.long0,r[1][1])[1]);return e.sphere&&(r[0][1]-e.lat0<-Math.PI/2||r[1][1]-e.lat0>Math.PI/2)&&(s=[e.y0-e.a*Math.PI/2,e.y0+e.a*Math.PI/2]),re([e.x0-i*n,e.x0+i*n],[s[0]-o,s[1]+o])}function WE(e,t,r){let n=Ho(gr(r,e.long0,e.over));if(e.sphere&&n>Math.PI/2)throw new Error("Unsupported Cassini rendering coverage");let i=e.a/Math.sqrt(1-e.es),o=e.es/(1-e.es),s=e.sphere?e.a*Math.asin(Math.min(1,Math.sin(Math.min(n,Math.PI/2)))):i*(n+n**3/6+(9+8*o)*n**5/120),a=e.sphere?e.a*n:i*(n*n/4+(6+6*o)*n**4/24),c=qn(t(e.long0,r[0][1])[1],t(e.long0,r[1][1])[1]);return re([e.x0-s,e.x0+s],[c[0]-a,c[1]+a])}function gy(e,t){return t[0]<=0&&t[1]>=0?[-1/0,1/0]:Te(e,qn(1/t[0],1/t[1]))}function HE(e,t){let r=l=>{let h=e.alpha*(Math.asinh(Math.tan(l))-e.e*Math.atanh(e.e*Math.sin(l)))+e.K;return Math.asin(Math.tanh(h))},n=K((t[0][0]-e.long0)*e.alpha,r(t[0][1]),(t[1][0]-e.long0)*e.alpha,r(t[1][1])),i=se([-Math.sin(e.b0),0,Math.cos(e.b0)],n);if(Ho(i)>=1-1e-14)throw new Error("Swiss oblique Mercator coverage reaches a rotated pole");let o=se([0,1,0],n),s=se([Math.cos(e.b0),0,Math.sin(e.b0)],n),a=gy(o,s).map(Math.atan),c=i.map(l=>Math.atanh(Math.max(-1+Number.EPSILON,Math.min(1-Number.EPSILON,l))));return re(At([e.x0,e.x0],Ct(a,e.R)),At([e.y0,e.y0],Ct(c,e.R)))}function $E(e,t){let r=m=>Math.log(e.E)-e.B*Math.log(Lr(e.e,m,Math.sin(m))),n=qn(r(t[0][1]),r(t[1][1])),i=Ct([t[0][0]-e.lam0,t[1][0]-e.lam0],e.B),o=K(i[0],Math.asin(Math.tanh(n[0])),i[1],Math.asin(Math.tanh(n[1]))),s=se([0,-e.cosgam,e.singam],o),a=Ct(qn(-Math.atanh(s[0]),-Math.atanh(s[1])),e.ArB),c=At(Ct([Math.sinh(n[0]),Math.sinh(n[1])],e.cosgam),Ct(Ch(i),e.singam)),l=yd(i),h=l[0]>0?gy(c,l).map(Math.atan):[-Math.PI,Math.PI],u=Ct(h,e.ArB),f,d;return e.no_rot?(f=u,d=a):(u=At(u,[-e.u_0,-e.u_0]),f=At(Ct(a,e.cosrot),Ct(u,e.sinrot)),d=At(Ct(u,e.cosrot),Ct(a,-e.sinrot))),re(At([e.x0,e.x0],Ct(f,e.a)),At([e.y0,e.y0],Ct(d,e.a)))}function YE(e,t){let r=d=>2*(Math.atan(e.k*Math.pow(Math.tan(d/2+e.s45),e.alfa)/Math.pow((1+e.e*Math.sin(d))/(1-e.e*Math.sin(d)),e.alfa*e.e/2))-e.s45),n=Ct(gr(t,e.long0,e.over),-e.alfa),i=K(n[0],r(t[0][1]),n[1],r(t[1][1])),o=se([Math.sin(e.ad),0,Math.cos(e.ad)],i),s=[Math.sqrt(Math.max(Number.EPSILON,1-Ho(o)**2)),1],a=se([0,1,0],i),c=gy(a,s),l=Ct(c.map(d=>Math.asin(Math.max(-1,Math.min(1,d)))),e.n),h=d=>e.ro0*Math.pow(Math.tan(e.s0/2+e.s45)/Math.tan(Math.asin(d)/2+e.s45),e.n),u=qn(h(o[0]),h(o[1])),f=e.czech?1:-1;return re(At([e.x0,e.x0],Ct(Te(u,Ch(l)),f)),At([e.y0,e.y0],Ct(Te(u,yd(l)),f)))}function KE(e,t){let r=Ct([t[0][1]-e.lat0,t[1][1]-e.lat0],1e-5/Oh),n=gr(t,e.long0,e.over),i=[0,0];for(let l=10;l>=1;l--)i=At([e.A[l],e.A[l]],Te(i,r));i=Te(i,r);let o=[0,0],s=[0,0];for(let l=6;l>=1;l--){let h=At(Te(o,i),Ct(Te(s,n),-1)),u=At(Te(o,n),Te(s,i));o=At(h,[e.B_re[l],e.B_re[l]]),s=At(u,[e.B_im[l],e.B_im[l]])}let a=At(Te(o,i),Ct(Te(s,n),-1)),c=At(Te(o,n),Te(s,i));return re(At([e.x0,e.x0],Ct(c,e.a)),At([e.y0,e.y0],Ct(a,e.a)))}Ht();ne();wa();wn();Ee();function vt(e){let t=er(e);return{...t,x0:0,y0:0,lat_ts:Number.isNaN(t.lat_ts)?0:t.lat_ts}}function Pe(e,t){return{...e,x0:tt(t.parameters,"x_0",0),y0:tt(t.parameters,"y_0",0)}}function Et(e,t,r,n,i,o){let s=Xe(e,r,n,i),a=tt(t.parameters,"x_0",0),c=tt(t.parameters,"y_0",0);return jn(l=>{o?.(l.x,l.y),s.forwardInPlace(l),l.x+=a,l.y+=c},l=>{l.x-=a,l.y-=c,s.inverseInPlace(l)})}function as(e,t=0,r=!1){return(n,i)=>{let o=Math.sin(e.lat0)*Math.sin(i)+Math.cos(e.lat0)*Math.cos(i)*Math.cos(n-e.long0);if(r?o<t-1e-14:o<=t+1e-14)throw new Error("Coordinate is outside the visible projection horizon")}}fe();Ma();qc();jc();ba();Ae();var Kh=1e-10;function yO(e){var t;if(e.phi1=e.lat1,Math.abs(e.phi1)<Kh)throw new Error;e.es?(e.en=Ni(e.es),e.am1=Math.sin(e.phi1),t=Math.cos(e.phi1),e.m1=rr(e.phi1,e.am1,t,e.en),e.am1=t/(Math.sqrt(1-e.es*e.am1*e.am1)*e.am1)):Math.abs(e.phi1)+Kh>=U?e.cphi1=0:e.cphi1=1/Math.tan(e.phi1)}function wO(e,t){var r=G(t.x-(e.long0||0),e.over),n=t.y,i,o,s;return o=Math.sin(n),s=Math.cos(n),i=e.am1+e.m1-rr(n,o,s,e.en),o=s*r/(i*Math.sqrt(1-e.es*o*o)),t.x=i*Math.sin(o),t.y=e.am1-i*Math.cos(o),t.x=e.a*t.x+(e.x0||0),t.y=e.a*t.y+(e.y0||0),t}function _O(e,t){t.x=(t.x-(e.x0||0))/e.a,t.y=(t.y-(e.y0||0))/e.a;var r,n,i,o;if(t.y=e.am1-t.y,n=qe(t.x,t.y),e.phi1<0&&(n=-n),o=Oi(e.am1+e.m1-n,e.es,e.en),r=Math.abs(o),r<U)r=Math.sin(o),i=n*Math.atan2(Math.sign(e.phi1)*t.x,Math.sign(e.phi1)*t.y)*Math.sqrt(1-e.es*r*r)/Math.cos(o);else if(Math.abs(r-U)<=Kh)i=0;else throw new Error;return t.x=G(i+(e.long0||0),e.over),t.y=uo(o),t}function MO(e,t){var r=G(t.x-(e.long0||0),e.over),n=t.y,i,o;return o=e.cphi1+e.phi1-n,Math.abs(o)>Kh?(i=r*Math.cos(n)/o,t.x=o*Math.sin(i),t.y=e.cphi1-o*Math.cos(i)):t.x=t.y=0,t.x=e.a*t.x+(e.x0||0),t.y=e.a*t.y+(e.y0||0),t}function bO(e,t){t.x=(t.x-(e.x0||0))/e.a,t.y=(t.y-(e.y0||0))/e.a;var r,n;t.y=e.cphi1-t.y;var i=qe(t.x,t.y);if(e.phi1<0&&(i=-i),n=e.cphi1+e.phi1-i,Math.abs(n)>U)throw new Error;return Math.abs(Math.abs(n)-U)<=Kh?r=0:r=i*Math.atan2(Math.sign(e.phi1)*t.x,Math.sign(e.phi1)*t.y)/Math.cos(n),t.x=G(r+(e.long0||0),e.over),t.y=uo(n),t}function XE(e,t){return e.es?wO(e,t):MO(e,t)}function ZE(e,t){return e.es?_O(e,t):bO(e,t)}function JE(e,t={}){let r={...e,phi1:0,en:[],m1:0,am1:0,cphi1:0,...t};return yO(r),r}var yy={name:"bonne",aliases:["Bonne (Werner lat_1=90)"],parameters:["lon_0","x_0","y_0","lat_1"],create(e){let t=vt(e);if(!Object.prototype.hasOwnProperty.call(e.parameters,"lat_1")||Math.abs(t.lat1)<1e-10)throw new Error("Bonne requires a nonzero lat_1");let r=JE(t),n=Et("bonne",e,r,XE,ZE);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>qE(Pe(r,e),n.forward,i),t.primeMeridian,t.over)}};Ht();ne();qc();ba();jc();function tl(e,t,r){var n=t*r;return e/Math.sqrt(1-n*n)}fe();Ae();function xO(e){e.sphere||(e.en=Ni(e.es),e.ml0=e.a*rr(e.lat0,Math.sin(e.lat0),Math.cos(e.lat0),e.en))}function _y(e,t){var r,n,i=t.x,o=t.y;if(i=G(i-e.long0,e.over),e.sphere)r=e.a*Math.asin(Math.cos(o)*Math.sin(i)),n=e.a*(Math.atan2(Math.tan(o),Math.cos(i))-e.lat0);else{var s=Math.sin(o),a=Math.cos(o),c=tl(e.a,e.e,s),l=Math.tan(o)*Math.tan(o),h=i*Math.cos(o),u=h*h,f=e.es*a*a/(1-e.es),d=e.a*rr(o,s,a,e.en);r=c*h*(1-u*l*(1/6+(8-l+8*f)*u/120)),n=d-e.ml0+c*s/a*u*(.5+(5-l+6*f)*u/24)}return t.x=r+e.x0,t.y=n+e.y0,t}function QE(e,t){t.x-=e.x0,t.y-=e.y0;var r=t.x/e.a,n=t.y/e.a,i,o;if(e.sphere){var s=n+e.lat0;i=Math.asin(Math.sin(s)*Math.cos(r)),o=Math.atan2(Math.tan(r),Math.cos(s))}else{var a=e.ml0/e.a+n,c=Oi(a,e.es,e.en);if(Math.abs(Math.abs(c)-U)<=1e-10)return t.x=e.long0,t.y=Math.sign(c)*U,t;var l=tl(e.a,e.e,Math.sin(c)),h=l*l*l/e.a/e.a*(1-e.es),u=Math.pow(Math.tan(c),2),f=r*e.a/l,d=f*f;i=c-l*Math.tan(c)/h*f*f*(.5-(1+3*u)*f*f/24),o=f*(1-d*(u/3-(1+3*u)*u*d/15))/Math.cos(c)}if(!e.sphere){let m=t.x+e.x0,p=t.y+e.y0,g=e.scratch,y=!1;for(let _=0;_<12;_++){wy(e,o,i);let M=g.x-m,b=g.y-p;if(Math.max(Math.abs(M),Math.abs(b))<1e-7){y=!0;break}let v=1e-7,T=i>U-v?-v:v,S=g.x,E=g.y;wy(e,o+v,i);let N=(g.x-S)/v,B=(g.y-E)/v;wy(e,o,i+T);let C=(g.x-S)/T,R=(g.y-E)/T,W=N*R-C*B;if(!Number.isFinite(W)||Math.abs(W)<1e-12||(o-=(R*M-C*b)/W,i-=(N*b-B*M)/W,!Number.isFinite(o)||Math.abs(i)>U))break}if(!y)throw new Error("Cassini inverse did not converge")}return t.x=G(o+e.long0,e.over),t.y=uo(i),t}function wy(e,t,r){e.scratch.x=t+e.long0,e.scratch.y=r,_y(e,e.scratch)}function tT(e,t={}){let r={...e,en:[],scratch:{x:0,y:0},ml0:0,...t};return xO(r),r}var My={name:"cass",aliases:["Cassini","Cassini_Soldner"],parameters:["lon_0","x_0","y_0","lat_0"],create(e){let t=vt(e),r=tT(t),n=Et("cass",e,r,_y,QE);return Pt(n,K(t.long0-Math.PI/6,-Math.PI/2+1e-8,t.long0+Math.PI/6,Math.PI/2-1e-8),i=>WE(Pe(t,e),n.forward,i),t.primeMeridian,t.over)}};Ie();Ht();ne();fe();Wc();function SO(e){e.sphere||(e.k0=nn(e.e,Math.sin(e.lat_ts),Math.cos(e.lat_ts)))}function eT(e,t){var r=t.x,n=t.y,i,o,s=G(r-e.long0,e.over);if(e.sphere)i=e.x0+e.a*s*Math.cos(e.lat_ts),o=e.y0+e.a*Math.sin(n)/Math.cos(e.lat_ts);else{var a=Fr(e.e,Math.sin(n));i=e.x0+e.a*e.k0*s,o=e.y0+e.a*a*.5/e.k0}return t.x=i,t.y=o,t}function rT(e,t){t.x-=e.x0,t.y-=e.y0;var r,n;return e.sphere?(r=G(e.long0+t.x/e.a/Math.cos(e.lat_ts),e.over),n=Math.asin(t.y/e.a*Math.cos(e.lat_ts))):(n=lm(e.e,2*t.y*e.k0/e.a),r=G(e.long0+t.x/(e.a*e.k0),e.over)),t.x=r,t.y=n,t}function nT(e,t={}){let r={...e,...t};return SO(r),r}var by={name:"cea",aliases:[],parameters:["lon_0","x_0","y_0","lat_ts"],create(e){let t=vt(e);if(Math.abs(t.lat_ts)>=Math.PI/2)throw new Error("CEA standard parallel must be away from the poles");let r=nT(t),n=Et("cea",e,r,eT,rT);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>yr(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};Ie();Ht();ne();fe();qc();ba();jc();Ae();function Aa(e){return Math.abs(e)>1&&(e=e>1?1:-1),Math.asin(e)}var vO=20;function EO(e){e.long0=e.long0||0,e.sphere?(e.n=1,e.m=0,e.es=0,e.C_y=Math.sqrt((e.m+1)/e.n),e.C_x=e.C_y/(e.m+1)):e.en=Ni(e.es)}function fm(e,t){var r,n,i=t.x,o=t.y;if(i=G(i-e.long0,e.over),e.sphere){if(!e.m)o=e.n!==1?Math.asin(e.n*Math.sin(o)):o;else for(var s=e.n*Math.sin(o),a=vO;a;--a){var c=(e.m*o+Math.sin(o)-s)/(e.m+Math.cos(o));if(o-=c,Math.abs(c)<1e-10)break}r=e.a*e.C_x*i*(e.m+Math.cos(o)),n=e.a*e.C_y*o}else{var l=Math.sin(o),h=Math.cos(o);n=e.a*rr(o,l,h,e.en),r=e.a*i*h/Math.sqrt(1-e.es*l*l)}return t.x=r,t.y=n,t}function dm(e,t){var r,n,i,o;if(t.x-=e.x0,i=t.x/e.a,t.y-=e.y0,r=t.y/e.a,e.sphere){if(r/=e.C_y,i=i/(e.C_x*(e.m+Math.cos(r))),e.m){let s=(e.m*r+Math.sin(r))/e.n;if(Math.abs(s)>1+8*Number.EPSILON)return null;r=Aa(s)}else e.n!==1&&(r=Aa(Math.sin(r)/e.n));i=G(i+e.long0,e.over),r=uo(r)}else r=Oi(t.y/e.a,e.es,e.en),o=Math.abs(r),o<U?(o=Math.sin(r),n=e.long0+t.x*Math.sqrt(1-e.es*o*o)/(e.a*Math.cos(r)),i=G(n,e.over)):o-1e-10<U&&(i=e.long0);return t.x=i,t.y=r,t}function iT(e,t={}){let r={...e,en:[],n:0,m:0,C_y:0,C_x:0,...t};return EO(r),r}function TO(e){e.sphere=!0,e.b=e.a,e.m=1,e.n=2.5707963267948966,e.es=0,e.C_y=Math.sqrt((e.m+1)/e.n),e.C_x=e.C_y/(e.m+1)}var oT=fm,sT=dm;function aT(e,t={}){let r={...e,m:0,n:0,C_y:0,C_x:0,en:[],...t};return TO(r),r}var xy={name:"eck6",aliases:["Eckert_VI"],parameters:["lon_0","x_0","y_0"],create(e){let t=vt(e),r=aT(t),n=Et("eck6",e,r,oT,sT);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>yr(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};Ee();fe();var IO=.3333333333333333,AO=.17222222222222222,PO=.10257936507936508,RO=.06388888888888888,CO=.0664021164021164,NO=.016415012942191543;function Sy(e){var t,r=[];return r[0]=e*IO,t=e*e,r[0]+=t*AO,r[1]=t*RO,t*=e,r[0]+=t*PO,r[1]+=t*CO,r[2]=t*NO,r}function vy(e,t){var r=e+e;return e+t[0]*Math.sin(r)+t[1]*Math.sin(r+r)+t[2]*Math.sin(r+r+r)}var el=1.340264,rl=-.081106,nl=893e-6,il=.003796,mm=Math.sqrt(3)/2;function OO(e){e.long0=e.long0!==void 0?e.long0:0,e.x0=e.x0!==void 0?e.x0:0,e.y0=e.y0!==void 0?e.y0:0,e.es!==0&&(e.apa=Sy(e.es),e.qp=Fr(e.e,1),e.rqda=Math.sqrt(.5*e.qp))}function cT(e,t){var r=G(t.x-e.long0,e.over),n=t.y,i=Math.sin(n);e.es!==0&&(i=Fr(e.e,i)/e.qp);var o=Math.asin(mm*i),s=o*o,a=s*s*s;return t.x=r*Math.cos(o)/(mm*(el+3*rl*s+a*(7*nl+9*il*s))),t.y=o*(el+rl*s+a*(nl+il*s)),e.es!==0&&(t.x*=e.rqda,t.y*=e.rqda),t.x=e.a*t.x+e.x0,t.y=e.a*t.y+e.y0,t}function lT(e,t){t.x=(t.x-e.x0)/e.a,t.y=(t.y-e.y0)/e.a,e.es!==0&&(t.x/=e.rqda,t.y/=e.rqda);let r=Math.PI/3,n=r*r,i=r*(el+rl*n+n**3*(nl+il*n));if(Math.abs(t.y)>i+8*Number.EPSILON*i)return null;var o=1e-9,s=12,a=t.y,c,l,h,u,f,d;for(d=0;d<s&&(c=a*a,l=c*c*c,h=a*(el+rl*c+l*(nl+il*c))-t.y,u=el+3*rl*c+l*(7*nl+9*il*c),a-=f=h/u,!(Math.abs(f)<o));++d);c=a*a,l=c*c*c,t.x=mm*t.x*(el+3*rl*c+l*(7*nl+9*il*c))/Math.cos(a);let m=Math.sin(a)/mm,p=8*Number.EPSILON;return Math.abs(m)>1+p?null:(t.y=Math.abs(m)>=1-p?Math.sign(m)*Math.PI/2:Math.asin(m),e.es!==0&&(t.y=vy(t.y,e.apa)),t.x=G(t.x+e.long0,e.over),t)}function hT(e,t={}){let r={...e,apa:[],qp:0,rqda:0,...t};return OO(r),r}Ht();ne();Ie();var Ey={name:"eqearth",aliases:["Equal Earth","Equal_Earth"],parameters:["lon_0","x_0","y_0"],create(e){let t=vt(e),r=e.primeMeridian??0,n=hT(t),i=Et("eqearth",e,n,cT,lT),o=Math.sqrt(e.eccentricitySquared),s=e.semiMajorAxis*(o?Math.sqrt((1+(1-o*o)*Math.atanh(o)/o)/2):1),a=Math.PI/3,c=a*a,l=c**3,h=s*Math.PI/(Math.sqrt(3)/2*1.340264),u=tt(e.parameters,"x_0",0),f=tt(e.parameters,"y_0",0),d=s*a*(1.340264-.081106*c+l*(893e-6+.003796*c));return{...i,longitudeOrigin:t.long0,getRenderingProfile(m){if(m)return Ke(g=>yr(i.forward,g,t.long0,t.over),m,t.long0,r,t.over);let p=[[u-h,f-d,0],[u+h,f+d,0]];return{bounds:p,normalize:Ke(()=>p,yn(K(t.long0-Math.PI,-(Math.PI/2),t.long0+Math.PI,Math.PI/2),r),t.long0,r,t.over).normalize}}}}};Ie();Ht();ne();fe();function BO(e){e.x0=e.x0||0,e.y0=e.y0||0,e.lat0=e.lat0||0,e.long0=e.long0||0}function uT(e,t){var r=t.x,n=t.y,i=G(r-e.long0,e.over),o=e.x0+e.a*i*Math.cos(e.lat0),s=e.y0+e.a*n;return e.t1=o,e.t2=Math.cos(e.lat0),t.x=o,t.y=s,t}function fT(e,t){t.x-=e.x0,t.y-=e.y0;var r=t.y/e.a;Math.abs(r)>Math.PI/2&&Math.abs(r)<=Math.PI/2+8*Number.EPSILON&&(r=Math.sign(r)*Math.PI/2);var n=G(e.long0+t.x/(e.a*Math.cos(e.lat0)),e.over);return t.x=n,t.y=r,t}function dT(e,t={}){let r={...e,t2:0,t1:0,...t};return BO(r),r}var Ty={name:"equi",aliases:[],parameters:["lon_0","x_0","y_0","lat_0"],create(e){let t=vt(e);if(Math.abs(t.lat0)>=Math.PI/2)throw new Error("Equirectangular standard parallel must be away from the poles");let r=dT(t),n=Et("equi",e,r,uT,fT);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>yr(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};Ht();ya();ne();Ee();xa();Ie();function mT(e,t,r=!1){let n=1+t/e.a,i=n/(1+1e-10),o=u=>Math.acos(Math.min(1,Math.sqrt(1-e.es*Math.sin(u)**2)/(i*Math.cos(u)))),s=u=>{let f=(i*Math.cos(u))**2;return Math.asin(Math.sqrt(Math.max(0,(f-1)/(f-e.es))))},a=t*Math.asin(1/n),c=t*Math.atan(Math.sqrt((1-e.es)/(n*n-1))),l=(u,f)=>{let d=Math.max(u[0][1],Math.min(u[1][1],0)),m=o(d),p=Math.max(u[0][0]-e.long0,-m),g=Math.min(u[1][0]-e.long0,m),y=s(Math.max(p,Math.min(g,0))),_=Math.max(u[0][1],-y),M=Math.min(u[1][1],y);if(g<p||M<_)return null;let b=K(p,_,g,M),v=yn(K(p+e.long0,_,g+e.long0,M),e.primeMeridian),T=(e.long0+e.primeMeridian)*180/Math.PI,S=Yo(E=>{let N=Math.max(p,Math.min(g,ve(E.x-e.long0))),B=s(N),C=Math.max(Math.max(_,-B),Math.min(Math.min(M,B),E.y));N!==E.x-e.long0&&(E.x=N+e.long0),E.y=C},e.primeMeridian);return{get bounds(){if(!f)return re([e.x0-a,e.x0+a],[e.y0-c,e.y0+c]);let E=se([0,0,1],b),N=[1,1/Math.sqrt(1-e.es*Math.max(E[0]**2,E[1]**2))],B=Te(se([1,0,0],b),N),C=Te(se([0,1,0],b),N),R=Te(E,[1-e.es,(1-e.es)*N[1]]),W=[n-Math.min(1,B[1]),n-Math.max(1/n,B[0])],j=(A,P,D,F)=>{let L=P[0]<=0&&P[1]>=0?0:Math.min(Math.abs(P[0]),Math.abs(P[1])),O=F?[Math.hypot(W[0],L),Math.hypot(W[1],Math.max(Math.abs(P[0]),Math.abs(P[1])))]:W,V=A.flatMap(yt=>O.map(Dt=>t*Math.atan(yt/Dt)));return[Math.max(-D,Math.min(...V)),Math.min(D,Math.max(...V))]};return re(At([e.x0,e.x0],j(C,R,a,r)),At([e.y0,e.y0],j(R,C,c,!r)))},normalize(E){Md(E,v,T),S(E)}}},h=yn(K(e.long0-o(0),-s(0),e.long0+o(0),s(0)),e.primeMeridian);return u=>{let f=u?wd(u,h):[h],d=_d(f,m=>l($o(m,e.primeMeridian,e.long0),!!u));if(!d)throw new Error("CRS coverage does not intersect the satellite limb");return d}}Ma();function LO(e){if(e.flip_axis=e.sweep==="x"?1:0,e.h=Number(e.h),e.radius_g_1=e.h/e.a,e.radius_g_1<=0||e.radius_g_1>1e10)throw new Error;if(e.radius_g=1+e.radius_g_1,e.C=e.radius_g*e.radius_g-1,e.es!==0){var t=1-e.es,r=1/t;e.radius_p=Math.sqrt(t),e.radius_p2=t,e.radius_p_inv2=r,e.shape="ellipse"}else e.radius_p=1,e.radius_p2=1,e.radius_p_inv2=1,e.shape="sphere"}function pT(e,t){var r=t.x,n=t.y,i,o,s,a;if(r=r-e.long0,e.shape==="ellipse"){n=Math.atan(e.radius_p2*Math.tan(n));var c=e.radius_p/qe(e.radius_p*Math.cos(n),Math.sin(n));if(o=c*Math.cos(r)*Math.cos(n),s=c*Math.sin(r)*Math.cos(n),a=c*Math.sin(n),(e.radius_g-o)*o-s*s-a*a*e.radius_p_inv2<0)return t.x=Number.NaN,t.y=Number.NaN,t;i=e.radius_g-o,e.flip_axis?(t.x=e.radius_g_1*Math.atan(s/qe(a,i)),t.y=e.radius_g_1*Math.atan(a/i)):(t.x=e.radius_g_1*Math.atan(s/i),t.y=e.radius_g_1*Math.atan(a/qe(s,i)))}else e.shape==="sphere"&&(i=Math.cos(n),o=Math.cos(r)*i,s=Math.sin(r)*i,a=Math.sin(n),i=e.radius_g-o,e.flip_axis?(t.x=e.radius_g_1*Math.atan(s/qe(a,i)),t.y=e.radius_g_1*Math.atan(a/i)):(t.x=e.radius_g_1*Math.atan(s/i),t.y=e.radius_g_1*Math.atan(a/qe(s,i))));return t.x=t.x*e.a,t.y=t.y*e.a,t}function gT(e,t){var r=-1,n=0,i=0,o,s,a,c;if(t.x=t.x/e.a,t.y=t.y/e.a,e.shape==="ellipse"){e.flip_axis?(i=Math.tan(t.y/e.radius_g_1),n=Math.tan(t.x/e.radius_g_1)*qe(1,i)):(n=Math.tan(t.x/e.radius_g_1),i=Math.tan(t.y/e.radius_g_1)*qe(1,n));var l=i/e.radius_p;if(o=n*n+l*l+r*r,s=2*e.radius_g*r,a=s*s-4*o*e.C,a<0)return t.x=Number.NaN,t.y=Number.NaN,t;c=(-s-Math.sqrt(a))/(2*o),r=e.radius_g+c*r,n*=c,i*=c,t.x=Math.atan2(n,r),t.y=Math.atan(i*Math.cos(t.x)/r),t.y=Math.atan(e.radius_p_inv2*Math.tan(t.y))}else if(e.shape==="sphere"){if(e.flip_axis?(i=Math.tan(t.y/e.radius_g_1),n=Math.tan(t.x/e.radius_g_1)*Math.sqrt(1+i*i)):(n=Math.tan(t.x/e.radius_g_1),i=Math.tan(t.y/e.radius_g_1)*Math.sqrt(1+n*n)),o=n*n+i*i+r*r,s=2*e.radius_g*r,a=s*s-4*o*e.C,a<0)return t.x=Number.NaN,t.y=Number.NaN,t;c=(-s-Math.sqrt(a))/(2*o),r=e.radius_g+c*r,n*=c,i*=c,t.x=Math.atan2(n,r),t.y=Math.atan(i*Math.cos(t.x)/r)}return t.x=t.x+e.long0,t}function yT(e,t={}){let r={...e,flip_axis:0,sweep:"",h:0,radius_g_1:0,radius_g:0,C:0,radius_p:0,radius_p2:0,radius_p_inv2:0,shape:"",...t};return LO(r),r}Ee();var Iy={name:"geos",aliases:["Geostationary Satellite View","Geostationary_Satellite"],parameters:["lon_0","x_0","y_0","h","sweep"],create(e){let t=vt(e),r=tt(e.parameters,"h",NaN);if(!Number.isFinite(r)||r<=0)throw new Error("Geostationary projection requires positive h");let n=e.parameters.sweep||"y";if(!["x","y"].includes(n))throw new Error("Geostationary sweep must be x or y");let i=yT(t,{h:r,sweep:n});return{...Et("geos",e,i,pT,gT,t.sphere?as({...t,lat0:0},1/(1+r/t.a),!0):void 0),longitudeOrigin:t.long0,getRenderingProfile:mT(Pe(t,e),r,n==="x")}}};rs();ns();Lx();fe();var Pa=180/Math.PI;function wT(e){return{engine:Bx({semiMajorAxis:1,semiMinorAxis:Math.sqrt(1-e.es)}),latitude:e.lat0*Pa}}function _T(e,t,r){let n=t.engine.Inverse(t.latitude,0,r.y*Pa,G(r.x-e.long0,e.over)*Pa,Ih);if(!(n.M12>0))throw new Error("Coordinate is outside the ellipsoidal gnomonic horizon");let i=e.a*n.m12/n.M12,o=n.azi1/Pa;return r.x=e.x0+i*Math.sin(o),r.y=e.y0+i*Math.cos(o),r}function MT(e,t,r){let n=(r.x-e.x0)/e.a,i=(r.y-e.y0)/e.a,o=Math.hypot(n,i);if(o===0)return r.x=e.long0,r.y=e.lat0,r;let s=t.engine.Line(t.latitude,0,Math.atan2(n,i)*Pa,Ih),a=o<=1,c=a?o:1/o,l=Math.atan(o);for(let h=0;h<20;h++){let u=s.Position(l,Ih),f=a?(u.m12-c*u.M12)*u.M12:(c*u.m12-u.M12)*u.m12;if(!Number.isFinite(f))break;if(l-=f,Math.abs(f)<1e-14){let d=s.Position(l,Ih);if(!(d.M12>0))break;return r.x=G(e.long0+d.lon2/Pa,e.over),r.y=d.lat2/Pa,r}}throw new Error("Ellipsoidal gnomonic inverse did not converge")}fe();function DO(e){e.sphere||(e.ellipsoid=wT(e)),e.sin_p14=Math.sin(e.lat0),e.cos_p14=Math.cos(e.lat0),e.infinity_dist=1e3*e.a,e.rc=1}function bT(e,t){if(e.ellipsoid)return _T(e,e.ellipsoid,t);var r,n,i,o,s,a,c,l,h=t.x,u=t.y;return i=G(h-e.long0,e.over),r=Math.sin(u),n=Math.cos(u),o=Math.cos(i),a=e.sin_p14*r+e.cos_p14*n*o,s=1,a>0||Math.abs(a)<=1e-10?(c=e.x0+e.a*s*n*Math.sin(i)/a,l=e.y0+e.a*s*(e.cos_p14*r-e.sin_p14*n*o)/a):(c=e.x0+e.infinity_dist*n*Math.sin(i),l=e.y0+e.infinity_dist*(e.cos_p14*r-e.sin_p14*n*o)),t.x=c,t.y=l,t}function xT(e,t){if(e.ellipsoid)return MT(e,e.ellipsoid,t);var r,n,i,o,s,a;return t.x=(t.x-e.x0)/e.a,t.y=(t.y-e.y0)/e.a,t.x/=e.k0,t.y/=e.k0,r=Math.sqrt(t.x*t.x+t.y*t.y),r?(o=Math.atan2(r,e.rc),n=Math.sin(o),i=Math.cos(o),a=Aa(i*e.sin_p14+t.y*n*e.cos_p14/r),s=Math.atan2(t.x*n,r*e.cos_p14*i-t.y*e.sin_p14*n),s=G(e.long0+s,e.over)):(a=e.lat0,s=e.long0),t.x=s,t.y=a,t}function ST(e,t={}){let r={...e,sin_p14:0,cos_p14:0,infinity_dist:0,rc:0,phic0:0,...t};return DO(r),r}var Ay={name:"gnom",aliases:[],parameters:["lon_0","x_0","y_0","lat_0"],create(e){let t=vt(e),r=ST(t);return rn(Et("gnom",e,r,bT,xT,t.sphere?as(t):void 0),t,Math.min(Math.PI*80/180,(1-t.es)*Math.PI*.45),(n,i)=>t.sphere?Td(Pe(t,e),n,i,"gnom"):RS(Pe(t,e),n,i),(1-t.es)*Math.PI/2)}};Ie();Ae();function Py(e,t){return 2*Math.atan(e*Math.exp(t))-U}function pm(e,t){var r=Py(1,t),n=0,i=0;let o=0;do{if(++o>50)throw new Error("Isometric latitude inverse did not converge");n=r,i=e*Math.sin(n),r=Py(Math.exp(e*Math.log((1+i)/(1-i))/2),t)}while(Math.abs(r-n)>1e-12);return r}Ht();ne();Ae();function ol(e,t,r){if(Math.abs(t)>U)return Number.NaN;if(t===U)return Number.POSITIVE_INFINITY;if(t===-1*U)return Number.NEGATIVE_INFINITY;var n=e*r;return Math.log(Math.tan((U+t)/2))+e*Math.log((1-n)/(1+n))/2}xd();p1();function FO(e){e.k0||(e.k0=1);var t=e.b/e.a;e.e=Math.sqrt(1-t*t),e.lc=e.long0,e.rs=Math.sqrt(1+e.e*e.e*Math.pow(Math.cos(e.lat0),4)/(1-e.e*e.e));var r=Math.sin(e.lat0),n=Math.asin(r/e.rs),i=Math.sin(n);e.cp=ol(0,n,i)-e.rs*ol(e.e,e.lat0,r),e.n2=e.k0*e.a*Math.sqrt(1-e.e*e.e)/(1-e.e*e.e*r*r),e.xs=e.x0,e.ys=e.y0-e.n2*n}function vT(e,t){var r=t.x,n=t.y,i=e.rs*(r-e.lc),o=e.cp+e.rs*ol(e.e,n,Math.sin(n)),s=Math.asin(Math.sin(i)/Nh(o)),a=ol(0,s,Math.sin(s));return t.x=e.xs+e.n2*a,t.y=e.ys+e.n2*Math.atan(_a(o)/Math.cos(i)),t}function ET(e,t){var r=t.x,n=t.y,i=Math.atan(_a((r-e.xs)/e.n2)/Math.cos((n-e.ys)/e.n2)),o=Math.asin(Math.sin((n-e.ys)/e.n2)/Nh((r-e.xs)/e.n2)),s=ol(0,o,Math.sin(o));return t.x=e.lc+i/e.rs,t.y=pm(e.e,(s-e.cp)/e.rs),t}function TT(e,t={}){let r={...e,lc:0,rs:0,cp:0,n2:0,xs:0,ys:0,...t};return FO(r),r}var Ry={name:"gstmerc",aliases:["gstmerg"],parameters:["lon_0","x_0","y_0","lat_0","k","k_0"],create(e){let t=vt(e),r=TT(t),n=Et("gstmerc",e,r,vT,ET);return Pt(n,K(t.long0-Math.PI/6,-Math.PI/3,t.long0+Math.PI/6,Math.PI/3),i=>Gc(n.forward,i,t.long0,t.over,pm(r.e,-r.cp/r.rs)),t.primeMeridian,t.over)}};Ht();ne();fe();function UO(e){e.a=6377397155e-3,e.es=.006674372230614,e.e=Math.sqrt(e.es),e.s45=Math.PI/4,e.s90=2*e.s45,e.fi0=e.lat0,e.e2=e.es,e.e=Math.sqrt(e.e2),e.alfa=Math.sqrt(1+e.e2*Math.pow(Math.cos(e.fi0),4)/(1-e.e2)),e.uq=1.04216856380474,e.u0=Math.asin(Math.sin(e.fi0)/e.alfa),e.g=Math.pow((1+e.e*Math.sin(e.fi0))/(1-e.e*Math.sin(e.fi0)),e.alfa*e.e/2),e.k=Math.tan(e.u0/2+e.s45)/Math.pow(Math.tan(e.fi0/2+e.s45),e.alfa)*e.g,e.k1=e.k0,e.n0=e.a*Math.sqrt(1-e.e2)/(1-e.e2*Math.pow(Math.sin(e.fi0),2)),e.s0=1.37008346281555,e.n=Math.sin(e.s0),e.ro0=e.k1*e.n0/Math.tan(e.s0),e.ad=e.s90-e.uq}function IT(e,t){var r,n,i,o,s,a,c,l=t.x,h=t.y,u=G(l-e.long0,e.over);return r=Math.pow((1+e.e*Math.sin(h))/(1-e.e*Math.sin(h)),e.alfa*e.e/2),n=2*(Math.atan(e.k*Math.pow(Math.tan(h/2+e.s45),e.alfa)/r)-e.s45),i=-u*e.alfa,o=Math.asin(Math.cos(e.ad)*Math.sin(n)+Math.sin(e.ad)*Math.cos(n)*Math.cos(i)),s=Math.asin(Math.cos(n)*Math.sin(i)/Math.cos(o)),a=e.n*s,c=e.ro0*Math.pow(Math.tan(e.s0/2+e.s45),e.n)/Math.pow(Math.tan(o/2+e.s45),e.n),t.y=c*Math.cos(a)/1,t.x=c*Math.sin(a)/1,e.czech||(t.y*=-1,t.x*=-1),t}function AT(e,t){var r,n,i,o,s,a,c,l,h=t.x;t.x=t.y,t.y=h,e.czech||(t.y*=-1,t.x*=-1),a=Math.sqrt(t.x*t.x+t.y*t.y),s=Math.atan2(t.y,t.x),o=s/Math.sin(e.s0),i=2*(Math.atan(Math.pow(e.ro0/a,1/e.n)*Math.tan(e.s0/2+e.s45))-e.s45),r=Math.asin(Math.cos(e.ad)*Math.sin(i)-Math.sin(e.ad)*Math.cos(i)*Math.cos(o)),n=Math.asin(Math.cos(i)*Math.sin(o)/Math.cos(r)),t.x=e.long0-n/e.alfa,c=r,l=0;var u=0;do t.y=2*(Math.atan(Math.pow(e.k,-1/e.alfa)*Math.pow(Math.tan(r/2+e.s45),1/e.alfa)*Math.pow((1+e.e*Math.sin(c))/(1-e.e*Math.sin(c)),e.e/2))-e.s45),Math.abs(c-t.y)<1e-10&&(l=1),c=t.y,u+=1;while(l===0&&u<15);return u>=15?null:t}function PT(e,t={}){let r={...e,s45:0,s90:0,fi0:0,e2:0,alfa:0,uq:0,u0:0,g:0,k:0,k1:0,n0:0,s0:0,n:0,ro0:0,ad:0,czech:!1,...t};return UO(r),r}Ee();wn();var Cy={name:"krovak",aliases:["Krovak","Krovak Modified","Krovak (North Orientated)","Krovak Modified (North Orientated)"],parameters:["lon_0","x_0","y_0","lat_0","k","k_0","czech","alpha","lat_ts"],flags:["czech"],create(e){let t=tt(e.parameters,"alpha",30.28813972222222),r=tt(e.parameters,"lat_ts",78.5);if(![30.28813972222222,30.28813975277778].some(s=>Math.abs(t-s)<=1e-10))throw new Error("Krovak requires its fixed cone-axis co-latitude");if(Math.abs(r-78.5)>1e-10)throw new Error("Krovak requires its fixed 78.5 degree pseudo standard parallel");let n=vt(e);n.lat0=Xo(e.parameters,"lat_0",49.5),n.long0=Xo(e.parameters,"lon_0",24.83333333333333),n.k0=tt(e.parameters,"k_0",tt(e.parameters,"k",.9999));let i=PT(n,{czech:si(e.parameters,"czech")}),o=Et("krovak",e,i,IT,AT);return Pt(o,K(n.long0-Math.PI/12,Math.max(-Math.PI/2+1e-8,n.lat0-Math.PI/36),n.long0+Math.PI/12,Math.min(Math.PI/2-1e-8,n.lat0+Math.PI/36)),s=>YE(Pe(i,e),s),n.primeMeridian,n.over)}};Ie();Ht();ne();fe();function RT(e,t){var r=t.x,n=t.y,i=G(r-e.long0,e.over),o=e.x0+e.a*i,s=e.y0+e.a*Math.log(Math.tan(Math.PI/4+n/2.5))*1.25;return t.x=o,t.y=s,t}function CT(e,t){t.x-=e.x0,t.y-=e.y0;var r=G(e.long0+t.x/e.a,e.over),n=2.5*(Math.atan(Math.exp(.8*t.y/e.a))-Math.PI/4);return t.x=r,t.y=n,t}function NT(e,t={}){let r={...e,...t};return r}var Ny={name:"mill",aliases:["Miller_Cylindrical"],parameters:["lon_0","x_0","y_0"],create(e){let t=vt(e),r=NT(t),n=Et("mill",e,r,RT,CT);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>yr(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};Ie();Ht();ne();fe();function GO(e){e.x0=e.x0!==void 0?e.x0:0,e.y0=e.y0!==void 0?e.y0:0,e.long0=e.long0!==void 0?e.long0:0}function OT(e,t){var r=t.x,n=t.y,i=G(r-e.long0,e.over);let o=Math.sin(Math.abs(n)),s=Math.cos(n),a=Math.abs(n)===Math.PI/2?0:Math.PI*s*s/(1+o),c=Math.cbrt(6*a),l=0,h=Math.PI;c=Math.min(c,h);for(let d=0;d<32&&c>0;d++){let m=DT(c)-a,p=m/(2*Math.sin(c/2)**2);if(Math.abs(p)<=16*Number.EPSILON*c)break;m>0?h=c:l=c;let g=c-p;if(g===c||h-l<=8*Number.EPSILON*Math.max(1,c))break;if(c=g>=l&&g<=h?g:(l+h)/2,d===31)throw new Error("Mollweide forward did not converge")}var u=2*Math.SQRT2/Math.PI*e.a*i*Math.sin(c/2)+e.x0,f=Math.sign(n)*Math.SQRT2*e.a*Math.cos(c/2)+e.y0;return t.x=u,t.y=f,t}function BT(e,t){let r=t.x-e.x0,n=(t.y-e.y0)/(Math.SQRT2*e.a);if(Math.abs(n)>1+8*Number.EPSILON)return null;let i=r/(2*Math.SQRT2*e.a),o=i*i+n*n;if(!e.over&&o>1+8*Number.EPSILON)return null;let s=2*Math.acos(Math.min(1,Math.abs(n))),a=Math.sin(s/2);if(!e.over&&Math.abs(o-1)<=8*Number.EPSILON&&(a=Math.min(1,Math.abs(i)),s=2*Math.asin(a)),a===0&&Math.abs(r)>8*Number.EPSILON*e.a)return null;let c=a===0?0:Math.PI*i/a;var l=G(e.long0+c,e.over),h=Math.sign(n)*(Math.PI/2-2*Math.asin(Math.sqrt(DT(s)/(2*Math.PI))));return t.x=l,t.y=h,t}function LT(e,t={}){let r={...e,...t};return GO(r),r}function DT(e){if(e>.5)return e-Math.sin(e);let t=e*e;return e*t*(1/6+t*(-1/120+t*(1/5040+t*(-1/362880+t*(1/39916800+t*(-1/6227020800+t/1307674368e3))))))}var Oy={name:"moll",aliases:["Mollweide"],parameters:["lon_0","x_0","y_0"],create(e){let t=vt(e),r=LT(t),n=Et("moll",e,r,OT,BT);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>yr(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};Ht();ne();Ae();function zO(e){e.A=[],e.A[1]=.6399175073,e.A[2]=-.1358797613,e.A[3]=.063294409,e.A[4]=-.02526853,e.A[5]=.0117879,e.A[6]=-.0055161,e.A[7]=.0026906,e.A[8]=-.001333,e.A[9]=67e-5,e.A[10]=-34e-5,e.B_re=[],e.B_im=[],e.B_re[1]=.7557853228,e.B_im[1]=0,e.B_re[2]=.249204646,e.B_im[2]=.003371507,e.B_re[3]=-.001541739,e.B_im[3]=.04105856,e.B_re[4]=-.10162907,e.B_im[4]=.01727609,e.B_re[5]=-.26623489,e.B_im[5]=-.36249218,e.B_re[6]=-.6870983,e.B_im[6]=-1.1651967,e.C_re=[],e.C_im=[],e.C_re[1]=1.3231270439,e.C_im[1]=0,e.C_re[2]=-.577245789,e.C_im[2]=-.007809598,e.C_re[3]=.508307513,e.C_im[3]=-.112208952,e.C_re[4]=-.15094762,e.C_im[4]=.18200602,e.C_re[5]=1.01418179,e.C_im[5]=1.64497696,e.C_re[6]=1.9660549,e.C_im[6]=2.5127645,e.D=[],e.D[1]=1.5627014243,e.D[2]=.5185406398,e.D[3]=-.03333098,e.D[4]=-.1052906,e.D[5]=-.0368594,e.D[6]=.007317,e.D[7]=.0122,e.D[8]=.00394,e.D[9]=-.0013}function FT(e,t){var r,n=t.x,i=t.y,o=i-e.lat0,s=n-e.long0,a=o/Oh*1e-5,c=s,l=1,h=0;for(r=1;r<=10;r++)l=l*a,h=h+e.A[r]*l;var u=h,f=c,d=1,m=0,p,g,y=0,_=0;for(r=1;r<=6;r++)p=d*u-m*f,g=m*u+d*f,d=p,m=g,y=y+e.B_re[r]*d-e.B_im[r]*m,_=_+e.B_im[r]*d+e.B_re[r]*m;return t.x=_*e.a+e.x0,t.y=y*e.a+e.y0,t}function UT(e,t){var r,n=t.x,i=t.y,o=n-e.x0,s=i-e.y0,a=s/e.a,c=o/e.a,l=1,h=0,u,f,d=0,m=0;for(r=1;r<=6;r++)u=l*a-h*c,f=h*a+l*c,l=u,h=f,d=d+e.C_re[r]*l-e.C_im[r]*h,m=m+e.C_im[r]*l+e.C_re[r]*h;for(var p=0;p<e.iterations;p++){var g=d,y=m,_,M,b=a,v=c;for(r=2;r<=6;r++)_=g*d-y*m,M=y*d+g*m,g=_,y=M,b=b+(r-1)*(e.B_re[r]*g-e.B_im[r]*y),v=v+(r-1)*(e.B_im[r]*g+e.B_re[r]*y);g=1,y=0;var T=e.B_re[1],S=e.B_im[1];for(r=2;r<=6;r++)_=g*d-y*m,M=y*d+g*m,g=_,y=M,T=T+r*(e.B_re[r]*g-e.B_im[r]*y),S=S+r*(e.B_im[r]*g+e.B_re[r]*y);var E=T*T+S*S;d=(b*T+v*S)/E,m=(v*T-b*S)/E}var N=d,B=m,C=1,R=0;for(r=1;r<=9;r++)C=C*N,R=R+e.D[r]*C;var W=e.lat0+R*Oh*1e5,j=e.long0+B;return t.x=j,t.y=W,t}function GT(e,t={}){let r={...e,A:[],B_re:[],B_im:[],C_re:[],C_im:[],D:[],iterations:1,...t};return zO(r),r}Ee();var By={name:"nzmg",aliases:["New_Zealand_Map_Grid"],parameters:["lon_0","x_0","y_0","lat_0","iterations"],create(e){let t=vt(e),r=tt(e.parameters,"iterations",1);if(!Number.isInteger(r)||r<0||r>10)throw new Error("NZMG iterations must be an integer from 0 to 10");if(!Object.prototype.hasOwnProperty.call(e.parameters,"lat_0")||!Object.prototype.hasOwnProperty.call(e.parameters,"lon_0"))throw new Error("NZMG requires lat_0 and lon_0");let n=GT(t,{iterations:r}),i=Et("nzmg",e,n,FT,UT);return Pt(i,K(t.long0-Math.PI/22.5,Math.max(-Math.PI/2,t.lat0-Math.PI/22.5),t.long0+Math.PI/22.5,Math.min(Math.PI/2,t.lat0+Math.PI/22.5)),o=>KE(Pe(n,e),o),t.primeMeridian,t.over)}};Ht();ne();Dh();fe();Ad();Ae();var sl=1e-7;function VO(e){return e.no_uoff||e.no_off||["hotineobliquemercator","hotineobliquemercatorvarianta","hotineobliquemercatorazimuthnaturalorigin"].includes(e.projName.toLowerCase().replace(/[ _-]/g,""))}function kO(e){var t,r,n,i,o,s,a,c,l,h,u=0,f,d=0,m=0,p=0,g=0,y=0,_=0;e.k0||(e.k0=1),e.no_off=VO(e),e.no_rot=e.no_rot;var M=!1;Number.isFinite(e.alpha)&&(M=!0);var b=!1;if(Number.isFinite(e.rectified_grid_angle)&&(b=!0),M&&(_=e.alpha),b&&(u=e.rectified_grid_angle,M||(_=0,M=!0)),M||b)d=e.longc;else if(m=e.long1,g=e.lat1,p=e.long2,y=e.lat2,Math.abs(g-y)<=sl||Math.abs(g)<=sl||Math.abs(Math.abs(g)-U)<=sl||Math.abs(Math.abs(e.lat0)-U)<=sl||Math.abs(Math.abs(y)-U)<=sl)throw new Error;var v=1-e.es;if(r=Math.sqrt(v),Math.abs(e.lat0)>1e-10?(c=Math.sin(e.lat0),n=Math.cos(e.lat0),t=1-e.es*c*c,e.B=n*n,e.B=Math.sqrt(1+e.es*e.B*e.B/v),e.A=e.B*e.k0*r/t,i=e.B*r/(n*Math.sqrt(t)),o=i*i-1,o<=0?o=0:(o=Math.sqrt(o),e.lat0<0&&(o=-o)),e.E=o+=i,e.E*=Math.pow(Lr(e.e,e.lat0,c),e.B)):(e.B=1/r,e.A=e.k0,e.E=i=o=1),M||b){M?(f=Math.asin(Math.sin(_)/i),b||(u=_)):(f=u,_=Math.asin(i*Math.sin(f)));let T=.5*(o-1/o)*Math.tan(f);i>1&&Math.abs(Math.cos(_))<=8*Number.EPSILON?T=Math.sign(e.lat0)*Math.sign(Math.sin(_)):Math.abs(T)>1&&Math.abs(T)<=1+8*Number.EPSILON&&(T=Math.sign(T)),e.lam0=d-Math.asin(T)/e.B}else s=Math.pow(Lr(e.e,g,Math.sin(g)),e.B),a=Math.pow(Lr(e.e,y,Math.sin(y)),e.B),o=e.E/s,l=(a-s)/(a+s),h=e.E*e.E,h=(h-a*s)/(h+a*s),t=m-p,t<-Math.PI?p-=Jo:t>Math.PI&&(p+=Jo),e.lam0=G(.5*(m+p)-Math.atan(h*Math.tan(.5*e.B*(m-p))/l)/e.B,e.over),f=Math.atan(2*Math.sin(e.B*G(m-e.lam0,e.over))/(o-1/o)),u=_=Math.asin(i*Math.sin(f));e.singam=Math.sin(f),e.cosgam=Math.cos(f),e.sinrot=Math.sin(u),e.cosrot=Math.cos(u),e.rB=1/e.B,e.ArB=e.A*e.rB,e.BrA=1/e.ArB,e.no_off?e.u_0=0:(e.u_0=Math.abs(e.ArB*Math.atan(Math.sqrt(i*i-1)/Math.cos(_))),e.lat0<0&&(e.u_0=-e.u_0)),o=.5*f,e.v_pole_n=e.ArB*Math.log(Math.tan($t-o)),e.v_pole_s=e.ArB*Math.log(Math.tan($t+o))}function zT(e,t){var r=t,n,i,o,s,a,c,l,h;if(t.x=t.x-e.lam0,Math.abs(Math.abs(t.y)-U)>1e-10){if(a=e.E/Math.pow(Lr(e.e,t.y,Math.sin(t.y)),e.B),c=1/a,n=.5*(a-c),i=.5*(a+c),s=Math.sin(e.B*t.x),o=(n*e.singam-s*e.cosgam)/i,Math.abs(Math.abs(o)-1)<1e-10)throw new Error;h=.5*e.ArB*Math.log((1-o)/(1+o)),c=Math.cos(e.B*t.x),Math.abs(c)<sl?l=e.A*t.x:l=e.ArB*Math.atan2(n*e.cosgam+s*e.singam,c)}else h=t.y>0?e.v_pole_n:e.v_pole_s,l=e.ArB*t.y;return e.no_rot?(r.x=l,r.y=h):(l-=e.u_0,r.x=h*e.cosrot+l*e.sinrot,r.y=l*e.cosrot-h*e.sinrot),r.x=e.a*r.x+e.x0,r.y=e.a*r.y+e.y0,r}function VT(e,t){var r,n,i,o,s,a,c,l=t;if(t.x=(t.x-e.x0)*(1/e.a),t.y=(t.y-e.y0)*(1/e.a),e.no_rot?(n=t.y,r=t.x):(n=t.x*e.cosrot-t.y*e.sinrot,r=t.y*e.cosrot+t.x*e.sinrot+e.u_0),i=Math.exp(-e.BrA*n),o=.5*(i-1/i),s=.5*(i+1/i),a=Math.sin(e.BrA*r),c=(a*e.cosgam+o*e.singam)/s,Math.abs(Math.abs(c)-1)<1e-10)l.x=0,l.y=c<0?-U:U;else{if(l.y=e.E/Math.sqrt((1+c)/(1-c)),l.y=Sa(e.e,Math.pow(l.y,1/e.B)),l.y===1/0)throw new Error;l.x=-e.rB*Math.atan2(o*e.cosgam-a*e.singam,Math.cos(e.BrA*r))}return l.x+=e.lam0,l}function kT(e,t={}){let r={...e,no_off:!1,no_rot:!1,alpha:NaN,rectified_grid_angle:NaN,longc:0,long1:0,long2:0,B:0,A:0,E:0,lam0:0,singam:0,cosgam:0,sinrot:0,cosrot:0,rB:0,ArB:0,BrA:0,u_0:0,v_pole_n:0,v_pole_s:0,no_uoff:!1,projName:"",...t};return kO(r),r}Ee();wn();var Ly={name:"omerc",aliases:["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Variant_B","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","Oblique_Mercator"],parameters:["lon_0","x_0","y_0","lat_0","k","k_0","alpha","gamma","lonc","lon_1","lon_2","lat_1","lat_2","no_off","no_uoff","no_rot"],flags:["no_off","no_uoff","no_rot"],create(e){let t=vt(e);if(Math.abs(t.lat0)>=Math.PI/2)throw new Error("Oblique Mercator origin must be away from the poles");let n=Object.prototype.hasOwnProperty.call(e.parameters,"alpha")||Object.prototype.hasOwnProperty.call(e.parameters,"gamma")?["lonc"]:["lon_1","lat_1","lon_2","lat_2"];for(let s of n)if(!Object.prototype.hasOwnProperty.call(e.parameters,s))throw new Error("Oblique Mercator requires "+s);let i=kT(t,{projName:e.parameters.proj||"omerc",alpha:tt(e.parameters,"alpha",NaN)*Math.PI/180,rectified_grid_angle:tt(e.parameters,"gamma",NaN)*Math.PI/180,longc:tt(e.parameters,"lonc",0)*Math.PI/180,long1:tt(e.parameters,"lon_1",0)*Math.PI/180,long2:tt(e.parameters,"lon_2",0)*Math.PI/180,no_off:si(e.parameters,"no_off"),no_uoff:si(e.parameters,"no_uoff"),no_rot:si(e.parameters,"no_rot")}),o=Et("omerc",e,i,zT,VT);return Pt(o,K(i.lam0-Math.PI/18,Math.max(-Math.PI/2+1e-8,t.lat0-Math.PI/18),i.lam0+Math.PI/18,Math.min(Math.PI/2-1e-8,t.lat0+Math.PI/18)),s=>$E(Pe(i,e),s),t.primeMeridian,t.over)}};rs();ns();fe();function qT(e){let t=Math.sin(e.lat0),r=Math.cos(e.lat0),n=1/Math.sqrt(1-e.es*t*t);return{...e,sin0:t,cos0:r,originY:-e.es*n*t*r}}function jT(e,t){let r=G(t.x-e.long0,e.over),n=Math.sin(t.y),i=Math.cos(t.y),o=1/Math.sqrt(1-e.es*n*n);return t.x=e.x0+e.a*e.k0*o*i*Math.sin(r),t.y=e.y0+e.a*e.k0*(o*((1-e.es)*n*e.cos0-i*Math.cos(r)*e.sin0)-e.originY),t}function WT(e,t){let r=(t.x-e.x0)/(e.a*e.k0),n=(t.y-e.y0)/(e.a*e.k0)+e.originY,i=1-e.es,o=e.cos0*e.cos0+e.sin0*e.sin0/i,s=n*e.sin0*e.cos0*e.es/i,a=r*r+n*n*(e.sin0*e.sin0+e.cos0*e.cos0/i)-1,c=s*s-o*a;if(c<-32*Number.EPSILON*o)throw new Error("Coordinate is outside the orthographic ellipse");let l=(-s+Math.sqrt(Math.max(0,c)))/o,h=l*e.cos0-n*e.sin0,u=l*e.sin0+n*e.cos0;return t.x=G(e.long0+Math.atan2(r,h),e.over),t.y=Math.atan2(u,i*Math.hypot(h,r)),t}var Dy={name:"ortho",aliases:[],parameters:["lon_0","x_0","y_0","lat_0","k","k_0"],create(e){let t=vt(e),r=qT(t);return rn(Et("ortho",e,r,jT,WT,as(t,0,!0)),t,Math.PI/2,(n,i)=>TS(Pe(t,e),n,i),Math.PI/2)}};Ht();ne();fe();var HT=20;function qO(e){e.meridianPole=Sn(e.a,e.es,0,Math.PI/2),e.poleRadius=e.a/Math.sqrt(1-e.es),e.ml0=Sn(e.a,e.es,0,e.lat0)}function YT(e,t){var r=t.x,n=t.y,i,o,s,a=G(r-e.long0,e.over);if(s=a*Math.sin(n),e.sphere)n===0?(i=e.a*a,o=-1*e.a*e.lat0):(i=e.a*Math.sin(s)/Math.tan(n),o=e.a*(n-e.lat0+2*Math.sin(s/2)**2/Math.tan(n)));else if(n===0)i=e.a*a,o=-1*e.ml0;else{var c=tl(e.a,e.e,Math.sin(n))/Math.tan(n);i=c*Math.sin(s),o=Sn(e.a,e.es,e.lat0,n)+c*(2*Math.sin(s/2)**2)}return t.x=i+e.x0,t.y=o+e.y0,t}function KT(e,t){var r,n,i,o,s,a,c,l,h;i=t.x-e.x0,o=t.y-e.y0;let u=o+(e.sphere?e.a*e.lat0:e.ml0),f=u<0?-1:1,m=(e.sphere?e.a*Math.PI/2:e.meridianPole)-f*u,p=Math.hypot(i,m);if(p/e.a<1e-6)return t.x=G(e.long0+Math.atan2(i,m),e.over),t.y=f*(Math.PI/2-p/e.poleRadius),t;if(e.sphere)if(Math.abs(o+e.a*e.lat0)<=1e-10)r=G(i/e.a+e.long0,e.over),n=0;else{a=e.lat0+o/e.a,c=i*i/e.a/e.a+a*a,l=a;var g;for(s=HT;s;--s)if(g=Math.tan(l),h=-1*(a*(l*g+1)-l-.5*(l*l+c)*g)/((l-a)/g-1),l+=h,Math.abs(h)<=1e-14){n=l;break}if(n=$T(e,n===void 0?l:n,i,o),n===void 0)return null;l=n,r=G(e.long0+Math.asin(i*Math.tan(l)/e.a)/Math.sin(n),e.over)}else if(Math.abs(o+e.ml0)<=1e-10)n=0,r=G(e.long0+i/e.a,e.over);else{a=(e.ml0+o)/e.a,c=i*i/e.a/e.a+a*a,l=a;var y,_,M,b,v;for(s=HT;s;--s)if(v=e.e*Math.sin(l),y=Math.sqrt(1-v*v)*Math.tan(l),_=Sn(e.a,e.es,0,l),M=(1-e.es)/Math.pow(1-v*v,1.5),b=_/e.a,h=(a*(y*b+1)-b-.5*y*(b*b+c))/(e.es*Math.sin(2*l)*(b*b+c-2*a*b)/(4*y)+(a-b)*(y*M-2/Math.sin(2*l))-M),l-=h,Math.abs(h)<=1e-14){n=l;break}if(n=$T(e,n===void 0?l:n,i,o),n===void 0)return null;l=n,y=Math.sqrt(1-e.es*Math.pow(Math.sin(n),2))*Math.tan(n),r=G(e.long0+Math.asin(i*y/e.a)/Math.sin(n),e.over)}return t.x=r,t.y=n,t}function XT(e,t={}){let r={...e,ml0:0,meridianPole:0,poleRadius:0,...t};return qO(r),r}function $T(e,t,r,n){for(let i=0;i<8;i++){if(!Number.isFinite(t)||Math.abs(t)>=Math.PI/2)return;let o=Math.sin(t),s=Math.cos(t),a=1-e.es*o*o,c=e.sphere?e.a:tl(e.a,e.e,o),l=c/Math.tan(t),h=Math.asin(r/l),u=l*Math.sin(h),f=2*Math.sin(h/2)**2,d=e.sphere?e.a*(t-e.lat0):Sn(e.a,e.es,e.lat0,t),m=l*f,g=d+m-n;if(Math.abs(u-r)<=64*Number.EPSILON*Math.max(e.a,Math.abs(r))&&Math.abs(g)<=64*Number.EPSILON*Math.max(Math.abs(n),Math.abs(d),Math.abs(m),e.a*Math.max(Math.abs(t),Math.abs(e.lat0))))return t;let y=e.sphere?e.a:e.a*(1-e.es)/Math.pow(a,1.5),_=c*((e.sphere?0:e.es*s*s/a)-1/(o*o)),M=y+_*(-f/Math.cos(h)),b=g/M;if(!Number.isFinite(b)||Math.abs(b)>1e-6)return;t-=b}}var Fy={name:"poly",aliases:["Polyconic","American_Polyconic"],parameters:["lon_0","x_0","y_0","lat_0"],create(e){let t=vt(e),r=XT(t),n=Et("poly",e,r,YT,KT);return Pt(n,K(t.long0-Math.PI/6,Math.max(-Math.PI/2+1e-8,t.lat0-Math.PI/2+1e-8),t.long0+Math.PI/6,Math.min(Math.PI/2-1e-8,t.lat0+Math.PI/2-1e-8)),i=>jE(Pe(t,e),n.forward,i),t.primeMeridian,t.over)}};ya();Ee();Ae();var Re={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},ae={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function jO(e){e.x0=e.x0||0,e.y0=e.y0||0,e.lat0=e.lat0||0,e.long0=e.long0||0,e.lat_ts=e.lat_ts||0,e.lat0>=U-$t/2?e.face=Re.TOP:e.lat0<=-(U-$t/2)?e.face=Re.BOTTOM:Math.abs(e.long0)<=$t?e.face=Re.FRONT:Math.abs(e.long0)<=U+$t?e.face=e.long0>0?Re.RIGHT:Re.LEFT:e.face=Re.BACK,e.es!==0&&(e.one_minus_f=1-(e.a-e.b)/e.a,e.one_minus_f_squared=e.one_minus_f*e.one_minus_f)}function ZT(e,t){var r=t,n,i,o,s,a,c,l=0;if(t.x-=e.long0,e.es!==0?n=Math.atan(e.one_minus_f_squared*Math.tan(t.y)):n=t.y,i=t.x,e.face===Re.TOP)s=U-n,i>=$t&&i<=U+$t?(l=ae.AREA_0,o=i-U):i>U+$t||i<=-(U+$t)?(l=ae.AREA_1,o=i>0?i-Math.PI:i+Math.PI):i>-(U+$t)&&i<=-$t?(l=ae.AREA_2,o=i+U):(l=ae.AREA_3,o=i);else if(e.face===Re.BOTTOM)s=U+n,i>=$t&&i<=U+$t?(l=ae.AREA_0,o=-i+U):i<$t&&i>=-$t?(l=ae.AREA_1,o=-i):i<-$t&&i>=-(U+$t)?(l=ae.AREA_2,o=-i-U):(l=ae.AREA_3,o=i>0?-i+Math.PI:-i-Math.PI);else{var h,u,f,d,m,p,g;e.face===Re.RIGHT?i=al(i,+U):e.face===Re.BACK?i=al(i,+Math.PI):e.face===Re.LEFT&&(i=al(i,-U)),d=Math.sin(n),m=Math.cos(n),p=Math.sin(i),g=Math.cos(i),h=m*g,u=m*p,f=d,e.face===Re.FRONT?(s=Math.atan2(Math.hypot(u,f),h),o=gm(s,f,u)):e.face===Re.RIGHT?(s=Math.atan2(Math.hypot(h,f),u),o=gm(s,f,-h)):e.face===Re.BACK?(s=Math.atan2(Math.hypot(u,f),-h),o=gm(s,f,-u)):e.face===Re.LEFT?(s=Math.atan2(Math.hypot(h,f),-u),o=gm(s,f,h)):s=o=0,Math.abs(o)<=$t?l=ae.AREA_0:o>$t&&o<=U+$t?(l=ae.AREA_1,o-=U):o>U+$t||o<=-(U+$t)?(l=ae.AREA_2,o=o>=0?o-Math.PI:o+Math.PI):(l=ae.AREA_3,o+=U)}return c=Math.atan(12/Math.PI*(o+Math.acos(Math.sin(o)*Math.cos($t))-U)),a=Math.sqrt(2*Math.sin(s/2)**2/(Math.cos(c)*Math.cos(c))/(1-Math.cos(Math.atan(1/Math.cos(o))))),l===ae.AREA_1?c+=U:l===ae.AREA_2?c+=Math.PI:l===ae.AREA_3&&(c+=1.5*Math.PI),r.x=a*Math.cos(c),r.y=a*Math.sin(c),r.x=r.x*e.a+e.x0,r.y=r.y*e.a+e.y0,t}function JT(e,t){var r=0,n=0,i,o,s,a,c,l,h,u,f=0;t.x=(t.x-e.x0)/e.a,t.y=(t.y-e.y0)/e.a,i=Math.atan2(t.y,t.x),t.x>=0&&t.x>=Math.abs(t.y)?f=ae.AREA_0:t.y>=0&&t.y>=Math.abs(t.x)?(f=ae.AREA_1,i-=U):t.x<0&&-t.x>=Math.abs(t.y)?(f=ae.AREA_2,i=i<0?i+Math.PI:i-Math.PI):(f=ae.AREA_3,i+=U),u=Math.PI/12*Math.tan(i),a=Math.sin(u)/(Math.cos(u)-1/Math.sqrt(2)),c=Math.atan(a),o=Math.cos(i),s=Math.hypot(t.x,t.y);let d=o*o*s*s*(1-Math.cos(Math.atan(1/Math.cos(c))));if(l=1-d,l<-1?l=-1:l>1&&(l=1),e.face===Re.TOP)h=2*Math.asin(Math.sqrt(Math.min(1,d/2))),n=U-h,f===ae.AREA_0?r=c+U:f===ae.AREA_1?r=c<0?c+Math.PI:c-Math.PI:f===ae.AREA_2?r=c-U:r=c;else if(e.face===Re.BOTTOM)h=2*Math.asin(Math.sqrt(Math.min(1,d/2))),n=h-U,f===ae.AREA_0?r=-c+U:f===ae.AREA_1?r=-c:f===ae.AREA_2?r=-c-U:r=c<0?-c-Math.PI:-c+Math.PI;else{var m,p,g;m=l;let y=Math.sqrt(Math.max(0,d*(2-d)));g=y*Math.sin(c),p=y*Math.cos(c),f===ae.AREA_1?(u=p,p=-g,g=u):f===ae.AREA_2?(p=-p,g=-g):f===ae.AREA_3&&(u=p,p=g,g=-u),e.face===Re.RIGHT?(u=m,m=-p,p=u):e.face===Re.BACK?(m=-m,p=-p):e.face===Re.LEFT&&(u=m,m=p,p=-u),n=Math.atan2(g,Math.hypot(m,p)),r=Math.atan2(p,m),e.face===Re.RIGHT?r=al(r,-U):e.face===Re.BACK?r=al(r,-Math.PI):e.face===Re.LEFT&&(r=al(r,+U))}return e.es!==0&&(n=Math.atan2(Math.sin(n),e.one_minus_f_squared*Math.cos(n))),r+=e.long0,t.x=r,t.y=n,t}function gm(e,t,r){return e===0?0:Math.atan2(t,r)}function al(e,t){var r=e+t;return r<-Math.PI?r+=Jo:r>+Math.PI&&(r-=Jo),r}function QT(e,t={}){let r={...e,face:0,one_minus_f:0,one_minus_f_squared:0,...t};return jO(r),r}Ht();ne();xa();Ie();var Uy={name:"qsc",aliases:["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube"],parameters:["lon_0","x_0","y_0","lat_0"],create(e){let t=vt(e),r=e.primeMeridian??0,n=QT(t),i=Et("qsc",e,n,ZT,JT),o=tt(e.parameters,"x_0",0),s=tt(e.parameters,"y_0",0);return{...i,longitudeOrigin:t.long0,getRenderingProfile(a){if(a)return Ke(u=>{let f=y=>t.es?Math.atan((1-t.es)*Math.tan(y)):y,d=K(u[0][0]-t.long0,f(u[0][1]),u[1][0]-t.long0,f(u[1][1])),m=n.face===5?[0,0,1]:n.face===6?[0,0,-1]:[1,0,0],p=se(m,d)[0],g=t.a*Math.sqrt((1-p)/(.5*(1-Math.SQRT1_2)));return re([o-g,o+g],[s-g,s+g])},a,t.long0,r);let c=[[o-t.a,s-t.a,0],[o+t.a,s+t.a,0]],l=os(e.parameters,r)().normalize,h=Yo(u=>{let[f,d]=i.forward(u.x,u.y);Math.abs(f-o)<=t.a&&Math.abs(d-s)<=t.a||([u.x,u.y]=i.inverse(o+Math.max(-t.a,Math.min(t.a,f-o)),s+Math.max(-t.a,Math.min(t.a,d-s))))},r);return{bounds:c,normalize(u){l(u),h(u)}}}}}};Ie();Ht();ne();Ae();fe();var cl=[[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]],cs=[[-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]];cl=cl.map(e=>e.map(Math.fround));cs=cs.map(e=>e.map(Math.fround));var tI=.8487,eI=1.3523,rI=w1/5,WO=1/rI,Ra=18,ym=function(e,t){return e[0]+t*(e[1]+t*(e[2]+t*e[3]))},HO=function(e,t){return e[1]+t*(2*e[2]+t*3*e[3])};function $O(e,t,r,n,i){for(var o=r;i;--i){var s=(ym(e,o)-t)/HO(e,o);if(o-=s,Math.abs(s)<n)break}return o}function YO(e){e.x0=e.x0||0,e.y0=e.y0||0,e.long0=e.long0||0,e.es=0}function nI(e,t){var r=G(t.x-e.long0,e.over),n=Math.abs(t.y),i=Math.floor(n*rI+1e-15);i<0?i=0:i>=Ra&&(i=Ra),n=w1*(n-WO*i);var o=ym(cl[i],n)*r,s=ym(cs[i],n);return t.y<0&&(s=-s),t.x=o*e.a*tI+e.x0,t.y=s*e.a*eI+e.y0,t}function iI(e,t){var r=t.y,n=t;n.x=(n.x-e.x0)/(e.a*tI),n.y=Math.abs(r-e.y0)/(e.a*eI);for(let a=0;a<=Ra;a++)if(Math.abs(n.y-cs[a][0])<=8*Number.EPSILON)return n.x=G(n.x/cl[a][0]+e.long0,e.over),n.y=(r<e.y0?-1:1)*a*5*y1,n;if(n.y>=1)n.x/=cl[Ra][0],n.y=r<0?-U:U;else{var i=Math.floor(n.y*Ra);for(i<0?i=0:i>=Ra&&(i=Ra-1);;)if(cs[i][0]>n.y)--i;else if(cs[i+1][0]<=n.y)++i;else break;var o=cs[i],s=5*(n.y-o[0])/(cs[i+1][0]-o[0]);s=$O(o,n.y,s,1e-10,100),n.x/=ym(cl[i],s),n.y=(5*i+s)*y1,r<0&&(n.y=-n.y)}return n.x=G(n.x+e.long0,e.over),n}function oI(e,t={}){let r={...e,...t};return YO(r),r}var Gy={name:"robin",aliases:["Robinson"],parameters:["lon_0","x_0","y_0"],create(e){let t=vt(e),r=oI(t),n=Et("robin",e,r,nI,iI);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>yr(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};Ie();Ht();ne();var zy={name:"sinu",aliases:["Sinusoidal"],parameters:["lon_0","x_0","y_0"],create(e){let t=vt(e),r=iT(t),n=Et("sinu",e,r,fm,dm);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>yr(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};Ht();ne();function KO(e){e.k0||(e.k0=1);var t=e.lat0;e.lambda0=e.long0;var r=Math.sin(t),n=e.a,i=e.rf,o=1/i,s=2*o-Math.pow(o,2);e.e=Math.sqrt(s);var a=e.e;e.R=e.k0*n*Math.sqrt(1-s)/(1-s*Math.pow(r,2)),e.alpha=Math.sqrt(1+s/(1-s)*Math.pow(Math.cos(t),4)),e.b0=Math.asin(r/e.alpha);var c=Math.log(Math.tan(Math.PI/4+e.b0/2)),l=Math.log(Math.tan(Math.PI/4+t/2)),h=Math.log((1+a*r)/(1-a*r));e.K=c-e.alpha*l+e.alpha*a/2*h}function sI(e,t){let r=e.e*Math.sin(t.y),n=2*Math.atan(Math.exp(e.alpha*(Math.log(Math.tan(Math.PI/4+t.y/2))-e.e/2*Math.log((1+r)/(1-r)))+e.K))-Math.PI/2,i=e.alpha*(t.x-e.lambda0),o=Math.cos(n),s=Math.asin(Math.cos(e.b0)*Math.sin(n)-Math.sin(e.b0)*o*Math.cos(i)),a=Math.asin(o*Math.sin(i)/Math.cos(s));return t.x=e.x0+e.R*a,t.y=e.y0+e.R*Math.log(Math.tan(Math.PI/4+s/2)),t}function aI(e,t){let r=(t.x-e.x0)/e.R,n=2*(Math.atan(Math.exp((t.y-e.y0)/e.R))-Math.PI/4),i=Math.asin(Math.cos(e.b0)*Math.sin(n)+Math.sin(e.b0)*Math.cos(n)*Math.cos(r)),o=Math.asin(Math.cos(n)*Math.sin(r)/Math.cos(i)),s=(e.K-Math.log(Math.tan(Math.PI/4+i/2)))/e.alpha;for(let a=0;a<6;a++){let c=e.e*Math.sin(i),l=(s+Math.log(Math.tan(Math.PI/4+i/2))-e.e/2*Math.log((1+c)/(1-c)))*(1-c*c)*Math.cos(i)/(1-e.es);if(i-=l,Math.abs(l)<1e-10)return t.x=e.lambda0+o/e.alpha,t.y=i,t}return null}function cI(e,t={}){let r={...e,lambda0:0,rf:0,R:0,alpha:0,b0:0,K:0,...t};return KO(r),r}var Vy={name:"somerc",aliases:[],parameters:["lon_0","x_0","y_0","lat_0","k","k_0"],create(e){let t=vt(e),r=cI(t,{rf:t.a===t.b?1/0:1/(1-t.b/t.a)}),n=Et("somerc",e,r,sI,aI);return Pt(n,K(t.long0-Math.PI/18,Math.max(-Math.PI/2+1e-8,t.lat0-Math.PI/18),t.long0+Math.PI/18,Math.min(Math.PI/2-1e-8,t.lat0+Math.PI/18)),i=>HE(Pe(r,e),i),t.primeMeridian,t.over)}};rs();ns();Ae();Ma();var _r={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3};function XO(e){if(Math.abs(Math.abs(e.lat0)-U)<1e-10?e.mode=e.lat0<0?_r.S_POLE:_r.N_POLE:Math.abs(e.lat0)<1e-10?e.mode=_r.EQUIT:(e.mode=_r.OBLIQ,e.sinph0=Math.sin(e.lat0),e.cosph0=Math.cos(e.lat0)),e.pn1=e.h/e.a,e.pn1<=0||e.pn1>1e10)throw new Error("Invalid height");e.p=1+e.pn1,e.rp=1/e.p,e.h1=1/e.pn1,e.pfact=(e.p+1)*e.h1,e.es=0;var t=e.tilt,r=e.azi;e.cg=Math.cos(r),e.sg=Math.sin(r),e.cw=Math.cos(t),e.sw=Math.sin(t)}function lI(e,t){t.x-=e.long0;var r=Math.sin(t.y),n=Math.cos(t.y),i=Math.cos(t.x),o,s;switch(e.mode){case _r.OBLIQ:s=e.sinph0*r+e.cosph0*n*i;break;case _r.EQUIT:s=n*i;break;case _r.S_POLE:s=-r;break;case _r.N_POLE:s=r;break}switch(s=e.pn1/(e.p-s),o=s*n*Math.sin(t.x),e.mode){case _r.OBLIQ:s*=e.cosph0*r-e.sinph0*n*i;break;case _r.EQUIT:s*=r;break;case _r.N_POLE:s*=-(n*i);break;case _r.S_POLE:s*=n*i;break}var a,c;return a=s*e.cg+o*e.sg,c=1/(a*e.sw*e.h1+e.cw),o=(o*e.cg-s*e.sg)*e.cw*c,s=a*c,t.x=o*e.a,t.y=s*e.a,t}function hI(e,t){t.x/=e.a,t.y/=e.a;var r=t.x,n=t.y,i,o,s;s=1/(e.pn1-t.y*e.sw),i=e.pn1*t.x*s,o=e.pn1*t.y*e.cw*s,t.x=i*e.cg+o*e.sg,t.y=o*e.cg-i*e.sg;var a=qe(t.x,t.y);if(Math.abs(a)<1e-10)r=0,n=e.lat0;else{var c,l;switch(l=1-a*a*e.pfact,l=(e.p-Math.sqrt(l))/(e.pn1/a+a/e.pn1),c=Math.sqrt(1-l*l),e.mode){case _r.OBLIQ:n=Math.asin(c*e.sinph0+t.y*l*e.cosph0/a),t.y=(c-e.sinph0*Math.sin(n))*a,t.x*=l*e.cosph0;break;case _r.EQUIT:n=Math.asin(t.y*l/a),t.y=c*a,t.x*=l;break;case _r.N_POLE:n=Math.asin(c),t.y=-t.y;break;case _r.S_POLE:n=-Math.asin(c);break}r=Math.atan2(t.x,t.y)}return t.x=r+e.long0,t.y=n,t}function uI(e,t={}){let r={...e,mode:0,sinph0:0,cosph0:0,pn1:0,h:0,p:0,rp:0,h1:0,pfact:0,tilt:0,azi:0,cg:0,sg:0,cw:0,sw:0,...t};return XO(r),r}Ee();var ky={name:"tpers",aliases:["Tilted_Perspective"],parameters:["lon_0","x_0","y_0","lat_0","h","tilt","azi"],create(e){let t=vt(e),r=tt(e.parameters,"h",1e5),n=tt(e.parameters,"tilt",0)*Math.PI/180,i=tt(e.parameters,"azi",0)*Math.PI/180;if(Math.abs(n)>=Math.PI/2)throw new Error("Perspective tilt must be between -90 and 90 degrees");let o=uI(t,{h:r,tilt:n,azi:i}),s=1+r/t.a,a=Math.acos(1/s),c=Math.abs(n),l=s*Math.cos(c)<1?c-Math.acos(s*Math.cos(c)):a,h=Math.min(a,l)*(1-1e-10);return rn(Et("tpers",e,o,lI,hI,as(t,1/(1+r/t.a))),t,h,(u,f)=>PS(Pe(t,e),s,n,i,u,f),a)}};Ie();Ht();ne();fe();Ae();function ZO(e){e.R=e.a}function fI(e,t){var r=t.x,n=t.y,i=G(r-e.long0,e.over),o,s;if(Math.abs(n)<=1e-10)return o=e.x0+e.R*i,s=e.y0,t.x=o,t.y=s,t;var a=Aa(2*Math.abs(n/Math.PI));if(Math.abs(i)<=1e-10||Math.abs(Math.abs(n)-U)<=1e-10)return o=e.x0,n>=0?s=e.y0+Math.PI*e.R*Math.tan(.5*a):s=e.y0+Math.PI*e.R*-Math.tan(.5*a),t.x=o,t.y=s,t;var c=.5*Math.abs(Math.PI/i-i/Math.PI),l=c*c,h=Math.sin(a),u=Math.cos(a),f=u/(h-2*Math.sin(a/2)**2),d=f*f,m=f*(2/h-1),p=m*m,g=Math.sqrt(l*(f-p)*(f-p)-(p+l)*(d-p)),y=Math.PI*e.R*(p-d)/(g-c*(f-p));i<0&&(y=-y),o=e.x0+y;var _=l+f;return y=Math.PI*e.R*(l*(2*f-1)+d)/(m*_+c*Math.sqrt((p+l)*(l+1)-_*_)),n>=0?s=e.y0+y:s=e.y0-y,t.x=o,t.y=s,t}function dI(e,t){var r,n,i,o,s,a,c,l,h,u,f,d,m;return t.x-=e.x0,t.y-=e.y0,Math.abs(t.y)<1e-10?(t.x=G(e.long0+t.x/e.R,e.over),t.y=0,t):(f=Math.PI*e.R,i=t.x/f,o=t.y/f,s=i*i+o*o,a=-Math.abs(o)*(1+s),c=a-2*o*o+i*i,l=-2*a+1+2*o*o+s*s,m=o*o/l+(2*c*c*c/l/l/l-9*a*c/l/l)/27,h=(a-c*c/3/l)/l,u=2*Math.sqrt(-h/3),f=3*m/h/u,Math.abs(f)>1&&(f>=0?f=1:f=-1),d=Math.acos(f)/3,t.y>=0?n=(-u*Math.cos(d+Math.PI/3)-c/3/l)*Math.PI:n=-(-u*Math.cos(d+Math.PI/3)-c/3/l)*Math.PI,Math.abs(i)<1e-10?r=e.long0:r=G(e.long0+2*Math.PI*i/(Math.sqrt(1+2*(i*i-o*o)+s*s)+1-s),e.over),t.x=r,t.y=n,t)}function mI(e,t={}){let r={...e,R:0,...t};return ZO(r),r}var qy={name:"vandg",aliases:["Van_der_Grinten_I","VanDerGrinten","Van_der_Grinten"],parameters:["lon_0","x_0","y_0"],create(e){let t=vt(e),r=mI(t),n=Et("vandg",e,r,fI,dI);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>Jx(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};wa();Ee();ya();ne();Ht();xa();var pI=["o_proj","o_alpha","o_lon_c","o_lat_c","o_lon_p","o_lat_p","o_lon_1","o_lat_1","o_lon_2","o_lat_2"],jy=e=>e.toLowerCase().replace(/[ _-]/g,""),Wy=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),hi=(e,t)=>tt(e,t,0)*Math.PI/180;function JO(e){let t=[["o_alpha","o_lon_c","o_lat_c"],["o_lat_p","o_lon_p"],["o_lon_1","o_lat_1","o_lon_2","o_lat_2"]],r=t.find(c=>c.some(l=>Wy(e,l)));if(!r)throw new Error("Oblique transformation requires a rotation parameter set");for(let c of r){if(!Wy(e,c))throw new Error("Oblique transformation requires "+c);if(c.includes("lat")&&Math.abs(hi(e,c))>Math.PI/2)throw new Error("Invalid rotation latitude: "+c)}if(r===t[0]){let c=hi(e,"o_alpha"),l=hi(e,"o_lon_c"),h=hi(e,"o_lat_c");if(Math.abs(h)>=Math.PI/2-1e-10)throw new Error("Rotation center must be away from the poles");return{lamp:l+Math.atan2(-Math.cos(c),-Math.sin(c)*Math.sin(h)),phip:Math.asin(Math.cos(h)*Math.sin(c))}}if(r===t[1])return{lamp:hi(e,"o_lon_p"),phip:hi(e,"o_lat_p")};let n=hi(e,"o_lon_1"),i=hi(e,"o_lat_1"),o=hi(e,"o_lon_2"),s=hi(e,"o_lat_2");if(Math.abs(i)>=Math.PI/2-1e-10||Math.abs(s)>=Math.PI/2-1e-10||Math.abs(i)<1e-10||Math.abs(i-s)<1e-10)throw new Error("Invalid new-equator reference points");let a=Math.atan2(Math.cos(i)*Math.sin(s)*Math.cos(n)-Math.sin(i)*Math.cos(s)*Math.cos(o),Math.sin(i)*Math.cos(s)*Math.sin(o)-Math.cos(i)*Math.sin(s)*Math.sin(n));return{lamp:a,phip:Math.atan(-Math.cos(a-n)/Math.tan(i))}}function wm(e){let t=e==="longlat";if(!t&&["obtran","geocent"].includes(jy(e.name)))throw new Error("Cannot wrap a composite or geocentric projection");return{name:"ob_tran",aliases:["General Oblique Transformation","General_Oblique_Transformation"],parameters:[...pI,"lon_0",...t?[]:e.parameters],flags:t?[]:e.flags,create(r){let{parameters:n}=r,i=n.o_proj,o=t?["longlat","latlong","lonlat","latlon","identity"]:[e.name,...e.aliases||[]];if(i&&!o.map(jy).includes(jy(i)))throw new xn("missing-plugin","Oblique transformation dependency does not match +o_proj="+i);let{lamp:s,phip:a}=JO(n),c=Math.cos(a),l=Math.sin(a),h=Math.abs(a)>1e-10,u=hi(n,"lon_0"),f=Wy(n,"over"),d={...n,proj:t?"longlat":i||e.name,lon_0:"0"};for(let S of pI)delete d[S];let m=t?jn(S=>{S.x*=180/Math.PI,S.y*=180/Math.PI},S=>{S.x*=Math.PI/180,S.y*=Math.PI/180}):e.create({...r,parameters:Object.freeze(d),primeMeridian:0}),p=co(m,!1),g=co(m,!0),y=S=>Math.asin(Math.max(-1,Math.min(1,S))),_=S=>{let E=S.x,N=S.y,B=ve(E-u,f),C=Math.cos(B),R=Math.sin(N),W=Math.cos(N),j=ve(Math.atan2(W*Math.sin(B),h?l*W*C+c*R:R)+s),A=y(h?l*R-c*W*C:-W*C);S.x=j,S.y=A},M=S=>{let E=S.x,N=S.y,B=E-s,C=Math.cos(B),R=Math.sin(N),W=Math.cos(N),j=Math.atan2(W*Math.sin(B),h?l*W*C-c*R:-R),A=y(h?l*R+c*W*C:W*C);S.x=ve(j+u),S.y=A},b=jn(S=>{_(S),p(S)},S=>{g(S),M(S)}),v=t?os(d):m.getRenderingProfile?.bind(m);if(!v)return b;let T=(S,E)=>{let N=E&&Ke(()=>S.bounds,E,u,r.primeMeridian??0,f),B=Yo(C=>{let R=C.x,W=C.y;_(C);let j=C.x*180/Math.PI,A=C.y*180/Math.PI,P={x:j,y:A,z:C.z};if(S.normalize?.(P),P.x===j&&P.y===A){C.x=R,C.y=W;return}C.x=P.x*Math.PI/180,C.y=P.y*Math.PI/180,M(C),f&&(C.x+=Math.round((R-C.x)/(2*Math.PI))*2*Math.PI)},r.primeMeridian??0);return{get bounds(){let C=S.bounds,R=W=>[W[0]*180/Math.PI,W[1]*180/Math.PI,W[2]];return t?[R(C[0]),R(C[1])]:C},normalize(C){N?.normalize(C),B(C)}}};return{...b,longitudeOrigin:u,getRenderingProfile(S){if(!S)return T(v());let E=$o(S,r.primeMeridian??0,u),N=K(E[0][0]-u,E[0][1],E[1][0]-u,E[1][1]),B=se(h?[-c,0,l]:[-1,0,0],N),C=h?[l,0,c]:[0,0,1],W=se(C,N)[0]>0?es([0,1,0],C,0,N).map(Math.atan):[-Math.PI,Math.PI];return T(v(yn(K(W[0]+s,y(B[0]),W[1]+s,y(B[1])))),S)}}}}}Pc();ag();Ee();function be(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Expected a CRS object");return e}function Xh(e){return Array.isArray(e)?e:[]}function Mr(e){return String(e||"").toLowerCase().replace(/[^a-z0-9]/g,"")}function cr(e){if(typeof e!="number"||!Number.isFinite(e))throw new Error("Expected a finite CRS parameter");return e}function sn(e,t){if(e===void 0)return t;if(typeof e=="object"){let i=cr(be(e).conversion_factor);if(i<=0)throw new Error("Unit conversion factor must be positive");return i}let n={metre:1,meter:1,degree:Me,radian:1,grad:Math.PI/200,gon:Math.PI/200,foot:.3048,ussurveyfoot:1200/3937,kilometre:1e3,arcsecond:Me/3600,partspermillion:1e-6,unity:1}[Mr(e)];return n||Bt("Unsupported CRS unit: "+String(e)),n}var QO={hotineobliquemercator:"omerc",hotineobliquemercatorvarianta:"omerc",hotineobliquemercatorvariantb:"omerc",hotineobliquemercatorazimuthnaturalorigin:"omerc",hotineobliquemercatorazimuthcenter:"omerc",obliquemercator:"omerc",krovak:"krovak",krovaknorthorientated:"krovak",quadrilateralizedsphericalcube:"qsc",transversemercator:"tmerc",transversemercatorsouthorientated:"unsupported-south-tmerc",mercator:"merc",mercator1sp:"merc",mercator2sp:"merc",mercatorvarianta:"merc",mercatorvariantb:"merc",mercatorauxiliarysphere:"webmerc",popularvisualisationpseudomercator:"webmerc",lambertconformalconic:"lcc",lambertconformalconic1sp:"lcc",lambertconformalconic2sp:"lcc",lambertconicconformal1sp:"lcc",lambertconicconformal2sp:"lcc",albers:"aea",albersconicequalarea:"aea",albersequalarea:"aea",equidistantconic:"eqdc",lambertazimuthalequalarea:"laea",stereographic:"stere",stereographicnorthpole:"sterea",stereographicsouthpole:"stere",polarstereographic:"stere",polarstereographicvarianta:"stere",polarstereographicvariantb:"stere",obliquestereographic:"sterea",doublestereographic:"sterea",azimuthalequidistant:"aeqd",modifiedazimuthalequidistant:"aeqd",equidistantcylindrical:"eqc",equidistantcylindricalspherical:"eqc",equirectangular:"eqc",platecarree:"eqc",bonne:"bonne",cassinisoldner:"cass",cassini:"cass",cylindricalequalarea:"cea",lambertcylindricalequalarea:"cea",eckertvi:"eck6",equalearth:"eqearth",millercylindrical:"mill",mollweide:"moll",robinson:"robin",sinusoidal:"sinu",vandergrinten:"vandg",vandergrinteni:"vandg",gnomonic:"gnom",orthographic:"ortho",polyconic:"poly",americanpolyconic:"poly",newzealandmapgrid:"nzmg",gaussschreibertransversemercator:"gstmerc"},tB={centralmeridian:"lon_0",longitudeoforigin:"lon_0",longitudeofcenter:"lon_0",longitudeofnaturalorigin:"lon_0",longitudeoffalseorigin:"lon_0",longitudeofprojectioncentre:"lon_0",straightverticalpolelongitude:"lon_0",longitudeoforiginmeridian:"lon_0",latitudeoforigin:"lat_0",latitudeofcenter:"lat_0",latitudeofnaturalorigin:"lat_0",latitudeoffalseorigin:"lat_0",latitudeofprojectioncentre:"lat_0",standardparallel1:"lat_1",latitudeof1ststandardparallel:"lat_1",standardparallel2:"lat_2",latitudeof2ndstandardparallel:"lat_2",latitudeofstandardparallel:"lat_ts",scalefactor:"k_0",scalefactoratnaturalorigin:"k_0",scalefactoratprojectionorigin:"k_0",falseeasting:"x_0",falsenorthing:"y_0",eastingatfalseorigin:"x_0",northingatfalseorigin:"y_0"},eB={omerc:{longitudeofcenter:"lonc",longitudeofprojectioncentre:"lonc",azimuth:"alpha",azimuthatprojectioncentre:"alpha",rectifiedgridangle:"gamma",anglefromrectifiedtoskewgrid:"gamma",scalefactoratprojectioncentre:"k_0",eastingatprojectioncentre:"x_0",northingatprojectioncentre:"y_0"},krovak:{azimuth:"alpha",colatitudeofconeaxis:"alpha",pseudostandardparallel1:"lat_ts",latitudeofpseudostandardparallel:"lat_ts",scalefactoronpseudostandardparallel:"k_0"}},rB={east:"e",west:"w",north:"n",south:"s",up:"u",down:"d",geocentricx:"e",geocentricy:"n",geocentricz:"u"};function Ca(e,t){let r=String(e.type),n=nB(e.bbox);if(r==="CompoundCRS"){t.mode!=="horizontal"&&Bt("CompoundCRS requires explicit horizontal extraction");let E=Xh(e.components).map(be).filter(B=>["ProjectedCRS","GeographicCRS","GeodeticCRS","BoundCRS"].includes(String(B.type)));if(E.length!==1)throw new Error("CompoundCRS requires exactly one horizontal component");let N=Ca(E[0],t);return{...N,areaOfUse:n??N.areaOfUse,lossy:!0}}if(r==="BoundCRS"){let E=Ca(be(e.source_crs),t),N=Ca(be(e.target_crs),t);(N.parameters.datum!=="WGS84"||!["longlat","geocent"].includes(N.parameters.proj)||Number(N.parameters.pm||0)!==0||N.parameters.towgs84||Number(N.parameters.a)!==6378137||!(Math.abs(Number(N.parameters.rf)-298.257223563)<=1e-9||Math.abs(Number(N.parameters.b)-6356752314245179e-9)<=1e-6))&&Bt("BoundCRS requires a WGS84 target");let B=be(e.transformation),C=Mr(be(B.method).name),R=C==="geocentrictranslations"||/^geocentrictranslationsgeog[23]ddomain$/.test(C),W=/^positionvector(?:transformation)?(?:geog[23]ddomain|geocentricdomain)?$/.test(C),j=/^coordinateframe(?:rotation)?(?:geog[23]ddomain|geocentricdomain)?$/.test(C);!R&&!W&&!j&&Bt("Unsupported BoundCRS transformation: "+C);let A=["xaxistranslation","yaxistranslation","zaxistranslation","xaxisrotation","yaxisrotation","zaxisrotation","scaledifference"],P=new Array(R?3:7).fill(void 0);for(let F of Xh(B.parameters)){let L=be(F),O=A.indexOf(Mr(L.name));(O<0||O>=P.length||P[O]!==void 0)&&Bt("Unsupported or duplicate Helmert parameter: "+String(L.name));let V=O<3?1:O<6?Me/3600:1e-6;P[O]=cr(L.value)*sn(L.unit,V)/V*(j&&O>=3&&O<6?-1:1)}if(P.some(F=>F===void 0))throw new Error("Incomplete BoundCRS Helmert transformation");let D={...E.parameters,towgs84:P.join(",")};return delete D.datum,{...E,parameters:D,areaOfUse:n??E.areaOfUse}}["ProjectedCRS","GeographicCRS","GeodeticCRS"].includes(r)||Bt("Unsupported CRS type: "+r);let i=r==="ProjectedCRS"?be(e.base_crs):e,o=be(i.datum||i.datum_ensemble);(o.type==="DynamicGeodeticReferenceFrame"||o.frame_reference_epoch!==void 0||e.coordinate_epoch!==void 0)&&Bt("Time-dependent datum transformations are not implemented");let s=be(o.ellipsoid),a=cr(s.semi_major_axis??s.radius),c={proj:"longlat",a:String(a*sn(s.unit,1))};if(s.inverse_flattening!==void 0)c.rf=String(cr(s.inverse_flattening));else if(s.semi_minor_axis!==void 0)c.b=String(cr(s.semi_minor_axis)*sn(s.unit,1));else if(s.radius!==void 0)c.b=c.a;else throw new Error("Ellipsoid requires inverse flattening or semi-minor axis");let l=Jc(t),h=String(o.name||""),u=Mr(h),f=Object.keys(l),d=f.find(E=>Ia(E)===Ia(h)),m=d?[d]:f.filter(E=>Mr(E)===u||Mr(E)===u.replace(/^d/,"")),p=m[0],g=l[p];if(g&&m.some(E=>{let N=l[E];return N.ellipse!==g.ellipse||N.towgs84!==g.towgs84||N.nadgrids!==g.nadgrids}))throw new Error("Ambiguous structured datum name: "+h);if(u&&(c.datum=p||h),p&&Ia(p)==="wgs84"&&(c.datum="WGS84"),p&&["nad83","northamericandatum1983"].includes(Ia(p))&&(c.datum="NAD83"),!p){["wgs84","worldgeodeticsystem1984","worldgeodeticsystem1984ensemble","dwgs1984","wgs1984"].includes(u)&&(c.datum="WGS84"),["nad83","northamericandatum1983","dnorthamerican1983"].includes(u)&&(c.datum="NAD83"),["nad27","northamericandatum1927","dnorthamerican1927"].includes(u)&&(c.datum="NAD27");let N={newzealand1949:"nzgd49",belge1972:"rnb72"}[u.replace(/^d/,"")];N&&(c.datum=N)}if(r==="ProjectedCRS"&&i.id){let E=be(i.id),N=String(E.authority)+"_"+String(E.code);Object.prototype.hasOwnProperty.call(l,N)&&(c.datum=N)}o.towgs84!==void 0&&(c.towgs84=Xh(o.towgs84).map(cr).join(","),delete c.datum);let y=e.coordinate_system?be(e.coordinate_system):{},_=Xh(y.axis).map(be),M=Mr(y.subtype)==="cartesian"&&r==="GeodeticCRS";r!=="ProjectedCRS"&&!M&&y.subtype&&Mr(y.subtype)!=="ellipsoidal"&&Bt("Unsupported coordinate system subtype"),M&&(c.proj="geocent");let b=sn(i.angular_unit,Me),v=sn(_[0]?.unit,r==="ProjectedCRS"||M?1:b);_[1]&&sn(_[1].unit,v)!==v&&Bt("Mixed horizontal axis units are not supported"),M&&_[2]&&sn(_[2].unit,v)!==v&&Bt("Mixed geocentric axis units are not supported");let T=i.prime_meridian||o.prime_meridian;if(T){let E=be(T);c.pm=String(cr(E.longitude)*sn(E.unit,b)/Me)}if(r==="ProjectedCRS"){let E=be(e.conversion),N=Mr(be(E.method).name),B=Xh(E.parameters).map(be),C=N==="stereographicnorthpole"&&!B.some(A=>Mr(A.name).startsWith("scalefactor")),R=C?"stere":QO[N],W=B.filter(A=>["xscale","yscale","xyplanerotation"].includes(Mr(A.name)));if(W.length){let A={xscale:-1,yscale:1,xyplanerotation:90};(R!=="krovak"||W.length!==3||new Set(W.map(P=>Mr(P.name))).size!==3||W.some(P=>{let D=Mr(P.name),F=D==="xyplanerotation"?sn(P.unit,b)/Me:sn(P.unit,1);return Math.abs(cr(P.value)*F-A[D])>1e-10}))&&Bt("Unsupported ESRI Krovak axis adjustment")}(!R||R.startsWith("unsupported"))&&Bt("Unsupported projection method: "+String(be(E.method).name)),c.proj=R==="webmerc"?"merc":R;let j=!1;for(let A of B){let P=Mr(A.name);if(W.includes(A)||P==="auxiliaryspheretype"&&R==="webmerc"&&A.value===0)continue;if(P==="semiminor"&&R==="webmerc"){if(j)throw new Error("Duplicate conversion parameter: semi_minor");j=!0;let V=cr(A.value)*sn(A.unit,1);Math.abs(V-Number(c.a))>4*Number.EPSILON*Number(c.a)&&Bt("Pseudo-Mercator semi_minor must equal the semi-major axis");continue}let D=eB[R]?.[P]||tB[P];if(D||Bt("Unsupported conversion parameter: "+String(A.name)),D==="lat_1"&&N==="stereographicnorthpole"&&!C?D="lat_0":D==="lat_1"&&["merc","webmerc","eqc","stere","cea"].includes(R)&&(D="lat_ts"),c[D]!==void 0)throw new Error("Duplicate conversion parameter: "+D);if(["merc","webmerc"].includes(R)&&D==="lat_0"&&A.value===0)continue;let F=D.startsWith("lat")||D.startsWith("lon")||D==="alpha"||D==="gamma",L=D==="x_0"||D==="y_0",O=cr(A.value)*sn(A.unit,F?b:L?v:1)/(F?Me:1);D.startsWith("lat")&&Math.abs(Math.abs(O)-90)<=4*Number.EPSILON*90&&(O=Math.sign(O)*90),c[D]=String(O)}if(R==="omerc"&&["hotineobliquemercator","hotineobliquemercatorvarianta","hotineobliquemercatorazimuthnaturalorigin"].includes(N)&&(c.no_uoff=void 0),R==="omerc"&&c.lon_0!==void 0&&c.lonc!==void 0&&(Math.abs(Number(c.lon_0)-Number(c.lonc))>1e-10&&Bt("Oblique Mercator central meridian conflicts with projection centre"),delete c.lon_0),N==="stereographicnorthpole"&&Math.abs(Number(c.lat_0))===90&&(c.proj="stere"),R==="lcc"&&c.lat_1===void 0&&(c.lat_1=c.lat_0),N==="polarstereographic"&&c.lat_0!==void 0){if(c.lat_ts!==void 0)throw new Error("Duplicate polar stereographic latitude of true scale");c.lat_ts=c.lat_0,delete c.lat_0}R==="stere"&&(N.includes("polar")||N==="stereographicsouthpole"||C)&&c.lat_0===void 0&&(c.lat_0=Number(c.lat_ts||90)<0?"-90":"90"),R==="webmerc"&&(c.b=c.a,delete c.rf,c.nadgrids="@null")}let S=_.map(E=>iB(E,c,r==="ProjectedCRS")).join("");return S.length===2&&(S+="u"),!M&&/[ud]/.test(S.slice(0,2))&&Bt("Structured CRS vertical-first axes require an explicit PROJ axis definition"),S&&(c.axis=S),(r==="ProjectedCRS"||M)&&(c.to_meter=String(v)),{parameters:c,areaOfUse:n,angularUnit:r==="ProjectedCRS"||M?b:v,verticalUnit:M?1:sn(_[2]?.unit,1)}}function nB(e){let t;if(e!==void 0){let r=be(e),n=cr(r.west_longitude),i=cr(r.south_latitude),o=cr(r.east_longitude),s=cr(r.north_latitude);if(n<-180||n>180||o<-180||o>180||i<-90||s>90||i>=s||n===o)throw new Error("Invalid CRS geographic bounding box");t=[n,i,o,s]}return t}function iB(e,t,r){let n=String(e.direction),i=e.meridian,o=/^(north|south) along ([+-]?(?:\d+(?:\.\d*)?|\.\d+)) deg(?: (east|west))?$/i.exec(n);if(o){if(i!==void 0)throw new Error("Duplicate axis meridian");n=o[1],i={longitude:Number(o[2])*(o[3]?.toLowerCase()==="west"?-1:1)}}if(i!==void 0){let a=Number(t.lat_0),c=a===90;(!r||t.proj!=="stere"||Math.abs(a)!==90||Mr(n)!==(c?"south":"north"))&&Bt("Axis meridians require an outward-facing polar stereographic axis");let l=be(i).longitude,h=typeof l=="number"?cr(l):cr(be(l).value)*sn(be(l).unit,Me)/Me,u=cr((h-Number(t.lon_0||0))/90);Math.abs(u-Math.round(u))>1e-12&&Bt("Non-cardinal axis meridians require an orientation operation");let f=(Math.round(u)%4+4)%4;return(c?"senw":"nesw")[f]}let s=rB[Mr(n)];return s||Bt("Unsupported axis direction: "+n),s}function _m(e,...t){return e.values.filter(r=>r.type==="node"&&t.includes(r.keyword.toUpperCase()))}function de(e,...t){return _m(e,...t)[0]}function le(e,t=0){let r=e.values[t];return r&&r.type!=="node"?r.value:void 0}function Na(e){return e?{name:le(e),conversion_factor:le(e,1)}:void 0}function oB(e,t){let r=le(e,1);if(t&&String(r).toLowerCase()==="unknown"){let n=String(le(e)).toLowerCase(),i=/^(easting|northing|westing|southing)(?:\s*\([a-z]\))?$/.exec(n);if(i)return{easting:"east",northing:"north",westing:"west",southing:"south"}[i[1]]}return r}function sB(e){let t=de(e,"MERIDIAN");if(t)return{longitude:{value:le(t),unit:Na(de(t,"ANGLEUNIT"))}}}function gI(e){let t=de(e,"METHOD","PROJECTION");if(!t)throw new Error("WKT conversion requires a METHOD or PROJECTION");return de(e,"PARAMETERFILE")&&Bt("Grid-based WKT operation is not implemented"),{method:{name:le(t)},parameters:_m(e,"PARAMETER").map(r=>({name:le(r),value:le(r,1),unit:Na(de(r,"ANGLEUNIT","LENGTHUNIT","SCALEUNIT"))}))}}function Zh(e){let t=e.keyword.toUpperCase();if(t==="COMPD_CS"||t==="COMPOUNDCRS")return{type:"CompoundCRS",components:_m(e,"PROJCS","PROJCRS","GEOGCS","GEOGCRS","GEODCRS","BOUNDCRS","VERT_CS","VERTCRS").map(Zh)};if(t==="BOUNDCRS"){let f=de(e,"SOURCECRS"),d=de(e,"TARGETCRS"),m=de(e,"ABRIDGEDTRANSFORMATION");if(!f||!d||!m)throw new Error("Incomplete WKT BoundCRS");let p=_=>{let M=_.values.find(b=>b.type==="node");if(!M)throw new Error("Missing bound CRS component");return M},g=gI(m),y=g.parameters;for(let _ of y)String(_.name).toLowerCase()==="scale difference"&&_.unit===void 0&&(_.value=(Number(_.value)-1)*1e6);return{type:"BoundCRS",source_crs:Zh(p(f)),target_crs:Zh(p(d)),transformation:g}}if(["VERT_CS","VERTCRS"].includes(t))return{type:"VerticalCRS"};let r=["PROJCS","PROJCRS","PROJECTEDCRS"].includes(t),n=["GEOGCS","GEOGCRS","GEODCRS","GEODETICCRS","GEOGRAPHICCRS","BASEGEOGCRS","BASEGEODCRS","GEOCCS"].includes(t);!r&&!n&&Bt("Unsupported WKT CRS: "+t),de(e,"DYNAMIC","DERIVINGCONVERSION","VELOCITYGRID","EXTENSION")&&Bt("Unsupported WKT dynamic/extension operation");let i=de(e,"CS"),o=t==="GEOCCS"||String(le(i||e)).toLowerCase()==="cartesian"&&!r,s=de(e,r||o?"LENGTHUNIT":"ANGLEUNIT","UNIT"),a=_m(e,"AXIS").sort((f,d)=>Number(le(de(f,"ORDER")||f))-Number(le(de(d,"ORDER")||d))).map((f,d)=>({name:le(f),direction:t==="GEOCCS"?["geocentricX","geocentricY","geocentricZ"][d]:oB(f,r),unit:Na(de(f,"ANGLEUNIT","LENGTHUNIT")||(!o&&!r&&/^(up|down)$/i.test(String(le(f,1)))?void 0:s)),meridian:sB(f)}));if(!a.length)for(let f of o?["geocentricX","geocentricY","geocentricZ"]:["east","north"])a.push({name:f,direction:f,unit:Na(s),meridian:void 0});let c=t==="GEOGCS"?void 0:de(e,"ID"),l={type:r?"ProjectedCRS":o?"GeodeticCRS":"GeographicCRS",name:le(e),id:c?{authority:le(c),code:le(c,1)}:void 0,coordinate_system:{subtype:r||o?"Cartesian":"ellipsoidal",axis:a}},h=de(e,"USAGE"),u=de(h||e,"BBOX");if(u&&(l.bbox={south_latitude:le(u,0),west_longitude:le(u,1),north_latitude:le(u,2),east_longitude:le(u,3)}),r){let f=de(e,"GEOGCS","BASEGEOGCRS","BASEGEODCRS","GEODCRS","GEOGCRS");if(!f)throw new Error("Projected WKT requires a base geographic CRS");l.base_crs=Zh(f),l.conversion=gI(de(e,"CONVERSION")||e)}else{let f=de(e,"DATUM","GEODETICDATUM","ENSEMBLE");if(!f)throw new Error("WKT requires a geodetic datum");de(f,"EXTENSION","DYNAMIC")&&Bt("Unsupported datum extension");let d=de(f,"SPHEROID","ELLIPSOID");if(!d)throw new Error("WKT datum requires an ellipsoid");let m=de(f,"TOWGS84");l.datum={name:le(f),ellipsoid:{name:le(d),semi_major_axis:le(d,1),inverse_flattening:le(d,2),unit:Na(de(d,"LENGTHUNIT"))},towgs84:m?.values.map((g,y)=>le(m,y))};let p=de(e,"PRIMEM");p&&(l.prime_meridian={name:le(p),longitude:le(p,1),unit:Na(de(p,"ANGLEUNIT")||(o?void 0:s))}),l.angular_unit=o?void 0:Na(s)}return l}var Hy={name:"wkt",canParse:e=>tr(e)==="wkt",parse(e,t){if(typeof e!="string")throw new Error("Expected serialized WKT");return Ca(Zh(gh(e).root),t)}};Pc();var $y={name:"projjson",canParse:e=>tr(e)==="projjson",parse:(e,t)=>Ca(be(e),t)};Ee();var Yy=1e-12;function Mm(e,t,r,n,i=!1){let o=(t-e.origin[0])/e.step[0],s=(r-e.origin[1])/e.step[1],a=e.size[0],c=e.size[1];if(!i&&(o<-1e-10||s<-1e-10||o>a-1+1e-10||s>c-1+1e-10))return!1;o=Math.max(0,Math.min(a-1,o)),s=Math.max(0,Math.min(c-1,s));let l=Math.min(a-2,Math.floor(o)),h=Math.min(c-2,Math.floor(s)),u=o-l,f=s-h,d=0,m=0;for(let p=0;p<4;p++){let g=p%2,y=p>1,_=(g?u:1-u)*(y?f:1-f);if(_===0)continue;let M=((h+(y?1:0))*a+l+g)*2,b=e.shifts[M],v=e.shifts[M+1];if(!Number.isFinite(b)||!Number.isFinite(v))return!1;d+=_*b,m+=_*v}return n.x=d,n.y=m,!0}function aB(e,t,r,n,i){if(!n)return Mm(e,t,r,i)?(i.x+=t,i.y+=r,!0):!1;for(let a=0;a<2;a++){let c=a===0?t:r;if(c<e.origin[a]-e.maxShift[a]-Yy||c>e.origin[a]+(e.size[a]-1)*e.step[a]+e.maxShift[a]+Yy)return!1}if(!Mm(e,t,r,i,!0))return!1;let o=t-i.x,s=r-i.y;for(let a=0;a<20;a++){if(!Mm(e,o,s,i,!0))return!1;let c=t-o-i.x,l=r-s-i.y;if(o+=c,s+=l,Math.max(Math.abs(c),Math.abs(l))<=Yy)return Mm(e,o,s,i)?(i.x=ve(o),i.y=s,!0):!1}throw new Error("Inverse datum grid shift did not converge")}function yI(e){if(!e.length)throw new Error("Datum grid requires at least one subgrid");let t=e.map(i=>{let[o,s]=i.size;if(![o,s].every(c=>Number.isSafeInteger(c)&&c>=2)||o*s*2!==i.shifts.length||!i.origin.every(Number.isFinite)||!i.step.every(c=>Number.isFinite(c)&&c>0))throw new Error("Invalid datum subgrid geometry or node count");let a=[0,0];for(let c=0;c<i.shifts.length;c++){let l=i.shifts[c];Number.isFinite(l)&&(a[c%2]=Math.max(a[c%2],Math.abs(l)))}return{...i,maxShift:a}}),r=(i,o)=>{let s=i.x,a=i.y;if(!Number.isFinite(s)||!Number.isFinite(a))throw new Error("Grid coordinates must be finite");for(let c of t)if(aB(c,-s,a,o,i))return i.x=-i.x,!0;return i.x=s,i.y=a,!1},n={x:NaN,y:NaN};return Object.freeze({subgridCount:t.length,shiftInPlace:r,shift(i,o,s){return n.x=i,n.y=o,r(n,s)?[n.x,n.y]:void 0}})}var ll=Math.PI/648e3;function Ky(e,t={}){let r=new DataView(e);if(r.byteLength<176)throw new Error("Truncated NTv2 overview header");let n=r.getInt32(8,!0)===11;if(!n&&r.getInt32(8,!1)!==11)throw new Error("Invalid NTv2 header or byte order");let i=u=>r.getInt32(u,n),o=u=>r.getFloat64(u,n),s=u=>String.fromCharCode(...new Uint8Array(e,u,8)).replace(/\0/g,"").trim();if(s(0)!=="NUM_OREC"||i(24)!==11||s(56)!=="SECONDS")throw new Error("Unsupported NTv2 header or shift units");let a=i(40),c=t.includeErrorFields===!1?8:16;if(a<1||a>Math.floor((r.byteLength-176)/(176+4*c)))throw new Error("Invalid NTv2 subgrid count");let l=176,h=[];for(let u=0;u<a;u++){if(l+176>r.byteLength)throw new Error("Truncated NTv2 subgrid header");let f=o(l+72),d=o(l+88),m=o(l+104),p=o(l+120),g=o(l+136),y=o(l+152),_=i(l+168),M=1+(p-m)/y,b=1+(d-f)/g;if(![M,b].every(E=>Number.isFinite(E)&&E>=2&&Math.abs(E-Math.round(E))<1e-7)||!(y>0&&g>0)||_!==Math.round(M)*Math.round(b))throw new Error("Invalid NTv2 subgrid dimensions");let v=l+176,T=v+_*c;if(T>r.byteLength)throw new Error("Truncated NTv2 node records");let S=new Float64Array(_*2);for(let E=0;E<_;E++)S[E*2]=r.getFloat32(v+E*c+4,n)*ll,S[E*2+1]=r.getFloat32(v+E*c,n)*ll;h.push({origin:[m*ll,f*ll],step:[y*ll,g*ll],size:[Math.round(M),Math.round(b)],shifts:S}),l=T}return yI(h)}var bm={ch1903:{towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},ggrs87:{towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},nad27:{nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},potsdam:{towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},carthage:{towgs84:"-263.0,6.0,431.0",ellipse:"clrk80ign",datumName:"Carthage 1934 Tunisia"},hermannskogel:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},mgi:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Militar-Geographische Institut"},osni52:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},ire65:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},rassadiran:{towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},nzgd49:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},osgb36:{towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Ordnance Survey of Great Britain 1936"},s_jtsk:{towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},beduaram:{towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},gunung_segara:{towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},rnb72:{towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"},EPSG_5451:{towgs84:"6.41,-49.05,-11.28,1.5657,0.5242,6.9718,-5.7649"},IGNF_LURESG:{towgs84:"-192.986,13.673,-39.309,-0.4099,-2.9332,2.6881,0.43"},EPSG_4614:{towgs84:"-119.4248,-303.65872,-11.00061,1.164298,0.174458,1.096259,3.657065"},EPSG_4615:{towgs84:"-494.088,-312.129,279.877,-1.423,-1.013,1.59,-0.748"},ESRI_37241:{towgs84:"-76.822,257.457,-12.817,2.136,-0.033,-2.392,-0.031"},ESRI_37249:{towgs84:"-440.296,58.548,296.265,1.128,10.202,4.559,-0.438"},ESRI_37245:{towgs84:"-511.151,-181.269,139.609,1.05,2.703,1.798,3.071"},EPSG_4178:{towgs84:"24.9,-126.4,-93.2,-0.063,-0.247,-0.041,1.01"},EPSG_4622:{towgs84:"-472.29,-5.63,-304.12,0.4362,-0.8374,0.2563,1.8984"},EPSG_4625:{towgs84:"126.93,547.94,130.41,-2.7867,5.1612,-0.8584,13.8227"},EPSG_5252:{towgs84:"0.023,0.036,-0.068,0.00176,0.00912,-0.01136,0.00439"},EPSG_4314:{towgs84:"597.1,71.4,412.1,0.894,0.068,-1.563,7.58"},EPSG_4282:{towgs84:"-178.3,-316.7,-131.5,5.278,6.077,10.979,19.166"},EPSG_4231:{towgs84:"-83.11,-97.38,-117.22,0.005693,-0.044698,0.044285,0.1218"},EPSG_4274:{towgs84:"-230.994,102.591,25.199,0.633,-0.239,0.9,1.95"},EPSG_4134:{towgs84:"-180.624,-225.516,173.919,-0.81,-1.898,8.336,16.71006"},EPSG_4254:{towgs84:"18.38,192.45,96.82,0.056,-0.142,-0.2,-0.0013"},EPSG_4159:{towgs84:"-194.513,-63.978,-25.759,-3.4027,3.756,-3.352,-0.9175"},EPSG_4687:{towgs84:"0.072,-0.507,-0.245,0.0183,-0.0003,0.007,-0.0093"},EPSG_4227:{towgs84:"-83.58,-397.54,458.78,-17.595,-2.847,4.256,3.225"},EPSG_4746:{towgs84:"599.4,72.4,419.2,-0.062,-0.022,-2.723,6.46"},EPSG_4745:{towgs84:"612.4,77,440.2,-0.054,0.057,-2.797,2.55"},EPSG_6311:{towgs84:"8.846,-4.394,-1.122,-0.00237,-0.146528,0.130428,0.783926"},EPSG_4289:{towgs84:"565.7381,50.4018,465.2904,-0.395026,0.330772,-1.876073,4.07244"},EPSG_4230:{towgs84:"-68.863,-134.888,-111.49,-0.53,-0.14,0.57,-3.4"},EPSG_4154:{towgs84:"-123.02,-158.95,-168.47"},EPSG_4156:{towgs84:"570.8,85.7,462.8,4.998,1.587,5.261,3.56"},EPSG_4299:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4179:{towgs84:"33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84"},EPSG_4313:{towgs84:"-106.8686,52.2978,-103.7239,0.3366,-0.457,1.8422,-1.2747"},EPSG_4194:{towgs84:"163.511,127.533,-159.789"},EPSG_4195:{towgs84:"105,326,-102.5"},EPSG_4196:{towgs84:"-45,417,-3.5"},EPSG_4611:{towgs84:"-162.619,-276.959,-161.764,0.067753,-2.243648,-1.158828,-1.094246"},EPSG_4633:{towgs84:"137.092,131.66,91.475,-1.9436,-11.5993,-4.3321,-7.4824"},EPSG_4641:{towgs84:"-408.809,366.856,-412.987,1.8842,-0.5308,2.1655,-121.0993"},EPSG_4643:{towgs84:"-480.26,-438.32,-643.429,16.3119,20.1721,-4.0349,-111.7002"},EPSG_4300:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4188:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4660:{towgs84:"982.6087,552.753,-540.873,6.681627,-31.611492,-19.848161,16.805"},EPSG_4662:{towgs84:"97.295,-263.247,310.882,-1.5999,0.8386,3.1409,13.3259"},EPSG_3906:{towgs84:"577.88891,165.22205,391.18289,4.9145,-0.94729,-13.05098,7.78664"},EPSG_4307:{towgs84:"-209.3622,-87.8162,404.6198,0.0046,3.4784,0.5805,-1.4547"},EPSG_6892:{towgs84:"-76.269,-16.683,68.562,-6.275,10.536,-4.286,-13.686"},EPSG_4690:{towgs84:"221.597,152.441,176.523,2.403,1.3893,0.884,11.4648"},EPSG_4691:{towgs84:"218.769,150.75,176.75,3.5231,2.0037,1.288,10.9817"},EPSG_4629:{towgs84:"72.51,345.411,79.241,-1.5862,-0.8826,-0.5495,1.3653"},EPSG_4630:{towgs84:"165.804,216.213,180.26,-0.6251,-0.4515,-0.0721,7.4111"},EPSG_4692:{towgs84:"217.109,86.452,23.711,0.0183,-0.0003,0.007,-0.0093"},EPSG_9333:{towgs84:"0,0,0,-0.008393,0.000749,-0.010276,0"},EPSG_9059:{towgs84:"0,0,0"},EPSG_4312:{towgs84:"601.705,84.263,485.227,4.7354,1.3145,5.393,-2.3887"},EPSG_4123:{towgs84:"-96.062,-82.428,-121.753,4.801,0.345,-1.376,1.496"},EPSG_4309:{towgs84:"-124.45,183.74,44.64,-0.4384,0.5446,-0.9706,-2.1365"},ESRI_104106:{towgs84:"-283.088,-70.693,117.445,-1.157,0.059,-0.652,-4.058"},EPSG_4281:{towgs84:"-219.247,-73.802,269.529"},EPSG_4322:{towgs84:"0,0,4.5"},EPSG_4324:{towgs84:"0,0,1.9"},EPSG_4284:{towgs84:"43.822,-108.842,-119.585,1.455,-0.761,0.737,0.549"},EPSG_4277:{towgs84:"446.448,-125.157,542.06,0.15,0.247,0.842,-20.489"},EPSG_4207:{towgs84:"-282.1,-72.2,120,-1.529,0.145,-0.89,-4.46"},EPSG_4688:{towgs84:"347.175,1077.618,2623.677,33.9058,-70.6776,9.4013,186.0647"},EPSG_4689:{towgs84:"410.793,54.542,80.501,-2.5596,-2.3517,-0.6594,17.3218"},EPSG_4720:{towgs84:"0,0,4.5"},EPSG_4273:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},EPSG_4240:{towgs84:"204.64,834.74,293.8"},EPSG_4817:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},ESRI_104131:{towgs84:"426.62,142.62,460.09,4.98,4.49,-12.42,-17.1"},EPSG_4265:{towgs84:"-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68"},EPSG_4263:{towgs84:"-111.92,-87.85,114.5,1.875,0.202,0.219,0.032"},EPSG_4298:{towgs84:"-689.5937,623.84046,-65.93566,-0.02331,1.17094,-0.80054,5.88536"},EPSG_4270:{towgs84:"-253.4392,-148.452,386.5267,0.15605,0.43,-0.1013,-0.0424"},EPSG_4229:{towgs84:"-121.8,98.1,-10.7"},EPSG_4220:{towgs84:"-55.5,-348,-229.2"},EPSG_4214:{towgs84:"12.646,-155.176,-80.863"},EPSG_4232:{towgs84:"-345,3,223"},EPSG_4238:{towgs84:"-1.977,-13.06,-9.993,0.364,0.254,0.689,-1.037"},EPSG_4168:{towgs84:"-170,33,326"},EPSG_4131:{towgs84:"199,931,318.9"},EPSG_4152:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_5228:{towgs84:"572.213,85.334,461.94,4.9732,1.529,5.2484,3.5378"},EPSG_8351:{towgs84:"485.021,169.465,483.839,7.786342,4.397554,4.102655,0"},EPSG_4683:{towgs84:"-127.62,-67.24,-47.04,-3.068,4.903,1.578,-1.06"},EPSG_4133:{towgs84:"0,0,0"},EPSG_7373:{towgs84:"0.819,-0.5762,-1.6446,-0.00378,-0.03317,0.00318,0.0693"},EPSG_9075:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9072:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9294:{towgs84:"1.16835,-1.42001,-2.24431,-0.00822,-0.05508,0.01818,0.23388"},EPSG_4212:{towgs84:"-267.434,173.496,181.814,-13.4704,8.7154,7.3926,14.7492"},EPSG_4191:{towgs84:"-44.183,-0.58,-38.489,2.3867,2.7072,-3.5196,-8.2703"},EPSG_4237:{towgs84:"52.684,-71.194,-13.975,-0.312,-0.1063,-0.3729,1.0191"},EPSG_4740:{towgs84:"-1.08,-0.27,-0.9"},EPSG_4124:{towgs84:"419.3836,99.3335,591.3451,0.850389,1.817277,-7.862238,-0.99496"},EPSG_5681:{towgs84:"584.9636,107.7175,413.8067,1.1155,0.2824,-3.1384,7.9922"},EPSG_4141:{towgs84:"23.772,17.49,17.859,-0.3132,-1.85274,1.67299,-5.4262"},EPSG_4204:{towgs84:"-85.645,-273.077,-79.708,2.289,-1.421,2.532,3.194"},EPSG_4319:{towgs84:"226.702,-193.337,-35.371,-2.229,-4.391,9.238,0.9798"},EPSG_4200:{towgs84:"24.82,-131.21,-82.66"},EPSG_4130:{towgs84:"0,0,0"},EPSG_4127:{towgs84:"-82.875,-57.097,-156.768,-2.158,1.524,-0.982,-0.359"},EPSG_4149:{towgs84:"674.374,15.056,405.346"},EPSG_4617:{towgs84:"-0.991,1.9072,0.5129,0.02579,0.00965,0.01166,0"},EPSG_4663:{towgs84:"-210.502,-66.902,-48.476,2.094,-15.067,-5.817,0.485"},EPSG_4664:{towgs84:"-211.939,137.626,58.3,-0.089,0.251,0.079,0.384"},EPSG_4665:{towgs84:"-105.854,165.589,-38.312,-0.003,-0.026,0.024,-0.048"},EPSG_4666:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},EPSG_4756:{towgs84:"-192.873,-39.382,-111.202,-0.00205,-0.0005,0.00335,0.0188"},EPSG_4723:{towgs84:"-179.483,-69.379,-27.584,-7.862,8.163,6.042,-13.925"},EPSG_4726:{towgs84:"8.853,-52.644,180.304,-0.393,-2.323,2.96,-24.081"},EPSG_4267:{towgs84:"-8.0,160.0,176.0"},EPSG_5365:{towgs84:"-0.16959,0.35312,0.51846,0.03385,-0.16325,0.03446,0.03693"},EPSG_4218:{towgs84:"304.5,306.5,-318.1"},EPSG_4242:{towgs84:"-33.722,153.789,94.959,-8.581,-4.478,4.54,8.95"},EPSG_4216:{towgs84:"-292.295,248.758,429.447,4.9971,2.99,6.6906,1.0289"},ESRI_104105:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},ESRI_104129:{towgs84:"0,0,0"},EPSG_4673:{towgs84:"174.05,-25.49,112.57"},EPSG_4202:{towgs84:"-124,-60,154"},EPSG_4203:{towgs84:"-117.763,-51.51,139.061,0.292,0.443,0.277,-0.191"},EPSG_3819:{towgs84:"595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408"},EPSG_8694:{towgs84:"-93.799,-132.737,-219.073,-1.844,0.648,-6.37,-0.169"},EPSG_4145:{towgs84:"275.57,676.78,229.6"},EPSG_4283:{towgs84:"0.06155,-0.01087,-0.04019,0.039492,0.032722,0.032898,-0.009994"},EPSG_4317:{towgs84:"2.3287,-147.0425,-92.0802,-0.309248,0.324822,0.497299,5.689063"},EPSG_4272:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993"},EPSG_4248:{towgs84:"-307.7,265.3,-363.5"},EPSG_5561:{towgs84:"24,-121,-76"},EPSG_5233:{towgs84:"-0.293,766.95,87.713,0.195704,1.695068,3.473016,-0.039338"},ESRI_104130:{towgs84:"-86,-98,-119"},ESRI_104102:{towgs84:"682,-203,480"},ESRI_37207:{towgs84:"7,-10,-26"},EPSG_4675:{towgs84:"59.935,118.4,-10.871"},ESRI_104109:{towgs84:"-89.121,-348.182,260.871"},ESRI_104112:{towgs84:"-185.583,-230.096,281.361"},ESRI_104113:{towgs84:"25.1,-275.6,222.6"},IGNF_WGS72G:{towgs84:"0,12,6"},IGNF_NTFG:{towgs84:"-168,-60,320"},IGNF_EFATE57G:{towgs84:"-127,-769,472"},IGNF_PGP50G:{towgs84:"324.8,153.6,172.1"},IGNF_REUN47G:{towgs84:"94,-948,-1262"},IGNF_CSG67G:{towgs84:"-186,230,110"},IGNF_GUAD48G:{towgs84:"-467,-16,-300"},IGNF_TAHI51G:{towgs84:"162,117,154"},IGNF_TAHAAG:{towgs84:"65,342,77"},IGNF_NUKU72G:{towgs84:"84,274,65"},IGNF_PETRELS72G:{towgs84:"365,194,166"},IGNF_WALL78G:{towgs84:"253,-133,-127"},IGNF_MAYO50G:{towgs84:"-382,-59,-262"},IGNF_TANNAG:{towgs84:"-139,-967,436"},IGNF_IGN72G:{towgs84:"-13,-348,292"},IGNF_ATIGG:{towgs84:"1118,23,66"},IGNF_FANGA84G:{towgs84:"150.57,158.33,118.32"},IGNF_RUSAT84G:{towgs84:"202.13,174.6,-15.74"},IGNF_KAUE70G:{towgs84:"126.74,300.1,-75.49"},IGNF_MOP90G:{towgs84:"-10.8,-1.8,12.77"},IGNF_MHPF67G:{towgs84:"338.08,212.58,-296.17"},IGNF_TAHI79G:{towgs84:"160.61,116.05,153.69"},IGNF_ANAA92G:{towgs84:"1.5,3.84,4.81"},IGNF_MARQUI72G:{towgs84:"330.91,-13.92,58.56"},IGNF_APAT86G:{towgs84:"143.6,197.82,74.05"},IGNF_TUBU69G:{towgs84:"237.17,171.61,-77.84"},IGNF_STPM50G:{towgs84:"11.363,424.148,373.13"},EPSG_4150:{towgs84:"674.374,15.056,405.346"},EPSG_4754:{towgs84:"-208.4058,-109.8777,-2.5764"},ESRI_104101:{towgs84:"372.87,149.23,585.29"},EPSG_4693:{towgs84:"0,-0.15,0.68"},EPSG_6207:{towgs84:"293.17,726.18,245.36"},EPSG_4153:{towgs84:"-133.63,-157.5,-158.62"},EPSG_4132:{towgs84:"-241.54,-163.64,396.06"},EPSG_4221:{towgs84:"-154.5,150.7,100.4"},EPSG_4266:{towgs84:"-80.7,-132.5,41.1"},EPSG_4193:{towgs84:"-70.9,-151.8,-41.4"},EPSG_5340:{towgs84:"-0.41,0.46,-0.35"},EPSG_4246:{towgs84:"-294.7,-200.1,525.5"},EPSG_4318:{towgs84:"-3.2,-5.7,2.8"},EPSG_4121:{towgs84:"-199.87,74.79,246.62"},EPSG_4223:{towgs84:"-260.1,5.5,432.2"},EPSG_4158:{towgs84:"-0.465,372.095,171.736"},EPSG_4285:{towgs84:"-128.16,-282.42,21.93"},EPSG_4613:{towgs84:"-404.78,685.68,45.47"},EPSG_4607:{towgs84:"195.671,332.517,274.607"},EPSG_4475:{towgs84:"-381.788,-57.501,-256.673"},EPSG_4208:{towgs84:"-157.84,308.54,-146.6"},EPSG_4743:{towgs84:"70.995,-335.916,262.898"},EPSG_4710:{towgs84:"-323.65,551.39,-491.22"},EPSG_7881:{towgs84:"-0.077,0.079,0.086"},EPSG_4682:{towgs84:"283.729,735.942,261.143"},EPSG_4739:{towgs84:"-156,-271,-189"},EPSG_4679:{towgs84:"-80.01,253.26,291.19"},EPSG_4750:{towgs84:"-56.263,16.136,-22.856"},EPSG_4644:{towgs84:"-10.18,-350.43,291.37"},EPSG_4695:{towgs84:"-103.746,-9.614,-255.95"},EPSG_4292:{towgs84:"-355,21,72"},EPSG_4302:{towgs84:"-61.702,284.488,472.052"},EPSG_4143:{towgs84:"-124.76,53,466.79"},EPSG_4606:{towgs84:"-153,153,307"},EPSG_4699:{towgs84:"-770.1,158.4,-498.2"},EPSG_4247:{towgs84:"-273.5,110.6,-357.9"},EPSG_4160:{towgs84:"8.88,184.86,106.69"},EPSG_4161:{towgs84:"-233.43,6.65,173.64"},EPSG_9251:{towgs84:"-9.5,122.9,138.2"},EPSG_9253:{towgs84:"-78.1,101.6,133.3"},EPSG_4297:{towgs84:"-198.383,-240.517,-107.909"},EPSG_4269:{towgs84:"0,0,0"},EPSG_4301:{towgs84:"-147,506,687"},EPSG_4618:{towgs84:"-59,-11,-52"},EPSG_4612:{towgs84:"0,0,0"},EPSG_4678:{towgs84:"44.585,-131.212,-39.544"},EPSG_4250:{towgs84:"-130,29,364"},EPSG_4144:{towgs84:"214,804,268"},EPSG_4147:{towgs84:"-17.51,-108.32,-62.39"},EPSG_4259:{towgs84:"-254.1,-5.36,-100.29"},EPSG_4164:{towgs84:"-76,-138,67"},EPSG_4211:{towgs84:"-378.873,676.002,-46.255"},EPSG_4182:{towgs84:"-422.651,-172.995,84.02"},EPSG_4224:{towgs84:"-143.87,243.37,-33.52"},EPSG_4225:{towgs84:"-205.57,168.77,-4.12"},EPSG_5527:{towgs84:"-67.35,3.88,-38.22"},EPSG_4752:{towgs84:"98,390,-22"},EPSG_4310:{towgs84:"-30,190,89"},EPSG_9248:{towgs84:"-192.26,65.72,132.08"},EPSG_4680:{towgs84:"124.5,-63.5,-281"},EPSG_4701:{towgs84:"-79.9,-158,-168.9"},EPSG_4706:{towgs84:"-146.21,112.63,4.05"},EPSG_4805:{towgs84:"682,-203,480"},EPSG_4201:{towgs84:"-165,-11,206"},EPSG_4210:{towgs84:"-157,-2,-299"},EPSG_4183:{towgs84:"-104,167,-38"},EPSG_4139:{towgs84:"11,72,-101"},EPSG_4668:{towgs84:"-86,-98,-119"},EPSG_4717:{towgs84:"-2,151,181"},EPSG_4732:{towgs84:"102,52,-38"},EPSG_4280:{towgs84:"-377,681,-50"},EPSG_4209:{towgs84:"-138,-105,-289"},EPSG_4261:{towgs84:"31,146,47"},EPSG_4658:{towgs84:"-73,46,-86"},EPSG_4721:{towgs84:"265.025,384.929,-194.046"},EPSG_4222:{towgs84:"-136,-108,-292"},EPSG_4601:{towgs84:"-255,-15,71"},EPSG_4602:{towgs84:"725,685,536"},EPSG_4603:{towgs84:"72,213.7,93"},EPSG_4605:{towgs84:"9,183,236"},EPSG_4621:{towgs84:"137,248,-430"},EPSG_4657:{towgs84:"-28,199,5"},EPSG_4316:{towgs84:"103.25,-100.4,-307.19"},EPSG_4642:{towgs84:"-13,-348,292"},EPSG_4698:{towgs84:"145,-187,103"},EPSG_4192:{towgs84:"-206.1,-174.7,-87.7"},EPSG_4311:{towgs84:"-265,120,-358"},EPSG_4135:{towgs84:"58,-283,-182"},ESRI_104138:{towgs84:"198,-226,-347"},EPSG_4245:{towgs84:"-11,851,5"},EPSG_4142:{towgs84:"-125,53,467"},EPSG_4213:{towgs84:"-106,-87,188"},EPSG_4253:{towgs84:"-133,-77,-51"},EPSG_4129:{towgs84:"-132,-110,-335"},EPSG_4713:{towgs84:"-77,-128,142"},EPSG_4239:{towgs84:"217,823,299"},EPSG_4146:{towgs84:"295,736,257"},EPSG_4155:{towgs84:"-83,37,124"},EPSG_4165:{towgs84:"-173,253,27"},EPSG_4672:{towgs84:"175,-38,113"},EPSG_4236:{towgs84:"-637,-549,-203"},EPSG_4251:{towgs84:"-90,40,88"},EPSG_4271:{towgs84:"-2,374,172"},EPSG_4175:{towgs84:"-88,4,101"},EPSG_4716:{towgs84:"298,-304,-375"},EPSG_4315:{towgs84:"-23,259,-9"},EPSG_4744:{towgs84:"-242.2,-144.9,370.3"},EPSG_4244:{towgs84:"-97,787,86"},EPSG_4293:{towgs84:"616,97,-251"},EPSG_4714:{towgs84:"-127,-769,472"},EPSG_4736:{towgs84:"260,12,-147"},EPSG_6883:{towgs84:"-235,-110,393"},EPSG_6894:{towgs84:"-63,176,185"},EPSG_4205:{towgs84:"-43,-163,45"},EPSG_4256:{towgs84:"41,-220,-134"},EPSG_4262:{towgs84:"639,405,60"},EPSG_4604:{towgs84:"174,359,365"},EPSG_4169:{towgs84:"-115,118,426"},EPSG_4620:{towgs84:"-106,-129,165"},EPSG_4184:{towgs84:"-203,141,53"},EPSG_4616:{towgs84:"-289,-124,60"},EPSG_9403:{towgs84:"-307,-92,127"},EPSG_4684:{towgs84:"-133,-321,50"},EPSG_4708:{towgs84:"-491,-22,435"},EPSG_4707:{towgs84:"114,-116,-333"},EPSG_4709:{towgs84:"145,75,-272"},EPSG_4712:{towgs84:"-205,107,53"},EPSG_4711:{towgs84:"124,-234,-25"},EPSG_4718:{towgs84:"230,-199,-752"},EPSG_4719:{towgs84:"211,147,111"},EPSG_4724:{towgs84:"208,-435,-229"},EPSG_4725:{towgs84:"189,-79,-202"},EPSG_4735:{towgs84:"647,1777,-1124"},EPSG_4722:{towgs84:"-794,119,-298"},EPSG_4728:{towgs84:"-307,-92,127"},EPSG_4734:{towgs84:"-632,438,-609"},EPSG_4727:{towgs84:"912,-58,1227"},EPSG_4729:{towgs84:"185,165,42"},EPSG_4730:{towgs84:"170,42,84"},EPSG_4733:{towgs84:"276,-57,149"},ESRI_37218:{towgs84:"230,-199,-752"},ESRI_37240:{towgs84:"-7,215,225"},ESRI_37221:{towgs84:"252,-209,-751"},ESRI_4305:{towgs84:"-123,-206,219"},ESRI_104139:{towgs84:"-73,-247,227"},EPSG_4748:{towgs84:"51,391,-36"},EPSG_4219:{towgs84:"-384,664,-48"},EPSG_4255:{towgs84:"-333,-222,114"},EPSG_4257:{towgs84:"-587.8,519.75,145.76"},EPSG_4646:{towgs84:"-963,510,-359"},EPSG_6881:{towgs84:"-24,-203,268"},EPSG_6882:{towgs84:"-183,-15,273"},EPSG_4715:{towgs84:"-104,-129,239"},IGNF_RGF93GDD:{towgs84:"0,0,0"},IGNF_RGM04GDD:{towgs84:"0,0,0"},IGNF_RGSPM06GDD:{towgs84:"0,0,0"},IGNF_RGTAAF07GDD:{towgs84:"0,0,0"},IGNF_RGFG95GDD:{towgs84:"0,0,0"},IGNF_RGNCG:{towgs84:"0,0,0"},IGNF_RGPFGDD:{towgs84:"0,0,0"},IGNF_ETRS89G:{towgs84:"0,0,0"},IGNF_RGR92GDD:{towgs84:"0,0,0"},EPSG_4173:{towgs84:"0,0,0"},EPSG_4180:{towgs84:"0,0,0"},EPSG_4619:{towgs84:"0,0,0"},EPSG_4667:{towgs84:"0,0,0"},EPSG_4075:{towgs84:"0,0,0"},EPSG_6706:{towgs84:"0,0,0"},EPSG_7798:{towgs84:"0,0,0"},EPSG_4661:{towgs84:"0,0,0"},EPSG_4669:{towgs84:"0,0,0"},EPSG_8685:{towgs84:"0,0,0"},EPSG_4151:{towgs84:"0,0,0"},EPSG_9702:{towgs84:"0,0,0"},EPSG_4758:{towgs84:"0,0,0"},EPSG_4761:{towgs84:"0,0,0"},EPSG_4765:{towgs84:"0,0,0"},EPSG_8997:{towgs84:"0,0,0"},EPSG_4023:{towgs84:"0,0,0"},EPSG_4670:{towgs84:"0,0,0"},EPSG_4694:{towgs84:"0,0,0"},EPSG_4148:{towgs84:"0,0,0"},EPSG_4163:{towgs84:"0,0,0"},EPSG_4167:{towgs84:"0,0,0"},EPSG_4189:{towgs84:"0,0,0"},EPSG_4190:{towgs84:"0,0,0"},EPSG_4176:{towgs84:"0,0,0"},EPSG_4659:{towgs84:"0,0,0"},EPSG_3824:{towgs84:"0,0,0"},EPSG_3889:{towgs84:"0,0,0"},EPSG_4046:{towgs84:"0,0,0"},EPSG_4081:{towgs84:"0,0,0"},EPSG_4558:{towgs84:"0,0,0"},EPSG_4483:{towgs84:"0,0,0"},EPSG_5013:{towgs84:"0,0,0"},EPSG_5264:{towgs84:"0,0,0"},EPSG_5324:{towgs84:"0,0,0"},EPSG_5354:{towgs84:"0,0,0"},EPSG_5371:{towgs84:"0,0,0"},EPSG_5373:{towgs84:"0,0,0"},EPSG_5381:{towgs84:"0,0,0"},EPSG_5393:{towgs84:"0,0,0"},EPSG_5489:{towgs84:"0,0,0"},EPSG_5593:{towgs84:"0,0,0"},EPSG_6135:{towgs84:"0,0,0"},EPSG_6365:{towgs84:"0,0,0"},EPSG_5246:{towgs84:"0,0,0"},EPSG_7886:{towgs84:"0,0,0"},EPSG_8431:{towgs84:"0,0,0"},EPSG_8427:{towgs84:"0,0,0"},EPSG_8699:{towgs84:"0,0,0"},EPSG_8818:{towgs84:"0,0,0"},EPSG_4757:{towgs84:"0,0,0"},EPSG_9140:{towgs84:"0,0,0"},EPSG_8086:{towgs84:"0,0,0"},EPSG_4686:{towgs84:"0,0,0"},EPSG_4737:{towgs84:"0,0,0"},EPSG_4702:{towgs84:"0,0,0"},EPSG_4747:{towgs84:"0,0,0"},EPSG_4749:{towgs84:"0,0,0"},EPSG_4674:{towgs84:"0,0,0"},EPSG_4755:{towgs84:"0,0,0"},EPSG_4759:{towgs84:"0,0,0"},EPSG_4762:{towgs84:"0,0,0"},EPSG_4763:{towgs84:"0,0,0"},EPSG_4764:{towgs84:"0,0,0"},EPSG_4166:{towgs84:"0,0,0"},EPSG_4170:{towgs84:"0,0,0"},EPSG_5546:{towgs84:"0,0,0"},EPSG_7844:{towgs84:"0,0,0"},EPSG_4818:{towgs84:"589,76,480"},EPSG_10328:{towgs84:"0,0,0"},EPSG_9782:{towgs84:"0,0,0"},EPSG_9777:{towgs84:"0,0,0"},EPSG_10690:{towgs84:"0,0,0"},EPSG_10639:{towgs84:"0,0,0"},EPSG_10739:{towgs84:"0,0,0"},EPSG_7686:{towgs84:"0,0,0"},EPSG_8900:{towgs84:"0,0,0"},EPSG_5886:{towgs84:"0,0,0"},EPSG_7683:{towgs84:"0,0,0"},EPSG_6668:{towgs84:"0,0,0"},EPSG_20046:{towgs84:"0,0,0"},EPSG_10299:{towgs84:"0,0,0"},EPSG_10310:{towgs84:"0,0,0"},EPSG_10475:{towgs84:"0,0,0"},EPSG_4742:{towgs84:"0,0,0"},EPSG_10671:{towgs84:"0,0,0"},EPSG_10762:{towgs84:"0,0,0"},EPSG_10725:{towgs84:"0,0,0"},EPSG_10791:{towgs84:"0,0,0"},EPSG_10800:{towgs84:"0,0,0"},EPSG_10305:{towgs84:"0,0,0"},EPSG_10941:{towgs84:"0,0,0"},EPSG_10968:{towgs84:"0,0,0"},EPSG_10875:{towgs84:"0,0,0"},EPSG_6318:{towgs84:"0,0,0"},EPSG_10910:{towgs84:"0,0,0"}};for(let e in bm){let t=bm[e];t.datumName&&(bm[t.datumName]=t)}var wI=bm;var _I=Object.freeze({name:"regional-datums",datums:Object.freeze(wI)});function cB(e){return{...e,parse(t,r){let n=e.parse(t,r),i=n.parameters.datum,o=s=>s.toLowerCase().replace(/[\s_-]/g,"");if(i&&!Object.keys(Jc(r)).some(s=>o(s)===o(i))){let s={...n.parameters};return delete s.datum,{...n,parameters:s}}return n}}}var lB=[Hy,$y].map(cB),xm;function hB(){if(xm)return xm;let e=[ny,iy,oy,sy,ay,hy,E1,uy,my,_1,M1,x1,py,yy,My,by,xy,Ey,Ty,Iy,Ay,Ry,Cy,Ny,Oy,By,Ly,Dy,Fy,Uy,Gy,zy,Vy,ky,qy],t=i=>i.toLowerCase().replace(/[\s_-]/g,""),r=wm("longlat"),n={name:r.name,aliases:r.aliases,parameters:[...new Set([...r.parameters,...e.flatMap(i=>i.parameters)])],flags:[...new Set(e.flatMap(i=>i.flags||[]))],create(i){let o=i.parameters.o_proj;if(!o)throw new Error("Oblique transformation requires +o_proj");let s=["longlat","latlong","latlon","lonlat","identity"].includes(t(o))?"longlat":e.find(l=>[l.name,...l.aliases||[]].some(h=>t(h)===t(o)));if(!s)throw new Error("Unknown oblique transformation projection: "+o);let a=wm(s),c=new Set([...Qd,...a.parameters]);for(let l of Object.keys(i.parameters))if(!c.has(l))throw new Error("Unsupported PROJ parameter: +"+l);return a.create(i)}};return xm=[...e,n],xm}var ls=class extends cm{constructor(t={}){super({...t,projections:t.projections??hB(),parsers:t.parsers??lB,datumCatalogs:t.datumCatalogs??[_I]}),this.useDefinitionSignature=!Yh(t)}},uB=new ls;var MI=new Map,Xy={},Zy={},Jy=new ls;function bI(){return Jy}function xI(e,t){tw(e,"CRS"),Xy[e]=t,Jy=new ls({aliases:Xy,datumGrids:Zy})}function SI(e,t){tw(e,"datum grid"),Zy[e]=Ky(t),Jy=new ls({aliases:Xy,datumGrids:Zy})}function Qy(e,t){tw(e,"geoid model"),MI.set(e,t)}function vI(e,t,r={}){let n=Zd(t,r);return Qy(e,n),n}function Sm(e){return MI.get(e)}function tw(e,t){if(!e.trim())throw new Error(`${t} name must not be empty`)}var $n=class{spatialReference;horizontalProjection;horizontalProjectionBuffer;geographicProjection;heightOutputProjection;sourceIsGeocentric;outputIsGeocentric;sourceIsGeographic;outputIsGeographic;geoid;constructor(t,r={}){this.spatialReference=t;let n=bI();mB(t);let i=t.targetCrs||t.sourceCrs;if(this.sourceIsGeocentric=ew(t.sourceCrs),this.outputIsGeocentric=ew(i),this.sourceIsGeographic=EI(t.sourceCrs),this.outputIsGeographic=EI(i),t.sourceCrs&&t.targetCrs&&!this.sourceIsGeocentric&&!this.outputIsGeocentric&&(this.horizontalProjection=n.createProjection({from:Jh(t.sourceCrs),to:Jh(t.targetCrs),enforceAxis:!1}),hl(t)||(this.horizontalProjectionBuffer=new Xd({projection:this.horizontalProjection,dimension:3}))),(hl(t)||this.sourceIsGeocentric||this.outputIsGeocentric)&&(!this.sourceIsGeographic&&!this.sourceIsGeocentric&&(this.geographicProjection=n.createProjection({from:Jh(t.sourceCrs),to:Yc,enforceAxis:!1})),!this.outputIsGeographic&&!this.outputIsGeocentric&&(this.heightOutputProjection=n.createProjection({from:Yc,to:Jh(i),enforceAxis:!1}))),hl(t)&&(this.geoid=pB(r.geoidModel),!this.geoid)){let o=typeof r.geoidModel=="string"?` "${r.geoidModel}"`:"";throw new Error(`Height conversion requires a registered geoid model${o}; call registerGeoidModel() or pass a parsed Geoid instance`)}}transformPosition(t){if(t.length<2)throw new Error("A spatial coordinate must contain at least x and y components");let r=[...t];if(hl(this.spatialReference)||this.sourceIsGeocentric||this.outputIsGeocentric){if(r.length<3||!Number.isFinite(r[2]))throw new Error("Three-dimensional CRS conversion requires a finite z coordinate");let n=this.toGeographic(r);if(hl(this.spatialReference)){let o=this.geoid.getHeight(n[1],n[0]);n[2]=gB(n[2],o,this.spatialReference.heightReference,this.spatialReference.targetHeightReference)}let i=this.fromGeographic(n);return r.splice(0,i.length,...i),r}if(this.horizontalProjection){let n=this.horizontalProjection.projectSync(r.slice(0,3));r.splice(0,n.length,...n)}return r}transformPositions(t){if(t.length%3!==0)throw new Error("Packed spatial positions must contain a multiple of three components");let r=new Float64Array(t.length);if(this.horizontalProjectionBuffer&&(r.set(t),r.every(Number.isFinite)))return this.horizontalProjectionBuffer.projectFlatTo(r,r);for(let n=0;n<t.length;n+=3){let i=this.transformPosition([Number(t[n]),Number(t[n+1]),Number(t[n+2])]);r[n]=i[0],r[n+1]=i[1],r[n+2]=i[2]}return r}transformNormals(t,r){if(t.length!==r.length||t.length%3!==0)throw new Error("Spatial normals and positions must have matching xyz component counts");let n=new Float32Array(t.length),i=1e-5;for(let o=0;o<t.length;o+=3){let s=[Number(r[o]),Number(r[o+1]),Number(r[o+2])],a=[Number(t[o]),Number(t[o+1]),Number(t[o+2])],c=fB(this,s,i),l=dB(c,a),h=Math.hypot(...l);h>0&&Number.isFinite(h)?(n[o]=l[0]/h,n[o+1]=l[1]/h,n[o+2]=l[2]/h):(n[o]=a[0],n[o+1]=a[1],n[o+2]=a[2])}return n}toGeographic(t){return this.sourceIsGeocentric?Array.from(pt.WGS84.cartesianToCartographic(new I(t))):this.sourceIsGeographic?t.slice(0,3):this.geographicProjection.projectSync(t.slice(0,3))}fromGeographic(t){return this.outputIsGeocentric?Array.from(pt.WGS84.cartographicToCartesian(new I(t))):this.outputIsGeographic?t.slice(0,3):this.heightOutputProjection.projectSync(t.slice(0,3))}};function fB(e,t,r){let n=[];for(let i=0;i<3;i++){let o=t.slice(),s=t.slice();o[i]+=r,s[i]-=r;let a=e.transformPosition(o),c=e.transformPosition(s);n.push([(a[0]-c[0])/(2*r),(a[1]-c[1])/(2*r),(a[2]-c[2])/(2*r)])}return n}function dB(e,t){let[r,n,i]=e,o=r[0]*(n[1]*i[2]-n[2]*i[1])-n[0]*(r[1]*i[2]-r[2]*i[1])+i[0]*(r[1]*n[2]-r[2]*n[1]);return!Number.isFinite(o)||Math.abs(o)<1e-15?t:[[n[1]*i[2]-n[2]*i[1],r[2]*i[1]-r[1]*i[2],r[1]*n[2]-r[2]*n[1]],[n[2]*i[0]-n[0]*i[2],r[0]*i[2]-r[2]*i[0],r[2]*n[0]-r[0]*n[2]],[n[0]*i[1]-n[1]*i[0],r[1]*i[0]-r[0]*i[1],r[0]*n[1]-r[1]*n[0]]].map(a=>(a[0]*t[0]+a[1]*t[1]+a[2]*t[2])/o)}function Jh(e){if(!e)throw new Error("Cannot construct a projection because the CRS is unknown");if(typeof e!="string"&&e.type==="CompoundCRS"){let t=e.components.filter(r=>r.type!=="VerticalCRS");if(t.length!==1)throw new Error("CompoundCRS requires exactly one horizontal component");return Jh(t[0])}return e}function mB(e){if(e.outputCoordinates==="local-enu")throw new Error("local-enu output requires a dataset-derived local origin and must be created by a tileset source");if(e.outputCoordinates==="target-crs"&&!e.targetCrs)throw new Error("target-crs output requires targetCrs");if(!e.sourceCrs&&e.status==="unresolved")throw new Error("Cannot transform coordinates because the source CRS is unknown");if(hl(e)&&e.heightReference==="unknown")throw new Error("Cannot convert heights because the source height reference is unknown");if(e.coordinateFrame==="geocentric"&&!ew(e.sourceCrs))throw new Error("Only EPSG:4978 geocentric coordinates are supported by the current spatial transformer");if(e.status==="unresolved")throw new Error("The requested spatial output cannot be resolved from the available metadata")}function ew(e){return typeof e=="string"&&Gh(e)===Ld}function EI(e){if(typeof e!="string")return!1;let t=Gh(e);return t===Yc||t==="EPSG:4979"||t==="OGC:CRS84"}function hl(e){let t=e.targetHeightReference;return t!=="native"&&t!==e.heightReference}function pB(e){return typeof e=="string"?Sm(e):e}function gB(e,t,r,n){if(r===n||n==="native")return e;if(r==="orthometric"&&n==="ellipsoidal")return e+t;if(r==="ellipsoidal"&&n==="orthometric")return e-t;throw new Error(`Unsupported height conversion from ${r} to ${n}`)}qt();var hs=class{spatialReference;coordinateTransformer;geographicCoordinateTransformer;constructor(t,r={}){this.coordinateTransformer=new $n(t,r);let n={...t,sourceCrs:"EPSG:4326",targetCrs:t.targetCrs||t.sourceCrs,coordinateFrame:"geographic",axisOrder:"xy"};this.geographicCoordinateTransformer=new $n(n,r),this.spatialReference=t}transformPositions(t){return this.coordinateTransformer.transformPositions(t)}transformNormals(t,r){return this.coordinateTransformer.transformNormals(t,r)}transformBoundingVolume(t,r){let n=r?new bt(Array.from(r)):void 0,i=t.region?yB(t.region):wB(t).map(s=>n?Array.from(n.transformAsPoint(s)):s);if(!i.length)return t;let o=t.region?i.map(s=>this.transformRegionSample(s)):i.map(s=>this.coordinateTransformer.transformPosition(s));return{box:_B(o)}}transformRegionSample(t){return this.geographicCoordinateTransformer.transformPosition(t)}};function yB(e){if(e.length<6||e.some(u=>!Number.isFinite(u)))return[];let[t,r,n,i,o,s]=e,a=n<t?n+Math.PI*2:n,c=TI(t,a),l=TI(r,i),h=[];for(let u of c)for(let f of l)for(let d of[o,s])h.push([u*180/Math.PI,f*180/Math.PI,d]);return h}function TI(e,t){let r=[e,(e+t)/2,t],n=Math.PI/2,i=Math.ceil(e/n),o=Math.floor(t/n);for(let s=i;s<=o;s++)r.push(s*n);return r}function wB(e){if(e.box&&e.box.length>=12){let t=e.box.slice(0,3),r=[e.box.slice(3,6),e.box.slice(6,9),e.box.slice(9,12)],n=[];for(let i=0;i<=4;i++)for(let o=0;o<=4;o++)for(let s=0;s<=4;s++){let a=i/2-1,c=o/2-1,l=s/2-1;n.push([t[0]+a*r[0][0]+c*r[1][0]+l*r[2][0],t[1]+a*r[0][1]+c*r[1][1]+l*r[2][1],t[2]+a*r[0][2]+c*r[1][2]+l*r[2][2]])}return n}if(e.sphere&&e.sphere.length>=4){let[t,r,n,i]=e.sphere,o=[[t-i,r,n],[t+i,r,n],[t,r-i,n],[t,r+i,n],[t,r,n-i],[t,r,n+i]];for(let s=0;s<16;s++){let a=s*Math.PI*2/16;o.push([t+i*Math.cos(a),r+i*Math.sin(a),n])}return o}return[]}function _B(e){let t=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0];for(let o of e)for(let s=0;s<3;s++)t[s]=Math.min(t[s],o[s]),r[s]=Math.max(r[s],o[s]);let n=[Math.max((r[0]-t[0])*.01,1e-9),Math.max((r[1]-t[1])*.01,1e-9),Math.max((r[2]-t[2])*.01,1e-9)];return[...[(t[0]+r[0])/2,(t[1]+r[1])/2,(t[2]+r[2])/2],(r[0]-t[0])/2+n[0],0,0,0,(r[1]-t[1])/2+n[1],0,0,0,(r[2]-t[2])/2+n[2]]}function II(e,t){let r=e.map(([c,l])=>[c,l]);if(r.length===0)return r;let n=1/0,i=-1/0;for(let[c]of e)n=Math.min(n,c),i=Math.max(i,c);if(i-n>=360)return r;let o=t??r[0][0];for(let c of r){let l=c[0]-o;l>180?c[0]-=360*Math.ceil((l-180)/360):l<-180&&(c[0]+=360*Math.ceil((-l-180)/360)),o=c[0]}let s=e[0],a=e[e.length-1];if(s[0]===a[0]&&s[1]===a[1]){if(Math.abs(r[r.length-1][0]-r[0][0])>180)return e.map(([c,l])=>[c,l]);r[r.length-1]=[...r[0]]}return r}function MB(e){let t=1/0,r=1/0,n=-1/0,i=-1/0;for(let[o,s]of e)t=Math.min(t,o),r=Math.min(r,s),n=Math.max(n,o),i=Math.max(i,s);return[[t,r],[n,i]]}function AI(e){let t=(r,n)=>{let i=e.cellToBoundary(r);return n?.unwrap?II(i,n.referenceLongitude):i};return{...e,cellToBoundary:t,cellToBoundaryFlat:(r,n)=>n?.unwrap?t(r,n).flat():e.cellToBoundaryFlat(r),cellToBounds:(r,n)=>{let i=e.cellToBounds(r);if(!n?.unwrap||i[1][0]-i[0][0]>=360)return i;let o=MB(t(r,n));return o[0][1]=i[0][1],o[1][1]=i[1][1],o}}}var bB=(1n<<64n)-1n,xB=0x1555555555555555n;function ul(e){if(e==="X")return 0n;if(!PI(e))throw new Error(`Invalid S2 token: ${e}`);let t=e.padEnd(16,"0");return BigInt(`0x${t}`)}function Qh(e){if(e===0n)return"X";if(!fl(e))throw new Error(`Invalid S2 index: ${e}`);let t=SB(e),r=t%4;t=(t-r)/4;let n=t;t*=4;let o=(e>>BigInt(t)).toString(16).replace(/0+$/,"");return Array(17-n-o.length).join("0")+o}function fl(e){if(typeof e!="bigint"||e<=0n||e>bB)return!1;let t=e>>61n,r=e&-e;return t<6n&&(r&xB)!==0n}function PI(e){if(typeof e!="string"||!/^[0-9a-fA-F]{1,16}$/.test(e)||e.endsWith("0"))return!1;let t=e.padEnd(16,"0");return fl(BigInt(`0x${t}`))}function SB(e){let t=0;for(;e%2n===0n;)e/=2n,t++;return t}function dl(e){if(!fl(e))throw new Error(`Invalid S2 index: ${e}`);let t=AB(e);return IB(t)}var vB=3,rw=30,EB=2*rw+1,RI=180/Math.PI,TB={a:[[0,"d"],[1,"a"],[3,"b"],[2,"a"]],b:[[2,"b"],[1,"b"],[3,"a"],[0,"c"]],c:[[2,"c"],[3,"d"],[1,"c"],[0,"b"]],d:[[0,"a"],[3,"c"],[1,"d"],[2,"d"]]};function IB(e){if(!/^[0-5]\/[0-3]{0,30}$/.test(e))throw new Error(`Invalid S2 Hilbert quadkey: ${e}`);let t=e.split("/"),r=parseInt(t[0],10),n=t[1]||"",i=n.length,o=0,s=[0,0];for(let a=i-1;a>=0;a--){o=i-a;let c=n[a],l=0,h=0;c==="1"?h=1:c==="2"?(l=1,h=1):c==="3"&&(l=1);let u=Math.pow(2,o-1);PB(u,s,l,h),s[0]+=u*l,s[1]+=u*h}if(r%2===1){let a=s[0];s[0]=s[1],s[1]=a}return{face:r,ij:s,level:o}}function AB(e){if(!fl(e))throw new Error(`Invalid S2 index: ${e}`);let t=e.toString(2);for(;t.length<vB+EB;)t="0"+t;let r=t.lastIndexOf("1"),n=t.substring(0,3),i=t.substring(3,r),o=i.length/2,s=BigInt(`0b${n}`).toString(10),a="";if(o!==0)for(a=BigInt(`0b${i}`).toString(4);a.length<o;)a="0"+a;return`${s}/${a}`}function NI(e){let{face:t,ij:r,level:n}=e;if(!Number.isInteger(t)||t<0||t>5)throw new Error(`Invalid S2 face: ${t}`);if(!Number.isInteger(n)||n<0||n>rw)throw new Error(`Invalid S2 level: ${n}`);let i=2**n;if(!Number.isInteger(r[0])||!Number.isInteger(r[1])||r[0]<0||r[1]<0||r[0]>=i||r[1]>=i)throw new Error(`Invalid S2 IJ coordinates: ${r[0]}, ${r[1]}`);let o=RB(r[0],r[1],n,t),s=BigInt(t)<<61n;for(let a=0;a<o.length;a++){let c=59-a*2;s|=BigInt(o[a])<<BigInt(c)}return s|=1n<<BigInt(60-n*2),s}function nw(e,t,r,n){let i=dl(e);if(!Number.isInteger(t)||t<0||i.level+t>rw)throw new Error(`Invalid S2 relative level: ${t}`);let o=2**t;if(!Number.isInteger(r)||!Number.isInteger(n)||r<0||n<0||r>=o||n>=o)throw new Error(`Invalid S2 descendant coordinates: ${r}, ${n}`);return NI({face:i.face,ij:[i.ij[0]*o+r,i.ij[1]*o+n],level:i.level+t})}function tu(e,t,r){let n=1<<t;return[(e[0]+r[0])/n,(e[1]+r[1])/n]}function CI(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function eu(e){return[CI(e[0]),CI(e[1])]}function ru(e,[t,r]){switch(e){case 0:return[1,t,r];case 1:return[-t,1,r];case 2:return[-t,-r,1];case 3:return[-1,-r,-t];case 4:return[r,-1,-t];case 5:return[r,t,-1];default:throw new Error("Invalid face")}}function nu([e,t,r]){let n=Math.atan2(r,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*RI,n*RI]}function PB(e,t,r,n){if(n===0){r===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let i=t[0];t[0]=t[1],t[1]=i}}function RB(e,t,r,n){let i=n%2===1?"d":"a",o=[];for(let s=r-1;s>=0;s--){let a=1<<s,c=(e&a)!==0?1:0,l=(t&a)!==0?1:0,[h,u]=TB[i][c*2+l];o.push(h),i=u}return o}var CB=100;function OI(e){let t=dl(e);return NB(t)}function NB({face:e,ij:t,level:r}){let n=[[0,0],[0,1],[1,1],[1,0],[0,0]],i=Math.max(1,Math.ceil(CB*Math.pow(2,-r))),o=new Float64Array(4*i*2+2),s=0,a=0;for(let c=0;c<4;c++){let l=n[c].slice(0),h=n[c+1],u=(h[0]-l[0])/i,f=(h[1]-l[1])/i;for(let d=0;d<i;d++){l[0]+=u,l[1]+=f;let m=tu(t,r,l),p=eu(m),g=ru(e,p),y=nu(g);Math.abs(y[1])>89.999&&(y[0]=a);let _=y[0]-a;y[0]+=_>180?-360:_<-180?360:0,o[s++]=y[0],o[s++]=y[1],a=y[0]}}return o[s++]=o[0],o[s++]=o[1],o}var OB=AI({name:"s2",hasNumericRepresentation:!0,cellColumnNames:["s2","s2Token","s2_token","s2Cell","s2_cell","s2CellId","s2_cell_id"],tokenToCell:e=>ul(e),cellToToken:e=>Qh(Em(e)),cellToLngLat:e=>BI(e),cellToBoundary:e=>BB(e),cellToBoundaryFlat:e=>iw(e),cellToBounds:e=>vm(e)});function BI(e){let t=Em(e),r=dl(t),n=tu(r.ij,r.level,[.5,.5]),i=eu(n),o=ru(r.face,i);return nu(o)}function iw(e){let t=Em(e),r=OI(t);return Array.from(r)}function BB(e){let t=iw(e),r=[];for(let n=0;n<t.length;n+=2)r.push([t[n],t[n+1]]);return r}function vm(e){let t=dl(Em(e));if(t.level===0)return LB(t.face);let r=[[0,0],[0,1],[1,1],[1,0]],n=1/0,i=1/0,o=-1/0,s=-1/0,a;for(let l of r){let h=tu(t.ij,t.level,l),u=eu(h),[f,d,m]=ru(t.face,u),[p,g]=nu([f,d,m]);if(f===0&&d===0&&a!==void 0&&(p=a),a!==void 0){let y=p-a;p+=y>180?-360:y<-180?360:0}a=p,n=Math.min(n,p),i=Math.min(i,g),o=Math.max(o,p),s=Math.max(s,g)}let c=2*Number.EPSILON*180/Math.PI;return[[n-c,Math.max(-90,i-c)],[o+c,Math.min(90,s+c)]]}function Em(e){return typeof e=="bigint"?e:ul(e)}function LB(e){let t=Math.asin(Math.sqrt(.3333333333333333))*180/Math.PI;switch(e){case 0:return[[-45,-45],[45,45]];case 1:return[[45,-45],[135,45]];case 2:return[[-180,t],[180,90]];case 3:return[[135,-45],[225,45]];case 4:return[[-135,-45],[-45,45]];case 5:return[[-180,-90],[180,-t]];default:throw new Error(`Invalid S2 face: ${e}`)}}Dr();function Tm(e){let[[t,r],[n,i]]=vm(e.token),o=Ph([t,r,n,i,e.minimumHeight,e.maximumHeight],pt.WGS84,{units:"degrees"});return[...o.center,...o.halfAxes]}var DB=4,FB=8,LI=new WeakMap;function sw(e,t){return{coordinates:t,subtreeUrl:ou(e.subtreesUrlTemplate,t),descriptor:e,resource:qI(e.resourceFiles,ou(e.subtreesUrlTemplate,t))}}function Im(e,t){let{descriptor:r}=t;WB(r),UB(e,r);let n={tileCount:0,childSubtreeCount:0},i=kI(e,t,{localLevel:0,mortonIndex:0},t.coordinates,n);if(!i)throw new Error(`Invalid 3D Tiles subtree: root tile is unavailable at ${t.subtreeUrl}`);return{root:i,...n}}function UB(e,t){let r=$I(t.subdivisionScheme),n=(r**t.subtreeLevels-1)/(r-1),i=r**t.subtreeLevels;ow(e.tileAvailability,n,"tile");let o=Array.isArray(e.contentAvailability)?e.contentAvailability:e.contentAvailability?[e.contentAvailability]:[];for(let c of o)ow(c,n,"content");ow(e.childSubtreeAvailability,i,"child subtree");let s=DI(e.tileAvailability,n),a=o[0]?DI(o[0],n):0;if(FI(e.tileAttributes,s,"tile"),FI(e.contentAttributes,a,"content"),e.tilePropertyRows&&e.tilePropertyRows.length!==s)throw new Error("3DTILES_subtree: tile property-table count does not match availability");if(e.contentPropertyRows&&e.contentPropertyRows.length!==a)throw new Error("3DTILES_subtree: content property-table count does not match availability")}function ow(e,t,r){if(!(e.constant===0||e.constant===1)&&(!e.explicitBitstream||e.explicitBitstream.byteLength*8<t))throw new Error(`3DTILES_subtree: ${r} availability bitstream is too short`)}function DI(e,t){if(e.constant===1)return t;if(e.constant===0)return 0;let r=0;for(let n=0;n<t;n++)ml(e,n)&&r++;return r}function FI(e,t,r){let n={TILE_BOUNDING_BOX:16,TILE_BOUNDING_SPHERE:4,TILE_GEOMETRIC_ERROR:1,TILE_REFINE:1,TILE_TRANSFORM:16,CONTENT_BOUNDING_BOX:16,CONTENT_BOUNDING_SPHERE:4};for(let[i,o]of Object.entries(e||{})){let s=n[i];if(s&&o.length!==t*s)throw new Error(`3DTILES_subtree: ${r} attribute ${i} count does not match availability`)}}function ou(e,t,r={}){let n={level:t.level,x:t.x,y:t.y,z:t.z,...r};return e.replace(/{([^{}]+)}/g,(i,o)=>{let s=Object.hasOwn(n,o)?n[o]:n[o.toLowerCase()];return s===void 0?i:String(s)})}function kI(e,t,r,n,i){let{descriptor:o}=t,s=$I(o.subdivisionScheme),a=kB(s,r.localLevel)+r.mortonIndex;if(!ml(e.tileAvailability,a))return null;i.tileCount++;let c=VB(e.contentAvailability,a),l=[];if(n.level<o.maximumLevel)if(r.localLevel+1<o.subtreeLevels)for(let h=0;h<s;h++){let u=zI(n,h,o.subdivisionScheme),f=kI(e,t,{localLevel:r.localLevel+1,mortonIndex:r.mortonIndex*s+h},u,i);f&&l.push(f)}else for(let h=0;h<s;h++){let u=r.mortonIndex*s+h;if(ml(e.childSubtreeAvailability,u)){let f=zI(n,h,o.subdivisionScheme);l.push(GB(e,o,f)),i.childSubtreeCount++}}return zB(e,o,t,n,a,c,l)}function GB(e,t,r){let n=jI(t.resourceFiles,e.resourceFiles),i=n?{...t,resourceFiles:n}:t,o=sw(i,r);return{id:HI(o,r),children:[],implicitSubtree:o,boundingVolume:YI(t.rootBoundingVolume,r,t.subdivisionScheme),geometricError:t.rootLodMetricValue/2**r.level,lodMetricType:t.lodMetricType,lodMetricValue:t.rootLodMetricValue/2**r.level,refine:t.refine,type:Bi.EMPTY,implicitMetadata:WI(e),_scaleGeometricError:t.scaleGeometricError!==!1}}function UI(e,t,r){if(!e||t<0)return{};let n=iu(e[r==="tile"?"TILE_BOUNDING_BOX":"CONTENT_BOUNDING_BOX"],t,16),i=iu(e[r==="tile"?"TILE_BOUNDING_SPHERE":"CONTENT_BOUNDING_SPHERE"],t,4),o=n?{box:[n[12],n[13],n[14],n[0]/2,n[1]/2,n[2]/2,n[4]/2,n[5]/2,n[6]/2,n[8]/2,n[9]/2,n[10]/2]}:i?{sphere:i}:void 0;if(r==="content")return{boundingVolume:o};let s=iu(e.TILE_GEOMETRIC_ERROR,t,1)?.[0];if(s!==void 0&&(!Number.isFinite(s)||s<0))throw new Error("3DTILES_subtree: TILE_GEOMETRIC_ERROR must be nonnegative");let a=iu(e.TILE_REFINE,t,1)?.[0];if(a!==void 0&&a!==0&&a!==1)throw new Error("3DTILES_subtree: TILE_REFINE must be 0 or 1");return{boundingVolume:o,geometricError:s,refine:a===void 0?void 0:a===0?ze.ADD:ze.REPLACE,transform:iu(e.TILE_TRANSFORM,t,16)}}function iu(e,t,r){if(!e)return;let n=t*r;if(n+r>e.length)throw new Error("3DTILES_subtree: attribute accessor is shorter than availability");return Array.from({length:r},(i,o)=>Number(e[n+o]))}function GI(e,t){if(e.constant===1)return t;if(e.constant===0)return 0;let r=LI.get(e);if(!r){let n=(e.explicitBitstream?.byteLength||0)*8;r=new Uint32Array(n+1);for(let i=0;i<n;i++)r[i+1]=r[i]+Number(ml(e,i));LI.set(e,r)}return r[t]}function qI(e,t){if(!e?.length)return;let r=t.split("?")[0],n=/^gltf-package:\/\/[^/]+\/(.*)$/.exec(r)?.[1],i=e.findIndex(s=>{let a=s.originalUri||s.name;return s.uri===r||!!(a&&(r===a||n===a))});if(i>=0)return{fileIndex:i,files:e};let o=e.findIndex(s=>{let a=s.originalUri||s.name;return!!(a&&(r.endsWith(`/${a}`)||r.endsWith(`:${a}`)))});return o<0?void 0:{fileIndex:o,files:e}}function jI(e,t){if(!t?.length)return e;if(!e?.length)return t;let r=new Set(t.flatMap(n=>[n.uri,n.originalUri,n.name].filter(Boolean)));return[...t,...e.filter(n=>![n.uri,n.originalUri,n.name].some(i=>i&&r.has(i)))]}function zB(e,t,r,n,i,o,s){let a=GI(e.tileAvailability,i),c=e.tilePropertyRows?.[a],l=Array.isArray(e.contentAvailability)?e.contentAvailability[0]:e.contentAvailability,h=l&&ml(l,i)?GI(l,i):-1,u=e.contentPropertyRows?.[h],f=e.tileTemplatePropertyRows?.[a]||c,d=e.contentTemplatePropertyRows?.[h]||u,m={...f,...d},p=UI(e.tileAttributes,a,"tile"),g=UI(e.contentAttributes,h,"content"),_=(t.contentUrlTemplates?.length?t.contentUrlTemplates:[t.contentUrlTemplate]).map((B,C)=>{if(!o[C]||!B)return null;let R=ou(B,n,m);if(/{[^{}]+}/.test(R))throw new Error(`Implicit content URI has unresolved template values: ${R}`);return{contentIndex:C,contentUrl:R}}).filter(B=>!!B),M=_.map(B=>B.contentUrl),b=jI(t.resourceFiles,e.resourceFiles),v=_.map(({contentIndex:B,contentUrl:C})=>{let R=qI(b,C);return{...t.contentHeaders?.[B]||(B===0?t.contentHeader:{})||{},...g,uri:C,...u?{metadata:{properties:u}}:{},...R?{_resource:R}:{}}}),T=M[0],S=t.rootLodMetricValue/2**n.level,E=p.geometricError??S,N=YI(t.rootBoundingVolume,n,t.subdivisionScheme);return{id:HI(r,n),children:s,contentUrl:T,content:v.length>1?v:v[0],contents:t.useCanonicalContents&&v.length?v:void 0,contentUrls:M,refine:p.refine||t.refine,type:jB(T),lodMetricType:t.lodMetricType,lodMetricValue:E,geometricError:E,boundingVolume:p.boundingVolume||N,transform:p.transform,transformMatrix:p.transform,metadata:c?{properties:c}:void 0,implicitMetadata:WI(e,c,u),_scaleGeometricError:t.scaleGeometricError!==!1}}function WI(e,t,r){if(!(!e.propertyTables&&e.tileMetadata===void 0&&!e.contentMetadata&&e.subtreeMetadata===void 0&&!t&&!r))return{propertyTables:e.propertyTables,tileMetadata:e.tileMetadata,contentMetadata:e.contentMetadata,subtreeMetadata:e.subtreeMetadata,tileProperties:t,contentProperties:r}}function HI(e,t){return`${e.subtreeUrl}#implicit=${t.level}/${t.x}/${t.y}/${t.z}`}function ml(e,t){if(typeof e?.constant=="number")return!!e.constant;let r=e?.explicitBitstream;if(!r)return!1;let n=Math.floor(t/8),i=t%8;return!!(r[n]>>i&1)}function VB(e,t){return(Array.isArray(e)?e:[e]).map(n=>ml(n||{constant:0},t))}function kB(e,t){return(e**t-1)/(e-1)}function zI(e,t,r){return{level:e.level+1,x:e.x*2+(t&1),y:e.y*2+(t>>1&1),z:r==="OCTREE"?e.z*2+(t>>2&1):0}}function $I(e){return e==="OCTREE"?FB:DB}function YI(e,t,r){if(e.region){let[n,i,o,s,a,c]=e.region,l=2**t.level,u=(o>=n?o-n:o+2*Math.PI-n)/l,f=(s-i)/l,d=VI(n+u*t.x),m=VI(n+u*(t.x+1)),p=i+f*t.y,g=a,y=c;if(r==="OCTREE"){let _=(c-a)/l;g=a+_*t.z,y=g+_}return{region:[d,p,m,p+f,g,y]}}if(e.box){if(e.s2VolumeInfo)return qB(e,t,r);if(e.extensions?.["3DTILES_shape_cylinder_region"])return{...e,box:[...e.box]};let n=e.box,i=2**t.level,o=-1+(2*t.x+1)/i,s=-1+(2*t.y+1)/i,a=-1+(2*t.z+1)/i,c=r==="OCTREE";return{box:[...[n[0]+n[3]*o+n[6]*s+(c?n[9]*a:0),n[1]+n[4]*o+n[7]*s+(c?n[10]*a:0),n[2]+n[5]*o+n[8]*s+(c?n[11]*a:0)],n[3]/i,n[4]/i,n[5]/i,n[6]/i,n[7]/i,n[8]/i,c?n[9]/i:n[9],c?n[10]/i:n[10],c?n[11]/i:n[11]]}}throw new Error(`Unsupported implicit 3D Tiles bounding volume: ${JSON.stringify(e)}`)}function qB(e,t,r){let n=e.s2VolumeInfo,i=ul(n.token),o=nw(i,t.level,t.x,t.y),s=2**t.level,a=(n.maximumHeight-n.minimumHeight)/s,c={token:Qh(o),minimumHeight:n.minimumHeight+(r==="OCTREE"?a*t.z:0),maximumHeight:n.minimumHeight+(r==="OCTREE"?a*(t.z+1):a*s)},l=e.extensions?{...e.extensions}:void 0;return l?.["3DTILES_bounding_volume_S2"]&&(l["3DTILES_bounding_volume_S2"]=c),l?.["3DTILES_shape_s2"]&&(l["3DTILES_shape_s2"]=c),{...e,...l?{extensions:l}:{},s2VolumeInfo:c,box:Tm(c)}}function VI(e){let t=e;for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function jB(e){if(!e)return Bi.EMPTY;let t=e.split("?")[0].split(".").pop()?.toLowerCase();switch(t){case"pnts":return Bi.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return Bi.SCENEGRAPH;default:return t||Bi.EMPTY}}function WB(e){if(e.subdivisionScheme!=="QUADTREE"&&e.subdivisionScheme!=="OCTREE")throw new Error(`Unsupported implicit subdivision scheme: ${e.subdivisionScheme}`);if(!Number.isInteger(e.subtreeLevels)||e.subtreeLevels<1)throw new Error("Implicit subtreeLevels must be a positive integer");if(!Number.isInteger(e.maximumLevel)||e.maximumLevel<0)throw new Error("Implicit availableLevels must describe at least the root level")}var HB={draco:!1,meshopt:!1,dds:!1,ktx2:!1},$B=32,Am=class{type=nr.TILES3D;loader;url;basePath;tileset=null;loadOptions;coreApi;contentFormats={...HB};asset;properties;extras;credits;metadata;queryParams={};tileUrlCache=new Map;tileContentHeaders=new WeakMap;nestedTilesetRoots=new WeakMap;packageNamespaces=new WeakMap;nextPackageNamespace=0;implicitSubtreeCache;implicitTilingStats={requestedSubtrees:0,loadedSubtrees:0,cacheHits:0,materializedTiles:0};destroyed=!1;extensionsUsed=[];resolver;rootTileset;spatialTransformer;preparedRootHeader;constructor(t,r={}){let n=YB(t);this.rootTileset=XI(t)?null:t,this.tileset=this.rootTileset,this.loader=n.loader,this.url=n.url,this.basePath=n.basePath||gn.dirname(n.url),this.resolver=n.resolver,this.coreApi=n.coreApi,this.loadOptions=r;let i=Number(r["3d-tiles"]?.maximumCachedSubtrees),o=Number.isFinite(i)?Math.max(0,Math.floor(i)):$B;this.implicitSubtreeCache=new hh({maxEntries:o})}destroy(){this.destroyed=!0,this.tileUrlCache.clear(),this.implicitSubtreeCache.clear()}async initialize(){if(!this.rootTileset){let t=this.loadOptions[this.loader.id]||{};this.rootTileset=await this.loadRootData(this.url,{...this.loadOptions,[this.loader.id]:{...t,isTileset:!0}})}if(this.tileset=this.rootTileset,this.rootTileset.queryString){let t=new URLSearchParams(this.rootTileset.queryString);for(let[r,n]of t.entries())this.setQueryParameter(r,n)}if(this.asset=this.rootTileset.asset,!this.asset)throw new Error("Tileset must have an asset property.");if(this.rootTileset.formatVersion!=="2.0-draft"&&this.asset.version!=="0.0"&&this.asset.version!=="1.0"&&this.asset.version!=="1.1")throw new Error("The tileset must be 3D Tiles version 0.0, 1.0, 1.1, or 2.0-draft.");"tilesetVersion"in this.asset&&this.setQueryParameter("v",this.asset.tilesetVersion),this.properties=this.rootTileset.properties,this.extras=this.rootTileset.extras,this.credits={attributions:[]},this.extensionsUsed.splice(0,this.extensionsUsed.length,...this.rootTileset.extensionsUsed||[]),this.metadata={type:this.type,loader:this.loader,url:this.url,basePath:this.basePath,tileset:this.rootTileset,lodMetricType:this.rootTileset.lodMetricType,lodMetricValue:this.rootTileset.lodMetricValue,refine:this.rootTileset.root?.refine,spatialReference:Yd(this.rootTileset)}}getMetadata(){if(!this.metadata)throw new Error("Tiles3DSource has not been initialized");return this.metadata}async getRootTileset(){return this.getMetadata().tileset}async prepareTileset(t){let r=t.spatialReference;if(r.status==="unresolved")throw new Error(r.warnings[0]||"3D Tiles spatial operations cannot be resolved from the supplied metadata and options");r.status!=="transformable"&&r.status!=="transformed"||(this.spatialTransformer||=new hs(r,t.options.spatial),t.spatialReference=Kc(r),this.preparedRootHeader=this.transformTileHeader(this.getMetadata().tileset.root,new bt))}initializeTileHeaders(t,r,n){let i=n?r.root:this.preparedRootHeader||r.root,o=new bn(t,i,n||void 0);n&&(n.children.push(o),o.depth=n.depth+1);let s=[o];for(;s.length>0;){let a=s.pop();t.stats.get("Tiles In Tileset(s)").incrementCount();let c=a.header.children||[];for(let l of c){let h=new bn(t,l,a);if(h.contentUrl?.includes("?session=")){let f=new URL(h.contentUrl).searchParams.get("session");f&&this.setQueryParameter("session",f)}a.children.push(h),h.depth=a.depth+1,s.push(h)}}return o}createTraverser(t){return new Hd(t)}async loadTileContent(t){let r=(t.contentUrls||[t.contentUrl]).filter(Boolean),n=this.tileContentHeaders.get(t),i=n||(Array.isArray(t.header?.content)?t.header.content:t.header?.content?[t.header.content]:[]);n||this.tileContentHeaders.set(t,i);let o=this.loadOptions[this.loader.id]||{},s={...this.loadOptions,[this.loader.id]:{...o,isTileset:"auto",assetGltfUpAxis:this.asset&&this.asset.gltfUpAxis||"Y",_tilesetOptions:{spatialReference:t.header?._spatialReference||t.tileset?.spatialReference,spatialOptions:t.tileset?.options.spatial,spatialTransform:t.header?._spatialTransform}}},a=await Promise.all(r.map((l,h)=>{let u=i[h]||{},f=u.extensions?.["3DTILES_content_gltf_vector"],d=u._vectorContent||(f?.vector===!0?{clip:f.clip===!0}:void 0),m=d?{...s,[this.loader.id]:{...s[this.loader.id],vectorContent:d}}:s;return this.loadContentResource(this.getTileUrl(l),u._resource,m)}));t.contents=a,t.content=a[0]||null;let c=a.filter(l=>l?.shape==="tileset3d");return{loaded:!0,contents:a,nestedTileset:c[0],nestedTilesets:c}}transformTileHeader(t,r=new bt){return this.spatialTransformer?this.transformTileHeaderWithTransformer(t,this.spatialTransformer,r):t}transformTileHeaderWithTransformer(t,r,n,i){let o=t.transform?new bt(t.transform):new bt,s=new bt(n).multiplyRight(o),a=Array.isArray(t.content)?t.content.map(c=>this.transformContentHeader(c,s,r)):t.content?this.transformContentHeader(t.content,s,r):t.content;return{...t,transform:void 0,boundingVolume:t.boundingVolume?r.transformBoundingVolume(t.boundingVolume,s):t.boundingVolume,_spatialReference:i,_spatialTransform:s.toArray(),content:a,children:Array.isArray(t.children)?t.children.map(c=>this.transformTileHeaderWithTransformer(c,r,s,i)):t.children}}transformContentHeader(t,r,n){return{...t,boundingVolume:t.boundingVolume?n.transformBoundingVolume(t.boundingVolume,r):t.boundingVolume}}async loadTileChildren(t,r){let n=t.header.implicitSubtree;if(!n)return{loaded:!1,tileCount:0,childSubtreeCount:0};let i=this.getTileUrl(n.subtreeUrl),o=await this.loadImplicitSubtreeResource(i,n.resource);if(this.destroyed||t.isDestroyed())return{loaded:!1,tileCount:0,childSubtreeCount:0};let s=Im(o,{...n,subtreeUrl:i}),a=t.header._spatialReference,c=a?new hs(a,t.tileset.options.spatial):this.spatialTransformer,l=c?this.transformTileHeaderWithTransformer(s.root,c,new bt,a):s.root;t.applyImplicitSubtreeHeader(l);let h=this.initializeMaterializedChildren(t.tileset,t,l.children);return this.implicitTilingStats.loadedSubtrees++,this.implicitTilingStats.materializedTiles+=h,{loaded:!0,tileCount:s.tileCount,childSubtreeCount:s.childSubtreeCount}}async loadTileChildrenForTraversal(t,r){KI(r);let n=await this.loadTileChildren(t,{});return KI(r),n}getImplicitTilingStats(){return{...this.implicitTilingStats,cachedSubtrees:this.implicitSubtreeCache.size-this.implicitSubtreeCache.pendingSize,pendingSubtrees:this.implicitSubtreeCache.pendingSize}}getTileUrl(t){if(t.startsWith("data:"))return t;let r=this.tileUrlCache.get(t);if(r)return r;if(!Object.keys(this.queryParams).length)return this.tileUrlCache.set(t,t),t;let[n,i=""]=t.split("?"),o=new URLSearchParams(i);for(let[c,l]of Object.entries(this.queryParams))o.has(c)||o.set(c,l);let s=o.toString(),a=s?`${n}?${s}`:n;return this.tileUrlCache.set(t,a),a}setQueryParameter(t,r){this.queryParams[t]!==r&&(this.queryParams[t]=r,this.tileUrlCache.clear())}getViewState(t){if(!t)return{asset:this.asset,properties:this.properties,extras:this.extras,credits:this.credits};let{center:r}=t.boundingVolume,n;return r&&(r[0]!==0||r[1]!==0||r[2]!==0)?(n=new I,pt.WGS84.cartesianToCartographic(r,n)):n=new I(0,0,-pt.WGS84.radii[0]),{asset:this.asset,properties:this.properties,extras:this.extras,credits:this.credits,boundingVolume:t.boundingVolume,cartographicCenter:n,cartesianCenter:r,zoom:Tv(t.boundingVolume,n)}}hasExtension(t){return this.extensionsUsed.includes(t)}onTileLoaded(t,r,n){let o=(r.contents.length?r.contents:[r.content]).flatMap(c=>c?.gltf?.json.extensionsRemoved||[]);o.includes("KHR_draco_mesh_compression")&&(this.contentFormats.draco=!0),o.includes("EXT_meshopt_compression")&&(this.contentFormats.meshopt=!0),o.includes("KHR_texture_basisu")&&(this.contentFormats.ktx2=!0);let s=n.nestedTilesets||(n.nestedTileset?[n.nestedTileset]:[]),a=this.nestedTilesetRoots.get(r)||[];for(let[c,l]of s.entries()){let h=a[c];if(h&&r.children.includes(h))continue;let u=a.slice(c+1).find(d=>r.children.includes(d)),f=t._initializeTileHeaders(this.prepareNestedTileset(t,l),r);u&&(r.children.splice(r.children.indexOf(f),1),r.children.splice(r.children.indexOf(u),0,f)),a[c]=f,this.nestedTilesetRoots.set(r,a)}}prepareNestedTileset(t,r){let n=r.spatialMetadata,i=t.spatialReference;if(n?.status==="unresolved"||n?.crs.state==="unknown")throw new Error(n.warnings[0]||"Nested 3D Tiles CRS is explicitly unresolved and cannot be placed in the parent frame");if(!n||!n.sourceCrs)return this.spatialTransformer&&(i.status==="transformable"||i.status==="transformed")?{...r,spatialMetadata:i,root:this.transformTileHeaderWithTransformer(r.root,this.spatialTransformer,new bt,i)}:aw(r,i);let o=i.coordinateEpoch,s=n.coordinateEpoch;if(o!==void 0&&s!==void 0&&o!==s)throw new Error(`Nested 3D Tiles coordinate epoch ${s} differs from parent epoch ${o}; epoch-aware transformation is unavailable`);let a=i.targetCrs||i.sourceCrs;if(!a)return aw(r,n);let c=Ea(n,{...t.options.spatial,outputCoordinates:"target-crs",targetCrs:a});if(c.status==="unresolved")throw new Error(c.warnings[0]||"Nested 3D Tiles CRS cannot be resolved in the parent output frame");if(c.status==="native")return aw(r,c);let l=new hs(c,t.options.spatial);return{...r,spatialMetadata:c,root:this.transformTileHeaderWithTransformer(r.root,l,new bt,c)}}async loadWithCoreApi(t,r,n=this.loader){if(!this.coreApi)throw new Error("Tiles3DSource requires an injected coreApi to load tileset data");return await this.coreApi.load(t,n,r)}async loadRootData(t,r){return this.resolver?await this.resolver.loadRoot(t,this.loader,r):await this.loadWithCoreApi(t,r)}async loadResourceData(t,r,n=this.loader){return this.resolver?await this.resolver.loadResource(t,n,r):await this.loadWithCoreApi(t,r,n)}async loadContentResource(t,r,n){if(!r)return await this.loadResourceData(t,n);let i=r.files[r.fileIndex];if(!i)throw new Error(`3D Tiles package references missing file ${r.fileIndex}`);if(i.uri)return await this.loadResourceData(this.getTileUrl(i.uri),n);if(!this.coreApi)throw new Error("Tiles3DSource requires an injected coreApi to parse embedded package data");let o=await this.getPackageFileData(i),a=`gltf-package://${this.getPackageNamespace(r.files)}/${r.fileIndex}`,c=i.name||"content",l=c.lastIndexOf("/"),h=l>=0?`${a}/${c.slice(0,l)}`:a;return await this.coreApi.parse(o,this.loader,n,{url:`${a}/${c}`,filename:c,baseUrl:h,loaders:[this.loader],coreApi:this.coreApi,_parse:this.coreApi.parse,_tiles3dPackageFiles:r.files,fetch:async(u,f)=>{let d=u.startsWith(`${a}/`)?u.slice(a.length+1):u,m=r.files.find(g=>g.name===d||g.originalUri===d);if(!m)throw new Error(`3D Tiles glTF package does not contain file ${d}`);if(m.uri)return await this.coreApi.fetchFile(this.getTileUrl(m.uri),f);let p=await this.getPackageFileData(m);return new Response(p,{headers:{"content-type":m.mimeType}})}})}getPackageNamespace(t){let r=this.packageNamespaces.get(t);if(r!==void 0)return r;let n=this.nextPackageNamespace++;return this.packageNamespaces.set(t,n),n}async getPackageFileData(t){if(t.data)return vf(t.data,t.byteOffset,t.byteLength);if(t.bufferUri&&this.coreApi){let r=await this.coreApi.fetchFile(this.getTileUrl(t.bufferUri));if(!r.ok)throw new Error(`Failed to fetch 3D Tiles package buffer: HTTP ${r.status}`);let n=await r.arrayBuffer();return vf(n,t.byteOffset,t.byteLength)}throw new Error("3D Tiles package file has no available byte source")}async loadImplicitSubtreeResource(t,r){let n=this.implicitSubtreeCache.get(t);if(n)return this.implicitTilingStats.cacheHits++,await n;this.implicitTilingStats.requestedSubtrees++;let i=this.loadOptions[this.loader.id]||{};return await this.implicitSubtreeCache.getOrLoad(t,async()=>{let o={...this.loadOptions,[this.loader.id]:{...i,isTileset:!1,isSubtree:!0}};return await(r?this.loadContentResource(t,r,o):this.loadResourceData(t,o))})}initializeMaterializedChildren(t,r,n){let i=0,o=[{parentTile:r,childHeaders:n}];for(;o.length>0;){let s=o.pop();for(let a of s.childHeaders){let c=new bn(t,a,s.parentTile);s.parentTile.children.push(c),c.depth=s.parentTile.depth+1,t.stats.get("Tiles In Tileset(s)").incrementCount(),i++,a.children?.length&&o.push({parentTile:c,childHeaders:a.children})}}return i}};function KI(e){if(e?.aborted)throw e.reason??new DOMException("The operation was aborted","AbortError")}function XI(e){return!!(e&&typeof e=="object"&&"url"in e&&"loader"in e&&!("type"in e))}function YB(e){return XI(e)?{...e,basePath:e.basePath||gn.dirname(e.url)}:{url:e.url,loader:e.loader,basePath:e.basePath||gn.dirname(e.url),resolver:e.resolver,coreApi:e.coreApi}}function aw(e,t){let r=n=>({...n,_spatialReference:t,children:Array.isArray(n.children)?n.children.map(r):n.children});return{...e,spatialMetadata:t,root:r(e.root)}}Wn();Wn();Dr();qt();var Pm=class{frameNumberMap=new Map;register(t,r){let n=this.frameNumberMap.get(t)||new Map,i=n.get(r)||0;n.set(r,i+1),this.frameNumberMap.set(t,n)}deregister(t,r){let n=this.frameNumberMap.get(t);if(!n)return;let i=n.get(r)||1;n.set(r,i-1)}isZero(t,r){return(this.frameNumberMap.get(t)?.get(r)||0)===0}};var cw={REQUESTED:"REQUESTED",COMPLETED:"COMPLETED",ERROR:"ERROR"},Rm=class{_statusMap;pendingTilesRegister=new Pm;constructor(){this._statusMap={}}add(t,r,n,i){if(!this._statusMap[r]){let{frameNumber:o,viewport:{id:s}}=i;this._statusMap[r]={request:t,callback:n,key:r,frameState:i,status:cw.REQUESTED},this.pendingTilesRegister.register(s,o),t().then(a=>{this._statusMap[r].status=cw.COMPLETED;let{frameNumber:c,viewport:{id:l}}=this._statusMap[r].frameState;this.pendingTilesRegister.deregister(l,c),this._statusMap[r].callback(a,i)}).catch(a=>{this._statusMap[r].status=cw.ERROR;let{frameNumber:c,viewport:{id:l}}=this._statusMap[r].frameState;this.pendingTilesRegister.deregister(l,c),n(a)})}}update(t,r){if(this._statusMap[t]){let{frameNumber:n,viewport:{id:i}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(i,n);let{frameNumber:o,viewport:{id:s}}=r;this.pendingTilesRegister.register(s,o),this._statusMap[t].frameState=r}}find(t){return this._statusMap[t]}hasPendingTiles(t,r){return!this.pendingTilesRegister.isZero(t,r)}};var Cm=class extends Li{_tileManager;constructor(t){super(t),this._tileManager=new Rm}traversalFinished(t){return!this._tileManager.hasPendingTiles(t.viewport.id,this._frameNumber||0)}shouldRefine(t,r){return t._lodJudge=Wd(t,r),t._lodJudge==="DIG"}updateChildTiles(t,r){let n=t.header.children||[],i=t.children;for(let o of n){let s=`${o.id}-${r.viewport.id}`,a=i&&i.find(c=>c.id===s||c.header?.id===o.id);if(a)a&&this.updateTile(a,r);else{let c=()=>this._loadTile(t,o.id,r);this._tileManager.find(s)?this._tileManager.update(s,r):this._tileManager.add(c,s,h=>this._onTileLoad(h,t,s),r)}}return!1}async _loadTile(t,r,n){if(!t.tileset.source.loadChildTileHeader)throw new Error("I3S source does not support child tile header loading");return await t.tileset.source.loadChildTileHeader(t,r,n)}_onTileLoad(t,r,n){if(t instanceof Error){r.tileset._onSourceError(t,r);return}let i=new bn(r.tileset,t,r,n);r.children.push(i);let o=this._tileManager.find(i.id).frameState;this.updateTile(i,o),this._frameNumber===o.frameNumber&&(this.traversalFinished(o)||new Date().getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(i,o)}};qt();Dr();var gl=class{spatialReference;targetCoordinateFrame;positionTransformer;sourceToGeographicTransformer;geographicToTargetTransformer;sourceCoordinateFrame;sourceVerticalUnitScale;elevationMode;elevationOffset;elevationProvider;providerUnitScale;providerHeightTransformer;constructor(t,r={}){if(t.status!=="transformable"&&t.status!=="transformed")throw new Error("I3SSpatialTransformer requires a requested, transformable spatial output");let n=t.targetCrs||t.sourceCrs;if(!n)throw new Error("I3S spatial transformation requires a target CRS");if(this.positionTransformer=new $n(t,r),this.sourceCoordinateFrame=t.coordinateFrame,this.sourceVerticalUnitScale=t.verticalUnitScale,this.elevationMode=t.elevationMode,this.elevationOffset=(t.elevationOffset||0)*t.elevationUnitScale,this.elevationProvider=KB(this.elevationMode,r),this.elevationProvider&&(typeof this.elevationProvider.sampleElevations!="function"||typeof this.elevationProvider.getElevationRange!="function"))throw new Error("An I3S elevation provider must implement sampleElevations() and getElevationRange()");let i=Vh(this.elevationProvider?.unit||"meter");if(this.elevationProvider&&i===void 0)throw new Error(`Unsupported elevation-provider unit ${this.elevationProvider.unit}`);this.providerUnitScale=i||1,this.targetCoordinateFrame=_n(n),this.spatialReference=Kc(t);let o=Mn({sourceCrs:t.sourceCrs,heightReference:t.heightReference,coordinateFrame:t.coordinateFrame,axisOrder:t.axisOrder,provenance:t.provenance},{targetCrs:"EPSG:4326"});if(this.sourceToGeographicTransformer=new $n(o),pl(this.elevationMode)){if(!this.elevationProvider){let c=this.elevationMode==="relativeToScene"?"scene":"terrain";throw new Error(`I3S elevation mode ${this.elevationMode} requires a ${c} elevation provider`)}if(t.heightReference==="unknown")throw new Error(`I3S elevation mode ${this.elevationMode} requires a known source height reference`);let a=this.elevationProvider.heightReference||t.heightReference;if(a!==t.heightReference){if(t.heightReference!=="ellipsoidal"&&t.heightReference!=="orthometric")throw new Error("Converting elevation-provider heights requires an ellipsoidal or orthometric source height reference");let c=Mn({sourceCrs:"EPSG:4326",heightReference:a,coordinateFrame:"geographic",axisOrder:"xyz",provenance:"caller-override"},{targetCrs:"EPSG:4326",targetHeightReference:t.heightReference,geoidModel:r.geoidModel});this.providerHeightTransformer=new $n(c,r)}}let s=Mn({sourceCrs:"EPSG:4326",heightReference:t.heightReference,coordinateFrame:"geographic",axisOrder:"xyz",provenance:"format-default"},{targetCrs:n,targetHeightReference:t.targetHeightReference,geoidModel:r.geoidModel});this.geographicToTargetTransformer=new $n(s,r)}transformPosition(t){let r=this.placeSourcePositionsSync(t),n=this.positionTransformer.transformPosition([r[0],r[1],r[2]]);return[n[0],n[1],n[2]]}async transformPositionAsync(t){let r=await this.placeSourcePositions(t),n=this.positionTransformer.transformPosition([r[0],r[1],r[2]]);return[n[0],n[1],n[2]]}transformPlacedPosition(t){let r=this.positionTransformer.transformPosition([t[0],t[1],t[2]]);return[r[0],r[1],r[2]]}transformSourcePositionToGeographic(t){let r=this.placeSourcePositionsSync(t),n=this.sourceToGeographicTransformer.transformPosition([r[0],r[1],r[2]]);return[n[0],n[1],n[2]]}async transformSourcePositionToGeographicAsync(t){let r=await this.placeSourcePositions(t),n=this.sourceToGeographicTransformer.transformPosition([r[0],r[1],r[2]]);return[n[0],n[1],n[2]]}transformPositions(t,r){let n=this.placeSourcePositionsSync(t),i=this.placeSourcePositionsSync(r);return this.transformPlacedPositions(n,i)}async transformPositionsAsync(t,r){let n=new Float64Array(t.length+3);n.set(Array.from(t),0),n.set(Array.from(r).slice(0,3),t.length);let i=await this.placeSourcePositions(n);return this.transformPlacedPositions(i.subarray(0,t.length),i.subarray(t.length))}async transformGeometryAsync(t,r,n="earth-centered"){if(t.length%3||r&&r.length!==t.length)throw new Error("Conversion positions and normals must contain matching finite xyz triples");for(let o=0;o<t.length;o++)if(!Number.isFinite(t[o])||r&&!Number.isFinite(r[o]))throw new Error("Conversion positions and normals must contain matching finite xyz triples");if(!["earth-centered","vertex-reference-frame"].includes(n))throw new Error("Unsupported I3S normal reference frame");let i=await this.placeSourcePositions(t);return{positions:this.positionTransformer.transformPositions(i),normals:r?this.transformNormals(r,i,n):void 0}}transformPlacedPositions(t,r){let n=this.transformPlacedPosition(r),i=new Float32Array(t.length),o=Float64Array.from(t);for(let c=0;c<t.length;c+=3){let l=this.transformPlacedPosition([t[c],t[c+1],t[c+2]]);i[c]=l[0]-n[0],i[c+1]=l[1]-n[1],i[c+2]=l[2]-n[2]}let s=this.targetCoordinateFrame==="geographic",a=s?new bt:new bt().translate(n);return{positions:i,sourcePositions:o,origin:n,cartographicOrigin:s?n:[0,0,0],coordinateSystem:s?"lnglat-offsets":"cartesian",modelMatrix:a}}transformNormals(t,r,n="earth-centered"){if(t.length!==r.length||t.length%3)throw new Error("I3S normals and positions must have matching xyz component counts");let i=new Float32Array(t.length);if(n==="earth-centered"&&(this.spatialReference.targetCrs||this.spatialReference.sourceCrs)==="EPSG:4978"){for(let o=0;o<t.length;o+=3){let s=Math.hypot(t[o],t[o+1],t[o+2]);for(let a=0;a<3;a++)i[o+a]=s?t[o+a]/s:t[o+a]}return i}for(let o=0;o<t.length;o+=3){let s=this.sourceToGeographicTransformer.transformPosition([r[o],r[o+1],r[o+2]]),a=new I([t[o],t[o+1],t[o+2]]).normalize(),c=n==="earth-centered"?a:e3(a,s),l=this.transformEcefNormal(c,s);i.set(l,o)}return i}transformBoundingVolume(t){let n=this.getGeographicBoundSamples(t).map(i=>this.geographicToTargetTransformer.transformPosition(i));return this.targetCoordinateFrame==="geographic"?{region:us(n)}:{box:Oa(n)}}async transformBoundingVolumeAsync(t){let n=(await this.getGeographicBoundSamplesAsync(t)).map(i=>this.geographicToTargetTransformer.transformPosition(i));return this.targetCoordinateFrame==="geographic"?{region:us(n)}:{box:Oa(n)}}transformBoundingVolumeToGeographic(t){return{region:us(this.getGeographicBoundSamples(t))}}async transformBoundingVolumeToGeographicAsync(t){return{region:us(await this.getGeographicBoundSamplesAsync(t))}}transformBoundingVolumeToGeocentric(t){let r=this.getGeographicBoundSamples(t).map(n=>Array.from(pt.WGS84.cartographicToCartesian(new I(n))));return{box:Oa(r)}}async transformBoundingVolumeToGeocentricAsync(t){let r=(await this.getGeographicBoundSamplesAsync(t)).map(n=>Array.from(pt.WGS84.cartographicToCartesian(new I(n))));return{box:Oa(r)}}transformBoundingSphereToGeographic(t){let r=t.mbs?.length?Array.from(t.mbs).slice(0,3):t.obb?Array.from(t.obb.center).slice(0,3):null;if(!r)throw new Error("I3S spatial transformation requires an MBS or OBB bound");let n=this.placeSourcePositionsSync(r),i=this.sourceToGeographicTransformer.transformPosition(Array.from(n)),o=t.mbs?.length?t.mbs[3]:Math.hypot(...Array.from(t.obb.halfSize).slice(0,3));return[i[0],i[1],i[2],o]}async transformBoundingSphereToGeographicAsync(t){return ZI(await this.getGeographicBoundSamplesAsync(t))}async transformBoundsAsync(t){let r=await this.getGeographicBoundSamplesAsync(t),n=r.map(o=>Array.from(pt.WGS84.cartographicToCartesian(new I(o)))),i=r.map(o=>this.geographicToTargetTransformer.transformPosition(o));return{boundingVolume:{box:Oa(n)},spatialBoundingVolume:this.targetCoordinateFrame==="geographic"?{region:us(i)}:{box:Oa(i)},i3sLodMbs:pl(this.elevationMode)?ZI(r):this.transformBoundingSphereToGeographic(t)}}async transformPointCloudBoundsAsync(t){let r=await this.getGeographicBoundSamplesAsync(t),n=r.map(i=>this.geographicToTargetTransformer.transformPosition(i));return{boundingVolume:{region:us(r)},spatialBoundingVolume:this.targetCoordinateFrame==="geographic"?{region:us(n)}:{box:Oa(n)}}}getGeographicBoundSamples(t){let r=JI(t,this.sourceCoordinateFrame,this.sourceToGeographicTransformer,this.sourceVerticalUnitScale);if(!r.length)throw new Error("I3S spatial transformation requires an MBS or OBB bound");let n=this.placeSourcePositionsSync(r.flat(),!0),i=lw(n);return this.sourceCoordinateFrame==="geographic"?i:i.map(o=>this.sourceToGeographicTransformer.transformPosition(o))}async getGeographicBoundSamplesAsync(t){let r=JI(t,this.sourceCoordinateFrame,this.sourceToGeographicTransformer,this.sourceVerticalUnitScale);if(!r.length)throw new Error("I3S spatial transformation requires an MBS or OBB bound");if(pl(this.elevationMode)){let i=this.sourceCoordinateFrame==="geographic"?r:r.map(o=>this.sourceToGeographicTransformer.transformPosition(o));return await this.placeGeographicBoundSamples(i)}let n=lw(await this.placeSourcePositions(r.flat(),!0));return this.sourceCoordinateFrame==="geographic"?n:n.map(i=>this.sourceToGeographicTransformer.transformPosition(i))}async placeGeographicBoundSamples(t){let n=await this.elevationProvider.getElevationRange(XB(t)),i=n.minimum*this.providerUnitScale,o=n.maximum*this.providerUnitScale;if(!Number.isFinite(i)||!Number.isFinite(o)||i>o)throw new Error("Elevation provider returned an invalid range; minimum and maximum must be finite and ordered");let s=t.map(h=>h[2]),a=Math.min(...s),c=Math.max(...s),l=[];for(let[h,u]of t){let f=this.providerHeightTransformer?this.providerHeightTransformer.transformPosition([h,u,i])[2]:i,d=this.providerHeightTransformer?this.providerHeightTransformer.transformPosition([h,u,o])[2]:o,m=Math.min(f,d),p=Math.max(f,d),g=this.elevationMode==="onTheGround"?m:m+a+this.elevationOffset,y=this.elevationMode==="onTheGround"?p:p+c+this.elevationOffset;l.push([h,u,g],[h,u,y])}return l}placeSourcePositionsSync(t,r=!1){if(pl(this.elevationMode))throw new Error(`I3S elevation mode ${this.elevationMode} requires asynchronous surface placement`);let n=Float64Array.from(t),i=this.elevationMode==="absoluteHeight"?this.elevationOffset:0;for(let o=2;o<n.length;o+=3)n[o]=n[o]*(r?1:this.sourceVerticalUnitScale)+i;return n}async placeSourcePositions(t,r=!1){if(!pl(this.elevationMode))return this.placeSourcePositionsSync(t,r);let n=Float64Array.from(t),i=lw(n).map(s=>{let a=this.sourceToGeographicTransformer.transformPosition(s);return[a[0],a[1]]}),o=await this.elevationProvider.sampleElevations(i);if(o.length!==i.length)throw new Error(`Elevation provider returned ${o.length} heights for ${i.length} positions`);for(let s=0;s<i.length;s++){let a=o[s]*this.providerUnitScale;if(!Number.isFinite(a))throw new Error(`Elevation provider returned a non-finite height at index ${s}`);let[c,l]=i[s],h=this.providerHeightTransformer?this.providerHeightTransformer.transformPosition([c,l,a])[2]:a,u=n[s*3+2]*(r?1:this.sourceVerticalUnitScale);n[s*3+2]=this.elevationMode==="onTheGround"?h:h+u+this.elevationOffset}return n}transformEcefNormal(t,r){if(this.targetCoordinateFrame==="geocentric")return t.normalize();if(this.targetCoordinateFrame==="geographic")return JB(t,r).normalize();let n=pt.WGS84.cartographicToCartesian(new I(r)),i=[];for(let s of ZB()){let a=pt.WGS84.cartesianToCartographic(new I(n).add(s)),c=pt.WGS84.cartesianToCartographic(new I(n).subtract(s)),l=this.geographicToTargetTransformer.transformPosition(a),h=this.geographicToTargetTransformer.transformPosition(c);i.push((l[0]-h[0])/2,(l[1]-h[1])/2,(l[2]-h[2])/2)}let o=new Qr(i);if(Math.abs(o.determinant())<1e-12)throw new Error("Cannot transform an I3S normal through a singular local projection");return o.invert().transpose(),new I(t).transformByMatrix3(o).normalize()}};function KB(e,t){return e==="relativeToScene"?t.sceneElevationProvider:pl(e)?t.terrainElevationProvider:void 0}function pl(e){return e==="onTheGround"||e==="relativeToGround"||e==="relativeToScene"}function lw(e){if(e.length%3!==0)throw new Error("I3S position arrays must contain complete XYZ tuples");let t=[];for(let r=0;r<e.length;r+=3)t.push([e[r],e[r+1],e[r+2]]);return t}function XB(e){let t=us(e);return{west:t[0]*180/Math.PI,south:t[1]*180/Math.PI,east:t[2]*180/Math.PI,north:t[3]*180/Math.PI}}function ZI(e){if(!e.length)throw new Error("I3S spatial transformation requires at least one bound sample");let t=e.map(o=>pt.WGS84.cartographicToCartesian(new I(o))),r=new I;for(let o of t)r.add(o);r.scale(1/t.length);let n=0;for(let o of t)n=Math.max(n,new I(o).subtract(r).magnitude());let i=pt.WGS84.cartesianToCartographic(r);return[i[0],i[1],i[2],n]}function JI(e,t,r,n){let i=e.obb;if(i){let c=Array.from(i.center).slice(0,3);c[2]*=n;let l=Array.from(i.halfSize).slice(0,3),h=new to().fromArray(Array.from(i.quaternion)),u=[new I([l[0],0,0]).transformByQuaternion(h),new I([0,l[1],0]).transformByQuaternion(h),new I([0,0,l[2]]).transformByQuaternion(h)];if(t==="geographic"){let f=r.transformPosition(c),d=pt.WGS84.cartographicToCartesian(new I(f)),m=e.normalReferenceFrame==="vertex-reference-frame"?u.map(p=>e3(p,f)):u;return QI().map(p=>{let g=new I(d);for(let y=0;y<3;y++)g.add(new I(m[y]).scale(p[y]));return Array.from(pt.WGS84.cartesianToCartographic(g))})}return QI().map(f=>{let d=new I(c);for(let m=0;m<3;m++)d.add(new I(u[m]).scale(f[m]));return Array.from(d)})}let o=e.mbs?Array.from(e.mbs):[];if(o.length<4)return[];let s=o.slice(0,3);s[2]*=n;let a=o[3];if(t==="geographic"){let c=r.transformPosition(s),l=pt.WGS84.cartographicToCartesian(new I(c));return t3().map(h=>Array.from(pt.WGS84.cartesianToCartographic(new I(l).add(new I(h).scale(a)))))}return t3().map(c=>Array.from(new I(s).add(new I(c).scale(a))))}function QI(){return[-1,1].flatMap(e=>[-1,1].flatMap(t=>[-1,1].map(r=>[e,t,r])))}function t3(){return[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]]}function ZB(){return[new I([1,0,0]),new I([0,1,0]),new I([0,0,1])]}function e3(e,t){let r=t[0]*Math.PI/180,n=t[1]*Math.PI/180,i=new I([-Math.sin(r),Math.cos(r),0]),o=new I([-Math.sin(n)*Math.cos(r),-Math.sin(n)*Math.sin(r),Math.cos(n)]),s=new I([Math.cos(n)*Math.cos(r),Math.cos(n)*Math.sin(r),Math.sin(n)]);return i.scale(e[0]).add(o.scale(e[1])).add(s.scale(e[2]))}function JB(e,t){let r=t[0]*Math.PI/180,n=t[1]*Math.PI/180,i=new I([-Math.sin(r),Math.cos(r),0]),o=new I([-Math.sin(n)*Math.cos(r),-Math.sin(n)*Math.sin(r),Math.cos(n)]),s=new I([Math.cos(n)*Math.cos(r),Math.cos(n)*Math.sin(r),Math.sin(n)]);return new I([i.dot(e),o.dot(e),s.dot(e)])}function Oa(e){let t=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0];for(let o of e)for(let s=0;s<3;s++)t[s]=Math.min(t[s],o[s]),r[s]=Math.max(r[s],o[s]);let n=t.map((o,s)=>(o+r[s])/2),i=t.map((o,s)=>(r[s]-o)/2);return[n[0],n[1],n[2],i[0],0,0,0,i[1],0,0,0,i[2]]}function us(e){let t=e[0][0],r=1/0,n=-1/0,i=1/0,o=-1/0,s=1/0,a=-1/0;for(let c of e){let l=t+hw(c[0]-t);r=Math.min(r,l),n=Math.max(n,l),i=Math.min(i,c[1]),o=Math.max(o,c[1]),s=Math.min(s,c[2]),a=Math.max(a,c[2])}return[hw(r)*Math.PI/180,i*Math.PI/180,hw(n)*Math.PI/180,o*Math.PI/180,s,a]}function hw(e){return((e+180)%360+360)%360-180}var QB={draco:!1,meshopt:!1,dds:!1,ktx2:!1},Nm=class{type=nr.I3S;loader;contentLoader;url;basePath;tileset=null;loadOptions;coreApi;contentFormats={...QB};asset;properties;extras;credits;metadata;queryParams={};resolver;rootTileset;spatialTransformer;preparedRootHeader;constructor(t,r={}){let n=e6(t);this.rootTileset=n3(t)?null:t,this.tileset=this.rootTileset,this.loader=n.loader,this.contentLoader=t6(n.loader),this.url=n.url,this.basePath=n.basePath||gn.dirname(n.url),this.resolver=n.resolver,this.coreApi=n.coreApi,this.loadOptions=r,this.initializeQueryParams(r)}async initialize(){this.rootTileset||(this.rootTileset=await this.loadRootData(this.getTileUrl(this.url),{...this.loadOptions,i3s:{...this.loadOptions.i3s,isTileset:!0}})),this.tileset=this.rootTileset,this.rootTileset.root&&typeof this.rootTileset.root.then=="function"&&(this.rootTileset.root=await this.rootTileset.root),this.metadata={type:this.type,loader:this.loader,url:this.url,basePath:this.basePath,tileset:this.rootTileset,lodMetricType:this.rootTileset.lodMetricType,lodMetricValue:this.rootTileset.lodMetricValue,refine:this.rootTileset.root?.refine,spatialReference:$d(this.rootTileset)}}getMetadata(){if(!this.metadata)throw new Error("I3SSource has not been initialized");return this.metadata}async getRootTileset(){return this.getMetadata().tileset}async prepareTileset(t){let r=t.spatialReference;if(r.status==="unresolved")throw new Error(r.warnings[0]||"I3S spatial operations cannot be resolved from the supplied metadata and options");r.status!=="transformable"&&r.status!=="transformed"||(this.spatialTransformer||=new gl(r,t.options.spatial),t.spatialReference=this.spatialTransformer.spatialReference,this.preparedRootHeader=await this.transformTileHeader(this.getMetadata().tileset.root))}initializeTileHeaders(t,r,n){let i=n?r.root:this.preparedRootHeader||r.root;if(this.spatialTransformer&&!this.preparedRootHeader)throw new Error("I3S spatial root header was not prepared before tile initialization");let o=new bn(t,i,n||void 0);return n&&(n.children.push(o),o.depth=n.depth+1),o}createTraverser(t){return new Cm(t)}async loadTileContent(t){let r=this.getTileUrl(t.contentUrl),n=this.loader.id,i=this.loadOptions[n]||{},o=this.getMetadata(),s={...this.loadOptions,[n]:{...i,...t.tileset.options.i3s,_tileOptions:{attributeUrls:t.header.attributeUrls,textureUrl:t.header.textureUrl,textureUrls:t.header.textureUrls,textureFormat:t.header.textureFormat,textureLoaderOptions:t.header.textureLoaderOptions,materialDefinition:t.header.materialDefinition,layerType:t.header.layerType,pointRenderer:t.header.pointRenderer,pointSymbol:t.header.pointSymbol,isDracoGeometry:t.header.isDracoGeometry,mbs:t.header.mbs},_tilesetOptions:{store:o.tileset.store,attributeStorageInfo:o.tileset.attributeStorageInfo,fields:o.tileset.fields,spatialReference:t.tileset.spatialReference,spatialOptions:t.tileset.options.spatial},isTileHeader:!1}};t.content=await this.loadResourceData(r,s,this.contentLoader);let a={index:0,uri:t.contentUrl,type:t.header.layerType,payload:t.content,metadata:t.header.metadata||null,boundingVolume:t.boundingVolume,featureIds:t.featureIdSets,renderable:!!t.content};return{loaded:!0,contents:[t.content],contentEntries:[a]}}async loadChildTileHeader(t,r,n){let i=this.getMetadata();if(i.tileset.nodePages||i.tileset.pointNodePages){let l=await i.tileset.nodePagesTile.formTileFromNodePages(r);return await this.transformTileHeader(l)}let o=this.getTileUrl(`${this.url}/nodes/${r}`),s=this.loadOptions.i3s&&typeof this.loadOptions.i3s=="object"?this.loadOptions.i3s:{},a={...this.loadOptions,i3s:{...s,isTileHeader:!0}},c=await this.loadResourceData(o,a);return await this.transformTileHeader(c)}async loadTileChildrenForTraversal(t,r){let n=t.header.children||[],i=0,o=[];for(let a of n){r3(r);let c=a.id;if(typeof c!="string"&&typeof c!="number")throw new Error("I3S child header is missing its node ID");let l=t.children.find(f=>f.id===String(c)||f.header?.id===c);if(l){o.push(l);continue}let h=await this.loadChildTileHeader(t,String(c),null);r3(r);let u=new bn(t.tileset,h,t,String(c));o.push(u),i++}let s=new Set(o);return t.children=[...o,...t.children.filter(a=>!s.has(a))],{loaded:!0,tileCount:i,childSubtreeCount:0}}getTileUrl(t){if(t.startsWith("data:")||!Object.keys(this.queryParams).length)return t;let r=t.indexOf("#"),n=r>=0?t.slice(r):"",i=r>=0?t.slice(0,r):t,o=i.indexOf("?"),s=o===-1?i:i.slice(0,o),a=o===-1?"":i.slice(o+1),c=new URLSearchParams(a),l=new URLSearchParams;for(let[u,f]of Object.entries(this.queryParams))c.has(u)||l.set(u,f);let h=l.toString();return`${s}${a?`?${a}`:""}${h?`${a?"&":"?"}${h}`:""}${n}`}getViewState(t){if(this.spatialTransformer&&t){let o=new I(t.boundingVolume.center),s=new I(t.header.i3sLodMbs.slice(0,3));return this.spatialTransformer.targetCoordinateFrame==="geographic"?{boundingVolume:t.boundingVolume,cartographicCenter:s,cartesianCenter:o,zoom:1}:{boundingVolume:t.boundingVolume,cartographicCenter:s,cartesianCenter:o,zoom:1}}let r=this.getMetadata(),n=r.tileset.fullExtent;if(n){let{xmin:o,xmax:s,ymin:a,ymax:c,zmin:l,zmax:h}=n,u=new I(o+(s-o)/2,a+(c-a)/2,l+(h-l)/2),f=new I;return pt.WGS84.cartographicToCartesian(u,f),{cartographicCenter:u,cartesianCenter:f,zoom:q1(n,u,f)}}let i=r.tileset.store?.extent;if(i){let[o,s,a,c]=i,l=new I(o+(a-o)/2,s+(c-s)/2,0),h=new I;return pt.WGS84.cartographicToCartesian(l,h),{cartographicCenter:l,cartesianCenter:h,zoom:Iv(i,l,h)}}return Ji.warn("Extent is not defined in the tileset header")(),{cartographicCenter:new I,zoom:1}}onTileLoaded(t,r){switch(r.header.isDracoGeometry&&(this.contentFormats.draco=!0),r.header.textureFormat){case"dds":this.contentFormats.dds=!0;break;case"ktx2":this.contentFormats.ktx2=!0;break;default:}}getTilesTotalCount(){return this.getMetadata().tileset?.nodePagesTile?.nodesInNodePages||null}async loadWithCoreApi(t,r,n=this.loader){if(!this.coreApi)throw new Error("I3SSource requires an injected coreApi to load tileset data");return await this.coreApi.load(t,n,r)}async loadRootData(t,r){return this.resolver?await this.resolver.loadRoot(t,this.loader,r):await this.loadWithCoreApi(t,r)}initializeQueryParams(t){for(let[n,i]of Object.entries(t.searchParams||{}))this.queryParams[n]=String(i);let r=t.i3s;if(r&&typeof r=="object"&&"token"in r){let n=r.token;typeof n=="string"&&(this.queryParams.token=n)}}async loadResourceData(t,r,n=this.loader){return this.resolver?await this.resolver.loadResource(t,n,r):await this.loadWithCoreApi(t,r,n)}async transformTileHeader(t){if(!this.spatialTransformer)return t;let r={mbs:t.mbs,obb:t.obb,normalReferenceFrame:this.getMetadata().tileset.store?.normalReferenceFrame},n=await this.spatialTransformer.transformBoundsAsync(r);return{...t,boundingVolume:n.boundingVolume,spatialBoundingVolume:n.spatialBoundingVolume,i3sLodMbs:n.i3sLodMbs}}};function r3(e){if(e?.aborted)throw e.reason??new DOMException("The operation was aborted","AbortError")}function t6(e){return e.contentLoader||e}function n3(e){return!!(e&&typeof e=="object"&&"url"in e&&"loader"in e&&!("type"in e))}function e6(e){return n3(e)?{...e,basePath:e.basePath||gn.dirname(e.url)}:{url:e.url,loader:e.loader,basePath:e.basePath||gn.dirname(e.url),resolver:e.resolver,coreApi:e.coreApi}}qt();so();var yl=class{header;parent;children=[];childrenLoaded=!1;childrenPromise=null;selected=!1;viewportIds=[];content=null;contentAvailable=!1;contentFailed=!1;isContentLoading=!1;constructor(t,r=null){this.header=t,this.parent=r}get id(){return this.header.id}get level(){return this.header.level}get pointCount(){return this.header.pointCount}get geometricError(){return this.header.geometricError}get boundingVolume(){return this.header.boundingVolume}setSelected(t){this.selected=!0,this.viewportIds.includes(t)||this.viewportIds.push(t)}clearSelection(){this.selected=!1,this.viewportIds=[]}};var r6={debounceTime:0,minimumNodePixelSize:150,maximumScreenSpaceError:1,lodSelectionMetricType:"maxScreenThresholdSQ",densityThreshold:1,pointBudget:2e6,maxDepth:Number.POSITIVE_INFINITY,onTileLoad:()=>{},onTileError:()=>{},onTraversalComplete:e=>e,onUpdate:()=>{}},Om=64,Bm=class{dataSource;options;root=null;cartographicCenter=null;zoom=1;boundingVolume=null;visibleTilesCount=0;frameNumberValue=0;pendingCount=0;lastUpdatedViewports=null;updatePromise=null;tilesMap=new Map;constructor(t,r={}){this.dataSource=t,this.options={...r6,...r},this.tilesetInitializationPromise=this.initialize()}tilesetInitializationPromise;get isReady(){return this.dataSource.isReady}get frameNumber(){return this.frameNumberValue}get tiles(){return Array.from(this.tilesMap.values())}isLoaded(){return this.frameNumberValue>0&&this.pendingCount===0&&this.selectedTiles.every(t=>t.contentAvailable||t.contentFailed)}selectedTiles=[];update(t=null){this.selectTiles(t).catch(()=>{})}destroy(){this.selectedTiles=[],this.tilesMap.clear(),this.root=null,this.cartographicCenter=null,this.boundingVolume=null,this.visibleTilesCount=0,this.pendingCount=0,this.lastUpdatedViewports=null,this.updatePromise=null}async initialize(){await this.dataSource.initialize();let t=await this.dataSource.getRootTile();this.root=this.getOrCreateTile(t,null);let r=await this.dataSource.getViewState?.();this.boundingVolume=r?.boundingVolume||this.root.boundingVolume;let n=r?.cartographicCenter||this.root.boundingVolume.center;this.cartographicCenter=new I(n),this.zoom=r?.zoom||this.estimateZoom(this.boundingVolume)}async selectTiles(t=null){return await this.tilesetInitializationPromise,t&&(this.lastUpdatedViewports=t),this.updatePromise||(this.updatePromise=new Promise((r,n)=>{setTimeout(()=>{this.doSelectTiles().then(()=>r(this.frameNumberValue)).catch(n).finally(()=>{this.updatePromise=null})},this.options.debounceTime)})),this.updatePromise}async doSelectTiles(){if(!this.root||!this.lastUpdatedViewports)return;let t=new Set(this.selectedTiles.map(a=>a.id));for(let a of this.tilesMap.values())a.clearSelection();this.frameNumberValue++;let r=Array.isArray(this.lastUpdatedViewports)?this.lastUpdatedViewports:[this.lastUpdatedViewports],n=new Map,i=new Set,o=0;for(let a of r){let c=this.getTraversalContext(a);o=await this.traverseTiles(c,n,o,i)}this.visibleTilesCount=i.size,this.selectedTiles=this.options.onTraversalComplete(Array.from(n.values()));for(let a of this.selectedTiles)this.loadTile(a).catch(()=>{});let s=new Set(this.selectedTiles.map(a=>a.id));this.haveSameIds(t,s)||this.options.onUpdate()}async traverseTiles(t,r,n,i){if(!this.root)return n;let o=n,s=[{tile:this.root,weight:this.estimateScreenRadius(this.root,t.viewport)}];for(;s.length>0;){s.sort((u,f)=>f.weight-u.weight);let a=s.shift();if(!a)break;let{tile:c,weight:l}=a;if(!this.isVisible(c,t))continue;if(i.add(c.id),!r.has(c.id)&&c.pointCount>0){if(o>0&&o+c.pointCount>this.options.pointBudget)break;r.set(c.id,c),o+=c.pointCount}if(r.has(c.id)&&c.setSelected(t.viewport.id),!this.shouldRefine(c,l))continue;let h=await this.getVisibleChildren(c,t);h.length>0&&s.push(...h)}return o}shouldRefine(t,r){if(t.level<this.options.maxDepth&&Number.isFinite(r)&&(t.header.lodSelectionMetricType||this.options.lodSelectionMetricType)==="density-threshold"){let n=Math.max(1,Math.PI*r*r),i=t.pointCount/n,o=t.header.lodThreshold||this.options.densityThreshold;return i<o}return t.level<this.options.maxDepth&&Number.isFinite(r)&&r>=this.options.minimumNodePixelSize}getTraversalContext(t){let r=this.getCullingVolume(t);return{viewport:t,cullingVolume:this.shouldUseCullingVolume(t,r)?r:null}}isVisible(t,r){if(r.cullingVolume){let i=this.getCommonSpaceBoundingSphere(t.boundingVolume,r.viewport);if(i)return this.isBoundingSphereInsideCullingVolume(i,r.cullingVolume)}let n=this.getProjectedFootprint(t.boundingVolume,r.viewport);return n?this.isProjectedFootprintVisible(n,r.viewport):!1}shouldUseCullingVolume(t,r){if(!this.root||!r)return!1;let n=this.getCommonSpaceBoundingSphere(this.root.boundingVolume,t);if(!n)return!1;if(this.isBoundingSphereInsideCullingVolume(n,r))return!0;let i=this.getProjectedFootprint(this.root.boundingVolume,t);return!i||!this.isProjectedFootprintVisible(i,t)}isBoundingSphereInsideCullingVolume(t,r){return r.computeVisibilityWithPlaneMask(t,sr.MASK_INDETERMINATE)!==sr.MASK_OUTSIDE}isProjectedFootprintVisible(t,r){return!(t.x+t.radius<-Om||t.x-t.radius>r.width+Om||t.y+t.radius<-Om||t.y-t.radius>r.height+Om)}estimateScreenRadius(t,r){let n=this.getProjectedFootprint(t.boundingVolume,r);return n?n.radius:0}projectBounds(t,r){let n=this.getBoundingVolumeCorners(t),i=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,a=Number.NEGATIVE_INFINITY;try{for(let c of n){let[l,h]=r.project(c);!Number.isFinite(l)||!Number.isFinite(h)||(i=Math.min(i,l),o=Math.min(o,h),s=Math.max(s,l),a=Math.max(a,h))}}catch{return null}return!Number.isFinite(i)||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(a)?null:{minX:i,minY:o,maxX:s,maxY:a}}getProjectedFootprint(t,r){let n=Number.NaN,i=Number.NaN;try{[n,i]=r.project(t.center)}catch{return null}if(!Number.isFinite(n)||!Number.isFinite(i))return null;let o=this.getBoundingVolumeCorners(t),s=0;try{for(let a of o){let[c,l]=r.project(a);!Number.isFinite(c)||!Number.isFinite(l)||(s=Math.max(s,Math.hypot(c-n,l-i)))}}catch{return null}if(s===0){let a=this.projectBounds(t,r);a&&(s=Math.max(a.maxX-a.minX,a.maxY-a.minY)/2)}return{x:n,y:i,radius:s}}async getVisibleChildren(t,r){return t.level>=this.options.maxDepth?[]:(await this.getChildren(t)).map(i=>({tile:i,weight:this.estimateScreenRadius(i,r.viewport)})).filter(i=>this.isVisible(i.tile,r))}async getChildren(t){if(t.childrenLoaded)return t.children;if(!t.childrenPromise){let r=this.dataSource.getChildren(t.header).then(n=>n.map(i=>this.getOrCreateTile(i,t))).then(n=>(t.children=n,t.childrenLoaded=!0,n));t.childrenPromise=r.finally(()=>{t.childrenPromise===r&&(t.childrenPromise=null)})}return t.childrenPromise}getOrCreateTile(t,r){let n=this.tilesMap.get(t.id);if(n)return n.header=t,r&&n.parent!==r&&(n.parent=r),n;let i=new yl(t,r);return this.tilesMap.set(t.id,i),r&&!r.children.find(o=>o.id===i.id)&&r.children.push(i),i}async loadTile(t){if(!(t.contentAvailable||t.isContentLoading||t.contentFailed)){t.isContentLoading=!0,this.pendingCount++;try{let r=await this.dataSource.loadTileContent(t.header);t.content=r,t.contentAvailable=!0,r&&this.options.onTileLoad(t)}catch(r){t.contentFailed=!0,this.options.onTileError(t,r)}finally{t.isContentLoading=!1,this.pendingCount--}}}estimateZoom(t){if(!t||t.coordinateFrame==="cartesian")return 1;let[r,n]=t.cartographicBounds,i=t.coversFullLongitude?360:t.wrapsDateline?360-Math.abs(n[0]-r[0]):Math.abs(n[0]-r[0]),o=Math.max(i,1e-6);return Math.max(1,Math.round(Math.log2(360/o)))}haveSameIds(t,r){if(t.size!==r.size)return!1;for(let n of t)if(!r.has(n))return!1;return!0}getBoundingVolumeCorners(t){let[r,n]=t.cartographicBounds,i=t.coversFullLongitude?[[-180,180]]:t.wrapsDateline?[[r[0],180],[-180,n[0]]]:[[r[0],n[0]]],o=[],s=360-Math.abs(n[0]-r[0]),a=r[0]+s/2;for(let[c,l]of i){let h=d=>{if(!t.wrapsDateline)return d;let m=d;for(;m-a>180;)m-=360;for(;m-a<-180;)m+=360;return m},u=h(c),f=h(l);o.push([u,r[1],r[2]||0],[u,r[1],n[2]||0],[u,n[1],r[2]||0],[u,n[1],n[2]||0],[f,r[1],r[2]||0],[f,r[1],n[2]||0],[f,n[1],r[2]||0],[f,n[1],n[2]||0])}return o}getCullingVolume(t){let r=t.getFrustumPlanes?.bind(t);if(!r)return null;let n=r(),i=["left","right","bottom","top","near","far"],o=[];for(let s of i){let a=n[s];if(!a)return null;o.push(new Ge(a.normal,-a.distance))}return new sr(o)}getCommonSpaceBoundingSphere(t,r){let n=r.projectPosition?.bind(r);if(!n)return null;let i=this.getBoundingVolumeCorners(t),o=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;try{for(let u of i){let[f,d,m=0]=n(u);!Number.isFinite(f)||!Number.isFinite(d)||!Number.isFinite(m)||(o=Math.min(o,f),s=Math.min(s,d),a=Math.min(a,m),c=Math.max(c,f),l=Math.max(l,d),h=Math.max(h,m))}}catch{return null}return!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(a)||!Number.isFinite(c)||!Number.isFinite(l)||!Number.isFinite(h)?null:new en().fromCornerPoints([o,s,a],[c,l,h])}};BM();return LP(ef);})();
28
+ }`),this._recordBatchesWithDictionaries=[],this._recordBatches=[],super.close()}}});function qA(e,t){if(Yn(e))return ID(e,t);if(ui(e))return TD(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function TD(e,t){let r=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){o(s,r||(r=e[Symbol.iterator]()))},pull(s){r?o(s,r):s.close()},cancel(){r?.return&&r.return(),r=null}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){let c,l=null,h=s.desiredSize||null;for(;!(l=a.next(n?h:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=nt(l.value))&&(h!=null&&n&&(h=h-c.byteLength+1),l.value=c),s.enqueue(l.value),h!=null&&--h<=0)return;s.close()}}function ID(e,t){let r=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){return Y(this,void 0,void 0,function*(){yield o(s,r||(r=e[Symbol.asyncIterator]()))})},pull(s){return Y(this,void 0,void 0,function*(){r?yield o(s,r):s.close()})},cancel(){return Y(this,void 0,void 0,function*(){r?.return&&(yield r.return()),r=null})}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){return Y(this,void 0,void 0,function*(){let c,l=null,h=s.desiredSize||null;for(;!(l=yield a.next(n?h:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=nt(l.value))&&(h!=null&&n&&(h=h-c.byteLength+1),l.value=c),s.enqueue(l.value),h!=null&&--h<=0)return;s.close()})}}var jA=w(()=>{an();Je();fs()});function $A(e){return new yM(e)}var yM,WA,HA,YA=w(()=>{an();qu();yM=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:r,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,o=n3(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Ei(o),this._getSize=i!=="bytes"?WA:HA;let{["highWaterMark"]:s=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},r),{["highWaterMark"]:a=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:s,size:i!=="bytes"?WA:HA}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:c=>this._writeValueAndReturnChunkSize(c)})}_writeValueAndReturnChunkSize(t){let r=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-r}_maybeFlush(t,r){r!=null&&(this._bufferedSize>=r.desiredSize&&++this._numChunks&&this._enqueue(r,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(r,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(r,null)))}_enqueue(t,r){this._bufferedSize=0,this._controller=null,r==null?t.close():t.enqueue(r)}},WA=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},HA=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0}});function r0(e,t){let r=new Qn,n=null,i=new ReadableStream({cancel(){return Y(this,void 0,void 0,function*(){yield r.close()})},start(a){return Y(this,void 0,void 0,function*(){yield s(a,n||(n=yield o()))})},pull(a){return Y(this,void 0,void 0,function*(){n?yield s(a,n):a.close()})}});return{writable:new WritableStream(r,Object.assign({highWaterMark:Math.pow(2,14)},e)),readable:i};function o(){return Y(this,void 0,void 0,function*(){return yield(yield Kr.from(r)).open(t)})}function s(a,c){return Y(this,void 0,void 0,function*(){let l=a.desiredSize,h=null;for(;!(h=yield c.next()).done;)if(a.enqueue(h.value),l!=null&&--l<=0)return;a.close()})}}var KA=w(()=>{an();Us();Yu()});function n0(e,t){let r=new this(e),n=new mn(r),i=new ReadableStream({cancel(){return Y(this,void 0,void 0,function*(){yield n.cancel()})},pull(s){return Y(this,void 0,void 0,function*(){yield o(s)})},start(s){return Y(this,void 0,void 0,function*(){yield o(s)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(r,e),readable:i};function o(s){return Y(this,void 0,void 0,function*(){let a=null,c=s.desiredSize;for(;a=yield n.read(c||null);)if(s.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;s.close()})}}var XA=w(()=>{an();Us()});function i0(e){let t=Kr.from(e);return Tn(t)?t.then(r=>i0(r)):t.isAsync()?t.readAll().then(r=>new ce(r)):new ce(t.readAll())}function wM(e,t="stream",r=null){let n={compressionType:r};return(t==="stream"?Lo:Do).writeAll(e,n).toUint8Array(!0)}var ZA=w(()=>{gc();fs();Yu();e0()});var _M={};Zr(_M,{isArrowData:()=>c0,isArrowDataType:()=>a0,isArrowField:()=>s0,isArrowRecordBatch:()=>h0,isArrowSchema:()=>o0,isArrowTable:()=>u0,isArrowVector:()=>l0});function o0(e){return _t.isSchema(e)}function s0(e){return Z.isField(e)}function a0(e){return z.isDataType(e)}function c0(e){return ut.isData(e)}function l0(e){return $.isVector(e)}function h0(e){return Zt.isRecordBatch(e)}function u0(e){return ce.isTable(e)}var MM=w(()=>{Rr();te();Zn();Ar();Ro();gc()});var JA,bM=w(()=>{Xm();bl();Ne();Zn();te();gc();Ar();fn();Rr();Bu();gp();me();qu();R_();q_();C_();N_();B_();O_();D_();G_();H_();W_();F_();U_();Y_();X_();K_();Fp();Gp();Up();z_();V_();L_();k_();j_();$_();Us();Yu();e0();ZA();Kp();Yp();Fs();Ro();MM();Zm();v_();ka();Nu();Je();Ol();vu();Op();MM();$u();JA=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},$w),S_),l_),Yw),dw),c_),qw),P_),_M),{compareSchemas:pc,compareFields:MA,compareTypes:kp})});var Mc={};Zr(Mc,{AsyncByteQueue:()=>Qn,AsyncByteStream:()=>mn,AsyncMessageReader:()=>wc,AsyncRecordBatchFileReader:()=>Wl,AsyncRecordBatchStreamReader:()=>Co,Binary:()=>ln,BinaryBuilder:()=>vo,BinaryView:()=>Mt,BinaryViewBuilder:()=>Io,Bool:()=>Er,BoolBuilder:()=>$a,BufferType:()=>xe,Builder:()=>oe,ByteStream:()=>ti,CompressionType:()=>ur,Data:()=>ut,DataType:()=>z,DateBuilder:()=>$i,DateDay:()=>bs,DateDayBuilder:()=>zs,DateMillisecond:()=>xs,DateMillisecondBuilder:()=>Vs,DateUnit:()=>Qt,Date_:()=>jr,Decimal:()=>hn,DecimalBuilder:()=>ks,DenseUnion:()=>wo,DenseUnionBuilder:()=>dc,Dictionary:()=>We,DictionaryBuilder:()=>Ya,Duration:()=>Wr,DurationBuilder:()=>ei,DurationMicrosecond:()=>Pu,DurationMicrosecondBuilder:()=>Ks,DurationMillisecond:()=>Au,DurationMillisecondBuilder:()=>Ys,DurationNanosecond:()=>Ru,DurationNanosecondBuilder:()=>Xs,DurationSecond:()=>Iu,DurationSecondBuilder:()=>$s,Field:()=>Z,FixedSizeBinary:()=>un,FixedSizeBinaryBuilder:()=>qs,FixedSizeList:()=>_e,FixedSizeListBuilder:()=>Ka,Float:()=>Sr,Float16:()=>_i,Float16Builder:()=>Xa,Float32:()=>kr,Float32Builder:()=>Za,Float64:()=>Bn,Float64Builder:()=>Ja,FloatBuilder:()=>Yi,Int:()=>Se,Int16:()=>Pn,Int16Builder:()=>tc,Int32:()=>Ve,Int32Builder:()=>ec,Int64:()=>Rn,Int64Builder:()=>rc,Int8:()=>An,Int8Builder:()=>Qa,IntBuilder:()=>$r,Interval:()=>Tr,IntervalBuilder:()=>Ti,IntervalDayTime:()=>Rs,IntervalDayTimeBuilder:()=>js,IntervalMonthDayNano:()=>Tu,IntervalMonthDayNanoBuilder:()=>Hs,IntervalUnit:()=>Lt,IntervalYearMonth:()=>Cs,IntervalYearMonthBuilder:()=>Ws,JSONMessageReader:()=>_c,LargeBinary:()=>Mi,LargeBinaryBuilder:()=>Eo,LargeList:()=>On,LargeListBuilder:()=>cc,LargeUtf8:()=>bi,LargeUtf8Builder:()=>sa,List:()=>je,ListBuilder:()=>ac,MapBuilder:()=>lc,MapRow:()=>Xn,Map_:()=>Ir,Message:()=>Nr,MessageHeader:()=>Nt,MessageReader:()=>aa,MetadataVersion:()=>Xt,Null:()=>De,NullBuilder:()=>hc,Precision:()=>Vt,RecordBatch:()=>Zt,RecordBatchFileReader:()=>No,RecordBatchFileWriter:()=>Do,RecordBatchJSONWriter:()=>Xu,RecordBatchReader:()=>Kr,RecordBatchStreamReader:()=>Ii,RecordBatchStreamWriter:()=>Lo,RecordBatchWriter:()=>Xi,Schema:()=>_t,SparseUnion:()=>Ns,SparseUnionBuilder:()=>fc,Struct:()=>Yt,StructBuilder:()=>uc,StructRow:()=>ji,Table:()=>ce,Time:()=>fr,TimeBuilder:()=>ni,TimeMicrosecond:()=>Es,TimeMicrosecondBuilder:()=>na,TimeMillisecond:()=>vs,TimeMillisecondBuilder:()=>ra,TimeNanosecond:()=>Ts,TimeNanosecondBuilder:()=>ia,TimeSecond:()=>Ss,TimeSecondBuilder:()=>ea,TimeUnit:()=>q,Timestamp:()=>dr,TimestampBuilder:()=>ri,TimestampMicrosecond:()=>As,TimestampMicrosecondBuilder:()=>Qs,TimestampMillisecond:()=>qi,TimestampMillisecondBuilder:()=>Js,TimestampNanosecond:()=>Ps,TimestampNanosecondBuilder:()=>ta,TimestampSecond:()=>Is,TimestampSecondBuilder:()=>Zs,Type:()=>b,Uint16:()=>Nn,Uint16Builder:()=>ic,Uint32:()=>Vr,Uint32Builder:()=>oc,Uint64:()=>wi,Uint64Builder:()=>sc,Uint8:()=>Cn,Uint8Builder:()=>nc,Union:()=>Hr,UnionBuilder:()=>To,UnionMode:()=>jt,Utf8:()=>vr,Utf8Builder:()=>oa,Utf8View:()=>qr,Utf8ViewBuilder:()=>mc,Vector:()=>$,Visitor:()=>rt,builderThroughAsyncIterable:()=>eM,builderThroughIterable:()=>jp,compressionRegistry:()=>ca,isArrowData:()=>c0,isArrowDataType:()=>a0,isArrowField:()=>s0,isArrowRecordBatch:()=>h0,isArrowSchema:()=>o0,isArrowTable:()=>u0,isArrowVector:()=>l0,makeBuilder:()=>Ei,makeData:()=>Q,makeTable:()=>rM,makeVector:()=>Hi,tableFromArrays:()=>nM,tableFromIPC:()=>i0,tableFromJSON:()=>tM,tableToIPC:()=>wM,util:()=>JA,vectorFromArray:()=>kl});var Yl=w(()=>{lu();me();Yu();e0();jA();YA();KA();XA();bM();bM();lr.toDOMStream=qA;oe.throughDOM=$A;Kr.throughDOM=r0;No.throughDOM=r0;Ii.throughDOM=r0;Xi.throughDOM=n0;Do.throughDOM=n0;Lo.throughDOM=n0});function rP(e){return{fields:e.fields.map(t=>bc(t)),metadata:nP(e.metadata)}}function nP(e){return Object.fromEntries(e)}function xM(e){return e?new Map(Object.entries(e)):new Map}function bc(e){return{name:e.name,type:iP(e.type),nullable:e.nullable,metadata:nP(e.metadata)}}function Fo(e,t){return new Z(e.name,f0(e.type,t),e.nullable,xM(e.metadata))}function iP(e){if(QA(e,"BinaryView"))return"binary-view";if(QA(e,"Utf8View"))return"utf8-view";if(AD(e,"LargeList"))return{type:"large-list",children:[bc(e.valueField)]};switch(e.constructor){case De:return"null";case ln:return"binary";case un:return{type:"fixed-size-binary",byteWidth:e.byteWidth};case Er:return"bool";case Se:let t=e;return`${t.isSigned?"":"u"}int${t.bitWidth}`;case An:return"int8";case Pn:return"int16";case Ve:return"int32";case Rn:return"int64";case Cn:return"uint8";case Nn:return"uint16";case Vr:return"uint32";case wi:return"uint64";case Sr:switch(e.precision){case Vt.HALF:return"float16";case Vt.SINGLE:return"float32";case Vt.DOUBLE:return"float64";default:return"float16"}case _i:return"float16";case kr:return"float32";case Bn:return"float64";case vr:return"utf8";case hn:let n=e;return{type:"decimal",bitWidth:n.bitWidth,precision:n.precision,scale:n.scale};case jr:return e.unit===Qt.DAY?"date-day":"date-millisecond";case bs:return"date-day";case xs:return"date-millisecond";case fr:switch(e.unit){case q.SECOND:return"time-second";case q.MILLISECOND:return"time-millisecond";case q.MICROSECOND:return"time-microsecond";case q.NANOSECOND:return"time-nanosecond";default:return"time-second"}case vs:return"time-millisecond";case Ss:return"time-second";case Es:return"time-microsecond";case Ts:return"time-nanosecond";case dr:switch(e.unit){case q.SECOND:return"timestamp-second";case q.MILLISECOND:return"timestamp-millisecond";case q.MICROSECOND:return"timestamp-microsecond";case q.NANOSECOND:return"timestamp-nanosecond";default:return"timestamp-second"}case Is:return"timestamp-second";case qi:return"timestamp-millisecond";case As:return"timestamp-microsecond";case Ps:return"timestamp-nanosecond";case Tr:switch(e.unit){case Lt.DAY_TIME:return"interval-daytime";case Lt.YEAR_MONTH:return"interval-yearmonth";default:return"interval-daytime"}case Rs:return"interval-daytime";case Cs:return"interval-yearmonth";case Ir:let c=e;return{type:"map",keysSorted:c.keysSorted,children:c.children.map(p=>bc(p))};case je:let h=e.valueField;return{type:"list",children:[bc(h)]};case _e:let u=e;return{type:"fixed-size-list",listSize:u.listSize,children:[bc(u.children[0])]};case Yt:return{type:"struct",children:e.children.map(p=>bc(p))};case Ns:case wo:let d=e;return{type:d instanceof wo?"dense-union":"sparse-union",typeIds:d.typeIds,children:d.children.map(p=>bc(p)),typeIdToChildIndex:{...d.typeIdToChildIndex}};case We:let m=e;return{type:"dictionary",id:m.id,indices:PD(m.indices),dictionary:iP(m.dictionary),isOrdered:m.isOrdered};default:throw new Error(`arrow type not supported: ${e.constructor.name}`)}}function f0(e,t){if(typeof e=="object")switch(e.type){case"decimal":return new hn(e.scale,e.precision,e.bitWidth);case"map":{let r=e.children.map(n=>Fo(n,t));return new Ir(r[0],e.keysSorted)}case"list":{let r=Fo(e.children[0],t);return new je(r)}case"large-list":{let r=Fo(e.children[0],t),n=Zu("LargeList");if(!n)throw new Error("LargeList requires an Apache Arrow runtime that exports the LargeList constructor");return new n(r)}case"fixed-size-list":{let r=Fo(e.children[0],t);return new _e(e.listSize,r)}case"fixed-size-binary":return new un(e.byteWidth);case"struct":{let r=e.children.map(n=>Fo(n,t));return new Yt(r)}case"sparse-union":case"dense-union":{let r=e.children.map(n=>Fo(n,t));return e.type==="dense-union"?new wo(e.typeIds,r):new Ns(e.typeIds,r)}case"dictionary":return new We(f0(e.dictionary,t),CD(e.indices),e.id,e.isOrdered);default:throw new Error("array type not supported")}switch(e){case"null":return new De;case"binary":return tP("BinaryView",new ln,t);case"binary-view":return eP("BinaryView");case"bool":return new Er;case"int8":return new An;case"int16":return new Pn;case"int32":return new Ve;case"int64":return new Rn;case"uint8":return new Cn;case"uint16":return new Nn;case"uint32":return new Vr;case"uint64":return new wi;case"float16":return new _i;case"float32":return new kr;case"float64":return new Bn;case"utf8":return tP("Utf8View",new vr,t);case"utf8-view":return eP("Utf8View");case"date-day":return new bs;case"date-millisecond":return new xs;case"time-second":return new Ss;case"time-millisecond":return new vs;case"time-microsecond":return new Es;case"time-nanosecond":return new Ts;case"timestamp-second":return new Is;case"timestamp-millisecond":return new qi;case"timestamp-microsecond":return new As;case"timestamp-nanosecond":return new Ps;case"interval-daytime":return new Rs;case"interval-yearmonth":return new Cs;default:throw new Error("array type not supported")}}function Zu(e){return Mc[e]}function QA(e,t){let r=Zu(t);if(r&&e instanceof r)return!0;let n=z;return!!(t==="BinaryView"?n.isBinaryView:n.isUtf8View)?.(e)}function AD(e,t){let r=Zu(t);return!!(r&&e instanceof r)}function tP(e,t,r){let n=r?.viewTypes||"never";if(n==="never")return t;let i=Zu(e);if(i)return new i;if(n==="require")throw new Error(`${e} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`);return t}function eP(e){let t=Zu(e);if(!t)throw new Error(`${e} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`);return new t}function PD(e){if(e instanceof Se){let r=`${e.isSigned?"int":"uint"}${e.bitWidth}`;if(RD(r))return r}switch(e.constructor){case An:return"int8";case Pn:return"int16";case Ve:return"int32";case Cn:return"uint8";case Nn:return"uint16";case Vr:return"uint32";default:throw new Error(`arrow dictionary index type not supported: ${e.constructor.name}`)}}function RD(e){return["int8","int16","int32","uint8","uint16","uint32"].includes(e)}function CD(e){switch(e){case"int8":return new An;case"int16":return new Pn;case"int32":return new Ve;case"uint8":return new Cn;case"uint16":return new Nn;case"uint32":return new Vr;default:throw new Error(`schema dictionary index type not supported: ${e}`)}}var d0=w(()=>{"use strict";Yl()});function oP(e){return!!(e&&typeof e=="object"&&"schema"in e&&"batches"in e&&Array.isArray(e.batches)&&"numRows"in e&&typeof e.numRows=="number"&&"getChildAt"in e&&typeof e.getChildAt=="function")}var sP=w(()=>{"use strict"});function m0(e){let t=e?.POSITION;if(!t||!("value"in t)||!t.value.length)return null;let r=1/0,n=1/0,i=1/0,o=-1/0,s=-1/0,a=-1/0,c=t.value,l=c.length;for(let h=0;h<l;h+=3){let u=c[h],f=c[h+1],d=c[h+2];r=u<r?u:r,n=f<n?f:n,i=d<i?d:i,o=u>o?u:o,s=f>s?f:s,a=d>a?d:a}return[[r,n,i],[o,s,a]]}var aP=w(()=>{"use strict"});var cP=w(()=>{"use strict";aP()});function SM(e){let t=od();return new t(e)}function la(e){return!!(Fc&&e instanceof Fc)}function vM(e,t,r){la(e)?e[t]=r:e[t]=lP(r)}function EM(e,t){return la(e)?e[t]:ND(e[t])}function Ju(e){return la(e)?new Uint16Array(e.buffer,e.byteOffset,e.length):e}function lP(e){if(!Number.isFinite(e))return e===1/0?31744:e===-1/0?64512:32256;let t=e<0||Object.is(e,-0)?32768:0,r=Math.abs(e);if(r===0)return t;if(r>=65520)return t|31744;if(r>=65504)return t|31743;let n=Math.floor(Math.log2(r));if(n<-14)return t|Math.round(r/2**-24);let i=n+15,o=Math.round((r/2**n-1)*1024);return o===1024?t|i+1<<10:t|i<<10|o}function ND(e){let t=e&32768?-1:1,r=e>>10&31,n=e&1023;return r===0?t*n*2**-24:r===31?n?NaN:t*(1/0):t*(1+n/1024)*2**(r-15)}var hP=w(()=>{"use strict";qt()});var p0,TM,uP=w(()=>{"use strict";Yl();p0=new _t([new Z("POSITION",new _e(3,new Z("value",new kr,!1)),!1)]),TM=new _t([...p0.fields,new Z("indices",new je(new Z("item",new Vr,!1)),!0)])});var Qu=w(()=>{"use strict";hP();uP()});function fP(e){return e.type instanceof _e?e.type.listSize:1}function IM(e,t,r){let n=BD(e,t,r);return new $([n])}function BD(e,t,r){let n=OD(e,t,r),i=n.children[0].type,o=r==="float16"&&la(e)?Ju(e):e,s={[xe.DATA]:o},a=new ut(i,0,o.length,0,s);return new ut(n,0,o.length/t,0,void 0,[a])}function OD(e,t,r){let n=r||t3(e).type,i=f0(n);return new _e(t,new Z("value",i,!1))}var AM=w(()=>{"use strict";Qu();Yl();e3();d0()});function PM(e){return mP(e.attributes,{schema:e.schema,topology:e.topology,mode:e.mode,boundingBox:e.header?.boundingBox,indices:FD(e)?e.indices:void 0})}function mP(e,t={}){let r=[],n={},i=DD(e);for(let s of i){let a=e[s],{value:c,size:l=1}=a,h=LD(c,l,a.componentType);if(n[s]=h,r.push(UD(t.schema,s,h,a.componentType)),s===i[0]&&t.indices?.value?.length){let u=TM.fields.find(f=>f.name==="indices");n.indices=zD(t.indices.value,h.length,u.type),r.push(u)}}let o=new _t(r,VD(t));return n[i[0]]?.length===0?new ce(o):new ce(o,n)}function LD(e,t,r){if(r==="float16"){let n=la(e)?Ju(e):e;if(t===1){let i=new ut(new _i,0,n.length,0,{[xe.DATA]:n});return new $([i])}return IM(e,t,r)}return t===1?Hi(e):IM(e,t)}function DD(e){let t=Object.keys(e),r=dP.filter(i=>i in e),n=t.filter(i=>!dP.includes(i));return[...r,...n]}function FD(e){return!!e.indices?.value?.length}function UD(e,t,r,n){if(t==="POSITION"&&GD(r)){let o=p0.fields[0],s=e?.fields.find(c=>c.name===t);if(!s?.metadata)return o;let a=new Map(o.metadata);for(let[c,l]of Object.entries(s.metadata))a.set(c,l);return new Z(o.name,o.type,o.nullable,a)}let i=e?.fields.find(o=>o.name===t);if(n==="float16"){let o=new Map(Object.entries(i?.metadata||{}));return o.set("componentType","float16"),new Z(t,r.type,!1,o)}if(i&&i.type.toString()!==r.type.toString()){let o=Fo(i);return new Z(t,r.type,o.nullable,o.metadata)}return i?Fo(i):new Z(t,r.type,!1)}function GD(e){return e.type instanceof _e&&e.type.listSize===3&&e.type.children[0].type instanceof kr}function zD(e,t,r){let n=r,i=e instanceof Uint32Array?e:Uint32Array.from(e),o=new Int32Array(t+1);t>0&&o.fill(i.length,1);let s=new Uint8Array(Math.ceil(t/8));t>0&&(s[0]=1);let a=new ut(n.children[0].type,0,i.length,0,{[xe.DATA]:i}),c=new ut(n,0,t,Math.max(0,t-1),{[xe.OFFSET]:o,[xe.VALIDITY]:s},[a]);return new $([c])}function VD(e){let t={...e.schema?.metadata};return e.topology&&(t.topology||=e.topology),Number.isFinite(e.mode)&&(t.mode||=String(e.mode)),e.boundingBox&&(t.boundingBox||=JSON.stringify(e.boundingBox)),xM(t)}var dP,pP=w(()=>{"use strict";Qu();Qu();Yl();AM();d0();dP=["POSITION"]});function gP(e){if(oP(e))return kD(e);throw new Error(e.shape)}function kD(e){let t=rP(e.schema),r=e.batches.length===1?e.batches[0].metadata.get("boundingBox"):void 0;r&&(t.metadata={...t.metadata,boundingBox:r});let n=t.fields,i={},o=[];for(let h of n){let{name:u}=h;if(u==="indices")continue;let f=e.getChild(u),d=fP(f),m=$D(f,d),p=jD(h.metadata),g=p.componentType==="float16"?YD(m):m,y=o.find(_=>_.data.length===f.data.length&&i[_.name].value.constructor===g.constructor&&_.data.every((M,x)=>yP(M,f.data[x])));i[u]={value:y?i[y.name].value:g,size:d,...p},y||o.push({name:u,data:f.data})}HD(t);let s=t.metadata.topology,a=KD(t),c=XD(e),l=i.POSITION?.transform?.type==="quantization"?qD(t)||m0(i):m0(i);return{schema:t,attributes:i,topology:s,mode:a,indices:c,header:{vertexCount:e.numRows,boundingBox:l??void 0}}}function qD(e){let t=e.metadata?.boundingBox;if(!t)return null;try{let r=JSON.parse(t);if(Array.isArray(r)&&r.length===2&&r.every(n=>Array.isArray(n)&&n.length===3&&n.every(i=>typeof i=="number")))return r}catch{}return null}function jD(e={}){let t={};if(e.byteOffset!==void 0&&(t.byteOffset=Number(e.byteOffset)),e.byteStride!==void 0&&(t.byteStride=Number(e.byteStride)),e.normalized!==void 0&&(t.normalized=e.normalized==="true"),e.componentType==="float16"&&(t.componentType="float16"),e["loaders.gl.transform"])try{let r=JSON.parse(e["loaders.gl.transform"]);WD(r)&&(t.transform=r)}catch{}return t}function WD(e){if(!e||typeof e!="object"||!("type"in e))return!1;let t=e;return t.type==="octahedron"?Number.isInteger(t.bits)&&t.bits>=1&&t.bits<=30:t.type==="quantization"&&Number.isInteger(t.bits)&&t.bits>=1&&t.bits<=30&&Array.isArray(t.origin)&&t.origin.every(r=>typeof r=="number")&&typeof t.range=="number"}function HD(e){e.metadata||={},e.metadata.topology||="point-list",e.metadata.mode||="0"}function $D(e,t){if(!(e.type instanceof _e))return e.toArray();if(e.length===0){let s=e.type.valueType.ArrayType;return new s(0)}let n=e.data.find(s=>s.length>0).children[0].values.constructor,i=new n(e.length*t),o=0;for(let s of e.data){let a=s.length*t;if(a===0)continue;let c=s.children[0],l=c.offset||s.offset*t,h=l+a<=c.values.length?l:0,u=c.values.subarray(h,h+a);i.set(u,o),o+=a}return i}function YD(e){let t=SM(e.length);for(let r=0;r<e.length;r++)vM(t,r,EM(e,r));return t}function KD(e){let t=Number(e.metadata?.mode);return Number.isFinite(t)?t:0}function XD(e){let t=e.getChild("indices");if(!t?.isValid(0))return;let r=t.data[0],n=r.valueOffsets,i=n[r.offset],o=n[r.offset+1];return{value:r.children[0].values.subarray(i,o),size:1}}function yP(e,t){let r=Object.values(t.buffers);return e.type.toString()===t.type.toString()&&e.offset===t.offset&&e.length===t.length&&e.nullCount===t.nullCount&&e.dictionary===t.dictionary&&Object.values(e.buffers).every((n,i)=>{let o=r[i];return n===o||!!(n&&o&&n.buffer===o.buffer&&n.byteOffset===o.byteOffset&&n.byteLength===o.byteLength)})&&e.children.length===t.children.length&&e.children.every((n,i)=>yP(n,t.children[i]))}var wP=w(()=>{"use strict";Qu();Yl();AM();d0();sP();cP()});function _P(e){return[e.value.constructor.name,e.value.byteOffset,e.value.byteLength,e.size,e.byteOffset??0,e.byteStride||e.size*e.value.BYTES_PER_ELEMENT].join(":")}var tf,MP=w(()=>{"use strict";wP();tf=class{ready;sourcePointCount=0;get pointCount(){return this.sourcePointCount}controller=new AbortController;options;signal;mesh=null;nodes=new Map;indexBytes=0;pointByteLength=0;constructor(t,r={}){this.options={nodePointLimit:r.nodePointLimit??5e4,maximumDepth:r.maximumDepth??16,maxInputBytes:r.maxInputBytes??512*1024*1024,maxIndexBytes:r.maxIndexBytes??128*1024*1024,maxTileBytes:r.maxTileBytes??64*1024*1024,maxNodes:r.maxNodes??1e5};for(let[n,i]of Object.entries(this.options))if(!Number.isSafeInteger(i)||i<(n==="maximumDepth"?0:1))throw new Error(`PointCloudTiler: invalid ${n}`);if(this.options.maximumDepth>24||this.options.nodePointLimit>1e6)throw new Error("PointCloudTiler: maximumDepth must be <= 24 and nodePointLimit <= 1000000");this.signal=r.signal?AbortSignal.any([r.signal,this.controller.signal]):this.controller.signal,this.ready=this.initialize(t).catch(n=>{throw this.close(),n})}async getRootNode(){return await this.ready,this.getNode("r").node}async getNodeMetadata(t){return await this.ready,this.getNode(t).node}async getChildNodes(t){await this.ready;let r=this.getNode(t);return r.childrenPromise||(r.childrenPromise=this.splitNode(r)),r.childrenPromise}async splitNode(t){let r=t.node.id;if(t.children)return t.children;let n=Array.from({length:8},()=>0),i=t.node.bounds[0].map((a,c)=>a+(t.node.bounds[1][c]-a)/2);for(let a=0;a<t.remaining.length;a++)a%65536===0&&await this.checkpoint(),n[this.getOctant(t.remaining[a],i)]++;if(this.nodes.size+n.filter(a=>a>0).length>this.options.maxNodes)throw new Error("PointCloudTiler: node budget exceeded");let o=[],s=[];try{for(let c of n)s.push(this.allocateRows(c));let a=new Uint32Array(8);for(let c=0;c<t.remaining.length;c++){c%65536===0&&await this.checkpoint();let l=t.remaining[c],h=this.getOctant(l,i);s[h][a[h]++]=l}for(let c=0;c<8;c++){if(!s[c].length)continue;let l=t.node.bounds.map(u=>[...u]);for(let u=0;u<3;u++)l[c&4>>u?0:1][u]=i[u];let h=await this.createNode(`${r}${c}`,l,s[c]);s[c]=new Uint32Array(0),o.push(h.node)}return this.releaseRows(t.remaining),t.remaining=new Uint32Array(0),t.children=Object.freeze(o),t.children}catch(a){throw this.close(),a}}async getTileMesh(t){await this.ready;let r=this.getNode(t);if(r.rows.length*this.pointByteLength>this.options.maxTileBytes)throw new Error("PointCloudTiler: tile byte budget exceeded");let i={},o=new Map;for(let[s,a]of Object.entries(this.mesh.attributes)){let c=_P(a),l=o.get(a.value.buffer)?.get(c);if(l){i[s]={...a,value:l,byteOffset:0,byteStride:0};continue}let h=a.value.constructor,u=new h(r.rows.length*a.size),f=new Uint8Array(a.value.buffer,a.value.byteOffset,a.value.byteLength),d=new Uint8Array(u.buffer,u.byteOffset,u.byteLength),m=a.value.BYTES_PER_ELEMENT,p=a.size*m,g=a.byteStride||p;for(let _=0;_<r.rows.length;_++){_%65536===0&&await this.checkpoint();let M=(a.byteOffset||0)+r.rows[_]*g;d.set(f.subarray(M,M+p),_*p)}let y=o.get(a.value.buffer)??new Map;y.set(c,u),o.set(a.value.buffer,y),i[s]={...a,value:u,byteOffset:0,byteStride:0}}return{...this.mesh,attributes:i,topology:"point-list",mode:0,indices:void 0,header:{vertexCount:r.rows.length,boundingBox:r.node.bounds.map(s=>[...s])},loaderData:{...this.mesh.loaderData,pointCloudTileId:t}}}close(){this.controller.abort(new Error("PointCloudTiler: closed")),this.mesh=null,this.nodes.clear(),this.indexBytes=0}async initialize(t){if(this.signal.throwIfAborted(),!("attributes"in t)){let f=t,d=new Set,m=0,p=g=>{if(g.nullCount)throw new Error("PointCloudTiler: null point attributes require an explicit mapping");for(let y of Object.values(g.buffers))y&&!d.has(y.buffer)&&(d.add(y.buffer),m+=y.buffer.byteLength);for(let y of g.children)p(y);if(g.dictionary)for(let y of g.dictionary.data)p(y)};for(let g of f.batches)p(g.data);if(m>this.options.maxInputBytes)throw new Error("PointCloudTiler: input byte budget exceeded");for(let g of f.schema.fields)if(f.getChild(g.name)?.nullCount)throw new Error("PointCloudTiler: null point attributes require an explicit mapping")}let r="attributes"in t?t:gP(t);if(r.topology!=="point-list"||r.indices)throw new Error("PointCloudTiler: unindexed point-list input required");let n=r.attributes.POSITION;if(!n||n.size!==3||!(n.value instanceof Float32Array||n.value instanceof Float64Array)||n.transform||n.normalized||n.componentType==="float16")throw new Error("PointCloudTiler: POSITION requires decoded floating-point XYZ");if(!r.header&&(n.byteOffset||n.byteStride))throw new Error("PointCloudTiler: strided POSITION requires vertexCount");let i=r.header?.vertexCount??n.value.length/3;if(!Number.isSafeInteger(i)||i<0||i>4294967295)throw new Error("PointCloudTiler: invalid point count");let o=0,s=new Map,a=new Set;for(let f of Object.values(r.attributes)){this.validateAttribute(f,i),a.has(f.value.buffer)||(a.add(f.value.buffer),o+=f.value.buffer.byteLength);let d=s.get(f.value.buffer)??new Set,m=_P(f);d.has(m)||(this.pointByteLength+=f.size*f.value.BYTES_PER_ELEMENT,d.add(m),s.set(f.value.buffer,d))}if(o>this.options.maxInputBytes)throw new Error("PointCloudTiler: input byte budget exceeded");this.mesh=r,this.sourcePointCount=i;let c=this.allocateRows(i),l=[1/0,1/0,1/0],h=[-1/0,-1/0,-1/0];for(let f=0;f<i;f++){f%65536===0&&await this.checkpoint(),c[f]=f;for(let d=0;d<3;d++){let m=this.getCoordinate(f,d);if(!Number.isFinite(m))throw new Error("PointCloudTiler: nonfinite position");l[d]=Math.min(l[d],m),h[d]=Math.max(h[d],m)}}i||(l.fill(0),h.fill(0));let u=Math.max(...l.map((f,d)=>h[d]-f));if(!Number.isFinite(u))throw new Error("PointCloudTiler: coordinate extent overflow");for(let f=0;f<3;f++)h[f]=l[f]+u;if(!h.every(Number.isFinite)||!Number.isFinite(Math.hypot(u,u,u)))throw new Error("PointCloudTiler: coordinate extent overflow");await this.createNode("r",[l,h],c),this.signal.throwIfAborted()}async createNode(t,r,n){let i=t.length-1>=this.options.maximumDepth||r[0].every((c,l)=>c===r[1][l])||n.length<=this.options.nodePointLimit,o=n,s=new Uint32Array(0);if(!i){let c=Math.ceil(Math.cbrt(this.options.nodePointLimit)),l=new Set,h=this.allocateRows(Math.min(n.length,this.options.nodePointLimit)),u=this.allocateRows(n.length),f=0,d=0;for(let m=0;m<n.length;m++){m%65536===0&&await this.checkpoint();let p=n[m],g=0;for(let y=0;y<3;y++){let _=Math.min(c-1,Math.floor((this.getCoordinate(p,y)-r[0][y])/(r[1][y]-r[0][y])*c));g=g*c+_}f<h.length&&!l.has(g)?(l.add(g),h[f++]=p):u[d++]=p}o=h.subarray(0,f),s=u.subarray(0,d),this.releaseRows(n)}let a={node:{id:t,level:t.length-1,pointCount:o.length,bounds:r,geometricError:s.length?Math.hypot(...r[0].map((c,l)=>r[1][l]-c)):0},rows:o,remaining:s};if(Object.freeze(r[0]),Object.freeze(r[1]),Object.freeze(r),Object.freeze(a.node),this.signal.throwIfAborted(),this.nodes.size>=this.options.maxNodes)throw new Error("PointCloudTiler: node budget exceeded");return this.nodes.set(t,a),a}getCoordinate(t,r){let n=this.mesh.attributes.POSITION;return Number(n.value[(n.byteOffset||0)/n.value.BYTES_PER_ELEMENT+t*(n.byteStride||3*n.value.BYTES_PER_ELEMENT)/n.value.BYTES_PER_ELEMENT+r])}validateAttribute(t,r){let n=t.value?.BYTES_PER_ELEMENT,i=t.byteOffset??0,o=t.byteStride||t.size*n;if(!n||!Number.isSafeInteger(t.size)||t.size<1||!Number.isSafeInteger(i)||i<0||i%n||!Number.isSafeInteger(o)||o<t.size*n||o%n||r&&i+(r-1)*o+t.size*n>t.value.byteLength)throw new Error("PointCloudTiler: invalid attribute layout")}allocateRows(t){if(t*4>this.options.maxIndexBytes-this.indexBytes)throw new Error("PointCloudTiler: index byte budget exceeded");let r=new Uint32Array(t);return this.indexBytes+=r.byteLength,r}releaseRows(t){this.indexBytes-=t.buffer.byteLength}getNode(t){this.signal.throwIfAborted();let r=this.nodes.get(t);if(!r)throw new Error(`PointCloudTiler: unknown tile ${t}`);return r}getOctant(t,r){let n=0;for(let i=0;i<3;i++)this.getCoordinate(t,i)>=r[i]&&(n|=4>>i);return n}async checkpoint(){this.signal.throwIfAborted(),await new Promise(t=>setTimeout(t,0)),this.signal.throwIfAborted()}}});var bP=w(()=>{"use strict";pP();MP()});var g0,xP=w(()=>{"use strict";Wn();bP();g0=class extends mh{ready;isReady=!1;tiler;constructor(t,r={},n){super(null,r,{pointCloudTiler:{}},n),this.tiler=new tf(t,r.pointCloudTiler),this.ready=this.tiler.getRootNode().then(()=>{this.isReady=!0}),this.ready.catch(()=>{})}async initialize(){await this.ready,await this.tiler.getRootNode()}async getMetadata(){return await this.initialize(),{pointCount:this.tiler.pointCount,refinement:"ADD"}}async getRootTile(){return this.createHeader(await this.tiler.getRootNode())}async getChildren(t){return(await this.tiler.getChildNodes(t.id)).map(r=>this.createHeader(r))}async loadTileContent(t){let r=await this.tiler.getTileMesh(t.id);return r.header.vertexCount?{data:PM(r),pointCount:r.header.vertexCount,cartographicOrigin:[0,0,0],coordinateSystem:"cartesian",spatialReference:this.options.pointCloudTiler.spatialReference,spatialBoundingVolume:this.createHeader(await this.tiler.getNodeMetadata(t.id)).boundingVolume}:null}close(){this.tiler.close(),this.isReady=!1}createHeader(t){let r=t.bounds[0].map((i,o)=>i+(t.bounds[1][o]-i)/2),n={cartographicBounds:t.bounds.map(i=>[...i]),center:r,radius:Math.hypot(...r.map((i,o)=>t.bounds[1][o]-i)),coordinateFrame:"cartesian"};return{id:t.id,level:t.level,pointCount:t.pointCount,geometricError:t.geometricError,boundingVolume:n,spatialBoundingVolume:n}}}});var SP={};Zr(SP,{PointCloudTileLoaderWithParser:()=>JD});var Pft,Rft,ZD,JD,vP=w(()=>{"use strict";xP();RM();({preload:Pft,createDataSourceSync:Rft,...ZD}=y0),JD={...ZD,createDataSourceSync(e,t={},r){if(typeof e=="string"||e instanceof Blob)throw new Error("PointCloudTileLoader requires decoded Mesh/Arrow input");return new g0(e,t,r)}}});async function tF(){let{PointCloudTileLoaderWithParser:e}=await Promise.resolve().then(()=>(vP(),SP));return e}var QD,y0,RM=w(()=>{"use strict";QD="5.0.0-beta.11";y0={dataType:null,batchType:null,name:"PointCloudTiler",id:"point-cloud-tiler",module:"tiles",version:QD,extensions:[],mimeTypes:[],type:"point-cloud",fromUrl:!1,fromBlob:!1,testURL:()=>!1,options:{pointCloudTiler:{}},defaultOptions:{pointCloudTiler:{}},preload:tF,createDataSourceSync(e,t={},r){throw new Error("PointCloudTileLoader requires preload() or @loaders.gl/tiles-3d/point-cloud-tile-loader")}}});var ef={};Zr(ef,{I3SSource:()=>Nm,I3SSpatialTransformer:()=>gl,IndexedArchiveTilesetSource:()=>kd,LOD_METRIC_TYPE:()=>$c,PointCloudTile:()=>yl,PointCloudTileLoader:()=>y0,PointCloudTileset:()=>Om,SpatialCoordinateTransformer:()=>$n,TILESET_TYPE:()=>nr,TILE_CONTENT_STATE:()=>ir,TILE_REFINEMENT:()=>ze,TILE_TYPE:()=>Oi,Tile3D:()=>bn,Tiles3DSource:()=>Am,Tiles3DSpatialTransformer:()=>hs,Tileset3D:()=>Ud,TilesetCache:()=>Hc,TilesetTraverser:()=>Li,applyTilesetSpatialOptions:()=>Ea,calculateTransformProps:()=>Cd,convertS2BoundingVolumeToOBB:()=>Tm,createBoundingVolume:()=>Xc,createImplicitSubtreeReference:()=>nw,createTilesetSpatialReference:()=>Mn,get3DTilesSpatialReference:()=>Yd,getFrameState:()=>Nd,getGeoidModel:()=>Sm,getI3SSpatialReference:()=>$d,getLodStatus:()=>Wd,getSpatialCoordinateFrame:()=>_n,getTileset3DTraversalSnapshot:()=>hv,isTileset3DSource:()=>Dd,markTilesetSpatialReferenceTransformed:()=>Kc,materializeImplicitSubtree:()=>Im,registerGeoidModel:()=>Xy,registerGeoidModelFromPgm:()=>MI,registerSpatialCrs:()=>wI,registerSpatialDatumGrid:()=>_I,replaceImplicitUrlTemplate:()=>ou,traverseTilesetContents:()=>uv});mf(ef,CP(DM(),1));Wn();qt();Dr();Ef();Wn();var Pd=class{item;previous;next;constructor(t,r,n){this.item=t,this.previous=r,this.next=n}};var Rd=class{head=null;tail=null;_length=0;get length(){return this._length}add(t){let r=new Pd(t,this.tail,null);return this.tail?(this.tail.next=r,this.tail=r):(this.head=r,this.tail=r),++this._length,r}remove(t){t&&(t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,--this._length)}splice(t,r){t!==r&&(this.remove(r),this._insert(t,r))}_insert(t,r){let n=t.next;t.next=r,this.tail===t?this.tail=r:n.previous=r,r.next=n,r.previous=t,++this._length}};var Hc=class{_list;_sentinel;_trimTiles;constructor(){this._list=new Rd,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(t){let r=t._cacheNode;r&&this._list.splice(this._sentinel,r)}add(t,r,n){r._cacheNode||(r._cacheNode=this._list.add(r),n&&n(t,r))}unloadTile(t,r,n){let i=r._cacheNode;i&&(this._list.remove(i),r._cacheNode=null,n&&n(t,r))}unloadTiles(t,r){let n=this._trimTiles;this._trimTiles=!1;let i=this._list,o=this._sentinel,s=i.head;for(;s!==o&&(t.gpuMemoryUsageInBytes>t.cacheBytes||n);){let a=s.item;s=s.next,this.unloadTile(t,a,r)}}trim(){this._trimTiles=!0}};Dr();Dr();qt();Wn();function Cd(e,t){ii(e),ii(t);let{rtcCenter:r,gltfUpAxis:n}=t,{computedTransform:i,boundingVolume:{center:o}}=e,s=new bt(i);switch(r&&s.translate(r),n){case"Z":break;case"Y":let f=new bt().rotateX(Math.PI/2);s=s.multiplyRight(f);break;case"X":let d=new bt().rotateY(-Math.PI/2);s=s.multiplyRight(d);break;default:break}t.isQuantized&&s.translate(t.quantizedVolumeOffset).scale(t.quantizedVolumeScale);let a=new I(o);t.cartesianModelMatrix=s,t.cartesianOrigin=a;let c=pt.WGS84.cartesianToCartographic(a,new I),h=ga(pt.WGS84,a).invert();t.cartographicModelMatrix=h.multiplyRight(s),t.cartographicOrigin=c;let u=Q8(t);u&&(t.cartesianModelMatrix=new bt(s).multiplyRight(u.matrix),t.cartographicModelMatrix.multiplyRight(u.matrix),u.matrix=bt.IDENTITY),t.coordinateSystem||(t.modelMatrix=t.cartographicModelMatrix)}var J8=1e6**2;function Q8(e){let t=e.gltf?.json;if(!t)return null;let r=typeof t.scene=="number"?t.scene:0,i=t.scenes?.[r]?.nodes?.[0],o=i===void 0?void 0:t.nodes?.[i];if(!o?.matrix)return null;let s=o.matrix;return s[12]*s[12]+s[13]*s[13]+s[14]*s[14]<=J8?null:o}qt();so();Dr();Dr();var BS=new I,S1=new I,tN=1e-5,eN=1e-7,v1=new sr([new Ge,new Ge,new Ge,new Ge,new Ge,new Ge]);function Nd(e,t,r={}){let{cameraUp:n,height:i}=e,o=e.cameraDirection,{metersPerUnit:s}=e.distanceScales,a=Fh(e,e.center),c=ga(pt.WGS84,a),l=e.unprojectPosition(e.cameraPosition),h=pt.WGS84.cartographicToCartesian(l,new I),u;if(o)u=new I(c.transformAsVector(new I(o).scale(s))).normalize();else{let p=e.getFrustumPlanes().near,g=E1(p,e.cameraPosition),y=Fh(e,g);u=new I(y).subtract(h).normalize()}let f=new I(c.transformAsVector(new I(n).scale(s))).normalize();iN(e);let d=rN(e),m=Number.isFinite(e.fovy)&&Number(e.fovy)>0&&Number(e.fovy)<180?Number(e.fovy)*Math.PI/180:Math.PI/3;return{camera:{position:h,direction:u,up:f,cartographicPosition:l,verticalFieldOfView:m,timeSinceMovement:r.timeSinceCameraMovement??Number.POSITIVE_INFINITY},viewport:e,topDownViewport:d,height:i,cullingVolume:v1,clippingPlanes:e.clippingPlanes,frameNumber:t,sseDenominator:2*Math.tan(m/2),dynamicScreenSpaceErrorDensity:0}}function OS(e,t,r,n){let i=Array.from(t),o=Array.from(r),s=e?i.length!==e.position.length||i.some((l,h)=>Math.abs(l-e.position[h])>tN):!1,a=e?o.length!==e.direction.length||o.some((l,h)=>Math.abs(l-e.direction[h])>eN):!1,c=s||a?n:e?.lastMovementTime??Number.NEGATIVE_INFINITY;return{state:{position:i,direction:o,lastMovementTime:c},timeSinceMovement:Math.max((n-c)/1e3,0)}}function LS(e,t,r){if(r===0||e.length<=r)return[e,[]];let n=[],[i,o]=nN(t.viewport);for(let[l,h]of e.entries()){let[u,f]=h.header.mbs,d=Math.abs(i-u),m=Math.abs(o-f),p=Math.sqrt(m*m+d*d);n.push([l,p])}let s=n.sort((l,h)=>l[1]-h[1]),a=[];for(let l=0;l<r;l++)a.push(e[s[l][0]]);let c=[];for(let l=r;l<s.length;l++)c.push(e[s[l][0]]);return[a,c]}function rN(e){if(e.getTopDownViewport)return e.getTopDownViewport();let t=e.constructor,{longitude:r,latitude:n,height:i,width:o,bearing:s,zoom:a,position:c}=e;return new t({longitude:r,latitude:n,height:i,width:o,bearing:s,zoom:a,position:c,pitch:0})}function nN(e){let{longitude:t,latitude:r}=e;if(Number.isFinite(t)&&Number.isFinite(r))return[t,r];let[n,i]=e.unprojectPosition(e.center);return[n,i]}function iN(e){let t=e.getFrustumPlanes(),r=E1(t.near,e.cameraPosition),n=Fh(e,r),i=Fh(e,e.cameraPosition,S1),o=0;v1.planes[o++].fromPointNormal(n,BS.copy(n).subtract(i));for(let s in t){if(s==="near")continue;let a=t[s],c=E1(a,r,S1),l=Fh(e,c,S1);v1.planes[o++].fromPointNormal(l,BS.copy(n).subtract(l))}}function E1(e,t,r=new I){let n=e.normal.dot(t);return r.copy(e.normal).scale(e.distance-n).add(t),r}function Fh(e,t,r=new I){let n=e.unprojectPosition(t);return pt.WGS84.cartographicToCartesian(n,r)}qt();var zS=new I,oN=new I,va=new I,DS=new I,Uh=new I,FS=new I,US=new I,GS=new I,Bd=new to,sN=new I(0,0,1);function VS(e,t){e._updateTransform(t)}function kS(e,t,r){if(!Number.isFinite(r.dynamicScreenSpaceErrorDensity)||r.dynamicScreenSpaceErrorDensity<=0)return 0;let n=hN(e),i=n.region?uN(n.region,t):fN(e,n,t);if(!i)return 0;let o=Mh(r.dynamicScreenSpaceErrorHeightFalloff,0,1),s=i.minimumHeight+(i.maximumHeight-i.minimumHeight)*o,a=i.maximumHeight-s,c=a>0?Mh((i.cameraHeight-s)/a,0,1):i.cameraHeight>=i.maximumHeight?1:0,h=(1-Mh(Math.abs(i.cameraDirection.dot(i.upDirection)),0,1))*(1-c);return r.dynamicScreenSpaceErrorDensity*h}function aN(e,t){let r=e*t;return 1-Math.exp(-(r*r))}function cN(e,t,r){return t<=0||r<=0||!Number.isFinite(t)||!Number.isFinite(r)?0:aN(e,t)*r}function qS(e,t,r,n=1){let i=e.tileset,o=e.parent&&e.parent.lodMetricValue||e.lodMetricValue,s=r?o:e.lodMetricValue;if(s===0)return 0;let{viewDistanceScale:a}=i.options,c=a||1,l=Number.isFinite(n)?Math.max(n,0):1,h=lN(s,t,c,l);if(h!==null)return h;let u=Math.max(e._distanceToCamera,1e-7),{height:f,sseDenominator:d}=t,m=s*f*l*c/(u*d);return i.options.dynamicScreenSpaceError&&!t.viewport.orthographic&&(m-=cN(u,t.dynamicScreenSpaceErrorDensity,i.options.dynamicScreenSpaceErrorFactor)),m}function lN(e,t,r,n){let i=t.viewport;if(!i?.orthographic)return null;let o=i.metersPerPixel;return!Number.isFinite(o)||!o||o<=0?null:e*r*n/o}function hN(e){return e.header.content?.boundingVolume||e.header.boundingVolume}function uN(e,t){let r=zS.copy(t.camera.position).normalize(),n=Uh.copy(t.camera.direction).normalize();return{cameraHeight:t.camera.cartographicPosition[2],minimumHeight:e[4],maximumHeight:e[5],cameraDirection:n,upDirection:r}}function fN(e,t,r){let n=dN(t,va);if(n===null)return null;let i=new bt(e.computedTransform).invert(),o=e.tileset.ellipsoid;if(Math.hypot(va[0],va[1],va[2])>o.minimumRadius){let a=o.cartesianToCartographic(va,oN),c=zS.copy(r.camera.position).normalize(),l=Uh.copy(r.camera.direction).normalize();return{cameraHeight:r.camera.cartographicPosition[2],minimumHeight:0,maximumHeight:a[2]*2,cameraDirection:l,upDirection:c}}return i.transformAsPoint(r.camera.position,DS),i.transformAsVector(r.camera.direction,Uh),Uh.normalize(),{cameraHeight:DS[2],minimumHeight:va[2]-n,maximumHeight:va[2]+n,cameraDirection:Uh,upDirection:sN}}function dN(e,t){if(e.box){let r=e.box;return t.set(r[0],r[1],r[2]),mN(r)}if(e.sphere){let r=e.sphere;return t.set(r[0],r[1],r[2]),r[3]}return null}function mN(e){return e.length===10?(Bd.fromArray(e,6),FS.set(e[3],0,0).transformByQuaternion(Bd),US.set(0,e[4],0).transformByQuaternion(Bd),GS.set(0,0,e[5]).transformByQuaternion(Bd),Math.abs(FS[2])+Math.abs(US[2])+Math.abs(GS[2])):Math.abs(e[5])+Math.abs(e[8])+Math.abs(e[11])}qt();so();var ir={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},ze;(function(e){e[e.ADD=1]="ADD",e[e.REPLACE=2]="REPLACE"})(ze||(ze={}));var Oi;(function(e){e.EMPTY="empty",e.SCENEGRAPH="scenegraph",e.POINTCLOUD="pointcloud",e.MESH="mesh"})(Oi||(Oi={}));var nr;(function(e){e.I3S="I3S",e.TILES3D="TILES3D"})(nr||(nr={}));var $c;(function(e){e.GEOMETRIC_ERROR="geometricError",e.MAX_SCREEN_THRESHOLD="maxScreenThreshold"})($c||($c={}));var jS={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0};var WS=1e4,pN=1e4,gN=1e8,yN=new en,HS=new I,$S=new I,T1=new I,Od=new I;function I1(e,t,r){return e+(t-e)*r}function YS(e,t){let r=e instanceof en?e:e.getBoundingSphere(yN),{center:n,radius:i}=r;HS.copy(n).subtract(t.position);let o=Math.max(HS.dot(t.direction),0);return $S.copy(t.direction).scale(o).add(t.position),T1.copy($S).subtract(n),T1.magnitude()<=i||(Od.copy(T1).normalize().scale(i).add(n).subtract(t.position),Od.magnitude()===0)?0:(Od.normalize(),Math.min(Math.max(1-Od.dot(t.direction),0),1))}function KS(e,t,r,n){return!Number.isFinite(n)||n<=0||n>.5?!1:e>r?!0:t!==void 0&&t>r}function XS(e){let t=Number.isFinite(e.foveatedConeSize)?Math.min(Math.max(e.foveatedConeSize,0),1):1,r=e.refinement===ze.REPLACE;if(r&&!e.skipLevelOfDetail||!e.foveatedScreenSpaceError||t>=1||r&&e.skipLevelOfDetail&&e.priorityProgressiveResolution)return!1;let n=Number.isFinite(e.verticalFieldOfView)&&e.verticalFieldOfView>0?e.verticalFieldOfView:Math.PI/3,i=1-Math.cos(n*.5),o=t*i;if(e.foveatedFactor<=o||i<=o)return!1;let s=Math.min(Math.max((e.foveatedFactor-o)/(i-o),0),1),c=(typeof e.interpolationCallback=="function"?e.interpolationCallback:I1)(e.minimumScreenSpaceErrorRelaxation,e.maximumScreenSpaceError,s),l=Number.isFinite(c)?Math.min(Math.max(c,0),e.maximumScreenSpaceError):0,h=e.screenSpaceError===0&&e.parentScreenSpaceError!==void 0?e.parentScreenSpaceError*.5:e.screenSpaceError;return e.maximumScreenSpaceError-l<=h}function ZS(e,t,r){return e&&Number.isFinite(t)&&Number.isFinite(r)&&r>0&&t<r}function JS(e){let t=e.rootScreenSpaceError>0?Math.min(Math.max(e.reverseScreenSpaceError/e.rootScreenSpaceError,0),1):0,r=Math.floor(t*(WS-1)),n=Number.isFinite(e.foveatedFactor)?Math.min(Math.max(e.foveatedFactor,0),1):0,i=Math.floor(n*(WS-1))*pN;return(e.priorityProgressiveResolution?0:gN)+i+r}lg();lg();var Yc="EPSG:4326",Ld="EPSG:4978";function Gh(e){let t=e.trim().toUpperCase(),r=t.match(/(?:\/DEF\/CRS\/|URN:OGC:DEF:CRS:)([A-Z0-9_-]+)(?:\/|::)(?:[^/:]*[/:])?([A-Z0-9_.-]+)$/);return r?`${r[1]}:${r[2]}`:t}function _n(e){if(typeof e=="string"){let r=tr(e);return r==="wkt"?wN(e):r==="proj-string"?_N(e):A1(e)||"projected"}let t=e;return t.type==="BoundCRS"&&t.source_crs?_n(t.source_crs):t.type==="CompoundCRS"&&t.components?.[0]?_n(t.components[0]):String(t.type).includes("Projected")?"projected":String(t.type).includes("Geographic")?"geographic":String(t.type).includes("Geodetic")?t.coordinate_system?.subtype==="Cartesian"?"geocentric":"geographic":"unknown"}function A1(e){if(typeof e!="string")return;let t=Gh(e);if(t===Ld)return"geocentric";if(t===Yc||t==="OGC:CRS84")return"geographic";let r=/^EPSG:(\d+)$/.exec(t);if(!r)return;let n=Number(r[1]);if(n===7789)return"geocentric";if(n===4490||n===4979)return"geographic";if(n===3857||n>=32601&&n<=32660||n>=32701&&n<=32760)return"projected"}function wN(e){let t;try{t=gh(e).root}catch{return"unknown"}switch(t.keyword.toUpperCase()){case"GEOCCS":return"geocentric";case"GEOGCS":case"GEOGCRS":case"GEOGRAPHICCRS":case"GEOGRAPHIC2DCRS":case"GEOGRAPHIC3DCRS":return"geographic";case"PROJCS":case"PROJCRS":case"PROJECTEDCRS":return"projected";case"GEODCRS":case"GEODETICCRS":{let n=t.values.find(i=>i.type==="node"&&i.keyword.toUpperCase()==="CS")?.values[0];return n?.type!=="enumeration"&&n?.type!=="string"?"unknown":n.value.toUpperCase()==="CARTESIAN"?"geocentric":n.value.toUpperCase()==="ELLIPSOIDAL"?"geographic":"unknown"}default:return"unknown"}}function _N(e){try{let t=yh(e).parameters.find(r=>r.name.toLowerCase()==="proj")?.value;switch(t?.toLowerCase()){case"longlat":case"latlong":return"geographic";case"geocent":return"geocentric";default:return t?"projected":"unknown"}}catch{return"unknown"}}function Mn(e,t={}){let r=t.sourceCrs!==void 0,n=t.sourceCrs||e.sourceCrs,i=t.outputCoordinates||"auto",o=t.targetCrs||(i==="ecef"?"EPSG:4978":void 0),s=t.targetHeightReference||"native",a=e.verticalUnitScale??1,c=e.elevationUnitScale??1,l=e.elevationOffset||0,h=e.elevationMode==="onTheGround"||e.elevationMode==="relativeToGround"||e.elevationMode==="relativeToScene",u=e.elevationMode==="relativeToScene"?!!t.sceneElevationProvider:!h||!!t.terrainElevationProvider,f=a!==1||c!==1||e.elevationMode!==void 0&&(h||e.elevationMode==="absoluteHeight"&&l!==0),d=s!=="native"&&s!==e.heightReference,m=!!o||s!=="native"||i!=="auto"||f,p=i!=="target-crs"||!!o,g=!d||(e.heightReference||"unknown")!=="unknown",y=Number.isFinite(a)&&a>0&&Number.isFinite(c)&&c>0,_=!!n&&m&&p&&g&&y&&u&&i!=="local-enu",M=r?"caller-override":e.provenance||"unknown",x=r&&n?_n(n):e.coordinateFrame,v=r?"explicit":e.sourceCrsState||(n?M==="format-default"?"default":"explicit":"absent"),T=Of({crs:n?{state:v==="default"?"default":"explicit",definition:n,representation:!r&&e.sourceCrsRepresentation||tr(n),provenance:M,alternatives:r?void 0:e.sourceCrsAlternatives}:{state:v==="unknown"?"unknown":"absent",provenance:M},vertical:e.verticalCrs?{state:"explicit",definition:e.verticalCrs,representation:tr(e.verticalCrs),provenance:e.provenance||"metadata"}:void 0,coordinateEpoch:t.coordinateEpoch??e.coordinateEpoch,coordinateFrame:x,coordinateOrder:bN(e.axisOrder),units:r?void 0:e.units}),S=P1(T.crs),E=T.vertical?P1(T.vertical):void 0,N=o?MN(o):void 0;return Object.freeze({...T,sourceCrs:S,verticalCrs:E,verticalUnitScale:a,coordinateEpoch:t.coordinateEpoch??e.coordinateEpoch,heightReference:e.heightReference||"unknown",elevationMode:e.elevationMode,elevationOffset:e.elevationOffset,elevationUnit:e.elevationUnit,elevationUnitScale:c,coordinateFrame:x||"unknown",axisOrder:e.axisOrder||"unknown",provenance:M,targetCrs:N,targetHeightReference:s,outputCoordinates:i,status:m?_?"transformable":"unresolved":"native",warnings:Object.freeze([...e.warnings||[]])})}function Ea(e,t={}){return Mn({sourceCrs:e?.sourceCrs,sourceCrsState:e?.crs.state,sourceCrsRepresentation:e?.crs.state==="explicit"||e?.crs.state==="default"?e.crs.representation:void 0,sourceCrsAlternatives:e?.crs.state==="explicit"||e?.crs.state==="default"?e.crs.alternatives:void 0,verticalCrs:e?.verticalCrs,units:e?.units,verticalUnitScale:e?.verticalUnitScale,coordinateEpoch:e?.coordinateEpoch,heightReference:e?.heightReference,elevationMode:e?.elevationMode,elevationOffset:e?.elevationOffset,elevationUnit:e?.elevationUnit,elevationUnitScale:e?.elevationUnitScale,coordinateFrame:e?.coordinateFrame,axisOrder:e?.axisOrder,provenance:e?.provenance,warnings:e?.warnings},t)}function P1(e){return e.state==="explicit"||e.state==="default"?e.definition:void 0}function MN(e){let t=Of({crs:{state:"explicit",definition:e,representation:tr(e),provenance:"caller-override"}}),r=P1(t.crs);if(!r)throw new Error("Failed to normalize a known target CRS definition");return r}function bN(e){switch(e){case"xy":return["x","y"];case"yx":return["y","x"];case"xyz":return["x","y","z"];default:return[]}}function Kc(e){if(e.status!=="transformable"&&e.status!=="transformed")throw new Error("Only a transformable spatial reference can be marked as transformed");return Object.freeze({...e,status:"transformed"})}function Dd(e){return!!(e&&typeof e=="object"&&"initialize"in e&&"getRootTileset"in e&&"initializeTileHeaders"in e&&"loadTileContent"in e)}var Gd=1024*1024,cv=512*Gd,lv=512*Gd,xN=32*Gd,SN=Gd;function Fd(e,t){if(!Number.isFinite(e)||e<0)throw new Error(`${t} must be a finite number greater than or equal to 0`);return e}function QS(e,t){let r=e.cacheBytes??t;return Fd(r,"cacheBytes")}function tv(e,t){let r=e.maximumCacheOverflowBytes??t;return Fd(r,"maximumCacheOverflowBytes")}var R1={description:"",ellipsoid:pt.WGS84,modelMatrix:new bt,throttleRequests:!0,maxRequests:64,cacheBytes:cv,maximumCacheOverflowBytes:lv,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onSourceError:()=>{},onTilesetError:()=>{},onTraversalComplete:e=>e,onUpdate:()=>{},contentLoader:void 0,viewDistanceScale:1,progressiveResolutionHeightFraction:.3,foveatedScreenSpaceError:!0,foveatedConeSize:.1,foveatedMinimumScreenSpaceErrorRelaxation:0,foveatedInterpolationCallback:I1,foveatedTimeDelay:.2,maximumScreenSpaceError:8,skipLevelOfDetail:!1,baseScreenSpaceError:1024,skipScreenSpaceErrorFactor:16,skipLevels:1,immediatelyLoadDesiredLevelOfDetail:!1,dynamicScreenSpaceError:!0,dynamicScreenSpaceErrorDensity:2e-4,dynamicScreenSpaceErrorFactor:24,dynamicScreenSpaceErrorHeightFalloff:.25,memoryAdjustedScreenSpaceError:!0,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{core:{fetch:{}}},attributions:[],basePath:"",i3s:{},spatial:{}},C1="Tiles In Tileset(s)",N1="Tiles In Memory",ev="Tiles In View",rv="Tiles To Render",nv="Tiles Loaded",B1="Tiles Loading",iv="Tiles Unloaded",ov="Failed Tile Loads",sv="Points/Vertices",O1="Tile Memory Use",av="Maximum Screen Space Error",Ud=class{options;loadOptions;source;type;tileset;loader;url;basePath;modelMatrix;ellipsoid;lodMetricType;lodMetricValue;refine;root=null;roots={};asset={};schema=null;schemaUri=null;groups=[];metadata=null;statistics=null;spatialReference=Mn({});description="";properties;extras=null;attributions={};credits={};stats;contentFormats;cartographicCenter=null;cartesianCenter=null;zoom=1;boundingVolume=null;dynamicScreenSpaceErrorComputedDensity=0;gpuMemoryUsageInBytes=0;memoryAdjustedScreenSpaceError=0;_cacheBytes=cv;_maximumCacheOverflowBytes=lv;_frameNumber=0;_tiles={};_pendingCount=0;selectedTiles=[];traverseCounter=0;geometricError=0;lastUpdatedVieports=null;_requestedTiles=[];_emptyTiles=[];frameStateData={};_cameraMotionStates={};_deferredTraversalTimeout=null;_traverser;_cache=new Hc;_requestScheduler;_heldTiles=new Set;updatePromise=null;tilesetInitializationPromise;constructor(t,r){if(!Dd(t))throw new Error("Tileset3D requires a Tileset3DSource instance");let n=r||{},i=t.type===nr.TILES3D,o=i?R1.cacheBytes:xN,s=i?R1.maximumCacheOverflowBytes:SN,a=QS(n,o),c=tv(n,s);this.options={...R1,...n,cacheBytes:a,maximumCacheOverflowBytes:c,skipLevelOfDetail:n.skipLevelOfDetail??t.type===nr.TILES3D,memoryAdjustedScreenSpaceError:n.memoryAdjustedScreenSpaceError??i},this.loadOptions=this.options.loadOptions||{},this.source=t,this.tileset=null,this.loader=this.source.loader,this.type=this.source.type,this.url=this.source.url,this.basePath=this.source.basePath,this.modelMatrix=this.options.modelMatrix,this.ellipsoid=this.options.ellipsoid,this.lodMetricType="",this.lodMetricValue=0,this.refine="",this.contentFormats=this.source.contentFormats,this._traverser=this._initializeTraverser(),this._requestScheduler=new Tc({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this.memoryAdjustedScreenSpaceError=this.options.maximumScreenSpaceError,this._cacheBytes=a,this._maximumCacheOverflowBytes=c;let l=this._getSourceMetadata();l&&(this.spatialReference=Ea(l.spatialReference,this.options.spatial)),this.stats=new Pi({id:this.url}),this._initializeStats(),this.tilesetInitializationPromise=this._initializeTileSet()}destroy(){this._clearDeferredTraversal(),this.source.destroy?.(),this._destroy()}isLoaded(){return this._pendingCount===0&&this._frameNumber!==0&&this._requestedTiles.length===0}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get requestedTiles(){return this._requestedTiles.slice()}get emptyTiles(){return this._emptyTiles.slice()}get cacheBytes(){return this._cacheBytes}set cacheBytes(t){this._cacheBytes=Fd(t,"cacheBytes"),this.options.cacheBytes=this._cacheBytes}get maximumCacheOverflowBytes(){return this._maximumCacheOverflowBytes}set maximumCacheOverflowBytes(t){this._maximumCacheOverflowBytes=Fd(t,"maximumCacheOverflowBytes"),this.options.maximumCacheOverflowBytes=this._maximumCacheOverflowBytes}get queryParams(){let t=this.source.getTileUrl(this.url),r=t.indexOf("?");return r>=0?t.slice(r+1):""}setProps(t){let r=QS(t,this.cacheBytes),n=tv(t,this.maximumCacheOverflowBytes);this.options={...this.options,...t,cacheBytes:r,maximumCacheOverflowBytes:n},this._cacheBytes=r,this._maximumCacheOverflowBytes=n}getTileUrl(t){return this.source.getTileUrl(t)}hasExtension(t){return!!this.source.hasExtension?.(t)}update(t=null){this.tilesetInitializationPromise.then(()=>{!t&&this.lastUpdatedVieports?t=this.lastUpdatedVieports:this.lastUpdatedVieports=t,t&&this.doUpdate(t)})}async selectTiles(t=null){return await this.tilesetInitializationPromise,t&&(this.lastUpdatedVieports=t),this.updatePromise||(this.updatePromise=new Promise(r=>{setTimeout(()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),r(this._frameNumber),this.updatePromise=null},this.options.debounceTime)})),this.updatePromise}adjustScreenSpaceError(){this.gpuMemoryUsageInBytes<this.cacheBytes?this.memoryAdjustedScreenSpaceError=Math.max(this.memoryAdjustedScreenSpaceError/1.02,this.options.maximumScreenSpaceError):this.gpuMemoryUsageInBytes>this.cacheBytes+this.maximumCacheOverflowBytes&&(this.memoryAdjustedScreenSpaceError*=1.02)}doUpdate(t){if("loadTiles"in this.options&&!this.options.loadTiles||this.traverseCounter>0)return;let r=t instanceof Array?t:[t],n=new Set(r.map(a=>a.id));for(let a of Object.keys(this.frameStateData))n.has(a)||delete this.frameStateData[a];this._cache.reset(),this._frameNumber++,this.traverseCounter=r.length;let i=Date.now(),o=Number.POSITIVE_INFINITY,s=[];for(let a of r){let c=a.id;this._needTraverse(c)?s.push(c):this.traverseCounter--}for(let a of r){let c=a.id;if(this.roots[c]||(this.roots[c]=this._initializeTileHeaders(this.tileset,null)),!s.includes(c))continue;let l=Nd(a,this._frameNumber),h=this.roots[c],u=OS(this._cameraMotionStates[c],l.camera.position,l.camera.direction,i);this._cameraMotionStates[c]=u.state,l.camera.timeSinceMovement=u.timeSinceMovement,VS(h,this.modelMatrix),l.dynamicScreenSpaceErrorDensity=this.type===nr.TILES3D&&this.options.dynamicScreenSpaceError&&!l.viewport.orthographic?kS(h,l,this.options):0,this.dynamicScreenSpaceErrorComputedDensity=l.dynamicScreenSpaceErrorDensity,this._traverser.traverse(h,l,this.options),Object.keys(this._traverser.deferredTiles).length>0&&(o=Math.min(o,Math.max(this.options.foveatedTimeDelay-u.timeSinceMovement,0)))}Number.isFinite(o)?this._scheduleDeferredTraversal(o):this._clearDeferredTraversal()}_scheduleDeferredTraversal(t){this._clearDeferredTraversal(),this._deferredTraversalTimeout=setTimeout(()=>{this._deferredTraversalTimeout=null,this.selectTiles().catch(r=>{let n=r instanceof Error?r:new Error(String(r));this._onTilesetError(n)})},Math.max(t*1e3,0))}_clearDeferredTraversal(){this._deferredTraversalTimeout!==null&&(clearTimeout(this._deferredTraversalTimeout),this._deferredTraversalTimeout=null)}_needTraverse(t){let r=t;return this.options.viewportTraversersMap&&(r=this.options.viewportTraversersMap[t]),r===t}_onTraversalEnd(t){let r=t.viewport.id;this.frameStateData[r]||(this.frameStateData[r]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});let n=this.frameStateData[r],i=Object.values(this._traverser.selectedTiles),[o,s]=LS(i,t,this.options.maximumTilesSelected);n.selectedTiles=o;for(let a of s)a.unselect();n._requestedTiles=Object.values(this._traverser.requestedTiles),n._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,!(this.traverseCounter>0)&&this._updateTiles()}_updateTiles(){let t=this.selectedTiles;this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(let o in this.frameStateData){let s=this.frameStateData[o];this.selectedTiles=this.selectedTiles.concat(s.selectedTiles),this._requestedTiles=this._requestedTiles.concat(s._requestedTiles),this._emptyTiles=this._emptyTiles.concat(s._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);let r=new Set(this.selectedTiles),n=this.selectedTiles.some(o=>!o.tileDrawn),i=0;if(n){let o=new Set(Object.keys(this.frameStateData).map(a=>this.roots[a])),s=new Map;for(let a of this.selectedTiles)for(let c=a.parent;c;c=c.parent)s.set(c,(s.get(c)??!0)&&a.tileDrawn);for(let a of t)a.tileDrawn&&this._heldTiles.add(a);for(let a of this._heldTiles){let c=a;for(;c.parent;)c=c.parent;if(!o.has(c)){this._heldTiles.delete(a);continue}r.has(a)||(a.contentAvailable&&!this._hasDrawnReplacement(a,r,s)?(a._selectedFrame=this._frameNumber,this.selectedTiles.push(a),i++):this._heldTiles.delete(a))}}else this._heldTiles=r;i>0&&setTimeout(()=>{this.selectTiles()},0);for(let o of this.selectedTiles)this._tiles[o.id]=o;this._loadTiles(),this._unloadTiles(),this._updateStats(),this._tilesChanged(t,this.selectedTiles)&&this.options.onUpdate()}_hasDrawnReplacement(t,r,n){for(let i=t.parent;i;i=i.parent)if(r.has(i))return i.tileDrawn;return n.get(t)===!0}_tilesChanged(t,r){if(t.length!==r.length)return!0;let n=new Set(t.map(s=>s.id)),i=new Set(r.map(s=>s.id)),o=t.some(s=>!i.has(s.id));return o=o||r.some(s=>!n.has(s.id)),o}_loadTiles(){this._requestedTiles.sort((t,r)=>t._priority-r._priority);for(let t of this._requestedTiles)t.contentUnloaded&&this._loadTile(t)}_unloadTiles(){this._cache.unloadTiles(this,(t,r)=>t._unloadTile(r)),this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_updateStats(){let t=0,r=0;for(let n of this.selectedTiles)if(n.contentAvailable&&n.content){t++;let i=n.contents.length?n.contents:[n.content];for(let o of i)o.pointCount?r+=o.pointCount:r+=o.vertexCount||0}this.stats.get(ev).count=this.selectedTiles.length,this.stats.get(rv).count=t,this.stats.get(sv).count=r,this.stats.get(av).count=this.memoryAdjustedScreenSpaceError}async _initializeTileSet(){try{let t=this.source.initialize(),r=this._getSourceMetadata();r&&this._syncSourceState(r),r?.tileset?.root&&typeof r.tileset.root.then!="function"&&(!this.source.prepareTileset||this.spatialReference?.status==="native")&&(this.root=this._initializeTileHeaders(r.tileset,null),this._applyViewState()),await t;let n=this.source.getMetadata();this._syncSourceState(n),await this.source.prepareTileset?.(this),this.root||(this.root=this._initializeTileHeaders(n.tileset,null)),this._applyViewState()}catch(t){let r=t instanceof Error?t:new Error(String(t));throw this._onSourceError(r,this.root),this._onTilesetError(r),r}}_initializeStats(){this.stats.get(C1),this.stats.get(B1),this.stats.get(N1),this.stats.get(ev),this.stats.get(rv),this.stats.get(nv),this.stats.get(iv),this.stats.get(ov),this.stats.get(sv),this.stats.get(O1,"memory"),this.stats.get(av)}_initializeTileHeaders(t,r){return this.source.initializeTileHeaders(this,t,r)}_initializeTraverser(){return this.source.createTraverser({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(t){this._destroySubtree(t)}async _loadTile(t){let r=null;try{this._onStartTileLoading(),r=await t.loadContent()}catch(n){let i=n instanceof Error?n:new Error("load failed");this._onSourceError(i,t),this._onTileLoadError(t,i)}finally{this._onEndTileLoading(),this._onTileLoad(t,r)}}async _loadTileChildren(t,r){try{this._onStartTileLoading(),await t.loadChildren(r)}catch(n){let i=n instanceof Error?n:new Error("subtree load failed");this._onSourceError(i,t),this._onTileLoadError(t,i)}finally{this._onEndTileLoading()}}_onTileLoadError(t,r){this.stats.get(ov).incrementCount();let n=r.message||r.toString(),i=t.url;Ji.error(`A 3D tile failed to load: ${t.url} ${n}`)(),this.options.onTileError(t,n,i)}_onSourceError(t,r=null){this.options.onSourceError(t,this.source,r)}_onTilesetError(t){this.options.onTilesetError(t,this)}_onTileLoad(t,r){if(!r?.loaded)return;t.content&&Cd(t,t.content),this.source.onTileLoaded?.(this,t,r),this._syncSourceState(this.source.getMetadata());let n=this.source.getTilesTotalCount?.();n&&(this.stats.get(C1).reset(),this.stats.get(C1).addCount(n)),this._addTileToCache(t),this.options.onTileLoad(t)}_onStartTileLoading(){this._pendingCount++,this.stats.get(B1).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(B1).decrementCount()}_addTileToCache(t){this._cache.add(this,t,r=>r._updateCacheStats(t))}_updateCacheStats(t){this.stats.get(nv).incrementCount(),this.stats.get(N1).incrementCount(),this.gpuMemoryUsageInBytes+=t.gpuMemoryUsageInBytes||0,this.stats.get(O1).count=this.gpuMemoryUsageInBytes,this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.gpuMemoryUsageInBytes||0,this.stats.get(N1).decrementCount(),this.stats.get(iv).incrementCount(),this.stats.get(O1).count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(t),t.unloadContent()}_destroy(){let t=[];for(this.root&&t.push(this.root);t.length>0;){let r=t.pop();for(let n of r.children)t.push(n);this._destroyTile(r)}this.root=null}_destroySubtree(t){let r=t,n=[r];for(;n.length>0;){t=n.pop();for(let i of t.children)n.push(i);t!==r&&this._destroyTile(t)}r.children=[]}_destroyTile(t){this._cache.unloadTile(this,t),this._unloadTile(t),t.destroy()}_syncSourceState(t){this.tileset=t.tileset,this.loader=t.loader,this.type=t.type,this.url=t.url,this.basePath=t.basePath,this.lodMetricType=t.lodMetricType,this.lodMetricValue=t.lodMetricValue,this.refine=t.refine,this.contentFormats=this.source.contentFormats,this.asset=this.source.asset||this.asset;let r=t.tileset;this.schema=r.schema||null,this.schemaUri=r.schemaUri||null,this.groups=r.groups||[],this.metadata=r.metadata||null,this.statistics=r.statistics??null;let n=Ea(t.spatialReference,this.options.spatial);this.spatialReference=vN(this.spatialReference,n),this.properties=this.source.properties??this.properties,this.extras=this.source.extras??this.extras,this.options.attributions?.length?this.credits={attributions:this.options.attributions}:this.credits=this.source.credits||this.credits}_applyViewState(){let t=this.source.getViewState(this.root);this.asset=t.asset||this.source.asset||{},this.properties=t.properties??this.source.properties,this.extras=t.extras??this.source.extras??null,this.credits=t.credits||this.source.credits||this.credits||{attributions:this.options.attributions||[]},this.description=t.description||this.options.description||"",this.boundingVolume=t.boundingVolume||this.root?.boundingVolume||null,this.cartographicCenter=t.cartographicCenter||new I,this.cartesianCenter=t.cartesianCenter||null,this.zoom=t.zoom||1,this.geometricError=this.tileset?.geometricError||0}_getSourceMetadata(){try{return this.source.getMetadata()}catch{return null}}};function vN(e,t){return e?.status==="transformed"&&e.sourceCrs===t.sourceCrs&&e.targetCrs===t.targetCrs&&e.targetHeightReference===t.targetHeightReference&&e.outputCoordinates===t.outputCoordinates?e:t}function hv(e){let t=e.selectedTiles.slice(),r=e.requestedTiles.slice(),n=e.emptyTiles.slice(),i=c=>c.map(l=>String(l.id)).sort(),o=c=>{let l=e.stats.get(c).count;return typeof l=="number"&&Number.isFinite(l)?l:0},a=e.source.getImplicitTilingStats?.();return{frameNumber:e.frameNumber,selectedTileIds:i(t),requestedTileIds:i(r),emptyTileIds:i(n),visibleTileCount:t.length,renderableTileCount:t.filter(c=>c.contentAvailable&&!!c.content).length,loadingTileCount:o("Tiles Loading"),loadedTileCount:o("Tiles Loaded"),failedTileCount:o("Failed Tile Loads"),cachedTileCount:o("Tiles In Memory"),cacheBytes:e.gpuMemoryUsageInBytes,maximumScreenSpaceError:e.memoryAdjustedScreenSpaceError,...a?{implicitTiling:a}:{}}}async function*uv(e,t={}){if(await e.tilesetInitializationPromise,zd(t.signal),!e.root)throw new Error("Tileset initialization completed without a root tile");let r=[e.root],n=new Set;for(;r.length>0;){zd(t.signal);let i=r.pop();if(n.has(i))continue;if(n.add(i),i.header.implicitSubtree&&i.childrenState!=="ready"){let s=e.source.loadTileChildrenForTraversal;if(!s)throw new Error("Tileset source does not support camera-independent subtree loading");if(!(await s.call(e.source,i,t.signal)).loaded)throw new Error(`Unable to load implicit subtree for tile ${i.id}`);i.childrenState="ready"}if(e.type===nr.I3S&&e.source.loadTileChildrenForTraversal&&!(await e.source.loadTileChildrenForTraversal(i,t.signal)).loaded)throw new Error(`Unable to load I3S child nodes for tile ${i.id}`);zd(t.signal);let o=i.contentUrls.length>0&&!i.content;try{if(o){let s=await i.loadContentForTraversal();if(zd(t.signal),!s.loaded)throw new Error(`Unable to load tile content for tile ${i.id}`);e.source.onTileLoaded?.(e,i,s)}yield{tile:i,contents:i.contentEntries}}finally{t.unloadContent&&o&&i.unloadContent()}for(let s=i.children.length-1;s>=0;s--)r.push(i.children[s])}}function zd(e){if(e?.aborted)throw e.reason??new DOMException("The operation was aborted","AbortError")}Wn();var kd=class{sourceUrl;options;archivePromise;constructor(t){this.options=t,this.sourceUrl=EN(t.data,t.fallbackFilename)}async loadRoot(t,r,n){let i=this.options.rootPath?`${Vd(this.sourceUrl)}/${this.options.rootPath}`:t;return await this.parseArchiveResource(i,this.options.rootPath,r,n,this.options.rootMode)}async loadResource(t,r,n){let i=this.resolveArchivePath(t,t);return await this.parseArchiveResource(t,i,r,n)}async parseArchiveResource(t,r,n,i,o){let s=this.options.getCoreApi();if(!s)throw new Error(this.options.missingCoreApiMessage);let a=await this.loadFile(r,o),c=this.createArchiveFetch(t);return await s.parse(a,n,{...i,fetch:c},{url:t,fetch:c,_parse:s.parse,loaders:[n],coreApi:s})}createArchiveFetch(t){return async r=>{let n=typeof r=="string"?r:r instanceof URL?r.toString():r.url,i=this.resolveArchivePath(n,t),o=await this.loadFile(i);return new Response(o,{status:200})}}async loadFile(t,r){this.archivePromise||=this.openArchiveReadableFile().then(i=>this.options.parseArchive(i));let n=await this.archivePromise;return await this.options.getFile(n,t,r)}async openArchiveReadableFile(){let{data:t}=this.options;if(typeof t!="string")return new Ic(t);if(/^https?:\/\//i.test(t))return new dh(t);let r=this.options.getCoreApi();if(!r)throw new Error(this.options.missingCoreApiMessage);let n=await r.fetchFile(t);return new Ic(await n.arrayBuffer())}resolveArchivePath(t,r){let n=Vd(t),i=Vd(this.sourceUrl),o=Vd(r),s=o===i?i:gn.dirname(o),a=new RegExp(`\\.${this.options.archiveExtension}/(.*)$`,"i"),c=n.match(a);if(c?.[1])return c[1];let l=/^[a-z][a-z0-9+.-]*:/i.test(n)||n.startsWith("/"),h=n.startsWith(i)?n:o===i&&!l?`${i}/${n}`:/^[a-z][a-z0-9+.-]*:\/\//i.test(o)?new URL(n,o).href:gn.resolve(s,n);return h===i?"":h.startsWith(`${i}/`)?h.slice(i.length+1):h.replace(/^\/+/,"")}};function EN(e,t){return typeof e=="string"?e:`memory://${"name"in e&&typeof e.name=="string"&&e.name?e.name:t}`}function Vd(e){return e.split(/[?#]/,1)[0]}Wn();qt();so();function qd(e){let t=[],r=new Set,n=i=>{if(!i||typeof i!="object"||r.has(i))return;r.add(i);let o=i,s=o.extensions?.EXT_mesh_features?.featureIds;if(Array.isArray(s))for(let a of s){if(!a||typeof a!="object")continue;let c=a.texture?"texture":a.implicit?"implicit":a.attribute!==void 0?"attribute":a.propertyTable!==void 0?"property-table":"constant";t.push({source:c,attribute:a.attribute,propertyTable:a.propertyTable,constant:a.constant,texture:a.texture,implicit:a.implicit,values:a.values,details:a})}for(let a of Object.values(o))n(a)};return n(e),t}qt();so();Dr();Wn();function mv(e){return e!=null}var wr=new I,jd=new I,fv=new bt;function Xc(e,t,r,n=t){if(ii(e,"3D Tile: boundingVolume must be defined"),e.box){let i=e.s2VolumeInfo?fv:t;return dv(e.box,i,r)}if(e.region){let i=Ph(e.region),o=t.equals(n)?fv:t.clone().multiplyRight(n.clone().invert());return dv([...i.center,...i.halfAxes],o,r)}if(e.sphere)return TN(e.sphere,t,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function pv(e,t,r=!1){if(e.box||e.region&&r)return IN(t);if(e.region){let[n,i,o,s,a,c]=e.region;return[[Or(n),Or(i),a],[Or(o),Or(s),c]]}if(e.sphere)return AN(t);throw new Error("Unkown boundingVolume type")}function dv(e,t,r){let n=new I(e[0],e[1],e[2]);t.transform(n,n);let i=[];if(e.length===10){let l=e.slice(3,6),h=new to;h.fromArray(e,6);let u=new I([1,0,0]),f=new I([0,1,0]),d=new I([0,0,1]);u.transformByQuaternion(h),u.scale(l[0]),f.transformByQuaternion(h),f.scale(l[1]),d.transformByQuaternion(h),d.scale(l[2]),i=[...u.toArray(),...f.toArray(),...d.toArray()]}else i=[...e.slice(3,6),...e.slice(6,9),...e.slice(9,12)];let o=t.transformAsVector(i.slice(0,3)),s=t.transformAsVector(i.slice(3,6)),a=t.transformAsVector(i.slice(6,9)),c=new Qr([o[0],o[1],o[2],s[0],s[1],s[2],a[0],a[1],a[2]]);return mv(r)?(r.center=n,r.halfAxes=c,r):new oo(n,c)}function TN(e,t,r){let n=new I(e[0],e[1],e[2]);t.transform(n,n);let i=t.getScale(jd),o=Math.max(Math.max(i[0],i[1]),i[2]),s=e[3]*o;return mv(r)?(r.center=n,r.radius=s,r):new en(n,s)}function IN(e){let t=gv(),{halfAxes:r}=e,n=new I(r.getColumn(0)),i=new I(r.getColumn(1)),o=new I(r.getColumn(2));for(let s=0;s<2;s++){for(let a=0;a<2;a++){for(let c=0;c<2;c++)wr.copy(e.center),wr.add(n),wr.add(i),wr.add(o),yv(t,wr),o.negate();i.negate()}n.negate()}return t}function AN(e){let t=gv(),{center:r,radius:n}=e,i=pt.WGS84.scaleToGeodeticSurface(r,wr),o;i?o=pt.WGS84.geodeticSurfaceNormal(i):o=new I(0,0,1);let s=new I(o[2],-o[1],0);s.len()>0?s.normalize():s=new I(0,1,0);let a=s.clone().cross(o);for(let c of[s,a,o]){jd.copy(c).scale(n);for(let l=0;l<2;l++)wr.copy(r),wr.add(jd),yv(t,wr),jd.negate()}return t}function gv(){return[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]]}function yv(e,t){pt.WGS84.cartesianToCartographic(t,wr),e[0][0]=Math.min(e[0][0],wr[0]),e[0][1]=Math.min(e[0][1],wr[1]),e[0][2]=Math.min(e[0][2],wr[2]),e[1][0]=Math.max(e[1][0],wr[0]),e[1][1]=Math.max(e[1][1],wr[1]),e[1][2]=Math.max(e[1][2],wr[2])}qt();Dr();Dr();var L1=new I,wv=new I,is=new I,_v=new I,PN=new I,D1=new bt,Mv=new bt;function Wd(e,t){if(e.lodMetricValue===0||Number.isNaN(e.lodMetricValue))return"DIG";let r=2*F1(e,t);if(r<2)return"OUT";if(!e.header.children)return"DRAW";switch(e.lodMetricType){case"screenSpaceRelative":{let n=t.topDownViewport.height||1;return r/n<=e.lodMetricValue?"DRAW":"DIG"}case"distanceRangeFromDefaultCamera":return e.distanceToTile(t)>=e.lodMetricValue?"DRAW":"DIG";case"maxScreenThresholdSQ":{let n=Math.sqrt(e.lodMetricValue/(Math.PI*.25));return r<=n?"DRAW":"DIG"}default:return r<=e.lodMetricValue?"DRAW":"DIG"}}function F1(e,t){let{topDownViewport:r}=t,n=e.header.i3sLodMbs||e.header.mbs,i=n[1],o=n[0],s=n[2],a=n[3],c=[...e.boundingVolume.center],l=r.unprojectPosition(r.cameraPosition);pt.WGS84.cartographicToCartesian(l,L1),wv.copy(L1).subtract(c).normalize(),ga(pt.WGS84,c,D1),Mv.copy(D1).invert(),is.copy(L1).transform(Mv);let h=Math.sqrt(is[0]*is[0]+is[1]*is[1]),u=h*h/is[2];_v.copy([is[0],is[1],u]);let d=_v.transform(D1).subtract(c).normalize(),p=wv.cross(d).normalize().scale(a).add(c),g=pt.WGS84.cartesianToCartographic(p),y=r.project([o,i,s]),_=r.project(g);return PN.copy(y).subtract(_).magnitude()}Wn();var zh=class{_map=new Map;_array;_length;constructor(t=0){this._array=new Array(t),this._length=t}get length(){return this._length}set length(t){this._length=t,t>this._array.length&&(this._array.length=t)}get values(){return this._array}get(t){return ii(t<this._array.length),this._array[t]}set(t,r){ii(t>=0),t>=this.length&&(this.length=t+1),this._map.has(this._array[t])&&this._map.delete(this._array[t]),this._array[t]=r,this._map.set(r,t)}delete(t){let r=this._map.get(t);r>=0&&(this._array.splice(r,1),this._map.delete(t),this.length--)}peek(){return this._array[this._length-1]}push(t){if(!this._map.has(t)){let r=this.length++;this._array[r]=t,this._map.set(t,r)}}pop(){let t=this._array[--this.length];return this._map.delete(t),t}reserve(t){ii(t>=0),t>this._array.length&&(this._array.length=t)}resize(t){ii(t>=0),this.length=t}trim(t){t==null&&(t=this.length),this._array.length=t}reset(){this._array=[],this._map=new Map,this._length=0}find(t){return this._map.has(t)}};var RN={loadSiblings:!1,skipLevelOfDetail:!1,baseScreenSpaceError:1024,skipScreenSpaceErrorFactor:16,skipLevels:1,immediatelyLoadDesiredLevelOfDetail:!1,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""},Li=class{options;disableSkipLevelOfDetail=!1;root=null;selectedTiles={};requestedTiles={};deferredTiles={};emptyTiles={};lastUpdate=new Date().getTime();updateDebounceTime=1e3;_traversalStack=new zh;_emptyTraversalStack=new zh;_frameNumber=null;traversalFinished(t){return!0}constructor(t){this.options={...RN,...t}}isSkipLevelOfDetailEnabled(){return this.options.skipLevelOfDetail&&!this.disableSkipLevelOfDetail}traverse(t,r,n){this.root=t,this.options={...this.options,...n},this.reset(),this.updateTile(t,r),this._frameNumber=r.frameNumber,this.executeTraversal(t,r)}reset(){this.requestedTiles={},this.deferredTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(t,r){let n=this._traversalStack;for(t._selectionDepth=1,n.push(t);n.length>0;){let i=n.pop(),o=!1;this.canTraverse(i,r)&&(this.updateChildTiles(i,r),o=this.updateAndPushChildren(i,r,n,i.hasRenderContent?i._selectionDepth+1:i._selectionDepth));let s=i.parent,a=!!(!s||s._shouldRefine),c=!o;i.hasRenderContent?i.refine===ze.ADD?(this.loadTile(i,r),this.selectTile(i,r)):i.refine===ze.REPLACE&&(this.loadTile(i,r),(c||this.isSkipLevelOfDetailEnabled())&&this.selectTile(i,r)):(this.emptyTiles[i.id]=i,this.loadTile(i,r),c&&this.selectTile(i,r)),this.touchTile(i,r),i._shouldRefine=o&&a}this.completeTraversal(r)}completeTraversal(t){let r=new Date().getTime();(this.traversalFinished(t)||r-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=r,this.options.onTraversalEnd(t))}updateChildTiles(t,r){let n=t.children;for(let i of n)this.updateTile(i,r)}updateAndPushChildren(t,r,n,i){let{loadSiblings:o}=this.options,s=this.isSkipLevelOfDetailEnabled(),a=t.children;a.sort(this.compareDistanceToCamera.bind(this));let c=t.refine===ze.REPLACE&&t.hasRenderContent&&!s,l=!1,h=!0;for(let u of a)if(u._selectionDepth=i,u.isVisibleAndInRequestVolume?(n.find(u)&&n.delete(u),n.push(u),l=!0):(c||o)&&u._inRequestVolume&&(this.loadTile(u,r),this.touchTile(u,r)),c){let f;u._inRequestVolume?u.hasRenderContent?f=u.contentAvailable:f=this.executeEmptyTraversal(u,r):f=!1,h=h&&f}return l||(h=!1),h}updateTile(t,r){this.updateTileVisibility(t,r)}selectTile(t,r){this.shouldSelectTile(t,r)&&(t._selectedFrame=r.frameNumber,this.selectedTiles[t.id]=t)}loadTile(t,r){if(this.shouldLoadTile(t)){if(this.shouldDeferTileRequest(t)){this.deferredTiles[t.id]=t;return}t._requestedFrame=r.frameNumber,t._priority=t._getPriority(),this.requestedTiles[t.id]=t}}shouldDeferTileRequest(t){return t.priorityDeferred}touchTile(t,r){t.tileset._cache.touch(t),t._touchedFrame=r.frameNumber}canTraverse(t,r){return t.hasChildren?t.hasTilesetContent?!t.contentExpired:this.shouldRefine(t,r):!1}shouldLoadTile(t){return t.hasUnloadedContent||t.contentExpired}shouldSelectTile(t,r){return t.contentAvailable&&t.contentVisibility(r)!=="outside"}shouldRefine(t,r,n=!1){let i=t._screenSpaceError;return n&&(i=t.getScreenSpaceError(r,!0)),i>t.tileset.memoryAdjustedScreenSpaceError}updateTileVisibility(t,r){let n=[];if(this.options.viewportTraversersMap)for(let i in this.options.viewportTraversersMap)this.options.viewportTraversersMap[i]===r.viewport.id&&n.push(i);else n.push(r.viewport.id);t.updateVisibility(r,n)}compareDistanceToCamera(t,r){return t._distanceToCamera-r._distanceToCamera}anyChildrenVisible(t,r){let n=!1;for(let i of t.children)i.updateVisibility(r),n=n||i.isVisibleAndInRequestVolume;return n}executeEmptyTraversal(t,r){let n=!0,i=!1,o=this._emptyTraversalStack;for(o.push(t);o.length>0;){let s=o.pop(),a=!s.hasRenderContent&&this.canTraverse(s,r),c=!s.hasRenderContent&&s.children.length===0;if(s.header.implicitSubtree&&(i=!0,n=!1),!a&&!s.contentAvailable&&!c&&(n=!1),this.updateTile(s,r),s.isVisibleAndInRequestVolume||(this.loadTile(s,r),this.touchTile(s,r)),a){let l=s.children;for(let h of l)o.push(h)}}return t.hasEmptyContent&&!i||n}};var U1=new I;function CN(e,t,r,n,i=[]){let o=e.length?e:[t],s=!1,a=!1;for(let c of o){let l="inside";if(n!==sr.MASK_INSIDE&&(l=r.computeVisibility(c),l==="outside"))continue;let h=!1;for(let u of i)if(c.intersectPlane(u)==="outside"){h=!0;break}h||(s=!0,a=a||l==="intersecting")}return s?a?"intersecting":"inside":"outside"}function bv(e){if(!e||typeof e!="object")return!1;let t=e;return t.shape==="tileset3d"||t.type==="tileset3d"||!!t.tileset}function NN(e){return e!=null}var bn=class{tileset;header;id;url;parent;refine;type;contentUrl;contentUrls=[];lodMetricType="geometricError";lodMetricValue=0;_unscaledLodMetricValue=0;_scaleGeometricError=!0;boundingVolume=null;content=null;contents=[];contentEntries=[];metadataContext={};featureIdSets=[];vectorContent=null;metadata=null;contentMetadata=[];contentState=ir.UNLOADED;gpuMemoryUsageInBytes=0;children=[];childrenState="ready";depth=0;viewportIds=[];transform=new bt;extensions=null;implicitTiling=null;userData={};computedTransform;hasEmptyContent=!1;hasTilesetContent=!1;traverser=new Li({});_cacheNode=null;_frameNumber=null;_expireDate=null;_expiredContent=null;_childrenPromise=null;_boundingBox=void 0;_distanceToCamera=0;_screenSpaceError=0;_screenSpaceErrorProgressiveResolution=0;_priorityProgressiveResolution=!1;_foveatedFactor=0;priorityDeferred=!1;_visibilityPlaneMask;_visible=void 0;_contentBoundingVolume;_contentBoundingVolumes=[];_contentBoundingVolumeHeaders=[];_viewerRequestVolume;get contentBoundingVolume(){return this._contentBoundingVolume}get contentBoundingVolumes(){return this._contentBoundingVolumes}get viewerRequestVolume(){return this._viewerRequestVolume}_initialTransform=new bt;_priority=0;_selectedFrame=0;_requestedFrame=0;_selectionDepth=0;_touchedFrame=0;_centerZDepth=0;_shouldRefine=!1;_stackLength=0;_visitedFrame=0;_inRequestVolume=!1;_lodJudge=null;tileDrawn=!0;constructor(t,r,n,i=""){this.header=r,this.tileset=t,this.id=i||r.id,this.url=r.url,this.parent=n,this.refine=this._getRefine(r.refine),this.type=r.type,this.contentUrl=r.contentUrl,this.contentUrls=r.contentUrls||(r.contentUrl?[r.contentUrl]:[]),this._initializeMetadata(r),this.childrenState=r.implicitSubtree?"unloaded":"ready",this._initializeLodMetric(r),this._initializeTransforms(r),this._updateLodMetricScale(),this._initializeBoundingVolumes(r),this._initializeContent(r),this._initializeContentEntries(r),this._initializeRenderingState(r),Object.seal(this)}destroy(){this.header=null}isDestroyed(){return this.header===null}get selected(){return this._selectedFrame===this.tileset._frameNumber}get isVisible(){return this._visible}get isVisibleAndInRequestVolume(){return this._visible&&this._inRequestVolume}get hasRenderContent(){return!this.hasEmptyContent&&!this.hasTilesetContent}get hasChildren(){return this.children.length>0||this.header.children&&this.header.children.length>0||!!(this.header.implicitSubtree&&this.childrenState!=="ready")}get hasUnloadedChildren(){return!!(this.header.implicitSubtree&&(this.childrenState==="unloaded"||this.childrenState==="failed"))}get childrenLoading(){return this.childrenState==="loading"}get contentReady(){return this.contentState===ir.READY||this.hasEmptyContent}get contentAvailable(){return!!(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}get hasUnloadedContent(){return this.hasRenderContent&&this.contentUnloaded}get contentUnloaded(){return this.contentState===ir.UNLOADED}get contentExpired(){return this.contentState===ir.EXPIRED}get contentFailed(){return this.contentState===ir.FAILED}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}get boundingBox(){return this._boundingBox||(this._boundingBox=pv(this.header.boundingVolume,this.boundingVolume,!this.computedTransform.equals(this._initialTransform))),this._boundingBox}getScreenSpaceError(t,r,n=1){switch(this.tileset.type){case nr.I3S:return F1(this,t);case nr.TILES3D:return qS(this,t,r,n);default:throw new Error("Unsupported tileset type")}}unselect(){this._selectedFrame=0}_getGpuMemoryUsageInBytes(){return(this.contents.length?this.contents:[this.content]).reduce((r,n)=>r+(n?.gpuMemoryUsageInBytes||n?.byteLength||0),0)}_getPriority(){return this._calculateRequestPriority(!1)}_getChildrenPriority(){return this._calculateRequestPriority(!0)}_calculateRequestPriority(t){let r=this.tileset._traverser,n=r.options.skipLevelOfDetail&&!r.disableSkipLevelOfDetail,i=this.refine===ze.ADD||n;if(i&&!this.isVisible&&this._visible!==void 0||this.tileset._frameNumber-this._touchedFrame>=1||this.priorityDeferred||!t&&this.contentState===ir.UNLOADED)return-1;let o=this.parent,a=o&&(!i||this._screenSpaceError===0||o.hasTilesetContent)?o._screenSpaceError:this._screenSpaceError,c=r.root?r.root._screenSpaceError:0,l=Math.max(c-a,0);return JS({priorityProgressiveResolution:this._priorityProgressiveResolution,foveatedFactor:this._foveatedFactor,reverseScreenSpaceError:l,rootScreenSpaceError:c})}async loadContent(){if(this.hasEmptyContent)return{loaded:!1};if(this.content)return{loaded:!0};this.contentExpired&&(this._expireDate=null),this.contentState=ir.LOADING;let r=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!r)return this.contentState=ir.UNLOADED,{loaded:!1};try{return await this._loadContentFromSource()}catch(n){throw this.contentState=ir.FAILED,n}finally{r.done()}}async loadContentForTraversal(){if(this.hasEmptyContent)return{loaded:!1};if(this.content)return{loaded:!0,contents:this.contents};this.contentState=ir.LOADING;try{return await this._loadContentFromSource()}catch(t){throw this.contentState=ir.FAILED,t}}async _loadContentFromSource(){let t=await this.tileset.source.loadTileContent(this);return t.contents&&(this.contents=t.contents,this.content=this.contents[0]||null),this.vectorContent=this.contents.find(r=>!!r?.vectorContent)?.vectorContent||null,this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this.contentState=ir.READY,this._onContentLoaded(),this._updateContentEntriesAfterLoad(t),t}async loadChildren(t){if(!this.header.implicitSubtree||this.childrenState==="ready")return{loaded:!1,tileCount:0,childSubtreeCount:0};if(this._childrenPromise)return await this._childrenPromise;if(!this.tileset.source.loadTileChildren)throw new Error("Tileset source does not support lazy tile children");this.childrenState="loading",this._childrenPromise=this._loadChildrenWithScheduler(t);try{return await this._childrenPromise}finally{this._childrenPromise=null}}async _loadChildrenWithScheduler(t){let r=await this.tileset._requestScheduler.scheduleRequest(`${this.id}:implicit-subtree`,this._getChildrenPriority.bind(this));if(!r)return this.childrenState="unloaded",{loaded:!1,tileCount:0,childSubtreeCount:0};try{let n=await this.tileset.source.loadTileChildren(this,t);return this.childrenState=n.loaded?"ready":"unloaded",n}catch(n){throw this.childrenState="failed",n}finally{r.done()}}applyImplicitSubtreeHeader(t){let r=this.header.transform,n=this.header.transformMatrix,i=t.transform!==void 0;this.header={...this.header,...t,transform:i?t.transform:r,transformMatrix:i?t.transformMatrix:n,implicitSubtree:void 0},i&&this._initializeTransforms(this.header),this.refine=this._getRefine(t.refine),this.type=t.type,this.contentUrl=t.contentUrl,this.contentUrls=t.contentUrls||(t.contentUrl?[t.contentUrl]:[]),this._initializeMetadata(this.header),this._initializeLodMetric(t),this._updateLodMetricScale(),this._initializeBoundingVolumes(this.header),this._boundingBox=void 0,this._initializeContent(this.header),this._initializeContentEntries(this.header)}_initializeMetadata(t){this.metadata=t.metadata||null;let r=Array.isArray(t.content)?t.content:[t.content];this.contentMetadata=r.filter(Boolean).map(a=>a.metadata||null);let i=(r.find(Boolean)||{}).group,o=typeof i=="number"?this.tileset.groups?.[i]||null:i||null,s={tileset:this.tileset.metadata||null,group:o,tile:this.metadata,content:this.contentMetadata[0]||null,subtree:t.implicitMetadata||null};this.tileset.groups&&(s.groups=this.tileset.groups),this.metadataContext=s}_updateContentEntriesAfterLoad(t){if(t.contentEntries){this.contentEntries=t.contentEntries.map((r,n)=>({...r,index:n,boundingVolume:r.boundingVolume||this._contentBoundingVolumes[n]||this.boundingVolume,payload:r.payload??this.contents[n]??null,featureIds:r.featureIds?.length?r.featureIds:qd(r.payload??this.contents[n]),renderable:!!(r.renderable!==!1&&(r.payload??this.contents[n])&&!bv(r.payload??this.contents[n]))})),this.featureIdSets=this.contentEntries.flatMap(r=>r.featureIds);return}this.contentEntries=this.contentEntries.map((r,n)=>({...r,payload:this.contents[n]??null,featureIds:qd(this.contents[n]),renderable:!!this.contents[n]&&!bv(this.contents[n])})),this.featureIdSets=this.contentEntries.flatMap(r=>r.featureIds)}getContentEntry(t){return this.contentEntries[t]||null}isContentRenderable(t){return!!this.contentEntries[t]?.renderable}_initializeContentEntries(t){let r=Array.isArray(t.content)?t.content:t.content?[t.content]:[];this.contentEntries=r.map((n,i)=>{let o=n||{};return{index:i,uri:this.contentUrls[i]||o.uri||o.url,group:o.group,type:o.type,payload:null,metadata:o.metadata||null,boundingVolume:this._contentBoundingVolumes[i]||this.boundingVolume,featureIds:this._getFeatureIdSets(o),renderable:!1}})}_getFeatureIdSets(t){return qd(t)}unloadContent(){for(let t of this.contents.length?this.contents:[this.content])t&&t.destroy&&t.destroy();return this.contents=[],this.content=null,this.vectorContent=null,this.contentEntries=this.contentEntries.map(t=>({...t,payload:null,renderable:!1})),this.featureIdSets=this.contentEntries.flatMap(t=>t.featureIds),this.header.content&&this.header.content.destroy&&this.header.content.destroy(),this.header.content=null,this.contentState=ir.UNLOADED,this.tileDrawn=!0,!0}updateVisibility(t,r){if(this._frameNumber===t.frameNumber)return;let n=this.parent,i=n?n._visibilityPlaneMask:sr.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){let o=n?n.computedTransform:this.tileset.modelMatrix;this._updateTransform(o)}this._distanceToCamera=this.distanceToTile(t),this._screenSpaceError=this.getScreenSpaceError(t,!1),this._updateRequestPriorityMetrics(t),this._visibilityPlaneMask=this.visibility(t,i),this._visible=this._visibilityPlaneMask!==sr.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(t),this._frameNumber=t.frameNumber,this.viewportIds=r}_updateRequestPriorityMetrics(t){if(this.tileset.type!==nr.TILES3D){this._screenSpaceErrorProgressiveResolution=this._screenSpaceError,this._priorityProgressiveResolution=!1,this._foveatedFactor=0,this.priorityDeferred=!1;return}let r=this.tileset.options,n=r.progressiveResolutionHeightFraction;if(this._screenSpaceErrorProgressiveResolution=this.getScreenSpaceError(t,!1,n),this._priorityProgressiveResolution=KS(this._screenSpaceErrorProgressiveResolution,this.parent?._screenSpaceErrorProgressiveResolution,this.tileset.memoryAdjustedScreenSpaceError,n),!r.foveatedScreenSpaceError||t.viewport?.orthographic||!t.camera?.position||!t.camera?.direction){this._foveatedFactor=0,this.priorityDeferred=!1;return}this._foveatedFactor=YS(this.boundingVolume,t.camera);let i=this.tileset._traverser,o=i.options.skipLevelOfDetail&&!i.disableSkipLevelOfDetail,s=XS({refinement:this.refine,skipLevelOfDetail:o,foveatedScreenSpaceError:r.foveatedScreenSpaceError,foveatedConeSize:r.foveatedConeSize,minimumScreenSpaceErrorRelaxation:r.foveatedMinimumScreenSpaceErrorRelaxation,interpolationCallback:r.foveatedInterpolationCallback,foveatedFactor:this._foveatedFactor,verticalFieldOfView:t.camera.verticalFieldOfView,screenSpaceError:this._screenSpaceError,parentScreenSpaceError:this.parent?._screenSpaceError,maximumScreenSpaceError:this.tileset.memoryAdjustedScreenSpaceError,priorityProgressiveResolution:this._priorityProgressiveResolution});this.priorityDeferred=ZS(s,t.camera.timeSinceMovement,r.foveatedTimeDelay)}visibility(t,r){let{cullingVolume:n}=t,{boundingVolume:i}=this;return n.computeVisibilityWithPlaneMask(i,r)}contentVisibility(t,r){let n=r===void 0?this._contentBoundingVolumes:this._contentBoundingVolumes[r]?[this._contentBoundingVolumes[r]]:[];return CN(n,this.boundingVolume,t.cullingVolume,this._visibilityPlaneMask,t.clippingPlanes)}distanceToTile(t){let r=this.boundingVolume;return Math.sqrt(Math.max(r.distanceSquaredTo(t.camera.position),0))}cameraSpaceZDepth({camera:t}){let r=this.boundingVolume;return U1.subVectors(r.center,t.position),t.direction.dot(U1)}insideViewerRequestVolume(t){let r=this._viewerRequestVolume;return!r||r.distanceSquaredTo(t.camera.position)<=0}updateExpiration(){if(NN(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){let t=Date.now();Date.lessThan(this._expireDate,t)&&(this.contentState=ir.EXPIRED,this._expiredContent=this.content)}}get extras(){return this.header.extras}_initializeLodMetric(t){this._scaleGeometricError=typeof t._scaleGeometricError=="boolean"?t._scaleGeometricError:this.parent?._scaleGeometricError??!0,"lodMetricType"in t?this.lodMetricType=t.lodMetricType:(this.lodMetricType=this.parent&&this.parent.lodMetricType||this.tileset.lodMetricType,Ji.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType")()),"lodMetricValue"in t?this._unscaledLodMetricValue=t.lodMetricValue:(this._unscaledLodMetricValue=this.parent?this.parent._unscaledLodMetricValue:this.tileset.lodMetricValue,Ji.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue")()),this.lodMetricValue=this._unscaledLodMetricValue}_initializeTransforms(t){this.transform=t.transform?new bt(t.transform):new bt;let r=this.parent,n=this.tileset,i=r&&r.computedTransform?r.computedTransform.clone():n.modelMatrix.clone();this.computedTransform=new bt(i).multiplyRight(this.transform);let o=r&&r._initialTransform?r._initialTransform.clone():new bt;this._initialTransform=new bt(o).multiplyRight(this.transform)}_updateLodMetricScale(){if(this.lodMetricType!==$c.GEOMETRIC_ERROR||!this._scaleGeometricError){this.lodMetricValue=this._unscaledLodMetricValue;return}let t=this.computedTransform.getScale(U1),r=Math.max(t[0],t[1],t[2]);this.lodMetricValue=this._unscaledLodMetricValue*r}_initializeBoundingVolumes(t){this._contentBoundingVolume=null,this._contentBoundingVolumeHeaders=[],this._viewerRequestVolume=null,this._updateBoundingVolume(t)}_initializeContent(t){this.content={_tileset:this.tileset,_tile:this},this.contents=[],this.hasEmptyContent=!0,this.contentState=ir.UNLOADED,this.hasTilesetContent=!1,(t.contentUrl||t.contentUrls?.length)&&(this.content=null,this.hasEmptyContent=!1)}_initializeRenderingState(t){this.depth=t.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._screenSpaceErrorProgressiveResolution=0,this._priorityProgressiveResolution=!1,this._foveatedFactor=0,this.priorityDeferred=!1,this._visibilityPlaneMask=sr.MASK_INDETERMINATE,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._frameNumber=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._priority=0}_getRefine(t){return t||this.parent&&this.parent.refine||ze.REPLACE}_isTileset(){return(this.contents.length?this.contents:[this.content]).some(t=>t?.shape==="tileset3d")}_onContentLoaded(){let t=this.contents.length?this.contents:[this.content];for(let r of t)switch(r&&r.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0;break;default:}this._isTileset()?this.hasTilesetContent=!0:this.gpuMemoryUsageInBytes=this._getGpuMemoryUsageInBytes()}_updateBoundingVolume(t){this._boundingBox=void 0,this.boundingVolume=Xc(t.boundingVolume,this.computedTransform,this.boundingVolume,this._initialTransform),t.viewerRequestVolume&&(this._viewerRequestVolume=Xc(t.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume,this._initialTransform));let r=t.content;r&&(this._contentBoundingVolumeHeaders=Array.isArray(r)?r:[r]);let n=r?Array.isArray(r)?r:[r]:this._contentBoundingVolumeHeaders;this._contentBoundingVolumes=n.length?n.map(i=>i?.boundingVolume?Xc(i.boundingVolume,this.computedTransform,void 0,this._initialTransform):this.boundingVolume):[this.boundingVolume],this._contentBoundingVolume=this._contentBoundingVolumes[0]||null}_updateTransform(t=new bt){let r=t.clone().multiplyRight(this.transform);r.equals(this.computedTransform)||(this.computedTransform=r,this._updateLodMetricScale(),this._updateBoundingVolume(this.header))}};Wn();Dr();qt();var Hd=class extends Li{pendingImplicitSubtrees=new Map;traversalFinished(t){let r=`${t.viewport.id}:`;for(let[n,i]of this.pendingImplicitSubtrees)if(n.startsWith(r)&&i===t.frameNumber)return!1;return!0}executeTraversal(t,r){if(!this.isSkipLevelOfDetailEnabled()){super.executeTraversal(t,r);return}this.executeSkipTraversal(t,r)}executeSkipTraversal(t,r){let n=[t];for(t._selectionDepth=t.parent?t.parent._selectionDepth:1;n.length>0;){let i=n.pop(),o=!i.parent||i.parent._shouldRefine,s=this.canTraverse(i,r)&&this.updateAndPushSkipChildren(i,r,n)&&o,a=!s&&o;i.hasRenderContent?i.refine===ze.ADD?(this.loadTile(i,r),this.selectDesiredTile(i,r)):i.refine===ze.REPLACE&&(this.isInBaseTraversal(i,r)?(this.loadTile(i,r),a&&this.selectDesiredTile(i,r)):a?(this.loadTile(i,r),this.selectDesiredTile(i,r)):this.hasReachedSkippingThreshold(i,r)&&this.loadTile(i,r)):(this.emptyTiles[i.id]=i,this.loadTile(i,r),a&&(!i.hasEmptyContent||i.hasChildren)&&this.selectDesiredTile(i,r)),this.touchTile(i,r),i._shouldRefine=s}this.completeTraversal(r)}updateAndPushSkipChildren(t,r,n){this.updateChildTiles(t,r),t.children.sort(this.compareDistanceToCamera.bind(this));let i=!1;for(let o of t.children)o._selectionDepth=t.hasRenderContent?t._selectionDepth+1:t._selectionDepth,o.isVisibleAndInRequestVolume?(n.push(o),i=!0):this.options.loadSiblings&&o._inRequestVolume&&(this.loadTile(o,r),this.touchTile(o,r));return i}isInBaseTraversal(t,r){if(this.options.immediatelyLoadDesiredLevelOfDetail)return!1;if(!this.findNearestRequestedOrLoadedAncestor(t,r))return!0;let n=Number.isFinite(this.options.baseScreenSpaceError)?Math.max(this.options.baseScreenSpaceError,0):1024,i=Math.max(n,t.tileset.memoryAdjustedScreenSpaceError);return t._screenSpaceError===0&&t.parent?t.parent._screenSpaceError>i:t._screenSpaceError>i}hasReachedSkippingThreshold(t,r){if(this.options.immediatelyLoadDesiredLevelOfDetail)return!1;if(t._priorityProgressiveResolution&&t._screenSpaceErrorProgressiveResolution<=t.tileset.memoryAdjustedScreenSpaceError&&!!(t.parent&&t.parent._screenSpaceErrorProgressiveResolution>t.tileset.memoryAdjustedScreenSpaceError))return!0;let i=this.findNearestRequestedOrLoadedAncestor(t,r);if(!i)return!1;let o=Number.isFinite(this.options.skipScreenSpaceErrorFactor)&&this.options.skipScreenSpaceErrorFactor>0?this.options.skipScreenSpaceErrorFactor:16,s=Number.isFinite(this.options.skipLevels)?Math.max(Math.floor(this.options.skipLevels),0):1;return t._screenSpaceError<i._screenSpaceError/o&&t.depth>i.depth+s}findNearestRequestedOrLoadedAncestor(t,r){let n=t.parent;for(;n;){if(n.hasRenderContent&&!n.contentFailed&&(!n.hasUnloadedContent||n._requestedFrame===r.frameNumber))return n;n=n.parent}return null}selectDesiredTile(t,r){let n=t;for(;n;){if(this.shouldSelectTile(n,r)){this.selectTile(n,r),n!==t&&this.selectLoadedDescendants(t,r,!0);return}n=n.parent}this.selectLoadedDescendants(t,r)}selectLoadedDescendants(t,r,n=!1){let i=[{tile:t,depth:0}];for(;i.length>0;){let{tile:o,depth:s}=i.pop();for(let a of o.children)this.updateTile(a,r),a.isVisibleAndInRequestVolume&&(this.shouldSelectTile(a,r)&&(!n||a.tileDrawn)?(this.selectTile(a,r),this.touchTile(a,r)):s<1&&i.push({tile:a,depth:s+1}))}}compareDistanceToCamera(t,r){return r._distanceToCamera===0&&t._distanceToCamera===0?r._centerZDepth-t._centerZDepth:r._distanceToCamera-t._distanceToCamera}updateChildTiles(t,r){let n=t.header.implicitSubtree?.coordinates.level===0;if(t.hasUnloadedChildren&&t.isVisibleAndInRequestVolume&&(n||this.shouldRefine(t,r))){let i=`${r.viewport.id}:${t.id}`;this.pendingImplicitSubtrees.has(i)||(this.pendingImplicitSubtrees.set(i,r.frameNumber),t.tileset._loadTileChildren(t,r).finally(()=>{this.handleImplicitSubtreeLoad(t,r,i)}))}super.updateChildTiles(t,r)}handleImplicitSubtreeLoad(t,r,n){this.pendingImplicitSubtrees.delete(n),this._frameNumber===r.frameNumber&&(t.childrenState==="ready"?this.executeTraversal(t,r):this.traversalFinished(r)&&this.options.onTraversalEnd(r))}updateTileVisibility(t,r){if(super.updateTileVisibility(t,r),!t.isVisibleAndInRequestVolume)return;let n=t.children.length>0;if(t.hasTilesetContent&&n){let s=t.children[0];this.updateTileVisibility(s,r),t._visible=s._visible;return}if(this.meetsScreenSpaceErrorEarly(t,r)){t._visible=!1;return}let i=t.refine===ze.REPLACE,o=t._optimChildrenWithinParent===jS.USE_OPTIMIZATION;if(i&&o&&n&&!this.anyChildrenVisible(t,r)){t._visible=!1;return}}meetsScreenSpaceErrorEarly(t,r){let{parent:n}=t;return!n||n.hasTilesetContent||n.refine!==ze.ADD?!1:!this.shouldRefine(t,r,!0)}};qt();so();Dr();var BN=6378137,ON=6378137,G1=6356752314245179e-9,Zc=new I;function xv(e,t){if(e instanceof oo){let{halfAxes:r}=e,n=LN(r);return Math.log2(G1/(n+t[2]))}else if(e instanceof en){let{radius:r}=e;return Math.log2(G1/(r+t[2]))}else if(e.width&&e.height){let{width:r,height:n}=e,i=Math.log2(BN/r),o=Math.log2(ON/n);return(i+o)/2}return 1}function z1(e,t,r){pt.WGS84.cartographicToCartesian([e.xmax,e.ymax,e.zmax],Zc);let n=Math.sqrt(Math.pow(Zc[0]-r[0],2)+Math.pow(Zc[1]-r[1],2)+Math.pow(Zc[2]-r[2],2));return Math.log2(G1/(n+t[2]))}function Sv(e,t,r){let[n,i,o,s]=e;return z1({xmin:n,xmax:o,ymin:i,ymax:s,zmin:0,zmax:0},t,r)}function LN(e){e.getColumn(0,Zc);let t=e.getColumn(1),r=e.getColumn(2);return Zc.add(t).add(r).len()}var DN=Object.freeze({meter:1,millimeter:.001,centimeter:.01,decimeter:.1,kilometer:1e3,foot:.3048,yard:.9144,mile:1609.344,"us-foot":.3048006096012192,"us-inch":.0254000508001016,"us-yard":.9144018288036576,"us-mile":1609.3472186944373,"clarke-foot":.3047972654,"clarke-yard":.9143917962,"clarke-link":.201166195164,"sears-yard":.914398414616,"sears-foot":.304799471539,"sears-chain":20.1167651216,"sears-1922-truncated-chain":20.116756,"benoit-1895-b-chain":20.1167824944,"indian-yard":.914398530744,"indian-1937-yard":.91439523,"gold-coast-foot":.304799710181}),FN=Object.freeze({m:"meter",metre:"meter",meters:"meter",metres:"meter",mm:"millimeter",millimetre:"millimeter",millimeters:"millimeter",millimetres:"millimeter",cm:"centimeter",centimetre:"centimeter",centimeters:"centimeter",centimetres:"centimeter",dm:"decimeter",decimetre:"decimeter",decimeters:"decimeter",decimetres:"decimeter",km:"kilometer",kilometre:"kilometer",kilometers:"kilometer",kilometres:"kilometer",ft:"foot",feet:"foot","us-survey-foot":"us-foot","us-survey-feet":"us-foot",yd:"yard",yards:"yard",mi:"mile",miles:"mile"});function Vh(e){if(!e)return;let t=e.trim().toLowerCase().replaceAll("_","-"),r=FN[t]||t;return DN[r]}function vv(e,t){return t!==void 0?Number.isFinite(t)&&t>0?t:void 0:e?Vh(e):1}function $d(e){let t=e.spatialReference||e.fullExtent?.spatialReference,r=kN(t),n=e.heightModelInfo?.vertCRS||qN(t),i=e.heightModelInfo?.heightModel,o=e.heightModelInfo?.heightUnit,s=vv(o,e.ZFactor),a=i==="ellipsoidal"?"ellipsoidal":i==="gravity_related_height"?"orthometric":"unknown",c=Iv(t),l=c===void 0?r?_n(r):"unknown":_n(`EPSG:${c}`),h=UN(l,o,e.ZFactor),u=[],f=GN(e.elevationInfo?.mode),d=e.elevationInfo?e.elevationInfo.unit||"meter":void 0,m=Vh(d);return s===void 0&&u.push(e.ZFactor!==void 0?`I3S ZFactor ${e.ZFactor} is not a positive finite conversion factor`:`Unsupported I3S vertical unit ${o}`),e.elevationInfo&&m===void 0&&u.push(`Unsupported I3S elevation unit ${d}`),e.elevationInfo?.mode&&!f&&u.push(`Unsupported I3S elevation mode ${e.elevationInfo.mode}`),f&&f!=="absoluteHeight"&&u.push(`I3S elevation mode ${f} requires a terrain or scene elevation provider`),Mn({sourceCrs:r,sourceCrsRepresentation:c!==void 0?"identifier":r?"wkt":void 0,sourceCrsAlternatives:c!==void 0&&t?.wkt?[{definition:t.wkt,representation:"wkt"}]:void 0,verticalCrs:n,units:h,verticalUnitScale:s??Number.NaN,heightReference:a,elevationMode:f,elevationOffset:e.elevationInfo?.offset,elevationUnit:d,elevationUnitScale:e.elevationInfo?.mode&&!f?Number.NaN:m??(e.elevationInfo?Number.NaN:1),coordinateFrame:l,axisOrder:r?"xyz":"unknown",provenance:r?"metadata":"unknown",warnings:u})}function UN(e,t,r){if(e==="geocentric")return["meter","meter","meter"];if(e==="geographic"&&(t||r===void 0))return["degree","degree",t||"meter"]}function GN(e){switch(e){case"absoluteHeight":case"onTheGround":case"relativeToGround":case"relativeToScene":return e;default:return}}function Yd(e){let t=zN(e);if(t)return t;let r=Ev(e,"TILESET_CRS_GEOCENTRIC"),n=Ev(e,"TILESET_CRS_COORDINATE_EPOCH"),i=[],o,s="unknown",a;typeof r=="string"&&r.toUpperCase()!=="UNKNOWN"?(o=r,s="metadata",a="explicit"):r!==void 0?(i.push("3D Tiles geocentric CRS is explicitly unknown"),s="metadata",a="unknown"):e.root?.boundingVolume?.region?(o="EPSG:4978",s="format-default",a="default"):e.schemaUri&&!e.schema&&i.push("External 3D Tiles metadata schema must be loaded before CRS semantics can resolve");let c=Tv(n);return n!==void 0&&c===void 0&&i.push("3D Tiles coordinate epoch is not a finite decimal year"),Mn({sourceCrs:o,sourceCrsState:a,sourceCrsRepresentation:o?"identifier":void 0,coordinateEpoch:c,heightReference:o?"ellipsoidal":"unknown",coordinateFrame:o?"geocentric":"unknown",axisOrder:o?"xyz":"unknown",provenance:s,warnings:i})}function zN(e){let t=e.extensions?.EXT_geospatial_crs;if(!t)return;let r=[],n,i,o,s;if(t.format==="wkid"){let h=t.extensions?.EXT_geospatial_crs_wkid;typeof h?.authority=="string"&&Number.isInteger(h.wkid)?(n=`${h.authority}:${h.wkid}`,s="identifier",Number.isInteger(h.vcsWkid)&&(i=`${h.authority}:${h.vcsWkid}`),o=Tv(h.epoch),h.epoch!==void 0&&o===void 0&&r.push("EXT_geospatial_crs_wkid epoch is not a finite decimal year")):r.push("EXT_geospatial_crs_wkid requires string authority and integer wkid")}else if(t.format==="wkt2"){let h=t.extensions?.EXT_geospatial_crs_wkt2;typeof h?.wkt2=="string"&&h.wkt2.trim()?(n=h.wkt2,s="wkt"):r.push("EXT_geospatial_crs_wkt2 requires a nonempty wkt2 string")}else r.push(`Unsupported EXT_geospatial_crs format ${String(t.format)}`);let a=s==="wkt"?_n(n):A1(n)||"unknown",c=VN(i);i&&!c&&r.push(`Unsupported vertical CRS ${String(i)}; vertical unit and height reference are unknown`);let l=i?c?.unit:"meter";return Mn({sourceCrs:n,sourceCrsState:n?"explicit":"unknown",sourceCrsRepresentation:s,verticalCrs:i,coordinateEpoch:o,units:a==="geocentric"?["meter","meter","meter"]:a==="geographic"&&l?["degree","degree",l]:void 0,verticalUnitScale:i?c?.verticalUnitScale??Number.NaN:1,heightReference:i?c?.heightReference??"unknown":n?"ellipsoidal":"unknown",coordinateFrame:a,axisOrder:n?"xyz":"unknown",provenance:"metadata",warnings:r})}function VN(e){if(typeof e!="string")return;let t=/^EPSG:(\d+)$/i.exec(e);if(t)switch(Number(t[1])){case 5702:case 6360:return{unit:"us-foot",verticalUnitScale:1200/3937,heightReference:"orthometric"};case 5703:return{unit:"meter",verticalUnitScale:1,heightReference:"orthometric"};default:return}}function Tv(e){if(typeof e!="string"&&typeof e!="number"||typeof e=="string"&&!e.trim())return;let t=Number(e);return Number.isFinite(t)?t:void 0}function kN(e){let t=Iv(e);return t!==void 0?`EPSG:${t}`:e?.wkt}function qN(e){let t=e?.latestVcsWkid??e?.vcsWkid;return t===void 0?void 0:`EPSG:${t}`}function Iv(e){return e?.latestWkid??e?.wkid}function Ev(e,t){let r=e.metadata?.class;if(!r)return;let i=e.schema?.classes?.[r]?.properties,o=e.metadata?.properties;for(let[s,a]of Object.entries(i||{}))if(a.semantic===t)return o?.[s]}qt();Dr();function Av(e){return{input:new Float64Array(e),output:new Float64Array(e)}}function kh(e){return e instanceof Float32Array||e instanceof Float64Array}function Pv(e){return typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer}function V1(e,t,r,n,i,o){return(e.buffer===n.buffer||Pv(e.buffer)&&Pv(n.buffer))&&t<o&&i<r}function Kd(e,t,r,n){return e<t+n?0:Math.floor((e-t-n)/r)+1}var Xd=class{constructor(t){this.depth=0;let r=t.dimension??2,n=t.inputOffset??0,i=t.outputOffset??0;if(!Number.isSafeInteger(r)||r<2||!Number.isSafeInteger(n)||n<0||!Number.isSafeInteger(i)||i<0||t.inputStride!==void 0&&(!Number.isSafeInteger(t.inputStride)||t.inputStride<1)||t.outputStride!==void 0&&(!Number.isSafeInteger(t.outputStride)||t.outputStride<1)||typeof t.projection?.projectToSync!="function"||typeof t.projection?.unprojectToSync!="function")throw new Error("Invalid projection buffer transform or layout");this.dimension=r,this.projection=t.projection,this.inputOffset=n,this.outputOffset=i,this.inputStride=t.inputStride,this.outputStride=t.outputStride,this.scratch=[Av(r)]}projectFlatTo(t,r,n,i=0,o){return this.flat(t,r,n,i,!1,o)}unprojectFlatTo(t,r,n,i=0,o){return this.flat(t,r,n,i,!0,o)}projectColumnsTo(t,r,n,i=0,o){return this.columns(t,r,n,i,!1,o)}unprojectColumnsTo(t,r,n,i=0,o){return this.columns(t,r,n,i,!0,o)}range(t,r,n){let i=r??Math.max(0,t-n);if(!Number.isSafeInteger(n)||n<0||!Number.isSafeInteger(i)||i<0||!Number.isSafeInteger(n+i)||n+i>t)throw new Error("Invalid projection buffer record range");return i}epochStorage(t,r,n){if(t!==void 0){if(typeof t=="number"){if(!Number.isFinite(t))throw new Error("Coordinate epoch must be finite")}else if(!kh(t)||t.length<r+n)throw new Error("Epoch buffer requires one value per addressed record")}}aliases(t,r,n,i,o,s,a){if(!i)return;let c=t.byteOffset+(this.inputOffset+n*o)*t.BYTES_PER_ELEMENT,l=c+((i-1)*o+a)*t.BYTES_PER_ELEMENT,h=r.byteOffset+(this.outputOffset+n*s)*r.BYTES_PER_ELEMENT,u=h+((i-1)*s+a)*r.BYTES_PER_ELEMENT,f=t.buffer===r.buffer&&t.constructor===r.constructor&&c===h&&o===s;if(V1(t,c,l,r,h,u)&&!f)throw new Error("Projection input/output ranges overlap without an exact in-place mapping")}epochAlias(t,r,n,i,o,s){if(typeof t!="object"||!t||!i)return;let a=t.byteOffset+n*t.BYTES_PER_ELEMENT,c=a+i*t.BYTES_PER_ELEMENT,l=r.byteOffset+(this.outputOffset+n*o)*r.BYTES_PER_ELEMENT,h=l+((i-1)*o+s)*r.BYTES_PER_ELEMENT;if(V1(t,a,c,r,l,h))throw new Error("Epoch and output buffers must not overlap")}acquire(){var t;let r=this.depth++;return(t=this.scratch)[r]||(t[r]=Av(this.dimension)),this.scratch[r]}transform(t,r,n){if(n!==void 0&&!Number.isFinite(n))throw new Error("Coordinate epoch must be finite");r?this.projection.unprojectToSync(t.input,t.output,n):this.projection.projectToSync(t.input,t.output,n)}floatRange(t,r){for(let n=0;n<this.dimension;n++){let i=t[n];if(n<3&&!Number.isFinite(i)||r&&Number.isFinite(i)&&Math.abs(i)>34028234663852886e22)throw new Error("Projection output is nonfinite or exceeds Float32 range")}}flat(t,r,n,i,o,s){if(!kh(t)||!kh(r))throw new Error("Projection buffers require Float32Array or Float64Array");let a=this.inputStride??this.dimension,c=this.outputStride??this.dimension;if(a<this.dimension||c<this.dimension)throw new Error("Interleaved stride must contain every ordinate");let l=this.range(Kd(t.length,this.inputOffset,a,this.dimension),n,i);if(i+l>Kd(r.length,this.outputOffset,c,this.dimension))throw new Error("Projection output buffer is too short");this.epochStorage(s,i,l),this.aliases(t,r,i,l,a,c,this.dimension),this.epochAlias(s,r,i,l,c,this.dimension);let h=this.acquire();try{let u=typeof s=="number"?void 0:s,f=r instanceof Float32Array;for(let d=i;d<i+l;d++){let m=this.inputOffset+d*a,p=this.outputOffset+d*c;for(let g=0;g<this.dimension;g++)h.input[g]=t[m+g];this.transform(h,o,u?u[d]:s),this.floatRange(h.output,f);for(let g=0;g<this.dimension;g++)r[p+g]=h.output[g]}return r}finally{this.depth--}}columns(t,r,n,i,o,s){if(t.length!==this.dimension||r.length!==this.dimension)throw new Error("Projection columns must match dimension");let a=this.inputStride??1,c=this.outputStride??1,l=Number.MAX_SAFE_INTEGER;for(let f=0;f<this.dimension;f++){if(!kh(t[f])||!kh(r[f]))throw new Error("Projection columns require floating typed arrays");l=Math.min(l,Kd(t[f].length,this.inputOffset,a,1))}let h=this.range(l,n,i);this.epochStorage(s,i,h);for(let f=0;f<this.dimension;f++){if(i+h>Kd(r[f].length,this.outputOffset,c,1))throw new Error("Projection output column is too short");this.epochAlias(s,r[f],i,h,c,1);for(let d=0;d<this.dimension;d++)this.aliases(t[f],r[d],i,h,a,c,1);for(let d=0;d<f&&h;d++){let m=r[f].byteOffset+(this.outputOffset+i*c)*r[f].BYTES_PER_ELEMENT,p=r[d].byteOffset+(this.outputOffset+i*c)*r[d].BYTES_PER_ELEMENT;if(V1(r[f],m,m+((h-1)*c+1)*r[f].BYTES_PER_ELEMENT,r[d],p,p+((h-1)*c+1)*r[d].BYTES_PER_ELEMENT))throw new Error("Projection output columns overlap")}}let u=this.acquire();try{let f=typeof s=="number"?void 0:s;for(let d=i;d<i+h;d++){let m=this.inputOffset+d*a,p=this.outputOffset+d*c;for(let g=0;g<this.dimension;g++)u.input[g]=t[g][m];this.transform(u,o,f?f[d]:s);for(let g=0;g<this.dimension;g++){let y=u.output[g];if(g<3&&!Number.isFinite(y)||r[g]instanceof Float32Array&&Number.isFinite(y)&&Math.abs(y)>34028234663852886e22)throw new Error("Projection output is nonfinite or exceeds Float32 range")}for(let g=0;g<this.dimension;g++)r[g][p]=u.output[g]}return r}finally{this.depth--}}};qt();var jN=240,WN=[9,-18,-88,0,96,90,0,0,-60,-20,-9,18,8,0,-96,30,0,0,60,-20,9,-88,-18,90,96,0,-20,-60,0,0,186,-42,-42,-150,-96,-150,60,60,60,60,54,162,-78,30,-24,-90,-60,60,-60,60,-9,-32,18,30,24,0,20,-60,0,0,-9,8,18,30,-96,0,-20,60,0,0,54,-78,162,-90,-24,30,60,-60,60,-60,-54,78,78,90,144,90,-60,-60,-60,-60,9,-8,-18,-30,-24,0,20,60,0,0,-9,18,-32,0,24,30,0,0,-60,20,9,-18,-8,0,-24,-30,0,0,60,20],HN=372,$N=[0,0,-131,0,138,144,0,0,-102,-31,0,0,7,0,-138,42,0,0,102,-31,62,0,-31,0,0,-62,0,0,0,31,124,0,-62,0,0,-124,0,0,0,62,124,0,-62,0,0,-124,0,0,0,62,62,0,-31,0,0,-62,0,0,0,31,0,0,45,0,-183,-9,0,93,18,0,0,0,216,0,33,87,0,-93,12,-93,0,0,156,0,153,99,0,-93,-12,-93,0,0,-45,0,-3,9,0,93,-18,0,0,0,-55,0,48,42,0,0,-84,31,0,0,-7,0,-48,-42,0,0,84,31],YN=372,KN=[18,-36,-122,0,120,135,0,0,-84,-31,-18,36,-2,0,-120,51,0,0,84,-31,36,-165,-27,93,147,-9,0,-93,18,0,210,45,-111,-93,-57,-192,0,93,12,93,162,141,-75,-93,-129,-180,0,93,-12,93,-36,-21,27,93,39,9,0,-93,-18,0,0,0,62,0,0,31,0,0,0,-31,0,0,124,0,0,62,0,0,0,-62,0,0,124,0,0,62,0,0,0,-62,0,0,62,0,0,31,0,0,0,-31,-18,36,-64,0,66,51,0,0,-102,31,18,-36,2,0,-66,-51,0,0,102,31],XN=12,k1=20/2,ZN=2,qh=class{constructor(t){this._v00=0,this._v01=0,this._v10=0,this._v11=0,this._t=[],this.options=t,this._ix=this.options._width,this._iy=this.options._height,this._hasUint16Data=id(t.data)}getHeight(t,r){if(t=Math.abs(t)>90?NaN:t,Number.isNaN(t)||Number.isNaN(r))return NaN;let n=JN(r,360);r=n!==-180?n:180;let i=r*this.options._rlonres,o=-t*this.options._rlatres,s=Math.floor(i),a=Math.min(Math.round((this.options._height-1)/2-1),Math.floor(o));i-=s,o-=a,a+=(this.options._height-1)/2,s+=s<0?this.options._width:s>=this.options._width?-this.options._width:0;let c=0,l=0,h=0,u=0,f=new Array(k1);if(s===this._ix&&a===this._iy)this.options.cubic?f=this._t:(c=this._v00,l=this._v01,h=this._v10,u=this._v11);else if(!this.options.cubic)c=this._rawval(s,a),l=this._rawval(s+1,a),h=this._rawval(s,a+1),u=this._rawval(s+1,a+1);else{let m=[this._rawval(s,a-1),this._rawval(s+1,a-1),this._rawval(s-1,a),this._rawval(s,a),this._rawval(s+1,a),this._rawval(s+2,a),this._rawval(s-1,a+1),this._rawval(s,a+1),this._rawval(s+1,a+1),this._rawval(s+2,a+1),this._rawval(s,a+2),this._rawval(s+1,a+2)],p=$N;a!==0&&(p=a===this.options._height-2?KN:WN);let g=HN;a!==0&&(g=a===this.options._height-2?YN:jN);for(let y=0;y<k1;++y){f[y]=0;for(let _=0;_<XN;++_)f[y]+=m[_]*p[k1*_+y];f[y]/=g}}if(!this.options.cubic){let m=(1-i)*c+i*l,p=(1-i)*h+i*u,g=(1-o)*m+o*p,y=this.options._offset+this.options._scale*g;return this._ix=s,this._iy=a,this._v00=c,this._v01=l,this._v10=h,this._v11=u,y}let d=f[0]+i*(f[1]+i*(f[3]+i*f[6]))+o*(f[2]+i*(f[4]+i*f[7])+o*(f[5]+i*f[8]+o*f[9]));return d=this.options._offset+this.options._scale*d,this._ix=s,this._iy=a,this._t=f,d}_rawval(t,r){t<0?t+=this.options._width:t>=this.options._width&&(t-=this.options._width),(r<0||r>=this.options._height)&&(r=r<0?-r:2*(this.options._height-1)-r,t+=(t<this.options._width/2?1:-1)*this.options._width/2);let n=r*this.options._swidth+t;if(this._hasUint16Data)return this.options.data[this.options._datastart+n];let i=this.options._datastart+ZN*n,o=this.options.data[i],s=this.options.data[i+1];return o<<8|s}};function JN(e,t){t=Math.abs(t);let r=Rv(e,t);return 2*Math.abs(r)===t?r-=Rv(e,2*t)-r:2*Math.abs(r)>t&&(r+=r<0?t:-t),r}function Rv(e,t){return e-Math.floor(e/t)*t}var QN=10,tB=65535;function Zd(e,t){let r=eB(e),n=r.next();if(n.done||n.value.line!=="P5")throw new Error("Geoid model file: File not in PGM format");let i=Number.MAX_VALUE,o=0,s=-1,a=-1,c="NONE",l="UNKNOWN",h=0,u=0,f=null,d=null;do{n=r.next();let y=n.value.line;if(y.length)if(y[0]==="#"){let _=y.split(" "),M=_[0],x=_[1];if(M!=="#"||!x)continue;let v=_.length>2?_.slice(2):[];if(x==="Description")c=v.join(" ");else if(x==="DateTime")l=v.join(" ");else if(x==="Offset"){if(!_[2])throw new Error("Geoid model file: Error reading offset");i=parseInt(_[2],10)}else if(x==="Scale"){if(!_[2])throw new Error("Geoid model file: Error reading scale");o=parseFloat(_[2])}else x===(t.cubic?"MaxCubicError":"MaxBilinearError")?isFinite(parseFloat(_[2]))&&(s=parseFloat(_[2])):x===(t.cubic?"RMSCubicError":"RMSBilinearError")&&isFinite(parseFloat(_[2]))&&(a=parseFloat(_[2]))}else{let _=y.split(" ");if(_=_.filter(M=>M!==""),h=parseInt(_[0],10),u=parseInt(_[1],10),!(h&&u))throw new Error("Geoid model file: Error reading raster size");break}}while(!n.done);n=r.next();let m=parseInt(n.value.line,10);if(n.done)throw new Error("Geoid model file: Error reading maxval");if(m!==tB)throw new Error("Geoid model file: Incorrect value of maxval");if(f=n.value.offset,d=h,i===Number.MAX_VALUE)throw new Error("Geoid model file: Offset not set");if(o===0)throw new Error("Geoid model file: Scale not set");if(o<0)throw new Error("Geoid model file: Scale must be positive");if(u<2||h<2)throw new Error("Geoid model file: Raster size too small");if(h&1)throw new Error("Geoid model file: Raster width is odd");if(!(u&1))throw new Error("Geoid model file: Raster height is even");let p=h/360,g=(u-1)/180;return new qh({cubic:t.cubic,_width:h,_height:u,_rlonres:p,_rlatres:g,_offset:i,_scale:o,_swidth:d,_datastart:f,_maxerror:s,_rmserror:a,_description:c,_datetime:l,data:e})}function*eB(e){let t=0;do{let r=e.indexOf(QN,t);if(r!==-1){let n=e.subarray(t,r);t=r+1,yield{offset:t,line:Cv(n)}}else{let n=e.subarray(t,e.length);t=e.length,yield{offset:t,line:Cv(n)}}}while(t<e.length);return{offset:t,line:""}}function Cv(e){let t="";for(let r of e)t+=String.fromCharCode(r);return t}ya();function Nv(){return{bounds:[[-1,-1,0],[1,1,0]]}}var q1=Symbol.for("@math.gl/projection/projection-implementations");function j1(){let e=globalThis;return e[q1]||(e[q1]=new WeakMap),e[q1]}function Bv(e){return"create"in e?e:j1().get(e)?.implementation}function Ov(e){if("create"in e)return Promise.resolve(e);let t=j1().get(e);if(t||(t={load:()=>e.preload()},j1().set(e,t)),t.implementation)return Promise.resolve(t.implementation);let r=t;return r.pending||(r.pending=Promise.resolve().then(r.load).then(n=>{let i=s=>s.toLowerCase().replace(/[\s_-]/g,""),o=new Set([n.name,...n.aliases||[]].map(i));if(typeof n.create!="function"||![e.name,...e.aliases||[]].every(s=>o.has(i(s))))throw new Error("Loaded projection does not match descriptor: "+e.name);return r.implementation=n,n}).catch(n=>{throw r.pending=void 0,n})),r.pending}wa();bd();var Jd=34028234663852886e22;function Ta(e,t,r){if(!(Array.isArray(e)||e instanceof Float32Array||e instanceof Float64Array))throw new Error("Scalar input requires a number array, Float32Array or Float64Array");if(!(Array.isArray(t)||t instanceof Float32Array||t instanceof Float64Array)||t.length<r)throw new Error("Scalar output requires a preallocated number array, Float32Array or Float64Array with sufficient capacity");if(e===t||Array.isArray(e)||Array.isArray(t))return;let n=e,i=t,o=typeof SharedArrayBuffer<"u"&&n.buffer instanceof SharedArrayBuffer&&i.buffer instanceof SharedArrayBuffer;if((n.buffer===i.buffer||o)&&n.byteOffset<i.byteOffset+r*i.BYTES_PER_ELEMENT&&i.byteOffset<n.byteOffset+n.byteLength)throw new Error("Scalar input/output views overlap; use the same view for in-place projection")}function jh(e,t,r,n){if(t instanceof Float32Array){if(Math.abs(r.x)>Jd||Math.abs(r.y)>Jd||n>=3&&Math.abs(r.z)>Jd)throw new Error("Projected coordinate exceeds Float32 range");for(let i=3;i<e.length;i++){let o=e[i];if(Number.isFinite(o)&&Math.abs(o)>Jd)throw new Error("Trailing ordinate exceeds Float32 range")}}for(let i=3;i<e.length;i++)t[i]=e[i];return t[0]=r.x,t[1]=r.y,n>=3&&(t[2]=r.z),t}Pc();ag();var Lv,Dv=Symbol.for("@math.gl/projection/TypeScriptCRSError"),xn=class e extends Error{static[(Lv=Dv,Symbol.hasInstance)](t){return this!==e?Function.prototype[Symbol.hasInstance].call(this,t):t instanceof Error&&t[Dv]===!0}constructor(t,r){super(r),this.reason=t,this[Lv]=!0,this.name="TypeScriptCRSError"}};function Ot(e){throw new xn("missing-transform-stage",e)}function Wh(e,t){if(typeof e=="string"||"type"in e)return{definition:e,lossy:!1};let r=e,n="crs"in r?r:void 0,i="crs"in r?r.crs:r;if(i.state!=="explicit"&&i.state!=="default")throw new xn("unknown-syntax","Cannot transform an "+i.state+" CRS reference");let o=!1;return n?.coordinateEpoch!==void 0&&Ot("Coordinate epochs require a time-dependent transformation"),n?.vertical&&n.vertical.state!=="absent"&&(t.mode!=="horizontal"&&Ot("A separately declared vertical CRS requires explicit horizontal extraction"),o=!0),{definition:i.definition,spatialReference:n,lossy:o}}function Fv(e,t){if(!t)return e;if(t.coordinateFrame!=="unknown"&&t.coordinateFrame!==e.kind)throw new Error("SpatialReference coordinate frame disagrees with its CRS");let r=t.coordinateOrder,n=e.kind==="geocentric"?{x:"e",y:"n",z:"u"}:{longitude:"e",lon:"e",latitude:"n",lat:"n",easting:"e",northing:"n",height:"u",altitude:"u",x:"e",y:"n",z:"u"},i;if(r.length&&(i=r.slice(0,3).map(o=>n[o.toLowerCase()]||"?").join(""),i.length===2&&(i+="u"),(i.length!==3||!i.includes("e")||!i.includes("n")||!i.includes("u"))&&Ot("Unsupported SpatialReference coordinate order"),(r.length>4||r.length>3&&!["m","measure"].includes(r[3]))&&Ot("Unsupported fourth coordinate component")),t.units?.length){let o={m:1,meter:1,metre:1,meters:1,metres:1,km:1e3,ft:.3048,"us-ft":.3048006096012192,degree:Math.PI/180,degrees:Math.PI/180,radian:1,radians:1,grad:Math.PI/200};for(let s=0;s<Math.min(t.units.length,3);s++){let a=(i||"enu")[s]==="u",c=e.kind==="geocentric"?e.toMeter:a?e.verticalUnit:e.kind==="geographic"?e.angularUnit:e.toMeter;(Math.abs((o[t.units[s]]??NaN)-c)>1e-12||o[t.units[s]]===void 0)&&Ot("SpatialReference units disagree with its CRS")}}return Object.freeze({...e,storedAxis:i})}Ee();var Uv={towgs84:"0,0,0",ellipse:"WGS84"},Gv={towgs84:"0,0,0",ellipse:"GRS80"},W1={wgs84:Uv,WGS84:Uv,nad83:Gv,North_American_Datum_1983:Gv},zv=new WeakMap,Ia=e=>e.toLowerCase().replace(/[\s_-]/g,"");function Jc(e){if(!e.datumCatalogs?.length)return W1;let t=zv.get(e);if(t?.catalogs===e.datumCatalogs)return t.definitions;let r=Object.assign(Object.create(null),W1),n=new Map(Object.entries(W1).map(([i,o])=>[Ia(i),{definition:o,owner:-1}]));return e.datumCatalogs.forEach((i,o)=>{if(!i.name||!i.datums)throw new Error("Invalid datum catalogue plugin");for(let[s,a]of Object.entries(i.datums)){let c=Ia(s);if(!c||c==="none"||!a||["ellipse","towgs84","nadgrids"].some(h=>a[h]!==void 0&&typeof a[h]!="string"))throw new Error("Invalid datum definition: "+s);let l=n.get(c);if(l&&(l.owner!==o||l.definition.ellipse!==a.ellipse||l.definition.towgs84!==a.towgs84||l.definition.nadgrids!==a.nadgrids))throw new Error("Conflicting datum registration: "+s);n.set(c,{definition:a,owner:o}),r[s]=a}}),zv.set(e,{catalogs:e.datumCatalogs,definitions:r}),r}var nB={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"},APL4:{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"},andrae:{a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"},clrk80:{a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk80ign:{a:63782492e-1,b:6356515,rf:293.4660213,ellipseName:"Clarke 1880 (IGN)"},clrk58:{a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"},plessis:{a:6376523,b:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:63558348467e-4,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS72:{a:6378135,rf:298.26,ellipseName:"WGS 72"},WGS84:{a:6378137,rf:298.257223563,ellipseName:"WGS 84"},sphere:{a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"}},Vv=nB;var on={};on.greenwich=0;on.lisbon=-9.131906111111;on.paris=2.337229166667;on.bogota=-74.080916666667;on.madrid=-3.687938888889;on.rome=12.452333333333;on.bern=7.439583333333;on.jakarta=106.807719444444;on.ferro=-17.666666666667;on.brussels=4.367975;on.stockholm=18.058277777778;on.athens=23.7163375;on.oslo=10.722916666667;var kv=on;cg();var qv={WGS84:"+proj=longlat +datum=WGS84","EPSG:4326":"+proj=longlat +datum=WGS84","EPSG:4269":"+proj=longlat +datum=NAD83","EPSG:4978":"+proj=geocent +datum=WGS84","EPSG:4979":"+proj=longlat +datum=WGS84","EPSG:3857":"+proj=merc +a=6378137 +b=6378137 +nadgrids=@null +units=m","EPSG:3785":"EPSG:3857",GOOGLE:"EPSG:3857","EPSG:900913":"EPSG:3857","EPSG:102113":"EPSG:3857"},Qd=["proj","datum","ellps","a","b","rf","f","R","units","to_meter","vunits","vto_meter","no_defs","type","title","towgs84","nadgrids","geoidgrids","axis","pm","over","lon_wrap"],Yv=["no_defs","over"],Di=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),jv=e=>e.toLowerCase().replace(/[\s_-]/g,"");function H1(e,t){let r=Object.keys(e).find(n=>jv(n)===jv(t));return r===void 0?void 0:e[r]}function Wv(e){if(/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i.test(e)){let r=Number(e);if(Number.isFinite(r))return r}if(/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?r$/i.test(e)){let r=Number(e.slice(0,-1))/Me;if(Number.isFinite(r))return r}let t=/^([+-]?)(\d+(?:\.\d*)?)(?:d(?:(\d+(?:\.\d*)?)'(?:(\d+(?:\.\d*)?)")?)?)?([NSEW])?$/i.exec(e);if(t&&(/d/i.test(e)||t[5])){let r=Number(t[3]||0),n=Number(t[4]||0);if(r<60&&n<60){let i=t[1]==="-"?-1:1,o=/[SW]/i.test(t[5]||"")?-1:1,s=i*o*(Number(t[2])+r/60+n/3600);if(Number.isFinite(s))return s}}throw new Error("Invalid angular parameter: "+e)}function $1(e,t={}){let r=e,n=t.aliases||{},i=new Set;for(;typeof r=="string"&&(Di(n,r)||Di(qv,r));){if(i.has(r))throw new Error("Circular CRS alias: "+r);i.add(r),r=Di(n,r)?n[r]:qv[r]}if(typeof r=="string"){let o=/^EPSG:(326|327)(\d{2})$/.exec(r);o&&Number(o[2])>=1&&Number(o[2])<=60&&(r="+proj=utm +datum=WGS84 +zone="+Number(o[2])+(o[1]==="327"?" +south":"")),(r==="EPSG:5041"||r==="EPSG:5042")&&(r="+proj=stere +datum=WGS84 +lat_0="+(r==="EPSG:5041"?90:-90)+" +k_0=0.994 +x_0=2000000 +y_0=2000000")}return r}function ho(e,t={}){let r=Jc(t),n=Wh(e,t),i=$1(n.definition,t),o;if(tr(i)==="proj-string"&&typeof i=="string"){let N=Object.create(null);for(let O of yh(i).parameters){if(Di(N,O.name))throw new Error("Duplicate PROJ parameter: +"+O.name);N[O.name]=O.value}o={parameters:N}}else{let N=t.parsers?.find(O=>O.canParse(i));if(!N){let O=["wkt","projjson"].includes(tr(i));throw new xn(O?"missing-parser":"unknown-syntax",tr(i)==="identifier"?"Unsupported CRS definition: "+i+"; resolve it first":"Unsupported CRS definition; register a WKT or PROJJSON parser for structured definitions")}o=N.parse(i,t)}let s={...o.parameters};for(let N of["lon_0","lat_0","lat_1","lat_2","lat_ts","lon_wrap","lon_1","lon_2","lonc","alpha","gamma","tilt","azi","o_alpha","o_lon_c","o_lat_c","o_lon_p","o_lat_p","o_lon_1","o_lat_1","o_lon_2","o_lat_2"])s[N]!==void 0&&(s[N]=String(Wv(s[N])));let a=s.proj,c=a?.toLowerCase(),l=c==="geocentric"?"geocent":["longlat","latlong","latlon","lonlat","identity","geocent"].includes(c)?c:a;if(!l)throw new Error("CRS requires +proj");let h=["longlat","latlong","latlon","lonlat"].includes(l)?"geographic":l==="geocent"?"geocentric":l==="identity"?"identity":"projected",u=s.datum,f=u&&u!=="none"?H1(r,u):void 0;u&&u!=="none"&&!f&&Ot("Unknown datum: "+u+"; register a datumCatalogs plugin");let d=$v(s,f?.ellipse),m=s.nadgrids??f?.nadgrids,p=m===void 0?void 0:m.split(",").map(N=>{let O=N.startsWith("@"),C=O?N.slice(1):N;if(!C||/\s/.test(C))throw new Error("Invalid datum grid name");return Object.freeze({name:C,optional:O})}),g=s.towgs84??f?.towgs84,y;if(g!==void 0&&(y=g.split(",").map(N=>tt({value:N},"value",NaN)),![3,7].includes(y.length)||y.some(N=>!Number.isFinite(N))||y.length===7&&y[6]<=-1e6))throw new Error("+towgs84 requires three or seven finite values and positive scale");u==="none"&&(y=void 0),p&&u!=="none"&&(y=[0,0,0]);let _=m==="@null"||m==="null"?$v({ellps:"WGS84"}):d,M=s.axis||"enu";if(M.length!==3||!/[ew]/.test(M)||!/[ns]/.test(M)||!/[ud]/.test(M))throw new Error("Invalid axis: "+M);let x=o.angularUnit??Me;if(h==="geographic"&&(s.units&&s.units!=="degrees"||Di(s,"to_meter")))throw new Error("Geographic coordinates must use angular units");if(h!=="geographic"&&s.units==="degrees")throw new Error("Linear coordinates require linear units");let v=Hv(s,"units","to_meter"),T=o.verticalUnit??Hv(s,"vunits","vto_meter");if(!(T>0)||!Number.isFinite(T))throw new Error("Invalid vertical unit");if(!(x>0)||!Number.isFinite(x))throw new Error("Invalid angular unit");let S=s.pm,E=S===void 0?0:(H1(kv,S)??Wv(S))*Me;return Fv(Object.freeze({kind:h,projection:l,parameters:Object.freeze(s),ellipsoid:d,datum:Object.freeze({ellipsoid:_,towgs84:y&&Object.freeze(y),grids:u==="none"||m==="@null"||m==="null"?void 0:p&&Object.freeze(p)}),areaOfUse:o.areaOfUse,angularUnit:x,toMeter:v,verticalUnit:T,primeMeridian:E,axis:M,longitudeWrap:s.lon_wrap===void 0?void 0:Number(s.lon_wrap)*Me,lossy:!!(o.lossy||n.lossy)}),n.spatialReference)}function Hv(e,t,r){let n=e[t],i=wh;if(t==="vunits"&&n==="degrees")throw new Error("Height requires linear units");if(n&&!["m","degrees"].includes(n)&&!Di(i,n))throw new Error("Unsupported units: "+n);let o=tt(e,r,n&&i[n]?i[n].metersPerUnit:1);if(!(o>0))throw new Error("+"+r+" must be positive");return o}function $v(e,t){let r=t||e.ellps||"WGS84",n=H1(Vv,r);if(!n)throw new Error("Unsupported ellipsoid: "+r);let i=tt(e,"a",n.a),o=tt(e,"f",NaN),s=tt(e,"rf",Number.isNaN(o)?n.rf||0:o===0?0:1/o),a=tt(e,"b",s?i*(1-1/s):Di(e,"f")||Di(e,"rf")||Di(e,"a")?i:n.b||i),c=tt(e,"R",0);if(i<=0||a<=0||a>i||s<0||s>0&&s<=1||Di(e,"R")&&c<=0||!Number.isNaN(o)&&(o<0||o>=1))throw new Error("Invalid ellipsoid dimensions");return Object.freeze({semiMajorAxis:c||i,semiMinorAxis:c||a,eccentricitySquared:c?0:1-(a/i)**2})}qt();var Y1=Math.PI/(180*3600),tm={ellipsoid:{semiMajorAxis:6378137,semiMinorAxis:6356752314245179e-9,eccentricitySquared:.0066943799901413165},towgs84:[0,0,0]};function rm(e,t){if(Math.abs(e.y)>Math.PI/2)throw new Error("Latitude outside geocentric domain");if(!vh(e,t))throw new Error("Geocentric coordinate must be finite")}function nm(e,t){let r=e.x,n=e.y,i=e.z,{semiMajorAxis:o,semiMinorAxis:s,eccentricitySquared:a}=t;if(r===0&&n===0&&i===0)throw new Error("Geodetic coordinates are undefined at the Earth center");if(a!==0&&Math.abs(r)<1e-12*o&&Math.abs(n)<1e-12*o&&Math.hypot(r,n)<1e-12*o){if(!Number.isFinite(Math.hypot(r,n,i)))throw new Error("Geocentric radius must be finite");e.x=0,e.y=Math.sign(i)*Math.PI/2,e.z=Math.abs(i)-s;return}if(!Eh(e,t))throw Number.isFinite(Math.hypot(r,n,i))?new Error("Geocentric inverse did not converge"):new Error("Geocentric radius must be finite")}function Kv(e,t){let r=e[0],n=e[1],i=e[2],o=(e[3]||0)*Y1,s=(e[4]||0)*Y1,a=(e[5]||0)*Y1,c=1+(e[6]||0)/1e6;return t?l=>{let h=(l.x-r)/c,u=(l.y-n)/c,f=(l.z-i)/c;l.x=h+a*u-s*f,l.y=-a*h+u+o*f,l.z=s*h-o*u+f}:l=>{let h=l.x,u=l.y,f=l.z;l.x=c*(h-a*u+s*f)+r,l.y=c*(a*h+u-o*f)+n,l.z=c*(-s*h+o*u+f)+i}}function em(e){return!!e.towgs84?.some(t=>t!==0)}function X1(e,t){if(!(!e.towgs84||!t.towgs84)){if(e.grids||t.grids){if(e.grids&&t.grids&&e.ellipsoid.semiMajorAxis===t.ellipsoid.semiMajorAxis&&e.ellipsoid.eccentricitySquared===t.ellipsoid.eccentricitySquared&&e.grids.length===t.grids.length&&e.grids.every((n,i)=>n.name===t.grids[i].name&&n.optional===t.grids[i].optional&&n.grid===t.grids[i].grid))return;let r=X1(e.grids?tm:e,t.grids?tm:t);return n=>{e.grids&&Xv(n,e,!1),r?.(n),t.grids&&Xv(n,t,!0)}}if(em(e)||em(t)){let r=K1(e,tm),n=K1(tm,t);return i=>{r?.(i),n?.(i)}}return K1(e,t)}}function K1(e,t){if(!e.towgs84||!t.towgs84)return;let r=e.ellipsoid,n=t.ellipsoid,i=!0;for(let a=0;a<7;a++)(e.towgs84[a]||0)!==(t.towgs84[a]||0)&&(i=!1);if(r.semiMajorAxis===n.semiMajorAxis&&Math.abs(r.eccentricitySquared-n.eccentricitySquared)<=5e-11&&i)return;let o=em(e)?Kv(e.towgs84,!1):void 0,s=em(t)?Kv(t.towgs84,!0):void 0;return a=>{rm(a,r),o?.(a),s?.(a),nm(a,n)}}function Xv(e,t,r){for(let n of t.grids){if(n.name==="null")return;if(!n.grid){if(n.optional)continue;throw new Error("Required datum grid is not registered: "+n.name)}let i=!1;if(n.grid.shiftInPlace)i=n.grid.shiftInPlace(e,r);else{let o=n.grid.shift(e.x,e.y,r);o&&(e.x=o[0],e.y=o[1],i=!0)}if(i){if(!Number.isFinite(e.x)||!Number.isFinite(e.y)||Math.abs(e.y)>Math.PI/2)throw new Error("Datum grid produced a coordinate outside the geographic domain");return}}throw new Error("No datum grid covers coordinate: "+t.grids.map(n=>n.name).join(","))}function Zv(e,t){let r={x:e[0],y:e[1],z:e[2]};return rm(r,t),[r.x,r.y,r.z]}function Jv(e,t){let r={x:e[0],y:e[1],z:e[2]};return nm(r,t),[r.x,r.y,r.z]}Ee();Ee();ne();Ie();function os(e,t=0){let r=tt(e,"lon_wrap",0)*Me;return n=>Ke(i=>{let o=gr(i,r);return[[r+o[0],i[0][1],0],[r+o[1],i[1][1],0]]},n??[-180,-90,180,90],r,t)}function Qv(e,t={}){if(e===void 0)return;let r=[];for(let n of e.split(",")){let i=n.startsWith("@"),o=i?n.slice(1):n;if(!o||/\s/.test(o))throw new Error("Invalid vertical grid name");if(o==="null"){r.push(null);break}let s=Object.prototype.hasOwnProperty.call(t,o)?t[o]:void 0;if(s){if(typeof s.getOffset!="function")throw new Error("Invalid vertical grid: "+o);r.push(s.getOffset.bind(s))}else i||Ot("Required vertical grid is not registered: "+o)}return(n,i)=>{for(let o of r){if(!o)return 0;let s=o(n,i);if(s!==void 0){if(!Number.isFinite(s))throw new Error("Vertical grid returned a non-finite offset");return s}}throw new Error("No vertical grid covers this coordinate")}}function Z1(e){let t=Object.freeze({...e.ellipsoid});return Object.freeze({kind:e.kind,projection:e.projection,parameters:Object.freeze(Object.fromEntries(Object.entries(e.parameters).map(([r,n])=>[r,n??null]))),ellipsoid:t,datum:Object.freeze({ellipsoid:Object.freeze({...e.datum.ellipsoid}),towgs84:e.datum.towgs84&&Object.freeze([...e.datum.towgs84]),grids:e.datum.grids&&Object.freeze(e.datum.grids.map(r=>Object.freeze({name:r.name,optional:r.optional,loaded:!!r.grid})))}),angularUnit:e.angularUnit,toMeter:e.toMeter,verticalUnit:e.verticalUnit,primeMeridian:e.primeMeridian,axis:e.axis,storedAxis:e.storedAxis,longitudeWrap:e.longitudeWrap,areaOfUse:e.areaOfUse&&Object.freeze([...e.areaOfUse]),lossy:e.lossy,algorithm:e.algorithm&&Object.freeze({...e.algorithm})})}function tE(e,t,r,n){let i=[];return e.algorithm||i.push("source-algorithm"),t.algorithm||i.push("target-algorithm"),(e.datum.grids||t.datum.grids||e.parameters.geoidgrids||t.parameters.geoidgrids)&&i.push("grid-resource"),Object.freeze({version:1,source:e,target:t,forward:r,inverse:n,lossy:e.lossy||t.lossy,complete:i.length===0,opaqueReasons:Object.freeze(i)})}var Hh=class e{static async create(t={}){let r=await Promise.all(eE(t).map(Ov));return new e({...t,projections:r})}get targetProfile(){return this.getTargetRenderingProfile(this.targetCoverage)}getTargetRenderingProfile(t){return this.targetRenderingProfile&&Jx(this.targetRenderingProfile,t)}get description(){return this.deferred?.implementation?.description??this.resolvedDescription}constructor(t={}){this.coordinateScratch=new Ko,this.targetLongitudeOrigin=0;let r=t.projections||[],n=oE(r);if(r.some(i=>!("create"in i))){let i=ho(t.from??"WGS84",t),o=ho(t.to??"WGS84",t);this.lossy=i.lossy||o.lossy,this.deferred={options:{...t,projections:[...r]}}}else{let i=t,o=n,s=rE(i.from??"WGS84",o,i),a=rE(i.to??"WGS84",o,i);this.targetRenderingProfile=a.implementation?.getRenderingProfile?.bind(a.implementation)??(a.kind==="geographic"?os(a.parameters,a.primeMeridian):a.kind==="identity"?Nv:void 0),this.targetCoverage=a.areaOfUse,this.targetLongitudeOrigin=a.implementation?.longitudeOrigin??(a.kind==="geographic"?a.longitudeWrap??0:0),this.lossy=s.lossy||a.lossy,this.lossy&&(s.kind==="geocentric"||a.kind==="geocentric")&&Ot("Horizontal extraction cannot supply ellipsoidal height for geocentric coordinates"),this.lossy&&(s.verticalGrid||a.verticalGrid)&&Ot("Horizontal extraction cannot be combined with vertical grids"),this.forwardTransform=iE(s,a,!!t.enforceAxis),this.inverseTransform=iE(a,s,!!t.enforceAxis),this.resolvedDescription=tE(Z1(s),Z1(a),this.forwardTransform.description,this.inverseTransform.description)}this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.projectTo=this.projectTo.bind(this),this.unprojectTo=this.unprojectTo.bind(this),this.projectToSync=this.projectToSync.bind(this),this.unprojectToSync=this.unprojectToSync.bind(this),this.projectFlat=this.projectFlat.bind(this),this.unprojectFlat=this.unprojectFlat.bind(this),this.projectSync=this.projectSync.bind(this),this.unprojectSync=this.unprojectSync.bind(this),this.projectFlatSync=this.projectFlatSync.bind(this),this.unprojectFlatSync=this.unprojectFlatSync.bind(this)}load(){let t=this.deferred;return t?t.implementation?Promise.resolve(t.implementation):(t.pending||(t.pending=e.create(t.options).then(r=>(t.implementation=r,r)).catch(r=>{throw t.pending=void 0,r})),t.pending):Promise.resolve(this)}loadSync(){let t=this.deferred;if(!t)return this;if(!t.implementation){let r=eE(t.options).map(n=>{let i=Bv(n);if(!i)throw new Error("Projection is not preloaded: "+n.name+". Call preload() first.");return i});t.implementation=new e({...t.options,projections:r})}return t.implementation}projectSync(t){return this.deferred?this.loadSync().project(t):Qc(t,this.forwardTransform,this.coordinateScratch)}unprojectSync(t){return this.deferred?this.loadSync().unproject(t):Qc(t,this.inverseTransform,this.coordinateScratch)}projectFlatSync(t,r=2){return this.deferred?this.loadSync().projectFlat(t,r):im(t,r,this.forwardTransform,this.coordinateScratch)}unprojectFlatSync(t,r=2){return this.deferred?this.loadSync().unprojectFlat(t,r):im(t,r,this.inverseTransform,this.coordinateScratch)}async preload(){await this.load()}project(t){return this.deferred?this.projectLoaded(t,!1):Qc(t,this.forwardTransform,this.coordinateScratch)}unproject(t){return this.deferred?this.projectLoaded(t,!0):Qc(t,this.inverseTransform,this.coordinateScratch)}projectTo(t,r){return this.deferred?this.projectToLoaded(t,r,!1):this.projectToSync(t,r)}unprojectTo(t,r){return this.deferred?this.projectToLoaded(t,r,!0):this.unprojectToSync(t,r)}projectToSync(t,r){return this.deferred?this.loadSync().projectTo(t,r):(Ta(t,r,Math.max(t.length,this.forwardTransform.geocentricOutput?3:2)),Qc(t,this.forwardTransform,this.coordinateScratch,r))}unprojectToSync(t,r){return this.deferred?this.loadSync().unprojectTo(t,r):(Ta(t,r,Math.max(t.length,this.inverseTransform.geocentricOutput?3:2)),Qc(t,this.inverseTransform,this.coordinateScratch,r))}projectToLoaded(t,r,n){Ta(t,r,t.length);let i=t.slice();return this.load().then(o=>n?o.unprojectTo(i,r):o.projectTo(i,r))}projectLoaded(t,r){let n=t.slice();return this.load().then(i=>r?i.unproject(n):i.project(n))}projectFlat(t,r=2){return this.deferred?this.load().then(i=>i.projectFlat(t,r)):im(t,r,this.forwardTransform,this.coordinateScratch)}unprojectFlat(t,r=2){return this.deferred?this.load().then(i=>i.unprojectFlat(t,r)):im(t,r,this.inverseTransform,this.coordinateScratch)}};function eE(e){let t=oE(e.projections||[]),r=new Set;for(let n of[e.from??"WGS84",e.to??"WGS84"]){let i=ho(n,e);if(["geographic","identity"].includes(i.kind))continue;let o=t.get(om(i.projection));if(!o)throw new xn("missing-plugin","Projection plugin is not registered: "+i.projection);r.add(o)}return[...r]}var om=e=>e.toLowerCase().replace(/[\s_-]/g,"");function oE(e){let t=new Map;for(let r of e)for(let n of new Set([r.name,...r.aliases||[]].map(om))){if(!n||["longlat","latlong","latlon","lonlat","identity"].includes(n)||t.has(n))throw new Error("Duplicate or reserved projection plugin: "+n);t.set(n,r)}return t}function rE(e,t,r){let n=ho(e,r),i=t.get(om(n.projection));if(!["geographic","identity"].includes(n.kind)&&!i)throw new xn("missing-plugin","Projection plugin is not registered: "+n.projection);let o=new Set([...Qd,...i?.parameters||[]]);for(let m of Object.keys(n.parameters)){if(!o.has(m))throw new xn("missing-transform-stage","Unsupported PROJ parameter: +"+m);let p=Yv.includes(m)||i?.flags?.includes(m);if(p&&n.parameters[m]!==void 0)throw new Error("Expected a flag without a value: +"+m);if(!p&&!n.parameters[m])throw new Error("PROJ parameter requires a value: +"+m)}if(n.parameters.type&&n.parameters.type!=="crs")throw new Error("Only +type=crs is supported");let s=om(n.projection)==="fasttransversemercator"?Object.freeze({...n.parameters,approx:void 0}):n.parameters,a=i?.create({...n.ellipsoid,parameters:s,primeMeridian:n.primeMeridian});if(n.kind==="geocentric"&&(!a?.forward3D||!a?.inverse3D))throw new Error("Geocentric plugin must implement 3D operations");let c=n.datum.grids,l=c?.findIndex(m=>m.name==="null")??-1,h=c?.slice(0,l<0?void 0:l+1).map(m=>{let p=Object.prototype.hasOwnProperty.call(r.datumGrids||{},m.name)?r.datumGrids[m.name]:void 0;if(p&&typeof p.shift!="function")throw new Error("Invalid prepared datum grid: "+m.name);return Object.freeze({...m,grid:p})});for(let m of h||[]){if(m.name==="null")break;!m.optional&&!m.grid&&Ot("Required datum grid is not registered: "+m.name)}let u=h?Object.freeze({...n.datum,grids:Object.freeze(h)}):n.datum,f=Qv(n.parameters.geoidgrids,r.verticalGrids);f&&(n.kind==="geocentric"||n.kind==="identity"||n.lossy)&&Ot("Vertical grids require a non-lossy geographic or projected CRS");let d=i?i.semantics:{id:"@math.gl/geospatial/"+n.kind,version:1};return{...n,datum:u,implementation:a,verticalGrid:f,algorithm:d}}function J1(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.z)}function nE(e,t){if(e==="enu")return;let r=[0,0,0],n=[0,0,0];for(let i=0;i<3;i++){let o=e[i],s="ew".includes(o)?0:"ns".includes(o)?1:2;r[t?i:s]=t?s:i,n[t?i:s]="wsd".includes(o)?-1:1}return i=>{let o=i.x,s=i.y,a=i.z;i.x=n[0]*(r[0]===0?o:r[0]===1?s:a),i.y=n[1]*(r[1]===0?o:r[1]===1?s:a),i.z=n[2]*(r[2]===0?o:r[2]===1?s:a)}}function iE(e,t,r){let n=e.storedAxis||(r?e.axis:"enu"),i=t.storedAxis||(r?t.axis:"enu"),o=nE(n,!1),s=nE(i,!0),a=e.implementation&&co(e.implementation,!0,e.kind==="geocentric"),c=t.implementation&&co(t.implementation,!1,t.kind==="geocentric"),l=X1(e.datum,t.datum),h=e.lossy||t.lossy,u=e.kind==="geocentric",f=e.kind==="geographic"?e.angularUnit:e.toMeter,d=t.kind==="geographic"?t.angularUnit:t.toMeter,m=u?1:e.verticalUnit,p=t.kind==="geocentric"?d:t.verticalUnit,g=e.primeMeridian,y=t.primeMeridian,_=t.kind==="geographic"?t.longitudeWrap:void 0,M;if(!l&&!e.verticalGrid&&!t.verticalGrid&&!h&&!o&&!s&&!g&&!y&&e.verticalUnit===1&&t.verticalUnit===1&&_===void 0){let T=Object.freeze({inputScale:f,outputScale:d});e.kind==="geographic"&&t.kind==="projected"&&(M=t.implementation?.createForwardFlat?.(T)),e.kind==="projected"&&t.kind==="geographic"&&(M=e.implementation?.createInverseFlat?.(T))}let x=!!(e.verticalGrid||t.verticalGrid)||e.kind==="geocentric"||/[ud]/.test(n.slice(0,2))||/[ud]/.test(i.slice(0,2)),v=[];return o&&v.push("input-axis"),h&&v.push("discard-height"),f!==1&&v.push("input-scale"),a&&v.push("source-inverse"),m!==1&&v.push("input-height-scale"),v.push("geographic-domain-check"),g&&v.push("source-prime-meridian"),e.verticalGrid&&v.push("source-vertical-grid"),l&&v.push("datum"),t.verticalGrid&&v.push("target-vertical-grid"),y&&v.push("target-prime-meridian"),_!==void 0&&v.push("longitude-wrap"),c&&v.push("target-forward"),d!==1&&v.push("output-scale"),p!==1&&v.push("output-height-scale"),h&&v.push("restore-height"),s&&v.push("output-axis"),{description:Object.freeze({inputAxis:n,outputAxis:i,requiresInputZ:x,geocentricOutput:t.kind==="geocentric",stages:Object.freeze(v)}),flat:M,requiresInputZ:x,geocentricOutput:t.kind==="geocentric",run(T){if(!J1(T))throw new Error("Coordinates must contain finite x, y and optional z values");o?.(T);let S=T.z;if(h&&(T.z=0),f!==1&&(T.x*=f,T.y*=f,u&&(T.z*=f)),a?.(T),m!==1&&(T.z*=m),Math.abs(T.y)>Math.PI/2||!J1(T))throw new Error("Coordinate is outside the geographic domain");if(T.x+=g,e.verticalGrid&&(T.z+=e.verticalGrid(T.x,T.y)),l?.(T),t.verticalGrid&&(T.z-=t.verticalGrid(T.x,T.y)),T.x-=y,_!==void 0&&(T.x=_+ve(T.x-_)),c?.(T),d!==1&&(T.x/=d,T.y/=d),p!==1&&(T.z/=p),h&&(T.z=S),s?.(T),!J1(T))throw new Error("Projection produced non-finite coordinates")}}}function Qc(e,t,r,n){if(e.length<2)throw new Error("Coordinates must contain finite x, y and optional z values");if(e.length<3&&t.requiresInputZ)throw new Error("This transform requires three ordinates");let i=Math.max(e.length,t.geocentricOutput?3:2),o=r.acquire();try{if(o.x=e[0],o.y=e[1],o.z=e.length>=3?e[2]:0,t.run(o),n)return jh(e,n,o,i);let s=e.slice();return s[0]=o.x,s[1]=o.y,(e.length>=3||t.geocentricOutput)&&(s[2]=o.z),s}finally{r.release(o)}}function im(e,t,r,n){if(!(e instanceof Float32Array||e instanceof Float64Array))throw new Error("In-place projection requires a Float32Array or Float64Array");if(!Number.isSafeInteger(t)||t<2||e.length%t!==0)throw new Error("Dimension must be an integer >= 2 and divide the typed array length");if(t<3&&(r.requiresInputZ||r.geocentricOutput))throw new Error("This transform requires a dimension of at least 3");if(r.flat)return r.flat(e,t),e;let i=n.acquire();try{let o=e instanceof Float32Array;for(let s=0;s<e.length;s+=t){if(i.x=e[s],i.y=e[s+1],i.z=t>=3?e[s+2]:0,r.run(i),o&&(Math.abs(i.x)>34028234663852886e22||Math.abs(i.y)>34028234663852886e22||t>=3&&Math.abs(i.z)>34028234663852886e22))throw new Error("Projected coordinate exceeds Float32 range");e[s]=i.x,e[s+1]=i.y,t>=3&&(e[s+2]=i.z)}return e}finally{n.release(i)}}var sm=class{constructor(t){this.sample=t,this.result=[0,0,0],this.samples=Array.from({length:4},()=>[0,0,0]),this.coarse=[0,0,0],this.fine=[0,0,0]}evaluate(t,r,n=1e-6){if(!this.difference(t,this.coarse)||!this.difference(t/2,this.fine))return!1;let i=n*Math.max(r,Math.abs(this.fine[0]),Math.abs(this.fine[1]),Math.abs(this.fine[2]));for(let o=0;o<3;o++)if(Math.abs(this.coarse[o]-this.fine[o])>i||(this.fine[o]+=(this.fine[o]-this.coarse[o])/15,!Number.isFinite(this.fine[o])))return!1;for(let o=0;o<3;o++)this.result[o]=this.fine[o];return!0}difference(t,r){let[n,i,o,s]=this.samples;if(!this.sample(-2*t,n)||!this.sample(-t,i)||!this.sample(t,o)||!this.sample(2*t,s))return!1;for(let a=0;a<3;a++)if(r[a]=(n[a]-s[a]+8*(o[a]-i[a]))/(12*t),!Number.isFinite(r[a]))return!1;return!0}};var $h=Math.PI/180,sE=ho("WGS84").ellipsoid;function Q1(e){if(e.length!==3||e.some(t=>!Number.isFinite(t)||t<=0))throw new Error("Invalid CRS rendering scale");return e}function aE(e,t,r,n){if(e.kind==="geocentric")return Q1([e.toMeter,e.toMeter,e.toMeter]);if(e.kind==="identity")return Q1([...r].map(m=>/[ud]/.test(m)?e.verticalUnit:e.toMeter));let i=[0,0,0],o=[0,0,0],s=[0,0,0],a=[0,0,0],c=Array.from({length:3},()=>[0,0,0]),l=0,h=0,u=0,f=!1,d=new sm((m,p)=>{for(let _=0;_<3;_++)o[_]=i[_];o[l]+=m,t.unprojectTo(o,a);let g=a[0]-s[0],y=Math.abs(g)<=180?g:((g+180)%360+360)%360-180;return Math.abs(a[1])>=90?!1:(p[0]=y*h,p[1]=(a[1]-s[1])*u,p[2]=a[2]-s[2],p.every(Number.isFinite))});return m=>{if(f||m.length<2)return null;f=!0;let p;try{if(i[0]=m[0],i[1]=m[1],i[2]=m[2]??0,!i.every(Number.isFinite))return null;t.unprojectTo(i,s);let g=s[1]*$h,y=sE.semiMajorAxis,_=sE.eccentricitySquared,M=1-_*Math.sin(g)**2;if(h=y*Math.cos(g)/Math.sqrt(M)*$h,u=y*(1-_)/M**1.5*$h,!(h>y*$h*1e-8)||!(u>0))return null;let x=((s[0]-n+180)%360+360)%360-180;if((e.kind==="geographic"?e.longitudeWrap!==void 0:!Object.prototype.hasOwnProperty.call(e.parameters,"over"))&&Math.abs(x)+2/h>=180||Math.abs(s[1])+2/u>=90)return null;for(l=0;l<3;l++){let T=r[l],S=/[ud]/.test(T)?e.verticalUnit:e.kind==="geographic"?(/[ew]/.test(T)?h:u)*e.angularUnit/$h:e.toMeter;if(!d.evaluate(1/S,S))return null;for(let E=0;E<3;E++)c[l][E]=d.result[E]}if(p=c.map(T=>Math.hypot(...T)),e.kind==="projected"){let T=c[r.search(/[ew]/)],S=c[r.search(/[ns]/)],E=Math.abs(T[0]*S[1]-T[1]*S[0])/e.toMeter**2;p[r.search(/[ud]/)]=e.verticalUnit*Math.sqrt(E)}}catch{return null}finally{f=!1}return Q1(p)}}cg();var cE={degrees:Math.PI/180,radians:1,gradians:Math.PI/200},iB={...Object.fromEntries(Object.values(wh).map(e=>[e.name,e.metersPerUnit]))};async function fE(e,t,r,n={},i=!1,o){let s=typeof t=="string"?t:JSON.parse(JSON.stringify(t)),a={enforceAxis:r.enforceAxis,mode:r.mode,...n,converters:n.converters&&[...n.converters]},c=o?await o(s,{...r,...a}):s,l=ho(c,{...r,...a}),h=await e.createProjectionAsync({...a,from:"WGS84",to:c}),u=l.storedAxis||(a.enforceAxis?l.axis:"enu"),f=uE(l.kind==="geographic"?l.angularUnit:l.toMeter,l.kind==="geographic"),d=uE(l.verticalUnit,!1),m=[...u].map(E=>l.kind!=="geocentric"&&/[ud]/.test(E)?d:f),p=h.targetProfile;if(!p)throw new Error("Projection must define a rendering profile for CRS retrieval");let g=(h.targetLongitudeOrigin+l.primeMeridian)*180/Math.PI,y=aB(p,l,u),_=sB(p.normalize),M=aE(l,h,u,g),x=[...new Set(["WGS84",...a.converters||[]])];if(x.some(E=>typeof E!="string"||!E.trim()))throw new Error("Converter source CRS must be a nonempty string");let v=await Promise.all(x.map(async E=>{if(E==="WGS84")return[E,lE(h,_)];let[N,O]=await Promise.all([e.createProjectionAsync({...a,from:E,to:c}),e.createProjectionAsync({...a,from:"WGS84",to:E})]);return[E,lE(N,oB(O,_))]})),T=Object.assign(Object.create(null),Object.fromEntries(v)),S={coordinateFrame:l.kind,projection:l.projection,parameters:l.parameters,ellipsoid:{semiMajorAxis:l.ellipsoid.semiMajorAxis,semiMinorAxis:l.ellipsoid.semiMinorAxis},axis:u,xUnit:m[0],yUnit:m[1],zUnit:m[2],areaOfUse:l.areaOfUse,lossy:l.lossy};return{...S,signature:i&&typeof c=="string"&&!a.enforceAxis&&!l.lossy?c:q2(S),renderingBounds:y,renderingScale:M,getRenderingScale:E=>typeof M=="function"?M(E):M,converter:T}}function lE(e,t){return{from:hE(e.project.bind(e),e.projectTo.bind(e)),to:hE(e.unproject.bind(e),e.unprojectTo.bind(e)),normalize:t}}function oB(e,t){function r(n,i){i!==void 0&&Ta(n,i,n.length);let o=e.unproject(Array.from(n)),[s,a,c]=o;return t(o,o),o[0]===s&&o[1]===a&&o[2]===c?i===void 0?Array.from(n):jh(n,i,{x:n[0],y:n[1],z:n[2]??0},n.length):i===void 0?e.project(o):e.projectTo(o,i)}return r}function hE(e,t){function r(n,i){return i===void 0?e(Array.isArray(n)?n:Array.from(n)):t(n,i)}return r}function sB(e){function t(r,n){let i=n??new Array(r.length);Ta(r,i,r.length);let o=r[0],s=r[1],a=r[2]??0;if(r.length<2||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(a))throw new Error("Normalization requires finite longitude, latitude and altitude");let c={x:o,y:s,z:a};return e?.(c),jh(r,i,c,r.length)}return t}function aB(e,t,r){let n=t.kind==="geographic"?t.angularUnit:t.toMeter,i=[n,n,t.kind==="geocentric"?t.toMeter:t.verticalUnit],o=e.bounds,s=[...r].map(a=>{let c=/[ew]/.test(a)?0:/[ns]/.test(a)?1:2,l=o[0][c]/i[c],h=o[1][c]/i[c];return/[wsd]/.test(a)?[-h,-l]:[l,h]});return[[s[0][0],s[1][0],s[2][0]],[s[0][1],s[1][1],s[2][1]]]}function uE(e,t){let r=t?cE:iB,n=Object.keys(r).find(i=>r[i]===e)||"custom";return t?{name:n,degreesPerUnit:e/cE.degrees}:{name:n,metersPerUnit:e}}function dE(e){return{...e,projections:e.projections&&[...e.projections],parsers:e.parsers&&[...e.parsers],datumCatalogs:e.datumCatalogs&&[...e.datumCatalogs],aliases:e.aliases&&JSON.parse(JSON.stringify(e.aliases)),datumGrids:e.datumGrids&&{...e.datumGrids},verticalGrids:e.verticalGrids&&{...e.verticalGrids}}}function Yh(e){return!!(e.projections||e.parsers||e.datumCatalogs||e.aliases||e.datumGrids||e.verticalGrids||e.resolver)}Pc();async function pE(e){let t={...e,from:mE(e.from??"WGS84"),to:mE(e.to??"WGS84")},[r,n]=await Promise.all([am(t.from,t),am(t.to,t)]);return{...t,from:r,to:n}}async function am(e,t){let r=Wh(e,t),n=$1(r.definition,t),i=typeof e=="string"||"type"in e?void 0:"crs"in e?e.crs:e,o=n===r.definition&&i?i.representation:tr(n);if(o!=="identifier"||t.parsers?.some(h=>h.canParse(n)))return e;let s=await t.resolver.resolve({state:"explicit",provenance:i?.provenance??"unknown",definition:n,representation:o}),a=Wh(s.input,t).definition;if(!i)return a;let c=e,l={...i,definition:a,representation:tr(a),alternatives:[{definition:i.definition,representation:i.representation},...i.alternatives??[]]};return"crs"in c?{...c,crs:l}:l}function mE(e){return typeof e=="string"?e:JSON.parse(JSON.stringify(e))}var cm=class{constructor(t={}){this.options=dE(t),this.useDefinitionSignature=!Yh(t)}getCRS(t,r={}){return fE(this,t,this.options,r,this.useDefinitionSignature,this.options.resolver?am:void 0)}createProjection(t={}){return new Hh({...this.options,...t})}async createProjectionAsync(t={}){let r={...this.options,...t};return Hh.create(r.resolver?await pE(r):r)}};kc();Ee();Ht();ne();Ie();var ty={name:"merc",semantics:{id:"@math.gl/geospatial/merc",version:1},aliases:["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","Mercator_Variant_A"],parameters:["lon_0","lat_ts","k","k_0","x_0","y_0"],create({semiMajorAxis:e,eccentricitySquared:t,parameters:r,primeMeridian:n=0}){let i=Math.sqrt(t),o=Object.prototype.hasOwnProperty.call(r,"over"),s=tt(r,"lon_0",0)*Me,a=tt(r,"x_0",0),c=tt(r,"y_0",0),l=tt(r,"k_0",tt(r,"k",1));if(Object.prototype.hasOwnProperty.call(r,"lat_ts")){let m=Rh(r,"lat_ts");l=Math.cos(m)/Math.sqrt(1-t*Math.sin(m)**2)}if(l<=0)throw new Error("Mercator scale must be positive");let h=e*l,u=Math.atan(Math.sinh(Math.PI)),f=h*Math.PI,d=h*(Math.PI-i*Math.atanh(i*Math.sin(u)));return{longitudeOrigin:s,getRenderingProfile(m){if(m){let g=m[1]<=-90||m[3]>=90,y=[m[0],g?Math.max(-u*180/Math.PI,Math.min(u*180/Math.PI,m[1])):m[1],m[2],g?Math.max(-u*180/Math.PI,Math.min(u*180/Math.PI,m[3])):m[3]],_=M=>c+h*(Math.asinh(Math.tan(M))-i*Math.atanh(i*Math.sin(M)));return Ke(M=>re(At([a,a],Ct(gr(M,s,o),h)),[_(M[0][1]),_(M[1][1])]),y,s,n,o)}let p=[[a-f,c-d,0],[a+f,c+d,0]];return{bounds:p,normalize:Ke(()=>p,yn(K(s-Math.PI,-u,s+Math.PI,u),n),s,n,o).normalize}},...ai(m=>{let p=m.x,g=m.y;if(Math.abs(g)>=Math.PI/2)throw new Error("Mercator is undefined at the poles");let y=Math.asinh(Math.tan(g));m.x=a+h*ve(p-s,o),m.y=c+h*(i===0?y+0:y-i*Math.atanh(i*Math.sin(g)))},m=>{let p=m.x,y=(m.y-c)/h,_=Math.atan(Math.sinh(y));if(i===0){m.x=ve(s+(p-a)/h,o),m.y=_+0;return}for(let M=0;M<30;M++){let x=Math.atan(Math.sinh(y+i*Math.atanh(i*Math.sin(_))));if(Math.abs(x-_)<1e-13){m.x=ve(s+(p-a)/h,o),m.y=x;return}_=x}throw new Error("Mercator inverse did not converge")})}}};wa();Ee();Ht();ne();Ie();var ey={name:"eqc",semantics:{id:"@math.gl/geospatial/eqc",version:1},aliases:["Equirectangular","Equidistant_Cylindrical","Equidistant_Cylindrical_Spherical"],parameters:["lon_0","lat_0","lat_ts","x_0","y_0"],create({semiMajorAxis:e,parameters:t,primeMeridian:r=0}){let n=Object.prototype.hasOwnProperty.call(t,"over"),i=tt(t,"lon_0",0)*Me,o=Rh(t,"lat_0"),s=Math.cos(Rh(t,"lat_ts")),a=tt(t,"x_0",0),c=tt(t,"y_0",0),l=e*Math.abs(s)*Math.PI;return{longitudeOrigin:i,getRenderingProfile(h){if(h)return Ke(f=>re(At([a,a],Ct(gr(f,i,n),e*s)),[c+e*(f[0][1]-o),c+e*(f[1][1]-o)]),h,i,r,n);let u=[[a-l,c+e*(-Math.PI/2-o),0],[a+l,c+e*(Math.PI/2-o),0]];return{bounds:u,normalize:Ke(()=>u,yn(K(i-Math.PI,-(Math.PI/2),i+Math.PI,Math.PI/2),r),i,r,n).normalize}},...jn(h=>{h.x=a+e*s*ve(h.x-i,n),h.y=c+e*(h.y-o)},h=>{h.x=ve(i+(h.x-a)/(e*s),n),h.y=o+(h.y-c)/e})}}};Ie();Ht();ne();kc();wn();Wc();Dh();fe();Ad();Ae();function cB(e){if(e.k0||(e.k0=1),e.x0=e.x0||0,e.y0=e.y0||0,e.long0=e.long0||0,!(Math.abs(e.lat1+e.lat2)<1e-10)){var t=e.b/e.a;e.e=Math.sqrt(1-t*t);var r=Math.sin(e.lat1),n=Math.cos(e.lat1),i=nn(e.e,r,n),o=Lr(e.e,e.lat1,r),s=Math.sin(e.lat2),a=Math.cos(e.lat2),c=nn(e.e,s,a),l=Lr(e.e,e.lat2,s),h=Lr(e.e,e.lat0,Math.sin(e.lat0));Math.abs(e.lat1-e.lat2)>1e-10?e.ns=Math.log(i/c)/Math.log(o/l):e.ns=r,Number.isNaN(e.ns)&&(e.ns=r),e.f0=i/(e.ns*Math.pow(o,e.ns)),e.rh=Math.abs(Math.abs(e.lat0)-U)<1e-10?0:e.a*e.f0*Math.pow(h,e.ns)}}function gE(e,t){var r=t.x,n=t.y,i=Math.abs(Math.abs(n)-U),o,s;if(i>1e-10)o=e.sphere?1/Math.tan(Math.PI/4+n/2):Lr(e.e,n,Math.sin(n)),s=e.a*e.f0*Math.pow(o,e.ns);else{if(i=n*e.ns,i<=0)return null;s=0}var a=e.ns*G(r-e.long0,e.over);return t.x=e.k0*(s*Math.sin(a))+e.x0,t.y=e.k0*(e.rh-s*Math.cos(a))+e.y0,t}function yE(e,t){var r,n,i,o,s,a=(t.x-e.x0)/e.k0,c=e.rh-(t.y-e.y0)/e.k0;e.ns>0?(r=Math.sqrt(a*a+c*c),n=1):(r=-Math.sqrt(a*a+c*c),n=-1);var l=0;if(r!==0&&(l=Math.atan2(n*a,n*c)),r!==0||e.ns>0){if(n=1/e.ns,i=Math.pow(r/(e.a*e.f0),n),o=Sa(e.e,i),o===-9999)return null}else o=-U;return s=G(l/e.ns+e.long0,e.over),t.x=s,t.y=o,t}function wE(e){let t={...e,ns:0,f0:0,rh:0};return cB(t),t}var ry={name:"lcc",aliases:["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"],parameters:[...ar,...lo,"lat_1","lat_2"],create(e){let t=er(e);Vc(t,e.parameters);let r=wE(t),n=Xe("lcc",r,gE,yE),i={...ai(o=>{let s=o.y;if(Math.abs(s)===Math.PI/2&&s*r.ns<0)throw new Error("Lambert conformal conic is undefined at the opposite pole");n.forwardInPlace(o)},n.inverseInPlace)};return Pt(i,K(t.long0-Math.PI,r.ns>0?-Math.PI/3:-Math.PI/2,t.long0+Math.PI,r.ns>0?Math.PI/2:Math.PI/3),o=>zc(i.forward,o,t.long0,r.ns,r.x0,r.y0+r.k0*r.rh,t.over),t.primeMeridian,t.over)}};kc();Ie();Ht();ne();wn();Wc();function Fr(e,t){var r;return e>1e-7?(r=e*t,(1-e*e)*(t/(1-r*r)-.5/e*Math.log((1-r)/(1+r)))):2*t}fe();Ae();function lm(e,t){var r=1-(1-e*e)/(2*e)*Math.log((1-e)/(1+e));let n=4*Number.EPSILON*r;if(Math.abs(t)>r+n)return NaN;if(Math.abs(Math.abs(t)-r)<=n)return t<0?-1*U:U;for(var i=Math.asin(.5*t),o,s,a,c,l=0;l<30;l++)if(s=Math.sin(i),a=Math.cos(i),c=e*s,o=Math.pow(1-c*c,2)/(2*a)*(t/(1-e*e)-s/(1-c*c)+.5/e*Math.log((1-c)/(1+c))),i+=o,Math.abs(o)<=1e-10)return i;return NaN}function lB(e){Math.abs(e.lat1+e.lat2)<1e-10||(e.temp=e.b/e.a,e.es=1-Math.pow(e.temp,2),e.e3=Math.sqrt(e.es),e.sin_po=Math.sin(e.lat1),e.cos_po=Math.cos(e.lat1),e.t1=e.sin_po,e.con=e.sin_po,e.ms1=nn(e.e3,e.sin_po,e.cos_po),e.qs1=Fr(e.e3,e.sin_po),e.sin_po=Math.sin(e.lat2),e.cos_po=Math.cos(e.lat2),e.t2=e.sin_po,e.ms2=nn(e.e3,e.sin_po,e.cos_po),e.qs2=Fr(e.e3,e.sin_po),e.sin_po=Math.sin(e.lat0),e.cos_po=Math.cos(e.lat0),e.t3=e.sin_po,e.qs0=Fr(e.e3,e.sin_po),Math.abs(e.lat1-e.lat2)>1e-10?e.ns0=(e.ms1*e.ms1-e.ms2*e.ms2)/(e.qs2-e.qs1):e.ns0=e.con,e.c=e.ms1*e.ms1+e.ns0*e.qs1,e.rh=e.a*Math.sqrt(e.c-e.ns0*e.qs0)/e.ns0)}function _E(e,t){var r=t.x,n=t.y;e.sin_phi=Math.sin(n),e.cos_phi=Math.cos(n);var i=Fr(e.e3,e.sin_phi),o=e.a*Math.sqrt(e.c-e.ns0*i)/e.ns0,s=e.ns0*G(r-e.long0,e.over),a=o*Math.sin(s)+e.x0,c=e.rh-o*Math.cos(s)+e.y0;return t.x=a,t.y=c,t}function ME(e,t){var r,n,i,o,s,a;if(t.x-=e.x0,t.y=e.rh-t.y+e.y0,e.ns0>=0?(r=Math.sqrt(t.x*t.x+t.y*t.y),i=1):(r=-Math.sqrt(t.x*t.x+t.y*t.y),i=-1),o=0,r!==0&&(o=Math.atan2(i*t.x,i*t.y)),i=r*e.ns0/e.a,e.sphere){let c=(e.c-i*i)/(2*e.ns0);if(Math.abs(c)>1+8*Number.EPSILON)return null;a=Math.asin(Math.max(-1,Math.min(1,c)))}else{n=(e.c-i*i)/e.ns0;let c=Fr(e.e3,1);a=Math.abs(Math.abs(n)-c)<=16*Number.EPSILON*c?Math.sign(n)*Math.PI/2:lm(e.e3,n)}return s=G(o/e.ns0+e.long0,e.over),t.x=s,t.y=a,t}function bE(e){let t={...e,temp:0,e3:0,sin_po:0,cos_po:0,t1:0,con:0,ms1:0,qs1:0,t2:0,ms2:0,qs2:0,t3:0,qs0:0,ns0:0,c:0,rh:0,sin_phi:0,cos_phi:0};return lB(t),t}var ny={name:"aea",aliases:["Albers_Conic_Equal_Area","Albers_Equal_Area","Albers"],parameters:[...ar,"lat_1","lat_2"],create(e){let t=er(e);Vc(t,e.parameters);let r=bE(t),n={...Xe("aea",r,_E,ME,ai)};return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>zc(n.forward,i,t.long0,r.ns0,r.x0,r.y0+r.rh,t.over),t.primeMeridian,t.over)}};kc();Ie();Ht();ne();wn();qc();ba();jc();Wc();fe();Ae();Oh();function uo(e){return Math.abs(e)<=U?e:e-Qo(e)*Math.PI}function hB(e){Math.abs(e.lat1+e.lat2)<1e-10||(e.temp=e.b/e.a,e.es=1-Math.pow(e.temp,2),e.e=Math.sqrt(e.es),e.en=Ni(e.es),e.sin_phi=Math.sin(e.lat1),e.cos_phi=Math.cos(e.lat1),e.ms1=nn(e.e,e.sin_phi,e.cos_phi),e.ml1=rr(e.lat1,Math.sin(e.lat1),Math.cos(e.lat1),e.en),Math.abs(e.lat1-e.lat2)<1e-10?e.ns=e.sin_phi:(e.sin_phi=Math.sin(e.lat2),e.cos_phi=Math.cos(e.lat2),e.ms2=nn(e.e,e.sin_phi,e.cos_phi),e.ml2=rr(e.lat2,Math.sin(e.lat2),Math.cos(e.lat2),e.en),e.ns=(e.ms1-e.ms2)/(e.ml2-e.ml1)),e.g=e.ml1+e.ms1/e.ns,e.ml0=rr(e.lat0,Math.sin(e.lat0),Math.cos(e.lat0),e.en),e.rh=e.a*(e.g-e.ml0))}function xE(e,t){var r=t.x,n=t.y,i;if(e.sphere)i=e.a*(e.g-n);else{var o=rr(n,Math.sin(n),Math.cos(n),e.en);i=e.a*(e.g-o)}var s=e.ns*G(r-e.long0,e.over),a=e.x0+i*Math.sin(s),c=e.y0+e.rh-i*Math.cos(s);return t.x=a,t.y=c,t}function SE(e,t){t.x-=e.x0,t.y=e.rh-t.y+e.y0;var r,n,i,o;e.ns>=0?(n=Math.sqrt(t.x*t.x+t.y*t.y),r=1):(n=-Math.sqrt(t.x*t.x+t.y*t.y),r=-1);var s=0;if(n!==0&&(s=Math.atan2(r*t.x,r*t.y)),e.sphere)return o=G(e.long0+s/e.ns,e.over),i=uo(e.g-n/e.a),t.x=o,t.y=i,t;var a=e.g-n/e.a;return i=Bi(a,e.es,e.en),o=G(e.long0+s/e.ns,e.over),t.x=o,t.y=i,t}function vE(e){let t={...e,temp:0,en:[],sin_phi:0,cos_phi:0,ms1:0,ml1:0,ns:0,ms2:0,ml2:0,g:0,ml0:0,rh:0};return hB(t),t}var iy={name:"eqdc",aliases:["Equidistant_Conic"],parameters:[...ar,"lat_1","lat_2"],create(e){let t=er(e);Vc(t,e.parameters);let r=vE(t),n=Xe("eqdc",r,xE,SE,ai);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>zc(n.forward,i,t.long0,r.ns,r.x0,r.y0+r.rh,t.over),t.primeMeridian,t.over)}};function ss(e,t){let r=Math.abs(Math.sin(t)),n=Math.cos(t),i=n*n/(1+r);if(e===0)return 2*i;let o=e*e;return i*(1+o*r)/(1-o*r*r)+(1-o)/e*Math.atanh(e*i/(1-o*r))}function oy(e,t,r){if(r===0||e===0)return r;let n=ss(e,r)/t;return Math.atan2(Math.sign(r)*(1-n),Math.sqrt(n*(2-n)))}function sy(e,t,r){if(e===0||r===0||Math.abs(r)===Math.PI/2)return r;let n=Math.abs(Math.sin(r)),i=Math.cos(r),o=t*i*i/(1+n),s=Math.abs(r),a=e*e,c=0,l=Math.PI/2;for(let h=0;h<48;h++){let u=Math.sin(s),f=1-a*u*u,d=2*(1-a)*Math.cos(s)/(f*f),m=ss(e,s)-o,p=m/d;if(Math.abs(p)<2e-15)return Math.sign(r)*s;m>0?c=s:l=s;let g=s+p;s=g>c&&g<l?g:(c+l)/2}throw new Error("Authalic latitude inverse did not converge")}rs();ns();wn();Ae();fe();Lh();var li=1,Fi=2,Hn=3,Ur=4;function uB(e){var t=Math.abs(e.lat0);if(Math.abs(t-U)<1e-10?e.mode=e.lat0<0?li:Fi:Math.abs(t)<1e-10?e.mode=Hn:e.mode=Ur,e.es>0){var r;switch(e.qp=Fr(e.e,1),e.mmf=.5/(1-e.es),e.mode){case Fi:e.dd=1;break;case li:e.dd=1;break;case Hn:e.rq=Math.sqrt(.5*e.qp),e.dd=1/e.rq,e.xmf=1,e.ymf=.5*e.qp;break;case Ur:e.rq=Math.sqrt(.5*e.qp),r=Math.sin(e.lat0),e.sinb1=Fr(e.e,r)/e.qp,e.cosb1=Math.sqrt(1-e.sinb1*e.sinb1),e.dd=Math.cos(e.lat0)/(Math.sqrt(1-e.es*r*r)*e.rq*e.cosb1),e.xmf=e.rq,e.ymf=e.xmf/e.dd,e.xmf*=e.dd;break}}else e.mode===Ur&&(e.sinph0=Math.sin(e.lat0),e.cosph0=Math.cos(e.lat0))}function EE(e,t){var r,n,i,o,s,a,c,l,h,u,f=t.x,d=t.y;if(f=G(f-e.long0,e.over),e.sphere){if(s=Math.sin(d),u=Math.cos(d),i=Math.cos(f),e.mode===Ur||e.mode===Hn){if(n=e.mode===Hn?1+u*i:1+e.sinph0*s+e.cosph0*u*i,n<=1e-10)return null;n=Math.sqrt(2/n),r=n*u*Math.sin(f),n*=e.mode===Hn?s:e.cosph0*s-e.sinph0*u*i}else if(e.mode===Fi||e.mode===li){if(e.mode===Fi&&(i=-i),Math.abs(d+e.lat0)<1e-10)return null;n=$t-d*.5,n=2*(e.mode===li?Math.cos(n):Math.sin(n)),r=n*Math.sin(f),n*=i}}else{if(c=0,l=0,h=0,i=Math.cos(f),o=Math.sin(f),s=Math.sin(d),a=Fr(e.e,s),e.mode===Ur||e.mode===Hn){c=a/e.qp;let m=ss(e.e,d)/e.qp;l=Math.sqrt(m*(2-m))}switch(e.mode){case Ur:h=1+e.sinb1*c+e.cosb1*l*i;break;case Hn:h=1+l*i;break;case Fi:h=U+d,a=d>=0?ss(e.e,d):2*e.qp-ss(e.e,d);break;case li:h=d-U,a=d<=0?ss(e.e,d):2*e.qp-ss(e.e,d);break}if(Math.abs(h)<1e-10)return null;switch(e.mode){case Ur:case Hn:h=Math.sqrt(2/h),e.mode===Ur?n=e.ymf*h*(e.cosb1*c-e.sinb1*l*i):(h=Math.sqrt(2/(1+l*i)),n=h*c*e.ymf),r=e.xmf*h*l*o;break;case Fi:case li:a>=0?(h=Math.sqrt(a),r=h*o,n=i*(e.mode===li?h:-h)):r=n=0;break}}return t.x=e.a*r+e.x0,t.y=e.a*n+e.y0,t}function TE(e,t){t.x-=e.x0,t.y-=e.y0;var r=t.x/e.a,n=t.y/e.a,i,o,s,a,c,l,h;if(e.sphere){var u=0,f,d=0;if(f=Math.sqrt(r*r+n*n),o=f*.5,o>1+8*Number.EPSILON)return null;switch(o=2*Math.asin(Math.min(1,o)),(e.mode===Ur||e.mode===Hn)&&(d=Math.sin(o),u=Math.cos(o)),e.mode){case Hn:o=Math.abs(f)<=1e-10?0:ci(0,1,d,u,r,n,f),r*=d,n=u*f;break;case Ur:o=Math.abs(f)<=1e-10?e.lat0:ci(e.sinph0,e.cosph0,d,u,r,n,f),r*=d*e.cosph0,n=(u-Math.sin(o)*e.sinph0)*f;break;case Fi:n=-n,o=U-o;break;case li:o-=U;break}i=n===0&&(e.mode===Hn||e.mode===Ur)?0:Math.atan2(r,n)}else{if(h=0,e.mode===Ur||e.mode===Hn){if(r/=e.dd,n*=e.dd,l=Math.sqrt(r*r+n*n),l<1e-10)return t.x=e.long0,t.y=e.lat0,t;let m=.5*l/e.rq;if(m>1+8*Number.EPSILON)return null;a=2*Math.asin(Math.min(1,m)),s=Math.cos(a),a=Math.sin(a);let p=ci(e.mode===Ur?e.sinb1:0,e.mode===Ur?e.cosb1:1,a,s,r,n,l);o=sy(e.e,e.qp,p),r*=a,e.mode===Ur?(h=s*e.sinb1+n*a*e.cosb1/l,c=e.qp*h,n=l*e.cosb1*s-n*e.sinb1*a):(h=n*a/l,c=e.qp*h,n=l*s)}else if(e.mode===Fi||e.mode===li){if(e.mode===Fi&&(n=-n),c=r*r+n*n,!c)return t.x=e.long0,t.y=e.lat0,t;h=1-c/e.qp,e.mode===li&&(h=-h)}if(i=Math.atan2(r,n),Math.abs(h)>1+8*Number.EPSILON)return null;if(e.mode===Fi||e.mode===li){let m=Math.max(0,Math.min(2,c/e.qp)),p=Math.atan2(h,Math.sqrt(m*(2-m)));o=sy(e.e,e.qp,p)}}return t.x=G(e.long0+i,e.over),t.y=o,t}function IE(e){let t={...e,mode:0,qp:0,mmf:0,dd:0,rq:0,xmf:0,ymf:0,sinb1:0,cosb1:0,sinph0:0,cosph0:0};return uB(t),t}var ay={name:"laea",aliases:["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area"],parameters:ar,create(e){let t=er(e),r=IE(t);return rn(Zo(t,Xe("laea",r,EE,TE)),t,Math.PI*179/180,(n,i)=>vS(t,t.sphere?1:r.xmf||Math.sqrt(r.qp/2),t.sphere?1:r.ymf||Math.sqrt(r.qp/2),n,i,t.sphere?t.lat0:oy(t.e,r.qp,t.lat0),t.sphere?o=>o:o=>oy(t.e,r.qp,o)))}};NS();rs();ns();wn();Lh();function hm(e,t){return Math.pow((1-e)/(1+e),t)}Ae();var fB=20;function dB(e){var t=Math.sin(e.lat0),r=Math.cos(e.lat0);r*=r,e.rc=Math.sqrt(1-e.es)/(1-e.es*t*t),e.C=Math.sqrt(1+e.es*r*r/(1-e.es)),e.phic0=Math.asin(t/e.C),e.ratexp=.5*e.C*e.e,e.K=Math.tan(.5*e.phic0+$t)/(Math.pow(Math.tan(.5*e.lat0+$t),e.C)*hm(e.e*t,e.ratexp))}function AE(e,t){var r=t.x,n=t.y;return t.y=2*Math.atan(e.K*Math.pow(Math.tan(.5*n+$t),e.C)*hm(e.e*Math.sin(n),e.ratexp))-U,t.x=e.C*r,t}function PE(e,t){for(var r=1e-14,n=t.x/e.C,i=t.y,o=Math.pow(Math.tan(.5*i+$t)/e.K,1/e.C),s=fB;s>0&&(i=2*Math.atan(o*hm(e.e*Math.sin(t.y),-.5*e.e))-U,!(Math.abs(i-t.y)<r));--s)t.y=i;return s?(t.x=n,t.y=i,t):null}function RE(e){let t={...e,rc:0,C:0,phic0:0,ratexp:0,K:0};return dB(t),t}fe();Ma();function mB(e){e.rc&&(e.sinc0=Math.sin(e.phic0),e.cosc0=Math.cos(e.phic0),e.R2=2*e.rc)}function CE(e,t){var r,n,i,o;return t.x=G(t.x-e.long0,e.over),AE(e,t),r=Math.sin(t.y),n=Math.cos(t.y),i=Math.cos(t.x),o=e.k0*e.R2/(1+e.sinc0*r+e.cosc0*n*i),t.x=o*n*Math.sin(t.x),t.y=o*(e.cosc0*r-e.sinc0*n*i),t.x=e.a*t.x+e.x0,t.y=e.a*t.y+e.y0,t}function NE(e,t){var r,n,i,o,s;if(t.x=(t.x-e.x0)/e.a,t.y=(t.y-e.y0)/e.a,t.x/=e.k0,t.y/=e.k0,s=qe(t.x,t.y),s){var a=2*Math.atan2(s,e.R2);r=Math.sin(a),n=Math.cos(a),o=ci(e.sinc0,e.cosc0,r,n,t.x,t.y,s),i=Math.atan2(t.x*r,s*e.cosc0*n-t.y*e.sinc0*r)}else o=e.phic0,i=0;if(t.x=i,t.y=o,!PE(e,t))throw new Error("Oblique stereographic inverse did not converge");return t.x=G(t.x+e.long0,e.over),t}function BE(e){let t={...RE(e),sinc0:0,cosc0:0,R2:0};return mB(t),t}var cy={name:"sterea",aliases:["Stereographic_North_Pole","Oblique_Stereographic","Oblique Stereographic Alternative","Double_Stereographic"],parameters:[...ar,...lo],create(e){let t=er(e);if(Math.abs(t.lat0)===Math.PI/2)throw new Error("sterea requires a non-polar origin; use stere at the poles");let r=BE(t);return rn(Zo(t,Xe("sterea",r,CE,NE)),t,Math.PI*150/180,(n,i)=>Id(t,o=>2*Math.atan(r.K*Math.pow(Math.tan(Math.PI/4+o/2),r.C)*Math.pow((1-t.e*Math.sin(o))/(1+t.e*Math.sin(o)),r.ratexp))-Math.PI/2,r.phic0,t.a*t.k0*r.R2,n,i,r.C,Math.abs(Math.log(r.C))+Math.abs(Math.log(r.K))+r.C*t.e*Math.atanh(t.e)))}};rs();ns();wn();Lh();fe();Ae();function ly(e,t){let r=1-e*Math.sin(t)**2;return(1-e)/(r*Math.sqrt(r))}function um(e,t,r,n){return ly(e,t-r*n)+ly(e,t+r*n)}function Sn(e,t,r,n){let i=(n-r)/8,o=0;for(let s=0;s<4;s++){let a=r+(2*s+1)*i;o+=i*(.362683783378362*um(t,a,i,.1834346424956498)+.3137066458778873*um(t,a,i,.525532409916329)+.2223810344533745*um(t,a,i,.7966664774136267)+.1012285362903763*um(t,a,i,.9602898564975363))}return e*o}function hy(e,t,r){let n=Math.PI/2,i=Sn(e,t,0,n);if(!Number.isFinite(r)||Math.abs(r)>i)return NaN;let o=-n,s=n,a=r/i*n;for(let c=0;c<48;c++){let l=Sn(e,t,0,a)-r;if(Math.abs(l)<=8*Number.EPSILON*e)return a;l>0?s=a:o=a;let h=a-l/(e*ly(t,a));a=h>o&&h<s?h:(o+s)/2}return NaN}function OE(e,t,r,n,i,o,s){let a=n-t,c=Math.atan((1-o)*Math.tan(e)),l=Math.atan((1-o)*Math.tan(r)),h=Math.sin(c),u=Math.cos(c),f=Math.sin(l),d=Math.cos(l),m=a,p,g=100,y,_,M,x,v,T,S,E,N,O,C,R,W,j;do{if(y=Math.sin(m),_=Math.cos(m),M=Math.sqrt(d*y*(d*y)+(u*f-h*d*_)*(u*f-h*d*_)),M===0){s.x=0,s.y=0;return}x=h*f+u*d*_,v=Math.atan2(M,x),T=u*d*y/M,S=1-T*T,E=S!==0?x-2*h*f/S:0,N=o/16*S*(4+o*(4-3*S)),p=m,m=a+(1-N)*o*T*(v+N*M*(E+N*x*(-1+2*E*E)))}while(Math.abs(m-p)>1e-12&&--g>0);if(g===0){s.x=NaN,s.y=NaN;return}O=S*(i*i-i*(1-o)*(i*(1-o)))/(i*(1-o)*(i*(1-o))),C=1+O/16384*(4096+O*(-768+O*(320-175*O))),R=O/1024*(256+O*(-128+O*(74-47*O))),W=R*M*(E+R/4*(x*(-1+2*E*E)-R/6*E*(-3+4*M*M)*(-3+4*E*E))),j=i*(1-o)*C*(v-W);let A=Math.atan2(d*y,u*f-h*d*_);s.x=A,s.y=j}function LE(e,t,r,n,i,o,s){let a=Math.atan((1-o)*Math.tan(e)),c=Math.sin(a),l=Math.cos(a),h=Math.sin(r),u=Math.cos(r),f=Math.atan2(c,l*u),d=l*h,m=1-d*d,p=m*(i*i-i*(1-o)*(i*(1-o)))/(i*(1-o)*(i*(1-o))),g=1+p/16384*(4096+p*(-768+p*(320-175*p))),y=p/1024*(256+p*(-128+p*(74-47*p))),_=n/(i*(1-o)*g),M,x=100,v,T,S,E;do v=Math.cos(2*f+_),T=Math.sin(_),S=Math.cos(_),E=y*T*(v+y/4*(S*(-1+2*v*v)-y/6*v*(-3+4*T*T)*(-3+4*v*v))),M=_,_=n/(i*(1-o)*g)+E;while(Math.abs(_-M)>1e-12&&--x>0);if(x===0){s.x=NaN,s.y=NaN;return}let N=c*T-l*S*u,O=Math.atan2(c*S+l*T*u,(1-o)*Math.sqrt(d*d+N*N)),C=Math.atan2(T*h,l*S-c*T*u),R=o/16*m*(4+o*(4-3*m)),W=C-(1-R)*o*d*(_+R*T*(v+R*S*(-1+2*v*v))),j=t+W;s.x=j,s.y=O}function pB(e){e.sin_p12=Math.sin(e.lat0),e.cos_p12=Math.cos(e.lat0),e.x0=e.x0||0,e.y0=e.y0||0,e.long0=e.long0||0,e.f=e.es/(1+Math.sqrt(1-e.es))}function DE(e,t){var r=t.x,n=t.y,i=Math.sin(t.y),o=Math.cos(t.y),s=G(r-e.long0,e.over),a,c,l,h,u;if(e.sphere)return Math.abs(e.sin_p12-1)<=1e-10?(t.x=e.x0+e.a*(U-n)*Math.sin(s),t.y=e.y0-e.a*(U-n)*Math.cos(s),t):Math.abs(e.sin_p12+1)<=1e-10?(t.x=e.x0+e.a*(U+n)*Math.sin(s),t.y=e.y0+e.a*(U+n)*Math.cos(s),t):(h=e.sin_p12*i+e.cos_p12*o*Math.cos(s),c=Math.acos(h),l=c?c/Math.sin(c):1,t.x=e.x0+e.a*l*o*Math.sin(s),t.y=e.y0+e.a*l*(e.cos_p12*i-e.sin_p12*o*Math.cos(s)),t);if(Math.abs(e.sin_p12-1)<=1e-10)return a=Sn(e.a,e.es,n,U),t.x=e.x0+a*Math.sin(s),t.y=e.y0-a*Math.cos(s),t;if(Math.abs(e.sin_p12+1)<=1e-10)return a=Sn(e.a,e.es,-U,n),t.x=e.x0+a*Math.sin(s),t.y=e.y0+a*Math.cos(s),t;{if(Math.abs(s)<1e-10&&Math.abs(n-e.lat0)<1e-10)return t.x=e.x0,t.y=e.y0,t;OE(e.lat0,e.long0,n,r,e.a,e.f,t),u=t.x;let f=t.y;return t.x=e.x0+f*Math.sin(u),t.y=e.y0+f*Math.cos(u),t}}function FE(e,t){t.x-=e.x0,t.y-=e.y0;var r,n,i,o,s,a,c,l,h,u,f;if(e.sphere){if(r=Math.sqrt(t.x*t.x+t.y*t.y),r>2*U*e.a)return null;if(n=r/e.a,i=Math.sin(n),o=Math.cos(n),s=e.long0,Math.abs(r)<=1e-10)a=e.lat0;else if(a=ci(e.sin_p12,e.cos_p12,i,o,t.x,t.y,r),c=Math.abs(e.lat0)-U,Math.abs(c)<=1e-10)if(e.lat0>=0){if(!Number.isFinite(a))return null;s=G(e.long0+Math.atan2(t.x,-t.y),e.over)}else s=G(e.long0-Math.atan2(-t.x,t.y),e.over);else s=G(e.long0+Math.atan2(t.x*i,r*e.cos_p12*o-t.y*e.sin_p12*i),e.over);return t.x=s,t.y=a,t}else return Math.abs(e.sin_p12-1)<=1e-10?(l=Sn(e.a,e.es,0,U),r=Math.sqrt(t.x*t.x+t.y*t.y),h=l-r,a=hy(e.a,e.es,h),Number.isFinite(a)?(s=G(e.long0+Math.atan2(t.x,-1*t.y),e.over),t.x=s,t.y=a,t):null):Math.abs(e.sin_p12+1)<=1e-10?(l=Sn(e.a,e.es,0,U),r=Math.sqrt(t.x*t.x+t.y*t.y),h=r-l,a=hy(e.a,e.es,h),Number.isFinite(a)?(s=G(e.long0+Math.atan2(t.x,t.y),e.over),t.x=s,t.y=a,t):null):(u=Math.atan2(t.x,t.y),f=Math.sqrt(t.x*t.x+t.y*t.y),LE(e.lat0,e.long0,u,f,e.a,e.f,t),t)}function UE(e){let t={...e,sin_p12:0,cos_p12:0,f:0};return pB(t),t}var uy={name:"aeqd",aliases:["Azimuthal_Equidistant"],parameters:ar,create(e){let t=er(e),r=UE(t);return rn(Zo(t,Xe("aeqd",r,DE,FE)),t,Math.PI*179/180,(n,i)=>SS(t,n,i))}};w1();bS();var fy={name:"geocent",aliases:["Geocentric","geocentric","Geocent"],parameters:[],create({semiMajorAxis:e,semiMinorAxis:t,eccentricitySquared:r,primeMeridian:n=0}){let i={semiMajorAxis:e,eccentricitySquared:r,semiMinorAxis:t??e*Math.sqrt(1-r)};return{getRenderingProfile:()=>({bounds:[[-e,-e,-i.semiMinorAxis],[e,e,i.semiMinorAxis]],normalize:os({},n)().normalize}),forward(){throw new Error("Geocentric projection requires the 3D pipeline")},inverse(){throw new Error("Geocentric projection requires the 3D pipeline")},forwardInPlace:o=>rm(o,i),inverseInPlace:o=>nm(o,i),forward3D:o=>Zv(o,i),inverse3D:o=>Jv(o,i)}}};Ht();xa();Ie();Dh();Ae();function GE(e,t,r){let n=Ho(gr(r,e.long0,e.over)),i=e.a/Math.sqrt(1-e.es),o=qn(t(e.long0,r[0][1])[1],t(e.long0,r[1][1])[1]),s=Math.max(Math.abs(e.a*(e.es?e.am1:e.cphi1)+e.y0-o[0]),Math.abs(e.a*(e.es?e.am1:e.cphi1)+e.y0-o[1])),a=Math.min(s,i*n),c=Math.min(2*s,i*n);return re([e.x0-a,e.x0+a],[o[0]-c,o[1]+c])}function zE(e,t,r){let n=Ho(gr(r,e.long0,e.over)),i=e.a/Math.sqrt(1-e.es),o=i*n*n/4,s=qn(t(e.long0,r[0][1])[1],t(e.long0,r[1][1])[1]);return e.sphere&&(r[0][1]-e.lat0<-Math.PI/2||r[1][1]-e.lat0>Math.PI/2)&&(s=[e.y0-e.a*Math.PI/2,e.y0+e.a*Math.PI/2]),re([e.x0-i*n,e.x0+i*n],[s[0]-o,s[1]+o])}function VE(e,t,r){let n=Ho(gr(r,e.long0,e.over));if(e.sphere&&n>Math.PI/2)throw new Error("Unsupported Cassini rendering coverage");let i=e.a/Math.sqrt(1-e.es),o=e.es/(1-e.es),s=e.sphere?e.a*Math.asin(Math.min(1,Math.sin(Math.min(n,Math.PI/2)))):i*(n+n**3/6+(9+8*o)*n**5/120),a=e.sphere?e.a*n:i*(n*n/4+(6+6*o)*n**4/24),c=qn(t(e.long0,r[0][1])[1],t(e.long0,r[1][1])[1]);return re([e.x0-s,e.x0+s],[c[0]-a,c[1]+a])}function dy(e,t){return t[0]<=0&&t[1]>=0?[-1/0,1/0]:Te(e,qn(1/t[0],1/t[1]))}function kE(e,t){let r=l=>{let h=e.alpha*(Math.asinh(Math.tan(l))-e.e*Math.atanh(e.e*Math.sin(l)))+e.K;return Math.asin(Math.tanh(h))},n=K((t[0][0]-e.long0)*e.alpha,r(t[0][1]),(t[1][0]-e.long0)*e.alpha,r(t[1][1])),i=se([-Math.sin(e.b0),0,Math.cos(e.b0)],n);if(Ho(i)>=1-1e-14)throw new Error("Swiss oblique Mercator coverage reaches a rotated pole");let o=se([0,1,0],n),s=se([Math.cos(e.b0),0,Math.sin(e.b0)],n),a=dy(o,s).map(Math.atan),c=i.map(l=>Math.atanh(Math.max(-1+Number.EPSILON,Math.min(1-Number.EPSILON,l))));return re(At([e.x0,e.x0],Ct(a,e.R)),At([e.y0,e.y0],Ct(c,e.R)))}function qE(e,t){let r=m=>Math.log(e.E)-e.B*Math.log(Lr(e.e,m,Math.sin(m))),n=qn(r(t[0][1]),r(t[1][1])),i=Ct([t[0][0]-e.lam0,t[1][0]-e.lam0],e.B),o=K(i[0],Math.asin(Math.tanh(n[0])),i[1],Math.asin(Math.tanh(n[1]))),s=se([0,-e.cosgam,e.singam],o),a=Ct(qn(-Math.atanh(s[0]),-Math.atanh(s[1])),e.ArB),c=At(Ct([Math.sinh(n[0]),Math.sinh(n[1])],e.cosgam),Ct(Ch(i),e.singam)),l=yd(i),h=l[0]>0?dy(c,l).map(Math.atan):[-Math.PI,Math.PI],u=Ct(h,e.ArB),f,d;return e.no_rot?(f=u,d=a):(u=At(u,[-e.u_0,-e.u_0]),f=At(Ct(a,e.cosrot),Ct(u,e.sinrot)),d=At(Ct(u,e.cosrot),Ct(a,-e.sinrot))),re(At([e.x0,e.x0],Ct(f,e.a)),At([e.y0,e.y0],Ct(d,e.a)))}function jE(e,t){let r=d=>2*(Math.atan(e.k*Math.pow(Math.tan(d/2+e.s45),e.alfa)/Math.pow((1+e.e*Math.sin(d))/(1-e.e*Math.sin(d)),e.alfa*e.e/2))-e.s45),n=Ct(gr(t,e.long0,e.over),-e.alfa),i=K(n[0],r(t[0][1]),n[1],r(t[1][1])),o=se([Math.sin(e.ad),0,Math.cos(e.ad)],i),s=[Math.sqrt(Math.max(Number.EPSILON,1-Ho(o)**2)),1],a=se([0,1,0],i),c=dy(a,s),l=Ct(c.map(d=>Math.asin(Math.max(-1,Math.min(1,d)))),e.n),h=d=>e.ro0*Math.pow(Math.tan(e.s0/2+e.s45)/Math.tan(Math.asin(d)/2+e.s45),e.n),u=qn(h(o[0]),h(o[1])),f=e.czech?1:-1;return re(At([e.x0,e.x0],Ct(Te(u,Ch(l)),f)),At([e.y0,e.y0],Ct(Te(u,yd(l)),f)))}function WE(e,t){let r=Ct([t[0][1]-e.lat0,t[1][1]-e.lat0],1e-5/Bh),n=gr(t,e.long0,e.over),i=[0,0];for(let l=10;l>=1;l--)i=At([e.A[l],e.A[l]],Te(i,r));i=Te(i,r);let o=[0,0],s=[0,0];for(let l=6;l>=1;l--){let h=At(Te(o,i),Ct(Te(s,n),-1)),u=At(Te(o,n),Te(s,i));o=At(h,[e.B_re[l],e.B_re[l]]),s=At(u,[e.B_im[l],e.B_im[l]])}let a=At(Te(o,i),Ct(Te(s,n),-1)),c=At(Te(o,n),Te(s,i));return re(At([e.x0,e.x0],Ct(c,e.a)),At([e.y0,e.y0],Ct(a,e.a)))}Ht();ne();wa();wn();Ee();function vt(e){let t=er(e);return{...t,x0:0,y0:0,lat_ts:Number.isNaN(t.lat_ts)?0:t.lat_ts}}function Pe(e,t){return{...e,x0:tt(t.parameters,"x_0",0),y0:tt(t.parameters,"y_0",0)}}function Et(e,t,r,n,i,o){let s=Xe(e,r,n,i),a=tt(t.parameters,"x_0",0),c=tt(t.parameters,"y_0",0);return jn(l=>{o?.(l.x,l.y),s.forwardInPlace(l),l.x+=a,l.y+=c},l=>{l.x-=a,l.y-=c,s.inverseInPlace(l)})}function as(e,t=0,r=!1){return(n,i)=>{let o=Math.sin(e.lat0)*Math.sin(i)+Math.cos(e.lat0)*Math.cos(i)*Math.cos(n-e.long0);if(r?o<t-1e-14:o<=t+1e-14)throw new Error("Coordinate is outside the visible projection horizon")}}fe();Ma();qc();jc();ba();Ae();var Kh=1e-10;function gB(e){var t;if(e.phi1=e.lat1,Math.abs(e.phi1)<Kh)throw new Error;e.es?(e.en=Ni(e.es),e.am1=Math.sin(e.phi1),t=Math.cos(e.phi1),e.m1=rr(e.phi1,e.am1,t,e.en),e.am1=t/(Math.sqrt(1-e.es*e.am1*e.am1)*e.am1)):Math.abs(e.phi1)+Kh>=U?e.cphi1=0:e.cphi1=1/Math.tan(e.phi1)}function yB(e,t){var r=G(t.x-(e.long0||0),e.over),n=t.y,i,o,s;return o=Math.sin(n),s=Math.cos(n),i=e.am1+e.m1-rr(n,o,s,e.en),o=s*r/(i*Math.sqrt(1-e.es*o*o)),t.x=i*Math.sin(o),t.y=e.am1-i*Math.cos(o),t.x=e.a*t.x+(e.x0||0),t.y=e.a*t.y+(e.y0||0),t}function wB(e,t){t.x=(t.x-(e.x0||0))/e.a,t.y=(t.y-(e.y0||0))/e.a;var r,n,i,o;if(t.y=e.am1-t.y,n=qe(t.x,t.y),e.phi1<0&&(n=-n),o=Bi(e.am1+e.m1-n,e.es,e.en),r=Math.abs(o),r<U)r=Math.sin(o),i=n*Math.atan2(Math.sign(e.phi1)*t.x,Math.sign(e.phi1)*t.y)*Math.sqrt(1-e.es*r*r)/Math.cos(o);else if(Math.abs(r-U)<=Kh)i=0;else throw new Error;return t.x=G(i+(e.long0||0),e.over),t.y=uo(o),t}function _B(e,t){var r=G(t.x-(e.long0||0),e.over),n=t.y,i,o;return o=e.cphi1+e.phi1-n,Math.abs(o)>Kh?(i=r*Math.cos(n)/o,t.x=o*Math.sin(i),t.y=e.cphi1-o*Math.cos(i)):t.x=t.y=0,t.x=e.a*t.x+(e.x0||0),t.y=e.a*t.y+(e.y0||0),t}function MB(e,t){t.x=(t.x-(e.x0||0))/e.a,t.y=(t.y-(e.y0||0))/e.a;var r,n;t.y=e.cphi1-t.y;var i=qe(t.x,t.y);if(e.phi1<0&&(i=-i),n=e.cphi1+e.phi1-i,Math.abs(n)>U)throw new Error;return Math.abs(Math.abs(n)-U)<=Kh?r=0:r=i*Math.atan2(Math.sign(e.phi1)*t.x,Math.sign(e.phi1)*t.y)/Math.cos(n),t.x=G(r+(e.long0||0),e.over),t.y=uo(n),t}function HE(e,t){return e.es?yB(e,t):_B(e,t)}function $E(e,t){return e.es?wB(e,t):MB(e,t)}function YE(e,t={}){let r={...e,phi1:0,en:[],m1:0,am1:0,cphi1:0,...t};return gB(r),r}var my={name:"bonne",aliases:["Bonne (Werner lat_1=90)"],parameters:["lon_0","x_0","y_0","lat_1"],create(e){let t=vt(e);if(!Object.prototype.hasOwnProperty.call(e.parameters,"lat_1")||Math.abs(t.lat1)<1e-10)throw new Error("Bonne requires a nonzero lat_1");let r=YE(t),n=Et("bonne",e,r,HE,$E);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>GE(Pe(r,e),n.forward,i),t.primeMeridian,t.over)}};Ht();ne();qc();ba();jc();function tl(e,t,r){var n=t*r;return e/Math.sqrt(1-n*n)}fe();Ae();function bB(e){e.sphere||(e.en=Ni(e.es),e.ml0=e.a*rr(e.lat0,Math.sin(e.lat0),Math.cos(e.lat0),e.en))}function gy(e,t){var r,n,i=t.x,o=t.y;if(i=G(i-e.long0,e.over),e.sphere)r=e.a*Math.asin(Math.cos(o)*Math.sin(i)),n=e.a*(Math.atan2(Math.tan(o),Math.cos(i))-e.lat0);else{var s=Math.sin(o),a=Math.cos(o),c=tl(e.a,e.e,s),l=Math.tan(o)*Math.tan(o),h=i*Math.cos(o),u=h*h,f=e.es*a*a/(1-e.es),d=e.a*rr(o,s,a,e.en);r=c*h*(1-u*l*(1/6+(8-l+8*f)*u/120)),n=d-e.ml0+c*s/a*u*(.5+(5-l+6*f)*u/24)}return t.x=r+e.x0,t.y=n+e.y0,t}function KE(e,t){t.x-=e.x0,t.y-=e.y0;var r=t.x/e.a,n=t.y/e.a,i,o;if(e.sphere){var s=n+e.lat0;i=Math.asin(Math.sin(s)*Math.cos(r)),o=Math.atan2(Math.tan(r),Math.cos(s))}else{var a=e.ml0/e.a+n,c=Bi(a,e.es,e.en);if(Math.abs(Math.abs(c)-U)<=1e-10)return t.x=e.long0,t.y=Math.sign(c)*U,t;var l=tl(e.a,e.e,Math.sin(c)),h=l*l*l/e.a/e.a*(1-e.es),u=Math.pow(Math.tan(c),2),f=r*e.a/l,d=f*f;i=c-l*Math.tan(c)/h*f*f*(.5-(1+3*u)*f*f/24),o=f*(1-d*(u/3-(1+3*u)*u*d/15))/Math.cos(c)}if(!e.sphere){let m=t.x+e.x0,p=t.y+e.y0,g=e.scratch,y=!1;for(let _=0;_<12;_++){py(e,o,i);let M=g.x-m,x=g.y-p;if(Math.max(Math.abs(M),Math.abs(x))<1e-7){y=!0;break}let v=1e-7,T=i>U-v?-v:v,S=g.x,E=g.y;py(e,o+v,i);let N=(g.x-S)/v,O=(g.y-E)/v;py(e,o,i+T);let C=(g.x-S)/T,R=(g.y-E)/T,W=N*R-C*O;if(!Number.isFinite(W)||Math.abs(W)<1e-12||(o-=(R*M-C*x)/W,i-=(N*x-O*M)/W,!Number.isFinite(o)||Math.abs(i)>U))break}if(!y)throw new Error("Cassini inverse did not converge")}return t.x=G(o+e.long0,e.over),t.y=uo(i),t}function py(e,t,r){e.scratch.x=t+e.long0,e.scratch.y=r,gy(e,e.scratch)}function XE(e,t={}){let r={...e,en:[],scratch:{x:0,y:0},ml0:0,...t};return bB(r),r}var yy={name:"cass",aliases:["Cassini","Cassini_Soldner"],parameters:["lon_0","x_0","y_0","lat_0"],create(e){let t=vt(e),r=XE(t),n=Et("cass",e,r,gy,KE);return Pt(n,K(t.long0-Math.PI/6,-Math.PI/2+1e-8,t.long0+Math.PI/6,Math.PI/2-1e-8),i=>VE(Pe(t,e),n.forward,i),t.primeMeridian,t.over)}};Ie();Ht();ne();fe();Wc();function xB(e){e.sphere||(e.k0=nn(e.e,Math.sin(e.lat_ts),Math.cos(e.lat_ts)))}function ZE(e,t){var r=t.x,n=t.y,i,o,s=G(r-e.long0,e.over);if(e.sphere)i=e.x0+e.a*s*Math.cos(e.lat_ts),o=e.y0+e.a*Math.sin(n)/Math.cos(e.lat_ts);else{var a=Fr(e.e,Math.sin(n));i=e.x0+e.a*e.k0*s,o=e.y0+e.a*a*.5/e.k0}return t.x=i,t.y=o,t}function JE(e,t){t.x-=e.x0,t.y-=e.y0;var r,n;return e.sphere?(r=G(e.long0+t.x/e.a/Math.cos(e.lat_ts),e.over),n=Math.asin(t.y/e.a*Math.cos(e.lat_ts))):(n=lm(e.e,2*t.y*e.k0/e.a),r=G(e.long0+t.x/(e.a*e.k0),e.over)),t.x=r,t.y=n,t}function QE(e,t={}){let r={...e,...t};return xB(r),r}var wy={name:"cea",aliases:[],parameters:["lon_0","x_0","y_0","lat_ts"],create(e){let t=vt(e);if(Math.abs(t.lat_ts)>=Math.PI/2)throw new Error("CEA standard parallel must be away from the poles");let r=QE(t),n=Et("cea",e,r,ZE,JE);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>yr(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};Ie();Ht();ne();fe();qc();ba();jc();Ae();function Aa(e){return Math.abs(e)>1&&(e=e>1?1:-1),Math.asin(e)}var SB=20;function vB(e){e.long0=e.long0||0,e.sphere?(e.n=1,e.m=0,e.es=0,e.C_y=Math.sqrt((e.m+1)/e.n),e.C_x=e.C_y/(e.m+1)):e.en=Ni(e.es)}function fm(e,t){var r,n,i=t.x,o=t.y;if(i=G(i-e.long0,e.over),e.sphere){if(!e.m)o=e.n!==1?Math.asin(e.n*Math.sin(o)):o;else for(var s=e.n*Math.sin(o),a=SB;a;--a){var c=(e.m*o+Math.sin(o)-s)/(e.m+Math.cos(o));if(o-=c,Math.abs(c)<1e-10)break}r=e.a*e.C_x*i*(e.m+Math.cos(o)),n=e.a*e.C_y*o}else{var l=Math.sin(o),h=Math.cos(o);n=e.a*rr(o,l,h,e.en),r=e.a*i*h/Math.sqrt(1-e.es*l*l)}return t.x=r,t.y=n,t}function dm(e,t){var r,n,i,o;if(t.x-=e.x0,i=t.x/e.a,t.y-=e.y0,r=t.y/e.a,e.sphere){if(r/=e.C_y,i=i/(e.C_x*(e.m+Math.cos(r))),e.m){let s=(e.m*r+Math.sin(r))/e.n;if(Math.abs(s)>1+8*Number.EPSILON)return null;r=Aa(s)}else e.n!==1&&(r=Aa(Math.sin(r)/e.n));i=G(i+e.long0,e.over),r=uo(r)}else r=Bi(t.y/e.a,e.es,e.en),o=Math.abs(r),o<U?(o=Math.sin(r),n=e.long0+t.x*Math.sqrt(1-e.es*o*o)/(e.a*Math.cos(r)),i=G(n,e.over)):o-1e-10<U&&(i=e.long0);return t.x=i,t.y=r,t}function tT(e,t={}){let r={...e,en:[],n:0,m:0,C_y:0,C_x:0,...t};return vB(r),r}function EB(e){e.sphere=!0,e.b=e.a,e.m=1,e.n=2.5707963267948966,e.es=0,e.C_y=Math.sqrt((e.m+1)/e.n),e.C_x=e.C_y/(e.m+1)}var eT=fm,rT=dm;function nT(e,t={}){let r={...e,m:0,n:0,C_y:0,C_x:0,en:[],...t};return EB(r),r}var _y={name:"eck6",aliases:["Eckert_VI"],parameters:["lon_0","x_0","y_0"],create(e){let t=vt(e),r=nT(t),n=Et("eck6",e,r,eT,rT);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>yr(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};Ee();fe();var TB=.3333333333333333,IB=.17222222222222222,AB=.10257936507936508,PB=.06388888888888888,RB=.0664021164021164,CB=.016415012942191543;function My(e){var t,r=[];return r[0]=e*TB,t=e*e,r[0]+=t*IB,r[1]=t*PB,t*=e,r[0]+=t*AB,r[1]+=t*RB,r[2]=t*CB,r}function by(e,t){var r=e+e;return e+t[0]*Math.sin(r)+t[1]*Math.sin(r+r)+t[2]*Math.sin(r+r+r)}var el=1.340264,rl=-.081106,nl=893e-6,il=.003796,mm=Math.sqrt(3)/2;function NB(e){e.long0=e.long0!==void 0?e.long0:0,e.x0=e.x0!==void 0?e.x0:0,e.y0=e.y0!==void 0?e.y0:0,e.es!==0&&(e.apa=My(e.es),e.qp=Fr(e.e,1),e.rqda=Math.sqrt(.5*e.qp))}function iT(e,t){var r=G(t.x-e.long0,e.over),n=t.y,i=Math.sin(n);e.es!==0&&(i=Fr(e.e,i)/e.qp);var o=Math.asin(mm*i),s=o*o,a=s*s*s;return t.x=r*Math.cos(o)/(mm*(el+3*rl*s+a*(7*nl+9*il*s))),t.y=o*(el+rl*s+a*(nl+il*s)),e.es!==0&&(t.x*=e.rqda,t.y*=e.rqda),t.x=e.a*t.x+e.x0,t.y=e.a*t.y+e.y0,t}function oT(e,t){t.x=(t.x-e.x0)/e.a,t.y=(t.y-e.y0)/e.a,e.es!==0&&(t.x/=e.rqda,t.y/=e.rqda);let r=Math.PI/3,n=r*r,i=r*(el+rl*n+n**3*(nl+il*n));if(Math.abs(t.y)>i+8*Number.EPSILON*i)return null;var o=1e-9,s=12,a=t.y,c,l,h,u,f,d;for(d=0;d<s&&(c=a*a,l=c*c*c,h=a*(el+rl*c+l*(nl+il*c))-t.y,u=el+3*rl*c+l*(7*nl+9*il*c),a-=f=h/u,!(Math.abs(f)<o));++d);c=a*a,l=c*c*c,t.x=mm*t.x*(el+3*rl*c+l*(7*nl+9*il*c))/Math.cos(a);let m=Math.sin(a)/mm,p=8*Number.EPSILON;return Math.abs(m)>1+p?null:(t.y=Math.abs(m)>=1-p?Math.sign(m)*Math.PI/2:Math.asin(m),e.es!==0&&(t.y=by(t.y,e.apa)),t.x=G(t.x+e.long0,e.over),t)}function sT(e,t={}){let r={...e,apa:[],qp:0,rqda:0,...t};return NB(r),r}Ht();ne();Ie();var xy={name:"eqearth",aliases:["Equal Earth","Equal_Earth"],parameters:["lon_0","x_0","y_0"],create(e){let t=vt(e),r=e.primeMeridian??0,n=sT(t),i=Et("eqearth",e,n,iT,oT),o=Math.sqrt(e.eccentricitySquared),s=e.semiMajorAxis*(o?Math.sqrt((1+(1-o*o)*Math.atanh(o)/o)/2):1),a=Math.PI/3,c=a*a,l=c**3,h=s*Math.PI/(Math.sqrt(3)/2*1.340264),u=tt(e.parameters,"x_0",0),f=tt(e.parameters,"y_0",0),d=s*a*(1.340264-.081106*c+l*(893e-6+.003796*c));return{...i,longitudeOrigin:t.long0,getRenderingProfile(m){if(m)return Ke(g=>yr(i.forward,g,t.long0,t.over),m,t.long0,r,t.over);let p=[[u-h,f-d,0],[u+h,f+d,0]];return{bounds:p,normalize:Ke(()=>p,yn(K(t.long0-Math.PI,-(Math.PI/2),t.long0+Math.PI,Math.PI/2),r),t.long0,r,t.over).normalize}}}}};Ie();Ht();ne();fe();function BB(e){e.x0=e.x0||0,e.y0=e.y0||0,e.lat0=e.lat0||0,e.long0=e.long0||0}function aT(e,t){var r=t.x,n=t.y,i=G(r-e.long0,e.over),o=e.x0+e.a*i*Math.cos(e.lat0),s=e.y0+e.a*n;return e.t1=o,e.t2=Math.cos(e.lat0),t.x=o,t.y=s,t}function cT(e,t){t.x-=e.x0,t.y-=e.y0;var r=t.y/e.a;Math.abs(r)>Math.PI/2&&Math.abs(r)<=Math.PI/2+8*Number.EPSILON&&(r=Math.sign(r)*Math.PI/2);var n=G(e.long0+t.x/(e.a*Math.cos(e.lat0)),e.over);return t.x=n,t.y=r,t}function lT(e,t={}){let r={...e,t2:0,t1:0,...t};return BB(r),r}var Sy={name:"equi",aliases:[],parameters:["lon_0","x_0","y_0","lat_0"],create(e){let t=vt(e);if(Math.abs(t.lat0)>=Math.PI/2)throw new Error("Equirectangular standard parallel must be away from the poles");let r=lT(t),n=Et("equi",e,r,aT,cT);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>yr(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};Ht();ya();ne();Ee();xa();Ie();function hT(e,t,r=!1){let n=1+t/e.a,i=n/(1+1e-10),o=u=>Math.acos(Math.min(1,Math.sqrt(1-e.es*Math.sin(u)**2)/(i*Math.cos(u)))),s=u=>{let f=(i*Math.cos(u))**2;return Math.asin(Math.sqrt(Math.max(0,(f-1)/(f-e.es))))},a=t*Math.asin(1/n),c=t*Math.atan(Math.sqrt((1-e.es)/(n*n-1))),l=(u,f)=>{let d=Math.max(u[0][1],Math.min(u[1][1],0)),m=o(d),p=Math.max(u[0][0]-e.long0,-m),g=Math.min(u[1][0]-e.long0,m),y=s(Math.max(p,Math.min(g,0))),_=Math.max(u[0][1],-y),M=Math.min(u[1][1],y);if(g<p||M<_)return null;let x=K(p,_,g,M),v=yn(K(p+e.long0,_,g+e.long0,M),e.primeMeridian),T=(e.long0+e.primeMeridian)*180/Math.PI,S=Yo(E=>{let N=Math.max(p,Math.min(g,ve(E.x-e.long0))),O=s(N),C=Math.max(Math.max(_,-O),Math.min(Math.min(M,O),E.y));N!==E.x-e.long0&&(E.x=N+e.long0),E.y=C},e.primeMeridian);return{get bounds(){if(!f)return re([e.x0-a,e.x0+a],[e.y0-c,e.y0+c]);let E=se([0,0,1],x),N=[1,1/Math.sqrt(1-e.es*Math.max(E[0]**2,E[1]**2))],O=Te(se([1,0,0],x),N),C=Te(se([0,1,0],x),N),R=Te(E,[1-e.es,(1-e.es)*N[1]]),W=[n-Math.min(1,O[1]),n-Math.max(1/n,O[0])],j=(A,P,D,F)=>{let L=P[0]<=0&&P[1]>=0?0:Math.min(Math.abs(P[0]),Math.abs(P[1])),B=F?[Math.hypot(W[0],L),Math.hypot(W[1],Math.max(Math.abs(P[0]),Math.abs(P[1])))]:W,V=A.flatMap(yt=>B.map(Dt=>t*Math.atan(yt/Dt)));return[Math.max(-D,Math.min(...V)),Math.min(D,Math.max(...V))]};return re(At([e.x0,e.x0],j(C,R,a,r)),At([e.y0,e.y0],j(R,C,c,!r)))},normalize(E){Md(E,v,T),S(E)}}},h=yn(K(e.long0-o(0),-s(0),e.long0+o(0),s(0)),e.primeMeridian);return u=>{let f=u?wd(u,h):[h],d=_d(f,m=>l($o(m,e.primeMeridian,e.long0),!!u));if(!d)throw new Error("CRS coverage does not intersect the satellite limb");return d}}Ma();function OB(e){if(e.flip_axis=e.sweep==="x"?1:0,e.h=Number(e.h),e.radius_g_1=e.h/e.a,e.radius_g_1<=0||e.radius_g_1>1e10)throw new Error;if(e.radius_g=1+e.radius_g_1,e.C=e.radius_g*e.radius_g-1,e.es!==0){var t=1-e.es,r=1/t;e.radius_p=Math.sqrt(t),e.radius_p2=t,e.radius_p_inv2=r,e.shape="ellipse"}else e.radius_p=1,e.radius_p2=1,e.radius_p_inv2=1,e.shape="sphere"}function uT(e,t){var r=t.x,n=t.y,i,o,s,a;if(r=r-e.long0,e.shape==="ellipse"){n=Math.atan(e.radius_p2*Math.tan(n));var c=e.radius_p/qe(e.radius_p*Math.cos(n),Math.sin(n));if(o=c*Math.cos(r)*Math.cos(n),s=c*Math.sin(r)*Math.cos(n),a=c*Math.sin(n),(e.radius_g-o)*o-s*s-a*a*e.radius_p_inv2<0)return t.x=Number.NaN,t.y=Number.NaN,t;i=e.radius_g-o,e.flip_axis?(t.x=e.radius_g_1*Math.atan(s/qe(a,i)),t.y=e.radius_g_1*Math.atan(a/i)):(t.x=e.radius_g_1*Math.atan(s/i),t.y=e.radius_g_1*Math.atan(a/qe(s,i)))}else e.shape==="sphere"&&(i=Math.cos(n),o=Math.cos(r)*i,s=Math.sin(r)*i,a=Math.sin(n),i=e.radius_g-o,e.flip_axis?(t.x=e.radius_g_1*Math.atan(s/qe(a,i)),t.y=e.radius_g_1*Math.atan(a/i)):(t.x=e.radius_g_1*Math.atan(s/i),t.y=e.radius_g_1*Math.atan(a/qe(s,i))));return t.x=t.x*e.a,t.y=t.y*e.a,t}function fT(e,t){var r=-1,n=0,i=0,o,s,a,c;if(t.x=t.x/e.a,t.y=t.y/e.a,e.shape==="ellipse"){e.flip_axis?(i=Math.tan(t.y/e.radius_g_1),n=Math.tan(t.x/e.radius_g_1)*qe(1,i)):(n=Math.tan(t.x/e.radius_g_1),i=Math.tan(t.y/e.radius_g_1)*qe(1,n));var l=i/e.radius_p;if(o=n*n+l*l+r*r,s=2*e.radius_g*r,a=s*s-4*o*e.C,a<0)return t.x=Number.NaN,t.y=Number.NaN,t;c=(-s-Math.sqrt(a))/(2*o),r=e.radius_g+c*r,n*=c,i*=c,t.x=Math.atan2(n,r),t.y=Math.atan(i*Math.cos(t.x)/r),t.y=Math.atan(e.radius_p_inv2*Math.tan(t.y))}else if(e.shape==="sphere"){if(e.flip_axis?(i=Math.tan(t.y/e.radius_g_1),n=Math.tan(t.x/e.radius_g_1)*Math.sqrt(1+i*i)):(n=Math.tan(t.x/e.radius_g_1),i=Math.tan(t.y/e.radius_g_1)*Math.sqrt(1+n*n)),o=n*n+i*i+r*r,s=2*e.radius_g*r,a=s*s-4*o*e.C,a<0)return t.x=Number.NaN,t.y=Number.NaN,t;c=(-s-Math.sqrt(a))/(2*o),r=e.radius_g+c*r,n*=c,i*=c,t.x=Math.atan2(n,r),t.y=Math.atan(i*Math.cos(t.x)/r)}return t.x=t.x+e.long0,t}function dT(e,t={}){let r={...e,flip_axis:0,sweep:"",h:0,radius_g_1:0,radius_g:0,C:0,radius_p:0,radius_p2:0,radius_p_inv2:0,shape:"",...t};return OB(r),r}Ee();var vy={name:"geos",aliases:["Geostationary Satellite View","Geostationary_Satellite"],parameters:["lon_0","x_0","y_0","h","sweep"],create(e){let t=vt(e),r=tt(e.parameters,"h",NaN);if(!Number.isFinite(r)||r<=0)throw new Error("Geostationary projection requires positive h");let n=e.parameters.sweep||"y";if(!["x","y"].includes(n))throw new Error("Geostationary sweep must be x or y");let i=dT(t,{h:r,sweep:n});return{...Et("geos",e,i,uT,fT,t.sphere?as({...t,lat0:0},1/(1+r/t.a),!0):void 0),longitudeOrigin:t.long0,getRenderingProfile:hT(Pe(t,e),r,n==="x")}}};rs();ns();Cx();fe();var Pa=180/Math.PI;function mT(e){return{engine:Rx({semiMajorAxis:1,semiMinorAxis:Math.sqrt(1-e.es)}),latitude:e.lat0*Pa}}function pT(e,t,r){let n=t.engine.Inverse(t.latitude,0,r.y*Pa,G(r.x-e.long0,e.over)*Pa,Ih);if(!(n.M12>0))throw new Error("Coordinate is outside the ellipsoidal gnomonic horizon");let i=e.a*n.m12/n.M12,o=n.azi1/Pa;return r.x=e.x0+i*Math.sin(o),r.y=e.y0+i*Math.cos(o),r}function gT(e,t,r){let n=(r.x-e.x0)/e.a,i=(r.y-e.y0)/e.a,o=Math.hypot(n,i);if(o===0)return r.x=e.long0,r.y=e.lat0,r;let s=t.engine.Line(t.latitude,0,Math.atan2(n,i)*Pa,Ih),a=o<=1,c=a?o:1/o,l=Math.atan(o);for(let h=0;h<20;h++){let u=s.Position(l,Ih),f=a?(u.m12-c*u.M12)*u.M12:(c*u.m12-u.M12)*u.m12;if(!Number.isFinite(f))break;if(l-=f,Math.abs(f)<1e-14){let d=s.Position(l,Ih);if(!(d.M12>0))break;return r.x=G(e.long0+d.lon2/Pa,e.over),r.y=d.lat2/Pa,r}}throw new Error("Ellipsoidal gnomonic inverse did not converge")}fe();function LB(e){e.sphere||(e.ellipsoid=mT(e)),e.sin_p14=Math.sin(e.lat0),e.cos_p14=Math.cos(e.lat0),e.infinity_dist=1e3*e.a,e.rc=1}function yT(e,t){if(e.ellipsoid)return pT(e,e.ellipsoid,t);var r,n,i,o,s,a,c,l,h=t.x,u=t.y;return i=G(h-e.long0,e.over),r=Math.sin(u),n=Math.cos(u),o=Math.cos(i),a=e.sin_p14*r+e.cos_p14*n*o,s=1,a>0||Math.abs(a)<=1e-10?(c=e.x0+e.a*s*n*Math.sin(i)/a,l=e.y0+e.a*s*(e.cos_p14*r-e.sin_p14*n*o)/a):(c=e.x0+e.infinity_dist*n*Math.sin(i),l=e.y0+e.infinity_dist*(e.cos_p14*r-e.sin_p14*n*o)),t.x=c,t.y=l,t}function wT(e,t){if(e.ellipsoid)return gT(e,e.ellipsoid,t);var r,n,i,o,s,a;return t.x=(t.x-e.x0)/e.a,t.y=(t.y-e.y0)/e.a,t.x/=e.k0,t.y/=e.k0,r=Math.sqrt(t.x*t.x+t.y*t.y),r?(o=Math.atan2(r,e.rc),n=Math.sin(o),i=Math.cos(o),a=Aa(i*e.sin_p14+t.y*n*e.cos_p14/r),s=Math.atan2(t.x*n,r*e.cos_p14*i-t.y*e.sin_p14*n),s=G(e.long0+s,e.over)):(a=e.lat0,s=e.long0),t.x=s,t.y=a,t}function _T(e,t={}){let r={...e,sin_p14:0,cos_p14:0,infinity_dist:0,rc:0,phic0:0,...t};return LB(r),r}var Ey={name:"gnom",aliases:[],parameters:["lon_0","x_0","y_0","lat_0"],create(e){let t=vt(e),r=_T(t);return rn(Et("gnom",e,r,yT,wT,t.sphere?as(t):void 0),t,Math.min(Math.PI*80/180,(1-t.es)*Math.PI*.45),(n,i)=>t.sphere?Td(Pe(t,e),n,i,"gnom"):TS(Pe(t,e),n,i),(1-t.es)*Math.PI/2)}};Ie();Ae();function Ty(e,t){return 2*Math.atan(e*Math.exp(t))-U}function pm(e,t){var r=Ty(1,t),n=0,i=0;let o=0;do{if(++o>50)throw new Error("Isometric latitude inverse did not converge");n=r,i=e*Math.sin(n),r=Ty(Math.exp(e*Math.log((1+i)/(1-i))/2),t)}while(Math.abs(r-n)>1e-12);return r}Ht();ne();Ae();function ol(e,t,r){if(Math.abs(t)>U)return Number.NaN;if(t===U)return Number.POSITIVE_INFINITY;if(t===-1*U)return Number.NEGATIVE_INFINITY;var n=e*r;return Math.log(Math.tan((U+t)/2))+e*Math.log((1-n)/(1+n))/2}xd();f1();function DB(e){e.k0||(e.k0=1);var t=e.b/e.a;e.e=Math.sqrt(1-t*t),e.lc=e.long0,e.rs=Math.sqrt(1+e.e*e.e*Math.pow(Math.cos(e.lat0),4)/(1-e.e*e.e));var r=Math.sin(e.lat0),n=Math.asin(r/e.rs),i=Math.sin(n);e.cp=ol(0,n,i)-e.rs*ol(e.e,e.lat0,r),e.n2=e.k0*e.a*Math.sqrt(1-e.e*e.e)/(1-e.e*e.e*r*r),e.xs=e.x0,e.ys=e.y0-e.n2*n}function MT(e,t){var r=t.x,n=t.y,i=e.rs*(r-e.lc),o=e.cp+e.rs*ol(e.e,n,Math.sin(n)),s=Math.asin(Math.sin(i)/Nh(o)),a=ol(0,s,Math.sin(s));return t.x=e.xs+e.n2*a,t.y=e.ys+e.n2*Math.atan(_a(o)/Math.cos(i)),t}function bT(e,t){var r=t.x,n=t.y,i=Math.atan(_a((r-e.xs)/e.n2)/Math.cos((n-e.ys)/e.n2)),o=Math.asin(Math.sin((n-e.ys)/e.n2)/Nh((r-e.xs)/e.n2)),s=ol(0,o,Math.sin(o));return t.x=e.lc+i/e.rs,t.y=pm(e.e,(s-e.cp)/e.rs),t}function xT(e,t={}){let r={...e,lc:0,rs:0,cp:0,n2:0,xs:0,ys:0,...t};return DB(r),r}var Iy={name:"gstmerc",aliases:["gstmerg"],parameters:["lon_0","x_0","y_0","lat_0","k","k_0"],create(e){let t=vt(e),r=xT(t),n=Et("gstmerc",e,r,MT,bT);return Pt(n,K(t.long0-Math.PI/6,-Math.PI/3,t.long0+Math.PI/6,Math.PI/3),i=>Gc(n.forward,i,t.long0,t.over,pm(r.e,-r.cp/r.rs)),t.primeMeridian,t.over)}};Ht();ne();fe();function FB(e){e.a=6377397155e-3,e.es=.006674372230614,e.e=Math.sqrt(e.es),e.s45=Math.PI/4,e.s90=2*e.s45,e.fi0=e.lat0,e.e2=e.es,e.e=Math.sqrt(e.e2),e.alfa=Math.sqrt(1+e.e2*Math.pow(Math.cos(e.fi0),4)/(1-e.e2)),e.uq=1.04216856380474,e.u0=Math.asin(Math.sin(e.fi0)/e.alfa),e.g=Math.pow((1+e.e*Math.sin(e.fi0))/(1-e.e*Math.sin(e.fi0)),e.alfa*e.e/2),e.k=Math.tan(e.u0/2+e.s45)/Math.pow(Math.tan(e.fi0/2+e.s45),e.alfa)*e.g,e.k1=e.k0,e.n0=e.a*Math.sqrt(1-e.e2)/(1-e.e2*Math.pow(Math.sin(e.fi0),2)),e.s0=1.37008346281555,e.n=Math.sin(e.s0),e.ro0=e.k1*e.n0/Math.tan(e.s0),e.ad=e.s90-e.uq}function ST(e,t){var r,n,i,o,s,a,c,l=t.x,h=t.y,u=G(l-e.long0,e.over);return r=Math.pow((1+e.e*Math.sin(h))/(1-e.e*Math.sin(h)),e.alfa*e.e/2),n=2*(Math.atan(e.k*Math.pow(Math.tan(h/2+e.s45),e.alfa)/r)-e.s45),i=-u*e.alfa,o=Math.asin(Math.cos(e.ad)*Math.sin(n)+Math.sin(e.ad)*Math.cos(n)*Math.cos(i)),s=Math.asin(Math.cos(n)*Math.sin(i)/Math.cos(o)),a=e.n*s,c=e.ro0*Math.pow(Math.tan(e.s0/2+e.s45),e.n)/Math.pow(Math.tan(o/2+e.s45),e.n),t.y=c*Math.cos(a)/1,t.x=c*Math.sin(a)/1,e.czech||(t.y*=-1,t.x*=-1),t}function vT(e,t){var r,n,i,o,s,a,c,l,h=t.x;t.x=t.y,t.y=h,e.czech||(t.y*=-1,t.x*=-1),a=Math.sqrt(t.x*t.x+t.y*t.y),s=Math.atan2(t.y,t.x),o=s/Math.sin(e.s0),i=2*(Math.atan(Math.pow(e.ro0/a,1/e.n)*Math.tan(e.s0/2+e.s45))-e.s45),r=Math.asin(Math.cos(e.ad)*Math.sin(i)-Math.sin(e.ad)*Math.cos(i)*Math.cos(o)),n=Math.asin(Math.cos(i)*Math.sin(o)/Math.cos(r)),t.x=e.long0-n/e.alfa,c=r,l=0;var u=0;do t.y=2*(Math.atan(Math.pow(e.k,-1/e.alfa)*Math.pow(Math.tan(r/2+e.s45),1/e.alfa)*Math.pow((1+e.e*Math.sin(c))/(1-e.e*Math.sin(c)),e.e/2))-e.s45),Math.abs(c-t.y)<1e-10&&(l=1),c=t.y,u+=1;while(l===0&&u<15);return u>=15?null:t}function ET(e,t={}){let r={...e,s45:0,s90:0,fi0:0,e2:0,alfa:0,uq:0,u0:0,g:0,k:0,k1:0,n0:0,s0:0,n:0,ro0:0,ad:0,czech:!1,...t};return FB(r),r}Ee();wn();var Ay={name:"krovak",aliases:["Krovak","Krovak Modified","Krovak (North Orientated)","Krovak Modified (North Orientated)"],parameters:["lon_0","x_0","y_0","lat_0","k","k_0","czech","alpha","lat_ts"],flags:["czech"],create(e){let t=tt(e.parameters,"alpha",30.28813972222222),r=tt(e.parameters,"lat_ts",78.5);if(![30.28813972222222,30.28813975277778].some(s=>Math.abs(t-s)<=1e-10))throw new Error("Krovak requires its fixed cone-axis co-latitude");if(Math.abs(r-78.5)>1e-10)throw new Error("Krovak requires its fixed 78.5 degree pseudo standard parallel");let n=vt(e);n.lat0=Xo(e.parameters,"lat_0",49.5),n.long0=Xo(e.parameters,"lon_0",24.83333333333333),n.k0=tt(e.parameters,"k_0",tt(e.parameters,"k",.9999));let i=ET(n,{czech:si(e.parameters,"czech")}),o=Et("krovak",e,i,ST,vT);return Pt(o,K(n.long0-Math.PI/12,Math.max(-Math.PI/2+1e-8,n.lat0-Math.PI/36),n.long0+Math.PI/12,Math.min(Math.PI/2-1e-8,n.lat0+Math.PI/36)),s=>jE(Pe(i,e),s),n.primeMeridian,n.over)}};Ie();Ht();ne();fe();function TT(e,t){var r=t.x,n=t.y,i=G(r-e.long0,e.over),o=e.x0+e.a*i,s=e.y0+e.a*Math.log(Math.tan(Math.PI/4+n/2.5))*1.25;return t.x=o,t.y=s,t}function IT(e,t){t.x-=e.x0,t.y-=e.y0;var r=G(e.long0+t.x/e.a,e.over),n=2.5*(Math.atan(Math.exp(.8*t.y/e.a))-Math.PI/4);return t.x=r,t.y=n,t}function AT(e,t={}){let r={...e,...t};return r}var Py={name:"mill",aliases:["Miller_Cylindrical"],parameters:["lon_0","x_0","y_0"],create(e){let t=vt(e),r=AT(t),n=Et("mill",e,r,TT,IT);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>yr(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};Ie();Ht();ne();fe();function UB(e){e.x0=e.x0!==void 0?e.x0:0,e.y0=e.y0!==void 0?e.y0:0,e.long0=e.long0!==void 0?e.long0:0}function PT(e,t){var r=t.x,n=t.y,i=G(r-e.long0,e.over);let o=Math.sin(Math.abs(n)),s=Math.cos(n),a=Math.abs(n)===Math.PI/2?0:Math.PI*s*s/(1+o),c=Math.cbrt(6*a),l=0,h=Math.PI;c=Math.min(c,h);for(let d=0;d<32&&c>0;d++){let m=NT(c)-a,p=m/(2*Math.sin(c/2)**2);if(Math.abs(p)<=16*Number.EPSILON*c)break;m>0?h=c:l=c;let g=c-p;if(g===c||h-l<=8*Number.EPSILON*Math.max(1,c))break;if(c=g>=l&&g<=h?g:(l+h)/2,d===31)throw new Error("Mollweide forward did not converge")}var u=2*Math.SQRT2/Math.PI*e.a*i*Math.sin(c/2)+e.x0,f=Math.sign(n)*Math.SQRT2*e.a*Math.cos(c/2)+e.y0;return t.x=u,t.y=f,t}function RT(e,t){let r=t.x-e.x0,n=(t.y-e.y0)/(Math.SQRT2*e.a);if(Math.abs(n)>1+8*Number.EPSILON)return null;let i=r/(2*Math.SQRT2*e.a),o=i*i+n*n;if(!e.over&&o>1+8*Number.EPSILON)return null;let s=2*Math.acos(Math.min(1,Math.abs(n))),a=Math.sin(s/2);if(!e.over&&Math.abs(o-1)<=8*Number.EPSILON&&(a=Math.min(1,Math.abs(i)),s=2*Math.asin(a)),a===0&&Math.abs(r)>8*Number.EPSILON*e.a)return null;let c=a===0?0:Math.PI*i/a;var l=G(e.long0+c,e.over),h=Math.sign(n)*(Math.PI/2-2*Math.asin(Math.sqrt(NT(s)/(2*Math.PI))));return t.x=l,t.y=h,t}function CT(e,t={}){let r={...e,...t};return UB(r),r}function NT(e){if(e>.5)return e-Math.sin(e);let t=e*e;return e*t*(1/6+t*(-1/120+t*(1/5040+t*(-1/362880+t*(1/39916800+t*(-1/6227020800+t/1307674368e3))))))}var Ry={name:"moll",aliases:["Mollweide"],parameters:["lon_0","x_0","y_0"],create(e){let t=vt(e),r=CT(t),n=Et("moll",e,r,PT,RT);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>yr(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};Ht();ne();Ae();function GB(e){e.A=[],e.A[1]=.6399175073,e.A[2]=-.1358797613,e.A[3]=.063294409,e.A[4]=-.02526853,e.A[5]=.0117879,e.A[6]=-.0055161,e.A[7]=.0026906,e.A[8]=-.001333,e.A[9]=67e-5,e.A[10]=-34e-5,e.B_re=[],e.B_im=[],e.B_re[1]=.7557853228,e.B_im[1]=0,e.B_re[2]=.249204646,e.B_im[2]=.003371507,e.B_re[3]=-.001541739,e.B_im[3]=.04105856,e.B_re[4]=-.10162907,e.B_im[4]=.01727609,e.B_re[5]=-.26623489,e.B_im[5]=-.36249218,e.B_re[6]=-.6870983,e.B_im[6]=-1.1651967,e.C_re=[],e.C_im=[],e.C_re[1]=1.3231270439,e.C_im[1]=0,e.C_re[2]=-.577245789,e.C_im[2]=-.007809598,e.C_re[3]=.508307513,e.C_im[3]=-.112208952,e.C_re[4]=-.15094762,e.C_im[4]=.18200602,e.C_re[5]=1.01418179,e.C_im[5]=1.64497696,e.C_re[6]=1.9660549,e.C_im[6]=2.5127645,e.D=[],e.D[1]=1.5627014243,e.D[2]=.5185406398,e.D[3]=-.03333098,e.D[4]=-.1052906,e.D[5]=-.0368594,e.D[6]=.007317,e.D[7]=.0122,e.D[8]=.00394,e.D[9]=-.0013}function BT(e,t){var r,n=t.x,i=t.y,o=i-e.lat0,s=n-e.long0,a=o/Bh*1e-5,c=s,l=1,h=0;for(r=1;r<=10;r++)l=l*a,h=h+e.A[r]*l;var u=h,f=c,d=1,m=0,p,g,y=0,_=0;for(r=1;r<=6;r++)p=d*u-m*f,g=m*u+d*f,d=p,m=g,y=y+e.B_re[r]*d-e.B_im[r]*m,_=_+e.B_im[r]*d+e.B_re[r]*m;return t.x=_*e.a+e.x0,t.y=y*e.a+e.y0,t}function OT(e,t){var r,n=t.x,i=t.y,o=n-e.x0,s=i-e.y0,a=s/e.a,c=o/e.a,l=1,h=0,u,f,d=0,m=0;for(r=1;r<=6;r++)u=l*a-h*c,f=h*a+l*c,l=u,h=f,d=d+e.C_re[r]*l-e.C_im[r]*h,m=m+e.C_im[r]*l+e.C_re[r]*h;for(var p=0;p<e.iterations;p++){var g=d,y=m,_,M,x=a,v=c;for(r=2;r<=6;r++)_=g*d-y*m,M=y*d+g*m,g=_,y=M,x=x+(r-1)*(e.B_re[r]*g-e.B_im[r]*y),v=v+(r-1)*(e.B_im[r]*g+e.B_re[r]*y);g=1,y=0;var T=e.B_re[1],S=e.B_im[1];for(r=2;r<=6;r++)_=g*d-y*m,M=y*d+g*m,g=_,y=M,T=T+r*(e.B_re[r]*g-e.B_im[r]*y),S=S+r*(e.B_im[r]*g+e.B_re[r]*y);var E=T*T+S*S;d=(x*T+v*S)/E,m=(v*T-x*S)/E}var N=d,O=m,C=1,R=0;for(r=1;r<=9;r++)C=C*N,R=R+e.D[r]*C;var W=e.lat0+R*Bh*1e5,j=e.long0+O;return t.x=j,t.y=W,t}function LT(e,t={}){let r={...e,A:[],B_re:[],B_im:[],C_re:[],C_im:[],D:[],iterations:1,...t};return GB(r),r}Ee();var Cy={name:"nzmg",aliases:["New_Zealand_Map_Grid"],parameters:["lon_0","x_0","y_0","lat_0","iterations"],create(e){let t=vt(e),r=tt(e.parameters,"iterations",1);if(!Number.isInteger(r)||r<0||r>10)throw new Error("NZMG iterations must be an integer from 0 to 10");if(!Object.prototype.hasOwnProperty.call(e.parameters,"lat_0")||!Object.prototype.hasOwnProperty.call(e.parameters,"lon_0"))throw new Error("NZMG requires lat_0 and lon_0");let n=LT(t,{iterations:r}),i=Et("nzmg",e,n,BT,OT);return Pt(i,K(t.long0-Math.PI/22.5,Math.max(-Math.PI/2,t.lat0-Math.PI/22.5),t.long0+Math.PI/22.5,Math.min(Math.PI/2,t.lat0+Math.PI/22.5)),o=>WE(Pe(n,e),o),t.primeMeridian,t.over)}};Ht();ne();Dh();fe();Ad();Ae();var sl=1e-7;function zB(e){return e.no_uoff||e.no_off||["hotineobliquemercator","hotineobliquemercatorvarianta","hotineobliquemercatorazimuthnaturalorigin"].includes(e.projName.toLowerCase().replace(/[ _-]/g,""))}function VB(e){var t,r,n,i,o,s,a,c,l,h,u=0,f,d=0,m=0,p=0,g=0,y=0,_=0;e.k0||(e.k0=1),e.no_off=zB(e),e.no_rot=e.no_rot;var M=!1;Number.isFinite(e.alpha)&&(M=!0);var x=!1;if(Number.isFinite(e.rectified_grid_angle)&&(x=!0),M&&(_=e.alpha),x&&(u=e.rectified_grid_angle,M||(_=0,M=!0)),M||x)d=e.longc;else if(m=e.long1,g=e.lat1,p=e.long2,y=e.lat2,Math.abs(g-y)<=sl||Math.abs(g)<=sl||Math.abs(Math.abs(g)-U)<=sl||Math.abs(Math.abs(e.lat0)-U)<=sl||Math.abs(Math.abs(y)-U)<=sl)throw new Error;var v=1-e.es;if(r=Math.sqrt(v),Math.abs(e.lat0)>1e-10?(c=Math.sin(e.lat0),n=Math.cos(e.lat0),t=1-e.es*c*c,e.B=n*n,e.B=Math.sqrt(1+e.es*e.B*e.B/v),e.A=e.B*e.k0*r/t,i=e.B*r/(n*Math.sqrt(t)),o=i*i-1,o<=0?o=0:(o=Math.sqrt(o),e.lat0<0&&(o=-o)),e.E=o+=i,e.E*=Math.pow(Lr(e.e,e.lat0,c),e.B)):(e.B=1/r,e.A=e.k0,e.E=i=o=1),M||x){M?(f=Math.asin(Math.sin(_)/i),x||(u=_)):(f=u,_=Math.asin(i*Math.sin(f)));let T=.5*(o-1/o)*Math.tan(f);i>1&&Math.abs(Math.cos(_))<=8*Number.EPSILON?T=Math.sign(e.lat0)*Math.sign(Math.sin(_)):Math.abs(T)>1&&Math.abs(T)<=1+8*Number.EPSILON&&(T=Math.sign(T)),e.lam0=d-Math.asin(T)/e.B}else s=Math.pow(Lr(e.e,g,Math.sin(g)),e.B),a=Math.pow(Lr(e.e,y,Math.sin(y)),e.B),o=e.E/s,l=(a-s)/(a+s),h=e.E*e.E,h=(h-a*s)/(h+a*s),t=m-p,t<-Math.PI?p-=Jo:t>Math.PI&&(p+=Jo),e.lam0=G(.5*(m+p)-Math.atan(h*Math.tan(.5*e.B*(m-p))/l)/e.B,e.over),f=Math.atan(2*Math.sin(e.B*G(m-e.lam0,e.over))/(o-1/o)),u=_=Math.asin(i*Math.sin(f));e.singam=Math.sin(f),e.cosgam=Math.cos(f),e.sinrot=Math.sin(u),e.cosrot=Math.cos(u),e.rB=1/e.B,e.ArB=e.A*e.rB,e.BrA=1/e.ArB,e.no_off?e.u_0=0:(e.u_0=Math.abs(e.ArB*Math.atan(Math.sqrt(i*i-1)/Math.cos(_))),e.lat0<0&&(e.u_0=-e.u_0)),o=.5*f,e.v_pole_n=e.ArB*Math.log(Math.tan($t-o)),e.v_pole_s=e.ArB*Math.log(Math.tan($t+o))}function DT(e,t){var r=t,n,i,o,s,a,c,l,h;if(t.x=t.x-e.lam0,Math.abs(Math.abs(t.y)-U)>1e-10){if(a=e.E/Math.pow(Lr(e.e,t.y,Math.sin(t.y)),e.B),c=1/a,n=.5*(a-c),i=.5*(a+c),s=Math.sin(e.B*t.x),o=(n*e.singam-s*e.cosgam)/i,Math.abs(Math.abs(o)-1)<1e-10)throw new Error;h=.5*e.ArB*Math.log((1-o)/(1+o)),c=Math.cos(e.B*t.x),Math.abs(c)<sl?l=e.A*t.x:l=e.ArB*Math.atan2(n*e.cosgam+s*e.singam,c)}else h=t.y>0?e.v_pole_n:e.v_pole_s,l=e.ArB*t.y;return e.no_rot?(r.x=l,r.y=h):(l-=e.u_0,r.x=h*e.cosrot+l*e.sinrot,r.y=l*e.cosrot-h*e.sinrot),r.x=e.a*r.x+e.x0,r.y=e.a*r.y+e.y0,r}function FT(e,t){var r,n,i,o,s,a,c,l=t;if(t.x=(t.x-e.x0)*(1/e.a),t.y=(t.y-e.y0)*(1/e.a),e.no_rot?(n=t.y,r=t.x):(n=t.x*e.cosrot-t.y*e.sinrot,r=t.y*e.cosrot+t.x*e.sinrot+e.u_0),i=Math.exp(-e.BrA*n),o=.5*(i-1/i),s=.5*(i+1/i),a=Math.sin(e.BrA*r),c=(a*e.cosgam+o*e.singam)/s,Math.abs(Math.abs(c)-1)<1e-10)l.x=0,l.y=c<0?-U:U;else{if(l.y=e.E/Math.sqrt((1+c)/(1-c)),l.y=Sa(e.e,Math.pow(l.y,1/e.B)),l.y===1/0)throw new Error;l.x=-e.rB*Math.atan2(o*e.cosgam-a*e.singam,Math.cos(e.BrA*r))}return l.x+=e.lam0,l}function UT(e,t={}){let r={...e,no_off:!1,no_rot:!1,alpha:NaN,rectified_grid_angle:NaN,longc:0,long1:0,long2:0,B:0,A:0,E:0,lam0:0,singam:0,cosgam:0,sinrot:0,cosrot:0,rB:0,ArB:0,BrA:0,u_0:0,v_pole_n:0,v_pole_s:0,no_uoff:!1,projName:"",...t};return VB(r),r}Ee();wn();var Ny={name:"omerc",aliases:["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Variant_B","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","Oblique_Mercator"],parameters:["lon_0","x_0","y_0","lat_0","k","k_0","alpha","gamma","lonc","lon_1","lon_2","lat_1","lat_2","no_off","no_uoff","no_rot"],flags:["no_off","no_uoff","no_rot"],create(e){let t=vt(e);if(Math.abs(t.lat0)>=Math.PI/2)throw new Error("Oblique Mercator origin must be away from the poles");let n=Object.prototype.hasOwnProperty.call(e.parameters,"alpha")||Object.prototype.hasOwnProperty.call(e.parameters,"gamma")?["lonc"]:["lon_1","lat_1","lon_2","lat_2"];for(let s of n)if(!Object.prototype.hasOwnProperty.call(e.parameters,s))throw new Error("Oblique Mercator requires "+s);let i=UT(t,{projName:e.parameters.proj||"omerc",alpha:tt(e.parameters,"alpha",NaN)*Math.PI/180,rectified_grid_angle:tt(e.parameters,"gamma",NaN)*Math.PI/180,longc:tt(e.parameters,"lonc",0)*Math.PI/180,long1:tt(e.parameters,"lon_1",0)*Math.PI/180,long2:tt(e.parameters,"lon_2",0)*Math.PI/180,no_off:si(e.parameters,"no_off"),no_uoff:si(e.parameters,"no_uoff"),no_rot:si(e.parameters,"no_rot")}),o=Et("omerc",e,i,DT,FT);return Pt(o,K(i.lam0-Math.PI/18,Math.max(-Math.PI/2+1e-8,t.lat0-Math.PI/18),i.lam0+Math.PI/18,Math.min(Math.PI/2-1e-8,t.lat0+Math.PI/18)),s=>qE(Pe(i,e),s),t.primeMeridian,t.over)}};rs();ns();fe();function GT(e){let t=Math.sin(e.lat0),r=Math.cos(e.lat0),n=1/Math.sqrt(1-e.es*t*t);return{...e,sin0:t,cos0:r,originY:-e.es*n*t*r}}function zT(e,t){let r=G(t.x-e.long0,e.over),n=Math.sin(t.y),i=Math.cos(t.y),o=1/Math.sqrt(1-e.es*n*n);return t.x=e.x0+e.a*e.k0*o*i*Math.sin(r),t.y=e.y0+e.a*e.k0*(o*((1-e.es)*n*e.cos0-i*Math.cos(r)*e.sin0)-e.originY),t}function VT(e,t){let r=(t.x-e.x0)/(e.a*e.k0),n=(t.y-e.y0)/(e.a*e.k0)+e.originY,i=1-e.es,o=e.cos0*e.cos0+e.sin0*e.sin0/i,s=n*e.sin0*e.cos0*e.es/i,a=r*r+n*n*(e.sin0*e.sin0+e.cos0*e.cos0/i)-1,c=s*s-o*a;if(c<-32*Number.EPSILON*o)throw new Error("Coordinate is outside the orthographic ellipse");let l=(-s+Math.sqrt(Math.max(0,c)))/o,h=l*e.cos0-n*e.sin0,u=l*e.sin0+n*e.cos0;return t.x=G(e.long0+Math.atan2(r,h),e.over),t.y=Math.atan2(u,i*Math.hypot(h,r)),t}var By={name:"ortho",aliases:[],parameters:["lon_0","x_0","y_0","lat_0","k","k_0"],create(e){let t=vt(e),r=GT(t);return rn(Et("ortho",e,r,zT,VT,as(t,0,!0)),t,Math.PI/2,(n,i)=>xS(Pe(t,e),n,i),Math.PI/2)}};Ht();ne();fe();var kT=20;function kB(e){e.meridianPole=Sn(e.a,e.es,0,Math.PI/2),e.poleRadius=e.a/Math.sqrt(1-e.es),e.ml0=Sn(e.a,e.es,0,e.lat0)}function jT(e,t){var r=t.x,n=t.y,i,o,s,a=G(r-e.long0,e.over);if(s=a*Math.sin(n),e.sphere)n===0?(i=e.a*a,o=-1*e.a*e.lat0):(i=e.a*Math.sin(s)/Math.tan(n),o=e.a*(n-e.lat0+2*Math.sin(s/2)**2/Math.tan(n)));else if(n===0)i=e.a*a,o=-1*e.ml0;else{var c=tl(e.a,e.e,Math.sin(n))/Math.tan(n);i=c*Math.sin(s),o=Sn(e.a,e.es,e.lat0,n)+c*(2*Math.sin(s/2)**2)}return t.x=i+e.x0,t.y=o+e.y0,t}function WT(e,t){var r,n,i,o,s,a,c,l,h;i=t.x-e.x0,o=t.y-e.y0;let u=o+(e.sphere?e.a*e.lat0:e.ml0),f=u<0?-1:1,m=(e.sphere?e.a*Math.PI/2:e.meridianPole)-f*u,p=Math.hypot(i,m);if(p/e.a<1e-6)return t.x=G(e.long0+Math.atan2(i,m),e.over),t.y=f*(Math.PI/2-p/e.poleRadius),t;if(e.sphere)if(Math.abs(o+e.a*e.lat0)<=1e-10)r=G(i/e.a+e.long0,e.over),n=0;else{a=e.lat0+o/e.a,c=i*i/e.a/e.a+a*a,l=a;var g;for(s=kT;s;--s)if(g=Math.tan(l),h=-1*(a*(l*g+1)-l-.5*(l*l+c)*g)/((l-a)/g-1),l+=h,Math.abs(h)<=1e-14){n=l;break}if(n=qT(e,n===void 0?l:n,i,o),n===void 0)return null;l=n,r=G(e.long0+Math.asin(i*Math.tan(l)/e.a)/Math.sin(n),e.over)}else if(Math.abs(o+e.ml0)<=1e-10)n=0,r=G(e.long0+i/e.a,e.over);else{a=(e.ml0+o)/e.a,c=i*i/e.a/e.a+a*a,l=a;var y,_,M,x,v;for(s=kT;s;--s)if(v=e.e*Math.sin(l),y=Math.sqrt(1-v*v)*Math.tan(l),_=Sn(e.a,e.es,0,l),M=(1-e.es)/Math.pow(1-v*v,1.5),x=_/e.a,h=(a*(y*x+1)-x-.5*y*(x*x+c))/(e.es*Math.sin(2*l)*(x*x+c-2*a*x)/(4*y)+(a-x)*(y*M-2/Math.sin(2*l))-M),l-=h,Math.abs(h)<=1e-14){n=l;break}if(n=qT(e,n===void 0?l:n,i,o),n===void 0)return null;l=n,y=Math.sqrt(1-e.es*Math.pow(Math.sin(n),2))*Math.tan(n),r=G(e.long0+Math.asin(i*y/e.a)/Math.sin(n),e.over)}return t.x=r,t.y=n,t}function HT(e,t={}){let r={...e,ml0:0,meridianPole:0,poleRadius:0,...t};return kB(r),r}function qT(e,t,r,n){for(let i=0;i<8;i++){if(!Number.isFinite(t)||Math.abs(t)>=Math.PI/2)return;let o=Math.sin(t),s=Math.cos(t),a=1-e.es*o*o,c=e.sphere?e.a:tl(e.a,e.e,o),l=c/Math.tan(t),h=Math.asin(r/l),u=l*Math.sin(h),f=2*Math.sin(h/2)**2,d=e.sphere?e.a*(t-e.lat0):Sn(e.a,e.es,e.lat0,t),m=l*f,g=d+m-n;if(Math.abs(u-r)<=64*Number.EPSILON*Math.max(e.a,Math.abs(r))&&Math.abs(g)<=64*Number.EPSILON*Math.max(Math.abs(n),Math.abs(d),Math.abs(m),e.a*Math.max(Math.abs(t),Math.abs(e.lat0))))return t;let y=e.sphere?e.a:e.a*(1-e.es)/Math.pow(a,1.5),_=c*((e.sphere?0:e.es*s*s/a)-1/(o*o)),M=y+_*(-f/Math.cos(h)),x=g/M;if(!Number.isFinite(x)||Math.abs(x)>1e-6)return;t-=x}}var Oy={name:"poly",aliases:["Polyconic","American_Polyconic"],parameters:["lon_0","x_0","y_0","lat_0"],create(e){let t=vt(e),r=HT(t),n=Et("poly",e,r,jT,WT);return Pt(n,K(t.long0-Math.PI/6,Math.max(-Math.PI/2+1e-8,t.lat0-Math.PI/2+1e-8),t.long0+Math.PI/6,Math.min(Math.PI/2-1e-8,t.lat0+Math.PI/2-1e-8)),i=>zE(Pe(t,e),n.forward,i),t.primeMeridian,t.over)}};ya();Ee();Ae();var Re={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},ae={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function qB(e){e.x0=e.x0||0,e.y0=e.y0||0,e.lat0=e.lat0||0,e.long0=e.long0||0,e.lat_ts=e.lat_ts||0,e.lat0>=U-$t/2?e.face=Re.TOP:e.lat0<=-(U-$t/2)?e.face=Re.BOTTOM:Math.abs(e.long0)<=$t?e.face=Re.FRONT:Math.abs(e.long0)<=U+$t?e.face=e.long0>0?Re.RIGHT:Re.LEFT:e.face=Re.BACK,e.es!==0&&(e.one_minus_f=1-(e.a-e.b)/e.a,e.one_minus_f_squared=e.one_minus_f*e.one_minus_f)}function $T(e,t){var r=t,n,i,o,s,a,c,l=0;if(t.x-=e.long0,e.es!==0?n=Math.atan(e.one_minus_f_squared*Math.tan(t.y)):n=t.y,i=t.x,e.face===Re.TOP)s=U-n,i>=$t&&i<=U+$t?(l=ae.AREA_0,o=i-U):i>U+$t||i<=-(U+$t)?(l=ae.AREA_1,o=i>0?i-Math.PI:i+Math.PI):i>-(U+$t)&&i<=-$t?(l=ae.AREA_2,o=i+U):(l=ae.AREA_3,o=i);else if(e.face===Re.BOTTOM)s=U+n,i>=$t&&i<=U+$t?(l=ae.AREA_0,o=-i+U):i<$t&&i>=-$t?(l=ae.AREA_1,o=-i):i<-$t&&i>=-(U+$t)?(l=ae.AREA_2,o=-i-U):(l=ae.AREA_3,o=i>0?-i+Math.PI:-i-Math.PI);else{var h,u,f,d,m,p,g;e.face===Re.RIGHT?i=al(i,+U):e.face===Re.BACK?i=al(i,+Math.PI):e.face===Re.LEFT&&(i=al(i,-U)),d=Math.sin(n),m=Math.cos(n),p=Math.sin(i),g=Math.cos(i),h=m*g,u=m*p,f=d,e.face===Re.FRONT?(s=Math.atan2(Math.hypot(u,f),h),o=gm(s,f,u)):e.face===Re.RIGHT?(s=Math.atan2(Math.hypot(h,f),u),o=gm(s,f,-h)):e.face===Re.BACK?(s=Math.atan2(Math.hypot(u,f),-h),o=gm(s,f,-u)):e.face===Re.LEFT?(s=Math.atan2(Math.hypot(h,f),-u),o=gm(s,f,h)):s=o=0,Math.abs(o)<=$t?l=ae.AREA_0:o>$t&&o<=U+$t?(l=ae.AREA_1,o-=U):o>U+$t||o<=-(U+$t)?(l=ae.AREA_2,o=o>=0?o-Math.PI:o+Math.PI):(l=ae.AREA_3,o+=U)}return c=Math.atan(12/Math.PI*(o+Math.acos(Math.sin(o)*Math.cos($t))-U)),a=Math.sqrt(2*Math.sin(s/2)**2/(Math.cos(c)*Math.cos(c))/(1-Math.cos(Math.atan(1/Math.cos(o))))),l===ae.AREA_1?c+=U:l===ae.AREA_2?c+=Math.PI:l===ae.AREA_3&&(c+=1.5*Math.PI),r.x=a*Math.cos(c),r.y=a*Math.sin(c),r.x=r.x*e.a+e.x0,r.y=r.y*e.a+e.y0,t}function YT(e,t){var r=0,n=0,i,o,s,a,c,l,h,u,f=0;t.x=(t.x-e.x0)/e.a,t.y=(t.y-e.y0)/e.a,i=Math.atan2(t.y,t.x),t.x>=0&&t.x>=Math.abs(t.y)?f=ae.AREA_0:t.y>=0&&t.y>=Math.abs(t.x)?(f=ae.AREA_1,i-=U):t.x<0&&-t.x>=Math.abs(t.y)?(f=ae.AREA_2,i=i<0?i+Math.PI:i-Math.PI):(f=ae.AREA_3,i+=U),u=Math.PI/12*Math.tan(i),a=Math.sin(u)/(Math.cos(u)-1/Math.sqrt(2)),c=Math.atan(a),o=Math.cos(i),s=Math.hypot(t.x,t.y);let d=o*o*s*s*(1-Math.cos(Math.atan(1/Math.cos(c))));if(l=1-d,l<-1?l=-1:l>1&&(l=1),e.face===Re.TOP)h=2*Math.asin(Math.sqrt(Math.min(1,d/2))),n=U-h,f===ae.AREA_0?r=c+U:f===ae.AREA_1?r=c<0?c+Math.PI:c-Math.PI:f===ae.AREA_2?r=c-U:r=c;else if(e.face===Re.BOTTOM)h=2*Math.asin(Math.sqrt(Math.min(1,d/2))),n=h-U,f===ae.AREA_0?r=-c+U:f===ae.AREA_1?r=-c:f===ae.AREA_2?r=-c-U:r=c<0?-c-Math.PI:-c+Math.PI;else{var m,p,g;m=l;let y=Math.sqrt(Math.max(0,d*(2-d)));g=y*Math.sin(c),p=y*Math.cos(c),f===ae.AREA_1?(u=p,p=-g,g=u):f===ae.AREA_2?(p=-p,g=-g):f===ae.AREA_3&&(u=p,p=g,g=-u),e.face===Re.RIGHT?(u=m,m=-p,p=u):e.face===Re.BACK?(m=-m,p=-p):e.face===Re.LEFT&&(u=m,m=p,p=-u),n=Math.atan2(g,Math.hypot(m,p)),r=Math.atan2(p,m),e.face===Re.RIGHT?r=al(r,-U):e.face===Re.BACK?r=al(r,-Math.PI):e.face===Re.LEFT&&(r=al(r,+U))}return e.es!==0&&(n=Math.atan2(Math.sin(n),e.one_minus_f_squared*Math.cos(n))),r+=e.long0,t.x=r,t.y=n,t}function gm(e,t,r){return e===0?0:Math.atan2(t,r)}function al(e,t){var r=e+t;return r<-Math.PI?r+=Jo:r>+Math.PI&&(r-=Jo),r}function KT(e,t={}){let r={...e,face:0,one_minus_f:0,one_minus_f_squared:0,...t};return qB(r),r}Ht();ne();xa();Ie();var Ly={name:"qsc",aliases:["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube"],parameters:["lon_0","x_0","y_0","lat_0"],create(e){let t=vt(e),r=e.primeMeridian??0,n=KT(t),i=Et("qsc",e,n,$T,YT),o=tt(e.parameters,"x_0",0),s=tt(e.parameters,"y_0",0);return{...i,longitudeOrigin:t.long0,getRenderingProfile(a){if(a)return Ke(u=>{let f=y=>t.es?Math.atan((1-t.es)*Math.tan(y)):y,d=K(u[0][0]-t.long0,f(u[0][1]),u[1][0]-t.long0,f(u[1][1])),m=n.face===5?[0,0,1]:n.face===6?[0,0,-1]:[1,0,0],p=se(m,d)[0],g=t.a*Math.sqrt((1-p)/(.5*(1-Math.SQRT1_2)));return re([o-g,o+g],[s-g,s+g])},a,t.long0,r);let c=[[o-t.a,s-t.a,0],[o+t.a,s+t.a,0]],l=os(e.parameters,r)().normalize,h=Yo(u=>{let[f,d]=i.forward(u.x,u.y);Math.abs(f-o)<=t.a&&Math.abs(d-s)<=t.a||([u.x,u.y]=i.inverse(o+Math.max(-t.a,Math.min(t.a,f-o)),s+Math.max(-t.a,Math.min(t.a,d-s))))},r);return{bounds:c,normalize(u){l(u),h(u)}}}}}};Ie();Ht();ne();Ae();fe();var cl=[[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]],cs=[[-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]];cl=cl.map(e=>e.map(Math.fround));cs=cs.map(e=>e.map(Math.fround));var XT=.8487,ZT=1.3523,JT=p1/5,jB=1/JT,Ra=18,ym=function(e,t){return e[0]+t*(e[1]+t*(e[2]+t*e[3]))},WB=function(e,t){return e[1]+t*(2*e[2]+t*3*e[3])};function HB(e,t,r,n,i){for(var o=r;i;--i){var s=(ym(e,o)-t)/WB(e,o);if(o-=s,Math.abs(s)<n)break}return o}function $B(e){e.x0=e.x0||0,e.y0=e.y0||0,e.long0=e.long0||0,e.es=0}function QT(e,t){var r=G(t.x-e.long0,e.over),n=Math.abs(t.y),i=Math.floor(n*JT+1e-15);i<0?i=0:i>=Ra&&(i=Ra),n=p1*(n-jB*i);var o=ym(cl[i],n)*r,s=ym(cs[i],n);return t.y<0&&(s=-s),t.x=o*e.a*XT+e.x0,t.y=s*e.a*ZT+e.y0,t}function tI(e,t){var r=t.y,n=t;n.x=(n.x-e.x0)/(e.a*XT),n.y=Math.abs(r-e.y0)/(e.a*ZT);for(let a=0;a<=Ra;a++)if(Math.abs(n.y-cs[a][0])<=8*Number.EPSILON)return n.x=G(n.x/cl[a][0]+e.long0,e.over),n.y=(r<e.y0?-1:1)*a*5*m1,n;if(n.y>=1)n.x/=cl[Ra][0],n.y=r<0?-U:U;else{var i=Math.floor(n.y*Ra);for(i<0?i=0:i>=Ra&&(i=Ra-1);;)if(cs[i][0]>n.y)--i;else if(cs[i+1][0]<=n.y)++i;else break;var o=cs[i],s=5*(n.y-o[0])/(cs[i+1][0]-o[0]);s=HB(o,n.y,s,1e-10,100),n.x/=ym(cl[i],s),n.y=(5*i+s)*m1,r<0&&(n.y=-n.y)}return n.x=G(n.x+e.long0,e.over),n}function eI(e,t={}){let r={...e,...t};return $B(r),r}var Dy={name:"robin",aliases:["Robinson"],parameters:["lon_0","x_0","y_0"],create(e){let t=vt(e),r=eI(t),n=Et("robin",e,r,QT,tI);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>yr(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};Ie();Ht();ne();var Fy={name:"sinu",aliases:["Sinusoidal"],parameters:["lon_0","x_0","y_0"],create(e){let t=vt(e),r=tT(t),n=Et("sinu",e,r,fm,dm);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>yr(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};Ht();ne();function YB(e){e.k0||(e.k0=1);var t=e.lat0;e.lambda0=e.long0;var r=Math.sin(t),n=e.a,i=e.rf,o=1/i,s=2*o-Math.pow(o,2);e.e=Math.sqrt(s);var a=e.e;e.R=e.k0*n*Math.sqrt(1-s)/(1-s*Math.pow(r,2)),e.alpha=Math.sqrt(1+s/(1-s)*Math.pow(Math.cos(t),4)),e.b0=Math.asin(r/e.alpha);var c=Math.log(Math.tan(Math.PI/4+e.b0/2)),l=Math.log(Math.tan(Math.PI/4+t/2)),h=Math.log((1+a*r)/(1-a*r));e.K=c-e.alpha*l+e.alpha*a/2*h}function rI(e,t){let r=e.e*Math.sin(t.y),n=2*Math.atan(Math.exp(e.alpha*(Math.log(Math.tan(Math.PI/4+t.y/2))-e.e/2*Math.log((1+r)/(1-r)))+e.K))-Math.PI/2,i=e.alpha*(t.x-e.lambda0),o=Math.cos(n),s=Math.asin(Math.cos(e.b0)*Math.sin(n)-Math.sin(e.b0)*o*Math.cos(i)),a=Math.asin(o*Math.sin(i)/Math.cos(s));return t.x=e.x0+e.R*a,t.y=e.y0+e.R*Math.log(Math.tan(Math.PI/4+s/2)),t}function nI(e,t){let r=(t.x-e.x0)/e.R,n=2*(Math.atan(Math.exp((t.y-e.y0)/e.R))-Math.PI/4),i=Math.asin(Math.cos(e.b0)*Math.sin(n)+Math.sin(e.b0)*Math.cos(n)*Math.cos(r)),o=Math.asin(Math.cos(n)*Math.sin(r)/Math.cos(i)),s=(e.K-Math.log(Math.tan(Math.PI/4+i/2)))/e.alpha;for(let a=0;a<6;a++){let c=e.e*Math.sin(i),l=(s+Math.log(Math.tan(Math.PI/4+i/2))-e.e/2*Math.log((1+c)/(1-c)))*(1-c*c)*Math.cos(i)/(1-e.es);if(i-=l,Math.abs(l)<1e-10)return t.x=e.lambda0+o/e.alpha,t.y=i,t}return null}function iI(e,t={}){let r={...e,lambda0:0,rf:0,R:0,alpha:0,b0:0,K:0,...t};return YB(r),r}var Uy={name:"somerc",aliases:[],parameters:["lon_0","x_0","y_0","lat_0","k","k_0"],create(e){let t=vt(e),r=iI(t,{rf:t.a===t.b?1/0:1/(1-t.b/t.a)}),n=Et("somerc",e,r,rI,nI);return Pt(n,K(t.long0-Math.PI/18,Math.max(-Math.PI/2+1e-8,t.lat0-Math.PI/18),t.long0+Math.PI/18,Math.min(Math.PI/2-1e-8,t.lat0+Math.PI/18)),i=>kE(Pe(r,e),i),t.primeMeridian,t.over)}};rs();ns();Ae();Ma();var _r={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3};function KB(e){if(Math.abs(Math.abs(e.lat0)-U)<1e-10?e.mode=e.lat0<0?_r.S_POLE:_r.N_POLE:Math.abs(e.lat0)<1e-10?e.mode=_r.EQUIT:(e.mode=_r.OBLIQ,e.sinph0=Math.sin(e.lat0),e.cosph0=Math.cos(e.lat0)),e.pn1=e.h/e.a,e.pn1<=0||e.pn1>1e10)throw new Error("Invalid height");e.p=1+e.pn1,e.rp=1/e.p,e.h1=1/e.pn1,e.pfact=(e.p+1)*e.h1,e.es=0;var t=e.tilt,r=e.azi;e.cg=Math.cos(r),e.sg=Math.sin(r),e.cw=Math.cos(t),e.sw=Math.sin(t)}function oI(e,t){t.x-=e.long0;var r=Math.sin(t.y),n=Math.cos(t.y),i=Math.cos(t.x),o,s;switch(e.mode){case _r.OBLIQ:s=e.sinph0*r+e.cosph0*n*i;break;case _r.EQUIT:s=n*i;break;case _r.S_POLE:s=-r;break;case _r.N_POLE:s=r;break}switch(s=e.pn1/(e.p-s),o=s*n*Math.sin(t.x),e.mode){case _r.OBLIQ:s*=e.cosph0*r-e.sinph0*n*i;break;case _r.EQUIT:s*=r;break;case _r.N_POLE:s*=-(n*i);break;case _r.S_POLE:s*=n*i;break}var a,c;return a=s*e.cg+o*e.sg,c=1/(a*e.sw*e.h1+e.cw),o=(o*e.cg-s*e.sg)*e.cw*c,s=a*c,t.x=o*e.a,t.y=s*e.a,t}function sI(e,t){t.x/=e.a,t.y/=e.a;var r=t.x,n=t.y,i,o,s;s=1/(e.pn1-t.y*e.sw),i=e.pn1*t.x*s,o=e.pn1*t.y*e.cw*s,t.x=i*e.cg+o*e.sg,t.y=o*e.cg-i*e.sg;var a=qe(t.x,t.y);if(Math.abs(a)<1e-10)r=0,n=e.lat0;else{var c,l;switch(l=1-a*a*e.pfact,l=(e.p-Math.sqrt(l))/(e.pn1/a+a/e.pn1),c=Math.sqrt(1-l*l),e.mode){case _r.OBLIQ:n=Math.asin(c*e.sinph0+t.y*l*e.cosph0/a),t.y=(c-e.sinph0*Math.sin(n))*a,t.x*=l*e.cosph0;break;case _r.EQUIT:n=Math.asin(t.y*l/a),t.y=c*a,t.x*=l;break;case _r.N_POLE:n=Math.asin(c),t.y=-t.y;break;case _r.S_POLE:n=-Math.asin(c);break}r=Math.atan2(t.x,t.y)}return t.x=r+e.long0,t.y=n,t}function aI(e,t={}){let r={...e,mode:0,sinph0:0,cosph0:0,pn1:0,h:0,p:0,rp:0,h1:0,pfact:0,tilt:0,azi:0,cg:0,sg:0,cw:0,sw:0,...t};return KB(r),r}Ee();var Gy={name:"tpers",aliases:["Tilted_Perspective"],parameters:["lon_0","x_0","y_0","lat_0","h","tilt","azi"],create(e){let t=vt(e),r=tt(e.parameters,"h",1e5),n=tt(e.parameters,"tilt",0)*Math.PI/180,i=tt(e.parameters,"azi",0)*Math.PI/180;if(Math.abs(n)>=Math.PI/2)throw new Error("Perspective tilt must be between -90 and 90 degrees");let o=aI(t,{h:r,tilt:n,azi:i}),s=1+r/t.a,a=Math.acos(1/s),c=Math.abs(n),l=s*Math.cos(c)<1?c-Math.acos(s*Math.cos(c)):a,h=Math.min(a,l)*(1-1e-10);return rn(Et("tpers",e,o,oI,sI,as(t,1/(1+r/t.a))),t,h,(u,f)=>ES(Pe(t,e),s,n,i,u,f),a)}};Ie();Ht();ne();fe();Ae();function XB(e){e.R=e.a}function cI(e,t){var r=t.x,n=t.y,i=G(r-e.long0,e.over),o,s;if(Math.abs(n)<=1e-10)return o=e.x0+e.R*i,s=e.y0,t.x=o,t.y=s,t;var a=Aa(2*Math.abs(n/Math.PI));if(Math.abs(i)<=1e-10||Math.abs(Math.abs(n)-U)<=1e-10)return o=e.x0,n>=0?s=e.y0+Math.PI*e.R*Math.tan(.5*a):s=e.y0+Math.PI*e.R*-Math.tan(.5*a),t.x=o,t.y=s,t;var c=.5*Math.abs(Math.PI/i-i/Math.PI),l=c*c,h=Math.sin(a),u=Math.cos(a),f=u/(h-2*Math.sin(a/2)**2),d=f*f,m=f*(2/h-1),p=m*m,g=Math.sqrt(l*(f-p)*(f-p)-(p+l)*(d-p)),y=Math.PI*e.R*(p-d)/(g-c*(f-p));i<0&&(y=-y),o=e.x0+y;var _=l+f;return y=Math.PI*e.R*(l*(2*f-1)+d)/(m*_+c*Math.sqrt((p+l)*(l+1)-_*_)),n>=0?s=e.y0+y:s=e.y0-y,t.x=o,t.y=s,t}function lI(e,t){var r,n,i,o,s,a,c,l,h,u,f,d,m;return t.x-=e.x0,t.y-=e.y0,Math.abs(t.y)<1e-10?(t.x=G(e.long0+t.x/e.R,e.over),t.y=0,t):(f=Math.PI*e.R,i=t.x/f,o=t.y/f,s=i*i+o*o,a=-Math.abs(o)*(1+s),c=a-2*o*o+i*i,l=-2*a+1+2*o*o+s*s,m=o*o/l+(2*c*c*c/l/l/l-9*a*c/l/l)/27,h=(a-c*c/3/l)/l,u=2*Math.sqrt(-h/3),f=3*m/h/u,Math.abs(f)>1&&(f>=0?f=1:f=-1),d=Math.acos(f)/3,t.y>=0?n=(-u*Math.cos(d+Math.PI/3)-c/3/l)*Math.PI:n=-(-u*Math.cos(d+Math.PI/3)-c/3/l)*Math.PI,Math.abs(i)<1e-10?r=e.long0:r=G(e.long0+2*Math.PI*i/(Math.sqrt(1+2*(i*i-o*o)+s*s)+1-s),e.over),t.x=r,t.y=n,t)}function hI(e,t={}){let r={...e,R:0,...t};return XB(r),r}var zy={name:"vandg",aliases:["Van_der_Grinten_I","VanDerGrinten","Van_der_Grinten"],parameters:["lon_0","x_0","y_0"],create(e){let t=vt(e),r=hI(t),n=Et("vandg",e,r,cI,lI);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>Yx(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};wa();Ee();ya();ne();Ht();xa();var uI=["o_proj","o_alpha","o_lon_c","o_lat_c","o_lon_p","o_lat_p","o_lon_1","o_lat_1","o_lon_2","o_lat_2"],Vy=e=>e.toLowerCase().replace(/[ _-]/g,""),ky=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),hi=(e,t)=>tt(e,t,0)*Math.PI/180;function ZB(e){let t=[["o_alpha","o_lon_c","o_lat_c"],["o_lat_p","o_lon_p"],["o_lon_1","o_lat_1","o_lon_2","o_lat_2"]],r=t.find(c=>c.some(l=>ky(e,l)));if(!r)throw new Error("Oblique transformation requires a rotation parameter set");for(let c of r){if(!ky(e,c))throw new Error("Oblique transformation requires "+c);if(c.includes("lat")&&Math.abs(hi(e,c))>Math.PI/2)throw new Error("Invalid rotation latitude: "+c)}if(r===t[0]){let c=hi(e,"o_alpha"),l=hi(e,"o_lon_c"),h=hi(e,"o_lat_c");if(Math.abs(h)>=Math.PI/2-1e-10)throw new Error("Rotation center must be away from the poles");return{lamp:l+Math.atan2(-Math.cos(c),-Math.sin(c)*Math.sin(h)),phip:Math.asin(Math.cos(h)*Math.sin(c))}}if(r===t[1])return{lamp:hi(e,"o_lon_p"),phip:hi(e,"o_lat_p")};let n=hi(e,"o_lon_1"),i=hi(e,"o_lat_1"),o=hi(e,"o_lon_2"),s=hi(e,"o_lat_2");if(Math.abs(i)>=Math.PI/2-1e-10||Math.abs(s)>=Math.PI/2-1e-10||Math.abs(i)<1e-10||Math.abs(i-s)<1e-10)throw new Error("Invalid new-equator reference points");let a=Math.atan2(Math.cos(i)*Math.sin(s)*Math.cos(n)-Math.sin(i)*Math.cos(s)*Math.cos(o),Math.sin(i)*Math.cos(s)*Math.sin(o)-Math.cos(i)*Math.sin(s)*Math.sin(n));return{lamp:a,phip:Math.atan(-Math.cos(a-n)/Math.tan(i))}}function wm(e){let t=e==="longlat";if(!t&&["obtran","geocent"].includes(Vy(e.name)))throw new Error("Cannot wrap a composite or geocentric projection");return{name:"ob_tran",aliases:["General Oblique Transformation","General_Oblique_Transformation"],parameters:[...uI,"lon_0",...t?[]:e.parameters],flags:t?[]:e.flags,create(r){let{parameters:n}=r,i=n.o_proj,o=t?["longlat","latlong","lonlat","latlon","identity"]:[e.name,...e.aliases||[]];if(i&&!o.map(Vy).includes(Vy(i)))throw new xn("missing-plugin","Oblique transformation dependency does not match +o_proj="+i);let{lamp:s,phip:a}=ZB(n),c=Math.cos(a),l=Math.sin(a),h=Math.abs(a)>1e-10,u=hi(n,"lon_0"),f=ky(n,"over"),d={...n,proj:t?"longlat":i||e.name,lon_0:"0"};for(let S of uI)delete d[S];let m=t?jn(S=>{S.x*=180/Math.PI,S.y*=180/Math.PI},S=>{S.x*=Math.PI/180,S.y*=Math.PI/180}):e.create({...r,parameters:Object.freeze(d),primeMeridian:0}),p=co(m,!1),g=co(m,!0),y=S=>Math.asin(Math.max(-1,Math.min(1,S))),_=S=>{let E=S.x,N=S.y,O=ve(E-u,f),C=Math.cos(O),R=Math.sin(N),W=Math.cos(N),j=ve(Math.atan2(W*Math.sin(O),h?l*W*C+c*R:R)+s),A=y(h?l*R-c*W*C:-W*C);S.x=j,S.y=A},M=S=>{let E=S.x,N=S.y,O=E-s,C=Math.cos(O),R=Math.sin(N),W=Math.cos(N),j=Math.atan2(W*Math.sin(O),h?l*W*C-c*R:-R),A=y(h?l*R+c*W*C:W*C);S.x=ve(j+u),S.y=A},x=jn(S=>{_(S),p(S)},S=>{g(S),M(S)}),v=t?os(d):m.getRenderingProfile?.bind(m);if(!v)return x;let T=(S,E)=>{let N=E&&Ke(()=>S.bounds,E,u,r.primeMeridian??0,f),O=Yo(C=>{let R=C.x,W=C.y;_(C);let j=C.x*180/Math.PI,A=C.y*180/Math.PI,P={x:j,y:A,z:C.z};if(S.normalize?.(P),P.x===j&&P.y===A){C.x=R,C.y=W;return}C.x=P.x*Math.PI/180,C.y=P.y*Math.PI/180,M(C),f&&(C.x+=Math.round((R-C.x)/(2*Math.PI))*2*Math.PI)},r.primeMeridian??0);return{get bounds(){let C=S.bounds,R=W=>[W[0]*180/Math.PI,W[1]*180/Math.PI,W[2]];return t?[R(C[0]),R(C[1])]:C},normalize(C){N?.normalize(C),O(C)}}};return{...x,longitudeOrigin:u,getRenderingProfile(S){if(!S)return T(v());let E=$o(S,r.primeMeridian??0,u),N=K(E[0][0]-u,E[0][1],E[1][0]-u,E[1][1]),O=se(h?[-c,0,l]:[-1,0,0],N),C=h?[l,0,c]:[0,0,1],W=se(C,N)[0]>0?es([0,1,0],C,0,N).map(Math.atan):[-Math.PI,Math.PI];return T(v(yn(K(W[0]+s,y(O[0]),W[1]+s,y(O[1])))),S)}}}}}Pc();sg();Ee();function be(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Expected a CRS object");return e}function Xh(e){return Array.isArray(e)?e:[]}function Mr(e){return String(e||"").toLowerCase().replace(/[^a-z0-9]/g,"")}function cr(e){if(typeof e!="number"||!Number.isFinite(e))throw new Error("Expected a finite CRS parameter");return e}function sn(e,t){if(e===void 0)return t;if(typeof e=="object"){let i=cr(be(e).conversion_factor);if(i<=0)throw new Error("Unit conversion factor must be positive");return i}let n={metre:1,meter:1,degree:Me,radian:1,grad:Math.PI/200,gon:Math.PI/200,foot:.3048,ussurveyfoot:1200/3937,kilometre:1e3,arcsecond:Me/3600,partspermillion:1e-6,unity:1}[Mr(e)];return n||Ot("Unsupported CRS unit: "+String(e)),n}var JB={hotineobliquemercator:"omerc",hotineobliquemercatorvarianta:"omerc",hotineobliquemercatorvariantb:"omerc",hotineobliquemercatorazimuthnaturalorigin:"omerc",hotineobliquemercatorazimuthcenter:"omerc",obliquemercator:"omerc",krovak:"krovak",krovaknorthorientated:"krovak",quadrilateralizedsphericalcube:"qsc",transversemercator:"tmerc",transversemercatorsouthorientated:"unsupported-south-tmerc",mercator:"merc",mercator1sp:"merc",mercator2sp:"merc",mercatorvarianta:"merc",mercatorvariantb:"merc",mercatorauxiliarysphere:"webmerc",popularvisualisationpseudomercator:"webmerc",lambertconformalconic:"lcc",lambertconformalconic1sp:"lcc",lambertconformalconic2sp:"lcc",lambertconicconformal1sp:"lcc",lambertconicconformal2sp:"lcc",albers:"aea",albersconicequalarea:"aea",albersequalarea:"aea",equidistantconic:"eqdc",lambertazimuthalequalarea:"laea",stereographic:"stere",stereographicnorthpole:"sterea",stereographicsouthpole:"stere",polarstereographic:"stere",polarstereographicvarianta:"stere",polarstereographicvariantb:"stere",obliquestereographic:"sterea",doublestereographic:"sterea",azimuthalequidistant:"aeqd",modifiedazimuthalequidistant:"aeqd",equidistantcylindrical:"eqc",equidistantcylindricalspherical:"eqc",equirectangular:"eqc",platecarree:"eqc",bonne:"bonne",cassinisoldner:"cass",cassini:"cass",cylindricalequalarea:"cea",lambertcylindricalequalarea:"cea",eckertvi:"eck6",equalearth:"eqearth",millercylindrical:"mill",mollweide:"moll",robinson:"robin",sinusoidal:"sinu",vandergrinten:"vandg",vandergrinteni:"vandg",gnomonic:"gnom",orthographic:"ortho",polyconic:"poly",americanpolyconic:"poly",newzealandmapgrid:"nzmg",gaussschreibertransversemercator:"gstmerc"},QB={centralmeridian:"lon_0",longitudeoforigin:"lon_0",longitudeofcenter:"lon_0",longitudeofnaturalorigin:"lon_0",longitudeoffalseorigin:"lon_0",longitudeofprojectioncentre:"lon_0",straightverticalpolelongitude:"lon_0",longitudeoforiginmeridian:"lon_0",latitudeoforigin:"lat_0",latitudeofcenter:"lat_0",latitudeofnaturalorigin:"lat_0",latitudeoffalseorigin:"lat_0",latitudeofprojectioncentre:"lat_0",standardparallel1:"lat_1",latitudeof1ststandardparallel:"lat_1",standardparallel2:"lat_2",latitudeof2ndstandardparallel:"lat_2",latitudeofstandardparallel:"lat_ts",scalefactor:"k_0",scalefactoratnaturalorigin:"k_0",scalefactoratprojectionorigin:"k_0",falseeasting:"x_0",falsenorthing:"y_0",eastingatfalseorigin:"x_0",northingatfalseorigin:"y_0"},tO={omerc:{longitudeofcenter:"lonc",longitudeofprojectioncentre:"lonc",azimuth:"alpha",azimuthatprojectioncentre:"alpha",rectifiedgridangle:"gamma",anglefromrectifiedtoskewgrid:"gamma",scalefactoratprojectioncentre:"k_0",eastingatprojectioncentre:"x_0",northingatprojectioncentre:"y_0"},krovak:{azimuth:"alpha",colatitudeofconeaxis:"alpha",pseudostandardparallel1:"lat_ts",latitudeofpseudostandardparallel:"lat_ts",scalefactoronpseudostandardparallel:"k_0"}},eO={east:"e",west:"w",north:"n",south:"s",up:"u",down:"d",geocentricx:"e",geocentricy:"n",geocentricz:"u"};function Ca(e,t){let r=String(e.type),n=rO(e.bbox);if(r==="CompoundCRS"){t.mode!=="horizontal"&&Ot("CompoundCRS requires explicit horizontal extraction");let E=Xh(e.components).map(be).filter(O=>["ProjectedCRS","GeographicCRS","GeodeticCRS","BoundCRS"].includes(String(O.type)));if(E.length!==1)throw new Error("CompoundCRS requires exactly one horizontal component");let N=Ca(E[0],t);return{...N,areaOfUse:n??N.areaOfUse,lossy:!0}}if(r==="BoundCRS"){let E=Ca(be(e.source_crs),t),N=Ca(be(e.target_crs),t);(N.parameters.datum!=="WGS84"||!["longlat","geocent"].includes(N.parameters.proj)||Number(N.parameters.pm||0)!==0||N.parameters.towgs84||Number(N.parameters.a)!==6378137||!(Math.abs(Number(N.parameters.rf)-298.257223563)<=1e-9||Math.abs(Number(N.parameters.b)-6356752314245179e-9)<=1e-6))&&Ot("BoundCRS requires a WGS84 target");let O=be(e.transformation),C=Mr(be(O.method).name),R=C==="geocentrictranslations"||/^geocentrictranslationsgeog[23]ddomain$/.test(C),W=/^positionvector(?:transformation)?(?:geog[23]ddomain|geocentricdomain)?$/.test(C),j=/^coordinateframe(?:rotation)?(?:geog[23]ddomain|geocentricdomain)?$/.test(C);!R&&!W&&!j&&Ot("Unsupported BoundCRS transformation: "+C);let A=["xaxistranslation","yaxistranslation","zaxistranslation","xaxisrotation","yaxisrotation","zaxisrotation","scaledifference"],P=new Array(R?3:7).fill(void 0);for(let F of Xh(O.parameters)){let L=be(F),B=A.indexOf(Mr(L.name));(B<0||B>=P.length||P[B]!==void 0)&&Ot("Unsupported or duplicate Helmert parameter: "+String(L.name));let V=B<3?1:B<6?Me/3600:1e-6;P[B]=cr(L.value)*sn(L.unit,V)/V*(j&&B>=3&&B<6?-1:1)}if(P.some(F=>F===void 0))throw new Error("Incomplete BoundCRS Helmert transformation");let D={...E.parameters,towgs84:P.join(",")};return delete D.datum,{...E,parameters:D,areaOfUse:n??E.areaOfUse}}["ProjectedCRS","GeographicCRS","GeodeticCRS"].includes(r)||Ot("Unsupported CRS type: "+r);let i=r==="ProjectedCRS"?be(e.base_crs):e,o=be(i.datum||i.datum_ensemble);(o.type==="DynamicGeodeticReferenceFrame"||o.frame_reference_epoch!==void 0||e.coordinate_epoch!==void 0)&&Ot("Time-dependent datum transformations are not implemented");let s=be(o.ellipsoid),a=cr(s.semi_major_axis??s.radius),c={proj:"longlat",a:String(a*sn(s.unit,1))};if(s.inverse_flattening!==void 0)c.rf=String(cr(s.inverse_flattening));else if(s.semi_minor_axis!==void 0)c.b=String(cr(s.semi_minor_axis)*sn(s.unit,1));else if(s.radius!==void 0)c.b=c.a;else throw new Error("Ellipsoid requires inverse flattening or semi-minor axis");let l=Jc(t),h=String(o.name||""),u=Mr(h),f=Object.keys(l),d=f.find(E=>Ia(E)===Ia(h)),m=d?[d]:f.filter(E=>Mr(E)===u||Mr(E)===u.replace(/^d/,"")),p=m[0],g=l[p];if(g&&m.some(E=>{let N=l[E];return N.ellipse!==g.ellipse||N.towgs84!==g.towgs84||N.nadgrids!==g.nadgrids}))throw new Error("Ambiguous structured datum name: "+h);if(u&&(c.datum=p||h),p&&Ia(p)==="wgs84"&&(c.datum="WGS84"),p&&["nad83","northamericandatum1983"].includes(Ia(p))&&(c.datum="NAD83"),!p){["wgs84","worldgeodeticsystem1984","worldgeodeticsystem1984ensemble","dwgs1984","wgs1984"].includes(u)&&(c.datum="WGS84"),["nad83","northamericandatum1983","dnorthamerican1983"].includes(u)&&(c.datum="NAD83"),["nad27","northamericandatum1927","dnorthamerican1927"].includes(u)&&(c.datum="NAD27");let N={newzealand1949:"nzgd49",belge1972:"rnb72"}[u.replace(/^d/,"")];N&&(c.datum=N)}if(r==="ProjectedCRS"&&i.id){let E=be(i.id),N=String(E.authority)+"_"+String(E.code);Object.prototype.hasOwnProperty.call(l,N)&&(c.datum=N)}o.towgs84!==void 0&&(c.towgs84=Xh(o.towgs84).map(cr).join(","),delete c.datum);let y=e.coordinate_system?be(e.coordinate_system):{},_=Xh(y.axis).map(be),M=Mr(y.subtype)==="cartesian"&&r==="GeodeticCRS";r!=="ProjectedCRS"&&!M&&y.subtype&&Mr(y.subtype)!=="ellipsoidal"&&Ot("Unsupported coordinate system subtype"),M&&(c.proj="geocent");let x=sn(i.angular_unit,Me),v=sn(_[0]?.unit,r==="ProjectedCRS"||M?1:x);_[1]&&sn(_[1].unit,v)!==v&&Ot("Mixed horizontal axis units are not supported"),M&&_[2]&&sn(_[2].unit,v)!==v&&Ot("Mixed geocentric axis units are not supported");let T=i.prime_meridian||o.prime_meridian;if(T){let E=be(T);c.pm=String(cr(E.longitude)*sn(E.unit,x)/Me)}if(r==="ProjectedCRS"){let E=be(e.conversion),N=Mr(be(E.method).name),O=Xh(E.parameters).map(be),C=N==="stereographicnorthpole"&&!O.some(A=>Mr(A.name).startsWith("scalefactor")),R=C?"stere":JB[N],W=O.filter(A=>["xscale","yscale","xyplanerotation"].includes(Mr(A.name)));if(W.length){let A={xscale:-1,yscale:1,xyplanerotation:90};(R!=="krovak"||W.length!==3||new Set(W.map(P=>Mr(P.name))).size!==3||W.some(P=>{let D=Mr(P.name),F=D==="xyplanerotation"?sn(P.unit,x)/Me:sn(P.unit,1);return Math.abs(cr(P.value)*F-A[D])>1e-10}))&&Ot("Unsupported ESRI Krovak axis adjustment")}(!R||R.startsWith("unsupported"))&&Ot("Unsupported projection method: "+String(be(E.method).name)),c.proj=R==="webmerc"?"merc":R;let j=!1;for(let A of O){let P=Mr(A.name);if(W.includes(A)||P==="auxiliaryspheretype"&&R==="webmerc"&&A.value===0)continue;if(P==="semiminor"&&R==="webmerc"){if(j)throw new Error("Duplicate conversion parameter: semi_minor");j=!0;let V=cr(A.value)*sn(A.unit,1);Math.abs(V-Number(c.a))>4*Number.EPSILON*Number(c.a)&&Ot("Pseudo-Mercator semi_minor must equal the semi-major axis");continue}let D=tO[R]?.[P]||QB[P];if(D||Ot("Unsupported conversion parameter: "+String(A.name)),D==="lat_1"&&N==="stereographicnorthpole"&&!C?D="lat_0":D==="lat_1"&&["merc","webmerc","eqc","stere","cea"].includes(R)&&(D="lat_ts"),c[D]!==void 0)throw new Error("Duplicate conversion parameter: "+D);if(["merc","webmerc"].includes(R)&&D==="lat_0"&&A.value===0)continue;let F=D.startsWith("lat")||D.startsWith("lon")||D==="alpha"||D==="gamma",L=D==="x_0"||D==="y_0",B=cr(A.value)*sn(A.unit,F?x:L?v:1)/(F?Me:1);D.startsWith("lat")&&Math.abs(Math.abs(B)-90)<=4*Number.EPSILON*90&&(B=Math.sign(B)*90),c[D]=String(B)}if(R==="omerc"&&["hotineobliquemercator","hotineobliquemercatorvarianta","hotineobliquemercatorazimuthnaturalorigin"].includes(N)&&(c.no_uoff=void 0),R==="omerc"&&c.lon_0!==void 0&&c.lonc!==void 0&&(Math.abs(Number(c.lon_0)-Number(c.lonc))>1e-10&&Ot("Oblique Mercator central meridian conflicts with projection centre"),delete c.lon_0),N==="stereographicnorthpole"&&Math.abs(Number(c.lat_0))===90&&(c.proj="stere"),R==="lcc"&&c.lat_1===void 0&&(c.lat_1=c.lat_0),N==="polarstereographic"&&c.lat_0!==void 0){if(c.lat_ts!==void 0)throw new Error("Duplicate polar stereographic latitude of true scale");c.lat_ts=c.lat_0,delete c.lat_0}R==="stere"&&(N.includes("polar")||N==="stereographicsouthpole"||C)&&c.lat_0===void 0&&(c.lat_0=Number(c.lat_ts||90)<0?"-90":"90"),R==="webmerc"&&(c.b=c.a,delete c.rf,c.nadgrids="@null")}let S=_.map(E=>nO(E,c,r==="ProjectedCRS")).join("");return S.length===2&&(S+="u"),!M&&/[ud]/.test(S.slice(0,2))&&Ot("Structured CRS vertical-first axes require an explicit PROJ axis definition"),S&&(c.axis=S),(r==="ProjectedCRS"||M)&&(c.to_meter=String(v)),{parameters:c,areaOfUse:n,angularUnit:r==="ProjectedCRS"||M?x:v,verticalUnit:M?1:sn(_[2]?.unit,1)}}function rO(e){let t;if(e!==void 0){let r=be(e),n=cr(r.west_longitude),i=cr(r.south_latitude),o=cr(r.east_longitude),s=cr(r.north_latitude);if(n<-180||n>180||o<-180||o>180||i<-90||s>90||i>=s||n===o)throw new Error("Invalid CRS geographic bounding box");t=[n,i,o,s]}return t}function nO(e,t,r){let n=String(e.direction),i=e.meridian,o=/^(north|south) along ([+-]?(?:\d+(?:\.\d*)?|\.\d+)) deg(?: (east|west))?$/i.exec(n);if(o){if(i!==void 0)throw new Error("Duplicate axis meridian");n=o[1],i={longitude:Number(o[2])*(o[3]?.toLowerCase()==="west"?-1:1)}}if(i!==void 0){let a=Number(t.lat_0),c=a===90;(!r||t.proj!=="stere"||Math.abs(a)!==90||Mr(n)!==(c?"south":"north"))&&Ot("Axis meridians require an outward-facing polar stereographic axis");let l=be(i).longitude,h=typeof l=="number"?cr(l):cr(be(l).value)*sn(be(l).unit,Me)/Me,u=cr((h-Number(t.lon_0||0))/90);Math.abs(u-Math.round(u))>1e-12&&Ot("Non-cardinal axis meridians require an orientation operation");let f=(Math.round(u)%4+4)%4;return(c?"senw":"nesw")[f]}let s=eO[Mr(n)];return s||Ot("Unsupported axis direction: "+n),s}function _m(e,...t){return e.values.filter(r=>r.type==="node"&&t.includes(r.keyword.toUpperCase()))}function de(e,...t){return _m(e,...t)[0]}function le(e,t=0){let r=e.values[t];return r&&r.type!=="node"?r.value:void 0}function Na(e){return e?{name:le(e),conversion_factor:le(e,1)}:void 0}function iO(e,t){let r=le(e,1);if(t&&String(r).toLowerCase()==="unknown"){let n=String(le(e)).toLowerCase(),i=/^(easting|northing|westing|southing)(?:\s*\([a-z]\))?$/.exec(n);if(i)return{easting:"east",northing:"north",westing:"west",southing:"south"}[i[1]]}return r}function oO(e){let t=de(e,"MERIDIAN");if(t)return{longitude:{value:le(t),unit:Na(de(t,"ANGLEUNIT"))}}}function fI(e){let t=de(e,"METHOD","PROJECTION");if(!t)throw new Error("WKT conversion requires a METHOD or PROJECTION");return de(e,"PARAMETERFILE")&&Ot("Grid-based WKT operation is not implemented"),{method:{name:le(t)},parameters:_m(e,"PARAMETER").map(r=>({name:le(r),value:le(r,1),unit:Na(de(r,"ANGLEUNIT","LENGTHUNIT","SCALEUNIT"))}))}}function Zh(e){let t=e.keyword.toUpperCase();if(t==="COMPD_CS"||t==="COMPOUNDCRS")return{type:"CompoundCRS",components:_m(e,"PROJCS","PROJCRS","GEOGCS","GEOGCRS","GEODCRS","BOUNDCRS","VERT_CS","VERTCRS").map(Zh)};if(t==="BOUNDCRS"){let f=de(e,"SOURCECRS"),d=de(e,"TARGETCRS"),m=de(e,"ABRIDGEDTRANSFORMATION");if(!f||!d||!m)throw new Error("Incomplete WKT BoundCRS");let p=_=>{let M=_.values.find(x=>x.type==="node");if(!M)throw new Error("Missing bound CRS component");return M},g=fI(m),y=g.parameters;for(let _ of y)String(_.name).toLowerCase()==="scale difference"&&_.unit===void 0&&(_.value=(Number(_.value)-1)*1e6);return{type:"BoundCRS",source_crs:Zh(p(f)),target_crs:Zh(p(d)),transformation:g}}if(["VERT_CS","VERTCRS"].includes(t))return{type:"VerticalCRS"};let r=["PROJCS","PROJCRS","PROJECTEDCRS"].includes(t),n=["GEOGCS","GEOGCRS","GEODCRS","GEODETICCRS","GEOGRAPHICCRS","BASEGEOGCRS","BASEGEODCRS","GEOCCS"].includes(t);!r&&!n&&Ot("Unsupported WKT CRS: "+t),de(e,"DYNAMIC","DERIVINGCONVERSION","VELOCITYGRID","EXTENSION")&&Ot("Unsupported WKT dynamic/extension operation");let i=de(e,"CS"),o=t==="GEOCCS"||String(le(i||e)).toLowerCase()==="cartesian"&&!r,s=de(e,r||o?"LENGTHUNIT":"ANGLEUNIT","UNIT"),a=_m(e,"AXIS").sort((f,d)=>Number(le(de(f,"ORDER")||f))-Number(le(de(d,"ORDER")||d))).map((f,d)=>({name:le(f),direction:t==="GEOCCS"?["geocentricX","geocentricY","geocentricZ"][d]:iO(f,r),unit:Na(de(f,"ANGLEUNIT","LENGTHUNIT")||(!o&&!r&&/^(up|down)$/i.test(String(le(f,1)))?void 0:s)),meridian:oO(f)}));if(!a.length)for(let f of o?["geocentricX","geocentricY","geocentricZ"]:["east","north"])a.push({name:f,direction:f,unit:Na(s),meridian:void 0});let c=t==="GEOGCS"?void 0:de(e,"ID"),l={type:r?"ProjectedCRS":o?"GeodeticCRS":"GeographicCRS",name:le(e),id:c?{authority:le(c),code:le(c,1)}:void 0,coordinate_system:{subtype:r||o?"Cartesian":"ellipsoidal",axis:a}},h=de(e,"USAGE"),u=de(h||e,"BBOX");if(u&&(l.bbox={south_latitude:le(u,0),west_longitude:le(u,1),north_latitude:le(u,2),east_longitude:le(u,3)}),r){let f=de(e,"GEOGCS","BASEGEOGCRS","BASEGEODCRS","GEODCRS","GEOGCRS");if(!f)throw new Error("Projected WKT requires a base geographic CRS");l.base_crs=Zh(f),l.conversion=fI(de(e,"CONVERSION")||e)}else{let f=de(e,"DATUM","GEODETICDATUM","ENSEMBLE");if(!f)throw new Error("WKT requires a geodetic datum");de(f,"EXTENSION","DYNAMIC")&&Ot("Unsupported datum extension");let d=de(f,"SPHEROID","ELLIPSOID");if(!d)throw new Error("WKT datum requires an ellipsoid");let m=de(f,"TOWGS84");l.datum={name:le(f),ellipsoid:{name:le(d),semi_major_axis:le(d,1),inverse_flattening:le(d,2),unit:Na(de(d,"LENGTHUNIT"))},towgs84:m?.values.map((g,y)=>le(m,y))};let p=de(e,"PRIMEM");p&&(l.prime_meridian={name:le(p),longitude:le(p,1),unit:Na(de(p,"ANGLEUNIT")||(o?void 0:s))}),l.angular_unit=o?void 0:Na(s)}return l}var qy={name:"wkt",canParse:e=>tr(e)==="wkt",parse(e,t){if(typeof e!="string")throw new Error("Expected serialized WKT");return Ca(Zh(gh(e).root),t)}};Pc();var jy={name:"projjson",canParse:e=>tr(e)==="projjson",parse:(e,t)=>Ca(be(e),t)};Ee();var Wy=1e-12;function Mm(e,t,r,n,i=!1){let o=(t-e.origin[0])/e.step[0],s=(r-e.origin[1])/e.step[1],a=e.size[0],c=e.size[1];if(!i&&(o<-1e-10||s<-1e-10||o>a-1+1e-10||s>c-1+1e-10))return!1;o=Math.max(0,Math.min(a-1,o)),s=Math.max(0,Math.min(c-1,s));let l=Math.min(a-2,Math.floor(o)),h=Math.min(c-2,Math.floor(s)),u=o-l,f=s-h,d=0,m=0;for(let p=0;p<4;p++){let g=p%2,y=p>1,_=(g?u:1-u)*(y?f:1-f);if(_===0)continue;let M=((h+(y?1:0))*a+l+g)*2,x=e.shifts[M],v=e.shifts[M+1];if(!Number.isFinite(x)||!Number.isFinite(v))return!1;d+=_*x,m+=_*v}return n.x=d,n.y=m,!0}function sO(e,t,r,n,i){if(!n)return Mm(e,t,r,i)?(i.x+=t,i.y+=r,!0):!1;for(let a=0;a<2;a++){let c=a===0?t:r;if(c<e.origin[a]-e.maxShift[a]-Wy||c>e.origin[a]+(e.size[a]-1)*e.step[a]+e.maxShift[a]+Wy)return!1}if(!Mm(e,t,r,i,!0))return!1;let o=t-i.x,s=r-i.y;for(let a=0;a<20;a++){if(!Mm(e,o,s,i,!0))return!1;let c=t-o-i.x,l=r-s-i.y;if(o+=c,s+=l,Math.max(Math.abs(c),Math.abs(l))<=Wy)return Mm(e,o,s,i)?(i.x=ve(o),i.y=s,!0):!1}throw new Error("Inverse datum grid shift did not converge")}function dI(e){if(!e.length)throw new Error("Datum grid requires at least one subgrid");let t=e.map(i=>{let[o,s]=i.size;if(![o,s].every(c=>Number.isSafeInteger(c)&&c>=2)||o*s*2!==i.shifts.length||!i.origin.every(Number.isFinite)||!i.step.every(c=>Number.isFinite(c)&&c>0))throw new Error("Invalid datum subgrid geometry or node count");let a=[0,0];for(let c=0;c<i.shifts.length;c++){let l=i.shifts[c];Number.isFinite(l)&&(a[c%2]=Math.max(a[c%2],Math.abs(l)))}return{...i,maxShift:a}}),r=(i,o)=>{let s=i.x,a=i.y;if(!Number.isFinite(s)||!Number.isFinite(a))throw new Error("Grid coordinates must be finite");for(let c of t)if(sO(c,-s,a,o,i))return i.x=-i.x,!0;return i.x=s,i.y=a,!1},n={x:NaN,y:NaN};return Object.freeze({subgridCount:t.length,shiftInPlace:r,shift(i,o,s){return n.x=i,n.y=o,r(n,s)?[n.x,n.y]:void 0}})}var ll=Math.PI/648e3;function Hy(e,t={}){let r=new DataView(e);if(r.byteLength<176)throw new Error("Truncated NTv2 overview header");let n=r.getInt32(8,!0)===11;if(!n&&r.getInt32(8,!1)!==11)throw new Error("Invalid NTv2 header or byte order");let i=u=>r.getInt32(u,n),o=u=>r.getFloat64(u,n),s=u=>String.fromCharCode(...new Uint8Array(e,u,8)).replace(/\0/g,"").trim();if(s(0)!=="NUM_OREC"||i(24)!==11||s(56)!=="SECONDS")throw new Error("Unsupported NTv2 header or shift units");let a=i(40),c=t.includeErrorFields===!1?8:16;if(a<1||a>Math.floor((r.byteLength-176)/(176+4*c)))throw new Error("Invalid NTv2 subgrid count");let l=176,h=[];for(let u=0;u<a;u++){if(l+176>r.byteLength)throw new Error("Truncated NTv2 subgrid header");let f=o(l+72),d=o(l+88),m=o(l+104),p=o(l+120),g=o(l+136),y=o(l+152),_=i(l+168),M=1+(p-m)/y,x=1+(d-f)/g;if(![M,x].every(E=>Number.isFinite(E)&&E>=2&&Math.abs(E-Math.round(E))<1e-7)||!(y>0&&g>0)||_!==Math.round(M)*Math.round(x))throw new Error("Invalid NTv2 subgrid dimensions");let v=l+176,T=v+_*c;if(T>r.byteLength)throw new Error("Truncated NTv2 node records");let S=new Float64Array(_*2);for(let E=0;E<_;E++)S[E*2]=r.getFloat32(v+E*c+4,n)*ll,S[E*2+1]=r.getFloat32(v+E*c,n)*ll;h.push({origin:[m*ll,f*ll],step:[y*ll,g*ll],size:[Math.round(M),Math.round(x)],shifts:S}),l=T}return dI(h)}var bm={ch1903:{towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},ggrs87:{towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},nad27:{nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},potsdam:{towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},carthage:{towgs84:"-263.0,6.0,431.0",ellipse:"clrk80ign",datumName:"Carthage 1934 Tunisia"},hermannskogel:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},mgi:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Militar-Geographische Institut"},osni52:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},ire65:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},rassadiran:{towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},nzgd49:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},osgb36:{towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Ordnance Survey of Great Britain 1936"},s_jtsk:{towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},beduaram:{towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},gunung_segara:{towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},rnb72:{towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"},EPSG_5451:{towgs84:"6.41,-49.05,-11.28,1.5657,0.5242,6.9718,-5.7649"},IGNF_LURESG:{towgs84:"-192.986,13.673,-39.309,-0.4099,-2.9332,2.6881,0.43"},EPSG_4614:{towgs84:"-119.4248,-303.65872,-11.00061,1.164298,0.174458,1.096259,3.657065"},EPSG_4615:{towgs84:"-494.088,-312.129,279.877,-1.423,-1.013,1.59,-0.748"},ESRI_37241:{towgs84:"-76.822,257.457,-12.817,2.136,-0.033,-2.392,-0.031"},ESRI_37249:{towgs84:"-440.296,58.548,296.265,1.128,10.202,4.559,-0.438"},ESRI_37245:{towgs84:"-511.151,-181.269,139.609,1.05,2.703,1.798,3.071"},EPSG_4178:{towgs84:"24.9,-126.4,-93.2,-0.063,-0.247,-0.041,1.01"},EPSG_4622:{towgs84:"-472.29,-5.63,-304.12,0.4362,-0.8374,0.2563,1.8984"},EPSG_4625:{towgs84:"126.93,547.94,130.41,-2.7867,5.1612,-0.8584,13.8227"},EPSG_5252:{towgs84:"0.023,0.036,-0.068,0.00176,0.00912,-0.01136,0.00439"},EPSG_4314:{towgs84:"597.1,71.4,412.1,0.894,0.068,-1.563,7.58"},EPSG_4282:{towgs84:"-178.3,-316.7,-131.5,5.278,6.077,10.979,19.166"},EPSG_4231:{towgs84:"-83.11,-97.38,-117.22,0.005693,-0.044698,0.044285,0.1218"},EPSG_4274:{towgs84:"-230.994,102.591,25.199,0.633,-0.239,0.9,1.95"},EPSG_4134:{towgs84:"-180.624,-225.516,173.919,-0.81,-1.898,8.336,16.71006"},EPSG_4254:{towgs84:"18.38,192.45,96.82,0.056,-0.142,-0.2,-0.0013"},EPSG_4159:{towgs84:"-194.513,-63.978,-25.759,-3.4027,3.756,-3.352,-0.9175"},EPSG_4687:{towgs84:"0.072,-0.507,-0.245,0.0183,-0.0003,0.007,-0.0093"},EPSG_4227:{towgs84:"-83.58,-397.54,458.78,-17.595,-2.847,4.256,3.225"},EPSG_4746:{towgs84:"599.4,72.4,419.2,-0.062,-0.022,-2.723,6.46"},EPSG_4745:{towgs84:"612.4,77,440.2,-0.054,0.057,-2.797,2.55"},EPSG_6311:{towgs84:"8.846,-4.394,-1.122,-0.00237,-0.146528,0.130428,0.783926"},EPSG_4289:{towgs84:"565.7381,50.4018,465.2904,-0.395026,0.330772,-1.876073,4.07244"},EPSG_4230:{towgs84:"-68.863,-134.888,-111.49,-0.53,-0.14,0.57,-3.4"},EPSG_4154:{towgs84:"-123.02,-158.95,-168.47"},EPSG_4156:{towgs84:"570.8,85.7,462.8,4.998,1.587,5.261,3.56"},EPSG_4299:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4179:{towgs84:"33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84"},EPSG_4313:{towgs84:"-106.8686,52.2978,-103.7239,0.3366,-0.457,1.8422,-1.2747"},EPSG_4194:{towgs84:"163.511,127.533,-159.789"},EPSG_4195:{towgs84:"105,326,-102.5"},EPSG_4196:{towgs84:"-45,417,-3.5"},EPSG_4611:{towgs84:"-162.619,-276.959,-161.764,0.067753,-2.243648,-1.158828,-1.094246"},EPSG_4633:{towgs84:"137.092,131.66,91.475,-1.9436,-11.5993,-4.3321,-7.4824"},EPSG_4641:{towgs84:"-408.809,366.856,-412.987,1.8842,-0.5308,2.1655,-121.0993"},EPSG_4643:{towgs84:"-480.26,-438.32,-643.429,16.3119,20.1721,-4.0349,-111.7002"},EPSG_4300:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4188:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4660:{towgs84:"982.6087,552.753,-540.873,6.681627,-31.611492,-19.848161,16.805"},EPSG_4662:{towgs84:"97.295,-263.247,310.882,-1.5999,0.8386,3.1409,13.3259"},EPSG_3906:{towgs84:"577.88891,165.22205,391.18289,4.9145,-0.94729,-13.05098,7.78664"},EPSG_4307:{towgs84:"-209.3622,-87.8162,404.6198,0.0046,3.4784,0.5805,-1.4547"},EPSG_6892:{towgs84:"-76.269,-16.683,68.562,-6.275,10.536,-4.286,-13.686"},EPSG_4690:{towgs84:"221.597,152.441,176.523,2.403,1.3893,0.884,11.4648"},EPSG_4691:{towgs84:"218.769,150.75,176.75,3.5231,2.0037,1.288,10.9817"},EPSG_4629:{towgs84:"72.51,345.411,79.241,-1.5862,-0.8826,-0.5495,1.3653"},EPSG_4630:{towgs84:"165.804,216.213,180.26,-0.6251,-0.4515,-0.0721,7.4111"},EPSG_4692:{towgs84:"217.109,86.452,23.711,0.0183,-0.0003,0.007,-0.0093"},EPSG_9333:{towgs84:"0,0,0,-0.008393,0.000749,-0.010276,0"},EPSG_9059:{towgs84:"0,0,0"},EPSG_4312:{towgs84:"601.705,84.263,485.227,4.7354,1.3145,5.393,-2.3887"},EPSG_4123:{towgs84:"-96.062,-82.428,-121.753,4.801,0.345,-1.376,1.496"},EPSG_4309:{towgs84:"-124.45,183.74,44.64,-0.4384,0.5446,-0.9706,-2.1365"},ESRI_104106:{towgs84:"-283.088,-70.693,117.445,-1.157,0.059,-0.652,-4.058"},EPSG_4281:{towgs84:"-219.247,-73.802,269.529"},EPSG_4322:{towgs84:"0,0,4.5"},EPSG_4324:{towgs84:"0,0,1.9"},EPSG_4284:{towgs84:"43.822,-108.842,-119.585,1.455,-0.761,0.737,0.549"},EPSG_4277:{towgs84:"446.448,-125.157,542.06,0.15,0.247,0.842,-20.489"},EPSG_4207:{towgs84:"-282.1,-72.2,120,-1.529,0.145,-0.89,-4.46"},EPSG_4688:{towgs84:"347.175,1077.618,2623.677,33.9058,-70.6776,9.4013,186.0647"},EPSG_4689:{towgs84:"410.793,54.542,80.501,-2.5596,-2.3517,-0.6594,17.3218"},EPSG_4720:{towgs84:"0,0,4.5"},EPSG_4273:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},EPSG_4240:{towgs84:"204.64,834.74,293.8"},EPSG_4817:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},ESRI_104131:{towgs84:"426.62,142.62,460.09,4.98,4.49,-12.42,-17.1"},EPSG_4265:{towgs84:"-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68"},EPSG_4263:{towgs84:"-111.92,-87.85,114.5,1.875,0.202,0.219,0.032"},EPSG_4298:{towgs84:"-689.5937,623.84046,-65.93566,-0.02331,1.17094,-0.80054,5.88536"},EPSG_4270:{towgs84:"-253.4392,-148.452,386.5267,0.15605,0.43,-0.1013,-0.0424"},EPSG_4229:{towgs84:"-121.8,98.1,-10.7"},EPSG_4220:{towgs84:"-55.5,-348,-229.2"},EPSG_4214:{towgs84:"12.646,-155.176,-80.863"},EPSG_4232:{towgs84:"-345,3,223"},EPSG_4238:{towgs84:"-1.977,-13.06,-9.993,0.364,0.254,0.689,-1.037"},EPSG_4168:{towgs84:"-170,33,326"},EPSG_4131:{towgs84:"199,931,318.9"},EPSG_4152:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_5228:{towgs84:"572.213,85.334,461.94,4.9732,1.529,5.2484,3.5378"},EPSG_8351:{towgs84:"485.021,169.465,483.839,7.786342,4.397554,4.102655,0"},EPSG_4683:{towgs84:"-127.62,-67.24,-47.04,-3.068,4.903,1.578,-1.06"},EPSG_4133:{towgs84:"0,0,0"},EPSG_7373:{towgs84:"0.819,-0.5762,-1.6446,-0.00378,-0.03317,0.00318,0.0693"},EPSG_9075:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9072:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9294:{towgs84:"1.16835,-1.42001,-2.24431,-0.00822,-0.05508,0.01818,0.23388"},EPSG_4212:{towgs84:"-267.434,173.496,181.814,-13.4704,8.7154,7.3926,14.7492"},EPSG_4191:{towgs84:"-44.183,-0.58,-38.489,2.3867,2.7072,-3.5196,-8.2703"},EPSG_4237:{towgs84:"52.684,-71.194,-13.975,-0.312,-0.1063,-0.3729,1.0191"},EPSG_4740:{towgs84:"-1.08,-0.27,-0.9"},EPSG_4124:{towgs84:"419.3836,99.3335,591.3451,0.850389,1.817277,-7.862238,-0.99496"},EPSG_5681:{towgs84:"584.9636,107.7175,413.8067,1.1155,0.2824,-3.1384,7.9922"},EPSG_4141:{towgs84:"23.772,17.49,17.859,-0.3132,-1.85274,1.67299,-5.4262"},EPSG_4204:{towgs84:"-85.645,-273.077,-79.708,2.289,-1.421,2.532,3.194"},EPSG_4319:{towgs84:"226.702,-193.337,-35.371,-2.229,-4.391,9.238,0.9798"},EPSG_4200:{towgs84:"24.82,-131.21,-82.66"},EPSG_4130:{towgs84:"0,0,0"},EPSG_4127:{towgs84:"-82.875,-57.097,-156.768,-2.158,1.524,-0.982,-0.359"},EPSG_4149:{towgs84:"674.374,15.056,405.346"},EPSG_4617:{towgs84:"-0.991,1.9072,0.5129,0.02579,0.00965,0.01166,0"},EPSG_4663:{towgs84:"-210.502,-66.902,-48.476,2.094,-15.067,-5.817,0.485"},EPSG_4664:{towgs84:"-211.939,137.626,58.3,-0.089,0.251,0.079,0.384"},EPSG_4665:{towgs84:"-105.854,165.589,-38.312,-0.003,-0.026,0.024,-0.048"},EPSG_4666:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},EPSG_4756:{towgs84:"-192.873,-39.382,-111.202,-0.00205,-0.0005,0.00335,0.0188"},EPSG_4723:{towgs84:"-179.483,-69.379,-27.584,-7.862,8.163,6.042,-13.925"},EPSG_4726:{towgs84:"8.853,-52.644,180.304,-0.393,-2.323,2.96,-24.081"},EPSG_4267:{towgs84:"-8.0,160.0,176.0"},EPSG_5365:{towgs84:"-0.16959,0.35312,0.51846,0.03385,-0.16325,0.03446,0.03693"},EPSG_4218:{towgs84:"304.5,306.5,-318.1"},EPSG_4242:{towgs84:"-33.722,153.789,94.959,-8.581,-4.478,4.54,8.95"},EPSG_4216:{towgs84:"-292.295,248.758,429.447,4.9971,2.99,6.6906,1.0289"},ESRI_104105:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},ESRI_104129:{towgs84:"0,0,0"},EPSG_4673:{towgs84:"174.05,-25.49,112.57"},EPSG_4202:{towgs84:"-124,-60,154"},EPSG_4203:{towgs84:"-117.763,-51.51,139.061,0.292,0.443,0.277,-0.191"},EPSG_3819:{towgs84:"595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408"},EPSG_8694:{towgs84:"-93.799,-132.737,-219.073,-1.844,0.648,-6.37,-0.169"},EPSG_4145:{towgs84:"275.57,676.78,229.6"},EPSG_4283:{towgs84:"0.06155,-0.01087,-0.04019,0.039492,0.032722,0.032898,-0.009994"},EPSG_4317:{towgs84:"2.3287,-147.0425,-92.0802,-0.309248,0.324822,0.497299,5.689063"},EPSG_4272:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993"},EPSG_4248:{towgs84:"-307.7,265.3,-363.5"},EPSG_5561:{towgs84:"24,-121,-76"},EPSG_5233:{towgs84:"-0.293,766.95,87.713,0.195704,1.695068,3.473016,-0.039338"},ESRI_104130:{towgs84:"-86,-98,-119"},ESRI_104102:{towgs84:"682,-203,480"},ESRI_37207:{towgs84:"7,-10,-26"},EPSG_4675:{towgs84:"59.935,118.4,-10.871"},ESRI_104109:{towgs84:"-89.121,-348.182,260.871"},ESRI_104112:{towgs84:"-185.583,-230.096,281.361"},ESRI_104113:{towgs84:"25.1,-275.6,222.6"},IGNF_WGS72G:{towgs84:"0,12,6"},IGNF_NTFG:{towgs84:"-168,-60,320"},IGNF_EFATE57G:{towgs84:"-127,-769,472"},IGNF_PGP50G:{towgs84:"324.8,153.6,172.1"},IGNF_REUN47G:{towgs84:"94,-948,-1262"},IGNF_CSG67G:{towgs84:"-186,230,110"},IGNF_GUAD48G:{towgs84:"-467,-16,-300"},IGNF_TAHI51G:{towgs84:"162,117,154"},IGNF_TAHAAG:{towgs84:"65,342,77"},IGNF_NUKU72G:{towgs84:"84,274,65"},IGNF_PETRELS72G:{towgs84:"365,194,166"},IGNF_WALL78G:{towgs84:"253,-133,-127"},IGNF_MAYO50G:{towgs84:"-382,-59,-262"},IGNF_TANNAG:{towgs84:"-139,-967,436"},IGNF_IGN72G:{towgs84:"-13,-348,292"},IGNF_ATIGG:{towgs84:"1118,23,66"},IGNF_FANGA84G:{towgs84:"150.57,158.33,118.32"},IGNF_RUSAT84G:{towgs84:"202.13,174.6,-15.74"},IGNF_KAUE70G:{towgs84:"126.74,300.1,-75.49"},IGNF_MOP90G:{towgs84:"-10.8,-1.8,12.77"},IGNF_MHPF67G:{towgs84:"338.08,212.58,-296.17"},IGNF_TAHI79G:{towgs84:"160.61,116.05,153.69"},IGNF_ANAA92G:{towgs84:"1.5,3.84,4.81"},IGNF_MARQUI72G:{towgs84:"330.91,-13.92,58.56"},IGNF_APAT86G:{towgs84:"143.6,197.82,74.05"},IGNF_TUBU69G:{towgs84:"237.17,171.61,-77.84"},IGNF_STPM50G:{towgs84:"11.363,424.148,373.13"},EPSG_4150:{towgs84:"674.374,15.056,405.346"},EPSG_4754:{towgs84:"-208.4058,-109.8777,-2.5764"},ESRI_104101:{towgs84:"372.87,149.23,585.29"},EPSG_4693:{towgs84:"0,-0.15,0.68"},EPSG_6207:{towgs84:"293.17,726.18,245.36"},EPSG_4153:{towgs84:"-133.63,-157.5,-158.62"},EPSG_4132:{towgs84:"-241.54,-163.64,396.06"},EPSG_4221:{towgs84:"-154.5,150.7,100.4"},EPSG_4266:{towgs84:"-80.7,-132.5,41.1"},EPSG_4193:{towgs84:"-70.9,-151.8,-41.4"},EPSG_5340:{towgs84:"-0.41,0.46,-0.35"},EPSG_4246:{towgs84:"-294.7,-200.1,525.5"},EPSG_4318:{towgs84:"-3.2,-5.7,2.8"},EPSG_4121:{towgs84:"-199.87,74.79,246.62"},EPSG_4223:{towgs84:"-260.1,5.5,432.2"},EPSG_4158:{towgs84:"-0.465,372.095,171.736"},EPSG_4285:{towgs84:"-128.16,-282.42,21.93"},EPSG_4613:{towgs84:"-404.78,685.68,45.47"},EPSG_4607:{towgs84:"195.671,332.517,274.607"},EPSG_4475:{towgs84:"-381.788,-57.501,-256.673"},EPSG_4208:{towgs84:"-157.84,308.54,-146.6"},EPSG_4743:{towgs84:"70.995,-335.916,262.898"},EPSG_4710:{towgs84:"-323.65,551.39,-491.22"},EPSG_7881:{towgs84:"-0.077,0.079,0.086"},EPSG_4682:{towgs84:"283.729,735.942,261.143"},EPSG_4739:{towgs84:"-156,-271,-189"},EPSG_4679:{towgs84:"-80.01,253.26,291.19"},EPSG_4750:{towgs84:"-56.263,16.136,-22.856"},EPSG_4644:{towgs84:"-10.18,-350.43,291.37"},EPSG_4695:{towgs84:"-103.746,-9.614,-255.95"},EPSG_4292:{towgs84:"-355,21,72"},EPSG_4302:{towgs84:"-61.702,284.488,472.052"},EPSG_4143:{towgs84:"-124.76,53,466.79"},EPSG_4606:{towgs84:"-153,153,307"},EPSG_4699:{towgs84:"-770.1,158.4,-498.2"},EPSG_4247:{towgs84:"-273.5,110.6,-357.9"},EPSG_4160:{towgs84:"8.88,184.86,106.69"},EPSG_4161:{towgs84:"-233.43,6.65,173.64"},EPSG_9251:{towgs84:"-9.5,122.9,138.2"},EPSG_9253:{towgs84:"-78.1,101.6,133.3"},EPSG_4297:{towgs84:"-198.383,-240.517,-107.909"},EPSG_4269:{towgs84:"0,0,0"},EPSG_4301:{towgs84:"-147,506,687"},EPSG_4618:{towgs84:"-59,-11,-52"},EPSG_4612:{towgs84:"0,0,0"},EPSG_4678:{towgs84:"44.585,-131.212,-39.544"},EPSG_4250:{towgs84:"-130,29,364"},EPSG_4144:{towgs84:"214,804,268"},EPSG_4147:{towgs84:"-17.51,-108.32,-62.39"},EPSG_4259:{towgs84:"-254.1,-5.36,-100.29"},EPSG_4164:{towgs84:"-76,-138,67"},EPSG_4211:{towgs84:"-378.873,676.002,-46.255"},EPSG_4182:{towgs84:"-422.651,-172.995,84.02"},EPSG_4224:{towgs84:"-143.87,243.37,-33.52"},EPSG_4225:{towgs84:"-205.57,168.77,-4.12"},EPSG_5527:{towgs84:"-67.35,3.88,-38.22"},EPSG_4752:{towgs84:"98,390,-22"},EPSG_4310:{towgs84:"-30,190,89"},EPSG_9248:{towgs84:"-192.26,65.72,132.08"},EPSG_4680:{towgs84:"124.5,-63.5,-281"},EPSG_4701:{towgs84:"-79.9,-158,-168.9"},EPSG_4706:{towgs84:"-146.21,112.63,4.05"},EPSG_4805:{towgs84:"682,-203,480"},EPSG_4201:{towgs84:"-165,-11,206"},EPSG_4210:{towgs84:"-157,-2,-299"},EPSG_4183:{towgs84:"-104,167,-38"},EPSG_4139:{towgs84:"11,72,-101"},EPSG_4668:{towgs84:"-86,-98,-119"},EPSG_4717:{towgs84:"-2,151,181"},EPSG_4732:{towgs84:"102,52,-38"},EPSG_4280:{towgs84:"-377,681,-50"},EPSG_4209:{towgs84:"-138,-105,-289"},EPSG_4261:{towgs84:"31,146,47"},EPSG_4658:{towgs84:"-73,46,-86"},EPSG_4721:{towgs84:"265.025,384.929,-194.046"},EPSG_4222:{towgs84:"-136,-108,-292"},EPSG_4601:{towgs84:"-255,-15,71"},EPSG_4602:{towgs84:"725,685,536"},EPSG_4603:{towgs84:"72,213.7,93"},EPSG_4605:{towgs84:"9,183,236"},EPSG_4621:{towgs84:"137,248,-430"},EPSG_4657:{towgs84:"-28,199,5"},EPSG_4316:{towgs84:"103.25,-100.4,-307.19"},EPSG_4642:{towgs84:"-13,-348,292"},EPSG_4698:{towgs84:"145,-187,103"},EPSG_4192:{towgs84:"-206.1,-174.7,-87.7"},EPSG_4311:{towgs84:"-265,120,-358"},EPSG_4135:{towgs84:"58,-283,-182"},ESRI_104138:{towgs84:"198,-226,-347"},EPSG_4245:{towgs84:"-11,851,5"},EPSG_4142:{towgs84:"-125,53,467"},EPSG_4213:{towgs84:"-106,-87,188"},EPSG_4253:{towgs84:"-133,-77,-51"},EPSG_4129:{towgs84:"-132,-110,-335"},EPSG_4713:{towgs84:"-77,-128,142"},EPSG_4239:{towgs84:"217,823,299"},EPSG_4146:{towgs84:"295,736,257"},EPSG_4155:{towgs84:"-83,37,124"},EPSG_4165:{towgs84:"-173,253,27"},EPSG_4672:{towgs84:"175,-38,113"},EPSG_4236:{towgs84:"-637,-549,-203"},EPSG_4251:{towgs84:"-90,40,88"},EPSG_4271:{towgs84:"-2,374,172"},EPSG_4175:{towgs84:"-88,4,101"},EPSG_4716:{towgs84:"298,-304,-375"},EPSG_4315:{towgs84:"-23,259,-9"},EPSG_4744:{towgs84:"-242.2,-144.9,370.3"},EPSG_4244:{towgs84:"-97,787,86"},EPSG_4293:{towgs84:"616,97,-251"},EPSG_4714:{towgs84:"-127,-769,472"},EPSG_4736:{towgs84:"260,12,-147"},EPSG_6883:{towgs84:"-235,-110,393"},EPSG_6894:{towgs84:"-63,176,185"},EPSG_4205:{towgs84:"-43,-163,45"},EPSG_4256:{towgs84:"41,-220,-134"},EPSG_4262:{towgs84:"639,405,60"},EPSG_4604:{towgs84:"174,359,365"},EPSG_4169:{towgs84:"-115,118,426"},EPSG_4620:{towgs84:"-106,-129,165"},EPSG_4184:{towgs84:"-203,141,53"},EPSG_4616:{towgs84:"-289,-124,60"},EPSG_9403:{towgs84:"-307,-92,127"},EPSG_4684:{towgs84:"-133,-321,50"},EPSG_4708:{towgs84:"-491,-22,435"},EPSG_4707:{towgs84:"114,-116,-333"},EPSG_4709:{towgs84:"145,75,-272"},EPSG_4712:{towgs84:"-205,107,53"},EPSG_4711:{towgs84:"124,-234,-25"},EPSG_4718:{towgs84:"230,-199,-752"},EPSG_4719:{towgs84:"211,147,111"},EPSG_4724:{towgs84:"208,-435,-229"},EPSG_4725:{towgs84:"189,-79,-202"},EPSG_4735:{towgs84:"647,1777,-1124"},EPSG_4722:{towgs84:"-794,119,-298"},EPSG_4728:{towgs84:"-307,-92,127"},EPSG_4734:{towgs84:"-632,438,-609"},EPSG_4727:{towgs84:"912,-58,1227"},EPSG_4729:{towgs84:"185,165,42"},EPSG_4730:{towgs84:"170,42,84"},EPSG_4733:{towgs84:"276,-57,149"},ESRI_37218:{towgs84:"230,-199,-752"},ESRI_37240:{towgs84:"-7,215,225"},ESRI_37221:{towgs84:"252,-209,-751"},ESRI_4305:{towgs84:"-123,-206,219"},ESRI_104139:{towgs84:"-73,-247,227"},EPSG_4748:{towgs84:"51,391,-36"},EPSG_4219:{towgs84:"-384,664,-48"},EPSG_4255:{towgs84:"-333,-222,114"},EPSG_4257:{towgs84:"-587.8,519.75,145.76"},EPSG_4646:{towgs84:"-963,510,-359"},EPSG_6881:{towgs84:"-24,-203,268"},EPSG_6882:{towgs84:"-183,-15,273"},EPSG_4715:{towgs84:"-104,-129,239"},IGNF_RGF93GDD:{towgs84:"0,0,0"},IGNF_RGM04GDD:{towgs84:"0,0,0"},IGNF_RGSPM06GDD:{towgs84:"0,0,0"},IGNF_RGTAAF07GDD:{towgs84:"0,0,0"},IGNF_RGFG95GDD:{towgs84:"0,0,0"},IGNF_RGNCG:{towgs84:"0,0,0"},IGNF_RGPFGDD:{towgs84:"0,0,0"},IGNF_ETRS89G:{towgs84:"0,0,0"},IGNF_RGR92GDD:{towgs84:"0,0,0"},EPSG_4173:{towgs84:"0,0,0"},EPSG_4180:{towgs84:"0,0,0"},EPSG_4619:{towgs84:"0,0,0"},EPSG_4667:{towgs84:"0,0,0"},EPSG_4075:{towgs84:"0,0,0"},EPSG_6706:{towgs84:"0,0,0"},EPSG_7798:{towgs84:"0,0,0"},EPSG_4661:{towgs84:"0,0,0"},EPSG_4669:{towgs84:"0,0,0"},EPSG_8685:{towgs84:"0,0,0"},EPSG_4151:{towgs84:"0,0,0"},EPSG_9702:{towgs84:"0,0,0"},EPSG_4758:{towgs84:"0,0,0"},EPSG_4761:{towgs84:"0,0,0"},EPSG_4765:{towgs84:"0,0,0"},EPSG_8997:{towgs84:"0,0,0"},EPSG_4023:{towgs84:"0,0,0"},EPSG_4670:{towgs84:"0,0,0"},EPSG_4694:{towgs84:"0,0,0"},EPSG_4148:{towgs84:"0,0,0"},EPSG_4163:{towgs84:"0,0,0"},EPSG_4167:{towgs84:"0,0,0"},EPSG_4189:{towgs84:"0,0,0"},EPSG_4190:{towgs84:"0,0,0"},EPSG_4176:{towgs84:"0,0,0"},EPSG_4659:{towgs84:"0,0,0"},EPSG_3824:{towgs84:"0,0,0"},EPSG_3889:{towgs84:"0,0,0"},EPSG_4046:{towgs84:"0,0,0"},EPSG_4081:{towgs84:"0,0,0"},EPSG_4558:{towgs84:"0,0,0"},EPSG_4483:{towgs84:"0,0,0"},EPSG_5013:{towgs84:"0,0,0"},EPSG_5264:{towgs84:"0,0,0"},EPSG_5324:{towgs84:"0,0,0"},EPSG_5354:{towgs84:"0,0,0"},EPSG_5371:{towgs84:"0,0,0"},EPSG_5373:{towgs84:"0,0,0"},EPSG_5381:{towgs84:"0,0,0"},EPSG_5393:{towgs84:"0,0,0"},EPSG_5489:{towgs84:"0,0,0"},EPSG_5593:{towgs84:"0,0,0"},EPSG_6135:{towgs84:"0,0,0"},EPSG_6365:{towgs84:"0,0,0"},EPSG_5246:{towgs84:"0,0,0"},EPSG_7886:{towgs84:"0,0,0"},EPSG_8431:{towgs84:"0,0,0"},EPSG_8427:{towgs84:"0,0,0"},EPSG_8699:{towgs84:"0,0,0"},EPSG_8818:{towgs84:"0,0,0"},EPSG_4757:{towgs84:"0,0,0"},EPSG_9140:{towgs84:"0,0,0"},EPSG_8086:{towgs84:"0,0,0"},EPSG_4686:{towgs84:"0,0,0"},EPSG_4737:{towgs84:"0,0,0"},EPSG_4702:{towgs84:"0,0,0"},EPSG_4747:{towgs84:"0,0,0"},EPSG_4749:{towgs84:"0,0,0"},EPSG_4674:{towgs84:"0,0,0"},EPSG_4755:{towgs84:"0,0,0"},EPSG_4759:{towgs84:"0,0,0"},EPSG_4762:{towgs84:"0,0,0"},EPSG_4763:{towgs84:"0,0,0"},EPSG_4764:{towgs84:"0,0,0"},EPSG_4166:{towgs84:"0,0,0"},EPSG_4170:{towgs84:"0,0,0"},EPSG_5546:{towgs84:"0,0,0"},EPSG_7844:{towgs84:"0,0,0"},EPSG_4818:{towgs84:"589,76,480"},EPSG_10328:{towgs84:"0,0,0"},EPSG_9782:{towgs84:"0,0,0"},EPSG_9777:{towgs84:"0,0,0"},EPSG_10690:{towgs84:"0,0,0"},EPSG_10639:{towgs84:"0,0,0"},EPSG_10739:{towgs84:"0,0,0"},EPSG_7686:{towgs84:"0,0,0"},EPSG_8900:{towgs84:"0,0,0"},EPSG_5886:{towgs84:"0,0,0"},EPSG_7683:{towgs84:"0,0,0"},EPSG_6668:{towgs84:"0,0,0"},EPSG_20046:{towgs84:"0,0,0"},EPSG_10299:{towgs84:"0,0,0"},EPSG_10310:{towgs84:"0,0,0"},EPSG_10475:{towgs84:"0,0,0"},EPSG_4742:{towgs84:"0,0,0"},EPSG_10671:{towgs84:"0,0,0"},EPSG_10762:{towgs84:"0,0,0"},EPSG_10725:{towgs84:"0,0,0"},EPSG_10791:{towgs84:"0,0,0"},EPSG_10800:{towgs84:"0,0,0"},EPSG_10305:{towgs84:"0,0,0"},EPSG_10941:{towgs84:"0,0,0"},EPSG_10968:{towgs84:"0,0,0"},EPSG_10875:{towgs84:"0,0,0"},EPSG_6318:{towgs84:"0,0,0"},EPSG_10910:{towgs84:"0,0,0"}};for(let e in bm){let t=bm[e];t.datumName&&(bm[t.datumName]=t)}var mI=bm;var pI=Object.freeze({name:"regional-datums",datums:Object.freeze(mI)});function aO(e){return{...e,parse(t,r){let n=e.parse(t,r),i=n.parameters.datum,o=s=>s.toLowerCase().replace(/[\s_-]/g,"");if(i&&!Object.keys(Jc(r)).some(s=>o(s)===o(i))){let s={...n.parameters};return delete s.datum,{...n,parameters:s}}return n}}}var cO=[qy,jy].map(aO),xm;function lO(){if(xm)return xm;let e=[ty,ey,ry,ny,iy,ay,x1,cy,uy,g1,y1,_1,fy,my,yy,wy,_y,xy,Sy,vy,Ey,Iy,Ay,Py,Ry,Cy,Ny,By,Oy,Ly,Dy,Fy,Uy,Gy,zy],t=i=>i.toLowerCase().replace(/[\s_-]/g,""),r=wm("longlat"),n={name:r.name,aliases:r.aliases,parameters:[...new Set([...r.parameters,...e.flatMap(i=>i.parameters)])],flags:[...new Set(e.flatMap(i=>i.flags||[]))],create(i){let o=i.parameters.o_proj;if(!o)throw new Error("Oblique transformation requires +o_proj");let s=["longlat","latlong","latlon","lonlat","identity"].includes(t(o))?"longlat":e.find(l=>[l.name,...l.aliases||[]].some(h=>t(h)===t(o)));if(!s)throw new Error("Unknown oblique transformation projection: "+o);let a=wm(s),c=new Set([...Qd,...a.parameters]);for(let l of Object.keys(i.parameters))if(!c.has(l))throw new Error("Unsupported PROJ parameter: +"+l);return a.create(i)}};return xm=[...e,n],xm}var ls=class extends cm{constructor(t={}){super({...t,projections:t.projections??lO(),parsers:t.parsers??cO,datumCatalogs:t.datumCatalogs??[pI]}),this.useDefinitionSignature=!Yh(t)}},hO=new ls;var gI=new Map,$y={},Yy={},Ky=new ls;function yI(){return Ky}function wI(e,t){Zy(e,"CRS"),$y[e]=t,Ky=new ls({aliases:$y,datumGrids:Yy})}function _I(e,t){Zy(e,"datum grid"),Yy[e]=Hy(t),Ky=new ls({aliases:$y,datumGrids:Yy})}function Xy(e,t){Zy(e,"geoid model"),gI.set(e,t)}function MI(e,t,r={}){let n=Zd(t,r);return Xy(e,n),n}function Sm(e){return gI.get(e)}function Zy(e,t){if(!e.trim())throw new Error(`${t} name must not be empty`)}var $n=class{spatialReference;horizontalProjection;horizontalProjectionBuffer;geographicProjection;heightOutputProjection;sourceIsGeocentric;outputIsGeocentric;sourceIsGeographic;outputIsGeographic;geoid;constructor(t,r={}){this.spatialReference=t;let n=yI();dO(t);let i=t.targetCrs||t.sourceCrs;if(this.sourceIsGeocentric=Jy(t.sourceCrs),this.outputIsGeocentric=Jy(i),this.sourceIsGeographic=bI(t.sourceCrs),this.outputIsGeographic=bI(i),t.sourceCrs&&t.targetCrs&&!this.sourceIsGeocentric&&!this.outputIsGeocentric&&(this.horizontalProjection=n.createProjection({from:Jh(t.sourceCrs),to:Jh(t.targetCrs),enforceAxis:!1}),hl(t)||(this.horizontalProjectionBuffer=new Xd({projection:this.horizontalProjection,dimension:3}))),(hl(t)||this.sourceIsGeocentric||this.outputIsGeocentric)&&(!this.sourceIsGeographic&&!this.sourceIsGeocentric&&(this.geographicProjection=n.createProjection({from:Jh(t.sourceCrs),to:Yc,enforceAxis:!1})),!this.outputIsGeographic&&!this.outputIsGeocentric&&(this.heightOutputProjection=n.createProjection({from:Yc,to:Jh(i),enforceAxis:!1}))),hl(t)&&(this.geoid=mO(r.geoidModel),!this.geoid)){let o=typeof r.geoidModel=="string"?` "${r.geoidModel}"`:"";throw new Error(`Height conversion requires a registered geoid model${o}; call registerGeoidModel() or pass a parsed Geoid instance`)}}transformPosition(t){if(t.length<2)throw new Error("A spatial coordinate must contain at least x and y components");let r=[...t];if(hl(this.spatialReference)||this.sourceIsGeocentric||this.outputIsGeocentric){if(r.length<3||!Number.isFinite(r[2]))throw new Error("Three-dimensional CRS conversion requires a finite z coordinate");let n=this.toGeographic(r);if(hl(this.spatialReference)){let o=this.geoid.getHeight(n[1],n[0]);n[2]=pO(n[2],o,this.spatialReference.heightReference,this.spatialReference.targetHeightReference)}let i=this.fromGeographic(n);return r.splice(0,i.length,...i),r}if(this.horizontalProjection){let n=this.horizontalProjection.projectSync(r.slice(0,3));r.splice(0,n.length,...n)}return r}transformPositions(t){if(t.length%3!==0)throw new Error("Packed spatial positions must contain a multiple of three components");let r=new Float64Array(t.length);if(this.horizontalProjectionBuffer&&(r.set(t),r.every(Number.isFinite)))return this.horizontalProjectionBuffer.projectFlatTo(r,r);for(let n=0;n<t.length;n+=3){let i=this.transformPosition([Number(t[n]),Number(t[n+1]),Number(t[n+2])]);r[n]=i[0],r[n+1]=i[1],r[n+2]=i[2]}return r}transformNormals(t,r){if(t.length!==r.length||t.length%3!==0)throw new Error("Spatial normals and positions must have matching xyz component counts");let n=new Float32Array(t.length),i=1e-5;for(let o=0;o<t.length;o+=3){let s=[Number(r[o]),Number(r[o+1]),Number(r[o+2])],a=[Number(t[o]),Number(t[o+1]),Number(t[o+2])],c=uO(this,s,i),l=fO(c,a),h=Math.hypot(...l);h>0&&Number.isFinite(h)?(n[o]=l[0]/h,n[o+1]=l[1]/h,n[o+2]=l[2]/h):(n[o]=a[0],n[o+1]=a[1],n[o+2]=a[2])}return n}toGeographic(t){return this.sourceIsGeocentric?Array.from(pt.WGS84.cartesianToCartographic(new I(t))):this.sourceIsGeographic?t.slice(0,3):this.geographicProjection.projectSync(t.slice(0,3))}fromGeographic(t){return this.outputIsGeocentric?Array.from(pt.WGS84.cartographicToCartesian(new I(t))):this.outputIsGeographic?t.slice(0,3):this.heightOutputProjection.projectSync(t.slice(0,3))}};function uO(e,t,r){let n=[];for(let i=0;i<3;i++){let o=t.slice(),s=t.slice();o[i]+=r,s[i]-=r;let a=e.transformPosition(o),c=e.transformPosition(s);n.push([(a[0]-c[0])/(2*r),(a[1]-c[1])/(2*r),(a[2]-c[2])/(2*r)])}return n}function fO(e,t){let[r,n,i]=e,o=r[0]*(n[1]*i[2]-n[2]*i[1])-n[0]*(r[1]*i[2]-r[2]*i[1])+i[0]*(r[1]*n[2]-r[2]*n[1]);return!Number.isFinite(o)||Math.abs(o)<1e-15?t:[[n[1]*i[2]-n[2]*i[1],r[2]*i[1]-r[1]*i[2],r[1]*n[2]-r[2]*n[1]],[n[2]*i[0]-n[0]*i[2],r[0]*i[2]-r[2]*i[0],r[2]*n[0]-r[0]*n[2]],[n[0]*i[1]-n[1]*i[0],r[1]*i[0]-r[0]*i[1],r[0]*n[1]-r[1]*n[0]]].map(a=>(a[0]*t[0]+a[1]*t[1]+a[2]*t[2])/o)}function Jh(e){if(!e)throw new Error("Cannot construct a projection because the CRS is unknown");if(typeof e!="string"&&e.type==="CompoundCRS"){let t=e.components.filter(r=>r.type!=="VerticalCRS");if(t.length!==1)throw new Error("CompoundCRS requires exactly one horizontal component");return Jh(t[0])}return e}function dO(e){if(e.outputCoordinates==="local-enu")throw new Error("local-enu output requires a dataset-derived local origin and must be created by a tileset source");if(e.outputCoordinates==="target-crs"&&!e.targetCrs)throw new Error("target-crs output requires targetCrs");if(!e.sourceCrs&&e.status==="unresolved")throw new Error("Cannot transform coordinates because the source CRS is unknown");if(hl(e)&&e.heightReference==="unknown")throw new Error("Cannot convert heights because the source height reference is unknown");if(e.coordinateFrame==="geocentric"&&!Jy(e.sourceCrs))throw new Error("Only EPSG:4978 geocentric coordinates are supported by the current spatial transformer");if(e.status==="unresolved")throw new Error("The requested spatial output cannot be resolved from the available metadata")}function Jy(e){return typeof e=="string"&&Gh(e)===Ld}function bI(e){if(typeof e!="string")return!1;let t=Gh(e);return t===Yc||t==="EPSG:4979"||t==="OGC:CRS84"}function hl(e){let t=e.targetHeightReference;return t!=="native"&&t!==e.heightReference}function mO(e){return typeof e=="string"?Sm(e):e}function pO(e,t,r,n){if(r===n||n==="native")return e;if(r==="orthometric"&&n==="ellipsoidal")return e+t;if(r==="ellipsoidal"&&n==="orthometric")return e-t;throw new Error(`Unsupported height conversion from ${r} to ${n}`)}qt();var hs=class{spatialReference;coordinateTransformer;geographicCoordinateTransformer;constructor(t,r={}){this.coordinateTransformer=new $n(t,r);let n={...t,sourceCrs:"EPSG:4326",targetCrs:t.targetCrs||t.sourceCrs,coordinateFrame:"geographic",axisOrder:"xy"};this.geographicCoordinateTransformer=new $n(n,r),this.spatialReference=t}transformPositions(t){return this.coordinateTransformer.transformPositions(t)}transformNormals(t,r){return this.coordinateTransformer.transformNormals(t,r)}transformBoundingVolume(t,r){let n=r?new bt(Array.from(r)):void 0,i=t.region?gO(t.region):yO(t).map(s=>n?Array.from(n.transformAsPoint(s)):s);if(!i.length)return t;let o=t.region?i.map(s=>this.transformRegionSample(s)):i.map(s=>this.coordinateTransformer.transformPosition(s));return{box:wO(o)}}transformRegionSample(t){return this.geographicCoordinateTransformer.transformPosition(t)}};function gO(e){if(e.length<6||e.some(u=>!Number.isFinite(u)))return[];let[t,r,n,i,o,s]=e,a=n<t?n+Math.PI*2:n,c=xI(t,a),l=xI(r,i),h=[];for(let u of c)for(let f of l)for(let d of[o,s])h.push([u*180/Math.PI,f*180/Math.PI,d]);return h}function xI(e,t){let r=[e,(e+t)/2,t],n=Math.PI/2,i=Math.ceil(e/n),o=Math.floor(t/n);for(let s=i;s<=o;s++)r.push(s*n);return r}function yO(e){if(e.box&&e.box.length>=12){let t=e.box.slice(0,3),r=[e.box.slice(3,6),e.box.slice(6,9),e.box.slice(9,12)],n=[];for(let i=0;i<=4;i++)for(let o=0;o<=4;o++)for(let s=0;s<=4;s++){let a=i/2-1,c=o/2-1,l=s/2-1;n.push([t[0]+a*r[0][0]+c*r[1][0]+l*r[2][0],t[1]+a*r[0][1]+c*r[1][1]+l*r[2][1],t[2]+a*r[0][2]+c*r[1][2]+l*r[2][2]])}return n}if(e.sphere&&e.sphere.length>=4){let[t,r,n,i]=e.sphere,o=[[t-i,r,n],[t+i,r,n],[t,r-i,n],[t,r+i,n],[t,r,n-i],[t,r,n+i]];for(let s=0;s<16;s++){let a=s*Math.PI*2/16;o.push([t+i*Math.cos(a),r+i*Math.sin(a),n])}return o}return[]}function wO(e){let t=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0];for(let o of e)for(let s=0;s<3;s++)t[s]=Math.min(t[s],o[s]),r[s]=Math.max(r[s],o[s]);let n=[Math.max((r[0]-t[0])*.01,1e-9),Math.max((r[1]-t[1])*.01,1e-9),Math.max((r[2]-t[2])*.01,1e-9)];return[...[(t[0]+r[0])/2,(t[1]+r[1])/2,(t[2]+r[2])/2],(r[0]-t[0])/2+n[0],0,0,0,(r[1]-t[1])/2+n[1],0,0,0,(r[2]-t[2])/2+n[2]]}function SI(e,t){let r=e.map(([c,l])=>[c,l]);if(r.length===0)return r;let n=1/0,i=-1/0;for(let[c]of e)n=Math.min(n,c),i=Math.max(i,c);if(i-n>=360)return r;let o=t??r[0][0];for(let c of r){let l=c[0]-o;l>180?c[0]-=360*Math.ceil((l-180)/360):l<-180&&(c[0]+=360*Math.ceil((-l-180)/360)),o=c[0]}let s=e[0],a=e[e.length-1];if(s[0]===a[0]&&s[1]===a[1]){if(Math.abs(r[r.length-1][0]-r[0][0])>180)return e.map(([c,l])=>[c,l]);r[r.length-1]=[...r[0]]}return r}function _O(e){let t=1/0,r=1/0,n=-1/0,i=-1/0;for(let[o,s]of e)t=Math.min(t,o),r=Math.min(r,s),n=Math.max(n,o),i=Math.max(i,s);return[[t,r],[n,i]]}function vI(e){let t=(r,n)=>{let i=e.cellToBoundary(r);return n?.unwrap?SI(i,n.referenceLongitude):i};return{...e,cellToBoundary:t,cellToBoundaryFlat:(r,n)=>n?.unwrap?t(r,n).flat():e.cellToBoundaryFlat(r),cellToBounds:(r,n)=>{let i=e.cellToBounds(r);if(!n?.unwrap||i[1][0]-i[0][0]>=360)return i;let o=_O(t(r,n));return o[0][1]=i[0][1],o[1][1]=i[1][1],o}}}var MO=(1n<<64n)-1n,bO=0x1555555555555555n;function ul(e){if(e==="X")return 0n;if(!EI(e))throw new Error(`Invalid S2 token: ${e}`);let t=e.padEnd(16,"0");return BigInt(`0x${t}`)}function Qh(e){if(e===0n)return"X";if(!fl(e))throw new Error(`Invalid S2 index: ${e}`);let t=xO(e),r=t%4;t=(t-r)/4;let n=t;t*=4;let o=(e>>BigInt(t)).toString(16).replace(/0+$/,"");return Array(17-n-o.length).join("0")+o}function fl(e){if(typeof e!="bigint"||e<=0n||e>MO)return!1;let t=e>>61n,r=e&-e;return t<6n&&(r&bO)!==0n}function EI(e){if(typeof e!="string"||!/^[0-9a-fA-F]{1,16}$/.test(e)||e.endsWith("0"))return!1;let t=e.padEnd(16,"0");return fl(BigInt(`0x${t}`))}function xO(e){let t=0;for(;e%2n===0n;)e/=2n,t++;return t}function dl(e){if(!fl(e))throw new Error(`Invalid S2 index: ${e}`);let t=IO(e);return TO(t)}var SO=3,Qy=30,vO=2*Qy+1,TI=180/Math.PI,EO={a:[[0,"d"],[1,"a"],[3,"b"],[2,"a"]],b:[[2,"b"],[1,"b"],[3,"a"],[0,"c"]],c:[[2,"c"],[3,"d"],[1,"c"],[0,"b"]],d:[[0,"a"],[3,"c"],[1,"d"],[2,"d"]]};function TO(e){if(!/^[0-5]\/[0-3]{0,30}$/.test(e))throw new Error(`Invalid S2 Hilbert quadkey: ${e}`);let t=e.split("/"),r=parseInt(t[0],10),n=t[1]||"",i=n.length,o=0,s=[0,0];for(let a=i-1;a>=0;a--){o=i-a;let c=n[a],l=0,h=0;c==="1"?h=1:c==="2"?(l=1,h=1):c==="3"&&(l=1);let u=Math.pow(2,o-1);AO(u,s,l,h),s[0]+=u*l,s[1]+=u*h}if(r%2===1){let a=s[0];s[0]=s[1],s[1]=a}return{face:r,ij:s,level:o}}function IO(e){if(!fl(e))throw new Error(`Invalid S2 index: ${e}`);let t=e.toString(2);for(;t.length<SO+vO;)t="0"+t;let r=t.lastIndexOf("1"),n=t.substring(0,3),i=t.substring(3,r),o=i.length/2,s=BigInt(`0b${n}`).toString(10),a="";if(o!==0)for(a=BigInt(`0b${i}`).toString(4);a.length<o;)a="0"+a;return`${s}/${a}`}function AI(e){let{face:t,ij:r,level:n}=e;if(!Number.isInteger(t)||t<0||t>5)throw new Error(`Invalid S2 face: ${t}`);if(!Number.isInteger(n)||n<0||n>Qy)throw new Error(`Invalid S2 level: ${n}`);let i=2**n;if(!Number.isInteger(r[0])||!Number.isInteger(r[1])||r[0]<0||r[1]<0||r[0]>=i||r[1]>=i)throw new Error(`Invalid S2 IJ coordinates: ${r[0]}, ${r[1]}`);let o=PO(r[0],r[1],n,t),s=BigInt(t)<<61n;for(let a=0;a<o.length;a++){let c=59-a*2;s|=BigInt(o[a])<<BigInt(c)}return s|=1n<<BigInt(60-n*2),s}function tw(e,t,r,n){let i=dl(e);if(!Number.isInteger(t)||t<0||i.level+t>Qy)throw new Error(`Invalid S2 relative level: ${t}`);let o=2**t;if(!Number.isInteger(r)||!Number.isInteger(n)||r<0||n<0||r>=o||n>=o)throw new Error(`Invalid S2 descendant coordinates: ${r}, ${n}`);return AI({face:i.face,ij:[i.ij[0]*o+r,i.ij[1]*o+n],level:i.level+t})}function tu(e,t,r){let n=1<<t;return[(e[0]+r[0])/n,(e[1]+r[1])/n]}function II(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function eu(e){return[II(e[0]),II(e[1])]}function ru(e,[t,r]){switch(e){case 0:return[1,t,r];case 1:return[-t,1,r];case 2:return[-t,-r,1];case 3:return[-1,-r,-t];case 4:return[r,-1,-t];case 5:return[r,t,-1];default:throw new Error("Invalid face")}}function nu([e,t,r]){let n=Math.atan2(r,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*TI,n*TI]}function AO(e,t,r,n){if(n===0){r===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let i=t[0];t[0]=t[1],t[1]=i}}function PO(e,t,r,n){let i=n%2===1?"d":"a",o=[];for(let s=r-1;s>=0;s--){let a=1<<s,c=(e&a)!==0?1:0,l=(t&a)!==0?1:0,[h,u]=EO[i][c*2+l];o.push(h),i=u}return o}var RO=100;function PI(e){let t=dl(e);return CO(t)}function CO({face:e,ij:t,level:r}){let n=[[0,0],[0,1],[1,1],[1,0],[0,0]],i=Math.max(1,Math.ceil(RO*Math.pow(2,-r))),o=new Float64Array(4*i*2+2),s=0,a=0;for(let c=0;c<4;c++){let l=n[c].slice(0),h=n[c+1],u=(h[0]-l[0])/i,f=(h[1]-l[1])/i;for(let d=0;d<i;d++){l[0]+=u,l[1]+=f;let m=tu(t,r,l),p=eu(m),g=ru(e,p),y=nu(g);Math.abs(y[1])>89.999&&(y[0]=a);let _=y[0]-a;y[0]+=_>180?-360:_<-180?360:0,o[s++]=y[0],o[s++]=y[1],a=y[0]}}return o[s++]=o[0],o[s++]=o[1],o}var NO=vI({name:"s2",hasNumericRepresentation:!0,cellColumnNames:["s2","s2Token","s2_token","s2Cell","s2_cell","s2CellId","s2_cell_id"],tokenToCell:e=>ul(e),cellToToken:e=>Qh(Em(e)),cellToLngLat:e=>RI(e),cellToBoundary:e=>BO(e),cellToBoundaryFlat:e=>ew(e),cellToBounds:e=>vm(e)});function RI(e){let t=Em(e),r=dl(t),n=tu(r.ij,r.level,[.5,.5]),i=eu(n),o=ru(r.face,i);return nu(o)}function ew(e){let t=Em(e),r=PI(t);return Array.from(r)}function BO(e){let t=ew(e),r=[];for(let n=0;n<t.length;n+=2)r.push([t[n],t[n+1]]);return r}function vm(e){let t=dl(Em(e));if(t.level===0)return OO(t.face);let r=[[0,0],[0,1],[1,1],[1,0]],n=1/0,i=1/0,o=-1/0,s=-1/0,a;for(let l of r){let h=tu(t.ij,t.level,l),u=eu(h),[f,d,m]=ru(t.face,u),[p,g]=nu([f,d,m]);if(f===0&&d===0&&a!==void 0&&(p=a),a!==void 0){let y=p-a;p+=y>180?-360:y<-180?360:0}a=p,n=Math.min(n,p),i=Math.min(i,g),o=Math.max(o,p),s=Math.max(s,g)}let c=2*Number.EPSILON*180/Math.PI;return[[n-c,Math.max(-90,i-c)],[o+c,Math.min(90,s+c)]]}function Em(e){return typeof e=="bigint"?e:ul(e)}function OO(e){let t=Math.asin(Math.sqrt(.3333333333333333))*180/Math.PI;switch(e){case 0:return[[-45,-45],[45,45]];case 1:return[[45,-45],[135,45]];case 2:return[[-180,t],[180,90]];case 3:return[[135,-45],[225,45]];case 4:return[[-135,-45],[-45,45]];case 5:return[[-180,-90],[180,-t]];default:throw new Error(`Invalid S2 face: ${e}`)}}Dr();function Tm(e){let[[t,r],[n,i]]=vm(e.token),o=Ph([t,r,n,i,e.minimumHeight,e.maximumHeight],pt.WGS84,{units:"degrees"});return[...o.center,...o.halfAxes]}var LO=4,DO=8,CI=new WeakMap;function nw(e,t){return{coordinates:t,subtreeUrl:ou(e.subtreesUrlTemplate,t),descriptor:e,resource:GI(e.resourceFiles,ou(e.subtreesUrlTemplate,t))}}function Im(e,t){let{descriptor:r}=t;jO(r),FO(e,r);let n={tileCount:0,childSubtreeCount:0},i=UI(e,t,{localLevel:0,mortonIndex:0},t.coordinates,n);if(!i)throw new Error(`Invalid 3D Tiles subtree: root tile is unavailable at ${t.subtreeUrl}`);return{root:i,...n}}function FO(e,t){let r=qI(t.subdivisionScheme),n=(r**t.subtreeLevels-1)/(r-1),i=r**t.subtreeLevels;rw(e.tileAvailability,n,"tile");let o=Array.isArray(e.contentAvailability)?e.contentAvailability:e.contentAvailability?[e.contentAvailability]:[];for(let c of o)rw(c,n,"content");rw(e.childSubtreeAvailability,i,"child subtree");let s=NI(e.tileAvailability,n),a=o[0]?NI(o[0],n):0;if(BI(e.tileAttributes,s,"tile"),BI(e.contentAttributes,a,"content"),e.tilePropertyRows&&e.tilePropertyRows.length!==s)throw new Error("3DTILES_subtree: tile property-table count does not match availability");if(e.contentPropertyRows&&e.contentPropertyRows.length!==a)throw new Error("3DTILES_subtree: content property-table count does not match availability")}function rw(e,t,r){if(!(e.constant===0||e.constant===1)&&(!e.explicitBitstream||e.explicitBitstream.byteLength*8<t))throw new Error(`3DTILES_subtree: ${r} availability bitstream is too short`)}function NI(e,t){if(e.constant===1)return t;if(e.constant===0)return 0;let r=0;for(let n=0;n<t;n++)ml(e,n)&&r++;return r}function BI(e,t,r){let n={TILE_BOUNDING_BOX:16,TILE_BOUNDING_SPHERE:4,TILE_GEOMETRIC_ERROR:1,TILE_REFINE:1,TILE_TRANSFORM:16,CONTENT_BOUNDING_BOX:16,CONTENT_BOUNDING_SPHERE:4};for(let[i,o]of Object.entries(e||{})){let s=n[i];if(s&&o.length!==t*s)throw new Error(`3DTILES_subtree: ${r} attribute ${i} count does not match availability`)}}function ou(e,t,r={}){let n={level:t.level,x:t.x,y:t.y,z:t.z,...r};return e.replace(/{([^{}]+)}/g,(i,o)=>{let s=Object.hasOwn(n,o)?n[o]:n[o.toLowerCase()];return s===void 0?i:String(s)})}function UI(e,t,r,n,i){let{descriptor:o}=t,s=qI(o.subdivisionScheme),a=VO(s,r.localLevel)+r.mortonIndex;if(!ml(e.tileAvailability,a))return null;i.tileCount++;let c=zO(e.contentAvailability,a),l=[];if(n.level<o.maximumLevel)if(r.localLevel+1<o.subtreeLevels)for(let h=0;h<s;h++){let u=DI(n,h,o.subdivisionScheme),f=UI(e,t,{localLevel:r.localLevel+1,mortonIndex:r.mortonIndex*s+h},u,i);f&&l.push(f)}else for(let h=0;h<s;h++){let u=r.mortonIndex*s+h;if(ml(e.childSubtreeAvailability,u)){let f=DI(n,h,o.subdivisionScheme);l.push(UO(e,o,f)),i.childSubtreeCount++}}return GO(e,o,t,n,a,c,l)}function UO(e,t,r){let n=zI(t.resourceFiles,e.resourceFiles),i=n?{...t,resourceFiles:n}:t,o=nw(i,r);return{id:kI(o,r),children:[],implicitSubtree:o,boundingVolume:jI(t.rootBoundingVolume,r,t.subdivisionScheme),geometricError:t.rootLodMetricValue/2**r.level,lodMetricType:t.lodMetricType,lodMetricValue:t.rootLodMetricValue/2**r.level,refine:t.refine,type:Oi.EMPTY,implicitMetadata:VI(e),_scaleGeometricError:t.scaleGeometricError!==!1}}function OI(e,t,r){if(!e||t<0)return{};let n=iu(e[r==="tile"?"TILE_BOUNDING_BOX":"CONTENT_BOUNDING_BOX"],t,16),i=iu(e[r==="tile"?"TILE_BOUNDING_SPHERE":"CONTENT_BOUNDING_SPHERE"],t,4),o=n?{box:[n[12],n[13],n[14],n[0]/2,n[1]/2,n[2]/2,n[4]/2,n[5]/2,n[6]/2,n[8]/2,n[9]/2,n[10]/2]}:i?{sphere:i}:void 0;if(r==="content")return{boundingVolume:o};let s=iu(e.TILE_GEOMETRIC_ERROR,t,1)?.[0];if(s!==void 0&&(!Number.isFinite(s)||s<0))throw new Error("3DTILES_subtree: TILE_GEOMETRIC_ERROR must be nonnegative");let a=iu(e.TILE_REFINE,t,1)?.[0];if(a!==void 0&&a!==0&&a!==1)throw new Error("3DTILES_subtree: TILE_REFINE must be 0 or 1");return{boundingVolume:o,geometricError:s,refine:a===void 0?void 0:a===0?ze.ADD:ze.REPLACE,transform:iu(e.TILE_TRANSFORM,t,16)}}function iu(e,t,r){if(!e)return;let n=t*r;if(n+r>e.length)throw new Error("3DTILES_subtree: attribute accessor is shorter than availability");return Array.from({length:r},(i,o)=>Number(e[n+o]))}function LI(e,t){if(e.constant===1)return t;if(e.constant===0)return 0;let r=CI.get(e);if(!r){let n=(e.explicitBitstream?.byteLength||0)*8;r=new Uint32Array(n+1);for(let i=0;i<n;i++)r[i+1]=r[i]+Number(ml(e,i));CI.set(e,r)}return r[t]}function GI(e,t){if(!e?.length)return;let r=t.split("?")[0],n=/^gltf-package:\/\/[^/]+\/(.*)$/.exec(r)?.[1],i=e.findIndex(s=>{let a=s.originalUri||s.name;return s.uri===r||!!(a&&(r===a||n===a))});if(i>=0)return{fileIndex:i,files:e};let o=e.findIndex(s=>{let a=s.originalUri||s.name;return!!(a&&(r.endsWith(`/${a}`)||r.endsWith(`:${a}`)))});return o<0?void 0:{fileIndex:o,files:e}}function zI(e,t){if(!t?.length)return e;if(!e?.length)return t;let r=new Set(t.flatMap(n=>[n.uri,n.originalUri,n.name].filter(Boolean)));return[...t,...e.filter(n=>![n.uri,n.originalUri,n.name].some(i=>i&&r.has(i)))]}function GO(e,t,r,n,i,o,s){let a=LI(e.tileAvailability,i),c=e.tilePropertyRows?.[a],l=Array.isArray(e.contentAvailability)?e.contentAvailability[0]:e.contentAvailability,h=l&&ml(l,i)?LI(l,i):-1,u=e.contentPropertyRows?.[h],f=e.tileTemplatePropertyRows?.[a]||c,d=e.contentTemplatePropertyRows?.[h]||u,m={...f,...d},p=OI(e.tileAttributes,a,"tile"),g=OI(e.contentAttributes,h,"content"),_=(t.contentUrlTemplates?.length?t.contentUrlTemplates:[t.contentUrlTemplate]).map((O,C)=>{if(!o[C]||!O)return null;let R=ou(O,n,m);if(/{[^{}]+}/.test(R))throw new Error(`Implicit content URI has unresolved template values: ${R}`);return{contentIndex:C,contentUrl:R}}).filter(O=>!!O),M=_.map(O=>O.contentUrl),x=zI(t.resourceFiles,e.resourceFiles),v=_.map(({contentIndex:O,contentUrl:C})=>{let R=GI(x,C);return{...t.contentHeaders?.[O]||(O===0?t.contentHeader:{})||{},...g,uri:C,...u?{metadata:{properties:u}}:{},...R?{_resource:R}:{}}}),T=M[0],S=t.rootLodMetricValue/2**n.level,E=p.geometricError??S,N=jI(t.rootBoundingVolume,n,t.subdivisionScheme);return{id:kI(r,n),children:s,contentUrl:T,content:v.length>1?v:v[0],contents:t.useCanonicalContents&&v.length?v:void 0,contentUrls:M,refine:p.refine||t.refine,type:qO(T),lodMetricType:t.lodMetricType,lodMetricValue:E,geometricError:E,boundingVolume:p.boundingVolume||N,transform:p.transform,transformMatrix:p.transform,metadata:c?{properties:c}:void 0,implicitMetadata:VI(e,c,u),_scaleGeometricError:t.scaleGeometricError!==!1}}function VI(e,t,r){if(!(!e.propertyTables&&e.tileMetadata===void 0&&!e.contentMetadata&&e.subtreeMetadata===void 0&&!t&&!r))return{propertyTables:e.propertyTables,tileMetadata:e.tileMetadata,contentMetadata:e.contentMetadata,subtreeMetadata:e.subtreeMetadata,tileProperties:t,contentProperties:r}}function kI(e,t){return`${e.subtreeUrl}#implicit=${t.level}/${t.x}/${t.y}/${t.z}`}function ml(e,t){if(typeof e?.constant=="number")return!!e.constant;let r=e?.explicitBitstream;if(!r)return!1;let n=Math.floor(t/8),i=t%8;return!!(r[n]>>i&1)}function zO(e,t){return(Array.isArray(e)?e:[e]).map(n=>ml(n||{constant:0},t))}function VO(e,t){return(e**t-1)/(e-1)}function DI(e,t,r){return{level:e.level+1,x:e.x*2+(t&1),y:e.y*2+(t>>1&1),z:r==="OCTREE"?e.z*2+(t>>2&1):0}}function qI(e){return e==="OCTREE"?DO:LO}function jI(e,t,r){if(e.region){let[n,i,o,s,a,c]=e.region,l=2**t.level,u=(o>=n?o-n:o+2*Math.PI-n)/l,f=(s-i)/l,d=FI(n+u*t.x),m=FI(n+u*(t.x+1)),p=i+f*t.y,g=a,y=c;if(r==="OCTREE"){let _=(c-a)/l;g=a+_*t.z,y=g+_}return{region:[d,p,m,p+f,g,y]}}if(e.box){if(e.s2VolumeInfo)return kO(e,t,r);if(e.extensions?.["3DTILES_shape_cylinder_region"])return{...e,box:[...e.box]};let n=e.box,i=2**t.level,o=-1+(2*t.x+1)/i,s=-1+(2*t.y+1)/i,a=-1+(2*t.z+1)/i,c=r==="OCTREE";return{box:[...[n[0]+n[3]*o+n[6]*s+(c?n[9]*a:0),n[1]+n[4]*o+n[7]*s+(c?n[10]*a:0),n[2]+n[5]*o+n[8]*s+(c?n[11]*a:0)],n[3]/i,n[4]/i,n[5]/i,n[6]/i,n[7]/i,n[8]/i,c?n[9]/i:n[9],c?n[10]/i:n[10],c?n[11]/i:n[11]]}}throw new Error(`Unsupported implicit 3D Tiles bounding volume: ${JSON.stringify(e)}`)}function kO(e,t,r){let n=e.s2VolumeInfo,i=ul(n.token),o=tw(i,t.level,t.x,t.y),s=2**t.level,a=(n.maximumHeight-n.minimumHeight)/s,c={token:Qh(o),minimumHeight:n.minimumHeight+(r==="OCTREE"?a*t.z:0),maximumHeight:n.minimumHeight+(r==="OCTREE"?a*(t.z+1):a*s)},l=e.extensions?{...e.extensions}:void 0;return l?.["3DTILES_bounding_volume_S2"]&&(l["3DTILES_bounding_volume_S2"]=c),l?.["3DTILES_shape_s2"]&&(l["3DTILES_shape_s2"]=c),{...e,...l?{extensions:l}:{},s2VolumeInfo:c,box:Tm(c)}}function FI(e){let t=e;for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function qO(e){if(!e)return Oi.EMPTY;let t=e.split("?")[0].split(".").pop()?.toLowerCase();switch(t){case"pnts":return Oi.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return Oi.SCENEGRAPH;default:return t||Oi.EMPTY}}function jO(e){if(e.subdivisionScheme!=="QUADTREE"&&e.subdivisionScheme!=="OCTREE")throw new Error(`Unsupported implicit subdivision scheme: ${e.subdivisionScheme}`);if(!Number.isInteger(e.subtreeLevels)||e.subtreeLevels<1)throw new Error("Implicit subtreeLevels must be a positive integer");if(!Number.isInteger(e.maximumLevel)||e.maximumLevel<0)throw new Error("Implicit availableLevels must describe at least the root level")}var WO={draco:!1,meshopt:!1,dds:!1,ktx2:!1},HO=32,Am=class{type=nr.TILES3D;loader;url;basePath;tileset=null;loadOptions;coreApi;contentFormats={...WO};asset;properties;extras;credits;metadata;queryParams={};tileUrlCache=new Map;tileContentHeaders=new WeakMap;nestedTilesetRoots=new WeakMap;packageNamespaces=new WeakMap;nextPackageNamespace=0;implicitSubtreeCache;implicitTilingStats={requestedSubtrees:0,loadedSubtrees:0,cacheHits:0,materializedTiles:0};destroyed=!1;extensionsUsed=[];resolver;rootTileset;spatialTransformer;preparedRootHeader;constructor(t,r={}){let n=$O(t);this.rootTileset=HI(t)?null:t,this.tileset=this.rootTileset,this.loader=n.loader,this.url=n.url,this.basePath=n.basePath||gn.dirname(n.url),this.resolver=n.resolver,this.coreApi=n.coreApi,this.loadOptions=r;let i=Number(r["3d-tiles"]?.maximumCachedSubtrees),o=Number.isFinite(i)?Math.max(0,Math.floor(i)):HO;this.implicitSubtreeCache=new hh({maxEntries:o})}destroy(){this.destroyed=!0,this.tileUrlCache.clear(),this.implicitSubtreeCache.clear()}async initialize(){if(!this.rootTileset){let t=this.loadOptions[this.loader.id]||{};this.rootTileset=await this.loadRootData(this.url,{...this.loadOptions,[this.loader.id]:{...t,isTileset:!0}})}if(this.tileset=this.rootTileset,this.rootTileset.queryString){let t=new URLSearchParams(this.rootTileset.queryString);for(let[r,n]of t.entries())this.setQueryParameter(r,n)}if(this.asset=this.rootTileset.asset,!this.asset)throw new Error("Tileset must have an asset property.");if(this.rootTileset.formatVersion!=="2.0-draft"&&this.asset.version!=="0.0"&&this.asset.version!=="1.0"&&this.asset.version!=="1.1")throw new Error("The tileset must be 3D Tiles version 0.0, 1.0, 1.1, or 2.0-draft.");"tilesetVersion"in this.asset&&this.setQueryParameter("v",this.asset.tilesetVersion),this.properties=this.rootTileset.properties,this.extras=this.rootTileset.extras,this.credits={attributions:[]},this.extensionsUsed.splice(0,this.extensionsUsed.length,...this.rootTileset.extensionsUsed||[]),this.metadata={type:this.type,loader:this.loader,url:this.url,basePath:this.basePath,tileset:this.rootTileset,lodMetricType:this.rootTileset.lodMetricType,lodMetricValue:this.rootTileset.lodMetricValue,refine:this.rootTileset.root?.refine,spatialReference:Yd(this.rootTileset)}}getMetadata(){if(!this.metadata)throw new Error("Tiles3DSource has not been initialized");return this.metadata}async getRootTileset(){return this.getMetadata().tileset}async prepareTileset(t){let r=t.spatialReference;if(r.status==="unresolved")throw new Error(r.warnings[0]||"3D Tiles spatial operations cannot be resolved from the supplied metadata and options");r.status!=="transformable"&&r.status!=="transformed"||(this.spatialTransformer||=new hs(r,t.options.spatial),t.spatialReference=Kc(r),this.preparedRootHeader=this.transformTileHeader(this.getMetadata().tileset.root,new bt))}initializeTileHeaders(t,r,n){let i=n?r.root:this.preparedRootHeader||r.root,o=new bn(t,i,n||void 0);n&&(n.children.push(o),o.depth=n.depth+1);let s=[o];for(;s.length>0;){let a=s.pop();t.stats.get("Tiles In Tileset(s)").incrementCount();let c=a.header.children||[];for(let l of c){let h=new bn(t,l,a);if(h.contentUrl?.includes("?session=")){let f=new URL(h.contentUrl).searchParams.get("session");f&&this.setQueryParameter("session",f)}a.children.push(h),h.depth=a.depth+1,s.push(h)}}return o}createTraverser(t){return new Hd(t)}async loadTileContent(t){let r=(t.contentUrls||[t.contentUrl]).filter(Boolean),n=this.tileContentHeaders.get(t),i=n||(Array.isArray(t.header?.content)?t.header.content:t.header?.content?[t.header.content]:[]);n||this.tileContentHeaders.set(t,i);let o=this.loadOptions[this.loader.id]||{},s={...this.loadOptions,[this.loader.id]:{...o,isTileset:"auto",assetGltfUpAxis:this.asset&&this.asset.gltfUpAxis||"Y",_tilesetOptions:{spatialReference:t.header?._spatialReference||t.tileset?.spatialReference,spatialOptions:t.tileset?.options.spatial,spatialTransform:t.header?._spatialTransform}}},a=await Promise.all(r.map((l,h)=>{let u=i[h]||{},f=u.extensions?.["3DTILES_content_gltf_vector"],d=u._vectorContent||(f?.vector===!0?{clip:f.clip===!0}:void 0),m=d?{...s,[this.loader.id]:{...s[this.loader.id],vectorContent:d}}:s;return this.loadContentResource(this.getTileUrl(l),u._resource,m)}));t.contents=a,t.content=a[0]||null;let c=a.filter(l=>l?.shape==="tileset3d");return{loaded:!0,contents:a,nestedTileset:c[0],nestedTilesets:c}}transformTileHeader(t,r=new bt){return this.spatialTransformer?this.transformTileHeaderWithTransformer(t,this.spatialTransformer,r):t}transformTileHeaderWithTransformer(t,r,n,i){let o=t.transform?new bt(t.transform):new bt,s=new bt(n).multiplyRight(o),a=Array.isArray(t.content)?t.content.map(c=>this.transformContentHeader(c,s,r)):t.content?this.transformContentHeader(t.content,s,r):t.content;return{...t,transform:void 0,boundingVolume:t.boundingVolume?r.transformBoundingVolume(t.boundingVolume,s):t.boundingVolume,_spatialReference:i,_spatialTransform:s.toArray(),content:a,children:Array.isArray(t.children)?t.children.map(c=>this.transformTileHeaderWithTransformer(c,r,s,i)):t.children}}transformContentHeader(t,r,n){return{...t,boundingVolume:t.boundingVolume?n.transformBoundingVolume(t.boundingVolume,r):t.boundingVolume}}async loadTileChildren(t,r){let n=t.header.implicitSubtree;if(!n)return{loaded:!1,tileCount:0,childSubtreeCount:0};let i=this.getTileUrl(n.subtreeUrl),o=await this.loadImplicitSubtreeResource(i,n.resource);if(this.destroyed||t.isDestroyed())return{loaded:!1,tileCount:0,childSubtreeCount:0};let s=Im(o,{...n,subtreeUrl:i}),a=t.header._spatialReference,c=a?new hs(a,t.tileset.options.spatial):this.spatialTransformer,l=c?this.transformTileHeaderWithTransformer(s.root,c,new bt,a):s.root;t.applyImplicitSubtreeHeader(l);let h=this.initializeMaterializedChildren(t.tileset,t,l.children);return this.implicitTilingStats.loadedSubtrees++,this.implicitTilingStats.materializedTiles+=h,{loaded:!0,tileCount:s.tileCount,childSubtreeCount:s.childSubtreeCount}}async loadTileChildrenForTraversal(t,r){WI(r);let n=await this.loadTileChildren(t,{});return WI(r),n}getImplicitTilingStats(){return{...this.implicitTilingStats,cachedSubtrees:this.implicitSubtreeCache.size-this.implicitSubtreeCache.pendingSize,pendingSubtrees:this.implicitSubtreeCache.pendingSize}}getTileUrl(t){if(t.startsWith("data:"))return t;let r=this.tileUrlCache.get(t);if(r)return r;if(!Object.keys(this.queryParams).length)return this.tileUrlCache.set(t,t),t;let[n,i=""]=t.split("?"),o=new URLSearchParams(i);for(let[c,l]of Object.entries(this.queryParams))o.has(c)||o.set(c,l);let s=o.toString(),a=s?`${n}?${s}`:n;return this.tileUrlCache.set(t,a),a}setQueryParameter(t,r){this.queryParams[t]!==r&&(this.queryParams[t]=r,this.tileUrlCache.clear())}getViewState(t){if(!t)return{asset:this.asset,properties:this.properties,extras:this.extras,credits:this.credits};let{center:r}=t.boundingVolume,n;return r&&(r[0]!==0||r[1]!==0||r[2]!==0)?(n=new I,pt.WGS84.cartesianToCartographic(r,n)):n=new I(0,0,-pt.WGS84.radii[0]),{asset:this.asset,properties:this.properties,extras:this.extras,credits:this.credits,boundingVolume:t.boundingVolume,cartographicCenter:n,cartesianCenter:r,zoom:xv(t.boundingVolume,n)}}hasExtension(t){return this.extensionsUsed.includes(t)}onTileLoaded(t,r,n){let o=(r.contents.length?r.contents:[r.content]).flatMap(c=>c?.gltf?.json.extensionsRemoved||[]);o.includes("KHR_draco_mesh_compression")&&(this.contentFormats.draco=!0),o.includes("EXT_meshopt_compression")&&(this.contentFormats.meshopt=!0),o.includes("KHR_texture_basisu")&&(this.contentFormats.ktx2=!0);let s=n.nestedTilesets||(n.nestedTileset?[n.nestedTileset]:[]),a=this.nestedTilesetRoots.get(r)||[];for(let[c,l]of s.entries()){let h=a[c];if(h&&r.children.includes(h))continue;let u=a.slice(c+1).find(d=>r.children.includes(d)),f=t._initializeTileHeaders(this.prepareNestedTileset(t,l),r);u&&(r.children.splice(r.children.indexOf(f),1),r.children.splice(r.children.indexOf(u),0,f)),a[c]=f,this.nestedTilesetRoots.set(r,a)}}prepareNestedTileset(t,r){let n=r.spatialMetadata,i=t.spatialReference;if(n?.status==="unresolved"||n?.crs.state==="unknown")throw new Error(n.warnings[0]||"Nested 3D Tiles CRS is explicitly unresolved and cannot be placed in the parent frame");if(!n||!n.sourceCrs)return this.spatialTransformer&&(i.status==="transformable"||i.status==="transformed")?{...r,spatialMetadata:i,root:this.transformTileHeaderWithTransformer(r.root,this.spatialTransformer,new bt,i)}:iw(r,i);let o=i.coordinateEpoch,s=n.coordinateEpoch;if(o!==void 0&&s!==void 0&&o!==s)throw new Error(`Nested 3D Tiles coordinate epoch ${s} differs from parent epoch ${o}; epoch-aware transformation is unavailable`);let a=i.targetCrs||i.sourceCrs;if(!a)return iw(r,n);let c=Ea(n,{...t.options.spatial,outputCoordinates:"target-crs",targetCrs:a});if(c.status==="unresolved")throw new Error(c.warnings[0]||"Nested 3D Tiles CRS cannot be resolved in the parent output frame");if(c.status==="native")return iw(r,c);let l=new hs(c,t.options.spatial);return{...r,spatialMetadata:c,root:this.transformTileHeaderWithTransformer(r.root,l,new bt,c)}}async loadWithCoreApi(t,r,n=this.loader){if(!this.coreApi)throw new Error("Tiles3DSource requires an injected coreApi to load tileset data");return await this.coreApi.load(t,n,r)}async loadRootData(t,r){return this.resolver?await this.resolver.loadRoot(t,this.loader,r):await this.loadWithCoreApi(t,r)}async loadResourceData(t,r,n=this.loader){return this.resolver?await this.resolver.loadResource(t,n,r):await this.loadWithCoreApi(t,r,n)}async loadContentResource(t,r,n){if(!r)return await this.loadResourceData(t,n);let i=r.files[r.fileIndex];if(!i)throw new Error(`3D Tiles package references missing file ${r.fileIndex}`);if(i.uri)return await this.loadResourceData(this.getTileUrl(i.uri),n);if(!this.coreApi)throw new Error("Tiles3DSource requires an injected coreApi to parse embedded package data");let o=await this.getPackageFileData(i),a=`gltf-package://${this.getPackageNamespace(r.files)}/${r.fileIndex}`,c=i.name||"content",l=c.lastIndexOf("/"),h=l>=0?`${a}/${c.slice(0,l)}`:a;return await this.coreApi.parse(o,this.loader,n,{url:`${a}/${c}`,filename:c,baseUrl:h,loaders:[this.loader],coreApi:this.coreApi,_parse:this.coreApi.parse,_tiles3dPackageFiles:r.files,fetch:async(u,f)=>{let d=u.startsWith(`${a}/`)?u.slice(a.length+1):u,m=r.files.find(g=>g.name===d||g.originalUri===d);if(!m)throw new Error(`3D Tiles glTF package does not contain file ${d}`);if(m.uri)return await this.coreApi.fetchFile(this.getTileUrl(m.uri),f);let p=await this.getPackageFileData(m);return new Response(p,{headers:{"content-type":m.mimeType}})}})}getPackageNamespace(t){let r=this.packageNamespaces.get(t);if(r!==void 0)return r;let n=this.nextPackageNamespace++;return this.packageNamespaces.set(t,n),n}async getPackageFileData(t){if(t.data)return vf(t.data,t.byteOffset,t.byteLength);if(t.bufferUri&&this.coreApi){let r=await this.coreApi.fetchFile(this.getTileUrl(t.bufferUri));if(!r.ok)throw new Error(`Failed to fetch 3D Tiles package buffer: HTTP ${r.status}`);let n=await r.arrayBuffer();return vf(n,t.byteOffset,t.byteLength)}throw new Error("3D Tiles package file has no available byte source")}async loadImplicitSubtreeResource(t,r){let n=this.implicitSubtreeCache.get(t);if(n)return this.implicitTilingStats.cacheHits++,await n;this.implicitTilingStats.requestedSubtrees++;let i=this.loadOptions[this.loader.id]||{};return await this.implicitSubtreeCache.getOrLoad(t,async()=>{let o={...this.loadOptions,[this.loader.id]:{...i,isTileset:!1,isSubtree:!0}};return await(r?this.loadContentResource(t,r,o):this.loadResourceData(t,o))})}initializeMaterializedChildren(t,r,n){let i=0,o=[{parentTile:r,childHeaders:n}];for(;o.length>0;){let s=o.pop();for(let a of s.childHeaders){let c=new bn(t,a,s.parentTile);s.parentTile.children.push(c),c.depth=s.parentTile.depth+1,t.stats.get("Tiles In Tileset(s)").incrementCount(),i++,a.children?.length&&o.push({parentTile:c,childHeaders:a.children})}}return i}};function WI(e){if(e?.aborted)throw e.reason??new DOMException("The operation was aborted","AbortError")}function HI(e){return!!(e&&typeof e=="object"&&"url"in e&&"loader"in e&&!("type"in e))}function $O(e){return HI(e)?{...e,basePath:e.basePath||gn.dirname(e.url)}:{url:e.url,loader:e.loader,basePath:e.basePath||gn.dirname(e.url),resolver:e.resolver,coreApi:e.coreApi}}function iw(e,t){let r=n=>({...n,_spatialReference:t,children:Array.isArray(n.children)?n.children.map(r):n.children});return{...e,spatialMetadata:t,root:r(e.root)}}Wn();Wn();Dr();qt();var Pm=class{frameNumberMap=new Map;register(t,r){let n=this.frameNumberMap.get(t)||new Map,i=n.get(r)||0;n.set(r,i+1),this.frameNumberMap.set(t,n)}deregister(t,r){let n=this.frameNumberMap.get(t);if(!n)return;let i=n.get(r)||1;n.set(r,i-1)}isZero(t,r){return(this.frameNumberMap.get(t)?.get(r)||0)===0}};var ow={REQUESTED:"REQUESTED",COMPLETED:"COMPLETED",ERROR:"ERROR"},Rm=class{_statusMap;pendingTilesRegister=new Pm;constructor(){this._statusMap={}}add(t,r,n,i){if(!this._statusMap[r]){let{frameNumber:o,viewport:{id:s}}=i;this._statusMap[r]={request:t,callback:n,key:r,frameState:i,status:ow.REQUESTED},this.pendingTilesRegister.register(s,o),t().then(a=>{this._statusMap[r].status=ow.COMPLETED;let{frameNumber:c,viewport:{id:l}}=this._statusMap[r].frameState;this.pendingTilesRegister.deregister(l,c),this._statusMap[r].callback(a,i)}).catch(a=>{this._statusMap[r].status=ow.ERROR;let{frameNumber:c,viewport:{id:l}}=this._statusMap[r].frameState;this.pendingTilesRegister.deregister(l,c),n(a)})}}update(t,r){if(this._statusMap[t]){let{frameNumber:n,viewport:{id:i}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(i,n);let{frameNumber:o,viewport:{id:s}}=r;this.pendingTilesRegister.register(s,o),this._statusMap[t].frameState=r}}find(t){return this._statusMap[t]}hasPendingTiles(t,r){return!this.pendingTilesRegister.isZero(t,r)}};var Cm=class extends Li{_tileManager;constructor(t){super(t),this._tileManager=new Rm}traversalFinished(t){return!this._tileManager.hasPendingTiles(t.viewport.id,this._frameNumber||0)}shouldRefine(t,r){return t._lodJudge=Wd(t,r),t._lodJudge==="DIG"}updateChildTiles(t,r){let n=t.header.children||[],i=t.children;for(let o of n){let s=`${o.id}-${r.viewport.id}`,a=i&&i.find(c=>c.id===s||c.header?.id===o.id);if(a)a&&this.updateTile(a,r);else{let c=()=>this._loadTile(t,o.id,r);this._tileManager.find(s)?this._tileManager.update(s,r):this._tileManager.add(c,s,h=>this._onTileLoad(h,t,s),r)}}return!1}async _loadTile(t,r,n){if(!t.tileset.source.loadChildTileHeader)throw new Error("I3S source does not support child tile header loading");return await t.tileset.source.loadChildTileHeader(t,r,n)}_onTileLoad(t,r,n){if(t instanceof Error){r.tileset._onSourceError(t,r);return}let i=new bn(r.tileset,t,r,n);r.children.push(i);let o=this._tileManager.find(i.id).frameState;this.updateTile(i,o),this._frameNumber===o.frameNumber&&(this.traversalFinished(o)||new Date().getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(i,o)}};qt();Dr();var gl=class{spatialReference;targetCoordinateFrame;positionTransformer;sourceToGeographicTransformer;geographicToTargetTransformer;sourceCoordinateFrame;sourceVerticalUnitScale;elevationMode;elevationOffset;elevationProvider;providerUnitScale;providerHeightTransformer;constructor(t,r={}){if(t.status!=="transformable"&&t.status!=="transformed")throw new Error("I3SSpatialTransformer requires a requested, transformable spatial output");let n=t.targetCrs||t.sourceCrs;if(!n)throw new Error("I3S spatial transformation requires a target CRS");if(this.positionTransformer=new $n(t,r),this.sourceCoordinateFrame=t.coordinateFrame,this.sourceVerticalUnitScale=t.verticalUnitScale,this.elevationMode=t.elevationMode,this.elevationOffset=(t.elevationOffset||0)*t.elevationUnitScale,this.elevationProvider=YO(this.elevationMode,r),this.elevationProvider&&(typeof this.elevationProvider.sampleElevations!="function"||typeof this.elevationProvider.getElevationRange!="function"))throw new Error("An I3S elevation provider must implement sampleElevations() and getElevationRange()");let i=Vh(this.elevationProvider?.unit||"meter");if(this.elevationProvider&&i===void 0)throw new Error(`Unsupported elevation-provider unit ${this.elevationProvider.unit}`);this.providerUnitScale=i||1,this.targetCoordinateFrame=_n(n),this.spatialReference=Kc(t);let o=Mn({sourceCrs:t.sourceCrs,heightReference:t.heightReference,coordinateFrame:t.coordinateFrame,axisOrder:t.axisOrder,provenance:t.provenance},{targetCrs:"EPSG:4326"});if(this.sourceToGeographicTransformer=new $n(o),pl(this.elevationMode)){if(!this.elevationProvider){let c=this.elevationMode==="relativeToScene"?"scene":"terrain";throw new Error(`I3S elevation mode ${this.elevationMode} requires a ${c} elevation provider`)}if(t.heightReference==="unknown")throw new Error(`I3S elevation mode ${this.elevationMode} requires a known source height reference`);let a=this.elevationProvider.heightReference||t.heightReference;if(a!==t.heightReference){if(t.heightReference!=="ellipsoidal"&&t.heightReference!=="orthometric")throw new Error("Converting elevation-provider heights requires an ellipsoidal or orthometric source height reference");let c=Mn({sourceCrs:"EPSG:4326",heightReference:a,coordinateFrame:"geographic",axisOrder:"xyz",provenance:"caller-override"},{targetCrs:"EPSG:4326",targetHeightReference:t.heightReference,geoidModel:r.geoidModel});this.providerHeightTransformer=new $n(c,r)}}let s=Mn({sourceCrs:"EPSG:4326",heightReference:t.heightReference,coordinateFrame:"geographic",axisOrder:"xyz",provenance:"format-default"},{targetCrs:n,targetHeightReference:t.targetHeightReference,geoidModel:r.geoidModel});this.geographicToTargetTransformer=new $n(s,r)}transformPosition(t){let r=this.placeSourcePositionsSync(t),n=this.positionTransformer.transformPosition([r[0],r[1],r[2]]);return[n[0],n[1],n[2]]}async transformPositionAsync(t){let r=await this.placeSourcePositions(t),n=this.positionTransformer.transformPosition([r[0],r[1],r[2]]);return[n[0],n[1],n[2]]}transformPlacedPosition(t){let r=this.positionTransformer.transformPosition([t[0],t[1],t[2]]);return[r[0],r[1],r[2]]}transformSourcePositionToGeographic(t){let r=this.placeSourcePositionsSync(t),n=this.sourceToGeographicTransformer.transformPosition([r[0],r[1],r[2]]);return[n[0],n[1],n[2]]}async transformSourcePositionToGeographicAsync(t){let r=await this.placeSourcePositions(t),n=this.sourceToGeographicTransformer.transformPosition([r[0],r[1],r[2]]);return[n[0],n[1],n[2]]}transformPositions(t,r){let n=this.placeSourcePositionsSync(t),i=this.placeSourcePositionsSync(r);return this.transformPlacedPositions(n,i)}async transformPositionsAsync(t,r){let n=new Float64Array(t.length+3);n.set(Array.from(t),0),n.set(Array.from(r).slice(0,3),t.length);let i=await this.placeSourcePositions(n);return this.transformPlacedPositions(i.subarray(0,t.length),i.subarray(t.length))}async transformGeometryAsync(t,r,n="earth-centered"){if(t.length%3||r&&r.length!==t.length)throw new Error("Conversion positions and normals must contain matching finite xyz triples");for(let o=0;o<t.length;o++)if(!Number.isFinite(t[o])||r&&!Number.isFinite(r[o]))throw new Error("Conversion positions and normals must contain matching finite xyz triples");if(!["earth-centered","vertex-reference-frame"].includes(n))throw new Error("Unsupported I3S normal reference frame");let i=await this.placeSourcePositions(t);return{positions:this.positionTransformer.transformPositions(i),normals:r?this.transformNormals(r,i,n):void 0}}transformPlacedPositions(t,r){let n=this.transformPlacedPosition(r),i=new Float32Array(t.length),o=Float64Array.from(t);for(let c=0;c<t.length;c+=3){let l=this.transformPlacedPosition([t[c],t[c+1],t[c+2]]);i[c]=l[0]-n[0],i[c+1]=l[1]-n[1],i[c+2]=l[2]-n[2]}let s=this.targetCoordinateFrame==="geographic",a=s?new bt:new bt().translate(n);return{positions:i,sourcePositions:o,origin:n,cartographicOrigin:s?n:[0,0,0],coordinateSystem:s?"lnglat-offsets":"cartesian",modelMatrix:a}}transformNormals(t,r,n="earth-centered"){if(t.length!==r.length||t.length%3)throw new Error("I3S normals and positions must have matching xyz component counts");let i=new Float32Array(t.length);if(n==="earth-centered"&&(this.spatialReference.targetCrs||this.spatialReference.sourceCrs)==="EPSG:4978"){for(let o=0;o<t.length;o+=3){let s=Math.hypot(t[o],t[o+1],t[o+2]);for(let a=0;a<3;a++)i[o+a]=s?t[o+a]/s:t[o+a]}return i}for(let o=0;o<t.length;o+=3){let s=this.sourceToGeographicTransformer.transformPosition([r[o],r[o+1],r[o+2]]),a=new I([t[o],t[o+1],t[o+2]]).normalize(),c=n==="earth-centered"?a:ZI(a,s),l=this.transformEcefNormal(c,s);i.set(l,o)}return i}transformBoundingVolume(t){let n=this.getGeographicBoundSamples(t).map(i=>this.geographicToTargetTransformer.transformPosition(i));return this.targetCoordinateFrame==="geographic"?{region:us(n)}:{box:Ba(n)}}async transformBoundingVolumeAsync(t){let n=(await this.getGeographicBoundSamplesAsync(t)).map(i=>this.geographicToTargetTransformer.transformPosition(i));return this.targetCoordinateFrame==="geographic"?{region:us(n)}:{box:Ba(n)}}transformBoundingVolumeToGeographic(t){return{region:us(this.getGeographicBoundSamples(t))}}async transformBoundingVolumeToGeographicAsync(t){return{region:us(await this.getGeographicBoundSamplesAsync(t))}}transformBoundingVolumeToGeocentric(t){let r=this.getGeographicBoundSamples(t).map(n=>Array.from(pt.WGS84.cartographicToCartesian(new I(n))));return{box:Ba(r)}}async transformBoundingVolumeToGeocentricAsync(t){let r=(await this.getGeographicBoundSamplesAsync(t)).map(n=>Array.from(pt.WGS84.cartographicToCartesian(new I(n))));return{box:Ba(r)}}transformBoundingSphereToGeographic(t){let r=t.mbs?.length?Array.from(t.mbs).slice(0,3):t.obb?Array.from(t.obb.center).slice(0,3):null;if(!r)throw new Error("I3S spatial transformation requires an MBS or OBB bound");let n=this.placeSourcePositionsSync(r),i=this.sourceToGeographicTransformer.transformPosition(Array.from(n)),o=t.mbs?.length?t.mbs[3]:Math.hypot(...Array.from(t.obb.halfSize).slice(0,3));return[i[0],i[1],i[2],o]}async transformBoundingSphereToGeographicAsync(t){return $I(await this.getGeographicBoundSamplesAsync(t))}async transformBoundsAsync(t){let r=await this.getGeographicBoundSamplesAsync(t),n=r.map(o=>Array.from(pt.WGS84.cartographicToCartesian(new I(o)))),i=r.map(o=>this.geographicToTargetTransformer.transformPosition(o));return{boundingVolume:{box:Ba(n)},spatialBoundingVolume:this.targetCoordinateFrame==="geographic"?{region:us(i)}:{box:Ba(i)},i3sLodMbs:pl(this.elevationMode)?$I(r):this.transformBoundingSphereToGeographic(t)}}async transformPointCloudBoundsAsync(t){let r=await this.getGeographicBoundSamplesAsync(t),n=r.map(i=>this.geographicToTargetTransformer.transformPosition(i));return{boundingVolume:{region:us(r)},spatialBoundingVolume:this.targetCoordinateFrame==="geographic"?{region:us(n)}:{box:Ba(n)}}}getGeographicBoundSamples(t){let r=YI(t,this.sourceCoordinateFrame,this.sourceToGeographicTransformer,this.sourceVerticalUnitScale);if(!r.length)throw new Error("I3S spatial transformation requires an MBS or OBB bound");let n=this.placeSourcePositionsSync(r.flat(),!0),i=sw(n);return this.sourceCoordinateFrame==="geographic"?i:i.map(o=>this.sourceToGeographicTransformer.transformPosition(o))}async getGeographicBoundSamplesAsync(t){let r=YI(t,this.sourceCoordinateFrame,this.sourceToGeographicTransformer,this.sourceVerticalUnitScale);if(!r.length)throw new Error("I3S spatial transformation requires an MBS or OBB bound");if(pl(this.elevationMode)){let i=this.sourceCoordinateFrame==="geographic"?r:r.map(o=>this.sourceToGeographicTransformer.transformPosition(o));return await this.placeGeographicBoundSamples(i)}let n=sw(await this.placeSourcePositions(r.flat(),!0));return this.sourceCoordinateFrame==="geographic"?n:n.map(i=>this.sourceToGeographicTransformer.transformPosition(i))}async placeGeographicBoundSamples(t){let n=await this.elevationProvider.getElevationRange(KO(t)),i=n.minimum*this.providerUnitScale,o=n.maximum*this.providerUnitScale;if(!Number.isFinite(i)||!Number.isFinite(o)||i>o)throw new Error("Elevation provider returned an invalid range; minimum and maximum must be finite and ordered");let s=t.map(h=>h[2]),a=Math.min(...s),c=Math.max(...s),l=[];for(let[h,u]of t){let f=this.providerHeightTransformer?this.providerHeightTransformer.transformPosition([h,u,i])[2]:i,d=this.providerHeightTransformer?this.providerHeightTransformer.transformPosition([h,u,o])[2]:o,m=Math.min(f,d),p=Math.max(f,d),g=this.elevationMode==="onTheGround"?m:m+a+this.elevationOffset,y=this.elevationMode==="onTheGround"?p:p+c+this.elevationOffset;l.push([h,u,g],[h,u,y])}return l}placeSourcePositionsSync(t,r=!1){if(pl(this.elevationMode))throw new Error(`I3S elevation mode ${this.elevationMode} requires asynchronous surface placement`);let n=Float64Array.from(t),i=this.elevationMode==="absoluteHeight"?this.elevationOffset:0;for(let o=2;o<n.length;o+=3)n[o]=n[o]*(r?1:this.sourceVerticalUnitScale)+i;return n}async placeSourcePositions(t,r=!1){if(!pl(this.elevationMode))return this.placeSourcePositionsSync(t,r);let n=Float64Array.from(t),i=sw(n).map(s=>{let a=this.sourceToGeographicTransformer.transformPosition(s);return[a[0],a[1]]}),o=await this.elevationProvider.sampleElevations(i);if(o.length!==i.length)throw new Error(`Elevation provider returned ${o.length} heights for ${i.length} positions`);for(let s=0;s<i.length;s++){let a=o[s]*this.providerUnitScale;if(!Number.isFinite(a))throw new Error(`Elevation provider returned a non-finite height at index ${s}`);let[c,l]=i[s],h=this.providerHeightTransformer?this.providerHeightTransformer.transformPosition([c,l,a])[2]:a,u=n[s*3+2]*(r?1:this.sourceVerticalUnitScale);n[s*3+2]=this.elevationMode==="onTheGround"?h:h+u+this.elevationOffset}return n}transformEcefNormal(t,r){if(this.targetCoordinateFrame==="geocentric")return t.normalize();if(this.targetCoordinateFrame==="geographic")return ZO(t,r).normalize();let n=pt.WGS84.cartographicToCartesian(new I(r)),i=[];for(let s of XO()){let a=pt.WGS84.cartesianToCartographic(new I(n).add(s)),c=pt.WGS84.cartesianToCartographic(new I(n).subtract(s)),l=this.geographicToTargetTransformer.transformPosition(a),h=this.geographicToTargetTransformer.transformPosition(c);i.push((l[0]-h[0])/2,(l[1]-h[1])/2,(l[2]-h[2])/2)}let o=new Qr(i);if(Math.abs(o.determinant())<1e-12)throw new Error("Cannot transform an I3S normal through a singular local projection");return o.invert().transpose(),new I(t).transformByMatrix3(o).normalize()}};function YO(e,t){return e==="relativeToScene"?t.sceneElevationProvider:pl(e)?t.terrainElevationProvider:void 0}function pl(e){return e==="onTheGround"||e==="relativeToGround"||e==="relativeToScene"}function sw(e){if(e.length%3!==0)throw new Error("I3S position arrays must contain complete XYZ tuples");let t=[];for(let r=0;r<e.length;r+=3)t.push([e[r],e[r+1],e[r+2]]);return t}function KO(e){let t=us(e);return{west:t[0]*180/Math.PI,south:t[1]*180/Math.PI,east:t[2]*180/Math.PI,north:t[3]*180/Math.PI}}function $I(e){if(!e.length)throw new Error("I3S spatial transformation requires at least one bound sample");let t=e.map(o=>pt.WGS84.cartographicToCartesian(new I(o))),r=new I;for(let o of t)r.add(o);r.scale(1/t.length);let n=0;for(let o of t)n=Math.max(n,new I(o).subtract(r).magnitude());let i=pt.WGS84.cartesianToCartographic(r);return[i[0],i[1],i[2],n]}function YI(e,t,r,n){let i=e.obb;if(i){let c=Array.from(i.center).slice(0,3);c[2]*=n;let l=Array.from(i.halfSize).slice(0,3),h=new to().fromArray(Array.from(i.quaternion)),u=[new I([l[0],0,0]).transformByQuaternion(h),new I([0,l[1],0]).transformByQuaternion(h),new I([0,0,l[2]]).transformByQuaternion(h)];if(t==="geographic"){let f=r.transformPosition(c),d=pt.WGS84.cartographicToCartesian(new I(f)),m=e.normalReferenceFrame==="vertex-reference-frame"?u.map(p=>ZI(p,f)):u;return KI().map(p=>{let g=new I(d);for(let y=0;y<3;y++)g.add(new I(m[y]).scale(p[y]));return Array.from(pt.WGS84.cartesianToCartographic(g))})}return KI().map(f=>{let d=new I(c);for(let m=0;m<3;m++)d.add(new I(u[m]).scale(f[m]));return Array.from(d)})}let o=e.mbs?Array.from(e.mbs):[];if(o.length<4)return[];let s=o.slice(0,3);s[2]*=n;let a=o[3];if(t==="geographic"){let c=r.transformPosition(s),l=pt.WGS84.cartographicToCartesian(new I(c));return XI().map(h=>Array.from(pt.WGS84.cartesianToCartographic(new I(l).add(new I(h).scale(a)))))}return XI().map(c=>Array.from(new I(s).add(new I(c).scale(a))))}function KI(){return[-1,1].flatMap(e=>[-1,1].flatMap(t=>[-1,1].map(r=>[e,t,r])))}function XI(){return[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]]}function XO(){return[new I([1,0,0]),new I([0,1,0]),new I([0,0,1])]}function ZI(e,t){let r=t[0]*Math.PI/180,n=t[1]*Math.PI/180,i=new I([-Math.sin(r),Math.cos(r),0]),o=new I([-Math.sin(n)*Math.cos(r),-Math.sin(n)*Math.sin(r),Math.cos(n)]),s=new I([Math.cos(n)*Math.cos(r),Math.cos(n)*Math.sin(r),Math.sin(n)]);return i.scale(e[0]).add(o.scale(e[1])).add(s.scale(e[2]))}function ZO(e,t){let r=t[0]*Math.PI/180,n=t[1]*Math.PI/180,i=new I([-Math.sin(r),Math.cos(r),0]),o=new I([-Math.sin(n)*Math.cos(r),-Math.sin(n)*Math.sin(r),Math.cos(n)]),s=new I([Math.cos(n)*Math.cos(r),Math.cos(n)*Math.sin(r),Math.sin(n)]);return new I([i.dot(e),o.dot(e),s.dot(e)])}function Ba(e){let t=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0];for(let o of e)for(let s=0;s<3;s++)t[s]=Math.min(t[s],o[s]),r[s]=Math.max(r[s],o[s]);let n=t.map((o,s)=>(o+r[s])/2),i=t.map((o,s)=>(r[s]-o)/2);return[n[0],n[1],n[2],i[0],0,0,0,i[1],0,0,0,i[2]]}function us(e){let t=e[0][0],r=1/0,n=-1/0,i=1/0,o=-1/0,s=1/0,a=-1/0;for(let c of e){let l=t+aw(c[0]-t);r=Math.min(r,l),n=Math.max(n,l),i=Math.min(i,c[1]),o=Math.max(o,c[1]),s=Math.min(s,c[2]),a=Math.max(a,c[2])}return[aw(r)*Math.PI/180,i*Math.PI/180,aw(n)*Math.PI/180,o*Math.PI/180,s,a]}function aw(e){return((e+180)%360+360)%360-180}var JO={draco:!1,meshopt:!1,dds:!1,ktx2:!1},Nm=class{type=nr.I3S;loader;contentLoader;url;basePath;tileset=null;loadOptions;coreApi;contentFormats={...JO};asset;properties;extras;credits;metadata;queryParams={};resolver;rootTileset;spatialTransformer;preparedRootHeader;constructor(t,r={}){let n=t6(t);this.rootTileset=QI(t)?null:t,this.tileset=this.rootTileset,this.loader=n.loader,this.contentLoader=QO(n.loader),this.url=n.url,this.basePath=n.basePath||gn.dirname(n.url),this.resolver=n.resolver,this.coreApi=n.coreApi,this.loadOptions=r,this.initializeQueryParams(r)}async initialize(){this.rootTileset||(this.rootTileset=await this.loadRootData(this.getTileUrl(this.url),{...this.loadOptions,i3s:{...this.loadOptions.i3s,isTileset:!0}})),this.tileset=this.rootTileset,this.rootTileset.root&&typeof this.rootTileset.root.then=="function"&&(this.rootTileset.root=await this.rootTileset.root),this.metadata={type:this.type,loader:this.loader,url:this.url,basePath:this.basePath,tileset:this.rootTileset,lodMetricType:this.rootTileset.lodMetricType,lodMetricValue:this.rootTileset.lodMetricValue,refine:this.rootTileset.root?.refine,spatialReference:$d(this.rootTileset)}}getMetadata(){if(!this.metadata)throw new Error("I3SSource has not been initialized");return this.metadata}async getRootTileset(){return this.getMetadata().tileset}async prepareTileset(t){let r=t.spatialReference;if(r.status==="unresolved")throw new Error(r.warnings[0]||"I3S spatial operations cannot be resolved from the supplied metadata and options");r.status!=="transformable"&&r.status!=="transformed"||(this.spatialTransformer||=new gl(r,t.options.spatial),t.spatialReference=this.spatialTransformer.spatialReference,this.preparedRootHeader=await this.transformTileHeader(this.getMetadata().tileset.root))}initializeTileHeaders(t,r,n){let i=n?r.root:this.preparedRootHeader||r.root;if(this.spatialTransformer&&!this.preparedRootHeader)throw new Error("I3S spatial root header was not prepared before tile initialization");let o=new bn(t,i,n||void 0);return n&&(n.children.push(o),o.depth=n.depth+1),o}createTraverser(t){return new Cm(t)}async loadTileContent(t){let r=this.getTileUrl(t.contentUrl),n=this.loader.id,i=this.loadOptions[n]||{},o=this.getMetadata(),s={...this.loadOptions,[n]:{...i,...t.tileset.options.i3s,_tileOptions:{attributeUrls:t.header.attributeUrls,textureUrl:t.header.textureUrl,textureUrls:t.header.textureUrls,textureFormat:t.header.textureFormat,textureLoaderOptions:t.header.textureLoaderOptions,materialDefinition:t.header.materialDefinition,layerType:t.header.layerType,pointRenderer:t.header.pointRenderer,pointSymbol:t.header.pointSymbol,isDracoGeometry:t.header.isDracoGeometry,mbs:t.header.mbs},_tilesetOptions:{store:o.tileset.store,attributeStorageInfo:o.tileset.attributeStorageInfo,fields:o.tileset.fields,spatialReference:t.tileset.spatialReference,spatialOptions:t.tileset.options.spatial},isTileHeader:!1}};t.content=await this.loadResourceData(r,s,this.contentLoader);let a={index:0,uri:t.contentUrl,type:t.header.layerType,payload:t.content,metadata:t.header.metadata||null,boundingVolume:t.boundingVolume,featureIds:t.featureIdSets,renderable:!!t.content};return{loaded:!0,contents:[t.content],contentEntries:[a]}}async loadChildTileHeader(t,r,n){let i=this.getMetadata();if(i.tileset.nodePages||i.tileset.pointNodePages){let l=await i.tileset.nodePagesTile.formTileFromNodePages(r);return await this.transformTileHeader(l)}let o=this.getTileUrl(`${this.url}/nodes/${r}`),s=this.loadOptions.i3s&&typeof this.loadOptions.i3s=="object"?this.loadOptions.i3s:{},a={...this.loadOptions,i3s:{...s,isTileHeader:!0}},c=await this.loadResourceData(o,a);return await this.transformTileHeader(c)}async loadTileChildrenForTraversal(t,r){let n=t.header.children||[],i=0,o=[];for(let a of n){JI(r);let c=a.id;if(typeof c!="string"&&typeof c!="number")throw new Error("I3S child header is missing its node ID");let l=t.children.find(f=>f.id===String(c)||f.header?.id===c);if(l){o.push(l);continue}let h=await this.loadChildTileHeader(t,String(c),null);JI(r);let u=new bn(t.tileset,h,t,String(c));o.push(u),i++}let s=new Set(o);return t.children=[...o,...t.children.filter(a=>!s.has(a))],{loaded:!0,tileCount:i,childSubtreeCount:0}}getTileUrl(t){if(t.startsWith("data:")||!Object.keys(this.queryParams).length)return t;let r=t.indexOf("#"),n=r>=0?t.slice(r):"",i=r>=0?t.slice(0,r):t,o=i.indexOf("?"),s=o===-1?i:i.slice(0,o),a=o===-1?"":i.slice(o+1),c=new URLSearchParams(a),l=new URLSearchParams;for(let[u,f]of Object.entries(this.queryParams))c.has(u)||l.set(u,f);let h=l.toString();return`${s}${a?`?${a}`:""}${h?`${a?"&":"?"}${h}`:""}${n}`}getViewState(t){if(this.spatialTransformer&&t){let o=new I(t.boundingVolume.center),s=new I(t.header.i3sLodMbs.slice(0,3));return this.spatialTransformer.targetCoordinateFrame==="geographic"?{boundingVolume:t.boundingVolume,cartographicCenter:s,cartesianCenter:o,zoom:1}:{boundingVolume:t.boundingVolume,cartographicCenter:s,cartesianCenter:o,zoom:1}}let r=this.getMetadata(),n=r.tileset.fullExtent;if(n){let{xmin:o,xmax:s,ymin:a,ymax:c,zmin:l,zmax:h}=n,u=new I(o+(s-o)/2,a+(c-a)/2,l+(h-l)/2),f=new I;return pt.WGS84.cartographicToCartesian(u,f),{cartographicCenter:u,cartesianCenter:f,zoom:z1(n,u,f)}}let i=r.tileset.store?.extent;if(i){let[o,s,a,c]=i,l=new I(o+(a-o)/2,s+(c-s)/2,0),h=new I;return pt.WGS84.cartographicToCartesian(l,h),{cartographicCenter:l,cartesianCenter:h,zoom:Sv(i,l,h)}}return Ji.warn("Extent is not defined in the tileset header")(),{cartographicCenter:new I,zoom:1}}onTileLoaded(t,r){switch(r.header.isDracoGeometry&&(this.contentFormats.draco=!0),r.header.textureFormat){case"dds":this.contentFormats.dds=!0;break;case"ktx2":this.contentFormats.ktx2=!0;break;default:}}getTilesTotalCount(){return this.getMetadata().tileset?.nodePagesTile?.nodesInNodePages||null}async loadWithCoreApi(t,r,n=this.loader){if(!this.coreApi)throw new Error("I3SSource requires an injected coreApi to load tileset data");return await this.coreApi.load(t,n,r)}async loadRootData(t,r){return this.resolver?await this.resolver.loadRoot(t,this.loader,r):await this.loadWithCoreApi(t,r)}initializeQueryParams(t){for(let[n,i]of Object.entries(t.searchParams||{}))this.queryParams[n]=String(i);let r=t.i3s;if(r&&typeof r=="object"&&"token"in r){let n=r.token;typeof n=="string"&&(this.queryParams.token=n)}}async loadResourceData(t,r,n=this.loader){return this.resolver?await this.resolver.loadResource(t,n,r):await this.loadWithCoreApi(t,r,n)}async transformTileHeader(t){if(!this.spatialTransformer)return t;let r={mbs:t.mbs,obb:t.obb,normalReferenceFrame:this.getMetadata().tileset.store?.normalReferenceFrame},n=await this.spatialTransformer.transformBoundsAsync(r);return{...t,boundingVolume:n.boundingVolume,spatialBoundingVolume:n.spatialBoundingVolume,i3sLodMbs:n.i3sLodMbs}}};function JI(e){if(e?.aborted)throw e.reason??new DOMException("The operation was aborted","AbortError")}function QO(e){return e.contentLoader||e}function QI(e){return!!(e&&typeof e=="object"&&"url"in e&&"loader"in e&&!("type"in e))}function t6(e){return QI(e)?{...e,basePath:e.basePath||gn.dirname(e.url)}:{url:e.url,loader:e.loader,basePath:e.basePath||gn.dirname(e.url),resolver:e.resolver,coreApi:e.coreApi}}qt();so();var yl=class{header;parent;children=[];childrenLoaded=!1;childrenPromise=null;selected=!1;viewportIds=[];content=null;contentAvailable=!1;contentFailed=!1;isContentLoading=!1;constructor(t,r=null){this.header=t,this.parent=r}get id(){return this.header.id}get level(){return this.header.level}get pointCount(){return this.header.pointCount}get geometricError(){return this.header.geometricError}get boundingVolume(){return this.header.boundingVolume}setSelected(t){this.selected=!0,this.viewportIds.includes(t)||this.viewportIds.push(t)}clearSelection(){this.selected=!1,this.viewportIds=[]}};var e6={debounceTime:0,minimumNodePixelSize:150,maximumScreenSpaceError:1,lodSelectionMetricType:"maxScreenThresholdSQ",densityThreshold:1,pointBudget:2e6,maxDepth:Number.POSITIVE_INFINITY,onTileLoad:()=>{},onTileError:()=>{},onTraversalComplete:e=>e,onUpdate:()=>{}},Bm=64,Om=class{dataSource;options;root=null;cartographicCenter=null;zoom=1;boundingVolume=null;visibleTilesCount=0;frameNumberValue=0;pendingCount=0;lastUpdatedViewports=null;updatePromise=null;tilesMap=new Map;constructor(t,r={}){this.dataSource=t,this.options={...e6,...r},this.tilesetInitializationPromise=this.initialize()}tilesetInitializationPromise;get isReady(){return this.dataSource.isReady}get frameNumber(){return this.frameNumberValue}get tiles(){return Array.from(this.tilesMap.values())}isLoaded(){return this.frameNumberValue>0&&this.pendingCount===0&&this.selectedTiles.every(t=>t.contentAvailable||t.contentFailed)}selectedTiles=[];update(t=null){this.selectTiles(t).catch(()=>{})}destroy(){this.selectedTiles=[],this.tilesMap.clear(),this.root=null,this.cartographicCenter=null,this.boundingVolume=null,this.visibleTilesCount=0,this.pendingCount=0,this.lastUpdatedViewports=null,this.updatePromise=null}async initialize(){await this.dataSource.initialize();let t=await this.dataSource.getRootTile();this.root=this.getOrCreateTile(t,null);let r=await this.dataSource.getViewState?.();this.boundingVolume=r?.boundingVolume||this.root.boundingVolume;let n=r?.cartographicCenter||this.root.boundingVolume.center;this.cartographicCenter=new I(n),this.zoom=r?.zoom||this.estimateZoom(this.boundingVolume)}async selectTiles(t=null){return await this.tilesetInitializationPromise,t&&(this.lastUpdatedViewports=t),this.updatePromise||(this.updatePromise=new Promise((r,n)=>{setTimeout(()=>{this.doSelectTiles().then(()=>r(this.frameNumberValue)).catch(n).finally(()=>{this.updatePromise=null})},this.options.debounceTime)})),this.updatePromise}async doSelectTiles(){if(!this.root||!this.lastUpdatedViewports)return;let t=new Set(this.selectedTiles.map(a=>a.id));for(let a of this.tilesMap.values())a.clearSelection();this.frameNumberValue++;let r=Array.isArray(this.lastUpdatedViewports)?this.lastUpdatedViewports:[this.lastUpdatedViewports],n=new Map,i=new Set,o=0;for(let a of r){let c=this.getTraversalContext(a);o=await this.traverseTiles(c,n,o,i)}this.visibleTilesCount=i.size,this.selectedTiles=this.options.onTraversalComplete(Array.from(n.values()));for(let a of this.selectedTiles)this.loadTile(a).catch(()=>{});let s=new Set(this.selectedTiles.map(a=>a.id));this.haveSameIds(t,s)||this.options.onUpdate()}async traverseTiles(t,r,n,i){if(!this.root)return n;let o=n,s=[{tile:this.root,weight:this.estimateScreenRadius(this.root,t.viewport)}];for(;s.length>0;){s.sort((u,f)=>f.weight-u.weight);let a=s.shift();if(!a)break;let{tile:c,weight:l}=a;if(!this.isVisible(c,t))continue;if(i.add(c.id),!r.has(c.id)&&c.pointCount>0){if(o>0&&o+c.pointCount>this.options.pointBudget)break;r.set(c.id,c),o+=c.pointCount}if(r.has(c.id)&&c.setSelected(t.viewport.id),!this.shouldRefine(c,l))continue;let h=await this.getVisibleChildren(c,t);h.length>0&&s.push(...h)}return o}shouldRefine(t,r){if(t.level<this.options.maxDepth&&Number.isFinite(r)&&(t.header.lodSelectionMetricType||this.options.lodSelectionMetricType)==="density-threshold"){let n=Math.max(1,Math.PI*r*r),i=t.pointCount/n,o=t.header.lodThreshold||this.options.densityThreshold;return i<o}return t.level<this.options.maxDepth&&Number.isFinite(r)&&r>=this.options.minimumNodePixelSize}getTraversalContext(t){let r=this.getCullingVolume(t);return{viewport:t,cullingVolume:this.shouldUseCullingVolume(t,r)?r:null}}isVisible(t,r){if(r.cullingVolume){let i=this.getCommonSpaceBoundingSphere(t.boundingVolume,r.viewport);if(i)return this.isBoundingSphereInsideCullingVolume(i,r.cullingVolume)}let n=this.getProjectedFootprint(t.boundingVolume,r.viewport);return n?this.isProjectedFootprintVisible(n,r.viewport):!1}shouldUseCullingVolume(t,r){if(!this.root||!r)return!1;let n=this.getCommonSpaceBoundingSphere(this.root.boundingVolume,t);if(!n)return!1;if(this.isBoundingSphereInsideCullingVolume(n,r))return!0;let i=this.getProjectedFootprint(this.root.boundingVolume,t);return!i||!this.isProjectedFootprintVisible(i,t)}isBoundingSphereInsideCullingVolume(t,r){return r.computeVisibilityWithPlaneMask(t,sr.MASK_INDETERMINATE)!==sr.MASK_OUTSIDE}isProjectedFootprintVisible(t,r){return!(t.x+t.radius<-Bm||t.x-t.radius>r.width+Bm||t.y+t.radius<-Bm||t.y-t.radius>r.height+Bm)}estimateScreenRadius(t,r){let n=this.getProjectedFootprint(t.boundingVolume,r);return n?n.radius:0}projectBounds(t,r){let n=this.getBoundingVolumeCorners(t),i=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,a=Number.NEGATIVE_INFINITY;try{for(let c of n){let[l,h]=r.project(c);!Number.isFinite(l)||!Number.isFinite(h)||(i=Math.min(i,l),o=Math.min(o,h),s=Math.max(s,l),a=Math.max(a,h))}}catch{return null}return!Number.isFinite(i)||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(a)?null:{minX:i,minY:o,maxX:s,maxY:a}}getProjectedFootprint(t,r){let n=Number.NaN,i=Number.NaN;try{[n,i]=r.project(t.center)}catch{return null}if(!Number.isFinite(n)||!Number.isFinite(i))return null;let o=this.getBoundingVolumeCorners(t),s=0;try{for(let a of o){let[c,l]=r.project(a);!Number.isFinite(c)||!Number.isFinite(l)||(s=Math.max(s,Math.hypot(c-n,l-i)))}}catch{return null}if(s===0){let a=this.projectBounds(t,r);a&&(s=Math.max(a.maxX-a.minX,a.maxY-a.minY)/2)}return{x:n,y:i,radius:s}}async getVisibleChildren(t,r){return t.level>=this.options.maxDepth?[]:(await this.getChildren(t)).map(i=>({tile:i,weight:this.estimateScreenRadius(i,r.viewport)})).filter(i=>this.isVisible(i.tile,r))}async getChildren(t){if(t.childrenLoaded)return t.children;if(!t.childrenPromise){let r=this.dataSource.getChildren(t.header).then(n=>n.map(i=>this.getOrCreateTile(i,t))).then(n=>(t.children=n,t.childrenLoaded=!0,n));t.childrenPromise=r.finally(()=>{t.childrenPromise===r&&(t.childrenPromise=null)})}return t.childrenPromise}getOrCreateTile(t,r){let n=this.tilesMap.get(t.id);if(n)return n.header=t,r&&n.parent!==r&&(n.parent=r),n;let i=new yl(t,r);return this.tilesMap.set(t.id,i),r&&!r.children.find(o=>o.id===i.id)&&r.children.push(i),i}async loadTile(t){if(!(t.contentAvailable||t.isContentLoading||t.contentFailed)){t.isContentLoading=!0,this.pendingCount++;try{let r=await this.dataSource.loadTileContent(t.header);t.content=r,t.contentAvailable=!0,r&&this.options.onTileLoad(t)}catch(r){t.contentFailed=!0,this.options.onTileError(t,r)}finally{t.isContentLoading=!1,this.pendingCount--}}}estimateZoom(t){if(!t||t.coordinateFrame==="cartesian")return 1;let[r,n]=t.cartographicBounds,i=t.coversFullLongitude?360:t.wrapsDateline?360-Math.abs(n[0]-r[0]):Math.abs(n[0]-r[0]),o=Math.max(i,1e-6);return Math.max(1,Math.round(Math.log2(360/o)))}haveSameIds(t,r){if(t.size!==r.size)return!1;for(let n of t)if(!r.has(n))return!1;return!0}getBoundingVolumeCorners(t){let[r,n]=t.cartographicBounds,i=t.coversFullLongitude?[[-180,180]]:t.wrapsDateline?[[r[0],180],[-180,n[0]]]:[[r[0],n[0]]],o=[],s=360-Math.abs(n[0]-r[0]),a=r[0]+s/2;for(let[c,l]of i){let h=d=>{if(!t.wrapsDateline)return d;let m=d;for(;m-a>180;)m-=360;for(;m-a<-180;)m+=360;return m},u=h(c),f=h(l);o.push([u,r[1],r[2]||0],[u,r[1],n[2]||0],[u,n[1],r[2]||0],[u,n[1],n[2]||0],[f,r[1],r[2]||0],[f,r[1],n[2]||0],[f,n[1],r[2]||0],[f,n[1],n[2]||0])}return o}getCullingVolume(t){let r=t.getFrustumPlanes?.bind(t);if(!r)return null;let n=r(),i=["left","right","bottom","top","near","far"],o=[];for(let s of i){let a=n[s];if(!a)return null;o.push(new Ge(a.normal,-a.distance))}return new sr(o)}getCommonSpaceBoundingSphere(t,r){let n=r.projectPosition?.bind(r);if(!n)return null;let i=this.getBoundingVolumeCorners(t),o=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;try{for(let u of i){let[f,d,m=0]=n(u);!Number.isFinite(f)||!Number.isFinite(d)||!Number.isFinite(m)||(o=Math.min(o,f),s=Math.min(s,d),a=Math.min(a,m),c=Math.max(c,f),l=Math.max(l,d),h=Math.max(h,m))}}catch{return null}return!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(a)||!Number.isFinite(c)||!Number.isFinite(l)||!Number.isFinite(h)?null:new en().fromCornerPoints([o,s,a],[c,l,h])}};RM();return NP(ef);})();
29
29
  return __exports__;
30
30
  });