@layers/amba-core 1.0.0 → 1.0.3

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.
@@ -0,0 +1,1542 @@
1
+ // ---- Hermes polyfills (injected by build-rn.mjs) ----
2
+ // Hermes lacks TextDecoder and globalThis.crypto. Without these, the
3
+ // wasm-bindgen glue throws at module-init. See DX-13 / DX-14.
4
+ (function() {
5
+ var g = typeof globalThis !== 'undefined' ? globalThis : (typeof global !== 'undefined' ? global : this);
6
+ if (typeof g.TextDecoder === 'undefined') {
7
+ g.TextDecoder = function TextDecoder(label, options) {
8
+ this.encoding = (label || 'utf-8').toLowerCase();
9
+ this.fatal = !!(options && options.fatal);
10
+ this.ignoreBOM = !!(options && options.ignoreBOM);
11
+ };
12
+ g.TextDecoder.prototype.decode = function decode(input) {
13
+ if (input === undefined) return '';
14
+ var bytes = input instanceof Uint8Array ? input : new Uint8Array(input.buffer || input);
15
+ var out = '';
16
+ var i = 0;
17
+ // WHATWG Encoding spec semantics:
18
+ // ignoreBOM: false (default) → strip the BOM from output
19
+ // ignoreBOM: true → preserve the BOM as a literal U+FEFF
20
+ // wasm-bindgen passes { ignoreBOM: true, fatal: true }, so BOM bytes
21
+ // must come through as U+FEFF. An inverted check silently drops 3
22
+ // bytes from any string that begins with a BOM — caught by the
23
+ // build-time self-test below.
24
+ if (!this.ignoreBOM && bytes.length >= 3 && bytes[0] === 0xEF && bytes[1] === 0xBB && bytes[2] === 0xBF) i = 3;
25
+ while (i < bytes.length) {
26
+ var b = bytes[i++];
27
+ if (b < 0x80) {
28
+ out += String.fromCharCode(b);
29
+ } else if (b < 0xC0) {
30
+ if (this.fatal) throw new TypeError('TextDecoder: invalid UTF-8 lead');
31
+ out += '\uFFFD';
32
+ } else if (b < 0xE0) {
33
+ out += String.fromCharCode(((b & 0x1F) << 6) | (bytes[i++] & 0x3F));
34
+ } else if (b < 0xF0) {
35
+ var c = ((b & 0x0F) << 12) | ((bytes[i++] & 0x3F) << 6) | (bytes[i++] & 0x3F);
36
+ out += String.fromCharCode(c);
37
+ } else {
38
+ var cp = ((b & 0x07) << 18) | ((bytes[i++] & 0x3F) << 12) | ((bytes[i++] & 0x3F) << 6) | (bytes[i++] & 0x3F);
39
+ cp -= 0x10000;
40
+ out += String.fromCharCode(0xD800 + (cp >> 10), 0xDC00 + (cp & 0x3FF));
41
+ }
42
+ }
43
+ return out;
44
+ };
45
+ }
46
+ if (typeof g.crypto === 'undefined' || typeof g.crypto.getRandomValues !== 'function') {
47
+ var warned = false;
48
+ g.crypto = g.crypto || {};
49
+ g.crypto.getRandomValues = function getRandomValues(arr) {
50
+ if (!warned) {
51
+ warned = true;
52
+ if (typeof console !== 'undefined' && console.warn) {
53
+ console.warn(
54
+ '[@layers/amba-core] Using Math.random fallback for crypto.getRandomValues — ' +
55
+ 'install `react-native-get-random-values` and import it before @layers/amba-react-native ' +
56
+ 'for cryptographically secure random bytes. See DX-13.'
57
+ );
58
+ }
59
+ }
60
+ for (var i = 0; i < arr.length; i++) arr[i] = (Math.random() * 256) | 0;
61
+ return arr;
62
+ };
63
+ }
64
+ })();
65
+ // ---- end Hermes polyfills ----
66
+
67
+ /**
68
+ * JS-callable opaque handle to [`AmbaCore`].
69
+ *
70
+ * The JS side instantiates it via `AmbaCoreWasm.init(configJson, fetchFn)`
71
+ * and stashes it for the lifetime of the page.
72
+ */
73
+ export class AmbaCoreWasm {
74
+ static __wrap(ptr) {
75
+ const obj = Object.create(AmbaCoreWasm.prototype);
76
+ obj.__wbg_ptr = ptr;
77
+ AmbaCoreWasmFinalization.register(obj, obj.__wbg_ptr, obj);
78
+ return obj;
79
+ }
80
+ __destroy_into_raw() {
81
+ const ptr = this.__wbg_ptr;
82
+ this.__wbg_ptr = 0;
83
+ AmbaCoreWasmFinalization.unregister(this);
84
+ return ptr;
85
+ }
86
+ free() {
87
+ const ptr = this.__destroy_into_raw();
88
+ wasm.__wbg_ambacorewasm_free(ptr, 0);
89
+ }
90
+ /**
91
+ * @returns {Promise<any>}
92
+ */
93
+ achievementsGetAll() {
94
+ const ret = wasm.ambacorewasm_achievementsGetAll(this.__wbg_ptr);
95
+ return takeObject(ret);
96
+ }
97
+ /**
98
+ * @returns {Promise<any>}
99
+ */
100
+ achievementsGetProgress() {
101
+ const ret = wasm.ambacorewasm_achievementsGetProgress(this.__wbg_ptr);
102
+ return takeObject(ret);
103
+ }
104
+ /**
105
+ * @param {string} request_json
106
+ * @returns {Promise<any>}
107
+ */
108
+ aiAnthropicMessages(request_json) {
109
+ const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
110
+ const len0 = WASM_VECTOR_LEN;
111
+ const ret = wasm.ambacorewasm_aiAnthropicMessages(this.__wbg_ptr, ptr0, len0);
112
+ return takeObject(ret);
113
+ }
114
+ /**
115
+ * @returns {string}
116
+ */
117
+ anonymousId() {
118
+ let deferred1_0;
119
+ let deferred1_1;
120
+ try {
121
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
122
+ wasm.ambacorewasm_anonymousId(retptr, this.__wbg_ptr);
123
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
124
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
125
+ deferred1_0 = r0;
126
+ deferred1_1 = r1;
127
+ return getStringFromWasm0(r0, r1);
128
+ } finally {
129
+ wasm.__wbindgen_add_to_stack_pointer(16);
130
+ wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
131
+ }
132
+ }
133
+ /**
134
+ * @returns {string | undefined}
135
+ */
136
+ appUserId() {
137
+ try {
138
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
139
+ wasm.ambacorewasm_appUserId(retptr, this.__wbg_ptr);
140
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
141
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
142
+ let v1;
143
+ if (r0 !== 0) {
144
+ v1 = getStringFromWasm0(r0, r1).slice();
145
+ wasm.__wbindgen_export5(r0, r1 * 1, 1);
146
+ }
147
+ return v1;
148
+ } finally {
149
+ wasm.__wbindgen_add_to_stack_pointer(16);
150
+ }
151
+ }
152
+ /**
153
+ * @returns {Promise<any>}
154
+ */
155
+ catalogList() {
156
+ const ret = wasm.ambacorewasm_catalogList(this.__wbg_ptr);
157
+ return takeObject(ret);
158
+ }
159
+ /**
160
+ * @param {string} id
161
+ * @returns {Promise<any>}
162
+ */
163
+ challengesClaim(id) {
164
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
165
+ const len0 = WASM_VECTOR_LEN;
166
+ const ret = wasm.ambacorewasm_challengesClaim(this.__wbg_ptr, ptr0, len0);
167
+ return takeObject(ret);
168
+ }
169
+ /**
170
+ * @param {string} id
171
+ * @returns {Promise<any>}
172
+ */
173
+ challengesGet(id) {
174
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
175
+ const len0 = WASM_VECTOR_LEN;
176
+ const ret = wasm.ambacorewasm_challengesGet(this.__wbg_ptr, ptr0, len0);
177
+ return takeObject(ret);
178
+ }
179
+ /**
180
+ * @returns {Promise<any>}
181
+ */
182
+ challengesGetActive() {
183
+ const ret = wasm.ambacorewasm_challengesGetActive(this.__wbg_ptr);
184
+ return takeObject(ret);
185
+ }
186
+ /**
187
+ * @param {string} id
188
+ * @returns {Promise<any>}
189
+ */
190
+ challengesGetProgress(id) {
191
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
192
+ const len0 = WASM_VECTOR_LEN;
193
+ const ret = wasm.ambacorewasm_challengesGetProgress(this.__wbg_ptr, ptr0, len0);
194
+ return takeObject(ret);
195
+ }
196
+ /**
197
+ * @param {string} collection
198
+ * @param {string} id
199
+ * @returns {Promise<any>}
200
+ */
201
+ collectionsDelete(collection, id) {
202
+ const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_export, wasm.__wbindgen_export2);
203
+ const len0 = WASM_VECTOR_LEN;
204
+ const ptr1 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
205
+ const len1 = WASM_VECTOR_LEN;
206
+ const ret = wasm.ambacorewasm_collectionsDelete(this.__wbg_ptr, ptr0, len0, ptr1, len1);
207
+ return takeObject(ret);
208
+ }
209
+ /**
210
+ * @param {string} collection
211
+ * @param {string} options_json
212
+ * @returns {Promise<any>}
213
+ */
214
+ collectionsFind(collection, options_json) {
215
+ const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_export, wasm.__wbindgen_export2);
216
+ const len0 = WASM_VECTOR_LEN;
217
+ const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
218
+ const len1 = WASM_VECTOR_LEN;
219
+ const ret = wasm.ambacorewasm_collectionsFind(this.__wbg_ptr, ptr0, len0, ptr1, len1);
220
+ return takeObject(ret);
221
+ }
222
+ /**
223
+ * @param {string} collection
224
+ * @param {string} id
225
+ * @returns {Promise<any>}
226
+ */
227
+ collectionsFindOne(collection, id) {
228
+ const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_export, wasm.__wbindgen_export2);
229
+ const len0 = WASM_VECTOR_LEN;
230
+ const ptr1 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
231
+ const len1 = WASM_VECTOR_LEN;
232
+ const ret = wasm.ambacorewasm_collectionsFindOne(this.__wbg_ptr, ptr0, len0, ptr1, len1);
233
+ return takeObject(ret);
234
+ }
235
+ /**
236
+ * @param {string} collection
237
+ * @param {string} row_json
238
+ * @returns {Promise<any>}
239
+ */
240
+ collectionsInsert(collection, row_json) {
241
+ const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_export, wasm.__wbindgen_export2);
242
+ const len0 = WASM_VECTOR_LEN;
243
+ const ptr1 = passStringToWasm0(row_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
244
+ const len1 = WASM_VECTOR_LEN;
245
+ const ret = wasm.ambacorewasm_collectionsInsert(this.__wbg_ptr, ptr0, len0, ptr1, len1);
246
+ return takeObject(ret);
247
+ }
248
+ /**
249
+ * @param {string} collection
250
+ * @param {string} id
251
+ * @param {string} set_json
252
+ * @returns {Promise<any>}
253
+ */
254
+ collectionsUpdate(collection, id, set_json) {
255
+ const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_export, wasm.__wbindgen_export2);
256
+ const len0 = WASM_VECTOR_LEN;
257
+ const ptr1 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
258
+ const len1 = WASM_VECTOR_LEN;
259
+ const ptr2 = passStringToWasm0(set_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
260
+ const len2 = WASM_VECTOR_LEN;
261
+ const ret = wasm.ambacorewasm_collectionsUpdate(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
262
+ return takeObject(ret);
263
+ }
264
+ /**
265
+ * @returns {Promise<any>}
266
+ */
267
+ configFetch() {
268
+ const ret = wasm.ambacorewasm_configFetch(this.__wbg_ptr);
269
+ return takeObject(ret);
270
+ }
271
+ /**
272
+ * @param {string} channel
273
+ * @param {string} item_json
274
+ * @returns {Promise<any>}
275
+ */
276
+ contentCreateItem(channel, item_json) {
277
+ const ptr0 = passStringToWasm0(channel, wasm.__wbindgen_export, wasm.__wbindgen_export2);
278
+ const len0 = WASM_VECTOR_LEN;
279
+ const ptr1 = passStringToWasm0(item_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
280
+ const len1 = WASM_VECTOR_LEN;
281
+ const ret = wasm.ambacorewasm_contentCreateItem(this.__wbg_ptr, ptr0, len0, ptr1, len1);
282
+ return takeObject(ret);
283
+ }
284
+ /**
285
+ * @param {string} id
286
+ * @returns {Promise<any>}
287
+ */
288
+ contentGetItem(id) {
289
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
290
+ const len0 = WASM_VECTOR_LEN;
291
+ const ret = wasm.ambacorewasm_contentGetItem(this.__wbg_ptr, ptr0, len0);
292
+ return takeObject(ret);
293
+ }
294
+ /**
295
+ * `channel` is optional; `limit` caps results per page; `cursor` is
296
+ * the server-issued opaque pagination token. Mirror the TS wrapper
297
+ * signature: getLibrary(channel?, { limit?, cursor? }).
298
+ * @param {string | null} [channel]
299
+ * @param {number | null} [limit]
300
+ * @param {string | null} [cursor]
301
+ * @returns {Promise<any>}
302
+ */
303
+ contentGetLibrary(channel, limit, cursor) {
304
+ var ptr0 = isLikeNone(channel) ? 0 : passStringToWasm0(channel, wasm.__wbindgen_export, wasm.__wbindgen_export2);
305
+ var len0 = WASM_VECTOR_LEN;
306
+ var ptr1 = isLikeNone(cursor) ? 0 : passStringToWasm0(cursor, wasm.__wbindgen_export, wasm.__wbindgen_export2);
307
+ var len1 = WASM_VECTOR_LEN;
308
+ const ret = wasm.ambacorewasm_contentGetLibrary(this.__wbg_ptr, ptr0, len0, isLikeNone(limit) ? Number.MAX_SAFE_INTEGER : (limit) >>> 0, ptr1, len1);
309
+ return takeObject(ret);
310
+ }
311
+ /**
312
+ * `channel` is optional; when omitted, FFI defaults to `"default"` so
313
+ * single-channel apps can call `Amba.content.getToday()` without args.
314
+ * @param {string | null} [channel]
315
+ * @returns {Promise<any>}
316
+ */
317
+ contentGetToday(channel) {
318
+ var ptr0 = isLikeNone(channel) ? 0 : passStringToWasm0(channel, wasm.__wbindgen_export, wasm.__wbindgen_export2);
319
+ var len0 = WASM_VECTOR_LEN;
320
+ const ret = wasm.ambacorewasm_contentGetToday(this.__wbg_ptr, ptr0, len0);
321
+ return takeObject(ret);
322
+ }
323
+ /**
324
+ * @param {string} id
325
+ * @param {string} state_json
326
+ * @returns {Promise<any>}
327
+ */
328
+ contentUpdateItem(id, state_json) {
329
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
330
+ const len0 = WASM_VECTOR_LEN;
331
+ const ptr1 = passStringToWasm0(state_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
332
+ const len1 = WASM_VECTOR_LEN;
333
+ const ret = wasm.ambacorewasm_contentUpdateItem(this.__wbg_ptr, ptr0, len0, ptr1, len1);
334
+ return takeObject(ret);
335
+ }
336
+ /**
337
+ * @returns {Promise<any>}
338
+ */
339
+ currenciesGetBalance() {
340
+ const ret = wasm.ambacorewasm_currenciesGetBalance(this.__wbg_ptr);
341
+ return takeObject(ret);
342
+ }
343
+ /**
344
+ * @param {string} currency_key
345
+ * @returns {Promise<any>}
346
+ */
347
+ currenciesGetTransactions(currency_key) {
348
+ const ptr0 = passStringToWasm0(currency_key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
349
+ const len0 = WASM_VECTOR_LEN;
350
+ const ret = wasm.ambacorewasm_currenciesGetTransactions(this.__wbg_ptr, ptr0, len0);
351
+ return takeObject(ret);
352
+ }
353
+ /**
354
+ * @param {string} params_json
355
+ * @returns {Promise<any>}
356
+ */
357
+ deepLinksCreate(params_json) {
358
+ const ptr0 = passStringToWasm0(params_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
359
+ const len0 = WASM_VECTOR_LEN;
360
+ const ret = wasm.ambacorewasm_deepLinksCreate(this.__wbg_ptr, ptr0, len0);
361
+ return takeObject(ret);
362
+ }
363
+ /**
364
+ * @param {string} short_code
365
+ * @returns {Promise<any>}
366
+ */
367
+ deepLinksGet(short_code) {
368
+ const ptr0 = passStringToWasm0(short_code, wasm.__wbindgen_export, wasm.__wbindgen_export2);
369
+ const len0 = WASM_VECTOR_LEN;
370
+ const ret = wasm.ambacorewasm_deepLinksGet(this.__wbg_ptr, ptr0, len0);
371
+ return takeObject(ret);
372
+ }
373
+ /**
374
+ * @param {string} name
375
+ * @returns {Promise<any>}
376
+ */
377
+ entitlementsHas(name) {
378
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
379
+ const len0 = WASM_VECTOR_LEN;
380
+ const ret = wasm.ambacorewasm_entitlementsHas(this.__wbg_ptr, ptr0, len0);
381
+ return takeObject(ret);
382
+ }
383
+ /**
384
+ * @returns {Promise<any>}
385
+ */
386
+ entitlementsList() {
387
+ const ret = wasm.ambacorewasm_entitlementsList(this.__wbg_ptr);
388
+ return takeObject(ret);
389
+ }
390
+ /**
391
+ * @param {string | null} [feed]
392
+ * @param {string | null} [cursor]
393
+ * @returns {Promise<any>}
394
+ */
395
+ feedsGetActivity(feed, cursor) {
396
+ var ptr0 = isLikeNone(feed) ? 0 : passStringToWasm0(feed, wasm.__wbindgen_export, wasm.__wbindgen_export2);
397
+ var len0 = WASM_VECTOR_LEN;
398
+ var ptr1 = isLikeNone(cursor) ? 0 : passStringToWasm0(cursor, wasm.__wbindgen_export, wasm.__wbindgen_export2);
399
+ var len1 = WASM_VECTOR_LEN;
400
+ const ret = wasm.ambacorewasm_feedsGetActivity(this.__wbg_ptr, ptr0, len0, ptr1, len1);
401
+ return takeObject(ret);
402
+ }
403
+ /**
404
+ * @returns {Promise<any>}
405
+ */
406
+ flagsFetch() {
407
+ const ret = wasm.ambacorewasm_flagsFetch(this.__wbg_ptr);
408
+ return takeObject(ret);
409
+ }
410
+ /**
411
+ * @param {string} user_id
412
+ * @returns {Promise<any>}
413
+ */
414
+ friendsBlockUser(user_id) {
415
+ const ptr0 = passStringToWasm0(user_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
416
+ const len0 = WASM_VECTOR_LEN;
417
+ const ret = wasm.ambacorewasm_friendsBlockUser(this.__wbg_ptr, ptr0, len0);
418
+ return takeObject(ret);
419
+ }
420
+ /**
421
+ * @returns {Promise<any>}
422
+ */
423
+ friendsGetFriends() {
424
+ const ret = wasm.ambacorewasm_friendsGetFriends(this.__wbg_ptr);
425
+ return takeObject(ret);
426
+ }
427
+ /**
428
+ * @returns {Promise<any>}
429
+ */
430
+ friendsGetList() {
431
+ const ret = wasm.ambacorewasm_friendsGetList(this.__wbg_ptr);
432
+ return takeObject(ret);
433
+ }
434
+ /**
435
+ * @param {string} friendship_id
436
+ * @returns {Promise<any>}
437
+ */
438
+ friendsRemoveBlock(friendship_id) {
439
+ const ptr0 = passStringToWasm0(friendship_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
440
+ const len0 = WASM_VECTOR_LEN;
441
+ const ret = wasm.ambacorewasm_friendsRemoveBlock(this.__wbg_ptr, ptr0, len0);
442
+ return takeObject(ret);
443
+ }
444
+ /**
445
+ * @param {string} user_id
446
+ * @returns {Promise<any>}
447
+ */
448
+ friendsUnblockUser(user_id) {
449
+ const ptr0 = passStringToWasm0(user_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
450
+ const len0 = WASM_VECTOR_LEN;
451
+ const ret = wasm.ambacorewasm_friendsUnblockUser(this.__wbg_ptr, ptr0, len0);
452
+ return takeObject(ret);
453
+ }
454
+ /**
455
+ * @param {string} params_json
456
+ * @returns {Promise<any>}
457
+ */
458
+ groupsCreate(params_json) {
459
+ const ptr0 = passStringToWasm0(params_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
460
+ const len0 = WASM_VECTOR_LEN;
461
+ const ret = wasm.ambacorewasm_groupsCreate(this.__wbg_ptr, ptr0, len0);
462
+ return takeObject(ret);
463
+ }
464
+ /**
465
+ * @param {string} id
466
+ * @returns {Promise<any>}
467
+ */
468
+ groupsDelete(id) {
469
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
470
+ const len0 = WASM_VECTOR_LEN;
471
+ const ret = wasm.ambacorewasm_groupsDelete(this.__wbg_ptr, ptr0, len0);
472
+ return takeObject(ret);
473
+ }
474
+ /**
475
+ * @param {string} id
476
+ * @returns {Promise<any>}
477
+ */
478
+ groupsGet(id) {
479
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
480
+ const len0 = WASM_VECTOR_LEN;
481
+ const ret = wasm.ambacorewasm_groupsGet(this.__wbg_ptr, ptr0, len0);
482
+ return takeObject(ret);
483
+ }
484
+ /**
485
+ * @param {string} id
486
+ * @returns {Promise<any>}
487
+ */
488
+ groupsGetMembers(id) {
489
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
490
+ const len0 = WASM_VECTOR_LEN;
491
+ const ret = wasm.ambacorewasm_groupsGetMembers(this.__wbg_ptr, ptr0, len0);
492
+ return takeObject(ret);
493
+ }
494
+ /**
495
+ * @param {string} id
496
+ * @param {string} user_id
497
+ * @returns {Promise<any>}
498
+ */
499
+ groupsInvite(id, user_id) {
500
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
501
+ const len0 = WASM_VECTOR_LEN;
502
+ const ptr1 = passStringToWasm0(user_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
503
+ const len1 = WASM_VECTOR_LEN;
504
+ const ret = wasm.ambacorewasm_groupsInvite(this.__wbg_ptr, ptr0, len0, ptr1, len1);
505
+ return takeObject(ret);
506
+ }
507
+ /**
508
+ * @param {string} id
509
+ * @returns {Promise<any>}
510
+ */
511
+ groupsJoin(id) {
512
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
513
+ const len0 = WASM_VECTOR_LEN;
514
+ const ret = wasm.ambacorewasm_groupsJoin(this.__wbg_ptr, ptr0, len0);
515
+ return takeObject(ret);
516
+ }
517
+ /**
518
+ * @param {string} id
519
+ * @returns {Promise<any>}
520
+ */
521
+ groupsLeave(id) {
522
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
523
+ const len0 = WASM_VECTOR_LEN;
524
+ const ret = wasm.ambacorewasm_groupsLeave(this.__wbg_ptr, ptr0, len0);
525
+ return takeObject(ret);
526
+ }
527
+ /**
528
+ * @param {string} id
529
+ * @param {string} patch_json
530
+ * @returns {Promise<any>}
531
+ */
532
+ groupsUpdate(id, patch_json) {
533
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
534
+ const len0 = WASM_VECTOR_LEN;
535
+ const ptr1 = passStringToWasm0(patch_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
536
+ const len1 = WASM_VECTOR_LEN;
537
+ const ret = wasm.ambacorewasm_groupsUpdate(this.__wbg_ptr, ptr0, len0, ptr1, len1);
538
+ return takeObject(ret);
539
+ }
540
+ /**
541
+ * Initialize the SDK.
542
+ *
543
+ * `config_json`: JSON-stringified `AmbaConfig` (api_key, base_url,
544
+ * sdk_platform, sdk_wrapper_version, consent_required, debug).
545
+ *
546
+ * `fetch_fn`: a JS function `(url, init) => Promise<Response>`
547
+ * matching the global `fetch` signature. The wrapper passes
548
+ * `window.fetch.bind(window)` or a server-side polyfill.
549
+ * @param {string} config_json
550
+ * @param {Function} fetch_fn
551
+ * @returns {AmbaCoreWasm}
552
+ */
553
+ static init(config_json, fetch_fn) {
554
+ try {
555
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
556
+ const ptr0 = passStringToWasm0(config_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
557
+ const len0 = WASM_VECTOR_LEN;
558
+ wasm.ambacorewasm_init(retptr, ptr0, len0, addHeapObject(fetch_fn));
559
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
560
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
561
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
562
+ if (r2) {
563
+ throw takeObject(r1);
564
+ }
565
+ return AmbaCoreWasm.__wrap(r0);
566
+ } finally {
567
+ wasm.__wbindgen_add_to_stack_pointer(16);
568
+ }
569
+ }
570
+ /**
571
+ * @param {string} request_json
572
+ * @returns {Promise<any>}
573
+ */
574
+ inventoryConsume(request_json) {
575
+ const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
576
+ const len0 = WASM_VECTOR_LEN;
577
+ const ret = wasm.ambacorewasm_inventoryConsume(this.__wbg_ptr, ptr0, len0);
578
+ return takeObject(ret);
579
+ }
580
+ /**
581
+ * @param {string} id
582
+ * @returns {Promise<any>}
583
+ */
584
+ inventoryGetItem(id) {
585
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
586
+ const len0 = WASM_VECTOR_LEN;
587
+ const ret = wasm.ambacorewasm_inventoryGetItem(this.__wbg_ptr, ptr0, len0);
588
+ return takeObject(ret);
589
+ }
590
+ /**
591
+ * @returns {Promise<any>}
592
+ */
593
+ inventoryGetItems() {
594
+ const ret = wasm.ambacorewasm_inventoryGetItems(this.__wbg_ptr);
595
+ return takeObject(ret);
596
+ }
597
+ /**
598
+ * @param {string} request_json
599
+ * @returns {Promise<any>}
600
+ */
601
+ inventoryPurchase(request_json) {
602
+ const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
603
+ const len0 = WASM_VECTOR_LEN;
604
+ const ret = wasm.ambacorewasm_inventoryPurchase(this.__wbg_ptr, ptr0, len0);
605
+ return takeObject(ret);
606
+ }
607
+ /**
608
+ * @returns {boolean}
609
+ */
610
+ isAuthenticated() {
611
+ const ret = wasm.ambacorewasm_isAuthenticated(this.__wbg_ptr);
612
+ return ret !== 0;
613
+ }
614
+ /**
615
+ * @param {string} key
616
+ * @returns {Promise<any>}
617
+ */
618
+ leaderboardsGet(key) {
619
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
620
+ const len0 = WASM_VECTOR_LEN;
621
+ const ret = wasm.ambacorewasm_leaderboardsGet(this.__wbg_ptr, ptr0, len0);
622
+ return takeObject(ret);
623
+ }
624
+ /**
625
+ * @param {string} key
626
+ * @param {number | null} [limit]
627
+ * @returns {Promise<any>}
628
+ */
629
+ leaderboardsGetEntries(key, limit) {
630
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
631
+ const len0 = WASM_VECTOR_LEN;
632
+ const ret = wasm.ambacorewasm_leaderboardsGetEntries(this.__wbg_ptr, ptr0, len0, isLikeNone(limit) ? Number.MAX_SAFE_INTEGER : (limit) >>> 0);
633
+ return takeObject(ret);
634
+ }
635
+ /**
636
+ * @param {string} key
637
+ * @returns {Promise<any>}
638
+ */
639
+ leaderboardsGetMyRank(key) {
640
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
641
+ const len0 = WASM_VECTOR_LEN;
642
+ const ret = wasm.ambacorewasm_leaderboardsGetMyRank(this.__wbg_ptr, ptr0, len0);
643
+ return takeObject(ret);
644
+ }
645
+ /**
646
+ * @returns {Promise<any>}
647
+ */
648
+ me() {
649
+ const ret = wasm.ambacorewasm_me(this.__wbg_ptr);
650
+ return takeObject(ret);
651
+ }
652
+ /**
653
+ * @returns {Promise<any>}
654
+ */
655
+ messagingGetConversations() {
656
+ const ret = wasm.ambacorewasm_messagingGetConversations(this.__wbg_ptr);
657
+ return takeObject(ret);
658
+ }
659
+ /**
660
+ * @param {string} id
661
+ * @returns {Promise<any>}
662
+ */
663
+ messagingGetMessage(id) {
664
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
665
+ const len0 = WASM_VECTOR_LEN;
666
+ const ret = wasm.ambacorewasm_messagingGetMessage(this.__wbg_ptr, ptr0, len0);
667
+ return takeObject(ret);
668
+ }
669
+ /**
670
+ * @param {string} request_json
671
+ * @returns {Promise<any>}
672
+ */
673
+ messagingSendMessage(request_json) {
674
+ const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
675
+ const len0 = WASM_VECTOR_LEN;
676
+ const ret = wasm.ambacorewasm_messagingSendMessage(this.__wbg_ptr, ptr0, len0);
677
+ return takeObject(ret);
678
+ }
679
+ /**
680
+ * @param {string} id
681
+ * @returns {Promise<any>}
682
+ */
683
+ moderationGetReportStatus(id) {
684
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
685
+ const len0 = WASM_VECTOR_LEN;
686
+ const ret = wasm.ambacorewasm_moderationGetReportStatus(this.__wbg_ptr, ptr0, len0);
687
+ return takeObject(ret);
688
+ }
689
+ /**
690
+ * @param {string} request_json
691
+ * @returns {Promise<any>}
692
+ */
693
+ moderationReportContent(request_json) {
694
+ const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
695
+ const len0 = WASM_VECTOR_LEN;
696
+ const ret = wasm.ambacorewasm_moderationReportContent(this.__wbg_ptr, ptr0, len0);
697
+ return takeObject(ret);
698
+ }
699
+ /**
700
+ * @param {string} request_json
701
+ * @returns {Promise<any>}
702
+ */
703
+ moderationReportUser(request_json) {
704
+ const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
705
+ const len0 = WASM_VECTOR_LEN;
706
+ const ret = wasm.ambacorewasm_moderationReportUser(this.__wbg_ptr, ptr0, len0);
707
+ return takeObject(ret);
708
+ }
709
+ /**
710
+ * @returns {Promise<any>}
711
+ */
712
+ onboardingComplete() {
713
+ const ret = wasm.ambacorewasm_onboardingComplete(this.__wbg_ptr);
714
+ return takeObject(ret);
715
+ }
716
+ /**
717
+ * @returns {Promise<any>}
718
+ */
719
+ onboardingGetStatus() {
720
+ const ret = wasm.ambacorewasm_onboardingGetStatus(this.__wbg_ptr);
721
+ return takeObject(ret);
722
+ }
723
+ /**
724
+ * @param {string} payload_json
725
+ * @returns {Promise<any>}
726
+ */
727
+ onboardingNextStep(payload_json) {
728
+ const ptr0 = passStringToWasm0(payload_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
729
+ const len0 = WASM_VECTOR_LEN;
730
+ const ret = wasm.ambacorewasm_onboardingNextStep(this.__wbg_ptr, ptr0, len0);
731
+ return takeObject(ret);
732
+ }
733
+ /**
734
+ * @returns {Promise<any>}
735
+ */
736
+ onboardingSkipStep() {
737
+ const ret = wasm.ambacorewasm_onboardingSkipStep(this.__wbg_ptr);
738
+ return takeObject(ret);
739
+ }
740
+ /**
741
+ * @returns {Promise<any>}
742
+ */
743
+ pushGetTokens() {
744
+ const ret = wasm.ambacorewasm_pushGetTokens(this.__wbg_ptr);
745
+ return takeObject(ret);
746
+ }
747
+ /**
748
+ * @param {string} token
749
+ * @param {string} platform
750
+ * @param {string | null} [bundle_id]
751
+ * @returns {Promise<any>}
752
+ */
753
+ pushRegister(token, platform, bundle_id) {
754
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
755
+ const len0 = WASM_VECTOR_LEN;
756
+ const ptr1 = passStringToWasm0(platform, wasm.__wbindgen_export, wasm.__wbindgen_export2);
757
+ const len1 = WASM_VECTOR_LEN;
758
+ var ptr2 = isLikeNone(bundle_id) ? 0 : passStringToWasm0(bundle_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
759
+ var len2 = WASM_VECTOR_LEN;
760
+ const ret = wasm.ambacorewasm_pushRegister(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
761
+ return takeObject(ret);
762
+ }
763
+ /**
764
+ * @param {string} topic
765
+ * @returns {Promise<any>}
766
+ */
767
+ pushSubscribe(topic) {
768
+ const ptr0 = passStringToWasm0(topic, wasm.__wbindgen_export, wasm.__wbindgen_export2);
769
+ const len0 = WASM_VECTOR_LEN;
770
+ const ret = wasm.ambacorewasm_pushSubscribe(this.__wbg_ptr, ptr0, len0);
771
+ return takeObject(ret);
772
+ }
773
+ /**
774
+ * @param {string} token
775
+ * @returns {Promise<any>}
776
+ */
777
+ pushUnregister(token) {
778
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
779
+ const len0 = WASM_VECTOR_LEN;
780
+ const ret = wasm.ambacorewasm_pushUnregister(this.__wbg_ptr, ptr0, len0);
781
+ return takeObject(ret);
782
+ }
783
+ /**
784
+ * @param {string} topic
785
+ * @returns {Promise<any>}
786
+ */
787
+ pushUnsubscribe(topic) {
788
+ const ptr0 = passStringToWasm0(topic, wasm.__wbindgen_export, wasm.__wbindgen_export2);
789
+ const len0 = WASM_VECTOR_LEN;
790
+ const ret = wasm.ambacorewasm_pushUnsubscribe(this.__wbg_ptr, ptr0, len0);
791
+ return takeObject(ret);
792
+ }
793
+ /**
794
+ * @param {string} code
795
+ * @returns {Promise<any>}
796
+ */
797
+ referralsClaimReferral(code) {
798
+ const ptr0 = passStringToWasm0(code, wasm.__wbindgen_export, wasm.__wbindgen_export2);
799
+ const len0 = WASM_VECTOR_LEN;
800
+ const ret = wasm.ambacorewasm_referralsClaimReferral(this.__wbg_ptr, ptr0, len0);
801
+ return takeObject(ret);
802
+ }
803
+ /**
804
+ * @param {string | null} [code]
805
+ * @param {number | null} [max_uses]
806
+ * @returns {Promise<any>}
807
+ */
808
+ referralsCreate(code, max_uses) {
809
+ var ptr0 = isLikeNone(code) ? 0 : passStringToWasm0(code, wasm.__wbindgen_export, wasm.__wbindgen_export2);
810
+ var len0 = WASM_VECTOR_LEN;
811
+ const ret = wasm.ambacorewasm_referralsCreate(this.__wbg_ptr, ptr0, len0, isLikeNone(max_uses) ? Number.MAX_SAFE_INTEGER : (max_uses) >>> 0);
812
+ return takeObject(ret);
813
+ }
814
+ /**
815
+ * @returns {Promise<any>}
816
+ */
817
+ referralsGetReferralCode() {
818
+ const ret = wasm.ambacorewasm_referralsGetReferralCode(this.__wbg_ptr);
819
+ return takeObject(ret);
820
+ }
821
+ /**
822
+ * @returns {Promise<any>}
823
+ */
824
+ refreshSession() {
825
+ const ret = wasm.ambacorewasm_refreshSession(this.__wbg_ptr);
826
+ return takeObject(ret);
827
+ }
828
+ /**
829
+ * @param {string} params_json
830
+ * @returns {Promise<any>}
831
+ */
832
+ reviewsCreate(params_json) {
833
+ const ptr0 = passStringToWasm0(params_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
834
+ const len0 = WASM_VECTOR_LEN;
835
+ const ret = wasm.ambacorewasm_reviewsCreate(this.__wbg_ptr, ptr0, len0);
836
+ return takeObject(ret);
837
+ }
838
+ /**
839
+ * @param {string} id
840
+ * @returns {Promise<any>}
841
+ */
842
+ reviewsDelete(id) {
843
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
844
+ const len0 = WASM_VECTOR_LEN;
845
+ const ret = wasm.ambacorewasm_reviewsDelete(this.__wbg_ptr, ptr0, len0);
846
+ return takeObject(ret);
847
+ }
848
+ /**
849
+ * @param {string} target_type
850
+ * @param {string} target_id
851
+ * @returns {Promise<any>}
852
+ */
853
+ reviewsList(target_type, target_id) {
854
+ const ptr0 = passStringToWasm0(target_type, wasm.__wbindgen_export, wasm.__wbindgen_export2);
855
+ const len0 = WASM_VECTOR_LEN;
856
+ const ptr1 = passStringToWasm0(target_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
857
+ const len1 = WASM_VECTOR_LEN;
858
+ const ret = wasm.ambacorewasm_reviewsList(this.__wbg_ptr, ptr0, len0, ptr1, len1);
859
+ return takeObject(ret);
860
+ }
861
+ /**
862
+ * @param {string} id
863
+ * @param {string} patch_json
864
+ * @returns {Promise<any>}
865
+ */
866
+ reviewsUpdate(id, patch_json) {
867
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
868
+ const len0 = WASM_VECTOR_LEN;
869
+ const ptr1 = passStringToWasm0(patch_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
870
+ const len1 = WASM_VECTOR_LEN;
871
+ const ret = wasm.ambacorewasm_reviewsUpdate(this.__wbg_ptr, ptr0, len0, ptr1, len1);
872
+ return takeObject(ret);
873
+ }
874
+ /**
875
+ * @returns {Promise<any>}
876
+ */
877
+ rolesGetMyRoles() {
878
+ const ret = wasm.ambacorewasm_rolesGetMyRoles(this.__wbg_ptr);
879
+ return takeObject(ret);
880
+ }
881
+ /**
882
+ * @param {string} permission
883
+ * @returns {Promise<any>}
884
+ */
885
+ rolesHasPermission(permission) {
886
+ const ptr0 = passStringToWasm0(permission, wasm.__wbindgen_export, wasm.__wbindgen_export2);
887
+ const len0 = WASM_VECTOR_LEN;
888
+ const ret = wasm.ambacorewasm_rolesHasPermission(this.__wbg_ptr, ptr0, len0);
889
+ return takeObject(ret);
890
+ }
891
+ /**
892
+ * @param {boolean} enabled
893
+ */
894
+ setDebug(enabled) {
895
+ wasm.ambacorewasm_setDebug(this.__wbg_ptr, enabled);
896
+ }
897
+ /**
898
+ * @returns {Promise<any>}
899
+ */
900
+ signInAnonymously() {
901
+ const ret = wasm.ambacorewasm_signInAnonymously(this.__wbg_ptr);
902
+ return takeObject(ret);
903
+ }
904
+ /**
905
+ * @param {string} email
906
+ * @param {string} password
907
+ * @returns {Promise<any>}
908
+ */
909
+ signInWithEmail(email, password) {
910
+ const ptr0 = passStringToWasm0(email, wasm.__wbindgen_export, wasm.__wbindgen_export2);
911
+ const len0 = WASM_VECTOR_LEN;
912
+ const ptr1 = passStringToWasm0(password, wasm.__wbindgen_export, wasm.__wbindgen_export2);
913
+ const len1 = WASM_VECTOR_LEN;
914
+ const ret = wasm.ambacorewasm_signInWithEmail(this.__wbg_ptr, ptr0, len0, ptr1, len1);
915
+ return takeObject(ret);
916
+ }
917
+ /**
918
+ * @param {string} provider
919
+ * @param {string} id_token
920
+ * @returns {Promise<any>}
921
+ */
922
+ signInWithSocial(provider, id_token) {
923
+ const ptr0 = passStringToWasm0(provider, wasm.__wbindgen_export, wasm.__wbindgen_export2);
924
+ const len0 = WASM_VECTOR_LEN;
925
+ const ptr1 = passStringToWasm0(id_token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
926
+ const len1 = WASM_VECTOR_LEN;
927
+ const ret = wasm.ambacorewasm_signInWithSocial(this.__wbg_ptr, ptr0, len0, ptr1, len1);
928
+ return takeObject(ret);
929
+ }
930
+ /**
931
+ * @param {boolean} rotate_anonymous_id
932
+ * @returns {Promise<any>}
933
+ */
934
+ signOut(rotate_anonymous_id) {
935
+ const ret = wasm.ambacorewasm_signOut(this.__wbg_ptr, rotate_anonymous_id);
936
+ return takeObject(ret);
937
+ }
938
+ /**
939
+ * @param {string} email
940
+ * @param {string} password
941
+ * @returns {Promise<any>}
942
+ */
943
+ signUpWithEmail(email, password) {
944
+ const ptr0 = passStringToWasm0(email, wasm.__wbindgen_export, wasm.__wbindgen_export2);
945
+ const len0 = WASM_VECTOR_LEN;
946
+ const ptr1 = passStringToWasm0(password, wasm.__wbindgen_export, wasm.__wbindgen_export2);
947
+ const len1 = WASM_VECTOR_LEN;
948
+ const ret = wasm.ambacorewasm_signUpWithEmail(this.__wbg_ptr, ptr0, len0, ptr1, len1);
949
+ return takeObject(ret);
950
+ }
951
+ /**
952
+ * @param {string} upload_id
953
+ * @param {string} asset_id
954
+ * @returns {Promise<any>}
955
+ */
956
+ storageCommit(upload_id, asset_id) {
957
+ const ptr0 = passStringToWasm0(upload_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
958
+ const len0 = WASM_VECTOR_LEN;
959
+ const ptr1 = passStringToWasm0(asset_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
960
+ const len1 = WASM_VECTOR_LEN;
961
+ const ret = wasm.ambacorewasm_storageCommit(this.__wbg_ptr, ptr0, len0, ptr1, len1);
962
+ return takeObject(ret);
963
+ }
964
+ /**
965
+ * @param {string} bucket
966
+ * @param {string} filename
967
+ * @param {string} mime_type
968
+ * @param {number} size_bytes
969
+ * @param {number | null} [retention_days]
970
+ * @returns {Promise<any>}
971
+ */
972
+ storagePresign(bucket, filename, mime_type, size_bytes, retention_days) {
973
+ const ptr0 = passStringToWasm0(bucket, wasm.__wbindgen_export, wasm.__wbindgen_export2);
974
+ const len0 = WASM_VECTOR_LEN;
975
+ const ptr1 = passStringToWasm0(filename, wasm.__wbindgen_export, wasm.__wbindgen_export2);
976
+ const len1 = WASM_VECTOR_LEN;
977
+ const ptr2 = passStringToWasm0(mime_type, wasm.__wbindgen_export, wasm.__wbindgen_export2);
978
+ const len2 = WASM_VECTOR_LEN;
979
+ const ret = wasm.ambacorewasm_storagePresign(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, size_bytes, isLikeNone(retention_days) ? Number.MAX_SAFE_INTEGER : (retention_days) >>> 0);
980
+ return takeObject(ret);
981
+ }
982
+ /**
983
+ * @param {string} store_key
984
+ * @returns {Promise<any>}
985
+ */
986
+ storesGetPurchaseOptions(store_key) {
987
+ const ptr0 = passStringToWasm0(store_key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
988
+ const len0 = WASM_VECTOR_LEN;
989
+ const ret = wasm.ambacorewasm_storesGetPurchaseOptions(this.__wbg_ptr, ptr0, len0);
990
+ return takeObject(ret);
991
+ }
992
+ /**
993
+ * @returns {Promise<any>}
994
+ */
995
+ storesList() {
996
+ const ret = wasm.ambacorewasm_storesList(this.__wbg_ptr);
997
+ return takeObject(ret);
998
+ }
999
+ /**
1000
+ * @param {string} store_key
1001
+ * @param {string} purchase_option_id
1002
+ * @param {string} receipt_json
1003
+ * @returns {Promise<any>}
1004
+ */
1005
+ storesPurchase(store_key, purchase_option_id, receipt_json) {
1006
+ const ptr0 = passStringToWasm0(store_key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1007
+ const len0 = WASM_VECTOR_LEN;
1008
+ const ptr1 = passStringToWasm0(purchase_option_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1009
+ const len1 = WASM_VECTOR_LEN;
1010
+ const ptr2 = passStringToWasm0(receipt_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1011
+ const len2 = WASM_VECTOR_LEN;
1012
+ const ret = wasm.ambacorewasm_storesPurchase(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
1013
+ return takeObject(ret);
1014
+ }
1015
+ /**
1016
+ * @returns {Promise<any>}
1017
+ */
1018
+ streaksGetAll() {
1019
+ const ret = wasm.ambacorewasm_streaksGetAll(this.__wbg_ptr);
1020
+ return takeObject(ret);
1021
+ }
1022
+ /**
1023
+ * @param {string} streak_key
1024
+ * @returns {Promise<any>}
1025
+ */
1026
+ streaksQualify(streak_key) {
1027
+ const ptr0 = passStringToWasm0(streak_key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1028
+ const len0 = WASM_VECTOR_LEN;
1029
+ const ret = wasm.ambacorewasm_streaksQualify(this.__wbg_ptr, ptr0, len0);
1030
+ return takeObject(ret);
1031
+ }
1032
+ /**
1033
+ * Track an event. Returns a Promise that resolves to undefined on success.
1034
+ * @param {string} event
1035
+ * @param {string | null} [properties_json]
1036
+ * @returns {Promise<any>}
1037
+ */
1038
+ track(event, properties_json) {
1039
+ const ptr0 = passStringToWasm0(event, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1040
+ const len0 = WASM_VECTOR_LEN;
1041
+ var ptr1 = isLikeNone(properties_json) ? 0 : passStringToWasm0(properties_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1042
+ var len1 = WASM_VECTOR_LEN;
1043
+ const ret = wasm.ambacorewasm_track(this.__wbg_ptr, ptr0, len0, ptr1, len1);
1044
+ return takeObject(ret);
1045
+ }
1046
+ /**
1047
+ * @param {string} grant_key
1048
+ * @returns {Promise<any>}
1049
+ */
1050
+ xpClaim(grant_key) {
1051
+ const ptr0 = passStringToWasm0(grant_key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1052
+ const len0 = WASM_VECTOR_LEN;
1053
+ const ret = wasm.ambacorewasm_xpClaim(this.__wbg_ptr, ptr0, len0);
1054
+ return takeObject(ret);
1055
+ }
1056
+ /**
1057
+ * @returns {Promise<any>}
1058
+ */
1059
+ xpGetBalance() {
1060
+ const ret = wasm.ambacorewasm_xpGetBalance(this.__wbg_ptr);
1061
+ return takeObject(ret);
1062
+ }
1063
+ /**
1064
+ * @param {number | null} [limit]
1065
+ * @returns {Promise<any>}
1066
+ */
1067
+ xpGetHistory(limit) {
1068
+ const ret = wasm.ambacorewasm_xpGetHistory(this.__wbg_ptr, isLikeNone(limit) ? Number.MAX_SAFE_INTEGER : (limit) >>> 0);
1069
+ return takeObject(ret);
1070
+ }
1071
+ }
1072
+ if (Symbol.dispose) AmbaCoreWasm.prototype[Symbol.dispose] = AmbaCoreWasm.prototype.free;
1073
+ export function __wbg_Error_bce6d499ff0a4aff(arg0, arg1) {
1074
+ const ret = Error(getStringFromWasm0(arg0, arg1));
1075
+ return addHeapObject(ret);
1076
+ }
1077
+ export function __wbg_String_8564e559799eccda(arg0, arg1) {
1078
+ const ret = String(getObject(arg1));
1079
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1080
+ const len1 = WASM_VECTOR_LEN;
1081
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1082
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1083
+ }
1084
+ export function __wbg___wbindgen_debug_string_edece8177ad01481(arg0, arg1) {
1085
+ const ret = debugString(getObject(arg1));
1086
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1087
+ const len1 = WASM_VECTOR_LEN;
1088
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1089
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1090
+ }
1091
+ export function __wbg___wbindgen_is_function_5cd60d5cf78b4eef(arg0) {
1092
+ const ret = typeof(getObject(arg0)) === 'function';
1093
+ return ret;
1094
+ }
1095
+ export function __wbg___wbindgen_is_string_dde0fd9020db4434(arg0) {
1096
+ const ret = typeof(getObject(arg0)) === 'string';
1097
+ return ret;
1098
+ }
1099
+ export function __wbg___wbindgen_is_undefined_35bb9f4c7fd651d5(arg0) {
1100
+ const ret = getObject(arg0) === undefined;
1101
+ return ret;
1102
+ }
1103
+ export function __wbg___wbindgen_number_get_f73a1244370fcc2c(arg0, arg1) {
1104
+ const obj = getObject(arg1);
1105
+ const ret = typeof(obj) === 'number' ? obj : undefined;
1106
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1107
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1108
+ }
1109
+ export function __wbg___wbindgen_string_get_d109740c0d18f4d7(arg0, arg1) {
1110
+ const obj = getObject(arg1);
1111
+ const ret = typeof(obj) === 'string' ? obj : undefined;
1112
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1113
+ var len1 = WASM_VECTOR_LEN;
1114
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1115
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1116
+ }
1117
+ export function __wbg___wbindgen_throw_9c31b086c2b26051(arg0, arg1) {
1118
+ throw new Error(getStringFromWasm0(arg0, arg1));
1119
+ }
1120
+ export function __wbg__wbg_cb_unref_3fa391f3fcdb55f8(arg0) {
1121
+ getObject(arg0)._wbg_cb_unref();
1122
+ }
1123
+ export function __wbg_call_13665d9f14390edc() { return handleError(function (arg0, arg1) {
1124
+ const ret = getObject(arg0).call(getObject(arg1));
1125
+ return addHeapObject(ret);
1126
+ }, arguments); }
1127
+ export function __wbg_call_dfde26266607c996() { return handleError(function (arg0, arg1, arg2) {
1128
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
1129
+ return addHeapObject(ret);
1130
+ }, arguments); }
1131
+ export function __wbg_call_faa0a261f288f846() { return handleError(function (arg0, arg1, arg2, arg3) {
1132
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3));
1133
+ return addHeapObject(ret);
1134
+ }, arguments); }
1135
+ export function __wbg_getRandomValues_ef12552bf5acd2fe() { return handleError(function (arg0, arg1) {
1136
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
1137
+ }, arguments); }
1138
+ export function __wbg_getTime_09f1dd40a44edb30(arg0) {
1139
+ const ret = getObject(arg0).getTime();
1140
+ return ret;
1141
+ }
1142
+ export function __wbg_get_dcf82ab8aad1a593() { return handleError(function (arg0, arg1) {
1143
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
1144
+ return addHeapObject(ret);
1145
+ }, arguments); }
1146
+ export function __wbg_length_56fcd3e2b7e0299d(arg0) {
1147
+ const ret = getObject(arg0).length;
1148
+ return ret;
1149
+ }
1150
+ export function __wbg_new_02d162bc6cf02f60() {
1151
+ const ret = new Object();
1152
+ return addHeapObject(ret);
1153
+ }
1154
+ export function __wbg_new_070df68d66325372() {
1155
+ const ret = new Map();
1156
+ return addHeapObject(ret);
1157
+ }
1158
+ export function __wbg_new_0_2722fcdb71a888a6() {
1159
+ const ret = new Date();
1160
+ return addHeapObject(ret);
1161
+ }
1162
+ export function __wbg_new_310879b66b6e95e1() {
1163
+ const ret = new Array();
1164
+ return addHeapObject(ret);
1165
+ }
1166
+ export function __wbg_new_7ddec6de44ff8f5d(arg0) {
1167
+ const ret = new Uint8Array(getObject(arg0));
1168
+ return addHeapObject(ret);
1169
+ }
1170
+ export function __wbg_new_typed_c072c4ce9a2a0cdf(arg0, arg1) {
1171
+ try {
1172
+ var state0 = {a: arg0, b: arg1};
1173
+ var cb0 = (arg0, arg1) => {
1174
+ const a = state0.a;
1175
+ state0.a = 0;
1176
+ try {
1177
+ return __wasm_bindgen_func_elem_2351_96(a, state0.b, arg0, arg1);
1178
+ } finally {
1179
+ state0.a = a;
1180
+ }
1181
+ };
1182
+ const ret = new Promise(cb0);
1183
+ return addHeapObject(ret);
1184
+ } finally {
1185
+ state0.a = 0;
1186
+ }
1187
+ }
1188
+ export function __wbg_new_with_length_99887c91eae4abab(arg0) {
1189
+ const ret = new Uint8Array(arg0 >>> 0);
1190
+ return addHeapObject(ret);
1191
+ }
1192
+ export function __wbg_prototypesetcall_5f9bdc8d75e07276(arg0, arg1, arg2) {
1193
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
1194
+ }
1195
+ export function __wbg_queueMicrotask_78d584b53af520f5(arg0) {
1196
+ const ret = getObject(arg0).queueMicrotask;
1197
+ return addHeapObject(ret);
1198
+ }
1199
+ export function __wbg_queueMicrotask_b39ea83c7f01971a(arg0) {
1200
+ queueMicrotask(getObject(arg0));
1201
+ }
1202
+ export function __wbg_resolve_d17db9352f5a220e(arg0) {
1203
+ const ret = Promise.resolve(getObject(arg0));
1204
+ return addHeapObject(ret);
1205
+ }
1206
+ export function __wbg_set_24d0fa9e104112f9(arg0, arg1, arg2) {
1207
+ getObject(arg0).set(getArrayU8FromWasm0(arg1, arg2));
1208
+ }
1209
+ export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
1210
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
1211
+ }
1212
+ export function __wbg_set_78ea6a19f4818587(arg0, arg1, arg2) {
1213
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
1214
+ }
1215
+ export function __wbg_set_a0e911be3da02782() { return handleError(function (arg0, arg1, arg2) {
1216
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
1217
+ return ret;
1218
+ }, arguments); }
1219
+ export function __wbg_set_facb7a5914e0fa39(arg0, arg1, arg2) {
1220
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
1221
+ return addHeapObject(ret);
1222
+ }
1223
+ export function __wbg_static_accessor_GLOBAL_THIS_02344c9b09eb08a9() {
1224
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
1225
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1226
+ }
1227
+ export function __wbg_static_accessor_GLOBAL_ac6d4ac874d5cd54() {
1228
+ const ret = typeof global === 'undefined' ? null : global;
1229
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1230
+ }
1231
+ export function __wbg_static_accessor_SELF_9b2406c23aeb2023() {
1232
+ const ret = typeof self === 'undefined' ? null : self;
1233
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1234
+ }
1235
+ export function __wbg_static_accessor_WINDOW_b34d2126934e16ba() {
1236
+ const ret = typeof window === 'undefined' ? null : window;
1237
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1238
+ }
1239
+ export function __wbg_then_837494e384b37459(arg0, arg1) {
1240
+ const ret = getObject(arg0).then(getObject(arg1));
1241
+ return addHeapObject(ret);
1242
+ }
1243
+ export function __wbg_then_bd927500e8905df2(arg0, arg1, arg2) {
1244
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
1245
+ return addHeapObject(ret);
1246
+ }
1247
+ export function __wbindgen_cast_0000000000000001(arg0, arg1) {
1248
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref, Externref], shim_idx: 581, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1249
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_2351);
1250
+ return addHeapObject(ret);
1251
+ }
1252
+ export function __wbindgen_cast_0000000000000002(arg0, arg1) {
1253
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 576, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1254
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_2347);
1255
+ return addHeapObject(ret);
1256
+ }
1257
+ export function __wbindgen_cast_0000000000000003(arg0) {
1258
+ // Cast intrinsic for `F64 -> Externref`.
1259
+ const ret = arg0;
1260
+ return addHeapObject(ret);
1261
+ }
1262
+ export function __wbindgen_cast_0000000000000004(arg0) {
1263
+ // Cast intrinsic for `I64 -> Externref`.
1264
+ const ret = arg0;
1265
+ return addHeapObject(ret);
1266
+ }
1267
+ export function __wbindgen_cast_0000000000000005(arg0, arg1) {
1268
+ // Cast intrinsic for `Ref(String) -> Externref`.
1269
+ const ret = getStringFromWasm0(arg0, arg1);
1270
+ return addHeapObject(ret);
1271
+ }
1272
+ export function __wbindgen_cast_0000000000000006(arg0) {
1273
+ // Cast intrinsic for `U64 -> Externref`.
1274
+ const ret = BigInt.asUintN(64, arg0);
1275
+ return addHeapObject(ret);
1276
+ }
1277
+ export function __wbindgen_object_clone_ref(arg0) {
1278
+ const ret = getObject(arg0);
1279
+ return addHeapObject(ret);
1280
+ }
1281
+ export function __wbindgen_object_drop_ref(arg0) {
1282
+ takeObject(arg0);
1283
+ }
1284
+ function __wasm_bindgen_func_elem_2351(arg0, arg1, arg2, arg3) {
1285
+ wasm.__wasm_bindgen_func_elem_2351(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
1286
+ }
1287
+
1288
+ function __wasm_bindgen_func_elem_2347(arg0, arg1, arg2) {
1289
+ try {
1290
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1291
+ wasm.__wasm_bindgen_func_elem_2347(retptr, arg0, arg1, addHeapObject(arg2));
1292
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1293
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1294
+ if (r1) {
1295
+ throw takeObject(r0);
1296
+ }
1297
+ } finally {
1298
+ wasm.__wbindgen_add_to_stack_pointer(16);
1299
+ }
1300
+ }
1301
+
1302
+ function __wasm_bindgen_func_elem_2351_96(arg0, arg1, arg2, arg3) {
1303
+ wasm.__wasm_bindgen_func_elem_2351_96(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
1304
+ }
1305
+
1306
+ const AmbaCoreWasmFinalization = (typeof FinalizationRegistry === 'undefined')
1307
+ ? { register: () => {}, unregister: () => {} }
1308
+ : new FinalizationRegistry(ptr => wasm.__wbg_ambacorewasm_free(ptr, 1));
1309
+
1310
+ function addHeapObject(obj) {
1311
+ if (heap_next === heap.length) heap.push(heap.length + 1);
1312
+ const idx = heap_next;
1313
+ heap_next = heap[idx];
1314
+
1315
+ heap[idx] = obj;
1316
+ return idx;
1317
+ }
1318
+
1319
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
1320
+ ? { register: () => {}, unregister: () => {} }
1321
+ : new FinalizationRegistry(state => wasm.__wbindgen_export4(state.a, state.b));
1322
+
1323
+ function debugString(val) {
1324
+ // primitive types
1325
+ const type = typeof val;
1326
+ if (type == 'number' || type == 'boolean' || val == null) {
1327
+ return `${val}`;
1328
+ }
1329
+ if (type == 'string') {
1330
+ return `"${val}"`;
1331
+ }
1332
+ if (type == 'symbol') {
1333
+ const description = val.description;
1334
+ if (description == null) {
1335
+ return 'Symbol';
1336
+ } else {
1337
+ return `Symbol(${description})`;
1338
+ }
1339
+ }
1340
+ if (type == 'function') {
1341
+ const name = val.name;
1342
+ if (typeof name == 'string' && name.length > 0) {
1343
+ return `Function(${name})`;
1344
+ } else {
1345
+ return 'Function';
1346
+ }
1347
+ }
1348
+ // objects
1349
+ if (Array.isArray(val)) {
1350
+ const length = val.length;
1351
+ let debug = '[';
1352
+ if (length > 0) {
1353
+ debug += debugString(val[0]);
1354
+ }
1355
+ for(let i = 1; i < length; i++) {
1356
+ debug += ', ' + debugString(val[i]);
1357
+ }
1358
+ debug += ']';
1359
+ return debug;
1360
+ }
1361
+ // Test for built-in
1362
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
1363
+ let className;
1364
+ if (builtInMatches && builtInMatches.length > 1) {
1365
+ className = builtInMatches[1];
1366
+ } else {
1367
+ // Failed to match the standard '[object ClassName]'
1368
+ return toString.call(val);
1369
+ }
1370
+ if (className == 'Object') {
1371
+ // we're a user defined class or Object
1372
+ // JSON.stringify avoids problems with cycles, and is generally much
1373
+ // easier than looping through ownProperties of `val`.
1374
+ try {
1375
+ return 'Object(' + JSON.stringify(val) + ')';
1376
+ } catch (_) {
1377
+ return 'Object';
1378
+ }
1379
+ }
1380
+ // errors
1381
+ if (val instanceof Error) {
1382
+ return `${val.name}: ${val.message}\n${val.stack}`;
1383
+ }
1384
+ // TODO we could test for more things here, like `Set`s and `Map`s.
1385
+ return className;
1386
+ }
1387
+
1388
+ function dropObject(idx) {
1389
+ if (idx < 1028) return;
1390
+ heap[idx] = heap_next;
1391
+ heap_next = idx;
1392
+ }
1393
+
1394
+ function getArrayU8FromWasm0(ptr, len) {
1395
+ ptr = ptr >>> 0;
1396
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1397
+ }
1398
+
1399
+ let cachedDataViewMemory0 = null;
1400
+ function getDataViewMemory0() {
1401
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1402
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1403
+ }
1404
+ return cachedDataViewMemory0;
1405
+ }
1406
+
1407
+ function getStringFromWasm0(ptr, len) {
1408
+ return decodeText(ptr >>> 0, len);
1409
+ }
1410
+
1411
+ let cachedUint8ArrayMemory0 = null;
1412
+ function getUint8ArrayMemory0() {
1413
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1414
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1415
+ }
1416
+ return cachedUint8ArrayMemory0;
1417
+ }
1418
+
1419
+ function getObject(idx) { return heap[idx]; }
1420
+
1421
+ function handleError(f, args) {
1422
+ try {
1423
+ return f.apply(this, args);
1424
+ } catch (e) {
1425
+ wasm.__wbindgen_export3(addHeapObject(e));
1426
+ }
1427
+ }
1428
+
1429
+ let heap = new Array(1024).fill(undefined);
1430
+ heap.push(undefined, null, true, false);
1431
+
1432
+ let heap_next = heap.length;
1433
+
1434
+ function isLikeNone(x) {
1435
+ return x === undefined || x === null;
1436
+ }
1437
+
1438
+ function makeMutClosure(arg0, arg1, f) {
1439
+ const state = { a: arg0, b: arg1, cnt: 1 };
1440
+ const real = (...args) => {
1441
+
1442
+ // First up with a closure we increment the internal reference
1443
+ // count. This ensures that the Rust closure environment won't
1444
+ // be deallocated while we're invoking it.
1445
+ state.cnt++;
1446
+ const a = state.a;
1447
+ state.a = 0;
1448
+ try {
1449
+ return f(a, state.b, ...args);
1450
+ } finally {
1451
+ state.a = a;
1452
+ real._wbg_cb_unref();
1453
+ }
1454
+ };
1455
+ real._wbg_cb_unref = () => {
1456
+ if (--state.cnt === 0) {
1457
+ wasm.__wbindgen_export4(state.a, state.b);
1458
+ state.a = 0;
1459
+ CLOSURE_DTORS.unregister(state);
1460
+ }
1461
+ };
1462
+ CLOSURE_DTORS.register(real, state, state);
1463
+ return real;
1464
+ }
1465
+
1466
+ function passStringToWasm0(arg, malloc, realloc) {
1467
+ if (realloc === undefined) {
1468
+ const buf = cachedTextEncoder.encode(arg);
1469
+ const ptr = malloc(buf.length, 1) >>> 0;
1470
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1471
+ WASM_VECTOR_LEN = buf.length;
1472
+ return ptr;
1473
+ }
1474
+
1475
+ let len = arg.length;
1476
+ let ptr = malloc(len, 1) >>> 0;
1477
+
1478
+ const mem = getUint8ArrayMemory0();
1479
+
1480
+ let offset = 0;
1481
+
1482
+ for (; offset < len; offset++) {
1483
+ const code = arg.charCodeAt(offset);
1484
+ if (code > 0x7F) break;
1485
+ mem[ptr + offset] = code;
1486
+ }
1487
+ if (offset !== len) {
1488
+ if (offset !== 0) {
1489
+ arg = arg.slice(offset);
1490
+ }
1491
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1492
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1493
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1494
+
1495
+ offset += ret.written;
1496
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1497
+ }
1498
+
1499
+ WASM_VECTOR_LEN = offset;
1500
+ return ptr;
1501
+ }
1502
+
1503
+ function takeObject(idx) {
1504
+ const ret = getObject(idx);
1505
+ dropObject(idx);
1506
+ return ret;
1507
+ }
1508
+
1509
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1510
+ cachedTextDecoder.decode();
1511
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1512
+ let numBytesDecoded = 0;
1513
+ function decodeText(ptr, len) {
1514
+ numBytesDecoded += len;
1515
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1516
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1517
+ cachedTextDecoder.decode();
1518
+ numBytesDecoded = len;
1519
+ }
1520
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1521
+ }
1522
+
1523
+ const cachedTextEncoder = new TextEncoder();
1524
+
1525
+ if (!('encodeInto' in cachedTextEncoder)) {
1526
+ cachedTextEncoder.encodeInto = function (arg, view) {
1527
+ const buf = cachedTextEncoder.encode(arg);
1528
+ view.set(buf);
1529
+ return {
1530
+ read: arg.length,
1531
+ written: buf.length
1532
+ };
1533
+ };
1534
+ }
1535
+
1536
+ let WASM_VECTOR_LEN = 0;
1537
+
1538
+
1539
+ let wasm;
1540
+ export function __wbg_set_wasm(val) {
1541
+ wasm = val;
1542
+ }