@hakistack/ng-daisyui 0.0.0-stage → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +376 -2
  3. package/fesm2022/hakistack-ng-daisyui-document_wasm_glue-BusZZ32t.mjs +327 -0
  4. package/fesm2022/hakistack-ng-daisyui-document_wasm_glue-BusZZ32t.mjs.map +1 -0
  5. package/fesm2022/hakistack-ng-daisyui-document_wasm_inline-HI02T61_.mjs +6 -0
  6. package/fesm2022/hakistack-ng-daisyui-document_wasm_inline-HI02T61_.mjs.map +1 -0
  7. package/fesm2022/hakistack-ng-daisyui-engine_wasm_glue-ClEcb6yJ.mjs +1328 -0
  8. package/fesm2022/hakistack-ng-daisyui-engine_wasm_glue-ClEcb6yJ.mjs.map +1 -0
  9. package/fesm2022/hakistack-ng-daisyui-engine_wasm_inline-DkzGyhGY.mjs +6 -0
  10. package/fesm2022/hakistack-ng-daisyui-engine_wasm_inline-DkzGyhGY.mjs.map +1 -0
  11. package/fesm2022/hakistack-ng-daisyui-image_wasm_glue-cLIBHdUJ.mjs +251 -0
  12. package/fesm2022/hakistack-ng-daisyui-image_wasm_glue-cLIBHdUJ.mjs.map +1 -0
  13. package/fesm2022/hakistack-ng-daisyui-image_wasm_inline-dOzXsoNb.mjs +6 -0
  14. package/fesm2022/hakistack-ng-daisyui-image_wasm_inline-dOzXsoNb.mjs.map +1 -0
  15. package/fesm2022/hakistack-ng-daisyui-pdfium_worker_inline-BdPitrud.mjs +7 -0
  16. package/fesm2022/hakistack-ng-daisyui-pdfium_worker_inline-BdPitrud.mjs.map +1 -0
  17. package/fesm2022/hakistack-ng-daisyui-phone-lib-BZ7gmnrv.mjs +9 -0
  18. package/fesm2022/hakistack-ng-daisyui-phone-lib-BZ7gmnrv.mjs.map +1 -0
  19. package/fesm2022/hakistack-ng-daisyui.mjs +51168 -0
  20. package/fesm2022/hakistack-ng-daisyui.mjs.map +1 -0
  21. package/package.json +149 -4
  22. package/plugin.cjs +279 -0
  23. package/plugin.mjs +279 -0
  24. package/schematics/collection.json +15 -0
  25. package/schematics/migrate-table-columns/index.js +70 -0
  26. package/schematics/migrate-table-columns/index.js.map +1 -0
  27. package/schematics/migrate-table-columns/migrate-source.js +0 -0
  28. package/schematics/migrate-table-columns/migrate-source.js.map +1 -0
  29. package/schematics/migrate-table-columns/schema.js +3 -0
  30. package/schematics/migrate-table-columns/schema.js.map +1 -0
  31. package/schematics/migrate-table-columns/schema.json +13 -0
  32. package/schematics/ng-add/index.js +273 -0
  33. package/schematics/ng-add/index.js.map +1 -0
  34. package/schematics/ng-add/schema.js +3 -0
  35. package/schematics/ng-add/schema.js.map +1 -0
  36. package/schematics/ng-add/schema.json +38 -0
  37. package/styles-v4.css +6967 -0
  38. package/styles.css +400 -0
  39. package/themes/daisyui-v4.css +80 -0
  40. package/themes/daisyui-v5.css +62 -0
  41. package/themes/kaizen-light.css +63 -0
  42. package/themes/kaizen.css +63 -0
  43. package/types/hakistack-ng-daisyui.d.ts +15988 -0
@@ -0,0 +1,1328 @@
1
+ // @ts-nocheck
2
+ /* eslint-disable */
3
+ // Auto-generated by scripts/build-wasm.mjs from engine_wasm.js. Do not edit.
4
+ /* @ts-self-types="./engine_wasm.d.ts" */
5
+ /**
6
+ * Handle to an ingested dataset. Hold one per table-component instance and
7
+ * call [`WasmDataset::free`] in `ngOnDestroy` to release the WASM-heap memory.
8
+ */
9
+ class WasmDataset {
10
+ static __wrap(ptr) {
11
+ const obj = Object.create(WasmDataset.prototype);
12
+ obj.__wbg_ptr = ptr;
13
+ WasmDatasetFinalization.register(obj, obj.__wbg_ptr, obj);
14
+ return obj;
15
+ }
16
+ __destroy_into_raw() {
17
+ const ptr = this.__wbg_ptr;
18
+ this.__wbg_ptr = 0;
19
+ WasmDatasetFinalization.unregister(this);
20
+ return ptr;
21
+ }
22
+ free() {
23
+ const ptr = this.__destroy_into_raw();
24
+ wasm.__wbg_wasmdataset_free(ptr, 0);
25
+ }
26
+ /**
27
+ * Compute one aggregate over the given column.
28
+ *
29
+ * `indices == null` ⇒ aggregate over the entire dataset
30
+ * (`RowSet::All`). Otherwise the aggregate runs over the supplied subset.
31
+ * @param {number} column
32
+ * @param {Uint32Array | null | undefined} indices
33
+ * @param {any} agg
34
+ * @returns {any}
35
+ */
36
+ aggregate(column, indices, agg) {
37
+ try {
38
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
39
+ wasm.wasmdataset_aggregate(retptr, this.__wbg_ptr, column, isLikeNone(indices) ? 0 : addHeapObject(indices), addHeapObject(agg));
40
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
41
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
42
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
43
+ if (r2) {
44
+ throw takeObject(r1);
45
+ }
46
+ return takeObject(r0);
47
+ }
48
+ finally {
49
+ wasm.__wbindgen_add_to_stack_pointer(16);
50
+ }
51
+ }
52
+ /**
53
+ * Apply filters, AND-combined. Empty filter list ⇒ all rows pass.
54
+ * Returns row indices in source order.
55
+ * @param {any} filters
56
+ * @returns {Uint32Array}
57
+ */
58
+ filter(filters) {
59
+ try {
60
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
61
+ wasm.wasmdataset_filter(retptr, this.__wbg_ptr, addHeapObject(filters));
62
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
63
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
64
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
65
+ if (r2) {
66
+ throw takeObject(r1);
67
+ }
68
+ return takeObject(r0);
69
+ }
70
+ finally {
71
+ wasm.__wbindgen_add_to_stack_pointer(16);
72
+ }
73
+ }
74
+ /**
75
+ * Multi-level group. Returns a tree of `WireGroup` nodes.
76
+ * `columns` is the chain of grouping fields (e.g. `[country_id, state_id]`).
77
+ * `indices == null` ⇒ group across the entire dataset.
78
+ * @param {Uint32Array} columns
79
+ * @param {Uint32Array | null} [indices]
80
+ * @returns {any}
81
+ */
82
+ group(columns, indices) {
83
+ try {
84
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
85
+ const ptr0 = passArray32ToWasm0(columns, wasm.__wbindgen_export);
86
+ const len0 = WASM_VECTOR_LEN;
87
+ wasm.wasmdataset_group(retptr, this.__wbg_ptr, ptr0, len0, isLikeNone(indices) ? 0 : addHeapObject(indices));
88
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
89
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
90
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
91
+ if (r2) {
92
+ throw takeObject(r1);
93
+ }
94
+ return takeObject(r0);
95
+ }
96
+ finally {
97
+ wasm.__wbindgen_add_to_stack_pointer(16);
98
+ }
99
+ }
100
+ /**
101
+ * Build a dataset from columnar arrays.
102
+ *
103
+ * Arguments:
104
+ * - `n_rows`: total row count (every column array must match)
105
+ * - `schema`: `Array<{ id: number, kind: 'text' | 'number' | 'bool' | 'date' }>`
106
+ * - `columns`: `Array` of per-column payloads, same order and length as
107
+ * `schema`. Wire shape depends on column kind:
108
+ * - `text` ⇒ `(string | null)[]` (serde path — strings have no
109
+ * packed typed-array form)
110
+ * - `number` ⇒ `{ values: Float64Array, validity: Uint8Array }`
111
+ * - `bool` ⇒ `{ values: Uint8Array (0/1), validity: Uint8Array }`
112
+ * - `date` ⇒ `{ values: Float64Array (ms-epoch), validity: Uint8Array }`
113
+ *
114
+ * The typed-array pairs are bulk-copied into Rust via `TypedArray::to_vec`
115
+ * (one memcpy per column), then the validity `Uint8Array` is packed into
116
+ * a `Bitset` for word-at-a-time filter scans. This skips the per-row
117
+ * `Option<X>` wrapping that the prior all-serde path paid for —
118
+ * `serde_wasm_bindgen::from_value` allocated `N` heap Options per
119
+ * numeric column, dominating ingest time on large datasets.
120
+ * @param {number} n_rows
121
+ * @param {any} schema
122
+ * @param {Array<any>} columns
123
+ * @returns {WasmDataset}
124
+ */
125
+ static ingest(n_rows, schema, columns) {
126
+ try {
127
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
128
+ wasm.wasmdataset_ingest(retptr, n_rows, addHeapObject(schema), addHeapObject(columns));
129
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
130
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
131
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
132
+ if (r2) {
133
+ throw takeObject(r1);
134
+ }
135
+ return WasmDataset.__wrap(r0);
136
+ }
137
+ finally {
138
+ wasm.__wbindgen_add_to_stack_pointer(16);
139
+ }
140
+ }
141
+ /**
142
+ * @returns {number}
143
+ */
144
+ n_rows() {
145
+ const ret = wasm.wasmdataset_n_rows(this.__wbg_ptr);
146
+ return ret >>> 0;
147
+ }
148
+ /**
149
+ * Apply a global multi-column search and return the matching-row mask.
150
+ * Empty term ⇒ empty result (caller composes with the filter mask, where
151
+ * "no search" means "no constraint added", not "everything matches").
152
+ * @param {any} spec
153
+ * @returns {Uint32Array}
154
+ */
155
+ search(spec) {
156
+ try {
157
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
158
+ wasm.wasmdataset_search(retptr, this.__wbg_ptr, addHeapObject(spec));
159
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
160
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
161
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
162
+ if (r2) {
163
+ throw takeObject(r1);
164
+ }
165
+ return takeObject(r0);
166
+ }
167
+ finally {
168
+ wasm.__wbindgen_add_to_stack_pointer(16);
169
+ }
170
+ }
171
+ /**
172
+ * Sort the given indices by a multi-tier sort spec, return the new order.
173
+ * Stable sort, so callers can chain by re-sorting the previous output.
174
+ * @param {Uint32Array} indices
175
+ * @param {any} specs
176
+ * @returns {Uint32Array}
177
+ */
178
+ sort(indices, specs) {
179
+ try {
180
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
181
+ wasm.wasmdataset_sort(retptr, this.__wbg_ptr, addBorrowedObject(indices), addHeapObject(specs));
182
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
183
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
184
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
185
+ if (r2) {
186
+ throw takeObject(r1);
187
+ }
188
+ return takeObject(r0);
189
+ }
190
+ finally {
191
+ wasm.__wbindgen_add_to_stack_pointer(16);
192
+ heap[stack_pointer++] = undefined;
193
+ }
194
+ }
195
+ }
196
+ if (Symbol.dispose)
197
+ WasmDataset.prototype[Symbol.dispose] = WasmDataset.prototype.free;
198
+ /**
199
+ * Handle to a form-engine instance. Owns the immutable schema, the
200
+ * per-form runtime state (value map + visibility / required / disabled
201
+ * bitsets), and the JS predicate registry for `function`-op conditions.
202
+ *
203
+ * One handle per `<hk-dynamic-form>`; call `free()` (auto-generated by
204
+ * wasm-bindgen) in `ngOnDestroy` to release WASM-heap memory.
205
+ */
206
+ class WasmFormEngine {
207
+ static __wrap(ptr) {
208
+ const obj = Object.create(WasmFormEngine.prototype);
209
+ obj.__wbg_ptr = ptr;
210
+ WasmFormEngineFinalization.register(obj, obj.__wbg_ptr, obj);
211
+ return obj;
212
+ }
213
+ __destroy_into_raw() {
214
+ const ptr = this.__wbg_ptr;
215
+ this.__wbg_ptr = 0;
216
+ WasmFormEngineFinalization.unregister(this);
217
+ return ptr;
218
+ }
219
+ free() {
220
+ const ptr = this.__destroy_into_raw();
221
+ wasm.__wbg_wasmformengine_free(ptr, 0);
222
+ }
223
+ /**
224
+ * @returns {number}
225
+ */
226
+ field_count() {
227
+ const ret = wasm.wasmformengine_field_count(this.__wbg_ptr);
228
+ return ret >>> 0;
229
+ }
230
+ /**
231
+ * Resolve a field name to its index. Returns `u32::MAX` for unknown
232
+ * names — JS contract: the adapter caches this map once and never
233
+ * hits the lookup on the hot path.
234
+ * @param {string} name
235
+ * @returns {number}
236
+ */
237
+ index_of(name) {
238
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
239
+ const len0 = WASM_VECTOR_LEN;
240
+ const ret = wasm.wasmformengine_index_of(this.__wbg_ptr, ptr0, len0);
241
+ return ret >>> 0;
242
+ }
243
+ /**
244
+ * Build a new engine from a `WireFormSchema`. The schema is uploaded
245
+ * once; per-keystroke calls only ship value updates.
246
+ * @param {any} schema
247
+ * @returns {WasmFormEngine}
248
+ */
249
+ static ingest(schema) {
250
+ try {
251
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
252
+ wasm.wasmformengine_ingest(retptr, addHeapObject(schema));
253
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
254
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
255
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
256
+ if (r2) {
257
+ throw takeObject(r1);
258
+ }
259
+ return WasmFormEngine.__wrap(r0);
260
+ }
261
+ finally {
262
+ wasm.__wbindgen_add_to_stack_pointer(16);
263
+ }
264
+ }
265
+ /**
266
+ * @param {number} field
267
+ * @returns {boolean}
268
+ */
269
+ is_disabled(field) {
270
+ const ret = wasm.wasmformengine_is_disabled(this.__wbg_ptr, field);
271
+ return ret !== 0;
272
+ }
273
+ /**
274
+ * @param {number} field
275
+ * @returns {boolean}
276
+ */
277
+ is_required(field) {
278
+ const ret = wasm.wasmformengine_is_required(this.__wbg_ptr, field);
279
+ return ret !== 0;
280
+ }
281
+ /**
282
+ * @param {number} field
283
+ * @returns {boolean}
284
+ */
285
+ is_visible(field) {
286
+ const ret = wasm.wasmformengine_is_visible(this.__wbg_ptr, field);
287
+ return ret !== 0;
288
+ }
289
+ /**
290
+ * Full pass. Used by the TS adapter when an external signal moves
291
+ * (no `formValues` diff available) and `function`-predicate fields
292
+ * must be re-checked alongside every other conditional field.
293
+ * @returns {Uint32Array}
294
+ */
295
+ recompute_all() {
296
+ const ret = wasm.wasmformengine_recompute_all(this.__wbg_ptr);
297
+ return takeObject(ret);
298
+ }
299
+ /**
300
+ * Register a JS function-operator predicate. `id` is the value the
301
+ * schema's `WireFormValue::Callback { id }` will refer to; the
302
+ * function is zero-arg and returns boolean.
303
+ * @param {number} id
304
+ * @param {Function} evaluator
305
+ */
306
+ register_predicate(id, evaluator) {
307
+ wasm.wasmformengine_register_predicate(this.__wbg_ptr, id, addHeapObject(evaluator));
308
+ }
309
+ /**
310
+ * Push a single field value. Returns a packed `Uint32Array` of
311
+ * `(kind, field, payload)` triples — empty when the value is the
312
+ * same as the previous one or no observable transition occurred.
313
+ * @param {number} field
314
+ * @param {any} value
315
+ * @returns {Uint32Array}
316
+ */
317
+ set_value(field, value) {
318
+ try {
319
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
320
+ wasm.wasmformengine_set_value(retptr, this.__wbg_ptr, field, addHeapObject(value));
321
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
322
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
323
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
324
+ if (r2) {
325
+ throw takeObject(r1);
326
+ }
327
+ return takeObject(r0);
328
+ }
329
+ finally {
330
+ wasm.__wbindgen_add_to_stack_pointer(16);
331
+ }
332
+ }
333
+ /**
334
+ * Batch write: array of `[field_idx, value]` pairs. Single dep-graph
335
+ * walk afterward, so two changes that touch the same downstream
336
+ * field only emit one transition event.
337
+ * @param {any} pairs
338
+ * @returns {Uint32Array}
339
+ */
340
+ set_values(pairs) {
341
+ try {
342
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
343
+ wasm.wasmformengine_set_values(retptr, this.__wbg_ptr, addHeapObject(pairs));
344
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
345
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
346
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
347
+ if (r2) {
348
+ throw takeObject(r1);
349
+ }
350
+ return takeObject(r0);
351
+ }
352
+ finally {
353
+ wasm.__wbindgen_add_to_stack_pointer(16);
354
+ }
355
+ }
356
+ /**
357
+ * @param {number} id
358
+ */
359
+ unregister_predicate(id) {
360
+ wasm.wasmformengine_unregister_predicate(this.__wbg_ptr, id);
361
+ }
362
+ }
363
+ if (Symbol.dispose)
364
+ WasmFormEngine.prototype[Symbol.dispose] = WasmFormEngine.prototype.free;
365
+ /**
366
+ * Handle to a fuzzy-search index. Powers `<hk-command-palette>` and
367
+ * `<hk-select>` per-keystroke ranking, replacing Fuse.js. Each input string
368
+ * becomes one searchable item; query results are returned as
369
+ * `(item_index, score)` pairs sorted by score descending.
370
+ */
371
+ class WasmFuzzyIndex {
372
+ static __wrap(ptr) {
373
+ const obj = Object.create(WasmFuzzyIndex.prototype);
374
+ obj.__wbg_ptr = ptr;
375
+ WasmFuzzyIndexFinalization.register(obj, obj.__wbg_ptr, obj);
376
+ return obj;
377
+ }
378
+ __destroy_into_raw() {
379
+ const ptr = this.__wbg_ptr;
380
+ this.__wbg_ptr = 0;
381
+ WasmFuzzyIndexFinalization.unregister(this);
382
+ return ptr;
383
+ }
384
+ free() {
385
+ const ptr = this.__destroy_into_raw();
386
+ wasm.__wbg_wasmfuzzyindex_free(ptr, 0);
387
+ }
388
+ /**
389
+ * Build an index from a flat list of strings. Index `i` in `items`
390
+ * is the index returned by `search`.
391
+ * @param {string[]} items
392
+ * @returns {WasmFuzzyIndex}
393
+ */
394
+ static ingest(items) {
395
+ const ptr0 = passArrayJsValueToWasm0(items, wasm.__wbindgen_export);
396
+ const len0 = WASM_VECTOR_LEN;
397
+ const ret = wasm.wasmfuzzyindex_ingest(ptr0, len0);
398
+ return WasmFuzzyIndex.__wrap(ret);
399
+ }
400
+ /**
401
+ * @returns {number}
402
+ */
403
+ n_items() {
404
+ const ret = wasm.wasmfuzzyindex_n_items(this.__wbg_ptr);
405
+ return ret >>> 0;
406
+ }
407
+ /**
408
+ * Run a query. Returns a packed `Uint32Array` where consecutive pairs
409
+ * are `(item_index, score)`. Length is `2 × match_count`. JS reads in
410
+ * groups of two and decodes into `{ index, score }` records.
411
+ *
412
+ * `opts.max_results === 0` means "no cap" (all matches returned).
413
+ * @param {string} query
414
+ * @param {any} opts
415
+ * @returns {Uint32Array}
416
+ */
417
+ search(query, opts) {
418
+ try {
419
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
420
+ const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export, wasm.__wbindgen_export2);
421
+ const len0 = WASM_VECTOR_LEN;
422
+ wasm.wasmfuzzyindex_search(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(opts));
423
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
424
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
425
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
426
+ if (r2) {
427
+ throw takeObject(r1);
428
+ }
429
+ return takeObject(r0);
430
+ }
431
+ finally {
432
+ wasm.__wbindgen_add_to_stack_pointer(16);
433
+ }
434
+ }
435
+ }
436
+ if (Symbol.dispose)
437
+ WasmFuzzyIndex.prototype[Symbol.dispose] = WasmFuzzyIndex.prototype.free;
438
+ /**
439
+ * Handle to a PDF in-document search index. Pages are added lazily as PDF.js
440
+ * produces text content via `getTextContent()`. Searches scan every ingested
441
+ * page and return packed `(page, char_start, char_len)` triples that the
442
+ * highlight painter resolves to text-layer DOM spans via [`resolve_hit`].
443
+ */
444
+ class WasmPdfIndex {
445
+ static __wrap(ptr) {
446
+ const obj = Object.create(WasmPdfIndex.prototype);
447
+ obj.__wbg_ptr = ptr;
448
+ WasmPdfIndexFinalization.register(obj, obj.__wbg_ptr, obj);
449
+ return obj;
450
+ }
451
+ __destroy_into_raw() {
452
+ const ptr = this.__wbg_ptr;
453
+ this.__wbg_ptr = 0;
454
+ WasmPdfIndexFinalization.unregister(this);
455
+ return ptr;
456
+ }
457
+ free() {
458
+ const ptr = this.__destroy_into_raw();
459
+ wasm.__wbg_wasmpdfindex_free(ptr, 0);
460
+ }
461
+ /**
462
+ * Ingest a page's text items. `text_items` is the array PDF.js's
463
+ * `getTextContent().items.map(it => it.str)` produces — same order as
464
+ * the text-layer DOM spans, so item indices map back 1-to-1.
465
+ * @param {number} page
466
+ * @param {string[]} text_items
467
+ */
468
+ add_page(page, text_items) {
469
+ const ptr0 = passArrayJsValueToWasm0(text_items, wasm.__wbindgen_export);
470
+ const len0 = WASM_VECTOR_LEN;
471
+ wasm.wasmpdfindex_add_page(this.__wbg_ptr, page, ptr0, len0);
472
+ }
473
+ /**
474
+ * @param {number} page
475
+ * @returns {boolean}
476
+ */
477
+ has_page(page) {
478
+ const ret = wasm.wasmpdfindex_has_page(this.__wbg_ptr, page);
479
+ return ret !== 0;
480
+ }
481
+ /**
482
+ * @returns {number}
483
+ */
484
+ n_pages() {
485
+ const ret = wasm.wasmpdfindex_n_pages(this.__wbg_ptr);
486
+ return ret >>> 0;
487
+ }
488
+ /**
489
+ * Build an empty index for `page_count` pages. All pages start
490
+ * uningested; call [`add_page`] as PDF.js delivers each page's text.
491
+ * @param {number} page_count
492
+ * @returns {WasmPdfIndex}
493
+ */
494
+ static new(page_count) {
495
+ const ret = wasm.wasmpdfindex_new(page_count);
496
+ return WasmPdfIndex.__wrap(ret);
497
+ }
498
+ /**
499
+ * Resolve a hit to its text-item indices. Returns a 4-element
500
+ * `Uint32Array`: `(item_start, item_end, intra_start, intra_end)`.
501
+ * Empty array when the hit can't be resolved (page uningested, etc.).
502
+ * @param {number} page
503
+ * @param {number} char_start
504
+ * @param {number} char_len
505
+ * @returns {Uint32Array}
506
+ */
507
+ resolve_hit(page, char_start, char_len) {
508
+ const ret = wasm.wasmpdfindex_resolve_hit(this.__wbg_ptr, page, char_start, char_len);
509
+ return takeObject(ret);
510
+ }
511
+ /**
512
+ * Run a search across every ingested page. Returns a packed
513
+ * `Uint32Array` where each consecutive triple is
514
+ * `(page, char_start, char_len)`. Length is `3 × hit_count`.
515
+ * @param {string} query
516
+ * @param {any} opts
517
+ * @returns {Uint32Array}
518
+ */
519
+ search(query, opts) {
520
+ try {
521
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
522
+ const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export, wasm.__wbindgen_export2);
523
+ const len0 = WASM_VECTOR_LEN;
524
+ wasm.wasmpdfindex_search(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(opts));
525
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
526
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
527
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
528
+ if (r2) {
529
+ throw takeObject(r1);
530
+ }
531
+ return takeObject(r0);
532
+ }
533
+ finally {
534
+ wasm.__wbindgen_add_to_stack_pointer(16);
535
+ }
536
+ }
537
+ }
538
+ if (Symbol.dispose)
539
+ WasmPdfIndex.prototype[Symbol.dispose] = WasmPdfIndex.prototype.free;
540
+ /**
541
+ * Handle to an ingested tree. Mirror of `WasmDataset` but for hierarchical
542
+ * data: filter / flatten / cascade work on node indices; the JS side keeps
543
+ * its original tree by reference and resolves indices back to nodes.
544
+ */
545
+ class WasmTree {
546
+ static __wrap(ptr) {
547
+ const obj = Object.create(WasmTree.prototype);
548
+ obj.__wbg_ptr = ptr;
549
+ WasmTreeFinalization.register(obj, obj.__wbg_ptr, obj);
550
+ return obj;
551
+ }
552
+ __destroy_into_raw() {
553
+ const ptr = this.__wbg_ptr;
554
+ this.__wbg_ptr = 0;
555
+ WasmTreeFinalization.unregister(this);
556
+ return ptr;
557
+ }
558
+ free() {
559
+ const ptr = this.__destroy_into_raw();
560
+ wasm.__wbg_wasmtree_free(ptr, 0);
561
+ }
562
+ /**
563
+ * Cascade up from `changed`. Returns a packed `Uint32Array` of
564
+ * `(ancestor_idx, state)` pairs — `state` ∈ {0=clear, 1=selected, 2=indeterminate}.
565
+ * Length = `2 * ancestor_count`.
566
+ * @param {Uint32Array} selected
567
+ * @param {number} changed
568
+ * @returns {Uint32Array}
569
+ */
570
+ cascade_up(selected, changed) {
571
+ try {
572
+ const ret = wasm.wasmtree_cascade_up(this.__wbg_ptr, addBorrowedObject(selected), changed);
573
+ return takeObject(ret);
574
+ }
575
+ finally {
576
+ heap[stack_pointer++] = undefined;
577
+ }
578
+ }
579
+ /**
580
+ * Apply a label filter and return the visibility mask packed as a
581
+ * `Uint32Array` of *visible* node indices in source order.
582
+ * @param {any} spec
583
+ * @returns {Uint32Array}
584
+ */
585
+ filter(spec) {
586
+ try {
587
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
588
+ wasm.wasmtree_filter(retptr, this.__wbg_ptr, addHeapObject(spec));
589
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
590
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
591
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
592
+ if (r2) {
593
+ throw takeObject(r1);
594
+ }
595
+ return takeObject(r0);
596
+ }
597
+ finally {
598
+ wasm.__wbindgen_add_to_stack_pointer(16);
599
+ }
600
+ }
601
+ /**
602
+ * Flatten the tree, given which nodes are visible and which are expanded.
603
+ * Both inputs are `Uint32Array`s of node indices.
604
+ *
605
+ * Returns a packed `Uint32Array` of `(node, depth, has_children)` triples
606
+ * in DFS preorder. Length is `3 * row_count`. JS reads in groups of three.
607
+ * @param {Uint32Array} visible
608
+ * @param {Uint32Array} expanded
609
+ * @returns {Uint32Array}
610
+ */
611
+ flatten(visible, expanded) {
612
+ try {
613
+ const ret = wasm.wasmtree_flatten(this.__wbg_ptr, addBorrowedObject(visible), addBorrowedObject(expanded));
614
+ return takeObject(ret);
615
+ }
616
+ finally {
617
+ heap[stack_pointer++] = undefined;
618
+ heap[stack_pointer++] = undefined;
619
+ }
620
+ }
621
+ /**
622
+ * Build a tree from a flat DFS-preorder representation.
623
+ *
624
+ * `labels[i]` is the i-th node's display label, `depths[i]` is its
625
+ * depth (0 = root). The JS side walks its hierarchical structure once
626
+ * and produces these flat arrays — much cheaper than nested objects
627
+ * across the boundary.
628
+ * @param {string[]} labels
629
+ * @param {Uint8Array} depths
630
+ * @returns {WasmTree}
631
+ */
632
+ static ingest(labels, depths) {
633
+ try {
634
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
635
+ const ptr0 = passArrayJsValueToWasm0(labels, wasm.__wbindgen_export);
636
+ const len0 = WASM_VECTOR_LEN;
637
+ const ptr1 = passArray8ToWasm0(depths, wasm.__wbindgen_export);
638
+ const len1 = WASM_VECTOR_LEN;
639
+ wasm.wasmtree_ingest(retptr, ptr0, len0, ptr1, len1);
640
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
641
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
642
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
643
+ if (r2) {
644
+ throw takeObject(r1);
645
+ }
646
+ return WasmTree.__wrap(r0);
647
+ }
648
+ finally {
649
+ wasm.__wbindgen_add_to_stack_pointer(16);
650
+ }
651
+ }
652
+ /**
653
+ * O(1) ancestor test using the arena's pre-computed Euler-tour intervals.
654
+ * @param {number} root
655
+ * @param {number} candidate
656
+ * @returns {boolean}
657
+ */
658
+ is_descendant(root, candidate) {
659
+ const ret = wasm.wasmtree_is_descendant(this.__wbg_ptr, root, candidate);
660
+ return ret !== 0;
661
+ }
662
+ /**
663
+ * @returns {number}
664
+ */
665
+ n_nodes() {
666
+ const ret = wasm.wasmtree_n_nodes(this.__wbg_ptr);
667
+ return ret >>> 0;
668
+ }
669
+ /**
670
+ * Return every descendant of `root` in DFS preorder, including `root`.
671
+ * @param {number} root
672
+ * @returns {Uint32Array}
673
+ */
674
+ select_descendants(root) {
675
+ const ret = wasm.wasmtree_select_descendants(this.__wbg_ptr, root);
676
+ return takeObject(ret);
677
+ }
678
+ }
679
+ if (Symbol.dispose)
680
+ WasmTree.prototype[Symbol.dispose] = WasmTree.prototype.free;
681
+ /**
682
+ * Engine version string. Useful smoke-test export and debugging aid.
683
+ * @returns {string}
684
+ */
685
+ function engine_version() {
686
+ let deferred1_0;
687
+ let deferred1_1;
688
+ try {
689
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
690
+ wasm.engine_version(retptr);
691
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
692
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
693
+ deferred1_0 = r0;
694
+ deferred1_1 = r1;
695
+ return getStringFromWasm0(r0, r1);
696
+ }
697
+ finally {
698
+ wasm.__wbindgen_add_to_stack_pointer(16);
699
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
700
+ }
701
+ }
702
+ /**
703
+ * Called automatically when the module is instantiated.
704
+ */
705
+ function init() {
706
+ wasm.init();
707
+ }
708
+ function __wbg_get_imports() {
709
+ const import0 = {
710
+ __proto__: null,
711
+ __wbg_Error_bce6d499ff0a4aff: function (arg0, arg1) {
712
+ const ret = Error(getStringFromWasm0(arg0, arg1));
713
+ return addHeapObject(ret);
714
+ },
715
+ __wbg_Number_b7972a139bfbfdf0: function (arg0) {
716
+ const ret = Number(getObject(arg0));
717
+ return ret;
718
+ },
719
+ __wbg_String_8564e559799eccda: function (arg0, arg1) {
720
+ const ret = String(getObject(arg1));
721
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
722
+ const len1 = WASM_VECTOR_LEN;
723
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
724
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
725
+ },
726
+ __wbg___wbindgen_bigint_get_as_i64_410e28c7b761ad83: function (arg0, arg1) {
727
+ const v = getObject(arg1);
728
+ const ret = typeof v === 'bigint' ? v : undefined;
729
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
730
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
731
+ },
732
+ __wbg___wbindgen_boolean_get_2304fb8c853028c8: function (arg0) {
733
+ const v = getObject(arg0);
734
+ const ret = typeof v === 'boolean' ? v : undefined;
735
+ return isLikeNone(ret) ? 0xffffff : ret ? 1 : 0;
736
+ },
737
+ __wbg___wbindgen_debug_string_edece8177ad01481: function (arg0, arg1) {
738
+ const ret = debugString(getObject(arg1));
739
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
740
+ const len1 = WASM_VECTOR_LEN;
741
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
742
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
743
+ },
744
+ __wbg___wbindgen_in_07056af4f902c445: function (arg0, arg1) {
745
+ const ret = getObject(arg0) in getObject(arg1);
746
+ return ret;
747
+ },
748
+ __wbg___wbindgen_is_bigint_aeae3893f30ed54e: function (arg0) {
749
+ const ret = typeof getObject(arg0) === 'bigint';
750
+ return ret;
751
+ },
752
+ __wbg___wbindgen_is_function_5cd60d5cf78b4eef: function (arg0) {
753
+ const ret = typeof getObject(arg0) === 'function';
754
+ return ret;
755
+ },
756
+ __wbg___wbindgen_is_object_b4593df85baada48: function (arg0) {
757
+ const val = getObject(arg0);
758
+ const ret = typeof val === 'object' && val !== null;
759
+ return ret;
760
+ },
761
+ __wbg___wbindgen_is_string_dde0fd9020db4434: function (arg0) {
762
+ const ret = typeof getObject(arg0) === 'string';
763
+ return ret;
764
+ },
765
+ __wbg___wbindgen_is_undefined_35bb9f4c7fd651d5: function (arg0) {
766
+ const ret = getObject(arg0) === undefined;
767
+ return ret;
768
+ },
769
+ __wbg___wbindgen_jsval_eq_c0ed08b3e0f393b9: function (arg0, arg1) {
770
+ const ret = getObject(arg0) === getObject(arg1);
771
+ return ret;
772
+ },
773
+ __wbg___wbindgen_jsval_loose_eq_0ad77b7717db155c: function (arg0, arg1) {
774
+ const ret = getObject(arg0) == getObject(arg1);
775
+ return ret;
776
+ },
777
+ __wbg___wbindgen_number_get_f73a1244370fcc2c: function (arg0, arg1) {
778
+ const obj = getObject(arg1);
779
+ const ret = typeof obj === 'number' ? obj : undefined;
780
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
781
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
782
+ },
783
+ __wbg___wbindgen_string_get_d109740c0d18f4d7: function (arg0, arg1) {
784
+ const obj = getObject(arg1);
785
+ const ret = typeof obj === 'string' ? obj : undefined;
786
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
787
+ var len1 = WASM_VECTOR_LEN;
788
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
789
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
790
+ },
791
+ __wbg___wbindgen_throw_9c31b086c2b26051: function (arg0, arg1) {
792
+ throw new Error(getStringFromWasm0(arg0, arg1));
793
+ },
794
+ __wbg_call_13665d9f14390edc: function () {
795
+ return handleError(function (arg0, arg1) {
796
+ const ret = getObject(arg0).call(getObject(arg1));
797
+ return addHeapObject(ret);
798
+ }, arguments);
799
+ },
800
+ __wbg_done_54b8da57023b7ed2: function (arg0) {
801
+ const ret = getObject(arg0).done;
802
+ return ret;
803
+ },
804
+ __wbg_entries_564a7e8b1e54ede5: function (arg0) {
805
+ const ret = Object.entries(getObject(arg0));
806
+ return addHeapObject(ret);
807
+ },
808
+ __wbg_get_3e9a707ab7d352eb: function () {
809
+ return handleError(function (arg0, arg1) {
810
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
811
+ return addHeapObject(ret);
812
+ }, arguments);
813
+ },
814
+ __wbg_get_98fdf51d029a75eb: function (arg0, arg1) {
815
+ const ret = getObject(arg0)[arg1 >>> 0];
816
+ return addHeapObject(ret);
817
+ },
818
+ __wbg_get_dcf82ab8aad1a593: function () {
819
+ return handleError(function (arg0, arg1) {
820
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
821
+ return addHeapObject(ret);
822
+ }, arguments);
823
+ },
824
+ __wbg_get_unchecked_1dfe6d05ad91d9b7: function (arg0, arg1) {
825
+ const ret = getObject(arg0)[arg1 >>> 0];
826
+ return addHeapObject(ret);
827
+ },
828
+ __wbg_get_with_ref_key_6412cf3094599694: function (arg0, arg1) {
829
+ const ret = getObject(arg0)[getObject(arg1)];
830
+ return addHeapObject(ret);
831
+ },
832
+ __wbg_instanceof_ArrayBuffer_53db37b06f6b9afe: function (arg0) {
833
+ let result;
834
+ try {
835
+ result = getObject(arg0) instanceof ArrayBuffer;
836
+ }
837
+ catch (_) {
838
+ result = false;
839
+ }
840
+ const ret = result;
841
+ return ret;
842
+ },
843
+ __wbg_instanceof_Float64Array_3bb8295dc7055274: function (arg0) {
844
+ let result;
845
+ try {
846
+ result = getObject(arg0) instanceof Float64Array;
847
+ }
848
+ catch (_) {
849
+ result = false;
850
+ }
851
+ const ret = result;
852
+ return ret;
853
+ },
854
+ __wbg_instanceof_Map_16f217b9a2a08d8c: function (arg0) {
855
+ let result;
856
+ try {
857
+ result = getObject(arg0) instanceof Map;
858
+ }
859
+ catch (_) {
860
+ result = false;
861
+ }
862
+ const ret = result;
863
+ return ret;
864
+ },
865
+ __wbg_instanceof_Uint8Array_abd07d4bd221d50b: function (arg0) {
866
+ let result;
867
+ try {
868
+ result = getObject(arg0) instanceof Uint8Array;
869
+ }
870
+ catch (_) {
871
+ result = false;
872
+ }
873
+ const ret = result;
874
+ return ret;
875
+ },
876
+ __wbg_isArray_94898ed3aad6947b: function (arg0) {
877
+ const ret = Array.isArray(getObject(arg0));
878
+ return ret;
879
+ },
880
+ __wbg_isSafeInteger_01e964d144ad3a55: function (arg0) {
881
+ const ret = Number.isSafeInteger(getObject(arg0));
882
+ return ret;
883
+ },
884
+ __wbg_iterator_1441b47f341dc34f: function () {
885
+ const ret = Symbol.iterator;
886
+ return addHeapObject(ret);
887
+ },
888
+ __wbg_length_2591a0f4f659a55c: function (arg0) {
889
+ const ret = getObject(arg0).length;
890
+ return ret;
891
+ },
892
+ __wbg_length_3a1b902b6cde9e2c: function (arg0) {
893
+ const ret = getObject(arg0).length;
894
+ return ret;
895
+ },
896
+ __wbg_length_56fcd3e2b7e0299d: function (arg0) {
897
+ const ret = getObject(arg0).length;
898
+ return ret;
899
+ },
900
+ __wbg_length_c7ce929623e7a230: function (arg0) {
901
+ const ret = getObject(arg0).length;
902
+ return ret;
903
+ },
904
+ __wbg_new_02d162bc6cf02f60: function () {
905
+ const ret = new Object();
906
+ return addHeapObject(ret);
907
+ },
908
+ __wbg_new_310879b66b6e95e1: function () {
909
+ const ret = new Array();
910
+ return addHeapObject(ret);
911
+ },
912
+ __wbg_new_7ddec6de44ff8f5d: function (arg0) {
913
+ const ret = new Uint8Array(getObject(arg0));
914
+ return addHeapObject(ret);
915
+ },
916
+ __wbg_new_with_length_f128f2c16ad4f906: function (arg0) {
917
+ const ret = new Uint32Array(arg0 >>> 0);
918
+ return addHeapObject(ret);
919
+ },
920
+ __wbg_next_2a4e19f4f5083b0f: function (arg0) {
921
+ const ret = getObject(arg0).next;
922
+ return addHeapObject(ret);
923
+ },
924
+ __wbg_next_6429a146bf756f93: function () {
925
+ return handleError(function (arg0) {
926
+ const ret = getObject(arg0).next();
927
+ return addHeapObject(ret);
928
+ }, arguments);
929
+ },
930
+ __wbg_prototypesetcall_272875b350b1e49b: function (arg0, arg1, arg2) {
931
+ Float64Array.prototype.set.call(getArrayF64FromWasm0(arg0, arg1), getObject(arg2));
932
+ },
933
+ __wbg_prototypesetcall_303283bf37c9f014: function (arg0, arg1, arg2) {
934
+ Uint32Array.prototype.set.call(getArrayU32FromWasm0(arg0, arg1), getObject(arg2));
935
+ },
936
+ __wbg_prototypesetcall_5f9bdc8d75e07276: function (arg0, arg1, arg2) {
937
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
938
+ },
939
+ __wbg_set_6be42768c690e380: function (arg0, arg1, arg2) {
940
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
941
+ },
942
+ __wbg_set_78ea6a19f4818587: function (arg0, arg1, arg2) {
943
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
944
+ },
945
+ __wbg_set_90474108ec025ba3: function (arg0, arg1, arg2) {
946
+ getObject(arg0).set(getArrayU32FromWasm0(arg1, arg2));
947
+ },
948
+ __wbg_value_9cc0518af87a489c: function (arg0) {
949
+ const ret = getObject(arg0).value;
950
+ return addHeapObject(ret);
951
+ },
952
+ __wbindgen_cast_0000000000000001: function (arg0) {
953
+ // Cast intrinsic for `F64 -> Externref`.
954
+ const ret = arg0;
955
+ return addHeapObject(ret);
956
+ },
957
+ __wbindgen_cast_0000000000000002: function (arg0) {
958
+ // Cast intrinsic for `I64 -> Externref`.
959
+ const ret = arg0;
960
+ return addHeapObject(ret);
961
+ },
962
+ __wbindgen_cast_0000000000000003: function (arg0, arg1) {
963
+ // Cast intrinsic for `Ref(String) -> Externref`.
964
+ const ret = getStringFromWasm0(arg0, arg1);
965
+ return addHeapObject(ret);
966
+ },
967
+ __wbindgen_cast_0000000000000004: function (arg0) {
968
+ // Cast intrinsic for `U64 -> Externref`.
969
+ const ret = BigInt.asUintN(64, arg0);
970
+ return addHeapObject(ret);
971
+ },
972
+ __wbindgen_object_clone_ref: function (arg0) {
973
+ const ret = getObject(arg0);
974
+ return addHeapObject(ret);
975
+ },
976
+ __wbindgen_object_drop_ref: function (arg0) {
977
+ takeObject(arg0);
978
+ },
979
+ };
980
+ return {
981
+ __proto__: null,
982
+ './engine_wasm_bg.js': import0,
983
+ };
984
+ }
985
+ const WasmDatasetFinalization = typeof FinalizationRegistry === 'undefined'
986
+ ? { register: () => { }, unregister: () => { } }
987
+ : new FinalizationRegistry((ptr) => wasm.__wbg_wasmdataset_free(ptr, 1));
988
+ const WasmFormEngineFinalization = typeof FinalizationRegistry === 'undefined'
989
+ ? { register: () => { }, unregister: () => { } }
990
+ : new FinalizationRegistry((ptr) => wasm.__wbg_wasmformengine_free(ptr, 1));
991
+ const WasmFuzzyIndexFinalization = typeof FinalizationRegistry === 'undefined'
992
+ ? { register: () => { }, unregister: () => { } }
993
+ : new FinalizationRegistry((ptr) => wasm.__wbg_wasmfuzzyindex_free(ptr, 1));
994
+ const WasmPdfIndexFinalization = typeof FinalizationRegistry === 'undefined'
995
+ ? { register: () => { }, unregister: () => { } }
996
+ : new FinalizationRegistry((ptr) => wasm.__wbg_wasmpdfindex_free(ptr, 1));
997
+ const WasmTreeFinalization = typeof FinalizationRegistry === 'undefined'
998
+ ? { register: () => { }, unregister: () => { } }
999
+ : new FinalizationRegistry((ptr) => wasm.__wbg_wasmtree_free(ptr, 1));
1000
+ function addHeapObject(obj) {
1001
+ if (heap_next === heap.length)
1002
+ heap.push(heap.length + 1);
1003
+ const idx = heap_next;
1004
+ heap_next = heap[idx];
1005
+ heap[idx] = obj;
1006
+ return idx;
1007
+ }
1008
+ function addBorrowedObject(obj) {
1009
+ if (stack_pointer == 1)
1010
+ throw new Error('out of js stack');
1011
+ heap[--stack_pointer] = obj;
1012
+ return stack_pointer;
1013
+ }
1014
+ function debugString(val) {
1015
+ // primitive types
1016
+ const type = typeof val;
1017
+ if (type == 'number' || type == 'boolean' || val == null) {
1018
+ return `${val}`;
1019
+ }
1020
+ if (type == 'string') {
1021
+ return `"${val}"`;
1022
+ }
1023
+ if (type == 'symbol') {
1024
+ const description = val.description;
1025
+ if (description == null) {
1026
+ return 'Symbol';
1027
+ }
1028
+ else {
1029
+ return `Symbol(${description})`;
1030
+ }
1031
+ }
1032
+ if (type == 'function') {
1033
+ const name = val.name;
1034
+ if (typeof name == 'string' && name.length > 0) {
1035
+ return `Function(${name})`;
1036
+ }
1037
+ else {
1038
+ return 'Function';
1039
+ }
1040
+ }
1041
+ // objects
1042
+ if (Array.isArray(val)) {
1043
+ const length = val.length;
1044
+ let debug = '[';
1045
+ if (length > 0) {
1046
+ debug += debugString(val[0]);
1047
+ }
1048
+ for (let i = 1; i < length; i++) {
1049
+ debug += ', ' + debugString(val[i]);
1050
+ }
1051
+ debug += ']';
1052
+ return debug;
1053
+ }
1054
+ // Test for built-in
1055
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
1056
+ let className;
1057
+ if (builtInMatches && builtInMatches.length > 1) {
1058
+ className = builtInMatches[1];
1059
+ }
1060
+ else {
1061
+ // Failed to match the standard '[object ClassName]'
1062
+ return toString.call(val);
1063
+ }
1064
+ if (className == 'Object') {
1065
+ // we're a user defined class or Object
1066
+ // JSON.stringify avoids problems with cycles, and is generally much
1067
+ // easier than looping through ownProperties of `val`.
1068
+ try {
1069
+ return 'Object(' + JSON.stringify(val) + ')';
1070
+ }
1071
+ catch (_) {
1072
+ return 'Object';
1073
+ }
1074
+ }
1075
+ // errors
1076
+ if (val instanceof Error) {
1077
+ return `${val.name}: ${val.message}\n${val.stack}`;
1078
+ }
1079
+ // TODO we could test for more things here, like `Set`s and `Map`s.
1080
+ return className;
1081
+ }
1082
+ function dropObject(idx) {
1083
+ if (idx < 1028)
1084
+ return;
1085
+ heap[idx] = heap_next;
1086
+ heap_next = idx;
1087
+ }
1088
+ function getArrayF64FromWasm0(ptr, len) {
1089
+ ptr = ptr >>> 0;
1090
+ return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
1091
+ }
1092
+ function getArrayU32FromWasm0(ptr, len) {
1093
+ ptr = ptr >>> 0;
1094
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
1095
+ }
1096
+ function getArrayU8FromWasm0(ptr, len) {
1097
+ ptr = ptr >>> 0;
1098
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1099
+ }
1100
+ let cachedDataViewMemory0 = null;
1101
+ function getDataViewMemory0() {
1102
+ if (cachedDataViewMemory0 === null ||
1103
+ cachedDataViewMemory0.buffer.detached === true ||
1104
+ (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1105
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1106
+ }
1107
+ return cachedDataViewMemory0;
1108
+ }
1109
+ let cachedFloat64ArrayMemory0 = null;
1110
+ function getFloat64ArrayMemory0() {
1111
+ if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
1112
+ cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
1113
+ }
1114
+ return cachedFloat64ArrayMemory0;
1115
+ }
1116
+ function getStringFromWasm0(ptr, len) {
1117
+ return decodeText(ptr >>> 0, len);
1118
+ }
1119
+ let cachedUint32ArrayMemory0 = null;
1120
+ function getUint32ArrayMemory0() {
1121
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
1122
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
1123
+ }
1124
+ return cachedUint32ArrayMemory0;
1125
+ }
1126
+ let cachedUint8ArrayMemory0 = null;
1127
+ function getUint8ArrayMemory0() {
1128
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1129
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1130
+ }
1131
+ return cachedUint8ArrayMemory0;
1132
+ }
1133
+ function getObject(idx) {
1134
+ return heap[idx];
1135
+ }
1136
+ function handleError(f, args) {
1137
+ try {
1138
+ return f.apply(this, args);
1139
+ }
1140
+ catch (e) {
1141
+ wasm.__wbindgen_export3(addHeapObject(e));
1142
+ }
1143
+ }
1144
+ let heap = new Array(1024).fill(undefined);
1145
+ heap.push(undefined, null, true, false);
1146
+ let heap_next = heap.length;
1147
+ function isLikeNone(x) {
1148
+ return x === undefined || x === null;
1149
+ }
1150
+ function passArray32ToWasm0(arg, malloc) {
1151
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
1152
+ getUint32ArrayMemory0().set(arg, ptr / 4);
1153
+ WASM_VECTOR_LEN = arg.length;
1154
+ return ptr;
1155
+ }
1156
+ function passArray8ToWasm0(arg, malloc) {
1157
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
1158
+ getUint8ArrayMemory0().set(arg, ptr / 1);
1159
+ WASM_VECTOR_LEN = arg.length;
1160
+ return ptr;
1161
+ }
1162
+ function passArrayJsValueToWasm0(array, malloc) {
1163
+ const ptr = malloc(array.length * 4, 4) >>> 0;
1164
+ const mem = getDataViewMemory0();
1165
+ for (let i = 0; i < array.length; i++) {
1166
+ mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
1167
+ }
1168
+ WASM_VECTOR_LEN = array.length;
1169
+ return ptr;
1170
+ }
1171
+ function passStringToWasm0(arg, malloc, realloc) {
1172
+ if (realloc === undefined) {
1173
+ const buf = cachedTextEncoder.encode(arg);
1174
+ const ptr = malloc(buf.length, 1) >>> 0;
1175
+ getUint8ArrayMemory0()
1176
+ .subarray(ptr, ptr + buf.length)
1177
+ .set(buf);
1178
+ WASM_VECTOR_LEN = buf.length;
1179
+ return ptr;
1180
+ }
1181
+ let len = arg.length;
1182
+ let ptr = malloc(len, 1) >>> 0;
1183
+ const mem = getUint8ArrayMemory0();
1184
+ let offset = 0;
1185
+ for (; offset < len; offset++) {
1186
+ const code = arg.charCodeAt(offset);
1187
+ if (code > 0x7f)
1188
+ break;
1189
+ mem[ptr + offset] = code;
1190
+ }
1191
+ if (offset !== len) {
1192
+ if (offset !== 0) {
1193
+ arg = arg.slice(offset);
1194
+ }
1195
+ ptr = realloc(ptr, len, (len = offset + arg.length * 3), 1) >>> 0;
1196
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1197
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1198
+ offset += ret.written;
1199
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1200
+ }
1201
+ WASM_VECTOR_LEN = offset;
1202
+ return ptr;
1203
+ }
1204
+ let stack_pointer = 1024;
1205
+ function takeObject(idx) {
1206
+ const ret = getObject(idx);
1207
+ dropObject(idx);
1208
+ return ret;
1209
+ }
1210
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1211
+ cachedTextDecoder.decode();
1212
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1213
+ let numBytesDecoded = 0;
1214
+ function decodeText(ptr, len) {
1215
+ numBytesDecoded += len;
1216
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1217
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1218
+ cachedTextDecoder.decode();
1219
+ numBytesDecoded = len;
1220
+ }
1221
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1222
+ }
1223
+ const cachedTextEncoder = new TextEncoder();
1224
+ if (!('encodeInto' in cachedTextEncoder)) {
1225
+ cachedTextEncoder.encodeInto = function (arg, view) {
1226
+ const buf = cachedTextEncoder.encode(arg);
1227
+ view.set(buf);
1228
+ return {
1229
+ read: arg.length,
1230
+ written: buf.length,
1231
+ };
1232
+ };
1233
+ }
1234
+ let WASM_VECTOR_LEN = 0;
1235
+ let wasmModule, wasmInstance, wasm;
1236
+ function __wbg_finalize_init(instance, module) {
1237
+ wasmInstance = instance;
1238
+ wasm = instance.exports;
1239
+ wasmModule = module;
1240
+ cachedDataViewMemory0 = null;
1241
+ cachedFloat64ArrayMemory0 = null;
1242
+ cachedUint32ArrayMemory0 = null;
1243
+ cachedUint8ArrayMemory0 = null;
1244
+ wasm.__wbindgen_start();
1245
+ return wasm;
1246
+ }
1247
+ async function __wbg_load(module, imports) {
1248
+ if (typeof Response === 'function' && module instanceof Response) {
1249
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
1250
+ try {
1251
+ return await WebAssembly.instantiateStreaming(module, imports);
1252
+ }
1253
+ catch (e) {
1254
+ const validResponse = module.ok && expectedResponseType(module.type);
1255
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1256
+ console.warn('`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n', e);
1257
+ }
1258
+ else {
1259
+ throw e;
1260
+ }
1261
+ }
1262
+ }
1263
+ const bytes = await module.arrayBuffer();
1264
+ return await WebAssembly.instantiate(bytes, imports);
1265
+ }
1266
+ else {
1267
+ const instance = await WebAssembly.instantiate(module, imports);
1268
+ if (instance instanceof WebAssembly.Instance) {
1269
+ return { instance, module };
1270
+ }
1271
+ else {
1272
+ return instance;
1273
+ }
1274
+ }
1275
+ function expectedResponseType(type) {
1276
+ switch (type) {
1277
+ case 'basic':
1278
+ case 'cors':
1279
+ case 'default':
1280
+ return true;
1281
+ }
1282
+ return false;
1283
+ }
1284
+ }
1285
+ function initSync(module) {
1286
+ if (wasm !== undefined)
1287
+ return wasm;
1288
+ if (module !== undefined) {
1289
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1290
+ ({ module } = module);
1291
+ }
1292
+ else {
1293
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead');
1294
+ }
1295
+ }
1296
+ const imports = __wbg_get_imports();
1297
+ if (!(module instanceof WebAssembly.Module)) {
1298
+ module = new WebAssembly.Module(module);
1299
+ }
1300
+ const instance = new WebAssembly.Instance(module, imports);
1301
+ return __wbg_finalize_init(instance, module);
1302
+ }
1303
+ async function __wbg_init(module_or_path) {
1304
+ if (wasm !== undefined)
1305
+ return wasm;
1306
+ if (module_or_path !== undefined) {
1307
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1308
+ ({ module_or_path } = module_or_path);
1309
+ }
1310
+ else {
1311
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead');
1312
+ }
1313
+ }
1314
+ if (module_or_path === undefined) {
1315
+ module_or_path = new URL('engine_wasm_bg.wasm', import.meta.url);
1316
+ }
1317
+ const imports = __wbg_get_imports();
1318
+ if (typeof module_or_path === 'string' ||
1319
+ (typeof Request === 'function' && module_or_path instanceof Request) ||
1320
+ (typeof URL === 'function' && module_or_path instanceof URL)) {
1321
+ module_or_path = fetch(module_or_path);
1322
+ }
1323
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
1324
+ return __wbg_finalize_init(instance, module);
1325
+ }
1326
+
1327
+ export { WasmDataset, WasmFormEngine, WasmFuzzyIndex, WasmPdfIndex, WasmTree, __wbg_init as default, engine_version, init, initSync };
1328
+ //# sourceMappingURL=hakistack-ng-daisyui-engine_wasm_glue-ClEcb6yJ.mjs.map