@ifc-lite/viewer 1.17.2 → 1.17.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 (62) hide show
  1. package/.turbo/turbo-build.log +30 -29
  2. package/.turbo/turbo-typecheck.log +1 -42
  3. package/CHANGELOG.md +9 -0
  4. package/dist/assets/arrow-DJf2ErbF.js +20 -0
  5. package/dist/assets/basketViewActivator-aojwdomq.js +1 -0
  6. package/dist/assets/bcf-D5-QWGO9.js +281 -0
  7. package/dist/assets/{browser-BDShTXzi.js → browser-CKs-FY1P.js} +1 -1
  8. package/dist/assets/drawing-2d-gWfpdfYe.js +257 -0
  9. package/dist/assets/epsg-index.generated-BjJrt_0S.js +1 -0
  10. package/dist/assets/exporters-C_6J153K.js +79896 -0
  11. package/dist/assets/geometry.worker-Nz9_YIqh.js +1 -0
  12. package/dist/assets/ids-B4jTqB1O.js +1 -0
  13. package/dist/assets/{ifc-lite_bg-FNRmpSvM.wasm → ifc-lite_bg-eSkBTizQ.wasm} +0 -0
  14. package/dist/assets/index-jhBr1wbn.js +101666 -0
  15. package/dist/assets/index-pbE7itQS.css +1 -0
  16. package/dist/assets/lens-CSASnhAL.js +1 -0
  17. package/dist/assets/maplibre-gl-BpvwNKKy.js +811 -0
  18. package/dist/assets/{native-bridge-Crsb7TKz.js → native-bridge-DSIyEYXG.js} +6 -4
  19. package/dist/assets/{arrow2-bb-jcVEo.js → parquet-CEXmQNRO.js} +2 -2
  20. package/dist/assets/sandbox-B79eavQ3.js +5933 -0
  21. package/dist/assets/server-client-D3bUPJJc.js +626 -0
  22. package/dist/assets/wasm-bridge-B0J07fZZ.js +1 -0
  23. package/dist/assets/zip-B-jFFAGa.js +12 -0
  24. package/dist/index.html +11 -2
  25. package/package.json +24 -19
  26. package/src/components/viewer/ExportChangesButton.tsx +18 -3
  27. package/src/components/viewer/ExportDialog.tsx +16 -3
  28. package/src/components/viewer/HierarchyPanel.tsx +6 -6
  29. package/src/components/viewer/PropertiesPanel.tsx +96 -60
  30. package/src/components/viewer/Section2DPanel.tsx +3 -2
  31. package/src/components/viewer/ViewportContainer.tsx +5 -4
  32. package/src/components/viewer/hierarchy/treeDataBuilder.ts +2 -1
  33. package/src/components/viewer/properties/EpsgLookupDialog.tsx +418 -0
  34. package/src/components/viewer/properties/GeoreferencingPanel.tsx +591 -0
  35. package/src/components/viewer/properties/LocationMap.tsx +289 -0
  36. package/src/components/viewer/properties/ModelMetadataPanel.tsx +3 -70
  37. package/src/hooks/bcfIdLookup.ts +13 -11
  38. package/src/hooks/ids/idsColorSystem.ts +3 -8
  39. package/src/hooks/useIDS.ts +31 -16
  40. package/src/hooks/useIfcFederation.ts +2 -2
  41. package/src/lib/geo/kmz-exporter.ts +112 -0
  42. package/src/lib/geo/reproject.ts +244 -0
  43. package/src/lib/lens/adapter.ts +3 -1
  44. package/src/main.tsx +1 -0
  45. package/src/sdk/adapters/export-adapter.ts +14 -1
  46. package/src/sdk/adapters/viewer-adapter.ts +5 -9
  47. package/src/sdk/adapters/visibility-adapter.ts +6 -9
  48. package/src/store/basketVisibleSet.ts +3 -4
  49. package/src/store/globalId.ts +79 -0
  50. package/src/store/index.ts +1 -0
  51. package/src/store/slices/mutationSlice.ts +178 -0
  52. package/src/store/slices/pinboardSlice.ts +4 -8
  53. package/vite.config.ts +17 -0
  54. package/dist/assets/Arrow.dom-BhOg9lpn.js +0 -20
  55. package/dist/assets/arrow2_bg-BlXl-cSQ.js +0 -1
  56. package/dist/assets/basketViewActivator-BRG5DBmM.js +0 -1
  57. package/dist/assets/geometry.worker-kgiT_Qhh.js +0 -1
  58. package/dist/assets/index-B1Ecw4AU.js +0 -189756
  59. package/dist/assets/index-Ba4eoTe7.css +0 -1
  60. package/dist/assets/index-CrgYBjTn.js +0 -229
  61. package/dist/assets/module-6F3E5H7Y-tx0BadV3.js +0 -6
  62. package/dist/assets/wasm-bridge-mJUhb7uk.js +0 -1
@@ -0,0 +1,20 @@
1
+ var sr=function(){return sr=Object.assign||function(t){for(var e,n=1,s=arguments.length;n<s;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},sr.apply(this,arguments)};function Ha(i,t){var e={};for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&t.indexOf(n)<0&&(e[n]=i[n]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(i);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(i,n[s])&&(e[n[s]]=i[n[s]]);return e}function p(i,t,e,n){function s(r){return r instanceof e?r:new e(function(o){o(r)})}return new(e||(e=Promise))(function(r,o){function a(h){try{l(n.next(h))}catch(d){o(d)}}function c(h){try{l(n.throw(h))}catch(d){o(d)}}function l(h){h.done?r(h.value):s(h.value).then(a,c)}l((n=n.apply(i,t||[])).next())})}function rr(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],n=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&n>=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Uh(i,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,r;n<s;n++)(r||!(n in t))&&(r||(r=Array.prototype.slice.call(t,0,n)),r[n]=t[n]);return i.concat(r||Array.prototype.slice.call(t))}function D(i){return this instanceof D?(this.v=i,this):new D(i)}function wt(i,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=e.apply(i,t||[]),s,r=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),s[Symbol.asyncIterator]=function(){return this},s;function o(M){return function(k){return Promise.resolve(k).then(M,d)}}function a(M,k){n[M]&&(s[M]=function(Ue){return new Promise(function(wn,ne){r.push([M,Ue,wn,ne])>1||c(M,Ue)})},k&&(s[M]=k(s[M])))}function c(M,k){try{l(n[M](k))}catch(Ue){U(r[0][3],Ue)}}function l(M){M.value instanceof D?Promise.resolve(M.value.v).then(h,d):U(r[0][2],M)}function h(M){c("next",M)}function d(M){c("throw",M)}function U(M,k){M(k),r.shift(),r.length&&c(r[0][0],r[0][1])}}function Vi(i){var t,e;return t={},n("next"),n("throw",function(s){throw s}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(s,r){t[s]=i[s]?function(o){return(e=!e)?{value:D(i[s](o)),done:!1}:r?r(o):o}:r}}function ae(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=i[Symbol.asyncIterator],e;return t?t.call(i):(i=typeof rr=="function"?rr(i):i[Symbol.iterator](),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(r){e[r]=i[r]&&function(o){return new Promise(function(a,c){o=i[r](o),s(a,c,o.done,o.value)})}}function s(r,o,a,c){Promise.resolve(c).then(function(l){r({value:l,done:a})},o)}}const Ka=new TextDecoder("utf-8"),Fn=i=>Ka.decode(i),qa=new TextEncoder,on=i=>qa.encode(i),Ga=i=>typeof i=="number",Or=i=>typeof i=="boolean",W=i=>typeof i=="function",st=i=>i!=null&&Object(i)===i,ce=i=>st(i)&&W(i.then),ri=i=>st(i)&&W(i[Symbol.iterator]),Fe=i=>st(i)&&W(i[Symbol.asyncIterator]),Mn=i=>st(i)&&st(i.schema),Fr=i=>st(i)&&"done"in i&&"value"in i,Mr=i=>st(i)&&W(i.stat)&&Ga(i.fd),Tr=i=>st(i)&&Rn(i.body),an=i=>"_getDOMStream"in i&&"_getNodeStream"in i,Za=i=>st(i)&&W(i.abort)&&W(i.getWriter)&&!an(i),Rn=i=>st(i)&&W(i.cancel)&&W(i.getReader)&&!an(i),Qa=i=>st(i)&&W(i.end)&&W(i.write)&&Or(i.writable)&&!an(i),Nr=i=>st(i)&&W(i.read)&&W(i.pipe)&&Or(i.readable)&&!an(i),Xa=i=>st(i)&&W(i.clear)&&W(i.bytes)&&W(i.position)&&W(i.setPosition)&&W(i.capacity)&&W(i.getBufferIdentifier)&&W(i.createLong),zn=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function tc(i){const t=i[0]?[i[0]]:[];let e,n,s,r;for(let o,a,c=0,l=0,h=i.length;++c<h;){if(o=t[l],a=i[c],!o||!a||o.buffer!==a.buffer||a.byteOffset<o.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:e,byteLength:s}=o,{byteOffset:n,byteLength:r}=a,e+s<n||n+r<e){a&&(t[++l]=a);continue}t[l]=new Uint8Array(o.buffer,e,n-e+r)}return t}function ci(i,t,e=0,n=t.byteLength){const s=i.byteLength,r=new Uint8Array(i.buffer,i.byteOffset,s),o=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,s));return r.set(o,e),i}function St(i,t){const e=tc(i),n=e.reduce((h,d)=>h+d.byteLength,0);let s,r,o,a=0,c=-1;const l=Math.min(t||Number.POSITIVE_INFINITY,n);for(const h=e.length;++c<h;){if(s=e[c],r=s.subarray(0,Math.min(s.length,l-a)),l<=a+r.length){r.length<s.length?e[c]=s.subarray(r.length):r.length===s.length&&c++,o?ci(o,r,a):o=r;break}ci(o||(o=new Uint8Array(l)),r,a),a+=r.length}return[o||new Uint8Array(0),e.slice(c),n-(o?o.byteLength:0)]}function N(i,t){let e=Fr(t)?t.value:t;return e instanceof i?i===Uint8Array?new i(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=on(e)),e instanceof ArrayBuffer?new i(e):e instanceof zn?new i(e):Xa(e)?N(i,e.bytes()):ArrayBuffer.isView(e)?e.byteLength<=0?new i(0):new i(e.buffer,e.byteOffset,e.byteLength/i.BYTES_PER_ELEMENT):i.from(e)):new i(0)}const ec=i=>N(Int8Array,i),ic=i=>N(Int16Array,i),Ee=i=>N(Int32Array,i),nc=i=>N(BigInt64Array,i),L=i=>N(Uint8Array,i),sc=i=>N(Uint16Array,i),rc=i=>N(Uint32Array,i),oc=i=>N(BigUint64Array,i),ac=i=>N(Float32Array,i),cc=i=>N(Float64Array,i),lc=i=>N(Uint8ClampedArray,i),Tn=i=>(i.next(),i);function*$t(i,t){const e=function*(s){yield s},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof zn?e(t):ri(t)?t:e(t);return yield*Tn(function*(s){let r=null;do r=s.next(yield N(i,r));while(!r.done)}(n[Symbol.iterator]())),new i}const uc=i=>$t(Int8Array,i),hc=i=>$t(Int16Array,i),dc=i=>$t(Int32Array,i),Lr=i=>$t(Uint8Array,i),fc=i=>$t(Uint16Array,i),yc=i=>$t(Uint32Array,i),pc=i=>$t(Float32Array,i),gc=i=>$t(Float64Array,i),mc=i=>$t(Uint8ClampedArray,i);function At(i,t){return wt(this,arguments,function*(){if(ce(t))return yield D(yield D(yield*Vi(ae(At(i,yield D(t))))));const n=function(o){return wt(this,arguments,function*(){yield yield D(yield D(o))})},s=function(o){return wt(this,arguments,function*(){yield D(yield*Vi(ae(Tn(function*(a){let c=null;do c=a.next(yield c?.value);while(!c.done)}(o[Symbol.iterator]())))))})},r=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof zn?n(t):ri(t)?s(t):Fe(t)?t:n(t);return yield D(yield*Vi(ae(Tn(function(o){return wt(this,arguments,function*(){let a=null;do a=yield D(o.next(yield yield D(N(i,a))));while(!a.done)})}(r[Symbol.asyncIterator]()))))),yield D(new i)})}const bc=i=>At(Int8Array,i),_c=i=>At(Int16Array,i),vc=i=>At(Int32Array,i),Ur=i=>At(Uint8Array,i),wc=i=>At(Uint16Array,i),Ic=i=>At(Uint32Array,i),Sc=i=>At(Float32Array,i),Bc=i=>At(Float64Array,i),Ac=i=>At(Uint8ClampedArray,i);function jn(i,t,e){if(i!==0){e=e.slice(0,t);for(let n=-1,s=e.length;++n<s;)e[n]+=i}return e.subarray(0,t)}function xr(i,t){let e=0;const n=i.length;if(n!==t.length)return!1;if(n>0)do if(i[e]!==t[e])return!1;while(++e<n);return!0}const Dc=Object.freeze(Object.defineProperty({__proto__:null,compareArrayLike:xr,joinUint8Arrays:St,memcpy:ci,rebaseValueOffsets:jn,toArrayBufferView:N,toArrayBufferViewAsyncIterator:At,toArrayBufferViewIterator:$t,toBigInt64Array:nc,toBigUint64Array:oc,toFloat32Array:ac,toFloat32ArrayAsyncIterator:Sc,toFloat32ArrayIterator:pc,toFloat64Array:cc,toFloat64ArrayAsyncIterator:Bc,toFloat64ArrayIterator:gc,toInt16Array:ic,toInt16ArrayAsyncIterator:_c,toInt16ArrayIterator:hc,toInt32Array:Ee,toInt32ArrayAsyncIterator:vc,toInt32ArrayIterator:dc,toInt8Array:ec,toInt8ArrayAsyncIterator:bc,toInt8ArrayIterator:uc,toUint16Array:sc,toUint16ArrayAsyncIterator:wc,toUint16ArrayIterator:fc,toUint32Array:rc,toUint32ArrayAsyncIterator:Ic,toUint32ArrayIterator:yc,toUint8Array:L,toUint8ArrayAsyncIterator:Ur,toUint8ArrayIterator:Lr,toUint8ClampedArray:lc,toUint8ClampedArrayAsyncIterator:Ac,toUint8ClampedArrayIterator:mc},Symbol.toStringTag,{value:"Module"})),ct={fromIterable(i){return xi(Oc(i))},fromAsyncIterable(i){return xi(Fc(i))},fromDOMStream(i){return xi(Mc(i))},fromNodeStream(i){return xi(Nc(i))},toDOMStream(i,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(i,t){throw new Error('"toNodeStream" not available in this environment')}},xi=i=>(i.next(),i);function*Oc(i){let t,e=!1,n=[],s,r,o,a=0;function c(){return r==="peek"?St(n,o)[0]:([s,n,a]=St(n,o),s)}({cmd:r,size:o}=yield null);const l=Lr(i)[Symbol.iterator]();try{do if({done:t,value:s}=Number.isNaN(o-a)?l.next():l.next(o-a),!t&&s.byteLength>0&&(n.push(s),a+=s.byteLength),t||o<=a)do({cmd:r,size:o}=yield c());while(o<a);while(!t)}catch(h){(e=!0)&&typeof l.throw=="function"&&l.throw(h)}finally{e===!1&&typeof l.return=="function"&&l.return(null)}return null}function Fc(i){return wt(this,arguments,function*(){let e,n=!1,s=[],r,o,a,c=0;function l(){return o==="peek"?St(s,a)[0]:([r,s,c]=St(s,a),r)}({cmd:o,size:a}=yield yield D(null));const h=Ur(i)[Symbol.asyncIterator]();try{do if({done:e,value:r}=Number.isNaN(a-c)?yield D(h.next()):yield D(h.next(a-c)),!e&&r.byteLength>0&&(s.push(r),c+=r.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield D(l()));while(a<c);while(!e)}catch(d){(n=!0)&&typeof h.throw=="function"&&(yield D(h.throw(d)))}finally{n===!1&&typeof h.return=="function"&&(yield D(h.return(new Uint8Array(0))))}return yield D(null)})}function Mc(i){return wt(this,arguments,function*(){let e=!1,n=!1,s=[],r,o,a,c=0;function l(){return o==="peek"?St(s,a)[0]:([r,s,c]=St(s,a),r)}({cmd:o,size:a}=yield yield D(null));const h=new Tc(i);try{do if({done:e,value:r}=Number.isNaN(a-c)?yield D(h.read()):yield D(h.read(a-c)),!e&&r.byteLength>0&&(s.push(L(r)),c+=r.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield D(l()));while(a<c);while(!e)}catch(d){(n=!0)&&(yield D(h.cancel(d)))}finally{n===!1?yield D(h.cancel()):i.locked&&h.releaseLock()}return yield D(null)})}class Tc{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 p(this,void 0,void 0,function*(){const{reader:e,source:n}=this;e&&(yield e.cancel(t).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(t){return p(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=L(e)),e})}}const In=(i,t)=>{const e=s=>n([t,s]);let n;return[t,e,new Promise(s=>(n=s)&&i.once(t,e))]};function Nc(i){return wt(this,arguments,function*(){const e=[];let n="error",s=!1,r=null,o,a,c=0,l=[],h;function d(){return o==="peek"?St(l,a)[0]:([h,l,c]=St(l,a),h)}if({cmd:o,size:a}=yield yield D(null),i.isTTY)return yield yield D(new Uint8Array(0)),yield D(null);try{e[0]=In(i,"end"),e[1]=In(i,"error");do{if(e[2]=In(i,"readable"),[n,r]=yield D(Promise.race(e.map(M=>M[2]))),n==="error")break;if((s=n==="end")||(Number.isFinite(a-c)?(h=L(i.read(a-c)),h.byteLength<a-c&&(h=L(i.read()))):h=L(i.read()),h.byteLength>0&&(l.push(h),c+=h.byteLength)),s||a<=c)do({cmd:o,size:a}=yield yield D(d()));while(a<c)}while(!s)}finally{yield D(U(e,n==="error"?r:null))}return yield D(null);function U(M,k){return h=l=null,new Promise((Ue,wn)=>{for(const[ne,Ja]of M)i.off(ne,Ja);try{const ne=i.destroy;ne&&ne.call(i,k),k=void 0}catch(ne){k=ne||k}finally{k!=null?wn(k):Ue()}})}})}var K;(function(i){i[i.V1=0]="V1",i[i.V2=1]="V2",i[i.V3=2]="V3",i[i.V4=3]="V4",i[i.V5=4]="V5"})(K||(K={}));var $;(function(i){i[i.Sparse=0]="Sparse",i[i.Dense=1]="Dense"})($||($={}));var H;(function(i){i[i.HALF=0]="HALF",i[i.SINGLE=1]="SINGLE",i[i.DOUBLE=2]="DOUBLE"})(H||(H={}));var rt;(function(i){i[i.DAY=0]="DAY",i[i.MILLISECOND=1]="MILLISECOND"})(rt||(rt={}));var f;(function(i){i[i.SECOND=0]="SECOND",i[i.MILLISECOND=1]="MILLISECOND",i[i.MICROSECOND=2]="MICROSECOND",i[i.NANOSECOND=3]="NANOSECOND"})(f||(f={}));var pt;(function(i){i[i.YEAR_MONTH=0]="YEAR_MONTH",i[i.DAY_TIME=1]="DAY_TIME",i[i.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(pt||(pt={}));var R;(function(i){i[i.NONE=0]="NONE",i[i.Schema=1]="Schema",i[i.DictionaryBatch=2]="DictionaryBatch",i[i.RecordBatch=3]="RecordBatch",i[i.Tensor=4]="Tensor",i[i.SparseTensor=5]="SparseTensor"})(R||(R={}));var u;(function(i){i[i.NONE=0]="NONE",i[i.Null=1]="Null",i[i.Int=2]="Int",i[i.Float=3]="Float",i[i.Binary=4]="Binary",i[i.Utf8=5]="Utf8",i[i.Bool=6]="Bool",i[i.Decimal=7]="Decimal",i[i.Date=8]="Date",i[i.Time=9]="Time",i[i.Timestamp=10]="Timestamp",i[i.Interval=11]="Interval",i[i.List=12]="List",i[i.Struct=13]="Struct",i[i.Union=14]="Union",i[i.FixedSizeBinary=15]="FixedSizeBinary",i[i.FixedSizeList=16]="FixedSizeList",i[i.Map=17]="Map",i[i.Duration=18]="Duration",i[i.Dictionary=-1]="Dictionary",i[i.Int8=-2]="Int8",i[i.Int16=-3]="Int16",i[i.Int32=-4]="Int32",i[i.Int64=-5]="Int64",i[i.Uint8=-6]="Uint8",i[i.Uint16=-7]="Uint16",i[i.Uint32=-8]="Uint32",i[i.Uint64=-9]="Uint64",i[i.Float16=-10]="Float16",i[i.Float32=-11]="Float32",i[i.Float64=-12]="Float64",i[i.DateDay=-13]="DateDay",i[i.DateMillisecond=-14]="DateMillisecond",i[i.TimestampSecond=-15]="TimestampSecond",i[i.TimestampMillisecond=-16]="TimestampMillisecond",i[i.TimestampMicrosecond=-17]="TimestampMicrosecond",i[i.TimestampNanosecond=-18]="TimestampNanosecond",i[i.TimeSecond=-19]="TimeSecond",i[i.TimeMillisecond=-20]="TimeMillisecond",i[i.TimeMicrosecond=-21]="TimeMicrosecond",i[i.TimeNanosecond=-22]="TimeNanosecond",i[i.DenseUnion=-23]="DenseUnion",i[i.SparseUnion=-24]="SparseUnion",i[i.IntervalDayTime=-25]="IntervalDayTime",i[i.IntervalYearMonth=-26]="IntervalYearMonth",i[i.DurationSecond=-27]="DurationSecond",i[i.DurationMillisecond=-28]="DurationMillisecond",i[i.DurationMicrosecond=-29]="DurationMicrosecond",i[i.DurationNanosecond=-30]="DurationNanosecond"})(u||(u={}));var bt;(function(i){i[i.OFFSET=0]="OFFSET",i[i.DATA=1]="DATA",i[i.VALIDITY=2]="VALIDITY",i[i.TYPE=3]="TYPE"})(bt||(bt={}));const Lc=void 0;function le(i){if(i===null)return"null";if(i===Lc)return"undefined";switch(typeof i){case"number":return`${i}`;case"bigint":return`${i}`;case"string":return`"${i}"`}return typeof i[Symbol.toPrimitive]=="function"?i[Symbol.toPrimitive]("string"):ArrayBuffer.isView(i)?i instanceof BigInt64Array||i instanceof BigUint64Array?`[${[...i].map(t=>le(t))}]`:`[${i}]`:ArrayBuffer.isView(i)?`[${i}]`:JSON.stringify(i,(t,e)=>typeof e=="bigint"?`${e}`:e)}const Uc=Object.freeze(Object.defineProperty({__proto__:null,valueToString:le},Symbol.toStringTag,{value:"Module"})),Cr=Symbol.for("isArrowBigNum");function Dt(i,...t){return t.length===0?Object.setPrototypeOf(N(this.TypedArray,i),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(i,...t),this.constructor.prototype)}Dt.prototype[Cr]=!0;Dt.prototype.toJSON=function(){return`"${Ke(this)}"`};Dt.prototype.valueOf=function(){return Er(this)};Dt.prototype.toString=function(){return Ke(this)};Dt.prototype[Symbol.toPrimitive]=function(i="default"){switch(i){case"number":return Er(this);case"string":return Ke(this);case"default":return Vr(this)}return Ke(this)};function Pe(...i){return Dt.apply(this,i)}function $e(...i){return Dt.apply(this,i)}function li(...i){return Dt.apply(this,i)}Object.setPrototypeOf(Pe.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf($e.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(li.prototype,Object.create(Uint32Array.prototype));Object.assign(Pe.prototype,Dt.prototype,{constructor:Pe,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign($e.prototype,Dt.prototype,{constructor:$e,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(li.prototype,Dt.prototype,{constructor:li,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function Er(i){const{buffer:t,byteOffset:e,length:n,signed:s}=i,r=new BigUint64Array(t,e,n),o=s&&r.at(-1)&BigInt(1)<<BigInt(63);let a=BigInt(o?1:0),c=BigInt(0);if(o){for(const l of r)a+=~l*(BigInt(1)<<BigInt(32)*c++);a*=BigInt(-1)}else for(const l of r)a+=l*(BigInt(1)<<BigInt(32)*c++);return a}const Ke=i=>{if(i.byteLength===8)return`${new i.BigIntArray(i.buffer,i.byteOffset,1)[0]}`;if(!i.signed)return Sn(i);let t=new Uint16Array(i.buffer,i.byteOffset,i.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Sn(i);t=t.slice();let n=1;for(let r=0;r<t.length;r++){const o=t[r],a=~o+n;t[r]=a,n&=o===0?1:0}return`-${Sn(t)}`},Vr=i=>i.byteLength===8?new i.BigIntArray(i.buffer,i.byteOffset,1)[0]:Ke(i);function Sn(i){let t="";const e=new Uint32Array(2);let n=new Uint16Array(i.buffer,i.byteOffset,i.byteLength/2);const s=new Uint32Array((n=new Uint16Array(n).reverse()).buffer);let r=-1;const o=n.length-1;do{for(e[0]=n[r=0];r<o;)n[r++]=e[1]=e[0]/10,e[0]=(e[0]-e[1]*10<<16)+n[r];n[r]=e[1]=e[0]/10,e[0]=e[0]-e[1]*10,t=`${e[0]}${t}`}while(s[0]||s[1]||s[2]||s[3]);return t??"0"}class vi{static new(t,e){switch(e){case!0:return new Pe(t);case!1:return new $e(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Pe(t)}return t.byteLength===16?new li(t):new $e(t)}static signed(t){return new Pe(t)}static unsigned(t){return new $e(t)}static decimal(t){return new li(t)}constructor(t,e){return vi.new(t,e)}}const xc=Object.freeze(Object.defineProperty({__proto__:null,BN:vi,bigNumToBigInt:Vr,bigNumToString:Ke,isArrowBigNumSymbol:Cr},Symbol.toStringTag,{value:"Module"}));function Bt(i){if(typeof i=="bigint"&&(i<Number.MIN_SAFE_INTEGER||i>Number.MAX_SAFE_INTEGER))throw new TypeError(`${i} is not safe to convert to a number.`);return Number(i)}var Rr,zr,jr,kr,Pr,$r,Wr,Yr,Jr,Hr,Kr,qr,Gr,Zr,Qr,Xr,to,eo,io,no;class y{static isNull(t){return t?.typeId===u.Null}static isInt(t){return t?.typeId===u.Int}static isFloat(t){return t?.typeId===u.Float}static isBinary(t){return t?.typeId===u.Binary}static isUtf8(t){return t?.typeId===u.Utf8}static isBool(t){return t?.typeId===u.Bool}static isDecimal(t){return t?.typeId===u.Decimal}static isDate(t){return t?.typeId===u.Date}static isTime(t){return t?.typeId===u.Time}static isTimestamp(t){return t?.typeId===u.Timestamp}static isInterval(t){return t?.typeId===u.Interval}static isDuration(t){return t?.typeId===u.Duration}static isList(t){return t?.typeId===u.List}static isStruct(t){return t?.typeId===u.Struct}static isUnion(t){return t?.typeId===u.Union}static isFixedSizeBinary(t){return t?.typeId===u.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===u.FixedSizeList}static isMap(t){return t?.typeId===u.Map}static isDictionary(t){return t?.typeId===u.Dictionary}static isDenseUnion(t){return y.isUnion(t)&&t.mode===$.Dense}static isSparseUnion(t){return y.isUnion(t)&&t.mode===$.Sparse}get typeId(){return u.NONE}}Rr=Symbol.toStringTag;y[Rr]=(i=>(i.children=null,i.ArrayType=Array,i[Symbol.toStringTag]="DataType"))(y.prototype);let Vt=class extends y{toString(){return"Null"}get typeId(){return u.Null}};zr=Symbol.toStringTag;Vt[zr]=(i=>i[Symbol.toStringTag]="Null")(Vt.prototype);class Q extends y{constructor(t,e){super(),this.isSigned=t,this.bitWidth=e}get typeId(){return u.Int}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}`}}jr=Symbol.toStringTag;Q[jr]=(i=>(i.isSigned=null,i.bitWidth=null,i[Symbol.toStringTag]="Int"))(Q.prototype);class kn extends Q{constructor(){super(!0,8)}get ArrayType(){return Int8Array}}class Pn extends Q{constructor(){super(!0,16)}get ArrayType(){return Int16Array}}class ue extends Q{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}let cn=class extends Q{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}};class $n extends Q{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}}class Wn extends Q{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}}class Yn extends Q{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}}let Jn=class extends Q{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(kn.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(Pn.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(ue.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(cn.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty($n.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Wn.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Yn.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Jn.prototype,"ArrayType",{value:BigUint64Array});class qt extends y{constructor(t){super(),this.precision=t}get typeId(){return u.Float}get ArrayType(){switch(this.precision){case H.HALF:return Uint16Array;case H.SINGLE:return Float32Array;case H.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}kr=Symbol.toStringTag;qt[kr]=(i=>(i.precision=null,i[Symbol.toStringTag]="Float"))(qt.prototype);class so extends qt{constructor(){super(H.HALF)}}class Hn extends qt{constructor(){super(H.SINGLE)}}class ln extends qt{constructor(){super(H.DOUBLE)}}Object.defineProperty(so.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Hn.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(ln.prototype,"ArrayType",{value:Float64Array});let ui=class extends y{constructor(){super()}get typeId(){return u.Binary}toString(){return"Binary"}};Pr=Symbol.toStringTag;ui[Pr]=(i=>(i.ArrayType=Uint8Array,i[Symbol.toStringTag]="Binary"))(ui.prototype);let qe=class extends y{constructor(){super()}get typeId(){return u.Utf8}toString(){return"Utf8"}};$r=Symbol.toStringTag;qe[$r]=(i=>(i.ArrayType=Uint8Array,i[Symbol.toStringTag]="Utf8"))(qe.prototype);let Ge=class extends y{constructor(){super()}get typeId(){return u.Bool}toString(){return"Bool"}};Wr=Symbol.toStringTag;Ge[Wr]=(i=>(i.ArrayType=Uint8Array,i[Symbol.toStringTag]="Bool"))(Ge.prototype);let hi=class extends y{constructor(t,e,n=128){super(),this.scale=t,this.precision=e,this.bitWidth=n}get typeId(){return u.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};Yr=Symbol.toStringTag;hi[Yr]=(i=>(i.scale=null,i.precision=null,i.ArrayType=Uint32Array,i[Symbol.toStringTag]="Decimal"))(hi.prototype);class Be extends y{constructor(t){super(),this.unit=t}get typeId(){return u.Date}toString(){return`Date${(this.unit+1)*32}<${rt[this.unit]}>`}}Jr=Symbol.toStringTag;Be[Jr]=(i=>(i.unit=null,i.ArrayType=Int32Array,i[Symbol.toStringTag]="Date"))(Be.prototype);class Cc extends Be{constructor(){super(rt.DAY)}}class ro extends Be{constructor(){super(rt.MILLISECOND)}}class Rt extends y{constructor(t,e){super(),this.unit=t,this.bitWidth=e}get typeId(){return u.Time}toString(){return`Time${this.bitWidth}<${f[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}Hr=Symbol.toStringTag;Rt[Hr]=(i=>(i.unit=null,i.bitWidth=null,i[Symbol.toStringTag]="Time"))(Rt.prototype);class Ec extends Rt{constructor(){super(f.SECOND,32)}}class Vc extends Rt{constructor(){super(f.MILLISECOND,32)}}class Rc extends Rt{constructor(){super(f.MICROSECOND,64)}}class zc extends Rt{constructor(){super(f.NANOSECOND,64)}}class Gt extends y{constructor(t,e){super(),this.unit=t,this.timezone=e}get typeId(){return u.Timestamp}toString(){return`Timestamp<${f[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}Kr=Symbol.toStringTag;Gt[Kr]=(i=>(i.unit=null,i.timezone=null,i.ArrayType=Int32Array,i[Symbol.toStringTag]="Timestamp"))(Gt.prototype);class jc extends Gt{constructor(t){super(f.SECOND,t)}}class kc extends Gt{constructor(t){super(f.MILLISECOND,t)}}class Pc extends Gt{constructor(t){super(f.MICROSECOND,t)}}class $c extends Gt{constructor(t){super(f.NANOSECOND,t)}}class Ae extends y{constructor(t){super(),this.unit=t}get typeId(){return u.Interval}toString(){return`Interval<${pt[this.unit]}>`}}qr=Symbol.toStringTag;Ae[qr]=(i=>(i.unit=null,i.ArrayType=Int32Array,i[Symbol.toStringTag]="Interval"))(Ae.prototype);class Wc extends Ae{constructor(){super(pt.DAY_TIME)}}class Yc extends Ae{constructor(){super(pt.YEAR_MONTH)}}let Zt=class extends y{constructor(t){super(),this.unit=t}get typeId(){return u.Duration}toString(){return`Duration<${f[this.unit]}>`}};Gr=Symbol.toStringTag;Zt[Gr]=(i=>(i.unit=null,i.ArrayType=BigInt64Array,i[Symbol.toStringTag]="Duration"))(Zt.prototype);class Jc extends Zt{constructor(){super(f.SECOND)}}class Hc extends Zt{constructor(){super(f.MILLISECOND)}}class Kc extends Zt{constructor(){super(f.MICROSECOND)}}class qc extends Zt{constructor(){super(f.NANOSECOND)}}let De=class extends y{constructor(t){super(),this.children=[t]}get typeId(){return u.List}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};Zr=Symbol.toStringTag;De[Zr]=(i=>(i.children=null,i[Symbol.toStringTag]="List"))(De.prototype);class q extends y{constructor(t){super(),this.children=t}get typeId(){return u.Struct}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}Qr=Symbol.toStringTag;q[Qr]=(i=>(i.children=null,i[Symbol.toStringTag]="Struct"))(q.prototype);class he extends y{constructor(t,e,n){super(),this.mode=t,this.children=n,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((s,r,o)=>(s[r]=o)&&s||s,Object.create(null))}get typeId(){return u.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}}Xr=Symbol.toStringTag;he[Xr]=(i=>(i.mode=null,i.typeIds=null,i.children=null,i.typeIdToChildIndex=null,i.ArrayType=Int8Array,i[Symbol.toStringTag]="Union"))(he.prototype);class Gc extends he{constructor(t,e){super($.Dense,t,e)}}class Zc extends he{constructor(t,e){super($.Sparse,t,e)}}let di=class extends y{constructor(t){super(),this.byteWidth=t}get typeId(){return u.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};to=Symbol.toStringTag;di[to]=(i=>(i.byteWidth=null,i.ArrayType=Uint8Array,i[Symbol.toStringTag]="FixedSizeBinary"))(di.prototype);let Ze=class extends y{constructor(t,e){super(),this.listSize=t,this.children=[e]}get typeId(){return u.FixedSizeList}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}>`}};eo=Symbol.toStringTag;Ze[eo]=(i=>(i.children=null,i.listSize=null,i[Symbol.toStringTag]="FixedSizeList"))(Ze.prototype);class Qe extends y{constructor(t,e=!1){var n,s,r;if(super(),this.children=[t],this.keysSorted=e,t&&(t.name="entries",!((n=t?.type)===null||n===void 0)&&n.children)){const o=(s=t?.type)===null||s===void 0?void 0:s.children[0];o&&(o.name="key");const a=(r=t?.type)===null||r===void 0?void 0:r.children[1];a&&(a.name="value")}}get typeId(){return u.Map}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(", ")}}>`}}io=Symbol.toStringTag;Qe[io]=(i=>(i.children=null,i.keysSorted=null,i[Symbol.toStringTag]="Map_"))(Qe.prototype);const Qc=(i=>()=>++i)(-1);class Qt extends y{constructor(t,e,n,s){super(),this.indices=e,this.dictionary=t,this.isOrdered=s||!1,this.id=n==null?Qc():Bt(n)}get typeId(){return u.Dictionary}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}no=Symbol.toStringTag;Qt[no]=(i=>(i.id=null,i.indices=null,i.isOrdered=null,i.dictionary=null,i[Symbol.toStringTag]="Dictionary"))(Qt.prototype);function Mt(i){const t=i;switch(i.typeId){case u.Decimal:return i.bitWidth/32;case u.Timestamp:return 2;case u.Date:return 1+t.unit;case u.Interval:return 1+t.unit;case u.FixedSizeList:return t.listSize;case u.FixedSizeBinary:return t.byteWidth;default:return 1}}class F{visitMany(t,...e){return t.map((n,s)=>this.visit(n,...e.map(r=>r[s])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return Xc(this,t,e)}getVisitFnByTypeId(t,e=!0){return Ve(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}visitBinary(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 Xc(i,t,e=!0){return typeof t=="number"?Ve(i,t,e):typeof t=="string"&&t in u?Ve(i,u[t],e):t&&t instanceof y?Ve(i,or(t),e):t?.type&&t.type instanceof y?Ve(i,or(t.type),e):Ve(i,u.NONE,e)}function Ve(i,t,e=!0){let n=null;switch(t){case u.Null:n=i.visitNull;break;case u.Bool:n=i.visitBool;break;case u.Int:n=i.visitInt;break;case u.Int8:n=i.visitInt8||i.visitInt;break;case u.Int16:n=i.visitInt16||i.visitInt;break;case u.Int32:n=i.visitInt32||i.visitInt;break;case u.Int64:n=i.visitInt64||i.visitInt;break;case u.Uint8:n=i.visitUint8||i.visitInt;break;case u.Uint16:n=i.visitUint16||i.visitInt;break;case u.Uint32:n=i.visitUint32||i.visitInt;break;case u.Uint64:n=i.visitUint64||i.visitInt;break;case u.Float:n=i.visitFloat;break;case u.Float16:n=i.visitFloat16||i.visitFloat;break;case u.Float32:n=i.visitFloat32||i.visitFloat;break;case u.Float64:n=i.visitFloat64||i.visitFloat;break;case u.Utf8:n=i.visitUtf8;break;case u.Binary:n=i.visitBinary;break;case u.FixedSizeBinary:n=i.visitFixedSizeBinary;break;case u.Date:n=i.visitDate;break;case u.DateDay:n=i.visitDateDay||i.visitDate;break;case u.DateMillisecond:n=i.visitDateMillisecond||i.visitDate;break;case u.Timestamp:n=i.visitTimestamp;break;case u.TimestampSecond:n=i.visitTimestampSecond||i.visitTimestamp;break;case u.TimestampMillisecond:n=i.visitTimestampMillisecond||i.visitTimestamp;break;case u.TimestampMicrosecond:n=i.visitTimestampMicrosecond||i.visitTimestamp;break;case u.TimestampNanosecond:n=i.visitTimestampNanosecond||i.visitTimestamp;break;case u.Time:n=i.visitTime;break;case u.TimeSecond:n=i.visitTimeSecond||i.visitTime;break;case u.TimeMillisecond:n=i.visitTimeMillisecond||i.visitTime;break;case u.TimeMicrosecond:n=i.visitTimeMicrosecond||i.visitTime;break;case u.TimeNanosecond:n=i.visitTimeNanosecond||i.visitTime;break;case u.Decimal:n=i.visitDecimal;break;case u.List:n=i.visitList;break;case u.Struct:n=i.visitStruct;break;case u.Union:n=i.visitUnion;break;case u.DenseUnion:n=i.visitDenseUnion||i.visitUnion;break;case u.SparseUnion:n=i.visitSparseUnion||i.visitUnion;break;case u.Dictionary:n=i.visitDictionary;break;case u.Interval:n=i.visitInterval;break;case u.IntervalDayTime:n=i.visitIntervalDayTime||i.visitInterval;break;case u.IntervalYearMonth:n=i.visitIntervalYearMonth||i.visitInterval;break;case u.Duration:n=i.visitDuration;break;case u.DurationSecond:n=i.visitDurationSecond||i.visitDuration;break;case u.DurationMillisecond:n=i.visitDurationMillisecond||i.visitDuration;break;case u.DurationMicrosecond:n=i.visitDurationMicrosecond||i.visitDuration;break;case u.DurationNanosecond:n=i.visitDurationNanosecond||i.visitDuration;break;case u.FixedSizeList:n=i.visitFixedSizeList;break;case u.Map:n=i.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error(`Unrecognized type '${u[t]}'`)}function or(i){switch(i.typeId){case u.Null:return u.Null;case u.Int:{const{bitWidth:t,isSigned:e}=i;switch(t){case 8:return e?u.Int8:u.Uint8;case 16:return e?u.Int16:u.Uint16;case 32:return e?u.Int32:u.Uint32;case 64:return e?u.Int64:u.Uint64}return u.Int}case u.Float:switch(i.precision){case H.HALF:return u.Float16;case H.SINGLE:return u.Float32;case H.DOUBLE:return u.Float64}return u.Float;case u.Binary:return u.Binary;case u.Utf8:return u.Utf8;case u.Bool:return u.Bool;case u.Decimal:return u.Decimal;case u.Time:switch(i.unit){case f.SECOND:return u.TimeSecond;case f.MILLISECOND:return u.TimeMillisecond;case f.MICROSECOND:return u.TimeMicrosecond;case f.NANOSECOND:return u.TimeNanosecond}return u.Time;case u.Timestamp:switch(i.unit){case f.SECOND:return u.TimestampSecond;case f.MILLISECOND:return u.TimestampMillisecond;case f.MICROSECOND:return u.TimestampMicrosecond;case f.NANOSECOND:return u.TimestampNanosecond}return u.Timestamp;case u.Date:switch(i.unit){case rt.DAY:return u.DateDay;case rt.MILLISECOND:return u.DateMillisecond}return u.Date;case u.Interval:switch(i.unit){case pt.DAY_TIME:return u.IntervalDayTime;case pt.YEAR_MONTH:return u.IntervalYearMonth}return u.Interval;case u.Duration:switch(i.unit){case f.SECOND:return u.DurationSecond;case f.MILLISECOND:return u.DurationMillisecond;case f.MICROSECOND:return u.DurationMicrosecond;case f.NANOSECOND:return u.DurationNanosecond}return u.Duration;case u.Map:return u.Map;case u.List:return u.List;case u.Struct:return u.Struct;case u.Union:switch(i.mode){case $.Dense:return u.DenseUnion;case $.Sparse:return u.SparseUnion}return u.Union;case u.FixedSizeBinary:return u.FixedSizeBinary;case u.FixedSizeList:return u.FixedSizeList;case u.Dictionary:return u.Dictionary}throw new Error(`Unrecognized type '${u[i.typeId]}'`)}F.prototype.visitInt8=null;F.prototype.visitInt16=null;F.prototype.visitInt32=null;F.prototype.visitInt64=null;F.prototype.visitUint8=null;F.prototype.visitUint16=null;F.prototype.visitUint32=null;F.prototype.visitUint64=null;F.prototype.visitFloat16=null;F.prototype.visitFloat32=null;F.prototype.visitFloat64=null;F.prototype.visitDateDay=null;F.prototype.visitDateMillisecond=null;F.prototype.visitTimestampSecond=null;F.prototype.visitTimestampMillisecond=null;F.prototype.visitTimestampMicrosecond=null;F.prototype.visitTimestampNanosecond=null;F.prototype.visitTimeSecond=null;F.prototype.visitTimeMillisecond=null;F.prototype.visitTimeMicrosecond=null;F.prototype.visitTimeNanosecond=null;F.prototype.visitDenseUnion=null;F.prototype.visitSparseUnion=null;F.prototype.visitIntervalDayTime=null;F.prototype.visitIntervalYearMonth=null;F.prototype.visitDuration=null;F.prototype.visitDurationSecond=null;F.prototype.visitDurationMillisecond=null;F.prototype.visitDurationMicrosecond=null;F.prototype.visitDurationNanosecond=null;const oo=new Float64Array(1),xe=new Uint32Array(oo.buffer);function Kn(i){const t=(i&31744)>>10,e=(i&1023)/1024,n=Math.pow(-1,(i&32768)>>15);switch(t){case 31:return n*(e?Number.NaN:1/0);case 0:return n*(e?6103515625e-14*e:0)}return n*Math.pow(2,t-15)*(1+e)}function qn(i){if(i!==i)return 32256;oo[0]=i;const t=(xe[1]&2147483648)>>16&65535;let e=xe[1]&2146435072,n=0;return e>=1089470464?xe[0]>0?e=31744:(e=(e&2080374784)>>16,n=(xe[1]&1048575)>>10):e<=1056964608?(n=1048576+(xe[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(xe[1]&1048575)+512>>10),t|e|n&65535}const tl=Object.freeze(Object.defineProperty({__proto__:null,float64ToUint16:qn,uint16ToFloat64:Kn},Symbol.toStringTag,{value:"Module"}));class I extends F{}function A(i){return(t,e,n)=>{if(t.setValid(e,n!=null))return i(t,e,n)}}const el=(i,t,e)=>{i[t]=Math.trunc(e/864e5)},Gn=(i,t,e)=>{i[t]=Math.trunc(e%4294967296),i[t+1]=Math.trunc(e/4294967296)},il=(i,t,e)=>{i[t]=Math.trunc(e*1e3%4294967296),i[t+1]=Math.trunc(e*1e3/4294967296)},nl=(i,t,e)=>{i[t]=Math.trunc(e*1e6%4294967296),i[t+1]=Math.trunc(e*1e6/4294967296)},ao=(i,t,e,n)=>{if(e+1<t.length){const{[e]:s,[e+1]:r}=t;i.set(n.subarray(0,r-s),s)}},sl=({offset:i,values:t},e,n)=>{const s=i+e;n?t[s>>3]|=1<<s%8:t[s>>3]&=~(1<<s%8)},Xt=({values:i},t,e)=>{i[t]=e},Zn=({values:i},t,e)=>{i[t]=e},co=({values:i},t,e)=>{i[t]=qn(e)},rl=(i,t,e)=>{switch(i.type.precision){case H.HALF:return co(i,t,e);case H.SINGLE:case H.DOUBLE:return Zn(i,t,e)}},Qn=({values:i},t,e)=>{el(i,t,e.valueOf())},Xn=({values:i},t,e)=>{Gn(i,t*2,e.valueOf())},lo=({stride:i,values:t},e,n)=>{t.set(n.subarray(0,i),i*e)},ol=({values:i,valueOffsets:t},e,n)=>ao(i,t,e,n),al=({values:i,valueOffsets:t},e,n)=>{ao(i,t,e,on(n))},uo=(i,t,e)=>{i.type.unit===rt.DAY?Qn(i,t,e):Xn(i,t,e)},ts=({values:i},t,e)=>Gn(i,t*2,e/1e3),es=({values:i},t,e)=>Gn(i,t*2,e),is=({values:i},t,e)=>il(i,t*2,e),ns=({values:i},t,e)=>nl(i,t*2,e),ho=(i,t,e)=>{switch(i.type.unit){case f.SECOND:return ts(i,t,e);case f.MILLISECOND:return es(i,t,e);case f.MICROSECOND:return is(i,t,e);case f.NANOSECOND:return ns(i,t,e)}},ss=({values:i},t,e)=>{i[t]=e},rs=({values:i},t,e)=>{i[t]=e},os=({values:i},t,e)=>{i[t]=e},as=({values:i},t,e)=>{i[t]=e},fo=(i,t,e)=>{switch(i.type.unit){case f.SECOND:return ss(i,t,e);case f.MILLISECOND:return rs(i,t,e);case f.MICROSECOND:return os(i,t,e);case f.NANOSECOND:return as(i,t,e)}},yo=({values:i,stride:t},e,n)=>{i.set(n.subarray(0,t),t*e)},cl=(i,t,e)=>{const n=i.children[0],s=i.valueOffsets,r=gt.getVisitFn(n);if(Array.isArray(e))for(let o=-1,a=s[t],c=s[t+1];a<c;)r(n,a++,e[++o]);else for(let o=-1,a=s[t],c=s[t+1];a<c;)r(n,a++,e.get(++o))},ll=(i,t,e)=>{const n=i.children[0],{valueOffsets:s}=i,r=gt.getVisitFn(n);let{[t]:o,[t+1]:a}=s;const c=e instanceof Map?e.entries():Object.entries(e);for(const l of c)if(r(n,o,l),++o>=a)break},ul=(i,t)=>(e,n,s,r)=>n&&e(n,i,t[r]),hl=(i,t)=>(e,n,s,r)=>n&&e(n,i,t.get(r)),dl=(i,t)=>(e,n,s,r)=>n&&e(n,i,t.get(s.name)),fl=(i,t)=>(e,n,s,r)=>n&&e(n,i,t[s.name]),yl=(i,t,e)=>{const n=i.type.children.map(r=>gt.getVisitFn(r.type)),s=e instanceof Map?dl(t,e):e instanceof g?hl(t,e):Array.isArray(e)?ul(t,e):fl(t,e);i.type.children.forEach((r,o)=>s(n[o],i.children[o],r,o))},pl=(i,t,e)=>{i.type.mode===$.Dense?po(i,t,e):go(i,t,e)},po=(i,t,e)=>{const n=i.type.typeIdToChildIndex[i.typeIds[t]],s=i.children[n];gt.visit(s,i.valueOffsets[t],e)},go=(i,t,e)=>{const n=i.type.typeIdToChildIndex[i.typeIds[t]],s=i.children[n];gt.visit(s,t,e)},gl=(i,t,e)=>{var n;(n=i.dictionary)===null||n===void 0||n.set(i.values[t],e)},mo=(i,t,e)=>{i.type.unit===pt.DAY_TIME?cs(i,t,e):ls(i,t,e)},cs=({values:i},t,e)=>{i.set(e.subarray(0,2),2*t)},ls=({values:i},t,e)=>{i[t]=e[0]*12+e[1]%12},us=({values:i},t,e)=>{i[t]=e},hs=({values:i},t,e)=>{i[t]=e},ds=({values:i},t,e)=>{i[t]=e},fs=({values:i},t,e)=>{i[t]=e},bo=(i,t,e)=>{switch(i.type.unit){case f.SECOND:return us(i,t,e);case f.MILLISECOND:return hs(i,t,e);case f.MICROSECOND:return ds(i,t,e);case f.NANOSECOND:return fs(i,t,e)}},ml=(i,t,e)=>{const{stride:n}=i,s=i.children[0],r=gt.getVisitFn(s);if(Array.isArray(e))for(let o=-1,a=t*n;++o<n;)r(s,a+o,e[o]);else for(let o=-1,a=t*n;++o<n;)r(s,a+o,e.get(o))};I.prototype.visitBool=A(sl);I.prototype.visitInt=A(Xt);I.prototype.visitInt8=A(Xt);I.prototype.visitInt16=A(Xt);I.prototype.visitInt32=A(Xt);I.prototype.visitInt64=A(Xt);I.prototype.visitUint8=A(Xt);I.prototype.visitUint16=A(Xt);I.prototype.visitUint32=A(Xt);I.prototype.visitUint64=A(Xt);I.prototype.visitFloat=A(rl);I.prototype.visitFloat16=A(co);I.prototype.visitFloat32=A(Zn);I.prototype.visitFloat64=A(Zn);I.prototype.visitUtf8=A(al);I.prototype.visitBinary=A(ol);I.prototype.visitFixedSizeBinary=A(lo);I.prototype.visitDate=A(uo);I.prototype.visitDateDay=A(Qn);I.prototype.visitDateMillisecond=A(Xn);I.prototype.visitTimestamp=A(ho);I.prototype.visitTimestampSecond=A(ts);I.prototype.visitTimestampMillisecond=A(es);I.prototype.visitTimestampMicrosecond=A(is);I.prototype.visitTimestampNanosecond=A(ns);I.prototype.visitTime=A(fo);I.prototype.visitTimeSecond=A(ss);I.prototype.visitTimeMillisecond=A(rs);I.prototype.visitTimeMicrosecond=A(os);I.prototype.visitTimeNanosecond=A(as);I.prototype.visitDecimal=A(yo);I.prototype.visitList=A(cl);I.prototype.visitStruct=A(yl);I.prototype.visitUnion=A(pl);I.prototype.visitDenseUnion=A(po);I.prototype.visitSparseUnion=A(go);I.prototype.visitDictionary=A(gl);I.prototype.visitInterval=A(mo);I.prototype.visitIntervalDayTime=A(cs);I.prototype.visitIntervalYearMonth=A(ls);I.prototype.visitDuration=A(bo);I.prototype.visitDurationSecond=A(us);I.prototype.visitDurationMillisecond=A(hs);I.prototype.visitDurationMicrosecond=A(ds);I.prototype.visitDurationNanosecond=A(fs);I.prototype.visitFixedSizeList=A(ml);I.prototype.visitMap=A(ll);const gt=new I,_t=Symbol.for("parent"),We=Symbol.for("rowIndex");class un{constructor(t,e){return this[_t]=t,this[We]=e,new Proxy(this,new _l)}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[We],e=this[_t],n=e.type.children,s={};for(let r=-1,o=n.length;++r<o;)s[n[r].name]=ot.visit(e.children[r],t);return s}toString(){return`{${[...this].map(([t,e])=>`${le(t)}: ${le(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new bl(this[_t],this[We])}}class bl{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,ot.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}}Object.defineProperties(un.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[_t]:{writable:!0,enumerable:!1,configurable:!1,value:null},[We]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});class _l{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[_t].type.children.map(e=>e.name)}has(t,e){return t[_t].type.children.findIndex(n=>n.name===e)!==-1}getOwnPropertyDescriptor(t,e){if(t[_t].type.children.findIndex(n=>n.name===e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const n=t[_t].type.children.findIndex(s=>s.name===e);if(n!==-1){const s=ot.visit(t[_t].children[n],t[We]);return Reflect.set(t,e,s),s}}set(t,e,n){const s=t[_t].type.children.findIndex(r=>r.name===e);return s!==-1?(gt.visit(t[_t].children[s],t[We],n),Reflect.set(t,e,n)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,n):!1}}class b extends F{}function S(i){return(t,e)=>t.getValid(e)?i(t,e):null}const vl=(i,t)=>864e5*i[t],ys=(i,t)=>4294967296*i[t+1]+(i[t]>>>0),wl=(i,t)=>4294967296*(i[t+1]/1e3)+(i[t]>>>0)/1e3,Il=(i,t)=>4294967296*(i[t+1]/1e6)+(i[t]>>>0)/1e6,_o=i=>new Date(i),Sl=(i,t)=>_o(vl(i,t)),Bl=(i,t)=>_o(ys(i,t)),Al=(i,t)=>null,vo=(i,t,e)=>{if(e+1>=t.length)return null;const n=t[e],s=t[e+1];return i.subarray(n,s)},Dl=({offset:i,values:t},e)=>{const n=i+e;return(t[n>>3]&1<<n%8)!==0},wo=({values:i},t)=>Sl(i,t),Io=({values:i},t)=>Bl(i,t*2),pe=({stride:i,values:t},e)=>t[i*e],Ol=({stride:i,values:t},e)=>Kn(t[i*e]),So=({values:i},t)=>i[t],Fl=({stride:i,values:t},e)=>t.subarray(i*e,i*(e+1)),Ml=({values:i,valueOffsets:t},e)=>vo(i,t,e),Tl=({values:i,valueOffsets:t},e)=>{const n=vo(i,t,e);return n!==null?Fn(n):null},Nl=({values:i},t)=>i[t],Ll=({type:i,values:t},e)=>i.precision!==H.HALF?t[e]:Kn(t[e]),Ul=(i,t)=>i.type.unit===rt.DAY?wo(i,t):Io(i,t),Bo=({values:i},t)=>1e3*ys(i,t*2),Ao=({values:i},t)=>ys(i,t*2),Do=({values:i},t)=>wl(i,t*2),Oo=({values:i},t)=>Il(i,t*2),xl=(i,t)=>{switch(i.type.unit){case f.SECOND:return Bo(i,t);case f.MILLISECOND:return Ao(i,t);case f.MICROSECOND:return Do(i,t);case f.NANOSECOND:return Oo(i,t)}},Fo=({values:i},t)=>i[t],Mo=({values:i},t)=>i[t],To=({values:i},t)=>i[t],No=({values:i},t)=>i[t],Cl=(i,t)=>{switch(i.type.unit){case f.SECOND:return Fo(i,t);case f.MILLISECOND:return Mo(i,t);case f.MICROSECOND:return To(i,t);case f.NANOSECOND:return No(i,t)}},El=({values:i,stride:t},e)=>vi.decimal(i.subarray(t*e,t*(e+1))),Vl=(i,t)=>{const{valueOffsets:e,stride:n,children:s}=i,{[t*n]:r,[t*n+1]:o}=e,c=s[0].slice(r,o-r);return new g([c])},Rl=(i,t)=>{const{valueOffsets:e,children:n}=i,{[t]:s,[t+1]:r}=e,o=n[0];return new wi(o.slice(s,r-s))},zl=(i,t)=>new un(i,t),jl=(i,t)=>i.type.mode===$.Dense?Lo(i,t):Uo(i,t),Lo=(i,t)=>{const e=i.type.typeIdToChildIndex[i.typeIds[t]],n=i.children[e];return ot.visit(n,i.valueOffsets[t])},Uo=(i,t)=>{const e=i.type.typeIdToChildIndex[i.typeIds[t]],n=i.children[e];return ot.visit(n,t)},kl=(i,t)=>{var e;return(e=i.dictionary)===null||e===void 0?void 0:e.get(i.values[t])},Pl=(i,t)=>i.type.unit===pt.DAY_TIME?xo(i,t):Co(i,t),xo=({values:i},t)=>i.subarray(2*t,2*(t+1)),Co=({values:i},t)=>{const e=i[t],n=new Int32Array(2);return n[0]=Math.trunc(e/12),n[1]=Math.trunc(e%12),n},Eo=({values:i},t)=>i[t],Vo=({values:i},t)=>i[t],Ro=({values:i},t)=>i[t],zo=({values:i},t)=>i[t],$l=(i,t)=>{switch(i.type.unit){case f.SECOND:return Eo(i,t);case f.MILLISECOND:return Vo(i,t);case f.MICROSECOND:return Ro(i,t);case f.NANOSECOND:return zo(i,t)}},Wl=(i,t)=>{const{stride:e,children:n}=i,r=n[0].slice(t*e,e);return new g([r])};b.prototype.visitNull=S(Al);b.prototype.visitBool=S(Dl);b.prototype.visitInt=S(Nl);b.prototype.visitInt8=S(pe);b.prototype.visitInt16=S(pe);b.prototype.visitInt32=S(pe);b.prototype.visitInt64=S(So);b.prototype.visitUint8=S(pe);b.prototype.visitUint16=S(pe);b.prototype.visitUint32=S(pe);b.prototype.visitUint64=S(So);b.prototype.visitFloat=S(Ll);b.prototype.visitFloat16=S(Ol);b.prototype.visitFloat32=S(pe);b.prototype.visitFloat64=S(pe);b.prototype.visitUtf8=S(Tl);b.prototype.visitBinary=S(Ml);b.prototype.visitFixedSizeBinary=S(Fl);b.prototype.visitDate=S(Ul);b.prototype.visitDateDay=S(wo);b.prototype.visitDateMillisecond=S(Io);b.prototype.visitTimestamp=S(xl);b.prototype.visitTimestampSecond=S(Bo);b.prototype.visitTimestampMillisecond=S(Ao);b.prototype.visitTimestampMicrosecond=S(Do);b.prototype.visitTimestampNanosecond=S(Oo);b.prototype.visitTime=S(Cl);b.prototype.visitTimeSecond=S(Fo);b.prototype.visitTimeMillisecond=S(Mo);b.prototype.visitTimeMicrosecond=S(To);b.prototype.visitTimeNanosecond=S(No);b.prototype.visitDecimal=S(El);b.prototype.visitList=S(Vl);b.prototype.visitStruct=S(zl);b.prototype.visitUnion=S(jl);b.prototype.visitDenseUnion=S(Lo);b.prototype.visitSparseUnion=S(Uo);b.prototype.visitDictionary=S(kl);b.prototype.visitInterval=S(Pl);b.prototype.visitIntervalDayTime=S(xo);b.prototype.visitIntervalYearMonth=S(Co);b.prototype.visitDuration=S($l);b.prototype.visitDurationSecond=S(Eo);b.prototype.visitDurationMillisecond=S(Vo);b.prototype.visitDurationMicrosecond=S(Ro);b.prototype.visitDurationNanosecond=S(zo);b.prototype.visitFixedSizeList=S(Wl);b.prototype.visitMap=S(Rl);const ot=new b,vt=Symbol.for("keys"),Ye=Symbol.for("vals");class wi{constructor(t){return this[vt]=new g([t.children[0]]).memoize(),this[Ye]=t.children[1],new Proxy(this,new Jl)}[Symbol.iterator](){return new Yl(this[vt],this[Ye])}get size(){return this[vt].length}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[vt],e=this[Ye],n={};for(let s=-1,r=t.length;++s<r;)n[t.get(s)]=ot.visit(e,s);return n}toString(){return`{${[...this].map(([t,e])=>`${le(t)}: ${le(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class Yl{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),ot.visit(this.vals,t)]})}}class Jl{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[vt].toArray().map(String)}has(t,e){return t[vt].includes(e)}getOwnPropertyDescriptor(t,e){if(t[vt].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const n=t[vt].indexOf(e);if(n!==-1){const s=ot.visit(Reflect.get(t,Ye),n);return Reflect.set(t,e,s),s}}set(t,e,n){const s=t[vt].indexOf(e);return s!==-1?(gt.visit(Reflect.get(t,Ye),s,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}}Object.defineProperties(wi.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[vt]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Ye]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function Hl(i,t,e){const n=i.length,s=t>-1?t:n+t%n;return e?e(i,s):s}let ar;function ps(i,t,e,n){const{length:s=0}=i;let r=typeof t!="number"?0:t,o=typeof e!="number"?s:e;return r<0&&(r=(r%s+s)%s),o<0&&(o=(o%s+s)%s),o<r&&(ar=r,r=o,o=ar),o>s&&(o=s),n?n(i,r,o):[r,o]}const cr=i=>i!==i;function Me(i){if(typeof i!=="object"||i===null)return cr(i)?cr:e=>e===i;if(i instanceof Date){const e=i.valueOf();return n=>n instanceof Date?n.valueOf()===e:!1}return ArrayBuffer.isView(i)?e=>e?xr(i,e):!1:i instanceof Map?ql(i):Array.isArray(i)?Kl(i):i instanceof g?Gl(i):Zl(i,!0)}function Kl(i){const t=[];for(let e=-1,n=i.length;++e<n;)t[e]=Me(i[e]);return hn(t)}function ql(i){let t=-1;const e=[];for(const n of i.values())e[++t]=Me(n);return hn(e)}function Gl(i){const t=[];for(let e=-1,n=i.length;++e<n;)t[e]=Me(i.get(e));return hn(t)}function Zl(i,t=!1){const e=Object.keys(i);if(!t&&e.length===0)return()=>!1;const n=[];for(let s=-1,r=e.length;++s<r;)n[s]=Me(i[e[s]]);return hn(n,e)}function hn(i,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return Ql(i,e);case Map:return lr(i,e,e.keys());case wi:case un:case Object:case void 0:return lr(i,e,t||Object.keys(e))}return e instanceof g?Xl(i,e):!1}}function Ql(i,t){const e=i.length;if(t.length!==e)return!1;for(let n=-1;++n<e;)if(!i[n](t[n]))return!1;return!0}function Xl(i,t){const e=i.length;if(t.length!==e)return!1;for(let n=-1;++n<e;)if(!i[n](t.get(n)))return!1;return!0}function lr(i,t,e){const n=e[Symbol.iterator](),s=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),r=t instanceof Map?t.values():Object.values(t)[Symbol.iterator]();let o=0;const a=i.length;let c=r.next(),l=n.next(),h=s.next();for(;o<a&&!l.done&&!h.done&&!c.done&&!(l.value!==h.value||!i[o](c.value));++o,l=n.next(),h=s.next(),c=r.next());return o===a&&l.done&&h.done&&c.done?!0:(n.return&&n.return(),s.return&&s.return(),r.return&&r.return(),!1)}const tu=Object.freeze(Object.defineProperty({__proto__:null,clampIndex:Hl,clampRange:ps,createElementComparator:Me},Symbol.toStringTag,{value:"Module"}));function dn(i,t,e,n){return(e&1<<n)!==0}function gs(i,t,e,n){return(e&1<<n)>>n}function eu(i,t,e){return e?!!(i[t>>3]|=1<<t%8)||!0:!(i[t>>3]&=~(1<<t%8))&&!1}function fi(i,t,e){const n=e.byteLength+7&-8;if(i>0||e.byteLength<n){const s=new Uint8Array(n);return s.set(i%8===0?e.subarray(i>>3):yi(new Xe(e,i,t,null,dn)).subarray(0,n)),s}return e}function yi(i){const t=[];let e=0,n=0,s=0;for(const o of i)o&&(s|=1<<n),++n===8&&(t[e++]=s,s=n=0);(e===0||n>0)&&(t[e++]=s);const r=new Uint8Array(t.length+7&-8);return r.set(t),r}class Xe{constructor(t,e,n,s,r){this.bytes=t,this.length=n,this.context=s,this.get=r,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(i,t,e){if(e-t<=0)return 0;if(e-t<8){let r=0;for(const o of new Xe(i,t,e-t,i,gs))r+=o;return r}const n=e>>3<<3,s=t+(t%8===0?0:8-t%8);return Yi(i,t,s)+Yi(i,n,e)+jo(i,s>>3,n-s>>3)}function jo(i,t,e){let n=0,s=Math.trunc(t);const r=new DataView(i.buffer,i.byteOffset,i.byteLength),o=e===void 0?i.byteLength:s+e;for(;o-s>=4;)n+=Ri(r.getUint32(s)),s+=4;for(;o-s>=2;)n+=Ri(r.getUint16(s)),s+=2;for(;o-s>=1;)n+=Ri(r.getUint8(s)),s+=1;return n}function Ri(i){let t=Math.trunc(i);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}const iu=Object.freeze(Object.defineProperty({__proto__:null,BitIterator:Xe,getBit:gs,getBool:dn,packBools:yi,popcnt_array:jo,popcnt_bit_range:Yi,popcnt_uint32:Ri,setBool:eu,truncateBitmap:fi},Symbol.toStringTag,{value:"Module"})),nu=-1;class E{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 y.isSparseUnion(t)?this.children.some(e=>e.nullable):y.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:n,nullBitmap:s,typeIds:r}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),s&&(t+=s.byteLength),r&&(t+=r.byteLength),this.children.reduce((o,a)=>o+a.byteLength,t)}get nullCount(){if(y.isUnion(this.type))return this.children.reduce((n,s)=>n+s.nullCount,0);let t=this._nullCount,e;return t<=nu&&(e=this.nullBitmap)&&(this._nullCount=t=this.length-Yi(e,this.offset,this.offset+this.length)),t}constructor(t,e,n,s,r,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(n||0,0)),this._nullCount=Math.floor(Math.max(s||0,-1));let c;r instanceof E?(this.stride=r.stride,this.values=r.values,this.typeIds=r.typeIds,this.nullBitmap=r.nullBitmap,this.valueOffsets=r.valueOffsets):(this.stride=Mt(t),r&&((c=r[0])&&(this.valueOffsets=c),(c=r[1])&&(this.values=c),(c=r[2])&&(this.nullBitmap=c),(c=r[3])&&(this.typeIds=c)))}getValid(t){const{type:e}=this;if(y.isUnion(e)){const n=e,s=this.children[n.typeIdToChildIndex[this.typeIds[t]]],r=n.mode===$.Dense?this.valueOffsets[t]:t;return s.getValid(r)}if(this.nullable&&this.nullCount>0){const n=this.offset+t;return(this.nullBitmap[n>>3]&1<<n%8)!==0}return!0}setValid(t,e){let n;const{type:s}=this;if(y.isUnion(s)){const r=s,o=this.children[r.typeIdToChildIndex[this.typeIds[t]]],a=r.mode===$.Dense?this.valueOffsets[t]:t;n=o.getValid(a),o.setValid(a,e)}else{let{nullBitmap:r}=this;const{offset:o,length:a}=this,c=o+t,l=1<<c%8,h=c>>3;(!r||r.byteLength<=h)&&(r=new Uint8Array((o+a+63&-64)>>3).fill(255),this.nullCount>0&&r.set(fi(o,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:r,_nullCount:-1}));const d=r[h];n=(d&l)!==0,e?r[h]=d|l:r[h]=d&~l}return n!==!!e&&(this._nullCount=this.nullCount+(e?-1:1)),e}clone(t=this.type,e=this.offset,n=this.length,s=this._nullCount,r=this,o=this.children){return new E(t,e,n,s,r,o,this.dictionary)}slice(t,e){const{stride:n,typeId:s,children:r}=this,o=+(this._nullCount===0)-1,a=s===16?n:1,c=this._sliceBuffers(t,e,n,s);return this.clone(this.type,this.offset+t,e,o,c,r.length===0||this.valueOffsets?r:this._sliceChildren(r,a*t,a*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===u.Null)return this.clone(this.type,0,t,0);const{length:e,nullCount:n}=this,s=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);s[e>>3]=(1<<e-(e&-8))-1,n>0&&s.set(fi(this.offset,e,this.nullBitmap),0);const r=this.buffers;return r[bt.VALIDITY]=s,this.clone(this.type,0,t,n+(t-e),r)}_sliceBuffers(t,e,n,s){let r;const{buffers:o}=this;return(r=o[bt.TYPE])&&(o[bt.TYPE]=r.subarray(t,t+e)),(r=o[bt.OFFSET])&&(o[bt.OFFSET]=r.subarray(t,t+e+1))||(r=o[bt.DATA])&&(o[bt.DATA]=s===6?r:r.subarray(n*t,n*(t+e))),o}_sliceChildren(t,e,n){return t.map(s=>s.slice(e,n))}}E.prototype.children=Object.freeze([]);class ai extends F{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){const{["type"]:e,["offset"]:n=0,["length"]:s=0}=t;return new E(e,n,s,s)}visitBool(t){const{["type"]:e,["offset"]:n=0}=t,s=L(t.nullBitmap),r=N(e.ArrayType,t.data),{["length"]:o=r.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new E(e,n,o,a,[void 0,r,s])}visitInt(t){const{["type"]:e,["offset"]:n=0}=t,s=L(t.nullBitmap),r=N(e.ArrayType,t.data),{["length"]:o=r.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new E(e,n,o,a,[void 0,r,s])}visitFloat(t){const{["type"]:e,["offset"]:n=0}=t,s=L(t.nullBitmap),r=N(e.ArrayType,t.data),{["length"]:o=r.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new E(e,n,o,a,[void 0,r,s])}visitUtf8(t){const{["type"]:e,["offset"]:n=0}=t,s=L(t.data),r=L(t.nullBitmap),o=Ee(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new E(e,n,a,c,[o,s,r])}visitBinary(t){const{["type"]:e,["offset"]:n=0}=t,s=L(t.data),r=L(t.nullBitmap),o=Ee(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new E(e,n,a,c,[o,s,r])}visitFixedSizeBinary(t){const{["type"]:e,["offset"]:n=0}=t,s=L(t.nullBitmap),r=N(e.ArrayType,t.data),{["length"]:o=r.length/Mt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new E(e,n,o,a,[void 0,r,s])}visitDate(t){const{["type"]:e,["offset"]:n=0}=t,s=L(t.nullBitmap),r=N(e.ArrayType,t.data),{["length"]:o=r.length/Mt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new E(e,n,o,a,[void 0,r,s])}visitTimestamp(t){const{["type"]:e,["offset"]:n=0}=t,s=L(t.nullBitmap),r=N(e.ArrayType,t.data),{["length"]:o=r.length/Mt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new E(e,n,o,a,[void 0,r,s])}visitTime(t){const{["type"]:e,["offset"]:n=0}=t,s=L(t.nullBitmap),r=N(e.ArrayType,t.data),{["length"]:o=r.length/Mt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new E(e,n,o,a,[void 0,r,s])}visitDecimal(t){const{["type"]:e,["offset"]:n=0}=t,s=L(t.nullBitmap),r=N(e.ArrayType,t.data),{["length"]:o=r.length/Mt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new E(e,n,o,a,[void 0,r,s])}visitList(t){const{["type"]:e,["offset"]:n=0,["child"]:s}=t,r=L(t.nullBitmap),o=Ee(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new E(e,n,a,c,[o,void 0,r],[s])}visitStruct(t){const{["type"]:e,["offset"]:n=0,["children"]:s=[]}=t,r=L(t.nullBitmap),{length:o=s.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new E(e,n,o,a,[void 0,void 0,r],s)}visitUnion(t){const{["type"]:e,["offset"]:n=0,["children"]:s=[]}=t,r=N(e.ArrayType,t.typeIds),{["length"]:o=r.length,["nullCount"]:a=-1}=t;if(y.isSparseUnion(e))return new E(e,n,o,a,[void 0,void 0,void 0,r],s);const c=Ee(t.valueOffsets);return new E(e,n,o,a,[c,void 0,void 0,r],s)}visitDictionary(t){const{["type"]:e,["offset"]:n=0}=t,s=L(t.nullBitmap),r=N(e.indices.ArrayType,t.data),{["dictionary"]:o=new g([new ai().visit({type:e.dictionary})])}=t,{["length"]:a=r.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new E(e,n,a,c,[void 0,r,s],[],o)}visitInterval(t){const{["type"]:e,["offset"]:n=0}=t,s=L(t.nullBitmap),r=N(e.ArrayType,t.data),{["length"]:o=r.length/Mt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new E(e,n,o,a,[void 0,r,s])}visitDuration(t){const{["type"]:e,["offset"]:n=0}=t,s=L(t.nullBitmap),r=N(e.ArrayType,t.data),{["length"]:o=r.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new E(e,n,o,a,[void 0,r,s])}visitFixedSizeList(t){const{["type"]:e,["offset"]:n=0,["child"]:s=new ai().visit({type:e.valueType})}=t,r=L(t.nullBitmap),{["length"]:o=s.length/Mt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new E(e,n,o,a,[void 0,void 0,r],[s])}visitMap(t){const{["type"]:e,["offset"]:n=0,["child"]:s=new ai().visit({type:e.childType})}=t,r=L(t.nullBitmap),o=Ee(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new E(e,n,a,c,[o,void 0,r],[s])}}const su=new ai;function m(i){return su.visit(i)}class ur{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 ko(i){return i.reduce((t,e)=>t+e.nullCount,0)}function Po(i){return i.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(i.length+1))}function $o(i,t,e,n){const s=[];for(let r=-1,o=i.length;++r<o;){const a=i[r],c=t[r],{length:l}=a;if(c>=n)break;if(e>=c+l)continue;if(c>=e&&c+l<=n){s.push(a);continue}const h=Math.max(0,e-c),d=Math.min(n-c,l);s.push(a.slice(h,d-h))}return s.length===0&&s.push(i[0].slice(0,0)),s}function ms(i,t,e,n){let s=0,r=0,o=t.length-1;do{if(s>=o-1)return e<t[o]?n(i,s,e-t[s]):null;r=s+Math.trunc((o-s)*.5),e<t[r]?o=r:s=r}while(s<o)}function bs(i,t){return i.getValid(t)}function Je(i){function t(e,n,s){return i(e[n],s)}return function(e){const n=this.data;return ms(n,this._offsets,e,t)}}function Wo(i){let t;function e(n,s,r){return i(n[s],r,t)}return function(n,s){const r=this.data;t=s;const o=ms(r,this._offsets,n,e);return t=void 0,o}}function Yo(i){let t;function e(n,s,r){let o=r,a=0,c=0;for(let l=s-1,h=n.length;++l<h;){const d=n[l];if(~(a=i(d,t,o)))return c+a;o=0,c+=d.length}return-1}return function(n,s){t=n;const r=this.data,o=typeof s!="number"?e(r,0,0):ms(r,this._offsets,s,e);return t=void 0,o}}class _ extends F{}function ru(i,t){return t===null&&i.length>0?0:-1}function ou(i,t){const{nullBitmap:e}=i;if(!e||i.nullCount<=0)return-1;let n=0;for(const s of new Xe(e,i.offset+(t||0),i.length,e,dn)){if(!s)return n;++n}return-1}function O(i,t,e){if(t===void 0)return-1;if(t===null)switch(i.typeId){case u.Union:break;case u.Dictionary:break;default:return ou(i,e)}const n=ot.getVisitFn(i),s=Me(t);for(let r=(e||0)-1,o=i.length;++r<o;)if(s(n(i,r)))return r;return-1}function Jo(i,t,e){const n=ot.getVisitFn(i),s=Me(t);for(let r=(e||0)-1,o=i.length;++r<o;)if(s(n(i,r)))return r;return-1}_.prototype.visitNull=ru;_.prototype.visitBool=O;_.prototype.visitInt=O;_.prototype.visitInt8=O;_.prototype.visitInt16=O;_.prototype.visitInt32=O;_.prototype.visitInt64=O;_.prototype.visitUint8=O;_.prototype.visitUint16=O;_.prototype.visitUint32=O;_.prototype.visitUint64=O;_.prototype.visitFloat=O;_.prototype.visitFloat16=O;_.prototype.visitFloat32=O;_.prototype.visitFloat64=O;_.prototype.visitUtf8=O;_.prototype.visitBinary=O;_.prototype.visitFixedSizeBinary=O;_.prototype.visitDate=O;_.prototype.visitDateDay=O;_.prototype.visitDateMillisecond=O;_.prototype.visitTimestamp=O;_.prototype.visitTimestampSecond=O;_.prototype.visitTimestampMillisecond=O;_.prototype.visitTimestampMicrosecond=O;_.prototype.visitTimestampNanosecond=O;_.prototype.visitTime=O;_.prototype.visitTimeSecond=O;_.prototype.visitTimeMillisecond=O;_.prototype.visitTimeMicrosecond=O;_.prototype.visitTimeNanosecond=O;_.prototype.visitDecimal=O;_.prototype.visitList=O;_.prototype.visitStruct=O;_.prototype.visitUnion=O;_.prototype.visitDenseUnion=Jo;_.prototype.visitSparseUnion=Jo;_.prototype.visitDictionary=O;_.prototype.visitInterval=O;_.prototype.visitIntervalDayTime=O;_.prototype.visitIntervalYearMonth=O;_.prototype.visitDuration=O;_.prototype.visitDurationSecond=O;_.prototype.visitDurationMillisecond=O;_.prototype.visitDurationMicrosecond=O;_.prototype.visitDurationNanosecond=O;_.prototype.visitFixedSizeList=O;_.prototype.visitMap=O;const Ji=new _;class v extends F{}function B(i){const{type:t}=i;if(i.nullCount===0&&i.stride===1&&(t.typeId===u.Timestamp||t instanceof Q&&t.bitWidth!==64||t instanceof Rt&&t.bitWidth!==64||t instanceof qt&&t.precision!==H.HALF))return new ur(i.data.length,n=>{const s=i.data[n];return s.values.subarray(0,s.length)[Symbol.iterator]()});let e=0;return new ur(i.data.length,n=>{const r=i.data[n].length,o=i.slice(e,e+r);return e+=r,new au(o)})}class au{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}}v.prototype.visitNull=B;v.prototype.visitBool=B;v.prototype.visitInt=B;v.prototype.visitInt8=B;v.prototype.visitInt16=B;v.prototype.visitInt32=B;v.prototype.visitInt64=B;v.prototype.visitUint8=B;v.prototype.visitUint16=B;v.prototype.visitUint32=B;v.prototype.visitUint64=B;v.prototype.visitFloat=B;v.prototype.visitFloat16=B;v.prototype.visitFloat32=B;v.prototype.visitFloat64=B;v.prototype.visitUtf8=B;v.prototype.visitBinary=B;v.prototype.visitFixedSizeBinary=B;v.prototype.visitDate=B;v.prototype.visitDateDay=B;v.prototype.visitDateMillisecond=B;v.prototype.visitTimestamp=B;v.prototype.visitTimestampSecond=B;v.prototype.visitTimestampMillisecond=B;v.prototype.visitTimestampMicrosecond=B;v.prototype.visitTimestampNanosecond=B;v.prototype.visitTime=B;v.prototype.visitTimeSecond=B;v.prototype.visitTimeMillisecond=B;v.prototype.visitTimeMicrosecond=B;v.prototype.visitTimeNanosecond=B;v.prototype.visitDecimal=B;v.prototype.visitList=B;v.prototype.visitStruct=B;v.prototype.visitUnion=B;v.prototype.visitDenseUnion=B;v.prototype.visitSparseUnion=B;v.prototype.visitDictionary=B;v.prototype.visitInterval=B;v.prototype.visitIntervalDayTime=B;v.prototype.visitIntervalYearMonth=B;v.prototype.visitDuration=B;v.prototype.visitDurationSecond=B;v.prototype.visitDurationMillisecond=B;v.prototype.visitDurationMicrosecond=B;v.prototype.visitDurationNanosecond=B;v.prototype.visitFixedSizeList=B;v.prototype.visitMap=B;const _s=new v,cu=(i,t)=>i+t;class ge extends F{visitNull(t,e){return 0}visitInt(t,e){return t.type.bitWidth/8}visitFloat(t,e){return t.type.ArrayType.BYTES_PER_ELEMENT}visitBool(t,e){return 1/8}visitDecimal(t,e){return t.type.bitWidth/8}visitDate(t,e){return(t.type.unit+1)*4}visitTime(t,e){return t.type.bitWidth/8}visitTimestamp(t,e){return t.type.unit===f.SECOND?4:8}visitInterval(t,e){return(t.type.unit+1)*4}visitDuration(t,e){return 8}visitStruct(t,e){return t.children.reduce((n,s)=>n+zt.visit(s,e),0)}visitFixedSizeBinary(t,e){return t.type.byteWidth}visitMap(t,e){return 8+t.children.reduce((n,s)=>n+zt.visit(s,e),0)}visitDictionary(t,e){var n;return t.type.indices.bitWidth/8+(((n=t.dictionary)===null||n===void 0?void 0:n.getByteLength(t.values[e]))||0)}}const lu=({valueOffsets:i},t)=>8+(i[t+1]-i[t]),uu=({valueOffsets:i},t)=>8+(i[t+1]-i[t]),hu=({valueOffsets:i,stride:t,children:e},n)=>{const s=e[0],{[n*t]:r}=i,{[n*t+1]:o}=i,a=zt.getVisitFn(s.type),c=s.slice(r,o-r);let l=8;for(let h=-1,d=o-r;++h<d;)l+=a(c,h);return l},du=({stride:i,children:t},e)=>{const n=t[0],s=n.slice(e*i,i),r=zt.getVisitFn(n.type);let o=0;for(let a=-1,c=s.length;++a<c;)o+=r(s,a);return o},fu=(i,t)=>i.type.mode===$.Dense?Ho(i,t):Ko(i,t),Ho=({type:i,children:t,typeIds:e,valueOffsets:n},s)=>{const r=i.typeIdToChildIndex[e[s]];return 8+zt.visit(t[r],n[s])},Ko=({children:i},t)=>4+zt.visitMany(i,i.map(()=>t)).reduce(cu,0);ge.prototype.visitUtf8=lu;ge.prototype.visitBinary=uu;ge.prototype.visitList=hu;ge.prototype.visitFixedSizeList=du;ge.prototype.visitUnion=fu;ge.prototype.visitDenseUnion=Ho;ge.prototype.visitSparseUnion=Ko;const zt=new ge;var qo;const Go={},Zo={};class g{constructor(t){var e,n,s;const r=t[0]instanceof g?t.flatMap(a=>a.data):t;if(r.length===0||r.some(a=>!(a instanceof E)))throw new TypeError("Vector constructor expects an Array of Data instances.");const o=(e=r[0])===null||e===void 0?void 0:e.type;switch(r.length){case 0:this._offsets=[0];break;case 1:{const{get:a,set:c,indexOf:l,byteLength:h}=Go[o.typeId],d=r[0];this.isValid=U=>bs(d,U),this.get=U=>a(d,U),this.set=(U,M)=>c(d,U,M),this.indexOf=U=>l(d,U),this.getByteLength=U=>h(d,U),this._offsets=[0,d.length];break}default:Object.setPrototypeOf(this,Zo[o.typeId]),this._offsets=Po(r);break}this.data=r,this.type=o,this.stride=Mt(o),this.numChildren=(s=(n=o.children)===null||n===void 0?void 0:n.length)!==null&&s!==void 0?s:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,e)=>t+e.byteLength,0)}get nullCount(){return ko(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${u[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>-1}getByteLength(t){return 0}[Symbol.iterator](){return _s.visit(this)}concat(...t){return new g(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new g(ps(this,t,e,({data:n,_offsets:s},r,o)=>$o(n,s,r,o)))}toJSON(){return[...this]}toArray(){const{type:t,data:e,length:n,stride:s,ArrayType:r}=this;switch(t.typeId){case u.Int:case u.Float:case u.Decimal:case u.Time:case u.Timestamp:switch(e.length){case 0:return new r;case 1:return e[0].values.subarray(0,n*s);default:return e.reduce((o,{values:a,length:c})=>(o.array.set(a.subarray(0,c*s),o.offset),o.offset+=c*s,o),{array:new r(n*s),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(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new g(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return y.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(y.isDictionary(this.type)){const t=new Hi(this.data[0].dictionary),e=this.data.map(n=>{const s=n.clone();return s.dictionary=t,s});return new g(e)}return new Hi(this)}unmemoize(){if(y.isDictionary(this.type)&&this.isMemoized){const t=this.data[0].dictionary.unmemoize(),e=this.data.map(n=>{const s=n.clone();return s.dictionary=t,s});return new g(e)}return this}}qo=Symbol.toStringTag;g[qo]=(i=>{i.type=y.prototype,i.data=[],i.length=0,i.stride=1,i.numChildren=0,i._offsets=new Uint32Array([0]),i[Symbol.isConcatSpreadable]=!0;const t=Object.keys(u).map(e=>u[e]).filter(e=>typeof e=="number"&&e!==u.NONE);for(const e of t){const n=ot.getVisitFnByTypeId(e),s=gt.getVisitFnByTypeId(e),r=Ji.getVisitFnByTypeId(e),o=zt.getVisitFnByTypeId(e);Go[e]={get:n,set:s,indexOf:r,byteLength:o},Zo[e]=Object.create(i,{isValid:{value:Je(bs)},get:{value:Je(ot.getVisitFnByTypeId(e))},set:{value:Wo(gt.getVisitFnByTypeId(e))},indexOf:{value:Yo(Ji.getVisitFnByTypeId(e))},getByteLength:{value:Je(zt.getVisitFnByTypeId(e))}})}return"Vector"})(g.prototype);class Hi extends g{constructor(t){super(t.data);const e=this.get,n=this.set,s=this.slice,r=new Array(this.length);Object.defineProperty(this,"get",{value(o){const a=r[o];if(a!==void 0)return a;const c=e.call(this,o);return r[o]=c,c}}),Object.defineProperty(this,"set",{value(o,a){n.call(this,o,a),r[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new Hi(s.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new g(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}function fn(i){if(i){if(i instanceof E)return new g([i]);if(i instanceof g)return new g(i.data);if(i.type instanceof y)return new g([m(i)]);if(Array.isArray(i))return new g(i.flatMap(t=>yu(t)));if(ArrayBuffer.isView(i)){i instanceof DataView&&(i=new Uint8Array(i.buffer));const t={offset:0,length:i.length,nullCount:0,data:i};if(i instanceof Int8Array)return new g([m(Object.assign(Object.assign({},t),{type:new kn}))]);if(i instanceof Int16Array)return new g([m(Object.assign(Object.assign({},t),{type:new Pn}))]);if(i instanceof Int32Array)return new g([m(Object.assign(Object.assign({},t),{type:new ue}))]);if(i instanceof BigInt64Array)return new g([m(Object.assign(Object.assign({},t),{type:new cn}))]);if(i instanceof Uint8Array||i instanceof Uint8ClampedArray)return new g([m(Object.assign(Object.assign({},t),{type:new $n}))]);if(i instanceof Uint16Array)return new g([m(Object.assign(Object.assign({},t),{type:new Wn}))]);if(i instanceof Uint32Array)return new g([m(Object.assign(Object.assign({},t),{type:new Yn}))]);if(i instanceof BigUint64Array)return new g([m(Object.assign(Object.assign({},t),{type:new Jn}))]);if(i instanceof Float32Array)return new g([m(Object.assign(Object.assign({},t),{type:new Hn}))]);if(i instanceof Float64Array)return new g([m(Object.assign(Object.assign({},t),{type:new ln}))]);throw new Error("Unrecognized input")}}throw new Error("Unrecognized input")}function yu(i){return i instanceof E?[i]:i instanceof g?i.data:fn(i).data}function pu(i){if(!i||i.length<=0)return function(s){return!0};let t="";const e=i.filter(n=>n===n);return e.length>0&&(t=`
2
+ switch (x) {${e.map(n=>`
3
+ case ${gu(n)}:`).join("")}
4
+ return false;
5
+ }`),i.length!==e.length&&(t=`if (x !== x) return false;
6
+ ${t}`),new Function("x",`${t}
7
+ return true;`)}function gu(i){return typeof i!="bigint"?le(i):`${le(i)}n`}const Bn=(i,t)=>(Math.ceil(i)*t+63&-64||64)/t,mu=(i,t=0)=>i.length>=t?i.subarray(0,t):ci(new i.constructor(t),i,0);class yn{constructor(t,e=1){this.buffer=t,this.stride=e,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t.constructor,this._resize(this.length=Math.ceil(t.length/e))}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,e){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;const e=this.stride,n=this.length*e,s=this.buffer.length;n>=s&&this._resize(s===0?Bn(n*1,this.BYTES_PER_ELEMENT):Bn(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=Bn(t*this.stride,this.BYTES_PER_ELEMENT);const e=mu(this.buffer,t);return this.clear(),e}clear(){return this.length=0,this._resize(0),this}_resize(t){return this.buffer=ci(new this.ArrayType(t),this.buffer)}}yn.prototype.offset=0;class Ii extends yn{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,e){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=e,this}}class Qo extends Ii{constructor(t=new Uint8Array(0)){super(t,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,e){const{buffer:n}=this.reserve(t-this.length+1),s=t>>3,r=t%8,o=n[s]>>r&1;return e?o===0&&(n[s]|=1<<r,++this.numValid):o===1&&(n[s]&=~(1<<r),--this.numValid),this}clear(){return this.numValid=0,super.clear()}}class Xo extends Ii{constructor(t=new Int32Array(1)){super(t,1)}append(t){return this.set(this.length-1,t)}set(t,e){const n=this.length-1,s=this.reserve(t-n+1).buffer;return n<t++&&s.fill(s[n],n,t),s[t]=s[t-1]+e,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,0),super.flush(t+1)}}let X=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:e}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=e,this.stride=Mt(t),this._nulls=new Qo,e&&e.length>0&&(this._isValid=pu(e))}toVector(){return new g([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0;const{_offsets:e,_values:n,_nulls:s,_typeIds:r,children:o}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),s&&(t+=s.byteLength),r&&(t+=r.byteLength),o.reduce((a,c)=>a+c.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((e,n)=>e+n.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,e){return this.setValid(t,this.isValid(e))&&this.setValue(t,e),this}setValue(t,e){this._setValue(this,t,e)}setValid(t,e){return this.length=this._nulls.set(t,+e).length,e}addChild(t,e=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,e,n,s;const{type:r,length:o,nullCount:a,_typeIds:c,_offsets:l,_values:h,_nulls:d}=this;(e=c?.flush(o))?s=l?.flush(o):(s=l?.flush(o))?t=h?.flush(l.last()):t=h?.flush(o),a>0&&(n=d?.flush(o));const U=this.children.map(M=>M.flush());return this.clear(),m({type:r,length:o,nullCount:a,children:U,child:U[0],data:t,typeIds:e,nullBitmap:n,valueOffsets:s})}finish(){this.finished=!0;for(const t of this.children)t.finish();return this}clear(){var t,e,n,s;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(e=this._values)===null||e===void 0||e.clear(),(n=this._offsets)===null||n===void 0||n.clear(),(s=this._typeIds)===null||s===void 0||s.clear();for(const r of this.children)r.clear();return this}};X.prototype.length=1;X.prototype.stride=1;X.prototype.children=null;X.prototype.finished=!1;X.prototype.nullValues=null;X.prototype._isValid=()=>!0;class te extends X{constructor(t){super(t),this._values=new Ii(new this.ArrayType(0),this.stride)}setValue(t,e){const n=this._values;return n.reserve(t-n.length+1),super.setValue(t,e)}}class pn extends X{constructor(t){super(t),this._pendingLength=0,this._offsets=new Xo}setValue(t,e){const n=this._pending||(this._pending=new Map),s=n.get(t);s&&(this._pendingLength-=s.length),this._pendingLength+=e instanceof wi?e[vt].length:e.length,n.set(t,e)}setValid(t,e){return super.setValid(t,e)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){const t=this._pending,e=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,e),this}}class Nn{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,n,s){return t.prep(8,24),t.writeInt64(BigInt(s??0)),t.pad(4),t.writeInt32(n),t.writeInt64(BigInt(e??0)),t.offset()}}const An=2,Tt=4,Ht=4,z=4,re=new Int32Array(2),hr=new Float32Array(re.buffer),dr=new Float64Array(re.buffer),Ci=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Ln;(function(i){i[i.UTF8_BYTES=1]="UTF8_BYTES",i[i.UTF16_STRING=2]="UTF16_STRING"})(Ln||(Ln={}));let ti=class ta{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new ta(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),hr[0]}readFloat64(t){return re[Ci?0:1]=this.readInt32(t),re[Ci?1:0]=this.readInt32(t+4),dr[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){hr[0]=e,this.writeInt32(t,re[0])}writeFloat64(t,e){dr[0]=e,this.writeInt32(t,re[Ci?0:1]),this.writeInt32(t+4,re[Ci?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+Tt+Ht)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let e=0;e<Ht;e++)t+=String.fromCharCode(this.readInt8(this.position_+Tt+e));return t}__offset(t,e){const n=t-this.readInt32(t);return e<this.readInt16(n)?this.readInt16(n+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 n=this.readInt32(t);t+=Tt;const s=this.bytes_.subarray(t,t+n);return e===Ln.UTF8_BYTES?s:this.text_decoder_.decode(s)}__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)+Tt}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=Ht)throw new Error("FlatBuffers: file identifier must be length "+Ht);for(let e=0;e<Ht;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+Tt+e))return!1;return!0}createScalarList(t,e){const n=[];for(let s=0;s<e;++s){const r=t(s);r!==null&&n.push(r)}return n}createObjList(t,e){const n=[];for(let s=0;s<e;++s){const r=t(s);r!==null&&n.push(r.unpack())}return n}},ea=class ia{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=ti.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 n=~(this.bb.capacity()-this.space+e)+1&t-1;for(;this.space<n+t+e;){const s=this.bb.capacity();this.bb=ia.growByteBuffer(this.bb),this.space+=this.bb.capacity()-s}this.pad(n)}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,n){(this.force_defaults||e!=n)&&(this.addInt8(e),this.slot(t))}addFieldInt16(t,e,n){(this.force_defaults||e!=n)&&(this.addInt16(e),this.slot(t))}addFieldInt32(t,e,n){(this.force_defaults||e!=n)&&(this.addInt32(e),this.slot(t))}addFieldInt64(t,e,n){(this.force_defaults||e!==n)&&(this.addInt64(e),this.slot(t))}addFieldFloat32(t,e,n){(this.force_defaults||e!=n)&&(this.addFloat32(e),this.slot(t))}addFieldFloat64(t,e,n){(this.force_defaults||e!=n)&&(this.addFloat64(e),this.slot(t))}addFieldOffset(t,e,n){(this.force_defaults||e!=n)&&(this.addOffset(e),this.slot(t))}addFieldStruct(t,e,n){e!=n&&(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 n=e<<1,s=ti.allocate(n);return s.setPosition(n-e),s.bytes().set(t.bytes(),n-e),s}addOffset(t){this.prep(Tt,0),this.writeInt32(this.offset()-t+Tt)}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 n=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);const s=2;this.addInt16(t-this.object_start);const r=(n+s)*An;this.addInt16(r);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(r==this.bb.readInt16(c)){for(let l=An;l<r;l+=An)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))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,n){const s=n?z:0;if(e){const r=e;if(this.prep(this.minalign,Tt+Ht+s),r.length!=Ht)throw new TypeError("FlatBuffers: file identifier must be length "+Ht);for(let o=Ht-1;o>=0;o--)this.writeInt8(r.charCodeAt(o))}this.prep(this.minalign,Tt+s),this.addOffset(t),s&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){const n=this.bb.capacity()-t,s=n-this.bb.readInt32(n);if(!(e<this.bb.readInt16(s)&&this.bb.readInt16(s+e)!=0))throw new TypeError("FlatBuffers: field "+e+" must be set")}startVector(t,e,n){this.notNested(),this.vector_num_elems=e,this.prep(Tt,t*e),this.prep(n,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;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);for(let n=0,s=this.space,r=this.bb.bytes();n<e.length;n++)r[s++]=e[n];return this.endVector()}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){const e=[];for(let n=0;n<t.length;++n){const s=t[n];if(s!==null)e.push(this.createObjectOffset(s));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()}};class Y{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 Y).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+z),(e||new Y).__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,n){return Y.startKeyValue(t),Y.addKey(t,e),Y.addValue(t,n),Y.endKeyValue(t)}}var ei;(function(i){i[i.V1=0]="V1",i[i.V2=1]="V2",i[i.V3=2]="V3",i[i.V4=3]="V4",i[i.V5=4]="V5"})(ei||(ei={}));var ii;(function(i){i[i.Little=0]="Little",i[i.Big=1]="Big"})(ii||(ii={}));var Ki;(function(i){i[i.DenseArray=0]="DenseArray"})(Ki||(Ki={}));class lt{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 lt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+z),(e||new lt).__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,n){return lt.startInt(t),lt.addBitWidth(t,e),lt.addIsSigned(t,n),lt.endInt(t)}}class Kt{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 Kt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+z),(e||new Kt).__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 lt).__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):Ki.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,Ki.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}}class be{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 be).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+z),(e||new be).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return be.startBinary(t),be.endBinary(t)}}class _e{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 _e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+z),(e||new _e).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return _e.startBool(t),_e.endBool(t)}}var qi;(function(i){i[i.DAY=0]="DAY",i[i.MILLISECOND=1]="MILLISECOND"})(qi||(qi={}));let zi=class Re{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 Re).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+z),(e||new Re).__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):qi.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,qi.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return Re.startDate(t),Re.addUnit(t,e),Re.endDate(t)}};class it{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 it).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+z),(e||new it).__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,n,s){return it.startDecimal(t),it.addPrecision(t,e),it.addScale(t,n),it.addBitWidth(t,s),it.endDecimal(t)}}var de;(function(i){i[i.SECOND=0]="SECOND",i[i.MILLISECOND=1]="MILLISECOND",i[i.MICROSECOND=2]="MICROSECOND",i[i.NANOSECOND=3]="NANOSECOND"})(de||(de={}));class Nt{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 Nt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,e){return t.setPosition(t.position()+z),(e||new Nt).__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):de.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,de.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,e){return Nt.startDuration(t),Nt.addUnit(t,e),Nt.endDuration(t)}}class Lt{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 Lt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+z),(e||new Lt).__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 Lt.startFixedSizeBinary(t),Lt.addByteWidth(t,e),Lt.endFixedSizeBinary(t)}}class Ut{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 Ut).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+z),(e||new Ut).__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 Ut.startFixedSizeList(t),Ut.addListSize(t,e),Ut.endFixedSizeList(t)}}var Gi;(function(i){i[i.HALF=0]="HALF",i[i.SINGLE=1]="SINGLE",i[i.DOUBLE=2]="DOUBLE"})(Gi||(Gi={}));class xt{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 xt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+z),(e||new xt).__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):Gi.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,Gi.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return xt.startFloatingPoint(t),xt.addPrecision(t,e),xt.endFloatingPoint(t)}}var Zi;(function(i){i[i.YEAR_MONTH=0]="YEAR_MONTH",i[i.DAY_TIME=1]="DAY_TIME",i[i.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(Zi||(Zi={}));class Ct{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 Ct).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+z),(e||new Ct).__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):Zi.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,Zi.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return Ct.startInterval(t),Ct.addUnit(t,e),Ct.endInterval(t)}}class ve{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 ve).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+z),(e||new ve).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return ve.startList(t),ve.endList(t)}}let ji=class ze{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 ze).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+z),(e||new ze).__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 ze.startMap(t),ze.addKeysSorted(t,e),ze.endMap(t)}};class we{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 we).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+z),(e||new we).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return we.startNull(t),we.endNull(t)}}class Ie{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 Ie).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+z),(e||new Ie).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return Ie.startStruct_(t),Ie.endStruct_(t)}}class dt{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 dt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+z),(e||new dt).__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):de.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,de.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,n){return dt.startTime(t),dt.addUnit(t,e),dt.addBitWidth(t,n),dt.endTime(t)}}class ft{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 ft).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+z),(e||new ft).__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):de.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,de.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,n){return ft.startTimestamp(t),ft.addUnit(t,e),ft.addTimezone(t,n),ft.endTimestamp(t)}}var Qi;(function(i){i[i.Sparse=0]="Sparse",i[i.Dense=1]="Dense"})(Qi||(Qi={}));class nt{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 nt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+z),(e||new nt).__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):Qi.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,Qi.Sparse)}static addTypeIds(t,e){t.addFieldOffset(1,e,0)}static createTypeIdsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addInt32(e[n]);return t.endVector()}static startTypeIdsVector(t,e){t.startVector(4,e,4)}static endUnion(t){return t.endObject()}static createUnion(t,e,n){return nt.startUnion(t),nt.addMode(t,e),nt.addTypeIds(t,n),nt.endUnion(t)}}class Se{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 Se).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+z),(e||new Se).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return Se.startUtf8(t),Se.endUtf8(t)}}var T;(function(i){i[i.NONE=0]="NONE",i[i.Null=1]="Null",i[i.Int=2]="Int",i[i.FloatingPoint=3]="FloatingPoint",i[i.Binary=4]="Binary",i[i.Utf8=5]="Utf8",i[i.Bool=6]="Bool",i[i.Decimal=7]="Decimal",i[i.Date=8]="Date",i[i.Time=9]="Time",i[i.Timestamp=10]="Timestamp",i[i.Interval=11]="Interval",i[i.List=12]="List",i[i.Struct_=13]="Struct_",i[i.Union=14]="Union",i[i.FixedSizeBinary=15]="FixedSizeBinary",i[i.FixedSizeList=16]="FixedSizeList",i[i.Map=17]="Map",i[i.Duration=18]="Duration",i[i.LargeBinary=19]="LargeBinary",i[i.LargeUtf8=20]="LargeUtf8",i[i.LargeList=21]="LargeList",i[i.RunEndEncoded=22]="RunEndEncoded"})(T||(T={}));let ht=class ki{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 ki).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+z),(e||new ki).__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):T.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 Kt).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}children(t,e){const n=this.bb.__offset(this.bb_pos,14);return n?(e||new ki).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+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 n=this.bb.__offset(this.bb_pos,16);return n?(e||new Y).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+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,T.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 n=e.length-1;n>=0;n--)t.addOffset(e[n]);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 n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endField(t){return t.endObject()}},Ft=class Yt{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 Yt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+z),(e||new Yt).__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):ii.Little}fields(t,e){const n=this.bb.__offset(this.bb_pos,6);return n?(e||new ht).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+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 n=this.bb.__offset(this.bb_pos,8);return n?(e||new Y).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+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,ii.Little)}static addFields(t,e){t.addFieldOffset(1,e,0)}static createFieldsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);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 n=e.length-1;n>=0;n--)t.addOffset(e[n]);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 n=e.length-1;n>=0;n--)t.addInt64(e[n]);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,n,s,r){return Yt.startSchema(t),Yt.addEndianness(t,e),Yt.addFields(t,n),Yt.addCustomMetadata(t,s),Yt.addFeatures(t,r),Yt.endSchema(t)}};class at{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 at).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+z),(e||new at).__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):ei.V1}schema(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new Ft).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}dictionaries(t,e){const n=this.bb.__offset(this.bb_pos,8);return n?(e||new Nn).__init(this.bb.__vector(this.bb_pos+n)+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 n=this.bb.__offset(this.bb_pos,10);return n?(e||new Nn).__init(this.bb.__vector(this.bb_pos+n)+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 n=this.bb.__offset(this.bb_pos,12);return n?(e||new Y).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+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,ei.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 n=e.length-1;n>=0;n--)t.addOffset(e[n]);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 C{constructor(t=[],e,n,s=K.V5){this.fields=t||[],this.metadata=e||new Map,n||(n=Un(t)),this.dictionaries=n,this.metadataVersion=s}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),n=this.fields.filter(s=>e.has(s.name));return new C(n,this.metadata)}selectAt(t){const e=t.map(n=>this.fields[n]).filter(Boolean);return new C(e,this.metadata)}assign(...t){const e=t[0]instanceof C?t[0]:Array.isArray(t[0])?new C(t[0]):new C(t),n=[...this.fields],s=Ei(Ei(new Map,this.metadata),e.metadata),r=e.fields.filter(a=>{const c=n.findIndex(l=>l.name===a.name);return~c?(n[c]=a.clone({metadata:Ei(Ei(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),o=Un(r,new Map);return new C([...n,...r],s,new Map([...this.dictionaries,...o]))}}C.prototype.fields=null;C.prototype.metadata=null;C.prototype.dictionaries=null;class x{static new(...t){let[e,n,s,r]=t;return t[0]&&typeof t[0]=="object"&&({name:e}=t[0],n===void 0&&(n=t[0].type),s===void 0&&(s=t[0].nullable),r===void 0&&(r=t[0].metadata)),new x(`${e}`,n,s,r)}constructor(t,e,n=!1,s){this.name=t,this.type=e,this.nullable=n,this.metadata=s||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[e,n,s,r]=t;return!t[0]||typeof t[0]!="object"?[e=this.name,n=this.type,s=this.nullable,r=this.metadata]=t:{name:e=this.name,type:n=this.type,nullable:s=this.nullable,metadata:r=this.metadata}=t[0],x.new(e,n,s,r)}}x.prototype.type=null;x.prototype.name=null;x.prototype.nullable=null;x.prototype.metadata=null;function Ei(i,t){return new Map([...i||new Map,...t||new Map])}function Un(i,t=new Map){for(let e=-1,n=i.length;++e<n;){const r=i[e].type;if(y.isDictionary(r)){if(!t.has(r.id))t.set(r.id,r.dictionary);else if(t.get(r.id)!==r.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}r.children&&r.children.length>0&&Un(r.children,t)}return t}var bu=ea,_u=ti;class pi{static decode(t){t=new _u(L(t));const e=at.getRootAsFooter(t),n=C.decode(e.schema(),new Map,e.version());return new vu(n,e)}static encode(t){const e=new bu,n=C.encode(e,t.schema);at.startRecordBatchesVector(e,t.numRecordBatches);for(const o of[...t.recordBatches()].slice().reverse())jt.encode(e,o);const s=e.endVector();at.startDictionariesVector(e,t.numDictionaries);for(const o of[...t.dictionaryBatches()].slice().reverse())jt.encode(e,o);const r=e.endVector();return at.startFooter(e),at.addSchema(e,n),at.addVersion(e,K.V5),at.addRecordBatches(e,s),at.addDictionaries(e,r),at.finishFooterBuffer(e,at.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,e=K.V5,n,s){this.schema=t,this.version=e,n&&(this._recordBatches=n),s&&(this._dictionaryBatches=s)}*recordBatches(){for(let t,e=-1,n=this.numRecordBatches;++e<n;)(t=this.getRecordBatch(e))&&(yield t)}*dictionaryBatches(){for(let t,e=-1,n=this.numDictionaries;++e<n;)(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 vu extends pi{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 jt.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){const e=this._footer.dictionaries(t);if(e)return jt.decode(e)}return null}}class jt{static decode(t){return new jt(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){const{metaDataLength:n}=e,s=BigInt(e.offset),r=BigInt(e.bodyLength);return Nn.createBlock(t,s,n,r)}constructor(t,e,n){this.metaDataLength=t,this.offset=Bt(n),this.bodyLength=Bt(e)}}const j=Object.freeze({done:!0,value:void 0});class fr{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}}class vs{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 wu extends vs{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return p(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(j);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return ct.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return ct.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return p(this,void 0,void 0,function*(){return yield this.abort(t),j})}return(t){return p(this,void 0,void 0,function*(){return yield this.close(),j})}read(t){return p(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return p(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,n)=>{this.resolvers.push({resolve:e,reject:n})}):Promise.resolve(j)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}class He extends wu{write(t){if((t=L(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Fn(this.toUint8Array(!0)):this.toUint8Array(!1).then(Fn)}toUint8Array(t=!1){return t?St(this._values)[0]:p(this,void 0,void 0,function*(){var e,n,s,r;const o=[];let a=0;try{for(var c=!0,l=ae(this),h;h=yield l.next(),e=h.done,!e;c=!0){r=h.value,c=!1;const d=r;o.push(d),a+=d.byteLength}}catch(d){n={error:d}}finally{try{!c&&!e&&(s=l.return)&&(yield s.call(l))}finally{if(n)throw n.error}}return St(o,a)[0]})}}class gi{constructor(t){t&&(this.source=new Iu(ct.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 fe{constructor(t){t instanceof fe?this.source=t.source:t instanceof He?this.source=new me(ct.fromAsyncIterable(t)):Nr(t)?this.source=new me(ct.fromNodeStream(t)):Rn(t)?this.source=new me(ct.fromDOMStream(t)):Tr(t)?this.source=new me(ct.fromDOMStream(t.body)):ri(t)?this.source=new me(ct.fromIterable(t)):ce(t)?this.source=new me(ct.fromAsyncIterable(t)):Fe(t)&&(this.source=new me(ct.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 Iu{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)||j)}return(t){return Object.create(this.source.return&&this.source.return(t)||j)}}class me{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return p(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return p(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return p(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,e="read"){return p(this,void 0,void 0,function*(){return yield this.source.next({cmd:e,size:t})})}throw(t){return p(this,void 0,void 0,function*(){const e=this.source.throw&&(yield this.source.throw(t))||j;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return p(this,void 0,void 0,function*(){const e=this.source.return&&(yield this.source.return(t))||j;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}}class yr extends gi{constructor(t,e){super(),this.position=0,this.buffer=L(t),this.size=e===void 0?this.buffer.byteLength:e}readInt32(t){const{buffer:e,byteOffset:n}=this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){const{buffer:e,size:n,position:s}=this;return e&&s<n?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(n,s+Math.min(n-s,t)),e.subarray(s,this.position)):null}readAt(t,e){const n=this.buffer,s=Math.min(this.size,t+e);return n?n.subarray(t,s):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 Xi extends fe{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=p(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return p(this,void 0,void 0,function*(){const{buffer:e,byteOffset:n}=yield this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)})}seek(t){return p(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 p(this,void 0,void 0,function*(){this._pending&&(yield this._pending);const{_handle:e,size:n,position:s}=this;if(e&&s<n){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let r=s,o=0,a=0;const c=Math.min(n,r+Math.min(n-r,t)),l=new Uint8Array(Math.max(0,(this.position=c)-r));for(;(r+=a)<c&&(o+=a)<l.byteLength;)({bytesRead:a}=yield e.read(l,o,l.byteLength-o,r));return l}return null})}readAt(t,e){return p(this,void 0,void 0,function*(){this._pending&&(yield this._pending);const{_handle:n,size:s}=this;if(n&&t+e<s){const r=Math.min(s,t+e),o=new Uint8Array(r-t);return(yield n.read(o,0,e,t)).buffer}return new Uint8Array(e)})}close(){return p(this,void 0,void 0,function*(){const t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return p(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return p(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}}const Su=65536;function ke(i){return i<0&&(i=4294967295+i+1),`0x${i.toString(16)}`}const ni=8,ws=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];class Is{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]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]);let s=e[3]*n[3];this.buffer[0]=s&65535;let r=s>>>16;return s=e[2]*n[3],r+=s,s=e[3]*n[2]>>>0,r+=s,this.buffer[0]+=r<<16,this.buffer[1]=r>>>0<s?Su:0,this.buffer[1]+=r>>>16,this.buffer[1]+=e[1]*n[3]+e[2]*n[2]+e[3]*n[1],this.buffer[1]+=e[0]*n[3]+e[1]*n[2]+e[2]*n[1]+e[3]*n[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`${ke(this.buffer[1])} ${ke(this.buffer[0])}`}}class V extends Is{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,e=new Uint32Array(2)){return V.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return V.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){const n=t.length,s=new V(e);for(let r=0;r<n;){const o=ni<n-r?ni:n-r,a=new V(new Uint32Array([Number.parseInt(t.slice(r,r+o),10),0])),c=new V(new Uint32Array([ws[o],0]));s.times(c),s.plus(a),r+=o}return s}static convertArray(t){const e=new Uint32Array(t.length*2);for(let n=-1,s=t.length;++n<s;)V.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new V(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new V(new Uint32Array(t.buffer)).plus(e)}}class tt extends Is{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,n=t.buffer[1]<<0;return e<n||e===n&&this.buffer[0]<t.buffer[0]}static from(t,e=new Uint32Array(2)){return tt.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return tt.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){const n=t.startsWith("-"),s=t.length,r=new tt(e);for(let o=n?1:0;o<s;){const a=ni<s-o?ni:s-o,c=new tt(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0])),l=new tt(new Uint32Array([ws[a],0]));r.times(l),r.plus(c),o+=a}return n?r.negate():r}static convertArray(t){const e=new Uint32Array(t.length*2);for(let n=-1,s=t.length;++n<s;)tt.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new tt(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new tt(new Uint32Array(t.buffer)).plus(e)}}class mt{constructor(t){this.buffer=t}high(){return new tt(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new tt(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 V(new Uint32Array([this.buffer[3],0])),n=new V(new Uint32Array([this.buffer[2],0])),s=new V(new Uint32Array([this.buffer[1],0])),r=new V(new Uint32Array([this.buffer[0],0])),o=new V(new Uint32Array([t.buffer[3],0])),a=new V(new Uint32Array([t.buffer[2],0])),c=new V(new Uint32Array([t.buffer[1],0])),l=new V(new Uint32Array([t.buffer[0],0]));let h=V.multiply(r,l);this.buffer[0]=h.low();const d=new V(new Uint32Array([h.high(),0]));return h=V.multiply(s,l),d.plus(h),h=V.multiply(r,c),d.plus(h),this.buffer[1]=d.low(),this.buffer[3]=d.lessThan(h)?1:0,this.buffer[2]=d.high(),new V(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(V.multiply(n,l)).plus(V.multiply(s,c)).plus(V.multiply(r,a)),this.buffer[3]+=V.multiply(e,l).plus(V.multiply(n,c)).plus(V.multiply(s,a)).plus(V.multiply(r,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`${ke(this.buffer[3])} ${ke(this.buffer[2])} ${ke(this.buffer[1])} ${ke(this.buffer[0])}`}static multiply(t,e){return new mt(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new mt(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return mt.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return mt.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){const n=t.startsWith("-"),s=t.length,r=new mt(e);for(let o=n?1:0;o<s;){const a=ni<s-o?ni:s-o,c=new mt(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0,0,0])),l=new mt(new Uint32Array([ws[a],0,0,0]));r.times(l),r.plus(c),o+=a}return n?r.negate():r}static convertArray(t){const e=new Uint32Array(t.length*4);for(let n=-1,s=t.length;++n<s;)mt.from(t[n],new Uint32Array(e.buffer,e.byteOffset+4*4*n,4));return e}}const Bu=Object.freeze(Object.defineProperty({__proto__:null,BaseInt64:Is,Int128:mt,Int64:tt,Uint64:V},Symbol.toStringTag,{value:"Module"}));class na extends F{constructor(t,e,n,s,r=K.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=e,this.buffers=n,this.dictionaries=s,this.metadataVersion=r}visit(t){return super.visit(t instanceof x?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return m({type:t,length:e})}visitBool(t,{length:e,nullCount:n}=this.nextFieldNode()){return m({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:e,nullCount:n}=this.nextFieldNode()){return m({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:n}=this.nextFieldNode()){return m({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return m({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return m({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return m({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:e,nullCount:n}=this.nextFieldNode()){return m({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:n}=this.nextFieldNode()){return m({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:e,nullCount:n}=this.nextFieldNode()){return m({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:n}=this.nextFieldNode()){return m({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:e,nullCount:n}=this.nextFieldNode()){return m({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:e,nullCount:n}=this.nextFieldNode()){return m({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return this.metadataVersion<K.V5&&this.readNullBitmap(t,n),t.mode===$.Sparse?this.visitSparseUnion(t,{length:e,nullCount:n}):this.visitDenseUnion(t,{length:e,nullCount:n})}visitDenseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return m({type:t,length:e,nullCount:n,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return m({type:t,length:e,nullCount:n,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:e,nullCount:n}=this.nextFieldNode()){return m({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:e,nullCount:n}=this.nextFieldNode()){return m({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDuration(t,{length:e,nullCount:n}=this.nextFieldNode()){return m({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:n}=this.nextFieldNode()){return m({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),child:this.visit(t.children[0])})}visitMap(t,{length:e,nullCount:n}=this.nextFieldNode()){return m({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,e,n=this.nextBufferRange()){return e>0&&this.readData(t,n)||new Uint8Array(0)}readOffsets(t,e){return this.readData(t,e)}readTypeIds(t,e){return this.readData(t,e)}readData(t,{length:e,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+e)}readDictionary(t){return this.dictionaries.get(t.id)}}class Au extends na{constructor(t,e,n,s,r){super(new Uint8Array(0),e,n,s,r),this.sources=t}readNullBitmap(t,e,{offset:n}=this.nextBufferRange()){return e<=0?new Uint8Array(0):yi(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return N(Uint8Array,N(Int32Array,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return N(Uint8Array,N(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){const{sources:n}=this;return y.isTimestamp(t)||(y.isInt(t)||y.isTime(t))&&t.bitWidth===64||y.isDuration(t)||y.isDate(t)&&t.unit===rt.MILLISECOND?N(Uint8Array,tt.convertArray(n[e])):y.isDecimal(t)?N(Uint8Array,mt.convertArray(n[e])):y.isBinary(t)||y.isFixedSizeBinary(t)?Du(n[e]):y.isBool(t)?yi(n[e]):y.isUtf8(t)?on(n[e].join("")):N(Uint8Array,N(t.ArrayType,n[e].map(s=>+s)))}}function Du(i){const t=i.join(""),e=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)e[n>>1]=Number.parseInt(t.slice(n,n+2),16);return e}class Ss extends pn{constructor(t){super(t),this._values=new yn(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,L(e))}_flushPending(t,e){const n=this._offsets,s=this._values.reserve(e).buffer;let r=0;for(const[o,a]of t)if(a===void 0)n.set(o,0);else{const c=a.length;s.set(a,r),n.set(o,c),r+=c}}}class sa extends X{constructor(t){super(t),this._values=new Qo}setValue(t,e){this._values.set(t,+e)}}class Si extends te{}Si.prototype._setValue=uo;class Bs extends Si{}Bs.prototype._setValue=Qn;class As extends Si{}As.prototype._setValue=Xn;class Ds extends te{}Ds.prototype._setValue=yo;class ra extends X{constructor({type:t,nullValues:e,dictionaryHashFunction:n}){super({type:new Qt(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Oe({type:this.type.indices,nullValues:e}),this.dictionary=Oe({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,e){const n=this.indices;return e=n.setValid(t,e),this.length=n.length,e}setValue(t,e){const n=this._keysToIndices,s=this.valueToKey(e);let r=n[s];return r===void 0&&(n[s]=r=this._dictionaryOffset+this.dictionary.append(e).length-1),this.indices.setValue(t,r)}flush(){const t=this.type,e=this._dictionary,n=this.dictionary.toVector(),s=this.indices.flush().clone(t);return s.dictionary=e?e.concat(n):n,this.finished||(this._dictionaryOffset+=n.length),this._dictionary=s.dictionary,this.clear(),s}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}}class Os extends te{}Os.prototype._setValue=lo;class oa extends X{setValue(t,e){const[n]=this.children,s=t*this.stride;for(let r=-1,o=e.length;++r<o;)n.set(s+r,e[r])}addChild(t,e="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");const n=this.children.push(t);return this.type=new Ze(this.type.listSize,new x(e,t.type,!0)),n}}class Bi extends te{setValue(t,e){this._values.set(t,e)}}class aa extends Bi{setValue(t,e){super.setValue(t,qn(e))}}class ca extends Bi{}class la extends Bi{}class Ai extends te{}Ai.prototype._setValue=mo;class Fs extends Ai{}Fs.prototype._setValue=cs;class Ms extends Ai{}Ms.prototype._setValue=ls;class Te extends te{}Te.prototype._setValue=bo;class Ts extends Te{}Ts.prototype._setValue=us;class Ns extends Te{}Ns.prototype._setValue=hs;class Ls extends Te{}Ls.prototype._setValue=ds;class Us extends Te{}Us.prototype._setValue=fs;class Wt extends te{setValue(t,e){this._values.set(t,e)}}class ua extends Wt{}class ha extends Wt{}class da extends Wt{}class fa extends Wt{}class ya extends Wt{}class pa extends Wt{}class ga extends Wt{}class ma extends Wt{}class ba extends pn{constructor(t){super(t),this._offsets=new Xo}addChild(t,e="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new De(new x(e,t.type,!0)),this.numChildren-1}_flushPending(t){const e=this._offsets,[n]=this.children;for(const[s,r]of t)if(typeof r>"u")e.set(s,0);else{const o=r,a=o.length,c=e.set(s,a).buffer[s];for(let l=-1;++l<a;)n.set(c+l,o[l])}}}class _a extends pn{set(t,e){return super.set(t,e)}setValue(t,e){const n=e instanceof Map?e:new Map(Object.entries(e)),s=this._pending||(this._pending=new Map),r=s.get(t);r&&(this._pendingLength-=r.size),this._pendingLength+=n.size,s.set(t,n)}addChild(t,e=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Qe(new x(e,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){const e=this._offsets,[n]=this.children;for(const[s,r]of t)if(r===void 0)e.set(s,0);else{let{[s]:o,[s+1]:a}=e.set(s,r.size).buffer;for(const c of r.entries())if(n.set(o,c),++o>=a)break}}}class va extends X{setValue(t,e){}setValid(t,e){return this.length=Math.max(t+1,this.length),e}}class wa extends X{setValue(t,e){const{children:n,type:s}=this;switch(Array.isArray(e)||e.constructor){case!0:return s.children.forEach((r,o)=>n[o].set(t,e[o]));case Map:return s.children.forEach((r,o)=>n[o].set(t,e.get(r.name)));default:return s.children.forEach((r,o)=>n[o].set(t,e[r.name]))}}setValid(t,e){return super.setValid(t,e)||this.children.forEach(n=>n.setValid(t,e)),e}addChild(t,e=`${this.numChildren}`){const n=this.children.push(t);return this.type=new q([...this.type.children,new x(e,t.type,!0)]),n}}class Ne extends te{}Ne.prototype._setValue=ho;class xs extends Ne{}xs.prototype._setValue=ts;class Cs extends Ne{}Cs.prototype._setValue=es;class Es extends Ne{}Es.prototype._setValue=is;class Vs extends Ne{}Vs.prototype._setValue=ns;class Le extends te{}Le.prototype._setValue=fo;class Rs extends Le{}Rs.prototype._setValue=ss;class zs extends Le{}zs.prototype._setValue=rs;class js extends Le{}js.prototype._setValue=os;class ks extends Le{}ks.prototype._setValue=as;class gn extends X{constructor(t){super(t),this._typeIds=new Ii(new Int8Array(0),1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,e){return this.set(this.length,t,e)}set(t,e,n){return n===void 0&&(n=this._valueToChildTypeId(this,e,t)),this.setValue(t,e,n),this}setValue(t,e,n){this._typeIds.set(t,n);const s=this.type.typeIdToChildIndex[n],r=this.children[s];r?.set(t,e)}addChild(t,e=`${this.children.length}`){const n=this.children.push(t),{type:{children:s,mode:r,typeIds:o}}=this,a=[...s,new x(e,t.type)];return this.type=new he(r,[...o,n],a),n}_valueToChildTypeId(t,e,n){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}}class Ia extends gn{}class Sa extends gn{constructor(t){super(t),this._offsets=new Ii(new Int32Array(0))}setValue(t,e,n){const s=this._typeIds.set(t,n).buffer[t],r=this.getChildAt(this.type.typeIdToChildIndex[s]),o=this._offsets.set(t,r.length).buffer[t];r?.set(o,e)}}class Ps extends pn{constructor(t){super(t),this._values=new yn(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,on(e))}_flushPending(t,e){}}Ps.prototype._flushPending=Ss.prototype._flushPending;class Ou extends F{visitNull(){return va}visitBool(){return sa}visitInt(){return Wt}visitInt8(){return ua}visitInt16(){return ha}visitInt32(){return da}visitInt64(){return fa}visitUint8(){return ya}visitUint16(){return pa}visitUint32(){return ga}visitUint64(){return ma}visitFloat(){return Bi}visitFloat16(){return aa}visitFloat32(){return ca}visitFloat64(){return la}visitUtf8(){return Ps}visitBinary(){return Ss}visitFixedSizeBinary(){return Os}visitDate(){return Si}visitDateDay(){return Bs}visitDateMillisecond(){return As}visitTimestamp(){return Ne}visitTimestampSecond(){return xs}visitTimestampMillisecond(){return Cs}visitTimestampMicrosecond(){return Es}visitTimestampNanosecond(){return Vs}visitTime(){return Le}visitTimeSecond(){return Rs}visitTimeMillisecond(){return zs}visitTimeMicrosecond(){return js}visitTimeNanosecond(){return ks}visitDecimal(){return Ds}visitList(){return ba}visitStruct(){return wa}visitUnion(){return gn}visitDenseUnion(){return Sa}visitSparseUnion(){return Ia}visitDictionary(){return ra}visitInterval(){return Ai}visitIntervalDayTime(){return Fs}visitIntervalYearMonth(){return Ms}visitDuration(){return Te}visitDurationSecond(){return Ts}visitDurationMillisecond(){return Ns}visitDurationMicrosecond(){return Ls}visistDurationNanosecond(){return Us}visitFixedSizeList(){return oa}visitMap(){return _a}}const Fu=new Ou;class w extends F{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((n,s)=>this.compareFields(n,e[s]))}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 et(i,t){return t instanceof i.constructor}function Di(i,t){return i===t||et(i,t)}function ee(i,t){return i===t||et(i,t)&&i.bitWidth===t.bitWidth&&i.isSigned===t.isSigned}function mn(i,t){return i===t||et(i,t)&&i.precision===t.precision}function Mu(i,t){return i===t||et(i,t)&&i.byteWidth===t.byteWidth}function $s(i,t){return i===t||et(i,t)&&i.unit===t.unit}function Oi(i,t){return i===t||et(i,t)&&i.unit===t.unit&&i.timezone===t.timezone}function Fi(i,t){return i===t||et(i,t)&&i.unit===t.unit&&i.bitWidth===t.bitWidth}function Tu(i,t){return i===t||et(i,t)&&i.children.length===t.children.length&&kt.compareManyFields(i.children,t.children)}function Nu(i,t){return i===t||et(i,t)&&i.children.length===t.children.length&&kt.compareManyFields(i.children,t.children)}function Ws(i,t){return i===t||et(i,t)&&i.mode===t.mode&&i.typeIds.every((e,n)=>e===t.typeIds[n])&&kt.compareManyFields(i.children,t.children)}function Lu(i,t){return i===t||et(i,t)&&i.id===t.id&&i.isOrdered===t.isOrdered&&kt.visit(i.indices,t.indices)&&kt.visit(i.dictionary,t.dictionary)}function Ys(i,t){return i===t||et(i,t)&&i.unit===t.unit}function Mi(i,t){return i===t||et(i,t)&&i.unit===t.unit}function Uu(i,t){return i===t||et(i,t)&&i.listSize===t.listSize&&i.children.length===t.children.length&&kt.compareManyFields(i.children,t.children)}function xu(i,t){return i===t||et(i,t)&&i.keysSorted===t.keysSorted&&i.children.length===t.children.length&&kt.compareManyFields(i.children,t.children)}w.prototype.visitNull=Di;w.prototype.visitBool=Di;w.prototype.visitInt=ee;w.prototype.visitInt8=ee;w.prototype.visitInt16=ee;w.prototype.visitInt32=ee;w.prototype.visitInt64=ee;w.prototype.visitUint8=ee;w.prototype.visitUint16=ee;w.prototype.visitUint32=ee;w.prototype.visitUint64=ee;w.prototype.visitFloat=mn;w.prototype.visitFloat16=mn;w.prototype.visitFloat32=mn;w.prototype.visitFloat64=mn;w.prototype.visitUtf8=Di;w.prototype.visitBinary=Di;w.prototype.visitFixedSizeBinary=Mu;w.prototype.visitDate=$s;w.prototype.visitDateDay=$s;w.prototype.visitDateMillisecond=$s;w.prototype.visitTimestamp=Oi;w.prototype.visitTimestampSecond=Oi;w.prototype.visitTimestampMillisecond=Oi;w.prototype.visitTimestampMicrosecond=Oi;w.prototype.visitTimestampNanosecond=Oi;w.prototype.visitTime=Fi;w.prototype.visitTimeSecond=Fi;w.prototype.visitTimeMillisecond=Fi;w.prototype.visitTimeMicrosecond=Fi;w.prototype.visitTimeNanosecond=Fi;w.prototype.visitDecimal=Di;w.prototype.visitList=Tu;w.prototype.visitStruct=Nu;w.prototype.visitUnion=Ws;w.prototype.visitDenseUnion=Ws;w.prototype.visitSparseUnion=Ws;w.prototype.visitDictionary=Lu;w.prototype.visitInterval=Ys;w.prototype.visitIntervalDayTime=Ys;w.prototype.visitIntervalYearMonth=Ys;w.prototype.visitDuration=Mi;w.prototype.visitDurationSecond=Mi;w.prototype.visitDurationMillisecond=Mi;w.prototype.visitDurationMicrosecond=Mi;w.prototype.visitDurationNanosecond=Mi;w.prototype.visitFixedSizeList=Uu;w.prototype.visitMap=xu;const kt=new w;function tn(i,t){return kt.compareSchemas(i,t)}function Cu(i,t){return kt.compareFields(i,t)}function Ba(i,t){return kt.visit(i,t)}function Oe(i){const t=i.type,e=new(Fu.getVisitFn(t)())(i);if(t.children&&t.children.length>0){const n=i.children||[],s={nullValues:i.nullValues},r=Array.isArray(n)?(o,a)=>n[a]||s:({name:o})=>n[o]||s;for(const[o,a]of t.children.entries()){const{type:c}=a,l=r(a,o);e.children.push(Oe(Object.assign(Object.assign({},l),{type:c})))}}return e}function Js(i,t){if(i instanceof E||i instanceof g||i.type instanceof y||ArrayBuffer.isView(i))return fn(i);const e={type:t??Pi(i),nullValues:[null]},n=[...Aa(e)(i)],s=n.length===1?n[0]:n.reduce((r,o)=>r.concat(o));return y.isDictionary(s.type)?s.memoize():s}function Eu(i){const t=Js(i),e=new G(new C(t.type.children),t.data[0]);return new J(e)}function Pi(i){if(i.length===0)return new Vt;let t=0,e=0,n=0,s=0,r=0,o=0,a=0,c=0;for(const l of i){if(l==null){++t;continue}switch(typeof l){case"bigint":++o;continue;case"boolean":++a;continue;case"number":++s;continue;case"string":++r;continue;case"object":Array.isArray(l)?++e:Object.prototype.toString.call(l)==="[object Date]"?++c:++n;continue}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}if(s+t===i.length)return new ln;if(r+t===i.length)return new Qt(new qe,new ue);if(o+t===i.length)return new cn;if(a+t===i.length)return new Ge;if(c+t===i.length)return new ro;if(e+t===i.length){const l=i,h=Pi(l[l.findIndex(d=>d!=null)]);if(l.every(d=>d==null||Ba(h,Pi(d))))return new De(new x("",h,!0))}else if(n+t===i.length){const l=new Map;for(const h of i)for(const d of Object.keys(h))!l.has(d)&&h[d]!=null&&l.set(d,new x(d,Pi([h[d]]),!0));return new q([...l.values()])}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}function Aa(i){const{["queueingStrategy"]:t="count"}=i,{["highWaterMark"]:e=t!=="bytes"?Number.POSITIVE_INFINITY:Math.pow(2,14)}=i,n=t!=="bytes"?"length":"byteLength";return function*(s){let r=0;const o=Oe(i);for(const a of s)o.append(a)[n]>=e&&++r&&(yield o.toVector());(o.finish().length>0||r===0)&&(yield o.toVector())}}function Vu(i){const{["queueingStrategy"]:t="count"}=i,{["highWaterMark"]:e=t!=="bytes"?Number.POSITIVE_INFINITY:Math.pow(2,14)}=i,n=t!=="bytes"?"length":"byteLength";return function(s){return wt(this,arguments,function*(){var r,o,a,c;let l=0;const h=Oe(i);try{for(var d=!0,U=ae(s),M;M=yield D(U.next()),r=M.done,!r;d=!0){c=M.value,d=!1;const k=c;h.append(k)[n]>=e&&++l&&(yield yield D(h.toVector()))}}catch(k){o={error:k}}finally{try{!d&&!r&&(a=U.return)&&(yield D(a.call(U)))}finally{if(o)throw o.error}}(h.finish().length>0||l===0)&&(yield yield D(h.toVector()))})}}function Dn(i,t){return Ru(i,t.map(e=>e.data.concat()))}function Ru(i,t){const e=[...i.fields],n=[],s={numBatches:t.reduce((d,U)=>Math.max(d,U.length),0)};let r=0,o=0,a=-1;const c=t.length;let l,h=[];for(;s.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a<c;)h[a]=l=t[a].shift(),o=Math.min(o,l?l.length:o);Number.isFinite(o)&&(h=zu(e,o,h,t,s),o>0&&(n[r++]=m({type:new q(e),length:o,nullCount:0,children:h.slice()})))}return[i=i.assign(e),n.map(d=>new G(i,d))]}function zu(i,t,e,n,s){var r;const o=(t+63&-64)>>3;for(let a=-1,c=n.length;++a<c;){const l=e[a],h=l?.length;if(h>=t)h===t?e[a]=l:(e[a]=l.slice(0,t),s.numBatches=Math.max(s.numBatches,n[a].unshift(l.slice(t,h-t))));else{const d=i[a];i[a]=d.clone({nullable:!0}),e[a]=(r=l?._changeLengthAndBackfillNullBitmap(t))!==null&&r!==void 0?r:m({type:d.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return e}var Da;class J{constructor(...t){var e,n;if(t.length===0)return this.batches=[],this.schema=new C([]),this._offsets=[0],this;let s,r;t[0]instanceof C&&(s=t.shift()),t.at(-1)instanceof Uint32Array&&(r=t.pop());const o=c=>{if(c){if(c instanceof G)return[c];if(c instanceof J)return c.batches;if(c instanceof E){if(c.type instanceof q)return[new G(new C(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(l=>o(l));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(l=>o(l));if(typeof c=="object"){const l=Object.keys(c),h=l.map(M=>new g([c[M]])),d=new C(l.map((M,k)=>new x(String(M),h[k].type))),[,U]=Dn(d,h);return U.length===0?[new G(c)]:U}}}return[]},a=t.flatMap(c=>o(c));if(s=(n=s??((e=a[0])===null||e===void 0?void 0:e.schema))!==null&&n!==void 0?n:new C([]),!(s instanceof C))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const c of a){if(!(c instanceof G))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!tn(s,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=s,this.batches=a,this._offsets=r??Po(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=ko(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,e){}indexOf(t,e){return-1}getByteLength(t){return 0}[Symbol.iterator](){return this.batches.length>0?_s.visit(new g(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
8
+ ${this.toArray().join(`,
9
+ `)}
10
+ ]`}concat(...t){const e=this.schema,n=this.data.concat(t.flatMap(({data:s})=>s));return new J(e,n.map(s=>new G(e,s)))}slice(t,e){const n=this.schema;[t,e]=ps({length:this.numRows},t,e);const s=$o(this.data,this._offsets,t,e);return new J(n,s.map(r=>new G(n,r)))}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(n=>n.children[t]);if(e.length===0){const{type:n}=this.schema.fields[t],s=m({type:n,length:0,nullCount:0});e.push(s._changeLengthAndBackfillNullBitmap(this.numRows))}return new g(e)}return null}setChild(t,e){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(s=>s.name===t),e)}setChildAt(t,e){let n=this.schema,s=[...this.batches];if(t>-1&&t<this.numCols){e||(e=new g([m({type:new Vt,length:this.numRows})]));const r=n.fields.slice(),o=r[t].clone({type:e.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[r[t],a[t]]=[o,e],[n,s]=Dn(n,a)}return new J(n,s)}select(t){const e=this.schema.fields.reduce((n,s,r)=>n.set(s.name,r),new Map);return this.selectAt(t.map(n=>e.get(n)).filter(n=>n>-1))}selectAt(t){const e=this.schema.selectAt(t),n=this.batches.map(s=>s.selectAt(t));return new J(e,n)}assign(t){const e=this.schema.fields,[n,s]=t.schema.fields.reduce((a,c,l)=>{const[h,d]=a,U=e.findIndex(M=>M.name===c.name);return~U?d[U]=l:h.push(l),a},[[],[]]),r=this.schema.assign(t.schema),o=[...e.map((a,c)=>[c,s[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...n.map(a=>t.getChildAt(a))].filter(Boolean);return new J(...Dn(r,o))}}Da=Symbol.toStringTag;J[Da]=(i=>(i.schema=null,i.batches=[],i._offsets=new Uint32Array([0]),i._nullCount=-1,i[Symbol.isConcatSpreadable]=!0,i.isValid=Je(bs),i.get=Je(ot.getVisitFn(u.Struct)),i.set=Wo(gt.getVisitFn(u.Struct)),i.indexOf=Yo(Ji.getVisitFn(u.Struct)),i.getByteLength=Je(zt.getVisitFn(u.Struct)),"Table"))(J.prototype);function ju(i){const t={},e=Object.entries(i);for(const[n,s]of e)t[n]=fn(s);return new J(t)}function ku(i){const t={},e=Object.entries(i);for(const[n,s]of e)t[n]=Js(s);return new J(t)}var Oa;let G=class oi{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof C))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=m({nullCount:0,type:new q(this.schema.fields),children:this.schema.fields.map(e=>m({type:e.type,nullCount:0}))})]=t,!(this.data instanceof E))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=pr(this.schema,this.data.children);break}case 1:{const[e]=t,{fields:n,children:s,length:r}=Object.keys(e).reduce((c,l,h)=>(c.children[h]=e[l],c.length=Math.max(c.length,e[l].length),c.fields[h]=x.new({name:l,type:e[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),o=new C(n),a=m({type:new q(n),length:r,children:s,nullCount:0});[this.schema,this.data]=pr(o,a.children,r);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=Fa(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 ot.visit(this.data,t)}set(t,e){return gt.visit(this.data,t,e)}indexOf(t,e){return Ji.visit(this.data,t,e)}getByteLength(t){return zt.visit(this.data,t)}[Symbol.iterator](){return _s.visit(new g([this.data]))}toArray(){return[...this]}concat(...t){return new J(this.schema,[this,...t])}slice(t,e){const[n]=new g([this.data]).slice(t,e).data;return new oi(this.schema,n)}getChild(t){var e;return this.getChildAt((e=this.schema.fields)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new g([this.data.children[t]]):null}setChild(t,e){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(s=>s.name===t),e)}setChildAt(t,e){let n=this.schema,s=this.data;if(t>-1&&t<this.numCols){e||(e=new g([m({type:new Vt,length:this.numRows})]));const r=n.fields.slice(),o=s.children.slice(),a=r[t].clone({type:e.type});[r[t],o[t]]=[a,e.data[0]],n=new C(r,new Map(this.schema.metadata)),s=m({type:new q(r),children:o})}return new oi(n,s)}select(t){const e=this.schema.select(t),n=new q(e.fields),s=[];for(const r of t){const o=this.schema.fields.findIndex(a=>a.name===r);~o&&(s[o]=this.data.children[o])}return new oi(e,m({type:n,length:this.numRows,children:s}))}selectAt(t){const e=this.schema.selectAt(t),n=t.map(r=>this.data.children[r]).filter(Boolean),s=m({type:new q(e.fields),length:this.numRows,children:n});return new oi(e,s)}};Oa=Symbol.toStringTag;G[Oa]=(i=>(i._nullCount=-1,i[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(G.prototype);function pr(i,t,e=t.reduce((n,s)=>Math.max(n,s.length),0)){var n;const s=[...i.fields],r=[...t],o=(e+63&-64)>>3;for(const[a,c]of i.fields.entries()){const l=t[a];(!l||l.length!==e)&&(s[a]=c.clone({nullable:!0}),r[a]=(n=l?._changeLengthAndBackfillNullBitmap(e))!==null&&n!==void 0?n:m({type:c.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)}))}return[i.assign(s),m({type:new q(s),length:e,children:r})]}function Fa(i,t,e=new Map){var n,s;if(((n=i?.length)!==null&&n!==void 0?n:0)>0&&i?.length===t?.length)for(let r=-1,o=i.length;++r<o;){const{type:a}=i[r],c=t[r];for(const l of[c,...((s=c?.dictionary)===null||s===void 0?void 0:s.data)||[]])Fa(a.children,l?.children,e);if(y.isDictionary(a)){const{id:l}=a;if(!e.has(l))c?.dictionary&&e.set(l,c.dictionary);else if(e.get(l)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return e}class Hs extends G{constructor(t){const e=t.fields.map(s=>m({type:s.type})),n=m({type:new q(t.fields),nullCount:0,children:e});super(t,n)}}var en;(function(i){i[i.BUFFER=0]="BUFFER"})(en||(en={}));var nn;(function(i){i[i.LZ4_FRAME=0]="LZ4_FRAME",i[i.ZSTD=1]="ZSTD"})(nn||(nn={}));class oe{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 oe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+z),(e||new oe).__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):nn.LZ4_FRAME}method(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):en.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,nn.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,en.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,n){return oe.startBodyCompression(t),oe.addCodec(t,e),oe.addMethod(t,n),oe.endBodyCompression(t)}}class Ma{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,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(e??0)),t.offset()}}let Ta=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,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(e??0)),t.offset()}},Jt=class xn{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 xn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+z),(e||new xn).__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 n=this.bb.__offset(this.bb_pos,6);return n?(e||new Ta).__init(this.bb.__vector(this.bb_pos+n)+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 n=this.bb.__offset(this.bb_pos,8);return n?(e||new Ma).__init(this.bb.__vector(this.bb_pos+n)+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 oe).__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()}},je=class Cn{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 Cn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+z),(e||new Cn).__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 Jt).__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 mi;(function(i){i[i.NONE=0]="NONE",i[i.Schema=1]="Schema",i[i.DictionaryBatch=2]="DictionaryBatch",i[i.RecordBatch=3]="RecordBatch",i[i.Tensor=4]="Tensor",i[i.SparseTensor=5]="SparseTensor"})(mi||(mi={}));let se=class Ot{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 Ot).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+z),(e||new Ot).__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):ei.V1}headerType(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):mi.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 n=this.bb.__offset(this.bb_pos,12);return n?(e||new Y).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+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,ei.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,mi.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 n=e.length-1;n>=0;n--)t.addOffset(e[n]);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,n,s,r,o){return Ot.startMessage(t),Ot.addVersion(t,e),Ot.addHeaderType(t,n),Ot.addHeader(t,s),Ot.addBodyLength(t,r),Ot.addCustomMetadata(t,o),Ot.endMessage(t)}};class Pu extends F{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return we.startNull(e),we.endNull(e)}visitInt(t,e){return lt.startInt(e),lt.addBitWidth(e,t.bitWidth),lt.addIsSigned(e,t.isSigned),lt.endInt(e)}visitFloat(t,e){return xt.startFloatingPoint(e),xt.addPrecision(e,t.precision),xt.endFloatingPoint(e)}visitBinary(t,e){return be.startBinary(e),be.endBinary(e)}visitBool(t,e){return _e.startBool(e),_e.endBool(e)}visitUtf8(t,e){return Se.startUtf8(e),Se.endUtf8(e)}visitDecimal(t,e){return it.startDecimal(e),it.addScale(e,t.scale),it.addPrecision(e,t.precision),it.addBitWidth(e,t.bitWidth),it.endDecimal(e)}visitDate(t,e){return zi.startDate(e),zi.addUnit(e,t.unit),zi.endDate(e)}visitTime(t,e){return dt.startTime(e),dt.addUnit(e,t.unit),dt.addBitWidth(e,t.bitWidth),dt.endTime(e)}visitTimestamp(t,e){const n=t.timezone&&e.createString(t.timezone)||void 0;return ft.startTimestamp(e),ft.addUnit(e,t.unit),n!==void 0&&ft.addTimezone(e,n),ft.endTimestamp(e)}visitInterval(t,e){return Ct.startInterval(e),Ct.addUnit(e,t.unit),Ct.endInterval(e)}visitDuration(t,e){return Nt.startDuration(e),Nt.addUnit(e,t.unit),Nt.endDuration(e)}visitList(t,e){return ve.startList(e),ve.endList(e)}visitStruct(t,e){return Ie.startStruct_(e),Ie.endStruct_(e)}visitUnion(t,e){nt.startTypeIdsVector(e,t.typeIds.length);const n=nt.createTypeIdsVector(e,t.typeIds);return nt.startUnion(e),nt.addMode(e,t.mode),nt.addTypeIds(e,n),nt.endUnion(e)}visitDictionary(t,e){const n=this.visit(t.indices,e);return Kt.startDictionaryEncoding(e),Kt.addId(e,BigInt(t.id)),Kt.addIsOrdered(e,t.isOrdered),n!==void 0&&Kt.addIndexType(e,n),Kt.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return Lt.startFixedSizeBinary(e),Lt.addByteWidth(e,t.byteWidth),Lt.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return Ut.startFixedSizeList(e),Ut.addListSize(e,t.listSize),Ut.endFixedSizeList(e)}visitMap(t,e){return ji.startMap(e),ji.addKeysSorted(e,t.keysSorted),ji.endMap(e)}}const On=new Pu;function $u(i,t=new Map){return new C(Yu(i,t),$i(i.metadata),t)}function Na(i){return new ut(i.count,La(i.columns),Ua(i.columns))}function Wu(i){return new Pt(Na(i.data),i.id,i.isDelta)}function Yu(i,t){return(i.fields||[]).filter(Boolean).map(e=>x.fromJSON(e,t))}function gr(i,t){return(i.children||[]).filter(Boolean).map(e=>x.fromJSON(e,t))}function La(i){return(i||[]).reduce((t,e)=>[...t,new ye(e.count,Ju(e.VALIDITY)),...La(e.children)],[])}function Ua(i,t=[]){for(let e=-1,n=(i||[]).length;++e<n;){const s=i[e];s.VALIDITY&&t.push(new Et(t.length,s.VALIDITY.length)),s.TYPE_ID&&t.push(new Et(t.length,s.TYPE_ID.length)),s.OFFSET&&t.push(new Et(t.length,s.OFFSET.length)),s.DATA&&t.push(new Et(t.length,s.DATA.length)),t=Ua(s.children,t)}return t}function Ju(i){return(i||[]).reduce((t,e)=>t+ +(e===0),0)}function Hu(i,t){let e,n,s,r,o,a;return!t||!(r=i.dictionary)?(o=br(i,gr(i,t)),s=new x(i.name,o,i.nullable,$i(i.metadata))):t.has(e=r.id)?(n=(n=r.indexType)?mr(n):new ue,a=new Qt(t.get(e),n,e,r.isOrdered),s=new x(i.name,a,i.nullable,$i(i.metadata))):(n=(n=r.indexType)?mr(n):new ue,t.set(e,o=br(i,gr(i,t))),a=new Qt(o,n,e,r.isOrdered),s=new x(i.name,a,i.nullable,$i(i.metadata))),s||null}function $i(i=[]){return new Map(i.map(({key:t,value:e})=>[t,e]))}function mr(i){return new Q(i.isSigned,i.bitWidth)}function br(i,t){const e=i.type.name;switch(e){case"NONE":return new Vt;case"null":return new Vt;case"binary":return new ui;case"utf8":return new qe;case"bool":return new Ge;case"list":return new De((t||[])[0]);case"struct":return new q(t||[]);case"struct_":return new q(t||[])}switch(e){case"int":{const n=i.type;return new Q(n.isSigned,n.bitWidth)}case"floatingpoint":{const n=i.type;return new qt(H[n.precision])}case"decimal":{const n=i.type;return new hi(n.scale,n.precision,n.bitWidth)}case"date":{const n=i.type;return new Be(rt[n.unit])}case"time":{const n=i.type;return new Rt(f[n.unit],n.bitWidth)}case"timestamp":{const n=i.type;return new Gt(f[n.unit],n.timezone)}case"interval":{const n=i.type;return new Ae(pt[n.unit])}case"duration":{const n=i.type;return new Zt(f[n.unit])}case"union":{const n=i.type,[s,...r]=(n.mode+"").toLowerCase(),o=s.toUpperCase()+r.join("");return new he($[o],n.typeIds||[],t||[])}case"fixedsizebinary":{const n=i.type;return new di(n.byteWidth)}case"fixedsizelist":{const n=i.type;return new Ze(n.listSize,(t||[])[0])}case"map":{const n=i.type;return new Qe((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var Ku=ea,qu=ti;class Z{static fromJSON(t,e){const n=new Z(0,K.V5,e);return n._createHeader=Gu(t,e),n}static decode(t){t=new qu(L(t));const e=se.getRootAsMessage(t),n=e.bodyLength(),s=e.version(),r=e.headerType(),o=new Z(n,s,r);return o._createHeader=Zu(e,r),o}static encode(t){const e=new Ku;let n=-1;return t.isSchema()?n=C.encode(e,t.header()):t.isRecordBatch()?n=ut.encode(e,t.header()):t.isDictionaryBatch()&&(n=Pt.encode(e,t.header())),se.startMessage(e),se.addVersion(e,K.V5),se.addHeader(e,n),se.addHeaderType(e,t.headerType),se.addBodyLength(e,BigInt(t.bodyLength)),se.finishMessageBuffer(e,se.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof C)return new Z(0,K.V5,R.Schema,t);if(t instanceof ut)return new Z(e,K.V5,R.RecordBatch,t);if(t instanceof Pt)return new Z(e,K.V5,R.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===R.Schema}isRecordBatch(){return this.headerType===R.RecordBatch}isDictionaryBatch(){return this.headerType===R.DictionaryBatch}constructor(t,e,n,s){this._version=e,this._headerType=n,this.body=new Uint8Array(0),s&&(this._createHeader=()=>s),this._bodyLength=Bt(t)}}class ut{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,e,n){this._nodes=e,this._buffers=n,this._length=Bt(t)}}class Pt{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,n=!1){this._data=t,this._isDelta=n,this._id=Bt(e)}}class Et{constructor(t,e){this.offset=Bt(t),this.length=Bt(e)}}class ye{constructor(t,e){this.length=Bt(t),this.nullCount=Bt(e)}}function Gu(i,t){return()=>{switch(t){case R.Schema:return C.fromJSON(i);case R.RecordBatch:return ut.fromJSON(i);case R.DictionaryBatch:return Pt.fromJSON(i)}throw new Error(`Unrecognized Message type: { name: ${R[t]}, type: ${t} }`)}}function Zu(i,t){return()=>{switch(t){case R.Schema:return C.decode(i.header(new Ft),new Map,i.version());case R.RecordBatch:return ut.decode(i.header(new Jt),i.version());case R.DictionaryBatch:return Pt.decode(i.header(new je),i.version())}throw new Error(`Unrecognized Message type: { name: ${R[t]}, type: ${t} }`)}}x.encode=ch;x.decode=oh;x.fromJSON=Hu;C.encode=ah;C.decode=Qu;C.fromJSON=$u;ut.encode=lh;ut.decode=Xu;ut.fromJSON=Na;Pt.encode=uh;Pt.decode=th;Pt.fromJSON=Wu;ye.encode=hh;ye.decode=ih;Et.encode=dh;Et.decode=eh;function Qu(i,t=new Map,e=K.V5){const n=rh(i,t);return new C(n,Wi(i),t,e)}function Xu(i,t=K.V5){if(i.compression()!==null)throw new Error("Record batch compression not implemented");return new ut(i.length(),nh(i),sh(i,t))}function th(i,t=K.V5){return new Pt(ut.decode(i.data(),t),i.id(),i.isDelta())}function eh(i){return new Et(i.offset(),i.length())}function ih(i){return new ye(i.length(),i.nullCount())}function nh(i){const t=[];for(let e,n=-1,s=-1,r=i.nodesLength();++n<r;)(e=i.nodes(n))&&(t[++s]=ye.decode(e));return t}function sh(i,t){const e=[];for(let n,s=-1,r=-1,o=i.buffersLength();++s<o;)(n=i.buffers(s))&&(t<K.V4&&(n.bb_pos+=8*(s+1)),e[++r]=Et.decode(n));return e}function rh(i,t){const e=[];for(let n,s=-1,r=-1,o=i.fieldsLength();++s<o;)(n=i.fields(s))&&(e[++r]=x.decode(n,t));return e}function _r(i,t){const e=[];for(let n,s=-1,r=-1,o=i.childrenLength();++s<o;)(n=i.children(s))&&(e[++r]=x.decode(n,t));return e}function oh(i,t){let e,n,s,r,o,a;return!t||!(a=i.dictionary())?(s=wr(i,_r(i,t)),n=new x(i.name(),s,i.nullable(),Wi(i))):t.has(e=Bt(a.id()))?(r=(r=a.indexType())?vr(r):new ue,o=new Qt(t.get(e),r,e,a.isOrdered()),n=new x(i.name(),o,i.nullable(),Wi(i))):(r=(r=a.indexType())?vr(r):new ue,t.set(e,s=wr(i,_r(i,t))),o=new Qt(s,r,e,a.isOrdered()),n=new x(i.name(),o,i.nullable(),Wi(i))),n||null}function Wi(i){const t=new Map;if(i)for(let e,n,s=-1,r=Math.trunc(i.customMetadataLength());++s<r;)(e=i.customMetadata(s))&&(n=e.key())!=null&&t.set(n,e.value());return t}function vr(i){return new Q(i.isSigned(),i.bitWidth())}function wr(i,t){const e=i.typeType();switch(e){case T.NONE:return new Vt;case T.Null:return new Vt;case T.Binary:return new ui;case T.Utf8:return new qe;case T.Bool:return new Ge;case T.List:return new De((t||[])[0]);case T.Struct_:return new q(t||[])}switch(e){case T.Int:{const n=i.type(new lt);return new Q(n.isSigned(),n.bitWidth())}case T.FloatingPoint:{const n=i.type(new xt);return new qt(n.precision())}case T.Decimal:{const n=i.type(new it);return new hi(n.scale(),n.precision(),n.bitWidth())}case T.Date:{const n=i.type(new zi);return new Be(n.unit())}case T.Time:{const n=i.type(new dt);return new Rt(n.unit(),n.bitWidth())}case T.Timestamp:{const n=i.type(new ft);return new Gt(n.unit(),n.timezone())}case T.Interval:{const n=i.type(new Ct);return new Ae(n.unit())}case T.Duration:{const n=i.type(new Nt);return new Zt(n.unit())}case T.Union:{const n=i.type(new nt);return new he(n.mode(),n.typeIdsArray()||[],t||[])}case T.FixedSizeBinary:{const n=i.type(new Lt);return new di(n.byteWidth())}case T.FixedSizeList:{const n=i.type(new Ut);return new Ze(n.listSize(),(t||[])[0])}case T.Map:{const n=i.type(new ji);return new Qe((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${T[e]}" (${e})`)}function ah(i,t){const e=t.fields.map(r=>x.encode(i,r));Ft.startFieldsVector(i,e.length);const n=Ft.createFieldsVector(i,e),s=t.metadata&&t.metadata.size>0?Ft.createCustomMetadataVector(i,[...t.metadata].map(([r,o])=>{const a=i.createString(`${r}`),c=i.createString(`${o}`);return Y.startKeyValue(i),Y.addKey(i,a),Y.addValue(i,c),Y.endKeyValue(i)})):-1;return Ft.startSchema(i),Ft.addFields(i,n),Ft.addEndianness(i,fh?ii.Little:ii.Big),s!==-1&&Ft.addCustomMetadata(i,s),Ft.endSchema(i)}function ch(i,t){let e=-1,n=-1,s=-1;const r=t.type;let o=t.typeId;y.isDictionary(r)?(o=r.dictionary.typeId,s=On.visit(r,i),n=On.visit(r.dictionary,i)):n=On.visit(r,i);const a=(r.children||[]).map(h=>x.encode(i,h)),c=ht.createChildrenVector(i,a),l=t.metadata&&t.metadata.size>0?ht.createCustomMetadataVector(i,[...t.metadata].map(([h,d])=>{const U=i.createString(`${h}`),M=i.createString(`${d}`);return Y.startKeyValue(i),Y.addKey(i,U),Y.addValue(i,M),Y.endKeyValue(i)})):-1;return t.name&&(e=i.createString(t.name)),ht.startField(i),ht.addType(i,n),ht.addTypeType(i,o),ht.addChildren(i,c),ht.addNullable(i,!!t.nullable),e!==-1&&ht.addName(i,e),s!==-1&&ht.addDictionary(i,s),l!==-1&&ht.addCustomMetadata(i,l),ht.endField(i)}function lh(i,t){const e=t.nodes||[],n=t.buffers||[];Jt.startNodesVector(i,e.length);for(const o of e.slice().reverse())ye.encode(i,o);const s=i.endVector();Jt.startBuffersVector(i,n.length);for(const o of n.slice().reverse())Et.encode(i,o);const r=i.endVector();return Jt.startRecordBatch(i),Jt.addLength(i,BigInt(t.length)),Jt.addNodes(i,s),Jt.addBuffers(i,r),Jt.endRecordBatch(i)}function uh(i,t){const e=ut.encode(i,t.data);return je.startDictionaryBatch(i),je.addId(i,BigInt(t.id)),je.addIsDelta(i,t.isDelta),je.addData(i,e),je.endDictionaryBatch(i)}function hh(i,t){return Ta.createFieldNode(i,BigInt(t.length),BigInt(t.nullCount))}function dh(i,t){return Ma.createBuffer(i,BigInt(t.offset),BigInt(t.length))}const fh=(()=>{const i=new ArrayBuffer(2);return new DataView(i).setInt16(0,256,!0),new Int16Array(i)[0]===256})(),Ks=i=>`Expected ${R[i]} Message in stream, but was null or length 0.`,qs=i=>`Header pointer of flatbuffer-encoded ${R[i]} Message is null or length 0.`,xa=(i,t)=>`Expected to read ${i} metadata bytes, but only read ${t}.`,Ca=(i,t)=>`Expected to read ${i} bytes for message body, but only read ${t}.`;class Gs{constructor(t){this.source=t instanceof gi?t:new gi(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?j: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(Ks(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);const e=L(this.source.read(t));if(e.byteLength<t)throw new Error(Ca(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){const e=R.Schema,n=this.readMessage(e),s=n?.header();if(t&&!s)throw new Error(qs(e));return s}readMetadataLength(){const t=this.source.read(bn),e=t&&new ti(t),n=e?.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(t){const e=this.source.read(t);if(!e)return j;if(e.byteLength<t)throw new Error(xa(t,e.byteLength));return{done:!1,value:Z.decode(e)}}}class Ea{constructor(t,e){this.source=t instanceof fe?t:Mr(t)?new Xi(t,e):new fe(t)}[Symbol.asyncIterator](){return this}next(){return p(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?j:t})}throw(t){return p(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return p(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return p(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(Ks(t));return e.value})}readMessageBody(t){return p(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);const e=L(yield this.source.read(t));if(e.byteLength<t)throw new Error(Ca(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(t=!1){return p(this,void 0,void 0,function*(){const e=R.Schema,n=yield this.readMessage(e),s=n?.header();if(t&&!s)throw new Error(qs(e));return s})}readMetadataLength(){return p(this,void 0,void 0,function*(){const t=yield this.source.read(bn),e=t&&new ti(t),n=e?.readInt32(0)||0;return{done:n===0,value:n}})}readMetadata(t){return p(this,void 0,void 0,function*(){const e=yield this.source.read(t);if(!e)return j;if(e.byteLength<t)throw new Error(xa(t,e.byteLength));return{done:!1,value:Z.decode(e)}})}}class Va extends Gs{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof fr?t:new fr(t)}next(){const{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:Z.fromJSON(t.schema,R.Schema)};if(this._dictionaryIndex<t.dictionaries.length){const e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:Z.fromJSON(e,R.DictionaryBatch)}}if(this._batchIndex<t.batches.length){const e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:Z.fromJSON(e,R.RecordBatch)}}return this._body=[],j}readMessageBody(t){return e(this._body);function e(n){return(n||[]).reduce((s,r)=>[...s,...r.VALIDITY&&[r.VALIDITY]||[],...r.TYPE_ID&&[r.TYPE_ID]||[],...r.OFFSET&&[r.OFFSET]||[],...r.DATA&&[r.DATA]||[],...e(r.children)],[])}}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(Ks(t));return e.value}readSchema(){const t=R.Schema,e=this.readMessage(t),n=e?.header();if(!e||!n)throw new Error(qs(t));return n}}const bn=4,En="ARROW1",bi=new Uint8Array(En.length);for(let i=0;i<En.length;i+=1)bi[i]=En.codePointAt(i);function Zs(i,t=0){for(let e=-1,n=bi.length;++e<n;)if(bi[e]!==i[t+e])return!1;return!0}const Ti=bi.length,Ra=Ti+bn,yh=Ti*2+bn;class yt extends vs{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 ce(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 ct.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return ct.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 yt?t:Mn(t)?mh(t):Mr(t)?vh(t):ce(t)?p(this,void 0,void 0,function*(){return yield yt.from(yield t)}):Tr(t)||Rn(t)||Nr(t)||Fe(t)?_h(new fe(t)):bh(new gi(t))}static readAll(t){return t instanceof yt?t.isSync()?Ir(t):Sr(t):Mn(t)||ArrayBuffer.isView(t)||ri(t)||Fr(t)?Ir(t):Sr(t)}}class si extends yt{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return wt(this,arguments,function*(){yield D(yield*Vi(ae(this[Symbol.iterator]())))})}}class _i extends yt{constructor(t){super(t),this._impl=t}readAll(){var t,e,n,s;return p(this,void 0,void 0,function*(){const r=new Array;try{for(var o=!0,a=ae(this),c;c=yield a.next(),t=c.done,!t;o=!0){s=c.value,o=!1;const l=s;r.push(l)}}catch(l){e={error:l}}finally{try{!o&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(e)throw e.error}}return r})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class _n extends si{constructor(t){super(t),this._impl=t}}class za extends _i{constructor(t){super(t),this._impl=t}}class ja{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 n=this._loadVectors(t,e,this.schema.fields),s=m({type:new q(this.schema.fields),length:t.length,children:n});return new G(this.schema,s)}_loadDictionaryBatch(t,e){const{id:n,isDelta:s}=t,{dictionaries:r,schema:o}=this,a=r.get(n);if(s||!a){const c=o.dictionaries.get(n),l=this._loadVectors(t.data,e,[c]);return(a&&s?a.concat(new g(l)):new g(l)).memoize()}return a.memoize()}_loadVectors(t,e,n){return new na(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}}class sn extends ja{constructor(t,e){super(e),this._reader=Mn(t)?new Va(this._handle=t):new Gs(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=Pa(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):j}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):j}next(){if(this.closed)return j;let t;const{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;const n=t.header(),s=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,s)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const n=t.header(),s=e.readMessageBody(t.bodyLength),r=this._loadDictionaryBatch(n,s);this.dictionaries.set(n.id,r)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Hs(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}}class rn extends ja{constructor(t,e){super(e),this._reader=new Ea(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return p(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 p(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Pa(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return p(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):j})}return(t){return p(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):j})}next(){return p(this,void 0,void 0,function*(){if(this.closed)return j;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 n=t.header(),s=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,s)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const n=t.header(),s=yield e.readMessageBody(t.bodyLength),r=this._loadDictionaryBatch(n,s);this.dictionaries.set(n.id,r)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Hs(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return p(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}}class ka extends sn{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 yr?t:new yr(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 n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){const s=this._reader.readMessage(R.RecordBatch);if(s?.isRecordBatch()){const r=s.header(),o=this._reader.readMessageBody(s.bodyLength);return this._loadRecordBatch(r,o)}}return null}_readDictionaryBatch(t){var e;const n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){const s=this._reader.readMessage(R.DictionaryBatch);if(s?.isDictionaryBatch()){const r=s.header(),o=this._reader.readMessageBody(s.bodyLength),a=this._loadDictionaryBatch(r,o);this.dictionaries.set(r.id,a)}}}_readFooter(){const{_handle:t}=this,e=t.size-Ra,n=t.readInt32(e),s=t.readAt(e-n,n);return pi.decode(s)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){const n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(this._recordBatchIndex);if(n&&this._handle.seek(n.offset))return this._reader.readMessage(t)}return null}}class ph extends rn{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 n=typeof e[0]!="number"?e.shift():void 0,s=e[0]instanceof Map?e.shift():void 0;super(t instanceof Xi?t:new Xi(t,n),s)}isFile(){return!0}isAsync(){return!0}open(t){const e=Object.create(null,{open:{get:()=>super.open}});return p(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(const n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)})}readRecordBatch(t){var e;return p(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());const n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){const s=yield this._reader.readMessage(R.RecordBatch);if(s?.isRecordBatch()){const r=s.header(),o=yield this._reader.readMessageBody(s.bodyLength);return this._loadRecordBatch(r,o)}}return null})}_readDictionaryBatch(t){var e;return p(this,void 0,void 0,function*(){const n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){const s=yield this._reader.readMessage(R.DictionaryBatch);if(s?.isDictionaryBatch()){const r=s.header(),o=yield this._reader.readMessageBody(s.bodyLength),a=this._loadDictionaryBatch(r,o);this.dictionaries.set(r.id,a)}}})}_readFooter(){return p(this,void 0,void 0,function*(){const{_handle:t}=this;t._pending&&(yield t._pending);const e=t.size-Ra,n=yield t.readInt32(e),s=yield t.readAt(e-n,n);return pi.decode(s)})}_readNextMessageAndValidate(t){return p(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 gh extends sn{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new Au(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}}function Pa(i,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:i.autoDestroy}function*Ir(i){const t=yt.from(i);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function Sr(i){return wt(this,arguments,function*(){const e=yield D(yt.from(i));try{if(!(yield D(e.open({autoDestroy:!1}))).closed)do yield yield D(e);while(!(yield D(e.reset().open())).closed)}finally{yield D(e.cancel())}})}function mh(i){return new si(new gh(i))}function bh(i){const t=i.peek(Ti+7&-8);return t&&t.byteLength>=4?Zs(t)?new _n(new ka(i.read())):new si(new sn(i)):new si(new sn(function*(){}()))}function _h(i){return p(this,void 0,void 0,function*(){const t=yield i.peek(Ti+7&-8);return t&&t.byteLength>=4?Zs(t)?new _n(new ka(yield i.read())):new _i(new rn(i)):new _i(new rn(function(){return wt(this,arguments,function*(){})}()))})}function vh(i){return p(this,void 0,void 0,function*(){const{size:t}=yield i.stat(),e=new Xi(i,t);return t>=yh&&Zs(yield e.readAt(0,Ti+7&-8))?new za(new ph(e)):new _i(new rn(e))})}class P extends F{static assemble(...t){const e=s=>s.flatMap(r=>Array.isArray(r)?e(r):r instanceof G?r.data.children:r.data),n=new P;return n.visitMany(e(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof g)return this.visitMany(t.data),this;const{type:e}=t;if(!y.isDictionary(e)){const{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(y.isUnion(e))this.nodes.push(new ye(n,0));else{const{nullCount:s}=t;y.isNull(e)||It.call(this,s<=0?new Uint8Array(0):fi(t.offset,n,t.nullBitmap)),this.nodes.push(new ye(n,s))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}}function It(i){const t=i.byteLength+7&-8;return this.buffers.push(i),this.bufferRegions.push(new Et(this._byteLength,t)),this._byteLength+=t,this}function wh(i){var t;const{type:e,length:n,typeIds:s,valueOffsets:r}=i;if(It.call(this,s),e.mode===$.Sparse)return Vn.call(this,i);if(e.mode===$.Dense){if(i.offset<=0)return It.call(this,r),Vn.call(this,i);{const o=new Int32Array(n),a=Object.create(null),c=Object.create(null);for(let l,h,d=-1;++d<n;)(l=s[d])!==void 0&&((h=a[l])===void 0&&(h=a[l]=r[d]),o[d]=r[d]-h,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);It.call(this,o),this.visitMany(i.children.map((l,h)=>{const d=e.typeIds[h],U=a[d],M=c[d];return l.slice(U,Math.min(n,M))}))}}return this}function Ih(i){let t;return i.nullCount>=i.length?It.call(this,new Uint8Array(0)):(t=i.values)instanceof Uint8Array?It.call(this,fi(i.offset,i.length,t)):It.call(this,yi(i.values))}function ie(i){return It.call(this,i.values.subarray(0,i.length*i.stride))}function $a(i){const{length:t,values:e,valueOffsets:n}=i,{[0]:s,[t]:r}=n,o=Math.min(r-s,e.byteLength-s);return It.call(this,jn(-s,t+1,n)),It.call(this,e.subarray(s,s+o)),this}function Qs(i){const{length:t,valueOffsets:e}=i;if(e){const{[0]:n,[t]:s}=e;return It.call(this,jn(-n,t+1,e)),this.visit(i.children[0].slice(n,s-n))}return this.visit(i.children[0])}function Vn(i){return this.visitMany(i.type.children.map((t,e)=>i.children[e]).filter(Boolean))[0]}P.prototype.visitBool=Ih;P.prototype.visitInt=ie;P.prototype.visitFloat=ie;P.prototype.visitUtf8=$a;P.prototype.visitBinary=$a;P.prototype.visitFixedSizeBinary=ie;P.prototype.visitDate=ie;P.prototype.visitTimestamp=ie;P.prototype.visitTime=ie;P.prototype.visitDecimal=ie;P.prototype.visitList=Qs;P.prototype.visitStruct=Vn;P.prototype.visitUnion=wh;P.prototype.visitInterval=ie;P.prototype.visitDuration=ie;P.prototype.visitFixedSizeList=Qs;P.prototype.visitMap=Qs;class Sh extends F{visit(t){return t==null?void 0:super.visit(t)}visitNull({typeId:t}){return{name:T[t].toLowerCase()}}visitInt({typeId:t,bitWidth:e,isSigned:n}){return{name:T[t].toLowerCase(),bitWidth:e,isSigned:n}}visitFloat({typeId:t,precision:e}){return{name:T[t].toLowerCase(),precision:H[e]}}visitBinary({typeId:t}){return{name:T[t].toLowerCase()}}visitBool({typeId:t}){return{name:T[t].toLowerCase()}}visitUtf8({typeId:t}){return{name:T[t].toLowerCase()}}visitDecimal({typeId:t,scale:e,precision:n,bitWidth:s}){return{name:T[t].toLowerCase(),scale:e,precision:n,bitWidth:s}}visitDate({typeId:t,unit:e}){return{name:T[t].toLowerCase(),unit:rt[e]}}visitTime({typeId:t,unit:e,bitWidth:n}){return{name:T[t].toLowerCase(),unit:f[e],bitWidth:n}}visitTimestamp({typeId:t,timezone:e,unit:n}){return{name:T[t].toLowerCase(),unit:f[n],timezone:e}}visitInterval({typeId:t,unit:e}){return{name:T[t].toLowerCase(),unit:pt[e]}}visitDuration({typeId:t,unit:e}){return{name:T[t].toLocaleLowerCase(),unit:f[e]}}visitList({typeId:t}){return{name:T[t].toLowerCase()}}visitStruct({typeId:t}){return{name:T[t].toLowerCase()}}visitUnion({typeId:t,mode:e,typeIds:n}){return{name:T[t].toLowerCase(),mode:$[e].toUpperCase(),typeIds:[...n]}}visitDictionary(t){return this.visit(t.dictionary)}visitFixedSizeBinary({typeId:t,byteWidth:e}){return{name:T[t].toLowerCase(),byteWidth:e}}visitFixedSizeList({typeId:t,listSize:e}){return{name:T[t].toLowerCase(),listSize:e}}visitMap({typeId:t,keysSorted:e}){return{name:T[t].toLowerCase(),keysSorted:e}}}class vn extends F{static assemble(...t){const e=new vn;return t.map(({schema:n,data:s})=>e.visitMany(n.fields,s.children))}visit({name:t},e){const{length:n}=e,{offset:s,nullCount:r,nullBitmap:o}=e,a=y.isDictionary(e.type)?e.type.indices:e.type,c=Object.assign([],e.buffers,{[bt.VALIDITY]:void 0});return Object.assign({name:t,count:n,VALIDITY:y.isNull(a)||y.isUnion(a)?void 0:r<=0?Array.from({length:n},()=>1):[...new Xe(o,s,n,null,gs)]},super.visit(e.clone(a,s,n,0,c)))}visitNull(){return{}}visitBool({values:t,offset:e,length:n}){return{DATA:[...new Xe(t,e,n,null,dn)]}}visitInt(t){return{DATA:t.type.bitWidth<64?[...t.values]:[...Ce(t.values,2)]}}visitFloat(t){return{DATA:[...t.values]}}visitUtf8(t){return{DATA:[...new g([t])],OFFSET:[...t.valueOffsets]}}visitBinary(t){return{DATA:[...Br(new g([t]))],OFFSET:[...t.valueOffsets]}}visitFixedSizeBinary(t){return{DATA:[...Br(new g([t]))]}}visitDate(t){return{DATA:t.type.unit===rt.DAY?[...t.values]:[...Ce(t.values,2)]}}visitTimestamp(t){return{DATA:[...Ce(t.values,2)]}}visitTime(t){return{DATA:t.type.unit<f.MICROSECOND?[...t.values]:[...Ce(t.values,2)]}}visitDecimal(t){return{DATA:[...Ce(t.values,4)]}}visitList(t){return{OFFSET:[...t.valueOffsets],children:this.visitMany(t.type.children,t.children)}}visitStruct(t){return{children:this.visitMany(t.type.children,t.children)}}visitUnion(t){return{TYPE_ID:[...t.typeIds],OFFSET:t.type.mode===$.Dense?[...t.valueOffsets]:void 0,children:this.visitMany(t.type.children,t.children)}}visitInterval(t){return{DATA:[...t.values]}}visitDuration(t){return{DATA:[...Ce(t.values,2)]}}visitFixedSizeList(t){return{children:this.visitMany(t.type.children,t.children)}}visitMap(t){return{OFFSET:[...t.valueOffsets],children:this.visitMany(t.type.children,t.children)}}}function*Br(i){for(const t of i)yield t.reduce((e,n)=>`${e}${("0"+(n&255).toString(16)).slice(-2)}`,"").toUpperCase()}function*Ce(i,t){const e=new Uint32Array(i.buffer);for(let n=-1,s=e.length/t;++n<s;)yield`${vi.new(e.subarray((n+0)*t,(n+1)*t),!1)}`}class Ni extends vs{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')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new He,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,st(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return ce(t)?t.then(e=>this.writeAll(e)):Fe(t)?er(this,t):tr(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,e=null){return t===this._sink||t instanceof He?this._sink=t:(this._sink=new He,t&&Za(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&Qa(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,(!e||!tn(e,this._schema))&&(e==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=e,this._writeSchema(e))),this}write(t){let e=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof J&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof G&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!tn(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof G?t instanceof Hs||this._writeRecordBatch(t):t instanceof J?this.writeAll(t.batches):ri(t)&&this.writeAll(t)}_writeMessage(t,e=8){const n=e-1,s=Z.encode(t),r=s.byteLength,o=this._writeLegacyIpcFormat?4:8,a=r+o+n&~n,c=a-r-o;return t.headerType===R.RecordBatch?this._recordBatchBlocks.push(new jt(a,t.bodyLength,this._position)):t.headerType===R.DictionaryBatch&&this._dictionaryBlocks.push(new jt(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),r>0&&this._write(s),this._writePadding(c)}_write(t){if(this._started){const e=L(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(Z.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(bi)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){const{byteLength:e,nodes:n,bufferRegions:s,buffers:r}=P.assemble(t),o=new ut(t.numRows,n,s),a=Z.from(o,e);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(r)}_writeDictionaryBatch(t,e,n=!1){this._dictionaryDeltaOffsets.set(e,t.length+(this._dictionaryDeltaOffsets.get(e)||0));const{byteLength:s,nodes:r,bufferRegions:o,buffers:a}=P.assemble(new g([t])),c=new ut(t.length,r,o),l=new Pt(c,e,n),h=Z.from(l,s);return this._writeMessage(h)._writeBodyBuffers(a)}_writeBodyBuffers(t){let e,n,s;for(let r=-1,o=t.length;++r<o;)(e=t[r])&&(n=e.byteLength)>0&&(this._write(e),(s=(n+7&-8)-n)>0&&this._writePadding(s));return this}_writeDictionaries(t){for(let[e,n]of t.dictionaries){let s=this._dictionaryDeltaOffsets.get(e)||0;if(s===0||(n=n?.slice(s)).length>0)for(const r of n.data)this._writeDictionaryBatch(r,e,s>0),s+=r.length}return this}}class Li extends Ni{static writeAll(t,e){const n=new Li(e);return ce(t)?t.then(s=>n.writeAll(s)):Fe(t)?er(n,t):tr(n,t)}}class Ui extends Ni{static writeAll(t){const e=new Ui;return ce(t)?t.then(n=>e.writeAll(n)):Fe(t)?er(e,t):tr(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){const e=pi.encode(new pi(t,K.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}}class Xs extends Ni{static writeAll(t){return new Xs().writeAll(t)}constructor(){super(),this._autoDestroy=!0,this._recordBatches=[],this._dictionaries=[]}_writeMessage(){return this}_writeFooter(t){return this}_writeSchema(t){return this._write(`{
11
+ "schema": ${JSON.stringify({fields:t.fields.map(e=>Wa(e))},null,2)}`)}_writeDictionaries(t){return t.dictionaries.size>0&&this._dictionaries.push(t),this}_writeDictionaryBatch(t,e,n=!1){return this._dictionaryDeltaOffsets.set(e,t.length+(this._dictionaryDeltaOffsets.get(e)||0)),this._write(this._dictionaryBlocks.length===0?" ":`,
12
+ `),this._write(`${Bh(t,e,n)}`),this._dictionaryBlocks.push(new jt(0,0,0)),this}_writeRecordBatch(t){return this._writeDictionaries(t),this._recordBatches.push(t),this}close(){if(this._dictionaries.length>0){this._write(`,
13
+ "dictionaries": [
14
+ `);for(const t of this._dictionaries)super._writeDictionaries(t);this._write(`
15
+ ]`)}if(this._recordBatches.length>0){for(let t=-1,e=this._recordBatches.length;++t<e;)this._write(t===0?`,
16
+ "batches": [
17
+ `:`,
18
+ `),this._write(`${Ah(this._recordBatches[t])}`),this._recordBatchBlocks.push(new jt(0,0,0));this._write(`
19
+ ]`)}return this._schema&&this._write(`
20
+ }`),this._dictionaries=[],this._recordBatches=[],super.close()}}function tr(i,t){let e=t;t instanceof J&&(e=t.batches,i.reset(void 0,t.schema));for(const n of e)i.write(n);return i.finish()}function er(i,t){var e,n,s,r,o,a,c;return p(this,void 0,void 0,function*(){try{for(e=!0,n=ae(t);s=yield n.next(),r=s.done,!r;e=!0){c=s.value,e=!1;const l=c;i.write(l)}}catch(l){o={error:l}}finally{try{!e&&!r&&(a=n.return)&&(yield a.call(n))}finally{if(o)throw o.error}}return i.finish()})}function Wa({name:i,type:t,nullable:e}){const n=new Sh;return{name:i,nullable:e,type:n.visit(t),children:(t.children||[]).map(s=>Wa(s)),dictionary:y.isDictionary(t)?{id:t.id,isOrdered:t.isOrdered,indexType:n.visit(t.indices)}:void 0}}function Bh(i,t,e=!1){const[n]=vn.assemble(new G({[t]:i}));return JSON.stringify({id:t,isDelta:e,data:{count:i.length,columns:n}},null,2)}function Ah(i){const[t]=vn.assemble(i);return JSON.stringify({count:i.numRows,columns:t},null,2)}function Dh(i,t){if(Fe(i))return Fh(i,t);if(ri(i))return Oh(i,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function Oh(i,t){let e=null;const n=t?.type==="bytes"||!1,s=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){r(o,e||(e=i[Symbol.iterator]()))},pull(o){e?r(o,e):o.close()},cancel(){(e?.return&&e.return()||!0)&&(e=null)}}),Object.assign({highWaterMark:n?s:void 0},t));function r(o,a){let c,l=null,h=o.desiredSize||null;for(;!(l=a.next(n?h:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=L(l.value))&&(h!=null&&n&&(h=h-c.byteLength+1),l.value=c),o.enqueue(l.value),h!=null&&--h<=0)return;o.close()}}function Fh(i,t){let e=null;const n=t?.type==="bytes"||!1,s=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){return p(this,void 0,void 0,function*(){yield r(o,e||(e=i[Symbol.asyncIterator]()))})},pull(o){return p(this,void 0,void 0,function*(){e?yield r(o,e):o.close()})},cancel(){return p(this,void 0,void 0,function*(){(e?.return&&(yield e.return())||!0)&&(e=null)})}}),Object.assign({highWaterMark:n?s:void 0},t));function r(o,a){return p(this,void 0,void 0,function*(){let c,l=null,h=o.desiredSize||null;for(;!(l=yield a.next(n?h:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=L(l.value))&&(h!=null&&n&&(h=h-c.byteLength+1),l.value=c),o.enqueue(l.value),h!=null&&--h<=0)return;o.close()})}}function Mh(i){return new Th(i)}class Th{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;const{["readableStrategy"]:e,["writableStrategy"]:n,["queueingStrategy"]:s="count"}=t,r=Ha(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Oe(r),this._getSize=s!=="bytes"?Ar:Dr;const{["highWaterMark"]:o=s==="bytes"?Math.pow(2,14):1e3}=Object.assign({},e),{["highWaterMark"]:a=s==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:o,size:s!=="bytes"?Ar:Dr}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:c=>this._writeValueAndReturnChunkSize(c)})}_writeValueAndReturnChunkSize(t){const e=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-e}_maybeFlush(t,e){e!=null&&(this._bufferedSize>=e.desiredSize&&++this._numChunks&&this._enqueue(e,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(e,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(e,null)))}_enqueue(t,e){this._bufferedSize=0,this._controller=null,e==null?t.close():t.enqueue(e)}}const Ar=i=>{var t;return(t=i?.length)!==null&&t!==void 0?t:0},Dr=i=>{var t;return(t=i?.byteLength)!==null&&t!==void 0?t:0};function ir(i,t){const e=new He;let n=null;const s=new ReadableStream({cancel(){return p(this,void 0,void 0,function*(){yield e.close()})},start(a){return p(this,void 0,void 0,function*(){yield o(a,n||(n=yield r()))})},pull(a){return p(this,void 0,void 0,function*(){n?yield o(a,n):a.close()})}});return{writable:new WritableStream(e,Object.assign({highWaterMark:Math.pow(2,14)},i)),readable:s};function r(){return p(this,void 0,void 0,function*(){return yield(yield yt.from(e)).open(t)})}function o(a,c){return p(this,void 0,void 0,function*(){let l=a.desiredSize,h=null;for(;!(h=yield c.next()).done;)if(a.enqueue(h.value),l!=null&&--l<=0)return;a.close()})}}function nr(i,t){const e=new this(i),n=new fe(e),s=new ReadableStream({cancel(){return p(this,void 0,void 0,function*(){yield n.cancel()})},pull(o){return p(this,void 0,void 0,function*(){yield r(o)})},start(o){return p(this,void 0,void 0,function*(){yield r(o)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(e,i),readable:s};function r(o){return p(this,void 0,void 0,function*(){let a=null,c=o.desiredSize;for(;a=yield n.read(c||null);)if(o.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;o.close()})}}function Ya(i){const t=yt.from(i);return ce(t)?t.then(e=>Ya(e)):t.isAsync()?t.readAll().then(e=>new J(e)):new J(t.readAll())}function Nh(i,t="stream"){return(t==="stream"?Li:Ui).writeAll(i).toUint8Array(!0)}const Lh=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},xc),Bu),iu),tl),Dc),tu),Uc),{compareSchemas:tn,compareFields:Cu,compareTypes:Ba});ct.toDOMStream=Dh;X.throughDOM=Mh;yt.throughDOM=ir;_n.throughDOM=ir;si.throughDOM=ir;Ni.throughDOM=nr;Ui.throughDOM=nr;Li.throughDOM=nr;const Hh=Object.freeze(Object.defineProperty({__proto__:null,AsyncByteQueue:He,AsyncByteStream:fe,AsyncMessageReader:Ea,AsyncRecordBatchFileReader:za,AsyncRecordBatchStreamReader:_i,Binary:ui,BinaryBuilder:Ss,Bool:Ge,BoolBuilder:sa,get BufferType(){return bt},Builder:X,ByteStream:gi,Data:E,DataType:y,DateBuilder:Si,DateDay:Cc,DateDayBuilder:Bs,DateMillisecond:ro,DateMillisecondBuilder:As,get DateUnit(){return rt},Date_:Be,Decimal:hi,DecimalBuilder:Ds,DenseUnion:Gc,DenseUnionBuilder:Sa,Dictionary:Qt,DictionaryBuilder:ra,Duration:Zt,DurationBuilder:Te,DurationMicrosecond:Kc,DurationMicrosecondBuilder:Ls,DurationMillisecond:Hc,DurationMillisecondBuilder:Ns,DurationNanosecond:qc,DurationNanosecondBuilder:Us,DurationSecond:Jc,DurationSecondBuilder:Ts,Field:x,FixedSizeBinary:di,FixedSizeBinaryBuilder:Os,FixedSizeList:Ze,FixedSizeListBuilder:oa,Float:qt,Float16:so,Float16Builder:aa,Float32:Hn,Float32Builder:ca,Float64:ln,Float64Builder:la,FloatBuilder:Bi,Int:Q,Int16:Pn,Int16Builder:ha,Int32:ue,Int32Builder:da,Int64:cn,Int64Builder:fa,Int8:kn,Int8Builder:ua,IntBuilder:Wt,Interval:Ae,IntervalBuilder:Ai,IntervalDayTime:Wc,IntervalDayTimeBuilder:Fs,get IntervalUnit(){return pt},IntervalYearMonth:Yc,IntervalYearMonthBuilder:Ms,JSONMessageReader:Va,List:De,ListBuilder:ba,MapBuilder:_a,MapRow:wi,Map_:Qe,Message:Z,get MessageHeader(){return mi},MessageReader:Gs,get MetadataVersion(){return K},Null:Vt,NullBuilder:va,get Precision(){return H},RecordBatch:G,RecordBatchFileReader:_n,RecordBatchFileWriter:Ui,RecordBatchJSONWriter:Xs,RecordBatchReader:yt,RecordBatchStreamReader:si,RecordBatchStreamWriter:Li,RecordBatchWriter:Ni,Schema:C,SparseUnion:Zc,SparseUnionBuilder:Ia,Struct:q,StructBuilder:wa,StructRow:un,Table:J,Time:Rt,TimeBuilder:Le,TimeMicrosecond:Rc,TimeMicrosecondBuilder:js,TimeMillisecond:Vc,TimeMillisecondBuilder:zs,TimeNanosecond:zc,TimeNanosecondBuilder:ks,TimeSecond:Ec,TimeSecondBuilder:Rs,get TimeUnit(){return f},Timestamp:Gt,TimestampBuilder:Ne,TimestampMicrosecond:Pc,TimestampMicrosecondBuilder:Es,TimestampMillisecond:kc,TimestampMillisecondBuilder:Cs,TimestampNanosecond:$c,TimestampNanosecondBuilder:Vs,TimestampSecond:jc,TimestampSecondBuilder:xs,get Type(){return u},Uint16:Wn,Uint16Builder:pa,Uint32:Yn,Uint32Builder:ga,Uint64:Jn,Uint64Builder:ma,Uint8:$n,Uint8Builder:ya,Union:he,UnionBuilder:gn,get UnionMode(){return $},Utf8:qe,Utf8Builder:Ps,Vector:g,Visitor:F,builderThroughAsyncIterable:Vu,builderThroughIterable:Aa,makeBuilder:Oe,makeData:m,makeTable:ju,makeVector:fn,tableFromArrays:ku,tableFromIPC:Ya,tableFromJSON:Eu,tableToIPC:Nh,util:Lh,vectorFromArray:Js},Symbol.toStringTag,{value:"Module"}));export{Hh as A,sr as _,Ha as a,Uh as b};
@@ -0,0 +1 @@
1
+ import{u as o}from"./index-jhBr1wbn.js";import"./zip-B-jFFAGa.js";import"./arrow-DJf2ErbF.js";import"./exporters-C_6J153K.js";import"./bcf-D5-QWGO9.js";import"./drawing-2d-gWfpdfYe.js";import"./lens-CSASnhAL.js";import"./sandbox-B79eavQ3.js";import"./server-client-D3bUPJJc.js";import"./ids-B4jTqB1O.js";const n=700;function D(s){const e=o.getState(),i=e.basketViews.find(t=>t.id===s);if(i){if(e.setDrawing2D(null),e.setDrawing2DPanelVisible(!1),e.updateDrawing2DDisplayOptions({show3DOverlay:!1}),e.clearEntitySelection(),e.restoreBasketEntities(i.entityRefs,s),i.viewpoint){const t=i.transitionMs??n;e.cameraCallbacks.applyViewpoint?.(i.viewpoint,!0,t)}if(i.section){const t=i.section;o.setState({sectionPlane:{...t.plane},drawing2DPanelVisible:!1}),t.plane.enabled?(e.activeTool!=="section"&&e.setSuppressNextSection2DPanelAutoOpen(!0),e.setActiveTool("section")):e.activeTool==="section"&&e.setActiveTool("select")}else{const t=o.getState().sectionPlane;o.setState({sectionPlane:{...t,enabled:!1}}),e.activeTool==="section"&&e.setActiveTool("select")}}}export{D as activateBasketViewFromStore};