@contentauth/c2pa-wasm 0.4.4 → 0.4.5

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/pkg/c2pa.js CHANGED
@@ -1,248 +1,4 @@
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 passStringToWasm0(arg, malloc, realloc) {
146
- if (realloc === undefined) {
147
- const buf = cachedTextEncoder.encode(arg);
148
- const ptr = malloc(buf.length, 1) >>> 0;
149
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
150
- WASM_VECTOR_LEN = buf.length;
151
- return ptr;
152
- }
153
-
154
- let len = arg.length;
155
- let ptr = malloc(len, 1) >>> 0;
156
-
157
- const mem = getUint8ArrayMemory0();
158
-
159
- let offset = 0;
160
-
161
- for (; offset < len; offset++) {
162
- const code = arg.charCodeAt(offset);
163
- if (code > 0x7F) break;
164
- mem[ptr + offset] = code;
165
- }
166
- if (offset !== len) {
167
- if (offset !== 0) {
168
- arg = arg.slice(offset);
169
- }
170
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
171
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
172
- const ret = cachedTextEncoder.encodeInto(arg, view);
173
-
174
- offset += ret.written;
175
- ptr = realloc(ptr, len, offset, 1) >>> 0;
176
- }
177
-
178
- WASM_VECTOR_LEN = offset;
179
- return ptr;
180
- }
181
-
182
- function takeFromExternrefTable0(idx) {
183
- const value = wasm.__wbindgen_externrefs.get(idx);
184
- wasm.__externref_table_dealloc(idx);
185
- return value;
186
- }
187
-
188
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
189
- cachedTextDecoder.decode();
190
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
191
- let numBytesDecoded = 0;
192
- function decodeText(ptr, len) {
193
- numBytesDecoded += len;
194
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
195
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
196
- cachedTextDecoder.decode();
197
- numBytesDecoded = len;
198
- }
199
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
200
- }
201
-
202
- const cachedTextEncoder = new TextEncoder();
203
-
204
- if (!('encodeInto' in cachedTextEncoder)) {
205
- cachedTextEncoder.encodeInto = function (arg, view) {
206
- const buf = cachedTextEncoder.encode(arg);
207
- view.set(buf);
208
- return {
209
- read: arg.length,
210
- written: buf.length
211
- };
212
- }
213
- }
214
-
215
- let WASM_VECTOR_LEN = 0;
216
-
217
- function wasm_bindgen__convert__closures_____invoke__hfa979f81ae70afaa(arg0, arg1, arg2) {
218
- wasm.wasm_bindgen__convert__closures_____invoke__hfa979f81ae70afaa(arg0, arg1, arg2);
219
- }
220
-
221
- function wasm_bindgen__convert__closures_____invoke__h6743aa07e10cb0d4(arg0, arg1) {
222
- wasm.wasm_bindgen__convert__closures_____invoke__h6743aa07e10cb0d4(arg0, arg1);
223
- }
224
-
225
- function wasm_bindgen__convert__closures_____invoke__h536d005b97d28fdb(arg0, arg1, arg2, arg3) {
226
- wasm.wasm_bindgen__convert__closures_____invoke__h536d005b97d28fdb(arg0, arg1, arg2, arg3);
227
- }
228
-
229
- const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
230
-
231
- const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
232
-
233
- const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
234
-
235
- const WasmBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
236
- ? { register: () => {}, unregister: () => {} }
237
- : new FinalizationRegistry(ptr => wasm.__wbg_wasmbuilder_free(ptr >>> 0, 1));
238
-
239
- const WasmReaderFinalization = (typeof FinalizationRegistry === 'undefined')
240
- ? { register: () => {}, unregister: () => {} }
241
- : new FinalizationRegistry(ptr => wasm.__wbg_wasmreader_free(ptr >>> 0, 1));
242
-
243
- const WasmSignerFinalization = (typeof FinalizationRegistry === 'undefined')
244
- ? { register: () => {}, unregister: () => {} }
245
- : new FinalizationRegistry(ptr => wasm.__wbg_wasmsigner_free(ptr >>> 0, 1));
1
+ /* @ts-self-types="./c2pa.d.ts" */
246
2
 
247
3
  /**
248
4
  * Wraps a `c2pa::Builder`.
@@ -276,25 +32,53 @@ export class WasmBuilder {
276
32
  }
277
33
  }
278
34
  /**
279
- * Sets the builder "intent."
280
- * @param {any} json_intent
35
+ * Add an ingredient to the manifest from a JSON ingredient definition without a blob
36
+ *
37
+ * # Arguments
38
+ * * `ingredient_json` - A JSON string representing the ingredient.
39
+ * @param {string} json
281
40
  */
282
- setIntent(json_intent) {
283
- const ret = wasm.wasmbuilder_setIntent(this.__wbg_ptr, json_intent);
41
+ addIngredient(json) {
42
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
43
+ const len0 = WASM_VECTOR_LEN;
44
+ const ret = wasm.wasmbuilder_addIngredient(this.__wbg_ptr, ptr0, len0);
284
45
  if (ret[1]) {
285
46
  throw takeFromExternrefTable0(ret[0]);
286
47
  }
287
48
  }
288
49
  /**
289
- * "Save" a builder to an archive.
290
- * @returns {Uint8Array}
291
- */
292
- toArchive() {
293
- const ret = wasm.wasmbuilder_toArchive(this.__wbg_ptr);
294
- if (ret[2]) {
295
- throw takeFromExternrefTable0(ret[1]);
50
+ * Add an ingredient to the manifest from a JSON ingredient definition and a [`Blob`].
51
+ *
52
+ * # Arguments
53
+ * * `ingredient_json` - A JSON string representing the ingredient. This ingredient is merged with the ingredient specified in the `stream` argument, and these values take precedence.
54
+ * * `format` - The format of the ingredient.
55
+ * * `blob` - A [`Blob`] representing an asset which should be included as an ingredient.
56
+ * @param {string} json
57
+ * @param {string} format
58
+ * @param {Blob} blob
59
+ */
60
+ addIngredientFromBlob(json, format, blob) {
61
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
62
+ const len0 = WASM_VECTOR_LEN;
63
+ const ptr1 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
64
+ const len1 = WASM_VECTOR_LEN;
65
+ const ret = wasm.wasmbuilder_addIngredientFromBlob(this.__wbg_ptr, ptr0, len0, ptr1, len1, blob);
66
+ if (ret[1]) {
67
+ throw takeFromExternrefTable0(ret[0]);
68
+ }
69
+ }
70
+ /**
71
+ * Add a [`Blob`] to the manifest as a resource. The ID must match an identifier in the manifest.
72
+ * @param {string} id
73
+ * @param {Blob} blob
74
+ */
75
+ addResourceFromBlob(id, blob) {
76
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
77
+ const len0 = WASM_VECTOR_LEN;
78
+ const ret = wasm.wasmbuilder_addResourceFromBlob(this.__wbg_ptr, ptr0, len0, blob);
79
+ if (ret[1]) {
80
+ throw takeFromExternrefTable0(ret[0]);
296
81
  }
297
- return takeFromExternrefTable0(ret[0]);
298
82
  }
299
83
  /**
300
84
  * Attempts to create a new `WasmBuilder` from a builder archive.
@@ -313,26 +97,22 @@ export class WasmBuilder {
313
97
  return WasmBuilder.__wrap(ret[0]);
314
98
  }
315
99
  /**
316
- * Sets the state of the no_embed flag.
317
- * @param {boolean} no_embed
318
- */
319
- setNoEmbed(no_embed) {
320
- wasm.wasmbuilder_setNoEmbed(this.__wbg_ptr, no_embed);
321
- }
322
- /**
323
- * Add an ingredient to the manifest from a JSON ingredient definition without a blob
324
- *
325
- * # Arguments
326
- * * `ingredient_json` - A JSON string representing the ingredient.
100
+ * Attempts to create a new `WasmBuilder` from a JSON ManifestDefinition string.
101
+ * Optionally accepts a context JSON string to configure the builder.
327
102
  * @param {string} json
103
+ * @param {string | null} [context_json]
104
+ * @returns {WasmBuilder}
328
105
  */
329
- addIngredient(json) {
106
+ static fromJson(json, context_json) {
330
107
  const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
331
108
  const len0 = WASM_VECTOR_LEN;
332
- const ret = wasm.wasmbuilder_addIngredient(this.__wbg_ptr, ptr0, len0);
333
- if (ret[1]) {
334
- throw takeFromExternrefTable0(ret[0]);
109
+ var ptr1 = isLikeNone(context_json) ? 0 : passStringToWasm0(context_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
110
+ var len1 = WASM_VECTOR_LEN;
111
+ const ret = wasm.wasmbuilder_fromJson(ptr0, len0, ptr1, len1);
112
+ if (ret[2]) {
113
+ throw takeFromExternrefTable0(ret[1]);
335
114
  }
115
+ return WasmBuilder.__wrap(ret[0]);
336
116
  }
337
117
  /**
338
118
  * Get the current manifest definition.
@@ -345,6 +125,38 @@ export class WasmBuilder {
345
125
  }
346
126
  return takeFromExternrefTable0(ret[0]);
347
127
  }
128
+ /**
129
+ * Creates a new `WasmBuilder` with a minimal manifest definition.
130
+ * Optionally accepts a context JSON string to configure the builder.
131
+ * @param {string | null} [context_json]
132
+ * @returns {WasmBuilder}
133
+ */
134
+ static new(context_json) {
135
+ var ptr0 = isLikeNone(context_json) ? 0 : passStringToWasm0(context_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
136
+ var len0 = WASM_VECTOR_LEN;
137
+ const ret = wasm.wasmbuilder_new(ptr0, len0);
138
+ if (ret[2]) {
139
+ throw takeFromExternrefTable0(ret[1]);
140
+ }
141
+ return WasmBuilder.__wrap(ret[0]);
142
+ }
143
+ /**
144
+ * Sets the builder "intent."
145
+ * @param {any} json_intent
146
+ */
147
+ setIntent(json_intent) {
148
+ const ret = wasm.wasmbuilder_setIntent(this.__wbg_ptr, json_intent);
149
+ if (ret[1]) {
150
+ throw takeFromExternrefTable0(ret[0]);
151
+ }
152
+ }
153
+ /**
154
+ * Sets the state of the no_embed flag.
155
+ * @param {boolean} no_embed
156
+ */
157
+ setNoEmbed(no_embed) {
158
+ wasm.wasmbuilder_setNoEmbed(this.__wbg_ptr, no_embed);
159
+ }
348
160
  /**
349
161
  * Sets the remote_url for a remote manifest.
350
162
  *
@@ -357,19 +169,6 @@ export class WasmBuilder {
357
169
  const len0 = WASM_VECTOR_LEN;
358
170
  wasm.wasmbuilder_setRemoteUrl(this.__wbg_ptr, ptr0, len0);
359
171
  }
360
- /**
361
- * Add a [`Blob`] to the manifest as a resource. The ID must match an identifier in the manifest.
362
- * @param {string} id
363
- * @param {Blob} blob
364
- */
365
- addResourceFromBlob(id, blob) {
366
- const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
367
- const len0 = WASM_VECTOR_LEN;
368
- const ret = wasm.wasmbuilder_addResourceFromBlob(this.__wbg_ptr, ptr0, len0, blob);
369
- if (ret[1]) {
370
- throw takeFromExternrefTable0(ret[0]);
371
- }
372
- }
373
172
  /**
374
173
  * Sets a thumbnail from a [`Blob`] to be included in the manifest. The thumbnail should represent the asset being signed.
375
174
  * @param {string} format
@@ -383,86 +182,43 @@ export class WasmBuilder {
383
182
  throw takeFromExternrefTable0(ret[0]);
384
183
  }
385
184
  }
386
- /**
387
- * Add an ingredient to the manifest from a JSON ingredient definition and a [`Blob`].
388
- *
389
- * # Arguments
390
- * * `ingredient_json` - A JSON string representing the ingredient. This ingredient is merged with the ingredient specified in the `stream` argument, and these values take precedence.
391
- * * `format` - The format of the ingredient.
392
- * * `blob` - A [`Blob`] representing an asset which should be included as an ingredient.
393
- * @param {string} json
394
- * @param {string} format
395
- * @param {Blob} blob
396
- */
397
- addIngredientFromBlob(json, format, blob) {
398
- const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
399
- const len0 = WASM_VECTOR_LEN;
400
- const ptr1 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
401
- const len1 = WASM_VECTOR_LEN;
402
- const ret = wasm.wasmbuilder_addIngredientFromBlob(this.__wbg_ptr, ptr0, len0, ptr1, len1, blob);
403
- if (ret[1]) {
404
- throw takeFromExternrefTable0(ret[0]);
405
- }
406
- }
407
185
  /**
408
186
  * Sign an asset using the provided SignerDefinition, format, and source Blob.
409
- * Use this method to get both the manifest bytes and the bytes of the signed asset.
410
187
  * @param {SignerDefinition} signer_definition
411
188
  * @param {string} format
412
189
  * @param {Blob} source
413
- * @returns {Promise<any>}
190
+ * @returns {Promise<Uint8Array>}
414
191
  */
415
- signAndGetManifestBytes(signer_definition, format, source) {
192
+ sign(signer_definition, format, source) {
416
193
  const ptr0 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
417
194
  const len0 = WASM_VECTOR_LEN;
418
- const ret = wasm.wasmbuilder_signAndGetManifestBytes(this.__wbg_ptr, signer_definition, ptr0, len0, source);
195
+ const ret = wasm.wasmbuilder_sign(this.__wbg_ptr, signer_definition, ptr0, len0, source);
419
196
  return ret;
420
197
  }
421
- /**
422
- * Creates a new `WasmBuilder` with a minimal manifest definition.
423
- * Optionally accepts a context JSON string to configure the builder.
424
- * @param {string | null} [context_json]
425
- * @returns {WasmBuilder}
426
- */
427
- static new(context_json) {
428
- var ptr0 = isLikeNone(context_json) ? 0 : passStringToWasm0(context_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
429
- var len0 = WASM_VECTOR_LEN;
430
- const ret = wasm.wasmbuilder_new(ptr0, len0);
431
- if (ret[2]) {
432
- throw takeFromExternrefTable0(ret[1]);
433
- }
434
- return WasmBuilder.__wrap(ret[0]);
435
- }
436
198
  /**
437
199
  * Sign an asset using the provided SignerDefinition, format, and source Blob.
200
+ * Use this method to get both the manifest bytes and the bytes of the signed asset.
438
201
  * @param {SignerDefinition} signer_definition
439
202
  * @param {string} format
440
203
  * @param {Blob} source
441
- * @returns {Promise<Uint8Array>}
204
+ * @returns {Promise<any>}
442
205
  */
443
- sign(signer_definition, format, source) {
206
+ signAndGetManifestBytes(signer_definition, format, source) {
444
207
  const ptr0 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
445
208
  const len0 = WASM_VECTOR_LEN;
446
- const ret = wasm.wasmbuilder_sign(this.__wbg_ptr, signer_definition, ptr0, len0, source);
209
+ const ret = wasm.wasmbuilder_signAndGetManifestBytes(this.__wbg_ptr, signer_definition, ptr0, len0, source);
447
210
  return ret;
448
211
  }
449
212
  /**
450
- * Attempts to create a new `WasmBuilder` from a JSON ManifestDefinition string.
451
- * Optionally accepts a context JSON string to configure the builder.
452
- * @param {string} json
453
- * @param {string | null} [context_json]
454
- * @returns {WasmBuilder}
213
+ * "Save" a builder to an archive.
214
+ * @returns {Uint8Array}
455
215
  */
456
- static fromJson(json, context_json) {
457
- const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
458
- const len0 = WASM_VECTOR_LEN;
459
- var ptr1 = isLikeNone(context_json) ? 0 : passStringToWasm0(context_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
460
- var len1 = WASM_VECTOR_LEN;
461
- const ret = wasm.wasmbuilder_fromJson(ptr0, len0, ptr1, len1);
216
+ toArchive() {
217
+ const ret = wasm.wasmbuilder_toArchive(this.__wbg_ptr);
462
218
  if (ret[2]) {
463
219
  throw takeFromExternrefTable0(ret[1]);
464
220
  }
465
- return WasmBuilder.__wrap(ret[0]);
221
+ return takeFromExternrefTable0(ret[0]);
466
222
  }
467
223
  }
468
224
  if (Symbol.dispose) WasmBuilder.prototype[Symbol.dispose] = WasmBuilder.prototype.free;
@@ -501,17 +257,6 @@ export class WasmReader {
501
257
  }
502
258
  return v1;
503
259
  }
504
- /**
505
- * Returns the asset's manifest store.
506
- * @returns {any}
507
- */
508
- manifestStore() {
509
- const ret = wasm.wasmreader_manifestStore(this.__wbg_ptr);
510
- if (ret[2]) {
511
- throw takeFromExternrefTable0(ret[1]);
512
- }
513
- return takeFromExternrefTable0(ret[0]);
514
- }
515
260
  /**
516
261
  * Returns the asset's active manifest.
517
262
  * @returns {any}
@@ -524,18 +269,20 @@ export class WasmReader {
524
269
  return takeFromExternrefTable0(ret[0]);
525
270
  }
526
271
  /**
527
- * Accepts a URI reference to a binary object in the resource store and returns a `js_sys::Uint8Array` containing the resource's bytes.
528
- * @param {string} uri
529
- * @returns {Uint8Array}
272
+ * Attempts to create a new `WasmReader` from an asset format and `Blob` of the asset's bytes.
273
+ * Optionally accepts a context JSON string to configure the reader.
274
+ * @param {string} format
275
+ * @param {Blob} blob
276
+ * @param {string | null} [context_json]
277
+ * @returns {Promise<WasmReader>}
530
278
  */
531
- resourceToBytes(uri) {
532
- const ptr0 = passStringToWasm0(uri, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
279
+ static fromBlob(format, blob, context_json) {
280
+ const ptr0 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
533
281
  const len0 = WASM_VECTOR_LEN;
534
- const ret = wasm.wasmreader_resourceToBytes(this.__wbg_ptr, ptr0, len0);
535
- if (ret[2]) {
536
- throw takeFromExternrefTable0(ret[1]);
537
- }
538
- return takeFromExternrefTable0(ret[0]);
282
+ var ptr1 = isLikeNone(context_json) ? 0 : passStringToWasm0(context_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
283
+ var len1 = WASM_VECTOR_LEN;
284
+ const ret = wasm.wasmreader_fromBlob(ptr0, len0, blob, ptr1, len1);
285
+ return ret;
539
286
  }
540
287
  /**
541
288
  * Attempts to create a new `WasmReader` from an asset format, a `Blob` of the bytes of the initial segment, and a fragment `Blob`.
@@ -571,20 +318,29 @@ export class WasmReader {
571
318
  }
572
319
  }
573
320
  /**
574
- * Attempts to create a new `WasmReader` from an asset format and `Blob` of the asset's bytes.
575
- * Optionally accepts a context JSON string to configure the reader.
576
- * @param {string} format
577
- * @param {Blob} blob
578
- * @param {string | null} [context_json]
579
- * @returns {Promise<WasmReader>}
321
+ * Returns the asset's manifest store.
322
+ * @returns {any}
580
323
  */
581
- static fromBlob(format, blob, context_json) {
582
- const ptr0 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
324
+ manifestStore() {
325
+ const ret = wasm.wasmreader_manifestStore(this.__wbg_ptr);
326
+ if (ret[2]) {
327
+ throw takeFromExternrefTable0(ret[1]);
328
+ }
329
+ return takeFromExternrefTable0(ret[0]);
330
+ }
331
+ /**
332
+ * Accepts a URI reference to a binary object in the resource store and returns a `js_sys::Uint8Array` containing the resource's bytes.
333
+ * @param {string} uri
334
+ * @returns {Uint8Array}
335
+ */
336
+ resourceToBytes(uri) {
337
+ const ptr0 = passStringToWasm0(uri, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
583
338
  const len0 = WASM_VECTOR_LEN;
584
- var ptr1 = isLikeNone(context_json) ? 0 : passStringToWasm0(context_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
585
- var len1 = WASM_VECTOR_LEN;
586
- const ret = wasm.wasmreader_fromBlob(ptr0, len0, blob, ptr1, len1);
587
- return ret;
339
+ const ret = wasm.wasmreader_resourceToBytes(this.__wbg_ptr, ptr0, len0);
340
+ if (ret[2]) {
341
+ throw takeFromExternrefTable0(ret[1]);
342
+ }
343
+ return takeFromExternrefTable0(ret[0]);
588
344
  }
589
345
  }
590
346
  if (Symbol.dispose) WasmReader.prototype[Symbol.dispose] = WasmReader.prototype.free;
@@ -642,602 +398,846 @@ export function run() {
642
398
  wasm.run();
643
399
  }
644
400
 
645
- const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
646
-
647
- async function __wbg_load(module, imports) {
648
- if (typeof Response === 'function' && module instanceof Response) {
649
- if (typeof WebAssembly.instantiateStreaming === 'function') {
650
- try {
651
- return await WebAssembly.instantiateStreaming(module, imports);
652
- } catch (e) {
653
- const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
654
-
655
- if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
656
- 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);
657
-
658
- } else {
659
- throw e;
660
- }
661
- }
662
- }
663
-
664
- const bytes = await module.arrayBuffer();
665
- return await WebAssembly.instantiate(bytes, imports);
666
- } else {
667
- const instance = await WebAssembly.instantiate(module, imports);
401
+ function __wbg_get_imports() {
402
+ const import0 = {
403
+ __proto__: null,
404
+ __wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {
405
+ const ret = Error(getStringFromWasm0(arg0, arg1));
406
+ return ret;
407
+ },
408
+ __wbg_Number_04624de7d0e8332d: function(arg0) {
409
+ const ret = Number(arg0);
410
+ return ret;
411
+ },
412
+ __wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2: function(arg0, arg1) {
413
+ const v = arg1;
414
+ const ret = typeof(v) === 'bigint' ? v : undefined;
415
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
416
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
417
+ },
418
+ __wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25: function(arg0) {
419
+ const v = arg0;
420
+ const ret = typeof(v) === 'boolean' ? v : undefined;
421
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
422
+ },
423
+ __wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(arg0, arg1) {
424
+ const ret = debugString(arg1);
425
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
426
+ const len1 = WASM_VECTOR_LEN;
427
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
428
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
429
+ },
430
+ __wbg___wbindgen_in_47fa6863be6f2f25: function(arg0, arg1) {
431
+ const ret = arg0 in arg1;
432
+ return ret;
433
+ },
434
+ __wbg___wbindgen_is_bigint_31b12575b56f32fc: function(arg0) {
435
+ const ret = typeof(arg0) === 'bigint';
436
+ return ret;
437
+ },
438
+ __wbg___wbindgen_is_function_0095a73b8b156f76: function(arg0) {
439
+ const ret = typeof(arg0) === 'function';
440
+ return ret;
441
+ },
442
+ __wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {
443
+ const val = arg0;
444
+ const ret = typeof(val) === 'object' && val !== null;
445
+ return ret;
446
+ },
447
+ __wbg___wbindgen_is_string_cd444516edc5b180: function(arg0) {
448
+ const ret = typeof(arg0) === 'string';
449
+ return ret;
450
+ },
451
+ __wbg___wbindgen_is_undefined_9e4d92534c42d778: function(arg0) {
452
+ const ret = arg0 === undefined;
453
+ return ret;
454
+ },
455
+ __wbg___wbindgen_jsval_eq_11888390b0186270: function(arg0, arg1) {
456
+ const ret = arg0 === arg1;
457
+ return ret;
458
+ },
459
+ __wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811: function(arg0, arg1) {
460
+ const ret = arg0 == arg1;
461
+ return ret;
462
+ },
463
+ __wbg___wbindgen_number_get_8ff4255516ccad3e: function(arg0, arg1) {
464
+ const obj = arg1;
465
+ const ret = typeof(obj) === 'number' ? obj : undefined;
466
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
467
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
468
+ },
469
+ __wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {
470
+ const obj = arg1;
471
+ const ret = typeof(obj) === 'string' ? obj : undefined;
472
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
473
+ var len1 = WASM_VECTOR_LEN;
474
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
475
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
476
+ },
477
+ __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
478
+ throw new Error(getStringFromWasm0(arg0, arg1));
479
+ },
480
+ __wbg__wbg_cb_unref_d9b87ff7982e3b21: function(arg0) {
481
+ arg0._wbg_cb_unref();
482
+ },
483
+ __wbg_abort_2f0584e03e8e3950: function(arg0) {
484
+ arg0.abort();
485
+ },
486
+ __wbg_abort_d549b92d3c665de1: function(arg0, arg1) {
487
+ arg0.abort(arg1);
488
+ },
489
+ __wbg_append_a992ccc37aa62dc4: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
490
+ arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
491
+ }, arguments); },
492
+ __wbg_arrayBuffer_bb54076166006c39: function() { return handleError(function (arg0) {
493
+ const ret = arg0.arrayBuffer();
494
+ return ret;
495
+ }, arguments); },
496
+ __wbg_byteLength_3417f266f4bf562a: function(arg0) {
497
+ const ret = arg0.byteLength;
498
+ return ret;
499
+ },
500
+ __wbg_call_389efe28435a9388: function() { return handleError(function (arg0, arg1) {
501
+ const ret = arg0.call(arg1);
502
+ return ret;
503
+ }, arguments); },
504
+ __wbg_call_4708e0c13bdc8e95: function() { return handleError(function (arg0, arg1, arg2) {
505
+ const ret = arg0.call(arg1, arg2);
506
+ return ret;
507
+ }, arguments); },
508
+ __wbg_clearTimeout_42d9ccd50822fd3a: function(arg0) {
509
+ const ret = clearTimeout(arg0);
510
+ return ret;
511
+ },
512
+ __wbg_crypto_86f2631e91b51511: function(arg0) {
513
+ const ret = arg0.crypto;
514
+ return ret;
515
+ },
516
+ __wbg_done_57b39ecd9addfe81: function(arg0) {
517
+ const ret = arg0.done;
518
+ return ret;
519
+ },
520
+ __wbg_entries_58c7934c745daac7: function(arg0) {
521
+ const ret = Object.entries(arg0);
522
+ return ret;
523
+ },
524
+ __wbg_error_7534b8e9a36f1ab4: function(arg0, arg1) {
525
+ let deferred0_0;
526
+ let deferred0_1;
527
+ try {
528
+ deferred0_0 = arg0;
529
+ deferred0_1 = arg1;
530
+ console.error(getStringFromWasm0(arg0, arg1));
531
+ } finally {
532
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
533
+ }
534
+ },
535
+ __wbg_fetch_6bbc32f991730587: function(arg0) {
536
+ const ret = fetch(arg0);
537
+ return ret;
538
+ },
539
+ __wbg_fetch_afb6a4b6cacf876d: function(arg0, arg1) {
540
+ const ret = arg0.fetch(arg1);
541
+ return ret;
542
+ },
543
+ __wbg_from_bddd64e7d5ff6941: function(arg0) {
544
+ const ret = Array.from(arg0);
545
+ return ret;
546
+ },
547
+ __wbg_getRandomValues_1c61fac11405ffdc: function() { return handleError(function (arg0, arg1) {
548
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
549
+ }, arguments); },
550
+ __wbg_getRandomValues_9c5c1b115e142bb8: function() { return handleError(function (arg0, arg1) {
551
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
552
+ }, arguments); },
553
+ __wbg_getRandomValues_b3f15fcbfabb0f8b: function() { return handleError(function (arg0, arg1) {
554
+ arg0.getRandomValues(arg1);
555
+ }, arguments); },
556
+ __wbg_getTime_1e3cd1391c5c3995: function(arg0) {
557
+ const ret = arg0.getTime();
558
+ return ret;
559
+ },
560
+ __wbg_get_9b94d73e6221f75c: function(arg0, arg1) {
561
+ const ret = arg0[arg1 >>> 0];
562
+ return ret;
563
+ },
564
+ __wbg_get_b3ed3ad4be2bc8ac: function() { return handleError(function (arg0, arg1) {
565
+ const ret = Reflect.get(arg0, arg1);
566
+ return ret;
567
+ }, arguments); },
568
+ __wbg_get_with_ref_key_1dc361bd10053bfe: function(arg0, arg1) {
569
+ const ret = arg0[arg1];
570
+ return ret;
571
+ },
572
+ __wbg_has_d4e53238966c12b6: function() { return handleError(function (arg0, arg1) {
573
+ const ret = Reflect.has(arg0, arg1);
574
+ return ret;
575
+ }, arguments); },
576
+ __wbg_headers_59a2938db9f80985: function(arg0) {
577
+ const ret = arg0.headers;
578
+ return ret;
579
+ },
580
+ __wbg_instanceof_ArrayBuffer_c367199e2fa2aa04: function(arg0) {
581
+ let result;
582
+ try {
583
+ result = arg0 instanceof ArrayBuffer;
584
+ } catch (_) {
585
+ result = false;
586
+ }
587
+ const ret = result;
588
+ return ret;
589
+ },
590
+ __wbg_instanceof_Map_53af74335dec57f4: function(arg0) {
591
+ let result;
592
+ try {
593
+ result = arg0 instanceof Map;
594
+ } catch (_) {
595
+ result = false;
596
+ }
597
+ const ret = result;
598
+ return ret;
599
+ },
600
+ __wbg_instanceof_Promise_0094681e3519d6ec: function(arg0) {
601
+ let result;
602
+ try {
603
+ result = arg0 instanceof Promise;
604
+ } catch (_) {
605
+ result = false;
606
+ }
607
+ const ret = result;
608
+ return ret;
609
+ },
610
+ __wbg_instanceof_Response_ee1d54d79ae41977: function(arg0) {
611
+ let result;
612
+ try {
613
+ result = arg0 instanceof Response;
614
+ } catch (_) {
615
+ result = false;
616
+ }
617
+ const ret = result;
618
+ return ret;
619
+ },
620
+ __wbg_instanceof_Uint8Array_9b9075935c74707c: function(arg0) {
621
+ let result;
622
+ try {
623
+ result = arg0 instanceof Uint8Array;
624
+ } catch (_) {
625
+ result = false;
626
+ }
627
+ const ret = result;
628
+ return ret;
629
+ },
630
+ __wbg_isArray_d314bb98fcf08331: function(arg0) {
631
+ const ret = Array.isArray(arg0);
632
+ return ret;
633
+ },
634
+ __wbg_isSafeInteger_bfbc7332a9768d2a: function(arg0) {
635
+ const ret = Number.isSafeInteger(arg0);
636
+ return ret;
637
+ },
638
+ __wbg_iterator_6ff6560ca1568e55: function() {
639
+ const ret = Symbol.iterator;
640
+ return ret;
641
+ },
642
+ __wbg_length_32ed9a279acd054c: function(arg0) {
643
+ const ret = arg0.length;
644
+ return ret;
645
+ },
646
+ __wbg_length_35a7bace40f36eac: function(arg0) {
647
+ const ret = arg0.length;
648
+ return ret;
649
+ },
650
+ __wbg_msCrypto_d562bbe83e0d4b91: function(arg0) {
651
+ const ret = arg0.msCrypto;
652
+ return ret;
653
+ },
654
+ __wbg_new_0_73afc35eb544e539: function() {
655
+ const ret = new Date();
656
+ return ret;
657
+ },
658
+ __wbg_new_361308b2356cecd0: function() {
659
+ const ret = new Object();
660
+ return ret;
661
+ },
662
+ __wbg_new_3eb36ae241fe6f44: function() {
663
+ const ret = new Array();
664
+ return ret;
665
+ },
666
+ __wbg_new_64284bd487f9d239: function() { return handleError(function () {
667
+ const ret = new Headers();
668
+ return ret;
669
+ }, arguments); },
670
+ __wbg_new_72b49615380db768: function(arg0, arg1) {
671
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
672
+ return ret;
673
+ },
674
+ __wbg_new_8a6f238a6ece86ea: function() {
675
+ const ret = new Error();
676
+ return ret;
677
+ },
678
+ __wbg_new_b5d9e2fb389fef91: function(arg0, arg1) {
679
+ try {
680
+ var state0 = {a: arg0, b: arg1};
681
+ var cb0 = (arg0, arg1) => {
682
+ const a = state0.a;
683
+ state0.a = 0;
684
+ try {
685
+ return wasm_bindgen__convert__closures_____invoke__h1ab8f2c4d39167e4(a, state0.b, arg0, arg1);
686
+ } finally {
687
+ state0.a = a;
688
+ }
689
+ };
690
+ const ret = new Promise(cb0);
691
+ return ret;
692
+ } finally {
693
+ state0.a = state0.b = 0;
694
+ }
695
+ },
696
+ __wbg_new_b949e7f56150a5d1: function() { return handleError(function () {
697
+ const ret = new AbortController();
698
+ return ret;
699
+ }, arguments); },
700
+ __wbg_new_c27f68f047724fa3: function() { return handleError(function () {
701
+ const ret = new FileReaderSync();
702
+ return ret;
703
+ }, arguments); },
704
+ __wbg_new_dca287b076112a51: function() {
705
+ const ret = new Map();
706
+ return ret;
707
+ },
708
+ __wbg_new_dd2b680c8bf6ae29: function(arg0) {
709
+ const ret = new Uint8Array(arg0);
710
+ return ret;
711
+ },
712
+ __wbg_new_from_slice_a3d2629dc1826784: function(arg0, arg1) {
713
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
714
+ return ret;
715
+ },
716
+ __wbg_new_no_args_1c7c842f08d00ebb: function(arg0, arg1) {
717
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
718
+ return ret;
719
+ },
720
+ __wbg_new_with_length_a2c39cbe88fd8ff1: function(arg0) {
721
+ const ret = new Uint8Array(arg0 >>> 0);
722
+ return ret;
723
+ },
724
+ __wbg_new_with_str_and_init_a61cbc6bdef21614: function() { return handleError(function (arg0, arg1, arg2) {
725
+ const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
726
+ return ret;
727
+ }, arguments); },
728
+ __wbg_next_3482f54c49e8af19: function() { return handleError(function (arg0) {
729
+ const ret = arg0.next();
730
+ return ret;
731
+ }, arguments); },
732
+ __wbg_next_418f80d8f5303233: function(arg0) {
733
+ const ret = arg0.next;
734
+ return ret;
735
+ },
736
+ __wbg_node_e1f24f89a7336c2e: function(arg0) {
737
+ const ret = arg0.node;
738
+ return ret;
739
+ },
740
+ __wbg_now_a3af9a2f4bbaa4d1: function() {
741
+ const ret = Date.now();
742
+ return ret;
743
+ },
744
+ __wbg_process_3975fd6c72f520aa: function(arg0) {
745
+ const ret = arg0.process;
746
+ return ret;
747
+ },
748
+ __wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
749
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
750
+ },
751
+ __wbg_queueMicrotask_0aa0a927f78f5d98: function(arg0) {
752
+ const ret = arg0.queueMicrotask;
753
+ return ret;
754
+ },
755
+ __wbg_queueMicrotask_5bb536982f78a56f: function(arg0) {
756
+ queueMicrotask(arg0);
757
+ },
758
+ __wbg_randomFillSync_f8c153b79f285817: function() { return handleError(function (arg0, arg1) {
759
+ arg0.randomFillSync(arg1);
760
+ }, arguments); },
761
+ __wbg_readAsArrayBuffer_8b36975ef3917d9b: function() { return handleError(function (arg0, arg1) {
762
+ const ret = arg0.readAsArrayBuffer(arg1);
763
+ return ret;
764
+ }, arguments); },
765
+ __wbg_require_b74f47fc2d022fd6: function() { return handleError(function () {
766
+ const ret = module.require;
767
+ return ret;
768
+ }, arguments); },
769
+ __wbg_resolve_002c4b7d9d8f6b64: function(arg0) {
770
+ const ret = Promise.resolve(arg0);
771
+ return ret;
772
+ },
773
+ __wbg_setTimeout_4ec014681668a581: function(arg0, arg1) {
774
+ const ret = setTimeout(arg0, arg1);
775
+ return ret;
776
+ },
777
+ __wbg_set_1eb0999cf5d27fc8: function(arg0, arg1, arg2) {
778
+ const ret = arg0.set(arg1, arg2);
779
+ return ret;
780
+ },
781
+ __wbg_set_3f1d0b984ed272ed: function(arg0, arg1, arg2) {
782
+ arg0[arg1] = arg2;
783
+ },
784
+ __wbg_set_body_9a7e00afe3cfe244: function(arg0, arg1) {
785
+ arg0.body = arg1;
786
+ },
787
+ __wbg_set_cache_315a3ed773a41543: function(arg0, arg1) {
788
+ arg0.cache = __wbindgen_enum_RequestCache[arg1];
789
+ },
790
+ __wbg_set_cc56eefd2dd91957: function(arg0, arg1, arg2) {
791
+ arg0.set(getArrayU8FromWasm0(arg1, arg2));
792
+ },
793
+ __wbg_set_credentials_c4a58d2e05ef24fb: function(arg0, arg1) {
794
+ arg0.credentials = __wbindgen_enum_RequestCredentials[arg1];
795
+ },
796
+ __wbg_set_f43e577aea94465b: function(arg0, arg1, arg2) {
797
+ arg0[arg1 >>> 0] = arg2;
798
+ },
799
+ __wbg_set_headers_cfc5f4b2c1f20549: function(arg0, arg1) {
800
+ arg0.headers = arg1;
801
+ },
802
+ __wbg_set_method_c3e20375f5ae7fac: function(arg0, arg1, arg2) {
803
+ arg0.method = getStringFromWasm0(arg1, arg2);
804
+ },
805
+ __wbg_set_mode_b13642c312648202: function(arg0, arg1) {
806
+ arg0.mode = __wbindgen_enum_RequestMode[arg1];
807
+ },
808
+ __wbg_set_signal_f2d3f8599248896d: function(arg0, arg1) {
809
+ arg0.signal = arg1;
810
+ },
811
+ __wbg_signal_d1285ecab4ebc5ad: function(arg0) {
812
+ const ret = arg0.signal;
813
+ return ret;
814
+ },
815
+ __wbg_size_e05d31cc6049815f: function(arg0) {
816
+ const ret = arg0.size;
817
+ return ret;
818
+ },
819
+ __wbg_slice_a4d15492574b99a1: function() { return handleError(function (arg0, arg1, arg2) {
820
+ const ret = arg0.slice(arg1, arg2);
821
+ return ret;
822
+ }, arguments); },
823
+ __wbg_stack_0ed75d68575b0f3c: function(arg0, arg1) {
824
+ const ret = arg1.stack;
825
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
826
+ const len1 = WASM_VECTOR_LEN;
827
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
828
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
829
+ },
830
+ __wbg_static_accessor_GLOBAL_12837167ad935116: function() {
831
+ const ret = typeof global === 'undefined' ? null : global;
832
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
833
+ },
834
+ __wbg_static_accessor_GLOBAL_THIS_e628e89ab3b1c95f: function() {
835
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
836
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
837
+ },
838
+ __wbg_static_accessor_SELF_a621d3dfbb60d0ce: function() {
839
+ const ret = typeof self === 'undefined' ? null : self;
840
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
841
+ },
842
+ __wbg_static_accessor_WINDOW_f8727f0cf888e0bd: function() {
843
+ const ret = typeof window === 'undefined' ? null : window;
844
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
845
+ },
846
+ __wbg_status_89d7e803db911ee7: function(arg0) {
847
+ const ret = arg0.status;
848
+ return ret;
849
+ },
850
+ __wbg_stringify_8d1cc6ff383e8bae: function() { return handleError(function (arg0) {
851
+ const ret = JSON.stringify(arg0);
852
+ return ret;
853
+ }, arguments); },
854
+ __wbg_subarray_a96e1fef17ed23cb: function(arg0, arg1, arg2) {
855
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
856
+ return ret;
857
+ },
858
+ __wbg_then_0d9fe2c7b1857d32: function(arg0, arg1, arg2) {
859
+ const ret = arg0.then(arg1, arg2);
860
+ return ret;
861
+ },
862
+ __wbg_then_b9e7b3b5f1a9e1b5: function(arg0, arg1) {
863
+ const ret = arg0.then(arg1);
864
+ return ret;
865
+ },
866
+ __wbg_url_c484c26b1fbf5126: function(arg0, arg1) {
867
+ const ret = arg1.url;
868
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
869
+ const len1 = WASM_VECTOR_LEN;
870
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
871
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
872
+ },
873
+ __wbg_valueOf_670bef5709ccda33: function(arg0) {
874
+ const ret = arg0.valueOf();
875
+ return ret;
876
+ },
877
+ __wbg_value_0546255b415e96c1: function(arg0) {
878
+ const ret = arg0.value;
879
+ return ret;
880
+ },
881
+ __wbg_versions_4e31226f5e8dc909: function(arg0) {
882
+ const ret = arg0.versions;
883
+ return ret;
884
+ },
885
+ __wbg_wasmreader_new: function(arg0) {
886
+ const ret = WasmReader.__wrap(arg0);
887
+ return ret;
888
+ },
889
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
890
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 1346, function: Function { arguments: [], shim_idx: 1347, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
891
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h6c572eed28725b35, wasm_bindgen__convert__closures_____invoke__h6d7af91d7cf01ed3);
892
+ return ret;
893
+ },
894
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
895
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 1349, function: Function { arguments: [Externref], shim_idx: 1350, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
896
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hdc14e87eb7e60d10, wasm_bindgen__convert__closures_____invoke__ha319c5c448ef8efe);
897
+ return ret;
898
+ },
899
+ __wbindgen_cast_0000000000000003: function(arg0) {
900
+ // Cast intrinsic for `F64 -> Externref`.
901
+ const ret = arg0;
902
+ return ret;
903
+ },
904
+ __wbindgen_cast_0000000000000004: function(arg0) {
905
+ // Cast intrinsic for `I64 -> Externref`.
906
+ const ret = arg0;
907
+ return ret;
908
+ },
909
+ __wbindgen_cast_0000000000000005: function(arg0, arg1) {
910
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
911
+ const ret = getArrayU8FromWasm0(arg0, arg1);
912
+ return ret;
913
+ },
914
+ __wbindgen_cast_0000000000000006: function(arg0, arg1) {
915
+ // Cast intrinsic for `Ref(String) -> Externref`.
916
+ const ret = getStringFromWasm0(arg0, arg1);
917
+ return ret;
918
+ },
919
+ __wbindgen_cast_0000000000000007: function(arg0) {
920
+ // Cast intrinsic for `U64 -> Externref`.
921
+ const ret = BigInt.asUintN(64, arg0);
922
+ return ret;
923
+ },
924
+ __wbindgen_cast_0000000000000008: function(arg0, arg1) {
925
+ var v0 = getArrayU8FromWasm0(arg0, arg1).slice();
926
+ wasm.__wbindgen_free(arg0, arg1 * 1, 1);
927
+ // Cast intrinsic for `Vector(U8) -> Externref`.
928
+ const ret = v0;
929
+ return ret;
930
+ },
931
+ __wbindgen_init_externref_table: function() {
932
+ const table = wasm.__wbindgen_externrefs;
933
+ const offset = table.grow(4);
934
+ table.set(0, undefined);
935
+ table.set(offset + 0, undefined);
936
+ table.set(offset + 1, null);
937
+ table.set(offset + 2, true);
938
+ table.set(offset + 3, false);
939
+ },
940
+ };
941
+ return {
942
+ __proto__: null,
943
+ "./c2pa_bg.js": import0,
944
+ };
945
+ }
668
946
 
669
- if (instance instanceof WebAssembly.Instance) {
670
- return { instance, module };
947
+ function wasm_bindgen__convert__closures_____invoke__h6d7af91d7cf01ed3(arg0, arg1) {
948
+ wasm.wasm_bindgen__convert__closures_____invoke__h6d7af91d7cf01ed3(arg0, arg1);
949
+ }
950
+
951
+ function wasm_bindgen__convert__closures_____invoke__ha319c5c448ef8efe(arg0, arg1, arg2) {
952
+ wasm.wasm_bindgen__convert__closures_____invoke__ha319c5c448ef8efe(arg0, arg1, arg2);
953
+ }
954
+
955
+ function wasm_bindgen__convert__closures_____invoke__h1ab8f2c4d39167e4(arg0, arg1, arg2, arg3) {
956
+ wasm.wasm_bindgen__convert__closures_____invoke__h1ab8f2c4d39167e4(arg0, arg1, arg2, arg3);
957
+ }
958
+
959
+
960
+ const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
961
+
962
+
963
+ const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
964
+
965
+
966
+ const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
967
+ const WasmBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
968
+ ? { register: () => {}, unregister: () => {} }
969
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmbuilder_free(ptr >>> 0, 1));
970
+ const WasmReaderFinalization = (typeof FinalizationRegistry === 'undefined')
971
+ ? { register: () => {}, unregister: () => {} }
972
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmreader_free(ptr >>> 0, 1));
973
+ const WasmSignerFinalization = (typeof FinalizationRegistry === 'undefined')
974
+ ? { register: () => {}, unregister: () => {} }
975
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmsigner_free(ptr >>> 0, 1));
976
+
977
+ function addToExternrefTable0(obj) {
978
+ const idx = wasm.__externref_table_alloc();
979
+ wasm.__wbindgen_externrefs.set(idx, obj);
980
+ return idx;
981
+ }
982
+
983
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
984
+ ? { register: () => {}, unregister: () => {} }
985
+ : new FinalizationRegistry(state => state.dtor(state.a, state.b));
986
+
987
+ function debugString(val) {
988
+ // primitive types
989
+ const type = typeof val;
990
+ if (type == 'number' || type == 'boolean' || val == null) {
991
+ return `${val}`;
992
+ }
993
+ if (type == 'string') {
994
+ return `"${val}"`;
995
+ }
996
+ if (type == 'symbol') {
997
+ const description = val.description;
998
+ if (description == null) {
999
+ return 'Symbol';
671
1000
  } else {
672
- return instance;
1001
+ return `Symbol(${description})`;
673
1002
  }
674
1003
  }
675
- }
676
-
677
- function __wbg_get_imports() {
678
- const imports = {};
679
- imports.wbg = {};
680
- imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
681
- const ret = Error(getStringFromWasm0(arg0, arg1));
682
- return ret;
683
- };
684
- imports.wbg.__wbg_Number_2d1dcfcf4ec51736 = function(arg0) {
685
- const ret = Number(arg0);
686
- return ret;
687
- };
688
- imports.wbg.__wbg___wbindgen_bigint_get_as_i64_6e32f5e6aff02e1d = function(arg0, arg1) {
689
- const v = arg1;
690
- const ret = typeof(v) === 'bigint' ? v : undefined;
691
- getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
692
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
693
- };
694
- imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
695
- const v = arg0;
696
- const ret = typeof(v) === 'boolean' ? v : undefined;
697
- return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
698
- };
699
- imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
700
- const ret = debugString(arg1);
701
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
702
- const len1 = WASM_VECTOR_LEN;
703
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
704
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
705
- };
706
- imports.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) {
707
- const ret = arg0 in arg1;
708
- return ret;
709
- };
710
- imports.wbg.__wbg___wbindgen_is_bigint_0e1a2e3f55cfae27 = function(arg0) {
711
- const ret = typeof(arg0) === 'bigint';
712
- return ret;
713
- };
714
- imports.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
715
- const ret = typeof(arg0) === 'function';
716
- return ret;
717
- };
718
- imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
719
- const val = arg0;
720
- const ret = typeof(val) === 'object' && val !== null;
721
- return ret;
722
- };
723
- imports.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030 = function(arg0) {
724
- const ret = typeof(arg0) === 'string';
725
- return ret;
726
- };
727
- imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
728
- const ret = arg0 === undefined;
729
- return ret;
730
- };
731
- imports.wbg.__wbg___wbindgen_jsval_eq_b6101cc9cef1fe36 = function(arg0, arg1) {
732
- const ret = arg0 === arg1;
733
- return ret;
734
- };
735
- imports.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) {
736
- const ret = arg0 == arg1;
737
- return ret;
738
- };
739
- imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
740
- const obj = arg1;
741
- const ret = typeof(obj) === 'number' ? obj : undefined;
742
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
743
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
744
- };
745
- imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
746
- const obj = arg1;
747
- const ret = typeof(obj) === 'string' ? obj : undefined;
748
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
749
- var len1 = WASM_VECTOR_LEN;
750
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
751
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
752
- };
753
- imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
754
- throw new Error(getStringFromWasm0(arg0, arg1));
755
- };
756
- imports.wbg.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7 = function(arg0) {
757
- arg0._wbg_cb_unref();
758
- };
759
- imports.wbg.__wbg_abort_07646c894ebbf2bd = function(arg0) {
760
- arg0.abort();
761
- };
762
- imports.wbg.__wbg_abort_399ecbcfd6ef3c8e = function(arg0, arg1) {
763
- arg0.abort(arg1);
764
- };
765
- imports.wbg.__wbg_append_c5cbdf46455cc776 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
766
- arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
767
- }, arguments) };
768
- imports.wbg.__wbg_arrayBuffer_c04af4fce566092d = function() { return handleError(function (arg0) {
769
- const ret = arg0.arrayBuffer();
770
- return ret;
771
- }, arguments) };
772
- imports.wbg.__wbg_byteLength_faa9938885bdeee6 = function(arg0) {
773
- const ret = arg0.byteLength;
774
- return ret;
775
- };
776
- imports.wbg.__wbg_call_3020136f7a2d6e44 = function() { return handleError(function (arg0, arg1, arg2) {
777
- const ret = arg0.call(arg1, arg2);
778
- return ret;
779
- }, arguments) };
780
- imports.wbg.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) {
781
- const ret = arg0.call(arg1);
782
- return ret;
783
- }, arguments) };
784
- imports.wbg.__wbg_clearTimeout_7a42b49784aea641 = function(arg0) {
785
- const ret = clearTimeout(arg0);
786
- return ret;
787
- };
788
- imports.wbg.__wbg_crypto_574e78ad8b13b65f = function(arg0) {
789
- const ret = arg0.crypto;
790
- return ret;
791
- };
792
- imports.wbg.__wbg_done_62ea16af4ce34b24 = function(arg0) {
793
- const ret = arg0.done;
794
- return ret;
795
- };
796
- imports.wbg.__wbg_entries_83c79938054e065f = function(arg0) {
797
- const ret = Object.entries(arg0);
798
- return ret;
799
- };
800
- imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
801
- let deferred0_0;
802
- let deferred0_1;
803
- try {
804
- deferred0_0 = arg0;
805
- deferred0_1 = arg1;
806
- console.error(getStringFromWasm0(arg0, arg1));
807
- } finally {
808
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
1004
+ if (type == 'function') {
1005
+ const name = val.name;
1006
+ if (typeof name == 'string' && name.length > 0) {
1007
+ return `Function(${name})`;
1008
+ } else {
1009
+ return 'Function';
809
1010
  }
810
- };
811
- imports.wbg.__wbg_fetch_74a3e84ebd2c9a0e = function(arg0) {
812
- const ret = fetch(arg0);
813
- return ret;
814
- };
815
- imports.wbg.__wbg_fetch_90447c28cc0b095e = function(arg0, arg1) {
816
- const ret = arg0.fetch(arg1);
817
- return ret;
818
- };
819
- imports.wbg.__wbg_from_29a8414a7a7cd19d = function(arg0) {
820
- const ret = Array.from(arg0);
821
- return ret;
822
- };
823
- imports.wbg.__wbg_getRandomValues_1c61fac11405ffdc = function() { return handleError(function (arg0, arg1) {
824
- globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
825
- }, arguments) };
826
- imports.wbg.__wbg_getRandomValues_38a1ff1ea09f6cc7 = function() { return handleError(function (arg0, arg1) {
827
- globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
828
- }, arguments) };
829
- imports.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() { return handleError(function (arg0, arg1) {
830
- arg0.getRandomValues(arg1);
831
- }, arguments) };
832
- imports.wbg.__wbg_getTime_ad1e9878a735af08 = function(arg0) {
833
- const ret = arg0.getTime();
834
- return ret;
835
- };
836
- imports.wbg.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
837
- const ret = arg0[arg1 >>> 0];
838
- return ret;
839
- };
840
- imports.wbg.__wbg_get_af9dab7e9603ea93 = function() { return handleError(function (arg0, arg1) {
841
- const ret = Reflect.get(arg0, arg1);
842
- return ret;
843
- }, arguments) };
844
- imports.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
845
- const ret = arg0[arg1];
846
- return ret;
847
- };
848
- imports.wbg.__wbg_has_0e670569d65d3a45 = function() { return handleError(function (arg0, arg1) {
849
- const ret = Reflect.has(arg0, arg1);
850
- return ret;
851
- }, arguments) };
852
- imports.wbg.__wbg_headers_654c30e1bcccc552 = function(arg0) {
853
- const ret = arg0.headers;
854
- return ret;
855
- };
856
- imports.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) {
857
- let result;
858
- try {
859
- result = arg0 instanceof ArrayBuffer;
860
- } catch (_) {
861
- result = false;
1011
+ }
1012
+ // objects
1013
+ if (Array.isArray(val)) {
1014
+ const length = val.length;
1015
+ let debug = '[';
1016
+ if (length > 0) {
1017
+ debug += debugString(val[0]);
862
1018
  }
863
- const ret = result;
864
- return ret;
865
- };
866
- imports.wbg.__wbg_instanceof_Map_084be8da74364158 = function(arg0) {
867
- let result;
868
- try {
869
- result = arg0 instanceof Map;
870
- } catch (_) {
871
- result = false;
1019
+ for(let i = 1; i < length; i++) {
1020
+ debug += ', ' + debugString(val[i]);
872
1021
  }
873
- const ret = result;
874
- return ret;
875
- };
876
- imports.wbg.__wbg_instanceof_Promise_eca6c43a2610558d = function(arg0) {
877
- let result;
1022
+ debug += ']';
1023
+ return debug;
1024
+ }
1025
+ // Test for built-in
1026
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
1027
+ let className;
1028
+ if (builtInMatches && builtInMatches.length > 1) {
1029
+ className = builtInMatches[1];
1030
+ } else {
1031
+ // Failed to match the standard '[object ClassName]'
1032
+ return toString.call(val);
1033
+ }
1034
+ if (className == 'Object') {
1035
+ // we're a user defined class or Object
1036
+ // JSON.stringify avoids problems with cycles, and is generally much
1037
+ // easier than looping through ownProperties of `val`.
878
1038
  try {
879
- result = arg0 instanceof Promise;
1039
+ return 'Object(' + JSON.stringify(val) + ')';
880
1040
  } catch (_) {
881
- result = false;
1041
+ return 'Object';
882
1042
  }
883
- const ret = result;
884
- return ret;
885
- };
886
- imports.wbg.__wbg_instanceof_Response_cd74d1c2ac92cb0b = function(arg0) {
887
- let result;
1043
+ }
1044
+ // errors
1045
+ if (val instanceof Error) {
1046
+ return `${val.name}: ${val.message}\n${val.stack}`;
1047
+ }
1048
+ // TODO we could test for more things here, like `Set`s and `Map`s.
1049
+ return className;
1050
+ }
1051
+
1052
+ function getArrayU8FromWasm0(ptr, len) {
1053
+ ptr = ptr >>> 0;
1054
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1055
+ }
1056
+
1057
+ let cachedDataViewMemory0 = null;
1058
+ function getDataViewMemory0() {
1059
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1060
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1061
+ }
1062
+ return cachedDataViewMemory0;
1063
+ }
1064
+
1065
+ function getStringFromWasm0(ptr, len) {
1066
+ ptr = ptr >>> 0;
1067
+ return decodeText(ptr, len);
1068
+ }
1069
+
1070
+ let cachedUint8ArrayMemory0 = null;
1071
+ function getUint8ArrayMemory0() {
1072
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1073
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1074
+ }
1075
+ return cachedUint8ArrayMemory0;
1076
+ }
1077
+
1078
+ function handleError(f, args) {
1079
+ try {
1080
+ return f.apply(this, args);
1081
+ } catch (e) {
1082
+ const idx = addToExternrefTable0(e);
1083
+ wasm.__wbindgen_exn_store(idx);
1084
+ }
1085
+ }
1086
+
1087
+ function isLikeNone(x) {
1088
+ return x === undefined || x === null;
1089
+ }
1090
+
1091
+ function makeMutClosure(arg0, arg1, dtor, f) {
1092
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
1093
+ const real = (...args) => {
1094
+
1095
+ // First up with a closure we increment the internal reference
1096
+ // count. This ensures that the Rust closure environment won't
1097
+ // be deallocated while we're invoking it.
1098
+ state.cnt++;
1099
+ const a = state.a;
1100
+ state.a = 0;
888
1101
  try {
889
- result = arg0 instanceof Response;
890
- } catch (_) {
891
- result = false;
1102
+ return f(a, state.b, ...args);
1103
+ } finally {
1104
+ state.a = a;
1105
+ real._wbg_cb_unref();
892
1106
  }
893
- const ret = result;
894
- return ret;
895
1107
  };
896
- imports.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) {
897
- let result;
898
- try {
899
- result = arg0 instanceof Uint8Array;
900
- } catch (_) {
901
- result = false;
1108
+ real._wbg_cb_unref = () => {
1109
+ if (--state.cnt === 0) {
1110
+ state.dtor(state.a, state.b);
1111
+ state.a = 0;
1112
+ CLOSURE_DTORS.unregister(state);
902
1113
  }
903
- const ret = result;
904
- return ret;
905
- };
906
- imports.wbg.__wbg_isArray_51fd9e6422c0a395 = function(arg0) {
907
- const ret = Array.isArray(arg0);
908
- return ret;
909
- };
910
- imports.wbg.__wbg_isSafeInteger_ae7d3f054d55fa16 = function(arg0) {
911
- const ret = Number.isSafeInteger(arg0);
912
- return ret;
913
- };
914
- imports.wbg.__wbg_iterator_27b7c8b35ab3e86b = function() {
915
- const ret = Symbol.iterator;
916
- return ret;
917
- };
918
- imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {
919
- const ret = arg0.length;
920
- return ret;
921
- };
922
- imports.wbg.__wbg_length_d45040a40c570362 = function(arg0) {
923
- const ret = arg0.length;
924
- return ret;
925
- };
926
- imports.wbg.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
927
- const ret = arg0.msCrypto;
928
- return ret;
929
- };
930
- imports.wbg.__wbg_new_0_23cedd11d9b40c9d = function() {
931
- const ret = new Date();
932
- return ret;
933
- };
934
- imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
935
- const ret = new Object();
936
- return ret;
937
- };
938
- imports.wbg.__wbg_new_25f239778d6112b9 = function() {
939
- const ret = new Array();
940
- return ret;
941
- };
942
- imports.wbg.__wbg_new_3c79b3bb1b32b7d3 = function() { return handleError(function () {
943
- const ret = new Headers();
944
- return ret;
945
- }, arguments) };
946
- imports.wbg.__wbg_new_6421f6084cc5bc5a = function(arg0) {
947
- const ret = new Uint8Array(arg0);
948
- return ret;
949
- };
950
- imports.wbg.__wbg_new_881a222c65f168fc = function() { return handleError(function () {
951
- const ret = new AbortController();
952
- return ret;
953
- }, arguments) };
954
- imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
955
- const ret = new Error();
956
- return ret;
957
- };
958
- imports.wbg.__wbg_new_b546ae120718850e = function() {
959
- const ret = new Map();
960
- return ret;
961
- };
962
- imports.wbg.__wbg_new_bd4ee84941f474fa = function() { return handleError(function () {
963
- const ret = new FileReaderSync();
964
- return ret;
965
- }, arguments) };
966
- imports.wbg.__wbg_new_df1173567d5ff028 = function(arg0, arg1) {
967
- const ret = new Error(getStringFromWasm0(arg0, arg1));
968
- return ret;
969
1114
  };
970
- imports.wbg.__wbg_new_ff12d2b041fb48f1 = function(arg0, arg1) {
971
- try {
972
- var state0 = {a: arg0, b: arg1};
973
- var cb0 = (arg0, arg1) => {
974
- const a = state0.a;
975
- state0.a = 0;
976
- try {
977
- return wasm_bindgen__convert__closures_____invoke__h536d005b97d28fdb(a, state0.b, arg0, arg1);
978
- } finally {
979
- state0.a = a;
980
- }
981
- };
982
- const ret = new Promise(cb0);
983
- return ret;
984
- } finally {
985
- state0.a = state0.b = 0;
1115
+ CLOSURE_DTORS.register(real, state, state);
1116
+ return real;
1117
+ }
1118
+
1119
+ function passStringToWasm0(arg, malloc, realloc) {
1120
+ if (realloc === undefined) {
1121
+ const buf = cachedTextEncoder.encode(arg);
1122
+ const ptr = malloc(buf.length, 1) >>> 0;
1123
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1124
+ WASM_VECTOR_LEN = buf.length;
1125
+ return ptr;
1126
+ }
1127
+
1128
+ let len = arg.length;
1129
+ let ptr = malloc(len, 1) >>> 0;
1130
+
1131
+ const mem = getUint8ArrayMemory0();
1132
+
1133
+ let offset = 0;
1134
+
1135
+ for (; offset < len; offset++) {
1136
+ const code = arg.charCodeAt(offset);
1137
+ if (code > 0x7F) break;
1138
+ mem[ptr + offset] = code;
1139
+ }
1140
+ if (offset !== len) {
1141
+ if (offset !== 0) {
1142
+ arg = arg.slice(offset);
986
1143
  }
987
- };
988
- imports.wbg.__wbg_new_from_slice_f9c22b9153b26992 = function(arg0, arg1) {
989
- const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
990
- return ret;
991
- };
992
- imports.wbg.__wbg_new_no_args_cb138f77cf6151ee = function(arg0, arg1) {
993
- const ret = new Function(getStringFromWasm0(arg0, arg1));
994
- return ret;
995
- };
996
- imports.wbg.__wbg_new_with_length_aa5eaf41d35235e5 = function(arg0) {
997
- const ret = new Uint8Array(arg0 >>> 0);
998
- return ret;
999
- };
1000
- imports.wbg.__wbg_new_with_str_and_init_c5748f76f5108934 = function() { return handleError(function (arg0, arg1, arg2) {
1001
- const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
1002
- return ret;
1003
- }, arguments) };
1004
- imports.wbg.__wbg_next_138a17bbf04e926c = function(arg0) {
1005
- const ret = arg0.next;
1006
- return ret;
1007
- };
1008
- imports.wbg.__wbg_next_3cfe5c0fe2a4cc53 = function() { return handleError(function (arg0) {
1009
- const ret = arg0.next();
1010
- return ret;
1011
- }, arguments) };
1012
- imports.wbg.__wbg_node_905d3e251edff8a2 = function(arg0) {
1013
- const ret = arg0.node;
1014
- return ret;
1015
- };
1016
- imports.wbg.__wbg_now_69d776cd24f5215b = function() {
1017
- const ret = Date.now();
1018
- return ret;
1019
- };
1020
- imports.wbg.__wbg_process_dc0fbacc7c1c06f7 = function(arg0) {
1021
- const ret = arg0.process;
1022
- return ret;
1023
- };
1024
- imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
1025
- Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1026
- };
1027
- imports.wbg.__wbg_queueMicrotask_9b549dfce8865860 = function(arg0) {
1028
- const ret = arg0.queueMicrotask;
1029
- return ret;
1030
- };
1031
- imports.wbg.__wbg_queueMicrotask_fca69f5bfad613a5 = function(arg0) {
1032
- queueMicrotask(arg0);
1033
- };
1034
- imports.wbg.__wbg_randomFillSync_ac0988aba3254290 = function() { return handleError(function (arg0, arg1) {
1035
- arg0.randomFillSync(arg1);
1036
- }, arguments) };
1037
- imports.wbg.__wbg_readAsArrayBuffer_5a7ad12aa99daa2f = function() { return handleError(function (arg0, arg1) {
1038
- const ret = arg0.readAsArrayBuffer(arg1);
1039
- return ret;
1040
- }, arguments) };
1041
- imports.wbg.__wbg_require_60cc747a6bc5215a = function() { return handleError(function () {
1042
- const ret = module.require;
1043
- return ret;
1044
- }, arguments) };
1045
- imports.wbg.__wbg_resolve_fd5bfbaa4ce36e1e = function(arg0) {
1046
- const ret = Promise.resolve(arg0);
1047
- return ret;
1048
- };
1049
- imports.wbg.__wbg_setTimeout_7bb3429662ab1e70 = function(arg0, arg1) {
1050
- const ret = setTimeout(arg0, arg1);
1051
- return ret;
1052
- };
1053
- imports.wbg.__wbg_set_169e13b608078b7b = function(arg0, arg1, arg2) {
1054
- arg0.set(getArrayU8FromWasm0(arg1, arg2));
1055
- };
1056
- imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
1057
- arg0[arg1] = arg2;
1058
- };
1059
- imports.wbg.__wbg_set_7df433eea03a5c14 = function(arg0, arg1, arg2) {
1060
- arg0[arg1 >>> 0] = arg2;
1061
- };
1062
- imports.wbg.__wbg_set_body_8e743242d6076a4f = function(arg0, arg1) {
1063
- arg0.body = arg1;
1064
- };
1065
- imports.wbg.__wbg_set_cache_0e437c7c8e838b9b = function(arg0, arg1) {
1066
- arg0.cache = __wbindgen_enum_RequestCache[arg1];
1067
- };
1068
- imports.wbg.__wbg_set_credentials_55ae7c3c106fd5be = function(arg0, arg1) {
1069
- arg0.credentials = __wbindgen_enum_RequestCredentials[arg1];
1070
- };
1071
- imports.wbg.__wbg_set_efaaf145b9377369 = function(arg0, arg1, arg2) {
1072
- const ret = arg0.set(arg1, arg2);
1073
- return ret;
1074
- };
1075
- imports.wbg.__wbg_set_headers_5671cf088e114d2b = function(arg0, arg1) {
1076
- arg0.headers = arg1;
1077
- };
1078
- imports.wbg.__wbg_set_method_76c69e41b3570627 = function(arg0, arg1, arg2) {
1079
- arg0.method = getStringFromWasm0(arg1, arg2);
1080
- };
1081
- imports.wbg.__wbg_set_mode_611016a6818fc690 = function(arg0, arg1) {
1082
- arg0.mode = __wbindgen_enum_RequestMode[arg1];
1083
- };
1084
- imports.wbg.__wbg_set_signal_e89be862d0091009 = function(arg0, arg1) {
1085
- arg0.signal = arg1;
1086
- };
1087
- imports.wbg.__wbg_signal_3c14fbdc89694b39 = function(arg0) {
1088
- const ret = arg0.signal;
1089
- return ret;
1090
- };
1091
- imports.wbg.__wbg_size_82fbdb656de23326 = function(arg0) {
1092
- const ret = arg0.size;
1093
- return ret;
1094
- };
1095
- imports.wbg.__wbg_slice_3518c924243cda3a = function() { return handleError(function (arg0, arg1, arg2) {
1096
- const ret = arg0.slice(arg1, arg2);
1097
- return ret;
1098
- }, arguments) };
1099
- imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
1100
- const ret = arg1.stack;
1101
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1102
- const len1 = WASM_VECTOR_LEN;
1103
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1104
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1105
- };
1106
- imports.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335 = function() {
1107
- const ret = typeof global === 'undefined' ? null : global;
1108
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1109
- };
1110
- imports.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1 = function() {
1111
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
1112
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1113
- };
1114
- imports.wbg.__wbg_static_accessor_SELF_08f5a74c69739274 = function() {
1115
- const ret = typeof self === 'undefined' ? null : self;
1116
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1117
- };
1118
- imports.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024 = function() {
1119
- const ret = typeof window === 'undefined' ? null : window;
1120
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1121
- };
1122
- imports.wbg.__wbg_status_9bfc680efca4bdfd = function(arg0) {
1123
- const ret = arg0.status;
1124
- return ret;
1125
- };
1126
- imports.wbg.__wbg_stringify_655a6390e1f5eb6b = function() { return handleError(function (arg0) {
1127
- const ret = JSON.stringify(arg0);
1128
- return ret;
1129
- }, arguments) };
1130
- imports.wbg.__wbg_subarray_845f2f5bce7d061a = function(arg0, arg1, arg2) {
1131
- const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
1132
- return ret;
1133
- };
1134
- imports.wbg.__wbg_then_429f7caf1026411d = function(arg0, arg1, arg2) {
1135
- const ret = arg0.then(arg1, arg2);
1136
- return ret;
1137
- };
1138
- imports.wbg.__wbg_then_4f95312d68691235 = function(arg0, arg1) {
1139
- const ret = arg0.then(arg1);
1140
- return ret;
1141
- };
1142
- imports.wbg.__wbg_url_b6d11838a4f95198 = function(arg0, arg1) {
1143
- const ret = arg1.url;
1144
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1145
- const len1 = WASM_VECTOR_LEN;
1146
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1147
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1148
- };
1149
- imports.wbg.__wbg_valueOf_17c63ed1b225597a = function(arg0) {
1150
- const ret = arg0.valueOf();
1151
- return ret;
1152
- };
1153
- imports.wbg.__wbg_value_57b7b035e117f7ee = function(arg0) {
1154
- const ret = arg0.value;
1155
- return ret;
1156
- };
1157
- imports.wbg.__wbg_versions_c01dfd4722a88165 = function(arg0) {
1158
- const ret = arg0.versions;
1159
- return ret;
1160
- };
1161
- imports.wbg.__wbg_wasmreader_new = function(arg0) {
1162
- const ret = WasmReader.__wrap(arg0);
1163
- return ret;
1164
- };
1165
- imports.wbg.__wbindgen_cast_0bcf4d5a20a2764c = function(arg0, arg1) {
1166
- // Cast intrinsic for `Closure(Closure { dtor_idx: 1300, function: Function { arguments: [], shim_idx: 1301, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1167
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h9cd45bdf09c25ec5, wasm_bindgen__convert__closures_____invoke__h6743aa07e10cb0d4);
1168
- return ret;
1169
- };
1170
- imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
1171
- // Cast intrinsic for `Ref(String) -> Externref`.
1172
- const ret = getStringFromWasm0(arg0, arg1);
1173
- return ret;
1174
- };
1175
- imports.wbg.__wbindgen_cast_2ddd8a25ff58642a = function(arg0, arg1) {
1176
- // Cast intrinsic for `I128 -> Externref`.
1177
- const ret = (BigInt.asUintN(64, arg0) | (arg1 << BigInt(64)));
1178
- return ret;
1179
- };
1180
- imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
1181
- // Cast intrinsic for `U64 -> Externref`.
1182
- const ret = BigInt.asUintN(64, arg0);
1183
- return ret;
1184
- };
1185
- imports.wbg.__wbindgen_cast_77bc3e92745e9a35 = function(arg0, arg1) {
1186
- var v0 = getArrayU8FromWasm0(arg0, arg1).slice();
1187
- wasm.__wbindgen_free(arg0, arg1 * 1, 1);
1188
- // Cast intrinsic for `Vector(U8) -> Externref`.
1189
- const ret = v0;
1190
- return ret;
1191
- };
1192
- imports.wbg.__wbindgen_cast_815cc8b6fd6cc840 = function(arg0, arg1) {
1193
- // Cast intrinsic for `Closure(Closure { dtor_idx: 1303, function: Function { arguments: [Externref], shim_idx: 1304, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1194
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h628fe959fcf32094, wasm_bindgen__convert__closures_____invoke__hfa979f81ae70afaa);
1195
- return ret;
1196
- };
1197
- imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
1198
- // Cast intrinsic for `I64 -> Externref`.
1199
- const ret = arg0;
1200
- return ret;
1201
- };
1202
- imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
1203
- // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
1204
- const ret = getArrayU8FromWasm0(arg0, arg1);
1205
- return ret;
1206
- };
1207
- imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
1208
- // Cast intrinsic for `F64 -> Externref`.
1209
- const ret = arg0;
1210
- return ret;
1211
- };
1212
- imports.wbg.__wbindgen_init_externref_table = function() {
1213
- const table = wasm.__wbindgen_externrefs;
1214
- const offset = table.grow(4);
1215
- table.set(0, undefined);
1216
- table.set(offset + 0, undefined);
1217
- table.set(offset + 1, null);
1218
- table.set(offset + 2, true);
1219
- table.set(offset + 3, false);
1220
- };
1144
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1145
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1146
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1147
+
1148
+ offset += ret.written;
1149
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1150
+ }
1151
+
1152
+ WASM_VECTOR_LEN = offset;
1153
+ return ptr;
1154
+ }
1221
1155
 
1222
- return imports;
1156
+ function takeFromExternrefTable0(idx) {
1157
+ const value = wasm.__wbindgen_externrefs.get(idx);
1158
+ wasm.__externref_table_dealloc(idx);
1159
+ return value;
1160
+ }
1161
+
1162
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1163
+ cachedTextDecoder.decode();
1164
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1165
+ let numBytesDecoded = 0;
1166
+ function decodeText(ptr, len) {
1167
+ numBytesDecoded += len;
1168
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1169
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1170
+ cachedTextDecoder.decode();
1171
+ numBytesDecoded = len;
1172
+ }
1173
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1174
+ }
1175
+
1176
+ const cachedTextEncoder = new TextEncoder();
1177
+
1178
+ if (!('encodeInto' in cachedTextEncoder)) {
1179
+ cachedTextEncoder.encodeInto = function (arg, view) {
1180
+ const buf = cachedTextEncoder.encode(arg);
1181
+ view.set(buf);
1182
+ return {
1183
+ read: arg.length,
1184
+ written: buf.length
1185
+ };
1186
+ };
1223
1187
  }
1224
1188
 
1189
+ let WASM_VECTOR_LEN = 0;
1190
+
1191
+ let wasmModule, wasm;
1225
1192
  function __wbg_finalize_init(instance, module) {
1226
1193
  wasm = instance.exports;
1227
- __wbg_init.__wbindgen_wasm_module = module;
1194
+ wasmModule = module;
1228
1195
  cachedDataViewMemory0 = null;
1229
1196
  cachedUint8ArrayMemory0 = null;
1230
-
1231
-
1232
1197
  wasm.__wbindgen_start();
1233
1198
  return wasm;
1234
1199
  }
1235
1200
 
1201
+ async function __wbg_load(module, imports) {
1202
+ if (typeof Response === 'function' && module instanceof Response) {
1203
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
1204
+ try {
1205
+ return await WebAssembly.instantiateStreaming(module, imports);
1206
+ } catch (e) {
1207
+ const validResponse = module.ok && expectedResponseType(module.type);
1208
+
1209
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1210
+ 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);
1211
+
1212
+ } else { throw e; }
1213
+ }
1214
+ }
1215
+
1216
+ const bytes = await module.arrayBuffer();
1217
+ return await WebAssembly.instantiate(bytes, imports);
1218
+ } else {
1219
+ const instance = await WebAssembly.instantiate(module, imports);
1220
+
1221
+ if (instance instanceof WebAssembly.Instance) {
1222
+ return { instance, module };
1223
+ } else {
1224
+ return instance;
1225
+ }
1226
+ }
1227
+
1228
+ function expectedResponseType(type) {
1229
+ switch (type) {
1230
+ case 'basic': case 'cors': case 'default': return true;
1231
+ }
1232
+ return false;
1233
+ }
1234
+ }
1235
+
1236
1236
  function initSync(module) {
1237
1237
  if (wasm !== undefined) return wasm;
1238
1238
 
1239
1239
 
1240
- if (typeof module !== 'undefined') {
1240
+ if (module !== undefined) {
1241
1241
  if (Object.getPrototypeOf(module) === Object.prototype) {
1242
1242
  ({module} = module)
1243
1243
  } else {
@@ -1257,7 +1257,7 @@ async function __wbg_init(module_or_path) {
1257
1257
  if (wasm !== undefined) return wasm;
1258
1258
 
1259
1259
 
1260
- if (typeof module_or_path !== 'undefined') {
1260
+ if (module_or_path !== undefined) {
1261
1261
  if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1262
1262
  ({module_or_path} = module_or_path)
1263
1263
  } else {
@@ -1277,6 +1277,5 @@ async function __wbg_init(module_or_path) {
1277
1277
  return __wbg_finalize_init(instance, module);
1278
1278
  }
1279
1279
 
1280
- export { initSync };
1281
- export default __wbg_init;
1282
- export const WASM_SRI = "sha512-emM3xZBux5bBdEv6EFS+y5SmKnxnEVbNgsjbsOLnC/YYm55pviVrgdOxU8iQUisOISQvXrTj7H8vvsgYVlpeLg==";
1280
+ export { initSync, __wbg_init as default };
1281
+ export const WASM_SRI = "sha512-/BfYF29Di+PDrCOWfBXKdkAlYy5+vZbDIW0Z8+oeWW8DUm6mKN9XV030vz7HKDEQK6v6xzkiHrc+/pBf5lS1bA==";