sdjs 0.1.0__py3-none-any.whl

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 (68) hide show
  1. sdjs/__init__.py +1 -0
  2. sdjs/__main__.py +3 -0
  3. sdjs/app/assets/Arrow.dom-B-azcdhS.js +2 -0
  4. sdjs/app/assets/CodecFixtureDemo-CI4ksOQT.js +1 -0
  5. sdjs/app/assets/GroupBlendDemo-DwrA1wbT.js +2 -0
  6. sdjs/app/assets/GroupGridDemo-CJtHpjS6.js +3 -0
  7. sdjs/app/assets/MultiCanvasDemo-D7Drapvg.js +1 -0
  8. sdjs/app/assets/PickDiagnosticDemo-Dqinqkp_.js +1 -0
  9. sdjs/app/assets/SharedElementDemo-DZAKzjyc.js +1 -0
  10. sdjs/app/assets/__vite-browser-external-2W3EstLn.js +1 -0
  11. sdjs/app/assets/__vite-browser-external-CA24GZmQ.js +1 -0
  12. sdjs/app/assets/adapter-CL8KVEO3.js +1 -0
  13. sdjs/app/assets/array-utils-flat-CPHZqbzf.js +1 -0
  14. sdjs/app/assets/basedecoder-B9MSveFr.js +1 -0
  15. sdjs/app/assets/blosc-DEOJs6D5.js +17 -0
  16. sdjs/app/assets/buffer-layout-utils-CNmNf5hG.js +1 -0
  17. sdjs/app/assets/buffer-transform-JbBrTijo.js +11 -0
  18. sdjs/app/assets/chunk-INHXZS53-DAOLzMPX.js +1 -0
  19. sdjs/app/assets/codec-worker-CX4ly_7E.js +1 -0
  20. sdjs/app/assets/codec-worker-D7zLfRWK.js +10 -0
  21. sdjs/app/assets/compiler-runtime-CAfxf4JJ.js +1 -0
  22. sdjs/app/assets/compute-pipeline-DCDUMgFt.js +3 -0
  23. sdjs/app/assets/deflate-Cdx7cYKj.js +1 -0
  24. sdjs/app/assets/dist-Cni3pAA9.js +2 -0
  25. sdjs/app/assets/expression-TaCJYzhU.js +365 -0
  26. sdjs/app/assets/external-texture-t8-J3thf.js +1 -0
  27. sdjs/app/assets/fence-nplZ-mmZ.js +2 -0
  28. sdjs/app/assets/fixtureUrls-CCOMCYin.js +1 -0
  29. sdjs/app/assets/get-attribute-from-layouts-BZVFJF-m.js +1 -0
  30. sdjs/app/assets/groupDemoLayers-CaSfYPCL.js +1 -0
  31. sdjs/app/assets/index-3iq6Xsui.css +1 -0
  32. sdjs/app/assets/index-B48sJ3dv.js +43 -0
  33. sdjs/app/assets/jpeg-Cv9xHQ4w.js +1 -0
  34. sdjs/app/assets/jsx-runtime-CGSxa44d.js +8785 -0
  35. sdjs/app/assets/lerc-j5yPRTYI.js +1 -0
  36. sdjs/app/assets/libopenjph-C0XvmX8-.mjs +2 -0
  37. sdjs/app/assets/libopenjph-D69GHHuE.wasm +0 -0
  38. sdjs/app/assets/lz4-BFJkNc3o.js +15 -0
  39. sdjs/app/assets/lzw-g8vcOne0.js +1 -0
  40. sdjs/app/assets/openjpegwasm_decode-B3gWTHpv.wasm +0 -0
  41. sdjs/app/assets/packbits-GZth5uN_.js +1 -0
  42. sdjs/app/assets/pako.esm-CtVA0R7W.js +1 -0
  43. sdjs/app/assets/parquet-worker-CJbArzoh.js +2 -0
  44. sdjs/app/assets/parquet_wasm-CRFnmKNg.js +1 -0
  45. sdjs/app/assets/parquet_wasm-OCuGOT-e.js +1 -0
  46. sdjs/app/assets/parquet_wasm_bg-B1vu2ek6.wasm +0 -0
  47. sdjs/app/assets/pointsFeatures-BfCPXCtw.js +1 -0
  48. sdjs/app/assets/pointsScan-DlEiHDDa.js +1 -0
  49. sdjs/app/assets/pointsTiling-CxhpLxiQ.js +1 -0
  50. sdjs/app/assets/raw-O6YTYq51.js +1 -0
  51. sdjs/app/assets/rolldown-runtime-hePW80VL.js +1 -0
  52. sdjs/app/assets/shader-type-decoder-Di2Xle6p.js +12 -0
  53. sdjs/app/assets/src-CDsD7llV.js +2 -0
  54. sdjs/app/assets/viewFix-hlLx6n-Z.js +11 -0
  55. sdjs/app/assets/webgl-DoPUCOxz.js +344 -0
  56. sdjs/app/assets/webgl-device-NSO_blte.js +1 -0
  57. sdjs/app/assets/webgpu-CXc2BB1s.js +406 -0
  58. sdjs/app/assets/webgpu-device-YlJiZNL6.js +161 -0
  59. sdjs/app/assets/webimage-BJB9ZY5I.js +1 -0
  60. sdjs/app/assets/zstd-CGD_7wnU.js +15 -0
  61. sdjs/app/index.html +37 -0
  62. sdjs/cli.py +82 -0
  63. sdjs/server.py +327 -0
  64. sdjs-0.1.0.dist-info/METADATA +35 -0
  65. sdjs-0.1.0.dist-info/RECORD +68 -0
  66. sdjs-0.1.0.dist-info/WHEEL +5 -0
  67. sdjs-0.1.0.dist-info/entry_points.txt +2 -0
  68. sdjs-0.1.0.dist-info/top_level.txt +1 -0
sdjs/__init__.py ADDED
@@ -0,0 +1 @@
1
+ """sdjs: serve local SpatialData stores and browse them in the SpatialData.js viewer."""
sdjs/__main__.py ADDED
@@ -0,0 +1,3 @@
1
+ from sdjs.cli import main
2
+
3
+ main()
@@ -0,0 +1,2 @@
1
+ import{n as e}from"./rolldown-runtime-hePW80VL.js";function t(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function n(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function r(e){return this instanceof r?(this.v=e,this):new r(e)}function i(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var i=n.apply(e,t||[]),a,o=[];return a=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),c(`next`),c(`throw`),c(`return`,s),a[Symbol.asyncIterator]=function(){return this},a;function s(e){return function(t){return Promise.resolve(t).then(e,te)}}function c(e,t){i[e]&&(a[e]=function(t){return new Promise(function(n,r){o.push([e,t,n,r])>1||l(e,t)})},t&&(a[e]=t(a[e])))}function l(e,t){try{u(i[e](t))}catch(e){d(o[0][3],e)}}function u(e){e.value instanceof r?Promise.resolve(e.value.v).then(ee,te):d(o[0][2],e)}function ee(e){l(`next`,e)}function te(e){l(`throw`,e)}function d(e,t){e(t),o.shift(),o.length&&l(o[0][0],o[0][1])}}function a(e){var t,n;return t={},i(`next`),i(`throw`,function(e){throw e}),i(`return`),t[Symbol.iterator]=function(){return this},t;function i(i,a){t[i]=e[i]?function(t){return(n=!n)?{value:r(e[i](t)),done:!1}:a?a(t):t}:a}}function o(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof n==`function`?n(e):e[Symbol.iterator](),r={},i(`next`),i(`throw`),i(`return`),r[Symbol.asyncIterator]=function(){return this},r);function i(t){r[t]=e[t]&&function(n){return new Promise(function(r,i){n=e[t](n),a(r,i,n.done,n.value)})}}function a(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}var s=new TextDecoder(`utf-8`),c=s.decode.bind(s),l=new TextEncoder,u=e=>l.encode(e),ee=e=>typeof e==`number`,te=e=>typeof e==`boolean`,d=e=>typeof e==`function`,ne=e=>e!=null&&Object(e)===e,re=e=>ne(e)&&d(e.then),ie=e=>ne(e)&&d(e[Symbol.iterator]),ae=e=>ne(e)&&d(e[Symbol.asyncIterator]),oe=e=>ne(e)&&ne(e.schema),se=e=>ne(e)&&`done`in e&&`value`in e,ce=e=>ne(e)&&d(e.stat)&&ee(e.fd),le=e=>ne(e)&&de(e.body),ue=e=>`_getDOMStream`in e&&`_getNodeStream`in e,de=e=>ne(e)&&d(e.cancel)&&d(e.getReader)&&!ue(e),fe=e=>ne(e)&&d(e.read)&&d(e.pipe)&&te(e.readable)&&!ue(e),pe=e=>ne(e)&&d(e.clear)&&d(e.bytes)&&d(e.position)&&d(e.setPosition)&&d(e.capacity)&&d(e.getBufferIdentifier)&&d(e.createLong),me=typeof SharedArrayBuffer<`u`?SharedArrayBuffer:ArrayBuffer;function he(e){let t=e[0]?[e[0]]:[],n,r,i,a;for(let o,s,c=0,l=0,u=e.length;++c<u;){if(o=t[l],s=e[c],!o||!s||o.buffer!==s.buffer||s.byteOffset<o.byteOffset){s&&(t[++l]=s);continue}if({byteOffset:n,byteLength:i}=o,{byteOffset:r,byteLength:a}=s,n+i<r||r+a<n){s&&(t[++l]=s);continue}t[l]=new Uint8Array(o.buffer,n,r-n+a)}return t}function ge(e,t,n=0,r=t.byteLength){let i=e.byteLength,a=new Uint8Array(e.buffer,e.byteOffset,i),o=new Uint8Array(t.buffer,t.byteOffset,Math.min(r,i));return a.set(o,n),e}function _e(e,t){let n=he(e),r=n.reduce((e,t)=>e+t.byteLength,0),i,a,o,s=0,c=-1,l=Math.min(t||1/0,r);for(let e=n.length;++c<e;){if(i=n[c],a=i.subarray(0,Math.min(i.length,l-s)),l<=s+a.length){a.length<i.length?n[c]=i.subarray(a.length):a.length===i.length&&c++,o?ge(o,a,s):o=a;break}ge(o||=new Uint8Array(l),a,s),s+=a.length}return[o||new Uint8Array,n.slice(c),r-(o?o.byteLength:0)]}function f(e,t){let n=se(t)?t.value:t;return n instanceof e?e===Uint8Array?new e(n.buffer,n.byteOffset,n.byteLength):n:n?(typeof n==`string`&&(n=u(n)),n instanceof ArrayBuffer||n instanceof me?new e(n):pe(n)?f(e,n.bytes()):ArrayBuffer.isView(n)?n.byteLength<=0?new e(0):new e(n.buffer,n.byteOffset,n.byteLength/e.BYTES_PER_ELEMENT):e.from(n)):new e(0)}var ve=e=>f(Int32Array,e),ye=e=>f(BigInt64Array,e),p=e=>f(Uint8Array,e),be=e=>(e.next(),e);function*xe(e,t){let n=function*(e){yield e};return yield*be((function*(t){let n=null;do n=t.next(yield f(e,n));while(!n.done)})((typeof t==`string`||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof me?n(t):ie(t)?t:n(t))[Symbol.iterator]())),new e}var Se=e=>xe(Uint8Array,e);function Ce(e,t){return i(this,arguments,function*(){if(re(t))return yield r(yield r(yield*a(o(Ce(e,yield r(t))))));let n=function(e){return i(this,arguments,function*(){yield yield r(yield r(e))})};return yield r(yield*a(o(be((function(t){return i(this,arguments,function*(){let n=null;do n=yield r(t.next(yield yield r(f(e,n))));while(!n.done)})})((typeof t==`string`||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof me?n(t):ie(t)?function(e){return i(this,arguments,function*(){yield r(yield*a(o(be((function*(e){let t=null;do t=e.next(yield t?.value);while(!t.done)})(e[Symbol.iterator]())))))})}(t):ae(t)?t:n(t))[Symbol.asyncIterator]()))))),yield r(new e)})}var we=e=>Ce(Uint8Array,e);function Te(e,t){let n=0,r=e.length;if(r!==t.length)return!1;if(r>0)do if(e[n]!==t[n])return!1;while(++n<r);return!0}var Ee={fromIterable(e){return De(Oe(e))},fromAsyncIterable(e){return De(ke(e))},fromDOMStream(e){return De(Ae(e))},fromNodeStream(e){return De(Ne(e))},toDOMStream(e,t){throw Error(`"toDOMStream" not available in this environment`)},toNodeStream(e,t){throw Error(`"toNodeStream" not available in this environment`)}},De=e=>(e.next(),e);function*Oe(e){let t,n=!1,r=[],i,a,o,s=0;function c(){return a===`peek`?_e(r,o)[0]:([i,r,s]=_e(r,o),i)}({cmd:a,size:o}=(yield null)||{cmd:`read`,size:0});let l=Se(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(o-s)?l.next():l.next(o-s),!t&&i.byteLength>0&&(r.push(i),s+=i.byteLength),t||o<=s)do({cmd:a,size:o}=yield c());while(o<s);while(!t)}catch(e){n=!0,typeof l.throw==`function`&&l.throw(e)}finally{n===!1&&typeof l.return==`function`&&l.return(null)}return null}function ke(e){return i(this,arguments,function*(){let t,n=!1,i=[],a,o,s,c=0;function l(){return o===`peek`?_e(i,s)[0]:([a,i,c]=_e(i,s),a)}({cmd:o,size:s}=(yield yield r(null))||{cmd:`read`,size:0});let u=we(e)[Symbol.asyncIterator]();try{do if({done:t,value:a}=Number.isNaN(s-c)?yield r(u.next()):yield r(u.next(s-c)),!t&&a.byteLength>0&&(i.push(a),c+=a.byteLength),t||s<=c)do({cmd:o,size:s}=yield yield r(l()));while(s<c);while(!t)}catch(e){n=!0,typeof u.throw==`function`&&(yield r(u.throw(e)))}finally{n===!1&&typeof u.return==`function`&&(yield r(u.return(new Uint8Array)))}return yield r(null)})}function Ae(e){return i(this,arguments,function*(){let t=!1,n=!1,i=[],a,o,s,c=0;function l(){return o===`peek`?_e(i,s)[0]:([a,i,c]=_e(i,s),a)}({cmd:o,size:s}=(yield yield r(null))||{cmd:`read`,size:0});let u=new je(e);try{do if({done:t,value:a}=Number.isNaN(s-c)?yield r(u.read()):yield r(u.read(s-c)),!t&&a.byteLength>0&&(i.push(p(a)),c+=a.byteLength),t||s<=c)do({cmd:o,size:s}=yield yield r(l()));while(s<c);while(!t)}catch(e){n=!0,yield r(u.cancel(e))}finally{n===!1?yield r(u.cancel()):e.locked&&u.releaseLock()}return yield r(null)})}var je=class{constructor(e){this.source=e,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(e){return t(this,void 0,void 0,function*(){let{reader:t,source:n}=this;t&&(yield t.cancel(e).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(e){return t(this,void 0,void 0,function*(){if(e===0)return{done:this.reader==null,value:new Uint8Array};let t=yield this.reader.read();return!t.done&&(t.value=p(t)),t})}},Me=(e,t)=>{let n=e=>r([t,e]),r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function Ne(e){return i(this,arguments,function*(){let t=[],n=`error`,i=!1,a=null,o,s,c=0,l=[],u;function ee(){return o===`peek`?_e(l,s)[0]:([u,l,c]=_e(l,s),u)}if({cmd:o,size:s}=(yield yield r(null))||{cmd:`read`,size:0},e.isTTY)return yield yield r(new Uint8Array),yield r(null);try{t[0]=Me(e,`end`),t[1]=Me(e,`error`);do{if(t[2]=Me(e,`readable`),[n,a]=yield r(Promise.race(t.map(e=>e[2]))),n===`error`)break;if((i=n===`end`)||(Number.isFinite(s-c)?(u=p(e.read(s-c)),u.byteLength<s-c&&(u=p(e.read()))):u=p(e.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),i||s<=c)do({cmd:o,size:s}=yield yield r(ee()));while(s<c)}while(!i)}finally{yield r(te(t,n===`error`?a:null))}return yield r(null);function te(t,n){return u=l=null,new Promise((r,i)=>{for(let[n,r]of t)e.off(n,r);try{let t=e.destroy;t&&t.call(e,n),n=void 0}catch(e){n=e||n}finally{n==null?r():i(n)}})}})}var m;(function(e){e[e.V1=0]=`V1`,e[e.V2=1]=`V2`,e[e.V3=2]=`V3`,e[e.V4=3]=`V4`,e[e.V5=4]=`V5`})(m||={});var h;(function(e){e[e.Sparse=0]=`Sparse`,e[e.Dense=1]=`Dense`})(h||={});var g;(function(e){e[e.HALF=0]=`HALF`,e[e.SINGLE=1]=`SINGLE`,e[e.DOUBLE=2]=`DOUBLE`})(g||={});var Pe;(function(e){e[e.DAY=0]=`DAY`,e[e.MILLISECOND=1]=`MILLISECOND`})(Pe||={});var _;(function(e){e[e.SECOND=0]=`SECOND`,e[e.MILLISECOND=1]=`MILLISECOND`,e[e.MICROSECOND=2]=`MICROSECOND`,e[e.NANOSECOND=3]=`NANOSECOND`})(_||={});var v;(function(e){e[e.YEAR_MONTH=0]=`YEAR_MONTH`,e[e.DAY_TIME=1]=`DAY_TIME`,e[e.MONTH_DAY_NANO=2]=`MONTH_DAY_NANO`})(v||={});var Fe=new Int32Array(2),Ie=new Float32Array(Fe.buffer),Le=new Float64Array(Fe.buffer),Re=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1,ze;(function(e){e[e.UTF8_BYTES=1]=`UTF8_BYTES`,e[e.UTF16_STRING=2]=`UTF16_STRING`})(ze||={});var Be=class e{constructor(e){this.bytes_=e,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new e(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(e){this.position_=e}capacity(){return this.bytes_.length}readInt8(e){return this.readUint8(e)<<24>>24}readUint8(e){return this.bytes_[e]}readInt16(e){return this.readUint16(e)<<16>>16}readUint16(e){return this.bytes_[e]|this.bytes_[e+1]<<8}readInt32(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24}readUint32(e){return this.readInt32(e)>>>0}readInt64(e){return BigInt.asIntN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readUint64(e){return BigInt.asUintN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readFloat32(e){return Fe[0]=this.readInt32(e),Ie[0]}readFloat64(e){return Fe[+!Re]=this.readInt32(e),Fe[+!!Re]=this.readInt32(e+4),Le[0]}writeInt8(e,t){this.bytes_[e]=t}writeUint8(e,t){this.bytes_[e]=t}writeInt16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeUint16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeInt32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeUint32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeInt64(e,t){this.writeInt32(e,Number(BigInt.asIntN(32,t))),this.writeInt32(e+4,Number(BigInt.asIntN(32,t>>BigInt(32))))}writeUint64(e,t){this.writeUint32(e,Number(BigInt.asUintN(32,t))),this.writeUint32(e+4,Number(BigInt.asUintN(32,t>>BigInt(32))))}writeFloat32(e,t){Ie[0]=t,this.writeInt32(e,Fe[0])}writeFloat64(e,t){Le[0]=t,this.writeInt32(e,Fe[+!Re]),this.writeInt32(e+4,Fe[+!!Re])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw Error(`FlatBuffers: ByteBuffer is too short to contain an identifier.`);let e=``;for(let t=0;t<4;t++)e+=String.fromCharCode(this.readInt8(this.position_+4+t));return e}__offset(e,t){let n=e-this.readInt32(e);return t<this.readInt16(n)?this.readInt16(n+t):0}__union(e,t){return e.bb_pos=t+this.readInt32(t),e.bb=this,e}__string(e,t){e+=this.readInt32(e);let n=this.readInt32(e);e+=4;let r=this.bytes_.subarray(e,e+n);return t===ze.UTF8_BYTES?r:this.text_decoder_.decode(r)}__union_with_string(e,t){return typeof e==`string`?this.__string(t):this.__union(e,t)}__indirect(e){return e+this.readInt32(e)}__vector(e){return e+this.readInt32(e)+4}__vector_len(e){return this.readInt32(e+this.readInt32(e))}__has_identifier(e){if(e.length!=4)throw Error(`FlatBuffers: file identifier must be length 4`);for(let t=0;t<4;t++)if(e.charCodeAt(t)!=this.readInt8(this.position()+4+t))return!1;return!0}createScalarList(e,t){let n=[];for(let r=0;r<t;++r){let t=e(r);t!==null&&n.push(t)}return n}createObjList(e,t){let n=[];for(let r=0;r<t;++r){let t=e(r);t!==null&&n.push(t.unpack())}return n}},Ve=class e{constructor(e){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 t;t=e||1024,this.bb=Be.allocate(t),this.space=t}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(e){this.force_defaults=e}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,n){t>this.minalign&&(this.minalign=t);let r=~(this.bb.capacity()-this.space+n)+1&t-1;for(;this.space<r+t+n;){let t=this.bb.capacity();this.bb=e.growByteBuffer(this.bb),this.space+=this.bb.capacity()-t}this.pad(r)}pad(e){for(let t=0;t<e;t++)this.bb.writeInt8(--this.space,0)}writeInt8(e){this.bb.writeInt8(--this.space,e)}writeInt16(e){this.bb.writeInt16(this.space-=2,e)}writeInt32(e){this.bb.writeInt32(this.space-=4,e)}writeInt64(e){this.bb.writeInt64(this.space-=8,e)}writeFloat32(e){this.bb.writeFloat32(this.space-=4,e)}writeFloat64(e){this.bb.writeFloat64(this.space-=8,e)}addInt8(e){this.prep(1,0),this.writeInt8(e)}addInt16(e){this.prep(2,0),this.writeInt16(e)}addInt32(e){this.prep(4,0),this.writeInt32(e)}addInt64(e){this.prep(8,0),this.writeInt64(e)}addFloat32(e){this.prep(4,0),this.writeFloat32(e)}addFloat64(e){this.prep(8,0),this.writeFloat64(e)}addFieldInt8(e,t,n){(this.force_defaults||t!=n)&&(this.addInt8(t),this.slot(e))}addFieldInt16(e,t,n){(this.force_defaults||t!=n)&&(this.addInt16(t),this.slot(e))}addFieldInt32(e,t,n){(this.force_defaults||t!=n)&&(this.addInt32(t),this.slot(e))}addFieldInt64(e,t,n){(this.force_defaults||t!==n)&&(this.addInt64(t),this.slot(e))}addFieldFloat32(e,t,n){(this.force_defaults||t!=n)&&(this.addFloat32(t),this.slot(e))}addFieldFloat64(e,t,n){(this.force_defaults||t!=n)&&(this.addFloat64(t),this.slot(e))}addFieldOffset(e,t,n){(this.force_defaults||t!=n)&&(this.addOffset(t),this.slot(e))}addFieldStruct(e,t,n){t!=n&&(this.nested(t),this.slot(e))}nested(e){if(e!=this.offset())throw TypeError(`FlatBuffers: struct must be serialized inline.`)}notNested(){if(this.isNested)throw TypeError(`FlatBuffers: object serialization must not be nested.`)}slot(e){this.vtable!==null&&(this.vtable[e]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(e){let t=e.capacity();if(t&3221225472)throw Error(`FlatBuffers: cannot grow buffer beyond 2 gigabytes.`);let n=t<<1,r=Be.allocate(n);return r.setPosition(n-t),r.bytes().set(e.bytes(),n-t),r}addOffset(e){this.prep(4,0),this.writeInt32(this.offset()-e+4)}startObject(e){this.notNested(),this.vtable??=[],this.vtable_in_use=e;for(let t=0;t<e;t++)this.vtable[t]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw Error(`FlatBuffers: endObject called without startObject`);this.addInt32(0);let e=this.offset(),t=this.vtable_in_use-1;for(;t>=0&&this.vtable[t]==0;t--);let n=t+1;for(;t>=0;t--)this.addInt16(this.vtable[t]==0?0:e-this.vtable[t]);this.addInt16(e-this.object_start);let r=(n+2)*2;this.addInt16(r);let i=0,a=this.space;outer_loop:for(t=0;t<this.vtables.length;t++){let e=this.bb.capacity()-this.vtables[t];if(r==this.bb.readInt16(e)){for(let t=2;t<r;t+=2)if(this.bb.readInt16(a+t)!=this.bb.readInt16(e+t))continue outer_loop;i=this.vtables[t];break}}return i?(this.space=this.bb.capacity()-e,this.bb.writeInt32(this.space,i-e)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-e,this.offset()-e)),this.isNested=!1,e}finish(e,t,n){let r=n?4:0;if(t){let e=t;if(this.prep(this.minalign,8+r),e.length!=4)throw TypeError(`FlatBuffers: file identifier must be length 4`);for(let t=3;t>=0;t--)this.writeInt8(e.charCodeAt(t))}this.prep(this.minalign,4+r),this.addOffset(e),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(e,t){this.finish(e,t,!0)}requiredField(e,t){let n=this.bb.capacity()-e,r=n-this.bb.readInt32(n);if(!(t<this.bb.readInt16(r)&&this.bb.readInt16(r+t)!=0))throw TypeError(`FlatBuffers: field `+t+` must be set`)}startVector(e,t,n){this.notNested(),this.vector_num_elems=t,this.prep(4,e*t),this.prep(n,e*t)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(e){if(!e)return 0;if(this.string_maps||=new Map,this.string_maps.has(e))return this.string_maps.get(e);let t=this.createString(e);return this.string_maps.set(e,t),t}createString(e){if(e==null)return 0;let t;return t=e instanceof Uint8Array?e:this.text_encoder.encode(e),this.addInt8(0),this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector()}createByteVector(e){return e==null?0:(this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector())}createObjectOffset(e){return e===null?0:typeof e==`string`?this.createString(e):e.pack(this)}createObjectOffsetList(e){let t=[];for(let n=0;n<e.length;++n){let r=e[n];if(r!==null)t.push(this.createObjectOffset(r));else throw TypeError(`FlatBuffers: Argument for createObjectOffsetList cannot contain null.`)}return t}createStructOffsetList(e,t){return t(this,e.length),this.createObjectOffsetList(e.slice().reverse()),this.endVector()}},He;(function(e){e[e.BUFFER=0]=`BUFFER`})(He||={});var Ue;(function(e){e[e.LZ4_FRAME=0]=`LZ4_FRAME`,e[e.ZSTD=1]=`ZSTD`})(Ue||={});var We=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBodyCompression(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}codec(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt8(this.bb_pos+e):Ue.LZ4_FRAME}method(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt8(this.bb_pos+e):He.BUFFER}static startBodyCompression(e){e.startObject(2)}static addCodec(e,t){e.addFieldInt8(0,t,Ue.LZ4_FRAME)}static addMethod(e,t){e.addFieldInt8(1,t,He.BUFFER)}static endBodyCompression(e){return e.endObject()}static createBodyCompression(t,n,r){return e.startBodyCompression(t),e.addCodec(t,n),e.addMethod(t,r),e.endBodyCompression(t)}},Ge=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(e,t,n){return e.prep(8,16),e.writeInt64(BigInt(n??0)),e.writeInt64(BigInt(t??0)),e.offset()}},Ke=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(e,t,n){return e.prep(8,16),e.writeInt64(BigInt(n??0)),e.writeInt64(BigInt(t??0)),e.offset()}},y=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsRecordBatch(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}length(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt(`0`)}nodes(e,t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new Ke).__init(this.bb.__vector(this.bb_pos+n)+e*16,this.bb):null}nodesLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}buffers(e,t){let n=this.bb.__offset(this.bb_pos,8);return n?(t||new Ge).__init(this.bb.__vector(this.bb_pos+n)+e*16,this.bb):null}buffersLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}compression(e){let t=this.bb.__offset(this.bb_pos,10);return t?(e||new We).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}variadicBufferCounts(e){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt64(this.bb.__vector(this.bb_pos+t)+e*8):BigInt(0)}variadicBufferCountsLength(){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startRecordBatch(e){e.startObject(5)}static addLength(e,t){e.addFieldInt64(0,t,BigInt(`0`))}static addNodes(e,t){e.addFieldOffset(1,t,0)}static startNodesVector(e,t){e.startVector(16,t,8)}static addBuffers(e,t){e.addFieldOffset(2,t,0)}static startBuffersVector(e,t){e.startVector(16,t,8)}static addCompression(e,t){e.addFieldOffset(3,t,0)}static addVariadicBufferCounts(e,t){e.addFieldOffset(4,t,0)}static createVariadicBufferCountsVector(e,t){e.startVector(8,t.length,8);for(let n=t.length-1;n>=0;n--)e.addInt64(t[n]);return e.endVector()}static startVariadicBufferCountsVector(e,t){e.startVector(8,t,8)}static endRecordBatch(e){return e.endObject()}},qe=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDictionaryBatch(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt(`0`)}data(e){let t=this.bb.__offset(this.bb_pos,6);return t?(e||new y).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}isDelta(){let e=this.bb.__offset(this.bb_pos,8);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startDictionaryBatch(e){e.startObject(3)}static addId(e,t){e.addFieldInt64(0,t,BigInt(`0`))}static addData(e,t){e.addFieldOffset(1,t,0)}static addIsDelta(e,t){e.addFieldInt8(2,+t,0)}static endDictionaryBatch(e){return e.endObject()}},Je;(function(e){e[e.Little=0]=`Little`,e[e.Big=1]=`Big`})(Je||={});var Ye;(function(e){e[e.DenseArray=0]=`DenseArray`})(Ye||={});var Xe=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsInt(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}isSigned(){let e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startInt(e){e.startObject(2)}static addBitWidth(e,t){e.addFieldInt32(0,t,0)}static addIsSigned(e,t){e.addFieldInt8(1,+t,0)}static endInt(e){return e.endObject()}static createInt(t,n,r){return e.startInt(t),e.addBitWidth(t,n),e.addIsSigned(t,r),e.endInt(t)}},Ze=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDictionaryEncoding(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt(`0`)}indexType(e){let t=this.bb.__offset(this.bb_pos,6);return t?(e||new Xe).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}isOrdered(){let e=this.bb.__offset(this.bb_pos,8);return e?!!this.bb.readInt8(this.bb_pos+e):!1}dictionaryKind(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt16(this.bb_pos+e):Ye.DenseArray}static startDictionaryEncoding(e){e.startObject(4)}static addId(e,t){e.addFieldInt64(0,t,BigInt(`0`))}static addIndexType(e,t){e.addFieldOffset(1,t,0)}static addIsOrdered(e,t){e.addFieldInt8(2,+t,0)}static addDictionaryKind(e,t){e.addFieldInt16(3,t,Ye.DenseArray)}static endDictionaryEncoding(e){return e.endObject()}},b=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsKeyValue(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}key(e){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}value(e){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,e):null}static startKeyValue(e){e.startObject(2)}static addKey(e,t){e.addFieldOffset(0,t,0)}static addValue(e,t){e.addFieldOffset(1,t,0)}static endKeyValue(e){return e.endObject()}static createKeyValue(t,n,r){return e.startKeyValue(t),e.addKey(t,n),e.addValue(t,r),e.endKeyValue(t)}},Qe=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(e){e.startObject(0)}static endBinary(e){return e.endObject()}static createBinary(t){return e.startBinary(t),e.endBinary(t)}},$e=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBinaryView(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinaryView(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinaryView(e){e.startObject(0)}static endBinaryView(e){return e.endObject()}static createBinaryView(t){return e.startBinaryView(t),e.endBinaryView(t)}},et=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBool(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBool(e){e.startObject(0)}static endBool(e){return e.endObject()}static createBool(t){return e.startBool(t),e.endBool(t)}},tt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDate(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):Pe.MILLISECOND}static startDate(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,Pe.MILLISECOND)}static endDate(e){return e.endObject()}static createDate(t,n){return e.startDate(t),e.addUnit(t,n),e.endDate(t)}},nt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDecimal(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}scale(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb_pos+e):0}bitWidth(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readInt32(this.bb_pos+e):128}static startDecimal(e){e.startObject(3)}static addPrecision(e,t){e.addFieldInt32(0,t,0)}static addScale(e,t){e.addFieldInt32(1,t,0)}static addBitWidth(e,t){e.addFieldInt32(2,t,128)}static endDecimal(e){return e.endObject()}static createDecimal(t,n,r,i){return e.startDecimal(t),e.addPrecision(t,n),e.addScale(t,r),e.addBitWidth(t,i),e.endDecimal(t)}},rt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDuration(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):_.MILLISECOND}static startDuration(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,_.MILLISECOND)}static endDuration(e){return e.endObject()}static createDuration(t,n){return e.startDuration(t),e.addUnit(t,n),e.endDuration(t)}},it=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFixedSizeBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}static startFixedSizeBinary(e){e.startObject(1)}static addByteWidth(e,t){e.addFieldInt32(0,t,0)}static endFixedSizeBinary(e){return e.endObject()}static createFixedSizeBinary(t,n){return e.startFixedSizeBinary(t),e.addByteWidth(t,n),e.endFixedSizeBinary(t)}},at=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFixedSizeList(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}static startFixedSizeList(e){e.startObject(1)}static addListSize(e,t){e.addFieldInt32(0,t,0)}static endFixedSizeList(e){return e.endObject()}static createFixedSizeList(t,n){return e.startFixedSizeList(t),e.addListSize(t,n),e.endFixedSizeList(t)}},ot=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFloatingPoint(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):g.HALF}static startFloatingPoint(e){e.startObject(1)}static addPrecision(e,t){e.addFieldInt16(0,t,g.HALF)}static endFloatingPoint(e){return e.endObject()}static createFloatingPoint(t,n){return e.startFloatingPoint(t),e.addPrecision(t,n),e.endFloatingPoint(t)}},st=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsInterval(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):v.YEAR_MONTH}static startInterval(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,v.YEAR_MONTH)}static endInterval(e){return e.endObject()}static createInterval(t,n){return e.startInterval(t),e.addUnit(t,n),e.endInterval(t)}},ct=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsLargeBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(e){e.startObject(0)}static endLargeBinary(e){return e.endObject()}static createLargeBinary(t){return e.startLargeBinary(t),e.endLargeBinary(t)}},lt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsLargeList(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeList(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeList(e){e.startObject(0)}static endLargeList(e){return e.endObject()}static createLargeList(t){return e.startLargeList(t),e.endLargeList(t)}},ut=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsLargeUtf8(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(e){e.startObject(0)}static endLargeUtf8(e){return e.endObject()}static createLargeUtf8(t){return e.startLargeUtf8(t),e.endLargeUtf8(t)}},dt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsList(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startList(e){e.startObject(0)}static endList(e){return e.endObject()}static createList(t){return e.startList(t),e.endList(t)}},ft=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsMap(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let e=this.bb.__offset(this.bb_pos,4);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startMap(e){e.startObject(1)}static addKeysSorted(e,t){e.addFieldInt8(0,+t,0)}static endMap(e){return e.endObject()}static createMap(t,n){return e.startMap(t),e.addKeysSorted(t,n),e.endMap(t)}},pt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsNull(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startNull(e){e.startObject(0)}static endNull(e){return e.endObject()}static createNull(t){return e.startNull(t),e.endNull(t)}},mt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsStruct_(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(e){e.startObject(0)}static endStruct_(e){return e.endObject()}static createStruct_(t){return e.startStruct_(t),e.endStruct_(t)}},ht=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsTime(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):_.MILLISECOND}bitWidth(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb_pos+e):32}static startTime(e){e.startObject(2)}static addUnit(e,t){e.addFieldInt16(0,t,_.MILLISECOND)}static addBitWidth(e,t){e.addFieldInt32(1,t,32)}static endTime(e){return e.endObject()}static createTime(t,n,r){return e.startTime(t),e.addUnit(t,n),e.addBitWidth(t,r),e.endTime(t)}},gt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsTimestamp(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):_.SECOND}timezone(e){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,e):null}static startTimestamp(e){e.startObject(2)}static addUnit(e,t){e.addFieldInt16(0,t,_.SECOND)}static addTimezone(e,t){e.addFieldOffset(1,t,0)}static endTimestamp(e){return e.endObject()}static createTimestamp(t,n,r){return e.startTimestamp(t),e.addUnit(t,n),e.addTimezone(t,r),e.endTimestamp(t)}},_t=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsUnion(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}mode(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):h.Sparse}typeIds(e){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb.__vector(this.bb_pos+t)+e*4):0}typeIdsLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}typeIdsArray(){let e=this.bb.__offset(this.bb_pos,6);return e?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+e),this.bb.__vector_len(this.bb_pos+e)):null}static startUnion(e){e.startObject(2)}static addMode(e,t){e.addFieldInt16(0,t,h.Sparse)}static addTypeIds(e,t){e.addFieldOffset(1,t,0)}static createTypeIdsVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addInt32(t[n]);return e.endVector()}static startTypeIdsVector(e,t){e.startVector(4,t,4)}static endUnion(e){return e.endObject()}static createUnion(t,n,r){return e.startUnion(t),e.addMode(t,n),e.addTypeIds(t,r),e.endUnion(t)}},vt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsUtf8(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(e){e.startObject(0)}static endUtf8(e){return e.endObject()}static createUtf8(t){return e.startUtf8(t),e.endUtf8(t)}},yt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsUtf8View(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8View(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8View(e){e.startObject(0)}static endUtf8View(e){return e.endObject()}static createUtf8View(t){return e.startUtf8View(t),e.endUtf8View(t)}},x;(function(e){e[e.NONE=0]=`NONE`,e[e.Null=1]=`Null`,e[e.Int=2]=`Int`,e[e.FloatingPoint=3]=`FloatingPoint`,e[e.Binary=4]=`Binary`,e[e.Utf8=5]=`Utf8`,e[e.Bool=6]=`Bool`,e[e.Decimal=7]=`Decimal`,e[e.Date=8]=`Date`,e[e.Time=9]=`Time`,e[e.Timestamp=10]=`Timestamp`,e[e.Interval=11]=`Interval`,e[e.List=12]=`List`,e[e.Struct_=13]=`Struct_`,e[e.Union=14]=`Union`,e[e.FixedSizeBinary=15]=`FixedSizeBinary`,e[e.FixedSizeList=16]=`FixedSizeList`,e[e.Map=17]=`Map`,e[e.Duration=18]=`Duration`,e[e.LargeBinary=19]=`LargeBinary`,e[e.LargeUtf8=20]=`LargeUtf8`,e[e.LargeList=21]=`LargeList`,e[e.RunEndEncoded=22]=`RunEndEncoded`,e[e.BinaryView=23]=`BinaryView`,e[e.Utf8View=24]=`Utf8View`,e[e.ListView=25]=`ListView`,e[e.LargeListView=26]=`LargeListView`})(x||={});var S=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsField(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}name(e){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}nullable(){let e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}typeType(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readUint8(this.bb_pos+e):x.NONE}type(e){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__union(e,this.bb_pos+t):null}dictionary(e){let t=this.bb.__offset(this.bb_pos,12);return t?(e||new Ze).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}children(t,n){let r=this.bb.__offset(this.bb_pos,14);return r?(n||new e).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}childrenLength(){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,16);return n?(t||new b).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,16);return e?this.bb.__vector_len(this.bb_pos+e):0}static startField(e){e.startObject(7)}static addName(e,t){e.addFieldOffset(0,t,0)}static addNullable(e,t){e.addFieldInt8(1,+t,0)}static addTypeType(e,t){e.addFieldInt8(2,t,x.NONE)}static addType(e,t){e.addFieldOffset(3,t,0)}static addDictionary(e,t){e.addFieldOffset(4,t,0)}static addChildren(e,t){e.addFieldOffset(5,t,0)}static createChildrenVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startChildrenVector(e,t){e.startVector(4,t,4)}static addCustomMetadata(e,t){e.addFieldOffset(6,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endField(e){return e.endObject()}},bt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsSchema(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):Je.Little}fields(e,t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new S).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}fieldsLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,8);return n?(t||new b).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}features(e){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb.__vector(this.bb_pos+t)+e*8):BigInt(0)}featuresLength(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}static startSchema(e){e.startObject(4)}static addEndianness(e,t){e.addFieldInt16(0,t,Je.Little)}static addFields(e,t){e.addFieldOffset(1,t,0)}static createFieldsVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startFieldsVector(e,t){e.startVector(4,t,4)}static addCustomMetadata(e,t){e.addFieldOffset(2,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static addFeatures(e,t){e.addFieldOffset(3,t,0)}static createFeaturesVector(e,t){e.startVector(8,t.length,8);for(let n=t.length-1;n>=0;n--)e.addInt64(t[n]);return e.endVector()}static startFeaturesVector(e,t){e.startVector(8,t,8)}static endSchema(e){return e.endObject()}static createSchema(t,n,r,i,a){return e.startSchema(t),e.addEndianness(t,n),e.addFields(t,r),e.addCustomMetadata(t,i),e.addFeatures(t,a),e.endSchema(t)}},C;(function(e){e[e.NONE=0]=`NONE`,e[e.Schema=1]=`Schema`,e[e.DictionaryBatch=2]=`DictionaryBatch`,e[e.RecordBatch=3]=`RecordBatch`,e[e.Tensor=4]=`Tensor`,e[e.SparseTensor=5]=`SparseTensor`})(C||={});var w;(function(e){e[e.NONE=0]=`NONE`,e[e.Null=1]=`Null`,e[e.Int=2]=`Int`,e[e.Float=3]=`Float`,e[e.Binary=4]=`Binary`,e[e.Utf8=5]=`Utf8`,e[e.Bool=6]=`Bool`,e[e.Decimal=7]=`Decimal`,e[e.Date=8]=`Date`,e[e.Time=9]=`Time`,e[e.Timestamp=10]=`Timestamp`,e[e.Interval=11]=`Interval`,e[e.List=12]=`List`,e[e.Struct=13]=`Struct`,e[e.Union=14]=`Union`,e[e.FixedSizeBinary=15]=`FixedSizeBinary`,e[e.FixedSizeList=16]=`FixedSizeList`,e[e.Map=17]=`Map`,e[e.Duration=18]=`Duration`,e[e.LargeBinary=19]=`LargeBinary`,e[e.LargeUtf8=20]=`LargeUtf8`,e[e.LargeList=21]=`LargeList`,e[e.BinaryView=23]=`BinaryView`,e[e.Utf8View=24]=`Utf8View`,e[e.Dictionary=-1]=`Dictionary`,e[e.Int8=-2]=`Int8`,e[e.Int16=-3]=`Int16`,e[e.Int32=-4]=`Int32`,e[e.Int64=-5]=`Int64`,e[e.Uint8=-6]=`Uint8`,e[e.Uint16=-7]=`Uint16`,e[e.Uint32=-8]=`Uint32`,e[e.Uint64=-9]=`Uint64`,e[e.Float16=-10]=`Float16`,e[e.Float32=-11]=`Float32`,e[e.Float64=-12]=`Float64`,e[e.DateDay=-13]=`DateDay`,e[e.DateMillisecond=-14]=`DateMillisecond`,e[e.TimestampSecond=-15]=`TimestampSecond`,e[e.TimestampMillisecond=-16]=`TimestampMillisecond`,e[e.TimestampMicrosecond=-17]=`TimestampMicrosecond`,e[e.TimestampNanosecond=-18]=`TimestampNanosecond`,e[e.TimeSecond=-19]=`TimeSecond`,e[e.TimeMillisecond=-20]=`TimeMillisecond`,e[e.TimeMicrosecond=-21]=`TimeMicrosecond`,e[e.TimeNanosecond=-22]=`TimeNanosecond`,e[e.DenseUnion=-23]=`DenseUnion`,e[e.SparseUnion=-24]=`SparseUnion`,e[e.IntervalDayTime=-25]=`IntervalDayTime`,e[e.IntervalYearMonth=-26]=`IntervalYearMonth`,e[e.DurationSecond=-27]=`DurationSecond`,e[e.DurationMillisecond=-28]=`DurationMillisecond`,e[e.DurationMicrosecond=-29]=`DurationMicrosecond`,e[e.DurationNanosecond=-30]=`DurationNanosecond`,e[e.IntervalMonthDayNano=-31]=`IntervalMonthDayNano`})(w||={});var xt;(function(e){e[e.OFFSET=0]=`OFFSET`,e[e.DATA=1]=`DATA`,e[e.VALIDITY=2]=`VALIDITY`,e[e.TYPE=3]=`TYPE`})(xt||={});var St=void 0;function Ct(e){if(e===null)return`null`;if(e===St)return`undefined`;switch(typeof e){case`number`:return`${e}`;case`bigint`:return`${e}`;case`string`:return`"${e}"`}return typeof e[Symbol.toPrimitive]==`function`?e[Symbol.toPrimitive](`string`):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(e=>Ct(e))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(e,t)=>typeof t==`bigint`?`${t}`:t)}function T(e){if(typeof e==`bigint`&&(e<-(2**53-1)||e>2**53-1))throw TypeError(`${e} is not safe to convert to a number.`);return Number(e)}function wt(e,t){return T(e/t)+T(e%t)/T(t)}var Tt=Symbol.for(`isArrowBigNum`);function E(e,...t){return t.length===0?Object.setPrototypeOf(f(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}E.prototype[Tt]=!0,E.prototype.toJSON=function(){return`"${jt(this)}"`},E.prototype.valueOf=function(e){return At(this,e)},E.prototype.toString=function(){return jt(this)},E.prototype[Symbol.toPrimitive]=function(e=`default`){switch(e){case`number`:return At(this);case`string`:return jt(this);case`default`:return Mt(this)}return jt(this)};function Et(...e){return E.apply(this,e)}function Dt(...e){return E.apply(this,e)}function Ot(...e){return E.apply(this,e)}Object.setPrototypeOf(Et.prototype,Object.create(Int32Array.prototype)),Object.setPrototypeOf(Dt.prototype,Object.create(Uint32Array.prototype)),Object.setPrototypeOf(Ot.prototype,Object.create(Uint32Array.prototype)),Object.assign(Et.prototype,E.prototype,{constructor:Et,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array}),Object.assign(Dt.prototype,E.prototype,{constructor:Dt,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array}),Object.assign(Ot.prototype,E.prototype,{constructor:Ot,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});var kt=BigInt(4294967296)*BigInt(4294967296)-BigInt(1);function At(e,t){let{buffer:n,byteOffset:r,byteLength:i,signed:a}=e,o=new BigUint64Array(n,r,i/8),s=a&&o.at(-1)&BigInt(1)<<BigInt(63),c=BigInt(0),l=0;if(s){for(let e of o)c|=(e^kt)*(BigInt(1)<<BigInt(64*l++));c*=BigInt(-1),c-=BigInt(1)}else for(let e of o)c|=e*(BigInt(1)<<BigInt(64*l++));if(typeof t==`number`&&t>0){let e=BigInt(`1`.padEnd(t+1,`0`)),n=c/e,r=s?-(c%e):c%e,i=T(n),a=`${r}`.padStart(t,`0`);return+`${s&&i===0?`-`:``}${i}.${a}`}return T(c)}function jt(e){if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return Nt(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Nt(e);t=t.slice();let n=1;for(let e=0;e<t.length;e++){let r=t[e],i=~r+n;t[e]=i,n&=+(r===0)}return`-${Nt(t)}`}function Mt(e){return e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:jt(e)}function Nt(e){let t=``,n=new Uint32Array(2),r=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=new Uint32Array((r=new Uint16Array(r).reverse()).buffer),a=-1,o=r.length-1;do{for(n[0]=r[a=0];a<o;)r[a++]=n[1]=n[0]/10,n[0]=(n[0]-n[1]*10<<16)+r[a];r[a]=n[1]=n[0]/10,n[0]-=n[1]*10,t=`${n[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??`0`}var Pt=class e{static new(e,t){switch(t){case!0:return new Et(e);case!1:return new Dt(e)}switch(e.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Et(e)}return e.byteLength===16?new Ot(e):new Dt(e)}static signed(e){return new Et(e)}static unsigned(e){return new Dt(e)}static decimal(e){return new Ot(e)}constructor(t,n){return e.new(t,n)}},Ft,It,Lt,Rt,zt,Bt,Vt,Ht,Ut,Wt,Gt,Kt,qt,Jt,Yt,Xt,Zt,Qt,$t,en,tn,nn,rn,an,on,sn=Symbol.for(`apache-arrow/DataType`),D=class e{static isDataType(e){return e?.[sn]===!0}static isNull(e){return e?.typeId===w.Null}static isInt(e){return e?.typeId===w.Int}static isFloat(e){return e?.typeId===w.Float}static isBinary(e){return e?.typeId===w.Binary}static isBinaryView(e){return e?.typeId===w.BinaryView}static isLargeBinary(e){return e?.typeId===w.LargeBinary}static isUtf8(e){return e?.typeId===w.Utf8}static isUtf8View(e){return e?.typeId===w.Utf8View}static isLargeUtf8(e){return e?.typeId===w.LargeUtf8}static isBool(e){return e?.typeId===w.Bool}static isDecimal(e){return e?.typeId===w.Decimal}static isDate(e){return e?.typeId===w.Date}static isTime(e){return e?.typeId===w.Time}static isTimestamp(e){return e?.typeId===w.Timestamp}static isInterval(e){return e?.typeId===w.Interval}static isDuration(e){return e?.typeId===w.Duration}static isList(e){return e?.typeId===w.List}static isLargeList(e){return e?.typeId===w.LargeList}static isStruct(e){return e?.typeId===w.Struct}static isUnion(e){return e?.typeId===w.Union}static isFixedSizeBinary(e){return e?.typeId===w.FixedSizeBinary}static isFixedSizeList(e){return e?.typeId===w.FixedSizeList}static isMap(e){return e?.typeId===w.Map}static isDictionary(e){return e?.typeId===w.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===h.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===h.Sparse}constructor(e){this.typeId=e}};Ft=Symbol.toStringTag,D[Ft]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[sn]=!0,e[Symbol.toStringTag]=`DataType`))(D.prototype);var cn=class extends D{constructor(){super(w.Null)}toString(){return`Null`}};It=Symbol.toStringTag,cn[It]=(e=>e[Symbol.toStringTag]=`Null`)(cn.prototype);var O=class extends D{constructor(e,t){super(w.Int),this.isSigned=e,this.bitWidth=t}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 Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?`I`:`Ui`}nt${this.bitWidth}`}};Lt=Symbol.toStringTag,O[Lt]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]=`Int`))(O.prototype);var ln=class extends O{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},un=class extends O{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},dn=class extends O{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},fn=class extends O{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},pn=class extends O{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},mn=class extends O{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},hn=class extends O{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},gn=class extends O{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(ln.prototype,"ArrayType",{value:Int8Array}),Object.defineProperty(un.prototype,"ArrayType",{value:Int16Array}),Object.defineProperty(dn.prototype,"ArrayType",{value:Int32Array}),Object.defineProperty(fn.prototype,"ArrayType",{value:BigInt64Array}),Object.defineProperty(pn.prototype,"ArrayType",{value:Uint8Array}),Object.defineProperty(mn.prototype,"ArrayType",{value:Uint16Array}),Object.defineProperty(hn.prototype,"ArrayType",{value:Uint32Array}),Object.defineProperty(gn.prototype,"ArrayType",{value:BigUint64Array});var _n=class extends D{constructor(e){super(w.Float),this.precision=e}get ArrayType(){switch(this.precision){case g.HALF:return Uint16Array;case g.SINGLE:return Float32Array;case g.DOUBLE:return Float64Array}throw Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};Rt=Symbol.toStringTag,_n[Rt]=(e=>(e.precision=null,e[Symbol.toStringTag]=`Float`))(_n.prototype);var vn=class extends _n{constructor(){super(g.HALF)}},yn=class extends _n{constructor(){super(g.SINGLE)}},bn=class extends _n{constructor(){super(g.DOUBLE)}};Object.defineProperty(vn.prototype,"ArrayType",{value:Uint16Array}),Object.defineProperty(yn.prototype,"ArrayType",{value:Float32Array}),Object.defineProperty(bn.prototype,"ArrayType",{value:Float64Array});var xn=class extends D{constructor(){super(w.Binary)}toString(){return`Binary`}};zt=Symbol.toStringTag,xn[zt]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Binary`))(xn.prototype);var k=class extends D{constructor(){super(w.BinaryView)}toString(){return`BinaryView`}};Bt=Symbol.toStringTag,k.ELEMENT_WIDTH=16,k.INLINE_CAPACITY=12,k.LENGTH_OFFSET=0,k.INLINE_OFFSET=4,k.BUFFER_INDEX_OFFSET=8,k.BUFFER_OFFSET_OFFSET=12,k[Bt]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`BinaryView`))(k.prototype);var Sn=class extends D{constructor(){super(w.LargeBinary)}toString(){return`LargeBinary`}};Vt=Symbol.toStringTag,Sn[Vt]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]=`LargeBinary`))(Sn.prototype);var Cn=class extends D{constructor(){super(w.Utf8)}toString(){return`Utf8`}};Ht=Symbol.toStringTag,Cn[Ht]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Utf8`))(Cn.prototype);var wn=class extends D{constructor(){super(w.Utf8View)}toString(){return`Utf8View`}};Ut=Symbol.toStringTag,wn.ELEMENT_WIDTH=k.ELEMENT_WIDTH,wn.INLINE_CAPACITY=k.INLINE_CAPACITY,wn[Ut]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Utf8View`))(wn.prototype);var Tn=class extends D{constructor(){super(w.LargeUtf8)}toString(){return`LargeUtf8`}};Wt=Symbol.toStringTag,Tn[Wt]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]=`LargeUtf8`))(Tn.prototype);var En=class extends D{constructor(){super(w.Bool)}toString(){return`Bool`}};Gt=Symbol.toStringTag,En[Gt]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Bool`))(En.prototype);var Dn=class extends D{constructor(e,t,n=128){super(w.Decimal),this.scale=e,this.precision=t,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?`+`:``}${this.scale}]`}};Kt=Symbol.toStringTag,Dn[Kt]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]=`Decimal`))(Dn.prototype);var On=class extends D{constructor(e){super(w.Date),this.unit=e}toString(){return`Date${(this.unit+1)*32}<${Pe[this.unit]}>`}get ArrayType(){return this.unit===Pe.DAY?Int32Array:BigInt64Array}};qt=Symbol.toStringTag,On[qt]=(e=>(e.unit=null,e[Symbol.toStringTag]=`Date`))(On.prototype);var kn=class extends D{constructor(e,t){super(w.Time),this.unit=e,this.bitWidth=t}toString(){return`Time${this.bitWidth}<${_[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};Jt=Symbol.toStringTag,kn[Jt]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]=`Time`))(kn.prototype);var An=class extends D{constructor(e,t){super(w.Timestamp),this.unit=e,this.timezone=t}toString(){return`Timestamp<${_[this.unit]}${this.timezone?`, ${this.timezone}`:``}>`}};Yt=Symbol.toStringTag,An[Yt]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]=`Timestamp`))(An.prototype);var jn=class extends D{constructor(e){super(w.Interval),this.unit=e}toString(){return`Interval<${v[this.unit]}>`}};Xt=Symbol.toStringTag,jn[Xt]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]=`Interval`))(jn.prototype);var Mn=class extends D{constructor(e){super(w.Duration),this.unit=e}toString(){return`Duration<${_[this.unit]}>`}};Zt=Symbol.toStringTag,Mn[Zt]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]=`Duration`))(Mn.prototype);var Nn=class extends D{constructor(e){super(w.List),this.children=[e]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};Qt=Symbol.toStringTag,Nn[Qt]=(e=>(e.children=null,e[Symbol.toStringTag]=`List`))(Nn.prototype);var Pn=class extends D{constructor(e){super(w.LargeList),this.children=[e]}toString(){return`LargeList<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};$t=Symbol.toStringTag,Pn[$t]=(e=>(e.children=null,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]=`LargeList`))(Pn.prototype);var A=class extends D{constructor(e){super(w.Struct),this.children=e}toString(){return`Struct<{${this.children.map(e=>`${e.name}:${e.type}`).join(`, `)}}>`}};en=Symbol.toStringTag,A[en]=(e=>(e.children=null,e[Symbol.toStringTag]=`Struct`))(A.prototype);var Fn=class extends D{constructor(e,t,n){super(w.Union),this.mode=e,this.children=n,this.typeIds=t=Int32Array.from(t),this.typeIdToChildIndex=t.reduce((e,t,n)=>(e[t]=n)&&e||e,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(e=>`${e.type}`).join(` | `)}>`}};tn=Symbol.toStringTag,Fn[tn]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]=`Union`))(Fn.prototype);var In=class extends D{constructor(e){super(w.FixedSizeBinary),this.byteWidth=e}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};nn=Symbol.toStringTag,In[nn]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`FixedSizeBinary`))(In.prototype);var Ln=class extends D{constructor(e,t){super(w.FixedSizeList),this.listSize=e,this.children=[t]}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}>`}};rn=Symbol.toStringTag,Ln[rn]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]=`FixedSizeList`))(Ln.prototype);var Rn=class extends D{constructor(e,t=!1){if(super(w.Map),this.children=[e],this.keysSorted=t,e&&(e.name=`entries`,e?.type?.children)){let t=(e?.type)?.children[0];t&&(t.name=`key`);let n=(e?.type)?.children[1];n&&(n.name=`value`)}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(e=>`${e.name}:${e.type}`).join(`, `)}}>`}};an=Symbol.toStringTag,Rn[an]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]=`Map_`))(Rn.prototype);var zn=(e=>()=>++e)(-1),Bn=class extends D{constructor(e,t,n,r){super(w.Dictionary),this.indices=t,this.dictionary=e,this.isOrdered=r||!1,this.id=n==null?zn():T(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};on=Symbol.toStringTag,Bn[on]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]=`Dictionary`))(Bn.prototype);function Vn(e){let t=e;switch(e.typeId){case w.Decimal:return e.bitWidth/32;case w.Interval:return t.unit===v.MONTH_DAY_NANO?4:1+t.unit;case w.BinaryView:case w.Utf8View:return 16;case w.FixedSizeList:return t.listSize;case w.FixedSizeBinary:return t.byteWidth;default:return 1}}var j=class{visitMany(e,...t){return e.map((e,n)=>this.visit(e,...t.map(e=>e[n])))}visit(...e){return this.getVisitFn(e[0],!1).apply(this,e)}getVisitFn(e,t=!0){return Hn(this,e,t)}getVisitFnByTypeId(e,t=!0){return Un(this,e,t)}visitNull(e,...t){return null}visitBool(e,...t){return null}visitInt(e,...t){return null}visitFloat(e,...t){return null}visitUtf8(e,...t){return null}visitLargeUtf8(e,...t){return null}visitUtf8View(e,...t){return null}visitBinary(e,...t){return null}visitLargeBinary(e,...t){return null}visitBinaryView(e,...t){return null}visitFixedSizeBinary(e,...t){return null}visitDate(e,...t){return null}visitTimestamp(e,...t){return null}visitTime(e,...t){return null}visitDecimal(e,...t){return null}visitList(e,...t){return null}visitLargeList(e,...t){return null}visitStruct(e,...t){return null}visitUnion(e,...t){return null}visitDictionary(e,...t){return null}visitInterval(e,...t){return null}visitDuration(e,...t){return null}visitFixedSizeList(e,...t){return null}visitMap(e,...t){return null}};function Hn(e,t,n=!0){return typeof t==`number`?Un(e,t,n):typeof t==`string`&&t in w?Un(e,w[t],n):t&&t instanceof D?Un(e,Wn(t),n):t?.type&&t.type instanceof D?Un(e,Wn(t.type),n):Un(e,w.NONE,n)}function Un(e,t,n=!0){let r=null;switch(t){case w.Null:r=e.visitNull;break;case w.Bool:r=e.visitBool;break;case w.Int:r=e.visitInt;break;case w.Int8:r=e.visitInt8||e.visitInt;break;case w.Int16:r=e.visitInt16||e.visitInt;break;case w.Int32:r=e.visitInt32||e.visitInt;break;case w.Int64:r=e.visitInt64||e.visitInt;break;case w.Uint8:r=e.visitUint8||e.visitInt;break;case w.Uint16:r=e.visitUint16||e.visitInt;break;case w.Uint32:r=e.visitUint32||e.visitInt;break;case w.Uint64:r=e.visitUint64||e.visitInt;break;case w.Float:r=e.visitFloat;break;case w.Float16:r=e.visitFloat16||e.visitFloat;break;case w.Float32:r=e.visitFloat32||e.visitFloat;break;case w.Float64:r=e.visitFloat64||e.visitFloat;break;case w.Utf8:r=e.visitUtf8;break;case w.LargeUtf8:r=e.visitLargeUtf8;break;case w.Utf8View:r=e.visitUtf8View||e.visitUtf8;break;case w.Binary:r=e.visitBinary;break;case w.LargeBinary:r=e.visitLargeBinary;break;case w.BinaryView:r=e.visitBinaryView||e.visitBinary;break;case w.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case w.Date:r=e.visitDate;break;case w.DateDay:r=e.visitDateDay||e.visitDate;break;case w.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case w.Timestamp:r=e.visitTimestamp;break;case w.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case w.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case w.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case w.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case w.Time:r=e.visitTime;break;case w.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case w.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case w.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case w.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case w.Decimal:r=e.visitDecimal;break;case w.List:r=e.visitList;break;case w.LargeList:r=e.visitLargeList;break;case w.Struct:r=e.visitStruct;break;case w.Union:r=e.visitUnion;break;case w.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case w.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case w.Dictionary:r=e.visitDictionary;break;case w.Interval:r=e.visitInterval;break;case w.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case w.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case w.IntervalMonthDayNano:r=e.visitIntervalMonthDayNano||e.visitInterval;break;case w.Duration:r=e.visitDuration;break;case w.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case w.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case w.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case w.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case w.FixedSizeList:r=e.visitFixedSizeList;break;case w.Map:r=e.visitMap}if(typeof r==`function`)return r;if(!n)return()=>null;throw Error(`Unrecognized type '${w[t]}'`)}function Wn(e){switch(e.typeId){case w.Null:return w.Null;case w.Int:{let{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?w.Int8:w.Uint8;case 16:return n?w.Int16:w.Uint16;case 32:return n?w.Int32:w.Uint32;case 64:return n?w.Int64:w.Uint64}return w.Int}case w.Float:switch(e.precision){case g.HALF:return w.Float16;case g.SINGLE:return w.Float32;case g.DOUBLE:return w.Float64}return w.Float;case w.Binary:return w.Binary;case w.LargeBinary:return w.LargeBinary;case w.BinaryView:return w.BinaryView;case w.Utf8:return w.Utf8;case w.LargeUtf8:return w.LargeUtf8;case w.Utf8View:return w.Utf8View;case w.Bool:return w.Bool;case w.Decimal:return w.Decimal;case w.Time:switch(e.unit){case _.SECOND:return w.TimeSecond;case _.MILLISECOND:return w.TimeMillisecond;case _.MICROSECOND:return w.TimeMicrosecond;case _.NANOSECOND:return w.TimeNanosecond}return w.Time;case w.Timestamp:switch(e.unit){case _.SECOND:return w.TimestampSecond;case _.MILLISECOND:return w.TimestampMillisecond;case _.MICROSECOND:return w.TimestampMicrosecond;case _.NANOSECOND:return w.TimestampNanosecond}return w.Timestamp;case w.Date:switch(e.unit){case Pe.DAY:return w.DateDay;case Pe.MILLISECOND:return w.DateMillisecond}return w.Date;case w.Interval:switch(e.unit){case v.DAY_TIME:return w.IntervalDayTime;case v.YEAR_MONTH:return w.IntervalYearMonth;case v.MONTH_DAY_NANO:return w.IntervalMonthDayNano}return w.Interval;case w.Duration:switch(e.unit){case _.SECOND:return w.DurationSecond;case _.MILLISECOND:return w.DurationMillisecond;case _.MICROSECOND:return w.DurationMicrosecond;case _.NANOSECOND:return w.DurationNanosecond}return w.Duration;case w.Map:return w.Map;case w.List:return w.List;case w.LargeList:return w.LargeList;case w.Struct:return w.Struct;case w.Union:switch(e.mode){case h.Dense:return w.DenseUnion;case h.Sparse:return w.SparseUnion}return w.Union;case w.FixedSizeBinary:return w.FixedSizeBinary;case w.FixedSizeList:return w.FixedSizeList;case w.Dictionary:return w.Dictionary}throw Error(`Unrecognized type '${w[e.typeId]}'`)}j.prototype.visitInt8=null,j.prototype.visitInt16=null,j.prototype.visitInt32=null,j.prototype.visitInt64=null,j.prototype.visitUint8=null,j.prototype.visitUint16=null,j.prototype.visitUint32=null,j.prototype.visitUint64=null,j.prototype.visitFloat16=null,j.prototype.visitFloat32=null,j.prototype.visitFloat64=null,j.prototype.visitDateDay=null,j.prototype.visitDateMillisecond=null,j.prototype.visitTimestampSecond=null,j.prototype.visitTimestampMillisecond=null,j.prototype.visitTimestampMicrosecond=null,j.prototype.visitTimestampNanosecond=null,j.prototype.visitTimeSecond=null,j.prototype.visitTimeMillisecond=null,j.prototype.visitTimeMicrosecond=null,j.prototype.visitTimeNanosecond=null,j.prototype.visitDenseUnion=null,j.prototype.visitSparseUnion=null,j.prototype.visitIntervalDayTime=null,j.prototype.visitIntervalYearMonth=null,j.prototype.visitIntervalMonthDayNano=null,j.prototype.visitDuration=null,j.prototype.visitDurationSecond=null,j.prototype.visitDurationMillisecond=null,j.prototype.visitDurationMicrosecond=null,j.prototype.visitDurationNanosecond=null;var Gn=new Float64Array(1),Kn=new Uint32Array(Gn.buffer);function qn(e){let t=(e&31744)>>10,n=(e&1023)/1024,r=(-1)**((e&32768)>>15);switch(t){case 31:return r*(n?NaN:1/0);case 0:return r*(n?6103515625e-14*n:0)}return r*2**(t-15)*(1+n)}function Jn(e){if(e!==e)return 32256;Gn[0]=e;let t=(Kn[1]&2147483648)>>16&65535,n=Kn[1]&2146435072,r=0;return n>=1089470464?Kn[0]>0?n=31744:(n=(n&2080374784)>>16,r=(Kn[1]&1048575)>>10):n<=1056964608?(r=1048576+(Kn[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(Kn[1]&1048575)+512>>10),t|n|r&65535}var M=class extends j{};function N(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}var Yn=(e,t,n)=>{e[t]=Math.floor(n/864e5)},Xn=(e,t,n,r)=>{if(n+1<t.length){let i=T(t[n]),a=T(t[n+1]);e.set(r.subarray(0,a-i),i)}},Zn=({offset:e,values:t},n,r)=>{let i=e+n;r?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},Qn=({values:e},t,n)=>{e[t]=n},$n=({values:e},t,n)=>{e[t]=n},er=({values:e},t,n)=>{e[t]=Jn(n)},tr=(e,t,n)=>{switch(e.type.precision){case g.HALF:return er(e,t,n);case g.SINGLE:case g.DOUBLE:return $n(e,t,n)}},nr=({values:e},t,n)=>{Yn(e,t,n.valueOf())},rr=({values:e},t,n)=>{e[t]=BigInt(n)},ir=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},ar=({values:e,valueOffsets:t},n,r)=>Xn(e,t,n,r),or=e=>{let t=e.variadicBuffers;return(!Array.isArray(t)||Object.isFrozen(t))&&(t=Array.from(t),e.variadicBuffers=t),t},sr=(e,t,n)=>{let r=e.values;if(!r)throw Error(`BinaryView data is missing view buffer`);let i=k.ELEMENT_WIDTH,a=t*i,o=a+i;if(a<0||o>r.length)throw RangeError(`BinaryView index ${t} out of bounds`);r.fill(0,a,o);let s=new DataView(r.buffer,r.byteOffset+a,i),c=n.length;if(s.setInt32(k.LENGTH_OFFSET,c,!0),c<=k.INLINE_CAPACITY){r.set(n,a+k.INLINE_OFFSET);return}let l=(n[0]??0)|(n[1]??0)<<8|(n[2]??0)<<16|(n[3]??0)<<24;s.setUint32(k.INLINE_OFFSET,l>>>0,!0);let u=or(e),ee=n.slice(),te=u.push(ee)-1;s.setInt32(k.BUFFER_INDEX_OFFSET,te,!0),s.setInt32(k.BUFFER_OFFSET_OFFSET,0,!0)},cr=(e,t,n)=>{sr(e,t,n instanceof Uint8Array?n:new Uint8Array(n))},lr=({values:e,valueOffsets:t},n,r)=>Xn(e,t,n,u(r)),ur=(e,t,n)=>{sr(e,t,u(n))},dr=(e,t,n)=>{e.type.unit===Pe.DAY?nr(e,t,n):rr(e,t,n)},fr=({values:e},t,n)=>{e[t]=BigInt(n/1e3)},pr=({values:e},t,n)=>{e[t]=BigInt(n)},mr=({values:e},t,n)=>{e[t]=BigInt(n*1e3)},hr=({values:e},t,n)=>{e[t]=BigInt(n*1e6)},gr=(e,t,n)=>{switch(e.type.unit){case _.SECOND:return fr(e,t,n);case _.MILLISECOND:return pr(e,t,n);case _.MICROSECOND:return mr(e,t,n);case _.NANOSECOND:return hr(e,t,n)}},_r=({values:e},t,n)=>{e[t]=n},vr=({values:e},t,n)=>{e[t]=n},yr=({values:e},t,n)=>{e[t]=n},br=({values:e},t,n)=>{e[t]=n},xr=(e,t,n)=>{switch(e.type.unit){case _.SECOND:return _r(e,t,n);case _.MILLISECOND:return vr(e,t,n);case _.MICROSECOND:return yr(e,t,n);case _.NANOSECOND:return br(e,t,n)}},Sr=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},Cr=(e,t,n)=>{let r=e.children[0],i=e.valueOffsets,a=P.getVisitFn(r),o=T(i[t]),s=T(i[t+1]);if(Array.isArray(n))for(let e=-1,t=o;t<s;)a(r,t++,n[++e]);else for(let e=-1,t=o;t<s;)a(r,t++,n.get(++e))},wr=(e,t,n)=>{let r=e.children[0],{valueOffsets:i}=e,a=P.getVisitFn(r),{[t]:o,[t+1]:s}=i,c=n instanceof Map?n.entries():Object.entries(n);for(let e of c)if(a(r,o,e),++o>=s)break},Tr=(e,t)=>(n,r,i,a)=>r&&n(r,e,t[a]),Er=(e,t)=>(n,r,i,a)=>r&&n(r,e,t.get(a)),Dr=(e,t)=>(n,r,i,a)=>r&&n(r,e,t.get(i.name)),Or=(e,t)=>(n,r,i,a)=>r&&n(r,e,t[i.name]),kr=(e,t,n)=>{let r=e.type.children.map(e=>P.getVisitFn(e.type)),i=n instanceof Map?Dr(t,n):n instanceof W?Er(t,n):Array.isArray(n)?Tr(t,n):Or(t,n);e.type.children.forEach((t,n)=>i(r[n],e.children[n],t,n))},Ar=(e,t,n)=>{e.type.mode===h.Dense?jr(e,t,n):Mr(e,t,n)},jr=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];P.visit(i,e.valueOffsets[t],n)},Mr=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];P.visit(i,t,n)},Nr=(e,t,n)=>{var r;(r=e.dictionary)==null||r.set(e.values[t],n)},Pr=(e,t,n)=>{switch(e.type.unit){case v.YEAR_MONTH:return Ir(e,t,n);case v.DAY_TIME:return Fr(e,t,n);case v.MONTH_DAY_NANO:return Lr(e,t,n)}},Fr=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},Ir=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},Lr=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},Rr=({values:e},t,n)=>{e[t]=n},zr=({values:e},t,n)=>{e[t]=n},Br=({values:e},t,n)=>{e[t]=n},Vr=({values:e},t,n)=>{e[t]=n},Hr=(e,t,n)=>{switch(e.type.unit){case _.SECOND:return Rr(e,t,n);case _.MILLISECOND:return zr(e,t,n);case _.MICROSECOND:return Br(e,t,n);case _.NANOSECOND:return Vr(e,t,n)}},Ur=(e,t,n)=>{let{stride:r}=e,i=e.children[0],a=P.getVisitFn(i);if(Array.isArray(n))for(let e=-1,o=t*r;++e<r;)a(i,o+e,n[e]);else for(let e=-1,o=t*r;++e<r;)a(i,o+e,n.get(e))};M.prototype.visitBool=N(Zn),M.prototype.visitInt=N(Qn),M.prototype.visitInt8=N(Qn),M.prototype.visitInt16=N(Qn),M.prototype.visitInt32=N(Qn),M.prototype.visitInt64=N(Qn),M.prototype.visitUint8=N(Qn),M.prototype.visitUint16=N(Qn),M.prototype.visitUint32=N(Qn),M.prototype.visitUint64=N(Qn),M.prototype.visitFloat=N(tr),M.prototype.visitFloat16=N(er),M.prototype.visitFloat32=N($n),M.prototype.visitFloat64=N($n),M.prototype.visitUtf8=N(lr),M.prototype.visitLargeUtf8=N(lr),M.prototype.visitUtf8View=N(ur),M.prototype.visitBinary=N(ar),M.prototype.visitLargeBinary=N(ar),M.prototype.visitBinaryView=N(cr),M.prototype.visitFixedSizeBinary=N(ir),M.prototype.visitDate=N(dr),M.prototype.visitDateDay=N(nr),M.prototype.visitDateMillisecond=N(rr),M.prototype.visitTimestamp=N(gr),M.prototype.visitTimestampSecond=N(fr),M.prototype.visitTimestampMillisecond=N(pr),M.prototype.visitTimestampMicrosecond=N(mr),M.prototype.visitTimestampNanosecond=N(hr),M.prototype.visitTime=N(xr),M.prototype.visitTimeSecond=N(_r),M.prototype.visitTimeMillisecond=N(vr),M.prototype.visitTimeMicrosecond=N(yr),M.prototype.visitTimeNanosecond=N(br),M.prototype.visitDecimal=N(Sr),M.prototype.visitList=N(Cr),M.prototype.visitLargeList=N(Cr),M.prototype.visitStruct=N(kr),M.prototype.visitUnion=N(Ar),M.prototype.visitDenseUnion=N(jr),M.prototype.visitSparseUnion=N(Mr),M.prototype.visitDictionary=N(Nr),M.prototype.visitInterval=N(Pr),M.prototype.visitIntervalDayTime=N(Fr),M.prototype.visitIntervalYearMonth=N(Ir),M.prototype.visitIntervalMonthDayNano=N(Lr),M.prototype.visitDuration=N(Hr),M.prototype.visitDurationSecond=N(Rr),M.prototype.visitDurationMillisecond=N(zr),M.prototype.visitDurationMicrosecond=N(Br),M.prototype.visitDurationNanosecond=N(Vr),M.prototype.visitFixedSizeList=N(Ur),M.prototype.visitMap=N(wr);var P=new M,Wr=Symbol.for(`parent`),Gr=Symbol.for(`rowIndex`),Kr=class{constructor(e,t){return this[Wr]=e,this[Gr]=t,new Proxy(this,Jr)}toArray(){return Object.values(this.toJSON())}toJSON(){let e=this[Gr],t=this[Wr],n=t.type.children,r={};for(let i=-1,a=n.length;++i<a;)r[n[i].name]=L.visit(t.children[i],e);return r}toString(){return`{${[...this].map(([e,t])=>`${Ct(e)}: ${Ct(t)}`).join(`, `)}}`}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.toString()}[Symbol.iterator](){return new qr(this[Wr],this[Gr])}},qr=class{constructor(e,t){this.childIndex=0,this.children=e.children,this.rowIndex=t,this.childFields=e.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let e=this.childIndex;return e<this.numChildren?(this.childIndex=e+1,{done:!1,value:[this.childFields[e].name,L.visit(this.children[e],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Kr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:`Row`},[Wr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Gr]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var Jr=new class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[Wr].type.children.map(e=>e.name)}has(e,t){return e[Wr].type.children.some(e=>e.name===t)}getOwnPropertyDescriptor(e,t){if(e[Wr].type.children.some(e=>e.name===t))return{writable:!0,enumerable:!0,configurable:!0}}get(e,t){if(Reflect.has(e,t))return e[t];let n=e[Wr].type.children.findIndex(e=>e.name===t);if(n!==-1){let r=L.visit(e[Wr].children[n],e[Gr]);return Reflect.set(e,t,r),r}}set(e,t,n){let r=e[Wr].type.children.findIndex(e=>e.name===t);return r===-1?Reflect.has(e,t)||typeof t==`symbol`?Reflect.set(e,t,n):!1:(P.visit(e[Wr].children[r],e[Gr],n),Reflect.set(e,t,n))}},F=class extends j{};function I(e){return(t,n)=>t.getValid(n)?e(t,n):null}var Yr=(e,t)=>864e5*e[t],Xr=16,Zr=12,Qr=(e,t)=>null,$r=(e,t,n)=>{if(n+1>=t.length)return null;let r=T(t[n]),i=T(t[n+1]);return e.subarray(r,i)},ei=({offset:e,values:t},n)=>{let r=e+n;return!!(t[r>>3]&1<<r%8)},ti=({values:e},t)=>Yr(e,t),ni=({values:e},t)=>T(e[t]),ri=({stride:e,values:t},n)=>t[e*n],ii=({stride:e,values:t},n)=>qn(t[e*n]),ai=({values:e},t)=>e[t],oi=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),si=({values:e,valueOffsets:t},n)=>$r(e,t,n),ci=(e,t)=>{let n=e.values;if(!n)throw Error(`BinaryView data is missing view buffer`);let r=t*Xr,i=r+Xr;if(r<0||i>n.length)throw Error(`BinaryView data buffer is too short: expected ${Xr} bytes, got ${Math.max(0,n.length-r)}`);let a=n.subarray(r,i);if(a.length<Xr)throw Error(`BinaryView data buffer is too short: expected ${Xr} bytes, got ${a.length}`);let o=new DataView(n.buffer,a.byteOffset,Xr),s=o.getInt32(0,!0);if(s<=0)return new Uint8Array;if(s<=Zr)return a.subarray(4,4+s);let c=o.getInt32(8,!0),l=o.getInt32(12,!0),u=e.variadicBuffers?.[c];if(!u)throw Error(`BinaryView variadic buffer ${c} is missing`);return u.subarray(l,l+s)},li=(e,t)=>ci(e,t),ui=({values:e,valueOffsets:t},n)=>{let r=$r(e,t,n);return r===null?null:c(r)},di=(e,t)=>c(ci(e,t)),fi=({values:e},t)=>e[t],pi=({type:e,values:t},n)=>e.precision===g.HALF?qn(t[n]):t[n],mi=(e,t)=>e.type.unit===Pe.DAY?ti(e,t):ni(e,t),hi=({values:e},t)=>1e3*T(e[t]),gi=({values:e},t)=>T(e[t]),_i=({values:e},t)=>wt(e[t],BigInt(1e3)),vi=({values:e},t)=>wt(e[t],BigInt(1e6)),yi=(e,t)=>{switch(e.type.unit){case _.SECOND:return hi(e,t);case _.MILLISECOND:return gi(e,t);case _.MICROSECOND:return _i(e,t);case _.NANOSECOND:return vi(e,t)}},bi=({values:e},t)=>e[t],xi=({values:e},t)=>e[t],Si=({values:e},t)=>e[t],Ci=({values:e},t)=>e[t],wi=(e,t)=>{switch(e.type.unit){case _.SECOND:return bi(e,t);case _.MILLISECOND:return xi(e,t);case _.MICROSECOND:return Si(e,t);case _.NANOSECOND:return Ci(e,t)}},Ti=({values:e,stride:t},n)=>Pt.decimal(e.subarray(t*n,t*(n+1))),Ei=(e,t)=>{let{valueOffsets:n,stride:r,children:i}=e,a=T(n[t*r]),o=T(n[t*r+1]);return new W([i[0].slice(a,o-a)])},Di=(e,t)=>{let{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:a}=n,o=r[0];return new qi(o.slice(i,a-i))},Oi=(e,t)=>new Kr(e,t),ki=(e,t)=>e.type.mode===h.Dense?Ai(e,t):ji(e,t),Ai=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return L.visit(r,e.valueOffsets[t])},ji=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return L.visit(r,t)},Mi=(e,t)=>e.dictionary?.get(e.values[t]),Ni=(e,t)=>e.type.unit===v.MONTH_DAY_NANO?Ii(e,t):e.type.unit===v.DAY_TIME?Pi(e,t):Fi(e,t),Pi=({values:e},t)=>e.subarray(2*t,2*(t+1)),Fi=({values:e},t)=>{let n=e[t],r=new Int32Array(2);return r[0]=Math.trunc(n/12),r[1]=Math.trunc(n%12),r},Ii=({values:e},t)=>e.subarray(4*t,4*(t+1)),Li=({values:e},t)=>e[t],Ri=({values:e},t)=>e[t],zi=({values:e},t)=>e[t],Bi=({values:e},t)=>e[t],Vi=(e,t)=>{switch(e.type.unit){case _.SECOND:return Li(e,t);case _.MILLISECOND:return Ri(e,t);case _.MICROSECOND:return zi(e,t);case _.NANOSECOND:return Bi(e,t)}},Hi=(e,t)=>{let{stride:n,children:r}=e;return new W([r[0].slice(t*n,n)])};F.prototype.visitNull=I(Qr),F.prototype.visitBool=I(ei),F.prototype.visitInt=I(fi),F.prototype.visitInt8=I(ri),F.prototype.visitInt16=I(ri),F.prototype.visitInt32=I(ri),F.prototype.visitInt64=I(ai),F.prototype.visitUint8=I(ri),F.prototype.visitUint16=I(ri),F.prototype.visitUint32=I(ri),F.prototype.visitUint64=I(ai),F.prototype.visitFloat=I(pi),F.prototype.visitFloat16=I(ii),F.prototype.visitFloat32=I(ri),F.prototype.visitFloat64=I(ri),F.prototype.visitUtf8=I(ui),F.prototype.visitLargeUtf8=I(ui),F.prototype.visitUtf8View=I(di),F.prototype.visitBinary=I(si),F.prototype.visitLargeBinary=I(si),F.prototype.visitBinaryView=I(li),F.prototype.visitFixedSizeBinary=I(oi),F.prototype.visitDate=I(mi),F.prototype.visitDateDay=I(ti),F.prototype.visitDateMillisecond=I(ni),F.prototype.visitTimestamp=I(yi),F.prototype.visitTimestampSecond=I(hi),F.prototype.visitTimestampMillisecond=I(gi),F.prototype.visitTimestampMicrosecond=I(_i),F.prototype.visitTimestampNanosecond=I(vi),F.prototype.visitTime=I(wi),F.prototype.visitTimeSecond=I(bi),F.prototype.visitTimeMillisecond=I(xi),F.prototype.visitTimeMicrosecond=I(Si),F.prototype.visitTimeNanosecond=I(Ci),F.prototype.visitDecimal=I(Ti),F.prototype.visitList=I(Ei),F.prototype.visitLargeList=I(Ei),F.prototype.visitStruct=I(Oi),F.prototype.visitUnion=I(ki),F.prototype.visitDenseUnion=I(Ai),F.prototype.visitSparseUnion=I(ji),F.prototype.visitDictionary=I(Mi),F.prototype.visitInterval=I(Ni),F.prototype.visitIntervalDayTime=I(Pi),F.prototype.visitIntervalYearMonth=I(Fi),F.prototype.visitIntervalMonthDayNano=I(Ii),F.prototype.visitDuration=I(Vi),F.prototype.visitDurationSecond=I(Li),F.prototype.visitDurationMillisecond=I(Ri),F.prototype.visitDurationMicrosecond=I(zi),F.prototype.visitDurationNanosecond=I(Bi),F.prototype.visitFixedSizeList=I(Hi),F.prototype.visitMap=I(Di);var L=new F,Ui=Symbol.for(`keys`),Wi=Symbol.for(`vals`),Gi=Symbol.for(`kKeysAsStrings`),Ki=Symbol.for(`_kKeysAsStrings`),qi=class{constructor(e){return this[Ui]=new W([e.children[0]]).memoize(),this[Wi]=e.children[1],new Proxy(this,new Yi)}get[Gi](){return this[Ki]||(this[Ki]=Array.from(this[Ui].toArray(),String))}[Symbol.iterator](){return new Ji(this[Ui],this[Wi])}get size(){return this[Ui].length}toArray(){return Object.values(this.toJSON())}toJSON(){let e=this[Ui],t=this[Wi],n={};for(let r=-1,i=e.length;++r<i;)n[e.get(r)]=L.visit(t,r);return n}toString(){return`{${[...this].map(([e,t])=>`${Ct(e)}: ${Ct(t)}`).join(`, `)}}`}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.toString()}},Ji=class{constructor(e,t){this.keys=e,this.vals=t,this.keyIndex=0,this.numKeys=e.length}[Symbol.iterator](){return this}next(){let e=this.keyIndex;return e===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(e),L.visit(this.vals,e)]})}},Yi=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[Gi]}has(e,t){return e[Gi].includes(t)}getOwnPropertyDescriptor(e,t){if(e[Gi].indexOf(t)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,t){if(Reflect.has(e,t))return e[t];let n=e[Gi].indexOf(t);if(n!==-1){let r=L.visit(Reflect.get(e,Wi),n);return Reflect.set(e,t,r),r}}set(e,t,n){let r=e[Gi].indexOf(t);return r===-1?Reflect.has(e,t)?Reflect.set(e,t,n):!1:(P.visit(Reflect.get(e,Wi),r,n),Reflect.set(e,t,n))}};Object.defineProperties(qi.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:`Row`},[Ui]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Wi]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Ki]:{writable:!0,enumerable:!1,configurable:!1,value:null}});var Xi;function Zi(e,t,n,r){let{length:i=0}=e,a=typeof t==`number`?t:0,o=typeof n==`number`?n:i;return a<0&&(a=(a%i+i)%i),o<0&&(o=(o%i+i)%i),o<a&&(Xi=a,a=o,o=Xi),o>i&&(o=i),r?r(e,a,o):[a,o]}var Qi=(e,t)=>e<0?t+e:e,$i=e=>e!==e;function ea(e){if(typeof e!=`object`||!e)return $i(e)?$i:t=>t===e;if(e instanceof Date){let t=e.valueOf();return e=>e instanceof Date&&e.valueOf()===t}return ArrayBuffer.isView(e)?t=>t?Te(e,t):!1:e instanceof Map?na(e):Array.isArray(e)?ta(e):e instanceof W?ra(e):ia(e,!0)}function ta(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=ea(e[n]);return aa(t)}function na(e){let t=-1,n=[];for(let r of e.values())n[++t]=ea(r);return aa(n)}function ra(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=ea(e.get(n));return aa(t)}function ia(e,t=!1){let n=Object.keys(e);if(!t&&n.length===0)return()=>!1;let r=[];for(let t=-1,i=n.length;++t<i;)r[t]=ea(e[n[t]]);return aa(r,n)}function aa(e,t){return n=>{if(!n||typeof n!=`object`)return!1;switch(n.constructor){case Array:return oa(e,n);case Map:return ca(e,n,n.keys());case qi:case Kr:case Object:case void 0:return ca(e,n,t||Object.keys(n))}return n instanceof W&&sa(e,n)}}function oa(e,t){let n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t[r]))return!1;return!0}function sa(e,t){let n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t.get(r)))return!1;return!0}function ca(e,t,n){let r=n[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),a=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),o=0,s=e.length,c=a.next(),l=r.next(),u=i.next();for(;o<s&&!l.done&&!u.done&&!c.done&&!(l.value!==u.value||!e[o](c.value));++o,l=r.next(),u=i.next(),c=a.next());return o===s&&l.done&&u.done&&c.done?!0:(r.return&&r.return(),i.return&&i.return(),a.return&&a.return(),!1)}function la(e,t,n,r){return!!(n&1<<r)}function ua(e,t,n,r){return(n&1<<r)>>r}function da(e,t,n){let r=n.byteLength+7&-8;if(e>0||n.byteLength<r){let i=new Uint8Array(r);return i.set(e%8==0?n.subarray(e>>3):fa(new pa(n,e,t,null,la)).subarray(0,r)),i}return n}function fa(e){let t=[],n=0,r=0,i=0;for(let a of e)a&&(i|=1<<r),++r===8&&(t[n++]=i,i=r=0);(n===0||r>0)&&(t[n++]=i);let a=new Uint8Array(t.length+7&-8);return a.set(t),a}var pa=class{constructor(e,t,n,r,i){this.bytes=e,this.length=n,this.context=r,this.get=i,this.bit=t%8,this.byteIndex=t>>3,this.byte=e[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 ma(e,t,n){if(n-t<=0)return 0;if(n-t<8){let r=0;for(let i of new pa(e,t,n-t,e,ua))r+=i;return r}let r=n>>3<<3,i=t+(t%8==0?0:8-t%8);return ma(e,t,i)+ma(e,r,n)+ha(e,i>>3,r-i>>3)}function ha(e,t,n){let r=0,i=Math.trunc(t),a=new DataView(e.buffer,e.byteOffset,e.byteLength),o=n===void 0?e.byteLength:i+n;for(;o-i>=4;)r+=ga(a.getUint32(i)),i+=4;for(;o-i>=2;)r+=ga(a.getUint16(i)),i+=2;for(;o-i>=1;)r+=ga(a.getUint8(i)),i+=1;return r}function ga(e){let t=Math.trunc(e);return t-=t>>>1&1431655765,t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var _a=Symbol.for(`apache-arrow/Data`),R=class e{static isData(e){return e?.[_a]===!0}get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:e}=this;return D.isSparseUnion(e)||D.isDenseUnion(e)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let e=0,{valueOffsets:t,values:n,nullBitmap:r,typeIds:i}=this;return t&&(e+=t.byteLength),n&&(e+=n.byteLength),r&&(e+=r.byteLength),i&&(e+=i.byteLength),e+=this.variadicBuffers.reduce((e,t)=>e+(t?.byteLength??0),0),this.children.reduce((e,t)=>e+t.byteLength,e)}get nullCount(){if(D.isUnion(this.type))return this.children.reduce((e,t)=>e+t.nullCount,0);let e=this._nullCount,t;return e<=-1&&(t=this.nullBitmap)&&(this._nullCount=e=t.length===0?0:this.length-ma(t,this.offset,this.offset+this.length)),e}constructor(t,n,r,i,a,o=[],s,c=[]){this.type=t,this.children=o,this.dictionary=s,this.offset=Math.floor(Math.max(n||0,0)),this.length=Math.floor(Math.max(r||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let l;a instanceof e?(this.stride=a.stride,this.values=a.values,this.typeIds=a.typeIds,this.nullBitmap=a.nullBitmap,this.valueOffsets=a.valueOffsets,this.variadicBuffers=a.variadicBuffers):(this.stride=Vn(t),a&&((l=a[0])&&(this.valueOffsets=l),(l=a[1])&&(this.values=l),(l=a[2])&&(this.nullBitmap=l),(l=a[3])&&(this.typeIds=l)),this.variadicBuffers=c),this.variadicBuffers??=[]}getValid(e){let{type:t}=this;if(D.isUnion(t)){let n=t,r=this.typeIds[e],i=n.typeIdToChildIndex[r],a=this.children[i],o=this.valueOffsets,s=n.mode===h.Dense&&o?Number(o[e]):e;return a.getValid(s)}if(this.nullable&&this.nullCount>0){let t=this.offset+e;return!!(this.nullBitmap[t>>3]&1<<t%8)}return!0}setValid(e,t){let n,{type:r}=this;if(D.isUnion(r)){let i=r,a=this.typeIds[e],o=i.typeIdToChildIndex[a],s=this.children[o],c=this.valueOffsets,l=i.mode===h.Dense&&c?Number(c[e]):e;n=s.getValid(l),s.setValid(l,t)}else{let{nullBitmap:r}=this,{offset:i,length:a}=this,o=i+e,s=1<<o%8,c=o>>3;(!r||r.byteLength<=c)&&(r=new Uint8Array((i+a+63&-64)>>3).fill(255),this.nullCount>0?(r.set(da(i,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:r})):Object.assign(this,{nullBitmap:r,_nullCount:0}));let l=r[c];n=(l&s)!==0,r[c]=t?l|s:l&~s}return n!==!!t&&(this._nullCount=this.nullCount+(t?-1:1)),t}clone(t=this.type,n=this.offset,r=this.length,i=this._nullCount,a=this,o=this.children,s=this.variadicBuffers){return new e(t,n,r,i,a,o,this.dictionary,s)}slice(e,t){let{stride:n,typeId:r,children:i}=this,a=(this._nullCount===0)-1,o=r===16?n:1,s=this._sliceBuffers(e,t,n,r);return this.clone(this.type,this.offset+e,t,a,s,i.length===0||this.valueOffsets?i:this._sliceChildren(i,o*e,o*t),this.variadicBuffers)}_changeLengthAndBackfillNullBitmap(e){if(this.typeId===w.Null)return this.clone(this.type,0,e,0,this.buffers,this.children,this.variadicBuffers);let{length:t,nullCount:n}=this,r=new Uint8Array((e+63&-64)>>3).fill(255,0,t>>3);r[t>>3]=(1<<t-(t&-8))-1,n>0&&r.set(da(this.offset,t,this.nullBitmap),0);let i=this.buffers;return i[xt.VALIDITY]=r,this.clone(this.type,0,e,n+(e-t),i,this.children,this.variadicBuffers)}_sliceBuffers(e,t,n,r){let i,{buffers:a}=this;if((i=a[xt.TYPE])&&(a[xt.TYPE]=i.subarray(e,e+t)),D.isBinaryView(this.type)||D.isUtf8View(this.type)){let n=k.ELEMENT_WIDTH;(i=a[xt.DATA])&&(a[xt.DATA]=i.subarray(e*n,(e+t)*n))}else(i=a[xt.OFFSET])&&(a[xt.OFFSET]=i.subarray(e,e+t+1))||(i=a[xt.DATA])&&(a[xt.DATA]=r===6?i:i.subarray(n*e,n*(e+t)));return a}_sliceChildren(e,t,n){return e.map(e=>e.slice(t,n))}};R.prototype.children=Object.freeze([]),R.prototype[_a]=!0,Object.defineProperty(R,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===R&&R.isData(e)}});var va=new class e extends j{visit(e){return this.getVisitFn(e.type).call(this,e)}visitNull(e){let{type:t,offset:n=0,length:r=0}=e;return new R(t,n,r,r)}visitBool(e){let{type:t,offset:n=0}=e,r=p(e.nullBitmap),i=f(t.ArrayType,e.data),{length:a=i.length>>3,nullCount:o=e.nullBitmap?-1:0}=e;return new R(t,n,a,o,[void 0,i,r])}visitInt(e){let{type:t,offset:n=0}=e,r=p(e.nullBitmap),i=f(t.ArrayType,e.data),{length:a=i.length,nullCount:o=e.nullBitmap?-1:0}=e;return new R(t,n,a,o,[void 0,i,r])}visitFloat(e){let{type:t,offset:n=0}=e,r=p(e.nullBitmap),i=f(t.ArrayType,e.data),{length:a=i.length,nullCount:o=e.nullBitmap?-1:0}=e;return new R(t,n,a,o,[void 0,i,r])}visitUtf8(e){let{type:t,offset:n=0}=e,r=p(e.data),i=p(e.nullBitmap),a=ve(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new R(t,n,o,s,[a,r,i])}visitUtf8View(e){let{type:t,offset:n=0}=e,r=f(t.ArrayType,e.views),i=p(e.nullBitmap),a=(e.variadicBuffers||[]).map(e=>p(e));return new R(t,n,e.length??Math.trunc(r.length/wn.ELEMENT_WIDTH),e.nullBitmap?-1:0,[void 0,r,i],[],void 0,a)}visitLargeUtf8(e){let{type:t,offset:n=0}=e,r=p(e.data),i=p(e.nullBitmap),a=ye(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new R(t,n,o,s,[a,r,i])}visitBinary(e){let{type:t,offset:n=0}=e,r=p(e.data),i=p(e.nullBitmap),a=ve(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new R(t,n,o,s,[a,r,i])}visitBinaryView(e){let{type:t,offset:n=0}=e,r=f(t.ArrayType,e.views),i=p(e.nullBitmap),a=(e.variadicBuffers||[]).map(e=>p(e));return new R(t,n,e.length??Math.trunc(r.length/k.ELEMENT_WIDTH),e.nullBitmap?-1:0,[void 0,r,i],[],void 0,a)}visitLargeBinary(e){let{type:t,offset:n=0}=e,r=p(e.data),i=p(e.nullBitmap),a=ye(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new R(t,n,o,s,[a,r,i])}visitFixedSizeBinary(e){let{type:t,offset:n=0}=e,r=p(e.nullBitmap),i=f(t.ArrayType,e.data),{length:a=i.length/Vn(t),nullCount:o=e.nullBitmap?-1:0}=e;return new R(t,n,a,o,[void 0,i,r])}visitDate(e){let{type:t,offset:n=0}=e,r=p(e.nullBitmap),i=f(t.ArrayType,e.data),{length:a=i.length/Vn(t),nullCount:o=e.nullBitmap?-1:0}=e;return new R(t,n,a,o,[void 0,i,r])}visitTimestamp(e){let{type:t,offset:n=0}=e,r=p(e.nullBitmap),i=f(t.ArrayType,e.data),{length:a=i.length/Vn(t),nullCount:o=e.nullBitmap?-1:0}=e;return new R(t,n,a,o,[void 0,i,r])}visitTime(e){let{type:t,offset:n=0}=e,r=p(e.nullBitmap),i=f(t.ArrayType,e.data),{length:a=i.length/Vn(t),nullCount:o=e.nullBitmap?-1:0}=e;return new R(t,n,a,o,[void 0,i,r])}visitDecimal(e){let{type:t,offset:n=0}=e,r=p(e.nullBitmap),i=f(t.ArrayType,e.data),{length:a=i.length/Vn(t),nullCount:o=e.nullBitmap?-1:0}=e;return new R(t,n,a,o,[void 0,i,r])}visitList(e){let{type:t,offset:n=0,child:r}=e,i=p(e.nullBitmap),a=ve(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new R(t,n,o,s,[a,void 0,i],[r])}visitLargeList(e){let{type:t,offset:n=0,child:r}=e,i=p(e.nullBitmap),a=ye(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new R(t,n,o,s,[a,void 0,i],[r])}visitStruct(e){let{type:t,offset:n=0,children:r=[]}=e,i=p(e.nullBitmap),{length:a=r.reduce((e,{length:t})=>Math.max(e,t),0),nullCount:o=e.nullBitmap?-1:0}=e;return new R(t,n,a,o,[void 0,void 0,i],r)}visitUnion(e){let{type:t,offset:n=0,children:r=[]}=e,i=f(t.ArrayType,e.typeIds),{length:a=i.length,nullCount:o=-1}=e;return D.isSparseUnion(t)?new R(t,n,a,o,[void 0,void 0,void 0,i],r):new R(t,n,a,o,[ve(e.valueOffsets),void 0,void 0,i],r)}visitDictionary(t){let{type:n,offset:r=0}=t,i=p(t.nullBitmap),a=f(n.indices.ArrayType,t.data),{dictionary:o=new W([new e().visit({type:n.dictionary})])}=t,{length:s=a.length,nullCount:c=t.nullBitmap?-1:0}=t;return new R(n,r,s,c,[void 0,a,i],[],o)}visitInterval(e){let{type:t,offset:n=0}=e,r=p(e.nullBitmap),i=f(t.ArrayType,e.data),{length:a=i.length/Vn(t),nullCount:o=e.nullBitmap?-1:0}=e;return new R(t,n,a,o,[void 0,i,r])}visitDuration(e){let{type:t,offset:n=0}=e,r=p(e.nullBitmap),i=f(t.ArrayType,e.data),{length:a=i.length,nullCount:o=e.nullBitmap?-1:0}=e;return new R(t,n,a,o,[void 0,i,r])}visitFixedSizeList(t){let{type:n,offset:r=0,child:i=new e().visit({type:n.valueType})}=t,a=p(t.nullBitmap),{length:o=i.length/Vn(n),nullCount:s=t.nullBitmap?-1:0}=t;return new R(n,r,o,s,[void 0,void 0,a],[i])}visitMap(t){let{type:n,offset:r=0,child:i=new e().visit({type:n.childType})}=t,a=p(t.nullBitmap),o=ve(t.valueOffsets),{length:s=o.length-1,nullCount:c=t.nullBitmap?-1:0}=t;return new R(n,r,s,c,[o,void 0,a],[i])}};function z(e){return va.visit(e)}var ya=class{constructor(e=0,t){this.numChunks=e,this.getChunkIterator=t,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let e=this.chunkIterator.next();if(!e.done)return e;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function ba(e){return e.some(e=>e.nullable)}function xa(e){return e.reduce((e,t)=>e+t.nullCount,0)}function Sa(e){return e.reduce((e,t,n)=>(e[n+1]=e[n]+t.length,e),new Uint32Array(e.length+1))}function Ca(e,t,n,r){let i=[];for(let a=-1,o=e.length;++a<o;){let o=e[a],s=t[a],{length:c}=o;if(s>=r)break;if(n>=s+c)continue;if(s>=n&&s+c<=r){i.push(o);continue}let l=Math.max(0,n-s),u=Math.min(r-s,c);i.push(o.slice(l,u-l))}return i.length===0&&i.push(e[0].slice(0,0)),i}function wa(e,t,n,r){let i=0,a=0,o=t.length-1;do{if(i>=o-1)return n<t[o]?r(e,i,n-t[i]):null;a=i+Math.trunc((o-i)*.5),n<t[a]?o=a:i=a}while(i<o)}function Ta(e,t){return e.getValid(t)}function Ea(e){function t(t,n,r){return e(t[n],r)}return function(e){let n=this.data;return wa(n,this._offsets,e,t)}}function Da(e){let t;function n(n,r,i){return e(n[r],i,t)}return function(e,r){let i=this.data;t=r;let a=wa(i,this._offsets,e,n);return t=void 0,a}}function Oa(e){let t;function n(n,r,i){let a=i,o=0,s=0;for(let i=r-1,c=n.length;++i<c;){let r=n[i];if(~(o=e(r,t,a)))return s+o;a=0,s+=r.length}return-1}return function(e,r){t=e;let i=this.data,a=typeof r==`number`?wa(i,this._offsets,r,n):n(i,0,0);return t=void 0,a}}var B=class extends j{};function ka(e,t){return t===null&&e.length>0?0:-1}function Aa(e,t){let{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(let i of new pa(n,e.offset+(t||0),e.length,n,la)){if(!i)return r;++r}return-1}function V(e,t,n){if(t===void 0)return-1;if(t===null)switch(e.typeId){case w.Union:break;case w.Dictionary:break;default:return Aa(e,n)}let r=L.getVisitFn(e),i=ea(t);for(let t=(n||0)-1,a=e.length;++t<a;)if(i(r(e,t)))return t;return-1}function ja(e,t,n){let r=L.getVisitFn(e),i=ea(t);for(let t=(n||0)-1,a=e.length;++t<a;)if(i(r(e,t)))return t;return-1}B.prototype.visitNull=ka,B.prototype.visitBool=V,B.prototype.visitInt=V,B.prototype.visitInt8=V,B.prototype.visitInt16=V,B.prototype.visitInt32=V,B.prototype.visitInt64=V,B.prototype.visitUint8=V,B.prototype.visitUint16=V,B.prototype.visitUint32=V,B.prototype.visitUint64=V,B.prototype.visitFloat=V,B.prototype.visitFloat16=V,B.prototype.visitFloat32=V,B.prototype.visitFloat64=V,B.prototype.visitUtf8=V,B.prototype.visitLargeUtf8=V,B.prototype.visitUtf8View=V,B.prototype.visitBinary=V,B.prototype.visitLargeBinary=V,B.prototype.visitBinaryView=V,B.prototype.visitFixedSizeBinary=V,B.prototype.visitDate=V,B.prototype.visitDateDay=V,B.prototype.visitDateMillisecond=V,B.prototype.visitTimestamp=V,B.prototype.visitTimestampSecond=V,B.prototype.visitTimestampMillisecond=V,B.prototype.visitTimestampMicrosecond=V,B.prototype.visitTimestampNanosecond=V,B.prototype.visitTime=V,B.prototype.visitTimeSecond=V,B.prototype.visitTimeMillisecond=V,B.prototype.visitTimeMicrosecond=V,B.prototype.visitTimeNanosecond=V,B.prototype.visitDecimal=V,B.prototype.visitList=V,B.prototype.visitLargeList=V,B.prototype.visitStruct=V,B.prototype.visitUnion=V,B.prototype.visitDenseUnion=ja,B.prototype.visitSparseUnion=ja,B.prototype.visitDictionary=V,B.prototype.visitInterval=V,B.prototype.visitIntervalDayTime=V,B.prototype.visitIntervalYearMonth=V,B.prototype.visitIntervalMonthDayNano=V,B.prototype.visitDuration=V,B.prototype.visitDurationSecond=V,B.prototype.visitDurationMillisecond=V,B.prototype.visitDurationMicrosecond=V,B.prototype.visitDurationNanosecond=V,B.prototype.visitFixedSizeList=V,B.prototype.visitMap=V;var Ma=new B,H=class extends j{};function U(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(D.isInt(t)&&t.bitWidth!==64||D.isTime(t)&&t.bitWidth!==64||D.isFloat(t)&&t.precision!==g.HALF))return new ya(e.data.length,t=>{let n=e.data[t];return n.values.subarray(0,n.length)[Symbol.iterator]()});let n=0;return new ya(e.data.length,t=>{let r=e.data[t].length,i=e.slice(n,n+r);return n+=r,new Na(i)})}var Na=class{constructor(e){this.vector=e,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};H.prototype.visitNull=U,H.prototype.visitBool=U,H.prototype.visitInt=U,H.prototype.visitInt8=U,H.prototype.visitInt16=U,H.prototype.visitInt32=U,H.prototype.visitInt64=U,H.prototype.visitUint8=U,H.prototype.visitUint16=U,H.prototype.visitUint32=U,H.prototype.visitUint64=U,H.prototype.visitFloat=U,H.prototype.visitFloat16=U,H.prototype.visitFloat32=U,H.prototype.visitFloat64=U,H.prototype.visitUtf8=U,H.prototype.visitLargeUtf8=U,H.prototype.visitUtf8View=U,H.prototype.visitBinary=U,H.prototype.visitLargeBinary=U,H.prototype.visitBinaryView=U,H.prototype.visitFixedSizeBinary=U,H.prototype.visitDate=U,H.prototype.visitDateDay=U,H.prototype.visitDateMillisecond=U,H.prototype.visitTimestamp=U,H.prototype.visitTimestampSecond=U,H.prototype.visitTimestampMillisecond=U,H.prototype.visitTimestampMicrosecond=U,H.prototype.visitTimestampNanosecond=U,H.prototype.visitTime=U,H.prototype.visitTimeSecond=U,H.prototype.visitTimeMillisecond=U,H.prototype.visitTimeMicrosecond=U,H.prototype.visitTimeNanosecond=U,H.prototype.visitDecimal=U,H.prototype.visitList=U,H.prototype.visitLargeList=U,H.prototype.visitStruct=U,H.prototype.visitUnion=U,H.prototype.visitDenseUnion=U,H.prototype.visitSparseUnion=U,H.prototype.visitDictionary=U,H.prototype.visitInterval=U,H.prototype.visitIntervalDayTime=U,H.prototype.visitIntervalYearMonth=U,H.prototype.visitIntervalMonthDayNano=U,H.prototype.visitDuration=U,H.prototype.visitDurationSecond=U,H.prototype.visitDurationMillisecond=U,H.prototype.visitDurationMicrosecond=U,H.prototype.visitDurationNanosecond=U,H.prototype.visitFixedSizeList=U,H.prototype.visitMap=U;var Pa=new H,Fa,Ia=Symbol.for(`apache-arrow/Vector`),La={},Ra={},W=class e{static isVector(e){return e?.[Ia]===!0}constructor(t){let n=t[0]instanceof e?t.flatMap(e=>e.data):t;if(n.length===0||n.some(e=>!(e instanceof R)))throw TypeError(`Vector constructor expects an Array of Data instances.`);let r=n[0]?.type;switch(n.length){case 0:this._offsets=[0];break;case 1:{let{get:e,set:t,indexOf:i}=La[r.typeId],a=n[0];this.isValid=e=>Ta(a,e),this.get=t=>e(a,t),this.set=(e,n)=>t(a,e,n),this.indexOf=e=>i(a,e),this._offsets=[0,a.length];break}default:Object.setPrototypeOf(this,Ra[r.typeId]),this._offsets=Sa(n)}this.data=n,this.type=r,this.stride=Vn(r),this.numChildren=r.children?.length??0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((e,t)=>e+t.byteLength,0)}get nullable(){return ba(this.data)}get nullCount(){return xa(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${w[this.type.typeId]}Vector`}isValid(e){return!1}get(e){return null}at(e){return this.get(Qi(e,this.length))}set(e,t){}indexOf(e,t){return-1}includes(e,t){return this.indexOf(e,t)>-1}[Symbol.iterator](){return Pa.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(e=>e.data).flat(1/0)))}slice(t,n){return new e(Zi(this,t,n,({data:e,_offsets:t},n,r)=>Ca(e,t,n,r)))}toJSON(){return[...this]}toArray(){let{type:e,data:t,length:n,stride:r,ArrayType:i}=this;switch(e.typeId){case w.Int:case w.Float:case w.Decimal:case w.Time:case w.Timestamp:switch(t.length){case 0:return new i;case 1:return t[0].values.subarray(0,n*r);default:return t.reduce((e,{values:t,length:n})=>(e.array.set(t.subarray(0,n*r),e.offset),e.offset+=n*r,e),{array:new i(n*r),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(`,`)}]`}getChild(e){return this.getChildAt(this.type.children?.findIndex(t=>t.name===e))}getChildAt(t){return t>-1&&t<this.numChildren?new e(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return D.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(D.isDictionary(this.type)){let t=new za(this.data[0].dictionary),n=this.data.map(e=>{let n=e.clone();return n.dictionary=t,n});return new e(n)}return new za(this)}unmemoize(){if(D.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),n=this.data.map(e=>{let n=e.clone();return n.dictionary=t,n});return new e(n)}return this}};Fa=Symbol.toStringTag,W[Fa]=(e=>{e.type=D.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0,e[Ia]=!0;let t=Object.keys(w).map(e=>w[e]).filter(e=>typeof e==`number`&&e!==w.NONE);for(let n of t)La[n]={get:L.getVisitFnByTypeId(n),set:P.getVisitFnByTypeId(n),indexOf:Ma.getVisitFnByTypeId(n)},Ra[n]=Object.create(e,{isValid:{value:Ea(Ta)},get:{value:Ea(L.getVisitFnByTypeId(n))},set:{value:Da(P.getVisitFnByTypeId(n))},indexOf:{value:Oa(Ma.getVisitFnByTypeId(n))}});return`Vector`})(W.prototype),Object.defineProperty(W,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===W&&W.isVector(e)}});var za=class e extends W{constructor(t){super(t.data);let n=this.get,r=this.set,i=this.slice,a=Array(this.length);Object.defineProperty(this,"get",{value(e){let t=a[e];if(t!==void 0)return t;let r=n.call(this,e);return a[e]=r,r}}),Object.defineProperty(this,"set",{value(e,t){r.call(this,e,t),a[e]=t}}),Object.defineProperty(this,"slice",{value:(t,n)=>new e(i.call(this,t,n))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new W(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}},Ba=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,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(e,t,n,r){return e.prep(8,24),e.writeInt64(BigInt(r??0)),e.pad(4),e.writeInt32(n),e.writeInt64(BigInt(t??0)),e.offset()}},Va=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFooter(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):m.V1}schema(e){let t=this.bb.__offset(this.bb_pos,6);return t?(e||new bt).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}dictionaries(e,t){let n=this.bb.__offset(this.bb_pos,8);return n?(t||new Ba).__init(this.bb.__vector(this.bb_pos+n)+e*24,this.bb):null}dictionariesLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}recordBatches(e,t){let n=this.bb.__offset(this.bb_pos,10);return n?(t||new Ba).__init(this.bb.__vector(this.bb_pos+n)+e*24,this.bb):null}recordBatchesLength(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,12);return n?(t||new b).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startFooter(e){e.startObject(5)}static addVersion(e,t){e.addFieldInt16(0,t,m.V1)}static addSchema(e,t){e.addFieldOffset(1,t,0)}static addDictionaries(e,t){e.addFieldOffset(2,t,0)}static startDictionariesVector(e,t){e.startVector(24,t,8)}static addRecordBatches(e,t){e.addFieldOffset(3,t,0)}static startRecordBatchesVector(e,t){e.startVector(24,t,8)}static addCustomMetadata(e,t){e.addFieldOffset(4,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endFooter(e){return e.endObject()}static finishFooterBuffer(e,t){e.finish(t)}static finishSizePrefixedFooterBuffer(e,t){e.finish(t,void 0,!0)}},Ha=Symbol.for(`apache-arrow/Schema`),Ua=Symbol.for(`apache-arrow/Field`),G=class e{static isSchema(e){return e?.[Ha]===!0}constructor(e=[],t,n,r=m.V5){this.fields=e||[],this.metadata=t||new Map,n||=Ga(this.fields),this.dictionaries=n,this.metadataVersion=r}get[Symbol.toStringTag](){return`Schema`}get names(){return this.fields.map(e=>e.name)}toString(){return`Schema<{ ${this.fields.map((e,t)=>`${t}: ${e}`).join(`, `)} }>`}select(t){let n=new Set(t),r=this.fields.filter(e=>n.has(e.name));return new e(r,this.metadata)}selectAt(t){let n=t.map(e=>this.fields[e]).filter(Boolean);return new e(n,this.metadata)}assign(...t){let n=t[0]instanceof e?t[0]:Array.isArray(t[0])?new e(t[0]):new e(t),r=[...this.fields],i=Wa(Wa(new Map,this.metadata),n.metadata),a=n.fields.filter(e=>{let t=r.findIndex(t=>t.name===e.name);return!~t||(r[t]=e.clone({metadata:Wa(Wa(new Map,r[t].metadata),e.metadata)}))&&!1}),o=Ga(a,new Map);return new e([...r,...a],i,new Map([...this.dictionaries,...o]))}};G.prototype.fields=null,G.prototype.metadata=null,G.prototype.dictionaries=null,G.prototype[Ha]=!0,Object.defineProperty(G,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===G&&G.isSchema(e)}});var K=class e{static isField(e){return e?.[Ua]===!0}static new(...t){let[n,r,i,a]=t;return t[0]&&typeof t[0]==`object`&&({name:n}=t[0],r===void 0&&(r=t[0].type),i===void 0&&(i=t[0].nullable),a===void 0&&(a=t[0].metadata)),new e(`${n}`,r,i,a)}constructor(e,t,n=!1,r){this.name=e,this.type=t,this.nullable=n,this.metadata=r||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return`Field`}toString(){return`${this.name}: ${this.type}`}clone(...t){let[n,r,i,a]=t;return!t[0]||typeof t[0]!=`object`?[n=this.name,r=this.type,i=this.nullable,a=this.metadata]=t:{name:n=this.name,type:r=this.type,nullable:i=this.nullable,metadata:a=this.metadata}=t[0],e.new(n,r,i,a)}};K.prototype.type=null,K.prototype.name=null,K.prototype.nullable=null,K.prototype.metadata=null,K.prototype[Ua]=!0,Object.defineProperty(K,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===K&&K.isField(e)}});function Wa(e,t){return new Map([...e||new Map,...t||new Map])}function Ga(e,t=new Map){for(let n=-1,r=e.length;++n<r;){let r=e[n].type;if(D.isDictionary(r)){if(!t.has(r.id))t.set(r.id,r.dictionary);else if(t.get(r.id)!==r.dictionary)throw Error(`Cannot create Schema containing two different dictionaries with the same Id`)}r.children&&r.children.length>0&&Ga(r.children,t)}return t}var Ka=Ve,qa=Be,Ja=class{static decode(e){e=new qa(p(e));let t=Va.getRootAsFooter(e);return new Ya(G.decode(t.schema(),new Map,t.version()),t)}static encode(e){let t=new Ka,n=G.encode(t,e.schema);Va.startRecordBatchesVector(t,e.numRecordBatches);for(let n of[...e.recordBatches()].slice().reverse())Xa.encode(t,n);let r=t.endVector();Va.startDictionariesVector(t,e.numDictionaries);for(let n of[...e.dictionaryBatches()].slice().reverse())Xa.encode(t,n);let i=t.endVector();return Va.startFooter(t),Va.addSchema(t,n),Va.addVersion(t,m.V5),Va.addRecordBatches(t,r),Va.addDictionaries(t,i),Va.finishFooterBuffer(t,Va.endFooter(t)),t.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(e,t=m.V5,n,r){this.schema=e,this.version=t,n&&(this._recordBatches=n),r&&(this._dictionaryBatches=r)}*recordBatches(){for(let e,t=-1,n=this.numRecordBatches;++t<n;)(e=this.getRecordBatch(t))&&(yield e)}*dictionaryBatches(){for(let e,t=-1,n=this.numDictionaries;++t<n;)(e=this.getDictionaryBatch(t))&&(yield e)}getRecordBatch(e){return e>=0&&e<this.numRecordBatches&&this._recordBatches[e]||null}getDictionaryBatch(e){return e>=0&&e<this.numDictionaries&&this._dictionaryBatches[e]||null}},Ya=class extends Ja{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(e,t){super(e,t.version()),this._footer=t}getRecordBatch(e){if(e>=0&&e<this.numRecordBatches){let t=this._footer.recordBatches(e);if(t)return Xa.decode(t)}return null}getDictionaryBatch(e){if(e>=0&&e<this.numDictionaries){let t=this._footer.dictionaries(e);if(t)return Xa.decode(t)}return null}},Xa=class e{static decode(t){return new e(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(e,t){let{metaDataLength:n}=t,r=BigInt(t.offset),i=BigInt(t.bodyLength);return Ba.createBlock(e,r,n,i)}constructor(e,t,n){this.metaDataLength=e,this.offset=T(n),this.bodyLength=T(t)}},Za=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsMessage(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):m.V1}headerType(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb_pos+e):C.NONE}header(e){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__union(e,this.bb_pos+t):null}bodyLength(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb_pos+e):BigInt(`0`)}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,12);return n?(t||new b).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startMessage(e){e.startObject(5)}static addVersion(e,t){e.addFieldInt16(0,t,m.V1)}static addHeaderType(e,t){e.addFieldInt8(1,t,C.NONE)}static addHeader(e,t){e.addFieldOffset(2,t,0)}static addBodyLength(e,t){e.addFieldInt64(3,t,BigInt(`0`))}static addCustomMetadata(e,t){e.addFieldOffset(4,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endMessage(e){return e.endObject()}static finishMessageBuffer(e,t){e.finish(t)}static finishSizePrefixedMessageBuffer(e,t){e.finish(t,void 0,!0)}static createMessage(t,n,r,i,a,o){return e.startMessage(t),e.addVersion(t,n),e.addHeaderType(t,r),e.addHeader(t,i),e.addBodyLength(t,a),e.addCustomMetadata(t,o),e.endMessage(t)}},Qa=new class extends j{visit(e,t){return e==null||t==null?void 0:super.visit(e,t)}visitNull(e,t){return pt.startNull(t),pt.endNull(t)}visitInt(e,t){return Xe.startInt(t),Xe.addBitWidth(t,e.bitWidth),Xe.addIsSigned(t,e.isSigned),Xe.endInt(t)}visitFloat(e,t){return ot.startFloatingPoint(t),ot.addPrecision(t,e.precision),ot.endFloatingPoint(t)}visitBinary(e,t){return Qe.startBinary(t),Qe.endBinary(t)}visitBinaryView(e,t){return $e.startBinaryView(t),$e.endBinaryView(t)}visitLargeBinary(e,t){return ct.startLargeBinary(t),ct.endLargeBinary(t)}visitBool(e,t){return et.startBool(t),et.endBool(t)}visitUtf8(e,t){return vt.startUtf8(t),vt.endUtf8(t)}visitUtf8View(e,t){return yt.startUtf8View(t),yt.endUtf8View(t)}visitLargeUtf8(e,t){return ut.startLargeUtf8(t),ut.endLargeUtf8(t)}visitDecimal(e,t){return nt.startDecimal(t),nt.addScale(t,e.scale),nt.addPrecision(t,e.precision),nt.addBitWidth(t,e.bitWidth),nt.endDecimal(t)}visitDate(e,t){return tt.startDate(t),tt.addUnit(t,e.unit),tt.endDate(t)}visitTime(e,t){return ht.startTime(t),ht.addUnit(t,e.unit),ht.addBitWidth(t,e.bitWidth),ht.endTime(t)}visitTimestamp(e,t){let n=e.timezone&&t.createString(e.timezone)||void 0;return gt.startTimestamp(t),gt.addUnit(t,e.unit),n!==void 0&&gt.addTimezone(t,n),gt.endTimestamp(t)}visitInterval(e,t){return st.startInterval(t),st.addUnit(t,e.unit),st.endInterval(t)}visitDuration(e,t){return rt.startDuration(t),rt.addUnit(t,e.unit),rt.endDuration(t)}visitList(e,t){return dt.startList(t),dt.endList(t)}visitLargeList(e,t){return lt.startLargeList(t),lt.endLargeList(t)}visitStruct(e,t){return mt.startStruct_(t),mt.endStruct_(t)}visitUnion(e,t){_t.startTypeIdsVector(t,e.typeIds.length);let n=_t.createTypeIdsVector(t,e.typeIds);return _t.startUnion(t),_t.addMode(t,e.mode),_t.addTypeIds(t,n),_t.endUnion(t)}visitDictionary(e,t){let n=this.visit(e.indices,t);return Ze.startDictionaryEncoding(t),Ze.addId(t,BigInt(e.id)),Ze.addIsOrdered(t,e.isOrdered),n!==void 0&&Ze.addIndexType(t,n),Ze.endDictionaryEncoding(t)}visitFixedSizeBinary(e,t){return it.startFixedSizeBinary(t),it.addByteWidth(t,e.byteWidth),it.endFixedSizeBinary(t)}visitFixedSizeList(e,t){return at.startFixedSizeList(t),at.addListSize(t,e.listSize),at.endFixedSizeList(t)}visitMap(e,t){return ft.startMap(t),ft.addKeysSorted(t,e.keysSorted),ft.endMap(t)}};function $a(e,t=new Map){return new G(no(e,t),lo(e.metadata),t)}function eo(e){return new q(e.count,io(e.columns),ao(e.columns),null,so(e.columns))}function to(e){return new go(eo(e.data),e.id,e.isDelta)}function no(e,t){return(e.fields||[]).filter(Boolean).map(e=>K.fromJSON(e,t))}function ro(e,t){return(e.children||[]).filter(Boolean).map(e=>K.fromJSON(e,t))}function io(e){return(e||[]).reduce((e,t)=>[...e,new _o(t.count,oo(t.VALIDITY)),...io(t.children)],[])}function ao(e,t=[]){for(let n=-1,r=(e||[]).length;++n<r;){let r=e[n];if(r.VALIDITY&&t.push(new J(t.length,r.VALIDITY.length)),r.TYPE_ID&&t.push(new J(t.length,r.TYPE_ID.length)),r.OFFSET&&t.push(new J(t.length,r.OFFSET.length)),r.DATA&&t.push(new J(t.length,r.DATA.length)),r.VIEWS&&t.push(new J(t.length,r.VIEWS.length)),r.VARIADIC_DATA_BUFFERS)for(let e of r.VARIADIC_DATA_BUFFERS)t.push(new J(t.length,e.length));t=ao(r.children,t)}return t}function oo(e){return(e||[]).reduce((e,t)=>e+ +(t===0),0)}function so(e){return(e||[]).reduce((e,t)=>[...e,...t.VARIADIC_DATA_BUFFERS?[t.VARIADIC_DATA_BUFFERS.length]:[],...so(t.children)],[])}function co(e,t){let n,r,i,a,o,s;return!t||!(a=e.dictionary)?(o=fo(e,ro(e,t)),i=new K(e.name,o,e.nullable,lo(e.metadata))):t.has(n=a.id)?(r=(r=a.indexType)?uo(r):new dn,s=new Bn(t.get(n),r,n,a.isOrdered),i=new K(e.name,s,e.nullable,lo(e.metadata))):(r=(r=a.indexType)?uo(r):new dn,t.set(n,o=fo(e,ro(e,t))),s=new Bn(o,r,n,a.isOrdered),i=new K(e.name,s,e.nullable,lo(e.metadata))),i||null}function lo(e=[]){return new Map(e.map(({key:e,value:t})=>[e,t]))}function uo(e){return new O(e.isSigned,e.bitWidth)}function fo(e,t){let n=e.type.name;switch(n){case`NONE`:return new cn;case`null`:return new cn;case`binary`:return new xn;case`largebinary`:return new Sn;case`binaryview`:return new k;case`utf8`:return new Cn;case`largeutf8`:return new Tn;case`utf8view`:return new wn;case`bool`:return new En;case`list`:return new Nn((t||[])[0]);case`largelist`:return new Pn((t||[])[0]);case`struct`:return new A(t||[]);case`struct_`:return new A(t||[])}switch(n){case`int`:{let t=e.type;return new O(t.isSigned,t.bitWidth)}case`floatingpoint`:{let t=e.type;return new _n(g[t.precision])}case`decimal`:{let t=e.type;return new Dn(t.scale,t.precision,t.bitWidth)}case`date`:{let t=e.type;return new On(Pe[t.unit])}case`time`:{let t=e.type;return new kn(_[t.unit],t.bitWidth)}case`timestamp`:{let t=e.type;return new An(_[t.unit],t.timezone)}case`interval`:{let t=e.type;return new jn(v[t.unit])}case`duration`:{let t=e.type;return new Mn(_[t.unit])}case`union`:{let n=e.type,[r,...i]=(n.mode+``).toLowerCase(),a=r.toUpperCase()+i.join(``);return new Fn(h[a],n.typeIds||[],t||[])}case`fixedsizebinary`:{let t=e.type;return new In(t.byteWidth)}case`fixedsizelist`:{let n=e.type;return new Ln(n.listSize,(t||[])[0])}case`map`:{let n=e.type;return new Rn((t||[])[0],n.keysSorted)}}throw Error(`Unrecognized type: "${n}"`)}var po=Ve,mo=Be,ho=class e{static fromJSON(t,n){let r=new e(0,m.V5,n);return r._createHeader=yo(t,n),r}static decode(t){t=new mo(p(t));let n=Za.getRootAsMessage(t),r=n.bodyLength(),i=n.version(),a=n.headerType(),o=No(n),s=new e(r,i,a,void 0,o);return s._createHeader=bo(n,a),s}static encode(e){let t=new po,n=-1;e.isSchema()?n=G.encode(t,e.header()):e.isRecordBatch()?n=q.encode(t,e.header()):e.isDictionaryBatch()&&(n=go.encode(t,e.header()));let r=e.metadata&&e.metadata.size>0?Za.createCustomMetadataVector(t,[...e.metadata].map(([e,n])=>{let r=t.createString(`${e}`),i=t.createString(`${n}`);return b.startKeyValue(t),b.addKey(t,r),b.addValue(t,i),b.endKeyValue(t)})):-1;return Za.startMessage(t),Za.addVersion(t,m.V5),Za.addHeader(t,n),Za.addHeaderType(t,e.headerType),Za.addBodyLength(t,BigInt(e.bodyLength)),r!==-1&&Za.addCustomMetadata(t,r),Za.finishMessageBuffer(t,Za.endMessage(t)),t.asUint8Array()}static from(t,n=0){if(t instanceof G)return new e(0,m.V5,C.Schema,t);if(t instanceof q)return new e(n,m.V5,C.RecordBatch,t,t.metadata);if(t instanceof go)return new e(n,m.V5,C.DictionaryBatch,t);throw Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get compression(){return this._compression}get bodyLength(){return this._bodyLength}get metadata(){return this._metadata}header(){return this._createHeader()}isSchema(){return this.headerType===C.Schema}isRecordBatch(){return this.headerType===C.RecordBatch}isDictionaryBatch(){return this.headerType===C.DictionaryBatch}constructor(e,t,n,r,i){this._version=t,this._headerType=n,this.body=new Uint8Array,this._compression=r?.compression,r&&(this._createHeader=()=>r),this._bodyLength=T(e),this._metadata=i||new Map}},q=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}get compression(){return this._compression}get variadicBufferCounts(){return this._variadicBufferCounts}get metadata(){return this._metadata}constructor(e,t,n,r,i=[],a){this._nodes=t,this._buffers=n,this._length=T(e),this._compression=r,this._variadicBufferCounts=i,this._metadata=a||new Map}},go=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(e,t,n=!1){this._data=e,this._isDelta=n,this._id=T(t)}},J=class{constructor(e,t){this.offset=T(e),this.length=T(t)}},_o=class{constructor(e,t){this.length=T(e),this.nullCount=T(t)}},vo=class{constructor(e,t=He.BUFFER){this.type=e,this.method=t}};function yo(e,t){return(()=>{switch(t){case C.Schema:return G.fromJSON(e);case C.RecordBatch:return q.fromJSON(e);case C.DictionaryBatch:return go.fromJSON(e)}throw Error(`Unrecognized Message type: { name: ${C[t]}, type: ${t} }`)})}function bo(e,t){return(()=>{switch(t){case C.Schema:return G.decode(e.header(new bt),new Map,e.version());case C.RecordBatch:return q.decode(e.header(new y),e.version());case C.DictionaryBatch:return go.decode(e.header(new qe),e.version())}throw Error(`Unrecognized Message type: { name: ${C[t]}, type: ${t} }`)})}K.encode=Ro,K.decode=jo,K.fromJSON=co,G.encode=Lo,G.decode=xo,G.fromJSON=$a,q.encode=zo,q.decode=So,q.fromJSON=eo,go.encode=Vo,go.decode=Co,go.fromJSON=to,_o.encode=Ho,_o.decode=To,J.encode=Uo,J.decode=wo,vo.encode=Bo,vo.decode=Io;function xo(e,t=new Map,n=m.V5){return new G(ko(e,t),Mo(e),t,n)}function So(e,t=m.V5){return new q(e.length(),Eo(e),Do(e,t),Io(e.compression()),Oo(e))}function Co(e,t=m.V5){return new go(q.decode(e.data(),t),e.id(),e.isDelta())}function wo(e){return new J(e.offset(),e.length())}function To(e){return new _o(e.length(),e.nullCount())}function Eo(e){let t=[];for(let n,r=-1,i=-1,a=e.nodesLength();++r<a;)(n=e.nodes(r))&&(t[++i]=_o.decode(n));return t}function Do(e,t){let n=[];for(let r,i=-1,a=-1,o=e.buffersLength();++i<o;)(r=e.buffers(i))&&(t<m.V4&&(r.bb_pos+=8*(i+1)),n[++a]=J.decode(r));return n}function Oo(e){let t=[],n=Math.trunc(e.variadicBufferCountsLength());for(let r=0;r<n;++r)t.push(T(e.variadicBufferCounts(r)));return t}function ko(e,t){let n=[];for(let r,i=-1,a=-1,o=e.fieldsLength();++i<o;)(r=e.fields(i))&&(n[++a]=K.decode(r,t));return n}function Ao(e,t){let n=[];for(let r,i=-1,a=-1,o=e.childrenLength();++i<o;)(r=e.children(i))&&(n[++a]=K.decode(r,t));return n}function jo(e,t){let n,r,i,a,o,s;return!t||!(s=e.dictionary())?(i=Fo(e,Ao(e,t)),r=new K(e.name(),i,e.nullable(),Mo(e))):t.has(n=T(s.id()))?(a=(a=s.indexType())?Po(a):new dn,o=new Bn(t.get(n),a,n,s.isOrdered()),r=new K(e.name(),o,e.nullable(),Mo(e))):(a=(a=s.indexType())?Po(a):new dn,t.set(n,i=Fo(e,Ao(e,t))),o=new Bn(i,a,n,s.isOrdered()),r=new K(e.name(),o,e.nullable(),Mo(e))),r||null}function Mo(e){let t=new Map;if(e)for(let n,r,i=-1,a=Math.trunc(e.customMetadataLength());++i<a;)(n=e.customMetadata(i))&&(r=n.key())!=null&&t.set(r,n.value());return t}function No(e){let t=new Map;for(let n,r,i=-1,a=Math.trunc(e.customMetadataLength());++i<a;)(n=e.customMetadata(i))&&(r=n.key())!=null&&t.set(r,n.value());return t}function Po(e){return new O(e.isSigned(),e.bitWidth())}function Fo(e,t){let n=e.typeType();switch(n){case x.NONE:return new cn;case x.Null:return new cn;case x.Binary:return new xn;case x.LargeBinary:return new Sn;case x.BinaryView:return new k;case x.Utf8:return new Cn;case x.LargeUtf8:return new Tn;case x.Utf8View:return new wn;case x.Bool:return new En;case x.List:return new Nn((t||[])[0]);case x.LargeList:return new Pn((t||[])[0]);case x.Struct_:return new A(t||[])}switch(n){case x.Int:{let t=e.type(new Xe);return new O(t.isSigned(),t.bitWidth())}case x.FloatingPoint:return new _n(e.type(new ot).precision());case x.Decimal:{let t=e.type(new nt);return new Dn(t.scale(),t.precision(),t.bitWidth())}case x.Date:return new On(e.type(new tt).unit());case x.Time:{let t=e.type(new ht);return new kn(t.unit(),t.bitWidth())}case x.Timestamp:{let t=e.type(new gt);return new An(t.unit(),t.timezone())}case x.Interval:return new jn(e.type(new st).unit());case x.Duration:return new Mn(e.type(new rt).unit());case x.Union:{let n=e.type(new _t);return new Fn(n.mode(),n.typeIdsArray()||[],t||[])}case x.FixedSizeBinary:return new In(e.type(new it).byteWidth());case x.FixedSizeList:return new Ln(e.type(new at).listSize(),(t||[])[0]);case x.Map:{let n=e.type(new ft);return new Rn((t||[])[0],n.keysSorted())}}throw Error(`Unrecognized type: "${x[n]}" (${n})`)}function Io(e){return e?new vo(e.codec(),e.method()):null}function Lo(e,t){let n=t.fields.map(t=>K.encode(e,t));bt.startFieldsVector(e,n.length);let r=bt.createFieldsVector(e,n),i=t.metadata&&t.metadata.size>0?bt.createCustomMetadataVector(e,[...t.metadata].map(([t,n])=>{let r=e.createString(`${t}`),i=e.createString(`${n}`);return b.startKeyValue(e),b.addKey(e,r),b.addValue(e,i),b.endKeyValue(e)})):-1;return bt.startSchema(e),bt.addFields(e,r),bt.addEndianness(e,Wo?Je.Little:Je.Big),i!==-1&&bt.addCustomMetadata(e,i),bt.endSchema(e)}function Ro(e,t){let n=-1,r=-1,i=-1,a=t.type,o=t.typeId;D.isDictionary(a)?(o=a.dictionary.typeId,i=Qa.visit(a,e),r=Qa.visit(a.dictionary,e)):r=Qa.visit(a,e);let s=(a.children||[]).map(t=>K.encode(e,t)),c=S.createChildrenVector(e,s),l=t.metadata&&t.metadata.size>0?S.createCustomMetadataVector(e,[...t.metadata].map(([t,n])=>{let r=e.createString(`${t}`),i=e.createString(`${n}`);return b.startKeyValue(e),b.addKey(e,r),b.addValue(e,i),b.endKeyValue(e)})):-1;return t.name&&(n=e.createString(t.name)),S.startField(e),S.addType(e,r),S.addTypeType(e,o),S.addChildren(e,c),S.addNullable(e,!!t.nullable),n!==-1&&S.addName(e,n),i!==-1&&S.addDictionary(e,i),l!==-1&&S.addCustomMetadata(e,l),S.endField(e)}function zo(e,t){let n=t.nodes||[],r=t.buffers||[],i=t.variadicBufferCounts||[];y.startNodesVector(e,n.length);for(let t of n.slice().reverse())_o.encode(e,t);let a=e.endVector();y.startBuffersVector(e,r.length);for(let t of r.slice().reverse())J.encode(e,t);let o=e.endVector(),s=null;t.compression!==null&&(s=Bo(e,t.compression));let c=-1;return i.length>0&&(c=y.createVariadicBufferCountsVector(e,i.map(BigInt))),y.startRecordBatch(e),y.addLength(e,BigInt(t.length)),y.addNodes(e,a),y.addBuffers(e,o),t.compression!==null&&s&&y.addCompression(e,s),c!==-1&&y.addVariadicBufferCounts(e,c),y.endRecordBatch(e)}function Bo(e,t){return We.startBodyCompression(e),We.addCodec(e,t.type),We.addMethod(e,t.method),We.endBodyCompression(e)}function Vo(e,t){let n=q.encode(e,t.data);return qe.startDictionaryBatch(e),qe.addId(e,BigInt(t.id)),qe.addIsDelta(e,t.isDelta),qe.addData(e,n),qe.endDictionaryBatch(e)}function Ho(e,t){return Ke.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function Uo(e,t){return Ge.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var Wo=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})(),Y=Object.freeze({done:!0,value:void 0}),Go=class{constructor(e){this._json=e}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Ko=class{tee(){return this._getDOMStream().tee()}pipe(e,t){return this._getNodeStream().pipe(e,t)}pipeTo(e,t){return this._getDOMStream().pipeTo(e,t)}pipeThrough(e,t){return this._getDOMStream().pipeThrough(e,t)}_getDOMStream(){return this._DOMStream||=this.toDOMStream()}_getNodeStream(){return this._nodeStream||=this.toNodeStream()}},qo=class extends Ko{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}get closed(){return this._closedPromise}cancel(e){return t(this,void 0,void 0,function*(){yield this.return(e)})}write(e){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(e):this.resolvers.shift().resolve({done:!1,value:e}))}abort(e){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:e}:this.resolvers.shift().reject({done:!0,value:e}))}close(){if(this._closedPromiseResolve){let{resolvers:e}=this;for(;e.length>0;)e.shift().resolve(Y);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(e){return Ee.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,e)}toNodeStream(e){return Ee.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,e)}throw(e){return t(this,void 0,void 0,function*(){return yield this.abort(e),Y})}return(e){return t(this,void 0,void 0,function*(){return yield this.close(),Y})}read(e){return t(this,void 0,void 0,function*(){return(yield this.next(e,`read`)).value})}peek(e){return t(this,void 0,void 0,function*(){return(yield this.next(e,`peek`)).value})}next(...e){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,t)=>{this.resolvers.push({resolve:e,reject:t})}):Promise.resolve(Y)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw Error(`AsyncQueue is closed`)}},Jo=class extends qo{write(e){if((e=p(e)).byteLength>0)return super.write(e)}toString(e=!1){return e?c(this.toUint8Array(!0)):this.toUint8Array(!1).then(c)}toUint8Array(e=!1){return e?_e(this._values)[0]:t(this,void 0,void 0,function*(){var e,t,n,r;let i=[],a=0;try{for(var s=!0,c=o(this),l;l=yield c.next(),e=l.done,!e;s=!0){r=l.value,s=!1;let e=r;i.push(e),a+=e.byteLength}}catch(e){t={error:e}}finally{try{!s&&!e&&(n=c.return)&&(yield n.call(c))}finally{if(t)throw t.error}}return _e(i,a)[0]})}},Yo=class{constructor(e){e&&(this.source=new Zo(Ee.fromIterable(e)))}[Symbol.iterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}},Xo=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof Jo?this.source=new Qo(Ee.fromAsyncIterable(t)):fe(t)?this.source=new Qo(Ee.fromNodeStream(t)):de(t)?this.source=new Qo(Ee.fromDOMStream(t)):le(t)?this.source=new Qo(Ee.fromDOMStream(t.body)):ie(t)?this.source=new Qo(Ee.fromIterable(t)):(re(t)||ae(t))&&(this.source=new Qo(Ee.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}get closed(){return this.source.closed}cancel(e){return this.source.cancel(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}},Zo=class{constructor(e){this.source=e}cancel(e){this.return(e)}peek(e){return this.next(e,`peek`).value}read(e){return this.next(e,`read`).value}next(e,t=`read`){return this.source.next({cmd:t,size:e})}throw(e){return Object.create(this.source.throw&&this.source.throw(e)||Y)}return(e){return Object.create(this.source.return&&this.source.return(e)||Y)}},Qo=class{constructor(e){this.source=e,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(e){return t(this,void 0,void 0,function*(){yield this.return(e)})}get closed(){return this._closedPromise}read(e){return t(this,void 0,void 0,function*(){return(yield this.next(e,`read`)).value})}peek(e){return t(this,void 0,void 0,function*(){return(yield this.next(e,`peek`)).value})}next(e){return t(this,arguments,void 0,function*(e,t=`read`){return yield this.source.next({cmd:t,size:e})})}throw(e){return t(this,void 0,void 0,function*(){let t=this.source.throw&&(yield this.source.throw(e))||Y;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(t)})}return(e){return t(this,void 0,void 0,function*(){let t=this.source.return&&(yield this.source.return(e))||Y;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(t)})}},$o=class extends Yo{constructor(e,t){super(),this.position=0,this.buffer=p(e),this.size=t===void 0?this.buffer.byteLength:t}readInt32(e){let{buffer:t,byteOffset:n}=this.readAt(e,4);return new DataView(t,n).getInt32(0,!0)}seek(e){return this.position=Math.min(e,this.size),e<this.size}read(e){let{buffer:t,size:n,position:r}=this;return t&&r<n?(typeof e!=`number`&&(e=1/0),this.position=Math.min(n,r+Math.min(n-r,e)),t.subarray(r,this.position)):null}readAt(e,t){let n=this.buffer,r=Math.min(this.size,e+t);return n?n.subarray(e,r):new Uint8Array(t)}close(){this.buffer&&=null}throw(e){return this.close(),{done:!0,value:e}}return(e){return this.close(),{done:!0,value:e}}},es=class extends Xo{constructor(e,n){super(),this.position=0,this._handle=e,typeof n==`number`?this.size=n:this._pending=t(this,void 0,void 0,function*(){this.size=(yield e.stat()).size,delete this._pending})}readInt32(e){return t(this,void 0,void 0,function*(){let{buffer:t,byteOffset:n}=yield this.readAt(e,4);return new DataView(t,n).getInt32(0,!0)})}seek(e){return t(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(e,this.size),e<this.size})}read(e){return t(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:t,size:n,position:r}=this;if(t&&r<n){typeof e!=`number`&&(e=1/0);let i=r,a=0,o=0,s=Math.min(n,i+Math.min(n-i,e)),c=new Uint8Array(Math.max(0,(this.position=s)-i));for(;(i+=o)<s&&(a+=o)<c.byteLength;)({bytesRead:o}=yield t.read(c,a,c.byteLength-a,i));return c}return null})}readAt(e,n){return t(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:t,size:r}=this;if(t&&e+n<r){let i=Math.min(r,e+n),a=new Uint8Array(i-e);return(yield t.read(a,0,n,e)).buffer}return new Uint8Array(n)})}close(){return t(this,void 0,void 0,function*(){let e=this._handle;this._handle=null,e&&(yield e.close())})}throw(e){return t(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:e}})}return(e){return t(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:e}})}},ts=65536;function ns(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var rs=8,is=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],as=class{constructor(e){this.buffer=e}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(e){let t=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([e.buffer[1]>>>16,e.buffer[1]&65535,e.buffer[0]>>>16,e.buffer[0]&65535]),r=t[3]*n[3];this.buffer[0]=r&65535;let i=r>>>16;return r=t[2]*n[3],i+=r,r=t[3]*n[2]>>>0,i+=r,this.buffer[0]+=i<<16,this.buffer[1]=i>>>0<r?ts:0,this.buffer[1]+=i>>>16,this.buffer[1]+=t[1]*n[3]+t[2]*n[2]+t[3]*n[1],this.buffer[1]+=t[0]*n[3]+t[1]*n[2]+t[2]*n[1]+t[3]*n[0]<<16,this}_plus(e){let t=this.buffer[0]+e.buffer[0]>>>0;this.buffer[1]+=e.buffer[1],t<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=t}lessThan(e){return this.buffer[1]<e.buffer[1]||this.buffer[1]===e.buffer[1]&&this.buffer[0]<e.buffer[0]}equals(e){return this.buffer[1]===e.buffer[1]&&this.buffer[0]==e.buffer[0]}greaterThan(e){return e.lessThan(this)}hex(){return`${ns(this.buffer[1])} ${ns(this.buffer[0])}`}},X=class e extends as{times(e){return this._times(e),this}plus(e){return this._plus(e),this}static from(t,n=new Uint32Array(2)){return e.fromString(typeof t==`string`?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){let r=t.length,i=new e(n);for(let n=0;n<r;){let a=rs<r-n?rs:r-n,o=new e(new Uint32Array([Number.parseInt(t.slice(n,n+a),10),0])),s=new e(new Uint32Array([is[a],0]));i.times(s),i.plus(o),n+=a}return i}static convertArray(t){let n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}},os=class e extends as{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(e){return this._times(e),this}plus(e){return this._plus(e),this}lessThan(e){let t=this.buffer[1]<<0,n=e.buffer[1]<<0;return t<n||t===n&&this.buffer[0]<e.buffer[0]}static from(t,n=new Uint32Array(2)){return e.fromString(typeof t==`string`?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){let r=t.startsWith(`-`),i=t.length,a=new e(n);for(let n=+!!r;n<i;){let r=rs<i-n?rs:i-n,o=new e(new Uint32Array([Number.parseInt(t.slice(n,n+r),10),0])),s=new e(new Uint32Array([is[r],0]));a.times(s),a.plus(o),n+=r}return r?a.negate():a}static convertArray(t){let n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}},ss=class e{constructor(e){this.buffer=e}high(){return new os(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new os(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(e){let t=new X(new Uint32Array([this.buffer[3],0])),n=new X(new Uint32Array([this.buffer[2],0])),r=new X(new Uint32Array([this.buffer[1],0])),i=new X(new Uint32Array([this.buffer[0],0])),a=new X(new Uint32Array([e.buffer[3],0])),o=new X(new Uint32Array([e.buffer[2],0])),s=new X(new Uint32Array([e.buffer[1],0])),c=new X(new Uint32Array([e.buffer[0],0])),l=X.multiply(i,c);this.buffer[0]=l.low();let u=new X(new Uint32Array([l.high(),0]));return l=X.multiply(r,c),u.plus(l),l=X.multiply(i,s),u.plus(l),this.buffer[1]=u.low(),this.buffer[3]=+!!u.lessThan(l),this.buffer[2]=u.high(),new X(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(X.multiply(n,c)).plus(X.multiply(r,s)).plus(X.multiply(i,o)),this.buffer[3]+=X.multiply(t,c).plus(X.multiply(n,s)).plus(X.multiply(r,o)).plus(X.multiply(i,a)).low(),this}plus(e){let t=new Uint32Array(4);return t[3]=this.buffer[3]+e.buffer[3]>>>0,t[2]=this.buffer[2]+e.buffer[2]>>>0,t[1]=this.buffer[1]+e.buffer[1]>>>0,t[0]=this.buffer[0]+e.buffer[0]>>>0,t[0]<this.buffer[0]>>>0&&++t[1],t[1]<this.buffer[1]>>>0&&++t[2],t[2]<this.buffer[2]>>>0&&++t[3],this.buffer[3]=t[3],this.buffer[2]=t[2],this.buffer[1]=t[1],this.buffer[0]=t[0],this}hex(){return`${ns(this.buffer[3])} ${ns(this.buffer[2])} ${ns(this.buffer[1])} ${ns(this.buffer[0])}`}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}static from(t,n=new Uint32Array(4)){return e.fromString(typeof t==`string`?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(4)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(4)){let r=t.startsWith(`-`),i=t.length,a=new e(n);for(let n=+!!r;n<i;){let r=rs<i-n?rs:i-n,o=new e(new Uint32Array([Number.parseInt(t.slice(n,n+r),10),0,0,0])),s=new e(new Uint32Array([is[r],0,0,0]));a.times(s),a.plus(o),n+=r}return r?a.negate():a}static convertArray(t){let n=new Uint32Array(t.length*4);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+16*r,4));return n}};function cs(e){let t=e.length,n=new Int32Array(t*2);for(let r=0,i=0;r<t;r++){let t=e[r];n[i++]=t.days??0,n[i++]=t.milliseconds??0}return n}function ls(e){let t=e.length,n=new Int32Array(t*4);for(let r=0,i=0;r<t;r++){let t=e[r];n[i++]=t.months??0,n[i++]=t.days??0;let a=t.nanoseconds;if(a){let e=BigInt(a);n[i++]=Number(e&BigInt(4294967295))>>>0,n[i++]=Number(e>>BigInt(32))>>>0}else i+=2}return n}var us=class extends j{constructor(e,t,n,r,i=m.V5,a=[]){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.variadicBufferIndex=-1,this.bytes=e,this.nodes=t,this.buffers=n,this.dictionaries=r,this.metadataVersion=i,this.variadicBufferCounts=a}visit(e){return super.visit(e instanceof K?e.type:e)}visitNull(e,{length:t}=this.nextFieldNode()){return z({type:e,length:t})}visitBool(e,{length:t,nullCount:n}=this.nextFieldNode()){return z({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitInt(e,{length:t,nullCount:n}=this.nextFieldNode()){return z({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitFloat(e,{length:t,nullCount:n}=this.nextFieldNode()){return z({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitUtf8(e,{length:t,nullCount:n}=this.nextFieldNode()){return z({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitLargeUtf8(e,{length:t,nullCount:n}=this.nextFieldNode()){return z({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitUtf8View(e,{length:t,nullCount:n}=this.nextFieldNode()){return z({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),views:this.readData(e),variadicBuffers:this.readVariadicBuffers(this.nextVariadicBufferCount())})}visitBinary(e,{length:t,nullCount:n}=this.nextFieldNode()){return z({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitLargeBinary(e,{length:t,nullCount:n}=this.nextFieldNode()){return z({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitBinaryView(e,{length:t,nullCount:n}=this.nextFieldNode()){return z({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),views:this.readData(e),variadicBuffers:this.readVariadicBuffers(this.nextVariadicBufferCount())})}visitFixedSizeBinary(e,{length:t,nullCount:n}=this.nextFieldNode()){return z({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitDate(e,{length:t,nullCount:n}=this.nextFieldNode()){return z({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitTimestamp(e,{length:t,nullCount:n}=this.nextFieldNode()){return z({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitTime(e,{length:t,nullCount:n}=this.nextFieldNode()){return z({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitDecimal(e,{length:t,nullCount:n}=this.nextFieldNode()){return z({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitList(e,{length:t,nullCount:n}=this.nextFieldNode()){return z({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}visitLargeList(e,{length:t,nullCount:n}=this.nextFieldNode()){return z({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}visitStruct(e,{length:t,nullCount:n}=this.nextFieldNode()){return z({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),children:this.visitMany(e.children)})}visitUnion(e,{length:t,nullCount:n}=this.nextFieldNode()){return this.metadataVersion<m.V5&&this.readNullBitmap(e,n),e.mode===h.Sparse?this.visitSparseUnion(e,{length:t,nullCount:n}):this.visitDenseUnion(e,{length:t,nullCount:n})}visitDenseUnion(e,{length:t,nullCount:n}=this.nextFieldNode()){return z({type:e,length:t,nullCount:n,typeIds:this.readTypeIds(e),valueOffsets:this.readOffsets(e),children:this.visitMany(e.children)})}visitSparseUnion(e,{length:t,nullCount:n}=this.nextFieldNode()){return z({type:e,length:t,nullCount:n,typeIds:this.readTypeIds(e),children:this.visitMany(e.children)})}visitDictionary(e,{length:t,nullCount:n}=this.nextFieldNode()){return z({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e.indices),dictionary:this.readDictionary(e)})}visitInterval(e,{length:t,nullCount:n}=this.nextFieldNode()){return z({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitDuration(e,{length:t,nullCount:n}=this.nextFieldNode()){return z({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitFixedSizeList(e,{length:t,nullCount:n}=this.nextFieldNode()){return z({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),child:this.visit(e.children[0])})}visitMap(e,{length:t,nullCount:n}=this.nextFieldNode()){return z({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(e,t,n=this.nextBufferRange()){return t>0&&this.readData(e,n)||new Uint8Array}readOffsets(e,t){return this.readData(e,t)}readTypeIds(e,t){return this.readData(e,t)}readData(e,{length:t,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+t)}readVariadicBuffers(e){return Array.from({length:e},()=>this.readData(null))}nextVariadicBufferCount(){return this.variadicBufferCounts[++this.variadicBufferIndex]??0}readDictionary(e){return this.dictionaries.get(e.id)}},ds=class extends us{constructor(e,t,n,r,i,a=[]){super(new Uint8Array,t,n,r,i,a),this.sources=e}readNullBitmap(e,t,{offset:n}=this.nextBufferRange()){return t<=0?new Uint8Array:fa(this.sources[n])}readOffsets(e,{offset:t}=this.nextBufferRange()){return f(Uint8Array,f(e.OffsetArrayType,this.sources[t]))}readTypeIds(e,{offset:t}=this.nextBufferRange()){return f(Uint8Array,f(e.ArrayType,this.sources[t]))}readData(e,{offset:t}=this.nextBufferRange()){let{sources:n}=this;if(D.isTimestamp(e)||(D.isInt(e)||D.isTime(e))&&e.bitWidth===64||D.isDuration(e)||D.isDate(e)&&e.unit===Pe.MILLISECOND)return f(Uint8Array,os.convertArray(n[t]));if(D.isDecimal(e))return f(Uint8Array,ss.convertArray(n[t]));if(D.isBinary(e)||D.isLargeBinary(e)||D.isFixedSizeBinary(e))return ps(n[t]);if(D.isBinaryView(e))return hs(n[t]);if(D.isUtf8View(e))return gs(n[t]);if(D.isBool(e))return fa(n[t]);if(D.isUtf8(e)||D.isLargeUtf8(e))return u(n[t].join(``));if(D.isInterval(e))switch(e.unit){case v.DAY_TIME:return cs(n[t]);case v.MONTH_DAY_NANO:return ls(n[t])}return f(Uint8Array,f(e.ArrayType,n[t].map(e=>+e)))}readVariadicBuffers(e){let t=[];for(let n=0;n<e;n++){let{offset:e}=this.nextBufferRange(),n=this.sources[e];t.push(fs(n))}return t}};function fs(e){let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)t[n>>1]=Number.parseInt(e.slice(n,n+2),16);return t}function ps(e){return fs(e.join(``))}function ms(e,t){let n=new Uint8Array(e.length*16),r=new DataView(n.buffer);for(let[i,a]of e.entries()){let e=i*16,o=a.SIZE;if(r.setInt32(e,o,!0),a.INLINED!==void 0){let r=t(a.INLINED);for(let t=0;t<r.length&&t<12;t++)n[e+4+t]=r[t]}else{let t=a.PREFIX_HEX;for(let r=0;r<8&&r<t.length;r+=2)n[e+4+(r>>1)]=Number.parseInt(t.slice(r,r+2),16);r.setInt32(e+8,a.BUFFER_INDEX,!0),r.setInt32(e+12,a.OFFSET,!0)}}return n}function hs(e){return ms(e,e=>{let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)t[n>>1]=Number.parseInt(e.slice(n,n+2),16);return t})}function gs(e){return ms(e,e=>new TextEncoder().encode(e))}var _s=class extends us{constructor(e,t,n,r,i,a=[]){super(new Uint8Array,t,n,r,i,a),this.bodyChunks=e}readData(e,t=this.nextBufferRange()){return this.bodyChunks[this.buffersIndex]}},Z=class extends j{compareSchemas(e,t){return e===t||t instanceof e.constructor&&this.compareManyFields(e.fields,t.fields)}compareManyFields(e,t){return e===t||Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((e,n)=>this.compareFields(e,t[n]))}compareFields(e,t){return e===t||t instanceof e.constructor&&e.name===t.name&&e.nullable===t.nullable&&this.visit(e.type,t.type)}};function Q(e,t){return t instanceof e.constructor}function vs(e,t){return e===t||Q(e,t)}function ys(e,t){return e===t||Q(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function bs(e,t){return e===t||Q(e,t)&&e.precision===t.precision}function xs(e,t){return e===t||Q(e,t)&&e.byteWidth===t.byteWidth}function Ss(e,t){return e===t||Q(e,t)&&e.unit===t.unit}function Cs(e,t){return e===t||Q(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function ws(e,t){return e===t||Q(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function Ts(e,t){return e===t||Q(e,t)&&e.children.length===t.children.length&&Ns.compareManyFields(e.children,t.children)}function Es(e,t){return e===t||Q(e,t)&&e.children.length===t.children.length&&Ns.compareManyFields(e.children,t.children)}function Ds(e,t){return e===t||Q(e,t)&&e.mode===t.mode&&e.typeIds.every((e,n)=>e===t.typeIds[n])&&Ns.compareManyFields(e.children,t.children)}function Os(e,t){return e===t||Q(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&Ns.visit(e.indices,t.indices)&&Ns.visit(e.dictionary,t.dictionary)}function ks(e,t){return e===t||Q(e,t)&&e.unit===t.unit}function As(e,t){return e===t||Q(e,t)&&e.unit===t.unit}function js(e,t){return e===t||Q(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&Ns.compareManyFields(e.children,t.children)}function Ms(e,t){return e===t||Q(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&Ns.compareManyFields(e.children,t.children)}Z.prototype.visitNull=vs,Z.prototype.visitBool=vs,Z.prototype.visitInt=ys,Z.prototype.visitInt8=ys,Z.prototype.visitInt16=ys,Z.prototype.visitInt32=ys,Z.prototype.visitInt64=ys,Z.prototype.visitUint8=ys,Z.prototype.visitUint16=ys,Z.prototype.visitUint32=ys,Z.prototype.visitUint64=ys,Z.prototype.visitFloat=bs,Z.prototype.visitFloat16=bs,Z.prototype.visitFloat32=bs,Z.prototype.visitFloat64=bs,Z.prototype.visitUtf8=vs,Z.prototype.visitLargeUtf8=vs,Z.prototype.visitUtf8View=vs,Z.prototype.visitBinary=vs,Z.prototype.visitLargeBinary=vs,Z.prototype.visitBinaryView=vs,Z.prototype.visitFixedSizeBinary=xs,Z.prototype.visitDate=Ss,Z.prototype.visitDateDay=Ss,Z.prototype.visitDateMillisecond=Ss,Z.prototype.visitTimestamp=Cs,Z.prototype.visitTimestampSecond=Cs,Z.prototype.visitTimestampMillisecond=Cs,Z.prototype.visitTimestampMicrosecond=Cs,Z.prototype.visitTimestampNanosecond=Cs,Z.prototype.visitTime=ws,Z.prototype.visitTimeSecond=ws,Z.prototype.visitTimeMillisecond=ws,Z.prototype.visitTimeMicrosecond=ws,Z.prototype.visitTimeNanosecond=ws,Z.prototype.visitDecimal=vs,Z.prototype.visitList=Ts,Z.prototype.visitLargeList=Ts,Z.prototype.visitStruct=Es,Z.prototype.visitUnion=Ds,Z.prototype.visitDenseUnion=Ds,Z.prototype.visitSparseUnion=Ds,Z.prototype.visitDictionary=Os,Z.prototype.visitInterval=ks,Z.prototype.visitIntervalDayTime=ks,Z.prototype.visitIntervalYearMonth=ks,Z.prototype.visitIntervalMonthDayNano=ks,Z.prototype.visitDuration=As,Z.prototype.visitDurationSecond=As,Z.prototype.visitDurationMillisecond=As,Z.prototype.visitDurationMicrosecond=As,Z.prototype.visitDurationNanosecond=As,Z.prototype.visitFixedSizeList=js,Z.prototype.visitMap=Ms;var Ns=new Z;function Ps(e,t){return Ns.compareSchemas(e,t)}function Fs(e,t){return Is(e,t.map(e=>e.data.concat()))}function Is(e,t){let n=[...e.fields],r=[],i={numBatches:t.reduce((e,t)=>Math.max(e,t.length),0)},a=0,o=0,s=-1,c=t.length,l,u=[];for(;i.numBatches-->0;){for(o=1/0,s=-1;++s<c;)u[s]=l=t[s].shift(),o=Math.min(o,l?l.length:o);Number.isFinite(o)&&(u=Ls(n,o,u,t,i),o>0&&(r[a++]=z({type:new A(n),length:o,nullCount:0,children:u.slice()})))}return[e=e.assign(n),r.map(t=>new $(e,t))]}function Ls(e,t,n,r,i){let a=(t+63&-64)>>3;for(let o=-1,s=r.length;++o<s;){let s=n[o],c=s?.length;if(c>=t)c===t?n[o]=s:(n[o]=s.slice(0,t),i.numBatches=Math.max(i.numBatches,r[o].unshift(s.slice(t,c-t))));else{let r=e[o];e[o]=r.clone({nullable:!0}),n[o]=s?._changeLengthAndBackfillNullBitmap(t)??z({type:r.type,length:t,nullCount:t,nullBitmap:new Uint8Array(a)})}}return n}var Rs,zs=Symbol.for(`apache-arrow/Table`),Bs=class e{static isTable(e){return e?.[zs]===!0}constructor(...t){if(t.length===0)return this.batches=[],this.schema=new G([]),this._offsets=[0],this;let n,r;t[0]instanceof G&&(n=t.shift()),t.at(-1)instanceof Uint32Array&&(r=t.pop());let i=t=>{if(t){if(t instanceof $)return[t];if(t instanceof e)return t.batches;if(t instanceof R){if(t.type instanceof A)return[new $(new G(t.type.children),t)]}else if(Array.isArray(t))return t.flatMap(e=>i(e));else if(typeof t[Symbol.iterator]==`function`)return[...t].flatMap(e=>i(e));else if(typeof t==`object`){let e=Object.keys(t),r=e.map(e=>new W([t[e]])),[,i]=Fs(n??new G(e.map((e,t)=>new K(String(e),r[t].type,r[t].nullable))),r);return i.length===0?[new $(t)]:i}}return[]},a=t.flatMap(e=>i(e));if(n=n??a[0]?.schema??new G([]),!(n instanceof G))throw TypeError(`Table constructor expects a [Schema, RecordBatch[]] pair.`);for(let e of a){if(!(e instanceof $))throw TypeError(`Table constructor expects a [Schema, RecordBatch[]] pair.`);if(!Ps(n,e.schema))throw TypeError(`Table and inner RecordBatch schemas must be equivalent.`)}this.schema=n,this.batches=a,this._offsets=r??Sa(this.data)}get data(){return this.batches.map(({data:e})=>e)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((e,t)=>e+t.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=xa(this.data)),this._nullCount}isValid(e){return!1}get(e){return null}at(e){return this.get(Qi(e,this.numRows))}set(e,t){}indexOf(e,t){return-1}[Symbol.iterator](){return this.batches.length>0?Pa.visit(new W(this.data)):[][Symbol.iterator]()}toArray(){return[...this]}toString(){return`[\n ${this.toArray().join(`,
2
+ `)}\n]`}concat(...t){let n=this.schema,r=this.data.concat(t.flatMap(({data:e})=>e));return new e(n,r.map(e=>new $(n,e)))}slice(t,n){let r=this.schema;[t,n]=Zi({length:this.numRows},t,n);let i=Ca(this.data,this._offsets,t,n);return new e(r,i.map(e=>new $(r,e)))}getChild(e){return this.getChildAt(this.schema.fields.findIndex(t=>t.name===e))}getChildAt(e){if(e>-1&&e<this.schema.fields.length){let t=this.data.map(t=>t.children[e]);if(t.length===0){let{type:n}=this.schema.fields[e],r=z({type:n,length:0,nullCount:0});t.push(r._changeLengthAndBackfillNullBitmap(this.numRows))}return new W(t)}return null}setChild(e,t){return this.setChildAt(this.schema.fields?.findIndex(t=>t.name===e),t)}setChildAt(t,n){let r=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){n||=new W([z({type:new cn,length:this.numRows})]);let e=r.fields.slice(),a=e[t].clone({type:n.type}),o=this.schema.fields.map((e,t)=>this.getChildAt(t));[e[t],o[t]]=[a,n],[r,i]=Fs(r,o)}return new e(r,i)}select(e){let t=this.schema.fields.reduce((e,t,n)=>e.set(t.name,n),new Map);return this.selectAt(e.map(e=>t.get(e)).filter(e=>e>-1))}selectAt(t){let n=this.schema.selectAt(t),r=this.batches.map(e=>e.selectAt(t));return new e(n,r)}assign(t){let n=this.schema.fields,[r,i]=t.schema.fields.reduce((e,t,r)=>{let[i,a]=e,o=n.findIndex(e=>e.name===t.name);return~o?a[o]=r:i.push(r),e},[[],[]]),a=this.schema.assign(t.schema),o=[...n.map((e,t)=>[t,i[t]]).map(([e,n])=>n===void 0?this.getChildAt(e):t.getChildAt(n)),...r.map(e=>t.getChildAt(e))].filter(Boolean);return new e(...Fs(a,o))}};Rs=Symbol.toStringTag,Bs[Rs]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e[zs]=!0,e.isValid=Ea(Ta),e.get=Ea(L.getVisitFn(w.Struct)),e.set=Da(P.getVisitFn(w.Struct)),e.indexOf=Oa(Ma.getVisitFn(w.Struct)),`Table`))(Bs.prototype),Object.defineProperty(Bs,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===Bs&&Bs.isTable(e)}});var Vs,Hs=Symbol.for(`apache-arrow/RecordBatch`),$=class e{static isRecordBatch(e){return e?.[Hs]===!0}constructor(...e){switch(e.length){case 3:case 2:if([this.schema]=e,!(this.schema instanceof G)||([,this.data=z({nullCount:0,type:new A(this.schema.fields),children:this.schema.fields.map(e=>z({type:e.type,nullCount:0}))}),this._metadata=new Map]=e,!(this.data instanceof R)))throw TypeError(`RecordBatch constructor expects a [Schema, Data] pair.`);[this.schema,this.data]=Us(this.schema,this.data.children,this.data.length);break;case 1:{let[t]=e,{fields:n,children:r,length:i}=Object.keys(t).reduce((e,n,r)=>(e.children[r]=t[n],e.length=Math.max(e.length,t[n].length),e.fields[r]=K.new({name:n,type:t[n].type,nullable:!0}),e),{length:0,fields:[],children:[]}),a=new G(n),o=z({type:new A(n),length:i,children:r,nullCount:0});[this.schema,this.data]=Us(a,o.children,i),this._metadata=new Map;break}default:throw TypeError(`RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.`)}}get metadata(){return this._metadata}get dictionaries(){return this._dictionaries||=Ws(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(e){return this.data.getValid(e)}get(e){return L.visit(this.data,e)}at(e){return this.get(Qi(e,this.numRows))}set(e,t){return P.visit(this.data,e,t)}indexOf(e,t){return Ma.visit(this.data,e,t)}[Symbol.iterator](){return Pa.visit(new W([this.data]))}toArray(){return[...this]}concat(...e){return new Bs(this.schema,[this,...e])}slice(t,n){let[r]=new W([this.data]).slice(t,n).data;return new e(this.schema,r,this._metadata)}getChild(e){return this.getChildAt(this.schema.fields?.findIndex(t=>t.name===e))}getChildAt(e){return e>-1&&e<this.schema.fields.length?new W([this.data.children[e]]):null}setChild(e,t){return this.setChildAt(this.schema.fields?.findIndex(t=>t.name===e),t)}setChildAt(t,n){let r=this.schema,i=this.data;if(t>-1&&t<this.numCols){n||=new W([z({type:new cn,length:this.numRows})]);let e=r.fields.slice(),a=i.children.slice(),o=e[t].clone({type:n.type});[e[t],a[t]]=[o,n.data[0]],r=new G(e,new Map(this.schema.metadata)),i=z({type:new A(e),length:i.length,children:a})}return new e(r,i,this._metadata)}select(t){let n=this.schema.select(t),r=new A(n.fields),i=[];for(let e of t){let t=this.schema.fields.findIndex(t=>t.name===e);~t&&(i[t]=this.data.children[t])}return new e(n,z({type:r,length:this.numRows,children:i}),this._metadata)}selectAt(t){let n=this.schema.selectAt(t),r=t.map(e=>this.data.children[e]).filter(Boolean),i=z({type:new A(n.fields),length:this.numRows,children:r});return new e(n,i,this._metadata)}};Vs=Symbol.toStringTag,$[Vs]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e[Hs]=!0,`RecordBatch`))($.prototype),Object.defineProperty($,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===$&&$.isRecordBatch(e)}});function Us(e,t,n=t.reduce((e,t)=>Math.max(e,t.length),0)){let r=[...e.fields],i=[...t],a=(n+63&-64)>>3;for(let[o,s]of e.fields.entries()){let e=t[o];(!e||e.length!==n)&&(r[o]=s.clone({nullable:!0}),i[o]=e?._changeLengthAndBackfillNullBitmap(n)??z({type:s.type,length:n,nullCount:n,nullBitmap:new Uint8Array(a)}))}return[e.assign(r),z({type:new A(r),length:n,children:i})]}function Ws(e,t,n=new Map){if((e?.length??0)>0&&e?.length===t?.length)for(let r=-1,i=e.length;++r<i;){let{type:i}=e[r],a=t[r];for(let e of[a,...a?.dictionary?.data||[]])Ws(i.children,e?.children,n);if(D.isDictionary(i)){let{id:e}=i;if(!n.has(e))a?.dictionary&&n.set(e,a.dictionary);else if(n.get(e)!==a.dictionary)throw Error(`Cannot create Schema containing two different dictionaries with the same Id`)}}return n}var Gs=class extends ${constructor(e,t){let n=e.fields.map(e=>z({type:e.type})),r=z({type:new A(e.fields),length:0,nullCount:0,children:n});super(e,r,t||new Map)}},Ks=e=>`Expected ${C[e]} Message in stream, but was null or length 0.`,qs=e=>`Header pointer of flatbuffer-encoded ${C[e]} Message is null or length 0.`,Js=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,Ys=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,Xs=class{constructor(e){this.source=e instanceof Yo?e:new Yo(e)}[Symbol.iterator](){return this}next(){let e;return(e=this.readMetadataLength()).done||e.value===-1&&(e=this.readMetadataLength()).done||(e=this.readMetadata(e.value)).done?Y:e}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}readMessage(e){let t;if((t=this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw Error(Ks(e));return t.value}readMessageBody(e){if(e<=0)return new Uint8Array;let t=p(this.source.read(e));if(t.byteLength<e)throw Error(Ys(e,t.byteLength));return t.byteOffset%8==0&&t.byteOffset+t.byteLength<=t.buffer.byteLength?t:t.slice()}readSchema(e=!1){let t=C.Schema,n=this.readMessage(t)?.header();if(e&&!n)throw Error(qs(t));return n}readMetadataLength(){let e=this.source.read(4),t=(e&&new Be(e))?.readInt32(0)||0;return{done:t===0,value:t}}readMetadata(e){let t=this.source.read(e);if(!t)return Y;if(t.byteLength<e)throw Error(Js(e,t.byteLength));return{done:!1,value:ho.decode(t)}}},Zs=class{constructor(e,t){this.source=e instanceof Xo?e:ce(e)?new es(e,t):new Xo(e)}[Symbol.asyncIterator](){return this}next(){return t(this,void 0,void 0,function*(){let e;return(e=yield this.readMetadataLength()).done||e.value===-1&&(e=yield this.readMetadataLength()).done||(e=yield this.readMetadata(e.value)).done?Y:e})}throw(e){return t(this,void 0,void 0,function*(){return yield this.source.throw(e)})}return(e){return t(this,void 0,void 0,function*(){return yield this.source.return(e)})}readMessage(e){return t(this,void 0,void 0,function*(){let t;if((t=yield this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw Error(Ks(e));return t.value})}readMessageBody(e){return t(this,void 0,void 0,function*(){if(e<=0)return new Uint8Array;let t=p(yield this.source.read(e));if(t.byteLength<e)throw Error(Ys(e,t.byteLength));return t.byteOffset%8==0&&t.byteOffset+t.byteLength<=t.buffer.byteLength?t:t.slice()})}readSchema(){return t(this,arguments,void 0,function*(e=!1){let t=C.Schema,n=(yield this.readMessage(t))?.header();if(e&&!n)throw Error(qs(t));return n})}readMetadataLength(){return t(this,void 0,void 0,function*(){let e=yield this.source.read(4),t=(e&&new Be(e))?.readInt32(0)||0;return{done:t===0,value:t}})}readMetadata(e){return t(this,void 0,void 0,function*(){let t=yield this.source.read(e);if(!t)return Y;if(t.byteLength<e)throw Error(Js(e,t.byteLength));return{done:!1,value:ho.decode(t)}})}},Qs=class extends Xs{constructor(e){super(new Uint8Array),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=e instanceof Go?e:new Go(e)}next(){let{_json:e}=this;if(!this._schema)return this._schema=!0,{done:!1,value:ho.fromJSON(e.schema,C.Schema)};if(this._dictionaryIndex<e.dictionaries.length){let t=e.dictionaries[this._dictionaryIndex++];return this._body=t.data.columns,{done:!1,value:ho.fromJSON(t,C.DictionaryBatch)}}if(this._batchIndex<e.batches.length){let t=e.batches[this._batchIndex++];return this._body=t.columns,{done:!1,value:ho.fromJSON(t,C.RecordBatch)}}return this._body=[],Y}readMessageBody(e){return t(this._body);function t(e){return(e||[]).reduce((e,n)=>[...e,...n.VALIDITY&&[n.VALIDITY]||[],...n.TYPE_ID&&[n.TYPE_ID]||[],...n.OFFSET&&[n.OFFSET]||[],...n.DATA&&[n.DATA]||[],...n.VIEWS&&[n.VIEWS]||[],...n.VARIADIC_DATA_BUFFERS||[],...t(n.children)],[])}}readMessage(e){let t;if((t=this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw Error(Ks(e));return t.value}readSchema(){let e=C.Schema,t=this.readMessage(e),n=t?.header();if(!t||!n)throw Error(qs(e));return n}},$s=`ARROW1`,ec=new Uint8Array(6);for(let e=0;e<6;e+=1)ec[e]=$s.codePointAt(e);function tc(e,t=0){for(let n=-1,r=ec.length;++n<r;)if(ec[n]!==e[t+n])return!1;return!0}var nc=ec.length,rc=nc+4,ic=nc*2+4,ac=class{constructor(){this.LZ4_FRAME_MAGIC=new Uint8Array([4,34,77,24]),this.MIN_HEADER_LENGTH=7}isValidCodecEncode(e){let t=new Uint8Array([1,2,3,4,5,6,7,8]),n=e.encode(t);return this._isValidCompressed(n)}_isValidCompressed(e){return this._hasMinimumLength(e)&&this._hasValidMagicNumber(e)&&this._hasValidVersion(e)}_hasMinimumLength(e){return e.length>=this.MIN_HEADER_LENGTH}_hasValidMagicNumber(e){return this.LZ4_FRAME_MAGIC.every((t,n)=>e[n]===t)}_hasValidVersion(e){return(e[4]&192)>>6==1}},oc=class{constructor(){this.ZSTD_MAGIC=new Uint8Array([40,181,47,253]),this.MIN_HEADER_LENGTH=6}isValidCodecEncode(e){let t=new Uint8Array([1,2,3,4,5,6,7,8]),n=e.encode(t);return this._isValidCompressed(n)}_isValidCompressed(e){return this._hasMinimumLength(e)&&this._hasValidMagicNumber(e)}_hasMinimumLength(e){return e.length>=this.MIN_HEADER_LENGTH}_hasValidMagicNumber(e){return this.ZSTD_MAGIC.every((t,n)=>e[n]===t)}},sc={[Ue.LZ4_FRAME]:new ac,[Ue.ZSTD]:new oc},cc=new class{constructor(){this.registry={}}set(e,t){if(t?.encode&&typeof t.encode==`function`&&!sc[e].isValidCodecEncode(t))throw Error(`Encoder for ${Ue[e]} is not valid.`);this.registry[e]=t}get(e){return this.registry?.[e]||null}},lc=class e extends Ko{constructor(e){super(),this._impl=e}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(e){return this._impl.throw(e)}return(e){return this._impl.return(e)}cancel(){return this._impl.cancel()}reset(e){return this._impl.reset(e),this._DOMStream=void 0,this._nodeStream=void 0,this}open(e){let t=this._impl.open(e);return re(t)?t.then(()=>this):this}readRecordBatch(e){return this._impl.isFile()?this._impl.readRecordBatch(e):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return Ee.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Ee.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(e){throw Error(`"throughNode" not available in this environment`)}static throughDOM(e,t){throw Error(`"throughDOM" not available in this environment`)}static from(n){return n instanceof e?n:oe(n)?Cc(n):ce(n)?Ec(n):re(n)?t(this,void 0,void 0,function*(){return yield e.from(yield n)}):le(n)||de(n)||fe(n)||ae(n)?Tc(new Xo(n)):wc(new Yo(n))}static readAll(t){return t instanceof e?t.isSync()?xc(t):Sc(t):oe(t)||ArrayBuffer.isView(t)||ie(t)||se(t)?xc(t):Sc(t)}},uc=class extends lc{constructor(e){super(e),this._impl=e}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return i(this,arguments,function*(){yield r(yield*a(o(this[Symbol.iterator]())))})}},dc=class extends lc{constructor(e){super(e),this._impl=e}readAll(){return t(this,void 0,void 0,function*(){var e,t,n,r;let i=[];try{for(var a=!0,s=o(this),c;c=yield s.next(),e=c.done,!e;a=!0){r=c.value,a=!1;let e=r;i.push(e)}}catch(e){t={error:e}}finally{try{!a&&!e&&(n=s.return)&&(yield n.call(s))}finally{if(t)throw t.error}}return i})}[Symbol.iterator](){throw Error(`AsyncRecordBatchStreamReader is not Iterable`)}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},fc=class extends uc{constructor(e){super(e),this._impl=e}},pc=class extends dc{constructor(e){super(e),this._impl=e}},mc=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(e=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=e}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(e){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=e,this.dictionaries=new Map,this}_loadRecordBatch(e,t,n){let r;if(e.compression!=null){let n=cc.get(e.compression.type);if(n?.decode&&typeof n.decode==`function`){let{decommpressedBody:i,buffers:a}=this._decompressBuffers(e,t,n);r=this._loadCompressedVectors(e,i,this.schema.fields),e=new q(e.length,e.nodes,a,null)}else throw Error(`Record batch is compressed but codec not found`)}else r=this._loadVectors(e,t,this.schema.fields);let i=z({type:new A(this.schema.fields),length:e.length,children:r});return new $(this.schema,i,n)}_loadDictionaryBatch(e,t){let{id:n,isDelta:r}=e,{dictionaries:i,schema:a}=this,o=i.get(n),s=a.dictionaries.get(n),c;if(e.data.compression!=null){let i=cc.get(e.data.compression.type);if(i?.decode&&typeof i.decode==`function`){let{decommpressedBody:a,buffers:o}=this._decompressBuffers(e.data,t,i);c=this._loadCompressedVectors(e.data,a,[s]),e=new go(new q(e.data.length,e.data.nodes,o,null,e.data.variadicBufferCounts),n,r)}else throw Error(`Dictionary batch is compressed but codec not found`)}else c=this._loadVectors(e.data,t,[s]);return(o&&r?o.concat(new W(c)):new W(c)).memoize()}_loadVectors(e,t,n){return new us(t,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion,e.variadicBufferCounts).visitMany(n)}_loadCompressedVectors(e,t,n){return new _s(t,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion,e.variadicBufferCounts).visitMany(n)}_decompressBuffers(e,t,n){let r=[],i=[],a=0;for(let{offset:o,length:s}of e.buffers){if(s===0){r.push(new Uint8Array),i.push(new J(a,0));continue}let e=new Be(t.subarray(o,o+s)),c=T(e.readInt64(0)),l=e.bytes().subarray(8),u=c===-1?l:n.decode(l);r.push(u);let ee=(a+7&-8)-a;a+=ee,i.push(new J(a,u.length)),a+=u.length}return{decommpressedBody:r,buffers:i}}},hc=class extends mc{constructor(e,t){super(t),this._reader=oe(e)?new Qs(this._handle=e):new Xs(this._handle=e)}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(e){return this.closed||(this.autoDestroy=bc(this,e),(this.schema||=this._reader.readSchema())||this.cancel()),this}throw(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(e):Y}return(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(e):Y}next(){if(this.closed)return Y;let e,{_reader:t}=this;for(;e=this._readNextMessageAndValidate();)if(e.isSchema())this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;let n=e.header(),r=t.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(n,r,e.metadata)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;let n=e.header(),r=t.readMessageBody(e.bodyLength),i=this._loadDictionaryBatch(n,r);this.dictionaries.set(n.id,i)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Gs(this.schema)}):this.return()}_readNextMessageAndValidate(e){return this._reader.readMessage(e)}},gc=class extends mc{constructor(e,t){super(t),this._reader=new Zs(this._handle=e)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return t(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(e){return t(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=bc(this,e),(this.schema||=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(e){return t(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(e):Y})}return(e){return t(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(e):Y})}next(){return t(this,void 0,void 0,function*(){if(this.closed)return Y;let e,{_reader:t}=this;for(;e=yield this._readNextMessageAndValidate();)if(e.isSchema())yield this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;let n=e.header(),r=yield t.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(n,r,e.metadata)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;let n=e.header(),r=yield t.readMessageBody(e.bodyLength),i=this._loadDictionaryBatch(n,r);this.dictionaries.set(n.id,i)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Gs(this.schema)}):yield this.return()})}_readNextMessageAndValidate(e){return t(this,void 0,void 0,function*(){return yield this._reader.readMessage(e)})}},_c=class extends hc{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(e,t){super(e instanceof $o?e:new $o(e),t)}isSync(){return!0}isFile(){return!0}open(e){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let e of this._footer.dictionaryBatches())e&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(e)}readRecordBatch(e){if(this.closed)return null;this._footer||this.open();let t=this._footer?.getRecordBatch(e);if(t&&this._handle.seek(t.offset)){let e=this._reader.readMessage(C.RecordBatch);if(e?.isRecordBatch()){let t=e.header(),n=this._reader.readMessageBody(e.bodyLength);return this._loadRecordBatch(t,n,e.metadata)}}return null}_readDictionaryBatch(e){let t=this._footer?.getDictionaryBatch(e);if(t&&this._handle.seek(t.offset)){let e=this._reader.readMessage(C.DictionaryBatch);if(e?.isDictionaryBatch()){let t=e.header(),n=this._reader.readMessageBody(e.bodyLength),r=this._loadDictionaryBatch(t,n);this.dictionaries.set(t.id,r)}}}_readFooter(){let{_handle:e}=this,t=e.size-rc,n=e.readInt32(t),r=e.readAt(t-n,n);return Ja.decode(r)}_readNextMessageAndValidate(e){if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let t=this._footer?.getRecordBatch(this._recordBatchIndex);if(t&&this._handle.seek(t.offset))return this._reader.readMessage(e)}return null}},vc=class extends gc{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(e,...t){let n=typeof t[0]==`number`?void 0:t.shift(),r=t[0]instanceof Map?t.shift():void 0;super(e instanceof es?e:new es(e,n),r)}isFile(){return!0}isAsync(){return!0}open(e){let n=Object.create(null,{open:{get:()=>super.open}});return t(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let e of this._footer.dictionaryBatches())e&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield n.open.call(this,e)})}readRecordBatch(e){return t(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());let t=this._footer?.getRecordBatch(e);if(t&&(yield this._handle.seek(t.offset))){let e=yield this._reader.readMessage(C.RecordBatch);if(e?.isRecordBatch()){let t=e.header(),n=yield this._reader.readMessageBody(e.bodyLength);return this._loadRecordBatch(t,n,e.metadata)}}return null})}_readDictionaryBatch(e){return t(this,void 0,void 0,function*(){let t=this._footer?.getDictionaryBatch(e);if(t&&(yield this._handle.seek(t.offset))){let e=yield this._reader.readMessage(C.DictionaryBatch);if(e?.isDictionaryBatch()){let t=e.header(),n=yield this._reader.readMessageBody(e.bodyLength),r=this._loadDictionaryBatch(t,n);this.dictionaries.set(t.id,r)}}})}_readFooter(){return t(this,void 0,void 0,function*(){let{_handle:e}=this;e._pending&&(yield e._pending);let t=e.size-rc,n=yield e.readInt32(t),r=yield e.readAt(t-n,n);return Ja.decode(r)})}_readNextMessageAndValidate(e){return t(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let t=this._footer.getRecordBatch(this._recordBatchIndex);if(t&&(yield this._handle.seek(t.offset)))return yield this._reader.readMessage(e)}return null})}},yc=class extends hc{constructor(e,t){super(e,t)}_loadVectors(e,t,n){return new ds(t,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion,e.variadicBufferCounts).visitMany(n)}};function bc(e,t){return t&&typeof t.autoDestroy==`boolean`?t.autoDestroy:e.autoDestroy}function*xc(e){let t=lc.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function Sc(e){return i(this,arguments,function*(){let t=yield r(lc.from(e));try{if(!(yield r(t.open({autoDestroy:!1}))).closed)do yield yield r(t);while(!(yield r(t.reset().open())).closed)}finally{yield r(t.cancel())}})}function Cc(e){return new uc(new yc(e))}function wc(e){let t=e.peek(nc+7&-8);return t&&t.byteLength>=4?tc(t)?new fc(new _c(e.read())):new uc(new hc(e)):new uc(new hc(function*(){}()))}function Tc(e){return t(this,void 0,void 0,function*(){let t=yield e.peek(nc+7&-8);return t&&t.byteLength>=4?tc(t)?new fc(new _c(yield e.read())):new dc(new gc(e)):new dc(new gc(function(){return i(this,arguments,function*(){})}()))})}function Ec(e){return t(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),n=new es(e,t);return t>=ic&&tc(yield n.readAt(0,nc+7&-8))?new pc(new vc(n)):new dc(new gc(n))})}function Dc(e){let t=lc.from(e);return re(t)?t.then(e=>Dc(e)):t.isAsync()?t.readAll().then(e=>new Bs(e)):new Bs(t.readAll())}var Oc=e({tableFromIPC:()=>Dc});export{g as a,w as i,Dc as n,D as r,Oc as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,t as n}from"./jsx-runtime-CGSxa44d.js";import{a as r,c as i,i as a,l as o,n as s,o as c,r as l,s as u}from"./fixtureUrls-CCOMCYin.js";import{a as d,i as f}from"./src-CDsD7llV.js";import{t as p}from"./compiler-runtime-CAfxf4JJ.js";import{t as m}from"./index-B48sJ3dv.js";var h=p(),g=e(t(),1),_=n(),v={jpeg2k:{label:`JP2K`,storeName:`jpeg2k.zarr`,getFixtureUrl:a,getManifestUrl:r},mandelbulb:{label:`HTJ2K Mandelbulb`,storeName:`mandelbulb.zarr`,getFixtureUrl:c,getManifestUrl:u},htj2k:{label:`HTJ2K (experimental.openjph_htj2k)`,storeName:`htj2k-demo.zarr`,getFixtureUrl:s,getManifestUrl:l}},y={flexShrink:0,padding:`10px 12px`,borderBottom:`1px solid #333`,background:`#1e1e1e`,fontSize:12},b={background:`#2a2a2a`,color:`#eee`,border:`1px solid #444`,borderRadius:4,padding:`4px 8px`},x={flex:1,minHeight:0,position:`relative`};function S(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KiB`:`${(e/1048576).toFixed(2)} MiB`}function C(e){let t=(0,h.c)(53),{fixtureKind:n,fixtureUrl:r,manifestUrl:a}=e,o=v[n],{spatialData:s,loading:c,error:l}=i(),u;t[0]===s?.coordinateSystems?u=t[1]:(u=s?.coordinateSystems??[],t[0]=s?.coordinateSystems,t[1]=u);let f=u,[p,b]=(0,g.useState)(null),S;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(S={schemaVersion:2,entries:[]},t[2]=S):S=t[2];let[C,w]=(0,g.useState)(S),[T,E]=(0,g.useState)(null),D,O;t[3]!==f||t[4]!==s?(D=()=>{!s||f.length===0||b(e=>e??f[0]??null)},O=[s,f],t[3]=f,t[4]=s,t[5]=D,t[6]=O):(D=t[5],O=t[6]),(0,g.useEffect)(D,O);let k,A;t[7]!==p||t[8]!==s?(k=()=>{!s||!p||(w(m(s,p)),E(null))},A=[s,p],t[7]=p,t[8]=s,t[9]=k,t[10]=A):(k=t[9],A=t[10]),(0,g.useEffect)(k,A);let j;bb0:{if(c){j=`Loading ${o.label} codec fixture...`;break bb0}if(l){j=`Failed to load ${o.label} fixture: ${l.message}`;break bb0}if(!s){j=`No SpatialData loaded.`;break bb0}if(!p){j=`No coordinate system available.`;break bb0}if(C.entries.length===0){j=`No layers in this coordinate system.`;break bb0}j=null}let M=j,N;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(N={display:`flex`,flexDirection:`column`,height:`100%`,minHeight:0},t[11]=N):N=t[11];let P;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(P={color:`#888`,marginBottom:6},t[12]=P):P=t[12];let F;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,_.jsx)(`code`,{children:`SpatialCanvasViewer`}),t[13]=F):F=t[13];let I;t[14]===o.storeName?I=t[15]:(I=(0,_.jsxs)(`div`,{style:P,children:[`Codec fixture `,F,` - local`,` `,(0,_.jsx)(`code`,{children:o.storeName})]}),t[14]=o.storeName,t[15]=I);let L;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(L={display:`flex`,flexWrap:`wrap`,gap:12,marginBottom:8},t[16]=L):L=t[16];let R;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(R={color:`#8af`},t[17]=R):R=t[17];let z;t[18]===r?z=t[19]:(z=(0,_.jsx)(`a`,{href:r,style:R,children:`Store`}),t[18]=r,t[19]=z);let B;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(B={color:`#8af`},t[20]=B):B=t[20];let V;t[21]===a?V=t[22]:(V=(0,_.jsx)(`a`,{href:a,style:B,children:`Manifest`}),t[21]=a,t[22]=V);let H;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(H={color:`#aaa`},t[23]=H):H=t[23];let U;t[24]===o.label?U=t[25]:(U=(0,_.jsxs)(`span`,{style:H,children:[`Codec: `,(0,_.jsx)(`code`,{children:o.label})]}),t[24]=o.label,t[25]=U);let W;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(W={color:`#aaa`},t[26]=W):W=t[26];let G=p??`-`,K;t[27]===G?K=t[28]:(K=(0,_.jsxs)(`span`,{style:W,children:[`Coordinate system: `,(0,_.jsx)(`code`,{children:G})]}),t[27]=G,t[28]=K);let q;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(q={color:`#aaa`},t[29]=q):q=t[29];let J;t[30]===C.entries.length?J=t[31]:(J=(0,_.jsxs)(`span`,{style:q,children:[`Layers: `,(0,_.jsx)(`code`,{children:C.entries.length})]}),t[30]=C.entries.length,t[31]=J);let Y;t[32]!==z||t[33]!==V||t[34]!==U||t[35]!==K||t[36]!==J?(Y=(0,_.jsxs)(`div`,{style:L,children:[z,V,U,K,J]}),t[32]=z,t[33]=V,t[34]=U,t[35]=K,t[36]=J,t[37]=Y):Y=t[37];let X;t[38]===l?X=t[39]:(X=l?(0,_.jsxs)(`div`,{style:{color:`#d99`},children:[`Generate fixtures with `,(0,_.jsx)(`code`,{children:`pnpm test:fixtures:generate:codecs`}),`.`]}):null,t[38]=l,t[39]=X);let Z;t[40]!==I||t[41]!==Y||t[42]!==X?(Z=(0,_.jsxs)(`div`,{style:y,children:[I,Y,X]}),t[40]=I,t[41]=Y,t[42]=X,t[43]=Z):Z=t[43];let Q;t[44]!==p||t[45]!==C||t[46]!==s||t[47]!==M||t[48]!==T?(Q=(0,_.jsx)(`div`,{style:x,children:M?(0,_.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100%`,color:`#888`,padding:16,textAlign:`center`},children:M}):(0,_.jsx)(d,{spatialData:s,coordinateSystem:p,renderStack:C,viewState:T,onViewStateChange:E,renderTooltip:!1,style:{width:`100%`,height:`100%`}})}),t[44]=p,t[45]=C,t[46]=s,t[47]=M,t[48]=T,t[49]=Q):Q=t[49];let $;return t[50]!==Z||t[51]!==Q?($=(0,_.jsxs)(`div`,{style:N,children:[Z,Q]}),t[50]=Z,t[51]=Q,t[52]=$):$=t[52],$}function w(e){let t=(0,h.c)(35),{fixtureUrl:n,manifestUrl:r,manifest:i}=e,a;t[0]===i?.shape?a=t[1]:(a=i?.shape??[],t[0]=i?.shape,t[1]=a);let[o,s,c,l,u]=a,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d={color:`#888`,marginBottom:6},t[2]=d):d=t[2];let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,_.jsx)(`code`,{children:`SpatialCanvas`}),t[3]=f):f=t[3];let p=i?.image_path??`images/mandelbulb`,m;t[4]===p?m=t[5]:(m=(0,_.jsx)(`code`,{children:p}),t[4]=p,t[5]=m);let g;t[6]===i?g=t[7]:(g=i?(0,_.jsxs)(_.Fragment,{children:[` `,`· codec `,(0,_.jsx)(`code`,{children:i.codec})]}):null,t[6]=i,t[7]=g);let v;t[8]!==m||t[9]!==g?(v=(0,_.jsxs)(`div`,{style:d,children:[`Mandelbulb volume `,f,` - local`,` `,m,g]}),t[8]=m,t[9]=g,t[10]=v):v=t[10];let b;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b={display:`flex`,flexWrap:`wrap`,gap:12,marginBottom:8},t[11]=b):b=t[11];let x;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(x={color:`#8af`},t[12]=x):x=t[12];let S;t[13]===n?S=t[14]:(S=(0,_.jsx)(`a`,{href:n,style:x,children:`Store`}),t[13]=n,t[14]=S);let C;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(C={color:`#8af`},t[15]=C):C=t[15];let w;t[16]===r?w=t[17]:(w=(0,_.jsx)(`a`,{href:r,style:C,children:`Manifest`}),t[16]=r,t[17]=w);let T;t[18]!==s||t[19]!==l||t[20]!==i||t[21]!==o||t[22]!==u||t[23]!==c?(T=i?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`span`,{style:{color:`#aaa`},children:[`Shape:`,` `,(0,_.jsxs)(`code`,{children:[`t=`,o,` c=`,s,` z=`,c,` `,u,`×`,l]})]}),(0,_.jsxs)(`span`,{style:{color:`#aaa`},children:[`Chunks: `,(0,_.jsx)(`code`,{children:i.chunks.join(`, `)})]})]}):null,t[18]=s,t[19]=l,t[20]=i,t[21]=o,t[22]=u,t[23]=c,t[24]=T):T=t[24];let E;t[25]!==S||t[26]!==w||t[27]!==T?(E=(0,_.jsxs)(`div`,{style:b,children:[S,w,T]}),t[25]=S,t[26]=w,t[27]=T,t[28]=E):E=t[28];let D;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(D={color:`#888`},t[29]=D):D=t[29];let O;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,_.jsx)(`code`,{children:`t`}),t[30]=O):O=t[30];let k;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,_.jsxs)(`div`,{style:D,children:[`Use the image layer panel to scrub `,O,` and `,(0,_.jsx)(`code`,{children:`z`}),` selections across the encoded volume.`]}),t[31]=k):k=t[31];let A;return t[32]!==E||t[33]!==v?(A=(0,_.jsxs)(`div`,{style:y,children:[v,E,k]}),t[32]=E,t[33]=v,t[34]=A):A=t[34],A}function T(e){let t=(0,h.c)(31),{fixtureUrl:n,manifestUrl:r,htj2kDemo:i}=e,a=i?.image.shape,o=i?.multiscale_levels,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={color:`#888`,marginBottom:6},t[0]=s):s=t[0];let c;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,_.jsx)(`code`,{children:`SpatialCanvas`}),t[1]=c):c=t[1];let l=i?.store??`htj2k-demo.zarr`,u;t[2]===l?u=t[3]:(u=(0,_.jsxs)(`div`,{style:s,children:[`HTJ2K encode demo `,c,` - local`,` `,(0,_.jsx)(`code`,{children:l})]}),t[2]=l,t[3]=u);let d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d={display:`flex`,flexWrap:`wrap`,gap:12,marginBottom:8},t[4]=d):d=t[4];let f;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(f={color:`#8af`},t[5]=f):f=t[5];let p;t[6]===n?p=t[7]:(p=(0,_.jsx)(`a`,{href:n,style:f,children:`Store`}),t[6]=n,t[7]=p);let m;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(m={color:`#8af`},t[8]=m):m=t[8];let g;t[9]===r?g=t[10]:(g=(0,_.jsx)(`a`,{href:r,style:m,children:`Manifest`}),t[9]=r,t[10]=g);let v;t[11]!==a||t[12]!==o?(v=a?(0,_.jsxs)(`span`,{style:{color:`#aaa`},children:[`Image: `,(0,_.jsx)(`code`,{children:a.slice(-2).join(`×`)}),o==null?null:(0,_.jsxs)(_.Fragment,{children:[` `,`· `,(0,_.jsx)(`code`,{children:o}),` scales`]})]}):null,t[11]=a,t[12]=o,t[13]=v):v=t[13];let b;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(b={color:`#aaa`},t[14]=b):b=t[14];let x=i?.variants.length??`-`,S;t[15]===x?S=t[16]:(S=(0,_.jsxs)(`span`,{style:b,children:[`Images: `,(0,_.jsx)(`code`,{children:x})]}),t[15]=x,t[16]=S);let C;t[17]!==v||t[18]!==S||t[19]!==p||t[20]!==g?(C=(0,_.jsxs)(`div`,{style:d,children:[p,g,v,S]}),t[17]=v,t[18]=S,t[19]=p,t[20]=g,t[21]=C):C=t[21];let w;t[22]===i?w=t[23]:(w=i?(0,_.jsxs)(`div`,{style:{color:`#888`,marginBottom:8},children:[`Toggle `,(0,_.jsx)(`code`,{children:`mandelbrot_*`}),` layers to compare HTJ2K presets (balanced`,` `,(0,_.jsx)(`code`,{children:`2 LSB`}),`, small `,(0,_.jsx)(`code`,{children:`5 LSB`}),` — on this `,(0,_.jsx)(`code`,{children:`uint16`}),` plane,`,` `,(0,_.jsx)(`code`,{children:`q=3.05e-5`}),` and `,(0,_.jsx)(`code`,{children:`q=7.63e-5`}),`). Interactive per-`,(0,_.jsx)(`code`,{children:`q`}),` `,`transcoding in the viewer is planned for a later pass.`]}):null,t[22]=i,t[23]=w);let T;t[24]===i?T=t[25]:(T=i?(0,_.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`,color:`#ccc`},children:[(0,_.jsx)(`thead`,{children:(0,_.jsxs)(`tr`,{style:{color:`#888`,textAlign:`left`},children:[(0,_.jsx)(`th`,{style:{padding:`4px 8px 4px 0`},children:`Image key`}),(0,_.jsx)(`th`,{style:{padding:`4px 8px`},children:`Preset`}),(0,_.jsx)(`th`,{style:{padding:`4px 8px`},children:`Encoded`}),(0,_.jsx)(`th`,{style:{padding:`4px 8px`},children:`Ratio`})]})}),(0,_.jsx)(`tbody`,{children:i.variants.map(E)})]}):null,t[24]=i,t[25]=T);let D;return t[26]!==C||t[27]!==w||t[28]!==T||t[29]!==u?(D=(0,_.jsxs)(`div`,{style:y,children:[u,C,w,T]}),t[26]=C,t[27]=w,t[28]=T,t[29]=u,t[30]=D):D=t[30],D}function E(e){return(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`td`,{style:{padding:`4px 8px 4px 0`},children:(0,_.jsx)(`code`,{children:e.image_key})}),(0,_.jsx)(`td`,{style:{padding:`4px 8px`},children:e.label}),(0,_.jsx)(`td`,{style:{padding:`4px 8px`},children:S(e.encoded_bytes)}),(0,_.jsx)(`td`,{style:{padding:`4px 8px`},children:e.compression_ratio==null?`-`:`${e.compression_ratio.toFixed(1)}×`})]},e.image_key)}function D(){let e=(0,h.c)(32),[t,n]=(0,g.useState)(`jpeg2k`),[r,i]=(0,g.useState)(null),[a,s]=(0,g.useState)(null),[c,d]=(0,g.useState)(null),[p,m]=(0,g.useState)(null),S=v[t],E,D;e[0]===t?(E=e[1],D=e[2]):(E=()=>{if(t!==`htj2k`&&(i(null),s(null)),t!==`mandelbulb`&&(d(null),m(null)),t!==`htj2k`&&t!==`mandelbulb`)return;let e=!1,n=t,r=n===`htj2k`?l():u();return fetch(r).then(O).then(t=>{e||(n===`htj2k`?(i(t),s(null)):(d(t),m(null)))}).catch(t=>{if(e)return;let r=t instanceof Error?t.message:String(t);n===`htj2k`?(i(null),s(r)):(d(null),m(r))}),()=>{e=!0}},D=[t],e[0]=t,e[1]=E,e[2]=D),(0,g.useEffect)(E,D);let k;e[3]===S?k=e[4]:(k=S.getFixtureUrl(),e[3]=S,e[4]=k);let A=k,j;e[5]===S?j=e[6]:(j=S.getManifestUrl(),e[5]=S,e[6]=j);let M=j,N;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(N={display:`flex`,flexDirection:`column`,height:`100%`,minHeight:0},e[7]=N):N=e[7];let P;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(P={display:`inline-flex`,alignItems:`center`,gap:8,color:`#ccc`},e[8]=P):P=e[8];let F;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>n(e.target.value),e[9]=F):F=e[9];let I,L,R;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,_.jsx)(`option`,{value:`jpeg2k`,children:`JP2K (imagecodecs_jpeg2k)`}),L=(0,_.jsx)(`option`,{value:`mandelbulb`,children:`HTJ2K Mandelbulb volume (t/z)`}),R=(0,_.jsx)(`option`,{value:`htj2k`,children:`HTJ2K encode demo (experimental.openjph_htj2k)`}),e[10]=I,e[11]=L,e[12]=R):(I=e[10],L=e[11],R=e[12]);let z;e[13]===t?z=e[14]:(z=(0,_.jsxs)(`label`,{style:P,children:[`Codec fixture`,(0,_.jsxs)(`select`,{value:t,onChange:F,style:b,children:[I,L,R]})]}),e[13]=t,e[14]=z);let B;e[15]===a?B=e[16]:(B=a?(0,_.jsxs)(`div`,{style:{color:`#d99`,marginTop:8},children:[`HTJ2K encode-demo manifest unavailable (`,a,`). Run`,` `,(0,_.jsx)(`code`,{children:`pnpm test:fixtures:generate:codecs`}),`.`]}):null,e[15]=a,e[16]=B);let V;e[17]===p?V=e[18]:(V=p?(0,_.jsxs)(`div`,{style:{color:`#d99`,marginTop:8},children:[`Mandelbulb manifest unavailable (`,p,`). Run`,` `,(0,_.jsx)(`code`,{children:`pnpm test:fixtures:generate:codecs`}),`.`]}):null,e[17]=p,e[18]=V);let H;e[19]!==z||e[20]!==B||e[21]!==V?(H=(0,_.jsxs)(`div`,{style:y,children:[z,B,V]}),e[19]=z,e[20]=B,e[21]=V,e[22]=H):H=e[22];let U;e[23]!==t||e[24]!==A||e[25]!==r||e[26]!==c||e[27]!==M?(U=t===`htj2k`?(0,_.jsxs)(o,{source:A,children:[(0,_.jsx)(T,{fixtureUrl:A,manifestUrl:M,htj2kDemo:r}),(0,_.jsx)(`div`,{style:x,children:(0,_.jsx)(f,{})})]}):t===`mandelbulb`?(0,_.jsxs)(o,{source:A,children:[(0,_.jsx)(w,{fixtureUrl:A,manifestUrl:M,manifest:c}),(0,_.jsx)(`div`,{style:x,children:(0,_.jsx)(f,{})})]}):(0,_.jsx)(o,{source:A,children:(0,_.jsx)(C,{fixtureKind:t,fixtureUrl:A,manifestUrl:M})}),e[23]=t,e[24]=A,e[25]=r,e[26]=c,e[27]=M,e[28]=U):U=e[28];let W;return e[29]!==H||e[30]!==U?(W=(0,_.jsxs)(`div`,{style:N,children:[H,U]}),e[29]=H,e[30]=U,e[31]=W):W=e[31],W}async function O(e){if(!e.ok)throw Error(`${e.status} ${e.statusText}`);return await e.json()}export{D as default};
@@ -0,0 +1,2 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{B as t,D as n,H as r,V as i,f as a,n as o,p as s,t as c}from"./jsx-runtime-CGSxa44d.js";import{t as l}from"./viewFix-hlLx6n-Z.js";import{t as u}from"./compiler-runtime-CAfxf4JJ.js";import{n as d}from"./dist-Cni3pAA9.js";import{a as f,i as p,n as m,o as h,r as g,t as _}from"./groupDemoLayers-CaSfYPCL.js";var v=u(),y=e(n(),1),b=c(),x=640,S=360,C=new URLSearchParams(window.location.search),w=C.get(`device`)===`webgl`?`webgl`:`webgpu`,T=[`normal`,`additive`,`multiply`,`screen`,`max`,`min`],E=T.find(e=>e===C.get(`blend`))??`normal`,D=C.get(`nested`)===`1`,O=C.get(`views`)===`2`,k=C.get(`fix`)!==`0`,A=C.get(`clear`)!==`0`,j=C.get(`group`)!==`0`,M=C.get(`image`)===`1`,N={x:400,y:200,width:220,height:140},P={main:{target:[0,0,0],zoom:0},inset:{target:[160,0,0],zoom:-1}};function F(e){return e.props.layers.filter(e=>e instanceof i)}var I=M?f():null;function L(e){return I?h(I,`@${e}`,x,S):[]}function R(e){let t=t=>`${t}@${e}`,n=p(t(`backdrop`),[{position:[-160,0],radius:150,color:_},{position:[160,0],radius:150,color:_}],1),r=[p(t(`loose-red`),[{position:[-200,0],radius:70,color:g}],.5),p(t(`loose-green`),[{position:[-120,0],radius:70,color:m}],.5)],i=new a({id:t(`iso`),opacity:.5,blendMode:E,layers:[...L(e),p(t(`iso-red`),[{position:[120,0],radius:70,color:g}],1),p(t(`iso-green`),[{position:[200,0],radius:70,color:m}],1)]}),o=D?new a({id:t(`outer`),layers:[i]}):i;return j?[n,...r,o]:[n,...r,...F(i)]}function z(e,[t,n]){let r=e===`main`?{x:0,y:0,width:x,height:S}:N,{target:i,zoom:a}=P[e],o=2**a;return[Math.round(r.x+r.width/2+(t-i[0])*o),Math.round(r.y+r.height/2+(n-i[1])*o)]}function B([e,t]){return e>=N.x&&e<N.x+N.width&&t>=N.y&&t<N.y+N.height}var V=[[`loose overlap`,`main`,[-160,0]],[`loose red only`,`main`,[-235,0]],[`iso overlap`,`main`,[160,0]],[`iso red only`,`main`,[85,0]],[`iso backdrop only (empty group)`,`main`,[160,110]],[`iso image only`,`main`,[250,110]],[`outside everything`,`main`,[0,170]],[`inset iso overlap`,`inset`,[160,0]],[`inset iso red only`,`inset`,[85,0]],[`inset iso backdrop only`,`inset`,[160,110]],[`inset empty (0 if cleared)`,`inset`,[-50,-130]]];function H(){if(!(O&&w===`webgpu`&&!k))return[];let e=S-2*N.y-N.height;return V.filter(([,e])=>e===`inset`).map(([t,n,r])=>{let[i,a]=z(n,r);return[`${t} (mirrored)`,[i,a+e]]})}var U=V.flatMap(([e,t,n])=>{let r=z(t,n);return(t===`inset`?!O:O&&B(r))?[]:[[e,r]]}).concat(H());function W(){let e=(0,v.c)(22),n=(0,y.useRef)(null),[i,a]=(0,y.useState)(``),[o,c]=(0,y.useState)(``),[l,u]=(0,y.useState)(`starting`),f,p;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{if(!n.current)return;let e=document.createElement(`canvas`);e.style.width=`${x}px`,e.style.height=`${S}px`,n.current.prepend(e);let i=new r({canvas:e,width:x,height:S,useDevicePixels:!1,...w===`webgpu`?{deviceProps:{type:`webgpu`,adapters:[d]}}:{},views:[new t({id:`main`,controller:!0}),...O?[new t({id:`inset`,...N,clear:A})]:[]],initialViewState:P,onDeviceInitialized:q,layers:[...R(`main`),...O?R(`inset`):[]],layerFilter:K,onAfterRender:()=>{let t=document.createElement(`canvas`);t.width=e.width,t.height=e.height;let n=t.getContext(`2d`,{willReadFrequently:!0});if(!n)return;n.drawImage(e,0,0);let r=U.map(e=>{let[t,r]=e,[i,a]=r,o=n.getImageData(i,a,1,1).data;return`${t.padEnd(34)} rgba(${o[0]}, ${o[1]}, ${o[2]}, ${o[3]})`});a(r.join(`
2
+ `)),u(`rendered on ${i.device?.type??`?`}`)},onHover:e=>{c(e.layer?`layer=${e.layer.id} member=${s(e)??`-`} index=${e.index}`:`none`)},onError:e=>u(`deck error: ${e.message}`)});return()=>{i.finalize(),e.remove()}},p=[],e[0]=f,e[1]=p):(f=e[0],p=e[1]),(0,y.useEffect)(f,p);let m=G,h,g;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(h={padding:16,color:`#ddd`,fontFamily:`monospace`,fontSize:12},g={marginBottom:8},e[2]=h,e[3]=g):(h=e[2],g=e[3]);let _,C;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=m(`webgpu`,{device:`webgpu`}),C=m(`webgl`,{device:`webgl`}),e[4]=_,e[5]=C):(_=e[4],C=e[5]);let F;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(F=T.map(e=>m(e,{blend:e})),e[6]=F):F=e[6];let I;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(I=m(D?`unnest`:`nest`,{nested:D?`0`:`1`}),e[7]=I):I=e[7];let L;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(L=m(O?`one view`:`inset view`,{views:O?`1`:`2`}),e[8]=L):L=e[8];let z;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(z=m(M?`no image`:`viv image`,{image:M?`0`:`1`}),e[9]=z):z=e[9];let B;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,b.jsxs)(`div`,{style:g,children:[`device: `,_,C,` | blend:`,` `,F,` |`,` `,I,` `,L,` `,z,` `,m(j?`ungroup`:`group`,{group:j?`0`:`1`}),w===`webgpu`&&m(k?`unpatch deck`:`patch deck`,{fix:k?`0`:`1`})]}),e[10]=B):B=e[10];let V;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,b.jsx)(`div`,{ref:n,style:{position:`relative`,width:x,height:S,background:`#000`}}),e[11]=V):V=e[11];let H;e[12]===l?H=e[13]:(H=(0,b.jsxs)(`div`,{children:[l,` · device=`,w,` blend=`,E,` nested=`,String(D),` views=`,O?2:1]}),e[12]=l,e[13]=H);let W;e[14]===i?W=e[15]:(W=(0,b.jsx)(`pre`,{children:i}),e[14]=i,e[15]=W);let J;e[16]===o?J=e[17]:(J=(0,b.jsxs)(`div`,{children:[`hover: `,o]}),e[16]=o,e[17]=J);let Y;return e[18]!==H||e[19]!==W||e[20]!==J?(Y=(0,b.jsxs)(`div`,{style:h,children:[B,V,H,W,J]}),e[18]=H,e[19]=W,e[20]=J,e[21]=Y):Y=e[21],Y}function G(e,t){let n=new URLSearchParams({device:w,blend:E,...D?{nested:`1`}:{},...O?{views:`2`}:{},...M?{image:`1`}:{},...j?{}:{group:`0`},...k?{}:{fix:`0`},...t});return(0,b.jsx)(`a`,{href:`?${n}`,style:{color:`#8af`,marginRight:10},children:e},e)}function K(e){let{layer:t,viewport:n}=e;return t.id.endsWith(`@${n.id}`)}function q(e){k&&(l(e),o(e))}export{W as default};
@@ -0,0 +1,3 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{B as t,D as n,H as r,f as i,n as a,p as o,t as s}from"./jsx-runtime-CGSxa44d.js";import{t as c}from"./viewFix-hlLx6n-Z.js";import{n as l}from"./dist-Cni3pAA9.js";import{a as u,i as d,n as f,o as p,r as m,t as h}from"./groupDemoLayers-CaSfYPCL.js";var g=e(n(),1),_=s(),v=640,y=360,b=new URLSearchParams(window.location.search),x=b.get(`device`)===`webgl`?`webgl`:`webgpu`,S=b.get(`image`)===`1`,C=200,w=170,T=3,E=6,D={target:[160,0,0],zoom:-.5},O=[[[250,200,40],[240,120,200],[120,230,230]],[[255,255,255],[30,30,30],[250,120,20]]],k=S?u(Number(b.get(`tileDelay`)??0)):null,A=k?p(k,`@shared`,C,w):[],j=[{position:[160,0],radius:150,color:h}],M=[{position:[120,0],radius:70,color:m}],N=new Map;function P(e){let t=e.join(),n=N.get(t);return n||(n=[{position:[200,0],radius:70,color:e}],N.set(t,n)),n}function F(e){let t=e%T,n=Math.floor(e/T);return{x:t*210,y:n*180,width:C,height:w}}function I(e){return Array.from({length:e},(e,n)=>new t({id:`cell-${n}`,...F(n),controller:!0}))}function L(e,t){let n=d(`backdrop@shared`,j,1),r=new i({id:`iso@shared`,opacity:.5,onTargetRender:t,layers:[...A,d(`iso-red@shared`,M,1),d(`iso-green@shared`,P(e.sharedGreen),1)]}),a=O[e.overlayPalette];return[n,r,...Array.from({length:e.cells},(e,t)=>d(`overlay@cell-${t}`,[{position:[60+30*t,100],radius:25,color:a[t%a.length]}],1))]}function R(e,[t,n],r){let i=F(e),a=2**(typeof r.zoom==`number`?r.zoom:0),[o,s]=r.target??[0,0,0];return[Math.round(i.x+i.width/2+(t-o)*a),Math.round(i.y+i.height/2+(n-s)*a)]}var z=()=>({new:0,view:0,contents:0});function B(){let e=(0,g.useRef)(null),t=(0,g.useRef)(null),n=(0,g.useRef)({cells:3,overlayPalette:0,sharedGreen:f}),i=(0,g.useRef)(D),s=(0,g.useRef)(z()),u=(0,g.useRef)(z()),d=(0,g.useRef)(0),p=(0,g.useRef)([]),[m,h]=(0,g.useState)(``),[b,C]=(0,g.useState)(``),[w,T]=(0,g.useState)(`starting`),[O,k]=(0,g.useState)(``),A=(0,g.useRef)(()=>{});(0,g.useEffect)(()=>{if(!e.current)return;let f=()=>{let e=t.current;if(!e)return;let r=n.current,a=I(r.cells);e.setProps({views:a,viewState:Object.fromEntries(a.map(e=>[e.id,i.current])),layers:L(r,e=>{p.current.push(`frame ${d.current}: ${e.reason} ${e.width}x${e.height} for ${e.viewportId}`),s.current[e.reason]+=1,u.current[e.reason]+=1})})};A.current=f;let m=document.createElement(`canvas`);m.style.width=`${v}px`,m.style.height=`${y}px`,e.current.prepend(m);let g=new r({canvas:m,width:v,height:y,useDevicePixels:!1,...x===`webgpu`?{deviceProps:{type:`webgpu`,adapters:[l]}}:{},onDeviceInitialized:e=>{c(e),a(e)},layerFilter:({layer:e,viewport:t})=>e.id.endsWith(`@shared`)||e.id.endsWith(`@${t.id}`),onViewStateChange:({viewState:e})=>(i.current=e,f(),e),onHover:e=>{C(e.picked?`view=${e.viewport?.id} layer=${e.layer?.id} member=${o(e)??`-`} index=${e.index}`:`none`)},onAfterRender:()=>{d.current+=1;let e=u.current,t=s.current;T(`frames ${d.current} · group target draws: total ${t.new+t.view+t.contents} (new ${t.new}, view ${t.view}, contents ${t.contents}) · this frame ${e.new+e.view+e.contents}`),u.current=z(),h(p.current.slice(-6).join(`
2
+ `));let r=document.createElement(`canvas`);r.width=m.width,r.height=m.height;let a=r.getContext(`2d`,{willReadFrequently:!0});if(!a)return;a.drawImage(m,0,0);let o=Array.from({length:n.current.cells},(e,t)=>{let n=e=>{let[n,r]=R(t,e,i.current),o=a.getImageData(n,r,1,1).data;return`(${o[0]}, ${o[1]}, ${o[2]})`};return`cell ${t}: shared overlap ${n([160,0])} overlay ${n([60+30*t,100])}`});k(o.join(`
3
+ `))}});return t.current=g,f(),()=>{g.finalize(),t.current=null,m.remove()}},[]);let j=e=>()=>{n.current=e(n.current),A.current()},M=(e,t)=>(0,_.jsx)(`button`,{type:`button`,onClick:t,style:{marginRight:8},children:e});return(0,_.jsxs)(`div`,{style:{padding:16,color:`#ddd`,fontFamily:`monospace`,fontSize:12},children:[(0,_.jsxs)(`div`,{style:{marginBottom:8},children:[`device:`,` `,(0,_.jsx)(`a`,{href:`?device=webgpu${S?`&image=1`:``}`,style:{color:`#8af`},children:`webgpu`}),` `,(0,_.jsx)(`a`,{href:`?device=webgl${S?`&image=1`:``}`,style:{color:`#8af`},children:`webgl`}),` `,`|`,` `,M(`recolour overlays`,j(e=>({...e,overlayPalette:1-e.overlayPalette}))),M(`recolour shared member`,j(e=>({...e,sharedGreen:e.sharedGreen===f?[40,160,220]:f}))),M(`add cell`,j(e=>({...e,cells:Math.min(E,e.cells+1)}))),M(`remove cell`,j(e=>({...e,cells:Math.max(1,e.cells-1)})))]}),(0,_.jsx)(`div`,{ref:e,style:{position:`relative`,width:v,height:y,background:`#000`}}),(0,_.jsx)(`div`,{id:`group-grid-readout`,children:w}),(0,_.jsx)(`pre`,{children:O}),(0,_.jsx)(`pre`,{id:`group-grid-log`,children:m}),(0,_.jsxs)(`div`,{id:`group-grid-hover`,children:[`hover: `,b]})]})}export{B as default};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{B as t,D as n,H as r,L as i,O as a,R as o,W as s,b as c,n as l,r as u,t as d,z as f}from"./jsx-runtime-CGSxa44d.js";import{c as p,l as m,t as h,u as g}from"./fixtureUrls-CCOMCYin.js";import{t as _}from"./compiler-runtime-CAfxf4JJ.js";import{n as v}from"./dist-Cni3pAA9.js";var y=_(),b=e(n(),1),x=d(),S={target:[256,256,0],zoom:-.3},C=[{view:`left`,canvas:`mc-canvas-left`,title:`image + labels`},{view:`right`,canvas:`mc-canvas-right`,title:`labels only`}];function w(e){return e}async function T(e,t){let{data:n}=await e.getRaster({selection:{c:t}}),r=1/0,i=-1/0;for(let e=0;e<n.length;e++){let t=n[e];t<r&&(r=t),t>i&&(i=t)}return[r,i>r?i:r+1]}function E(){let e=(0,y.c)(8),{spatialData:t}=p(),[n,r]=(0,b.useState)(null),[i,a]=(0,b.useState)(null),o;e[0]!==t?.images?.blobs_multiscale_image||e[1]!==t?.labels?.blobs_multiscale_labels?(o=()=>{let e=t?.images?.blobs_multiscale_image,n=t?.labels?.blobs_multiscale_labels;if(!e||!n)return;let i=!1;return(async()=>{let[t,a]=(await Promise.all([g(e.getStore()),g(n.getStore())])).map(w),o=t[t.length-1],s=o.shape[o.labels.indexOf(`c`)]??1,c=await Promise.all(Array.from({length:s},(e,t)=>T(o,t)));i||r({image:t,labels:a,contrastLimits:c})})().catch(e=>{i||a(String(e))}),()=>{i=!0}},e[0]=t?.images?.blobs_multiscale_image,e[1]=t?.labels?.blobs_multiscale_labels,e[2]=o):o=e[2];let s;e[3]===t?s=e[4]:(s=[t],e[3]=t,e[4]=s),(0,b.useEffect)(o,s);let c;return e[5]!==i||e[6]!==n?(c={sources:n,loadError:i},e[5]=i,e[6]=n,e[7]=c):c=e[7],c}var D=Array.from({length:256},(e,t)=>[t%16*32+16,Math.floor(t/16)*32+16]);function O(e){let t=e.tile?.bbox;if(!(!t||!(`left`in t)))return[t.left,t.bottom,t.right,t.top]}function k(e){let[t,n,r,i]=e;return[[t,i],[r,i],[r,n],[t,n],[t,i]]}function A(e){if(!e)return[];let{view:t,tileBounds:n,pointer:r,pickedPoint:a}=e,s=1e6;return[n&&new i({id:`hover-tile@${t}`,data:[k(n)],getPath:e=>e,getColor:[255,255,255,200],getWidth:2,widthUnits:`pixels`}),r&&new f({id:`hover-crosshair@${t}`,data:[[[r[0]-s,r[1]],[r[0]+s,r[1]]],[[r[0],r[1]-s],[r[0],r[1]+s]]],getSourcePosition:e=>e[0],getTargetPosition:e=>e[1],getColor:[0,255,0,200],getWidth:1,widthUnits:`pixels`}),a&&new o({id:`hover-picked@${t}`,data:[a],getPosition:e=>e,getFillColor:[255,60,60,255],getRadius:4,radiusUnits:`pixels`})]}function j(e,t){let n=e.contrastLimits.length,r={colors:[[255,0,255],[0,255,0],[0,128,255]].slice(0,n)},i=new a({...r,id:`image@left`,loader:e.image,dtype:e.image[0].dtype,selections:Array.from({length:n},(e,t)=>({c:t})),contrastLimits:e.contrastLimits,channelsVisible:Array.from({length:n},()=>!0)}),s=n=>new c({id:`labels@${n}`,loader:e.labels,channelColors:[[255,200,0]],channelOpacities:[.25],highlightedLabelId:t?.labelId??-1,highlightColor:[255,0,0,200]});return[new u({id:`image-device@left`,vivLayer:i}),s(`left`),s(`right`),new o({id:`grid@left`,data:D,getPosition:e=>e,getRadius:6,radiusUnits:`common`,getFillColor:[255,255,255,50],pickable:!0,autoHighlight:!0,highlightColor:[0,255,255,255]}),A(t)]}function M(){let e=(0,y.c)(22),{sources:t,loadError:n}=E(),[i,a]=(0,b.useState)(`Creating WebGPU device…`),[o,c]=(0,b.useState)(null),[u,d]=(0,b.useState)(null),f,p;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{let e=!1,t=null;return s.createDevice({type:`webgpu`,adapters:[v],createCanvasContext:{canvas:new OffscreenCanvas(1,1)}}).then(n=>{if(e){n.destroy();return}l(n);let i=new r({device:n,_canvases:C.map(R),views:C.map(L),initialViewState:Object.fromEntries(C.map(I)),layerFilter:F,onError:e=>a(`deck error: ${e.message}`)});t={device:n,deck:i},d(i),a(`device: ${n.type} (${n.info.gpu??`unknown gpu`})`)}).catch(e=>a(`device creation failed: ${String(e)}`)),()=>{e=!0,t?.deck.finalize(),t?.device.destroy(),d(null)}},p=[],e[0]=f,e[1]=p):(f=e[0],p=e[1]),(0,b.useEffect)(f,p);let m;e[2]!==o||e[3]!==t?(m=t?j(t,o):null,e[2]=o,e[3]=t,e[4]=m):m=e[4];let h=m,g;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>{let t=e.viewport;if(!t||e.x<0){c(null);return}let{object:n}=e,[r,i]=t.unproject([e.x,e.y]),a=e.layer&&!e.layer.id.startsWith(`hover-`)?e.layer:null;a&&console.log(e),c({view:t.id,layerId:a?.id,labelId:typeof n?.labelId==`number`?n.labelId:void 0,tileBounds:a?O(e):void 0,pickedPoint:Array.isArray(n)?[n[0],n[1]]:void 0,pointer:[r,i]})},e[5]=g):g=e[5];let _=g,S,w;e[6]!==u||e[7]!==h?(S=()=>{!u||!h||u.setProps({layers:h,onHover:_})},w=[u,h,_],e[6]=u,e[7]=h,e[8]=S,e[9]=w):(S=e[8],w=e[9]),(0,b.useEffect)(S,w);let T,D;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(T={display:`flex`,flexDirection:`column`,height:`100%`,minHeight:0},D={padding:`8px 12px`,fontSize:12,borderBottom:`1px solid #333`},e[10]=T,e[11]=D):(T=e[10],D=e[11]);let k=n?`load failed: ${n}`:t?`data loaded`:`loading data…`,A;e[12]===o?A=e[13]:(A=o?`${o.view} → ${o.layerId??`nothing`}${o.labelId?` label ${o.labelId}`:``} · pointer (${o.pointer?.map(P).join(`, `)})`+(o.pickedPoint?` · picked point (${o.pickedPoint.join(`, `)})`:``):`—`,e[12]=o,e[13]=A);let M;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,x.jsx)(`div`,{style:{color:`#888`,marginTop:4},children:`green crosshair = pointer · red dot = picked grid point (cyan = deck autoHighlight) · white box = picked tile · red label = picked label (both views)`}),e[14]=M):M=e[14];let z;e[15]!==i||e[16]!==k||e[17]!==A?(z=(0,x.jsxs)(`div`,{style:D,children:[i,` ·`,` `,k,` · hover:`,` `,A,M]}),e[15]=i,e[16]=k,e[17]=A,e[18]=z):z=e[18];let B;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,x.jsx)(`div`,{style:{display:`flex`,flex:1,minHeight:0,gap:8,padding:8},children:C.map(N)}),e[19]=B):B=e[19];let V;return e[20]===z?V=e[21]:(V=(0,x.jsxs)(`div`,{style:T,children:[z,B]}),e[20]=z,e[21]=V),V}function N(e){return(0,x.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`},children:[(0,x.jsx)(`div`,{style:{fontSize:12,color:`#aaa`,marginBottom:4},children:e.title}),(0,x.jsx)(`div`,{style:{position:`relative`,flex:1,minHeight:200,background:`#111`},children:(0,x.jsx)(`canvas`,{id:e.canvas,style:{position:`absolute`,inset:0,width:`100%`,height:`100%`}})})]},e.canvas)}function P(e){return e.toFixed(0)}function F(e){let{layer:t,viewport:n}=e;return t.id.endsWith(`@${n.id}`)}function I(e){return[e.view,S]}function L(e){return new t({id:e.view,canvasId:e.canvas,controller:!0})}function R(e){return e.canvas}function z(){let e=(0,y.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=h(),e[0]=t):t=e[0];let n=t,r;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,x.jsx)(m,{source:n,children:(0,x.jsx)(M,{})}),e[1]=r):r=e[1],r}export{z as default};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{B as t,D as n,H as r,b as i,n as a,t as o}from"./jsx-runtime-CGSxa44d.js";import{c as s,l as c,t as l,u}from"./fixtureUrls-CCOMCYin.js";import{t as d}from"./compiler-runtime-CAfxf4JJ.js";import{n as f}from"./dist-Cni3pAA9.js";var p=d(),m=e(n(),1),h=o(),g=new URLSearchParams(window.location.search),_=g.get(`device`)===`webgl`?`webgl`:`webgpu`,v=g.get(`element`)===`multiscale`?`blobs_multiscale_labels`:`blobs_labels`,y=g.get(`fix`)!==`0`,b=600,x=40,S={target:[256,256,0],zoom:0};function C(e){return[e&255,e>>8&255,255,255]}function w(e,t,n,r){return r===0||e===0&&t===0&&n===0?0:n===255&&r===255?e+256*t:`ambiguous`}function T(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)&&!(e instanceof BigInt64Array)&&!(e instanceof BigUint64Array)}async function ee(e){let{data:t}=await e[0].getRaster({selection:{}}),n=new Set;if(!T(t))return n;for(let e=0;e<t.length;e++)t[e]>0&&n.add(t[e]);return n}var te={correct:`rgba(0,255,0,0.9)`,wrongId:`rgba(255,0,0,1)`,missed:`rgba(255,160,0,1)`,spurious:`rgba(255,0,255,1)`,background:`rgba(255,255,255,0.25)`,ambiguous:`rgba(120,120,120,0.6)`};function E(){let e=(0,p.c)(33),{spatialData:n}=s(),a=(0,m.useRef)(null),o=(0,m.useRef)(null),c=(0,m.useRef)(null),l=(0,m.useRef)(null),[d,g]=(0,m.useState)(null),[y,C]=(0,m.useState)(null),[T,E]=(0,m.useState)(`loading…`),[O,k]=(0,m.useState)(null),A;e[0]===n?.labels?A=e[1]:(A=()=>{let e=n?.labels?.[v];if(!e)return;let t=!1;return(async()=>{let n=await u(e.getStore()),r=await ee(n),i=Object.fromEntries([...r].map(D));t||(g(n),C({fillColorByFeatureId:i}),E(`${v}: ${n.length} level(s), ${r.size} labels`))})().catch(e=>{t||E(`load failed: ${e}`)}),()=>{t=!0}},e[0]=n?.labels,e[1]=A);let j;e[2]===n?j=e[3]:(j=[n],e[2]=n,e[3]=j),(0,m.useEffect)(A,j);let M;e[4]!==y||e[5]!==d?(M=d&&y?[new i({id:`labels:${v}`,loader:d,selections:[{}],featureState:y,channelOpacities:[1],channelOutlineOpacities:[0],channelStrokeWidths:[0],channelsFilled:[!0]})]:[],e[4]=y,e[5]=d,e[6]=M):M=e[6];let N=M,P,F;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{if(!a.current)return;let e=document.createElement(`canvas`);e.style.width=`${b}px`,e.style.height=`${b}px`,a.current.prepend(e);let n=new r({canvas:e,width:b,height:b,useDevicePixels:!1,..._===`webgpu`?{deviceProps:{type:`webgpu`,adapters:[f]}}:{},views:new t({id:`diag`,controller:!0}),initialViewState:S,onDeviceInitialized:ae,onAfterRender:()=>{let t=l.current;if(!t)return;l.current=null;let n=document.createElement(`canvas`);n.width=e.width,n.height=e.height;let r=n.getContext(`2d`,{willReadFrequently:!0});r&&(r.drawImage(e,0,0),t(r.getImageData(0,0,e.width,e.height)))},onError:e=>E(`deck error: ${e.message}`)});return c.current=n,()=>{n.finalize(),c.current=null,e.remove()}},F=[],e[7]=P,e[8]=F):(P=e[7],F=e[8]),(0,m.useEffect)(P,F);let I,L;e[9]===N?(I=e[10],L=e[11]):(I=()=>{c.current?.setProps({layers:N})},L=[N],e[9]=N,e[10]=I,e[11]=L),(0,m.useEffect)(I,L);let R;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(R=async()=>{let e=c.current;if(!e)return;E(`capturing frame…`);let t=await new Promise(t=>{l.current=t,e.redraw(`pick-diagnostic`)}),n=(e,n)=>{let r=(Math.floor(n)*t.width+Math.floor(e))*4,i=t.data;return w(i[r],i[r+1],i[r+2],i[r+3])};E(`picking…`);let r={correct:0,wrongId:0,missed:0,spurious:0,background:0,ambiguous:0},i=[],a=0;for(let t=0;t<x;t++)for(let o=0;o<x;o++){let s=Math.floor(b*(o+.5)/x),c=Math.floor(b*(t+.5)/x),l=n(s,c),u=(await e.pickObjectAsync({x:s,y:c,radius:0}))?.object?.labelId,d=typeof u==`number`?u:0,f;f=l===`ambiguous`?`ambiguous`:l===0?d===0?`background`:`spurious`:d===0?`missed`:d===l?`correct`:`wrongId`,(f===`wrongId`||f===`missed`||f===`spurious`)&&n(s,599-c)===d&&(a+=1),r[f]=r[f]+1,i.push({x:s,y:c,outcome:f})}k({counts:r,explainedByMirror:a,marks:i}),E(`done`)},e[12]=R):R=e[12];let oe=R,z;e[13]===O?.marks?z=e[14]:(z=()=>{let e=o.current,t=e?.getContext(`2d`);if(!(!e||!t)){t.clearRect(0,0,e.width,e.height);for(let e of O?.marks??[]){t.fillStyle=te[e.outcome];let n=e.outcome===`correct`||e.outcome===`background`?1.5:3;t.beginPath(),t.arc(e.x,e.y,n,0,Math.PI*2),t.fill()}}},e[13]=O?.marks,e[14]=z);let B;e[15]===O?B=e[16]:(B=[O],e[15]=O,e[16]=B),(0,m.useEffect)(z,B);let V;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(V=[`webgpu`,`webgl`],e[17]=V):V=e[17];let H;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(H=V.flatMap(ie),e[18]=H):H=e[18];let U=H,W,G,K;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(W={padding:12,fontSize:12},G=(0,h.jsx)(`div`,{style:{display:`flex`,gap:12,marginBottom:8},children:U.map(re)}),K={marginBottom:8},e[19]=W,e[20]=G,e[21]=K):(W=e[19],G=e[20],K=e[21]);let q;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,h.jsx)(`button`,{type:`button`,onClick:oe,children:`scan`}),e[22]=q):q=e[22];let J;e[23]===T?J=e[24]:(J=(0,h.jsxs)(`div`,{style:K,children:[T,` · pan/zoom, then`,` `,q,` `]}),e[23]=T,e[24]=J);let Y;e[25]===O?Y=e[26]:(Y=O?(0,h.jsxs)(`div`,{style:{marginBottom:8,fontFamily:`monospace`},children:[Object.entries(O.counts).map(ne).join(` · `),` `,`· wrong results explained by y-mirror `,O.explainedByMirror]}):null,e[25]=O,e[26]=Y);let X;e[27]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,h.jsx)(`div`,{style:{color:`#888`,marginBottom:8},children:`marks: green correct · red wrong id · orange missed (label drawn, pick empty) · magenta spurious (background drawn, pick found a label) · grey edge pixel (skipped)`}),e[27]=X):X=e[27];let Z;e[28]===Symbol.for(`react.memo_cache_sentinel`)?(Z={position:`relative`,width:b,height:b,background:`#000`},e[28]=Z):Z=e[28];let Q;e[29]===Symbol.for(`react.memo_cache_sentinel`)?(Q=(0,h.jsx)(`div`,{ref:a,style:Z,children:(0,h.jsx)(`canvas`,{ref:o,width:b,height:b,style:{position:`absolute`,inset:0,pointerEvents:`none`}})}),e[29]=Q):Q=e[29];let $;return e[30]!==J||e[31]!==Y?($=(0,h.jsxs)(`div`,{style:W,children:[G,J,Y,X,Q]}),e[30]=J,e[31]=Y,e[32]=$):$=e[32],$}function ne(e){let[t,n]=e;return`${t} ${n}`}function re(e){return(0,h.jsx)(`a`,{href:e.href,style:{color:e.active?`#fff`:`#8af`},children:e.label},e.href)}function ie(e){return[`single`,`multiscale`].flatMap(t=>(e===`webgpu`?[!0,!1]:[!0]).map(n=>({href:`?device=${e}&element=${t}${n?``:`&fix=0`}`,label:`${e} / ${t}${e===`webgpu`&&!n?` / unpatched`:``}`,active:e===_&&t===`multiscale`==(v===`blobs_multiscale_labels`)&&(e!==`webgpu`||n===y)})))}function ae(e){y&&a(e)}function D(e){return[String(e),C(e)]}function O(){let e=(0,p.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=l(),e[0]=t):t=e[0];let n=t,r;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,h.jsx)(c,{source:n,children:(0,h.jsx)(E,{})}),e[1]=r):r=e[1],r}export{O as default};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,t as n}from"./jsx-runtime-CGSxa44d.js";import{c as r,l as i,t as a}from"./fixtureUrls-CCOMCYin.js";import{a as o}from"./src-CDsD7llV.js";import{t as s}from"./compiler-runtime-CAfxf4JJ.js";var c=s(),l=e(t(),1),u=n(),d=`blobs_circles`,f=`global`,p=[255,40,40],m=[40,220,40],h=(e,t,n,r)=>({kind:`spatial`,id:e,visible:!0,source:{elementType:`shapes`,elementKey:d,coordinateSystem:f},props:{opacity:1,strokeColor:[255,255,255,220],strokeWidth:1,fillColorByColumn:{columnName:t,mode:`categorical`,categoricalPalette:{byValue:r}},featureState:{hiddenFeatureIds:n}}}),g={schemaVersion:1,entries:[h(`layer-a`,`a`,[`1`,`3`],{red:p}),h(`layer-b`,`b`,[`0`,`2`,`4`],{green:m})]};function _(e,t){let n={getTableKeys:()=>({region:[d],regionKey:`region`,instanceKey:`instance_id`}),loadObsIndex:async()=>[`0`,`1`,`2`,`3`,`4`],loadObsColumns:async e=>((e.includes(`a`)||e.includes(`b`))&&t(e),e.map(e=>e===`region`?[,,,,,].fill(d):[,,,,,].fill(e===`a`?`red`:`green`))),getObsColumnKinds:e=>e.map(()=>`categorical`)},r=Object.create(e),i=e.shapes?.[d];if(i){let t=Object.create(i);t.loadRenderData=async()=>({...await i.loadRenderData(),rowIndexByFeatureIndex:Int32Array.from([0,1,2,3,4])}),r.shapes={...e.shapes,[d]:t}}return r.getAssociatedTables=(t,r)=>t===`shapes`&&r===d?[[`shapes_table`,n]]:e.getAssociatedTables(t,r),r.getAssociatedTable=(e,t)=>r.getAssociatedTables(e,t)[0],r}function v(e){let t=(0,c.c)(11),{onFetch:n}=e,{spatialData:i,loading:a,error:s}=r(),[d,p]=(0,l.useState)(null),m;t[0]!==n||t[1]!==i?(m=i?_(i,n):null,t[0]=n,t[1]=i,t[2]=m):m=t[2];let h=m;if(a){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,u.jsx)(`div`,{style:{padding:16,color:`#888`},children:`Loading blobs fixture…`}),t[3]=e):e=t[3],e}if(s||!h){let e;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e={padding:16,color:`#a88`},t[4]=e):e=t[4];let n=s?.message??`No data.`,r;return t[5]===n?r=t[6]:(r=(0,u.jsx)(`div`,{style:e,children:n}),t[5]=n,t[6]=r),r}let v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(v={width:`100%`,height:`100%`},t[7]=v):v=t[7];let y;return t[8]!==h||t[9]!==d?(y=(0,u.jsx)(o,{spatialData:h,coordinateSystem:f,renderStack:g,viewState:d,onViewStateChange:p,renderTooltip:!1,style:v}),t[8]=h,t[9]=d,t[10]=y):y=t[10],y}function y(){let e=(0,c.c)(15),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=a(),e[0]=t):t=e[0];let n=t,[r,o]=(0,l.useState)(0),s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>o(b),e[1]=s):s=e[1];let f=s,h,g;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(h={display:`flex`,flexDirection:`column`,height:`100%`,minHeight:0},g={flexShrink:0,padding:`10px 12px`,borderBottom:`1px solid #333`,background:`#1e1e1e`,fontSize:12},e[2]=h,e[3]=g):(h=e[2],g=e[3]);let _;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,u.jsx)(`code`,{children:d}),e[4]=_):_=e[4];let y;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,u.jsx)(`code`,{children:`a`}),e[5]=y):y=e[5];let x;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,u.jsx)(`span`,{style:{color:`rgb(${p})`},children:`red`}),e[6]=x):x=e[6];let S;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,u.jsx)(`code`,{children:`b`}),e[7]=S):S=e[7];let C;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,u.jsx)(`span`,{style:{color:`rgb(${m})`},children:`green`}),e[8]=C):C=e[8];let w;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(w={color:`#888`,marginTop:4},e[9]=w):w=e[9];let T;e[10]===r?T=e[11]:(T=(0,u.jsxs)(`div`,{style:g,children:[`Two shapes layers over `,_,`: layer A (even circles) colours by`,` `,y,` and should be `,x,`; layer B (odd circles) colours by `,S,` and should be`,` `,C,`.`,(0,u.jsxs)(`div`,{style:w,children:[`Column reads: `,(0,u.jsx)(`code`,{"data-testid":`fetches`,children:r}),` (two per column under StrictMode, then it stops; it keeps climbing if the layers evict each other)`]})]}),e[10]=r,e[11]=T);let E;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,u.jsx)(`div`,{style:{flex:1,minHeight:0,position:`relative`},children:(0,u.jsx)(v,{onFetch:f})}),e[12]=E):E=e[12];let D;return e[13]===T?D=e[14]:(D=(0,u.jsx)(i,{source:n,children:(0,u.jsxs)(`div`,{style:h,children:[T,E]})}),e[13]=T,e[14]=D),D}function b(e){return e+1}export{y as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./rolldown-runtime-hePW80VL.js";var t=e(((e,t)=>{t.exports={}}));export default t();
@@ -0,0 +1 @@
1
+ import{t as e}from"./parquet-worker-CJbArzoh.js";var t=e(((e,t)=>{t.exports={}}));export default t();
@@ -0,0 +1 @@
1
+ import{y as e}from"./shader-type-decoder-Di2Xle6p.js";var t=`modulepreload`,n=function(e){return`/`+e},r={},i=function(e,i,a){let o=Promise.resolve();if(i&&i.length>0){let e=document.getElementsByTagName(`link`),s=document.querySelector(`meta[property=csp-nonce]`),c=s?.nonce||s?.getAttribute(`nonce`);function l(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function u(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}o=l(i.map(i=>{if(i=n(i,a),i=u(i),i in r)return;r[i]=!0;let o=i.endsWith(`.css`);for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.href===i&&(!o||n.rel===`stylesheet`))return}let s=document.createElement(`link`);if(s.rel=o?`stylesheet`:t,o||(s.as=`script`),s.crossOrigin=``,s.href=i,c&&s.setAttribute(`nonce`,c),document.head.appendChild(s),o)return new Promise((e,t)=>{s.addEventListener(`load`,e),s.addEventListener(`error`,()=>t(Error(`Unable to preload CSS for ${i}`)))})}))}function s(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return o.then(t=>{for(let e of t||[])e.status===`rejected`&&s(e.reason);return e().catch(s)})},a=class{get pageLoaded(){return l()}},o=e()&&typeof document<`u`,s=()=>o&&document.readyState===`complete`,c=null;function l(){return c||=s()||typeof window>`u`?Promise.resolve():new Promise(e=>window.addEventListener(`load`,()=>e())),c}export{i as n,a as t};
@@ -0,0 +1 @@
1
+ import{n as e,t,u as n}from"./shader-type-decoder-Di2Xle6p.js";function r(e,t={}){let r={...e},i=t.layout??`std140`,a={},s=0;for(let[e,t]of Object.entries(r))s=o(a,e,t,s,i);return s=n(s,c(r,i)),{layout:i,byteLength:s*4,uniformTypes:r,fields:a}}function i(n,r){let i=e(n),a=t(i),o=/^mat(\d)x(\d)<.+>$/.exec(i);if(o){let e=Number(o[1]),t=Number(o[2]),n=l(t,i,a.type,r),s=f(n.size,n.alignment,r);return{alignment:n.alignment,size:e*s,components:e*t,columns:e,rows:t,columnStride:s,shaderType:i,type:a.type}}let s=/^vec(\d)<.+>$/.exec(i);return s?l(Number(s[1]),i,a.type,r):{alignment:1,size:1,components:1,columns:1,rows:1,columnStride:1,shaderType:i,type:a.type}}function a(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function o(e,t,r,s,l){if(typeof r==`string`){let a=i(r,l),o=n(s,a.alignment);return e[t]={offset:o,...a},o+a.size}if(Array.isArray(r)){if(Array.isArray(r[0]))throw Error(`Nested arrays are not supported for ${t}`);let i=r[0],a=r[1],d=u(i,l),f=n(s,c(r,l));for(let n=0;n<a;n++)o(e,`${t}[${n}]`,i,f+n*d,l);return f+d*a}if(a(r)){let i=c(r,l),a=n(s,i);for(let[n,i]of Object.entries(r))a=o(e,`${t}.${n}`,i,a,l);return n(a,i)}throw Error(`Unsupported CompositeShaderType for ${t}`)}function s(e,t){if(typeof e==`string`)return i(e,t).size;if(Array.isArray(e)){let n=e[0],r=e[1];if(Array.isArray(n))throw Error(`Nested arrays are not supported`);return u(n,t)*r}let r=0;for(let i of Object.values(e)){let e=i;r=n(r,c(e,t)),r+=s(e,t)}return n(r,c(e,t))}function c(e,t){if(typeof e==`string`)return i(e,t).alignment;if(Array.isArray(e)){let n=e[0],r=c(n,t);return p(t)?Math.max(r,4):r}let n=1;for(let r of Object.values(e)){let e=c(r,t);n=Math.max(n,e)}return m(t)?Math.max(n,4):n}function l(e,t,n,r){return{alignment:e===2?2:4,size:e===3?3:e,components:e,columns:1,rows:e,columnStride:e===3?3:e,shaderType:t,type:n}}function u(e,t){return d(s(e,t),c(e,t),t)}function d(e,t,r){return n(e,p(r)?4:t)}function f(e,t,r){return r===`std140`?4:n(e,t)}function p(e){return e===`std140`||e===`wgsl-uniform`}function m(e){return e===`std140`||e===`wgsl-uniform`}var h;function g(e){return(!h||h.byteLength<e)&&(h=new ArrayBuffer(e)),h}function _(e,t){return new e(g(e.BYTES_PER_ELEMENT*t),0,t)}export{r as a,a as i,g as n,i as r,_ as t};
@@ -0,0 +1 @@
1
+ function e(e,t){let n=e.length-t,r=0;do{for(let n=t;n>0;n--)e[r+t]+=e[r],r++;n-=t}while(n>0)}function t(e,t,n){let r=0,i=e.length,a=i/n;for(;i>t;){for(let n=t;n>0;--n)e[r+t]+=e[r],++r;i-=t}let o=e.slice();for(let t=0;t<a;++t)for(let r=0;r<n;++r)e[n*t+r]=o[(n-r-1)*a+t]}function n(n,r,i,a,o,s){if(!r||r===1)return n;for(let e=0;e<o.length;++e){if(o[e]%8!=0)throw Error(`When decoding with predictor, only multiple of 8 bits are supported.`);if(o[e]!==o[0])throw Error(`When decoding with predictor, all samples must have the same size.`)}let c=o[0]/8,l=s===2?1:o.length;for(let s=0;s<a&&!(s*l*i*c>=n.byteLength);++s){let a;if(r===2){switch(o[0]){case 8:a=new Uint8Array(n,s*l*i*c,l*i*c);break;case 16:a=new Uint16Array(n,s*l*i*c,l*i*c/2);break;case 32:a=new Uint32Array(n,s*l*i*c,l*i*c/4);break;default:throw Error(`Predictor 2 not allowed with ${o[0]} bits per sample.`)}e(a,l,c)}else r===3&&(a=new Uint8Array(n,s*l*i*c,l*i*c),t(a,l,c))}return n}var r=class{async decode(e,t){let r=await this.decodeBlock(t),i=e.Predictor||1;if(i!==1){let t=!e.StripOffsets;return n(r,i,t?e.TileWidth:e.ImageWidth,t?e.TileLength:e.RowsPerStrip||e.ImageLength,e.BitsPerSample,e.PlanarConfiguration)}return r}};export{r as t};