@ducklings/browser 1.4.3-dev.3 → 1.4.4-dev.1
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.
- package/README.md +50 -5
- package/dist/index.d.ts +21 -6
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/wasm/duckdb.js +1 -1
- package/dist/wasm/duckdb.wasm +0 -0
- package/dist/worker.js +1 -1
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ await db.close();
|
|
|
34
34
|
- Async API - queries run in Web Worker, UI stays responsive
|
|
35
35
|
- ~5.7MB gzipped WASM
|
|
36
36
|
- Built-in Parquet, JSON, and httpfs extensions
|
|
37
|
-
- Arrow Table support via Flechette
|
|
37
|
+
- Arrow Table support via Flechette (query + insert)
|
|
38
38
|
- Prepared statements with type-safe parameter binding
|
|
39
39
|
- Streaming results for large datasets
|
|
40
40
|
- Transaction support
|
|
@@ -83,6 +83,33 @@ Load directly from jsDelivr or unpkg - cross-origin workers are handled automati
|
|
|
83
83
|
</script>
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
+
### Bundler Usage (Vite / Webpack)
|
|
87
|
+
|
|
88
|
+
When using a bundler, import asset URLs explicitly instead of relying on auto-resolution:
|
|
89
|
+
|
|
90
|
+
**Vite:**
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
import { init, DuckDB } from '@ducklings/browser';
|
|
94
|
+
import wasmUrl from '@ducklings/browser/wasm/duckdb.wasm?url';
|
|
95
|
+
import wasmJsUrl from '@ducklings/browser/wasm/duckdb.js?url';
|
|
96
|
+
import workerUrl from '@ducklings/browser/worker?url';
|
|
97
|
+
|
|
98
|
+
await init({ wasmUrl, wasmJsUrl, workerUrl });
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Webpack:**
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
import { init, DuckDB } from '@ducklings/browser';
|
|
105
|
+
|
|
106
|
+
const wasmUrl = new URL('@ducklings/browser/wasm/duckdb.wasm', import.meta.url).href;
|
|
107
|
+
const wasmJsUrl = new URL('@ducklings/browser/wasm/duckdb.js', import.meta.url).href;
|
|
108
|
+
const workerUrl = new URL('@ducklings/browser/worker', import.meta.url).href;
|
|
109
|
+
|
|
110
|
+
await init({ wasmUrl, wasmJsUrl, workerUrl });
|
|
111
|
+
```
|
|
112
|
+
|
|
86
113
|
### Query Methods
|
|
87
114
|
|
|
88
115
|
```typescript
|
|
@@ -96,6 +123,10 @@ const table = await conn.queryArrow('SELECT * FROM users');
|
|
|
96
123
|
|
|
97
124
|
// Execute without returning results
|
|
98
125
|
await conn.execute('INSERT INTO users VALUES (1, "Alice")');
|
|
126
|
+
|
|
127
|
+
// Insert Arrow IPC data into a table
|
|
128
|
+
const ipc = tableToIPC(arrowTable, { format: 'stream' });
|
|
129
|
+
await conn.insertArrowFromIPCStream('my_table', ipc);
|
|
99
130
|
```
|
|
100
131
|
|
|
101
132
|
### Prepared Statements
|
|
@@ -149,7 +180,7 @@ const rows = await conn.query(`
|
|
|
149
180
|
### Arrow Support
|
|
150
181
|
|
|
151
182
|
```typescript
|
|
152
|
-
import { tableFromArrays, tableFromIPC, tableToIPC } from '@ducklings/browser';
|
|
183
|
+
import { tableFromArrays, tableFromIPC, tableToIPC, utf8 } from '@ducklings/browser';
|
|
153
184
|
|
|
154
185
|
// Query as Arrow Table
|
|
155
186
|
const table = await conn.queryArrow('SELECT * FROM users');
|
|
@@ -160,11 +191,25 @@ const custom = tableFromArrays({
|
|
|
160
191
|
name: ['Alice', 'Bob', 'Charlie']
|
|
161
192
|
});
|
|
162
193
|
|
|
163
|
-
//
|
|
164
|
-
const
|
|
165
|
-
|
|
194
|
+
// Serialize to/from Arrow IPC
|
|
195
|
+
const bytes = tableToIPC(table, { format: 'stream' });
|
|
196
|
+
const restored = tableFromIPC(bytes);
|
|
197
|
+
|
|
198
|
+
// Insert Arrow IPC data directly into a table
|
|
199
|
+
const data = tableFromArrays(
|
|
200
|
+
{ id: [1, 2], label: ['x', 'y'] },
|
|
201
|
+
{ types: { label: utf8() } } // Use plain utf8 (see note below)
|
|
202
|
+
);
|
|
203
|
+
const ipc = tableToIPC(data, { format: 'stream' });
|
|
204
|
+
await conn.insertArrowFromIPCStream('my_table', ipc);
|
|
166
205
|
```
|
|
167
206
|
|
|
207
|
+
> **Dictionary encoding:** Flechette's `tableFromArrays()` defaults to `dictionary(utf8())` for string columns. The Arrow IPC decoder used internally does not support dictionary-encoded streams. When building tables for `insertArrowFromIPCStream()`, explicitly set string columns to `utf8()`:
|
|
208
|
+
> ```typescript
|
|
209
|
+
> import { utf8 } from '@ducklings/browser';
|
|
210
|
+
> tableFromArrays({ col: ['a', 'b'] }, { types: { col: utf8() } });
|
|
211
|
+
> ```
|
|
212
|
+
|
|
168
213
|
## Cloudflare Workers
|
|
169
214
|
|
|
170
215
|
For Cloudflare Workers, use the [`@ducklings/workers`](https://www.npmjs.com/package/@ducklings/workers) package instead, which uses Asyncify for proper httpfs support in the Workers runtime.
|
package/dist/index.d.ts
CHANGED
|
@@ -782,17 +782,32 @@ declare class Connection {
|
|
|
782
782
|
*/
|
|
783
783
|
transaction<T>(fn: () => Promise<T>): Promise<T>;
|
|
784
784
|
/**
|
|
785
|
-
* Insert data from an Arrow IPC buffer.
|
|
785
|
+
* Insert data from an Arrow IPC stream buffer into a table.
|
|
786
786
|
*
|
|
787
|
-
*
|
|
788
|
-
*
|
|
787
|
+
* Creates a new table with the given name from the Arrow IPC data. If the table
|
|
788
|
+
* already exists, the call is a no-op (uses `CREATE TABLE IF NOT EXISTS`).
|
|
789
|
+
*
|
|
790
|
+
* **Important:** The IPC stream must not contain dictionary-encoded columns.
|
|
791
|
+
* Flechette's `tableFromArrays()` defaults to `dictionary(utf8())` for string
|
|
792
|
+
* columns. Use explicit `utf8()` types to avoid this.
|
|
793
|
+
*
|
|
794
|
+
* @param tableName - The name of the table to create
|
|
795
|
+
* @param ipcBuffer - Arrow IPC stream bytes (use `tableToIPC(table, { format: 'stream' })`)
|
|
796
|
+
* @throws When the connection is closed or the IPC data is invalid
|
|
789
797
|
*
|
|
790
798
|
* @example
|
|
791
799
|
* ```typescript
|
|
792
|
-
* import { tableToIPC } from '@
|
|
793
|
-
*
|
|
794
|
-
*
|
|
800
|
+
* import { tableFromArrays, tableToIPC, utf8 } from '@ducklings/browser';
|
|
801
|
+
*
|
|
802
|
+
* const table = tableFromArrays(
|
|
803
|
+
* { id: [1, 2, 3], name: ['Alice', 'Bob', 'Charlie'] },
|
|
804
|
+
* { types: { name: utf8() } } // Required for string columns
|
|
805
|
+
* );
|
|
806
|
+
* const ipcBuffer = tableToIPC(table, { format: 'stream' });
|
|
807
|
+
* await conn.insertArrowFromIPCStream('users', ipcBuffer);
|
|
795
808
|
* ```
|
|
809
|
+
*
|
|
810
|
+
* @category Data Insertion
|
|
796
811
|
*/
|
|
797
812
|
insertArrowFromIPCStream(tableName: string, ipcBuffer: Uint8Array): Promise<void>;
|
|
798
813
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// Ducklings - Minimal DuckDB for browsers
|
|
2
|
-
var Kt="@ducklings/browser",Qt="1.4.3-dev.3";function Lr(n){let e=`https://cdn.jsdelivr.net/npm/${Kt}@${n??Qt}/dist/`;return {mainModule:`${e}index.js`,mainWorker:`${e}worker.js`,wasmModule:`${e}wasm/duckdb.wasm`,wasmJs:`${e}wasm/duckdb.js`}}function Br(n){let e=`https://unpkg.com/${Kt}@${n??Qt}/dist/`;return {mainModule:`${e}index.js`,mainWorker:`${e}worker.js`,wasmModule:`${e}wasm/duckdb.wasm`,wasmJs:`${e}wasm/duckdb.js`}}async function un(n){let t=await fetch(n);if(!t.ok)throw new Error(`Failed to fetch worker script: ${t.status} ${t.statusText}`);let e=await t.blob(),r=URL.createObjectURL(e);return new Worker(r,{type:"module"})}var x=class n extends Error{code;query;constructor(t,e,r){super(t),this.name="DuckDBError",this.code=e,this.query=r,Error.captureStackTrace&&Error.captureStackTrace(this,n);}static fromObject(t){return new n(t.message,t.code,t.query)}toObject(){return {message:this.message,code:this.code,query:this.query}}};var Jt=class{messageId;type;_resolve;_reject;promise;constructor(t,e){this.messageId=t,this.type=e,this._resolve=()=>{},this._reject=()=>{},this.promise=new Promise((r,s)=>{this._resolve=r,this._reject=s;});}resolve(t){this._resolve(t);}reject(t){this._reject(t);}};var xt=Uint8Array.of(65,82,82,79,87,49),k={V1:0,V4:3,V5:4},dn={Little:0},v={NONE:0,Schema:1,DictionaryBatch:2,RecordBatch:3,Tensor:4,SparseTensor:5},i={Dictionary:-1,NONE:0,Null:1,Int:2,Float:3,Binary:4,Utf8:5,Bool:6,Decimal:7,Date:8,Time:9,Timestamp:10,Interval:11,List:12,Struct:13,Union:14,FixedSizeBinary:15,FixedSizeList:16,Map:17,Duration:18,LargeBinary:19,LargeUtf8:20,LargeList:21,RunEndEncoded:22,BinaryView:23,Utf8View:24,ListView:25,LargeListView:26},$={HALF:0,SINGLE:1,DOUBLE:2},V={DAY:0,MILLISECOND:1},I={SECOND:0,MILLISECOND:1,MICROSECOND:2,NANOSECOND:3},C={YEAR_MONTH:0,DAY_TIME:1,MONTH_DAY_NANO:2},W={Sparse:0,Dense:1};var q=Uint8Array,Tt=Uint16Array,bt=Uint32Array,ft=BigUint64Array,tt=Int8Array,fn=Int16Array,b=Int32Array,A=BigInt64Array,Xt=Float32Array,Y=Float64Array;function Xn(n){return n instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer}function Zn(n,t){let e=Math.log2(n)-3;return (t?[tt,fn,b,A]:[q,Tt,bt,ft])[e]}var Ur=Object.getPrototypeOf(Int8Array);function ln(n){return n instanceof Ur}function Zt(n){return Array.isArray(n)||ln(n)}function lt(n){return n===A||n===ft}function pt(n,t){let e=0,r=n.length;if(r<=2147483648)do{let s=e+r>>>1;n[s]<=t?e=s+1:r=s;}while(e<r);else do{let s=Math.trunc((e+r)/2);n[s]<=t?e=s+1:r=s;}while(e<r);return e}function Mr(n,t=1){return (n*t+7&-8)/t}function tr(n,t=n.length){let e=Mr(t,n.BYTES_PER_ELEMENT);return n.length>e?n.subarray(0,e):n.length<e?er(n,e):n}function er(n,t,e=0){let r=new n.constructor(t);return r.set(n,e),r}function pn(n,t,e){for(;n.length<=t;)n=er(n,n.length<<1,0);return n}function nr(n){return n instanceof Date}function rr(n){return typeof n[Symbol.iterator]=="function"}function te(n,t,e){if(t(n))return n;throw new Error(e(n))}function _(n,t,e){return t=Array.isArray(t)?t:Object.values(t),te(n,r=>t.includes(r),e??(()=>`${n} must be one of ${t}`))}function ee(n,t){for(let[e,r]of Object.entries(n))if(r===t)return e;return "<Unknown>"}var j=n=>`Unsupported data type: "${ee(i,n)}" (id ${n})`,et=(n,t,e=true,r=null)=>({name:n,type:t,nullable:e,metadata:r});function sr(n){return Object.hasOwn(n,"name")&&or(n.type)}function or(n){return typeof n?.typeId=="number"}function K(n,t="",e=true){return sr(n)?n:et(t,te(n,or,()=>"Data type expected."),e)}var ir=n=>({typeId:n}),Ot=(n,t,e=false,r=-1)=>({typeId:i.Dictionary,id:r,dictionary:n,indices:t||Q(),ordered:e}),mn=()=>ir(i.Null),B=(n=32,t=true)=>({typeId:i.Int,bitWidth:_(n,[8,16,32,64]),signed:t,values:Zn(n,t)}),At=()=>B(8),St=()=>B(16),Q=()=>B(32),Ct=()=>B(64),hn=()=>B(8,false),yn=()=>B(16,false),In=()=>B(32,false),gn=()=>B(64,false),Dt=(n=2)=>({typeId:i.Float,precision:_(n,$),values:[Tt,Xt,Y][n]});var En=()=>Dt($.SINGLE),mt=()=>Dt($.DOUBLE),wn=()=>({typeId:i.Binary,offsets:b}),kt=()=>({typeId:i.Utf8,offsets:b}),Rn=()=>ir(i.Bool),xn=(n,t,e=128)=>({typeId:i.Decimal,precision:n,scale:t,bitWidth:_(e,[32,64,128,256]),values:e===32?b:ft});var ne=n=>({typeId:i.Date,unit:_(n,V),values:n===V.DAY?b:A}),Tn=()=>ne(V.DAY);var bn=(n=I.MILLISECOND)=>{n=_(n,I);let t=n===I.SECOND||n===I.MILLISECOND?32:64;return {typeId:i.Time,unit:n,bitWidth:t,values:t===32?b:A}};var vt=(n=I.MILLISECOND,t=null)=>({typeId:i.Timestamp,unit:_(n,I),timezone:t,values:A}),On=(n=C.MONTH_DAY_NANO)=>({typeId:i.Interval,unit:_(n,C),values:n===C.MONTH_DAY_NANO?void 0:b}),_t=n=>({typeId:i.List,children:[K(n)],offsets:b}),Ft=n=>({typeId:i.Struct,children:Array.isArray(n)&&sr(n[0])?n:Object.entries(n).map(([t,e])=>et(t,e))}),An=(n,t,e,r)=>(e??=t.map((s,o)=>o),{typeId:i.Union,mode:_(n,W),typeIds:e,typeMap:e.reduce((s,o,a)=>(s[o]=a,s),{}),children:t.map((s,o)=>K(s,`_${o}`)),typeIdForValue:r,offsets:b}),Sn=n=>({typeId:i.FixedSizeBinary,stride:n}),Nt=(n,t)=>({typeId:i.FixedSizeList,stride:t,children:[K(n)]}),ar=(n,t)=>({typeId:i.Map,keysSorted:n,children:[t],offsets:b});var Cn=(n=I.MILLISECOND)=>({typeId:i.Duration,unit:_(n,I),values:A}),Dn=()=>({typeId:i.LargeBinary,offsets:A}),kn=()=>({typeId:i.LargeUtf8,offsets:A}),vn=n=>({typeId:i.LargeList,children:[K(n)],offsets:A}),_n=(n,t)=>({typeId:i.RunEndEncoded,children:[te(K(n,"run_ends"),e=>e.type.typeId===i.Int,()=>"Run-ends must have an integer type."),K(t,"values")]});var Fn=n=>({typeId:i.ListView,children:[K(n,"value")],offsets:b}),Nn=n=>({typeId:i.LargeListView,children:[K(n,"value")],offsets:A});var ur=new Y(2),re=ur.buffer,Vr=new A(re),ht=new bt(re),cr=new b(re),qr=new q(re);function jr(n){return n}function P(n){return BigInt(n)}function se(n){return lt(n)?P:jr}function dr(n){return n/864e5|0}function fr(n){return n===I.SECOND?t=>P(t/1e3):n===I.MILLISECOND?P:n===I.MICROSECOND?t=>P(t*1e3):t=>P(t*1e6)}function lr([n,t,e]){return cr[0]=n,cr[1]=t,Vr[1]=P(e),qr}function G(n){if(n>Number.MAX_SAFE_INTEGER||n<Number.MIN_SAFE_INTEGER)throw Error(`BigInt exceeds integer number representation: ${n}`);return Number(n)}function oe(n,t){return Number(n/t)+Number(n%t)/Number(t)}function pr(n){return t=>typeof t=="bigint"?Number(t):Math.trunc(t*n)}function mr(n,t,e,r,s){let o=typeof n=="bigint"?n:P(Math.trunc(n*s));t[e]=o,r>1&&(t[e+1]=o>>64n,r>2&&(t[e+2]=o>>128n,t[e+3]=o>>192n));}var yt=n=>BigInt.asUintN(64,n);function hr(n,t){return BigInt.asIntN(64,n[t])}function yr(n,t){let e=t<<1,r;return BigInt.asIntN(64,n[e+1])<0?(r=yt(~n[e])|yt(~n[e+1])<<64n,r=-(r+1n)):r=n[e]|n[e+1]<<64n,r}function Ir(n,t){let e=t<<2,r;return BigInt.asIntN(64,n[e+3])<0?(r=yt(~n[e])|yt(~n[e+1])<<64n|yt(~n[e+2])<<128n|yt(~n[e+3])<<192n,r=-(r+1n)):r=n[e]|n[e+1]<<64n|n[e+2]<<128n|n[e+3]<<192n,r}function gr(n){if(n!==n)return 32256;ur[0]=n;let t=(ht[1]&2147483648)>>16&65535,e=ht[1]&2146435072,r=0;return e>=1089470464?ht[0]>0?e=31744:(e=(e&2080374784)>>16,r=(ht[1]&1048575)>>10):e<=1056964608?(r=1048576+(ht[1]&1048575),r=1048576+(r<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,r=(ht[1]&1048575)+512>>10),t|e|r&65535}var Gr=new TextDecoder("utf-8"),Hr=new TextEncoder;function It(n){return Gr.decode(n)}function Ln(n){return Hr.encode(n)}function gt(n){return `${typeof n!="object"||!n?n??null:nr(n)?+n:Zt(n)?`[${n.map(gt)}]`:zr(n)}`}function zr(n){let t="",e=-1;for(let r in n)++e>0&&(t+=","),t+=`"${r}":${gt(n[r])}`;return `{${t}}`}var nt=4;function Bn(n,t){return (n[t>>3]&1<<t%8)!==0}function O(n,t){let e=t+p(n,t),r=e-p(n,e),s=T(n,r);return (o,a,c=null)=>{if(o<s){let u=T(n,r+o);if(u)return a(n,e+u)}return c}}function U(n,t){return t}function J(n,t){return !!Wr(n,t)}function Wr(n,t){return Lt(n,t)<<24>>24}function Lt(n,t){return n[t]}function T(n,t){return Yr(n,t)<<16>>16}function Yr(n,t){return n[t]|n[t+1]<<8}function p(n,t){return n[t]|n[t+1]<<8|n[t+2]<<16|n[t+3]<<24}function Er(n,t){return p(n,t)>>>0}function R(n,t){return G(BigInt.asIntN(64,BigInt(Er(n,t))+(BigInt(Er(n,t+nt))<<32n)))}function rt(n,t){let e=t+p(n,t),r=p(n,e);return e+=nt,It(n.subarray(e,e+r))}function F(n,t,e,r){if(!t)return [];let s=t+p(n,t);return Array.from({length:p(n,s)},(o,a)=>r(n,s+nt+a*e))}var ie=Symbol("rowIndex");function Bt(n,t){class e{constructor(o){this[ie]=o;}toJSON(){return wr(n,t,this[ie])}}let r=e.prototype;for(let s=0;s<n.length;++s){if(Object.hasOwn(r,n[s]))continue;let o=t[s];Object.defineProperty(r,n[s],{get(){return o.at(this[ie])},enumerable:true});}return s=>new e(s)}function ae(n,t){return e=>wr(n,t,e)}function wr(n,t,e){let r={};for(let s=0;s<n.length;++s)r[n[s]]=t[s].at(e);return r}function Rr(n){return n instanceof H}var st=class{static ArrayType=null;constructor({length:t,nullCount:e,type:r,validity:s,values:o,offsets:a,sizes:c,children:u}){this.length=t,this.nullCount=e,this.type=r,this.validity=s,this.values=o,this.offsets=a,this.sizes=c,this.children=u,(!e||!this.validity)&&(this.at=d=>this.value(d));}get[Symbol.toStringTag](){return "Batch"}at(t){return this.isValid(t)?this.value(t):null}isValid(t){return Bn(this.validity,t)}value(t){return this.values[t]}slice(t,e){let r=e-t,s=Array(r);for(let o=0;o<r;++o)s[o]=this.at(t+o);return s}*[Symbol.iterator](){for(let t=0;t<this.length;++t)yield this.at(t);}},H=class extends st{constructor(t){super(t);let{length:e,values:r}=this;this.values=r.subarray(0,e);}slice(t,e){return this.nullCount?super.slice(t,e):this.values.subarray(t,e)}[Symbol.iterator](){return this.nullCount?super[Symbol.iterator]():this.values[Symbol.iterator]()}},Et=class extends st{static ArrayType=Y},g=class extends st{static ArrayType=Array},wt=class extends g{value(t){return null}},M=class extends Et{value(t){return G(this.values[t])}},ce=class extends Et{value(t){let e=this.values[t],r=(e&31744)>>10,s=(e&1023)/1024,o=(-1)**((e&32768)>>15);switch(r){case 31:return o*(s?Number.NaN:1/0);case 0:return o*(s?6103515625e-14*s:0)}return o*2**(r-15)*(1+s)}},ue=class extends g{value(t){return Bn(this.values,t)}},de=class extends Et{constructor(t){super(t);let{scale:e}=this.type;this.scale=10**e;}value(t){return this.values[t]/this.scale}},fe=class extends st{constructor(t){super(t);let{bitWidth:e,scale:r}=this.type;this.decimal=e===64?hr:e===128?yr:Ir,this.scale=10n**BigInt(r);}},le=class extends fe{static ArrayType=Y;value(t){return oe(this.decimal(this.values,t),this.scale)}},pe=class extends fe{static ArrayType=Array;value(t){return this.decimal(this.values,t)}},Pt=class extends g{constructor(t){super(t),this.source=t;}value(t){return new Date(this.source.value(t))}},me=class extends Et{value(t){return 864e5*this.values[t]}},xr=M,he=class extends M{value(t){return super.value(t)*1e3}},Tr=M,ye=class extends M{value(t){return oe(this.values[t],1000n)}},Ie=class extends M{value(t){return oe(this.values[t],1000000n)}},ge=class extends g{value(t){return this.values.subarray(t<<1,t+1<<1)}},Ee=class extends g{value(t){let e=this.values,r=t<<4;return Float64Array.of(p(e,r),p(e,r+4),R(e,r+8))}},br=({values:n,offsets:t},e)=>n.subarray(t[e],t[e+1]),Or=({values:n,offsets:t},e)=>n.subarray(G(t[e]),G(t[e+1])),we=class extends g{value(t){return br(this,t)}},Re=class extends g{value(t){return Or(this,t)}},xe=class extends g{value(t){return It(br(this,t))}},Te=class extends g{value(t){return It(Or(this,t))}},be=class extends g{value(t){let e=this.offsets;return this.children[0].slice(e[t],e[t+1])}},Oe=class extends g{value(t){let e=this.offsets;return this.children[0].slice(G(e[t]),G(e[t+1]))}},Ae=class extends g{value(t){let e=this.offsets[t],r=e+this.sizes[t];return this.children[0].slice(e,r)}},Se=class extends g{value(t){let e=this.offsets[t],r=e+this.sizes[t];return this.children[0].slice(G(e),G(r))}},Ce=class extends g{constructor(t){super(t),this.stride=this.type.stride;}},De=class extends Ce{value(t){let{stride:e,values:r}=this;return r.subarray(t*e,(t+1)*e)}},ke=class extends Ce{value(t){let{children:e,stride:r}=this;return e[0].slice(t*r,(t+1)*r)}};function Ar({children:n,offsets:t},e){let[r,s]=n[0].children,o=t[e],a=t[e+1],c=[];for(let u=o;u<a;++u)c.push([r.at(u),s.at(u)]);return c}var ve=class extends g{value(t){return Ar(this,t)}},_e=class extends g{value(t){return new Map(Ar(this,t))}},Ut=class extends g{constructor({typeIds:t,...e}){super(e),this.typeIds=t,this.typeMap=this.type.typeMap;}value(t,e=t){let{typeIds:r,children:s,typeMap:o}=this;return s[o[r[t]]].at(e)}},Fe=class extends Ut{value(t){return super.value(t,this.offsets[t])}},Mt=class extends g{constructor(t,e=ae){super(t),this.names=this.type.children.map(r=>r.name),this.factory=e(this.names,this.children);}value(t){return this.factory(t)}},Ne=class extends Mt{constructor(t){super(t,Bt);}},Le=class extends g{value(t){let[{values:e},r]=this.children;return r.at(pt(e,t))}},Be=class extends g{setDictionary(t){return this.dictionary=t,this.cache=t.cache(),this}value(t){return this.cache[this.key(t)]}key(t){return this.values[t]}},Pe=class extends g{constructor({data:t,...e}){super(e),this.data=t;}view(t){let{values:e,data:r}=this,s=t<<4,o=s+4,a=e,c=p(a,s);return c>12&&(o=p(a,s+12),a=r[p(a,s+8)]),a.subarray(o,o+c)}},Ue=class extends Pe{value(t){return this.view(t)}},Me=class extends Pe{value(t){return It(this.view(t))}};function Pn(n){let t=[];return {add(e){return t.push(e),this},clear:()=>t=[],done:()=>new z(t,n)}}var z=class{constructor(t,e=t[0]?.type){this.type=e,this.length=t.reduce((o,a)=>o+a.length,0),this.nullCount=t.reduce((o,a)=>o+a.nullCount,0),this.data=t;let r=t.length,s=new Int32Array(r+1);if(r===1){let[o]=t;s[1]=o.length,this.at=a=>o.at(a);}else for(let o=0,a=0;o<r;++o)s[o+1]=a+=t[o].length;this.offsets=s;}get[Symbol.toStringTag](){return "Column"}[Symbol.iterator](){let t=this.data;return t.length===1?t[0][Symbol.iterator]():$r(t)}at(t){let{data:e,offsets:r}=this,s=pt(r,t)-1;return e[s]?.at(t-r[s])}get(t){return this.at(t)}toArray(){let{length:t,nullCount:e,data:r}=this,s=!e&&Rr(r[0]),o=r.length;if(s&&o===1)return r[0].values;let a=!o||e>0?Array:r[0].constructor.ArrayType??r[0].values.constructor,c=new a(t);return s?Kr(c,r):Qr(c,r)}cache(){return this._cache??(this._cache=this.toArray())}};function*$r(n){for(let t=0;t<n.length;++t){let e=n[t][Symbol.iterator]();for(let r=e.next();!r.done;r=e.next())yield r.value;}}function Kr(n,t){for(let e=0,r=0;e<t.length;++e){let{values:s}=t[e];n.set(s,r),r+=s.length;}return n}function Qr(n,t){let e=-1;for(let r=0;r<t.length;++r){let s=t[r];for(let o=0;o<s.length;++o)n[++e]=s.at(o);}return n}var ot=class n{constructor(t,e,r=false){let s=t.fields.map(a=>a.name);this.schema=t,this.names=s,this.children=e,this.factory=r?Bt:ae;let o=[];this.getFactory=a=>o[a]??(o[a]=this.factory(s,e.map(c=>c.data[a])));}get[Symbol.toStringTag](){return "Table"}get numCols(){return this.names.length}get numRows(){return this.children[0]?.length??0}getChildAt(t){return this.children[t]}getChild(t){let e=this.names.findIndex(r=>r===t);return e>-1?this.children[e]:void 0}selectAt(t,e=[]){let{children:r,factory:s,schema:o}=this,{fields:a}=o;return new n({...o,fields:t.map((c,u)=>Jr(a[c],e[u]))},t.map(c=>r[c]),s===Bt)}select(t,e){let r=this.names,s=t.map(o=>r.indexOf(o));return this.selectAt(s,e)}toColumns(){let{children:t,names:e}=this,r={};return e.forEach((s,o)=>r[s]=t[o]?.toArray()??[]),r}toArray(){let{children:t,getFactory:e,numRows:r}=this,s=t[0]?.data??[],o=Array(r);for(let a=0,c=-1;a<s.length;++a){let u=e(a);for(let d=0;d<s[a].length;++d)o[++c]=u(d);}return o}*[Symbol.iterator](){let{children:t,getFactory:e}=this,r=t[0]?.data??[];for(let s=0;s<r.length;++s){let o=e(s);for(let a=0;a<r[s].length;++a)yield o(a);}}at(t){let{children:e,getFactory:r,numRows:s}=this;if(t<0||t>=s)return null;let[{offsets:o}]=e,a=pt(o,t)-1;return r(a)(t-o[a])}get(t){return this.at(t)}};function Jr(n,t){return t!=null&&t!==n.name?{...n,name:t}:n}function it(n,t={}){let{typeId:e,bitWidth:r,mode:s,precision:o,unit:a}=n,{useBigInt:c,useDate:u,useDecimalInt:d,useMap:m,useProxy:l}=t;switch(e){case i.Null:return wt;case i.Bool:return ue;case i.Int:case i.Time:case i.Duration:return c||r<64?H:M;case i.Float:return o?H:ce;case i.Date:return Sr(a===V.DAY?me:xr,u&&Pt);case i.Timestamp:return Sr(a===I.SECOND?he:a===I.MILLISECOND?Tr:a===I.MICROSECOND?ye:Ie,u&&Pt);case i.Decimal:return r===32?d?H:de:d?pe:le;case i.Interval:return a===C.DAY_TIME?ge:a===C.YEAR_MONTH?H:Ee;case i.FixedSizeBinary:return De;case i.Utf8:return xe;case i.LargeUtf8:return Te;case i.Binary:return we;case i.LargeBinary:return Re;case i.BinaryView:return Ue;case i.Utf8View:return Me;case i.List:return be;case i.LargeList:return Oe;case i.Map:return m?_e:ve;case i.ListView:return Ae;case i.LargeListView:return Se;case i.FixedSizeList:return ke;case i.Struct:return l?Ne:Mt;case i.RunEndEncoded:return Le;case i.Dictionary:return Be;case i.Union:return s?Fe:Ut}throw new Error(j(e))}function Sr(n,t){return t?class extends t{constructor(r){super(new n(r));}}:n}function Xr(n,t){return {offset:R(n,t),metadataLength:p(n,t+8),bodyLength:R(n,t+16)}}function Un(n,t){return F(n,t,24,Xr)}function Ve(n,t,e){let r=O(n,t);if(r(10,U,0))throw new Error("Record batch compression not implemented");let s=e<k.V4?8:0;return {length:r(4,R,0),nodes:F(n,r(6,U),16,(o,a)=>({length:R(o,a),nullCount:R(o,a+8)})),regions:F(n,r(8,U),16+s,(o,a)=>({offset:R(o,a+s),length:R(o,a+s+8)})),variadic:F(n,r(12,U),8,R)}}function Cr(n,t,e){let r=O(n,t);return {id:r(4,R,0),data:r(6,(s,o)=>Ve(s,o,e)),isDelta:r(8,J,false)}}function Mn(n,t,e,r){_(e,i,j);let s=O(n,t);switch(e){case i.Binary:return wn();case i.Utf8:return kt();case i.LargeBinary:return Dn();case i.LargeUtf8:return kn();case i.List:return _t(r[0]);case i.ListView:return Fn(r[0]);case i.LargeList:return vn(r[0]);case i.LargeListView:return Nn(r[0]);case i.Struct:return Ft(r);case i.RunEndEncoded:return _n(r[0],r[1]);case i.Int:return B(s(4,p,0),s(6,J,false));case i.Float:return Dt(s(4,T,$.HALF));case i.Decimal:return xn(s(4,p,0),s(6,p,0),s(8,p,128));case i.Date:return ne(s(4,T,V.MILLISECOND));case i.Time:return bn(s(4,T,I.MILLISECOND));case i.Timestamp:return vt(s(4,T,I.SECOND),s(6,rt));case i.Interval:return On(s(4,T,C.YEAR_MONTH));case i.Duration:return Cn(s(4,T,I.MILLISECOND));case i.FixedSizeBinary:return Sn(s(4,p,0));case i.FixedSizeList:return Nt(r[0],s(4,p,0));case i.Map:return ar(s(4,J,false),r[0]);case i.Union:return An(s(4,T,W.Sparse),r,F(n,s(6,U),4,p))}return {typeId:e}}function Vt(n,t){let e=F(n,t,4,(r,s)=>{let o=O(r,s);return [o(4,rt),o(6,rt)]});return e.length?new Map(e):null}function qe(n,t,e){let r=O(n,t);return {version:e,endianness:r(4,T,0),fields:r(6,Zr,[]),metadata:r(8,Vt)}}function Zr(n,t){return F(n,t,4,Dr)}function Dr(n,t){let e=O(n,t),r=e(8,Lt,i.NONE),s=e(10,U,0),o=e(12,es),a=e(14,(u,d)=>ts(u,d)),c=Mn(n,s,r,a);return o&&(o.dictionary=c,c=o),{name:e(4,rt),type:c,nullable:e(6,J,false),metadata:e(16,Vt)}}function ts(n,t){let e=F(n,t,4,Dr);return e.length?e:null}function es(n,t){if(!t)return null;let e=O(n,t);return Ot(null,e(6,ns,Q()),e(8,J,false),e(4,R,0))}function ns(n,t){return Mn(n,t,i.Int)}var rs=(n,t)=>`Expected to read ${n} metadata bytes, but only read ${t}.`,ss=(n,t)=>`Expected to read ${n} bytes for message body, but only read ${t}.`,os=n=>`Unsupported message type: ${n} (${ee(v,n)})`;function je(n,t){let e=p(n,t)||0;if(t+=nt,e===-1&&(e=p(n,t)||0,t+=nt),e===0)return null;let r=n.subarray(t,t+=e);if(r.byteLength<e)throw new Error(rs(e,r.byteLength));let s=O(r,0),o=s(4,T,k.V1),a=s(6,Lt,v.NONE),c=s(8,U,0),u=s(10,R,0),d;if(c){let m=a===v.Schema?qe:a===v.DictionaryBatch?Cr:a===v.RecordBatch?Ve:null;if(!m)throw new Error(os(a));if(d=m(r,c,o),u>0){let l=n.subarray(t,t+=u);if(l.byteLength<u)throw new Error(ss(u,l.byteLength));d.body=l;}else a!==v.Schema&&(d.body=new Uint8Array(0));}return {version:o,type:a,index:t,content:d}}function kr(n){let t=Xn(n)?new Uint8Array(n):n;return t instanceof Uint8Array&&is(t)?cs(t):as(t)}function is(n){if(!n||n.length<4)return false;for(let t=0;t<6;++t)if(xt[t]!==n[t])return false;return true}function as(n){let t=[n].flat(),e,r=[],s=[];for(let o of t){if(!(o instanceof Uint8Array))throw new Error("IPC data batch was not a Uint8Array.");let a=0;for(;;){let c=je(o,a);if(c===null)break;if(a=c.index,!!c.content)switch(c.type){case v.Schema:e||(e=c.content);break;case v.RecordBatch:r.push(c.content);break;case v.DictionaryBatch:s.push(c.content);break}}}return {schema:e,dictionaries:s,records:r,metadata:null}}function cs(n){let t=n.byteLength-(xt.length+4),e=p(n,t),r=O(n,t-e),s=r(4,T,k.V1),o=r(8,Un,[]),a=r(10,Un,[]);return {schema:r(6,(c,u)=>qe(c,u,s)),dictionaries:o.map(({offset:c})=>je(n,c).content),records:a.map(({offset:c})=>je(n,c).content),metadata:r(12,Vt)}}function qn(n,t){return us(kr(n),t)}function us(n,t={}){let{schema:e={fields:[]},dictionaries:r,records:s}=n,{version:o,fields:a}=e,c=new Map,u=fs(t,o,c),d=new Map;ds(e,h=>{let y=h.type;y.typeId===i.Dictionary&&d.set(y.id,y.dictionary);});let m=new Map;for(let h of r){let{id:y,data:N,isDelta:S,body:ct}=h,ut=d.get(y),dt=Vn(ut,u({...N,body:ct}));if(m.has(y)){let f=m.get(y);S||f.clear(),f.add(dt);}else {if(S)throw new Error("Delta update can not be first dictionary batch.");m.set(y,Pn(ut).add(dt));}}m.forEach((h,y)=>c.set(y,h.done()));let l=a.map(h=>Pn(h.type));for(let h of s){let y=u(h);a.forEach((N,S)=>l[S].add(Vn(N.type,y)));}return new ot(e,l.map(h=>h.done()),t.useProxy)}function ds(n,t){n.fields.forEach(function e(r){t(r),r.type.dictionary?.children?.forEach(e),r.type.children?.forEach(e);});}function fs(n,t,e){let r={version:t,options:n,dictionary:s=>e.get(s)};return s=>{let{length:o,nodes:a,regions:c,variadic:u,body:d}=s,m=-1,l=-1,h=-1;return {...r,length:o,node:()=>a[++m],buffer:y=>{let{length:N,offset:S}=c[++l];return y?new y(d.buffer,d.byteOffset+S,N/y.BYTES_PER_ELEMENT):d.subarray(S,S+N)},variadic:()=>u[++h],visit(y){return y.map(N=>Vn(N.type,this))}}}}function Vn(n,t){let{typeId:e}=n,{options:r,node:s,buffer:o,variadic:a,version:c}=t,u=it(n,r),d={...s(),type:n};if(e===i.Null)return new u({...d,nullCount:d.length});switch(e){case i.Bool:case i.Int:case i.Time:case i.Duration:case i.Float:case i.Decimal:case i.Date:case i.Timestamp:case i.Interval:case i.FixedSizeBinary:return new u({...d,validity:o(),values:o(n.values)});case i.Utf8:case i.LargeUtf8:case i.Binary:case i.LargeBinary:return new u({...d,validity:o(),offsets:o(n.offsets),values:o()});case i.BinaryView:case i.Utf8View:return new u({...d,validity:o(),values:o(),data:Array.from({length:a()},()=>o())});case i.List:case i.LargeList:case i.Map:return new u({...d,validity:o(),offsets:o(n.offsets),children:t.visit(n.children)});case i.ListView:case i.LargeListView:return new u({...d,validity:o(),offsets:o(n.offsets),sizes:o(n.offsets),children:t.visit(n.children)});case i.FixedSizeList:case i.Struct:return new u({...d,validity:o(),children:t.visit(n.children)});case i.RunEndEncoded:return new u({...d,children:t.visit(n.children)});case i.Dictionary:{let{id:m,indices:l}=n;return new u({...d,validity:o(),values:o(l.values)}).setDictionary(t.dictionary(m))}case i.Union:return c<k.V5&&o(),new u({...d,typeIds:o(tt),offsets:n.mode===W.Sparse?null:o(n.offsets),children:t.visit(n.children)});default:throw new Error(j(e))}}new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;function w(n){return new Ge(n)}var Ge=class{constructor(t=q){this.buf=new t(512);}array(t){return tr(this.buf,t)}prep(t){t>=this.buf.length&&(this.buf=pn(this.buf,t));}get(t){return this.buf[t]}set(t,e){this.prep(e),this.buf[e]=t;}write(t,e){this.prep(e+t.length),this.buf.set(t,e);}};function He(){return new jn}var jn=class extends Ge{set(t){let e=t>>3;this.prep(e),this.buf[e]|=1<<t%8;}};var X=class{constructor(t,e){this.type=t,this.ctx=e,this.batchClass=e.batchType(t);}init(){return this.index=-1,this}set(t,e){return this.index=e,false}done(){return null}batch(){let t=new this.batchClass(this.done());return this.init(),t}};var E=class extends X{constructor(t,e){super(t,e);}init(){return this.nullCount=0,this.validity=He(),super.init()}set(t,e){this.index=e;let r=t!=null;return r?this.validity.set(e):this.nullCount++,r}done(){let{index:t,nullCount:e,type:r,validity:s}=this;return {length:t+1,nullCount:e,type:r,validity:e?s.array((t>>3)+1):new q(0)}}};function qt(){let n=new Map,t=new Set;return {get(e,r){let s=e.id;if(s>=0&&n.has(s))return n.get(s);{let o=hs(e,r);return s>=0&&n.set(s,o),t.add(o),o}},finish(e){t.forEach(r=>r.finish(e));}}}function hs(n,t){let e=Object.create(null),r=t.builder(n.dictionary),s=[];r.init();let o=-1;return {type:n,values:r,add(a){return s.push(a),a},key(a){let c=gt(a),u=e[c];return u===void 0&&(e[c]=u=++o,r.set(a,u)),u},finish(a){let c=n.dictionary,u=new(it(c,a))(r.done()),d=new z([u]);s.forEach(m=>m.setDictionary(d));}}}var ze=class extends E{constructor(t,e){super(t,e),this.dict=e.dictionary(t);}init(){return this.values=w(this.type.indices.values),super.init()}set(t,e){super.set(t,e)&&this.values.set(this.dict.key(t),e);}done(){return {...super.done(),values:this.values.array(this.index+1)}}batch(){return this.dict.add(super.batch())}};function vr(n){let t=Gn();return n(e=>t.add(e)),t.type()}function Gn(){let n=0,t=0,e=0,r=0,s=0,o=0,a=0,c=0,u=0,d=0,m=0,l=1/0,h=-1/0,y=1/0,N=-1/0,S,ct,ut,dt={};return {add(f){if(n++,f==null){t++;return}switch(typeof f){case "string":u++;break;case "number":r++,f<l&&(l=f),f>h&&(h=f),Number.isInteger(f)&&s++;break;case "bigint":o++,S===void 0?S=ct=f:(f<S&&(S=f),f>ct&&(ct=f));break;case "boolean":e++;break;case "object":if(f instanceof Date)a++,+f%864e5===0&&c++;else if(Zt(f)){d++;let L=f.length;L<y&&(y=L),L>N&&(N=L),ut??=Gn(),f.forEach(ut.add);}else {m++;for(let L in f)(dt[L]??(dt[L]=Gn())).add(f[L]);}}},type(){let f=n-t;return f===0?mn():s===f?Is(l,h):r===f?mt():o===f?gs(S,ct):e===f?Rn():c===f?Tn():a===f?vt():u===f?Ot(kt()):d===f?ys(ut.type(),y,N):m===f?Ft(Object.entries(dt).map(L=>et(L[0],L[1].type()))):Es()}}}function ys(n,t,e){return e===t?Nt(n,t):_t(n)}function Is(n,t){let e=Math.max(Math.abs(n)-1,t);return e<128?At():e<32768?St():e<2**31?Q():mt()}function gs(n,t){let e=-n>t?-n-1n:t;if(e>=2**63)throw new Error(`BigInt exceeds 64 bits: ${e}`);return Ct()}function Es(){throw new Error("Mixed types detected, please define a union type.")}var Rt=class extends E{constructor(t,e){super(t,e),this.toOffset=se(t.offsets);}init(){return this.offsets=w(this.type.offsets),this.values=w(),this.pos=0,super.init()}set(t,e){let{offsets:r,values:s,toOffset:o}=this;super.set(t,e)&&(s.write(t,this.pos),this.pos+=t.length),r.set(o(this.pos),e+1);}done(){return {...super.done(),offsets:this.offsets.array(this.index+2),values:this.values.array(this.pos+1)}}};var We=class extends E{constructor(t,e){super(t,e);}init(){return this.values=He(),super.init()}set(t,e){super.set(t,e),t&&this.values.set(e);}done(){return {...super.done(),values:this.values.array((this.index>>3)+1)}}};var Ye=class extends E{constructor(t,e){super(t,e),this.scale=10**t.scale,this.stride=t.bitWidth>>6;}init(){return this.values=w(this.type.values),super.init()}set(t,e){let{scale:r,stride:s,values:o}=this;super.set(t,e)&&(o.prep((e+1)*s),mr(t,o.buf,e*s,s,r));}done(){let{index:t,stride:e,values:r}=this;return {...super.done(),values:r.array((t+1)*e)}}};var $e=class extends E{constructor(t,e){super(t,e),this.stride=t.stride;}init(){return this.values=w(),super.init()}set(t,e){super.set(t,e)&&this.values.write(t,e*this.stride);}done(){let{stride:t,values:e}=this;return {...super.done(),values:e.array(t*(this.index+1))}}};var Ke=class extends E{constructor(t,e){super(t,e),this.child=e.builder(this.type.children[0].type),this.stride=t.stride;}init(){return this.child.init(),super.init()}set(t,e){let{child:r,stride:s}=this,o=e*s;if(super.set(t,e))for(let a=0;a<s;++a)r.set(t[a],o+a);else r.index=o+s;}done(){let{child:t}=this;return {...super.done(),children:[t.batch()]}}};var Qe=class extends E{init(){return this.values=w(this.type.values),super.init()}set(t,e){if(super.set(t,e)){let r=e<<1;this.values.set(t[0],r),this.values.set(t[1],r+1);}}done(){return {...super.done(),values:this.values.array(this.index+1<<1)}}},Je=class extends E{init(){return this.values=w(),super.init()}set(t,e){super.set(t,e)&&this.values.write(lr(t),e<<4);}done(){return {...super.done(),values:this.values.array(this.index+1<<4)}}};var jt=class extends E{constructor(t,e,r){super(t,e),this.child=r;}init(){this.child.init();let t=this.type.offsets;return this.offsets=w(t),this.toOffset=se(t),this.pos=0,super.init()}done(){return {...super.done(),offsets:this.offsets.array(this.index+2),children:[this.child.batch()]}}},Xe=class extends jt{constructor(t,e){super(t,e,e.builder(t.children[0].type));}set(t,e){let{child:r,offsets:s,toOffset:o}=this;super.set(t,e)&&t.forEach(a=>r.set(a,this.pos++)),s.set(o(this.pos),e+1);}};var Gt=class extends E{constructor(t,e){super(t,e),this.children=t.children.map(r=>e.builder(r.type));}init(){return this.children.forEach(t=>t.init()),super.init()}done(){let{children:t}=this;return t.forEach(e=>e.index=this.index),{...super.done(),children:t.map(e=>e.batch())}}},Ze=class extends Gt{constructor(t,e){super(t,e),this.setters=this.children.map((r,s)=>{let o=t.children[s].name;return (a,c)=>r.set(a?.[o],c)});}set(t,e){super.set(t,e);let r=this.setters;for(let s=0;s<r.length;++s)r[s](t,e);}};var tn=class extends jt{constructor(t,e){super(t,e,new Hn(t.children[0].type,e));}set(t,e){let{child:r,offsets:s,toOffset:o}=this;if(super.set(t,e))for(let a of t)r.set(a,this.pos++);s.set(o(this.pos),e+1);}},Hn=class extends Gt{set(t,e){super.set(t,e);let[r,s]=this.children;r.set(t[0],e),s.set(t[1],e);}};var ws={},en=class extends X{constructor(t,e){super(t,e),this.children=t.children.map(r=>e.builder(r.type));}init(){return this.pos=0,this.key=null,this.value=ws,this.children.forEach(t=>t.init()),super.init()}next(){let[t,e]=this.children;t.set(this.index+1,this.pos),e.set(this.value,this.pos++);}set(t,e){if(t!==this.value){let r=gt(t);r!==this.key&&(this.key&&this.next(),this.key=r,this.value=t);}this.index=e;}done(){this.next();let{children:t,index:e,type:r}=this;return {length:e+1,nullCount:0,type:r,children:t.map(s=>s.batch())}}};var nn=class extends X{constructor(t,e){super(t,e),this.children=t.children.map(r=>e.builder(r.type)),this.typeMap=t.typeMap,this.lookup=t.typeIdForValue;}init(){return this.nullCount=0,this.typeIds=w(tt),this.children.forEach(t=>t.init()),super.init()}set(t,e){let{children:r,lookup:s,typeMap:o,typeIds:a}=this;this.index=e;let c=s(t,e),u=r[o[c]];a.set(c,e),t==null&&++this.nullCount,this.update(t,e,u);}done(){let{children:t,nullCount:e,type:r,typeIds:s}=this,o=this.index+1;return {length:o,nullCount:e,type:r,typeIds:s.array(o),children:t.map(a=>a.batch())}}},rn=class extends nn{update(t,e,r){r.set(t,e),this.children.forEach(s=>{s!==r&&s.set(null,e);});}},sn=class extends nn{init(){return this.offsets=w(this.type.offsets),super.init()}update(t,e,r){let s=r.index+1;r.set(t,s),this.offsets.set(s,e);}done(){return {...super.done(),offsets:this.offsets.array(this.index+1)}}};var on=class extends Rt{set(t,e){super.set(t&&Ln(t),e);}};var Z=class extends E{constructor(t,e){super(t,e),this.values=w(t.values);}init(){return this.values=w(this.type.values),super.init()}set(t,e){super.set(t,e)&&this.values.set(t,e);}done(){return {...super.done(),values:this.values.array(this.index+1)}}},an=class extends Z{set(t,e){super.set(t==null?t:P(t),e);}},at=class extends Z{constructor(t,e,r){super(t,e),this.transform=r;}set(t,e){super.set(t==null?t:this.transform(t),e);}};function zn(n={},t=qt()){return {batchType:e=>it(e,n),builder(e){return Wn(e,this)},dictionary(e){return t.get(e,this)},finish:()=>t.finish(n)}}function Wn(n,t=zn()){let{typeId:e}=n;switch(e){case i.Int:case i.Time:case i.Duration:return lt(n.values)?new an(n,t):new Z(n,t);case i.Float:return n.precision?new Z(n,t):new at(n,t,gr);case i.Binary:case i.LargeBinary:return new Rt(n,t);case i.Utf8:case i.LargeUtf8:return new on(n,t);case i.Bool:return new We(n,t);case i.Decimal:return n.bitWidth===32?new at(n,t,pr(n.scale)):new Ye(n,t);case i.Date:return new at(n,t,n.unit?P:dr);case i.Timestamp:return new at(n,t,fr(n.unit));case i.Interval:switch(n.unit){case C.DAY_TIME:return new Qe(n,t);case C.MONTH_DAY_NANO:return new Je(n,t)}return new Z(n,t);case i.List:case i.LargeList:return new Xe(n,t);case i.Struct:return new Ze(n,t);case i.Union:return n.mode?new sn(n,t):new rn(n,t);case i.FixedSizeBinary:return new $e(n,t);case i.FixedSizeList:return new Ke(n,t);case i.Map:return new tn(n,t);case i.RunEndEncoded:return new en(n,t);case i.Dictionary:return new ze(n,t)}throw new Error(j(e))}function Yn(n,t,e={},r){let s=rr(n)?u=>{for(let d of n)u(d);}:n;t??=vr(s);let{maxBatchRows:o=1/0,...a}=e,c;if(t.typeId===i.Null){let u=0;s(()=>++u),c=Rs(t,u,o);}else {let u=zn(a,r),d=Wn(t,u).init(),m=h=>c.push(h.batch());c=[];let l=0;s(h=>{d.set(h,l++),l>=o&&(m(d),l=0);}),l&&m(d),u.finish();}return new z(c,t)}function Rs(n,t,e){let r=[],s=c=>new wt({length:c,nullCount:c,type:n}),o=Math.floor(t/e);for(let c=0;c<o;++c)r.push(s(e));let a=t%e;return a&&r.push(s(a)),r}function $n(n,t,e={},r){return !t&&ln(n)?xs(n,e):Yn(s=>n.forEach(s),t,e,r)}function xs(n,{maxBatchRows:t,useBigInt:e}){let r=n.constructor,s=Ts(r),o=n.length,a=Math.min(t||1/0,o),c=Math.floor(o/a),u=[],d=lt(r)&&!e?M:H,m=(h,y)=>u.push(new d({length:y-h,nullCount:0,type:s,validity:new q(0),values:n.subarray(h,y)})),l=0;for(let h=0;h<c;++h)m(l,l+=a);return l<o&&m(l,o),new z(u)}function Ts(n){switch(n){case Xt:return En();case Y:return mt();case tt:return At();case fn:return St();case b:return Q();case A:return Ct();case q:return hn();case Tt:return yn();case bt:return In();case ft:return gn()}}function Kn(n,t){let e=[],r=Array.isArray(n)?n:Object.entries(n),s=r[0]?.[1].length,o=r.map(([c,u])=>{if(u.length!==s)throw new Error("All columns must have the same length.");return e.push(et(c,u.type)),u}),a={version:k.V5,endianness:dn.Little,fields:e,metadata:null};return new ot(a,o,t)}function Qn(n,t={}){let{types:e={},...r}=t,s=qt(),a=(Array.isArray(n)?n:Object.entries(n)).map(([c,u])=>[c,$n(u,e[c],r,s)]);return Kn(a,t.useProxy)}var Ht=class{db;connectionId;preparedStatementId;closed=false;bindings=[];constructor(t,e,r,s){this.db=t,this.connectionId=e,this.preparedStatementId=r;}checkClosed(){if(this.closed)throw new x("Statement is closed")}clearBindings(){this.checkClosed(),this.bindings=[];}bindNull(t){this.checkClosed(),this.bindings.push({index:t,type:"null",value:null});}bindBoolean(t,e){this.checkClosed(),this.bindings.push({index:t,type:"boolean",value:e});}bindInt8(t,e){this.checkClosed(),this.bindings.push({index:t,type:"int8",value:e});}bindInt16(t,e){this.checkClosed(),this.bindings.push({index:t,type:"int16",value:e});}bindInt32(t,e){this.checkClosed(),this.bindings.push({index:t,type:"int32",value:e});}bindInt64(t,e){this.checkClosed(),this.bindings.push({index:t,type:"int64",value:e});}bindUInt8(t,e){this.checkClosed(),this.bindings.push({index:t,type:"uint8",value:e});}bindUInt16(t,e){this.checkClosed(),this.bindings.push({index:t,type:"uint16",value:e});}bindUInt32(t,e){this.checkClosed(),this.bindings.push({index:t,type:"uint32",value:e});}bindUInt64(t,e){this.checkClosed(),this.bindings.push({index:t,type:"uint64",value:e});}bindFloat(t,e){this.checkClosed(),this.bindings.push({index:t,type:"float",value:e});}bindDouble(t,e){this.checkClosed(),this.bindings.push({index:t,type:"double",value:e});}bindVarchar(t,e){this.checkClosed(),this.bindings.push({index:t,type:"varchar",value:e});}bindBlob(t,e){this.checkClosed(),this.bindings.push({index:t,type:"blob",value:e});}async run(){this.checkClosed();let t=await this.db.postTask("RUN_PREPARED",{connectionId:this.connectionId,preparedStatementId:this.preparedStatementId,bindings:this.bindings}),{columns:e,rows:r}=t;return r.map(s=>{let o={};for(let a=0;a<e.length;a++)o[e[a].name]=s[a];return o})}async execute(){return this.checkClosed(),(await this.db.postTask("EXECUTE_PREPARED",{connectionId:this.connectionId,preparedStatementId:this.preparedStatementId,bindings:this.bindings})).rowsChanged}async close(){this.closed||(await this.db.postTask("CLOSE_PREPARED",{connectionId:this.connectionId,preparedStatementId:this.preparedStatementId}),this.closed=true);}};var zt=class{columns;rows;_rowCount;constructor(t,e,r){this.columns=t,this.rows=e,this._rowCount=r;}get rowCount(){return this._rowCount}get columnCount(){return this.columns.length}getColumns(){return this.columns}getRows(){return this.rows}getColumn(t){if(t<0||t>=this.columns.length)throw new Error(`Column index ${t} out of bounds`);return this.rows.map(e=>e[t])}getColumnByName(t){let e=this.columns.findIndex(r=>r.name===t);if(e===-1)throw new Error(`Column "${t}" not found`);return this.getColumn(e)}getRow(t){if(t<0||t>=this._rowCount)throw new Error(`Row index ${t} out of bounds`);return this.rows[t]}getRowObject(t){let e=this.getRow(t),r={};for(let s=0;s<this.columns.length;s++)r[this.columns[s].name]=e[s];return r}toArray(){return this.rows.map(t=>{let e={};for(let r=0;r<this.columns.length;r++)e[this.columns[r].name]=t[r];return e})}*[Symbol.iterator](){for(let t=0;t<this._rowCount;t++)yield this.getRowObject(t);}};var Wt=class{db;connectionId;streamingResultId;columns;closed=false;done=false;constructor(t,e,r,s){this.db=t,this.connectionId=e,this.streamingResultId=r,this.columns=s;}getColumns(){return this.columns}isDone(){return this.done}isClosed(){return this.closed}checkClosed(){if(this.closed)throw new x("Streaming result is closed")}async nextChunk(){if(this.checkClosed(),this.done)return null;let t=await this.db.postTask("FETCH_CHUNK",{connectionId:this.connectionId,streamingResultId:this.streamingResultId});return t.done&&t.rowCount===0?(this.done=true,null):(t.done&&(this.done=true),new zt(t.columns,t.rows,t.rowCount))}async toArray(){let t=[];for await(let e of this)t.push(...e.toArray());return t}async toArrowTable(){let t=[],e=this.columns;for await(let s of this)t.push(...s.getRows());let r={};for(let s=0;s<e.length;s++){let o=e[s].name;r[o]=t.map(a=>a[s]);}return Qn(r)}async close(){this.closed||(await this.db.postTask("CLOSE_STREAMING_RESULT",{connectionId:this.connectionId,streamingResultId:this.streamingResultId}),this.closed=true);}async*[Symbol.asyncIterator](){try{let t=await this.nextChunk();for(;t!==null;)yield t,t=await this.nextChunk();}finally{this.closed||await this.close();}}};var Yt=class{db;connectionId;closed=false;constructor(t,e){this.db=t,this.connectionId=e;}getConnectionId(){return this.connectionId}getDB(){return this.db}checkClosed(){if(this.closed)throw new x("Connection is closed")}async query(t){this.checkClosed();let e=await this.db.postTask("QUERY",{connectionId:this.connectionId,sql:t}),{columns:r,rows:s}=e;return s.map(o=>{let a={};for(let c=0;c<r.length;c++)a[r[c].name]=o[c];return a})}async queryArrow(t){this.checkClosed();let e=await this.db.postTask("QUERY_ARROW",{connectionId:this.connectionId,sql:t});return qn(e.ipcBuffer)}async queryStreaming(t){this.checkClosed();let e=await this.db.postTask("QUERY_STREAMING",{connectionId:this.connectionId,sql:t});return new Wt(this.db,this.connectionId,e.streamingResultId,e.columns)}async execute(t){return this.checkClosed(),(await this.db.postTask("EXECUTE",{connectionId:this.connectionId,sql:t})).rowsChanged}async prepare(t){this.checkClosed();let e=await this.db.postTask("PREPARE",{connectionId:this.connectionId,sql:t});return new Ht(this.db,this.connectionId,e.preparedStatementId,t)}async beginTransaction(){this.checkClosed(),await this.db.postTask("BEGIN_TRANSACTION",{connectionId:this.connectionId});}async commit(){this.checkClosed(),await this.db.postTask("COMMIT",{connectionId:this.connectionId});}async rollback(){this.checkClosed(),await this.db.postTask("ROLLBACK",{connectionId:this.connectionId});}async transaction(t){await this.beginTransaction();try{let e=await t();return await this.commit(),e}catch(e){throw await this.rollback(),e}}async insertArrowFromIPCStream(t,e){this.checkClosed(),await this.db.postTask("INSERT_ARROW_FROM_IPC",{connectionId:this.connectionId,tableName:t,ipcBuffer:e},[e.buffer]);}async insertCSVFromPath(t,e,r){this.checkClosed(),await this.db.postTask("INSERT_CSV_FROM_PATH",{connectionId:this.connectionId,tableName:t,path:e,options:r});}async insertJSONFromPath(t,e,r){this.checkClosed(),await this.db.postTask("INSERT_JSON_FROM_PATH",{connectionId:this.connectionId,tableName:t,path:e,options:r});}async close(){this.closed||(await this.db.postTask("DISCONNECT",{connectionId:this.connectionId}),this.closed=true);}};var D=null,$t=null;async function _r(n){if(D)return;if($t){await $t;return}let t=typeof n=="string"?{wasmUrl:n}:n??{};$t=(async()=>{let e=new URL(".",import.meta.url).href,r=t.workerUrl??new URL("worker.js",e).href,s=t.wasmUrl??new URL("wasm/duckdb.wasm",e).href,o=t.wasmJsUrl??new URL("wasm/duckdb.js",e).href,a;t.worker?a=t.worker:typeof location<"u"&&new URL(r).origin!==location.origin?a=await un(r):a=new Worker(r,{type:"module"}),await new Promise((c,u)=>{let d=setTimeout(()=>{u(new x("Worker initialization timeout"));},3e4),m=l=>{l.data?.type==="WORKER_READY"&&(clearTimeout(d),a.removeEventListener("message",m),c());};a.addEventListener("message",m);}),D=new cn(a),await D.instantiate(s,o),await D.open(t.config);})(),await $t;}async function bs(){if(!D)throw new x("DuckDB WASM not initialized. Call init() first.");return D.getVersion()}function Fr(){if(!D)throw new x("DuckDB WASM not initialized. Call init() first.");return D}var cn=class{worker;pendingRequests=new Map;nextMessageId=1;closed=false;constructor(t){if(t)this.worker=t,this.setupMessageHandler();else {if(!D)throw new x("DuckDB WASM not initialized. Call init() first.");this.worker=D.worker,this.pendingRequests=D.pendingRequests,this.nextMessageId=D.nextMessageId;}}setupMessageHandler(){this.worker.onmessage=t=>{let e=t.data,r=this.pendingRequests.get(e.requestId);if(r)if(this.pendingRequests.delete(e.requestId),e.type==="ERROR"){let s=e.data;r.reject(new x(s.message,s.code,s.query));}else r.resolve(e.data);},this.worker.onerror=t=>{for(let[,e]of this.pendingRequests)e.reject(new x(`Worker error: ${t.message}`));this.pendingRequests.clear();};}postTask(t,e,r){if(this.closed)return Promise.reject(new x("Database is closed"));let s=this.nextMessageId++,o=new Jt(s,t);this.pendingRequests.set(s,o);let a={messageId:s,type:t,data:e};return r&&r.length>0?this.worker.postMessage(a,r):this.worker.postMessage(a),o.promise}async instantiate(t,e){await this.postTask("INSTANTIATE",{wasmUrl:t,wasmJsUrl:e});}async open(t){await this.postTask("OPEN",{config:t});}async getVersion(){return (await this.postTask("GET_VERSION")).version}async connect(){let t=await this.postTask("CONNECT");return new Yt(this,t.connectionId)}static async createConnection(){return await _r(),Fr().connect()}async registerFileURL(t,e,r,s){await this.postTask("REGISTER_FILE_URL",{name:t,url:e,protocol:r,directIO:s});}async registerFileBuffer(t,e){await this.postTask("REGISTER_FILE_BUFFER",{name:t,buffer:e},[e.buffer]);}async registerFileText(t,e){await this.postTask("REGISTER_FILE_TEXT",{name:t,text:e});}async dropFile(t){await this.postTask("DROP_FILE",{name:t});}async dropFiles(){await this.postTask("DROP_FILES");}async flushFiles(){await this.postTask("FLUSH_FILES");}async copyFileToBuffer(t){return (await this.postTask("COPY_FILE_TO_BUFFER",{name:t})).buffer}async copyFileToPath(t,e){await this.postTask("COPY_FILE_TO_PATH",{srcName:t,dstPath:e});}async globFiles(t){return (await this.postTask("GLOB_FILES",{pattern:t})).files}async close(){this.closed||(await this.postTask("CLOSE"),this.worker.terminate(),this.closed=true,D===this&&(D=null,$t=null));}};var Os={INVALID:0,BOOLEAN:1,TINYINT:2,SMALLINT:3,INTEGER:4,BIGINT:5,UTINYINT:6,USMALLINT:7,UINTEGER:8,UBIGINT:9,FLOAT:10,DOUBLE:11,TIMESTAMP:12,DATE:13,TIME:14,INTERVAL:15,HUGEINT:16,UHUGEINT:32,VARCHAR:17,BLOB:18,DECIMAL:19,TIMESTAMP_S:20,TIMESTAMP_MS:21,TIMESTAMP_NS:22,ENUM:23,LIST:24,STRUCT:25,MAP:26,ARRAY:33,UUID:27,UNION:28,BIT:29,TIME_TZ:30,TIMESTAMP_TZ:31},Nr=(r=>(r.AUTOMATIC="automatic",r.READ_ONLY="read_only",r.READ_WRITE="read_write",r))(Nr||{});
|
|
3
|
-
export{
|
|
2
|
+
var Xt="@ducklings/browser",Zt="1.4.4-dev.1";function jr(n){let e=`https://cdn.jsdelivr.net/npm/${Xt}@${n??Zt}/dist/`;return {mainModule:`${e}index.js`,mainWorker:`${e}worker.js`,wasmModule:`${e}wasm/duckdb.wasm`,wasmJs:`${e}wasm/duckdb.js`}}function Gr(n){let e=`https://unpkg.com/${Xt}@${n??Zt}/dist/`;return {mainModule:`${e}index.js`,mainWorker:`${e}worker.js`,wasmModule:`${e}wasm/duckdb.wasm`,wasmJs:`${e}wasm/duckdb.js`}}async function pn(n){let t=await fetch(n);if(!t.ok)throw new Error(`Failed to fetch worker script: ${t.status} ${t.statusText}`);let e=await t.blob(),r=URL.createObjectURL(e);return new Worker(r,{type:"module"})}var T=class n extends Error{code;query;constructor(t,e,r){super(t),this.name="DuckDBError",this.code=e,this.query=r,Error.captureStackTrace&&Error.captureStackTrace(this,n);}static fromObject(t){return new n(t.message,t.code,t.query)}toObject(){return {message:this.message,code:this.code,query:this.query}}};var te=class{messageId;type;_resolve;_reject;promise;constructor(t,e){this.messageId=t,this.type=e,this._resolve=()=>{},this._reject=()=>{},this.promise=new Promise((r,s)=>{this._resolve=r,this._reject=s;});}resolve(t){this._resolve(t);}reject(t){this._reject(t);}};var Ot=Uint8Array.of(65,82,82,79,87,49),_={V1:0,V4:3,V5:4},mn={Little:0},k={NONE:0,Schema:1,DictionaryBatch:2,RecordBatch:3,Tensor:4,SparseTensor:5},i={Dictionary:-1,NONE:0,Null:1,Int:2,Float:3,Binary:4,Utf8:5,Bool:6,Decimal:7,Date:8,Time:9,Timestamp:10,Interval:11,List:12,Struct:13,Union:14,FixedSizeBinary:15,FixedSizeList:16,Map:17,Duration:18,LargeBinary:19,LargeUtf8:20,LargeList:21,RunEndEncoded:22,BinaryView:23,Utf8View:24,ListView:25,LargeListView:26},Q={HALF:0,SINGLE:1,DOUBLE:2},V={DAY:0,MILLISECOND:1},y={SECOND:0,MILLISECOND:1,MICROSECOND:2,NANOSECOND:3},S={YEAR_MONTH:0,DAY_TIME:1,MONTH_DAY_NANO:2},$={Sparse:0,Dense:1},ft={LZ4_FRAME:0,ZSTD:1},lt={BUFFER:0};var q=Uint8Array,Ct=Uint16Array,At=Uint32Array,pt=BigUint64Array,nt=Int8Array,hn=Int16Array,C=Int32Array,A=BigInt64Array,ee=Float32Array,K=Float64Array;function rr(n){return n instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer}function sr(n,t){let e=Math.log2(n)-3;return (t?[nt,hn,C,A]:[q,Ct,At,pt])[e]}var zr=Object.getPrototypeOf(Int8Array);function yn(n){return n instanceof zr}function ne(n){return Array.isArray(n)||yn(n)}function mt(n){return n===A||n===pt}function ht(n,t){let e=0,r=n.length;if(r<=2147483648)do{let s=e+r>>>1;n[s]<=t?e=s+1:r=s;}while(e<r);else do{let s=Math.trunc((e+r)/2);n[s]<=t?e=s+1:r=s;}while(e<r);return e}function Wr(n,t=1){return (n*t+7&-8)/t}function or(n,t=n.length){let e=Wr(t,n.BYTES_PER_ELEMENT);return n.length>e?n.subarray(0,e):n.length<e?ir(n,e):n}function ir(n,t,e=0){let r=new n.constructor(t);return r.set(n,e),r}function In(n,t,e){for(;n.length<=t;)n=ir(n,n.length<<1,0);return n}function ar(n){return n instanceof Date}function cr(n){return typeof n[Symbol.iterator]=="function"}function re(n,t,e){if(t(n))return n;throw new Error(e(n))}function v(n,t,e){return t=Array.isArray(t)?t:Object.values(t),re(n,r=>t.includes(r),e??(()=>`${n} must be one of ${t}`))}function yt(n,t){for(let[e,r]of Object.entries(n))if(r===t)return e;return "<Unknown>"}var j=n=>`Unsupported data type: "${yt(i,n)}" (id ${n})`,rt=(n,t,e=true,r=null)=>({name:n,type:t,nullable:e,metadata:r});function ur(n){return Object.hasOwn(n,"name")&&dr(n.type)}function dr(n){return typeof n?.typeId=="number"}function J(n,t="",e=true){return ur(n)?n:rt(t,re(n,dr,()=>"Data type expected."),e)}var fr=n=>({typeId:n}),St=(n,t,e=false,r=-1)=>({typeId:i.Dictionary,id:r,dictionary:n,indices:t||X(),ordered:e}),gn=()=>fr(i.Null),B=(n=32,t=true)=>({typeId:i.Int,bitWidth:v(n,[8,16,32,64]),signed:t,values:sr(n,t)}),Dt=()=>B(8),Ft=()=>B(16),X=()=>B(32),_t=()=>B(64),En=()=>B(8,false),wn=()=>B(16,false),Rn=()=>B(32,false),xn=()=>B(64,false),kt=(n=2)=>({typeId:i.Float,precision:v(n,Q),values:[Ct,ee,K][n]});var Tn=()=>kt(Q.SINGLE),It=()=>kt(Q.DOUBLE),bn=()=>({typeId:i.Binary,offsets:C}),vt=()=>({typeId:i.Utf8,offsets:C}),On=()=>fr(i.Bool),Cn=(n,t,e=128)=>({typeId:i.Decimal,precision:n,scale:t,bitWidth:v(e,[32,64,128,256]),values:e===32?C:pt});var se=n=>({typeId:i.Date,unit:v(n,V),values:n===V.DAY?C:A}),An=()=>se(V.DAY);var Sn=(n=y.MILLISECOND)=>{n=v(n,y);let t=n===y.SECOND||n===y.MILLISECOND?32:64;return {typeId:i.Time,unit:n,bitWidth:t,values:t===32?C:A}};var Lt=(n=y.MILLISECOND,t=null)=>({typeId:i.Timestamp,unit:v(n,y),timezone:t,values:A}),Dn=(n=S.MONTH_DAY_NANO)=>({typeId:i.Interval,unit:v(n,S),values:n===S.MONTH_DAY_NANO?void 0:C}),Nt=n=>({typeId:i.List,children:[J(n)],offsets:C}),Bt=n=>({typeId:i.Struct,children:Array.isArray(n)&&n.length>0&&ur(n[0])?n:Object.entries(n).map(([t,e])=>rt(t,e))}),Fn=(n,t,e,r)=>(e??=t.map((s,o)=>o),{typeId:i.Union,mode:v(n,$),typeIds:e,typeMap:e.reduce((s,o,a)=>(s[o]=a,s),{}),children:t.map((s,o)=>J(s,`_${o}`)),typeIdForValue:r,offsets:C}),_n=n=>({typeId:i.FixedSizeBinary,stride:n}),Ut=(n,t)=>({typeId:i.FixedSizeList,stride:t,children:[J(n)]}),lr=(n,t)=>({typeId:i.Map,keysSorted:n,children:[t],offsets:C});var kn=(n=y.MILLISECOND)=>({typeId:i.Duration,unit:v(n,y),values:A}),vn=()=>({typeId:i.LargeBinary,offsets:A}),Ln=()=>({typeId:i.LargeUtf8,offsets:A}),Nn=n=>({typeId:i.LargeList,children:[J(n)],offsets:A}),Bn=(n,t)=>({typeId:i.RunEndEncoded,children:[re(J(n,"run_ends"),e=>e.type.typeId===i.Int,()=>"Run-ends must have an integer type."),J(t,"values")]});var Un=n=>({typeId:i.ListView,children:[J(n,"value")],offsets:C}),Pn=n=>({typeId:i.LargeListView,children:[J(n,"value")],offsets:A});var mr=new K(2),oe=mr.buffer,Yr=new A(oe),gt=new At(oe),pr=new C(oe),$r=new q(oe);function Kr(n){return n}function U(n){return BigInt(n)}function ie(n){return mt(n)?U:Kr}function hr(n){return n/864e5|0}function yr(n){return n===y.SECOND?t=>U(t/1e3):n===y.MILLISECOND?U:n===y.MICROSECOND?t=>U(t*1e3):t=>U(t*1e6)}function Ir([n,t,e]){return pr[0]=n,pr[1]=t,Yr[1]=U(e),$r}function G(n){if(n>Number.MAX_SAFE_INTEGER||n<Number.MIN_SAFE_INTEGER)throw Error(`BigInt exceeds integer number representation: ${n}`);return Number(n)}function ae(n,t){return Number(n/t)+Number(n%t)/Number(t)}function gr(n){return t=>typeof t=="bigint"?Number(t):Math.trunc(t*n)}function Er(n,t,e,r,s){let o=typeof n=="bigint"?n:U(Math.trunc(n*s));t[e]=o,r>1&&(t[e+1]=o>>64n,r>2&&(t[e+2]=o>>128n,t[e+3]=o>>192n));}var Et=n=>BigInt.asUintN(64,n);function wr(n,t){return BigInt.asIntN(64,n[t])}function Rr(n,t){let e=t<<1,r;return BigInt.asIntN(64,n[e+1])<0?(r=Et(~n[e])|Et(~n[e+1])<<64n,r=-(r+1n)):r=n[e]|n[e+1]<<64n,r}function xr(n,t){let e=t<<2,r;return BigInt.asIntN(64,n[e+3])<0?(r=Et(~n[e])|Et(~n[e+1])<<64n|Et(~n[e+2])<<128n|Et(~n[e+3])<<192n,r=-(r+1n)):r=n[e]|n[e+1]<<64n|n[e+2]<<128n|n[e+3]<<192n,r}function Tr(n){if(n!==n)return 32256;mr[0]=n;let t=(gt[1]&2147483648)>>16&65535,e=gt[1]&2146435072,r=0;return e>=1089470464?gt[0]>0?e=31744:(e=(e&2080374784)>>16,r=(gt[1]&1048575)>>10):e<=1056964608?(r=1048576+(gt[1]&1048575),r=1048576+(r<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,r=(gt[1]&1048575)+512>>10),t|e|r&65535}var Qr=new TextDecoder("utf-8"),Jr=new TextEncoder;function wt(n){return Qr.decode(n)}function Mn(n){return Jr.encode(n)}function Rt(n){return `${typeof n!="object"||!n?n??null:ar(n)?+n:ne(n)?`[${n.map(Rt)}]`:Xr(n)}`}function Xr(n){let t="",e=-1;for(let r in n)++e>0&&(t+=","),t+=`"${r}":${Rt(n[r])}`;return `{${t}}`}var st=4;function Vn(n,t){return (n[t>>3]&1<<t%8)!==0}function x(n,t){let e=t+p(n,t),r=e-p(n,e),s=b(n,r);return (o,a,c=null)=>{if(o<s){let u=b(n,r+o);if(u)return a(n,e+u)}return c}}function H(n,t){return t}function Z(n,t){return !!ce(n,t)}function ce(n,t){return Pt(n,t)<<24>>24}function Pt(n,t){return n[t]}function b(n,t){return Zr(n,t)<<16>>16}function Zr(n,t){return n[t]|n[t+1]<<8}function p(n,t){return n[t]|n[t+1]<<8|n[t+2]<<16|n[t+3]<<24}function br(n,t){return p(n,t)>>>0}function w(n,t){return G(BigInt.asIntN(64,BigInt(br(n,t))+(BigInt(br(n,t+st))<<32n)))}function ot(n,t){let e=t+p(n,t),r=p(n,e);return e+=st,wt(n.subarray(e,e+r))}function L(n,t,e,r){if(!t)return [];let s=t+p(n,t);return Array.from({length:p(n,s)},(o,a)=>r(n,s+st+a*e))}var ue=Symbol("rowIndex");function Mt(n,t){class e{constructor(o){this[ue]=o;}toJSON(){return Or(n,t,this[ue])}}let r=e.prototype;for(let s=0;s<n.length;++s){if(Object.hasOwn(r,n[s]))continue;let o=t[s];Object.defineProperty(r,n[s],{get(){return o.at(this[ue])},enumerable:true});}return s=>new e(s)}function de(n,t){return e=>Or(n,t,e)}function Or(n,t,e){let r={};for(let s=0;s<n.length;++s)r[n[s]]=t[s].at(e);return r}function Cr(n){return n instanceof z}var it=class{static ArrayType=null;constructor({length:t,nullCount:e,type:r,validity:s,values:o,offsets:a,sizes:c,children:u}){this.length=t,this.nullCount=e,this.type=r,this.validity=s,this.values=o,this.offsets=a,this.sizes=c,this.children=u,(!e||!this.validity)&&(this.at=d=>this.value(d));}get[Symbol.toStringTag](){return "Batch"}at(t){return this.isValid(t)?this.value(t):null}isValid(t){return Vn(this.validity,t)}value(t){return this.values[t]}slice(t,e){let r=e-t,s=Array(r);for(let o=0;o<r;++o)s[o]=this.at(t+o);return s}*[Symbol.iterator](){for(let t=0;t<this.length;++t)yield this.at(t);}},z=class extends it{constructor(t){super(t);let{length:e,values:r}=this;this.values=r.subarray(0,e);}slice(t,e){return this.nullCount?super.slice(t,e):this.values.subarray(t,e)}[Symbol.iterator](){return this.nullCount?super[Symbol.iterator]():this.values[Symbol.iterator]()}},xt=class extends it{static ArrayType=K},I=class extends it{static ArrayType=Array},Tt=class extends I{value(t){return null}},P=class extends xt{value(t){return G(this.values[t])}},fe=class extends xt{value(t){let e=this.values[t],r=(e&31744)>>10,s=(e&1023)/1024,o=(-1)**((e&32768)>>15);switch(r){case 31:return o*(s?Number.NaN:1/0);case 0:return o*(s?6103515625e-14*s:0)}return o*2**(r-15)*(1+s)}},le=class extends I{value(t){return Vn(this.values,t)}},pe=class extends xt{constructor(t){super(t);let{scale:e}=this.type;this.scale=10**e;}value(t){return this.values[t]/this.scale}},me=class extends it{constructor(t){super(t);let{bitWidth:e,scale:r}=this.type;this.decimal=e===64?wr:e===128?Rr:xr,this.scale=10n**BigInt(r);}},he=class extends me{static ArrayType=K;value(t){return ae(this.decimal(this.values,t),this.scale)}},ye=class extends me{static ArrayType=Array;value(t){return this.decimal(this.values,t)}},Vt=class extends I{constructor(t){super(t),this.source=t;}value(t){return new Date(this.source.value(t))}},Ie=class extends xt{value(t){return 864e5*this.values[t]}},Ar=P,ge=class extends P{value(t){return super.value(t)*1e3}},Sr=P,Ee=class extends P{value(t){return ae(this.values[t],1000n)}},we=class extends P{value(t){return ae(this.values[t],1000000n)}},Re=class extends I{value(t){return this.values.subarray(t<<1,t+1<<1)}},xe=class extends I{value(t){let e=this.values,r=t<<4;return Float64Array.of(p(e,r),p(e,r+4),w(e,r+8))}},Dr=({values:n,offsets:t},e)=>n.subarray(t[e],t[e+1]),Fr=({values:n,offsets:t},e)=>n.subarray(G(t[e]),G(t[e+1])),Te=class extends I{value(t){return Dr(this,t)}},be=class extends I{value(t){return Fr(this,t)}},Oe=class extends I{value(t){return wt(Dr(this,t))}},Ce=class extends I{value(t){return wt(Fr(this,t))}},Ae=class extends I{value(t){let e=this.offsets;return this.children[0].slice(e[t],e[t+1])}},Se=class extends I{value(t){let e=this.offsets;return this.children[0].slice(G(e[t]),G(e[t+1]))}},De=class extends I{value(t){let e=this.offsets[t],r=e+this.sizes[t];return this.children[0].slice(e,r)}},Fe=class extends I{value(t){let e=this.offsets[t],r=e+this.sizes[t];return this.children[0].slice(G(e),G(r))}},_e=class extends I{constructor(t){super(t),this.stride=this.type.stride;}},ke=class extends _e{value(t){let{stride:e,values:r}=this;return r.subarray(t*e,(t+1)*e)}},ve=class extends _e{value(t){let{children:e,stride:r}=this;return e[0].slice(t*r,(t+1)*r)}};function _r({children:n,offsets:t},e){let[r,s]=n[0].children,o=t[e],a=t[e+1],c=[];for(let u=o;u<a;++u)c.push([r.at(u),s.at(u)]);return c}var Le=class extends I{value(t){return _r(this,t)}},Ne=class extends I{value(t){return new Map(_r(this,t))}},qt=class extends I{constructor({typeIds:t,...e}){super(e),this.typeIds=t,this.typeMap=this.type.typeMap;}value(t,e=t){let{typeIds:r,children:s,typeMap:o}=this;return s[o[r[t]]].at(e)}},Be=class extends qt{value(t){return super.value(t,this.offsets[t])}},jt=class extends I{constructor(t,e=de){super(t),this.names=this.type.children.map(r=>r.name),this.factory=e(this.names,this.children);}value(t){return this.factory(t)}},Ue=class extends jt{constructor(t){super(t,Mt);}},Pe=class extends I{value(t){let[{values:e},r]=this.children;return r.at(ht(e,t))}},Me=class extends I{setDictionary(t){return this.dictionary=t,this.cache=t.cache(),this}value(t){return this.cache[this.key(t)]}key(t){return this.values[t]}},Ve=class extends I{constructor({data:t,...e}){super(e),this.data=t;}view(t){let{values:e,data:r}=this,s=t<<4,o=s+4,a=e,c=p(a,s);return c>12&&(o=p(a,s+12),a=r[p(a,s+8)]),a.subarray(o,o+c)}},qe=class extends Ve{value(t){return this.view(t)}},je=class extends Ve{value(t){return wt(this.view(t))}};function qn(n){let t=[];return {add(e){return t.push(e),this},clear:()=>t=[],done:()=>new W(t,n)}}var W=class{constructor(t,e=t[0]?.type){this.type=e,this.length=t.reduce((o,a)=>o+a.length,0),this.nullCount=t.reduce((o,a)=>o+a.nullCount,0),this.data=t;let r=t.length,s=new Int32Array(r+1);if(r===1){let[o]=t;s[1]=o.length,this.at=a=>o.at(a);}else for(let o=0,a=0;o<r;++o)s[o+1]=a+=t[o].length;this.offsets=s;}get[Symbol.toStringTag](){return "Column"}[Symbol.iterator](){let t=this.data;return t.length===1?t[0][Symbol.iterator]():ts(t)}at(t){let{data:e,offsets:r}=this,s=ht(r,t)-1;return e[s]?.at(t-r[s])}get(t){return this.at(t)}toArray(){let{length:t,nullCount:e,data:r}=this,s=!e&&Cr(r[0]),o=r.length;if(s&&o===1)return r[0].values;let a=!o||e>0?Array:r[0].constructor.ArrayType??r[0].values.constructor,c=new a(t);return s?es(c,r):ns(c,r)}cache(){return this._cache??(this._cache=this.toArray())}};function*ts(n){for(let t=0;t<n.length;++t){let e=n[t][Symbol.iterator]();for(let r=e.next();!r.done;r=e.next())yield r.value;}}function es(n,t){for(let e=0,r=0;e<t.length;++e){let{values:s}=t[e];n.set(s,r),r+=s.length;}return n}function ns(n,t){let e=-1;for(let r=0;r<t.length;++r){let s=t[r];for(let o=0;o<s.length;++o)n[++e]=s.at(o);}return n}var at=class n{constructor(t,e,r=false){let s=t.fields.map(a=>a.name);this.schema=t,this.names=s,this.children=e,this.factory=r?Mt:de;let o=[];this.getFactory=a=>o[a]??(o[a]=this.factory(s,e.map(c=>c.data[a])));}get[Symbol.toStringTag](){return "Table"}get numCols(){return this.names.length}get numRows(){return this.children[0]?.length??0}getChildAt(t){return this.children[t]}getChild(t){let e=this.names.findIndex(r=>r===t);return e>-1?this.children[e]:void 0}selectAt(t,e=[]){let{children:r,factory:s,schema:o}=this,{fields:a}=o;return new n({...o,fields:t.map((c,u)=>rs(a[c],e[u]))},t.map(c=>r[c]),s===Mt)}select(t,e){let r=this.names,s=t.map(o=>r.indexOf(o));return this.selectAt(s,e)}toColumns(){let{children:t,names:e}=this,r={};return e.forEach((s,o)=>r[s]=t[o]?.toArray()??[]),r}toArray(){let{children:t,getFactory:e,numRows:r}=this,s=t[0]?.data??[],o=Array(r);for(let a=0,c=-1;a<s.length;++a){let u=e(a);for(let d=0;d<s[a].length;++d)o[++c]=u(d);}return o}*[Symbol.iterator](){let{children:t,getFactory:e}=this,r=t[0]?.data??[];for(let s=0;s<r.length;++s){let o=e(s);for(let a=0;a<r[s].length;++a)yield o(a);}}at(t){let{children:e,getFactory:r,numRows:s}=this;if(t<0||t>=s)return null;let[{offsets:o}]=e,a=ht(o,t)-1;return r(a)(t-o[a])}get(t){return this.at(t)}};function rs(n,t){return t!=null&&t!==n.name?{...n,name:t}:n}function ct(n,t={}){let{typeId:e,bitWidth:r,mode:s,precision:o,unit:a}=n,{useBigInt:c,useDate:u,useDecimalInt:d,useMap:m,useProxy:l}=t;switch(e){case i.Null:return Tt;case i.Bool:return le;case i.Int:case i.Time:case i.Duration:return c||r<64?z:P;case i.Float:return o?z:fe;case i.Date:return kr(a===V.DAY?Ie:Ar,u&&Vt);case i.Timestamp:return kr(a===y.SECOND?ge:a===y.MILLISECOND?Sr:a===y.MICROSECOND?Ee:we,u&&Vt);case i.Decimal:return r===32?d?z:pe:d?ye:he;case i.Interval:return a===S.DAY_TIME?Re:a===S.YEAR_MONTH?z:xe;case i.FixedSizeBinary:return ke;case i.Utf8:return Oe;case i.LargeUtf8:return Ce;case i.Binary:return Te;case i.LargeBinary:return be;case i.BinaryView:return qe;case i.Utf8View:return je;case i.List:return Ae;case i.LargeList:return Se;case i.Map:return m?Ne:Le;case i.ListView:return De;case i.LargeListView:return Fe;case i.FixedSizeList:return ve;case i.Struct:return l?Ue:jt;case i.RunEndEncoded:return Pe;case i.Dictionary:return Me;case i.Union:return s?Be:qt}throw new Error(j(e))}function kr(n,t){return t?class extends t{constructor(r){super(new n(r));}}:n}var ss=-1,os=8;function jn(n){return `Missing compression codec "${yt(ft,n)}" (id ${n})`}var is=new Map;function Ge(n){return n!=null&&is.get(n)||null}function vr(n,{offset:t,length:e},r){if(e===0)return {bytes:new Uint8Array(0),offset:0,length:0};let s=w(n,t),o=n.subarray(t+os,t+e),a=s===ss?o:r.decode(o);return {bytes:a,offset:0,length:a.length}}function as(n,t){return {offset:w(n,t),metadataLength:p(n,t+8),bodyLength:w(n,t+16)}}function Gn(n,t){return L(n,t,24,as)}function Lr(n,t){let e=x(n,t);return {codec:e(4,ce,ft.LZ4_FRAME),method:e(6,ce,lt.BUFFER)}}function He(n,t,e){let r=x(n,t),s=e<_.V4?8:0;return {length:r(4,w,0),nodes:L(n,r(6,H),16,(o,a)=>({length:w(o,a),nullCount:w(o,a+8)})),regions:L(n,r(8,H),16+s,(o,a)=>({offset:w(o,a+s),length:w(o,a+s+8)})),compression:r(10,Lr),variadic:L(n,r(12,H),8,w)}}function Nr(n,t,e){let r=x(n,t);return {id:r(4,w,0),data:r(6,(s,o)=>He(s,o,e)),isDelta:r(8,Z,false)}}function Hn(n,t,e,r){v(e,i,j);let s=x(n,t);switch(e){case i.Binary:return bn();case i.Utf8:return vt();case i.LargeBinary:return vn();case i.LargeUtf8:return Ln();case i.List:return Nt(r[0]);case i.ListView:return Un(r[0]);case i.LargeList:return Nn(r[0]);case i.LargeListView:return Pn(r[0]);case i.Struct:return Bt(r);case i.RunEndEncoded:return Bn(r[0],r[1]);case i.Int:return B(s(4,p,0),s(6,Z,false));case i.Float:return kt(s(4,b,Q.HALF));case i.Decimal:return Cn(s(4,p,0),s(6,p,0),s(8,p,128));case i.Date:return se(s(4,b,V.MILLISECOND));case i.Time:return Sn(s(4,b,y.MILLISECOND));case i.Timestamp:return Lt(s(4,b,y.SECOND),s(6,ot));case i.Interval:return Dn(s(4,b,S.YEAR_MONTH));case i.Duration:return kn(s(4,b,y.MILLISECOND));case i.FixedSizeBinary:return _n(s(4,p,0));case i.FixedSizeList:return Ut(r[0],s(4,p,0));case i.Map:return lr(s(4,Z,false),r[0]);case i.Union:return Fn(s(4,b,$.Sparse),r,L(n,s(6,H),4,p))}return {typeId:e}}function Gt(n,t){let e=L(n,t,4,(r,s)=>{let o=x(r,s);return [o(4,ot),o(6,ot)]});return e.length?new Map(e):null}function ze(n,t,e){let r=x(n,t);return {version:e,endianness:r(4,b,0),fields:r(6,cs,[]),metadata:r(8,Gt)}}function cs(n,t){return L(n,t,4,Br)}function Br(n,t){let e=x(n,t),r=e(8,Pt,i.NONE),s=e(10,H,0),o=e(12,ds),a=e(14,us,[]),c=Hn(n,s,r,a);return o&&(o.dictionary=c,c=o),{name:e(4,ot),type:c,nullable:e(6,Z,false),metadata:e(16,Gt)}}function us(n,t){return L(n,t,4,Br)}function ds(n,t){if(!t)return null;let e=x(n,t);return St(null,e(6,fs,X()),e(8,Z,false),e(4,w,0))}function fs(n,t){return Hn(n,t,i.Int)}var ls=(n,t)=>`Expected to read ${n} metadata bytes, but only read ${t}.`,ps=(n,t)=>`Expected to read ${n} bytes for message body, but only read ${t}.`,ms=n=>`Unsupported message type: ${n} (${yt(k,n)})`;function We(n,t){let e=p(n,t)||0;if(t+=st,e===-1&&(e=p(n,t)||0,t+=st),e===0)return null;let r=n.subarray(t,t+=e);if(r.byteLength<e)throw new Error(ls(e,r.byteLength));let s=x(r,0),o=s(4,b,_.V1),a=s(6,Pt,k.NONE),c=s(8,H,0),u=s(10,w,0),d;if(c){let m=a===k.Schema?ze:a===k.DictionaryBatch?Nr:a===k.RecordBatch?He:null;if(!m)throw new Error(ms(a));if(d=m(r,c,o),u>0){let l=n.subarray(t,t+=u);if(l.byteLength<u)throw new Error(ps(u,l.byteLength));d.body=l;}else a!==k.Schema&&(d.body=new Uint8Array(0));}return {version:o,type:a,index:t,content:d}}function Ur(n){let t=rr(n)?new Uint8Array(n):n;return t instanceof Uint8Array&&hs(t)?Is(t):ys(t)}function hs(n){if(!n||n.length<4)return false;for(let t=0;t<6;++t)if(Ot[t]!==n[t])return false;return true}function ys(n){let t=[n].flat(),e,r=[],s=[];for(let o of t){if(!(o instanceof Uint8Array))throw new Error("IPC data batch was not a Uint8Array.");let a=0;for(;;){let c=We(o,a);if(c===null)break;if(a=c.index,!!c.content)switch(c.type){case k.Schema:e||(e=c.content);break;case k.RecordBatch:r.push(c.content);break;case k.DictionaryBatch:s.push(c.content);break}}}return {schema:e,dictionaries:s,records:r,metadata:null}}function Is(n){let t=n.byteLength-(Ot.length+4),e=p(n,t),r=x(n,t-e),s=r(4,b,_.V1),o=r(8,Gn,[]),a=r(10,Gn,[]);return {schema:r(6,(c,u)=>ze(c,u,s)),dictionaries:o.map(({offset:c})=>We(n,c).content),records:a.map(({offset:c})=>We(n,c).content),metadata:r(12,Gt)}}function Wn(n,t){return gs(Ur(n),t)}function gs(n,t={}){let{schema:e={fields:[]},dictionaries:r,records:s}=n,{version:o,fields:a}=e,c=new Map,u=ws(t,o,c),d=new Map;Es(e,h=>{let E=h.type;E.typeId===i.Dictionary&&d.set(E.id,E.dictionary);});let m=new Map;for(let h of r){let{id:E,data:F,isDelta:O,body:Y}=h,M=d.get(E),dt=zn(M,u({...F,body:Y}));if(m.has(E)){let f=m.get(E);O||f.clear(),f.add(dt);}else {if(O)throw new Error("Delta update can not be first dictionary batch.");m.set(E,qn(M).add(dt));}}m.forEach((h,E)=>c.set(E,h.done()));let l=a.map(h=>qn(h.type));for(let h of s){let E=u(h);a.forEach((F,O)=>l[O].add(zn(F.type,E)));}return new at(e,l.map(h=>h.done()),t.useProxy)}function Es(n,t){n.fields.forEach(function e(r){t(r),r.type.dictionary?.children?.forEach(e),r.type.children?.forEach(e);});}function ws(n,t,e){let r={version:t,options:n,dictionary:s=>e.get(s)};return s=>{let{length:o,nodes:a,regions:c,compression:u,variadic:d,body:m}=s,l=-1,h=-1,E=-1;return {...r,length:o,node:()=>a[++l],buffer:F=>{let{bytes:O,length:Y,offset:M}=Rs(m,c[++h],u);return F?new F(O.buffer,O.byteOffset+M,Y/F.BYTES_PER_ELEMENT):O.subarray(M,M+Y)},variadic:()=>d[++E],visit(F){return F.map(O=>zn(O.type,this))}}}}function Rs(n,t,e){if(e){if(e.method!==lt.BUFFER)throw new Error(`Unknown compression method (${e.method})`);{let r=e.codec,s=Ge(r);if(!s)throw new Error(jn(r));return vr(n,t,s)}}else return {bytes:n,...t}}function zn(n,t){let{typeId:e}=n,{options:r,node:s,buffer:o,variadic:a,version:c}=t,u=ct(n,r),d={...s(),type:n};if(e===i.Null)return new u({...d,nullCount:d.length});switch(e){case i.Bool:case i.Int:case i.Time:case i.Duration:case i.Float:case i.Decimal:case i.Date:case i.Timestamp:case i.Interval:case i.FixedSizeBinary:return new u({...d,validity:o(),values:o(n.values)});case i.Utf8:case i.LargeUtf8:case i.Binary:case i.LargeBinary:return new u({...d,validity:o(),offsets:o(n.offsets),values:o()});case i.BinaryView:case i.Utf8View:return new u({...d,validity:o(),values:o(),data:Array.from({length:a()},()=>o())});case i.List:case i.LargeList:case i.Map:return new u({...d,validity:o(),offsets:o(n.offsets),children:t.visit(n.children)});case i.ListView:case i.LargeListView:return new u({...d,validity:o(),offsets:o(n.offsets),sizes:o(n.offsets),children:t.visit(n.children)});case i.FixedSizeList:case i.Struct:return new u({...d,validity:o(),children:t.visit(n.children)});case i.RunEndEncoded:return new u({...d,children:t.visit(n.children)});case i.Dictionary:{let{id:m,indices:l}=n;return new u({...d,validity:o(),values:o(l.values)}).setDictionary(t.dictionary(m))}case i.Union:return c<_.V5&&o(),new u({...d,typeIds:o(nt),offsets:n.mode===$.Sparse?null:o(n.offsets),children:t.visit(n.children)});default:throw new Error(j(e))}}new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;function R(n){return new Ye(n)}var Ye=class{constructor(t=q){this.buf=new t(512);}array(t){return or(this.buf,t)}prep(t){t>=this.buf.length&&(this.buf=In(this.buf,t));}get(t){return this.buf[t]}set(t,e){this.prep(e),this.buf[e]=t;}write(t,e){this.prep(e+t.length),this.buf.set(t,e);}};function $e(){return new Yn}var Yn=class extends Ye{set(t){let e=t>>3;this.prep(e),this.buf[e]|=1<<t%8;}};var tt=class{constructor(t,e){this.type=t,this.ctx=e,this.batchClass=e.batchType(t);}init(){return this.index=-1,this}set(t,e){return this.index=e,false}done(){return null}batch(){let t=new this.batchClass(this.done());return this.init(),t}};var g=class extends tt{constructor(t,e){super(t,e);}init(){return this.nullCount=0,this.validity=$e(),super.init()}set(t,e){this.index=e;let r=t!=null;return r?this.validity.set(e):this.nullCount++,r}done(){let{index:t,nullCount:e,type:r,validity:s}=this;return {length:t+1,nullCount:e,type:r,validity:e?s.array((t>>3)+1):new q(0)}}};function Ht(){let n=new Map,t=new Set;return {get(e,r){let s=e.id;if(s>=0&&n.has(s))return n.get(s);{let o=Os(e,r);return s>=0&&n.set(s,o),t.add(o),o}},finish(e){t.forEach(r=>r.finish(e));}}}function Os(n,t){let e=Object.create(null),r=t.builder(n.dictionary),s=[];r.init();let o=-1;return {type:n,values:r,add(a){return s.push(a),a},key(a){let c=Rt(a),u=e[c];return u===void 0&&(e[c]=u=++o,r.set(a,u)),u},finish(a){let c=n.dictionary,u=new(ct(c,a))(r.done()),d=new W([u]);s.forEach(m=>m.setDictionary(d));}}}var Ke=class extends g{constructor(t,e){super(t,e),this.dict=e.dictionary(t);}init(){return this.values=R(this.type.indices.values),super.init()}set(t,e){super.set(t,e)&&this.values.set(this.dict.key(t),e);}done(){return {...super.done(),values:this.values.array(this.index+1)}}batch(){return this.dict.add(super.batch())}};function Pr(n){let t=$n();return n(e=>t.add(e)),t.type()}function $n(){let n=0,t=0,e=0,r=0,s=0,o=0,a=0,c=0,u=0,d=0,m=0,l=1/0,h=-1/0,E=1/0,F=-1/0,O,Y,M,dt={};return {add(f){if(n++,f==null){t++;return}switch(typeof f){case "string":u++;break;case "number":r++,f<l&&(l=f),f>h&&(h=f),Number.isInteger(f)&&s++;break;case "bigint":o++,O===void 0?O=Y=f:(f<O&&(O=f),f>Y&&(Y=f));break;case "boolean":e++;break;case "object":if(f instanceof Date)a++,+f%864e5===0&&c++;else if(ne(f)){d++;let N=f.length;N<E&&(E=N),N>F&&(F=N),M??=$n(),f.forEach(M.add);}else {m++;for(let N in f)(dt[N]??(dt[N]=$n())).add(f[N]);}}},type(){let f=n-t;return f===0?gn():s===f?As(l,h):r===f?It():o===f?Ss(O,Y):e===f?On():c===f?An():a===f?Lt():u===f?St(vt()):d===f?Cs(M.type(),E,F):m===f?Bt(Object.entries(dt).map(N=>rt(N[0],N[1].type()))):Ds()}}}function Cs(n,t,e){return e===t?Ut(n,t):Nt(n)}function As(n,t){let e=Math.max(Math.abs(n)-1,t);return e<128?Dt():e<32768?Ft():e<2**31?X():It()}function Ss(n,t){let e=-n>t?-n-1n:t;if(e>=2**63)throw new Error(`BigInt exceeds 64 bits: ${e}`);return _t()}function Ds(){throw new Error("Mixed types detected, please define a union type.")}var bt=class extends g{constructor(t,e){super(t,e),this.toOffset=ie(t.offsets);}init(){return this.offsets=R(this.type.offsets),this.values=R(),this.pos=0,super.init()}set(t,e){let{offsets:r,values:s,toOffset:o}=this;super.set(t,e)&&(s.write(t,this.pos),this.pos+=t.length),r.set(o(this.pos),e+1);}done(){return {...super.done(),offsets:this.offsets.array(this.index+2),values:this.values.array(this.pos+1)}}};var Qe=class extends g{constructor(t,e){super(t,e);}init(){return this.values=$e(),super.init()}set(t,e){super.set(t,e),t&&this.values.set(e);}done(){return {...super.done(),values:this.values.array((this.index>>3)+1)}}};var Je=class extends g{constructor(t,e){super(t,e),this.scale=10**t.scale,this.stride=t.bitWidth>>6;}init(){return this.values=R(this.type.values),super.init()}set(t,e){let{scale:r,stride:s,values:o}=this;super.set(t,e)&&(o.prep((e+1)*s),Er(t,o.buf,e*s,s,r));}done(){let{index:t,stride:e,values:r}=this;return {...super.done(),values:r.array((t+1)*e)}}};var Xe=class extends g{constructor(t,e){super(t,e),this.stride=t.stride;}init(){return this.values=R(),super.init()}set(t,e){super.set(t,e)&&this.values.write(t,e*this.stride);}done(){let{stride:t,values:e}=this;return {...super.done(),values:e.array(t*(this.index+1))}}};var Ze=class extends g{constructor(t,e){super(t,e),this.child=e.builder(this.type.children[0].type),this.stride=t.stride;}init(){return this.child.init(),super.init()}set(t,e){let{child:r,stride:s}=this,o=e*s;if(super.set(t,e))for(let a=0;a<s;++a)r.set(t[a],o+a);else r.index=o+s;}done(){let{child:t}=this;return {...super.done(),children:[t.batch()]}}};var tn=class extends g{init(){return this.values=R(this.type.values),super.init()}set(t,e){if(super.set(t,e)){let r=e<<1;this.values.set(t[0],r),this.values.set(t[1],r+1);}}done(){return {...super.done(),values:this.values.array(this.index+1<<1)}}},en=class extends g{init(){return this.values=R(),super.init()}set(t,e){super.set(t,e)&&this.values.write(Ir(t),e<<4);}done(){return {...super.done(),values:this.values.array(this.index+1<<4)}}};var zt=class extends g{constructor(t,e,r){super(t,e),this.child=r;}init(){this.child.init();let t=this.type.offsets;return this.offsets=R(t),this.toOffset=ie(t),this.pos=0,super.init()}done(){return {...super.done(),offsets:this.offsets.array(this.index+2),children:[this.child.batch()]}}},nn=class extends zt{constructor(t,e){super(t,e,e.builder(t.children[0].type));}set(t,e){let{child:r,offsets:s,toOffset:o}=this;super.set(t,e)&&t.forEach(a=>r.set(a,this.pos++)),s.set(o(this.pos),e+1);}};var Wt=class extends g{constructor(t,e){super(t,e),this.children=t.children.map(r=>e.builder(r.type));}init(){return this.children.forEach(t=>t.init()),super.init()}done(){let{children:t}=this;return t.forEach(e=>e.index=this.index),{...super.done(),children:t.map(e=>e.batch())}}},rn=class extends Wt{constructor(t,e){super(t,e),this.setters=this.children.map((r,s)=>{let o=t.children[s].name;return (a,c)=>r.set(a?.[o],c)});}set(t,e){super.set(t,e);let r=this.setters;for(let s=0;s<r.length;++s)r[s](t,e);}};var sn=class extends zt{constructor(t,e){super(t,e,new Kn(t.children[0].type,e));}set(t,e){let{child:r,offsets:s,toOffset:o}=this;if(super.set(t,e))for(let a of t)r.set(a,this.pos++);s.set(o(this.pos),e+1);}},Kn=class extends Wt{set(t,e){super.set(t,e);let[r,s]=this.children;r.set(t[0],e),s.set(t[1],e);}};var Fs={},on=class extends tt{constructor(t,e){super(t,e),this.children=t.children.map(r=>e.builder(r.type));}init(){return this.pos=0,this.key=null,this.value=Fs,this.children.forEach(t=>t.init()),super.init()}next(){let[t,e]=this.children;t.set(this.index+1,this.pos),e.set(this.value,this.pos++);}set(t,e){if(t!==this.value){let r=Rt(t);r!==this.key&&(this.key&&this.next(),this.key=r,this.value=t);}this.index=e;}done(){this.next();let{children:t,index:e,type:r}=this;return {length:e+1,nullCount:0,type:r,children:t.map(s=>s.batch())}}};var an=class extends tt{constructor(t,e){super(t,e),this.children=t.children.map(r=>e.builder(r.type)),this.typeMap=t.typeMap,this.lookup=t.typeIdForValue;}init(){return this.nullCount=0,this.typeIds=R(nt),this.children.forEach(t=>t.init()),super.init()}set(t,e){let{children:r,lookup:s,typeMap:o,typeIds:a}=this;this.index=e;let c=s(t,e),u=r[o[c]];a.set(c,e),t==null&&++this.nullCount,this.update(t,e,u);}done(){let{children:t,nullCount:e,type:r,typeIds:s}=this,o=this.index+1;return {length:o,nullCount:e,type:r,typeIds:s.array(o),children:t.map(a=>a.batch())}}},cn=class extends an{update(t,e,r){r.set(t,e),this.children.forEach(s=>{s!==r&&s.set(null,e);});}},un=class extends an{init(){return this.offsets=R(this.type.offsets),super.init()}update(t,e,r){let s=r.index+1;r.set(t,s),this.offsets.set(s,e);}done(){return {...super.done(),offsets:this.offsets.array(this.index+1)}}};var dn=class extends bt{set(t,e){super.set(t&&Mn(t),e);}};var et=class extends g{constructor(t,e){super(t,e),this.values=R(t.values);}init(){return this.values=R(this.type.values),super.init()}set(t,e){super.set(t,e)&&this.values.set(t,e);}done(){return {...super.done(),values:this.values.array(this.index+1)}}},fn=class extends et{set(t,e){super.set(t==null?t:U(t),e);}},ut=class extends et{constructor(t,e,r){super(t,e),this.transform=r;}set(t,e){super.set(t==null?t:this.transform(t),e);}};function Qn(n={},t=Ht()){return {batchType:e=>ct(e,n),builder(e){return Jn(e,this)},dictionary(e){return t.get(e,this)},finish:()=>t.finish(n)}}function Jn(n,t=Qn()){let{typeId:e}=n;switch(e){case i.Int:case i.Time:case i.Duration:return mt(n.values)?new fn(n,t):new et(n,t);case i.Float:return n.precision?new et(n,t):new ut(n,t,Tr);case i.Binary:case i.LargeBinary:return new bt(n,t);case i.Utf8:case i.LargeUtf8:return new dn(n,t);case i.Bool:return new Qe(n,t);case i.Decimal:return n.bitWidth===32?new ut(n,t,gr(n.scale)):new Je(n,t);case i.Date:return new ut(n,t,n.unit?U:hr);case i.Timestamp:return new ut(n,t,yr(n.unit));case i.Interval:switch(n.unit){case S.DAY_TIME:return new tn(n,t);case S.MONTH_DAY_NANO:return new en(n,t)}return new et(n,t);case i.List:case i.LargeList:return new nn(n,t);case i.Struct:return new rn(n,t);case i.Union:return n.mode?new un(n,t):new cn(n,t);case i.FixedSizeBinary:return new Xe(n,t);case i.FixedSizeList:return new Ze(n,t);case i.Map:return new sn(n,t);case i.RunEndEncoded:return new on(n,t);case i.Dictionary:return new Ke(n,t)}throw new Error(j(e))}function Xn(n,t,e={},r){let s=cr(n)?u=>{for(let d of n)u(d);}:n;t??=Pr(s);let{maxBatchRows:o=1/0,...a}=e,c;if(t.typeId===i.Null){let u=0;s(()=>++u),c=_s(t,u,o);}else {let u=Qn(a,r),d=Jn(t,u).init(),m=h=>c.push(h.batch());c=[];let l=0;s(h=>{d.set(h,l++),l>=o&&(m(d),l=0);}),l&&m(d),u.finish();}return new W(c,t)}function _s(n,t,e){let r=[],s=c=>new Tt({length:c,nullCount:c,type:n}),o=Math.floor(t/e);for(let c=0;c<o;++c)r.push(s(e));let a=t%e;return a&&r.push(s(a)),r}function Zn(n,t,e={},r){return !t&&yn(n)?ks(n,e):Xn(s=>n.forEach(s),t,e,r)}function ks(n,{maxBatchRows:t,useBigInt:e}){let r=n.constructor,s=vs(r),o=n.length,a=Math.min(t||1/0,o),c=Math.floor(o/a),u=[],d=mt(r)&&!e?P:z,m=(h,E)=>u.push(new d({length:E-h,nullCount:0,type:s,validity:new q(0),values:n.subarray(h,E)})),l=0;for(let h=0;h<c;++h)m(l,l+=a);return l<o&&m(l,o),new W(u)}function vs(n){switch(n){case ee:return Tn();case K:return It();case nt:return Dt();case hn:return Ft();case C:return X();case A:return _t();case q:return En();case Ct:return wn();case At:return Rn();case pt:return xn()}}function tr(n,t){let e=[],r=Array.isArray(n)?n:Object.entries(n),s=r[0]?.[1].length,o=r.map(([c,u])=>{if(u.length!==s)throw new Error("All columns must have the same length.");return e.push(rt(c,u.type)),u}),a={version:_.V5,endianness:mn.Little,fields:e,metadata:null};return new at(a,o,t)}function er(n,t={}){let{types:e={},...r}=t,s=Ht(),a=(Array.isArray(n)?n:Object.entries(n)).map(([c,u])=>[c,Zn(u,e[c],r,s)]);return tr(a,t.useProxy)}var Yt=class{db;connectionId;preparedStatementId;closed=false;bindings=[];constructor(t,e,r,s){this.db=t,this.connectionId=e,this.preparedStatementId=r;}checkClosed(){if(this.closed)throw new T("Statement is closed")}clearBindings(){this.checkClosed(),this.bindings=[];}bindNull(t){this.checkClosed(),this.bindings.push({index:t,type:"null",value:null});}bindBoolean(t,e){this.checkClosed(),this.bindings.push({index:t,type:"boolean",value:e});}bindInt8(t,e){this.checkClosed(),this.bindings.push({index:t,type:"int8",value:e});}bindInt16(t,e){this.checkClosed(),this.bindings.push({index:t,type:"int16",value:e});}bindInt32(t,e){this.checkClosed(),this.bindings.push({index:t,type:"int32",value:e});}bindInt64(t,e){this.checkClosed(),this.bindings.push({index:t,type:"int64",value:e});}bindUInt8(t,e){this.checkClosed(),this.bindings.push({index:t,type:"uint8",value:e});}bindUInt16(t,e){this.checkClosed(),this.bindings.push({index:t,type:"uint16",value:e});}bindUInt32(t,e){this.checkClosed(),this.bindings.push({index:t,type:"uint32",value:e});}bindUInt64(t,e){this.checkClosed(),this.bindings.push({index:t,type:"uint64",value:e});}bindFloat(t,e){this.checkClosed(),this.bindings.push({index:t,type:"float",value:e});}bindDouble(t,e){this.checkClosed(),this.bindings.push({index:t,type:"double",value:e});}bindVarchar(t,e){this.checkClosed(),this.bindings.push({index:t,type:"varchar",value:e});}bindBlob(t,e){this.checkClosed(),this.bindings.push({index:t,type:"blob",value:e});}async run(){this.checkClosed();let t=await this.db.postTask("RUN_PREPARED",{connectionId:this.connectionId,preparedStatementId:this.preparedStatementId,bindings:this.bindings}),{columns:e,rows:r}=t;return r.map(s=>{let o={};for(let a=0;a<e.length;a++)o[e[a].name]=s[a];return o})}async execute(){return this.checkClosed(),(await this.db.postTask("EXECUTE_PREPARED",{connectionId:this.connectionId,preparedStatementId:this.preparedStatementId,bindings:this.bindings})).rowsChanged}async close(){this.closed||(await this.db.postTask("CLOSE_PREPARED",{connectionId:this.connectionId,preparedStatementId:this.preparedStatementId}),this.closed=true);}};var $t=class{columns;rows;_rowCount;constructor(t,e,r){this.columns=t,this.rows=e,this._rowCount=r;}get rowCount(){return this._rowCount}get columnCount(){return this.columns.length}getColumns(){return this.columns}getRows(){return this.rows}getColumn(t){if(t<0||t>=this.columns.length)throw new Error(`Column index ${t} out of bounds`);return this.rows.map(e=>e[t])}getColumnByName(t){let e=this.columns.findIndex(r=>r.name===t);if(e===-1)throw new Error(`Column "${t}" not found`);return this.getColumn(e)}getRow(t){if(t<0||t>=this._rowCount)throw new Error(`Row index ${t} out of bounds`);return this.rows[t]}getRowObject(t){let e=this.getRow(t),r={};for(let s=0;s<this.columns.length;s++)r[this.columns[s].name]=e[s];return r}toArray(){return this.rows.map(t=>{let e={};for(let r=0;r<this.columns.length;r++)e[this.columns[r].name]=t[r];return e})}*[Symbol.iterator](){for(let t=0;t<this._rowCount;t++)yield this.getRowObject(t);}};var Kt=class{db;connectionId;streamingResultId;columns;closed=false;done=false;constructor(t,e,r,s){this.db=t,this.connectionId=e,this.streamingResultId=r,this.columns=s;}getColumns(){return this.columns}isDone(){return this.done}isClosed(){return this.closed}checkClosed(){if(this.closed)throw new T("Streaming result is closed")}async nextChunk(){if(this.checkClosed(),this.done)return null;let t=await this.db.postTask("FETCH_CHUNK",{connectionId:this.connectionId,streamingResultId:this.streamingResultId});return t.done&&t.rowCount===0?(this.done=true,null):(t.done&&(this.done=true),new $t(t.columns,t.rows,t.rowCount))}async toArray(){let t=[];for await(let e of this)t.push(...e.toArray());return t}async toArrowTable(){let t=[],e=this.columns;for await(let s of this)t.push(...s.getRows());let r={};for(let s=0;s<e.length;s++){let o=e[s].name;r[o]=t.map(a=>a[s]);}return er(r)}async close(){this.closed||(await this.db.postTask("CLOSE_STREAMING_RESULT",{connectionId:this.connectionId,streamingResultId:this.streamingResultId}),this.closed=true);}async*[Symbol.asyncIterator](){try{let t=await this.nextChunk();for(;t!==null;)yield t,t=await this.nextChunk();}finally{this.closed||await this.close();}}};var Qt=class{db;connectionId;closed=false;constructor(t,e){this.db=t,this.connectionId=e;}getConnectionId(){return this.connectionId}getDB(){return this.db}checkClosed(){if(this.closed)throw new T("Connection is closed")}async query(t){this.checkClosed();let e=await this.db.postTask("QUERY",{connectionId:this.connectionId,sql:t}),{columns:r,rows:s}=e;return s.map(o=>{let a={};for(let c=0;c<r.length;c++)a[r[c].name]=o[c];return a})}async queryArrow(t){this.checkClosed();let e=await this.db.postTask("QUERY_ARROW",{connectionId:this.connectionId,sql:t});return Wn(e.ipcBuffer)}async queryStreaming(t){this.checkClosed();let e=await this.db.postTask("QUERY_STREAMING",{connectionId:this.connectionId,sql:t});return new Kt(this.db,this.connectionId,e.streamingResultId,e.columns)}async execute(t){return this.checkClosed(),(await this.db.postTask("EXECUTE",{connectionId:this.connectionId,sql:t})).rowsChanged}async prepare(t){this.checkClosed();let e=await this.db.postTask("PREPARE",{connectionId:this.connectionId,sql:t});return new Yt(this.db,this.connectionId,e.preparedStatementId,t)}async beginTransaction(){this.checkClosed(),await this.db.postTask("BEGIN_TRANSACTION",{connectionId:this.connectionId});}async commit(){this.checkClosed(),await this.db.postTask("COMMIT",{connectionId:this.connectionId});}async rollback(){this.checkClosed(),await this.db.postTask("ROLLBACK",{connectionId:this.connectionId});}async transaction(t){await this.beginTransaction();try{let e=await t();return await this.commit(),e}catch(e){throw await this.rollback(),e}}async insertArrowFromIPCStream(t,e){this.checkClosed(),await this.db.postTask("INSERT_ARROW_FROM_IPC",{connectionId:this.connectionId,tableName:t,ipcBuffer:e},[e.buffer]);}async insertCSVFromPath(t,e,r){this.checkClosed(),await this.db.postTask("INSERT_CSV_FROM_PATH",{connectionId:this.connectionId,tableName:t,path:e,options:r});}async insertJSONFromPath(t,e,r){this.checkClosed(),await this.db.postTask("INSERT_JSON_FROM_PATH",{connectionId:this.connectionId,tableName:t,path:e,options:r});}async close(){this.closed||(await this.db.postTask("DISCONNECT",{connectionId:this.connectionId}),this.closed=true);}};var D=null,Jt=null;async function Mr(n){if(D)return;if(Jt){await Jt;return}let t=typeof n=="string"?{wasmUrl:n}:n??{};Jt=(async()=>{let e=new URL(".",import.meta.url).href,r=t.workerUrl??new URL("worker.js",e).href,s=t.wasmUrl??new URL("wasm/duckdb.wasm",e).href,o=t.wasmJsUrl??new URL("wasm/duckdb.js",e).href,a;t.worker?a=t.worker:typeof location<"u"&&new URL(r,location.href).origin!==location.origin?a=await pn(r):a=new Worker(r,{type:"module"}),await new Promise((c,u)=>{let d=setTimeout(()=>{u(new T("Worker initialization timeout"));},3e4),m=l=>{l.data?.type==="WORKER_READY"&&(clearTimeout(d),a.removeEventListener("message",m),c());};a.addEventListener("message",m);}),D=new ln(a),await D.instantiate(s,o),await D.open(t.config);})(),await Jt;}async function Ls(){if(!D)throw new T("DuckDB WASM not initialized. Call init() first.");return D.getVersion()}function Vr(){if(!D)throw new T("DuckDB WASM not initialized. Call init() first.");return D}var ln=class{worker;pendingRequests=new Map;nextMessageId=1;closed=false;constructor(t){if(t)this.worker=t,this.setupMessageHandler();else {if(!D)throw new T("DuckDB WASM not initialized. Call init() first.");this.worker=D.worker,this.pendingRequests=D.pendingRequests,this.nextMessageId=D.nextMessageId;}}setupMessageHandler(){this.worker.onmessage=t=>{let e=t.data,r=this.pendingRequests.get(e.requestId);if(r)if(this.pendingRequests.delete(e.requestId),e.type==="ERROR"){let s=e.data;r.reject(new T(s.message,s.code,s.query));}else r.resolve(e.data);},this.worker.onerror=t=>{for(let[,e]of this.pendingRequests)e.reject(new T(`Worker error: ${t.message}`));this.pendingRequests.clear();};}postTask(t,e,r){if(this.closed)return Promise.reject(new T("Database is closed"));let s=this.nextMessageId++,o=new te(s,t);this.pendingRequests.set(s,o);let a={messageId:s,type:t,data:e};return r&&r.length>0?this.worker.postMessage(a,r):this.worker.postMessage(a),o.promise}async instantiate(t,e){await this.postTask("INSTANTIATE",{wasmUrl:t,wasmJsUrl:e});}async open(t){await this.postTask("OPEN",{config:t});}async getVersion(){return (await this.postTask("GET_VERSION")).version}async connect(){let t=await this.postTask("CONNECT");return new Qt(this,t.connectionId)}static async createConnection(){return await Mr(),Vr().connect()}async registerFileURL(t,e,r,s){await this.postTask("REGISTER_FILE_URL",{name:t,url:e,protocol:r,directIO:s});}async registerFileBuffer(t,e){await this.postTask("REGISTER_FILE_BUFFER",{name:t,buffer:e},[e.buffer]);}async registerFileText(t,e){await this.postTask("REGISTER_FILE_TEXT",{name:t,text:e});}async dropFile(t){await this.postTask("DROP_FILE",{name:t});}async dropFiles(){await this.postTask("DROP_FILES");}async flushFiles(){await this.postTask("FLUSH_FILES");}async copyFileToBuffer(t){return (await this.postTask("COPY_FILE_TO_BUFFER",{name:t})).buffer}async copyFileToPath(t,e){await this.postTask("COPY_FILE_TO_PATH",{srcName:t,dstPath:e});}async globFiles(t){return (await this.postTask("GLOB_FILES",{pattern:t})).files}async close(){this.closed||(await this.postTask("CLOSE"),this.worker.terminate(),this.closed=true,D===this&&(D=null,Jt=null));}};var Ns={INVALID:0,BOOLEAN:1,TINYINT:2,SMALLINT:3,INTEGER:4,BIGINT:5,UTINYINT:6,USMALLINT:7,UINTEGER:8,UBIGINT:9,FLOAT:10,DOUBLE:11,TIMESTAMP:12,DATE:13,TIME:14,INTERVAL:15,HUGEINT:16,UHUGEINT:32,VARCHAR:17,BLOB:18,DECIMAL:19,TIMESTAMP_S:20,TIMESTAMP_MS:21,TIMESTAMP_NS:22,ENUM:23,LIST:24,STRUCT:25,MAP:26,ARRAY:33,UUID:27,UNION:28,BIT:29,TIME_TZ:30,TIMESTAMP_TZ:31},qr=(r=>(r.AUTOMATIC="automatic",r.READ_ONLY="read_only",r.READ_WRITE="read_write",r))(qr||{});
|
|
3
|
+
export{qr as AccessMode,Qt as Connection,$t as DataChunk,ln as DuckDB,T as DuckDBError,Ns as DuckDBType,Xt as PACKAGE_NAME,Zt as PACKAGE_VERSION,Yt as PreparedStatement,Kt as StreamingResult,pn as createWorker,Vr as getDB,jr as getJsDelivrBundle,Gr as getUnpkgBundle,Mr as init,Ls as version};//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|