hermes-wasm 0.1.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.
package/hermes_wasm.js ADDED
@@ -0,0 +1,1317 @@
1
+ let wasm;
2
+
3
+ function addToExternrefTable0(obj) {
4
+ const idx = wasm.__externref_table_alloc();
5
+ wasm.__wbindgen_externrefs.set(idx, obj);
6
+ return idx;
7
+ }
8
+
9
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
10
+ ? { register: () => {}, unregister: () => {} }
11
+ : new FinalizationRegistry(state => state.dtor(state.a, state.b));
12
+
13
+ function debugString(val) {
14
+ // primitive types
15
+ const type = typeof val;
16
+ if (type == 'number' || type == 'boolean' || val == null) {
17
+ return `${val}`;
18
+ }
19
+ if (type == 'string') {
20
+ return `"${val}"`;
21
+ }
22
+ if (type == 'symbol') {
23
+ const description = val.description;
24
+ if (description == null) {
25
+ return 'Symbol';
26
+ } else {
27
+ return `Symbol(${description})`;
28
+ }
29
+ }
30
+ if (type == 'function') {
31
+ const name = val.name;
32
+ if (typeof name == 'string' && name.length > 0) {
33
+ return `Function(${name})`;
34
+ } else {
35
+ return 'Function';
36
+ }
37
+ }
38
+ // objects
39
+ if (Array.isArray(val)) {
40
+ const length = val.length;
41
+ let debug = '[';
42
+ if (length > 0) {
43
+ debug += debugString(val[0]);
44
+ }
45
+ for(let i = 1; i < length; i++) {
46
+ debug += ', ' + debugString(val[i]);
47
+ }
48
+ debug += ']';
49
+ return debug;
50
+ }
51
+ // Test for built-in
52
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
53
+ let className;
54
+ if (builtInMatches && builtInMatches.length > 1) {
55
+ className = builtInMatches[1];
56
+ } else {
57
+ // Failed to match the standard '[object ClassName]'
58
+ return toString.call(val);
59
+ }
60
+ if (className == 'Object') {
61
+ // we're a user defined class or Object
62
+ // JSON.stringify avoids problems with cycles, and is generally much
63
+ // easier than looping through ownProperties of `val`.
64
+ try {
65
+ return 'Object(' + JSON.stringify(val) + ')';
66
+ } catch (_) {
67
+ return 'Object';
68
+ }
69
+ }
70
+ // errors
71
+ if (val instanceof Error) {
72
+ return `${val.name}: ${val.message}\n${val.stack}`;
73
+ }
74
+ // TODO we could test for more things here, like `Set`s and `Map`s.
75
+ return className;
76
+ }
77
+
78
+ function getArrayU8FromWasm0(ptr, len) {
79
+ ptr = ptr >>> 0;
80
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
81
+ }
82
+
83
+ let cachedDataViewMemory0 = null;
84
+ function getDataViewMemory0() {
85
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
86
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
87
+ }
88
+ return cachedDataViewMemory0;
89
+ }
90
+
91
+ function getStringFromWasm0(ptr, len) {
92
+ ptr = ptr >>> 0;
93
+ return decodeText(ptr, len);
94
+ }
95
+
96
+ let cachedUint8ArrayMemory0 = null;
97
+ function getUint8ArrayMemory0() {
98
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
99
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
100
+ }
101
+ return cachedUint8ArrayMemory0;
102
+ }
103
+
104
+ function handleError(f, args) {
105
+ try {
106
+ return f.apply(this, args);
107
+ } catch (e) {
108
+ const idx = addToExternrefTable0(e);
109
+ wasm.__wbindgen_exn_store(idx);
110
+ }
111
+ }
112
+
113
+ function isLikeNone(x) {
114
+ return x === undefined || x === null;
115
+ }
116
+
117
+ function makeMutClosure(arg0, arg1, dtor, f) {
118
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
119
+ const real = (...args) => {
120
+
121
+ // First up with a closure we increment the internal reference
122
+ // count. This ensures that the Rust closure environment won't
123
+ // be deallocated while we're invoking it.
124
+ state.cnt++;
125
+ const a = state.a;
126
+ state.a = 0;
127
+ try {
128
+ return f(a, state.b, ...args);
129
+ } finally {
130
+ state.a = a;
131
+ real._wbg_cb_unref();
132
+ }
133
+ };
134
+ real._wbg_cb_unref = () => {
135
+ if (--state.cnt === 0) {
136
+ state.dtor(state.a, state.b);
137
+ state.a = 0;
138
+ CLOSURE_DTORS.unregister(state);
139
+ }
140
+ };
141
+ CLOSURE_DTORS.register(real, state, state);
142
+ return real;
143
+ }
144
+
145
+ function passArray8ToWasm0(arg, malloc) {
146
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
147
+ getUint8ArrayMemory0().set(arg, ptr / 1);
148
+ WASM_VECTOR_LEN = arg.length;
149
+ return ptr;
150
+ }
151
+
152
+ function passStringToWasm0(arg, malloc, realloc) {
153
+ if (realloc === undefined) {
154
+ const buf = cachedTextEncoder.encode(arg);
155
+ const ptr = malloc(buf.length, 1) >>> 0;
156
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
157
+ WASM_VECTOR_LEN = buf.length;
158
+ return ptr;
159
+ }
160
+
161
+ let len = arg.length;
162
+ let ptr = malloc(len, 1) >>> 0;
163
+
164
+ const mem = getUint8ArrayMemory0();
165
+
166
+ let offset = 0;
167
+
168
+ for (; offset < len; offset++) {
169
+ const code = arg.charCodeAt(offset);
170
+ if (code > 0x7F) break;
171
+ mem[ptr + offset] = code;
172
+ }
173
+ if (offset !== len) {
174
+ if (offset !== 0) {
175
+ arg = arg.slice(offset);
176
+ }
177
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
178
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
179
+ const ret = cachedTextEncoder.encodeInto(arg, view);
180
+
181
+ offset += ret.written;
182
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
183
+ }
184
+
185
+ WASM_VECTOR_LEN = offset;
186
+ return ptr;
187
+ }
188
+
189
+ function takeFromExternrefTable0(idx) {
190
+ const value = wasm.__wbindgen_externrefs.get(idx);
191
+ wasm.__externref_table_dealloc(idx);
192
+ return value;
193
+ }
194
+
195
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
196
+ cachedTextDecoder.decode();
197
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
198
+ let numBytesDecoded = 0;
199
+ function decodeText(ptr, len) {
200
+ numBytesDecoded += len;
201
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
202
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
203
+ cachedTextDecoder.decode();
204
+ numBytesDecoded = len;
205
+ }
206
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
207
+ }
208
+
209
+ const cachedTextEncoder = new TextEncoder();
210
+
211
+ if (!('encodeInto' in cachedTextEncoder)) {
212
+ cachedTextEncoder.encodeInto = function (arg, view) {
213
+ const buf = cachedTextEncoder.encode(arg);
214
+ view.set(buf);
215
+ return {
216
+ read: arg.length,
217
+ written: buf.length
218
+ };
219
+ }
220
+ }
221
+
222
+ let WASM_VECTOR_LEN = 0;
223
+
224
+ function wasm_bindgen__convert__closures_____invoke__hf0ae6e1302402218(arg0, arg1, arg2) {
225
+ wasm.wasm_bindgen__convert__closures_____invoke__hf0ae6e1302402218(arg0, arg1, arg2);
226
+ }
227
+
228
+ function wasm_bindgen__convert__closures_____invoke__he0fab6886ed0c11a(arg0, arg1, arg2) {
229
+ wasm.wasm_bindgen__convert__closures_____invoke__he0fab6886ed0c11a(arg0, arg1, arg2);
230
+ }
231
+
232
+ function wasm_bindgen__convert__closures_____invoke__hb63c839732b74d13(arg0, arg1) {
233
+ wasm.wasm_bindgen__convert__closures_____invoke__hb63c839732b74d13(arg0, arg1);
234
+ }
235
+
236
+ function wasm_bindgen__convert__closures_____invoke__h24eb9da7cece06fa(arg0, arg1, arg2, arg3) {
237
+ wasm.wasm_bindgen__convert__closures_____invoke__h24eb9da7cece06fa(arg0, arg1, arg2, arg3);
238
+ }
239
+
240
+ const __wbindgen_enum_IdbTransactionMode = ["readonly", "readwrite", "versionchange", "readwriteflush", "cleanup"];
241
+
242
+ const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
243
+
244
+ const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
245
+
246
+ const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
247
+
248
+ const IndexRegistryFinalization = (typeof FinalizationRegistry === 'undefined')
249
+ ? { register: () => {}, unregister: () => {} }
250
+ : new FinalizationRegistry(ptr => wasm.__wbg_indexregistry_free(ptr >>> 0, 1));
251
+
252
+ const IpfsIndexFinalization = (typeof FinalizationRegistry === 'undefined')
253
+ ? { register: () => {}, unregister: () => {} }
254
+ : new FinalizationRegistry(ptr => wasm.__wbg_ipfsindex_free(ptr >>> 0, 1));
255
+
256
+ const RemoteIndexFinalization = (typeof FinalizationRegistry === 'undefined')
257
+ ? { register: () => {}, unregister: () => {} }
258
+ : new FinalizationRegistry(ptr => wasm.__wbg_remoteindex_free(ptr >>> 0, 1));
259
+
260
+ /**
261
+ * Index registry for managing multiple indexes
262
+ */
263
+ export class IndexRegistry {
264
+ __destroy_into_raw() {
265
+ const ptr = this.__wbg_ptr;
266
+ this.__wbg_ptr = 0;
267
+ IndexRegistryFinalization.unregister(this);
268
+ return ptr;
269
+ }
270
+ free() {
271
+ const ptr = this.__destroy_into_raw();
272
+ wasm.__wbg_indexregistry_free(ptr, 0);
273
+ }
274
+ /**
275
+ * Add a remote index
276
+ * @param {string} name
277
+ * @param {string} base_url
278
+ * @returns {Promise<void>}
279
+ */
280
+ add_remote(name, base_url) {
281
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
282
+ const len0 = WASM_VECTOR_LEN;
283
+ const ptr1 = passStringToWasm0(base_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
284
+ const len1 = WASM_VECTOR_LEN;
285
+ const ret = wasm.indexregistry_add_remote(this.__wbg_ptr, ptr0, len0, ptr1, len1);
286
+ return ret;
287
+ }
288
+ constructor() {
289
+ const ret = wasm.indexregistry_new();
290
+ this.__wbg_ptr = ret >>> 0;
291
+ IndexRegistryFinalization.register(this, this.__wbg_ptr, this);
292
+ return this;
293
+ }
294
+ /**
295
+ * List index names
296
+ * @returns {any}
297
+ */
298
+ list() {
299
+ const ret = wasm.indexregistry_list(this.__wbg_ptr);
300
+ return ret;
301
+ }
302
+ /**
303
+ * Remove an index
304
+ * @param {string} name
305
+ */
306
+ remove(name) {
307
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
308
+ const len0 = WASM_VECTOR_LEN;
309
+ wasm.indexregistry_remove(this.__wbg_ptr, ptr0, len0);
310
+ }
311
+ /**
312
+ * Search an index by name
313
+ * @param {string} index_name
314
+ * @param {string} text
315
+ * @param {number} limit
316
+ * @returns {Promise<any>}
317
+ */
318
+ search(index_name, text, limit) {
319
+ const ptr0 = passStringToWasm0(index_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
320
+ const len0 = WASM_VECTOR_LEN;
321
+ const ptr1 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
322
+ const len1 = WASM_VECTOR_LEN;
323
+ const ret = wasm.indexregistry_search(this.__wbg_ptr, ptr0, len0, ptr1, len1, limit);
324
+ return ret;
325
+ }
326
+ }
327
+ if (Symbol.dispose) IndexRegistry.prototype[Symbol.dispose] = IndexRegistry.prototype.free;
328
+
329
+ /**
330
+ * IPFS Index that uses JavaScript verified-fetch for content retrieval
331
+ *
332
+ * This allows loading indexes from IPFS without using gateways by
333
+ * leveraging @helia/verified-fetch in JavaScript.
334
+ */
335
+ export class IpfsIndex {
336
+ static __wrap(ptr) {
337
+ ptr = ptr >>> 0;
338
+ const obj = Object.create(IpfsIndex.prototype);
339
+ obj.__wbg_ptr = ptr;
340
+ IpfsIndexFinalization.register(obj, obj.__wbg_ptr, obj);
341
+ return obj;
342
+ }
343
+ __destroy_into_raw() {
344
+ const ptr = this.__wbg_ptr;
345
+ this.__wbg_ptr = 0;
346
+ IpfsIndexFinalization.unregister(this);
347
+ return ptr;
348
+ }
349
+ free() {
350
+ const ptr = this.__destroy_into_raw();
351
+ wasm.__wbg_ipfsindex_free(ptr, 0);
352
+ }
353
+ /**
354
+ * Get cache statistics
355
+ * @returns {any}
356
+ */
357
+ cache_stats() {
358
+ const ret = wasm.ipfsindex_cache_stats(this.__wbg_ptr);
359
+ return ret;
360
+ }
361
+ /**
362
+ * Get field names
363
+ * @returns {any}
364
+ */
365
+ field_names() {
366
+ const ret = wasm.ipfsindex_field_names(this.__wbg_ptr);
367
+ return ret;
368
+ }
369
+ /**
370
+ * Export cache
371
+ * @returns {Uint8Array | undefined}
372
+ */
373
+ export_cache() {
374
+ const ret = wasm.ipfsindex_export_cache(this.__wbg_ptr);
375
+ let v1;
376
+ if (ret[0] !== 0) {
377
+ v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
378
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
379
+ }
380
+ return v1;
381
+ }
382
+ /**
383
+ * Get a document by address
384
+ * @param {string} segment_id
385
+ * @param {number} doc_id
386
+ * @returns {Promise<any>}
387
+ */
388
+ get_document(segment_id, doc_id) {
389
+ const ptr0 = passStringToWasm0(segment_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
390
+ const len0 = WASM_VECTOR_LEN;
391
+ const ret = wasm.ipfsindex_get_document(this.__wbg_ptr, ptr0, len0, doc_id);
392
+ return ret;
393
+ }
394
+ /**
395
+ * Import cache
396
+ * @param {Uint8Array} data
397
+ */
398
+ import_cache(data) {
399
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
400
+ const len0 = WASM_VECTOR_LEN;
401
+ const ret = wasm.ipfsindex_import_cache(this.__wbg_ptr, ptr0, len0);
402
+ if (ret[1]) {
403
+ throw takeFromExternrefTable0(ret[0]);
404
+ }
405
+ }
406
+ /**
407
+ * Get number of segments
408
+ * @returns {number}
409
+ */
410
+ num_segments() {
411
+ const ret = wasm.ipfsindex_num_segments(this.__wbg_ptr);
412
+ return ret >>> 0;
413
+ }
414
+ /**
415
+ * Get default fields
416
+ * @returns {any}
417
+ */
418
+ default_fields() {
419
+ const ret = wasm.ipfsindex_default_fields(this.__wbg_ptr);
420
+ return ret;
421
+ }
422
+ /**
423
+ * Clear IndexedDB cache
424
+ * @returns {Promise<void>}
425
+ */
426
+ clear_idb_cache() {
427
+ const ret = wasm.ipfsindex_clear_idb_cache(this.__wbg_ptr);
428
+ return ret;
429
+ }
430
+ /**
431
+ * Create with custom cache size
432
+ * @param {string} base_path
433
+ * @param {number} cache_size
434
+ * @returns {IpfsIndex}
435
+ */
436
+ static with_cache_size(base_path, cache_size) {
437
+ const ptr0 = passStringToWasm0(base_path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
438
+ const len0 = WASM_VECTOR_LEN;
439
+ const ret = wasm.ipfsindex_with_cache_size(ptr0, len0, cache_size);
440
+ return IpfsIndex.__wrap(ret);
441
+ }
442
+ /**
443
+ * Save cache to IndexedDB
444
+ * @returns {Promise<void>}
445
+ */
446
+ save_cache_to_idb() {
447
+ const ret = wasm.ipfsindex_save_cache_to_idb(this.__wbg_ptr);
448
+ return ret;
449
+ }
450
+ /**
451
+ * Load cache from IndexedDB
452
+ * @returns {Promise<boolean>}
453
+ */
454
+ load_cache_from_idb() {
455
+ const ret = wasm.ipfsindex_load_cache_from_idb(this.__wbg_ptr);
456
+ return ret;
457
+ }
458
+ /**
459
+ * Create a new IPFS index
460
+ *
461
+ * @param base_path - The IPFS path (e.g., "/ipfs/Qm..." or "/ipns/...")
462
+ * @param {string} base_path
463
+ */
464
+ constructor(base_path) {
465
+ const ptr0 = passStringToWasm0(base_path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
466
+ const len0 = WASM_VECTOR_LEN;
467
+ const ret = wasm.ipfsindex_new(ptr0, len0);
468
+ this.__wbg_ptr = ret >>> 0;
469
+ IpfsIndexFinalization.register(this, this.__wbg_ptr, this);
470
+ return this;
471
+ }
472
+ /**
473
+ * Load index using JavaScript fetch functions
474
+ *
475
+ * @param fetch_fn - JS function: (path: string) => Promise<Uint8Array>
476
+ * @param size_fn - JS function: (path: string) => Promise<number>
477
+ * @param {Function} fetch_fn
478
+ * @param {Function} size_fn
479
+ * @returns {Promise<void>}
480
+ */
481
+ load(fetch_fn, size_fn) {
482
+ const ret = wasm.ipfsindex_load(this.__wbg_ptr, fetch_fn, size_fn);
483
+ return ret;
484
+ }
485
+ /**
486
+ * Search the index
487
+ * @param {string} query_str
488
+ * @param {number} limit
489
+ * @returns {Promise<any>}
490
+ */
491
+ search(query_str, limit) {
492
+ const ptr0 = passStringToWasm0(query_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
493
+ const len0 = WASM_VECTOR_LEN;
494
+ const ret = wasm.ipfsindex_search(this.__wbg_ptr, ptr0, len0, limit);
495
+ return ret;
496
+ }
497
+ /**
498
+ * Get number of documents
499
+ * @returns {number}
500
+ */
501
+ num_docs() {
502
+ const ret = wasm.ipfsindex_num_docs(this.__wbg_ptr);
503
+ return ret >>> 0;
504
+ }
505
+ }
506
+ if (Symbol.dispose) IpfsIndex.prototype[Symbol.dispose] = IpfsIndex.prototype.free;
507
+
508
+ /**
509
+ * Remote index that loads data via HTTP with slice caching
510
+ */
511
+ export class RemoteIndex {
512
+ static __wrap(ptr) {
513
+ ptr = ptr >>> 0;
514
+ const obj = Object.create(RemoteIndex.prototype);
515
+ obj.__wbg_ptr = ptr;
516
+ RemoteIndexFinalization.register(obj, obj.__wbg_ptr, obj);
517
+ return obj;
518
+ }
519
+ __destroy_into_raw() {
520
+ const ptr = this.__wbg_ptr;
521
+ this.__wbg_ptr = 0;
522
+ RemoteIndexFinalization.unregister(this);
523
+ return ptr;
524
+ }
525
+ free() {
526
+ const ptr = this.__destroy_into_raw();
527
+ wasm.__wbg_remoteindex_free(ptr, 0);
528
+ }
529
+ /**
530
+ * Get cache statistics
531
+ * @returns {any}
532
+ */
533
+ cache_stats() {
534
+ const ret = wasm.remoteindex_cache_stats(this.__wbg_ptr);
535
+ return ret;
536
+ }
537
+ /**
538
+ * Get field names
539
+ * @returns {any}
540
+ */
541
+ field_names() {
542
+ const ret = wasm.remoteindex_field_names(this.__wbg_ptr);
543
+ return ret;
544
+ }
545
+ /**
546
+ * Export the current slice cache as bytes
547
+ *
548
+ * Returns the serialized cache data that can be stored in IndexedDB
549
+ * or other persistent storage for later restoration.
550
+ * @returns {Uint8Array | undefined}
551
+ */
552
+ export_cache() {
553
+ const ret = wasm.remoteindex_export_cache(this.__wbg_ptr);
554
+ let v1;
555
+ if (ret[0] !== 0) {
556
+ v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
557
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
558
+ }
559
+ return v1;
560
+ }
561
+ /**
562
+ * Get a document by its address (segment_id + doc_id)
563
+ *
564
+ * Returns the document as a JSON object, or null if not found.
565
+ * @param {string} segment_id
566
+ * @param {number} doc_id
567
+ * @returns {Promise<any>}
568
+ */
569
+ get_document(segment_id, doc_id) {
570
+ const ptr0 = passStringToWasm0(segment_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
571
+ const len0 = WASM_VECTOR_LEN;
572
+ const ret = wasm.remoteindex_get_document(this.__wbg_ptr, ptr0, len0, doc_id);
573
+ return ret;
574
+ }
575
+ /**
576
+ * Import a previously exported slice cache
577
+ *
578
+ * Merges the cached slices into the current cache, reducing
579
+ * network requests for previously fetched data.
580
+ * @param {Uint8Array} data
581
+ */
582
+ import_cache(data) {
583
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
584
+ const len0 = WASM_VECTOR_LEN;
585
+ const ret = wasm.remoteindex_import_cache(this.__wbg_ptr, ptr0, len0);
586
+ if (ret[1]) {
587
+ throw takeFromExternrefTable0(ret[0]);
588
+ }
589
+ }
590
+ /**
591
+ * Get number of segments
592
+ * @returns {number}
593
+ */
594
+ num_segments() {
595
+ const ret = wasm.remoteindex_num_segments(this.__wbg_ptr);
596
+ return ret >>> 0;
597
+ }
598
+ /**
599
+ * Get network statistics (requests made, bytes transferred, etc.)
600
+ * @returns {any}
601
+ */
602
+ network_stats() {
603
+ const ret = wasm.remoteindex_network_stats(this.__wbg_ptr);
604
+ return ret;
605
+ }
606
+ /**
607
+ * Get default field names for query parsing
608
+ * @returns {any}
609
+ */
610
+ default_fields() {
611
+ const ret = wasm.remoteindex_default_fields(this.__wbg_ptr);
612
+ return ret;
613
+ }
614
+ /**
615
+ * Clear the persisted cache from IndexedDB
616
+ * @returns {Promise<void>}
617
+ */
618
+ clear_idb_cache() {
619
+ const ret = wasm.remoteindex_clear_idb_cache(this.__wbg_ptr);
620
+ return ret;
621
+ }
622
+ /**
623
+ * Create with custom cache size (in bytes)
624
+ * @param {string} base_url
625
+ * @param {number} cache_size
626
+ * @returns {RemoteIndex}
627
+ */
628
+ static with_cache_size(base_url, cache_size) {
629
+ const ptr0 = passStringToWasm0(base_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
630
+ const len0 = WASM_VECTOR_LEN;
631
+ const ret = wasm.remoteindex_with_cache_size(ptr0, len0, cache_size);
632
+ return RemoteIndex.__wrap(ret);
633
+ }
634
+ /**
635
+ * Save the slice cache to IndexedDB for persistence across sessions
636
+ *
637
+ * The cache is stored under a key derived from the base URL.
638
+ * @returns {Promise<void>}
639
+ */
640
+ save_cache_to_idb() {
641
+ const ret = wasm.remoteindex_save_cache_to_idb(this.__wbg_ptr);
642
+ return ret;
643
+ }
644
+ /**
645
+ * Load the slice cache from IndexedDB
646
+ *
647
+ * Call this after load() to restore cached data from a previous session.
648
+ * @returns {Promise<boolean>}
649
+ */
650
+ load_cache_from_idb() {
651
+ const ret = wasm.remoteindex_load_cache_from_idb(this.__wbg_ptr);
652
+ return ret;
653
+ }
654
+ /**
655
+ * Reset network statistics
656
+ */
657
+ reset_network_stats() {
658
+ wasm.remoteindex_reset_network_stats(this.__wbg_ptr);
659
+ }
660
+ /**
661
+ * Create a new remote index pointing to a URL
662
+ * @param {string} base_url
663
+ */
664
+ constructor(base_url) {
665
+ const ptr0 = passStringToWasm0(base_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
666
+ const len0 = WASM_VECTOR_LEN;
667
+ const ret = wasm.remoteindex_new(ptr0, len0);
668
+ this.__wbg_ptr = ret >>> 0;
669
+ RemoteIndexFinalization.register(this, this.__wbg_ptr, this);
670
+ return this;
671
+ }
672
+ /**
673
+ * Load index from URL using hermes-core Index with slice caching
674
+ *
675
+ * Automatically attempts to load the slice cache file (index.slicecache)
676
+ * to prefill the cache with hot data, reducing cold-start latency.
677
+ * @returns {Promise<void>}
678
+ */
679
+ load() {
680
+ const ret = wasm.remoteindex_load(this.__wbg_ptr);
681
+ return ret;
682
+ }
683
+ /**
684
+ * Search the index
685
+ *
686
+ * Accepts both query language syntax (field:term, AND, OR, NOT, grouping)
687
+ * and simple text (tokenized and searched across default fields).
688
+ * Returns document addresses (segment_id + doc_id) without document content.
689
+ * @param {string} query_str
690
+ * @param {number} limit
691
+ * @returns {Promise<any>}
692
+ */
693
+ search(query_str, limit) {
694
+ const ptr0 = passStringToWasm0(query_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
695
+ const len0 = WASM_VECTOR_LEN;
696
+ const ret = wasm.remoteindex_search(this.__wbg_ptr, ptr0, len0, limit);
697
+ return ret;
698
+ }
699
+ /**
700
+ * Get number of documents
701
+ * @returns {number}
702
+ */
703
+ num_docs() {
704
+ const ret = wasm.remoteindex_num_docs(this.__wbg_ptr);
705
+ return ret >>> 0;
706
+ }
707
+ }
708
+ if (Symbol.dispose) RemoteIndex.prototype[Symbol.dispose] = RemoteIndex.prototype.free;
709
+
710
+ /**
711
+ * Initialize panic hook and logging
712
+ */
713
+ export function init() {
714
+ wasm.init();
715
+ }
716
+
717
+ /**
718
+ * Setup logging to browser console (can be called explicitly)
719
+ */
720
+ export function setup_logging() {
721
+ wasm.init();
722
+ }
723
+
724
+ const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
725
+
726
+ async function __wbg_load(module, imports) {
727
+ if (typeof Response === 'function' && module instanceof Response) {
728
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
729
+ try {
730
+ return await WebAssembly.instantiateStreaming(module, imports);
731
+ } catch (e) {
732
+ const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
733
+
734
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
735
+ 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);
736
+
737
+ } else {
738
+ throw e;
739
+ }
740
+ }
741
+ }
742
+
743
+ const bytes = await module.arrayBuffer();
744
+ return await WebAssembly.instantiate(bytes, imports);
745
+ } else {
746
+ const instance = await WebAssembly.instantiate(module, imports);
747
+
748
+ if (instance instanceof WebAssembly.Instance) {
749
+ return { instance, module };
750
+ } else {
751
+ return instance;
752
+ }
753
+ }
754
+ }
755
+
756
+ function __wbg_get_imports() {
757
+ const imports = {};
758
+ imports.wbg = {};
759
+ imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
760
+ const ret = Error(getStringFromWasm0(arg0, arg1));
761
+ return ret;
762
+ };
763
+ imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
764
+ const ret = String(arg1);
765
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
766
+ const len1 = WASM_VECTOR_LEN;
767
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
768
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
769
+ };
770
+ imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
771
+ const ret = debugString(arg1);
772
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
773
+ const len1 = WASM_VECTOR_LEN;
774
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
775
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
776
+ };
777
+ imports.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
778
+ const ret = typeof(arg0) === 'function';
779
+ return ret;
780
+ };
781
+ imports.wbg.__wbg___wbindgen_is_null_dfda7d66506c95b5 = function(arg0) {
782
+ const ret = arg0 === null;
783
+ return ret;
784
+ };
785
+ imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
786
+ const val = arg0;
787
+ const ret = typeof(val) === 'object' && val !== null;
788
+ return ret;
789
+ };
790
+ imports.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030 = function(arg0) {
791
+ const ret = typeof(arg0) === 'string';
792
+ return ret;
793
+ };
794
+ imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
795
+ const ret = arg0 === undefined;
796
+ return ret;
797
+ };
798
+ imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
799
+ const obj = arg1;
800
+ const ret = typeof(obj) === 'number' ? obj : undefined;
801
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
802
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
803
+ };
804
+ imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
805
+ const obj = arg1;
806
+ const ret = typeof(obj) === 'string' ? obj : undefined;
807
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
808
+ var len1 = WASM_VECTOR_LEN;
809
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
810
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
811
+ };
812
+ imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
813
+ throw new Error(getStringFromWasm0(arg0, arg1));
814
+ };
815
+ imports.wbg.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7 = function(arg0) {
816
+ arg0._wbg_cb_unref();
817
+ };
818
+ imports.wbg.__wbg_abort_07646c894ebbf2bd = function(arg0) {
819
+ arg0.abort();
820
+ };
821
+ imports.wbg.__wbg_abort_399ecbcfd6ef3c8e = function(arg0, arg1) {
822
+ arg0.abort(arg1);
823
+ };
824
+ imports.wbg.__wbg_append_c5cbdf46455cc776 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
825
+ arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
826
+ }, arguments) };
827
+ imports.wbg.__wbg_arrayBuffer_c04af4fce566092d = function() { return handleError(function (arg0) {
828
+ const ret = arg0.arrayBuffer();
829
+ return ret;
830
+ }, arguments) };
831
+ imports.wbg.__wbg_call_3020136f7a2d6e44 = function() { return handleError(function (arg0, arg1, arg2) {
832
+ const ret = arg0.call(arg1, arg2);
833
+ return ret;
834
+ }, arguments) };
835
+ imports.wbg.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) {
836
+ const ret = arg0.call(arg1);
837
+ return ret;
838
+ }, arguments) };
839
+ imports.wbg.__wbg_clearTimeout_42d9ccd50822fd3a = function(arg0) {
840
+ const ret = clearTimeout(arg0);
841
+ return ret;
842
+ };
843
+ imports.wbg.__wbg_contains_de2a27de1ed31877 = function(arg0, arg1, arg2) {
844
+ const ret = arg0.contains(getStringFromWasm0(arg1, arg2));
845
+ return ret;
846
+ };
847
+ imports.wbg.__wbg_createObjectStore_dba64acfe84d4191 = function() { return handleError(function (arg0, arg1, arg2) {
848
+ const ret = arg0.createObjectStore(getStringFromWasm0(arg1, arg2));
849
+ return ret;
850
+ }, arguments) };
851
+ imports.wbg.__wbg_debug_9d0c87ddda3dc485 = function(arg0) {
852
+ console.debug(arg0);
853
+ };
854
+ imports.wbg.__wbg_delete_a8cf58aab29e18d2 = function() { return handleError(function (arg0, arg1) {
855
+ const ret = arg0.delete(arg1);
856
+ return ret;
857
+ }, arguments) };
858
+ imports.wbg.__wbg_done_62ea16af4ce34b24 = function(arg0) {
859
+ const ret = arg0.done;
860
+ return ret;
861
+ };
862
+ imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
863
+ let deferred0_0;
864
+ let deferred0_1;
865
+ try {
866
+ deferred0_0 = arg0;
867
+ deferred0_1 = arg1;
868
+ console.error(getStringFromWasm0(arg0, arg1));
869
+ } finally {
870
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
871
+ }
872
+ };
873
+ imports.wbg.__wbg_error_7bc7d576a6aaf855 = function(arg0) {
874
+ console.error(arg0);
875
+ };
876
+ imports.wbg.__wbg_fetch_6bbc32f991730587 = function(arg0) {
877
+ const ret = fetch(arg0);
878
+ return ret;
879
+ };
880
+ imports.wbg.__wbg_fetch_8119fbf8d0e4f4d1 = function(arg0, arg1) {
881
+ const ret = arg0.fetch(arg1);
882
+ return ret;
883
+ };
884
+ imports.wbg.__wbg_fetch_90447c28cc0b095e = function(arg0, arg1) {
885
+ const ret = arg0.fetch(arg1);
886
+ return ret;
887
+ };
888
+ imports.wbg.__wbg_get_7d8b665fa88606d5 = function() { return handleError(function (arg0, arg1) {
889
+ const ret = arg0.get(arg1);
890
+ return ret;
891
+ }, arguments) };
892
+ imports.wbg.__wbg_get_af9dab7e9603ea93 = function() { return handleError(function (arg0, arg1) {
893
+ const ret = Reflect.get(arg0, arg1);
894
+ return ret;
895
+ }, arguments) };
896
+ imports.wbg.__wbg_has_0e670569d65d3a45 = function() { return handleError(function (arg0, arg1) {
897
+ const ret = Reflect.has(arg0, arg1);
898
+ return ret;
899
+ }, arguments) };
900
+ imports.wbg.__wbg_headers_654c30e1bcccc552 = function(arg0) {
901
+ const ret = arg0.headers;
902
+ return ret;
903
+ };
904
+ imports.wbg.__wbg_indexedDB_23c232e00a1e28ad = function() { return handleError(function (arg0) {
905
+ const ret = arg0.indexedDB;
906
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
907
+ }, arguments) };
908
+ imports.wbg.__wbg_info_ce6bcc489c22f6f0 = function(arg0) {
909
+ console.info(arg0);
910
+ };
911
+ imports.wbg.__wbg_instanceof_IdbDatabase_f4e157055e32c479 = function(arg0) {
912
+ let result;
913
+ try {
914
+ result = arg0 instanceof IDBDatabase;
915
+ } catch (_) {
916
+ result = false;
917
+ }
918
+ const ret = result;
919
+ return ret;
920
+ };
921
+ imports.wbg.__wbg_instanceof_IdbOpenDbRequest_e4a587961e53201e = function(arg0) {
922
+ let result;
923
+ try {
924
+ result = arg0 instanceof IDBOpenDBRequest;
925
+ } catch (_) {
926
+ result = false;
927
+ }
928
+ const ret = result;
929
+ return ret;
930
+ };
931
+ imports.wbg.__wbg_instanceof_IdbRequest_9000a361b4bf0dc6 = function(arg0) {
932
+ let result;
933
+ try {
934
+ result = arg0 instanceof IDBRequest;
935
+ } catch (_) {
936
+ result = false;
937
+ }
938
+ const ret = result;
939
+ return ret;
940
+ };
941
+ imports.wbg.__wbg_instanceof_Response_cd74d1c2ac92cb0b = function(arg0) {
942
+ let result;
943
+ try {
944
+ result = arg0 instanceof Response;
945
+ } catch (_) {
946
+ result = false;
947
+ }
948
+ const ret = result;
949
+ return ret;
950
+ };
951
+ imports.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) {
952
+ let result;
953
+ try {
954
+ result = arg0 instanceof Uint8Array;
955
+ } catch (_) {
956
+ result = false;
957
+ }
958
+ const ret = result;
959
+ return ret;
960
+ };
961
+ imports.wbg.__wbg_instanceof_Window_b5cf7783caa68180 = function(arg0) {
962
+ let result;
963
+ try {
964
+ result = arg0 instanceof Window;
965
+ } catch (_) {
966
+ result = false;
967
+ }
968
+ const ret = result;
969
+ return ret;
970
+ };
971
+ imports.wbg.__wbg_iterator_27b7c8b35ab3e86b = function() {
972
+ const ret = Symbol.iterator;
973
+ return ret;
974
+ };
975
+ imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {
976
+ const ret = arg0.length;
977
+ return ret;
978
+ };
979
+ imports.wbg.__wbg_log_1d990106d99dacb7 = function(arg0) {
980
+ console.log(arg0);
981
+ };
982
+ imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
983
+ const ret = new Object();
984
+ return ret;
985
+ };
986
+ imports.wbg.__wbg_new_25f239778d6112b9 = function() {
987
+ const ret = new Array();
988
+ return ret;
989
+ };
990
+ imports.wbg.__wbg_new_3c79b3bb1b32b7d3 = function() { return handleError(function () {
991
+ const ret = new Headers();
992
+ return ret;
993
+ }, arguments) };
994
+ imports.wbg.__wbg_new_6421f6084cc5bc5a = function(arg0) {
995
+ const ret = new Uint8Array(arg0);
996
+ return ret;
997
+ };
998
+ imports.wbg.__wbg_new_881a222c65f168fc = function() { return handleError(function () {
999
+ const ret = new AbortController();
1000
+ return ret;
1001
+ }, arguments) };
1002
+ imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
1003
+ const ret = new Error();
1004
+ return ret;
1005
+ };
1006
+ imports.wbg.__wbg_new_b546ae120718850e = function() {
1007
+ const ret = new Map();
1008
+ return ret;
1009
+ };
1010
+ imports.wbg.__wbg_new_ff12d2b041fb48f1 = function(arg0, arg1) {
1011
+ try {
1012
+ var state0 = {a: arg0, b: arg1};
1013
+ var cb0 = (arg0, arg1) => {
1014
+ const a = state0.a;
1015
+ state0.a = 0;
1016
+ try {
1017
+ return wasm_bindgen__convert__closures_____invoke__h24eb9da7cece06fa(a, state0.b, arg0, arg1);
1018
+ } finally {
1019
+ state0.a = a;
1020
+ }
1021
+ };
1022
+ const ret = new Promise(cb0);
1023
+ return ret;
1024
+ } finally {
1025
+ state0.a = state0.b = 0;
1026
+ }
1027
+ };
1028
+ imports.wbg.__wbg_new_from_slice_f9c22b9153b26992 = function(arg0, arg1) {
1029
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
1030
+ return ret;
1031
+ };
1032
+ imports.wbg.__wbg_new_no_args_cb138f77cf6151ee = function(arg0, arg1) {
1033
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
1034
+ return ret;
1035
+ };
1036
+ imports.wbg.__wbg_new_with_str_and_init_c5748f76f5108934 = function() { return handleError(function (arg0, arg1, arg2) {
1037
+ const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
1038
+ return ret;
1039
+ }, arguments) };
1040
+ imports.wbg.__wbg_next_138a17bbf04e926c = function(arg0) {
1041
+ const ret = arg0.next;
1042
+ return ret;
1043
+ };
1044
+ imports.wbg.__wbg_next_3cfe5c0fe2a4cc53 = function() { return handleError(function (arg0) {
1045
+ const ret = arg0.next();
1046
+ return ret;
1047
+ }, arguments) };
1048
+ imports.wbg.__wbg_now_8cf15d6e317793e1 = function(arg0) {
1049
+ const ret = arg0.now();
1050
+ return ret;
1051
+ };
1052
+ imports.wbg.__wbg_objectStoreNames_90900f9a531513ac = function(arg0) {
1053
+ const ret = arg0.objectStoreNames;
1054
+ return ret;
1055
+ };
1056
+ imports.wbg.__wbg_objectStore_da9a077b8849dbe9 = function() { return handleError(function (arg0, arg1, arg2) {
1057
+ const ret = arg0.objectStore(getStringFromWasm0(arg1, arg2));
1058
+ return ret;
1059
+ }, arguments) };
1060
+ imports.wbg.__wbg_ok_dd98ecb60d721e20 = function(arg0) {
1061
+ const ret = arg0.ok;
1062
+ return ret;
1063
+ };
1064
+ imports.wbg.__wbg_open_0d7b85f4c0a38ffe = function() { return handleError(function (arg0, arg1, arg2, arg3) {
1065
+ const ret = arg0.open(getStringFromWasm0(arg1, arg2), arg3 >>> 0);
1066
+ return ret;
1067
+ }, arguments) };
1068
+ imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
1069
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1070
+ };
1071
+ imports.wbg.__wbg_put_d40a68e5a8902a46 = function() { return handleError(function (arg0, arg1, arg2) {
1072
+ const ret = arg0.put(arg1, arg2);
1073
+ return ret;
1074
+ }, arguments) };
1075
+ imports.wbg.__wbg_queueMicrotask_9b549dfce8865860 = function(arg0) {
1076
+ const ret = arg0.queueMicrotask;
1077
+ return ret;
1078
+ };
1079
+ imports.wbg.__wbg_queueMicrotask_fca69f5bfad613a5 = function(arg0) {
1080
+ queueMicrotask(arg0);
1081
+ };
1082
+ imports.wbg.__wbg_resolve_fd5bfbaa4ce36e1e = function(arg0) {
1083
+ const ret = Promise.resolve(arg0);
1084
+ return ret;
1085
+ };
1086
+ imports.wbg.__wbg_result_084f962aedb54250 = function() { return handleError(function (arg0) {
1087
+ const ret = arg0.result;
1088
+ return ret;
1089
+ }, arguments) };
1090
+ imports.wbg.__wbg_setTimeout_4ec014681668a581 = function(arg0, arg1) {
1091
+ const ret = setTimeout(arg0, arg1);
1092
+ return ret;
1093
+ };
1094
+ imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
1095
+ arg0[arg1] = arg2;
1096
+ };
1097
+ imports.wbg.__wbg_set_7df433eea03a5c14 = function(arg0, arg1, arg2) {
1098
+ arg0[arg1 >>> 0] = arg2;
1099
+ };
1100
+ imports.wbg.__wbg_set_body_8e743242d6076a4f = function(arg0, arg1) {
1101
+ arg0.body = arg1;
1102
+ };
1103
+ imports.wbg.__wbg_set_cache_0e437c7c8e838b9b = function(arg0, arg1) {
1104
+ arg0.cache = __wbindgen_enum_RequestCache[arg1];
1105
+ };
1106
+ imports.wbg.__wbg_set_credentials_55ae7c3c106fd5be = function(arg0, arg1) {
1107
+ arg0.credentials = __wbindgen_enum_RequestCredentials[arg1];
1108
+ };
1109
+ imports.wbg.__wbg_set_efaaf145b9377369 = function(arg0, arg1, arg2) {
1110
+ const ret = arg0.set(arg1, arg2);
1111
+ return ret;
1112
+ };
1113
+ imports.wbg.__wbg_set_headers_5671cf088e114d2b = function(arg0, arg1) {
1114
+ arg0.headers = arg1;
1115
+ };
1116
+ imports.wbg.__wbg_set_method_76c69e41b3570627 = function(arg0, arg1, arg2) {
1117
+ arg0.method = getStringFromWasm0(arg1, arg2);
1118
+ };
1119
+ imports.wbg.__wbg_set_mode_611016a6818fc690 = function(arg0, arg1) {
1120
+ arg0.mode = __wbindgen_enum_RequestMode[arg1];
1121
+ };
1122
+ imports.wbg.__wbg_set_oncomplete_e4a04a9244826e8b = function(arg0, arg1) {
1123
+ arg0.oncomplete = arg1;
1124
+ };
1125
+ imports.wbg.__wbg_set_onerror_08fecec3bdc9d24d = function(arg0, arg1) {
1126
+ arg0.onerror = arg1;
1127
+ };
1128
+ imports.wbg.__wbg_set_onsuccess_94332a00452de699 = function(arg0, arg1) {
1129
+ arg0.onsuccess = arg1;
1130
+ };
1131
+ imports.wbg.__wbg_set_onupgradeneeded_3dc6e233a6d13fe2 = function(arg0, arg1) {
1132
+ arg0.onupgradeneeded = arg1;
1133
+ };
1134
+ imports.wbg.__wbg_set_signal_e89be862d0091009 = function(arg0, arg1) {
1135
+ arg0.signal = arg1;
1136
+ };
1137
+ imports.wbg.__wbg_signal_3c14fbdc89694b39 = function(arg0) {
1138
+ const ret = arg0.signal;
1139
+ return ret;
1140
+ };
1141
+ imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
1142
+ const ret = arg1.stack;
1143
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1144
+ const len1 = WASM_VECTOR_LEN;
1145
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1146
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1147
+ };
1148
+ imports.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335 = function() {
1149
+ const ret = typeof global === 'undefined' ? null : global;
1150
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1151
+ };
1152
+ imports.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1 = function() {
1153
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
1154
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1155
+ };
1156
+ imports.wbg.__wbg_static_accessor_SELF_08f5a74c69739274 = function() {
1157
+ const ret = typeof self === 'undefined' ? null : self;
1158
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1159
+ };
1160
+ imports.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024 = function() {
1161
+ const ret = typeof window === 'undefined' ? null : window;
1162
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1163
+ };
1164
+ imports.wbg.__wbg_status_9bfc680efca4bdfd = function(arg0) {
1165
+ const ret = arg0.status;
1166
+ return ret;
1167
+ };
1168
+ imports.wbg.__wbg_stringify_655a6390e1f5eb6b = function() { return handleError(function (arg0) {
1169
+ const ret = JSON.stringify(arg0);
1170
+ return ret;
1171
+ }, arguments) };
1172
+ imports.wbg.__wbg_target_0e3e05a6263c37a0 = function(arg0) {
1173
+ const ret = arg0.target;
1174
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1175
+ };
1176
+ imports.wbg.__wbg_then_429f7caf1026411d = function(arg0, arg1, arg2) {
1177
+ const ret = arg0.then(arg1, arg2);
1178
+ return ret;
1179
+ };
1180
+ imports.wbg.__wbg_then_4f95312d68691235 = function(arg0, arg1) {
1181
+ const ret = arg0.then(arg1);
1182
+ return ret;
1183
+ };
1184
+ imports.wbg.__wbg_transaction_754344c3ae25fdcf = function() { return handleError(function (arg0, arg1, arg2) {
1185
+ const ret = arg0.transaction(getStringFromWasm0(arg1, arg2));
1186
+ return ret;
1187
+ }, arguments) };
1188
+ imports.wbg.__wbg_transaction_790ec170b8fbc74b = function() { return handleError(function (arg0, arg1, arg2, arg3) {
1189
+ const ret = arg0.transaction(getStringFromWasm0(arg1, arg2), __wbindgen_enum_IdbTransactionMode[arg3]);
1190
+ return ret;
1191
+ }, arguments) };
1192
+ imports.wbg.__wbg_url_b6d11838a4f95198 = function(arg0, arg1) {
1193
+ const ret = arg1.url;
1194
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1195
+ const len1 = WASM_VECTOR_LEN;
1196
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1197
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1198
+ };
1199
+ imports.wbg.__wbg_value_57b7b035e117f7ee = function(arg0) {
1200
+ const ret = arg0.value;
1201
+ return ret;
1202
+ };
1203
+ imports.wbg.__wbg_warn_6e567d0d926ff881 = function(arg0) {
1204
+ console.warn(arg0);
1205
+ };
1206
+ imports.wbg.__wbindgen_cast_0c8e8791e842c642 = function(arg0, arg1) {
1207
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 137, function: Function { arguments: [NamedExternref("IDBVersionChangeEvent")], shim_idx: 138, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1208
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h3d8374674b985d9e, wasm_bindgen__convert__closures_____invoke__he0fab6886ed0c11a);
1209
+ return ret;
1210
+ };
1211
+ imports.wbg.__wbindgen_cast_1e096971952e54dc = function(arg0, arg1) {
1212
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 137, function: Function { arguments: [NamedExternref("Event")], shim_idx: 138, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1213
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h3d8374674b985d9e, wasm_bindgen__convert__closures_____invoke__he0fab6886ed0c11a);
1214
+ return ret;
1215
+ };
1216
+ imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
1217
+ // Cast intrinsic for `Ref(String) -> Externref`.
1218
+ const ret = getStringFromWasm0(arg0, arg1);
1219
+ return ret;
1220
+ };
1221
+ imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
1222
+ // Cast intrinsic for `U64 -> Externref`.
1223
+ const ret = BigInt.asUintN(64, arg0);
1224
+ return ret;
1225
+ };
1226
+ imports.wbg.__wbindgen_cast_5cd376b701f56c0e = function(arg0, arg1) {
1227
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 360, function: Function { arguments: [Externref], shim_idx: 361, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1228
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__he02095c7bca1c472, wasm_bindgen__convert__closures_____invoke__hf0ae6e1302402218);
1229
+ return ret;
1230
+ };
1231
+ imports.wbg.__wbindgen_cast_829978f7e672581b = function(arg0, arg1) {
1232
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 337, function: Function { arguments: [], shim_idx: 338, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1233
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h1bff8044f851153e, wasm_bindgen__convert__closures_____invoke__hb63c839732b74d13);
1234
+ return ret;
1235
+ };
1236
+ imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
1237
+ // Cast intrinsic for `I64 -> Externref`.
1238
+ const ret = arg0;
1239
+ return ret;
1240
+ };
1241
+ imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
1242
+ // Cast intrinsic for `F64 -> Externref`.
1243
+ const ret = arg0;
1244
+ return ret;
1245
+ };
1246
+ imports.wbg.__wbindgen_init_externref_table = function() {
1247
+ const table = wasm.__wbindgen_externrefs;
1248
+ const offset = table.grow(4);
1249
+ table.set(0, undefined);
1250
+ table.set(offset + 0, undefined);
1251
+ table.set(offset + 1, null);
1252
+ table.set(offset + 2, true);
1253
+ table.set(offset + 3, false);
1254
+ };
1255
+
1256
+ return imports;
1257
+ }
1258
+
1259
+ function __wbg_finalize_init(instance, module) {
1260
+ wasm = instance.exports;
1261
+ __wbg_init.__wbindgen_wasm_module = module;
1262
+ cachedDataViewMemory0 = null;
1263
+ cachedUint8ArrayMemory0 = null;
1264
+
1265
+
1266
+ wasm.__wbindgen_start();
1267
+ return wasm;
1268
+ }
1269
+
1270
+ function initSync(module) {
1271
+ if (wasm !== undefined) return wasm;
1272
+
1273
+
1274
+ if (typeof module !== 'undefined') {
1275
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1276
+ ({module} = module)
1277
+ } else {
1278
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1279
+ }
1280
+ }
1281
+
1282
+ const imports = __wbg_get_imports();
1283
+ if (!(module instanceof WebAssembly.Module)) {
1284
+ module = new WebAssembly.Module(module);
1285
+ }
1286
+ const instance = new WebAssembly.Instance(module, imports);
1287
+ return __wbg_finalize_init(instance, module);
1288
+ }
1289
+
1290
+ async function __wbg_init(module_or_path) {
1291
+ if (wasm !== undefined) return wasm;
1292
+
1293
+
1294
+ if (typeof module_or_path !== 'undefined') {
1295
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1296
+ ({module_or_path} = module_or_path)
1297
+ } else {
1298
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1299
+ }
1300
+ }
1301
+
1302
+ if (typeof module_or_path === 'undefined') {
1303
+ module_or_path = new URL('hermes_wasm_bg.wasm', import.meta.url);
1304
+ }
1305
+ const imports = __wbg_get_imports();
1306
+
1307
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1308
+ module_or_path = fetch(module_or_path);
1309
+ }
1310
+
1311
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
1312
+
1313
+ return __wbg_finalize_init(instance, module);
1314
+ }
1315
+
1316
+ export { initSync };
1317
+ export default __wbg_init;