@oceanum/datamesh 0.2.0 → 0.4.3

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 (50) hide show
  1. package/README.md +6 -6
  2. package/package.json +6 -8
  3. package/src/lib/connector.ts +194 -37
  4. package/src/lib/datamodel.ts +322 -148
  5. package/src/lib/datasource.ts +35 -9
  6. package/src/lib/query.ts +2 -2
  7. package/src/lib/session.ts +171 -0
  8. package/src/lib/zarr.ts +93 -31
  9. package/src/test/dataframe.test.ts +1 -1
  10. package/src/test/dataset.test.ts +139 -19
  11. package/src/test/fixtures.ts +51 -48
  12. package/src/test/query.test.ts +3 -3
  13. package/tsconfig.vitest-temp.json +13 -2
  14. package/typedoc.json +1 -1
  15. package/vite.config.ts +1 -1
  16. package/dist/README.md +0 -31
  17. package/dist/blosc-CeItQ6qj.cjs +0 -17
  18. package/dist/blosc-DaK8KnI4.js +0 -719
  19. package/dist/browser-BDe_cnOJ.cjs +0 -1
  20. package/dist/browser-CJIXy_XB.js +0 -524
  21. package/dist/chunk-INHXZS53-DiyuLb3Z.js +0 -14
  22. package/dist/chunk-INHXZS53-z3BpFH8p.cjs +0 -1
  23. package/dist/gzip-DfmsOCZR.cjs +0 -1
  24. package/dist/gzip-TMN4LZ5e.js +0 -24
  25. package/dist/index.cjs +0 -9
  26. package/dist/index.d.ts +0 -5
  27. package/dist/index.d.ts.map +0 -1
  28. package/dist/index.js +0 -11341
  29. package/dist/lib/connector.d.ts +0 -93
  30. package/dist/lib/connector.d.ts.map +0 -1
  31. package/dist/lib/datamodel.d.ts +0 -152
  32. package/dist/lib/datamodel.d.ts.map +0 -1
  33. package/dist/lib/datasource.d.ts +0 -96
  34. package/dist/lib/datasource.d.ts.map +0 -1
  35. package/dist/lib/observe.d.ts +0 -3
  36. package/dist/lib/observe.d.ts.map +0 -1
  37. package/dist/lib/query.d.ts +0 -135
  38. package/dist/lib/query.d.ts.map +0 -1
  39. package/dist/lib/zarr.d.ts +0 -20
  40. package/dist/lib/zarr.d.ts.map +0 -1
  41. package/dist/lz4-CssV0LoA.js +0 -643
  42. package/dist/lz4-PFaIsPAh.cjs +0 -15
  43. package/dist/test/fixtures.d.ts +0 -12
  44. package/dist/test/fixtures.d.ts.map +0 -1
  45. package/dist/zlib-C-RQJQaC.cjs +0 -1
  46. package/dist/zlib-DrihHfbK.js +0 -24
  47. package/dist/zstd-Cqadn9HA.js +0 -610
  48. package/dist/zstd-_xUhkGOV.cjs +0 -15
  49. package/src/docs/reverse_proxy.md +0 -0
  50. package/vite.config.ts.timestamp-1734584068599-c5119713c3c4e.mjs +0 -67
package/dist/index.cjs DELETED
@@ -1,9 +0,0 @@
1
- "use strict";var au=Object.defineProperty;var Us=n=>{throw TypeError(n)};var cu=(n,t,e)=>t in n?au(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var W=(n,t,e)=>cu(n,typeof t!="symbol"?t+"":t,e),Rs=(n,t,e)=>t.has(n)||Us("Cannot "+e);var at=(n,t,e)=>(Rs(n,t,"read from private field"),e?e.call(n):t.get(n)),Ut=(n,t,e)=>t.has(n)?Us("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,e),Ot=(n,t,e,r)=>(Rs(n,t,"write to private field"),r?r.call(n,e):t.set(n,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class En extends Error{constructor(t,e={}){super(`Node not found: ${t}`,e),this.name="NodeNotFoundError"}}class ai extends Error{constructor(t){super(`Missing key: ${t}`),this.name="KeyError"}}var Jt;class Co{constructor(t,e,r){Ut(this,Jt);typeof t=="number"?Ot(this,Jt,new Uint8Array(t)):t instanceof ArrayBuffer?Ot(this,Jt,new Uint8Array(t,e,r)):Ot(this,Jt,new Uint8Array(Array.from(t,i=>i?1:0)))}get BYTES_PER_ELEMENT(){return 1}get byteOffset(){return at(this,Jt).byteOffset}get byteLength(){return at(this,Jt).byteLength}get buffer(){return at(this,Jt).buffer}get length(){return at(this,Jt).length}get(t){let e=at(this,Jt)[t];return typeof e=="number"?e!==0:e}set(t,e){at(this,Jt)[t]=e?1:0}fill(t){at(this,Jt).fill(t?1:0)}*[Symbol.iterator](){for(let t=0;t<this.length;t++)yield this.get(t)}}Jt=new WeakMap;var Mn;class Xi{constructor(t,e,r,i){W(this,"_data");W(this,"chars");Ut(this,Mn);if(this.chars=t,Ot(this,Mn,new TextEncoder),typeof e=="number")this._data=new Uint8Array(e*t);else if(e instanceof ArrayBuffer)i&&(i=i*t),this._data=new Uint8Array(e,r,i);else{let s=Array.from(e);this._data=new Uint8Array(s.length*t);for(let o=0;o<s.length;o++)this.set(o,s[o])}}get BYTES_PER_ELEMENT(){return this.chars}get byteOffset(){return this._data.byteOffset}get byteLength(){return this._data.byteLength}get buffer(){return this._data.buffer}get length(){return this.byteLength/this.BYTES_PER_ELEMENT}get(t){const e=new Uint8Array(this.buffer,this.byteOffset+this.chars*t,this.chars);return new TextDecoder().decode(e).replace(/\x00/g,"")}set(t,e){const r=new Uint8Array(this.buffer,this.byteOffset+this.chars*t,this.chars);r.fill(0),r.set(at(this,Mn).encode(e))}fill(t){const e=at(this,Mn).encode(t);for(let r=0;r<this.length;r++)this._data.set(e,r*this.chars)}*[Symbol.iterator](){for(let t=0;t<this.length;t++)yield this.get(t)}}Mn=new WeakMap;var Lt;const Ts=class Ts{constructor(t,e,r,i){Ut(this,Lt);W(this,"chars");if(this.chars=t,typeof e=="number")Ot(this,Lt,new Int32Array(e*t));else if(e instanceof ArrayBuffer)i&&(i*=t),Ot(this,Lt,new Int32Array(e,r,i));else{const s=e,o=new Ts(t,1);Ot(this,Lt,new Int32Array(function*(){for(let a of s)o.set(0,a),yield*at(o,Lt)}()))}}get BYTES_PER_ELEMENT(){return at(this,Lt).BYTES_PER_ELEMENT*this.chars}get byteLength(){return at(this,Lt).byteLength}get byteOffset(){return at(this,Lt).byteOffset}get buffer(){return at(this,Lt).buffer}get length(){return at(this,Lt).length/this.chars}get(t){const e=this.chars*t;let r="";for(let i=0;i<this.chars;i++)r+=String.fromCodePoint(at(this,Lt)[e+i]);return r.replace(/\u0000/g,"")}set(t,e){const r=this.chars*t,i=at(this,Lt).subarray(r,r+this.chars);i.fill(0);for(let s=0;s<this.chars;s++)i[s]=e.codePointAt(s)??0}fill(t){this.set(0,t);let e=at(this,Lt).subarray(0,this.chars);for(let r=1;r<this.length;r++)at(this,Lt).set(e,r*this.chars)}*[Symbol.iterator](){for(let t=0;t<this.length;t++)yield this.get(t)}};Lt=new WeakMap;let Yn=Ts;function Qi(n){const t=JSON.stringify(n,null,2);return new TextEncoder().encode(t)}function en(n){const t=new TextDecoder().decode(n);return JSON.parse(t)}function Cs(n,t){const e=t/2,r=t-1;let i=0;for(let s=0;s<n.length;s+=t)for(let o=0;o<e;o+=1)i=n[s+o],n[s+o]=n[s+r-o],n[s+r-o]=i}const uu={int8:Int8Array,int16:Int16Array,int32:Int32Array,int64:globalThis.BigInt64Array,uint8:Uint8Array,uint16:Uint16Array,uint32:Uint32Array,uint64:globalThis.BigUint64Array,float32:Float32Array,float64:Float64Array,bool:Co},lu=/v2:([US])(\d+)/;function Po(n){if(n==="v2:object")return globalThis.Array;let t=n.match(lu);if(t){let[,r,i]=t;return(r==="U"?Yn:Xi).bind(null,Number(i))}let e=uu[n];if(!e)throw new Error(`Unknown or unsupported data_type: ${n}`);return e}function Qe(n,t){return(t==="C"?hu:du)(n)}function hu(n){const t=n.length,e=globalThis.Array(t);for(let r=t-1,i=1;r>=0;r--)e[r]=i,i*=n[r];return e}function du(n){const t=n.length,e=globalThis.Array(t);for(let r=0,i=1;r<t;r++)e[r]=i,i*=n[r];return e}function fu({name:n,configuration:t}){if(n==="default"){const e=(t==null?void 0:t.separator)??"/";return r=>["c",...r].join(e)}if(n==="v2"){const e=(t==null?void 0:t.separator)??".";return r=>r.join(e)||"0"}throw new Error(`Unknown chunk key encoding: ${n}`)}function Li(n){var e;const t=n.find(r=>r.name==="transpose");return((e=t==null?void 0:t.configuration)==null?void 0:e.order)==="F"?"F":"C"}const pu=/^([<|>])(.*)$/;function yu(n){if(n==="|O")return{data_type:"v2:object"};let t=n.match(pu);if(!t)throw new Error(`Invalid dtype: ${n}`);let[,e,r]=t,i={b1:"bool",i1:"int8",u1:"uint8",i2:"int16",u2:"uint16",i4:"int32",u4:"uint32",i8:"int64",u8:"uint64",f4:"float32",f8:"float64"}[r]??(r.startsWith("S")||r.startsWith("U")?`v2:${r}`:void 0);if(!i)throw new Error(`Unsupported or unknown dtype: ${n}`);return e==="|"?{data_type:i}:{data_type:i,endian:e==="<"?"little":"big"}}function gu(n,t={}){let e=[],r=yu(n.dtype);n.order==="F"&&e.push({name:"transpose",configuration:{order:"F"}}),"endian"in r&&r.endian==="big"&&e.push({name:"bytes",configuration:{endian:"big"}});for(let{id:i,...s}of n.filters??[])e.push({name:i,configuration:s});if(n.compressor){let{id:i,...s}=n.compressor;e.push({name:i,configuration:s})}return{zarr_format:3,node_type:"array",shape:n.shape,data_type:r.data_type,chunk_grid:{name:"regular",configuration:{chunk_shape:n.chunks}},chunk_key_encoding:{name:"v2",configuration:{separator:n.dimension_separator??"."}},codecs:e,fill_value:n.fill_value,attributes:t}}function mu(n,t={}){return{zarr_format:3,node_type:"group",attributes:t}}function bu(n,t){if(t!=="number"&&t!=="bigint"&&t!=="boolean"&&t!=="object"&&t!=="string")return n===t;let e=n==="bool";if(t==="boolean")return e;let r=n.startsWith("v2:U")||n.startsWith("v2:S");if(t==="string")return r;let i=n==="int64"||n==="uint64";if(t==="bigint")return i;let s=n==="v2:object";return t==="object"?s:!r&&!i&&!e&&!s}function wu(n){return(n==null?void 0:n.name)==="sharding_indexed"}function $o(n){return(n.data_type==="uint64"||n.data_type==="int64")&&n.fill_value!=null?BigInt(n.fill_value):n.fill_value}const Ps=_u();function _u(){const n=new Uint32Array([305419896]);return new Uint8Array(n.buffer,n.byteOffset,n.byteLength)[0]!==18}function $s(n){return"BYTES_PER_ELEMENT"in n?n.BYTES_PER_ELEMENT:4}var tr,Pe,er,nr,An;const Ns=class Ns{constructor(t,e){W(this,"kind","array_to_bytes");Ut(this,tr);Ut(this,Pe);Ut(this,er);Ut(this,nr);Ut(this,An);Ot(this,An,t==null?void 0:t.endian),Ot(this,Pe,Po(e.data_type)),Ot(this,nr,e.shape),Ot(this,tr,Qe(e.shape,Li(e.codecs)));const r=new(at(this,Pe))(0);Ot(this,er,r.BYTES_PER_ELEMENT)}static fromConfig(t,e){return new Ns(t,e)}encode(t){let e=new Uint8Array(t.data.buffer);return Ps&&at(this,An)==="big"&&Cs(e,$s(at(this,Pe))),e}decode(t){return Ps&&at(this,An)==="big"&&Cs(t,$s(at(this,Pe))),{data:new(at(this,Pe))(t.buffer,t.byteOffset,t.byteLength/at(this,er)),shape:at(this,nr),stride:at(this,tr)}}};tr=new WeakMap,Pe=new WeakMap,er=new WeakMap,nr=new WeakMap,An=new WeakMap;let Or=Ns;class ts{constructor(){W(this,"kind","bytes_to_bytes")}static fromConfig(){return new ts}encode(t){throw new Error("Not implemented")}decode(t){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength-4)}}function vu(n,t){if(Number.isNaN(t))throw new Error("JsonCodec allow_nan is false but NaN was encountered during encoding.");if(t===Number.POSITIVE_INFINITY)throw new Error("JsonCodec allow_nan is false but Infinity was encountered during encoding.");if(t===Number.NEGATIVE_INFINITY)throw new Error("JsonCodec allow_nan is false but -Infinity was encountered during encoding.");return t}function Su(n,t){return t instanceof Object&&!Array.isArray(t)?Object.keys(t).sort().reduce((e,r)=>(e[r]=t[r],e),{}):t}var rr,ir;const Es=class Es{constructor(t={}){W(this,"configuration");W(this,"kind","array_to_bytes");Ut(this,rr);Ut(this,ir);this.configuration=t;const{encoding:e="utf-8",skipkeys:r=!1,ensure_ascii:i=!0,check_circular:s=!0,allow_nan:o=!0,sort_keys:a=!0,indent:c,strict:u=!0}=t;let f=t.separators;f||(c?f=[", ",": "]:f=[",",":"]),Ot(this,rr,{encoding:e,skipkeys:r,ensure_ascii:i,check_circular:s,allow_nan:o,indent:c,separators:f,sort_keys:a}),Ot(this,ir,{strict:u})}static fromConfig(t){return new Es(t)}encode(t){const{indent:e,encoding:r,ensure_ascii:i,check_circular:s,allow_nan:o,sort_keys:a}=at(this,rr);if(r!=="utf-8")throw new Error("JsonCodec does not yet support non-utf-8 encoding.");const c=[];if(!s)throw new Error("JsonCodec does not yet support skipping the check for circular references during encoding.");o||c.push(vu),a&&c.push(Su);const u=Array.from(t.data);u.push("|O"),u.push(t.shape);let f;c.length&&(f=(k,I)=>{let m=I;for(let B of c)m=B(k,m);return m});let S=JSON.stringify(u,f,e);return i&&(S=S.replace(/[\u007F-\uFFFF]/g,k=>{const I=`0000${k.charCodeAt(0).toString(16)}`;return`\\u${I.substring(I.length-4)}`})),new TextEncoder().encode(S)}decode(t){const{strict:e}=at(this,ir);if(!e)throw new Error("JsonCodec does not yet support non-strict decoding.");const r=en(t),i=r.pop();if(r.pop(),!i)throw new Error("0D not implemented for JsonCodec.");const s=Qe(i,"C");return{data:r,shape:i,stride:s}}};rr=new WeakMap,ir=new WeakMap;let xi=Es;function zs(n){return n instanceof Co||n instanceof Xi||n instanceof Yn?new Proxy(n,{get(e,r){return e.get(Number(r))},set(e,r,i){return e.set(Number(r),i),!0}}):n}function Iu(n,t){let e;return n.data instanceof Xi||n.data instanceof Yn?e=new n.constructor(n.data.length,n.data.chars):e=new n.constructor(n.data.length),{data:e,shape:n.shape,stride:Qe(n.shape,t)}}function Bu(n,t){let e=Iu(n,t),r=n.shape.length,i=n.data.length,s=Array(r).fill(0),o=zs(n.data),a=zs(e.data);for(let c=0;c<i;c++){let u=0;for(let f=0;f<r;f++)u+=s[f]*e.stride[f];a[u]=o[c],s[0]+=1;for(let f=0;f<r;f++)if(s[f]===n.shape[f]){if(f+1===r)break;s[f]=0,s[f+1]+=1}}return e}function Mu(n){if(!n.stride)return"C";let t=Qe(n.shape,"C");return n.stride.every((e,r)=>e===t[r])?"C":"F"}class es{constructor(t){W(this,"configuration");W(this,"kind","array_to_array");this.configuration=t}static fromConfig(t){return new es(t)}encode(t){var e,r;return Mu(t)===((e=this.configuration)==null?void 0:e.order)?t:Bu(t,((r=this.configuration)==null?void 0:r.order)??"C")}decode(t){return t}}var sr,or;const Ls=class Ls{constructor(t){W(this,"kind","array_to_bytes");Ut(this,sr);Ut(this,or);Ot(this,sr,t),Ot(this,or,Qe(t,"C"))}static fromConfig(t,e){return new Ls(e.shape)}encode(t){throw new Error("Method not implemented.")}decode(t){let e=new TextDecoder,r=new DataView(t.buffer),i=Array(r.getUint32(0,!0)),s=4;for(let o=0;o<i.length;o++){let a=r.getUint32(s,!0);s+=4,i[o]=e.decode(t.buffer.slice(s,s+a)),s+=a}return{data:i,shape:at(this,sr),stride:at(this,or)}}};sr=new WeakMap,or=new WeakMap;let Ui=Ls;function Au(){return new Map().set("blosc",()=>Promise.resolve().then(()=>require("./blosc-CeItQ6qj.cjs")).then(n=>n.default)).set("gzip",()=>Promise.resolve().then(()=>require("./gzip-DfmsOCZR.cjs")).then(n=>n.default)).set("lz4",()=>Promise.resolve().then(()=>require("./lz4-PFaIsPAh.cjs")).then(n=>n.default)).set("zlib",()=>Promise.resolve().then(()=>require("./zlib-C-RQJQaC.cjs")).then(n=>n.default)).set("zstd",()=>Promise.resolve().then(()=>require("./zstd-_xUhkGOV.cjs")).then(n=>n.default)).set("transpose",()=>es).set("bytes",()=>Or).set("crc32c",()=>ts).set("vlen-utf8",()=>Ui).set("json2",()=>xi)}const Du=Au();function Ri(n){let t;return{async encode(e){t||(t=await Vs(n));for(const i of t.array_to_array)e=await i.encode(e);let r=await t.array_to_bytes.encode(e);for(const i of t.bytes_to_bytes)r=await i.encode(r);return r},async decode(e){t||(t=await Vs(n));for(let i=t.bytes_to_bytes.length-1;i>=0;i--)e=await t.bytes_to_bytes[i].decode(e);let r=await t.array_to_bytes.decode(e);for(let i=t.array_to_array.length-1;i>=0;i--)r=await t.array_to_array[i].decode(r);return r}}}async function Vs(n){let t=n.codecs.map(async s=>{var a;let o=await((a=Du.get(s.name))==null?void 0:a());if(!o)throw new Error(`Unknown codec: ${s.name}`);return{Codec:o,meta:s}}),e=[],r,i=[];for await(let{Codec:s,meta:o}of t){let a=s.fromConfig(o.configuration,n);switch(a.kind){case"array_to_array":e.push(a);break;case"array_to_bytes":r=a;break;default:i.push(a)}}if(!r){if(!Ou(n))throw new Error(`Cannot encode ${n.data_type} to bytes without a codec`);r=Or.fromConfig({endian:"little"},n)}return{array_to_array:e,array_to_bytes:r,bytes_to_bytes:i}}function Ou(n){return n.data_type!=="v2:object"}const js=18446744073709551615n;function ku(n,t,e,r){if(n.store.getRange===void 0)throw new Error("Store does not support range requests");let i=n.store.getRange.bind(n.store),s=t.map((c,u)=>c/r.chunk_shape[u]),o=Ri({data_type:"uint64",shape:[...s,2],codecs:r.index_codecs}),a={};return async c=>{let u=c.map((F,T)=>Math.floor(F/s[T])),f=n.resolve(e(u)).path,S;if(f in a)S=a[f];else{let F=4,T=16*s.reduce((j,w)=>j*w,1),U=await i(f,{suffixLength:T+F});S=a[f]=U?await o.decode(U):null}if(S===null)return;let{data:k,shape:I,stride:m}=S,B=c.map((F,T)=>F%I[T]).reduce((F,T,U)=>F+T*m[U],0),_=k[B],D=k[B+1];if(!(_===js&&D===js))return i(f,{offset:Number(_),length:Number(D)})}}class je{constructor(t,e="/"){W(this,"store");W(this,"path");this.store=t,this.path=e}resolve(t){let e=new URL(`file://${this.path.endsWith("/")?this.path:`${this.path}/`}`);return new je(this.store,new URL(t,e).pathname)}}function Ws(n){return new je(n??new Map)}var ar;class ci extends je{constructor(e,r,i){super(e,r);W(this,"kind","group");Ut(this,ar);Ot(this,ar,i)}get attrs(){return at(this,ar).attributes}}ar=new WeakMap;const Rn=Symbol("zarrita.context");function zo(n){return n[Rn]}function Fu(n,t){let{configuration:e}=t.codecs.find(wu)??{},r={encode_chunk_key:fu(t.chunk_key_encoding),TypedArray:Po(t.data_type),fill_value:t.fill_value};if(e){let s=Li(e.codecs);return{...r,kind:"sharded",chunk_shape:e.chunk_shape,codec:Ri({data_type:t.data_type,shape:e.chunk_shape,codecs:e.codecs}),get_strides(o,a){return Qe(o,a??s)},get_chunk_bytes:ku(n,t.chunk_grid.configuration.chunk_shape,r.encode_chunk_key,e)}}let i=Li(t.codecs);return{...r,kind:"regular",chunk_shape:t.chunk_grid.configuration.chunk_shape,codec:Ri({data_type:t.data_type,shape:t.chunk_grid.configuration.chunk_shape,codecs:t.codecs}),get_strides(s,o){return Qe(s,o??i)},async get_chunk_bytes(s,o){let a=r.encode_chunk_key(s),c=n.resolve(a).path;return n.store.get(c,o)}}}var xo,Uo,qe,Ro;let Jn=(Ro=class extends(Uo=je,xo=Rn,Uo){constructor(e,r,i){super(e,r);W(this,"kind","array");Ut(this,qe);W(this,xo);Ot(this,qe,{...i,fill_value:$o(i)}),this[Rn]=Fu(this,i)}get attrs(){return at(this,qe).attributes}get shape(){return at(this,qe).shape}get chunks(){return this[Rn].chunk_shape}get dtype(){return at(this,qe).data_type}async getChunk(e,r){let i=this[Rn],s=await i.get_chunk_bytes(e,r);if(!s){let o=i.chunk_shape.reduce((c,u)=>c*u,1),a=new i.TypedArray(o);return a.fill(i.fill_value),{data:a,shape:i.chunk_shape,stride:i.get_strides(i.chunk_shape)}}return i.codec.decode(s)}is(e){return bu(this.dtype,e)}},qe=new WeakMap,Ro),ui=Tu();function Tu(){let n=new WeakMap;function t(e){let r=n.get(e)??{v2:0,v3:0};return n.set(e,r),r}return{increment(e,r){t(e)[r]+=1},version_max(e){let r=t(e);return r.v3>r.v2?"v3":"v2"}}}async function Nu(n){let t=await n.store.get(n.resolve(".zattrs").path);return t?en(t):{}}async function Eu(n,t={}){let e="store"in n?n:new je(n),r={};return(t.attrs??!0)&&(r=await Nu(e)),t.kind==="array"?Zs(e,r):t.kind==="group"?Gs(e,r):Zs(e,r).catch(i=>{if(i instanceof En)return Gs(e,r);throw i})}async function Zs(n,t){let{path:e}=n.resolve(".zarray"),r=await n.store.get(e);if(!r)throw new En("v2 array",{cause:new ai(e)});return ui.increment(n.store,"v2"),new Jn(n.store,n.path,gu(en(r),t))}async function Gs(n,t){let{path:e}=n.resolve(".zgroup"),r=await n.store.get(e);if(!r)throw new En("v2 group",{cause:new ai(e)});return ui.increment(n.store,"v2"),new ci(n.store,n.path,mu(en(r),t))}async function Lu(n){let{store:t,path:e}=n.resolve("zarr.json"),r=await n.store.get(e);if(!r)throw new En("v3 array or group",{cause:new ai(e)});let i=en(r);return i.node_type==="array"&&(i.fill_value=$o(i)),i.node_type==="array"?new Jn(t,n.path,i):new ci(t,n.path,i)}async function xu(n,t={}){let e="store"in n?n:new je(n),r=await Lu(e);if(ui.increment(e.store,"v3"),t.kind===void 0||t.kind==="array"&&r instanceof Jn||t.kind==="group"&&r instanceof ci)return r;let i=r instanceof Jn?"array":"group";throw new Error(`Expected node of kind ${t.kind}, found ${i}.`)}async function $e(n,t={}){let e="store"in n?n.store:n,r=ui.version_max(e),i=r==="v2"?$e.v2:$e.v3,s=r==="v2"?$e.v3:$e.v2;return i(n,t).catch(o=>{if(o instanceof En)return s(n,t);throw o})}$e.v2=Eu;$e.v3=xu;async function Uu(n,t={}){let e="store"in n?n:new je(n);return"shape"in t?await Cu(e,t):Ru(e,t)}async function Ru(n,t={}){let e={zarr_format:3,node_type:"group",attributes:t.attributes??{}};return await n.store.set(n.resolve("zarr.json").path,Qi(e)),new ci(n.store,n.path,e)}async function Cu(n,t){let e={zarr_format:3,node_type:"array",shape:t.shape,data_type:t.data_type,chunk_grid:{name:"regular",configuration:{chunk_shape:t.chunk_shape}},chunk_key_encoding:{name:"default",configuration:{separator:t.chunk_separator??"/"}},codecs:t.codecs??[],fill_value:t.fill_value??null,attributes:t.attributes??{}};return await n.store.set(n.resolve("zarr.json").path,Qi(e)),new Jn(n.store,n.path,e)}async function Pu(n){let t=await n.get("/.zmetadata");if(!t)throw new En("v2 consolidated metadata",{cause:new ai("/.zmetadata")});let e=en(t);if(e.zarr_consolidated_format!==1)throw new Error("Unsupported consolidated format.");return e}function $u(n){return n.endsWith(".zarray")||n.endsWith(".zgroup")||n.endsWith(".zattrs")||n.endsWith("zarr.json")}function zu(n){return"zarr_format"in n&&n.zarr_format===3}async function Vu(n){let t=await Pu(n),e={};for(let[r,i]of Object.entries(t.metadata))e[`/${r}`]=i;return{async get(...r){let[i,s]=r;if(e[i])return Qi(e[i]);let o=await n.get(i,s);if($u(i)&&o){let a=en(o);e[i]=a}return o},contents(){let r=[];for(let[i,s]of Object.entries(e)){let o=i.split("/"),a=o.pop(),c=o.join("/")||"/";a===".zarray"&&r.push({path:c,kind:"array"}),a===".zgroup"&&r.push({path:c,kind:"group"}),zu(s)&&r.push({path:c,kind:s.node_type})}return r}}}function*ju(n,t,e=1){t===void 0&&(t=n,n=0);for(let r=n;r<t;r+=e)yield r}function*Wu(...n){if(n.length===0)return;const t=n.map(r=>r[Symbol.iterator]()),e=t.map(r=>r.next());if(e.some(r=>r.done))throw new Error("Input contains an empty iterator.");for(let r=0;;){if(e[r].done){if(t[r]=n[r][Symbol.iterator](),e[r]=t[r].next(),++r>=t.length)return}else yield e.map(({value:i})=>i),r=0;e[r]=t[r].next()}}function Zu({start:n,stop:t,step:e},r){if(e===0)throw new Error("slice step cannot be zero");e=e??1;const i=e<0,[s,o]=i?[-1,r-1]:[0,r];return n===null?n=i?o:s:n<0?(n+=r,n<s&&(n=s)):n>o&&(n=o),t===null?t=i?s:o:t<0?(t+=r,t<s&&(t=s)):t>o&&(t=o),[n,t,e]}function Ys(n,t,e=null){return t===void 0&&(t=n,n=null),{start:n,stop:t,step:e}}function Vo(){const n=[];return{add:t=>n.push(t()),onIdle:()=>Promise.all(n)}}class ns extends Error{constructor(t){super(t),this.name="IndexError"}}function Gu(n,t){throw new ns(`too many indicies for array; expected ${t.length}, got ${n.length}`)}function Yu(n){throw new ns(`index out of bounds for dimension with length ${n}`)}function Ju(){throw new ns("only slices with step >= 1 are supported")}function Hu(n,t){n.length>t.length&&Gu(n,t)}function Ku(n,t){return n=Math.trunc(n),n<0&&(n=t+n),(n>=t||n<0)&&Yu(t),n}class qu{constructor({dim_sel:t,dim_len:e,dim_chunk_len:r}){W(this,"dim_sel");W(this,"dim_len");W(this,"dim_chunk_len");W(this,"nitems");t=Ku(t,e),this.dim_sel=t,this.dim_len=e,this.dim_chunk_len=r,this.nitems=1}*[Symbol.iterator](){const t=Math.floor(this.dim_sel/this.dim_chunk_len),e=t*this.dim_chunk_len,r=this.dim_sel-e;yield{dim_chunk_ix:t,dim_chunk_sel:r}}}class Js{constructor({dim_sel:t,dim_len:e,dim_chunk_len:r}){W(this,"start");W(this,"stop");W(this,"step");W(this,"dim_len");W(this,"dim_chunk_len");W(this,"nitems");W(this,"nchunks");const[i,s,o]=Zu(t,e);this.start=i,this.stop=s,this.step=o,this.step<1&&Ju(),this.dim_len=e,this.dim_chunk_len=r,this.nitems=Math.max(0,Math.ceil((this.stop-this.start)/this.step)),this.nchunks=Math.ceil(this.dim_len/this.dim_chunk_len)}*[Symbol.iterator](){const t=Math.floor(this.start/this.dim_chunk_len),e=Math.ceil(this.stop/this.dim_chunk_len);for(const r of ju(t,e)){const i=r*this.dim_chunk_len,s=Math.min(this.dim_len,(r+1)*this.dim_chunk_len),o=s-i;let a=0,c=0;if(this.start<i){const I=(i-this.start)%this.step;I&&(c+=this.step-I),a=Math.ceil((i-this.start)/this.step)}else c=this.start-i;const u=this.stop>s?o:this.stop-i,f=[c,u,this.step],S=Math.ceil((u-c)/this.step),k=[a,a+S,1];yield{dim_chunk_ix:r,dim_chunk_sel:f,dim_out_sel:k}}}}function Xu(n,t){let e=[];return n===null?e=t.map(r=>Ys(null)):Array.isArray(n)&&(e=n.map(r=>r??Ys(null))),Hu(e,t),e}class jo{constructor({selection:t,shape:e,chunk_shape:r}){W(this,"dim_indexers");W(this,"shape");this.dim_indexers=Xu(t,e).map((i,s)=>new(typeof i=="number"?qu:Js)({dim_sel:i,dim_len:e[s],dim_chunk_len:r[s]})),this.shape=this.dim_indexers.filter(i=>i instanceof Js).map(i=>i.nitems)}*[Symbol.iterator](){for(const t of Wu(...this.dim_indexers)){const e=t.map(i=>i.dim_chunk_ix),r=t.map(i=>"dim_out_sel"in i?{from:i.dim_chunk_sel,to:i.dim_out_sel}:{from:i.dim_chunk_sel,to:null});yield{chunk_coords:e,mapping:r}}}}function Qu(n,t){return"get"in n?n.get(t):n[t]}async function tl(n,t,e,r){var c;let i=zo(n),s=new jo({selection:t,shape:n.shape,chunk_shape:n.chunks}),o=r.prepare(new i.TypedArray(s.shape.reduce((u,f)=>u*f,1)),s.shape,i.get_strides(s.shape,e.order)),a=((c=e.create_queue)==null?void 0:c.call(e))??Vo();for(const{chunk_coords:u,mapping:f}of s)a.add(async()=>{let{data:S,shape:k,stride:I}=await n.getChunk(u,e.opts),m=r.prepare(S,k,I);r.set_from_chunk(o,m,f)});return await a.onIdle(),s.shape.length===0?Qu(o.data,0):o}function el(n){return n.to==null?{from:n.to,to:n.from}:{from:n.to,to:n.from}}async function nl(n,t,e,r,i){const s=zo(n);if(s.kind==="sharded")throw new Error("Set not supported for sharded arrays.");const o=new jo({selection:t,shape:n.shape,chunk_shape:n.chunks}),a=n.chunks.reduce((u,f)=>u*f,1),c=r.create_queue?r.create_queue():Vo();for(const{chunk_coords:u,mapping:f}of o){const S=f.map(I=>I.from),k=f.map(el);c.add(async()=>{const I=n.resolve(s.encode_chunk_key(u)).path;let m;const B=n.chunks.slice(),_=s.get_strides(B);if(rl(S,B))if(m=new s.TypedArray(a),typeof e=="object"){const D=i.prepare(m,B.slice(),_.slice());i.set_from_chunk(D,e,k)}else m.fill(e);else{m=await n.getChunk(u).then(({data:F})=>F);const D=i.prepare(m,B.slice(),_.slice());typeof e=="object"?i.set_from_chunk(D,e,k):i.set_scalar(D,S,e)}await n.store.set(I,await s.codec.encode({data:m,shape:B,stride:_}))})}await c.onIdle()}function rl(n,t){return n.every((e,r)=>{if(typeof e=="number")return!1;const[i,s,o]=e;return s-i===t[r]&&o===1})}function rs(n,t=0,e){let r=e??n.length-t;return{length:r,subarray(i,s=r){return rs(n,t+i,s-i)},set(i,s=0){for(let o=0;o<i.length;o++)n[t+s+o]=i.get(o)},get(i){return n[t+i]}}}function gi(n){return globalThis.Array.isArray(n.data)?{data:rs(n.data),stride:n.stride,bytes_per_element:1}:{data:new Uint8Array(n.data.buffer,n.data.byteOffset,n.data.byteLength),stride:n.stride,bytes_per_element:n.data.BYTES_PER_ELEMENT}}function il(n){return"chars"in n?n.constructor.bind(null,n.chars):n.constructor}function sl(n,t){if(globalThis.Array.isArray(n.data))return rs([t]);let e=il(n.data),r=new e([t]);return new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}const Wo={prepare(n,t,e){return{data:n,shape:t,stride:e}},set_scalar(n,t,e){let r=gi(n);Ci(r,t,sl(n,e),r.bytes_per_element)},set_from_chunk(n,t,e){let r=gi(n);mr(r,gi(t),r.bytes_per_element,e)}};async function ol(n,t=null,e={}){return tl(n,t,e,Wo)}async function al(n,t,e,r={}){return nl(n,t,e,r,Wo)}function Zo(n,t,e){return e<0&&t<n?Math.floor((n-t-1)/-e)+1:n<t?Math.floor((t-n-1)/e)+1:0}function Ci(n,t,e,r){if(t.length===0){n.data.set(e,0);return}const[i,...s]=t,[o,...a]=n.stride;if(typeof i=="number"){const k=n.data.subarray(o*i*r);Ci({data:k,stride:a},s,e,r);return}const[c,u,f]=i,S=Zo(c,u,f);if(s.length===0){for(let k=0;k<S;k++)n.data.set(e,o*(c+f*k)*r);return}for(let k=0;k<S;k++){const I=n.data.subarray(o*(c+f*k)*r);Ci({data:I,stride:a},s,e,r)}}function mr(n,t,e,r){const[i,...s]=r,[o,...a]=n.stride,[c,...u]=t.stride;if(i.from===null){if(s.length===0){n.data.set(t.data.subarray(0,e),i.to*e);return}mr({data:n.data.subarray(o*i.to*e),stride:a},t,e,s);return}if(i.to===null){if(s.length===0){let D=i.from*e;n.data.set(t.data.subarray(D,D+e),0);return}mr(n,{data:t.data.subarray(c*i.from*e),stride:u},e,s);return}const[f,S,k]=i.to,[I,m,B]=i.from,_=Zo(f,S,k);if(s.length===0){if(k===1&&B===1&&o===1&&c===1){let D=I*e,F=_*e;n.data.set(t.data.subarray(D,D+F),f*e);return}for(let D=0;D<_;D++){let F=c*(I+B*D)*e;n.data.set(t.data.subarray(F,F+e),o*(f+k*D)*e)}return}for(let D=0;D<_;D++)mr({data:n.data.subarray(o*(f+D*k)*e),stride:a},{data:t.data.subarray(c*(I+D*B)*e),stride:u},e,s)}function rt(n,t,e,r){function i(s){return s instanceof e?s:new e(function(o){o(s)})}return new(e||(e=Promise))(function(s,o){function a(f){try{u(r.next(f))}catch(S){o(S)}}function c(f){try{u(r.throw(f))}catch(S){o(S)}}function u(f){f.done?s(f.value):i(f.value).then(a,c)}u((r=r.apply(n,t||[])).next())})}function Hs(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],r=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function it(n){return this instanceof it?(this.v=n,this):new it(n)}function be(n,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=e.apply(n,t||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(I){return function(m){return Promise.resolve(m).then(I,S)}}function a(I,m){r[I]&&(i[I]=function(B){return new Promise(function(_,D){s.push([I,B,_,D])>1||c(I,B)})},m&&(i[I]=m(i[I])))}function c(I,m){try{u(r[I](m))}catch(B){k(s[0][3],B)}}function u(I){I.value instanceof it?Promise.resolve(I.value.v).then(f,S):k(s[0][2],I)}function f(I){c("next",I)}function S(I){c("throw",I)}function k(I,m){I(m),s.shift(),s.length&&c(s[0][0],s[0][1])}}function br(n){var t,e;return t={},r("next"),r("throw",function(i){throw i}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(i,s){t[i]=n[i]?function(o){return(e=!e)?{value:it(n[i](o)),done:!1}:s?s(o):o}:s}}function _n(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=n[Symbol.asyncIterator],e;return t?t.call(n):(n=typeof Hs=="function"?Hs(n):n[Symbol.iterator](),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(s){e[s]=n[s]&&function(o){return new Promise(function(a,c){o=n[s](o),i(a,c,o.done,o.value)})}}function i(s,o,a,c){Promise.resolve(c).then(function(u){s({value:u,done:a})},o)}}const cl=new TextDecoder("utf-8"),Pi=n=>cl.decode(n),ul=new TextEncoder,is=n=>ul.encode(n),ll=n=>typeof n=="number",hl=n=>typeof n=="boolean",Rt=n=>typeof n=="function",ae=n=>n!=null&&Object(n)===n,Hn=n=>ae(n)&&Rt(n.then),li=n=>ae(n)&&Rt(n[Symbol.iterator]),ss=n=>ae(n)&&Rt(n[Symbol.asyncIterator]),$i=n=>ae(n)&&ae(n.schema),Go=n=>ae(n)&&"done"in n&&"value"in n,Yo=n=>ae(n)&&Rt(n.stat)&&ll(n.fd),Jo=n=>ae(n)&&os(n.body),Ho=n=>"_getDOMStream"in n&&"_getNodeStream"in n,os=n=>ae(n)&&Rt(n.cancel)&&Rt(n.getReader)&&!Ho(n),Ko=n=>ae(n)&&Rt(n.read)&&Rt(n.pipe)&&hl(n.readable)&&!Ho(n),dl=n=>ae(n)&&Rt(n.clear)&&Rt(n.bytes)&&Rt(n.position)&&Rt(n.setPosition)&&Rt(n.capacity)&&Rt(n.getBufferIdentifier)&&Rt(n.createLong),as=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function fl(n){const t=n[0]?[n[0]]:[];let e,r,i,s;for(let o,a,c=0,u=0,f=n.length;++c<f;){if(o=t[u],a=n[c],!o||!a||o.buffer!==a.buffer||a.byteOffset<o.byteOffset){a&&(t[++u]=a);continue}if({byteOffset:e,byteLength:i}=o,{byteOffset:r,byteLength:s}=a,e+i<r||r+s<e){a&&(t[++u]=a);continue}t[u]=new Uint8Array(o.buffer,e,r-e+s)}return t}function Ks(n,t,e=0,r=t.byteLength){const i=n.byteLength,s=new Uint8Array(n.buffer,n.byteOffset,i),o=new Uint8Array(t.buffer,t.byteOffset,Math.min(r,i));return s.set(o,e),n}function we(n,t){const e=fl(n),r=e.reduce((f,S)=>f+S.byteLength,0);let i,s,o,a=0,c=-1;const u=Math.min(t||Number.POSITIVE_INFINITY,r);for(const f=e.length;++c<f;){if(i=e[c],s=i.subarray(0,Math.min(i.length,u-a)),u<=a+s.length){s.length<i.length?e[c]=i.subarray(s.length):s.length===i.length&&c++,o?Ks(o,s,a):o=s;break}Ks(o||(o=new Uint8Array(u)),s,a),a+=s.length}return[o||new Uint8Array(0),e.slice(c),r-(o?o.byteLength:0)]}function gt(n,t){let e=Go(t)?t.value:t;return e instanceof n?n===Uint8Array?new n(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=is(e)),e instanceof ArrayBuffer?new n(e):e instanceof as?new n(e):dl(e)?gt(n,e.bytes()):ArrayBuffer.isView(e)?e.byteLength<=0?new n(0):new n(e.buffer,e.byteOffset,e.byteLength/n.BYTES_PER_ELEMENT):n.from(e)):new n(0)}const Un=n=>gt(Int32Array,n),qs=n=>gt(BigInt64Array,n),lt=n=>gt(Uint8Array,n),zi=n=>(n.next(),n);function*pl(n,t){const e=function*(i){yield i},r=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof as?e(t):li(t)?t:e(t);return yield*zi(function*(i){let s=null;do s=i.next(yield gt(n,s));while(!s.done)}(r[Symbol.iterator]())),new n}const yl=n=>pl(Uint8Array,n);function qo(n,t){return be(this,arguments,function*(){if(Hn(t))return yield it(yield it(yield*br(_n(qo(n,yield it(t))))));const r=function(o){return be(this,arguments,function*(){yield yield it(yield it(o))})},i=function(o){return be(this,arguments,function*(){yield it(yield*br(_n(zi(function*(a){let c=null;do c=a.next(yield c==null?void 0:c.value);while(!c.done)}(o[Symbol.iterator]())))))})},s=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof as?r(t):li(t)?i(t):ss(t)?t:r(t);return yield it(yield*br(_n(zi(function(o){return be(this,arguments,function*(){let a=null;do a=yield it(o.next(yield yield it(gt(n,a))));while(!a.done)})}(s[Symbol.asyncIterator]()))))),yield it(new n)})}const gl=n=>qo(Uint8Array,n);function ml(n,t){let e=0;const r=n.length;if(r!==t.length)return!1;if(r>0)do if(n[e]!==t[e])return!1;while(++e<r);return!0}const qt={fromIterable(n){return fr(bl(n))},fromAsyncIterable(n){return fr(wl(n))},fromDOMStream(n){return fr(_l(n))},fromNodeStream(n){return fr(Sl(n))},toDOMStream(n,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(n,t){throw new Error('"toNodeStream" not available in this environment')}},fr=n=>(n.next(),n);function*bl(n){let t,e=!1,r=[],i,s,o,a=0;function c(){return s==="peek"?we(r,o)[0]:([i,r,a]=we(r,o),i)}({cmd:s,size:o}=(yield null)||{cmd:"read",size:0});const u=yl(n)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(o-a)?u.next():u.next(o-a),!t&&i.byteLength>0&&(r.push(i),a+=i.byteLength),t||o<=a)do({cmd:s,size:o}=yield c());while(o<a);while(!t)}catch(f){(e=!0)&&typeof u.throw=="function"&&u.throw(f)}finally{e===!1&&typeof u.return=="function"&&u.return(null)}return null}function wl(n){return be(this,arguments,function*(){let e,r=!1,i=[],s,o,a,c=0;function u(){return o==="peek"?we(i,a)[0]:([s,i,c]=we(i,a),s)}({cmd:o,size:a}=(yield yield it(null))||{cmd:"read",size:0});const f=gl(n)[Symbol.asyncIterator]();try{do if({done:e,value:s}=Number.isNaN(a-c)?yield it(f.next()):yield it(f.next(a-c)),!e&&s.byteLength>0&&(i.push(s),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield it(u()));while(a<c);while(!e)}catch(S){(r=!0)&&typeof f.throw=="function"&&(yield it(f.throw(S)))}finally{r===!1&&typeof f.return=="function"&&(yield it(f.return(new Uint8Array(0))))}return yield it(null)})}function _l(n){return be(this,arguments,function*(){let e=!1,r=!1,i=[],s,o,a,c=0;function u(){return o==="peek"?we(i,a)[0]:([s,i,c]=we(i,a),s)}({cmd:o,size:a}=(yield yield it(null))||{cmd:"read",size:0});const f=new vl(n);try{do if({done:e,value:s}=Number.isNaN(a-c)?yield it(f.read()):yield it(f.read(a-c)),!e&&s.byteLength>0&&(i.push(lt(s)),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield it(u()));while(a<c);while(!e)}catch(S){(r=!0)&&(yield it(f.cancel(S)))}finally{r===!1?yield it(f.cancel()):n.locked&&f.releaseLock()}return yield it(null)})}class vl{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 rt(this,void 0,void 0,function*(){const{reader:e,source:r}=this;e&&(yield e.cancel(t).catch(()=>{})),r&&r.locked&&this.releaseLock()})}read(t){return rt(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};const e=yield this.reader.read();return!e.done&&(e.value=lt(e)),e})}}const mi=(n,t)=>{const e=i=>r([t,i]);let r;return[t,e,new Promise(i=>(r=i)&&n.once(t,e))]};function Sl(n){return be(this,arguments,function*(){const e=[];let r="error",i=!1,s=null,o,a,c=0,u=[],f;function S(){return o==="peek"?we(u,a)[0]:([f,u,c]=we(u,a),f)}if({cmd:o,size:a}=(yield yield it(null))||{cmd:"read",size:0},n.isTTY)return yield yield it(new Uint8Array(0)),yield it(null);try{e[0]=mi(n,"end"),e[1]=mi(n,"error");do{if(e[2]=mi(n,"readable"),[r,s]=yield it(Promise.race(e.map(I=>I[2]))),r==="error")break;if((i=r==="end")||(Number.isFinite(a-c)?(f=lt(n.read(a-c)),f.byteLength<a-c&&(f=lt(n.read()))):f=lt(n.read()),f.byteLength>0&&(u.push(f),c+=f.byteLength)),i||a<=c)do({cmd:o,size:a}=yield yield it(S()));while(a<c)}while(!i)}finally{yield it(k(e,r==="error"?s:null))}return yield it(null);function k(I,m){return f=u=null,new Promise((B,_)=>{for(const[D,F]of I)n.off(D,F);try{const D=n.destroy;D&&D.call(n,m),m=void 0}catch(D){m=D||m}finally{m!=null?_(m):B()}})}})}var At;(function(n){n[n.V1=0]="V1",n[n.V2=1]="V2",n[n.V3=2]="V3",n[n.V4=3]="V4",n[n.V5=4]="V5"})(At||(At={}));var Wt;(function(n){n[n.Sparse=0]="Sparse",n[n.Dense=1]="Dense"})(Wt||(Wt={}));var xt;(function(n){n[n.HALF=0]="HALF",n[n.SINGLE=1]="SINGLE",n[n.DOUBLE=2]="DOUBLE"})(xt||(xt={}));var ee;(function(n){n[n.DAY=0]="DAY",n[n.MILLISECOND=1]="MILLISECOND"})(ee||(ee={}));var q;(function(n){n[n.SECOND=0]="SECOND",n[n.MILLISECOND=1]="MILLISECOND",n[n.MICROSECOND=2]="MICROSECOND",n[n.NANOSECOND=3]="NANOSECOND"})(q||(q={}));var _e;(function(n){n[n.YEAR_MONTH=0]="YEAR_MONTH",n[n.DAY_TIME=1]="DAY_TIME",n[n.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(_e||(_e={}));const bi=2,ye=4,Oe=4,ft=4,Re=new Int32Array(2),Xs=new Float32Array(Re.buffer),Qs=new Float64Array(Re.buffer),pr=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Vi;(function(n){n[n.UTF8_BYTES=1]="UTF8_BYTES",n[n.UTF16_STRING=2]="UTF16_STRING"})(Vi||(Vi={}));let Dn=class Xo{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new Xo(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 Re[0]=this.readInt32(t),Xs[0]}readFloat64(t){return Re[pr?0:1]=this.readInt32(t),Re[pr?1:0]=this.readInt32(t+4),Qs[0]}writeInt8(t,e){this.bytes_[t]=e}writeUint8(t,e){this.bytes_[t]=e}writeInt16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeUint16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeInt32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeUint32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeInt64(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))}writeUint64(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))}writeFloat32(t,e){Xs[0]=e,this.writeInt32(t,Re[0])}writeFloat64(t,e){Qs[0]=e,this.writeInt32(t,Re[pr?0:1]),this.writeInt32(t+4,Re[pr?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+ye+Oe)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let e=0;e<Oe;e++)t+=String.fromCharCode(this.readInt8(this.position_+ye+e));return t}__offset(t,e){const r=t-this.readInt32(t);return e<this.readInt16(r)?this.readInt16(r+e):0}__union(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t}__string(t,e){t+=this.readInt32(t);const r=this.readInt32(t);t+=ye;const i=this.bytes_.subarray(t,t+r);return e===Vi.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,e){return typeof t=="string"?this.__string(e):this.__union(t,e)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+ye}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=Oe)throw new Error("FlatBuffers: file identifier must be length "+Oe);for(let e=0;e<Oe;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+ye+e))return!1;return!0}createScalarList(t,e){const r=[];for(let i=0;i<e;++i){const s=t(i);s!==null&&r.push(s)}return r}createObjList(t,e){const r=[];for(let i=0;i<e;++i){const s=t(i);s!==null&&r.push(s.unpack())}return r}},Qo=class ta{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 e;t?e=t:e=1024,this.bb=Dn.allocate(e),this.space=e}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,e){t>this.minalign&&(this.minalign=t);const r=~(this.bb.capacity()-this.space+e)+1&t-1;for(;this.space<r+t+e;){const i=this.bb.capacity();this.bb=ta.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(r)}pad(t){for(let e=0;e<t;e++)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,e,r){(this.force_defaults||e!=r)&&(this.addInt8(e),this.slot(t))}addFieldInt16(t,e,r){(this.force_defaults||e!=r)&&(this.addInt16(e),this.slot(t))}addFieldInt32(t,e,r){(this.force_defaults||e!=r)&&(this.addInt32(e),this.slot(t))}addFieldInt64(t,e,r){(this.force_defaults||e!==r)&&(this.addInt64(e),this.slot(t))}addFieldFloat32(t,e,r){(this.force_defaults||e!=r)&&(this.addFloat32(e),this.slot(t))}addFieldFloat64(t,e,r){(this.force_defaults||e!=r)&&(this.addFloat64(e),this.slot(t))}addFieldOffset(t,e,r){(this.force_defaults||e!=r)&&(this.addOffset(e),this.slot(t))}addFieldStruct(t,e,r){e!=r&&(this.nested(e),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){const e=t.capacity();if(e&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");const r=e<<1,i=Dn.allocate(r);return i.setPosition(r-e),i.bytes().set(t.bytes(),r-e),i}addOffset(t){this.prep(ye,0),this.writeInt32(this.offset()-t+ye)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let e=0;e<t;e++)this.vtable[e]=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);const t=this.offset();let e=this.vtable_in_use-1;for(;e>=0&&this.vtable[e]==0;e--);const r=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);const i=2;this.addInt16(t-this.object_start);const s=(r+i)*bi;this.addInt16(s);let o=0;const a=this.space;t:for(e=0;e<this.vtables.length;e++){const c=this.bb.capacity()-this.vtables[e];if(s==this.bb.readInt16(c)){for(let u=bi;u<s;u+=bi)if(this.bb.readInt16(a+u)!=this.bb.readInt16(c+u))continue t;o=this.vtables[e];break}}return o?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,o-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,e,r){const i=r?ft:0;if(e){const s=e;if(this.prep(this.minalign,ye+Oe+i),s.length!=Oe)throw new TypeError("FlatBuffers: file identifier must be length "+Oe);for(let o=Oe-1;o>=0;o--)this.writeInt8(s.charCodeAt(o))}this.prep(this.minalign,ye+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){const r=this.bb.capacity()-t,i=r-this.bb.readInt32(r);if(!(e<this.bb.readInt16(i)&&this.bb.readInt16(i+e)!=0))throw new TypeError("FlatBuffers: field "+e+" must be set")}startVector(t,e,r){this.notNested(),this.vector_num_elems=e,this.prep(ye,t*e),this.prep(r,t*e)}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);const e=this.createString(t);return this.string_maps.set(t,e),e}createString(t){if(t==null)return 0;let e;return t instanceof Uint8Array?e=t:e=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,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){const e=[];for(let r=0;r<t.length;++r){const i=t[r];if(i!==null)e.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e}createStructOffsetList(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var kr;(function(n){n[n.BUFFER=0]="BUFFER"})(kr||(kr={}));var Fr;(function(n){n[n.LZ4_FRAME=0]="LZ4_FRAME",n[n.ZSTD=1]="ZSTD"})(Fr||(Fr={}));class Ce{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBodyCompression(t,e){return(e||new Ce).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+ft),(e||new Ce).__init(t.readInt32(t.position())+t.position(),t)}codec(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):Fr.LZ4_FRAME}method(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):kr.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,Fr.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,kr.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,r){return Ce.startBodyCompression(t),Ce.addCodec(t,e),Ce.addMethod(t,r),Ce.endBodyCompression(t)}}let ea=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,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,e,r){return t.prep(8,16),t.writeInt64(BigInt(r??0)),t.writeInt64(BigInt(e??0)),t.offset()}},na=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,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,e,r){return t.prep(8,16),t.writeInt64(BigInt(r??0)),t.writeInt64(BigInt(e??0)),t.offset()}},Me=class ji{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsRecordBatch(t,e){return(e||new ji).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+ft),(e||new ji).__init(t.readInt32(t.position())+t.position(),t)}length(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,e){const r=this.bb.__offset(this.bb_pos,6);return r?(e||new na).__init(this.bb.__vector(this.bb_pos+r)+t*16,this.bb):null}nodesLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,e){const r=this.bb.__offset(this.bb_pos,8);return r?(e||new ea).__init(this.bb.__vector(this.bb_pos+r)+t*16,this.bb):null}buffersLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){const e=this.bb.__offset(this.bb_pos,10);return e?(t||new Ce).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addNodes(t,e){t.addFieldOffset(1,e,0)}static startNodesVector(t,e){t.startVector(16,e,8)}static addBuffers(t,e){t.addFieldOffset(2,e,0)}static startBuffersVector(t,e){t.startVector(16,e,8)}static addCompression(t,e){t.addFieldOffset(3,e,0)}static endRecordBatch(t){return t.endObject()}},cn=class Wi{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryBatch(t,e){return(e||new Wi).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+ft),(e||new Wi).__init(t.readInt32(t.position())+t.position(),t)}id(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new Me).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isDelta(){const 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,e){t.addFieldInt64(0,e,BigInt("0"))}static addData(t,e){t.addFieldOffset(1,e,0)}static addIsDelta(t,e){t.addFieldInt8(2,+e,0)}static endDictionaryBatch(t){return t.endObject()}};var On;(function(n){n[n.Little=0]="Little",n[n.Big=1]="Big"})(On||(On={}));var Tr;(function(n){n[n.DenseArray=0]="DenseArray"})(Tr||(Tr={}));class Ht{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInt(t,e){return(e||new Ht).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+ft),(e||new Ht).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){const 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,e){t.addFieldInt32(0,e,0)}static addIsSigned(t,e){t.addFieldInt8(1,+e,0)}static endInt(t){return t.endObject()}static createInt(t,e,r){return Ht.startInt(t),Ht.addBitWidth(t,e),Ht.addIsSigned(t,r),Ht.endInt(t)}}class ke{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryEncoding(t,e){return(e||new ke).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+ft),(e||new ke).__init(t.readInt32(t.position())+t.position(),t)}id(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new Ht).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isOrdered(){const t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):Tr.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addIndexType(t,e){t.addFieldOffset(1,e,0)}static addIsOrdered(t,e){t.addFieldInt8(2,+e,0)}static addDictionaryKind(t,e){t.addFieldInt16(3,e,Tr.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}}class kt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsKeyValue(t,e){return(e||new kt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+ft),(e||new kt).__init(t.readInt32(t.position())+t.position(),t)}key(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}value(t){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,e){t.addFieldOffset(0,e,0)}static addValue(t,e){t.addFieldOffset(1,e,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,e,r){return kt.startKeyValue(t),kt.addKey(t,e),kt.addValue(t,r),kt.endKeyValue(t)}}let to=class Cn{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBinary(t,e){return(e||new Cn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+ft),(e||new Cn).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return Cn.startBinary(t),Cn.endBinary(t)}},eo=class Pn{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBool(t,e){return(e||new Pn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+ft),(e||new Pn).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return Pn.startBool(t),Pn.endBool(t)}},wr=class un{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDate(t,e){return(e||new un).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+ft),(e||new un).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ee.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,ee.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return un.startDate(t),un.addUnit(t,e),un.endDate(t)}},ln=class Ue{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDecimal(t,e){return(e||new Ue).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+ft),(e||new Ue).__init(t.readInt32(t.position())+t.position(),t)}precision(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){const 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,e){t.addFieldInt32(0,e,0)}static addScale(t,e){t.addFieldInt32(1,e,0)}static addBitWidth(t,e){t.addFieldInt32(2,e,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,e,r,i){return Ue.startDecimal(t),Ue.addPrecision(t,e),Ue.addScale(t,r),Ue.addBitWidth(t,i),Ue.endDecimal(t)}},_r=class hn{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDuration(t,e){return(e||new hn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,e){return t.setPosition(t.position()+ft),(e||new hn).__init(t.readInt32(t.position())+t.position(),t)}unit(){const 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,e){t.addFieldInt16(0,e,q.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,e){return hn.startDuration(t),hn.addUnit(t,e),hn.endDuration(t)}},vr=class dn{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeBinary(t,e){return(e||new dn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+ft),(e||new dn).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){const 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,e){t.addFieldInt32(0,e,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,e){return dn.startFixedSizeBinary(t),dn.addByteWidth(t,e),dn.endFixedSizeBinary(t)}},Sr=class fn{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeList(t,e){return(e||new fn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+ft),(e||new fn).__init(t.readInt32(t.position())+t.position(),t)}listSize(){const 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,e){t.addFieldInt32(0,e,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,e){return fn.startFixedSizeList(t),fn.addListSize(t,e),fn.endFixedSizeList(t)}};class ge{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFloatingPoint(t,e){return(e||new ge).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+ft),(e||new ge).__init(t.readInt32(t.position())+t.position(),t)}precision(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):xt.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,xt.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return ge.startFloatingPoint(t),ge.addPrecision(t,e),ge.endFloatingPoint(t)}}class me{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInterval(t,e){return(e||new me).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+ft),(e||new me).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):_e.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,_e.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return me.startInterval(t),me.addUnit(t,e),me.endInterval(t)}}let no=class $n{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsLargeBinary(t,e){return(e||new $n).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,e){return t.setPosition(t.position()+ft),(e||new $n).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return $n.startLargeBinary(t),$n.endLargeBinary(t)}},ro=class zn{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsLargeUtf8(t,e){return(e||new zn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,e){return t.setPosition(t.position()+ft),(e||new zn).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return zn.startLargeUtf8(t),zn.endLargeUtf8(t)}},io=class Vn{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsList(t,e){return(e||new Vn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+ft),(e||new Vn).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return Vn.startList(t),Vn.endList(t)}},Ir=class pn{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMap(t,e){return(e||new pn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+ft),(e||new pn).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){const 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,e){t.addFieldInt8(0,+e,0)}static endMap(t){return t.endObject()}static createMap(t,e){return pn.startMap(t),pn.addKeysSorted(t,e),pn.endMap(t)}},so=class jn{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsNull(t,e){return(e||new jn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+ft),(e||new jn).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return jn.startNull(t),jn.endNull(t)}};class Ke{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsStruct_(t,e){return(e||new Ke).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+ft),(e||new Ke).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return Ke.startStruct_(t),Ke.endStruct_(t)}}class Xt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTime(t,e){return(e||new Xt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+ft),(e||new Xt).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):q.MILLISECOND}bitWidth(){const 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,e){t.addFieldInt16(0,e,q.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,r){return Xt.startTime(t),Xt.addUnit(t,e),Xt.addBitWidth(t,r),Xt.endTime(t)}}class Qt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTimestamp(t,e){return(e||new Qt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+ft),(e||new Qt).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):q.SECOND}timezone(t){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,q.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,r){return Qt.startTimestamp(t),Qt.addUnit(t,e),Qt.addTimezone(t,r),Qt.endTimestamp(t)}}class jt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUnion(t,e){return(e||new jt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+ft),(e||new jt).__init(t.readInt32(t.position())+t.position(),t)}mode(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Wt.Sparse}typeIds(t){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb.__vector(this.bb_pos+e)+t*4):0}typeIdsLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){const 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,e){t.addFieldInt16(0,e,Wt.Sparse)}static addTypeIds(t,e){t.addFieldOffset(1,e,0)}static createTypeIdsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addInt32(e[r]);return t.endVector()}static startTypeIdsVector(t,e){t.startVector(4,e,4)}static endUnion(t){return t.endObject()}static createUnion(t,e,r){return jt.startUnion(t),jt.addMode(t,e),jt.addTypeIds(t,r),jt.endUnion(t)}}let oo=class Wn{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUtf8(t,e){return(e||new Wn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+ft),(e||new Wn).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return Wn.startUtf8(t),Wn.endUtf8(t)}};var bt;(function(n){n[n.NONE=0]="NONE",n[n.Null=1]="Null",n[n.Int=2]="Int",n[n.FloatingPoint=3]="FloatingPoint",n[n.Binary=4]="Binary",n[n.Utf8=5]="Utf8",n[n.Bool=6]="Bool",n[n.Decimal=7]="Decimal",n[n.Date=8]="Date",n[n.Time=9]="Time",n[n.Timestamp=10]="Timestamp",n[n.Interval=11]="Interval",n[n.List=12]="List",n[n.Struct_=13]="Struct_",n[n.Union=14]="Union",n[n.FixedSizeBinary=15]="FixedSizeBinary",n[n.FixedSizeList=16]="FixedSizeList",n[n.Map=17]="Map",n[n.Duration=18]="Duration",n[n.LargeBinary=19]="LargeBinary",n[n.LargeUtf8=20]="LargeUtf8",n[n.LargeList=21]="LargeList",n[n.RunEndEncoded=22]="RunEndEncoded"})(bt||(bt={}));let Kt=class Br{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsField(t,e){return(e||new Br).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+ft),(e||new Br).__init(t.readInt32(t.position())+t.position(),t)}name(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}nullable(){const t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):bt.NONE}type(t){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}dictionary(t){const e=this.bb.__offset(this.bb_pos,12);return e?(t||new ke).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}children(t,e){const r=this.bb.__offset(this.bb_pos,14);return r?(e||new Br).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}childrenLength(){const t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const r=this.bb.__offset(this.bb_pos,16);return r?(e||new kt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){const 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,e){t.addFieldOffset(0,e,0)}static addNullable(t,e){t.addFieldInt8(1,+e,0)}static addTypeType(t,e){t.addFieldInt8(2,e,bt.NONE)}static addType(t,e){t.addFieldOffset(3,e,0)}static addDictionary(t,e){t.addFieldOffset(4,e,0)}static addChildren(t,e){t.addFieldOffset(5,e,0)}static createChildrenVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startChildrenVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(6,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endField(t){return t.endObject()}},fe=class Be{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSchema(t,e){return(e||new Be).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+ft),(e||new Be).__init(t.readInt32(t.position())+t.position(),t)}endianness(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):On.Little}fields(t,e){const r=this.bb.__offset(this.bb_pos,6);return r?(e||new Kt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}fieldsLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const r=this.bb.__offset(this.bb_pos,8);return r?(e||new kt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+t*8):BigInt(0)}featuresLength(){const 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,e){t.addFieldInt16(0,e,On.Little)}static addFields(t,e){t.addFieldOffset(1,e,0)}static createFieldsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startFieldsVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(2,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static addFeatures(t,e){t.addFieldOffset(3,e,0)}static createFeaturesVector(t,e){t.startVector(8,e.length,8);for(let r=e.length-1;r>=0;r--)t.addInt64(e[r]);return t.endVector()}static startFeaturesVector(t,e){t.startVector(8,e,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,e){t.finish(e)}static finishSizePrefixedSchemaBuffer(t,e){t.finish(e,void 0,!0)}static createSchema(t,e,r,i,s){return Be.startSchema(t),Be.addEndianness(t,e),Be.addFields(t,r),Be.addCustomMetadata(t,i),Be.addFeatures(t,s),Be.endSchema(t)}};var ht;(function(n){n[n.NONE=0]="NONE",n[n.Schema=1]="Schema",n[n.DictionaryBatch=2]="DictionaryBatch",n[n.RecordBatch=3]="RecordBatch",n[n.Tensor=4]="Tensor",n[n.SparseTensor=5]="SparseTensor"})(ht||(ht={}));var b;(function(n){n[n.NONE=0]="NONE",n[n.Null=1]="Null",n[n.Int=2]="Int",n[n.Float=3]="Float",n[n.Binary=4]="Binary",n[n.Utf8=5]="Utf8",n[n.Bool=6]="Bool",n[n.Decimal=7]="Decimal",n[n.Date=8]="Date",n[n.Time=9]="Time",n[n.Timestamp=10]="Timestamp",n[n.Interval=11]="Interval",n[n.List=12]="List",n[n.Struct=13]="Struct",n[n.Union=14]="Union",n[n.FixedSizeBinary=15]="FixedSizeBinary",n[n.FixedSizeList=16]="FixedSizeList",n[n.Map=17]="Map",n[n.Duration=18]="Duration",n[n.LargeBinary=19]="LargeBinary",n[n.LargeUtf8=20]="LargeUtf8",n[n.Dictionary=-1]="Dictionary",n[n.Int8=-2]="Int8",n[n.Int16=-3]="Int16",n[n.Int32=-4]="Int32",n[n.Int64=-5]="Int64",n[n.Uint8=-6]="Uint8",n[n.Uint16=-7]="Uint16",n[n.Uint32=-8]="Uint32",n[n.Uint64=-9]="Uint64",n[n.Float16=-10]="Float16",n[n.Float32=-11]="Float32",n[n.Float64=-12]="Float64",n[n.DateDay=-13]="DateDay",n[n.DateMillisecond=-14]="DateMillisecond",n[n.TimestampSecond=-15]="TimestampSecond",n[n.TimestampMillisecond=-16]="TimestampMillisecond",n[n.TimestampMicrosecond=-17]="TimestampMicrosecond",n[n.TimestampNanosecond=-18]="TimestampNanosecond",n[n.TimeSecond=-19]="TimeSecond",n[n.TimeMillisecond=-20]="TimeMillisecond",n[n.TimeMicrosecond=-21]="TimeMicrosecond",n[n.TimeNanosecond=-22]="TimeNanosecond",n[n.DenseUnion=-23]="DenseUnion",n[n.SparseUnion=-24]="SparseUnion",n[n.IntervalDayTime=-25]="IntervalDayTime",n[n.IntervalYearMonth=-26]="IntervalYearMonth",n[n.DurationSecond=-27]="DurationSecond",n[n.DurationMillisecond=-28]="DurationMillisecond",n[n.DurationMicrosecond=-29]="DurationMicrosecond",n[n.DurationNanosecond=-30]="DurationNanosecond"})(b||(b={}));var Ae;(function(n){n[n.OFFSET=0]="OFFSET",n[n.DATA=1]="DATA",n[n.VALIDITY=2]="VALIDITY",n[n.TYPE=3]="TYPE"})(Ae||(Ae={}));const Il=void 0;function Kn(n){if(n===null)return"null";if(n===Il)return"undefined";switch(typeof n){case"number":return`${n}`;case"bigint":return`${n}`;case"string":return`"${n}"`}return typeof n[Symbol.toPrimitive]=="function"?n[Symbol.toPrimitive]("string"):ArrayBuffer.isView(n)?n instanceof BigInt64Array||n instanceof BigUint64Array?`[${[...n].map(t=>Kn(t))}]`:`[${n}]`:ArrayBuffer.isView(n)?`[${n}]`:JSON.stringify(n,(t,e)=>typeof e=="bigint"?`${e}`:e)}function wt(n){if(typeof n=="bigint"&&(n<Number.MIN_SAFE_INTEGER||n>Number.MAX_SAFE_INTEGER))throw new TypeError(`${n} is not safe to convert to a number.`);return Number(n)}function ra(n,t){return wt(n/t)+wt(n%t)/wt(t)}const Bl=Symbol.for("isArrowBigNum");function ue(n,...t){return t.length===0?Object.setPrototypeOf(gt(this.TypedArray,n),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(n,...t),this.constructor.prototype)}ue.prototype[Bl]=!0;ue.prototype.toJSON=function(){return`"${Xn(this)}"`};ue.prototype.valueOf=function(n){return ia(this,n)};ue.prototype.toString=function(){return Xn(this)};ue.prototype[Symbol.toPrimitive]=function(n="default"){switch(n){case"number":return ia(this);case"string":return Xn(this);case"default":return Dl(this)}return Xn(this)};function vn(...n){return ue.apply(this,n)}function Sn(...n){return ue.apply(this,n)}function qn(...n){return ue.apply(this,n)}Object.setPrototypeOf(vn.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Sn.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(qn.prototype,Object.create(Uint32Array.prototype));Object.assign(vn.prototype,ue.prototype,{constructor:vn,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(Sn.prototype,ue.prototype,{constructor:Sn,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(qn.prototype,ue.prototype,{constructor:qn,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const Ml=BigInt(4294967296)*BigInt(4294967296),Al=Ml-BigInt(1);function ia(n,t){const{buffer:e,byteOffset:r,byteLength:i,signed:s}=n,o=new BigUint64Array(e,r,i/8),a=s&&o.at(-1)&BigInt(1)<<BigInt(63);let c=BigInt(0),u=0;if(a){for(const f of o)c|=(f^Al)*(BigInt(1)<<BigInt(64*u++));c*=BigInt(-1),c-=BigInt(1)}else for(const f of o)c|=f*(BigInt(1)<<BigInt(64*u++));if(typeof t=="number"){const f=BigInt(Math.pow(10,t)),S=c/f,k=c%f;return wt(S)+wt(k)/wt(f)}return wt(c)}function Xn(n){if(n.byteLength===8)return`${new n.BigIntArray(n.buffer,n.byteOffset,1)[0]}`;if(!n.signed)return wi(n);let t=new Uint16Array(n.buffer,n.byteOffset,n.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return wi(n);t=t.slice();let r=1;for(let s=0;s<t.length;s++){const o=t[s],a=~o+r;t[s]=a,r&=o===0?1:0}return`-${wi(t)}`}function Dl(n){return n.byteLength===8?new n.BigIntArray(n.buffer,n.byteOffset,1)[0]:Xn(n)}function wi(n){let t="";const e=new Uint32Array(2);let r=new Uint16Array(n.buffer,n.byteOffset,n.byteLength/2);const i=new Uint32Array((r=new Uint16Array(r).reverse()).buffer);let s=-1;const o=r.length-1;do{for(e[0]=r[s=0];s<o;)r[s++]=e[1]=e[0]/10,e[0]=(e[0]-e[1]*10<<16)+r[s];r[s]=e[1]=e[0]/10,e[0]=e[0]-e[1]*10,t=`${e[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}class cs{static new(t,e){switch(e){case!0:return new vn(t);case!1:return new Sn(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new vn(t)}return t.byteLength===16?new qn(t):new Sn(t)}static signed(t){return new vn(t)}static unsigned(t){return new Sn(t)}static decimal(t){return new qn(t)}constructor(t,e){return cs.new(t,e)}}var sa,oa,aa,ca,ua,la,ha,da,fa,pa,ya,ga,ma,ba,wa,_a,va,Sa,Ia,Ba,Ma,Aa;class G{static isNull(t){return(t==null?void 0:t.typeId)===b.Null}static isInt(t){return(t==null?void 0:t.typeId)===b.Int}static isFloat(t){return(t==null?void 0:t.typeId)===b.Float}static isBinary(t){return(t==null?void 0:t.typeId)===b.Binary}static isLargeBinary(t){return(t==null?void 0:t.typeId)===b.LargeBinary}static isUtf8(t){return(t==null?void 0:t.typeId)===b.Utf8}static isLargeUtf8(t){return(t==null?void 0:t.typeId)===b.LargeUtf8}static isBool(t){return(t==null?void 0:t.typeId)===b.Bool}static isDecimal(t){return(t==null?void 0:t.typeId)===b.Decimal}static isDate(t){return(t==null?void 0:t.typeId)===b.Date}static isTime(t){return(t==null?void 0:t.typeId)===b.Time}static isTimestamp(t){return(t==null?void 0:t.typeId)===b.Timestamp}static isInterval(t){return(t==null?void 0:t.typeId)===b.Interval}static isDuration(t){return(t==null?void 0:t.typeId)===b.Duration}static isList(t){return(t==null?void 0:t.typeId)===b.List}static isStruct(t){return(t==null?void 0:t.typeId)===b.Struct}static isUnion(t){return(t==null?void 0:t.typeId)===b.Union}static isFixedSizeBinary(t){return(t==null?void 0:t.typeId)===b.FixedSizeBinary}static isFixedSizeList(t){return(t==null?void 0:t.typeId)===b.FixedSizeList}static isMap(t){return(t==null?void 0:t.typeId)===b.Map}static isDictionary(t){return(t==null?void 0:t.typeId)===b.Dictionary}static isDenseUnion(t){return G.isUnion(t)&&t.mode===Wt.Dense}static isSparseUnion(t){return G.isUnion(t)&&t.mode===Wt.Sparse}constructor(t){this.typeId=t}}sa=Symbol.toStringTag;G[sa]=(n=>(n.children=null,n.ArrayType=Array,n.OffsetArrayType=Int32Array,n[Symbol.toStringTag]="DataType"))(G.prototype);class ze extends G{constructor(){super(b.Null)}toString(){return"Null"}}oa=Symbol.toStringTag;ze[oa]=(n=>n[Symbol.toStringTag]="Null")(ze.prototype);class tn extends G{constructor(t,e){super(b.Int),this.isSigned=t,this.bitWidth=e}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}`}}aa=Symbol.toStringTag;tn[aa]=(n=>(n.isSigned=null,n.bitWidth=null,n[Symbol.toStringTag]="Int"))(tn.prototype);class Qn extends tn{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}Object.defineProperty(Qn.prototype,"ArrayType",{value:Int32Array});class Nr extends G{constructor(t){super(b.Float),this.precision=t}get ArrayType(){switch(this.precision){case xt.HALF:return Uint16Array;case xt.SINGLE:return Float32Array;case xt.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}ca=Symbol.toStringTag;Nr[ca]=(n=>(n.precision=null,n[Symbol.toStringTag]="Float"))(Nr.prototype);class Er extends G{constructor(){super(b.Binary)}toString(){return"Binary"}}ua=Symbol.toStringTag;Er[ua]=(n=>(n.ArrayType=Uint8Array,n[Symbol.toStringTag]="Binary"))(Er.prototype);class Lr extends G{constructor(){super(b.LargeBinary)}toString(){return"LargeBinary"}}la=Symbol.toStringTag;Lr[la]=(n=>(n.ArrayType=Uint8Array,n.OffsetArrayType=BigInt64Array,n[Symbol.toStringTag]="LargeBinary"))(Lr.prototype);class xr extends G{constructor(){super(b.Utf8)}toString(){return"Utf8"}}ha=Symbol.toStringTag;xr[ha]=(n=>(n.ArrayType=Uint8Array,n[Symbol.toStringTag]="Utf8"))(xr.prototype);class Ur extends G{constructor(){super(b.LargeUtf8)}toString(){return"LargeUtf8"}}da=Symbol.toStringTag;Ur[da]=(n=>(n.ArrayType=Uint8Array,n.OffsetArrayType=BigInt64Array,n[Symbol.toStringTag]="LargeUtf8"))(Ur.prototype);class Rr extends G{constructor(){super(b.Bool)}toString(){return"Bool"}}fa=Symbol.toStringTag;Rr[fa]=(n=>(n.ArrayType=Uint8Array,n[Symbol.toStringTag]="Bool"))(Rr.prototype);class Cr extends G{constructor(t,e,r=128){super(b.Decimal),this.scale=t,this.precision=e,this.bitWidth=r}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}pa=Symbol.toStringTag;Cr[pa]=(n=>(n.scale=null,n.precision=null,n.ArrayType=Uint32Array,n[Symbol.toStringTag]="Decimal"))(Cr.prototype);class Pr extends G{constructor(t){super(b.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${ee[this.unit]}>`}get ArrayType(){return this.unit===ee.DAY?Int32Array:BigInt64Array}}ya=Symbol.toStringTag;Pr[ya]=(n=>(n.unit=null,n[Symbol.toStringTag]="Date"))(Pr.prototype);class $r extends G{constructor(t,e){super(b.Time),this.unit=t,this.bitWidth=e}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`)}}ga=Symbol.toStringTag;$r[ga]=(n=>(n.unit=null,n.bitWidth=null,n[Symbol.toStringTag]="Time"))($r.prototype);class zr extends G{constructor(t,e){super(b.Timestamp),this.unit=t,this.timezone=e}toString(){return`Timestamp<${q[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}ma=Symbol.toStringTag;zr[ma]=(n=>(n.unit=null,n.timezone=null,n.ArrayType=BigInt64Array,n[Symbol.toStringTag]="Timestamp"))(zr.prototype);class Vr extends G{constructor(t){super(b.Interval),this.unit=t}toString(){return`Interval<${_e[this.unit]}>`}}ba=Symbol.toStringTag;Vr[ba]=(n=>(n.unit=null,n.ArrayType=Int32Array,n[Symbol.toStringTag]="Interval"))(Vr.prototype);class jr extends G{constructor(t){super(b.Duration),this.unit=t}toString(){return`Duration<${q[this.unit]}>`}}wa=Symbol.toStringTag;jr[wa]=(n=>(n.unit=null,n.ArrayType=BigInt64Array,n[Symbol.toStringTag]="Duration"))(jr.prototype);class Wr extends G{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}}_a=Symbol.toStringTag;Wr[_a]=(n=>(n.children=null,n[Symbol.toStringTag]="List"))(Wr.prototype);class Ct extends G{constructor(t){super(b.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}va=Symbol.toStringTag;Ct[va]=(n=>(n.children=null,n[Symbol.toStringTag]="Struct"))(Ct.prototype);class Zr extends G{constructor(t,e,r){super(b.Union),this.mode=t,this.children=r,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((i,s,o)=>(i[s]=o)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}}Sa=Symbol.toStringTag;Zr[Sa]=(n=>(n.mode=null,n.typeIds=null,n.children=null,n.typeIdToChildIndex=null,n.ArrayType=Int8Array,n[Symbol.toStringTag]="Union"))(Zr.prototype);class Gr extends G{constructor(t){super(b.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}Ia=Symbol.toStringTag;Gr[Ia]=(n=>(n.byteWidth=null,n.ArrayType=Uint8Array,n[Symbol.toStringTag]="FixedSizeBinary"))(Gr.prototype);class Yr extends G{constructor(t,e){super(b.FixedSizeList),this.listSize=t,this.children=[e]}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}>`}}Ba=Symbol.toStringTag;Yr[Ba]=(n=>(n.children=null,n.listSize=null,n[Symbol.toStringTag]="FixedSizeList"))(Yr.prototype);class Jr extends G{constructor(t,e=!1){var r,i,s;if(super(b.Map),this.children=[t],this.keysSorted=e,t&&(t.name="entries",!((r=t==null?void 0:t.type)===null||r===void 0)&&r.children)){const o=(i=t==null?void 0:t.type)===null||i===void 0?void 0:i.children[0];o&&(o.name="key");const a=(s=t==null?void 0:t.type)===null||s===void 0?void 0:s.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(", ")}}>`}}Ma=Symbol.toStringTag;Jr[Ma]=(n=>(n.children=null,n.keysSorted=null,n[Symbol.toStringTag]="Map_"))(Jr.prototype);const Ol=(n=>()=>++n)(-1);class kn extends G{constructor(t,e,r,i){super(b.Dictionary),this.indices=e,this.dictionary=t,this.isOrdered=i||!1,this.id=r==null?Ol():wt(r)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}Aa=Symbol.toStringTag;kn[Aa]=(n=>(n.id=null,n.indices=null,n.isOrdered=null,n.dictionary=null,n[Symbol.toStringTag]="Dictionary"))(kn.prototype);function De(n){const t=n;switch(n.typeId){case b.Decimal:return n.bitWidth/32;case b.Interval:return 1+t.unit;case b.FixedSizeList:return t.listSize;case b.FixedSizeBinary:return t.byteWidth;default:return 1}}class ot{visitMany(t,...e){return t.map((r,i)=>this.visit(r,...e.map(s=>s[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return kl(this,t,e)}getVisitFnByTypeId(t,e=!0){return yn(this,t,e)}visitNull(t,...e){return null}visitBool(t,...e){return null}visitInt(t,...e){return null}visitFloat(t,...e){return null}visitUtf8(t,...e){return null}visitLargeUtf8(t,...e){return null}visitBinary(t,...e){return null}visitLargeBinary(t,...e){return null}visitFixedSizeBinary(t,...e){return null}visitDate(t,...e){return null}visitTimestamp(t,...e){return null}visitTime(t,...e){return null}visitDecimal(t,...e){return null}visitList(t,...e){return null}visitStruct(t,...e){return null}visitUnion(t,...e){return null}visitDictionary(t,...e){return null}visitInterval(t,...e){return null}visitDuration(t,...e){return null}visitFixedSizeList(t,...e){return null}visitMap(t,...e){return null}}function kl(n,t,e=!0){return typeof t=="number"?yn(n,t,e):typeof t=="string"&&t in b?yn(n,b[t],e):t&&t instanceof G?yn(n,ao(t),e):t!=null&&t.type&&t.type instanceof G?yn(n,ao(t.type),e):yn(n,b.NONE,e)}function yn(n,t,e=!0){let r=null;switch(t){case b.Null:r=n.visitNull;break;case b.Bool:r=n.visitBool;break;case b.Int:r=n.visitInt;break;case b.Int8:r=n.visitInt8||n.visitInt;break;case b.Int16:r=n.visitInt16||n.visitInt;break;case b.Int32:r=n.visitInt32||n.visitInt;break;case b.Int64:r=n.visitInt64||n.visitInt;break;case b.Uint8:r=n.visitUint8||n.visitInt;break;case b.Uint16:r=n.visitUint16||n.visitInt;break;case b.Uint32:r=n.visitUint32||n.visitInt;break;case b.Uint64:r=n.visitUint64||n.visitInt;break;case b.Float:r=n.visitFloat;break;case b.Float16:r=n.visitFloat16||n.visitFloat;break;case b.Float32:r=n.visitFloat32||n.visitFloat;break;case b.Float64:r=n.visitFloat64||n.visitFloat;break;case b.Utf8:r=n.visitUtf8;break;case b.LargeUtf8:r=n.visitLargeUtf8;break;case b.Binary:r=n.visitBinary;break;case b.LargeBinary:r=n.visitLargeBinary;break;case b.FixedSizeBinary:r=n.visitFixedSizeBinary;break;case b.Date:r=n.visitDate;break;case b.DateDay:r=n.visitDateDay||n.visitDate;break;case b.DateMillisecond:r=n.visitDateMillisecond||n.visitDate;break;case b.Timestamp:r=n.visitTimestamp;break;case b.TimestampSecond:r=n.visitTimestampSecond||n.visitTimestamp;break;case b.TimestampMillisecond:r=n.visitTimestampMillisecond||n.visitTimestamp;break;case b.TimestampMicrosecond:r=n.visitTimestampMicrosecond||n.visitTimestamp;break;case b.TimestampNanosecond:r=n.visitTimestampNanosecond||n.visitTimestamp;break;case b.Time:r=n.visitTime;break;case b.TimeSecond:r=n.visitTimeSecond||n.visitTime;break;case b.TimeMillisecond:r=n.visitTimeMillisecond||n.visitTime;break;case b.TimeMicrosecond:r=n.visitTimeMicrosecond||n.visitTime;break;case b.TimeNanosecond:r=n.visitTimeNanosecond||n.visitTime;break;case b.Decimal:r=n.visitDecimal;break;case b.List:r=n.visitList;break;case b.Struct:r=n.visitStruct;break;case b.Union:r=n.visitUnion;break;case b.DenseUnion:r=n.visitDenseUnion||n.visitUnion;break;case b.SparseUnion:r=n.visitSparseUnion||n.visitUnion;break;case b.Dictionary:r=n.visitDictionary;break;case b.Interval:r=n.visitInterval;break;case b.IntervalDayTime:r=n.visitIntervalDayTime||n.visitInterval;break;case b.IntervalYearMonth:r=n.visitIntervalYearMonth||n.visitInterval;break;case b.Duration:r=n.visitDuration;break;case b.DurationSecond:r=n.visitDurationSecond||n.visitDuration;break;case b.DurationMillisecond:r=n.visitDurationMillisecond||n.visitDuration;break;case b.DurationMicrosecond:r=n.visitDurationMicrosecond||n.visitDuration;break;case b.DurationNanosecond:r=n.visitDurationNanosecond||n.visitDuration;break;case b.FixedSizeList:r=n.visitFixedSizeList;break;case b.Map:r=n.visitMap;break}if(typeof r=="function")return r;if(!e)return()=>null;throw new Error(`Unrecognized type '${b[t]}'`)}function ao(n){switch(n.typeId){case b.Null:return b.Null;case b.Int:{const{bitWidth:t,isSigned:e}=n;switch(t){case 8:return e?b.Int8:b.Uint8;case 16:return e?b.Int16:b.Uint16;case 32:return e?b.Int32:b.Uint32;case 64:return e?b.Int64:b.Uint64}return b.Int}case b.Float:switch(n.precision){case xt.HALF:return b.Float16;case xt.SINGLE:return b.Float32;case xt.DOUBLE:return b.Float64}return b.Float;case b.Binary:return b.Binary;case b.LargeBinary:return b.LargeBinary;case b.Utf8:return b.Utf8;case b.LargeUtf8:return b.LargeUtf8;case b.Bool:return b.Bool;case b.Decimal:return b.Decimal;case b.Time:switch(n.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(n.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(n.unit){case ee.DAY:return b.DateDay;case ee.MILLISECOND:return b.DateMillisecond}return b.Date;case b.Interval:switch(n.unit){case _e.DAY_TIME:return b.IntervalDayTime;case _e.YEAR_MONTH:return b.IntervalYearMonth}return b.Interval;case b.Duration:switch(n.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.Struct:return b.Struct;case b.Union:switch(n.mode){case Wt.Dense:return b.DenseUnion;case Wt.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[n.typeId]}'`)}ot.prototype.visitInt8=null;ot.prototype.visitInt16=null;ot.prototype.visitInt32=null;ot.prototype.visitInt64=null;ot.prototype.visitUint8=null;ot.prototype.visitUint16=null;ot.prototype.visitUint32=null;ot.prototype.visitUint64=null;ot.prototype.visitFloat16=null;ot.prototype.visitFloat32=null;ot.prototype.visitFloat64=null;ot.prototype.visitDateDay=null;ot.prototype.visitDateMillisecond=null;ot.prototype.visitTimestampSecond=null;ot.prototype.visitTimestampMillisecond=null;ot.prototype.visitTimestampMicrosecond=null;ot.prototype.visitTimestampNanosecond=null;ot.prototype.visitTimeSecond=null;ot.prototype.visitTimeMillisecond=null;ot.prototype.visitTimeMicrosecond=null;ot.prototype.visitTimeNanosecond=null;ot.prototype.visitDenseUnion=null;ot.prototype.visitSparseUnion=null;ot.prototype.visitIntervalDayTime=null;ot.prototype.visitIntervalYearMonth=null;ot.prototype.visitDuration=null;ot.prototype.visitDurationSecond=null;ot.prototype.visitDurationMillisecond=null;ot.prototype.visitDurationMicrosecond=null;ot.prototype.visitDurationNanosecond=null;const Da=new Float64Array(1),an=new Uint32Array(Da.buffer);function Oa(n){const t=(n&31744)>>10,e=(n&1023)/1024,r=Math.pow(-1,(n&32768)>>15);switch(t){case 31:return r*(e?Number.NaN:1/0);case 0:return r*(e?6103515625e-14*e:0)}return r*Math.pow(2,t-15)*(1+e)}function Fl(n){if(n!==n)return 32256;Da[0]=n;const t=(an[1]&2147483648)>>16&65535;let e=an[1]&2146435072,r=0;return e>=1089470464?an[0]>0?e=31744:(e=(e&2080374784)>>16,r=(an[1]&1048575)>>10):e<=1056964608?(r=1048576+(an[1]&1048575),r=1048576+(r<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,r=(an[1]&1048575)+512>>10),t|e|r&65535}class X extends ot{}function et(n){return(t,e,r)=>{if(t.setValid(e,r!=null))return n(t,e,r)}}const Tl=(n,t,e)=>{n[t]=Math.floor(e/864e5)},ka=(n,t,e,r)=>{if(e+1<t.length){const i=wt(t[e]),s=wt(t[e+1]);n.set(r.subarray(0,s-i),i)}},Nl=({offset:n,values:t},e,r)=>{const i=n+e;r?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},Ee=({values:n},t,e)=>{n[t]=e},us=({values:n},t,e)=>{n[t]=e},Fa=({values:n},t,e)=>{n[t]=Fl(e)},El=(n,t,e)=>{switch(n.type.precision){case xt.HALF:return Fa(n,t,e);case xt.SINGLE:case xt.DOUBLE:return us(n,t,e)}},Ta=({values:n},t,e)=>{Tl(n,t,e.valueOf())},Na=({values:n},t,e)=>{n[t]=BigInt(e)},Ll=({stride:n,values:t},e,r)=>{t.set(r.subarray(0,n),n*e)},Ea=({values:n,valueOffsets:t},e,r)=>ka(n,t,e,r),La=({values:n,valueOffsets:t},e,r)=>ka(n,t,e,is(r)),xl=(n,t,e)=>{n.type.unit===ee.DAY?Ta(n,t,e):Na(n,t,e)},xa=({values:n},t,e)=>{n[t]=BigInt(e/1e3)},Ua=({values:n},t,e)=>{n[t]=BigInt(e)},Ra=({values:n},t,e)=>{n[t]=BigInt(e*1e3)},Ca=({values:n},t,e)=>{n[t]=BigInt(e*1e6)},Ul=(n,t,e)=>{switch(n.type.unit){case q.SECOND:return xa(n,t,e);case q.MILLISECOND:return Ua(n,t,e);case q.MICROSECOND:return Ra(n,t,e);case q.NANOSECOND:return Ca(n,t,e)}},Pa=({values:n},t,e)=>{n[t]=e},$a=({values:n},t,e)=>{n[t]=e},za=({values:n},t,e)=>{n[t]=e},Va=({values:n},t,e)=>{n[t]=e},Rl=(n,t,e)=>{switch(n.type.unit){case q.SECOND:return Pa(n,t,e);case q.MILLISECOND:return $a(n,t,e);case q.MICROSECOND:return za(n,t,e);case q.NANOSECOND:return Va(n,t,e)}},Cl=({values:n,stride:t},e,r)=>{n.set(r.subarray(0,t),t*e)},Pl=(n,t,e)=>{const r=n.children[0],i=n.valueOffsets,s=ne.getVisitFn(r);if(Array.isArray(e))for(let o=-1,a=i[t],c=i[t+1];a<c;)s(r,a++,e[++o]);else for(let o=-1,a=i[t],c=i[t+1];a<c;)s(r,a++,e.get(++o))},$l=(n,t,e)=>{const r=n.children[0],{valueOffsets:i}=n,s=ne.getVisitFn(r);let{[t]:o,[t+1]:a}=i;const c=e instanceof Map?e.entries():Object.entries(e);for(const u of c)if(s(r,o,u),++o>=a)break},zl=(n,t)=>(e,r,i,s)=>r&&e(r,n,t[s]),Vl=(n,t)=>(e,r,i,s)=>r&&e(r,n,t.get(s)),jl=(n,t)=>(e,r,i,s)=>r&&e(r,n,t.get(i.name)),Wl=(n,t)=>(e,r,i,s)=>r&&e(r,n,t[i.name]),Zl=(n,t,e)=>{const r=n.type.children.map(s=>ne.getVisitFn(s.type)),i=e instanceof Map?jl(t,e):e instanceof mt?Vl(t,e):Array.isArray(e)?zl(t,e):Wl(t,e);n.type.children.forEach((s,o)=>i(r[o],n.children[o],s,o))},Gl=(n,t,e)=>{n.type.mode===Wt.Dense?ja(n,t,e):Wa(n,t,e)},ja=(n,t,e)=>{const r=n.type.typeIdToChildIndex[n.typeIds[t]],i=n.children[r];ne.visit(i,n.valueOffsets[t],e)},Wa=(n,t,e)=>{const r=n.type.typeIdToChildIndex[n.typeIds[t]],i=n.children[r];ne.visit(i,t,e)},Yl=(n,t,e)=>{var r;(r=n.dictionary)===null||r===void 0||r.set(n.values[t],e)},Jl=(n,t,e)=>{n.type.unit===_e.DAY_TIME?Za(n,t,e):Ga(n,t,e)},Za=({values:n},t,e)=>{n.set(e.subarray(0,2),2*t)},Ga=({values:n},t,e)=>{n[t]=e[0]*12+e[1]%12},Ya=({values:n},t,e)=>{n[t]=e},Ja=({values:n},t,e)=>{n[t]=e},Ha=({values:n},t,e)=>{n[t]=e},Ka=({values:n},t,e)=>{n[t]=e},Hl=(n,t,e)=>{switch(n.type.unit){case q.SECOND:return Ya(n,t,e);case q.MILLISECOND:return Ja(n,t,e);case q.MICROSECOND:return Ha(n,t,e);case q.NANOSECOND:return Ka(n,t,e)}},Kl=(n,t,e)=>{const{stride:r}=n,i=n.children[0],s=ne.getVisitFn(i);if(Array.isArray(e))for(let o=-1,a=t*r;++o<r;)s(i,a+o,e[o]);else for(let o=-1,a=t*r;++o<r;)s(i,a+o,e.get(o))};X.prototype.visitBool=et(Nl);X.prototype.visitInt=et(Ee);X.prototype.visitInt8=et(Ee);X.prototype.visitInt16=et(Ee);X.prototype.visitInt32=et(Ee);X.prototype.visitInt64=et(Ee);X.prototype.visitUint8=et(Ee);X.prototype.visitUint16=et(Ee);X.prototype.visitUint32=et(Ee);X.prototype.visitUint64=et(Ee);X.prototype.visitFloat=et(El);X.prototype.visitFloat16=et(Fa);X.prototype.visitFloat32=et(us);X.prototype.visitFloat64=et(us);X.prototype.visitUtf8=et(La);X.prototype.visitLargeUtf8=et(La);X.prototype.visitBinary=et(Ea);X.prototype.visitLargeBinary=et(Ea);X.prototype.visitFixedSizeBinary=et(Ll);X.prototype.visitDate=et(xl);X.prototype.visitDateDay=et(Ta);X.prototype.visitDateMillisecond=et(Na);X.prototype.visitTimestamp=et(Ul);X.prototype.visitTimestampSecond=et(xa);X.prototype.visitTimestampMillisecond=et(Ua);X.prototype.visitTimestampMicrosecond=et(Ra);X.prototype.visitTimestampNanosecond=et(Ca);X.prototype.visitTime=et(Rl);X.prototype.visitTimeSecond=et(Pa);X.prototype.visitTimeMillisecond=et($a);X.prototype.visitTimeMicrosecond=et(za);X.prototype.visitTimeNanosecond=et(Va);X.prototype.visitDecimal=et(Cl);X.prototype.visitList=et(Pl);X.prototype.visitStruct=et(Zl);X.prototype.visitUnion=et(Gl);X.prototype.visitDenseUnion=et(ja);X.prototype.visitSparseUnion=et(Wa);X.prototype.visitDictionary=et(Yl);X.prototype.visitInterval=et(Jl);X.prototype.visitIntervalDayTime=et(Za);X.prototype.visitIntervalYearMonth=et(Ga);X.prototype.visitDuration=et(Hl);X.prototype.visitDurationSecond=et(Ya);X.prototype.visitDurationMillisecond=et(Ja);X.prototype.visitDurationMicrosecond=et(Ha);X.prototype.visitDurationNanosecond=et(Ka);X.prototype.visitFixedSizeList=et(Kl);X.prototype.visitMap=et($l);const ne=new X,ie=Symbol.for("parent"),In=Symbol.for("rowIndex");class ls{constructor(t,e){return this[ie]=t,this[In]=e,new Proxy(this,Ql)}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[In],e=this[ie],r=e.type.children,i={};for(let s=-1,o=r.length;++s<o;)i[r[s].name]=Zt.visit(e.children[s],t);return i}toString(){return`{${[...this].map(([t,e])=>`${Kn(t)}: ${Kn(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new ql(this[ie],this[In])}}class ql{constructor(t,e){this.childIndex=0,this.children=t.children,this.rowIndex=e,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){const t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,Zt.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}}Object.defineProperties(ls.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[ie]:{writable:!0,enumerable:!1,configurable:!1,value:null},[In]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});class Xl{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[ie].type.children.map(e=>e.name)}has(t,e){return t[ie].type.children.some(r=>r.name===e)}getOwnPropertyDescriptor(t,e){if(t[ie].type.children.some(r=>r.name===e))return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const r=t[ie].type.children.findIndex(i=>i.name===e);if(r!==-1){const i=Zt.visit(t[ie].children[r],t[In]);return Reflect.set(t,e,i),i}}set(t,e,r){const i=t[ie].type.children.findIndex(s=>s.name===e);return i!==-1?(ne.visit(t[ie].children[i],t[In],r),Reflect.set(t,e,r)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,r):!1}}const Ql=new Xl;class Y extends ot{}function Q(n){return(t,e)=>t.getValid(e)?n(t,e):null}const th=(n,t)=>864e5*n[t],eh=(n,t)=>null,qa=(n,t,e)=>{if(e+1>=t.length)return null;const r=wt(t[e]),i=wt(t[e+1]);return n.subarray(r,i)},nh=({offset:n,values:t},e)=>{const r=n+e;return(t[r>>3]&1<<r%8)!==0},Xa=({values:n},t)=>th(n,t),Qa=({values:n},t)=>wt(n[t]),We=({stride:n,values:t},e)=>t[n*e],rh=({stride:n,values:t},e)=>Oa(t[n*e]),tc=({values:n},t)=>n[t],ih=({stride:n,values:t},e)=>t.subarray(n*e,n*(e+1)),ec=({values:n,valueOffsets:t},e)=>qa(n,t,e),nc=({values:n,valueOffsets:t},e)=>{const r=qa(n,t,e);return r!==null?Pi(r):null},sh=({values:n},t)=>n[t],oh=({type:n,values:t},e)=>n.precision!==xt.HALF?t[e]:Oa(t[e]),ah=(n,t)=>n.type.unit===ee.DAY?Xa(n,t):Qa(n,t),rc=({values:n},t)=>1e3*wt(n[t]),ic=({values:n},t)=>wt(n[t]),sc=({values:n},t)=>ra(n[t],BigInt(1e3)),oc=({values:n},t)=>ra(n[t],BigInt(1e6)),ch=(n,t)=>{switch(n.type.unit){case q.SECOND:return rc(n,t);case q.MILLISECOND:return ic(n,t);case q.MICROSECOND:return sc(n,t);case q.NANOSECOND:return oc(n,t)}},ac=({values:n},t)=>n[t],cc=({values:n},t)=>n[t],uc=({values:n},t)=>n[t],lc=({values:n},t)=>n[t],uh=(n,t)=>{switch(n.type.unit){case q.SECOND:return ac(n,t);case q.MILLISECOND:return cc(n,t);case q.MICROSECOND:return uc(n,t);case q.NANOSECOND:return lc(n,t)}},lh=({values:n,stride:t},e)=>cs.decimal(n.subarray(t*e,t*(e+1))),hh=(n,t)=>{const{valueOffsets:e,stride:r,children:i}=n,{[t*r]:s,[t*r+1]:o}=e,c=i[0].slice(s,o-s);return new mt([c])},dh=(n,t)=>{const{valueOffsets:e,children:r}=n,{[t]:i,[t+1]:s}=e,o=r[0];return new hs(o.slice(i,s-i))},fh=(n,t)=>new ls(n,t),ph=(n,t)=>n.type.mode===Wt.Dense?hc(n,t):dc(n,t),hc=(n,t)=>{const e=n.type.typeIdToChildIndex[n.typeIds[t]],r=n.children[e];return Zt.visit(r,n.valueOffsets[t])},dc=(n,t)=>{const e=n.type.typeIdToChildIndex[n.typeIds[t]],r=n.children[e];return Zt.visit(r,t)},yh=(n,t)=>{var e;return(e=n.dictionary)===null||e===void 0?void 0:e.get(n.values[t])},gh=(n,t)=>n.type.unit===_e.DAY_TIME?fc(n,t):pc(n,t),fc=({values:n},t)=>n.subarray(2*t,2*(t+1)),pc=({values:n},t)=>{const e=n[t],r=new Int32Array(2);return r[0]=Math.trunc(e/12),r[1]=Math.trunc(e%12),r},yc=({values:n},t)=>n[t],gc=({values:n},t)=>n[t],mc=({values:n},t)=>n[t],bc=({values:n},t)=>n[t],mh=(n,t)=>{switch(n.type.unit){case q.SECOND:return yc(n,t);case q.MILLISECOND:return gc(n,t);case q.MICROSECOND:return mc(n,t);case q.NANOSECOND:return bc(n,t)}},bh=(n,t)=>{const{stride:e,children:r}=n,s=r[0].slice(t*e,e);return new mt([s])};Y.prototype.visitNull=Q(eh);Y.prototype.visitBool=Q(nh);Y.prototype.visitInt=Q(sh);Y.prototype.visitInt8=Q(We);Y.prototype.visitInt16=Q(We);Y.prototype.visitInt32=Q(We);Y.prototype.visitInt64=Q(tc);Y.prototype.visitUint8=Q(We);Y.prototype.visitUint16=Q(We);Y.prototype.visitUint32=Q(We);Y.prototype.visitUint64=Q(tc);Y.prototype.visitFloat=Q(oh);Y.prototype.visitFloat16=Q(rh);Y.prototype.visitFloat32=Q(We);Y.prototype.visitFloat64=Q(We);Y.prototype.visitUtf8=Q(nc);Y.prototype.visitLargeUtf8=Q(nc);Y.prototype.visitBinary=Q(ec);Y.prototype.visitLargeBinary=Q(ec);Y.prototype.visitFixedSizeBinary=Q(ih);Y.prototype.visitDate=Q(ah);Y.prototype.visitDateDay=Q(Xa);Y.prototype.visitDateMillisecond=Q(Qa);Y.prototype.visitTimestamp=Q(ch);Y.prototype.visitTimestampSecond=Q(rc);Y.prototype.visitTimestampMillisecond=Q(ic);Y.prototype.visitTimestampMicrosecond=Q(sc);Y.prototype.visitTimestampNanosecond=Q(oc);Y.prototype.visitTime=Q(uh);Y.prototype.visitTimeSecond=Q(ac);Y.prototype.visitTimeMillisecond=Q(cc);Y.prototype.visitTimeMicrosecond=Q(uc);Y.prototype.visitTimeNanosecond=Q(lc);Y.prototype.visitDecimal=Q(lh);Y.prototype.visitList=Q(hh);Y.prototype.visitStruct=Q(fh);Y.prototype.visitUnion=Q(ph);Y.prototype.visitDenseUnion=Q(hc);Y.prototype.visitSparseUnion=Q(dc);Y.prototype.visitDictionary=Q(yh);Y.prototype.visitInterval=Q(gh);Y.prototype.visitIntervalDayTime=Q(fc);Y.prototype.visitIntervalYearMonth=Q(pc);Y.prototype.visitDuration=Q(mh);Y.prototype.visitDurationSecond=Q(yc);Y.prototype.visitDurationMillisecond=Q(gc);Y.prototype.visitDurationMicrosecond=Q(mc);Y.prototype.visitDurationNanosecond=Q(bc);Y.prototype.visitFixedSizeList=Q(bh);Y.prototype.visitMap=Q(dh);const Zt=new Y,gn=Symbol.for("keys"),Bn=Symbol.for("vals"),mn=Symbol.for("kKeysAsStrings"),Zi=Symbol.for("_kKeysAsStrings");class hs{constructor(t){return this[gn]=new mt([t.children[0]]).memoize(),this[Bn]=t.children[1],new Proxy(this,new _h)}get[mn](){return this[Zi]||(this[Zi]=Array.from(this[gn].toArray(),String))}[Symbol.iterator](){return new wh(this[gn],this[Bn])}get size(){return this[gn].length}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[gn],e=this[Bn],r={};for(let i=-1,s=t.length;++i<s;)r[t.get(i)]=Zt.visit(e,i);return r}toString(){return`{${[...this].map(([t,e])=>`${Kn(t)}: ${Kn(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class wh{constructor(t,e){this.keys=t,this.vals=e,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){const t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),Zt.visit(this.vals,t)]})}}class _h{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[mn]}has(t,e){return t[mn].includes(e)}getOwnPropertyDescriptor(t,e){if(t[mn].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const r=t[mn].indexOf(e);if(r!==-1){const i=Zt.visit(Reflect.get(t,Bn),r);return Reflect.set(t,e,i),i}}set(t,e,r){const i=t[mn].indexOf(e);return i!==-1?(ne.visit(Reflect.get(t,Bn),i,r),Reflect.set(t,e,r)):Reflect.has(t,e)?Reflect.set(t,e,r):!1}}Object.defineProperties(hs.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[gn]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Bn]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Zi]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let co;function wc(n,t,e,r){const{length:i=0}=n;let s=typeof t!="number"?0:t,o=typeof e!="number"?i:e;return s<0&&(s=(s%i+i)%i),o<0&&(o=(o%i+i)%i),o<s&&(co=s,s=o,o=co),o>i&&(o=i),r?r(n,s,o):[s,o]}const ds=(n,t)=>n<0?t+n:n,uo=n=>n!==n;function Ln(n){if(typeof n!=="object"||n===null)return uo(n)?uo:e=>e===n;if(n instanceof Date){const e=n.valueOf();return r=>r instanceof Date?r.valueOf()===e:!1}return ArrayBuffer.isView(n)?e=>e?ml(n,e):!1:n instanceof Map?Sh(n):Array.isArray(n)?vh(n):n instanceof mt?Ih(n):Bh(n,!0)}function vh(n){const t=[];for(let e=-1,r=n.length;++e<r;)t[e]=Ln(n[e]);return hi(t)}function Sh(n){let t=-1;const e=[];for(const r of n.values())e[++t]=Ln(r);return hi(e)}function Ih(n){const t=[];for(let e=-1,r=n.length;++e<r;)t[e]=Ln(n.get(e));return hi(t)}function Bh(n,t=!1){const e=Object.keys(n);if(!t&&e.length===0)return()=>!1;const r=[];for(let i=-1,s=e.length;++i<s;)r[i]=Ln(n[e[i]]);return hi(r,e)}function hi(n,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return Mh(n,e);case Map:return lo(n,e,e.keys());case hs:case ls:case Object:case void 0:return lo(n,e,t||Object.keys(e))}return e instanceof mt?Ah(n,e):!1}}function Mh(n,t){const e=n.length;if(t.length!==e)return!1;for(let r=-1;++r<e;)if(!n[r](t[r]))return!1;return!0}function Ah(n,t){const e=n.length;if(t.length!==e)return!1;for(let r=-1;++r<e;)if(!n[r](t.get(r)))return!1;return!0}function lo(n,t,e){const r=e[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),s=t instanceof Map?t.values():Object.values(t)[Symbol.iterator]();let o=0;const a=n.length;let c=s.next(),u=r.next(),f=i.next();for(;o<a&&!u.done&&!f.done&&!c.done&&!(u.value!==f.value||!n[o](c.value));++o,u=r.next(),f=i.next(),c=s.next());return o===a&&u.done&&f.done&&c.done?!0:(r.return&&r.return(),i.return&&i.return(),s.return&&s.return(),!1)}function _c(n,t,e,r){return(e&1<<r)!==0}function Dh(n,t,e,r){return(e&1<<r)>>r}function ho(n,t,e){const r=e.byteLength+7&-8;if(n>0||e.byteLength<r){const i=new Uint8Array(r);return i.set(n%8===0?e.subarray(n>>3):Gi(new fs(e,n,t,null,_c)).subarray(0,r)),i}return e}function Gi(n){const t=[];let e=0,r=0,i=0;for(const o of n)o&&(i|=1<<r),++r===8&&(t[e++]=i,i=r=0);(e===0||r>0)&&(t[e++]=i);const s=new Uint8Array(t.length+7&-8);return s.set(t),s}class fs{constructor(t,e,r,i,s){this.bytes=t,this.length=r,this.context=i,this.get=s,this.bit=e%8,this.byteIndex=e>>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 Yi(n,t,e){if(e-t<=0)return 0;if(e-t<8){let s=0;for(const o of new fs(n,t,e-t,n,Dh))s+=o;return s}const r=e>>3<<3,i=t+(t%8===0?0:8-t%8);return Yi(n,t,i)+Yi(n,r,e)+Oh(n,i>>3,r-i>>3)}function Oh(n,t,e){let r=0,i=Math.trunc(t);const s=new DataView(n.buffer,n.byteOffset,n.byteLength),o=e===void 0?n.byteLength:i+e;for(;o-i>=4;)r+=_i(s.getUint32(i)),i+=4;for(;o-i>=2;)r+=_i(s.getUint16(i)),i+=2;for(;o-i>=1;)r+=_i(s.getUint8(i)),i+=1;return r}function _i(n){let t=Math.trunc(n);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}const kh=-1;class pt{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){const{type:t}=this;return G.isSparseUnion(t)?this.children.some(e=>e.nullable):G.isDenseUnion(t)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0;const{valueOffsets:e,values:r,nullBitmap:i,typeIds:s}=this;return e&&(t+=e.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),this.children.reduce((o,a)=>o+a.byteLength,t)}get nullCount(){if(G.isUnion(this.type))return this.children.reduce((r,i)=>r+i.nullCount,0);let t=this._nullCount,e;return t<=kh&&(e=this.nullBitmap)&&(this._nullCount=t=e.length===0?0:this.length-Yi(e,this.offset,this.offset+this.length)),t}constructor(t,e,r,i,s,o=[],a){this.type=t,this.children=o,this.dictionary=a,this.offset=Math.floor(Math.max(e||0,0)),this.length=Math.floor(Math.max(r||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let c;s instanceof pt?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=De(t),s&&((c=s[0])&&(this.valueOffsets=c),(c=s[1])&&(this.values=c),(c=s[2])&&(this.nullBitmap=c),(c=s[3])&&(this.typeIds=c)))}getValid(t){const{type:e}=this;if(G.isUnion(e)){const r=e,i=this.children[r.typeIdToChildIndex[this.typeIds[t]]],s=r.mode===Wt.Dense?this.valueOffsets[t]:t;return i.getValid(s)}if(this.nullable&&this.nullCount>0){const r=this.offset+t;return(this.nullBitmap[r>>3]&1<<r%8)!==0}return!0}setValid(t,e){let r;const{type:i}=this;if(G.isUnion(i)){const s=i,o=this.children[s.typeIdToChildIndex[this.typeIds[t]]],a=s.mode===Wt.Dense?this.valueOffsets[t]:t;r=o.getValid(a),o.setValid(a,e)}else{let{nullBitmap:s}=this;const{offset:o,length:a}=this,c=o+t,u=1<<c%8,f=c>>3;(!s||s.byteLength<=f)&&(s=new Uint8Array((o+a+63&-64)>>3).fill(255),this.nullCount>0?(s.set(ho(o,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:s})):Object.assign(this,{nullBitmap:s,_nullCount:0}));const S=s[f];r=(S&u)!==0,s[f]=e?S|u:S&~u}return r!==!!e&&(this._nullCount=this.nullCount+(e?-1:1)),e}clone(t=this.type,e=this.offset,r=this.length,i=this._nullCount,s=this,o=this.children){return new pt(t,e,r,i,s,o,this.dictionary)}slice(t,e){const{stride:r,typeId:i,children:s}=this,o=+(this._nullCount===0)-1,a=i===16?r:1,c=this._sliceBuffers(t,e,r,i);return this.clone(this.type,this.offset+t,e,o,c,s.length===0||this.valueOffsets?s:this._sliceChildren(s,a*t,a*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===b.Null)return this.clone(this.type,0,t,0);const{length:e,nullCount:r}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);i[e>>3]=(1<<e-(e&-8))-1,r>0&&i.set(ho(this.offset,e,this.nullBitmap),0);const s=this.buffers;return s[Ae.VALIDITY]=i,this.clone(this.type,0,t,r+(t-e),s)}_sliceBuffers(t,e,r,i){let s;const{buffers:o}=this;return(s=o[Ae.TYPE])&&(o[Ae.TYPE]=s.subarray(t,t+e)),(s=o[Ae.OFFSET])&&(o[Ae.OFFSET]=s.subarray(t,t+e+1))||(s=o[Ae.DATA])&&(o[Ae.DATA]=i===6?s:s.subarray(r*t,r*(t+e))),o}_sliceChildren(t,e,r){return t.map(i=>i.slice(e,r))}}pt.prototype.children=Object.freeze([]);class Gn extends ot{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){const{["type"]:e,["offset"]:r=0,["length"]:i=0}=t;return new pt(e,r,i,i)}visitBool(t){const{["type"]:e,["offset"]:r=0}=t,i=lt(t.nullBitmap),s=gt(e.ArrayType,t.data),{["length"]:o=s.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new pt(e,r,o,a,[void 0,s,i])}visitInt(t){const{["type"]:e,["offset"]:r=0}=t,i=lt(t.nullBitmap),s=gt(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new pt(e,r,o,a,[void 0,s,i])}visitFloat(t){const{["type"]:e,["offset"]:r=0}=t,i=lt(t.nullBitmap),s=gt(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new pt(e,r,o,a,[void 0,s,i])}visitUtf8(t){const{["type"]:e,["offset"]:r=0}=t,i=lt(t.data),s=lt(t.nullBitmap),o=Un(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new pt(e,r,a,c,[o,i,s])}visitLargeUtf8(t){const{["type"]:e,["offset"]:r=0}=t,i=lt(t.data),s=lt(t.nullBitmap),o=qs(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new pt(e,r,a,c,[o,i,s])}visitBinary(t){const{["type"]:e,["offset"]:r=0}=t,i=lt(t.data),s=lt(t.nullBitmap),o=Un(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new pt(e,r,a,c,[o,i,s])}visitLargeBinary(t){const{["type"]:e,["offset"]:r=0}=t,i=lt(t.data),s=lt(t.nullBitmap),o=qs(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new pt(e,r,a,c,[o,i,s])}visitFixedSizeBinary(t){const{["type"]:e,["offset"]:r=0}=t,i=lt(t.nullBitmap),s=gt(e.ArrayType,t.data),{["length"]:o=s.length/De(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new pt(e,r,o,a,[void 0,s,i])}visitDate(t){const{["type"]:e,["offset"]:r=0}=t,i=lt(t.nullBitmap),s=gt(e.ArrayType,t.data),{["length"]:o=s.length/De(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new pt(e,r,o,a,[void 0,s,i])}visitTimestamp(t){const{["type"]:e,["offset"]:r=0}=t,i=lt(t.nullBitmap),s=gt(e.ArrayType,t.data),{["length"]:o=s.length/De(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new pt(e,r,o,a,[void 0,s,i])}visitTime(t){const{["type"]:e,["offset"]:r=0}=t,i=lt(t.nullBitmap),s=gt(e.ArrayType,t.data),{["length"]:o=s.length/De(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new pt(e,r,o,a,[void 0,s,i])}visitDecimal(t){const{["type"]:e,["offset"]:r=0}=t,i=lt(t.nullBitmap),s=gt(e.ArrayType,t.data),{["length"]:o=s.length/De(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new pt(e,r,o,a,[void 0,s,i])}visitList(t){const{["type"]:e,["offset"]:r=0,["child"]:i}=t,s=lt(t.nullBitmap),o=Un(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new pt(e,r,a,c,[o,void 0,s],[i])}visitStruct(t){const{["type"]:e,["offset"]:r=0,["children"]:i=[]}=t,s=lt(t.nullBitmap),{length:o=i.reduce((c,{length:u})=>Math.max(c,u),0),nullCount:a=t.nullBitmap?-1:0}=t;return new pt(e,r,o,a,[void 0,void 0,s],i)}visitUnion(t){const{["type"]:e,["offset"]:r=0,["children"]:i=[]}=t,s=gt(e.ArrayType,t.typeIds),{["length"]:o=s.length,["nullCount"]:a=-1}=t;if(G.isSparseUnion(e))return new pt(e,r,o,a,[void 0,void 0,void 0,s],i);const c=Un(t.valueOffsets);return new pt(e,r,o,a,[c,void 0,void 0,s],i)}visitDictionary(t){const{["type"]:e,["offset"]:r=0}=t,i=lt(t.nullBitmap),s=gt(e.indices.ArrayType,t.data),{["dictionary"]:o=new mt([new Gn().visit({type:e.dictionary})])}=t,{["length"]:a=s.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new pt(e,r,a,c,[void 0,s,i],[],o)}visitInterval(t){const{["type"]:e,["offset"]:r=0}=t,i=lt(t.nullBitmap),s=gt(e.ArrayType,t.data),{["length"]:o=s.length/De(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new pt(e,r,o,a,[void 0,s,i])}visitDuration(t){const{["type"]:e,["offset"]:r=0}=t,i=lt(t.nullBitmap),s=gt(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new pt(e,r,o,a,[void 0,s,i])}visitFixedSizeList(t){const{["type"]:e,["offset"]:r=0,["child"]:i=new Gn().visit({type:e.valueType})}=t,s=lt(t.nullBitmap),{["length"]:o=i.length/De(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new pt(e,r,o,a,[void 0,void 0,s],[i])}visitMap(t){const{["type"]:e,["offset"]:r=0,["child"]:i=new Gn().visit({type:e.childType})}=t,s=lt(t.nullBitmap),o=Un(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new pt(e,r,a,c,[o,void 0,s],[i])}}const Fh=new Gn;function st(n){return Fh.visit(n)}class fo{constructor(t=0,e){this.numChunks=t,this.getChunkIterator=e,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){const 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 Th(n){return n.some(t=>t.nullable)}function vc(n){return n.reduce((t,e)=>t+e.nullCount,0)}function Sc(n){return n.reduce((t,e,r)=>(t[r+1]=t[r]+e.length,t),new Uint32Array(n.length+1))}function Ic(n,t,e,r){const i=[];for(let s=-1,o=n.length;++s<o;){const a=n[s],c=t[s],{length:u}=a;if(c>=r)break;if(e>=c+u)continue;if(c>=e&&c+u<=r){i.push(a);continue}const f=Math.max(0,e-c),S=Math.min(r-c,u);i.push(a.slice(f,S-f))}return i.length===0&&i.push(n[0].slice(0,0)),i}function ps(n,t,e,r){let i=0,s=0,o=t.length-1;do{if(i>=o-1)return e<t[o]?r(n,i,e-t[i]):null;s=i+Math.trunc((o-i)*.5),e<t[s]?o=s:i=s}while(i<o)}function ys(n,t){return n.getValid(t)}function Hr(n){function t(e,r,i){return n(e[r],i)}return function(e){const r=this.data;return ps(r,this._offsets,e,t)}}function Bc(n){let t;function e(r,i,s){return n(r[i],s,t)}return function(r,i){const s=this.data;t=i;const o=ps(s,this._offsets,r,e);return t=void 0,o}}function Mc(n){let t;function e(r,i,s){let o=s,a=0,c=0;for(let u=i-1,f=r.length;++u<f;){const S=r[u];if(~(a=n(S,t,o)))return c+a;o=0,c+=S.length}return-1}return function(r,i){t=r;const s=this.data,o=typeof i!="number"?e(s,0,0):ps(s,this._offsets,i,e);return t=void 0,o}}class J extends ot{}function Nh(n,t){return t===null&&n.length>0?0:-1}function Eh(n,t){const{nullBitmap:e}=n;if(!e||n.nullCount<=0)return-1;let r=0;for(const i of new fs(e,n.offset+(t||0),n.length,e,_c)){if(!i)return r;++r}return-1}function nt(n,t,e){if(t===void 0)return-1;if(t===null)switch(n.typeId){case b.Union:break;case b.Dictionary:break;default:return Eh(n,e)}const r=Zt.getVisitFn(n),i=Ln(t);for(let s=(e||0)-1,o=n.length;++s<o;)if(i(r(n,s)))return s;return-1}function Ac(n,t,e){const r=Zt.getVisitFn(n),i=Ln(t);for(let s=(e||0)-1,o=n.length;++s<o;)if(i(r(n,s)))return s;return-1}J.prototype.visitNull=Nh;J.prototype.visitBool=nt;J.prototype.visitInt=nt;J.prototype.visitInt8=nt;J.prototype.visitInt16=nt;J.prototype.visitInt32=nt;J.prototype.visitInt64=nt;J.prototype.visitUint8=nt;J.prototype.visitUint16=nt;J.prototype.visitUint32=nt;J.prototype.visitUint64=nt;J.prototype.visitFloat=nt;J.prototype.visitFloat16=nt;J.prototype.visitFloat32=nt;J.prototype.visitFloat64=nt;J.prototype.visitUtf8=nt;J.prototype.visitLargeUtf8=nt;J.prototype.visitBinary=nt;J.prototype.visitLargeBinary=nt;J.prototype.visitFixedSizeBinary=nt;J.prototype.visitDate=nt;J.prototype.visitDateDay=nt;J.prototype.visitDateMillisecond=nt;J.prototype.visitTimestamp=nt;J.prototype.visitTimestampSecond=nt;J.prototype.visitTimestampMillisecond=nt;J.prototype.visitTimestampMicrosecond=nt;J.prototype.visitTimestampNanosecond=nt;J.prototype.visitTime=nt;J.prototype.visitTimeSecond=nt;J.prototype.visitTimeMillisecond=nt;J.prototype.visitTimeMicrosecond=nt;J.prototype.visitTimeNanosecond=nt;J.prototype.visitDecimal=nt;J.prototype.visitList=nt;J.prototype.visitStruct=nt;J.prototype.visitUnion=nt;J.prototype.visitDenseUnion=Ac;J.prototype.visitSparseUnion=Ac;J.prototype.visitDictionary=nt;J.prototype.visitInterval=nt;J.prototype.visitIntervalDayTime=nt;J.prototype.visitIntervalYearMonth=nt;J.prototype.visitDuration=nt;J.prototype.visitDurationSecond=nt;J.prototype.visitDurationMillisecond=nt;J.prototype.visitDurationMicrosecond=nt;J.prototype.visitDurationNanosecond=nt;J.prototype.visitFixedSizeList=nt;J.prototype.visitMap=nt;const Kr=new J;class H extends ot{}function tt(n){const{type:t}=n;if(n.nullCount===0&&n.stride===1&&(G.isInt(t)&&t.bitWidth!==64||G.isTime(t)&&t.bitWidth!==64||G.isFloat(t)&&t.precision!==xt.HALF))return new fo(n.data.length,r=>{const i=n.data[r];return i.values.subarray(0,i.length)[Symbol.iterator]()});let e=0;return new fo(n.data.length,r=>{const s=n.data[r].length,o=n.slice(e,e+s);return e+=s,new Lh(o)})}class Lh{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}}H.prototype.visitNull=tt;H.prototype.visitBool=tt;H.prototype.visitInt=tt;H.prototype.visitInt8=tt;H.prototype.visitInt16=tt;H.prototype.visitInt32=tt;H.prototype.visitInt64=tt;H.prototype.visitUint8=tt;H.prototype.visitUint16=tt;H.prototype.visitUint32=tt;H.prototype.visitUint64=tt;H.prototype.visitFloat=tt;H.prototype.visitFloat16=tt;H.prototype.visitFloat32=tt;H.prototype.visitFloat64=tt;H.prototype.visitUtf8=tt;H.prototype.visitLargeUtf8=tt;H.prototype.visitBinary=tt;H.prototype.visitLargeBinary=tt;H.prototype.visitFixedSizeBinary=tt;H.prototype.visitDate=tt;H.prototype.visitDateDay=tt;H.prototype.visitDateMillisecond=tt;H.prototype.visitTimestamp=tt;H.prototype.visitTimestampSecond=tt;H.prototype.visitTimestampMillisecond=tt;H.prototype.visitTimestampMicrosecond=tt;H.prototype.visitTimestampNanosecond=tt;H.prototype.visitTime=tt;H.prototype.visitTimeSecond=tt;H.prototype.visitTimeMillisecond=tt;H.prototype.visitTimeMicrosecond=tt;H.prototype.visitTimeNanosecond=tt;H.prototype.visitDecimal=tt;H.prototype.visitList=tt;H.prototype.visitStruct=tt;H.prototype.visitUnion=tt;H.prototype.visitDenseUnion=tt;H.prototype.visitSparseUnion=tt;H.prototype.visitDictionary=tt;H.prototype.visitInterval=tt;H.prototype.visitIntervalDayTime=tt;H.prototype.visitIntervalYearMonth=tt;H.prototype.visitDuration=tt;H.prototype.visitDurationSecond=tt;H.prototype.visitDurationMillisecond=tt;H.prototype.visitDurationMicrosecond=tt;H.prototype.visitDurationNanosecond=tt;H.prototype.visitFixedSizeList=tt;H.prototype.visitMap=tt;const gs=new H;var Dc;const Oc={},kc={};class mt{constructor(t){var e,r,i;const s=t[0]instanceof mt?t.flatMap(a=>a.data):t;if(s.length===0||s.some(a=>!(a instanceof pt)))throw new TypeError("Vector constructor expects an Array of Data instances.");const o=(e=s[0])===null||e===void 0?void 0:e.type;switch(s.length){case 0:this._offsets=[0];break;case 1:{const{get:a,set:c,indexOf:u}=Oc[o.typeId],f=s[0];this.isValid=S=>ys(f,S),this.get=S=>a(f,S),this.set=(S,k)=>c(f,S,k),this.indexOf=S=>u(f,S),this._offsets=[0,f.length];break}default:Object.setPrototypeOf(this,kc[o.typeId]),this._offsets=Sc(s);break}this.data=s,this.type=o,this.stride=De(o),this.numChildren=(i=(r=o.children)===null||r===void 0?void 0:r.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,e)=>t+e.byteLength,0)}get nullable(){return Th(this.data)}get nullCount(){return vc(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(ds(t,this.length))}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>-1}[Symbol.iterator](){return gs.visit(this)}concat(...t){return new mt(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new mt(wc(this,t,e,({data:r,_offsets:i},s,o)=>Ic(r,i,s,o)))}toJSON(){return[...this]}toArray(){const{type:t,data:e,length:r,stride:i,ArrayType:s}=this;switch(t.typeId){case b.Int:case b.Float:case b.Decimal:case b.Time:case b.Timestamp:switch(e.length){case 0:return new s;case 1:return e[0].values.subarray(0,r*i);default:return e.reduce((o,{values:a,length:c})=>(o.array.set(a.subarray(0,c*i),o.offset),o.offset+=c*i,o),{array:new s(r*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var e;return this.getChildAt((e=this.type.children)===null||e===void 0?void 0:e.findIndex(r=>r.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new mt(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return G.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(G.isDictionary(this.type)){const t=new qr(this.data[0].dictionary),e=this.data.map(r=>{const i=r.clone();return i.dictionary=t,i});return new mt(e)}return new qr(this)}unmemoize(){if(G.isDictionary(this.type)&&this.isMemoized){const t=this.data[0].dictionary.unmemoize(),e=this.data.map(r=>{const i=r.clone();return i.dictionary=t,i});return new mt(e)}return this}}Dc=Symbol.toStringTag;mt[Dc]=(n=>{n.type=G.prototype,n.data=[],n.length=0,n.stride=1,n.numChildren=0,n._offsets=new Uint32Array([0]),n[Symbol.isConcatSpreadable]=!0;const t=Object.keys(b).map(e=>b[e]).filter(e=>typeof e=="number"&&e!==b.NONE);for(const e of t){const r=Zt.getVisitFnByTypeId(e),i=ne.getVisitFnByTypeId(e),s=Kr.getVisitFnByTypeId(e);Oc[e]={get:r,set:i,indexOf:s},kc[e]=Object.create(n,{isValid:{value:Hr(ys)},get:{value:Hr(Zt.getVisitFnByTypeId(e))},set:{value:Bc(ne.getVisitFnByTypeId(e))},indexOf:{value:Mc(Kr.getVisitFnByTypeId(e))}})}return"Vector"})(mt.prototype);class qr extends mt{constructor(t){super(t.data);const e=this.get,r=this.set,i=this.slice,s=new Array(this.length);Object.defineProperty(this,"get",{value(o){const a=s[o];if(a!==void 0)return a;const c=e.call(this,o);return s[o]=c,c}}),Object.defineProperty(this,"set",{value(o,a){r.call(this,o,a),s[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new qr(i.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new mt(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}class Ji{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,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,e,r,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(r),t.writeInt64(BigInt(e??0)),t.offset()}}class Yt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFooter(t,e){return(e||new Yt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+ft),(e||new Yt).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):At.V1}schema(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new fe).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}dictionaries(t,e){const r=this.bb.__offset(this.bb_pos,8);return r?(e||new Ji).__init(this.bb.__vector(this.bb_pos+r)+t*24,this.bb):null}dictionariesLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,e){const r=this.bb.__offset(this.bb_pos,10);return r?(e||new Ji).__init(this.bb.__vector(this.bb_pos+r)+t*24,this.bb):null}recordBatchesLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const r=this.bb.__offset(this.bb_pos,12);return r?(e||new kt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){const 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,e){t.addFieldInt16(0,e,At.V1)}static addSchema(t,e){t.addFieldOffset(1,e,0)}static addDictionaries(t,e){t.addFieldOffset(2,e,0)}static startDictionariesVector(t,e){t.startVector(24,e,8)}static addRecordBatches(t,e){t.addFieldOffset(3,e,0)}static startRecordBatchesVector(t,e){t.startVector(24,e,8)}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,e){t.finish(e)}static finishSizePrefixedFooterBuffer(t,e){t.finish(e,void 0,!0)}}class dt{constructor(t=[],e,r,i=At.V5){this.fields=t||[],this.metadata=e||new Map,r||(r=Hi(this.fields)),this.dictionaries=r,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,e)=>`${e}: ${t}`).join(", ")} }>`}select(t){const e=new Set(t),r=this.fields.filter(i=>e.has(i.name));return new dt(r,this.metadata)}selectAt(t){const e=t.map(r=>this.fields[r]).filter(Boolean);return new dt(e,this.metadata)}assign(...t){const e=t[0]instanceof dt?t[0]:Array.isArray(t[0])?new dt(t[0]):new dt(t),r=[...this.fields],i=yr(yr(new Map,this.metadata),e.metadata),s=e.fields.filter(a=>{const c=r.findIndex(u=>u.name===a.name);return~c?(r[c]=a.clone({metadata:yr(yr(new Map,r[c].metadata),a.metadata)}))&&!1:!0}),o=Hi(s,new Map);return new dt([...r,...s],i,new Map([...this.dictionaries,...o]))}}dt.prototype.fields=null;dt.prototype.metadata=null;dt.prototype.dictionaries=null;class _t{static new(...t){let[e,r,i,s]=t;return t[0]&&typeof t[0]=="object"&&({name:e}=t[0],r===void 0&&(r=t[0].type),i===void 0&&(i=t[0].nullable),s===void 0&&(s=t[0].metadata)),new _t(`${e}`,r,i,s)}constructor(t,e,r=!1,i){this.name=t,this.type=e,this.nullable=r,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[e,r,i,s]=t;return!t[0]||typeof t[0]!="object"?[e=this.name,r=this.type,i=this.nullable,s=this.metadata]=t:{name:e=this.name,type:r=this.type,nullable:i=this.nullable,metadata:s=this.metadata}=t[0],_t.new(e,r,i,s)}}_t.prototype.type=null;_t.prototype.name=null;_t.prototype.nullable=null;_t.prototype.metadata=null;function yr(n,t){return new Map([...n||new Map,...t||new Map])}function Hi(n,t=new Map){for(let e=-1,r=n.length;++e<r;){const s=n[e].type;if(G.isDictionary(s)){if(!t.has(s.id))t.set(s.id,s.dictionary);else if(t.get(s.id)!==s.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}s.children&&s.children.length>0&&Hi(s.children,t)}return t}var xh=Qo,Uh=Dn;class ms{static decode(t){t=new Uh(lt(t));const e=Yt.getRootAsFooter(t),r=dt.decode(e.schema(),new Map,e.version());return new Rh(r,e)}static encode(t){const e=new xh,r=dt.encode(e,t.schema);Yt.startRecordBatchesVector(e,t.numRecordBatches);for(const o of[...t.recordBatches()].slice().reverse())Fn.encode(e,o);const i=e.endVector();Yt.startDictionariesVector(e,t.numDictionaries);for(const o of[...t.dictionaryBatches()].slice().reverse())Fn.encode(e,o);const s=e.endVector();return Yt.startFooter(e),Yt.addSchema(e,r),Yt.addVersion(e,At.V5),Yt.addRecordBatches(e,i),Yt.addDictionaries(e,s),Yt.finishFooterBuffer(e,Yt.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,e=At.V5,r,i){this.schema=t,this.version=e,r&&(this._recordBatches=r),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,e=-1,r=this.numRecordBatches;++e<r;)(t=this.getRecordBatch(e))&&(yield t)}*dictionaryBatches(){for(let t,e=-1,r=this.numDictionaries;++e<r;)(t=this.getDictionaryBatch(e))&&(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 Rh extends ms{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,e){super(t,e.version()),this._footer=e}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){const e=this._footer.recordBatches(t);if(e)return Fn.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){const e=this._footer.dictionaries(t);if(e)return Fn.decode(e)}return null}}class Fn{static decode(t){return new Fn(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){const{metaDataLength:r}=e,i=BigInt(e.offset),s=BigInt(e.bodyLength);return Ji.createBlock(t,i,r,s)}constructor(t,e,r){this.metaDataLength=t,this.offset=wt(r),this.bodyLength=wt(e)}}const It=Object.freeze({done:!0,value:void 0});class po{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}}class Fc{tee(){return this._getDOMStream().tee()}pipe(t,e){return this._getNodeStream().pipe(t,e)}pipeTo(t,e){return this._getDOMStream().pipeTo(t,e)}pipeThrough(t,e){return this._getDOMStream().pipeThrough(t,e)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}}class Ch extends Fc{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return rt(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){const{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(It);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return qt.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return qt.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return rt(this,void 0,void 0,function*(){return yield this.abort(t),It})}return(t){return rt(this,void 0,void 0,function*(){return yield this.close(),It})}read(t){return rt(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return rt(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((e,r)=>{this.resolvers.push({resolve:e,reject:r})}):Promise.resolve(It)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}class Ph extends Ch{write(t){if((t=lt(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Pi(this.toUint8Array(!0)):this.toUint8Array(!1).then(Pi)}toUint8Array(t=!1){return t?we(this._values)[0]:rt(this,void 0,void 0,function*(){var e,r,i,s;const o=[];let a=0;try{for(var c=!0,u=_n(this),f;f=yield u.next(),e=f.done,!e;c=!0){s=f.value,c=!1;const S=s;o.push(S),a+=S.byteLength}}catch(S){r={error:S}}finally{try{!c&&!e&&(i=u.return)&&(yield i.call(u))}finally{if(r)throw r.error}}return we(o,a)[0]})}}class Xr{constructor(t){t&&(this.source=new $h(qt.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)}}class Tn{constructor(t){t instanceof Tn?this.source=t.source:t instanceof Ph?this.source=new He(qt.fromAsyncIterable(t)):Ko(t)?this.source=new He(qt.fromNodeStream(t)):os(t)?this.source=new He(qt.fromDOMStream(t)):Jo(t)?this.source=new He(qt.fromDOMStream(t.body)):li(t)?this.source=new He(qt.fromIterable(t)):Hn(t)?this.source=new He(qt.fromAsyncIterable(t)):ss(t)&&(this.source=new He(qt.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)}}class $h{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,e="read"){return this.source.next({cmd:e,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||It)}return(t){return Object.create(this.source.return&&this.source.return(t)||It)}}class He{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return rt(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return rt(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return rt(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return rt(this,arguments,void 0,function*(e,r="read"){return yield this.source.next({cmd:r,size:e})})}throw(t){return rt(this,void 0,void 0,function*(){const e=this.source.throw&&(yield this.source.throw(t))||It;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return rt(this,void 0,void 0,function*(){const e=this.source.return&&(yield this.source.return(t))||It;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}}class yo extends Xr{constructor(t,e){super(),this.position=0,this.buffer=lt(t),this.size=e===void 0?this.buffer.byteLength:e}readInt32(t){const{buffer:e,byteOffset:r}=this.readAt(t,4);return new DataView(e,r).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){const{buffer:e,size:r,position:i}=this;return e&&i<r?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(r,i+Math.min(r-i,t)),e.subarray(i,this.position)):null}readAt(t,e){const r=this.buffer,i=Math.min(this.size,t+e);return r?r.subarray(t,i):new Uint8Array(e)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}}class Qr extends Tn{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=rt(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return rt(this,void 0,void 0,function*(){const{buffer:e,byteOffset:r}=yield this.readAt(t,4);return new DataView(e,r).getInt32(0,!0)})}seek(t){return rt(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 rt(this,void 0,void 0,function*(){this._pending&&(yield this._pending);const{_handle:e,size:r,position:i}=this;if(e&&i<r){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let s=i,o=0,a=0;const c=Math.min(r,s+Math.min(r-s,t)),u=new Uint8Array(Math.max(0,(this.position=c)-s));for(;(s+=a)<c&&(o+=a)<u.byteLength;)({bytesRead:a}=yield e.read(u,o,u.byteLength-o,s));return u}return null})}readAt(t,e){return rt(this,void 0,void 0,function*(){this._pending&&(yield this._pending);const{_handle:r,size:i}=this;if(r&&t+e<i){const s=Math.min(i,t+e),o=new Uint8Array(s-t);return(yield r.read(o,0,e,t)).buffer}return new Uint8Array(e)})}close(){return rt(this,void 0,void 0,function*(){const t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return rt(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return rt(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}}const zh=65536;function wn(n){return n<0&&(n=4294967295+n+1),`0x${n.toString(16)}`}const Nn=8,bs=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];class Tc{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){const e=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),r=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]);let i=e[3]*r[3];this.buffer[0]=i&65535;let s=i>>>16;return i=e[2]*r[3],s+=i,i=e[3]*r[2]>>>0,s+=i,this.buffer[0]+=s<<16,this.buffer[1]=s>>>0<i?zh:0,this.buffer[1]+=s>>>16,this.buffer[1]+=e[1]*r[3]+e[2]*r[2]+e[3]*r[1],this.buffer[1]+=e[0]*r[3]+e[1]*r[2]+e[2]*r[1]+e[3]*r[0]<<16,this}_plus(t){const e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=e}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`${wn(this.buffer[1])} ${wn(this.buffer[0])}`}}class yt extends Tc{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,e=new Uint32Array(2)){return yt.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return yt.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){const r=t.length,i=new yt(e);for(let s=0;s<r;){const o=Nn<r-s?Nn:r-s,a=new yt(new Uint32Array([Number.parseInt(t.slice(s,s+o),10),0])),c=new yt(new Uint32Array([bs[o],0]));i.times(c),i.plus(a),s+=o}return i}static convertArray(t){const e=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)yt.from(t[r],new Uint32Array(e.buffer,e.byteOffset+2*r*4,2));return e}static multiply(t,e){return new yt(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new yt(new Uint32Array(t.buffer)).plus(e)}}class Vt extends Tc{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){const e=this.buffer[1]<<0,r=t.buffer[1]<<0;return e<r||e===r&&this.buffer[0]<t.buffer[0]}static from(t,e=new Uint32Array(2)){return Vt.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return Vt.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){const r=t.startsWith("-"),i=t.length,s=new Vt(e);for(let o=r?1:0;o<i;){const a=Nn<i-o?Nn:i-o,c=new Vt(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0])),u=new Vt(new Uint32Array([bs[a],0]));s.times(u),s.plus(c),o+=a}return r?s.negate():s}static convertArray(t){const e=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)Vt.from(t[r],new Uint32Array(e.buffer,e.byteOffset+2*r*4,2));return e}static multiply(t,e){return new Vt(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new Vt(new Uint32Array(t.buffer)).plus(e)}}class pe{constructor(t){this.buffer=t}high(){return new Vt(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Vt(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){const e=new yt(new Uint32Array([this.buffer[3],0])),r=new yt(new Uint32Array([this.buffer[2],0])),i=new yt(new Uint32Array([this.buffer[1],0])),s=new yt(new Uint32Array([this.buffer[0],0])),o=new yt(new Uint32Array([t.buffer[3],0])),a=new yt(new Uint32Array([t.buffer[2],0])),c=new yt(new Uint32Array([t.buffer[1],0])),u=new yt(new Uint32Array([t.buffer[0],0]));let f=yt.multiply(s,u);this.buffer[0]=f.low();const S=new yt(new Uint32Array([f.high(),0]));return f=yt.multiply(i,u),S.plus(f),f=yt.multiply(s,c),S.plus(f),this.buffer[1]=S.low(),this.buffer[3]=S.lessThan(f)?1:0,this.buffer[2]=S.high(),new yt(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(yt.multiply(r,u)).plus(yt.multiply(i,c)).plus(yt.multiply(s,a)),this.buffer[3]+=yt.multiply(e,u).plus(yt.multiply(r,c)).plus(yt.multiply(i,a)).plus(yt.multiply(s,o)).low(),this}plus(t){const e=new Uint32Array(4);return e[3]=this.buffer[3]+t.buffer[3]>>>0,e[2]=this.buffer[2]+t.buffer[2]>>>0,e[1]=this.buffer[1]+t.buffer[1]>>>0,e[0]=this.buffer[0]+t.buffer[0]>>>0,e[0]<this.buffer[0]>>>0&&++e[1],e[1]<this.buffer[1]>>>0&&++e[2],e[2]<this.buffer[2]>>>0&&++e[3],this.buffer[3]=e[3],this.buffer[2]=e[2],this.buffer[1]=e[1],this.buffer[0]=e[0],this}hex(){return`${wn(this.buffer[3])} ${wn(this.buffer[2])} ${wn(this.buffer[1])} ${wn(this.buffer[0])}`}static multiply(t,e){return new pe(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new pe(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return pe.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return pe.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){const r=t.startsWith("-"),i=t.length,s=new pe(e);for(let o=r?1:0;o<i;){const a=Nn<i-o?Nn:i-o,c=new pe(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0,0,0])),u=new pe(new Uint32Array([bs[a],0,0,0]));s.times(u),s.plus(c),o+=a}return r?s.negate():s}static convertArray(t){const e=new Uint32Array(t.length*4);for(let r=-1,i=t.length;++r<i;)pe.from(t[r],new Uint32Array(e.buffer,e.byteOffset+4*4*r,4));return e}}class Nc extends ot{constructor(t,e,r,i,s=At.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=e,this.buffers=r,this.dictionaries=i,this.metadataVersion=s}visit(t){return super.visit(t instanceof _t?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return st({type:t,length:e})}visitBool(t,{length:e,nullCount:r}=this.nextFieldNode()){return st({type:t,length:e,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitInt(t,{length:e,nullCount:r}=this.nextFieldNode()){return st({type:t,length:e,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:r}=this.nextFieldNode()){return st({type:t,length:e,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:r}=this.nextFieldNode()){return st({type:t,length:e,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:e,nullCount:r}=this.nextFieldNode()){return st({type:t,length:e,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:e,nullCount:r}=this.nextFieldNode()){return st({type:t,length:e,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:e,nullCount:r}=this.nextFieldNode()){return st({type:t,length:e,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:e,nullCount:r}=this.nextFieldNode()){return st({type:t,length:e,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDate(t,{length:e,nullCount:r}=this.nextFieldNode()){return st({type:t,length:e,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:r}=this.nextFieldNode()){return st({type:t,length:e,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTime(t,{length:e,nullCount:r}=this.nextFieldNode()){return st({type:t,length:e,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:r}=this.nextFieldNode()){return st({type:t,length:e,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitList(t,{length:e,nullCount:r}=this.nextFieldNode()){return st({type:t,length:e,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:e,nullCount:r}=this.nextFieldNode()){return st({type:t,length:e,nullCount:r,nullBitmap:this.readNullBitmap(t,r),children:this.visitMany(t.children)})}visitUnion(t,{length:e,nullCount:r}=this.nextFieldNode()){return this.metadataVersion<At.V5&&this.readNullBitmap(t,r),t.mode===Wt.Sparse?this.visitSparseUnion(t,{length:e,nullCount:r}):this.visitDenseUnion(t,{length:e,nullCount:r})}visitDenseUnion(t,{length:e,nullCount:r}=this.nextFieldNode()){return st({type:t,length:e,nullCount:r,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:e,nullCount:r}=this.nextFieldNode()){return st({type:t,length:e,nullCount:r,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:e,nullCount:r}=this.nextFieldNode()){return st({type:t,length:e,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:e,nullCount:r}=this.nextFieldNode()){return st({type:t,length:e,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDuration(t,{length:e,nullCount:r}=this.nextFieldNode()){return st({type:t,length:e,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:r}=this.nextFieldNode()){return st({type:t,length:e,nullCount:r,nullBitmap:this.readNullBitmap(t,r),child:this.visit(t.children[0])})}visitMap(t,{length:e,nullCount:r}=this.nextFieldNode()){return st({type:t,length:e,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,e,r=this.nextBufferRange()){return e>0&&this.readData(t,r)||new Uint8Array(0)}readOffsets(t,e){return this.readData(t,e)}readTypeIds(t,e){return this.readData(t,e)}readData(t,{length:e,offset:r}=this.nextBufferRange()){return this.bytes.subarray(r,r+e)}readDictionary(t){return this.dictionaries.get(t.id)}}class Vh extends Nc{constructor(t,e,r,i,s){super(new Uint8Array(0),e,r,i,s),this.sources=t}readNullBitmap(t,e,{offset:r}=this.nextBufferRange()){return e<=0?new Uint8Array(0):Gi(this.sources[r])}readOffsets(t,{offset:e}=this.nextBufferRange()){return gt(Uint8Array,gt(t.OffsetArrayType,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return gt(Uint8Array,gt(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){const{sources:r}=this;return G.isTimestamp(t)||(G.isInt(t)||G.isTime(t))&&t.bitWidth===64||G.isDuration(t)||G.isDate(t)&&t.unit===ee.MILLISECOND?gt(Uint8Array,Vt.convertArray(r[e])):G.isDecimal(t)?gt(Uint8Array,pe.convertArray(r[e])):G.isBinary(t)||G.isLargeBinary(t)||G.isFixedSizeBinary(t)?jh(r[e]):G.isBool(t)?Gi(r[e]):G.isUtf8(t)||G.isLargeUtf8(t)?is(r[e].join("")):gt(Uint8Array,gt(t.ArrayType,r[e].map(i=>+i)))}}function jh(n){const t=n.join(""),e=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)e[r>>1]=Number.parseInt(t.slice(r,r+2),16);return e}class K extends ot{compareSchemas(t,e){return t===e||e instanceof t.constructor&&this.compareManyFields(t.fields,e.fields)}compareManyFields(t,e){return t===e||Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((r,i)=>this.compareFields(r,e[i]))}compareFields(t,e){return t===e||e instanceof t.constructor&&t.name===e.name&&t.nullable===e.nullable&&this.visit(t.type,e.type)}}function Pt(n,t){return t instanceof n.constructor}function nn(n,t){return n===t||Pt(n,t)}function Le(n,t){return n===t||Pt(n,t)&&n.bitWidth===t.bitWidth&&n.isSigned===t.isSigned}function di(n,t){return n===t||Pt(n,t)&&n.precision===t.precision}function Wh(n,t){return n===t||Pt(n,t)&&n.byteWidth===t.byteWidth}function ws(n,t){return n===t||Pt(n,t)&&n.unit===t.unit}function cr(n,t){return n===t||Pt(n,t)&&n.unit===t.unit&&n.timezone===t.timezone}function ur(n,t){return n===t||Pt(n,t)&&n.unit===t.unit&&n.bitWidth===t.bitWidth}function Zh(n,t){return n===t||Pt(n,t)&&n.children.length===t.children.length&&Ve.compareManyFields(n.children,t.children)}function Gh(n,t){return n===t||Pt(n,t)&&n.children.length===t.children.length&&Ve.compareManyFields(n.children,t.children)}function _s(n,t){return n===t||Pt(n,t)&&n.mode===t.mode&&n.typeIds.every((e,r)=>e===t.typeIds[r])&&Ve.compareManyFields(n.children,t.children)}function Yh(n,t){return n===t||Pt(n,t)&&n.id===t.id&&n.isOrdered===t.isOrdered&&Ve.visit(n.indices,t.indices)&&Ve.visit(n.dictionary,t.dictionary)}function vs(n,t){return n===t||Pt(n,t)&&n.unit===t.unit}function lr(n,t){return n===t||Pt(n,t)&&n.unit===t.unit}function Jh(n,t){return n===t||Pt(n,t)&&n.listSize===t.listSize&&n.children.length===t.children.length&&Ve.compareManyFields(n.children,t.children)}function Hh(n,t){return n===t||Pt(n,t)&&n.keysSorted===t.keysSorted&&n.children.length===t.children.length&&Ve.compareManyFields(n.children,t.children)}K.prototype.visitNull=nn;K.prototype.visitBool=nn;K.prototype.visitInt=Le;K.prototype.visitInt8=Le;K.prototype.visitInt16=Le;K.prototype.visitInt32=Le;K.prototype.visitInt64=Le;K.prototype.visitUint8=Le;K.prototype.visitUint16=Le;K.prototype.visitUint32=Le;K.prototype.visitUint64=Le;K.prototype.visitFloat=di;K.prototype.visitFloat16=di;K.prototype.visitFloat32=di;K.prototype.visitFloat64=di;K.prototype.visitUtf8=nn;K.prototype.visitLargeUtf8=nn;K.prototype.visitBinary=nn;K.prototype.visitLargeBinary=nn;K.prototype.visitFixedSizeBinary=Wh;K.prototype.visitDate=ws;K.prototype.visitDateDay=ws;K.prototype.visitDateMillisecond=ws;K.prototype.visitTimestamp=cr;K.prototype.visitTimestampSecond=cr;K.prototype.visitTimestampMillisecond=cr;K.prototype.visitTimestampMicrosecond=cr;K.prototype.visitTimestampNanosecond=cr;K.prototype.visitTime=ur;K.prototype.visitTimeSecond=ur;K.prototype.visitTimeMillisecond=ur;K.prototype.visitTimeMicrosecond=ur;K.prototype.visitTimeNanosecond=ur;K.prototype.visitDecimal=nn;K.prototype.visitList=Zh;K.prototype.visitStruct=Gh;K.prototype.visitUnion=_s;K.prototype.visitDenseUnion=_s;K.prototype.visitSparseUnion=_s;K.prototype.visitDictionary=Yh;K.prototype.visitInterval=vs;K.prototype.visitIntervalDayTime=vs;K.prototype.visitIntervalYearMonth=vs;K.prototype.visitDuration=lr;K.prototype.visitDurationSecond=lr;K.prototype.visitDurationMillisecond=lr;K.prototype.visitDurationMicrosecond=lr;K.prototype.visitDurationNanosecond=lr;K.prototype.visitFixedSizeList=Jh;K.prototype.visitMap=Hh;const Ve=new K;function Kh(n,t){return Ve.compareSchemas(n,t)}function vi(n,t){return qh(n,t.map(e=>e.data.concat()))}function qh(n,t){const e=[...n.fields],r=[],i={numBatches:t.reduce((S,k)=>Math.max(S,k.length),0)};let s=0,o=0,a=-1;const c=t.length;let u,f=[];for(;i.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a<c;)f[a]=u=t[a].shift(),o=Math.min(o,u?u.length:o);Number.isFinite(o)&&(f=Xh(e,o,f,t,i),o>0&&(r[s++]=st({type:new Ct(e),length:o,nullCount:0,children:f.slice()})))}return[n=n.assign(e),r.map(S=>new se(n,S))]}function Xh(n,t,e,r,i){var s;const o=(t+63&-64)>>3;for(let a=-1,c=r.length;++a<c;){const u=e[a],f=u==null?void 0:u.length;if(f>=t)f===t?e[a]=u:(e[a]=u.slice(0,t),i.numBatches=Math.max(i.numBatches,r[a].unshift(u.slice(t,f-t))));else{const S=n[a];n[a]=S.clone({nullable:!0}),e[a]=(s=u==null?void 0:u._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:st({type:S.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return e}var Ec;class te{constructor(...t){var e,r;if(t.length===0)return this.batches=[],this.schema=new dt([]),this._offsets=[0],this;let i,s;t[0]instanceof dt&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(s=t.pop());const o=c=>{if(c){if(c instanceof se)return[c];if(c instanceof te)return c.batches;if(c instanceof pt){if(c.type instanceof Ct)return[new se(new dt(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(u=>o(u));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(u=>o(u));if(typeof c=="object"){const u=Object.keys(c),f=u.map(I=>new mt([c[I]])),S=i??new dt(u.map((I,m)=>new _t(String(I),f[m].type,f[m].nullable))),[,k]=vi(S,f);return k.length===0?[new se(c)]:k}}}return[]},a=t.flatMap(c=>o(c));if(i=(r=i??((e=a[0])===null||e===void 0?void 0:e.schema))!==null&&r!==void 0?r:new dt([]),!(i instanceof dt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const c of a){if(!(c instanceof se))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Kh(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=s??Sc(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,e)=>t+e.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=vc(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(ds(t,this.numRows))}set(t,e){}indexOf(t,e){return-1}[Symbol.iterator](){return this.batches.length>0?gs.visit(new mt(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
2
- ${this.toArray().join(`,
3
- `)}
4
- ]`}concat(...t){const e=this.schema,r=this.data.concat(t.flatMap(({data:i})=>i));return new te(e,r.map(i=>new se(e,i)))}slice(t,e){const r=this.schema;[t,e]=wc({length:this.numRows},t,e);const i=Ic(this.data,this._offsets,t,e);return new te(r,i.map(s=>new se(r,s)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(e=>e.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){const e=this.data.map(r=>r.children[t]);if(e.length===0){const{type:r}=this.schema.fields[t],i=st({type:r,length:0,nullCount:0});e.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new mt(e)}return null}setChild(t,e){var r;return this.setChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t),e)}setChildAt(t,e){let r=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){e||(e=new mt([st({type:new ze,length:this.numRows})]));const s=r.fields.slice(),o=s[t].clone({type:e.type}),a=this.schema.fields.map((c,u)=>this.getChildAt(u));[s[t],a[t]]=[o,e],[r,i]=vi(r,a)}return new te(r,i)}select(t){const e=this.schema.fields.reduce((r,i,s)=>r.set(i.name,s),new Map);return this.selectAt(t.map(r=>e.get(r)).filter(r=>r>-1))}selectAt(t){const e=this.schema.selectAt(t),r=this.batches.map(i=>i.selectAt(t));return new te(e,r)}assign(t){const e=this.schema.fields,[r,i]=t.schema.fields.reduce((a,c,u)=>{const[f,S]=a,k=e.findIndex(I=>I.name===c.name);return~k?S[k]=u:f.push(u),a},[[],[]]),s=this.schema.assign(t.schema),o=[...e.map((a,c)=>[c,i[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...r.map(a=>t.getChildAt(a))].filter(Boolean);return new te(...vi(s,o))}}Ec=Symbol.toStringTag;te[Ec]=(n=>(n.schema=null,n.batches=[],n._offsets=new Uint32Array([0]),n._nullCount=-1,n[Symbol.isConcatSpreadable]=!0,n.isValid=Hr(ys),n.get=Hr(Zt.getVisitFn(b.Struct)),n.set=Bc(ne.getVisitFn(b.Struct)),n.indexOf=Mc(Kr.getVisitFn(b.Struct)),"Table"))(te.prototype);var Lc;let se=class Zn{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof dt))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=st({nullCount:0,type:new Ct(this.schema.fields),children:this.schema.fields.map(e=>st({type:e.type,nullCount:0}))})]=t,!(this.data instanceof pt))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=go(this.schema,this.data.children);break}case 1:{const[e]=t,{fields:r,children:i,length:s}=Object.keys(e).reduce((c,u,f)=>(c.children[f]=e[u],c.length=Math.max(c.length,e[u].length),c.fields[f]=_t.new({name:u,type:e[u].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),o=new dt(r),a=st({type:new Ct(r),length:s,children:i,nullCount:0});[this.schema,this.data]=go(o,a.children,s);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=xc(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 Zt.visit(this.data,t)}at(t){return this.get(ds(t,this.numRows))}set(t,e){return ne.visit(this.data,t,e)}indexOf(t,e){return Kr.visit(this.data,t,e)}[Symbol.iterator](){return gs.visit(new mt([this.data]))}toArray(){return[...this]}concat(...t){return new te(this.schema,[this,...t])}slice(t,e){const[r]=new mt([this.data]).slice(t,e).data;return new Zn(this.schema,r)}getChild(t){var e;return this.getChildAt((e=this.schema.fields)===null||e===void 0?void 0:e.findIndex(r=>r.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new mt([this.data.children[t]]):null}setChild(t,e){var r;return this.setChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t),e)}setChildAt(t,e){let r=this.schema,i=this.data;if(t>-1&&t<this.numCols){e||(e=new mt([st({type:new ze,length:this.numRows})]));const s=r.fields.slice(),o=i.children.slice(),a=s[t].clone({type:e.type});[s[t],o[t]]=[a,e.data[0]],r=new dt(s,new Map(this.schema.metadata)),i=st({type:new Ct(s),children:o})}return new Zn(r,i)}select(t){const e=this.schema.select(t),r=new Ct(e.fields),i=[];for(const s of t){const o=this.schema.fields.findIndex(a=>a.name===s);~o&&(i[o]=this.data.children[o])}return new Zn(e,st({type:r,length:this.numRows,children:i}))}selectAt(t){const e=this.schema.selectAt(t),r=t.map(s=>this.data.children[s]).filter(Boolean),i=st({type:new Ct(e.fields),length:this.numRows,children:r});return new Zn(e,i)}};Lc=Symbol.toStringTag;se[Lc]=(n=>(n._nullCount=-1,n[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(se.prototype);function go(n,t,e=t.reduce((r,i)=>Math.max(r,i.length),0)){var r;const i=[...n.fields],s=[...t],o=(e+63&-64)>>3;for(const[a,c]of n.fields.entries()){const u=t[a];(!u||u.length!==e)&&(i[a]=c.clone({nullable:!0}),s[a]=(r=u==null?void 0:u._changeLengthAndBackfillNullBitmap(e))!==null&&r!==void 0?r:st({type:c.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)}))}return[n.assign(i),st({type:new Ct(i),length:e,children:s})]}function xc(n,t,e=new Map){var r,i;if(((r=n==null?void 0:n.length)!==null&&r!==void 0?r:0)>0&&(n==null?void 0:n.length)===(t==null?void 0:t.length))for(let s=-1,o=n.length;++s<o;){const{type:a}=n[s],c=t[s];for(const u of[c,...((i=c==null?void 0:c.dictionary)===null||i===void 0?void 0:i.data)||[]])xc(a.children,u==null?void 0:u.children,e);if(G.isDictionary(a)){const{id:u}=a;if(!e.has(u))c!=null&&c.dictionary&&e.set(u,c.dictionary);else if(e.get(u)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return e}class Uc extends se{constructor(t){const e=t.fields.map(i=>st({type:i.type})),r=st({type:new Ct(t.fields),nullCount:0,children:e});super(t,r)}}let xe=class de{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMessage(t,e){return(e||new de).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+ft),(e||new de).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):At.V1}headerType(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):ht.NONE}header(t){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}bodyLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,e){const r=this.bb.__offset(this.bb_pos,12);return r?(e||new kt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){const 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,e){t.addFieldInt16(0,e,At.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,ht.NONE)}static addHeader(t,e){t.addFieldOffset(2,e,0)}static addBodyLength(t,e){t.addFieldInt64(3,e,BigInt("0"))}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,e){t.finish(e)}static finishSizePrefixedMessageBuffer(t,e){t.finish(e,void 0,!0)}static createMessage(t,e,r,i,s,o){return de.startMessage(t),de.addVersion(t,e),de.addHeaderType(t,r),de.addHeader(t,i),de.addBodyLength(t,s),de.addCustomMetadata(t,o),de.endMessage(t)}};class Qh extends ot{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return so.startNull(e),so.endNull(e)}visitInt(t,e){return Ht.startInt(e),Ht.addBitWidth(e,t.bitWidth),Ht.addIsSigned(e,t.isSigned),Ht.endInt(e)}visitFloat(t,e){return ge.startFloatingPoint(e),ge.addPrecision(e,t.precision),ge.endFloatingPoint(e)}visitBinary(t,e){return to.startBinary(e),to.endBinary(e)}visitLargeBinary(t,e){return no.startLargeBinary(e),no.endLargeBinary(e)}visitBool(t,e){return eo.startBool(e),eo.endBool(e)}visitUtf8(t,e){return oo.startUtf8(e),oo.endUtf8(e)}visitLargeUtf8(t,e){return ro.startLargeUtf8(e),ro.endLargeUtf8(e)}visitDecimal(t,e){return ln.startDecimal(e),ln.addScale(e,t.scale),ln.addPrecision(e,t.precision),ln.addBitWidth(e,t.bitWidth),ln.endDecimal(e)}visitDate(t,e){return wr.startDate(e),wr.addUnit(e,t.unit),wr.endDate(e)}visitTime(t,e){return Xt.startTime(e),Xt.addUnit(e,t.unit),Xt.addBitWidth(e,t.bitWidth),Xt.endTime(e)}visitTimestamp(t,e){const r=t.timezone&&e.createString(t.timezone)||void 0;return Qt.startTimestamp(e),Qt.addUnit(e,t.unit),r!==void 0&&Qt.addTimezone(e,r),Qt.endTimestamp(e)}visitInterval(t,e){return me.startInterval(e),me.addUnit(e,t.unit),me.endInterval(e)}visitDuration(t,e){return _r.startDuration(e),_r.addUnit(e,t.unit),_r.endDuration(e)}visitList(t,e){return io.startList(e),io.endList(e)}visitStruct(t,e){return Ke.startStruct_(e),Ke.endStruct_(e)}visitUnion(t,e){jt.startTypeIdsVector(e,t.typeIds.length);const r=jt.createTypeIdsVector(e,t.typeIds);return jt.startUnion(e),jt.addMode(e,t.mode),jt.addTypeIds(e,r),jt.endUnion(e)}visitDictionary(t,e){const r=this.visit(t.indices,e);return ke.startDictionaryEncoding(e),ke.addId(e,BigInt(t.id)),ke.addIsOrdered(e,t.isOrdered),r!==void 0&&ke.addIndexType(e,r),ke.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return vr.startFixedSizeBinary(e),vr.addByteWidth(e,t.byteWidth),vr.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return Sr.startFixedSizeList(e),Sr.addListSize(e,t.listSize),Sr.endFixedSizeList(e)}visitMap(t,e){return Ir.startMap(e),Ir.addKeysSorted(e,t.keysSorted),Ir.endMap(e)}}const Si=new Qh;function td(n,t=new Map){return new dt(nd(n,t),Mr(n.metadata),t)}function Rc(n){return new ce(n.count,Cc(n.columns),Pc(n.columns))}function ed(n){return new Ne(Rc(n.data),n.id,n.isDelta)}function nd(n,t){return(n.fields||[]).filter(Boolean).map(e=>_t.fromJSON(e,t))}function mo(n,t){return(n.children||[]).filter(Boolean).map(e=>_t.fromJSON(e,t))}function Cc(n){return(n||[]).reduce((t,e)=>[...t,new xn(e.count,rd(e.VALIDITY)),...Cc(e.children)],[])}function Pc(n,t=[]){for(let e=-1,r=(n||[]).length;++e<r;){const i=n[e];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)),t=Pc(i.children,t)}return t}function rd(n){return(n||[]).reduce((t,e)=>t+ +(e===0),0)}function id(n,t){let e,r,i,s,o,a;return!t||!(s=n.dictionary)?(o=wo(n,mo(n,t)),i=new _t(n.name,o,n.nullable,Mr(n.metadata))):t.has(e=s.id)?(r=(r=s.indexType)?bo(r):new Qn,a=new kn(t.get(e),r,e,s.isOrdered),i=new _t(n.name,a,n.nullable,Mr(n.metadata))):(r=(r=s.indexType)?bo(r):new Qn,t.set(e,o=wo(n,mo(n,t))),a=new kn(o,r,e,s.isOrdered),i=new _t(n.name,a,n.nullable,Mr(n.metadata))),i||null}function Mr(n=[]){return new Map(n.map(({key:t,value:e})=>[t,e]))}function bo(n){return new tn(n.isSigned,n.bitWidth)}function wo(n,t){const e=n.type.name;switch(e){case"NONE":return new ze;case"null":return new ze;case"binary":return new Er;case"largebinary":return new Lr;case"utf8":return new xr;case"largeutf8":return new Ur;case"bool":return new Rr;case"list":return new Wr((t||[])[0]);case"struct":return new Ct(t||[]);case"struct_":return new Ct(t||[])}switch(e){case"int":{const r=n.type;return new tn(r.isSigned,r.bitWidth)}case"floatingpoint":{const r=n.type;return new Nr(xt[r.precision])}case"decimal":{const r=n.type;return new Cr(r.scale,r.precision,r.bitWidth)}case"date":{const r=n.type;return new Pr(ee[r.unit])}case"time":{const r=n.type;return new $r(q[r.unit],r.bitWidth)}case"timestamp":{const r=n.type;return new zr(q[r.unit],r.timezone)}case"interval":{const r=n.type;return new Vr(_e[r.unit])}case"duration":{const r=n.type;return new jr(q[r.unit])}case"union":{const r=n.type,[i,...s]=(r.mode+"").toLowerCase(),o=i.toUpperCase()+s.join("");return new Zr(Wt[o],r.typeIds||[],t||[])}case"fixedsizebinary":{const r=n.type;return new Gr(r.byteWidth)}case"fixedsizelist":{const r=n.type;return new Yr(r.listSize,(t||[])[0])}case"map":{const r=n.type;return new Jr((t||[])[0],r.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var sd=Qo,od=Dn;class oe{static fromJSON(t,e){const r=new oe(0,At.V5,e);return r._createHeader=ad(t,e),r}static decode(t){t=new od(lt(t));const e=xe.getRootAsMessage(t),r=e.bodyLength(),i=e.version(),s=e.headerType(),o=new oe(r,i,s);return o._createHeader=cd(e,s),o}static encode(t){const e=new sd;let r=-1;return t.isSchema()?r=dt.encode(e,t.header()):t.isRecordBatch()?r=ce.encode(e,t.header()):t.isDictionaryBatch()&&(r=Ne.encode(e,t.header())),xe.startMessage(e),xe.addVersion(e,At.V5),xe.addHeader(e,r),xe.addHeaderType(e,t.headerType),xe.addBodyLength(e,BigInt(t.bodyLength)),xe.finishMessageBuffer(e,xe.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof dt)return new oe(0,At.V5,ht.Schema,t);if(t instanceof ce)return new oe(e,At.V5,ht.RecordBatch,t);if(t instanceof Ne)return new oe(e,At.V5,ht.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 bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===ht.Schema}isRecordBatch(){return this.headerType===ht.RecordBatch}isDictionaryBatch(){return this.headerType===ht.DictionaryBatch}constructor(t,e,r,i){this._version=e,this._headerType=r,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=wt(t)}}class ce{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,e,r){this._nodes=e,this._buffers=r,this._length=wt(t)}}class Ne{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,e,r=!1){this._data=t,this._isDelta=r,this._id=wt(e)}}class Fe{constructor(t,e){this.offset=wt(t),this.length=wt(e)}}class xn{constructor(t,e){this.length=wt(t),this.nullCount=wt(e)}}function ad(n,t){return()=>{switch(t){case ht.Schema:return dt.fromJSON(n);case ht.RecordBatch:return ce.fromJSON(n);case ht.DictionaryBatch:return Ne.fromJSON(n)}throw new Error(`Unrecognized Message type: { name: ${ht[t]}, type: ${t} }`)}}function cd(n,t){return()=>{switch(t){case ht.Schema:return dt.decode(n.header(new fe),new Map,n.version());case ht.RecordBatch:return ce.decode(n.header(new Me),n.version());case ht.DictionaryBatch:return Ne.decode(n.header(new cn),n.version())}throw new Error(`Unrecognized Message type: { name: ${ht[t]}, type: ${t} }`)}}_t.encode=wd;_t.decode=md;_t.fromJSON=id;dt.encode=bd;dt.decode=ud;dt.fromJSON=td;ce.encode=_d;ce.decode=ld;ce.fromJSON=Rc;Ne.encode=vd;Ne.decode=hd;Ne.fromJSON=ed;xn.encode=Sd;xn.decode=fd;Fe.encode=Id;Fe.decode=dd;function ud(n,t=new Map,e=At.V5){const r=gd(n,t);return new dt(r,Ar(n),t,e)}function ld(n,t=At.V5){if(n.compression()!==null)throw new Error("Record batch compression not implemented");return new ce(n.length(),pd(n),yd(n,t))}function hd(n,t=At.V5){return new Ne(ce.decode(n.data(),t),n.id(),n.isDelta())}function dd(n){return new Fe(n.offset(),n.length())}function fd(n){return new xn(n.length(),n.nullCount())}function pd(n){const t=[];for(let e,r=-1,i=-1,s=n.nodesLength();++r<s;)(e=n.nodes(r))&&(t[++i]=xn.decode(e));return t}function yd(n,t){const e=[];for(let r,i=-1,s=-1,o=n.buffersLength();++i<o;)(r=n.buffers(i))&&(t<At.V4&&(r.bb_pos+=8*(i+1)),e[++s]=Fe.decode(r));return e}function gd(n,t){const e=[];for(let r,i=-1,s=-1,o=n.fieldsLength();++i<o;)(r=n.fields(i))&&(e[++s]=_t.decode(r,t));return e}function _o(n,t){const e=[];for(let r,i=-1,s=-1,o=n.childrenLength();++i<o;)(r=n.children(i))&&(e[++s]=_t.decode(r,t));return e}function md(n,t){let e,r,i,s,o,a;return!t||!(a=n.dictionary())?(i=So(n,_o(n,t)),r=new _t(n.name(),i,n.nullable(),Ar(n))):t.has(e=wt(a.id()))?(s=(s=a.indexType())?vo(s):new Qn,o=new kn(t.get(e),s,e,a.isOrdered()),r=new _t(n.name(),o,n.nullable(),Ar(n))):(s=(s=a.indexType())?vo(s):new Qn,t.set(e,i=So(n,_o(n,t))),o=new kn(i,s,e,a.isOrdered()),r=new _t(n.name(),o,n.nullable(),Ar(n))),r||null}function Ar(n){const t=new Map;if(n)for(let e,r,i=-1,s=Math.trunc(n.customMetadataLength());++i<s;)(e=n.customMetadata(i))&&(r=e.key())!=null&&t.set(r,e.value());return t}function vo(n){return new tn(n.isSigned(),n.bitWidth())}function So(n,t){const e=n.typeType();switch(e){case bt.NONE:return new ze;case bt.Null:return new ze;case bt.Binary:return new Er;case bt.LargeBinary:return new Lr;case bt.Utf8:return new xr;case bt.LargeUtf8:return new Ur;case bt.Bool:return new Rr;case bt.List:return new Wr((t||[])[0]);case bt.Struct_:return new Ct(t||[])}switch(e){case bt.Int:{const r=n.type(new Ht);return new tn(r.isSigned(),r.bitWidth())}case bt.FloatingPoint:{const r=n.type(new ge);return new Nr(r.precision())}case bt.Decimal:{const r=n.type(new ln);return new Cr(r.scale(),r.precision(),r.bitWidth())}case bt.Date:{const r=n.type(new wr);return new Pr(r.unit())}case bt.Time:{const r=n.type(new Xt);return new $r(r.unit(),r.bitWidth())}case bt.Timestamp:{const r=n.type(new Qt);return new zr(r.unit(),r.timezone())}case bt.Interval:{const r=n.type(new me);return new Vr(r.unit())}case bt.Duration:{const r=n.type(new _r);return new jr(r.unit())}case bt.Union:{const r=n.type(new jt);return new Zr(r.mode(),r.typeIdsArray()||[],t||[])}case bt.FixedSizeBinary:{const r=n.type(new vr);return new Gr(r.byteWidth())}case bt.FixedSizeList:{const r=n.type(new Sr);return new Yr(r.listSize(),(t||[])[0])}case bt.Map:{const r=n.type(new Ir);return new Jr((t||[])[0],r.keysSorted())}}throw new Error(`Unrecognized type: "${bt[e]}" (${e})`)}function bd(n,t){const e=t.fields.map(s=>_t.encode(n,s));fe.startFieldsVector(n,e.length);const r=fe.createFieldsVector(n,e),i=t.metadata&&t.metadata.size>0?fe.createCustomMetadataVector(n,[...t.metadata].map(([s,o])=>{const a=n.createString(`${s}`),c=n.createString(`${o}`);return kt.startKeyValue(n),kt.addKey(n,a),kt.addValue(n,c),kt.endKeyValue(n)})):-1;return fe.startSchema(n),fe.addFields(n,r),fe.addEndianness(n,Bd?On.Little:On.Big),i!==-1&&fe.addCustomMetadata(n,i),fe.endSchema(n)}function wd(n,t){let e=-1,r=-1,i=-1;const s=t.type;let o=t.typeId;G.isDictionary(s)?(o=s.dictionary.typeId,i=Si.visit(s,n),r=Si.visit(s.dictionary,n)):r=Si.visit(s,n);const a=(s.children||[]).map(f=>_t.encode(n,f)),c=Kt.createChildrenVector(n,a),u=t.metadata&&t.metadata.size>0?Kt.createCustomMetadataVector(n,[...t.metadata].map(([f,S])=>{const k=n.createString(`${f}`),I=n.createString(`${S}`);return kt.startKeyValue(n),kt.addKey(n,k),kt.addValue(n,I),kt.endKeyValue(n)})):-1;return t.name&&(e=n.createString(t.name)),Kt.startField(n),Kt.addType(n,r),Kt.addTypeType(n,o),Kt.addChildren(n,c),Kt.addNullable(n,!!t.nullable),e!==-1&&Kt.addName(n,e),i!==-1&&Kt.addDictionary(n,i),u!==-1&&Kt.addCustomMetadata(n,u),Kt.endField(n)}function _d(n,t){const e=t.nodes||[],r=t.buffers||[];Me.startNodesVector(n,e.length);for(const o of e.slice().reverse())xn.encode(n,o);const i=n.endVector();Me.startBuffersVector(n,r.length);for(const o of r.slice().reverse())Fe.encode(n,o);const s=n.endVector();return Me.startRecordBatch(n),Me.addLength(n,BigInt(t.length)),Me.addNodes(n,i),Me.addBuffers(n,s),Me.endRecordBatch(n)}function vd(n,t){const e=ce.encode(n,t.data);return cn.startDictionaryBatch(n),cn.addId(n,BigInt(t.id)),cn.addIsDelta(n,t.isDelta),cn.addData(n,e),cn.endDictionaryBatch(n)}function Sd(n,t){return na.createFieldNode(n,BigInt(t.length),BigInt(t.nullCount))}function Id(n,t){return ea.createBuffer(n,BigInt(t.offset),BigInt(t.length))}const Bd=(()=>{const n=new ArrayBuffer(2);return new DataView(n).setInt16(0,256,!0),new Int16Array(n)[0]===256})(),Ss=n=>`Expected ${ht[n]} Message in stream, but was null or length 0.`,Is=n=>`Header pointer of flatbuffer-encoded ${ht[n]} Message is null or length 0.`,$c=(n,t)=>`Expected to read ${n} metadata bytes, but only read ${t}.`,zc=(n,t)=>`Expected to read ${n} bytes for message body, but only read ${t}.`;class Vc{constructor(t){this.source=t instanceof Xr?t:new Xr(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done||t.value===-1&&(t=this.readMetadataLength()).done||(t=this.readMetadata(t.value)).done?It:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(Ss(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);const e=lt(this.source.read(t));if(e.byteLength<t)throw new Error(zc(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){const e=ht.Schema,r=this.readMessage(e),i=r==null?void 0:r.header();if(t&&!i)throw new Error(Is(e));return i}readMetadataLength(){const t=this.source.read(fi),e=t&&new Dn(t),r=(e==null?void 0:e.readInt32(0))||0;return{done:r===0,value:r}}readMetadata(t){const e=this.source.read(t);if(!e)return It;if(e.byteLength<t)throw new Error($c(t,e.byteLength));return{done:!1,value:oe.decode(e)}}}class Md{constructor(t,e){this.source=t instanceof Tn?t:Yo(t)?new Qr(t,e):new Tn(t)}[Symbol.asyncIterator](){return this}next(){return rt(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done||t.value===-1&&(t=yield this.readMetadataLength()).done||(t=yield this.readMetadata(t.value)).done?It:t})}throw(t){return rt(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return rt(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return rt(this,void 0,void 0,function*(){let e;if((e=yield this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(Ss(t));return e.value})}readMessageBody(t){return rt(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);const e=lt(yield this.source.read(t));if(e.byteLength<t)throw new Error(zc(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(){return rt(this,arguments,void 0,function*(t=!1){const e=ht.Schema,r=yield this.readMessage(e),i=r==null?void 0:r.header();if(t&&!i)throw new Error(Is(e));return i})}readMetadataLength(){return rt(this,void 0,void 0,function*(){const t=yield this.source.read(fi),e=t&&new Dn(t),r=(e==null?void 0:e.readInt32(0))||0;return{done:r===0,value:r}})}readMetadata(t){return rt(this,void 0,void 0,function*(){const e=yield this.source.read(t);if(!e)return It;if(e.byteLength<t)throw new Error($c(t,e.byteLength));return{done:!1,value:oe.decode(e)}})}}class Ad extends Vc{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof po?t:new po(t)}next(){const{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:oe.fromJSON(t.schema,ht.Schema)};if(this._dictionaryIndex<t.dictionaries.length){const e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:oe.fromJSON(e,ht.DictionaryBatch)}}if(this._batchIndex<t.batches.length){const e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:oe.fromJSON(e,ht.RecordBatch)}}return this._body=[],It}readMessageBody(t){return e(this._body);function e(r){return(r||[]).reduce((i,s)=>[...i,...s.VALIDITY&&[s.VALIDITY]||[],...s.TYPE_ID&&[s.TYPE_ID]||[],...s.OFFSET&&[s.OFFSET]||[],...s.DATA&&[s.DATA]||[],...e(s.children)],[])}}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(Ss(t));return e.value}readSchema(){const t=ht.Schema,e=this.readMessage(t),r=e==null?void 0:e.header();if(!e||!r)throw new Error(Is(t));return r}}const fi=4,Ki="ARROW1",ti=new Uint8Array(Ki.length);for(let n=0;n<Ki.length;n+=1)ti[n]=Ki.codePointAt(n);function Bs(n,t=0){for(let e=-1,r=ti.length;++e<r;)if(ti[e]!==n[t+e])return!1;return!0}const hr=ti.length,jc=hr+fi,Dd=hr*2+fi;class Te extends Fc{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){const e=this._impl.open(t);return Hn(e)?e.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 qt.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return qt.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,e){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof Te?t:$i(t)?Td(t):Yo(t)?Ld(t):Hn(t)?rt(this,void 0,void 0,function*(){return yield Te.from(yield t)}):Jo(t)||os(t)||Ko(t)||ss(t)?Ed(new Tn(t)):Nd(new Xr(t))}static readAll(t){return t instanceof Te?t.isSync()?Io(t):Bo(t):$i(t)||ArrayBuffer.isView(t)||li(t)||Go(t)?Io(t):Bo(t)}}class ei extends Te{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return be(this,arguments,function*(){yield it(yield*br(_n(this[Symbol.iterator]())))})}}class ni extends Te{constructor(t){super(t),this._impl=t}readAll(){return rt(this,void 0,void 0,function*(){var t,e,r,i;const s=new Array;try{for(var o=!0,a=_n(this),c;c=yield a.next(),t=c.done,!t;o=!0){i=c.value,o=!1;const u=i;s.push(u)}}catch(u){e={error:u}}finally{try{!o&&!t&&(r=a.return)&&(yield r.call(a))}finally{if(e)throw e.error}}return s})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class Wc extends ei{constructor(t){super(t),this._impl=t}}class Od extends ni{constructor(t){super(t),this._impl=t}}class Zc{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,e){const r=this._loadVectors(t,e,this.schema.fields),i=st({type:new Ct(this.schema.fields),length:t.length,children:r});return new se(this.schema,i)}_loadDictionaryBatch(t,e){const{id:r,isDelta:i}=t,{dictionaries:s,schema:o}=this,a=s.get(r),c=o.dictionaries.get(r),u=this._loadVectors(t.data,e,[c]);return(a&&i?a.concat(new mt(u)):new mt(u)).memoize()}_loadVectors(t,e,r){return new Nc(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}}class ri extends Zc{constructor(t,e){super(e),this._reader=$i(t)?new Ad(this._handle=t):new Vc(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=Yc(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):It}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):It}next(){if(this.closed)return It;let t;const{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;const r=t.header(),i=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(r,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const r=t.header(),i=e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(r,i);this.dictionaries.set(r.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Uc(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}}class ii extends Zc{constructor(t,e){super(e),this._reader=new Md(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return rt(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 rt(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Yc(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return rt(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):It})}return(t){return rt(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):It})}next(){return rt(this,void 0,void 0,function*(){if(this.closed)return It;let t;const{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;const r=t.header(),i=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(r,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const r=t.header(),i=yield e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(r,i);this.dictionaries.set(r.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Uc(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return rt(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}}class Gc extends ri{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,e){super(t instanceof yo?t:new yo(t),e)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const e of this._footer.dictionaryBatches())e&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var e;if(this.closed)return null;this._footer||this.open();const r=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(r&&this._handle.seek(r.offset)){const i=this._reader.readMessage(ht.RecordBatch);if(i!=null&&i.isRecordBatch()){const s=i.header(),o=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null}_readDictionaryBatch(t){var e;const r=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(r&&this._handle.seek(r.offset)){const i=this._reader.readMessage(ht.DictionaryBatch);if(i!=null&&i.isDictionaryBatch()){const s=i.header(),o=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}}_readFooter(){const{_handle:t}=this,e=t.size-jc,r=t.readInt32(e),i=t.readAt(e-r,r);return ms.decode(i)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){const r=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(this._recordBatchIndex);if(r&&this._handle.seek(r.offset))return this._reader.readMessage(t)}return null}}class kd extends ii{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,...e){const r=typeof e[0]!="number"?e.shift():void 0,i=e[0]instanceof Map?e.shift():void 0;super(t instanceof Qr?t:new Qr(t,r),i)}isFile(){return!0}isAsync(){return!0}open(t){const e=Object.create(null,{open:{get:()=>super.open}});return rt(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(const r of this._footer.dictionaryBatches())r&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)})}readRecordBatch(t){return rt(this,void 0,void 0,function*(){var e;if(this.closed)return null;this._footer||(yield this.open());const r=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(r&&(yield this._handle.seek(r.offset))){const i=yield this._reader.readMessage(ht.RecordBatch);if(i!=null&&i.isRecordBatch()){const s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null})}_readDictionaryBatch(t){return rt(this,void 0,void 0,function*(){var e;const r=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(r&&(yield this._handle.seek(r.offset))){const i=yield this._reader.readMessage(ht.DictionaryBatch);if(i!=null&&i.isDictionaryBatch()){const s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}})}_readFooter(){return rt(this,void 0,void 0,function*(){const{_handle:t}=this;t._pending&&(yield t._pending);const e=t.size-jc,r=yield t.readInt32(e),i=yield t.readAt(e-r,r);return ms.decode(i)})}_readNextMessageAndValidate(t){return rt(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){const e=this._footer.getRecordBatch(this._recordBatchIndex);if(e&&(yield this._handle.seek(e.offset)))return yield this._reader.readMessage(t)}return null})}}class Fd extends ri{constructor(t,e){super(t,e)}_loadVectors(t,e,r){return new Vh(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}}function Yc(n,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:n.autoDestroy}function*Io(n){const t=Te.from(n);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function Bo(n){return be(this,arguments,function*(){const e=yield it(Te.from(n));try{if(!(yield it(e.open({autoDestroy:!1}))).closed)do yield yield it(e);while(!(yield it(e.reset().open())).closed)}finally{yield it(e.cancel())}})}function Td(n){return new ei(new Fd(n))}function Nd(n){const t=n.peek(hr+7&-8);return t&&t.byteLength>=4?Bs(t)?new Wc(new Gc(n.read())):new ei(new ri(n)):new ei(new ri(function*(){}()))}function Ed(n){return rt(this,void 0,void 0,function*(){const t=yield n.peek(hr+7&-8);return t&&t.byteLength>=4?Bs(t)?new Wc(new Gc(yield n.read())):new ni(new ii(n)):new ni(new ii(function(){return be(this,arguments,function*(){})}()))})}function Ld(n){return rt(this,void 0,void 0,function*(){const{size:t}=yield n.stat(),e=new Qr(n,t);return t>=Dd&&Bs(yield e.readAt(0,hr+7&-8))?new Od(new kd(e)):new ni(new ii(e))})}function Jc(n){const t=Te.from(n);return Hn(t)?t.then(e=>Jc(e)):t.isAsync()?t.readAll().then(e=>new te(e)):new te(t.readAll())}var Hc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ms(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function xd(n){if(n.__esModule)return n;var t=n.default;if(typeof t=="function"){var e=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),e}var ve={},Se={wkt:{Point:"POINT",LineString:"LINESTRING",Polygon:"POLYGON",MultiPoint:"MULTIPOINT",MultiLineString:"MULTILINESTRING",MultiPolygon:"MULTIPOLYGON",GeometryCollection:"GEOMETRYCOLLECTION"},wkb:{Point:1,LineString:2,Polygon:3,MultiPoint:4,MultiLineString:5,MultiPolygon:6,GeometryCollection:7},geoJSON:{Point:"Point",LineString:"LineString",Polygon:"Polygon",MultiPoint:"MultiPoint",MultiLineString:"MultiLineString",MultiPolygon:"MultiPolygon",GeometryCollection:"GeometryCollection"}};const Ud={},Rd=Object.freeze(Object.defineProperty({__proto__:null,default:Ud},Symbol.toStringTag,{value:"Module"})),rn=xd(Rd);var Ze=Nt;function Nt(n,t){this.buffer=new Buffer(n),this.position=0,this.allowResize=t}function Gt(n,t){return function(e,r){this.ensureSize(t),n.call(this.buffer,e,this.position,r),this.position+=t}}Nt.prototype.writeUInt8=Gt(Buffer.prototype.writeUInt8,1);Nt.prototype.writeUInt16LE=Gt(Buffer.prototype.writeUInt16LE,2);Nt.prototype.writeUInt16BE=Gt(Buffer.prototype.writeUInt16BE,2);Nt.prototype.writeUInt32LE=Gt(Buffer.prototype.writeUInt32LE,4);Nt.prototype.writeUInt32BE=Gt(Buffer.prototype.writeUInt32BE,4);Nt.prototype.writeInt8=Gt(Buffer.prototype.writeInt8,1);Nt.prototype.writeInt16LE=Gt(Buffer.prototype.writeInt16LE,2);Nt.prototype.writeInt16BE=Gt(Buffer.prototype.writeInt16BE,2);Nt.prototype.writeInt32LE=Gt(Buffer.prototype.writeInt32LE,4);Nt.prototype.writeInt32BE=Gt(Buffer.prototype.writeInt32BE,4);Nt.prototype.writeFloatLE=Gt(Buffer.prototype.writeFloatLE,4);Nt.prototype.writeFloatBE=Gt(Buffer.prototype.writeFloatBE,4);Nt.prototype.writeDoubleLE=Gt(Buffer.prototype.writeDoubleLE,8);Nt.prototype.writeDoubleBE=Gt(Buffer.prototype.writeDoubleBE,8);Nt.prototype.writeBuffer=function(n){this.ensureSize(n.length),n.copy(this.buffer,this.position,0,n.length),this.position+=n.length};Nt.prototype.writeVarInt=function(n){for(var t=1;n&4294967168;)this.writeUInt8(n&127|128),n>>>=7,t++;return this.writeUInt8(n&127),t};Nt.prototype.ensureSize=function(n){if(this.buffer.length<this.position+n)if(this.allowResize){var t=new Buffer(this.position+n);this.buffer.copy(t,0,0,this.buffer.length),this.buffer=t}else throw new RangeError("index out of range")};var Kc={encode:function(n){return n<<1^n>>31},decode:function(n){return n>>1^-(n&1)}},Ii,Mo;function Ge(){if(Mo)return Ii;Mo=1,Ii=s;var n=rn,t=Je(),e=Se,r=Ze,i=Kc;function s(o,a,c,u,f){t.call(this),this.x=o,this.y=a,this.z=c,this.m=u,this.srid=f,this.hasZ=typeof this.z<"u",this.hasM=typeof this.m<"u"}return n.inherits(s,t),s.Z=function(o,a,c,u){var f=new s(o,a,c,void 0,u);return f.hasZ=!0,f},s.M=function(o,a,c,u){var f=new s(o,a,void 0,c,u);return f.hasM=!0,f},s.ZM=function(o,a,c,u,f){var S=new s(o,a,c,u,f);return S.hasZ=!0,S.hasM=!0,S},s._parseWkt=function(o,a){var c=new s;if(c.srid=a.srid,c.hasZ=a.hasZ,c.hasM=a.hasM,o.isMatch(["EMPTY"]))return c;o.expectGroupStart();var u=o.matchCoordinate(a);return c.x=u.x,c.y=u.y,c.z=u.z,c.m=u.m,o.expectGroupEnd(),c},s._parseWkb=function(o,a){var c=s._readWkbPoint(o,a);return c.srid=a.srid,c},s._readWkbPoint=function(o,a){return new s(o.readDouble(),o.readDouble(),a.hasZ?o.readDouble():void 0,a.hasM?o.readDouble():void 0)},s._parseTwkb=function(o,a){var c=new s;return c.hasZ=a.hasZ,c.hasM=a.hasM,a.isEmpty||(c.x=i.decode(o.readVarInt())/a.precisionFactor,c.y=i.decode(o.readVarInt())/a.precisionFactor,c.z=a.hasZ?i.decode(o.readVarInt())/a.zPrecisionFactor:void 0,c.m=a.hasM?i.decode(o.readVarInt())/a.mPrecisionFactor:void 0),c},s._readTwkbPoint=function(o,a,c){return c.x+=i.decode(o.readVarInt())/a.precisionFactor,c.y+=i.decode(o.readVarInt())/a.precisionFactor,a.hasZ&&(c.z+=i.decode(o.readVarInt())/a.zPrecisionFactor),a.hasM&&(c.m+=i.decode(o.readVarInt())/a.mPrecisionFactor),new s(c.x,c.y,c.z,c.m)},s._parseGeoJSON=function(o){return s._readGeoJSONPoint(o.coordinates)},s._readGeoJSONPoint=function(o){return o.length===0?new s:o.length>2?new s(o[0],o[1],o[2]):new s(o[0],o[1])},s.prototype.toWkt=function(){return typeof this.x>"u"&&typeof this.y>"u"&&typeof this.z>"u"&&typeof this.m>"u"?this._getWktType(e.wkt.Point,!0):this._getWktType(e.wkt.Point,!1)+"("+this._getWktCoordinate(this)+")"},s.prototype.toWkb=function(o){var a=new r(this._getWkbSize());return a.writeInt8(1),this._writeWkbType(a,e.wkb.Point,o),typeof this.x>"u"&&typeof this.y>"u"?(a.writeDoubleLE(NaN),a.writeDoubleLE(NaN),this.hasZ&&a.writeDoubleLE(NaN),this.hasM&&a.writeDoubleLE(NaN)):this._writeWkbPoint(a),a.buffer},s.prototype._writeWkbPoint=function(o){o.writeDoubleLE(this.x),o.writeDoubleLE(this.y),this.hasZ&&o.writeDoubleLE(this.z),this.hasM&&o.writeDoubleLE(this.m)},s.prototype.toTwkb=function(){var o=new r(0,!0),a=t.getTwkbPrecision(5,0,0),c=typeof this.x>"u"&&typeof this.y>"u";return this._writeTwkbHeader(o,e.wkb.Point,a,c),c||this._writeTwkbPoint(o,a,new s(0,0,0,0)),o.buffer},s.prototype._writeTwkbPoint=function(o,a,c){var u=this.x*a.xyFactor,f=this.y*a.xyFactor,S=this.z*a.zFactor,k=this.m*a.mFactor;o.writeVarInt(i.encode(u-c.x)),o.writeVarInt(i.encode(f-c.y)),this.hasZ&&o.writeVarInt(i.encode(S-c.z)),this.hasM&&o.writeVarInt(i.encode(k-c.m)),c.x=u,c.y=f,c.z=S,c.m=k},s.prototype._getWkbSize=function(){var o=21;return this.hasZ&&(o+=8),this.hasM&&(o+=8),o},s.prototype.toGeoJSON=function(o){var a=t.prototype.toGeoJSON.call(this,o);return a.type=e.geoJSON.Point,typeof this.x>"u"&&typeof this.y>"u"?a.coordinates=[]:typeof this.z<"u"?a.coordinates=[this.x,this.y,this.z]:a.coordinates=[this.x,this.y],a},Ii}var Bi,Ao;function As(){if(Ao)return Bi;Ao=1,Bi=s;var n=rn,t=Je(),e=Se,r=Ge(),i=Ze;function s(o,a){t.call(this),this.points=o||[],this.srid=a,this.points.length>0&&(this.hasZ=this.points[0].hasZ,this.hasM=this.points[0].hasM)}return n.inherits(s,t),s.Z=function(o,a){var c=new s(o,a);return c.hasZ=!0,c},s.M=function(o,a){var c=new s(o,a);return c.hasM=!0,c},s.ZM=function(o,a){var c=new s(o,a);return c.hasZ=!0,c.hasM=!0,c},s._parseWkt=function(o,a){var c=new s;return c.srid=a.srid,c.hasZ=a.hasZ,c.hasM=a.hasM,o.isMatch(["EMPTY"])||(o.expectGroupStart(),c.points.push.apply(c.points,o.matchCoordinates(a)),o.expectGroupEnd()),c},s._parseWkb=function(o,a){var c=new s;c.srid=a.srid,c.hasZ=a.hasZ,c.hasM=a.hasM;for(var u=o.readUInt32(),f=0;f<u;f++)c.points.push(r._readWkbPoint(o,a));return c},s._parseTwkb=function(o,a){var c=new s;if(c.hasZ=a.hasZ,c.hasM=a.hasM,a.isEmpty)return c;for(var u=new r(0,0,a.hasZ?0:void 0,a.hasM?0:void 0),f=o.readVarInt(),S=0;S<f;S++)c.points.push(r._readTwkbPoint(o,a,u));return c},s._parseGeoJSON=function(o){var a=new s;o.coordinates.length>0&&(a.hasZ=o.coordinates[0].length>2);for(var c=0;c<o.coordinates.length;c++)a.points.push(r._readGeoJSONPoint(o.coordinates[c]));return a},s.prototype.toWkt=function(){return this.points.length===0?this._getWktType(e.wkt.LineString,!0):this._getWktType(e.wkt.LineString,!1)+this._toInnerWkt()},s.prototype._toInnerWkt=function(){for(var o="(",a=0;a<this.points.length;a++)o+=this._getWktCoordinate(this.points[a])+",";return o=o.slice(0,-1),o+=")",o},s.prototype.toWkb=function(o){var a=new i(this._getWkbSize());a.writeInt8(1),this._writeWkbType(a,e.wkb.LineString,o),a.writeUInt32LE(this.points.length);for(var c=0;c<this.points.length;c++)this.points[c]._writeWkbPoint(a);return a.buffer},s.prototype.toTwkb=function(){var o=new i(0,!0),a=t.getTwkbPrecision(5,0,0),c=this.points.length===0;if(this._writeTwkbHeader(o,e.wkb.LineString,a,c),this.points.length>0){o.writeVarInt(this.points.length);for(var u=new r(0,0,0,0),f=0;f<this.points.length;f++)this.points[f]._writeTwkbPoint(o,a,u)}return o.buffer},s.prototype._getWkbSize=function(){var o=16;return this.hasZ&&(o+=8),this.hasM&&(o+=8),9+this.points.length*o},s.prototype.toGeoJSON=function(o){var a=t.prototype.toGeoJSON.call(this,o);a.type=e.geoJSON.LineString,a.coordinates=[];for(var c=0;c<this.points.length;c++)this.hasZ?a.coordinates.push([this.points[c].x,this.points[c].y,this.points[c].z]):a.coordinates.push([this.points[c].x,this.points[c].y]);return a},Bi}var Mi,Do;function Ds(){if(Do)return Mi;Do=1,Mi=s;var n=rn,t=Je(),e=Se,r=Ge(),i=Ze;function s(o,a,c){t.call(this),this.exteriorRing=o||[],this.interiorRings=a||[],this.srid=c,this.exteriorRing.length>0&&(this.hasZ=this.exteriorRing[0].hasZ,this.hasM=this.exteriorRing[0].hasM)}return n.inherits(s,t),s.Z=function(o,a,c){var u=new s(o,a,c);return u.hasZ=!0,u},s.M=function(o,a,c){var u=new s(o,a,c);return u.hasM=!0,u},s.ZM=function(o,a,c){var u=new s(o,a,c);return u.hasZ=!0,u.hasM=!0,u},s._parseWkt=function(o,a){var c=new s;if(c.srid=a.srid,c.hasZ=a.hasZ,c.hasM=a.hasM,o.isMatch(["EMPTY"]))return c;for(o.expectGroupStart(),o.expectGroupStart(),c.exteriorRing.push.apply(c.exteriorRing,o.matchCoordinates(a)),o.expectGroupEnd();o.isMatch([","]);)o.expectGroupStart(),c.interiorRings.push(o.matchCoordinates(a)),o.expectGroupEnd();return o.expectGroupEnd(),c},s._parseWkb=function(o,a){var c=new s;c.srid=a.srid,c.hasZ=a.hasZ,c.hasM=a.hasM;var u=o.readUInt32();if(u>0){for(var f=o.readUInt32(),S=0;S<f;S++)c.exteriorRing.push(r._readWkbPoint(o,a));for(S=1;S<u;S++){for(var k=[],I=o.readUInt32(),m=0;m<I;m++)k.push(r._readWkbPoint(o,a));c.interiorRings.push(k)}}return c},s._parseTwkb=function(o,a){var c=new s;if(c.hasZ=a.hasZ,c.hasM=a.hasM,a.isEmpty)return c;for(var u=new r(0,0,a.hasZ?0:void 0,a.hasM?0:void 0),f=o.readVarInt(),S=o.readVarInt(),k=0;k<S;k++)c.exteriorRing.push(r._readTwkbPoint(o,a,u));for(k=1;k<f;k++){for(var I=[],m=o.readVarInt(),B=0;B<m;B++)I.push(r._readTwkbPoint(o,a,u));c.interiorRings.push(I)}return c},s._parseGeoJSON=function(o){var a=new s;o.coordinates.length>0&&o.coordinates[0].length>0&&(a.hasZ=o.coordinates[0][0].length>2);for(var c=0;c<o.coordinates.length;c++){c>0&&a.interiorRings.push([]);for(var u=0;u<o.coordinates[c].length;u++)c===0?a.exteriorRing.push(r._readGeoJSONPoint(o.coordinates[c][u])):a.interiorRings[c-1].push(r._readGeoJSONPoint(o.coordinates[c][u]))}return a},s.prototype.toWkt=function(){return this.exteriorRing.length===0?this._getWktType(e.wkt.Polygon,!0):this._getWktType(e.wkt.Polygon,!1)+this._toInnerWkt()},s.prototype._toInnerWkt=function(){for(var o="((",a=0;a<this.exteriorRing.length;a++)o+=this._getWktCoordinate(this.exteriorRing[a])+",";for(o=o.slice(0,-1),o+=")",a=0;a<this.interiorRings.length;a++){o+=",(";for(var c=0;c<this.interiorRings[a].length;c++)o+=this._getWktCoordinate(this.interiorRings[a][c])+",";o=o.slice(0,-1),o+=")"}return o+=")",o},s.prototype.toWkb=function(o){var a=new i(this._getWkbSize());a.writeInt8(1),this._writeWkbType(a,e.wkb.Polygon,o),this.exteriorRing.length>0?(a.writeUInt32LE(1+this.interiorRings.length),a.writeUInt32LE(this.exteriorRing.length)):a.writeUInt32LE(0);for(var c=0;c<this.exteriorRing.length;c++)this.exteriorRing[c]._writeWkbPoint(a);for(c=0;c<this.interiorRings.length;c++){a.writeUInt32LE(this.interiorRings[c].length);for(var u=0;u<this.interiorRings[c].length;u++)this.interiorRings[c][u]._writeWkbPoint(a)}return a.buffer},s.prototype.toTwkb=function(){var o=new i(0,!0),a=t.getTwkbPrecision(5,0,0),c=this.exteriorRing.length===0;if(this._writeTwkbHeader(o,e.wkb.Polygon,a,c),this.exteriorRing.length>0){o.writeVarInt(1+this.interiorRings.length),o.writeVarInt(this.exteriorRing.length);for(var u=new r(0,0,0,0),f=0;f<this.exteriorRing.length;f++)this.exteriorRing[f]._writeTwkbPoint(o,a,u);for(f=0;f<this.interiorRings.length;f++){o.writeVarInt(this.interiorRings[f].length);for(var S=0;S<this.interiorRings[f].length;S++)this.interiorRings[f][S]._writeTwkbPoint(o,a,u)}}return o.buffer},s.prototype._getWkbSize=function(){var o=16;this.hasZ&&(o+=8),this.hasM&&(o+=8);var a=9;this.exteriorRing.length>0&&(a+=4+this.exteriorRing.length*o);for(var c=0;c<this.interiorRings.length;c++)a+=4+this.interiorRings[c].length*o;return a},s.prototype.toGeoJSON=function(o){var a=t.prototype.toGeoJSON.call(this,o);if(a.type=e.geoJSON.Polygon,a.coordinates=[],this.exteriorRing.length>0){for(var c=[],u=0;u<this.exteriorRing.length;u++)this.hasZ?c.push([this.exteriorRing[u].x,this.exteriorRing[u].y,this.exteriorRing[u].z]):c.push([this.exteriorRing[u].x,this.exteriorRing[u].y]);a.coordinates.push(c)}for(var f=0;f<this.interiorRings.length;f++){for(var S=[],k=0;k<this.interiorRings[f].length;k++)this.hasZ?S.push([this.interiorRings[f][k].x,this.interiorRings[f][k].y,this.interiorRings[f][k].z]):S.push([this.interiorRings[f][k].x,this.interiorRings[f][k].y]);a.coordinates.push(S)}return a},Mi}var Ai,Oo;function qc(){if(Oo)return Ai;Oo=1,Ai=s;var n=rn,t=Se,e=Je(),r=Ge(),i=Ze;function s(o,a){e.call(this),this.points=o||[],this.srid=a,this.points.length>0&&(this.hasZ=this.points[0].hasZ,this.hasM=this.points[0].hasM)}return n.inherits(s,e),s.Z=function(o,a){var c=new s(o,a);return c.hasZ=!0,c},s.M=function(o,a){var c=new s(o,a);return c.hasM=!0,c},s.ZM=function(o,a){var c=new s(o,a);return c.hasZ=!0,c.hasM=!0,c},s._parseWkt=function(o,a){var c=new s;return c.srid=a.srid,c.hasZ=a.hasZ,c.hasM=a.hasM,o.isMatch(["EMPTY"])||(o.expectGroupStart(),c.points.push.apply(c.points,o.matchCoordinates(a)),o.expectGroupEnd()),c},s._parseWkb=function(o,a){var c=new s;c.srid=a.srid,c.hasZ=a.hasZ,c.hasM=a.hasM;for(var u=o.readUInt32(),f=0;f<u;f++)c.points.push(e.parse(o,a));return c},s._parseTwkb=function(o,a){var c=new s;if(c.hasZ=a.hasZ,c.hasM=a.hasM,a.isEmpty)return c;for(var u=new r(0,0,a.hasZ?0:void 0,a.hasM?0:void 0),f=o.readVarInt(),S=0;S<f;S++)c.points.push(r._readTwkbPoint(o,a,u));return c},s._parseGeoJSON=function(o){var a=new s;o.coordinates.length>0&&(a.hasZ=o.coordinates[0].length>2);for(var c=0;c<o.coordinates.length;c++)a.points.push(r._parseGeoJSON({coordinates:o.coordinates[c]}));return a},s.prototype.toWkt=function(){if(this.points.length===0)return this._getWktType(t.wkt.MultiPoint,!0);for(var o=this._getWktType(t.wkt.MultiPoint,!1)+"(",a=0;a<this.points.length;a++)o+=this._getWktCoordinate(this.points[a])+",";return o=o.slice(0,-1),o+=")",o},s.prototype.toWkb=function(){var o=new i(this._getWkbSize());o.writeInt8(1),this._writeWkbType(o,t.wkb.MultiPoint),o.writeUInt32LE(this.points.length);for(var a=0;a<this.points.length;a++)o.writeBuffer(this.points[a].toWkb({srid:this.srid}));return o.buffer},s.prototype.toTwkb=function(){var o=new i(0,!0),a=e.getTwkbPrecision(5,0,0),c=this.points.length===0;if(this._writeTwkbHeader(o,t.wkb.MultiPoint,a,c),this.points.length>0){o.writeVarInt(this.points.length);for(var u=new r(0,0,0,0),f=0;f<this.points.length;f++)this.points[f]._writeTwkbPoint(o,a,u)}return o.buffer},s.prototype._getWkbSize=function(){var o=16;return this.hasZ&&(o+=8),this.hasM&&(o+=8),o+=5,9+this.points.length*o},s.prototype.toGeoJSON=function(o){var a=e.prototype.toGeoJSON.call(this,o);a.type=t.geoJSON.MultiPoint,a.coordinates=[];for(var c=0;c<this.points.length;c++)a.coordinates.push(this.points[c].toGeoJSON().coordinates);return a},Ai}var Di,ko;function Xc(){if(ko)return Di;ko=1,Di=o;var n=rn,t=Se,e=Je(),r=Ge(),i=As(),s=Ze;function o(a,c){e.call(this),this.lineStrings=a||[],this.srid=c,this.lineStrings.length>0&&(this.hasZ=this.lineStrings[0].hasZ,this.hasM=this.lineStrings[0].hasM)}return n.inherits(o,e),o.Z=function(a,c){var u=new o(a,c);return u.hasZ=!0,u},o.M=function(a,c){var u=new o(a,c);return u.hasM=!0,u},o.ZM=function(a,c){var u=new o(a,c);return u.hasZ=!0,u.hasM=!0,u},o._parseWkt=function(a,c){var u=new o;if(u.srid=c.srid,u.hasZ=c.hasZ,u.hasM=c.hasM,a.isMatch(["EMPTY"]))return u;a.expectGroupStart();do a.expectGroupStart(),u.lineStrings.push(new i(a.matchCoordinates(c))),a.expectGroupEnd();while(a.isMatch([","]));return a.expectGroupEnd(),u},o._parseWkb=function(a,c){var u=new o;u.srid=c.srid,u.hasZ=c.hasZ,u.hasM=c.hasM;for(var f=a.readUInt32(),S=0;S<f;S++)u.lineStrings.push(e.parse(a,c));return u},o._parseTwkb=function(a,c){var u=new o;if(u.hasZ=c.hasZ,u.hasM=c.hasM,c.isEmpty)return u;for(var f=new r(0,0,c.hasZ?0:void 0,c.hasM?0:void 0),S=a.readVarInt(),k=0;k<S;k++){var I=new i;I.hasZ=c.hasZ,I.hasM=c.hasM;for(var m=a.readVarInt(),B=0;B<m;B++)I.points.push(r._readTwkbPoint(a,c,f));u.lineStrings.push(I)}return u},o._parseGeoJSON=function(a){var c=new o;a.coordinates.length>0&&a.coordinates[0].length>0&&(c.hasZ=a.coordinates[0][0].length>2);for(var u=0;u<a.coordinates.length;u++)c.lineStrings.push(i._parseGeoJSON({coordinates:a.coordinates[u]}));return c},o.prototype.toWkt=function(){if(this.lineStrings.length===0)return this._getWktType(t.wkt.MultiLineString,!0);for(var a=this._getWktType(t.wkt.MultiLineString,!1)+"(",c=0;c<this.lineStrings.length;c++)a+=this.lineStrings[c]._toInnerWkt()+",";return a=a.slice(0,-1),a+=")",a},o.prototype.toWkb=function(){var a=new s(this._getWkbSize());a.writeInt8(1),this._writeWkbType(a,t.wkb.MultiLineString),a.writeUInt32LE(this.lineStrings.length);for(var c=0;c<this.lineStrings.length;c++)a.writeBuffer(this.lineStrings[c].toWkb({srid:this.srid}));return a.buffer},o.prototype.toTwkb=function(){var a=new s(0,!0),c=e.getTwkbPrecision(5,0,0),u=this.lineStrings.length===0;if(this._writeTwkbHeader(a,t.wkb.MultiLineString,c,u),this.lineStrings.length>0){a.writeVarInt(this.lineStrings.length);for(var f=new r(0,0,0,0),S=0;S<this.lineStrings.length;S++){a.writeVarInt(this.lineStrings[S].points.length);for(var k=0;k<this.lineStrings[S].points.length;k++)this.lineStrings[S].points[k]._writeTwkbPoint(a,c,f)}}return a.buffer},o.prototype._getWkbSize=function(){for(var a=9,c=0;c<this.lineStrings.length;c++)a+=this.lineStrings[c]._getWkbSize();return a},o.prototype.toGeoJSON=function(a){var c=e.prototype.toGeoJSON.call(this,a);c.type=t.geoJSON.MultiLineString,c.coordinates=[];for(var u=0;u<this.lineStrings.length;u++)c.coordinates.push(this.lineStrings[u].toGeoJSON().coordinates);return c},Di}var Oi,Fo;function Qc(){if(Fo)return Oi;Fo=1,Oi=o;var n=rn,t=Se,e=Je(),r=Ge(),i=Ds(),s=Ze;function o(a,c){e.call(this),this.polygons=a||[],this.srid=c,this.polygons.length>0&&(this.hasZ=this.polygons[0].hasZ,this.hasM=this.polygons[0].hasM)}return n.inherits(o,e),o.Z=function(a,c){var u=new o(a,c);return u.hasZ=!0,u},o.M=function(a,c){var u=new o(a,c);return u.hasM=!0,u},o.ZM=function(a,c){var u=new o(a,c);return u.hasZ=!0,u.hasM=!0,u},o._parseWkt=function(a,c){var u=new o;if(u.srid=c.srid,u.hasZ=c.hasZ,u.hasM=c.hasM,a.isMatch(["EMPTY"]))return u;a.expectGroupStart();do{a.expectGroupStart();var f=[],S=[];for(a.expectGroupStart(),f.push.apply(f,a.matchCoordinates(c)),a.expectGroupEnd();a.isMatch([","]);)a.expectGroupStart(),S.push(a.matchCoordinates(c)),a.expectGroupEnd();u.polygons.push(new i(f,S)),a.expectGroupEnd()}while(a.isMatch([","]));return a.expectGroupEnd(),u},o._parseWkb=function(a,c){var u=new o;u.srid=c.srid,u.hasZ=c.hasZ,u.hasM=c.hasM;for(var f=a.readUInt32(),S=0;S<f;S++)u.polygons.push(e.parse(a,c));return u},o._parseTwkb=function(a,c){var u=new o;if(u.hasZ=c.hasZ,u.hasM=c.hasM,c.isEmpty)return u;for(var f=new r(0,0,c.hasZ?0:void 0,c.hasM?0:void 0),S=a.readVarInt(),k=0;k<S;k++){var I=new i;I.hasZ=c.hasZ,I.hasM=c.hasM;for(var m=a.readVarInt(),B=a.readVarInt(),_=0;_<B;_++)I.exteriorRing.push(r._readTwkbPoint(a,c,f));for(_=1;_<m;_++){for(var D=[],F=a.readVarInt(),T=0;T<F;T++)D.push(r._readTwkbPoint(a,c,f));I.interiorRings.push(D)}u.polygons.push(I)}return u},o._parseGeoJSON=function(a){var c=new o;a.coordinates.length>0&&a.coordinates[0].length>0&&a.coordinates[0][0].length>0&&(c.hasZ=a.coordinates[0][0][0].length>2);for(var u=0;u<a.coordinates.length;u++)c.polygons.push(i._parseGeoJSON({coordinates:a.coordinates[u]}));return c},o.prototype.toWkt=function(){if(this.polygons.length===0)return this._getWktType(t.wkt.MultiPolygon,!0);for(var a=this._getWktType(t.wkt.MultiPolygon,!1)+"(",c=0;c<this.polygons.length;c++)a+=this.polygons[c]._toInnerWkt()+",";return a=a.slice(0,-1),a+=")",a},o.prototype.toWkb=function(){var a=new s(this._getWkbSize());a.writeInt8(1),this._writeWkbType(a,t.wkb.MultiPolygon),a.writeUInt32LE(this.polygons.length);for(var c=0;c<this.polygons.length;c++)a.writeBuffer(this.polygons[c].toWkb({srid:this.srid}));return a.buffer},o.prototype.toTwkb=function(){var a=new s(0,!0),c=e.getTwkbPrecision(5,0,0),u=this.polygons.length===0;if(this._writeTwkbHeader(a,t.wkb.MultiPolygon,c,u),this.polygons.length>0){a.writeVarInt(this.polygons.length);for(var f=new r(0,0,0,0),S=0;S<this.polygons.length;S++){a.writeVarInt(1+this.polygons[S].interiorRings.length),a.writeVarInt(this.polygons[S].exteriorRing.length);for(var k=0;k<this.polygons[S].exteriorRing.length;k++)this.polygons[S].exteriorRing[k]._writeTwkbPoint(a,c,f);for(k=0;k<this.polygons[S].interiorRings.length;k++){a.writeVarInt(this.polygons[S].interiorRings[k].length);for(var I=0;I<this.polygons[S].interiorRings[k].length;I++)this.polygons[S].interiorRings[k][I]._writeTwkbPoint(a,c,f)}}}return a.buffer},o.prototype._getWkbSize=function(){for(var a=9,c=0;c<this.polygons.length;c++)a+=this.polygons[c]._getWkbSize();return a},o.prototype.toGeoJSON=function(a){var c=e.prototype.toGeoJSON.call(this,a);c.type=t.geoJSON.MultiPolygon,c.coordinates=[];for(var u=0;u<this.polygons.length;u++)c.coordinates.push(this.polygons[u].toGeoJSON().coordinates);return c},Oi}var ki,To;function tu(){if(To)return ki;To=1,ki=i;var n=rn,t=Se,e=Je(),r=Ze;function i(s,o){e.call(this),this.geometries=s||[],this.srid=o,this.geometries.length>0&&(this.hasZ=this.geometries[0].hasZ,this.hasM=this.geometries[0].hasM)}return n.inherits(i,e),i.Z=function(s,o){var a=new i(s,o);return a.hasZ=!0,a},i.M=function(s,o){var a=new i(s,o);return a.hasM=!0,a},i.ZM=function(s,o){var a=new i(s,o);return a.hasZ=!0,a.hasM=!0,a},i._parseWkt=function(s,o){var a=new i;if(a.srid=o.srid,a.hasZ=o.hasZ,a.hasM=o.hasM,s.isMatch(["EMPTY"]))return a;s.expectGroupStart();do a.geometries.push(e.parse(s));while(s.isMatch([","]));return s.expectGroupEnd(),a},i._parseWkb=function(s,o){var a=new i;a.srid=o.srid,a.hasZ=o.hasZ,a.hasM=o.hasM;for(var c=s.readUInt32(),u=0;u<c;u++)a.geometries.push(e.parse(s,o));return a},i._parseTwkb=function(s,o){var a=new i;if(a.hasZ=o.hasZ,a.hasM=o.hasM,o.isEmpty)return a;for(var c=s.readVarInt(),u=0;u<c;u++)a.geometries.push(e.parseTwkb(s));return a},i._parseGeoJSON=function(s){for(var o=new i,a=0;a<s.geometries.length;a++)o.geometries.push(e._parseGeoJSON(s.geometries[a],!0));return o.geometries.length>0&&(o.hasZ=o.geometries[0].hasZ),o},i.prototype.toWkt=function(){if(this.geometries.length===0)return this._getWktType(t.wkt.GeometryCollection,!0);for(var s=this._getWktType(t.wkt.GeometryCollection,!1)+"(",o=0;o<this.geometries.length;o++)s+=this.geometries[o].toWkt()+",";return s=s.slice(0,-1),s+=")",s},i.prototype.toWkb=function(){var s=new r(this._getWkbSize());s.writeInt8(1),this._writeWkbType(s,t.wkb.GeometryCollection),s.writeUInt32LE(this.geometries.length);for(var o=0;o<this.geometries.length;o++)s.writeBuffer(this.geometries[o].toWkb({srid:this.srid}));return s.buffer},i.prototype.toTwkb=function(){var s=new r(0,!0),o=e.getTwkbPrecision(5,0,0),a=this.geometries.length===0;if(this._writeTwkbHeader(s,t.wkb.GeometryCollection,o,a),this.geometries.length>0){s.writeVarInt(this.geometries.length);for(var c=0;c<this.geometries.length;c++)s.writeBuffer(this.geometries[c].toTwkb())}return s.buffer},i.prototype._getWkbSize=function(){for(var s=9,o=0;o<this.geometries.length;o++)s+=this.geometries[o]._getWkbSize();return s},i.prototype.toGeoJSON=function(s){var o=e.prototype.toGeoJSON.call(this,s);o.type=t.geoJSON.GeometryCollection,o.geometries=[];for(var a=0;a<this.geometries.length;a++)o.geometries.push(this.geometries[a].toGeoJSON());return o},ki}var Cd=Ie;function Ie(n,t){this.buffer=n,this.position=0,this.isBigEndian=t||!1}function Ye(n,t,e){return function(){var r;return this.isBigEndian?r=t.call(this.buffer,this.position):r=n.call(this.buffer,this.position),this.position+=e,r}}Ie.prototype.readUInt8=Ye(Buffer.prototype.readUInt8,Buffer.prototype.readUInt8,1);Ie.prototype.readUInt16=Ye(Buffer.prototype.readUInt16LE,Buffer.prototype.readUInt16BE,2);Ie.prototype.readUInt32=Ye(Buffer.prototype.readUInt32LE,Buffer.prototype.readUInt32BE,4);Ie.prototype.readInt8=Ye(Buffer.prototype.readInt8,Buffer.prototype.readInt8,1);Ie.prototype.readInt16=Ye(Buffer.prototype.readInt16LE,Buffer.prototype.readInt16BE,2);Ie.prototype.readInt32=Ye(Buffer.prototype.readInt32LE,Buffer.prototype.readInt32BE,4);Ie.prototype.readFloat=Ye(Buffer.prototype.readFloatLE,Buffer.prototype.readFloatBE,4);Ie.prototype.readDouble=Ye(Buffer.prototype.readDoubleLE,Buffer.prototype.readDoubleBE,8);Ie.prototype.readVarInt=function(){var n,t=0,e=0;do n=this.buffer[this.position+e],t+=(n&127)<<7*e,e++;while(n>=128);return this.position+=e,t};var Fi,No;function Pd(){if(No)return Fi;No=1,Fi=e;var n=Se,t=Ge();function e(r){this.value=r,this.position=0}return e.prototype.match=function(r){this.skipWhitespaces();for(var i=0;i<r.length;i++)if(this.value.substring(this.position).indexOf(r[i])===0)return this.position+=r[i].length,r[i];return null},e.prototype.matchRegex=function(r){this.skipWhitespaces();for(var i=0;i<r.length;i++){var s=this.value.substring(this.position).match(r[i]);if(s)return this.position+=s[0].length,s}return null},e.prototype.isMatch=function(r){this.skipWhitespaces();for(var i=0;i<r.length;i++)if(this.value.substring(this.position).indexOf(r[i])===0)return this.position+=r[i].length,!0;return!1},e.prototype.matchType=function(){var r=this.match([n.wkt.Point,n.wkt.LineString,n.wkt.Polygon,n.wkt.MultiPoint,n.wkt.MultiLineString,n.wkt.MultiPolygon,n.wkt.GeometryCollection]);if(!r)throw new Error("Expected geometry type");return r},e.prototype.matchDimension=function(){var r=this.match(["ZM","Z","M"]);switch(r){case"ZM":return{hasZ:!0,hasM:!0};case"Z":return{hasZ:!0,hasM:!1};case"M":return{hasZ:!1,hasM:!0};default:return{hasZ:!1,hasM:!1}}},e.prototype.expectGroupStart=function(){if(!this.isMatch(["("]))throw new Error("Expected group start")},e.prototype.expectGroupEnd=function(){if(!this.isMatch([")"]))throw new Error("Expected group end")},e.prototype.matchCoordinate=function(r){var i;if(r.hasZ&&r.hasM?i=this.matchRegex([/^(\S*)\s+(\S*)\s+(\S*)\s+([^\s,)]*)/]):r.hasZ||r.hasM?i=this.matchRegex([/^(\S*)\s+(\S*)\s+([^\s,)]*)/]):i=this.matchRegex([/^(\S*)\s+([^\s,)]*)/]),!i)throw new Error("Expected coordinates");return r.hasZ&&r.hasM?new t(parseFloat(i[1]),parseFloat(i[2]),parseFloat(i[3]),parseFloat(i[4])):r.hasZ?new t(parseFloat(i[1]),parseFloat(i[2]),parseFloat(i[3])):r.hasM?new t(parseFloat(i[1]),parseFloat(i[2]),void 0,parseFloat(i[3])):new t(parseFloat(i[1]),parseFloat(i[2]))},e.prototype.matchCoordinates=function(r){var i=[];do{var s=this.isMatch(["("]);i.push(this.matchCoordinate(r)),s&&this.expectGroupEnd()}while(this.isMatch([","]));return i},e.prototype.skipWhitespaces=function(){for(;this.position<this.value.length&&this.value[this.position]===" ";)this.position++},Fi}var Ti,Eo;function Je(){if(Eo)return Ti;Eo=1,Ti=k;var n=Se,t=Ge(),e=As(),r=Ds(),i=qc(),s=Xc(),o=Qc(),a=tu(),c=Cd,u=Ze,f=Pd(),S=Kc;function k(){this.srid=void 0,this.hasZ=!1,this.hasM=!1}return k.parse=function(I,m){var B=typeof I;if(B==="string"||I instanceof f)return k._parseWkt(I);if(Buffer.isBuffer(I)||I instanceof c)return k._parseWkb(I,m);throw new Error("first argument must be a string or Buffer")},k._parseWkt=function(I){var m,B;I instanceof f?m=I:m=new f(I);var _=m.matchRegex([/^SRID=(\d+);/]);_&&(B=parseInt(_[1],10));var D=m.matchType(),F=m.matchDimension(),T={srid:B,hasZ:F.hasZ,hasM:F.hasM};switch(D){case n.wkt.Point:return t._parseWkt(m,T);case n.wkt.LineString:return e._parseWkt(m,T);case n.wkt.Polygon:return r._parseWkt(m,T);case n.wkt.MultiPoint:return i._parseWkt(m,T);case n.wkt.MultiLineString:return s._parseWkt(m,T);case n.wkt.MultiPolygon:return o._parseWkt(m,T);case n.wkt.GeometryCollection:return a._parseWkt(m,T)}},k._parseWkb=function(I,m){var B,_,D,F={};switch(I instanceof c?B=I:B=new c(I),B.isBigEndian=!B.readInt8(),_=B.readUInt32(),F.hasSrid=(_&536870912)===536870912,F.isEwkb=_&536870912||_&1073741824||_&2147483648,F.hasSrid&&(F.srid=B.readUInt32()),F.hasZ=!1,F.hasM=!1,!F.isEwkb&&(!m||!m.isEwkb)?_>=1e3&&_<2e3?(F.hasZ=!0,D=_-1e3):_>=2e3&&_<3e3?(F.hasM=!0,D=_-2e3):_>=3e3&&_<4e3?(F.hasZ=!0,F.hasM=!0,D=_-3e3):D=_:(_&2147483648&&(F.hasZ=!0),_&1073741824&&(F.hasM=!0),D=_&15),D){case n.wkb.Point:return t._parseWkb(B,F);case n.wkb.LineString:return e._parseWkb(B,F);case n.wkb.Polygon:return r._parseWkb(B,F);case n.wkb.MultiPoint:return i._parseWkb(B,F);case n.wkb.MultiLineString:return s._parseWkb(B,F);case n.wkb.MultiPolygon:return o._parseWkb(B,F);case n.wkb.GeometryCollection:return a._parseWkb(B,F);default:throw new Error("GeometryType "+D+" not supported")}},k.parseTwkb=function(I){var m,B={};I instanceof c?m=I:m=new c(I);var _=m.readUInt8(),D=m.readUInt8(),F=_&15;if(B.precision=S.decode(_>>4),B.precisionFactor=Math.pow(10,B.precision),B.hasBoundingBox=D>>0&1,B.hasSizeAttribute=D>>1&1,B.hasIdList=D>>2&1,B.hasExtendedPrecision=D>>3&1,B.isEmpty=D>>4&1,B.hasExtendedPrecision){var T=m.readUInt8();B.hasZ=(T&1)===1,B.hasM=(T&2)===2,B.zPrecision=S.decode((T&28)>>2),B.zPrecisionFactor=Math.pow(10,B.zPrecision),B.mPrecision=S.decode((T&224)>>5),B.mPrecisionFactor=Math.pow(10,B.mPrecision)}else B.hasZ=!1,B.hasM=!1;if(B.hasSizeAttribute&&m.readVarInt(),B.hasBoundingBox){var U=2;B.hasZ&&U++,B.hasM&&U++;for(var j=0;j<U;j++)m.readVarInt(),m.readVarInt()}switch(F){case n.wkb.Point:return t._parseTwkb(m,B);case n.wkb.LineString:return e._parseTwkb(m,B);case n.wkb.Polygon:return r._parseTwkb(m,B);case n.wkb.MultiPoint:return i._parseTwkb(m,B);case n.wkb.MultiLineString:return s._parseTwkb(m,B);case n.wkb.MultiPolygon:return o._parseTwkb(m,B);case n.wkb.GeometryCollection:return a._parseTwkb(m,B);default:throw new Error("GeometryType "+F+" not supported")}},k.parseGeoJSON=function(I){return k._parseGeoJSON(I)},k._parseGeoJSON=function(I,m){var B;switch(I.type){case n.geoJSON.Point:B=t._parseGeoJSON(I);break;case n.geoJSON.LineString:B=e._parseGeoJSON(I);break;case n.geoJSON.Polygon:B=r._parseGeoJSON(I);break;case n.geoJSON.MultiPoint:B=i._parseGeoJSON(I);break;case n.geoJSON.MultiLineString:B=s._parseGeoJSON(I);break;case n.geoJSON.MultiPolygon:B=o._parseGeoJSON(I);break;case n.geoJSON.GeometryCollection:B=a._parseGeoJSON(I);break;default:throw new Error("GeometryType "+I.type+" not supported")}if(I.crs&&I.crs.type&&I.crs.type==="name"&&I.crs.properties&&I.crs.properties.name){var _=I.crs.properties.name;if(_.indexOf("EPSG:")===0)B.srid=parseInt(_.substring(5));else if(_.indexOf("urn:ogc:def:crs:EPSG::")===0)B.srid=parseInt(_.substring(22));else throw new Error("Unsupported crs: "+_)}else m||(B.srid=4326);return B},k.prototype.toEwkt=function(){return"SRID="+this.srid+";"+this.toWkt()},k.prototype.toEwkb=function(){var I=new u(this._getWkbSize()+4),m=this.toWkb();return I.writeInt8(1),I.writeUInt32LE((m.slice(1,5).readUInt32LE(0)|536870912)>>>0,!0),I.writeUInt32LE(this.srid),I.writeBuffer(m.slice(5)),I.buffer},k.prototype._getWktType=function(I,m){var B=I;return this.hasZ&&this.hasM?B+=" ZM ":this.hasZ?B+=" Z ":this.hasM&&(B+=" M "),m&&!this.hasZ&&!this.hasM&&(B+=" "),m&&(B+="EMPTY"),B},k.prototype._getWktCoordinate=function(I){var m=I.x+" "+I.y;return this.hasZ&&(m+=" "+I.z),this.hasM&&(m+=" "+I.m),m},k.prototype._writeWkbType=function(I,m,B){var _=0;typeof this.srid>"u"&&(!B||typeof B.srid>"u")?this.hasZ&&this.hasM?_+=3e3:this.hasZ?_+=1e3:this.hasM&&(_+=2e3):(this.hasZ&&(_|=2147483648),this.hasM&&(_|=1073741824)),I.writeUInt32LE(_+m>>>0,!0)},k.getTwkbPrecision=function(I,m,B){return{xy:I,z:m,m:B,xyFactor:Math.pow(10,I),zFactor:Math.pow(10,m),mFactor:Math.pow(10,B)}},k.prototype._writeTwkbHeader=function(I,m,B,_){var D=(S.encode(B.xy)<<4)+m,F=(this.hasZ||this.hasM)<<3;if(F+=_<<4,I.writeUInt8(D),I.writeUInt8(F),this.hasZ||this.hasM){var T=0;this.hasZ&&(T|=1),this.hasM&&(T|=2),I.writeUInt8(T)}},k.prototype.toGeoJSON=function(I){var m={};return this.srid&&I&&(I.shortCrs?m.crs={type:"name",properties:{name:"EPSG:"+this.srid}}:I.longCrs&&(m.crs={type:"name",properties:{name:"urn:ogc:def:crs:EPSG::"+this.srid}})),m},Ti}ve.Types=Se;ve.Geometry=Je();ve.Point=Ge();ve.LineString=As();ve.Polygon=Ds();ve.MultiPoint=qc();ve.MultiLineString=Xc();ve.MultiPolygon=Qc();ve.GeometryCollection=tu();function pi(n){return new Promise((t,e)=>{n.oncomplete=n.onsuccess=()=>t(n.result),n.onabort=n.onerror=()=>e(n.error)})}function eu(n,t){const e=indexedDB.open(n);e.onupgradeneeded=()=>e.result.createObjectStore(t);const r=pi(e);return(i,s)=>r.then(o=>s(o.transaction(t,i).objectStore(t)))}let Ni;function Os(){return Ni||(Ni=eu("keyval-store","keyval")),Ni}function $d(n,t=Os()){return t("readonly",e=>pi(e.get(n)))}function Lo(n,t,e=Os()){return e("readwrite",r=>(r.put(t,n),pi(r.transaction)))}function Ei(n,t=Os()){return t("readwrite",e=>(e.delete(n),pi(e.transaction)))}function gr(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var nu={exports:{}};(function(n,t){(function(e){n.exports=e()})(function(){return function e(r,i,s){function o(u,f){if(!i[u]){if(!r[u]){var S=typeof gr=="function"&&gr;if(!f&&S)return S(u,!0);if(a)return a(u,!0);throw new Error("Cannot find module '"+u+"'")}f=i[u]={exports:{}},r[u][0].call(f.exports,function(k){var I=r[u][1][k];return o(I||k)},f,f.exports,e,r,i,s)}return i[u].exports}for(var a=typeof gr=="function"&&gr,c=0;c<s.length;c++)o(s[c]);return o}({1:[function(e,r,i){(function(s,o,a,c,u,f,S,k,I){var m=e("crypto");function B(w,M){M=F(w,M);var h;return(h=M.algorithm!=="passthrough"?m.createHash(M.algorithm):new j).write===void 0&&(h.write=h.update,h.end=h.update),U(M,h).dispatch(w),h.update||h.end(""),h.digest?h.digest(M.encoding==="buffer"?void 0:M.encoding):(w=h.read(),M.encoding!=="buffer"?w.toString(M.encoding):w)}(i=r.exports=B).sha1=function(w){return B(w)},i.keys=function(w){return B(w,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})},i.MD5=function(w){return B(w,{algorithm:"md5",encoding:"hex"})},i.keysMD5=function(w){return B(w,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var _=m.getHashes?m.getHashes().slice():["sha1","md5"],D=(_.push("passthrough"),["buffer","hex","binary","base64"]);function F(w,M){var h={};if(h.algorithm=(M=M||{}).algorithm||"sha1",h.encoding=M.encoding||"hex",h.excludeValues=!!M.excludeValues,h.algorithm=h.algorithm.toLowerCase(),h.encoding=h.encoding.toLowerCase(),h.ignoreUnknown=M.ignoreUnknown===!0,h.respectType=M.respectType!==!1,h.respectFunctionNames=M.respectFunctionNames!==!1,h.respectFunctionProperties=M.respectFunctionProperties!==!1,h.unorderedArrays=M.unorderedArrays===!0,h.unorderedSets=M.unorderedSets!==!1,h.unorderedObjects=M.unorderedObjects!==!1,h.replacer=M.replacer||void 0,h.excludeKeys=M.excludeKeys||void 0,w===void 0)throw new Error("Object argument required.");for(var y=0;y<_.length;++y)_[y].toLowerCase()===h.algorithm.toLowerCase()&&(h.algorithm=_[y]);if(_.indexOf(h.algorithm)===-1)throw new Error('Algorithm "'+h.algorithm+'" not supported. supported values: '+_.join(", "));if(D.indexOf(h.encoding)===-1&&h.algorithm!=="passthrough")throw new Error('Encoding "'+h.encoding+'" not supported. supported values: '+D.join(", "));return h}function T(w){if(typeof w=="function")return/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(w))!=null}function U(w,M,h){h=h||[];function y(d){return M.update?M.update(d,"utf8"):M.write(d,"utf8")}return{dispatch:function(d){return this["_"+((d=w.replacer?w.replacer(d):d)===null?"null":typeof d)](d)},_object:function(d){var g,A=Object.prototype.toString.call(d),Z=/\[object (.*)\]/i.exec(A);if(Z=(Z=Z?Z[1]:"unknown:["+A+"]").toLowerCase(),0<=(A=h.indexOf(d)))return this.dispatch("[CIRCULAR:"+A+"]");if(h.push(d),a!==void 0&&a.isBuffer&&a.isBuffer(d))return y("buffer:"),y(d);if(Z==="object"||Z==="function"||Z==="asyncfunction")return A=Object.keys(d),w.unorderedObjects&&(A=A.sort()),w.respectType===!1||T(d)||A.splice(0,0,"prototype","__proto__","constructor"),w.excludeKeys&&(A=A.filter(function(E){return!w.excludeKeys(E)})),y("object:"+A.length+":"),g=this,A.forEach(function(E){g.dispatch(E),y(":"),w.excludeValues||g.dispatch(d[E]),y(",")});if(!this["_"+Z]){if(w.ignoreUnknown)return y("["+Z+"]");throw new Error('Unknown object type "'+Z+'"')}this["_"+Z](d)},_array:function(d,E){E=E!==void 0?E:w.unorderedArrays!==!1;var A=this;if(y("array:"+d.length+":"),!E||d.length<=1)return d.forEach(function(N){return A.dispatch(N)});var Z=[],E=d.map(function(N){var O=new j,C=h.slice();return U(w,O,C).dispatch(N),Z=Z.concat(C.slice(h.length)),O.read().toString()});return h=h.concat(Z),E.sort(),this._array(E,!1)},_date:function(d){return y("date:"+d.toJSON())},_symbol:function(d){return y("symbol:"+d.toString())},_error:function(d){return y("error:"+d.toString())},_boolean:function(d){return y("bool:"+d.toString())},_string:function(d){y("string:"+d.length+":"),y(d.toString())},_function:function(d){y("fn:"),T(d)?this.dispatch("[native]"):this.dispatch(d.toString()),w.respectFunctionNames!==!1&&this.dispatch("function-name:"+String(d.name)),w.respectFunctionProperties&&this._object(d)},_number:function(d){return y("number:"+d.toString())},_xml:function(d){return y("xml:"+d.toString())},_null:function(){return y("Null")},_undefined:function(){return y("Undefined")},_regexp:function(d){return y("regex:"+d.toString())},_uint8array:function(d){return y("uint8array:"),this.dispatch(Array.prototype.slice.call(d))},_uint8clampedarray:function(d){return y("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(d))},_int8array:function(d){return y("int8array:"),this.dispatch(Array.prototype.slice.call(d))},_uint16array:function(d){return y("uint16array:"),this.dispatch(Array.prototype.slice.call(d))},_int16array:function(d){return y("int16array:"),this.dispatch(Array.prototype.slice.call(d))},_uint32array:function(d){return y("uint32array:"),this.dispatch(Array.prototype.slice.call(d))},_int32array:function(d){return y("int32array:"),this.dispatch(Array.prototype.slice.call(d))},_float32array:function(d){return y("float32array:"),this.dispatch(Array.prototype.slice.call(d))},_float64array:function(d){return y("float64array:"),this.dispatch(Array.prototype.slice.call(d))},_arraybuffer:function(d){return y("arraybuffer:"),this.dispatch(new Uint8Array(d))},_url:function(d){return y("url:"+d.toString())},_map:function(d){return y("map:"),d=Array.from(d),this._array(d,w.unorderedSets!==!1)},_set:function(d){return y("set:"),d=Array.from(d),this._array(d,w.unorderedSets!==!1)},_file:function(d){return y("file:"),this.dispatch([d.name,d.size,d.type,d.lastModfied])},_blob:function(){if(w.ignoreUnknown)return y("[blob]");throw Error(`Hashing Blob objects is currently not supported
5
- (see https://github.com/puleos/object-hash/issues/26)
6
- Use "options.replacer" or "options.ignoreUnknown"
7
- `)},_domwindow:function(){return y("domwindow")},_bigint:function(d){return y("bigint:"+d.toString())},_process:function(){return y("process")},_timer:function(){return y("timer")},_pipe:function(){return y("pipe")},_tcp:function(){return y("tcp")},_udp:function(){return y("udp")},_tty:function(){return y("tty")},_statwatcher:function(){return y("statwatcher")},_securecontext:function(){return y("securecontext")},_connection:function(){return y("connection")},_zlib:function(){return y("zlib")},_context:function(){return y("context")},_nodescript:function(){return y("nodescript")},_httpparser:function(){return y("httpparser")},_dataview:function(){return y("dataview")},_signal:function(){return y("signal")},_fsevent:function(){return y("fsevent")},_tlswrap:function(){return y("tlswrap")}}}function j(){return{buf:"",write:function(w){this.buf+=w},end:function(w){this.buf+=w},read:function(){return this.buf}}}i.writeToStream=function(w,M,h){return h===void 0&&(h=M,M={}),U(M=F(w,M),h).dispatch(w)}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/fake_9a5aa49d.js","/")},{buffer:3,crypto:5,lYpoI2:11}],2:[function(e,r,i){(function(s,o,a,c,u,f,S,k,I){(function(m){var B=typeof Uint8Array<"u"?Uint8Array:Array,_=43,D=47,F=48,T=97,U=65,j=45,w=95;function M(h){return h=h.charCodeAt(0),h===_||h===j?62:h===D||h===w?63:h<F?-1:h<F+10?h-F+26+26:h<U+26?h-U:h<T+26?h-T+26:void 0}m.toByteArray=function(h){var y,d;if(0<h.length%4)throw new Error("Invalid string. Length must be a multiple of 4");var g=h.length,g=h.charAt(g-2)==="="?2:h.charAt(g-1)==="="?1:0,A=new B(3*h.length/4-g),Z=0<g?h.length-4:h.length,E=0;function N(O){A[E++]=O}for(y=0;y<Z;y+=4,0)N((16711680&(d=M(h.charAt(y))<<18|M(h.charAt(y+1))<<12|M(h.charAt(y+2))<<6|M(h.charAt(y+3))))>>16),N((65280&d)>>8),N(255&d);return g==2?N(255&(d=M(h.charAt(y))<<2|M(h.charAt(y+1))>>4)):g==1&&(N((d=M(h.charAt(y))<<10|M(h.charAt(y+1))<<4|M(h.charAt(y+2))>>2)>>8&255),N(255&d)),A},m.fromByteArray=function(h){var y,d,g,A,Z=h.length%3,E="";function N(O){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(O)}for(y=0,g=h.length-Z;y<g;y+=3)d=(h[y]<<16)+(h[y+1]<<8)+h[y+2],E+=N((A=d)>>18&63)+N(A>>12&63)+N(A>>6&63)+N(63&A);switch(Z){case 1:E=(E+=N((d=h[h.length-1])>>2))+N(d<<4&63)+"==";break;case 2:E=(E=(E+=N((d=(h[h.length-2]<<8)+h[h.length-1])>>10))+N(d>>4&63))+N(d<<2&63)+"="}return E}})(i===void 0?this.base64js={}:i)}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:11}],3:[function(e,r,i){(function(s,o,_,c,u,f,S,k,I){var m=e("base64-js"),B=e("ieee754");function _(l,p,v){if(!(this instanceof _))return new _(l,p,v);var L,x,$,ut,Bt=typeof l;if(p==="base64"&&Bt=="string")for(l=(ut=l).trim?ut.trim():ut.replace(/^\s+|\s+$/g,"");l.length%4!=0;)l+="=";if(Bt=="number")L=R(l);else if(Bt=="string")L=_.byteLength(l,p);else{if(Bt!="object")throw new Error("First argument needs to be a number, array or string.");L=R(l.length)}if(_._useTypedArrays?x=_._augment(new Uint8Array(L)):((x=this).length=L,x._isBuffer=!0),_._useTypedArrays&&typeof l.byteLength=="number")x._set(l);else if(V(ut=l)||_.isBuffer(ut)||ut&&typeof ut=="object"&&typeof ut.length=="number")for($=0;$<L;$++)_.isBuffer(l)?x[$]=l.readUInt8($):x[$]=l[$];else if(Bt=="string")x.write(l,0,p);else if(Bt=="number"&&!_._useTypedArrays&&!v)for($=0;$<L;$++)x[$]=0;return x}function D(l,p,v,L){return _._charsWritten=St(function(x){for(var $=[],ut=0;ut<x.length;ut++)$.push(255&x.charCodeAt(ut));return $}(p),l,v,L)}function F(l,p,v,L){return _._charsWritten=St(function(x){for(var $,ut,Bt=[],Ft=0;Ft<x.length;Ft++)ut=x.charCodeAt(Ft),$=ut>>8,ut=ut%256,Bt.push(ut),Bt.push($);return Bt}(p),l,v,L)}function T(l,p,v){var L="";v=Math.min(l.length,v);for(var x=p;x<v;x++)L+=String.fromCharCode(l[x]);return L}function U(l,p,v,$){$||(P(typeof v=="boolean","missing or invalid endian"),P(p!=null,"missing offset"),P(p+1<l.length,"Trying to read beyond buffer length"));var x,$=l.length;if(!($<=p))return v?(x=l[p],p+1<$&&(x|=l[p+1]<<8)):(x=l[p]<<8,p+1<$&&(x|=l[p+1])),x}function j(l,p,v,$){$||(P(typeof v=="boolean","missing or invalid endian"),P(p!=null,"missing offset"),P(p+3<l.length,"Trying to read beyond buffer length"));var x,$=l.length;if(!($<=p))return v?(p+2<$&&(x=l[p+2]<<16),p+1<$&&(x|=l[p+1]<<8),x|=l[p],p+3<$&&(x+=l[p+3]<<24>>>0)):(p+1<$&&(x=l[p+1]<<16),p+2<$&&(x|=l[p+2]<<8),p+3<$&&(x|=l[p+3]),x+=l[p]<<24>>>0),x}function w(l,p,v,L){if(L||(P(typeof v=="boolean","missing or invalid endian"),P(p!=null,"missing offset"),P(p+1<l.length,"Trying to read beyond buffer length")),!(l.length<=p))return L=U(l,p,v,!0),32768&L?-1*(65535-L+1):L}function M(l,p,v,L){if(L||(P(typeof v=="boolean","missing or invalid endian"),P(p!=null,"missing offset"),P(p+3<l.length,"Trying to read beyond buffer length")),!(l.length<=p))return L=j(l,p,v,!0),2147483648&L?-1*(4294967295-L+1):L}function h(l,p,v,L){return L||(P(typeof v=="boolean","missing or invalid endian"),P(p+3<l.length,"Trying to read beyond buffer length")),B.read(l,p,v,23,4)}function y(l,p,v,L){return L||(P(typeof v=="boolean","missing or invalid endian"),P(p+7<l.length,"Trying to read beyond buffer length")),B.read(l,p,v,52,8)}function d(l,p,v,L,x){if(x||(P(p!=null,"missing value"),P(typeof L=="boolean","missing or invalid endian"),P(v!=null,"missing offset"),P(v+1<l.length,"trying to write beyond buffer length"),Et(p,65535)),x=l.length,!(x<=v))for(var $=0,ut=Math.min(x-v,2);$<ut;$++)l[v+$]=(p&255<<8*(L?$:1-$))>>>8*(L?$:1-$)}function g(l,p,v,L,x){if(x||(P(p!=null,"missing value"),P(typeof L=="boolean","missing or invalid endian"),P(v!=null,"missing offset"),P(v+3<l.length,"trying to write beyond buffer length"),Et(p,4294967295)),x=l.length,!(x<=v))for(var $=0,ut=Math.min(x-v,4);$<ut;$++)l[v+$]=p>>>8*(L?$:3-$)&255}function A(l,p,v,L,x){x||(P(p!=null,"missing value"),P(typeof L=="boolean","missing or invalid endian"),P(v!=null,"missing offset"),P(v+1<l.length,"Trying to write beyond buffer length"),le(p,32767,-32768)),l.length<=v||d(l,0<=p?p:65535+p+1,v,L,x)}function Z(l,p,v,L,x){x||(P(p!=null,"missing value"),P(typeof L=="boolean","missing or invalid endian"),P(v!=null,"missing offset"),P(v+3<l.length,"Trying to write beyond buffer length"),le(p,2147483647,-2147483648)),l.length<=v||g(l,0<=p?p:4294967295+p+1,v,L,x)}function E(l,p,v,L,x){x||(P(p!=null,"missing value"),P(typeof L=="boolean","missing or invalid endian"),P(v!=null,"missing offset"),P(v+3<l.length,"Trying to write beyond buffer length"),he(p,34028234663852886e22,-34028234663852886e22)),l.length<=v||B.write(l,p,v,L,23,4)}function N(l,p,v,L,x){x||(P(p!=null,"missing value"),P(typeof L=="boolean","missing or invalid endian"),P(v!=null,"missing offset"),P(v+7<l.length,"Trying to write beyond buffer length"),he(p,17976931348623157e292,-17976931348623157e292)),l.length<=v||B.write(l,p,v,L,52,8)}i.Buffer=_,i.SlowBuffer=_,i.INSPECT_MAX_BYTES=50,_.poolSize=8192,_._useTypedArrays=function(){try{var l=new ArrayBuffer(0),p=new Uint8Array(l);return p.foo=function(){return 42},p.foo()===42&&typeof p.subarray=="function"}catch{return!1}}(),_.isEncoding=function(l){switch(String(l).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},_.isBuffer=function(l){return!(l==null||!l._isBuffer)},_.byteLength=function(l,p){var v;switch(l+="",p||"utf8"){case"hex":v=l.length/2;break;case"utf8":case"utf-8":v=ct(l).length;break;case"ascii":case"binary":case"raw":v=l.length;break;case"base64":v=vt(l).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":v=2*l.length;break;default:throw new Error("Unknown encoding")}return v},_.concat=function(l,p){if(P(V(l),`Usage: Buffer.concat(list, [totalLength])
8
- list should be an Array.`),l.length===0)return new _(0);if(l.length===1)return l[0];if(typeof p!="number")for(x=p=0;x<l.length;x++)p+=l[x].length;for(var v=new _(p),L=0,x=0;x<l.length;x++){var $=l[x];$.copy(v,L),L+=$.length}return v},_.prototype.write=function(l,p,v,L){isFinite(p)?isFinite(v)||(L=v,v=void 0):(Ft=L,L=p,p=v,v=Ft),p=Number(p)||0;var x,$,ut,Bt,Ft=this.length-p;switch((!v||Ft<(v=Number(v)))&&(v=Ft),L=String(L||"utf8").toLowerCase()){case"hex":x=function(re,$t,zt,Tt){zt=Number(zt)||0;var Mt=re.length-zt;(!Tt||Mt<(Tt=Number(Tt)))&&(Tt=Mt),P((Mt=$t.length)%2==0,"Invalid hex string"),Mt/2<Tt&&(Tt=Mt/2);for(var on=0;on<Tt;on++){var xs=parseInt($t.substr(2*on,2),16);P(!isNaN(xs),"Invalid hex string"),re[zt+on]=xs}return _._charsWritten=2*on,on}(this,l,p,v);break;case"utf8":case"utf-8":$=this,ut=p,Bt=v,x=_._charsWritten=St(ct(l),$,ut,Bt);break;case"ascii":case"binary":x=D(this,l,p,v);break;case"base64":$=this,ut=p,Bt=v,x=_._charsWritten=St(vt(l),$,ut,Bt);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":x=F(this,l,p,v);break;default:throw new Error("Unknown encoding")}return x},_.prototype.toString=function(l,p,v){var L,x,$,ut,Bt=this;if(l=String(l||"utf8").toLowerCase(),p=Number(p)||0,(v=v!==void 0?Number(v):Bt.length)===p)return"";switch(l){case"hex":L=function(Ft,re,$t){var zt=Ft.length;(!re||re<0)&&(re=0),(!$t||$t<0||zt<$t)&&($t=zt);for(var Tt="",Mt=re;Mt<$t;Mt++)Tt+=z(Ft[Mt]);return Tt}(Bt,p,v);break;case"utf8":case"utf-8":L=function(Ft,re,$t){var zt="",Tt="";$t=Math.min(Ft.length,$t);for(var Mt=re;Mt<$t;Mt++)Ft[Mt]<=127?(zt+=Dt(Tt)+String.fromCharCode(Ft[Mt]),Tt=""):Tt+="%"+Ft[Mt].toString(16);return zt+Dt(Tt)}(Bt,p,v);break;case"ascii":case"binary":L=T(Bt,p,v);break;case"base64":x=Bt,ut=v,L=($=p)===0&&ut===x.length?m.fromByteArray(x):m.fromByteArray(x.slice($,ut));break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":L=function(Ft,re,$t){for(var zt=Ft.slice(re,$t),Tt="",Mt=0;Mt<zt.length;Mt+=2)Tt+=String.fromCharCode(zt[Mt]+256*zt[Mt+1]);return Tt}(Bt,p,v);break;default:throw new Error("Unknown encoding")}return L},_.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},_.prototype.copy=function(l,p,v,L){if(p=p||0,(L=L||L===0?L:this.length)!==(v=v||0)&&l.length!==0&&this.length!==0){P(v<=L,"sourceEnd < sourceStart"),P(0<=p&&p<l.length,"targetStart out of bounds"),P(0<=v&&v<this.length,"sourceStart out of bounds"),P(0<=L&&L<=this.length,"sourceEnd out of bounds"),L>this.length&&(L=this.length);var x=(L=l.length-p<L-v?l.length-p+v:L)-v;if(x<100||!_._useTypedArrays)for(var $=0;$<x;$++)l[$+p]=this[$+v];else l._set(this.subarray(v,v+x),p)}},_.prototype.slice=function(l,p){var v=this.length;if(l=C(l,v,0),p=C(p,v,v),_._useTypedArrays)return _._augment(this.subarray(l,p));for(var L=p-l,x=new _(L,void 0,!0),$=0;$<L;$++)x[$]=this[$+l];return x},_.prototype.get=function(l){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(l)},_.prototype.set=function(l,p){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(l,p)},_.prototype.readUInt8=function(l,p){if(p||(P(l!=null,"missing offset"),P(l<this.length,"Trying to read beyond buffer length")),!(l>=this.length))return this[l]},_.prototype.readUInt16LE=function(l,p){return U(this,l,!0,p)},_.prototype.readUInt16BE=function(l,p){return U(this,l,!1,p)},_.prototype.readUInt32LE=function(l,p){return j(this,l,!0,p)},_.prototype.readUInt32BE=function(l,p){return j(this,l,!1,p)},_.prototype.readInt8=function(l,p){if(p||(P(l!=null,"missing offset"),P(l<this.length,"Trying to read beyond buffer length")),!(l>=this.length))return 128&this[l]?-1*(255-this[l]+1):this[l]},_.prototype.readInt16LE=function(l,p){return w(this,l,!0,p)},_.prototype.readInt16BE=function(l,p){return w(this,l,!1,p)},_.prototype.readInt32LE=function(l,p){return M(this,l,!0,p)},_.prototype.readInt32BE=function(l,p){return M(this,l,!1,p)},_.prototype.readFloatLE=function(l,p){return h(this,l,!0,p)},_.prototype.readFloatBE=function(l,p){return h(this,l,!1,p)},_.prototype.readDoubleLE=function(l,p){return y(this,l,!0,p)},_.prototype.readDoubleBE=function(l,p){return y(this,l,!1,p)},_.prototype.writeUInt8=function(l,p,v){v||(P(l!=null,"missing value"),P(p!=null,"missing offset"),P(p<this.length,"trying to write beyond buffer length"),Et(l,255)),p>=this.length||(this[p]=l)},_.prototype.writeUInt16LE=function(l,p,v){d(this,l,p,!0,v)},_.prototype.writeUInt16BE=function(l,p,v){d(this,l,p,!1,v)},_.prototype.writeUInt32LE=function(l,p,v){g(this,l,p,!0,v)},_.prototype.writeUInt32BE=function(l,p,v){g(this,l,p,!1,v)},_.prototype.writeInt8=function(l,p,v){v||(P(l!=null,"missing value"),P(p!=null,"missing offset"),P(p<this.length,"Trying to write beyond buffer length"),le(l,127,-128)),p>=this.length||(0<=l?this.writeUInt8(l,p,v):this.writeUInt8(255+l+1,p,v))},_.prototype.writeInt16LE=function(l,p,v){A(this,l,p,!0,v)},_.prototype.writeInt16BE=function(l,p,v){A(this,l,p,!1,v)},_.prototype.writeInt32LE=function(l,p,v){Z(this,l,p,!0,v)},_.prototype.writeInt32BE=function(l,p,v){Z(this,l,p,!1,v)},_.prototype.writeFloatLE=function(l,p,v){E(this,l,p,!0,v)},_.prototype.writeFloatBE=function(l,p,v){E(this,l,p,!1,v)},_.prototype.writeDoubleLE=function(l,p,v){N(this,l,p,!0,v)},_.prototype.writeDoubleBE=function(l,p,v){N(this,l,p,!1,v)},_.prototype.fill=function(l,p,v){if(p=p||0,v=v||this.length,P(typeof(l=typeof(l=l||0)=="string"?l.charCodeAt(0):l)=="number"&&!isNaN(l),"value is not a number"),P(p<=v,"end < start"),v!==p&&this.length!==0){P(0<=p&&p<this.length,"start out of bounds"),P(0<=v&&v<=this.length,"end out of bounds");for(var L=p;L<v;L++)this[L]=l}},_.prototype.inspect=function(){for(var l=[],p=this.length,v=0;v<p;v++)if(l[v]=z(this[v]),v===i.INSPECT_MAX_BYTES){l[v+1]="...";break}return"<Buffer "+l.join(" ")+">"},_.prototype.toArrayBuffer=function(){if(typeof Uint8Array>"u")throw new Error("Buffer.toArrayBuffer not supported in this browser");if(_._useTypedArrays)return new _(this).buffer;for(var l=new Uint8Array(this.length),p=0,v=l.length;p<v;p+=1)l[p]=this[p];return l.buffer};var O=_.prototype;function C(l,p,v){return typeof l!="number"?v:p<=(l=~~l)?p:0<=l||0<=(l+=p)?l:0}function R(l){return(l=~~Math.ceil(+l))<0?0:l}function V(l){return(Array.isArray||function(p){return Object.prototype.toString.call(p)==="[object Array]"})(l)}function z(l){return l<16?"0"+l.toString(16):l.toString(16)}function ct(l){for(var p=[],v=0;v<l.length;v++){var L=l.charCodeAt(v);if(L<=127)p.push(l.charCodeAt(v));else for(var x=v,$=(55296<=L&&L<=57343&&v++,encodeURIComponent(l.slice(x,v+1)).substr(1).split("%")),ut=0;ut<$.length;ut++)p.push(parseInt($[ut],16))}return p}function vt(l){return m.toByteArray(l)}function St(l,p,v,L){for(var x=0;x<L&&!(x+v>=p.length||x>=l.length);x++)p[x+v]=l[x];return x}function Dt(l){try{return decodeURIComponent(l)}catch{return"�"}}function Et(l,p){P(typeof l=="number","cannot write a non-number as a number"),P(0<=l,"specified a negative value for writing an unsigned value"),P(l<=p,"value is larger than maximum value for type"),P(Math.floor(l)===l,"value has a fractional component")}function le(l,p,v){P(typeof l=="number","cannot write a non-number as a number"),P(l<=p,"value larger than maximum allowed value"),P(v<=l,"value smaller than minimum allowed value"),P(Math.floor(l)===l,"value has a fractional component")}function he(l,p,v){P(typeof l=="number","cannot write a non-number as a number"),P(l<=p,"value larger than maximum allowed value"),P(v<=l,"value smaller than minimum allowed value")}function P(l,p){if(!l)throw new Error(p||"Failed assertion")}_._augment=function(l){return l._isBuffer=!0,l._get=l.get,l._set=l.set,l.get=O.get,l.set=O.set,l.write=O.write,l.toString=O.toString,l.toLocaleString=O.toString,l.toJSON=O.toJSON,l.copy=O.copy,l.slice=O.slice,l.readUInt8=O.readUInt8,l.readUInt16LE=O.readUInt16LE,l.readUInt16BE=O.readUInt16BE,l.readUInt32LE=O.readUInt32LE,l.readUInt32BE=O.readUInt32BE,l.readInt8=O.readInt8,l.readInt16LE=O.readInt16LE,l.readInt16BE=O.readInt16BE,l.readInt32LE=O.readInt32LE,l.readInt32BE=O.readInt32BE,l.readFloatLE=O.readFloatLE,l.readFloatBE=O.readFloatBE,l.readDoubleLE=O.readDoubleLE,l.readDoubleBE=O.readDoubleBE,l.writeUInt8=O.writeUInt8,l.writeUInt16LE=O.writeUInt16LE,l.writeUInt16BE=O.writeUInt16BE,l.writeUInt32LE=O.writeUInt32LE,l.writeUInt32BE=O.writeUInt32BE,l.writeInt8=O.writeInt8,l.writeInt16LE=O.writeInt16LE,l.writeInt16BE=O.writeInt16BE,l.writeInt32LE=O.writeInt32LE,l.writeInt32BE=O.writeInt32BE,l.writeFloatLE=O.writeFloatLE,l.writeFloatBE=O.writeFloatBE,l.writeDoubleLE=O.writeDoubleLE,l.writeDoubleBE=O.writeDoubleBE,l.fill=O.fill,l.inspect=O.inspect,l.toArrayBuffer=O.toArrayBuffer,l}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:10,lYpoI2:11}],4:[function(e,r,i){(function(s,o,m,c,u,f,S,k,I){var m=e("buffer").Buffer,B=4,_=new m(B);_.fill(0),r.exports={hash:function(D,F,T,U){for(var j=F(function(d,g){d.length%B!=0&&(A=d.length+(B-d.length%B),d=m.concat([d,_],A));for(var A,Z=[],E=g?d.readInt32BE:d.readInt32LE,N=0;N<d.length;N+=B)Z.push(E.call(d,N));return Z}(D=m.isBuffer(D)?D:new m(D),U),8*D.length),F=U,w=new m(T),M=F?w.writeInt32BE:w.writeInt32LE,h=0;h<j.length;h++)M.call(w,j[h],4*h,!0);return w}}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/helpers.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],5:[function(e,r,i){(function(s,o,m,c,u,f,S,k,I){var m=e("buffer").Buffer,B=e("./sha"),_=e("./sha256"),D=e("./rng"),F={sha1:B,sha256:_,md5:e("./md5")},T=64,U=new m(T);function j(d,g){var A=F[d=d||"sha1"],Z=[];return A||w("algorithm:",d,"is not yet supported"),{update:function(E){return m.isBuffer(E)||(E=new m(E)),Z.push(E),E.length,this},digest:function(E){var N=m.concat(Z),N=g?function(O,C,R){m.isBuffer(C)||(C=new m(C)),m.isBuffer(R)||(R=new m(R)),C.length>T?C=O(C):C.length<T&&(C=m.concat([C,U],T));for(var V=new m(T),z=new m(T),ct=0;ct<T;ct++)V[ct]=54^C[ct],z[ct]=92^C[ct];return R=O(m.concat([V,R])),O(m.concat([z,R]))}(A,g,N):A(N);return Z=null,E?N.toString(E):N}}}function w(){var d=[].slice.call(arguments).join(" ");throw new Error([d,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join(`
9
- `))}U.fill(0),i.createHash=function(d){return j(d)},i.createHmac=j,i.randomBytes=function(d,g){if(!g||!g.call)return new m(D(d));try{g.call(this,void 0,new m(D(d)))}catch(A){g(A)}};var M,h=["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],y=function(d){i[d]=function(){w("sorry,",d,"is not implemented yet")}};for(M in h)y(h[M])}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./md5":6,"./rng":7,"./sha":8,"./sha256":9,buffer:3,lYpoI2:11}],6:[function(e,r,i){(function(s,o,a,c,u,f,S,k,I){var m=e("./helpers");function B(w,M){w[M>>5]|=128<<M%32,w[14+(M+64>>>9<<4)]=M;for(var h=1732584193,y=-271733879,d=-1732584194,g=271733878,A=0;A<w.length;A+=16){var Z=h,E=y,N=d,O=g,h=D(h,y,d,g,w[A+0],7,-680876936),g=D(g,h,y,d,w[A+1],12,-389564586),d=D(d,g,h,y,w[A+2],17,606105819),y=D(y,d,g,h,w[A+3],22,-1044525330);h=D(h,y,d,g,w[A+4],7,-176418897),g=D(g,h,y,d,w[A+5],12,1200080426),d=D(d,g,h,y,w[A+6],17,-1473231341),y=D(y,d,g,h,w[A+7],22,-45705983),h=D(h,y,d,g,w[A+8],7,1770035416),g=D(g,h,y,d,w[A+9],12,-1958414417),d=D(d,g,h,y,w[A+10],17,-42063),y=D(y,d,g,h,w[A+11],22,-1990404162),h=D(h,y,d,g,w[A+12],7,1804603682),g=D(g,h,y,d,w[A+13],12,-40341101),d=D(d,g,h,y,w[A+14],17,-1502002290),h=F(h,y=D(y,d,g,h,w[A+15],22,1236535329),d,g,w[A+1],5,-165796510),g=F(g,h,y,d,w[A+6],9,-1069501632),d=F(d,g,h,y,w[A+11],14,643717713),y=F(y,d,g,h,w[A+0],20,-373897302),h=F(h,y,d,g,w[A+5],5,-701558691),g=F(g,h,y,d,w[A+10],9,38016083),d=F(d,g,h,y,w[A+15],14,-660478335),y=F(y,d,g,h,w[A+4],20,-405537848),h=F(h,y,d,g,w[A+9],5,568446438),g=F(g,h,y,d,w[A+14],9,-1019803690),d=F(d,g,h,y,w[A+3],14,-187363961),y=F(y,d,g,h,w[A+8],20,1163531501),h=F(h,y,d,g,w[A+13],5,-1444681467),g=F(g,h,y,d,w[A+2],9,-51403784),d=F(d,g,h,y,w[A+7],14,1735328473),h=T(h,y=F(y,d,g,h,w[A+12],20,-1926607734),d,g,w[A+5],4,-378558),g=T(g,h,y,d,w[A+8],11,-2022574463),d=T(d,g,h,y,w[A+11],16,1839030562),y=T(y,d,g,h,w[A+14],23,-35309556),h=T(h,y,d,g,w[A+1],4,-1530992060),g=T(g,h,y,d,w[A+4],11,1272893353),d=T(d,g,h,y,w[A+7],16,-155497632),y=T(y,d,g,h,w[A+10],23,-1094730640),h=T(h,y,d,g,w[A+13],4,681279174),g=T(g,h,y,d,w[A+0],11,-358537222),d=T(d,g,h,y,w[A+3],16,-722521979),y=T(y,d,g,h,w[A+6],23,76029189),h=T(h,y,d,g,w[A+9],4,-640364487),g=T(g,h,y,d,w[A+12],11,-421815835),d=T(d,g,h,y,w[A+15],16,530742520),h=U(h,y=T(y,d,g,h,w[A+2],23,-995338651),d,g,w[A+0],6,-198630844),g=U(g,h,y,d,w[A+7],10,1126891415),d=U(d,g,h,y,w[A+14],15,-1416354905),y=U(y,d,g,h,w[A+5],21,-57434055),h=U(h,y,d,g,w[A+12],6,1700485571),g=U(g,h,y,d,w[A+3],10,-1894986606),d=U(d,g,h,y,w[A+10],15,-1051523),y=U(y,d,g,h,w[A+1],21,-2054922799),h=U(h,y,d,g,w[A+8],6,1873313359),g=U(g,h,y,d,w[A+15],10,-30611744),d=U(d,g,h,y,w[A+6],15,-1560198380),y=U(y,d,g,h,w[A+13],21,1309151649),h=U(h,y,d,g,w[A+4],6,-145523070),g=U(g,h,y,d,w[A+11],10,-1120210379),d=U(d,g,h,y,w[A+2],15,718787259),y=U(y,d,g,h,w[A+9],21,-343485551),h=j(h,Z),y=j(y,E),d=j(d,N),g=j(g,O)}return Array(h,y,d,g)}function _(w,M,h,y,d,g){return j((M=j(j(M,w),j(y,g)))<<d|M>>>32-d,h)}function D(w,M,h,y,d,g,A){return _(M&h|~M&y,w,M,d,g,A)}function F(w,M,h,y,d,g,A){return _(M&y|h&~y,w,M,d,g,A)}function T(w,M,h,y,d,g,A){return _(M^h^y,w,M,d,g,A)}function U(w,M,h,y,d,g,A){return _(h^(M|~y),w,M,d,g,A)}function j(w,M){var h=(65535&w)+(65535&M);return(w>>16)+(M>>16)+(h>>16)<<16|65535&h}r.exports=function(w){return m.hash(w,B,16)}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],7:[function(e,r,i){(function(s,o,a,c,u,f,S,k,I){r.exports=function(m){for(var B,_=new Array(m),D=0;D<m;D++)!(3&D)&&(B=4294967296*Math.random()),_[D]=B>>>((3&D)<<3)&255;return _}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],8:[function(e,r,i){(function(s,o,a,c,u,f,S,k,I){var m=e("./helpers");function B(F,T){F[T>>5]|=128<<24-T%32,F[15+(T+64>>9<<4)]=T;for(var U,j,w,M=Array(80),h=1732584193,y=-271733879,d=-1732584194,g=271733878,A=-1009589776,Z=0;Z<F.length;Z+=16){for(var E=h,N=y,O=d,C=g,R=A,V=0;V<80;V++){M[V]=V<16?F[Z+V]:D(M[V-3]^M[V-8]^M[V-14]^M[V-16],1);var z=_(_(D(h,5),(z=y,j=d,w=g,(U=V)<20?z&j|~z&w:!(U<40)&&U<60?z&j|z&w|j&w:z^j^w)),_(_(A,M[V]),(U=V)<20?1518500249:U<40?1859775393:U<60?-1894007588:-899497514)),A=g,g=d,d=D(y,30),y=h,h=z}h=_(h,E),y=_(y,N),d=_(d,O),g=_(g,C),A=_(A,R)}return Array(h,y,d,g,A)}function _(F,T){var U=(65535&F)+(65535&T);return(F>>16)+(T>>16)+(U>>16)<<16|65535&U}function D(F,T){return F<<T|F>>>32-T}r.exports=function(F){return m.hash(F,B,20,!0)}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],9:[function(e,r,i){(function(s,o,a,c,u,f,S,k,I){function m(T,U){var j=(65535&T)+(65535&U);return(T>>16)+(U>>16)+(j>>16)<<16|65535&j}function B(T,U){var j,w=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),M=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),h=new Array(64);T[U>>5]|=128<<24-U%32,T[15+(U+64>>9<<4)]=U;for(var y,d,g=0;g<T.length;g+=16){for(var A=M[0],Z=M[1],E=M[2],N=M[3],O=M[4],C=M[5],R=M[6],V=M[7],z=0;z<64;z++)h[z]=z<16?T[z+g]:m(m(m((d=h[z-2],D(d,17)^D(d,19)^F(d,10)),h[z-7]),(d=h[z-15],D(d,7)^D(d,18)^F(d,3))),h[z-16]),j=m(m(m(m(V,D(d=O,6)^D(d,11)^D(d,25)),O&C^~O&R),w[z]),h[z]),y=m(D(y=A,2)^D(y,13)^D(y,22),A&Z^A&E^Z&E),V=R,R=C,C=O,O=m(N,j),N=E,E=Z,Z=A,A=m(j,y);M[0]=m(A,M[0]),M[1]=m(Z,M[1]),M[2]=m(E,M[2]),M[3]=m(N,M[3]),M[4]=m(O,M[4]),M[5]=m(C,M[5]),M[6]=m(R,M[6]),M[7]=m(V,M[7])}return M}var _=e("./helpers"),D=function(T,U){return T>>>U|T<<32-U},F=function(T,U){return T>>>U};r.exports=function(T){return _.hash(T,B,32,!0)}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],10:[function(e,r,i){(function(s,o,a,c,u,f,S,k,I){i.read=function(m,B,_,D,g){var T,U,j=8*g-D-1,w=(1<<j)-1,M=w>>1,h=-7,y=_?g-1:0,d=_?-1:1,g=m[B+y];for(y+=d,T=g&(1<<-h)-1,g>>=-h,h+=j;0<h;T=256*T+m[B+y],y+=d,h-=8);for(U=T&(1<<-h)-1,T>>=-h,h+=D;0<h;U=256*U+m[B+y],y+=d,h-=8);if(T===0)T=1-M;else{if(T===w)return U?NaN:1/0*(g?-1:1);U+=Math.pow(2,D),T-=M}return(g?-1:1)*U*Math.pow(2,T-D)},i.write=function(m,B,_,D,F,A){var U,j,w=8*A-F-1,M=(1<<w)-1,h=M>>1,y=F===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=D?0:A-1,g=D?1:-1,A=B<0||B===0&&1/B<0?1:0;for(B=Math.abs(B),isNaN(B)||B===1/0?(j=isNaN(B)?1:0,U=M):(U=Math.floor(Math.log(B)/Math.LN2),B*(D=Math.pow(2,-U))<1&&(U--,D*=2),2<=(B+=1<=U+h?y/D:y*Math.pow(2,1-h))*D&&(U++,D/=2),M<=U+h?(j=0,U=M):1<=U+h?(j=(B*D-1)*Math.pow(2,F),U+=h):(j=B*Math.pow(2,h-1)*Math.pow(2,F),U=0));8<=F;m[_+d]=255&j,d+=g,j/=256,F-=8);for(U=U<<F|j,w+=F;0<w;m[_+d]=255&U,d+=g,U/=256,w-=8);m[_+d-g]|=128*A}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/ieee754/index.js","/node_modules/gulp-browserify/node_modules/ieee754")},{buffer:3,lYpoI2:11}],11:[function(e,r,i){(function(s,o,a,c,u,f,S,k,I){var m,B,_;function D(){}(s=r.exports={}).nextTick=(B=typeof window<"u"&&window.setImmediate,_=typeof window<"u"&&window.postMessage&&window.addEventListener,B?function(F){return window.setImmediate(F)}:_?(m=[],window.addEventListener("message",function(F){var T=F.source;T!==window&&T!==null||F.data!=="process-tick"||(F.stopPropagation(),0<m.length&&m.shift()())},!0),function(F){m.push(F),window.postMessage("process-tick","*")}):function(F){setTimeout(F,0)}),s.title="browser",s.browser=!0,s.env={},s.argv=[],s.on=D,s.addListener=D,s.once=D,s.off=D,s.removeListener=D,s.removeAllListeners=D,s.emit=D,s.binding=function(F){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(F){throw new Error("process.chdir is not supported")}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/process/browser.js","/node_modules/gulp-browserify/node_modules/process")},{buffer:3,lYpoI2:11}]},{},[1])(1)})})(nu);var zd=nu.exports;const Vd=Ms(zd);function jd(n){return new Promise(t=>setTimeout(t,n))}class Wd{constructor(t,e,r,i,s,o){W(this,"cache");W(this,"url");W(this,"cache_prefix");W(this,"fetchOptions");const a={...e};r&&(a["x-parameters"]=JSON.stringify(r)),i&&(a["x-chunks"]=i),s&&(a["x-downsample"]=JSON.stringify(s)),a["x-filtered"]="True",this.fetchOptions={headers:a},this.url=t,o?this.cache=void 0:this.cache=eu("zarr","cache"),this.cache_prefix=Vd({...r,chunks:i,downsample:s})}async get(t,e,r=0){const i=`${this.cache_prefix}${t}`;let s=null;if(this.cache&&(s=await $d(i,this.cache),s==="pending")){if(await jd(200),r>5*60)throw await Ei(i,this.cache),new Error("Zarr timeout");return await this.get(t,e,r+1)}if(!s||!this.cache){this.cache&&Lo(i,"pending",this.cache);const o=await fetch(`${this.url}${t}`,{...this.fetchOptions,...e});if(o.status===404){this.cache&&await Ei(i,this.cache);return}else if(o.status!==200)throw this.cache&&await Ei(i,this.cache),new Error(String(o.status));s=new Uint8Array(await o.arrayBuffer()),this.cache&&await Lo(i,s,this.cache)}return s}}function sn(n,t,e){const r=e.value;return e.value=async function(...i){const s=Date.now(),o=await r.apply(this,i),c=Date.now()-s;return console.debug(`${t} took ${c}ms`),o},e}var Zd=Object.defineProperty,Gd=Object.getOwnPropertyDescriptor,ks=(n,t,e,r)=>{for(var i=Gd(t,e),s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=o(t,e,i)||i);return i&&Zd(t,e,i),i};const si=n=>n&&(Array.isArray(n)||ArrayBuffer.isView(n)),Yd=n=>{const t=[];if(!si(n))return t;for(;t.push(n.length),si(n[0]);)n=n[0];return t},Jd=n=>{for(;Array.isArray(n);)n=n[0];if(typeof n=="number")return"float32";if(typeof n=="string")return"v2:object";switch(n.constructor.name){case"Int8Array":return"int8";case"Int16Array":return"int16";case"Int32Array":return"int32";case"BigInt64Array":return"int64";case"Uint8Array":return"uint8";case"Uint16Array":return"uint16";case"Uint32Array":return"uint32";case"Float32Array":return"float32";case"Float64Array":return"float64"}throw new Error("Unsupported data type: "+n.constructor.name)},Hd=n=>{if(!Array.isArray(n))return n;const t=n.flat(1/0);if(si(t[0])){const e=t[0].length,r=new t[0].constructor(t.length*e);for(let i=0;i<t.length;i++)r.set(t[i],i*e);return r}else return t};function Kd(n){const t=n.length,e=Array(t);for(let r=t-1,i=1;r>=0;r--)e[r]=i,i*=n[r];return e}function ru(n,t,e,r=0){if(t.length===0)return n[0];if(t.length===1){const s=new n.constructor(t[0]);return s.set(n.slice(r,r+t[0])),s}const i=new Array(t[0]);for(let s=0;s<t[0];s++)i[s]=ru(n,t.slice(1),e.slice(1),r+s*e[0]);return i}const iu=(n,t,e)=>{const r=Object.keys(t),i={};for(const s in n)si(n[s].data)&&(i[s]=!0);if(r.length==1)for(let s=0;s<t[r[0]];s++){const o={};for(const a in n)i[a]?n[a].data.length>1&&(o[a]=n[a].data[s]):o[a]=n[a].data;e.push(o)}else for(let s=0;s<t[r[0]];s++){const o={};for(const c in n)n[c].dims.includes(r[0])?o[c]={attrs:{},data:n[c].data[s],dims:n[c].dims.slice(1)}:o[c]=n[c];const a={...t};delete a[r[0]],iu(o,a,e)}return e};class oi{constructor(t,e,r,i){W(this,"id");W(this,"dims");W(this,"attrs");W(this,"arr");this.id=t,this.dims=e,this.attrs=r,this.arr=i}async get(t){const e=await ol(this.arr,t);return this.arr.dtype!=="v2:object"&&e.shape?ru(e.data,e.shape,e.stride):e.data}}ks([sn],oi.prototype,"get");const Fs=class Dr{constructor(t,e,r,i,s){W(this,"dims");W(this,"data_vars");W(this,"attrs");W(this,"coordinates");W(this,"root");this.data_vars=e,this.dims=t,this.attrs=r,this.root=s,this.coordinates=i}static async zarr(t,e,r,i,s){const o=await Vu(new Wd(t,e,r,i,s,typeof window>"u")),a=await Ws(o),c=await $e(a,{kind:"group"}),u={},f={};for(const k of o.contents())if(k.kind=="array"){const I=await $e(a.resolve(k.path),{kind:"array"}),m=I.attrs._ARRAY_DIMENSIONS,B=k.path.split("/").pop();u[B]=new oi(B,m||[],I.attrs,I),m&&m.map((_,D)=>{const F=I.shape[D];if(f[_]&&f[_]!=F)throw new Error(`Inconsistent dimension size for ${_}: ${f[_]} != ${F}`);f[_]=F})}const S=JSON.parse(c.attrs._coordinates);return new Dr(f,u,c.attrs,S,a)}static async fromArrow(t,e){const r={},i={record:t.numRows},s={};return t.schema.fields.forEach(o=>{const a=t.getChild(o.name);let c=a==null?void 0:a.toArray();if(G.isTimestamp(o.type)){const u=new Int32Array(c.length),f=BigInt(1e3**(o.type.unit-1));for(let S=0;S<c.length;S++)u[S]=Number(c[S]/f);c=u}else if(G.isBinary(o.type)){const u=[];for(let f=0;f<c.length;f++)u.push(new Buffer(c[f]).toString("base64"));c=u}s[o.name]={dims:["record"],attrs:{},data:c}}),await Dr.init({dims:i,data_vars:s,attrs:r},e)}static async init(t,e){const r=Ws(new Map),i=new Dr(t.dims,{},t.attrs||{},e||{},r);for(const s in t.data_vars){const{dims:o,attrs:a,data:c}=t.data_vars[s];await i.assign(s,o,c,a)}return i}async asDataframe(){const t={},e=[];for(const i in this.data_vars)t[i]={attrs:this.data_vars[i].attrs,dims:this.data_vars[i].dims},t[i].data=await this.data_vars[i].get(),this.data_vars[i].arr.dtype=="int64"&&e.push(i);const r=iu(t,{...this.dims},[]);if(this.coordinates.t)for(let i=0;i<r.length;i++)r[i][this.coordinates.t]=new Date(r[i][this.coordinates.t]).toISOString();if(e.length>0)for(const i of e)for(let s=0;s<r.length;s++)r[s][i]=Number(r[s][i]);return r}async asGeojson(t){if(!this.coordinates.g&&!t)throw new Error("No geometry found");const e=[],r=await this.asDataframe();for(let i=0;i<r.length;i++){const{...s}=r[i];let o=t;if(!o&&this.coordinates.g){delete s[this.coordinates.g];const a=new Buffer(r[i][this.coordinates.g],"base64");o=ve.Geometry.parse(a).toGeoJSON()}e.push({type:"Feature",geometry:o,properties:s})}return{type:"FeatureCollection",features:e}}async assign(t,e,r,i,s,o){const a=Yd(r);if(a.length!=e.length)throw new Error("Data shape does not match dimensions");e.map((f,S)=>{if(this.dims[f]){if(this.dims[f]!=a[S])throw new Error(`Existing size of dimension ${f} does not match new data`)}else this.dims[f]=a[S]});const c=Jd(r),u=await Uu(this.root.resolve(t),{shape:a,data_type:c,chunk_shape:o||a,codecs:c=="v2:object"?[{name:"json2"}]:[]});await al(u,a.map(()=>null),{data:Hd(r),shape:a,stride:Kd(a)}),this.data_vars[t]=new oi(t,e,i||{},u)}};ks([sn],Fs.prototype,"asDataframe");ks([sn],Fs,"zarr");let qi=Fs;var qd=Object.defineProperty,Xd=Object.getOwnPropertyDescriptor,yi=(n,t,e,r)=>{for(var i=Xd(t,e),s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=o(t,e,i)||i);return i&&qd(t,e,i),i},Xe;const dr=(Xe=class{constructor(t=process.env.DATAMESH_TOKEN||"$DATAMESH_TOKEN",e=process.env.DATAMESH_SERVICE||"https://datamesh.oceanum.io",r=process.env.DATAMESH_GATEWAY||"https://gateway.datamesh.oceanum.io"){W(this,"_token");W(this,"_proto");W(this,"_host");W(this,"_authHeaders");W(this,"_gateway");if(!t)throw new Error("A valid datamesh token must be supplied as a connector constructor argument or defined in environment variables as DATAMESH_TOKEN");this._token=t;const i=new URL(e);this._proto=i.protocol,this._host=i.hostname,this._authHeaders={Authorization:`Token ${this._token}`,"X-DATAMESH-TOKEN":this._token},this._gateway=r||`${this._proto}//gateway.${this._host}`,this._host.split(".").slice(-1)[0]!==this._gateway.split(".").slice(-1)[0]&&console.warn("Gateway and service domain do not match")}get host(){return this._host}async status(){return(await fetch(`${this._proto}//${this._host}`,{headers:this._authHeaders})).status===200}async validateResponse(t){if(t.status>=400){let e;try{e=(await t.json()).detail}catch{e=`Datamesh server error: ${await t.text()}`}throw new Error(e)}}async metadataRequest(t="",e={}){const r=new URL(`${this._proto}//${this._host}/datasource/${t}`);Object.keys(e).forEach(s=>r.searchParams.append(s,e[s]));const i=await fetch(r.toString(),{headers:this._authHeaders});if(i.status===404)throw new Error(`Datasource ${t} not found`);if(i.status===401)throw new Error(`Datasource ${t} not authorized`);return await this.validateResponse(i),i}async dataRequest(t,e="application/vnd.apache.arrow.file"){const r=await fetch(`${this._gateway}/oceanql/${t}?f=arrow`,{headers:{Accept:e,...this._authHeaders}});return await this.validateResponse(r),Jc(await r.arrayBuffer())}async stageRequest(t){const e=JSON.stringify(t),r=await fetch(`${this._gateway}/oceanql/stage/`,{method:"POST",headers:{"Content-Type":"application/json",...this._authHeaders},body:e});if(r.status>=400){const i=await r.json();throw new Error(i.detail)}else return r.status===204?null:r.json()}async query(t){const e=await this.stageRequest(t);if(!e)return console.warn("No data found for query"),null;if(e.size<Xe.LAZY_LOAD_SIZE&&e.container!="dataset"){const s=await this.dataRequest(e.qhash);return await qi.fromArrow(s,e.coordkeys)}const r=`${this._gateway}/zarr/${e.qhash}`;return await qi.zarr(r,this._authHeaders)}async getDatasource(t){const r=await(await this.metadataRequest(t)).json();return{id:t,geom:r.geometry,...r.properties}}async loadDatasource(t,e={}){const r={datasource:t,parameters:e};return await this.query(r)}},W(Xe,"LAZY_LOAD_SIZE",1e8),Xe);yi([sn],dr.prototype,"stageRequest");yi([sn],dr.prototype,"query");yi([sn],dr.prototype,"getDatasource");yi([sn],dr.prototype,"loadDatasource");let Qd=dr;var su={exports:{}};(function(n,t){(function(e,r){n.exports=r()})(Hc,function(){var e=1e3,r=6e4,i=36e5,s="millisecond",o="second",a="minute",c="hour",u="day",f="week",S="month",k="quarter",I="year",m="date",B="Invalid Date",_=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,D=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,F={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(E){var N=["th","st","nd","rd"],O=E%100;return"["+E+(N[(O-20)%10]||N[O]||N[0])+"]"}},T=function(E,N,O){var C=String(E);return!C||C.length>=N?E:""+Array(N+1-C.length).join(O)+E},U={s:T,z:function(E){var N=-E.utcOffset(),O=Math.abs(N),C=Math.floor(O/60),R=O%60;return(N<=0?"+":"-")+T(C,2,"0")+":"+T(R,2,"0")},m:function E(N,O){if(N.date()<O.date())return-E(O,N);var C=12*(O.year()-N.year())+(O.month()-N.month()),R=N.clone().add(C,S),V=O-R<0,z=N.clone().add(C+(V?-1:1),S);return+(-(C+(O-R)/(V?R-z:z-R))||0)},a:function(E){return E<0?Math.ceil(E)||0:Math.floor(E)},p:function(E){return{M:S,y:I,w:f,d:u,D:m,h:c,m:a,s:o,ms:s,Q:k}[E]||String(E||"").toLowerCase().replace(/s$/,"")},u:function(E){return E===void 0}},j="en",w={};w[j]=F;var M="$isDayjsObject",h=function(E){return E instanceof A||!(!E||!E[M])},y=function E(N,O,C){var R;if(!N)return j;if(typeof N=="string"){var V=N.toLowerCase();w[V]&&(R=V),O&&(w[V]=O,R=V);var z=N.split("-");if(!R&&z.length>1)return E(z[0])}else{var ct=N.name;w[ct]=N,R=ct}return!C&&R&&(j=R),R||!C&&j},d=function(E,N){if(h(E))return E.clone();var O=typeof N=="object"?N:{};return O.date=E,O.args=arguments,new A(O)},g=U;g.l=y,g.i=h,g.w=function(E,N){return d(E,{locale:N.$L,utc:N.$u,x:N.$x,$offset:N.$offset})};var A=function(){function E(O){this.$L=y(O.locale,null,!0),this.parse(O),this.$x=this.$x||O.x||{},this[M]=!0}var N=E.prototype;return N.parse=function(O){this.$d=function(C){var R=C.date,V=C.utc;if(R===null)return new Date(NaN);if(g.u(R))return new Date;if(R instanceof Date)return new Date(R);if(typeof R=="string"&&!/Z$/i.test(R)){var z=R.match(_);if(z){var ct=z[2]-1||0,vt=(z[7]||"0").substring(0,3);return V?new Date(Date.UTC(z[1],ct,z[3]||1,z[4]||0,z[5]||0,z[6]||0,vt)):new Date(z[1],ct,z[3]||1,z[4]||0,z[5]||0,z[6]||0,vt)}}return new Date(R)}(O),this.init()},N.init=function(){var O=this.$d;this.$y=O.getFullYear(),this.$M=O.getMonth(),this.$D=O.getDate(),this.$W=O.getDay(),this.$H=O.getHours(),this.$m=O.getMinutes(),this.$s=O.getSeconds(),this.$ms=O.getMilliseconds()},N.$utils=function(){return g},N.isValid=function(){return this.$d.toString()!==B},N.isSame=function(O,C){var R=d(O);return this.startOf(C)<=R&&R<=this.endOf(C)},N.isAfter=function(O,C){return d(O)<this.startOf(C)},N.isBefore=function(O,C){return this.endOf(C)<d(O)},N.$g=function(O,C,R){return g.u(O)?this[C]:this.set(R,O)},N.unix=function(){return Math.floor(this.valueOf()/1e3)},N.valueOf=function(){return this.$d.getTime()},N.startOf=function(O,C){var R=this,V=!!g.u(C)||C,z=g.p(O),ct=function(l,p){var v=g.w(R.$u?Date.UTC(R.$y,p,l):new Date(R.$y,p,l),R);return V?v:v.endOf(u)},vt=function(l,p){return g.w(R.toDate()[l].apply(R.toDate("s"),(V?[0,0,0,0]:[23,59,59,999]).slice(p)),R)},St=this.$W,Dt=this.$M,Et=this.$D,le="set"+(this.$u?"UTC":"");switch(z){case I:return V?ct(1,0):ct(31,11);case S:return V?ct(1,Dt):ct(0,Dt+1);case f:var he=this.$locale().weekStart||0,P=(St<he?St+7:St)-he;return ct(V?Et-P:Et+(6-P),Dt);case u:case m:return vt(le+"Hours",0);case c:return vt(le+"Minutes",1);case a:return vt(le+"Seconds",2);case o:return vt(le+"Milliseconds",3);default:return this.clone()}},N.endOf=function(O){return this.startOf(O,!1)},N.$set=function(O,C){var R,V=g.p(O),z="set"+(this.$u?"UTC":""),ct=(R={},R[u]=z+"Date",R[m]=z+"Date",R[S]=z+"Month",R[I]=z+"FullYear",R[c]=z+"Hours",R[a]=z+"Minutes",R[o]=z+"Seconds",R[s]=z+"Milliseconds",R)[V],vt=V===u?this.$D+(C-this.$W):C;if(V===S||V===I){var St=this.clone().set(m,1);St.$d[ct](vt),St.init(),this.$d=St.set(m,Math.min(this.$D,St.daysInMonth())).$d}else ct&&this.$d[ct](vt);return this.init(),this},N.set=function(O,C){return this.clone().$set(O,C)},N.get=function(O){return this[g.p(O)]()},N.add=function(O,C){var R,V=this;O=Number(O);var z=g.p(C),ct=function(Dt){var Et=d(V);return g.w(Et.date(Et.date()+Math.round(Dt*O)),V)};if(z===S)return this.set(S,this.$M+O);if(z===I)return this.set(I,this.$y+O);if(z===u)return ct(1);if(z===f)return ct(7);var vt=(R={},R[a]=r,R[c]=i,R[o]=e,R)[z]||1,St=this.$d.getTime()+O*vt;return g.w(St,this)},N.subtract=function(O,C){return this.add(-1*O,C)},N.format=function(O){var C=this,R=this.$locale();if(!this.isValid())return R.invalidDate||B;var V=O||"YYYY-MM-DDTHH:mm:ssZ",z=g.z(this),ct=this.$H,vt=this.$m,St=this.$M,Dt=R.weekdays,Et=R.months,le=R.meridiem,he=function(p,v,L,x){return p&&(p[v]||p(C,V))||L[v].slice(0,x)},P=function(p){return g.s(ct%12||12,p,"0")},l=le||function(p,v,L){var x=p<12?"AM":"PM";return L?x.toLowerCase():x};return V.replace(D,function(p,v){return v||function(L){switch(L){case"YY":return String(C.$y).slice(-2);case"YYYY":return g.s(C.$y,4,"0");case"M":return St+1;case"MM":return g.s(St+1,2,"0");case"MMM":return he(R.monthsShort,St,Et,3);case"MMMM":return he(Et,St);case"D":return C.$D;case"DD":return g.s(C.$D,2,"0");case"d":return String(C.$W);case"dd":return he(R.weekdaysMin,C.$W,Dt,2);case"ddd":return he(R.weekdaysShort,C.$W,Dt,3);case"dddd":return Dt[C.$W];case"H":return String(ct);case"HH":return g.s(ct,2,"0");case"h":return P(1);case"hh":return P(2);case"a":return l(ct,vt,!0);case"A":return l(ct,vt,!1);case"m":return String(vt);case"mm":return g.s(vt,2,"0");case"s":return String(C.$s);case"ss":return g.s(C.$s,2,"0");case"SSS":return g.s(C.$ms,3,"0");case"Z":return z}return null}(p)||z.replace(":","")})},N.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},N.diff=function(O,C,R){var V,z=this,ct=g.p(C),vt=d(O),St=(vt.utcOffset()-this.utcOffset())*r,Dt=this-vt,Et=function(){return g.m(z,vt)};switch(ct){case I:V=Et()/12;break;case S:V=Et();break;case k:V=Et()/3;break;case f:V=(Dt-St)/6048e5;break;case u:V=(Dt-St)/864e5;break;case c:V=Dt/i;break;case a:V=Dt/r;break;case o:V=Dt/e;break;default:V=Dt}return R?V:g.a(V)},N.daysInMonth=function(){return this.endOf(S).$D},N.$locale=function(){return w[this.$L]},N.locale=function(O,C){if(!O)return this.$L;var R=this.clone(),V=y(O,C,!0);return V&&(R.$L=V),R},N.clone=function(){return g.w(this.$d,this)},N.toDate=function(){return new Date(this.valueOf())},N.toJSON=function(){return this.isValid()?this.toISOString():null},N.toISOString=function(){return this.$d.toISOString()},N.toString=function(){return this.$d.toUTCString()},E}(),Z=A.prototype;return d.prototype=Z,[["$ms",s],["$s",o],["$m",a],["$H",c],["$W",u],["$M",S],["$y",I],["$D",m]].forEach(function(E){Z[E[1]]=function(N){return this.$g(N,E[0],E[1])}}),d.extend=function(E,N){return E.$i||(E(N,A,d),E.$i=!0),d},d.locale=y,d.isDayjs=h,d.unix=function(E){return d(1e3*E)},d.en=w[j],d.Ls=w,d.p={},d})})(su);var tf=su.exports;const bn=Ms(tf);var ou={exports:{}};(function(n,t){(function(e,r){n.exports=r()})(Hc,function(){var e,r,i=1e3,s=6e4,o=36e5,a=864e5,c=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,u=31536e6,f=2628e6,S=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,k={years:u,months:f,days:a,hours:o,minutes:s,seconds:i,milliseconds:1,weeks:6048e5},I=function(w){return w instanceof U},m=function(w,M,h){return new U(w,h,M.$l)},B=function(w){return r.p(w)+"s"},_=function(w){return w<0},D=function(w){return _(w)?Math.ceil(w):Math.floor(w)},F=function(w){return Math.abs(w)},T=function(w,M){return w?_(w)?{negative:!0,format:""+F(w)+M}:{negative:!1,format:""+w+M}:{negative:!1,format:""}},U=function(){function w(h,y,d){var g=this;if(this.$d={},this.$l=d,h===void 0&&(this.$ms=0,this.parseFromMilliseconds()),y)return m(h*k[B(y)],this);if(typeof h=="number")return this.$ms=h,this.parseFromMilliseconds(),this;if(typeof h=="object")return Object.keys(h).forEach(function(E){g.$d[B(E)]=h[E]}),this.calMilliseconds(),this;if(typeof h=="string"){var A=h.match(S);if(A){var Z=A.slice(2).map(function(E){return E!=null?Number(E):0});return this.$d.years=Z[0],this.$d.months=Z[1],this.$d.weeks=Z[2],this.$d.days=Z[3],this.$d.hours=Z[4],this.$d.minutes=Z[5],this.$d.seconds=Z[6],this.calMilliseconds(),this}}return this}var M=w.prototype;return M.calMilliseconds=function(){var h=this;this.$ms=Object.keys(this.$d).reduce(function(y,d){return y+(h.$d[d]||0)*k[d]},0)},M.parseFromMilliseconds=function(){var h=this.$ms;this.$d.years=D(h/u),h%=u,this.$d.months=D(h/f),h%=f,this.$d.days=D(h/a),h%=a,this.$d.hours=D(h/o),h%=o,this.$d.minutes=D(h/s),h%=s,this.$d.seconds=D(h/i),h%=i,this.$d.milliseconds=h},M.toISOString=function(){var h=T(this.$d.years,"Y"),y=T(this.$d.months,"M"),d=+this.$d.days||0;this.$d.weeks&&(d+=7*this.$d.weeks);var g=T(d,"D"),A=T(this.$d.hours,"H"),Z=T(this.$d.minutes,"M"),E=this.$d.seconds||0;this.$d.milliseconds&&(E+=this.$d.milliseconds/1e3,E=Math.round(1e3*E)/1e3);var N=T(E,"S"),O=h.negative||y.negative||g.negative||A.negative||Z.negative||N.negative,C=A.format||Z.format||N.format?"T":"",R=(O?"-":"")+"P"+h.format+y.format+g.format+C+A.format+Z.format+N.format;return R==="P"||R==="-P"?"P0D":R},M.toJSON=function(){return this.toISOString()},M.format=function(h){var y=h||"YYYY-MM-DDTHH:mm:ss",d={Y:this.$d.years,YY:r.s(this.$d.years,2,"0"),YYYY:r.s(this.$d.years,4,"0"),M:this.$d.months,MM:r.s(this.$d.months,2,"0"),D:this.$d.days,DD:r.s(this.$d.days,2,"0"),H:this.$d.hours,HH:r.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:r.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:r.s(this.$d.seconds,2,"0"),SSS:r.s(this.$d.milliseconds,3,"0")};return y.replace(c,function(g,A){return A||String(d[g])})},M.as=function(h){return this.$ms/k[B(h)]},M.get=function(h){var y=this.$ms,d=B(h);return d==="milliseconds"?y%=1e3:y=d==="weeks"?D(y/k[d]):this.$d[d],y||0},M.add=function(h,y,d){var g;return g=y?h*k[B(y)]:I(h)?h.$ms:m(h,this).$ms,m(this.$ms+g*(d?-1:1),this)},M.subtract=function(h,y){return this.add(h,y,!0)},M.locale=function(h){var y=this.clone();return y.$l=h,y},M.clone=function(){return m(this.$ms,this)},M.humanize=function(h){return e().add(this.$ms,"ms").locale(this.$l).fromNow(!h)},M.valueOf=function(){return this.asMilliseconds()},M.milliseconds=function(){return this.get("milliseconds")},M.asMilliseconds=function(){return this.as("milliseconds")},M.seconds=function(){return this.get("seconds")},M.asSeconds=function(){return this.as("seconds")},M.minutes=function(){return this.get("minutes")},M.asMinutes=function(){return this.as("minutes")},M.hours=function(){return this.get("hours")},M.asHours=function(){return this.as("hours")},M.days=function(){return this.get("days")},M.asDays=function(){return this.as("days")},M.weeks=function(){return this.get("weeks")},M.asWeeks=function(){return this.as("weeks")},M.months=function(){return this.get("months")},M.asMonths=function(){return this.as("months")},M.years=function(){return this.get("years")},M.asYears=function(){return this.as("years")},w}(),j=function(w,M,h){return w.add(M.years()*h,"y").add(M.months()*h,"M").add(M.days()*h,"d").add(M.hours()*h,"h").add(M.minutes()*h,"m").add(M.seconds()*h,"s").add(M.milliseconds()*h,"ms")};return function(w,M,h){e=h,r=h().$utils(),h.duration=function(g,A){var Z=h.locale();return m(g,{$l:Z},A)},h.isDuration=I;var y=M.prototype.add,d=M.prototype.subtract;M.prototype.add=function(g,A){return I(g)?j(this,g,1):y.bind(this)(g,A)},M.prototype.subtract=function(g,A){return I(g)?j(this,g,-1):d.bind(this)(g,A)}}})})(ou);var ef=ou.exports;const nf=Ms(ef);bn.extend(nf);const rf=n=>{if(n instanceof Date)return bn(n).toISOString();if(n instanceof bn)return n.toISOString();if(n instanceof bn.duration)return n.toISOString();try{return bn.duration(n).toISOString()}catch{return bn(n).toISOString()}},sf=n=>{const t=n.times.map(e=>rf(e));return{type:n.type||"range",times:t,resolution:n.resolution,resample:n.resample}};class of{constructor(t){W(this,"datasource");W(this,"parameters");W(this,"description");W(this,"variables");W(this,"timefilter");W(this,"geofilter");W(this,"levelfilter");W(this,"coordfilter");W(this,"crs");W(this,"aggregate");W(this,"limit");W(this,"id");this.datasource=t.datasource,this.parameters=t.parameters,this.description=t.description,this.variables=t.variables,this.timefilter=t.timefilter&&sf(t.timefilter),this.geofilter=t.geofilter,this.levelfilter=t.levelfilter,this.coordfilter=t.coordfilter,this.crs=t.crs,this.aggregate=t.aggregate,this.limit=t.limit,this.id=t.id}toJSON(){return{datasource:this.datasource,parameters:this.parameters,description:this.description,variables:this.variables,timefilter:this.timefilter,geofilter:this.geofilter,levelfilter:this.levelfilter,coordfilter:this.coordfilter,crs:this.crs,aggregate:this.aggregate,limit:this.limit,id:this.id}}}exports.Connector=Qd;exports.DataVar=oi;exports.Dataset=qi;exports.Query=of;